Files
bob/assets/index-1d7f1b78.js
2023-09-06 09:30:01 +00:00

4911 lines
1.8 MiB
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{r as $,g as ps,R as f_,c as nP,j as Ne,B as iP}from"./index-4a90bf6b.js";const rP=new Worker(new URL("/assets/script-8e2076e1.js",self.location),{type:"module"});/**
* @license
* Copyright 2010-2023 Three.js Authors
* SPDX-License-Identifier: MIT
*/const Wl="154",iC={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},sP={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},rC=0,O5=1,sC=2,aP=3,aC=0,b2=1,jd=2,sa=3,$a=0,Ki=1,$n=2,oP=2,Kt=0,Ha=1,dp=2,F5=3,k5=4,pp=5,ss=100,oC=101,lC=102,N5=103,G5=104,Hh=200,cC=201,uC=202,hC=203,gp=204,mp=205,I2=206,fC=207,M2=208,dC=209,pC=210,gC=0,mC=1,AC=2,Rm=3,vC=4,yC=5,xC=6,_C=7,a0=0,EC=1,SC=2,os=0,wC=1,CC=2,TC=3,v6=4,bC=5,R2=300,Fl=301,kl=302,Ap=303,vp=304,of=306,Qo=1e3,oi=1001,yp=1002,Rt=1003,Bm=1004,lP=1004,Kd=1005,cP=1005,Tn=1006,y6=1007,uP=1007,Ja=1008,hP=1008,Ri=1009,IC=1010,MC=1011,Au=1012,x6=1013,Oo=1014,br=1015,Ai=1016,_6=1017,E6=1018,ko=1020,RC=1021,li=1023,S6=1024,BC=1025,Bl=1026,Nl=1027,Qc=1028,w6=1029,wh=1030,C6=1031,T6=1033,Ph=33776,lm=33777,cm=33778,Lh=33779,xp=35840,z5=35841,_p=35842,Q5=35843,B2=36196,Ep=37492,Sp=37496,wp=37808,H5=37809,V5=37810,W5=37811,Y5=37812,q5=37813,X5=37814,j5=37815,K5=37816,$5=37817,J5=37818,Z5=37819,ey=37820,ty=37821,Uh=36492,DC=36283,ny=36284,iy=36285,ry=36286,PC=2200,LC=2201,UC=2202,Cp=2300,Tp=2301,um=2302,Hc=2400,Vc=2401,bp=2402,D2=2500,b6=2501,fP=0,dP=1,pP=2,I6=3e3,Dl=3001,OC=3200,P2=3201,Yl=0,FC=1,Pl="",Nt="srgb",fa="srgb-linear",M6="display-p3",gP=0,hm=7680,mP=7681,AP=7682,vP=7683,yP=34055,xP=34056,_P=5386,EP=512,SP=513,wP=514,CP=515,TP=516,bP=517,IP=518,kC=519,NC=512,GC=513,zC=514,QC=515,HC=516,VC=517,WC=518,YC=519,Ip=35044,fm=35048,MP=35040,RP=35045,BP=35049,DP=35041,PP=35046,LP=35050,UP=35042,OP="100",sy="300 es",Dm=1035,za=2e3,Mp=2001;let Yo=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}};const ar=["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 d_=1234567;const jc=Math.PI/180,Vh=180/Math.PI;function ls(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(ar[n&255]+ar[n>>8&255]+ar[n>>16&255]+ar[n>>24&255]+"-"+ar[e&255]+ar[e>>8&255]+"-"+ar[e>>16&15|64]+ar[e>>24&255]+"-"+ar[t&63|128]+ar[t>>8&255]+"-"+ar[t>>16&255]+ar[t>>24&255]+ar[i&255]+ar[i>>8&255]+ar[i>>16&255]+ar[i>>24&255]).toLowerCase()}function si(n,e,t){return Math.max(e,Math.min(t,n))}function R6(n,e){return(n%e+e)%e}function FP(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function kP(n,e,t){return n!==e?(t-n)/(e-n):0}function $d(n,e,t){return(1-t)*n+t*e}function NP(n,e,t,i){return $d(n,e,1-Math.exp(-t*i))}function GP(n,e=1){return e-Math.abs(R6(n,e*2)-e)}function zP(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function QP(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function HP(n,e){return n+Math.floor(Math.random()*(e-n+1))}function VP(n,e){return n+Math.random()*(e-n)}function WP(n){return n*(.5-Math.random())}function YP(n){n!==void 0&&(d_=n);let e=d_+=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 qP(n){return n*jc}function XP(n){return n*Vh}function ay(n){return(n&n-1)===0&&n!==0}function qC(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Pm(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function jP(n,e,t,i,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+i)/2),u=a((e+i)/2),h=s((e-i)/2),f=a((e-i)/2),p=s((i-e)/2),m=a((i-e)/2);switch(r){case"XYX":n.set(o*u,l*h,l*f,o*c);break;case"YZY":n.set(l*f,o*u,l*h,o*c);break;case"ZXZ":n.set(l*h,l*f,o*u,o*c);break;case"XZX":n.set(o*u,l*m,l*p,o*c);break;case"YXY":n.set(l*p,o*u,l*m,o*c);break;case"ZYZ":n.set(l*m,l*p,o*u,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function as(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Wt(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const Ll={DEG2RAD:jc,RAD2DEG:Vh,generateUUID:ls,clamp:si,euclideanModulo:R6,mapLinear:FP,inverseLerp:kP,lerp:$d,damp:NP,pingpong:GP,smoothstep:zP,smootherstep:QP,randInt:HP,randFloat:VP,randFloatSpread:WP,seededRandom:YP,degToRad:qP,radToDeg:XP,isPowerOfTwo:ay,ceilPowerOfTwo:qC,floorPowerOfTwo:Pm,setQuaternionFromProperEuler:jP,normalize:Wt,denormalize:as};class _e{constructor(e=0,t=0){_e.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(si(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*i-a*r+e.x,this.y=s*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Qt{constructor(e,t,i,r,s,a,o,l,c){Qt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c)}set(e,t,i,r,s,a,o,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=i,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],u=i[4],h=i[7],f=i[2],p=i[5],m=i[8],y=r[0],v=r[3],A=r[6],_=r[1],x=r[4],E=r[7],w=r[2],I=r[5],T=r[8];return s[0]=a*y+o*_+l*w,s[3]=a*v+o*x+l*I,s[6]=a*A+o*E+l*T,s[1]=c*y+u*_+h*w,s[4]=c*v+u*x+h*I,s[7]=c*A+u*E+h*T,s[2]=f*y+p*_+m*w,s[5]=f*v+p*x+m*I,s[8]=f*A+p*E+m*T,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-i*s*u+i*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=u*a-o*c,f=o*l-u*s,p=c*s-a*l,m=t*h+i*f+r*p;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/m;return e[0]=h*y,e[1]=(r*c-u*i)*y,e[2]=(o*i-r*a)*y,e[3]=f*y,e[4]=(u*t-r*l)*y,e[5]=(r*s-o*t)*y,e[6]=p*y,e[7]=(i*l-c*t)*y,e[8]=(a*t-i*s)*y,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(qA.makeScale(e,t)),this}rotate(e){return this.premultiply(qA.makeRotation(-e)),this}translate(e,t){return this.premultiply(qA.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const qA=new Qt;function XC(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const KP={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Ch(n,e){return new KP[n](e)}function Rp(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}const p_={};function Jd(n){n in p_||(p_[n]=!0,console.warn(n))}function Oh(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function XA(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const $P=new Qt().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),JP=new Qt().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function ZP(n){return n.convertSRGBToLinear().applyMatrix3(JP)}function eL(n){return n.applyMatrix3($P).convertLinearToSRGB()}const tL={[fa]:n=>n,[Nt]:n=>n.convertSRGBToLinear(),[M6]:ZP},nL={[fa]:n=>n,[Nt]:n=>n.convertLinearToSRGB(),[M6]:eL},Ds={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(n){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!n},get workingColorSpace(){return fa},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=tL[e],r=nL[t];if(i===void 0||r===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)}};let Qu;class B6{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Qu===void 0&&(Qu=Rp("canvas")),Qu.width=e.width,Qu.height=e.height;const i=Qu.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Qu}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Rp("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=Oh(s[a]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(Oh(t[i]/255)*255):t[i]=Oh(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let iL=0;class Wc{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:iL++}),this.uuid=ls(),this.data=e,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(jA(r[a].image)):s.push(jA(r[a]))}else s=jA(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function jA(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?B6.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let rL=0;class Vn extends Yo{constructor(e=Vn.DEFAULT_IMAGE,t=Vn.DEFAULT_MAPPING,i=oi,r=oi,s=Tn,a=Ja,o=li,l=Ri,c=Vn.DEFAULT_ANISOTROPY,u=Pl){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:rL++}),this.uuid=ls(),this.name="",this.source=new Wc(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new _e(0,0),this.repeat=new _e(1,1),this.center=new _e(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Qt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof u=="string"?this.colorSpace=u:(Jd("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=u===Dl?Nt:Pl),this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==R2)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Qo:e.x=e.x-Math.floor(e.x);break;case oi:e.x=e.x<0?0:1;break;case yp: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 Qo:e.y=e.y-Math.floor(e.y);break;case oi:e.y=e.y<0?0:1;break;case yp:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return Jd("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Nt?Dl:I6}set encoding(e){Jd("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Dl?Nt:Pl}}Vn.DEFAULT_IMAGE=null;Vn.DEFAULT_MAPPING=R2;Vn.DEFAULT_ANISOTROPY=1;class jt{constructor(e=0,t=0,i=0,r=1){jt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],u=l[4],h=l[8],f=l[1],p=l[5],m=l[9],y=l[2],v=l[6],A=l[10];if(Math.abs(u-f)<.01&&Math.abs(h-y)<.01&&Math.abs(m-v)<.01){if(Math.abs(u+f)<.1&&Math.abs(h+y)<.1&&Math.abs(m+v)<.1&&Math.abs(c+p+A-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const x=(c+1)/2,E=(p+1)/2,w=(A+1)/2,I=(u+f)/4,T=(h+y)/4,M=(m+v)/4;return x>E&&x>w?x<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(x),r=I/i,s=T/i):E>w?E<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(E),i=I/r,s=M/r):w<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(w),i=T/s,r=M/s),this.set(i,r,s,t),this}let _=Math.sqrt((v-m)*(v-m)+(h-y)*(h-y)+(f-u)*(f-u));return Math.abs(_)<.001&&(_=1),this.x=(v-m)/_,this.y=(h-y)/_,this.z=(f-u)/_,this.w=Math.acos((c+p+A-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Dn extends Yo{constructor(e=1,t=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new jt(0,0,e,t),this.scissorTest=!1,this.viewport=new jt(0,0,e,t);const r={width:e,height:t,depth:1};i.encoding!==void 0&&(Jd("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===Dl?Nt:Pl),this.texture=new Vn(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.internalFormat=i.internalFormat!==void 0?i.internalFormat:null,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:Tn,this.depthBuffer=i.depthBuffer!==void 0?i.depthBuffer:!0,this.stencilBuffer=i.stencilBuffer!==void 0?i.stencilBuffer:!1,this.depthTexture=i.depthTexture!==void 0?i.depthTexture:null,this.samples=i.samples!==void 0?i.samples:0}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Wc(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class L2 extends Vn{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Rt,this.minFilter=Rt,this.wrapR=oi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class sL extends Dn{constructor(e=1,t=1,i=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new L2(null,e,t,i),this.texture.isRenderTargetTexture=!0}}let D6=class extends Vn{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Rt,this.minFilter=Rt,this.wrapR=oi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};class aL extends Dn{constructor(e=1,t=1,i=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new D6(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class oL extends Dn{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let a=0;a<i;a++)this.texture[a]=s.clone(),this.texture[a].isRenderTargetTexture=!0}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.texture.length;r<s;r++)this.texture[r].image.width=e,this.texture[r].image.height=t,this.texture[r].image.depth=i;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(let t=0,i=e.texture.length;t<i;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}}class $i{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,a,o){let l=i[r+0],c=i[r+1],u=i[r+2],h=i[r+3];const f=s[a+0],p=s[a+1],m=s[a+2],y=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h;return}if(o===1){e[t+0]=f,e[t+1]=p,e[t+2]=m,e[t+3]=y;return}if(h!==y||l!==f||c!==p||u!==m){let v=1-o;const A=l*f+c*p+u*m+h*y,_=A>=0?1:-1,x=1-A*A;if(x>Number.EPSILON){const w=Math.sqrt(x),I=Math.atan2(w,A*_);v=Math.sin(v*I)/w,o=Math.sin(o*I)/w}const E=o*_;if(l=l*v+f*E,c=c*v+p*E,u=u*v+m*E,h=h*v+y*E,v===1-o){const w=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=w,c*=w,u*=w,h*=w}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,r,s,a){const o=i[r],l=i[r+1],c=i[r+2],u=i[r+3],h=s[a],f=s[a+1],p=s[a+2],m=s[a+3];return e[t]=o*m+u*h+l*p-c*f,e[t+1]=l*m+u*f+c*h-o*p,e[t+2]=c*m+u*p+o*f-l*h,e[t+3]=u*m-o*h-l*f-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const i=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(i/2),u=o(r/2),h=o(s/2),f=l(i/2),p=l(r/2),m=l(s/2);switch(a){case"XYZ":this._x=f*u*h+c*p*m,this._y=c*p*h-f*u*m,this._z=c*u*m+f*p*h,this._w=c*u*h-f*p*m;break;case"YXZ":this._x=f*u*h+c*p*m,this._y=c*p*h-f*u*m,this._z=c*u*m-f*p*h,this._w=c*u*h+f*p*m;break;case"ZXY":this._x=f*u*h-c*p*m,this._y=c*p*h+f*u*m,this._z=c*u*m+f*p*h,this._w=c*u*h-f*p*m;break;case"ZYX":this._x=f*u*h-c*p*m,this._y=c*p*h+f*u*m,this._z=c*u*m-f*p*h,this._w=c*u*h+f*p*m;break;case"YZX":this._x=f*u*h+c*p*m,this._y=c*p*h+f*u*m,this._z=c*u*m-f*p*h,this._w=c*u*h-f*p*m;break;case"XZY":this._x=f*u*h-c*p*m,this._y=c*p*h-f*u*m,this._z=c*u*m+f*p*h,this._w=c*u*h+f*p*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],u=t[6],h=t[10],f=i+o+h;if(f>0){const p=.5/Math.sqrt(f+1);this._w=.25/p,this._x=(u-l)*p,this._y=(s-c)*p,this._z=(a-r)*p}else if(i>o&&i>h){const p=2*Math.sqrt(1+i-o-h);this._w=(u-l)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(s+c)/p}else if(o>h){const p=2*Math.sqrt(1+o-i-h);this._w=(s-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+h-i-o);this._w=(a-r)/p,this._x=(s+c)/p,this._y=(l+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(si(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+a*o+r*c-s*l,this._y=r*u+a*l+s*o-i*c,this._z=s*u+a*c+i*l-r*o,this._w=a*u-i*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+i*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=i,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const p=1-t;return this._w=p*a+t*this._w,this._x=p*i+t*this._x,this._y=p*r+t*this._y,this._z=p*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,o),h=Math.sin((1-t)*u)/c,f=Math.sin(t*u)/c;return this._w=a*h+this._w*f,this._x=i*h+this._x*f,this._y=r*h+this._y*f,this._z=s*h+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(r),i*Math.sin(s),i*Math.cos(s),t*Math.sin(r))}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}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 N{constructor(e=0,t=0,i=0){N.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(g_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(g_.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=l*t+a*r-o*i,u=l*i+o*t-s*r,h=l*r+s*i-a*t,f=-s*t-a*i-o*r;return this.x=c*l+f*-s+u*-o-h*-a,this.y=u*l+f*-a+h*-s-c*-o,this.z=h*l+f*-o+c*-a-u*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-i*l,this.z=i*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return KA.copy(this).projectOnVector(e),this.sub(KA)}reflect(e){return this.sub(KA.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(si(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const KA=new N,g_=new $i;class gs{constructor(e=new N(1/0,1/0,1/0),t=new N(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(Eo.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(Eo.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Eo.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){if(e.updateWorldMatrix(!1,!1),e.boundingBox!==void 0)e.boundingBox===null&&e.computeBoundingBox(),Hu.copy(e.boundingBox),Hu.applyMatrix4(e.matrixWorld),this.union(Hu);else{const r=e.geometry;if(r!==void 0)if(t&&r.attributes!==void 0&&r.attributes.position!==void 0){const s=r.attributes.position;for(let a=0,o=s.count;a<o;a++)Eo.fromBufferAttribute(s,a).applyMatrix4(e.matrixWorld),this.expandByPoint(Eo)}else r.boundingBox===null&&r.computeBoundingBox(),Hu.copy(r.boundingBox),Hu.applyMatrix4(e.matrixWorld),this.union(Hu)}const i=e.children;for(let r=0,s=i.length;r<s;r++)this.expandByObject(i[r],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Eo),Eo.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(qf),N3.subVectors(this.max,qf),Vu.subVectors(e.a,qf),Wu.subVectors(e.b,qf),Yu.subVectors(e.c,qf),hl.subVectors(Wu,Vu),fl.subVectors(Yu,Wu),vc.subVectors(Vu,Yu);let t=[0,-hl.z,hl.y,0,-fl.z,fl.y,0,-vc.z,vc.y,hl.z,0,-hl.x,fl.z,0,-fl.x,vc.z,0,-vc.x,-hl.y,hl.x,0,-fl.y,fl.x,0,-vc.y,vc.x,0];return!$A(t,Vu,Wu,Yu,N3)||(t=[1,0,0,0,1,0,0,0,1],!$A(t,Vu,Wu,Yu,N3))?!1:(G3.crossVectors(hl,fl),t=[G3.x,G3.y,G3.z],$A(t,Vu,Wu,Yu,N3))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Eo).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Eo).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:(_o[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_o[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_o[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_o[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_o[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_o[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_o[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_o[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_o),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 _o=[new N,new N,new N,new N,new N,new N,new N,new N],Eo=new N,Hu=new gs,Vu=new N,Wu=new N,Yu=new N,hl=new N,fl=new N,vc=new N,qf=new N,N3=new N,G3=new N,yc=new N;function $A(n,e,t,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){yc.fromArray(n,s);const o=r.x*Math.abs(yc.x)+r.y*Math.abs(yc.y)+r.z*Math.abs(yc.z),l=e.dot(yc),c=t.dot(yc),u=i.dot(yc);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const lL=new gs,Xf=new N,JA=new N;let ms=class{constructor(e=new N,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):lL.setFromPoints(e).getCenter(i);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Xf.subVectors(e,this.center);const t=Xf.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Xf,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(JA.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Xf.copy(e.center).add(JA)),this.expandByPoint(Xf.copy(e.center).sub(JA))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};const So=new N,ZA=new N,z3=new N,dl=new N,ev=new N,Q3=new N,tv=new N;class lf{constructor(e=new N,t=new N(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,So)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=So.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(So.copy(this.origin).addScaledVector(this.direction,t),So.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){ZA.copy(e).add(t).multiplyScalar(.5),z3.copy(t).sub(e).normalize(),dl.copy(this.origin).sub(ZA);const s=e.distanceTo(t)*.5,a=-this.direction.dot(z3),o=dl.dot(this.direction),l=-dl.dot(z3),c=dl.lengthSq(),u=Math.abs(1-a*a);let h,f,p,m;if(u>0)if(h=a*l-o,f=a*o-l,m=s*u,h>=0)if(f>=-m)if(f<=m){const y=1/u;h*=y,f*=y,p=h*(h+a*f+2*o)+f*(a*h+f+2*l)+c}else f=s,h=Math.max(0,-(a*f+o)),p=-h*h+f*(f+2*l)+c;else f=-s,h=Math.max(0,-(a*f+o)),p=-h*h+f*(f+2*l)+c;else f<=-m?(h=Math.max(0,-(-a*s+o)),f=h>0?-s:Math.min(Math.max(-s,-l),s),p=-h*h+f*(f+2*l)+c):f<=m?(h=0,f=Math.min(Math.max(-s,-l),s),p=f*(f+2*l)+c):(h=Math.max(0,-(a*s+o)),f=h>0?s:Math.min(Math.max(-s,-l),s),p=-h*h+f*(f+2*l)+c);else f=a>0?-s:s,h=Math.max(0,-(a*f+o)),p=-h*h+f*(f+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(ZA).addScaledVector(z3,f),p}intersectSphere(e,t){So.subVectors(e.center,this.origin);const i=So.dot(this.direction),r=So.dot(So)-i*i,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=i-a,l=i+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,o,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return c>=0?(i=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(i=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),u>=0?(s=(e.min.y-f.y)*u,a=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,a=(e.min.y-f.y)*u),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),h>=0?(o=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(o=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),i>l||o>r)||((o>i||i!==i)&&(i=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,So)!==null}intersectTriangle(e,t,i,r,s){ev.subVectors(t,e),Q3.subVectors(i,e),tv.crossVectors(ev,Q3);let a=this.direction.dot(tv),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;dl.subVectors(this.origin,e);const l=o*this.direction.dot(Q3.crossVectors(dl,Q3));if(l<0)return null;const c=o*this.direction.dot(ev.cross(dl));if(c<0||l+c>a)return null;const u=-o*dl.dot(tv);return u<0?null:this.at(u/a,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 ct{constructor(e,t,i,r,s,a,o,l,c,u,h,f,p,m,y,v){ct.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c,u,h,f,p,m,y,v)}set(e,t,i,r,s,a,o,l,c,u,h,f,p,m,y,v){const A=this.elements;return A[0]=e,A[4]=t,A[8]=i,A[12]=r,A[1]=s,A[5]=a,A[9]=o,A[13]=l,A[2]=c,A[6]=u,A[10]=h,A[14]=f,A[3]=p,A[7]=m,A[11]=y,A[15]=v,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 ct().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/qu.setFromMatrixColumn(e,0).length(),s=1/qu.setFromMatrixColumn(e,1).length(),a=1/qu.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const f=a*u,p=a*h,m=o*u,y=o*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=p+m*c,t[5]=f-y*c,t[9]=-o*l,t[2]=y-f*c,t[6]=m+p*c,t[10]=a*l}else if(e.order==="YXZ"){const f=l*u,p=l*h,m=c*u,y=c*h;t[0]=f+y*o,t[4]=m*o-p,t[8]=a*c,t[1]=a*h,t[5]=a*u,t[9]=-o,t[2]=p*o-m,t[6]=y+f*o,t[10]=a*l}else if(e.order==="ZXY"){const f=l*u,p=l*h,m=c*u,y=c*h;t[0]=f-y*o,t[4]=-a*h,t[8]=m+p*o,t[1]=p+m*o,t[5]=a*u,t[9]=y-f*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const f=a*u,p=a*h,m=o*u,y=o*h;t[0]=l*u,t[4]=m*c-p,t[8]=f*c+y,t[1]=l*h,t[5]=y*c+f,t[9]=p*c-m,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const f=a*l,p=a*c,m=o*l,y=o*c;t[0]=l*u,t[4]=y-f*h,t[8]=m*h+p,t[1]=h,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=p*h+m,t[10]=f-y*h}else if(e.order==="XZY"){const f=a*l,p=a*c,m=o*l,y=o*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=f*h+y,t[5]=a*u,t[9]=p*h-m,t[2]=m*h-p,t[6]=o*u,t[10]=y*h+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(cL,e,uL)}lookAt(e,t,i){const r=this.elements;return ns.subVectors(e,t),ns.lengthSq()===0&&(ns.z=1),ns.normalize(),pl.crossVectors(i,ns),pl.lengthSq()===0&&(Math.abs(i.z)===1?ns.x+=1e-4:ns.z+=1e-4,ns.normalize(),pl.crossVectors(i,ns)),pl.normalize(),H3.crossVectors(ns,pl),r[0]=pl.x,r[4]=H3.x,r[8]=ns.x,r[1]=pl.y,r[5]=H3.y,r[9]=ns.y,r[2]=pl.z,r[6]=H3.z,r[10]=ns.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],u=i[1],h=i[5],f=i[9],p=i[13],m=i[2],y=i[6],v=i[10],A=i[14],_=i[3],x=i[7],E=i[11],w=i[15],I=r[0],T=r[4],M=r[8],b=r[12],B=r[1],L=r[5],U=r[9],O=r[13],Q=r[2],G=r[6],F=r[10],q=r[14],Y=r[3],H=r[7],V=r[11],D=r[15];return s[0]=a*I+o*B+l*Q+c*Y,s[4]=a*T+o*L+l*G+c*H,s[8]=a*M+o*U+l*F+c*V,s[12]=a*b+o*O+l*q+c*D,s[1]=u*I+h*B+f*Q+p*Y,s[5]=u*T+h*L+f*G+p*H,s[9]=u*M+h*U+f*F+p*V,s[13]=u*b+h*O+f*q+p*D,s[2]=m*I+y*B+v*Q+A*Y,s[6]=m*T+y*L+v*G+A*H,s[10]=m*M+y*U+v*F+A*V,s[14]=m*b+y*O+v*q+A*D,s[3]=_*I+x*B+E*Q+w*Y,s[7]=_*T+x*L+E*G+w*H,s[11]=_*M+x*U+E*F+w*V,s[15]=_*b+x*O+E*q+w*D,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],h=e[6],f=e[10],p=e[14],m=e[3],y=e[7],v=e[11],A=e[15];return m*(+s*l*h-r*c*h-s*o*f+i*c*f+r*o*p-i*l*p)+y*(+t*l*p-t*c*f+s*a*f-r*a*p+r*c*u-s*l*u)+v*(+t*c*h-t*o*p-s*a*h+i*a*p+s*o*u-i*c*u)+A*(-r*o*u-t*l*h+t*o*f+r*a*h-i*a*f+i*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],p=e[11],m=e[12],y=e[13],v=e[14],A=e[15],_=h*v*c-y*f*c+y*l*p-o*v*p-h*l*A+o*f*A,x=m*f*c-u*v*c-m*l*p+a*v*p+u*l*A-a*f*A,E=u*y*c-m*h*c+m*o*p-a*y*p-u*o*A+a*h*A,w=m*h*l-u*y*l-m*o*f+a*y*f+u*o*v-a*h*v,I=t*_+i*x+r*E+s*w;if(I===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/I;return e[0]=_*T,e[1]=(y*f*s-h*v*s-y*r*p+i*v*p+h*r*A-i*f*A)*T,e[2]=(o*v*s-y*l*s+y*r*c-i*v*c-o*r*A+i*l*A)*T,e[3]=(h*l*s-o*f*s-h*r*c+i*f*c+o*r*p-i*l*p)*T,e[4]=x*T,e[5]=(u*v*s-m*f*s+m*r*p-t*v*p-u*r*A+t*f*A)*T,e[6]=(m*l*s-a*v*s-m*r*c+t*v*c+a*r*A-t*l*A)*T,e[7]=(a*f*s-u*l*s+u*r*c-t*f*c-a*r*p+t*l*p)*T,e[8]=E*T,e[9]=(m*h*s-u*y*s-m*i*p+t*y*p+u*i*A-t*h*A)*T,e[10]=(a*y*s-m*o*s+m*i*c-t*y*c-a*i*A+t*o*A)*T,e[11]=(u*o*s-a*h*s-u*i*c+t*h*c+a*i*p-t*o*p)*T,e[12]=w*T,e[13]=(u*y*r-m*h*r+m*i*f-t*y*f-u*i*v+t*h*v)*T,e[14]=(m*o*r-a*y*r-m*i*l+t*y*l+a*i*v-t*o*v)*T,e[15]=(a*h*r-u*o*r+u*i*l-t*h*l-a*i*f+t*o*f)*T,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,a=e.x,o=e.y,l=e.z,c=s*a,u=s*o;return this.set(c*a+i,c*o-r*l,c*l+r*o,0,c*o+r*l,u*o+i,u*l-r*a,0,c*l-r*o,u*l+r*a,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,u=a+a,h=o+o,f=s*c,p=s*u,m=s*h,y=a*u,v=a*h,A=o*h,_=l*c,x=l*u,E=l*h,w=i.x,I=i.y,T=i.z;return r[0]=(1-(y+A))*w,r[1]=(p+E)*w,r[2]=(m-x)*w,r[3]=0,r[4]=(p-E)*I,r[5]=(1-(f+A))*I,r[6]=(v+_)*I,r[7]=0,r[8]=(m+x)*T,r[9]=(v-_)*T,r[10]=(1-(f+y))*T,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=qu.set(r[0],r[1],r[2]).length();const a=qu.set(r[4],r[5],r[6]).length(),o=qu.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Js.copy(this);const c=1/s,u=1/a,h=1/o;return Js.elements[0]*=c,Js.elements[1]*=c,Js.elements[2]*=c,Js.elements[4]*=u,Js.elements[5]*=u,Js.elements[6]*=u,Js.elements[8]*=h,Js.elements[9]*=h,Js.elements[10]*=h,t.setFromRotationMatrix(Js),i.x=s,i.y=a,i.z=o,this}makePerspective(e,t,i,r,s,a,o=za){const l=this.elements,c=2*s/(t-e),u=2*s/(i-r),h=(t+e)/(t-e),f=(i+r)/(i-r);let p,m;if(o===za)p=-(a+s)/(a-s),m=-2*a*s/(a-s);else if(o===Mp)p=-a/(a-s),m=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,a,o=za){const l=this.elements,c=1/(t-e),u=1/(i-r),h=1/(a-s),f=(t+e)*c,p=(i+r)*u;let m,y;if(o===za)m=(a+s)*h,y=-2*h;else if(o===Mp)m=s*h,y=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=y,l[14]=-m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const qu=new N,Js=new ct,cL=new N(0,0,0),uL=new N(1,1,1),pl=new N,H3=new N,ns=new N,m_=new ct,A_=new $i;class vu{constructor(e=0,t=0,i=0,r=vu.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],u=r[9],h=r[2],f=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(si(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-si(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(si(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-si(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(si(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-si(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return m_.makeRotationFromQuaternion(e),this.setFromRotationMatrix(m_,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return A_.setFromEuler(this),this.setFromQuaternion(A_,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}}vu.DEFAULT_ORDER="XYZ";class Kc{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 hL=0;const v_=new N,Xu=new $i,wo=new ct,V3=new N,jf=new N,fL=new N,dL=new $i,y_=new N(1,0,0),x_=new N(0,1,0),__=new N(0,0,1),pL={type:"added"},E_={type:"removed"};class fn extends Yo{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:hL++}),this.uuid=ls(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=fn.DEFAULT_UP.clone();const e=new N,t=new vu,i=new $i,r=new N(1,1,1);function s(){i.setFromEuler(t,!1)}function a(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new ct},normalMatrix:{value:new Qt}}),this.matrix=new ct,this.matrixWorld=new ct,this.matrixAutoUpdate=fn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=fn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new Kc,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}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 Xu.setFromAxisAngle(e,t),this.quaternion.multiply(Xu),this}rotateOnWorldAxis(e,t){return Xu.setFromAxisAngle(e,t),this.quaternion.premultiply(Xu),this}rotateX(e){return this.rotateOnAxis(y_,e)}rotateY(e){return this.rotateOnAxis(x_,e)}rotateZ(e){return this.rotateOnAxis(__,e)}translateOnAxis(e,t){return v_.copy(e).applyQuaternion(this.quaternion),this.position.add(v_.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(y_,e)}translateY(e){return this.translateOnAxis(x_,e)}translateZ(e){return this.translateOnAxis(__,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(wo.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?V3.copy(e):V3.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),jf.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?wo.lookAt(jf,V3,this.up):wo.lookAt(V3,jf,this.up),this.quaternion.setFromRotationMatrix(wo),r&&(wo.extractRotation(r.matrixWorld),Xu.setFromRotationMatrix(wo),this.quaternion.premultiply(Xu.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(pL)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(E_)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(E_)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),wo.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),wo.multiply(e.parent.matrixWorld)),e.applyMatrix4(wo),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){const a=this.children[i].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t){let i=[];this[e]===t&&i.push(this);for(let r=0,s=this.children.length;r<s;r++){const a=this.children[r].getObjectsByProperty(e,t);a.length>0&&(i=i.concat(a))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(jf,e,fL),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(jf,dL,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++){const s=t[i];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.matrixWorldAutoUpdate===!0&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++){const o=r[s];o.matrixWorldAutoUpdate===!0&&o.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const h=l[c];s(e.shapes,h)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),u=a(e.images),h=a(e.shapes),f=a(e.skeletons),p=a(e.animations),m=a(e.nodes);o.length>0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),h.length>0&&(i.shapes=h),f.length>0&&(i.skeletons=f),p.length>0&&(i.animations=p),m.length>0&&(i.nodes=m)}return i.object=r,i;function a(o){const l=[];for(const c in o){const u=o[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}fn.DEFAULT_UP=new N(0,1,0);fn.DEFAULT_MATRIX_AUTO_UPDATE=!0;fn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Zs=new N,Co=new N,nv=new N,To=new N,ju=new N,Ku=new N,S_=new N,iv=new N,rv=new N,sv=new N;let W3=!1;class Qr{constructor(e=new N,t=new N,i=new N){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),Zs.subVectors(e,t),r.cross(Zs);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){Zs.subVectors(r,t),Co.subVectors(i,t),nv.subVectors(e,t);const a=Zs.dot(Zs),o=Zs.dot(Co),l=Zs.dot(nv),c=Co.dot(Co),u=Co.dot(nv),h=a*c-o*o;if(h===0)return s.set(-2,-1,-1);const f=1/h,p=(c*l-o*u)*f,m=(a*u-o*l)*f;return s.set(1-p-m,m,p)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,To),To.x>=0&&To.y>=0&&To.x+To.y<=1}static getUV(e,t,i,r,s,a,o,l){return W3===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),W3=!0),this.getInterpolation(e,t,i,r,s,a,o,l)}static getInterpolation(e,t,i,r,s,a,o,l){return this.getBarycoord(e,t,i,r,To),l.setScalar(0),l.addScaledVector(s,To.x),l.addScaledVector(a,To.y),l.addScaledVector(o,To.z),l}static isFrontFacing(e,t,i,r){return Zs.subVectors(i,t),Co.subVectors(e,t),Zs.cross(Co).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Zs.subVectors(this.c,this.b),Co.subVectors(this.a,this.b),Zs.cross(Co).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Qr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Qr.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,s){return W3===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),W3=!0),Qr.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}getInterpolation(e,t,i,r,s){return Qr.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return Qr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Qr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let a,o;ju.subVectors(r,i),Ku.subVectors(s,i),iv.subVectors(e,i);const l=ju.dot(iv),c=Ku.dot(iv);if(l<=0&&c<=0)return t.copy(i);rv.subVectors(e,r);const u=ju.dot(rv),h=Ku.dot(rv);if(u>=0&&h<=u)return t.copy(r);const f=l*h-u*c;if(f<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(i).addScaledVector(ju,a);sv.subVectors(e,s);const p=ju.dot(sv),m=Ku.dot(sv);if(m>=0&&p<=m)return t.copy(s);const y=p*c-l*m;if(y<=0&&c>=0&&m<=0)return o=c/(c-m),t.copy(i).addScaledVector(Ku,o);const v=u*m-p*h;if(v<=0&&h-u>=0&&p-m>=0)return S_.subVectors(s,r),o=(h-u)/(h-u+(p-m)),t.copy(r).addScaledVector(S_,o);const A=1/(v+y+f);return a=y*A,o=f*A,t.copy(i).addScaledVector(ju,a).addScaledVector(Ku,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let gL=0;class Ji extends Yo{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:gL++}),this.uuid=ls(),this.name="",this.type="Material",this.blending=Ha,this.side=$a,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=gp,this.blendDst=mp,this.blendEquation=ss,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Rm,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=kC,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=hm,this.stencilZFail=hm,this.stencilZPass=hm,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Ha&&(i.blending=this.blending),this.side!==$a&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=this.alphaHash),this.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(i.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=this.flatShading),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const jC={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},ea={h:0,s:0,l:0},Y3={h:0,s:0,l:0};function av(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}let He=class{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Nt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ds.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=Ds.workingColorSpace){return this.r=e,this.g=t,this.b=i,Ds.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=Ds.workingColorSpace){if(e=R6(e,1),t=si(t,0,1),i=si(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=av(a,s,e+1/3),this.g=av(a,s,e),this.b=av(a,s,e-1/3)}return Ds.toWorkingColorSpace(this,r),this}setStyle(e,t=Nt){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Nt){const i=jC[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Oh(e.r),this.g=Oh(e.g),this.b=Oh(e.b),this}copyLinearToSRGB(e){return this.r=XA(e.r),this.g=XA(e.g),this.b=XA(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Nt){return Ds.fromWorkingColorSpace(or.copy(this),e),Math.round(si(or.r*255,0,255))*65536+Math.round(si(or.g*255,0,255))*256+Math.round(si(or.b*255,0,255))}getHexString(e=Nt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ds.workingColorSpace){Ds.fromWorkingColorSpace(or.copy(this),t);const i=or.r,r=or.g,s=or.b,a=Math.max(i,r,s),o=Math.min(i,r,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const h=a-o;switch(c=u<=.5?h/(a+o):h/(2-a-o),a){case i:l=(r-s)/h+(r<s?6:0);break;case r:l=(s-i)/h+2;break;case s:l=(i-r)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=Ds.workingColorSpace){return Ds.fromWorkingColorSpace(or.copy(this),t),e.r=or.r,e.g=or.g,e.b=or.b,e}getStyle(e=Nt){Ds.fromWorkingColorSpace(or.copy(this),e);const t=or.r,i=or.g,r=or.b;return e!==Nt?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(ea),ea.h+=e,ea.s+=t,ea.l+=i,this.setHSL(ea.h,ea.s,ea.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(ea),e.getHSL(Y3);const i=$d(ea.h,Y3.h,t),r=$d(ea.s,Y3.s,t),s=$d(ea.l,Y3.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};const or=new He;He.NAMES=jC;class cs extends Ji{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new He(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=a0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Uo=mL();function mL(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;!(c&8388608);)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}function zr(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=si(n,-65504,65504),Uo.floatView[0]=n;const e=Uo.uint32View[0],t=e>>23&511;return Uo.baseTable[t]+((e&8388607)>>Uo.shiftTable[t])}function Nd(n){const e=n>>10;return Uo.uint32View[0]=Uo.mantissaTable[Uo.offsetTable[e]+(n&1023)]+Uo.exponentTable[e],Uo.floatView[0]}const AL={toHalfFloat:zr,fromHalfFloat:Nd},Ei=new N,q3=new _e;class En{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Ip,this.updateRange={offset:0,count:-1},this.gpuType=br,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)q3.fromBufferAttribute(this,t),q3.applyMatrix3(e),this.setXY(t,q3.x,q3.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Ei.fromBufferAttribute(this,t),Ei.applyMatrix3(e),this.setXYZ(t,Ei.x,Ei.y,Ei.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Ei.fromBufferAttribute(this,t),Ei.applyMatrix4(e),this.setXYZ(t,Ei.x,Ei.y,Ei.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Ei.fromBufferAttribute(this,t),Ei.applyNormalMatrix(e),this.setXYZ(t,Ei.x,Ei.y,Ei.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Ei.fromBufferAttribute(this,t),Ei.transformDirection(e),this.setXYZ(t,Ei.x,Ei.y,Ei.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=as(t,this.array)),t}setX(e,t){return this.normalized&&(t=Wt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=as(t,this.array)),t}setY(e,t){return this.normalized&&(t=Wt(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=as(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Wt(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=as(t,this.array)),t}setW(e,t){return this.normalized&&(t=Wt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Wt(t,this.array),i=Wt(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Wt(t,this.array),i=Wt(i,this.array),r=Wt(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Wt(t,this.array),i=Wt(i,this.array),r=Wt(r,this.array),s=Wt(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Ip&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}}class vL extends En{constructor(e,t,i){super(new Int8Array(e),t,i)}}class yL extends En{constructor(e,t,i){super(new Uint8Array(e),t,i)}}class xL extends En{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}}class _L extends En{constructor(e,t,i){super(new Int16Array(e),t,i)}}class P6 extends En{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class EL extends En{constructor(e,t,i){super(new Int32Array(e),t,i)}}class U2 extends En{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class SL extends En{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}getX(e){let t=Nd(this.array[e*this.itemSize]);return this.normalized&&(t=as(t,this.array)),t}setX(e,t){return this.normalized&&(t=Wt(t,this.array)),this.array[e*this.itemSize]=zr(t),this}getY(e){let t=Nd(this.array[e*this.itemSize+1]);return this.normalized&&(t=as(t,this.array)),t}setY(e,t){return this.normalized&&(t=Wt(t,this.array)),this.array[e*this.itemSize+1]=zr(t),this}getZ(e){let t=Nd(this.array[e*this.itemSize+2]);return this.normalized&&(t=as(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Wt(t,this.array)),this.array[e*this.itemSize+2]=zr(t),this}getW(e){let t=Nd(this.array[e*this.itemSize+3]);return this.normalized&&(t=as(t,this.array)),t}setW(e,t){return this.normalized&&(t=Wt(t,this.array)),this.array[e*this.itemSize+3]=zr(t),this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Wt(t,this.array),i=Wt(i,this.array)),this.array[e+0]=zr(t),this.array[e+1]=zr(i),this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Wt(t,this.array),i=Wt(i,this.array),r=Wt(r,this.array)),this.array[e+0]=zr(t),this.array[e+1]=zr(i),this.array[e+2]=zr(r),this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Wt(t,this.array),i=Wt(i,this.array),r=Wt(r,this.array),s=Wt(s,this.array)),this.array[e+0]=zr(t),this.array[e+1]=zr(i),this.array[e+2]=zr(r),this.array[e+3]=zr(s),this}}class ot extends En{constructor(e,t,i){super(new Float32Array(e),t,i)}}class wL extends En{constructor(e,t,i){super(new Float64Array(e),t,i)}}let CL=0;const Is=new ct,ov=new fn,$u=new N,is=new gs,Kf=new gs,zi=new N;class Bt extends Yo{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:CL++}),this.uuid=ls(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(XC(e)?U2:P6)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new Qt().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Is.makeRotationFromQuaternion(e),this.applyMatrix4(Is),this}rotateX(e){return Is.makeRotationX(e),this.applyMatrix4(Is),this}rotateY(e){return Is.makeRotationY(e),this.applyMatrix4(Is),this}rotateZ(e){return Is.makeRotationZ(e),this.applyMatrix4(Is),this}translate(e,t,i){return Is.makeTranslation(e,t,i),this.applyMatrix4(Is),this}scale(e,t,i){return Is.makeScale(e,t,i),this.applyMatrix4(Is),this}lookAt(e){return ov.lookAt(e),ov.updateMatrix(),this.applyMatrix4(ov.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter($u).negate(),this.translate($u.x,$u.y,$u.z),this}setFromPoints(e){const t=[];for(let i=0,r=e.length;i<r;i++){const s=e[i];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new ot(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new gs);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new N(-1/0,-1/0,-1/0),new N(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];is.setFromBufferAttribute(s),this.morphTargetsRelative?(zi.addVectors(this.boundingBox.min,is.min),this.boundingBox.expandByPoint(zi),zi.addVectors(this.boundingBox.max,is.max),this.boundingBox.expandByPoint(zi)):(this.boundingBox.expandByPoint(is.min),this.boundingBox.expandByPoint(is.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ms);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new N,1/0);return}if(e){const i=this.boundingSphere.center;if(is.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Kf.setFromBufferAttribute(o),this.morphTargetsRelative?(zi.addVectors(is.min,Kf.min),is.expandByPoint(zi),zi.addVectors(is.max,Kf.max),is.expandByPoint(zi)):(is.expandByPoint(Kf.min),is.expandByPoint(Kf.max))}is.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;s++)zi.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(zi));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,u=o.count;c<u;c++)zi.fromBufferAttribute(o,c),l&&($u.fromBufferAttribute(e,c),zi.add($u)),r=Math.max(r,i.distanceToSquared(zi))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=e.array,r=t.position.array,s=t.normal.array,a=t.uv.array,o=r.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new En(new Float32Array(4*o),4));const l=this.getAttribute("tangent").array,c=[],u=[];for(let B=0;B<o;B++)c[B]=new N,u[B]=new N;const h=new N,f=new N,p=new N,m=new _e,y=new _e,v=new _e,A=new N,_=new N;function x(B,L,U){h.fromArray(r,B*3),f.fromArray(r,L*3),p.fromArray(r,U*3),m.fromArray(a,B*2),y.fromArray(a,L*2),v.fromArray(a,U*2),f.sub(h),p.sub(h),y.sub(m),v.sub(m);const O=1/(y.x*v.y-v.x*y.y);isFinite(O)&&(A.copy(f).multiplyScalar(v.y).addScaledVector(p,-y.y).multiplyScalar(O),_.copy(p).multiplyScalar(y.x).addScaledVector(f,-v.x).multiplyScalar(O),c[B].add(A),c[L].add(A),c[U].add(A),u[B].add(_),u[L].add(_),u[U].add(_))}let E=this.groups;E.length===0&&(E=[{start:0,count:i.length}]);for(let B=0,L=E.length;B<L;++B){const U=E[B],O=U.start,Q=U.count;for(let G=O,F=O+Q;G<F;G+=3)x(i[G+0],i[G+1],i[G+2])}const w=new N,I=new N,T=new N,M=new N;function b(B){T.fromArray(s,B*3),M.copy(T);const L=c[B];w.copy(L),w.sub(T.multiplyScalar(T.dot(L))).normalize(),I.crossVectors(M,L);const O=I.dot(u[B])<0?-1:1;l[B*4]=w.x,l[B*4+1]=w.y,l[B*4+2]=w.z,l[B*4+3]=O}for(let B=0,L=E.length;B<L;++B){const U=E[B],O=U.start,Q=U.count;for(let G=O,F=O+Q;G<F;G+=3)b(i[G+0]),b(i[G+1]),b(i[G+2])}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new En(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let f=0,p=i.count;f<p;f++)i.setXYZ(f,0,0,0);const r=new N,s=new N,a=new N,o=new N,l=new N,c=new N,u=new N,h=new N;if(e)for(let f=0,p=e.count;f<p;f+=3){const m=e.getX(f+0),y=e.getX(f+1),v=e.getX(f+2);r.fromBufferAttribute(t,m),s.fromBufferAttribute(t,y),a.fromBufferAttribute(t,v),u.subVectors(a,s),h.subVectors(r,s),u.cross(h),o.fromBufferAttribute(i,m),l.fromBufferAttribute(i,y),c.fromBufferAttribute(i,v),o.add(u),l.add(u),c.add(u),i.setXYZ(m,o.x,o.y,o.z),i.setXYZ(y,l.x,l.y,l.z),i.setXYZ(v,c.x,c.y,c.z)}else for(let f=0,p=t.count;f<p;f+=3)r.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),a.fromBufferAttribute(t,f+2),u.subVectors(a,s),h.subVectors(r,s),u.cross(h),i.setXYZ(f+0,u.x,u.y,u.z),i.setXYZ(f+1,u.x,u.y,u.z),i.setXYZ(f+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)zi.fromBufferAttribute(e,t),zi.normalize(),e.setXYZ(t,zi.x,zi.y,zi.z)}toNonIndexed(){function e(o,l){const c=o.array,u=o.itemSize,h=o.normalized,f=new c.constructor(l.length*u);let p=0,m=0;for(let y=0,v=l.length;y<v;y++){o.isInterleavedBufferAttribute?p=l[y]*o.data.stride+o.offset:p=l[y]*u;for(let A=0;A<u;A++)f[m++]=c[p++]}return new En(f,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Bt,i=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,i);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let u=0,h=c.length;u<h;u++){const f=c[u],p=e(f,i);l.push(p)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,f=c.length;h<f;h++){const p=c[h];u.push(p.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let f=0,p=h.length;f<p;f++)u.push(h[f].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,u=a.length;c<u;c++){const h=a[c];this.addGroup(h.start,h.count,h.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const w_=new ct,xc=new lf,X3=new ms,C_=new N,Ju=new N,Zu=new N,eh=new N,lv=new N,j3=new N,K3=new _e,$3=new _e,J3=new _e,T_=new N,b_=new N,I_=new N,Z3=new N,eg=new N;class nn extends fn{constructor(e=new Bt,t=new cs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){j3.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=o[l],h=s[l];u!==0&&(lv.fromBufferAttribute(h,e),a?j3.addScaledVector(lv,u):j3.addScaledVector(lv.sub(t),u))}t.add(j3)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),X3.copy(i.boundingSphere),X3.applyMatrix4(s),xc.copy(e.ray).recast(e.near),!(X3.containsPoint(xc.origin)===!1&&(xc.intersectSphere(X3,C_)===null||xc.origin.distanceToSquared(C_)>(e.far-e.near)**2))&&(w_.copy(s).invert(),xc.copy(e.ray).applyMatrix4(w_),!(i.boundingBox!==null&&xc.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,xc)))}_computeIntersections(e,t,i){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,f=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let m=0,y=f.length;m<y;m++){const v=f[m],A=a[v.materialIndex],_=Math.max(v.start,p.start),x=Math.min(o.count,Math.min(v.start+v.count,p.start+p.count));for(let E=_,w=x;E<w;E+=3){const I=o.getX(E),T=o.getX(E+1),M=o.getX(E+2);r=tg(this,A,e,i,c,u,h,I,T,M),r&&(r.faceIndex=Math.floor(E/3),r.face.materialIndex=v.materialIndex,t.push(r))}}else{const m=Math.max(0,p.start),y=Math.min(o.count,p.start+p.count);for(let v=m,A=y;v<A;v+=3){const _=o.getX(v),x=o.getX(v+1),E=o.getX(v+2);r=tg(this,a,e,i,c,u,h,_,x,E),r&&(r.faceIndex=Math.floor(v/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let m=0,y=f.length;m<y;m++){const v=f[m],A=a[v.materialIndex],_=Math.max(v.start,p.start),x=Math.min(l.count,Math.min(v.start+v.count,p.start+p.count));for(let E=_,w=x;E<w;E+=3){const I=E,T=E+1,M=E+2;r=tg(this,A,e,i,c,u,h,I,T,M),r&&(r.faceIndex=Math.floor(E/3),r.face.materialIndex=v.materialIndex,t.push(r))}}else{const m=Math.max(0,p.start),y=Math.min(l.count,p.start+p.count);for(let v=m,A=y;v<A;v+=3){const _=v,x=v+1,E=v+2;r=tg(this,a,e,i,c,u,h,_,x,E),r&&(r.faceIndex=Math.floor(v/3),t.push(r))}}}}function TL(n,e,t,i,r,s,a,o){let l;if(e.side===Ki?l=i.intersectTriangle(a,s,r,!0,o):l=i.intersectTriangle(r,s,a,e.side===$a,o),l===null)return null;eg.copy(o),eg.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(eg);return c<t.near||c>t.far?null:{distance:c,point:eg.clone(),object:n}}function tg(n,e,t,i,r,s,a,o,l,c){n.getVertexPosition(o,Ju),n.getVertexPosition(l,Zu),n.getVertexPosition(c,eh);const u=TL(n,e,t,i,Ju,Zu,eh,Z3);if(u){r&&(K3.fromBufferAttribute(r,o),$3.fromBufferAttribute(r,l),J3.fromBufferAttribute(r,c),u.uv=Qr.getInterpolation(Z3,Ju,Zu,eh,K3,$3,J3,new _e)),s&&(K3.fromBufferAttribute(s,o),$3.fromBufferAttribute(s,l),J3.fromBufferAttribute(s,c),u.uv1=Qr.getInterpolation(Z3,Ju,Zu,eh,K3,$3,J3,new _e),u.uv2=u.uv1),a&&(T_.fromBufferAttribute(a,o),b_.fromBufferAttribute(a,l),I_.fromBufferAttribute(a,c),u.normal=Qr.getInterpolation(Z3,Ju,Zu,eh,T_,b_,I_,new N),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const h={a:o,b:l,c,normal:new N,materialIndex:0};Qr.getNormal(Ju,Zu,eh,h.normal),u.face=h}return u}class qo extends Bt{constructor(e=1,t=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],u=[],h=[];let f=0,p=0;m("z","y","x",-1,-1,i,t,e,a,s,0),m("z","y","x",1,-1,i,t,-e,a,s,1),m("x","z","y",1,1,e,i,t,r,a,2),m("x","z","y",1,-1,e,i,-t,r,a,3),m("x","y","z",1,-1,e,t,i,r,s,4),m("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new ot(c,3)),this.setAttribute("normal",new ot(u,3)),this.setAttribute("uv",new ot(h,2));function m(y,v,A,_,x,E,w,I,T,M,b){const B=E/T,L=w/M,U=E/2,O=w/2,Q=I/2,G=T+1,F=M+1;let q=0,Y=0;const H=new N;for(let V=0;V<F;V++){const D=V*L-O;for(let k=0;k<G;k++){const Z=k*B-U;H[y]=Z*_,H[v]=D*x,H[A]=Q,c.push(H.x,H.y,H.z),H[y]=0,H[v]=0,H[A]=I>0?1:-1,u.push(H.x,H.y,H.z),h.push(k/T),h.push(1-V/M),q+=1}}for(let V=0;V<M;V++)for(let D=0;D<T;D++){const k=f+D+G*V,Z=f+D+G*(V+1),j=f+(D+1)+G*(V+1),ee=f+(D+1)+G*V;l.push(k,Z,ee),l.push(Z,j,ee),Y+=6}o.addGroup(p,Y,b),p+=Y,f+=q}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qo(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Wh(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function wr(n){const e={};for(let t=0;t<n.length;t++){const i=Wh(n[t]);for(const r in i)e[r]=i[r]}return e}function bL(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function KC(n){return n.getRenderTarget()===null?n.outputColorSpace:fa}const Hn={clone:Wh,merge:wr};var IL=`void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,ML=`void main() {
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class sn extends Ji{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=IL,this.fragmentShader=ML,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Wh(e.uniforms),this.uniformsGroups=bL(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class o0 extends fn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ct,this.projectionMatrix=new ct,this.projectionMatrixInverse=new ct,this.coordinateSystem=za}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Kn extends o0{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Vh*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(jc*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Vh*2*Math.atan(Math.tan(jc*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(jc*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*i/c,r*=a.width/l,i*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const th=-90,nh=1;class $C extends fn{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null;const r=new Kn(th,nh,e,t);r.layers=this.layers,this.add(r);const s=new Kn(th,nh,e,t);s.layers=this.layers,this.add(s);const a=new Kn(th,nh,e,t);a.layers=this.layers,this.add(a);const o=new Kn(th,nh,e,t);o.layers=this.layers,this.add(o);const l=new Kn(th,nh,e,t);l.layers=this.layers,this.add(l);const c=new Kn(th,nh,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===za)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Mp)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const i=this.renderTarget;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,s,a,o,l,c]=this.children,u=e.getRenderTarget(),h=e.toneMapping,f=e.xr.enabled;e.toneMapping=os,e.xr.enabled=!1;const p=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,r),e.setRenderTarget(i,1),e.render(t,s),e.setRenderTarget(i,2),e.render(t,a),e.setRenderTarget(i,3),e.render(t,o),e.setRenderTarget(i,4),e.render(t,l),i.texture.generateMipmaps=p,e.setRenderTarget(i,5),e.render(t,c),e.setRenderTarget(u),e.toneMapping=h,e.xr.enabled=f,i.texture.needsPMREMUpdate=!0}}class l0 extends Vn{constructor(e,t,i,r,s,a,o,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:Fl,super(e,t,i,r,s,a,o,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class JC extends Dn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];t.encoding!==void 0&&(Jd("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===Dl?Nt:Pl),this.texture=new l0(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Tn}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`
varying vec3 vWorldDirection;
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}
`,fragmentShader:`
uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
}
`},r=new qo(5,5,5),s=new sn({name:"CubemapFromEquirect",uniforms:Wh(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ki,blending:Kt});s.uniforms.tEquirect.value=t;const a=new nn(r,s),o=t.minFilter;return t.minFilter===Ja&&(t.minFilter=Tn),new $C(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,r);e.setRenderTarget(s)}}const cv=new N,RL=new N,BL=new Qt;class rs{constructor(e=new N(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=cv.subVectors(i,t).cross(RL.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(cv),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||BL.getNormalMatrix(e),r=this.coplanarPoint(cv).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const _c=new ms,ng=new N;class c0{constructor(e=new rs,t=new rs,i=new rs,r=new rs,s=new rs,a=new rs){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=za){const i=this.planes,r=e.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],u=r[5],h=r[6],f=r[7],p=r[8],m=r[9],y=r[10],v=r[11],A=r[12],_=r[13],x=r[14],E=r[15];if(i[0].setComponents(l-s,f-c,v-p,E-A).normalize(),i[1].setComponents(l+s,f+c,v+p,E+A).normalize(),i[2].setComponents(l+a,f+u,v+m,E+_).normalize(),i[3].setComponents(l-a,f-u,v-m,E-_).normalize(),i[4].setComponents(l-o,f-h,v-y,E-x).normalize(),t===za)i[5].setComponents(l+o,f+h,v+y,E+x).normalize();else if(t===Mp)i[5].setComponents(o,h,y,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(),_c.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),_c.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(_c)}intersectsSprite(e){return _c.center.set(0,0,0),_c.radius=.7071067811865476,_c.applyMatrix4(e.matrixWorld),this.intersectsSphere(_c)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(ng.x=r.normal.x>0?e.max.x:e.min.x,ng.y=r.normal.y>0?e.max.y:e.min.y,ng.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(ng)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function ZC(){let n=null,e=!1,t=null,i=null;function r(s,a){t(s,a),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function DL(n,e){const t=e.isWebGL2,i=new WeakMap;function r(c,u){const h=c.array,f=c.usage,p=n.createBuffer();n.bindBuffer(u,p),n.bufferData(u,h,f),c.onUploadCallback();let m;if(h instanceof Float32Array)m=n.FLOAT;else if(h instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)m=n.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else m=n.UNSIGNED_SHORT;else if(h instanceof Int16Array)m=n.SHORT;else if(h instanceof Uint32Array)m=n.UNSIGNED_INT;else if(h instanceof Int32Array)m=n.INT;else if(h instanceof Int8Array)m=n.BYTE;else if(h instanceof Uint8Array)m=n.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)m=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:p,type:m,bytesPerElement:h.BYTES_PER_ELEMENT,version:c.version}}function s(c,u,h){const f=u.array,p=u.updateRange;n.bindBuffer(h,c),p.count===-1?n.bufferSubData(h,0,f):(t?n.bufferSubData(h,p.offset*f.BYTES_PER_ELEMENT,f,p.offset,p.count):n.bufferSubData(h,p.offset*f.BYTES_PER_ELEMENT,f.subarray(p.offset,p.offset+p.count)),p.count=-1),u.onUploadCallback()}function a(c){return c.isInterleavedBufferAttribute&&(c=c.data),i.get(c)}function o(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=i.get(c);u&&(n.deleteBuffer(u.buffer),i.delete(c))}function l(c,u){if(c.isGLBufferAttribute){const f=i.get(c);(!f||f.version<c.version)&&i.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}c.isInterleavedBufferAttribute&&(c=c.data);const h=i.get(c);h===void 0?i.set(c,r(c,u)):h.version<c.version&&(s(h.buffer,c,u),h.version=c.version)}return{get:a,remove:o,update:l}}class Xo extends Bt{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(i),l=Math.floor(r),c=o+1,u=l+1,h=e/o,f=t/l,p=[],m=[],y=[],v=[];for(let A=0;A<u;A++){const _=A*f-a;for(let x=0;x<c;x++){const E=x*h-s;m.push(E,-_,0),y.push(0,0,1),v.push(x/o),v.push(1-A/l)}}for(let A=0;A<l;A++)for(let _=0;_<o;_++){const x=_+c*A,E=_+c*(A+1),w=_+1+c*(A+1),I=_+1+c*A;p.push(x,E,I),p.push(E,w,I)}this.setIndex(p),this.setAttribute("position",new ot(m,3)),this.setAttribute("normal",new ot(y,3)),this.setAttribute("uv",new ot(v,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Xo(e.width,e.height,e.widthSegments,e.heightSegments)}}var PL=`#ifdef USE_ALPHAHASH
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,LL=`#ifdef USE_ALPHAHASH
const float ALPHA_HASH_SCALE = 0.05;
float hash2D( vec2 value ) {
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
}
float hash3D( vec3 value ) {
return hash2D( vec2( hash2D( value.xy ), value.z ) );
}
float getAlphaHashThreshold( vec3 position ) {
float maxDeriv = max(
length( dFdx( position.xyz ) ),
length( dFdy( position.xyz ) )
);
float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
vec2 pixScales = vec2(
exp2( floor( log2( pixScale ) ) ),
exp2( ceil( log2( pixScale ) ) )
);
vec2 alpha = vec2(
hash3D( floor( pixScales.x * position.xyz ) ),
hash3D( floor( pixScales.y * position.xyz ) )
);
float lerpFactor = fract( log2( pixScale ) );
float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
float a = min( lerpFactor, 1.0 - lerpFactor );
vec3 cases = vec3(
x * x / ( 2.0 * a * ( 1.0 - a ) ),
( x - 0.5 * a ) / ( 1.0 - a ),
1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
);
float threshold = ( x < ( 1.0 - a ) )
? ( ( x < a ) ? cases.x : cases.y )
: cases.z;
return clamp( threshold , 1.0e-6, 1.0 );
}
#endif`,UL=`#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,OL=`#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
#endif`,FL=`#ifdef USE_ALPHATEST
if ( diffuseColor.a < alphaTest ) discard;
#endif`,kL=`#ifdef USE_ALPHATEST
uniform float alphaTest;
#endif`,NL=`#ifdef USE_AOMAP
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
reflectedLight.indirectDiffuse *= ambientOcclusion;
#if defined( USE_ENVMAP ) && defined( STANDARD )
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
#endif
#endif`,GL=`#ifdef USE_AOMAP
uniform sampler2D aoMap;
uniform float aoMapIntensity;
#endif`,zL=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
vPosition = vec3( position );
#endif`,QL=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
vec3 objectTangent = vec3( tangent.xyz );
#endif`,HL=`float G_BlinnPhong_Implicit( ) {
return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
vec3 halfDir = normalize( lightDir + viewDir );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
float G = G_BlinnPhong_Implicit( );
float D = D_BlinnPhong( shininess, dotNH );
return F * ( G * D );
} // validated`,VL=`#ifdef USE_IRIDESCENCE
const mat3 XYZ_TO_REC709 = mat3(
3.2404542, -0.9692660, 0.0556434,
-1.5371385, 1.8760108, -0.2040259,
-0.4985314, 0.0415560, 1.0572252
);
vec3 Fresnel0ToIor( vec3 fresnel0 ) {
vec3 sqrtF0 = sqrt( fresnel0 );
return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
}
vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
}
float IorToFresnel0( float transmittedIor, float incidentIor ) {
return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
}
vec3 evalSensitivity( float OPD, vec3 shift ) {
float phase = 2.0 * PI * OPD * 1.0e-9;
vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
xyz /= 1.0685e-7;
vec3 rgb = XYZ_TO_REC709 * xyz;
return rgb;
}
vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
vec3 I;
float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
float cosTheta2Sq = 1.0 - sinTheta2Sq;
if ( cosTheta2Sq < 0.0 ) {
return vec3( 1.0 );
}
float cosTheta2 = sqrt( cosTheta2Sq );
float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
float R12 = F_Schlick( R0, 1.0, cosTheta1 );
float R21 = R12;
float T121 = 1.0 - R12;
float phi12 = 0.0;
if ( iridescenceIOR < outsideIOR ) phi12 = PI;
float phi21 = PI - phi12;
vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
vec3 phi23 = vec3( 0.0 );
if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
vec3 phi = vec3( phi21 ) + phi23;
vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
vec3 r123 = sqrt( R123 );
vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
vec3 C0 = R12 + Rs;
I = C0;
vec3 Cm = Rs - T121;
for ( int m = 1; m <= 2; ++ m ) {
Cm *= r123;
vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
I += Cm * Sm;
}
return max( I, vec3( 0.0 ) );
}
#endif`,WL=`#ifdef USE_BUMPMAP
uniform sampler2D bumpMap;
uniform float bumpScale;
vec2 dHdxy_fwd() {
vec2 dSTdx = dFdx( vBumpMapUv );
vec2 dSTdy = dFdy( vBumpMapUv );
float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
return vec2( dBx, dBy );
}
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
vec3 vSigmaX = dFdx( surf_pos.xyz );
vec3 vSigmaY = dFdy( surf_pos.xyz );
vec3 vN = surf_norm;
vec3 R1 = cross( vSigmaY, vN );
vec3 R2 = cross( vN, vSigmaX );
float fDet = dot( vSigmaX, R1 ) * faceDirection;
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
return normalize( abs( fDet ) * surf_norm - vGrad );
}
#endif`,YL=`#if NUM_CLIPPING_PLANES > 0
vec4 plane;
#pragma unroll_loop_start
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
}
#pragma unroll_loop_end
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
bool clipped = true;
#pragma unroll_loop_start
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
}
#pragma unroll_loop_end
if ( clipped ) discard;
#endif
#endif`,qL=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,XL=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
#endif`,jL=`#if NUM_CLIPPING_PLANES > 0
vClipPosition = - mvPosition.xyz;
#endif`,KL=`#if defined( USE_COLOR_ALPHA )
diffuseColor *= vColor;
#elif defined( USE_COLOR )
diffuseColor.rgb *= vColor;
#endif`,$L=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR )
varying vec3 vColor;
#endif`,JL=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
varying vec3 vColor;
#endif`,ZL=`#if defined( USE_COLOR_ALPHA )
vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
vColor.xyz *= instanceColor.xyz;
#endif`,eU=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
float precisionSafeLength( vec3 v ) { return length( v ); }
#else
float precisionSafeLength( vec3 v ) {
float maxComponent = max3( abs( v ) );
return length( v / maxComponent ) * maxComponent;
}
#endif
struct IncidentLight {
vec3 color;
vec3 direction;
bool visible;
};
struct ReflectedLight {
vec3 directDiffuse;
vec3 directSpecular;
vec3 indirectDiffuse;
vec3 indirectSpecular;
};
struct GeometricContext {
vec3 position;
vec3 normal;
vec3 viewDir;
#ifdef USE_CLEARCOAT
vec3 clearcoatNormal;
#endif
};
#ifdef USE_ALPHAHASH
varying vec3 vPosition;
#endif
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
mat3 transposeMat3( const in mat3 m ) {
mat3 tmp;
tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
return tmp;
}
float luminance( const in vec3 rgb ) {
const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
return dot( weights, rgb );
}
bool isPerspectiveMatrix( mat4 m ) {
return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
return vec2( u, v );
}
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
} // validated`,tU=`#ifdef ENVMAP_TYPE_CUBE_UV
#define cubeUV_minMipLevel 4.0
#define cubeUV_minTileSize 16.0
float getFace( vec3 direction ) {
vec3 absDirection = abs( direction );
float face = - 1.0;
if ( absDirection.x > absDirection.z ) {
if ( absDirection.x > absDirection.y )
face = direction.x > 0.0 ? 0.0 : 3.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
} else {
if ( absDirection.z > absDirection.y )
face = direction.z > 0.0 ? 2.0 : 5.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
}
return face;
}
vec2 getUV( vec3 direction, float face ) {
vec2 uv;
if ( face == 0.0 ) {
uv = vec2( direction.z, direction.y ) / abs( direction.x );
} else if ( face == 1.0 ) {
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
} else if ( face == 2.0 ) {
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
} else if ( face == 3.0 ) {
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
} else if ( face == 4.0 ) {
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
} else {
uv = vec2( direction.x, direction.y ) / abs( direction.z );
}
return 0.5 * ( uv + 1.0 );
}
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
float face = getFace( direction );
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
mipInt = max( mipInt, cubeUV_minMipLevel );
float faceSize = exp2( mipInt );
highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
if ( face > 2.0 ) {
uv.y += faceSize;
face -= 3.0;
}
uv.x += face * faceSize;
uv.x += filterInt * 3.0 * cubeUV_minTileSize;
uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
uv.x *= CUBEUV_TEXEL_WIDTH;
uv.y *= CUBEUV_TEXEL_HEIGHT;
#ifdef texture2DGradEXT
return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
#else
return texture2D( envMap, uv ).rgb;
#endif
}
#define cubeUV_r0 1.0
#define cubeUV_v0 0.339
#define cubeUV_m0 - 2.0
#define cubeUV_r1 0.8
#define cubeUV_v1 0.276
#define cubeUV_m1 - 1.0
#define cubeUV_r4 0.4
#define cubeUV_v4 0.046
#define cubeUV_m4 2.0
#define cubeUV_r5 0.305
#define cubeUV_v5 0.016
#define cubeUV_m5 3.0
#define cubeUV_r6 0.21
#define cubeUV_v6 0.0038
#define cubeUV_m6 4.0
float roughnessToMip( float roughness ) {
float mip = 0.0;
if ( roughness >= cubeUV_r1 ) {
mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
} else if ( roughness >= cubeUV_r4 ) {
mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
} else if ( roughness >= cubeUV_r5 ) {
mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
} else if ( roughness >= cubeUV_r6 ) {
mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
} else {
mip = - 2.0 * log2( 1.16 * roughness ); }
return mip;
}
vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
float mipF = fract( mip );
float mipInt = floor( mip );
vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
if ( mipF == 0.0 ) {
return vec4( color0, 1.0 );
} else {
vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
return vec4( mix( color0, color1, mipF ), 1.0 );
}
}
#endif`,nU=`vec3 transformedNormal = objectNormal;
#ifdef USE_INSTANCING
mat3 m = mat3( instanceMatrix );
transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
transformedNormal = m * transformedNormal;
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#ifdef FLIP_SIDED
transformedTangent = - transformedTangent;
#endif
#endif`,iU=`#ifdef USE_DISPLACEMENTMAP
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
#endif`,rU=`#ifdef USE_DISPLACEMENTMAP
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,sU=`#ifdef USE_EMISSIVEMAP
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,aU=`#ifdef USE_EMISSIVEMAP
uniform sampler2D emissiveMap;
#endif`,oU="gl_FragColor = linearToOutputTexel( gl_FragColor );",lU=`vec4 LinearToLinear( in vec4 value ) {
return value;
}
vec4 LinearTosRGB( in vec4 value ) {
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}`,cU=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vec3 cameraToFrag;
if ( isOrthographic ) {
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToFrag = normalize( vWorldPosition - cameraPosition );
}
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
#else
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
#endif
#else
vec3 reflectVec = vReflect;
#endif
#ifdef ENVMAP_TYPE_CUBE
vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
#else
vec4 envColor = vec4( 0.0 );
#endif
#ifdef ENVMAP_BLENDING_MULTIPLY
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
#elif defined( ENVMAP_BLENDING_MIX )
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
#elif defined( ENVMAP_BLENDING_ADD )
outgoingLight += envColor.xyz * specularStrength * reflectivity;
#endif
#endif`,uU=`#ifdef USE_ENVMAP
uniform float envMapIntensity;
uniform float flipEnvMap;
#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#else
uniform sampler2D envMap;
#endif
#endif`,hU=`#ifdef USE_ENVMAP
uniform float reflectivity;
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
#ifdef ENV_WORLDPOS
varying vec3 vWorldPosition;
uniform float refractionRatio;
#else
varying vec3 vReflect;
#endif
#endif`,fU=`#ifdef USE_ENVMAP
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
#ifdef ENV_WORLDPOS
varying vec3 vWorldPosition;
#else
varying vec3 vReflect;
uniform float refractionRatio;
#endif
#endif`,dU=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vWorldPosition = worldPosition.xyz;
#else
vec3 cameraToVertex;
if ( isOrthographic ) {
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
}
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vReflect = reflect( cameraToVertex, worldNormal );
#else
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
#endif
#endif
#endif`,pU=`#ifdef USE_FOG
vFogDepth = - mvPosition.z;
#endif`,gU=`#ifdef USE_FOG
varying float vFogDepth;
#endif`,mU=`#ifdef USE_FOG
#ifdef FOG_EXP2
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
#else
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
#endif
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,AU=`#ifdef USE_FOG
uniform vec3 fogColor;
varying float vFogDepth;
#ifdef FOG_EXP2
uniform float fogDensity;
#else
uniform float fogNear;
uniform float fogFar;
#endif
#endif`,vU=`#ifdef USE_GRADIENTMAP
uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
float dotNL = dot( normal, lightDirection );
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
#ifdef USE_GRADIENTMAP
return vec3( texture2D( gradientMap, coord ).r );
#else
vec2 fw = fwidth( coord ) * 0.5;
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
#endif
}`,yU=`#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
reflectedLight.indirectDiffuse += lightMapIrradiance;
#endif`,xU=`#ifdef USE_LIGHTMAP
uniform sampler2D lightMap;
uniform float lightMapIntensity;
#endif`,_U=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,EU=`varying vec3 vViewPosition;
struct LambertMaterial {
vec3 diffuseColor;
float specularStrength;
};
void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Lambert
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,SU=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
uniform vec3 lightProbe[ 9 ];
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
float x = normal.x, y = normal.y, z = normal.z;
vec3 result = shCoefficients[ 0 ] * 0.886227;
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
vec3 irradiance = ambientLightColor;
return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
#if defined ( LEGACY_LIGHTS )
if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
}
return 1.0;
#else
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
if ( cutoffDistance > 0.0 ) {
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
}
return distanceFalloff;
#endif
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
struct DirectionalLight {
vec3 direction;
vec3 color;
};
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {
light.color = directionalLight.color;
light.direction = directionalLight.direction;
light.visible = true;
}
#endif
#if NUM_POINT_LIGHTS > 0
struct PointLight {
vec3 position;
vec3 color;
float distance;
float decay;
};
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {
vec3 lVector = pointLight.position - geometry.position;
light.direction = normalize( lVector );
float lightDistance = length( lVector );
light.color = pointLight.color;
light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
light.visible = ( light.color != vec3( 0.0 ) );
}
#endif
#if NUM_SPOT_LIGHTS > 0
struct SpotLight {
vec3 position;
vec3 direction;
vec3 color;
float distance;
float decay;
float coneCos;
float penumbraCos;
};
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {
vec3 lVector = spotLight.position - geometry.position;
light.direction = normalize( lVector );
float angleCos = dot( light.direction, spotLight.direction );
float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
if ( spotAttenuation > 0.0 ) {
float lightDistance = length( lVector );
light.color = spotLight.color * spotAttenuation;
light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
light.visible = ( light.color != vec3( 0.0 ) );
} else {
light.color = vec3( 0.0 );
light.visible = false;
}
}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
struct RectAreaLight {
vec3 color;
vec3 position;
vec3 halfWidth;
vec3 halfHeight;
};
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
struct HemisphereLight {
vec3 direction;
vec3 skyColor;
vec3 groundColor;
};
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
float dotNL = dot( normal, hemiLight.direction );
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
return irradiance;
}
#endif`,wU=`#ifdef USE_ENVMAP
vec3 getIBLIrradiance( const in vec3 normal ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
return PI * envMapColor.rgb * envMapIntensity;
#else
return vec3( 0.0 );
#endif
}
vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 reflectVec = reflect( - viewDir, normal );
reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
return envMapColor.rgb * envMapIntensity;
#else
return vec3( 0.0 );
#endif
}
#ifdef USE_ANISOTROPY
vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 bentNormal = cross( bitangent, viewDir );
bentNormal = normalize( cross( bentNormal, bitangent ) );
bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
return getIBLRadiance( viewDir, bentNormal, roughness );
#else
return vec3( 0.0 );
#endif
}
#endif
#endif`,CU=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,TU=`varying vec3 vViewPosition;
struct ToonMaterial {
vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Toon
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,bU=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,IU=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
vec3 diffuseColor;
vec3 specularColor;
float specularShininess;
float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_BlinnPhong
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,MU=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
material.ior = ior;
#ifdef USE_SPECULAR
float specularIntensityFactor = specularIntensity;
vec3 specularColorFactor = specularColor;
#ifdef USE_SPECULAR_COLORMAP
specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
#endif
material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
#else
float specularIntensityFactor = 1.0;
vec3 specularColorFactor = vec3( 1.0 );
material.specularF90 = 1.0;
#endif
material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
#else
material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
material.clearcoat = clearcoat;
material.clearcoatRoughness = clearcoatRoughness;
material.clearcoatF0 = vec3( 0.04 );
material.clearcoatF90 = 1.0;
#ifdef USE_CLEARCOATMAP
material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
#endif
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
material.clearcoatRoughness += geometryRoughness;
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_IRIDESCENCE
material.iridescence = iridescence;
material.iridescenceIOR = iridescenceIOR;
#ifdef USE_IRIDESCENCEMAP
material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
#else
material.iridescenceThickness = iridescenceThicknessMaximum;
#endif
#endif
#ifdef USE_SHEEN
material.sheenColor = sheenColor;
#ifdef USE_SHEEN_COLORMAP
material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
#endif
material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
#ifdef USE_SHEEN_ROUGHNESSMAP
material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
#endif
#endif
#ifdef USE_ANISOTROPY
#ifdef USE_ANISOTROPYMAP
mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
#else
vec2 anisotropyV = anisotropyVector;
#endif
material.anisotropy = length( anisotropyV );
anisotropyV /= material.anisotropy;
material.anisotropy = saturate( material.anisotropy );
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
material.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;
material.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;
#endif`,RU=`struct PhysicalMaterial {
vec3 diffuseColor;
float roughness;
vec3 specularColor;
float specularF90;
#ifdef USE_CLEARCOAT
float clearcoat;
float clearcoatRoughness;
vec3 clearcoatF0;
float clearcoatF90;
#endif
#ifdef USE_IRIDESCENCE
float iridescence;
float iridescenceIOR;
float iridescenceThickness;
vec3 iridescenceFresnel;
vec3 iridescenceF0;
#endif
#ifdef USE_SHEEN
vec3 sheenColor;
float sheenRoughness;
#endif
#ifdef IOR
float ior;
#endif
#ifdef USE_TRANSMISSION
float transmission;
float transmissionAlpha;
float thickness;
float attenuationDistance;
vec3 attenuationColor;
#endif
#ifdef USE_ANISOTROPY
float anisotropy;
float alphaT;
vec3 anisotropyT;
vec3 anisotropyB;
#endif
};
vec3 clearcoatSpecular = vec3( 0.0 );
vec3 sheenSpecular = vec3( 0.0 );
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
float x2 = x * x;
float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
float a2 = pow2( alpha );
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
float a2 = pow2( alpha );
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
return RECIPROCAL_PI * a2 / pow2( denom );
}
#ifdef USE_ANISOTROPY
float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
float v = 0.5 / ( gv + gl );
return saturate(v);
}
float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
float a2 = alphaT * alphaB;
highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
highp float v2 = dot( v, v );
float w2 = a2 / v2;
return RECIPROCAL_PI * a2 * pow2 ( w2 );
}
#endif
#ifdef USE_CLEARCOAT
vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
vec3 f0 = material.clearcoatF0;
float f90 = material.clearcoatF90;
float roughness = material.clearcoatRoughness;
float alpha = pow2( roughness );
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( f0, f90, dotVH );
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
float D = D_GGX( alpha, dotNH );
return F * ( V * D );
}
#endif
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
vec3 f0 = material.specularColor;
float f90 = material.specularF90;
float roughness = material.roughness;
float alpha = pow2( roughness );
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( f0, f90, dotVH );
#ifdef USE_IRIDESCENCE
F = mix( F, material.iridescenceFresnel, material.iridescence );
#endif
#ifdef USE_ANISOTROPY
float dotTL = dot( material.anisotropyT, lightDir );
float dotTV = dot( material.anisotropyT, viewDir );
float dotTH = dot( material.anisotropyT, halfDir );
float dotBL = dot( material.anisotropyB, lightDir );
float dotBV = dot( material.anisotropyB, viewDir );
float dotBH = dot( material.anisotropyB, halfDir );
float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
#else
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
float D = D_GGX( alpha, dotNH );
#endif
return F * ( V * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
const float LUT_SIZE = 64.0;
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
const float LUT_BIAS = 0.5 / LUT_SIZE;
float dotNV = saturate( dot( N, V ) );
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
uv = uv * LUT_SCALE + LUT_BIAS;
return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
float l = length( f );
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
float x = dot( v1, v2 );
float y = abs( x );
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
float b = 3.4175940 + ( 4.1616724 + y ) * y;
float v = a / b;
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
vec3 lightNormal = cross( v1, v2 );
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
vec3 T1, T2;
T1 = normalize( V - N * dot( V, N ) );
T2 = - cross( N, T1 );
mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
vec3 coords[ 4 ];
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
coords[ 0 ] = normalize( coords[ 0 ] );
coords[ 1 ] = normalize( coords[ 1 ] );
coords[ 2 ] = normalize( coords[ 2 ] );
coords[ 3 ] = normalize( coords[ 3 ] );
vec3 vectorFormFactor = vec3( 0.0 );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
return vec3( result );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
float alpha = pow2( roughness );
float invAlpha = 1.0 / alpha;
float cos2h = dotNH * dotNH;
float sin2h = max( 1.0 - cos2h, 0.0078125 );
return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float D = D_Charlie( sheenRoughness, dotNH );
float V = V_Neubelt( dotNV, dotNL );
return sheenColor * ( D * V );
}
#endif
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
float dotNV = saturate( dot( normal, viewDir ) );
float r2 = roughness * roughness;
float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
return saturate( DG * RECIPROCAL_PI );
}
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
float dotNV = saturate( dot( normal, viewDir ) );
const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
vec4 r = roughness * c0 + c1;
float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
return fab;
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
vec2 fab = DFGApprox( normal, viewDir, roughness );
return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#else
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#endif
vec2 fab = DFGApprox( normal, viewDir, roughness );
#ifdef USE_IRIDESCENCE
vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
#else
vec3 Fr = specularColor;
#endif
vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
float Ess = fab.x + fab.y;
float Ems = 1.0 - Ess;
vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
singleScatter += FssEss;
multiScatter += Fms * Ems;
}
#if NUM_RECT_AREA_LIGHTS > 0
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
vec3 normal = geometry.normal;
vec3 viewDir = geometry.viewDir;
vec3 position = geometry.position;
vec3 lightPos = rectAreaLight.position;
vec3 halfWidth = rectAreaLight.halfWidth;
vec3 halfHeight = rectAreaLight.halfHeight;
vec3 lightColor = rectAreaLight.color;
float roughness = material.roughness;
vec3 rectCoords[ 4 ];
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
vec2 uv = LTC_Uv( normal, viewDir, roughness );
vec4 t1 = texture2D( ltc_1, uv );
vec4 t2 = texture2D( ltc_2, uv );
mat3 mInv = mat3(
vec3( t1.x, 0, t1.y ),
vec3( 0, 1, 0 ),
vec3( t1.z, 0, t1.w )
);
vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
#ifdef USE_CLEARCOAT
float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
vec3 ccIrradiance = dotNLcc * directLight.color;
clearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );
#endif
#ifdef USE_SHEEN
sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );
#endif
reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
#ifdef USE_CLEARCOAT
clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
#endif
#ifdef USE_SHEEN
sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );
#endif
vec3 singleScattering = vec3( 0.0 );
vec3 multiScattering = vec3( 0.0 );
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
#ifdef USE_IRIDESCENCE
computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
#else
computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
#endif
vec3 totalScattering = singleScattering + multiScattering;
vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
reflectedLight.indirectSpecular += radiance * singleScattering;
reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct RE_Direct_Physical
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,BU=`
GeometricContext geometry;
geometry.position = - vViewPosition;
geometry.normal = normal;
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
#ifdef USE_CLEARCOAT
geometry.clearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
float dotNVi = saturate( dot( normal, geometry.viewDir ) );
if ( material.iridescenceThickness == 0.0 ) {
material.iridescence = 0.0;
} else {
material.iridescence = saturate( material.iridescence );
}
if ( material.iridescence > 0.0 ) {
material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
PointLight pointLight;
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
PointLightShadow pointLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
pointLight = pointLights[ i ];
getPointLightInfo( pointLight, geometry, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
pointLightShadow = pointLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
#endif
RE_Direct( directLight, geometry, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
SpotLight spotLight;
vec4 spotColor;
vec3 spotLightCoord;
bool inSpotLightMap;
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
SpotLightShadow spotLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
spotLight = spotLights[ i ];
getSpotLightInfo( spotLight, geometry, directLight );
#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
#else
#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
#endif
#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
#endif
#undef SPOT_LIGHT_MAP_INDEX
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
spotLightShadow = spotLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometry, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
DirectionalLight directionalLight;
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
DirectionalLightShadow directionalLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
directionalLight = directionalLights[ i ];
getDirectionalLightInfo( directionalLight, geometry, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
directionalLightShadow = directionalLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometry, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
RectAreaLight rectAreaLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
rectAreaLight = rectAreaLights[ i ];
RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
vec3 iblIrradiance = vec3( 0.0 );
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
#if ( NUM_HEMI_LIGHTS > 0 )
#pragma unroll_loop_start
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
}
#pragma unroll_loop_end
#endif
#endif
#if defined( RE_IndirectSpecular )
vec3 radiance = vec3( 0.0 );
vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,DU=`#if defined( RE_IndirectDiffuse )
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
irradiance += lightMapIrradiance;
#endif
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
iblIrradiance += getIBLIrradiance( geometry.normal );
#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
#ifdef USE_ANISOTROPY
radiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy );
#else
radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );
#endif
#ifdef USE_CLEARCOAT
clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );
#endif
#endif`,PU=`#if defined( RE_IndirectDiffuse )
RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
#endif`,LU=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,UU=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
#endif`,OU=`#ifdef USE_LOGDEPTHBUF
#ifdef USE_LOGDEPTHBUF_EXT
varying float vFragDepth;
varying float vIsPerspective;
#else
uniform float logDepthBufFC;
#endif
#endif`,FU=`#ifdef USE_LOGDEPTHBUF
#ifdef USE_LOGDEPTHBUF_EXT
vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#else
if ( isPerspectiveMatrix( projectionMatrix ) ) {
gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
gl_Position.z *= gl_Position.w;
}
#endif
#endif`,kU=`#ifdef USE_MAP
diffuseColor *= texture2D( map, vMapUv );
#endif`,NU=`#ifdef USE_MAP
uniform sampler2D map;
#endif`,GU=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
#if defined( USE_POINTS_UV )
vec2 uv = vUv;
#else
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
#endif
#endif
#ifdef USE_MAP
diffuseColor *= texture2D( map, uv );
#endif
#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`,zU=`#if defined( USE_POINTS_UV )
varying vec2 vUv;
#else
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
uniform mat3 uvTransform;
#endif
#endif
#ifdef USE_MAP
uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
#endif`,QU=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
metalnessFactor *= texelMetalness.b;
#endif`,HU=`#ifdef USE_METALNESSMAP
uniform sampler2D metalnessMap;
#endif`,VU=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
vColor *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
#if defined( USE_COLOR_ALPHA )
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
#elif defined( USE_COLOR )
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
#endif
}
#endif`,WU=`#ifdef USE_MORPHNORMALS
objectNormal *= morphTargetBaseInfluence;
#ifdef MORPHTARGETS_TEXTURE
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
}
#else
objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
#endif
#endif`,YU=`#ifdef USE_MORPHTARGETS
uniform float morphTargetBaseInfluence;
#ifdef MORPHTARGETS_TEXTURE
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
uniform sampler2DArray morphTargetsTexture;
uniform ivec2 morphTargetsTextureSize;
vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
int y = texelIndex / morphTargetsTextureSize.x;
int x = texelIndex - y * morphTargetsTextureSize.x;
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
return texelFetch( morphTargetsTexture, morphUV, 0 );
}
#else
#ifndef USE_MORPHNORMALS
uniform float morphTargetInfluences[ 8 ];
#else
uniform float morphTargetInfluences[ 4 ];
#endif
#endif
#endif`,qU=`#ifdef USE_MORPHTARGETS
transformed *= morphTargetBaseInfluence;
#ifdef MORPHTARGETS_TEXTURE
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
}
#else
transformed += morphTarget0 * morphTargetInfluences[ 0 ];
transformed += morphTarget1 * morphTargetInfluences[ 1 ];
transformed += morphTarget2 * morphTargetInfluences[ 2 ];
transformed += morphTarget3 * morphTargetInfluences[ 3 ];
#ifndef USE_MORPHNORMALS
transformed += morphTarget4 * morphTargetInfluences[ 4 ];
transformed += morphTarget5 * morphTargetInfluences[ 5 ];
transformed += morphTarget6 * morphTargetInfluences[ 6 ];
transformed += morphTarget7 * morphTargetInfluences[ 7 ];
#endif
#endif
#endif`,XU=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
vec3 fdx = dFdx( vViewPosition );
vec3 fdy = dFdy( vViewPosition );
vec3 normal = normalize( cross( fdx, fdy ) );
#else
vec3 normal = normalize( vNormal );
#ifdef DOUBLE_SIDED
normal *= faceDirection;
#endif
#endif
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
#ifdef USE_TANGENT
mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
#else
mat3 tbn = getTangentFrame( - vViewPosition, normal,
#if defined( USE_NORMALMAP )
vNormalMapUv
#elif defined( USE_CLEARCOAT_NORMALMAP )
vClearcoatNormalMapUv
#else
vUv
#endif
);
#endif
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
tbn[0] *= faceDirection;
tbn[1] *= faceDirection;
#endif
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
#ifdef USE_TANGENT
mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
#else
mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
#endif
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
tbn2[0] *= faceDirection;
tbn2[1] *= faceDirection;
#endif
#endif
vec3 geometryNormal = normal;`,jU=`#ifdef USE_NORMALMAP_OBJECTSPACE
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
#ifdef FLIP_SIDED
normal = - normal;
#endif
#ifdef DOUBLE_SIDED
normal = normal * faceDirection;
#endif
normal = normalize( normalMatrix * normal );
#elif defined( USE_NORMALMAP_TANGENTSPACE )
vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
mapN.xy *= normalScale;
normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,KU=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif`,$U=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif`,JU=`#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#endif
#endif`,ZU=`#ifdef USE_NORMALMAP
uniform sampler2D normalMap;
uniform vec2 normalScale;
#endif
#ifdef USE_NORMALMAP_OBJECTSPACE
uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
vec3 q0 = dFdx( eye_pos.xyz );
vec3 q1 = dFdy( eye_pos.xyz );
vec2 st0 = dFdx( uv.st );
vec2 st1 = dFdy( uv.st );
vec3 N = surf_norm;
vec3 q1perp = cross( q1, N );
vec3 q0perp = cross( N, q0 );
vec3 T = q1perp * st0.x + q0perp * st1.x;
vec3 B = q1perp * st0.y + q0perp * st1.y;
float det = max( dot( T, T ), dot( B, B ) );
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
return mat3( T * scale, B * scale, N );
}
#endif`,eO=`#ifdef USE_CLEARCOAT
vec3 clearcoatNormal = geometryNormal;
#endif`,tO=`#ifdef USE_CLEARCOAT_NORMALMAP
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
clearcoatMapN.xy *= clearcoatNormalScale;
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,nO=`#ifdef USE_CLEARCOATMAP
uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
uniform sampler2D clearcoatNormalMap;
uniform vec2 clearcoatNormalScale;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform sampler2D clearcoatRoughnessMap;
#endif`,iO=`#ifdef USE_IRIDESCENCEMAP
uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform sampler2D iridescenceThicknessMap;
#endif`,rO=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,sO=`vec3 packNormalToRGB( const in vec3 normal ) {
return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
const float ShiftRight8 = 1. / 256.;
vec4 packDepthToRGBA( const in float v ) {
vec4 r = vec4( fract( v * PackFactors ), v );
r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
}
float unpackRGBAToDepth( const in vec4 v ) {
return dot( v, UnpackFactors );
}
vec2 packDepthToRG( in highp float v ) {
return packDepthToRGBA( v ).yx;
}
float unpackRGToDepth( const in highp vec2 v ) {
return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
}
vec4 pack2HalfToRGBA( vec2 v ) {
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( vec4 v ) {
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
return depth * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
return ( near * far ) / ( ( far - near ) * depth - far );
}`,aO=`#ifdef PREMULTIPLIED_ALPHA
gl_FragColor.rgb *= gl_FragColor.a;
#endif`,oO=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_INSTANCING
mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,lO=`#ifdef DITHERING
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,cO=`#ifdef DITHERING
vec3 dithering( vec3 color ) {
float grid_position = rand( gl_FragCoord.xy );
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
return color + dither_shift_RGB;
}
#endif`,uO=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
roughnessFactor *= texelRoughness.g;
#endif`,hO=`#ifdef USE_ROUGHNESSMAP
uniform sampler2D roughnessMap;
#endif`,fO=`#if NUM_SPOT_LIGHT_COORDS > 0
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
#endif
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
struct DirectionalLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
struct SpotLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
struct PointLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
float shadowCameraNear;
float shadowCameraFar;
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
}
vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
return unpackRGBATo2Half( texture2D( shadow, uv ) );
}
float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
float occlusion = 1.0;
vec2 distribution = texture2DDistribution( shadow, uv );
float hard_shadow = step( compare , distribution.x );
if (hard_shadow != 1.0 ) {
float distance = compare - distribution.x ;
float variance = max( 0.00000, distribution.y * distribution.y );
float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
}
return occlusion;
}
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
float shadow = 1.0;
shadowCoord.xyz /= shadowCoord.w;
shadowCoord.z += shadowBias;
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
if ( frustumTest ) {
#if defined( SHADOWMAP_TYPE_PCF )
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
float dx0 = - texelSize.x * shadowRadius;
float dy0 = - texelSize.y * shadowRadius;
float dx1 = + texelSize.x * shadowRadius;
float dy1 = + texelSize.y * shadowRadius;
float dx2 = dx0 / 2.0;
float dy2 = dy0 / 2.0;
float dx3 = dx1 / 2.0;
float dy3 = dy1 / 2.0;
shadow = (
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
) * ( 1.0 / 17.0 );
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
float dx = texelSize.x;
float dy = texelSize.y;
vec2 uv = shadowCoord.xy;
vec2 f = fract( uv * shadowMapSize + 0.5 );
uv -= f * texelSize;
shadow = (
texture2DCompare( shadowMap, uv, shadowCoord.z ) +
texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
f.x ) +
mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
f.x ) +
mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
f.y ) +
mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
f.y ) +
mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
f.x ),
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
f.x ),
f.y )
) * ( 1.0 / 9.0 );
#elif defined( SHADOWMAP_TYPE_VSM )
shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
#else
shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
#endif
}
return shadow;
}
vec2 cubeToUV( vec3 v, float texelSizeY ) {
vec3 absV = abs( v );
float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
absV *= scaleToCube;
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
vec2 planar = v.xy;
float almostATexel = 1.5 * texelSizeY;
float almostOne = 1.0 - almostATexel;
if ( absV.z >= almostOne ) {
if ( v.z > 0.0 )
planar.x = 4.0 - v.x;
} else if ( absV.x >= almostOne ) {
float signX = sign( v.x );
planar.x = v.z * signX + 2.0 * signX;
} else if ( absV.y >= almostOne ) {
float signY = sign( v.y );
planar.x = v.x + 2.0 * signY + 2.0;
planar.y = v.z * signY - 2.0;
}
return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
}
float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
vec3 lightToPosition = shadowCoord.xyz;
float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
vec3 bd3D = normalize( lightToPosition );
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
return (
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
) * ( 1.0 / 9.0 );
#else
return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
#endif
}
#endif`,dO=`#if NUM_SPOT_LIGHT_COORDS > 0
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
struct DirectionalLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
struct SpotLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
struct PointLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
float shadowCameraNear;
float shadowCameraFar;
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
#endif`,pO=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
vec4 shadowWorldPosition;
#endif
#if defined( USE_SHADOWMAP )
#if NUM_DIR_LIGHT_SHADOWS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif
#endif
#if NUM_SPOT_LIGHT_COORDS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
shadowWorldPosition = worldPosition;
#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
#endif
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif`,gO=`float getShadowMask() {
float shadow = 1.0;
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
DirectionalLightShadow directionalLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
directionalLight = directionalLightShadows[ i ];
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
}
#pragma unroll_loop_end
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
SpotLightShadow spotLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
spotLight = spotLightShadows[ i ];
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
}
#pragma unroll_loop_end
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
PointLightShadow pointLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
pointLight = pointLightShadows[ i ];
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
}
#pragma unroll_loop_end
#endif
#endif
return shadow;
}`,mO=`#ifdef USE_SKINNING
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,AO=`#ifdef USE_SKINNING
uniform mat4 bindMatrix;
uniform mat4 bindMatrixInverse;
uniform highp sampler2D boneTexture;
uniform int boneTextureSize;
mat4 getBoneMatrix( const in float i ) {
float j = i * 4.0;
float x = mod( j, float( boneTextureSize ) );
float y = floor( j / float( boneTextureSize ) );
float dx = 1.0 / float( boneTextureSize );
float dy = 1.0 / float( boneTextureSize );
y = dy * ( y + 0.5 );
vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
mat4 bone = mat4( v1, v2, v3, v4 );
return bone;
}
#endif`,vO=`#ifdef USE_SKINNING
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
vec4 skinned = vec4( 0.0 );
skinned += boneMatX * skinVertex * skinWeight.x;
skinned += boneMatY * skinVertex * skinWeight.y;
skinned += boneMatZ * skinVertex * skinWeight.z;
skinned += boneMatW * skinVertex * skinWeight.w;
transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,yO=`#ifdef USE_SKINNING
mat4 skinMatrix = mat4( 0.0 );
skinMatrix += skinWeight.x * boneMatX;
skinMatrix += skinWeight.y * boneMatY;
skinMatrix += skinWeight.z * boneMatZ;
skinMatrix += skinWeight.w * boneMatW;
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
#ifdef USE_TANGENT
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#endif
#endif`,xO=`float specularStrength;
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
#endif`,_O=`#ifdef USE_SPECULARMAP
uniform sampler2D specularMap;
#endif`,EO=`#if defined( TONE_MAPPING )
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,SO=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
return saturate( toneMappingExposure * color );
}
vec3 ReinhardToneMapping( vec3 color ) {
color *= toneMappingExposure;
return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 OptimizedCineonToneMapping( vec3 color ) {
color *= toneMappingExposure;
color = max( vec3( 0.0 ), color - 0.004 );
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
const mat3 ACESInputMat = mat3(
vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
vec3( 0.04823, 0.01566, 0.83777 )
);
const mat3 ACESOutputMat = mat3(
vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
vec3( -0.07367, -0.00605, 1.07602 )
);
color *= toneMappingExposure / 0.6;
color = ACESInputMat * color;
color = RRTAndODTFit( color );
color = ACESOutputMat * color;
return saturate( color );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,wO=`#ifdef USE_TRANSMISSION
material.transmission = transmission;
material.transmissionAlpha = 1.0;
material.thickness = thickness;
material.attenuationDistance = attenuationDistance;
material.attenuationColor = attenuationColor;
#ifdef USE_TRANSMISSIONMAP
material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
#endif
#ifdef USE_THICKNESSMAP
material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
#endif
vec3 pos = vWorldPosition;
vec3 v = normalize( cameraPosition - pos );
vec3 n = inverseTransformDirection( normal, viewMatrix );
vec4 transmitted = getIBLVolumeRefraction(
n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
material.attenuationColor, material.attenuationDistance );
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
#endif`,CO=`#ifdef USE_TRANSMISSION
uniform float transmission;
uniform float thickness;
uniform float attenuationDistance;
uniform vec3 attenuationColor;
#ifdef USE_TRANSMISSIONMAP
uniform sampler2D transmissionMap;
#endif
#ifdef USE_THICKNESSMAP
uniform sampler2D thicknessMap;
#endif
uniform vec2 transmissionSamplerSize;
uniform sampler2D transmissionSamplerMap;
uniform mat4 modelMatrix;
uniform mat4 projectionMatrix;
varying vec3 vWorldPosition;
float w0( float a ) {
return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
}
float w1( float a ) {
return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
}
float w2( float a ){
return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
}
float w3( float a ) {
return ( 1.0 / 6.0 ) * ( a * a * a );
}
float g0( float a ) {
return w0( a ) + w1( a );
}
float g1( float a ) {
return w2( a ) + w3( a );
}
float h0( float a ) {
return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
}
float h1( float a ) {
return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
}
vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
uv = uv * texelSize.zw + 0.5;
vec2 iuv = floor( uv );
vec2 fuv = fract( uv );
float g0x = g0( fuv.x );
float g1x = g1( fuv.x );
float h0x = h0( fuv.x );
float h1x = h1( fuv.x );
float h0y = h0( fuv.y );
float h1y = h1( fuv.y );
vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
}
vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
vec2 fLodSizeInv = 1.0 / fLodSize;
vec2 cLodSizeInv = 1.0 / cLodSize;
vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
return mix( fSample, cSample, fract( lod ) );
}
vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
vec3 modelScale;
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
return normalize( refractionVector ) * thickness * modelScale;
}
float applyIorToRoughness( const in float roughness, const in float ior ) {
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
}
vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
}
vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
if ( isinf( attenuationDistance ) ) {
return vec3( 1.0 );
} else {
vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
}
}
vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
const in vec3 attenuationColor, const in float attenuationDistance ) {
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
vec3 refractedRayExit = position + transmissionRay;
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
refractionCoords += 1.0;
refractionCoords /= 2.0;
vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
vec3 attenuatedColor = transmittance * transmittedLight.rgb;
vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
}
#endif`,TO=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
varying vec2 vNormalMapUv;
#endif
#ifdef USE_EMISSIVEMAP
varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_SPECULARMAP
varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
uniform mat3 transmissionMapTransform;
varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
#endif`,bO=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
uniform mat3 mapTransform;
varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
uniform mat3 alphaMapTransform;
varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
uniform mat3 lightMapTransform;
varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
uniform mat3 aoMapTransform;
varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
uniform mat3 bumpMapTransform;
varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
uniform mat3 normalMapTransform;
varying vec2 vNormalMapUv;
#endif
#ifdef USE_DISPLACEMENTMAP
uniform mat3 displacementMapTransform;
varying vec2 vDisplacementMapUv;
#endif
#ifdef USE_EMISSIVEMAP
uniform mat3 emissiveMapTransform;
varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
uniform mat3 metalnessMapTransform;
varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
uniform mat3 roughnessMapTransform;
varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
uniform mat3 anisotropyMapTransform;
varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
uniform mat3 clearcoatMapTransform;
varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
uniform mat3 clearcoatNormalMapTransform;
varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform mat3 clearcoatRoughnessMapTransform;
varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
uniform mat3 sheenColorMapTransform;
varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
uniform mat3 sheenRoughnessMapTransform;
varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
uniform mat3 iridescenceMapTransform;
varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform mat3 iridescenceThicknessMapTransform;
varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SPECULARMAP
uniform mat3 specularMapTransform;
varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
uniform mat3 specularColorMapTransform;
varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
uniform mat3 specularIntensityMapTransform;
varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
uniform mat3 transmissionMapTransform;
varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
#endif`,IO=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ALPHAMAP
vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_LIGHTMAP
vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_AOMAP
vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_BUMPMAP
vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_NORMALMAP
vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_DISPLACEMENTMAP
vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_EMISSIVEMAP
vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_METALNESSMAP
vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ROUGHNESSMAP
vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ANISOTROPYMAP
vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOATMAP
vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCEMAP
vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_COLORMAP
vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULARMAP
vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_COLORMAP
vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_TRANSMISSIONMAP
vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_THICKNESSMAP
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
#endif`,MO=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
vec4 worldPosition = vec4( transformed, 1.0 );
#ifdef USE_INSTANCING
worldPosition = instanceMatrix * worldPosition;
#endif
worldPosition = modelMatrix * worldPosition;
#endif`;const RO=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,BO=`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
vec4 texColor = texture2D( t2D, vUv );
texColor.rgb *= backgroundIntensity;
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,DO=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,PO=`#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
uniform sampler2D envMap;
#endif
uniform float flipEnvMap;
uniform float backgroundBlurriness;
uniform float backgroundIntensity;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
#ifdef ENVMAP_TYPE_CUBE
vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
#elif defined( ENVMAP_TYPE_CUBE_UV )
vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );
#else
vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
#endif
texColor.rgb *= backgroundIntensity;
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,LO=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,UO=`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
void main() {
vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
gl_FragColor = texColor;
gl_FragColor.a *= opacity;
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,OO=`#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
#include <uv_vertex>
#include <skinbase_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vHighPrecisionZW = gl_Position.zw;
}`,FO=`#if DEPTH_PACKING == 3200
uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( 1.0 );
#if DEPTH_PACKING == 3200
diffuseColor.a = opacity;
#endif
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <logdepthbuf_fragment>
float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
#if DEPTH_PACKING == 3200
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
#elif DEPTH_PACKING == 3201
gl_FragColor = packDepthToRGBA( fragCoordZ );
#endif
}`,kO=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <skinbase_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <worldpos_vertex>
#include <clipping_planes_vertex>
vWorldPosition = worldPosition.xyz;
}`,NO=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( 1.0 );
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
float dist = length( vWorldPosition - referencePosition );
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
dist = saturate( dist );
gl_FragColor = packDepthToRGBA( dist );
}`,GO=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}`,zO=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,QO=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
vLineDistance = scale * lineDistance;
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
}`,HO=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
if ( mod( vLineDistance, totalSize ) > dashSize ) {
discard;
}
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,VO=`#include <common>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <envmap_vertex>
#include <fog_vertex>
}`,WO=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
#else
reflectedLight.indirectDiffuse += vec3( 1.0 );
#endif
#include <aomap_fragment>
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
vec3 outgoingLight = reflectedLight.indirectDiffuse;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,YO=`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,qO=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_lambert_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,XO=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
vViewPosition = - mvPosition.xyz;
}`,jO=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
vec3 viewDir = normalize( vViewPosition );
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
vec3 y = cross( viewDir, x );
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
#ifdef USE_MATCAP
vec4 matcapColor = texture2D( matcap, uv );
#else
vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
#endif
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,KO=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
vViewPosition = - mvPosition.xyz;
#endif
}`,$O=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
#include <packing>
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
#ifdef OPAQUE
gl_FragColor.a = 1.0;
#endif
}`,JO=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,ZO=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_phong_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,eF=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
varying vec3 vWorldPosition;
#endif
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
#ifdef USE_TRANSMISSION
vWorldPosition = worldPosition.xyz;
#endif
}`,tF=`#define STANDARD
#ifdef PHYSICAL
#define IOR
#define USE_SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
uniform float ior;
#endif
#ifdef USE_SPECULAR
uniform float specularIntensity;
uniform vec3 specularColor;
#ifdef USE_SPECULAR_COLORMAP
uniform sampler2D specularColorMap;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
uniform sampler2D specularIntensityMap;
#endif
#endif
#ifdef USE_CLEARCOAT
uniform float clearcoat;
uniform float clearcoatRoughness;
#endif
#ifdef USE_IRIDESCENCE
uniform float iridescence;
uniform float iridescenceIOR;
uniform float iridescenceThicknessMinimum;
uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
uniform vec3 sheenColor;
uniform float sheenRoughness;
#ifdef USE_SHEEN_COLORMAP
uniform sampler2D sheenColorMap;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
uniform sampler2D sheenRoughnessMap;
#endif
#endif
#ifdef USE_ANISOTROPY
uniform vec2 anisotropyVector;
#ifdef USE_ANISOTROPYMAP
uniform sampler2D anisotropyMap;
#endif
#endif
varying vec3 vViewPosition;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <roughnessmap_fragment>
#include <metalnessmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <clearcoat_normal_fragment_begin>
#include <clearcoat_normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_physical_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
#include <transmission_fragment>
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
#ifdef USE_SHEEN
float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;
#endif
#ifdef USE_CLEARCOAT
float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;
#endif
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,nF=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,iF=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_toon_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,rF=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
#ifdef USE_POINTS_UV
varying vec2 vUv;
uniform mat3 uvTransform;
#endif
void main() {
#ifdef USE_POINTS_UV
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
#endif
#include <color_vertex>
#include <morphcolor_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
gl_PointSize = size;
#ifdef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
#endif
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <fog_vertex>
}`,sF=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_particle_fragment>
#include <color_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,aF=`#include <common>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,oF=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <packing>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <logdepthbuf_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
#include <logdepthbuf_fragment>
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
}`,lF=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
vec2 scale;
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
#ifndef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) scale *= - mvPosition.z;
#endif
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
vec2 rotatedPosition;
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
mvPosition.xy += rotatedPosition;
gl_Position = projectionMatrix * mvPosition;
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
}`,cF=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
}`,kt={alphahash_fragment:PL,alphahash_pars_fragment:LL,alphamap_fragment:UL,alphamap_pars_fragment:OL,alphatest_fragment:FL,alphatest_pars_fragment:kL,aomap_fragment:NL,aomap_pars_fragment:GL,begin_vertex:zL,beginnormal_vertex:QL,bsdfs:HL,iridescence_fragment:VL,bumpmap_pars_fragment:WL,clipping_planes_fragment:YL,clipping_planes_pars_fragment:qL,clipping_planes_pars_vertex:XL,clipping_planes_vertex:jL,color_fragment:KL,color_pars_fragment:$L,color_pars_vertex:JL,color_vertex:ZL,common:eU,cube_uv_reflection_fragment:tU,defaultnormal_vertex:nU,displacementmap_pars_vertex:iU,displacementmap_vertex:rU,emissivemap_fragment:sU,emissivemap_pars_fragment:aU,colorspace_fragment:oU,colorspace_pars_fragment:lU,envmap_fragment:cU,envmap_common_pars_fragment:uU,envmap_pars_fragment:hU,envmap_pars_vertex:fU,envmap_physical_pars_fragment:wU,envmap_vertex:dU,fog_vertex:pU,fog_pars_vertex:gU,fog_fragment:mU,fog_pars_fragment:AU,gradientmap_pars_fragment:vU,lightmap_fragment:yU,lightmap_pars_fragment:xU,lights_lambert_fragment:_U,lights_lambert_pars_fragment:EU,lights_pars_begin:SU,lights_toon_fragment:CU,lights_toon_pars_fragment:TU,lights_phong_fragment:bU,lights_phong_pars_fragment:IU,lights_physical_fragment:MU,lights_physical_pars_fragment:RU,lights_fragment_begin:BU,lights_fragment_maps:DU,lights_fragment_end:PU,logdepthbuf_fragment:LU,logdepthbuf_pars_fragment:UU,logdepthbuf_pars_vertex:OU,logdepthbuf_vertex:FU,map_fragment:kU,map_pars_fragment:NU,map_particle_fragment:GU,map_particle_pars_fragment:zU,metalnessmap_fragment:QU,metalnessmap_pars_fragment:HU,morphcolor_vertex:VU,morphnormal_vertex:WU,morphtarget_pars_vertex:YU,morphtarget_vertex:qU,normal_fragment_begin:XU,normal_fragment_maps:jU,normal_pars_fragment:KU,normal_pars_vertex:$U,normal_vertex:JU,normalmap_pars_fragment:ZU,clearcoat_normal_fragment_begin:eO,clearcoat_normal_fragment_maps:tO,clearcoat_pars_fragment:nO,iridescence_pars_fragment:iO,opaque_fragment:rO,packing:sO,premultiplied_alpha_fragment:aO,project_vertex:oO,dithering_fragment:lO,dithering_pars_fragment:cO,roughnessmap_fragment:uO,roughnessmap_pars_fragment:hO,shadowmap_pars_fragment:fO,shadowmap_pars_vertex:dO,shadowmap_vertex:pO,shadowmask_pars_fragment:gO,skinbase_vertex:mO,skinning_pars_vertex:AO,skinning_vertex:vO,skinnormal_vertex:yO,specularmap_fragment:xO,specularmap_pars_fragment:_O,tonemapping_fragment:EO,tonemapping_pars_fragment:SO,transmission_fragment:wO,transmission_pars_fragment:CO,uv_pars_fragment:TO,uv_pars_vertex:bO,uv_vertex:IO,worldpos_vertex:MO,background_vert:RO,background_frag:BO,backgroundCube_vert:DO,backgroundCube_frag:PO,cube_vert:LO,cube_frag:UO,depth_vert:OO,depth_frag:FO,distanceRGBA_vert:kO,distanceRGBA_frag:NO,equirect_vert:GO,equirect_frag:zO,linedashed_vert:QO,linedashed_frag:HO,meshbasic_vert:VO,meshbasic_frag:WO,meshlambert_vert:YO,meshlambert_frag:qO,meshmatcap_vert:XO,meshmatcap_frag:jO,meshnormal_vert:KO,meshnormal_frag:$O,meshphong_vert:JO,meshphong_frag:ZO,meshphysical_vert:eF,meshphysical_frag:tF,meshtoon_vert:nF,meshtoon_frag:iF,points_vert:rF,points_frag:sF,shadow_vert:aF,shadow_frag:oF,sprite_vert:lF,sprite_frag:cF},Je={common:{diffuse:{value:new He(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Qt},alphaMap:{value:null},alphaMapTransform:{value:new Qt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Qt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Qt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Qt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Qt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Qt},normalScale:{value:new _e(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Qt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Qt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Qt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Qt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new He(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new He(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Qt},alphaTest:{value:0},uvTransform:{value:new Qt}},sprite:{diffuse:{value:new He(16777215)},opacity:{value:1},center:{value:new _e(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Qt},alphaMap:{value:null},alphaMapTransform:{value:new Qt},alphaTest:{value:0}}},aa={basic:{uniforms:wr([Je.common,Je.specularmap,Je.envmap,Je.aomap,Je.lightmap,Je.fog]),vertexShader:kt.meshbasic_vert,fragmentShader:kt.meshbasic_frag},lambert:{uniforms:wr([Je.common,Je.specularmap,Je.envmap,Je.aomap,Je.lightmap,Je.emissivemap,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.fog,Je.lights,{emissive:{value:new He(0)}}]),vertexShader:kt.meshlambert_vert,fragmentShader:kt.meshlambert_frag},phong:{uniforms:wr([Je.common,Je.specularmap,Je.envmap,Je.aomap,Je.lightmap,Je.emissivemap,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.fog,Je.lights,{emissive:{value:new He(0)},specular:{value:new He(1118481)},shininess:{value:30}}]),vertexShader:kt.meshphong_vert,fragmentShader:kt.meshphong_frag},standard:{uniforms:wr([Je.common,Je.envmap,Je.aomap,Je.lightmap,Je.emissivemap,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.roughnessmap,Je.metalnessmap,Je.fog,Je.lights,{emissive:{value:new He(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:kt.meshphysical_vert,fragmentShader:kt.meshphysical_frag},toon:{uniforms:wr([Je.common,Je.aomap,Je.lightmap,Je.emissivemap,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.gradientmap,Je.fog,Je.lights,{emissive:{value:new He(0)}}]),vertexShader:kt.meshtoon_vert,fragmentShader:kt.meshtoon_frag},matcap:{uniforms:wr([Je.common,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.fog,{matcap:{value:null}}]),vertexShader:kt.meshmatcap_vert,fragmentShader:kt.meshmatcap_frag},points:{uniforms:wr([Je.points,Je.fog]),vertexShader:kt.points_vert,fragmentShader:kt.points_frag},dashed:{uniforms:wr([Je.common,Je.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:kt.linedashed_vert,fragmentShader:kt.linedashed_frag},depth:{uniforms:wr([Je.common,Je.displacementmap]),vertexShader:kt.depth_vert,fragmentShader:kt.depth_frag},normal:{uniforms:wr([Je.common,Je.bumpmap,Je.normalmap,Je.displacementmap,{opacity:{value:1}}]),vertexShader:kt.meshnormal_vert,fragmentShader:kt.meshnormal_frag},sprite:{uniforms:wr([Je.sprite,Je.fog]),vertexShader:kt.sprite_vert,fragmentShader:kt.sprite_frag},background:{uniforms:{uvTransform:{value:new Qt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:kt.background_vert,fragmentShader:kt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:kt.backgroundCube_vert,fragmentShader:kt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:kt.cube_vert,fragmentShader:kt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:kt.equirect_vert,fragmentShader:kt.equirect_frag},distanceRGBA:{uniforms:wr([Je.common,Je.displacementmap,{referencePosition:{value:new N},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:kt.distanceRGBA_vert,fragmentShader:kt.distanceRGBA_frag},shadow:{uniforms:wr([Je.lights,Je.fog,{color:{value:new He(0)},opacity:{value:1}}]),vertexShader:kt.shadow_vert,fragmentShader:kt.shadow_frag}};aa.physical={uniforms:wr([aa.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Qt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Qt},clearcoatNormalScale:{value:new _e(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Qt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Qt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Qt},sheen:{value:0},sheenColor:{value:new He(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Qt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Qt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Qt},transmissionSamplerSize:{value:new _e},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Qt},attenuationDistance:{value:0},attenuationColor:{value:new He(0)},specularColor:{value:new He(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Qt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Qt},anisotropyVector:{value:new _e},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Qt}}]),vertexShader:kt.meshphysical_vert,fragmentShader:kt.meshphysical_frag};const ig={r:0,b:0,g:0};function uF(n,e,t,i,r,s,a){const o=new He(0);let l=s===!0?0:1,c,u,h=null,f=0,p=null;function m(v,A){let _=!1,x=A.isScene===!0?A.background:null;switch(x&&x.isTexture&&(x=(A.backgroundBlurriness>0?t:e).get(x)),x===null?y(o,l):x&&x.isColor&&(y(x,1),_=!0),n.xr.getEnvironmentBlendMode()){case"opaque":_=!0;break;case"additive":i.buffers.color.setClear(0,0,0,1,a),_=!0;break;case"alpha-blend":i.buffers.color.setClear(0,0,0,0,a),_=!0;break}(n.autoClear||_)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),x&&(x.isCubeTexture||x.mapping===of)?(u===void 0&&(u=new nn(new qo(1,1,1),new sn({name:"BackgroundCubeMaterial",uniforms:Wh(aa.backgroundCube.uniforms),vertexShader:aa.backgroundCube.vertexShader,fragmentShader:aa.backgroundCube.fragmentShader,side:Ki,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(I,T,M){this.matrixWorld.copyPosition(M.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),u.material.uniforms.envMap.value=x,u.material.uniforms.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=A.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,u.material.toneMapped=x.colorSpace!==Nt,(h!==x||f!==x.version||p!==n.toneMapping)&&(u.material.needsUpdate=!0,h=x,f=x.version,p=n.toneMapping),u.layers.enableAll(),v.unshift(u,u.geometry,u.material,0,0,null)):x&&x.isTexture&&(c===void 0&&(c=new nn(new Xo(2,2),new sn({name:"BackgroundMaterial",uniforms:Wh(aa.background.uniforms),vertexShader:aa.background.vertexShader,fragmentShader:aa.background.fragmentShader,side:$a,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=x,c.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,c.material.toneMapped=x.colorSpace!==Nt,x.matrixAutoUpdate===!0&&x.updateMatrix(),c.material.uniforms.uvTransform.value.copy(x.matrix),(h!==x||f!==x.version||p!==n.toneMapping)&&(c.material.needsUpdate=!0,h=x,f=x.version,p=n.toneMapping),c.layers.enableAll(),v.unshift(c,c.geometry,c.material,0,0,null))}function y(v,A){v.getRGB(ig,KC(n)),i.buffers.color.setClear(ig.r,ig.g,ig.b,A,a)}return{getClearColor:function(){return o},setClearColor:function(v,A=1){o.set(v),l=A,y(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(v){l=v,y(o,l)},render:m}}function hF(n,e,t,i){const r=n.getParameter(n.MAX_VERTEX_ATTRIBS),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),a=i.isWebGL2||s!==null,o={},l=v(null);let c=l,u=!1;function h(Q,G,F,q,Y){let H=!1;if(a){const V=y(q,F,G);c!==V&&(c=V,p(c.object)),H=A(Q,q,F,Y),H&&_(Q,q,F,Y)}else{const V=G.wireframe===!0;(c.geometry!==q.id||c.program!==F.id||c.wireframe!==V)&&(c.geometry=q.id,c.program=F.id,c.wireframe=V,H=!0)}Y!==null&&t.update(Y,n.ELEMENT_ARRAY_BUFFER),(H||u)&&(u=!1,M(Q,G,F,q),Y!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(Y).buffer))}function f(){return i.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function p(Q){return i.isWebGL2?n.bindVertexArray(Q):s.bindVertexArrayOES(Q)}function m(Q){return i.isWebGL2?n.deleteVertexArray(Q):s.deleteVertexArrayOES(Q)}function y(Q,G,F){const q=F.wireframe===!0;let Y=o[Q.id];Y===void 0&&(Y={},o[Q.id]=Y);let H=Y[G.id];H===void 0&&(H={},Y[G.id]=H);let V=H[q];return V===void 0&&(V=v(f()),H[q]=V),V}function v(Q){const G=[],F=[],q=[];for(let Y=0;Y<r;Y++)G[Y]=0,F[Y]=0,q[Y]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:G,enabledAttributes:F,attributeDivisors:q,object:Q,attributes:{},index:null}}function A(Q,G,F,q){const Y=c.attributes,H=G.attributes;let V=0;const D=F.getAttributes();for(const k in D)if(D[k].location>=0){const j=Y[k];let ee=H[k];if(ee===void 0&&(k==="instanceMatrix"&&Q.instanceMatrix&&(ee=Q.instanceMatrix),k==="instanceColor"&&Q.instanceColor&&(ee=Q.instanceColor)),j===void 0||j.attribute!==ee||ee&&j.data!==ee.data)return!0;V++}return c.attributesNum!==V||c.index!==q}function _(Q,G,F,q){const Y={},H=G.attributes;let V=0;const D=F.getAttributes();for(const k in D)if(D[k].location>=0){let j=H[k];j===void 0&&(k==="instanceMatrix"&&Q.instanceMatrix&&(j=Q.instanceMatrix),k==="instanceColor"&&Q.instanceColor&&(j=Q.instanceColor));const ee={};ee.attribute=j,j&&j.data&&(ee.data=j.data),Y[k]=ee,V++}c.attributes=Y,c.attributesNum=V,c.index=q}function x(){const Q=c.newAttributes;for(let G=0,F=Q.length;G<F;G++)Q[G]=0}function E(Q){w(Q,0)}function w(Q,G){const F=c.newAttributes,q=c.enabledAttributes,Y=c.attributeDivisors;F[Q]=1,q[Q]===0&&(n.enableVertexAttribArray(Q),q[Q]=1),Y[Q]!==G&&((i.isWebGL2?n:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](Q,G),Y[Q]=G)}function I(){const Q=c.newAttributes,G=c.enabledAttributes;for(let F=0,q=G.length;F<q;F++)G[F]!==Q[F]&&(n.disableVertexAttribArray(F),G[F]=0)}function T(Q,G,F,q,Y,H,V){V===!0?n.vertexAttribIPointer(Q,G,F,Y,H):n.vertexAttribPointer(Q,G,F,q,Y,H)}function M(Q,G,F,q){if(i.isWebGL2===!1&&(Q.isInstancedMesh||q.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;x();const Y=q.attributes,H=F.getAttributes(),V=G.defaultAttributeValues;for(const D in H){const k=H[D];if(k.location>=0){let Z=Y[D];if(Z===void 0&&(D==="instanceMatrix"&&Q.instanceMatrix&&(Z=Q.instanceMatrix),D==="instanceColor"&&Q.instanceColor&&(Z=Q.instanceColor)),Z!==void 0){const j=Z.normalized,ee=Z.itemSize,ie=t.get(Z);if(ie===void 0)continue;const te=ie.buffer,re=ie.type,ce=ie.bytesPerElement,ye=i.isWebGL2===!0&&(re===n.INT||re===n.UNSIGNED_INT||Z.gpuType===x6);if(Z.isInterleavedBufferAttribute){const oe=Z.data,W=oe.stride,ge=Z.offset;if(oe.isInstancedInterleavedBuffer){for(let he=0;he<k.locationSize;he++)w(k.location+he,oe.meshPerAttribute);Q.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=oe.meshPerAttribute*oe.count)}else for(let he=0;he<k.locationSize;he++)E(k.location+he);n.bindBuffer(n.ARRAY_BUFFER,te);for(let he=0;he<k.locationSize;he++)T(k.location+he,ee/k.locationSize,re,j,W*ce,(ge+ee/k.locationSize*he)*ce,ye)}else{if(Z.isInstancedBufferAttribute){for(let oe=0;oe<k.locationSize;oe++)w(k.location+oe,Z.meshPerAttribute);Q.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=Z.meshPerAttribute*Z.count)}else for(let oe=0;oe<k.locationSize;oe++)E(k.location+oe);n.bindBuffer(n.ARRAY_BUFFER,te);for(let oe=0;oe<k.locationSize;oe++)T(k.location+oe,ee/k.locationSize,re,j,ee*ce,ee/k.locationSize*oe*ce,ye)}}else if(V!==void 0){const j=V[D];if(j!==void 0)switch(j.length){case 2:n.vertexAttrib2fv(k.location,j);break;case 3:n.vertexAttrib3fv(k.location,j);break;case 4:n.vertexAttrib4fv(k.location,j);break;default:n.vertexAttrib1fv(k.location,j)}}}}I()}function b(){U();for(const Q in o){const G=o[Q];for(const F in G){const q=G[F];for(const Y in q)m(q[Y].object),delete q[Y];delete G[F]}delete o[Q]}}function B(Q){if(o[Q.id]===void 0)return;const G=o[Q.id];for(const F in G){const q=G[F];for(const Y in q)m(q[Y].object),delete q[Y];delete G[F]}delete o[Q.id]}function L(Q){for(const G in o){const F=o[G];if(F[Q.id]===void 0)continue;const q=F[Q.id];for(const Y in q)m(q[Y].object),delete q[Y];delete F[Q.id]}}function U(){O(),u=!0,c!==l&&(c=l,p(c.object))}function O(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:h,reset:U,resetDefaultState:O,dispose:b,releaseStatesOfGeometry:B,releaseStatesOfProgram:L,initAttributes:x,enableAttribute:E,disableUnusedAttributes:I}}function fF(n,e,t,i){const r=i.isWebGL2;let s;function a(c){s=c}function o(c,u){n.drawArrays(s,c,u),t.update(u,s,1)}function l(c,u,h){if(h===0)return;let f,p;if(r)f=n,p="drawArraysInstanced";else if(f=e.get("ANGLE_instanced_arrays"),p="drawArraysInstancedANGLE",f===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}f[p](s,c,u,h),t.update(u,s,h)}this.setMode=a,this.render=o,this.renderInstances=l}function dF(n,e,t){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const T=e.get("EXT_texture_filter_anisotropic");i=n.getParameter(T.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function s(T){if(T==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";T="mediump"}return T==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const a=typeof WebGL2RenderingContext<"u"&&n.constructor.name==="WebGL2RenderingContext";let o=t.precision!==void 0?t.precision:"highp";const l=s(o);l!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",l,"instead."),o=l);const c=a||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,h=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),f=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),p=n.getParameter(n.MAX_TEXTURE_SIZE),m=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),y=n.getParameter(n.MAX_VERTEX_ATTRIBS),v=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),A=n.getParameter(n.MAX_VARYING_VECTORS),_=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),x=f>0,E=a||e.has("OES_texture_float"),w=x&&E,I=a?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:a,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:s,precision:o,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:f,maxTextureSize:p,maxCubemapSize:m,maxAttributes:y,maxVertexUniforms:v,maxVaryings:A,maxFragmentUniforms:_,vertexTextures:x,floatFragmentTextures:E,floatVertexTextures:w,maxSamples:I}}function pF(n){const e=this;let t=null,i=0,r=!1,s=!1;const a=new rs,o=new Qt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f){const p=h.length!==0||f||i!==0||r;return r=f,i=h.length,p},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,f){t=u(h,f,0)},this.setState=function(h,f,p){const m=h.clippingPlanes,y=h.clipIntersection,v=h.clipShadows,A=n.get(h);if(!r||m===null||m.length===0||s&&!v)s?u(null):c();else{const _=s?0:i,x=_*4;let E=A.clippingState||null;l.value=E,E=u(m,f,x,p);for(let w=0;w!==x;++w)E[w]=t[w];A.clippingState=E,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=_}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(h,f,p,m){const y=h!==null?h.length:0;let v=null;if(y!==0){if(v=l.value,m!==!0||v===null){const A=p+y*4,_=f.matrixWorldInverse;o.getNormalMatrix(_),(v===null||v.length<A)&&(v=new Float32Array(A));for(let x=0,E=p;x!==y;++x,E+=4)a.copy(h[x]).applyMatrix4(_,o),a.normal.toArray(v,E),v[E+3]=a.constant}l.value=v,l.needsUpdate=!0}return e.numPlanes=y,e.numIntersection=0,v}}function gF(n){let e=new WeakMap;function t(a,o){return o===Ap?a.mapping=Fl:o===vp&&(a.mapping=kl),a}function i(a){if(a&&a.isTexture&&a.isRenderTargetTexture===!1){const o=a.mapping;if(o===Ap||o===vp)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new JC(l.height/2);return c.fromEquirectangularTexture(n,a),e.set(a,c),a.addEventListener("dispose",r),t(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class ql extends o0{constructor(e=-1,t=1,i=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,a=i+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Th=4,M_=[.125,.215,.35,.446,.526,.582],Nc=20,uv=new ql,R_=new He;let hv=null;const Dc=(1+Math.sqrt(5))/2,ih=1/Dc,B_=[new N(1,1,1),new N(-1,1,1),new N(1,1,-1),new N(-1,1,-1),new N(0,Dc,ih),new N(0,Dc,-ih),new N(ih,0,Dc),new N(-ih,0,Dc),new N(Dc,ih,0),new N(-Dc,ih,0)];class oy{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){hv=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=L_(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=P_(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(hv),e.scissorTest=!1,rg(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Fl||e.mapping===kl?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),hv=this._renderer.getRenderTarget();const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:Tn,minFilter:Tn,generateMipmaps:!1,type:Ai,format:li,colorSpace:fa,depthBuffer:!1},r=D_(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=D_(e,t,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=mF(s)),this._blurMaterial=AF(s,e,t)}return r}_compileMaterial(e){const t=new nn(this._lodPlanes[0],e);this._renderer.compile(t,uv)}_sceneToCubeUV(e,t,i,r){const o=new Kn(90,1,t,i),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,f=u.toneMapping;u.getClearColor(R_),u.toneMapping=os,u.autoClear=!1;const p=new cs({name:"PMREM.Background",side:Ki,depthWrite:!1,depthTest:!1}),m=new nn(new qo,p);let y=!1;const v=e.background;v?v.isColor&&(p.color.copy(v),e.background=null,y=!0):(p.color.copy(R_),y=!0);for(let A=0;A<6;A++){const _=A%3;_===0?(o.up.set(0,l[A],0),o.lookAt(c[A],0,0)):_===1?(o.up.set(0,0,l[A]),o.lookAt(0,c[A],0)):(o.up.set(0,l[A],0),o.lookAt(0,0,c[A]));const x=this._cubeSize;rg(r,_*x,A>2?x:0,x,x),u.setRenderTarget(r),y&&u.render(m,o),u.render(e,o)}m.geometry.dispose(),m.material.dispose(),u.toneMapping=f,u.autoClear=h,e.background=v}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===Fl||e.mapping===kl;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=L_()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=P_());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new nn(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;rg(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(a,uv)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let r=1;r<this._lodPlanes.length;r++){const s=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),a=B_[(r-1)%B_.length];this._blur(e,r-1,r,s,a)}t.autoClear=i}_blur(e,t,i,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,r,"latitudinal",s),this._halfBlur(a,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,h=new nn(this._lodPlanes[r],c),f=c.uniforms,p=this._sizeLods[i]-1,m=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*Nc-1),y=s/m,v=isFinite(s)?1+Math.floor(u*y):Nc;v>Nc&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${v} samples when the maximum is set to ${Nc}`);const A=[];let _=0;for(let T=0;T<Nc;++T){const M=T/y,b=Math.exp(-M*M/2);A.push(b),T===0?_+=b:T<v&&(_+=2*b)}for(let T=0;T<A.length;T++)A[T]=A[T]/_;f.envMap.value=e.texture,f.samples.value=v,f.weights.value=A,f.latitudinal.value=a==="latitudinal",o&&(f.poleAxis.value=o);const{_lodMax:x}=this;f.dTheta.value=m,f.mipInt.value=x-i;const E=this._sizeLods[r],w=3*E*(r>x-Th?r-x+Th:0),I=4*(this._cubeSize-E);rg(t,w,I,3*E,2*E),l.setRenderTarget(t),l.render(h,uv)}}function mF(n){const e=[],t=[],i=[];let r=n;const s=n-Th+1+M_.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a>n-Th?l=M_[a-n+Th-1]:a===0&&(l=0),i.push(l);const c=1/(o-2),u=-c,h=1+c,f=[u,u,h,u,h,h,u,u,h,h,u,h],p=6,m=6,y=3,v=2,A=1,_=new Float32Array(y*m*p),x=new Float32Array(v*m*p),E=new Float32Array(A*m*p);for(let I=0;I<p;I++){const T=I%3*2/3-1,M=I>2?0:-1,b=[T,M,0,T+2/3,M,0,T+2/3,M+1,0,T,M,0,T+2/3,M+1,0,T,M+1,0];_.set(b,y*m*I),x.set(f,v*m*I);const B=[I,I,I,I,I,I];E.set(B,A*m*I)}const w=new Bt;w.setAttribute("position",new En(_,y)),w.setAttribute("uv",new En(x,v)),w.setAttribute("faceIndex",new En(E,A)),e.push(w),r>Th&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function D_(n,e,t){const i=new Dn(n,e,t);return i.texture.mapping=of,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function rg(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function AF(n,e,t){const i=new Float32Array(Nc),r=new N(0,1,0);return new sn({name:"SphericalGaussianBlur",defines:{n:Nc,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:L6(),fragmentShader:`
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
uniform int samples;
uniform float weights[ n ];
uniform bool latitudinal;
uniform float dTheta;
uniform float mipInt;
uniform vec3 poleAxis;
#define ENVMAP_TYPE_CUBE_UV
#include <cube_uv_reflection_fragment>
vec3 getSample( float theta, vec3 axis ) {
float cosTheta = cos( theta );
// Rodrigues' axis-angle rotation
vec3 sampleDirection = vOutputDirection * cosTheta
+ cross( axis, vOutputDirection ) * sin( theta )
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
return bilinearCubeUV( envMap, sampleDirection, mipInt );
}
void main() {
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
}
axis = normalize( axis );
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
for ( int i = 1; i < n; i++ ) {
if ( i >= samples ) {
break;
}
float theta = dTheta * float( i );
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
}
}
`,blending:Kt,depthTest:!1,depthWrite:!1})}function P_(){return new sn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:L6(),fragmentShader:`
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
#include <common>
void main() {
vec3 outputDirection = normalize( vOutputDirection );
vec2 uv = equirectUv( outputDirection );
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
}
`,blending:Kt,depthTest:!1,depthWrite:!1})}function L_(){return new sn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:L6(),fragmentShader:`
precision mediump float;
precision mediump int;
uniform float flipEnvMap;
varying vec3 vOutputDirection;
uniform samplerCube envMap;
void main() {
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
}
`,blending:Kt,depthTest:!1,depthWrite:!1})}function L6(){return`
precision mediump float;
precision mediump int;
attribute float faceIndex;
varying vec3 vOutputDirection;
// RH coordinate system; PMREM face-indexing convention
vec3 getDirection( vec2 uv, float face ) {
uv = 2.0 * uv - 1.0;
vec3 direction = vec3( uv, 1.0 );
if ( face == 0.0 ) {
direction = direction.zyx; // ( 1, v, u ) pos x
} else if ( face == 1.0 ) {
direction = direction.xzy;
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
} else if ( face == 2.0 ) {
direction.x *= -1.0; // ( -u, v, 1 ) pos z
} else if ( face == 3.0 ) {
direction = direction.zyx;
direction.xz *= -1.0; // ( -1, v, -u ) neg x
} else if ( face == 4.0 ) {
direction = direction.xzy;
direction.xy *= -1.0; // ( -u, -1, v ) neg y
} else if ( face == 5.0 ) {
direction.z *= -1.0; // ( u, v, -1 ) neg z
}
return direction;
}
void main() {
vOutputDirection = getDirection( uv, faceIndex );
gl_Position = vec4( position, 1.0 );
}
`}function vF(n){let e=new WeakMap,t=null;function i(o){if(o&&o.isTexture){const l=o.mapping,c=l===Ap||l===vp,u=l===Fl||l===kl;if(c||u)if(o.isRenderTargetTexture&&o.needsPMREMUpdate===!0){o.needsPMREMUpdate=!1;let h=e.get(o);return t===null&&(t=new oy(n)),h=c?t.fromEquirectangular(o,h):t.fromCubemap(o,h),e.set(o,h),h.texture}else{if(e.has(o))return e.get(o).texture;{const h=o.image;if(c&&h&&h.height>0||u&&h&&r(h)){t===null&&(t=new oy(n));const f=c?t.fromEquirectangular(o):t.fromCubemap(o);return e.set(o,f),o.addEventListener("dispose",s),f.texture}else return null}}}return o}function r(o){let l=0;const c=6;for(let u=0;u<c;u++)o[u]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:a}}function yF(n){const e={};function t(i){if(e[i]!==void 0)return e[i];let r;switch(i){case"WEBGL_depth_texture":r=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=n.getExtension(i)}return e[i]=r,r}return{has:function(i){return t(i)!==null},init:function(i){i.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(i){const r=t(i);return r===null&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function xF(n,e,t,i){const r={},s=new WeakMap;function a(h){const f=h.target;f.index!==null&&e.remove(f.index);for(const m in f.attributes)e.remove(f.attributes[m]);for(const m in f.morphAttributes){const y=f.morphAttributes[m];for(let v=0,A=y.length;v<A;v++)e.remove(y[v])}f.removeEventListener("dispose",a),delete r[f.id];const p=s.get(f);p&&(e.remove(p),s.delete(f)),i.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function o(h,f){return r[f.id]===!0||(f.addEventListener("dispose",a),r[f.id]=!0,t.memory.geometries++),f}function l(h){const f=h.attributes;for(const m in f)e.update(f[m],n.ARRAY_BUFFER);const p=h.morphAttributes;for(const m in p){const y=p[m];for(let v=0,A=y.length;v<A;v++)e.update(y[v],n.ARRAY_BUFFER)}}function c(h){const f=[],p=h.index,m=h.attributes.position;let y=0;if(p!==null){const _=p.array;y=p.version;for(let x=0,E=_.length;x<E;x+=3){const w=_[x+0],I=_[x+1],T=_[x+2];f.push(w,I,I,T,T,w)}}else{const _=m.array;y=m.version;for(let x=0,E=_.length/3-1;x<E;x+=3){const w=x+0,I=x+1,T=x+2;f.push(w,I,I,T,T,w)}}const v=new(XC(f)?U2:P6)(f,1);v.version=y;const A=s.get(h);A&&e.remove(A),s.set(h,v)}function u(h){const f=s.get(h);if(f){const p=h.index;p!==null&&f.version<p.version&&c(h)}else c(h);return s.get(h)}return{get:o,update:l,getWireframeAttribute:u}}function _F(n,e,t,i){const r=i.isWebGL2;let s;function a(f){s=f}let o,l;function c(f){o=f.type,l=f.bytesPerElement}function u(f,p){n.drawElements(s,p,o,f*l),t.update(p,s,1)}function h(f,p,m){if(m===0)return;let y,v;if(r)y=n,v="drawElementsInstanced";else if(y=e.get("ANGLE_instanced_arrays"),v="drawElementsInstancedANGLE",y===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}y[v](s,p,o,f*l,m),t.update(p,s,m)}this.setMode=a,this.setIndex=c,this.render=u,this.renderInstances=h}function EF(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,a,o){switch(t.calls++,a){case n.TRIANGLES:t.triangles+=o*(s/3);break;case n.LINES:t.lines+=o*(s/2);break;case n.LINE_STRIP:t.lines+=o*(s-1);break;case n.LINE_LOOP:t.lines+=o*s;break;case n.POINTS:t.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function SF(n,e){return n[0]-e[0]}function wF(n,e){return Math.abs(e[1])-Math.abs(n[1])}function CF(n,e,t){const i={},r=new Float32Array(8),s=new WeakMap,a=new jt,o=[];for(let c=0;c<8;c++)o[c]=[c,0];function l(c,u,h){const f=c.morphTargetInfluences;if(e.isWebGL2===!0){const p=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,m=p!==void 0?p.length:0;let y=s.get(u);if(y===void 0||y.count!==m){let Q=function(){U.dispose(),s.delete(u),u.removeEventListener("dispose",Q)};y!==void 0&&y.texture.dispose();const _=u.morphAttributes.position!==void 0,x=u.morphAttributes.normal!==void 0,E=u.morphAttributes.color!==void 0,w=u.morphAttributes.position||[],I=u.morphAttributes.normal||[],T=u.morphAttributes.color||[];let M=0;_===!0&&(M=1),x===!0&&(M=2),E===!0&&(M=3);let b=u.attributes.position.count*M,B=1;b>e.maxTextureSize&&(B=Math.ceil(b/e.maxTextureSize),b=e.maxTextureSize);const L=new Float32Array(b*B*4*m),U=new L2(L,b,B,m);U.type=br,U.needsUpdate=!0;const O=M*4;for(let G=0;G<m;G++){const F=w[G],q=I[G],Y=T[G],H=b*B*4*G;for(let V=0;V<F.count;V++){const D=V*O;_===!0&&(a.fromBufferAttribute(F,V),L[H+D+0]=a.x,L[H+D+1]=a.y,L[H+D+2]=a.z,L[H+D+3]=0),x===!0&&(a.fromBufferAttribute(q,V),L[H+D+4]=a.x,L[H+D+5]=a.y,L[H+D+6]=a.z,L[H+D+7]=0),E===!0&&(a.fromBufferAttribute(Y,V),L[H+D+8]=a.x,L[H+D+9]=a.y,L[H+D+10]=a.z,L[H+D+11]=Y.itemSize===4?a.w:1)}}y={count:m,texture:U,size:new _e(b,B)},s.set(u,y),u.addEventListener("dispose",Q)}let v=0;for(let _=0;_<f.length;_++)v+=f[_];const A=u.morphTargetsRelative?1:1-v;h.getUniforms().setValue(n,"morphTargetBaseInfluence",A),h.getUniforms().setValue(n,"morphTargetInfluences",f),h.getUniforms().setValue(n,"morphTargetsTexture",y.texture,t),h.getUniforms().setValue(n,"morphTargetsTextureSize",y.size)}else{const p=f===void 0?0:f.length;let m=i[u.id];if(m===void 0||m.length!==p){m=[];for(let x=0;x<p;x++)m[x]=[x,0];i[u.id]=m}for(let x=0;x<p;x++){const E=m[x];E[0]=x,E[1]=f[x]}m.sort(wF);for(let x=0;x<8;x++)x<p&&m[x][1]?(o[x][0]=m[x][0],o[x][1]=m[x][1]):(o[x][0]=Number.MAX_SAFE_INTEGER,o[x][1]=0);o.sort(SF);const y=u.morphAttributes.position,v=u.morphAttributes.normal;let A=0;for(let x=0;x<8;x++){const E=o[x],w=E[0],I=E[1];w!==Number.MAX_SAFE_INTEGER&&I?(y&&u.getAttribute("morphTarget"+x)!==y[w]&&u.setAttribute("morphTarget"+x,y[w]),v&&u.getAttribute("morphNormal"+x)!==v[w]&&u.setAttribute("morphNormal"+x,v[w]),r[x]=I,A+=I):(y&&u.hasAttribute("morphTarget"+x)===!0&&u.deleteAttribute("morphTarget"+x),v&&u.hasAttribute("morphNormal"+x)===!0&&u.deleteAttribute("morphNormal"+x),r[x]=0)}const _=u.morphTargetsRelative?1:1-A;h.getUniforms().setValue(n,"morphTargetBaseInfluence",_),h.getUniforms().setValue(n,"morphTargetInfluences",r)}}return{update:l}}function TF(n,e,t,i){let r=new WeakMap;function s(l){const c=i.render.frame,u=l.geometry,h=e.get(l,u);if(r.get(h)!==c&&(e.update(h),r.set(h,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),r.get(l)!==c&&(t.update(l.instanceMatrix,n.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,n.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const f=l.skeleton;r.get(f)!==c&&(f.update(),r.set(f,c))}return h}function a(){r=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:a}}const eT=new Vn,tT=new L2,nT=new D6,iT=new l0,U_=[],O_=[],F_=new Float32Array(16),k_=new Float32Array(9),N_=new Float32Array(4);function cf(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let s=U_[r];if(s===void 0&&(s=new Float32Array(r),U_[r]=s),e!==0){i.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,n[a].toArray(s,o)}return s}function Di(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function Pi(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function O2(n,e){let t=O_[e];t===void 0&&(t=new Int32Array(e),O_[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function bF(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function IF(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Di(t,e))return;n.uniform2fv(this.addr,e),Pi(t,e)}}function MF(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Di(t,e))return;n.uniform3fv(this.addr,e),Pi(t,e)}}function RF(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Di(t,e))return;n.uniform4fv(this.addr,e),Pi(t,e)}}function BF(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Di(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),Pi(t,e)}else{if(Di(t,i))return;N_.set(i),n.uniformMatrix2fv(this.addr,!1,N_),Pi(t,i)}}function DF(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Di(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),Pi(t,e)}else{if(Di(t,i))return;k_.set(i),n.uniformMatrix3fv(this.addr,!1,k_),Pi(t,i)}}function PF(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Di(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),Pi(t,e)}else{if(Di(t,i))return;F_.set(i),n.uniformMatrix4fv(this.addr,!1,F_),Pi(t,i)}}function LF(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function UF(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Di(t,e))return;n.uniform2iv(this.addr,e),Pi(t,e)}}function OF(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Di(t,e))return;n.uniform3iv(this.addr,e),Pi(t,e)}}function FF(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Di(t,e))return;n.uniform4iv(this.addr,e),Pi(t,e)}}function kF(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function NF(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Di(t,e))return;n.uniform2uiv(this.addr,e),Pi(t,e)}}function GF(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Di(t,e))return;n.uniform3uiv(this.addr,e),Pi(t,e)}}function zF(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Di(t,e))return;n.uniform4uiv(this.addr,e),Pi(t,e)}}function QF(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2D(e||eT,r)}function HF(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||nT,r)}function VF(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||iT,r)}function WF(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||tT,r)}function YF(n){switch(n){case 5126:return bF;case 35664:return IF;case 35665:return MF;case 35666:return RF;case 35674:return BF;case 35675:return DF;case 35676:return PF;case 5124:case 35670:return LF;case 35667:case 35671:return UF;case 35668:case 35672:return OF;case 35669:case 35673:return FF;case 5125:return kF;case 36294:return NF;case 36295:return GF;case 36296:return zF;case 35678:case 36198:case 36298:case 36306:case 35682:return QF;case 35679:case 36299:case 36307:return HF;case 35680:case 36300:case 36308:case 36293:return VF;case 36289:case 36303:case 36311:case 36292:return WF}}function qF(n,e){n.uniform1fv(this.addr,e)}function XF(n,e){const t=cf(e,this.size,2);n.uniform2fv(this.addr,t)}function jF(n,e){const t=cf(e,this.size,3);n.uniform3fv(this.addr,t)}function KF(n,e){const t=cf(e,this.size,4);n.uniform4fv(this.addr,t)}function $F(n,e){const t=cf(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function JF(n,e){const t=cf(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function ZF(n,e){const t=cf(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function ek(n,e){n.uniform1iv(this.addr,e)}function tk(n,e){n.uniform2iv(this.addr,e)}function nk(n,e){n.uniform3iv(this.addr,e)}function ik(n,e){n.uniform4iv(this.addr,e)}function rk(n,e){n.uniform1uiv(this.addr,e)}function sk(n,e){n.uniform2uiv(this.addr,e)}function ak(n,e){n.uniform3uiv(this.addr,e)}function ok(n,e){n.uniform4uiv(this.addr,e)}function lk(n,e,t){const i=this.cache,r=e.length,s=O2(t,r);Di(i,s)||(n.uniform1iv(this.addr,s),Pi(i,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||eT,s[a])}function ck(n,e,t){const i=this.cache,r=e.length,s=O2(t,r);Di(i,s)||(n.uniform1iv(this.addr,s),Pi(i,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||nT,s[a])}function uk(n,e,t){const i=this.cache,r=e.length,s=O2(t,r);Di(i,s)||(n.uniform1iv(this.addr,s),Pi(i,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||iT,s[a])}function hk(n,e,t){const i=this.cache,r=e.length,s=O2(t,r);Di(i,s)||(n.uniform1iv(this.addr,s),Pi(i,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||tT,s[a])}function fk(n){switch(n){case 5126:return qF;case 35664:return XF;case 35665:return jF;case 35666:return KF;case 35674:return $F;case 35675:return JF;case 35676:return ZF;case 5124:case 35670:return ek;case 35667:case 35671:return tk;case 35668:case 35672:return nk;case 35669:case 35673:return ik;case 5125:return rk;case 36294:return sk;case 36295:return ak;case 36296:return ok;case 35678:case 36198:case 36298:case 36306:case 35682:return lk;case 35679:case 36299:case 36307:return ck;case 35680:case 36300:case 36308:case 36293:return uk;case 36289:case 36303:case 36311:case 36292:return hk}}class dk{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.setValue=YF(t.type)}}class pk{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.size=t.size,this.setValue=fk(t.type)}}class gk{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],i)}}}const fv=/(\w+)(\])?(\[|\.)?/g;function G_(n,e){n.seq.push(e),n.map[e.id]=e}function mk(n,e,t){const i=n.name,r=i.length;for(fv.lastIndex=0;;){const s=fv.exec(i),a=fv.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){G_(t,c===void 0?new dk(o,n,e):new pk(o,n,e));break}else{let h=t.map[o];h===void 0&&(h=new gk(o),G_(t,h)),t=h}}}class dm{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<i;++r){const s=e.getActiveUniform(t,r),a=e.getUniformLocation(t,s.name);mk(s,a,this)}}setValue(e,t,i,r){const s=this.map[t];s!==void 0&&s.setValue(e,i,r)}setOptional(e,t,i){const r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=i[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){const i=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&i.push(a)}return i}}function z_(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}let Ak=0;function vk(n,e){const t=n.split(`
`),i=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a<s;a++){const o=a+1;i.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return i.join(`
`)}function yk(n){switch(n){case fa:return["Linear","( value )"];case Nt:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),["Linear","( value )"]}}function Q_(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+`
`+r+`
`+vk(n.getShaderSource(e),a)}else return r}function xk(n,e){const t=yk(e);return"vec4 "+n+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function _k(n,e){let t;switch(e){case wC:t="Linear";break;case CC:t="Reinhard";break;case TC:t="OptimizedCineon";break;case v6:t="ACESFilmic";break;case bC:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function Ek(n){return[n.extensionDerivatives||n.envMapCubeUVHeight||n.bumpMap||n.normalMapTangentSpace||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Gd).join(`
`)}function Sk(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
`)}function wk(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const s=n.getActiveAttrib(e,r),a=s.name;let o=1;s.type===n.FLOAT_MAT2&&(o=2),s.type===n.FLOAT_MAT3&&(o=3),s.type===n.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:n.getAttribLocation(e,a),locationSize:o}}return t}function Gd(n){return n!==""}function H_(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function V_(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Ck=/^[ \t]*#include +<([\w\d./]+)>/gm;function ly(n){return n.replace(Ck,bk)}const Tk=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function bk(n,e){let t=kt[e];if(t===void 0){const i=Tk.get(e);if(i!==void 0)t=kt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return ly(t)}const Ik=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function W_(n){return n.replace(Ik,Mk)}function Mk(n,e,t,i){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function Y_(n){let e="precision "+n.precision+` float;
precision `+n.precision+" int;";return n.precision==="highp"?e+=`
#define HIGH_PRECISION`:n.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}function Rk(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===b2?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===jd?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===sa&&(e="SHADOWMAP_TYPE_VSM"),e}function Bk(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case Fl:case kl:e="ENVMAP_TYPE_CUBE";break;case of:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Dk(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case kl:e="ENVMAP_MODE_REFRACTION";break}return e}function Pk(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case a0:e="ENVMAP_BLENDING_MULTIPLY";break;case EC:e="ENVMAP_BLENDING_MIX";break;case SC:e="ENVMAP_BLENDING_ADD";break}return e}function Lk(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function Uk(n,e,t,i){const r=n.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=Rk(t),c=Bk(t),u=Dk(t),h=Pk(t),f=Lk(t),p=t.isWebGL2?"":Ek(t),m=Sk(s),y=r.createProgram();let v,A,_=t.glslVersion?"#version "+t.glslVersion+`
`:"";t.isRawShaderMaterial?(v=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(Gd).join(`
`),v.length>0&&(v+=`
`),A=[p,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(Gd).join(`
`),A.length>0&&(A+=`
`)):(v=[Y_(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
`].filter(Gd).join(`
`),A=[p,Y_(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==os?"#define TONE_MAPPING":"",t.toneMapping!==os?kt.tonemapping_pars_fragment:"",t.toneMapping!==os?_k("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",kt.colorspace_pars_fragment,xk("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
`].filter(Gd).join(`
`)),a=ly(a),a=H_(a,t),a=V_(a,t),o=ly(o),o=H_(o,t),o=V_(o,t),a=W_(a),o=W_(o),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(_=`#version 300 es
`,v=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+v,A=["#define varying in",t.glslVersion===sy?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===sy?"":"#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(`
`)+`
`+A);const x=_+v+a,E=_+A+o,w=z_(r,r.VERTEX_SHADER,x),I=z_(r,r.FRAGMENT_SHADER,E);if(r.attachShader(y,w),r.attachShader(y,I),t.index0AttributeName!==void 0?r.bindAttribLocation(y,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y),n.debug.checkShaderErrors){const b=r.getProgramInfoLog(y).trim(),B=r.getShaderInfoLog(w).trim(),L=r.getShaderInfoLog(I).trim();let U=!0,O=!0;if(r.getProgramParameter(y,r.LINK_STATUS)===!1)if(U=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,y,w,I);else{const Q=Q_(r,w,"vertex"),G=Q_(r,I,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(y,r.VALIDATE_STATUS)+`
Program Info Log: `+b+`
`+Q+`
`+G)}else b!==""?console.warn("THREE.WebGLProgram: Program Info Log:",b):(B===""||L==="")&&(O=!1);O&&(this.diagnostics={runnable:U,programLog:b,vertexShader:{log:B,prefix:v},fragmentShader:{log:L,prefix:A}})}r.deleteShader(w),r.deleteShader(I);let T;this.getUniforms=function(){return T===void 0&&(T=new dm(r,y)),T};let M;return this.getAttributes=function(){return M===void 0&&(M=wk(r,y)),M},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(y),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Ak++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=w,this.fragmentShader=I,this}let Ok=0;class Fk{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new kk(e),t.set(e,i)),i}}class kk{constructor(e){this.id=Ok++,this.code=e,this.usedTimes=0}}function Nk(n,e,t,i,r,s,a){const o=new Kc,l=new Fk,c=[],u=r.isWebGL2,h=r.logarithmicDepthBuffer,f=r.vertexTextures;let p=r.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function y(b){return b===0?"uv":`uv${b}`}function v(b,B,L,U,O){const Q=U.fog,G=O.geometry,F=b.isMeshStandardMaterial?U.environment:null,q=(b.isMeshStandardMaterial?t:e).get(b.envMap||F),Y=q&&q.mapping===of?q.image.height:null,H=m[b.type];b.precision!==null&&(p=r.getMaxPrecision(b.precision),p!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",p,"instead."));const V=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,D=V!==void 0?V.length:0;let k=0;G.morphAttributes.position!==void 0&&(k=1),G.morphAttributes.normal!==void 0&&(k=2),G.morphAttributes.color!==void 0&&(k=3);let Z,j,ee,ie;if(H){const Jt=aa[H];Z=Jt.vertexShader,j=Jt.fragmentShader}else Z=b.vertexShader,j=b.fragmentShader,l.update(b),ee=l.getVertexShaderID(b),ie=l.getFragmentShaderID(b);const te=n.getRenderTarget(),re=O.isInstancedMesh===!0,ce=!!b.map,ye=!!b.matcap,oe=!!q,W=!!b.aoMap,ge=!!b.lightMap,he=!!b.bumpMap,ue=!!b.normalMap,fe=!!b.displacementMap,Pe=!!b.emissiveMap,pe=!!b.metalnessMap,Re=!!b.roughnessMap,Le=b.anisotropy>0,Se=b.clearcoat>0,$e=b.iridescence>0,X=b.sheen>0,z=b.transmission>0,se=Le&&!!b.anisotropyMap,Be=Se&&!!b.clearcoatMap,Ce=Se&&!!b.clearcoatNormalMap,we=Se&&!!b.clearcoatRoughnessMap,ke=$e&&!!b.iridescenceMap,Ue=$e&&!!b.iridescenceThicknessMap,xe=X&&!!b.sheenColorMap,ze=X&&!!b.sheenRoughnessMap,je=!!b.specularMap,We=!!b.specularColorMap,Oe=!!b.specularIntensityMap,Ve=z&&!!b.transmissionMap,it=z&&!!b.thicknessMap,gt=!!b.gradientMap,ne=!!b.alphaMap,Fe=b.alphaTest>0,me=!!b.alphaHash,Qe=!!b.extensions,Xe=!!G.attributes.uv1,Dt=!!G.attributes.uv2,Yt=!!G.attributes.uv3;return{isWebGL2:u,shaderID:H,shaderType:b.type,shaderName:b.name,vertexShader:Z,fragmentShader:j,defines:b.defines,customVertexShaderID:ee,customFragmentShaderID:ie,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:p,instancing:re,instancingColor:re&&O.instanceColor!==null,supportsVertexTextures:f,outputColorSpace:te===null?n.outputColorSpace:te.isXRRenderTarget===!0?te.texture.colorSpace:fa,map:ce,matcap:ye,envMap:oe,envMapMode:oe&&q.mapping,envMapCubeUVHeight:Y,aoMap:W,lightMap:ge,bumpMap:he,normalMap:ue,displacementMap:f&&fe,emissiveMap:Pe,normalMapObjectSpace:ue&&b.normalMapType===FC,normalMapTangentSpace:ue&&b.normalMapType===Yl,metalnessMap:pe,roughnessMap:Re,anisotropy:Le,anisotropyMap:se,clearcoat:Se,clearcoatMap:Be,clearcoatNormalMap:Ce,clearcoatRoughnessMap:we,iridescence:$e,iridescenceMap:ke,iridescenceThicknessMap:Ue,sheen:X,sheenColorMap:xe,sheenRoughnessMap:ze,specularMap:je,specularColorMap:We,specularIntensityMap:Oe,transmission:z,transmissionMap:Ve,thicknessMap:it,gradientMap:gt,opaque:b.transparent===!1&&b.blending===Ha,alphaMap:ne,alphaTest:Fe,alphaHash:me,combine:b.combine,mapUv:ce&&y(b.map.channel),aoMapUv:W&&y(b.aoMap.channel),lightMapUv:ge&&y(b.lightMap.channel),bumpMapUv:he&&y(b.bumpMap.channel),normalMapUv:ue&&y(b.normalMap.channel),displacementMapUv:fe&&y(b.displacementMap.channel),emissiveMapUv:Pe&&y(b.emissiveMap.channel),metalnessMapUv:pe&&y(b.metalnessMap.channel),roughnessMapUv:Re&&y(b.roughnessMap.channel),anisotropyMapUv:se&&y(b.anisotropyMap.channel),clearcoatMapUv:Be&&y(b.clearcoatMap.channel),clearcoatNormalMapUv:Ce&&y(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:we&&y(b.clearcoatRoughnessMap.channel),iridescenceMapUv:ke&&y(b.iridescenceMap.channel),iridescenceThicknessMapUv:Ue&&y(b.iridescenceThicknessMap.channel),sheenColorMapUv:xe&&y(b.sheenColorMap.channel),sheenRoughnessMapUv:ze&&y(b.sheenRoughnessMap.channel),specularMapUv:je&&y(b.specularMap.channel),specularColorMapUv:We&&y(b.specularColorMap.channel),specularIntensityMapUv:Oe&&y(b.specularIntensityMap.channel),transmissionMapUv:Ve&&y(b.transmissionMap.channel),thicknessMapUv:it&&y(b.thicknessMap.channel),alphaMapUv:ne&&y(b.alphaMap.channel),vertexTangents:!!G.attributes.tangent&&(ue||Le),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,vertexUv1s:Xe,vertexUv2s:Dt,vertexUv3s:Yt,pointsUvs:O.isPoints===!0&&!!G.attributes.uv&&(ce||ne),fog:!!Q,useFog:b.fog===!0,fogExp2:Q&&Q.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:O.isSkinnedMesh===!0,morphTargets:G.morphAttributes.position!==void 0,morphNormals:G.morphAttributes.normal!==void 0,morphColors:G.morphAttributes.color!==void 0,morphTargetsCount:D,morphTextureStride:k,numDirLights:B.directional.length,numPointLights:B.point.length,numSpotLights:B.spot.length,numSpotLightMaps:B.spotLightMap.length,numRectAreaLights:B.rectArea.length,numHemiLights:B.hemi.length,numDirLightShadows:B.directionalShadowMap.length,numPointLightShadows:B.pointShadowMap.length,numSpotLightShadows:B.spotShadowMap.length,numSpotLightShadowsWithMaps:B.numSpotLightShadowsWithMaps,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:b.dithering,shadowMapEnabled:n.shadowMap.enabled&&L.length>0,shadowMapType:n.shadowMap.type,toneMapping:b.toneMapped?n.toneMapping:os,useLegacyLights:n.useLegacyLights,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===$n,flipSided:b.side===Ki,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionDerivatives:Qe&&b.extensions.derivatives===!0,extensionFragDepth:Qe&&b.extensions.fragDepth===!0,extensionDrawBuffers:Qe&&b.extensions.drawBuffers===!0,extensionShaderTextureLOD:Qe&&b.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||i.has("EXT_shader_texture_lod"),customProgramCacheKey:b.customProgramCacheKey()}}function A(b){const B=[];if(b.shaderID?B.push(b.shaderID):(B.push(b.customVertexShaderID),B.push(b.customFragmentShaderID)),b.defines!==void 0)for(const L in b.defines)B.push(L),B.push(b.defines[L]);return b.isRawShaderMaterial===!1&&(_(B,b),x(B,b),B.push(n.outputColorSpace)),B.push(b.customProgramCacheKey),B.join()}function _(b,B){b.push(B.precision),b.push(B.outputColorSpace),b.push(B.envMapMode),b.push(B.envMapCubeUVHeight),b.push(B.mapUv),b.push(B.alphaMapUv),b.push(B.lightMapUv),b.push(B.aoMapUv),b.push(B.bumpMapUv),b.push(B.normalMapUv),b.push(B.displacementMapUv),b.push(B.emissiveMapUv),b.push(B.metalnessMapUv),b.push(B.roughnessMapUv),b.push(B.anisotropyMapUv),b.push(B.clearcoatMapUv),b.push(B.clearcoatNormalMapUv),b.push(B.clearcoatRoughnessMapUv),b.push(B.iridescenceMapUv),b.push(B.iridescenceThicknessMapUv),b.push(B.sheenColorMapUv),b.push(B.sheenRoughnessMapUv),b.push(B.specularMapUv),b.push(B.specularColorMapUv),b.push(B.specularIntensityMapUv),b.push(B.transmissionMapUv),b.push(B.thicknessMapUv),b.push(B.combine),b.push(B.fogExp2),b.push(B.sizeAttenuation),b.push(B.morphTargetsCount),b.push(B.morphAttributeCount),b.push(B.numDirLights),b.push(B.numPointLights),b.push(B.numSpotLights),b.push(B.numSpotLightMaps),b.push(B.numHemiLights),b.push(B.numRectAreaLights),b.push(B.numDirLightShadows),b.push(B.numPointLightShadows),b.push(B.numSpotLightShadows),b.push(B.numSpotLightShadowsWithMaps),b.push(B.shadowMapType),b.push(B.toneMapping),b.push(B.numClippingPlanes),b.push(B.numClipIntersection),b.push(B.depthPacking)}function x(b,B){o.disableAll(),B.isWebGL2&&o.enable(0),B.supportsVertexTextures&&o.enable(1),B.instancing&&o.enable(2),B.instancingColor&&o.enable(3),B.matcap&&o.enable(4),B.envMap&&o.enable(5),B.normalMapObjectSpace&&o.enable(6),B.normalMapTangentSpace&&o.enable(7),B.clearcoat&&o.enable(8),B.iridescence&&o.enable(9),B.alphaTest&&o.enable(10),B.vertexColors&&o.enable(11),B.vertexAlphas&&o.enable(12),B.vertexUv1s&&o.enable(13),B.vertexUv2s&&o.enable(14),B.vertexUv3s&&o.enable(15),B.vertexTangents&&o.enable(16),B.anisotropy&&o.enable(17),b.push(o.mask),o.disableAll(),B.fog&&o.enable(0),B.useFog&&o.enable(1),B.flatShading&&o.enable(2),B.logarithmicDepthBuffer&&o.enable(3),B.skinning&&o.enable(4),B.morphTargets&&o.enable(5),B.morphNormals&&o.enable(6),B.morphColors&&o.enable(7),B.premultipliedAlpha&&o.enable(8),B.shadowMapEnabled&&o.enable(9),B.useLegacyLights&&o.enable(10),B.doubleSided&&o.enable(11),B.flipSided&&o.enable(12),B.useDepthPacking&&o.enable(13),B.dithering&&o.enable(14),B.transmission&&o.enable(15),B.sheen&&o.enable(16),B.opaque&&o.enable(17),B.pointsUvs&&o.enable(18),b.push(o.mask)}function E(b){const B=m[b.type];let L;if(B){const U=aa[B];L=Hn.clone(U.uniforms)}else L=b.uniforms;return L}function w(b,B){let L;for(let U=0,O=c.length;U<O;U++){const Q=c[U];if(Q.cacheKey===B){L=Q,++L.usedTimes;break}}return L===void 0&&(L=new Uk(n,B,b,s),c.push(L)),L}function I(b){if(--b.usedTimes===0){const B=c.indexOf(b);c[B]=c[c.length-1],c.pop(),b.destroy()}}function T(b){l.remove(b)}function M(){l.dispose()}return{getParameters:v,getProgramCacheKey:A,getUniforms:E,acquireProgram:w,releaseProgram:I,releaseShaderCache:T,programs:c,dispose:M}}function Gk(){let n=new WeakMap;function e(s){let a=n.get(s);return a===void 0&&(a={},n.set(s,a)),a}function t(s){n.delete(s)}function i(s,a,o){n.get(s)[a]=o}function r(){n=new WeakMap}return{get:e,remove:t,update:i,dispose:r}}function zk(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.z!==e.z?n.z-e.z:n.id-e.id}function q_(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function X_(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function a(h,f,p,m,y,v){let A=n[e];return A===void 0?(A={id:h.id,object:h,geometry:f,material:p,groupOrder:m,renderOrder:h.renderOrder,z:y,group:v},n[e]=A):(A.id=h.id,A.object=h,A.geometry=f,A.material=p,A.groupOrder=m,A.renderOrder=h.renderOrder,A.z=y,A.group=v),e++,A}function o(h,f,p,m,y,v){const A=a(h,f,p,m,y,v);p.transmission>0?i.push(A):p.transparent===!0?r.push(A):t.push(A)}function l(h,f,p,m,y,v){const A=a(h,f,p,m,y,v);p.transmission>0?i.unshift(A):p.transparent===!0?r.unshift(A):t.unshift(A)}function c(h,f){t.length>1&&t.sort(h||zk),i.length>1&&i.sort(f||q_),r.length>1&&r.sort(f||q_)}function u(){for(let h=e,f=n.length;h<f;h++){const p=n[h];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:o,unshift:l,finish:u,sort:c}}function Qk(){let n=new WeakMap;function e(i,r){const s=n.get(i);let a;return s===void 0?(a=new X_,n.set(i,[a])):r>=s.length?(a=new X_,s.push(a)):a=s[r],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function Hk(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new N,color:new He};break;case"SpotLight":t={position:new N,direction:new N,color:new He,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new N,color:new He,distance:0,decay:0};break;case"HemisphereLight":t={direction:new N,skyColor:new He,groundColor:new He};break;case"RectAreaLight":t={color:new He,position:new N,halfWidth:new N,halfHeight:new N};break}return n[e.id]=t,t}}}function Vk(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new _e};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new _e};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new _e,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let Wk=0;function Yk(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function qk(n,e){const t=new Hk,i=Vk(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-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};for(let u=0;u<9;u++)r.probe.push(new N);const s=new N,a=new ct,o=new ct;function l(u,h){let f=0,p=0,m=0;for(let L=0;L<9;L++)r.probe[L].set(0,0,0);let y=0,v=0,A=0,_=0,x=0,E=0,w=0,I=0,T=0,M=0;u.sort(Yk);const b=h===!0?Math.PI:1;for(let L=0,U=u.length;L<U;L++){const O=u[L],Q=O.color,G=O.intensity,F=O.distance,q=O.shadow&&O.shadow.map?O.shadow.map.texture:null;if(O.isAmbientLight)f+=Q.r*G*b,p+=Q.g*G*b,m+=Q.b*G*b;else if(O.isLightProbe)for(let Y=0;Y<9;Y++)r.probe[Y].addScaledVector(O.sh.coefficients[Y],G);else if(O.isDirectionalLight){const Y=t.get(O);if(Y.color.copy(O.color).multiplyScalar(O.intensity*b),O.castShadow){const H=O.shadow,V=i.get(O);V.shadowBias=H.bias,V.shadowNormalBias=H.normalBias,V.shadowRadius=H.radius,V.shadowMapSize=H.mapSize,r.directionalShadow[y]=V,r.directionalShadowMap[y]=q,r.directionalShadowMatrix[y]=O.shadow.matrix,E++}r.directional[y]=Y,y++}else if(O.isSpotLight){const Y=t.get(O);Y.position.setFromMatrixPosition(O.matrixWorld),Y.color.copy(Q).multiplyScalar(G*b),Y.distance=F,Y.coneCos=Math.cos(O.angle),Y.penumbraCos=Math.cos(O.angle*(1-O.penumbra)),Y.decay=O.decay,r.spot[A]=Y;const H=O.shadow;if(O.map&&(r.spotLightMap[T]=O.map,T++,H.updateMatrices(O),O.castShadow&&M++),r.spotLightMatrix[A]=H.matrix,O.castShadow){const V=i.get(O);V.shadowBias=H.bias,V.shadowNormalBias=H.normalBias,V.shadowRadius=H.radius,V.shadowMapSize=H.mapSize,r.spotShadow[A]=V,r.spotShadowMap[A]=q,I++}A++}else if(O.isRectAreaLight){const Y=t.get(O);Y.color.copy(Q).multiplyScalar(G),Y.halfWidth.set(O.width*.5,0,0),Y.halfHeight.set(0,O.height*.5,0),r.rectArea[_]=Y,_++}else if(O.isPointLight){const Y=t.get(O);if(Y.color.copy(O.color).multiplyScalar(O.intensity*b),Y.distance=O.distance,Y.decay=O.decay,O.castShadow){const H=O.shadow,V=i.get(O);V.shadowBias=H.bias,V.shadowNormalBias=H.normalBias,V.shadowRadius=H.radius,V.shadowMapSize=H.mapSize,V.shadowCameraNear=H.camera.near,V.shadowCameraFar=H.camera.far,r.pointShadow[v]=V,r.pointShadowMap[v]=q,r.pointShadowMatrix[v]=O.shadow.matrix,w++}r.point[v]=Y,v++}else if(O.isHemisphereLight){const Y=t.get(O);Y.skyColor.copy(O.color).multiplyScalar(G*b),Y.groundColor.copy(O.groundColor).multiplyScalar(G*b),r.hemi[x]=Y,x++}}_>0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=Je.LTC_FLOAT_1,r.rectAreaLTC2=Je.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=Je.LTC_HALF_1,r.rectAreaLTC2=Je.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=f,r.ambient[1]=p,r.ambient[2]=m;const B=r.hash;(B.directionalLength!==y||B.pointLength!==v||B.spotLength!==A||B.rectAreaLength!==_||B.hemiLength!==x||B.numDirectionalShadows!==E||B.numPointShadows!==w||B.numSpotShadows!==I||B.numSpotMaps!==T)&&(r.directional.length=y,r.spot.length=A,r.rectArea.length=_,r.point.length=v,r.hemi.length=x,r.directionalShadow.length=E,r.directionalShadowMap.length=E,r.pointShadow.length=w,r.pointShadowMap.length=w,r.spotShadow.length=I,r.spotShadowMap.length=I,r.directionalShadowMatrix.length=E,r.pointShadowMatrix.length=w,r.spotLightMatrix.length=I+T-M,r.spotLightMap.length=T,r.numSpotLightShadowsWithMaps=M,B.directionalLength=y,B.pointLength=v,B.spotLength=A,B.rectAreaLength=_,B.hemiLength=x,B.numDirectionalShadows=E,B.numPointShadows=w,B.numSpotShadows=I,B.numSpotMaps=T,r.version=Wk++)}function c(u,h){let f=0,p=0,m=0,y=0,v=0;const A=h.matrixWorldInverse;for(let _=0,x=u.length;_<x;_++){const E=u[_];if(E.isDirectionalLight){const w=r.directional[f];w.direction.setFromMatrixPosition(E.matrixWorld),s.setFromMatrixPosition(E.target.matrixWorld),w.direction.sub(s),w.direction.transformDirection(A),f++}else if(E.isSpotLight){const w=r.spot[m];w.position.setFromMatrixPosition(E.matrixWorld),w.position.applyMatrix4(A),w.direction.setFromMatrixPosition(E.matrixWorld),s.setFromMatrixPosition(E.target.matrixWorld),w.direction.sub(s),w.direction.transformDirection(A),m++}else if(E.isRectAreaLight){const w=r.rectArea[y];w.position.setFromMatrixPosition(E.matrixWorld),w.position.applyMatrix4(A),o.identity(),a.copy(E.matrixWorld),a.premultiply(A),o.extractRotation(a),w.halfWidth.set(E.width*.5,0,0),w.halfHeight.set(0,E.height*.5,0),w.halfWidth.applyMatrix4(o),w.halfHeight.applyMatrix4(o),y++}else if(E.isPointLight){const w=r.point[p];w.position.setFromMatrixPosition(E.matrixWorld),w.position.applyMatrix4(A),p++}else if(E.isHemisphereLight){const w=r.hemi[v];w.direction.setFromMatrixPosition(E.matrixWorld),w.direction.transformDirection(A),v++}}}return{setup:l,setupView:c,state:r}}function j_(n,e){const t=new qk(n,e),i=[],r=[];function s(){i.length=0,r.length=0}function a(h){i.push(h)}function o(h){r.push(h)}function l(h){t.setup(i,h)}function c(h){t.setupView(i,h)}return{init:s,state:{lightsArray:i,shadowsArray:r,lights:t},setupLights:l,setupLightsView:c,pushLight:a,pushShadow:o}}function Xk(n,e){let t=new WeakMap;function i(s,a=0){const o=t.get(s);let l;return o===void 0?(l=new j_(n,e),t.set(s,[l])):a>=o.length?(l=new j_(n,e),o.push(l)):l=o[a],l}function r(){t=new WeakMap}return{get:i,dispose:r}}class u0 extends Ji{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=OC,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 F2 extends Ji{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const jk=`void main() {
gl_Position = vec4( position, 1.0 );
}`,Kk=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
#include <packing>
void main() {
const float samples = float( VSM_SAMPLES );
float mean = 0.0;
float squared_mean = 0.0;
float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
for ( float i = 0.0; i < samples; i ++ ) {
float uvOffset = uvStart + i * uvStride;
#ifdef HORIZONTAL_PASS
vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
mean += distribution.x;
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
#else
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
mean += depth;
squared_mean += depth * depth;
#endif
}
mean = mean / samples;
squared_mean = squared_mean / samples;
float std_dev = sqrt( squared_mean - mean * mean );
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
}`;function $k(n,e,t){let i=new c0;const r=new _e,s=new _e,a=new jt,o=new u0({depthPacking:P2}),l=new F2,c={},u=t.maxTextureSize,h={[$a]:Ki,[Ki]:$a,[$n]:$n},f=new sn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new _e},radius:{value:4}},vertexShader:jk,fragmentShader:Kk}),p=f.clone();p.defines.HORIZONTAL_PASS=1;const m=new Bt;m.setAttribute("position",new En(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new nn(m,f),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=b2;let A=this.type;this.render=function(w,I,T){if(v.enabled===!1||v.autoUpdate===!1&&v.needsUpdate===!1||w.length===0)return;const M=n.getRenderTarget(),b=n.getActiveCubeFace(),B=n.getActiveMipmapLevel(),L=n.state;L.setBlending(Kt),L.buffers.color.setClear(1,1,1,1),L.buffers.depth.setTest(!0),L.setScissorTest(!1);const U=A!==sa&&this.type===sa,O=A===sa&&this.type!==sa;for(let Q=0,G=w.length;Q<G;Q++){const F=w[Q],q=F.shadow;if(q===void 0){console.warn("THREE.WebGLShadowMap:",F,"has no shadow.");continue}if(q.autoUpdate===!1&&q.needsUpdate===!1)continue;r.copy(q.mapSize);const Y=q.getFrameExtents();if(r.multiply(Y),s.copy(q.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/Y.x),r.x=s.x*Y.x,q.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/Y.y),r.y=s.y*Y.y,q.mapSize.y=s.y)),q.map===null||U===!0||O===!0){const V=this.type!==sa?{minFilter:Rt,magFilter:Rt}:{};q.map!==null&&q.map.dispose(),q.map=new Dn(r.x,r.y,V),q.map.texture.name=F.name+".shadowMap",q.camera.updateProjectionMatrix()}n.setRenderTarget(q.map),n.clear();const H=q.getViewportCount();for(let V=0;V<H;V++){const D=q.getViewport(V);a.set(s.x*D.x,s.y*D.y,s.x*D.z,s.y*D.w),L.viewport(a),q.updateMatrices(F,V),i=q.getFrustum(),E(I,T,q.camera,F,this.type)}q.isPointLightShadow!==!0&&this.type===sa&&_(q,T),q.needsUpdate=!1}A=this.type,v.needsUpdate=!1,n.setRenderTarget(M,b,B)};function _(w,I){const T=e.update(y);f.defines.VSM_SAMPLES!==w.blurSamples&&(f.defines.VSM_SAMPLES=w.blurSamples,p.defines.VSM_SAMPLES=w.blurSamples,f.needsUpdate=!0,p.needsUpdate=!0),w.mapPass===null&&(w.mapPass=new Dn(r.x,r.y)),f.uniforms.shadow_pass.value=w.map.texture,f.uniforms.resolution.value=w.mapSize,f.uniforms.radius.value=w.radius,n.setRenderTarget(w.mapPass),n.clear(),n.renderBufferDirect(I,null,T,f,y,null),p.uniforms.shadow_pass.value=w.mapPass.texture,p.uniforms.resolution.value=w.mapSize,p.uniforms.radius.value=w.radius,n.setRenderTarget(w.map),n.clear(),n.renderBufferDirect(I,null,T,p,y,null)}function x(w,I,T,M){let b=null;const B=T.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(B!==void 0)b=B;else if(b=T.isPointLight===!0?l:o,n.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){const L=b.uuid,U=I.uuid;let O=c[L];O===void 0&&(O={},c[L]=O);let Q=O[U];Q===void 0&&(Q=b.clone(),O[U]=Q),b=Q}if(b.visible=I.visible,b.wireframe=I.wireframe,M===sa?b.side=I.shadowSide!==null?I.shadowSide:I.side:b.side=I.shadowSide!==null?I.shadowSide:h[I.side],b.alphaMap=I.alphaMap,b.alphaTest=I.alphaTest,b.map=I.map,b.clipShadows=I.clipShadows,b.clippingPlanes=I.clippingPlanes,b.clipIntersection=I.clipIntersection,b.displacementMap=I.displacementMap,b.displacementScale=I.displacementScale,b.displacementBias=I.displacementBias,b.wireframeLinewidth=I.wireframeLinewidth,b.linewidth=I.linewidth,T.isPointLight===!0&&b.isMeshDistanceMaterial===!0){const L=n.properties.get(b);L.light=T}return b}function E(w,I,T,M,b){if(w.visible===!1)return;if(w.layers.test(I.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&b===sa)&&(!w.frustumCulled||i.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,w.matrixWorld);const U=e.update(w),O=w.material;if(Array.isArray(O)){const Q=U.groups;for(let G=0,F=Q.length;G<F;G++){const q=Q[G],Y=O[q.materialIndex];if(Y&&Y.visible){const H=x(w,Y,M,b);n.renderBufferDirect(T,null,U,H,w,q)}}}else if(O.visible){const Q=x(w,O,M,b);n.renderBufferDirect(T,null,U,Q,w,null)}}const L=w.children;for(let U=0,O=L.length;U<O;U++)E(L[U],I,T,M,b)}}function Jk(n,e,t){const i=t.isWebGL2;function r(){let ne=!1;const Fe=new jt;let me=null;const Qe=new jt(0,0,0,0);return{setMask:function(Xe){me!==Xe&&!ne&&(n.colorMask(Xe,Xe,Xe,Xe),me=Xe)},setLocked:function(Xe){ne=Xe},setClear:function(Xe,Dt,Yt,en,Jt){Jt===!0&&(Xe*=en,Dt*=en,Yt*=en),Fe.set(Xe,Dt,Yt,en),Qe.equals(Fe)===!1&&(n.clearColor(Xe,Dt,Yt,en),Qe.copy(Fe))},reset:function(){ne=!1,me=null,Qe.set(-1,0,0,0)}}}function s(){let ne=!1,Fe=null,me=null,Qe=null;return{setTest:function(Xe){Xe?te(n.DEPTH_TEST):re(n.DEPTH_TEST)},setMask:function(Xe){Fe!==Xe&&!ne&&(n.depthMask(Xe),Fe=Xe)},setFunc:function(Xe){if(me!==Xe){switch(Xe){case gC:n.depthFunc(n.NEVER);break;case mC:n.depthFunc(n.ALWAYS);break;case AC:n.depthFunc(n.LESS);break;case Rm:n.depthFunc(n.LEQUAL);break;case vC:n.depthFunc(n.EQUAL);break;case yC:n.depthFunc(n.GEQUAL);break;case xC:n.depthFunc(n.GREATER);break;case _C:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}me=Xe}},setLocked:function(Xe){ne=Xe},setClear:function(Xe){Qe!==Xe&&(n.clearDepth(Xe),Qe=Xe)},reset:function(){ne=!1,Fe=null,me=null,Qe=null}}}function a(){let ne=!1,Fe=null,me=null,Qe=null,Xe=null,Dt=null,Yt=null,en=null,Jt=null;return{setTest:function(dn){ne||(dn?te(n.STENCIL_TEST):re(n.STENCIL_TEST))},setMask:function(dn){Fe!==dn&&!ne&&(n.stencilMask(dn),Fe=dn)},setFunc:function(dn,Zt,Ht){(me!==dn||Qe!==Zt||Xe!==Ht)&&(n.stencilFunc(dn,Zt,Ht),me=dn,Qe=Zt,Xe=Ht)},setOp:function(dn,Zt,Ht){(Dt!==dn||Yt!==Zt||en!==Ht)&&(n.stencilOp(dn,Zt,Ht),Dt=dn,Yt=Zt,en=Ht)},setLocked:function(dn){ne=dn},setClear:function(dn){Jt!==dn&&(n.clearStencil(dn),Jt=dn)},reset:function(){ne=!1,Fe=null,me=null,Qe=null,Xe=null,Dt=null,Yt=null,en=null,Jt=null}}}const o=new r,l=new s,c=new a,u=new WeakMap,h=new WeakMap;let f={},p={},m=new WeakMap,y=[],v=null,A=!1,_=null,x=null,E=null,w=null,I=null,T=null,M=null,b=!1,B=null,L=null,U=null,O=null,Q=null;const G=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let F=!1,q=0;const Y=n.getParameter(n.VERSION);Y.indexOf("WebGL")!==-1?(q=parseFloat(/^WebGL (\d)/.exec(Y)[1]),F=q>=1):Y.indexOf("OpenGL ES")!==-1&&(q=parseFloat(/^OpenGL ES (\d)/.exec(Y)[1]),F=q>=2);let H=null,V={};const D=n.getParameter(n.SCISSOR_BOX),k=n.getParameter(n.VIEWPORT),Z=new jt().fromArray(D),j=new jt().fromArray(k);function ee(ne,Fe,me,Qe){const Xe=new Uint8Array(4),Dt=n.createTexture();n.bindTexture(ne,Dt),n.texParameteri(ne,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(ne,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Yt=0;Yt<me;Yt++)i&&(ne===n.TEXTURE_3D||ne===n.TEXTURE_2D_ARRAY)?n.texImage3D(Fe,0,n.RGBA,1,1,Qe,0,n.RGBA,n.UNSIGNED_BYTE,Xe):n.texImage2D(Fe+Yt,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,Xe);return Dt}const ie={};ie[n.TEXTURE_2D]=ee(n.TEXTURE_2D,n.TEXTURE_2D,1),ie[n.TEXTURE_CUBE_MAP]=ee(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),i&&(ie[n.TEXTURE_2D_ARRAY]=ee(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),ie[n.TEXTURE_3D]=ee(n.TEXTURE_3D,n.TEXTURE_3D,1,1)),o.setClear(0,0,0,1),l.setClear(1),c.setClear(0),te(n.DEPTH_TEST),l.setFunc(Rm),fe(!1),Pe(O5),te(n.CULL_FACE),he(Kt);function te(ne){f[ne]!==!0&&(n.enable(ne),f[ne]=!0)}function re(ne){f[ne]!==!1&&(n.disable(ne),f[ne]=!1)}function ce(ne,Fe){return p[ne]!==Fe?(n.bindFramebuffer(ne,Fe),p[ne]=Fe,i&&(ne===n.DRAW_FRAMEBUFFER&&(p[n.FRAMEBUFFER]=Fe),ne===n.FRAMEBUFFER&&(p[n.DRAW_FRAMEBUFFER]=Fe)),!0):!1}function ye(ne,Fe){let me=y,Qe=!1;if(ne)if(me=m.get(Fe),me===void 0&&(me=[],m.set(Fe,me)),ne.isWebGLMultipleRenderTargets){const Xe=ne.texture;if(me.length!==Xe.length||me[0]!==n.COLOR_ATTACHMENT0){for(let Dt=0,Yt=Xe.length;Dt<Yt;Dt++)me[Dt]=n.COLOR_ATTACHMENT0+Dt;me.length=Xe.length,Qe=!0}}else me[0]!==n.COLOR_ATTACHMENT0&&(me[0]=n.COLOR_ATTACHMENT0,Qe=!0);else me[0]!==n.BACK&&(me[0]=n.BACK,Qe=!0);Qe&&(t.isWebGL2?n.drawBuffers(me):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(me))}function oe(ne){return v!==ne?(n.useProgram(ne),v=ne,!0):!1}const W={[ss]:n.FUNC_ADD,[oC]:n.FUNC_SUBTRACT,[lC]:n.FUNC_REVERSE_SUBTRACT};if(i)W[N5]=n.MIN,W[G5]=n.MAX;else{const ne=e.get("EXT_blend_minmax");ne!==null&&(W[N5]=ne.MIN_EXT,W[G5]=ne.MAX_EXT)}const ge={[Hh]:n.ZERO,[cC]:n.ONE,[uC]:n.SRC_COLOR,[gp]:n.SRC_ALPHA,[pC]:n.SRC_ALPHA_SATURATE,[M2]:n.DST_COLOR,[I2]:n.DST_ALPHA,[hC]:n.ONE_MINUS_SRC_COLOR,[mp]:n.ONE_MINUS_SRC_ALPHA,[dC]:n.ONE_MINUS_DST_COLOR,[fC]:n.ONE_MINUS_DST_ALPHA};function he(ne,Fe,me,Qe,Xe,Dt,Yt,en){if(ne===Kt){A===!0&&(re(n.BLEND),A=!1);return}if(A===!1&&(te(n.BLEND),A=!0),ne!==pp){if(ne!==_||en!==b){if((x!==ss||I!==ss)&&(n.blendEquation(n.FUNC_ADD),x=ss,I=ss),en)switch(ne){case Ha:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case dp:n.blendFunc(n.ONE,n.ONE);break;case F5:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case k5:n.blendFuncSeparate(n.ZERO,n.SRC_COLOR,n.ZERO,n.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",ne);break}else switch(ne){case Ha:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case dp:n.blendFunc(n.SRC_ALPHA,n.ONE);break;case F5:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case k5:n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",ne);break}E=null,w=null,T=null,M=null,_=ne,b=en}return}Xe=Xe||Fe,Dt=Dt||me,Yt=Yt||Qe,(Fe!==x||Xe!==I)&&(n.blendEquationSeparate(W[Fe],W[Xe]),x=Fe,I=Xe),(me!==E||Qe!==w||Dt!==T||Yt!==M)&&(n.blendFuncSeparate(ge[me],ge[Qe],ge[Dt],ge[Yt]),E=me,w=Qe,T=Dt,M=Yt),_=ne,b=!1}function ue(ne,Fe){ne.side===$n?re(n.CULL_FACE):te(n.CULL_FACE);let me=ne.side===Ki;Fe&&(me=!me),fe(me),ne.blending===Ha&&ne.transparent===!1?he(Kt):he(ne.blending,ne.blendEquation,ne.blendSrc,ne.blendDst,ne.blendEquationAlpha,ne.blendSrcAlpha,ne.blendDstAlpha,ne.premultipliedAlpha),l.setFunc(ne.depthFunc),l.setTest(ne.depthTest),l.setMask(ne.depthWrite),o.setMask(ne.colorWrite);const Qe=ne.stencilWrite;c.setTest(Qe),Qe&&(c.setMask(ne.stencilWriteMask),c.setFunc(ne.stencilFunc,ne.stencilRef,ne.stencilFuncMask),c.setOp(ne.stencilFail,ne.stencilZFail,ne.stencilZPass)),Re(ne.polygonOffset,ne.polygonOffsetFactor,ne.polygonOffsetUnits),ne.alphaToCoverage===!0?te(n.SAMPLE_ALPHA_TO_COVERAGE):re(n.SAMPLE_ALPHA_TO_COVERAGE)}function fe(ne){B!==ne&&(ne?n.frontFace(n.CW):n.frontFace(n.CCW),B=ne)}function Pe(ne){ne!==rC?(te(n.CULL_FACE),ne!==L&&(ne===O5?n.cullFace(n.BACK):ne===sC?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):re(n.CULL_FACE),L=ne}function pe(ne){ne!==U&&(F&&n.lineWidth(ne),U=ne)}function Re(ne,Fe,me){ne?(te(n.POLYGON_OFFSET_FILL),(O!==Fe||Q!==me)&&(n.polygonOffset(Fe,me),O=Fe,Q=me)):re(n.POLYGON_OFFSET_FILL)}function Le(ne){ne?te(n.SCISSOR_TEST):re(n.SCISSOR_TEST)}function Se(ne){ne===void 0&&(ne=n.TEXTURE0+G-1),H!==ne&&(n.activeTexture(ne),H=ne)}function $e(ne,Fe,me){me===void 0&&(H===null?me=n.TEXTURE0+G-1:me=H);let Qe=V[me];Qe===void 0&&(Qe={type:void 0,texture:void 0},V[me]=Qe),(Qe.type!==ne||Qe.texture!==Fe)&&(H!==me&&(n.activeTexture(me),H=me),n.bindTexture(ne,Fe||ie[ne]),Qe.type=ne,Qe.texture=Fe)}function X(){const ne=V[H];ne!==void 0&&ne.type!==void 0&&(n.bindTexture(ne.type,null),ne.type=void 0,ne.texture=void 0)}function z(){try{n.compressedTexImage2D.apply(n,arguments)}catch(ne){console.error("THREE.WebGLState:",ne)}}function se(){try{n.compressedTexImage3D.apply(n,arguments)}catch(ne){console.error("THREE.WebGLState:",ne)}}function Be(){try{n.texSubImage2D.apply(n,arguments)}catch(ne){console.error("THREE.WebGLState:",ne)}}function Ce(){try{n.texSubImage3D.apply(n,arguments)}catch(ne){console.error("THREE.WebGLState:",ne)}}function we(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(ne){console.error("THREE.WebGLState:",ne)}}function ke(){try{n.compressedTexSubImage3D.apply(n,arguments)}catch(ne){console.error("THREE.WebGLState:",ne)}}function Ue(){try{n.texStorage2D.apply(n,arguments)}catch(ne){console.error("THREE.WebGLState:",ne)}}function xe(){try{n.texStorage3D.apply(n,arguments)}catch(ne){console.error("THREE.WebGLState:",ne)}}function ze(){try{n.texImage2D.apply(n,arguments)}catch(ne){console.error("THREE.WebGLState:",ne)}}function je(){try{n.texImage3D.apply(n,arguments)}catch(ne){console.error("THREE.WebGLState:",ne)}}function We(ne){Z.equals(ne)===!1&&(n.scissor(ne.x,ne.y,ne.z,ne.w),Z.copy(ne))}function Oe(ne){j.equals(ne)===!1&&(n.viewport(ne.x,ne.y,ne.z,ne.w),j.copy(ne))}function Ve(ne,Fe){let me=h.get(Fe);me===void 0&&(me=new WeakMap,h.set(Fe,me));let Qe=me.get(ne);Qe===void 0&&(Qe=n.getUniformBlockIndex(Fe,ne.name),me.set(ne,Qe))}function it(ne,Fe){const Qe=h.get(Fe).get(ne);u.get(Fe)!==Qe&&(n.uniformBlockBinding(Fe,Qe,ne.__bindingPointIndex),u.set(Fe,Qe))}function gt(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),i===!0&&(n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null)),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),f={},H=null,V={},p={},m=new WeakMap,y=[],v=null,A=!1,_=null,x=null,E=null,w=null,I=null,T=null,M=null,b=!1,B=null,L=null,U=null,O=null,Q=null,Z.set(0,0,n.canvas.width,n.canvas.height),j.set(0,0,n.canvas.width,n.canvas.height),o.reset(),l.reset(),c.reset()}return{buffers:{color:o,depth:l,stencil:c},enable:te,disable:re,bindFramebuffer:ce,drawBuffers:ye,useProgram:oe,setBlending:he,setMaterial:ue,setFlipSided:fe,setCullFace:Pe,setLineWidth:pe,setPolygonOffset:Re,setScissorTest:Le,activeTexture:Se,bindTexture:$e,unbindTexture:X,compressedTexImage2D:z,compressedTexImage3D:se,texImage2D:ze,texImage3D:je,updateUBOMapping:Ve,uniformBlockBinding:it,texStorage2D:Ue,texStorage3D:xe,texSubImage2D:Be,texSubImage3D:Ce,compressedTexSubImage2D:we,compressedTexSubImage3D:ke,scissor:We,viewport:Oe,reset:gt}}function Zk(n,e,t,i,r,s,a){const o=r.isWebGL2,l=r.maxTextures,c=r.maxCubemapSize,u=r.maxTextureSize,h=r.maxSamples,f=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,p=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),m=new WeakMap;let y;const v=new WeakMap;let A=!1;try{A=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(X,z){return A?new OffscreenCanvas(X,z):Rp("canvas")}function x(X,z,se,Be){let Ce=1;if((X.width>Be||X.height>Be)&&(Ce=Be/Math.max(X.width,X.height)),Ce<1||z===!0)if(typeof HTMLImageElement<"u"&&X instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&X instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&X instanceof ImageBitmap){const we=z?Pm:Math.floor,ke=we(Ce*X.width),Ue=we(Ce*X.height);y===void 0&&(y=_(ke,Ue));const xe=se?_(ke,Ue):y;return xe.width=ke,xe.height=Ue,xe.getContext("2d").drawImage(X,0,0,ke,Ue),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+X.width+"x"+X.height+") to ("+ke+"x"+Ue+")."),xe}else return"data"in X&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+X.width+"x"+X.height+")."),X;return X}function E(X){return ay(X.width)&&ay(X.height)}function w(X){return o?!1:X.wrapS!==oi||X.wrapT!==oi||X.minFilter!==Rt&&X.minFilter!==Tn}function I(X,z){return X.generateMipmaps&&z&&X.minFilter!==Rt&&X.minFilter!==Tn}function T(X){n.generateMipmap(X)}function M(X,z,se,Be,Ce=!1){if(o===!1)return z;if(X!==null){if(n[X]!==void 0)return n[X];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+X+"'")}let we=z;return z===n.RED&&(se===n.FLOAT&&(we=n.R32F),se===n.HALF_FLOAT&&(we=n.R16F),se===n.UNSIGNED_BYTE&&(we=n.R8)),z===n.RG&&(se===n.FLOAT&&(we=n.RG32F),se===n.HALF_FLOAT&&(we=n.RG16F),se===n.UNSIGNED_BYTE&&(we=n.RG8)),z===n.RGBA&&(se===n.FLOAT&&(we=n.RGBA32F),se===n.HALF_FLOAT&&(we=n.RGBA16F),se===n.UNSIGNED_BYTE&&(we=Be===Nt&&Ce===!1?n.SRGB8_ALPHA8:n.RGBA8),se===n.UNSIGNED_SHORT_4_4_4_4&&(we=n.RGBA4),se===n.UNSIGNED_SHORT_5_5_5_1&&(we=n.RGB5_A1)),(we===n.R16F||we===n.R32F||we===n.RG16F||we===n.RG32F||we===n.RGBA16F||we===n.RGBA32F)&&e.get("EXT_color_buffer_float"),we}function b(X,z,se){return I(X,se)===!0||X.isFramebufferTexture&&X.minFilter!==Rt&&X.minFilter!==Tn?Math.log2(Math.max(z.width,z.height))+1:X.mipmaps!==void 0&&X.mipmaps.length>0?X.mipmaps.length:X.isCompressedTexture&&Array.isArray(X.image)?z.mipmaps.length:1}function B(X){return X===Rt||X===Bm||X===Kd?n.NEAREST:n.LINEAR}function L(X){const z=X.target;z.removeEventListener("dispose",L),O(z),z.isVideoTexture&&m.delete(z)}function U(X){const z=X.target;z.removeEventListener("dispose",U),G(z)}function O(X){const z=i.get(X);if(z.__webglInit===void 0)return;const se=X.source,Be=v.get(se);if(Be){const Ce=Be[z.__cacheKey];Ce.usedTimes--,Ce.usedTimes===0&&Q(X),Object.keys(Be).length===0&&v.delete(se)}i.remove(X)}function Q(X){const z=i.get(X);n.deleteTexture(z.__webglTexture);const se=X.source,Be=v.get(se);delete Be[z.__cacheKey],a.memory.textures--}function G(X){const z=X.texture,se=i.get(X),Be=i.get(z);if(Be.__webglTexture!==void 0&&(n.deleteTexture(Be.__webglTexture),a.memory.textures--),X.depthTexture&&X.depthTexture.dispose(),X.isWebGLCubeRenderTarget)for(let Ce=0;Ce<6;Ce++)n.deleteFramebuffer(se.__webglFramebuffer[Ce]),se.__webglDepthbuffer&&n.deleteRenderbuffer(se.__webglDepthbuffer[Ce]);else{if(n.deleteFramebuffer(se.__webglFramebuffer),se.__webglDepthbuffer&&n.deleteRenderbuffer(se.__webglDepthbuffer),se.__webglMultisampledFramebuffer&&n.deleteFramebuffer(se.__webglMultisampledFramebuffer),se.__webglColorRenderbuffer)for(let Ce=0;Ce<se.__webglColorRenderbuffer.length;Ce++)se.__webglColorRenderbuffer[Ce]&&n.deleteRenderbuffer(se.__webglColorRenderbuffer[Ce]);se.__webglDepthRenderbuffer&&n.deleteRenderbuffer(se.__webglDepthRenderbuffer)}if(X.isWebGLMultipleRenderTargets)for(let Ce=0,we=z.length;Ce<we;Ce++){const ke=i.get(z[Ce]);ke.__webglTexture&&(n.deleteTexture(ke.__webglTexture),a.memory.textures--),i.remove(z[Ce])}i.remove(z),i.remove(X)}let F=0;function q(){F=0}function Y(){const X=F;return X>=l&&console.warn("THREE.WebGLTextures: Trying to use "+X+" texture units while this GPU supports only "+l),F+=1,X}function H(X){const z=[];return z.push(X.wrapS),z.push(X.wrapT),z.push(X.wrapR||0),z.push(X.magFilter),z.push(X.minFilter),z.push(X.anisotropy),z.push(X.internalFormat),z.push(X.format),z.push(X.type),z.push(X.generateMipmaps),z.push(X.premultiplyAlpha),z.push(X.flipY),z.push(X.unpackAlignment),z.push(X.colorSpace),z.join()}function V(X,z){const se=i.get(X);if(X.isVideoTexture&&Se(X),X.isRenderTargetTexture===!1&&X.version>0&&se.__version!==X.version){const Be=X.image;if(Be===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Be.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ce(se,X,z);return}}t.bindTexture(n.TEXTURE_2D,se.__webglTexture,n.TEXTURE0+z)}function D(X,z){const se=i.get(X);if(X.version>0&&se.__version!==X.version){ce(se,X,z);return}t.bindTexture(n.TEXTURE_2D_ARRAY,se.__webglTexture,n.TEXTURE0+z)}function k(X,z){const se=i.get(X);if(X.version>0&&se.__version!==X.version){ce(se,X,z);return}t.bindTexture(n.TEXTURE_3D,se.__webglTexture,n.TEXTURE0+z)}function Z(X,z){const se=i.get(X);if(X.version>0&&se.__version!==X.version){ye(se,X,z);return}t.bindTexture(n.TEXTURE_CUBE_MAP,se.__webglTexture,n.TEXTURE0+z)}const j={[Qo]:n.REPEAT,[oi]:n.CLAMP_TO_EDGE,[yp]:n.MIRRORED_REPEAT},ee={[Rt]:n.NEAREST,[Bm]:n.NEAREST_MIPMAP_NEAREST,[Kd]:n.NEAREST_MIPMAP_LINEAR,[Tn]:n.LINEAR,[y6]:n.LINEAR_MIPMAP_NEAREST,[Ja]:n.LINEAR_MIPMAP_LINEAR},ie={[NC]:n.NEVER,[YC]:n.ALWAYS,[GC]:n.LESS,[QC]:n.LEQUAL,[zC]:n.EQUAL,[WC]:n.GEQUAL,[HC]:n.GREATER,[VC]:n.NOTEQUAL};function te(X,z,se){if(se?(n.texParameteri(X,n.TEXTURE_WRAP_S,j[z.wrapS]),n.texParameteri(X,n.TEXTURE_WRAP_T,j[z.wrapT]),(X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY)&&n.texParameteri(X,n.TEXTURE_WRAP_R,j[z.wrapR]),n.texParameteri(X,n.TEXTURE_MAG_FILTER,ee[z.magFilter]),n.texParameteri(X,n.TEXTURE_MIN_FILTER,ee[z.minFilter])):(n.texParameteri(X,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(X,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY)&&n.texParameteri(X,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(z.wrapS!==oi||z.wrapT!==oi)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(X,n.TEXTURE_MAG_FILTER,B(z.magFilter)),n.texParameteri(X,n.TEXTURE_MIN_FILTER,B(z.minFilter)),z.minFilter!==Rt&&z.minFilter!==Tn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),z.compareFunction&&(n.texParameteri(X,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(X,n.TEXTURE_COMPARE_FUNC,ie[z.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const Be=e.get("EXT_texture_filter_anisotropic");if(z.magFilter===Rt||z.minFilter!==Kd&&z.minFilter!==Ja||z.type===br&&e.has("OES_texture_float_linear")===!1||o===!1&&z.type===Ai&&e.has("OES_texture_half_float_linear")===!1)return;(z.anisotropy>1||i.get(z).__currentAnisotropy)&&(n.texParameterf(X,Be.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(z.anisotropy,r.getMaxAnisotropy())),i.get(z).__currentAnisotropy=z.anisotropy)}}function re(X,z){let se=!1;X.__webglInit===void 0&&(X.__webglInit=!0,z.addEventListener("dispose",L));const Be=z.source;let Ce=v.get(Be);Ce===void 0&&(Ce={},v.set(Be,Ce));const we=H(z);if(we!==X.__cacheKey){Ce[we]===void 0&&(Ce[we]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,se=!0),Ce[we].usedTimes++;const ke=Ce[X.__cacheKey];ke!==void 0&&(Ce[X.__cacheKey].usedTimes--,ke.usedTimes===0&&Q(z)),X.__cacheKey=we,X.__webglTexture=Ce[we].texture}return se}function ce(X,z,se){let Be=n.TEXTURE_2D;(z.isDataArrayTexture||z.isCompressedArrayTexture)&&(Be=n.TEXTURE_2D_ARRAY),z.isData3DTexture&&(Be=n.TEXTURE_3D);const Ce=re(X,z),we=z.source;t.bindTexture(Be,X.__webglTexture,n.TEXTURE0+se);const ke=i.get(we);if(we.version!==ke.__version||Ce===!0){t.activeTexture(n.TEXTURE0+se),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,z.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,z.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,z.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.NONE);const Ue=w(z)&&E(z.image)===!1;let xe=x(z.image,Ue,!1,u);xe=$e(z,xe);const ze=E(xe)||o,je=s.convert(z.format,z.colorSpace);let We=s.convert(z.type),Oe=M(z.internalFormat,je,We,z.colorSpace);te(Be,z,ze);let Ve;const it=z.mipmaps,gt=o&&z.isVideoTexture!==!0,ne=ke.__version===void 0||Ce===!0,Fe=b(z,xe,ze);if(z.isDepthTexture)Oe=n.DEPTH_COMPONENT,o?z.type===br?Oe=n.DEPTH_COMPONENT32F:z.type===Oo?Oe=n.DEPTH_COMPONENT24:z.type===ko?Oe=n.DEPTH24_STENCIL8:Oe=n.DEPTH_COMPONENT16:z.type===br&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),z.format===Bl&&Oe===n.DEPTH_COMPONENT&&z.type!==Au&&z.type!==Oo&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),z.type=Oo,We=s.convert(z.type)),z.format===Nl&&Oe===n.DEPTH_COMPONENT&&(Oe=n.DEPTH_STENCIL,z.type!==ko&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),z.type=ko,We=s.convert(z.type))),ne&&(gt?t.texStorage2D(n.TEXTURE_2D,1,Oe,xe.width,xe.height):t.texImage2D(n.TEXTURE_2D,0,Oe,xe.width,xe.height,0,je,We,null));else if(z.isDataTexture)if(it.length>0&&ze){gt&&ne&&t.texStorage2D(n.TEXTURE_2D,Fe,Oe,it[0].width,it[0].height);for(let me=0,Qe=it.length;me<Qe;me++)Ve=it[me],gt?t.texSubImage2D(n.TEXTURE_2D,me,0,0,Ve.width,Ve.height,je,We,Ve.data):t.texImage2D(n.TEXTURE_2D,me,Oe,Ve.width,Ve.height,0,je,We,Ve.data);z.generateMipmaps=!1}else gt?(ne&&t.texStorage2D(n.TEXTURE_2D,Fe,Oe,xe.width,xe.height),t.texSubImage2D(n.TEXTURE_2D,0,0,0,xe.width,xe.height,je,We,xe.data)):t.texImage2D(n.TEXTURE_2D,0,Oe,xe.width,xe.height,0,je,We,xe.data);else if(z.isCompressedTexture)if(z.isCompressedArrayTexture){gt&&ne&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Fe,Oe,it[0].width,it[0].height,xe.depth);for(let me=0,Qe=it.length;me<Qe;me++)Ve=it[me],z.format!==li?je!==null?gt?t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,me,0,0,0,Ve.width,Ve.height,xe.depth,je,Ve.data,0,0):t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,me,Oe,Ve.width,Ve.height,xe.depth,0,Ve.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):gt?t.texSubImage3D(n.TEXTURE_2D_ARRAY,me,0,0,0,Ve.width,Ve.height,xe.depth,je,We,Ve.data):t.texImage3D(n.TEXTURE_2D_ARRAY,me,Oe,Ve.width,Ve.height,xe.depth,0,je,We,Ve.data)}else{gt&&ne&&t.texStorage2D(n.TEXTURE_2D,Fe,Oe,it[0].width,it[0].height);for(let me=0,Qe=it.length;me<Qe;me++)Ve=it[me],z.format!==li?je!==null?gt?t.compressedTexSubImage2D(n.TEXTURE_2D,me,0,0,Ve.width,Ve.height,je,Ve.data):t.compressedTexImage2D(n.TEXTURE_2D,me,Oe,Ve.width,Ve.height,0,Ve.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):gt?t.texSubImage2D(n.TEXTURE_2D,me,0,0,Ve.width,Ve.height,je,We,Ve.data):t.texImage2D(n.TEXTURE_2D,me,Oe,Ve.width,Ve.height,0,je,We,Ve.data)}else if(z.isDataArrayTexture)gt?(ne&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Fe,Oe,xe.width,xe.height,xe.depth),t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,xe.width,xe.height,xe.depth,je,We,xe.data)):t.texImage3D(n.TEXTURE_2D_ARRAY,0,Oe,xe.width,xe.height,xe.depth,0,je,We,xe.data);else if(z.isData3DTexture)gt?(ne&&t.texStorage3D(n.TEXTURE_3D,Fe,Oe,xe.width,xe.height,xe.depth),t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,xe.width,xe.height,xe.depth,je,We,xe.data)):t.texImage3D(n.TEXTURE_3D,0,Oe,xe.width,xe.height,xe.depth,0,je,We,xe.data);else if(z.isFramebufferTexture){if(ne)if(gt)t.texStorage2D(n.TEXTURE_2D,Fe,Oe,xe.width,xe.height);else{let me=xe.width,Qe=xe.height;for(let Xe=0;Xe<Fe;Xe++)t.texImage2D(n.TEXTURE_2D,Xe,Oe,me,Qe,0,je,We,null),me>>=1,Qe>>=1}}else if(it.length>0&&ze){gt&&ne&&t.texStorage2D(n.TEXTURE_2D,Fe,Oe,it[0].width,it[0].height);for(let me=0,Qe=it.length;me<Qe;me++)Ve=it[me],gt?t.texSubImage2D(n.TEXTURE_2D,me,0,0,je,We,Ve):t.texImage2D(n.TEXTURE_2D,me,Oe,je,We,Ve);z.generateMipmaps=!1}else gt?(ne&&t.texStorage2D(n.TEXTURE_2D,Fe,Oe,xe.width,xe.height),t.texSubImage2D(n.TEXTURE_2D,0,0,0,je,We,xe)):t.texImage2D(n.TEXTURE_2D,0,Oe,je,We,xe);I(z,ze)&&T(Be),ke.__version=we.version,z.onUpdate&&z.onUpdate(z)}X.__version=z.version}function ye(X,z,se){if(z.image.length!==6)return;const Be=re(X,z),Ce=z.source;t.bindTexture(n.TEXTURE_CUBE_MAP,X.__webglTexture,n.TEXTURE0+se);const we=i.get(Ce);if(Ce.version!==we.__version||Be===!0){t.activeTexture(n.TEXTURE0+se),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,z.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,z.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,z.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.NONE);const ke=z.isCompressedTexture||z.image[0].isCompressedTexture,Ue=z.image[0]&&z.image[0].isDataTexture,xe=[];for(let me=0;me<6;me++)!ke&&!Ue?xe[me]=x(z.image[me],!1,!0,c):xe[me]=Ue?z.image[me].image:z.image[me],xe[me]=$e(z,xe[me]);const ze=xe[0],je=E(ze)||o,We=s.convert(z.format,z.colorSpace),Oe=s.convert(z.type),Ve=M(z.internalFormat,We,Oe,z.colorSpace),it=o&&z.isVideoTexture!==!0,gt=we.__version===void 0||Be===!0;let ne=b(z,ze,je);te(n.TEXTURE_CUBE_MAP,z,je);let Fe;if(ke){it&&gt&&t.texStorage2D(n.TEXTURE_CUBE_MAP,ne,Ve,ze.width,ze.height);for(let me=0;me<6;me++){Fe=xe[me].mipmaps;for(let Qe=0;Qe<Fe.length;Qe++){const Xe=Fe[Qe];z.format!==li?We!==null?it?t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Qe,0,0,Xe.width,Xe.height,We,Xe.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Qe,Ve,Xe.width,Xe.height,0,Xe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):it?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Qe,0,0,Xe.width,Xe.height,We,Oe,Xe.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Qe,Ve,Xe.width,Xe.height,0,We,Oe,Xe.data)}}}else{Fe=z.mipmaps,it&&gt&&(Fe.length>0&&ne++,t.texStorage2D(n.TEXTURE_CUBE_MAP,ne,Ve,xe[0].width,xe[0].height));for(let me=0;me<6;me++)if(Ue){it?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,0,0,xe[me].width,xe[me].height,We,Oe,xe[me].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,Ve,xe[me].width,xe[me].height,0,We,Oe,xe[me].data);for(let Qe=0;Qe<Fe.length;Qe++){const Dt=Fe[Qe].image[me].image;it?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Qe+1,0,0,Dt.width,Dt.height,We,Oe,Dt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Qe+1,Ve,Dt.width,Dt.height,0,We,Oe,Dt.data)}}else{it?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,0,0,We,Oe,xe[me]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,Ve,We,Oe,xe[me]);for(let Qe=0;Qe<Fe.length;Qe++){const Xe=Fe[Qe];it?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Qe+1,0,0,We,Oe,Xe.image[me]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Qe+1,Ve,We,Oe,Xe.image[me])}}}I(z,je)&&T(n.TEXTURE_CUBE_MAP),we.__version=Ce.version,z.onUpdate&&z.onUpdate(z)}X.__version=z.version}function oe(X,z,se,Be,Ce){const we=s.convert(se.format,se.colorSpace),ke=s.convert(se.type),Ue=M(se.internalFormat,we,ke,se.colorSpace);i.get(z).__hasExternalTextures||(Ce===n.TEXTURE_3D||Ce===n.TEXTURE_2D_ARRAY?t.texImage3D(Ce,0,Ue,z.width,z.height,z.depth,0,we,ke,null):t.texImage2D(Ce,0,Ue,z.width,z.height,0,we,ke,null)),t.bindFramebuffer(n.FRAMEBUFFER,X),Le(z)?f.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,Be,Ce,i.get(se).__webglTexture,0,Re(z)):(Ce===n.TEXTURE_2D||Ce>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&Ce<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,Be,Ce,i.get(se).__webglTexture,0),t.bindFramebuffer(n.FRAMEBUFFER,null)}function W(X,z,se){if(n.bindRenderbuffer(n.RENDERBUFFER,X),z.depthBuffer&&!z.stencilBuffer){let Be=n.DEPTH_COMPONENT16;if(se||Le(z)){const Ce=z.depthTexture;Ce&&Ce.isDepthTexture&&(Ce.type===br?Be=n.DEPTH_COMPONENT32F:Ce.type===Oo&&(Be=n.DEPTH_COMPONENT24));const we=Re(z);Le(z)?f.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,we,Be,z.width,z.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,we,Be,z.width,z.height)}else n.renderbufferStorage(n.RENDERBUFFER,Be,z.width,z.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,X)}else if(z.depthBuffer&&z.stencilBuffer){const Be=Re(z);se&&Le(z)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,Be,n.DEPTH24_STENCIL8,z.width,z.height):Le(z)?f.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Be,n.DEPTH24_STENCIL8,z.width,z.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,z.width,z.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,X)}else{const Be=z.isWebGLMultipleRenderTargets===!0?z.texture:[z.texture];for(let Ce=0;Ce<Be.length;Ce++){const we=Be[Ce],ke=s.convert(we.format,we.colorSpace),Ue=s.convert(we.type),xe=M(we.internalFormat,ke,Ue,we.colorSpace),ze=Re(z);se&&Le(z)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,ze,xe,z.width,z.height):Le(z)?f.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ze,xe,z.width,z.height):n.renderbufferStorage(n.RENDERBUFFER,xe,z.width,z.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function ge(X,z){if(z&&z.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(n.FRAMEBUFFER,X),!(z.depthTexture&&z.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(z.depthTexture).__webglTexture||z.depthTexture.image.width!==z.width||z.depthTexture.image.height!==z.height)&&(z.depthTexture.image.width=z.width,z.depthTexture.image.height=z.height,z.depthTexture.needsUpdate=!0),V(z.depthTexture,0);const Be=i.get(z.depthTexture).__webglTexture,Ce=Re(z);if(z.depthTexture.format===Bl)Le(z)?f.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,Be,0,Ce):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,Be,0);else if(z.depthTexture.format===Nl)Le(z)?f.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,Be,0,Ce):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,Be,0);else throw new Error("Unknown depthTexture format")}function he(X){const z=i.get(X),se=X.isWebGLCubeRenderTarget===!0;if(X.depthTexture&&!z.__autoAllocateDepthBuffer){if(se)throw new Error("target.depthTexture not supported in Cube render targets");ge(z.__webglFramebuffer,X)}else if(se){z.__webglDepthbuffer=[];for(let Be=0;Be<6;Be++)t.bindFramebuffer(n.FRAMEBUFFER,z.__webglFramebuffer[Be]),z.__webglDepthbuffer[Be]=n.createRenderbuffer(),W(z.__webglDepthbuffer[Be],X,!1)}else t.bindFramebuffer(n.FRAMEBUFFER,z.__webglFramebuffer),z.__webglDepthbuffer=n.createRenderbuffer(),W(z.__webglDepthbuffer,X,!1);t.bindFramebuffer(n.FRAMEBUFFER,null)}function ue(X,z,se){const Be=i.get(X);z!==void 0&&oe(Be.__webglFramebuffer,X,X.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D),se!==void 0&&he(X)}function fe(X){const z=X.texture,se=i.get(X),Be=i.get(z);X.addEventListener("dispose",U),X.isWebGLMultipleRenderTargets!==!0&&(Be.__webglTexture===void 0&&(Be.__webglTexture=n.createTexture()),Be.__version=z.version,a.memory.textures++);const Ce=X.isWebGLCubeRenderTarget===!0,we=X.isWebGLMultipleRenderTargets===!0,ke=E(X)||o;if(Ce){se.__webglFramebuffer=[];for(let Ue=0;Ue<6;Ue++)se.__webglFramebuffer[Ue]=n.createFramebuffer()}else{if(se.__webglFramebuffer=n.createFramebuffer(),we)if(r.drawBuffers){const Ue=X.texture;for(let xe=0,ze=Ue.length;xe<ze;xe++){const je=i.get(Ue[xe]);je.__webglTexture===void 0&&(je.__webglTexture=n.createTexture(),a.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(o&&X.samples>0&&Le(X)===!1){const Ue=we?z:[z];se.__webglMultisampledFramebuffer=n.createFramebuffer(),se.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,se.__webglMultisampledFramebuffer);for(let xe=0;xe<Ue.length;xe++){const ze=Ue[xe];se.__webglColorRenderbuffer[xe]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,se.__webglColorRenderbuffer[xe]);const je=s.convert(ze.format,ze.colorSpace),We=s.convert(ze.type),Oe=M(ze.internalFormat,je,We,ze.colorSpace,X.isXRRenderTarget===!0),Ve=Re(X);n.renderbufferStorageMultisample(n.RENDERBUFFER,Ve,Oe,X.width,X.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+xe,n.RENDERBUFFER,se.__webglColorRenderbuffer[xe])}n.bindRenderbuffer(n.RENDERBUFFER,null),X.depthBuffer&&(se.__webglDepthRenderbuffer=n.createRenderbuffer(),W(se.__webglDepthRenderbuffer,X,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(Ce){t.bindTexture(n.TEXTURE_CUBE_MAP,Be.__webglTexture),te(n.TEXTURE_CUBE_MAP,z,ke);for(let Ue=0;Ue<6;Ue++)oe(se.__webglFramebuffer[Ue],X,z,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Ue);I(z,ke)&&T(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(we){const Ue=X.texture;for(let xe=0,ze=Ue.length;xe<ze;xe++){const je=Ue[xe],We=i.get(je);t.bindTexture(n.TEXTURE_2D,We.__webglTexture),te(n.TEXTURE_2D,je,ke),oe(se.__webglFramebuffer,X,je,n.COLOR_ATTACHMENT0+xe,n.TEXTURE_2D),I(je,ke)&&T(n.TEXTURE_2D)}t.unbindTexture()}else{let Ue=n.TEXTURE_2D;(X.isWebGL3DRenderTarget||X.isWebGLArrayRenderTarget)&&(o?Ue=X.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(Ue,Be.__webglTexture),te(Ue,z,ke),oe(se.__webglFramebuffer,X,z,n.COLOR_ATTACHMENT0,Ue),I(z,ke)&&T(Ue),t.unbindTexture()}X.depthBuffer&&he(X)}function Pe(X){const z=E(X)||o,se=X.isWebGLMultipleRenderTargets===!0?X.texture:[X.texture];for(let Be=0,Ce=se.length;Be<Ce;Be++){const we=se[Be];if(I(we,z)){const ke=X.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:n.TEXTURE_2D,Ue=i.get(we).__webglTexture;t.bindTexture(ke,Ue),T(ke),t.unbindTexture()}}}function pe(X){if(o&&X.samples>0&&Le(X)===!1){const z=X.isWebGLMultipleRenderTargets?X.texture:[X.texture],se=X.width,Be=X.height;let Ce=n.COLOR_BUFFER_BIT;const we=[],ke=X.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Ue=i.get(X),xe=X.isWebGLMultipleRenderTargets===!0;if(xe)for(let ze=0;ze<z.length;ze++)t.bindFramebuffer(n.FRAMEBUFFER,Ue.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+ze,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,Ue.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+ze,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,Ue.__webglMultisampledFramebuffer),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Ue.__webglFramebuffer);for(let ze=0;ze<z.length;ze++){we.push(n.COLOR_ATTACHMENT0+ze),X.depthBuffer&&we.push(ke);const je=Ue.__ignoreDepthValues!==void 0?Ue.__ignoreDepthValues:!1;if(je===!1&&(X.depthBuffer&&(Ce|=n.DEPTH_BUFFER_BIT),X.stencilBuffer&&(Ce|=n.STENCIL_BUFFER_BIT)),xe&&n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,Ue.__webglColorRenderbuffer[ze]),je===!0&&(n.invalidateFramebuffer(n.READ_FRAMEBUFFER,[ke]),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[ke])),xe){const We=i.get(z[ze]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,We,0)}n.blitFramebuffer(0,0,se,Be,0,0,se,Be,Ce,n.NEAREST),p&&n.invalidateFramebuffer(n.READ_FRAMEBUFFER,we)}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),xe)for(let ze=0;ze<z.length;ze++){t.bindFramebuffer(n.FRAMEBUFFER,Ue.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+ze,n.RENDERBUFFER,Ue.__webglColorRenderbuffer[ze]);const je=i.get(z[ze]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,Ue.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+ze,n.TEXTURE_2D,je,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Ue.__webglMultisampledFramebuffer)}}function Re(X){return Math.min(h,X.samples)}function Le(X){const z=i.get(X);return o&&X.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&z.__useRenderToTexture!==!1}function Se(X){const z=a.render.frame;m.get(X)!==z&&(m.set(X,z),X.update())}function $e(X,z){const se=X.colorSpace,Be=X.format,Ce=X.type;return X.isCompressedTexture===!0||X.format===Dm||se!==fa&&se!==Pl&&(se===Nt?o===!1?e.has("EXT_sRGB")===!0&&Be===li?(X.format=Dm,X.minFilter=Tn,X.generateMipmaps=!1):z=B6.sRGBToLinear(z):(Be!==li||Ce!==Ri)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",se)),z}this.allocateTextureUnit=Y,this.resetTextureUnits=q,this.setTexture2D=V,this.setTexture2DArray=D,this.setTexture3D=k,this.setTextureCube=Z,this.rebindTextures=ue,this.setupRenderTarget=fe,this.updateRenderTargetMipmap=Pe,this.updateMultisampleRenderTarget=pe,this.setupDepthRenderbuffer=he,this.setupFrameBufferTexture=oe,this.useMultisampledRTT=Le}function rT(n,e,t){const i=t.isWebGL2;function r(s,a=Pl){let o;if(s===Ri)return n.UNSIGNED_BYTE;if(s===_6)return n.UNSIGNED_SHORT_4_4_4_4;if(s===E6)return n.UNSIGNED_SHORT_5_5_5_1;if(s===IC)return n.BYTE;if(s===MC)return n.SHORT;if(s===Au)return n.UNSIGNED_SHORT;if(s===x6)return n.INT;if(s===Oo)return n.UNSIGNED_INT;if(s===br)return n.FLOAT;if(s===Ai)return i?n.HALF_FLOAT:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(s===RC)return n.ALPHA;if(s===li)return n.RGBA;if(s===S6)return n.LUMINANCE;if(s===BC)return n.LUMINANCE_ALPHA;if(s===Bl)return n.DEPTH_COMPONENT;if(s===Nl)return n.DEPTH_STENCIL;if(s===Dm)return o=e.get("EXT_sRGB"),o!==null?o.SRGB_ALPHA_EXT:null;if(s===Qc)return n.RED;if(s===w6)return n.RED_INTEGER;if(s===wh)return n.RG;if(s===C6)return n.RG_INTEGER;if(s===T6)return n.RGBA_INTEGER;if(s===Ph||s===lm||s===cm||s===Lh)if(a===Nt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(s===Ph)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===lm)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===cm)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Lh)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(s===Ph)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===lm)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===cm)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Lh)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===xp||s===z5||s===_p||s===Q5)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(s===xp)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===z5)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===_p)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Q5)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===B2)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===Ep||s===Sp)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(s===Ep)return a===Nt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(s===Sp)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===wp||s===H5||s===V5||s===W5||s===Y5||s===q5||s===X5||s===j5||s===K5||s===$5||s===J5||s===Z5||s===ey||s===ty)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(s===wp)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===H5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===V5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===W5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Y5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===q5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===X5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===j5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===K5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===$5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===J5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Z5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===ey)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===ty)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Uh)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(s===Uh)return a===Nt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===DC||s===ny||s===iy||s===ry)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(s===Uh)return o.COMPRESSED_RED_RGTC1_EXT;if(s===ny)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===iy)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===ry)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===ko?i?n.UNSIGNED_INT_24_8:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:r}}class sT extends Kn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class bh extends fn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const eN={type:"move"};class dv{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new bh,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 bh,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new N,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new N),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new bh,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new N,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new N),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const y of e.hand.values()){const v=t.getJointPose(y,i),A=this._getHandJoint(c,y);v!==null&&(A.matrix.fromArray(v.transform.matrix),A.matrix.decompose(A.position,A.rotation,A.scale),A.matrixWorldNeedsUpdate=!0,A.jointRadius=v.radius),A.visible=v!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=u.position.distanceTo(h.position),p=.02,m=.005;c.inputState.pinching&&f>p+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=p-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(eN)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new bh;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class uf extends Vn{constructor(e,t,i,r,s,a,o,l,c,u){if(u=u!==void 0?u:Bl,u!==Bl&&u!==Nl)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===Bl&&(i=Oo),i===void 0&&u===Nl&&(i=ko),super(null,r,s,a,o,l,u,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:Rt,this.minFilter=l!==void 0?l:Rt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class tN extends Yo{constructor(e,t){super();const i=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,u=null,h=null,f=null,p=null,m=null;const y=t.getContextAttributes();let v=null,A=null;const _=[],x=[],E=new Kn;E.layers.enable(1),E.viewport=new jt;const w=new Kn;w.layers.enable(2),w.viewport=new jt;const I=[E,w],T=new sT;T.layers.enable(1),T.layers.enable(2);let M=null,b=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(D){let k=_[D];return k===void 0&&(k=new dv,_[D]=k),k.getTargetRaySpace()},this.getControllerGrip=function(D){let k=_[D];return k===void 0&&(k=new dv,_[D]=k),k.getGripSpace()},this.getHand=function(D){let k=_[D];return k===void 0&&(k=new dv,_[D]=k),k.getHandSpace()};function B(D){const k=x.indexOf(D.inputSource);if(k===-1)return;const Z=_[k];Z!==void 0&&(Z.update(D.inputSource,D.frame,c||a),Z.dispatchEvent({type:D.type,data:D.inputSource}))}function L(){r.removeEventListener("select",B),r.removeEventListener("selectstart",B),r.removeEventListener("selectend",B),r.removeEventListener("squeeze",B),r.removeEventListener("squeezestart",B),r.removeEventListener("squeezeend",B),r.removeEventListener("end",L),r.removeEventListener("inputsourceschange",U);for(let D=0;D<_.length;D++){const k=x[D];k!==null&&(x[D]=null,_[D].disconnect(k))}M=null,b=null,e.setRenderTarget(v),p=null,f=null,h=null,r=null,A=null,V.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(D){s=D,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(D){o=D,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(D){c=D},this.getBaseLayer=function(){return f!==null?f:p},this.getBinding=function(){return h},this.getFrame=function(){return m},this.getSession=function(){return r},this.setSession=async function(D){if(r=D,r!==null){if(v=e.getRenderTarget(),r.addEventListener("select",B),r.addEventListener("selectstart",B),r.addEventListener("selectend",B),r.addEventListener("squeeze",B),r.addEventListener("squeezestart",B),r.addEventListener("squeezeend",B),r.addEventListener("end",L),r.addEventListener("inputsourceschange",U),y.xrCompatible!==!0&&await t.makeXRCompatible(),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const k={antialias:r.renderState.layers===void 0?y.antialias:!0,alpha:!0,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,t,k),r.updateRenderState({baseLayer:p}),A=new Dn(p.framebufferWidth,p.framebufferHeight,{format:li,type:Ri,colorSpace:e.outputColorSpace,stencilBuffer:y.stencil})}else{let k=null,Z=null,j=null;y.depth&&(j=y.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,k=y.stencil?Nl:Bl,Z=y.stencil?ko:Oo);const ee={colorFormat:t.RGBA8,depthFormat:j,scaleFactor:s};h=new XRWebGLBinding(r,t),f=h.createProjectionLayer(ee),r.updateRenderState({layers:[f]}),A=new Dn(f.textureWidth,f.textureHeight,{format:li,type:Ri,depthTexture:new uf(f.textureWidth,f.textureHeight,Z,void 0,void 0,void 0,void 0,void 0,void 0,k),stencilBuffer:y.stencil,colorSpace:e.outputColorSpace,samples:y.antialias?4:0});const ie=e.properties.get(A);ie.__ignoreDepthValues=f.ignoreDepthValues}A.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),V.setContext(r),V.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode};function U(D){for(let k=0;k<D.removed.length;k++){const Z=D.removed[k],j=x.indexOf(Z);j>=0&&(x[j]=null,_[j].disconnect(Z))}for(let k=0;k<D.added.length;k++){const Z=D.added[k];let j=x.indexOf(Z);if(j===-1){for(let ie=0;ie<_.length;ie++)if(ie>=x.length){x.push(Z),j=ie;break}else if(x[ie]===null){x[ie]=Z,j=ie;break}if(j===-1)break}const ee=_[j];ee&&ee.connect(Z)}}const O=new N,Q=new N;function G(D,k,Z){O.setFromMatrixPosition(k.matrixWorld),Q.setFromMatrixPosition(Z.matrixWorld);const j=O.distanceTo(Q),ee=k.projectionMatrix.elements,ie=Z.projectionMatrix.elements,te=ee[14]/(ee[10]-1),re=ee[14]/(ee[10]+1),ce=(ee[9]+1)/ee[5],ye=(ee[9]-1)/ee[5],oe=(ee[8]-1)/ee[0],W=(ie[8]+1)/ie[0],ge=te*oe,he=te*W,ue=j/(-oe+W),fe=ue*-oe;k.matrixWorld.decompose(D.position,D.quaternion,D.scale),D.translateX(fe),D.translateZ(ue),D.matrixWorld.compose(D.position,D.quaternion,D.scale),D.matrixWorldInverse.copy(D.matrixWorld).invert();const Pe=te+ue,pe=re+ue,Re=ge-fe,Le=he+(j-fe),Se=ce*re/pe*Pe,$e=ye*re/pe*Pe;D.projectionMatrix.makePerspective(Re,Le,Se,$e,Pe,pe),D.projectionMatrixInverse.copy(D.projectionMatrix).invert()}function F(D,k){k===null?D.matrixWorld.copy(D.matrix):D.matrixWorld.multiplyMatrices(k.matrixWorld,D.matrix),D.matrixWorldInverse.copy(D.matrixWorld).invert()}this.updateCamera=function(D){if(r===null)return;T.near=w.near=E.near=D.near,T.far=w.far=E.far=D.far,(M!==T.near||b!==T.far)&&(r.updateRenderState({depthNear:T.near,depthFar:T.far}),M=T.near,b=T.far);const k=D.parent,Z=T.cameras;F(T,k);for(let j=0;j<Z.length;j++)F(Z[j],k);Z.length===2?G(T,E,w):T.projectionMatrix.copy(E.projectionMatrix),q(D,T,k)};function q(D,k,Z){Z===null?D.matrix.copy(k.matrixWorld):(D.matrix.copy(Z.matrixWorld),D.matrix.invert(),D.matrix.multiply(k.matrixWorld)),D.matrix.decompose(D.position,D.quaternion,D.scale),D.updateMatrixWorld(!0);const j=D.children;for(let ee=0,ie=j.length;ee<ie;ee++)j[ee].updateMatrixWorld(!0);D.projectionMatrix.copy(k.projectionMatrix),D.projectionMatrixInverse.copy(k.projectionMatrixInverse),D.isPerspectiveCamera&&(D.fov=Vh*2*Math.atan(1/D.projectionMatrix.elements[5]),D.zoom=1)}this.getCamera=function(){return T},this.getFoveation=function(){if(!(f===null&&p===null))return l},this.setFoveation=function(D){l=D,f!==null&&(f.fixedFoveation=D),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=D)};let Y=null;function H(D,k){if(u=k.getViewerPose(c||a),m=k,u!==null){const Z=u.views;p!==null&&(e.setRenderTargetFramebuffer(A,p.framebuffer),e.setRenderTarget(A));let j=!1;Z.length!==T.cameras.length&&(T.cameras.length=0,j=!0);for(let ee=0;ee<Z.length;ee++){const ie=Z[ee];let te=null;if(p!==null)te=p.getViewport(ie);else{const ce=h.getViewSubImage(f,ie);te=ce.viewport,ee===0&&(e.setRenderTargetTextures(A,ce.colorTexture,f.ignoreDepthValues?void 0:ce.depthStencilTexture),e.setRenderTarget(A))}let re=I[ee];re===void 0&&(re=new Kn,re.layers.enable(ee),re.viewport=new jt,I[ee]=re),re.matrix.fromArray(ie.transform.matrix),re.matrix.decompose(re.position,re.quaternion,re.scale),re.projectionMatrix.fromArray(ie.projectionMatrix),re.projectionMatrixInverse.copy(re.projectionMatrix).invert(),re.viewport.set(te.x,te.y,te.width,te.height),ee===0&&(T.matrix.copy(re.matrix),T.matrix.decompose(T.position,T.quaternion,T.scale)),j===!0&&T.cameras.push(re)}}for(let Z=0;Z<_.length;Z++){const j=x[Z],ee=_[Z];j!==null&&ee!==void 0&&ee.update(j,k,c||a)}Y&&Y(D,k),k.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:k}),m=null}const V=new ZC;V.setAnimationLoop(H),this.setAnimationLoop=function(D){Y=D},this.dispose=function(){}}}function nN(n,e){function t(v,A){v.matrixAutoUpdate===!0&&v.updateMatrix(),A.value.copy(v.matrix)}function i(v,A){A.color.getRGB(v.fogColor.value,KC(n)),A.isFog?(v.fogNear.value=A.near,v.fogFar.value=A.far):A.isFogExp2&&(v.fogDensity.value=A.density)}function r(v,A,_,x,E){A.isMeshBasicMaterial||A.isMeshLambertMaterial?s(v,A):A.isMeshToonMaterial?(s(v,A),h(v,A)):A.isMeshPhongMaterial?(s(v,A),u(v,A)):A.isMeshStandardMaterial?(s(v,A),f(v,A),A.isMeshPhysicalMaterial&&p(v,A,E)):A.isMeshMatcapMaterial?(s(v,A),m(v,A)):A.isMeshDepthMaterial?s(v,A):A.isMeshDistanceMaterial?(s(v,A),y(v,A)):A.isMeshNormalMaterial?s(v,A):A.isLineBasicMaterial?(a(v,A),A.isLineDashedMaterial&&o(v,A)):A.isPointsMaterial?l(v,A,_,x):A.isSpriteMaterial?c(v,A):A.isShadowMaterial?(v.color.value.copy(A.color),v.opacity.value=A.opacity):A.isShaderMaterial&&(A.uniformsNeedUpdate=!1)}function s(v,A){v.opacity.value=A.opacity,A.color&&v.diffuse.value.copy(A.color),A.emissive&&v.emissive.value.copy(A.emissive).multiplyScalar(A.emissiveIntensity),A.map&&(v.map.value=A.map,t(A.map,v.mapTransform)),A.alphaMap&&(v.alphaMap.value=A.alphaMap,t(A.alphaMap,v.alphaMapTransform)),A.bumpMap&&(v.bumpMap.value=A.bumpMap,t(A.bumpMap,v.bumpMapTransform),v.bumpScale.value=A.bumpScale,A.side===Ki&&(v.bumpScale.value*=-1)),A.normalMap&&(v.normalMap.value=A.normalMap,t(A.normalMap,v.normalMapTransform),v.normalScale.value.copy(A.normalScale),A.side===Ki&&v.normalScale.value.negate()),A.displacementMap&&(v.displacementMap.value=A.displacementMap,t(A.displacementMap,v.displacementMapTransform),v.displacementScale.value=A.displacementScale,v.displacementBias.value=A.displacementBias),A.emissiveMap&&(v.emissiveMap.value=A.emissiveMap,t(A.emissiveMap,v.emissiveMapTransform)),A.specularMap&&(v.specularMap.value=A.specularMap,t(A.specularMap,v.specularMapTransform)),A.alphaTest>0&&(v.alphaTest.value=A.alphaTest);const _=e.get(A).envMap;if(_&&(v.envMap.value=_,v.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,v.reflectivity.value=A.reflectivity,v.ior.value=A.ior,v.refractionRatio.value=A.refractionRatio),A.lightMap){v.lightMap.value=A.lightMap;const x=n.useLegacyLights===!0?Math.PI:1;v.lightMapIntensity.value=A.lightMapIntensity*x,t(A.lightMap,v.lightMapTransform)}A.aoMap&&(v.aoMap.value=A.aoMap,v.aoMapIntensity.value=A.aoMapIntensity,t(A.aoMap,v.aoMapTransform))}function a(v,A){v.diffuse.value.copy(A.color),v.opacity.value=A.opacity,A.map&&(v.map.value=A.map,t(A.map,v.mapTransform))}function o(v,A){v.dashSize.value=A.dashSize,v.totalSize.value=A.dashSize+A.gapSize,v.scale.value=A.scale}function l(v,A,_,x){v.diffuse.value.copy(A.color),v.opacity.value=A.opacity,v.size.value=A.size*_,v.scale.value=x*.5,A.map&&(v.map.value=A.map,t(A.map,v.uvTransform)),A.alphaMap&&(v.alphaMap.value=A.alphaMap,t(A.alphaMap,v.alphaMapTransform)),A.alphaTest>0&&(v.alphaTest.value=A.alphaTest)}function c(v,A){v.diffuse.value.copy(A.color),v.opacity.value=A.opacity,v.rotation.value=A.rotation,A.map&&(v.map.value=A.map,t(A.map,v.mapTransform)),A.alphaMap&&(v.alphaMap.value=A.alphaMap,t(A.alphaMap,v.alphaMapTransform)),A.alphaTest>0&&(v.alphaTest.value=A.alphaTest)}function u(v,A){v.specular.value.copy(A.specular),v.shininess.value=Math.max(A.shininess,1e-4)}function h(v,A){A.gradientMap&&(v.gradientMap.value=A.gradientMap)}function f(v,A){v.metalness.value=A.metalness,A.metalnessMap&&(v.metalnessMap.value=A.metalnessMap,t(A.metalnessMap,v.metalnessMapTransform)),v.roughness.value=A.roughness,A.roughnessMap&&(v.roughnessMap.value=A.roughnessMap,t(A.roughnessMap,v.roughnessMapTransform)),e.get(A).envMap&&(v.envMapIntensity.value=A.envMapIntensity)}function p(v,A,_){v.ior.value=A.ior,A.sheen>0&&(v.sheenColor.value.copy(A.sheenColor).multiplyScalar(A.sheen),v.sheenRoughness.value=A.sheenRoughness,A.sheenColorMap&&(v.sheenColorMap.value=A.sheenColorMap,t(A.sheenColorMap,v.sheenColorMapTransform)),A.sheenRoughnessMap&&(v.sheenRoughnessMap.value=A.sheenRoughnessMap,t(A.sheenRoughnessMap,v.sheenRoughnessMapTransform))),A.clearcoat>0&&(v.clearcoat.value=A.clearcoat,v.clearcoatRoughness.value=A.clearcoatRoughness,A.clearcoatMap&&(v.clearcoatMap.value=A.clearcoatMap,t(A.clearcoatMap,v.clearcoatMapTransform)),A.clearcoatRoughnessMap&&(v.clearcoatRoughnessMap.value=A.clearcoatRoughnessMap,t(A.clearcoatRoughnessMap,v.clearcoatRoughnessMapTransform)),A.clearcoatNormalMap&&(v.clearcoatNormalMap.value=A.clearcoatNormalMap,t(A.clearcoatNormalMap,v.clearcoatNormalMapTransform),v.clearcoatNormalScale.value.copy(A.clearcoatNormalScale),A.side===Ki&&v.clearcoatNormalScale.value.negate())),A.iridescence>0&&(v.iridescence.value=A.iridescence,v.iridescenceIOR.value=A.iridescenceIOR,v.iridescenceThicknessMinimum.value=A.iridescenceThicknessRange[0],v.iridescenceThicknessMaximum.value=A.iridescenceThicknessRange[1],A.iridescenceMap&&(v.iridescenceMap.value=A.iridescenceMap,t(A.iridescenceMap,v.iridescenceMapTransform)),A.iridescenceThicknessMap&&(v.iridescenceThicknessMap.value=A.iridescenceThicknessMap,t(A.iridescenceThicknessMap,v.iridescenceThicknessMapTransform))),A.transmission>0&&(v.transmission.value=A.transmission,v.transmissionSamplerMap.value=_.texture,v.transmissionSamplerSize.value.set(_.width,_.height),A.transmissionMap&&(v.transmissionMap.value=A.transmissionMap,t(A.transmissionMap,v.transmissionMapTransform)),v.thickness.value=A.thickness,A.thicknessMap&&(v.thicknessMap.value=A.thicknessMap,t(A.thicknessMap,v.thicknessMapTransform)),v.attenuationDistance.value=A.attenuationDistance,v.attenuationColor.value.copy(A.attenuationColor)),A.anisotropy>0&&(v.anisotropyVector.value.set(A.anisotropy*Math.cos(A.anisotropyRotation),A.anisotropy*Math.sin(A.anisotropyRotation)),A.anisotropyMap&&(v.anisotropyMap.value=A.anisotropyMap,t(A.anisotropyMap,v.anisotropyMapTransform))),v.specularIntensity.value=A.specularIntensity,v.specularColor.value.copy(A.specularColor),A.specularColorMap&&(v.specularColorMap.value=A.specularColorMap,t(A.specularColorMap,v.specularColorMapTransform)),A.specularIntensityMap&&(v.specularIntensityMap.value=A.specularIntensityMap,t(A.specularIntensityMap,v.specularIntensityMapTransform))}function m(v,A){A.matcap&&(v.matcap.value=A.matcap)}function y(v,A){const _=e.get(A).light;v.referencePosition.value.setFromMatrixPosition(_.matrixWorld),v.nearDistance.value=_.shadow.camera.near,v.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function iN(n,e,t,i){let r={},s={},a=[];const o=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(_,x){const E=x.program;i.uniformBlockBinding(_,E)}function c(_,x){let E=r[_.id];E===void 0&&(m(_),E=u(_),r[_.id]=E,_.addEventListener("dispose",v));const w=x.program;i.updateUBOMapping(_,w);const I=e.render.frame;s[_.id]!==I&&(f(_),s[_.id]=I)}function u(_){const x=h();_.__bindingPointIndex=x;const E=n.createBuffer(),w=_.__size,I=_.usage;return n.bindBuffer(n.UNIFORM_BUFFER,E),n.bufferData(n.UNIFORM_BUFFER,w,I),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,x,E),E}function h(){for(let _=0;_<o;_++)if(a.indexOf(_)===-1)return a.push(_),_;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(_){const x=r[_.id],E=_.uniforms,w=_.__cache;n.bindBuffer(n.UNIFORM_BUFFER,x);for(let I=0,T=E.length;I<T;I++){const M=E[I];if(p(M,I,w)===!0){const b=M.__offset,B=Array.isArray(M.value)?M.value:[M.value];let L=0;for(let U=0;U<B.length;U++){const O=B[U],Q=y(O);typeof O=="number"?(M.__data[0]=O,n.bufferSubData(n.UNIFORM_BUFFER,b+L,M.__data)):O.isMatrix3?(M.__data[0]=O.elements[0],M.__data[1]=O.elements[1],M.__data[2]=O.elements[2],M.__data[3]=O.elements[0],M.__data[4]=O.elements[3],M.__data[5]=O.elements[4],M.__data[6]=O.elements[5],M.__data[7]=O.elements[0],M.__data[8]=O.elements[6],M.__data[9]=O.elements[7],M.__data[10]=O.elements[8],M.__data[11]=O.elements[0]):(O.toArray(M.__data,L),L+=Q.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,b,M.__data)}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function p(_,x,E){const w=_.value;if(E[x]===void 0){if(typeof w=="number")E[x]=w;else{const I=Array.isArray(w)?w:[w],T=[];for(let M=0;M<I.length;M++)T.push(I[M].clone());E[x]=T}return!0}else if(typeof w=="number"){if(E[x]!==w)return E[x]=w,!0}else{const I=Array.isArray(E[x])?E[x]:[E[x]],T=Array.isArray(w)?w:[w];for(let M=0;M<I.length;M++){const b=I[M];if(b.equals(T[M])===!1)return b.copy(T[M]),!0}}return!1}function m(_){const x=_.uniforms;let E=0;const w=16;let I=0;for(let T=0,M=x.length;T<M;T++){const b=x[T],B={boundary:0,storage:0},L=Array.isArray(b.value)?b.value:[b.value];for(let U=0,O=L.length;U<O;U++){const Q=L[U],G=y(Q);B.boundary+=G.boundary,B.storage+=G.storage}if(b.__data=new Float32Array(B.storage/Float32Array.BYTES_PER_ELEMENT),b.__offset=E,T>0){I=E%w;const U=w-I;I!==0&&U-B.boundary<0&&(E+=w-I,b.__offset=E)}E+=B.storage}return I=E%w,I>0&&(E+=w-I),_.__size=E,_.__cache={},this}function y(_){const x={boundary:0,storage:0};return typeof _=="number"?(x.boundary=4,x.storage=4):_.isVector2?(x.boundary=8,x.storage=8):_.isVector3||_.isColor?(x.boundary=16,x.storage=12):_.isVector4?(x.boundary=16,x.storage=16):_.isMatrix3?(x.boundary=48,x.storage=48):_.isMatrix4?(x.boundary=64,x.storage=64):_.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",_),x}function v(_){const x=_.target;x.removeEventListener("dispose",v);const E=a.indexOf(x.__bindingPointIndex);a.splice(E,1),n.deleteBuffer(r[x.id]),delete r[x.id],delete s[x.id]}function A(){for(const _ in r)n.deleteBuffer(r[_]);a=[],r={},s={}}return{bind:l,update:c,dispose:A}}function rN(){const n=Rp("canvas");return n.style.display="block",n}class U6{constructor(e={}){const{canvas:t=rN(),context:i=null,depth:r=!0,stencil:s=!0,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let f;i!==null?f=i.getContextAttributes().alpha:f=a;const p=new Uint32Array(4),m=new Int32Array(4);let y=null,v=null;const A=[],_=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputColorSpace=Nt,this.useLegacyLights=!0,this.toneMapping=os,this.toneMappingExposure=1;const x=this;let E=!1,w=0,I=0,T=null,M=-1,b=null;const B=new jt,L=new jt;let U=null;const O=new He(0);let Q=0,G=t.width,F=t.height,q=1,Y=null,H=null;const V=new jt(0,0,G,F),D=new jt(0,0,G,F);let k=!1;const Z=new c0;let j=!1,ee=!1,ie=null;const te=new ct,re=new _e,ce=new N,ye={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function oe(){return T===null?q:1}let W=i;function ge(K,Ae){for(let Ie=0;Ie<K.length;Ie++){const de=K[Ie],Me=t.getContext(de,Ae);if(Me!==null)return Me}return null}try{const K={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Wl}`),t.addEventListener("webglcontextlost",Fe,!1),t.addEventListener("webglcontextrestored",me,!1),t.addEventListener("webglcontextcreationerror",Qe,!1),W===null){const Ae=["webgl2","webgl","experimental-webgl"];if(x.isWebGL1Renderer===!0&&Ae.shift(),W=ge(Ae,K),W===null)throw ge(Ae)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext<"u"&&W instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),W.getShaderPrecisionFormat===void 0&&(W.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(K){throw console.error("THREE.WebGLRenderer: "+K.message),K}let he,ue,fe,Pe,pe,Re,Le,Se,$e,X,z,se,Be,Ce,we,ke,Ue,xe,ze,je,We,Oe,Ve,it;function gt(){he=new yF(W),ue=new dF(W,he,e),he.init(ue),Oe=new rT(W,he,ue),fe=new Jk(W,he,ue),Pe=new EF(W),pe=new Gk,Re=new Zk(W,he,fe,pe,ue,Oe,Pe),Le=new gF(x),Se=new vF(x),$e=new DL(W,ue),Ve=new hF(W,he,$e,ue),X=new xF(W,$e,Pe,Ve),z=new TF(W,X,$e,Pe),ze=new CF(W,ue,Re),ke=new pF(pe),se=new Nk(x,Le,Se,he,ue,Ve,ke),Be=new nN(x,pe),Ce=new Qk,we=new Xk(he,ue),xe=new uF(x,Le,Se,fe,z,f,l),Ue=new $k(x,z,ue),it=new iN(W,Pe,ue,fe),je=new fF(W,he,Pe,ue),We=new _F(W,he,Pe,ue),Pe.programs=se.programs,x.capabilities=ue,x.extensions=he,x.properties=pe,x.renderLists=Ce,x.shadowMap=Ue,x.state=fe,x.info=Pe}gt();const ne=new tN(x,W);this.xr=ne,this.getContext=function(){return W},this.getContextAttributes=function(){return W.getContextAttributes()},this.forceContextLoss=function(){const K=he.get("WEBGL_lose_context");K&&K.loseContext()},this.forceContextRestore=function(){const K=he.get("WEBGL_lose_context");K&&K.restoreContext()},this.getPixelRatio=function(){return q},this.setPixelRatio=function(K){K!==void 0&&(q=K,this.setSize(G,F,!1))},this.getSize=function(K){return K.set(G,F)},this.setSize=function(K,Ae,Ie=!0){if(ne.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}G=K,F=Ae,t.width=Math.floor(K*q),t.height=Math.floor(Ae*q),Ie===!0&&(t.style.width=K+"px",t.style.height=Ae+"px"),this.setViewport(0,0,K,Ae)},this.getDrawingBufferSize=function(K){return K.set(G*q,F*q).floor()},this.setDrawingBufferSize=function(K,Ae,Ie){G=K,F=Ae,q=Ie,t.width=Math.floor(K*Ie),t.height=Math.floor(Ae*Ie),this.setViewport(0,0,K,Ae)},this.getCurrentViewport=function(K){return K.copy(B)},this.getViewport=function(K){return K.copy(V)},this.setViewport=function(K,Ae,Ie,de){K.isVector4?V.set(K.x,K.y,K.z,K.w):V.set(K,Ae,Ie,de),fe.viewport(B.copy(V).multiplyScalar(q).floor())},this.getScissor=function(K){return K.copy(D)},this.setScissor=function(K,Ae,Ie,de){K.isVector4?D.set(K.x,K.y,K.z,K.w):D.set(K,Ae,Ie,de),fe.scissor(L.copy(D).multiplyScalar(q).floor())},this.getScissorTest=function(){return k},this.setScissorTest=function(K){fe.setScissorTest(k=K)},this.setOpaqueSort=function(K){Y=K},this.setTransparentSort=function(K){H=K},this.getClearColor=function(K){return K.copy(xe.getClearColor())},this.setClearColor=function(){xe.setClearColor.apply(xe,arguments)},this.getClearAlpha=function(){return xe.getClearAlpha()},this.setClearAlpha=function(){xe.setClearAlpha.apply(xe,arguments)},this.clear=function(K=!0,Ae=!0,Ie=!0){let de=0;if(K){let Me=!1;if(T!==null){const rt=T.texture.format;Me=rt===T6||rt===C6||rt===w6}if(Me){const rt=T.texture.type,mt=rt===Ri||rt===Oo||rt===Au||rt===ko||rt===_6||rt===E6,At=xe.getClearColor(),Et=xe.getClearAlpha(),Ut=At.r,Ge=At.g,vt=At.b;mt?(p[0]=Ut,p[1]=Ge,p[2]=vt,p[3]=Et,W.clearBufferuiv(W.COLOR,0,p)):(m[0]=Ut,m[1]=Ge,m[2]=vt,m[3]=Et,W.clearBufferiv(W.COLOR,0,m))}else de|=W.COLOR_BUFFER_BIT}Ae&&(de|=W.DEPTH_BUFFER_BIT),Ie&&(de|=W.STENCIL_BUFFER_BIT),W.clear(de)},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",Fe,!1),t.removeEventListener("webglcontextrestored",me,!1),t.removeEventListener("webglcontextcreationerror",Qe,!1),Ce.dispose(),we.dispose(),pe.dispose(),Le.dispose(),Se.dispose(),z.dispose(),Ve.dispose(),it.dispose(),se.dispose(),ne.dispose(),ne.removeEventListener("sessionstart",dn),ne.removeEventListener("sessionend",Zt),ie&&(ie.dispose(),ie=null),Ht.stop()};function Fe(K){K.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),E=!0}function me(){console.log("THREE.WebGLRenderer: Context Restored."),E=!1;const K=Pe.autoReset,Ae=Ue.enabled,Ie=Ue.autoUpdate,de=Ue.needsUpdate,Me=Ue.type;gt(),Pe.autoReset=K,Ue.enabled=Ae,Ue.autoUpdate=Ie,Ue.needsUpdate=de,Ue.type=Me}function Qe(K){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",K.statusMessage)}function Xe(K){const Ae=K.target;Ae.removeEventListener("dispose",Xe),Dt(Ae)}function Dt(K){Yt(K),pe.remove(K)}function Yt(K){const Ae=pe.get(K).programs;Ae!==void 0&&(Ae.forEach(function(Ie){se.releaseProgram(Ie)}),K.isShaderMaterial&&se.releaseShaderCache(K))}this.renderBufferDirect=function(K,Ae,Ie,de,Me,rt){Ae===null&&(Ae=ye);const mt=Me.isMesh&&Me.matrixWorld.determinant()<0,At=wi(K,Ae,Ie,de,Me);fe.setMaterial(de,mt);let Et=Ie.index,Ut=1;de.wireframe===!0&&(Et=X.getWireframeAttribute(Ie),Ut=2);const Ge=Ie.drawRange,vt=Ie.attributes.position;let wn=Ge.start*Ut,ln=(Ge.start+Ge.count)*Ut;rt!==null&&(wn=Math.max(wn,rt.start*Ut),ln=Math.min(ln,(rt.start+rt.count)*Ut)),Et!==null?(wn=Math.max(wn,0),ln=Math.min(ln,Et.count)):vt!=null&&(wn=Math.max(wn,0),ln=Math.min(ln,vt.count));const Oi=ln-wn;if(Oi<0||Oi===1/0)return;Ve.setup(Me,de,At,Ie,Et);let er,pn=je;if(Et!==null&&(er=$e.get(Et),pn=We,pn.setIndex(er)),Me.isMesh)de.wireframe===!0?(fe.setLineWidth(de.wireframeLinewidth*oe()),pn.setMode(W.LINES)):pn.setMode(W.TRIANGLES);else if(Me.isLine){let Ct=de.linewidth;Ct===void 0&&(Ct=1),fe.setLineWidth(Ct*oe()),Me.isLineSegments?pn.setMode(W.LINES):Me.isLineLoop?pn.setMode(W.LINE_LOOP):pn.setMode(W.LINE_STRIP)}else Me.isPoints?pn.setMode(W.POINTS):Me.isSprite&&pn.setMode(W.TRIANGLES);if(Me.isInstancedMesh)pn.renderInstances(wn,Oi,Me.count);else if(Ie.isInstancedBufferGeometry){const Ct=Ie._maxInstanceCount!==void 0?Ie._maxInstanceCount:1/0,tn=Math.min(Ie.instanceCount,Ct);pn.renderInstances(wn,Oi,tn)}else pn.render(wn,Oi)},this.compile=function(K,Ae){function Ie(de,Me,rt){de.transparent===!0&&de.side===$n&&de.forceSinglePass===!1?(de.side=Ki,de.needsUpdate=!0,Mn(de,Me,rt),de.side=$a,de.needsUpdate=!0,Mn(de,Me,rt),de.side=$n):Mn(de,Me,rt)}v=we.get(K),v.init(),_.push(v),K.traverseVisible(function(de){de.isLight&&de.layers.test(Ae.layers)&&(v.pushLight(de),de.castShadow&&v.pushShadow(de))}),v.setupLights(x.useLegacyLights),K.traverse(function(de){const Me=de.material;if(Me)if(Array.isArray(Me))for(let rt=0;rt<Me.length;rt++){const mt=Me[rt];Ie(mt,K,de)}else Ie(Me,K,de)}),_.pop(),v=null};let en=null;function Jt(K){en&&en(K)}function dn(){Ht.stop()}function Zt(){Ht.start()}const Ht=new ZC;Ht.setAnimationLoop(Jt),typeof self<"u"&&Ht.setContext(self),this.setAnimationLoop=function(K){en=K,ne.setAnimationLoop(K),K===null?Ht.stop():Ht.start()},ne.addEventListener("sessionstart",dn),ne.addEventListener("sessionend",Zt),this.render=function(K,Ae){if(Ae!==void 0&&Ae.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(E===!0)return;K.matrixWorldAutoUpdate===!0&&K.updateMatrixWorld(),Ae.parent===null&&Ae.matrixWorldAutoUpdate===!0&&Ae.updateMatrixWorld(),ne.enabled===!0&&ne.isPresenting===!0&&(ne.cameraAutoUpdate===!0&&ne.updateCamera(Ae),Ae=ne.getCamera()),K.isScene===!0&&K.onBeforeRender(x,K,Ae,T),v=we.get(K,_.length),v.init(),_.push(v),te.multiplyMatrices(Ae.projectionMatrix,Ae.matrixWorldInverse),Z.setFromProjectionMatrix(te),ee=this.localClippingEnabled,j=ke.init(this.clippingPlanes,ee),y=Ce.get(K,A.length),y.init(),A.push(y),Zi(K,Ae,0,x.sortObjects),y.finish(),x.sortObjects===!0&&y.sort(Y,H),this.info.render.frame++,j===!0&&ke.beginShadows();const Ie=v.state.shadowsArray;if(Ue.render(Ie,K,Ae),j===!0&&ke.endShadows(),this.info.autoReset===!0&&this.info.reset(),xe.render(y,K),v.setupLights(x.useLegacyLights),Ae.isArrayCamera){const de=Ae.cameras;for(let Me=0,rt=de.length;Me<rt;Me++){const mt=de[Me];Ui(y,K,mt,mt.viewport)}}else Ui(y,K,Ae);T!==null&&(Re.updateMultisampleRenderTarget(T),Re.updateRenderTargetMipmap(T)),K.isScene===!0&&K.onAfterRender(x,K,Ae),Ve.resetDefaultState(),M=-1,b=null,_.pop(),_.length>0?v=_[_.length-1]:v=null,A.pop(),A.length>0?y=A[A.length-1]:y=null};function Zi(K,Ae,Ie,de){if(K.visible===!1)return;if(K.layers.test(Ae.layers)){if(K.isGroup)Ie=K.renderOrder;else if(K.isLOD)K.autoUpdate===!0&&K.update(Ae);else if(K.isLight)v.pushLight(K),K.castShadow&&v.pushShadow(K);else if(K.isSprite){if(!K.frustumCulled||Z.intersectsSprite(K)){de&&ce.setFromMatrixPosition(K.matrixWorld).applyMatrix4(te);const mt=z.update(K),At=K.material;At.visible&&y.push(K,mt,At,Ie,ce.z,null)}}else if((K.isMesh||K.isLine||K.isPoints)&&(!K.frustumCulled||Z.intersectsObject(K))){const mt=z.update(K),At=K.material;if(de&&(K.boundingSphere!==void 0?(K.boundingSphere===null&&K.computeBoundingSphere(),ce.copy(K.boundingSphere.center)):(mt.boundingSphere===null&&mt.computeBoundingSphere(),ce.copy(mt.boundingSphere.center)),ce.applyMatrix4(K.matrixWorld).applyMatrix4(te)),Array.isArray(At)){const Et=mt.groups;for(let Ut=0,Ge=Et.length;Ut<Ge;Ut++){const vt=Et[Ut],wn=At[vt.materialIndex];wn&&wn.visible&&y.push(K,mt,wn,Ie,ce.z,vt)}}else At.visible&&y.push(K,mt,At,Ie,ce.z,null)}}const rt=K.children;for(let mt=0,At=rt.length;mt<At;mt++)Zi(rt[mt],Ae,Ie,de)}function Ui(K,Ae,Ie,de){const Me=K.opaque,rt=K.transmissive,mt=K.transparent;v.setupLightsView(Ie),j===!0&&ke.setGlobalState(x.clippingPlanes,Ie),rt.length>0&&on(Me,rt,Ae,Ie),de&&fe.viewport(B.copy(de)),Me.length>0&&Pn(Me,Ae,Ie),rt.length>0&&Pn(rt,Ae,Ie),mt.length>0&&Pn(mt,Ae,Ie),fe.buffers.depth.setTest(!0),fe.buffers.depth.setMask(!0),fe.buffers.color.setMask(!0),fe.setPolygonOffset(!1)}function on(K,Ae,Ie,de){const Me=ue.isWebGL2;ie===null&&(ie=new Dn(1,1,{generateMipmaps:!0,type:he.has("EXT_color_buffer_half_float")?Ai:Ri,minFilter:Ja,samples:Me?4:0})),x.getDrawingBufferSize(re),Me?ie.setSize(re.x,re.y):ie.setSize(Pm(re.x),Pm(re.y));const rt=x.getRenderTarget();x.setRenderTarget(ie),x.getClearColor(O),Q=x.getClearAlpha(),Q<1&&x.setClearColor(16777215,.5),x.clear();const mt=x.toneMapping;x.toneMapping=os,Pn(K,Ie,de),Re.updateMultisampleRenderTarget(ie),Re.updateRenderTargetMipmap(ie);let At=!1;for(let Et=0,Ut=Ae.length;Et<Ut;Et++){const Ge=Ae[Et],vt=Ge.object,wn=Ge.geometry,ln=Ge.material,Oi=Ge.group;if(ln.side===$n&&vt.layers.test(de.layers)){const er=ln.side;ln.side=Ki,ln.needsUpdate=!0,Wi(vt,Ie,de,wn,ln,Oi),ln.side=er,ln.needsUpdate=!0,At=!0}}At===!0&&(Re.updateMultisampleRenderTarget(ie),Re.updateRenderTargetMipmap(ie)),x.setRenderTarget(rt),x.setClearColor(O,Q),x.toneMapping=mt}function Pn(K,Ae,Ie){const de=Ae.isScene===!0?Ae.overrideMaterial:null;for(let Me=0,rt=K.length;Me<rt;Me++){const mt=K[Me],At=mt.object,Et=mt.geometry,Ut=de===null?mt.material:de,Ge=mt.group;At.layers.test(Ie.layers)&&Wi(At,Ae,Ie,Et,Ut,Ge)}}function Wi(K,Ae,Ie,de,Me,rt){K.onBeforeRender(x,Ae,Ie,de,Me,rt),K.modelViewMatrix.multiplyMatrices(Ie.matrixWorldInverse,K.matrixWorld),K.normalMatrix.getNormalMatrix(K.modelViewMatrix),Me.onBeforeRender(x,Ae,Ie,de,K,rt),Me.transparent===!0&&Me.side===$n&&Me.forceSinglePass===!1?(Me.side=Ki,Me.needsUpdate=!0,x.renderBufferDirect(Ie,Ae,de,Me,K,rt),Me.side=$a,Me.needsUpdate=!0,x.renderBufferDirect(Ie,Ae,de,Me,K,rt),Me.side=$n):x.renderBufferDirect(Ie,Ae,de,Me,K,rt),K.onAfterRender(x,Ae,Ie,de,Me,rt)}function Mn(K,Ae,Ie){Ae.isScene!==!0&&(Ae=ye);const de=pe.get(K),Me=v.state.lights,rt=v.state.shadowsArray,mt=Me.state.version,At=se.getParameters(K,Me.state,rt,Ae,Ie),Et=se.getProgramCacheKey(At);let Ut=de.programs;de.environment=K.isMeshStandardMaterial?Ae.environment:null,de.fog=Ae.fog,de.envMap=(K.isMeshStandardMaterial?Se:Le).get(K.envMap||de.environment),Ut===void 0&&(K.addEventListener("dispose",Xe),Ut=new Map,de.programs=Ut);let Ge=Ut.get(Et);if(Ge!==void 0){if(de.currentProgram===Ge&&de.lightsStateVersion===mt)return Wn(K,At),Ge}else At.uniforms=se.getUniforms(K),K.onBuild(Ie,At,x),K.onBeforeCompile(At,x),Ge=se.acquireProgram(At,Et),Ut.set(Et,Ge),de.uniforms=At.uniforms;const vt=de.uniforms;(!K.isShaderMaterial&&!K.isRawShaderMaterial||K.clipping===!0)&&(vt.clippingPlanes=ke.uniform),Wn(K,At),de.needsLights=fr(K),de.lightsStateVersion=mt,de.needsLights&&(vt.ambientLightColor.value=Me.state.ambient,vt.lightProbe.value=Me.state.probe,vt.directionalLights.value=Me.state.directional,vt.directionalLightShadows.value=Me.state.directionalShadow,vt.spotLights.value=Me.state.spot,vt.spotLightShadows.value=Me.state.spotShadow,vt.rectAreaLights.value=Me.state.rectArea,vt.ltc_1.value=Me.state.rectAreaLTC1,vt.ltc_2.value=Me.state.rectAreaLTC2,vt.pointLights.value=Me.state.point,vt.pointLightShadows.value=Me.state.pointShadow,vt.hemisphereLights.value=Me.state.hemi,vt.directionalShadowMap.value=Me.state.directionalShadowMap,vt.directionalShadowMatrix.value=Me.state.directionalShadowMatrix,vt.spotShadowMap.value=Me.state.spotShadowMap,vt.spotLightMatrix.value=Me.state.spotLightMatrix,vt.spotLightMap.value=Me.state.spotLightMap,vt.pointShadowMap.value=Me.state.pointShadowMap,vt.pointShadowMatrix.value=Me.state.pointShadowMatrix);const wn=Ge.getUniforms(),ln=dm.seqWithValue(wn.seq,vt);return de.currentProgram=Ge,de.uniformsList=ln,Ge}function Wn(K,Ae){const Ie=pe.get(K);Ie.outputColorSpace=Ae.outputColorSpace,Ie.instancing=Ae.instancing,Ie.skinning=Ae.skinning,Ie.morphTargets=Ae.morphTargets,Ie.morphNormals=Ae.morphNormals,Ie.morphColors=Ae.morphColors,Ie.morphTargetsCount=Ae.morphTargetsCount,Ie.numClippingPlanes=Ae.numClippingPlanes,Ie.numIntersection=Ae.numClipIntersection,Ie.vertexAlphas=Ae.vertexAlphas,Ie.vertexTangents=Ae.vertexTangents,Ie.toneMapping=Ae.toneMapping}function wi(K,Ae,Ie,de,Me){Ae.isScene!==!0&&(Ae=ye),Re.resetTextureUnits();const rt=Ae.fog,mt=de.isMeshStandardMaterial?Ae.environment:null,At=T===null?x.outputColorSpace:T.isXRRenderTarget===!0?T.texture.colorSpace:fa,Et=(de.isMeshStandardMaterial?Se:Le).get(de.envMap||mt),Ut=de.vertexColors===!0&&!!Ie.attributes.color&&Ie.attributes.color.itemSize===4,Ge=!!Ie.attributes.tangent&&(!!de.normalMap||de.anisotropy>0),vt=!!Ie.morphAttributes.position,wn=!!Ie.morphAttributes.normal,ln=!!Ie.morphAttributes.color,Oi=de.toneMapped?x.toneMapping:os,er=Ie.morphAttributes.position||Ie.morphAttributes.normal||Ie.morphAttributes.color,pn=er!==void 0?er.length:0,Ct=pe.get(de),tn=v.state.lights;if(j===!0&&(ee===!0||K!==b)){const yi=K===b&&de.id===M;ke.setState(de,K,yi)}let Tt=!1;de.version===Ct.__version?(Ct.needsLights&&Ct.lightsStateVersion!==tn.state.version||Ct.outputColorSpace!==At||Me.isInstancedMesh&&Ct.instancing===!1||!Me.isInstancedMesh&&Ct.instancing===!0||Me.isSkinnedMesh&&Ct.skinning===!1||!Me.isSkinnedMesh&&Ct.skinning===!0||Ct.envMap!==Et||de.fog===!0&&Ct.fog!==rt||Ct.numClippingPlanes!==void 0&&(Ct.numClippingPlanes!==ke.numPlanes||Ct.numIntersection!==ke.numIntersection)||Ct.vertexAlphas!==Ut||Ct.vertexTangents!==Ge||Ct.morphTargets!==vt||Ct.morphNormals!==wn||Ct.morphColors!==ln||Ct.toneMapping!==Oi||ue.isWebGL2===!0&&Ct.morphTargetsCount!==pn)&&(Tt=!0):(Tt=!0,Ct.__version=de.version);let hi=Ct.currentProgram;Tt===!0&&(hi=Mn(de,Ae,Me));let ti=!1,Gn=!1,Lr=!1;const Cn=hi.getUniforms(),Ln=Ct.uniforms;if(fe.useProgram(hi.program)&&(ti=!0,Gn=!0,Lr=!0),de.id!==M&&(M=de.id,Gn=!0),ti||b!==K){if(Cn.setValue(W,"projectionMatrix",K.projectionMatrix),ue.logarithmicDepthBuffer&&Cn.setValue(W,"logDepthBufFC",2/(Math.log(K.far+1)/Math.LN2)),b!==K&&(b=K,Gn=!0,Lr=!0),de.isShaderMaterial||de.isMeshPhongMaterial||de.isMeshToonMaterial||de.isMeshStandardMaterial||de.envMap){const yi=Cn.map.cameraPosition;yi!==void 0&&yi.setValue(W,ce.setFromMatrixPosition(K.matrixWorld))}(de.isMeshPhongMaterial||de.isMeshToonMaterial||de.isMeshLambertMaterial||de.isMeshBasicMaterial||de.isMeshStandardMaterial||de.isShaderMaterial)&&Cn.setValue(W,"isOrthographic",K.isOrthographicCamera===!0),(de.isMeshPhongMaterial||de.isMeshToonMaterial||de.isMeshLambertMaterial||de.isMeshBasicMaterial||de.isMeshStandardMaterial||de.isShaderMaterial||de.isShadowMaterial||Me.isSkinnedMesh)&&Cn.setValue(W,"viewMatrix",K.matrixWorldInverse)}if(Me.isSkinnedMesh){Cn.setOptional(W,Me,"bindMatrix"),Cn.setOptional(W,Me,"bindMatrixInverse");const yi=Me.skeleton;yi&&(ue.floatVertexTextures?(yi.boneTexture===null&&yi.computeBoneTexture(),Cn.setValue(W,"boneTexture",yi.boneTexture,Re),Cn.setValue(W,"boneTextureSize",yi.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const dr=Ie.morphAttributes;if((dr.position!==void 0||dr.normal!==void 0||dr.color!==void 0&&ue.isWebGL2===!0)&&ze.update(Me,Ie,hi),(Gn||Ct.receiveShadow!==Me.receiveShadow)&&(Ct.receiveShadow=Me.receiveShadow,Cn.setValue(W,"receiveShadow",Me.receiveShadow)),de.isMeshGouraudMaterial&&de.envMap!==null&&(Ln.envMap.value=Et,Ln.flipEnvMap.value=Et.isCubeTexture&&Et.isRenderTargetTexture===!1?-1:1),Gn&&(Cn.setValue(W,"toneMappingExposure",x.toneMappingExposure),Ct.needsLights&&ys(Ln,Lr),rt&&de.fog===!0&&Be.refreshFogUniforms(Ln,rt),Be.refreshMaterialUniforms(Ln,de,q,F,ie),dm.upload(W,Ct.uniformsList,Ln,Re)),de.isShaderMaterial&&de.uniformsNeedUpdate===!0&&(dm.upload(W,Ct.uniformsList,Ln,Re),de.uniformsNeedUpdate=!1),de.isSpriteMaterial&&Cn.setValue(W,"center",Me.center),Cn.setValue(W,"modelViewMatrix",Me.modelViewMatrix),Cn.setValue(W,"normalMatrix",Me.normalMatrix),Cn.setValue(W,"modelMatrix",Me.matrixWorld),de.isShaderMaterial||de.isRawShaderMaterial){const yi=de.uniformsGroups;for(let wa=0,Ca=yi.length;wa<Ca;wa++)if(ue.isWebGL2){const tr=yi[wa];it.update(tr,hi),it.bind(tr,hi)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return hi}function ys(K,Ae){K.ambientLightColor.needsUpdate=Ae,K.lightProbe.needsUpdate=Ae,K.directionalLights.needsUpdate=Ae,K.directionalLightShadows.needsUpdate=Ae,K.pointLights.needsUpdate=Ae,K.pointLightShadows.needsUpdate=Ae,K.spotLights.needsUpdate=Ae,K.spotLightShadows.needsUpdate=Ae,K.rectAreaLights.needsUpdate=Ae,K.hemisphereLights.needsUpdate=Ae}function fr(K){return K.isMeshLambertMaterial||K.isMeshToonMaterial||K.isMeshPhongMaterial||K.isMeshStandardMaterial||K.isShadowMaterial||K.isShaderMaterial&&K.lights===!0}this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return I},this.getRenderTarget=function(){return T},this.setRenderTargetTextures=function(K,Ae,Ie){pe.get(K.texture).__webglTexture=Ae,pe.get(K.depthTexture).__webglTexture=Ie;const de=pe.get(K);de.__hasExternalTextures=!0,de.__hasExternalTextures&&(de.__autoAllocateDepthBuffer=Ie===void 0,de.__autoAllocateDepthBuffer||he.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),de.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(K,Ae){const Ie=pe.get(K);Ie.__webglFramebuffer=Ae,Ie.__useDefaultFramebuffer=Ae===void 0},this.setRenderTarget=function(K,Ae=0,Ie=0){T=K,w=Ae,I=Ie;let de=!0,Me=null,rt=!1,mt=!1;if(K){const Et=pe.get(K);Et.__useDefaultFramebuffer!==void 0?(fe.bindFramebuffer(W.FRAMEBUFFER,null),de=!1):Et.__webglFramebuffer===void 0?Re.setupRenderTarget(K):Et.__hasExternalTextures&&Re.rebindTextures(K,pe.get(K.texture).__webglTexture,pe.get(K.depthTexture).__webglTexture);const Ut=K.texture;(Ut.isData3DTexture||Ut.isDataArrayTexture||Ut.isCompressedArrayTexture)&&(mt=!0);const Ge=pe.get(K).__webglFramebuffer;K.isWebGLCubeRenderTarget?(Me=Ge[Ae],rt=!0):ue.isWebGL2&&K.samples>0&&Re.useMultisampledRTT(K)===!1?Me=pe.get(K).__webglMultisampledFramebuffer:Me=Ge,B.copy(K.viewport),L.copy(K.scissor),U=K.scissorTest}else B.copy(V).multiplyScalar(q).floor(),L.copy(D).multiplyScalar(q).floor(),U=k;if(fe.bindFramebuffer(W.FRAMEBUFFER,Me)&&ue.drawBuffers&&de&&fe.drawBuffers(K,Me),fe.viewport(B),fe.scissor(L),fe.setScissorTest(U),rt){const Et=pe.get(K.texture);W.framebufferTexture2D(W.FRAMEBUFFER,W.COLOR_ATTACHMENT0,W.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,Et.__webglTexture,Ie)}else if(mt){const Et=pe.get(K.texture),Ut=Ae||0;W.framebufferTextureLayer(W.FRAMEBUFFER,W.COLOR_ATTACHMENT0,Et.__webglTexture,Ie||0,Ut)}M=-1},this.readRenderTargetPixels=function(K,Ae,Ie,de,Me,rt,mt){if(!(K&&K.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let At=pe.get(K).__webglFramebuffer;if(K.isWebGLCubeRenderTarget&&mt!==void 0&&(At=At[mt]),At){fe.bindFramebuffer(W.FRAMEBUFFER,At);try{const Et=K.texture,Ut=Et.format,Ge=Et.type;if(Ut!==li&&Oe.convert(Ut)!==W.getParameter(W.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const vt=Ge===Ai&&(he.has("EXT_color_buffer_half_float")||ue.isWebGL2&&he.has("EXT_color_buffer_float"));if(Ge!==Ri&&Oe.convert(Ge)!==W.getParameter(W.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ge===br&&(ue.isWebGL2||he.has("OES_texture_float")||he.has("WEBGL_color_buffer_float")))&&!vt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Ae>=0&&Ae<=K.width-de&&Ie>=0&&Ie<=K.height-Me&&W.readPixels(Ae,Ie,de,Me,Oe.convert(Ut),Oe.convert(Ge),rt)}finally{const Et=T!==null?pe.get(T).__webglFramebuffer:null;fe.bindFramebuffer(W.FRAMEBUFFER,Et)}}},this.copyFramebufferToTexture=function(K,Ae,Ie=0){const de=Math.pow(2,-Ie),Me=Math.floor(Ae.image.width*de),rt=Math.floor(Ae.image.height*de);Re.setTexture2D(Ae,0),W.copyTexSubImage2D(W.TEXTURE_2D,Ie,0,0,K.x,K.y,Me,rt),fe.unbindTexture()},this.copyTextureToTexture=function(K,Ae,Ie,de=0){const Me=Ae.image.width,rt=Ae.image.height,mt=Oe.convert(Ie.format),At=Oe.convert(Ie.type);Re.setTexture2D(Ie,0),W.pixelStorei(W.UNPACK_FLIP_Y_WEBGL,Ie.flipY),W.pixelStorei(W.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Ie.premultiplyAlpha),W.pixelStorei(W.UNPACK_ALIGNMENT,Ie.unpackAlignment),Ae.isDataTexture?W.texSubImage2D(W.TEXTURE_2D,de,K.x,K.y,Me,rt,mt,At,Ae.image.data):Ae.isCompressedTexture?W.compressedTexSubImage2D(W.TEXTURE_2D,de,K.x,K.y,Ae.mipmaps[0].width,Ae.mipmaps[0].height,mt,Ae.mipmaps[0].data):W.texSubImage2D(W.TEXTURE_2D,de,K.x,K.y,mt,At,Ae.image),de===0&&Ie.generateMipmaps&&W.generateMipmap(W.TEXTURE_2D),fe.unbindTexture()},this.copyTextureToTexture3D=function(K,Ae,Ie,de,Me=0){if(x.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const rt=K.max.x-K.min.x+1,mt=K.max.y-K.min.y+1,At=K.max.z-K.min.z+1,Et=Oe.convert(de.format),Ut=Oe.convert(de.type);let Ge;if(de.isData3DTexture)Re.setTexture3D(de,0),Ge=W.TEXTURE_3D;else if(de.isDataArrayTexture)Re.setTexture2DArray(de,0),Ge=W.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}W.pixelStorei(W.UNPACK_FLIP_Y_WEBGL,de.flipY),W.pixelStorei(W.UNPACK_PREMULTIPLY_ALPHA_WEBGL,de.premultiplyAlpha),W.pixelStorei(W.UNPACK_ALIGNMENT,de.unpackAlignment);const vt=W.getParameter(W.UNPACK_ROW_LENGTH),wn=W.getParameter(W.UNPACK_IMAGE_HEIGHT),ln=W.getParameter(W.UNPACK_SKIP_PIXELS),Oi=W.getParameter(W.UNPACK_SKIP_ROWS),er=W.getParameter(W.UNPACK_SKIP_IMAGES),pn=Ie.isCompressedTexture?Ie.mipmaps[0]:Ie.image;W.pixelStorei(W.UNPACK_ROW_LENGTH,pn.width),W.pixelStorei(W.UNPACK_IMAGE_HEIGHT,pn.height),W.pixelStorei(W.UNPACK_SKIP_PIXELS,K.min.x),W.pixelStorei(W.UNPACK_SKIP_ROWS,K.min.y),W.pixelStorei(W.UNPACK_SKIP_IMAGES,K.min.z),Ie.isDataTexture||Ie.isData3DTexture?W.texSubImage3D(Ge,Me,Ae.x,Ae.y,Ae.z,rt,mt,At,Et,Ut,pn.data):Ie.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),W.compressedTexSubImage3D(Ge,Me,Ae.x,Ae.y,Ae.z,rt,mt,At,Et,pn.data)):W.texSubImage3D(Ge,Me,Ae.x,Ae.y,Ae.z,rt,mt,At,Et,Ut,pn),W.pixelStorei(W.UNPACK_ROW_LENGTH,vt),W.pixelStorei(W.UNPACK_IMAGE_HEIGHT,wn),W.pixelStorei(W.UNPACK_SKIP_PIXELS,ln),W.pixelStorei(W.UNPACK_SKIP_ROWS,Oi),W.pixelStorei(W.UNPACK_SKIP_IMAGES,er),Me===0&&de.generateMipmaps&&W.generateMipmap(Ge),fe.unbindTexture()},this.initTexture=function(K){K.isCubeTexture?Re.setTextureCube(K,0):K.isData3DTexture?Re.setTexture3D(K,0):K.isDataArrayTexture||K.isCompressedArrayTexture?Re.setTexture2DArray(K,0):Re.setTexture2D(K,0),fe.unbindTexture()},this.resetState=function(){w=0,I=0,T=null,fe.reset(),Ve.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return za}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===Nt?Dl:I6}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Dl?Nt:fa}}class aT extends U6{}aT.prototype.isWebGL1Renderer=!0;class k2{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new He(e),this.density=t}clone(){return new k2(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class N2{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new He(e),this.near=t,this.far=i}clone(){return new N2(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class Bp extends fn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}class G2{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Ip,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=ls()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=ls()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=ls()),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 xr=new N;class tu{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)xr.fromBufferAttribute(this,t),xr.applyMatrix4(e),this.setXYZ(t,xr.x,xr.y,xr.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)xr.fromBufferAttribute(this,t),xr.applyNormalMatrix(e),this.setXYZ(t,xr.x,xr.y,xr.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)xr.fromBufferAttribute(this,t),xr.transformDirection(e),this.setXYZ(t,xr.x,xr.y,xr.z);return this}setX(e,t){return this.normalized&&(t=Wt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Wt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Wt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Wt(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=as(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=as(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=as(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=as(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Wt(t,this.array),i=Wt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Wt(t,this.array),i=Wt(i,this.array),r=Wt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Wt(t,this.array),i=Wt(i,this.array),r=Wt(r,this.array),s=Wt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new En(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 tu(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class O6 extends Ji{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new He(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 rh;const $f=new N,sh=new N,ah=new N,oh=new _e,Jf=new _e,oT=new ct,sg=new N,Zf=new N,ag=new N,K_=new _e,pv=new _e,$_=new _e;class lT extends fn{constructor(e){if(super(),this.isSprite=!0,this.type="Sprite",rh===void 0){rh=new Bt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new G2(t,5);rh.setIndex([0,1,2,0,2,3]),rh.setAttribute("position",new tu(i,3,0,!1)),rh.setAttribute("uv",new tu(i,2,3,!1))}this.geometry=rh,this.material=e!==void 0?e:new O6,this.center=new _e(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),sh.setFromMatrixScale(this.matrixWorld),oT.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),ah.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&sh.multiplyScalar(-ah.z);const i=this.material.rotation;let r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));const a=this.center;og(sg.set(-.5,-.5,0),ah,a,sh,r,s),og(Zf.set(.5,-.5,0),ah,a,sh,r,s),og(ag.set(.5,.5,0),ah,a,sh,r,s),K_.set(0,0),pv.set(1,0),$_.set(1,1);let o=e.ray.intersectTriangle(sg,Zf,ag,!1,$f);if(o===null&&(og(Zf.set(-.5,.5,0),ah,a,sh,r,s),pv.set(0,1),o=e.ray.intersectTriangle(sg,ag,Zf,!1,$f),o===null))return;const l=e.ray.origin.distanceTo($f);l<e.near||l>e.far||t.push({distance:l,point:$f.clone(),uv:Qr.getInterpolation($f,sg,Zf,ag,K_,pv,$_,new _e),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 og(n,e,t,i,r,s){oh.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(Jf.x=s*oh.x-r*oh.y,Jf.y=r*oh.x+s*oh.y):Jf.copy(oh),n.copy(e),n.x+=Jf.x,n.y+=Jf.y,n.applyMatrix4(oT)}const lg=new N,J_=new N;class cT extends fn{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,r=t.length;i<r;i++){const s=t[i];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,i=0){t=Math.abs(t);const r=this.levels;let s;for(s=0;s<r.length&&!(t<r[s].distance);s++);return r.splice(s,0,{distance:t,hysteresis:i,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let i,r;for(i=1,r=t.length;i<r;i++){let s=t[i].distance;if(t[i].object.visible&&(s-=s*t[i].hysteresis),e<s)break}return t[i-1].object}return null}raycast(e,t){if(this.levels.length>0){lg.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(lg);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){lg.setFromMatrixPosition(e.matrixWorld),J_.setFromMatrixPosition(this.matrixWorld);const i=lg.distanceTo(J_)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r<s;r++){let a=t[r].distance;if(t[r].object.visible&&(a-=a*t[r].hysteresis),i>=a)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<s;r++)t[r].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const i=this.levels;for(let r=0,s=i.length;r<s;r++){const a=i[r];t.object.levels.push({object:a.object.uuid,distance:a.distance,hysteresis:a.hysteresis})}return t}}const Z_=new N,eE=new jt,tE=new jt,sN=new N,nE=new ct,lh=new N,gv=new ms,iE=new ct,mv=new lf;class uT extends nn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new ct,this.bindMatrixInverse=new ct,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new gs),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)lh.fromBufferAttribute(t,i),this.applyBoneTransform(i,lh),this.boundingBox.expandByPoint(lh)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new ms),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)lh.fromBufferAttribute(t,i),this.applyBoneTransform(i,lh),this.boundingSphere.expandByPoint(lh)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const i=this.material,r=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),gv.copy(this.boundingSphere),gv.applyMatrix4(r),e.ray.intersectsSphere(gv)!==!1&&(iE.copy(r).invert(),mv.copy(e.ray).applyMatrix4(iE),!(this.boundingBox!==null&&mv.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,mv)))}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 jt,t=this.geometry.attributes.skinWeight;for(let i=0,r=t.count;i<r;i++){e.fromBufferAttribute(t,i);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const i=this.skeleton,r=this.geometry;eE.fromBufferAttribute(r.attributes.skinIndex,e),tE.fromBufferAttribute(r.attributes.skinWeight,e),Z_.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=tE.getComponent(s);if(a!==0){const o=eE.getComponent(s);nE.multiplyMatrices(i.bones[o].matrixWorld,i.boneInverses[o]),t.addScaledVector(sN.copy(Z_).applyMatrix4(nE),a)}}return t.applyMatrix4(this.bindMatrixInverse)}boneTransform(e,t){return console.warn("THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151."),this.applyBoneTransform(e,t)}}class F6 extends fn{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Va extends Vn{constructor(e=null,t=1,i=1,r,s,a,o,l,c=Rt,u=Rt,h,f){super(null,a,o,l,c,u,r,s,h,f),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const rE=new ct,aN=new ct;class z2{constructor(e=[],t=[]){this.uuid=ls(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,r=this.bones.length;i<r;i++)this.boneInverses.push(new ct)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new ct;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const o=e[s]?e[s].matrixWorld:aN;rE.multiplyMatrices(o,t[s]),rE.toArray(i,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new z2(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=qC(e),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const i=new Va(t,e,e,li,br);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,r=e.bones.length;i<r;i++){const s=e.bones[i];let a=t[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new F6),this.bones.push(a),this.boneInverses.push(new ct().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,i=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const a=t[r];e.bones.push(a.uuid);const o=i[r];e.boneInverses.push(o.toArray())}return e}}class nu extends En{constructor(e,t,i,r=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const ch=new ct,sE=new ct,cg=[],aE=new gs,oN=new ct,ed=new nn,td=new ms;class hT extends nn{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new nu(new Float32Array(i*16),16),this.instanceColor=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<i;r++)this.setMatrixAt(r,oN)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new gs),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,ch),aE.copy(e.boundingBox).applyMatrix4(ch),this.boundingBox.union(aE)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new ms),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,ch),td.copy(e.boundingSphere).applyMatrix4(ch),this.boundingSphere.union(td)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const i=this.matrixWorld,r=this.count;if(ed.geometry=this.geometry,ed.material=this.material,ed.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),td.copy(this.boundingSphere),td.applyMatrix4(i),e.ray.intersectsSphere(td)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,ch),sE.multiplyMatrices(i,ch),ed.matrixWorld=sE,ed.raycast(e,cg);for(let a=0,o=cg.length;a<o;a++){const l=cg[a];l.instanceId=s,l.object=this,t.push(l)}cg.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new nu(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}class Rr extends Ji{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new He(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 oE=new N,lE=new N,cE=new ct,Av=new lf,ug=new ms;let Gl=class extends fn{constructor(e=new Bt,t=new Rr){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)oE.fromBufferAttribute(t,r-1),lE.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=oE.distanceTo(lE);e.setAttribute("lineDistance",new ot(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),ug.copy(i.boundingSphere),ug.applyMatrix4(r),ug.radius+=s,e.ray.intersectsSphere(ug)===!1)return;cE.copy(r).invert(),Av.copy(e.ray).applyMatrix4(cE);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=new N,u=new N,h=new N,f=new N,p=this.isLineSegments?2:1,m=i.index,v=i.attributes.position;if(m!==null){const A=Math.max(0,a.start),_=Math.min(m.count,a.start+a.count);for(let x=A,E=_-1;x<E;x+=p){const w=m.getX(x),I=m.getX(x+1);if(c.fromBufferAttribute(v,w),u.fromBufferAttribute(v,I),Av.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);const M=e.ray.origin.distanceTo(f);M<e.near||M>e.far||t.push({distance:M,point:h.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else{const A=Math.max(0,a.start),_=Math.min(v.count,a.start+a.count);for(let x=A,E=_-1;x<E;x+=p){if(c.fromBufferAttribute(v,x),u.fromBufferAttribute(v,x+1),Av.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);const I=e.ray.origin.distanceTo(f);I<e.near||I>e.far||t.push({distance:I,point:h.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}};const uE=new N,hE=new N;class to extends Gl{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let r=0,s=t.count;r<s;r+=2)uE.fromBufferAttribute(t,r),hE.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+uE.distanceTo(hE);e.setAttribute("lineDistance",new ot(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class fT extends Gl{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class k6 extends Ji{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new He(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 fE=new ct,cy=new lf,hg=new ms,fg=new N;class N6 extends fn{constructor(e=new Bt,t=new k6){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),hg.copy(i.boundingSphere),hg.applyMatrix4(r),hg.radius+=s,e.ray.intersectsSphere(hg)===!1)return;fE.copy(r).invert(),cy.copy(e.ray).applyMatrix4(fE);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=i.index,h=i.attributes.position;if(c!==null){const f=Math.max(0,a.start),p=Math.min(c.count,a.start+a.count);for(let m=f,y=p;m<y;m++){const v=c.getX(m);fg.fromBufferAttribute(h,v),dE(fg,v,l,r,e,t,this)}}else{const f=Math.max(0,a.start),p=Math.min(h.count,a.start+a.count);for(let m=f,y=p;m<y;m++)fg.fromBufferAttribute(h,m),dE(fg,m,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function dE(n,e,t,i,r,s,a){const o=cy.distanceSqToPoint(n);if(o<t){const l=new N;cy.closestPointToPoint(n,l),l.applyMatrix4(i);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,object:a})}}class lN extends Vn{constructor(e,t,i,r,s,a,o,l,c){super(e,t,i,r,s,a,o,l,c),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:Tn,this.magFilter=s!==void 0?s:Tn,this.generateMipmaps=!1;const u=this;function h(){u.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class cN extends Vn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Rt,this.minFilter=Rt,this.generateMipmaps=!1,this.needsUpdate=!0}}class iu extends Vn{constructor(e,t,i,r,s,a,o,l,c,u,h,f){super(null,a,o,l,c,u,r,s,h,f),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}let uN=class extends iu{constructor(e,t,i,r,s,a){super(e,t,i,s,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=oi}};class hN extends Vn{constructor(e,t,i,r,s,a,o,l,c){super(e,t,i,r,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Aa{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)i=this.getPoint(a/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let r=0;const s=i.length;let a;t?a=t:a=e*i[s-1];let o=0,l=s-1,c;for(;o<=l;)if(r=Math.floor(o+(l-o)/2),c=i[r]-a,c<0)o=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,i[r]===a)return r/(s-1);const u=i[r],f=i[r+1]-u,p=(a-u)/f;return(r+p)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),o=this.getPoint(s),l=t||(a.isVector2?new _e:new N);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new N,r=[],s=[],a=[],o=new N,l=new ct;for(let p=0;p<=e;p++){const m=p/e;r[p]=this.getTangentAt(m,new N)}s[0]=new N,a[0]=new N;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),h=Math.abs(r[0].y),f=Math.abs(r[0].z);u<=c&&(c=u,i.set(1,0,0)),h<=c&&(c=h,i.set(0,1,0)),f<=c&&i.set(0,0,1),o.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],o),a[0].crossVectors(r[0],s[0]);for(let p=1;p<=e;p++){if(s[p]=s[p-1].clone(),a[p]=a[p-1].clone(),o.crossVectors(r[p-1],r[p]),o.length()>Number.EPSILON){o.normalize();const m=Math.acos(si(r[p-1].dot(r[p]),-1,1));s[p].applyMatrix4(l.makeRotationAxis(o,m))}a[p].crossVectors(r[p],s[p])}if(t===!0){let p=Math.acos(si(s[0].dot(s[e]),-1,1));p/=e,r[0].dot(o.crossVectors(s[0],s[e]))>0&&(p=-p);for(let m=1;m<=e;m++)s[m].applyMatrix4(l.makeRotationAxis(r[m],p*m)),a[m].crossVectors(r[m],s[m])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Q2 extends Aa{constructor(e=0,t=0,i=1,r=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t){const i=t||new _e,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(a?s=0:s=r),this.aClockwise===!0&&!a&&(s===r?s=-r:s=s-r);const o=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),f=l-this.aX,p=c-this.aY;l=f*u-p*h+this.aX,c=f*h+p*u+this.aY}return i.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class dT extends Q2{constructor(e,t,i,r,s,a){super(e,t,i,i,r,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function G6(){let n=0,e=0,t=0,i=0;function r(s,a,o,l){n=s,e=o,t=-3*s+3*a-2*o-l,i=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){r(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,u,h){let f=(a-s)/c-(o-s)/(c+u)+(o-a)/u,p=(o-a)/u-(l-a)/(u+h)+(l-o)/h;f*=u,p*=u,r(a,o,f,p)},calc:function(s){const a=s*s,o=a*s;return n+e*s+t*a+i*o}}}const dg=new N,vv=new G6,yv=new G6,xv=new G6;class pT extends Aa{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new N){const i=t,r=this.points,s=r.length,a=(s-(this.closed?0:1))*e;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,u;this.closed||o>0?c=r[(o-1)%s]:(dg.subVectors(r[0],r[1]).add(r[0]),c=dg);const h=r[o%s],f=r[(o+1)%s];if(this.closed||o+2<s?u=r[(o+2)%s]:(dg.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=dg),this.curveType==="centripetal"||this.curveType==="chordal"){const p=this.curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(h),p),y=Math.pow(h.distanceToSquared(f),p),v=Math.pow(f.distanceToSquared(u),p);y<1e-4&&(y=1),m<1e-4&&(m=y),v<1e-4&&(v=y),vv.initNonuniformCatmullRom(c.x,h.x,f.x,u.x,m,y,v),yv.initNonuniformCatmullRom(c.y,h.y,f.y,u.y,m,y,v),xv.initNonuniformCatmullRom(c.z,h.z,f.z,u.z,m,y,v)}else this.curveType==="catmullrom"&&(vv.initCatmullRom(c.x,h.x,f.x,u.x,this.tension),yv.initCatmullRom(c.y,h.y,f.y,u.y,this.tension),xv.initCatmullRom(c.z,h.z,f.z,u.z,this.tension));return i.set(vv.calc(l),yv.calc(l),xv.calc(l)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new N().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function pE(n,e,t,i,r){const s=(i-e)*.5,a=(r-t)*.5,o=n*n,l=n*o;return(2*t-2*i+s+a)*l+(-3*t+3*i-2*s-a)*o+s*n+t}function fN(n,e){const t=1-n;return t*t*e}function dN(n,e){return 2*(1-n)*n*e}function pN(n,e){return n*n*e}function Zd(n,e,t,i){return fN(n,e)+dN(n,t)+pN(n,i)}function gN(n,e){const t=1-n;return t*t*t*e}function mN(n,e){const t=1-n;return 3*t*t*n*e}function AN(n,e){return 3*(1-n)*n*n*e}function vN(n,e){return n*n*n*e}function ep(n,e,t,i,r){return gN(n,e)+mN(n,t)+AN(n,i)+vN(n,r)}class z6 extends Aa{constructor(e=new _e,t=new _e,i=new _e,r=new _e){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new _e){const i=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return i.set(ep(e,r.x,s.x,a.x,o.x),ep(e,r.y,s.y,a.y,o.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.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 gT extends Aa{constructor(e=new N,t=new N,i=new N,r=new N){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new N){const i=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return i.set(ep(e,r.x,s.x,a.x,o.x),ep(e,r.y,s.y,a.y,o.y),ep(e,r.z,s.z,a.z,o.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.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 H2 extends Aa{constructor(e=new _e,t=new _e){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new _e){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new _e){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 Q6 extends Aa{constructor(e=new N,t=new N){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new N){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new N){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 H6 extends Aa{constructor(e=new _e,t=new _e,i=new _e){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new _e){const i=t,r=this.v0,s=this.v1,a=this.v2;return i.set(Zd(e,r.x,s.x,a.x),Zd(e,r.y,s.y,a.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}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 V2 extends Aa{constructor(e=new N,t=new N,i=new N){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new N){const i=t,r=this.v0,s=this.v1,a=this.v2;return i.set(Zd(e,r.x,s.x,a.x),Zd(e,r.y,s.y,a.y),Zd(e,r.z,s.z,a.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}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 V6 extends Aa{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new _e){const i=t,r=this.points,s=(r.length-1)*e,a=Math.floor(s),o=s-a,l=r[a===0?a:a-1],c=r[a],u=r[a>r.length-2?r.length-1:a+1],h=r[a>r.length-3?r.length-1:a+2];return i.set(pE(o,l.x,c.x,u.x,h.x),pE(o,l.y,c.y,u.y,h.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new _e().fromArray(r))}return this}}var W6=Object.freeze({__proto__:null,ArcCurve:dT,CatmullRomCurve3:pT,CubicBezierCurve:z6,CubicBezierCurve3:gT,EllipseCurve:Q2,LineCurve:H2,LineCurve3:Q6,QuadraticBezierCurve:H6,QuadraticBezierCurve3:V2,SplineCurve:V6});class mT extends Aa{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);e.equals(t)||this.curves.push(new H2(t,e))}getPoint(e,t){const i=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=i){const a=r[s]-i,o=this.curves[s],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let i;for(let r=0,s=this.curves;r<s.length;r++){const a=s[r],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,l=a.getPoints(o);for(let c=0;c<l.length;c++){const u=l[c];i&&i.equals(u)||(t.push(u),i=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){const r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(new W6[r.type]().fromJSON(r))}return this}}let Dp=class extends mT{constructor(e){super(),this.type="Path",this.currentPoint=new _e,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const i=new H2(this.currentPoint.clone(),new _e(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){const s=new H6(this.currentPoint.clone(),new _e(e,t),new _e(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,a){const o=new z6(this.currentPoint.clone(),new _e(e,t),new _e(i,r),new _e(s,a));return this.curves.push(o),this.currentPoint.set(s,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new V6(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,s,a){const o=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+o,t+l,i,r,s,a),this}absarc(e,t,i,r,s,a){return this.absellipse(e,t,i,i,r,s,a),this}ellipse(e,t,i,r,s,a,o,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,i,r,s,a,o,l),this}absellipse(e,t,i,r,s,a,o,l){const c=new Q2(e,t,i,r,s,a,o,l);if(this.curves.length>0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}};class h0 extends Bt{constructor(e=[new _e(0,-.5),new _e(.5,0),new _e(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=si(r,0,Math.PI*2);const s=[],a=[],o=[],l=[],c=[],u=1/t,h=new N,f=new _e,p=new N,m=new N,y=new N;let v=0,A=0;for(let _=0;_<=e.length-1;_++)switch(_){case 0:v=e[_+1].x-e[_].x,A=e[_+1].y-e[_].y,p.x=A*1,p.y=-v,p.z=A*0,y.copy(p),p.normalize(),l.push(p.x,p.y,p.z);break;case e.length-1:l.push(y.x,y.y,y.z);break;default:v=e[_+1].x-e[_].x,A=e[_+1].y-e[_].y,p.x=A*1,p.y=-v,p.z=A*0,m.copy(p),p.x+=y.x,p.y+=y.y,p.z+=y.z,p.normalize(),l.push(p.x,p.y,p.z),y.copy(m)}for(let _=0;_<=t;_++){const x=i+_*u*r,E=Math.sin(x),w=Math.cos(x);for(let I=0;I<=e.length-1;I++){h.x=e[I].x*E,h.y=e[I].y,h.z=e[I].x*w,a.push(h.x,h.y,h.z),f.x=_/t,f.y=I/(e.length-1),o.push(f.x,f.y);const T=l[3*I+0]*E,M=l[3*I+1],b=l[3*I+0]*w;c.push(T,M,b)}}for(let _=0;_<t;_++)for(let x=0;x<e.length-1;x++){const E=x+_*e.length,w=E,I=E+e.length,T=E+e.length+1,M=E+1;s.push(w,I,M),s.push(T,M,I)}this.setIndex(s),this.setAttribute("position",new ot(a,3)),this.setAttribute("uv",new ot(o,2)),this.setAttribute("normal",new ot(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new h0(e.points,e.segments,e.phiStart,e.phiLength)}}class W2 extends h0{constructor(e=1,t=1,i=4,r=8){const s=new Dp;s.absarc(0,-t/2,e,Math.PI*1.5,0),s.absarc(0,t/2,e,0,Math.PI*.5),super(s.getPoints(i),r),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:i,radialSegments:r}}static fromJSON(e){return new W2(e.radius,e.length,e.capSegments,e.radialSegments)}}class Y2 extends Bt{constructor(e=1,t=32,i=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},t=Math.max(3,t);const s=[],a=[],o=[],l=[],c=new N,u=new _e;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let h=0,f=3;h<=t;h++,f+=3){const p=i+h/t*r;c.x=e*Math.cos(p),c.y=e*Math.sin(p),a.push(c.x,c.y,c.z),o.push(0,0,1),u.x=(a[f]/e+1)/2,u.y=(a[f+1]/e+1)/2,l.push(u.x,u.y)}for(let h=1;h<=t;h++)s.push(h,h+1,0);this.setIndex(s),this.setAttribute("position",new ot(a,3)),this.setAttribute("normal",new ot(o,3)),this.setAttribute("uv",new ot(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Y2(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class yu extends Bt{constructor(e=1,t=1,i=1,r=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const u=[],h=[],f=[],p=[];let m=0;const y=[],v=i/2;let A=0;_(),a===!1&&(e>0&&x(!0),t>0&&x(!1)),this.setIndex(u),this.setAttribute("position",new ot(h,3)),this.setAttribute("normal",new ot(f,3)),this.setAttribute("uv",new ot(p,2));function _(){const E=new N,w=new N;let I=0;const T=(t-e)/i;for(let M=0;M<=s;M++){const b=[],B=M/s,L=B*(t-e)+e;for(let U=0;U<=r;U++){const O=U/r,Q=O*l+o,G=Math.sin(Q),F=Math.cos(Q);w.x=L*G,w.y=-B*i+v,w.z=L*F,h.push(w.x,w.y,w.z),E.set(G,T,F).normalize(),f.push(E.x,E.y,E.z),p.push(O,1-B),b.push(m++)}y.push(b)}for(let M=0;M<r;M++)for(let b=0;b<s;b++){const B=y[b][M],L=y[b+1][M],U=y[b+1][M+1],O=y[b][M+1];u.push(B,L,O),u.push(L,U,O),I+=6}c.addGroup(A,I,0),A+=I}function x(E){const w=m,I=new _e,T=new N;let M=0;const b=E===!0?e:t,B=E===!0?1:-1;for(let U=1;U<=r;U++)h.push(0,v*B,0),f.push(0,B,0),p.push(.5,.5),m++;const L=m;for(let U=0;U<=r;U++){const Q=U/r*l+o,G=Math.cos(Q),F=Math.sin(Q);T.x=b*F,T.y=v*B,T.z=b*G,h.push(T.x,T.y,T.z),f.push(0,B,0),I.x=G*.5+.5,I.y=F*.5*B+.5,p.push(I.x,I.y),m++}for(let U=0;U<r;U++){const O=w+U,Q=L+U;E===!0?u.push(Q,Q+1,O):u.push(Q+1,Q,O),M+=3}c.addGroup(A,M,E===!0?1:2),A+=M}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new yu(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class q2 extends yu{constructor(e=1,t=1,i=32,r=1,s=!1,a=0,o=Math.PI*2){super(0,e,t,i,r,s,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(e){return new q2(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Xl extends Bt{constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};const s=[],a=[];o(r),c(i),u(),this.setAttribute("position",new ot(s,3)),this.setAttribute("normal",new ot(s.slice(),3)),this.setAttribute("uv",new ot(a,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function o(_){const x=new N,E=new N,w=new N;for(let I=0;I<t.length;I+=3)p(t[I+0],x),p(t[I+1],E),p(t[I+2],w),l(x,E,w,_)}function l(_,x,E,w){const I=w+1,T=[];for(let M=0;M<=I;M++){T[M]=[];const b=_.clone().lerp(E,M/I),B=x.clone().lerp(E,M/I),L=I-M;for(let U=0;U<=L;U++)U===0&&M===I?T[M][U]=b:T[M][U]=b.clone().lerp(B,U/L)}for(let M=0;M<I;M++)for(let b=0;b<2*(I-M)-1;b++){const B=Math.floor(b/2);b%2===0?(f(T[M][B+1]),f(T[M+1][B]),f(T[M][B])):(f(T[M][B+1]),f(T[M+1][B+1]),f(T[M+1][B]))}}function c(_){const x=new N;for(let E=0;E<s.length;E+=3)x.x=s[E+0],x.y=s[E+1],x.z=s[E+2],x.normalize().multiplyScalar(_),s[E+0]=x.x,s[E+1]=x.y,s[E+2]=x.z}function u(){const _=new N;for(let x=0;x<s.length;x+=3){_.x=s[x+0],_.y=s[x+1],_.z=s[x+2];const E=v(_)/2/Math.PI+.5,w=A(_)/Math.PI+.5;a.push(E,1-w)}m(),h()}function h(){for(let _=0;_<a.length;_+=6){const x=a[_+0],E=a[_+2],w=a[_+4],I=Math.max(x,E,w),T=Math.min(x,E,w);I>.9&&T<.1&&(x<.2&&(a[_+0]+=1),E<.2&&(a[_+2]+=1),w<.2&&(a[_+4]+=1))}}function f(_){s.push(_.x,_.y,_.z)}function p(_,x){const E=_*3;x.x=e[E+0],x.y=e[E+1],x.z=e[E+2]}function m(){const _=new N,x=new N,E=new N,w=new N,I=new _e,T=new _e,M=new _e;for(let b=0,B=0;b<s.length;b+=9,B+=6){_.set(s[b+0],s[b+1],s[b+2]),x.set(s[b+3],s[b+4],s[b+5]),E.set(s[b+6],s[b+7],s[b+8]),I.set(a[B+0],a[B+1]),T.set(a[B+2],a[B+3]),M.set(a[B+4],a[B+5]),w.copy(_).add(x).add(E).divideScalar(3);const L=v(w);y(I,B+0,_,L),y(T,B+2,x,L),y(M,B+4,E,L)}}function y(_,x,E,w){w<0&&_.x===1&&(a[x]=_.x-1),E.x===0&&E.z===0&&(a[x]=w/2/Math.PI+.5)}function v(_){return Math.atan2(_.z,-_.x)}function A(_){return Math.atan2(-_.y,Math.sqrt(_.x*_.x+_.z*_.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Xl(e.vertices,e.indices,e.radius,e.details)}}class X2 extends Xl{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=1/i,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r],a=[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,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new X2(e.radius,e.detail)}}const pg=new N,gg=new N,_v=new N,mg=new Qr;class AT extends Bt{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(jc*t),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],u=["a","b","c"],h=new Array(3),f={},p=[];for(let m=0;m<l;m+=3){a?(c[0]=a.getX(m),c[1]=a.getX(m+1),c[2]=a.getX(m+2)):(c[0]=m,c[1]=m+1,c[2]=m+2);const{a:y,b:v,c:A}=mg;if(y.fromBufferAttribute(o,c[0]),v.fromBufferAttribute(o,c[1]),A.fromBufferAttribute(o,c[2]),mg.getNormal(_v),h[0]=`${Math.round(y.x*r)},${Math.round(y.y*r)},${Math.round(y.z*r)}`,h[1]=`${Math.round(v.x*r)},${Math.round(v.y*r)},${Math.round(v.z*r)}`,h[2]=`${Math.round(A.x*r)},${Math.round(A.y*r)},${Math.round(A.z*r)}`,!(h[0]===h[1]||h[1]===h[2]||h[2]===h[0]))for(let _=0;_<3;_++){const x=(_+1)%3,E=h[_],w=h[x],I=mg[u[_]],T=mg[u[x]],M=`${E}_${w}`,b=`${w}_${E}`;b in f&&f[b]?(_v.dot(f[b].normal)<=s&&(p.push(I.x,I.y,I.z),p.push(T.x,T.y,T.z)),f[b]=null):M in f||(f[M]={index0:c[_],index1:c[x],normal:_v.clone()})}}for(const m in f)if(f[m]){const{index0:y,index1:v}=f[m];pg.fromBufferAttribute(o,y),gg.fromBufferAttribute(o,v),p.push(pg.x,pg.y,pg.z),p.push(gg.x,gg.y,gg.z)}this.setAttribute("position",new ot(p,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class $c extends Dp{constructor(e){super(e),this.uuid=ls(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){const r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(new Dp().fromJSON(r))}return this}}const yN={triangulate:function(n,e,t=2){const i=e&&e.length,r=i?e[0]*t:n.length;let s=vT(n,0,r,t,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c,u,h,f,p;if(i&&(s=wN(n,e,s,t)),n.length>80*t){o=c=n[0],l=u=n[1];for(let m=t;m<r;m+=t)h=n[m],f=n[m+1],h<o&&(o=h),f<l&&(l=f),h>c&&(c=h),f>u&&(u=f);p=Math.max(c-o,u-l),p=p!==0?32767/p:0}return Pp(s,a,t,o,l,p,0),a}};function vT(n,e,t,i,r){let s,a;if(r===UN(n,e,t,i)>0)for(s=e;s<t;s+=i)a=gE(s,n[s],n[s+1],a);else for(s=t-i;s>=e;s-=i)a=gE(s,n[s],n[s+1],a);return a&&j2(a,a.next)&&(Up(a),a=a.next),a}function ru(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(j2(t,t.next)||Jn(t.prev,t,t.next)===0)){if(Up(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Pp(n,e,t,i,r,s,a){if(!n)return;!a&&s&&MN(n,i,r,s);let o=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,s?_N(n,i,r,s):xN(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),Up(n),n=c.next,o=c.next;continue}if(n=c,n===o){a?a===1?(n=EN(ru(n),e,t),Pp(n,e,t,i,r,s,2)):a===2&&SN(n,e,t,i,r,s):Pp(ru(n),e,t,i,r,s,1);break}}}function xN(n){const e=n.prev,t=n,i=n.next;if(Jn(e,t,i)>=0)return!1;const r=e.x,s=t.x,a=i.x,o=e.y,l=t.y,c=i.y,u=r<s?r<a?r:a:s<a?s:a,h=o<l?o<c?o:c:l<c?l:c,f=r>s?r>a?r:a:s>a?s:a,p=o>l?o>c?o:c:l>c?l:c;let m=i.next;for(;m!==e;){if(m.x>=u&&m.x<=f&&m.y>=h&&m.y<=p&&Ih(r,o,s,l,a,c,m.x,m.y)&&Jn(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function _N(n,e,t,i){const r=n.prev,s=n,a=n.next;if(Jn(r,s,a)>=0)return!1;const o=r.x,l=s.x,c=a.x,u=r.y,h=s.y,f=a.y,p=o<l?o<c?o:c:l<c?l:c,m=u<h?u<f?u:f:h<f?h:f,y=o>l?o>c?o:c:l>c?l:c,v=u>h?u>f?u:f:h>f?h:f,A=uy(p,m,e,t,i),_=uy(y,v,e,t,i);let x=n.prevZ,E=n.nextZ;for(;x&&x.z>=A&&E&&E.z<=_;){if(x.x>=p&&x.x<=y&&x.y>=m&&x.y<=v&&x!==r&&x!==a&&Ih(o,u,l,h,c,f,x.x,x.y)&&Jn(x.prev,x,x.next)>=0||(x=x.prevZ,E.x>=p&&E.x<=y&&E.y>=m&&E.y<=v&&E!==r&&E!==a&&Ih(o,u,l,h,c,f,E.x,E.y)&&Jn(E.prev,E,E.next)>=0))return!1;E=E.nextZ}for(;x&&x.z>=A;){if(x.x>=p&&x.x<=y&&x.y>=m&&x.y<=v&&x!==r&&x!==a&&Ih(o,u,l,h,c,f,x.x,x.y)&&Jn(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;E&&E.z<=_;){if(E.x>=p&&E.x<=y&&E.y>=m&&E.y<=v&&E!==r&&E!==a&&Ih(o,u,l,h,c,f,E.x,E.y)&&Jn(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function EN(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!j2(r,s)&&yT(r,i,i.next,s)&&Lp(r,s)&&Lp(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),Up(i),Up(i.next),i=n=s),i=i.next}while(i!==n);return ru(i)}function SN(n,e,t,i,r,s){let a=n;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&DN(a,o)){let l=xT(a,o);a=ru(a,a.next),l=ru(l,l.next),Pp(a,e,t,i,r,s,0),Pp(l,e,t,i,r,s,0);return}o=o.next}a=a.next}while(a!==n)}function wN(n,e,t,i){const r=[];let s,a,o,l,c;for(s=0,a=e.length;s<a;s++)o=e[s]*i,l=s<a-1?e[s+1]*i:n.length,c=vT(n,o,l,i,!1),c===c.next&&(c.steiner=!0),r.push(BN(c));for(r.sort(CN),s=0;s<r.length;s++)t=TN(r[s],t);return t}function CN(n,e){return n.x-e.x}function TN(n,e){const t=bN(n,e);if(!t)return e;const i=xT(t,n);return ru(i,i.next),ru(t,t.next)}function bN(n,e){let t=e,i=-1/0,r;const s=n.x,a=n.y;do{if(a<=t.y&&a>=t.next.y&&t.next.y!==t.y){const f=t.x+(a-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=s&&f>i&&(i=f,r=t.x<t.next.x?t:t.next,f===s))return r}t=t.next}while(t!==e);if(!r)return null;const o=r,l=r.x,c=r.y;let u=1/0,h;t=r;do s>=t.x&&t.x>=l&&s!==t.x&&Ih(a<c?s:i,a,l,c,a<c?i:s,a,t.x,t.y)&&(h=Math.abs(a-t.y)/(s-t.x),Lp(t,n)&&(h<u||h===u&&(t.x>r.x||t.x===r.x&&IN(r,t)))&&(r=t,u=h)),t=t.next;while(t!==o);return r}function IN(n,e){return Jn(n.prev,n,e.prev)<0&&Jn(e.next,n,n.next)<0}function MN(n,e,t,i){let r=n;do r.z===0&&(r.z=uy(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,RN(r)}function RN(n){let e,t,i,r,s,a,o,l,c=1;do{for(t=n,n=null,s=null,a=0;t;){for(a++,i=t,o=0,e=0;e<c&&(o++,i=i.nextZ,!!i);e++);for(l=c;o>0||l>0&&i;)o!==0&&(l===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,o--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,c*=2}while(a>1);return n}function uy(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function BN(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function Ih(n,e,t,i,r,s,a,o){return(r-a)*(e-o)>=(n-a)*(s-o)&&(n-a)*(i-o)>=(t-a)*(e-o)&&(t-a)*(s-o)>=(r-a)*(i-o)}function DN(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!PN(n,e)&&(Lp(n,e)&&Lp(e,n)&&LN(n,e)&&(Jn(n.prev,n,e.prev)||Jn(n,e.prev,e))||j2(n,e)&&Jn(n.prev,n,n.next)>0&&Jn(e.prev,e,e.next)>0)}function Jn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function j2(n,e){return n.x===e.x&&n.y===e.y}function yT(n,e,t,i){const r=vg(Jn(n,e,t)),s=vg(Jn(n,e,i)),a=vg(Jn(t,i,n)),o=vg(Jn(t,i,e));return!!(r!==s&&a!==o||r===0&&Ag(n,t,e)||s===0&&Ag(n,i,e)||a===0&&Ag(t,n,i)||o===0&&Ag(t,e,i))}function Ag(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function vg(n){return n>0?1:n<0?-1:0}function PN(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&yT(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Lp(n,e){return Jn(n.prev,n,n.next)<0?Jn(n,e,n.next)>=0&&Jn(n,n.prev,e)>=0:Jn(n,e,n.prev)<0||Jn(n,n.next,e)<0}function LN(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function xT(n,e){const t=new hy(n.i,n.x,n.y),i=new hy(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function gE(n,e,t,i){const r=new hy(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Up(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function hy(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function UN(n,e,t,i){let r=0;for(let s=e,a=t-i;s<t;s+=i)r+=(n[a]-n[s])*(n[s+1]+n[a+1]),a=s;return r}class Wa{static area(e){const t=e.length;let i=0;for(let r=t-1,s=0;s<t;r=s++)i+=e[r].x*e[s].y-e[s].x*e[r].y;return i*.5}static isClockWise(e){return Wa.area(e)<0}static triangulateShape(e,t){const i=[],r=[],s=[];mE(e),AE(i,e);let a=e.length;t.forEach(mE);for(let l=0;l<t.length;l++)r.push(a),a+=t[l].length,AE(i,t[l]);const o=yN.triangulate(i,r);for(let l=0;l<o.length;l+=3)s.push(o.slice(l,l+3));return s}}function mE(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function AE(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class K2 extends Bt{constructor(e=new $c([new _e(.5,.5),new _e(-.5,.5),new _e(-.5,-.5),new _e(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,r=[],s=[];for(let o=0,l=e.length;o<l;o++){const c=e[o];a(c)}this.setAttribute("position",new ot(r,3)),this.setAttribute("uv",new ot(s,2)),this.computeVertexNormals();function a(o){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1;let f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,p=t.bevelThickness!==void 0?t.bevelThickness:.2,m=t.bevelSize!==void 0?t.bevelSize:p-.1,y=t.bevelOffset!==void 0?t.bevelOffset:0,v=t.bevelSegments!==void 0?t.bevelSegments:3;const A=t.extrudePath,_=t.UVGenerator!==void 0?t.UVGenerator:ON;let x,E=!1,w,I,T,M;A&&(x=A.getSpacedPoints(u),E=!0,f=!1,w=A.computeFrenetFrames(u,!1),I=new N,T=new N,M=new N),f||(v=0,p=0,m=0,y=0);const b=o.extractPoints(c);let B=b.shape;const L=b.holes;if(!Wa.isClockWise(B)){B=B.reverse();for(let W=0,ge=L.length;W<ge;W++){const he=L[W];Wa.isClockWise(he)&&(L[W]=he.reverse())}}const O=Wa.triangulateShape(B,L),Q=B;for(let W=0,ge=L.length;W<ge;W++){const he=L[W];B=B.concat(he)}function G(W,ge,he){return ge||console.error("THREE.ExtrudeGeometry: vec does not exist"),W.clone().addScaledVector(ge,he)}const F=B.length,q=O.length;function Y(W,ge,he){let ue,fe,Pe;const pe=W.x-ge.x,Re=W.y-ge.y,Le=he.x-W.x,Se=he.y-W.y,$e=pe*pe+Re*Re,X=pe*Se-Re*Le;if(Math.abs(X)>Number.EPSILON){const z=Math.sqrt($e),se=Math.sqrt(Le*Le+Se*Se),Be=ge.x-Re/z,Ce=ge.y+pe/z,we=he.x-Se/se,ke=he.y+Le/se,Ue=((we-Be)*Se-(ke-Ce)*Le)/(pe*Se-Re*Le);ue=Be+pe*Ue-W.x,fe=Ce+Re*Ue-W.y;const xe=ue*ue+fe*fe;if(xe<=2)return new _e(ue,fe);Pe=Math.sqrt(xe/2)}else{let z=!1;pe>Number.EPSILON?Le>Number.EPSILON&&(z=!0):pe<-Number.EPSILON?Le<-Number.EPSILON&&(z=!0):Math.sign(Re)===Math.sign(Se)&&(z=!0),z?(ue=-Re,fe=pe,Pe=Math.sqrt($e)):(ue=pe,fe=Re,Pe=Math.sqrt($e/2))}return new _e(ue/Pe,fe/Pe)}const H=[];for(let W=0,ge=Q.length,he=ge-1,ue=W+1;W<ge;W++,he++,ue++)he===ge&&(he=0),ue===ge&&(ue=0),H[W]=Y(Q[W],Q[he],Q[ue]);const V=[];let D,k=H.concat();for(let W=0,ge=L.length;W<ge;W++){const he=L[W];D=[];for(let ue=0,fe=he.length,Pe=fe-1,pe=ue+1;ue<fe;ue++,Pe++,pe++)Pe===fe&&(Pe=0),pe===fe&&(pe=0),D[ue]=Y(he[ue],he[Pe],he[pe]);V.push(D),k=k.concat(D)}for(let W=0;W<v;W++){const ge=W/v,he=p*Math.cos(ge*Math.PI/2),ue=m*Math.sin(ge*Math.PI/2)+y;for(let fe=0,Pe=Q.length;fe<Pe;fe++){const pe=G(Q[fe],H[fe],ue);te(pe.x,pe.y,-he)}for(let fe=0,Pe=L.length;fe<Pe;fe++){const pe=L[fe];D=V[fe];for(let Re=0,Le=pe.length;Re<Le;Re++){const Se=G(pe[Re],D[Re],ue);te(Se.x,Se.y,-he)}}}const Z=m+y;for(let W=0;W<F;W++){const ge=f?G(B[W],k[W],Z):B[W];E?(T.copy(w.normals[0]).multiplyScalar(ge.x),I.copy(w.binormals[0]).multiplyScalar(ge.y),M.copy(x[0]).add(T).add(I),te(M.x,M.y,M.z)):te(ge.x,ge.y,0)}for(let W=1;W<=u;W++)for(let ge=0;ge<F;ge++){const he=f?G(B[ge],k[ge],Z):B[ge];E?(T.copy(w.normals[W]).multiplyScalar(he.x),I.copy(w.binormals[W]).multiplyScalar(he.y),M.copy(x[W]).add(T).add(I),te(M.x,M.y,M.z)):te(he.x,he.y,h/u*W)}for(let W=v-1;W>=0;W--){const ge=W/v,he=p*Math.cos(ge*Math.PI/2),ue=m*Math.sin(ge*Math.PI/2)+y;for(let fe=0,Pe=Q.length;fe<Pe;fe++){const pe=G(Q[fe],H[fe],ue);te(pe.x,pe.y,h+he)}for(let fe=0,Pe=L.length;fe<Pe;fe++){const pe=L[fe];D=V[fe];for(let Re=0,Le=pe.length;Re<Le;Re++){const Se=G(pe[Re],D[Re],ue);E?te(Se.x,Se.y+x[u-1].y,x[u-1].x+he):te(Se.x,Se.y,h+he)}}}j(),ee();function j(){const W=r.length/3;if(f){let ge=0,he=F*ge;for(let ue=0;ue<q;ue++){const fe=O[ue];re(fe[2]+he,fe[1]+he,fe[0]+he)}ge=u+v*2,he=F*ge;for(let ue=0;ue<q;ue++){const fe=O[ue];re(fe[0]+he,fe[1]+he,fe[2]+he)}}else{for(let ge=0;ge<q;ge++){const he=O[ge];re(he[2],he[1],he[0])}for(let ge=0;ge<q;ge++){const he=O[ge];re(he[0]+F*u,he[1]+F*u,he[2]+F*u)}}i.addGroup(W,r.length/3-W,0)}function ee(){const W=r.length/3;let ge=0;ie(Q,ge),ge+=Q.length;for(let he=0,ue=L.length;he<ue;he++){const fe=L[he];ie(fe,ge),ge+=fe.length}i.addGroup(W,r.length/3-W,1)}function ie(W,ge){let he=W.length;for(;--he>=0;){const ue=he;let fe=he-1;fe<0&&(fe=W.length-1);for(let Pe=0,pe=u+v*2;Pe<pe;Pe++){const Re=F*Pe,Le=F*(Pe+1),Se=ge+ue+Re,$e=ge+fe+Re,X=ge+fe+Le,z=ge+ue+Le;ce(Se,$e,X,z)}}}function te(W,ge,he){l.push(W),l.push(ge),l.push(he)}function re(W,ge,he){ye(W),ye(ge),ye(he);const ue=r.length/3,fe=_.generateTopUV(i,r,ue-3,ue-2,ue-1);oe(fe[0]),oe(fe[1]),oe(fe[2])}function ce(W,ge,he,ue){ye(W),ye(ge),ye(ue),ye(ge),ye(he),ye(ue);const fe=r.length/3,Pe=_.generateSideWallUV(i,r,fe-6,fe-3,fe-2,fe-1);oe(Pe[0]),oe(Pe[1]),oe(Pe[3]),oe(Pe[1]),oe(Pe[2]),oe(Pe[3])}function ye(W){r.push(l[W*3+0]),r.push(l[W*3+1]),r.push(l[W*3+2])}function oe(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,i=this.parameters.options;return FN(t,i,e)}static fromJSON(e,t){const i=[];for(let s=0,a=e.shapes.length;s<a;s++){const o=t[e.shapes[s]];i.push(o)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new W6[r.type]().fromJSON(r)),new K2(i,e.options)}}const ON={generateTopUV:function(n,e,t,i,r){const s=e[t*3],a=e[t*3+1],o=e[i*3],l=e[i*3+1],c=e[r*3],u=e[r*3+1];return[new _e(s,a),new _e(o,l),new _e(c,u)]},generateSideWallUV:function(n,e,t,i,r,s){const a=e[t*3],o=e[t*3+1],l=e[t*3+2],c=e[i*3],u=e[i*3+1],h=e[i*3+2],f=e[r*3],p=e[r*3+1],m=e[r*3+2],y=e[s*3],v=e[s*3+1],A=e[s*3+2];return Math.abs(o-u)<Math.abs(a-c)?[new _e(a,1-l),new _e(c,1-h),new _e(f,1-m),new _e(y,1-A)]:[new _e(o,1-l),new _e(u,1-h),new _e(p,1-m),new _e(v,1-A)]}};function FN(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,r=n.length;i<r;i++){const s=n[i];t.shapes.push(s.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class $2 extends Xl{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(r,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new $2(e.radius,e.detail)}}class f0 extends Xl{constructor(e=1,t=0){const i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(i,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new f0(e.radius,e.detail)}}class J2 extends Bt{constructor(e=.5,t=1,i=32,r=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:s,thetaLength:a},i=Math.max(3,i),r=Math.max(1,r);const o=[],l=[],c=[],u=[];let h=e;const f=(t-e)/r,p=new N,m=new _e;for(let y=0;y<=r;y++){for(let v=0;v<=i;v++){const A=s+v/i*a;p.x=h*Math.cos(A),p.y=h*Math.sin(A),l.push(p.x,p.y,p.z),c.push(0,0,1),m.x=(p.x/t+1)/2,m.y=(p.y/t+1)/2,u.push(m.x,m.y)}h+=f}for(let y=0;y<r;y++){const v=y*(i+1);for(let A=0;A<i;A++){const _=A+v,x=_,E=_+i+1,w=_+i+2,I=_+1;o.push(x,E,I),o.push(E,w,I)}}this.setIndex(o),this.setAttribute("position",new ot(l,3)),this.setAttribute("normal",new ot(c,3)),this.setAttribute("uv",new ot(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new J2(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Z2 extends Bt{constructor(e=new $c([new _e(0,.5),new _e(-.5,-.5),new _e(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],r=[],s=[],a=[];let o=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(o,l,u),o+=l,l=0;this.setIndex(i),this.setAttribute("position",new ot(r,3)),this.setAttribute("normal",new ot(s,3)),this.setAttribute("uv",new ot(a,2));function c(u){const h=r.length/3,f=u.extractPoints(t);let p=f.shape;const m=f.holes;Wa.isClockWise(p)===!1&&(p=p.reverse());for(let v=0,A=m.length;v<A;v++){const _=m[v];Wa.isClockWise(_)===!0&&(m[v]=_.reverse())}const y=Wa.triangulateShape(p,m);for(let v=0,A=m.length;v<A;v++){const _=m[v];p=p.concat(_)}for(let v=0,A=p.length;v<A;v++){const _=p[v];r.push(_.x,_.y,0),s.push(0,0,1),a.push(_.x,_.y)}for(let v=0,A=y.length;v<A;v++){const _=y[v],x=_[0]+h,E=_[1]+h,w=_[2]+h;i.push(x,E,w),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return kN(t,e)}static fromJSON(e,t){const i=[];for(let r=0,s=e.shapes.length;r<s;r++){const a=t[e.shapes[r]];i.push(a)}return new Z2(i,e.curveSegments)}}function kN(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const r=n[t];e.shapes.push(r.uuid)}else e.shapes.push(n.uuid);return e}class d0 extends Bt{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const l=Math.min(a+o,Math.PI);let c=0;const u=[],h=new N,f=new N,p=[],m=[],y=[],v=[];for(let A=0;A<=i;A++){const _=[],x=A/i;let E=0;A===0&&a===0?E=.5/t:A===i&&l===Math.PI&&(E=-.5/t);for(let w=0;w<=t;w++){const I=w/t;h.x=-e*Math.cos(r+I*s)*Math.sin(a+x*o),h.y=e*Math.cos(a+x*o),h.z=e*Math.sin(r+I*s)*Math.sin(a+x*o),m.push(h.x,h.y,h.z),f.copy(h).normalize(),y.push(f.x,f.y,f.z),v.push(I+E,1-x),_.push(c++)}u.push(_)}for(let A=0;A<i;A++)for(let _=0;_<t;_++){const x=u[A][_+1],E=u[A][_],w=u[A+1][_],I=u[A+1][_+1];(A!==0||a>0)&&p.push(x,E,I),(A!==i-1||l<Math.PI)&&p.push(E,w,I)}this.setIndex(p),this.setAttribute("position",new ot(m,3)),this.setAttribute("normal",new ot(y,3)),this.setAttribute("uv",new ot(v,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new d0(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class e1 extends Xl{constructor(e=1,t=0){const i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];super(i,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new e1(e.radius,e.detail)}}class t1 extends Bt{constructor(e=1,t=.4,i=12,r=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:s},i=Math.floor(i),r=Math.floor(r);const a=[],o=[],l=[],c=[],u=new N,h=new N,f=new N;for(let p=0;p<=i;p++)for(let m=0;m<=r;m++){const y=m/r*s,v=p/i*Math.PI*2;h.x=(e+t*Math.cos(v))*Math.cos(y),h.y=(e+t*Math.cos(v))*Math.sin(y),h.z=t*Math.sin(v),o.push(h.x,h.y,h.z),u.x=e*Math.cos(y),u.y=e*Math.sin(y),f.subVectors(h,u).normalize(),l.push(f.x,f.y,f.z),c.push(m/r),c.push(p/i)}for(let p=1;p<=i;p++)for(let m=1;m<=r;m++){const y=(r+1)*p+m-1,v=(r+1)*(p-1)+m-1,A=(r+1)*(p-1)+m,_=(r+1)*p+m;a.push(y,v,_),a.push(v,A,_)}this.setIndex(a),this.setAttribute("position",new ot(o,3)),this.setAttribute("normal",new ot(l,3)),this.setAttribute("uv",new ot(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new t1(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class n1 extends Bt{constructor(e=1,t=.4,i=64,r=8,s=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:s,q:a},i=Math.floor(i),r=Math.floor(r);const o=[],l=[],c=[],u=[],h=new N,f=new N,p=new N,m=new N,y=new N,v=new N,A=new N;for(let x=0;x<=i;++x){const E=x/i*s*Math.PI*2;_(E,s,a,e,p),_(E+.01,s,a,e,m),v.subVectors(m,p),A.addVectors(m,p),y.crossVectors(v,A),A.crossVectors(y,v),y.normalize(),A.normalize();for(let w=0;w<=r;++w){const I=w/r*Math.PI*2,T=-t*Math.cos(I),M=t*Math.sin(I);h.x=p.x+(T*A.x+M*y.x),h.y=p.y+(T*A.y+M*y.y),h.z=p.z+(T*A.z+M*y.z),l.push(h.x,h.y,h.z),f.subVectors(h,p).normalize(),c.push(f.x,f.y,f.z),u.push(x/i),u.push(w/r)}}for(let x=1;x<=i;x++)for(let E=1;E<=r;E++){const w=(r+1)*(x-1)+(E-1),I=(r+1)*x+(E-1),T=(r+1)*x+E,M=(r+1)*(x-1)+E;o.push(w,I,M),o.push(I,T,M)}this.setIndex(o),this.setAttribute("position",new ot(l,3)),this.setAttribute("normal",new ot(c,3)),this.setAttribute("uv",new ot(u,2));function _(x,E,w,I,T){const M=Math.cos(x),b=Math.sin(x),B=w/E*x,L=Math.cos(B);T.x=I*(2+L)*.5*M,T.y=I*(2+L)*b*.5,T.z=I*Math.sin(B)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n1(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class su extends Bt{constructor(e=new V2(new N(-1,-1,0),new N(-1,1,0),new N(1,1,0)),t=64,i=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:s};const a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new N,l=new N,c=new _e;let u=new N;const h=[],f=[],p=[],m=[];y(),this.setIndex(m),this.setAttribute("position",new ot(h,3)),this.setAttribute("normal",new ot(f,3)),this.setAttribute("uv",new ot(p,2));function y(){for(let x=0;x<t;x++)v(x);v(s===!1?t:0),_(),A()}function v(x){u=e.getPointAt(x/t,u);const E=a.normals[x],w=a.binormals[x];for(let I=0;I<=r;I++){const T=I/r*Math.PI*2,M=Math.sin(T),b=-Math.cos(T);l.x=b*E.x+M*w.x,l.y=b*E.y+M*w.y,l.z=b*E.z+M*w.z,l.normalize(),f.push(l.x,l.y,l.z),o.x=u.x+i*l.x,o.y=u.y+i*l.y,o.z=u.z+i*l.z,h.push(o.x,o.y,o.z)}}function A(){for(let x=1;x<=t;x++)for(let E=1;E<=r;E++){const w=(r+1)*(x-1)+(E-1),I=(r+1)*x+(E-1),T=(r+1)*x+E,M=(r+1)*(x-1)+E;m.push(w,I,M),m.push(I,T,M)}}function _(){for(let x=0;x<=t;x++)for(let E=0;E<=r;E++)c.x=x/t,c.y=E/r,p.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new su(new W6[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class _T extends Bt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new N,s=new N;if(e.index!==null){const a=e.attributes.position,o=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){const h=l[c],f=h.start,p=h.count;for(let m=f,y=f+p;m<y;m+=3)for(let v=0;v<3;v++){const A=o.getX(m+v),_=o.getX(m+(v+1)%3);r.fromBufferAttribute(a,A),s.fromBufferAttribute(a,_),vE(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const u=3*o+c,h=3*o+(c+1)%3;r.fromBufferAttribute(a,u),s.fromBufferAttribute(a,h),vE(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new ot(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function vE(n,e,t){const i=`${n.x},${n.y},${n.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${n.x},${n.y},${n.z}`;return t.has(i)===!0||t.has(r)===!0?!1:(t.add(i),t.add(r),!0)}var yE=Object.freeze({__proto__:null,BoxGeometry:qo,CapsuleGeometry:W2,CircleGeometry:Y2,ConeGeometry:q2,CylinderGeometry:yu,DodecahedronGeometry:X2,EdgesGeometry:AT,ExtrudeGeometry:K2,IcosahedronGeometry:$2,LatheGeometry:h0,OctahedronGeometry:f0,PlaneGeometry:Xo,PolyhedronGeometry:Xl,RingGeometry:J2,ShapeGeometry:Z2,SphereGeometry:d0,TetrahedronGeometry:e1,TorusGeometry:t1,TorusKnotGeometry:n1,TubeGeometry:su,WireframeGeometry:_T});class ET extends Ji{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new He(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 tp extends sn{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Y6 extends Ji{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new He(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 He(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yl,this.normalScale=new _e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class ST extends Y6{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 _e(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return si(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 He(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 He(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new He(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class wT extends Ji{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new He(16777215),this.specular=new He(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new He(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yl,this.normalScale=new _e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=a0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class CT extends Ji{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new He(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new He(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yl,this.normalScale=new _e(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 p0 extends Ji{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yl,this.normalScale=new _e(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 TT extends Ji{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new He(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new He(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yl,this.normalScale=new _e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=a0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class bT extends Ji{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new He(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yl,this.normalScale=new _e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class IT extends Rr{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 Ps(n,e,t){return q6(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function Yc(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function q6(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function MT(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function fy(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,a=0;a!==i;++s){const o=t[s]*e;for(let l=0;l!==e;++l)r[a++]=n[o+l]}return r}function X6(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let a=s[i];if(a!==void 0)if(Array.isArray(a))do a=s[i],a!==void 0&&(e.push(s.time),t.push.apply(t,a)),s=n[r++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[i],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do a=s[i],a!==void 0&&(e.push(s.time),t.push(a)),s=n[r++];while(s!==void 0)}function NN(n,e,t,i,r=30){const s=n.clone();s.name=e;const a=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],u=c.getValueSize(),h=[],f=[];for(let p=0;p<c.times.length;++p){const m=c.times[p]*r;if(!(m<t||m>=i)){h.push(c.times[p]);for(let y=0;y<u;++y)f.push(c.values[p*u+y])}}h.length!==0&&(c.times=Yc(h,c.times.constructor),c.values=Yc(f,c.values.constructor),a.push(c))}s.tracks=a;let o=1/0;for(let l=0;l<s.tracks.length;++l)o>s.tracks[l].times[0]&&(o=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*o);return s.resetDuration(),s}function GN(n,e=0,t=n,i=30){i<=0&&(i=30);const r=t.tracks.length,s=e/i;for(let a=0;a<r;++a){const o=t.tracks[a],l=o.ValueTypeName;if(l==="bool"||l==="string")continue;const c=n.tracks.find(function(A){return A.name===o.name&&A.ValueTypeName===l});if(c===void 0)continue;let u=0;const h=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let f=0;const p=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=p/3);const m=o.times.length-1;let y;if(s<=o.times[0]){const A=u,_=h-u;y=Ps(o.values,A,_)}else if(s>=o.times[m]){const A=m*h+u,_=A+h-u;y=Ps(o.values,A,_)}else{const A=o.createInterpolant(),_=u,x=h-u;A.evaluate(s),y=Ps(A.resultBuffer,_,x)}l==="quaternion"&&new $i().fromArray(y).normalize().conjugate().toArray(y);const v=c.times.length;for(let A=0;A<v;++A){const _=A*p+f;if(l==="quaternion")$i.multiplyQuaternionsFlat(c.values,_,y,0,c.values,_);else{const x=p-f*2;for(let E=0;E<x;++E)c.values[_+E]-=y[E]}}}return n.blendMode=b6,n}const zN={arraySlice:Ps,convertArray:Yc,isTypedArray:q6,getKeyframeOrder:MT,sortedArray:fy,flattenJSON:X6,subclip:NN,makeClipAdditive:GN};class g0{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,r=t[i],s=t[i-1];e:{t:{let a;n:{i:if(!(e<r)){for(let o=i+2;;){if(r===void 0){if(e<s)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===o)break;if(s=r,r=t[++i],e<r)break t}a=t.length;break n}if(!(e>=s)){const o=t[1];e<o&&(i=2,s=o);for(let l=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===l)break;if(r=s,s=t[--i-1],e>=s)break t}a=i,i=0;break n}break e}for(;i<a;){const o=i+a>>>1;e<t[o]?a=o:i=o+1}if(r=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r;for(let a=0;a!==r;++a)t[a]=i[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class RT extends g0{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Hc,endingEnd:Hc}}intervalChanged_(e,t,i){const r=this.parameterPositions;let s=e-2,a=e+1,o=r[s],l=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case Vc:s=e,o=2*t-i;break;case bp:s=r.length-2,o=t+r[s]-r[s+1];break;default:s=e,o=i}if(l===void 0)switch(this.getSettings_().endingEnd){case Vc:a=e,l=2*i-t;break;case bp:a=1,l=i+r[1]-r[0];break;default:a=e-1,l=t}const c=(i-t)*.5,u=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-i),this._offsetPrev=s*u,this._offsetNext=a*u}interpolate_(e,t,i,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=this._offsetPrev,h=this._offsetNext,f=this._weightPrev,p=this._weightNext,m=(i-t)/(r-t),y=m*m,v=y*m,A=-f*v+2*f*y-f*m,_=(1+f)*v+(-1.5-2*f)*y+(-.5+f)*m+1,x=(-1-p)*v+(1.5+p)*y+.5*m,E=p*v-p*y;for(let w=0;w!==o;++w)s[w]=A*a[u+w]+_*a[c+w]+x*a[l+w]+E*a[h+w];return s}}class j6 extends g0{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=(i-t)/(r-t),h=1-u;for(let f=0;f!==o;++f)s[f]=a[c+f]*h+a[l+f]*u;return s}}class BT extends g0{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class va{constructor(e,t,i,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Yc(t,this.TimeBufferType),this.values=Yc(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:Yc(e.times,Array),values:Yc(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new BT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new j6(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new RT(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Cp:t=this.InterpolantFactoryMethodDiscrete;break;case Tp:t=this.InterpolantFactoryMethodLinear;break;case um:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Cp;case this.InterpolantFactoryMethodLinear:return Tp;case this.InterpolantFactoryMethodSmooth:return um}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){const i=this.times,r=i.length;let s=0,a=r-1;for(;s!==r&&i[s]<e;)++s;for(;a!==-1&&i[a]>t;)--a;if(++a,s!==0||a!==r){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=Ps(i,s,a),this.values=Ps(this.values,s*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=i[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(r!==void 0&&q6(r))for(let o=0,l=r.length;o!==l;++o){const c=r[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=Ps(this.times),t=Ps(this.values),i=this.getValueSize(),r=this.getInterpolation()===um,s=e.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=e[o],u=e[o+1];if(c!==u&&(o!==1||c!==e[0]))if(r)l=!0;else{const h=o*i,f=h-i,p=h+i;for(let m=0;m!==i;++m){const y=t[h+m];if(y!==t[f+m]||y!==t[p+m]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const h=o*i,f=a*i;for(let p=0;p!==i;++p)t[f+p]=t[h+p]}++a}}if(s>0){e[a]=e[s];for(let o=s*i,l=a*i,c=0;c!==i;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=Ps(e,0,a),this.values=Ps(t,0,a*i)):(this.times=e,this.values=t),this}clone(){const e=Ps(this.times,0),t=Ps(this.values,0),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}va.prototype.TimeBufferType=Float32Array;va.prototype.ValueBufferType=Float32Array;va.prototype.DefaultInterpolation=Tp;class xu extends va{}xu.prototype.ValueTypeName="bool";xu.prototype.ValueBufferType=Array;xu.prototype.DefaultInterpolation=Cp;xu.prototype.InterpolantFactoryMethodLinear=void 0;xu.prototype.InterpolantFactoryMethodSmooth=void 0;class K6 extends va{}K6.prototype.ValueTypeName="color";class Op extends va{}Op.prototype.ValueTypeName="number";class DT extends g0{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(i-t)/(r-t);let c=e*o;for(let u=c+o;c!==u;c+=4)$i.slerpFlat(s,0,a,c-o,a,c,l);return s}}class hf extends va{InterpolantFactoryMethodLinear(e){return new DT(this.times,this.values,this.getValueSize(),e)}}hf.prototype.ValueTypeName="quaternion";hf.prototype.DefaultInterpolation=Tp;hf.prototype.InterpolantFactoryMethodSmooth=void 0;class _u extends va{}_u.prototype.ValueTypeName="string";_u.prototype.ValueBufferType=Array;_u.prototype.DefaultInterpolation=Cp;_u.prototype.InterpolantFactoryMethodLinear=void 0;_u.prototype.InterpolantFactoryMethodSmooth=void 0;class Fp extends va{}Fp.prototype.ValueTypeName="vector";class kp{constructor(e,t=-1,i,r=D2){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=ls(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let a=0,o=i.length;a!==o;++a)t.push(HN(i[a]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=i.length;s!==a;++s)t.push(va.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,a=[];for(let o=0;o<s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const u=MT(l);l=fy(l,1,u),c=fy(c,1,u),!r&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new Op(".morphTargetInfluences["+t[o].name+"]",l,c).scale(1/i))}return new this(e,-1,a)}static findByName(e,t){let i=e;if(!Array.isArray(e)){const r=e;i=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null}static CreateClipsFromMorphTargetSequences(e,t,i){const r={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o<l;o++){const c=e[o],u=c.name.match(s);if(u&&u.length>1){const h=u[1];let f=r[h];f||(r[h]=f=[]),f.push(c)}}const a=[];for(const o in r)a.push(this.CreateFromMorphTargetSequence(o,r[o],t,i));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(h,f,p,m,y){if(p.length!==0){const v=[],A=[];X6(p,v,A,m),v.length!==0&&y.push(new h(f,v,A))}},r=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h<c.length;h++){const f=c[h].keys;if(!(!f||f.length===0))if(f[0].morphTargets){const p={};let m;for(m=0;m<f.length;m++)if(f[m].morphTargets)for(let y=0;y<f[m].morphTargets.length;y++)p[f[m].morphTargets[y]]=-1;for(const y in p){const v=[],A=[];for(let _=0;_!==f[m].morphTargets.length;++_){const x=f[m];v.push(x.time),A.push(x.morphTarget===y?1:0)}r.push(new Op(".morphTargetInfluence["+y+"]",v,A))}l=p.length*a}else{const p=".bones["+t[h].name+"]";i(Fp,p+".position",f,"pos",r),i(hf,p+".quaternion",f,"rot",r),i(Fp,p+".scale",f,"scl",r)}}return r.length===0?null:new this(s,l,r,o)}resetDuration(){const e=this.tracks;let t=0;for(let i=0,r=e.length;i!==r;++i){const s=this.tracks[i];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function QN(n){switch(n.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Op;case"vector":case"vector2":case"vector3":case"vector4":return Fp;case"color":return K6;case"quaternion":return hf;case"bool":case"boolean":return xu;case"string":return _u}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+n)}function HN(n){if(n.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=QN(n.type);if(n.times===void 0){const t=[],i=[];X6(n.keys,t,i,"value"),n.times=t,n.values=i}return e.parse!==void 0?e.parse(n):new e(n.name,n.times,n.values,n.interpolation)}const au={enabled:!1,files:{},add:function(n,e){this.enabled!==!1&&(this.files[n]=e)},get:function(n){if(this.enabled!==!1)return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};class $6{constructor(e,t,i){const r=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(u){o++,s===!1&&r.onStart!==void 0&&r.onStart(u,a,o),s=!0},this.itemEnd=function(u){a++,r.onProgress!==void 0&&r.onProgress(u,a,o),a===o&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){const h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,f=c.length;h<f;h+=2){const p=c[h],m=c[h+1];if(p.global&&(p.lastIndex=0),p.test(u))return m}return null}}}const PT=new $6;class ur{constructor(e){this.manager=e!==void 0?e:PT,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const i=this;return new Promise(function(r,s){i.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}ur.DEFAULT_MATERIAL_NAME="__DEFAULT";const bo={};class VN extends Error{constructor(e,t){super(e),this.response=t}}class Ir extends ur{constructor(e){super(e)}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=au.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(bo[e]!==void 0){bo[e].push({onLoad:t,onProgress:i,onError:r});return}bo[e]=[],bo[e].push({onLoad:t,onProgress:i,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=bo[e],h=c.body.getReader(),f=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),p=f?parseInt(f):0,m=p!==0;let y=0;const v=new ReadableStream({start(A){_();function _(){h.read().then(({done:x,value:E})=>{if(x)A.close();else{y+=E.byteLength;const w=new ProgressEvent("progress",{lengthComputable:m,loaded:y,total:p});for(let I=0,T=u.length;I<T;I++){const M=u[I];M.onProgress&&M.onProgress(w)}A.enqueue(E),_()}})}}});return new Response(v)}else throw new VN(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,o));case"json":return c.json();default:if(o===void 0)return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(o),f=h&&h[1]?h[1].toLowerCase():void 0,p=new TextDecoder(f);return c.arrayBuffer().then(m=>p.decode(m))}}}).then(c=>{au.add(e,c);const u=bo[e];delete bo[e];for(let h=0,f=u.length;h<f;h++){const p=u[h];p.onLoad&&p.onLoad(c)}}).catch(c=>{const u=bo[e];if(u===void 0)throw this.manager.itemError(e),c;delete bo[e];for(let h=0,f=u.length;h<f;h++){const p=u[h];p.onError&&p.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class WN extends ur{constructor(e){super(e)}load(e,t,i,r){const s=this,a=new Ir(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=[];for(let i=0;i<e.length;i++){const r=kp.parse(e[i]);t.push(r)}return t}}class YN extends ur{constructor(e){super(e)}load(e,t,i,r){const s=this,a=[],o=new iu,l=new Ir(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function u(h){l.load(e[h],function(f){const p=s.parse(f,!0);a[h]={width:p.width,height:p.height,format:p.format,mipmaps:p.mipmaps},c+=1,c===6&&(p.mipmapCount===1&&(o.minFilter=Tn),o.image=a,o.format=p.format,o.needsUpdate=!0,t&&t(o))},i,r)}if(Array.isArray(e))for(let h=0,f=e.length;h<f;++h)u(h);else l.load(e,function(h){const f=s.parse(h,!0);if(f.isCubemap){const p=f.mipmaps.length/f.mipmapCount;for(let m=0;m<p;m++){a[m]={mipmaps:[]};for(let y=0;y<f.mipmapCount;y++)a[m].mipmaps.push(f.mipmaps[m*f.mipmapCount+y]),a[m].format=f.format,a[m].width=f.width,a[m].height=f.height}o.image=a}else o.image.width=f.width,o.image.height=f.height,o.mipmaps=f.mipmaps;f.mipmapCount===1&&(o.minFilter=Tn),o.format=f.format,o.needsUpdate=!0,t&&t(o)},i,r);return o}}class Np extends ur{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=au.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o=Rp("img");function l(){u(),au.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),r&&r(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),s.manager.itemStart(e),o.src=e,o}}class qN extends ur{constructor(e){super(e)}load(e,t,i,r){const s=new l0;s.colorSpace=Nt;const a=new Np(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function l(c){a.load(e[c],function(u){s.images[c]=u,o++,o===6&&(s.needsUpdate=!0,t&&t(s))},void 0,r)}for(let c=0;c<e.length;++c)l(c);return s}}class XN extends ur{constructor(e){super(e)}load(e,t,i,r){const s=this,a=new Va,o=new Ir(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(e,function(l){const c=s.parse(l);c&&(c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:oi,a.wrapT=c.wrapT!==void 0?c.wrapT:oi,a.magFilter=c.magFilter!==void 0?c.magFilter:Tn,a.minFilter=c.minFilter!==void 0?c.minFilter:Tn,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0?a.colorSpace=c.colorSpace:c.encoding!==void 0&&(a.encoding=c.encoding),c.flipY!==void 0&&(a.flipY=c.flipY),c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=Ja),c.mipmapCount===1&&(a.minFilter=Tn),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,t&&t(a,c))},i,r),a}}class LT extends ur{constructor(e){super(e)}load(e,t,i,r){const s=new Vn,a=new Np(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class jl extends fn{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new He(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}class UT extends jl{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(fn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new He(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const Ev=new ct,xE=new N,_E=new N;class J6{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new _e(512,512),this.map=null,this.mapPass=null,this.matrix=new ct,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new c0,this._frameExtents=new _e(1,1),this._viewportCount=1,this._viewports=[new jt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;xE.setFromMatrixPosition(e.matrixWorld),t.position.copy(xE),_E.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(_E),t.updateMatrixWorld(),Ev.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ev),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(Ev)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class jN extends J6{constructor(){super(new Kn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=Vh*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class OT extends jl{constructor(e,t,i=0,r=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(fn.DEFAULT_UP),this.updateMatrix(),this.target=new fn,this.distance=i,this.angle=r,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new jN}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const EE=new ct,nd=new N,Sv=new N;class KN extends J6{constructor(){super(new Kn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new _e(4,2),this._viewportCount=6,this._viewports=[new jt(2,1,1,1),new jt(0,1,1,1),new jt(3,1,1,1),new jt(1,1,1,1),new jt(3,0,1,1),new jt(1,0,1,1)],this._cubeDirections=[new N(1,0,0),new N(-1,0,0),new N(0,0,1),new N(0,0,-1),new N(0,1,0),new N(0,-1,0)],this._cubeUps=[new N(0,1,0),new N(0,1,0),new N(0,1,0),new N(0,1,0),new N(0,0,1),new N(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),nd.setFromMatrixPosition(e.matrixWorld),i.position.copy(nd),Sv.copy(i.position),Sv.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(Sv),i.updateMatrixWorld(),r.makeTranslation(-nd.x,-nd.y,-nd.z),EE.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(EE)}}class FT extends jl{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new KN}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class $N extends J6{constructor(){super(new ql(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class kT extends jl{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(fn.DEFAULT_UP),this.updateMatrix(),this.target=new fn,this.shadow=new $N}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class NT extends jl{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class GT extends jl{constructor(e,t,i=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class zT{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new N)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const i=e.x,r=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*s),t.addScaledVector(a[3],.488603*i),t.addScaledVector(a[4],1.092548*(i*r)),t.addScaledVector(a[5],1.092548*(r*s)),t.addScaledVector(a[6],.315392*(3*s*s-1)),t.addScaledVector(a[7],1.092548*(i*s)),t.addScaledVector(a[8],.546274*(i*i-r*r)),t}getIrradianceAt(e,t){const i=e.x,r=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*r),t.addScaledVector(a[2],2*.511664*s),t.addScaledVector(a[3],2*.511664*i),t.addScaledVector(a[4],2*.429043*i*r),t.addScaledVector(a[5],2*.429043*r*s),t.addScaledVector(a[6],.743125*s*s-.247708),t.addScaledVector(a[7],2*.429043*i*s),t.addScaledVector(a[8],.429043*(i*i-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){const i=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*i,t[4]=1.092548*i*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*i*s,t[8]=.546274*(i*i-r*r)}}class i1 extends jl{constructor(e=new zT,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class r1 extends ur{constructor(e){super(e),this.textures={}}load(e,t,i,r){const s=this,a=new Ir(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=this.textures;function i(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const r=r1.createMaterialFromType(e.type);if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=e.sheen),e.sheenColor!==void 0&&(r.sheenColor=new He().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(r.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&r.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular!==void 0&&r.specular.setHex(e.specular),e.specularIntensity!==void 0&&(r.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&r.specularColor!==void 0&&r.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.iridescence!==void 0&&(r.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(r.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(r.transmission=e.transmission),e.thickness!==void 0&&(r.thickness=e.thickness),e.attenuationDistance!==void 0&&(r.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&r.attenuationColor!==void 0&&r.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(r.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(r.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.shadowSide!==void 0&&(r.shadowSide=e.shadowSide),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(r.alphaHash=e.alphaHash),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==1&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(r.dithering=e.dithering),e.alphaToCoverage!==void 0&&(r.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(r.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(r.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const a=e.uniforms[s];switch(r.uniforms[s]={},a.type){case"t":r.uniforms[s].value=i(a.value);break;case"c":r.uniforms[s].value=new He().setHex(a.value);break;case"v2":r.uniforms[s].value=new _e().fromArray(a.value);break;case"v3":r.uniforms[s].value=new N().fromArray(a.value);break;case"v4":r.uniforms[s].value=new jt().fromArray(a.value);break;case"m3":r.uniforms[s].value=new Qt().fromArray(a.value);break;case"m4":r.uniforms[s].value=new ct().fromArray(a.value);break;default:r.uniforms[s].value=a.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=i(e.map)),e.matcap!==void 0&&(r.matcap=i(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new _e().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=i(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new _e().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=i(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=i(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=i(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:ET,SpriteMaterial:O6,RawShaderMaterial:tp,ShaderMaterial:sn,PointsMaterial:k6,MeshPhysicalMaterial:ST,MeshStandardMaterial:Y6,MeshPhongMaterial:wT,MeshToonMaterial:CT,MeshNormalMaterial:p0,MeshLambertMaterial:TT,MeshDepthMaterial:u0,MeshDistanceMaterial:F2,MeshBasicMaterial:cs,MeshMatcapMaterial:bT,LineDashedMaterial:IT,LineBasicMaterial:Rr,Material:Ji};return new t[e]}}class dy{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i<r;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Z6 extends Bt{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 QT extends ur{constructor(e){super(e)}load(e,t,i,r){const s=this,a=new Ir(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t={},i={};function r(p,m){if(t[m]!==void 0)return t[m];const v=p.interleavedBuffers[m],A=s(p,v.buffer),_=Ch(v.type,A),x=new G2(_,v.stride);return x.uuid=v.uuid,t[m]=x,x}function s(p,m){if(i[m]!==void 0)return i[m];const v=p.arrayBuffers[m],A=new Uint32Array(v).buffer;return i[m]=A,A}const a=e.isInstancedBufferGeometry?new Z6:new Bt,o=e.data.index;if(o!==void 0){const p=Ch(o.type,o.array);a.setIndex(new En(p,1))}const l=e.data.attributes;for(const p in l){const m=l[p];let y;if(m.isInterleavedBufferAttribute){const v=r(e.data,m.data);y=new tu(v,m.itemSize,m.offset,m.normalized)}else{const v=Ch(m.type,m.array),A=m.isInstancedBufferAttribute?nu:En;y=new A(v,m.itemSize,m.normalized)}m.name!==void 0&&(y.name=m.name),m.usage!==void 0&&y.setUsage(m.usage),m.updateRange!==void 0&&(y.updateRange.offset=m.updateRange.offset,y.updateRange.count=m.updateRange.count),a.setAttribute(p,y)}const c=e.data.morphAttributes;if(c)for(const p in c){const m=c[p],y=[];for(let v=0,A=m.length;v<A;v++){const _=m[v];let x;if(_.isInterleavedBufferAttribute){const E=r(e.data,_.data);x=new tu(E,_.itemSize,_.offset,_.normalized)}else{const E=Ch(_.type,_.array);x=new En(E,_.itemSize,_.normalized)}_.name!==void 0&&(x.name=_.name),y.push(x)}a.morphAttributes[p]=y}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let p=0,m=h.length;p!==m;++p){const y=h[p];a.addGroup(y.start,y.count,y.materialIndex)}const f=e.data.boundingSphere;if(f!==void 0){const p=new N;f.center!==void 0&&p.fromArray(f.center),a.boundingSphere=new ms(p,f.radius)}return e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}}class JN extends ur{constructor(e){super(e)}load(e,t,i,r){const s=this,a=this.path===""?dy.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const o=new Ir(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(h){r!==void 0&&r(h),console.error("THREE:ObjectLoader: Can't parse "+e+".",h.message);return}const u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){r!==void 0&&r(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,t)},i,r)}async loadAsync(e,t){const i=this,r=this.path===""?dy.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||r;const s=new Ir(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const a=await s.loadAsync(e,t),o=JSON.parse(a),l=o.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await i.parseAsync(o)}parse(e,t){const i=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,r),a=this.parseImages(e.images,function(){t!==void 0&&t(c)}),o=this.parseTextures(e.textures,a),l=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,s,l,o,i),u=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,u),t!==void 0){let h=!1;for(const f in a)if(a[f].data instanceof HTMLImageElement){h=!0;break}h===!1&&t(c)}return c}async parseAsync(e){const t=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),s=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,s),o=this.parseMaterials(e.materials,a),l=this.parseObject(e.object,r,o,a,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),l}parseShapes(e){const t={};if(e!==void 0)for(let i=0,r=e.length;i<r;i++){const s=new $c().fromJSON(e[i]);t[s.uuid]=s}return t}parseSkeletons(e,t){const i={},r={};if(t.traverse(function(s){s.isBone&&(r[s.uuid]=s)}),e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=new z2().fromJSON(e[s],r);i[o.uuid]=o}return i}parseGeometries(e,t){const i={};if(e!==void 0){const r=new QT;for(let s=0,a=e.length;s<a;s++){let o;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":o=r.parse(l);break;default:l.type in yE?o=yE[l.type].fromJSON(l,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}o.uuid=l.uuid,l.name!==void 0&&(o.name=l.name),l.userData!==void 0&&(o.userData=l.userData),i[l.uuid]=o}}return i}parseMaterials(e,t){const i={},r={};if(e!==void 0){const s=new r1;s.setTextures(t);for(let a=0,o=e.length;a<o;a++){const l=e[a];i[l.uuid]===void 0&&(i[l.uuid]=s.parse(l)),r[l.uuid]=i[l.uuid]}}return r}parseAnimations(e){const t={};if(e!==void 0)for(let i=0;i<e.length;i++){const r=e[i],s=kp.parse(r);t[s.uuid]=s}return t}parseImages(e,t){const i=this,r={};let s;function a(l){return i.manager.itemStart(l),s.load(l,function(){i.manager.itemEnd(l)},void 0,function(){i.manager.itemError(l),i.manager.itemEnd(l)})}function o(l){if(typeof l=="string"){const c=l,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:i.resourcePath+c;return a(u)}else return l.data?{data:Ch(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new $6(t);s=new Np(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c<u;c++){const h=e[c],f=h.url;if(Array.isArray(f)){const p=[];for(let m=0,y=f.length;m<y;m++){const v=f[m],A=o(v);A!==null&&(A instanceof HTMLImageElement?p.push(A):p.push(new Va(A.data,A.width,A.height)))}r[h.uuid]=new Wc(p)}else{const p=o(h.url);r[h.uuid]=new Wc(p)}}}return r}async parseImagesAsync(e){const t=this,i={};let r;async function s(a){if(typeof a=="string"){const o=a,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(o)?o:t.resourcePath+o;return await r.loadAsync(l)}else return a.data?{data:Ch(a.type,a.data),width:a.width,height:a.height}:null}if(e!==void 0&&e.length>0){r=new Np(this.manager),r.setCrossOrigin(this.crossOrigin);for(let a=0,o=e.length;a<o;a++){const l=e[a],c=l.url;if(Array.isArray(c)){const u=[];for(let h=0,f=c.length;h<f;h++){const p=c[h],m=await s(p);m!==null&&(m instanceof HTMLImageElement?u.push(m):u.push(new Va(m.data,m.width,m.height)))}i[l.uuid]=new Wc(u)}else{const u=await s(l.url);i[l.uuid]=new Wc(u)}}}return i}parseTextures(e,t){function i(s,a){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),a[s])}const r={};if(e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=e[s];o.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),t[o.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",o.image);const l=t[o.image],c=l.data;let u;Array.isArray(c)?(u=new l0,c.length===6&&(u.needsUpdate=!0)):(c&&c.data?u=new Va:u=new Vn,c&&(u.needsUpdate=!0)),u.source=l,u.uuid=o.uuid,o.name!==void 0&&(u.name=o.name),o.mapping!==void 0&&(u.mapping=i(o.mapping,ZN)),o.channel!==void 0&&(u.channel=o.channel),o.offset!==void 0&&u.offset.fromArray(o.offset),o.repeat!==void 0&&u.repeat.fromArray(o.repeat),o.center!==void 0&&u.center.fromArray(o.center),o.rotation!==void 0&&(u.rotation=o.rotation),o.wrap!==void 0&&(u.wrapS=i(o.wrap[0],SE),u.wrapT=i(o.wrap[1],SE)),o.format!==void 0&&(u.format=o.format),o.internalFormat!==void 0&&(u.internalFormat=o.internalFormat),o.type!==void 0&&(u.type=o.type),o.colorSpace!==void 0&&(u.colorSpace=o.colorSpace),o.encoding!==void 0&&(u.encoding=o.encoding),o.minFilter!==void 0&&(u.minFilter=i(o.minFilter,wE)),o.magFilter!==void 0&&(u.magFilter=i(o.magFilter,wE)),o.anisotropy!==void 0&&(u.anisotropy=o.anisotropy),o.flipY!==void 0&&(u.flipY=o.flipY),o.generateMipmaps!==void 0&&(u.generateMipmaps=o.generateMipmaps),o.premultiplyAlpha!==void 0&&(u.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(u.unpackAlignment=o.unpackAlignment),o.compareFunction!==void 0&&(u.compareFunction=o.compareFunction),o.userData!==void 0&&(u.userData=o.userData),r[o.uuid]=u}return r}parseObject(e,t,i,r,s){let a;function o(f){return t[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",f),t[f]}function l(f){if(f!==void 0){if(Array.isArray(f)){const p=[];for(let m=0,y=f.length;m<y;m++){const v=f[m];i[v]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",v),p.push(i[v])}return p}return i[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",f),i[f]}}function c(f){return r[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",f),r[f]}let u,h;switch(e.type){case"Scene":a=new Bp,e.background!==void 0&&(Number.isInteger(e.background)?a.background=new He(e.background):a.background=c(e.background)),e.environment!==void 0&&(a.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?a.fog=new N2(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(a.fog=new k2(e.fog.color,e.fog.density))),e.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(a.backgroundIntensity=e.backgroundIntensity);break;case"PerspectiveCamera":a=new Kn(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(a.focus=e.focus),e.zoom!==void 0&&(a.zoom=e.zoom),e.filmGauge!==void 0&&(a.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(a.filmOffset=e.filmOffset),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new ql(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(a.zoom=e.zoom),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new NT(e.color,e.intensity);break;case"DirectionalLight":a=new kT(e.color,e.intensity);break;case"PointLight":a=new FT(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new GT(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new OT(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":a=new UT(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=new i1().fromJSON(e);break;case"SkinnedMesh":u=o(e.geometry),h=l(e.material),a=new uT(u,h),e.bindMode!==void 0&&(a.bindMode=e.bindMode),e.bindMatrix!==void 0&&a.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(a.skeleton=e.skeleton);break;case"Mesh":u=o(e.geometry),h=l(e.material),a=new nn(u,h);break;case"InstancedMesh":u=o(e.geometry),h=l(e.material);const f=e.count,p=e.instanceMatrix,m=e.instanceColor;a=new hT(u,h,f),a.instanceMatrix=new nu(new Float32Array(p.array),16),m!==void 0&&(a.instanceColor=new nu(new Float32Array(m.array),m.itemSize));break;case"LOD":a=new cT;break;case"Line":a=new Gl(o(e.geometry),l(e.material));break;case"LineLoop":a=new fT(o(e.geometry),l(e.material));break;case"LineSegments":a=new to(o(e.geometry),l(e.material));break;case"PointCloud":case"Points":a=new N6(o(e.geometry),l(e.material));break;case"Sprite":a=new lT(l(e.material));break;case"Group":a=new bh;break;case"Bone":a=new F6;break;default:a=new fn}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.up!==void 0&&a.up.fromArray(e.up),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){const f=e.children;for(let p=0;p<f.length;p++)a.add(this.parseObject(f[p],t,i,r,s))}if(e.animations!==void 0){const f=e.animations;for(let p=0;p<f.length;p++){const m=f[p];a.animations.push(s[m])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(a.autoUpdate=e.autoUpdate);const f=e.levels;for(let p=0;p<f.length;p++){const m=f[p],y=a.getObjectByProperty("uuid",m.object);y!==void 0&&a.addLevel(y,m.distance,m.hysteresis)}}return a}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(i){if(i.isSkinnedMesh===!0&&i.skeleton!==void 0){const r=t[i.skeleton];r===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",i.skeleton):i.bind(r,i.bindMatrix)}})}}const ZN={UVMapping:R2,CubeReflectionMapping:Fl,CubeRefractionMapping:kl,EquirectangularReflectionMapping:Ap,EquirectangularRefractionMapping:vp,CubeUVReflectionMapping:of},SE={RepeatWrapping:Qo,ClampToEdgeWrapping:oi,MirroredRepeatWrapping:yp},wE={NearestFilter:Rt,NearestMipmapNearestFilter:Bm,NearestMipmapLinearFilter:Kd,LinearFilter:Tn,LinearMipmapNearestFilter:y6,LinearMipmapLinearFilter:Ja};class eG extends ur{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=au.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){au.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){r&&r(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}let yg;class e4{static getContext(){return yg===void 0&&(yg=new(window.AudioContext||window.webkitAudioContext)),yg}static setContext(e){yg=e}}class tG extends ur{constructor(e){super(e)}load(e,t,i,r){const s=this,a=new Ir(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{const c=l.slice(0);e4.getContext().decodeAudioData(c,function(h){t(h)},o)}catch(c){o(c)}},i,r);function o(l){r?r(l):console.error(l),s.manager.itemError(e)}}}class nG extends i1{constructor(e,t,i=1){super(void 0,i),this.isHemisphereLightProbe=!0;const r=new He().set(e),s=new He().set(t),a=new N(r.r,r.g,r.b),o=new N(s.r,s.g,s.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(l),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(c)}}class iG extends i1{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const i=new He().set(e);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const CE=new ct,TE=new ct,Ec=new ct;class rG{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Kn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Kn,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,Ec.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,a=t.near*Math.tan(jc*t.fov*.5)/t.zoom;let o,l;TE.elements[12]=-r,CE.elements[12]=r,o=-a*t.aspect+s,l=a*t.aspect+s,Ec.elements[0]=2*t.near/(l-o),Ec.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(Ec),o=-a*t.aspect-s,l=a*t.aspect-s,Ec.elements[0]=2*t.near/(l-o),Ec.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(Ec)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(TE),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(CE)}}class s1{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=bE(),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=bE();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function bE(){return(typeof performance>"u"?Date:performance).now()}const Sc=new N,IE=new $i,sG=new N,wc=new N;class aG extends fn{constructor(){super(),this.type="AudioListener",this.context=e4.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new s1}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Sc,IE,sG),wc.set(0,0,-1).applyQuaternion(IE),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Sc.x,r),t.positionY.linearRampToValueAtTime(Sc.y,r),t.positionZ.linearRampToValueAtTime(Sc.z,r),t.forwardX.linearRampToValueAtTime(wc.x,r),t.forwardY.linearRampToValueAtTime(wc.y,r),t.forwardZ.linearRampToValueAtTime(wc.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(Sc.x,Sc.y,Sc.z),t.setOrientation(wc.x,wc.y,wc.z,i.x,i.y,i.z)}}class HT extends fn{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const Cc=new N,ME=new $i,oG=new N,Tc=new N;class lG extends HT{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,i){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=i,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Cc,ME,oG),Tc.set(0,0,1).applyQuaternion(ME);const t=this.panner;if(t.positionX){const i=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Cc.x,i),t.positionY.linearRampToValueAtTime(Cc.y,i),t.positionZ.linearRampToValueAtTime(Cc.z,i),t.orientationX.linearRampToValueAtTime(Tc.x,i),t.orientationY.linearRampToValueAtTime(Tc.y,i),t.orientationZ.linearRampToValueAtTime(Tc.z,i)}else t.setPosition(Cc.x,Cc.y,Cc.z),t.setOrientation(Tc.x,Tc.y,Tc.z)}}class cG{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let i=0;i<t.length;i++)e+=t[i];return e/t.length}}class VT{constructor(e,t,i){this.binding=e,this.valueSize=i;let r,s,a;switch(t){case"quaternion":r=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":r=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:r=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const i=this.buffer,r=this.valueSize,s=e*r+r;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==r;++o)i[s+o]=i[o];a=t}else{a+=t;const o=t/a;this._mixBufferRegion(i,s,0,o,r)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,i=this.valueSize,r=i*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,i=this.buffer,r=e*t+t,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(i,r,l,1-s,t)}a>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(i[l]!==i[l+t]){o.setValue(i,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let s=i,a=r;s!==a;++s)t[s]=t[r+s%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i<t;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,r,s){if(r>=.5)for(let a=0;a!==s;++a)e[t+a]=e[i+a]}_slerp(e,t,i,r){$i.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const a=this._workIndex*s;$i.multiplyQuaternionsFlat(e,a,e,t,e,i),$i.slerpFlat(e,t,e,t,e,a,r)}_lerp(e,t,i,r,s){const a=1-r;for(let o=0;o!==s;++o){const l=t+o;e[l]=e[l]*a+e[i+o]*r}}_lerpAdditive(e,t,i,r,s){for(let a=0;a!==s;++a){const o=t+a;e[o]=e[o]+e[i+a]*r}}}const t4="\\[\\]\\.:\\/",uG=new RegExp("["+t4+"]","g"),n4="[^"+t4+"]",hG="[^"+t4.replace("\\.","")+"]",fG=/((?:WC+[\/:])*)/.source.replace("WC",n4),dG=/(WCOD+)?/.source.replace("WCOD",hG),pG=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",n4),gG=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",n4),mG=new RegExp("^"+fG+dG+pG+gG+"$"),AG=["material","materials","bones","map"];class vG{constructor(e,t,i){const r=i||rn.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class rn{constructor(e,t,i){this.path=t,this.parsedPath=i||rn.parseTrackName(t),this.node=rn.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new rn.Composite(e,t,i):new rn(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(uG,"")}static parseTrackName(e){const t=mG.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);AG.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let a=0;a<s.length;a++){const o=s[a];if(o.name===t||o.uuid===t)return o;const l=i(o.children);if(l)return l}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,i=t.objectName,r=t.propertyName;let s=t.propertyIndex;if(e||(e=rn.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(i){let c=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const a=e[r];if(a===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?o=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}rn.Composite=vG;rn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};rn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};rn.prototype.GetterByBindingType=[rn.prototype._getValue_direct,rn.prototype._getValue_array,rn.prototype._getValue_arrayElement,rn.prototype._getValue_toArray];rn.prototype.SetterByBindingTypeAndVersioning=[[rn.prototype._setValue_direct,rn.prototype._setValue_direct_setNeedsUpdate,rn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[rn.prototype._setValue_array,rn.prototype._setValue_array_setNeedsUpdate,rn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[rn.prototype._setValue_arrayElement,rn.prototype._setValue_arrayElement_setNeedsUpdate,rn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[rn.prototype._setValue_fromArray,rn.prototype._setValue_fromArray_setNeedsUpdate,rn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class yG{constructor(){this.isAnimationObjectGroup=!0,this.uuid=ls(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let i=0,r=arguments.length;i!==r;++i)e[arguments[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,i=this._paths,r=this._parsedPaths,s=this._bindings,a=s.length;let o,l=e.length,c=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){const f=arguments[u],p=f.uuid;let m=t[p];if(m===void 0){m=l++,t[p]=m,e.push(f);for(let y=0,v=a;y!==v;++y)s[y].push(new rn(f,i[y],r[y]))}else if(m<c){o=e[m];const y=--c,v=e[y];t[v.uuid]=m,e[m]=v,t[p]=y,e[y]=f;for(let A=0,_=a;A!==_;++A){const x=s[A],E=x[y];let w=x[m];x[m]=E,w===void 0&&(w=new rn(f,i[A],r[A])),x[y]=w}}else e[m]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_;for(let a=0,o=arguments.length;a!==o;++a){const l=arguments[a],c=l.uuid,u=t[c];if(u!==void 0&&u>=s){const h=s++,f=e[h];t[f.uuid]=u,e[u]=f,t[c]=h,e[h]=l;for(let p=0,m=r;p!==m;++p){const y=i[p],v=y[h],A=y[u];y[u]=v,y[h]=A}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_,a=e.length;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],u=c.uuid,h=t[u];if(h!==void 0)if(delete t[u],h<s){const f=--s,p=e[f],m=--a,y=e[m];t[p.uuid]=h,e[h]=p,t[y.uuid]=f,e[f]=y,e.pop();for(let v=0,A=r;v!==A;++v){const _=i[v],x=_[f],E=_[m];_[h]=x,_[f]=E,_.pop()}}else{const f=--a,p=e[f];f>0&&(t[p.uuid]=h),e[h]=p,e.pop();for(let m=0,y=r;m!==y;++m){const v=i[m];v[h]=v[f],v.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const i=this._bindingsIndicesByPath;let r=i[e];const s=this._bindings;if(r!==void 0)return s[r];const a=this._paths,o=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);r=s.length,i[e]=r,a.push(e),o.push(t),s.push(h);for(let f=u,p=l.length;f!==p;++f){const m=l[f];h[f]=new rn(m,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const r=this._paths,s=this._parsedPaths,a=this._bindings,o=a.length-1,l=a[o],c=e[o];t[c]=i,a[i]=l,a.pop(),s[i]=s[o],s.pop(),r[i]=r[o],r.pop()}}}class WT{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;const s=t.tracks,a=s.length,o=new Array(a),l={endingStart:Hc,endingEnd:Hc};for(let c=0;c!==a;++c){const u=s[c].createInterpolant(null);o[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=LC,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){const r=this._clip.duration,s=e._clip.duration,a=s/r,o=r/s;e.warp(1,a,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){const r=this._mixer,s=r.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=s,l[1]=s+i,c[0]=e/a,c[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*i;l<0||i===0?t=0:(this._startTime=null,t=i*l)}t*=this._updateTimeScale(e);const a=this._updateTime(t),o=this._updateWeight(e);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case b6:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(a),c[u].accumulateAdditive(o);break;case D2:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(a),c[u].accumulate(r,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let r=this.time+e,s=this._loopCount;const a=i===UC;if(e===0)return s===-1?r:a&&(s&1)===1?t-r:r;if(i===PC){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),r>=t||r<0){const o=Math.floor(r/t);r-=t*o,s+=Math.abs(o);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=r;if(a&&(s&1)===1)return t-r}return r}_setEndings(e,t,i){const r=this._interpolantSettings;i?(r.endingStart=Vc,r.endingEnd=Vc):(e?r.endingStart=this.zeroSlopeAtStart?Vc:Hc:r.endingStart=bp,t?r.endingEnd=this.zeroSlopeAtEnd?Vc:Hc:r.endingEnd=bp)}_scheduleFading(e,t,i){const r=this._mixer,s=r.time;let a=this._weightInterpolant;a===null&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,l[0]=t,o[1]=s+e,l[1]=i,this}}const xG=new Float32Array(1);class _G extends Yo{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,r=e._clip.tracks,s=r.length,a=e._propertyBindings,o=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){const f=r[h],p=f.name;let m=u[p];if(m!==void 0)++m.referenceCount,a[h]=m;else{if(m=a[h],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,p));continue}const y=t&&t._propertyBindings[h].binding.parsedPath;m=new VT(rn.create(i,p,y),f.ValueTypeName,f.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,p),a[h]=m}o[h].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,i)}const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,i){const r=this._actions,s=this._actionsByClip;let a=s[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=a;else{const o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[i]=e}_removeInactiveAction(e){const t=this._actions,i=t[t.length-1],r=e._cacheIndex;i._cacheIndex=r,t[r]=i,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,a=this._actionsByClip,o=a[s],l=o.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;const h=o.actionByRoot,f=(e._localRoot||this._root).uuid;delete h[f],l.length===0&&delete a[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackAction(e){const t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_addInactiveBinding(e,t,i){const r=this._bindingsByRootAndName,s=this._bindings;let a=r[t];a===void 0&&(a={},r[t]=a),a[i]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,i=e.binding,r=i.rootNode.uuid,s=i.path,a=this._bindingsByRootAndName,o=a[r],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete o[s],Object.keys(o).length===0&&delete a[r]}_lendBinding(e){const t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackBinding(e){const t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let i=e[t];return i===void 0&&(i=new j6(new Float32Array(2),new Float32Array(2),1,xG),i.__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){const t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,s=t[r];e.__cacheIndex=r,t[r]=e,s.__cacheIndex=i,t[i]=s}clipAction(e,t,i){const r=t||this._root,s=r.uuid;let a=typeof e=="string"?kp.findByName(r,e):e;const o=a!==null?a.uuid:e,l=this._actionsByClip[o];let c=null;if(i===void 0&&(a!==null?i=a.blendMode:i=D2),l!==void 0){const h=l.actionByRoot[s];if(h!==void 0&&h.blendMode===i)return h;c=l.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;const u=new WT(this,a,t,i);return this._bindAction(u,c),this._addInactiveAction(u,o,s),u}existingAction(e,t){const i=t||this._root,r=i.uuid,s=typeof e=="string"?kp.findByName(i,e):e,a=s?s.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[r]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,r=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let c=0;c!==i;++c)t[c]._update(r,e,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,i=e.uuid,r=this._actionsByClip,s=r[i];if(s!==void 0){const a=s.knownActions;for(let o=0,l=a.length;o!==l;++o){const c=a[o];this._deactivateAction(c);const u=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[i]}}uncacheRoot(e){const t=e.uuid,i=this._actionsByClip;for(const a in i){const o=i[a].actionByRoot,l=o[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const r=this._bindingsByRootAndName,s=r[t];if(s!==void 0)for(const a in s){const o=s[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){const i=this.existingAction(e,t);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class i4{constructor(e){this.value=e}clone(){return new i4(this.value.clone===void 0?this.value:this.value.clone())}}let EG=0;class SG extends Yo{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:EG++}),this.name="",this.usage=Ip,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let i=0,r=t.length;i<r;i++)this.uniforms.push(t[i].clone());return this}clone(){return new this.constructor().copy(this)}}class wG extends G2{constructor(e,t,i=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class CG{constructor(e,t,i,r,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=i,this.elementSize=r,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}class r4{constructor(e,t,i=0,r=1/0){this.ray=new lf(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new Kc,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,i=[]){return py(e,this,i,t),i.sort(RE),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)py(e[r],this,i,t);return i.sort(RE),i}}function RE(n,e){return n.distance-e.distance}function py(n,e,t,i){if(n.layers.test(e.layers)&&n.raycast(e,t),i===!0){const r=n.children;for(let s=0,a=r.length;s<a;s++)py(r[s],e,t,!0)}}class YT{constructor(e=1,t=0,i=0){return this.radius=e,this.phi=t,this.theta=i,this}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(si(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class TG{constructor(e=1,t=0,i=0){return this.radius=e,this.theta=t,this.y=i,this}set(e,t,i){return this.radius=e,this.theta=t,this.y=i,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+i*i),this.theta=Math.atan2(e,i),this.y=t,this}clone(){return new this.constructor().copy(this)}}const BE=new _e;class qT{constructor(e=new _e(1/0,1/0),t=new _e(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=BE.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,BE).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 DE=new N,xg=new N;class bG{constructor(e=new N,t=new N){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){DE.subVectors(e,this.start),xg.subVectors(this.end,this.start);const i=xg.dot(xg);let s=xg.dot(DE)/i;return t&&(s=si(s,0,1)),s}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const PE=new N;class IG extends fn{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new Bt,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,o=1,l=32;a<l;a++,o++){const c=a/l*Math.PI*2,u=o/l*Math.PI*2;r.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}i.setAttribute("position",new ot(r,3));const s=new Rr({fog:!1,toneMapped:!1});this.cone=new to(i,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),PE.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(PE),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const gl=new N,_g=new ct,wv=new ct;class MG extends to{constructor(e){const t=XT(e),i=new Bt,r=[],s=[],a=new He(0,0,1),o=new He(0,1,0);for(let c=0;c<t.length;c++){const u=t[c];u.parent&&u.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),s.push(a.r,a.g,a.b),s.push(o.r,o.g,o.b))}i.setAttribute("position",new ot(r,3)),i.setAttribute("color",new ot(s,3));const l=new Rr({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,i=this.geometry,r=i.getAttribute("position");wv.copy(this.root.matrixWorld).invert();for(let s=0,a=0;s<t.length;s++){const o=t[s];o.parent&&o.parent.isBone&&(_g.multiplyMatrices(wv,o.matrixWorld),gl.setFromMatrixPosition(_g),r.setXYZ(a,gl.x,gl.y,gl.z),_g.multiplyMatrices(wv,o.parent.matrixWorld),gl.setFromMatrixPosition(_g),r.setXYZ(a+1,gl.x,gl.y,gl.z),a+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function XT(n){const e=[];n.isBone===!0&&e.push(n);for(let t=0;t<n.children.length;t++)e.push.apply(e,XT(n.children[t]));return e}class RG extends nn{constructor(e,t,i){const r=new d0(t,4,2),s=new cs({wireframe:!0,fog:!1,toneMapped:!1});super(r,s),this.light=e,this.color=i,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const BG=new N,LE=new He,UE=new He;class DG extends fn{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const r=new f0(t);r.rotateY(Math.PI*.5),this.material=new cs({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=r.getAttribute("position"),a=new Float32Array(s.count*3);r.setAttribute("color",new En(a,3)),this.add(new nn(r,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");LE.copy(this.light.color),UE.copy(this.light.groundColor);for(let i=0,r=t.count;i<r;i++){const s=i<r/2?LE:UE;t.setXYZ(i,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(BG.setFromMatrixPosition(this.light.matrixWorld).negate())}}class PG extends to{constructor(e=10,t=10,i=4473924,r=8947848){i=new He(i),r=new He(r);const s=t/2,a=e/t,o=e/2,l=[],c=[];for(let f=0,p=0,m=-o;f<=t;f++,m+=a){l.push(-o,0,m,o,0,m),l.push(m,0,-o,m,0,o);const y=f===s?i:r;y.toArray(c,p),p+=3,y.toArray(c,p),p+=3,y.toArray(c,p),p+=3,y.toArray(c,p),p+=3}const u=new Bt;u.setAttribute("position",new ot(l,3)),u.setAttribute("color",new ot(c,3));const h=new Rr({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class LG extends to{constructor(e=10,t=16,i=8,r=64,s=4473924,a=8947848){s=new He(s),a=new He(a);const o=[],l=[];if(t>1)for(let h=0;h<t;h++){const f=h/t*(Math.PI*2),p=Math.sin(f)*e,m=Math.cos(f)*e;o.push(0,0,0),o.push(p,0,m);const y=h&1?s:a;l.push(y.r,y.g,y.b),l.push(y.r,y.g,y.b)}for(let h=0;h<i;h++){const f=h&1?s:a,p=e-e/i*h;for(let m=0;m<r;m++){let y=m/r*(Math.PI*2),v=Math.sin(y)*p,A=Math.cos(y)*p;o.push(v,0,A),l.push(f.r,f.g,f.b),y=(m+1)/r*(Math.PI*2),v=Math.sin(y)*p,A=Math.cos(y)*p,o.push(v,0,A),l.push(f.r,f.g,f.b)}}const c=new Bt;c.setAttribute("position",new ot(o,3)),c.setAttribute("color",new ot(l,3));const u=new Rr({vertexColors:!0,toneMapped:!1});super(c,u),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const OE=new N,Eg=new N,FE=new N;class UG extends fn{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",t===void 0&&(t=1);let r=new Bt;r.setAttribute("position",new ot([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new Rr({fog:!1,toneMapped:!1});this.lightPlane=new Gl(r,s),this.add(this.lightPlane),r=new Bt,r.setAttribute("position",new ot([0,0,0,0,0,1],3)),this.targetLine=new Gl(r,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),OE.setFromMatrixPosition(this.light.matrixWorld),Eg.setFromMatrixPosition(this.light.target.matrixWorld),FE.subVectors(Eg,OE),this.lightPlane.lookAt(Eg),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(Eg),this.targetLine.scale.z=FE.length()}}const Sg=new N,ii=new o0;class OG extends to{constructor(e){const t=new Bt,i=new Rr({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],s=[],a={};o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4");function o(m,y){l(m),l(y)}function l(m){r.push(0,0,0),s.push(0,0,0),a[m]===void 0&&(a[m]=[]),a[m].push(r.length/3-1)}t.setAttribute("position",new ot(r,3)),t.setAttribute("color",new ot(s,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();const c=new He(16755200),u=new He(16711680),h=new He(43775),f=new He(16777215),p=new He(3355443);this.setColors(c,u,h,f,p)}setColors(e,t,i,r,s){const o=this.geometry.getAttribute("color");o.setXYZ(0,e.r,e.g,e.b),o.setXYZ(1,e.r,e.g,e.b),o.setXYZ(2,e.r,e.g,e.b),o.setXYZ(3,e.r,e.g,e.b),o.setXYZ(4,e.r,e.g,e.b),o.setXYZ(5,e.r,e.g,e.b),o.setXYZ(6,e.r,e.g,e.b),o.setXYZ(7,e.r,e.g,e.b),o.setXYZ(8,e.r,e.g,e.b),o.setXYZ(9,e.r,e.g,e.b),o.setXYZ(10,e.r,e.g,e.b),o.setXYZ(11,e.r,e.g,e.b),o.setXYZ(12,e.r,e.g,e.b),o.setXYZ(13,e.r,e.g,e.b),o.setXYZ(14,e.r,e.g,e.b),o.setXYZ(15,e.r,e.g,e.b),o.setXYZ(16,e.r,e.g,e.b),o.setXYZ(17,e.r,e.g,e.b),o.setXYZ(18,e.r,e.g,e.b),o.setXYZ(19,e.r,e.g,e.b),o.setXYZ(20,e.r,e.g,e.b),o.setXYZ(21,e.r,e.g,e.b),o.setXYZ(22,e.r,e.g,e.b),o.setXYZ(23,e.r,e.g,e.b),o.setXYZ(24,t.r,t.g,t.b),o.setXYZ(25,t.r,t.g,t.b),o.setXYZ(26,t.r,t.g,t.b),o.setXYZ(27,t.r,t.g,t.b),o.setXYZ(28,t.r,t.g,t.b),o.setXYZ(29,t.r,t.g,t.b),o.setXYZ(30,t.r,t.g,t.b),o.setXYZ(31,t.r,t.g,t.b),o.setXYZ(32,i.r,i.g,i.b),o.setXYZ(33,i.r,i.g,i.b),o.setXYZ(34,i.r,i.g,i.b),o.setXYZ(35,i.r,i.g,i.b),o.setXYZ(36,i.r,i.g,i.b),o.setXYZ(37,i.r,i.g,i.b),o.setXYZ(38,r.r,r.g,r.b),o.setXYZ(39,r.r,r.g,r.b),o.setXYZ(40,s.r,s.g,s.b),o.setXYZ(41,s.r,s.g,s.b),o.setXYZ(42,s.r,s.g,s.b),o.setXYZ(43,s.r,s.g,s.b),o.setXYZ(44,s.r,s.g,s.b),o.setXYZ(45,s.r,s.g,s.b),o.setXYZ(46,s.r,s.g,s.b),o.setXYZ(47,s.r,s.g,s.b),o.setXYZ(48,s.r,s.g,s.b),o.setXYZ(49,s.r,s.g,s.b),o.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,i=1,r=1;ii.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),gi("c",t,e,ii,0,0,-1),gi("t",t,e,ii,0,0,1),gi("n1",t,e,ii,-i,-r,-1),gi("n2",t,e,ii,i,-r,-1),gi("n3",t,e,ii,-i,r,-1),gi("n4",t,e,ii,i,r,-1),gi("f1",t,e,ii,-i,-r,1),gi("f2",t,e,ii,i,-r,1),gi("f3",t,e,ii,-i,r,1),gi("f4",t,e,ii,i,r,1),gi("u1",t,e,ii,i*.7,r*1.1,-1),gi("u2",t,e,ii,-i*.7,r*1.1,-1),gi("u3",t,e,ii,0,r*2,-1),gi("cf1",t,e,ii,-i,0,1),gi("cf2",t,e,ii,i,0,1),gi("cf3",t,e,ii,0,-r,1),gi("cf4",t,e,ii,0,r,1),gi("cn1",t,e,ii,-i,0,-1),gi("cn2",t,e,ii,i,0,-1),gi("cn3",t,e,ii,0,-r,-1),gi("cn4",t,e,ii,0,r,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function gi(n,e,t,i,r,s,a){Sg.set(r,s,a).unproject(i);const o=e[n];if(o!==void 0){const l=t.getAttribute("position");for(let c=0,u=o.length;c<u;c++)l.setXYZ(o[c],Sg.x,Sg.y,Sg.z)}}const wg=new gs;class FG extends to{constructor(e,t=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(8*3),s=new Bt;s.setIndex(new En(i,1)),s.setAttribute("position",new En(r,3)),super(s,new Rr({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&wg.setFromObject(this.object),wg.isEmpty())return;const t=wg.min,i=wg.max,r=this.geometry.attributes.position,s=r.array;s[0]=i.x,s[1]=i.y,s[2]=i.z,s[3]=t.x,s[4]=i.y,s[5]=i.z,s[6]=t.x,s[7]=t.y,s[8]=i.z,s[9]=i.x,s[10]=t.y,s[11]=i.z,s[12]=i.x,s[13]=i.y,s[14]=t.z,s[15]=t.x,s[16]=i.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=i.x,s[22]=t.y,s[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class kG extends to{constructor(e,t=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new Bt;s.setIndex(new En(i,1)),s.setAttribute("position",new ot(r,3)),super(s,new Rr({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 NG extends Gl{constructor(e,t=1,i=16776960){const r=i,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],a=new Bt;a.setAttribute("position",new ot(s,3)),a.computeBoundingSphere(),super(a,new Rr({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const o=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new Bt;l.setAttribute("position",new ot(o,3)),l.computeBoundingSphere(),this.add(new nn(l,new cs({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const kE=new N;let Cg,Cv;class GG extends fn{constructor(e=new N(0,0,1),t=new N(0,0,0),i=1,r=16776960,s=i*.2,a=s*.2){super(),this.type="ArrowHelper",Cg===void 0&&(Cg=new Bt,Cg.setAttribute("position",new ot([0,0,0,0,1,0],3)),Cv=new yu(0,.5,1,5,1),Cv.translate(0,-.5,0)),this.position.copy(t),this.line=new Gl(Cg,new Rr({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new nn(Cv,new cs({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,s,a)}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{kE.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(kE,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class zG extends to{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new Bt;r.setAttribute("position",new ot(t,3)),r.setAttribute("color",new ot(i,3));const s=new Rr({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){const r=new He,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(i),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class jT{constructor(){this.type="ShapePath",this.color=new He,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Dp,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,a){return this.currentPath.bezierCurveTo(e,t,i,r,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(A){const _=[];for(let x=0,E=A.length;x<E;x++){const w=A[x],I=new $c;I.curves=w.curves,_.push(I)}return _}function i(A,_){const x=_.length;let E=!1;for(let w=x-1,I=0;I<x;w=I++){let T=_[w],M=_[I],b=M.x-T.x,B=M.y-T.y;if(Math.abs(B)>Number.EPSILON){if(B<0&&(T=_[I],b=-b,M=_[w],B=-B),A.y<T.y||A.y>M.y)continue;if(A.y===T.y){if(A.x===T.x)return!0}else{const L=B*(A.x-T.x)-b*(A.y-T.y);if(L===0)return!0;if(L<0)continue;E=!E}}else{if(A.y!==T.y)continue;if(M.x<=A.x&&A.x<=T.x||T.x<=A.x&&A.x<=M.x)return!0}}return E}const r=Wa.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,o,l;const c=[];if(s.length===1)return o=s[0],l=new $c,l.curves=o.curves,c.push(l),c;let u=!r(s[0].getPoints());u=e?!u:u;const h=[],f=[];let p=[],m=0,y;f[m]=void 0,p[m]=[];for(let A=0,_=s.length;A<_;A++)o=s[A],y=o.getPoints(),a=r(y),a=e?!a:a,a?(!u&&f[m]&&m++,f[m]={s:new $c,p:y},f[m].s.curves=o.curves,u&&m++,p[m]=[]):p[m].push({h:o,p:y[0]});if(!f[0])return t(s);if(f.length>1){let A=!1,_=0;for(let x=0,E=f.length;x<E;x++)h[x]=[];for(let x=0,E=f.length;x<E;x++){const w=p[x];for(let I=0;I<w.length;I++){const T=w[I];let M=!0;for(let b=0;b<f.length;b++)i(T.p,f[b].p)&&(x!==b&&_++,M?(M=!1,h[b].push(T)):A=!0);M&&h[x].push(T)}}_>0&&A===!1&&(p=h)}let v;for(let A=0,_=f.length;A<_;A++){l=f[A].s,c.push(l),v=p[A];for(let x=0,E=v.length;x<E;x++)l.holes.push(v[x].h)}return c}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Wl}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Wl);const KT=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:v6,AddEquation:ss,AddOperation:SC,AdditiveAnimationBlendMode:b6,AdditiveBlending:dp,AlphaFormat:RC,AlwaysCompare:YC,AlwaysDepth:mC,AlwaysStencilFunc:kC,AmbientLight:NT,AmbientLightProbe:iG,AnimationAction:WT,AnimationClip:kp,AnimationLoader:WN,AnimationMixer:_G,AnimationObjectGroup:yG,AnimationUtils:zN,ArcCurve:dT,ArrayCamera:sT,ArrowHelper:GG,Audio:HT,AudioAnalyser:cG,AudioContext:e4,AudioListener:aG,AudioLoader:tG,AxesHelper:zG,BackSide:Ki,BasicDepthPacking:OC,BasicShadowMap:aC,Bone:F6,BooleanKeyframeTrack:xu,Box2:qT,Box3:gs,Box3Helper:kG,BoxGeometry:qo,BoxHelper:FG,BufferAttribute:En,BufferGeometry:Bt,BufferGeometryLoader:QT,ByteType:IC,Cache:au,Camera:o0,CameraHelper:OG,CanvasTexture:hN,CapsuleGeometry:W2,CatmullRomCurve3:pT,CineonToneMapping:TC,CircleGeometry:Y2,ClampToEdgeWrapping:oi,Clock:s1,Color:He,ColorKeyframeTrack:K6,ColorManagement:Ds,CompressedArrayTexture:uN,CompressedTexture:iu,CompressedTextureLoader:YN,ConeGeometry:q2,CubeCamera:$C,CubeReflectionMapping:Fl,CubeRefractionMapping:kl,CubeTexture:l0,CubeTextureLoader:qN,CubeUVReflectionMapping:of,CubicBezierCurve:z6,CubicBezierCurve3:gT,CubicInterpolant:RT,CullFaceBack:O5,CullFaceFront:sC,CullFaceFrontBack:aP,CullFaceNone:rC,Curve:Aa,CurvePath:mT,CustomBlending:pp,CustomToneMapping:bC,CylinderGeometry:yu,Cylindrical:TG,Data3DTexture:D6,DataArrayTexture:L2,DataTexture:Va,DataTextureLoader:XN,DataUtils:AL,DecrementStencilOp:vP,DecrementWrapStencilOp:xP,DefaultLoadingManager:PT,DepthFormat:Bl,DepthStencilFormat:Nl,DepthTexture:uf,DirectionalLight:kT,DirectionalLightHelper:UG,DiscreteInterpolant:BT,DisplayP3ColorSpace:M6,DodecahedronGeometry:X2,DoubleSide:$n,DstAlphaFactor:I2,DstColorFactor:M2,DynamicCopyUsage:LP,DynamicDrawUsage:fm,DynamicReadUsage:BP,EdgesGeometry:AT,EllipseCurve:Q2,EqualCompare:zC,EqualDepth:vC,EqualStencilFunc:wP,EquirectangularReflectionMapping:Ap,EquirectangularRefractionMapping:vp,Euler:vu,EventDispatcher:Yo,ExtrudeGeometry:K2,FileLoader:Ir,Float16BufferAttribute:SL,Float32BufferAttribute:ot,Float64BufferAttribute:wL,FloatType:br,Fog:N2,FogExp2:k2,FramebufferTexture:cN,FrontSide:$a,Frustum:c0,GLBufferAttribute:CG,GLSL1:OP,GLSL3:sy,GreaterCompare:HC,GreaterDepth:xC,GreaterEqualCompare:WC,GreaterEqualDepth:yC,GreaterEqualStencilFunc:IP,GreaterStencilFunc:TP,GridHelper:PG,Group:bh,HalfFloatType:Ai,HemisphereLight:UT,HemisphereLightHelper:DG,HemisphereLightProbe:nG,IcosahedronGeometry:$2,ImageBitmapLoader:eG,ImageLoader:Np,ImageUtils:B6,IncrementStencilOp:AP,IncrementWrapStencilOp:yP,InstancedBufferAttribute:nu,InstancedBufferGeometry:Z6,InstancedInterleavedBuffer:wG,InstancedMesh:hT,Int16BufferAttribute:_L,Int32BufferAttribute:EL,Int8BufferAttribute:vL,IntType:x6,InterleavedBuffer:G2,InterleavedBufferAttribute:tu,Interpolant:g0,InterpolateDiscrete:Cp,InterpolateLinear:Tp,InterpolateSmooth:um,InvertStencilOp:_P,KeepStencilOp:hm,KeyframeTrack:va,LOD:cT,LatheGeometry:h0,Layers:Kc,LessCompare:GC,LessDepth:AC,LessEqualCompare:QC,LessEqualDepth:Rm,LessEqualStencilFunc:CP,LessStencilFunc:SP,Light:jl,LightProbe:i1,Line:Gl,Line3:bG,LineBasicMaterial:Rr,LineCurve:H2,LineCurve3:Q6,LineDashedMaterial:IT,LineLoop:fT,LineSegments:to,LinearEncoding:I6,LinearFilter:Tn,LinearInterpolant:j6,LinearMipMapLinearFilter:hP,LinearMipMapNearestFilter:uP,LinearMipmapLinearFilter:Ja,LinearMipmapNearestFilter:y6,LinearSRGBColorSpace:fa,LinearToneMapping:wC,Loader:ur,LoaderUtils:dy,LoadingManager:$6,LoopOnce:PC,LoopPingPong:UC,LoopRepeat:LC,LuminanceAlphaFormat:BC,LuminanceFormat:S6,MOUSE:iC,Material:Ji,MaterialLoader:r1,MathUtils:Ll,Matrix3:Qt,Matrix4:ct,MaxEquation:G5,Mesh:nn,MeshBasicMaterial:cs,MeshDepthMaterial:u0,MeshDistanceMaterial:F2,MeshLambertMaterial:TT,MeshMatcapMaterial:bT,MeshNormalMaterial:p0,MeshPhongMaterial:wT,MeshPhysicalMaterial:ST,MeshStandardMaterial:Y6,MeshToonMaterial:CT,MinEquation:N5,MirroredRepeatWrapping:yp,MixOperation:EC,MultiplyBlending:k5,MultiplyOperation:a0,NearestFilter:Rt,NearestMipMapLinearFilter:cP,NearestMipMapNearestFilter:lP,NearestMipmapLinearFilter:Kd,NearestMipmapNearestFilter:Bm,NeverCompare:NC,NeverDepth:gC,NeverStencilFunc:EP,NoBlending:Kt,NoColorSpace:Pl,NoToneMapping:os,NormalAnimationBlendMode:D2,NormalBlending:Ha,NotEqualCompare:VC,NotEqualDepth:_C,NotEqualStencilFunc:bP,NumberKeyframeTrack:Op,Object3D:fn,ObjectLoader:JN,ObjectSpaceNormalMap:FC,OctahedronGeometry:f0,OneFactor:cC,OneMinusDstAlphaFactor:fC,OneMinusDstColorFactor:dC,OneMinusSrcAlphaFactor:mp,OneMinusSrcColorFactor:hC,OrthographicCamera:ql,PCFShadowMap:b2,PCFSoftShadowMap:jd,PMREMGenerator:oy,Path:Dp,PerspectiveCamera:Kn,Plane:rs,PlaneGeometry:Xo,PlaneHelper:NG,PointLight:FT,PointLightHelper:RG,Points:N6,PointsMaterial:k6,PolarGridHelper:LG,PolyhedronGeometry:Xl,PositionalAudio:lG,PropertyBinding:rn,PropertyMixer:VT,QuadraticBezierCurve:H6,QuadraticBezierCurve3:V2,Quaternion:$i,QuaternionKeyframeTrack:hf,QuaternionLinearInterpolant:DT,RED_GREEN_RGTC2_Format:iy,RED_RGTC1_Format:DC,REVISION:Wl,RGBADepthPacking:P2,RGBAFormat:li,RGBAIntegerFormat:T6,RGBA_ASTC_10x10_Format:Z5,RGBA_ASTC_10x5_Format:K5,RGBA_ASTC_10x6_Format:$5,RGBA_ASTC_10x8_Format:J5,RGBA_ASTC_12x10_Format:ey,RGBA_ASTC_12x12_Format:ty,RGBA_ASTC_4x4_Format:wp,RGBA_ASTC_5x4_Format:H5,RGBA_ASTC_5x5_Format:V5,RGBA_ASTC_6x5_Format:W5,RGBA_ASTC_6x6_Format:Y5,RGBA_ASTC_8x5_Format:q5,RGBA_ASTC_8x6_Format:X5,RGBA_ASTC_8x8_Format:j5,RGBA_BPTC_Format:Uh,RGBA_ETC2_EAC_Format:Sp,RGBA_PVRTC_2BPPV1_Format:Q5,RGBA_PVRTC_4BPPV1_Format:_p,RGBA_S3TC_DXT1_Format:lm,RGBA_S3TC_DXT3_Format:cm,RGBA_S3TC_DXT5_Format:Lh,RGB_ETC1_Format:B2,RGB_ETC2_Format:Ep,RGB_PVRTC_2BPPV1_Format:z5,RGB_PVRTC_4BPPV1_Format:xp,RGB_S3TC_DXT1_Format:Ph,RGFormat:wh,RGIntegerFormat:C6,RawShaderMaterial:tp,Ray:lf,Raycaster:r4,RectAreaLight:GT,RedFormat:Qc,RedIntegerFormat:w6,ReinhardToneMapping:CC,RepeatWrapping:Qo,ReplaceStencilOp:mP,ReverseSubtractEquation:lC,RingGeometry:J2,SIGNED_RED_GREEN_RGTC2_Format:ry,SIGNED_RED_RGTC1_Format:ny,SRGBColorSpace:Nt,Scene:Bp,ShaderChunk:kt,ShaderLib:aa,ShaderMaterial:sn,ShadowMaterial:ET,Shape:$c,ShapeGeometry:Z2,ShapePath:jT,ShapeUtils:Wa,ShortType:MC,Skeleton:z2,SkeletonHelper:MG,SkinnedMesh:uT,Source:Wc,Sphere:ms,SphereGeometry:d0,Spherical:YT,SphericalHarmonics3:zT,SplineCurve:V6,SpotLight:OT,SpotLightHelper:IG,Sprite:lT,SpriteMaterial:O6,SrcAlphaFactor:gp,SrcAlphaSaturateFactor:pC,SrcColorFactor:uC,StaticCopyUsage:PP,StaticDrawUsage:Ip,StaticReadUsage:RP,StereoCamera:rG,StreamCopyUsage:UP,StreamDrawUsage:MP,StreamReadUsage:DP,StringKeyframeTrack:_u,SubtractEquation:oC,SubtractiveBlending:F5,TOUCH:sP,TangentSpaceNormalMap:Yl,TetrahedronGeometry:e1,Texture:Vn,TextureLoader:LT,TorusGeometry:t1,TorusKnotGeometry:n1,Triangle:Qr,TriangleFanDrawMode:pP,TriangleStripDrawMode:dP,TrianglesDrawMode:fP,TubeGeometry:su,TwoPassDoubleSide:oP,UVMapping:R2,Uint16BufferAttribute:P6,Uint32BufferAttribute:U2,Uint8BufferAttribute:yL,Uint8ClampedBufferAttribute:xL,Uniform:i4,UniformsGroup:SG,UniformsLib:Je,UniformsUtils:Hn,UnsignedByteType:Ri,UnsignedInt248Type:ko,UnsignedIntType:Oo,UnsignedShort4444Type:_6,UnsignedShort5551Type:E6,UnsignedShortType:Au,VSMShadowMap:sa,Vector2:_e,Vector3:N,Vector4:jt,VectorKeyframeTrack:Fp,VideoTexture:lN,WebGL1Renderer:aT,WebGL3DRenderTarget:aL,WebGLArrayRenderTarget:sL,WebGLCoordinateSystem:za,WebGLCubeRenderTarget:JC,WebGLMultipleRenderTargets:oL,WebGLRenderTarget:Dn,WebGLRenderer:U6,WebGLUtils:rT,WebGPUCoordinateSystem:Mp,WireframeGeometry:_T,WrapAroundEnding:bp,ZeroCurvatureEnding:Hc,ZeroFactor:Hh,ZeroSlopeEnding:Vc,ZeroStencilOp:gP,_SRGBAFormat:Dm,sRGBEncoding:Dl},Symbol.toStringTag,{value:"Module"}));var $T={exports:{}},Eu={};/**
* @license React
* react-reconciler-constants.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/Eu.ConcurrentRoot=1;Eu.ContinuousEventPriority=4;Eu.DefaultEventPriority=16;Eu.DiscreteEventPriority=1;Eu.IdleEventPriority=536870912;Eu.LegacyRoot=0;$T.exports=Eu;var Mh=$T.exports;function QG(n){let e;const t=new Set,i=(c,u)=>{const h=typeof c=="function"?c(e):c;if(h!==e){const f=e;e=u?h:Object.assign({},e,h),t.forEach(p=>p(e,f))}},r=()=>e,s=(c,u=r,h=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let f=u(e);function p(){const m=u(e);if(!h(f,m)){const y=f;c(f=m,y)}}return t.add(p),()=>t.delete(p)},l={setState:i,getState:r,subscribe:(c,u,h)=>u||h?s(c,u,h):(t.add(c),()=>t.delete(c)),destroy:()=>t.clear()};return e=n(i,r,l),l}const HG=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),NE=HG?$.useEffect:$.useLayoutEffect;function VG(n){const e=typeof n=="function"?QG(n):n,t=(i=e.getState,r=Object.is)=>{const[,s]=$.useReducer(v=>v+1,0),a=e.getState(),o=$.useRef(a),l=$.useRef(i),c=$.useRef(r),u=$.useRef(!1),h=$.useRef();h.current===void 0&&(h.current=i(a));let f,p=!1;(o.current!==a||l.current!==i||c.current!==r||u.current)&&(f=i(a),p=!r(h.current,f)),NE(()=>{p&&(h.current=f),o.current=a,l.current=i,c.current=r,u.current=!1});const m=$.useRef(a);NE(()=>{const v=()=>{try{const _=e.getState(),x=l.current(_);c.current(h.current,x)||(o.current=_,h.current=x,s())}catch{u.current=!0,s()}},A=e.subscribe(v);return e.getState()!==m.current&&v(),A},[]);const y=p?f:h.current;return $.useDebugValue(y),y};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const i=[t,e];return{next(){const r=i.length<=0;return{value:i.shift(),done:r}}}},t}var JT={exports:{}},ZT={exports:{}},eb={};/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/(function(n){function e(Y,H){var V=Y.length;Y.push(H);e:for(;0<V;){var D=V-1>>>1,k=Y[D];if(0<r(k,H))Y[D]=H,Y[V]=k,V=D;else break e}}function t(Y){return Y.length===0?null:Y[0]}function i(Y){if(Y.length===0)return null;var H=Y[0],V=Y.pop();if(V!==H){Y[0]=V;e:for(var D=0,k=Y.length,Z=k>>>1;D<Z;){var j=2*(D+1)-1,ee=Y[j],ie=j+1,te=Y[ie];if(0>r(ee,V))ie<k&&0>r(te,ee)?(Y[D]=te,Y[ie]=V,D=ie):(Y[D]=ee,Y[j]=V,D=j);else if(ie<k&&0>r(te,V))Y[D]=te,Y[ie]=V,D=ie;else break e}}return H}function r(Y,H){var V=Y.sortIndex-H.sortIndex;return V!==0?V:Y.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();n.unstable_now=function(){return a.now()-o}}var l=[],c=[],u=1,h=null,f=3,p=!1,m=!1,y=!1,v=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(Y){for(var H=t(c);H!==null;){if(H.callback===null)i(c);else if(H.startTime<=Y)i(c),H.sortIndex=H.expirationTime,e(l,H);else break;H=t(c)}}function E(Y){if(y=!1,x(Y),!m)if(t(l)!==null)m=!0,F(w);else{var H=t(c);H!==null&&q(E,H.startTime-Y)}}function w(Y,H){m=!1,y&&(y=!1,A(M),M=-1),p=!0;var V=f;try{for(x(H),h=t(l);h!==null&&(!(h.expirationTime>H)||Y&&!L());){var D=h.callback;if(typeof D=="function"){h.callback=null,f=h.priorityLevel;var k=D(h.expirationTime<=H);H=n.unstable_now(),typeof k=="function"?h.callback=k:h===t(l)&&i(l),x(H)}else i(l);h=t(l)}if(h!==null)var Z=!0;else{var j=t(c);j!==null&&q(E,j.startTime-H),Z=!1}return Z}finally{h=null,f=V,p=!1}}var I=!1,T=null,M=-1,b=5,B=-1;function L(){return!(n.unstable_now()-B<b)}function U(){if(T!==null){var Y=n.unstable_now();B=Y;var H=!0;try{H=T(!0,Y)}finally{H?O():(I=!1,T=null)}}else I=!1}var O;if(typeof _=="function")O=function(){_(U)};else if(typeof MessageChannel<"u"){var Q=new MessageChannel,G=Q.port2;Q.port1.onmessage=U,O=function(){G.postMessage(null)}}else O=function(){v(U,0)};function F(Y){T=Y,I||(I=!0,O())}function q(Y,H){M=v(function(){Y(n.unstable_now())},H)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(Y){Y.callback=null},n.unstable_continueExecution=function(){m||p||(m=!0,F(w))},n.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):b=0<Y?Math.floor(1e3/Y):5},n.unstable_getCurrentPriorityLevel=function(){return f},n.unstable_getFirstCallbackNode=function(){return t(l)},n.unstable_next=function(Y){switch(f){case 1:case 2:case 3:var H=3;break;default:H=f}var V=f;f=H;try{return Y()}finally{f=V}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(Y,H){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var V=f;f=Y;try{return H()}finally{f=V}},n.unstable_scheduleCallback=function(Y,H,V){var D=n.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?D+V:D):V=D,Y){case 1:var k=-1;break;case 2:k=250;break;case 5:k=1073741823;break;case 4:k=1e4;break;default:k=5e3}return k=V+k,Y={id:u++,callback:H,priorityLevel:Y,startTime:V,expirationTime:k,sortIndex:-1},V>D?(Y.sortIndex=V,e(c,Y),t(l)===null&&Y===t(c)&&(y?(A(M),M=-1):y=!0,q(E,V-D))):(Y.sortIndex=k,e(l,Y),m||p||(m=!0,F(w))),Y},n.unstable_shouldYield=L,n.unstable_wrapCallback=function(Y){var H=f;return function(){var V=f;f=H;try{return Y.apply(this,arguments)}finally{f=V}}}})(eb);ZT.exports=eb;var gy=ZT.exports;/**
* @license React
* react-reconciler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var WG=function(e){var t={},i=$,r=gy,s=Object.assign;function a(d){for(var g="https://reactjs.org/docs/error-decoder.html?invariant="+d,S=1;S<arguments.length;S++)g+="&args[]="+encodeURIComponent(arguments[S]);return"Minified React error #"+d+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var o=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,l=Symbol.for("react.element"),c=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),p=Symbol.for("react.provider"),m=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),E=Symbol.for("react.offscreen"),w=Symbol.iterator;function I(d){return d===null||typeof d!="object"?null:(d=w&&d[w]||d["@@iterator"],typeof d=="function"?d:null)}function T(d){if(d==null)return null;if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d;switch(d){case u:return"Fragment";case c:return"Portal";case f:return"Profiler";case h:return"StrictMode";case v:return"Suspense";case A:return"SuspenseList"}if(typeof d=="object")switch(d.$$typeof){case m:return(d.displayName||"Context")+".Consumer";case p:return(d._context.displayName||"Context")+".Provider";case y:var g=d.render;return d=d.displayName,d||(d=g.displayName||g.name||"",d=d!==""?"ForwardRef("+d+")":"ForwardRef"),d;case _:return g=d.displayName||null,g!==null?g:T(d.type)||"Memo";case x:g=d._payload,d=d._init;try{return T(d(g))}catch{}}return null}function M(d){var g=d.type;switch(d.tag){case 24:return"Cache";case 9:return(g.displayName||"Context")+".Consumer";case 10:return(g._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return d=g.render,d=d.displayName||d.name||"",g.displayName||(d!==""?"ForwardRef("+d+")":"ForwardRef");case 7:return"Fragment";case 5:return g;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return T(g);case 8:return g===h?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof g=="function")return g.displayName||g.name||null;if(typeof g=="string")return g}return null}function b(d){var g=d,S=d;if(d.alternate)for(;g.return;)g=g.return;else{d=g;do g=d,g.flags&4098&&(S=g.return),d=g.return;while(d)}return g.tag===3?S:null}function B(d){if(b(d)!==d)throw Error(a(188))}function L(d){var g=d.alternate;if(!g){if(g=b(d),g===null)throw Error(a(188));return g!==d?null:d}for(var S=d,C=g;;){var R=S.return;if(R===null)break;var P=R.alternate;if(P===null){if(C=R.return,C!==null){S=C;continue}break}if(R.child===P.child){for(P=R.child;P;){if(P===S)return B(R),d;if(P===C)return B(R),g;P=P.sibling}throw Error(a(188))}if(S.return!==C.return)S=R,C=P;else{for(var J=!1,ae=R.child;ae;){if(ae===S){J=!0,S=R,C=P;break}if(ae===C){J=!0,C=R,S=P;break}ae=ae.sibling}if(!J){for(ae=P.child;ae;){if(ae===S){J=!0,S=P,C=R;break}if(ae===C){J=!0,C=P,S=R;break}ae=ae.sibling}if(!J)throw Error(a(189))}}if(S.alternate!==C)throw Error(a(190))}if(S.tag!==3)throw Error(a(188));return S.stateNode.current===S?d:g}function U(d){return d=L(d),d!==null?O(d):null}function O(d){if(d.tag===5||d.tag===6)return d;for(d=d.child;d!==null;){var g=O(d);if(g!==null)return g;d=d.sibling}return null}function Q(d){if(d.tag===5||d.tag===6)return d;for(d=d.child;d!==null;){if(d.tag!==4){var g=Q(d);if(g!==null)return g}d=d.sibling}return null}var G=Array.isArray,F=e.getPublicInstance,q=e.getRootHostContext,Y=e.getChildHostContext,H=e.prepareForCommit,V=e.resetAfterCommit,D=e.createInstance,k=e.appendInitialChild,Z=e.finalizeInitialChildren,j=e.prepareUpdate,ee=e.shouldSetTextContent,ie=e.createTextInstance,te=e.scheduleTimeout,re=e.cancelTimeout,ce=e.noTimeout,ye=e.isPrimaryRenderer,oe=e.supportsMutation,W=e.supportsPersistence,ge=e.supportsHydration,he=e.getInstanceFromNode,ue=e.preparePortalMount,fe=e.getCurrentEventPriority,Pe=e.detachDeletedInstance,pe=e.supportsMicrotasks,Re=e.scheduleMicrotask,Le=e.supportsTestSelectors,Se=e.findFiberRoot,$e=e.getBoundingRect,X=e.getTextContent,z=e.isHiddenSubtree,se=e.matchAccessibilityRole,Be=e.setFocusIfFocusable,Ce=e.setupIntersectionObserver,we=e.appendChild,ke=e.appendChildToContainer,Ue=e.commitTextUpdate,xe=e.commitMount,ze=e.commitUpdate,je=e.insertBefore,We=e.insertInContainerBefore,Oe=e.removeChild,Ve=e.removeChildFromContainer,it=e.resetTextContent,gt=e.hideInstance,ne=e.hideTextInstance,Fe=e.unhideInstance,me=e.unhideTextInstance,Qe=e.clearContainer,Xe=e.cloneInstance,Dt=e.createContainerChildSet,Yt=e.appendChildToContainerChildSet,en=e.finalizeContainerChildren,Jt=e.replaceContainerChildren,dn=e.cloneHiddenInstance,Zt=e.cloneHiddenTextInstance,Ht=e.canHydrateInstance,Zi=e.canHydrateTextInstance,Ui=e.canHydrateSuspenseInstance,on=e.isSuspenseInstancePending,Pn=e.isSuspenseInstanceFallback,Wi=e.registerSuspenseInstanceRetry,Mn=e.getNextHydratableSibling,Wn=e.getFirstHydratableChild,wi=e.getFirstHydratableChildWithinContainer,ys=e.getFirstHydratableChildWithinSuspenseInstance,fr=e.hydrateInstance,K=e.hydrateTextInstance,Ae=e.hydrateSuspenseInstance,Ie=e.getNextHydratableInstanceAfterSuspenseInstance,de=e.commitHydratedContainer,Me=e.commitHydratedSuspenseInstance,rt=e.clearSuspenseBoundary,mt=e.clearSuspenseBoundaryFromContainer,At=e.shouldDeleteUnhydratedTailInstances,Et=e.didNotMatchHydratedContainerTextInstance,Ut=e.didNotMatchHydratedTextInstance,Ge;function vt(d){if(Ge===void 0)try{throw Error()}catch(S){var g=S.stack.trim().match(/\n( *(at )?)/);Ge=g&&g[1]||""}return`
`+Ge+d}var wn=!1;function ln(d,g){if(!d||wn)return"";wn=!0;var S=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(g)if(g=function(){throw Error()},Object.defineProperty(g.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(g,[])}catch(Ye){var C=Ye}Reflect.construct(d,[],g)}else{try{g.call()}catch(Ye){C=Ye}d.call(g.prototype)}else{try{throw Error()}catch(Ye){C=Ye}d()}}catch(Ye){if(Ye&&C&&typeof Ye.stack=="string"){for(var R=Ye.stack.split(`
`),P=C.stack.split(`
`),J=R.length-1,ae=P.length-1;1<=J&&0<=ae&&R[J]!==P[ae];)ae--;for(;1<=J&&0<=ae;J--,ae--)if(R[J]!==P[ae]){if(J!==1||ae!==1)do if(J--,ae--,0>ae||R[J]!==P[ae]){var be=`
`+R[J].replace(" at new "," at ");return d.displayName&&be.includes("<anonymous>")&&(be=be.replace("<anonymous>",d.displayName)),be}while(1<=J&&0<=ae);break}}}finally{wn=!1,Error.prepareStackTrace=S}return(d=d?d.displayName||d.name:"")?vt(d):""}var Oi=Object.prototype.hasOwnProperty,er=[],pn=-1;function Ct(d){return{current:d}}function tn(d){0>pn||(d.current=er[pn],er[pn]=null,pn--)}function Tt(d,g){pn++,er[pn]=d.current,d.current=g}var hi={},ti=Ct(hi),Gn=Ct(!1),Lr=hi;function Cn(d,g){var S=d.type.contextTypes;if(!S)return hi;var C=d.stateNode;if(C&&C.__reactInternalMemoizedUnmaskedChildContext===g)return C.__reactInternalMemoizedMaskedChildContext;var R={},P;for(P in S)R[P]=g[P];return C&&(d=d.stateNode,d.__reactInternalMemoizedUnmaskedChildContext=g,d.__reactInternalMemoizedMaskedChildContext=R),R}function Ln(d){return d=d.childContextTypes,d!=null}function dr(){tn(Gn),tn(ti)}function yi(d,g,S){if(ti.current!==hi)throw Error(a(168));Tt(ti,g),Tt(Gn,S)}function wa(d,g,S){var C=d.stateNode;if(g=g.childContextTypes,typeof C.getChildContext!="function")return S;C=C.getChildContext();for(var R in C)if(!(R in g))throw Error(a(108,M(d)||"Unknown",R));return s({},S,C)}function Ca(d){return d=(d=d.stateNode)&&d.__reactInternalMemoizedMergedChildContext||hi,Lr=ti.current,Tt(ti,d),Tt(Gn,Gn.current),!0}function tr(d,g,S){var C=d.stateNode;if(!C)throw Error(a(169));S?(d=wa(d,g,Lr),C.__reactInternalMemoizedMergedChildContext=d,tn(Gn),tn(ti),Tt(ti,d)):tn(Gn),Tt(Gn,S)}var Xr=Math.clz32?Math.clz32:j0,bu=Math.log,nc=Math.LN2;function j0(d){return d>>>=0,d===0?32:31-(bu(d)/nc|0)|0}var uo=64,ho=4194304;function fo(d){switch(d&-d){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return d&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return d&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return d}}function ic(d,g){var S=d.pendingLanes;if(S===0)return 0;var C=0,R=d.suspendedLanes,P=d.pingedLanes,J=S&268435455;if(J!==0){var ae=J&~R;ae!==0?C=fo(ae):(P&=J,P!==0&&(C=fo(P)))}else J=S&~R,J!==0?C=fo(J):P!==0&&(C=fo(P));if(C===0)return 0;if(g!==0&&g!==C&&!(g&R)&&(R=C&-C,P=g&-g,R>=P||R===16&&(P&4194240)!==0))return g;if(C&4&&(C|=S&16),g=d.entangledLanes,g!==0)for(d=d.entanglements,g&=C;0<g;)S=31-Xr(g),R=1<<S,C|=d[S],g&=~R;return C}function K0(d,g){switch(d){case 1:case 2:case 4:return g+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return g+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Sf(d,g){for(var S=d.suspendedLanes,C=d.pingedLanes,R=d.expirationTimes,P=d.pendingLanes;0<P;){var J=31-Xr(P),ae=1<<J,be=R[J];be===-1?(!(ae&S)||ae&C)&&(R[J]=K0(ae,g)):be<=g&&(d.expiredLanes|=ae),P&=~ae}}function po(d){return d=d.pendingLanes&-1073741825,d!==0?d:d&1073741824?1073741824:0}function Iu(d){for(var g=[],S=0;31>S;S++)g.push(d);return g}function Ta(d,g,S){d.pendingLanes|=g,g!==536870912&&(d.suspendedLanes=0,d.pingedLanes=0),d=d.eventTimes,g=31-Xr(g),d[g]=S}function tl(d,g){var S=d.pendingLanes&~g;d.pendingLanes=g,d.suspendedLanes=0,d.pingedLanes=0,d.expiredLanes&=g,d.mutableReadLanes&=g,d.entangledLanes&=g,g=d.entanglements;var C=d.eventTimes;for(d=d.expirationTimes;0<S;){var R=31-Xr(S),P=1<<R;g[R]=0,C[R]=-1,d[R]=-1,S&=~P}}function ba(d,g){var S=d.entangledLanes|=g;for(d=d.entanglements;S;){var C=31-Xr(S),R=1<<C;R&g|d[C]&g&&(d[C]|=g),S&=~R}}var Xt=0;function wf(d){return d&=-d,1<d?4<d?d&268435455?16:536870912:4:1}var go=r.unstable_scheduleCallback,Mu=r.unstable_cancelCallback,Cf=r.unstable_shouldYield,$0=r.unstable_requestPaint,Yn=r.unstable_now,rc=r.unstable_ImmediatePriority,J0=r.unstable_UserBlockingPriority,pr=r.unstable_NormalPriority,Tf=r.unstable_IdlePriority,sc=null,jr=null;function bf(d){if(jr&&typeof jr.onCommitFiberRoot=="function")try{jr.onCommitFiberRoot(sc,d,void 0,(d.current.flags&128)===128)}catch{}}function Z0(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}var Kr=typeof Object.is=="function"?Object.is:Z0,gr=null,Ia=!1,xs=!1;function If(d){gr===null?gr=[d]:gr.push(d)}function Mf(d){Ia=!0,If(d)}function Ur(){if(!xs&&gr!==null){xs=!0;var d=0,g=Xt;try{var S=gr;for(Xt=1;d<S.length;d++){var C=S[d];do C=C(!0);while(C!==null)}gr=null,Ia=!1}catch(R){throw gr!==null&&(gr=gr.slice(d+1)),go(rc,Ur),R}finally{Xt=g,xs=!1}}return null}var ac=o.ReactCurrentBatchConfig;function oc(d,g){if(Kr(d,g))return!0;if(typeof d!="object"||d===null||typeof g!="object"||g===null)return!1;var S=Object.keys(d),C=Object.keys(g);if(S.length!==C.length)return!1;for(C=0;C<S.length;C++){var R=S[C];if(!Oi.call(g,R)||!Kr(d[R],g[R]))return!1}return!0}function lc(d){switch(d.tag){case 5:return vt(d.type);case 16:return vt("Lazy");case 13:return vt("Suspense");case 19:return vt("SuspenseList");case 0:case 2:case 15:return d=ln(d.type,!1),d;case 11:return d=ln(d.type.render,!1),d;case 1:return d=ln(d.type,!0),d;default:return""}}function mr(d,g){if(d&&d.defaultProps){g=s({},g),d=d.defaultProps;for(var S in d)g[S]===void 0&&(g[S]=d[S]);return g}return g}var Fi=Ct(null),Ru=null,Ks=null,nl=null;function Bu(){nl=Ks=Ru=null}function e3(d,g,S){ye?(Tt(Fi,g._currentValue),g._currentValue=S):(Tt(Fi,g._currentValue2),g._currentValue2=S)}function ki(d){var g=Fi.current;tn(Fi),ye?d._currentValue=g:d._currentValue2=g}function Ar(d,g,S){for(;d!==null;){var C=d.alternate;if((d.childLanes&g)!==g?(d.childLanes|=g,C!==null&&(C.childLanes|=g)):C!==null&&(C.childLanes&g)!==g&&(C.childLanes|=g),d===S)break;d=d.return}}function fi(d,g){Ru=d,nl=Ks=null,d=d.dependencies,d!==null&&d.firstContext!==null&&(d.lanes&g&&(es=!0),d.firstContext=null)}function di(d){var g=ye?d._currentValue:d._currentValue2;if(nl!==d)if(d={context:d,memoizedValue:g,next:null},Ks===null){if(Ru===null)throw Error(a(308));Ks=d,Ru.dependencies={lanes:0,firstContext:d}}else Ks=Ks.next=d;return g}var $r=null,il=!1;function eA(d){d.updateQueue={baseState:d.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function N8(d,g){d=d.updateQueue,g.updateQueue===d&&(g.updateQueue={baseState:d.baseState,firstBaseUpdate:d.firstBaseUpdate,lastBaseUpdate:d.lastBaseUpdate,shared:d.shared,effects:d.effects})}function mo(d,g){return{eventTime:d,lane:g,tag:0,payload:null,callback:null,next:null}}function rl(d,g){var S=d.updateQueue;S!==null&&(S=S.shared,xi!==null&&d.mode&1&&!(qt&2)?(d=S.interleaved,d===null?(g.next=g,$r===null?$r=[S]:$r.push(S)):(g.next=d.next,d.next=g),S.interleaved=g):(d=S.pending,d===null?g.next=g:(g.next=d.next,d.next=g),S.pending=g))}function t3(d,g,S){if(g=g.updateQueue,g!==null&&(g=g.shared,(S&4194240)!==0)){var C=g.lanes;C&=d.pendingLanes,S|=C,g.lanes=S,ba(d,S)}}function G8(d,g){var S=d.updateQueue,C=d.alternate;if(C!==null&&(C=C.updateQueue,S===C)){var R=null,P=null;if(S=S.firstBaseUpdate,S!==null){do{var J={eventTime:S.eventTime,lane:S.lane,tag:S.tag,payload:S.payload,callback:S.callback,next:null};P===null?R=P=J:P=P.next=J,S=S.next}while(S!==null);P===null?R=P=g:P=P.next=g}else R=P=g;S={baseState:C.baseState,firstBaseUpdate:R,lastBaseUpdate:P,shared:C.shared,effects:C.effects},d.updateQueue=S;return}d=S.lastBaseUpdate,d===null?S.firstBaseUpdate=g:d.next=g,S.lastBaseUpdate=g}function n3(d,g,S,C){var R=d.updateQueue;il=!1;var P=R.firstBaseUpdate,J=R.lastBaseUpdate,ae=R.shared.pending;if(ae!==null){R.shared.pending=null;var be=ae,Ye=be.next;be.next=null,J===null?P=Ye:J.next=Ye,J=be;var st=d.alternate;st!==null&&(st=st.updateQueue,ae=st.lastBaseUpdate,ae!==J&&(ae===null?st.firstBaseUpdate=Ye:ae.next=Ye,st.lastBaseUpdate=be))}if(P!==null){var Ot=R.baseState;J=0,st=Ye=be=null,ae=P;do{var yt=ae.lane,Rn=ae.eventTime;if((C&yt)===yt){st!==null&&(st=st.next={eventTime:Rn,lane:0,tag:ae.tag,payload:ae.payload,callback:ae.callback,next:null});e:{var dt=d,sr=ae;switch(yt=g,Rn=S,sr.tag){case 1:if(dt=sr.payload,typeof dt=="function"){Ot=dt.call(Rn,Ot,yt);break e}Ot=dt;break e;case 3:dt.flags=dt.flags&-65537|128;case 0:if(dt=sr.payload,yt=typeof dt=="function"?dt.call(Rn,Ot,yt):dt,yt==null)break e;Ot=s({},Ot,yt);break e;case 2:il=!0}}ae.callback!==null&&ae.lane!==0&&(d.flags|=64,yt=R.effects,yt===null?R.effects=[ae]:yt.push(ae))}else Rn={eventTime:Rn,lane:yt,tag:ae.tag,payload:ae.payload,callback:ae.callback,next:null},st===null?(Ye=st=Rn,be=Ot):st=st.next=Rn,J|=yt;if(ae=ae.next,ae===null){if(ae=R.shared.pending,ae===null)break;yt=ae,ae=yt.next,yt.next=null,R.lastBaseUpdate=yt,R.shared.pending=null}}while(1);if(st===null&&(be=Ot),R.baseState=be,R.firstBaseUpdate=Ye,R.lastBaseUpdate=st,g=R.shared.interleaved,g!==null){R=g;do J|=R.lane,R=R.next;while(R!==g)}else P===null&&(R.shared.lanes=0);Gu|=J,d.lanes=J,d.memoizedState=Ot}}function z8(d,g,S){if(d=g.effects,g.effects=null,d!==null)for(g=0;g<d.length;g++){var C=d[g],R=C.callback;if(R!==null){if(C.callback=null,C=S,typeof R!="function")throw Error(a(191,R));R.call(C)}}}var Q8=new i.Component().refs;function tA(d,g,S,C){g=d.memoizedState,S=S(C,g),S=S==null?g:s({},g,S),d.memoizedState=S,d.lanes===0&&(d.updateQueue.baseState=S)}var i3={isMounted:function(d){return(d=d._reactInternals)?b(d)===d:!1},enqueueSetState:function(d,g,S){d=d._reactInternals;var C=yr(),R=ol(d),P=mo(C,R);P.payload=g,S!=null&&(P.callback=S),rl(d,P),g=Cs(d,R,C),g!==null&&t3(g,d,R)},enqueueReplaceState:function(d,g,S){d=d._reactInternals;var C=yr(),R=ol(d),P=mo(C,R);P.tag=1,P.payload=g,S!=null&&(P.callback=S),rl(d,P),g=Cs(d,R,C),g!==null&&t3(g,d,R)},enqueueForceUpdate:function(d,g){d=d._reactInternals;var S=yr(),C=ol(d),R=mo(S,C);R.tag=2,g!=null&&(R.callback=g),rl(d,R),g=Cs(d,C,S),g!==null&&t3(g,d,C)}};function H8(d,g,S,C,R,P,J){return d=d.stateNode,typeof d.shouldComponentUpdate=="function"?d.shouldComponentUpdate(C,P,J):g.prototype&&g.prototype.isPureReactComponent?!oc(S,C)||!oc(R,P):!0}function V8(d,g,S){var C=!1,R=hi,P=g.contextType;return typeof P=="object"&&P!==null?P=di(P):(R=Ln(g)?Lr:ti.current,C=g.contextTypes,P=(C=C!=null)?Cn(d,R):hi),g=new g(S,P),d.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=i3,d.stateNode=g,g._reactInternals=d,C&&(d=d.stateNode,d.__reactInternalMemoizedUnmaskedChildContext=R,d.__reactInternalMemoizedMaskedChildContext=P),g}function W8(d,g,S,C){d=g.state,typeof g.componentWillReceiveProps=="function"&&g.componentWillReceiveProps(S,C),typeof g.UNSAFE_componentWillReceiveProps=="function"&&g.UNSAFE_componentWillReceiveProps(S,C),g.state!==d&&i3.enqueueReplaceState(g,g.state,null)}function nA(d,g,S,C){var R=d.stateNode;R.props=S,R.state=d.memoizedState,R.refs=Q8,eA(d);var P=g.contextType;typeof P=="object"&&P!==null?R.context=di(P):(P=Ln(g)?Lr:ti.current,R.context=Cn(d,P)),R.state=d.memoizedState,P=g.getDerivedStateFromProps,typeof P=="function"&&(tA(d,g,P,S),R.state=d.memoizedState),typeof g.getDerivedStateFromProps=="function"||typeof R.getSnapshotBeforeUpdate=="function"||typeof R.UNSAFE_componentWillMount!="function"&&typeof R.componentWillMount!="function"||(g=R.state,typeof R.componentWillMount=="function"&&R.componentWillMount(),typeof R.UNSAFE_componentWillMount=="function"&&R.UNSAFE_componentWillMount(),g!==R.state&&i3.enqueueReplaceState(R,R.state,null),n3(d,S,R,C),R.state=d.memoizedState),typeof R.componentDidMount=="function"&&(d.flags|=4194308)}var Du=[],Pu=0,r3=null,s3=0,_s=[],Es=0,cc=null,Ao=1,vo="";function uc(d,g){Du[Pu++]=s3,Du[Pu++]=r3,r3=d,s3=g}function Y8(d,g,S){_s[Es++]=Ao,_s[Es++]=vo,_s[Es++]=cc,cc=d;var C=Ao;d=vo;var R=32-Xr(C)-1;C&=~(1<<R),S+=1;var P=32-Xr(g)+R;if(30<P){var J=R-R%5;P=(C&(1<<J)-1).toString(32),C>>=J,R-=J,Ao=1<<32-Xr(g)+R|S<<R|C,vo=P+d}else Ao=1<<P|S<<R|C,vo=d}function iA(d){d.return!==null&&(uc(d,1),Y8(d,1,0))}function rA(d){for(;d===r3;)r3=Du[--Pu],Du[Pu]=null,s3=Du[--Pu],Du[Pu]=null;for(;d===cc;)cc=_s[--Es],_s[Es]=null,vo=_s[--Es],_s[Es]=null,Ao=_s[--Es],_s[Es]=null}var Jr=null,Zr=null,zn=!1,Rf=!1,$s=null;function q8(d,g){var S=Ts(5,null,null,0);S.elementType="DELETED",S.stateNode=g,S.return=d,g=d.deletions,g===null?(d.deletions=[S],d.flags|=16):g.push(S)}function X8(d,g){switch(d.tag){case 5:return g=Ht(g,d.type,d.pendingProps),g!==null?(d.stateNode=g,Jr=d,Zr=Wn(g),!0):!1;case 6:return g=Zi(g,d.pendingProps),g!==null?(d.stateNode=g,Jr=d,Zr=null,!0):!1;case 13:if(g=Ui(g),g!==null){var S=cc!==null?{id:Ao,overflow:vo}:null;return d.memoizedState={dehydrated:g,treeContext:S,retryLane:1073741824},S=Ts(18,null,null,0),S.stateNode=g,S.return=d,d.child=S,Jr=d,Zr=null,!0}return!1;default:return!1}}function sA(d){return(d.mode&1)!==0&&(d.flags&128)===0}function aA(d){if(zn){var g=Zr;if(g){var S=g;if(!X8(d,g)){if(sA(d))throw Error(a(418));g=Mn(S);var C=Jr;g&&X8(d,g)?q8(C,S):(d.flags=d.flags&-4097|2,zn=!1,Jr=d)}}else{if(sA(d))throw Error(a(418));d.flags=d.flags&-4097|2,zn=!1,Jr=d}}}function j8(d){for(d=d.return;d!==null&&d.tag!==5&&d.tag!==3&&d.tag!==13;)d=d.return;Jr=d}function Bf(d){if(!ge||d!==Jr)return!1;if(!zn)return j8(d),zn=!0,!1;if(d.tag!==3&&(d.tag!==5||At(d.type)&&!ee(d.type,d.memoizedProps))){var g=Zr;if(g){if(sA(d)){for(d=Zr;d;)d=Mn(d);throw Error(a(418))}for(;g;)q8(d,g),g=Mn(g)}}if(j8(d),d.tag===13){if(!ge)throw Error(a(316));if(d=d.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(a(317));Zr=Ie(d)}else Zr=Jr?Mn(d.stateNode):null;return!0}function Lu(){ge&&(Zr=Jr=null,Rf=zn=!1)}function oA(d){$s===null?$s=[d]:$s.push(d)}function Df(d,g,S){if(d=S.ref,d!==null&&typeof d!="function"&&typeof d!="object"){if(S._owner){if(S=S._owner,S){if(S.tag!==1)throw Error(a(309));var C=S.stateNode}if(!C)throw Error(a(147,d));var R=C,P=""+d;return g!==null&&g.ref!==null&&typeof g.ref=="function"&&g.ref._stringRef===P?g.ref:(g=function(J){var ae=R.refs;ae===Q8&&(ae=R.refs={}),J===null?delete ae[P]:ae[P]=J},g._stringRef=P,g)}if(typeof d!="string")throw Error(a(284));if(!S._owner)throw Error(a(290,d))}return d}function a3(d,g){throw d=Object.prototype.toString.call(g),Error(a(31,d==="[object Object]"?"object with keys {"+Object.keys(g).join(", ")+"}":d))}function K8(d){var g=d._init;return g(d._payload)}function $8(d){function g(ve,le){if(d){var Ee=ve.deletions;Ee===null?(ve.deletions=[le],ve.flags|=16):Ee.push(le)}}function S(ve,le){if(!d)return null;for(;le!==null;)g(ve,le),le=le.sibling;return null}function C(ve,le){for(ve=new Map;le!==null;)le.key!==null?ve.set(le.key,le):ve.set(le.index,le),le=le.sibling;return ve}function R(ve,le){return ve=cl(ve,le),ve.index=0,ve.sibling=null,ve}function P(ve,le,Ee){return ve.index=Ee,d?(Ee=ve.alternate,Ee!==null?(Ee=Ee.index,Ee<le?(ve.flags|=2,le):Ee):(ve.flags|=2,le)):(ve.flags|=1048576,le)}function J(ve){return d&&ve.alternate===null&&(ve.flags|=2),ve}function ae(ve,le,Ee,tt){return le===null||le.tag!==6?(le=VA(Ee,ve.mode,tt),le.return=ve,le):(le=R(le,Ee),le.return=ve,le)}function be(ve,le,Ee,tt){var ht=Ee.type;return ht===u?st(ve,le,Ee.props.children,tt,Ee.key):le!==null&&(le.elementType===ht||typeof ht=="object"&&ht!==null&&ht.$$typeof===x&&K8(ht)===le.type)?(tt=R(le,Ee.props),tt.ref=Df(ve,le,Ee),tt.return=ve,tt):(tt=F3(Ee.type,Ee.key,Ee.props,null,ve.mode,tt),tt.ref=Df(ve,le,Ee),tt.return=ve,tt)}function Ye(ve,le,Ee,tt){return le===null||le.tag!==4||le.stateNode.containerInfo!==Ee.containerInfo||le.stateNode.implementation!==Ee.implementation?(le=WA(Ee,ve.mode,tt),le.return=ve,le):(le=R(le,Ee.children||[]),le.return=ve,le)}function st(ve,le,Ee,tt,ht){return le===null||le.tag!==7?(le=Ac(Ee,ve.mode,tt,ht),le.return=ve,le):(le=R(le,Ee),le.return=ve,le)}function Ot(ve,le,Ee){if(typeof le=="string"&&le!==""||typeof le=="number")return le=VA(""+le,ve.mode,Ee),le.return=ve,le;if(typeof le=="object"&&le!==null){switch(le.$$typeof){case l:return Ee=F3(le.type,le.key,le.props,null,ve.mode,Ee),Ee.ref=Df(ve,null,le),Ee.return=ve,Ee;case c:return le=WA(le,ve.mode,Ee),le.return=ve,le;case x:var tt=le._init;return Ot(ve,tt(le._payload),Ee)}if(G(le)||I(le))return le=Ac(le,ve.mode,Ee,null),le.return=ve,le;a3(ve,le)}return null}function yt(ve,le,Ee,tt){var ht=le!==null?le.key:null;if(typeof Ee=="string"&&Ee!==""||typeof Ee=="number")return ht!==null?null:ae(ve,le,""+Ee,tt);if(typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case l:return Ee.key===ht?be(ve,le,Ee,tt):null;case c:return Ee.key===ht?Ye(ve,le,Ee,tt):null;case x:return ht=Ee._init,yt(ve,le,ht(Ee._payload),tt)}if(G(Ee)||I(Ee))return ht!==null?null:st(ve,le,Ee,tt,null);a3(ve,Ee)}return null}function Rn(ve,le,Ee,tt,ht){if(typeof tt=="string"&&tt!==""||typeof tt=="number")return ve=ve.get(Ee)||null,ae(le,ve,""+tt,ht);if(typeof tt=="object"&&tt!==null){switch(tt.$$typeof){case l:return ve=ve.get(tt.key===null?Ee:tt.key)||null,be(le,ve,tt,ht);case c:return ve=ve.get(tt.key===null?Ee:tt.key)||null,Ye(le,ve,tt,ht);case x:var Vt=tt._init;return Rn(ve,le,Ee,Vt(tt._payload),ht)}if(G(tt)||I(tt))return ve=ve.get(Ee)||null,st(le,ve,tt,ht,null);a3(le,tt)}return null}function dt(ve,le,Ee,tt){for(var ht=null,Vt=null,Ft=le,cn=le=0,Gi=null;Ft!==null&&cn<Ee.length;cn++){Ft.index>cn?(Gi=Ft,Ft=null):Gi=Ft.sibling;var un=yt(ve,Ft,Ee[cn],tt);if(un===null){Ft===null&&(Ft=Gi);break}d&&Ft&&un.alternate===null&&g(ve,Ft),le=P(un,le,cn),Vt===null?ht=un:Vt.sibling=un,Vt=un,Ft=Gi}if(cn===Ee.length)return S(ve,Ft),zn&&uc(ve,cn),ht;if(Ft===null){for(;cn<Ee.length;cn++)Ft=Ot(ve,Ee[cn],tt),Ft!==null&&(le=P(Ft,le,cn),Vt===null?ht=Ft:Vt.sibling=Ft,Vt=Ft);return zn&&uc(ve,cn),ht}for(Ft=C(ve,Ft);cn<Ee.length;cn++)Gi=Rn(Ft,ve,cn,Ee[cn],tt),Gi!==null&&(d&&Gi.alternate!==null&&Ft.delete(Gi.key===null?cn:Gi.key),le=P(Gi,le,cn),Vt===null?ht=Gi:Vt.sibling=Gi,Vt=Gi);return d&&Ft.forEach(function(ul){return g(ve,ul)}),zn&&uc(ve,cn),ht}function sr(ve,le,Ee,tt){var ht=I(Ee);if(typeof ht!="function")throw Error(a(150));if(Ee=ht.call(Ee),Ee==null)throw Error(a(151));for(var Vt=ht=null,Ft=le,cn=le=0,Gi=null,un=Ee.next();Ft!==null&&!un.done;cn++,un=Ee.next()){Ft.index>cn?(Gi=Ft,Ft=null):Gi=Ft.sibling;var ul=yt(ve,Ft,un.value,tt);if(ul===null){Ft===null&&(Ft=Gi);break}d&&Ft&&ul.alternate===null&&g(ve,Ft),le=P(ul,le,cn),Vt===null?ht=ul:Vt.sibling=ul,Vt=ul,Ft=Gi}if(un.done)return S(ve,Ft),zn&&uc(ve,cn),ht;if(Ft===null){for(;!un.done;cn++,un=Ee.next())un=Ot(ve,un.value,tt),un!==null&&(le=P(un,le,cn),Vt===null?ht=un:Vt.sibling=un,Vt=un);return zn&&uc(ve,cn),ht}for(Ft=C(ve,Ft);!un.done;cn++,un=Ee.next())un=Rn(Ft,ve,cn,un.value,tt),un!==null&&(d&&un.alternate!==null&&Ft.delete(un.key===null?cn:un.key),le=P(un,le,cn),Vt===null?ht=un:Vt.sibling=un,Vt=un);return d&&Ft.forEach(function(tP){return g(ve,tP)}),zn&&uc(ve,cn),ht}function bs(ve,le,Ee,tt){if(typeof Ee=="object"&&Ee!==null&&Ee.type===u&&Ee.key===null&&(Ee=Ee.props.children),typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case l:e:{for(var ht=Ee.key,Vt=le;Vt!==null;){if(Vt.key===ht){if(ht=Ee.type,ht===u){if(Vt.tag===7){S(ve,Vt.sibling),le=R(Vt,Ee.props.children),le.return=ve,ve=le;break e}}else if(Vt.elementType===ht||typeof ht=="object"&&ht!==null&&ht.$$typeof===x&&K8(ht)===Vt.type){S(ve,Vt.sibling),le=R(Vt,Ee.props),le.ref=Df(ve,Vt,Ee),le.return=ve,ve=le;break e}S(ve,Vt);break}else g(ve,Vt);Vt=Vt.sibling}Ee.type===u?(le=Ac(Ee.props.children,ve.mode,tt,Ee.key),le.return=ve,ve=le):(tt=F3(Ee.type,Ee.key,Ee.props,null,ve.mode,tt),tt.ref=Df(ve,le,Ee),tt.return=ve,ve=tt)}return J(ve);case c:e:{for(Vt=Ee.key;le!==null;){if(le.key===Vt)if(le.tag===4&&le.stateNode.containerInfo===Ee.containerInfo&&le.stateNode.implementation===Ee.implementation){S(ve,le.sibling),le=R(le,Ee.children||[]),le.return=ve,ve=le;break e}else{S(ve,le);break}else g(ve,le);le=le.sibling}le=WA(Ee,ve.mode,tt),le.return=ve,ve=le}return J(ve);case x:return Vt=Ee._init,bs(ve,le,Vt(Ee._payload),tt)}if(G(Ee))return dt(ve,le,Ee,tt);if(I(Ee))return sr(ve,le,Ee,tt);a3(ve,Ee)}return typeof Ee=="string"&&Ee!==""||typeof Ee=="number"?(Ee=""+Ee,le!==null&&le.tag===6?(S(ve,le.sibling),le=R(le,Ee),le.return=ve,ve=le):(S(ve,le),le=VA(Ee,ve.mode,tt),le.return=ve,ve=le),J(ve)):S(ve,le)}return bs}var Uu=$8(!0),J8=$8(!1),Pf={},Ss=Ct(Pf),Lf=Ct(Pf),Ou=Ct(Pf);function Ma(d){if(d===Pf)throw Error(a(174));return d}function lA(d,g){Tt(Ou,g),Tt(Lf,d),Tt(Ss,Pf),d=q(g),tn(Ss),Tt(Ss,d)}function Fu(){tn(Ss),tn(Lf),tn(Ou)}function Z8(d){var g=Ma(Ou.current),S=Ma(Ss.current);g=Y(S,d.type,g),S!==g&&(Tt(Lf,d),Tt(Ss,g))}function cA(d){Lf.current===d&&(tn(Ss),tn(Lf))}var qn=Ct(0);function o3(d){for(var g=d;g!==null;){if(g.tag===13){var S=g.memoizedState;if(S!==null&&(S=S.dehydrated,S===null||on(S)||Pn(S)))return g}else if(g.tag===19&&g.memoizedProps.revealOrder!==void 0){if(g.flags&128)return g}else if(g.child!==null){g.child.return=g,g=g.child;continue}if(g===d)break;for(;g.sibling===null;){if(g.return===null||g.return===d)return null;g=g.return}g.sibling.return=g.return,g=g.sibling}return null}var uA=[];function hA(){for(var d=0;d<uA.length;d++){var g=uA[d];ye?g._workInProgressVersionPrimary=null:g._workInProgressVersionSecondary=null}uA.length=0}var l3=o.ReactCurrentDispatcher,ws=o.ReactCurrentBatchConfig,ku=0,ni=null,nr=null,Ni=null,c3=!1,Uf=!1,Of=0,TD=0;function ir(){throw Error(a(321))}function fA(d,g){if(g===null)return!1;for(var S=0;S<g.length&&S<d.length;S++)if(!Kr(d[S],g[S]))return!1;return!0}function dA(d,g,S,C,R,P){if(ku=P,ni=g,g.memoizedState=null,g.updateQueue=null,g.lanes=0,l3.current=d===null||d.memoizedState===null?RD:BD,d=S(C,R),Uf){P=0;do{if(Uf=!1,Of=0,25<=P)throw Error(a(301));P+=1,Ni=nr=null,g.updateQueue=null,l3.current=DD,d=S(C,R)}while(Uf)}if(l3.current=p3,g=nr!==null&&nr.next!==null,ku=0,Ni=nr=ni=null,c3=!1,g)throw Error(a(300));return d}function pA(){var d=Of!==0;return Of=0,d}function yo(){var d={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ni===null?ni.memoizedState=Ni=d:Ni=Ni.next=d,Ni}function Ra(){if(nr===null){var d=ni.alternate;d=d!==null?d.memoizedState:null}else d=nr.next;var g=Ni===null?ni.memoizedState:Ni.next;if(g!==null)Ni=g,nr=d;else{if(d===null)throw Error(a(310));nr=d,d={memoizedState:nr.memoizedState,baseState:nr.baseState,baseQueue:nr.baseQueue,queue:nr.queue,next:null},Ni===null?ni.memoizedState=Ni=d:Ni=Ni.next=d}return Ni}function hc(d,g){return typeof g=="function"?g(d):g}function u3(d){var g=Ra(),S=g.queue;if(S===null)throw Error(a(311));S.lastRenderedReducer=d;var C=nr,R=C.baseQueue,P=S.pending;if(P!==null){if(R!==null){var J=R.next;R.next=P.next,P.next=J}C.baseQueue=R=P,S.pending=null}if(R!==null){P=R.next,C=C.baseState;var ae=J=null,be=null,Ye=P;do{var st=Ye.lane;if((ku&st)===st)be!==null&&(be=be.next={lane:0,action:Ye.action,hasEagerState:Ye.hasEagerState,eagerState:Ye.eagerState,next:null}),C=Ye.hasEagerState?Ye.eagerState:d(C,Ye.action);else{var Ot={lane:st,action:Ye.action,hasEagerState:Ye.hasEagerState,eagerState:Ye.eagerState,next:null};be===null?(ae=be=Ot,J=C):be=be.next=Ot,ni.lanes|=st,Gu|=st}Ye=Ye.next}while(Ye!==null&&Ye!==P);be===null?J=C:be.next=ae,Kr(C,g.memoizedState)||(es=!0),g.memoizedState=C,g.baseState=J,g.baseQueue=be,S.lastRenderedState=C}if(d=S.interleaved,d!==null){R=d;do P=R.lane,ni.lanes|=P,Gu|=P,R=R.next;while(R!==d)}else R===null&&(S.lanes=0);return[g.memoizedState,S.dispatch]}function h3(d){var g=Ra(),S=g.queue;if(S===null)throw Error(a(311));S.lastRenderedReducer=d;var C=S.dispatch,R=S.pending,P=g.memoizedState;if(R!==null){S.pending=null;var J=R=R.next;do P=d(P,J.action),J=J.next;while(J!==R);Kr(P,g.memoizedState)||(es=!0),g.memoizedState=P,g.baseQueue===null&&(g.baseState=P),S.lastRenderedState=P}return[P,C]}function ex(){}function tx(d,g){var S=ni,C=Ra(),R=g(),P=!Kr(C.memoizedState,R);if(P&&(C.memoizedState=R,es=!0),C=C.queue,kf(rx.bind(null,S,C,d),[d]),C.getSnapshot!==g||P||Ni!==null&&Ni.memoizedState.tag&1){if(S.flags|=2048,Ff(9,ix.bind(null,S,C,R,g),void 0,null),xi===null)throw Error(a(349));ku&30||nx(S,g,R)}return R}function nx(d,g,S){d.flags|=16384,d={getSnapshot:g,value:S},g=ni.updateQueue,g===null?(g={lastEffect:null,stores:null},ni.updateQueue=g,g.stores=[d]):(S=g.stores,S===null?g.stores=[d]:S.push(d))}function ix(d,g,S,C){g.value=S,g.getSnapshot=C,sx(g)&&Cs(d,1,-1)}function rx(d,g,S){return S(function(){sx(g)&&Cs(d,1,-1)})}function sx(d){var g=d.getSnapshot;d=d.value;try{var S=g();return!Kr(d,S)}catch{return!0}}function gA(d){var g=yo();return typeof d=="function"&&(d=d()),g.memoizedState=g.baseState=d,d={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:hc,lastRenderedState:d},g.queue=d,d=d.dispatch=MD.bind(null,ni,d),[g.memoizedState,d]}function Ff(d,g,S,C){return d={tag:d,create:g,destroy:S,deps:C,next:null},g=ni.updateQueue,g===null?(g={lastEffect:null,stores:null},ni.updateQueue=g,g.lastEffect=d.next=d):(S=g.lastEffect,S===null?g.lastEffect=d.next=d:(C=S.next,S.next=d,d.next=C,g.lastEffect=d)),d}function ax(){return Ra().memoizedState}function f3(d,g,S,C){var R=yo();ni.flags|=d,R.memoizedState=Ff(1|g,S,void 0,C===void 0?null:C)}function d3(d,g,S,C){var R=Ra();C=C===void 0?null:C;var P=void 0;if(nr!==null){var J=nr.memoizedState;if(P=J.destroy,C!==null&&fA(C,J.deps)){R.memoizedState=Ff(g,S,P,C);return}}ni.flags|=d,R.memoizedState=Ff(1|g,S,P,C)}function mA(d,g){return f3(8390656,8,d,g)}function kf(d,g){return d3(2048,8,d,g)}function ox(d,g){return d3(4,2,d,g)}function lx(d,g){return d3(4,4,d,g)}function cx(d,g){if(typeof g=="function")return d=d(),g(d),function(){g(null)};if(g!=null)return d=d(),g.current=d,function(){g.current=null}}function ux(d,g,S){return S=S!=null?S.concat([d]):null,d3(4,4,cx.bind(null,g,d),S)}function AA(){}function hx(d,g){var S=Ra();g=g===void 0?null:g;var C=S.memoizedState;return C!==null&&g!==null&&fA(g,C[1])?C[0]:(S.memoizedState=[d,g],d)}function fx(d,g){var S=Ra();g=g===void 0?null:g;var C=S.memoizedState;return C!==null&&g!==null&&fA(g,C[1])?C[0]:(d=d(),S.memoizedState=[d,g],d)}function bD(d,g){var S=Xt;Xt=S!==0&&4>S?S:4,d(!0);var C=ws.transition;ws.transition={};try{d(!1),g()}finally{Xt=S,ws.transition=C}}function dx(){return Ra().memoizedState}function ID(d,g,S){var C=ol(d);S={lane:C,action:S,hasEagerState:!1,eagerState:null,next:null},px(d)?gx(g,S):(mx(d,g,S),S=yr(),d=Cs(d,C,S),d!==null&&Ax(d,g,C))}function MD(d,g,S){var C=ol(d),R={lane:C,action:S,hasEagerState:!1,eagerState:null,next:null};if(px(d))gx(g,R);else{mx(d,g,R);var P=d.alternate;if(d.lanes===0&&(P===null||P.lanes===0)&&(P=g.lastRenderedReducer,P!==null))try{var J=g.lastRenderedState,ae=P(J,S);if(R.hasEagerState=!0,R.eagerState=ae,Kr(ae,J))return}catch{}finally{}S=yr(),d=Cs(d,C,S),d!==null&&Ax(d,g,C)}}function px(d){var g=d.alternate;return d===ni||g!==null&&g===ni}function gx(d,g){Uf=c3=!0;var S=d.pending;S===null?g.next=g:(g.next=S.next,S.next=g),d.pending=g}function mx(d,g,S){xi!==null&&d.mode&1&&!(qt&2)?(d=g.interleaved,d===null?(S.next=S,$r===null?$r=[g]:$r.push(g)):(S.next=d.next,d.next=S),g.interleaved=S):(d=g.pending,d===null?S.next=S:(S.next=d.next,d.next=S),g.pending=S)}function Ax(d,g,S){if(S&4194240){var C=g.lanes;C&=d.pendingLanes,S|=C,g.lanes=S,ba(d,S)}}var p3={readContext:di,useCallback:ir,useContext:ir,useEffect:ir,useImperativeHandle:ir,useInsertionEffect:ir,useLayoutEffect:ir,useMemo:ir,useReducer:ir,useRef:ir,useState:ir,useDebugValue:ir,useDeferredValue:ir,useTransition:ir,useMutableSource:ir,useSyncExternalStore:ir,useId:ir,unstable_isNewReconciler:!1},RD={readContext:di,useCallback:function(d,g){return yo().memoizedState=[d,g===void 0?null:g],d},useContext:di,useEffect:mA,useImperativeHandle:function(d,g,S){return S=S!=null?S.concat([d]):null,f3(4194308,4,cx.bind(null,g,d),S)},useLayoutEffect:function(d,g){return f3(4194308,4,d,g)},useInsertionEffect:function(d,g){return f3(4,2,d,g)},useMemo:function(d,g){var S=yo();return g=g===void 0?null:g,d=d(),S.memoizedState=[d,g],d},useReducer:function(d,g,S){var C=yo();return g=S!==void 0?S(g):g,C.memoizedState=C.baseState=g,d={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:d,lastRenderedState:g},C.queue=d,d=d.dispatch=ID.bind(null,ni,d),[C.memoizedState,d]},useRef:function(d){var g=yo();return d={current:d},g.memoizedState=d},useState:gA,useDebugValue:AA,useDeferredValue:function(d){var g=gA(d),S=g[0],C=g[1];return mA(function(){var R=ws.transition;ws.transition={};try{C(d)}finally{ws.transition=R}},[d]),S},useTransition:function(){var d=gA(!1),g=d[0];return d=bD.bind(null,d[1]),yo().memoizedState=d,[g,d]},useMutableSource:function(){},useSyncExternalStore:function(d,g,S){var C=ni,R=yo();if(zn){if(S===void 0)throw Error(a(407));S=S()}else{if(S=g(),xi===null)throw Error(a(349));ku&30||nx(C,g,S)}R.memoizedState=S;var P={value:S,getSnapshot:g};return R.queue=P,mA(rx.bind(null,C,P,d),[d]),C.flags|=2048,Ff(9,ix.bind(null,C,P,S,g),void 0,null),S},useId:function(){var d=yo(),g=xi.identifierPrefix;if(zn){var S=vo,C=Ao;S=(C&~(1<<32-Xr(C)-1)).toString(32)+S,g=":"+g+"R"+S,S=Of++,0<S&&(g+="H"+S.toString(32)),g+=":"}else S=TD++,g=":"+g+"r"+S.toString(32)+":";return d.memoizedState=g},unstable_isNewReconciler:!1},BD={readContext:di,useCallback:hx,useContext:di,useEffect:kf,useImperativeHandle:ux,useInsertionEffect:ox,useLayoutEffect:lx,useMemo:fx,useReducer:u3,useRef:ax,useState:function(){return u3(hc)},useDebugValue:AA,useDeferredValue:function(d){var g=u3(hc),S=g[0],C=g[1];return kf(function(){var R=ws.transition;ws.transition={};try{C(d)}finally{ws.transition=R}},[d]),S},useTransition:function(){var d=u3(hc)[0],g=Ra().memoizedState;return[d,g]},useMutableSource:ex,useSyncExternalStore:tx,useId:dx,unstable_isNewReconciler:!1},DD={readContext:di,useCallback:hx,useContext:di,useEffect:kf,useImperativeHandle:ux,useInsertionEffect:ox,useLayoutEffect:lx,useMemo:fx,useReducer:h3,useRef:ax,useState:function(){return h3(hc)},useDebugValue:AA,useDeferredValue:function(d){var g=h3(hc),S=g[0],C=g[1];return kf(function(){var R=ws.transition;ws.transition={};try{C(d)}finally{ws.transition=R}},[d]),S},useTransition:function(){var d=h3(hc)[0],g=Ra().memoizedState;return[d,g]},useMutableSource:ex,useSyncExternalStore:tx,useId:dx,unstable_isNewReconciler:!1};function vA(d,g){try{var S="",C=g;do S+=lc(C),C=C.return;while(C);var R=S}catch(P){R=`
Error generating stack: `+P.message+`
`+P.stack}return{value:d,source:g,stack:R}}function yA(d,g){try{console.error(g.value)}catch(S){setTimeout(function(){throw S})}}var PD=typeof WeakMap=="function"?WeakMap:Map;function vx(d,g,S){S=mo(-1,S),S.tag=3,S.payload={element:null};var C=g.value;return S.callback=function(){R3||(R3=!0,FA=C),yA(d,g)},S}function yx(d,g,S){S=mo(-1,S),S.tag=3;var C=d.type.getDerivedStateFromError;if(typeof C=="function"){var R=g.value;S.payload=function(){return C(R)},S.callback=function(){yA(d,g)}}var P=d.stateNode;return P!==null&&typeof P.componentDidCatch=="function"&&(S.callback=function(){yA(d,g),typeof C!="function"&&(sl===null?sl=new Set([this]):sl.add(this));var J=g.stack;this.componentDidCatch(g.value,{componentStack:J!==null?J:""})}),S}function xx(d,g,S){var C=d.pingCache;if(C===null){C=d.pingCache=new PD;var R=new Set;C.set(g,R)}else R=C.get(g),R===void 0&&(R=new Set,C.set(g,R));R.has(S)||(R.add(S),d=qD.bind(null,d,g,S),g.then(d,d))}function _x(d){do{var g;if((g=d.tag===13)&&(g=d.memoizedState,g=g!==null?g.dehydrated!==null:!0),g)return d;d=d.return}while(d!==null);return null}function Ex(d,g,S,C,R){return d.mode&1?(d.flags|=65536,d.lanes=R,d):(d===g?d.flags|=65536:(d.flags|=128,S.flags|=131072,S.flags&=-52805,S.tag===1&&(S.alternate===null?S.tag=17:(g=mo(-1,1),g.tag=2,rl(S,g))),S.lanes|=1),d)}function Ba(d){d.flags|=4}function Sx(d,g){if(d!==null&&d.child===g.child)return!0;if(g.flags&16)return!1;for(d=g.child;d!==null;){if(d.flags&12854||d.subtreeFlags&12854)return!1;d=d.sibling}return!0}var Nf,Gf,g3,m3;if(oe)Nf=function(d,g){for(var S=g.child;S!==null;){if(S.tag===5||S.tag===6)k(d,S.stateNode);else if(S.tag!==4&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===g)break;for(;S.sibling===null;){if(S.return===null||S.return===g)return;S=S.return}S.sibling.return=S.return,S=S.sibling}},Gf=function(){},g3=function(d,g,S,C,R){if(d=d.memoizedProps,d!==C){var P=g.stateNode,J=Ma(Ss.current);S=j(P,S,d,C,R,J),(g.updateQueue=S)&&Ba(g)}},m3=function(d,g,S,C){S!==C&&Ba(g)};else if(W){Nf=function(d,g,S,C){for(var R=g.child;R!==null;){if(R.tag===5){var P=R.stateNode;S&&C&&(P=dn(P,R.type,R.memoizedProps,R)),k(d,P)}else if(R.tag===6)P=R.stateNode,S&&C&&(P=Zt(P,R.memoizedProps,R)),k(d,P);else if(R.tag!==4){if(R.tag===22&&R.memoizedState!==null)P=R.child,P!==null&&(P.return=R),Nf(d,R,!0,!0);else if(R.child!==null){R.child.return=R,R=R.child;continue}}if(R===g)break;for(;R.sibling===null;){if(R.return===null||R.return===g)return;R=R.return}R.sibling.return=R.return,R=R.sibling}};var wx=function(d,g,S,C){for(var R=g.child;R!==null;){if(R.tag===5){var P=R.stateNode;S&&C&&(P=dn(P,R.type,R.memoizedProps,R)),Yt(d,P)}else if(R.tag===6)P=R.stateNode,S&&C&&(P=Zt(P,R.memoizedProps,R)),Yt(d,P);else if(R.tag!==4){if(R.tag===22&&R.memoizedState!==null)P=R.child,P!==null&&(P.return=R),wx(d,R,!0,!0);else if(R.child!==null){R.child.return=R,R=R.child;continue}}if(R===g)break;for(;R.sibling===null;){if(R.return===null||R.return===g)return;R=R.return}R.sibling.return=R.return,R=R.sibling}};Gf=function(d,g){var S=g.stateNode;if(!Sx(d,g)){d=S.containerInfo;var C=Dt(d);wx(C,g,!1,!1),S.pendingChildren=C,Ba(g),en(d,C)}},g3=function(d,g,S,C,R){var P=d.stateNode,J=d.memoizedProps;if((d=Sx(d,g))&&J===C)g.stateNode=P;else{var ae=g.stateNode,be=Ma(Ss.current),Ye=null;J!==C&&(Ye=j(ae,S,J,C,R,be)),d&&Ye===null?g.stateNode=P:(P=Xe(P,Ye,S,J,C,g,d,ae),Z(P,S,C,R,be)&&Ba(g),g.stateNode=P,d?Ba(g):Nf(P,g,!1,!1))}},m3=function(d,g,S,C){S!==C?(d=Ma(Ou.current),S=Ma(Ss.current),g.stateNode=ie(C,d,S,g),Ba(g)):g.stateNode=d.stateNode}}else Gf=function(){},g3=function(){},m3=function(){};function zf(d,g){if(!zn)switch(d.tailMode){case"hidden":g=d.tail;for(var S=null;g!==null;)g.alternate!==null&&(S=g),g=g.sibling;S===null?d.tail=null:S.sibling=null;break;case"collapsed":S=d.tail;for(var C=null;S!==null;)S.alternate!==null&&(C=S),S=S.sibling;C===null?g||d.tail===null?d.tail=null:d.tail.sibling=null:C.sibling=null}}function rr(d){var g=d.alternate!==null&&d.alternate.child===d.child,S=0,C=0;if(g)for(var R=d.child;R!==null;)S|=R.lanes|R.childLanes,C|=R.subtreeFlags&14680064,C|=R.flags&14680064,R.return=d,R=R.sibling;else for(R=d.child;R!==null;)S|=R.lanes|R.childLanes,C|=R.subtreeFlags,C|=R.flags,R.return=d,R=R.sibling;return d.subtreeFlags|=C,d.childLanes=S,g}function LD(d,g,S){var C=g.pendingProps;switch(rA(g),g.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return rr(g),null;case 1:return Ln(g.type)&&dr(),rr(g),null;case 3:return C=g.stateNode,Fu(),tn(Gn),tn(ti),hA(),C.pendingContext&&(C.context=C.pendingContext,C.pendingContext=null),(d===null||d.child===null)&&(Bf(g)?Ba(g):d===null||d.memoizedState.isDehydrated&&!(g.flags&256)||(g.flags|=1024,$s!==null&&(GA($s),$s=null))),Gf(d,g),rr(g),null;case 5:cA(g),S=Ma(Ou.current);var R=g.type;if(d!==null&&g.stateNode!=null)g3(d,g,R,C,S),d.ref!==g.ref&&(g.flags|=512,g.flags|=2097152);else{if(!C){if(g.stateNode===null)throw Error(a(166));return rr(g),null}if(d=Ma(Ss.current),Bf(g)){if(!ge)throw Error(a(175));d=fr(g.stateNode,g.type,g.memoizedProps,S,d,g,!Rf),g.updateQueue=d,d!==null&&Ba(g)}else{var P=D(R,C,S,d,g);Nf(P,g,!1,!1),g.stateNode=P,Z(P,R,C,S,d)&&Ba(g)}g.ref!==null&&(g.flags|=512,g.flags|=2097152)}return rr(g),null;case 6:if(d&&g.stateNode!=null)m3(d,g,d.memoizedProps,C);else{if(typeof C!="string"&&g.stateNode===null)throw Error(a(166));if(d=Ma(Ou.current),S=Ma(Ss.current),Bf(g)){if(!ge)throw Error(a(176));if(d=g.stateNode,C=g.memoizedProps,(S=K(d,C,g,!Rf))&&(R=Jr,R!==null))switch(P=(R.mode&1)!==0,R.tag){case 3:Et(R.stateNode.containerInfo,d,C,P);break;case 5:Ut(R.type,R.memoizedProps,R.stateNode,d,C,P)}S&&Ba(g)}else g.stateNode=ie(C,d,S,g)}return rr(g),null;case 13:if(tn(qn),C=g.memoizedState,zn&&Zr!==null&&g.mode&1&&!(g.flags&128)){for(d=Zr;d;)d=Mn(d);return Lu(),g.flags|=98560,g}if(C!==null&&C.dehydrated!==null){if(C=Bf(g),d===null){if(!C)throw Error(a(318));if(!ge)throw Error(a(344));if(d=g.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(a(317));Ae(d,g)}else Lu(),!(g.flags&128)&&(g.memoizedState=null),g.flags|=4;return rr(g),null}return $s!==null&&(GA($s),$s=null),g.flags&128?(g.lanes=S,g):(C=C!==null,S=!1,d===null?Bf(g):S=d.memoizedState!==null,C&&!S&&(g.child.flags|=8192,g.mode&1&&(d===null||qn.current&1?Ci===0&&(Ci=3):QA())),g.updateQueue!==null&&(g.flags|=4),rr(g),null);case 4:return Fu(),Gf(d,g),d===null&&ue(g.stateNode.containerInfo),rr(g),null;case 10:return ki(g.type._context),rr(g),null;case 17:return Ln(g.type)&&dr(),rr(g),null;case 19:if(tn(qn),R=g.memoizedState,R===null)return rr(g),null;if(C=(g.flags&128)!==0,P=R.rendering,P===null)if(C)zf(R,!1);else{if(Ci!==0||d!==null&&d.flags&128)for(d=g.child;d!==null;){if(P=o3(d),P!==null){for(g.flags|=128,zf(R,!1),d=P.updateQueue,d!==null&&(g.updateQueue=d,g.flags|=4),g.subtreeFlags=0,d=S,C=g.child;C!==null;)S=C,R=d,S.flags&=14680066,P=S.alternate,P===null?(S.childLanes=0,S.lanes=R,S.child=null,S.subtreeFlags=0,S.memoizedProps=null,S.memoizedState=null,S.updateQueue=null,S.dependencies=null,S.stateNode=null):(S.childLanes=P.childLanes,S.lanes=P.lanes,S.child=P.child,S.subtreeFlags=0,S.deletions=null,S.memoizedProps=P.memoizedProps,S.memoizedState=P.memoizedState,S.updateQueue=P.updateQueue,S.type=P.type,R=P.dependencies,S.dependencies=R===null?null:{lanes:R.lanes,firstContext:R.firstContext}),C=C.sibling;return Tt(qn,qn.current&1|2),g.child}d=d.sibling}R.tail!==null&&Yn()>OA&&(g.flags|=128,C=!0,zf(R,!1),g.lanes=4194304)}else{if(!C)if(d=o3(P),d!==null){if(g.flags|=128,C=!0,d=d.updateQueue,d!==null&&(g.updateQueue=d,g.flags|=4),zf(R,!0),R.tail===null&&R.tailMode==="hidden"&&!P.alternate&&!zn)return rr(g),null}else 2*Yn()-R.renderingStartTime>OA&&S!==1073741824&&(g.flags|=128,C=!0,zf(R,!1),g.lanes=4194304);R.isBackwards?(P.sibling=g.child,g.child=P):(d=R.last,d!==null?d.sibling=P:g.child=P,R.last=P)}return R.tail!==null?(g=R.tail,R.rendering=g,R.tail=g.sibling,R.renderingStartTime=Yn(),g.sibling=null,d=qn.current,Tt(qn,C?d&1|2:d&1),g):(rr(g),null);case 22:case 23:return zA(),C=g.memoizedState!==null,d!==null&&d.memoizedState!==null!==C&&(g.flags|=8192),C&&g.mode&1?ts&1073741824&&(rr(g),oe&&g.subtreeFlags&6&&(g.flags|=8192)):rr(g),null;case 24:return null;case 25:return null}throw Error(a(156,g.tag))}var UD=o.ReactCurrentOwner,es=!1;function vr(d,g,S,C){g.child=d===null?J8(g,null,S,C):Uu(g,d.child,S,C)}function Cx(d,g,S,C,R){S=S.render;var P=g.ref;return fi(g,R),C=dA(d,g,S,C,P,R),S=pA(),d!==null&&!es?(g.updateQueue=d.updateQueue,g.flags&=-2053,d.lanes&=~R,xo(d,g,R)):(zn&&S&&iA(g),g.flags|=1,vr(d,g,C,R),g.child)}function Tx(d,g,S,C,R){if(d===null){var P=S.type;return typeof P=="function"&&!HA(P)&&P.defaultProps===void 0&&S.compare===null&&S.defaultProps===void 0?(g.tag=15,g.type=P,bx(d,g,P,C,R)):(d=F3(S.type,null,C,g,g.mode,R),d.ref=g.ref,d.return=g,g.child=d)}if(P=d.child,!(d.lanes&R)){var J=P.memoizedProps;if(S=S.compare,S=S!==null?S:oc,S(J,C)&&d.ref===g.ref)return xo(d,g,R)}return g.flags|=1,d=cl(P,C),d.ref=g.ref,d.return=g,g.child=d}function bx(d,g,S,C,R){if(d!==null&&oc(d.memoizedProps,C)&&d.ref===g.ref)if(es=!1,(d.lanes&R)!==0)d.flags&131072&&(es=!0);else return g.lanes=d.lanes,xo(d,g,R);return xA(d,g,S,C,R)}function Ix(d,g,S){var C=g.pendingProps,R=C.children,P=d!==null?d.memoizedState:null;if(C.mode==="hidden")if(!(g.mode&1))g.memoizedState={baseLanes:0,cachePool:null},Tt(Nu,ts),ts|=S;else if(S&1073741824)g.memoizedState={baseLanes:0,cachePool:null},C=P!==null?P.baseLanes:S,Tt(Nu,ts),ts|=C;else return d=P!==null?P.baseLanes|S:S,g.lanes=g.childLanes=1073741824,g.memoizedState={baseLanes:d,cachePool:null},g.updateQueue=null,Tt(Nu,ts),ts|=d,null;else P!==null?(C=P.baseLanes|S,g.memoizedState=null):C=S,Tt(Nu,ts),ts|=C;return vr(d,g,R,S),g.child}function Mx(d,g){var S=g.ref;(d===null&&S!==null||d!==null&&d.ref!==S)&&(g.flags|=512,g.flags|=2097152)}function xA(d,g,S,C,R){var P=Ln(S)?Lr:ti.current;return P=Cn(g,P),fi(g,R),S=dA(d,g,S,C,P,R),C=pA(),d!==null&&!es?(g.updateQueue=d.updateQueue,g.flags&=-2053,d.lanes&=~R,xo(d,g,R)):(zn&&C&&iA(g),g.flags|=1,vr(d,g,S,R),g.child)}function Rx(d,g,S,C,R){if(Ln(S)){var P=!0;Ca(g)}else P=!1;if(fi(g,R),g.stateNode===null)d!==null&&(d.alternate=null,g.alternate=null,g.flags|=2),V8(g,S,C),nA(g,S,C,R),C=!0;else if(d===null){var J=g.stateNode,ae=g.memoizedProps;J.props=ae;var be=J.context,Ye=S.contextType;typeof Ye=="object"&&Ye!==null?Ye=di(Ye):(Ye=Ln(S)?Lr:ti.current,Ye=Cn(g,Ye));var st=S.getDerivedStateFromProps,Ot=typeof st=="function"||typeof J.getSnapshotBeforeUpdate=="function";Ot||typeof J.UNSAFE_componentWillReceiveProps!="function"&&typeof J.componentWillReceiveProps!="function"||(ae!==C||be!==Ye)&&W8(g,J,C,Ye),il=!1;var yt=g.memoizedState;J.state=yt,n3(g,C,J,R),be=g.memoizedState,ae!==C||yt!==be||Gn.current||il?(typeof st=="function"&&(tA(g,S,st,C),be=g.memoizedState),(ae=il||H8(g,S,ae,C,yt,be,Ye))?(Ot||typeof J.UNSAFE_componentWillMount!="function"&&typeof J.componentWillMount!="function"||(typeof J.componentWillMount=="function"&&J.componentWillMount(),typeof J.UNSAFE_componentWillMount=="function"&&J.UNSAFE_componentWillMount()),typeof J.componentDidMount=="function"&&(g.flags|=4194308)):(typeof J.componentDidMount=="function"&&(g.flags|=4194308),g.memoizedProps=C,g.memoizedState=be),J.props=C,J.state=be,J.context=Ye,C=ae):(typeof J.componentDidMount=="function"&&(g.flags|=4194308),C=!1)}else{J=g.stateNode,N8(d,g),ae=g.memoizedProps,Ye=g.type===g.elementType?ae:mr(g.type,ae),J.props=Ye,Ot=g.pendingProps,yt=J.context,be=S.contextType,typeof be=="object"&&be!==null?be=di(be):(be=Ln(S)?Lr:ti.current,be=Cn(g,be));var Rn=S.getDerivedStateFromProps;(st=typeof Rn=="function"||typeof J.getSnapshotBeforeUpdate=="function")||typeof J.UNSAFE_componentWillReceiveProps!="function"&&typeof J.componentWillReceiveProps!="function"||(ae!==Ot||yt!==be)&&W8(g,J,C,be),il=!1,yt=g.memoizedState,J.state=yt,n3(g,C,J,R);var dt=g.memoizedState;ae!==Ot||yt!==dt||Gn.current||il?(typeof Rn=="function"&&(tA(g,S,Rn,C),dt=g.memoizedState),(Ye=il||H8(g,S,Ye,C,yt,dt,be)||!1)?(st||typeof J.UNSAFE_componentWillUpdate!="function"&&typeof J.componentWillUpdate!="function"||(typeof J.componentWillUpdate=="function"&&J.componentWillUpdate(C,dt,be),typeof J.UNSAFE_componentWillUpdate=="function"&&J.UNSAFE_componentWillUpdate(C,dt,be)),typeof J.componentDidUpdate=="function"&&(g.flags|=4),typeof J.getSnapshotBeforeUpdate=="function"&&(g.flags|=1024)):(typeof J.componentDidUpdate!="function"||ae===d.memoizedProps&&yt===d.memoizedState||(g.flags|=4),typeof J.getSnapshotBeforeUpdate!="function"||ae===d.memoizedProps&&yt===d.memoizedState||(g.flags|=1024),g.memoizedProps=C,g.memoizedState=dt),J.props=C,J.state=dt,J.context=be,C=Ye):(typeof J.componentDidUpdate!="function"||ae===d.memoizedProps&&yt===d.memoizedState||(g.flags|=4),typeof J.getSnapshotBeforeUpdate!="function"||ae===d.memoizedProps&&yt===d.memoizedState||(g.flags|=1024),C=!1)}return _A(d,g,S,C,P,R)}function _A(d,g,S,C,R,P){Mx(d,g);var J=(g.flags&128)!==0;if(!C&&!J)return R&&tr(g,S,!1),xo(d,g,P);C=g.stateNode,UD.current=g;var ae=J&&typeof S.getDerivedStateFromError!="function"?null:C.render();return g.flags|=1,d!==null&&J?(g.child=Uu(g,d.child,null,P),g.child=Uu(g,null,ae,P)):vr(d,g,ae,P),g.memoizedState=C.state,R&&tr(g,S,!0),g.child}function Bx(d){var g=d.stateNode;g.pendingContext?yi(d,g.pendingContext,g.pendingContext!==g.context):g.context&&yi(d,g.context,!1),lA(d,g.containerInfo)}function Dx(d,g,S,C,R){return Lu(),oA(R),g.flags|=256,vr(d,g,S,C),g.child}var A3={dehydrated:null,treeContext:null,retryLane:0};function v3(d){return{baseLanes:d,cachePool:null}}function Px(d,g,S){var C=g.pendingProps,R=qn.current,P=!1,J=(g.flags&128)!==0,ae;if((ae=J)||(ae=d!==null&&d.memoizedState===null?!1:(R&2)!==0),ae?(P=!0,g.flags&=-129):(d===null||d.memoizedState!==null)&&(R|=1),Tt(qn,R&1),d===null)return aA(g),d=g.memoizedState,d!==null&&(d=d.dehydrated,d!==null)?(g.mode&1?Pn(d)?g.lanes=8:g.lanes=1073741824:g.lanes=1,null):(R=C.children,d=C.fallback,P?(C=g.mode,P=g.child,R={mode:"hidden",children:R},!(C&1)&&P!==null?(P.childLanes=0,P.pendingProps=R):P=k3(R,C,0,null),d=Ac(d,C,S,null),P.return=g,d.return=g,P.sibling=d,g.child=P,g.child.memoizedState=v3(S),g.memoizedState=A3,d):EA(g,R));if(R=d.memoizedState,R!==null){if(ae=R.dehydrated,ae!==null){if(J)return g.flags&256?(g.flags&=-257,y3(d,g,S,Error(a(422)))):g.memoizedState!==null?(g.child=d.child,g.flags|=128,null):(P=C.fallback,R=g.mode,C=k3({mode:"visible",children:C.children},R,0,null),P=Ac(P,R,S,null),P.flags|=2,C.return=g,P.return=g,C.sibling=P,g.child=C,g.mode&1&&Uu(g,d.child,null,S),g.child.memoizedState=v3(S),g.memoizedState=A3,P);if(!(g.mode&1))g=y3(d,g,S,null);else if(Pn(ae))g=y3(d,g,S,Error(a(419)));else if(C=(S&d.childLanes)!==0,es||C){if(C=xi,C!==null){switch(S&-S){case 4:P=2;break;case 16:P=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:P=32;break;case 536870912:P=268435456;break;default:P=0}C=P&(C.suspendedLanes|S)?0:P,C!==0&&C!==R.retryLane&&(R.retryLane=C,Cs(d,C,-1))}QA(),g=y3(d,g,S,Error(a(421)))}else on(ae)?(g.flags|=128,g.child=d.child,g=XD.bind(null,d),Wi(ae,g),g=null):(S=R.treeContext,ge&&(Zr=ys(ae),Jr=g,zn=!0,$s=null,Rf=!1,S!==null&&(_s[Es++]=Ao,_s[Es++]=vo,_s[Es++]=cc,Ao=S.id,vo=S.overflow,cc=g)),g=EA(g,g.pendingProps.children),g.flags|=4096);return g}return P?(C=Ux(d,g,C.children,C.fallback,S),P=g.child,R=d.child.memoizedState,P.memoizedState=R===null?v3(S):{baseLanes:R.baseLanes|S,cachePool:null},P.childLanes=d.childLanes&~S,g.memoizedState=A3,C):(S=Lx(d,g,C.children,S),g.memoizedState=null,S)}return P?(C=Ux(d,g,C.children,C.fallback,S),P=g.child,R=d.child.memoizedState,P.memoizedState=R===null?v3(S):{baseLanes:R.baseLanes|S,cachePool:null},P.childLanes=d.childLanes&~S,g.memoizedState=A3,C):(S=Lx(d,g,C.children,S),g.memoizedState=null,S)}function EA(d,g){return g=k3({mode:"visible",children:g},d.mode,0,null),g.return=d,d.child=g}function Lx(d,g,S,C){var R=d.child;return d=R.sibling,S=cl(R,{mode:"visible",children:S}),!(g.mode&1)&&(S.lanes=C),S.return=g,S.sibling=null,d!==null&&(C=g.deletions,C===null?(g.deletions=[d],g.flags|=16):C.push(d)),g.child=S}function Ux(d,g,S,C,R){var P=g.mode;d=d.child;var J=d.sibling,ae={mode:"hidden",children:S};return!(P&1)&&g.child!==d?(S=g.child,S.childLanes=0,S.pendingProps=ae,g.deletions=null):(S=cl(d,ae),S.subtreeFlags=d.subtreeFlags&14680064),J!==null?C=cl(J,C):(C=Ac(C,P,R,null),C.flags|=2),C.return=g,S.return=g,S.sibling=C,g.child=S,C}function y3(d,g,S,C){return C!==null&&oA(C),Uu(g,d.child,null,S),d=EA(g,g.pendingProps.children),d.flags|=2,g.memoizedState=null,d}function Ox(d,g,S){d.lanes|=g;var C=d.alternate;C!==null&&(C.lanes|=g),Ar(d.return,g,S)}function SA(d,g,S,C,R){var P=d.memoizedState;P===null?d.memoizedState={isBackwards:g,rendering:null,renderingStartTime:0,last:C,tail:S,tailMode:R}:(P.isBackwards=g,P.rendering=null,P.renderingStartTime=0,P.last=C,P.tail=S,P.tailMode=R)}function Fx(d,g,S){var C=g.pendingProps,R=C.revealOrder,P=C.tail;if(vr(d,g,C.children,S),C=qn.current,C&2)C=C&1|2,g.flags|=128;else{if(d!==null&&d.flags&128)e:for(d=g.child;d!==null;){if(d.tag===13)d.memoizedState!==null&&Ox(d,S,g);else if(d.tag===19)Ox(d,S,g);else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===g)break e;for(;d.sibling===null;){if(d.return===null||d.return===g)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}C&=1}if(Tt(qn,C),!(g.mode&1))g.memoizedState=null;else switch(R){case"forwards":for(S=g.child,R=null;S!==null;)d=S.alternate,d!==null&&o3(d)===null&&(R=S),S=S.sibling;S=R,S===null?(R=g.child,g.child=null):(R=S.sibling,S.sibling=null),SA(g,!1,R,S,P);break;case"backwards":for(S=null,R=g.child,g.child=null;R!==null;){if(d=R.alternate,d!==null&&o3(d)===null){g.child=R;break}d=R.sibling,R.sibling=S,S=R,R=d}SA(g,!0,S,null,P);break;case"together":SA(g,!1,null,null,void 0);break;default:g.memoizedState=null}return g.child}function xo(d,g,S){if(d!==null&&(g.dependencies=d.dependencies),Gu|=g.lanes,!(S&g.childLanes))return null;if(d!==null&&g.child!==d.child)throw Error(a(153));if(g.child!==null){for(d=g.child,S=cl(d,d.pendingProps),g.child=S,S.return=g;d.sibling!==null;)d=d.sibling,S=S.sibling=cl(d,d.pendingProps),S.return=g;S.sibling=null}return g.child}function OD(d,g,S){switch(g.tag){case 3:Bx(g),Lu();break;case 5:Z8(g);break;case 1:Ln(g.type)&&Ca(g);break;case 4:lA(g,g.stateNode.containerInfo);break;case 10:e3(g,g.type._context,g.memoizedProps.value);break;case 13:var C=g.memoizedState;if(C!==null)return C.dehydrated!==null?(Tt(qn,qn.current&1),g.flags|=128,null):S&g.child.childLanes?Px(d,g,S):(Tt(qn,qn.current&1),d=xo(d,g,S),d!==null?d.sibling:null);Tt(qn,qn.current&1);break;case 19:if(C=(S&g.childLanes)!==0,d.flags&128){if(C)return Fx(d,g,S);g.flags|=128}var R=g.memoizedState;if(R!==null&&(R.rendering=null,R.tail=null,R.lastEffect=null),Tt(qn,qn.current),C)break;return null;case 22:case 23:return g.lanes=0,Ix(d,g,S)}return xo(d,g,S)}function FD(d,g){switch(rA(g),g.tag){case 1:return Ln(g.type)&&dr(),d=g.flags,d&65536?(g.flags=d&-65537|128,g):null;case 3:return Fu(),tn(Gn),tn(ti),hA(),d=g.flags,d&65536&&!(d&128)?(g.flags=d&-65537|128,g):null;case 5:return cA(g),null;case 13:if(tn(qn),d=g.memoizedState,d!==null&&d.dehydrated!==null){if(g.alternate===null)throw Error(a(340));Lu()}return d=g.flags,d&65536?(g.flags=d&-65537|128,g):null;case 19:return tn(qn),null;case 4:return Fu(),null;case 10:return ki(g.type._context),null;case 22:case 23:return zA(),null;case 24:return null;default:return null}}var x3=!1,fc=!1,kD=typeof WeakSet=="function"?WeakSet:Set,et=null;function _3(d,g){var S=d.ref;if(S!==null)if(typeof S=="function")try{S(null)}catch(C){kr(d,g,C)}else S.current=null}function wA(d,g,S){try{S()}catch(C){kr(d,g,C)}}var kx=!1;function ND(d,g){for(H(d.containerInfo),et=g;et!==null;)if(d=et,g=d.child,(d.subtreeFlags&1028)!==0&&g!==null)g.return=d,et=g;else for(;et!==null;){d=et;try{var S=d.alternate;if(d.flags&1024)switch(d.tag){case 0:case 11:case 15:break;case 1:if(S!==null){var C=S.memoizedProps,R=S.memoizedState,P=d.stateNode,J=P.getSnapshotBeforeUpdate(d.elementType===d.type?C:mr(d.type,C),R);P.__reactInternalSnapshotBeforeUpdate=J}break;case 3:oe&&Qe(d.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(ae){kr(d,d.return,ae)}if(g=d.sibling,g!==null){g.return=d.return,et=g;break}et=d.return}return S=kx,kx=!1,S}function dc(d,g,S){var C=g.updateQueue;if(C=C!==null?C.lastEffect:null,C!==null){var R=C=C.next;do{if((R.tag&d)===d){var P=R.destroy;R.destroy=void 0,P!==void 0&&wA(g,S,P)}R=R.next}while(R!==C)}}function Qf(d,g){if(g=g.updateQueue,g=g!==null?g.lastEffect:null,g!==null){var S=g=g.next;do{if((S.tag&d)===d){var C=S.create;S.destroy=C()}S=S.next}while(S!==g)}}function CA(d){var g=d.ref;if(g!==null){var S=d.stateNode;switch(d.tag){case 5:d=F(S);break;default:d=S}typeof g=="function"?g(d):g.current=d}}function Nx(d,g,S){if(jr&&typeof jr.onCommitFiberUnmount=="function")try{jr.onCommitFiberUnmount(sc,g)}catch{}switch(g.tag){case 0:case 11:case 14:case 15:if(d=g.updateQueue,d!==null&&(d=d.lastEffect,d!==null)){var C=d=d.next;do{var R=C,P=R.destroy;R=R.tag,P!==void 0&&(R&2||R&4)&&wA(g,S,P),C=C.next}while(C!==d)}break;case 1:if(_3(g,S),d=g.stateNode,typeof d.componentWillUnmount=="function")try{d.props=g.memoizedProps,d.state=g.memoizedState,d.componentWillUnmount()}catch(J){kr(g,S,J)}break;case 5:_3(g,S);break;case 4:oe?Wx(d,g,S):W&&W&&(g=g.stateNode.containerInfo,S=Dt(g),Jt(g,S))}}function Gx(d,g,S){for(var C=g;;)if(Nx(d,C,S),C.child===null||oe&&C.tag===4){if(C===g)break;for(;C.sibling===null;){if(C.return===null||C.return===g)return;C=C.return}C.sibling.return=C.return,C=C.sibling}else C.child.return=C,C=C.child}function zx(d){var g=d.alternate;g!==null&&(d.alternate=null,zx(g)),d.child=null,d.deletions=null,d.sibling=null,d.tag===5&&(g=d.stateNode,g!==null&&Pe(g)),d.stateNode=null,d.return=null,d.dependencies=null,d.memoizedProps=null,d.memoizedState=null,d.pendingProps=null,d.stateNode=null,d.updateQueue=null}function Qx(d){return d.tag===5||d.tag===3||d.tag===4}function Hx(d){e:for(;;){for(;d.sibling===null;){if(d.return===null||Qx(d.return))return null;d=d.return}for(d.sibling.return=d.return,d=d.sibling;d.tag!==5&&d.tag!==6&&d.tag!==18;){if(d.flags&2||d.child===null||d.tag===4)continue e;d.child.return=d,d=d.child}if(!(d.flags&2))return d.stateNode}}function Vx(d){if(oe){e:{for(var g=d.return;g!==null;){if(Qx(g))break e;g=g.return}throw Error(a(160))}var S=g;switch(S.tag){case 5:g=S.stateNode,S.flags&32&&(it(g),S.flags&=-33),S=Hx(d),bA(d,S,g);break;case 3:case 4:g=S.stateNode.containerInfo,S=Hx(d),TA(d,S,g);break;default:throw Error(a(161))}}}function TA(d,g,S){var C=d.tag;if(C===5||C===6)d=d.stateNode,g?We(S,d,g):ke(S,d);else if(C!==4&&(d=d.child,d!==null))for(TA(d,g,S),d=d.sibling;d!==null;)TA(d,g,S),d=d.sibling}function bA(d,g,S){var C=d.tag;if(C===5||C===6)d=d.stateNode,g?je(S,d,g):we(S,d);else if(C!==4&&(d=d.child,d!==null))for(bA(d,g,S),d=d.sibling;d!==null;)bA(d,g,S),d=d.sibling}function Wx(d,g,S){for(var C=g,R=!1,P,J;;){if(!R){R=C.return;e:for(;;){if(R===null)throw Error(a(160));switch(P=R.stateNode,R.tag){case 5:J=!1;break e;case 3:P=P.containerInfo,J=!0;break e;case 4:P=P.containerInfo,J=!0;break e}R=R.return}R=!0}if(C.tag===5||C.tag===6)Gx(d,C,S),J?Ve(P,C.stateNode):Oe(P,C.stateNode);else if(C.tag===18)J?mt(P,C.stateNode):rt(P,C.stateNode);else if(C.tag===4){if(C.child!==null){P=C.stateNode.containerInfo,J=!0,C.child.return=C,C=C.child;continue}}else if(Nx(d,C,S),C.child!==null){C.child.return=C,C=C.child;continue}if(C===g)break;for(;C.sibling===null;){if(C.return===null||C.return===g)return;C=C.return,C.tag===4&&(R=!1)}C.sibling.return=C.return,C=C.sibling}}function IA(d,g){if(oe){switch(g.tag){case 0:case 11:case 14:case 15:dc(3,g,g.return),Qf(3,g),dc(5,g,g.return);return;case 1:return;case 5:var S=g.stateNode;if(S!=null){var C=g.memoizedProps;d=d!==null?d.memoizedProps:C;var R=g.type,P=g.updateQueue;g.updateQueue=null,P!==null&&ze(S,P,R,d,C,g)}return;case 6:if(g.stateNode===null)throw Error(a(162));S=g.memoizedProps,Ue(g.stateNode,d!==null?d.memoizedProps:S,S);return;case 3:ge&&d!==null&&d.memoizedState.isDehydrated&&de(g.stateNode.containerInfo);return;case 12:return;case 13:E3(g);return;case 19:E3(g);return;case 17:return}throw Error(a(163))}switch(g.tag){case 0:case 11:case 14:case 15:dc(3,g,g.return),Qf(3,g),dc(5,g,g.return);return;case 12:return;case 13:E3(g);return;case 19:E3(g);return;case 3:ge&&d!==null&&d.memoizedState.isDehydrated&&de(g.stateNode.containerInfo);break;case 22:case 23:return}e:if(W){switch(g.tag){case 1:case 5:case 6:break e;case 3:case 4:g=g.stateNode,Jt(g.containerInfo,g.pendingChildren);break e}throw Error(a(163))}}function E3(d){var g=d.updateQueue;if(g!==null){d.updateQueue=null;var S=d.stateNode;S===null&&(S=d.stateNode=new kD),g.forEach(function(C){var R=jD.bind(null,d,C);S.has(C)||(S.add(C),C.then(R,R))})}}function GD(d,g){for(et=g;et!==null;){g=et;var S=g.deletions;if(S!==null)for(var C=0;C<S.length;C++){var R=S[C];try{var P=d;oe?Wx(P,R,g):Gx(P,R,g);var J=R.alternate;J!==null&&(J.return=null),R.return=null}catch(ht){kr(R,g,ht)}}if(S=g.child,g.subtreeFlags&12854&&S!==null)S.return=g,et=S;else for(;et!==null;){g=et;try{var ae=g.flags;if(ae&32&&oe&&it(g.stateNode),ae&512){var be=g.alternate;if(be!==null){var Ye=be.ref;Ye!==null&&(typeof Ye=="function"?Ye(null):Ye.current=null)}}if(ae&8192)switch(g.tag){case 13:if(g.memoizedState!==null){var st=g.alternate;(st===null||st.memoizedState===null)&&(UA=Yn())}break;case 22:var Ot=g.memoizedState!==null,yt=g.alternate,Rn=yt!==null&&yt.memoizedState!==null;if(S=g,oe){e:if(C=S,R=Ot,P=null,oe)for(var dt=C;;){if(dt.tag===5){if(P===null){P=dt;var sr=dt.stateNode;R?gt(sr):Fe(dt.stateNode,dt.memoizedProps)}}else if(dt.tag===6){if(P===null){var bs=dt.stateNode;R?ne(bs):me(bs,dt.memoizedProps)}}else if((dt.tag!==22&&dt.tag!==23||dt.memoizedState===null||dt===C)&&dt.child!==null){dt.child.return=dt,dt=dt.child;continue}if(dt===C)break;for(;dt.sibling===null;){if(dt.return===null||dt.return===C)break e;P===dt&&(P=null),dt=dt.return}P===dt&&(P=null),dt.sibling.return=dt.return,dt=dt.sibling}}if(Ot&&!Rn&&S.mode&1){et=S;for(var ve=S.child;ve!==null;){for(S=et=ve;et!==null;){C=et;var le=C.child;switch(C.tag){case 0:case 11:case 14:case 15:dc(4,C,C.return);break;case 1:_3(C,C.return);var Ee=C.stateNode;if(typeof Ee.componentWillUnmount=="function"){var tt=C.return;try{Ee.props=C.memoizedProps,Ee.state=C.memoizedState,Ee.componentWillUnmount()}catch(ht){kr(C,tt,ht)}}break;case 5:_3(C,C.return);break;case 22:if(C.memoizedState!==null){Xx(S);continue}}le!==null?(le.return=C,et=le):Xx(S)}ve=ve.sibling}}}switch(ae&4102){case 2:Vx(g),g.flags&=-3;break;case 6:Vx(g),g.flags&=-3,IA(g.alternate,g);break;case 4096:g.flags&=-4097;break;case 4100:g.flags&=-4097,IA(g.alternate,g);break;case 4:IA(g.alternate,g)}}catch(ht){kr(g,g.return,ht)}if(S=g.sibling,S!==null){S.return=g.return,et=S;break}et=g.return}}}function zD(d,g,S){et=d,Yx(d)}function Yx(d,g,S){for(var C=(d.mode&1)!==0;et!==null;){var R=et,P=R.child;if(R.tag===22&&C){var J=R.memoizedState!==null||x3;if(!J){var ae=R.alternate,be=ae!==null&&ae.memoizedState!==null||fc;ae=x3;var Ye=fc;if(x3=J,(fc=be)&&!Ye)for(et=R;et!==null;)J=et,be=J.child,J.tag===22&&J.memoizedState!==null?jx(R):be!==null?(be.return=J,et=be):jx(R);for(;P!==null;)et=P,Yx(P),P=P.sibling;et=R,x3=ae,fc=Ye}qx(d)}else R.subtreeFlags&8772&&P!==null?(P.return=R,et=P):qx(d)}}function qx(d){for(;et!==null;){var g=et;if(g.flags&8772){var S=g.alternate;try{if(g.flags&8772)switch(g.tag){case 0:case 11:case 15:fc||Qf(5,g);break;case 1:var C=g.stateNode;if(g.flags&4&&!fc)if(S===null)C.componentDidMount();else{var R=g.elementType===g.type?S.memoizedProps:mr(g.type,S.memoizedProps);C.componentDidUpdate(R,S.memoizedState,C.__reactInternalSnapshotBeforeUpdate)}var P=g.updateQueue;P!==null&&z8(g,P,C);break;case 3:var J=g.updateQueue;if(J!==null){if(S=null,g.child!==null)switch(g.child.tag){case 5:S=F(g.child.stateNode);break;case 1:S=g.child.stateNode}z8(g,J,S)}break;case 5:var ae=g.stateNode;S===null&&g.flags&4&&xe(ae,g.type,g.memoizedProps,g);break;case 6:break;case 4:break;case 12:break;case 13:if(ge&&g.memoizedState===null){var be=g.alternate;if(be!==null){var Ye=be.memoizedState;if(Ye!==null){var st=Ye.dehydrated;st!==null&&Me(st)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(a(163))}fc||g.flags&512&&CA(g)}catch(Ot){kr(g,g.return,Ot)}}if(g===d){et=null;break}if(S=g.sibling,S!==null){S.return=g.return,et=S;break}et=g.return}}function Xx(d){for(;et!==null;){var g=et;if(g===d){et=null;break}var S=g.sibling;if(S!==null){S.return=g.return,et=S;break}et=g.return}}function jx(d){for(;et!==null;){var g=et;try{switch(g.tag){case 0:case 11:case 15:var S=g.return;try{Qf(4,g)}catch(be){kr(g,S,be)}break;case 1:var C=g.stateNode;if(typeof C.componentDidMount=="function"){var R=g.return;try{C.componentDidMount()}catch(be){kr(g,R,be)}}var P=g.return;try{CA(g)}catch(be){kr(g,P,be)}break;case 5:var J=g.return;try{CA(g)}catch(be){kr(g,J,be)}}}catch(be){kr(g,g.return,be)}if(g===d){et=null;break}var ae=g.sibling;if(ae!==null){ae.return=g.return,et=ae;break}et=g.return}}var S3=0,w3=1,C3=2,T3=3,b3=4;if(typeof Symbol=="function"&&Symbol.for){var Hf=Symbol.for;S3=Hf("selector.component"),w3=Hf("selector.has_pseudo_class"),C3=Hf("selector.role"),T3=Hf("selector.test_id"),b3=Hf("selector.text")}function MA(d){var g=he(d);if(g!=null){if(typeof g.memoizedProps["data-testname"]!="string")throw Error(a(364));return g}if(d=Se(d),d===null)throw Error(a(362));return d.stateNode.current}function RA(d,g){switch(g.$$typeof){case S3:if(d.type===g.value)return!0;break;case w3:e:{g=g.value,d=[d,0];for(var S=0;S<d.length;){var C=d[S++],R=d[S++],P=g[R];if(C.tag!==5||!z(C)){for(;P!=null&&RA(C,P);)R++,P=g[R];if(R===g.length){g=!0;break e}else for(C=C.child;C!==null;)d.push(C,R),C=C.sibling}}g=!1}return g;case C3:if(d.tag===5&&se(d.stateNode,g.value))return!0;break;case b3:if((d.tag===5||d.tag===6)&&(d=X(d),d!==null&&0<=d.indexOf(g.value)))return!0;break;case T3:if(d.tag===5&&(d=d.memoizedProps["data-testname"],typeof d=="string"&&d.toLowerCase()===g.value.toLowerCase()))return!0;break;default:throw Error(a(365))}return!1}function BA(d){switch(d.$$typeof){case S3:return"<"+(T(d.value)||"Unknown")+">";case w3:return":has("+(BA(d)||"")+")";case C3:return'[role="'+d.value+'"]';case b3:return'"'+d.value+'"';case T3:return'[data-testname="'+d.value+'"]';default:throw Error(a(365))}}function Kx(d,g){var S=[];d=[d,0];for(var C=0;C<d.length;){var R=d[C++],P=d[C++],J=g[P];if(R.tag!==5||!z(R)){for(;J!=null&&RA(R,J);)P++,J=g[P];if(P===g.length)S.push(R);else for(R=R.child;R!==null;)d.push(R,P),R=R.sibling}}return S}function DA(d,g){if(!Le)throw Error(a(363));d=MA(d),d=Kx(d,g),g=[],d=Array.from(d);for(var S=0;S<d.length;){var C=d[S++];if(C.tag===5)z(C)||g.push(C.stateNode);else for(C=C.child;C!==null;)d.push(C),C=C.sibling}return g}var QD=Math.ceil,I3=o.ReactCurrentDispatcher,PA=o.ReactCurrentOwner,pi=o.ReactCurrentBatchConfig,qt=0,xi=null,_i=null,Yi=0,ts=0,Nu=Ct(0),Ci=0,Vf=null,Gu=0,M3=0,LA=0,Wf=null,Or=null,UA=0,OA=1/0;function zu(){OA=Yn()+500}var R3=!1,FA=null,sl=null,B3=!1,al=null,D3=0,Yf=0,kA=null,P3=-1,L3=0;function yr(){return qt&6?Yn():P3!==-1?P3:P3=Yn()}function ol(d){return d.mode&1?qt&2&&Yi!==0?Yi&-Yi:ac.transition!==null?(L3===0&&(d=uo,uo<<=1,!(uo&4194240)&&(uo=64),L3=d),L3):(d=Xt,d!==0?d:fe()):1}function Cs(d,g,S){if(50<Yf)throw Yf=0,kA=null,Error(a(185));var C=U3(d,g);return C===null?null:(Ta(C,g,S),(!(qt&2)||C!==xi)&&(C===xi&&(!(qt&2)&&(M3|=g),Ci===4&&ll(C,Yi)),Fr(C,S),g===1&&qt===0&&!(d.mode&1)&&(zu(),Ia&&Ur())),C)}function U3(d,g){d.lanes|=g;var S=d.alternate;for(S!==null&&(S.lanes|=g),S=d,d=d.return;d!==null;)d.childLanes|=g,S=d.alternate,S!==null&&(S.childLanes|=g),S=d,d=d.return;return S.tag===3?S.stateNode:null}function Fr(d,g){var S=d.callbackNode;Sf(d,g);var C=ic(d,d===xi?Yi:0);if(C===0)S!==null&&Mu(S),d.callbackNode=null,d.callbackPriority=0;else if(g=C&-C,d.callbackPriority!==g){if(S!=null&&Mu(S),g===1)d.tag===0?Mf(Jx.bind(null,d)):If(Jx.bind(null,d)),pe?Re(function(){qt===0&&Ur()}):go(rc,Ur),S=null;else{switch(wf(C)){case 1:S=rc;break;case 4:S=J0;break;case 16:S=pr;break;case 536870912:S=Tf;break;default:S=pr}S=o_(S,$x.bind(null,d))}d.callbackPriority=g,d.callbackNode=S}}function $x(d,g){if(P3=-1,L3=0,qt&6)throw Error(a(327));var S=d.callbackNode;if(mc()&&d.callbackNode!==S)return null;var C=ic(d,d===xi?Yi:0);if(C===0)return null;if(C&30||C&d.expiredLanes||g)g=O3(d,C);else{g=C;var R=qt;qt|=2;var P=t_();(xi!==d||Yi!==g)&&(zu(),pc(d,g));do try{WD();break}catch(ae){e_(d,ae)}while(1);Bu(),I3.current=P,qt=R,_i!==null?g=0:(xi=null,Yi=0,g=Ci)}if(g!==0){if(g===2&&(R=po(d),R!==0&&(C=R,g=NA(d,R))),g===1)throw S=Vf,pc(d,0),ll(d,C),Fr(d,Yn()),S;if(g===6)ll(d,C);else{if(R=d.current.alternate,!(C&30)&&!HD(R)&&(g=O3(d,C),g===2&&(P=po(d),P!==0&&(C=P,g=NA(d,P))),g===1))throw S=Vf,pc(d,0),ll(d,C),Fr(d,Yn()),S;switch(d.finishedWork=R,d.finishedLanes=C,g){case 0:case 1:throw Error(a(345));case 2:gc(d,Or);break;case 3:if(ll(d,C),(C&130023424)===C&&(g=UA+500-Yn(),10<g)){if(ic(d,0)!==0)break;if(R=d.suspendedLanes,(R&C)!==C){yr(),d.pingedLanes|=d.suspendedLanes&R;break}d.timeoutHandle=te(gc.bind(null,d,Or),g);break}gc(d,Or);break;case 4:if(ll(d,C),(C&4194240)===C)break;for(g=d.eventTimes,R=-1;0<C;){var J=31-Xr(C);P=1<<J,J=g[J],J>R&&(R=J),C&=~P}if(C=R,C=Yn()-C,C=(120>C?120:480>C?480:1080>C?1080:1920>C?1920:3e3>C?3e3:4320>C?4320:1960*QD(C/1960))-C,10<C){d.timeoutHandle=te(gc.bind(null,d,Or),C);break}gc(d,Or);break;case 5:gc(d,Or);break;default:throw Error(a(329))}}}return Fr(d,Yn()),d.callbackNode===S?$x.bind(null,d):null}function NA(d,g){var S=Wf;return d.current.memoizedState.isDehydrated&&(pc(d,g).flags|=256),d=O3(d,g),d!==2&&(g=Or,Or=S,g!==null&&GA(g)),d}function GA(d){Or===null?Or=d:Or.push.apply(Or,d)}function HD(d){for(var g=d;;){if(g.flags&16384){var S=g.updateQueue;if(S!==null&&(S=S.stores,S!==null))for(var C=0;C<S.length;C++){var R=S[C],P=R.getSnapshot;R=R.value;try{if(!Kr(P(),R))return!1}catch{return!1}}}if(S=g.child,g.subtreeFlags&16384&&S!==null)S.return=g,g=S;else{if(g===d)break;for(;g.sibling===null;){if(g.return===null||g.return===d)return!0;g=g.return}g.sibling.return=g.return,g=g.sibling}}return!0}function ll(d,g){for(g&=~LA,g&=~M3,d.suspendedLanes|=g,d.pingedLanes&=~g,d=d.expirationTimes;0<g;){var S=31-Xr(g),C=1<<S;d[S]=-1,g&=~C}}function Jx(d){if(qt&6)throw Error(a(327));mc();var g=ic(d,0);if(!(g&1))return Fr(d,Yn()),null;var S=O3(d,g);if(d.tag!==0&&S===2){var C=po(d);C!==0&&(g=C,S=NA(d,C))}if(S===1)throw S=Vf,pc(d,0),ll(d,g),Fr(d,Yn()),S;if(S===6)throw Error(a(345));return d.finishedWork=d.current.alternate,d.finishedLanes=g,gc(d,Or),Fr(d,Yn()),null}function Zx(d){al!==null&&al.tag===0&&!(qt&6)&&mc();var g=qt;qt|=1;var S=pi.transition,C=Xt;try{if(pi.transition=null,Xt=1,d)return d()}finally{Xt=C,pi.transition=S,qt=g,!(qt&6)&&Ur()}}function zA(){ts=Nu.current,tn(Nu)}function pc(d,g){d.finishedWork=null,d.finishedLanes=0;var S=d.timeoutHandle;if(S!==ce&&(d.timeoutHandle=ce,re(S)),_i!==null)for(S=_i.return;S!==null;){var C=S;switch(rA(C),C.tag){case 1:C=C.type.childContextTypes,C!=null&&dr();break;case 3:Fu(),tn(Gn),tn(ti),hA();break;case 5:cA(C);break;case 4:Fu();break;case 13:tn(qn);break;case 19:tn(qn);break;case 10:ki(C.type._context);break;case 22:case 23:zA()}S=S.return}if(xi=d,_i=d=cl(d.current,null),Yi=ts=g,Ci=0,Vf=null,LA=M3=Gu=0,Or=Wf=null,$r!==null){for(g=0;g<$r.length;g++)if(S=$r[g],C=S.interleaved,C!==null){S.interleaved=null;var R=C.next,P=S.pending;if(P!==null){var J=P.next;P.next=R,C.next=J}S.pending=C}$r=null}return d}function e_(d,g){do{var S=_i;try{if(Bu(),l3.current=p3,c3){for(var C=ni.memoizedState;C!==null;){var R=C.queue;R!==null&&(R.pending=null),C=C.next}c3=!1}if(ku=0,Ni=nr=ni=null,Uf=!1,Of=0,PA.current=null,S===null||S.return===null){Ci=1,Vf=g,_i=null;break}e:{var P=d,J=S.return,ae=S,be=g;if(g=Yi,ae.flags|=32768,be!==null&&typeof be=="object"&&typeof be.then=="function"){var Ye=be,st=ae,Ot=st.tag;if(!(st.mode&1)&&(Ot===0||Ot===11||Ot===15)){var yt=st.alternate;yt?(st.updateQueue=yt.updateQueue,st.memoizedState=yt.memoizedState,st.lanes=yt.lanes):(st.updateQueue=null,st.memoizedState=null)}var Rn=_x(J);if(Rn!==null){Rn.flags&=-257,Ex(Rn,J,ae,P,g),Rn.mode&1&&xx(P,Ye,g),g=Rn,be=Ye;var dt=g.updateQueue;if(dt===null){var sr=new Set;sr.add(be),g.updateQueue=sr}else dt.add(be);break e}else{if(!(g&1)){xx(P,Ye,g),QA();break e}be=Error(a(426))}}else if(zn&&ae.mode&1){var bs=_x(J);if(bs!==null){!(bs.flags&65536)&&(bs.flags|=256),Ex(bs,J,ae,P,g),oA(be);break e}}P=be,Ci!==4&&(Ci=2),Wf===null?Wf=[P]:Wf.push(P),be=vA(be,ae),ae=J;do{switch(ae.tag){case 3:ae.flags|=65536,g&=-g,ae.lanes|=g;var ve=vx(ae,be,g);G8(ae,ve);break e;case 1:P=be;var le=ae.type,Ee=ae.stateNode;if(!(ae.flags&128)&&(typeof le.getDerivedStateFromError=="function"||Ee!==null&&typeof Ee.componentDidCatch=="function"&&(sl===null||!sl.has(Ee)))){ae.flags|=65536,g&=-g,ae.lanes|=g;var tt=yx(ae,P,g);G8(ae,tt);break e}}ae=ae.return}while(ae!==null)}i_(S)}catch(ht){g=ht,_i===S&&S!==null&&(_i=S=S.return);continue}break}while(1)}function t_(){var d=I3.current;return I3.current=p3,d===null?p3:d}function QA(){(Ci===0||Ci===3||Ci===2)&&(Ci=4),xi===null||!(Gu&268435455)&&!(M3&268435455)||ll(xi,Yi)}function O3(d,g){var S=qt;qt|=2;var C=t_();xi===d&&Yi===g||pc(d,g);do try{VD();break}catch(R){e_(d,R)}while(1);if(Bu(),qt=S,I3.current=C,_i!==null)throw Error(a(261));return xi=null,Yi=0,Ci}function VD(){for(;_i!==null;)n_(_i)}function WD(){for(;_i!==null&&!Cf();)n_(_i)}function n_(d){var g=a_(d.alternate,d,ts);d.memoizedProps=d.pendingProps,g===null?i_(d):_i=g,PA.current=null}function i_(d){var g=d;do{var S=g.alternate;if(d=g.return,g.flags&32768){if(S=FD(S,g),S!==null){S.flags&=32767,_i=S;return}if(d!==null)d.flags|=32768,d.subtreeFlags=0,d.deletions=null;else{Ci=6,_i=null;return}}else if(S=LD(S,g,ts),S!==null){_i=S;return}if(g=g.sibling,g!==null){_i=g;return}_i=g=d}while(g!==null);Ci===0&&(Ci=5)}function gc(d,g){var S=Xt,C=pi.transition;try{pi.transition=null,Xt=1,YD(d,g,S)}finally{pi.transition=C,Xt=S}return null}function YD(d,g,S){do mc();while(al!==null);if(qt&6)throw Error(a(327));var C=d.finishedWork,R=d.finishedLanes;if(C===null)return null;if(d.finishedWork=null,d.finishedLanes=0,C===d.current)throw Error(a(177));d.callbackNode=null,d.callbackPriority=0;var P=C.lanes|C.childLanes;if(tl(d,P),d===xi&&(_i=xi=null,Yi=0),!(C.subtreeFlags&2064)&&!(C.flags&2064)||B3||(B3=!0,o_(pr,function(){return mc(),null})),P=(C.flags&15990)!==0,C.subtreeFlags&15990||P){P=pi.transition,pi.transition=null;var J=Xt;Xt=1;var ae=qt;qt|=4,PA.current=null,ND(d,C),GD(d,C),V(d.containerInfo),d.current=C,zD(C),$0(),qt=ae,Xt=J,pi.transition=P}else d.current=C;if(B3&&(B3=!1,al=d,D3=R),P=d.pendingLanes,P===0&&(sl=null),bf(C.stateNode),Fr(d,Yn()),g!==null)for(S=d.onRecoverableError,C=0;C<g.length;C++)S(g[C]);if(R3)throw R3=!1,d=FA,FA=null,d;return D3&1&&d.tag!==0&&mc(),P=d.pendingLanes,P&1?d===kA?Yf++:(Yf=0,kA=d):Yf=0,Ur(),null}function mc(){if(al!==null){var d=wf(D3),g=pi.transition,S=Xt;try{if(pi.transition=null,Xt=16>d?16:d,al===null)var C=!1;else{if(d=al,al=null,D3=0,qt&6)throw Error(a(331));var R=qt;for(qt|=4,et=d.current;et!==null;){var P=et,J=P.child;if(et.flags&16){var ae=P.deletions;if(ae!==null){for(var be=0;be<ae.length;be++){var Ye=ae[be];for(et=Ye;et!==null;){var st=et;switch(st.tag){case 0:case 11:case 15:dc(8,st,P)}var Ot=st.child;if(Ot!==null)Ot.return=st,et=Ot;else for(;et!==null;){st=et;var yt=st.sibling,Rn=st.return;if(zx(st),st===Ye){et=null;break}if(yt!==null){yt.return=Rn,et=yt;break}et=Rn}}}var dt=P.alternate;if(dt!==null){var sr=dt.child;if(sr!==null){dt.child=null;do{var bs=sr.sibling;sr.sibling=null,sr=bs}while(sr!==null)}}et=P}}if(P.subtreeFlags&2064&&J!==null)J.return=P,et=J;else e:for(;et!==null;){if(P=et,P.flags&2048)switch(P.tag){case 0:case 11:case 15:dc(9,P,P.return)}var ve=P.sibling;if(ve!==null){ve.return=P.return,et=ve;break e}et=P.return}}var le=d.current;for(et=le;et!==null;){J=et;var Ee=J.child;if(J.subtreeFlags&2064&&Ee!==null)Ee.return=J,et=Ee;else e:for(J=le;et!==null;){if(ae=et,ae.flags&2048)try{switch(ae.tag){case 0:case 11:case 15:Qf(9,ae)}}catch(ht){kr(ae,ae.return,ht)}if(ae===J){et=null;break e}var tt=ae.sibling;if(tt!==null){tt.return=ae.return,et=tt;break e}et=ae.return}}if(qt=R,Ur(),jr&&typeof jr.onPostCommitFiberRoot=="function")try{jr.onPostCommitFiberRoot(sc,d)}catch{}C=!0}return C}finally{Xt=S,pi.transition=g}}return!1}function r_(d,g,S){g=vA(S,g),g=vx(d,g,1),rl(d,g),g=yr(),d=U3(d,1),d!==null&&(Ta(d,1,g),Fr(d,g))}function kr(d,g,S){if(d.tag===3)r_(d,d,S);else for(;g!==null;){if(g.tag===3){r_(g,d,S);break}else if(g.tag===1){var C=g.stateNode;if(typeof g.type.getDerivedStateFromError=="function"||typeof C.componentDidCatch=="function"&&(sl===null||!sl.has(C))){d=vA(S,d),d=yx(g,d,1),rl(g,d),d=yr(),g=U3(g,1),g!==null&&(Ta(g,1,d),Fr(g,d));break}}g=g.return}}function qD(d,g,S){var C=d.pingCache;C!==null&&C.delete(g),g=yr(),d.pingedLanes|=d.suspendedLanes&S,xi===d&&(Yi&S)===S&&(Ci===4||Ci===3&&(Yi&130023424)===Yi&&500>Yn()-UA?pc(d,0):LA|=S),Fr(d,g)}function s_(d,g){g===0&&(d.mode&1?(g=ho,ho<<=1,!(ho&130023424)&&(ho=4194304)):g=1);var S=yr();d=U3(d,g),d!==null&&(Ta(d,g,S),Fr(d,S))}function XD(d){var g=d.memoizedState,S=0;g!==null&&(S=g.retryLane),s_(d,S)}function jD(d,g){var S=0;switch(d.tag){case 13:var C=d.stateNode,R=d.memoizedState;R!==null&&(S=R.retryLane);break;case 19:C=d.stateNode;break;default:throw Error(a(314))}C!==null&&C.delete(g),s_(d,S)}var a_;a_=function(d,g,S){if(d!==null)if(d.memoizedProps!==g.pendingProps||Gn.current)es=!0;else{if(!(d.lanes&S)&&!(g.flags&128))return es=!1,OD(d,g,S);es=!!(d.flags&131072)}else es=!1,zn&&g.flags&1048576&&Y8(g,s3,g.index);switch(g.lanes=0,g.tag){case 2:var C=g.type;d!==null&&(d.alternate=null,g.alternate=null,g.flags|=2),d=g.pendingProps;var R=Cn(g,ti.current);fi(g,S),R=dA(null,g,C,d,R,S);var P=pA();return g.flags|=1,typeof R=="object"&&R!==null&&typeof R.render=="function"&&R.$$typeof===void 0?(g.tag=1,g.memoizedState=null,g.updateQueue=null,Ln(C)?(P=!0,Ca(g)):P=!1,g.memoizedState=R.state!==null&&R.state!==void 0?R.state:null,eA(g),R.updater=i3,g.stateNode=R,R._reactInternals=g,nA(g,C,d,S),g=_A(null,g,C,!0,P,S)):(g.tag=0,zn&&P&&iA(g),vr(null,g,R,S),g=g.child),g;case 16:C=g.elementType;e:{switch(d!==null&&(d.alternate=null,g.alternate=null,g.flags|=2),d=g.pendingProps,R=C._init,C=R(C._payload),g.type=C,R=g.tag=$D(C),d=mr(C,d),R){case 0:g=xA(null,g,C,d,S);break e;case 1:g=Rx(null,g,C,d,S);break e;case 11:g=Cx(null,g,C,d,S);break e;case 14:g=Tx(null,g,C,mr(C.type,d),S);break e}throw Error(a(306,C,""))}return g;case 0:return C=g.type,R=g.pendingProps,R=g.elementType===C?R:mr(C,R),xA(d,g,C,R,S);case 1:return C=g.type,R=g.pendingProps,R=g.elementType===C?R:mr(C,R),Rx(d,g,C,R,S);case 3:e:{if(Bx(g),d===null)throw Error(a(387));C=g.pendingProps,P=g.memoizedState,R=P.element,N8(d,g),n3(g,C,null,S);var J=g.memoizedState;if(C=J.element,ge&&P.isDehydrated)if(P={element:C,isDehydrated:!1,cache:J.cache,transitions:J.transitions},g.updateQueue.baseState=P,g.memoizedState=P,g.flags&256){R=Error(a(423)),g=Dx(d,g,C,S,R);break e}else if(C!==R){R=Error(a(424)),g=Dx(d,g,C,S,R);break e}else for(ge&&(Zr=wi(g.stateNode.containerInfo),Jr=g,zn=!0,$s=null,Rf=!1),S=J8(g,null,C,S),g.child=S;S;)S.flags=S.flags&-3|4096,S=S.sibling;else{if(Lu(),C===R){g=xo(d,g,S);break e}vr(d,g,C,S)}g=g.child}return g;case 5:return Z8(g),d===null&&aA(g),C=g.type,R=g.pendingProps,P=d!==null?d.memoizedProps:null,J=R.children,ee(C,R)?J=null:P!==null&&ee(C,P)&&(g.flags|=32),Mx(d,g),vr(d,g,J,S),g.child;case 6:return d===null&&aA(g),null;case 13:return Px(d,g,S);case 4:return lA(g,g.stateNode.containerInfo),C=g.pendingProps,d===null?g.child=Uu(g,null,C,S):vr(d,g,C,S),g.child;case 11:return C=g.type,R=g.pendingProps,R=g.elementType===C?R:mr(C,R),Cx(d,g,C,R,S);case 7:return vr(d,g,g.pendingProps,S),g.child;case 8:return vr(d,g,g.pendingProps.children,S),g.child;case 12:return vr(d,g,g.pendingProps.children,S),g.child;case 10:e:{if(C=g.type._context,R=g.pendingProps,P=g.memoizedProps,J=R.value,e3(g,C,J),P!==null)if(Kr(P.value,J)){if(P.children===R.children&&!Gn.current){g=xo(d,g,S);break e}}else for(P=g.child,P!==null&&(P.return=g);P!==null;){var ae=P.dependencies;if(ae!==null){J=P.child;for(var be=ae.firstContext;be!==null;){if(be.context===C){if(P.tag===1){be=mo(-1,S&-S),be.tag=2;var Ye=P.updateQueue;if(Ye!==null){Ye=Ye.shared;var st=Ye.pending;st===null?be.next=be:(be.next=st.next,st.next=be),Ye.pending=be}}P.lanes|=S,be=P.alternate,be!==null&&(be.lanes|=S),Ar(P.return,S,g),ae.lanes|=S;break}be=be.next}}else if(P.tag===10)J=P.type===g.type?null:P.child;else if(P.tag===18){if(J=P.return,J===null)throw Error(a(341));J.lanes|=S,ae=J.alternate,ae!==null&&(ae.lanes|=S),Ar(J,S,g),J=P.sibling}else J=P.child;if(J!==null)J.return=P;else for(J=P;J!==null;){if(J===g){J=null;break}if(P=J.sibling,P!==null){P.return=J.return,J=P;break}J=J.return}P=J}vr(d,g,R.children,S),g=g.child}return g;case 9:return R=g.type,C=g.pendingProps.children,fi(g,S),R=di(R),C=C(R),g.flags|=1,vr(d,g,C,S),g.child;case 14:return C=g.type,R=mr(C,g.pendingProps),R=mr(C.type,R),Tx(d,g,C,R,S);case 15:return bx(d,g,g.type,g.pendingProps,S);case 17:return C=g.type,R=g.pendingProps,R=g.elementType===C?R:mr(C,R),d!==null&&(d.alternate=null,g.alternate=null,g.flags|=2),g.tag=1,Ln(C)?(d=!0,Ca(g)):d=!1,fi(g,S),V8(g,C,R),nA(g,C,R,S),_A(null,g,C,!0,d,S);case 19:return Fx(d,g,S);case 22:return Ix(d,g,S)}throw Error(a(156,g.tag))};function o_(d,g){return go(d,g)}function KD(d,g,S,C){this.tag=d,this.key=S,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=g,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=C,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ts(d,g,S,C){return new KD(d,g,S,C)}function HA(d){return d=d.prototype,!(!d||!d.isReactComponent)}function $D(d){if(typeof d=="function")return HA(d)?1:0;if(d!=null){if(d=d.$$typeof,d===y)return 11;if(d===_)return 14}return 2}function cl(d,g){var S=d.alternate;return S===null?(S=Ts(d.tag,g,d.key,d.mode),S.elementType=d.elementType,S.type=d.type,S.stateNode=d.stateNode,S.alternate=d,d.alternate=S):(S.pendingProps=g,S.type=d.type,S.flags=0,S.subtreeFlags=0,S.deletions=null),S.flags=d.flags&14680064,S.childLanes=d.childLanes,S.lanes=d.lanes,S.child=d.child,S.memoizedProps=d.memoizedProps,S.memoizedState=d.memoizedState,S.updateQueue=d.updateQueue,g=d.dependencies,S.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext},S.sibling=d.sibling,S.index=d.index,S.ref=d.ref,S}function F3(d,g,S,C,R,P){var J=2;if(C=d,typeof d=="function")HA(d)&&(J=1);else if(typeof d=="string")J=5;else e:switch(d){case u:return Ac(S.children,R,P,g);case h:J=8,R|=8;break;case f:return d=Ts(12,S,g,R|2),d.elementType=f,d.lanes=P,d;case v:return d=Ts(13,S,g,R),d.elementType=v,d.lanes=P,d;case A:return d=Ts(19,S,g,R),d.elementType=A,d.lanes=P,d;case E:return k3(S,R,P,g);default:if(typeof d=="object"&&d!==null)switch(d.$$typeof){case p:J=10;break e;case m:J=9;break e;case y:J=11;break e;case _:J=14;break e;case x:J=16,C=null;break e}throw Error(a(130,d==null?d:typeof d,""))}return g=Ts(J,S,g,R),g.elementType=d,g.type=C,g.lanes=P,g}function Ac(d,g,S,C){return d=Ts(7,d,C,g),d.lanes=S,d}function k3(d,g,S,C){return d=Ts(22,d,C,g),d.elementType=E,d.lanes=S,d.stateNode={},d}function VA(d,g,S){return d=Ts(6,d,null,g),d.lanes=S,d}function WA(d,g,S){return g=Ts(4,d.children!==null?d.children:[],d.key,g),g.lanes=S,g.stateNode={containerInfo:d.containerInfo,pendingChildren:null,implementation:d.implementation},g}function JD(d,g,S,C,R){this.tag=g,this.containerInfo=d,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=ce,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Iu(0),this.expirationTimes=Iu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Iu(0),this.identifierPrefix=C,this.onRecoverableError=R,ge&&(this.mutableSourceEagerHydrationData=null)}function l_(d,g,S,C,R,P,J,ae,be){return d=new JD(d,g,S,ae,be),g===1?(g=1,P===!0&&(g|=8)):g=0,P=Ts(3,null,null,g),d.current=P,P.stateNode=d,P.memoizedState={element:C,isDehydrated:S,cache:null,transitions:null},eA(P),d}function c_(d){if(!d)return hi;d=d._reactInternals;e:{if(b(d)!==d||d.tag!==1)throw Error(a(170));var g=d;do{switch(g.tag){case 3:g=g.stateNode.context;break e;case 1:if(Ln(g.type)){g=g.stateNode.__reactInternalMemoizedMergedChildContext;break e}}g=g.return}while(g!==null);throw Error(a(171))}if(d.tag===1){var S=d.type;if(Ln(S))return wa(d,S,g)}return g}function u_(d){var g=d._reactInternals;if(g===void 0)throw typeof d.render=="function"?Error(a(188)):(d=Object.keys(d).join(","),Error(a(268,d)));return d=U(g),d===null?null:d.stateNode}function h_(d,g){if(d=d.memoizedState,d!==null&&d.dehydrated!==null){var S=d.retryLane;d.retryLane=S!==0&&S<g?S:g}}function YA(d,g){h_(d,g),(d=d.alternate)&&h_(d,g)}function ZD(d){return d=U(d),d===null?null:d.stateNode}function eP(){return null}return t.attemptContinuousHydration=function(d){if(d.tag===13){var g=yr();Cs(d,134217728,g),YA(d,134217728)}},t.attemptHydrationAtCurrentPriority=function(d){if(d.tag===13){var g=yr(),S=ol(d);Cs(d,S,g),YA(d,S)}},t.attemptSynchronousHydration=function(d){switch(d.tag){case 3:var g=d.stateNode;if(g.current.memoizedState.isDehydrated){var S=fo(g.pendingLanes);S!==0&&(ba(g,S|1),Fr(g,Yn()),!(qt&6)&&(zu(),Ur()))}break;case 13:var C=yr();Zx(function(){return Cs(d,1,C)}),YA(d,1)}},t.batchedUpdates=function(d,g){var S=qt;qt|=1;try{return d(g)}finally{qt=S,qt===0&&(zu(),Ia&&Ur())}},t.createComponentSelector=function(d){return{$$typeof:S3,value:d}},t.createContainer=function(d,g,S,C,R,P,J){return l_(d,g,!1,null,S,C,R,P,J)},t.createHasPseudoClassSelector=function(d){return{$$typeof:w3,value:d}},t.createHydrationContainer=function(d,g,S,C,R,P,J,ae,be){return d=l_(S,C,!0,d,R,P,J,ae,be),d.context=c_(null),S=d.current,C=yr(),R=ol(S),P=mo(C,R),P.callback=g??null,rl(S,P),d.current.lanes=R,Ta(d,R,C),Fr(d,C),d},t.createPortal=function(d,g,S){var C=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:C==null?null:""+C,children:d,containerInfo:g,implementation:S}},t.createRoleSelector=function(d){return{$$typeof:C3,value:d}},t.createTestNameSelector=function(d){return{$$typeof:T3,value:d}},t.createTextSelector=function(d){return{$$typeof:b3,value:d}},t.deferredUpdates=function(d){var g=Xt,S=pi.transition;try{return pi.transition=null,Xt=16,d()}finally{Xt=g,pi.transition=S}},t.discreteUpdates=function(d,g,S,C,R){var P=Xt,J=pi.transition;try{return pi.transition=null,Xt=1,d(g,S,C,R)}finally{Xt=P,pi.transition=J,qt===0&&zu()}},t.findAllNodes=DA,t.findBoundingRects=function(d,g){if(!Le)throw Error(a(363));g=DA(d,g),d=[];for(var S=0;S<g.length;S++)d.push($e(g[S]));for(g=d.length-1;0<g;g--){S=d[g];for(var C=S.x,R=C+S.width,P=S.y,J=P+S.height,ae=g-1;0<=ae;ae--)if(g!==ae){var be=d[ae],Ye=be.x,st=Ye+be.width,Ot=be.y,yt=Ot+be.height;if(C>=Ye&&P>=Ot&&R<=st&&J<=yt){d.splice(g,1);break}else if(C!==Ye||S.width!==be.width||yt<P||Ot>J){if(!(P!==Ot||S.height!==be.height||st<C||Ye>R)){Ye>C&&(be.width+=Ye-C,be.x=C),st<R&&(be.width=R-Ye),d.splice(g,1);break}}else{Ot>P&&(be.height+=Ot-P,be.y=P),yt<J&&(be.height=J-Ot),d.splice(g,1);break}}}return d},t.findHostInstance=u_,t.findHostInstanceWithNoPortals=function(d){return d=L(d),d=d!==null?Q(d):null,d===null?null:d.stateNode},t.findHostInstanceWithWarning=function(d){return u_(d)},t.flushControlled=function(d){var g=qt;qt|=1;var S=pi.transition,C=Xt;try{pi.transition=null,Xt=1,d()}finally{Xt=C,pi.transition=S,qt=g,qt===0&&(zu(),Ur())}},t.flushPassiveEffects=mc,t.flushSync=Zx,t.focusWithin=function(d,g){if(!Le)throw Error(a(363));for(d=MA(d),g=Kx(d,g),g=Array.from(g),d=0;d<g.length;){var S=g[d++];if(!z(S)){if(S.tag===5&&Be(S.stateNode))return!0;for(S=S.child;S!==null;)g.push(S),S=S.sibling}}return!1},t.getCurrentUpdatePriority=function(){return Xt},t.getFindAllNodesFailureDescription=function(d,g){if(!Le)throw Error(a(363));var S=0,C=[];d=[MA(d),0];for(var R=0;R<d.length;){var P=d[R++],J=d[R++],ae=g[J];if((P.tag!==5||!z(P))&&(RA(P,ae)&&(C.push(BA(ae)),J++,J>S&&(S=J)),J<g.length))for(P=P.child;P!==null;)d.push(P,J),P=P.sibling}if(S<g.length){for(d=[];S<g.length;S++)d.push(BA(g[S]));return`findAllNodes was able to match part of the selector:
`+(C.join(" > ")+`
No matching component was found for:
`)+d.join(" > ")}return null},t.getPublicRootInstance=function(d){if(d=d.current,!d.child)return null;switch(d.child.tag){case 5:return F(d.child.stateNode);default:return d.child.stateNode}},t.injectIntoDevTools=function(d){if(d={bundleType:d.bundleType,version:d.version,rendererPackageName:d.rendererPackageName,rendererConfig:d.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:o.ReactCurrentDispatcher,findHostInstanceByFiber:ZD,findFiberByHostInstance:d.findFiberByHostInstance||eP,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")d=!1;else{var g=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(g.isDisabled||!g.supportsFiber)d=!0;else{try{sc=g.inject(d),jr=g}catch{}d=!!g.checkDCE}}return d},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(d,g,S,C){if(!Le)throw Error(a(363));d=DA(d,g);var R=Ce(d,S,C).disconnect;return{disconnect:function(){R()}}},t.registerMutableSourceForHydration=function(d,g){var S=g._getVersion;S=S(g._source),d.mutableSourceEagerHydrationData==null?d.mutableSourceEagerHydrationData=[g,S]:d.mutableSourceEagerHydrationData.push(g,S)},t.runWithPriority=function(d,g){var S=Xt;try{return Xt=d,g()}finally{Xt=S}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(d,g,S,C){var R=g.current,P=yr(),J=ol(R);return S=c_(S),g.context===null?g.context=S:g.pendingContext=S,g=mo(P,J),g.payload={element:d},C=C===void 0?null:C,C!==null&&(g.callback=C),rl(R,g),d=Cs(R,J,P),d!==null&&t3(d,R,J),J},t};JT.exports=WG;var YG=JT.exports;const qG=ps(YG),XG=n=>typeof n=="object"&&typeof n.then=="function",Tg=[];function jG(n,e,t=(i,r)=>i===r){if(n===e)return!0;if(!n||!e)return!1;const i=n.length;if(e.length!==i)return!1;for(let r=0;r<i;r++)if(!t(n[r],e[r]))return!1;return!0}function KG(n,e=null,t=!1,i={}){e===null&&(e=[n]);for(const s of Tg)if(jG(e,s.keys,s.equal)){if(t)return;if(Object.prototype.hasOwnProperty.call(s,"error"))throw s.error;if(Object.prototype.hasOwnProperty.call(s,"response"))return i.lifespan&&i.lifespan>0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,i.lifespan)),s.response;if(!t)throw s.promise}const r={keys:e,equal:i.equal,remove:()=>{const s=Tg.indexOf(r);s!==-1&&Tg.splice(s,1)},promise:(XG(n)?n:n(...e)).then(s=>{r.response=s,i.lifespan&&i.lifespan>0&&(r.timeout=setTimeout(r.remove,i.lifespan))}).catch(s=>r.error=s)};if(Tg.push(r),!t)throw r.promise}const $G=(n,e,t)=>KG(n,e,!1,t),s4={},tb=n=>void Object.assign(s4,n);function JG(n,e){function t(u,{args:h=[],attach:f,...p},m){let y=`${u[0].toUpperCase()}${u.slice(1)}`,v;if(u==="primitive"){if(p.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const A=p.object;v=Eh(A,{type:u,root:m,attach:f,primitive:!0})}else{const A=s4[y];if(!A)throw new Error(`R3F: ${y} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(h))throw new Error("R3F: The args prop must be an array!");v=Eh(new A(...h),{type:u,root:m,attach:f,memoizedProps:{args:h}})}return v.__r3f.attach===void 0&&(v instanceof Bt?v.__r3f.attach="geometry":v instanceof Ji&&(v.__r3f.attach="material")),y!=="inject"&&Iv(v,p),v}function i(u,h){let f=!1;if(h){var p,m;(p=h.__r3f)!=null&&p.attach?bv(u,h,h.__r3f.attach):h.isObject3D&&u.isObject3D&&(u.add(h),f=!0),f||(m=u.__r3f)==null||m.objects.push(h),h.__r3f||Eh(h,{}),h.__r3f.parent=u,Ay(h),Sh(h)}}function r(u,h,f){let p=!1;if(h){var m,y;if((m=h.__r3f)!=null&&m.attach)bv(u,h,h.__r3f.attach);else if(h.isObject3D&&u.isObject3D){h.parent=u,h.dispatchEvent({type:"added"});const v=u.children.filter(_=>_!==h),A=v.indexOf(f);u.children=[...v.slice(0,A),h,...v.slice(A)],p=!0}p||(y=u.__r3f)==null||y.objects.push(h),h.__r3f||Eh(h,{}),h.__r3f.parent=u,Ay(h),Sh(h)}}function s(u,h,f=!1){u&&[...u].forEach(p=>a(h,p,f))}function a(u,h,f){if(h){var p,m,y;if(h.__r3f&&(h.__r3f.parent=null),(p=u.__r3f)!=null&&p.objects&&(u.__r3f.objects=u.__r3f.objects.filter(E=>E!==h)),(m=h.__r3f)!=null&&m.attach)VE(u,h,h.__r3f.attach);else if(h.isObject3D&&u.isObject3D){var v;u.remove(h),(v=h.__r3f)!=null&&v.root&&sz(h.__r3f.root,h)}const _=(y=h.__r3f)==null?void 0:y.primitive,x=f===void 0?h.dispose!==null&&!_:f;if(!_){var A;s((A=h.__r3f)==null?void 0:A.objects,h,x),s(h.children,h,x)}delete h.__r3f,x&&h.dispose&&h.type!=="Scene"&&gy.unstable_scheduleCallback(gy.unstable_IdlePriority,()=>{try{h.dispose()}catch{}}),Sh(u)}}function o(u,h,f,p){var m;const y=(m=u.__r3f)==null?void 0:m.parent;if(!y)return;const v=t(h,f,u.__r3f.root);if(u.children){for(const A of u.children)A.__r3f&&i(v,A);u.children=u.children.filter(A=>!A.__r3f)}u.__r3f.objects.forEach(A=>i(v,A)),u.__r3f.objects=[],u.__r3f.autoRemovedBeforeAppend||a(y,u),v.parent&&(v.__r3f.autoRemovedBeforeAppend=!0),i(y,v),v.raycast&&v.__r3f.eventCount&&v.__r3f.root.getState().internal.interaction.push(v),[p,p.alternate].forEach(A=>{A!==null&&(A.stateNode=v,A.ref&&(typeof A.ref=="function"?A.ref(v):A.ref.current=v))})}const l=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:qG({createInstance:t,removeChild:a,appendChild:i,appendInitialChild:i,insertBefore:r,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(u,h)=>{if(!h)return;const f=u.getState().scene;f.__r3f&&(f.__r3f.root=u,i(f,h))},removeChildFromContainer:(u,h)=>{h&&a(u.getState().scene,h)},insertInContainerBefore:(u,h,f)=>{if(!h||!f)return;const p=u.getState().scene;p.__r3f&&r(p,h,f)},getRootHostContext:()=>null,getChildHostContext:u=>u,finalizeInitialChildren(u){var h;return!!((h=u==null?void 0:u.__r3f)!=null?h:{}).handlers},prepareUpdate(u,h,f,p){var m;if(((m=u==null?void 0:u.__r3f)!=null?m:{}).primitive&&p.object&&p.object!==u)return[!0];{const{args:v=[],children:A,..._}=p,{args:x=[],children:E,...w}=f;if(!Array.isArray(v))throw new Error("R3F: the args prop must be an array!");if(v.some((T,M)=>T!==x[M]))return[!0];const I=lb(u,_,w,!0);return I.changes.length?[!1,I]:null}},commitUpdate(u,[h,f],p,m,y,v){h?o(u,p,y,v):Iv(u,f)},commitMount(u,h,f,p){var m;const y=(m=u.__r3f)!=null?m:{};u.raycast&&y.handlers&&y.eventCount&&u.__r3f.root.getState().internal.interaction.push(u)},getPublicInstance:u=>u,prepareForCommit:()=>null,preparePortalMount:u=>Eh(u.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(u){var h;const{attach:f,parent:p}=(h=u.__r3f)!=null?h:{};f&&p&&VE(p,u,f),u.isObject3D&&(u.visible=!1),Sh(u)},unhideInstance(u,h){var f;const{attach:p,parent:m}=(f=u.__r3f)!=null?f:{};p&&m&&bv(m,u,p),(u.isObject3D&&h.visible==null||h.visible)&&(u.visible=!0),Sh(u)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Mh.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&Qn.fun(performance.now)?performance.now:Qn.fun(Date.now)?Date.now:()=>0,scheduleTimeout:Qn.fun(setTimeout)?setTimeout:void 0,cancelTimeout:Qn.fun(clearTimeout)?clearTimeout:void 0}),applyProps:Iv}}var GE,zE;const Tv=n=>"colorSpace"in n||"outputColorSpace"in n,nb=()=>{var n;return(n=s4.ColorManagement)!=null?n:null},ib=n=>n&&n.isOrthographicCamera,ZG=n=>n&&n.hasOwnProperty("current"),m0=typeof window<"u"&&((GE=window.document)!=null&&GE.createElement||((zE=window.navigator)==null?void 0:zE.product)==="ReactNative")?$.useLayoutEffect:$.useEffect;function rb(n){const e=$.useRef(n);return m0(()=>void(e.current=n),[n]),e}function ez({set:n}){return m0(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}class sb extends $.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}sb.getDerivedStateFromError=()=>({error:!0});const ab="__default",QE=new Map,tz=n=>n&&!!n.memoized&&!!n.changes;function ob(n){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(n)?Math.min(Math.max(n[0],t),n[1]):n}const id=n=>{var e;return(e=n.__r3f)==null?void 0:e.root.getState()},Qn={obj:n=>n===Object(n)&&!Qn.arr(n)&&typeof n!="function",fun:n=>typeof n=="function",str:n=>typeof n=="string",num:n=>typeof n=="number",boo:n=>typeof n=="boolean",und:n=>n===void 0,arr:n=>Array.isArray(n),equ(n,e,{arrays:t="shallow",objects:i="reference",strict:r=!0}={}){if(typeof n!=typeof e||!!n!=!!e)return!1;if(Qn.str(n)||Qn.num(n))return n===e;const s=Qn.obj(n);if(s&&i==="reference")return n===e;const a=Qn.arr(n);if(a&&t==="reference")return n===e;if((a||s)&&n===e)return!0;let o;for(o in n)if(!(o in e))return!1;if(s&&t==="shallow"&&i==="shallow"){for(o in r?e:n)if(!Qn.equ(n[o],e[o],{strict:r,objects:"reference"}))return!1}else for(o in r?e:n)if(n[o]!==e[o])return!1;if(Qn.und(o)){if(a&&n.length===0&&e.length===0||s&&Object.keys(n).length===0&&Object.keys(e).length===0)return!0;if(n!==e)return!1}return!0}};function nz(n){n.dispose&&n.type!=="Scene"&&n.dispose();for(const e in n)e.dispose==null||e.dispose(),delete n[e]}function Eh(n,e){const t=n;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},n}function my(n,e){let t=n;if(e.includes("-")){const i=e.split("-"),r=i.pop();return t=i.reduce((s,a)=>s[a],n),{target:t,key:r}}else return{target:t,key:e}}const HE=/-\d+$/;function bv(n,e,t){if(Qn.str(t)){if(HE.test(t)){const s=t.replace(HE,""),{target:a,key:o}=my(n,s);Array.isArray(a[o])||(a[o]=[])}const{target:i,key:r}=my(n,t);e.__r3f.previousAttach=i[r],i[r]=e}else e.__r3f.previousAttach=t(n,e)}function VE(n,e,t){var i,r;if(Qn.str(t)){const{target:s,key:a}=my(n,t),o=e.__r3f.previousAttach;o===void 0?delete s[a]:s[a]=o}else(i=e.__r3f)==null||i.previousAttach==null||i.previousAttach(n,e);(r=e.__r3f)==null||delete r.previousAttach}function lb(n,{children:e,key:t,ref:i,...r},{children:s,key:a,ref:o,...l}={},c=!1){var u;const h=(u=n==null?void 0:n.__r3f)!=null?u:{},f=Object.entries(r),p=[];if(c){const y=Object.keys(l);for(let v=0;v<y.length;v++)r.hasOwnProperty(y[v])||f.unshift([y[v],ab+"remove"])}f.forEach(([y,v])=>{var A;if((A=n.__r3f)!=null&&A.primitive&&y==="object"||Qn.equ(v,l[y]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(y))return p.push([y,v,!0,[]]);let _=[];y.includes("-")&&(_=y.split("-")),p.push([y,v,!1,_]);for(const x in r){const E=r[x];x.startsWith(`${y}-`)&&p.push([x,E,!1,x.split("-")])}});const m={...r};return h.memoizedProps&&h.memoizedProps.args&&(m.args=h.memoizedProps.args),h.memoizedProps&&h.memoizedProps.attach&&(m.attach=h.memoizedProps.attach),{memoized:m,changes:p}}function Iv(n,e){var t,i,r;const s=(t=n.__r3f)!=null?t:{},a=s.root,o=(i=a==null||a.getState==null?void 0:a.getState())!=null?i:{},{memoized:l,changes:c}=tz(e)?e:lb(n,e),u=s.eventCount;n.__r3f&&(n.__r3f.memoizedProps=l);for(let f=0;f<c.length;f++){let[p,m,y,v]=c[f];if(Tv(n)){const E="srgb",w="srgb-linear";p==="encoding"?(p="colorSpace",m=m===3001?E:w):p==="outputEncoding"&&(p="outputColorSpace",m=m===3001?E:w)}let A=n,_=A[p];if(v.length&&(_=v.reduce((x,E)=>x[E],n),!(_&&_.set))){const[x,...E]=v.reverse();A=E.reverse().reduce((w,I)=>w[I],n),p=x}if(m===ab+"remove")if(A.constructor){let x=QE.get(A.constructor);x||(x=new A.constructor,QE.set(A.constructor,x)),m=x[p]}else m=0;if(y)m?s.handlers[p]=m:delete s.handlers[p],s.eventCount=Object.keys(s.handlers).length;else if(_&&_.set&&(_.copy||_ instanceof Kc)){if(Array.isArray(m))_.fromArray?_.fromArray(m):_.set(...m);else if(_.copy&&m&&m.constructor&&_.constructor===m.constructor)_.copy(m);else if(m!==void 0){const x=_ instanceof He;!x&&_.setScalar?_.setScalar(m):_ instanceof Kc&&m instanceof Kc?_.mask=m.mask:_.set(m),!nb()&&!o.linear&&x&&_.convertSRGBToLinear()}}else if(A[p]=m,A[p]instanceof Vn&&A[p].format===li&&A[p].type===Ri){const x=A[p];Tv(x)&&Tv(o.gl)?x.colorSpace=o.gl.outputColorSpace:x.encoding=o.gl.outputEncoding}Sh(n)}if(s.parent&&o.internal&&n.raycast&&u!==s.eventCount){const f=o.internal.interaction.indexOf(n);f>-1&&o.internal.interaction.splice(f,1),s.eventCount&&o.internal.interaction.push(n)}return!(c.length===1&&c[0][0]==="onUpdate")&&c.length&&(r=n.__r3f)!=null&&r.parent&&Ay(n),n}function Sh(n){var e,t;const i=(e=n.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();i&&i.internal.frames===0&&i.invalidate()}function Ay(n){n.onUpdate==null||n.onUpdate(n)}function iz(n,e){n.manual||(ib(n)?(n.left=e.width/-2,n.right=e.width/2,n.top=e.height/2,n.bottom=e.height/-2):n.aspect=e.width/e.height,n.updateProjectionMatrix(),n.updateMatrixWorld())}function bg(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function rz(){var n;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Mh.DefaultEventPriority;switch((n=e.event)==null?void 0:n.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Mh.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Mh.ContinuousEventPriority;default:return Mh.DefaultEventPriority}}function cb(n,e,t,i){const r=t.get(e);r&&(t.delete(e),t.size===0&&(n.delete(i),r.target.releasePointerCapture(i)))}function sz(n,e){const{internal:t}=n.getState();t.interaction=t.interaction.filter(i=>i!==e),t.initialHits=t.initialHits.filter(i=>i!==e),t.hovered.forEach((i,r)=>{(i.eventObject===e||i.object===e)&&t.hovered.delete(r)}),t.capturedMap.forEach((i,r)=>{cb(t.capturedMap,e,i,r)})}function az(n){function e(l){const{internal:c}=n.getState(),u=l.offsetX-c.initialClick[0],h=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(u*u+h*h))}function t(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(u=>{var h;return(h=c.__r3f)==null?void 0:h.handlers["onPointer"+u]}))}function i(l,c){const u=n.getState(),h=new Set,f=[],p=c?c(u.internal.interaction):u.internal.interaction;for(let A=0;A<p.length;A++){const _=id(p[A]);_&&(_.raycaster.camera=void 0)}u.previousRoot||u.events.compute==null||u.events.compute(l,u);function m(A){const _=id(A);if(!_||!_.events.enabled||_.raycaster.camera===null)return[];if(_.raycaster.camera===void 0){var x;_.events.compute==null||_.events.compute(l,_,(x=_.previousRoot)==null?void 0:x.getState()),_.raycaster.camera===void 0&&(_.raycaster.camera=null)}return _.raycaster.camera?_.raycaster.intersectObject(A,!0):[]}let y=p.flatMap(m).sort((A,_)=>{const x=id(A.object),E=id(_.object);return!x||!E?A.distance-_.distance:E.events.priority-x.events.priority||A.distance-_.distance}).filter(A=>{const _=bg(A);return h.has(_)?!1:(h.add(_),!0)});u.events.filter&&(y=u.events.filter(y,u));for(const A of y){let _=A.object;for(;_;){var v;(v=_.__r3f)!=null&&v.eventCount&&f.push({...A,eventObject:_}),_=_.parent}}if("pointerId"in l&&u.internal.capturedMap.has(l.pointerId))for(let A of u.internal.capturedMap.get(l.pointerId).values())h.has(bg(A.intersection))||f.push(A.intersection);return f}function r(l,c,u,h){const f=n.getState();if(l.length){const p={stopped:!1};for(const m of l){const y=id(m.object)||f,{raycaster:v,pointer:A,camera:_,internal:x}=y,E=new N(A.x,A.y,0).unproject(_),w=B=>{var L,U;return(L=(U=x.capturedMap.get(B))==null?void 0:U.has(m.eventObject))!=null?L:!1},I=B=>{const L={intersection:m,target:c.target};x.capturedMap.has(B)?x.capturedMap.get(B).set(m.eventObject,L):x.capturedMap.set(B,new Map([[m.eventObject,L]])),c.target.setPointerCapture(B)},T=B=>{const L=x.capturedMap.get(B);L&&cb(x.capturedMap,m.eventObject,L,B)};let M={};for(let B in c){let L=c[B];typeof L!="function"&&(M[B]=L)}let b={...m,...M,pointer:A,intersections:l,stopped:p.stopped,delta:u,unprojectedPoint:E,ray:v.ray,camera:_,stopPropagation(){const B="pointerId"in c&&x.capturedMap.get(c.pointerId);if((!B||B.has(m.eventObject))&&(b.stopped=p.stopped=!0,x.hovered.size&&Array.from(x.hovered.values()).find(L=>L.eventObject===m.eventObject))){const L=l.slice(0,l.indexOf(m));s([...L,m])}},target:{hasPointerCapture:w,setPointerCapture:I,releasePointerCapture:T},currentTarget:{hasPointerCapture:w,setPointerCapture:I,releasePointerCapture:T},nativeEvent:c};if(h(b),p.stopped===!0)break}}return l}function s(l){const{internal:c}=n.getState();for(const u of c.hovered.values())if(!l.length||!l.find(h=>h.object===u.object&&h.index===u.index&&h.instanceId===u.instanceId)){const f=u.eventObject.__r3f,p=f==null?void 0:f.handlers;if(c.hovered.delete(bg(u)),f!=null&&f.eventCount){const m={...u,intersections:l};p.onPointerOut==null||p.onPointerOut(m),p.onPointerLeave==null||p.onPointerLeave(m)}}}function a(l,c){for(let u=0;u<c.length;u++){const h=c[u].__r3f;h==null||h.handlers.onPointerMissed==null||h.handlers.onPointerMissed(l)}}function o(l){switch(l){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return c=>{const{internal:u}=n.getState();"pointerId"in c&&u.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{u.capturedMap.has(c.pointerId)&&(u.capturedMap.delete(c.pointerId),s([]))})}}return function(u){const{onPointerMissed:h,internal:f}=n.getState();f.lastEvent.current=u;const p=l==="onPointerMove",m=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",v=i(u,p?t:void 0),A=m?e(u):0;l==="onPointerDown"&&(f.initialClick=[u.offsetX,u.offsetY],f.initialHits=v.map(x=>x.eventObject)),m&&!v.length&&A<=2&&(a(u,f.interaction),h&&h(u)),p&&s(v);function _(x){const E=x.eventObject,w=E.__r3f,I=w==null?void 0:w.handlers;if(w!=null&&w.eventCount)if(p){if(I.onPointerOver||I.onPointerEnter||I.onPointerOut||I.onPointerLeave){const T=bg(x),M=f.hovered.get(T);M?M.stopped&&x.stopPropagation():(f.hovered.set(T,x),I.onPointerOver==null||I.onPointerOver(x),I.onPointerEnter==null||I.onPointerEnter(x))}I.onPointerMove==null||I.onPointerMove(x)}else{const T=I[l];T?(!m||f.initialHits.includes(E))&&(a(u,f.interaction.filter(M=>!f.initialHits.includes(M))),T(x)):m&&f.initialHits.includes(E)&&a(u,f.interaction.filter(M=>!f.initialHits.includes(M)))}}r(v,u,A,_)}}return{handlePointer:o}}const ub=n=>!!(n!=null&&n.render),hb=$.createContext(null),oz=(n,e)=>{const t=VG((o,l)=>{const c=new N,u=new N,h=new N;function f(A=l().camera,_=u,x=l().size){const{width:E,height:w,top:I,left:T}=x,M=E/w;_ instanceof N?h.copy(_):h.set(..._);const b=A.getWorldPosition(c).distanceTo(h);if(ib(A))return{width:E/A.zoom,height:w/A.zoom,top:I,left:T,factor:1,distance:b,aspect:M};{const B=A.fov*Math.PI/180,L=2*Math.tan(B/2)*b,U=L*(E/w);return{width:U,height:L,top:I,left:T,factor:E/U,distance:b,aspect:M}}}let p;const m=A=>o(_=>({performance:{..._.performance,current:A}})),y=new _e;return{set:o,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(A=1)=>n(l(),A),advance:(A,_)=>e(A,_,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new s1,pointer:y,mouse:y,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const A=l();p&&clearTimeout(p),A.performance.current!==A.performance.min&&m(A.performance.min),p=setTimeout(()=>m(l().performance.max),A.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:f},setEvents:A=>o(_=>({..._,events:{..._.events,...A}})),setSize:(A,_,x,E,w)=>{const I=l().camera,T={width:A,height:_,top:E||0,left:w||0,updateStyle:x};o(M=>({size:T,viewport:{...M.viewport,...f(I,u,T)}}))},setDpr:A=>o(_=>{const x=ob(A);return{viewport:{..._.viewport,dpr:x,initialDpr:_.viewport.initialDpr||x}}}),setFrameloop:(A="always")=>{const _=l().clock;_.stop(),_.elapsedTime=0,A!=="never"&&(_.start(),_.elapsedTime=0),o(()=>({frameloop:A}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:$.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(A,_,x)=>{const E=l().internal;return E.priority=E.priority+(_>0?1:0),E.subscribers.push({ref:A,priority:_,store:x}),E.subscribers=E.subscribers.sort((w,I)=>w.priority-I.priority),()=>{const w=l().internal;w!=null&&w.subscribers&&(w.priority=w.priority-(_>0?1:0),w.subscribers=w.subscribers.filter(I=>I.ref!==A))}}}}}),i=t.getState();let r=i.size,s=i.viewport.dpr,a=i.camera;return t.subscribe(()=>{const{camera:o,size:l,viewport:c,gl:u,set:h}=t.getState();if(l!==r||c.dpr!==s){var f;r=l,s=c.dpr,iz(o,l),u.setPixelRatio(c.dpr);const p=(f=l.updateStyle)!=null?f:typeof HTMLCanvasElement<"u"&&u.domElement instanceof HTMLCanvasElement;u.setSize(l.width,l.height,p)}o!==a&&(a=o,h(p=>({viewport:{...p.viewport,...p.viewport.getCurrentViewport(o)}})))}),t.subscribe(o=>n(o)),t};function lz(n,e){const t={callback:n};return e.add(t),()=>void e.delete(t)}let Ig,fb=new Set,cz=new Set,uz=new Set;const hz=n=>lz(n,fb);function Mv(n,e){if(n.size)for(const{callback:t}of n.values())t(e)}function rd(n,e){switch(n){case"before":return Mv(fb,e);case"after":return Mv(cz,e);case"tail":return Mv(uz,e)}}let Rv,Bv;function Dv(n,e,t){let i=e.clock.getDelta();for(e.frameloop==="never"&&typeof n=="number"&&(i=n-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=n),Rv=e.internal.subscribers,Ig=0;Ig<Rv.length;Ig++)Bv=Rv[Ig],Bv.ref.current(Bv.store.getState(),i,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}function fz(n){let e=!1,t,i,r;function s(l){i=requestAnimationFrame(s),e=!0,t=0,rd("before",l);for(const u of n.values()){var c;r=u.store.getState(),r.internal.active&&(r.frameloop==="always"||r.internal.frames>0)&&!((c=r.gl.xr)!=null&&c.isPresenting)&&(t+=Dv(l,r))}if(rd("after",l),t===0)return rd("tail",l),e=!1,cancelAnimationFrame(i)}function a(l,c=1){var u;if(!l)return n.forEach(h=>a(h.store.getState()),c);(u=l.gl.xr)!=null&&u.isPresenting||!l.internal.active||l.frameloop==="never"||(l.internal.frames=Math.min(60,l.internal.frames+c),e||(e=!0,requestAnimationFrame(s)))}function o(l,c=!0,u,h){if(c&&rd("before",l),u)Dv(l,u,h);else for(const f of n.values())Dv(l,f.store.getState());c&&rd("after",l)}return{loop:s,invalidate:a,advance:o}}function db(){const n=$.useContext(hb);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function Cr(n=t=>t,e){return db()(n,e)}function a1(n,e=0){const t=db(),i=t.getState().internal.subscribe,r=rb(n);return m0(()=>i(r,e,t),[e,i,t]),null}const Yh=new Map,{invalidate:WE,advance:YE}=fz(Yh),{reconciler:Lm,applyProps:Pc}=JG(Yh,rz),uh={objects:"shallow",strict:!1},dz=(n,e)=>{const t=typeof n=="function"?n(e):n;return ub(t)?t:new U6({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...n})};function pz(n,e){if(e)return e;if(typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement&&n.parentElement){const{width:t,height:i,top:r,left:s}=n.parentElement.getBoundingClientRect();return{width:t,height:i,top:r,left:s}}else if(typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas)return{width:n.width,height:n.height,top:0,left:0};return{width:0,height:0,top:0,left:0}}function gz(n){const e=Yh.get(n),t=e==null?void 0:e.fiber,i=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const r=typeof reportError=="function"?reportError:console.error,s=i||oz(WE,YE),a=t||Lm.createContainer(s,Mh.ConcurrentRoot,null,!1,null,"",r,null);e||Yh.set(n,{fiber:a,store:s});let o,l=!1,c;return{configure(u={}){let{gl:h,size:f,scene:p,events:m,onCreated:y,shadows:v=!1,linear:A=!1,flat:_=!1,legacy:x=!1,orthographic:E=!1,frameloop:w="always",dpr:I=[1,2],performance:T,raycaster:M,camera:b,onPointerMissed:B}=u,L=s.getState(),U=L.gl;L.gl||L.set({gl:U=dz(h,n)});let O=L.raycaster;O||L.set({raycaster:O=new r4});const{params:Q,...G}=M||{};if(Qn.equ(G,O,uh)||Pc(O,{...G}),Qn.equ(Q,O.params,uh)||Pc(O,{params:{...O.params,...Q}}),!L.camera||L.camera===c&&!Qn.equ(c,b,uh)){c=b;const D=b instanceof o0,k=D?b:E?new ql(0,0,0,0,.1,1e3):new Kn(75,0,.1,1e3);D||(k.position.z=5,b&&Pc(k,b),!L.camera&&!(b!=null&&b.rotation)&&k.lookAt(0,0,0)),L.set({camera:k})}if(!L.scene){let D;p instanceof Bp?D=p:(D=new Bp,p&&Pc(D,p)),L.set({scene:Eh(D)})}if(!L.xr){const D=(j,ee)=>{const ie=s.getState();ie.frameloop!=="never"&&YE(j,!0,ie,ee)},k=()=>{const j=s.getState();j.gl.xr.enabled=j.gl.xr.isPresenting,j.gl.xr.setAnimationLoop(j.gl.xr.isPresenting?D:null),j.gl.xr.isPresenting||WE(j)},Z={connect(){const j=s.getState().gl;j.xr.addEventListener("sessionstart",k),j.xr.addEventListener("sessionend",k)},disconnect(){const j=s.getState().gl;j.xr.removeEventListener("sessionstart",k),j.xr.removeEventListener("sessionend",k)}};U.xr&&Z.connect(),L.set({xr:Z})}if(U.shadowMap){const D=U.shadowMap.enabled,k=U.shadowMap.type;if(U.shadowMap.enabled=!!v,Qn.boo(v))U.shadowMap.type=jd;else if(Qn.str(v)){var F;const Z={basic:aC,percentage:b2,soft:jd,variance:sa};U.shadowMap.type=(F=Z[v])!=null?F:jd}else Qn.obj(v)&&Object.assign(U.shadowMap,v);(D!==U.shadowMap.enabled||k!==U.shadowMap.type)&&(U.shadowMap.needsUpdate=!0)}const q=nb();q&&("enabled"in q?q.enabled=!x:"legacyMode"in q&&(q.legacyMode=x)),Pc(U,{outputEncoding:A?3e3:3001,toneMapping:_?os:v6}),L.legacy!==x&&L.set(()=>({legacy:x})),L.linear!==A&&L.set(()=>({linear:A})),L.flat!==_&&L.set(()=>({flat:_})),h&&!Qn.fun(h)&&!ub(h)&&!Qn.equ(h,U,uh)&&Pc(U,h),m&&!L.events.handlers&&L.set({events:m(s)});const V=pz(n,f);return Qn.equ(V,L.size,uh)||L.setSize(V.width,V.height,V.updateStyle,V.top,V.left),I&&L.viewport.dpr!==ob(I)&&L.setDpr(I),L.frameloop!==w&&L.setFrameloop(w),L.onPointerMissed||L.set({onPointerMissed:B}),T&&!Qn.equ(T,L.performance,uh)&&L.set(D=>({performance:{...D.performance,...T}})),o=y,l=!0,this},render(u){return l||this.configure(),Lm.updateContainer($.createElement(mz,{store:s,children:u,onCreated:o,rootElement:n}),a,null,()=>{}),s},unmount(){pb(n)}}}function mz({store:n,children:e,onCreated:t,rootElement:i}){return m0(()=>{const r=n.getState();r.set(s=>({internal:{...s.internal,active:!0}})),t&&t(r),n.getState().events.connected||r.events.connect==null||r.events.connect(i)},[]),$.createElement(hb.Provider,{value:n},e)}function pb(n,e){const t=Yh.get(n),i=t==null?void 0:t.fiber;if(i){const r=t==null?void 0:t.store.getState();r&&(r.internal.active=!1),Lm.updateContainer(null,i,null,()=>{r&&setTimeout(()=>{try{var s,a,o,l;r.events.disconnect==null||r.events.disconnect(),(s=r.gl)==null||(a=s.renderLists)==null||a.dispose==null||a.dispose(),(o=r.gl)==null||o.forceContextLoss==null||o.forceContextLoss(),(l=r.gl)!=null&&l.xr&&r.xr.disconnect(),nz(r),Yh.delete(n),e&&e(n)}catch{}},500)})}}Lm.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:$.version});function ou(){return ou=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},ou.apply(this,arguments)}function vy(n,e,t){var i,r,s,a,o;e==null&&(e=100);function l(){var u=Date.now()-a;u<e&&u>=0?i=setTimeout(l,e-u):(i=null,t||(o=n.apply(s,r),s=r=null))}var c=function(){s=this,r=arguments,a=Date.now();var u=t&&!i;return i||(i=setTimeout(l,e)),u&&(o=n.apply(s,r),s=r=null),o};return c.clear=function(){i&&(clearTimeout(i),i=null)},c.flush=function(){i&&(o=n.apply(s,r),s=r=null,clearTimeout(i),i=null)},c}vy.debounce=vy;var Az=vy;const qE=ps(Az);function vz(n){let{debounce:e,scroll:t,polyfill:i,offsetSize:r}=n===void 0?{debounce:0,scroll:!1,offsetSize:!1}:n;const s=i||(typeof window>"u"?class{}:window.ResizeObserver);if(!s)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[a,o]=$.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=$.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:a}),c=e?typeof e=="number"?e:e.scroll:null,u=e?typeof e=="number"?e:e.resize:null,h=$.useRef(!1);$.useEffect(()=>(h.current=!0,()=>void(h.current=!1)));const[f,p,m]=$.useMemo(()=>{const _=()=>{if(!l.current.element)return;const{left:x,top:E,width:w,height:I,bottom:T,right:M,x:b,y:B}=l.current.element.getBoundingClientRect(),L={left:x,top:E,width:w,height:I,bottom:T,right:M,x:b,y:B};l.current.element instanceof HTMLElement&&r&&(L.height=l.current.element.offsetHeight,L.width=l.current.element.offsetWidth),Object.freeze(L),h.current&&!Ez(l.current.lastBounds,L)&&o(l.current.lastBounds=L)};return[_,u?qE(_,u):_,c?qE(_,c):_]},[o,r,c,u]);function y(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(_=>_.removeEventListener("scroll",m,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null)}function v(){l.current.element&&(l.current.resizeObserver=new s(m),l.current.resizeObserver.observe(l.current.element),t&&l.current.scrollContainers&&l.current.scrollContainers.forEach(_=>_.addEventListener("scroll",m,{capture:!0,passive:!0})))}const A=_=>{!_||_===l.current.element||(y(),l.current.element=_,l.current.scrollContainers=gb(_),v())};return xz(m,!!t),yz(p),$.useEffect(()=>{y(),v()},[t,m,p]),$.useEffect(()=>y,[]),[A,a,f]}function yz(n){$.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function xz(n,e){$.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[n,e])}function gb(n){const e=[];if(!n||n===document.body)return e;const{overflow:t,overflowX:i,overflowY:r}=window.getComputedStyle(n);return[t,i,r].some(s=>s==="auto"||s==="scroll")&&e.push(n),[...e,...gb(n.parentElement)]}const _z=["x","y","top","bottom","left","right","width","height"],Ez=(n,e)=>_z.every(t=>n[t]===e[t]);var Sz=Object.defineProperty,wz=Object.defineProperties,Cz=Object.getOwnPropertyDescriptors,XE=Object.getOwnPropertySymbols,Tz=Object.prototype.hasOwnProperty,bz=Object.prototype.propertyIsEnumerable,jE=(n,e,t)=>e in n?Sz(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,KE=(n,e)=>{for(var t in e||(e={}))Tz.call(e,t)&&jE(n,t,e[t]);if(XE)for(var t of XE(e))bz.call(e,t)&&jE(n,t,e[t]);return n},Iz=(n,e)=>wz(n,Cz(e));function mb(n,e,t){if(!n)return;if(t(n)===!0)return n;let i=e?n.return:n.child;for(;i;){const r=mb(i,e,t);if(r)return r;i=e?null:i.sibling}}function Ab(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}const a4=Ab($.createContext(null));class vb extends $.Component{render(){return $.createElement(a4.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:$E,ReactCurrentDispatcher:JE}=$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function Mz(){const n=$.useContext(a4);if(n===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=$.useId();return $.useMemo(()=>{for(const i of[$E==null?void 0:$E.current,n,n==null?void 0:n.alternate]){if(!i)continue;const r=mb(i,!1,s=>{let a=s.memoizedState;for(;a;){if(a.memoizedState===e)return!0;a=a.next}});if(r)return r}},[n,e])}function Rz(){var n,e;const t=Mz(),[i]=$.useState(()=>new Map);i.clear();let r=t;for(;r;){const s=(n=r.type)==null?void 0:n._context;s&&s!==a4&&!i.has(s)&&i.set(s,(e=JE==null?void 0:JE.current)==null?void 0:e.readContext(Ab(s))),r=r.return}return i}function Bz(){const n=Rz();return $.useMemo(()=>Array.from(n.keys()).reduce((e,t)=>i=>$.createElement(e,null,$.createElement(t.Provider,Iz(KE({},i),{value:n.get(t)}))),e=>$.createElement(vb,KE({},e))),[n])}const Pv={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function Dz(n){const{handlePointer:e}=az(n);return{priority:1,enabled:!0,compute(t,i,r){i.pointer.set(t.offsetX/i.size.width*2-1,-(t.offsetY/i.size.height)*2+1),i.raycaster.setFromCamera(i.pointer,i.camera)},connected:void 0,handlers:Object.keys(Pv).reduce((t,i)=>({...t,[i]:e(i)}),{}),update:()=>{var t;const{events:i,internal:r}=n.getState();(t=r.lastEvent)!=null&&t.current&&i.handlers&&i.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{var i;const{set:r,events:s}=n.getState();s.disconnect==null||s.disconnect(),r(a=>({events:{...a.events,connected:t}})),Object.entries((i=s.handlers)!=null?i:[]).forEach(([a,o])=>{const[l,c]=Pv[a];t.addEventListener(l,o,{passive:c})})},disconnect:()=>{const{set:t,events:i}=n.getState();if(i.connected){var r;Object.entries((r=i.handlers)!=null?r:[]).forEach(([s,a])=>{if(i&&i.connected instanceof HTMLElement){const[o]=Pv[s];i.connected.removeEventListener(o,a)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}const Pz=$.forwardRef(function({children:e,fallback:t,resize:i,style:r,gl:s,events:a=Dz,eventSource:o,eventPrefix:l,shadows:c,linear:u,flat:h,legacy:f,orthographic:p,frameloop:m,dpr:y,performance:v,raycaster:A,camera:_,onPointerMissed:x,onCreated:E,...w},I){$.useMemo(()=>tb(KT),[]);const T=Bz(),[M,b]=vz({scroll:!0,debounce:{scroll:50,resize:0},...i}),B=$.useRef(null),L=$.useRef(null);$.useImperativeHandle(I,()=>B.current);const U=rb(x),[O,Q]=$.useState(!1),[G,F]=$.useState(!1);if(O)throw O;if(G)throw G;const q=$.useRef(null);m0(()=>{const H=B.current;b.width>0&&b.height>0&&H&&(q.current||(q.current=gz(H)),q.current.configure({gl:s,events:a,shadows:c,linear:u,flat:h,legacy:f,orthographic:p,frameloop:m,dpr:y,performance:v,raycaster:A,camera:_,size:b,onPointerMissed:(...V)=>U.current==null?void 0:U.current(...V),onCreated:V=>{V.events.connect==null||V.events.connect(o?ZG(o)?o.current:o:L.current),l&&V.setEvents({compute:(D,k)=>{const Z=D[l+"X"],j=D[l+"Y"];k.pointer.set(Z/k.size.width*2-1,-(j/k.size.height)*2+1),k.raycaster.setFromCamera(k.pointer,k.camera)}}),E==null||E(V)}}),q.current.render($.createElement(T,null,$.createElement(sb,{set:F},$.createElement($.Suspense,{fallback:$.createElement(ez,{set:Q})},e)))))}),$.useEffect(()=>{const H=B.current;if(H)return()=>pb(H)},[]);const Y=o?"none":"auto";return $.createElement("div",ou({ref:L,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:Y,...r}},w),$.createElement("div",{ref:M,style:{width:"100%",height:"100%"}},$.createElement("canvas",{ref:B,style:{display:"block"}},t)))}),Lz=$.forwardRef(function(e,t){return $.createElement(vb,null,$.createElement(Pz,ou({},e,{ref:t})))});function Uz(n){const e=+this._x.call(null,n);return yb(this.cover(e),e,n)}function yb(n,e,t){if(isNaN(e))return n;var i,r=n._root,s={data:t},a=n._x0,o=n._x1,l,c,u,h,f;if(!r)return n._root=s,n;for(;r.length;)if((u=e>=(l=(a+o)/2))?a=l:o=l,i=r,!(r=r[h=+u]))return i[h]=s,n;if(c=+n._x.call(null,r.data),e===c)return s.next=r,i?i[h]=s:n._root=s,n;do i=i?i[h]=new Array(2):n._root=new Array(2),(u=e>=(l=(a+o)/2))?a=l:o=l;while((h=+u)==(f=+(c>=l)));return i[f]=r,i[h]=s,n}function Oz(n){Array.isArray(n)||(n=Array.from(n));const e=n.length,t=new Float64Array(e);let i=1/0,r=-1/0;for(let s=0,a;s<e;++s)isNaN(a=+this._x.call(null,n[s]))||(t[s]=a,a<i&&(i=a),a>r&&(r=a));if(i>r)return this;this.cover(i).cover(r);for(let s=0;s<e;++s)yb(this,t[s],n[s]);return this}function Fz(n){if(isNaN(n=+n))return this;var e=this._x0,t=this._x1;if(isNaN(e))t=(e=Math.floor(n))+1;else{for(var i=t-e||1,r=this._root,s,a;e>n||n>=t;)switch(a=+(n<e),s=new Array(2),s[a]=r,r=s,i*=2,a){case 0:t=e+i;break;case 1:e=t-i;break}this._root&&this._root.length&&(this._root=r)}return this._x0=e,this._x1=t,this}function kz(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function Nz(n){return arguments.length?this.cover(+n[0][0]).cover(+n[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function No(n,e,t){this.node=n,this.x0=e,this.x1=t}function Gz(n,e){var t,i=this._x0,r,s,a=this._x1,o=[],l=this._root,c,u;for(l&&o.push(new No(l,i,a)),e==null?e=1/0:(i=n-e,a=n+e);c=o.pop();)if(!(!(l=c.node)||(r=c.x0)>a||(s=c.x1)<i))if(l.length){var h=(r+s)/2;o.push(new No(l[1],h,s),new No(l[0],r,h)),(u=+(n>=h))&&(c=o[o.length-1],o[o.length-1]=o[o.length-1-u],o[o.length-1-u]=c)}else{var f=Math.abs(n-+this._x.call(null,l.data));f<e&&(e=f,i=n-f,a=n+f,t=l.data)}return t}function zz(n){if(isNaN(l=+this._x.call(null,n)))return this;var e,t=this._root,i,r,s,a=this._x0,o=this._x1,l,c,u,h,f;if(!t)return this;if(t.length)for(;;){if((u=l>=(c=(a+o)/2))?a=c:o=c,e=t,!(t=t[h=+u]))return this;if(!t.length)break;e[h+1&1]&&(i=e,f=h)}for(;t.data!==n;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[h]=s:delete e[h],(t=e[0]||e[1])&&t===(e[1]||e[0])&&!t.length&&(i?i[f]=t:this._root=t),this):(this._root=s,this)}function Qz(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function Hz(){return this._root}function Vz(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function Wz(n){var e=[],t,i=this._root,r,s,a;for(i&&e.push(new No(i,this._x0,this._x1));t=e.pop();)if(!n(i=t.node,s=t.x0,a=t.x1)&&i.length){var o=(s+a)/2;(r=i[1])&&e.push(new No(r,o,a)),(r=i[0])&&e.push(new No(r,s,o))}return this}function Yz(n){var e=[],t=[],i;for(this._root&&e.push(new No(this._root,this._x0,this._x1));i=e.pop();){var r=i.node;if(r.length){var s,a=i.x0,o=i.x1,l=(a+o)/2;(s=r[0])&&e.push(new No(s,a,l)),(s=r[1])&&e.push(new No(s,l,o))}t.push(i)}for(;i=t.pop();)n(i.node,i.x0,i.x1);return this}function qz(n){return n[0]}function Xz(n){return arguments.length?(this._x=n,this):this._x}function o4(n,e){var t=new l4(e??qz,NaN,NaN);return n==null?t:t.addAll(n)}function l4(n,e,t){this._x=n,this._x0=e,this._x1=t,this._root=void 0}function ZE(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var qr=o4.prototype=l4.prototype;qr.copy=function(){var n=new l4(this._x,this._x0,this._x1),e=this._root,t,i;if(!e)return n;if(!e.length)return n._root=ZE(e),n;for(t=[{source:e,target:n._root=new Array(2)}];e=t.pop();)for(var r=0;r<2;++r)(i=e.source[r])&&(i.length?t.push({source:i,target:e.target[r]=new Array(2)}):e.target[r]=ZE(i));return n};qr.add=Uz;qr.addAll=Oz;qr.cover=Fz;qr.data=kz;qr.extent=Nz;qr.find=Gz;qr.remove=zz;qr.removeAll=Qz;qr.root=Hz;qr.size=Vz;qr.visit=Wz;qr.visitAfter=Yz;qr.x=Xz;function jz(n){const e=+this._x.call(null,n),t=+this._y.call(null,n);return xb(this.cover(e,t),e,t,n)}function xb(n,e,t,i){if(isNaN(e)||isNaN(t))return n;var r,s=n._root,a={data:i},o=n._x0,l=n._y0,c=n._x1,u=n._y1,h,f,p,m,y,v,A,_;if(!s)return n._root=a,n;for(;s.length;)if((y=e>=(h=(o+c)/2))?o=h:c=h,(v=t>=(f=(l+u)/2))?l=f:u=f,r=s,!(s=s[A=v<<1|y]))return r[A]=a,n;if(p=+n._x.call(null,s.data),m=+n._y.call(null,s.data),e===p&&t===m)return a.next=s,r?r[A]=a:n._root=a,n;do r=r?r[A]=new Array(4):n._root=new Array(4),(y=e>=(h=(o+c)/2))?o=h:c=h,(v=t>=(f=(l+u)/2))?l=f:u=f;while((A=v<<1|y)===(_=(m>=f)<<1|p>=h));return r[_]=s,r[A]=a,n}function Kz(n){var e,t,i=n.length,r,s,a=new Array(i),o=new Array(i),l=1/0,c=1/0,u=-1/0,h=-1/0;for(t=0;t<i;++t)isNaN(r=+this._x.call(null,e=n[t]))||isNaN(s=+this._y.call(null,e))||(a[t]=r,o[t]=s,r<l&&(l=r),r>u&&(u=r),s<c&&(c=s),s>h&&(h=s));if(l>u||c>h)return this;for(this.cover(l,c).cover(u,h),t=0;t<i;++t)xb(this,a[t],o[t],n[t]);return this}function $z(n,e){if(isNaN(n=+n)||isNaN(e=+e))return this;var t=this._x0,i=this._y0,r=this._x1,s=this._y1;if(isNaN(t))r=(t=Math.floor(n))+1,s=(i=Math.floor(e))+1;else{for(var a=r-t||1,o=this._root,l,c;t>n||n>=r||i>e||e>=s;)switch(c=(e<i)<<1|n<t,l=new Array(4),l[c]=o,o=l,a*=2,c){case 0:r=t+a,s=i+a;break;case 1:t=r-a,s=i+a;break;case 2:r=t+a,i=s-a;break;case 3:t=r-a,i=s-a;break}this._root&&this._root.length&&(this._root=o)}return this._x0=t,this._y0=i,this._x1=r,this._y1=s,this}function Jz(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function Zz(n){return arguments.length?this.cover(+n[0][0],+n[0][1]).cover(+n[1][0],+n[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Tr(n,e,t,i,r){this.node=n,this.x0=e,this.y0=t,this.x1=i,this.y1=r}function eQ(n,e,t){var i,r=this._x0,s=this._y0,a,o,l,c,u=this._x1,h=this._y1,f=[],p=this._root,m,y;for(p&&f.push(new Tr(p,r,s,u,h)),t==null?t=1/0:(r=n-t,s=e-t,u=n+t,h=e+t,t*=t);m=f.pop();)if(!(!(p=m.node)||(a=m.x0)>u||(o=m.y0)>h||(l=m.x1)<r||(c=m.y1)<s))if(p.length){var v=(a+l)/2,A=(o+c)/2;f.push(new Tr(p[3],v,A,l,c),new Tr(p[2],a,A,v,c),new Tr(p[1],v,o,l,A),new Tr(p[0],a,o,v,A)),(y=(e>=A)<<1|n>=v)&&(m=f[f.length-1],f[f.length-1]=f[f.length-1-y],f[f.length-1-y]=m)}else{var _=n-+this._x.call(null,p.data),x=e-+this._y.call(null,p.data),E=_*_+x*x;if(E<t){var w=Math.sqrt(t=E);r=n-w,s=e-w,u=n+w,h=e+w,i=p.data}}return i}function tQ(n){if(isNaN(u=+this._x.call(null,n))||isNaN(h=+this._y.call(null,n)))return this;var e,t=this._root,i,r,s,a=this._x0,o=this._y0,l=this._x1,c=this._y1,u,h,f,p,m,y,v,A;if(!t)return this;if(t.length)for(;;){if((m=u>=(f=(a+l)/2))?a=f:l=f,(y=h>=(p=(o+c)/2))?o=p:c=p,e=t,!(t=t[v=y<<1|m]))return this;if(!t.length)break;(e[v+1&3]||e[v+2&3]||e[v+3&3])&&(i=e,A=v)}for(;t.data!==n;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[v]=s:delete e[v],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(i?i[A]=t:this._root=t),this):(this._root=s,this)}function nQ(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function iQ(){return this._root}function rQ(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function sQ(n){var e=[],t,i=this._root,r,s,a,o,l;for(i&&e.push(new Tr(i,this._x0,this._y0,this._x1,this._y1));t=e.pop();)if(!n(i=t.node,s=t.x0,a=t.y0,o=t.x1,l=t.y1)&&i.length){var c=(s+o)/2,u=(a+l)/2;(r=i[3])&&e.push(new Tr(r,c,u,o,l)),(r=i[2])&&e.push(new Tr(r,s,u,c,l)),(r=i[1])&&e.push(new Tr(r,c,a,o,u)),(r=i[0])&&e.push(new Tr(r,s,a,c,u))}return this}function aQ(n){var e=[],t=[],i;for(this._root&&e.push(new Tr(this._root,this._x0,this._y0,this._x1,this._y1));i=e.pop();){var r=i.node;if(r.length){var s,a=i.x0,o=i.y0,l=i.x1,c=i.y1,u=(a+l)/2,h=(o+c)/2;(s=r[0])&&e.push(new Tr(s,a,o,u,h)),(s=r[1])&&e.push(new Tr(s,u,o,l,h)),(s=r[2])&&e.push(new Tr(s,a,h,u,c)),(s=r[3])&&e.push(new Tr(s,u,h,l,c))}t.push(i)}for(;i=t.pop();)n(i.node,i.x0,i.y0,i.x1,i.y1);return this}function oQ(n){return n[0]}function lQ(n){return arguments.length?(this._x=n,this):this._x}function cQ(n){return n[1]}function uQ(n){return arguments.length?(this._y=n,this):this._y}function c4(n,e,t){var i=new u4(e??oQ,t??cQ,NaN,NaN,NaN,NaN);return n==null?i:i.addAll(n)}function u4(n,e,t,i,r,s){this._x=n,this._y=e,this._x0=t,this._y0=i,this._x1=r,this._y1=s,this._root=void 0}function e7(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var Br=c4.prototype=u4.prototype;Br.copy=function(){var n=new u4(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,t,i;if(!e)return n;if(!e.length)return n._root=e7(e),n;for(t=[{source:e,target:n._root=new Array(4)}];e=t.pop();)for(var r=0;r<4;++r)(i=e.source[r])&&(i.length?t.push({source:i,target:e.target[r]=new Array(4)}):e.target[r]=e7(i));return n};Br.add=jz;Br.addAll=Kz;Br.cover=$z;Br.data=Jz;Br.extent=Zz;Br.find=eQ;Br.remove=tQ;Br.removeAll=nQ;Br.root=iQ;Br.size=rQ;Br.visit=sQ;Br.visitAfter=aQ;Br.x=lQ;Br.y=uQ;function hQ(n){const e=+this._x.call(null,n),t=+this._y.call(null,n),i=+this._z.call(null,n);return _b(this.cover(e,t,i),e,t,i,n)}function _b(n,e,t,i,r){if(isNaN(e)||isNaN(t)||isNaN(i))return n;var s,a=n._root,o={data:r},l=n._x0,c=n._y0,u=n._z0,h=n._x1,f=n._y1,p=n._z1,m,y,v,A,_,x,E,w,I,T,M;if(!a)return n._root=o,n;for(;a.length;)if((E=e>=(m=(l+h)/2))?l=m:h=m,(w=t>=(y=(c+f)/2))?c=y:f=y,(I=i>=(v=(u+p)/2))?u=v:p=v,s=a,!(a=a[T=I<<2|w<<1|E]))return s[T]=o,n;if(A=+n._x.call(null,a.data),_=+n._y.call(null,a.data),x=+n._z.call(null,a.data),e===A&&t===_&&i===x)return o.next=a,s?s[T]=o:n._root=o,n;do s=s?s[T]=new Array(8):n._root=new Array(8),(E=e>=(m=(l+h)/2))?l=m:h=m,(w=t>=(y=(c+f)/2))?c=y:f=y,(I=i>=(v=(u+p)/2))?u=v:p=v;while((T=I<<2|w<<1|E)===(M=(x>=v)<<2|(_>=y)<<1|A>=m));return s[M]=a,s[T]=o,n}function fQ(n){Array.isArray(n)||(n=Array.from(n));const e=n.length,t=new Float64Array(e),i=new Float64Array(e),r=new Float64Array(e);let s=1/0,a=1/0,o=1/0,l=-1/0,c=-1/0,u=-1/0;for(let h=0,f,p,m,y;h<e;++h)isNaN(p=+this._x.call(null,f=n[h]))||isNaN(m=+this._y.call(null,f))||isNaN(y=+this._z.call(null,f))||(t[h]=p,i[h]=m,r[h]=y,p<s&&(s=p),p>l&&(l=p),m<a&&(a=m),m>c&&(c=m),y<o&&(o=y),y>u&&(u=y));if(s>l||a>c||o>u)return this;this.cover(s,a,o).cover(l,c,u);for(let h=0;h<e;++h)_b(this,t[h],i[h],r[h],n[h]);return this}function dQ(n,e,t){if(isNaN(n=+n)||isNaN(e=+e)||isNaN(t=+t))return this;var i=this._x0,r=this._y0,s=this._z0,a=this._x1,o=this._y1,l=this._z1;if(isNaN(i))a=(i=Math.floor(n))+1,o=(r=Math.floor(e))+1,l=(s=Math.floor(t))+1;else{for(var c=a-i||1,u=this._root,h,f;i>n||n>=a||r>e||e>=o||s>t||t>=l;)switch(f=(t<s)<<2|(e<r)<<1|n<i,h=new Array(8),h[f]=u,u=h,c*=2,f){case 0:a=i+c,o=r+c,l=s+c;break;case 1:i=a-c,o=r+c,l=s+c;break;case 2:a=i+c,r=o-c,l=s+c;break;case 3:i=a-c,r=o-c,l=s+c;break;case 4:a=i+c,o=r+c,s=l-c;break;case 5:i=a-c,o=r+c,s=l-c;break;case 6:a=i+c,r=o-c,s=l-c;break;case 7:i=a-c,r=o-c,s=l-c;break}this._root&&this._root.length&&(this._root=u)}return this._x0=i,this._y0=r,this._z0=s,this._x1=a,this._y1=o,this._z1=l,this}function pQ(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function gQ(n){return arguments.length?this.cover(+n[0][0],+n[0][1],+n[0][2]).cover(+n[1][0],+n[1][1],+n[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function Bn(n,e,t,i,r,s,a){this.node=n,this.x0=e,this.y0=t,this.z0=i,this.x1=r,this.y1=s,this.z1=a}function mQ(n,e,t,i){var r,s=this._x0,a=this._y0,o=this._z0,l,c,u,h,f,p,m=this._x1,y=this._y1,v=this._z1,A=[],_=this._root,x,E;for(_&&A.push(new Bn(_,s,a,o,m,y,v)),i==null?i=1/0:(s=n-i,a=e-i,o=t-i,m=n+i,y=e+i,v=t+i,i*=i);x=A.pop();)if(!(!(_=x.node)||(l=x.x0)>m||(c=x.y0)>y||(u=x.z0)>v||(h=x.x1)<s||(f=x.y1)<a||(p=x.z1)<o))if(_.length){var w=(l+h)/2,I=(c+f)/2,T=(u+p)/2;A.push(new Bn(_[7],w,I,T,h,f,p),new Bn(_[6],l,I,T,w,f,p),new Bn(_[5],w,c,T,h,I,p),new Bn(_[4],l,c,T,w,I,p),new Bn(_[3],w,I,u,h,f,T),new Bn(_[2],l,I,u,w,f,T),new Bn(_[1],w,c,u,h,I,T),new Bn(_[0],l,c,u,w,I,T)),(E=(t>=T)<<2|(e>=I)<<1|n>=w)&&(x=A[A.length-1],A[A.length-1]=A[A.length-1-E],A[A.length-1-E]=x)}else{var M=n-+this._x.call(null,_.data),b=e-+this._y.call(null,_.data),B=t-+this._z.call(null,_.data),L=M*M+b*b+B*B;if(L<i){var U=Math.sqrt(i=L);s=n-U,a=e-U,o=t-U,m=n+U,y=e+U,v=t+U,r=_.data}}return r}function AQ(n){if(isNaN(f=+this._x.call(null,n))||isNaN(p=+this._y.call(null,n))||isNaN(m=+this._z.call(null,n)))return this;var e,t=this._root,i,r,s,a=this._x0,o=this._y0,l=this._z0,c=this._x1,u=this._y1,h=this._z1,f,p,m,y,v,A,_,x,E,w,I;if(!t)return this;if(t.length)for(;;){if((_=f>=(y=(a+c)/2))?a=y:c=y,(x=p>=(v=(o+u)/2))?o=v:u=v,(E=m>=(A=(l+h)/2))?l=A:h=A,e=t,!(t=t[w=E<<2|x<<1|_]))return this;if(!t.length)break;(e[w+1&7]||e[w+2&7]||e[w+3&7]||e[w+4&7]||e[w+5&7]||e[w+6&7]||e[w+7&7])&&(i=e,I=w)}for(;t.data!==n;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[w]=s:delete e[w],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(i?i[I]=t:this._root=t),this):(this._root=s,this)}function vQ(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function yQ(){return this._root}function xQ(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function _Q(n){var e=[],t,i=this._root,r,s,a,o,l,c,u;for(i&&e.push(new Bn(i,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));t=e.pop();)if(!n(i=t.node,s=t.x0,a=t.y0,o=t.z0,l=t.x1,c=t.y1,u=t.z1)&&i.length){var h=(s+l)/2,f=(a+c)/2,p=(o+u)/2;(r=i[7])&&e.push(new Bn(r,h,f,p,l,c,u)),(r=i[6])&&e.push(new Bn(r,s,f,p,h,c,u)),(r=i[5])&&e.push(new Bn(r,h,a,p,l,f,u)),(r=i[4])&&e.push(new Bn(r,s,a,p,h,f,u)),(r=i[3])&&e.push(new Bn(r,h,f,o,l,c,p)),(r=i[2])&&e.push(new Bn(r,s,f,o,h,c,p)),(r=i[1])&&e.push(new Bn(r,h,a,o,l,f,p)),(r=i[0])&&e.push(new Bn(r,s,a,o,h,f,p))}return this}function EQ(n){var e=[],t=[],i;for(this._root&&e.push(new Bn(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));i=e.pop();){var r=i.node;if(r.length){var s,a=i.x0,o=i.y0,l=i.z0,c=i.x1,u=i.y1,h=i.z1,f=(a+c)/2,p=(o+u)/2,m=(l+h)/2;(s=r[0])&&e.push(new Bn(s,a,o,l,f,p,m)),(s=r[1])&&e.push(new Bn(s,f,o,l,c,p,m)),(s=r[2])&&e.push(new Bn(s,a,p,l,f,u,m)),(s=r[3])&&e.push(new Bn(s,f,p,l,c,u,m)),(s=r[4])&&e.push(new Bn(s,a,o,m,f,p,h)),(s=r[5])&&e.push(new Bn(s,f,o,m,c,p,h)),(s=r[6])&&e.push(new Bn(s,a,p,m,f,u,h)),(s=r[7])&&e.push(new Bn(s,f,p,m,c,u,h))}t.push(i)}for(;i=t.pop();)n(i.node,i.x0,i.y0,i.z0,i.x1,i.y1,i.z1);return this}function SQ(n){return n[0]}function wQ(n){return arguments.length?(this._x=n,this):this._x}function CQ(n){return n[1]}function TQ(n){return arguments.length?(this._y=n,this):this._y}function bQ(n){return n[2]}function IQ(n){return arguments.length?(this._z=n,this):this._z}function h4(n,e,t,i){var r=new f4(e??SQ,t??CQ,i??bQ,NaN,NaN,NaN,NaN,NaN,NaN);return n==null?r:r.addAll(n)}function f4(n,e,t,i,r,s,a,o,l){this._x=n,this._y=e,this._z=t,this._x0=i,this._y0=r,this._z0=s,this._x1=a,this._y1=o,this._z1=l,this._root=void 0}function t7(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var hr=h4.prototype=f4.prototype;hr.copy=function(){var n=new f4(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),e=this._root,t,i;if(!e)return n;if(!e.length)return n._root=t7(e),n;for(t=[{source:e,target:n._root=new Array(8)}];e=t.pop();)for(var r=0;r<8;++r)(i=e.source[r])&&(i.length?t.push({source:i,target:e.target[r]=new Array(8)}):e.target[r]=t7(i));return n};hr.add=hQ;hr.addAll=fQ;hr.cover=dQ;hr.data=pQ;hr.extent=gQ;hr.find=mQ;hr.remove=AQ;hr.removeAll=vQ;hr.root=yQ;hr.size=xQ;hr.visit=_Q;hr.visitAfter=EQ;hr.x=wQ;hr.y=TQ;hr.z=IQ;function Zn(n){return function(){return n}}function Us(n){return(n()-.5)*1e-6}function Lv(n){return n.x+n.vx}function n7(n){return n.y+n.vy}function MQ(n){return n.z+n.vz}function Eb(n){var e,t,i,r,s=1,a=1;typeof n!="function"&&(n=Zn(n==null?1:+n));function o(){for(var u,h=e.length,f,p,m,y,v,A,_,x=0;x<a;++x)for(f=(t===1?o4(e,Lv):t===2?c4(e,Lv,n7):t===3?h4(e,Lv,n7,MQ):null).visitAfter(l),u=0;u<h;++u)p=e[u],A=i[p.index],_=A*A,m=p.x+p.vx,t>1&&(y=p.y+p.vy),t>2&&(v=p.z+p.vz),f.visit(E);function E(w,I,T,M,b,B,L){var U=[I,T,M,b,B,L],O=U[0],Q=U[1],G=U[2],F=U[t],q=U[t+1],Y=U[t+2],H=w.data,V=w.r,D=A+V;if(H){if(H.index>p.index){var k=m-H.x-H.vx,Z=t>1?y-H.y-H.vy:0,j=t>2?v-H.z-H.vz:0,ee=k*k+Z*Z+j*j;ee<D*D&&(k===0&&(k=Us(r),ee+=k*k),t>1&&Z===0&&(Z=Us(r),ee+=Z*Z),t>2&&j===0&&(j=Us(r),ee+=j*j),ee=(D-(ee=Math.sqrt(ee)))/ee*s,p.vx+=(k*=ee)*(D=(V*=V)/(_+V)),t>1&&(p.vy+=(Z*=ee)*D),t>2&&(p.vz+=(j*=ee)*D),H.vx-=k*(D=1-D),t>1&&(H.vy-=Z*D),t>2&&(H.vz-=j*D))}return}return O>m+D||F<m-D||t>1&&(Q>y+D||q<y-D)||t>2&&(G>v+D||Y<v-D)}}function l(u){if(u.data)return u.r=i[u.data.index];for(var h=u.r=0;h<Math.pow(2,t);++h)u[h]&&u[h].r>u.r&&(u.r=u[h].r)}function c(){if(e){var u,h=e.length,f;for(i=new Array(h),u=0;u<h;++u)f=e[u],i[f.index]=+n(f,u,e)}}return o.initialize=function(u,...h){e=u,r=h.find(f=>typeof f=="function")||Math.random,t=h.find(f=>[1,2,3].includes(f))||2,c()},o.iterations=function(u){return arguments.length?(a=+u,o):a},o.strength=function(u){return arguments.length?(s=+u,o):s},o.radius=function(u){return arguments.length?(n=typeof u=="function"?u:Zn(+u),c(),o):n},o}function RQ(n){return n.index}function i7(n,e){var t=n.get(e);if(!t)throw new Error("node not found: "+e);return t}function Sb(n){var e=RQ,t=f,i,r=Zn(30),s,a,o,l,c,u,h=1;n==null&&(n=[]);function f(A){return 1/Math.min(l[A.source.index],l[A.target.index])}function p(A){for(var _=0,x=n.length;_<h;++_)for(var E=0,w,I,T,M=0,b=0,B=0,L,U;E<x;++E)w=n[E],I=w.source,T=w.target,M=T.x+T.vx-I.x-I.vx||Us(u),o>1&&(b=T.y+T.vy-I.y-I.vy||Us(u)),o>2&&(B=T.z+T.vz-I.z-I.vz||Us(u)),L=Math.sqrt(M*M+b*b+B*B),L=(L-s[E])/L*A*i[E],M*=L,b*=L,B*=L,T.vx-=M*(U=c[E]),o>1&&(T.vy-=b*U),o>2&&(T.vz-=B*U),I.vx+=M*(U=1-U),o>1&&(I.vy+=b*U),o>2&&(I.vz+=B*U)}function m(){if(a){var A,_=a.length,x=n.length,E=new Map(a.map((I,T)=>[e(I,T,a),I])),w;for(A=0,l=new Array(_);A<x;++A)w=n[A],w.index=A,typeof w.source!="object"&&(w.source=i7(E,w.source)),typeof w.target!="object"&&(w.target=i7(E,w.target)),l[w.source.index]=(l[w.source.index]||0)+1,l[w.target.index]=(l[w.target.index]||0)+1;for(A=0,c=new Array(x);A<x;++A)w=n[A],c[A]=l[w.source.index]/(l[w.source.index]+l[w.target.index]);i=new Array(x),y(),s=new Array(x),v()}}function y(){if(a)for(var A=0,_=n.length;A<_;++A)i[A]=+t(n[A],A,n)}function v(){if(a)for(var A=0,_=n.length;A<_;++A)s[A]=+r(n[A],A,n)}return p.initialize=function(A,..._){a=A,u=_.find(x=>typeof x=="function")||Math.random,o=_.find(x=>[1,2,3].includes(x))||2,m()},p.links=function(A){return arguments.length?(n=A,m(),p):n},p.id=function(A){return arguments.length?(e=A,p):e},p.iterations=function(A){return arguments.length?(h=+A,p):h},p.strength=function(A){return arguments.length?(t=typeof A=="function"?A:Zn(+A),y(),p):t},p.distance=function(A){return arguments.length?(r=typeof A=="function"?A:Zn(+A),v(),p):r},p}var BQ={value:()=>{}};function wb(){for(var n=0,e=arguments.length,t={},i;n<e;++n){if(!(i=arguments[n]+"")||i in t||/[\s.]/.test(i))throw new Error("illegal type: "+i);t[i]=[]}return new pm(t)}function pm(n){this._=n}function DQ(n,e){return n.trim().split(/^|\s+/).map(function(t){var i="",r=t.indexOf(".");if(r>=0&&(i=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:i}})}pm.prototype=wb.prototype={constructor:pm,on:function(n,e){var t=this._,i=DQ(n+"",t),r,s=-1,a=i.length;if(arguments.length<2){for(;++s<a;)if((r=(n=i[s]).type)&&(r=PQ(t[r],n.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<a;)if(r=(n=i[s]).type)t[r]=r7(t[r],n.name,e);else if(e==null)for(r in t)t[r]=r7(t[r],n.name,null);return this},copy:function(){var n={},e=this._;for(var t in e)n[t]=e[t].slice();return new pm(n)},call:function(n,e){if((r=arguments.length-2)>0)for(var t=new Array(r),i=0,r,s;i<r;++i)t[i]=arguments[i+2];if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(s=this._[n],i=0,r=s.length;i<r;++i)s[i].value.apply(e,t)},apply:function(n,e,t){if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(var i=this._[n],r=0,s=i.length;r<s;++r)i[r].value.apply(e,t)}};function PQ(n,e){for(var t=0,i=n.length,r;t<i;++t)if((r=n[t]).name===e)return r.value}function r7(n,e,t){for(var i=0,r=n.length;i<r;++i)if(n[i].name===e){n[i]=BQ,n=n.slice(0,i).concat(n.slice(i+1));break}return t!=null&&n.push({name:e,value:t}),n}var qh=0,zd=0,sd=0,Cb=1e3,Um,Qd,Om=0,lu=0,o1=0,Gp=typeof performance=="object"&&performance.now?performance:Date,Tb=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function bb(){return lu||(Tb(LQ),lu=Gp.now()+o1)}function LQ(){lu=0}function yy(){this._call=this._time=this._next=null}yy.prototype=Ib.prototype={constructor:yy,restart:function(n,e,t){if(typeof n!="function")throw new TypeError("callback is not a function");t=(t==null?bb():+t)+(e==null?0:+e),!this._next&&Qd!==this&&(Qd?Qd._next=this:Um=this,Qd=this),this._call=n,this._time=t,xy()},stop:function(){this._call&&(this._call=null,this._time=1/0,xy())}};function Ib(n,e,t){var i=new yy;return i.restart(n,e,t),i}function UQ(){bb(),++qh;for(var n=Um,e;n;)(e=lu-n._time)>=0&&n._call.call(void 0,e),n=n._next;--qh}function s7(){lu=(Om=Gp.now())+o1,qh=zd=0;try{UQ()}finally{qh=0,FQ(),lu=0}}function OQ(){var n=Gp.now(),e=n-Om;e>Cb&&(o1-=e,Om=n)}function FQ(){for(var n,e=Um,t,i=1/0;e;)e._call?(i>e._time&&(i=e._time),n=e,e=e._next):(t=e._next,e._next=null,e=n?n._next=t:Um=t);Qd=n,xy(i)}function xy(n){if(!qh){zd&&(zd=clearTimeout(zd));var e=n-lu;e>24?(n<1/0&&(zd=setTimeout(s7,n-Gp.now()-o1)),sd&&(sd=clearInterval(sd))):(sd||(Om=Gp.now(),sd=setInterval(OQ,Cb)),qh=1,Tb(s7))}}const kQ=1664525,NQ=1013904223,a7=4294967296;function GQ(){let n=1;return()=>(n=(kQ*n+NQ)%a7)/a7}var o7=3;function Uv(n){return n.x}function l7(n){return n.y}function zQ(n){return n.z}var QQ=10,HQ=Math.PI*(3-Math.sqrt(5)),VQ=Math.PI*20/(9+Math.sqrt(221));function Mb(n,e){e=e||2;var t=Math.min(o7,Math.max(1,Math.round(e))),i,r=1,s=.001,a=1-Math.pow(s,1/300),o=0,l=.6,c=new Map,u=Ib(p),h=wb("tick","end"),f=GQ();n==null&&(n=[]);function p(){m(),h.call("tick",i),r<s&&(u.stop(),h.call("end",i))}function m(A){var _,x=n.length,E;A===void 0&&(A=1);for(var w=0;w<A;++w)for(r+=(o-r)*a,c.forEach(function(I){I(r)}),_=0;_<x;++_)E=n[_],E.fx==null?E.x+=E.vx*=l:(E.x=E.fx,E.vx=0),t>1&&(E.fy==null?E.y+=E.vy*=l:(E.y=E.fy,E.vy=0)),t>2&&(E.fz==null?E.z+=E.vz*=l:(E.z=E.fz,E.vz=0));return i}function y(){for(var A=0,_=n.length,x;A<_;++A){if(x=n[A],x.index=A,x.fx!=null&&(x.x=x.fx),x.fy!=null&&(x.y=x.fy),x.fz!=null&&(x.z=x.fz),isNaN(x.x)||t>1&&isNaN(x.y)||t>2&&isNaN(x.z)){var E=QQ*(t>2?Math.cbrt(.5+A):t>1?Math.sqrt(.5+A):A),w=A*HQ,I=A*VQ;t===1?x.x=E:t===2?(x.x=E*Math.cos(w),x.y=E*Math.sin(w)):(x.x=E*Math.sin(w)*Math.cos(I),x.y=E*Math.cos(w),x.z=E*Math.sin(w)*Math.sin(I))}(isNaN(x.vx)||t>1&&isNaN(x.vy)||t>2&&isNaN(x.vz))&&(x.vx=0,t>1&&(x.vy=0),t>2&&(x.vz=0))}}function v(A){return A.initialize&&A.initialize(n,f,t),A}return y(),i={tick:m,restart:function(){return u.restart(p),i},stop:function(){return u.stop(),i},numDimensions:function(A){return arguments.length?(t=Math.min(o7,Math.max(1,Math.round(A))),c.forEach(v),i):t},nodes:function(A){return arguments.length?(n=A,y(),c.forEach(v),i):n},alpha:function(A){return arguments.length?(r=+A,i):r},alphaMin:function(A){return arguments.length?(s=+A,i):s},alphaDecay:function(A){return arguments.length?(a=+A,i):+a},alphaTarget:function(A){return arguments.length?(o=+A,i):o},velocityDecay:function(A){return arguments.length?(l=1-A,i):1-l},randomSource:function(A){return arguments.length?(f=A,c.forEach(v),i):f},force:function(A,_){return arguments.length>1?(_==null?c.delete(A):c.set(A,v(_)),i):c.get(A)},find:function(){var A=Array.prototype.slice.call(arguments),_=A.shift()||0,x=(t>1?A.shift():null)||0,E=(t>2?A.shift():null)||0,w=A.shift()||1/0,I=0,T=n.length,M,b,B,L,U,O;for(w*=w,I=0;I<T;++I)U=n[I],M=_-U.x,b=x-(U.y||0),B=E-(U.z||0),L=M*M+b*b+B*B,L<w&&(O=U,w=L);return O},on:function(A,_){return arguments.length>1?(h.on(A,_),i):h.on(A)}}}function Rb(){var n,e,t,i,r,s=Zn(-30),a,o=1,l=1/0,c=.81;function u(m){var y,v=n.length,A=(e===1?o4(n,Uv):e===2?c4(n,Uv,l7):e===3?h4(n,Uv,l7,zQ):null).visitAfter(f);for(r=m,y=0;y<v;++y)t=n[y],A.visit(p)}function h(){if(n){var m,y=n.length,v;for(a=new Array(y),m=0;m<y;++m)v=n[m],a[v.index]=+s(v,m,n)}}function f(m){var y=0,v,A,_=0,x,E,w,I,T=m.length;if(T){for(x=E=w=I=0;I<T;++I)(v=m[I])&&(A=Math.abs(v.value))&&(y+=v.value,_+=A,x+=A*(v.x||0),E+=A*(v.y||0),w+=A*(v.z||0));y*=Math.sqrt(4/T),m.x=x/_,e>1&&(m.y=E/_),e>2&&(m.z=w/_)}else{v=m,v.x=v.data.x,e>1&&(v.y=v.data.y),e>2&&(v.z=v.data.z);do y+=a[v.data.index];while(v=v.next)}m.value=y}function p(m,y,v,A,_){if(!m.value)return!0;var x=[v,A,_][e-1],E=m.x-t.x,w=e>1?m.y-t.y:0,I=e>2?m.z-t.z:0,T=x-y,M=E*E+w*w+I*I;if(T*T/c<M)return M<l&&(E===0&&(E=Us(i),M+=E*E),e>1&&w===0&&(w=Us(i),M+=w*w),e>2&&I===0&&(I=Us(i),M+=I*I),M<o&&(M=Math.sqrt(o*M)),t.vx+=E*m.value*r/M,e>1&&(t.vy+=w*m.value*r/M),e>2&&(t.vz+=I*m.value*r/M)),!0;if(m.length||M>=l)return;(m.data!==t||m.next)&&(E===0&&(E=Us(i),M+=E*E),e>1&&w===0&&(w=Us(i),M+=w*w),e>2&&I===0&&(I=Us(i),M+=I*I),M<o&&(M=Math.sqrt(o*M)));do m.data!==t&&(T=a[m.data.index]*r/M,t.vx+=E*T,e>1&&(t.vy+=w*T),e>2&&(t.vz+=I*T));while(m=m.next)}return u.initialize=function(m,...y){n=m,i=y.find(v=>typeof v=="function")||Math.random,e=y.find(v=>[1,2,3].includes(v))||2,h()},u.strength=function(m){return arguments.length?(s=typeof m=="function"?m:Zn(+m),h(),u):s},u.distanceMin=function(m){return arguments.length?(o=m*m,u):Math.sqrt(o)},u.distanceMax=function(m){return arguments.length?(l=m*m,u):Math.sqrt(l)},u.theta=function(m){return arguments.length?(c=m*m,u):Math.sqrt(c)},u}function WQ(n,e,t,i){var r,s,a=Zn(.1),o,l;typeof n!="function"&&(n=Zn(+n)),e==null&&(e=0),t==null&&(t=0),i==null&&(i=0);function c(h){for(var f=0,p=r.length;f<p;++f){var m=r[f],y=m.x-e||1e-6,v=(m.y||0)-t||1e-6,A=(m.z||0)-i||1e-6,_=Math.sqrt(y*y+v*v+A*A),x=(l[f]-_)*o[f]*h/_;m.vx+=y*x,s>1&&(m.vy+=v*x),s>2&&(m.vz+=A*x)}}function u(){if(r){var h,f=r.length;for(o=new Array(f),l=new Array(f),h=0;h<f;++h)l[h]=+n(r[h],h,r),o[h]=isNaN(l[h])?0:+a(r[h],h,r)}}return c.initialize=function(h,...f){r=h,s=f.find(p=>[1,2,3].includes(p))||2,u()},c.strength=function(h){return arguments.length?(a=typeof h=="function"?h:Zn(+h),u(),c):a},c.radius=function(h){return arguments.length?(n=typeof h=="function"?h:Zn(+h),u(),c):n},c.x=function(h){return arguments.length?(e=+h,c):e},c.y=function(h){return arguments.length?(t=+h,c):t},c.z=function(h){return arguments.length?(i=+h,c):i},c}function Bb(n){var e=Zn(.1),t,i,r;typeof n!="function"&&(n=Zn(n==null?0:+n));function s(o){for(var l=0,c=t.length,u;l<c;++l)u=t[l],u.vx+=(r[l]-u.x)*i[l]*o}function a(){if(t){var o,l=t.length;for(i=new Array(l),r=new Array(l),o=0;o<l;++o)i[o]=isNaN(r[o]=+n(t[o],o,t))?0:+e(t[o],o,t)}}return s.initialize=function(o){t=o,a()},s.strength=function(o){return arguments.length?(e=typeof o=="function"?o:Zn(+o),a(),s):e},s.x=function(o){return arguments.length?(n=typeof o=="function"?o:Zn(+o),a(),s):n},s}function Db(n){var e=Zn(.1),t,i,r;typeof n!="function"&&(n=Zn(n==null?0:+n));function s(o){for(var l=0,c=t.length,u;l<c;++l)u=t[l],u.vy+=(r[l]-u.y)*i[l]*o}function a(){if(t){var o,l=t.length;for(i=new Array(l),r=new Array(l),o=0;o<l;++o)i[o]=isNaN(r[o]=+n(t[o],o,t))?0:+e(t[o],o,t)}}return s.initialize=function(o){t=o,a()},s.strength=function(o){return arguments.length?(e=typeof o=="function"?o:Zn(+o),a(),s):e},s.y=function(o){return arguments.length?(n=typeof o=="function"?o:Zn(+o),a(),s):n},s}function YQ(n){var e=Zn(.1),t,i,r;typeof n!="function"&&(n=Zn(n==null?0:+n));function s(o){for(var l=0,c=t.length,u;l<c;++l)u=t[l],u.vz+=(r[l]-u.z)*i[l]*o}function a(){if(t){var o,l=t.length;for(i=new Array(l),r=new Array(l),o=0;o<l;++o)i[o]=isNaN(r[o]=+n(t[o],o,t))?0:+e(t[o],o,t)}}return s.initialize=function(o){t=o,a()},s.strength=function(o){return arguments.length?(e=typeof o=="function"?o:Zn(+o),a(),s):e},s.z=function(o){return arguments.length?(n=typeof o=="function"?o:Zn(+o),a(),s):n},s}function qQ(n){var e=0,t=n.children,i=t&&t.length;if(!i)e=1;else for(;--i>=0;)e+=t[i].value;n.value=e}function XQ(){return this.eachAfter(qQ)}function jQ(n,e){let t=-1;for(const i of this)n.call(e,i,++t,this);return this}function KQ(n,e){for(var t=this,i=[t],r,s,a=-1;t=i.pop();)if(n.call(e,t,++a,this),r=t.children)for(s=r.length-1;s>=0;--s)i.push(r[s]);return this}function $Q(n,e){for(var t=this,i=[t],r=[],s,a,o,l=-1;t=i.pop();)if(r.push(t),s=t.children)for(a=0,o=s.length;a<o;++a)i.push(s[a]);for(;t=r.pop();)n.call(e,t,++l,this);return this}function JQ(n,e){let t=-1;for(const i of this)if(n.call(e,i,++t,this))return i}function ZQ(n){return this.eachAfter(function(e){for(var t=+n(e.data)||0,i=e.children,r=i&&i.length;--r>=0;)t+=i[r].value;e.value=t})}function eH(n){return this.eachBefore(function(e){e.children&&e.children.sort(n)})}function tH(n){for(var e=this,t=nH(e,n),i=[e];e!==t;)e=e.parent,i.push(e);for(var r=i.length;n!==t;)i.splice(r,0,n),n=n.parent;return i}function nH(n,e){if(n===e)return n;var t=n.ancestors(),i=e.ancestors(),r=null;for(n=t.pop(),e=i.pop();n===e;)r=n,n=t.pop(),e=i.pop();return r}function iH(){for(var n=this,e=[n];n=n.parent;)e.push(n);return e}function rH(){return Array.from(this)}function sH(){var n=[];return this.eachBefore(function(e){e.children||n.push(e)}),n}function aH(){var n=this,e=[];return n.each(function(t){t!==n&&e.push({source:t.parent,target:t})}),e}function*oH(){var n=this,e,t=[n],i,r,s;do for(e=t.reverse(),t=[];n=e.pop();)if(yield n,i=n.children)for(r=0,s=i.length;r<s;++r)t.push(i[r]);while(t.length)}function l1(n,e){n instanceof Map?(n=[void 0,n],e===void 0&&(e=uH)):e===void 0&&(e=cH);for(var t=new Xh(n),i,r=[t],s,a,o,l;i=r.pop();)if((a=e(i.data))&&(l=(a=Array.from(a)).length))for(i.children=a,o=l-1;o>=0;--o)r.push(s=a[o]=new Xh(a[o])),s.parent=i,s.depth=i.depth+1;return t.eachBefore(Pb)}function lH(){return l1(this).eachBefore(hH)}function cH(n){return n.children}function uH(n){return Array.isArray(n)?n[1]:null}function hH(n){n.data.value!==void 0&&(n.value=n.data.value),n.data=n.data.data}function Pb(n){var e=0;do n.height=e;while((n=n.parent)&&n.height<++e)}function Xh(n){this.data=n,this.depth=this.height=0,this.parent=null}Xh.prototype=l1.prototype={constructor:Xh,count:XQ,each:jQ,eachAfter:$Q,eachBefore:KQ,find:JQ,sum:ZQ,sort:eH,path:tH,ancestors:iH,descendants:rH,leaves:sH,links:aH,copy:lH,[Symbol.iterator]:oH};function Ov(n){return n==null?null:Lb(n)}function Lb(n){if(typeof n!="function")throw new Error;return n}function ad(){return 0}function od(n){return function(){return n}}function fH(n){n.x0=Math.round(n.x0),n.y0=Math.round(n.y0),n.x1=Math.round(n.x1),n.y1=Math.round(n.y1)}function dH(n,e,t,i,r){for(var s=n.children,a,o=-1,l=s.length,c=n.value&&(i-e)/n.value;++o<l;)a=s[o],a.y0=t,a.y1=r,a.x0=e,a.x1=e+=a.value*c}var pH={depth:-1},c7={},Fv={};function gH(n){return n.id}function mH(n){return n.parentId}function AH(){var n=gH,e=mH,t;function i(r){var s=Array.from(r),a=n,o=e,l,c,u,h,f,p,m,y,v=new Map;if(t!=null){const A=s.map((E,w)=>vH(t(E,w,r))),_=A.map(u7),x=new Set(A).add("");for(const E of _)x.has(E)||(x.add(E),A.push(E),_.push(u7(E)),s.push(Fv));a=(E,w)=>A[w],o=(E,w)=>_[w]}for(u=0,l=s.length;u<l;++u)c=s[u],p=s[u]=new Xh(c),(m=a(c,u,r))!=null&&(m+="")&&(y=p.id=m,v.set(y,v.has(y)?c7:p)),(m=o(c,u,r))!=null&&(m+="")&&(p.parent=m);for(u=0;u<l;++u)if(p=s[u],m=p.parent){if(f=v.get(m),!f)throw new Error("missing: "+m);if(f===c7)throw new Error("ambiguous: "+m);f.children?f.children.push(p):f.children=[p],p.parent=f}else{if(h)throw new Error("multiple roots");h=p}if(!h)throw new Error("no root");if(t!=null){for(;h.data===Fv&&h.children.length===1;)h=h.children[0],--l;for(let A=s.length-1;A>=0&&(p=s[A],p.data===Fv);--A)p.data=null}if(h.parent=pH,h.eachBefore(function(A){A.depth=A.parent.depth+1,--l}).eachBefore(Pb),h.parent=null,l>0)throw new Error("cycle");return h}return i.id=function(r){return arguments.length?(n=Ov(r),i):n},i.parentId=function(r){return arguments.length?(e=Ov(r),i):e},i.path=function(r){return arguments.length?(t=Ov(r),i):t},i}function vH(n){n=`${n}`;let e=n.length;return _y(n,e-1)&&!_y(n,e-2)&&(n=n.slice(0,-1)),n[0]==="/"?n:`/${n}`}function u7(n){let e=n.length;if(e<2)return"";for(;--e>1&&!_y(n,e););return n.slice(0,e)}function _y(n,e){if(n[e]==="/"){let t=0;for(;e>0&&n[--e]==="\\";)++t;if(!(t&1))return!0}return!1}function yH(n,e){return n.parent===e.parent?1:2}function kv(n){var e=n.children;return e?e[0]:n.t}function Nv(n){var e=n.children;return e?e[e.length-1]:n.t}function xH(n,e,t){var i=t/(e.i-n.i);e.c-=i,e.s+=t,n.c+=i,e.z+=t,e.m+=t}function _H(n){for(var e=0,t=0,i=n.children,r=i.length,s;--r>=0;)s=i[r],s.z+=e,s.m+=e,e+=s.s+(t+=s.c)}function EH(n,e,t){return n.a.parent===e.parent?n.a:t}function gm(n,e){this._=n,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}gm.prototype=Object.create(Xh.prototype);function SH(n){for(var e=new gm(n,0),t,i=[e],r,s,a,o;t=i.pop();)if(s=t._.children)for(t.children=new Array(o=s.length),a=o-1;a>=0;--a)i.push(r=t.children[a]=new gm(s[a],a)),r.parent=t;return(e.parent=new gm(null,0)).children=[e],e}function wH(){var n=yH,e=1,t=1,i=null;function r(c){var u=SH(c);if(u.eachAfter(s),u.parent.m=-u.z,u.eachBefore(a),i)c.eachBefore(l);else{var h=c,f=c,p=c;c.eachBefore(function(_){_.x<h.x&&(h=_),_.x>f.x&&(f=_),_.depth>p.depth&&(p=_)});var m=h===f?1:n(h,f)/2,y=m-h.x,v=e/(f.x+m+y),A=t/(p.depth||1);c.eachBefore(function(_){_.x=(_.x+y)*v,_.y=_.depth*A})}return c}function s(c){var u=c.children,h=c.parent.children,f=c.i?h[c.i-1]:null;if(u){_H(c);var p=(u[0].z+u[u.length-1].z)/2;f?(c.z=f.z+n(c._,f._),c.m=c.z-p):c.z=p}else f&&(c.z=f.z+n(c._,f._));c.parent.A=o(c,f,c.parent.A||h[0])}function a(c){c._.x=c.z+c.parent.m,c.m+=c.parent.m}function o(c,u,h){if(u){for(var f=c,p=c,m=u,y=f.parent.children[0],v=f.m,A=p.m,_=m.m,x=y.m,E;m=Nv(m),f=kv(f),m&&f;)y=kv(y),p=Nv(p),p.a=c,E=m.z+_-f.z-v+n(m._,f._),E>0&&(xH(EH(m,c,h),c,E),v+=E,A+=E),_+=m.m,v+=f.m,x+=y.m,A+=p.m;m&&!Nv(p)&&(p.t=m,p.m+=_-A),f&&!kv(y)&&(y.t=f,y.m+=v-x,h=c)}return h}function l(c){c.x*=e,c.y=c.depth*t}return r.separation=function(c){return arguments.length?(n=c,r):n},r.size=function(c){return arguments.length?(i=!1,e=+c[0],t=+c[1],r):i?null:[e,t]},r.nodeSize=function(c){return arguments.length?(i=!0,e=+c[0],t=+c[1],r):i?[e,t]:null},r}function CH(n,e,t,i,r){for(var s=n.children,a,o=-1,l=s.length,c=n.value&&(r-t)/n.value;++o<l;)a=s[o],a.x0=e,a.x1=i,a.y0=t,a.y1=t+=a.value*c}var TH=(1+Math.sqrt(5))/2;function bH(n,e,t,i,r,s){for(var a=[],o=e.children,l,c,u=0,h=0,f=o.length,p,m,y=e.value,v,A,_,x,E,w,I;u<f;){p=r-t,m=s-i;do v=o[h++].value;while(!v&&h<f);for(A=_=v,w=Math.max(m/p,p/m)/(y*n),I=v*v*w,E=Math.max(_/I,I/A);h<f;++h){if(v+=c=o[h].value,c<A&&(A=c),c>_&&(_=c),I=v*v*w,x=Math.max(_/I,I/A),x>E){v-=c;break}E=x}a.push(l={value:v,dice:p<m,children:o.slice(u,h)}),l.dice?dH(l,t,i,r,y?i+=m*v/y:s):CH(l,t,i,y?t+=p*v/y:r,s),y-=v,u=h}return a}const IH=function n(e){function t(i,r,s,a,o){bH(e,i,r,s,a,o)}return t.ratio=function(i){return n((i=+i)>1?i:1)},t}(TH);function MH(){var n=IH,e=!1,t=1,i=1,r=[0],s=ad,a=ad,o=ad,l=ad,c=ad;function u(f){return f.x0=f.y0=0,f.x1=t,f.y1=i,f.eachBefore(h),r=[0],e&&f.eachBefore(fH),f}function h(f){var p=r[f.depth],m=f.x0+p,y=f.y0+p,v=f.x1-p,A=f.y1-p;v<m&&(m=v=(m+v)/2),A<y&&(y=A=(y+A)/2),f.x0=m,f.y0=y,f.x1=v,f.y1=A,f.children&&(p=r[f.depth+1]=s(f)/2,m+=c(f)-p,y+=a(f)-p,v-=o(f)-p,A-=l(f)-p,v<m&&(m=v=(m+v)/2),A<y&&(y=A=(y+A)/2),n(f,m,y,v,A))}return u.round=function(f){return arguments.length?(e=!!f,u):e},u.size=function(f){return arguments.length?(t=+f[0],i=+f[1],u):[t,i]},u.tile=function(f){return arguments.length?(n=Lb(f),u):n},u.padding=function(f){return arguments.length?u.paddingInner(f).paddingOuter(f):u.paddingInner()},u.paddingInner=function(f){return arguments.length?(s=typeof f=="function"?f:od(+f),u):s},u.paddingOuter=function(f){return arguments.length?u.paddingTop(f).paddingRight(f).paddingBottom(f).paddingLeft(f):u.paddingTop()},u.paddingTop=function(f){return arguments.length?(a=typeof f=="function"?f:od(+f),u):a},u.paddingRight=function(f){return arguments.length?(o=typeof f=="function"?f:od(+f),u):o},u.paddingBottom=function(f){return arguments.length?(l=typeof f=="function"?f:od(+f),u):l},u.paddingLeft=function(f){return arguments.length?(c=typeof f=="function"?f:od(+f),u):c},u}function RH(n){return!n||typeof n!="object"||typeof n=="function"||Array.isArray(n)||n instanceof Set||n instanceof Map||n instanceof RegExp||n instanceof Date}function Ub(n,e){n=n||{};var t={};for(var i in e){var r=n[i],s=e[i];if(!RH(s)){t[i]=Ub(r,s);continue}r===void 0?t[i]=s:t[i]=r}return t}var d4=Ub,Kl=function(e){return e!==null&&typeof e=="object"&&typeof e.addUndirectedEdgeWithKey=="function"&&typeof e.dropNode=="function"&&typeof e.multi=="boolean"},BH=d4,DH=Kl,PH={dimensions:["x","y"],center:.5,scale:1};function Ob(n,e,t){if(!DH(e))throw new Error("graphology-layout/random: the given graph is not a valid graphology instance.");t=BH(t,PH);var i=t.dimensions;if(!Array.isArray(i)||i.length!==2)throw new Error("graphology-layout/random: given dimensions are invalid.");var r=t.center,s=t.scale,a=Math.PI*2,o=(r-.5)*s,l=e.order,c=i[0],u=i[1];function h(m,y){return y[c]=s*Math.cos(m*a/l)+o,y[u]=s*Math.sin(m*a/l)+o,y}var f=0;if(!n){var p={};return e.forEachNode(function(m){p[m]=h(f++,{})}),p}e.updateEachNodeAttributes(function(m,y){return h(f++,y),y},{attributes:i})}var Fb=Ob.bind(null,!1);Fb.assign=Ob.bind(null,!0);var LH=Fb;const UH=ps(LH);var ld=0,cd=1,Mg=2,ud=3;function OH(n,e){return n+"§"+e}function h7(){return .01*(.5-Math.random())}var FH=function(e,t){var i=e.margin,r=e.ratio,s=e.expansion,a=e.gridSize,o=e.speed,l,c,u,h,f,p,m=!0,y=t.length,v=y/ud|0,A=new Float32Array(v),_=new Float32Array(v),x=1/0,E=1/0,w=-1/0,I=-1/0;for(l=0;l<y;l+=ud)u=t[l+ld],h=t[l+cd],p=t[l+Mg]*r+i,x=Math.min(x,u-p),w=Math.max(w,u+p),E=Math.min(E,h-p),I=Math.max(I,h+p);var T=w-x,M=I-E,b=(x+w)/2,B=(E+I)/2;x=b-s*T/2,w=b+s*T/2,E=B-s*M/2,I=B+s*M/2;var L=new Array(a*a),U=L.length,O;for(O=0;O<U;O++)L[O]=[];var Q,G,F,q,Y,H,V,D,k,Z;for(l=0;l<y;l+=ud)for(u=t[l+ld],h=t[l+cd],p=t[l+Mg]*r+i,Q=u-p,G=u+p,F=h-p,q=h+p,Y=Math.floor(a*(Q-x)/(w-x)),H=Math.floor(a*(G-x)/(w-x)),V=Math.floor(a*(F-E)/(I-E)),D=Math.floor(a*(q-E)/(I-E)),k=Y;k<=H;k++)for(Z=V;Z<=D;Z++)L[k*a+Z].push(l);var j,ee=new Set,ie,te,re,ce,ye,oe,W,ge,he,ue,fe,Pe,pe;for(O=0;O<U;O++)for(j=L[O],l=0,f=j.length;l<f;l++)for(ie=j[l],re=t[ie+ld],ye=t[ie+cd],W=t[ie+Mg],c=l+1;c<f;c++)te=j[c],he=OH(ie,te),!(U>1&&ee.has(he))&&(U>1&&ee.add(he),ce=t[te+ld],oe=t[te+cd],ge=t[te+Mg],ue=ce-re,fe=oe-ye,Pe=Math.sqrt(ue*ue+fe*fe),pe=Pe<W*r+i+(ge*r+i),pe&&(m=!1,te=te/ud|0,Pe>0?(A[te]+=ue/Pe*(1+W),_[te]+=fe/Pe*(1+W)):(A[te]+=T*h7(),_[te]+=M*h7())));for(l=0,c=0;l<y;l+=ud,c++)t[l+ld]+=A[c]*.1*o,t[l+cd]+=_[c]*.1*o;return{converged:m}},ff={},Fm=3;ff.validateSettings=function(n){return"gridSize"in n&&typeof n.gridSize!="number"||n.gridSize<=0?{message:"the `gridSize` setting should be a positive number."}:"margin"in n&&typeof n.margin!="number"||n.margin<0?{message:"the `margin` setting should be 0 or a positive number."}:"expansion"in n&&typeof n.expansion!="number"||n.expansion<=0?{message:"the `expansion` setting should be a positive number."}:"ratio"in n&&typeof n.ratio!="number"||n.ratio<=0?{message:"the `ratio` setting should be a positive number."}:"speed"in n&&typeof n.speed!="number"||n.speed<=0?{message:"the `speed` setting should be a positive number."}:null};ff.graphToByteArray=function(n,e){var t=n.order,i=new Float32Array(t*Fm),r=0;return n.forEachNode(function(s,a){typeof e=="function"&&(a=e(s,a)),i[r]=a.x,i[r+1]=a.y,i[r+2]=a.size||1,r+=Fm}),i};ff.assignLayoutChanges=function(n,e,t){var i=0;n.forEachNode(function(r){var s={x:e[i],y:e[i+1]};typeof t=="function"&&(s=t(r,s)),n.mergeNodeAttributes(r,s),i+=Fm})};ff.collectLayoutChanges=function(n,e,t){var i={},r=0;return n.forEachNode(function(s){var a={x:e[r],y:e[r+1]};typeof t=="function"&&(a=t(s,a)),i[s]=a,r+=Fm}),i};ff.createWorker=function(e){var t=window.URL||window.webkitURL,i=e.toString(),r=t.createObjectURL(new Blob(["("+i+").call(this);"],{type:"text/javascript"})),s=new Worker(r);return t.revokeObjectURL(r),s};var kH={gridSize:20,margin:5,expansion:1.1,ratio:1,speed:3},NH=Kl,GH=FH,Rg=ff,zH=kH,QH=500;function kb(n,e,t){if(!NH(e))throw new Error("graphology-layout-noverlap: the given graph is not a valid graphology instance.");typeof t=="number"?t={maxIterations:t}:t=t||{};var i=t.maxIterations||QH;if(typeof i!="number"||i<=0)throw new Error("graphology-layout-force: you should provide a positive number of maximum iterations.");var r=Object.assign({},zH,t.settings),s=Rg.validateSettings(r);if(s)throw new Error("graphology-layout-noverlap: "+s.message);var a=Rg.graphToByteArray(e,t.inputReducer),o=!1,l;for(l=0;l<i&&!o;l++)o=GH(r,a).converged;if(n){Rg.assignLayoutChanges(e,a,t.outputReducer);return}return Rg.collectLayoutChanges(e,a,t.outputReducer)}var Nb=kb.bind(null,!1);Nb.assign=kb.bind(null,!0);var HH=Nb;const VH=ps(HH);var df={};function WH(n){return typeof n!="number"||isNaN(n)?1:n}function YH(n,e){var t={},i=function(a){return typeof a>"u"?e:a};typeof e=="function"&&(i=e);var r=function(a){return i(a[n])},s=function(){return i(void 0)};return typeof n=="string"?(t.fromAttributes=r,t.fromGraph=function(a,o){return r(a.getNodeAttributes(o))},t.fromEntry=function(a,o){return r(o)}):typeof n=="function"?(t.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},t.fromGraph=function(a,o){return i(n(o,a.getNodeAttributes(o)))},t.fromEntry=function(a,o){return i(n(a,o))}):(t.fromAttributes=s,t.fromGraph=s,t.fromEntry=s),t}function Gb(n,e){var t={},i=function(a){return typeof a>"u"?e:a};typeof e=="function"&&(i=e);var r=function(a){return i(a[n])},s=function(){return i(void 0)};return typeof n=="string"?(t.fromAttributes=r,t.fromGraph=function(a,o){return r(a.getEdgeAttributes(o))},t.fromEntry=function(a,o){return r(o)},t.fromPartialEntry=t.fromEntry,t.fromMinimalEntry=t.fromEntry):typeof n=="function"?(t.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},t.fromGraph=function(a,o){var l=a.extremities(o);return i(n(o,a.getEdgeAttributes(o),l[0],l[1],a.getNodeAttributes(l[0]),a.getNodeAttributes(l[1]),a.isUndirected(o)))},t.fromEntry=function(a,o,l,c,u,h,f){return i(n(a,o,l,c,u,h,f))},t.fromPartialEntry=function(a,o,l,c){return i(n(a,o,l,c))},t.fromMinimalEntry=function(a,o){return i(n(a,o))}):(t.fromAttributes=s,t.fromGraph=s,t.fromEntry=s,t.fromMinimalEntry=s),t}df.createNodeValueGetter=YH;df.createEdgeValueGetter=Gb;df.createEdgeWeightGetter=function(n){return Gb(n,WH)};var Si=0,Xn=1,gn=2,mn=3,Io=4,Mo=5,vn=6,f7=7,Bg=8,d7=9,qH=0,XH=1,jH=2,Qi=0,Ms=1,_r=2,bc=3,ml=4,ri=5,Nr=6,Da=7,Pa=8,p7=3,ta=10,KH=3,lr=9,Gv=10,$H=function(e,t,i){var r,s,a,o,l,c,u,h,f,p,m=t.length,y=i.length,v=e.adjustSizes,A=e.barnesHutTheta*e.barnesHutTheta,_,x,E,w,I,T,M,b=[];for(a=0;a<m;a+=ta)t[a+Io]=t[a+gn],t[a+Mo]=t[a+mn],t[a+gn]=0,t[a+mn]=0;if(e.outboundAttractionDistribution){for(_=0,a=0;a<m;a+=ta)_+=t[a+vn];_/=m/ta}if(e.barnesHutOptimize){var B=1/0,L=-1/0,U=1/0,O=-1/0,Q,G,F;for(a=0;a<m;a+=ta)B=Math.min(B,t[a+Si]),L=Math.max(L,t[a+Si]),U=Math.min(U,t[a+Xn]),O=Math.max(O,t[a+Xn]);var q=L-B,Y=O-U;for(q>Y?(U-=(q-Y)/2,O=U+q):(B-=(Y-q)/2,L=B+Y),b[0+Qi]=-1,b[0+Ms]=(B+L)/2,b[0+_r]=(U+O)/2,b[0+bc]=Math.max(L-B,O-U),b[0+ml]=-1,b[0+ri]=-1,b[0+Nr]=0,b[0+Da]=0,b[0+Pa]=0,r=1,a=0;a<m;a+=ta)for(s=0,F=p7;;)if(b[s+ri]>=0){t[a+Si]<b[s+Ms]?t[a+Xn]<b[s+_r]?Q=b[s+ri]:Q=b[s+ri]+lr:t[a+Xn]<b[s+_r]?Q=b[s+ri]+lr*2:Q=b[s+ri]+lr*3,b[s+Da]=(b[s+Da]*b[s+Nr]+t[a+Si]*t[a+vn])/(b[s+Nr]+t[a+vn]),b[s+Pa]=(b[s+Pa]*b[s+Nr]+t[a+Xn]*t[a+vn])/(b[s+Nr]+t[a+vn]),b[s+Nr]+=t[a+vn],s=Q;continue}else if(b[s+Qi]<0){b[s+Qi]=a;break}else{if(b[s+ri]=r*lr,h=b[s+bc]/2,f=b[s+ri],b[f+Qi]=-1,b[f+Ms]=b[s+Ms]-h,b[f+_r]=b[s+_r]-h,b[f+bc]=h,b[f+ml]=f+lr,b[f+ri]=-1,b[f+Nr]=0,b[f+Da]=0,b[f+Pa]=0,f+=lr,b[f+Qi]=-1,b[f+Ms]=b[s+Ms]-h,b[f+_r]=b[s+_r]+h,b[f+bc]=h,b[f+ml]=f+lr,b[f+ri]=-1,b[f+Nr]=0,b[f+Da]=0,b[f+Pa]=0,f+=lr,b[f+Qi]=-1,b[f+Ms]=b[s+Ms]+h,b[f+_r]=b[s+_r]-h,b[f+bc]=h,b[f+ml]=f+lr,b[f+ri]=-1,b[f+Nr]=0,b[f+Da]=0,b[f+Pa]=0,f+=lr,b[f+Qi]=-1,b[f+Ms]=b[s+Ms]+h,b[f+_r]=b[s+_r]+h,b[f+bc]=h,b[f+ml]=b[s+ml],b[f+ri]=-1,b[f+Nr]=0,b[f+Da]=0,b[f+Pa]=0,r+=4,t[b[s+Qi]+Si]<b[s+Ms]?t[b[s+Qi]+Xn]<b[s+_r]?Q=b[s+ri]:Q=b[s+ri]+lr:t[b[s+Qi]+Xn]<b[s+_r]?Q=b[s+ri]+lr*2:Q=b[s+ri]+lr*3,b[s+Nr]=t[b[s+Qi]+vn],b[s+Da]=t[b[s+Qi]+Si],b[s+Pa]=t[b[s+Qi]+Xn],b[Q+Qi]=b[s+Qi],b[s+Qi]=-1,t[a+Si]<b[s+Ms]?t[a+Xn]<b[s+_r]?G=b[s+ri]:G=b[s+ri]+lr:t[a+Xn]<b[s+_r]?G=b[s+ri]+lr*2:G=b[s+ri]+lr*3,Q===G)if(F--){s=Q;continue}else{F=p7;break}b[G+Qi]=a;break}}if(e.barnesHutOptimize)for(x=e.scalingRatio,a=0;a<m;a+=ta)for(s=0;;)if(b[s+ri]>=0)if(T=Math.pow(t[a+Si]-b[s+Da],2)+Math.pow(t[a+Xn]-b[s+Pa],2),p=b[s+bc],4*p*p/T<A){if(E=t[a+Si]-b[s+Da],w=t[a+Xn]-b[s+Pa],v===!0?T>0?(M=x*t[a+vn]*b[s+Nr]/T,t[a+gn]+=E*M,t[a+mn]+=w*M):T<0&&(M=-x*t[a+vn]*b[s+Nr]/Math.sqrt(T),t[a+gn]+=E*M,t[a+mn]+=w*M):T>0&&(M=x*t[a+vn]*b[s+Nr]/T,t[a+gn]+=E*M,t[a+mn]+=w*M),s=b[s+ml],s<0)break;continue}else{s=b[s+ri];continue}else{if(c=b[s+Qi],c>=0&&c!==a&&(E=t[a+Si]-t[c+Si],w=t[a+Xn]-t[c+Xn],T=E*E+w*w,v===!0?T>0?(M=x*t[a+vn]*t[c+vn]/T,t[a+gn]+=E*M,t[a+mn]+=w*M):T<0&&(M=-x*t[a+vn]*t[c+vn]/Math.sqrt(T),t[a+gn]+=E*M,t[a+mn]+=w*M):T>0&&(M=x*t[a+vn]*t[c+vn]/T,t[a+gn]+=E*M,t[a+mn]+=w*M)),s=b[s+ml],s<0)break;continue}else for(x=e.scalingRatio,o=0;o<m;o+=ta)for(l=0;l<o;l+=ta)E=t[o+Si]-t[l+Si],w=t[o+Xn]-t[l+Xn],v===!0?(T=Math.sqrt(E*E+w*w)-t[o+Bg]-t[l+Bg],T>0?(M=x*t[o+vn]*t[l+vn]/T/T,t[o+gn]+=E*M,t[o+mn]+=w*M,t[l+gn]-=E*M,t[l+mn]-=w*M):T<0&&(M=100*x*t[o+vn]*t[l+vn],t[o+gn]+=E*M,t[o+mn]+=w*M,t[l+gn]-=E*M,t[l+mn]-=w*M)):(T=Math.sqrt(E*E+w*w),T>0&&(M=x*t[o+vn]*t[l+vn]/T/T,t[o+gn]+=E*M,t[o+mn]+=w*M,t[l+gn]-=E*M,t[l+mn]-=w*M));for(f=e.gravity/e.scalingRatio,x=e.scalingRatio,a=0;a<m;a+=ta)M=0,E=t[a+Si],w=t[a+Xn],T=Math.sqrt(Math.pow(E,2)+Math.pow(w,2)),e.strongGravityMode?T>0&&(M=x*t[a+vn]*f):T>0&&(M=x*t[a+vn]*f/T),t[a+gn]-=E*M,t[a+mn]-=w*M;for(x=1*(e.outboundAttractionDistribution?_:1),u=0;u<y;u+=KH)o=i[u+qH],l=i[u+XH],h=i[u+jH],I=Math.pow(h,e.edgeWeightInfluence),E=t[o+Si]-t[l+Si],w=t[o+Xn]-t[l+Xn],v===!0?(T=Math.sqrt(E*E+w*w)-t[o+Bg]-t[l+Bg],e.linLogMode?e.outboundAttractionDistribution?T>0&&(M=-x*I*Math.log(1+T)/T/t[o+vn]):T>0&&(M=-x*I*Math.log(1+T)/T):e.outboundAttractionDistribution?T>0&&(M=-x*I/t[o+vn]):T>0&&(M=-x*I)):(T=Math.sqrt(Math.pow(E,2)+Math.pow(w,2)),e.linLogMode?e.outboundAttractionDistribution?T>0&&(M=-x*I*Math.log(1+T)/T/t[o+vn]):T>0&&(M=-x*I*Math.log(1+T)/T):e.outboundAttractionDistribution?(T=1,M=-x*I/t[o+vn]):(T=1,M=-x*I)),T>0&&(t[o+gn]+=E*M,t[o+mn]+=w*M,t[l+gn]-=E*M,t[l+mn]-=w*M);var H,V,D,k,Z,j;if(v===!0)for(a=0;a<m;a+=ta)t[a+d7]!==1&&(H=Math.sqrt(Math.pow(t[a+gn],2)+Math.pow(t[a+mn],2)),H>Gv&&(t[a+gn]=t[a+gn]*Gv/H,t[a+mn]=t[a+mn]*Gv/H),V=t[a+vn]*Math.sqrt((t[a+Io]-t[a+gn])*(t[a+Io]-t[a+gn])+(t[a+Mo]-t[a+mn])*(t[a+Mo]-t[a+mn])),D=Math.sqrt((t[a+Io]+t[a+gn])*(t[a+Io]+t[a+gn])+(t[a+Mo]+t[a+mn])*(t[a+Mo]+t[a+mn]))/2,k=.1*Math.log(1+D)/(1+Math.sqrt(V)),Z=t[a+Si]+t[a+gn]*(k/e.slowDown),t[a+Si]=Z,j=t[a+Xn]+t[a+mn]*(k/e.slowDown),t[a+Xn]=j);else for(a=0;a<m;a+=ta)t[a+d7]!==1&&(V=t[a+vn]*Math.sqrt((t[a+Io]-t[a+gn])*(t[a+Io]-t[a+gn])+(t[a+Mo]-t[a+mn])*(t[a+Mo]-t[a+mn])),D=Math.sqrt((t[a+Io]+t[a+gn])*(t[a+Io]+t[a+gn])+(t[a+Mo]+t[a+mn])*(t[a+Mo]+t[a+mn]))/2,k=t[a+f7]*Math.log(1+D)/(1+Math.sqrt(V)),t[a+f7]=Math.min(1,Math.sqrt(k*(Math.pow(t[a+gn],2)+Math.pow(t[a+mn],2))/(1+Math.sqrt(V)))),Z=t[a+Si]+t[a+gn]*(k/e.slowDown),t[a+Si]=Z,j=t[a+Xn]+t[a+mn]*(k/e.slowDown),t[a+Xn]=j);return{}},$l={},zp=10,g7=3;$l.assign=function(n){n=n||{};var e=Array.prototype.slice.call(arguments).slice(1),t,i,r;for(t=0,r=e.length;t<r;t++)if(e[t])for(i in e[t])n[i]=e[t][i];return n};$l.validateSettings=function(n){return"linLogMode"in n&&typeof n.linLogMode!="boolean"?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in n&&typeof n.outboundAttractionDistribution!="boolean"?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in n&&typeof n.adjustSizes!="boolean"?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in n&&typeof n.edgeWeightInfluence!="number"?{message:"the `edgeWeightInfluence` setting should be a number."}:"scalingRatio"in n&&!(typeof n.scalingRatio=="number"&&n.scalingRatio>=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in n&&typeof n.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in n&&!(typeof n.gravity=="number"&&n.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in n&&!(typeof n.slowDown=="number"||n.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in n&&typeof n.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in n&&!(typeof n.barnesHutTheta=="number"&&n.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null};$l.graphToByteArrays=function(n,e){var t=n.order,i=n.size,r={},s,a=new Float32Array(t*zp),o=new Float32Array(i*g7);return s=0,n.forEachNode(function(l,c){r[l]=s,a[s]=c.x,a[s+1]=c.y,a[s+2]=0,a[s+3]=0,a[s+4]=0,a[s+5]=0,a[s+6]=1,a[s+7]=1,a[s+8]=c.size||1,a[s+9]=c.fixed?1:0,s+=zp}),s=0,n.forEachEdge(function(l,c,u,h,f,p,m){var y=r[u],v=r[h],A=e(l,c,u,h,f,p,m);a[y+6]+=A,a[v+6]+=A,o[s]=y,o[s+1]=v,o[s+2]=A,s+=g7}),{nodes:a,edges:o}};$l.assignLayoutChanges=function(n,e,t){var i=0;n.updateEachNodeAttributes(function(r,s){return s.x=e[i],s.y=e[i+1],i+=zp,t?t(r,s):s})};$l.readGraphPositions=function(n,e){var t=0;n.forEachNode(function(i,r){e[t]=r.x,e[t+1]=r.y,t+=zp})};$l.collectLayoutChanges=function(n,e,t){for(var i=n.nodes(),r={},s=0,a=0,o=e.length;s<o;s+=zp){if(t){var l=Object.assign({},n.getNodeAttributes(i[a]));l.x=e[s],l.y=e[s+1],l=t(i[a],l),r[i[a]]={x:l.x,y:l.y}}else r[i[a]]={x:e[s],y:e[s+1]};a++}return r};$l.createWorker=function(e){var t=window.URL||window.webkitURL,i=e.toString(),r=t.createObjectURL(new Blob(["("+i+").call(this);"],{type:"text/javascript"})),s=new Worker(r);return t.revokeObjectURL(r),s};var JH={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5},ZH=Kl,eV=df.createEdgeWeightGetter,tV=$H,hd=$l,nV=JH;function zb(n,e,t){if(!ZH(e))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");typeof t=="number"&&(t={iterations:t});var i=t.iterations;if(typeof i!="number")throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(i<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var r=eV("getEdgeWeight"in t?t.getEdgeWeight:"weight").fromEntry,s=typeof t.outputReducer=="function"?t.outputReducer:null,a=hd.assign({},nV,t.settings),o=hd.validateSettings(a);if(o)throw new Error("graphology-layout-forceatlas2: "+o.message);var l=hd.graphToByteArrays(e,r),c;for(c=0;c<i;c++)tV(a,l.nodes,l.edges);if(n){hd.assignLayoutChanges(e,l.nodes,s);return}return hd.collectLayoutChanges(e,l.nodes)}function iV(n){var e=typeof n=="number"?n:n.order;return{barnesHutOptimize:e>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(e)}}var p4=zb.bind(null,!1);p4.assign=zb.bind(null,!0);p4.inferSettings=iV;var rV=p4;const sV=ps(rV);var aV=d4,oV=Kl,lV={dimensions:["x","y"],center:.5,rng:Math.random,scale:1};function Qb(n,e,t){if(!oV(e))throw new Error("graphology-layout/random: the given graph is not a valid graphology instance.");t=aV(t,lV);var i=t.dimensions;if(!Array.isArray(i)||i.length<1)throw new Error("graphology-layout/random: given dimensions are invalid.");var r=i.length,s=t.center,a=t.rng,o=t.scale,l=(s-.5)*o;function c(h){for(var f=0;f<r;f++)h[i[f]]=a()*o+l;return h}if(!n){var u={};return e.forEachNode(function(h){u[h]=c({})}),u}e.updateEachNodeAttributes(function(h,f){return c(f),f},{attributes:i})}var Hb=Qb.bind(null,!1);Hb.assign=Qb.bind(null,!0);var cV=Hb;const uV=ps(cV);var g4={},m4={};(function(n){var e=Math.pow(2,8)-1,t=Math.pow(2,16)-1,i=Math.pow(2,32)-1,r=Math.pow(2,7)-1,s=Math.pow(2,15)-1,a=Math.pow(2,31)-1;n.getPointerArray=function(l){var c=l-1;if(c<=e)return Uint8Array;if(c<=t)return Uint16Array;if(c<=i)return Uint32Array;throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")},n.getSignedPointerArray=function(l){var c=l-1;return c<=r?Int8Array:c<=s?Int16Array:c<=a?Int32Array:Float64Array},n.getNumberType=function(l){return l===(l|0)?Math.sign(l)===-1?l<=127&&l>=-128?Int8Array:l<=32767&&l>=-32768?Int16Array:Int32Array:l<=255?Uint8Array:l<=65535?Uint16Array:Uint32Array:Float64Array};var o={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};n.getMinimalRepresentation=function(l,c){var u=null,h=0,f,p,m,y,v;for(y=0,v=l.length;y<v;y++)m=c?c(l[y]):l[y],p=n.getNumberType(m),f=o[p.name],f>h&&(h=f,u=p);return u},n.isTypedArray=function(l){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(l)},n.concat=function(){var l=0,c,u,h;for(c=0,h=arguments.length;c<h;c++)l+=arguments[c].length;var f=new arguments[0].constructor(l);for(c=0,u=0;c<h;c++)f.set(arguments[c],u),u+=arguments[c].length;return f},n.indices=function(l){for(var c=n.getPointerArray(l),u=new c(l),h=0;h<l;h++)u[h]=h;return u}})(m4);var km=m4,hV=df.createEdgeWeightGetter;function Vb(n,e){return n==="outbound"||n==="inbound"?e.directedSize+e.undirectedSize*2:n==="in"||n==="out"||n==="directed"?e.directedSize:e.undirectedSize*2}function jo(n,e){e=e||"outbound";var t=n[e+"Neighbors"].bind(n),i=Vb(e,n),r=km.getPointerArray(i),s=km.getPointerArray(n.order);this.graph=n,this.neighborhood=new s(i),this.starts=new r(n.order+1),this.nodes=n.nodes();var a={},o,l,c,u,h,f,p=0;for(o=0,l=n.order;o<l;o++)a[this.nodes[o]]=o;for(o=0,l=n.order;o<l;o++)for(h=this.nodes[o],f=t(h),this.starts[o]=p,c=0,u=f.length;c<u;c++)this.neighborhood[p++]=a[f[c]];this.starts[o]=i}jo.prototype.bounds=function(n){return[this.starts[n],this.starts[n+1]]};jo.prototype.project=function(){var n=this,e={};return n.nodes.forEach(function(t,i){e[t]=Array.from(n.neighborhood.slice(n.starts[i],n.starts[i+1])).map(function(r){return n.nodes[r]})}),e};jo.prototype.collect=function(n){var e,t,i={};for(e=0,t=n.length;e<t;e++)i[this.nodes[e]]=n[e];return i};jo.prototype.assign=function(n,e){var t=0;this.graph.updateEachNodeAttributes(function(i,r){return r[n]=e[t++],r},{attributes:[n]})};g4.NeighborhoodIndex=jo;function A0(n,e,t){t=t||"outbound";var i=n[t+"Edges"].bind(n),r=Vb(t,n),s=km.getPointerArray(r),a=km.getPointerArray(n.order),o=hV(e).fromMinimalEntry;this.graph=n,this.neighborhood=new a(r),this.weights=new Float64Array(r),this.outDegrees=new Float64Array(n.order),this.starts=new s(n.order+1),this.nodes=n.nodes();var l={},c,u,h,f,p,m,y,v,A,_=0;for(c=0,u=n.order;c<u;c++)l[this.nodes[c]]=c;for(c=0,u=n.order;c<u;c++)for(p=this.nodes[c],y=i(p),this.starts[c]=_,h=0,f=y.length;h<f;h++)v=y[h],m=n.opposite(p,v),A=o(v,n.getEdgeAttributes(v)),this.neighborhood[_]=l[m],this.weights[_++]=A,this.outDegrees[c]+=A;this.starts[c]=r}A0.prototype.bounds=jo.prototype.bounds;A0.prototype.project=jo.prototype.project;A0.prototype.collect=jo.prototype.collect;A0.prototype.assign=jo.prototype.assign;g4.WeightedNeighborhoodIndex=A0;var fV=Kl,dV=d4,pV=g4.WeightedNeighborhoodIndex,gV={nodePagerankAttribute:"pagerank",getEdgeWeight:"weight",alpha:.85,maxIterations:100,tolerance:1e-6};function Wb(n,e,t){if(!fV(e))throw new Error("graphology-metrics/centrality/pagerank: the given graph is not a valid graphology instance.");t=dV(t,gV);var i=t.alpha,r=t.maxIterations,s=t.tolerance,a=t.nodePagerankAttribute,o=e.order,l=1/o,c=new pV(e,t.getEdgeWeight),u,h,f,p,m=new Float64Array(e.order),y=new Float64Array(c.weights.length),v=[];for(u=0;u<o;u++)for(m[u]=l,f=c.starts[u+1],p=c.outDegrees[u],p===0&&v.push(u),h=c.starts[u];h<f;h++)y[h]=c.weights[h]/p;for(var A=0,_=0,x,E,w,I=!1;A<r;){for(w=m,m=new Float64Array(e.order),x=0,u=0,f=v.length;u<f;u++)x+=w[v[u]];for(x*=i,u=0;u<o;u++){for(f=c.starts[u+1],h=c.starts[u];h<f;h++)E=c.neighborhood[h],m[E]+=i*w[u]*y[h];m[u]+=x*l+(1-i)*l}for(_=0,u=0;u<o;u++)_+=Math.abs(m[u]-w[u]);if(_<o*s){I=!0;break}A++}if(!I)throw Error("graphology-metrics/centrality/pagerank: failed to converge.");if(n){c.assign(a,m);return}return c.collect(m)}var Yb=Wb.bind(null,!1);Yb.assign=Wb.bind(null,!0);var mV=Yb;const AV=ps(mV);var vV=Kl;function pf(n,e,t,i){var r=e+"Centrality";if(!vV(t))throw new Error("graphology-centrality/"+r+": the given graph is not a valid graphology instance.");if(e!=="degree"&&t.type==="undirected")throw new Error("graphology-centrality/"+r+": cannot compute "+e+" centrality on an undirected graph.");i=i||{};var s=i.nodeCentralityAttribute||r,a=t.order-1,o=t[e].bind(t);if(n){t.updateEachNodeAttributes(function(c,u){return u[s]=o(c)/a,u},{attributes:[s]});return}var l={};return t.forEachNode(function(c){l[c]=o(c)/a}),l}var qb=pf.bind(null,!1,"degree"),yV=pf.bind(null,!1,"inDegree"),xV=pf.bind(null,!1,"outDegree");qb.assign=pf.bind(null,!0,"degree");yV.assign=pf.bind(null,!0,"inDegree");xV.assign=pf.bind(null,!0,"outDegree");var _V=qb;function mm(n,e){return n==null||e==null?NaN:n<e?-1:n>e?1:n>=e?0:NaN}function EV(n,e){return n==null||e==null?NaN:e<n?-1:e>n?1:e>=n?0:NaN}function Xb(n){let e,t,i;n.length!==2?(e=mm,t=(o,l)=>mm(n(o),l),i=(o,l)=>n(o)-l):(e=n===mm||n===EV?n:SV,t=n,i=n);function r(o,l,c=0,u=o.length){if(c<u){if(e(l,l)!==0)return u;do{const h=c+u>>>1;t(o[h],l)<0?c=h+1:u=h}while(c<u)}return c}function s(o,l,c=0,u=o.length){if(c<u){if(e(l,l)!==0)return u;do{const h=c+u>>>1;t(o[h],l)<=0?c=h+1:u=h}while(c<u)}return c}function a(o,l,c=0,u=o.length){const h=r(o,l,c,u-1);return h>c&&i(o[h-1],l)>-i(o[h],l)?h-1:h}return{left:r,center:a,right:s}}function SV(){return 0}function wV(n){return n===null?NaN:+n}const CV=Xb(mm),TV=CV.right;Xb(wV).center;const bV=TV,IV=Math.sqrt(50),MV=Math.sqrt(10),RV=Math.sqrt(2);function Nm(n,e,t){const i=(e-n)/Math.max(0,t),r=Math.floor(Math.log10(i)),s=i/Math.pow(10,r),a=s>=IV?10:s>=MV?5:s>=RV?2:1;let o,l,c;return r<0?(c=Math.pow(10,-r)/a,o=Math.round(n*c),l=Math.round(e*c),o/c<n&&++o,l/c>e&&--l,c=-c):(c=Math.pow(10,r)*a,o=Math.round(n/c),l=Math.round(e/c),o*c<n&&++o,l*c>e&&--l),l<o&&.5<=t&&t<2?Nm(n,e,t*2):[o,l,c]}function BV(n,e,t){if(e=+e,n=+n,t=+t,!(t>0))return[];if(n===e)return[n];const i=e<n,[r,s,a]=i?Nm(e,n,t):Nm(n,e,t);if(!(s>=r))return[];const o=s-r+1,l=new Array(o);if(i)if(a<0)for(let c=0;c<o;++c)l[c]=(s-c)/-a;else for(let c=0;c<o;++c)l[c]=(s-c)*a;else if(a<0)for(let c=0;c<o;++c)l[c]=(r+c)/-a;else for(let c=0;c<o;++c)l[c]=(r+c)*a;return l}function Ey(n,e,t){return e=+e,n=+n,t=+t,Nm(n,e,t)[2]}function DV(n,e,t){e=+e,n=+n,t=+t;const i=e<n,r=i?Ey(e,n,t):Ey(n,e,t);return(i?-1:1)*(r<0?1/-r:r)}function PV(n,e){switch(arguments.length){case 0:break;case 1:this.range(n);break;default:this.range(e).domain(n);break}return this}function A4(n,e,t){n.prototype=e.prototype=t,t.constructor=n}function jb(n,e){var t=Object.create(n.prototype);for(var i in e)t[i]=e[i];return t}function v0(){}var Qp=.7,Gm=1/Qp,Fh="\\s*([+-]?\\d+)\\s*",Hp="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ya="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",LV=/^#([0-9a-f]{3,8})$/,UV=new RegExp(`^rgb\\(${Fh},${Fh},${Fh}\\)$`),OV=new RegExp(`^rgb\\(${Ya},${Ya},${Ya}\\)$`),FV=new RegExp(`^rgba\\(${Fh},${Fh},${Fh},${Hp}\\)$`),kV=new RegExp(`^rgba\\(${Ya},${Ya},${Ya},${Hp}\\)$`),NV=new RegExp(`^hsl\\(${Hp},${Ya},${Ya}\\)$`),GV=new RegExp(`^hsla\\(${Hp},${Ya},${Ya},${Hp}\\)$`),m7={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};A4(v0,Vp,{copy(n){return Object.assign(new this.constructor,this,n)},displayable(){return this.rgb().displayable()},hex:A7,formatHex:A7,formatHex8:zV,formatHsl:QV,formatRgb:v7,toString:v7});function A7(){return this.rgb().formatHex()}function zV(){return this.rgb().formatHex8()}function QV(){return Kb(this).formatHsl()}function v7(){return this.rgb().formatRgb()}function Vp(n){var e,t;return n=(n+"").trim().toLowerCase(),(e=LV.exec(n))?(t=e[1].length,e=parseInt(e[1],16),t===6?y7(e):t===3?new Hr(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?Dg(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?Dg(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=UV.exec(n))?new Hr(e[1],e[2],e[3],1):(e=OV.exec(n))?new Hr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=FV.exec(n))?Dg(e[1],e[2],e[3],e[4]):(e=kV.exec(n))?Dg(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=NV.exec(n))?E7(e[1],e[2]/100,e[3]/100,1):(e=GV.exec(n))?E7(e[1],e[2]/100,e[3]/100,e[4]):m7.hasOwnProperty(n)?y7(m7[n]):n==="transparent"?new Hr(NaN,NaN,NaN,0):null}function y7(n){return new Hr(n>>16&255,n>>8&255,n&255,1)}function Dg(n,e,t,i){return i<=0&&(n=e=t=NaN),new Hr(n,e,t,i)}function HV(n){return n instanceof v0||(n=Vp(n)),n?(n=n.rgb(),new Hr(n.r,n.g,n.b,n.opacity)):new Hr}function Sy(n,e,t,i){return arguments.length===1?HV(n):new Hr(n,e,t,i??1)}function Hr(n,e,t,i){this.r=+n,this.g=+e,this.b=+t,this.opacity=+i}A4(Hr,Sy,jb(v0,{brighter(n){return n=n==null?Gm:Math.pow(Gm,n),new Hr(this.r*n,this.g*n,this.b*n,this.opacity)},darker(n){return n=n==null?Qp:Math.pow(Qp,n),new Hr(this.r*n,this.g*n,this.b*n,this.opacity)},rgb(){return this},clamp(){return new Hr(Jc(this.r),Jc(this.g),Jc(this.b),zm(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:x7,formatHex:x7,formatHex8:VV,formatRgb:_7,toString:_7}));function x7(){return`#${qc(this.r)}${qc(this.g)}${qc(this.b)}`}function VV(){return`#${qc(this.r)}${qc(this.g)}${qc(this.b)}${qc((isNaN(this.opacity)?1:this.opacity)*255)}`}function _7(){const n=zm(this.opacity);return`${n===1?"rgb(":"rgba("}${Jc(this.r)}, ${Jc(this.g)}, ${Jc(this.b)}${n===1?")":`, ${n})`}`}function zm(n){return isNaN(n)?1:Math.max(0,Math.min(1,n))}function Jc(n){return Math.max(0,Math.min(255,Math.round(n)||0))}function qc(n){return n=Jc(n),(n<16?"0":"")+n.toString(16)}function E7(n,e,t,i){return i<=0?n=e=t=NaN:t<=0||t>=1?n=e=NaN:e<=0&&(n=NaN),new la(n,e,t,i)}function Kb(n){if(n instanceof la)return new la(n.h,n.s,n.l,n.opacity);if(n instanceof v0||(n=Vp(n)),!n)return new la;if(n instanceof la)return n;n=n.rgb();var e=n.r/255,t=n.g/255,i=n.b/255,r=Math.min(e,t,i),s=Math.max(e,t,i),a=NaN,o=s-r,l=(s+r)/2;return o?(e===s?a=(t-i)/o+(t<i)*6:t===s?a=(i-e)/o+2:a=(e-t)/o+4,o/=l<.5?s+r:2-s-r,a*=60):o=l>0&&l<1?0:a,new la(a,o,l,n.opacity)}function WV(n,e,t,i){return arguments.length===1?Kb(n):new la(n,e,t,i??1)}function la(n,e,t,i){this.h=+n,this.s=+e,this.l=+t,this.opacity=+i}A4(la,WV,jb(v0,{brighter(n){return n=n==null?Gm:Math.pow(Gm,n),new la(this.h,this.s,this.l*n,this.opacity)},darker(n){return n=n==null?Qp:Math.pow(Qp,n),new la(this.h,this.s,this.l*n,this.opacity)},rgb(){var n=this.h%360+(this.h<0)*360,e=isNaN(n)||isNaN(this.s)?0:this.s,t=this.l,i=t+(t<.5?t:1-t)*e,r=2*t-i;return new Hr(zv(n>=240?n-240:n+120,r,i),zv(n,r,i),zv(n<120?n+240:n-120,r,i),this.opacity)},clamp(){return new la(S7(this.h),Pg(this.s),Pg(this.l),zm(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const n=zm(this.opacity);return`${n===1?"hsl(":"hsla("}${S7(this.h)}, ${Pg(this.s)*100}%, ${Pg(this.l)*100}%${n===1?")":`, ${n})`}`}}));function S7(n){return n=(n||0)%360,n<0?n+360:n}function Pg(n){return Math.max(0,Math.min(1,n||0))}function zv(n,e,t){return(n<60?e+(t-e)*n/60:n<180?t:n<240?e+(t-e)*(240-n)/60:e)*255}const v4=n=>()=>n;function YV(n,e){return function(t){return n+t*e}}function qV(n,e,t){return n=Math.pow(n,t),e=Math.pow(e,t)-n,t=1/t,function(i){return Math.pow(n+i*e,t)}}function XV(n){return(n=+n)==1?$b:function(e,t){return t-e?qV(e,t,n):v4(isNaN(e)?t:e)}}function $b(n,e){var t=e-n;return t?YV(n,t):v4(isNaN(n)?e:n)}const w7=function n(e){var t=XV(e);function i(r,s){var a=t((r=Sy(r)).r,(s=Sy(s)).r),o=t(r.g,s.g),l=t(r.b,s.b),c=$b(r.opacity,s.opacity);return function(u){return r.r=a(u),r.g=o(u),r.b=l(u),r.opacity=c(u),r+""}}return i.gamma=n,i}(1);function jV(n,e){e||(e=[]);var t=n?Math.min(e.length,n.length):0,i=e.slice(),r;return function(s){for(r=0;r<t;++r)i[r]=n[r]*(1-s)+e[r]*s;return i}}function KV(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function $V(n,e){var t=e?e.length:0,i=n?Math.min(t,n.length):0,r=new Array(i),s=new Array(t),a;for(a=0;a<i;++a)r[a]=y4(n[a],e[a]);for(;a<t;++a)s[a]=e[a];return function(o){for(a=0;a<i;++a)s[a]=r[a](o);return s}}function JV(n,e){var t=new Date;return n=+n,e=+e,function(i){return t.setTime(n*(1-i)+e*i),t}}function Qm(n,e){return n=+n,e=+e,function(t){return n*(1-t)+e*t}}function ZV(n,e){var t={},i={},r;(n===null||typeof n!="object")&&(n={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in n?t[r]=y4(n[r],e[r]):i[r]=e[r];return function(s){for(r in t)i[r]=t[r](s);return i}}var wy=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Qv=new RegExp(wy.source,"g");function eW(n){return function(){return n}}function tW(n){return function(e){return n(e)+""}}function nW(n,e){var t=wy.lastIndex=Qv.lastIndex=0,i,r,s,a=-1,o=[],l=[];for(n=n+"",e=e+"";(i=wy.exec(n))&&(r=Qv.exec(e));)(s=r.index)>t&&(s=e.slice(t,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(r=r[0])?o[a]?o[a]+=r:o[++a]=r:(o[++a]=null,l.push({i:a,x:Qm(i,r)})),t=Qv.lastIndex;return t<e.length&&(s=e.slice(t),o[a]?o[a]+=s:o[++a]=s),o.length<2?l[0]?tW(l[0].x):eW(e):(e=l.length,function(c){for(var u=0,h;u<e;++u)o[(h=l[u]).i]=h.x(c);return o.join("")})}function y4(n,e){var t=typeof e,i;return e==null||t==="boolean"?v4(e):(t==="number"?Qm:t==="string"?(i=Vp(e))?(e=i,w7):nW:e instanceof Vp?w7:e instanceof Date?JV:KV(e)?jV:Array.isArray(e)?$V:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?ZV:Qm)(n,e)}function iW(n,e){return n=+n,e=+e,function(t){return Math.round(n*(1-t)+e*t)}}function rW(n){return function(){return n}}function sW(n){return+n}var C7=[0,1];function Rh(n){return n}function Cy(n,e){return(e-=n=+n)?function(t){return(t-n)/e}:rW(isNaN(e)?NaN:.5)}function aW(n,e){var t;return n>e&&(t=n,n=e,e=t),function(i){return Math.max(n,Math.min(e,i))}}function oW(n,e,t){var i=n[0],r=n[1],s=e[0],a=e[1];return r<i?(i=Cy(r,i),s=t(a,s)):(i=Cy(i,r),s=t(s,a)),function(o){return s(i(o))}}function lW(n,e,t){var i=Math.min(n.length,e.length)-1,r=new Array(i),s=new Array(i),a=-1;for(n[i]<n[0]&&(n=n.slice().reverse(),e=e.slice().reverse());++a<i;)r[a]=Cy(n[a],n[a+1]),s[a]=t(e[a],e[a+1]);return function(o){var l=bV(n,o,1,i)-1;return s[l](r[l](o))}}function cW(n,e){return e.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown())}function uW(){var n=C7,e=C7,t=y4,i,r,s,a=Rh,o,l,c;function u(){var f=Math.min(n.length,e.length);return a!==Rh&&(a=aW(n[0],n[f-1])),o=f>2?lW:oW,l=c=null,h}function h(f){return f==null||isNaN(f=+f)?s:(l||(l=o(n.map(i),e,t)))(i(a(f)))}return h.invert=function(f){return a(r((c||(c=o(e,n.map(i),Qm)))(f)))},h.domain=function(f){return arguments.length?(n=Array.from(f,sW),u()):n.slice()},h.range=function(f){return arguments.length?(e=Array.from(f),u()):e.slice()},h.rangeRound=function(f){return e=Array.from(f),t=iW,u()},h.clamp=function(f){return arguments.length?(a=f?!0:Rh,u()):a!==Rh},h.interpolate=function(f){return arguments.length?(t=f,u()):t},h.unknown=function(f){return arguments.length?(s=f,h):s},function(f,p){return i=f,r=p,u()}}function hW(){return uW()(Rh,Rh)}function fW(n){return Math.abs(n=Math.round(n))>=1e21?n.toLocaleString("en").replace(/,/g,""):n.toString(10)}function Hm(n,e){if((t=(n=e?n.toExponential(e-1):n.toExponential()).indexOf("e"))<0)return null;var t,i=n.slice(0,t);return[i.length>1?i[0]+i.slice(2):i,+n.slice(t+1)]}function jh(n){return n=Hm(Math.abs(n)),n?n[1]:NaN}function dW(n,e){return function(t,i){for(var r=t.length,s=[],a=0,o=n[0],l=0;r>0&&o>0&&(l+o+1>i&&(o=Math.max(1,i-l)),s.push(t.substring(r-=o,r+o)),!((l+=o+1)>i));)o=n[a=(a+1)%n.length];return s.reverse().join(e)}}function pW(n){return function(e){return e.replace(/[0-9]/g,function(t){return n[+t]})}}var gW=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Vm(n){if(!(e=gW.exec(n)))throw new Error("invalid format: "+n);var e;return new x4({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Vm.prototype=x4.prototype;function x4(n){this.fill=n.fill===void 0?" ":n.fill+"",this.align=n.align===void 0?">":n.align+"",this.sign=n.sign===void 0?"-":n.sign+"",this.symbol=n.symbol===void 0?"":n.symbol+"",this.zero=!!n.zero,this.width=n.width===void 0?void 0:+n.width,this.comma=!!n.comma,this.precision=n.precision===void 0?void 0:+n.precision,this.trim=!!n.trim,this.type=n.type===void 0?"":n.type+""}x4.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function mW(n){e:for(var e=n.length,t=1,i=-1,r;t<e;++t)switch(n[t]){case".":i=r=t;break;case"0":i===0&&(i=t),r=t;break;default:if(!+n[t])break e;i>0&&(i=0);break}return i>0?n.slice(0,i)+n.slice(r+1):n}var Jb;function AW(n,e){var t=Hm(n,e);if(!t)return n+"";var i=t[0],r=t[1],s=r-(Jb=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,a=i.length;return s===a?i:s>a?i+new Array(s-a+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+Hm(n,Math.max(0,e+s-1))[0]}function T7(n,e){var t=Hm(n,e);if(!t)return n+"";var i=t[0],r=t[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}const b7={"%":(n,e)=>(n*100).toFixed(e),b:n=>Math.round(n).toString(2),c:n=>n+"",d:fW,e:(n,e)=>n.toExponential(e),f:(n,e)=>n.toFixed(e),g:(n,e)=>n.toPrecision(e),o:n=>Math.round(n).toString(8),p:(n,e)=>T7(n*100,e),r:T7,s:AW,X:n=>Math.round(n).toString(16).toUpperCase(),x:n=>Math.round(n).toString(16)};function I7(n){return n}var M7=Array.prototype.map,R7=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function vW(n){var e=n.grouping===void 0||n.thousands===void 0?I7:dW(M7.call(n.grouping,Number),n.thousands+""),t=n.currency===void 0?"":n.currency[0]+"",i=n.currency===void 0?"":n.currency[1]+"",r=n.decimal===void 0?".":n.decimal+"",s=n.numerals===void 0?I7:pW(M7.call(n.numerals,String)),a=n.percent===void 0?"%":n.percent+"",o=n.minus===void 0?"":n.minus+"",l=n.nan===void 0?"NaN":n.nan+"";function c(h){h=Vm(h);var f=h.fill,p=h.align,m=h.sign,y=h.symbol,v=h.zero,A=h.width,_=h.comma,x=h.precision,E=h.trim,w=h.type;w==="n"?(_=!0,w="g"):b7[w]||(x===void 0&&(x=12),E=!0,w="g"),(v||f==="0"&&p==="=")&&(v=!0,f="0",p="=");var I=y==="$"?t:y==="#"&&/[boxX]/.test(w)?"0"+w.toLowerCase():"",T=y==="$"?i:/[%p]/.test(w)?a:"",M=b7[w],b=/[defgprs%]/.test(w);x=x===void 0?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x));function B(L){var U=I,O=T,Q,G,F;if(w==="c")O=M(L)+O,L="";else{L=+L;var q=L<0||1/L<0;if(L=isNaN(L)?l:M(Math.abs(L),x),E&&(L=mW(L)),q&&+L==0&&m!=="+"&&(q=!1),U=(q?m==="("?m:o:m==="-"||m==="("?"":m)+U,O=(w==="s"?R7[8+Jb/3]:"")+O+(q&&m==="("?")":""),b){for(Q=-1,G=L.length;++Q<G;)if(F=L.charCodeAt(Q),48>F||F>57){O=(F===46?r+L.slice(Q+1):L.slice(Q))+O,L=L.slice(0,Q);break}}}_&&!v&&(L=e(L,1/0));var Y=U.length+L.length+O.length,H=Y<A?new Array(A-Y+1).join(f):"";switch(_&&v&&(L=e(H+L,H.length?A-O.length:1/0),H=""),p){case"<":L=U+L+O+H;break;case"=":L=U+H+L+O;break;case"^":L=H.slice(0,Y=H.length>>1)+U+L+O+H.slice(Y);break;default:L=H+U+L+O;break}return s(L)}return B.toString=function(){return h+""},B}function u(h,f){var p=c((h=Vm(h),h.type="f",h)),m=Math.max(-8,Math.min(8,Math.floor(jh(f)/3)))*3,y=Math.pow(10,-m),v=R7[8+m/3];return function(A){return p(y*A)+v}}return{format:c,formatPrefix:u}}var Lg,Zb,eI;yW({thousands:",",grouping:[3],currency:["$",""]});function yW(n){return Lg=vW(n),Zb=Lg.format,eI=Lg.formatPrefix,Lg}function xW(n){return Math.max(0,-jh(Math.abs(n)))}function _W(n,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(jh(e)/3)))*3-jh(Math.abs(n)))}function EW(n,e){return n=Math.abs(n),e=Math.abs(e)-n,Math.max(0,jh(e)-jh(n))+1}function SW(n,e,t,i){var r=DV(n,e,t),s;switch(i=Vm(i??",f"),i.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(e));return i.precision==null&&!isNaN(s=_W(r,a))&&(i.precision=s),eI(i,a)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(s=EW(r,Math.max(Math.abs(n),Math.abs(e))))&&(i.precision=s-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(s=xW(r))&&(i.precision=s-(i.type==="%")*2);break}}return Zb(i)}function wW(n){var e=n.domain;return n.ticks=function(t){var i=e();return BV(i[0],i[i.length-1],t??10)},n.tickFormat=function(t,i){var r=e();return SW(r[0],r[r.length-1],t??10,i)},n.nice=function(t){t==null&&(t=10);var i=e(),r=0,s=i.length-1,a=i[r],o=i[s],l,c,u=10;for(o<a&&(c=a,a=o,o=c,c=r,r=s,s=c);u-- >0;){if(c=Ey(a,o,t),c===l)return i[r]=a,i[s]=o,e(i);if(c>0)a=Math.floor(a/c)*c,o=Math.ceil(o/c)*c;else if(c<0)a=Math.ceil(a*c)/c,o=Math.floor(o*c)/c;else break;l=c}return n},n}function tI(){var n=hW();return n.copy=function(){return cW(n,tI())},PV.apply(n,arguments),wW(n)}const B7=n=>{let e;const t=new Set,i=(l,c)=>{const u=typeof l=="function"?l(e):l;if(!Object.is(u,e)){const h=e;e=c??typeof u!="object"?u:Object.assign({},e,u),t.forEach(f=>f(e,h))}},r=()=>e,o={setState:i,getState:r,subscribe:l=>(t.add(l),()=>t.delete(l)),destroy:()=>{t.clear()}};return e=n(i,r,o),o},CW=n=>n?B7(n):B7;var nI={exports:{}},iI={},rI={exports:{}},sI={};/**
* @license React
* use-sync-external-store-shim.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Kh=$;function TW(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var bW=typeof Object.is=="function"?Object.is:TW,IW=Kh.useState,MW=Kh.useEffect,RW=Kh.useLayoutEffect,BW=Kh.useDebugValue;function DW(n,e){var t=e(),i=IW({inst:{value:t,getSnapshot:e}}),r=i[0].inst,s=i[1];return RW(function(){r.value=t,r.getSnapshot=e,Hv(r)&&s({inst:r})},[n,t,e]),MW(function(){return Hv(r)&&s({inst:r}),n(function(){Hv(r)&&s({inst:r})})},[n]),BW(t),t}function Hv(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!bW(n,t)}catch{return!0}}function PW(n,e){return e()}var LW=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?PW:DW;sI.useSyncExternalStore=Kh.useSyncExternalStore!==void 0?Kh.useSyncExternalStore:LW;rI.exports=sI;var UW=rI.exports;/**
* @license React
* use-sync-external-store-shim/with-selector.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var c1=$,OW=UW;function FW(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var kW=typeof Object.is=="function"?Object.is:FW,NW=OW.useSyncExternalStore,GW=c1.useRef,zW=c1.useEffect,QW=c1.useMemo,HW=c1.useDebugValue;iI.useSyncExternalStoreWithSelector=function(n,e,t,i,r){var s=GW(null);if(s.current===null){var a={hasValue:!1,value:null};s.current=a}else a=s.current;s=QW(function(){function l(p){if(!c){if(c=!0,u=p,p=i(p),r!==void 0&&a.hasValue){var m=a.value;if(r(m,p))return h=m}return h=p}if(m=h,kW(u,p))return m;var y=i(p);return r!==void 0&&r(m,y)?m:(u=p,h=y)}var c=!1,u,h,f=t===void 0?null:t;return[function(){return l(e())},f===null?void 0:function(){return l(f())}]},[e,t,i,r]);var o=NW(n,s[0],s[1]);return zW(function(){a.hasValue=!0,a.value=o},[o]),HW(o),o};nI.exports=iI;var VW=nI.exports;const WW=ps(VW),{useSyncExternalStoreWithSelector:YW}=WW;function aI(n,e=n.getState,t){const i=YW(n.subscribe,n.getState,n.getServerState||n.getState,e,t);return $.useDebugValue(i),i}const D7=n=>{const e=typeof n=="function"?CW(n):n,t=(i,r)=>aI(e,i,r);return Object.assign(t,e),t},qW=n=>n?D7(n):D7;function XW(){const n=$.createContext(void 0);return{Provider:({createStore:r,children:s})=>{const a=$.useRef();return a.current||(a.current=r()),$.createElement(n.Provider,{value:a.current},s)},useStore:(r,s)=>{const a=$.useContext(n);if(!a)throw new Error("Seems like you have not used zustand provider as an ancestor.");return aI(a,r,s)},useStoreApi:()=>{const r=$.useContext(n);if(!r)throw new Error("Seems like you have not used zustand provider as an ancestor.");return $.useMemo(()=>({...r}),[r])}}}function Wm(n,e){return n.map(function(t,i){return t+e[i]})}function u1(n,e){return n.map(function(t,i){return t-e[i]})}function Wp(n){return Math.hypot.apply(Math,n)}function oI(n,e){e===void 0&&(e=n);var t=Wp(e),i=t===0?0:1/t,r=e.map(function(a){return i*a}),s=Wp(n);return{distance:s,direction:r}}function lI(n,e,t){var i=Wp(e),r=i===0?0:1/i,s=t===0?0:1/t,a=s*i,o=e.map(function(u){return s*u}),l=e.map(function(u){return r*u}),c=Wp(n);return{velocities:o,velocity:a,distance:c,direction:l}}function Ym(n){return Math.sign?Math.sign(n):+(n>0)-+(n<0)||+n}function jW(n,e,t){return Math.max(e,Math.min(n,t))}function KW(n,e){return Math.pow(n,e*5)}function P7(n,e,t){return e===0||Math.abs(e)===1/0?KW(n,t):n*e*t/(e+t*n)}function L7(n,e,t,i){return i===void 0&&(i=.15),i===0?jW(n,e,t):n<e?-P7(e-n,t-e,i)+e:n>t?+P7(n-t,t-e,i)+t:n}function U7(n,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}}function $W(n,e,t){return e&&U7(n.prototype,e),t&&U7(n,t),n}function $t(){return $t=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},$t.apply(this,arguments)}function Su(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e}function JW(n,e){if(n==null)return{};var t={},i=Object.keys(n),r,s;for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&(t[r]=n[r]);return t}function An(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function ZW(n,e){if(n){if(typeof n=="string")return O7(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return O7(n,e)}}function O7(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=new Array(e);t<e;t++)i[t]=n[t];return i}function h1(n,e){var t;if(typeof Symbol>"u"||n[Symbol.iterator]==null){if(Array.isArray(n)||(t=ZW(n))||e&&n&&typeof n.length=="number"){t&&(n=t);var i=0;return function(){return i>=n.length?{done:!0}:{done:!1,value:n[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return t=n[Symbol.iterator](),t.next.bind(t)}function cI(){}function uI(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return e.length===0?cI:e.length===1?e[0]:function(){for(var i,r=h1(e),s;!(s=r()).done;){var a=s.value;i=a.apply(this,arguments)||i}return i}}function bl(n,e){if(n===void 0){if(e===void 0)throw new Error("Must define fallback value if undefined is expected");n=e}return Array.isArray(n)?n:[n,n]}function F7(n,e){return Object.assign({},e,n||{})}function qm(n){if(typeof n=="function"){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return n.apply(void 0,t)}else return n}function y0(n,e){n===void 0&&(n={});for(var t={},i=0,r=Object.entries(e);i<r.length;i++){var s=r[i],a=s[0],o=s[1];switch(typeof o){case"function":t[a]=o.call(t,n[a],a,n);break;case"object":t[a]=y0(n[a],o);break;case"boolean":o&&(t[a]=n[a]);break}}return t}function eY(){try{return"constructor"in GestureEvent}catch{return!1}}function hI(){return typeof window<"u"&&"ontouchstart"in window}function tY(){return typeof window<"u"&&"onpointerdown"in window}function fI(n){return"pointerId"in n?null:n.type==="touchend"?n.changedTouches:n.targetTouches}function _4(n){return Array.from(fI(n)).map(function(e){return e.identifier})}function Os(n){var e="buttons"in n?n.buttons:0,t=n.shiftKey,i=n.altKey,r=n.metaKey,s=n.ctrlKey;return{buttons:e,shiftKey:t,altKey:i,metaKey:r,ctrlKey:s}}var x0=function(e){return e};function Bh(n,e){e===void 0&&(e=x0);var t=fI(n),i=t?t[0]:n,r=i.clientX,s=i.clientY;return e([r,s])}function k7(n,e,t){t===void 0&&(t=x0);var i=Array.from(n.touches).filter(function(m){return e.includes(m.identifier)}),r=i[0],s=i[1];if(!r||!s)throw Error("The event doesn't have two pointers matching the pointerIds");var a=s.clientX-r.clientX,o=s.clientY-r.clientY,l=(s.clientX+r.clientX)/2,c=(s.clientY+r.clientY)/2,u=Math.hypot(a,o),h=-(Math.atan2(a,o)*180)/Math.PI,f=t([u,h]),p=t([l,c]);return{values:f,origin:p}}function nY(n,e){e===void 0&&(e=x0);var t=n.currentTarget,i=t.scrollX,r=t.scrollY,s=t.scrollLeft,a=t.scrollTop;return e([i||s||0,r||a||0])}var N7=40,G7=800;function dI(n,e){e===void 0&&(e=x0);var t=n.deltaX,i=n.deltaY,r=n.deltaMode;return r===1?(t*=N7,i*=N7):r===2&&(t*=G7,i*=G7),e([t,i])}function z7(n,e){return e===void 0&&(e=x0),e([n.scale,n.rotation])}var iY=180,rY=.15,sY=.5,aY=50,oY=250,pI={threshold:function(e){return e===void 0&&(e=0),bl(e)},rubberband:function(e){switch(e===void 0&&(e=0),e){case!0:return bl(rY);case!1:return bl(0);default:return bl(e)}},enabled:function(e){return e===void 0&&(e=!0),e},triggerAllEvents:function(e){return e===void 0&&(e=!1),e},initial:function(e){return e===void 0&&(e=0),typeof e=="function"?e:bl(e)},transform:!0},E4=$t({},pI,{axis:!0,lockDirection:function(e){return e===void 0&&(e=!1),e},bounds:function(e){if(e===void 0&&(e={}),typeof e=="function")return function(h){return E4.bounds(e(h))};var t=e,i=t.left,r=i===void 0?-1/0:i,s=t.right,a=s===void 0?1/0:s,o=t.top,l=o===void 0?-1/0:o,c=t.bottom,u=c===void 0?1/0:c;return[[r,a],[l,u]]}}),lY=typeof window<"u"&&window.document&&window.document.createElement,cY={enabled:function(e){return e===void 0&&(e=!0),e},domTarget:!0,window:function(n){function e(t){return n.apply(this,arguments)}return e.toString=function(){return n.toString()},e}(function(n){return n===void 0&&(n=lY?window:void 0),n}),eventOptions:function(e){var t=e===void 0?{}:e,i=t.passive,r=i===void 0?!0:i,s=t.capture,a=s===void 0?!1:s;return{passive:r,capture:a}},transform:!0},uY=$t({},pI,{bounds:function(e,t,i){var r=i.distanceBounds,s=r===void 0?{}:r,a=i.angleBounds,o=a===void 0?{}:a,l=function(h){var f=F7(qm(s,h),{min:-1/0,max:1/0});return[f.min,f.max]},c=function(h){var f=F7(qm(o,h),{min:-1/0,max:1/0});return[f.min,f.max]};return typeof s!="function"&&typeof o!="function"?[l(),c()]:function(u){return[l(u),c(u)]}}}),hY=$t({},E4,{useTouch:function(e){e===void 0&&(e=!1);var t=hI(),i=tY();return!!(e&&t||t&&!i)},experimental_preventWindowScrollY:function(e){return e===void 0&&(e=!1),e},threshold:function(e,t,i){var r=i.filterTaps,s=r===void 0?!1:r,a=i.lockDirection,o=a===void 0?!1:a,l=i.axis,c=l===void 0?void 0:l,u=bl(e,s?3:o||c?1:0);return this.filterTaps=s,u},swipeVelocity:function(e){return e===void 0&&(e=sY),bl(e)},swipeDistance:function(e){return e===void 0&&(e=aY),bl(e)},swipeDuration:function(e){return e===void 0&&(e=oY),e},delay:function(e){switch(e===void 0&&(e=0),e){case!0:return iY;case!1:return 0;default:return e}}});function fY(n){return n===void 0&&(n={}),y0(n,cY)}function Vv(n){return n===void 0&&(n={}),y0(n,E4)}function dY(n){return n===void 0&&(n={}),y0(n,uY)}function pY(n){return n===void 0&&(n={}),y0(n,hY)}function gY(n,e){n===void 0&&(n={}),e===void 0&&(e=new Set);var t=n,i=t.drag,r=t.wheel,s=t.move,a=t.scroll,o=t.pinch,l=t.hover,c=t.eventOptions,u=t.window,h=t.transform,f=t.domTarget,p=t.enabled,m=fY({domTarget:f,eventOptions:c,transform:h,window:u,enabled:p});return e.has("onDrag")&&(m.drag=pY(i)),e.has("onWheel")&&(m.wheel=Vv(r)),e.has("onScroll")&&(m.scroll=Vv(a)),e.has("onMove")&&(m.move=Vv(s)),e.has("onPinch")&&(m.pinch=dY(o)),e.has("onHover")&&(m.hover=$t({enabled:!0},l)),m}function fd(n){return $t({_active:!1,_blocked:!1,_intentional:[!1,!1],_movement:[0,0],_initial:[0,0],_bounds:[[-1/0,1/0],[-1/0,1/0]],_threshold:[0,0],_lastEventType:void 0,_dragStarted:!1,_dragPreventScroll:!1,_dragIsTap:!0,_dragDelayed:!1,event:void 0,intentional:!1,values:[0,0],velocities:[0,0],delta:[0,0],movement:[0,0],offset:[0,0],lastOffset:[0,0],direction:[0,0],initial:[0,0],previous:[0,0],first:!1,last:!1,active:!1,timeStamp:0,startTime:0,elapsedTime:0,cancel:cI,canceled:!1,memo:void 0,args:void 0},n)}function gI(){var n={hovering:!1,scrolling:!1,wheeling:!1,dragging:!1,moving:!1,pinching:!1,touches:0,buttons:0,down:!1,shiftKey:!1,altKey:!1,metaKey:!1,ctrlKey:!1,locked:!1},e=fd({_pointerId:void 0,axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0,tap:!1,swipe:[0,0]}),t=fd({_pointerIds:[],da:[0,0],vdva:[0,0],origin:void 0,turns:0}),i=fd({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),r=fd({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),s=fd({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0});return{shared:n,drag:e,pinch:t,wheel:i,move:r,scroll:s}}var Fs=new Map,mY=function(e){return e},mI=function(){function n(t,i){var r=this;i===void 0&&(i=[]),this.controller=t,this.args=i,this.debounced=!0,this.setTimeout=function(s,a){var o;a===void 0&&(a=140),clearTimeout(r.controller.timeouts[r.stateKey]);for(var l=arguments.length,c=new Array(l>2?l-2:0),u=2;u<l;u++)c[u-2]=arguments[u];r.controller.timeouts[r.stateKey]=(o=window).setTimeout.apply(o,[s,a].concat(c))},this.clearTimeout=function(){clearTimeout(r.controller.timeouts[r.stateKey])},this.fireGestureHandler=function(s){if(s===void 0&&(s=!1),r.state._blocked)return r.debounced||(r.state._active=!1,r.clean()),null;if(!s&&!r.state.intentional&&!r.config.triggerAllEvents)return null;if(r.state.intentional){var a=r.state.active,o=r.state._active;r.state.active=o,r.state.first=o&&!a,r.state.last=a&&!o,r.controller.state.shared[r.ingKey]=o}var l=r.controller.pointerIds.size||r.controller.touchIds.size,c=r.controller.state.shared.buttons>0||l>0,u=$t({},r.controller.state.shared,r.state,r.mapStateValues(r.state),{locked:!!document.pointerLockElement,touches:l,down:c}),h=r.handler(u);return r.state.memo=h!==void 0?h:r.state.memo,u},this.controller=t,this.args=i}var e=n.prototype;return e.updateSharedState=function(i){Object.assign(this.controller.state.shared,i)},e.updateGestureState=function(i){Object.assign(this.state,i)},e.checkIntentionality=function(i,r){return{_intentional:i,_blocked:!1}},e.getMovement=function(i){var r=this.config.rubberband,s=this.state,a=s._bounds,o=s._initial,l=s._active,c=s._intentional,u=s.lastOffset,h=s.movement,f=s._threshold,p=this.getInternalMovement(i,this.state),m=c[0]===!1?Q7(p[0],f[0]):c[0],y=c[1]===!1?Q7(p[1],f[1]):c[1],v=this.checkIntentionality([m,y],p);if(v._blocked)return $t({},v,{_movement:p,delta:[0,0]});var A=v._intentional,_=p,x=[A[0]!==!1?p[0]-A[0]:0,A[1]!==!1?p[1]-A[1]:0],E=Wm(x,u),w=l?r:[0,0];return x=H7(a,Wm(x,o),w),$t({},v,{intentional:A[0]!==!1||A[1]!==!1,_initial:o,_movement:_,movement:x,values:i,offset:H7(a,E,w),delta:u1(x,h)})},e.clean=function(){this.clearTimeout()},$W(n,[{key:"config",get:function(){return this.controller.config[this.stateKey]}},{key:"enabled",get:function(){return this.controller.config.enabled&&this.config.enabled}},{key:"state",get:function(){return this.controller.state[this.stateKey]}},{key:"handler",get:function(){return this.controller.handlers[this.stateKey]}},{key:"transform",get:function(){return this.config.transform||this.controller.config.transform||mY}}]),n}();function Q7(n,e){return Math.abs(n)>=e?Ym(n)*e:!1}function H7(n,e,t){var i=e[0],r=e[1],s=t[0],a=t[1],o=n[0],l=o[0],c=o[1],u=n[1],h=u[0],f=u[1];return[L7(i,l,c,s),L7(r,h,f,a)]}function bi(n,e,t){var i=n.state,r=e.timeStamp,s=e.type,a=i.values,o=t?0:r-i.startTime;return{_lastEventType:s,event:e,timeStamp:r,elapsedTime:o,previous:a}}function Zc(n,e,t,i){var r=n.state,s=n.config,a=n.stateKey,o=n.args,l=n.transform,c=r.offset,u=t.timeStamp,h=s.initial,f=s.bounds,p=s.threshold,m=u1(l(p),l([0,0])).map(Math.abs),y=$t({},gI()[a],{_active:!0,args:o,values:e,initial:i??e,_threshold:m,offset:c,lastOffset:c,startTime:u});return $t({},y,{_initial:qm(h,y),_bounds:qm(f,y)})}var AY=function(e){var t=this;this.classes=e,this.pointerIds=new Set,this.touchIds=new Set,this.supportsTouchEvents=hI(),this.supportsGestureEvents=eY(),this.bind=function(){for(var i=arguments.length,r=new Array(i),s=0;s<i;s++)r[s]=arguments[s];for(var a={},o=h1(t.classes),l;!(l=o()).done;){var c=l.value;new c(t,r).addBindings(a)}var u=function(p){jn(a,p,function(m){return t.nativeRefs[p]($t({},t.state.shared,{event:m,args:r}))})};for(var h in t.nativeRefs)u(h);return t.config.domTarget?_Y(t,a):EY(t,a)},this.effect=function(){return t.config.domTarget&&t.bind(),t.clean},this.clean=function(){var i=xI(t.config),r=t.config.eventOptions;i&&_0(i,yI(t.domListeners),r),Object.values(t.timeouts).forEach(clearTimeout),vY(t)},this.classes=e,this.state=gI(),this.timeouts={},this.domListeners=[],this.windowListeners={}};function AI(n,e){"pointerId"in e?n.pointerIds.add(e.pointerId):n.touchIds=new Set(_4(e))}function vI(n,e){"pointerId"in e?n.pointerIds.delete(e.pointerId):_4(e).forEach(function(t){return n.touchIds.delete(t)})}function vY(n){var e=n.config,t=e.window,i=e.eventOptions,r=n.windowListeners;if(t){for(var s in r){var a=r[s];_0(t,a,i)}n.windowListeners={}}}function yY(n,e,t){var i=n.config,r=n.windowListeners;t===void 0&&(t=i.eventOptions),i.window&&(_0(i.window,r[e],t),delete r[e])}function xY(n,e,t,i){var r=n.config,s=n.windowListeners;t===void 0&&(t=[]),i===void 0&&(i=r.eventOptions),r.window&&(_0(r.window,s[e],i),_I(r.window,s[e]=t,i))}function _Y(n,e){var t=n.config,i=n.domListeners,r=xI(t);if(!r)throw new Error("domTarget must be defined");var s=t.eventOptions;_0(r,yI(i),s);for(var a=0,o=Object.entries(e);a<o.length;a++){var l=o[a],c=l[0],u=l[1],h=c.slice(2).toLowerCase();i.push([h,uI.apply(void 0,u)])}_I(r,i,s)}function EY(n,e){for(var t=n.config,i={},r=t.eventOptions.capture?"Capture":"",s=0,a=Object.entries(e);s<a.length;s++){var o=a[s],l=o[0],c=o[1],u=Array.isArray(c)?c:[c],h=l+r;i[h]=uI.apply(void 0,u)}return i}function yI(n){return n===void 0&&(n=[]),n.splice(0,n.length)}function xI(n){var e=n.domTarget;return e&&"current"in e?e.current:e}function jn(n,e,t){n[e]||(n[e]=[]),n[e].push(t)}function _I(n,e,t){e===void 0&&(e=[]),t===void 0&&(t={});for(var i=h1(e),r;!(r=i()).done;){var s=r.value,a=s[0],o=s[1];n.addEventListener(a,o,t)}}function _0(n,e,t){e===void 0&&(e=[]),t===void 0&&(t={});for(var i=h1(e),r;!(r=i()).done;){var s=r.value,a=s[0],o=s[1];n.removeEventListener(a,o,t)}}function SY(n,e,t){t===void 0&&(t={});var i=CY(n),r=f_.useMemo(function(){return new AY(i)},[]);return r.config=e,r.handlers=n,r.nativeRefs=t,f_.useEffect(r.effect,[]),r.config.domTarget?wY:r.bind}function wY(){}function CY(n){var e=new Set;return n.drag&&e.add(Fs.get("drag")),n.wheel&&e.add(Fs.get("wheel")),n.scroll&&e.add(Fs.get("scroll")),n.move&&e.add(Fs.get("move")),n.pinch&&e.add(Fs.get("pinch")),n.hover&&e.add(Fs.get("hover")),e}var f1=function(n){Su(e,n);function e(){return n.apply(this,arguments)||this}var t=e.prototype;return t.getInternalMovement=function(r,s){return u1(r,s.initial)},t.checkIntentionality=function(r,s){if(r[0]===!1&&r[1]===!1)return{_intentional:r,axis:this.state.axis};var a=s.map(Math.abs),o=a[0],l=a[1],c=this.state.axis||(o>l?"x":o<l?"y":void 0);return!this.config.axis&&!this.config.lockDirection?{_intentional:r,_blocked:!1,axis:c}:c?this.config.axis&&c!==this.config.axis?{_intentional:r,_blocked:!0,axis:c}:(r[c==="x"?1:0]=!1,{_intentional:r,_blocked:!1,axis:c}):{_intentional:[!1,!1],_blocked:!1,axis:c}},t.getKinematics=function(r,s){var a=this.getMovement(r);if(!a._blocked){var o=s.timeStamp-this.state.timeStamp;Object.assign(a,lI(a.movement,a.delta,o))}return a},t.mapStateValues=function(r){return{xy:r.values,vxvy:r.velocities}},e}(mI),TY=3;function V7(n){"persist"in n&&typeof n.persist=="function"&&n.persist()}var bY=function(n){Su(e,n);function e(){var i;return i=n.apply(this,arguments)||this,i.ingKey="dragging",i.stateKey="drag",i.setPointerCapture=function(r){if(!(i.config.useTouch||document.pointerLockElement)){var s=r.target,a=r.pointerId;s&&"setPointerCapture"in s&&s.setPointerCapture(a),i.updateGestureState({_dragTarget:s,_dragPointerId:a})}},i.releasePointerCapture=function(){if(!(i.config.useTouch||document.pointerLockElement)){var r=i.state,s=r._dragTarget,a=r._dragPointerId;if(a&&s&&"releasePointerCapture"in s&&(!("hasPointerCapture"in s)||s.hasPointerCapture(a)))try{s.releasePointerCapture(a)}catch{}}},i.preventScroll=function(r){i.state._dragPreventScroll&&r.cancelable&&r.preventDefault()},i.getEventId=function(r){return i.config.useTouch?r.changedTouches[0].identifier:r.pointerId},i.isValidEvent=function(r){return i.state._pointerId===i.getEventId(r)},i.shouldPreventWindowScrollY=i.config.experimental_preventWindowScrollY&&i.controller.supportsTouchEvents,i.setUpWindowScrollDetection=function(r){V7(r),xY(i.controller,i.stateKey,[["touchmove",i.preventScroll],["touchend",i.clean.bind(An(i))],["touchcancel",i.clean.bind(An(i))]],{passive:!1}),i.setTimeout(i.startDrag.bind(An(i)),250,r)},i.setUpDelayedDragTrigger=function(r){i.state._dragDelayed=!0,V7(r),i.setTimeout(i.startDrag.bind(An(i)),i.config.delay,r)},i.setStartState=function(r){var s=Bh(r,i.transform);i.updateSharedState(Os(r)),i.updateGestureState($t({},Zc(An(i),s,r),bi(An(i),r,!0),{_pointerId:i.getEventId(r)})),i.updateGestureState(i.getMovement(s))},i.onDragStart=function(r){AI(i.controller,r),!(!i.enabled||i.state._active)&&(i.setStartState(r),i.setPointerCapture(r),i.shouldPreventWindowScrollY?i.setUpWindowScrollDetection(r):i.config.delay>0?i.setUpDelayedDragTrigger(r):i.startDrag(r,!0))},i.onDragChange=function(r){if(!(i.state.canceled||!i.state._active||!i.isValidEvent(r)||i.state._lastEventType===r.type&&r.timeStamp===i.state.timeStamp)){var s;if(document.pointerLockElement){var a=r.movementX,o=r.movementY;s=Wm(i.transform([a,o]),i.state.values)}else s=Bh(r,i.transform);var l=i.getKinematics(s,r);if(!i.state._dragStarted){if(i.state._dragDelayed){i.startDrag(r);return}if(i.shouldPreventWindowScrollY)if(!i.state._dragPreventScroll&&l.axis)if(l.axis==="x")i.startDrag(r);else{i.state._active=!1;return}else return;else return}var c=Os(r);i.updateSharedState(c);var u=bi(An(i),r),h=Wp(l._movement),f=i.state._dragIsTap;f&&h>=TY&&(f=!1),i.updateGestureState($t({},u,l,{_dragIsTap:f})),i.fireGestureHandler()}},i.onDragEnd=function(r){if(vI(i.controller,r),!!i.isValidEvent(r)&&(i.clean(),!!i.state._active)){i.state._active=!1;var s=i.state._dragIsTap,a=i.state.velocities,o=a[0],l=a[1],c=i.state.movement,u=c[0],h=c[1],f=i.state._intentional,p=f[0],m=f[1],y=i.config.swipeVelocity,v=y[0],A=y[1],_=i.config.swipeDistance,x=_[0],E=_[1],w=i.config.swipeDuration,I=$t({},bi(An(i),r),i.getMovement(i.state.values)),T=[0,0];I.elapsedTime<w&&(p!==!1&&Math.abs(o)>v&&Math.abs(u)>x&&(T[0]=Ym(o)),m!==!1&&Math.abs(l)>A&&Math.abs(h)>E&&(T[1]=Ym(l))),i.updateSharedState({buttons:0}),i.updateGestureState($t({},I,{tap:s,swipe:T})),i.fireGestureHandler(i.config.filterTaps&&s===!0)}},i.clean=function(){n.prototype.clean.call(An(i)),i.state._dragStarted=!1,i.releasePointerCapture(),yY(i.controller,i.stateKey)},i.onCancel=function(){i.state.canceled||(i.updateGestureState({canceled:!0,_active:!1}),i.updateSharedState({buttons:0}),setTimeout(function(){return i.fireGestureHandler()},0))},i.onClick=function(r){i.state._dragIsTap||r.stopPropagation()},i}var t=e.prototype;return t.startDrag=function(r,s){s===void 0&&(s=!1),!(!this.state._active||this.state._dragStarted)&&(s||this.setStartState(r),this.updateGestureState({_dragStarted:!0,_dragPreventScroll:!0,cancel:this.onCancel}),this.clearTimeout(),this.fireGestureHandler())},t.addBindings=function(r){if(this.config.useTouch?(jn(r,"onTouchStart",this.onDragStart),jn(r,"onTouchMove",this.onDragChange),jn(r,"onTouchEnd",this.onDragEnd),jn(r,"onTouchCancel",this.onDragEnd)):(jn(r,"onPointerDown",this.onDragStart),jn(r,"onPointerMove",this.onDragChange),jn(r,"onPointerUp",this.onDragEnd),jn(r,"onPointerCancel",this.onDragEnd)),this.config.filterTaps){var s=this.controller.config.eventOptions.capture?"onClick":"onClickCapture";jn(r,s,this.onClick)}},e}(f1),IY=function(n){Su(e,n);function e(){return n.apply(this,arguments)||this}var t=e.prototype;return t.getInternalMovement=function(r,s){var a=s.values[1],o=r[0],l=r[1],c=l===void 0?a:l,u=c-a,h=s.turns;return Math.abs(u)>270&&(h+=Ym(u)),u1([o,c-360*h],s.initial)},t.getKinematics=function(r,s){var a=this.getMovement(r),o=(r[1]-a._movement[1]-this.state.initial[1])/360,l=s.timeStamp-this.state.timeStamp,c=lI(a.movement,a.delta,l),u=JW(c,["distance","velocity"]);return $t({turns:o},a,u)},t.mapStateValues=function(r){return{da:r.values,vdva:r.velocities}},e}(mI),MY=7,RY=260,BY=function(n){Su(e,n);function e(){var i;return i=n.apply(this,arguments)||this,i.ingKey="pinching",i.stateKey="pinch",i.onPinchStart=function(r){AI(i.controller,r);var s=i.controller.touchIds;if(i.enabled&&!(i.state._active&&i.state._pointerIds.every(function(u){return s.has(u)}))&&!(s.size<2)){var a=Array.from(s).slice(0,2),o=k7(r,a,i.transform),l=o.values,c=o.origin;i.updateSharedState(Os(r)),i.updateGestureState($t({},Zc(An(i),l,r),bi(An(i),r,!0),{_pointerIds:a,cancel:i.onCancel,origin:c})),i.updateGestureState(i.getMovement(l)),i.fireGestureHandler()}},i.onPinchChange=function(r){var s=i.state,a=s.canceled,o=s._active;if(!(a||!o||r.timeStamp===i.state.timeStamp)){var l=Os(r);i.updateSharedState(l);try{var c=k7(r,i.state._pointerIds,i.transform),u=c.values,h=c.origin,f=i.getKinematics(u,r);i.updateGestureState($t({},bi(An(i),r),f,{origin:h})),i.fireGestureHandler()}catch{i.onPinchEnd(r)}}},i.onPinchEnd=function(r){vI(i.controller,r);var s=_4(r);i.state._pointerIds.every(function(a){return!s.includes(a)})||(i.clean(),i.state._active&&(i.updateGestureState($t({},bi(An(i),r),i.getMovement(i.state.values),{_active:!1})),i.fireGestureHandler()))},i.onCancel=function(){i.state.canceled||(i.updateGestureState({_active:!1,canceled:!0}),setTimeout(function(){return i.fireGestureHandler()},0))},i.onGestureStart=function(r){if(i.enabled){r.preventDefault();var s=z7(r,i.transform);i.updateSharedState(Os(r)),i.updateGestureState($t({},Zc(An(i),s,r),bi(An(i),r,!0),{origin:[r.clientX,r.clientY],cancel:i.onCancel})),i.updateGestureState(i.getMovement(s)),i.fireGestureHandler()}},i.onGestureChange=function(r){var s=i.state,a=s.canceled,o=s._active;if(!(a||!o)){r.preventDefault();var l=Os(r);i.updateSharedState(l);var c=z7(r,i.transform);c[0]=(c[0]-i.state.event.scale)*RY+i.state.values[0];var u=i.getKinematics(c,r);i.updateGestureState($t({},bi(An(i),r),u,{origin:[r.clientX,r.clientY]})),i.fireGestureHandler()}},i.onGestureEnd=function(r){i.clean(),i.state._active&&(i.updateGestureState($t({},bi(An(i),r),i.getMovement(i.state.values),{_active:!1,origin:[r.clientX,r.clientY]})),i.fireGestureHandler())},i.wheelShouldRun=function(r){return i.enabled&&r.ctrlKey},i.getWheelValuesFromEvent=function(r){var s=dI(r,i.transform),a=s[1],o=i.state.values,l=o[0],c=o[1],u=-a*MY,h=l+u,f=c!==void 0?c:0;return{values:[h,f],origin:[r.clientX,r.clientY],delta:[u,f]}},i.onWheel=function(r){i.wheelShouldRun(r)&&(i.setTimeout(i.onWheelEnd),i.state._active?i.onWheelChange(r):i.onWheelStart(r))},i.onWheelStart=function(r){var s=i.getWheelValuesFromEvent(r),a=s.values,o=s.delta,l=s.origin;r.cancelable&&r.preventDefault(),i.updateSharedState(Os(r)),i.updateGestureState($t({},Zc(An(i),a,r,i.state.values),bi(An(i),r,!0),{offset:a,delta:o,origin:l})),i.updateGestureState(i.getMovement(a)),i.fireGestureHandler()},i.onWheelChange=function(r){r.cancelable&&r.preventDefault(),i.updateSharedState(Os(r));var s=i.getWheelValuesFromEvent(r),a=s.values,o=s.origin,l=s.delta;i.updateGestureState($t({},bi(An(i),r),i.getKinematics(a,r),{origin:o,delta:l})),i.fireGestureHandler()},i.onWheelEnd=function(){i.clean(),i.state._active&&(i.state._active=!1,i.updateGestureState(i.getMovement(i.state.values)),i.fireGestureHandler())},i}var t=e.prototype;return t.addBindings=function(r){this.controller.config.domTarget&&!this.controller.supportsTouchEvents&&this.controller.supportsGestureEvents?(jn(r,"onGestureStart",this.onGestureStart),jn(r,"onGestureChange",this.onGestureChange),jn(r,"onGestureEnd",this.onGestureEnd)):(jn(r,"onTouchStart",this.onPinchStart),jn(r,"onTouchMove",this.onPinchChange),jn(r,"onTouchEnd",this.onPinchEnd),jn(r,"onTouchCancel",this.onPinchEnd),jn(r,"onWheel",this.onWheel))},e}(IY),DY=function(n){Su(e,n);function e(){var i;return i=n.apply(this,arguments)||this,i.ingKey="wheeling",i.stateKey="wheel",i.debounced=!0,i.handleEvent=function(r){if(!(r.ctrlKey&&"pinch"in i.controller.handlers)&&i.enabled){i.setTimeout(i.onEnd),i.updateSharedState(Os(r));var s=Wm(dI(r,i.transform),i.state.values);if(i.state._active)i.updateGestureState($t({},bi(An(i),r),i.getKinematics(s,r)));else{i.updateGestureState($t({},Zc(An(i),s,r,i.state.values),bi(An(i),r,!0)));var a=i.getMovement(s),o=oI(a.delta);i.updateGestureState(a),i.updateGestureState(o)}i.fireGestureHandler()}},i.onEnd=function(){if(i.clean(),!!i.state._active){var r=i.getMovement(i.state.values);i.updateGestureState(r),i.updateGestureState({_active:!1,velocities:[0,0],velocity:0}),i.fireGestureHandler()}},i}var t=e.prototype;return t.addBindings=function(r){jn(r,"onWheel",this.handleEvent)},e}(f1),W7=function(n){Su(e,n);function e(){var i;return i=n.apply(this,arguments)||this,i.ingKey="moving",i.stateKey="move",i.debounced=!0,i.onMove=function(r){i.enabled&&(i.setTimeout(i.onMoveEnd),i.state._active?i.onMoveChange(r):i.onMoveStart(r))},i.onMoveStart=function(r){i.updateSharedState(Os(r));var s=Bh(r,i.transform);i.updateGestureState($t({},Zc(An(i),s,r),bi(An(i),r,!0))),i.updateGestureState(i.getMovement(s)),i.fireGestureHandler()},i.onMoveChange=function(r){i.updateSharedState(Os(r));var s=Bh(r,i.transform);i.updateGestureState($t({},bi(An(i),r),i.getKinematics(s,r))),i.fireGestureHandler()},i.onMoveEnd=function(){if(i.clean(),!!i.state._active){var r=i.state.values;i.updateGestureState(i.getMovement(r)),i.updateGestureState({velocities:[0,0],velocity:0,_active:!1}),i.fireGestureHandler()}},i.hoverTransform=function(){return i.controller.config.hover.transform||i.controller.config.transform},i.onPointerEnter=function(r){if(i.controller.state.shared.hovering=!0,!!i.controller.config.enabled){if(i.controller.config.hover.enabled){var s=Bh(r,i.hoverTransform()),a=$t({},i.controller.state.shared,i.state,bi(An(i),r,!0),{args:i.args,values:s,active:!0,hovering:!0});i.controller.handlers.hover($t({},a,i.mapStateValues(a)))}"move"in i.controller.handlers&&i.onMoveStart(r)}},i.onPointerLeave=function(r){if(i.controller.state.shared.hovering=!1,"move"in i.controller.handlers&&i.onMoveEnd(),!!i.controller.config.hover.enabled){var s=Bh(r,i.hoverTransform()),a=$t({},i.controller.state.shared,i.state,bi(An(i),r),{args:i.args,values:s,active:!1});i.controller.handlers.hover($t({},a,i.mapStateValues(a)))}},i}var t=e.prototype;return t.addBindings=function(r){"move"in this.controller.handlers&&jn(r,"onPointerMove",this.onMove),"hover"in this.controller.handlers&&(jn(r,"onPointerEnter",this.onPointerEnter),jn(r,"onPointerLeave",this.onPointerLeave))},e}(f1),PY=function(n){Su(e,n);function e(){var i;return i=n.apply(this,arguments)||this,i.ingKey="scrolling",i.stateKey="scroll",i.debounced=!0,i.handleEvent=function(r){if(i.enabled){i.clearTimeout(),i.setTimeout(i.onEnd);var s=nY(r,i.transform);if(i.updateSharedState(Os(r)),i.state._active)i.updateGestureState($t({},bi(An(i),r),i.getKinematics(s,r)));else{i.updateGestureState($t({},Zc(An(i),s,r,i.state.values),bi(An(i),r,!0)));var a=i.getMovement(s),o=oI(a.delta);i.updateGestureState(a),i.updateGestureState(o)}i.fireGestureHandler()}},i.onEnd=function(){i.clean(),i.state._active&&(i.updateGestureState($t({},i.getMovement(i.state.values),{_active:!1,velocities:[0,0],velocity:0})),i.fireGestureHandler())},i}var t=e.prototype;return t.addBindings=function(r){jn(r,"onScroll",this.handleEvent)},e}(f1),LY=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function UY(n){var e={},t={},i=new Set;for(var r in n)LY.test(r)?(i.add(RegExp.lastMatch),t[r]=n[r]):e[r]=n[r];return[t,e,i]}function OY(n,e){e===void 0&&(e={});var t=UY(n),i=t[0],r=t[1],s=t[2];Fs.set("drag",bY),Fs.set("hover",W7),Fs.set("move",W7),Fs.set("pinch",BY),Fs.set("scroll",PY),Fs.set("wheel",DY);var a=gY(e,s),o={};return s.has("onDrag")&&(o.drag=dd(i,"onDrag")),s.has("onWheel")&&(o.wheel=dd(i,"onWheel")),s.has("onScroll")&&(o.scroll=dd(i,"onScroll")),s.has("onMove")&&(o.move=dd(i,"onMove")),s.has("onPinch")&&(o.pinch=dd(i,"onPinch")),s.has("onHover")&&(o.hover=i.onHover),SY(o,a,r)}function dd(n,e){var t=e+"Start",i=e+"End",r=function(a){var o=void 0;return a.first&&t in n&&n[t](a),e in n&&(o=n[e](a)),a.last&&i in n&&n[i](a),o};return r}var gf={};function Za(n){if(typeof n!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=n}typeof Symbol<"u"&&(Za.prototype[Symbol.iterator]=function(){return this});Za.of=function(){var n=arguments,e=n.length,t=0;return new Za(function(){return t>=e?{done:!0}:{done:!1,value:n[t++]}})};Za.empty=function(){var n=new Za(function(){return{done:!0}});return n};Za.fromSequence=function(n){var e=0,t=n.length;return new Za(function(){return e>=t?{done:!0}:{done:!1,value:n[e++]}})};Za.is=function(n){return n instanceof Za?!0:typeof n=="object"&&n!==null&&typeof n.next=="function"};var d1=Za;const Hs=ps(d1);var p1={};p1.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u";p1.SYMBOL_SUPPORT=typeof Symbol<"u";var EI=p1,FY=EI.ARRAY_BUFFER_SUPPORT,kY=EI.SYMBOL_SUPPORT,S4=function(e,t){var i,r,s,a,o;if(!e)throw new Error("obliterator/forEach: invalid iterable.");if(typeof t!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(e)||FY&&ArrayBuffer.isView(e)||typeof e=="string"||e.toString()==="[object Arguments]"){for(s=0,a=e.length;s<a;s++)t(e[s],s);return}if(typeof e.forEach=="function"){e.forEach(t);return}if(kY&&Symbol.iterator in e&&typeof e.next!="function"&&(e=e[Symbol.iterator]()),typeof e.next=="function"){for(i=e,s=0;o=i.next(),o.done!==!0;)t(o.value,s),s++;return}for(r in e)e.hasOwnProperty(r)&&t(e[r],r)},SI=d1,NY=S4;function vi(){this.clear()}vi.prototype.clear=function(){this.items=[],this.offset=0,this.size=0};vi.prototype.enqueue=function(n){return this.items.push(n),++this.size};vi.prototype.dequeue=function(){if(this.size){var n=this.items[this.offset];return++this.offset*2>=this.items.length&&(this.items=this.items.slice(this.offset),this.offset=0),this.size--,n}};vi.prototype.peek=function(){if(this.size)return this.items[this.offset]};vi.prototype.forEach=function(n,e){e=arguments.length>1?e:this;for(var t=this.offset,i=0,r=this.items.length;t<r;t++,i++)n.call(e,this.items[t],i,this)};vi.prototype.toArray=function(){return this.items.slice(this.offset)};vi.prototype.values=function(){var n=this.items,e=this.offset;return new SI(function(){if(e>=n.length)return{done:!0};var t=n[e];return e++,{value:t,done:!1}})};vi.prototype.entries=function(){var n=this.items,e=this.offset,t=0;return new SI(function(){if(e>=n.length)return{done:!0};var i=n[e];return e++,{value:[t++,i],done:!1}})};typeof Symbol<"u"&&(vi.prototype[Symbol.iterator]=vi.prototype.values);vi.prototype.toString=function(){return this.toArray().join(",")};vi.prototype.toJSON=function(){return this.toArray()};vi.prototype.inspect=function(){var n=this.toArray();return Object.defineProperty(n,"constructor",{value:vi,enumerable:!1}),n};typeof Symbol<"u"&&(vi.prototype[Symbol.for("nodejs.util.inspect.custom")]=vi.prototype.inspect);vi.from=function(n){var e=new vi;return NY(n,function(t){e.enqueue(t)}),e};vi.of=function(){return vi.from(arguments)};var GY=vi,zY=function(e,t){var i=t.length;if(i!==0){var r=e.length;e.length+=i;for(var s=0;s<i;s++)e[r+s]=t[s]}},w4=Kl,QY=GY,HY=zY;function VY(n,e,t){if(!w4(n))throw new Error("graphology-shortest-path: invalid graphology instance.");if(arguments.length<3)throw new Error("graphology-shortest-path: invalid number of arguments. Expecting at least 3.");if(!n.hasNode(e))throw new Error('graphology-shortest-path: the "'+e+'" source node does not exist in the given graph.');if(!n.hasNode(t))throw new Error('graphology-shortest-path: the "'+t+'" target node does not exist in the given graph.');if(e=""+e,t=""+t,e===t)return[e];var i=n.inboundNeighbors.bind(n),r=n.outboundNeighbors.bind(n),s={},a={};s[e]=null,a[t]=null;var o=[e],l=[t],c,u,h,f,p,m,y,v,A=!1;e:for(;o.length&&l.length;)if(o.length<=l.length){for(c=o,o=[],p=0,y=c.length;p<y;p++)for(u=c[p],h=r(u),m=0,v=h.length;m<v;m++)if(f=h[m],f in s||(o.push(f),s[f]=u),f in a){A=!0;break e}}else for(c=l,l=[],p=0,y=c.length;p<y;p++)for(u=c[p],h=i(u),m=0,v=h.length;m<v;m++)if(f=h[m],f in a||(l.push(f),a[f]=u),f in s){A=!0;break e}if(!A)return null;for(var _=[];f;)_.unshift(f),f=s[f];for(f=a[_[_.length-1]];f;)_.push(f),f=a[f];return _.length?_:null}function WY(n,e){if(!w4(n))throw new Error("graphology-shortest-path: invalid graphology instance.");if(arguments.length<2)throw new Error("graphology-shortest-path: invalid number of arguments. Expecting at least 2.");if(!n.hasNode(e))throw new Error('graphology-shortest-path: the "'+e+'" source node does not exist in the given graph.');e=""+e;var t={},i={},r,s,a,o,l,c;for(t[e]=!0,i[e]=[e];Object.keys(t).length;){r=t,t={};for(a in r)for(s=n.outboundNeighbors(a),l=0,c=s.length;l<c;l++)o=s[l],i[o]||(i[o]=i[a].concat(o),t[o]=!0)}return i}function wI(n,e,t){if(!w4(e))throw new Error("graphology-shortest-path: invalid graphology instance.");if(!e.hasNode(t))throw new Error('graphology-shortest-path: the "'+t+'" source node does not exist in the given graph.');t=""+t;var i=new Set,r={},s=0;r[t]=0;for(var a=[t],o,l,c;a.length!==0;){var u=[];for(o=0,l=a.length;o<l;o++)c=a[o],!i.has(c)&&(i.add(c),HY(u,e[n](c)),r[c]=s);s++,a=u}return r}var YY=wI.bind(null,"outboundNeighbors"),qY=wI.bind(null,"neighbors");function XY(n,e){e=""+e;var t=[],i={},r={},s=n.nodes(),a,o,l,c,u,h,f,p,m;for(h=0,p=s.length;h<p;h++)c=s[h],i[c]=[],r[c]=0;var y={};r[e]=1,y[e]=0;for(var v=QY.of(e);v.size;)for(c=v.dequeue(),t.push(c),a=y[c],o=r[c],l=n.outboundNeighbors(c),f=0,m=l.length;f<m;f++)u=l[f],u in y||(v.enqueue(u),y[u]=a+1),y[u]===a+1&&(r[u]+=o,i[u].push(c));return[t,i,r]}gf.bidirectional=VY;gf.singleSource=WY;gf.singleSourceLength=YY;gf.undirectedSingleSourceLength=qY;gf.brandes=XY;var C4={},E0={},jY=function(n,e){return n<e?-1:n>e?1:0},KY=function(n,e){return n<e?1:n>e?-1:0};function $Y(n){return function(e,t){return n(t,e)}}function JY(n){return n===2?function(e,t){return e[0]<t[0]?-1:e[0]>t[0]?1:e[1]<t[1]?-1:e[1]>t[1]?1:0}:function(e,t){for(var i=0;i<n;){if(e[i]<t[i])return-1;if(e[i]>t[i])return 1;i++}return 0}}E0.DEFAULT_COMPARATOR=jY;E0.DEFAULT_REVERSE_COMPARATOR=KY;E0.reverseComparator=$Y;E0.createTupleComparator=JY;var S0={},CI=S4,TI=m4;function ZY(n){return Array.isArray(n)||TI.isTypedArray(n)}function T4(n){if(typeof n.length=="number")return n.length;if(typeof n.size=="number")return n.size}function eq(n){var e=T4(n),t=typeof e=="number"?new Array(e):[],i=0;return CI(n,function(r){t[i++]=r}),t}function tq(n){var e=T4(n),t=typeof e=="number"?TI.getPointerArray(e):Array,i=typeof e=="number"?new Array(e):[],r=typeof e=="number"?new t(e):[],s=0;return CI(n,function(a){i[s]=a,r[s]=s++}),[i,r]}S0.isArrayLike=ZY;S0.guessLength=T4;S0.toArray=eq;S0.toArrayWithIndices=tq;var Xm=S4,bI=E0,qa=S0,g1=bI.DEFAULT_COMPARATOR,b4=bI.reverseComparator;function I4(n,e,t,i){for(var r=e[i],s,a;i>t;){if(s=i-1>>1,a=e[s],n(r,a)<0){e[i]=a,i=s;continue}break}e[i]=r}function w0(n,e,t){for(var i=e.length,r=t,s=e[t],a=2*t+1,o;a<i;)o=a+1,o<i&&n(e[a],e[o])>=0&&(a=o),e[t]=e[a],t=a,a=2*t+1;e[t]=s,I4(n,e,r,t)}function II(n,e,t){e.push(t),I4(n,e,0,e.length-1)}function M4(n,e){var t=e.pop();if(e.length!==0){var i=e[0];return e[0]=t,w0(n,e,0),i}return t}function $h(n,e,t){if(e.length===0)throw new Error("mnemonist/heap.replace: cannot pop an empty heap.");var i=e[0];return e[0]=t,w0(n,e,0),i}function MI(n,e,t){var i;return e.length!==0&&n(e[0],t)<0&&(i=e[0],e[0]=t,t=i,w0(n,e,0)),t}function cu(n,e){for(var t=e.length,i=t>>1,r=i;--r>=0;)w0(n,e,r)}function R4(n,e){for(var t=e.length,i=0,r=new Array(t);i<t;)r[i++]=M4(n,e);return r}function nq(n,e,t){arguments.length===2&&(t=e,e=n,n=g1);var i=b4(n),r,s,a,o=1/0,l;if(e===1){if(qa.isArrayLike(t)){for(r=0,s=t.length;r<s;r++)a=t[r],(o===1/0||n(a,o)<0)&&(o=a);return l=new t.constructor(1),l[0]=o,l}return Xm(t,function(u){(o===1/0||n(u,o)<0)&&(o=u)}),[o]}if(qa.isArrayLike(t)){if(e>=t.length)return t.slice().sort(n);for(l=t.slice(0,e),cu(i,l),r=e,s=t.length;r<s;r++)i(t[r],l[0])>0&&$h(i,l,t[r]);return l.sort(n)}var c=qa.guessLength(t);return c!==null&&c<e&&(e=c),l=new Array(e),r=0,Xm(t,function(u){r<e?l[r]=u:(r===e&&cu(i,l),i(u,l[0])>0&&$h(i,l,u)),r++}),l.length>r&&(l.length=r),l.sort(n)}function iq(n,e,t){arguments.length===2&&(t=e,e=n,n=g1);var i=b4(n),r,s,a,o=-1/0,l;if(e===1){if(qa.isArrayLike(t)){for(r=0,s=t.length;r<s;r++)a=t[r],(o===-1/0||n(a,o)>0)&&(o=a);return l=new t.constructor(1),l[0]=o,l}return Xm(t,function(u){(o===-1/0||n(u,o)>0)&&(o=u)}),[o]}if(qa.isArrayLike(t)){if(e>=t.length)return t.slice().sort(i);for(l=t.slice(0,e),cu(n,l),r=e,s=t.length;r<s;r++)n(t[r],l[0])>0&&$h(n,l,t[r]);return l.sort(i)}var c=qa.guessLength(t);return c!==null&&c<e&&(e=c),l=new Array(e),r=0,Xm(t,function(u){r<e?l[r]=u:(r===e&&cu(n,l),n(u,l[0])>0&&$h(n,l,u)),r++}),l.length>r&&(l.length=r),l.sort(i)}function Sn(n){if(this.clear(),this.comparator=n||g1,typeof this.comparator!="function")throw new Error("mnemonist/Heap.constructor: given comparator should be a function.")}Sn.prototype.clear=function(){this.items=[],this.size=0};Sn.prototype.push=function(n){return II(this.comparator,this.items,n),++this.size};Sn.prototype.peek=function(){return this.items[0]};Sn.prototype.pop=function(){return this.size!==0&&this.size--,M4(this.comparator,this.items)};Sn.prototype.replace=function(n){return $h(this.comparator,this.items,n)};Sn.prototype.pushpop=function(n){return MI(this.comparator,this.items,n)};Sn.prototype.consume=function(){return this.size=0,R4(this.comparator,this.items)};Sn.prototype.toArray=function(){return R4(this.comparator,this.items.slice())};Sn.prototype.inspect=function(){var n=this.toArray();return Object.defineProperty(n,"constructor",{value:Sn,enumerable:!1}),n};typeof Symbol<"u"&&(Sn.prototype[Symbol.for("nodejs.util.inspect.custom")]=Sn.prototype.inspect);function jm(n){if(this.clear(),this.comparator=n||g1,typeof this.comparator!="function")throw new Error("mnemonist/MaxHeap.constructor: given comparator should be a function.");this.comparator=b4(this.comparator)}jm.prototype=Sn.prototype;Sn.from=function(n,e){var t=new Sn(e),i;return qa.isArrayLike(n)?i=n.slice():i=qa.toArray(n),cu(t.comparator,i),t.items=i,t.size=i.length,t};jm.from=function(n,e){var t=new jm(e),i;return qa.isArrayLike(n)?i=n.slice():i=qa.toArray(n),cu(t.comparator,i),t.items=i,t.size=i.length,t};Sn.siftUp=w0;Sn.siftDown=I4;Sn.push=II;Sn.pop=M4;Sn.replace=$h;Sn.pushpop=MI;Sn.heapify=cu;Sn.consume=R4;Sn.nsmallest=nq;Sn.nlargest=iq;Sn.MinHeap=Sn;Sn.MaxHeap=jm;var rq=Sn,RI=Kl,B4=df.createEdgeWeightGetter,Km=rq,D4="weight";function Ty(n,e){return n[0]>e[0]?1:n[0]<e[0]?-1:n[1]>e[1]?1:n[1]<e[1]?-1:n[2]>e[2]?1:n[2]<e[2]?-1:0}function sq(n,e){return n[0]>e[0]?1:n[0]<e[0]?-1:n[1]>e[1]?1:n[1]<e[1]?-1:n[2]>e[2]?1:n[2]<e[2]?-1:n[3]>e[3]?1:n[3]<e[3]?-1:0}function aq(n,e,t,i){if(e=""+e,t=""+t,!RI(n))throw new Error("graphology-shortest-path/dijkstra: invalid graphology instance.");if(e&&!n.hasNode(e))throw new Error('graphology-shortest-path/dijkstra: the "'+e+'" source node does not exist in the given graph.');if(t&&!n.hasNode(t))throw new Error('graphology-shortest-path/dijkstra: the "'+t+'" target node does not exist in the given graph.');if(i=B4(i||D4).fromMinimalEntry,e===t)return[0,[e]];var r=[{},{}],s=[{},{}],a=[new Km(Ty),new Km(Ty)],o=[{},{}];s[0][e]=[e],s[1][t]=[t],o[0][e]=0,o[1][t]=0;var l=[],c=1/0,u=0,h=1,f,p,m,y,v,A,_,x,E;for(a[0].push([0,u++,e]),a[1].push([0,u++,t]);a[0].size&&a[1].size;)if(h=1-h,f=a[h].pop(),y=f[0],v=f[2],!(v in r[h])){if(r[h][v]=y,v in r[1-h])return[c,l];for(p=h===1?n.inboundEdges(v):n.outboundEdges(v),x=0,E=p.length;x<E;x++){if(_=p[x],A=n.opposite(v,_),m=r[h][v]+i(_,n.getEdgeAttributes(_)),A in r[h]&&m<r[h][A])throw Error("graphology-shortest-path/dijkstra: contradictory paths found. Do some of your edges have a negative weight?");(!(A in o[h])||m<o[h][A])&&(o[h][A]=m,a[h].push([m,u++,A]),s[h][A]=s[h][v].concat(A),A in o[0]&&A in o[1]&&(y=o[0][A]+o[1][A],(l.length===0||c>y)&&(c=y,l=s[0][A].concat(s[1][A].slice(0,-1).reverse()))))}}return[1/0,null]}function oq(n,e,t,i,r,s){if(!RI(n))throw new Error("graphology-shortest-path/dijkstra: invalid graphology instance.");if(r&&!n.hasNode(r))throw new Error('graphology-shortest-path/dijkstra: the "'+r+'" target node does not exist in the given graph.');t=B4(t||D4).fromMinimalEntry;var a={},o={},l=new Km(Ty),c=0,u,h,f,p,m,y,v,A,_,x,E;for(A=0,x=e.length;A<x;A++)p=e[A],o[p]=0,l.push([0,c++,p]),s&&(s[p]=[p]);for(;l.size;)if(h=l.pop(),v=h[0],p=h[2],!(p in a)){if(a[p]=v,p===r)break;for(u=n.outboundEdges(p),_=0,E=u.length;_<E;_++)if(y=u[_],m=n.opposite(p,y),f=t(y,n.getEdgeAttributes(y))+a[p],!(i&&f>i)){if(m in a&&f<a[m])throw Error("graphology-shortest-path/dijkstra: contradictory paths found. Do some of your edges have a negative weight?");(!(m in o)||f<o[m])&&(o[m]=f,l.push([f,c++,m]),s&&(s[m]=s[p].concat(m)))}}return a}function lq(n,e,t){var i={};return oq(n,[e],t,0,null,i),i}function cq(n,e,t,i){return aq(n,e,t,i)[1]}function uq(n,e,t){e=""+e,t=B4(t||D4).fromMinimalEntry;var i=[],r={},s={},a=n.nodes(),o,l,c,u,h,f,p,m,y,v;for(y=0,v=a.length;y<v;y++)f=a[y],r[f]=[],s[f]=0;var A={};s[e]=1;var _={};_[e]=0;var x=0,E=new Km(sq);for(E.push([0,x++,e,e]);E.size;)if(l=E.pop(),u=l[0],c=l[2],f=l[3],!(f in A))for(s[f]+=s[c],i.push(f),A[f]=u,o=n.outboundEdges(f),y=0,v=o.length;y<v;y++)m=o[y],p=n.opposite(f,m),h=u+t(m,n.getEdgeAttributes(m)),!(p in A)&&(!(p in _)||h<_[p])?(_[p]=h,E.push([h,x++,f,p]),s[p]=0,r[p]=[f]):h===_[p]&&(s[p]+=s[f],r[p].push(f));return[i,r,s]}C4.bidirectional=cq;C4.singleSource=lq;C4.brandes=uq;var C0=gf;C0.bidirectional;C0.singleSource;C0.singleSourceLength;C0.undirectedSingleSourceLength;C0.brandes;var P4={exports:{}},kh=typeof Reflect=="object"?Reflect:null,Y7=kh&&typeof kh.apply=="function"?kh.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},Am;kh&&typeof kh.ownKeys=="function"?Am=kh.ownKeys:Object.getOwnPropertySymbols?Am=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Am=function(e){return Object.getOwnPropertyNames(e)};function hq(n){console&&console.warn&&console.warn(n)}var BI=Number.isNaN||function(e){return e!==e};function bn(){bn.init.call(this)}P4.exports=bn;P4.exports.once=gq;bn.EventEmitter=bn;bn.prototype._events=void 0;bn.prototype._eventsCount=0;bn.prototype._maxListeners=void 0;var q7=10;function m1(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(bn,"defaultMaxListeners",{enumerable:!0,get:function(){return q7},set:function(n){if(typeof n!="number"||n<0||BI(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");q7=n}});bn.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};bn.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||BI(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function DI(n){return n._maxListeners===void 0?bn.defaultMaxListeners:n._maxListeners}bn.prototype.getMaxListeners=function(){return DI(this)};bn.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var r=e==="error",s=this._events;if(s!==void 0)r=r&&s.error===void 0;else if(!r)return!1;if(r){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var l=s[e];if(l===void 0)return!1;if(typeof l=="function")Y7(l,this,t);else for(var c=l.length,u=FI(l,c),i=0;i<c;++i)Y7(u[i],this,t);return!0};function PI(n,e,t,i){var r,s,a;if(m1(t),s=n._events,s===void 0?(s=n._events=Object.create(null),n._eventsCount=0):(s.newListener!==void 0&&(n.emit("newListener",e,t.listener?t.listener:t),s=n._events),a=s[e]),a===void 0)a=s[e]=t,++n._eventsCount;else if(typeof a=="function"?a=s[e]=i?[t,a]:[a,t]:i?a.unshift(t):a.push(t),r=DI(n),r>0&&a.length>r&&!a.warned){a.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=n,o.type=e,o.count=a.length,hq(o)}return n}bn.prototype.addListener=function(e,t){return PI(this,e,t,!1)};bn.prototype.on=bn.prototype.addListener;bn.prototype.prependListener=function(e,t){return PI(this,e,t,!0)};function fq(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function LI(n,e,t){var i={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},r=fq.bind(i);return r.listener=t,i.wrapFn=r,r}bn.prototype.once=function(e,t){return m1(t),this.on(e,LI(this,e,t)),this};bn.prototype.prependOnceListener=function(e,t){return m1(t),this.prependListener(e,LI(this,e,t)),this};bn.prototype.removeListener=function(e,t){var i,r,s,a,o;if(m1(t),r=this._events,r===void 0)return this;if(i=r[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(s=-1,a=i.length-1;a>=0;a--)if(i[a]===t||i[a].listener===t){o=i[a].listener,s=a;break}if(s<0)return this;s===0?i.shift():dq(i,s),i.length===1&&(r[e]=i[0]),r.removeListener!==void 0&&this.emit("removeListener",e,o||t)}return this};bn.prototype.off=bn.prototype.removeListener;bn.prototype.removeAllListeners=function(e){var t,i,r;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),a;for(r=0;r<s.length;++r)a=s[r],a!=="removeListener"&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=i[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function UI(n,e,t){var i=n._events;if(i===void 0)return[];var r=i[e];return r===void 0?[]:typeof r=="function"?t?[r.listener||r]:[r]:t?pq(r):FI(r,r.length)}bn.prototype.listeners=function(e){return UI(this,e,!0)};bn.prototype.rawListeners=function(e){return UI(this,e,!1)};bn.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):OI.call(n,e)};bn.prototype.listenerCount=OI;function OI(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}bn.prototype.eventNames=function(){return this._eventsCount>0?Am(this._events):[]};function FI(n,e){for(var t=new Array(e),i=0;i<e;++i)t[i]=n[i];return t}function dq(n,e){for(;e+1<n.length;e++)n[e]=n[e+1];n.pop()}function pq(n){for(var e=new Array(n.length),t=0;t<e.length;++t)e[t]=n[t].listener||n[t];return e}function gq(n,e){return new Promise(function(t,i){function r(a){n.removeListener(e,s),i(a)}function s(){typeof n.removeListener=="function"&&n.removeListener("error",r),t([].slice.call(arguments))}kI(n,e,s,{once:!0}),e!=="error"&&mq(n,r,{once:!0})})}function mq(n,e,t){typeof n.on=="function"&&kI(n,"error",e,t)}function kI(n,e,t,i){if(typeof n.on=="function")i.once?n.once(e,t):n.on(e,t);else if(typeof n.addEventListener=="function")n.addEventListener(e,function r(s){i.once&&n.removeEventListener(e,r),t(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof n)}var Aq=P4.exports,vq=d1,NI=p1,yq=NI.ARRAY_BUFFER_SUPPORT,xq=NI.SYMBOL_SUPPORT;function _q(n){return typeof n=="string"||Array.isArray(n)||yq&&ArrayBuffer.isView(n)?vq.fromSequence(n):typeof n!="object"||n===null?null:xq&&typeof n[Symbol.iterator]=="function"?n[Symbol.iterator]():typeof n.next=="function"?n:null}var GI=function(e){var t=_q(e);if(!t)throw new Error("obliterator: target is not iterable nor a valid iterator.");return t},Eq=GI,Sq=function(e,t){for(var i=arguments.length>1?t:1/0,r=i!==1/0?new Array(i):[],s,a=0,o=Eq(e);;){if(a===i)return r;if(s=o.next(),s.done)return a!==t&&(r.length=a),r;r[a++]=s.value}};const zI=ps(Sq);var wq=d1,Cq=GI,Tq=function(){var e=arguments,t=null,i=-1;return new wq(function(){var s=null;do{if(t===null){if(i++,i>=e.length)return{done:!0};t=Cq(e[i])}if(s=t.next(),s.done===!0){t=null;continue}break}while(!0);return s})};const Go=ps(Tq);function bq(){const n=arguments[0];for(let e=1,t=arguments.length;e<t;e++)if(arguments[e])for(const i in arguments[e])n[i]=arguments[e][i];return n}let Mi=bq;typeof Object.assign=="function"&&(Mi=Object.assign);function Gs(n,e,t,i){const r=n._nodes.get(e);let s=null;return r&&(i==="mixed"?s=r.out&&r.out[t]||r.undirected&&r.undirected[t]:i==="directed"?s=r.out&&r.out[t]:s=r.undirected&&r.undirected[t]),s}function ji(n){return typeof n=="object"&&n!==null}function QI(n){let e;for(e in n)return!1;return!0}function Rs(n,e,t){Object.defineProperty(n,e,{enumerable:!1,configurable:!1,writable:!0,value:t})}function na(n,e,t){const i={enumerable:!0,configurable:!0};typeof t=="function"?i.get=t:(i.value=t,i.writable=!1),Object.defineProperty(n,e,i)}function X7(n){return!(!ji(n)||n.attributes&&!Array.isArray(n.attributes))}function Iq(){let n=Math.floor(Math.random()*256)&255;return()=>n++}class L4 extends Error{constructor(e){super(),this.name="GraphError",this.message=e}}class nt extends L4{constructor(e){super(e),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,nt.prototype.constructor)}}class qe extends L4{constructor(e){super(e),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,qe.prototype.constructor)}}class xt extends L4{constructor(e){super(e),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,xt.prototype.constructor)}}function HI(n,e){this.key=n,this.attributes=e,this.clear()}HI.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function VI(n,e){this.key=n,this.attributes=e,this.clear()}VI.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function WI(n,e){this.key=n,this.attributes=e,this.clear()}WI.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function mf(n,e,t,i,r){this.key=e,this.attributes=r,this.undirected=n,this.source=t,this.target=i}mf.prototype.attach=function(){let n="out",e="in";this.undirected&&(n=e="undirected");const t=this.source.key,i=this.target.key;this.source[n][i]=this,!(this.undirected&&t===i)&&(this.target[e][t]=this)};mf.prototype.attachMulti=function(){let n="out",e="in";const t=this.source.key,i=this.target.key;this.undirected&&(n=e="undirected");const r=this.source[n],s=r[i];if(typeof s>"u"){r[i]=this,this.undirected&&t===i||(this.target[e][t]=this);return}s.previous=this,this.next=s,r[i]=this,this.target[e][t]=this};mf.prototype.detach=function(){const n=this.source.key,e=this.target.key;let t="out",i="in";this.undirected&&(t=i="undirected"),delete this.source[t][e],delete this.target[i][n]};mf.prototype.detachMulti=function(){const n=this.source.key,e=this.target.key;let t="out",i="in";this.undirected&&(t=i="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][e],delete this.target[i][n]):(this.next.previous=void 0,this.source[t][e]=this.next,this.target[i][n]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const YI=0,qI=1,Mq=2,XI=3;function Ko(n,e,t,i,r,s,a){let o,l,c,u;if(i=""+i,t===YI){if(o=n._nodes.get(i),!o)throw new qe(`Graph.${e}: could not find the "${i}" node in the graph.`);c=r,u=s}else if(t===XI){if(r=""+r,l=n._edges.get(r),!l)throw new qe(`Graph.${e}: could not find the "${r}" edge in the graph.`);const h=l.source.key,f=l.target.key;if(i===h)o=l.target;else if(i===f)o=l.source;else throw new qe(`Graph.${e}: the "${i}" node is not attached to the "${r}" edge (${h}, ${f}).`);c=s,u=a}else{if(l=n._edges.get(i),!l)throw new qe(`Graph.${e}: could not find the "${i}" edge in the graph.`);t===qI?o=l.source:o=l.target,c=r,u=s}return[o,c,u]}function Rq(n,e,t){n.prototype[e]=function(i,r,s){const[a,o]=Ko(this,e,t,i,r,s);return a.attributes[o]}}function Bq(n,e,t){n.prototype[e]=function(i,r){const[s]=Ko(this,e,t,i,r);return s.attributes}}function Dq(n,e,t){n.prototype[e]=function(i,r,s){const[a,o]=Ko(this,e,t,i,r,s);return a.attributes.hasOwnProperty(o)}}function Pq(n,e,t){n.prototype[e]=function(i,r,s,a){const[o,l,c]=Ko(this,e,t,i,r,s,a);return o.attributes[l]=c,this.emit("nodeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:l}),this}}function Lq(n,e,t){n.prototype[e]=function(i,r,s,a){const[o,l,c]=Ko(this,e,t,i,r,s,a);if(typeof c!="function")throw new nt(`Graph.${e}: updater should be a function.`);const u=o.attributes,h=c(u[l]);return u[l]=h,this.emit("nodeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:l}),this}}function Uq(n,e,t){n.prototype[e]=function(i,r,s){const[a,o]=Ko(this,e,t,i,r,s);return delete a.attributes[o],this.emit("nodeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:o}),this}}function Oq(n,e,t){n.prototype[e]=function(i,r,s){const[a,o]=Ko(this,e,t,i,r,s);if(!ji(o))throw new nt(`Graph.${e}: provided attributes are not a plain object.`);return a.attributes=o,this.emit("nodeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}function Fq(n,e,t){n.prototype[e]=function(i,r,s){const[a,o]=Ko(this,e,t,i,r,s);if(!ji(o))throw new nt(`Graph.${e}: provided attributes are not a plain object.`);return Mi(a.attributes,o),this.emit("nodeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:o}),this}}function kq(n,e,t){n.prototype[e]=function(i,r,s){const[a,o]=Ko(this,e,t,i,r,s);if(typeof o!="function")throw new nt(`Graph.${e}: provided updater is not a function.`);return a.attributes=o(a.attributes),this.emit("nodeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}const Nq=[{name:n=>`get${n}Attribute`,attacher:Rq},{name:n=>`get${n}Attributes`,attacher:Bq},{name:n=>`has${n}Attribute`,attacher:Dq},{name:n=>`set${n}Attribute`,attacher:Pq},{name:n=>`update${n}Attribute`,attacher:Lq},{name:n=>`remove${n}Attribute`,attacher:Uq},{name:n=>`replace${n}Attributes`,attacher:Oq},{name:n=>`merge${n}Attributes`,attacher:Fq},{name:n=>`update${n}Attributes`,attacher:kq}];function Gq(n){Nq.forEach(function({name:e,attacher:t}){t(n,e("Node"),YI),t(n,e("Source"),qI),t(n,e("Target"),Mq),t(n,e("Opposite"),XI)})}function zq(n,e,t){n.prototype[e]=function(i,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+i,o=""+r;if(r=arguments[2],s=Gs(this,a,o,t),!s)throw new qe(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,s=this._edges.get(i),!s)throw new qe(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return s.attributes[r]}}function Qq(n,e,t){n.prototype[e]=function(i){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+i,a=""+arguments[1];if(r=Gs(this,s,a,t),!r)throw new qe(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,r=this._edges.get(i),!r)throw new qe(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return r.attributes}}function Hq(n,e,t){n.prototype[e]=function(i,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+i,o=""+r;if(r=arguments[2],s=Gs(this,a,o,t),!s)throw new qe(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,s=this._edges.get(i),!s)throw new qe(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return s.attributes.hasOwnProperty(r)}}function Vq(n,e,t){n.prototype[e]=function(i,r,s){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+i,l=""+r;if(r=arguments[2],s=arguments[3],a=Gs(this,o,l,t),!a)throw new qe(`Graph.${e}: could not find an edge for the given path ("${o}" - "${l}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,a=this._edges.get(i),!a)throw new qe(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return a.attributes[r]=s,this.emit("edgeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:r}),this}}function Wq(n,e,t){n.prototype[e]=function(i,r,s){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+i,l=""+r;if(r=arguments[2],s=arguments[3],a=Gs(this,o,l,t),!a)throw new qe(`Graph.${e}: could not find an edge for the given path ("${o}" - "${l}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,a=this._edges.get(i),!a)throw new qe(`Graph.${e}: could not find the "${i}" edge in the graph.`)}if(typeof s!="function")throw new nt(`Graph.${e}: updater should be a function.`);return a.attributes[r]=s(a.attributes[r]),this.emit("edgeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:r}),this}}function Yq(n,e,t){n.prototype[e]=function(i,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+i,o=""+r;if(r=arguments[2],s=Gs(this,a,o,t),!s)throw new qe(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,s=this._edges.get(i),!s)throw new qe(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return delete s.attributes[r],this.emit("edgeAttributesUpdated",{key:s.key,type:"remove",attributes:s.attributes,name:r}),this}}function qq(n,e,t){n.prototype[e]=function(i,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+i,o=""+r;if(r=arguments[2],s=Gs(this,a,o,t),!s)throw new qe(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,s=this._edges.get(i),!s)throw new qe(`Graph.${e}: could not find the "${i}" edge in the graph.`)}if(!ji(r))throw new nt(`Graph.${e}: provided attributes are not a plain object.`);return s.attributes=r,this.emit("edgeAttributesUpdated",{key:s.key,type:"replace",attributes:s.attributes}),this}}function Xq(n,e,t){n.prototype[e]=function(i,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+i,o=""+r;if(r=arguments[2],s=Gs(this,a,o,t),!s)throw new qe(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,s=this._edges.get(i),!s)throw new qe(`Graph.${e}: could not find the "${i}" edge in the graph.`)}if(!ji(r))throw new nt(`Graph.${e}: provided attributes are not a plain object.`);return Mi(s.attributes,r),this.emit("edgeAttributesUpdated",{key:s.key,type:"merge",attributes:s.attributes,data:r}),this}}function jq(n,e,t){n.prototype[e]=function(i,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+i,o=""+r;if(r=arguments[2],s=Gs(this,a,o,t),!s)throw new qe(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,s=this._edges.get(i),!s)throw new qe(`Graph.${e}: could not find the "${i}" edge in the graph.`)}if(typeof r!="function")throw new nt(`Graph.${e}: provided updater is not a function.`);return s.attributes=r(s.attributes),this.emit("edgeAttributesUpdated",{key:s.key,type:"update",attributes:s.attributes}),this}}const Kq=[{name:n=>`get${n}Attribute`,attacher:zq},{name:n=>`get${n}Attributes`,attacher:Qq},{name:n=>`has${n}Attribute`,attacher:Hq},{name:n=>`set${n}Attribute`,attacher:Vq},{name:n=>`update${n}Attribute`,attacher:Wq},{name:n=>`remove${n}Attribute`,attacher:Yq},{name:n=>`replace${n}Attributes`,attacher:qq},{name:n=>`merge${n}Attributes`,attacher:Xq},{name:n=>`update${n}Attributes`,attacher:jq}];function $q(n){Kq.forEach(function({name:e,attacher:t}){t(n,e("Edge"),"mixed"),t(n,e("DirectedEdge"),"directed"),t(n,e("UndirectedEdge"),"undirected")})}const Jq=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function Zq(n,e,t,i){let r=!1;for(const s in e){if(s===i)continue;const a=e[s];if(r=t(a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes,a.undirected),n&&r)return a.key}}function eX(n,e,t,i){let r,s,a,o=!1;for(const l in e)if(l!==i){r=e[l];do{if(s=r.source,a=r.target,o=t(r.key,r.attributes,s.key,a.key,s.attributes,a.attributes,r.undirected),n&&o)return r.key;r=r.next}while(r!==void 0)}}function Wv(n,e){const t=Object.keys(n),i=t.length;let r,s=0;return new Hs(function(){do if(r)r=r.next;else{if(s>=i)return{done:!0};const o=t[s++];if(o===e){r=void 0;continue}r=n[o]}while(!r);return{done:!1,value:{edge:r.key,attributes:r.attributes,source:r.source.key,target:r.target.key,sourceAttributes:r.source.attributes,targetAttributes:r.target.attributes,undirected:r.undirected}}})}function tX(n,e,t,i){const r=e[t];if(!r)return;const s=r.source,a=r.target;if(i(r.key,r.attributes,s.key,a.key,s.attributes,a.attributes,r.undirected)&&n)return r.key}function nX(n,e,t,i){let r=e[t];if(!r)return;let s=!1;do{if(s=i(r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes,r.undirected),n&&s)return r.key;r=r.next}while(r!==void 0)}function Yv(n,e){let t=n[e];return t.next!==void 0?new Hs(function(){if(!t)return{done:!0};const i={edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected};return t=t.next,{done:!1,value:i}}):Hs.of({edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected})}function iX(n,e){if(n.size===0)return[];if(e==="mixed"||e===n.type)return typeof Array.from=="function"?Array.from(n._edges.keys()):zI(n._edges.keys(),n._edges.size);const t=e==="undirected"?n.undirectedSize:n.directedSize,i=new Array(t),r=e==="undirected",s=n._edges.values();let a=0,o,l;for(;o=s.next(),o.done!==!0;)l=o.value,l.undirected===r&&(i[a++]=l.key);return i}function jI(n,e,t,i){if(e.size===0)return;const r=t!=="mixed"&&t!==e.type,s=t==="undirected";let a,o,l=!1;const c=e._edges.values();for(;a=c.next(),a.done!==!0;){if(o=a.value,r&&o.undirected!==s)continue;const{key:u,attributes:h,source:f,target:p}=o;if(l=i(u,h,f.key,p.key,f.attributes,p.attributes,o.undirected),n&&l)return u}}function rX(n,e){if(n.size===0)return Hs.empty();const t=e!=="mixed"&&e!==n.type,i=e==="undirected",r=n._edges.values();return new Hs(function(){let a,o;for(;;){if(a=r.next(),a.done)return a;if(o=a.value,!(t&&o.undirected!==i))break}return{value:{edge:o.key,attributes:o.attributes,source:o.source.key,target:o.target.key,sourceAttributes:o.source.attributes,targetAttributes:o.target.attributes,undirected:o.undirected},done:!1}})}function U4(n,e,t,i,r,s){const a=e?eX:Zq;let o;if(t!=="undirected"&&(i!=="out"&&(o=a(n,r.in,s),n&&o)||i!=="in"&&(o=a(n,r.out,s,i?void 0:r.key),n&&o))||t!=="directed"&&(o=a(n,r.undirected,s),n&&o))return o}function sX(n,e,t,i){const r=[];return U4(!1,n,e,t,i,function(s){r.push(s)}),r}function aX(n,e,t){let i=Hs.empty();return n!=="undirected"&&(e!=="out"&&typeof t.in<"u"&&(i=Go(i,Wv(t.in))),e!=="in"&&typeof t.out<"u"&&(i=Go(i,Wv(t.out,e?void 0:t.key)))),n!=="directed"&&typeof t.undirected<"u"&&(i=Go(i,Wv(t.undirected))),i}function O4(n,e,t,i,r,s,a){const o=t?nX:tX;let l;if(e!=="undirected"&&(typeof r.in<"u"&&i!=="out"&&(l=o(n,r.in,s,a),n&&l)||typeof r.out<"u"&&i!=="in"&&(i||r.key!==s)&&(l=o(n,r.out,s,a),n&&l))||e!=="directed"&&typeof r.undirected<"u"&&(l=o(n,r.undirected,s,a),n&&l))return l}function oX(n,e,t,i,r){const s=[];return O4(!1,n,e,t,i,r,function(a){s.push(a)}),s}function lX(n,e,t,i){let r=Hs.empty();return n!=="undirected"&&(typeof t.in<"u"&&e!=="out"&&i in t.in&&(r=Go(r,Yv(t.in,i))),typeof t.out<"u"&&e!=="in"&&i in t.out&&(e||t.key!==i)&&(r=Go(r,Yv(t.out,i)))),n!=="directed"&&typeof t.undirected<"u"&&i in t.undirected&&(r=Go(r,Yv(t.undirected,i))),r}function cX(n,e){const{name:t,type:i,direction:r}=e;n.prototype[t]=function(s,a){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return[];if(!arguments.length)return iX(this,i);if(arguments.length===1){s=""+s;const o=this._nodes.get(s);if(typeof o>"u")throw new qe(`Graph.${t}: could not find the "${s}" node in the graph.`);return sX(this.multi,i==="mixed"?this.type:i,r,o)}if(arguments.length===2){s=""+s,a=""+a;const o=this._nodes.get(s);if(!o)throw new qe(`Graph.${t}: could not find the "${s}" source node in the graph.`);if(!this._nodes.has(a))throw new qe(`Graph.${t}: could not find the "${a}" target node in the graph.`);return oX(i,this.multi,r,o,a)}throw new nt(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function uX(n,e){const{name:t,type:i,direction:r}=e,s="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(c,u,h){if(!(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)){if(arguments.length===1)return h=c,jI(!1,this,i,h);if(arguments.length===2){c=""+c,h=u;const f=this._nodes.get(c);if(typeof f>"u")throw new qe(`Graph.${s}: could not find the "${c}" node in the graph.`);return U4(!1,this.multi,i==="mixed"?this.type:i,r,f,h)}if(arguments.length===3){c=""+c,u=""+u;const f=this._nodes.get(c);if(!f)throw new qe(`Graph.${s}: could not find the "${c}" source node in the graph.`);if(!this._nodes.has(u))throw new qe(`Graph.${s}: could not find the "${u}" target node in the graph.`);return O4(!1,i,this.multi,r,f,u,h)}throw new nt(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const a="map"+t[0].toUpperCase()+t.slice(1);n.prototype[a]=function(){const c=Array.prototype.slice.call(arguments),u=c.pop();let h;if(c.length===0){let f=0;i!=="directed"&&(f+=this.undirectedSize),i!=="undirected"&&(f+=this.directedSize),h=new Array(f);let p=0;c.push((m,y,v,A,_,x,E)=>{h[p++]=u(m,y,v,A,_,x,E)})}else h=[],c.push((f,p,m,y,v,A,_)=>{h.push(u(f,p,m,y,v,A,_))});return this[s].apply(this,c),h};const o="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(){const c=Array.prototype.slice.call(arguments),u=c.pop(),h=[];return c.push((f,p,m,y,v,A,_)=>{u(f,p,m,y,v,A,_)&&h.push(f)}),this[s].apply(this,c),h};const l="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[l]=function(){let c=Array.prototype.slice.call(arguments);if(c.length<2||c.length>4)throw new nt(`Graph.${l}: invalid number of arguments (expecting 2, 3 or 4 and got ${c.length}).`);if(typeof c[c.length-1]=="function"&&typeof c[c.length-2]!="function")throw new nt(`Graph.${l}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let u,h;c.length===2?(u=c[0],h=c[1],c=[]):c.length===3?(u=c[1],h=c[2],c=[c[0]]):c.length===4&&(u=c[2],h=c[3],c=[c[0],c[1]]);let f=h;return c.push((p,m,y,v,A,_,x)=>{f=u(f,p,m,y,v,A,_,x)}),this[s].apply(this,c),f}}function hX(n,e){const{name:t,type:i,direction:r}=e,s="find"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(l,c,u){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return!1;if(arguments.length===1)return u=l,jI(!0,this,i,u);if(arguments.length===2){l=""+l,u=c;const h=this._nodes.get(l);if(typeof h>"u")throw new qe(`Graph.${s}: could not find the "${l}" node in the graph.`);return U4(!0,this.multi,i==="mixed"?this.type:i,r,h,u)}if(arguments.length===3){l=""+l,c=""+c;const h=this._nodes.get(l);if(!h)throw new qe(`Graph.${s}: could not find the "${l}" source node in the graph.`);if(!this._nodes.has(c))throw new qe(`Graph.${s}: could not find the "${c}" target node in the graph.`);return O4(!0,i,this.multi,r,h,c,u)}throw new nt(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const a="some"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(){const l=Array.prototype.slice.call(arguments),c=l.pop();return l.push((h,f,p,m,y,v,A)=>c(h,f,p,m,y,v,A)),!!this[s].apply(this,l)};const o="every"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(){const l=Array.prototype.slice.call(arguments),c=l.pop();return l.push((h,f,p,m,y,v,A)=>!c(h,f,p,m,y,v,A)),!this[s].apply(this,l)}}function fX(n,e){const{name:t,type:i,direction:r}=e,s=t.slice(0,-1)+"Entries";n.prototype[s]=function(a,o){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return Hs.empty();if(!arguments.length)return rX(this,i);if(arguments.length===1){a=""+a;const l=this._nodes.get(a);if(!l)throw new qe(`Graph.${s}: could not find the "${a}" node in the graph.`);return aX(i,r,l)}if(arguments.length===2){a=""+a,o=""+o;const l=this._nodes.get(a);if(!l)throw new qe(`Graph.${s}: could not find the "${a}" source node in the graph.`);if(!this._nodes.has(o))throw new qe(`Graph.${s}: could not find the "${o}" target node in the graph.`);return lX(i,r,l,o)}throw new nt(`Graph.${s}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function dX(n){Jq.forEach(e=>{cX(n,e),uX(n,e),hX(n,e),fX(n,e)})}const pX=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function A1(){this.A=null,this.B=null}A1.prototype.wrap=function(n){this.A===null?this.A=n:this.B===null&&(this.B=n)};A1.prototype.has=function(n){return this.A!==null&&n in this.A||this.B!==null&&n in this.B};function pd(n,e,t,i,r){for(const s in i){const a=i[s],o=a.source,l=a.target,c=o===t?l:o;if(e&&e.has(c.key))continue;const u=r(c.key,c.attributes);if(n&&u)return c.key}}function F4(n,e,t,i,r){if(e!=="mixed"){if(e==="undirected")return pd(n,null,i,i.undirected,r);if(typeof t=="string")return pd(n,null,i,i[t],r)}const s=new A1;let a;if(e!=="undirected"){if(t!=="out"){if(a=pd(n,null,i,i.in,r),n&&a)return a;s.wrap(i.in)}if(t!=="in"){if(a=pd(n,s,i,i.out,r),n&&a)return a;s.wrap(i.out)}}if(e!=="directed"&&(a=pd(n,s,i,i.undirected,r),n&&a))return a}function gX(n,e,t){if(n!=="mixed"){if(n==="undirected")return Object.keys(t.undirected);if(typeof e=="string")return Object.keys(t[e])}const i=[];return F4(!1,n,e,t,function(r){i.push(r)}),i}function gd(n,e,t){const i=Object.keys(t),r=i.length;let s=0;return new Hs(function(){let o=null;do{if(s>=r)return n&&n.wrap(t),{done:!0};const l=t[i[s++]],c=l.source,u=l.target;if(o=c===e?u:c,n&&n.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}})}function mX(n,e,t){if(n!=="mixed"){if(n==="undirected")return gd(null,t,t.undirected);if(typeof e=="string")return gd(null,t,t[e])}let i=Hs.empty();const r=new A1;return n!=="undirected"&&(e!=="out"&&(i=Go(i,gd(r,t,t.in))),e!=="in"&&(i=Go(i,gd(r,t,t.out)))),n!=="directed"&&(i=Go(i,gd(r,t,t.undirected))),i}function AX(n,e){const{name:t,type:i,direction:r}=e;n.prototype[t]=function(s){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return[];s=""+s;const a=this._nodes.get(s);if(typeof a>"u")throw new qe(`Graph.${t}: could not find the "${s}" node in the graph.`);return gX(i==="mixed"?this.type:i,r,a)}}function vX(n,e){const{name:t,type:i,direction:r}=e,s="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(c,u){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return;c=""+c;const h=this._nodes.get(c);if(typeof h>"u")throw new qe(`Graph.${s}: could not find the "${c}" node in the graph.`);F4(!1,i==="mixed"?this.type:i,r,h,u)};const a="map"+t[0].toUpperCase()+t.slice(1);n.prototype[a]=function(c,u){const h=[];return this[s](c,(f,p)=>{h.push(u(f,p))}),h};const o="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(c,u){const h=[];return this[s](c,(f,p)=>{u(f,p)&&h.push(f)}),h};const l="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[l]=function(c,u,h){if(arguments.length<3)throw new nt(`Graph.${l}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let f=h;return this[s](c,(p,m)=>{f=u(f,p,m)}),f}}function yX(n,e){const{name:t,type:i,direction:r}=e,s=t[0].toUpperCase()+t.slice(1,-1),a="find"+s;n.prototype[a]=function(c,u){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return;c=""+c;const h=this._nodes.get(c);if(typeof h>"u")throw new qe(`Graph.${a}: could not find the "${c}" node in the graph.`);return F4(!0,i==="mixed"?this.type:i,r,h,u)};const o="some"+s;n.prototype[o]=function(c,u){return!!this[a](c,u)};const l="every"+s;n.prototype[l]=function(c,u){return!this[a](c,(f,p)=>!u(f,p))}}function xX(n,e){const{name:t,type:i,direction:r}=e,s=t.slice(0,-1)+"Entries";n.prototype[s]=function(a){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return Hs.empty();a=""+a;const o=this._nodes.get(a);if(typeof o>"u")throw new qe(`Graph.${s}: could not find the "${a}" node in the graph.`);return mX(i==="mixed"?this.type:i,r,o)}}function _X(n){pX.forEach(e=>{AX(n,e),vX(n,e),yX(n,e),xX(n,e)})}function Ug(n,e,t,i,r){const s=i._nodes.values(),a=i.type;let o,l,c,u,h,f,p;for(;o=s.next(),o.done!==!0;){let m=!1;if(l=o.value,a!=="undirected"){u=l.out;for(c in u){h=u[c];do{if(f=h.target,m=!0,p=r(l.key,f.key,l.attributes,f.attributes,h.key,h.attributes,h.undirected),n&&p)return h;h=h.next}while(h)}}if(a!=="directed"){u=l.undirected;for(c in u)if(!(e&&l.key>c)){h=u[c];do{if(f=h.target,f.key!==c&&(f=h.source),m=!0,p=r(l.key,f.key,l.attributes,f.attributes,h.key,h.attributes,h.undirected),n&&p)return h;h=h.next}while(h)}}if(t&&!m&&(p=r(l.key,null,l.attributes,null,null,null,null),n&&p))return null}}function EX(n,e){const t={key:n};return QI(e.attributes)||(t.attributes=Mi({},e.attributes)),t}function SX(n,e,t){const i={key:e,source:t.source.key,target:t.target.key};return QI(t.attributes)||(i.attributes=Mi({},t.attributes)),n==="mixed"&&t.undirected&&(i.undirected=!0),i}function wX(n){if(!ji(n))throw new nt('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in n))throw new nt("Graph.import: serialized node is missing its key.");if("attributes"in n&&(!ji(n.attributes)||n.attributes===null))throw new nt("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function CX(n){if(!ji(n))throw new nt('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in n))throw new nt("Graph.import: serialized edge is missing its source.");if(!("target"in n))throw new nt("Graph.import: serialized edge is missing its target.");if("attributes"in n&&(!ji(n.attributes)||n.attributes===null))throw new nt("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in n&&typeof n.undirected!="boolean")throw new nt("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const TX=Iq(),bX=new Set(["directed","undirected","mixed"]),j7=new Set(["domain","_events","_eventsCount","_maxListeners"]),IX=[{name:n=>`${n}Edge`,generateKey:!0},{name:n=>`${n}DirectedEdge`,generateKey:!0,type:"directed"},{name:n=>`${n}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:n=>`${n}EdgeWithKey`},{name:n=>`${n}DirectedEdgeWithKey`,type:"directed"},{name:n=>`${n}UndirectedEdgeWithKey`,type:"undirected"}],MX={allowSelfLoops:!0,multi:!1,type:"mixed"};function RX(n,e,t){if(t&&!ji(t))throw new nt(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(e=""+e,t=t||{},n._nodes.has(e))throw new xt(`Graph.addNode: the "${e}" node already exist in the graph.`);const i=new n.NodeDataClass(e,t);return n._nodes.set(e,i),n.emit("nodeAdded",{key:e,attributes:t}),i}function K7(n,e,t){const i=new n.NodeDataClass(e,t);return n._nodes.set(e,i),n.emit("nodeAdded",{key:e,attributes:t}),i}function KI(n,e,t,i,r,s,a,o){if(!i&&n.type==="undirected")throw new xt(`Graph.${e}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(i&&n.type==="directed")throw new xt(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(o&&!ji(o))throw new nt(`Graph.${e}: invalid attributes. Expecting an object but got "${o}"`);if(s=""+s,a=""+a,o=o||{},!n.allowSelfLoops&&s===a)throw new xt(`Graph.${e}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const l=n._nodes.get(s),c=n._nodes.get(a);if(!l)throw new qe(`Graph.${e}: source node "${s}" not found.`);if(!c)throw new qe(`Graph.${e}: target node "${a}" not found.`);const u={key:null,undirected:i,source:s,target:a,attributes:o};if(t)r=n._edgeKeyGenerator();else if(r=""+r,n._edges.has(r))throw new xt(`Graph.${e}: the "${r}" edge already exists in the graph.`);if(!n.multi&&(i?typeof l.undirected[a]<"u":typeof l.out[a]<"u"))throw new xt(`Graph.${e}: an edge linking "${s}" to "${a}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const h=new mf(i,r,l,c,o);n._edges.set(r,h);const f=s===a;return i?(l.undirectedDegree++,c.undirectedDegree++,f&&(l.undirectedLoops++,n._undirectedSelfLoopCount++)):(l.outDegree++,c.inDegree++,f&&(l.directedLoops++,n._directedSelfLoopCount++)),n.multi?h.attachMulti():h.attach(),i?n._undirectedSize++:n._directedSize++,u.key=r,n.emit("edgeAdded",u),r}function BX(n,e,t,i,r,s,a,o,l){if(!i&&n.type==="undirected")throw new xt(`Graph.${e}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(i&&n.type==="directed")throw new xt(`Graph.${e}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(o){if(l){if(typeof o!="function")throw new nt(`Graph.${e}: invalid updater function. Expecting a function but got "${o}"`)}else if(!ji(o))throw new nt(`Graph.${e}: invalid attributes. Expecting an object but got "${o}"`)}s=""+s,a=""+a;let c;if(l&&(c=o,o=void 0),!n.allowSelfLoops&&s===a)throw new xt(`Graph.${e}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let u=n._nodes.get(s),h=n._nodes.get(a),f,p;if(!t&&(f=n._edges.get(r),f)){if((f.source.key!==s||f.target.key!==a)&&(!i||f.source.key!==a||f.target.key!==s))throw new xt(`Graph.${e}: inconsistency detected when attempting to merge the "${r}" edge with "${s}" source & "${a}" target vs. ("${f.source.key}", "${f.target.key}").`);p=f}if(!p&&!n.multi&&u&&(p=i?u.undirected[a]:u.out[a]),p){const _=[p.key,!1,!1,!1];if(l?!c:!o)return _;if(l){const x=p.attributes;p.attributes=c(x),n.emit("edgeAttributesUpdated",{type:"replace",key:p.key,attributes:p.attributes})}else Mi(p.attributes,o),n.emit("edgeAttributesUpdated",{type:"merge",key:p.key,attributes:p.attributes,data:o});return _}o=o||{},l&&c&&(o=c(o));const m={key:null,undirected:i,source:s,target:a,attributes:o};if(t)r=n._edgeKeyGenerator();else if(r=""+r,n._edges.has(r))throw new xt(`Graph.${e}: the "${r}" edge already exists in the graph.`);let y=!1,v=!1;u||(u=K7(n,s,{}),y=!0,s===a&&(h=u,v=!0)),h||(h=K7(n,a,{}),v=!0),f=new mf(i,r,u,h,o),n._edges.set(r,f);const A=s===a;return i?(u.undirectedDegree++,h.undirectedDegree++,A&&(u.undirectedLoops++,n._undirectedSelfLoopCount++)):(u.outDegree++,h.inDegree++,A&&(u.directedLoops++,n._directedSelfLoopCount++)),n.multi?f.attachMulti():f.attach(),i?n._undirectedSize++:n._directedSize++,m.key=r,n.emit("edgeAdded",m),[r,!0,y,v]}function hh(n,e){n._edges.delete(e.key);const{source:t,target:i,attributes:r}=e,s=e.undirected,a=t===i;s?(t.undirectedDegree--,i.undirectedDegree--,a&&(t.undirectedLoops--,n._undirectedSelfLoopCount--)):(t.outDegree--,i.inDegree--,a&&(t.directedLoops--,n._directedSelfLoopCount--)),n.multi?e.detachMulti():e.detach(),s?n._undirectedSize--:n._directedSize--,n.emit("edgeDropped",{key:e.key,attributes:r,source:t.key,target:i.key,undirected:s})}class In extends Aq.EventEmitter{constructor(e){if(super(),e=Mi({},MX,e),typeof e.multi!="boolean")throw new nt(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!bX.has(e.type))throw new nt(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!="boolean")throw new nt(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);const t=e.type==="mixed"?HI:e.type==="directed"?VI:WI;Rs(this,"NodeDataClass",t);const i="geid_"+TX()+"_";let r=0;const s=()=>{let a;do a=i+r++;while(this._edges.has(a));return a};Rs(this,"_attributes",{}),Rs(this,"_nodes",new Map),Rs(this,"_edges",new Map),Rs(this,"_directedSize",0),Rs(this,"_undirectedSize",0),Rs(this,"_directedSelfLoopCount",0),Rs(this,"_undirectedSelfLoopCount",0),Rs(this,"_edgeKeyGenerator",s),Rs(this,"_options",e),j7.forEach(a=>Rs(this,a,this[a])),na(this,"order",()=>this._nodes.size),na(this,"size",()=>this._edges.size),na(this,"directedSize",()=>this._directedSize),na(this,"undirectedSize",()=>this._undirectedSize),na(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),na(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),na(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),na(this,"multi",this._options.multi),na(this,"type",this._options.type),na(this,"allowSelfLoops",this._options.allowSelfLoops),na(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(""+e)}hasDirectedEdge(e,t){if(this.type==="undirected")return!1;if(arguments.length===1){const i=""+e,r=this._edges.get(i);return!!r&&!r.undirected}else if(arguments.length===2){e=""+e,t=""+t;const i=this._nodes.get(e);return i?i.out.hasOwnProperty(t):!1}throw new nt(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type==="directed")return!1;if(arguments.length===1){const i=""+e,r=this._edges.get(i);return!!r&&r.undirected}else if(arguments.length===2){e=""+e,t=""+t;const i=this._nodes.get(e);return i?i.undirected.hasOwnProperty(t):!1}throw new nt(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){const i=""+e;return this._edges.has(i)}else if(arguments.length===2){e=""+e,t=""+t;const i=this._nodes.get(e);return i?typeof i.out<"u"&&i.out.hasOwnProperty(t)||typeof i.undirected<"u"&&i.undirected.hasOwnProperty(t):!1}throw new nt(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type==="undirected")return;if(e=""+e,t=""+t,this.multi)throw new xt("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const i=this._nodes.get(e);if(!i)throw new qe(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new qe(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const r=i.out&&i.out[t]||void 0;if(r)return r.key}undirectedEdge(e,t){if(this.type==="directed")return;if(e=""+e,t=""+t,this.multi)throw new xt("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const i=this._nodes.get(e);if(!i)throw new qe(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new qe(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const r=i.undirected&&i.undirected[t]||void 0;if(r)return r.key}edge(e,t){if(this.multi)throw new xt("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new qe(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new qe(`Graph.edge: could not find the "${t}" target node in the graph.`);const r=i.out&&i.out[t]||i.undirected&&i.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new qe(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in i.in||t in i.out}areOutNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new qe(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in i.out}areInNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new qe(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in i.in}areUndirectedNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new qe(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="directed"?!1:t in i.undirected}areNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new qe(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&(t in i.in||t in i.out)||this.type!=="directed"&&t in i.undirected}areInboundNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new qe(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in i.in||this.type!=="directed"&&t in i.undirected}areOutboundNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new qe(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in i.out||this.type!=="directed"&&t in i.undirected}inDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let i=0;return this.type!=="directed"&&(i+=t.undirectedDegree),this.type!=="undirected"&&(i+=t.inDegree),i}outboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let i=0;return this.type!=="directed"&&(i+=t.undirectedDegree),this.type!=="undirected"&&(i+=t.outDegree),i}degree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`Graph.degree: could not find the "${e}" node in the graph.`);let i=0;return this.type!=="directed"&&(i+=t.undirectedDegree),this.type!=="undirected"&&(i+=t.inDegree+t.outDegree),i}inDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let i=0,r=0;return this.type!=="directed"&&(i+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(i+=t.inDegree,r+=t.directedLoops),i-r}outboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let i=0,r=0;return this.type!=="directed"&&(i+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(i+=t.outDegree,r+=t.directedLoops),i-r}degreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let i=0,r=0;return this.type!=="directed"&&(i+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(i+=t.inDegree+t.outDegree,r+=t.directedLoops*2),i-r}source(e){e=""+e;const t=this._edges.get(e);if(!t)throw new qe(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=""+e;const t=this._edges.get(e);if(!t)throw new qe(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=""+e;const t=this._edges.get(e);if(!t)throw new qe(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=""+e,t=""+t;const i=this._edges.get(t);if(!i)throw new qe(`Graph.opposite: could not find the "${t}" edge in the graph.`);const r=i.source.key,s=i.target.key;if(e===r)return s;if(e===s)return r;throw new qe(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${r}, ${s}).`)}hasExtremity(e,t){e=""+e,t=""+t;const i=this._edges.get(e);if(!i)throw new qe(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return i.source.key===t||i.target.key===t}isUndirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new qe(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new qe(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=""+e;const t=this._edges.get(e);if(!t)throw new qe(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return RX(this,e,t).key}mergeNode(e,t){if(t&&!ji(t))throw new nt(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=""+e,t=t||{};let i=this._nodes.get(e);return i?(t&&(Mi(i.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:i.attributes,data:t})),[e,!1]):(i=new this.NodeDataClass(e,t),this._nodes.set(e,i),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!="function")throw new nt(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=""+e;let i=this._nodes.get(e);if(i){if(t){const s=i.attributes;i.attributes=t(s),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:i.attributes})}return[e,!1]}const r=t?t({}):{};return i=new this.NodeDataClass(e,r),this._nodes.set(e,i),this.emit("nodeAdded",{key:e,attributes:r}),[e,!0]}dropNode(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`Graph.dropNode: could not find the "${e}" node in the graph.`);let i;if(this.type!=="undirected"){for(const r in t.out){i=t.out[r];do hh(this,i),i=i.next;while(i)}for(const r in t.in){i=t.in[r];do hh(this,i),i=i.next;while(i)}}if(this.type!=="directed")for(const r in t.undirected){i=t.undirected[r];do hh(this,i),i=i.next;while(i)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){const i=""+arguments[0],r=""+arguments[1];if(t=Gs(this,i,r,this.type),!t)throw new qe(`Graph.dropEdge: could not find the "${i}" -> "${r}" edge in the graph.`)}else if(e=""+e,t=this._edges.get(e),!t)throw new qe(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return hh(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new xt("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new xt("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");e=""+e,t=""+t;const i=Gs(this,e,t,"directed");if(!i)throw new qe(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return hh(this,i),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new xt("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new xt("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const i=Gs(this,e,t,"undirected");if(!i)throw new qe(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return hh(this,i),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const e=this._nodes.values();let t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!="function")throw new nt("Graph.updateAttribute: updater should be a function.");const i=this._attributes[e];return this._attributes[e]=t(i),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!ji(e))throw new nt("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(e){if(!ji(e))throw new nt("Graph.mergeAttributes: provided attributes are not a plain object.");return Mi(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!="function")throw new nt("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!="function")throw new nt("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!X7(t))throw new nt("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const i=this._nodes.values();let r,s;for(;r=i.next(),r.done!==!0;)s=r.value,s.attributes=e(s.key,s.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!="function")throw new nt("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!X7(t))throw new nt("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const i=this._edges.values();let r,s,a,o;for(;r=i.next(),r.done!==!0;)s=r.value,a=s.source,o=s.target,s.attributes=e(s.key,s.attributes,a.key,o.key,a.attributes,o.attributes,s.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!="function")throw new nt("Graph.forEachAdjacencyEntry: expecting a callback.");Ug(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new nt("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");Ug(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!="function")throw new nt("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");Ug(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new nt("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");Ug(!1,!0,!0,this,e)}nodes(){return typeof Array.from=="function"?Array.from(this._nodes.keys()):zI(this._nodes.keys(),this._nodes.size)}forEachNode(e){if(typeof e!="function")throw new nt("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let i,r;for(;i=t.next(),i.done!==!0;)r=i.value,e(r.key,r.attributes)}findNode(e){if(typeof e!="function")throw new nt("Graph.findNode: expecting a callback.");const t=this._nodes.values();let i,r;for(;i=t.next(),i.done!==!0;)if(r=i.value,e(r.key,r.attributes))return r.key}mapNodes(e){if(typeof e!="function")throw new nt("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let i,r;const s=new Array(this.order);let a=0;for(;i=t.next(),i.done!==!0;)r=i.value,s[a++]=e(r.key,r.attributes);return s}someNode(e){if(typeof e!="function")throw new nt("Graph.someNode: expecting a callback.");const t=this._nodes.values();let i,r;for(;i=t.next(),i.done!==!0;)if(r=i.value,e(r.key,r.attributes))return!0;return!1}everyNode(e){if(typeof e!="function")throw new nt("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let i,r;for(;i=t.next(),i.done!==!0;)if(r=i.value,!e(r.key,r.attributes))return!1;return!0}filterNodes(e){if(typeof e!="function")throw new nt("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let i,r;const s=[];for(;i=t.next(),i.done!==!0;)r=i.value,e(r.key,r.attributes)&&s.push(r.key);return s}reduceNodes(e,t){if(typeof e!="function")throw new nt("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new nt("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let i=t;const r=this._nodes.values();let s,a;for(;s=r.next(),s.done!==!0;)a=s.value,i=e(i,a.key,a.attributes);return i}nodeEntries(){const e=this._nodes.values();return new Hs(()=>{const t=e.next();if(t.done)return t;const i=t.value;return{value:{node:i.key,attributes:i.attributes},done:!1}})}export(){const e=new Array(this._nodes.size);let t=0;this._nodes.forEach((r,s)=>{e[t++]=EX(s,r)});const i=new Array(this._edges.size);return t=0,this._edges.forEach((r,s)=>{i[t++]=SX(this.type,s,r)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:i}}import(e,t=!1){if(e instanceof In)return e.forEachNode((l,c)=>{t?this.mergeNode(l,c):this.addNode(l,c)}),e.forEachEdge((l,c,u,h,f,p,m)=>{t?m?this.mergeUndirectedEdgeWithKey(l,u,h,c):this.mergeDirectedEdgeWithKey(l,u,h,c):m?this.addUndirectedEdgeWithKey(l,u,h,c):this.addDirectedEdgeWithKey(l,u,h,c)}),this;if(!ji(e))throw new nt("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!ji(e.attributes))throw new nt("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}let i,r,s,a,o;if(e.nodes){if(s=e.nodes,!Array.isArray(s))throw new nt("Graph.import: invalid nodes. Expecting an array.");for(i=0,r=s.length;i<r;i++){a=s[i],wX(a);const{key:l,attributes:c}=a;t?this.mergeNode(l,c):this.addNode(l,c)}}if(e.edges){let l=!1;if(this.type==="undirected"&&(l=!0),s=e.edges,!Array.isArray(s))throw new nt("Graph.import: invalid edges. Expecting an array.");for(i=0,r=s.length;i<r;i++){o=s[i],CX(o);const{source:c,target:u,attributes:h,undirected:f=l}=o;let p;"key"in o?(p=t?f?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:f?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,p.call(this,o.key,c,u,h)):(p=t?f?this.mergeUndirectedEdge:this.mergeDirectedEdge:f?this.addUndirectedEdge:this.addDirectedEdge,p.call(this,c,u,h))}}return this}nullCopy(e){const t=new In(Mi({},this._options,e));return t.replaceAttributes(Mi({},this.getAttributes())),t}emptyCopy(e){const t=this.nullCopy(e);return this._nodes.forEach((i,r)=>{const s=Mi({},i.attributes);i=new t.NodeDataClass(r,s),t._nodes.set(r,i)}),t}copy(e){if(e=e||{},typeof e.type=="string"&&e.type!==this.type&&e.type!=="mixed")throw new xt(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi=="boolean"&&e.multi!==this.multi&&e.multi!==!0)throw new xt("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof e.allowSelfLoops=="boolean"&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new xt("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(e),i=this._edges.values();let r,s;for(;r=i.next(),r.done!==!0;)s=r.value,KI(t,"copy",!1,s.undirected,s.key,s.source.key,s.target.key,Mi({},s.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const e={};this._nodes.forEach((s,a)=>{e[a]=s.attributes});const t={},i={};this._edges.forEach((s,a)=>{const o=s.undirected?"--":"->";let l="",c=s.source.key,u=s.target.key,h;s.undirected&&c>u&&(h=c,c=u,u=h);const f=`(${c})${o}(${u})`;a.startsWith("geid_")?this.multi&&(typeof i[f]>"u"?i[f]=0:i[f]++,l+=`${i[f]}. `):l+=`[${a}]: `,l+=f,t[l]=s.attributes});const r={};for(const s in this)this.hasOwnProperty(s)&&!j7.has(s)&&typeof this[s]!="function"&&typeof s!="symbol"&&(r[s]=this[s]);return r.attributes=this._attributes,r.nodes=e,r.edges=t,Rs(r,"constructor",this.constructor),r}}typeof Symbol<"u"&&(In.prototype[Symbol.for("nodejs.util.inspect.custom")]=In.prototype.inspect);IX.forEach(n=>{["add","merge","update"].forEach(e=>{const t=n.name(e),i=e==="add"?KI:BX;n.generateKey?In.prototype[t]=function(r,s,a){return i(this,t,!0,(n.type||this.type)==="undirected",null,r,s,a,e==="update")}:In.prototype[t]=function(r,s,a,o){return i(this,t,!1,(n.type||this.type)==="undirected",r,s,a,o,e==="update")}})});Gq(In);$q(In);dX(In);_X(In);class $I extends In{constructor(e){const t=Mi({type:"directed"},e);if("multi"in t&&t.multi!==!1)throw new nt("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new nt('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class JI extends In{constructor(e){const t=Mi({type:"undirected"},e);if("multi"in t&&t.multi!==!1)throw new nt("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new nt('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class ZI extends In{constructor(e){const t=Mi({multi:!0},e);if("multi"in t&&t.multi!==!0)throw new nt("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class eM extends In{constructor(e){const t=Mi({type:"directed",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new nt("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new nt('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class tM extends In{constructor(e){const t=Mi({type:"undirected",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new nt("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new nt('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function Af(n){n.from=function(e,t){const i=Mi({},e.options,t),r=new n(i);return r.import(e),r}}Af(In);Af($I);Af(JI);Af(ZI);Af(eM);Af(tM);In.Graph=In;In.DirectedGraph=$I;In.UndirectedGraph=JI;In.MultiGraph=ZI;In.MultiDirectedGraph=eM;In.MultiUndirectedGraph=tM;In.InvalidArgumentsGraphError=nt;In.NotFoundGraphError=qe;In.UsageGraphError=xt;const T0=new N,k4=new N,DX=new N;function PX(n,e,t){const i=T0.setFromMatrixPosition(n.matrixWorld);i.project(e);const r=t.width/2,s=t.height/2;return[i.x*r+r,-(i.y*s)+s]}function LX(n,e){const t=T0.setFromMatrixPosition(n.matrixWorld),i=k4.setFromMatrixPosition(e.matrixWorld),r=t.sub(i),s=e.getWorldDirection(DX);return r.angleTo(s)>Math.PI/2}function UX(n,e,t,i){const r=T0.setFromMatrixPosition(n.matrixWorld),s=r.clone();s.project(e),t.setFromCamera(s,e);const a=t.intersectObjects(i,!0);if(a.length){const o=a[0].distance;return r.distanceTo(t.ray.origin)<o}return!0}function OX(n,e){if(e instanceof ql)return e.zoom;if(e instanceof Kn){const t=T0.setFromMatrixPosition(n.matrixWorld),i=k4.setFromMatrixPosition(e.matrixWorld),r=e.fov*Math.PI/180,s=t.distanceTo(i);return 1/(2*Math.tan(r/2)*s)}else return 1}function FX(n,e,t){if(e instanceof Kn||e instanceof ql){const i=T0.setFromMatrixPosition(n.matrixWorld),r=k4.setFromMatrixPosition(e.matrixWorld),s=i.distanceTo(r),a=(t[1]-t[0])/(e.far-e.near),o=t[1]-a*e.far;return Math.round(a*s+o)}}const by=n=>Math.abs(n)<1e-10?0:n;function nM(n,e,t=""){let i="matrix3d(";for(let r=0;r!==16;r++)i+=by(e[r]*n.elements[r])+(r!==15?",":")");return t+i}const kX=(n=>e=>nM(e,n))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),NX=(n=>(e,t)=>nM(e,n(t),"translate(-50%,-50%)"))(n=>[1/n,1/n,1/n,1,-1/n,-1/n,-1/n,-1,1/n,1/n,1/n,1,1,1,1,1]);function GX(n){return n&&typeof n=="object"&&"current"in n}const N4=$.forwardRef(({children:n,eps:e=.001,style:t,className:i,prepend:r,center:s,fullscreen:a,portal:o,distanceFactor:l,sprite:c=!1,transform:u=!1,occlude:h,onOcclude:f,castShadow:p,receiveShadow:m,material:y,geometry:v,zIndexRange:A=[16777271,0],calculatePosition:_=PX,as:x="div",wrapperClass:E,pointerEvents:w="auto",...I},T)=>{const{gl:M,camera:b,scene:B,size:L,raycaster:U,events:O,viewport:Q}=Cr(),[G]=$.useState(()=>document.createElement(x)),F=$.useRef(),q=$.useRef(null),Y=$.useRef(0),H=$.useRef([0,0]),V=$.useRef(null),D=$.useRef(null),k=(o==null?void 0:o.current)||O.connected||M.domElement.parentNode,Z=$.useRef(null),j=$.useRef(!1),ee=$.useMemo(()=>h&&h!=="blending"||Array.isArray(h)&&h.length&&GX(h[0]),[h]);$.useLayoutEffect(()=>{const ye=M.domElement;h&&h==="blending"?(ye.style.zIndex=`${Math.floor(A[0]/2)}`,ye.style.position="absolute",ye.style.pointerEvents="none"):(ye.style.zIndex=null,ye.style.position=null,ye.style.pointerEvents=null)},[h]),$.useLayoutEffect(()=>{if(q.current){const ye=F.current=nP(G);if(B.updateMatrixWorld(),u)G.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const oe=_(q.current,b,L);G.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${oe[0]}px,${oe[1]}px,0);transform-origin:0 0;`}return k&&(r?k.prepend(G):k.appendChild(G)),()=>{k&&k.removeChild(G),ye.unmount()}}},[k,u]),$.useLayoutEffect(()=>{E&&(G.className=E)},[E]);const ie=$.useMemo(()=>u?{position:"absolute",top:0,left:0,width:L.width,height:L.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...a&&{top:-L.height/2,left:-L.width/2,width:L.width,height:L.height},...t},[t,s,a,L,u]),te=$.useMemo(()=>({position:"absolute",pointerEvents:w}),[w]);$.useLayoutEffect(()=>{if(j.current=!1,u){var ye;(ye=F.current)==null||ye.render($.createElement("div",{ref:V,style:ie},$.createElement("div",{ref:D,style:te},$.createElement("div",{ref:T,className:i,style:t,children:n}))))}else{var oe;(oe=F.current)==null||oe.render($.createElement("div",{ref:T,style:ie,className:i,children:n}))}});const re=$.useRef(!0);a1(ye=>{if(q.current){b.updateMatrixWorld(),q.current.updateWorldMatrix(!0,!1);const oe=u?H.current:_(q.current,b,L);if(u||Math.abs(Y.current-b.zoom)>e||Math.abs(H.current[0]-oe[0])>e||Math.abs(H.current[1]-oe[1])>e){const W=LX(q.current,b);let ge=!1;ee&&(h!=="blending"?ge=[B]:Array.isArray(h)&&(ge=h.map(Pe=>Pe.current)));const he=re.current;if(ge){const Pe=UX(q.current,b,U,ge);re.current=Pe&&!W}else re.current=!W;he!==re.current&&(f?f(!re.current):G.style.display=re.current?"block":"none");const ue=Math.floor(A[0]/2),fe=h?ee?[A[0],ue]:[ue-1,0]:A;if(G.style.zIndex=`${FX(q.current,b,fe)}`,u){const[Pe,pe]=[L.width/2,L.height/2],Re=b.projectionMatrix.elements[5]*pe,{isOrthographicCamera:Le,top:Se,left:$e,bottom:X,right:z}=b,se=kX(b.matrixWorldInverse),Be=Le?`scale(${Re})translate(${by(-(z+$e)/2)}px,${by((Se+X)/2)}px)`:`translateZ(${Re}px)`;let Ce=q.current.matrixWorld;c&&(Ce=b.matrixWorldInverse.clone().transpose().copyPosition(Ce).scale(q.current.scale),Ce.elements[3]=Ce.elements[7]=Ce.elements[11]=0,Ce.elements[15]=1),G.style.width=L.width+"px",G.style.height=L.height+"px",G.style.perspective=Le?"":`${Re}px`,V.current&&D.current&&(V.current.style.transform=`${Be}${se}translate(${Pe}px,${pe}px)`,D.current.style.transform=NX(Ce,1/((l||10)/400)))}else{const Pe=l===void 0?1:OX(q.current,b)*l;G.style.transform=`translate3d(${oe[0]}px,${oe[1]}px,0) scale(${Pe})`}H.current=oe,Y.current=b.zoom}}if(!ee&&Z.current&&!j.current)if(u){if(V.current){const oe=V.current.children[0];if(oe!=null&&oe.clientWidth&&oe!=null&&oe.clientHeight){const{isOrthographicCamera:W}=b;if(W||v)I.scale&&(Array.isArray(I.scale)?I.scale instanceof N?Z.current.scale.copy(I.scale.clone().divideScalar(1)):Z.current.scale.set(1/I.scale[0],1/I.scale[1],1/I.scale[2]):Z.current.scale.setScalar(1/I.scale));else{const ge=(l||10)/400,he=oe.clientWidth*ge,ue=oe.clientHeight*ge;Z.current.scale.set(he,ue,1)}j.current=!0}}}else{const oe=G.children[0];if(oe!=null&&oe.clientWidth&&oe!=null&&oe.clientHeight){const W=1/Q.factor,ge=oe.clientWidth*W,he=oe.clientHeight*W;Z.current.scale.set(ge,he,1),j.current=!0}Z.current.lookAt(ye.camera.position)}});const ce=$.useMemo(()=>({vertexShader:u?void 0:`
/*
This shader is from the THREE's SpriteMaterial.
We need to turn the backing plane into a Sprite
(make it always face the camera) if "transfrom"
is false.
*/
#include <common>
void main() {
vec2 center = vec2(0., 1.);
float rotation = 0.0;
// This is somewhat arbitrary, but it seems to work well
// Need to figure out how to derive this dynamically if it even matters
float size = 0.03;
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
vec2 scale;
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) scale *= - mvPosition.z;
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;
vec2 rotatedPosition;
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
mvPosition.xy += rotatedPosition;
gl_Position = projectionMatrix * mvPosition;
}
`,fragmentShader:`
void main() {
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
}
`}),[u]);return $.createElement("group",ou({},I,{ref:q}),h&&!ee&&$.createElement("mesh",{castShadow:p,receiveShadow:m,ref:Z},v||$.createElement("planeGeometry",null),y||$.createElement("shaderMaterial",{side:$n,vertexShader:ce.vertexShader,fragmentShader:ce.fragmentShader})))});function np(n,e="pointer",t="auto"){$.useEffect(()=>{if(n)return document.body.style.cursor=e,()=>void(document.body.style.cursor=t)},[n])}function zX(n){return function(e){n.forEach(function(t){typeof t=="function"?t(e):t!=null&&(t.current=e)})}}let G4=I0();const Pt=n=>b0(n,G4);let z4=I0();Pt.write=n=>b0(n,z4);let v1=I0();Pt.onStart=n=>b0(n,v1);let Q4=I0();Pt.onFrame=n=>b0(n,Q4);let H4=I0();Pt.onFinish=n=>b0(n,H4);let Nh=[];Pt.setTimeout=(n,e)=>{let t=Pt.now()+e,i=()=>{let s=Nh.findIndex(a=>a.cancel==i);~s&&Nh.splice(s,1),Ml-=~s?1:0},r={time:t,handler:n,cancel:i};return Nh.splice(iM(t),0,r),Ml+=1,rM(),r};let iM=n=>~(~Nh.findIndex(e=>e.time>n)||~Nh.length);Pt.cancel=n=>{v1.delete(n),Q4.delete(n),H4.delete(n),G4.delete(n),z4.delete(n)};Pt.sync=n=>{Iy=!0,Pt.batchedUpdates(n),Iy=!1};Pt.throttle=n=>{let e;function t(){try{n(...e)}finally{e=null}}function i(...r){e=r,Pt.onStart(t)}return i.handler=n,i.cancel=()=>{v1.delete(t),e=null},i};let V4=typeof window<"u"?window.requestAnimationFrame:()=>{};Pt.use=n=>V4=n;Pt.now=typeof performance<"u"?()=>performance.now():Date.now;Pt.batchedUpdates=n=>n();Pt.catch=console.error;Pt.frameLoop="always";Pt.advance=()=>{Pt.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):aM()};let Il=-1,Ml=0,Iy=!1;function b0(n,e){Iy?(e.delete(n),n(0)):(e.add(n),rM())}function rM(){Il<0&&(Il=0,Pt.frameLoop!=="demand"&&V4(sM))}function QX(){Il=-1}function sM(){~Il&&(V4(sM),Pt.batchedUpdates(aM))}function aM(){let n=Il;Il=Pt.now();let e=iM(Il);if(e&&(oM(Nh.splice(0,e),t=>t.handler()),Ml-=e),!Ml){QX();return}v1.flush(),G4.flush(n?Math.min(64,Il-n):16.667),Q4.flush(),z4.flush(),H4.flush()}function I0(){let n=new Set,e=n;return{add(t){Ml+=e==n&&!n.has(t)?1:0,n.add(t)},delete(t){return Ml-=e==n&&n.has(t)?1:0,n.delete(t)},flush(t){e.size&&(n=new Set,Ml-=e.size,oM(e,i=>i(t)&&n.add(i)),Ml+=n.size,e=n)}}}function oM(n,e){n.forEach(t=>{try{e(t)}catch(i){Pt.catch(i)}})}function My(){}const HX=(n,e,t)=>Object.defineProperty(n,e,{value:t,writable:!0,configurable:!0}),Ke={arr:Array.isArray,obj:n=>!!n&&n.constructor.name==="Object",fun:n=>typeof n=="function",str:n=>typeof n=="string",num:n=>typeof n=="number",und:n=>n===void 0};function Lo(n,e){if(Ke.arr(n)){if(!Ke.arr(e)||n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}return n===e}const xn=(n,e)=>n.forEach(e);function Ho(n,e,t){if(Ke.arr(n)){for(let i=0;i<n.length;i++)e.call(t,n[i],`${i}`);return}for(const i in n)n.hasOwnProperty(i)&&e.call(t,n[i],i)}const Ns=n=>Ke.und(n)?[]:Ke.arr(n)?n:[n];function ip(n,e){if(n.size){const t=Array.from(n);n.clear(),xn(t,e)}}const Hd=(n,...e)=>ip(n,t=>t(...e)),W4=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent);let Y4,lM,Ul=null,cM=!1,q4=My;const VX=n=>{n.to&&(lM=n.to),n.now&&(Pt.now=n.now),n.colors!==void 0&&(Ul=n.colors),n.skipAnimation!=null&&(cM=n.skipAnimation),n.createStringInterpolator&&(Y4=n.createStringInterpolator),n.requestAnimationFrame&&Pt.use(n.requestAnimationFrame),n.batchedUpdates&&(Pt.batchedUpdates=n.batchedUpdates),n.willAdvance&&(q4=n.willAdvance),n.frameLoop&&(Pt.frameLoop=n.frameLoop)};var eo=Object.freeze({__proto__:null,get createStringInterpolator(){return Y4},get to(){return lM},get colors(){return Ul},get skipAnimation(){return cM},get willAdvance(){return q4},assign:VX});const rp=new Set;let ks=[],qv=[],$m=0;const y1={get idle(){return!rp.size&&!ks.length},start(n){$m>n.priority?(rp.add(n),Pt.onStart(WX)):(uM(n),Pt(Ry))},advance:Ry,sort(n){if($m)Pt.onFrame(()=>y1.sort(n));else{const e=ks.indexOf(n);~e&&(ks.splice(e,1),hM(n))}},clear(){ks=[],rp.clear()}};function WX(){rp.forEach(uM),rp.clear(),Pt(Ry)}function uM(n){ks.includes(n)||hM(n)}function hM(n){ks.splice(YX(ks,e=>e.priority>n.priority),0,n)}function Ry(n){const e=qv;for(let t=0;t<ks.length;t++){const i=ks[t];$m=i.priority,i.idle||(q4(i),i.advance(n),i.idle||e.push(i))}return $m=0,qv=ks,qv.length=0,ks=e,ks.length>0}function YX(n,e){const t=n.findIndex(e);return t<0?n.length:t}const qX=(n,e,t)=>Math.min(Math.max(t,n),e),XX={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},ca="[-+]?\\d*\\.?\\d+",Jm=ca+"%";function x1(...n){return"\\(\\s*("+n.join(")\\s*,\\s*(")+")\\s*\\)"}const jX=new RegExp("rgb"+x1(ca,ca,ca)),KX=new RegExp("rgba"+x1(ca,ca,ca,ca)),$X=new RegExp("hsl"+x1(ca,Jm,Jm)),JX=new RegExp("hsla"+x1(ca,Jm,Jm,ca)),ZX=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ej=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,tj=/^#([0-9a-fA-F]{6})$/,nj=/^#([0-9a-fA-F]{8})$/;function ij(n){let e;return typeof n=="number"?n>>>0===n&&n>=0&&n<=4294967295?n:null:(e=tj.exec(n))?parseInt(e[1]+"ff",16)>>>0:Ul&&Ul[n]!==void 0?Ul[n]:(e=jX.exec(n))?(fh(e[1])<<24|fh(e[2])<<16|fh(e[3])<<8|255)>>>0:(e=KX.exec(n))?(fh(e[1])<<24|fh(e[2])<<16|fh(e[3])<<8|Z7(e[4]))>>>0:(e=ZX.exec(n))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+"ff",16)>>>0:(e=nj.exec(n))?parseInt(e[1],16)>>>0:(e=ej.exec(n))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+e[4]+e[4],16)>>>0:(e=$X.exec(n))?($7(J7(e[1]),Og(e[2]),Og(e[3]))|255)>>>0:(e=JX.exec(n))?($7(J7(e[1]),Og(e[2]),Og(e[3]))|Z7(e[4]))>>>0:null}function Xv(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*(2/3-t)*6:n}function $7(n,e,t){const i=t<.5?t*(1+e):t+e-t*e,r=2*t-i,s=Xv(r,i,n+1/3),a=Xv(r,i,n),o=Xv(r,i,n-1/3);return Math.round(s*255)<<24|Math.round(a*255)<<16|Math.round(o*255)<<8}function fh(n){const e=parseInt(n,10);return e<0?0:e>255?255:e}function J7(n){return(parseFloat(n)%360+360)%360/360}function Z7(n){const e=parseFloat(n);return e<0?0:e>1?255:Math.round(e*255)}function Og(n){const e=parseFloat(n);return e<0?0:e>100?1:e/100}function eS(n){let e=ij(n);if(e===null)return n;e=e||0;let t=(e&4278190080)>>>24,i=(e&16711680)>>>16,r=(e&65280)>>>8,s=(e&255)/255;return`rgba(${t}, ${i}, ${r}, ${s})`}const Yp=(n,e,t)=>{if(Ke.fun(n))return n;if(Ke.arr(n))return Yp({range:n,output:e,extrapolate:t});if(Ke.str(n.output[0]))return Y4(n);const i=n,r=i.output,s=i.range||[0,1],a=i.extrapolateLeft||i.extrapolate||"extend",o=i.extrapolateRight||i.extrapolate||"extend",l=i.easing||(c=>c);return c=>{const u=sj(c,s);return rj(c,s[u],s[u+1],r[u],r[u+1],l,a,o,i.map)}};function rj(n,e,t,i,r,s,a,o,l){let c=l?l(n):n;if(c<e){if(a==="identity")return c;a==="clamp"&&(c=e)}if(c>t){if(o==="identity")return c;o==="clamp"&&(c=t)}return i===r?i:e===t?n<=e?i:r:(e===-1/0?c=-c:t===1/0?c=c-e:c=(c-e)/(t-e),c=s(c),i===-1/0?c=-c:r===1/0?c=c+i:c=c*(r-i)+i,c)}function sj(n,e){for(var t=1;t<e.length-1&&!(e[t]>=n);++t);return t-1}const aj=(n,e="end")=>t=>{t=e==="end"?Math.min(t,.999):Math.max(t,.001);const i=t*n,r=e==="end"?Math.floor(i):Math.ceil(i);return qX(0,1,r/n)},Zm=1.70158,Fg=Zm*1.525,tS=Zm+1,nS=2*Math.PI/3,iS=2*Math.PI/4.5,kg=n=>n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375,oj={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>1-(1-n)*(1-n),easeInOutQuad:n=>n<.5?2*n*n:1-Math.pow(-2*n+2,2)/2,easeInCubic:n=>n*n*n,easeOutCubic:n=>1-Math.pow(1-n,3),easeInOutCubic:n=>n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2,easeInQuart:n=>n*n*n*n,easeOutQuart:n=>1-Math.pow(1-n,4),easeInOutQuart:n=>n<.5?8*n*n*n*n:1-Math.pow(-2*n+2,4)/2,easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>1-Math.pow(1-n,5),easeInOutQuint:n=>n<.5?16*n*n*n*n*n:1-Math.pow(-2*n+2,5)/2,easeInSine:n=>1-Math.cos(n*Math.PI/2),easeOutSine:n=>Math.sin(n*Math.PI/2),easeInOutSine:n=>-(Math.cos(Math.PI*n)-1)/2,easeInExpo:n=>n===0?0:Math.pow(2,10*n-10),easeOutExpo:n=>n===1?1:1-Math.pow(2,-10*n),easeInOutExpo:n=>n===0?0:n===1?1:n<.5?Math.pow(2,20*n-10)/2:(2-Math.pow(2,-20*n+10))/2,easeInCirc:n=>1-Math.sqrt(1-Math.pow(n,2)),easeOutCirc:n=>Math.sqrt(1-Math.pow(n-1,2)),easeInOutCirc:n=>n<.5?(1-Math.sqrt(1-Math.pow(2*n,2)))/2:(Math.sqrt(1-Math.pow(-2*n+2,2))+1)/2,easeInBack:n=>tS*n*n*n-Zm*n*n,easeOutBack:n=>1+tS*Math.pow(n-1,3)+Zm*Math.pow(n-1,2),easeInOutBack:n=>n<.5?Math.pow(2*n,2)*((Fg+1)*2*n-Fg)/2:(Math.pow(2*n-2,2)*((Fg+1)*(n*2-2)+Fg)+2)/2,easeInElastic:n=>n===0?0:n===1?1:-Math.pow(2,10*n-10)*Math.sin((n*10-10.75)*nS),easeOutElastic:n=>n===0?0:n===1?1:Math.pow(2,-10*n)*Math.sin((n*10-.75)*nS)+1,easeInOutElastic:n=>n===0?0:n===1?1:n<.5?-(Math.pow(2,20*n-10)*Math.sin((20*n-11.125)*iS))/2:Math.pow(2,-20*n+10)*Math.sin((20*n-11.125)*iS)/2+1,easeInBounce:n=>1-kg(1-n),easeOutBounce:kg,easeInOutBounce:n=>n<.5?(1-kg(1-2*n))/2:(1+kg(2*n-1))/2,steps:aj};function By(){return By=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},By.apply(this,arguments)}const Jh=Symbol.for("FluidValue.get"),uu=Symbol.for("FluidValue.observers"),Na=n=>!!(n&&n[Jh]),Ls=n=>n&&n[Jh]?n[Jh]():n,rS=n=>n[uu]||null;function lj(n,e){n.eventObserved?n.eventObserved(e):n(e)}function e2(n,e){let t=n[uu];t&&t.forEach(i=>{lj(i,e)})}class cj{constructor(e){if(this[Jh]=void 0,this[uu]=void 0,!e&&!(e=this.get))throw Error("Unknown getter");uj(this,e)}}const uj=(n,e)=>fM(n,Jh,e);function M0(n,e){if(n[Jh]){let t=n[uu];t||fM(n,uu,t=new Set),t.has(e)||(t.add(e),n.observerAdded&&n.observerAdded(t.size,e))}return e}function t2(n,e){let t=n[uu];if(t&&t.has(e)){const i=t.size-1;i?t.delete(e):n[uu]=null,n.observerRemoved&&n.observerRemoved(i,e)}}const fM=(n,e,t)=>Object.defineProperty(n,e,{value:t,writable:!0,configurable:!0}),vm=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,hj=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,sS=new RegExp(`(${vm.source})(%|[a-z]+)`,"i"),fj=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,_1=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,dM=n=>{const[e,t]=dj(n);if(!e||W4())return n;const i=window.getComputedStyle(document.documentElement).getPropertyValue(e);if(i)return i.trim();if(t&&t.startsWith("--")){const r=window.getComputedStyle(document.documentElement).getPropertyValue(t);return r||n}else{if(t&&_1.test(t))return dM(t);if(t)return t}return n},dj=n=>{const e=_1.exec(n);if(!e)return[,];const[,t,i]=e;return[t,i]};let jv;const pj=(n,e,t,i,r)=>`rgba(${Math.round(e)}, ${Math.round(t)}, ${Math.round(i)}, ${r})`,pM=n=>{jv||(jv=Ul?new RegExp(`(${Object.keys(Ul).join("|")})(?!\\w)`,"g"):/^\b$/);const e=n.output.map(s=>Ls(s).replace(_1,dM).replace(hj,eS).replace(jv,eS)),t=e.map(s=>s.match(vm).map(Number)),r=t[0].map((s,a)=>t.map(o=>{if(!(a in o))throw Error('The arity of each "output" value must be equal');return o[a]})).map(s=>Yp(By({},n,{output:s})));return s=>{var a;const o=!sS.test(e[0])&&((a=e.find(c=>sS.test(c)))==null?void 0:a.replace(vm,""));let l=0;return e[0].replace(vm,()=>`${r[l++](s)}${o||""}`).replace(fj,pj)}},X4="react-spring: ",gM=n=>{const e=n;let t=!1;if(typeof e!="function")throw new TypeError(`${X4}once requires a function parameter`);return(...i)=>{t||(e(...i),t=!0)}},gj=gM(console.warn);function mj(){gj(`${X4}The "interpolate" function is deprecated in v9 (use "to" instead)`)}const Aj=gM(console.warn);function vj(){Aj(`${X4}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function E1(n){return Ke.str(n)&&(n[0]=="#"||/\d/.test(n)||!W4()&&_1.test(n)||n in(Ul||{}))}const j4=W4()?$.useEffect:$.useLayoutEffect,yj=()=>{const n=$.useRef(!1);return j4(()=>(n.current=!0,()=>{n.current=!1}),[]),n};function mM(){const n=$.useState()[1],e=yj();return()=>{e.current&&n(Math.random())}}function xj(n,e){const[t]=$.useState(()=>({inputs:e,result:n()})),i=$.useRef(),r=i.current;let s=r;return s?e&&s.inputs&&_j(e,s.inputs)||(s={inputs:e,result:n()}):s=t,$.useEffect(()=>{i.current=s,r==t&&(t.inputs=t.result=void 0)},[s]),s.result}function _j(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}const AM=n=>$.useEffect(n,Ej),Ej=[];function aS(n){const e=$.useRef();return $.useEffect(()=>{e.current=n}),e.current}const qp=Symbol.for("Animated:node"),Sj=n=>!!n&&n[qp]===n,ka=n=>n&&n[qp],K4=(n,e)=>HX(n,qp,e),S1=n=>n&&n[qp]&&n[qp].getPayload();class vM{constructor(){this.payload=void 0,K4(this,this)}getPayload(){return this.payload||[]}}class vf extends vM{constructor(e){super(),this.done=!0,this.elapsedTime=void 0,this.lastPosition=void 0,this.lastVelocity=void 0,this.v0=void 0,this.durationProgress=0,this._value=e,Ke.num(this._value)&&(this.lastPosition=this._value)}static create(e){return new vf(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return Ke.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value===e?!1:(this._value=e,!0)}reset(){const{done:e}=this;this.done=!1,Ke.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}}class Zh extends vf{constructor(e){super(0),this._string=null,this._toString=void 0,this._toString=Yp({output:[e,e]})}static create(e){return new Zh(e)}getValue(){let e=this._string;return e??(this._string=this._toString(this._value))}setValue(e){if(Ke.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else if(super.setValue(e))this._string=null;else return!1;return!0}reset(e){e&&(this._toString=Yp({output:[this.getValue(),e]})),this._value=0,super.reset()}}const n2={dependencies:null};class $4 extends vM{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){const t={};return Ho(this.source,(i,r)=>{Sj(i)?t[r]=i.getValue(e):Na(i)?t[r]=Ls(i):e||(t[r]=i)}),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&xn(this.payload,e=>e.reset())}_makePayload(e){if(e){const t=new Set;return Ho(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){n2.dependencies&&Na(e)&&n2.dependencies.add(e);const t=S1(e);t&&xn(t,i=>this.add(i))}}class J4 extends $4{constructor(e){super(e)}static create(e){return new J4(e)}getValue(){return this.source.map(e=>e.getValue())}setValue(e){const t=this.getPayload();return e.length==t.length?t.map((i,r)=>i.setValue(e[r])).some(Boolean):(super.setValue(e.map(wj)),!0)}}function wj(n){return(E1(n)?Zh:vf).create(n)}function Dy(n){const e=ka(n);return e?e.constructor:Ke.arr(n)?J4:E1(n)?Zh:vf}function i2(){return i2=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},i2.apply(this,arguments)}const oS=(n,e)=>{const t=!Ke.fun(n)||n.prototype&&n.prototype.isReactComponent;return $.forwardRef((i,r)=>{const s=$.useRef(null),a=t&&$.useCallback(m=>{s.current=bj(r,m)},[r]),[o,l]=Tj(i,e),c=mM(),u=()=>{const m=s.current;if(t&&!m)return;(m?e.applyAnimatedValues(m,o.getValue(!0)):!1)===!1&&c()},h=new Cj(u,l),f=$.useRef();j4(()=>(f.current=h,xn(l,m=>M0(m,h)),()=>{f.current&&(xn(f.current.deps,m=>t2(m,f.current)),Pt.cancel(f.current.update))})),$.useEffect(u,[]),AM(()=>()=>{const m=f.current;xn(m.deps,y=>t2(y,m))});const p=e.getComponentProps(o.getValue());return $.createElement(n,i2({},p,{ref:a}))})};class Cj{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){e.type=="change"&&Pt.write(this.update)}}function Tj(n,e){const t=new Set;return n2.dependencies=t,n.style&&(n=i2({},n,{style:e.createAnimatedStyle(n.style)})),n=new $4(n),n2.dependencies=null,[n,t]}function bj(n,e){return n&&(Ke.fun(n)?n(e):n.current=e),e}const lS=Symbol.for("AnimatedComponent"),Ij=(n,{applyAnimatedValues:e=()=>!1,createAnimatedStyle:t=r=>new $4(r),getComponentProps:i=r=>r}={})=>{const r={applyAnimatedValues:e,createAnimatedStyle:t,getComponentProps:i},s=a=>{const o=cS(a)||"Anonymous";return Ke.str(a)?a=s[a]||(s[a]=oS(a,r)):a=a[lS]||(a[lS]=oS(a,r)),a.displayName=`Animated(${o})`,a};return Ho(n,(a,o)=>{Ke.arr(n)&&(o=cS(a)),s[o]=s(a)}),{animated:s}},cS=n=>Ke.str(n)?n:n&&Ke.str(n.displayName)?n.displayName:Ke.fun(n)&&n.name||null;function Hi(){return Hi=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},Hi.apply(this,arguments)}function Gc(n,...e){return Ke.fun(n)?n(...e):n}const sp=(n,e)=>n===!0||!!(e&&n&&(Ke.fun(n)?n(e):Ns(n).includes(e))),yM=(n,e)=>Ke.obj(n)?e&&n[e]:n,xM=(n,e)=>n.default===!0?n[e]:n.default?n.default[e]:void 0,Mj=n=>n,Z4=(n,e=Mj)=>{let t=Rj;n.default&&n.default!==!0&&(n=n.default,t=Object.keys(n));const i={};for(const r of t){const s=e(n[r],r);Ke.und(s)||(i[r]=s)}return i},Rj=["config","onProps","onStart","onChange","onPause","onResume","onRest"],Bj={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function Dj(n){const e={};let t=0;if(Ho(n,(i,r)=>{Bj[r]||(e[r]=i,t++)}),t)return e}function _M(n){const e=Dj(n);if(e){const t={to:e};return Ho(n,(i,r)=>r in e||(t[r]=i)),t}return Hi({},n)}function Xp(n){return n=Ls(n),Ke.arr(n)?n.map(Xp):E1(n)?eo.createStringInterpolator({range:[0,1],output:[n,n]})(1):n}function Pj(n){for(const e in n)return!0;return!1}function Py(n){return Ke.fun(n)||Ke.arr(n)&&Ke.obj(n[0])}function Lj(n,e){var t;(t=n.ref)==null||t.delete(n),e==null||e.delete(n)}function Uj(n,e){if(e&&n.ref!==e){var t;(t=n.ref)==null||t.delete(n),e.add(n),n.ref=e}}const Oj={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}},Ly=Hi({},Oj.default,{mass:1,damping:1,easing:oj.linear,clamp:!1});class Fj{constructor(){this.tension=void 0,this.friction=void 0,this.frequency=void 0,this.damping=void 0,this.mass=void 0,this.velocity=0,this.restVelocity=void 0,this.precision=void 0,this.progress=void 0,this.duration=void 0,this.easing=void 0,this.clamp=void 0,this.bounce=void 0,this.decay=void 0,this.round=void 0,Object.assign(this,Ly)}}function kj(n,e,t){t&&(t=Hi({},t),uS(t,e),e=Hi({},t,e)),uS(n,e),Object.assign(n,e);for(const a in Ly)n[a]==null&&(n[a]=Ly[a]);let{mass:i,frequency:r,damping:s}=n;return Ke.und(r)||(r<.01&&(r=.01),s<0&&(s=0),n.tension=Math.pow(2*Math.PI/r,2)*i,n.friction=4*Math.PI*s*i/r),n}function uS(n,e){if(!Ke.und(e.decay))n.duration=void 0;else{const t=!Ke.und(e.tension)||!Ke.und(e.friction);(t||!Ke.und(e.frequency)||!Ke.und(e.damping)||!Ke.und(e.mass))&&(n.duration=void 0,n.decay=void 0),t&&(n.frequency=void 0)}}const hS=[];class Nj{constructor(){this.changed=!1,this.values=hS,this.toValues=null,this.fromValues=hS,this.to=void 0,this.from=void 0,this.config=new Fj,this.immediate=!1}}function EM(n,{key:e,props:t,defaultProps:i,state:r,actions:s}){return new Promise((a,o)=>{var l;let c,u,h=sp((l=t.cancel)!=null?l:i==null?void 0:i.cancel,e);if(h)m();else{Ke.und(t.pause)||(r.paused=sp(t.pause,e));let y=i==null?void 0:i.pause;y!==!0&&(y=r.paused||sp(y,e)),c=Gc(t.delay||0,e),y?(r.resumeQueue.add(p),s.pause()):(s.resume(),p())}function f(){r.resumeQueue.add(p),r.timeouts.delete(u),u.cancel(),c=u.time-Pt.now()}function p(){c>0&&!eo.skipAnimation?(r.delayed=!0,u=Pt.setTimeout(m,c),r.pauseQueue.add(f),r.timeouts.add(u)):m()}function m(){r.delayed&&(r.delayed=!1),r.pauseQueue.delete(f),r.timeouts.delete(u),n<=(r.cancelId||0)&&(h=!0);try{s.start(Hi({},t,{callId:n,cancel:h}),a)}catch(y){o(y)}}})}const e8=(n,e)=>e.length==1?e[0]:e.some(t=>t.cancelled)?Gh(n.get()):e.every(t=>t.noop)?SM(n.get()):oa(n.get(),e.every(t=>t.finished)),SM=n=>({value:n,noop:!0,finished:!0,cancelled:!1}),oa=(n,e,t=!1)=>({value:n,finished:e,cancelled:t}),Gh=n=>({value:n,cancelled:!0,finished:!1});function wM(n,e,t,i){const{callId:r,parentId:s,onRest:a}=e,{asyncTo:o,promise:l}=t;return!s&&n===o&&!e.reset?l:t.promise=(async()=>{t.asyncId=r,t.asyncTo=n;const c=Z4(e,(v,A)=>A==="onRest"?void 0:v);let u,h;const f=new Promise((v,A)=>(u=v,h=A)),p=v=>{const A=r<=(t.cancelId||0)&&Gh(i)||r!==t.asyncId&&oa(i,!1);if(A)throw v.result=A,h(v),v},m=(v,A)=>{const _=new fS,x=new dS;return(async()=>{if(eo.skipAnimation)throw jp(t),x.result=oa(i,!1),h(x),x;p(_);const E=Ke.obj(v)?Hi({},v):Hi({},A,{to:v});E.parentId=r,Ho(c,(I,T)=>{Ke.und(E[T])&&(E[T]=I)});const w=await i.start(E);return p(_),t.paused&&await new Promise(I=>{t.resumeQueue.add(I)}),w})()};let y;if(eo.skipAnimation)return jp(t),oa(i,!1);try{let v;Ke.arr(n)?v=(async A=>{for(const _ of A)await m(_)})(n):v=Promise.resolve(n(m,i.stop.bind(i))),await Promise.all([v.then(u),f]),y=oa(i.get(),!0,!1)}catch(v){if(v instanceof fS)y=v.result;else if(v instanceof dS)y=v.result;else throw v}finally{r==t.asyncId&&(t.asyncId=s,t.asyncTo=s?o:void 0,t.promise=s?l:void 0)}return Ke.fun(a)&&Pt.batchedUpdates(()=>{a(y,i,i.item)}),y})()}function jp(n,e){ip(n.timeouts,t=>t.cancel()),n.pauseQueue.clear(),n.resumeQueue.clear(),n.asyncId=n.asyncTo=n.promise=void 0,e&&(n.cancelId=e)}class fS extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise."),this.result=void 0}}class dS extends Error{constructor(){super("SkipAnimationSignal"),this.result=void 0}}const Uy=n=>n instanceof t8;let Gj=1;class t8 extends cj{constructor(...e){super(...e),this.id=Gj++,this.key=void 0,this._priority=0}get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){const e=ka(this);return e&&e.getValue()}to(...e){return eo.to(this,e)}interpolate(...e){return mj(),eo.to(this,e)}toJSON(){return this.get()}observerAdded(e){e==1&&this._attach()}observerRemoved(e){e==0&&this._detach()}_attach(){}_detach(){}_onChange(e,t=!1){e2(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||y1.sort(this),e2(this,{type:"priority",parent:this,priority:e})}}const hu=Symbol.for("SpringPhase"),CM=1,Oy=2,Fy=4,Kv=n=>(n[hu]&CM)>0,Al=n=>(n[hu]&Oy)>0,md=n=>(n[hu]&Fy)>0,pS=(n,e)=>e?n[hu]|=Oy|CM:n[hu]&=~Oy,gS=(n,e)=>e?n[hu]|=Fy:n[hu]&=~Fy;class zj extends t8{constructor(e,t){if(super(),this.key=void 0,this.animation=new Nj,this.queue=void 0,this.defaultProps={},this._state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!Ke.und(e)||!Ke.und(t)){const i=Ke.obj(e)?Hi({},e):Hi({},t,{from:e});Ke.und(i.default)&&(i.default=!0),this.start(i)}}get idle(){return!(Al(this)||this._state.asyncTo)||md(this)}get goal(){return Ls(this.animation.to)}get velocity(){const e=ka(this);return e instanceof vf?e.lastVelocity||0:e.getPayload().map(t=>t.lastVelocity||0)}get hasAnimated(){return Kv(this)}get isAnimating(){return Al(this)}get isPaused(){return md(this)}get isDelayed(){return this._state.delayed}advance(e){let t=!0,i=!1;const r=this.animation;let{config:s,toValues:a}=r;const o=S1(r.to);!o&&Na(r.to)&&(a=Ns(Ls(r.to))),r.values.forEach((u,h)=>{if(u.done)return;const f=u.constructor==Zh?1:o?o[h].lastPosition:a[h];let p=r.immediate,m=f;if(!p){if(m=u.lastPosition,s.tension<=0){u.done=!0;return}let y=u.elapsedTime+=e;const v=r.fromValues[h],A=u.v0!=null?u.v0:u.v0=Ke.arr(s.velocity)?s.velocity[h]:s.velocity;let _;const x=s.precision||(v==f?.005:Math.min(1,Math.abs(f-v)*.001));if(Ke.und(s.duration))if(s.decay){const E=s.decay===!0?.998:s.decay,w=Math.exp(-(1-E)*y);m=v+A/(1-E)*(1-w),p=Math.abs(u.lastPosition-m)<=x,_=A*w}else{_=u.lastVelocity==null?A:u.lastVelocity;const E=s.restVelocity||x/10,w=s.clamp?0:s.bounce,I=!Ke.und(w),T=v==f?u.v0>0:v<f;let M,b=!1;const B=1,L=Math.ceil(e/B);for(let U=0;U<L&&(M=Math.abs(_)>E,!(!M&&(p=Math.abs(f-m)<=x,p)));++U){I&&(b=m==f||m>f==T,b&&(_=-_*w,m=f));const O=-s.tension*1e-6*(m-f),Q=-s.friction*.001*_,G=(O+Q)/s.mass;_=_+G*B,m=m+_*B}}else{let E=1;s.duration>0&&(this._memoizedDuration!==s.duration&&(this._memoizedDuration=s.duration,u.durationProgress>0&&(u.elapsedTime=s.duration*u.durationProgress,y=u.elapsedTime+=e)),E=(s.progress||0)+y/this._memoizedDuration,E=E>1?1:E<0?0:E,u.durationProgress=E),m=v+s.easing(E)*(f-v),_=(m-u.lastPosition)/e,p=E==1}u.lastVelocity=_,Number.isNaN(m)&&(console.warn("Got NaN while animating:",this),p=!0)}o&&!o[h].done&&(p=!1),p?u.done=!0:t=!1,u.setValue(m,s.round)&&(i=!0)});const l=ka(this),c=l.getValue();if(t){const u=Ls(r.to);(c!==u||i)&&!s.decay?(l.setValue(u),this._onChange(u)):i&&s.decay&&this._onChange(c),this._stop()}else i&&this._onChange(c)}set(e){return Pt.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(Al(this)){const{to:e,config:t}=this.animation;Pt.batchedUpdates(()=>{this._onStart(),t.decay||this._set(e,!1),this._stop()})}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,t){let i;return Ke.und(e)?(i=this.queue||[],this.queue=[]):i=[Ke.obj(e)?e:Hi({},t,{to:e})],Promise.all(i.map(r=>this._update(r))).then(r=>e8(this,r))}stop(e){const{to:t}=this.animation;return this._focus(this.get()),jp(this._state,e&&this._lastCallId),Pt.batchedUpdates(()=>this._stop(t,e)),this}reset(){this._update({reset:!0})}eventObserved(e){e.type=="change"?this._start():e.type=="priority"&&(this.priority=e.priority+1)}_prepareNode(e){const t=this.key||"";let{to:i,from:r}=e;i=Ke.obj(i)?i[t]:i,(i==null||Py(i))&&(i=void 0),r=Ke.obj(r)?r[t]:r,r==null&&(r=void 0);const s={to:i,from:r};return Kv(this)||(e.reverse&&([i,r]=[r,i]),r=Ls(r),Ke.und(r)?ka(this)||this._set(i):this._set(r)),s}_update(e,t){let i=Hi({},e);const{key:r,defaultProps:s}=this;i.default&&Object.assign(s,Z4(i,(l,c)=>/^on/.test(c)?yM(l,r):l)),AS(this,i,"onProps"),vd(this,"onProps",i,this);const a=this._prepareNode(i);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");const o=this._state;return EM(++this._lastCallId,{key:r,props:i,defaultProps:s,state:o,actions:{pause:()=>{md(this)||(gS(this,!0),Hd(o.pauseQueue),vd(this,"onPause",oa(this,Ad(this,this.animation.to)),this))},resume:()=>{md(this)&&(gS(this,!1),Al(this)&&this._resume(),Hd(o.resumeQueue),vd(this,"onResume",oa(this,Ad(this,this.animation.to)),this))},start:this._merge.bind(this,a)}}).then(l=>{if(i.loop&&l.finished&&!(t&&l.noop)){const c=TM(i);if(c)return this._update(c,!0)}return l})}_merge(e,t,i){if(t.cancel)return this.stop(!0),i(Gh(this));const r=!Ke.und(e.to),s=!Ke.und(e.from);if(r||s)if(t.callId>this._lastToId)this._lastToId=t.callId;else return i(Gh(this));const{key:a,defaultProps:o,animation:l}=this,{to:c,from:u}=l;let{to:h=c,from:f=u}=e;s&&!r&&(!t.default||Ke.und(h))&&(h=f),t.reverse&&([h,f]=[f,h]);const p=!Lo(f,u);p&&(l.from=f),f=Ls(f);const m=!Lo(h,c);m&&this._focus(h);const y=Py(t.to),{config:v}=l,{decay:A,velocity:_}=v;(r||s)&&(v.velocity=0),t.config&&!y&&kj(v,Gc(t.config,a),t.config!==o.config?Gc(o.config,a):void 0);let x=ka(this);if(!x||Ke.und(h))return i(oa(this,!0));const E=Ke.und(t.reset)?s&&!t.default:!Ke.und(f)&&sp(t.reset,a),w=E?f:this.get(),I=Xp(h),T=Ke.num(I)||Ke.arr(I)||E1(I),M=!y&&(!T||sp(o.immediate||t.immediate,a));if(m){const U=Dy(h);if(U!==x.constructor)if(M)x=this._set(I);else throw Error(`Cannot animate between ${x.constructor.name} and ${U.name}, as the "to" prop suggests`)}const b=x.constructor;let B=Na(h),L=!1;if(!B){const U=E||!Kv(this)&&p;(m||U)&&(L=Lo(Xp(w),I),B=!L),(!Lo(l.immediate,M)&&!M||!Lo(v.decay,A)||!Lo(v.velocity,_))&&(B=!0)}if(L&&Al(this)&&(l.changed&&!E?B=!0:B||this._stop(c)),!y&&((B||Na(c))&&(l.values=x.getPayload(),l.toValues=Na(h)?null:b==Zh?[1]:Ns(I)),l.immediate!=M&&(l.immediate=M,!M&&!E&&this._set(c)),B)){const{onRest:U}=l;xn(Hj,Q=>AS(this,t,Q));const O=oa(this,Ad(this,c));Hd(this._pendingCalls,O),this._pendingCalls.add(i),l.changed&&Pt.batchedUpdates(()=>{l.changed=!E,U==null||U(O,this),E?Gc(o.onRest,O):l.onStart==null||l.onStart(O,this)})}E&&this._set(w),y?i(wM(t.to,t,this._state,this)):B?this._start():Al(this)&&!m?this._pendingCalls.add(i):i(SM(w))}_focus(e){const t=this.animation;e!==t.to&&(rS(this)&&this._detach(),t.to=e,rS(this)&&this._attach())}_attach(){let e=0;const{to:t}=this.animation;Na(t)&&(M0(t,this),Uy(t)&&(e=t.priority+1)),this.priority=e}_detach(){const{to:e}=this.animation;Na(e)&&t2(e,this)}_set(e,t=!0){const i=Ls(e);if(!Ke.und(i)){const r=ka(this);if(!r||!Lo(i,r.getValue())){const s=Dy(i);!r||r.constructor!=s?K4(this,s.create(i)):r.setValue(i),r&&Pt.batchedUpdates(()=>{this._onChange(i,t)})}}return ka(this)}_onStart(){const e=this.animation;e.changed||(e.changed=!0,vd(this,"onStart",oa(this,Ad(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),Gc(this.animation.onChange,e,this)),Gc(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){const e=this.animation;ka(this).reset(Ls(e.to)),e.immediate||(e.fromValues=e.values.map(t=>t.lastPosition)),Al(this)||(pS(this,!0),md(this)||this._resume())}_resume(){eo.skipAnimation?this.finish():y1.start(this)}_stop(e,t){if(Al(this)){pS(this,!1);const i=this.animation;xn(i.values,s=>{s.done=!0}),i.toValues&&(i.onChange=i.onPause=i.onResume=void 0),e2(this,{type:"idle",parent:this});const r=t?Gh(this.get()):oa(this.get(),Ad(this,e??i.to));Hd(this._pendingCalls,r),i.changed&&(i.changed=!1,vd(this,"onRest",r,this))}}}function Ad(n,e){const t=Xp(e),i=Xp(n.get());return Lo(i,t)}function TM(n,e=n.loop,t=n.to){let i=Gc(e);if(i){const r=i!==!0&&_M(i),s=(r||n).reverse,a=!r||r.reset;return Kp(Hi({},n,{loop:e,default:!1,pause:void 0,to:!s||Py(t)?t:void 0,from:a?n.from:void 0,reset:a},r))}}function Kp(n){const{to:e,from:t}=n=_M(n),i=new Set;return Ke.obj(e)&&mS(e,i),Ke.obj(t)&&mS(t,i),n.keys=i.size?Array.from(i):null,n}function Qj(n){const e=Kp(n);return Ke.und(e.default)&&(e.default=Z4(e)),e}function mS(n,e){Ho(n,(t,i)=>t!=null&&e.add(i))}const Hj=["onStart","onRest","onChange","onPause","onResume"];function AS(n,e,t){n.animation[t]=e[t]!==xM(e,t)?yM(e[t],n.key):void 0}function vd(n,e,...t){var i,r,s,a;(i=(r=n.animation)[e])==null||i.call(r,...t),(s=(a=n.defaultProps)[e])==null||s.call(a,...t)}const Vj=["onStart","onChange","onRest"];let Wj=1;class Yj{constructor(e,t){this.id=Wj++,this.springs={},this.queue=[],this.ref=void 0,this._flush=void 0,this._initialProps=void 0,this._lastAsyncId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._item=void 0,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start(Hi({default:!0},e))}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){const e={};return this.each((t,i)=>e[i]=t.get()),e}set(e){for(const t in e){const i=e[t];Ke.und(i)||this.springs[t].set(i)}}update(e){return e&&this.queue.push(Kp(e)),this}start(e){let{queue:t}=this;return e?t=Ns(e).map(Kp):this.queue=[],this._flush?this._flush(this,t):(BM(this,t),ky(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){const i=this.springs;xn(Ns(t),r=>i[r].stop(!!e))}else jp(this._state,this._lastAsyncId),this.each(i=>i.stop(!!e));return this}pause(e){if(Ke.und(e))this.start({pause:!0});else{const t=this.springs;xn(Ns(e),i=>t[i].pause())}return this}resume(e){if(Ke.und(e))this.start({pause:!1});else{const t=this.springs;xn(Ns(e),i=>t[i].resume())}return this}each(e){Ho(this.springs,e)}_onFrame(){const{onStart:e,onChange:t,onRest:i}=this._events,r=this._active.size>0,s=this._changed.size>0;(r&&!this._started||s&&!this._started)&&(this._started=!0,ip(e,([l,c])=>{c.value=this.get(),l(c,this,this._item)}));const a=!r&&this._started,o=s||a&&i.size?this.get():null;s&&t.size&&ip(t,([l,c])=>{c.value=o,l(c,this,this._item)}),a&&(this._started=!1,ip(i,([l,c])=>{c.value=o,l(c,this,this._item)}))}eventObserved(e){if(e.type=="change")this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type=="idle")this._active.delete(e.parent);else return;Pt.onFrame(this._onFrame)}}function ky(n,e){return Promise.all(e.map(t=>bM(n,t))).then(t=>e8(n,t))}async function bM(n,e,t){const{keys:i,to:r,from:s,loop:a,onRest:o,onResolve:l}=e,c=Ke.obj(e.default)&&e.default;a&&(e.loop=!1),r===!1&&(e.to=null),s===!1&&(e.from=null);const u=Ke.arr(r)||Ke.fun(r)?r:void 0;u?(e.to=void 0,e.onRest=void 0,c&&(c.onRest=void 0)):xn(Vj,y=>{const v=e[y];if(Ke.fun(v)){const A=n._events[y];e[y]=({finished:_,cancelled:x})=>{const E=A.get(v);E?(_||(E.finished=!1),x&&(E.cancelled=!0)):A.set(v,{value:null,finished:_||!1,cancelled:x||!1})},c&&(c[y]=e[y])}});const h=n._state;e.pause===!h.paused?(h.paused=e.pause,Hd(e.pause?h.pauseQueue:h.resumeQueue)):h.paused&&(e.pause=!0);const f=(i||Object.keys(n.springs)).map(y=>n.springs[y].start(e)),p=e.cancel===!0||xM(e,"cancel")===!0;(u||p&&h.asyncId)&&f.push(EM(++n._lastAsyncId,{props:e,state:h,actions:{pause:My,resume:My,start(y,v){p?(jp(h,n._lastAsyncId),v(Gh(n))):(y.onRest=o,v(wM(u,y,h,n)))}}})),h.paused&&await new Promise(y=>{h.resumeQueue.add(y)});const m=e8(n,await Promise.all(f));if(a&&m.finished&&!(t&&m.noop)){const y=TM(e,a,r);if(y)return BM(n,[y]),bM(n,y,!0)}return l&&Pt.batchedUpdates(()=>l(m,n,n.item)),m}function vS(n,e){const t=Hi({},n.springs);return e&&xn(Ns(e),i=>{Ke.und(i.keys)&&(i=Kp(i)),Ke.obj(i.to)||(i=Hi({},i,{to:void 0})),RM(t,i,r=>MM(r))}),IM(n,t),t}function IM(n,e){Ho(e,(t,i)=>{n.springs[i]||(n.springs[i]=t,M0(t,n))})}function MM(n,e){const t=new zj;return t.key=n,e&&M0(t,e),t}function RM(n,e,t){e.keys&&xn(e.keys,i=>{(n[i]||(n[i]=t(i)))._prepareNode(e)})}function BM(n,e){xn(e,t=>{RM(n.springs,t,i=>MM(i,n))})}function qj(n,e){if(n==null)return{};var t={},i=Object.keys(n),r,s;for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&(t[r]=n[r]);return t}const Xj=["children"],w1=n=>{let{children:e}=n,t=qj(n,Xj);const i=$.useContext(r2),r=t.pause||!!i.pause,s=t.immediate||!!i.immediate;t=xj(()=>({pause:r,immediate:s}),[r,s]);const{Provider:a}=r2;return $.createElement(a,{value:t},e)},r2=jj(w1,{});w1.Provider=r2.Provider;w1.Consumer=r2.Consumer;function jj(n,e){return Object.assign(n,$.createContext(e)),n.Provider._context=n,n.Consumer._context=n,n}const Kj=()=>{const n=[],e=function(r){vj();const s=[];return xn(n,(a,o)=>{if(Ke.und(r))s.push(a.start());else{const l=t(r,a,o);l&&s.push(a.start(l))}}),s};e.current=n,e.add=function(i){n.includes(i)||n.push(i)},e.delete=function(i){const r=n.indexOf(i);~r&&n.splice(r,1)},e.pause=function(){return xn(n,i=>i.pause(...arguments)),this},e.resume=function(){return xn(n,i=>i.resume(...arguments)),this},e.set=function(i){xn(n,r=>r.set(i))},e.start=function(i){const r=[];return xn(n,(s,a)=>{if(Ke.und(i))r.push(s.start());else{const o=this._getProps(i,s,a);o&&r.push(s.start(o))}}),r},e.stop=function(){return xn(n,i=>i.stop(...arguments)),this},e.update=function(i){return xn(n,(r,s)=>r.update(this._getProps(i,r,s))),this};const t=function(r,s,a){return Ke.fun(r)?r(a,s):r};return e._getProps=t,e};function $j(n,e,t){const i=Ke.fun(e)&&e;i&&!t&&(t=[]);const r=$.useMemo(()=>i||arguments.length==3?Kj():void 0,[]),s=$.useRef(0),a=mM(),o=$.useMemo(()=>({ctrls:[],queue:[],flush(A,_){const x=vS(A,_);return s.current>0&&!o.queue.length&&!Object.keys(x).some(w=>!A.springs[w])?ky(A,_):new Promise(w=>{IM(A,x),o.queue.push(()=>{w(ky(A,_))}),a()})}}),[]),l=$.useRef([...o.ctrls]),c=[],u=aS(n)||0;$.useMemo(()=>{xn(l.current.slice(n,u),A=>{Lj(A,r),A.stop(!0)}),l.current.length=n,h(u,n)},[n]),$.useMemo(()=>{h(0,Math.min(u,n))},t);function h(A,_){for(let x=A;x<_;x++){const E=l.current[x]||(l.current[x]=new Yj(null,o.flush)),w=i?i(x,E):e[x];w&&(c[x]=Qj(w))}}const f=l.current.map((A,_)=>vS(A,c[_])),p=$.useContext(w1),m=aS(p),y=p!==m&&Pj(p);j4(()=>{s.current++,o.ctrls=l.current;const{queue:A}=o;A.length&&(o.queue=[],xn(A,_=>_())),xn(l.current,(_,x)=>{r==null||r.add(_),y&&_.start({default:p});const E=c[x];E&&(Uj(_,E.ref),_.ref?_.queue.push(E):_.start(E))})}),AM(()=>()=>{xn(o.ctrls,A=>A.stop(!0))});const v=f.map(A=>Hi({},A));return r?[v,r]:v}function Vs(n,e){const t=Ke.fun(n),[[i],r]=$j(1,t?n:[n],t?e||[]:e);return t||arguments.length==2?[i,r]:i}let yS;(function(n){n.MOUNT="mount",n.ENTER="enter",n.UPDATE="update",n.LEAVE="leave"})(yS||(yS={}));class Jj extends t8{constructor(e,t){super(),this.key=void 0,this.idle=!0,this.calc=void 0,this._active=new Set,this.source=e,this.calc=Yp(...t);const i=this._get(),r=Dy(i);K4(this,r.create(i))}advance(e){const t=this._get(),i=this.get();Lo(t,i)||(ka(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&xS(this._active)&&$v(this)}_get(){const e=Ke.arr(this.source)?this.source.map(Ls):Ns(Ls(this.source));return this.calc(...e)}_start(){this.idle&&!xS(this._active)&&(this.idle=!1,xn(S1(this),e=>{e.done=!1}),eo.skipAnimation?(Pt.batchedUpdates(()=>this.advance()),$v(this)):y1.start(this))}_attach(){let e=1;xn(Ns(this.source),t=>{Na(t)&&M0(t,this),Uy(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))}),this.priority=e,this._start()}_detach(){xn(Ns(this.source),e=>{Na(e)&&t2(e,this)}),this._active.clear(),$v(this)}eventObserved(e){e.type=="change"?e.idle?this.advance():(this._active.add(e.parent),this._start()):e.type=="idle"?this._active.delete(e.parent):e.type=="priority"&&(this.priority=Ns(this.source).reduce((t,i)=>Math.max(t,(Uy(i)?i.priority:0)+1),0))}}function Zj(n){return n.idle!==!1}function xS(n){return!n.size||Array.from(n).every(Zj)}function $v(n){n.idle||(n.idle=!0,xn(S1(n),e=>{e.done=!0}),e2(n,{type:"idle",parent:n}))}eo.assign({createStringInterpolator:pM,to:(n,e)=>new Jj(n,e)});const eK=["primitive"].concat(Object.keys(KT).filter(n=>/^[A-Z]/.test(n)).map(n=>n[0].toLowerCase()+n.slice(1)));eo.assign({createStringInterpolator:pM,colors:XX,frameLoop:"demand"});hz(()=>{Pt.advance()});const tK=Ij(eK,{applyAnimatedValues:Pc}),mi=tK.animated;function n8(){}n8.prototype.s2u=function(n){for(var e=this.s2uTable,t="",i=0;i<n.length;){var r=n[i++];if(!(r>=0&&r<=126||r>=161&&r<=223)&&i<n.length&&(r=r<<8|n[i++]),e[r]===void 0)return console.error("unknown char code "+r+"."),t;t+=String.fromCharCode(e[r])}return t};n8.prototype.s2uTable={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,14:14,15:15,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,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:92,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,161:65377,162:65378,163:65379,164:65380,165:65381,166:65382,167:65383,168:65384,169:65385,170:65386,171:65387,172:65388,173:65389,174:65390,175:65391,176:65392,177:65393,178:65394,179:65395,180:65396,181:65397,182:65398,183:65399,184:65400,185:65401,186:65402,187:65403,188:65404,189:65405,190:65406,191:65407,192:65408,193:65409,194:65410,195:65411,196:65412,197:65413,198:65414,199:65415,200:65416,201:65417,202:65418,203:65419,204:65420,205:65421,206:65422,207:65423,208:65424,209:65425,210:65426,211:65427,212:65428,213:65429,214:65430,215:65431,216:65432,217:65433,218:65434,219:65435,220:65436,221:65437,222:65438,223:65439,33088:12288,33089:12289,33090:12290,33091:65292,33092:65294,33093:12539,33094:65306,33095:65307,33096:65311,33097:65281,33098:12443,33099:12444,33100:180,33101:65344,33102:168,33103:65342,33104:65507,33105:65343,33106:12541,33107:12542,33108:12445,33109:12446,33110:12291,33111:20189,33112:12293,33113:12294,33114:12295,33115:12540,33116:8213,33117:8208,33118:65295,33119:65340,33120:65374,33121:8741,33122:65372,33123:8230,33124:8229,33125:8216,33126:8217,33127:8220,33128:8221,33129:65288,33130:65289,33131:12308,33132:12309,33133:65339,33134:65341,33135:65371,33136:65373,33137:12296,33138:12297,33139:12298,33140:12299,33141:12300,33142:12301,33143:12302,33144:12303,33145:12304,33146:12305,33147:65291,33148:65293,33149:177,33150:215,33152:247,33153:65309,33154:8800,33155:65308,33156:65310,33157:8806,33158:8807,33159:8734,33160:8756,33161:9794,33162:9792,33163:176,33164:8242,33165:8243,33166:8451,33167:65509,33168:65284,33169:65504,33170:65505,33171:65285,33172:65283,33173:65286,33174:65290,33175:65312,33176:167,33177:9734,33178:9733,33179:9675,33180:9679,33181:9678,33182:9671,33183:9670,33184:9633,33185:9632,33186:9651,33187:9650,33188:9661,33189:9660,33190:8251,33191:12306,33192:8594,33193:8592,33194:8593,33195:8595,33196:12307,33208:8712,33209:8715,33210:8838,33211:8839,33212:8834,33213:8835,33214:8746,33215:8745,33224:8743,33225:8744,33226:65506,33227:8658,33228:8660,33229:8704,33230:8707,33242:8736,33243:8869,33244:8978,33245:8706,33246:8711,33247:8801,33248:8786,33249:8810,33250:8811,33251:8730,33252:8765,33253:8733,33254:8757,33255:8747,33256:8748,33264:8491,33265:8240,33266:9839,33267:9837,33268:9834,33269:8224,33270:8225,33271:182,33276:9711,33359:65296,33360:65297,33361:65298,33362:65299,33363:65300,33364:65301,33365:65302,33366:65303,33367:65304,33368:65305,33376:65313,33377:65314,33378:65315,33379:65316,33380:65317,33381:65318,33382:65319,33383:65320,33384:65321,33385:65322,33386:65323,33387:65324,33388:65325,33389:65326,33390:65327,33391:65328,33392:65329,33393:65330,33394:65331,33395:65332,33396:65333,33397:65334,33398:65335,33399:65336,33400:65337,33401:65338,33409:65345,33410:65346,33411:65347,33412:65348,33413:65349,33414:65350,33415:65351,33416:65352,33417:65353,33418:65354,33419:65355,33420:65356,33421:65357,33422:65358,33423:65359,33424:65360,33425:65361,33426:65362,33427:65363,33428:65364,33429:65365,33430:65366,33431:65367,33432:65368,33433:65369,33434:65370,33439:12353,33440:12354,33441:12355,33442:12356,33443:12357,33444:12358,33445:12359,33446:12360,33447:12361,33448:12362,33449:12363,33450:12364,33451:12365,33452:12366,33453:12367,33454:12368,33455:12369,33456:12370,33457:12371,33458:12372,33459:12373,33460:12374,33461:12375,33462:12376,33463:12377,33464:12378,33465:12379,33466:12380,33467:12381,33468:12382,33469:12383,33470:12384,33471:12385,33472:12386,33473:12387,33474:12388,33475:12389,33476:12390,33477:12391,33478:12392,33479:12393,33480:12394,33481:12395,33482:12396,33483:12397,33484:12398,33485:12399,33486:12400,33487:12401,33488:12402,33489:12403,33490:12404,33491:12405,33492:12406,33493:12407,33494:12408,33495:12409,33496:12410,33497:12411,33498:12412,33499:12413,33500:12414,33501:12415,33502:12416,33503:12417,33504:12418,33505:12419,33506:12420,33507:12421,33508:12422,33509:12423,33510:12424,33511:12425,33512:12426,33513:12427,33514:12428,33515:12429,33516:12430,33517:12431,33518:12432,33519:12433,33520:12434,33521:12435,33600:12449,33601:12450,33602:12451,33603:12452,33604:12453,33605:12454,33606:12455,33607:12456,33608:12457,33609:12458,33610:12459,33611:12460,33612:12461,33613:12462,33614:12463,33615:12464,33616:12465,33617:12466,33618:12467,33619:12468,33620:12469,33621:12470,33622:12471,33623:12472,33624:12473,33625:12474,33626:12475,33627:12476,33628:12477,33629:12478,33630:12479,33631:12480,33632:12481,33633:12482,33634:12483,33635:12484,33636:12485,33637:12486,33638:12487,33639:12488,33640:12489,33641:12490,33642:12491,33643:12492,33644:12493,33645:12494,33646:12495,33647:12496,33648:12497,33649:12498,33650:12499,33651:12500,33652:12501,33653:12502,33654:12503,33655:12504,33656:12505,33657:12506,33658:12507,33659:12508,33660:12509,33661:12510,33662:12511,33664:12512,33665:12513,33666:12514,33667:12515,33668:12516,33669:12517,33670:12518,33671:12519,33672:12520,33673:12521,33674:12522,33675:12523,33676:12524,33677:12525,33678:12526,33679:12527,33680:12528,33681:12529,33682:12530,33683:12531,33684:12532,33685:12533,33686:12534,33695:913,33696:914,33697:915,33698:916,33699:917,33700:918,33701:919,33702:920,33703:921,33704:922,33705:923,33706:924,33707:925,33708:926,33709:927,33710:928,33711:929,33712:931,33713:932,33714:933,33715:934,33716:935,33717:936,33718:937,33727:945,33728:946,33729:947,33730:948,33731:949,33732:950,33733:951,33734:952,33735:953,33736:954,33737:955,33738:956,33739:957,33740:958,33741:959,33742:960,33743:961,33744:963,33745:964,33746:965,33747:966,33748:967,33749:968,33750:969,33856:1040,33857:1041,33858:1042,33859:1043,33860:1044,33861:1045,33862:1025,33863:1046,33864:1047,33865:1048,33866:1049,33867:1050,33868:1051,33869:1052,33870:1053,33871:1054,33872:1055,33873:1056,33874:1057,33875:1058,33876:1059,33877:1060,33878:1061,33879:1062,33880:1063,33881:1064,33882:1065,33883:1066,33884:1067,33885:1068,33886:1069,33887:1070,33888:1071,33904:1072,33905:1073,33906:1074,33907:1075,33908:1076,33909:1077,33910:1105,33911:1078,33912:1079,33913:1080,33914:1081,33915:1082,33916:1083,33917:1084,33918:1085,33920:1086,33921:1087,33922:1088,33923:1089,33924:1090,33925:1091,33926:1092,33927:1093,33928:1094,33929:1095,33930:1096,33931:1097,33932:1098,33933:1099,33934:1100,33935:1101,33936:1102,33937:1103,33951:9472,33952:9474,33953:9484,33954:9488,33955:9496,33956:9492,33957:9500,33958:9516,33959:9508,33960:9524,33961:9532,33962:9473,33963:9475,33964:9487,33965:9491,33966:9499,33967:9495,33968:9507,33969:9523,33970:9515,33971:9531,33972:9547,33973:9504,33974:9519,33975:9512,33976:9527,33977:9535,33978:9501,33979:9520,33980:9509,33981:9528,33982:9538,34624:9312,34625:9313,34626:9314,34627:9315,34628:9316,34629:9317,34630:9318,34631:9319,34632:9320,34633:9321,34634:9322,34635:9323,34636:9324,34637:9325,34638:9326,34639:9327,34640:9328,34641:9329,34642:9330,34643:9331,34644:8544,34645:8545,34646:8546,34647:8547,34648:8548,34649:8549,34650:8550,34651:8551,34652:8552,34653:8553,34655:13129,34656:13076,34657:13090,34658:13133,34659:13080,34660:13095,34661:13059,34662:13110,34663:13137,34664:13143,34665:13069,34666:13094,34667:13091,34668:13099,34669:13130,34670:13115,34671:13212,34672:13213,34673:13214,34674:13198,34675:13199,34676:13252,34677:13217,34686:13179,34688:12317,34689:12319,34690:8470,34691:13261,34692:8481,34693:12964,34694:12965,34695:12966,34696:12967,34697:12968,34698:12849,34699:12850,34700:12857,34701:13182,34702:13181,34703:13180,34704:8786,34705:8801,34706:8747,34707:8750,34708:8721,34709:8730,34710:8869,34711:8736,34712:8735,34713:8895,34714:8757,34715:8745,34716:8746,34975:20124,34976:21782,34977:23043,34978:38463,34979:21696,34980:24859,34981:25384,34982:23030,34983:36898,34984:33909,34985:33564,34986:31312,34987:24746,34988:25569,34989:28197,34990:26093,34991:33894,34992:33446,34993:39925,34994:26771,34995:22311,34996:26017,34997:25201,34998:23451,34999:22992,35e3:34427,35001:39156,35002:32098,35003:32190,35004:39822,35005:25110,35006:31903,35007:34999,35008:23433,35009:24245,35010:25353,35011:26263,35012:26696,35013:38343,35014:38797,35015:26447,35016:20197,35017:20234,35018:20301,35019:20381,35020:20553,35021:22258,35022:22839,35023:22996,35024:23041,35025:23561,35026:24799,35027:24847,35028:24944,35029:26131,35030:26885,35031:28858,35032:30031,35033:30064,35034:31227,35035:32173,35036:32239,35037:32963,35038:33806,35039:34915,35040:35586,35041:36949,35042:36986,35043:21307,35044:20117,35045:20133,35046:22495,35047:32946,35048:37057,35049:30959,35050:19968,35051:22769,35052:28322,35053:36920,35054:31282,35055:33576,35056:33419,35057:39983,35058:20801,35059:21360,35060:21693,35061:21729,35062:22240,35063:23035,35064:24341,35065:39154,35066:28139,35067:32996,35068:34093,35136:38498,35137:38512,35138:38560,35139:38907,35140:21515,35141:21491,35142:23431,35143:28879,35144:32701,35145:36802,35146:38632,35147:21359,35148:40284,35149:31418,35150:19985,35151:30867,35152:33276,35153:28198,35154:22040,35155:21764,35156:27421,35157:34074,35158:39995,35159:23013,35160:21417,35161:28006,35162:29916,35163:38287,35164:22082,35165:20113,35166:36939,35167:38642,35168:33615,35169:39180,35170:21473,35171:21942,35172:23344,35173:24433,35174:26144,35175:26355,35176:26628,35177:27704,35178:27891,35179:27945,35180:29787,35181:30408,35182:31310,35183:38964,35184:33521,35185:34907,35186:35424,35187:37613,35188:28082,35189:30123,35190:30410,35191:39365,35192:24742,35193:35585,35194:36234,35195:38322,35196:27022,35197:21421,35198:20870,35200:22290,35201:22576,35202:22852,35203:23476,35204:24310,35205:24616,35206:25513,35207:25588,35208:27839,35209:28436,35210:28814,35211:28948,35212:29017,35213:29141,35214:29503,35215:32257,35216:33398,35217:33489,35218:34199,35219:36960,35220:37467,35221:40219,35222:22633,35223:26044,35224:27738,35225:29989,35226:20985,35227:22830,35228:22885,35229:24448,35230:24540,35231:25276,35232:26106,35233:27178,35234:27431,35235:27572,35236:29579,35237:32705,35238:35158,35239:40236,35240:40206,35241:40644,35242:23713,35243:27798,35244:33659,35245:20740,35246:23627,35247:25014,35248:33222,35249:26742,35250:29281,35251:20057,35252:20474,35253:21368,35254:24681,35255:28201,35256:31311,35257:38899,35258:19979,35259:21270,35260:20206,35261:20309,35262:20285,35263:20385,35264:20339,35265:21152,35266:21487,35267:22025,35268:22799,35269:23233,35270:23478,35271:23521,35272:31185,35273:26247,35274:26524,35275:26550,35276:27468,35277:27827,35278:28779,35279:29634,35280:31117,35281:31166,35282:31292,35283:31623,35284:33457,35285:33499,35286:33540,35287:33655,35288:33775,35289:33747,35290:34662,35291:35506,35292:22057,35293:36008,35294:36838,35295:36942,35296:38686,35297:34442,35298:20420,35299:23784,35300:25105,35301:29273,35302:30011,35303:33253,35304:33469,35305:34558,35306:36032,35307:38597,35308:39187,35309:39381,35310:20171,35311:20250,35312:35299,35313:22238,35314:22602,35315:22730,35316:24315,35317:24555,35318:24618,35319:24724,35320:24674,35321:25040,35322:25106,35323:25296,35324:25913,35392:39745,35393:26214,35394:26800,35395:28023,35396:28784,35397:30028,35398:30342,35399:32117,35400:33445,35401:34809,35402:38283,35403:38542,35404:35997,35405:20977,35406:21182,35407:22806,35408:21683,35409:23475,35410:23830,35411:24936,35412:27010,35413:28079,35414:30861,35415:33995,35416:34903,35417:35442,35418:37799,35419:39608,35420:28012,35421:39336,35422:34521,35423:22435,35424:26623,35425:34510,35426:37390,35427:21123,35428:22151,35429:21508,35430:24275,35431:25313,35432:25785,35433:26684,35434:26680,35435:27579,35436:29554,35437:30906,35438:31339,35439:35226,35440:35282,35441:36203,35442:36611,35443:37101,35444:38307,35445:38548,35446:38761,35447:23398,35448:23731,35449:27005,35450:38989,35451:38990,35452:25499,35453:31520,35454:27179,35456:27263,35457:26806,35458:39949,35459:28511,35460:21106,35461:21917,35462:24688,35463:25324,35464:27963,35465:28167,35466:28369,35467:33883,35468:35088,35469:36676,35470:19988,35471:39993,35472:21494,35473:26907,35474:27194,35475:38788,35476:26666,35477:20828,35478:31427,35479:33970,35480:37340,35481:37772,35482:22107,35483:40232,35484:26658,35485:33541,35486:33841,35487:31909,35488:21e3,35489:33477,35490:29926,35491:20094,35492:20355,35493:20896,35494:23506,35495:21002,35496:21208,35497:21223,35498:24059,35499:21914,35500:22570,35501:23014,35502:23436,35503:23448,35504:23515,35505:24178,35506:24185,35507:24739,35508:24863,35509:24931,35510:25022,35511:25563,35512:25954,35513:26577,35514:26707,35515:26874,35516:27454,35517:27475,35518:27735,35519:28450,35520:28567,35521:28485,35522:29872,35523:29976,35524:30435,35525:30475,35526:31487,35527:31649,35528:31777,35529:32233,35530:32566,35531:32752,35532:32925,35533:33382,35534:33694,35535:35251,35536:35532,35537:36011,35538:36996,35539:37969,35540:38291,35541:38289,35542:38306,35543:38501,35544:38867,35545:39208,35546:33304,35547:20024,35548:21547,35549:23736,35550:24012,35551:29609,35552:30284,35553:30524,35554:23721,35555:32747,35556:36107,35557:38593,35558:38929,35559:38996,35560:39e3,35561:20225,35562:20238,35563:21361,35564:21916,35565:22120,35566:22522,35567:22855,35568:23305,35569:23492,35570:23696,35571:24076,35572:24190,35573:24524,35574:25582,35575:26426,35576:26071,35577:26082,35578:26399,35579:26827,35580:26820,35648:27231,35649:24112,35650:27589,35651:27671,35652:27773,35653:30079,35654:31048,35655:23395,35656:31232,35657:32e3,35658:24509,35659:35215,35660:35352,35661:36020,35662:36215,35663:36556,35664:36637,35665:39138,35666:39438,35667:39740,35668:20096,35669:20605,35670:20736,35671:22931,35672:23452,35673:25135,35674:25216,35675:25836,35676:27450,35677:29344,35678:30097,35679:31047,35680:32681,35681:34811,35682:35516,35683:35696,35684:25516,35685:33738,35686:38816,35687:21513,35688:21507,35689:21931,35690:26708,35691:27224,35692:35440,35693:30759,35694:26485,35695:40653,35696:21364,35697:23458,35698:33050,35699:34384,35700:36870,35701:19992,35702:20037,35703:20167,35704:20241,35705:21450,35706:21560,35707:23470,35708:24339,35709:24613,35710:25937,35712:26429,35713:27714,35714:27762,35715:27875,35716:28792,35717:29699,35718:31350,35719:31406,35720:31496,35721:32026,35722:31998,35723:32102,35724:26087,35725:29275,35726:21435,35727:23621,35728:24040,35729:25298,35730:25312,35731:25369,35732:28192,35733:34394,35734:35377,35735:36317,35736:37624,35737:28417,35738:31142,35739:39770,35740:20136,35741:20139,35742:20140,35743:20379,35744:20384,35745:20689,35746:20807,35747:31478,35748:20849,35749:20982,35750:21332,35751:21281,35752:21375,35753:21483,35754:21932,35755:22659,35756:23777,35757:24375,35758:24394,35759:24623,35760:24656,35761:24685,35762:25375,35763:25945,35764:27211,35765:27841,35766:29378,35767:29421,35768:30703,35769:33016,35770:33029,35771:33288,35772:34126,35773:37111,35774:37857,35775:38911,35776:39255,35777:39514,35778:20208,35779:20957,35780:23597,35781:26241,35782:26989,35783:23616,35784:26354,35785:26997,35786:29577,35787:26704,35788:31873,35789:20677,35790:21220,35791:22343,35792:24062,35793:37670,35794:26020,35795:27427,35796:27453,35797:29748,35798:31105,35799:31165,35800:31563,35801:32202,35802:33465,35803:33740,35804:34943,35805:35167,35806:35641,35807:36817,35808:37329,35809:21535,35810:37504,35811:20061,35812:20534,35813:21477,35814:21306,35815:29399,35816:29590,35817:30697,35818:33510,35819:36527,35820:39366,35821:39368,35822:39378,35823:20855,35824:24858,35825:34398,35826:21936,35827:31354,35828:20598,35829:23507,35830:36935,35831:38533,35832:20018,35833:27355,35834:37351,35835:23633,35836:23624,35904:25496,35905:31391,35906:27795,35907:38772,35908:36705,35909:31402,35910:29066,35911:38536,35912:31874,35913:26647,35914:32368,35915:26705,35916:37740,35917:21234,35918:21531,35919:34219,35920:35347,35921:32676,35922:36557,35923:37089,35924:21350,35925:34952,35926:31041,35927:20418,35928:20670,35929:21009,35930:20804,35931:21843,35932:22317,35933:29674,35934:22411,35935:22865,35936:24418,35937:24452,35938:24693,35939:24950,35940:24935,35941:25001,35942:25522,35943:25658,35944:25964,35945:26223,35946:26690,35947:28179,35948:30054,35949:31293,35950:31995,35951:32076,35952:32153,35953:32331,35954:32619,35955:33550,35956:33610,35957:34509,35958:35336,35959:35427,35960:35686,35961:36605,35962:38938,35963:40335,35964:33464,35965:36814,35966:39912,35968:21127,35969:25119,35970:25731,35971:28608,35972:38553,35973:26689,35974:20625,35975:27424,35976:27770,35977:28500,35978:31348,35979:32080,35980:34880,35981:35363,35982:26376,35983:20214,35984:20537,35985:20518,35986:20581,35987:20860,35988:21048,35989:21091,35990:21927,35991:22287,35992:22533,35993:23244,35994:24314,35995:25010,35996:25080,35997:25331,35998:25458,35999:26908,36e3:27177,36001:29309,36002:29356,36003:29486,36004:30740,36005:30831,36006:32121,36007:30476,36008:32937,36009:35211,36010:35609,36011:36066,36012:36562,36013:36963,36014:37749,36015:38522,36016:38997,36017:39443,36018:40568,36019:20803,36020:21407,36021:21427,36022:24187,36023:24358,36024:28187,36025:28304,36026:29572,36027:29694,36028:32067,36029:33335,36030:35328,36031:35578,36032:38480,36033:20046,36034:20491,36035:21476,36036:21628,36037:22266,36038:22993,36039:23396,36040:24049,36041:24235,36042:24359,36043:25144,36044:25925,36045:26543,36046:28246,36047:29392,36048:31946,36049:34996,36050:32929,36051:32993,36052:33776,36053:34382,36054:35463,36055:36328,36056:37431,36057:38599,36058:39015,36059:40723,36060:20116,36061:20114,36062:20237,36063:21320,36064:21577,36065:21566,36066:23087,36067:24460,36068:24481,36069:24735,36070:26791,36071:27278,36072:29786,36073:30849,36074:35486,36075:35492,36076:35703,36077:37264,36078:20062,36079:39881,36080:20132,36081:20348,36082:20399,36083:20505,36084:20502,36085:20809,36086:20844,36087:21151,36088:21177,36089:21246,36090:21402,36091:21475,36092:21521,36160:21518,36161:21897,36162:22353,36163:22434,36164:22909,36165:23380,36166:23389,36167:23439,36168:24037,36169:24039,36170:24055,36171:24184,36172:24195,36173:24218,36174:24247,36175:24344,36176:24658,36177:24908,36178:25239,36179:25304,36180:25511,36181:25915,36182:26114,36183:26179,36184:26356,36185:26477,36186:26657,36187:26775,36188:27083,36189:27743,36190:27946,36191:28009,36192:28207,36193:28317,36194:30002,36195:30343,36196:30828,36197:31295,36198:31968,36199:32005,36200:32024,36201:32094,36202:32177,36203:32789,36204:32771,36205:32943,36206:32945,36207:33108,36208:33167,36209:33322,36210:33618,36211:34892,36212:34913,36213:35611,36214:36002,36215:36092,36216:37066,36217:37237,36218:37489,36219:30783,36220:37628,36221:38308,36222:38477,36224:38917,36225:39321,36226:39640,36227:40251,36228:21083,36229:21163,36230:21495,36231:21512,36232:22741,36233:25335,36234:28640,36235:35946,36236:36703,36237:40633,36238:20811,36239:21051,36240:21578,36241:22269,36242:31296,36243:37239,36244:40288,36245:40658,36246:29508,36247:28425,36248:33136,36249:29969,36250:24573,36251:24794,36252:39592,36253:29403,36254:36796,36255:27492,36256:38915,36257:20170,36258:22256,36259:22372,36260:22718,36261:23130,36262:24680,36263:25031,36264:26127,36265:26118,36266:26681,36267:26801,36268:28151,36269:30165,36270:32058,36271:33390,36272:39746,36273:20123,36274:20304,36275:21449,36276:21766,36277:23919,36278:24038,36279:24046,36280:26619,36281:27801,36282:29811,36283:30722,36284:35408,36285:37782,36286:35039,36287:22352,36288:24231,36289:25387,36290:20661,36291:20652,36292:20877,36293:26368,36294:21705,36295:22622,36296:22971,36297:23472,36298:24425,36299:25165,36300:25505,36301:26685,36302:27507,36303:28168,36304:28797,36305:37319,36306:29312,36307:30741,36308:30758,36309:31085,36310:25998,36311:32048,36312:33756,36313:35009,36314:36617,36315:38555,36316:21092,36317:22312,36318:26448,36319:32618,36320:36001,36321:20916,36322:22338,36323:38442,36324:22586,36325:27018,36326:32948,36327:21682,36328:23822,36329:22524,36330:30869,36331:40442,36332:20316,36333:21066,36334:21643,36335:25662,36336:26152,36337:26388,36338:26613,36339:31364,36340:31574,36341:32034,36342:37679,36343:26716,36344:39853,36345:31545,36346:21273,36347:20874,36348:21047,36416:23519,36417:25334,36418:25774,36419:25830,36420:26413,36421:27578,36422:34217,36423:38609,36424:30352,36425:39894,36426:25420,36427:37638,36428:39851,36429:30399,36430:26194,36431:19977,36432:20632,36433:21442,36434:23665,36435:24808,36436:25746,36437:25955,36438:26719,36439:29158,36440:29642,36441:29987,36442:31639,36443:32386,36444:34453,36445:35715,36446:36059,36447:37240,36448:39184,36449:26028,36450:26283,36451:27531,36452:20181,36453:20180,36454:20282,36455:20351,36456:21050,36457:21496,36458:21490,36459:21987,36460:22235,36461:22763,36462:22987,36463:22985,36464:23039,36465:23376,36466:23629,36467:24066,36468:24107,36469:24535,36470:24605,36471:25351,36472:25903,36473:23388,36474:26031,36475:26045,36476:26088,36477:26525,36478:27490,36480:27515,36481:27663,36482:29509,36483:31049,36484:31169,36485:31992,36486:32025,36487:32043,36488:32930,36489:33026,36490:33267,36491:35222,36492:35422,36493:35433,36494:35430,36495:35468,36496:35566,36497:36039,36498:36060,36499:38604,36500:39164,36501:27503,36502:20107,36503:20284,36504:20365,36505:20816,36506:23383,36507:23546,36508:24904,36509:25345,36510:26178,36511:27425,36512:28363,36513:27835,36514:29246,36515:29885,36516:30164,36517:30913,36518:31034,36519:32780,36520:32819,36521:33258,36522:33940,36523:36766,36524:27728,36525:40575,36526:24335,36527:35672,36528:40235,36529:31482,36530:36600,36531:23437,36532:38635,36533:19971,36534:21489,36535:22519,36536:22833,36537:23241,36538:23460,36539:24713,36540:28287,36541:28422,36542:30142,36543:36074,36544:23455,36545:34048,36546:31712,36547:20594,36548:26612,36549:33437,36550:23649,36551:34122,36552:32286,36553:33294,36554:20889,36555:23556,36556:25448,36557:36198,36558:26012,36559:29038,36560:31038,36561:32023,36562:32773,36563:35613,36564:36554,36565:36974,36566:34503,36567:37034,36568:20511,36569:21242,36570:23610,36571:26451,36572:28796,36573:29237,36574:37196,36575:37320,36576:37675,36577:33509,36578:23490,36579:24369,36580:24825,36581:20027,36582:21462,36583:23432,36584:25163,36585:26417,36586:27530,36587:29417,36588:29664,36589:31278,36590:33131,36591:36259,36592:37202,36593:39318,36594:20754,36595:21463,36596:21610,36597:23551,36598:25480,36599:27193,36600:32172,36601:38656,36602:22234,36603:21454,36604:21608,36672:23447,36673:23601,36674:24030,36675:20462,36676:24833,36677:25342,36678:27954,36679:31168,36680:31179,36681:32066,36682:32333,36683:32722,36684:33261,36685:33311,36686:33936,36687:34886,36688:35186,36689:35728,36690:36468,36691:36655,36692:36913,36693:37195,36694:37228,36695:38598,36696:37276,36697:20160,36698:20303,36699:20805,36700:21313,36701:24467,36702:25102,36703:26580,36704:27713,36705:28171,36706:29539,36707:32294,36708:37325,36709:37507,36710:21460,36711:22809,36712:23487,36713:28113,36714:31069,36715:32302,36716:31899,36717:22654,36718:29087,36719:20986,36720:34899,36721:36848,36722:20426,36723:23803,36724:26149,36725:30636,36726:31459,36727:33308,36728:39423,36729:20934,36730:24490,36731:26092,36732:26991,36733:27529,36734:28147,36736:28310,36737:28516,36738:30462,36739:32020,36740:24033,36741:36981,36742:37255,36743:38918,36744:20966,36745:21021,36746:25152,36747:26257,36748:26329,36749:28186,36750:24246,36751:32210,36752:32626,36753:26360,36754:34223,36755:34295,36756:35576,36757:21161,36758:21465,36759:22899,36760:24207,36761:24464,36762:24661,36763:37604,36764:38500,36765:20663,36766:20767,36767:21213,36768:21280,36769:21319,36770:21484,36771:21736,36772:21830,36773:21809,36774:22039,36775:22888,36776:22974,36777:23100,36778:23477,36779:23558,36780:23567,36781:23569,36782:23578,36783:24196,36784:24202,36785:24288,36786:24432,36787:25215,36788:25220,36789:25307,36790:25484,36791:25463,36792:26119,36793:26124,36794:26157,36795:26230,36796:26494,36797:26786,36798:27167,36799:27189,36800:27836,36801:28040,36802:28169,36803:28248,36804:28988,36805:28966,36806:29031,36807:30151,36808:30465,36809:30813,36810:30977,36811:31077,36812:31216,36813:31456,36814:31505,36815:31911,36816:32057,36817:32918,36818:33750,36819:33931,36820:34121,36821:34909,36822:35059,36823:35359,36824:35388,36825:35412,36826:35443,36827:35937,36828:36062,36829:37284,36830:37478,36831:37758,36832:37912,36833:38556,36834:38808,36835:19978,36836:19976,36837:19998,36838:20055,36839:20887,36840:21104,36841:22478,36842:22580,36843:22732,36844:23330,36845:24120,36846:24773,36847:25854,36848:26465,36849:26454,36850:27972,36851:29366,36852:30067,36853:31331,36854:33976,36855:35698,36856:37304,36857:37664,36858:22065,36859:22516,36860:39166,36928:25325,36929:26893,36930:27542,36931:29165,36932:32340,36933:32887,36934:33394,36935:35302,36936:39135,36937:34645,36938:36785,36939:23611,36940:20280,36941:20449,36942:20405,36943:21767,36944:23072,36945:23517,36946:23529,36947:24515,36948:24910,36949:25391,36950:26032,36951:26187,36952:26862,36953:27035,36954:28024,36955:28145,36956:30003,36957:30137,36958:30495,36959:31070,36960:31206,36961:32051,36962:33251,36963:33455,36964:34218,36965:35242,36966:35386,36967:36523,36968:36763,36969:36914,36970:37341,36971:38663,36972:20154,36973:20161,36974:20995,36975:22645,36976:22764,36977:23563,36978:29978,36979:23613,36980:33102,36981:35338,36982:36805,36983:38499,36984:38765,36985:31525,36986:35535,36987:38920,36988:37218,36989:22259,36990:21416,36992:36887,36993:21561,36994:22402,36995:24101,36996:25512,36997:27700,36998:28810,36999:30561,37e3:31883,37001:32736,37002:34928,37003:36930,37004:37204,37005:37648,37006:37656,37007:38543,37008:29790,37009:39620,37010:23815,37011:23913,37012:25968,37013:26530,37014:36264,37015:38619,37016:25454,37017:26441,37018:26905,37019:33733,37020:38935,37021:38592,37022:35070,37023:28548,37024:25722,37025:23544,37026:19990,37027:28716,37028:30045,37029:26159,37030:20932,37031:21046,37032:21218,37033:22995,37034:24449,37035:24615,37036:25104,37037:25919,37038:25972,37039:26143,37040:26228,37041:26866,37042:26646,37043:27491,37044:28165,37045:29298,37046:29983,37047:30427,37048:31934,37049:32854,37050:22768,37051:35069,37052:35199,37053:35488,37054:35475,37055:35531,37056:36893,37057:37266,37058:38738,37059:38745,37060:25993,37061:31246,37062:33030,37063:38587,37064:24109,37065:24796,37066:25114,37067:26021,37068:26132,37069:26512,37070:30707,37071:31309,37072:31821,37073:32318,37074:33034,37075:36012,37076:36196,37077:36321,37078:36447,37079:30889,37080:20999,37081:25305,37082:25509,37083:25666,37084:25240,37085:35373,37086:31363,37087:31680,37088:35500,37089:38634,37090:32118,37091:33292,37092:34633,37093:20185,37094:20808,37095:21315,37096:21344,37097:23459,37098:23554,37099:23574,37100:24029,37101:25126,37102:25159,37103:25776,37104:26643,37105:26676,37106:27849,37107:27973,37108:27927,37109:26579,37110:28508,37111:29006,37112:29053,37113:26059,37114:31359,37115:31661,37116:32218,37184:32330,37185:32680,37186:33146,37187:33307,37188:33337,37189:34214,37190:35438,37191:36046,37192:36341,37193:36984,37194:36983,37195:37549,37196:37521,37197:38275,37198:39854,37199:21069,37200:21892,37201:28472,37202:28982,37203:20840,37204:31109,37205:32341,37206:33203,37207:31950,37208:22092,37209:22609,37210:23720,37211:25514,37212:26366,37213:26365,37214:26970,37215:29401,37216:30095,37217:30094,37218:30990,37219:31062,37220:31199,37221:31895,37222:32032,37223:32068,37224:34311,37225:35380,37226:38459,37227:36961,37228:40736,37229:20711,37230:21109,37231:21452,37232:21474,37233:20489,37234:21930,37235:22766,37236:22863,37237:29245,37238:23435,37239:23652,37240:21277,37241:24803,37242:24819,37243:25436,37244:25475,37245:25407,37246:25531,37248:25805,37249:26089,37250:26361,37251:24035,37252:27085,37253:27133,37254:28437,37255:29157,37256:20105,37257:30185,37258:30456,37259:31379,37260:31967,37261:32207,37262:32156,37263:32865,37264:33609,37265:33624,37266:33900,37267:33980,37268:34299,37269:35013,37270:36208,37271:36865,37272:36973,37273:37783,37274:38684,37275:39442,37276:20687,37277:22679,37278:24974,37279:33235,37280:34101,37281:36104,37282:36896,37283:20419,37284:20596,37285:21063,37286:21363,37287:24687,37288:25417,37289:26463,37290:28204,37291:36275,37292:36895,37293:20439,37294:23646,37295:36042,37296:26063,37297:32154,37298:21330,37299:34966,37300:20854,37301:25539,37302:23384,37303:23403,37304:23562,37305:25613,37306:26449,37307:36956,37308:20182,37309:22810,37310:22826,37311:27760,37312:35409,37313:21822,37314:22549,37315:22949,37316:24816,37317:25171,37318:26561,37319:33333,37320:26965,37321:38464,37322:39364,37323:39464,37324:20307,37325:22534,37326:23550,37327:32784,37328:23729,37329:24111,37330:24453,37331:24608,37332:24907,37333:25140,37334:26367,37335:27888,37336:28382,37337:32974,37338:33151,37339:33492,37340:34955,37341:36024,37342:36864,37343:36910,37344:38538,37345:40667,37346:39899,37347:20195,37348:21488,37349:22823,37350:31532,37351:37261,37352:38988,37353:40441,37354:28381,37355:28711,37356:21331,37357:21828,37358:23429,37359:25176,37360:25246,37361:25299,37362:27810,37363:28655,37364:29730,37365:35351,37366:37944,37367:28609,37368:35582,37369:33592,37370:20967,37371:34552,37372:21482,37440:21481,37441:20294,37442:36948,37443:36784,37444:22890,37445:33073,37446:24061,37447:31466,37448:36799,37449:26842,37450:35895,37451:29432,37452:40008,37453:27197,37454:35504,37455:20025,37456:21336,37457:22022,37458:22374,37459:25285,37460:25506,37461:26086,37462:27470,37463:28129,37464:28251,37465:28845,37466:30701,37467:31471,37468:31658,37469:32187,37470:32829,37471:32966,37472:34507,37473:35477,37474:37723,37475:22243,37476:22727,37477:24382,37478:26029,37479:26262,37480:27264,37481:27573,37482:30007,37483:35527,37484:20516,37485:30693,37486:22320,37487:24347,37488:24677,37489:26234,37490:27744,37491:30196,37492:31258,37493:32622,37494:33268,37495:34584,37496:36933,37497:39347,37498:31689,37499:30044,37500:31481,37501:31569,37502:33988,37504:36880,37505:31209,37506:31378,37507:33590,37508:23265,37509:30528,37510:20013,37511:20210,37512:23449,37513:24544,37514:25277,37515:26172,37516:26609,37517:27880,37518:34411,37519:34935,37520:35387,37521:37198,37522:37619,37523:39376,37524:27159,37525:28710,37526:29482,37527:33511,37528:33879,37529:36015,37530:19969,37531:20806,37532:20939,37533:21899,37534:23541,37535:24086,37536:24115,37537:24193,37538:24340,37539:24373,37540:24427,37541:24500,37542:25074,37543:25361,37544:26274,37545:26397,37546:28526,37547:29266,37548:30010,37549:30522,37550:32884,37551:33081,37552:33144,37553:34678,37554:35519,37555:35548,37556:36229,37557:36339,37558:37530,37559:38263,37560:38914,37561:40165,37562:21189,37563:25431,37564:30452,37565:26389,37566:27784,37567:29645,37568:36035,37569:37806,37570:38515,37571:27941,37572:22684,37573:26894,37574:27084,37575:36861,37576:37786,37577:30171,37578:36890,37579:22618,37580:26626,37581:25524,37582:27131,37583:20291,37584:28460,37585:26584,37586:36795,37587:34086,37588:32180,37589:37716,37590:26943,37591:28528,37592:22378,37593:22775,37594:23340,37595:32044,37596:29226,37597:21514,37598:37347,37599:40372,37600:20141,37601:20302,37602:20572,37603:20597,37604:21059,37605:35998,37606:21576,37607:22564,37608:23450,37609:24093,37610:24213,37611:24237,37612:24311,37613:24351,37614:24716,37615:25269,37616:25402,37617:25552,37618:26799,37619:27712,37620:30855,37621:31118,37622:31243,37623:32224,37624:33351,37625:35330,37626:35558,37627:36420,37628:36883,37696:37048,37697:37165,37698:37336,37699:40718,37700:27877,37701:25688,37702:25826,37703:25973,37704:28404,37705:30340,37706:31515,37707:36969,37708:37841,37709:28346,37710:21746,37711:24505,37712:25764,37713:36685,37714:36845,37715:37444,37716:20856,37717:22635,37718:22825,37719:23637,37720:24215,37721:28155,37722:32399,37723:29980,37724:36028,37725:36578,37726:39003,37727:28857,37728:20253,37729:27583,37730:28593,37731:3e4,37732:38651,37733:20814,37734:21520,37735:22581,37736:22615,37737:22956,37738:23648,37739:24466,37740:26007,37741:26460,37742:28193,37743:30331,37744:33759,37745:36077,37746:36884,37747:37117,37748:37709,37749:30757,37750:30778,37751:21162,37752:24230,37753:22303,37754:22900,37755:24594,37756:20498,37757:20826,37758:20908,37760:20941,37761:20992,37762:21776,37763:22612,37764:22616,37765:22871,37766:23445,37767:23798,37768:23947,37769:24764,37770:25237,37771:25645,37772:26481,37773:26691,37774:26812,37775:26847,37776:30423,37777:28120,37778:28271,37779:28059,37780:28783,37781:29128,37782:24403,37783:30168,37784:31095,37785:31561,37786:31572,37787:31570,37788:31958,37789:32113,37790:21040,37791:33891,37792:34153,37793:34276,37794:35342,37795:35588,37796:35910,37797:36367,37798:36867,37799:36879,37800:37913,37801:38518,37802:38957,37803:39472,37804:38360,37805:20685,37806:21205,37807:21516,37808:22530,37809:23566,37810:24999,37811:25758,37812:27934,37813:30643,37814:31461,37815:33012,37816:33796,37817:36947,37818:37509,37819:23776,37820:40199,37821:21311,37822:24471,37823:24499,37824:28060,37825:29305,37826:30563,37827:31167,37828:31716,37829:27602,37830:29420,37831:35501,37832:26627,37833:27233,37834:20984,37835:31361,37836:26932,37837:23626,37838:40182,37839:33515,37840:23493,37841:37193,37842:28702,37843:22136,37844:23663,37845:24775,37846:25958,37847:27788,37848:35930,37849:36929,37850:38931,37851:21585,37852:26311,37853:37389,37854:22856,37855:37027,37856:20869,37857:20045,37858:20970,37859:34201,37860:35598,37861:28760,37862:25466,37863:37707,37864:26978,37865:39348,37866:32260,37867:30071,37868:21335,37869:26976,37870:36575,37871:38627,37872:27741,37873:20108,37874:23612,37875:24336,37876:36841,37877:21250,37878:36049,37879:32905,37880:34425,37881:24319,37882:26085,37883:20083,37884:20837,37952:22914,37953:23615,37954:38894,37955:20219,37956:22922,37957:24525,37958:35469,37959:28641,37960:31152,37961:31074,37962:23527,37963:33905,37964:29483,37965:29105,37966:24180,37967:24565,37968:25467,37969:25754,37970:29123,37971:31896,37972:20035,37973:24316,37974:20043,37975:22492,37976:22178,37977:24745,37978:28611,37979:32013,37980:33021,37981:33075,37982:33215,37983:36786,37984:35223,37985:34468,37986:24052,37987:25226,37988:25773,37989:35207,37990:26487,37991:27874,37992:27966,37993:29750,37994:30772,37995:23110,37996:32629,37997:33453,37998:39340,37999:20467,38e3:24259,38001:25309,38002:25490,38003:25943,38004:26479,38005:30403,38006:29260,38007:32972,38008:32954,38009:36649,38010:37197,38011:20493,38012:22521,38013:23186,38014:26757,38016:26995,38017:29028,38018:29437,38019:36023,38020:22770,38021:36064,38022:38506,38023:36889,38024:34687,38025:31204,38026:30695,38027:33833,38028:20271,38029:21093,38030:21338,38031:25293,38032:26575,38033:27850,38034:30333,38035:31636,38036:31893,38037:33334,38038:34180,38039:36843,38040:26333,38041:28448,38042:29190,38043:32283,38044:33707,38045:39361,38046:40614,38047:20989,38048:31665,38049:30834,38050:31672,38051:32903,38052:31560,38053:27368,38054:24161,38055:32908,38056:30033,38057:30048,38058:20843,38059:37474,38060:28300,38061:30330,38062:37271,38063:39658,38064:20240,38065:32624,38066:25244,38067:31567,38068:38309,38069:40169,38070:22138,38071:22617,38072:34532,38073:38588,38074:20276,38075:21028,38076:21322,38077:21453,38078:21467,38079:24070,38080:25644,38081:26001,38082:26495,38083:27710,38084:27726,38085:29256,38086:29359,38087:29677,38088:30036,38089:32321,38090:33324,38091:34281,38092:36009,38093:31684,38094:37318,38095:29033,38096:38930,38097:39151,38098:25405,38099:26217,38100:30058,38101:30436,38102:30928,38103:34115,38104:34542,38105:21290,38106:21329,38107:21542,38108:22915,38109:24199,38110:24444,38111:24754,38112:25161,38113:25209,38114:25259,38115:26e3,38116:27604,38117:27852,38118:30130,38119:30382,38120:30865,38121:31192,38122:32203,38123:32631,38124:32933,38125:34987,38126:35513,38127:36027,38128:36991,38129:38750,38130:39131,38131:27147,38132:31800,38133:20633,38134:23614,38135:24494,38136:26503,38137:27608,38138:29749,38139:30473,38140:32654,38208:40763,38209:26570,38210:31255,38211:21305,38212:30091,38213:39661,38214:24422,38215:33181,38216:33777,38217:32920,38218:24380,38219:24517,38220:30050,38221:31558,38222:36924,38223:26727,38224:23019,38225:23195,38226:32016,38227:30334,38228:35628,38229:20469,38230:24426,38231:27161,38232:27703,38233:28418,38234:29922,38235:31080,38236:34920,38237:35413,38238:35961,38239:24287,38240:25551,38241:30149,38242:31186,38243:33495,38244:37672,38245:37618,38246:33948,38247:34541,38248:39981,38249:21697,38250:24428,38251:25996,38252:27996,38253:28693,38254:36007,38255:36051,38256:38971,38257:25935,38258:29942,38259:19981,38260:20184,38261:22496,38262:22827,38263:23142,38264:23500,38265:20904,38266:24067,38267:24220,38268:24598,38269:25206,38270:25975,38272:26023,38273:26222,38274:28014,38275:29238,38276:31526,38277:33104,38278:33178,38279:33433,38280:35676,38281:36e3,38282:36070,38283:36212,38284:38428,38285:38468,38286:20398,38287:25771,38288:27494,38289:33310,38290:33889,38291:34154,38292:37096,38293:23553,38294:26963,38295:39080,38296:33914,38297:34135,38298:20239,38299:21103,38300:24489,38301:24133,38302:26381,38303:31119,38304:33145,38305:35079,38306:35206,38307:28149,38308:24343,38309:25173,38310:27832,38311:20175,38312:29289,38313:39826,38314:20998,38315:21563,38316:22132,38317:22707,38318:24996,38319:25198,38320:28954,38321:22894,38322:31881,38323:31966,38324:32027,38325:38640,38326:25991,38327:32862,38328:19993,38329:20341,38330:20853,38331:22592,38332:24163,38333:24179,38334:24330,38335:26564,38336:20006,38337:34109,38338:38281,38339:38491,38340:31859,38341:38913,38342:20731,38343:22721,38344:30294,38345:30887,38346:21029,38347:30629,38348:34065,38349:31622,38350:20559,38351:22793,38352:29255,38353:31687,38354:32232,38355:36794,38356:36820,38357:36941,38358:20415,38359:21193,38360:23081,38361:24321,38362:38829,38363:20445,38364:33303,38365:37610,38366:22275,38367:25429,38368:27497,38369:29995,38370:35036,38371:36628,38372:31298,38373:21215,38374:22675,38375:24917,38376:25098,38377:26286,38378:27597,38379:31807,38380:33769,38381:20515,38382:20472,38383:21253,38384:21574,38385:22577,38386:22857,38387:23453,38388:23792,38389:23791,38390:23849,38391:24214,38392:25265,38393:25447,38394:25918,38395:26041,38396:26379,38464:27861,38465:27873,38466:28921,38467:30770,38468:32299,38469:32990,38470:33459,38471:33804,38472:34028,38473:34562,38474:35090,38475:35370,38476:35914,38477:37030,38478:37586,38479:39165,38480:40179,38481:40300,38482:20047,38483:20129,38484:20621,38485:21078,38486:22346,38487:22952,38488:24125,38489:24536,38490:24537,38491:25151,38492:26292,38493:26395,38494:26576,38495:26834,38496:20882,38497:32033,38498:32938,38499:33192,38500:35584,38501:35980,38502:36031,38503:37502,38504:38450,38505:21536,38506:38956,38507:21271,38508:20693,38509:21340,38510:22696,38511:25778,38512:26420,38513:29287,38514:30566,38515:31302,38516:37350,38517:21187,38518:27809,38519:27526,38520:22528,38521:24140,38522:22868,38523:26412,38524:32763,38525:20961,38526:30406,38528:25705,38529:30952,38530:39764,38531:40635,38532:22475,38533:22969,38534:26151,38535:26522,38536:27598,38537:21737,38538:27097,38539:24149,38540:33180,38541:26517,38542:39850,38543:26622,38544:40018,38545:26717,38546:20134,38547:20451,38548:21448,38549:25273,38550:26411,38551:27819,38552:36804,38553:20397,38554:32365,38555:40639,38556:19975,38557:24930,38558:28288,38559:28459,38560:34067,38561:21619,38562:26410,38563:39749,38564:24051,38565:31637,38566:23724,38567:23494,38568:34588,38569:28234,38570:34001,38571:31252,38572:33032,38573:22937,38574:31885,38575:27665,38576:30496,38577:21209,38578:22818,38579:28961,38580:29279,38581:30683,38582:38695,38583:40289,38584:26891,38585:23167,38586:23064,38587:20901,38588:21517,38589:21629,38590:26126,38591:30431,38592:36855,38593:37528,38594:40180,38595:23018,38596:29277,38597:28357,38598:20813,38599:26825,38600:32191,38601:32236,38602:38754,38603:40634,38604:25720,38605:27169,38606:33538,38607:22916,38608:23391,38609:27611,38610:29467,38611:30450,38612:32178,38613:32791,38614:33945,38615:20786,38616:26408,38617:40665,38618:30446,38619:26466,38620:21247,38621:39173,38622:23588,38623:25147,38624:31870,38625:36016,38626:21839,38627:24758,38628:32011,38629:38272,38630:21249,38631:20063,38632:20918,38633:22812,38634:29242,38635:32822,38636:37326,38637:24357,38638:30690,38639:21380,38640:24441,38641:32004,38642:34220,38643:35379,38644:36493,38645:38742,38646:26611,38647:34222,38648:37971,38649:24841,38650:24840,38651:27833,38652:30290,38720:35565,38721:36664,38722:21807,38723:20305,38724:20778,38725:21191,38726:21451,38727:23461,38728:24189,38729:24736,38730:24962,38731:25558,38732:26377,38733:26586,38734:28263,38735:28044,38736:29494,38737:29495,38738:30001,38739:31056,38740:35029,38741:35480,38742:36938,38743:37009,38744:37109,38745:38596,38746:34701,38747:22805,38748:20104,38749:20313,38750:19982,38751:35465,38752:36671,38753:38928,38754:20653,38755:24188,38756:22934,38757:23481,38758:24248,38759:25562,38760:25594,38761:25793,38762:26332,38763:26954,38764:27096,38765:27915,38766:28342,38767:29076,38768:29992,38769:31407,38770:32650,38771:32768,38772:33865,38773:33993,38774:35201,38775:35617,38776:36362,38777:36965,38778:38525,38779:39178,38780:24958,38781:25233,38782:27442,38784:27779,38785:28020,38786:32716,38787:32764,38788:28096,38789:32645,38790:34746,38791:35064,38792:26469,38793:33713,38794:38972,38795:38647,38796:27931,38797:32097,38798:33853,38799:37226,38800:20081,38801:21365,38802:23888,38803:27396,38804:28651,38805:34253,38806:34349,38807:35239,38808:21033,38809:21519,38810:23653,38811:26446,38812:26792,38813:29702,38814:29827,38815:30178,38816:35023,38817:35041,38818:37324,38819:38626,38820:38520,38821:24459,38822:29575,38823:31435,38824:33870,38825:25504,38826:30053,38827:21129,38828:27969,38829:28316,38830:29705,38831:30041,38832:30827,38833:31890,38834:38534,38835:31452,38836:40845,38837:20406,38838:24942,38839:26053,38840:34396,38841:20102,38842:20142,38843:20698,38844:20001,38845:20940,38846:23534,38847:26009,38848:26753,38849:28092,38850:29471,38851:30274,38852:30637,38853:31260,38854:31975,38855:33391,38856:35538,38857:36988,38858:37327,38859:38517,38860:38936,38861:21147,38862:32209,38863:20523,38864:21400,38865:26519,38866:28107,38867:29136,38868:29747,38869:33256,38870:36650,38871:38563,38872:40023,38873:40607,38874:29792,38875:22593,38876:28057,38877:32047,38878:39006,38879:20196,38880:20278,38881:20363,38882:20919,38883:21169,38884:23994,38885:24604,38886:29618,38887:31036,38888:33491,38889:37428,38890:38583,38891:38646,38892:38666,38893:40599,38894:40802,38895:26278,38896:27508,38897:21015,38898:21155,38899:28872,38900:35010,38901:24265,38902:24651,38903:24976,38904:28451,38905:29001,38906:31806,38907:32244,38908:32879,38976:34030,38977:36899,38978:37676,38979:21570,38980:39791,38981:27347,38982:28809,38983:36034,38984:36335,38985:38706,38986:21172,38987:23105,38988:24266,38989:24324,38990:26391,38991:27004,38992:27028,38993:28010,38994:28431,38995:29282,38996:29436,38997:31725,38998:32769,38999:32894,39e3:34635,39001:37070,39002:20845,39003:40595,39004:31108,39005:32907,39006:37682,39007:35542,39008:20525,39009:21644,39010:35441,39011:27498,39012:36036,39013:33031,39014:24785,39015:26528,39016:40434,39017:20121,39018:20120,39019:39952,39020:35435,39021:34241,39022:34152,39023:26880,39024:28286,39025:30871,39026:33109,39071:24332,39072:19984,39073:19989,39074:20010,39075:20017,39076:20022,39077:20028,39078:20031,39079:20034,39080:20054,39081:20056,39082:20098,39083:20101,39084:35947,39085:20106,39086:33298,39087:24333,39088:20110,39089:20126,39090:20127,39091:20128,39092:20130,39093:20144,39094:20147,39095:20150,39096:20174,39097:20173,39098:20164,39099:20166,39100:20162,39101:20183,39102:20190,39103:20205,39104:20191,39105:20215,39106:20233,39107:20314,39108:20272,39109:20315,39110:20317,39111:20311,39112:20295,39113:20342,39114:20360,39115:20367,39116:20376,39117:20347,39118:20329,39119:20336,39120:20369,39121:20335,39122:20358,39123:20374,39124:20760,39125:20436,39126:20447,39127:20430,39128:20440,39129:20443,39130:20433,39131:20442,39132:20432,39133:20452,39134:20453,39135:20506,39136:20520,39137:20500,39138:20522,39139:20517,39140:20485,39141:20252,39142:20470,39143:20513,39144:20521,39145:20524,39146:20478,39147:20463,39148:20497,39149:20486,39150:20547,39151:20551,39152:26371,39153:20565,39154:20560,39155:20552,39156:20570,39157:20566,39158:20588,39159:20600,39160:20608,39161:20634,39162:20613,39163:20660,39164:20658,39232:20681,39233:20682,39234:20659,39235:20674,39236:20694,39237:20702,39238:20709,39239:20717,39240:20707,39241:20718,39242:20729,39243:20725,39244:20745,39245:20737,39246:20738,39247:20758,39248:20757,39249:20756,39250:20762,39251:20769,39252:20794,39253:20791,39254:20796,39255:20795,39256:20799,39257:20800,39258:20818,39259:20812,39260:20820,39261:20834,39262:31480,39263:20841,39264:20842,39265:20846,39266:20864,39267:20866,39268:22232,39269:20876,39270:20873,39271:20879,39272:20881,39273:20883,39274:20885,39275:20886,39276:20900,39277:20902,39278:20898,39279:20905,39280:20906,39281:20907,39282:20915,39283:20913,39284:20914,39285:20912,39286:20917,39287:20925,39288:20933,39289:20937,39290:20955,39291:20960,39292:34389,39293:20969,39294:20973,39296:20976,39297:20981,39298:20990,39299:20996,39300:21003,39301:21012,39302:21006,39303:21031,39304:21034,39305:21038,39306:21043,39307:21049,39308:21071,39309:21060,39310:21067,39311:21068,39312:21086,39313:21076,39314:21098,39315:21108,39316:21097,39317:21107,39318:21119,39319:21117,39320:21133,39321:21140,39322:21138,39323:21105,39324:21128,39325:21137,39326:36776,39327:36775,39328:21164,39329:21165,39330:21180,39331:21173,39332:21185,39333:21197,39334:21207,39335:21214,39336:21219,39337:21222,39338:39149,39339:21216,39340:21235,39341:21237,39342:21240,39343:21241,39344:21254,39345:21256,39346:30008,39347:21261,39348:21264,39349:21263,39350:21269,39351:21274,39352:21283,39353:21295,39354:21297,39355:21299,39356:21304,39357:21312,39358:21318,39359:21317,39360:19991,39361:21321,39362:21325,39363:20950,39364:21342,39365:21353,39366:21358,39367:22808,39368:21371,39369:21367,39370:21378,39371:21398,39372:21408,39373:21414,39374:21413,39375:21422,39376:21424,39377:21430,39378:21443,39379:31762,39380:38617,39381:21471,39382:26364,39383:29166,39384:21486,39385:21480,39386:21485,39387:21498,39388:21505,39389:21565,39390:21568,39391:21548,39392:21549,39393:21564,39394:21550,39395:21558,39396:21545,39397:21533,39398:21582,39399:21647,39400:21621,39401:21646,39402:21599,39403:21617,39404:21623,39405:21616,39406:21650,39407:21627,39408:21632,39409:21622,39410:21636,39411:21648,39412:21638,39413:21703,39414:21666,39415:21688,39416:21669,39417:21676,39418:21700,39419:21704,39420:21672,39488:21675,39489:21698,39490:21668,39491:21694,39492:21692,39493:21720,39494:21733,39495:21734,39496:21775,39497:21780,39498:21757,39499:21742,39500:21741,39501:21754,39502:21730,39503:21817,39504:21824,39505:21859,39506:21836,39507:21806,39508:21852,39509:21829,39510:21846,39511:21847,39512:21816,39513:21811,39514:21853,39515:21913,39516:21888,39517:21679,39518:21898,39519:21919,39520:21883,39521:21886,39522:21912,39523:21918,39524:21934,39525:21884,39526:21891,39527:21929,39528:21895,39529:21928,39530:21978,39531:21957,39532:21983,39533:21956,39534:21980,39535:21988,39536:21972,39537:22036,39538:22007,39539:22038,39540:22014,39541:22013,39542:22043,39543:22009,39544:22094,39545:22096,39546:29151,39547:22068,39548:22070,39549:22066,39550:22072,39552:22123,39553:22116,39554:22063,39555:22124,39556:22122,39557:22150,39558:22144,39559:22154,39560:22176,39561:22164,39562:22159,39563:22181,39564:22190,39565:22198,39566:22196,39567:22210,39568:22204,39569:22209,39570:22211,39571:22208,39572:22216,39573:22222,39574:22225,39575:22227,39576:22231,39577:22254,39578:22265,39579:22272,39580:22271,39581:22276,39582:22281,39583:22280,39584:22283,39585:22285,39586:22291,39587:22296,39588:22294,39589:21959,39590:22300,39591:22310,39592:22327,39593:22328,39594:22350,39595:22331,39596:22336,39597:22351,39598:22377,39599:22464,39600:22408,39601:22369,39602:22399,39603:22409,39604:22419,39605:22432,39606:22451,39607:22436,39608:22442,39609:22448,39610:22467,39611:22470,39612:22484,39613:22482,39614:22483,39615:22538,39616:22486,39617:22499,39618:22539,39619:22553,39620:22557,39621:22642,39622:22561,39623:22626,39624:22603,39625:22640,39626:27584,39627:22610,39628:22589,39629:22649,39630:22661,39631:22713,39632:22687,39633:22699,39634:22714,39635:22750,39636:22715,39637:22712,39638:22702,39639:22725,39640:22739,39641:22737,39642:22743,39643:22745,39644:22744,39645:22757,39646:22748,39647:22756,39648:22751,39649:22767,39650:22778,39651:22777,39652:22779,39653:22780,39654:22781,39655:22786,39656:22794,39657:22800,39658:22811,39659:26790,39660:22821,39661:22828,39662:22829,39663:22834,39664:22840,39665:22846,39666:31442,39667:22869,39668:22864,39669:22862,39670:22874,39671:22872,39672:22882,39673:22880,39674:22887,39675:22892,39676:22889,39744:22904,39745:22913,39746:22941,39747:20318,39748:20395,39749:22947,39750:22962,39751:22982,39752:23016,39753:23004,39754:22925,39755:23001,39756:23002,39757:23077,39758:23071,39759:23057,39760:23068,39761:23049,39762:23066,39763:23104,39764:23148,39765:23113,39766:23093,39767:23094,39768:23138,39769:23146,39770:23194,39771:23228,39772:23230,39773:23243,39774:23234,39775:23229,39776:23267,39777:23255,39778:23270,39779:23273,39780:23254,39781:23290,39782:23291,39783:23308,39784:23307,39785:23318,39786:23346,39787:23248,39788:23338,39789:23350,39790:23358,39791:23363,39792:23365,39793:23360,39794:23377,39795:23381,39796:23386,39797:23387,39798:23397,39799:23401,39800:23408,39801:23411,39802:23413,39803:23416,39804:25992,39805:23418,39806:23424,39808:23427,39809:23462,39810:23480,39811:23491,39812:23495,39813:23497,39814:23508,39815:23504,39816:23524,39817:23526,39818:23522,39819:23518,39820:23525,39821:23531,39822:23536,39823:23542,39824:23539,39825:23557,39826:23559,39827:23560,39828:23565,39829:23571,39830:23584,39831:23586,39832:23592,39833:23608,39834:23609,39835:23617,39836:23622,39837:23630,39838:23635,39839:23632,39840:23631,39841:23409,39842:23660,39843:23662,39844:20066,39845:23670,39846:23673,39847:23692,39848:23697,39849:23700,39850:22939,39851:23723,39852:23739,39853:23734,39854:23740,39855:23735,39856:23749,39857:23742,39858:23751,39859:23769,39860:23785,39861:23805,39862:23802,39863:23789,39864:23948,39865:23786,39866:23819,39867:23829,39868:23831,39869:23900,39870:23839,39871:23835,39872:23825,39873:23828,39874:23842,39875:23834,39876:23833,39877:23832,39878:23884,39879:23890,39880:23886,39881:23883,39882:23916,39883:23923,39884:23926,39885:23943,39886:23940,39887:23938,39888:23970,39889:23965,39890:23980,39891:23982,39892:23997,39893:23952,39894:23991,39895:23996,39896:24009,39897:24013,39898:24019,39899:24018,39900:24022,39901:24027,39902:24043,39903:24050,39904:24053,39905:24075,39906:24090,39907:24089,39908:24081,39909:24091,39910:24118,39911:24119,39912:24132,39913:24131,39914:24128,39915:24142,39916:24151,39917:24148,39918:24159,39919:24162,39920:24164,39921:24135,39922:24181,39923:24182,39924:24186,39925:40636,39926:24191,39927:24224,39928:24257,39929:24258,39930:24264,39931:24272,39932:24271,4e4:24278,40001:24291,40002:24285,40003:24282,40004:24283,40005:24290,40006:24289,40007:24296,40008:24297,40009:24300,40010:24305,40011:24307,40012:24304,40013:24308,40014:24312,40015:24318,40016:24323,40017:24329,40018:24413,40019:24412,40020:24331,40021:24337,40022:24342,40023:24361,40024:24365,40025:24376,40026:24385,40027:24392,40028:24396,40029:24398,40030:24367,40031:24401,40032:24406,40033:24407,40034:24409,40035:24417,40036:24429,40037:24435,40038:24439,40039:24451,40040:24450,40041:24447,40042:24458,40043:24456,40044:24465,40045:24455,40046:24478,40047:24473,40048:24472,40049:24480,40050:24488,40051:24493,40052:24508,40053:24534,40054:24571,40055:24548,40056:24568,40057:24561,40058:24541,40059:24755,40060:24575,40061:24609,40062:24672,40064:24601,40065:24592,40066:24617,40067:24590,40068:24625,40069:24603,40070:24597,40071:24619,40072:24614,40073:24591,40074:24634,40075:24666,40076:24641,40077:24682,40078:24695,40079:24671,40080:24650,40081:24646,40082:24653,40083:24675,40084:24643,40085:24676,40086:24642,40087:24684,40088:24683,40089:24665,40090:24705,40091:24717,40092:24807,40093:24707,40094:24730,40095:24708,40096:24731,40097:24726,40098:24727,40099:24722,40100:24743,40101:24715,40102:24801,40103:24760,40104:24800,40105:24787,40106:24756,40107:24560,40108:24765,40109:24774,40110:24757,40111:24792,40112:24909,40113:24853,40114:24838,40115:24822,40116:24823,40117:24832,40118:24820,40119:24826,40120:24835,40121:24865,40122:24827,40123:24817,40124:24845,40125:24846,40126:24903,40127:24894,40128:24872,40129:24871,40130:24906,40131:24895,40132:24892,40133:24876,40134:24884,40135:24893,40136:24898,40137:24900,40138:24947,40139:24951,40140:24920,40141:24921,40142:24922,40143:24939,40144:24948,40145:24943,40146:24933,40147:24945,40148:24927,40149:24925,40150:24915,40151:24949,40152:24985,40153:24982,40154:24967,40155:25004,40156:24980,40157:24986,40158:24970,40159:24977,40160:25003,40161:25006,40162:25036,40163:25034,40164:25033,40165:25079,40166:25032,40167:25027,40168:25030,40169:25018,40170:25035,40171:32633,40172:25037,40173:25062,40174:25059,40175:25078,40176:25082,40177:25076,40178:25087,40179:25085,40180:25084,40181:25086,40182:25088,40183:25096,40184:25097,40185:25101,40186:25100,40187:25108,40188:25115,40256:25118,40257:25121,40258:25130,40259:25134,40260:25136,40261:25138,40262:25139,40263:25153,40264:25166,40265:25182,40266:25187,40267:25179,40268:25184,40269:25192,40270:25212,40271:25218,40272:25225,40273:25214,40274:25234,40275:25235,40276:25238,40277:25300,40278:25219,40279:25236,40280:25303,40281:25297,40282:25275,40283:25295,40284:25343,40285:25286,40286:25812,40287:25288,40288:25308,40289:25292,40290:25290,40291:25282,40292:25287,40293:25243,40294:25289,40295:25356,40296:25326,40297:25329,40298:25383,40299:25346,40300:25352,40301:25327,40302:25333,40303:25424,40304:25406,40305:25421,40306:25628,40307:25423,40308:25494,40309:25486,40310:25472,40311:25515,40312:25462,40313:25507,40314:25487,40315:25481,40316:25503,40317:25525,40318:25451,40320:25449,40321:25534,40322:25577,40323:25536,40324:25542,40325:25571,40326:25545,40327:25554,40328:25590,40329:25540,40330:25622,40331:25652,40332:25606,40333:25619,40334:25638,40335:25654,40336:25885,40337:25623,40338:25640,40339:25615,40340:25703,40341:25711,40342:25718,40343:25678,40344:25898,40345:25749,40346:25747,40347:25765,40348:25769,40349:25736,40350:25788,40351:25818,40352:25810,40353:25797,40354:25799,40355:25787,40356:25816,40357:25794,40358:25841,40359:25831,40360:33289,40361:25824,40362:25825,40363:25260,40364:25827,40365:25839,40366:25900,40367:25846,40368:25844,40369:25842,40370:25850,40371:25856,40372:25853,40373:25880,40374:25884,40375:25861,40376:25892,40377:25891,40378:25899,40379:25908,40380:25909,40381:25911,40382:25910,40383:25912,40384:30027,40385:25928,40386:25942,40387:25941,40388:25933,40389:25944,40390:25950,40391:25949,40392:25970,40393:25976,40394:25986,40395:25987,40396:35722,40397:26011,40398:26015,40399:26027,40400:26039,40401:26051,40402:26054,40403:26049,40404:26052,40405:26060,40406:26066,40407:26075,40408:26073,40409:26080,40410:26081,40411:26097,40412:26482,40413:26122,40414:26115,40415:26107,40416:26483,40417:26165,40418:26166,40419:26164,40420:26140,40421:26191,40422:26180,40423:26185,40424:26177,40425:26206,40426:26205,40427:26212,40428:26215,40429:26216,40430:26207,40431:26210,40432:26224,40433:26243,40434:26248,40435:26254,40436:26249,40437:26244,40438:26264,40439:26269,40440:26305,40441:26297,40442:26313,40443:26302,40444:26300,40512:26308,40513:26296,40514:26326,40515:26330,40516:26336,40517:26175,40518:26342,40519:26345,40520:26352,40521:26357,40522:26359,40523:26383,40524:26390,40525:26398,40526:26406,40527:26407,40528:38712,40529:26414,40530:26431,40531:26422,40532:26433,40533:26424,40534:26423,40535:26438,40536:26462,40537:26464,40538:26457,40539:26467,40540:26468,40541:26505,40542:26480,40543:26537,40544:26492,40545:26474,40546:26508,40547:26507,40548:26534,40549:26529,40550:26501,40551:26551,40552:26607,40553:26548,40554:26604,40555:26547,40556:26601,40557:26552,40558:26596,40559:26590,40560:26589,40561:26594,40562:26606,40563:26553,40564:26574,40565:26566,40566:26599,40567:27292,40568:26654,40569:26694,40570:26665,40571:26688,40572:26701,40573:26674,40574:26702,40576:26803,40577:26667,40578:26713,40579:26723,40580:26743,40581:26751,40582:26783,40583:26767,40584:26797,40585:26772,40586:26781,40587:26779,40588:26755,40589:27310,40590:26809,40591:26740,40592:26805,40593:26784,40594:26810,40595:26895,40596:26765,40597:26750,40598:26881,40599:26826,40600:26888,40601:26840,40602:26914,40603:26918,40604:26849,40605:26892,40606:26829,40607:26836,40608:26855,40609:26837,40610:26934,40611:26898,40612:26884,40613:26839,40614:26851,40615:26917,40616:26873,40617:26848,40618:26863,40619:26920,40620:26922,40621:26906,40622:26915,40623:26913,40624:26822,40625:27001,40626:26999,40627:26972,40628:27e3,40629:26987,40630:26964,40631:27006,40632:26990,40633:26937,40634:26996,40635:26941,40636:26969,40637:26928,40638:26977,40639:26974,40640:26973,40641:27009,40642:26986,40643:27058,40644:27054,40645:27088,40646:27071,40647:27073,40648:27091,40649:27070,40650:27086,40651:23528,40652:27082,40653:27101,40654:27067,40655:27075,40656:27047,40657:27182,40658:27025,40659:27040,40660:27036,40661:27029,40662:27060,40663:27102,40664:27112,40665:27138,40666:27163,40667:27135,40668:27402,40669:27129,40670:27122,40671:27111,40672:27141,40673:27057,40674:27166,40675:27117,40676:27156,40677:27115,40678:27146,40679:27154,40680:27329,40681:27171,40682:27155,40683:27204,40684:27148,40685:27250,40686:27190,40687:27256,40688:27207,40689:27234,40690:27225,40691:27238,40692:27208,40693:27192,40694:27170,40695:27280,40696:27277,40697:27296,40698:27268,40699:27298,40700:27299,40768:27287,40769:34327,40770:27323,40771:27331,40772:27330,40773:27320,40774:27315,40775:27308,40776:27358,40777:27345,40778:27359,40779:27306,40780:27354,40781:27370,40782:27387,40783:27397,40784:34326,40785:27386,40786:27410,40787:27414,40788:39729,40789:27423,40790:27448,40791:27447,40792:30428,40793:27449,40794:39150,40795:27463,40796:27459,40797:27465,40798:27472,40799:27481,40800:27476,40801:27483,40802:27487,40803:27489,40804:27512,40805:27513,40806:27519,40807:27520,40808:27524,40809:27523,40810:27533,40811:27544,40812:27541,40813:27550,40814:27556,40815:27562,40816:27563,40817:27567,40818:27570,40819:27569,40820:27571,40821:27575,40822:27580,40823:27590,40824:27595,40825:27603,40826:27615,40827:27628,40828:27627,40829:27635,40830:27631,40832:40638,40833:27656,40834:27667,40835:27668,40836:27675,40837:27684,40838:27683,40839:27742,40840:27733,40841:27746,40842:27754,40843:27778,40844:27789,40845:27802,40846:27777,40847:27803,40848:27774,40849:27752,40850:27763,40851:27794,40852:27792,40853:27844,40854:27889,40855:27859,40856:27837,40857:27863,40858:27845,40859:27869,40860:27822,40861:27825,40862:27838,40863:27834,40864:27867,40865:27887,40866:27865,40867:27882,40868:27935,40869:34893,40870:27958,40871:27947,40872:27965,40873:27960,40874:27929,40875:27957,40876:27955,40877:27922,40878:27916,40879:28003,40880:28051,40881:28004,40882:27994,40883:28025,40884:27993,40885:28046,40886:28053,40887:28644,40888:28037,40889:28153,40890:28181,40891:28170,40892:28085,40893:28103,40894:28134,40895:28088,40896:28102,40897:28140,40898:28126,40899:28108,40900:28136,40901:28114,40902:28101,40903:28154,40904:28121,40905:28132,40906:28117,40907:28138,40908:28142,40909:28205,40910:28270,40911:28206,40912:28185,40913:28274,40914:28255,40915:28222,40916:28195,40917:28267,40918:28203,40919:28278,40920:28237,40921:28191,40922:28227,40923:28218,40924:28238,40925:28196,40926:28415,40927:28189,40928:28216,40929:28290,40930:28330,40931:28312,40932:28361,40933:28343,40934:28371,40935:28349,40936:28335,40937:28356,40938:28338,40939:28372,40940:28373,40941:28303,40942:28325,40943:28354,40944:28319,40945:28481,40946:28433,40947:28748,40948:28396,40949:28408,40950:28414,40951:28479,40952:28402,40953:28465,40954:28399,40955:28466,40956:28364,57408:28478,57409:28435,57410:28407,57411:28550,57412:28538,57413:28536,57414:28545,57415:28544,57416:28527,57417:28507,57418:28659,57419:28525,57420:28546,57421:28540,57422:28504,57423:28558,57424:28561,57425:28610,57426:28518,57427:28595,57428:28579,57429:28577,57430:28580,57431:28601,57432:28614,57433:28586,57434:28639,57435:28629,57436:28652,57437:28628,57438:28632,57439:28657,57440:28654,57441:28635,57442:28681,57443:28683,57444:28666,57445:28689,57446:28673,57447:28687,57448:28670,57449:28699,57450:28698,57451:28532,57452:28701,57453:28696,57454:28703,57455:28720,57456:28734,57457:28722,57458:28753,57459:28771,57460:28825,57461:28818,57462:28847,57463:28913,57464:28844,57465:28856,57466:28851,57467:28846,57468:28895,57469:28875,57470:28893,57472:28889,57473:28937,57474:28925,57475:28956,57476:28953,57477:29029,57478:29013,57479:29064,57480:29030,57481:29026,57482:29004,57483:29014,57484:29036,57485:29071,57486:29179,57487:29060,57488:29077,57489:29096,57490:29100,57491:29143,57492:29113,57493:29118,57494:29138,57495:29129,57496:29140,57497:29134,57498:29152,57499:29164,57500:29159,57501:29173,57502:29180,57503:29177,57504:29183,57505:29197,57506:29200,57507:29211,57508:29224,57509:29229,57510:29228,57511:29232,57512:29234,57513:29243,57514:29244,57515:29247,57516:29248,57517:29254,57518:29259,57519:29272,57520:29300,57521:29310,57522:29314,57523:29313,57524:29319,57525:29330,57526:29334,57527:29346,57528:29351,57529:29369,57530:29362,57531:29379,57532:29382,57533:29380,57534:29390,57535:29394,57536:29410,57537:29408,57538:29409,57539:29433,57540:29431,57541:20495,57542:29463,57543:29450,57544:29468,57545:29462,57546:29469,57547:29492,57548:29487,57549:29481,57550:29477,57551:29502,57552:29518,57553:29519,57554:40664,57555:29527,57556:29546,57557:29544,57558:29552,57559:29560,57560:29557,57561:29563,57562:29562,57563:29640,57564:29619,57565:29646,57566:29627,57567:29632,57568:29669,57569:29678,57570:29662,57571:29858,57572:29701,57573:29807,57574:29733,57575:29688,57576:29746,57577:29754,57578:29781,57579:29759,57580:29791,57581:29785,57582:29761,57583:29788,57584:29801,57585:29808,57586:29795,57587:29802,57588:29814,57589:29822,57590:29835,57591:29854,57592:29863,57593:29898,57594:29903,57595:29908,57596:29681,57664:29920,57665:29923,57666:29927,57667:29929,57668:29934,57669:29938,57670:29936,57671:29937,57672:29944,57673:29943,57674:29956,57675:29955,57676:29957,57677:29964,57678:29966,57679:29965,57680:29973,57681:29971,57682:29982,57683:29990,57684:29996,57685:30012,57686:30020,57687:30029,57688:30026,57689:30025,57690:30043,57691:30022,57692:30042,57693:30057,57694:30052,57695:30055,57696:30059,57697:30061,57698:30072,57699:30070,57700:30086,57701:30087,57702:30068,57703:30090,57704:30089,57705:30082,57706:30100,57707:30106,57708:30109,57709:30117,57710:30115,57711:30146,57712:30131,57713:30147,57714:30133,57715:30141,57716:30136,57717:30140,57718:30129,57719:30157,57720:30154,57721:30162,57722:30169,57723:30179,57724:30174,57725:30206,57726:30207,57728:30204,57729:30209,57730:30192,57731:30202,57732:30194,57733:30195,57734:30219,57735:30221,57736:30217,57737:30239,57738:30247,57739:30240,57740:30241,57741:30242,57742:30244,57743:30260,57744:30256,57745:30267,57746:30279,57747:30280,57748:30278,57749:30300,57750:30296,57751:30305,57752:30306,57753:30312,57754:30313,57755:30314,57756:30311,57757:30316,57758:30320,57759:30322,57760:30326,57761:30328,57762:30332,57763:30336,57764:30339,57765:30344,57766:30347,57767:30350,57768:30358,57769:30355,57770:30361,57771:30362,57772:30384,57773:30388,57774:30392,57775:30393,57776:30394,57777:30402,57778:30413,57779:30422,57780:30418,57781:30430,57782:30433,57783:30437,57784:30439,57785:30442,57786:34351,57787:30459,57788:30472,57789:30471,57790:30468,57791:30505,57792:30500,57793:30494,57794:30501,57795:30502,57796:30491,57797:30519,57798:30520,57799:30535,57800:30554,57801:30568,57802:30571,57803:30555,57804:30565,57805:30591,57806:30590,57807:30585,57808:30606,57809:30603,57810:30609,57811:30624,57812:30622,57813:30640,57814:30646,57815:30649,57816:30655,57817:30652,57818:30653,57819:30651,57820:30663,57821:30669,57822:30679,57823:30682,57824:30684,57825:30691,57826:30702,57827:30716,57828:30732,57829:30738,57830:31014,57831:30752,57832:31018,57833:30789,57834:30862,57835:30836,57836:30854,57837:30844,57838:30874,57839:30860,57840:30883,57841:30901,57842:30890,57843:30895,57844:30929,57845:30918,57846:30923,57847:30932,57848:30910,57849:30908,57850:30917,57851:30922,57852:30956,57920:30951,57921:30938,57922:30973,57923:30964,57924:30983,57925:30994,57926:30993,57927:31001,57928:31020,57929:31019,57930:31040,57931:31072,57932:31063,57933:31071,57934:31066,57935:31061,57936:31059,57937:31098,57938:31103,57939:31114,57940:31133,57941:31143,57942:40779,57943:31146,57944:31150,57945:31155,57946:31161,57947:31162,57948:31177,57949:31189,57950:31207,57951:31212,57952:31201,57953:31203,57954:31240,57955:31245,57956:31256,57957:31257,57958:31264,57959:31263,57960:31104,57961:31281,57962:31291,57963:31294,57964:31287,57965:31299,57966:31319,57967:31305,57968:31329,57969:31330,57970:31337,57971:40861,57972:31344,57973:31353,57974:31357,57975:31368,57976:31383,57977:31381,57978:31384,57979:31382,57980:31401,57981:31432,57982:31408,57984:31414,57985:31429,57986:31428,57987:31423,57988:36995,57989:31431,57990:31434,57991:31437,57992:31439,57993:31445,57994:31443,57995:31449,57996:31450,57997:31453,57998:31457,57999:31458,58e3:31462,58001:31469,58002:31472,58003:31490,58004:31503,58005:31498,58006:31494,58007:31539,58008:31512,58009:31513,58010:31518,58011:31541,58012:31528,58013:31542,58014:31568,58015:31610,58016:31492,58017:31565,58018:31499,58019:31564,58020:31557,58021:31605,58022:31589,58023:31604,58024:31591,58025:31600,58026:31601,58027:31596,58028:31598,58029:31645,58030:31640,58031:31647,58032:31629,58033:31644,58034:31642,58035:31627,58036:31634,58037:31631,58038:31581,58039:31641,58040:31691,58041:31681,58042:31692,58043:31695,58044:31668,58045:31686,58046:31709,58047:31721,58048:31761,58049:31764,58050:31718,58051:31717,58052:31840,58053:31744,58054:31751,58055:31763,58056:31731,58057:31735,58058:31767,58059:31757,58060:31734,58061:31779,58062:31783,58063:31786,58064:31775,58065:31799,58066:31787,58067:31805,58068:31820,58069:31811,58070:31828,58071:31823,58072:31808,58073:31824,58074:31832,58075:31839,58076:31844,58077:31830,58078:31845,58079:31852,58080:31861,58081:31875,58082:31888,58083:31908,58084:31917,58085:31906,58086:31915,58087:31905,58088:31912,58089:31923,58090:31922,58091:31921,58092:31918,58093:31929,58094:31933,58095:31936,58096:31941,58097:31938,58098:31960,58099:31954,58100:31964,58101:31970,58102:39739,58103:31983,58104:31986,58105:31988,58106:31990,58107:31994,58108:32006,58176:32002,58177:32028,58178:32021,58179:32010,58180:32069,58181:32075,58182:32046,58183:32050,58184:32063,58185:32053,58186:32070,58187:32115,58188:32086,58189:32078,58190:32114,58191:32104,58192:32110,58193:32079,58194:32099,58195:32147,58196:32137,58197:32091,58198:32143,58199:32125,58200:32155,58201:32186,58202:32174,58203:32163,58204:32181,58205:32199,58206:32189,58207:32171,58208:32317,58209:32162,58210:32175,58211:32220,58212:32184,58213:32159,58214:32176,58215:32216,58216:32221,58217:32228,58218:32222,58219:32251,58220:32242,58221:32225,58222:32261,58223:32266,58224:32291,58225:32289,58226:32274,58227:32305,58228:32287,58229:32265,58230:32267,58231:32290,58232:32326,58233:32358,58234:32315,58235:32309,58236:32313,58237:32323,58238:32311,58240:32306,58241:32314,58242:32359,58243:32349,58244:32342,58245:32350,58246:32345,58247:32346,58248:32377,58249:32362,58250:32361,58251:32380,58252:32379,58253:32387,58254:32213,58255:32381,58256:36782,58257:32383,58258:32392,58259:32393,58260:32396,58261:32402,58262:32400,58263:32403,58264:32404,58265:32406,58266:32398,58267:32411,58268:32412,58269:32568,58270:32570,58271:32581,58272:32588,58273:32589,58274:32590,58275:32592,58276:32593,58277:32597,58278:32596,58279:32600,58280:32607,58281:32608,58282:32616,58283:32617,58284:32615,58285:32632,58286:32642,58287:32646,58288:32643,58289:32648,58290:32647,58291:32652,58292:32660,58293:32670,58294:32669,58295:32666,58296:32675,58297:32687,58298:32690,58299:32697,58300:32686,58301:32694,58302:32696,58303:35697,58304:32709,58305:32710,58306:32714,58307:32725,58308:32724,58309:32737,58310:32742,58311:32745,58312:32755,58313:32761,58314:39132,58315:32774,58316:32772,58317:32779,58318:32786,58319:32792,58320:32793,58321:32796,58322:32801,58323:32808,58324:32831,58325:32827,58326:32842,58327:32838,58328:32850,58329:32856,58330:32858,58331:32863,58332:32866,58333:32872,58334:32883,58335:32882,58336:32880,58337:32886,58338:32889,58339:32893,58340:32895,58341:32900,58342:32902,58343:32901,58344:32923,58345:32915,58346:32922,58347:32941,58348:20880,58349:32940,58350:32987,58351:32997,58352:32985,58353:32989,58354:32964,58355:32986,58356:32982,58357:33033,58358:33007,58359:33009,58360:33051,58361:33065,58362:33059,58363:33071,58364:33099,58432:38539,58433:33094,58434:33086,58435:33107,58436:33105,58437:33020,58438:33137,58439:33134,58440:33125,58441:33126,58442:33140,58443:33155,58444:33160,58445:33162,58446:33152,58447:33154,58448:33184,58449:33173,58450:33188,58451:33187,58452:33119,58453:33171,58454:33193,58455:33200,58456:33205,58457:33214,58458:33208,58459:33213,58460:33216,58461:33218,58462:33210,58463:33225,58464:33229,58465:33233,58466:33241,58467:33240,58468:33224,58469:33242,58470:33247,58471:33248,58472:33255,58473:33274,58474:33275,58475:33278,58476:33281,58477:33282,58478:33285,58479:33287,58480:33290,58481:33293,58482:33296,58483:33302,58484:33321,58485:33323,58486:33336,58487:33331,58488:33344,58489:33369,58490:33368,58491:33373,58492:33370,58493:33375,58494:33380,58496:33378,58497:33384,58498:33386,58499:33387,58500:33326,58501:33393,58502:33399,58503:33400,58504:33406,58505:33421,58506:33426,58507:33451,58508:33439,58509:33467,58510:33452,58511:33505,58512:33507,58513:33503,58514:33490,58515:33524,58516:33523,58517:33530,58518:33683,58519:33539,58520:33531,58521:33529,58522:33502,58523:33542,58524:33500,58525:33545,58526:33497,58527:33589,58528:33588,58529:33558,58530:33586,58531:33585,58532:33600,58533:33593,58534:33616,58535:33605,58536:33583,58537:33579,58538:33559,58539:33560,58540:33669,58541:33690,58542:33706,58543:33695,58544:33698,58545:33686,58546:33571,58547:33678,58548:33671,58549:33674,58550:33660,58551:33717,58552:33651,58553:33653,58554:33696,58555:33673,58556:33704,58557:33780,58558:33811,58559:33771,58560:33742,58561:33789,58562:33795,58563:33752,58564:33803,58565:33729,58566:33783,58567:33799,58568:33760,58569:33778,58570:33805,58571:33826,58572:33824,58573:33725,58574:33848,58575:34054,58576:33787,58577:33901,58578:33834,58579:33852,58580:34138,58581:33924,58582:33911,58583:33899,58584:33965,58585:33902,58586:33922,58587:33897,58588:33862,58589:33836,58590:33903,58591:33913,58592:33845,58593:33994,58594:33890,58595:33977,58596:33983,58597:33951,58598:34009,58599:33997,58600:33979,58601:34010,58602:34e3,58603:33985,58604:33990,58605:34006,58606:33953,58607:34081,58608:34047,58609:34036,58610:34071,58611:34072,58612:34092,58613:34079,58614:34069,58615:34068,58616:34044,58617:34112,58618:34147,58619:34136,58620:34120,58688:34113,58689:34306,58690:34123,58691:34133,58692:34176,58693:34212,58694:34184,58695:34193,58696:34186,58697:34216,58698:34157,58699:34196,58700:34203,58701:34282,58702:34183,58703:34204,58704:34167,58705:34174,58706:34192,58707:34249,58708:34234,58709:34255,58710:34233,58711:34256,58712:34261,58713:34269,58714:34277,58715:34268,58716:34297,58717:34314,58718:34323,58719:34315,58720:34302,58721:34298,58722:34310,58723:34338,58724:34330,58725:34352,58726:34367,58727:34381,58728:20053,58729:34388,58730:34399,58731:34407,58732:34417,58733:34451,58734:34467,58735:34473,58736:34474,58737:34443,58738:34444,58739:34486,58740:34479,58741:34500,58742:34502,58743:34480,58744:34505,58745:34851,58746:34475,58747:34516,58748:34526,58749:34537,58750:34540,58752:34527,58753:34523,58754:34543,58755:34578,58756:34566,58757:34568,58758:34560,58759:34563,58760:34555,58761:34577,58762:34569,58763:34573,58764:34553,58765:34570,58766:34612,58767:34623,58768:34615,58769:34619,58770:34597,58771:34601,58772:34586,58773:34656,58774:34655,58775:34680,58776:34636,58777:34638,58778:34676,58779:34647,58780:34664,58781:34670,58782:34649,58783:34643,58784:34659,58785:34666,58786:34821,58787:34722,58788:34719,58789:34690,58790:34735,58791:34763,58792:34749,58793:34752,58794:34768,58795:38614,58796:34731,58797:34756,58798:34739,58799:34759,58800:34758,58801:34747,58802:34799,58803:34802,58804:34784,58805:34831,58806:34829,58807:34814,58808:34806,58809:34807,58810:34830,58811:34770,58812:34833,58813:34838,58814:34837,58815:34850,58816:34849,58817:34865,58818:34870,58819:34873,58820:34855,58821:34875,58822:34884,58823:34882,58824:34898,58825:34905,58826:34910,58827:34914,58828:34923,58829:34945,58830:34942,58831:34974,58832:34933,58833:34941,58834:34997,58835:34930,58836:34946,58837:34967,58838:34962,58839:34990,58840:34969,58841:34978,58842:34957,58843:34980,58844:34992,58845:35007,58846:34993,58847:35011,58848:35012,58849:35028,58850:35032,58851:35033,58852:35037,58853:35065,58854:35074,58855:35068,58856:35060,58857:35048,58858:35058,58859:35076,58860:35084,58861:35082,58862:35091,58863:35139,58864:35102,58865:35109,58866:35114,58867:35115,58868:35137,58869:35140,58870:35131,58871:35126,58872:35128,58873:35148,58874:35101,58875:35168,58876:35166,58944:35174,58945:35172,58946:35181,58947:35178,58948:35183,58949:35188,58950:35191,58951:35198,58952:35203,58953:35208,58954:35210,58955:35219,58956:35224,58957:35233,58958:35241,58959:35238,58960:35244,58961:35247,58962:35250,58963:35258,58964:35261,58965:35263,58966:35264,58967:35290,58968:35292,58969:35293,58970:35303,58971:35316,58972:35320,58973:35331,58974:35350,58975:35344,58976:35340,58977:35355,58978:35357,58979:35365,58980:35382,58981:35393,58982:35419,58983:35410,58984:35398,58985:35400,58986:35452,58987:35437,58988:35436,58989:35426,58990:35461,58991:35458,58992:35460,58993:35496,58994:35489,58995:35473,58996:35493,58997:35494,58998:35482,58999:35491,59e3:35524,59001:35533,59002:35522,59003:35546,59004:35563,59005:35571,59006:35559,59008:35556,59009:35569,59010:35604,59011:35552,59012:35554,59013:35575,59014:35550,59015:35547,59016:35596,59017:35591,59018:35610,59019:35553,59020:35606,59021:35600,59022:35607,59023:35616,59024:35635,59025:38827,59026:35622,59027:35627,59028:35646,59029:35624,59030:35649,59031:35660,59032:35663,59033:35662,59034:35657,59035:35670,59036:35675,59037:35674,59038:35691,59039:35679,59040:35692,59041:35695,59042:35700,59043:35709,59044:35712,59045:35724,59046:35726,59047:35730,59048:35731,59049:35734,59050:35737,59051:35738,59052:35898,59053:35905,59054:35903,59055:35912,59056:35916,59057:35918,59058:35920,59059:35925,59060:35938,59061:35948,59062:35960,59063:35962,59064:35970,59065:35977,59066:35973,59067:35978,59068:35981,59069:35982,59070:35988,59071:35964,59072:35992,59073:25117,59074:36013,59075:36010,59076:36029,59077:36018,59078:36019,59079:36014,59080:36022,59081:36040,59082:36033,59083:36068,59084:36067,59085:36058,59086:36093,59087:36090,59088:36091,59089:36100,59090:36101,59091:36106,59092:36103,59093:36111,59094:36109,59095:36112,59096:40782,59097:36115,59098:36045,59099:36116,59100:36118,59101:36199,59102:36205,59103:36209,59104:36211,59105:36225,59106:36249,59107:36290,59108:36286,59109:36282,59110:36303,59111:36314,59112:36310,59113:36300,59114:36315,59115:36299,59116:36330,59117:36331,59118:36319,59119:36323,59120:36348,59121:36360,59122:36361,59123:36351,59124:36381,59125:36382,59126:36368,59127:36383,59128:36418,59129:36405,59130:36400,59131:36404,59132:36426,59200:36423,59201:36425,59202:36428,59203:36432,59204:36424,59205:36441,59206:36452,59207:36448,59208:36394,59209:36451,59210:36437,59211:36470,59212:36466,59213:36476,59214:36481,59215:36487,59216:36485,59217:36484,59218:36491,59219:36490,59220:36499,59221:36497,59222:36500,59223:36505,59224:36522,59225:36513,59226:36524,59227:36528,59228:36550,59229:36529,59230:36542,59231:36549,59232:36552,59233:36555,59234:36571,59235:36579,59236:36604,59237:36603,59238:36587,59239:36606,59240:36618,59241:36613,59242:36629,59243:36626,59244:36633,59245:36627,59246:36636,59247:36639,59248:36635,59249:36620,59250:36646,59251:36659,59252:36667,59253:36665,59254:36677,59255:36674,59256:36670,59257:36684,59258:36681,59259:36678,59260:36686,59261:36695,59262:36700,59264:36706,59265:36707,59266:36708,59267:36764,59268:36767,59269:36771,59270:36781,59271:36783,59272:36791,59273:36826,59274:36837,59275:36834,59276:36842,59277:36847,59278:36999,59279:36852,59280:36869,59281:36857,59282:36858,59283:36881,59284:36885,59285:36897,59286:36877,59287:36894,59288:36886,59289:36875,59290:36903,59291:36918,59292:36917,59293:36921,59294:36856,59295:36943,59296:36944,59297:36945,59298:36946,59299:36878,59300:36937,59301:36926,59302:36950,59303:36952,59304:36958,59305:36968,59306:36975,59307:36982,59308:38568,59309:36978,59310:36994,59311:36989,59312:36993,59313:36992,59314:37002,59315:37001,59316:37007,59317:37032,59318:37039,59319:37041,59320:37045,59321:37090,59322:37092,59323:25160,59324:37083,59325:37122,59326:37138,59327:37145,59328:37170,59329:37168,59330:37194,59331:37206,59332:37208,59333:37219,59334:37221,59335:37225,59336:37235,59337:37234,59338:37259,59339:37257,59340:37250,59341:37282,59342:37291,59343:37295,59344:37290,59345:37301,59346:37300,59347:37306,59348:37312,59349:37313,59350:37321,59351:37323,59352:37328,59353:37334,59354:37343,59355:37345,59356:37339,59357:37372,59358:37365,59359:37366,59360:37406,59361:37375,59362:37396,59363:37420,59364:37397,59365:37393,59366:37470,59367:37463,59368:37445,59369:37449,59370:37476,59371:37448,59372:37525,59373:37439,59374:37451,59375:37456,59376:37532,59377:37526,59378:37523,59379:37531,59380:37466,59381:37583,59382:37561,59383:37559,59384:37609,59385:37647,59386:37626,59387:37700,59388:37678,59456:37657,59457:37666,59458:37658,59459:37667,59460:37690,59461:37685,59462:37691,59463:37724,59464:37728,59465:37756,59466:37742,59467:37718,59468:37808,59469:37804,59470:37805,59471:37780,59472:37817,59473:37846,59474:37847,59475:37864,59476:37861,59477:37848,59478:37827,59479:37853,59480:37840,59481:37832,59482:37860,59483:37914,59484:37908,59485:37907,59486:37891,59487:37895,59488:37904,59489:37942,59490:37931,59491:37941,59492:37921,59493:37946,59494:37953,59495:37970,59496:37956,59497:37979,59498:37984,59499:37986,59500:37982,59501:37994,59502:37417,59503:38e3,59504:38005,59505:38007,59506:38013,59507:37978,59508:38012,59509:38014,59510:38017,59511:38015,59512:38274,59513:38279,59514:38282,59515:38292,59516:38294,59517:38296,59518:38297,59520:38304,59521:38312,59522:38311,59523:38317,59524:38332,59525:38331,59526:38329,59527:38334,59528:38346,59529:28662,59530:38339,59531:38349,59532:38348,59533:38357,59534:38356,59535:38358,59536:38364,59537:38369,59538:38373,59539:38370,59540:38433,59541:38440,59542:38446,59543:38447,59544:38466,59545:38476,59546:38479,59547:38475,59548:38519,59549:38492,59550:38494,59551:38493,59552:38495,59553:38502,59554:38514,59555:38508,59556:38541,59557:38552,59558:38549,59559:38551,59560:38570,59561:38567,59562:38577,59563:38578,59564:38576,59565:38580,59566:38582,59567:38584,59568:38585,59569:38606,59570:38603,59571:38601,59572:38605,59573:35149,59574:38620,59575:38669,59576:38613,59577:38649,59578:38660,59579:38662,59580:38664,59581:38675,59582:38670,59583:38673,59584:38671,59585:38678,59586:38681,59587:38692,59588:38698,59589:38704,59590:38713,59591:38717,59592:38718,59593:38724,59594:38726,59595:38728,59596:38722,59597:38729,59598:38748,59599:38752,59600:38756,59601:38758,59602:38760,59603:21202,59604:38763,59605:38769,59606:38777,59607:38789,59608:38780,59609:38785,59610:38778,59611:38790,59612:38795,59613:38799,59614:38800,59615:38812,59616:38824,59617:38822,59618:38819,59619:38835,59620:38836,59621:38851,59622:38854,59623:38856,59624:38859,59625:38876,59626:38893,59627:40783,59628:38898,59629:31455,59630:38902,59631:38901,59632:38927,59633:38924,59634:38968,59635:38948,59636:38945,59637:38967,59638:38973,59639:38982,59640:38991,59641:38987,59642:39019,59643:39023,59644:39024,59712:39025,59713:39028,59714:39027,59715:39082,59716:39087,59717:39089,59718:39094,59719:39108,59720:39107,59721:39110,59722:39145,59723:39147,59724:39171,59725:39177,59726:39186,59727:39188,59728:39192,59729:39201,59730:39197,59731:39198,59732:39204,59733:39200,59734:39212,59735:39214,59736:39229,59737:39230,59738:39234,59739:39241,59740:39237,59741:39248,59742:39243,59743:39249,59744:39250,59745:39244,59746:39253,59747:39319,59748:39320,59749:39333,59750:39341,59751:39342,59752:39356,59753:39391,59754:39387,59755:39389,59756:39384,59757:39377,59758:39405,59759:39406,59760:39409,59761:39410,59762:39419,59763:39416,59764:39425,59765:39439,59766:39429,59767:39394,59768:39449,59769:39467,59770:39479,59771:39493,59772:39490,59773:39488,59774:39491,59776:39486,59777:39509,59778:39501,59779:39515,59780:39511,59781:39519,59782:39522,59783:39525,59784:39524,59785:39529,59786:39531,59787:39530,59788:39597,59789:39600,59790:39612,59791:39616,59792:39631,59793:39633,59794:39635,59795:39636,59796:39646,59797:39647,59798:39650,59799:39651,59800:39654,59801:39663,59802:39659,59803:39662,59804:39668,59805:39665,59806:39671,59807:39675,59808:39686,59809:39704,59810:39706,59811:39711,59812:39714,59813:39715,59814:39717,59815:39719,59816:39720,59817:39721,59818:39722,59819:39726,59820:39727,59821:39730,59822:39748,59823:39747,59824:39759,59825:39757,59826:39758,59827:39761,59828:39768,59829:39796,59830:39827,59831:39811,59832:39825,59833:39830,59834:39831,59835:39839,59836:39840,59837:39848,59838:39860,59839:39872,59840:39882,59841:39865,59842:39878,59843:39887,59844:39889,59845:39890,59846:39907,59847:39906,59848:39908,59849:39892,59850:39905,59851:39994,59852:39922,59853:39921,59854:39920,59855:39957,59856:39956,59857:39945,59858:39955,59859:39948,59860:39942,59861:39944,59862:39954,59863:39946,59864:39940,59865:39982,59866:39963,59867:39973,59868:39972,59869:39969,59870:39984,59871:40007,59872:39986,59873:40006,59874:39998,59875:40026,59876:40032,59877:40039,59878:40054,59879:40056,59880:40167,59881:40172,59882:40176,59883:40201,59884:40200,59885:40171,59886:40195,59887:40198,59888:40234,59889:40230,59890:40367,59891:40227,59892:40223,59893:40260,59894:40213,59895:40210,59896:40257,59897:40255,59898:40254,59899:40262,59900:40264,59968:40285,59969:40286,59970:40292,59971:40273,59972:40272,59973:40281,59974:40306,59975:40329,59976:40327,59977:40363,59978:40303,59979:40314,59980:40346,59981:40356,59982:40361,59983:40370,59984:40388,59985:40385,59986:40379,59987:40376,59988:40378,59989:40390,59990:40399,59991:40386,59992:40409,59993:40403,59994:40440,59995:40422,59996:40429,59997:40431,59998:40445,59999:40474,6e4:40475,60001:40478,60002:40565,60003:40569,60004:40573,60005:40577,60006:40584,60007:40587,60008:40588,60009:40594,60010:40597,60011:40593,60012:40605,60013:40613,60014:40617,60015:40632,60016:40618,60017:40621,60018:38753,60019:40652,60020:40654,60021:40655,60022:40656,60023:40660,60024:40668,60025:40670,60026:40669,60027:40672,60028:40677,60029:40680,60030:40687,60032:40692,60033:40694,60034:40695,60035:40697,60036:40699,60037:40700,60038:40701,60039:40711,60040:40712,60041:30391,60042:40725,60043:40737,60044:40748,60045:40766,60046:40778,60047:40786,60048:40788,60049:40803,60050:40799,60051:40800,60052:40801,60053:40806,60054:40807,60055:40812,60056:40810,60057:40823,60058:40818,60059:40822,60060:40853,60061:40860,60062:40864,60063:22575,60064:27079,60065:36953,60066:29796,60067:20956,60068:29081,60736:32394,60737:35100,60738:37704,60739:37512,60740:34012,60741:20425,60742:28859,60743:26161,60744:26824,60745:37625,60746:26363,60747:24389,60748:20008,60749:20193,60750:20220,60751:20224,60752:20227,60753:20281,60754:20310,60755:20370,60756:20362,60757:20378,60758:20372,60759:20429,60760:20544,60761:20514,60762:20479,60763:20510,60764:20550,60765:20592,60766:20546,60767:20628,60768:20724,60769:20696,60770:20810,60771:20836,60772:20893,60773:20926,60774:20972,60775:21013,60776:21148,60777:21158,60778:21184,60779:21211,60780:21248,60781:21255,60782:21284,60783:21362,60784:21395,60785:21426,60786:21469,60787:64014,60788:21660,60789:21642,60790:21673,60791:21759,60792:21894,60793:22361,60794:22373,60795:22444,60796:22472,60797:22471,60798:64015,60800:64016,60801:22686,60802:22706,60803:22795,60804:22867,60805:22875,60806:22877,60807:22883,60808:22948,60809:22970,60810:23382,60811:23488,60812:29999,60813:23512,60814:23532,60815:23582,60816:23718,60817:23738,60818:23797,60819:23847,60820:23891,60821:64017,60822:23874,60823:23917,60824:23992,60825:23993,60826:24016,60827:24353,60828:24372,60829:24423,60830:24503,60831:24542,60832:24669,60833:24709,60834:24714,60835:24798,60836:24789,60837:24864,60838:24818,60839:24849,60840:24887,60841:24880,60842:24984,60843:25107,60844:25254,60845:25589,60846:25696,60847:25757,60848:25806,60849:25934,60850:26112,60851:26133,60852:26171,60853:26121,60854:26158,60855:26142,60856:26148,60857:26213,60858:26199,60859:26201,60860:64018,60861:26227,60862:26265,60863:26272,60864:26290,60865:26303,60866:26362,60867:26382,60868:63785,60869:26470,60870:26555,60871:26706,60872:26560,60873:26625,60874:26692,60875:26831,60876:64019,60877:26984,60878:64020,60879:27032,60880:27106,60881:27184,60882:27243,60883:27206,60884:27251,60885:27262,60886:27362,60887:27364,60888:27606,60889:27711,60890:27740,60891:27782,60892:27759,60893:27866,60894:27908,60895:28039,60896:28015,60897:28054,60898:28076,60899:28111,60900:28152,60901:28146,60902:28156,60903:28217,60904:28252,60905:28199,60906:28220,60907:28351,60908:28552,60909:28597,60910:28661,60911:28677,60912:28679,60913:28712,60914:28805,60915:28843,60916:28943,60917:28932,60918:29020,60919:28998,60920:28999,60921:64021,60922:29121,60923:29182,60924:29361,60992:29374,60993:29476,60994:64022,60995:29559,60996:29629,60997:29641,60998:29654,60999:29667,61e3:29650,61001:29703,61002:29685,61003:29734,61004:29738,61005:29737,61006:29742,61007:29794,61008:29833,61009:29855,61010:29953,61011:30063,61012:30338,61013:30364,61014:30366,61015:30363,61016:30374,61017:64023,61018:30534,61019:21167,61020:30753,61021:30798,61022:30820,61023:30842,61024:31024,61025:64024,61026:64025,61027:64026,61028:31124,61029:64027,61030:31131,61031:31441,61032:31463,61033:64028,61034:31467,61035:31646,61036:64029,61037:32072,61038:32092,61039:32183,61040:32160,61041:32214,61042:32338,61043:32583,61044:32673,61045:64030,61046:33537,61047:33634,61048:33663,61049:33735,61050:33782,61051:33864,61052:33972,61053:34131,61054:34137,61056:34155,61057:64031,61058:34224,61059:64032,61060:64033,61061:34823,61062:35061,61063:35346,61064:35383,61065:35449,61066:35495,61067:35518,61068:35551,61069:64034,61070:35574,61071:35667,61072:35711,61073:36080,61074:36084,61075:36114,61076:36214,61077:64035,61078:36559,61079:64036,61080:64037,61081:36967,61082:37086,61083:64038,61084:37141,61085:37159,61086:37338,61087:37335,61088:37342,61089:37357,61090:37358,61091:37348,61092:37349,61093:37382,61094:37392,61095:37386,61096:37434,61097:37440,61098:37436,61099:37454,61100:37465,61101:37457,61102:37433,61103:37479,61104:37543,61105:37495,61106:37496,61107:37607,61108:37591,61109:37593,61110:37584,61111:64039,61112:37589,61113:37600,61114:37587,61115:37669,61116:37665,61117:37627,61118:64040,61119:37662,61120:37631,61121:37661,61122:37634,61123:37744,61124:37719,61125:37796,61126:37830,61127:37854,61128:37880,61129:37937,61130:37957,61131:37960,61132:38290,61133:63964,61134:64041,61135:38557,61136:38575,61137:38707,61138:38715,61139:38723,61140:38733,61141:38735,61142:38737,61143:38741,61144:38999,61145:39013,61146:64042,61147:64043,61148:39207,61149:64044,61150:39326,61151:39502,61152:39641,61153:39644,61154:39797,61155:39794,61156:39823,61157:39857,61158:39867,61159:39936,61160:40304,61161:40299,61162:64045,61163:40473,61164:40657,61167:8560,61168:8561,61169:8562,61170:8563,61171:8564,61172:8565,61173:8566,61174:8567,61175:8568,61176:8569,61177:65506,61178:65508,61179:65287,61180:65282,61504:57344,61505:57345,61506:57346,61507:57347,61508:57348,61509:57349,61510:57350,61511:57351,61512:57352,61513:57353,61514:57354,61515:57355,61516:57356,61517:57357,61518:57358,61519:57359,61520:57360,61521:57361,61522:57362,61523:57363,61524:57364,61525:57365,61526:57366,61527:57367,61528:57368,61529:57369,61530:57370,61531:57371,61532:57372,61533:57373,61534:57374,61535:57375,61536:57376,61537:57377,61538:57378,61539:57379,61540:57380,61541:57381,61542:57382,61543:57383,61544:57384,61545:57385,61546:57386,61547:57387,61548:57388,61549:57389,61550:57390,61551:57391,61552:57392,61553:57393,61554:57394,61555:57395,61556:57396,61557:57397,61558:57398,61559:57399,61560:57400,61561:57401,61562:57402,61563:57403,61564:57404,61565:57405,61566:57406,61568:57407,61569:57408,61570:57409,61571:57410,61572:57411,61573:57412,61574:57413,61575:57414,61576:57415,61577:57416,61578:57417,61579:57418,61580:57419,61581:57420,61582:57421,61583:57422,61584:57423,61585:57424,61586:57425,61587:57426,61588:57427,61589:57428,61590:57429,61591:57430,61592:57431,61593:57432,61594:57433,61595:57434,61596:57435,61597:57436,61598:57437,61599:57438,61600:57439,61601:57440,61602:57441,61603:57442,61604:57443,61605:57444,61606:57445,61607:57446,61608:57447,61609:57448,61610:57449,61611:57450,61612:57451,61613:57452,61614:57453,61615:57454,61616:57455,61617:57456,61618:57457,61619:57458,61620:57459,61621:57460,61622:57461,61623:57462,61624:57463,61625:57464,61626:57465,61627:57466,61628:57467,61629:57468,61630:57469,61631:57470,61632:57471,61633:57472,61634:57473,61635:57474,61636:57475,61637:57476,61638:57477,61639:57478,61640:57479,61641:57480,61642:57481,61643:57482,61644:57483,61645:57484,61646:57485,61647:57486,61648:57487,61649:57488,61650:57489,61651:57490,61652:57491,61653:57492,61654:57493,61655:57494,61656:57495,61657:57496,61658:57497,61659:57498,61660:57499,61661:57500,61662:57501,61663:57502,61664:57503,61665:57504,61666:57505,61667:57506,61668:57507,61669:57508,61670:57509,61671:57510,61672:57511,61673:57512,61674:57513,61675:57514,61676:57515,61677:57516,61678:57517,61679:57518,61680:57519,61681:57520,61682:57521,61683:57522,61684:57523,61685:57524,61686:57525,61687:57526,61688:57527,61689:57528,61690:57529,61691:57530,61692:57531,61760:57532,61761:57533,61762:57534,61763:57535,61764:57536,61765:57537,61766:57538,61767:57539,61768:57540,61769:57541,61770:57542,61771:57543,61772:57544,61773:57545,61774:57546,61775:57547,61776:57548,61777:57549,61778:57550,61779:57551,61780:57552,61781:57553,61782:57554,61783:57555,61784:57556,61785:57557,61786:57558,61787:57559,61788:57560,61789:57561,61790:57562,61791:57563,61792:57564,61793:57565,61794:57566,61795:57567,61796:57568,61797:57569,61798:57570,61799:57571,61800:57572,61801:57573,61802:57574,61803:57575,61804:57576,61805:57577,61806:57578,61807:57579,61808:57580,61809:57581,61810:57582,61811:57583,61812:57584,61813:57585,61814:57586,61815:57587,61816:57588,61817:57589,61818:57590,61819:57591,61820:57592,61821:57593,61822:57594,61824:57595,61825:57596,61826:57597,61827:57598,61828:57599,61829:57600,61830:57601,61831:57602,61832:57603,61833:57604,61834:57605,61835:57606,61836:57607,61837:57608,61838:57609,61839:57610,61840:57611,61841:57612,61842:57613,61843:57614,61844:57615,61845:57616,61846:57617,61847:57618,61848:57619,61849:57620,61850:57621,61851:57622,61852:57623,61853:57624,61854:57625,61855:57626,61856:57627,61857:57628,61858:57629,61859:57630,61860:57631,61861:57632,61862:57633,61863:57634,61864:57635,61865:57636,61866:57637,61867:57638,61868:57639,61869:57640,61870:57641,61871:57642,61872:57643,61873:57644,61874:57645,61875:57646,61876:57647,61877:57648,61878:57649,61879:57650,61880:57651,61881:57652,61882:57653,61883:57654,61884:57655,61885:57656,61886:57657,61887:57658,61888:57659,61889:57660,61890:57661,61891:57662,61892:57663,61893:57664,61894:57665,61895:57666,61896:57667,61897:57668,61898:57669,61899:57670,61900:57671,61901:57672,61902:57673,61903:57674,61904:57675,61905:57676,61906:57677,61907:57678,61908:57679,61909:57680,61910:57681,61911:57682,61912:57683,61913:57684,61914:57685,61915:57686,61916:57687,61917:57688,61918:57689,61919:57690,61920:57691,61921:57692,61922:57693,61923:57694,61924:57695,61925:57696,61926:57697,61927:57698,61928:57699,61929:57700,61930:57701,61931:57702,61932:57703,61933:57704,61934:57705,61935:57706,61936:57707,61937:57708,61938:57709,61939:57710,61940:57711,61941:57712,61942:57713,61943:57714,61944:57715,61945:57716,61946:57717,61947:57718,61948:57719,62016:57720,62017:57721,62018:57722,62019:57723,62020:57724,62021:57725,62022:57726,62023:57727,62024:57728,62025:57729,62026:57730,62027:57731,62028:57732,62029:57733,62030:57734,62031:57735,62032:57736,62033:57737,62034:57738,62035:57739,62036:57740,62037:57741,62038:57742,62039:57743,62040:57744,62041:57745,62042:57746,62043:57747,62044:57748,62045:57749,62046:57750,62047:57751,62048:57752,62049:57753,62050:57754,62051:57755,62052:57756,62053:57757,62054:57758,62055:57759,62056:57760,62057:57761,62058:57762,62059:57763,62060:57764,62061:57765,62062:57766,62063:57767,62064:57768,62065:57769,62066:57770,62067:57771,62068:57772,62069:57773,62070:57774,62071:57775,62072:57776,62073:57777,62074:57778,62075:57779,62076:57780,62077:57781,62078:57782,62080:57783,62081:57784,62082:57785,62083:57786,62084:57787,62085:57788,62086:57789,62087:57790,62088:57791,62089:57792,62090:57793,62091:57794,62092:57795,62093:57796,62094:57797,62095:57798,62096:57799,62097:57800,62098:57801,62099:57802,62100:57803,62101:57804,62102:57805,62103:57806,62104:57807,62105:57808,62106:57809,62107:57810,62108:57811,62109:57812,62110:57813,62111:57814,62112:57815,62113:57816,62114:57817,62115:57818,62116:57819,62117:57820,62118:57821,62119:57822,62120:57823,62121:57824,62122:57825,62123:57826,62124:57827,62125:57828,62126:57829,62127:57830,62128:57831,62129:57832,62130:57833,62131:57834,62132:57835,62133:57836,62134:57837,62135:57838,62136:57839,62137:57840,62138:57841,62139:57842,62140:57843,62141:57844,62142:57845,62143:57846,62144:57847,62145:57848,62146:57849,62147:57850,62148:57851,62149:57852,62150:57853,62151:57854,62152:57855,62153:57856,62154:57857,62155:57858,62156:57859,62157:57860,62158:57861,62159:57862,62160:57863,62161:57864,62162:57865,62163:57866,62164:57867,62165:57868,62166:57869,62167:57870,62168:57871,62169:57872,62170:57873,62171:57874,62172:57875,62173:57876,62174:57877,62175:57878,62176:57879,62177:57880,62178:57881,62179:57882,62180:57883,62181:57884,62182:57885,62183:57886,62184:57887,62185:57888,62186:57889,62187:57890,62188:57891,62189:57892,62190:57893,62191:57894,62192:57895,62193:57896,62194:57897,62195:57898,62196:57899,62197:57900,62198:57901,62199:57902,62200:57903,62201:57904,62202:57905,62203:57906,62204:57907,62272:57908,62273:57909,62274:57910,62275:57911,62276:57912,62277:57913,62278:57914,62279:57915,62280:57916,62281:57917,62282:57918,62283:57919,62284:57920,62285:57921,62286:57922,62287:57923,62288:57924,62289:57925,62290:57926,62291:57927,62292:57928,62293:57929,62294:57930,62295:57931,62296:57932,62297:57933,62298:57934,62299:57935,62300:57936,62301:57937,62302:57938,62303:57939,62304:57940,62305:57941,62306:57942,62307:57943,62308:57944,62309:57945,62310:57946,62311:57947,62312:57948,62313:57949,62314:57950,62315:57951,62316:57952,62317:57953,62318:57954,62319:57955,62320:57956,62321:57957,62322:57958,62323:57959,62324:57960,62325:57961,62326:57962,62327:57963,62328:57964,62329:57965,62330:57966,62331:57967,62332:57968,62333:57969,62334:57970,62336:57971,62337:57972,62338:57973,62339:57974,62340:57975,62341:57976,62342:57977,62343:57978,62344:57979,62345:57980,62346:57981,62347:57982,62348:57983,62349:57984,62350:57985,62351:57986,62352:57987,62353:57988,62354:57989,62355:57990,62356:57991,62357:57992,62358:57993,62359:57994,62360:57995,62361:57996,62362:57997,62363:57998,62364:57999,62365:58e3,62366:58001,62367:58002,62368:58003,62369:58004,62370:58005,62371:58006,62372:58007,62373:58008,62374:58009,62375:58010,62376:58011,62377:58012,62378:58013,62379:58014,62380:58015,62381:58016,62382:58017,62383:58018,62384:58019,62385:58020,62386:58021,62387:58022,62388:58023,62389:58024,62390:58025,62391:58026,62392:58027,62393:58028,62394:58029,62395:58030,62396:58031,62397:58032,62398:58033,62399:58034,62400:58035,62401:58036,62402:58037,62403:58038,62404:58039,62405:58040,62406:58041,62407:58042,62408:58043,62409:58044,62410:58045,62411:58046,62412:58047,62413:58048,62414:58049,62415:58050,62416:58051,62417:58052,62418:58053,62419:58054,62420:58055,62421:58056,62422:58057,62423:58058,62424:58059,62425:58060,62426:58061,62427:58062,62428:58063,62429:58064,62430:58065,62431:58066,62432:58067,62433:58068,62434:58069,62435:58070,62436:58071,62437:58072,62438:58073,62439:58074,62440:58075,62441:58076,62442:58077,62443:58078,62444:58079,62445:58080,62446:58081,62447:58082,62448:58083,62449:58084,62450:58085,62451:58086,62452:58087,62453:58088,62454:58089,62455:58090,62456:58091,62457:58092,62458:58093,62459:58094,62460:58095,62528:58096,62529:58097,62530:58098,62531:58099,62532:58100,62533:58101,62534:58102,62535:58103,62536:58104,62537:58105,62538:58106,62539:58107,62540:58108,62541:58109,62542:58110,62543:58111,62544:58112,62545:58113,62546:58114,62547:58115,62548:58116,62549:58117,62550:58118,62551:58119,62552:58120,62553:58121,62554:58122,62555:58123,62556:58124,62557:58125,62558:58126,62559:58127,62560:58128,62561:58129,62562:58130,62563:58131,62564:58132,62565:58133,62566:58134,62567:58135,62568:58136,62569:58137,62570:58138,62571:58139,62572:58140,62573:58141,62574:58142,62575:58143,62576:58144,62577:58145,62578:58146,62579:58147,62580:58148,62581:58149,62582:58150,62583:58151,62584:58152,62585:58153,62586:58154,62587:58155,62588:58156,62589:58157,62590:58158,62592:58159,62593:58160,62594:58161,62595:58162,62596:58163,62597:58164,62598:58165,62599:58166,62600:58167,62601:58168,62602:58169,62603:58170,62604:58171,62605:58172,62606:58173,62607:58174,62608:58175,62609:58176,62610:58177,62611:58178,62612:58179,62613:58180,62614:58181,62615:58182,62616:58183,62617:58184,62618:58185,62619:58186,62620:58187,62621:58188,62622:58189,62623:58190,62624:58191,62625:58192,62626:58193,62627:58194,62628:58195,62629:58196,62630:58197,62631:58198,62632:58199,62633:58200,62634:58201,62635:58202,62636:58203,62637:58204,62638:58205,62639:58206,62640:58207,62641:58208,62642:58209,62643:58210,62644:58211,62645:58212,62646:58213,62647:58214,62648:58215,62649:58216,62650:58217,62651:58218,62652:58219,62653:58220,62654:58221,62655:58222,62656:58223,62657:58224,62658:58225,62659:58226,62660:58227,62661:58228,62662:58229,62663:58230,62664:58231,62665:58232,62666:58233,62667:58234,62668:58235,62669:58236,62670:58237,62671:58238,62672:58239,62673:58240,62674:58241,62675:58242,62676:58243,62677:58244,62678:58245,62679:58246,62680:58247,62681:58248,62682:58249,62683:58250,62684:58251,62685:58252,62686:58253,62687:58254,62688:58255,62689:58256,62690:58257,62691:58258,62692:58259,62693:58260,62694:58261,62695:58262,62696:58263,62697:58264,62698:58265,62699:58266,62700:58267,62701:58268,62702:58269,62703:58270,62704:58271,62705:58272,62706:58273,62707:58274,62708:58275,62709:58276,62710:58277,62711:58278,62712:58279,62713:58280,62714:58281,62715:58282,62716:58283,62784:58284,62785:58285,62786:58286,62787:58287,62788:58288,62789:58289,62790:58290,62791:58291,62792:58292,62793:58293,62794:58294,62795:58295,62796:58296,62797:58297,62798:58298,62799:58299,62800:58300,62801:58301,62802:58302,62803:58303,62804:58304,62805:58305,62806:58306,62807:58307,62808:58308,62809:58309,62810:58310,62811:58311,62812:58312,62813:58313,62814:58314,62815:58315,62816:58316,62817:58317,62818:58318,62819:58319,62820:58320,62821:58321,62822:58322,62823:58323,62824:58324,62825:58325,62826:58326,62827:58327,62828:58328,62829:58329,62830:58330,62831:58331,62832:58332,62833:58333,62834:58334,62835:58335,62836:58336,62837:58337,62838:58338,62839:58339,62840:58340,62841:58341,62842:58342,62843:58343,62844:58344,62845:58345,62846:58346,62848:58347,62849:58348,62850:58349,62851:58350,62852:58351,62853:58352,62854:58353,62855:58354,62856:58355,62857:58356,62858:58357,62859:58358,62860:58359,62861:58360,62862:58361,62863:58362,62864:58363,62865:58364,62866:58365,62867:58366,62868:58367,62869:58368,62870:58369,62871:58370,62872:58371,62873:58372,62874:58373,62875:58374,62876:58375,62877:58376,62878:58377,62879:58378,62880:58379,62881:58380,62882:58381,62883:58382,62884:58383,62885:58384,62886:58385,62887:58386,62888:58387,62889:58388,62890:58389,62891:58390,62892:58391,62893:58392,62894:58393,62895:58394,62896:58395,62897:58396,62898:58397,62899:58398,62900:58399,62901:58400,62902:58401,62903:58402,62904:58403,62905:58404,62906:58405,62907:58406,62908:58407,62909:58408,62910:58409,62911:58410,62912:58411,62913:58412,62914:58413,62915:58414,62916:58415,62917:58416,62918:58417,62919:58418,62920:58419,62921:58420,62922:58421,62923:58422,62924:58423,62925:58424,62926:58425,62927:58426,62928:58427,62929:58428,62930:58429,62931:58430,62932:58431,62933:58432,62934:58433,62935:58434,62936:58435,62937:58436,62938:58437,62939:58438,62940:58439,62941:58440,62942:58441,62943:58442,62944:58443,62945:58444,62946:58445,62947:58446,62948:58447,62949:58448,62950:58449,62951:58450,62952:58451,62953:58452,62954:58453,62955:58454,62956:58455,62957:58456,62958:58457,62959:58458,62960:58459,62961:58460,62962:58461,62963:58462,62964:58463,62965:58464,62966:58465,62967:58466,62968:58467,62969:58468,62970:58469,62971:58470,62972:58471,63040:58472,63041:58473,63042:58474,63043:58475,63044:58476,63045:58477,63046:58478,63047:58479,63048:58480,63049:58481,63050:58482,63051:58483,63052:58484,63053:58485,63054:58486,63055:58487,63056:58488,63057:58489,63058:58490,63059:58491,63060:58492,63061:58493,63062:58494,63063:58495,63064:58496,63065:58497,63066:58498,63067:58499,63068:58500,63069:58501,63070:58502,63071:58503,63072:58504,63073:58505,63074:58506,63075:58507,63076:58508,63077:58509,63078:58510,63079:58511,63080:58512,63081:58513,63082:58514,63083:58515,63084:58516,63085:58517,63086:58518,63087:58519,63088:58520,63089:58521,63090:58522,63091:58523,63092:58524,63093:58525,63094:58526,63095:58527,63096:58528,63097:58529,63098:58530,63099:58531,63100:58532,63101:58533,63102:58534,63104:58535,63105:58536,63106:58537,63107:58538,63108:58539,63109:58540,63110:58541,63111:58542,63112:58543,63113:58544,63114:58545,63115:58546,63116:58547,63117:58548,63118:58549,63119:58550,63120:58551,63121:58552,63122:58553,63123:58554,63124:58555,63125:58556,63126:58557,63127:58558,63128:58559,63129:58560,63130:58561,63131:58562,63132:58563,63133:58564,63134:58565,63135:58566,63136:58567,63137:58568,63138:58569,63139:58570,63140:58571,63141:58572,63142:58573,63143:58574,63144:58575,63145:58576,63146:58577,63147:58578,63148:58579,63149:58580,63150:58581,63151:58582,63152:58583,63153:58584,63154:58585,63155:58586,63156:58587,63157:58588,63158:58589,63159:58590,63160:58591,63161:58592,63162:58593,63163:58594,63164:58595,63165:58596,63166:58597,63167:58598,63168:58599,63169:58600,63170:58601,63171:58602,63172:58603,63173:58604,63174:58605,63175:58606,63176:58607,63177:58608,63178:58609,63179:58610,63180:58611,63181:58612,63182:58613,63183:58614,63184:58615,63185:58616,63186:58617,63187:58618,63188:58619,63189:58620,63190:58621,63191:58622,63192:58623,63193:58624,63194:58625,63195:58626,63196:58627,63197:58628,63198:58629,63199:58630,63200:58631,63201:58632,63202:58633,63203:58634,63204:58635,63205:58636,63206:58637,63207:58638,63208:58639,63209:58640,63210:58641,63211:58642,63212:58643,63213:58644,63214:58645,63215:58646,63216:58647,63217:58648,63218:58649,63219:58650,63220:58651,63221:58652,63222:58653,63223:58654,63224:58655,63225:58656,63226:58657,63227:58658,63228:58659,63296:58660,63297:58661,63298:58662,63299:58663,63300:58664,63301:58665,63302:58666,63303:58667,63304:58668,63305:58669,63306:58670,63307:58671,63308:58672,63309:58673,63310:58674,63311:58675,63312:58676,63313:58677,63314:58678,63315:58679,63316:58680,63317:58681,63318:58682,63319:58683,63320:58684,63321:58685,63322:58686,63323:58687,63324:58688,63325:58689,63326:58690,63327:58691,63328:58692,63329:58693,63330:58694,63331:58695,63332:58696,63333:58697,63334:58698,63335:58699,63336:58700,63337:58701,63338:58702,63339:58703,63340:58704,63341:58705,63342:58706,63343:58707,63344:58708,63345:58709,63346:58710,63347:58711,63348:58712,63349:58713,63350:58714,63351:58715,63352:58716,63353:58717,63354:58718,63355:58719,63356:58720,63357:58721,63358:58722,63360:58723,63361:58724,63362:58725,63363:58726,63364:58727,63365:58728,63366:58729,63367:58730,63368:58731,63369:58732,63370:58733,63371:58734,63372:58735,63373:58736,63374:58737,63375:58738,63376:58739,63377:58740,63378:58741,63379:58742,63380:58743,63381:58744,63382:58745,63383:58746,63384:58747,63385:58748,63386:58749,63387:58750,63388:58751,63389:58752,63390:58753,63391:58754,63392:58755,63393:58756,63394:58757,63395:58758,63396:58759,63397:58760,63398:58761,63399:58762,63400:58763,63401:58764,63402:58765,63403:58766,63404:58767,63405:58768,63406:58769,63407:58770,63408:58771,63409:58772,63410:58773,63411:58774,63412:58775,63413:58776,63414:58777,63415:58778,63416:58779,63417:58780,63418:58781,63419:58782,63420:58783,63421:58784,63422:58785,63423:58786,63424:58787,63425:58788,63426:58789,63427:58790,63428:58791,63429:58792,63430:58793,63431:58794,63432:58795,63433:58796,63434:58797,63435:58798,63436:58799,63437:58800,63438:58801,63439:58802,63440:58803,63441:58804,63442:58805,63443:58806,63444:58807,63445:58808,63446:58809,63447:58810,63448:58811,63449:58812,63450:58813,63451:58814,63452:58815,63453:58816,63454:58817,63455:58818,63456:58819,63457:58820,63458:58821,63459:58822,63460:58823,63461:58824,63462:58825,63463:58826,63464:58827,63465:58828,63466:58829,63467:58830,63468:58831,63469:58832,63470:58833,63471:58834,63472:58835,63473:58836,63474:58837,63475:58838,63476:58839,63477:58840,63478:58841,63479:58842,63480:58843,63481:58844,63482:58845,63483:58846,63484:58847,63552:58848,63553:58849,63554:58850,63555:58851,63556:58852,63557:58853,63558:58854,63559:58855,63560:58856,63561:58857,63562:58858,63563:58859,63564:58860,63565:58861,63566:58862,63567:58863,63568:58864,63569:58865,63570:58866,63571:58867,63572:58868,63573:58869,63574:58870,63575:58871,63576:58872,63577:58873,63578:58874,63579:58875,63580:58876,63581:58877,63582:58878,63583:58879,63584:58880,63585:58881,63586:58882,63587:58883,63588:58884,63589:58885,63590:58886,63591:58887,63592:58888,63593:58889,63594:58890,63595:58891,63596:58892,63597:58893,63598:58894,63599:58895,63600:58896,63601:58897,63602:58898,63603:58899,63604:58900,63605:58901,63606:58902,63607:58903,63608:58904,63609:58905,63610:58906,63611:58907,63612:58908,63613:58909,63614:58910,63616:58911,63617:58912,63618:58913,63619:58914,63620:58915,63621:58916,63622:58917,63623:58918,63624:58919,63625:58920,63626:58921,63627:58922,63628:58923,63629:58924,63630:58925,63631:58926,63632:58927,63633:58928,63634:58929,63635:58930,63636:58931,63637:58932,63638:58933,63639:58934,63640:58935,63641:58936,63642:58937,63643:58938,63644:58939,63645:58940,63646:58941,63647:58942,63648:58943,63649:58944,63650:58945,63651:58946,63652:58947,63653:58948,63654:58949,63655:58950,63656:58951,63657:58952,63658:58953,63659:58954,63660:58955,63661:58956,63662:58957,63663:58958,63664:58959,63665:58960,63666:58961,63667:58962,63668:58963,63669:58964,63670:58965,63671:58966,63672:58967,63673:58968,63674:58969,63675:58970,63676:58971,63677:58972,63678:58973,63679:58974,63680:58975,63681:58976,63682:58977,63683:58978,63684:58979,63685:58980,63686:58981,63687:58982,63688:58983,63689:58984,63690:58985,63691:58986,63692:58987,63693:58988,63694:58989,63695:58990,63696:58991,63697:58992,63698:58993,63699:58994,63700:58995,63701:58996,63702:58997,63703:58998,63704:58999,63705:59e3,63706:59001,63707:59002,63708:59003,63709:59004,63710:59005,63711:59006,63712:59007,63713:59008,63714:59009,63715:59010,63716:59011,63717:59012,63718:59013,63719:59014,63720:59015,63721:59016,63722:59017,63723:59018,63724:59019,63725:59020,63726:59021,63727:59022,63728:59023,63729:59024,63730:59025,63731:59026,63732:59027,63733:59028,63734:59029,63735:59030,63736:59031,63737:59032,63738:59033,63739:59034,63740:59035,64064:8560,64065:8561,64066:8562,64067:8563,64068:8564,64069:8565,64070:8566,64071:8567,64072:8568,64073:8569,64074:8544,64075:8545,64076:8546,64077:8547,64078:8548,64079:8549,64080:8550,64081:8551,64082:8552,64083:8553,64084:65506,64085:65508,64086:65287,64087:65282,64088:12849,64089:8470,64090:8481,64091:8757,64092:32394,64093:35100,64094:37704,64095:37512,64096:34012,64097:20425,64098:28859,64099:26161,64100:26824,64101:37625,64102:26363,64103:24389,64104:20008,64105:20193,64106:20220,64107:20224,64108:20227,64109:20281,64110:20310,64111:20370,64112:20362,64113:20378,64114:20372,64115:20429,64116:20544,64117:20514,64118:20479,64119:20510,64120:20550,64121:20592,64122:20546,64123:20628,64124:20724,64125:20696,64126:20810,64128:20836,64129:20893,64130:20926,64131:20972,64132:21013,64133:21148,64134:21158,64135:21184,64136:21211,64137:21248,64138:21255,64139:21284,64140:21362,64141:21395,64142:21426,64143:21469,64144:64014,64145:21660,64146:21642,64147:21673,64148:21759,64149:21894,64150:22361,64151:22373,64152:22444,64153:22472,64154:22471,64155:64015,64156:64016,64157:22686,64158:22706,64159:22795,64160:22867,64161:22875,64162:22877,64163:22883,64164:22948,64165:22970,64166:23382,64167:23488,64168:29999,64169:23512,64170:23532,64171:23582,64172:23718,64173:23738,64174:23797,64175:23847,64176:23891,64177:64017,64178:23874,64179:23917,64180:23992,64181:23993,64182:24016,64183:24353,64184:24372,64185:24423,64186:24503,64187:24542,64188:24669,64189:24709,64190:24714,64191:24798,64192:24789,64193:24864,64194:24818,64195:24849,64196:24887,64197:24880,64198:24984,64199:25107,64200:25254,64201:25589,64202:25696,64203:25757,64204:25806,64205:25934,64206:26112,64207:26133,64208:26171,64209:26121,64210:26158,64211:26142,64212:26148,64213:26213,64214:26199,64215:26201,64216:64018,64217:26227,64218:26265,64219:26272,64220:26290,64221:26303,64222:26362,64223:26382,64224:63785,64225:26470,64226:26555,64227:26706,64228:26560,64229:26625,64230:26692,64231:26831,64232:64019,64233:26984,64234:64020,64235:27032,64236:27106,64237:27184,64238:27243,64239:27206,64240:27251,64241:27262,64242:27362,64243:27364,64244:27606,64245:27711,64246:27740,64247:27782,64248:27759,64249:27866,64250:27908,64251:28039,64252:28015,64320:28054,64321:28076,64322:28111,64323:28152,64324:28146,64325:28156,64326:28217,64327:28252,64328:28199,64329:28220,64330:28351,64331:28552,64332:28597,64333:28661,64334:28677,64335:28679,64336:28712,64337:28805,64338:28843,64339:28943,64340:28932,64341:29020,64342:28998,64343:28999,64344:64021,64345:29121,64346:29182,64347:29361,64348:29374,64349:29476,64350:64022,64351:29559,64352:29629,64353:29641,64354:29654,64355:29667,64356:29650,64357:29703,64358:29685,64359:29734,64360:29738,64361:29737,64362:29742,64363:29794,64364:29833,64365:29855,64366:29953,64367:30063,64368:30338,64369:30364,64370:30366,64371:30363,64372:30374,64373:64023,64374:30534,64375:21167,64376:30753,64377:30798,64378:30820,64379:30842,64380:31024,64381:64024,64382:64025,64384:64026,64385:31124,64386:64027,64387:31131,64388:31441,64389:31463,64390:64028,64391:31467,64392:31646,64393:64029,64394:32072,64395:32092,64396:32183,64397:32160,64398:32214,64399:32338,64400:32583,64401:32673,64402:64030,64403:33537,64404:33634,64405:33663,64406:33735,64407:33782,64408:33864,64409:33972,64410:34131,64411:34137,64412:34155,64413:64031,64414:34224,64415:64032,64416:64033,64417:34823,64418:35061,64419:35346,64420:35383,64421:35449,64422:35495,64423:35518,64424:35551,64425:64034,64426:35574,64427:35667,64428:35711,64429:36080,64430:36084,64431:36114,64432:36214,64433:64035,64434:36559,64435:64036,64436:64037,64437:36967,64438:37086,64439:64038,64440:37141,64441:37159,64442:37338,64443:37335,64444:37342,64445:37357,64446:37358,64447:37348,64448:37349,64449:37382,64450:37392,64451:37386,64452:37434,64453:37440,64454:37436,64455:37454,64456:37465,64457:37457,64458:37433,64459:37479,64460:37543,64461:37495,64462:37496,64463:37607,64464:37591,64465:37593,64466:37584,64467:64039,64468:37589,64469:37600,64470:37587,64471:37669,64472:37665,64473:37627,64474:64040,64475:37662,64476:37631,64477:37661,64478:37634,64479:37744,64480:37719,64481:37796,64482:37830,64483:37854,64484:37880,64485:37937,64486:37957,64487:37960,64488:38290,64489:63964,64490:64041,64491:38557,64492:38575,64493:38707,64494:38715,64495:38723,64496:38733,64497:38735,64498:38737,64499:38741,64500:38999,64501:39013,64502:64042,64503:64043,64504:39207,64505:64044,64506:39326,64507:39502,64508:39641,64576:39644,64577:39797,64578:39794,64579:39823,64580:39857,64581:39867,64582:39936,64583:40304,64584:40299,64585:64045,64586:40473,64587:40657};function _S(n,e){this.dv=new DataView(n),this.offset=0,this.littleEndian=e!==void 0?e:!0,this.encoder=new n8}_S.prototype={constructor:_S,getInt8:function(){var n=this.dv.getInt8(this.offset);return this.offset+=1,n},getInt8Array:function(n){for(var e=[],t=0;t<n;t++)e.push(this.getInt8());return e},getUint8:function(){var n=this.dv.getUint8(this.offset);return this.offset+=1,n},getUint8Array:function(n){for(var e=[],t=0;t<n;t++)e.push(this.getUint8());return e},getInt16:function(){var n=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,n},getInt16Array:function(n){for(var e=[],t=0;t<n;t++)e.push(this.getInt16());return e},getUint16:function(){var n=this.dv.getUint16(this.offset,this.littleEndian);return this.offset+=2,n},getUint16Array:function(n){for(var e=[],t=0;t<n;t++)e.push(this.getUint16());return e},getInt32:function(){var n=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,n},getInt32Array:function(n){for(var e=[],t=0;t<n;t++)e.push(this.getInt32());return e},getUint32:function(){var n=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,n},getUint32Array:function(n){for(var e=[],t=0;t<n;t++)e.push(this.getUint32());return e},getFloat32:function(){var n=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,n},getFloat32Array:function(n){for(var e=[],t=0;t<n;t++)e.push(this.getFloat32());return e},getFloat64:function(){var n=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,n},getFloat64Array:function(n){for(var e=[],t=0;t<n;t++)e.push(this.getFloat64());return e},getIndex:function(n,e){switch(n){case 1:return e===!0?this.getUint8():this.getInt8();case 2:return e===!0?this.getUint16():this.getInt16();case 4:return this.getInt32();default:throw"unknown number type "+n+" exception."}},getIndexArray:function(n,e,t){for(var i=[],r=0;r<e;r++)i.push(this.getIndex(n,t));return i},getChars:function(n){for(var e="";n>0;){var t=this.getUint8();if(n--,t===0)break;e+=String.fromCharCode(t)}for(;n>0;)this.getUint8(),n--;return e},getSjisStringsAsUnicode:function(n){for(var e=[];n>0;){var t=this.getUint8();if(n--,t===0)break;e.push(t)}for(;n>0;)this.getUint8(),n--;return this.encoder.s2u(new Uint8Array(e))},getUnicodeStrings:function(n){for(var e="";n>0;){var t=this.getUint16();if(n-=2,t===0)break;e+=String.fromCharCode(t)}for(;n>0;)this.getUint8(),n--;return e},getTextBuffer:function(){var n=this.getUint32();return this.getUnicodeStrings(n)}};function ES(){}ES.prototype={constructor:ES,leftToRightVector3:function(n){n[2]=-n[2]},leftToRightQuaternion:function(n){n[0]=-n[0],n[1]=-n[1]},leftToRightEuler:function(n){n[0]=-n[0],n[1]=-n[1]},leftToRightIndexOrder:function(n){var e=n[2];n[2]=n[0],n[0]=e},leftToRightVector3Range:function(n,e){var t=-e[2];e[2]=-n[2],n[2]=t},leftToRightEulerRange:function(n,e){var t=-e[0],i=-e[1];e[0]=-n[0],e[1]=-n[1],n[0]=t,n[1]=i}};const DM=0,nK=2,iK=0,rK=0,sK=2,aK=0,oK=0,lK=1,Ny=2,cK=1,uK=64,PM=0,LM=9,i8=15,UM=16,r8=22,OM=37,s8=43,FM=76,kM=83,NM=97,GM=100,zM=103,QM=109;class hK{constructor(){this.vkFormat=PM,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=DM,this.levels=[],this.dataFormatDescriptor=[{vendorId:rK,descriptorType:iK,descriptorBlockSize:0,versionNumber:sK,colorModel:aK,colorPrimaries:cK,transferFunction:Ny,flags:oK,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class yd{constructor(e,t,i,r){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,i),this._littleEndian=r,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian),t=this._dataView.getUint32(this._offset+4,this._littleEndian),i=e+2**32*t;return this._offset+=8,i}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_skip(e){return this._offset+=e,this}_scan(e,t=0){const i=this._offset;let r=0;for(;this._dataView.getUint8(this._offset)!==t&&r<e;)r++,this._offset++;return r<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+i,r)}}const Er=[171,75,84,88,32,50,48,187,13,10,26,10];function SS(n){return typeof TextDecoder<"u"?new TextDecoder().decode(n):Buffer.from(n).toString("utf8")}function fK(n){const e=new Uint8Array(n.buffer,n.byteOffset,Er.length);if(e[0]!==Er[0]||e[1]!==Er[1]||e[2]!==Er[2]||e[3]!==Er[3]||e[4]!==Er[4]||e[5]!==Er[5]||e[6]!==Er[6]||e[7]!==Er[7]||e[8]!==Er[8]||e[9]!==Er[9]||e[10]!==Er[10]||e[11]!==Er[11])throw new Error("Missing KTX 2.0 identifier.");const t=new hK,i=17*Uint32Array.BYTES_PER_ELEMENT,r=new yd(n,Er.length,i,!0);t.vkFormat=r._nextUint32(),t.typeSize=r._nextUint32(),t.pixelWidth=r._nextUint32(),t.pixelHeight=r._nextUint32(),t.pixelDepth=r._nextUint32(),t.layerCount=r._nextUint32(),t.faceCount=r._nextUint32();const s=r._nextUint32();t.supercompressionScheme=r._nextUint32();const a=r._nextUint32(),o=r._nextUint32(),l=r._nextUint32(),c=r._nextUint32(),u=r._nextUint64(),h=r._nextUint64(),f=s*3*8,p=new yd(n,Er.length+i,f,!0);for(let V=0;V<s;V++)t.levels.push({levelData:new Uint8Array(n.buffer,n.byteOffset+p._nextUint64(),p._nextUint64()),uncompressedByteLength:p._nextUint64()});const m=new yd(n,a,o,!0),y={vendorId:m._skip(4)._nextUint16(),descriptorType:m._nextUint16(),versionNumber:m._nextUint16(),descriptorBlockSize:m._nextUint16(),colorModel:m._nextUint8(),colorPrimaries:m._nextUint8(),transferFunction:m._nextUint8(),flags:m._nextUint8(),texelBlockDimension:[m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8()],bytesPlane:[m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8()],samples:[]},v=6,A=4,_=(y.descriptorBlockSize/4-v)/A;for(let V=0;V<_;V++){const D={bitOffset:m._nextUint16(),bitLength:m._nextUint8(),channelType:m._nextUint8(),samplePosition:[m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};D.channelType&uK?(D.sampleLower=m._nextInt32(),D.sampleUpper=m._nextInt32()):(D.sampleLower=m._nextUint32(),D.sampleUpper=m._nextUint32()),y.samples[V]=D}t.dataFormatDescriptor.length=0,t.dataFormatDescriptor.push(y);const x=new yd(n,l,c,!0);for(;x._offset<c;){const V=x._nextUint32(),D=x._scan(V),k=SS(D),Z=x._scan(V-D.byteLength);t.keyValue[k]=k.match(/^ktx/i)?SS(Z):Z,x._offset%4&&x._skip(4-x._offset%4)}if(h<=0)return t;const E=new yd(n,u,h,!0),w=E._nextUint16(),I=E._nextUint16(),T=E._nextUint32(),M=E._nextUint32(),b=E._nextUint32(),B=E._nextUint32(),L=[];for(let V=0;V<s;V++)L.push({imageFlags:E._nextUint32(),rgbSliceByteOffset:E._nextUint32(),rgbSliceByteLength:E._nextUint32(),alphaSliceByteOffset:E._nextUint32(),alphaSliceByteLength:E._nextUint32()});const U=u+E._offset,O=U+T,Q=O+M,G=Q+b,F=new Uint8Array(n.buffer,n.byteOffset+U,T),q=new Uint8Array(n.buffer,n.byteOffset+O,M),Y=new Uint8Array(n.buffer,n.byteOffset+Q,b),H=new Uint8Array(n.buffer,n.byteOffset+G,B);return t.globalData={endpointCount:w,selectorCount:I,imageDescs:L,endpointsData:F,selectorsData:q,tablesData:Y,extendedData:H},t}let Jv,Po,Gy;const Zv={env:{emscripten_notify_memory_growth:function(n){Gy=new Uint8Array(Po.exports.memory.buffer)}}};class dK{init(){return Jv||(Jv=typeof fetch<"u"?fetch("data:application/wasm;base64,"+wS).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,Zv)).then(this._init):WebAssembly.instantiate(Buffer.from(wS,"base64"),Zv).then(this._init),Jv)}_init(e){Po=e.instance,Zv.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!Po)throw new Error("ZSTDDecoder: Await .init() before decoding.");const i=e.byteLength,r=Po.exports.malloc(i);Gy.set(e,r),t=t||Number(Po.exports.ZSTD_findDecompressedSize(r,i));const s=Po.exports.malloc(t),a=Po.exports.ZSTD_decompress(s,t,r,i),o=Gy.slice(s,s+a);return Po.exports.free(r),Po.exports.free(s),o}}const wS="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ";/*! https://mths.be/codepointat v0.2.0 by @mathias */String.prototype.codePointAt||function(){var n=function(){try{var t={},i=Object.defineProperty,r=i(t,t,t)&&i}catch{}return r}(),e=function(t){if(this==null)throw TypeError();var i=String(this),r=i.length,s=t?Number(t):0;if(s!=s&&(s=0),!(s<0||s>=r)){var a=i.charCodeAt(s),o;return a>=55296&&a<=56319&&r>s+1&&(o=i.charCodeAt(s+1),o>=56320&&o<=57343)?(a-55296)*1024+o-56320+65536:a}};n?n(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e}();function HM(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}var pK=new HM,gK=new HM,VM=new Uint8Array(30),WM=new Uint16Array(30),mK=new Uint8Array(30),AK=new Uint16Array(30);function YM(n,e,t,i){var r,s;for(r=0;r<t;++r)n[r]=0;for(r=0;r<30-t;++r)n[r+t]=r/t|0;for(s=i,r=0;r<30;++r)e[r]=s,s+=1<<n[r]}function vK(n,e){var t;for(t=0;t<7;++t)n.table[t]=0;for(n.table[7]=24,n.table[8]=152,n.table[9]=112,t=0;t<24;++t)n.trans[t]=256+t;for(t=0;t<144;++t)n.trans[24+t]=t;for(t=0;t<8;++t)n.trans[24+144+t]=280+t;for(t=0;t<112;++t)n.trans[24+144+8+t]=144+t;for(t=0;t<5;++t)e.table[t]=0;for(e.table[5]=32,t=0;t<32;++t)e.trans[t]=t}vK(pK,gK);YM(VM,WM,4,3);YM(mK,AK,2,1);VM[28]=0;WM[28]=258;function dh(n,e,t,i,r){return Math.pow(1-r,3)*n+3*Math.pow(1-r,2)*r*e+3*(1-r)*Math.pow(r,2)*t+Math.pow(r,3)*i}function Jl(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}Jl.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)};Jl.prototype.addPoint=function(n,e){typeof n=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=n,this.x2=n),n<this.x1&&(this.x1=n),n>this.x2&&(this.x2=n)),typeof e=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),e<this.y1&&(this.y1=e),e>this.y2&&(this.y2=e))};Jl.prototype.addX=function(n){this.addPoint(n,null)};Jl.prototype.addY=function(n){this.addPoint(null,n)};Jl.prototype.addBezier=function(n,e,t,i,r,s,a,o){var l=[n,e],c=[t,i],u=[r,s],h=[a,o];this.addPoint(n,e),this.addPoint(a,o);for(var f=0;f<=1;f++){var p=6*l[f]-12*c[f]+6*u[f],m=-3*l[f]+9*c[f]-9*u[f]+3*h[f],y=3*c[f]-3*l[f];if(m===0){if(p===0)continue;var v=-y/p;0<v&&v<1&&(f===0&&this.addX(dh(l[f],c[f],u[f],h[f],v)),f===1&&this.addY(dh(l[f],c[f],u[f],h[f],v)));continue}var A=Math.pow(p,2)-4*y*m;if(!(A<0)){var _=(-p+Math.sqrt(A))/(2*m);0<_&&_<1&&(f===0&&this.addX(dh(l[f],c[f],u[f],h[f],_)),f===1&&this.addY(dh(l[f],c[f],u[f],h[f],_)));var x=(-p-Math.sqrt(A))/(2*m);0<x&&x<1&&(f===0&&this.addX(dh(l[f],c[f],u[f],h[f],x)),f===1&&this.addY(dh(l[f],c[f],u[f],h[f],x)))}}};Jl.prototype.addQuad=function(n,e,t,i,r,s){var a=n+.6666666666666666*(t-n),o=e+2/3*(i-e),l=a+1/3*(r-n),c=o+1/3*(s-e);this.addBezier(n,e,a,o,l,c,r,s)};function Li(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}Li.prototype.moveTo=function(n,e){this.commands.push({type:"M",x:n,y:e})};Li.prototype.lineTo=function(n,e){this.commands.push({type:"L",x:n,y:e})};Li.prototype.curveTo=Li.prototype.bezierCurveTo=function(n,e,t,i,r,s){this.commands.push({type:"C",x1:n,y1:e,x2:t,y2:i,x:r,y:s})};Li.prototype.quadTo=Li.prototype.quadraticCurveTo=function(n,e,t,i){this.commands.push({type:"Q",x1:n,y1:e,x:t,y:i})};Li.prototype.close=Li.prototype.closePath=function(){this.commands.push({type:"Z"})};Li.prototype.extend=function(n){if(n.commands)n=n.commands;else if(n instanceof Jl){var e=n;this.moveTo(e.x1,e.y1),this.lineTo(e.x2,e.y1),this.lineTo(e.x2,e.y2),this.lineTo(e.x1,e.y2),this.close();return}Array.prototype.push.apply(this.commands,n)};Li.prototype.getBoundingBox=function(){for(var n=new Jl,e=0,t=0,i=0,r=0,s=0;s<this.commands.length;s++){var a=this.commands[s];switch(a.type){case"M":n.addPoint(a.x,a.y),e=i=a.x,t=r=a.y;break;case"L":n.addPoint(a.x,a.y),i=a.x,r=a.y;break;case"Q":n.addQuad(i,r,a.x1,a.y1,a.x,a.y),i=a.x,r=a.y;break;case"C":n.addBezier(i,r,a.x1,a.y1,a.x2,a.y2,a.x,a.y),i=a.x,r=a.y;break;case"Z":i=e,r=t;break;default:throw new Error("Unexpected path command "+a.type)}}return n.isEmpty()&&n.addPoint(0,0),n};Li.prototype.draw=function(n){n.beginPath();for(var e=0;e<this.commands.length;e+=1){var t=this.commands[e];t.type==="M"?n.moveTo(t.x,t.y):t.type==="L"?n.lineTo(t.x,t.y):t.type==="C"?n.bezierCurveTo(t.x1,t.y1,t.x2,t.y2,t.x,t.y):t.type==="Q"?n.quadraticCurveTo(t.x1,t.y1,t.x,t.y):t.type==="Z"&&n.closePath()}this.fill&&(n.fillStyle=this.fill,n.fill()),this.stroke&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeWidth,n.stroke())};Li.prototype.toPathData=function(n){n=n!==void 0?n:2;function e(a){return Math.round(a)===a?""+Math.round(a):a.toFixed(n)}function t(){for(var a=arguments,o="",l=0;l<arguments.length;l+=1){var c=a[l];c>=0&&l>0&&(o+=" "),o+=e(c)}return o}for(var i="",r=0;r<this.commands.length;r+=1){var s=this.commands[r];s.type==="M"?i+="M"+t(s.x,s.y):s.type==="L"?i+="L"+t(s.x,s.y):s.type==="C"?i+="C"+t(s.x1,s.y1,s.x2,s.y2,s.x,s.y):s.type==="Q"?i+="Q"+t(s.x1,s.y1,s.x,s.y):s.type==="Z"&&(i+="Z")}return i};Li.prototype.toSVG=function(n){var e='<path d="';return e+=this.toPathData(n),e+='"',this.fill&&this.fill!=="black"&&(this.fill===null?e+=' fill="none"':e+=' fill="'+this.fill+'"'),this.stroke&&(e+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),e+="/>",e};Li.prototype.toDOMElement=function(n){var e=this.toPathData(n),t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d",e),t};function qM(n){throw new Error(n)}function CS(n,e){n||qM(e)}var Lt={fail:qM,argument:CS,assert:CS},TS=32768,bS=2147483648,ef={},Ze={},Mt={};function ya(n){return function(){return n}}Ze.BYTE=function(n){return Lt.argument(n>=0&&n<=255,"Byte value should be between 0 and 255."),[n]};Mt.BYTE=ya(1);Ze.CHAR=function(n){return[n.charCodeAt(0)]};Mt.CHAR=ya(1);Ze.CHARARRAY=function(n){typeof n>"u"&&(n="",console.warn("Undefined CHARARRAY encountered and treated as an empty string. This is probably caused by a missing glyph name."));for(var e=[],t=0;t<n.length;t+=1)e[t]=n.charCodeAt(t);return e};Mt.CHARARRAY=function(n){return typeof n>"u"?0:n.length};Ze.USHORT=function(n){return[n>>8&255,n&255]};Mt.USHORT=ya(2);Ze.SHORT=function(n){return n>=TS&&(n=-(2*TS-n)),[n>>8&255,n&255]};Mt.SHORT=ya(2);Ze.UINT24=function(n){return[n>>16&255,n>>8&255,n&255]};Mt.UINT24=ya(3);Ze.ULONG=function(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]};Mt.ULONG=ya(4);Ze.LONG=function(n){return n>=bS&&(n=-(2*bS-n)),[n>>24&255,n>>16&255,n>>8&255,n&255]};Mt.LONG=ya(4);Ze.FIXED=Ze.ULONG;Mt.FIXED=Mt.ULONG;Ze.FWORD=Ze.SHORT;Mt.FWORD=Mt.SHORT;Ze.UFWORD=Ze.USHORT;Mt.UFWORD=Mt.USHORT;Ze.LONGDATETIME=function(n){return[0,0,0,0,n>>24&255,n>>16&255,n>>8&255,n&255]};Mt.LONGDATETIME=ya(8);Ze.TAG=function(n){return Lt.argument(n.length===4,"Tag should be exactly 4 ASCII characters."),[n.charCodeAt(0),n.charCodeAt(1),n.charCodeAt(2),n.charCodeAt(3)]};Mt.TAG=ya(4);Ze.Card8=Ze.BYTE;Mt.Card8=Mt.BYTE;Ze.Card16=Ze.USHORT;Mt.Card16=Mt.USHORT;Ze.OffSize=Ze.BYTE;Mt.OffSize=Mt.BYTE;Ze.SID=Ze.USHORT;Mt.SID=Mt.USHORT;Ze.NUMBER=function(n){return n>=-107&&n<=107?[n+139]:n>=108&&n<=1131?(n=n-108,[(n>>8)+247,n&255]):n>=-1131&&n<=-108?(n=-n-108,[(n>>8)+251,n&255]):n>=-32768&&n<=32767?Ze.NUMBER16(n):Ze.NUMBER32(n)};Mt.NUMBER=function(n){return Ze.NUMBER(n).length};Ze.NUMBER16=function(n){return[28,n>>8&255,n&255]};Mt.NUMBER16=ya(3);Ze.NUMBER32=function(n){return[29,n>>24&255,n>>16&255,n>>8&255,n&255]};Mt.NUMBER32=ya(5);Ze.REAL=function(n){var e=n.toString(),t=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(e);if(t){var i=parseFloat("1e"+((t[2]?+t[2]:0)+t[1].length));e=(Math.round(n*i)/i).toString()}for(var r="",s=0,a=e.length;s<a;s+=1){var o=e[s];o==="e"?r+=e[++s]==="-"?"c":"b":o==="."?r+="a":o==="-"?r+="e":r+=o}r+=r.length&1?"f":"ff";for(var l=[30],c=0,u=r.length;c<u;c+=2)l.push(parseInt(r.substr(c,2),16));return l};Mt.REAL=function(n){return Ze.REAL(n).length};Ze.NAME=Ze.CHARARRAY;Mt.NAME=Mt.CHARARRAY;Ze.STRING=Ze.CHARARRAY;Mt.STRING=Mt.CHARARRAY;ef.UTF8=function(n,e,t){for(var i=[],r=t,s=0;s<r;s++,e+=1)i[s]=n.getUint8(e);return String.fromCharCode.apply(null,i)};ef.UTF16=function(n,e,t){for(var i=[],r=t/2,s=0;s<r;s++,e+=2)i[s]=n.getUint16(e);return String.fromCharCode.apply(null,i)};Ze.UTF16=function(n){for(var e=[],t=0;t<n.length;t+=1){var i=n.charCodeAt(t);e[e.length]=i>>8&255,e[e.length]=i&255}return e};Mt.UTF16=function(n){return n.length*2};var zy={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ­","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};ef.MACSTRING=function(n,e,t,i){var r=zy[i];if(r!==void 0){for(var s="",a=0;a<t;a++){var o=n.getUint8(e+a);o<=127?s+=String.fromCharCode(o):s+=r[o&127]}return s}};var Ng=typeof WeakMap=="function"&&new WeakMap,Gg,yK=function(n){if(!Gg){Gg={};for(var e in zy)Gg[e]=new String(e)}var t=Gg[n];if(t!==void 0){if(Ng){var i=Ng.get(t);if(i!==void 0)return i}var r=zy[n];if(r!==void 0){for(var s={},a=0;a<r.length;a++)s[r.charCodeAt(a)]=a+128;return Ng&&Ng.set(t,s),s}}};Ze.MACSTRING=function(n,e){var t=yK(e);if(t!==void 0){for(var i=[],r=0;r<n.length;r++){var s=n.charCodeAt(r);if(s>=128&&(s=t[s],s===void 0))return;i[r]=s}return i}};Mt.MACSTRING=function(n,e){var t=Ze.MACSTRING(n,e);return t!==void 0?t.length:0};function Qy(n){return n>=-128&&n<=127}function xK(n,e,t){for(var i=0,r=n.length;e<r&&i<64&&n[e]===0;)++e,++i;return t.push(128|i-1),e}function _K(n,e,t){for(var i=0,r=n.length,s=e;s<r&&i<64;){var a=n[s];if(!Qy(a)||a===0&&s+1<r&&n[s+1]===0)break;++s,++i}t.push(i-1);for(var o=e;o<s;++o)t.push(n[o]+256&255);return s}function EK(n,e,t){for(var i=0,r=n.length,s=e;s<r&&i<64;){var a=n[s];if(a===0||Qy(a)&&s+1<r&&Qy(n[s+1]))break;++s,++i}t.push(64|i-1);for(var o=e;o<s;++o){var l=n[o];t.push(l+65536>>8&255,l+256&255)}return s}Ze.VARDELTAS=function(n){for(var e=0,t=[];e<n.length;){var i=n[e];i===0?e=xK(n,e,t):i>=-128&&i<=127?e=_K(n,e,t):e=EK(n,e,t)}return t};Ze.INDEX=function(n){for(var e=1,t=[e],i=[],r=0;r<n.length;r+=1){var s=Ze.OBJECT(n[r]);Array.prototype.push.apply(i,s),e+=s.length,t.push(e)}if(i.length===0)return[0,0];for(var a=[],o=1+Math.floor(Math.log(e)/Math.log(2))/8|0,l=[void 0,Ze.BYTE,Ze.USHORT,Ze.UINT24,Ze.ULONG][o],c=0;c<t.length;c+=1){var u=l(t[c]);Array.prototype.push.apply(a,u)}return Array.prototype.concat(Ze.Card16(n.length),Ze.OffSize(o),a,i)};Mt.INDEX=function(n){return Ze.INDEX(n).length};Ze.DICT=function(n){for(var e=[],t=Object.keys(n),i=t.length,r=0;r<i;r+=1){var s=parseInt(t[r],0),a=n[s];e=e.concat(Ze.OPERAND(a.value,a.type)),e=e.concat(Ze.OPERATOR(s))}return e};Mt.DICT=function(n){return Ze.DICT(n).length};Ze.OPERATOR=function(n){return n<1200?[n]:[12,n-1200]};Ze.OPERAND=function(n,e){var t=[];if(Array.isArray(e))for(var i=0;i<e.length;i+=1)Lt.argument(n.length===e.length,"Not enough arguments given for type"+e),t=t.concat(Ze.OPERAND(n[i],e[i]));else if(e==="SID")t=t.concat(Ze.NUMBER(n));else if(e==="offset")t=t.concat(Ze.NUMBER32(n));else if(e==="number")t=t.concat(Ze.NUMBER(n));else if(e==="real")t=t.concat(Ze.REAL(n));else throw new Error("Unknown operand type "+e);return t};Ze.OP=Ze.BYTE;Mt.OP=Mt.BYTE;var zg=typeof WeakMap=="function"&&new WeakMap;Ze.CHARSTRING=function(n){if(zg){var e=zg.get(n);if(e!==void 0)return e}for(var t=[],i=n.length,r=0;r<i;r+=1){var s=n[r];t=t.concat(Ze[s.type](s.value))}return zg&&zg.set(n,t),t};Mt.CHARSTRING=function(n){return Ze.CHARSTRING(n).length};Ze.OBJECT=function(n){var e=Ze[n.type];return Lt.argument(e!==void 0,"No encoding function for type "+n.type),e(n.value)};Mt.OBJECT=function(n){var e=Mt[n.type];return Lt.argument(e!==void 0,"No sizeOf function for type "+n.type),e(n.value)};Ze.TABLE=function(n){for(var e=[],t=n.fields.length,i=[],r=[],s=0;s<t;s+=1){var a=n.fields[s],o=Ze[a.type];Lt.argument(o!==void 0,"No encoding function for field type "+a.type+" ("+a.name+")");var l=n[a.name];l===void 0&&(l=a.value);var c=o(l);a.type==="TABLE"?(r.push(e.length),e=e.concat([0,0]),i.push(c)):e=e.concat(c)}for(var u=0;u<i.length;u+=1){var h=r[u],f=e.length;Lt.argument(f<65536,"Table "+n.tableName+" too big."),e[h]=f>>8,e[h+1]=f&255,e=e.concat(i[u])}return e};Mt.TABLE=function(n){for(var e=0,t=n.fields.length,i=0;i<t;i+=1){var r=n.fields[i],s=Mt[r.type];Lt.argument(s!==void 0,"No sizeOf function for field type "+r.type+" ("+r.name+")");var a=n[r.name];a===void 0&&(a=r.value),e+=s(a),r.type==="TABLE"&&(e+=2)}return e};Ze.RECORD=Ze.TABLE;Mt.RECORD=Mt.TABLE;Ze.LITERAL=function(n){return n};Mt.LITERAL=function(n){return n.length};function Vi(n,e,t){if(e.length&&(e[0].name!=="coverageFormat"||e[0].value===1))for(var i=0;i<e.length;i+=1){var r=e[i];this[r.name]=r.value}if(this.tableName=n,this.fields=e,t)for(var s=Object.keys(t),a=0;a<s.length;a+=1){var o=s[a],l=t[o];this[o]!==void 0&&(this[o]=l)}}Vi.prototype.encode=function(){return Ze.TABLE(this)};Vi.prototype.sizeOf=function(){return Mt.TABLE(this)};function $p(n,e,t){t===void 0&&(t=e.length);var i=new Array(e.length+1);i[0]={name:n+"Count",type:"USHORT",value:t};for(var r=0;r<e.length;r++)i[r+1]={name:n+r,type:"USHORT",value:e[r]};return i}function Hy(n,e,t){var i=e.length,r=new Array(i+1);r[0]={name:n+"Count",type:"USHORT",value:i};for(var s=0;s<i;s++)r[s+1]={name:n+s,type:"TABLE",value:t(e[s],s)};return r}function Jp(n,e,t){var i=e.length,r=[];r[0]={name:n+"Count",type:"USHORT",value:i};for(var s=0;s<i;s++)r=r.concat(t(e[s],s));return r}function s2(n){n.format===1?Vi.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat($p("glyph",n.glyphs))):n.format===2?Vi.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(Jp("rangeRecord",n.ranges,function(e){return[{name:"startGlyphID",type:"USHORT",value:e.start},{name:"endGlyphID",type:"USHORT",value:e.end},{name:"startCoverageIndex",type:"USHORT",value:e.index}]}))):Lt.assert(!1,"Coverage format must be 1 or 2.")}s2.prototype=Object.create(Vi.prototype);s2.prototype.constructor=s2;function a2(n){Vi.call(this,"scriptListTable",Jp("scriptRecord",n,function(e,t){var i=e.script,r=i.defaultLangSys;return Lt.assert(!!r,"Unable to write GSUB: script "+e.tag+" has no default language system."),[{name:"scriptTag"+t,type:"TAG",value:e.tag},{name:"script"+t,type:"TABLE",value:new Vi("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new Vi("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:r.reqFeatureIndex}].concat($p("featureIndex",r.featureIndexes)))}].concat(Jp("langSys",i.langSysRecords,function(s,a){var o=s.langSys;return[{name:"langSysTag"+a,type:"TAG",value:s.tag},{name:"langSys"+a,type:"TABLE",value:new Vi("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:o.reqFeatureIndex}].concat($p("featureIndex",o.featureIndexes)))}]})))}]}))}a2.prototype=Object.create(Vi.prototype);a2.prototype.constructor=a2;function o2(n){Vi.call(this,"featureListTable",Jp("featureRecord",n,function(e,t){var i=e.feature;return[{name:"featureTag"+t,type:"TAG",value:e.tag},{name:"feature"+t,type:"TABLE",value:new Vi("featureTable",[{name:"featureParams",type:"USHORT",value:i.featureParams}].concat($p("lookupListIndex",i.lookupListIndexes)))}]}))}o2.prototype=Object.create(Vi.prototype);o2.prototype.constructor=o2;function l2(n,e){Vi.call(this,"lookupListTable",Hy("lookup",n,function(t){var i=e[t.lookupType];return Lt.assert(!!i,"Unable to write GSUB lookup type "+t.lookupType+" tables."),new Vi("lookupTable",[{name:"lookupType",type:"USHORT",value:t.lookupType},{name:"lookupFlag",type:"USHORT",value:t.lookupFlag}].concat(Hy("subtable",t.subtables,i)))}))}l2.prototype=Object.create(Vi.prototype);l2.prototype.constructor=l2;var lt={Table:Vi,Record:Vi,Coverage:s2,ScriptList:a2,FeatureList:o2,LookupList:l2,ushortList:$p,tableList:Hy,recordList:Jp};function IS(n,e){return n.getUint8(e)}function c2(n,e){return n.getUint16(e,!1)}function SK(n,e){return n.getInt16(e,!1)}function a8(n,e){return n.getUint32(e,!1)}function XM(n,e){var t=n.getInt16(e,!1),i=n.getUint16(e+2,!1);return t+i/65535}function wK(n,e){for(var t="",i=e;i<e+4;i+=1)t+=String.fromCharCode(n.getInt8(i));return t}function CK(n,e,t){for(var i=0,r=0;r<t;r+=1)i<<=8,i+=n.getUint8(e+r);return i}function TK(n,e,t){for(var i=[],r=e;r<t;r+=1)i.push(n.getUint8(r));return i}function bK(n){for(var e="",t=0;t<n.length;t+=1)e+=String.fromCharCode(n[t]);return e}var IK={byte:1,uShort:2,short:2,uLong:4,fixed:4,longDateTime:8,tag:4};function Te(n,e){this.data=n,this.offset=e,this.relativeOffset=0}Te.prototype.parseByte=function(){var n=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,n};Te.prototype.parseChar=function(){var n=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,n};Te.prototype.parseCard8=Te.prototype.parseByte;Te.prototype.parseUShort=function(){var n=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,n};Te.prototype.parseCard16=Te.prototype.parseUShort;Te.prototype.parseSID=Te.prototype.parseUShort;Te.prototype.parseOffset16=Te.prototype.parseUShort;Te.prototype.parseShort=function(){var n=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,n};Te.prototype.parseF2Dot14=function(){var n=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,n};Te.prototype.parseULong=function(){var n=a8(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,n};Te.prototype.parseOffset32=Te.prototype.parseULong;Te.prototype.parseFixed=function(){var n=XM(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,n};Te.prototype.parseString=function(n){var e=this.data,t=this.offset+this.relativeOffset,i="";this.relativeOffset+=n;for(var r=0;r<n;r++)i+=String.fromCharCode(e.getUint8(t+r));return i};Te.prototype.parseTag=function(){return this.parseString(4)};Te.prototype.parseLongDateTime=function(){var n=a8(this.data,this.offset+this.relativeOffset+4);return n-=2082844800,this.relativeOffset+=8,n};Te.prototype.parseVersion=function(n){var e=c2(this.data,this.offset+this.relativeOffset),t=c2(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,n===void 0&&(n=4096),e+t/n/10};Te.prototype.skip=function(n,e){e===void 0&&(e=1),this.relativeOffset+=IK[n]*e};Te.prototype.parseULongList=function(n){n===void 0&&(n=this.parseULong());for(var e=new Array(n),t=this.data,i=this.offset+this.relativeOffset,r=0;r<n;r++)e[r]=t.getUint32(i),i+=4;return this.relativeOffset+=n*4,e};Te.prototype.parseOffset16List=Te.prototype.parseUShortList=function(n){n===void 0&&(n=this.parseUShort());for(var e=new Array(n),t=this.data,i=this.offset+this.relativeOffset,r=0;r<n;r++)e[r]=t.getUint16(i),i+=2;return this.relativeOffset+=n*2,e};Te.prototype.parseShortList=function(n){for(var e=new Array(n),t=this.data,i=this.offset+this.relativeOffset,r=0;r<n;r++)e[r]=t.getInt16(i),i+=2;return this.relativeOffset+=n*2,e};Te.prototype.parseByteList=function(n){for(var e=new Array(n),t=this.data,i=this.offset+this.relativeOffset,r=0;r<n;r++)e[r]=t.getUint8(i++);return this.relativeOffset+=n,e};Te.prototype.parseList=function(n,e){e||(e=n,n=this.parseUShort());for(var t=new Array(n),i=0;i<n;i++)t[i]=e.call(this);return t};Te.prototype.parseList32=function(n,e){e||(e=n,n=this.parseULong());for(var t=new Array(n),i=0;i<n;i++)t[i]=e.call(this);return t};Te.prototype.parseRecordList=function(n,e){e||(e=n,n=this.parseUShort());for(var t=new Array(n),i=Object.keys(e),r=0;r<n;r++){for(var s={},a=0;a<i.length;a++){var o=i[a],l=e[o];s[o]=l.call(this)}t[r]=s}return t};Te.prototype.parseRecordList32=function(n,e){e||(e=n,n=this.parseULong());for(var t=new Array(n),i=Object.keys(e),r=0;r<n;r++){for(var s={},a=0;a<i.length;a++){var o=i[a],l=e[o];s[o]=l.call(this)}t[r]=s}return t};Te.prototype.parseStruct=function(n){if(typeof n=="function")return n.call(this);for(var e=Object.keys(n),t={},i=0;i<e.length;i++){var r=e[i],s=n[r];t[r]=s.call(this)}return t};Te.prototype.parseValueRecord=function(n){if(n===void 0&&(n=this.parseUShort()),n!==0){var e={};return n&1&&(e.xPlacement=this.parseShort()),n&2&&(e.yPlacement=this.parseShort()),n&4&&(e.xAdvance=this.parseShort()),n&8&&(e.yAdvance=this.parseShort()),n&16&&(e.xPlaDevice=void 0,this.parseShort()),n&32&&(e.yPlaDevice=void 0,this.parseShort()),n&64&&(e.xAdvDevice=void 0,this.parseShort()),n&128&&(e.yAdvDevice=void 0,this.parseShort()),e}};Te.prototype.parseValueRecordList=function(){for(var n=this.parseUShort(),e=this.parseUShort(),t=new Array(e),i=0;i<e;i++)t[i]=this.parseValueRecord(n);return t};Te.prototype.parsePointer=function(n){var e=this.parseOffset16();if(e>0)return new Te(this.data,this.offset+e).parseStruct(n)};Te.prototype.parsePointer32=function(n){var e=this.parseOffset32();if(e>0)return new Te(this.data,this.offset+e).parseStruct(n)};Te.prototype.parseListOfLists=function(n){for(var e=this.parseOffset16List(),t=e.length,i=this.relativeOffset,r=new Array(t),s=0;s<t;s++){var a=e[s];if(a===0){r[s]=void 0;continue}if(this.relativeOffset=a,n){for(var o=this.parseOffset16List(),l=new Array(o.length),c=0;c<o.length;c++)this.relativeOffset=a+o[c],l[c]=n.call(this);r[s]=l}else r[s]=this.parseUShortList()}return this.relativeOffset=i,r};Te.prototype.parseCoverage=function(){var n=this.offset+this.relativeOffset,e=this.parseUShort(),t=this.parseUShort();if(e===1)return{format:1,glyphs:this.parseUShortList(t)};if(e===2){for(var i=new Array(t),r=0;r<t;r++)i[r]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:i}}throw new Error("0x"+n.toString(16)+": Coverage format must be 1 or 2.")};Te.prototype.parseClassDef=function(){var n=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()};if(e===2)return{format:2,ranges:this.parseRecordList({start:Te.uShort,end:Te.uShort,classId:Te.uShort})};throw new Error("0x"+n.toString(16)+": ClassDef format must be 1 or 2.")};Te.list=function(n,e){return function(){return this.parseList(n,e)}};Te.list32=function(n,e){return function(){return this.parseList32(n,e)}};Te.recordList=function(n,e){return function(){return this.parseRecordList(n,e)}};Te.recordList32=function(n,e){return function(){return this.parseRecordList32(n,e)}};Te.pointer=function(n){return function(){return this.parsePointer(n)}};Te.pointer32=function(n){return function(){return this.parsePointer32(n)}};Te.tag=Te.prototype.parseTag;Te.byte=Te.prototype.parseByte;Te.uShort=Te.offset16=Te.prototype.parseUShort;Te.uShortList=Te.prototype.parseUShortList;Te.uLong=Te.offset32=Te.prototype.parseULong;Te.uLongList=Te.prototype.parseULongList;Te.struct=Te.prototype.parseStruct;Te.coverage=Te.prototype.parseCoverage;Te.classDef=Te.prototype.parseClassDef;var MS={reserved:Te.uShort,reqFeatureIndex:Te.uShort,featureIndexes:Te.uShortList};Te.prototype.parseScriptList=function(){return this.parsePointer(Te.recordList({tag:Te.tag,script:Te.pointer({defaultLangSys:Te.pointer(MS),langSysRecords:Te.recordList({tag:Te.tag,langSys:Te.pointer(MS)})})}))||[]};Te.prototype.parseFeatureList=function(){return this.parsePointer(Te.recordList({tag:Te.tag,feature:Te.pointer({featureParams:Te.offset16,lookupListIndexes:Te.uShortList})}))||[]};Te.prototype.parseLookupList=function(n){return this.parsePointer(Te.list(Te.pointer(function(){var e=this.parseUShort();Lt.argument(1<=e&&e<=9,"GPOS/GSUB lookup type "+e+" unknown.");var t=this.parseUShort(),i=t&16;return{lookupType:e,lookupFlag:t,subtables:this.parseList(Te.pointer(n[e])),markFilteringSet:i?this.parseUShort():void 0}})))||[]};Te.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){var n=this.parseUShort(),e=this.parseUShort();Lt.argument(n===1&&e<1,"GPOS/GSUB feature variations table unknown.");var t=this.parseRecordList32({conditionSetOffset:Te.offset32,featureTableSubstitutionOffset:Te.offset32});return t})||[]};var Gt={getByte:IS,getCard8:IS,getUShort:c2,getCard16:c2,getShort:SK,getULong:a8,getFixed:XM,getTag:wK,getOffset:CK,getBytes:TK,bytesToString:bK,Parser:Te};function MK(n,e){e.parseUShort(),n.length=e.parseULong(),n.language=e.parseULong();var t;n.groupCount=t=e.parseULong(),n.glyphIndexMap={};for(var i=0;i<t;i+=1)for(var r=e.parseULong(),s=e.parseULong(),a=e.parseULong(),o=r;o<=s;o+=1)n.glyphIndexMap[o]=a,a++}function RK(n,e,t,i,r){n.length=e.parseUShort(),n.language=e.parseUShort();var s;n.segCount=s=e.parseUShort()>>1,e.skip("uShort",3),n.glyphIndexMap={};for(var a=new Gt.Parser(t,i+r+14),o=new Gt.Parser(t,i+r+16+s*2),l=new Gt.Parser(t,i+r+16+s*4),c=new Gt.Parser(t,i+r+16+s*6),u=i+r+16+s*8,h=0;h<s-1;h+=1)for(var f=void 0,p=a.parseUShort(),m=o.parseUShort(),y=l.parseShort(),v=c.parseUShort(),A=m;A<=p;A+=1)v!==0?(u=c.offset+c.relativeOffset-2,u+=v,u+=(A-m)*2,f=Gt.getUShort(t,u),f!==0&&(f=f+y&65535)):f=A+y&65535,n.glyphIndexMap[A]=f}function BK(n,e){var t={};t.version=Gt.getUShort(n,e),Lt.argument(t.version===0,"cmap table version should be 0."),t.numTables=Gt.getUShort(n,e+2);for(var i=-1,r=t.numTables-1;r>=0;r-=1){var s=Gt.getUShort(n,e+4+r*8),a=Gt.getUShort(n,e+4+r*8+2);if(s===3&&(a===0||a===1||a===10)||s===0&&(a===0||a===1||a===2||a===3||a===4)){i=Gt.getULong(n,e+4+r*8+4);break}}if(i===-1)throw new Error("No valid cmap sub-tables found.");var o=new Gt.Parser(n,e+i);if(t.format=o.parseUShort(),t.format===12)MK(t,o);else if(t.format===4)RK(t,o,n,e,i);else throw new Error("Only format 4 and 12 cmap tables are supported (found format "+t.format+").");return t}function DK(n,e,t){n.segments.push({end:e,start:e,delta:-(e-t),offset:0,glyphIndex:t})}function PK(n){n.segments.push({end:65535,start:65535,delta:1,offset:0})}function LK(n){var e=!0,t;for(t=n.length-1;t>0;t-=1){var i=n.get(t);if(i.unicode>65535){console.log("Adding CMAP format 12 (needed!)"),e=!1;break}}var r=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:e?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:e?12:12+8}];e||(r=r.concat([{name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}])),r=r.concat([{name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);var s=new lt.Table("cmap",r);for(s.segments=[],t=0;t<n.length;t+=1){for(var a=n.get(t),o=0;o<a.unicodes.length;o+=1)DK(s,a.unicodes[o],t);s.segments=s.segments.sort(function(_,x){return _.start-x.start})}PK(s);var l=s.segments.length,c=0,u=[],h=[],f=[],p=[],m=[],y=[];for(t=0;t<l;t+=1){var v=s.segments[t];v.end<=65535&&v.start<=65535?(u=u.concat({name:"end_"+t,type:"USHORT",value:v.end}),h=h.concat({name:"start_"+t,type:"USHORT",value:v.start}),f=f.concat({name:"idDelta_"+t,type:"SHORT",value:v.delta}),p=p.concat({name:"idRangeOffset_"+t,type:"USHORT",value:v.offset}),v.glyphId!==void 0&&(m=m.concat({name:"glyph_"+t,type:"USHORT",value:v.glyphId}))):c+=1,!e&&v.glyphIndex!==void 0&&(y=y.concat({name:"cmap12Start_"+t,type:"ULONG",value:v.start}),y=y.concat({name:"cmap12End_"+t,type:"ULONG",value:v.end}),y=y.concat({name:"cmap12Glyph_"+t,type:"ULONG",value:v.glyphIndex}))}if(s.segCountX2=(l-c)*2,s.searchRange=Math.pow(2,Math.floor(Math.log(l-c)/Math.log(2)))*2,s.entrySelector=Math.log(s.searchRange/2)/Math.log(2),s.rangeShift=s.segCountX2-s.searchRange,s.fields=s.fields.concat(u),s.fields.push({name:"reservedPad",type:"USHORT",value:0}),s.fields=s.fields.concat(h),s.fields=s.fields.concat(f),s.fields=s.fields.concat(p),s.fields=s.fields.concat(m),s.cmap4Length=14+u.length*2+2+h.length*2+f.length*2+p.length*2+m.length*2,!e){var A=16+y.length*4;s.cmap12Offset=12+2*2+4+s.cmap4Length,s.fields=s.fields.concat([{name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:A},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:y.length/3}]),s.fields=s.fields.concat(y)}return s}var UK={parse:BK,make:LK},ym=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],OK=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],FK=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],RS=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function jM(n){this.font=n}jM.prototype.charToGlyphIndex=function(n){var e=n.codePointAt(0),t=this.font.glyphs;if(t){for(var i=0;i<t.length;i+=1)for(var r=t.get(i),s=0;s<r.unicodes.length;s+=1)if(r.unicodes[s]===e)return i}return null};function u2(n,e){this.encoding=n,this.charset=e}u2.prototype.charToGlyphIndex=function(n){var e=n.codePointAt(0),t=this.encoding[e];return this.charset.indexOf(t)};function kK(n,e,t,i,r){n.beginPath(),n.moveTo(e,t),n.lineTo(i,r),n.stroke()}var Ic={line:kK};function NK(n,e){var t=e||new Li;return{configurable:!0,get:function(){return typeof t=="function"&&(t=t()),t},set:function(i){t=i}}}function Xs(n){this.bindConstructorValues(n)}Xs.prototype.bindConstructorValues=function(n){this.index=n.index||0,this.name=n.name||null,this.unicode=n.unicode||void 0,this.unicodes=n.unicodes||n.unicode!==void 0?[n.unicode]:[],"xMin"in n&&(this.xMin=n.xMin),"yMin"in n&&(this.yMin=n.yMin),"xMax"in n&&(this.xMax=n.xMax),"yMax"in n&&(this.yMax=n.yMax),"advanceWidth"in n&&(this.advanceWidth=n.advanceWidth),Object.defineProperty(this,"path",NK(this,n.path))};Xs.prototype.addUnicode=function(n){this.unicodes.length===0&&(this.unicode=n),this.unicodes.push(n)};Xs.prototype.getBoundingBox=function(){return this.path.getBoundingBox()};Xs.prototype.getPath=function(n,e,t,i,r){n=n!==void 0?n:0,e=e!==void 0?e:0,t=t!==void 0?t:72;var s,a;i||(i={});var o=i.xScale,l=i.yScale;if(i.hinting&&r&&r.hinting&&(a=this.path&&r.hinting.exec(this,t)),a)s=r.hinting.getCommands(a),n=Math.round(n),e=Math.round(e),o=l=1;else{s=this.path.commands;var c=1/(this.path.unitsPerEm||1e3)*t;o===void 0&&(o=c),l===void 0&&(l=c)}for(var u=new Li,h=0;h<s.length;h+=1){var f=s[h];f.type==="M"?u.moveTo(n+f.x*o,e+-f.y*l):f.type==="L"?u.lineTo(n+f.x*o,e+-f.y*l):f.type==="Q"?u.quadraticCurveTo(n+f.x1*o,e+-f.y1*l,n+f.x*o,e+-f.y*l):f.type==="C"?u.curveTo(n+f.x1*o,e+-f.y1*l,n+f.x2*o,e+-f.y2*l,n+f.x*o,e+-f.y*l):f.type==="Z"&&u.closePath()}return u};Xs.prototype.getContours=function(){if(this.points===void 0)return[];for(var n=[],e=[],t=0;t<this.points.length;t+=1){var i=this.points[t];e.push(i),i.lastPointOfContour&&(n.push(e),e=[])}return Lt.argument(e.length===0,"There are still points left in the current contour."),n};Xs.prototype.getMetrics=function(){for(var n=this.path.commands,e=[],t=[],i=0;i<n.length;i+=1){var r=n[i];r.type!=="Z"&&(e.push(r.x),t.push(r.y)),(r.type==="Q"||r.type==="C")&&(e.push(r.x1),t.push(r.y1)),r.type==="C"&&(e.push(r.x2),t.push(r.y2))}var s={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,t),xMax:Math.max.apply(null,e),yMax:Math.max.apply(null,t),leftSideBearing:this.leftSideBearing};return isFinite(s.xMin)||(s.xMin=0),isFinite(s.xMax)||(s.xMax=this.advanceWidth),isFinite(s.yMin)||(s.yMin=0),isFinite(s.yMax)||(s.yMax=0),s.rightSideBearing=this.advanceWidth-s.leftSideBearing-(s.xMax-s.xMin),s};Xs.prototype.draw=function(n,e,t,i,r){this.getPath(e,t,i,r).draw(n)};Xs.prototype.drawPoints=function(n,e,t,i){function r(h,f,p,m){n.beginPath();for(var y=0;y<h.length;y+=1)n.moveTo(f+h[y].x*m,p+h[y].y*m),n.arc(f+h[y].x*m,p+h[y].y*m,2,0,Math.PI*2,!1);n.closePath(),n.fill()}e=e!==void 0?e:0,t=t!==void 0?t:0,i=i!==void 0?i:24;for(var s=1/this.path.unitsPerEm*i,a=[],o=[],l=this.path,c=0;c<l.commands.length;c+=1){var u=l.commands[c];u.x!==void 0&&a.push({x:u.x,y:-u.y}),u.x1!==void 0&&o.push({x:u.x1,y:-u.y1}),u.x2!==void 0&&o.push({x:u.x2,y:-u.y2})}n.fillStyle="blue",r(a,e,t,s),n.fillStyle="red",r(o,e,t,s)};Xs.prototype.drawMetrics=function(n,e,t,i){var r;e=e!==void 0?e:0,t=t!==void 0?t:0,i=i!==void 0?i:24,r=1/this.path.unitsPerEm*i,n.lineWidth=1,n.strokeStyle="black",Ic.line(n,e,-1e4,e,1e4),Ic.line(n,-1e4,t,1e4,t);var s=this.xMin||0,a=this.yMin||0,o=this.xMax||0,l=this.yMax||0,c=this.advanceWidth||0;n.strokeStyle="blue",Ic.line(n,e+s*r,-1e4,e+s*r,1e4),Ic.line(n,e+o*r,-1e4,e+o*r,1e4),Ic.line(n,-1e4,t+-a*r,1e4,t+-a*r),Ic.line(n,-1e4,t+-l*r,1e4,t+-l*r),n.strokeStyle="green",Ic.line(n,e+c*r,-1e4,e+c*r,1e4)};function Qg(n,e,t){Object.defineProperty(n,e,{get:function(){return n.path,n[t]},set:function(i){n[t]=i},enumerable:!0,configurable:!0})}function o8(n,e){if(this.font=n,this.glyphs={},Array.isArray(e))for(var t=0;t<e.length;t++){var i=e[t];i.path.unitsPerEm=n.unitsPerEm,this.glyphs[t]=i}this.length=e&&e.length||0}o8.prototype.get=function(n){if(this.glyphs[n]===void 0){this.font._push(n),typeof this.glyphs[n]=="function"&&(this.glyphs[n]=this.glyphs[n]());var e=this.glyphs[n],t=this.font._IndexToUnicodeMap[n];if(t)for(var i=0;i<t.unicodes.length;i++)e.addUnicode(t.unicodes[i]);this.font.cffEncoding?this.font.isCIDFont?e.name="gid"+n:e.name=this.font.cffEncoding.charset[n]:this.font.glyphNames.names&&(e.name=this.font.glyphNames.glyphIndexToName(n)),this.glyphs[n].advanceWidth=this.font._hmtxTableData[n].advanceWidth,this.glyphs[n].leftSideBearing=this.font._hmtxTableData[n].leftSideBearing}else typeof this.glyphs[n]=="function"&&(this.glyphs[n]=this.glyphs[n]());return this.glyphs[n]};o8.prototype.push=function(n,e){this.glyphs[n]=e,this.length++};function GK(n,e){return new Xs({index:e,font:n})}function zK(n,e,t,i,r,s){return function(){var a=new Xs({index:e,font:n});return a.path=function(){t(a,i,r);var o=s(n.glyphs,a);return o.unitsPerEm=n.unitsPerEm,o},Qg(a,"xMin","_xMin"),Qg(a,"xMax","_xMax"),Qg(a,"yMin","_yMin"),Qg(a,"yMax","_yMax"),a}}function QK(n,e,t,i){return function(){var r=new Xs({index:e,font:n});return r.path=function(){var s=t(n,r,i);return s.unitsPerEm=n.unitsPerEm,s},r}}var Xa={GlyphSet:o8,glyphLoader:GK,ttfGlyphLoader:zK,cffGlyphLoader:QK};function KM(n,e){if(n===e)return!0;if(Array.isArray(n)&&Array.isArray(e)){if(n.length!==e.length)return!1;for(var t=0;t<n.length;t+=1)if(!KM(n[t],e[t]))return!1;return!0}else return!1}function Vy(n){var e;return n.length<1240?e=107:n.length<33900?e=1131:e=32768,e}function wl(n,e,t){var i=[],r=[],s=Gt.getCard16(n,e),a,o;if(s!==0){var l=Gt.getByte(n,e+2);a=e+(s+1)*l+2;for(var c=e+3,u=0;u<s+1;u+=1)i.push(Gt.getOffset(n,c,l)),c+=l;o=a+i[s]}else o=e+2;for(var h=0;h<i.length-1;h+=1){var f=Gt.getBytes(n,a+i[h],a+i[h+1]);t&&(f=t(f)),r.push(f)}return{objects:r,startOffset:e,endOffset:o}}function HK(n,e){var t=[],i=Gt.getCard16(n,e),r,s;if(i!==0){var a=Gt.getByte(n,e+2);r=e+(i+1)*a+2;for(var o=e+3,l=0;l<i+1;l+=1)t.push(Gt.getOffset(n,o,a)),o+=a;s=r+t[i]}else s=e+2;return{offsets:t,startOffset:e,endOffset:s}}function VK(n,e,t,i,r){var s=Gt.getCard16(t,i),a=0;if(s!==0){var o=Gt.getByte(t,i+2);a=i+(s+1)*o+2}var l=Gt.getBytes(t,a+e[n],a+e[n+1]);return r&&(l=r(l)),l}function WK(n){for(var e="",t=15,i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];;){var r=n.parseByte(),s=r>>4,a=r&15;if(s===t||(e+=i[s],a===t))break;e+=i[a]}return parseFloat(e)}function YK(n,e){var t,i,r,s;if(e===28)return t=n.parseByte(),i=n.parseByte(),t<<8|i;if(e===29)return t=n.parseByte(),i=n.parseByte(),r=n.parseByte(),s=n.parseByte(),t<<24|i<<16|r<<8|s;if(e===30)return WK(n);if(e>=32&&e<=246)return e-139;if(e>=247&&e<=250)return t=n.parseByte(),(e-247)*256+t+108;if(e>=251&&e<=254)return t=n.parseByte(),-(e-251)*256-t-108;throw new Error("Invalid b0 "+e)}function qK(n){for(var e={},t=0;t<n.length;t+=1){var i=n[t][0],r=n[t][1],s=void 0;if(r.length===1?s=r[0]:s=r,e.hasOwnProperty(i)&&!isNaN(e[i]))throw new Error("Object "+e+" already has key "+i);e[i]=s}return e}function $M(n,e,t){e=e!==void 0?e:0;var i=new Gt.Parser(n,e),r=[],s=[];for(t=t!==void 0?t:n.length;i.relativeOffset<t;){var a=i.parseByte();a<=21?(a===12&&(a=1200+i.parseByte()),r.push([a,s]),s=[]):s.push(YK(i,a))}return qK(r)}function ap(n,e){return e<=390?e=ym[e]:e=n[e-391],e}function JM(n,e,t){for(var i={},r,s=0;s<e.length;s+=1){var a=e[s];if(Array.isArray(a.type)){var o=[];o.length=a.type.length;for(var l=0;l<a.type.length;l++)r=n[a.op]!==void 0?n[a.op][l]:void 0,r===void 0&&(r=a.value!==void 0&&a.value[l]!==void 0?a.value[l]:null),a.type[l]==="SID"&&(r=ap(t,r)),o[l]=r;i[a.name]=o}else r=n[a.op],r===void 0&&(r=a.value!==void 0?a.value:null),a.type==="SID"&&(r=ap(t,r)),i[a.name]=r}return i}function XK(n,e){var t={};return t.formatMajor=Gt.getCard8(n,e),t.formatMinor=Gt.getCard8(n,e+1),t.size=Gt.getCard8(n,e+2),t.offsetSize=Gt.getCard8(n,e+3),t.startOffset=e,t.endOffset=e+4,t}var ZM=[{name:"version",op:0,type:"SID"},{name:"notice",op:1,type:"SID"},{name:"copyright",op:1200,type:"SID"},{name:"fullName",op:2,type:"SID"},{name:"familyName",op:3,type:"SID"},{name:"weight",op:4,type:"SID"},{name:"isFixedPitch",op:1201,type:"number",value:0},{name:"italicAngle",op:1202,type:"number",value:0},{name:"underlinePosition",op:1203,type:"number",value:-100},{name:"underlineThickness",op:1204,type:"number",value:50},{name:"paintType",op:1205,type:"number",value:0},{name:"charstringType",op:1206,type:"number",value:2},{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"uniqueId",op:13,type:"number"},{name:"fontBBox",op:5,type:["number","number","number","number"],value:[0,0,0,0]},{name:"strokeWidth",op:1208,type:"number",value:0},{name:"xuid",op:14,type:[],value:null},{name:"charset",op:15,type:"offset",value:0},{name:"encoding",op:16,type:"offset",value:0},{name:"charStrings",op:17,type:"offset",value:0},{name:"private",op:18,type:["number","offset"],value:[0,0]},{name:"ros",op:1230,type:["SID","SID","number"]},{name:"cidFontVersion",op:1231,type:"number",value:0},{name:"cidFontRevision",op:1232,type:"number",value:0},{name:"cidFontType",op:1233,type:"number",value:0},{name:"cidCount",op:1234,type:"number",value:8720},{name:"uidBase",op:1235,type:"number"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"fontName",op:1238,type:"SID"}],eR=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}];function jK(n,e){var t=$M(n,0,n.byteLength);return JM(t,ZM,e)}function tR(n,e,t,i){var r=$M(n,e,t);return JM(r,eR,i)}function BS(n,e,t,i){for(var r=[],s=0;s<t.length;s+=1){var a=new DataView(new Uint8Array(t[s]).buffer),o=jK(a,i);o._subrs=[],o._subrsBias=0,o._defaultWidthX=0,o._nominalWidthX=0;var l=o.private[0],c=o.private[1];if(l!==0&&c!==0){var u=tR(n,c+e,l,i);if(o._defaultWidthX=u.defaultWidthX,o._nominalWidthX=u.nominalWidthX,u.subrs!==0){var h=c+u.subrs,f=wl(n,h+e);o._subrs=f.objects,o._subrsBias=Vy(o._subrs)}o._privateDict=u}r.push(o)}return r}function KK(n,e,t,i){var r,s,a=new Gt.Parser(n,e);t-=1;var o=[".notdef"],l=a.parseCard8();if(l===0)for(var c=0;c<t;c+=1)r=a.parseSID(),o.push(ap(i,r));else if(l===1)for(;o.length<=t;){r=a.parseSID(),s=a.parseCard8();for(var u=0;u<=s;u+=1)o.push(ap(i,r)),r+=1}else if(l===2)for(;o.length<=t;){r=a.parseSID(),s=a.parseCard16();for(var h=0;h<=s;h+=1)o.push(ap(i,r)),r+=1}else throw new Error("Unknown charset format "+l);return o}function $K(n,e,t){var i,r={},s=new Gt.Parser(n,e),a=s.parseCard8();if(a===0)for(var o=s.parseCard8(),l=0;l<o;l+=1)i=s.parseCard8(),r[i]=l;else if(a===1){var c=s.parseCard8();i=1;for(var u=0;u<c;u+=1)for(var h=s.parseCard8(),f=s.parseCard8(),p=h;p<=h+f;p+=1)r[p]=i,i+=1}else throw new Error("Unknown encoding format "+a);return new u2(r,t)}function DS(n,e,t){var i,r,s,a,o=new Li,l=[],c=0,u=!1,h=!1,f=0,p=0,m,y,v,A;if(n.isCIDFont){var _=n.tables.cff.topDict._fdSelect[e.index],x=n.tables.cff.topDict._fdArray[_];m=x._subrs,y=x._subrsBias,v=x._defaultWidthX,A=x._nominalWidthX}else m=n.tables.cff.topDict._subrs,y=n.tables.cff.topDict._subrsBias,v=n.tables.cff.topDict._defaultWidthX,A=n.tables.cff.topDict._nominalWidthX;var E=v;function w(M,b){h&&o.closePath(),o.moveTo(M,b),h=!0}function I(){var M;M=l.length%2!==0,M&&!u&&(E=l.shift()+A),c+=l.length>>1,l.length=0,u=!0}function T(M){for(var b,B,L,U,O,Q,G,F,q,Y,H,V,D=0;D<M.length;){var k=M[D];switch(D+=1,k){case 1:I();break;case 3:I();break;case 4:l.length>1&&!u&&(E=l.shift()+A,u=!0),p+=l.pop(),w(f,p);break;case 5:for(;l.length>0;)f+=l.shift(),p+=l.shift(),o.lineTo(f,p);break;case 6:for(;l.length>0&&(f+=l.shift(),o.lineTo(f,p),l.length!==0);)p+=l.shift(),o.lineTo(f,p);break;case 7:for(;l.length>0&&(p+=l.shift(),o.lineTo(f,p),l.length!==0);)f+=l.shift(),o.lineTo(f,p);break;case 8:for(;l.length>0;)i=f+l.shift(),r=p+l.shift(),s=i+l.shift(),a=r+l.shift(),f=s+l.shift(),p=a+l.shift(),o.curveTo(i,r,s,a,f,p);break;case 10:O=l.pop()+y,Q=m[O],Q&&T(Q);break;case 11:return;case 12:switch(k=M[D],D+=1,k){case 35:i=f+l.shift(),r=p+l.shift(),s=i+l.shift(),a=r+l.shift(),G=s+l.shift(),F=a+l.shift(),q=G+l.shift(),Y=F+l.shift(),H=q+l.shift(),V=Y+l.shift(),f=H+l.shift(),p=V+l.shift(),l.shift(),o.curveTo(i,r,s,a,G,F),o.curveTo(q,Y,H,V,f,p);break;case 34:i=f+l.shift(),r=p,s=i+l.shift(),a=r+l.shift(),G=s+l.shift(),F=a,q=G+l.shift(),Y=a,H=q+l.shift(),V=p,f=H+l.shift(),o.curveTo(i,r,s,a,G,F),o.curveTo(q,Y,H,V,f,p);break;case 36:i=f+l.shift(),r=p+l.shift(),s=i+l.shift(),a=r+l.shift(),G=s+l.shift(),F=a,q=G+l.shift(),Y=a,H=q+l.shift(),V=Y+l.shift(),f=H+l.shift(),o.curveTo(i,r,s,a,G,F),o.curveTo(q,Y,H,V,f,p);break;case 37:i=f+l.shift(),r=p+l.shift(),s=i+l.shift(),a=r+l.shift(),G=s+l.shift(),F=a+l.shift(),q=G+l.shift(),Y=F+l.shift(),H=q+l.shift(),V=Y+l.shift(),Math.abs(H-f)>Math.abs(V-p)?f=H+l.shift():p=V+l.shift(),o.curveTo(i,r,s,a,G,F),o.curveTo(q,Y,H,V,f,p);break;default:console.log("Glyph "+e.index+": unknown operator 1200"+k),l.length=0}break;case 14:l.length>0&&!u&&(E=l.shift()+A,u=!0),h&&(o.closePath(),h=!1);break;case 18:I();break;case 19:case 20:I(),D+=c+7>>3;break;case 21:l.length>2&&!u&&(E=l.shift()+A,u=!0),p+=l.pop(),f+=l.pop(),w(f,p);break;case 22:l.length>1&&!u&&(E=l.shift()+A,u=!0),f+=l.pop(),w(f,p);break;case 23:I();break;case 24:for(;l.length>2;)i=f+l.shift(),r=p+l.shift(),s=i+l.shift(),a=r+l.shift(),f=s+l.shift(),p=a+l.shift(),o.curveTo(i,r,s,a,f,p);f+=l.shift(),p+=l.shift(),o.lineTo(f,p);break;case 25:for(;l.length>6;)f+=l.shift(),p+=l.shift(),o.lineTo(f,p);i=f+l.shift(),r=p+l.shift(),s=i+l.shift(),a=r+l.shift(),f=s+l.shift(),p=a+l.shift(),o.curveTo(i,r,s,a,f,p);break;case 26:for(l.length%2&&(f+=l.shift());l.length>0;)i=f,r=p+l.shift(),s=i+l.shift(),a=r+l.shift(),f=s,p=a+l.shift(),o.curveTo(i,r,s,a,f,p);break;case 27:for(l.length%2&&(p+=l.shift());l.length>0;)i=f+l.shift(),r=p,s=i+l.shift(),a=r+l.shift(),f=s+l.shift(),p=a,o.curveTo(i,r,s,a,f,p);break;case 28:b=M[D],B=M[D+1],l.push((b<<24|B<<16)>>16),D+=2;break;case 29:O=l.pop()+n.gsubrsBias,Q=n.gsubrs[O],Q&&T(Q);break;case 30:for(;l.length>0&&(i=f,r=p+l.shift(),s=i+l.shift(),a=r+l.shift(),f=s+l.shift(),p=a+(l.length===1?l.shift():0),o.curveTo(i,r,s,a,f,p),l.length!==0);)i=f+l.shift(),r=p,s=i+l.shift(),a=r+l.shift(),p=a+l.shift(),f=s+(l.length===1?l.shift():0),o.curveTo(i,r,s,a,f,p);break;case 31:for(;l.length>0&&(i=f+l.shift(),r=p,s=i+l.shift(),a=r+l.shift(),p=a+l.shift(),f=s+(l.length===1?l.shift():0),o.curveTo(i,r,s,a,f,p),l.length!==0);)i=f,r=p+l.shift(),s=i+l.shift(),a=r+l.shift(),f=s+l.shift(),p=a+(l.length===1?l.shift():0),o.curveTo(i,r,s,a,f,p);break;default:k<32?console.log("Glyph "+e.index+": unknown operator "+k):k<247?l.push(k-139):k<251?(b=M[D],D+=1,l.push((k-247)*256+b+108)):k<255?(b=M[D],D+=1,l.push(-(k-251)*256-b-108)):(b=M[D],B=M[D+1],L=M[D+2],U=M[D+3],D+=4,l.push((b<<24|B<<16|L<<8|U)/65536))}}}return T(t),e.advanceWidth=E,o}function JK(n,e,t,i){var r=[],s,a=new Gt.Parser(n,e),o=a.parseCard8();if(o===0)for(var l=0;l<t;l++){if(s=a.parseCard8(),s>=i)throw new Error("CFF table CID Font FDSelect has bad FD index value "+s+" (FD count "+i+")");r.push(s)}else if(o===3){var c=a.parseCard16(),u=a.parseCard16();if(u!==0)throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID "+u);for(var h,f=0;f<c;f++){if(s=a.parseCard8(),h=a.parseCard16(),s>=i)throw new Error("CFF table CID Font FDSelect has bad FD index value "+s+" (FD count "+i+")");if(h>t)throw new Error("CFF Table CID Font FDSelect format 3 range has bad GID "+h);for(;u<h;u++)r.push(s);u=h}if(h!==t)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final GID "+h)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+o);return r}function ZK(n,e,t,i){t.tables.cff={};var r=XK(n,e),s=wl(n,r.endOffset,Gt.bytesToString),a=wl(n,s.endOffset),o=wl(n,a.endOffset,Gt.bytesToString),l=wl(n,o.endOffset);t.gsubrs=l.objects,t.gsubrsBias=Vy(t.gsubrs);var c=BS(n,e,a.objects,o.objects);if(c.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+c.length);var u=c[0];if(t.tables.cff.topDict=u,u._privateDict&&(t.defaultWidthX=u._privateDict.defaultWidthX,t.nominalWidthX=u._privateDict.nominalWidthX),u.ros[0]!==void 0&&u.ros[1]!==void 0&&(t.isCIDFont=!0),t.isCIDFont){var h=u.fdArray,f=u.fdSelect;if(h===0||f===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");h+=e;var p=wl(n,h),m=BS(n,e,p.objects,o.objects);u._fdArray=m,f+=e,u._fdSelect=JK(n,f,t.numGlyphs,m.length)}var y=e+u.private[1],v=tR(n,y,u.private[0],o.objects);if(t.defaultWidthX=v.defaultWidthX,t.nominalWidthX=v.nominalWidthX,v.subrs!==0){var A=y+v.subrs,_=wl(n,A);t.subrs=_.objects,t.subrsBias=Vy(t.subrs)}else t.subrs=[],t.subrsBias=0;var x;i.lowMemory?(x=HK(n,e+u.charStrings),t.nGlyphs=x.offsets.length):(x=wl(n,e+u.charStrings),t.nGlyphs=x.objects.length);var E=KK(n,e+u.charset,t.nGlyphs,o.objects);if(u.encoding===0?t.cffEncoding=new u2(OK,E):u.encoding===1?t.cffEncoding=new u2(FK,E):t.cffEncoding=$K(n,e+u.encoding,E),t.encoding=t.encoding||t.cffEncoding,t.glyphs=new Xa.GlyphSet(t),i.lowMemory)t._push=function(T){var M=VK(T,x.offsets,n,e+u.charStrings);t.glyphs.push(T,Xa.cffGlyphLoader(t,T,DS,M))};else for(var w=0;w<t.nGlyphs;w+=1){var I=x.objects[w];t.glyphs.push(w,Xa.cffGlyphLoader(t,w,DS,I))}}function nR(n,e){var t,i=ym.indexOf(n);return i>=0&&(t=i),i=e.indexOf(n),i>=0?t=i+ym.length:(t=ym.length+e.length,e.push(n)),t}function e$(){return new lt.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function t$(n){var e=new lt.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);e.names=[];for(var t=0;t<n.length;t+=1)e.names.push({name:"name_"+t,type:"NAME",value:n[t]});return e}function iR(n,e,t){for(var i={},r=0;r<n.length;r+=1){var s=n[r],a=e[s.name];a!==void 0&&!KM(a,s.value)&&(s.type==="SID"&&(a=nR(a,t)),i[s.op]={name:s.name,type:s.type,value:a})}return i}function PS(n,e){var t=new lt.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return t.dict=iR(ZM,n,e),t}function LS(n){var e=new lt.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return e.topDicts=[{name:"topDict_0",type:"TABLE",value:n}],e}function n$(n){var e=new lt.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);e.strings=[];for(var t=0;t<n.length;t+=1)e.strings.push({name:"string_"+t,type:"STRING",value:n[t]});return e}function i$(){return new lt.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function r$(n,e){for(var t=new lt.Record("Charsets",[{name:"format",type:"Card8",value:0}]),i=0;i<n.length;i+=1){var r=n[i],s=nR(r,e);t.fields.push({name:"glyph_"+i,type:"SID",value:s})}return t}function s$(n){var e=[],t=n.path;e.push({name:"width",type:"NUMBER",value:n.advanceWidth});for(var i=0,r=0,s=0;s<t.commands.length;s+=1){var a=void 0,o=void 0,l=t.commands[s];if(l.type==="Q"){var c=.3333333333333333,u=2/3;l={type:"C",x:l.x,y:l.y,x1:Math.round(c*i+u*l.x1),y1:Math.round(c*r+u*l.y1),x2:Math.round(c*l.x+u*l.x1),y2:Math.round(c*l.y+u*l.y1)}}if(l.type==="M")a=Math.round(l.x-i),o=Math.round(l.y-r),e.push({name:"dx",type:"NUMBER",value:a}),e.push({name:"dy",type:"NUMBER",value:o}),e.push({name:"rmoveto",type:"OP",value:21}),i=Math.round(l.x),r=Math.round(l.y);else if(l.type==="L")a=Math.round(l.x-i),o=Math.round(l.y-r),e.push({name:"dx",type:"NUMBER",value:a}),e.push({name:"dy",type:"NUMBER",value:o}),e.push({name:"rlineto",type:"OP",value:5}),i=Math.round(l.x),r=Math.round(l.y);else if(l.type==="C"){var h=Math.round(l.x1-i),f=Math.round(l.y1-r),p=Math.round(l.x2-l.x1),m=Math.round(l.y2-l.y1);a=Math.round(l.x-l.x2),o=Math.round(l.y-l.y2),e.push({name:"dx1",type:"NUMBER",value:h}),e.push({name:"dy1",type:"NUMBER",value:f}),e.push({name:"dx2",type:"NUMBER",value:p}),e.push({name:"dy2",type:"NUMBER",value:m}),e.push({name:"dx",type:"NUMBER",value:a}),e.push({name:"dy",type:"NUMBER",value:o}),e.push({name:"rrcurveto",type:"OP",value:8}),i=Math.round(l.x),r=Math.round(l.y)}}return e.push({name:"endchar",type:"OP",value:14}),e}function a$(n){for(var e=new lt.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]),t=0;t<n.length;t+=1){var i=n.get(t),r=s$(i);e.charStrings.push({name:i.name,type:"CHARSTRING",value:r})}return e}function o$(n,e){var t=new lt.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return t.dict=iR(eR,n,e),t}function l$(n,e){for(var t=new lt.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),i=1/e.unitsPerEm,r={version:e.version,fullName:e.fullName,familyName:e.familyName,weight:e.weightName,fontBBox:e.fontBBox||[0,0,0,0],fontMatrix:[i,0,0,i,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},s={},a=[],o,l=1;l<n.length;l+=1)o=n.get(l),a.push(o.name);var c=[];t.header=e$(),t.nameIndex=t$([e.postScriptName]);var u=PS(r,c);t.topDictIndex=LS(u),t.globalSubrIndex=i$(),t.charsets=r$(a,c),t.charStringsIndex=a$(n),t.privateDict=o$(s,c),t.stringIndex=n$(c);var h=t.header.sizeOf()+t.nameIndex.sizeOf()+t.topDictIndex.sizeOf()+t.stringIndex.sizeOf()+t.globalSubrIndex.sizeOf();return r.charset=h,r.encoding=0,r.charStrings=r.charset+t.charsets.sizeOf(),r.private[1]=r.charStrings+t.charStringsIndex.sizeOf(),u=PS(r,c),t.topDictIndex=LS(u),t}var c$={parse:ZK,make:l$};function u$(n,e){var t={},i=new Gt.Parser(n,e);return t.version=i.parseVersion(),t.fontRevision=Math.round(i.parseFixed()*1e3)/1e3,t.checkSumAdjustment=i.parseULong(),t.magicNumber=i.parseULong(),Lt.argument(t.magicNumber===1594834165,"Font header has wrong magic number."),t.flags=i.parseUShort(),t.unitsPerEm=i.parseUShort(),t.created=i.parseLongDateTime(),t.modified=i.parseLongDateTime(),t.xMin=i.parseShort(),t.yMin=i.parseShort(),t.xMax=i.parseShort(),t.yMax=i.parseShort(),t.macStyle=i.parseUShort(),t.lowestRecPPEM=i.parseUShort(),t.fontDirectionHint=i.parseShort(),t.indexToLocFormat=i.parseShort(),t.glyphDataFormat=i.parseShort(),t}function h$(n){var e=Math.round(new Date().getTime()/1e3)+2082844800,t=e;return n.createdTimestamp&&(t=n.createdTimestamp+2082844800),new lt.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:t},{name:"modified",type:"LONGDATETIME",value:e},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:0},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],n)}var f$={parse:u$,make:h$};function d$(n,e){var t={},i=new Gt.Parser(n,e);return t.version=i.parseVersion(),t.ascender=i.parseShort(),t.descender=i.parseShort(),t.lineGap=i.parseShort(),t.advanceWidthMax=i.parseUShort(),t.minLeftSideBearing=i.parseShort(),t.minRightSideBearing=i.parseShort(),t.xMaxExtent=i.parseShort(),t.caretSlopeRise=i.parseShort(),t.caretSlopeRun=i.parseShort(),t.caretOffset=i.parseShort(),i.relativeOffset+=8,t.metricDataFormat=i.parseShort(),t.numberOfHMetrics=i.parseUShort(),t}function p$(n){return new lt.Table("hhea",[{name:"version",type:"FIXED",value:65536},{name:"ascender",type:"FWORD",value:0},{name:"descender",type:"FWORD",value:0},{name:"lineGap",type:"FWORD",value:0},{name:"advanceWidthMax",type:"UFWORD",value:0},{name:"minLeftSideBearing",type:"FWORD",value:0},{name:"minRightSideBearing",type:"FWORD",value:0},{name:"xMaxExtent",type:"FWORD",value:0},{name:"caretSlopeRise",type:"SHORT",value:1},{name:"caretSlopeRun",type:"SHORT",value:0},{name:"caretOffset",type:"SHORT",value:0},{name:"reserved1",type:"SHORT",value:0},{name:"reserved2",type:"SHORT",value:0},{name:"reserved3",type:"SHORT",value:0},{name:"reserved4",type:"SHORT",value:0},{name:"metricDataFormat",type:"SHORT",value:0},{name:"numberOfHMetrics",type:"USHORT",value:0}],n)}var g$={parse:d$,make:p$};function m$(n,e,t,i,r){for(var s,a,o=new Gt.Parser(n,e),l=0;l<i;l+=1){l<t&&(s=o.parseUShort(),a=o.parseShort());var c=r.get(l);c.advanceWidth=s,c.leftSideBearing=a}}function A$(n,e,t,i,r){n._hmtxTableData={};for(var s,a,o=new Gt.Parser(e,t),l=0;l<r;l+=1)l<i&&(s=o.parseUShort(),a=o.parseShort()),n._hmtxTableData[l]={advanceWidth:s,leftSideBearing:a}}function v$(n,e,t,i,r,s,a){a.lowMemory?A$(n,e,t,i,r):m$(e,t,i,r,s)}function y$(n){for(var e=new lt.Table("hmtx",[]),t=0;t<n.length;t+=1){var i=n.get(t),r=i.advanceWidth||0,s=i.leftSideBearing||0;e.fields.push({name:"advanceWidth_"+t,type:"USHORT",value:r}),e.fields.push({name:"leftSideBearing_"+t,type:"SHORT",value:s})}return e}var x$={parse:v$,make:y$};function _$(n){for(var e=new lt.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:n.length}]),t="",i=12+n.length*4,r=0;r<n.length;++r){var s=t.indexOf(n[r]);s<0&&(s=t.length,t+=n[r]),e.fields.push({name:"offset "+r,type:"USHORT",value:i+s}),e.fields.push({name:"length "+r,type:"USHORT",value:n[r].length})}return e.fields.push({name:"stringPool",type:"CHARARRAY",value:t}),e}function E$(n,e){var t=new Gt.Parser(n,e),i=t.parseULong();Lt.argument(i===1,"Unsupported ltag table version."),t.skip("uLong",1);for(var r=t.parseULong(),s=[],a=0;a<r;a++){for(var o="",l=e+t.parseUShort(),c=t.parseUShort(),u=l;u<l+c;++u)o+=String.fromCharCode(n.getInt8(u));s.push(o)}return s}var S$={make:_$,parse:E$};function w$(n,e){var t={},i=new Gt.Parser(n,e);return t.version=i.parseVersion(),t.numGlyphs=i.parseUShort(),t.version===1&&(t.maxPoints=i.parseUShort(),t.maxContours=i.parseUShort(),t.maxCompositePoints=i.parseUShort(),t.maxCompositeContours=i.parseUShort(),t.maxZones=i.parseUShort(),t.maxTwilightPoints=i.parseUShort(),t.maxStorage=i.parseUShort(),t.maxFunctionDefs=i.parseUShort(),t.maxInstructionDefs=i.parseUShort(),t.maxStackElements=i.parseUShort(),t.maxSizeOfInstructions=i.parseUShort(),t.maxComponentElements=i.parseUShort(),t.maxComponentDepth=i.parseUShort()),t}function C$(n){return new lt.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:n}])}var T$={parse:w$,make:C$},rR=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],sR={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},b$={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},aR={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",1040:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"};function I$(n,e,t){switch(n){case 0:if(e===65535)return"und";if(t)return t[e];break;case 1:return sR[e];case 3:return aR[e]}}var Wy="utf-16",M$={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},R$={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};function oR(n,e,t){switch(n){case 0:return Wy;case 1:return R$[t]||M$[e];case 3:if(e===1||e===10)return Wy;break}}function B$(n,e,t){for(var i={},r=new Gt.Parser(n,e),s=r.parseUShort(),a=r.parseUShort(),o=r.offset+r.parseUShort(),l=0;l<a;l++){var c=r.parseUShort(),u=r.parseUShort(),h=r.parseUShort(),f=r.parseUShort(),p=rR[f]||f,m=r.parseUShort(),y=r.parseUShort(),v=I$(c,h,t),A=oR(c,u,h);if(A!==void 0&&v!==void 0){var _=void 0;if(A===Wy?_=ef.UTF16(n,o+y,m):_=ef.MACSTRING(n,o+y,m,A),_){var x=i[p];x===void 0&&(x=i[p]={}),x[v]=_}}}return s===1&&r.parseUShort(),i}function e5(n){var e={};for(var t in n)e[n[t]]=parseInt(t);return e}function US(n,e,t,i,r,s){return new lt.Record("NameRecord",[{name:"platformID",type:"USHORT",value:n},{name:"encodingID",type:"USHORT",value:e},{name:"languageID",type:"USHORT",value:t},{name:"nameID",type:"USHORT",value:i},{name:"length",type:"USHORT",value:r},{name:"offset",type:"USHORT",value:s}])}function D$(n,e){var t=n.length,i=e.length-t+1;e:for(var r=0;r<i;r++)for(;r<i;r++){for(var s=0;s<t;s++)if(e[r+s]!==n[s])continue e;return r}return-1}function OS(n,e){var t=D$(n,e);if(t<0){t=e.length;for(var i=0,r=n.length;i<r;++i)e.push(n[i])}return t}function P$(n,e){var t,i=[],r={},s=e5(rR);for(var a in n){var o=s[a];if(o===void 0&&(o=a),t=parseInt(o),isNaN(t))throw new Error('Name table entry "'+a+'" does not exist, see nameTableNames for complete list.');r[t]=n[a],i.push(t)}for(var l=e5(sR),c=e5(aR),u=[],h=[],f=0;f<i.length;f++){t=i[f];var p=r[t];for(var m in p){var y=p[m],v=1,A=l[m],_=b$[A],x=oR(v,_,A),E=Ze.MACSTRING(y,x);E===void 0&&(v=0,A=e.indexOf(m),A<0&&(A=e.length,e.push(m)),_=4,E=Ze.UTF16(y));var w=OS(E,h);u.push(US(v,_,A,t,E.length,w));var I=c[m];if(I!==void 0){var T=Ze.UTF16(y),M=OS(T,h);u.push(US(3,1,I,t,T.length,M))}}}u.sort(function(L,U){return L.platformID-U.platformID||L.encodingID-U.encodingID||L.languageID-U.languageID||L.nameID-U.nameID});for(var b=new lt.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:u.length},{name:"stringOffset",type:"USHORT",value:6+u.length*12}]),B=0;B<u.length;B++)b.fields.push({name:"record_"+B,type:"RECORD",value:u[B]});return b.fields.push({name:"strings",type:"LITERAL",value:h}),b}var L$={parse:B$,make:P$},Yy=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];function U$(n){for(var e=0;e<Yy.length;e+=1){var t=Yy[e];if(n>=t.begin&&n<t.end)return e}return-1}function O$(n,e){var t={},i=new Gt.Parser(n,e);t.version=i.parseUShort(),t.xAvgCharWidth=i.parseShort(),t.usWeightClass=i.parseUShort(),t.usWidthClass=i.parseUShort(),t.fsType=i.parseUShort(),t.ySubscriptXSize=i.parseShort(),t.ySubscriptYSize=i.parseShort(),t.ySubscriptXOffset=i.parseShort(),t.ySubscriptYOffset=i.parseShort(),t.ySuperscriptXSize=i.parseShort(),t.ySuperscriptYSize=i.parseShort(),t.ySuperscriptXOffset=i.parseShort(),t.ySuperscriptYOffset=i.parseShort(),t.yStrikeoutSize=i.parseShort(),t.yStrikeoutPosition=i.parseShort(),t.sFamilyClass=i.parseShort(),t.panose=[];for(var r=0;r<10;r++)t.panose[r]=i.parseByte();return t.ulUnicodeRange1=i.parseULong(),t.ulUnicodeRange2=i.parseULong(),t.ulUnicodeRange3=i.parseULong(),t.ulUnicodeRange4=i.parseULong(),t.achVendID=String.fromCharCode(i.parseByte(),i.parseByte(),i.parseByte(),i.parseByte()),t.fsSelection=i.parseUShort(),t.usFirstCharIndex=i.parseUShort(),t.usLastCharIndex=i.parseUShort(),t.sTypoAscender=i.parseShort(),t.sTypoDescender=i.parseShort(),t.sTypoLineGap=i.parseShort(),t.usWinAscent=i.parseUShort(),t.usWinDescent=i.parseUShort(),t.version>=1&&(t.ulCodePageRange1=i.parseULong(),t.ulCodePageRange2=i.parseULong()),t.version>=2&&(t.sxHeight=i.parseShort(),t.sCapHeight=i.parseShort(),t.usDefaultChar=i.parseUShort(),t.usBreakChar=i.parseUShort(),t.usMaxContent=i.parseUShort()),t}function F$(n){return new lt.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],n)}var FS={parse:O$,make:F$,unicodeRanges:Yy,getUnicodeRange:U$};function k$(n,e){var t={},i=new Gt.Parser(n,e);switch(t.version=i.parseVersion(),t.italicAngle=i.parseFixed(),t.underlinePosition=i.parseShort(),t.underlineThickness=i.parseShort(),t.isFixedPitch=i.parseULong(),t.minMemType42=i.parseULong(),t.maxMemType42=i.parseULong(),t.minMemType1=i.parseULong(),t.maxMemType1=i.parseULong(),t.version){case 1:t.names=RS.slice();break;case 2:t.numberOfGlyphs=i.parseUShort(),t.glyphNameIndex=new Array(t.numberOfGlyphs);for(var r=0;r<t.numberOfGlyphs;r++)t.glyphNameIndex[r]=i.parseUShort();t.names=[];for(var s=0;s<t.numberOfGlyphs;s++)if(t.glyphNameIndex[s]>=RS.length){var a=i.parseChar();t.names.push(i.parseString(a))}break;case 2.5:t.numberOfGlyphs=i.parseUShort(),t.offset=new Array(t.numberOfGlyphs);for(var o=0;o<t.numberOfGlyphs;o++)t.offset[o]=i.parseChar();break}return t}function N$(){return new lt.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:0},{name:"underlinePosition",type:"FWORD",value:0},{name:"underlineThickness",type:"FWORD",value:0},{name:"isFixedPitch",type:"ULONG",value:0},{name:"minMemType42",type:"ULONG",value:0},{name:"maxMemType42",type:"ULONG",value:0},{name:"minMemType1",type:"ULONG",value:0},{name:"maxMemType1",type:"ULONG",value:0}])}var G$={parse:k$,make:N$},da=new Array(9);da[1]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:1,coverage:this.parsePointer(Te.coverage),deltaGlyphId:this.parseUShort()};if(t===2)return{substFormat:2,coverage:this.parsePointer(Te.coverage),substitute:this.parseOffset16List()};Lt.assert(!1,"0x"+e.toString(16)+": lookup type 1 format must be 1 or 2.")};da[2]=function(){var e=this.parseUShort();return Lt.argument(e===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(Te.coverage),sequences:this.parseListOfLists()}};da[3]=function(){var e=this.parseUShort();return Lt.argument(e===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(Te.coverage),alternateSets:this.parseListOfLists()}};da[4]=function(){var e=this.parseUShort();return Lt.argument(e===1,"GSUB ligature table identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(Te.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var zh={sequenceIndex:Te.uShort,lookupListIndex:Te.uShort};da[5]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:t,coverage:this.parsePointer(Te.coverage),ruleSets:this.parseListOfLists(function(){var s=this.parseUShort(),a=this.parseUShort();return{input:this.parseUShortList(s-1),lookupRecords:this.parseRecordList(a,zh)}})};if(t===2)return{substFormat:t,coverage:this.parsePointer(Te.coverage),classDef:this.parsePointer(Te.classDef),classSets:this.parseListOfLists(function(){var s=this.parseUShort(),a=this.parseUShort();return{classes:this.parseUShortList(s-1),lookupRecords:this.parseRecordList(a,zh)}})};if(t===3){var i=this.parseUShort(),r=this.parseUShort();return{substFormat:t,coverages:this.parseList(i,Te.pointer(Te.coverage)),lookupRecords:this.parseRecordList(r,zh)}}Lt.assert(!1,"0x"+e.toString(16)+": lookup type 5 format must be 1, 2 or 3.")};da[6]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:1,coverage:this.parsePointer(Te.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(zh)}})};if(t===2)return{substFormat:2,coverage:this.parsePointer(Te.coverage),backtrackClassDef:this.parsePointer(Te.classDef),inputClassDef:this.parsePointer(Te.classDef),lookaheadClassDef:this.parsePointer(Te.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(zh)}})};if(t===3)return{substFormat:3,backtrackCoverage:this.parseList(Te.pointer(Te.coverage)),inputCoverage:this.parseList(Te.pointer(Te.coverage)),lookaheadCoverage:this.parseList(Te.pointer(Te.coverage)),lookupRecords:this.parseRecordList(zh)};Lt.assert(!1,"0x"+e.toString(16)+": lookup type 6 format must be 1, 2 or 3.")};da[7]=function(){var e=this.parseUShort();Lt.argument(e===1,"GSUB Extension Substitution subtable identifier-format must be 1");var t=this.parseUShort(),i=new Te(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:t,extension:da[t].call(i)}};da[8]=function(){var e=this.parseUShort();return Lt.argument(e===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(Te.coverage),backtrackCoverage:this.parseList(Te.pointer(Te.coverage)),lookaheadCoverage:this.parseList(Te.pointer(Te.coverage)),substitutes:this.parseUShortList()}};function z$(n,e){e=e||0;var t=new Te(n,e),i=t.parseVersion(1);return Lt.argument(i===1||i===1.1,"Unsupported GSUB table version."),i===1?{version:i,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(da)}:{version:i,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(da),variations:t.parseFeatureVariationsList()}}var yf=new Array(9);yf[1]=function(e){return e.substFormat===1?new lt.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new lt.Coverage(e.coverage)},{name:"deltaGlyphID",type:"USHORT",value:e.deltaGlyphId}]):new lt.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new lt.Coverage(e.coverage)}].concat(lt.ushortList("substitute",e.substitute)))};yf[2]=function(e){return Lt.assert(e.substFormat===1,"Lookup type 2 substFormat must be 1."),new lt.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new lt.Coverage(e.coverage)}].concat(lt.tableList("seqSet",e.sequences,function(t){return new lt.Table("sequenceSetTable",lt.ushortList("sequence",t))})))};yf[3]=function(e){return Lt.assert(e.substFormat===1,"Lookup type 3 substFormat must be 1."),new lt.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new lt.Coverage(e.coverage)}].concat(lt.tableList("altSet",e.alternateSets,function(t){return new lt.Table("alternateSetTable",lt.ushortList("alternate",t))})))};yf[4]=function(e){return Lt.assert(e.substFormat===1,"Lookup type 4 substFormat must be 1."),new lt.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new lt.Coverage(e.coverage)}].concat(lt.tableList("ligSet",e.ligatureSets,function(t){return new lt.Table("ligatureSetTable",lt.tableList("ligature",t,function(i){return new lt.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:i.ligGlyph}].concat(lt.ushortList("component",i.components,i.components.length+1)))}))})))};yf[6]=function(e){if(e.substFormat===1){var t=new lt.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:e.substFormat},{name:"coverage",type:"TABLE",value:new lt.Coverage(e.coverage)}].concat(lt.tableList("chainRuleSet",e.chainRuleSets,function(s){return new lt.Table("chainRuleSetTable",lt.tableList("chainRule",s,function(a){var o=lt.ushortList("backtrackGlyph",a.backtrack,a.backtrack.length).concat(lt.ushortList("inputGlyph",a.input,a.input.length+1)).concat(lt.ushortList("lookaheadGlyph",a.lookahead,a.lookahead.length)).concat(lt.ushortList("substitution",[],a.lookupRecords.length));return a.lookupRecords.forEach(function(l,c){o=o.concat({name:"sequenceIndex"+c,type:"USHORT",value:l.sequenceIndex}).concat({name:"lookupListIndex"+c,type:"USHORT",value:l.lookupListIndex})}),new lt.Table("chainRuleTable",o)}))})));return t}else if(e.substFormat===2)Lt.assert(!1,"lookup type 6 format 2 is not yet supported.");else if(e.substFormat===3){var i=[{name:"substFormat",type:"USHORT",value:e.substFormat}];i.push({name:"backtrackGlyphCount",type:"USHORT",value:e.backtrackCoverage.length}),e.backtrackCoverage.forEach(function(s,a){i.push({name:"backtrackCoverage"+a,type:"TABLE",value:new lt.Coverage(s)})}),i.push({name:"inputGlyphCount",type:"USHORT",value:e.inputCoverage.length}),e.inputCoverage.forEach(function(s,a){i.push({name:"inputCoverage"+a,type:"TABLE",value:new lt.Coverage(s)})}),i.push({name:"lookaheadGlyphCount",type:"USHORT",value:e.lookaheadCoverage.length}),e.lookaheadCoverage.forEach(function(s,a){i.push({name:"lookaheadCoverage"+a,type:"TABLE",value:new lt.Coverage(s)})}),i.push({name:"substitutionCount",type:"USHORT",value:e.lookupRecords.length}),e.lookupRecords.forEach(function(s,a){i=i.concat({name:"sequenceIndex"+a,type:"USHORT",value:s.sequenceIndex}).concat({name:"lookupListIndex"+a,type:"USHORT",value:s.lookupListIndex})});var r=new lt.Table("chainContextTable",i);return r}Lt.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function Q$(n){return new lt.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new lt.ScriptList(n.scripts)},{name:"features",type:"TABLE",value:new lt.FeatureList(n.features)},{name:"lookups",type:"TABLE",value:new lt.LookupList(n.lookups,yf)}])}var H$={parse:z$,make:Q$};function V$(n,e){var t=new Gt.Parser(n,e),i=t.parseULong();Lt.argument(i===1,"Unsupported META table version."),t.parseULong(),t.parseULong();for(var r=t.parseULong(),s={},a=0;a<r;a++){var o=t.parseTag(),l=t.parseULong(),c=t.parseULong(),u=ef.UTF8(n,e+l,c);s[o]=u}return s}function W$(n){var e=Object.keys(n).length,t="",i=16+e*12,r=new lt.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:i},{name:"numTags",type:"ULONG",value:e}]);for(var s in n){var a=t.length;t+=n[s],r.fields.push({name:"tag "+s,type:"TAG",value:s}),r.fields.push({name:"offset "+s,type:"ULONG",value:i+a}),r.fields.push({name:"length "+s,type:"ULONG",value:n[s].length})}return r.fields.push({name:"stringPool",type:"CHARARRAY",value:t}),r}var Y$={parse:V$,make:W$};function kS(n){return Math.log(n)/Math.log(2)|0}function l8(n){for(;n.length%4!==0;)n.push(0);for(var e=0,t=0;t<n.length;t+=4)e+=(n[t]<<24)+(n[t+1]<<16)+(n[t+2]<<8)+n[t+3];return e%=Math.pow(2,32),e}function NS(n,e,t,i){return new lt.Record("Table Record",[{name:"tag",type:"TAG",value:n!==void 0?n:""},{name:"checkSum",type:"ULONG",value:e!==void 0?e:0},{name:"offset",type:"ULONG",value:t!==void 0?t:0},{name:"length",type:"ULONG",value:i!==void 0?i:0}])}function lR(n){var e=new lt.Table("sfnt",[{name:"version",type:"TAG",value:"OTTO"},{name:"numTables",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);e.tables=n,e.numTables=n.length;var t=Math.pow(2,kS(e.numTables));e.searchRange=16*t,e.entrySelector=kS(t),e.rangeShift=e.numTables*16-e.searchRange;for(var i=[],r=[],s=e.sizeOf()+NS().sizeOf()*e.numTables;s%4!==0;)s+=1,r.push({name:"padding",type:"BYTE",value:0});for(var a=0;a<n.length;a+=1){var o=n[a];Lt.argument(o.tableName.length===4,"Table name"+o.tableName+" is invalid.");var l=o.sizeOf(),c=NS(o.tableName,l8(o.encode()),s,l);for(i.push({name:c.tag+" Table Record",type:"RECORD",value:c}),r.push({name:o.tableName+" table",type:"RECORD",value:o}),s+=l,Lt.argument(!isNaN(s),"Something went wrong calculating the offset.");s%4!==0;)s+=1,r.push({name:"padding",type:"BYTE",value:0})}return i.sort(function(u,h){return u.value.tag>h.value.tag?1:-1}),e.fields=e.fields.concat(i),e.fields=e.fields.concat(r),e}function GS(n,e,t){for(var i=0;i<e.length;i+=1){var r=n.charToGlyphIndex(e[i]);if(r>0){var s=n.glyphs.get(r);return s.getMetrics()}}return t}function q$(n){for(var e=0,t=0;t<n.length;t+=1)e+=n[t];return e/n.length}function X$(n){for(var e=[],t=[],i=[],r=[],s=[],a=[],o=[],l,c=0,u=0,h=0,f=0,p=0,m=0;m<n.glyphs.length;m+=1){var y=n.glyphs.get(m),v=y.unicode|0;if(isNaN(y.advanceWidth))throw new Error("Glyph "+y.name+" ("+m+"): advanceWidth is not a number.");(l>v||l===void 0)&&v>0&&(l=v),c<v&&(c=v);var A=FS.getUnicodeRange(v);if(A<32)u|=1<<A;else if(A<64)h|=1<<A-32;else if(A<96)f|=1<<A-64;else if(A<123)p|=1<<A-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(y.name!==".notdef"){var _=y.getMetrics();e.push(_.xMin),t.push(_.yMin),i.push(_.xMax),r.push(_.yMax),a.push(_.leftSideBearing),o.push(_.rightSideBearing),s.push(y.advanceWidth)}}var x={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,t),xMax:Math.max.apply(null,i),yMax:Math.max.apply(null,r),advanceWidthMax:Math.max.apply(null,s),advanceWidthAvg:q$(s),minLeftSideBearing:Math.min.apply(null,a),maxLeftSideBearing:Math.max.apply(null,a),minRightSideBearing:Math.min.apply(null,o)};x.ascender=n.ascender,x.descender=n.descender;var E=f$.make({flags:3,unitsPerEm:n.unitsPerEm,xMin:x.xMin,yMin:x.yMin,xMax:x.xMax,yMax:x.yMax,lowestRecPPEM:3,createdTimestamp:n.createdTimestamp}),w=g$.make({ascender:x.ascender,descender:x.descender,advanceWidthMax:x.advanceWidthMax,minLeftSideBearing:x.minLeftSideBearing,minRightSideBearing:x.minRightSideBearing,xMaxExtent:x.maxLeftSideBearing+(x.xMax-x.xMin),numberOfHMetrics:n.glyphs.length}),I=T$.make(n.glyphs.length),T=FS.make(Object.assign({xAvgCharWidth:Math.round(x.advanceWidthAvg),usFirstCharIndex:l,usLastCharIndex:c,ulUnicodeRange1:u,ulUnicodeRange2:h,ulUnicodeRange3:f,ulUnicodeRange4:p,sTypoAscender:x.ascender,sTypoDescender:x.descender,sTypoLineGap:0,usWinAscent:x.yMax,usWinDescent:Math.abs(x.yMin),ulCodePageRange1:1,sxHeight:GS(n,"xyvw",{yMax:Math.round(x.ascender/2)}).yMax,sCapHeight:GS(n,"HIKLEFJMNTZBDPRAGOQSUVWXY",x).yMax,usDefaultChar:n.hasChar(" ")?32:0,usBreakChar:n.hasChar(" ")?32:0},n.tables.os2)),M=x$.make(n.glyphs),b=UK.make(n.glyphs),B=n.getEnglishName("fontFamily"),L=n.getEnglishName("fontSubfamily"),U=B+" "+L,O=n.getEnglishName("postScriptName");O||(O=B.replace(/\s/g,"")+"-"+L);var Q={};for(var G in n.names)Q[G]=n.names[G];Q.uniqueID||(Q.uniqueID={en:n.getEnglishName("manufacturer")+":"+U}),Q.postScriptName||(Q.postScriptName={en:O}),Q.preferredFamily||(Q.preferredFamily=n.names.fontFamily),Q.preferredSubfamily||(Q.preferredSubfamily=n.names.fontSubfamily);var F=[],q=L$.make(Q,F),Y=F.length>0?S$.make(F):void 0,H=G$.make(),V=c$.make(n.glyphs,{version:n.getEnglishName("version"),fullName:U,familyName:B,weightName:L,postScriptName:O,unitsPerEm:n.unitsPerEm,fontBBox:[0,x.yMin,x.ascender,x.advanceWidthMax]}),D=n.metas&&Object.keys(n.metas).length>0?Y$.make(n.metas):void 0,k=[E,w,I,T,q,b,H,V,M];Y&&k.push(Y),n.tables.gsub&&k.push(H$.make(n.tables.gsub)),D&&k.push(D);for(var Z=lR(k),j=Z.encode(),ee=l8(j),ie=Z.fields,te=!1,re=0;re<ie.length;re+=1)if(ie[re].name==="head table"){ie[re].value.checkSumAdjustment=2981146554-ee,te=!0;break}if(!te)throw new Error("Could not find head table with checkSum to adjust.");return Z}var j$={make:lR,fontToTable:X$,computeCheckSum:l8};function t5(n,e){for(var t=0,i=n.length-1;t<=i;){var r=t+i>>>1,s=n[r].tag;if(s===e)return r;s<e?t=r+1:i=r-1}return-t-1}function zS(n,e){for(var t=0,i=n.length-1;t<=i;){var r=t+i>>>1,s=n[r];if(s===e)return r;s<e?t=r+1:i=r-1}return-t-1}function QS(n,e){for(var t,i=0,r=n.length-1;i<=r;){var s=i+r>>>1;t=n[s];var a=t.start;if(a===e)return t;a<e?i=s+1:r=s-1}if(i>0)return t=n[i-1],e>t.end?0:t}function R0(n,e){this.font=n,this.tableName=e}R0.prototype={searchTag:t5,binSearch:zS,getTable:function(n){var e=this.font.tables[this.tableName];return!e&&n&&(e=this.font.tables[this.tableName]=this.createDefaultTable()),e},getScriptNames:function(){var n=this.getTable();return n?n.scripts.map(function(e){return e.tag}):[]},getDefaultScriptName:function(){var n=this.getTable();if(n){for(var e=!1,t=0;t<n.scripts.length;t++){var i=n.scripts[t].tag;if(i==="DFLT")return i;i==="latn"&&(e=!0)}if(e)return"latn"}},getScriptTable:function(n,e){var t=this.getTable(e);if(t){n=n||"DFLT";var i=t.scripts,r=t5(t.scripts,n);if(r>=0)return i[r].script;if(e){var s={tag:n,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return i.splice(-1-r,0,s),s.script}}},getLangSysTable:function(n,e,t){var i=this.getScriptTable(n,t);if(i){if(!e||e==="dflt"||e==="DFLT")return i.defaultLangSys;var r=t5(i.langSysRecords,e);if(r>=0)return i.langSysRecords[r].langSys;if(t){var s={tag:e,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return i.langSysRecords.splice(-1-r,0,s),s.langSys}}},getFeatureTable:function(n,e,t,i){var r=this.getLangSysTable(n,e,i);if(r){for(var s,a=r.featureIndexes,o=this.font.tables[this.tableName].features,l=0;l<a.length;l++)if(s=o[a[l]],s.tag===t)return s.feature;if(i){var c=o.length;return Lt.assert(c===0||t>=o[c-1].tag,"Features must be added in alphabetical order."),s={tag:t,feature:{params:0,lookupListIndexes:[]}},o.push(s),a.push(c),s.feature}}},getLookupTables:function(n,e,t,i,r){var s=this.getFeatureTable(n,e,t,r),a=[];if(s){for(var o,l=s.lookupListIndexes,c=this.font.tables[this.tableName].lookups,u=0;u<l.length;u++)o=c[l[u]],o.lookupType===i&&a.push(o);if(a.length===0&&r){o={lookupType:i,lookupFlag:0,subtables:[],markFilteringSet:void 0};var h=c.length;return c.push(o),l.push(h),[o]}}return a},getGlyphClass:function(n,e){switch(n.format){case 1:return n.startGlyph<=e&&e<n.startGlyph+n.classes.length?n.classes[e-n.startGlyph]:0;case 2:var t=QS(n.ranges,e);return t?t.classId:0}},getCoverageIndex:function(n,e){switch(n.format){case 1:var t=zS(n.glyphs,e);return t>=0?t:-1;case 2:var i=QS(n.ranges,e);return i?i.index+e-i.start:-1}},expandCoverage:function(n){if(n.format===1)return n.glyphs;for(var e=[],t=n.ranges,i=0;i<t.length;i++)for(var r=t[i],s=r.start,a=r.end,o=s;o<=a;o++)e.push(o);return e}};function B0(n){R0.call(this,n,"gpos")}B0.prototype=R0.prototype;B0.prototype.init=function(){var n=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(n)};B0.prototype.getKerningValue=function(n,e,t){for(var i=0;i<n.length;i++)for(var r=n[i].subtables,s=0;s<r.length;s++){var a=r[s],o=this.getCoverageIndex(a.coverage,e);if(!(o<0))switch(a.posFormat){case 1:for(var l=a.pairSets[o],c=0;c<l.length;c++){var u=l[c];if(u.secondGlyph===t)return u.value1&&u.value1.xAdvance||0}break;case 2:var h=this.getGlyphClass(a.classDef1,e),f=this.getGlyphClass(a.classDef2,t),p=a.classRecords[h][f];return p.value1&&p.value1.xAdvance||0}}return 0};B0.prototype.getKerningTables=function(n,e){if(this.font.tables.gpos)return this.getLookupTables(n,e,"kern",2)};function As(n){R0.call(this,n,"gsub")}function K$(n,e){var t=n.length;if(t!==e.length)return!1;for(var i=0;i<t;i++)if(n[i]!==e[i])return!1;return!0}function c8(n,e,t){for(var i=n.subtables,r=0;r<i.length;r++){var s=i[r];if(s.substFormat===e)return s}if(t)return i.push(t),t}As.prototype=R0.prototype;As.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}};As.prototype.getSingle=function(n,e,t){for(var i=[],r=this.getLookupTables(e,t,n,1),s=0;s<r.length;s++)for(var a=r[s].subtables,o=0;o<a.length;o++){var l=a[o],c=this.expandCoverage(l.coverage),u=void 0;if(l.substFormat===1){var h=l.deltaGlyphId;for(u=0;u<c.length;u++){var f=c[u];i.push({sub:f,by:f+h})}}else{var p=l.substitute;for(u=0;u<c.length;u++)i.push({sub:c[u],by:p[u]})}}return i};As.prototype.getMultiple=function(n,e,t){for(var i=[],r=this.getLookupTables(e,t,n,2),s=0;s<r.length;s++)for(var a=r[s].subtables,o=0;o<a.length;o++){var l=a[o],c=this.expandCoverage(l.coverage),u=void 0;for(u=0;u<c.length;u++){var h=c[u],f=l.sequences[u];i.push({sub:h,by:f})}}return i};As.prototype.getAlternates=function(n,e,t){for(var i=[],r=this.getLookupTables(e,t,n,3),s=0;s<r.length;s++)for(var a=r[s].subtables,o=0;o<a.length;o++)for(var l=a[o],c=this.expandCoverage(l.coverage),u=l.alternateSets,h=0;h<c.length;h++)i.push({sub:c[h],by:u[h]});return i};As.prototype.getLigatures=function(n,e,t){for(var i=[],r=this.getLookupTables(e,t,n,4),s=0;s<r.length;s++)for(var a=r[s].subtables,o=0;o<a.length;o++)for(var l=a[o],c=this.expandCoverage(l.coverage),u=l.ligatureSets,h=0;h<c.length;h++)for(var f=c[h],p=u[h],m=0;m<p.length;m++){var y=p[m];i.push({sub:[f].concat(y.components),by:y.ligGlyph})}return i};As.prototype.addSingle=function(n,e,t,i){var r=this.getLookupTables(t,i,n,1,!0)[0],s=c8(r,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});Lt.assert(s.coverage.format===1,"Single: unable to modify coverage table format "+s.coverage.format);var a=e.sub,o=this.binSearch(s.coverage.glyphs,a);o<0&&(o=-1-o,s.coverage.glyphs.splice(o,0,a),s.substitute.splice(o,0,0)),s.substitute[o]=e.by};As.prototype.addMultiple=function(n,e,t,i){Lt.assert(e.by instanceof Array&&e.by.length>1,'Multiple: "by" must be an array of two or more ids');var r=this.getLookupTables(t,i,n,2,!0)[0],s=c8(r,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});Lt.assert(s.coverage.format===1,"Multiple: unable to modify coverage table format "+s.coverage.format);var a=e.sub,o=this.binSearch(s.coverage.glyphs,a);o<0&&(o=-1-o,s.coverage.glyphs.splice(o,0,a),s.sequences.splice(o,0,0)),s.sequences[o]=e.by};As.prototype.addAlternate=function(n,e,t,i){var r=this.getLookupTables(t,i,n,3,!0)[0],s=c8(r,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});Lt.assert(s.coverage.format===1,"Alternate: unable to modify coverage table format "+s.coverage.format);var a=e.sub,o=this.binSearch(s.coverage.glyphs,a);o<0&&(o=-1-o,s.coverage.glyphs.splice(o,0,a),s.alternateSets.splice(o,0,0)),s.alternateSets[o]=e.by};As.prototype.addLigature=function(n,e,t,i){var r=this.getLookupTables(t,i,n,4,!0)[0],s=r.subtables[0];s||(s={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},r.subtables[0]=s),Lt.assert(s.coverage.format===1,"Ligature: unable to modify coverage table format "+s.coverage.format);var a=e.sub[0],o=e.sub.slice(1),l={ligGlyph:e.by,components:o},c=this.binSearch(s.coverage.glyphs,a);if(c>=0){for(var u=s.ligatureSets[c],h=0;h<u.length;h++)if(K$(u[h].components,o))return;u.push(l)}else c=-1-c,s.coverage.glyphs.splice(c,0,a),s.ligatureSets.splice(c,0,[l])};As.prototype.getFeature=function(n,e,t){if(/ss\d\d/.test(n))return this.getSingle(n,e,t);switch(n){case"aalt":case"salt":return this.getSingle(n,e,t).concat(this.getAlternates(n,e,t));case"dlig":case"liga":case"rlig":return this.getLigatures(n,e,t);case"ccmp":return this.getMultiple(n,e,t).concat(this.getLigatures(n,e,t));case"stch":return this.getMultiple(n,e,t)}};As.prototype.add=function(n,e,t,i){if(/ss\d\d/.test(n))return this.addSingle(n,e,t,i);switch(n){case"aalt":case"salt":return typeof e.by=="number"?this.addSingle(n,e,t,i):this.addAlternate(n,e,t,i);case"dlig":case"liga":case"rlig":return this.addLigature(n,e,t,i);case"ccmp":return e.by instanceof Array?this.addMultiple(n,e,t,i):this.addLigature(n,e,t,i)}};function $$(){return typeof window<"u"}function J$(n){for(var e=new Buffer(n.byteLength),t=new Uint8Array(n),i=0;i<e.length;++i)e[i]=t[i];return e}function xd(n,e){if(!n)throw e}function HS(n,e,t,i,r){var s;return(e&i)>0?(s=n.parseByte(),e&r||(s=-s),s=t+s):(e&r)>0?s=t:s=t+n.parseShort(),s}function cR(n,e,t){var i=new Gt.Parser(e,t);n.numberOfContours=i.parseShort(),n._xMin=i.parseShort(),n._yMin=i.parseShort(),n._xMax=i.parseShort(),n._yMax=i.parseShort();var r,s;if(n.numberOfContours>0){for(var a=n.endPointIndices=[],o=0;o<n.numberOfContours;o+=1)a.push(i.parseUShort());n.instructionLength=i.parseUShort(),n.instructions=[];for(var l=0;l<n.instructionLength;l+=1)n.instructions.push(i.parseByte());var c=a[a.length-1]+1;r=[];for(var u=0;u<c;u+=1)if(s=i.parseByte(),r.push(s),(s&8)>0)for(var h=i.parseByte(),f=0;f<h;f+=1)r.push(s),u+=1;if(Lt.argument(r.length===c,"Bad flags."),a.length>0){var p=[],m;if(c>0){for(var y=0;y<c;y+=1)s=r[y],m={},m.onCurve=!!(s&1),m.lastPointOfContour=a.indexOf(y)>=0,p.push(m);for(var v=0,A=0;A<c;A+=1)s=r[A],m=p[A],m.x=HS(i,s,v,2,16),v=m.x;for(var _=0,x=0;x<c;x+=1)s=r[x],m=p[x],m.y=HS(i,s,_,4,32),_=m.y}n.points=p}else n.points=[]}else if(n.numberOfContours===0)n.points=[];else{n.isComposite=!0,n.points=[],n.components=[];for(var E=!0;E;){r=i.parseUShort();var w={glyphIndex:i.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(r&1)>0?(r&2)>0?(w.dx=i.parseShort(),w.dy=i.parseShort()):w.matchedPoints=[i.parseUShort(),i.parseUShort()]:(r&2)>0?(w.dx=i.parseChar(),w.dy=i.parseChar()):w.matchedPoints=[i.parseByte(),i.parseByte()],(r&8)>0?w.xScale=w.yScale=i.parseF2Dot14():(r&64)>0?(w.xScale=i.parseF2Dot14(),w.yScale=i.parseF2Dot14()):(r&128)>0&&(w.xScale=i.parseF2Dot14(),w.scale01=i.parseF2Dot14(),w.scale10=i.parseF2Dot14(),w.yScale=i.parseF2Dot14()),n.components.push(w),E=!!(r&32)}if(r&256){n.instructionLength=i.parseUShort(),n.instructions=[];for(var I=0;I<n.instructionLength;I+=1)n.instructions.push(i.parseByte())}}}function n5(n,e){for(var t=[],i=0;i<n.length;i+=1){var r=n[i],s={x:e.xScale*r.x+e.scale01*r.y+e.dx,y:e.scale10*r.x+e.yScale*r.y+e.dy,onCurve:r.onCurve,lastPointOfContour:r.lastPointOfContour};t.push(s)}return t}function Z$(n){for(var e=[],t=[],i=0;i<n.length;i+=1){var r=n[i];t.push(r),r.lastPointOfContour&&(e.push(t),t=[])}return Lt.argument(t.length===0,"There are still points left in the current contour."),e}function uR(n){var e=new Li;if(!n)return e;for(var t=Z$(n),i=0;i<t.length;++i){var r=t[i],s=null,a=r[r.length-1],o=r[0];if(a.onCurve)e.moveTo(a.x,a.y);else if(o.onCurve)e.moveTo(o.x,o.y);else{var l={x:(a.x+o.x)*.5,y:(a.y+o.y)*.5};e.moveTo(l.x,l.y)}for(var c=0;c<r.length;++c)if(s=a,a=o,o=r[(c+1)%r.length],a.onCurve)e.lineTo(a.x,a.y);else{var u=o;s.onCurve||((a.x+s.x)*.5,(a.y+s.y)*.5),o.onCurve||(u={x:(a.x+o.x)*.5,y:(a.y+o.y)*.5}),e.quadraticCurveTo(a.x,a.y,u.x,u.y)}e.closePath()}return e}function hR(n,e){if(e.isComposite)for(var t=0;t<e.components.length;t+=1){var i=e.components[t],r=n.get(i.glyphIndex);if(r.getPath(),r.points){var s=void 0;if(i.matchedPoints===void 0)s=n5(r.points,i);else{if(i.matchedPoints[0]>e.points.length-1||i.matchedPoints[1]>r.points.length-1)throw Error("Matched points out of range in "+e.name);var a=e.points[i.matchedPoints[0]],o=r.points[i.matchedPoints[1]],l={xScale:i.xScale,scale01:i.scale01,scale10:i.scale10,yScale:i.yScale,dx:0,dy:0};o=n5([o],l)[0],l.dx=a.x-o.x,l.dy=a.y-o.y,s=n5(r.points,l)}e.points=e.points.concat(s)}}return uR(e.points)}function eJ(n,e,t,i){for(var r=new Xa.GlyphSet(i),s=0;s<t.length-1;s+=1){var a=t[s],o=t[s+1];a!==o?r.push(s,Xa.ttfGlyphLoader(i,s,cR,n,e+a,hR)):r.push(s,Xa.glyphLoader(i,s))}return r}function tJ(n,e,t,i){var r=new Xa.GlyphSet(i);return i._push=function(s){var a=t[s],o=t[s+1];a!==o?r.push(s,Xa.ttfGlyphLoader(i,s,cR,n,e+a,hR)):r.push(s,Xa.glyphLoader(i,s))},r}function nJ(n,e,t,i,r){return r.lowMemory?tJ(n,e,t,i):eJ(n,e,t,i)}var iJ={getPath:uR,parse:nJ},fR,fu,dR,qy;function pR(n){this.font=n,this.getCommands=function(e){return iJ.getPath(e).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function rJ(n){return n}function gR(n){return Math.sign(n)*Math.round(Math.abs(n))}function sJ(n){return Math.sign(n)*Math.round(Math.abs(n*2))/2}function aJ(n){return Math.sign(n)*(Math.round(Math.abs(n)+.5)-.5)}function oJ(n){return Math.sign(n)*Math.ceil(Math.abs(n))}function lJ(n){return Math.sign(n)*Math.floor(Math.abs(n))}var mR=function(n){var e=this.srPeriod,t=this.srPhase,i=this.srThreshold,r=1;return n<0&&(n=-n,r=-1),n+=i-t,n=Math.trunc(n/e)*e,n+=t,n<0?t*r:n*r},Qa={x:1,y:0,axis:"x",distance:function(n,e,t,i){return(t?n.xo:n.x)-(i?e.xo:e.x)},interpolate:function(n,e,t,i){var r,s,a,o,l,c,u;if(!i||i===this){if(r=n.xo-e.xo,s=n.xo-t.xo,l=e.x-e.xo,c=t.x-t.xo,a=Math.abs(r),o=Math.abs(s),u=a+o,u===0){n.x=n.xo+(l+c)/2;return}n.x=n.xo+(l*o+c*a)/u;return}if(r=i.distance(n,e,!0,!0),s=i.distance(n,t,!0,!0),l=i.distance(e,e,!1,!0),c=i.distance(t,t,!1,!0),a=Math.abs(r),o=Math.abs(s),u=a+o,u===0){Qa.setRelative(n,n,(l+c)/2,i,!0);return}Qa.setRelative(n,n,(l*o+c*a)/u,i,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(n,e,t,i,r){if(!i||i===this){n.x=(r?e.xo:e.x)+t;return}var s=r?e.xo:e.x,a=r?e.yo:e.y,o=s+t*i.x,l=a+t*i.y;n.x=o+(n.y-l)/i.normalSlope},slope:0,touch:function(n){n.xTouched=!0},touched:function(n){return n.xTouched},untouch:function(n){n.xTouched=!1}},Fo={x:0,y:1,axis:"y",distance:function(n,e,t,i){return(t?n.yo:n.y)-(i?e.yo:e.y)},interpolate:function(n,e,t,i){var r,s,a,o,l,c,u;if(!i||i===this){if(r=n.yo-e.yo,s=n.yo-t.yo,l=e.y-e.yo,c=t.y-t.yo,a=Math.abs(r),o=Math.abs(s),u=a+o,u===0){n.y=n.yo+(l+c)/2;return}n.y=n.yo+(l*o+c*a)/u;return}if(r=i.distance(n,e,!0,!0),s=i.distance(n,t,!0,!0),l=i.distance(e,e,!1,!0),c=i.distance(t,t,!1,!0),a=Math.abs(r),o=Math.abs(s),u=a+o,u===0){Fo.setRelative(n,n,(l+c)/2,i,!0);return}Fo.setRelative(n,n,(l*o+c*a)/u,i,!0)},normalSlope:0,setRelative:function(n,e,t,i,r){if(!i||i===this){n.y=(r?e.yo:e.y)+t;return}var s=r?e.xo:e.x,a=r?e.yo:e.y,o=s+t*i.x,l=a+t*i.y;n.y=l+i.normalSlope*(n.x-o)},slope:Number.POSITIVE_INFINITY,touch:function(n){n.yTouched=!0},touched:function(n){return n.yTouched},untouch:function(n){n.yTouched=!1}};Object.freeze(Qa);Object.freeze(Fo);function D0(n,e){this.x=n,this.y=e,this.axis=void 0,this.slope=e/n,this.normalSlope=-n/e,Object.freeze(this)}D0.prototype.distance=function(n,e,t,i){return this.x*Qa.distance(n,e,t,i)+this.y*Fo.distance(n,e,t,i)};D0.prototype.interpolate=function(n,e,t,i){var r,s,a,o,l,c,u;if(a=i.distance(n,e,!0,!0),o=i.distance(n,t,!0,!0),r=i.distance(e,e,!1,!0),s=i.distance(t,t,!1,!0),l=Math.abs(a),c=Math.abs(o),u=l+c,u===0){this.setRelative(n,n,(r+s)/2,i,!0);return}this.setRelative(n,n,(r*c+s*l)/u,i,!0)};D0.prototype.setRelative=function(n,e,t,i,r){i=i||this;var s=r?e.xo:e.x,a=r?e.yo:e.y,o=s+t*i.x,l=a+t*i.y,c=i.normalSlope,u=this.slope,h=n.x,f=n.y;n.x=(u*h-c*o+l-f)/(u-c),n.y=u*(n.x-h)+f};D0.prototype.touch=function(n){n.xTouched=!0,n.yTouched=!0};function P0(n,e){var t=Math.sqrt(n*n+e*e);return n/=t,e/=t,n===1&&e===0?Qa:n===0&&e===1?Fo:new D0(n,e)}function zo(n,e,t,i){this.x=this.xo=Math.round(n*64)/64,this.y=this.yo=Math.round(e*64)/64,this.lastPointOfContour=t,this.onCurve=i,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}zo.prototype.nextTouched=function(n){for(var e=this.nextPointOnContour;!n.touched(e)&&e!==this;)e=e.nextPointOnContour;return e};zo.prototype.prevTouched=function(n){for(var e=this.prevPointOnContour;!n.touched(e)&&e!==this;)e=e.prevPointOnContour;return e};var Zp=Object.freeze(new zo(0,0)),cJ={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function Rl(n,e){switch(this.env=n,this.stack=[],this.prog=e,n){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=Qa,this.round=gR}}pR.prototype.exec=function(n,e){if(typeof e!="number")throw new Error("Point size is not a number!");if(!(this._errorState>2)){var t=this.font,i=this._prepState;if(!i||i.ppem!==e){var r=this._fpgmState;if(!r){Rl.prototype=cJ,r=this._fpgmState=new Rl("fpgm",t.tables.fpgm),r.funcs=[],r.font=t,exports.DEBUG&&(console.log("---EXEC FPGM---"),r.step=-1);try{fu(r)}catch(c){console.log("Hinting error in FPGM:"+c),this._errorState=3;return}}Rl.prototype=r,i=this._prepState=new Rl("prep",t.tables.prep),i.ppem=e;var s=t.tables.cvt;if(s)for(var a=i.cvt=new Array(s.length),o=e/t.unitsPerEm,l=0;l<s.length;l++)a[l]=s[l]*o;else i.cvt=[];exports.DEBUG&&(console.log("---EXEC PREP---"),i.step=-1);try{fu(i)}catch(c){this._errorState<2&&console.log("Hinting error in PREP:"+c),this._errorState=2}}if(!(this._errorState>1))try{return dR(n,i)}catch(c){this._errorState<1&&(console.log("Hinting error:"+c),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}}};dR=function(n,e){var t=e.ppem/e.font.unitsPerEm,i=t,r=n.components,s,a,o;if(Rl.prototype=e,!r)o=new Rl("glyf",n.instructions),exports.DEBUG&&(console.log("---EXEC GLYPH---"),o.step=-1),qy(n,o,t,i),a=o.gZone;else{var l=e.font;a=[],s=[];for(var c=0;c<r.length;c++){var u=r[c],h=l.glyphs.get(u.glyphIndex);o=new Rl("glyf",h.instructions),exports.DEBUG&&(console.log("---EXEC COMP "+c+"---"),o.step=-1),qy(h,o,t,i);for(var f=Math.round(u.dx*t),p=Math.round(u.dy*i),m=o.gZone,y=o.contours,v=0;v<m.length;v++){var A=m[v];A.xTouched=A.yTouched=!1,A.xo=A.x=A.x+f,A.yo=A.y=A.y+p}var _=a.length;a.push.apply(a,m);for(var x=0;x<y.length;x++)s.push(y[x]+_)}n.instructions&&!o.inhibitGridFit&&(o=new Rl("glyf",n.instructions),o.gZone=o.z0=o.z1=o.z2=a,o.contours=s,a.push(new zo(0,0),new zo(Math.round(n.advanceWidth*t),0)),exports.DEBUG&&(console.log("---EXEC COMPOSITE---"),o.step=-1),fu(o),a.length-=2)}return a};qy=function(n,e,t,i){for(var r=n.points||[],s=r.length,a=e.gZone=e.z0=e.z1=e.z2=[],o=e.contours=[],l,c=0;c<s;c++)l=r[c],a[c]=new zo(l.x*t,l.y*i,l.lastPointOfContour,l.onCurve);for(var u,h,f=0;f<s;f++)l=a[f],u||(u=l,o.push(f)),l.lastPointOfContour?(l.nextPointOnContour=u,u.prevPointOnContour=l,u=void 0):(h=a[f+1],l.nextPointOnContour=h,h.prevPointOnContour=l);if(!e.inhibitGridFit){if(exports.DEBUG){console.log("PROCESSING GLYPH",e.stack);for(var p=0;p<s;p++)console.log(p,a[p].x,a[p].y)}if(a.push(new zo(0,0),new zo(Math.round(n.advanceWidth*t),0)),fu(e),a.length-=2,exports.DEBUG){console.log("FINISHED GLYPH",e.stack);for(var m=0;m<s;m++)console.log(m,a[m].x,a[m].y)}}};fu=function(n){var e=n.prog;if(e){var t=e.length,i;for(n.ip=0;n.ip<t;n.ip++){if(exports.DEBUG&&n.step++,i=fR[e[n.ip]],!i)throw new Error("unknown instruction: 0x"+Number(e[n.ip]).toString(16));i(n)}}};function C1(n){for(var e=n.tZone=new Array(n.gZone.length),t=0;t<e.length;t++)e[t]=new zo(0,0)}function AR(n,e){var t=n.prog,i=n.ip,r=1,s;do if(s=t[++i],s===88)r++;else if(s===89)r--;else if(s===64)i+=t[i+1]+1;else if(s===65)i+=2*t[i+1]+1;else if(s>=176&&s<=183)i+=s-176+1;else if(s>=184&&s<=191)i+=(s-184+1)*2;else if(e&&r===1&&s===27)break;while(r>0);n.ip=i}function VS(n,e){exports.DEBUG&&console.log(e.step,"SVTCA["+n.axis+"]"),e.fv=e.pv=e.dpv=n}function WS(n,e){exports.DEBUG&&console.log(e.step,"SPVTCA["+n.axis+"]"),e.pv=e.dpv=n}function YS(n,e){exports.DEBUG&&console.log(e.step,"SFVTCA["+n.axis+"]"),e.fv=n}function qS(n,e){var t=e.stack,i=t.pop(),r=t.pop(),s=e.z2[i],a=e.z1[r];exports.DEBUG&&console.log("SPVTL["+n+"]",i,r);var o,l;n?(o=s.y-a.y,l=a.x-s.x):(o=a.x-s.x,l=a.y-s.y),e.pv=e.dpv=P0(o,l)}function XS(n,e){var t=e.stack,i=t.pop(),r=t.pop(),s=e.z2[i],a=e.z1[r];exports.DEBUG&&console.log("SFVTL["+n+"]",i,r);var o,l;n?(o=s.y-a.y,l=a.x-s.x):(o=a.x-s.x,l=a.y-s.y),e.fv=P0(o,l)}function uJ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"SPVFS[]",t,i),n.pv=n.dpv=P0(i,t)}function hJ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"SPVFS[]",t,i),n.fv=P0(i,t)}function fJ(n){var e=n.stack,t=n.pv;exports.DEBUG&&console.log(n.step,"GPV[]"),e.push(t.x*16384),e.push(t.y*16384)}function dJ(n){var e=n.stack,t=n.fv;exports.DEBUG&&console.log(n.step,"GFV[]"),e.push(t.x*16384),e.push(t.y*16384)}function pJ(n){n.fv=n.pv,exports.DEBUG&&console.log(n.step,"SFVTPV[]")}function gJ(n){var e=n.stack,t=e.pop(),i=e.pop(),r=e.pop(),s=e.pop(),a=e.pop(),o=n.z0,l=n.z1,c=o[t],u=o[i],h=l[r],f=l[s],p=n.z2[a];exports.DEBUG&&console.log("ISECT[], ",t,i,r,s,a);var m=c.x,y=c.y,v=u.x,A=u.y,_=h.x,x=h.y,E=f.x,w=f.y,I=(m-v)*(x-w)-(y-A)*(_-E),T=m*A-y*v,M=_*w-x*E;p.x=(T*(_-E)-M*(m-v))/I,p.y=(T*(x-w)-M*(y-A))/I}function mJ(n){n.rp0=n.stack.pop(),exports.DEBUG&&console.log(n.step,"SRP0[]",n.rp0)}function AJ(n){n.rp1=n.stack.pop(),exports.DEBUG&&console.log(n.step,"SRP1[]",n.rp1)}function vJ(n){n.rp2=n.stack.pop(),exports.DEBUG&&console.log(n.step,"SRP2[]",n.rp2)}function yJ(n){var e=n.stack.pop();switch(exports.DEBUG&&console.log(n.step,"SZP0[]",e),n.zp0=e,e){case 0:n.tZone||C1(n),n.z0=n.tZone;break;case 1:n.z0=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function xJ(n){var e=n.stack.pop();switch(exports.DEBUG&&console.log(n.step,"SZP1[]",e),n.zp1=e,e){case 0:n.tZone||C1(n),n.z1=n.tZone;break;case 1:n.z1=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function _J(n){var e=n.stack.pop();switch(exports.DEBUG&&console.log(n.step,"SZP2[]",e),n.zp2=e,e){case 0:n.tZone||C1(n),n.z2=n.tZone;break;case 1:n.z2=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function EJ(n){var e=n.stack.pop();switch(exports.DEBUG&&console.log(n.step,"SZPS[]",e),n.zp0=n.zp1=n.zp2=e,e){case 0:n.tZone||C1(n),n.z0=n.z1=n.z2=n.tZone;break;case 1:n.z0=n.z1=n.z2=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function SJ(n){n.loop=n.stack.pop(),exports.DEBUG&&console.log(n.step,"SLOOP[]",n.loop)}function wJ(n){exports.DEBUG&&console.log(n.step,"RTG[]"),n.round=gR}function CJ(n){exports.DEBUG&&console.log(n.step,"RTHG[]"),n.round=aJ}function TJ(n){var e=n.stack.pop();exports.DEBUG&&console.log(n.step,"SMD[]",e),n.minDis=e/64}function bJ(n){exports.DEBUG&&console.log(n.step,"ELSE[]"),AR(n,!1)}function IJ(n){var e=n.stack.pop();exports.DEBUG&&console.log(n.step,"JMPR[]",e),n.ip+=e-1}function MJ(n){var e=n.stack.pop();exports.DEBUG&&console.log(n.step,"SCVTCI[]",e),n.cvCutIn=e/64}function RJ(n){var e=n.stack;exports.DEBUG&&console.log(n.step,"DUP[]"),e.push(e[e.length-1])}function i5(n){exports.DEBUG&&console.log(n.step,"POP[]"),n.stack.pop()}function BJ(n){exports.DEBUG&&console.log(n.step,"CLEAR[]"),n.stack.length=0}function DJ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"SWAP[]"),e.push(t),e.push(i)}function PJ(n){var e=n.stack;exports.DEBUG&&console.log(n.step,"DEPTH[]"),e.push(e.length)}function LJ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"LOOPCALL[]",t,i);var r=n.ip,s=n.prog;n.prog=n.funcs[t];for(var a=0;a<i;a++)fu(n),exports.DEBUG&&console.log(++n.step,a+1<i?"next loopcall":"done loopcall",a);n.ip=r,n.prog=s}function UJ(n){var e=n.stack.pop();exports.DEBUG&&console.log(n.step,"CALL[]",e);var t=n.ip,i=n.prog;n.prog=n.funcs[e],fu(n),n.ip=t,n.prog=i,exports.DEBUG&&console.log(++n.step,"returning from",e)}function OJ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"CINDEX[]",t),e.push(e[e.length-t])}function FJ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"MINDEX[]",t),e.push(e.splice(e.length-t,1)[0])}function kJ(n){if(n.env!=="fpgm")throw new Error("FDEF not allowed here");var e=n.stack,t=n.prog,i=n.ip,r=e.pop(),s=i;for(exports.DEBUG&&console.log(n.step,"FDEF[]",r);t[++i]!==45;);n.ip=i,n.funcs[r]=t.slice(s+1,i)}function jS(n,e){var t=e.stack.pop(),i=e.z0[t],r=e.fv,s=e.pv;exports.DEBUG&&console.log(e.step,"MDAP["+n+"]",t);var a=s.distance(i,Zp);n&&(a=e.round(a)),r.setRelative(i,Zp,a,s),r.touch(i),e.rp0=e.rp1=t}function KS(n,e){var t=e.z2,i=t.length-2,r,s,a;exports.DEBUG&&console.log(e.step,"IUP["+n.axis+"]");for(var o=0;o<i;o++)r=t[o],!n.touched(r)&&(s=r.prevTouched(n),s!==r&&(a=r.nextTouched(n),s===a&&n.setRelative(r,r,n.distance(s,s,!1,!0),n,!0),n.interpolate(r,s,a,n)))}function $S(n,e){for(var t=e.stack,i=n?e.rp1:e.rp2,r=(n?e.z0:e.z1)[i],s=e.fv,a=e.pv,o=e.loop,l=e.z2;o--;){var c=t.pop(),u=l[c],h=a.distance(r,r,!1,!0);s.setRelative(u,u,h,a),s.touch(u),exports.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-o)+": ":"")+"SHP["+(n?"rp1":"rp2")+"]",c)}e.loop=1}function JS(n,e){var t=e.stack,i=n?e.rp1:e.rp2,r=(n?e.z0:e.z1)[i],s=e.fv,a=e.pv,o=t.pop(),l=e.z2[e.contours[o]],c=l;exports.DEBUG&&console.log(e.step,"SHC["+n+"]",o);var u=a.distance(r,r,!1,!0);do c!==r&&s.setRelative(c,c,u,a),c=c.nextPointOnContour;while(c!==l)}function ZS(n,e){var t=e.stack,i=n?e.rp1:e.rp2,r=(n?e.z0:e.z1)[i],s=e.fv,a=e.pv,o=t.pop();exports.DEBUG&&console.log(e.step,"SHZ["+n+"]",o);var l;switch(o){case 0:l=e.tZone;break;case 1:l=e.gZone;break;default:throw new Error("Invalid zone")}for(var c,u=a.distance(r,r,!1,!0),h=l.length-2,f=0;f<h;f++)c=l[f],s.setRelative(c,c,u,a)}function NJ(n){for(var e=n.stack,t=n.loop,i=n.fv,r=e.pop()/64,s=n.z2;t--;){var a=e.pop(),o=s[a];exports.DEBUG&&console.log(n.step,(n.loop>1?"loop "+(n.loop-t)+": ":"")+"SHPIX[]",a,r),i.setRelative(o,o,r),i.touch(o)}n.loop=1}function GJ(n){for(var e=n.stack,t=n.rp1,i=n.rp2,r=n.loop,s=n.z0[t],a=n.z1[i],o=n.fv,l=n.dpv,c=n.z2;r--;){var u=e.pop(),h=c[u];exports.DEBUG&&console.log(n.step,(n.loop>1?"loop "+(n.loop-r)+": ":"")+"IP[]",u,t,"<->",i),o.interpolate(h,s,a,l),o.touch(h)}n.loop=1}function e9(n,e){var t=e.stack,i=t.pop()/64,r=t.pop(),s=e.z1[r],a=e.z0[e.rp0],o=e.fv,l=e.pv;o.setRelative(s,a,i,l),o.touch(s),exports.DEBUG&&console.log(e.step,"MSIRP["+n+"]",i,r),e.rp1=e.rp0,e.rp2=r,n&&(e.rp0=r)}function zJ(n){for(var e=n.stack,t=n.rp0,i=n.z0[t],r=n.loop,s=n.fv,a=n.pv,o=n.z1;r--;){var l=e.pop(),c=o[l];exports.DEBUG&&console.log(n.step,(n.loop>1?"loop "+(n.loop-r)+": ":"")+"ALIGNRP[]",l),s.setRelative(c,i,0,a),s.touch(c)}n.loop=1}function QJ(n){exports.DEBUG&&console.log(n.step,"RTDG[]"),n.round=sJ}function t9(n,e){var t=e.stack,i=t.pop(),r=t.pop(),s=e.z0[r],a=e.fv,o=e.pv,l=e.cvt[i];exports.DEBUG&&console.log(e.step,"MIAP["+n+"]",i,"(",l,")",r);var c=o.distance(s,Zp);n&&(Math.abs(c-l)<e.cvCutIn&&(c=l),c=e.round(c)),a.setRelative(s,Zp,c,o),e.zp0===0&&(s.xo=s.x,s.yo=s.y),a.touch(s),e.rp0=e.rp1=r}function HJ(n){var e=n.prog,t=n.ip,i=n.stack,r=e[++t];exports.DEBUG&&console.log(n.step,"NPUSHB[]",r);for(var s=0;s<r;s++)i.push(e[++t]);n.ip=t}function VJ(n){var e=n.ip,t=n.prog,i=n.stack,r=t[++e];exports.DEBUG&&console.log(n.step,"NPUSHW[]",r);for(var s=0;s<r;s++){var a=t[++e]<<8|t[++e];a&32768&&(a=-((a^65535)+1)),i.push(a)}n.ip=e}function WJ(n){var e=n.stack,t=n.store;t||(t=n.store=[]);var i=e.pop(),r=e.pop();exports.DEBUG&&console.log(n.step,"WS",i,r),t[r]=i}function YJ(n){var e=n.stack,t=n.store,i=e.pop();exports.DEBUG&&console.log(n.step,"RS",i);var r=t&&t[i]||0;e.push(r)}function qJ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"WCVTP",t,i),n.cvt[i]=t/64}function XJ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"RCVT",t),e.push(n.cvt[t]*64)}function n9(n,e){var t=e.stack,i=t.pop(),r=e.z2[i];exports.DEBUG&&console.log(e.step,"GC["+n+"]",i),t.push(e.dpv.distance(r,Zp,n,!1)*64)}function i9(n,e){var t=e.stack,i=t.pop(),r=t.pop(),s=e.z1[i],a=e.z0[r],o=e.dpv.distance(a,s,n,n);exports.DEBUG&&console.log(e.step,"MD["+n+"]",i,r,"->",o),e.stack.push(Math.round(o*64))}function jJ(n){exports.DEBUG&&console.log(n.step,"MPPEM[]"),n.stack.push(n.ppem)}function KJ(n){exports.DEBUG&&console.log(n.step,"FLIPON[]"),n.autoFlip=!0}function $J(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"LT[]",t,i),e.push(i<t?1:0)}function JJ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"LTEQ[]",t,i),e.push(i<=t?1:0)}function ZJ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"GT[]",t,i),e.push(i>t?1:0)}function eZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"GTEQ[]",t,i),e.push(i>=t?1:0)}function tZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"EQ[]",t,i),e.push(t===i?1:0)}function nZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"NEQ[]",t,i),e.push(t!==i?1:0)}function iZ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"ODD[]",t),e.push(Math.trunc(t)%2?1:0)}function rZ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"EVEN[]",t),e.push(Math.trunc(t)%2?0:1)}function sZ(n){var e=n.stack.pop();exports.DEBUG&&console.log(n.step,"IF[]",e),e||(AR(n,!0),exports.DEBUG&&console.log(n.step,"EIF[]"))}function aZ(n){exports.DEBUG&&console.log(n.step,"EIF[]")}function oZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"AND[]",t,i),e.push(t&&i?1:0)}function lZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"OR[]",t,i),e.push(t||i?1:0)}function cZ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"NOT[]",t),e.push(t?0:1)}function r5(n,e){var t=e.stack,i=t.pop(),r=e.fv,s=e.pv,a=e.ppem,o=e.deltaBase+(n-1)*16,l=e.deltaShift,c=e.z0;exports.DEBUG&&console.log(e.step,"DELTAP["+n+"]",i,t);for(var u=0;u<i;u++){var h=t.pop(),f=t.pop(),p=o+((f&240)>>4);if(p===a){var m=(f&15)-8;m>=0&&m++,exports.DEBUG&&console.log(e.step,"DELTAPFIX",h,"by",m*l);var y=c[h];r.setRelative(y,y,m*l,s)}}}function uZ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"SDB[]",t),n.deltaBase=t}function hZ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"SDS[]",t),n.deltaShift=Math.pow(.5,t)}function fZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"ADD[]",t,i),e.push(i+t)}function dZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"SUB[]",t,i),e.push(i-t)}function pZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"DIV[]",t,i),e.push(i*64/t)}function gZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"MUL[]",t,i),e.push(i*t/64)}function mZ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"ABS[]",t),e.push(Math.abs(t))}function AZ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"NEG[]",t),e.push(-t)}function vZ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"FLOOR[]",t),e.push(Math.floor(t/64)*64)}function yZ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"CEILING[]",t),e.push(Math.ceil(t/64)*64)}function Hg(n,e){var t=e.stack,i=t.pop();exports.DEBUG&&console.log(e.step,"ROUND[]"),t.push(e.round(i/64)*64)}function xZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"WCVTF[]",t,i),n.cvt[i]=t*n.ppem/n.font.unitsPerEm}function s5(n,e){var t=e.stack,i=t.pop(),r=e.ppem,s=e.deltaBase+(n-1)*16,a=e.deltaShift;exports.DEBUG&&console.log(e.step,"DELTAC["+n+"]",i,t);for(var o=0;o<i;o++){var l=t.pop(),c=t.pop(),u=s+((c&240)>>4);if(u===r){var h=(c&15)-8;h>=0&&h++;var f=h*a;exports.DEBUG&&console.log(e.step,"DELTACFIX",l,"by",f),e.cvt[l]+=f}}}function _Z(n){var e=n.stack.pop();exports.DEBUG&&console.log(n.step,"SROUND[]",e),n.round=mR;var t;switch(e&192){case 0:t=.5;break;case 64:t=1;break;case 128:t=2;break;default:throw new Error("invalid SROUND value")}switch(n.srPeriod=t,e&48){case 0:n.srPhase=0;break;case 16:n.srPhase=.25*t;break;case 32:n.srPhase=.5*t;break;case 48:n.srPhase=.75*t;break;default:throw new Error("invalid SROUND value")}e&=15,e===0?n.srThreshold=0:n.srThreshold=(e/8-.5)*t}function EZ(n){var e=n.stack.pop();exports.DEBUG&&console.log(n.step,"S45ROUND[]",e),n.round=mR;var t;switch(e&192){case 0:t=Math.sqrt(2)/2;break;case 64:t=Math.sqrt(2);break;case 128:t=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(n.srPeriod=t,e&48){case 0:n.srPhase=0;break;case 16:n.srPhase=.25*t;break;case 32:n.srPhase=.5*t;break;case 48:n.srPhase=.75*t;break;default:throw new Error("invalid S45ROUND value")}e&=15,e===0?n.srThreshold=0:n.srThreshold=(e/8-.5)*t}function SZ(n){exports.DEBUG&&console.log(n.step,"ROFF[]"),n.round=rJ}function wZ(n){exports.DEBUG&&console.log(n.step,"RUTG[]"),n.round=oJ}function CZ(n){exports.DEBUG&&console.log(n.step,"RDTG[]"),n.round=lJ}function TZ(n){var e=n.stack.pop();exports.DEBUG&&console.log(n.step,"SCANCTRL[]",e)}function r9(n,e){var t=e.stack,i=t.pop(),r=t.pop(),s=e.z2[i],a=e.z1[r];exports.DEBUG&&console.log(e.step,"SDPVTL["+n+"]",i,r);var o,l;n?(o=s.y-a.y,l=a.x-s.x):(o=a.x-s.x,l=a.y-s.y),e.dpv=P0(o,l)}function bZ(n){var e=n.stack,t=e.pop(),i=0;exports.DEBUG&&console.log(n.step,"GETINFO[]",t),t&1&&(i=35),t&32&&(i|=4096),e.push(i)}function IZ(n){var e=n.stack,t=e.pop(),i=e.pop(),r=e.pop();exports.DEBUG&&console.log(n.step,"ROLL[]"),e.push(i),e.push(t),e.push(r)}function MZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"MAX[]",t,i),e.push(Math.max(i,t))}function RZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"MIN[]",t,i),e.push(Math.min(i,t))}function BZ(n){var e=n.stack.pop();exports.DEBUG&&console.log(n.step,"SCANTYPE[]",e)}function DZ(n){var e=n.stack.pop(),t=n.stack.pop();switch(exports.DEBUG&&console.log(n.step,"INSTCTRL[]",e,t),e){case 1:n.inhibitGridFit=!!t;return;case 2:n.ignoreCvt=!!t;return;default:throw new Error("invalid INSTCTRL[] selector")}}function vl(n,e){var t=e.stack,i=e.prog,r=e.ip;exports.DEBUG&&console.log(e.step,"PUSHB["+n+"]");for(var s=0;s<n;s++)t.push(i[++r]);e.ip=r}function yl(n,e){var t=e.ip,i=e.prog,r=e.stack;exports.DEBUG&&console.log(e.ip,"PUSHW["+n+"]");for(var s=0;s<n;s++){var a=i[++t]<<8|i[++t];a&32768&&(a=-((a^65535)+1)),r.push(a)}e.ip=t}function at(n,e,t,i,r,s){var a=s.stack,o=n&&a.pop(),l=a.pop(),c=s.rp0,u=s.z0[c],h=s.z1[l],f=s.minDis,p=s.fv,m=s.dpv,y,v,A,_;v=y=m.distance(h,u,!0,!0),A=v>=0?1:-1,v=Math.abs(v),n&&(_=s.cvt[o],i&&Math.abs(v-_)<s.cvCutIn&&(v=_)),t&&v<f&&(v=f),i&&(v=s.round(v)),p.setRelative(h,u,A*v,m),p.touch(h),exports.DEBUG&&console.log(s.step,(n?"MIRP[":"MDRP[")+(e?"M":"m")+(t?">":"_")+(i?"R":"_")+(r===0?"Gr":r===1?"Bl":r===2?"Wh":"")+"]",n?o+"("+s.cvt[o]+","+_+")":"",l,"(d =",y,"->",A*v,")"),s.rp1=s.rp0,s.rp2=l,e&&(s.rp0=l)}fR=[VS.bind(void 0,Fo),VS.bind(void 0,Qa),WS.bind(void 0,Fo),WS.bind(void 0,Qa),YS.bind(void 0,Fo),YS.bind(void 0,Qa),qS.bind(void 0,0),qS.bind(void 0,1),XS.bind(void 0,0),XS.bind(void 0,1),uJ,hJ,fJ,dJ,pJ,gJ,mJ,AJ,vJ,yJ,xJ,_J,EJ,SJ,wJ,CJ,TJ,bJ,IJ,MJ,void 0,void 0,RJ,i5,BJ,DJ,PJ,OJ,FJ,void 0,void 0,void 0,LJ,UJ,kJ,void 0,jS.bind(void 0,0),jS.bind(void 0,1),KS.bind(void 0,Fo),KS.bind(void 0,Qa),$S.bind(void 0,0),$S.bind(void 0,1),JS.bind(void 0,0),JS.bind(void 0,1),ZS.bind(void 0,0),ZS.bind(void 0,1),NJ,GJ,e9.bind(void 0,0),e9.bind(void 0,1),zJ,QJ,t9.bind(void 0,0),t9.bind(void 0,1),HJ,VJ,WJ,YJ,qJ,XJ,n9.bind(void 0,0),n9.bind(void 0,1),void 0,i9.bind(void 0,0),i9.bind(void 0,1),jJ,void 0,KJ,void 0,void 0,$J,JJ,ZJ,eZ,tZ,nZ,iZ,rZ,sZ,aZ,oZ,lZ,cZ,r5.bind(void 0,1),uZ,hZ,fZ,dZ,pZ,gZ,mZ,AZ,vZ,yZ,Hg.bind(void 0,0),Hg.bind(void 0,1),Hg.bind(void 0,2),Hg.bind(void 0,3),void 0,void 0,void 0,void 0,xZ,r5.bind(void 0,2),r5.bind(void 0,3),s5.bind(void 0,1),s5.bind(void 0,2),s5.bind(void 0,3),_Z,EZ,void 0,void 0,SZ,void 0,wZ,CZ,i5,i5,void 0,void 0,void 0,void 0,void 0,TZ,r9.bind(void 0,0),r9.bind(void 0,1),bZ,void 0,IZ,MZ,RZ,BZ,DZ,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,vl.bind(void 0,1),vl.bind(void 0,2),vl.bind(void 0,3),vl.bind(void 0,4),vl.bind(void 0,5),vl.bind(void 0,6),vl.bind(void 0,7),vl.bind(void 0,8),yl.bind(void 0,1),yl.bind(void 0,2),yl.bind(void 0,3),yl.bind(void 0,4),yl.bind(void 0,5),yl.bind(void 0,6),yl.bind(void 0,7),yl.bind(void 0,8),at.bind(void 0,0,0,0,0,0),at.bind(void 0,0,0,0,0,1),at.bind(void 0,0,0,0,0,2),at.bind(void 0,0,0,0,0,3),at.bind(void 0,0,0,0,1,0),at.bind(void 0,0,0,0,1,1),at.bind(void 0,0,0,0,1,2),at.bind(void 0,0,0,0,1,3),at.bind(void 0,0,0,1,0,0),at.bind(void 0,0,0,1,0,1),at.bind(void 0,0,0,1,0,2),at.bind(void 0,0,0,1,0,3),at.bind(void 0,0,0,1,1,0),at.bind(void 0,0,0,1,1,1),at.bind(void 0,0,0,1,1,2),at.bind(void 0,0,0,1,1,3),at.bind(void 0,0,1,0,0,0),at.bind(void 0,0,1,0,0,1),at.bind(void 0,0,1,0,0,2),at.bind(void 0,0,1,0,0,3),at.bind(void 0,0,1,0,1,0),at.bind(void 0,0,1,0,1,1),at.bind(void 0,0,1,0,1,2),at.bind(void 0,0,1,0,1,3),at.bind(void 0,0,1,1,0,0),at.bind(void 0,0,1,1,0,1),at.bind(void 0,0,1,1,0,2),at.bind(void 0,0,1,1,0,3),at.bind(void 0,0,1,1,1,0),at.bind(void 0,0,1,1,1,1),at.bind(void 0,0,1,1,1,2),at.bind(void 0,0,1,1,1,3),at.bind(void 0,1,0,0,0,0),at.bind(void 0,1,0,0,0,1),at.bind(void 0,1,0,0,0,2),at.bind(void 0,1,0,0,0,3),at.bind(void 0,1,0,0,1,0),at.bind(void 0,1,0,0,1,1),at.bind(void 0,1,0,0,1,2),at.bind(void 0,1,0,0,1,3),at.bind(void 0,1,0,1,0,0),at.bind(void 0,1,0,1,0,1),at.bind(void 0,1,0,1,0,2),at.bind(void 0,1,0,1,0,3),at.bind(void 0,1,0,1,1,0),at.bind(void 0,1,0,1,1,1),at.bind(void 0,1,0,1,1,2),at.bind(void 0,1,0,1,1,3),at.bind(void 0,1,1,0,0,0),at.bind(void 0,1,1,0,0,1),at.bind(void 0,1,1,0,0,2),at.bind(void 0,1,1,0,0,3),at.bind(void 0,1,1,0,1,0),at.bind(void 0,1,1,0,1,1),at.bind(void 0,1,1,0,1,2),at.bind(void 0,1,1,0,1,3),at.bind(void 0,1,1,1,0,0),at.bind(void 0,1,1,1,0,1),at.bind(void 0,1,1,1,0,2),at.bind(void 0,1,1,1,0,3),at.bind(void 0,1,1,1,1,0),at.bind(void 0,1,1,1,1,1),at.bind(void 0,1,1,1,1,2),at.bind(void 0,1,1,1,1,3)];function xf(n){this.char=n,this.state={},this.activeState=null}function u8(n,e,t){this.contextName=t,this.startIndex=n,this.endOffset=e}function PZ(n,e,t){this.contextName=n,this.openRange=null,this.ranges=[],this.checkStart=e,this.checkEnd=t}function pa(n,e){this.context=n,this.index=e,this.length=n.length,this.current=n[e],this.backtrack=n.slice(0,e),this.lookahead=n.slice(e+1)}function T1(n){this.eventId=n,this.subscribers=[]}function LZ(n){var e=this,t=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];t.forEach(function(r){Object.defineProperty(e.events,r,{value:new T1(r)})}),n&&t.forEach(function(r){var s=n[r];typeof s=="function"&&e.events[r].subscribe(s)});var i=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];i.forEach(function(r){e.events[r].subscribe(e.updateContextsRanges)})}function ui(n){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],LZ.call(this,n)}xf.prototype.setState=function(n,e){return this.state[n]=e,this.activeState={key:n,value:this.state[n]},this.activeState};xf.prototype.getState=function(n){return this.state[n]||null};ui.prototype.inboundIndex=function(n){return n>=0&&n<this.tokens.length};ui.prototype.composeRUD=function(n){var e=this,t=!0,i=n.map(function(s){return e[s[0]].apply(e,s.slice(1).concat(t))}),r=function(s){return typeof s=="object"&&s.hasOwnProperty("FAIL")};if(i.every(r))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:i.filter(r)};this.dispatch("composeRUD",[i.filter(function(s){return!r(s)})])};ui.prototype.replaceRange=function(n,e,t,i){e=e!==null?e:this.tokens.length;var r=t.every(function(a){return a instanceof xf});if(!isNaN(n)&&this.inboundIndex(n)&&r){var s=this.tokens.splice.apply(this.tokens,[n,e].concat(t));return i||this.dispatch("replaceToken",[n,e,t]),[s,t]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}};ui.prototype.replaceToken=function(n,e,t){if(!isNaN(n)&&this.inboundIndex(n)&&e instanceof xf){var i=this.tokens.splice(n,1,e);return t||this.dispatch("replaceToken",[n,e]),[i[0],e]}else return{FAIL:"replaceToken: invalid token or index."}};ui.prototype.removeRange=function(n,e,t){e=isNaN(e)?this.tokens.length:e;var i=this.tokens.splice(n,e);return t||this.dispatch("removeRange",[i,n,e]),i};ui.prototype.removeToken=function(n,e){if(!isNaN(n)&&this.inboundIndex(n)){var t=this.tokens.splice(n,1);return e||this.dispatch("removeToken",[t,n]),t}else return{FAIL:"removeToken: invalid token index."}};ui.prototype.insertToken=function(n,e,t){var i=n.every(function(r){return r instanceof xf});return i?(this.tokens.splice.apply(this.tokens,[e,0].concat(n)),t||this.dispatch("insertToken",[n,e]),n):{FAIL:"insertToken: invalid token(s)."}};ui.prototype.registerModifier=function(n,e,t){this.events.newToken.subscribe(function(i,r){var s=[i,r],a=e===null||e.apply(this,s)===!0,o=[i,r];if(a){var l=t.apply(this,o);i.setState(n,l)}}),this.registeredModifiers.push(n)};T1.prototype.subscribe=function(n){return typeof n=="function"?this.subscribers.push(n)-1:{FAIL:"invalid '"+this.eventId+"' event handler"}};T1.prototype.unsubscribe=function(n){this.subscribers.splice(n,1)};pa.prototype.setCurrentIndex=function(n){this.index=n,this.current=this.context[n],this.backtrack=this.context.slice(0,n),this.lookahead=this.context.slice(n+1)};pa.prototype.get=function(n){switch(!0){case n===0:return this.current;case(n<0&&Math.abs(n)<=this.backtrack.length):return this.backtrack.slice(n)[0];case(n>0&&n<=this.lookahead.length):return this.lookahead[n-1];default:return null}};ui.prototype.rangeToText=function(n){if(n instanceof u8)return this.getRangeTokens(n).map(function(e){return e.char}).join("")};ui.prototype.getText=function(){return this.tokens.map(function(n){return n.char}).join("")};ui.prototype.getContext=function(n){var e=this.registeredContexts[n];return e||null};ui.prototype.on=function(n,e){var t=this.events[n];return t?t.subscribe(e):null};ui.prototype.dispatch=function(n,e){var t=this,i=this.events[n];i instanceof T1&&i.subscribers.forEach(function(r){r.apply(t,e||[])})};ui.prototype.registerContextChecker=function(n,e,t){if(this.getContext(n))return{FAIL:"context name '"+n+"' is already registered."};if(typeof e!="function")return{FAIL:"missing context start check."};if(typeof t!="function")return{FAIL:"missing context end check."};var i=new PZ(n,e,t);return this.registeredContexts[n]=i,this.contextCheckers.push(i),i};ui.prototype.getRangeTokens=function(n){var e=n.startIndex+n.endOffset;return[].concat(this.tokens.slice(n.startIndex,e))};ui.prototype.getContextRanges=function(n){var e=this.getContext(n);return e?e.ranges:{FAIL:"context checker '"+n+"' is not registered."}};ui.prototype.resetContextsRanges=function(){var n=this.registeredContexts;for(var e in n)if(n.hasOwnProperty(e)){var t=n[e];t.ranges=[]}};ui.prototype.updateContextsRanges=function(){this.resetContextsRanges();for(var n=this.tokens.map(function(i){return i.char}),e=0;e<n.length;e++){var t=new pa(n,e);this.runContextCheck(t)}this.dispatch("updateContextsRanges",[this.registeredContexts])};ui.prototype.setEndOffset=function(n,e){var t=this.getContext(e).openRange.startIndex,i=new u8(t,n,e),r=this.getContext(e).ranges;return i.rangeId=e+"."+r.length,r.push(i),this.getContext(e).openRange=null,i};ui.prototype.runContextCheck=function(n){var e=this,t=n.index;this.contextCheckers.forEach(function(i){var r=i.contextName,s=e.getContext(r).openRange;if(!s&&i.checkStart(n)&&(s=new u8(t,null,r),e.getContext(r).openRange=s,e.dispatch("contextStart",[r,t])),s&&i.checkEnd(n)){var a=t-s.startIndex+1,o=e.setEndOffset(a,r);e.dispatch("contextEnd",[r,o])}})};ui.prototype.tokenize=function(n){this.tokens=[],this.resetContextsRanges();var e=Array.from(n);this.dispatch("start");for(var t=0;t<e.length;t++){var i=e[t],r=new pa(e,t);this.dispatch("next",[r]),this.runContextCheck(r);var s=new xf(i);this.tokens.push(s),this.dispatch("newToken",[s,r])}return this.dispatch("end",[this.tokens]),this.tokens};function Ol(n){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(n)}function vR(n){return/[\u0630\u0690\u0621\u0631\u0661\u0671\u0622\u0632\u0672\u0692\u06C2\u0623\u0673\u0693\u06C3\u0624\u0694\u06C4\u0625\u0675\u0695\u06C5\u06E5\u0676\u0696\u06C6\u0627\u0677\u0697\u06C7\u0648\u0688\u0698\u06C8\u0689\u0699\u06C9\u068A\u06CA\u066B\u068B\u06CB\u068C\u068D\u06CD\u06FD\u068E\u06EE\u06FE\u062F\u068F\u06CF\u06EF]/.test(n)}function zl(n){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(n)}function xm(n){return/[A-z]/.test(n)}function UZ(n){return/\s/.test(n)}function vs(n){this.font=n,this.features={}}function zc(n){this.id=n.id,this.tag=n.tag,this.substitution=n.substitution}function L0(n,e){if(!n)return-1;switch(e.format){case 1:return e.glyphs.indexOf(n);case 2:for(var t=e.ranges,i=0;i<t.length;i++){var r=t[i];if(n>=r.start&&n<=r.end){var s=n-r.start;return r.index+s}}break;default:return-1}return-1}function OZ(n,e){var t=L0(n,e.coverage);return t===-1?null:n+e.deltaGlyphId}function FZ(n,e){var t=L0(n,e.coverage);return t===-1?null:e.substitute[t]}function a5(n,e){for(var t=[],i=0;i<n.length;i++){var r=n[i],s=e.current;s=Array.isArray(s)?s[0]:s;var a=L0(s,r);a!==-1&&t.push(a)}return t.length!==n.length?-1:t}function kZ(n,e){var t=e.inputCoverage.length+e.lookaheadCoverage.length+e.backtrackCoverage.length;if(n.context.length<t)return[];var i=a5(e.inputCoverage,n);if(i===-1)return[];var r=e.inputCoverage.length-1;if(n.lookahead.length<e.lookaheadCoverage.length)return[];for(var s=n.lookahead.slice(r);s.length&&zl(s[0].char);)s.shift();var a=new pa(s,0),o=a5(e.lookaheadCoverage,a),l=[].concat(n.backtrack);for(l.reverse();l.length&&zl(l[0].char);)l.shift();if(l.length<e.backtrackCoverage.length)return[];var c=new pa(l,0),u=a5(e.backtrackCoverage,c),h=i.length===e.inputCoverage.length&&o.length===e.lookaheadCoverage.length&&u.length===e.backtrackCoverage.length,f=[];if(h)for(var p=0;p<e.lookupRecords.length;p++)for(var m=e.lookupRecords[p],y=m.lookupListIndex,v=this.getLookupByIndex(y),A=0;A<v.subtables.length;A++){var _=v.subtables[A],x=this.getLookupMethod(v,_),E=this.getSubstitutionType(v,_);if(E==="12")for(var w=0;w<i.length;w++){var I=n.get(w),T=x(I);T&&f.push(T)}}return f}function NZ(n,e){var t=n.current,i=L0(t,e.coverage);if(i===-1)return null;for(var r,s=e.ligatureSets[i],a=0;a<s.length;a++){r=s[a];for(var o=0;o<r.components.length;o++){var l=n.lookahead[o],c=r.components[o];if(l!==c)break;if(o===r.components.length-1)return r}}return null}function GZ(n,e){var t=L0(n,e.coverage);return t===-1?null:e.sequences[t]}vs.prototype.getDefaultScriptFeaturesIndexes=function(){for(var n=this.font.tables.gsub.scripts,e=0;e<n.length;e++){var t=n[e];if(t.tag==="DFLT")return t.script.defaultLangSys.featureIndexes}return[]};vs.prototype.getScriptFeaturesIndexes=function(n){var e=this.font.tables;if(!e.gsub)return[];if(!n)return this.getDefaultScriptFeaturesIndexes();for(var t=this.font.tables.gsub.scripts,i=0;i<t.length;i++){var r=t[i];if(r.tag===n&&r.script.defaultLangSys)return r.script.defaultLangSys.featureIndexes;var s=r.langSysRecords;if(s)for(var a=0;a<s.length;a++){var o=s[a];if(o.tag===n){var l=o.langSys;return l.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()};vs.prototype.mapTagsToFeatures=function(n,e){for(var t={},i=0;i<n.length;i++){var r=n[i].tag,s=n[i].feature;t[r]=s}this.features[e].tags=t};vs.prototype.getScriptFeatures=function(n){var e=this.features[n];if(this.features.hasOwnProperty(n))return e;var t=this.getScriptFeaturesIndexes(n);if(!t)return null;var i=this.font.tables.gsub;return e=t.map(function(r){return i.features[r]}),this.features[n]=e,this.mapTagsToFeatures(e,n),e};vs.prototype.getSubstitutionType=function(n,e){var t=n.lookupType.toString(),i=e.substFormat.toString();return t+i};vs.prototype.getLookupMethod=function(n,e){var t=this,i=this.getSubstitutionType(n,e);switch(i){case"11":return function(r){return OZ.apply(t,[r,e])};case"12":return function(r){return FZ.apply(t,[r,e])};case"63":return function(r){return kZ.apply(t,[r,e])};case"41":return function(r){return NZ.apply(t,[r,e])};case"21":return function(r){return GZ.apply(t,[r,e])};default:throw new Error("lookupType: "+n.lookupType+" - substFormat: "+e.substFormat+" is not yet supported")}};vs.prototype.lookupFeature=function(n){var e=n.contextParams,t=e.index,i=this.getFeature({tag:n.tag,script:n.script});if(!i)return new Error("font '"+this.font.names.fullName.en+"' doesn't support feature '"+n.tag+"' for script '"+n.script+"'.");for(var r=this.getFeatureLookups(i),s=[].concat(e.context),a=0;a<r.length;a++)for(var o=r[a],l=this.getLookupSubtables(o),c=0;c<l.length;c++){var u=l[c],h=this.getSubstitutionType(o,u),f=this.getLookupMethod(o,u),p=void 0;switch(h){case"11":p=f(e.current),p&&s.splice(t,1,new zc({id:11,tag:n.tag,substitution:p}));break;case"12":p=f(e.current),p&&s.splice(t,1,new zc({id:12,tag:n.tag,substitution:p}));break;case"63":p=f(e),Array.isArray(p)&&p.length&&s.splice(t,1,new zc({id:63,tag:n.tag,substitution:p}));break;case"41":p=f(e),p&&s.splice(t,1,new zc({id:41,tag:n.tag,substitution:p}));break;case"21":p=f(e.current),p&&s.splice(t,1,new zc({id:21,tag:n.tag,substitution:p}));break}e=new pa(s,t),!(Array.isArray(p)&&!p.length)&&(p=null)}return s.length?s:null};vs.prototype.supports=function(n){if(!n.script)return!1;this.getScriptFeatures(n.script);var e=this.features.hasOwnProperty(n.script);if(!n.tag)return e;var t=this.features[n.script].some(function(i){return i.tag===n.tag});return e&&t};vs.prototype.getLookupSubtables=function(n){return n.subtables||null};vs.prototype.getLookupByIndex=function(n){var e=this.font.tables.gsub.lookups;return e[n]||null};vs.prototype.getFeatureLookups=function(n){return n.lookupListIndexes.map(this.getLookupByIndex.bind(this))};vs.prototype.getFeature=function(e){if(!this.font)return{FAIL:"No font was found"};this.features.hasOwnProperty(e.script)||this.getScriptFeatures(e.script);var t=this.features[e.script];return t?t.tags[e.tag]?this.features[e.script].tags[e.tag]:null:{FAIL:"No feature for script "+e.script}};function zZ(n){var e=n.current,t=n.get(-1);return t===null&&Ol(e)||!Ol(t)&&Ol(e)}function QZ(n){var e=n.get(1);return e===null||!Ol(e)}var HZ={startCheck:zZ,endCheck:QZ};function VZ(n){var e=n.current,t=n.get(-1);return(Ol(e)||zl(e))&&!Ol(t)}function WZ(n){var e=n.get(1);switch(!0){case e===null:return!0;case(!Ol(e)&&!zl(e)):var t=UZ(e);if(!t)return!0;if(t){var i=!1;if(i=n.lookahead.some(function(r){return Ol(r)||zl(r)}),!i)return!0}break;default:return!1}}var YZ={startCheck:VZ,endCheck:WZ};function qZ(n,e,t){e[t].setState(n.tag,n.substitution)}function XZ(n,e,t){e[t].setState(n.tag,n.substitution)}function jZ(n,e,t){n.substitution.forEach(function(i,r){var s=e[t+r];s.setState(n.tag,i)})}function KZ(n,e,t){var i=e[t];i.setState(n.tag,n.substitution.ligGlyph);for(var r=n.substitution.components.length,s=0;s<r;s++)i=e[t+s+1],i.setState("deleted",!0)}var s9={11:qZ,12:XZ,63:jZ,41:KZ};function h8(n,e,t){n instanceof zc&&s9[n.id]&&s9[n.id](n,e,t)}function $Z(n){for(var e=[].concat(n.backtrack),t=e.length-1;t>=0;t--){var i=e[t],r=vR(i),s=zl(i);if(!r&&!s)return!0;if(r)return!1}return!1}function JZ(n){if(vR(n.current))return!1;for(var e=0;e<n.lookahead.length;e++){var t=n.lookahead[e],i=zl(t);if(!i)return!0}return!1}function ZZ(n){var e=this,t="arab",i=this.featuresTags[t],r=this.tokenizer.getRangeTokens(n);if(r.length!==1){var s=new pa(r.map(function(o){return o.getState("glyphIndex")}),0),a=new pa(r.map(function(o){return o.char}),0);r.forEach(function(o,l){if(!zl(o.char)){s.setCurrentIndex(l),a.setCurrentIndex(l);var c=0;$Z(a)&&(c|=1),JZ(a)&&(c|=2);var u;switch(c){case 1:u="fina";break;case 2:u="init";break;case 3:u="medi";break}if(i.indexOf(u)!==-1){var h=e.query.lookupFeature({tag:u,script:t,contextParams:s});if(h instanceof Error)return console.info(h.message);h.forEach(function(f,p){f instanceof zc&&(h8(f,r,p),s.context[p]=f.substitution)})}}})}}function a9(n,e){var t=n.map(function(i){return i.activeState.value});return new pa(t,e||0)}function eee(n){var e=this,t="arab",i=this.tokenizer.getRangeTokens(n),r=a9(i);r.context.forEach(function(s,a){r.setCurrentIndex(a);var o=e.query.lookupFeature({tag:"rlig",script:t,contextParams:r});o.length&&(o.forEach(function(l){return h8(l,i,a)}),r=a9(i))})}function tee(n){var e=n.current,t=n.get(-1);return t===null&&xm(e)||!xm(t)&&xm(e)}function nee(n){var e=n.get(1);return e===null||!xm(e)}var iee={startCheck:tee,endCheck:nee};function o9(n,e){var t=n.map(function(i){return i.activeState.value});return new pa(t,e||0)}function ree(n){var e=this,t="latn",i=this.tokenizer.getRangeTokens(n),r=o9(i);r.context.forEach(function(s,a){r.setCurrentIndex(a);var o=e.query.lookupFeature({tag:"liga",script:t,contextParams:r});o.length&&(o.forEach(function(l){return h8(l,i,a)}),r=o9(i))})}function xa(n){this.baseDir=n||"ltr",this.tokenizer=new ui,this.featuresTags={}}xa.prototype.setText=function(n){this.text=n};xa.prototype.contextChecks={latinWordCheck:iee,arabicWordCheck:HZ,arabicSentenceCheck:YZ};function o5(n){var e=this.contextChecks[n+"Check"];return this.tokenizer.registerContextChecker(n,e.startCheck,e.endCheck)}function see(){return o5.call(this,"latinWord"),o5.call(this,"arabicWord"),o5.call(this,"arabicSentence"),this.tokenizer.tokenize(this.text)}function aee(){var n=this,e=this.tokenizer.getContextRanges("arabicSentence");e.forEach(function(t){var i=n.tokenizer.getRangeTokens(t);n.tokenizer.replaceRange(t.startIndex,t.endOffset,i.reverse())})}xa.prototype.registerFeatures=function(n,e){var t=this,i=e.filter(function(r){return t.query.supports({script:n,tag:r})});this.featuresTags.hasOwnProperty(n)?this.featuresTags[n]=this.featuresTags[n].concat(i):this.featuresTags[n]=i};xa.prototype.applyFeatures=function(n,e){if(!n)throw new Error("No valid font was provided to apply features");this.query||(this.query=new vs(n));for(var t=0;t<e.length;t++){var i=e[t];this.query.supports({script:i.script})&&this.registerFeatures(i.script,i.tags)}};xa.prototype.registerModifier=function(n,e,t){this.tokenizer.registerModifier(n,e,t)};function f8(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function oee(){var n=this,e="arab";if(this.featuresTags.hasOwnProperty(e)){f8.call(this);var t=this.tokenizer.getContextRanges("arabicWord");t.forEach(function(i){ZZ.call(n,i)})}}function lee(){var n=this,e="arab";if(this.featuresTags.hasOwnProperty(e)){var t=this.featuresTags[e];if(t.indexOf("rlig")!==-1){f8.call(this);var i=this.tokenizer.getContextRanges("arabicWord");i.forEach(function(r){eee.call(n,r)})}}}function cee(){var n=this,e="latn";if(this.featuresTags.hasOwnProperty(e)){var t=this.featuresTags[e];if(t.indexOf("liga")!==-1){f8.call(this);var i=this.tokenizer.getContextRanges("latinWord");i.forEach(function(r){ree.call(n,r)})}}}xa.prototype.checkContextReady=function(n){return!!this.tokenizer.getContext(n)};xa.prototype.applyFeaturesToContexts=function(){this.checkContextReady("arabicWord")&&(oee.call(this),lee.call(this)),this.checkContextReady("latinWord")&&cee.call(this),this.checkContextReady("arabicSentence")&&aee.call(this)};xa.prototype.processText=function(n){(!this.text||this.text!==n)&&(this.setText(n),see.call(this),this.applyFeaturesToContexts())};xa.prototype.getBidiText=function(n){return this.processText(n),this.tokenizer.getText()};xa.prototype.getTextGlyphs=function(n){this.processText(n);for(var e=[],t=0;t<this.tokenizer.tokens.length;t++){var i=this.tokenizer.tokens[t];if(!i.state.deleted){var r=i.activeState.value;e.push(Array.isArray(r)?r[0]:r)}}return e};function kn(n){n=n||{},n.tables=n.tables||{},n.empty||(xd(n.familyName,"When creating a new Font object, familyName is required."),xd(n.styleName,"When creating a new Font object, styleName is required."),xd(n.unitsPerEm,"When creating a new Font object, unitsPerEm is required."),xd(n.ascender,"When creating a new Font object, ascender is required."),xd(n.descender<=0,"When creating a new Font object, negative descender value is required."),this.names={fontFamily:{en:n.familyName||" "},fontSubfamily:{en:n.styleName||" "},fullName:{en:n.fullName||n.familyName+" "+n.styleName},postScriptName:{en:n.postScriptName||(n.familyName+n.styleName).replace(/\s/g,"")},designer:{en:n.designer||" "},designerURL:{en:n.designerURL||" "},manufacturer:{en:n.manufacturer||" "},manufacturerURL:{en:n.manufacturerURL||" "},license:{en:n.license||" "},licenseURL:{en:n.licenseURL||" "},version:{en:n.version||"Version 0.1"},description:{en:n.description||" "},copyright:{en:n.copyright||" "},trademark:{en:n.trademark||" "}},this.unitsPerEm=n.unitsPerEm||1e3,this.ascender=n.ascender,this.descender=n.descender,this.createdTimestamp=n.createdTimestamp,this.tables=Object.assign(n.tables,{os2:Object.assign({usWeightClass:n.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:n.widthClass||this.usWidthClasses.MEDIUM,fsSelection:n.fsSelection||this.fsSelectionValues.REGULAR},n.tables.os2)})),this.supported=!0,this.glyphs=new Xa.GlyphSet(this,n.glyphs||[]),this.encoding=new jM(this),this.position=new B0(this),this.substitution=new As(this),this.tables=this.tables||{},this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){if(this._hinting)return this._hinting;if(this.outlinesFormat==="truetype")return this._hinting=new pR(this)}})}kn.prototype.hasChar=function(n){return this.encoding.charToGlyphIndex(n)!==null};kn.prototype.charToGlyphIndex=function(n){return this.encoding.charToGlyphIndex(n)};kn.prototype.charToGlyph=function(n){var e=this.charToGlyphIndex(n),t=this.glyphs.get(e);return t||(t=this.glyphs.get(0)),t};kn.prototype.updateFeatures=function(n){return this.defaultRenderOptions.features.map(function(e){return e.script==="latn"?{script:"latn",tags:e.tags.filter(function(t){return n[t]})}:e})};kn.prototype.stringToGlyphs=function(n,e){var t=this,i=new xa,r=function(h){return t.charToGlyphIndex(h.char)};i.registerModifier("glyphIndex",null,r);var s=e?this.updateFeatures(e.features):this.defaultRenderOptions.features;i.applyFeatures(this,s);for(var a=i.getTextGlyphs(n),o=a.length,l=new Array(o),c=this.glyphs.get(0),u=0;u<o;u+=1)l[u]=this.glyphs.get(a[u])||c;return l};kn.prototype.nameToGlyphIndex=function(n){return this.glyphNames.nameToGlyphIndex(n)};kn.prototype.nameToGlyph=function(n){var e=this.nameToGlyphIndex(n),t=this.glyphs.get(e);return t||(t=this.glyphs.get(0)),t};kn.prototype.glyphIndexToName=function(n){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(n):""};kn.prototype.getKerningValue=function(n,e){n=n.index||n,e=e.index||e;var t=this.position.defaultKerningTables;return t?this.position.getKerningValue(t,n,e):this.kerningPairs[n+","+e]||0};kn.prototype.defaultRenderOptions={kerning:!0,features:[{script:"arab",tags:["init","medi","fina","rlig"]},{script:"latn",tags:["liga","rlig"]}]};kn.prototype.forEachGlyph=function(n,e,t,i,r,s){e=e!==void 0?e:0,t=t!==void 0?t:0,i=i!==void 0?i:72,r=Object.assign({},this.defaultRenderOptions,r);var a=1/this.unitsPerEm*i,o=this.stringToGlyphs(n,r),l;if(r.kerning){var c=r.script||this.position.getDefaultScriptName();l=this.position.getKerningTables(c,r.language)}for(var u=0;u<o.length;u+=1){var h=o[u];if(s.call(this,h,e,t,i,r),h.advanceWidth&&(e+=h.advanceWidth*a),r.kerning&&u<o.length-1){var f=l?this.position.getKerningValue(l,h.index,o[u+1].index):this.getKerningValue(h,o[u+1]);e+=f*a}r.letterSpacing?e+=r.letterSpacing*i:r.tracking&&(e+=r.tracking/1e3*i)}return e};kn.prototype.getPath=function(n,e,t,i,r){var s=new Li;return this.forEachGlyph(n,e,t,i,r,function(a,o,l,c){var u=a.getPath(o,l,c,r,this);s.extend(u)}),s};kn.prototype.getPaths=function(n,e,t,i,r){var s=[];return this.forEachGlyph(n,e,t,i,r,function(a,o,l,c){var u=a.getPath(o,l,c,r,this);s.push(u)}),s};kn.prototype.getAdvanceWidth=function(n,e,t){return this.forEachGlyph(n,0,0,e,t,function(){})};kn.prototype.draw=function(n,e,t,i,r,s){this.getPath(e,t,i,r,s).draw(n)};kn.prototype.drawPoints=function(n,e,t,i,r,s){this.forEachGlyph(e,t,i,r,s,function(a,o,l,c){a.drawPoints(n,o,l,c)})};kn.prototype.drawMetrics=function(n,e,t,i,r,s){this.forEachGlyph(e,t,i,r,s,function(a,o,l,c){a.drawMetrics(n,o,l,c)})};kn.prototype.getEnglishName=function(n){var e=this.names[n];if(e)return e.en};kn.prototype.validate=function(){var n=this;function e(i,r){}function t(i){var r=n.getEnglishName(i);r&&r.trim().length>0}t("fontFamily"),t("weightName"),t("manufacturer"),t("copyright"),t("version"),this.unitsPerEm>0};kn.prototype.toTables=function(){return j$.fontToTable(this)};kn.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()};kn.prototype.toArrayBuffer=function(){for(var n=this.toTables(),e=n.encode(),t=new ArrayBuffer(e.length),i=new Uint8Array(t),r=0;r<e.length;r++)i[r]=e[r];return t};kn.prototype.download=function(n){var e=this.getEnglishName("fontFamily"),t=this.getEnglishName("fontSubfamily");n=n||e.replace(/\s/g,"")+"-"+t+".otf";var i=this.toArrayBuffer();if($$())if(window.URL=window.URL||window.webkitURL,window.URL){var r=new DataView(i),s=new Blob([r],{type:"font/opentype"}),a=document.createElement("a");a.href=window.URL.createObjectURL(s),a.download=n;var o=document.createEvent("MouseEvents");o.initEvent("click",!0,!1),a.dispatchEvent(o)}else console.warn("Font file could not be downloaded. Try using a different browser.");else{var l=require("fs"),c=J$(i);l.writeFileSync(n,c)}};kn.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512};kn.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9};kn.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};var $o=new Array(10);$o[1]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{posFormat:1,coverage:this.parsePointer(Te.coverage),value:this.parseValueRecord()};if(t===2)return{posFormat:2,coverage:this.parsePointer(Te.coverage),values:this.parseValueRecordList()};Lt.assert(!1,"0x"+e.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")};$o[2]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();Lt.assert(t===1||t===2,"0x"+e.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");var i=this.parsePointer(Te.coverage),r=this.parseUShort(),s=this.parseUShort();if(t===1)return{posFormat:t,coverage:i,valueFormat1:r,valueFormat2:s,pairSets:this.parseList(Te.pointer(Te.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(r),value2:this.parseValueRecord(s)}})))};if(t===2){var a=this.parsePointer(Te.classDef),o=this.parsePointer(Te.classDef),l=this.parseUShort(),c=this.parseUShort();return{posFormat:t,coverage:i,valueFormat1:r,valueFormat2:s,classDef1:a,classDef2:o,class1Count:l,class2Count:c,classRecords:this.parseList(l,Te.list(c,function(){return{value1:this.parseValueRecord(r),value2:this.parseValueRecord(s)}}))}}};$o[3]=function(){return{error:"GPOS Lookup 3 not supported"}};$o[4]=function(){return{error:"GPOS Lookup 4 not supported"}};$o[5]=function(){return{error:"GPOS Lookup 5 not supported"}};$o[6]=function(){return{error:"GPOS Lookup 6 not supported"}};$o[7]=function(){return{error:"GPOS Lookup 7 not supported"}};$o[8]=function(){return{error:"GPOS Lookup 8 not supported"}};$o[9]=function(){return{error:"GPOS Lookup 9 not supported"}};new Array(10);var uee=Object.defineProperty,hee=(n,e,t)=>e in n?uee(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ut=(n,e,t)=>(hee(n,typeof e!="symbol"?e+"":e,t),t);const Vg=(n,e)=>{const t=n[0].index!==null,i=new Set(Object.keys(n[0].attributes)),r=new Set(Object.keys(n[0].morphAttributes)),s={},a={},o=n[0].morphTargetsRelative,l=new Bt;let c=0;if(n.forEach((u,h)=>{let f=0;if(t!==(u.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let p in u.attributes){if(!i.has(p))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;s[p]===void 0&&(s[p]=[]),s[p].push(u.attributes[p]),f++}if(f!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(o!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let p in u.morphAttributes){if(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;a[p]===void 0&&(a[p]=[]),a[p].push(u.morphAttributes[p])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(u.userData),e){let p;if(u.index)p=u.index.count;else if(u.attributes.position!==void 0)p=u.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,p,h),c+=p}}),t){let u=0;const h=[];n.forEach(f=>{const p=f.index;for(let m=0;m<p.count;++m)h.push(p.getX(m)+u);u+=f.attributes.position.count}),l.setIndex(h)}for(let u in s){const h=l9(s[u]);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,h)}for(let u in a){const h=a[u][0].length;if(h===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let f=0;f<h;++f){const p=[];for(let y=0;y<a[u].length;++y)p.push(a[u][y][f]);const m=l9(p);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(m)}}return l},l9=n=>{let e,t,i,r=0;if(n.forEach(s=>{if(e===void 0&&(e=s.array.constructor),e!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=s.itemSize),t!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=s.normalized),i!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;r+=s.array.length}),e&&t){const s=new e(r);let a=0;return n.forEach(o=>{s.set(o.array,a),a+=o.array.length}),new En(s,t,i)}};new He;const yR=class{parse(n,e={decodeSpeed:5,encodeSpeed:5,encoderMethod:yR.MESH_EDGEBREAKER_ENCODING,quantization:[16,8,8,8,8],exportUvs:!0,exportNormals:!0,exportColor:!1}){if(n instanceof Bt&&n.isBufferGeometry)throw new Error("DRACOExporter: The first parameter of parse() is now an instance of Mesh or Points.");if(DracoEncoderModule===void 0)throw new Error("THREE.DRACOExporter: required the draco_encoder to work.");const t=n.geometry,i=DracoEncoderModule(),r=new i.Encoder;let s,a;if(!t.isBufferGeometry)throw new Error("THREE.DRACOExporter.parse(geometry, options): geometry is not a THREE.BufferGeometry instance.");if(n instanceof nn&&n.isMesh){s=new i.MeshBuilder,a=new i.Mesh;const f=t.getAttribute("position");s.AddFloatAttributeToMesh(a,i.POSITION,f.count,f.itemSize,f.array);const p=t.getIndex();if(p!==null)s.AddFacesToMesh(a,p.count/3,p.array);else{const m=new(f.count>65535?Uint32Array:Uint16Array)(f.count);for(let y=0;y<m.length;y++)m[y]=y;s.AddFacesToMesh(a,f.count,m)}if(e.exportNormals){const m=t.getAttribute("normal");m!==void 0&&s.AddFloatAttributeToMesh(a,i.NORMAL,m.count,m.itemSize,m.array)}if(e.exportUvs){const m=t.getAttribute("uv");m!==void 0&&s.AddFloatAttributeToMesh(a,i.TEX_COORD,m.count,m.itemSize,m.array)}if(e.exportColor){const m=t.getAttribute("color");m!==void 0&&s.AddFloatAttributeToMesh(a,i.COLOR,m.count,m.itemSize,m.array)}}else if(n instanceof N6&&n.isPoints){s=new i.PointCloudBuilder,a=new i.PointCloud;const f=t.getAttribute("position");if(s.AddFloatAttribute(a,i.POSITION,f.count,f.itemSize,f.array),e.exportColor){const p=t.getAttribute("color");p!==void 0&&s.AddFloatAttribute(a,i.COLOR,p.count,p.itemSize,p.array)}}else throw new Error("DRACOExporter: Unsupported object type.");const o=new i.DracoInt8Array,l=e.encodeSpeed!==void 0?e.encodeSpeed:5,c=e.decodeSpeed!==void 0?e.decodeSpeed:5;if(r.SetSpeedOptions(l,c),e.encoderMethod!==void 0&&r.SetEncodingMethod(e.encoderMethod),e.quantization!==void 0)for(let f=0;f<5;f++)e.quantization[f]!==void 0&&r.SetAttributeQuantization(f,e.quantization[f]);let u;if(n instanceof nn&&n.isMesh?u=r.EncodeMeshToDracoBuffer(a,o):u=r.EncodePointCloudToDracoBuffer(a,!0,o),i.destroy(a),u===0)throw new Error("THREE.DRACOExporter: Draco encoding failed.");const h=new Int8Array(new ArrayBuffer(u));for(let f=0;f<u;f++)h[f]=o.GetValue(f);return i.destroy(o),i.destroy(r),i.destroy(s),h}};let no=yR;ut(no,"MESH_EDGEBREAKER_ENCODING",1);ut(no,"MESH_SEQUENTIAL_ENCODING",0);ut(no,"POINT_CLOUD",0);ut(no,"TRIANGULAR_MESH",1);ut(no,"INVALID",-1);ut(no,"POSITION",0);ut(no,"NORMAL",1);ut(no,"COLOR",2);ut(no,"TEX_COORD",3);ut(no,"GENERIC",4);const xR=class extends nn{constructor(n,e={}){super(n),this.isReflector=!0,this.type="Reflector",this.camera=new Kn;const t=this,i=e.color!==void 0?new He(e.color):new He(8355711),r=e.textureWidth||512,s=e.textureHeight||512,a=e.clipBias||0,o=e.shader||xR.ReflectorShader,l=e.multisample!==void 0?e.multisample:4,c=new rs,u=new N,h=new N,f=new N,p=new ct,m=new N(0,0,-1),y=new jt,v=new N,A=new N,_=new jt,x=new ct,E=this.camera,w=new Dn(r,s,{samples:l,type:Ai}),I=new sn({uniforms:Hn.clone(o.uniforms),fragmentShader:o.fragmentShader,vertexShader:o.vertexShader});I.uniforms.tDiffuse.value=w.texture,I.uniforms.color.value=i,I.uniforms.textureMatrix.value=x,this.material=I,this.onBeforeRender=function(T,M,b){if(h.setFromMatrixPosition(t.matrixWorld),f.setFromMatrixPosition(b.matrixWorld),p.extractRotation(t.matrixWorld),u.set(0,0,1),u.applyMatrix4(p),v.subVectors(h,f),v.dot(u)>0)return;v.reflect(u).negate(),v.add(h),p.extractRotation(b.matrixWorld),m.set(0,0,-1),m.applyMatrix4(p),m.add(f),A.subVectors(h,m),A.reflect(u).negate(),A.add(h),E.position.copy(v),E.up.set(0,1,0),E.up.applyMatrix4(p),E.up.reflect(u),E.lookAt(A),E.far=b.far,E.updateMatrixWorld(),E.projectionMatrix.copy(b.projectionMatrix),x.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),x.multiply(E.projectionMatrix),x.multiply(E.matrixWorldInverse),x.multiply(t.matrixWorld),c.setFromNormalAndCoplanarPoint(u,h),c.applyMatrix4(E.matrixWorldInverse),y.set(c.normal.x,c.normal.y,c.normal.z,c.constant);const B=E.projectionMatrix;_.x=(Math.sign(y.x)+B.elements[8])/B.elements[0],_.y=(Math.sign(y.y)+B.elements[9])/B.elements[5],_.z=-1,_.w=(1+B.elements[10])/B.elements[14],y.multiplyScalar(2/y.dot(_)),B.elements[2]=y.x,B.elements[6]=y.y,B.elements[10]=y.z+1-a,B.elements[14]=y.w,t.visible=!1;const L=T.getRenderTarget(),U=T.xr.enabled,O=T.shadowMap.autoUpdate,Q=T.toneMapping;let G=!1;"outputColorSpace"in T?G=T.outputColorSpace==="srgb":G=T.outputEncoding===3001,T.xr.enabled=!1,T.shadowMap.autoUpdate=!1,"outputColorSpace"in T?T.outputColorSpace="linear-srgb":T.outputEncoding=3e3,T.toneMapping=os,T.setRenderTarget(w),T.state.buffers.depth.setMask(!0),T.autoClear===!1&&T.clear(),T.render(M,E),T.xr.enabled=U,T.shadowMap.autoUpdate=O,T.toneMapping=Q,"outputColorSpace"in T?T.outputColorSpace=G?"srgb":"srgb-linear":T.outputEncoding=G?3001:3e3,T.setRenderTarget(L);const F=b.viewport;F!==void 0&&T.state.viewport(F),t.visible=!0},this.getRenderTarget=function(){return w},this.dispose=function(){w.dispose(),t.material.dispose()}}};let Xy=xR;ut(Xy,"ReflectorShader",{uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:`
uniform mat4 textureMatrix;
varying vec4 vUv;
#include <common>
#include <logdepthbuf_pars_vertex>
void main() {
vUv = textureMatrix * vec4( position, 1.0 );
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
#include <logdepthbuf_vertex>
}`,fragmentShader:`
uniform vec3 color;
uniform sampler2D tDiffuse;
varying vec4 vUv;
#include <logdepthbuf_pars_fragment>
float blendOverlay( float base, float blend ) {
return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );
}
vec3 blendOverlay( vec3 base, vec3 blend ) {
return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );
}
void main() {
#include <logdepthbuf_fragment>
vec4 base = texture2DProj( tDiffuse, vUv );
gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
#include <tonemapping_fragment>
#include <${parseInt(Wl.replace(/\D+/g,""))>=154?"colorspace_fragment":"encodings_fragment"}>
}`});const _R=class extends nn{constructor(n,e={}){super(n),this.isRefractor=!0,this.type="Refractor",this.camera=new Kn;const t=this,i=e.color!==void 0?new He(e.color):new He(8355711),r=e.textureWidth||512,s=e.textureHeight||512,a=e.clipBias||0,o=e.shader||_R.RefractorShader,l=e.multisample!==void 0?e.multisample:4,c=this.camera;c.matrixAutoUpdate=!1,c.userData.refractor=!0;const u=new rs,h=new ct,f=new Dn(r,s,{samples:l,type:Ai});this.material=new sn({uniforms:Hn.clone(o.uniforms),vertexShader:o.vertexShader,fragmentShader:o.fragmentShader,transparent:!0}),this.material.uniforms.color.value=i,this.material.uniforms.tDiffuse.value=f.texture,this.material.uniforms.textureMatrix.value=h;const p=function(){const _=new N,x=new N,E=new ct,w=new N,I=new N;return function(M){return _.setFromMatrixPosition(t.matrixWorld),x.setFromMatrixPosition(M.matrixWorld),w.subVectors(_,x),E.extractRotation(t.matrixWorld),I.set(0,0,1),I.applyMatrix4(E),w.dot(I)<0}}(),m=function(){const _=new N,x=new N,E=new $i,w=new N;return function(){t.matrixWorld.decompose(x,E,w),_.set(0,0,1).applyQuaternion(E).normalize(),_.negate(),u.setFromNormalAndCoplanarPoint(_,x)}}(),y=function(){const _=new rs,x=new jt,E=new jt;return function(I){c.matrixWorld.copy(I.matrixWorld),c.matrixWorldInverse.copy(c.matrixWorld).invert(),c.projectionMatrix.copy(I.projectionMatrix),c.far=I.far,_.copy(u),_.applyMatrix4(c.matrixWorldInverse),x.set(_.normal.x,_.normal.y,_.normal.z,_.constant);const T=c.projectionMatrix;E.x=(Math.sign(x.x)+T.elements[8])/T.elements[0],E.y=(Math.sign(x.y)+T.elements[9])/T.elements[5],E.z=-1,E.w=(1+T.elements[10])/T.elements[14],x.multiplyScalar(2/x.dot(E)),T.elements[2]=x.x,T.elements[6]=x.y,T.elements[10]=x.z+1-a,T.elements[14]=x.w}}();function v(_){h.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),h.multiply(_.projectionMatrix),h.multiply(_.matrixWorldInverse),h.multiply(t.matrixWorld)}function A(_,x,E){t.visible=!1;const w=_.getRenderTarget(),I=_.xr.enabled,T=_.shadowMap.autoUpdate,M=_.toneMapping;let b=!1;"outputColorSpace"in _?b=_.outputColorSpace==="srgb":b=_.outputEncoding===3001,_.xr.enabled=!1,_.shadowMap.autoUpdate=!1,"outputColorSpace"in _?_.outputColorSpace="linear-srgb":_.outputEncoding=3e3,_.toneMapping=os,_.setRenderTarget(f),_.autoClear===!1&&_.clear(),_.render(x,c),_.xr.enabled=I,_.shadowMap.autoUpdate=T,_.toneMapping=M,_.setRenderTarget(w),"outputColorSpace"in _?_.outputColorSpace=b?"srgb":"srgb-linear":_.outputEncoding=b?3001:3e3;const B=E.viewport;B!==void 0&&_.state.viewport(B),t.visible=!0}this.onBeforeRender=function(_,x,E){E.userData.refractor!==!0&&p(E)&&(m(),v(E),y(E),A(_,x,E))},this.getRenderTarget=function(){return f},this.dispose=function(){f.dispose(),t.material.dispose()}}};let jy=_R;ut(jy,"RefractorShader",{uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:`
uniform mat4 textureMatrix;
varying vec4 vUv;
void main() {
vUv = textureMatrix * vec4( position, 1.0 );
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,fragmentShader:`
uniform vec3 color;
uniform sampler2D tDiffuse;
varying vec4 vUv;
float blendOverlay( float base, float blend ) {
return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );
}
vec3 blendOverlay( vec3 base, vec3 blend ) {
return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );
}
void main() {
vec4 base = texture2DProj( tDiffuse, vUv );
gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
#include <tonemapping_fragment>
#include <${parseInt(Wl.replace(/\D+/g,""))>=154?"colorspace_fragment":"encodings_fragment"}>
}`});const fee=new Bt,Ky=class extends nn{constructor(){super(Ky.Geometry,new cs({opacity:0,transparent:!0})),this.isLensflare=!0,this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const n=new N,e=new N,t=new Va(new Uint8Array(16*16*3),16,16,li);t.minFilter=Rt,t.magFilter=Rt,t.wrapS=oi,t.wrapT=oi;const i=new Va(new Uint8Array(16*16*3),16,16,li);i.minFilter=Rt,i.magFilter=Rt,i.wrapS=oi,i.wrapT=oi;const r=Ky.Geometry,s=new tp({uniforms:{scale:{value:null},screenPosition:{value:null}},vertexShader:`
precision highp float;
uniform vec3 screenPosition;
uniform vec2 scale;
attribute vec3 position;
void main() {
gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );
}`,fragmentShader:`
precision highp float;
void main() {
gl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 );
}`,depthTest:!0,depthWrite:!1,transparent:!1}),a=new tp({uniforms:{map:{value:t},scale:{value:null},screenPosition:{value:null}},vertexShader:`
precision highp float;
uniform vec3 screenPosition;
uniform vec2 scale;
attribute vec3 position;
attribute vec2 uv;
varying vec2 vUV;
void main() {
vUV = uv;
gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );
}`,fragmentShader:`
precision highp float;
uniform sampler2D map;
varying vec2 vUV;
void main() {
gl_FragColor = texture2D( map, vUV );
}`,depthTest:!1,depthWrite:!1,transparent:!1}),o=new nn(r,s),l=[],c=ER.Shader,u=new tp({uniforms:{map:{value:null},occlusionMap:{value:i},color:{value:new He(16777215)},scale:{value:new _e},screenPosition:{value:new N}},vertexShader:c.vertexShader,fragmentShader:c.fragmentShader,blending:dp,transparent:!0,depthWrite:!1}),h=new nn(r,u);this.addElement=function(v){l.push(v)};const f=new _e,p=new _e,m=new qT,y=new jt;this.onBeforeRender=function(v,A,_){v.getCurrentViewport(y);const x=y.w/y.z,E=y.z/2,w=y.w/2;let I=16/y.w;if(f.set(I*x,I),m.min.set(y.x,y.y),m.max.set(y.x+(y.z-16),y.y+(y.w-16)),e.setFromMatrixPosition(this.matrixWorld),e.applyMatrix4(_.matrixWorldInverse),!(e.z>0)&&(n.copy(e).applyMatrix4(_.projectionMatrix),p.x=y.x+n.x*E+E-8,p.y=y.y+n.y*w+w-8,m.containsPoint(p))){v.copyFramebufferToTexture(p,t);let T=s.uniforms;T.scale.value=f,T.screenPosition.value=n,v.renderBufferDirect(_,null,r,s,o,null),v.copyFramebufferToTexture(p,i),T=a.uniforms,T.scale.value=f,T.screenPosition.value=n,v.renderBufferDirect(_,null,r,a,o,null);const M=-n.x*2,b=-n.y*2;for(let B=0,L=l.length;B<L;B++){const U=l[B],O=u.uniforms;O.color.value.copy(U.color),O.map.value=U.texture,O.screenPosition.value.x=n.x+M*U.distance,O.screenPosition.value.y=n.y+b*U.distance,I=U.size/y.w;const Q=y.w/y.z;O.scale.value.set(I*Q,I),u.uniformsNeedUpdate=!0,v.renderBufferDirect(_,null,r,u,h,null)}}},this.dispose=function(){s.dispose(),a.dispose(),u.dispose(),t.dispose(),i.dispose();for(let v=0,A=l.length;v<A;v++)l[v].texture.dispose()}}};let dee=Ky;ut(dee,"Geometry",fee);class ER{constructor(e,t=1,i=0,r=new He(16777215)){this.texture=e,this.size=t,this.distance=i,this.color=r}}ut(ER,"Shader",{uniforms:{map:{value:null},occlusionMap:{value:null},color:{value:null},scale:{value:null},screenPosition:{value:null}},vertexShader:`
precision highp float;
uniform vec3 screenPosition;
uniform vec2 scale;
uniform sampler2D occlusionMap;
attribute vec3 position;
attribute vec2 uv;
varying vec2 vUV;
varying float vVisibility;
void main() {
vUV = uv;
vec2 pos = position.xy;
vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );
visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );
visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );
visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );
visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );
visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );
visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );
visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );
visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );
vVisibility = visibility.r / 9.0;
vVisibility *= 1.0 - visibility.g / 9.0;
vVisibility *= visibility.b / 9.0;
gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );
}`,fragmentShader:`
precision highp float;
uniform sampler2D map;
uniform vec3 color;
varying vec2 vUV;
varying float vVisibility;
void main() {
vec4 texture = texture2D( map, vUV );
texture.a *= vVisibility;
gl_FragColor = texture;
gl_FragColor.rgb *= color;
}`});class op{constructor(e=Math){ut(this,"grad3",[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]]),ut(this,"grad4",[[0,1,1,1],[0,1,1,-1],[0,1,-1,1],[0,1,-1,-1],[0,-1,1,1],[0,-1,1,-1],[0,-1,-1,1],[0,-1,-1,-1],[1,0,1,1],[1,0,1,-1],[1,0,-1,1],[1,0,-1,-1],[-1,0,1,1],[-1,0,1,-1],[-1,0,-1,1],[-1,0,-1,-1],[1,1,0,1],[1,1,0,-1],[1,-1,0,1],[1,-1,0,-1],[-1,1,0,1],[-1,1,0,-1],[-1,-1,0,1],[-1,-1,0,-1],[1,1,1,0],[1,1,-1,0],[1,-1,1,0],[1,-1,-1,0],[-1,1,1,0],[-1,1,-1,0],[-1,-1,1,0],[-1,-1,-1,0]]),ut(this,"p",[]),ut(this,"perm",[]),ut(this,"simplex",[[0,1,2,3],[0,1,3,2],[0,0,0,0],[0,2,3,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,3,0],[0,2,1,3],[0,0,0,0],[0,3,1,2],[0,3,2,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,3,2,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,0,3],[0,0,0,0],[1,3,0,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,3,0,1],[2,3,1,0],[1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,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],[2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0],[2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0]]),ut(this,"dot",(t,i,r)=>t[0]*i+t[1]*r),ut(this,"dot3",(t,i,r,s)=>t[0]*i+t[1]*r+t[2]*s),ut(this,"dot4",(t,i,r,s,a)=>t[0]*i+t[1]*r+t[2]*s+t[3]*a),ut(this,"noise",(t,i)=>{let r,s,a;const o=.5*(Math.sqrt(3)-1),l=(t+i)*o,c=Math.floor(t+l),u=Math.floor(i+l),h=(3-Math.sqrt(3))/6,f=(c+u)*h,p=c-f,m=u-f,y=t-p,v=i-m;let A=0,_=1;y>v&&(A=1,_=0);const x=y-A+h,E=v-_+h,w=y-1+2*h,I=v-1+2*h,T=c&255,M=u&255,b=this.perm[T+this.perm[M]]%12,B=this.perm[T+A+this.perm[M+_]]%12,L=this.perm[T+1+this.perm[M+1]]%12;let U=.5-y*y-v*v;U<0?r=0:(U*=U,r=U*U*this.dot(this.grad3[b],y,v));let O=.5-x*x-E*E;O<0?s=0:(O*=O,s=O*O*this.dot(this.grad3[B],x,E));let Q=.5-w*w-I*I;return Q<0?a=0:(Q*=Q,a=Q*Q*this.dot(this.grad3[L],w,I)),70*(r+s+a)}),ut(this,"noise3d",(t,i,r)=>{let s,a,o,l;const c=.3333333333333333,u=(t+i+r)*c,h=Math.floor(t+u),f=Math.floor(i+u),p=Math.floor(r+u),m=1/6,y=(h+f+p)*m,v=h-y,A=f-y,_=p-y,x=t-v,E=i-A,w=r-_;let I,T,M,b,B,L;x>=E?E>=w?(I=1,T=0,M=0,b=1,B=1,L=0):x>=w?(I=1,T=0,M=0,b=1,B=0,L=1):(I=0,T=0,M=1,b=1,B=0,L=1):E<w?(I=0,T=0,M=1,b=0,B=1,L=1):x<w?(I=0,T=1,M=0,b=0,B=1,L=1):(I=0,T=1,M=0,b=1,B=1,L=0);const U=x-I+m,O=E-T+m,Q=w-M+m,G=x-b+2*m,F=E-B+2*m,q=w-L+2*m,Y=x-1+3*m,H=E-1+3*m,V=w-1+3*m,D=h&255,k=f&255,Z=p&255,j=this.perm[D+this.perm[k+this.perm[Z]]]%12,ee=this.perm[D+I+this.perm[k+T+this.perm[Z+M]]]%12,ie=this.perm[D+b+this.perm[k+B+this.perm[Z+L]]]%12,te=this.perm[D+1+this.perm[k+1+this.perm[Z+1]]]%12;let re=.6-x*x-E*E-w*w;re<0?s=0:(re*=re,s=re*re*this.dot3(this.grad3[j],x,E,w));let ce=.6-U*U-O*O-Q*Q;ce<0?a=0:(ce*=ce,a=ce*ce*this.dot3(this.grad3[ee],U,O,Q));let ye=.6-G*G-F*F-q*q;ye<0?o=0:(ye*=ye,o=ye*ye*this.dot3(this.grad3[ie],G,F,q));let oe=.6-Y*Y-H*H-V*V;return oe<0?l=0:(oe*=oe,l=oe*oe*this.dot3(this.grad3[te],Y,H,V)),32*(s+a+o+l)}),ut(this,"noise4d",(t,i,r,s)=>{const a=this.grad4,o=this.simplex,l=this.perm,c=(Math.sqrt(5)-1)/4,u=(5-Math.sqrt(5))/20;let h,f,p,m,y;const v=(t+i+r+s)*c,A=Math.floor(t+v),_=Math.floor(i+v),x=Math.floor(r+v),E=Math.floor(s+v),w=(A+_+x+E)*u,I=A-w,T=_-w,M=x-w,b=E-w,B=t-I,L=i-T,U=r-M,O=s-b,Q=B>L?32:0,G=B>U?16:0,F=L>U?8:0,q=B>O?4:0,Y=L>O?2:0,H=U>O?1:0,V=Q+G+F+q+Y+H;let D,k,Z,j,ee,ie,te,re,ce,ye,oe,W;D=o[V][0]>=3?1:0,k=o[V][1]>=3?1:0,Z=o[V][2]>=3?1:0,j=o[V][3]>=3?1:0,ee=o[V][0]>=2?1:0,ie=o[V][1]>=2?1:0,te=o[V][2]>=2?1:0,re=o[V][3]>=2?1:0,ce=o[V][0]>=1?1:0,ye=o[V][1]>=1?1:0,oe=o[V][2]>=1?1:0,W=o[V][3]>=1?1:0;const ge=B-D+u,he=L-k+u,ue=U-Z+u,fe=O-j+u,Pe=B-ee+2*u,pe=L-ie+2*u,Re=U-te+2*u,Le=O-re+2*u,Se=B-ce+3*u,$e=L-ye+3*u,X=U-oe+3*u,z=O-W+3*u,se=B-1+4*u,Be=L-1+4*u,Ce=U-1+4*u,we=O-1+4*u,ke=A&255,Ue=_&255,xe=x&255,ze=E&255,je=l[ke+l[Ue+l[xe+l[ze]]]]%32,We=l[ke+D+l[Ue+k+l[xe+Z+l[ze+j]]]]%32,Oe=l[ke+ee+l[Ue+ie+l[xe+te+l[ze+re]]]]%32,Ve=l[ke+ce+l[Ue+ye+l[xe+oe+l[ze+W]]]]%32,it=l[ke+1+l[Ue+1+l[xe+1+l[ze+1]]]]%32;let gt=.6-B*B-L*L-U*U-O*O;gt<0?h=0:(gt*=gt,h=gt*gt*this.dot4(a[je],B,L,U,O));let ne=.6-ge*ge-he*he-ue*ue-fe*fe;ne<0?f=0:(ne*=ne,f=ne*ne*this.dot4(a[We],ge,he,ue,fe));let Fe=.6-Pe*Pe-pe*pe-Re*Re-Le*Le;Fe<0?p=0:(Fe*=Fe,p=Fe*Fe*this.dot4(a[Oe],Pe,pe,Re,Le));let me=.6-Se*Se-$e*$e-X*X-z*z;me<0?m=0:(me*=me,m=me*me*this.dot4(a[Ve],Se,$e,X,z));let Qe=.6-se*se-Be*Be-Ce*Ce-we*we;return Qe<0?y=0:(Qe*=Qe,y=Qe*Qe*this.dot4(a[it],se,Be,Ce,we)),27*(h+f+p+m+y)});for(let t=0;t<256;t++)this.p[t]=Math.floor(e.random()*256);for(let t=0;t<512;t++)this.perm[t]=this.p[t&255]}}const Sr=class extends Bt{constructor(n={}){super(),this.isLightningStrike=!0,this.type="LightningStrike",this.init(Sr.copyParameters(n,n)),this.createMesh()}static createRandomGenerator(){const e=[];for(let i=0;i<2053;i++)e.push(Math.random());const t={currentSeed:0,random:function(){const i=e[t.currentSeed];return t.currentSeed=(t.currentSeed+1)%2053,i},getSeed:function(){return t.currentSeed/2053},setSeed:function(i){t.currentSeed=Math.floor(i*2053)%2053}};return t}static copyParameters(n={},e={}){const t=function(i){return e===n?i:i.clone()};return n.sourceOffset=e.sourceOffset!==void 0?t(e.sourceOffset):new N(0,100,0),n.destOffset=e.destOffset!==void 0?t(e.destOffset):new N(0,0,0),n.timeScale=e.timeScale!==void 0?e.timeScale:1,n.roughness=e.roughness!==void 0?e.roughness:.9,n.straightness=e.straightness!==void 0?e.straightness:.7,n.up0=e.up0!==void 0?t(e.up0):new N(0,0,1),n.up1=e.up1!==void 0?t(e.up1):new N(0,0,1),n.radius0=e.radius0!==void 0?e.radius0:1,n.radius1=e.radius1!==void 0?e.radius1:1,n.radius0Factor=e.radius0Factor!==void 0?e.radius0Factor:.5,n.radius1Factor=e.radius1Factor!==void 0?e.radius1Factor:.2,n.minRadius=e.minRadius!==void 0?e.minRadius:.2,n.isEternal=e.isEternal!==void 0?e.isEternal:e.birthTime===void 0||e.deathTime===void 0,n.birthTime=e.birthTime,n.deathTime=e.deathTime,n.propagationTimeFactor=e.propagationTimeFactor!==void 0?e.propagationTimeFactor:.1,n.vanishingTimeFactor=e.vanishingTimeFactor!==void 0?e.vanishingTimeFactor:.9,n.subrayPeriod=e.subrayPeriod!==void 0?e.subrayPeriod:4,n.subrayDutyCycle=e.subrayDutyCycle!==void 0?e.subrayDutyCycle:.6,n.maxIterations=e.maxIterations!==void 0?e.maxIterations:9,n.isStatic=e.isStatic!==void 0?e.isStatic:!1,n.ramification=e.ramification!==void 0?e.ramification:5,n.maxSubrayRecursion=e.maxSubrayRecursion!==void 0?e.maxSubrayRecursion:3,n.recursionProbability=e.recursionProbability!==void 0?e.recursionProbability:.6,n.generateUVs=e.generateUVs!==void 0?e.generateUVs:!1,n.randomGenerator=e.randomGenerator,n.noiseSeed=e.noiseSeed,n.onDecideSubrayCreation=e.onDecideSubrayCreation,n.onSubrayCreation=e.onSubrayCreation,n}update(n){this.isStatic||(this.rayParameters.isEternal||this.rayParameters.birthTime<=n&&n<=this.rayParameters.deathTime?(this.updateMesh(n),n<this.subrays[0].endPropagationTime?this.state=Sr.RAY_PROPAGATING:n>this.subrays[0].beginVanishingTime?this.state=Sr.RAY_VANISHING:this.state=Sr.RAY_STEADY,this.visible=!0):(this.visible=!1,n<this.rayParameters.birthTime?this.state=Sr.RAY_UNBORN:this.state=Sr.RAY_EXTINGUISHED))}init(n){this.rayParameters=n,this.maxIterations=n.maxIterations!==void 0?Math.floor(n.maxIterations):9,n.maxIterations=this.maxIterations,this.isStatic=n.isStatic!==void 0?n.isStatic:!1,n.isStatic=this.isStatic,this.ramification=n.ramification!==void 0?Math.floor(n.ramification):5,n.ramification=this.ramification,this.maxSubrayRecursion=n.maxSubrayRecursion!==void 0?Math.floor(n.maxSubrayRecursion):3,n.maxSubrayRecursion=this.maxSubrayRecursion,this.recursionProbability=n.recursionProbability!==void 0?n.recursionProbability:.6,n.recursionProbability=this.recursionProbability,this.generateUVs=n.generateUVs!==void 0?n.generateUVs:!1,n.generateUVs=this.generateUVs,n.randomGenerator!==void 0?(this.randomGenerator=n.randomGenerator,this.seedGenerator=n.randomGenerator,n.noiseSeed!==void 0&&this.seedGenerator.setSeed(n.noiseSeed)):(this.randomGenerator=Sr.createRandomGenerator(),this.seedGenerator=Math),n.onDecideSubrayCreation!==void 0?this.onDecideSubrayCreation=n.onDecideSubrayCreation:(this.createDefaultSubrayCreationCallbacks(),n.onSubrayCreation!==void 0&&(this.onSubrayCreation=n.onSubrayCreation)),this.state=Sr.RAY_INITIALIZED,this.maxSubrays=Math.ceil(1+Math.pow(this.ramification,Math.max(0,this.maxSubrayRecursion-1))),n.maxSubrays=this.maxSubrays,this.maxRaySegments=2*(1<<this.maxIterations),this.subrays=[];for(let e=0;e<this.maxSubrays;e++)this.subrays.push(this.createSubray());this.raySegments=[];for(let e=0;e<this.maxRaySegments;e++)this.raySegments.push(this.createSegment());this.time=0,this.timeFraction=0,this.currentSegmentCallback=null,this.currentCreateTriangleVertices=this.generateUVs?this.createTriangleVerticesWithUVs:this.createTriangleVerticesWithoutUVs,this.numSubrays=0,this.currentSubray=null,this.currentSegmentIndex=0,this.isInitialSegment=!1,this.subrayProbability=0,this.currentVertex=0,this.currentIndex=0,this.currentCoordinate=0,this.currentUVCoordinate=0,this.vertices=null,this.uvs=null,this.indices=null,this.positionAttribute=null,this.uvsAttribute=null,this.simplexX=new op(this.seedGenerator),this.simplexY=new op(this.seedGenerator),this.simplexZ=new op(this.seedGenerator),this.forwards=new N,this.forwardsFill=new N,this.side=new N,this.down=new N,this.middlePos=new N,this.middleLinPos=new N,this.newPos=new N,this.vPos=new N,this.cross1=new N}createMesh(){const n=1<<this.maxIterations,e=3*(n+1)*this.maxSubrays,t=18*n*this.maxSubrays;this.vertices=new Float32Array(e*3),this.indices=new Uint32Array(t),this.generateUVs&&(this.uvs=new Float32Array(e*2)),this.fillMesh(0),this.setIndex(new U2(this.indices,1)),this.positionAttribute=new ot(this.vertices,3),this.setAttribute("position",this.positionAttribute),this.generateUVs&&(this.uvsAttribute=new ot(new Float32Array(this.uvs),2),this.setAttribute("uv",this.uvsAttribute)),this.isStatic||(this.index.usage=fm,this.positionAttribute.usage=fm,this.generateUVs&&(this.uvsAttribute.usage=fm)),this.vertices=this.positionAttribute.array,this.indices=this.index.array,this.generateUVs&&(this.uvs=this.uvsAttribute.array)}updateMesh(n){this.fillMesh(n),this.drawRange.count=this.currentIndex,this.index.needsUpdate=!0,this.positionAttribute.needsUpdate=!0,this.generateUVs&&(this.uvsAttribute.needsUpdate=!0)}fillMesh(n){const e=this;this.currentVertex=0,this.currentIndex=0,this.currentCoordinate=0,this.currentUVCoordinate=0,this.fractalRay(n,function(i){const r=e.currentSubray;n<r.birthTime||(this.rayParameters.isEternal&&e.currentSubray.recursion==0?(e.createPrism(i),e.onDecideSubrayCreation(i,e)):n<r.endPropagationTime?e.timeFraction>=i.fraction0*r.propagationTimeFactor&&(e.createPrism(i),e.onDecideSubrayCreation(i,e)):n<r.beginVanishingTime?(e.createPrism(i),e.onDecideSubrayCreation(i,e)):(e.timeFraction<=r.vanishingTimeFactor+i.fraction1*(1-r.vanishingTimeFactor)&&e.createPrism(i),e.onDecideSubrayCreation(i,e)))})}addNewSubray(){return this.subrays[this.numSubrays++]}initSubray(n,e){n.pos0.copy(e.sourceOffset),n.pos1.copy(e.destOffset),n.up0.copy(e.up0),n.up1.copy(e.up1),n.radius0=e.radius0,n.radius1=e.radius1,n.birthTime=e.birthTime,n.deathTime=e.deathTime,n.timeScale=e.timeScale,n.roughness=e.roughness,n.straightness=e.straightness,n.propagationTimeFactor=e.propagationTimeFactor,n.vanishingTimeFactor=e.vanishingTimeFactor,n.maxIterations=this.maxIterations,n.seed=e.noiseSeed!==void 0?e.noiseSeed:0,n.recursion=0}fractalRay(n,e){this.time=n,this.currentSegmentCallback=e,this.numSubrays=0,this.initSubray(this.addNewSubray(),this.rayParameters);for(let t=0;t<this.numSubrays;t++){const i=this.subrays[t];this.currentSubray=i,this.randomGenerator.setSeed(i.seed),i.endPropagationTime=Ll.lerp(i.birthTime,i.deathTime,i.propagationTimeFactor),i.beginVanishingTime=Ll.lerp(i.deathTime,i.birthTime,1-i.vanishingTimeFactor);const r=this.randomGenerator.random;i.linPos0.set(r(),r(),r()).multiplyScalar(1e3),i.linPos1.set(r(),r(),r()).multiplyScalar(1e3),this.timeFraction=(n-i.birthTime)/(i.deathTime-i.birthTime),this.currentSegmentIndex=0,this.isInitialSegment=!0;const s=this.getNewSegment();s.iteration=0,s.pos0.copy(i.pos0),s.pos1.copy(i.pos1),s.linPos0.copy(i.linPos0),s.linPos1.copy(i.linPos1),s.up0.copy(i.up0),s.up1.copy(i.up1),s.radius0=i.radius0,s.radius1=i.radius1,s.fraction0=0,s.fraction1=1,s.positionVariationFactor=1-i.straightness,this.subrayProbability=this.ramification*Math.pow(this.recursionProbability,i.recursion)/(1<<i.maxIterations),this.fractalRayRecursive(s)}this.currentSegmentCallback=null,this.currentSubray=null}fractalRayRecursive(n){if(n.iteration>=this.currentSubray.maxIterations){this.currentSegmentCallback(n);return}this.forwards.subVectors(n.pos1,n.pos0);let e=this.forwards.length();e<1e-6&&(this.forwards.set(0,0,.01),e=this.forwards.length());const t=(n.radius0+n.radius1)*.5,i=(n.fraction0+n.fraction1)*.5,r=this.time*this.currentSubray.timeScale*Math.pow(2,n.iteration);this.middlePos.lerpVectors(n.pos0,n.pos1,.5),this.middleLinPos.lerpVectors(n.linPos0,n.linPos1,.5);const s=this.middleLinPos;this.newPos.set(this.simplexX.noise4d(s.x,s.y,s.z,r),this.simplexY.noise4d(s.x,s.y,s.z,r),this.simplexZ.noise4d(s.x,s.y,s.z,r)),this.newPos.multiplyScalar(n.positionVariationFactor*e),this.newPos.add(this.middlePos);const a=this.getNewSegment();a.pos0.copy(n.pos0),a.pos1.copy(this.newPos),a.linPos0.copy(n.linPos0),a.linPos1.copy(this.middleLinPos),a.up0.copy(n.up0),a.up1.copy(n.up1),a.radius0=n.radius0,a.radius1=t,a.fraction0=n.fraction0,a.fraction1=i,a.positionVariationFactor=n.positionVariationFactor*this.currentSubray.roughness,a.iteration=n.iteration+1;const o=this.getNewSegment();o.pos0.copy(this.newPos),o.pos1.copy(n.pos1),o.linPos0.copy(this.middleLinPos),o.linPos1.copy(n.linPos1),this.cross1.crossVectors(n.up0,this.forwards.normalize()),o.up0.crossVectors(this.forwards,this.cross1).normalize(),o.up1.copy(n.up1),o.radius0=t,o.radius1=n.radius1,o.fraction0=i,o.fraction1=n.fraction1,o.positionVariationFactor=n.positionVariationFactor*this.currentSubray.roughness,o.iteration=n.iteration+1,this.fractalRayRecursive(a),this.fractalRayRecursive(o)}createPrism(n){this.forwardsFill.subVectors(n.pos1,n.pos0).normalize(),this.isInitialSegment&&(this.currentCreateTriangleVertices(n.pos0,n.up0,this.forwardsFill,n.radius0,0),this.isInitialSegment=!1),this.currentCreateTriangleVertices(n.pos1,n.up0,this.forwardsFill,n.radius1,n.fraction1),this.createPrismFaces()}createTriangleVerticesWithoutUVs(n,e,t,i){this.side.crossVectors(e,t).multiplyScalar(i*Sr.COS30DEG),this.down.copy(e).multiplyScalar(-i*Sr.SIN30DEG);const r=this.vPos,s=this.vertices;r.copy(n).sub(this.side).add(this.down),s[this.currentCoordinate++]=r.x,s[this.currentCoordinate++]=r.y,s[this.currentCoordinate++]=r.z,r.copy(n).add(this.side).add(this.down),s[this.currentCoordinate++]=r.x,s[this.currentCoordinate++]=r.y,s[this.currentCoordinate++]=r.z,r.copy(e).multiplyScalar(i).add(n),s[this.currentCoordinate++]=r.x,s[this.currentCoordinate++]=r.y,s[this.currentCoordinate++]=r.z,this.currentVertex+=3}createTriangleVerticesWithUVs(n,e,t,i,r){this.side.crossVectors(e,t).multiplyScalar(i*Sr.COS30DEG),this.down.copy(e).multiplyScalar(-i*Sr.SIN30DEG);const s=this.vPos,a=this.vertices,o=this.uvs;s.copy(n).sub(this.side).add(this.down),a[this.currentCoordinate++]=s.x,a[this.currentCoordinate++]=s.y,a[this.currentCoordinate++]=s.z,o[this.currentUVCoordinate++]=r,o[this.currentUVCoordinate++]=0,s.copy(n).add(this.side).add(this.down),a[this.currentCoordinate++]=s.x,a[this.currentCoordinate++]=s.y,a[this.currentCoordinate++]=s.z,o[this.currentUVCoordinate++]=r,o[this.currentUVCoordinate++]=.5,s.copy(e).multiplyScalar(i).add(n),a[this.currentCoordinate++]=s.x,a[this.currentCoordinate++]=s.y,a[this.currentCoordinate++]=s.z,o[this.currentUVCoordinate++]=r,o[this.currentUVCoordinate++]=1,this.currentVertex+=3}createPrismFaces(n){const e=this.indices;n=this.currentVertex-6,e[this.currentIndex++]=n+1,e[this.currentIndex++]=n+2,e[this.currentIndex++]=n+5,e[this.currentIndex++]=n+1,e[this.currentIndex++]=n+5,e[this.currentIndex++]=n+4,e[this.currentIndex++]=n+0,e[this.currentIndex++]=n+1,e[this.currentIndex++]=n+4,e[this.currentIndex++]=n+0,e[this.currentIndex++]=n+4,e[this.currentIndex++]=n+3,e[this.currentIndex++]=n+2,e[this.currentIndex++]=n+0,e[this.currentIndex++]=n+3,e[this.currentIndex++]=n+2,e[this.currentIndex++]=n+3,e[this.currentIndex++]=n+5}createDefaultSubrayCreationCallbacks(){const n=this.randomGenerator.random;this.onDecideSubrayCreation=function(s,a){const o=a.currentSubray,l=a.rayParameters.subrayPeriod,c=a.rayParameters.subrayDutyCycle,u=a.rayParameters.isEternal&&o.recursion==0?-n()*l:Ll.lerp(o.birthTime,o.endPropagationTime,s.fraction0)-n()*l,h=a.time-u,f=Math.floor(h/l),p=n()*(f+1),m=h%l<=c*l;let y=0;if(m&&(y=a.subrayProbability),o.recursion<a.maxSubrayRecursion&&a.numSubrays<a.maxSubrays&&n()<y){const v=a.addNewSubray(),A=a.randomGenerator.getSeed();v.seed=p,a.randomGenerator.setSeed(p),v.recursion=o.recursion+1,v.maxIterations=Math.max(1,o.maxIterations-1),v.linPos0.set(n(),n(),n()).multiplyScalar(1e3),v.linPos1.set(n(),n(),n()).multiplyScalar(1e3),v.up0.copy(o.up0),v.up1.copy(o.up1),v.radius0=s.radius0*a.rayParameters.radius0Factor,v.radius1=Math.min(a.rayParameters.minRadius,s.radius1*a.rayParameters.radius1Factor),v.birthTime=u+f*l,v.deathTime=v.birthTime+l*c,!a.rayParameters.isEternal&&o.recursion==0&&(v.birthTime=Math.max(v.birthTime,o.birthTime),v.deathTime=Math.min(v.deathTime,o.deathTime)),v.timeScale=o.timeScale*2,v.roughness=o.roughness,v.straightness=o.straightness,v.propagationTimeFactor=o.propagationTimeFactor,v.vanishingTimeFactor=o.vanishingTimeFactor,a.onSubrayCreation(s,o,v,a),a.randomGenerator.setSeed(A)}};const e=new N,t=new N,i=new N,r=new N;this.onSubrayCreation=function(s,a,o,l){l.subrayCylinderPosition(s,a,o,.5,.6,.2)},this.subrayConePosition=function(s,a,o,l,c,u){o.pos0.copy(s.pos0),e.subVectors(a.pos1,a.pos0),t.copy(e).normalize(),e.multiplyScalar(s.fraction0+(1-s.fraction0)*(n()*l));const h=e.length();i.crossVectors(a.up0,t);const f=2*Math.PI*n();i.multiplyScalar(Math.cos(f)),r.copy(a.up0).multiplyScalar(Math.sin(f)),o.pos1.copy(i).add(r).multiplyScalar(h*c*(u+n()*(1-u))).add(e).add(a.pos0)},this.subrayCylinderPosition=function(s,a,o,l,c,u){o.pos0.copy(s.pos0),e.subVectors(a.pos1,a.pos0),t.copy(e).normalize(),e.multiplyScalar(s.fraction0+(1-s.fraction0)*((2*n()-1)*l));const h=e.length();i.crossVectors(a.up0,t);const f=2*Math.PI*n();i.multiplyScalar(Math.cos(f)),r.copy(a.up0).multiplyScalar(Math.sin(f)),o.pos1.copy(i).add(r).multiplyScalar(h*c*(u+n()*(1-u))).add(e).add(a.pos0)}}createSubray(){return{seed:0,maxIterations:0,recursion:0,pos0:new N,pos1:new N,linPos0:new N,linPos1:new N,up0:new N,up1:new N,radius0:0,radius1:0,birthTime:0,deathTime:0,timeScale:0,roughness:0,straightness:0,propagationTimeFactor:0,vanishingTimeFactor:0,endPropagationTime:0,beginVanishingTime:0}}createSegment(){return{iteration:0,pos0:new N,pos1:new N,linPos0:new N,linPos1:new N,up0:new N,up1:new N,radius0:0,radius1:0,fraction0:0,fraction1:0,positionVariationFactor:0}}getNewSegment(){return this.raySegments[this.currentSegmentIndex++]}copy(n){return super.copy(n),this.init(Sr.copyParameters({},n.rayParameters)),this}clone(){return new this.constructor(Sr.copyParameters({},this.rayParameters))}};let Zl=Sr;ut(Zl,"RAY_INITIALIZED",0);ut(Zl,"RAY_UNBORN",1);ut(Zl,"RAY_PROPAGATING",2);ut(Zl,"RAY_STEADY",3);ut(Zl,"RAY_VANISHING",4);ut(Zl,"RAY_EXTINGUISHED",5);ut(Zl,"COS30DEG",Math.cos(30*Math.PI/180));ut(Zl,"SIN30DEG",Math.sin(30*Math.PI/180));const Lc=class extends nn{constructor(n,e={}){super(n),this.isReflectorForSSRPass=!0,this.type="ReflectorForSSRPass";const t=this,i=e.color!==void 0?new He(e.color):new He(8355711),r=e.textureWidth||512,s=e.textureHeight||512,a=e.clipBias||0,o=e.shader||Lc.ReflectorShader,l=e.useDepthTexture===!0,c=new N(0,1,0),u=new N,h=new N;t.needsUpdate=!1,t.maxDistance=Lc.ReflectorShader.uniforms.maxDistance.value,t.opacity=Lc.ReflectorShader.uniforms.opacity.value,t.color=i,t.resolution=e.resolution||new _e(window.innerWidth,window.innerHeight),t._distanceAttenuation=Lc.ReflectorShader.defines.DISTANCE_ATTENUATION,Object.defineProperty(t,"distanceAttenuation",{get(){return t._distanceAttenuation},set(L){t._distanceAttenuation!==L&&(t._distanceAttenuation=L,t.material.defines.DISTANCE_ATTENUATION=L,t.material.needsUpdate=!0)}}),t._fresnel=Lc.ReflectorShader.defines.FRESNEL,Object.defineProperty(t,"fresnel",{get(){return t._fresnel},set(L){t._fresnel!==L&&(t._fresnel=L,t.material.defines.FRESNEL=L,t.material.needsUpdate=!0)}});const f=new N,p=new N,m=new N,y=new ct,v=new N(0,0,-1),A=new N,_=new N,x=new ct,E=new Kn;let w;l&&(w=new uf,w.type=Au,w.minFilter=Rt,w.magFilter=Rt);const I={depthTexture:l?w:null,type:Ai},T=new Dn(r,s,I),M=new sn({transparent:l,defines:Object.assign({},Lc.ReflectorShader.defines,{useDepthTexture:l}),uniforms:Hn.clone(o.uniforms),fragmentShader:o.fragmentShader,vertexShader:o.vertexShader});M.uniforms.tDiffuse.value=T.texture,M.uniforms.color.value=t.color,M.uniforms.textureMatrix.value=x,l&&(M.uniforms.tDepth.value=T.depthTexture),this.material=M;const B=[new rs(new N(0,1,0),a)];this.doRender=function(L,U,O){if(M.uniforms.maxDistance.value=t.maxDistance,M.uniforms.color.value=t.color,M.uniforms.opacity.value=t.opacity,u.copy(O.position).normalize(),h.copy(u).reflect(c),M.uniforms.fresnelCoe.value=(u.dot(h)+1)/2,p.setFromMatrixPosition(t.matrixWorld),m.setFromMatrixPosition(O.matrixWorld),y.extractRotation(t.matrixWorld),f.set(0,0,1),f.applyMatrix4(y),A.subVectors(p,m),A.dot(f)>0)return;A.reflect(f).negate(),A.add(p),y.extractRotation(O.matrixWorld),v.set(0,0,-1),v.applyMatrix4(y),v.add(m),_.subVectors(p,v),_.reflect(f).negate(),_.add(p),E.position.copy(A),E.up.set(0,1,0),E.up.applyMatrix4(y),E.up.reflect(f),E.lookAt(_),E.far=O.far,E.updateMatrixWorld(),E.projectionMatrix.copy(O.projectionMatrix),M.uniforms.virtualCameraNear.value=O.near,M.uniforms.virtualCameraFar.value=O.far,M.uniforms.virtualCameraMatrixWorld.value=E.matrixWorld,M.uniforms.virtualCameraProjectionMatrix.value=O.projectionMatrix,M.uniforms.virtualCameraProjectionMatrixInverse.value=O.projectionMatrixInverse,M.uniforms.resolution.value=t.resolution,x.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),x.multiply(E.projectionMatrix),x.multiply(E.matrixWorldInverse),x.multiply(t.matrixWorld);const Q=L.getRenderTarget(),G=L.xr.enabled,F=L.shadowMap.autoUpdate,q=L.clippingPlanes;L.xr.enabled=!1,L.shadowMap.autoUpdate=!1,L.clippingPlanes=B,L.setRenderTarget(T),L.state.buffers.depth.setMask(!0),L.autoClear===!1&&L.clear(),L.render(U,E),L.xr.enabled=G,L.shadowMap.autoUpdate=F,L.clippingPlanes=q,L.setRenderTarget(Q);const Y=O.viewport;Y!==void 0&&L.state.viewport(Y)},this.getRenderTarget=function(){return T}}};let pee=Lc;ut(pee,"ReflectorShader",{defines:{DISTANCE_ATTENUATION:!0,FRESNEL:!0},uniforms:{color:{value:null},tDiffuse:{value:null},tDepth:{value:null},textureMatrix:{value:new ct},maxDistance:{value:180},opacity:{value:.5},fresnelCoe:{value:null},virtualCameraNear:{value:null},virtualCameraFar:{value:null},virtualCameraProjectionMatrix:{value:new ct},virtualCameraMatrixWorld:{value:new ct},virtualCameraProjectionMatrixInverse:{value:new ct},resolution:{value:new _e}},vertexShader:`
uniform mat4 textureMatrix;
varying vec4 vUv;
void main() {
vUv = textureMatrix * vec4( position, 1.0 );
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,fragmentShader:`
uniform vec3 color;
uniform sampler2D tDiffuse;
uniform sampler2D tDepth;
uniform float maxDistance;
uniform float opacity;
uniform float fresnelCoe;
uniform float virtualCameraNear;
uniform float virtualCameraFar;
uniform mat4 virtualCameraProjectionMatrix;
uniform mat4 virtualCameraProjectionMatrixInverse;
uniform mat4 virtualCameraMatrixWorld;
uniform vec2 resolution;
varying vec4 vUv;
#include <packing>
float blendOverlay( float base, float blend ) {
return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );
}
vec3 blendOverlay( vec3 base, vec3 blend ) {
return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );
}
float getDepth( const in vec2 uv ) {
return texture2D( tDepth, uv ).x;
}
float getViewZ( const in float depth ) {
return perspectiveDepthToViewZ( depth, virtualCameraNear, virtualCameraFar );
}
vec3 getViewPosition( const in vec2 uv, const in float depth/*clip space*/, const in float clipW ) {
vec4 clipPosition = vec4( ( vec3( uv, depth ) - 0.5 ) * 2.0, 1.0 );//ndc
clipPosition *= clipW; //clip
return ( virtualCameraProjectionMatrixInverse * clipPosition ).xyz;//view
}
void main() {
vec4 base = texture2DProj( tDiffuse, vUv );
#ifdef useDepthTexture
vec2 uv=(gl_FragCoord.xy-.5)/resolution.xy;
uv.x=1.-uv.x;
float depth = texture2DProj( tDepth, vUv ).r;
float viewZ = getViewZ( depth );
float clipW = virtualCameraProjectionMatrix[2][3] * viewZ+virtualCameraProjectionMatrix[3][3];
vec3 viewPosition=getViewPosition( uv, depth, clipW );
vec3 worldPosition=(virtualCameraMatrixWorld*vec4(viewPosition,1)).xyz;
if(worldPosition.y>maxDistance) discard;
float op=opacity;
#ifdef DISTANCE_ATTENUATION
float ratio=1.-(worldPosition.y/maxDistance);
float attenuation=ratio*ratio;
op=opacity*attenuation;
#endif
#ifdef FRESNEL
op*=fresnelCoe;
#endif
gl_FragColor = vec4( blendOverlay( base.rgb, color ), op );
#else
gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
#endif
}
`});const _m={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new N},up:{value:new N(0,1,0)}},vertexShader:`
uniform vec3 sunPosition;
uniform float rayleigh;
uniform float turbidity;
uniform float mieCoefficient;
uniform vec3 up;
varying vec3 vWorldPosition;
varying vec3 vSunDirection;
varying float vSunfade;
varying vec3 vBetaR;
varying vec3 vBetaM;
varying float vSunE;
// constants for atmospheric scattering
const float e = 2.71828182845904523536028747135266249775724709369995957;
const float pi = 3.141592653589793238462643383279502884197169;
// wavelength of used primaries, according to preetham
const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );
// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:
// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))
const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );
// mie stuff
// K coefficient for the primaries
const float v = 4.0;
const vec3 K = vec3( 0.686, 0.678, 0.666 );
// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K
const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );
// earth shadow hack
// cutoffAngle = pi / 1.95;
const float cutoffAngle = 1.6110731556870734;
const float steepness = 1.5;
const float EE = 1000.0;
float sunIntensity( float zenithAngleCos ) {
zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );
return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );
}
vec3 totalMie( float T ) {
float c = ( 0.2 * T ) * 10E-18;
return 0.434 * c * MieConst;
}
void main() {
vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
vWorldPosition = worldPosition.xyz;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
gl_Position.z = gl_Position.w; // set z to camera.far
vSunDirection = normalize( sunPosition );
vSunE = sunIntensity( dot( vSunDirection, up ) );
vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );
float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );
// extinction (absorbtion + out scattering)
// rayleigh coefficients
vBetaR = totalRayleigh * rayleighCoefficient;
// mie coefficients
vBetaM = totalMie( turbidity ) * mieCoefficient;
}
`,fragmentShader:`
varying vec3 vWorldPosition;
varying vec3 vSunDirection;
varying float vSunfade;
varying vec3 vBetaR;
varying vec3 vBetaM;
varying float vSunE;
uniform float mieDirectionalG;
uniform vec3 up;
const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );
// constants for atmospheric scattering
const float pi = 3.141592653589793238462643383279502884197169;
const float n = 1.0003; // refractive index of air
const float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)
// optical length at zenith for molecules
const float rayleighZenithLength = 8.4E3;
const float mieZenithLength = 1.25E3;
// 66 arc seconds -> degrees, and the cosine of that
const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;
// 3.0 / ( 16.0 * pi )
const float THREE_OVER_SIXTEENPI = 0.05968310365946075;
// 1.0 / ( 4.0 * pi )
const float ONE_OVER_FOURPI = 0.07957747154594767;
float rayleighPhase( float cosTheta ) {
return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );
}
float hgPhase( float cosTheta, float g ) {
float g2 = pow( g, 2.0 );
float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );
return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );
}
void main() {
vec3 direction = normalize( vWorldPosition - cameraPos );
// optical length
// cutoff angle at 90 to avoid singularity in next formula.
float zenithAngle = acos( max( 0.0, dot( up, direction ) ) );
float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );
float sR = rayleighZenithLength * inverse;
float sM = mieZenithLength * inverse;
// combined extinction factor
vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );
// in scattering
float cosTheta = dot( direction, vSunDirection );
float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );
vec3 betaRTheta = vBetaR * rPhase;
float mPhase = hgPhase( cosTheta, mieDirectionalG );
vec3 betaMTheta = vBetaM * mPhase;
vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );
Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );
// nightsky
float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2]
float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2]
vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );
vec3 L0 = vec3( 0.1 ) * Fex;
// composition + solar disc
float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );
L0 += ( vSunE * 19000.0 * Fex ) * sundisk;
vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );
vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );
gl_FragColor = vec4( retColor, 1.0 );
#include <tonemapping_fragment>
#include <${parseInt(Wl.replace(/\D+/g,""))>=154?"colorspace_fragment":"encodings_fragment"}>
}
`},SR=new sn({name:"SkyShader",fragmentShader:_m.fragmentShader,vertexShader:_m.vertexShader,uniforms:Hn.clone(_m.uniforms),side:Ki,depthWrite:!1});class wR extends nn{constructor(){super(new qo(1,1,1),SR)}}ut(wR,"SkyShader",_m);ut(wR,"material",SR);const CR=class extends nn{constructor(n,e={}){super(n),this.isWater=!0,this.type="Water";const t=this,i=e.color!==void 0?new He(e.color):new He(16777215),r=e.textureWidth||512,s=e.textureHeight||512,a=e.clipBias||0,o=e.flowDirection||new _e(1,0),l=e.flowSpeed||.03,c=e.reflectivity||.02,u=e.scale||1,h=e.shader||CR.WaterShader,f=e.encoding!==void 0?e.encoding:3e3,p=e.flowMap||void 0,m=e.normalMap0,y=e.normalMap1,v=.15,A=v*.5,_=new ct,x=new s1;if(Xy===void 0){console.error("THREE.Water: Required component Reflector not found.");return}if(jy===void 0){console.error("THREE.Water: Required component Refractor not found.");return}const E=new Xy(n,{textureWidth:r,textureHeight:s,clipBias:a,encoding:f}),w=new jy(n,{textureWidth:r,textureHeight:s,clipBias:a,encoding:f});E.matrixAutoUpdate=!1,w.matrixAutoUpdate=!1,this.material=new sn({uniforms:Hn.merge([Je.fog,h.uniforms]),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader,transparent:!0,fog:!0}),p!==void 0?(this.material.defines.USE_FLOWMAP="",this.material.uniforms.tFlowMap={type:"t",value:p}):this.material.uniforms.flowDirection={type:"v2",value:o},m.wrapS=m.wrapT=Qo,y.wrapS=y.wrapT=Qo,this.material.uniforms.tReflectionMap.value=E.getRenderTarget().texture,this.material.uniforms.tRefractionMap.value=w.getRenderTarget().texture,this.material.uniforms.tNormalMap0.value=m,this.material.uniforms.tNormalMap1.value=y,this.material.uniforms.color.value=i,this.material.uniforms.reflectivity.value=c,this.material.uniforms.textureMatrix.value=_,this.material.uniforms.config.value.x=0,this.material.uniforms.config.value.y=A,this.material.uniforms.config.value.z=A,this.material.uniforms.config.value.w=u;function I(M){_.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),_.multiply(M.projectionMatrix),_.multiply(M.matrixWorldInverse),_.multiply(t.matrixWorld)}function T(){const M=x.getDelta(),b=t.material.uniforms.config;b.value.x+=l*M,b.value.y=b.value.x+A,b.value.x>=v?(b.value.x=0,b.value.y=A):b.value.y>=v&&(b.value.y=b.value.y-v)}this.onBeforeRender=function(M,b,B){I(B),T(),t.visible=!1,E.matrixWorld.copy(t.matrixWorld),w.matrixWorld.copy(t.matrixWorld),E.onBeforeRender(M,b,B),w.onBeforeRender(M,b,B),t.visible=!0}}};let gee=CR;ut(gee,"WaterShader",{uniforms:{color:{value:null},reflectivity:{value:0},tReflectionMap:{value:null},tRefractionMap:{value:null},tNormalMap0:{value:null},tNormalMap1:{value:null},textureMatrix:{value:null},config:{value:new jt}},vertexShader:`
#include <common>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
uniform mat4 textureMatrix;
varying vec4 vCoord;
varying vec2 vUv;
varying vec3 vToEye;
void main() {
vUv = uv;
vCoord = textureMatrix * vec4( position, 1.0 );
vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
vToEye = cameraPosition - worldPosition.xyz;
vec4 mvPosition = viewMatrix * worldPosition; // used in fog_vertex
gl_Position = projectionMatrix * mvPosition;
#include <logdepthbuf_vertex>
#include <fog_vertex>
}`,fragmentShader:`
#include <common>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
uniform sampler2D tReflectionMap;
uniform sampler2D tRefractionMap;
uniform sampler2D tNormalMap0;
uniform sampler2D tNormalMap1;
#ifdef USE_FLOWMAP
uniform sampler2D tFlowMap;
#else
uniform vec2 flowDirection;
#endif
uniform vec3 color;
uniform float reflectivity;
uniform vec4 config;
varying vec4 vCoord;
varying vec2 vUv;
varying vec3 vToEye;
void main() {
#include <logdepthbuf_fragment>
float flowMapOffset0 = config.x;
float flowMapOffset1 = config.y;
float halfCycle = config.z;
float scale = config.w;
vec3 toEye = normalize( vToEye );
// determine flow direction
vec2 flow;
#ifdef USE_FLOWMAP
flow = texture2D( tFlowMap, vUv ).rg * 2.0 - 1.0;
#else
flow = flowDirection;
#endif
flow.x *= - 1.0;
// sample normal maps (distort uvs with flowdata)
vec4 normalColor0 = texture2D( tNormalMap0, ( vUv * scale ) + flow * flowMapOffset0 );
vec4 normalColor1 = texture2D( tNormalMap1, ( vUv * scale ) + flow * flowMapOffset1 );
// linear interpolate to get the final normal color
float flowLerp = abs( halfCycle - flowMapOffset0 ) / halfCycle;
vec4 normalColor = mix( normalColor0, normalColor1, flowLerp );
// calculate normal vector
vec3 normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );
// calculate the fresnel term to blend reflection and refraction maps
float theta = max( dot( toEye, normal ), 0.0 );
float reflectance = reflectivity + ( 1.0 - reflectivity ) * pow( ( 1.0 - theta ), 5.0 );
// calculate final uv coords
vec3 coord = vCoord.xyz / vCoord.w;
vec2 uv = coord.xy + coord.z * normal.xz * 0.05;
vec4 reflectColor = texture2D( tReflectionMap, vec2( 1.0 - uv.x, uv.y ) );
vec4 refractColor = texture2D( tRefractionMap, uv );
// multiply water color with the mix of both textures
gl_FragColor = vec4( color, 1.0 ) * mix( refractColor, reflectColor, reflectance );
#include <tonemapping_fragment>
#include <${parseInt(Wl.replace(/\D+/g,""))>=154?"colorspace_fragment":"encodings_fragment"}>
#include <fog_fragment>
}`});const l5={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(`
`),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","#include <packing>","void main() {"," float depth = 1.0 - unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );"," gl_FragColor = vec4( vec3( depth ), opacity );","}"].join(`
`)};class b1{constructor(){ut(this,"enabled",!0),ut(this,"needsSwap",!0),ut(this,"clear",!1),ut(this,"renderToScreen",!1)}setSize(e,t){}render(e,t,i,r,s){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}class I1{constructor(e){ut(this,"camera",new ql(-1,1,1,-1,0,1)),ut(this,"geometry",new Xo(2,2)),ut(this,"mesh"),this.mesh=new nn(this.geometry,e)}get material(){return this.mesh.material}set material(e){this.mesh.material=e}dispose(){this.mesh.geometry.dispose()}render(e){e.render(this.mesh,this.camera)}}const ja={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(`
`),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {"," vec4 texel = texture2D( tDiffuse, vUv );"," gl_FragColor = opacity * texel;","}"].join(`
`)},_d={defines:{PERSPECTIVE_CAMERA:1,KERNEL_SIZE:32},uniforms:{tDiffuse:{value:null},tNormal:{value:null},tDepth:{value:null},tNoise:{value:null},kernel:{value:null},cameraNear:{value:null},cameraFar:{value:null},resolution:{value:new _e},cameraProjectionMatrix:{value:new ct},cameraInverseProjectionMatrix:{value:new ct},kernelRadius:{value:8},minDistance:{value:.005},maxDistance:{value:.05}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(`
`),fragmentShader:["uniform sampler2D tDiffuse;","uniform sampler2D tNormal;","uniform sampler2D tDepth;","uniform sampler2D tNoise;","uniform vec3 kernel[ KERNEL_SIZE ];","uniform vec2 resolution;","uniform float cameraNear;","uniform float cameraFar;","uniform mat4 cameraProjectionMatrix;","uniform mat4 cameraInverseProjectionMatrix;","uniform float kernelRadius;","uniform float minDistance;","uniform float maxDistance;","varying vec2 vUv;","#include <packing>","float getDepth( const in vec2 screenPosition ) {"," return texture2D( tDepth, screenPosition ).x;","}","float getLinearDepth( const in vec2 screenPosition ) {"," #if PERSPECTIVE_CAMERA == 1"," float fragCoordZ = texture2D( tDepth, screenPosition ).x;"," float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );"," return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );"," #else"," return texture2D( tDepth, screenPosition ).x;"," #endif","}","float getViewZ( const in float depth ) {"," #if PERSPECTIVE_CAMERA == 1"," return perspectiveDepthToViewZ( depth, cameraNear, cameraFar );"," #else"," return orthographicDepthToViewZ( depth, cameraNear, cameraFar );"," #endif","}","vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {"," float clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];"," vec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );"," clipPosition *= clipW; // unprojection."," return ( cameraInverseProjectionMatrix * clipPosition ).xyz;","}","vec3 getViewNormal( const in vec2 screenPosition ) {"," return unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );","}","void main() {"," float depth = getDepth( vUv );"," float viewZ = getViewZ( depth );"," vec3 viewPosition = getViewPosition( vUv, depth, viewZ );"," vec3 viewNormal = getViewNormal( vUv );"," vec2 noiseScale = vec2( resolution.x / 4.0, resolution.y / 4.0 );"," vec3 random = texture2D( tNoise, vUv * noiseScale ).xyz;"," vec3 tangent = normalize( random - viewNormal * dot( random, viewNormal ) );"," vec3 bitangent = cross( viewNormal, tangent );"," mat3 kernelMatrix = mat3( tangent, bitangent, viewNormal );"," float occlusion = 0.0;"," for ( int i = 0; i < KERNEL_SIZE; i ++ ) {"," vec3 sampleVector = kernelMatrix * kernel[ i ];"," vec3 samplePoint = viewPosition + ( sampleVector * kernelRadius );"," vec4 samplePointNDC = cameraProjectionMatrix * vec4( samplePoint, 1.0 );"," samplePointNDC /= samplePointNDC.w;"," vec2 samplePointUv = samplePointNDC.xy * 0.5 + 0.5;"," float realDepth = getLinearDepth( samplePointUv );"," float sampleDepth = viewZToOrthographicDepth( samplePoint.z, cameraNear, cameraFar );"," float delta = sampleDepth - realDepth;"," if ( delta > minDistance && delta < maxDistance ) {"," occlusion += 1.0;"," }"," }"," occlusion = clamp( occlusion / float( KERNEL_SIZE ), 0.0, 1.0 );"," gl_FragColor = vec4( vec3( 1.0 - occlusion ), 1.0 );","}"].join(`
`)},Wg={defines:{PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},cameraNear:{value:null},cameraFar:{value:null}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(`
`),fragmentShader:["uniform sampler2D tDepth;","uniform float cameraNear;","uniform float cameraFar;","varying vec2 vUv;","#include <packing>","float getLinearDepth( const in vec2 screenPosition ) {"," #if PERSPECTIVE_CAMERA == 1"," float fragCoordZ = texture2D( tDepth, screenPosition ).x;"," float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );"," return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );"," #else"," return texture2D( tDepth, screenPosition ).x;"," #endif","}","void main() {"," float depth = getLinearDepth( vUv );"," gl_FragColor = vec4( vec3( 1.0 - depth ), 1.0 );","}"].join(`
`)},Yg={uniforms:{tDiffuse:{value:null},resolution:{value:new _e}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(`
`),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec2 resolution;","varying vec2 vUv;","void main() {"," vec2 texelSize = ( 1.0 / resolution );"," float result = 0.0;"," for ( int i = - 2; i <= 2; i ++ ) {"," for ( int j = - 2; j <= 2; j ++ ) {"," vec2 offset = ( vec2( float( i ), float( j ) ) ) * texelSize;"," result += texture2D( tDiffuse, vUv + offset ).r;"," }"," }"," gl_FragColor = vec4( vec3( result / ( 5.0 * 5.0 ) ), 1.0 );","}"].join(`
`)},Uc=class extends b1{constructor(n,e,t,i){super(),this.width=t!==void 0?t:512,this.height=i!==void 0?i:512,this.clear=!0,this.camera=e,this.scene=n,this.kernelRadius=8,this.kernelSize=32,this.kernel=[],this.noiseTexture=null,this.output=0,this.minDistance=.005,this.maxDistance=.1,this._visibilityCache=new Map,this.generateSampleKernel(),this.generateRandomKernelRotations();const r=new uf;r.format=Nl,r.type=ko,this.beautyRenderTarget=new Dn(this.width,this.height),this.normalRenderTarget=new Dn(this.width,this.height,{minFilter:Rt,magFilter:Rt,depthTexture:r}),this.ssaoRenderTarget=new Dn(this.width,this.height),this.blurRenderTarget=this.ssaoRenderTarget.clone(),_d===void 0&&console.error("THREE.SSAOPass: The pass relies on SSAOShader."),this.ssaoMaterial=new sn({defines:Object.assign({},_d.defines),uniforms:Hn.clone(_d.uniforms),vertexShader:_d.vertexShader,fragmentShader:_d.fragmentShader,blending:Kt}),this.ssaoMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.ssaoMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture,this.ssaoMaterial.uniforms.tDepth.value=this.normalRenderTarget.depthTexture,this.ssaoMaterial.uniforms.tNoise.value=this.noiseTexture,this.ssaoMaterial.uniforms.kernel.value=this.kernel,this.ssaoMaterial.uniforms.cameraNear.value=this.camera.near,this.ssaoMaterial.uniforms.cameraFar.value=this.camera.far,this.ssaoMaterial.uniforms.resolution.value.set(this.width,this.height),this.ssaoMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssaoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.normalMaterial=new p0,this.normalMaterial.blending=Kt,this.blurMaterial=new sn({defines:Object.assign({},Yg.defines),uniforms:Hn.clone(Yg.uniforms),vertexShader:Yg.vertexShader,fragmentShader:Yg.fragmentShader}),this.blurMaterial.uniforms.tDiffuse.value=this.ssaoRenderTarget.texture,this.blurMaterial.uniforms.resolution.value.set(this.width,this.height),this.depthRenderMaterial=new sn({defines:Object.assign({},Wg.defines),uniforms:Hn.clone(Wg.uniforms),vertexShader:Wg.vertexShader,fragmentShader:Wg.fragmentShader,blending:Kt}),this.depthRenderMaterial.uniforms.tDepth.value=this.normalRenderTarget.depthTexture,this.depthRenderMaterial.uniforms.cameraNear.value=this.camera.near,this.depthRenderMaterial.uniforms.cameraFar.value=this.camera.far,this.copyMaterial=new sn({uniforms:Hn.clone(ja.uniforms),vertexShader:ja.vertexShader,fragmentShader:ja.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blendSrc:M2,blendDst:Hh,blendEquation:ss,blendSrcAlpha:I2,blendDstAlpha:Hh,blendEquationAlpha:ss}),this.fsQuad=new I1(null),this.originalClearColor=new He}dispose(){this.beautyRenderTarget.dispose(),this.normalRenderTarget.dispose(),this.ssaoRenderTarget.dispose(),this.blurRenderTarget.dispose(),this.normalMaterial.dispose(),this.blurMaterial.dispose(),this.copyMaterial.dispose(),this.depthRenderMaterial.dispose(),this.fsQuad.dispose()}render(n,e){switch(n.capabilities.isWebGL2===!1&&(this.noiseTexture.format=S6),n.setRenderTarget(this.beautyRenderTarget),n.clear(),n.render(this.scene,this.camera),this.overrideVisibility(),this.renderOverride(n,this.normalMaterial,this.normalRenderTarget,7829503,1),this.restoreVisibility(),this.ssaoMaterial.uniforms.kernelRadius.value=this.kernelRadius,this.ssaoMaterial.uniforms.minDistance.value=this.minDistance,this.ssaoMaterial.uniforms.maxDistance.value=this.maxDistance,this.renderPass(n,this.ssaoMaterial,this.ssaoRenderTarget),this.renderPass(n,this.blurMaterial,this.blurRenderTarget),this.output){case Uc.OUTPUT.SSAO:this.copyMaterial.uniforms.tDiffuse.value=this.ssaoRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e);break;case Uc.OUTPUT.Blur:this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e);break;case Uc.OUTPUT.Beauty:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e);break;case Uc.OUTPUT.Depth:this.renderPass(n,this.depthRenderMaterial,this.renderToScreen?null:e);break;case Uc.OUTPUT.Normal:this.copyMaterial.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e);break;case Uc.OUTPUT.Default:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e),this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.copyMaterial.blending=pp,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e);break;default:console.warn("THREE.SSAOPass: Unknown output type.")}}renderPass(n,e,t,i,r){n.getClearColor(this.originalClearColor);const s=n.getClearAlpha(),a=n.autoClear;n.setRenderTarget(t),n.autoClear=!1,i!=null&&(n.setClearColor(i),n.setClearAlpha(r||0),n.clear()),this.fsQuad.material=e,this.fsQuad.render(n),n.autoClear=a,n.setClearColor(this.originalClearColor),n.setClearAlpha(s)}renderOverride(n,e,t,i,r){n.getClearColor(this.originalClearColor);const s=n.getClearAlpha(),a=n.autoClear;n.setRenderTarget(t),n.autoClear=!1,i=e.clearColor||i,r=e.clearAlpha||r,i!=null&&(n.setClearColor(i),n.setClearAlpha(r||0),n.clear()),this.scene.overrideMaterial=e,n.render(this.scene,this.camera),this.scene.overrideMaterial=null,n.autoClear=a,n.setClearColor(this.originalClearColor),n.setClearAlpha(s)}setSize(n,e){this.width=n,this.height=e,this.beautyRenderTarget.setSize(n,e),this.ssaoRenderTarget.setSize(n,e),this.normalRenderTarget.setSize(n,e),this.blurRenderTarget.setSize(n,e),this.ssaoMaterial.uniforms.resolution.value.set(n,e),this.ssaoMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssaoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.blurMaterial.uniforms.resolution.value.set(n,e)}generateSampleKernel(){const n=this.kernelSize,e=this.kernel;for(let t=0;t<n;t++){const i=new N;i.x=Math.random()*2-1,i.y=Math.random()*2-1,i.z=Math.random(),i.normalize();let r=t/n;r=Ll.lerp(.1,1,r*r),i.multiplyScalar(r),e.push(i)}}generateRandomKernelRotations(){op===void 0&&console.error("THREE.SSAOPass: The pass relies on SimplexNoise.");const t=new op,i=4*4,r=new Float32Array(i);for(let s=0;s<i;s++){const a=Math.random()*2-1,o=Math.random()*2-1,l=0;r[s]=t.noise3d(a,o,l)}this.noiseTexture=new Va(r,4,4,Qc,br),this.noiseTexture.wrapS=Qo,this.noiseTexture.wrapT=Qo,this.noiseTexture.needsUpdate=!0}overrideVisibility(){const n=this.scene,e=this._visibilityCache;n.traverse(function(t){e.set(t,t.visible),(t.isPoints||t.isLine)&&(t.visible=!1)})}restoreVisibility(){const n=this.scene,e=this._visibilityCache;n.traverse(function(t){const i=e.get(t);t.visible=i}),e.clear()}};let mee=Uc;ut(mee,"OUTPUT",{Default:0,SSAO:1,Blur:2,Beauty:3,Depth:4,Normal:5});const Aee={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new He(0)},defaultOpacity:{value:0}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(`
`),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec3 defaultColor;","uniform float defaultOpacity;","uniform float luminosityThreshold;","uniform float smoothWidth;","varying vec2 vUv;","void main() {"," vec4 texel = texture2D( tDiffuse, vUv );"," vec3 luma = vec3( 0.299, 0.587, 0.114 );"," float v = dot( texel.xyz, luma );"," vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );"," float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );"," gl_FragColor = mix( outputColor, texel, alpha );","}"].join(`
`)},$y=class extends b1{constructor(n,e,t,i){super(),this.strength=e!==void 0?e:1,this.radius=t,this.threshold=i,this.resolution=n!==void 0?new _e(n.x,n.y):new _e(256,256),this.clearColor=new He(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let r=Math.round(this.resolution.x/2),s=Math.round(this.resolution.y/2);this.renderTargetBright=new Dn(r,s,{type:Ai}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let u=0;u<this.nMips;u++){const h=new Dn(r,s,{type:Ai});h.texture.name="UnrealBloomPass.h"+u,h.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(h);const f=new Dn(r,s,{type:Ai});f.texture.name="UnrealBloomPass.v"+u,f.texture.generateMipmaps=!1,this.renderTargetsVertical.push(f),r=Math.round(r/2),s=Math.round(s/2)}const a=Aee;this.highPassUniforms=Hn.clone(a.uniforms),this.highPassUniforms.luminosityThreshold.value=i,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new sn({uniforms:this.highPassUniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader,defines:{}}),this.separableBlurMaterials=[];const o=[3,5,7,9,11];r=Math.round(this.resolution.x/2),s=Math.round(this.resolution.y/2);for(let u=0;u<this.nMips;u++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(o[u])),this.separableBlurMaterials[u].uniforms.texSize.value=new _e(r,s),r=Math.round(r/2),s=Math.round(s/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=e,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.needsUpdate=!0;const l=[1,.8,.6,.4,.2];this.compositeMaterial.uniforms.bloomFactors.value=l,this.bloomTintColors=[new N(1,1,1),new N(1,1,1),new N(1,1,1),new N(1,1,1),new N(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;const c=ja;this.copyUniforms=Hn.clone(c.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new sn({uniforms:this.copyUniforms,vertexShader:c.vertexShader,fragmentShader:c.fragmentShader,blending:dp,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new He,this.oldClearAlpha=1,this.basic=new cs,this.fsQuad=new I1(null)}dispose(){for(let n=0;n<this.renderTargetsHorizontal.length;n++)this.renderTargetsHorizontal[n].dispose();for(let n=0;n<this.renderTargetsVertical.length;n++)this.renderTargetsVertical[n].dispose();this.renderTargetBright.dispose();for(let n=0;n<this.separableBlurMaterials.length;n++)this.separableBlurMaterials[n].dispose();this.compositeMaterial.dispose(),this.materialCopy.dispose(),this.basic.dispose(),this.fsQuad.dispose()}setSize(n,e){let t=Math.round(n/2),i=Math.round(e/2);this.renderTargetBright.setSize(t,i);for(let r=0;r<this.nMips;r++)this.renderTargetsHorizontal[r].setSize(t,i),this.renderTargetsVertical[r].setSize(t,i),this.separableBlurMaterials[r].uniforms.texSize.value=new _e(t,i),t=Math.round(t/2),i=Math.round(i/2)}render(n,e,t,i,r){n.getClearColor(this._oldClearColor),this.oldClearAlpha=n.getClearAlpha();const s=n.autoClear;n.autoClear=!1,n.setClearColor(this.clearColor,0),r&&n.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=t.texture,n.setRenderTarget(null),n.clear(),this.fsQuad.render(n)),this.highPassUniforms.tDiffuse.value=t.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,n.setRenderTarget(this.renderTargetBright),n.clear(),this.fsQuad.render(n);let a=this.renderTargetBright;for(let o=0;o<this.nMips;o++)this.fsQuad.material=this.separableBlurMaterials[o],this.separableBlurMaterials[o].uniforms.colorTexture.value=a.texture,this.separableBlurMaterials[o].uniforms.direction.value=$y.BlurDirectionX,n.setRenderTarget(this.renderTargetsHorizontal[o]),n.clear(),this.fsQuad.render(n),this.separableBlurMaterials[o].uniforms.colorTexture.value=this.renderTargetsHorizontal[o].texture,this.separableBlurMaterials[o].uniforms.direction.value=$y.BlurDirectionY,n.setRenderTarget(this.renderTargetsVertical[o]),n.clear(),this.fsQuad.render(n),a=this.renderTargetsVertical[o];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,n.setRenderTarget(this.renderTargetsHorizontal[0]),n.clear(),this.fsQuad.render(n),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,r&&n.state.buffers.stencil.setTest(!0),this.renderToScreen?(n.setRenderTarget(null),this.fsQuad.render(n)):(n.setRenderTarget(t),this.fsQuad.render(n)),n.setClearColor(this._oldClearColor,this.oldClearAlpha),n.autoClear=s}getSeperableBlurMaterial(n){return new sn({defines:{KERNEL_RADIUS:n,SIGMA:n},uniforms:{colorTexture:{value:null},texSize:{value:new _e(.5,.5)},direction:{value:new _e(.5,.5)}},vertexShader:`varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,fragmentShader:`#include <common>
varying vec2 vUv;
uniform sampler2D colorTexture;
uniform vec2 texSize;
uniform vec2 direction;
float gaussianPdf(in float x, in float sigma) {
return 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;
}
void main() {
vec2 invSize = 1.0 / texSize;
float fSigma = float(SIGMA);
float weightSum = gaussianPdf(0.0, fSigma);
vec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;
for( int i = 1; i < KERNEL_RADIUS; i ++ ) {
float x = float(i);
float w = gaussianPdf(x, fSigma);
vec2 uvOffset = direction * invSize * x;
vec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;
vec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;
diffuseSum += (sample1 + sample2) * w;
weightSum += 2.0 * w;
}
gl_FragColor = vec4(diffuseSum/weightSum, 1.0);
}`})}getCompositeMaterial(n){return new sn({defines:{NUM_MIPS:n},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,fragmentShader:`varying vec2 vUv;
uniform sampler2D blurTexture1;
uniform sampler2D blurTexture2;
uniform sampler2D blurTexture3;
uniform sampler2D blurTexture4;
uniform sampler2D blurTexture5;
uniform float bloomStrength;
uniform float bloomRadius;
uniform float bloomFactors[NUM_MIPS];
uniform vec3 bloomTintColors[NUM_MIPS];
float lerpBloomFactor(const in float factor) {
float mirrorFactor = 1.2 - factor;
return mix(factor, mirrorFactor, bloomRadius);
}
void main() {
gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +
lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +
lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +
lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +
lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );
}`})}};let TR=$y;ut(TR,"BlurDirectionX",new _e(1,0));ut(TR,"BlurDirectionY",new _e(0,1));const qg={defines:{NUM_SAMPLES:7,NUM_RINGS:4,NORMAL_TEXTURE:0,DIFFUSE_TEXTURE:0,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},tDiffuse:{value:null},tNormal:{value:null},size:{value:new _e(512,512)},cameraNear:{value:1},cameraFar:{value:100},cameraProjectionMatrix:{value:new ct},cameraInverseProjectionMatrix:{value:new ct},scale:{value:1},intensity:{value:.1},bias:{value:.5},minResolution:{value:0},kernelRadius:{value:100},randomSeed:{value:0}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(`
`),fragmentShader:["#include <common>","varying vec2 vUv;","#if DIFFUSE_TEXTURE == 1","uniform sampler2D tDiffuse;","#endif","uniform sampler2D tDepth;","#if NORMAL_TEXTURE == 1","uniform sampler2D tNormal;","#endif","uniform float cameraNear;","uniform float cameraFar;","uniform mat4 cameraProjectionMatrix;","uniform mat4 cameraInverseProjectionMatrix;","uniform float scale;","uniform float intensity;","uniform float bias;","uniform float kernelRadius;","uniform float minResolution;","uniform vec2 size;","uniform float randomSeed;","// RGBA depth","#include <packing>","vec4 getDefaultColor( const in vec2 screenPosition ) {"," #if DIFFUSE_TEXTURE == 1"," return texture2D( tDiffuse, vUv );"," #else"," return vec4( 1.0 );"," #endif","}","float getDepth( const in vec2 screenPosition ) {"," #if DEPTH_PACKING == 1"," return unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );"," #else"," return texture2D( tDepth, screenPosition ).x;"," #endif","}","float getViewZ( const in float depth ) {"," #if PERSPECTIVE_CAMERA == 1"," return perspectiveDepthToViewZ( depth, cameraNear, cameraFar );"," #else"," return orthographicDepthToViewZ( depth, cameraNear, cameraFar );"," #endif","}","vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {"," float clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];"," vec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );"," clipPosition *= clipW; // unprojection."," return ( cameraInverseProjectionMatrix * clipPosition ).xyz;","}","vec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPosition ) {"," #if NORMAL_TEXTURE == 1"," return unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );"," #else"," return normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );"," #endif","}","float scaleDividedByCameraFar;","float minResolutionMultipliedByCameraFar;","float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {"," vec3 viewDelta = sampleViewPosition - centerViewPosition;"," float viewDistance = length( viewDelta );"," float scaledScreenDistance = scaleDividedByCameraFar * viewDistance;"," return max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - bias) / (1.0 + pow2( scaledScreenDistance ) );","}","// moving costly divides into consts","const float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );","const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );","float getAmbientOcclusion( const in vec3 centerViewPosition ) {"," // precompute some variables require in getOcclusion."," scaleDividedByCameraFar = scale / cameraFar;"," minResolutionMultipliedByCameraFar = minResolution * cameraFar;"," vec3 centerViewNormal = getViewNormal( centerViewPosition, vUv );"," // jsfiddle that shows sample pattern: https://jsfiddle.net/a16ff1p7/"," float angle = rand( vUv + randomSeed ) * PI2;"," vec2 radius = vec2( kernelRadius * INV_NUM_SAMPLES ) / size;"," vec2 radiusStep = radius;"," float occlusionSum = 0.0;"," float weightSum = 0.0;"," for( int i = 0; i < NUM_SAMPLES; i ++ ) {"," vec2 sampleUv = vUv + vec2( cos( angle ), sin( angle ) ) * radius;"," radius += radiusStep;"," angle += ANGLE_STEP;"," float sampleDepth = getDepth( sampleUv );"," if( sampleDepth >= ( 1.0 - EPSILON ) ) {"," continue;"," }"," float sampleViewZ = getViewZ( sampleDepth );"," vec3 sampleViewPosition = getViewPosition( sampleUv, sampleDepth, sampleViewZ );"," occlusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );"," weightSum += 1.0;"," }"," if( weightSum == 0.0 ) discard;"," return occlusionSum * ( intensity / weightSum );","}","void main() {"," float centerDepth = getDepth( vUv );"," if( centerDepth >= ( 1.0 - EPSILON ) ) {"," discard;"," }"," float centerViewZ = getViewZ( centerDepth );"," vec3 viewPosition = getViewPosition( vUv, centerDepth, centerViewZ );"," float ambientOcclusion = getAmbientOcclusion( viewPosition );"," gl_FragColor = getDefaultColor( vUv );"," gl_FragColor.xyz *= 1.0 - ambientOcclusion;","}"].join(`
`)},xl={defines:{KERNEL_RADIUS:4,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDiffuse:{value:null},size:{value:new _e(512,512)},sampleUvOffsets:{value:[new _e(0,0)]},sampleWeights:{value:[1]},tDepth:{value:null},cameraNear:{value:10},cameraFar:{value:1e3},depthCutoff:{value:10}},vertexShader:["#include <common>","uniform vec2 size;","varying vec2 vUv;","varying vec2 vInvSize;","void main() {"," vUv = uv;"," vInvSize = 1.0 / size;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(`
`),fragmentShader:["#include <common>","#include <packing>","uniform sampler2D tDiffuse;","uniform sampler2D tDepth;","uniform float cameraNear;","uniform float cameraFar;","uniform float depthCutoff;","uniform vec2 sampleUvOffsets[ KERNEL_RADIUS + 1 ];","uniform float sampleWeights[ KERNEL_RADIUS + 1 ];","varying vec2 vUv;","varying vec2 vInvSize;","float getDepth( const in vec2 screenPosition ) {"," #if DEPTH_PACKING == 1"," return unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );"," #else"," return texture2D( tDepth, screenPosition ).x;"," #endif","}","float getViewZ( const in float depth ) {"," #if PERSPECTIVE_CAMERA == 1"," return perspectiveDepthToViewZ( depth, cameraNear, cameraFar );"," #else"," return orthographicDepthToViewZ( depth, cameraNear, cameraFar );"," #endif","}","void main() {"," float depth = getDepth( vUv );"," if( depth >= ( 1.0 - EPSILON ) ) {"," discard;"," }"," float centerViewZ = -getViewZ( depth );"," bool rBreak = false, lBreak = false;"," float weightSum = sampleWeights[0];"," vec4 diffuseSum = texture2D( tDiffuse, vUv ) * weightSum;"," for( int i = 1; i <= KERNEL_RADIUS; i ++ ) {"," float sampleWeight = sampleWeights[i];"," vec2 sampleUvOffset = sampleUvOffsets[i] * vInvSize;"," vec2 sampleUv = vUv + sampleUvOffset;"," float viewZ = -getViewZ( getDepth( sampleUv ) );"," if( abs( viewZ - centerViewZ ) > depthCutoff ) rBreak = true;"," if( ! rBreak ) {"," diffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;"," weightSum += sampleWeight;"," }"," sampleUv = vUv - sampleUvOffset;"," viewZ = -getViewZ( getDepth( sampleUv ) );"," if( abs( viewZ - centerViewZ ) > depthCutoff ) lBreak = true;"," if( ! lBreak ) {"," diffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;"," weightSum += sampleWeight;"," }"," }"," gl_FragColor = diffuseSum / weightSum;","}"].join(`
`)},h2={createSampleWeights:(n,e)=>{const t=(r,s)=>Math.exp(-(r*r)/(2*(s*s)))/(Math.sqrt(2*Math.PI)*s),i=[];for(let r=0;r<=n;r++)i.push(t(r,e));return i},createSampleOffsets:(n,e)=>{const t=[];for(let i=0;i<=n;i++)t.push(e.clone().multiplyScalar(i));return t},configure:(n,e,t,i)=>{n.defines.KERNEL_RADIUS=e,n.uniforms.sampleUvOffsets.value=h2.createSampleOffsets(e,i),n.uniforms.sampleWeights.value=h2.createSampleWeights(e,t),n.needsUpdate=!0}};class vee extends b1{constructor(e,t,i=!1,r=!1,s=new _e(256,256)){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.supportsDepthTextureExtension=i,this.supportsNormalTexture=r,this.originalClearColor=new He,this._oldClearColor=new He,this.oldClearAlpha=1,this.params={output:0,saoBias:.5,saoIntensity:.18,saoScale:1,saoKernelRadius:100,saoMinResolution:0,saoBlur:!0,saoBlurRadius:8,saoBlurStdDev:4,saoBlurDepthCutoff:.01},this.resolution=new _e(s.x,s.y),this.saoRenderTarget=new Dn(this.resolution.x,this.resolution.y,{type:Ai}),this.blurIntermediateRenderTarget=this.saoRenderTarget.clone(),this.beautyRenderTarget=this.saoRenderTarget.clone(),this.normalRenderTarget=new Dn(this.resolution.x,this.resolution.y,{minFilter:Rt,magFilter:Rt,type:Ai}),this.depthRenderTarget=this.normalRenderTarget.clone();let a;this.supportsDepthTextureExtension&&(a=new uf,a.type=Au,this.beautyRenderTarget.depthTexture=a,this.beautyRenderTarget.depthBuffer=!0),this.depthMaterial=new u0,this.depthMaterial.depthPacking=P2,this.depthMaterial.blending=Kt,this.normalMaterial=new p0,this.normalMaterial.blending=Kt,this.saoMaterial=new sn({defines:Object.assign({},qg.defines),fragmentShader:qg.fragmentShader,vertexShader:qg.vertexShader,uniforms:Hn.clone(qg.uniforms)}),this.saoMaterial.extensions.derivatives=!0,this.saoMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.saoMaterial.defines.NORMAL_TEXTURE=this.supportsNormalTexture?1:0,this.saoMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.saoMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?a:this.depthRenderTarget.texture,this.saoMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture,this.saoMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.saoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.saoMaterial.uniforms.cameraProjectionMatrix.value=this.camera.projectionMatrix,this.saoMaterial.blending=Kt,this.vBlurMaterial=new sn({uniforms:Hn.clone(xl.uniforms),defines:Object.assign({},xl.defines),vertexShader:xl.vertexShader,fragmentShader:xl.fragmentShader}),this.vBlurMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.vBlurMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.vBlurMaterial.uniforms.tDiffuse.value=this.saoRenderTarget.texture,this.vBlurMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?a:this.depthRenderTarget.texture,this.vBlurMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.vBlurMaterial.blending=Kt,this.hBlurMaterial=new sn({uniforms:Hn.clone(xl.uniforms),defines:Object.assign({},xl.defines),vertexShader:xl.vertexShader,fragmentShader:xl.fragmentShader}),this.hBlurMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.hBlurMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.hBlurMaterial.uniforms.tDiffuse.value=this.blurIntermediateRenderTarget.texture,this.hBlurMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?a:this.depthRenderTarget.texture,this.hBlurMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.hBlurMaterial.blending=Kt,this.materialCopy=new sn({uniforms:Hn.clone(ja.uniforms),vertexShader:ja.vertexShader,fragmentShader:ja.fragmentShader,blending:Kt}),this.materialCopy.transparent=!0,this.materialCopy.depthTest=!1,this.materialCopy.depthWrite=!1,this.materialCopy.blending=pp,this.materialCopy.blendSrc=M2,this.materialCopy.blendDst=Hh,this.materialCopy.blendEquation=ss,this.materialCopy.blendSrcAlpha=I2,this.materialCopy.blendDstAlpha=Hh,this.materialCopy.blendEquationAlpha=ss,this.depthCopy=new sn({uniforms:Hn.clone(l5.uniforms),vertexShader:l5.vertexShader,fragmentShader:l5.fragmentShader,blending:Kt}),this.fsQuad=new I1(null)}render(e,t,i){if(this.renderToScreen&&(this.materialCopy.blending=Kt,this.materialCopy.uniforms.tDiffuse.value=i.texture,this.materialCopy.needsUpdate=!0,this.renderPass(e,this.materialCopy,null)),this.params.output===1)return;e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const r=e.autoClear;e.autoClear=!1,e.setRenderTarget(this.depthRenderTarget),e.clear(),this.saoMaterial.uniforms.bias.value=this.params.saoBias,this.saoMaterial.uniforms.intensity.value=this.params.saoIntensity,this.saoMaterial.uniforms.scale.value=this.params.saoScale,this.saoMaterial.uniforms.kernelRadius.value=this.params.saoKernelRadius,this.saoMaterial.uniforms.minResolution.value=this.params.saoMinResolution,this.saoMaterial.uniforms.cameraNear.value=this.camera.near,this.saoMaterial.uniforms.cameraFar.value=this.camera.far;const s=this.params.saoBlurDepthCutoff*(this.camera.far-this.camera.near);this.vBlurMaterial.uniforms.depthCutoff.value=s,this.hBlurMaterial.uniforms.depthCutoff.value=s,this.vBlurMaterial.uniforms.cameraNear.value=this.camera.near,this.vBlurMaterial.uniforms.cameraFar.value=this.camera.far,this.hBlurMaterial.uniforms.cameraNear.value=this.camera.near,this.hBlurMaterial.uniforms.cameraFar.value=this.camera.far,this.params.saoBlurRadius=Math.floor(this.params.saoBlurRadius),(this.prevStdDev!==this.params.saoBlurStdDev||this.prevNumSamples!==this.params.saoBlurRadius)&&(h2.configure(this.vBlurMaterial,this.params.saoBlurRadius,this.params.saoBlurStdDev,new _e(0,1)),h2.configure(this.hBlurMaterial,this.params.saoBlurRadius,this.params.saoBlurStdDev,new _e(1,0)),this.prevStdDev=this.params.saoBlurStdDev,this.prevNumSamples=this.params.saoBlurRadius),e.setClearColor(0),e.setRenderTarget(this.beautyRenderTarget),e.clear(),e.render(this.scene,this.camera),this.supportsDepthTextureExtension||this.renderOverride(e,this.depthMaterial,this.depthRenderTarget,0,1),this.supportsNormalTexture&&this.renderOverride(e,this.normalMaterial,this.normalRenderTarget,7829503,1),this.renderPass(e,this.saoMaterial,this.saoRenderTarget,16777215,1),this.params.saoBlur&&(this.renderPass(e,this.vBlurMaterial,this.blurIntermediateRenderTarget,16777215,1),this.renderPass(e,this.hBlurMaterial,this.saoRenderTarget,16777215,1));let a=this.materialCopy;this.params.output===3?this.supportsDepthTextureExtension?(this.materialCopy.uniforms.tDiffuse.value=this.beautyRenderTarget.depthTexture,this.materialCopy.needsUpdate=!0):(this.depthCopy.uniforms.tDiffuse.value=this.depthRenderTarget.texture,this.depthCopy.needsUpdate=!0,a=this.depthCopy):this.params.output===4?(this.materialCopy.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.materialCopy.needsUpdate=!0):(this.materialCopy.uniforms.tDiffuse.value=this.saoRenderTarget.texture,this.materialCopy.needsUpdate=!0),this.params.output===0?a.blending=pp:a.blending=Kt,this.renderPass(e,a,this.renderToScreen?null:i),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=r}renderPass(e,t,i,r,s){e.getClearColor(this.originalClearColor);const a=e.getClearAlpha(),o=e.autoClear;e.setRenderTarget(i),e.autoClear=!1,r!=null&&(e.setClearColor(r),e.setClearAlpha(s||0),e.clear()),this.fsQuad.material=t,this.fsQuad.render(e),e.autoClear=o,e.setClearColor(this.originalClearColor),e.setClearAlpha(a)}renderOverride(e,t,i,r,s){e.getClearColor(this.originalClearColor);const a=e.getClearAlpha(),o=e.autoClear;e.setRenderTarget(i),e.autoClear=!1,r=t.clearColor||r,s=t.clearAlpha||s,r!=null&&(e.setClearColor(r),e.setClearAlpha(s||0),e.clear()),this.scene.overrideMaterial=t,e.render(this.scene,this.camera),this.scene.overrideMaterial=null,e.autoClear=o,e.setClearColor(this.originalClearColor),e.setClearAlpha(a)}setSize(e,t){this.beautyRenderTarget.setSize(e,t),this.saoRenderTarget.setSize(e,t),this.blurIntermediateRenderTarget.setSize(e,t),this.normalRenderTarget.setSize(e,t),this.depthRenderTarget.setSize(e,t),this.saoMaterial.uniforms.size.value.set(e,t),this.saoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.saoMaterial.uniforms.cameraProjectionMatrix.value=this.camera.projectionMatrix,this.saoMaterial.needsUpdate=!0,this.vBlurMaterial.uniforms.size.value.set(e,t),this.vBlurMaterial.needsUpdate=!0,this.hBlurMaterial.uniforms.size.value.set(e,t),this.hBlurMaterial.needsUpdate=!0}dispose(){this.saoRenderTarget.dispose(),this.blurIntermediateRenderTarget.dispose(),this.beautyRenderTarget.dispose(),this.normalRenderTarget.dispose(),this.depthRenderTarget.dispose(),this.depthMaterial.dispose(),this.normalMaterial.dispose(),this.saoMaterial.dispose(),this.vBlurMaterial.dispose(),this.hBlurMaterial.dispose(),this.materialCopy.dispose(),this.depthCopy.dispose(),this.fsQuad.dispose()}}ut(vee,"OUTPUT",{Beauty:1,Default:0,SAO:2,Depth:3,Normal:4});const La={defines:{MAX_STEP:0,isPerspectiveCamera:!0,isDistanceAttenuation:!0,isFresnel:!0,isInfiniteThick:!1,isSelective:!1},uniforms:{tDiffuse:{value:null},tNormal:{value:null},tMetalness:{value:null},tDepth:{value:null},cameraNear:{value:null},cameraFar:{value:null},resolution:{value:new _e},cameraProjectionMatrix:{value:new ct},cameraInverseProjectionMatrix:{value:new ct},opacity:{value:.5},maxDistance:{value:180},cameraRange:{value:0},surfDist:{value:.007},thickTolerance:{value:.03}},vertexShader:`
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
`,fragmentShader:`
// precision highp float;
precision highp sampler2D;
varying vec2 vUv;
uniform sampler2D tDepth;
uniform sampler2D tNormal;
uniform sampler2D tMetalness;
uniform sampler2D tDiffuse;
uniform float cameraRange;
uniform vec2 resolution;
uniform float opacity;
uniform float cameraNear;
uniform float cameraFar;
uniform float maxDistance;
uniform float surfDist;
uniform mat4 cameraProjectionMatrix;
uniform mat4 cameraInverseProjectionMatrix;
uniform float thickTolerance;
#include <packing>
float pointToLineDistance(vec3 x0, vec3 x1, vec3 x2) {
//x0: point, x1: linePointA, x2: linePointB
//https://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html
return length(cross(x0-x1,x0-x2))/length(x2-x1);
}
float pointPlaneDistance(vec3 point,vec3 planePoint,vec3 planeNormal){
// https://mathworld.wolfram.com/Point-PlaneDistance.html
//// https://en.wikipedia.org/wiki/Plane_(geometry)
//// http://paulbourke.net/geometry/pointlineplane/
float a=planeNormal.x,b=planeNormal.y,c=planeNormal.z;
float x0=point.x,y0=point.y,z0=point.z;
float x=planePoint.x,y=planePoint.y,z=planePoint.z;
float d=-(a*x+b*y+c*z);
float distance=(a*x0+b*y0+c*z0+d)/sqrt(a*a+b*b+c*c);
return distance;
}
float getDepth( const in vec2 uv ) {
return texture2D( tDepth, uv ).x;
}
float getViewZ( const in float depth ) {
#ifdef isPerspectiveCamera
return perspectiveDepthToViewZ( depth, cameraNear, cameraFar );
#else
return orthographicDepthToViewZ( depth, cameraNear, cameraFar );
#endif
}
vec3 getViewPosition( const in vec2 uv, const in float depth/*clip space*/, const in float clipW ) {
vec4 clipPosition = vec4( ( vec3( uv, depth ) - 0.5 ) * 2.0, 1.0 );//ndc
clipPosition *= clipW; //clip
return ( cameraInverseProjectionMatrix * clipPosition ).xyz;//view
}
vec3 getViewNormal( const in vec2 uv ) {
return unpackRGBToNormal( texture2D( tNormal, uv ).xyz );
}
vec2 viewPositionToXY(vec3 viewPosition){
vec2 xy;
vec4 clip=cameraProjectionMatrix*vec4(viewPosition,1);
xy=clip.xy;//clip
float clipW=clip.w;
xy/=clipW;//NDC
xy=(xy+1.)/2.;//uv
xy*=resolution;//screen
return xy;
}
void main(){
#ifdef isSelective
float metalness=texture2D(tMetalness,vUv).r;
if(metalness==0.) return;
#endif
float depth = getDepth( vUv );
float viewZ = getViewZ( depth );
if(-viewZ>=cameraFar) return;
float clipW = cameraProjectionMatrix[2][3] * viewZ+cameraProjectionMatrix[3][3];
vec3 viewPosition=getViewPosition( vUv, depth, clipW );
vec2 d0=gl_FragCoord.xy;
vec2 d1;
vec3 viewNormal=getViewNormal( vUv );
#ifdef isPerspectiveCamera
vec3 viewIncidenceDir=normalize(viewPosition);
vec3 viewReflectDir=reflect(viewIncidenceDir,viewNormal);
#else
vec3 viewIncidenceDir=vec3(0,0,-1);
vec3 viewReflectDir=reflect(viewIncidenceDir,viewNormal);
#endif
float maxReflectRayLen=maxDistance/dot(-viewIncidenceDir,viewNormal);
// dot(a,b)==length(a)*length(b)*cos(theta) // https://www.mathsisfun.com/algebra/vectors-dot-product.html
// if(a.isNormalized&&b.isNormalized) dot(a,b)==cos(theta)
// maxDistance/maxReflectRayLen=cos(theta)
// maxDistance/maxReflectRayLen==dot(a,b)
// maxReflectRayLen==maxDistance/dot(a,b)
vec3 d1viewPosition=viewPosition+viewReflectDir*maxReflectRayLen;
#ifdef isPerspectiveCamera
if(d1viewPosition.z>-cameraNear){
//https://tutorial.math.lamar.edu/Classes/CalcIII/EqnsOfLines.aspx
float t=(-cameraNear-viewPosition.z)/viewReflectDir.z;
d1viewPosition=viewPosition+viewReflectDir*t;
}
#endif
d1=viewPositionToXY(d1viewPosition);
float totalLen=length(d1-d0);
float xLen=d1.x-d0.x;
float yLen=d1.y-d0.y;
float totalStep=max(abs(xLen),abs(yLen));
float xSpan=xLen/totalStep;
float ySpan=yLen/totalStep;
for(float i=0.;i<MAX_STEP;i++){
if(i>=totalStep) break;
vec2 xy=vec2(d0.x+i*xSpan,d0.y+i*ySpan);
if(xy.x<0.||xy.x>resolution.x||xy.y<0.||xy.y>resolution.y) break;
float s=length(xy-d0)/totalLen;
vec2 uv=xy/resolution;
float d = getDepth(uv);
float vZ = getViewZ( d );
if(-vZ>=cameraFar) continue;
float cW = cameraProjectionMatrix[2][3] * vZ+cameraProjectionMatrix[3][3];
vec3 vP=getViewPosition( uv, d, cW );
#ifdef isPerspectiveCamera
// https://www.comp.nus.edu.sg/~lowkl/publications/lowk_persp_interp_techrep.pdf
float recipVPZ=1./viewPosition.z;
float viewReflectRayZ=1./(recipVPZ+s*(1./d1viewPosition.z-recipVPZ));
float sD=surfDist*cW;
#else
float viewReflectRayZ=viewPosition.z+s*(d1viewPosition.z-viewPosition.z);
float sD=surfDist;
#endif
if(viewReflectRayZ-sD>vZ) continue;
#ifdef isInfiniteThick
if(viewReflectRayZ+thickTolerance*clipW<vP.z) break;
#endif
float away=pointToLineDistance(vP,viewPosition,d1viewPosition);
float op=opacity;
if(away<sD){
vec3 vN=getViewNormal( uv );
if(dot(viewReflectDir,vN)>=0.) continue;
float distance=pointPlaneDistance(vP,viewPosition,viewNormal);
if(distance>maxDistance) break;
#ifdef isDistanceAttenuation
float ratio=1.-(distance/maxDistance);
float attenuation=ratio*ratio;
op=opacity*attenuation;
#endif
#ifdef isFresnel
float fresnel=(dot(viewIncidenceDir,viewReflectDir)+1.)/2.;
op*=fresnel;
#endif
vec4 reflectColor=texture2D(tDiffuse,uv);
gl_FragColor.xyz=reflectColor.xyz;
gl_FragColor.a=op;
break;
}
}
}
`},Xg={defines:{PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},cameraNear:{value:null},cameraFar:{value:null}},vertexShader:`
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
`,fragmentShader:`
uniform sampler2D tDepth;
uniform float cameraNear;
uniform float cameraFar;
varying vec2 vUv;
#include <packing>
float getLinearDepth( const in vec2 uv ) {
#if PERSPECTIVE_CAMERA == 1
float fragCoordZ = texture2D( tDepth, uv ).x;
float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );
return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );
#else
return texture2D( tDepth, uv ).x;
#endif
}
void main() {
float depth = getLinearDepth( vUv );
float d = 1.0 - depth;
// d=(d-.999)*1000.;
gl_FragColor = vec4( vec3( d ), 1.0 );
}
`},_l={uniforms:{tDiffuse:{value:null},resolution:{value:new _e},opacity:{value:.5}},vertexShader:`
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
`,fragmentShader:`
uniform sampler2D tDiffuse;
uniform vec2 resolution;
varying vec2 vUv;
void main() {
//reverse engineering from PhotoShop blur filter, then change coefficient
vec2 texelSize = ( 1.0 / resolution );
vec4 c=texture2D(tDiffuse,vUv);
vec2 offset;
offset=(vec2(-1,0))*texelSize;
vec4 cl=texture2D(tDiffuse,vUv+offset);
offset=(vec2(1,0))*texelSize;
vec4 cr=texture2D(tDiffuse,vUv+offset);
offset=(vec2(0,-1))*texelSize;
vec4 cb=texture2D(tDiffuse,vUv+offset);
offset=(vec2(0,1))*texelSize;
vec4 ct=texture2D(tDiffuse,vUv+offset);
// float coeCenter=.5;
// float coeSide=.125;
float coeCenter=.2;
float coeSide=.2;
float a=c.a*coeCenter+cl.a*coeSide+cr.a*coeSide+cb.a*coeSide+ct.a*coeSide;
vec3 rgb=(c.rgb*c.a*coeCenter+cl.rgb*cl.a*coeSide+cr.rgb*cr.a*coeSide+cb.rgb*cb.a*coeSide+ct.rgb*ct.a*coeSide)/a;
gl_FragColor=vec4(rgb,a);
}
`},Oc=class extends b1{constructor({renderer:n,scene:e,camera:t,width:i,height:r,selects:s,bouncing:a=!1,groundReflector:o}){super(),this.width=i!==void 0?i:512,this.height=r!==void 0?r:512,this.clear=!0,this.renderer=n,this.scene=e,this.camera=t,this.groundReflector=o,this.opacity=La.uniforms.opacity.value,this.output=0,this.maxDistance=La.uniforms.maxDistance.value,this.thickness=La.uniforms.thickness.value,this.tempColor=new He,this._selects=s,this.selective=Array.isArray(this._selects),Object.defineProperty(this,"selects",{get(){return this._selects},set(c){this._selects!==c&&(this._selects=c,Array.isArray(c)?(this.selective=!0,this.ssrMaterial.defines.SELECTIVE=!0,this.ssrMaterial.needsUpdate=!0):(this.selective=!1,this.ssrMaterial.defines.SELECTIVE=!1,this.ssrMaterial.needsUpdate=!0))}}),this._bouncing=a,Object.defineProperty(this,"bouncing",{get(){return this._bouncing},set(c){this._bouncing!==c&&(this._bouncing=c,c?this.ssrMaterial.uniforms.tDiffuse.value=this.prevRenderTarget.texture:this.ssrMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture)}}),this.blur=!0,this._distanceAttenuation=La.defines.DISTANCE_ATTENUATION,Object.defineProperty(this,"distanceAttenuation",{get(){return this._distanceAttenuation},set(c){this._distanceAttenuation!==c&&(this._distanceAttenuation=c,this.ssrMaterial.defines.DISTANCE_ATTENUATION=c,this.ssrMaterial.needsUpdate=!0)}}),this._fresnel=La.defines.FRESNEL,Object.defineProperty(this,"fresnel",{get(){return this._fresnel},set(c){this._fresnel!==c&&(this._fresnel=c,this.ssrMaterial.defines.FRESNEL=c,this.ssrMaterial.needsUpdate=!0)}}),this._infiniteThick=La.defines.INFINITE_THICK,Object.defineProperty(this,"infiniteThick",{get(){return this._infiniteThick},set(c){this._infiniteThick!==c&&(this._infiniteThick=c,this.ssrMaterial.defines.INFINITE_THICK=c,this.ssrMaterial.needsUpdate=!0)}});const l=new uf;l.type=Au,l.minFilter=Rt,l.magFilter=Rt,this.beautyRenderTarget=new Dn(this.width,this.height,{minFilter:Rt,magFilter:Rt,type:Ai,depthTexture:l,depthBuffer:!0}),this.prevRenderTarget=new Dn(this.width,this.height,{minFilter:Rt,magFilter:Rt}),this.normalRenderTarget=new Dn(this.width,this.height,{minFilter:Rt,magFilter:Rt,type:Ai}),this.metalnessRenderTarget=new Dn(this.width,this.height,{minFilter:Rt,magFilter:Rt,type:Ai}),this.ssrRenderTarget=new Dn(this.width,this.height,{minFilter:Rt,magFilter:Rt}),this.blurRenderTarget=this.ssrRenderTarget.clone(),this.blurRenderTarget2=this.ssrRenderTarget.clone(),this.ssrMaterial=new sn({defines:Object.assign({},La.defines,{MAX_STEP:Math.sqrt(this.width*this.width+this.height*this.height)}),uniforms:Hn.clone(La.uniforms),vertexShader:La.vertexShader,fragmentShader:La.fragmentShader,blending:Kt}),this.ssrMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.ssrMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture,this.ssrMaterial.defines.SELECTIVE=this.selective,this.ssrMaterial.needsUpdate=!0,this.ssrMaterial.uniforms.tMetalness.value=this.metalnessRenderTarget.texture,this.ssrMaterial.uniforms.tDepth.value=this.beautyRenderTarget.depthTexture,this.ssrMaterial.uniforms.cameraNear.value=this.camera.near,this.ssrMaterial.uniforms.cameraFar.value=this.camera.far,this.ssrMaterial.uniforms.thickness.value=this.thickness,this.ssrMaterial.uniforms.resolution.value.set(this.width,this.height),this.ssrMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssrMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.normalMaterial=new p0,this.normalMaterial.blending=Kt,this.metalnessOnMaterial=new cs({color:"white"}),this.metalnessOffMaterial=new cs({color:"black"}),this.blurMaterial=new sn({defines:Object.assign({},_l.defines),uniforms:Hn.clone(_l.uniforms),vertexShader:_l.vertexShader,fragmentShader:_l.fragmentShader}),this.blurMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.blurMaterial.uniforms.resolution.value.set(this.width,this.height),this.blurMaterial2=new sn({defines:Object.assign({},_l.defines),uniforms:Hn.clone(_l.uniforms),vertexShader:_l.vertexShader,fragmentShader:_l.fragmentShader}),this.blurMaterial2.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.blurMaterial2.uniforms.resolution.value.set(this.width,this.height),this.depthRenderMaterial=new sn({defines:Object.assign({},Xg.defines),uniforms:Hn.clone(Xg.uniforms),vertexShader:Xg.vertexShader,fragmentShader:Xg.fragmentShader,blending:Kt}),this.depthRenderMaterial.uniforms.tDepth.value=this.beautyRenderTarget.depthTexture,this.depthRenderMaterial.uniforms.cameraNear.value=this.camera.near,this.depthRenderMaterial.uniforms.cameraFar.value=this.camera.far,this.copyMaterial=new sn({uniforms:Hn.clone(ja.uniforms),vertexShader:ja.vertexShader,fragmentShader:ja.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blendSrc:gp,blendDst:mp,blendEquation:ss,blendSrcAlpha:gp,blendDstAlpha:mp,blendEquationAlpha:ss}),this.fsQuad=new I1(null),this.originalClearColor=new He}dispose(){this.beautyRenderTarget.dispose(),this.prevRenderTarget.dispose(),this.normalRenderTarget.dispose(),this.metalnessRenderTarget.dispose(),this.ssrRenderTarget.dispose(),this.blurRenderTarget.dispose(),this.blurRenderTarget2.dispose(),this.normalMaterial.dispose(),this.metalnessOnMaterial.dispose(),this.metalnessOffMaterial.dispose(),this.blurMaterial.dispose(),this.blurMaterial2.dispose(),this.copyMaterial.dispose(),this.depthRenderMaterial.dispose(),this.fsQuad.dispose()}render(n,e){switch(n.setRenderTarget(this.beautyRenderTarget),n.clear(),this.groundReflector&&(this.groundReflector.visible=!1,this.groundReflector.doRender(this.renderer,this.scene,this.camera),this.groundReflector.visible=!0),n.render(this.scene,this.camera),this.groundReflector&&(this.groundReflector.visible=!1),this.renderOverride(n,this.normalMaterial,this.normalRenderTarget,0,0),this.selective&&this.renderMetalness(n,this.metalnessOnMaterial,this.metalnessRenderTarget,0,0),this.ssrMaterial.uniforms.opacity.value=this.opacity,this.ssrMaterial.uniforms.maxDistance.value=this.maxDistance,this.ssrMaterial.uniforms.thickness.value=this.thickness,this.renderPass(n,this.ssrMaterial,this.ssrRenderTarget),this.blur&&(this.renderPass(n,this.blurMaterial,this.blurRenderTarget),this.renderPass(n,this.blurMaterial2,this.blurRenderTarget2)),this.output){case Oc.OUTPUT.Default:this.bouncing?(this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.prevRenderTarget),this.blur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=Ha,this.renderPass(n,this.copyMaterial,this.prevRenderTarget),this.copyMaterial.uniforms.tDiffuse.value=this.prevRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e)):(this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e),this.blur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=Ha,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e));break;case Oc.OUTPUT.SSR:this.blur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e),this.bouncing&&(this.blur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.prevRenderTarget),this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=Ha,this.renderPass(n,this.copyMaterial,this.prevRenderTarget));break;case Oc.OUTPUT.Beauty:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e);break;case Oc.OUTPUT.Depth:this.renderPass(n,this.depthRenderMaterial,this.renderToScreen?null:e);break;case Oc.OUTPUT.Normal:this.copyMaterial.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e);break;case Oc.OUTPUT.Metalness:this.copyMaterial.uniforms.tDiffuse.value=this.metalnessRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e);break;default:console.warn("THREE.SSRPass: Unknown output type.")}}renderPass(n,e,t,i,r){this.originalClearColor.copy(n.getClearColor(this.tempColor));const s=n.getClearAlpha(this.tempColor),a=n.autoClear;n.setRenderTarget(t),n.autoClear=!1,i!=null&&(n.setClearColor(i),n.setClearAlpha(r||0),n.clear()),this.fsQuad.material=e,this.fsQuad.render(n),n.autoClear=a,n.setClearColor(this.originalClearColor),n.setClearAlpha(s)}renderOverride(n,e,t,i,r){this.originalClearColor.copy(n.getClearColor(this.tempColor));const s=n.getClearAlpha(this.tempColor),a=n.autoClear;n.setRenderTarget(t),n.autoClear=!1,i=e.clearColor||i,r=e.clearAlpha||r,i!=null&&(n.setClearColor(i),n.setClearAlpha(r||0),n.clear()),this.scene.overrideMaterial=e,n.render(this.scene,this.camera),this.scene.overrideMaterial=null,n.autoClear=a,n.setClearColor(this.originalClearColor),n.setClearAlpha(s)}renderMetalness(n,e,t,i,r){this.originalClearColor.copy(n.getClearColor(this.tempColor));const s=n.getClearAlpha(this.tempColor),a=n.autoClear;n.setRenderTarget(t),n.autoClear=!1,i=e.clearColor||i,r=e.clearAlpha||r,i!=null&&(n.setClearColor(i),n.setClearAlpha(r||0),n.clear()),this.scene.traverseVisible(o=>{o._SSRPassBackupMaterial=o.material,this._selects.includes(o)?o.material=this.metalnessOnMaterial:o.material=this.metalnessOffMaterial}),n.render(this.scene,this.camera),this.scene.traverseVisible(o=>{o.material=o._SSRPassBackupMaterial}),n.autoClear=a,n.setClearColor(this.originalClearColor),n.setClearAlpha(s)}setSize(n,e){this.width=n,this.height=e,this.ssrMaterial.defines.MAX_STEP=Math.sqrt(n*n+e*e),this.ssrMaterial.needsUpdate=!0,this.beautyRenderTarget.setSize(n,e),this.prevRenderTarget.setSize(n,e),this.ssrRenderTarget.setSize(n,e),this.normalRenderTarget.setSize(n,e),this.metalnessRenderTarget.setSize(n,e),this.blurRenderTarget.setSize(n,e),this.blurRenderTarget2.setSize(n,e),this.ssrMaterial.uniforms.resolution.value.set(n,e),this.ssrMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssrMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.blurMaterial.uniforms.resolution.value.set(n,e),this.blurMaterial2.uniforms.resolution.value.set(n,e)}};let yee=Oc;ut(yee,"OUTPUT",{Default:0,SSR:1,Beauty:3,Depth:4,Normal:5,Metalness:7});const Jy=class{static createButton(n,e={}){const t=document.createElement("button");function i(){let o=null;async function l(u){u.addEventListener("end",c),await n.xr.setSession(u),t.textContent="EXIT VR",o=u}function c(){o.removeEventListener("end",c),t.textContent="ENTER VR",o=null}t.style.display="",t.style.cursor="pointer",t.style.left="calc(50% - 50px)",t.style.width="100px",t.textContent="ENTER VR",t.onmouseenter=()=>{t.style.opacity="1.0"},t.onmouseleave=()=>{t.style.opacity="0.5"},t.onclick=()=>{var u;if(o===null){const h=[e.optionalFeatures,"local-floor","bounded-floor","hand-tracking"].flat().filter(Boolean);(u=navigator.xr)==null||u.requestSession("immersive-vr",{...e,optionalFeatures:h}).then(l)}else o.end()}}function r(){t.style.display="",t.style.cursor="auto",t.style.left="calc(50% - 75px)",t.style.width="150px",t.onmouseenter=null,t.onmouseleave=null,t.onclick=null}function s(){r(),t.textContent="VR NOT SUPPORTED"}function a(o){o.style.position="absolute",o.style.bottom="20px",o.style.padding="12px 6px",o.style.border="1px solid #fff",o.style.borderRadius="4px",o.style.background="rgba(0,0,0,0.1)",o.style.color="#fff",o.style.font="normal 13px sans-serif",o.style.textAlign="center",o.style.opacity="0.5",o.style.outline="none",o.style.zIndex="999"}if("xr"in navigator)return a(t),t.id="VRButton",t.style.display="none",navigator.xr.isSessionSupported("immersive-vr").then(o=>{o?i():s(),o&&Jy.xrSessionIsGranted&&t.click()}),t;{const o=document.createElement("a");return window.isSecureContext===!1?(o.href=document.location.href.replace(/^http:/,"https:"),o.innerHTML="WEBXR NEEDS HTTPS"):(o.href="https://immersiveweb.dev/",o.innerHTML="WEBXR NOT AVAILABLE"),o.style.left="calc(50% - 90px)",o.style.width="180px",o.style.textDecoration="none",a(o),o}}static registerSessionGrantedListener(){"xr"in navigator&&navigator.xr.addEventListener("sessiongranted",()=>{Jy.xrSessionIsGranted=!0})}};let xee=Jy;ut(xee,"xrSessionIsGranted",!1);const c5=new c0,u5=new N,ph=new N,ia=new N,Ro=new N,Ua=new N,Bo=new N,Do=new N,Ed=new N,Sd=new N,wd=new N,jg=new N,Cd=new N,Td=new N,bd=new N;class c9{constructor(e,t,i){this.camera=e,this.scene=t,this.startPoint=new N,this.endPoint=new N,this.collection=[],this.deep=i||Number.MAX_VALUE}select(e,t){return this.startPoint=e||this.startPoint,this.endPoint=t||this.endPoint,this.collection=[],this.updateFrustum(this.startPoint,this.endPoint),this.searchChildInFrustum(c5,this.scene),this.collection}updateFrustum(e,t){if(e=e||this.startPoint,t=t||this.endPoint,e.x===t.x&&(t.x+=Number.EPSILON),e.y===t.y&&(t.y+=Number.EPSILON),this.camera.updateProjectionMatrix(),this.camera.updateMatrixWorld(),this.camera.isPerspectiveCamera){ph.copy(e),ph.x=Math.min(e.x,t.x),ph.y=Math.max(e.y,t.y),t.x=Math.max(e.x,t.x),t.y=Math.min(e.y,t.y),ia.setFromMatrixPosition(this.camera.matrixWorld),Ro.copy(ph),Ua.set(t.x,ph.y,0),Bo.copy(t),Do.set(ph.x,t.y,0),Ro.unproject(this.camera),Ua.unproject(this.camera),Bo.unproject(this.camera),Do.unproject(this.camera),Cd.copy(Ro).sub(ia),Td.copy(Ua).sub(ia),bd.copy(Bo).sub(ia),Cd.normalize(),Td.normalize(),bd.normalize(),Cd.multiplyScalar(this.deep),Td.multiplyScalar(this.deep),bd.multiplyScalar(this.deep),Cd.add(ia),Td.add(ia),bd.add(ia);var i=c5.planes;i[0].setFromCoplanarPoints(ia,Ro,Ua),i[1].setFromCoplanarPoints(ia,Ua,Bo),i[2].setFromCoplanarPoints(Bo,Do,ia),i[3].setFromCoplanarPoints(Do,Ro,ia),i[4].setFromCoplanarPoints(Ua,Bo,Do),i[5].setFromCoplanarPoints(bd,Td,Cd),i[5].normal.multiplyScalar(-1)}else if(this.camera.isOrthographicCamera){const r=Math.min(e.x,t.x),s=Math.max(e.y,t.y),a=Math.max(e.x,t.x),o=Math.min(e.y,t.y);Ro.set(r,s,-1),Ua.set(a,s,-1),Bo.set(a,o,-1),Do.set(r,o,-1),Ed.set(r,s,1),Sd.set(a,s,1),wd.set(a,o,1),jg.set(r,o,1),Ro.unproject(this.camera),Ua.unproject(this.camera),Bo.unproject(this.camera),Do.unproject(this.camera),Ed.unproject(this.camera),Sd.unproject(this.camera),wd.unproject(this.camera),jg.unproject(this.camera);var i=c5.planes;i[0].setFromCoplanarPoints(Ro,Ed,Sd),i[1].setFromCoplanarPoints(Ua,Sd,wd),i[2].setFromCoplanarPoints(wd,jg,Do),i[3].setFromCoplanarPoints(jg,Ed,Ro),i[4].setFromCoplanarPoints(Ua,Bo,Do),i[5].setFromCoplanarPoints(wd,Sd,Ed),i[5].normal.multiplyScalar(-1)}else console.error("THREE.SelectionBox: Unsupported camera type.")}searchChildInFrustum(e,t){if((t.isMesh||t.isLine||t.isPoints)&&t.material!==void 0&&(t.geometry.boundingSphere===null&&t.geometry.computeBoundingSphere(),u5.copy(t.geometry.boundingSphere.center),u5.applyMatrix4(t.matrixWorld),e.containsPoint(u5)&&this.collection.push(t)),t.children.length>0)for(let i=0;i<t.children.length;i++)this.searchChildInFrustum(e,t.children[i])}}class bR{constructor(e){ut(this,"data"),this.data=e}generateShapes(e,t=100,i){const r=[],s={letterSpacing:0,lineHeight:1,...i},a=_ee(e,t,this.data,s);for(let o=0,l=a.length;o<l;o++)Array.prototype.push.apply(r,a[o].toShapes(!1));return r}}ut(bR,"isFont");ut(bR,"type");function _ee(n,e,t,i){const r=Array.from(n),s=e/t.resolution,a=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*s,o=[];let l=0,c=0;for(let u=0;u<r.length;u++){const h=r[u];if(h===`
`)l=0,c-=a*i.lineHeight;else{const f=Eee(h,s,l,c,t);f&&(l+=f.offsetX+i.letterSpacing,o.push(f.path))}}return o}function Eee(n,e,t,i,r){const s=r.glyphs[n]||r.glyphs["?"];if(!s){console.error('THREE.Font: character "'+n+'" does not exists in font family '+r.familyName+".");return}const a=new jT;let o,l,c,u,h,f,p,m;if(s.o){const y=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let v=0,A=y.length;v<A;)switch(y[v++]){case"m":o=parseInt(y[v++])*e+t,l=parseInt(y[v++])*e+i,a.moveTo(o,l);break;case"l":o=parseInt(y[v++])*e+t,l=parseInt(y[v++])*e+i,a.lineTo(o,l);break;case"q":c=parseInt(y[v++])*e+t,u=parseInt(y[v++])*e+i,h=parseInt(y[v++])*e+t,f=parseInt(y[v++])*e+i,a.quadraticCurveTo(h,f,c,u);break;case"b":c=parseInt(y[v++])*e+t,u=parseInt(y[v++])*e+i,h=parseInt(y[v++])*e+t,f=parseInt(y[v++])*e+i,p=parseInt(y[v++])*e+t,m=parseInt(y[v++])*e+i,a.bezierCurveTo(h,f,p,m,c,u);break}}return{offsetX:s.ha*e,path:a}}class See extends Vn{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Rt,this.minFilter=Rt,this.wrapR=oi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}var wee=typeof global=="object"&&global&&global.Object===Object&&global;const IR=wee;var Cee=typeof self=="object"&&self&&self.Object===Object&&self,Tee=IR||Cee||Function("return this")();const io=Tee;var bee=io.Symbol;const Ws=bee;var MR=Object.prototype,Iee=MR.hasOwnProperty,Mee=MR.toString,Id=Ws?Ws.toStringTag:void 0;function Ree(n){var e=Iee.call(n,Id),t=n[Id];try{n[Id]=void 0;var i=!0}catch{}var r=Mee.call(n);return i&&(e?n[Id]=t:delete n[Id]),r}var Bee=Object.prototype,Dee=Bee.toString;function Pee(n){return Dee.call(n)}var Lee="[object Null]",Uee="[object Undefined]",u9=Ws?Ws.toStringTag:void 0;function ec(n){return n==null?n===void 0?Uee:Lee:u9&&u9 in Object(n)?Ree(n):Pee(n)}function ga(n){return n!=null&&typeof n=="object"}var Oee="[object Symbol]";function M1(n){return typeof n=="symbol"||ga(n)&&ec(n)==Oee}function U0(n,e){for(var t=-1,i=n==null?0:n.length,r=Array(i);++t<i;)r[t]=e(n[t],t,n);return r}var Fee=Array.isArray;const an=Fee;var kee=1/0,h9=Ws?Ws.prototype:void 0,f9=h9?h9.toString:void 0;function RR(n){if(typeof n=="string")return n;if(an(n))return U0(n,RR)+"";if(M1(n))return f9?f9.call(n):"";var e=n+"";return e=="0"&&1/n==-kee?"-0":e}var Nee=/\s/;function Gee(n){for(var e=n.length;e--&&Nee.test(n.charAt(e)););return e}var zee=/^\s+/;function Qee(n){return n&&n.slice(0,Gee(n)+1).replace(zee,"")}function Ys(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var d9=0/0,Hee=/^[-+]0x[0-9a-f]+$/i,Vee=/^0b[01]+$/i,Wee=/^0o[0-7]+$/i,Yee=parseInt;function qee(n){if(typeof n=="number")return n;if(M1(n))return d9;if(Ys(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=Ys(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=Qee(n);var t=Vee.test(n);return t||Wee.test(n)?Yee(n.slice(2),t?2:8):Hee.test(n)?d9:+n}var p9=1/0,Xee=17976931348623157e292;function jee(n){if(!n)return n===0?n:0;if(n=qee(n),n===p9||n===-p9){var e=n<0?-1:1;return e*Xee}return n===n?n:0}function O0(n){var e=jee(n),t=e%1;return e===e?t?e-t:e:0}function tf(n){return n}var Kee="[object AsyncFunction]",$ee="[object Function]",Jee="[object GeneratorFunction]",Zee="[object Proxy]";function Jo(n){if(!Ys(n))return!1;var e=ec(n);return e==$ee||e==Jee||e==Kee||e==Zee}var ete=io["__core-js_shared__"];const h5=ete;var g9=function(){var n=/[^.]+$/.exec(h5&&h5.keys&&h5.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function tte(n){return!!g9&&g9 in n}var nte=Function.prototype,ite=nte.toString;function wu(n){if(n!=null){try{return ite.call(n)}catch{}try{return n+""}catch{}}return""}var rte=/[\\^$.*+?()[\]{}|]/g,ste=/^\[object .+?Constructor\]$/,ate=Function.prototype,ote=Object.prototype,lte=ate.toString,cte=ote.hasOwnProperty,ute=RegExp("^"+lte.call(cte).replace(rte,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function hte(n){if(!Ys(n)||tte(n))return!1;var e=Jo(n)?ute:ste;return e.test(wu(n))}function fte(n,e){return n==null?void 0:n[e]}function Cu(n,e){var t=fte(n,e);return hte(t)?t:void 0}var dte=Cu(io,"WeakMap");const Zy=dte;var m9=Object.create,pte=function(){function n(){}return function(e){if(!Ys(e))return{};if(m9)return m9(e);n.prototype=e;var t=new n;return n.prototype=void 0,t}}();const gte=pte;function mte(n,e,t){switch(t.length){case 0:return n.call(e);case 1:return n.call(e,t[0]);case 2:return n.call(e,t[0],t[1]);case 3:return n.call(e,t[0],t[1],t[2])}return n.apply(e,t)}function Ti(){}function Ate(n,e){var t=-1,i=n.length;for(e||(e=Array(i));++t<i;)e[t]=n[t];return e}var vte=800,yte=16,xte=Date.now;function _te(n){var e=0,t=0;return function(){var i=xte(),r=yte-(i-t);if(t=i,r>0){if(++e>=vte)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}function Ete(n){return function(){return n}}var Ste=function(){try{var n=Cu(Object,"defineProperty");return n({},"",{}),n}catch{}}();const f2=Ste;var wte=f2?function(n,e){return f2(n,"toString",{configurable:!0,enumerable:!1,value:Ete(e),writable:!0})}:tf;const Cte=wte;var Tte=_te(Cte);const bte=Tte;function BR(n,e){for(var t=-1,i=n==null?0:n.length;++t<i&&e(n[t],t,n)!==!1;);return n}function DR(n,e,t,i){for(var r=n.length,s=t+(i?1:-1);i?s--:++s<r;)if(e(n[s],s,n))return s;return-1}function Ite(n){return n!==n}function Mte(n,e,t){for(var i=t-1,r=n.length;++i<r;)if(n[i]===e)return i;return-1}function d8(n,e,t){return e===e?Mte(n,e,t):DR(n,Ite,t)}function PR(n,e){var t=n==null?0:n.length;return!!t&&d8(n,e,0)>-1}var Rte=9007199254740991,Bte=/^(?:0|[1-9]\d*)$/;function R1(n,e){var t=typeof n;return e=e??Rte,!!e&&(t=="number"||t!="symbol"&&Bte.test(n))&&n>-1&&n%1==0&&n<e}function p8(n,e,t){e=="__proto__"&&f2?f2(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):n[e]=t}function F0(n,e){return n===e||n!==n&&e!==e}var Dte=Object.prototype,Pte=Dte.hasOwnProperty;function B1(n,e,t){var i=n[e];(!(Pte.call(n,e)&&F0(i,t))||t===void 0&&!(e in n))&&p8(n,e,t)}function k0(n,e,t,i){var r=!t;t||(t={});for(var s=-1,a=e.length;++s<a;){var o=e[s],l=i?i(t[o],n[o],o,t,n):void 0;l===void 0&&(l=n[o]),r?p8(t,o,l):B1(t,o,l)}return t}var A9=Math.max;function Lte(n,e,t){return e=A9(e===void 0?n.length-1:e,0),function(){for(var i=arguments,r=-1,s=A9(i.length-e,0),a=Array(s);++r<s;)a[r]=i[e+r];r=-1;for(var o=Array(e+1);++r<e;)o[r]=i[r];return o[e]=t(a),mte(n,this,o)}}function g8(n,e){return bte(Lte(n,e,tf),n+"")}var Ute=9007199254740991;function m8(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=Ute}function ro(n){return n!=null&&m8(n.length)&&!Jo(n)}function D1(n,e,t){if(!Ys(t))return!1;var i=typeof e;return(i=="number"?ro(t)&&R1(e,t.length):i=="string"&&e in t)?F0(t[e],n):!1}function Ote(n){return g8(function(e,t){var i=-1,r=t.length,s=r>1?t[r-1]:void 0,a=r>2?t[2]:void 0;for(s=n.length>3&&typeof s=="function"?(r--,s):void 0,a&&D1(t[0],t[1],a)&&(s=r<3?void 0:s,r=1),e=Object(e);++i<r;){var o=t[i];o&&n(e,o,i,s)}return e})}var Fte=Object.prototype;function N0(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||Fte;return n===t}function kte(n,e){for(var t=-1,i=Array(n);++t<n;)i[t]=e(t);return i}var Nte="[object Arguments]";function v9(n){return ga(n)&&ec(n)==Nte}var LR=Object.prototype,Gte=LR.hasOwnProperty,zte=LR.propertyIsEnumerable,Qte=v9(function(){return arguments}())?v9:function(n){return ga(n)&&Gte.call(n,"callee")&&!zte.call(n,"callee")};const P1=Qte;function Hte(){return!1}var UR=typeof exports=="object"&&exports&&!exports.nodeType&&exports,y9=UR&&typeof module=="object"&&module&&!module.nodeType&&module,Vte=y9&&y9.exports===UR,x9=Vte?io.Buffer:void 0,Wte=x9?x9.isBuffer:void 0,Yte=Wte||Hte;const e0=Yte;var qte="[object Arguments]",Xte="[object Array]",jte="[object Boolean]",Kte="[object Date]",$te="[object Error]",Jte="[object Function]",Zte="[object Map]",ene="[object Number]",tne="[object Object]",nne="[object RegExp]",ine="[object Set]",rne="[object String]",sne="[object WeakMap]",ane="[object ArrayBuffer]",one="[object DataView]",lne="[object Float32Array]",cne="[object Float64Array]",une="[object Int8Array]",hne="[object Int16Array]",fne="[object Int32Array]",dne="[object Uint8Array]",pne="[object Uint8ClampedArray]",gne="[object Uint16Array]",mne="[object Uint32Array]",Nn={};Nn[lne]=Nn[cne]=Nn[une]=Nn[hne]=Nn[fne]=Nn[dne]=Nn[pne]=Nn[gne]=Nn[mne]=!0;Nn[qte]=Nn[Xte]=Nn[ane]=Nn[jte]=Nn[one]=Nn[Kte]=Nn[$te]=Nn[Jte]=Nn[Zte]=Nn[ene]=Nn[tne]=Nn[nne]=Nn[ine]=Nn[rne]=Nn[sne]=!1;function Ane(n){return ga(n)&&m8(n.length)&&!!Nn[ec(n)]}function G0(n){return function(e){return n(e)}}var OR=typeof exports=="object"&&exports&&!exports.nodeType&&exports,lp=OR&&typeof module=="object"&&module&&!module.nodeType&&module,vne=lp&&lp.exports===OR,f5=vne&&IR.process,yne=function(){try{var n=lp&&lp.require&&lp.require("util").types;return n||f5&&f5.binding&&f5.binding("util")}catch{}}();const Ql=yne;var _9=Ql&&Ql.isTypedArray,xne=_9?G0(_9):Ane;const A8=xne;var _ne=Object.prototype,Ene=_ne.hasOwnProperty;function FR(n,e){var t=an(n),i=!t&&P1(n),r=!t&&!i&&e0(n),s=!t&&!i&&!r&&A8(n),a=t||i||r||s,o=a?kte(n.length,String):[],l=o.length;for(var c in n)(e||Ene.call(n,c))&&!(a&&(c=="length"||r&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||R1(c,l)))&&o.push(c);return o}function kR(n,e){return function(t){return n(e(t))}}var Sne=kR(Object.keys,Object);const wne=Sne;var Cne=Object.prototype,Tne=Cne.hasOwnProperty;function NR(n){if(!N0(n))return wne(n);var e=[];for(var t in Object(n))Tne.call(n,t)&&t!="constructor"&&e.push(t);return e}function us(n){return ro(n)?FR(n):NR(n)}var bne=Object.prototype,Ine=bne.hasOwnProperty,Mne=Ote(function(n,e){if(N0(e)||ro(e)){k0(e,us(e),n);return}for(var t in e)Ine.call(e,t)&&B1(n,t,e[t])});const hs=Mne;function Rne(n){var e=[];if(n!=null)for(var t in Object(n))e.push(t);return e}var Bne=Object.prototype,Dne=Bne.hasOwnProperty;function Pne(n){if(!Ys(n))return Rne(n);var e=N0(n),t=[];for(var i in n)i=="constructor"&&(e||!Dne.call(n,i))||t.push(i);return t}function L1(n){return ro(n)?FR(n,!0):Pne(n)}var Lne=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Une=/^\w*$/;function v8(n,e){if(an(n))return!1;var t=typeof n;return t=="number"||t=="symbol"||t=="boolean"||n==null||M1(n)?!0:Une.test(n)||!Lne.test(n)||e!=null&&n in Object(e)}var One=Cu(Object,"create");const t0=One;function Fne(){this.__data__=t0?t0(null):{},this.size=0}function kne(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}var Nne="__lodash_hash_undefined__",Gne=Object.prototype,zne=Gne.hasOwnProperty;function Qne(n){var e=this.__data__;if(t0){var t=e[n];return t===Nne?void 0:t}return zne.call(e,n)?e[n]:void 0}var Hne=Object.prototype,Vne=Hne.hasOwnProperty;function Wne(n){var e=this.__data__;return t0?e[n]!==void 0:Vne.call(e,n)}var Yne="__lodash_hash_undefined__";function qne(n,e){var t=this.__data__;return this.size+=this.has(n)?0:1,t[n]=t0&&e===void 0?Yne:e,this}function du(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}du.prototype.clear=Fne;du.prototype.delete=kne;du.prototype.get=Qne;du.prototype.has=Wne;du.prototype.set=qne;function Xne(){this.__data__=[],this.size=0}function U1(n,e){for(var t=n.length;t--;)if(F0(n[t][0],e))return t;return-1}var jne=Array.prototype,Kne=jne.splice;function $ne(n){var e=this.__data__,t=U1(e,n);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():Kne.call(e,t,1),--this.size,!0}function Jne(n){var e=this.__data__,t=U1(e,n);return t<0?void 0:e[t][1]}function Zne(n){return U1(this.__data__,n)>-1}function eie(n,e){var t=this.__data__,i=U1(t,n);return i<0?(++this.size,t.push([n,e])):t[i][1]=e,this}function Zo(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}Zo.prototype.clear=Xne;Zo.prototype.delete=$ne;Zo.prototype.get=Jne;Zo.prototype.has=Zne;Zo.prototype.set=eie;var tie=Cu(io,"Map");const n0=tie;function nie(){this.size=0,this.__data__={hash:new du,map:new(n0||Zo),string:new du}}function iie(n){var e=typeof n;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?n!=="__proto__":n===null}function O1(n,e){var t=n.__data__;return iie(e)?t[typeof e=="string"?"string":"hash"]:t.map}function rie(n){var e=O1(this,n).delete(n);return this.size-=e?1:0,e}function sie(n){return O1(this,n).get(n)}function aie(n){return O1(this,n).has(n)}function oie(n,e){var t=O1(this,n),i=t.size;return t.set(n,e),this.size+=t.size==i?0:1,this}function el(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}el.prototype.clear=nie;el.prototype.delete=rie;el.prototype.get=sie;el.prototype.has=aie;el.prototype.set=oie;var lie="Expected a function";function y8(n,e){if(typeof n!="function"||e!=null&&typeof e!="function")throw new TypeError(lie);var t=function(){var i=arguments,r=e?e.apply(this,i):i[0],s=t.cache;if(s.has(r))return s.get(r);var a=n.apply(this,i);return t.cache=s.set(r,a)||s,a};return t.cache=new(y8.Cache||el),t}y8.Cache=el;var cie=500;function uie(n){var e=y8(n,function(i){return t.size===cie&&t.clear(),i}),t=e.cache;return e}var hie=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,fie=/\\(\\)?/g,die=uie(function(n){var e=[];return n.charCodeAt(0)===46&&e.push(""),n.replace(hie,function(t,i,r,s){e.push(r?s.replace(fie,"$1"):i||t)}),e});const pie=die;function gie(n){return n==null?"":RR(n)}function F1(n,e){return an(n)?n:v8(n,e)?[n]:pie(gie(n))}var mie=1/0;function z0(n){if(typeof n=="string"||M1(n))return n;var e=n+"";return e=="0"&&1/n==-mie?"-0":e}function x8(n,e){e=F1(e,n);for(var t=0,i=e.length;n!=null&&t<i;)n=n[z0(e[t++])];return t&&t==i?n:void 0}function Aie(n,e,t){var i=n==null?void 0:x8(n,e);return i===void 0?t:i}function _8(n,e){for(var t=-1,i=e.length,r=n.length;++t<i;)n[r+t]=e[t];return n}var E9=Ws?Ws.isConcatSpreadable:void 0;function vie(n){return an(n)||P1(n)||!!(E9&&n&&n[E9])}function k1(n,e,t,i,r){var s=-1,a=n.length;for(t||(t=vie),r||(r=[]);++s<a;){var o=n[s];e>0&&t(o)?e>1?k1(o,e-1,t,i,r):_8(r,o):i||(r[r.length]=o)}return r}function ua(n){var e=n==null?0:n.length;return e?k1(n,1):[]}var yie=kR(Object.getPrototypeOf,Object);const GR=yie;function zR(n,e,t){var i=-1,r=n.length;e<0&&(e=-e>r?0:r+e),t=t>r?r:t,t<0&&(t+=r),r=e>t?0:t-e>>>0,e>>>=0;for(var s=Array(r);++i<r;)s[i]=n[i+e];return s}function xie(n,e,t,i){var r=-1,s=n==null?0:n.length;for(i&&s&&(t=n[++r]);++r<s;)t=e(t,n[r],r,n);return t}function _ie(){this.__data__=new Zo,this.size=0}function Eie(n){var e=this.__data__,t=e.delete(n);return this.size=e.size,t}function Sie(n){return this.__data__.get(n)}function wie(n){return this.__data__.has(n)}var Cie=200;function Tie(n,e){var t=this.__data__;if(t instanceof Zo){var i=t.__data__;if(!n0||i.length<Cie-1)return i.push([n,e]),this.size=++t.size,this;t=this.__data__=new el(i)}return t.set(n,e),this.size=t.size,this}function Ka(n){var e=this.__data__=new Zo(n);this.size=e.size}Ka.prototype.clear=_ie;Ka.prototype.delete=Eie;Ka.prototype.get=Sie;Ka.prototype.has=wie;Ka.prototype.set=Tie;function bie(n,e){return n&&k0(e,us(e),n)}function Iie(n,e){return n&&k0(e,L1(e),n)}var QR=typeof exports=="object"&&exports&&!exports.nodeType&&exports,S9=QR&&typeof module=="object"&&module&&!module.nodeType&&module,Mie=S9&&S9.exports===QR,w9=Mie?io.Buffer:void 0,C9=w9?w9.allocUnsafe:void 0;function Rie(n,e){if(e)return n.slice();var t=n.length,i=C9?C9(t):new n.constructor(t);return n.copy(i),i}function E8(n,e){for(var t=-1,i=n==null?0:n.length,r=0,s=[];++t<i;){var a=n[t];e(a,t,n)&&(s[r++]=a)}return s}function HR(){return[]}var Bie=Object.prototype,Die=Bie.propertyIsEnumerable,T9=Object.getOwnPropertySymbols,Pie=T9?function(n){return n==null?[]:(n=Object(n),E8(T9(n),function(e){return Die.call(n,e)}))}:HR;const S8=Pie;function Lie(n,e){return k0(n,S8(n),e)}var Uie=Object.getOwnPropertySymbols,Oie=Uie?function(n){for(var e=[];n;)_8(e,S8(n)),n=GR(n);return e}:HR;const VR=Oie;function Fie(n,e){return k0(n,VR(n),e)}function WR(n,e,t){var i=e(n);return an(n)?i:_8(i,t(n))}function e6(n){return WR(n,us,S8)}function YR(n){return WR(n,L1,VR)}var kie=Cu(io,"DataView");const t6=kie;var Nie=Cu(io,"Promise");const n6=Nie;var Gie=Cu(io,"Set");const Qh=Gie;var b9="[object Map]",zie="[object Object]",I9="[object Promise]",M9="[object Set]",R9="[object WeakMap]",B9="[object DataView]",Qie=wu(t6),Hie=wu(n0),Vie=wu(n6),Wie=wu(Qh),Yie=wu(Zy),Fc=ec;(t6&&Fc(new t6(new ArrayBuffer(1)))!=B9||n0&&Fc(new n0)!=b9||n6&&Fc(n6.resolve())!=I9||Qh&&Fc(new Qh)!=M9||Zy&&Fc(new Zy)!=R9)&&(Fc=function(n){var e=ec(n),t=e==zie?n.constructor:void 0,i=t?wu(t):"";if(i)switch(i){case Qie:return B9;case Hie:return b9;case Vie:return I9;case Wie:return M9;case Yie:return R9}return e});const nf=Fc;var qie=Object.prototype,Xie=qie.hasOwnProperty;function jie(n){var e=n.length,t=new n.constructor(e);return e&&typeof n[0]=="string"&&Xie.call(n,"index")&&(t.index=n.index,t.input=n.input),t}var Kie=io.Uint8Array;const d2=Kie;function w8(n){var e=new n.constructor(n.byteLength);return new d2(e).set(new d2(n)),e}function $ie(n,e){var t=e?w8(n.buffer):n.buffer;return new n.constructor(t,n.byteOffset,n.byteLength)}var Jie=/\w*$/;function Zie(n){var e=new n.constructor(n.source,Jie.exec(n));return e.lastIndex=n.lastIndex,e}var D9=Ws?Ws.prototype:void 0,P9=D9?D9.valueOf:void 0;function ere(n){return P9?Object(P9.call(n)):{}}function tre(n,e){var t=e?w8(n.buffer):n.buffer;return new n.constructor(t,n.byteOffset,n.length)}var nre="[object Boolean]",ire="[object Date]",rre="[object Map]",sre="[object Number]",are="[object RegExp]",ore="[object Set]",lre="[object String]",cre="[object Symbol]",ure="[object ArrayBuffer]",hre="[object DataView]",fre="[object Float32Array]",dre="[object Float64Array]",pre="[object Int8Array]",gre="[object Int16Array]",mre="[object Int32Array]",Are="[object Uint8Array]",vre="[object Uint8ClampedArray]",yre="[object Uint16Array]",xre="[object Uint32Array]";function _re(n,e,t){var i=n.constructor;switch(e){case ure:return w8(n);case nre:case ire:return new i(+n);case hre:return $ie(n,t);case fre:case dre:case pre:case gre:case mre:case Are:case vre:case yre:case xre:return tre(n,t);case rre:return new i;case sre:case lre:return new i(n);case are:return Zie(n);case ore:return new i;case cre:return ere(n)}}function Ere(n){return typeof n.constructor=="function"&&!N0(n)?gte(GR(n)):{}}var Sre="[object Map]";function wre(n){return ga(n)&&nf(n)==Sre}var L9=Ql&&Ql.isMap,Cre=L9?G0(L9):wre;const Tre=Cre;var bre="[object Set]";function Ire(n){return ga(n)&&nf(n)==bre}var U9=Ql&&Ql.isSet,Mre=U9?G0(U9):Ire;const Rre=Mre;var Bre=1,Dre=2,Pre=4,qR="[object Arguments]",Lre="[object Array]",Ure="[object Boolean]",Ore="[object Date]",Fre="[object Error]",XR="[object Function]",kre="[object GeneratorFunction]",Nre="[object Map]",Gre="[object Number]",jR="[object Object]",zre="[object RegExp]",Qre="[object Set]",Hre="[object String]",Vre="[object Symbol]",Wre="[object WeakMap]",Yre="[object ArrayBuffer]",qre="[object DataView]",Xre="[object Float32Array]",jre="[object Float64Array]",Kre="[object Int8Array]",$re="[object Int16Array]",Jre="[object Int32Array]",Zre="[object Uint8Array]",ese="[object Uint8ClampedArray]",tse="[object Uint16Array]",nse="[object Uint32Array]",On={};On[qR]=On[Lre]=On[Yre]=On[qre]=On[Ure]=On[Ore]=On[Xre]=On[jre]=On[Kre]=On[$re]=On[Jre]=On[Nre]=On[Gre]=On[jR]=On[zre]=On[Qre]=On[Hre]=On[Vre]=On[Zre]=On[ese]=On[tse]=On[nse]=!0;On[Fre]=On[XR]=On[Wre]=!1;function Em(n,e,t,i,r,s){var a,o=e&Bre,l=e&Dre,c=e&Pre;if(t&&(a=r?t(n,i,r,s):t(n)),a!==void 0)return a;if(!Ys(n))return n;var u=an(n);if(u){if(a=jie(n),!o)return Ate(n,a)}else{var h=nf(n),f=h==XR||h==kre;if(e0(n))return Rie(n,o);if(h==jR||h==qR||f&&!r){if(a=l||f?{}:Ere(n),!o)return l?Fie(n,Iie(a,n)):Lie(n,bie(a,n))}else{if(!On[h])return r?n:{};a=_re(n,h,o)}}s||(s=new Ka);var p=s.get(n);if(p)return p;s.set(n,a),Rre(n)?n.forEach(function(v){a.add(Em(v,e,t,v,n,s))}):Tre(n)&&n.forEach(function(v,A){a.set(A,Em(v,e,t,A,n,s))});var m=c?l?YR:e6:l?L1:us,y=u?void 0:m(n);return BR(y||n,function(v,A){y&&(A=v,v=n[A]),B1(a,A,Em(v,e,t,A,n,s))}),a}var ise=4;function cr(n){return Em(n,ise)}function Q0(n){for(var e=-1,t=n==null?0:n.length,i=0,r=[];++e<t;){var s=n[e];s&&(r[i++]=s)}return r}var rse="__lodash_hash_undefined__";function sse(n){return this.__data__.set(n,rse),this}function ase(n){return this.__data__.has(n)}function rf(n){var e=-1,t=n==null?0:n.length;for(this.__data__=new el;++e<t;)this.add(n[e])}rf.prototype.add=rf.prototype.push=sse;rf.prototype.has=ase;function KR(n,e){for(var t=-1,i=n==null?0:n.length;++t<i;)if(e(n[t],t,n))return!0;return!1}function C8(n,e){return n.has(e)}var ose=1,lse=2;function $R(n,e,t,i,r,s){var a=t&ose,o=n.length,l=e.length;if(o!=l&&!(a&&l>o))return!1;var c=s.get(n),u=s.get(e);if(c&&u)return c==e&&u==n;var h=-1,f=!0,p=t&lse?new rf:void 0;for(s.set(n,e),s.set(e,n);++h<o;){var m=n[h],y=e[h];if(i)var v=a?i(y,m,h,e,n,s):i(m,y,h,n,e,s);if(v!==void 0){if(v)continue;f=!1;break}if(p){if(!KR(e,function(A,_){if(!C8(p,_)&&(m===A||r(m,A,t,i,s)))return p.push(_)})){f=!1;break}}else if(!(m===y||r(m,y,t,i,s))){f=!1;break}}return s.delete(n),s.delete(e),f}function cse(n){var e=-1,t=Array(n.size);return n.forEach(function(i,r){t[++e]=[r,i]}),t}function T8(n){var e=-1,t=Array(n.size);return n.forEach(function(i){t[++e]=i}),t}var use=1,hse=2,fse="[object Boolean]",dse="[object Date]",pse="[object Error]",gse="[object Map]",mse="[object Number]",Ase="[object RegExp]",vse="[object Set]",yse="[object String]",xse="[object Symbol]",_se="[object ArrayBuffer]",Ese="[object DataView]",O9=Ws?Ws.prototype:void 0,d5=O9?O9.valueOf:void 0;function Sse(n,e,t,i,r,s,a){switch(t){case Ese:if(n.byteLength!=e.byteLength||n.byteOffset!=e.byteOffset)return!1;n=n.buffer,e=e.buffer;case _se:return!(n.byteLength!=e.byteLength||!s(new d2(n),new d2(e)));case fse:case dse:case mse:return F0(+n,+e);case pse:return n.name==e.name&&n.message==e.message;case Ase:case yse:return n==e+"";case gse:var o=cse;case vse:var l=i&use;if(o||(o=T8),n.size!=e.size&&!l)return!1;var c=a.get(n);if(c)return c==e;i|=hse,a.set(n,e);var u=$R(o(n),o(e),i,r,s,a);return a.delete(n),u;case xse:if(d5)return d5.call(n)==d5.call(e)}return!1}var wse=1,Cse=Object.prototype,Tse=Cse.hasOwnProperty;function bse(n,e,t,i,r,s){var a=t&wse,o=e6(n),l=o.length,c=e6(e),u=c.length;if(l!=u&&!a)return!1;for(var h=l;h--;){var f=o[h];if(!(a?f in e:Tse.call(e,f)))return!1}var p=s.get(n),m=s.get(e);if(p&&m)return p==e&&m==n;var y=!0;s.set(n,e),s.set(e,n);for(var v=a;++h<l;){f=o[h];var A=n[f],_=e[f];if(i)var x=a?i(_,A,f,e,n,s):i(A,_,f,n,e,s);if(!(x===void 0?A===_||r(A,_,t,i,s):x)){y=!1;break}v||(v=f=="constructor")}if(y&&!v){var E=n.constructor,w=e.constructor;E!=w&&"constructor"in n&&"constructor"in e&&!(typeof E=="function"&&E instanceof E&&typeof w=="function"&&w instanceof w)&&(y=!1)}return s.delete(n),s.delete(e),y}var Ise=1,F9="[object Arguments]",k9="[object Array]",Kg="[object Object]",Mse=Object.prototype,N9=Mse.hasOwnProperty;function Rse(n,e,t,i,r,s){var a=an(n),o=an(e),l=a?k9:nf(n),c=o?k9:nf(e);l=l==F9?Kg:l,c=c==F9?Kg:c;var u=l==Kg,h=c==Kg,f=l==c;if(f&&e0(n)){if(!e0(e))return!1;a=!0,u=!1}if(f&&!u)return s||(s=new Ka),a||A8(n)?$R(n,e,t,i,r,s):Sse(n,e,l,t,i,r,s);if(!(t&Ise)){var p=u&&N9.call(n,"__wrapped__"),m=h&&N9.call(e,"__wrapped__");if(p||m){var y=p?n.value():n,v=m?e.value():e;return s||(s=new Ka),r(y,v,t,i,s)}}return f?(s||(s=new Ka),bse(n,e,t,i,r,s)):!1}function b8(n,e,t,i,r){return n===e?!0:n==null||e==null||!ga(n)&&!ga(e)?n!==n&&e!==e:Rse(n,e,t,i,b8,r)}var Bse=1,Dse=2;function Pse(n,e,t,i){var r=t.length,s=r,a=!i;if(n==null)return!s;for(n=Object(n);r--;){var o=t[r];if(a&&o[2]?o[1]!==n[o[0]]:!(o[0]in n))return!1}for(;++r<s;){o=t[r];var l=o[0],c=n[l],u=o[1];if(a&&o[2]){if(c===void 0&&!(l in n))return!1}else{var h=new Ka;if(i)var f=i(c,u,l,n,e,h);if(!(f===void 0?b8(u,c,Bse|Dse,i,h):f))return!1}}return!0}function JR(n){return n===n&&!Ys(n)}function Lse(n){for(var e=us(n),t=e.length;t--;){var i=e[t],r=n[i];e[t]=[i,r,JR(r)]}return e}function ZR(n,e){return function(t){return t==null?!1:t[n]===e&&(e!==void 0||n in Object(t))}}function Use(n){var e=Lse(n);return e.length==1&&e[0][2]?ZR(e[0][0],e[0][1]):function(t){return t===n||Pse(t,n,e)}}function Ose(n,e){return n!=null&&e in Object(n)}function eB(n,e,t){e=F1(e,n);for(var i=-1,r=e.length,s=!1;++i<r;){var a=z0(e[i]);if(!(s=n!=null&&t(n,a)))break;n=n[a]}return s||++i!=r?s:(r=n==null?0:n.length,!!r&&m8(r)&&R1(a,r)&&(an(n)||P1(n)))}function Fse(n,e){return n!=null&&eB(n,e,Ose)}var kse=1,Nse=2;function Gse(n,e){return v8(n)&&JR(e)?ZR(z0(n),e):function(t){var i=Aie(t,n);return i===void 0&&i===e?Fse(t,n):b8(e,i,kse|Nse)}}function zse(n){return function(e){return e==null?void 0:e[n]}}function Qse(n){return function(e){return x8(e,n)}}function Hse(n){return v8(n)?zse(z0(n)):Qse(n)}function so(n){return typeof n=="function"?n:n==null?tf:typeof n=="object"?an(n)?Gse(n[0],n[1]):Use(n):Hse(n)}function Vse(n,e,t,i){for(var r=-1,s=n==null?0:n.length;++r<s;){var a=n[r];e(i,a,t(a),n)}return i}function Wse(n){return function(e,t,i){for(var r=-1,s=Object(e),a=i(e),o=a.length;o--;){var l=a[n?o:++r];if(t(s[l],l,s)===!1)break}return e}}var Yse=Wse();const qse=Yse;function Xse(n,e){return n&&qse(n,e,us)}function jse(n,e){return function(t,i){if(t==null)return t;if(!ro(t))return n(t,i);for(var r=t.length,s=e?r:-1,a=Object(t);(e?s--:++s<r)&&i(a[s],s,a)!==!1;);return t}}var Kse=jse(Xse);const Tu=Kse;function $se(n,e,t,i){return Tu(n,function(r,s,a){e(i,r,t(r),a)}),i}function Jse(n,e){return function(t,i){var r=an(t)?Vse:$se,s=e?e():{};return r(t,n,so(i),s)}}var tB=Object.prototype,Zse=tB.hasOwnProperty,eae=g8(function(n,e){n=Object(n);var t=-1,i=e.length,r=i>2?e[2]:void 0;for(r&&D1(e[0],e[1],r)&&(i=1);++t<i;)for(var s=e[t],a=L1(s),o=-1,l=a.length;++o<l;){var c=a[o],u=n[c];(u===void 0||F0(u,tB[c])&&!Zse.call(n,c))&&(n[c]=s[c])}return n});const I8=eae;function G9(n){return ga(n)&&ro(n)}function nB(n,e,t){for(var i=-1,r=n==null?0:n.length;++i<r;)if(t(e,n[i]))return!0;return!1}var tae=200;function nae(n,e,t,i){var r=-1,s=PR,a=!0,o=n.length,l=[],c=e.length;if(!o)return l;t&&(e=U0(e,G0(t))),i?(s=nB,a=!1):e.length>=tae&&(s=C8,a=!1,e=new rf(e));e:for(;++r<o;){var u=n[r],h=t==null?u:t(u);if(u=i||u!==0?u:0,a&&h===h){for(var f=c;f--;)if(e[f]===h)continue e;l.push(u)}else s(e,h,i)||l.push(u)}return l}var iae=g8(function(n,e){return G9(n)?nae(n,k1(e,1,G9,!0)):[]});const N1=iae;function sf(n){var e=n==null?0:n.length;return e?n[e-1]:void 0}function Xi(n,e,t){var i=n==null?0:n.length;return i?(e=t||e===void 0?1:O0(e),zR(n,e<0?0:e,i)):[]}function i0(n,e,t){var i=n==null?0:n.length;return i?(e=t||e===void 0?1:O0(e),e=i-e,zR(n,0,e<0?0:e)):[]}function rae(n){return typeof n=="function"?n:tf}function wt(n,e){var t=an(n)?BR:Tu;return t(n,rae(e))}function sae(n,e){for(var t=-1,i=n==null?0:n.length;++t<i;)if(!e(n[t],t,n))return!1;return!0}function aae(n,e){var t=!0;return Tu(n,function(i,r,s){return t=!!e(i,r,s),t}),t}function ha(n,e,t){var i=an(n)?sae:aae;return t&&D1(n,e,t)&&(e=void 0),i(n,so(e))}function iB(n,e){var t=[];return Tu(n,function(i,r,s){e(i,r,s)&&t.push(i)}),t}function js(n,e){var t=an(n)?E8:iB;return t(n,so(e))}function oae(n){return function(e,t,i){var r=Object(e);if(!ro(e)){var s=so(t);e=us(e),t=function(o){return s(r[o],o,r)}}var a=n(e,t,i);return a>-1?r[s?e[a]:a]:void 0}}var lae=Math.max;function cae(n,e,t){var i=n==null?0:n.length;if(!i)return-1;var r=t==null?0:O0(t);return r<0&&(r=lae(i+r,0)),DR(n,so(e),r)}var uae=oae(cae);const af=uae;function ma(n){return n&&n.length?n[0]:void 0}function hae(n,e){var t=-1,i=ro(n)?Array(n.length):[];return Tu(n,function(r,s,a){i[++t]=e(r,s,a)}),i}function pt(n,e){var t=an(n)?U0:hae;return t(n,so(e))}function zs(n,e){return k1(pt(n,e),1)}var fae=Object.prototype,dae=fae.hasOwnProperty,pae=Jse(function(n,e,t){dae.call(n,t)?n[t].push(e):p8(n,t,[e])});const gae=pae;var mae=Object.prototype,Aae=mae.hasOwnProperty;function vae(n,e){return n!=null&&Aae.call(n,e)}function _t(n,e){return n!=null&&eB(n,e,vae)}var yae="[object String]";function Wr(n){return typeof n=="string"||!an(n)&&ga(n)&&ec(n)==yae}function xae(n,e){return U0(e,function(t){return n[t]})}function Ii(n){return n==null?[]:xae(n,us(n))}var _ae=Math.max;function Dr(n,e,t,i){n=ro(n)?n:Ii(n),t=t&&!i?O0(t):0;var r=n.length;return t<0&&(t=_ae(r+t,0)),Wr(n)?t<=r&&n.indexOf(e,t)>-1:!!r&&d8(n,e,t)>-1}var Eae=Math.max;function z9(n,e,t){var i=n==null?0:n.length;if(!i)return-1;var r=t==null?0:O0(t);return r<0&&(r=Eae(i+r,0)),d8(n,e,r)}var Sae="[object Map]",wae="[object Set]",Cae=Object.prototype,Tae=Cae.hasOwnProperty;function Fn(n){if(n==null)return!0;if(ro(n)&&(an(n)||typeof n=="string"||typeof n.splice=="function"||e0(n)||A8(n)||P1(n)))return!n.length;var e=nf(n);if(e==Sae||e==wae)return!n.size;if(N0(n))return!NR(n).length;for(var t in n)if(Tae.call(n,t))return!1;return!0}var bae="[object RegExp]";function Iae(n){return ga(n)&&ec(n)==bae}var Q9=Ql&&Ql.isRegExp,Mae=Q9?G0(Q9):Iae;const Vo=Mae;function Wo(n){return n===void 0}var Rae="Expected a function";function Bae(n){if(typeof n!="function")throw new TypeError(Rae);return function(){var e=arguments;switch(e.length){case 0:return!n.call(this);case 1:return!n.call(this,e[0]);case 2:return!n.call(this,e[0],e[1]);case 3:return!n.call(this,e[0],e[1],e[2])}return!n.apply(this,e)}}function Dae(n,e,t,i){if(!Ys(n))return n;e=F1(e,n);for(var r=-1,s=e.length,a=s-1,o=n;o!=null&&++r<s;){var l=z0(e[r]),c=t;if(l==="__proto__"||l==="constructor"||l==="prototype")return n;if(r!=a){var u=o[l];c=i?i(u,l,o):void 0,c===void 0&&(c=Ys(u)?u:R1(e[r+1])?[]:{})}B1(o,l,c),o=o[l]}return n}function Pae(n,e,t){for(var i=-1,r=e.length,s={};++i<r;){var a=e[i],o=x8(n,a);t(o,a)&&Dae(s,F1(a,n),o)}return s}function _a(n,e){if(n==null)return{};var t=U0(YR(n),function(i){return[i]});return e=so(e),Pae(n,t,function(i,r){return e(i,r[0])})}function Lae(n,e,t,i,r){return r(n,function(s,a,o){t=i?(i=!1,s):e(t,s,a,o)}),t}function fs(n,e,t){var i=an(n)?xie:Lae,r=arguments.length<3;return i(n,so(e),t,r,Tu)}function G1(n,e){var t=an(n)?E8:iB;return t(n,Bae(so(e)))}function Uae(n,e){var t;return Tu(n,function(i,r,s){return t=e(i,r,s),!t}),!!t}function rB(n,e,t){var i=an(n)?KR:Uae;return t&&D1(n,e,t)&&(e=void 0),i(n,so(e))}var Oae=1/0,Fae=Qh&&1/T8(new Qh([,-0]))[1]==Oae?function(n){return new Qh(n)}:Ti;const kae=Fae;var Nae=200;function Gae(n,e,t){var i=-1,r=PR,s=n.length,a=!0,o=[],l=o;if(t)a=!1,r=nB;else if(s>=Nae){var c=e?null:kae(n);if(c)return T8(c);a=!1,r=C8,l=new rf}else l=e?[]:o;e:for(;++i<s;){var u=n[i],h=e?e(u):u;if(u=t||u!==0?u:0,a&&h===h){for(var f=l.length;f--;)if(l[f]===h)continue e;e&&l.push(h),o.push(u)}else r(l,h,t)||(l!==o&&l.push(h),o.push(u))}return o}function M8(n){return n&&n.length?Gae(n):[]}function i6(n){console&&console.error&&console.error(`Error: ${n}`)}function sB(n){console&&console.warn&&console.warn(`Warning: ${n}`)}function aB(n){const e=new Date().getTime(),t=n();return{time:new Date().getTime()-e,value:t}}function oB(n){function e(){}e.prototype=n;const t=new e;function i(){return typeof t.bar}return i(),i(),n}function zae(n){return Qae(n)?n.LABEL:n.name}function Qae(n){return Wr(n.LABEL)&&n.LABEL!==""}class ao{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),wt(this.definition,t=>{t.accept(e)})}}class ds extends ao{constructor(e){super([]),this.idx=1,hs(this,_a(e,t=>t!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class _f extends ao{constructor(e){super(e.definition),this.orgText="",hs(this,_a(e,t=>t!==void 0))}}class Yr extends ao{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,hs(this,_a(e,t=>t!==void 0))}}class Vr extends ao{constructor(e){super(e.definition),this.idx=1,hs(this,_a(e,t=>t!==void 0))}}class oo extends ao{constructor(e){super(e.definition),this.idx=1,hs(this,_a(e,t=>t!==void 0))}}class lo extends ao{constructor(e){super(e.definition),this.idx=1,hs(this,_a(e,t=>t!==void 0))}}class Bi extends ao{constructor(e){super(e.definition),this.idx=1,hs(this,_a(e,t=>t!==void 0))}}class Ea extends ao{constructor(e){super(e.definition),this.idx=1,hs(this,_a(e,t=>t!==void 0))}}class Sa extends ao{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,hs(this,_a(e,t=>t!==void 0))}}class ei{constructor(e){this.idx=1,hs(this,_a(e,t=>t!==void 0))}accept(e){e.visit(this)}}function Hae(n){return pt(n,Sm)}function Sm(n){function e(t){return pt(t,Sm)}if(n instanceof ds){const t={type:"NonTerminal",name:n.nonTerminalName,idx:n.idx};return Wr(n.label)&&(t.label=n.label),t}else{if(n instanceof Yr)return{type:"Alternative",definition:e(n.definition)};if(n instanceof Vr)return{type:"Option",idx:n.idx,definition:e(n.definition)};if(n instanceof oo)return{type:"RepetitionMandatory",idx:n.idx,definition:e(n.definition)};if(n instanceof lo)return{type:"RepetitionMandatoryWithSeparator",idx:n.idx,separator:Sm(new ei({terminalType:n.separator})),definition:e(n.definition)};if(n instanceof Ea)return{type:"RepetitionWithSeparator",idx:n.idx,separator:Sm(new ei({terminalType:n.separator})),definition:e(n.definition)};if(n instanceof Bi)return{type:"Repetition",idx:n.idx,definition:e(n.definition)};if(n instanceof Sa)return{type:"Alternation",idx:n.idx,definition:e(n.definition)};if(n instanceof ei){const t={type:"Terminal",name:n.terminalType.name,label:zae(n.terminalType),idx:n.idx};Wr(n.label)&&(t.terminalLabel=n.label);const i=n.terminalType.PATTERN;return n.terminalType.PATTERN&&(t.pattern=Vo(i)?i.source:i),t}else{if(n instanceof _f)return{type:"Rule",name:n.name,orgText:n.orgText,definition:e(n.definition)};throw Error("non exhaustive match")}}}class Ef{visit(e){const t=e;switch(t.constructor){case ds:return this.visitNonTerminal(t);case Yr:return this.visitAlternative(t);case Vr:return this.visitOption(t);case oo:return this.visitRepetitionMandatory(t);case lo:return this.visitRepetitionMandatoryWithSeparator(t);case Ea:return this.visitRepetitionWithSeparator(t);case Bi:return this.visitRepetition(t);case Sa:return this.visitAlternation(t);case ei:return this.visitTerminal(t);case _f:return this.visitRule(t);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}function Vae(n){return n instanceof Yr||n instanceof Vr||n instanceof Bi||n instanceof oo||n instanceof lo||n instanceof Ea||n instanceof ei||n instanceof _f}function p2(n,e=[]){return n instanceof Vr||n instanceof Bi||n instanceof Ea?!0:n instanceof Sa?rB(n.definition,i=>p2(i,e)):n instanceof ds&&Dr(e,n)?!1:n instanceof ao?(n instanceof ds&&e.push(n),ha(n.definition,i=>p2(i,e))):!1}function Wae(n){return n instanceof Sa}function Ga(n){if(n instanceof ds)return"SUBRULE";if(n instanceof Vr)return"OPTION";if(n instanceof Sa)return"OR";if(n instanceof oo)return"AT_LEAST_ONE";if(n instanceof lo)return"AT_LEAST_ONE_SEP";if(n instanceof Ea)return"MANY_SEP";if(n instanceof Bi)return"MANY";if(n instanceof ei)return"CONSUME";throw Error("non exhaustive match")}class z1{walk(e,t=[]){wt(e.definition,(i,r)=>{const s=Xi(e.definition,r+1);if(i instanceof ds)this.walkProdRef(i,s,t);else if(i instanceof ei)this.walkTerminal(i,s,t);else if(i instanceof Yr)this.walkFlat(i,s,t);else if(i instanceof Vr)this.walkOption(i,s,t);else if(i instanceof oo)this.walkAtLeastOne(i,s,t);else if(i instanceof lo)this.walkAtLeastOneSep(i,s,t);else if(i instanceof Ea)this.walkManySep(i,s,t);else if(i instanceof Bi)this.walkMany(i,s,t);else if(i instanceof Sa)this.walkOr(i,s,t);else throw Error("non exhaustive match")})}walkTerminal(e,t,i){}walkProdRef(e,t,i){}walkFlat(e,t,i){const r=t.concat(i);this.walk(e,r)}walkOption(e,t,i){const r=t.concat(i);this.walk(e,r)}walkAtLeastOne(e,t,i){const r=[new Vr({definition:e.definition})].concat(t,i);this.walk(e,r)}walkAtLeastOneSep(e,t,i){const r=H9(e,t,i);this.walk(e,r)}walkMany(e,t,i){const r=[new Vr({definition:e.definition})].concat(t,i);this.walk(e,r)}walkManySep(e,t,i){const r=H9(e,t,i);this.walk(e,r)}walkOr(e,t,i){const r=t.concat(i);wt(e.definition,s=>{const a=new Yr({definition:[s]});this.walk(a,r)})}}function H9(n,e,t){return[new Vr({definition:[new ei({terminalType:n.separator})].concat(n.definition)})].concat(e,t)}function H0(n){if(n instanceof ds)return H0(n.referencedRule);if(n instanceof ei)return Xae(n);if(Vae(n))return Yae(n);if(Wae(n))return qae(n);throw Error("non exhaustive match")}function Yae(n){let e=[];const t=n.definition;let i=0,r=t.length>i,s,a=!0;for(;r&&a;)s=t[i],a=p2(s),e=e.concat(H0(s)),i=i+1,r=t.length>i;return M8(e)}function qae(n){const e=pt(n.definition,t=>H0(t));return M8(ua(e))}function Xae(n){return[n.terminalType]}const lB="_~IN~_";class jae extends z1{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,i){}walkProdRef(e,t,i){const r=$ae(e.referencedRule,e.idx)+this.topProd.name,s=t.concat(i),a=new Yr({definition:s}),o=H0(a);this.follows[r]=o}}function Kae(n){const e={};return wt(n,t=>{const i=new jae(t).startWalking();hs(e,i)}),e}function $ae(n,e){return n.name+e+lB}function bt(n){return n.charCodeAt(0)}function p5(n,e){Array.isArray(n)?n.forEach(function(t){e.push(t)}):e.push(n)}function Md(n,e){if(n[e]===!0)throw"duplicate flag "+e;n[e],n[e]=!0}function gh(n){if(n===void 0)throw Error("Internal Error - Should never get here!");return!0}function Jae(){throw Error("Internal Error - Should never get here!")}function V9(n){return n.type==="Character"}const g2=[];for(let n=bt("0");n<=bt("9");n++)g2.push(n);const m2=[bt("_")].concat(g2);for(let n=bt("a");n<=bt("z");n++)m2.push(n);for(let n=bt("A");n<=bt("Z");n++)m2.push(n);const W9=[bt(" "),bt("\f"),bt(`
`),bt("\r"),bt(" "),bt("\v"),bt(" "),bt(" "),bt(""),bt(" "),bt(""),bt(""),bt(""),bt(""),bt(""),bt(""),bt(""),bt(""),bt(""),bt(""),bt("\u2028"),bt("\u2029"),bt(""),bt(""),bt(" "),bt("\uFEFF")],Zae=/[0-9a-fA-F]/,$g=/[0-9]/,eoe=/[1-9]/;class toe{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");const t=this.disjunction();this.consumeChar("/");const i={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":Md(i,"global");break;case"i":Md(i,"ignoreCase");break;case"m":Md(i,"multiLine");break;case"u":Md(i,"unicode");break;case"y":Md(i,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:i,value:t,loc:this.loc(0)}}disjunction(){const e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}}alternative(){const e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let t;switch(this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead";break}gh(t);const i=this.disjunction();return this.consumeChar(")"),{type:t,value:i,loc:this.loc(e)}}return Jae()}quantifier(e=!1){let t;const i=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":const r=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:r,atMost:r};break;case",":let s;this.isDigit()?(s=this.integerIncludingZero(),t={atLeast:r,atMost:s}):t={atLeast:r,atMost:1/0},this.consumeChar("}");break}if(e===!0&&t===void 0)return;gh(t);break}if(!(e===!0&&t===void 0)&&gh(t))return this.peekChar(0)==="?"?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(i),t}atom(){let e;const t=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),gh(e))return e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[bt(`
`),bt("\r"),bt("\u2028"),bt("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case"d":e=g2;break;case"D":e=g2,t=!0;break;case"s":e=W9;break;case"S":e=W9,t=!0;break;case"w":e=m2;break;case"W":e=m2,t=!0;break}if(gh(e))return{type:"Set",value:e,complement:t}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=bt("\f");break;case"n":e=bt(`
`);break;case"r":e=bt("\r");break;case"t":e=bt(" ");break;case"v":e=bt("\v");break}if(gh(e))return{type:"Character",value:e}}controlLetterEscapeAtom(){this.consumeChar("c");const e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:bt("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){const e=this.popChar();return{type:"Character",value:bt(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:const e=this.popChar();return{type:"Character",value:bt(e)}}}characterClass(){const e=[];let t=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),t=!0);this.isClassAtom();){const i=this.classAtom();if(i.type,V9(i)&&this.isRangeDash()){this.consumeChar("-");const r=this.classAtom();if(r.type,V9(r)){if(r.value<i.value)throw Error("Range out of order in character class");e.push({from:i.value,to:r.value})}else p5(i.value,e),e.push(bt("-")),p5(r.value,e)}else p5(i.value,e)}return this.consumeChar("]"),{type:"Set",complement:t,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
`:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:bt("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),e=!1;break;default:this.groupIdx++;break}const t=this.disjunction();this.consumeChar(")");const i={type:"Group",capturing:e,value:t};return e&&(i.idx=this.groupIdx),i}positiveInteger(){let e=this.popChar();if(eoe.test(e)===!1)throw Error("Expecting a positive integer");for(;$g.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if($g.test(e)===!1)throw Error("Expecting an integer");for(;$g.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){const e=this.popChar();switch(e){case`
`:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:bt(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return this.peekChar()==="-"&&this.isClassAtom(1)}isDigit(){return $g.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case`
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!");default:return!1}}isQuantifier(){const e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let t="";for(let r=0;r<e;r++){const s=this.popChar();if(Zae.test(s)===!1)throw Error("Expecting a HexDecimal digits");t+=s}return{type:"Character",value:parseInt(t,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){const e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}}class R8{visitChildren(e){for(const t in e){const i=e[t];e.hasOwnProperty(t)&&(i.type!==void 0?this.visit(i):Array.isArray(i)&&i.forEach(r=>{this.visit(r)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}let wm={};const noe=new toe;function Q1(n){const e=n.toString();if(wm.hasOwnProperty(e))return wm[e];{const t=noe.pattern(e);return wm[e]=t,t}}function ioe(){wm={}}const cB="Complement Sets are not supported for first char optimization",A2=`Unable to use "first char" lexer optimizations:
`;function roe(n,e=!1){try{const t=Q1(n);return r6(t.value,{},t.flags.ignoreCase)}catch(t){if(t.message===cB)e&&sB(`${A2} Unable to optimize: < ${n.toString()} >
Complement Sets cannot be automatically optimized.
This will disable the lexer's first char optimizations.
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let i="";e&&(i=`
This will disable the lexer's first char optimizations.
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),i6(`${A2}
Failed parsing: < ${n.toString()} >
Using the @chevrotain/regexp-to-ast library
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+i)}}return[]}function r6(n,e,t){switch(n.type){case"Disjunction":for(let r=0;r<n.value.length;r++)r6(n.value[r],e,t);break;case"Alternative":const i=n.value;for(let r=0;r<i.length;r++){const s=i[r];switch(s.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const a=s;switch(a.type){case"Character":Jg(a.value,e,t);break;case"Set":if(a.complement===!0)throw Error(cB);wt(a.value,l=>{if(typeof l=="number")Jg(l,e,t);else{const c=l;if(t===!0)for(let u=c.from;u<=c.to;u++)Jg(u,e,t);else{for(let u=c.from;u<=c.to&&u<Wd;u++)Jg(u,e,t);if(c.to>=Wd){const u=c.from>=Wd?c.from:Wd,h=c.to,f=Hl(u),p=Hl(h);for(let m=f;m<=p;m++)e[m]=m}}}});break;case"Group":r6(a.value,e,t);break;default:throw Error("Non Exhaustive Match")}const o=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type==="Group"&&s6(a)===!1||a.type!=="Group"&&o===!1)break}break;default:throw Error("non exhaustive match!")}return Ii(e)}function Jg(n,e,t){const i=Hl(n);e[i]=i,t===!0&&soe(n,e)}function soe(n,e){const t=String.fromCharCode(n),i=t.toUpperCase();if(i!==t){const r=Hl(i.charCodeAt(0));e[r]=r}else{const r=t.toLowerCase();if(r!==t){const s=Hl(r.charCodeAt(0));e[s]=s}}}function Y9(n,e){return af(n.value,t=>{if(typeof t=="number")return Dr(e,t);{const i=t;return af(e,r=>i.from<=r&&r<=i.to)!==void 0}})}function s6(n){const e=n.quantifier;return e&&e.atLeast===0?!0:n.value?an(n.value)?ha(n.value,s6):s6(n.value):!1}class aoe extends R8{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return}super.visitChildren(e)}}visitCharacter(e){Dr(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?Y9(e,this.targetCharCodes)===void 0&&(this.found=!0):Y9(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function B8(n,e){if(e instanceof RegExp){const t=Q1(e),i=new aoe(n);return i.visit(t),i.found}else return af(e,t=>Dr(n,t.charCodeAt(0)))!==void 0}const pu="PATTERN",Vd="defaultMode",Zg="modes";let uB=typeof new RegExp("(?:)").sticky=="boolean";function ooe(n,e){e=I8(e,{useSticky:uB,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
`],tracer:(_,x)=>x()});const t=e.tracer;t("initCharCodeToOptimizedIndexMap",()=>{Roe()});let i;t("Reject Lexer.NA",()=>{i=G1(n,_=>_[pu]===Qs.NA)});let r=!1,s;t("Transform Patterns",()=>{r=!1,s=pt(i,_=>{const x=_[pu];if(Vo(x)){const E=x.source;return E.length===1&&E!=="^"&&E!=="$"&&E!=="."&&!x.ignoreCase?E:E.length===2&&E[0]==="\\"&&!Dr(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],E[1])?E[1]:e.useSticky?X9(x):q9(x)}else{if(Jo(x))return r=!0,{exec:x};if(typeof x=="object")return r=!0,x;if(typeof x=="string"){if(x.length===1)return x;{const E=x.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),w=new RegExp(E);return e.useSticky?X9(w):q9(w)}}else throw Error("non exhaustive match")}})});let a,o,l,c,u;t("misc mapping",()=>{a=pt(i,_=>_.tokenTypeIdx),o=pt(i,_=>{const x=_.GROUP;if(x!==Qs.SKIPPED){if(Wr(x))return x;if(Wo(x))return!1;throw Error("non exhaustive match")}}),l=pt(i,_=>{const x=_.LONGER_ALT;if(x)return an(x)?pt(x,w=>z9(i,w)):[z9(i,x)]}),c=pt(i,_=>_.PUSH_MODE),u=pt(i,_=>_t(_,"POP_MODE"))});let h;t("Line Terminator Handling",()=>{const _=dB(e.lineTerminatorCharacters);h=pt(i,x=>!1),e.positionTracking!=="onlyOffset"&&(h=pt(i,x=>_t(x,"LINE_BREAKS")?!!x.LINE_BREAKS:fB(x,_)===!1&&B8(_,x.PATTERN)))});let f,p,m,y;t("Misc Mapping #2",()=>{f=pt(i,hB),p=pt(s,boe),m=fs(i,(_,x)=>{const E=x.GROUP;return Wr(E)&&E!==Qs.SKIPPED&&(_[E]=[]),_},{}),y=pt(s,(_,x)=>({pattern:s[x],longerAlt:l[x],canLineTerminator:h[x],isCustom:f[x],short:p[x],group:o[x],push:c[x],pop:u[x],tokenTypeIdx:a[x],tokenType:i[x]}))});let v=!0,A=[];return e.safeMode||t("First Char Optimization",()=>{A=fs(i,(_,x,E)=>{if(typeof x.PATTERN=="string"){const w=x.PATTERN.charCodeAt(0),I=Hl(w);g5(_,I,y[E])}else if(an(x.START_CHARS_HINT)){let w;wt(x.START_CHARS_HINT,I=>{const T=typeof I=="string"?I.charCodeAt(0):I,M=Hl(T);w!==M&&(w=M,g5(_,M,y[E]))})}else if(Vo(x.PATTERN))if(x.PATTERN.unicode)v=!1,e.ensureOptimizations&&i6(`${A2} Unable to analyze < ${x.PATTERN.toString()} > pattern.
The regexp unicode flag is not currently supported by the regexp-to-ast library.
This will disable the lexer's first char optimizations.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const w=roe(x.PATTERN,e.ensureOptimizations);Fn(w)&&(v=!1),wt(w,I=>{g5(_,I,y[E])})}else e.ensureOptimizations&&i6(`${A2} TokenType: <${x.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
This will disable the lexer's first char optimizations.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),v=!1;return _},[])}),{emptyGroups:m,patternIdxToConfig:y,charCodeToPatternIdxToConfig:A,hasCustom:r,canBeOptimized:v}}function loe(n,e){let t=[];const i=uoe(n);t=t.concat(i.errors);const r=hoe(i.valid),s=r.valid;return t=t.concat(r.errors),t=t.concat(coe(s)),t=t.concat(yoe(s)),t=t.concat(xoe(s,e)),t=t.concat(_oe(s)),t}function coe(n){let e=[];const t=js(n,i=>Vo(i[pu]));return e=e.concat(doe(t)),e=e.concat(moe(t)),e=e.concat(Aoe(t)),e=e.concat(voe(t)),e=e.concat(poe(t)),e}function uoe(n){const e=js(n,r=>!_t(r,pu)),t=pt(e,r=>({message:"Token Type: ->"+r.name+"<- missing static 'PATTERN' property",type:ci.MISSING_PATTERN,tokenTypes:[r]})),i=N1(n,e);return{errors:t,valid:i}}function hoe(n){const e=js(n,r=>{const s=r[pu];return!Vo(s)&&!Jo(s)&&!_t(s,"exec")&&!Wr(s)}),t=pt(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:ci.INVALID_PATTERN,tokenTypes:[r]})),i=N1(n,e);return{errors:t,valid:i}}const foe=/[^\\][$]/;function doe(n){class e extends R8{constructor(){super(...arguments),this.found=!1}visitEndAnchor(s){this.found=!0}}const t=js(n,r=>{const s=r.PATTERN;try{const a=Q1(s),o=new e;return o.visit(a),o.found}catch{return foe.test(s.source)}});return pt(t,r=>({message:`Unexpected RegExp Anchor Error:
Token Type: ->`+r.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:ci.EOI_ANCHOR_FOUND,tokenTypes:[r]}))}function poe(n){const e=js(n,i=>i.PATTERN.test(""));return pt(e,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' must not match an empty string",type:ci.EMPTY_MATCH_PATTERN,tokenTypes:[i]}))}const goe=/[^\\[][\^]|^\^/;function moe(n){class e extends R8{constructor(){super(...arguments),this.found=!1}visitStartAnchor(s){this.found=!0}}const t=js(n,r=>{const s=r.PATTERN;try{const a=Q1(s),o=new e;return o.visit(a),o.found}catch{return goe.test(s.source)}});return pt(t,r=>({message:`Unexpected RegExp Anchor Error:
Token Type: ->`+r.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:ci.SOI_ANCHOR_FOUND,tokenTypes:[r]}))}function Aoe(n){const e=js(n,i=>{const r=i[pu];return r instanceof RegExp&&(r.multiline||r.global)});return pt(e,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:ci.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[i]}))}function voe(n){const e=[];let t=pt(n,s=>fs(n,(a,o)=>(s.PATTERN.source===o.PATTERN.source&&!Dr(e,o)&&o.PATTERN!==Qs.NA&&(e.push(o),a.push(o)),a),[]));t=Q0(t);const i=js(t,s=>s.length>1);return pt(i,s=>{const a=pt(s,l=>l.name);return{message:`The same RegExp pattern ->${ma(s).PATTERN}<-has been used in all of the following Token Types: ${a.join(", ")} <-`,type:ci.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}})}function yoe(n){const e=js(n,i=>{if(!_t(i,"GROUP"))return!1;const r=i.GROUP;return r!==Qs.SKIPPED&&r!==Qs.NA&&!Wr(r)});return pt(e,i=>({message:"Token Type: ->"+i.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:ci.INVALID_GROUP_TYPE_FOUND,tokenTypes:[i]}))}function xoe(n,e){const t=js(n,r=>r.PUSH_MODE!==void 0&&!Dr(e,r.PUSH_MODE));return pt(t,r=>({message:`Token Type: ->${r.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${r.PUSH_MODE}<-which does not exist`,type:ci.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[r]}))}function _oe(n){const e=[],t=fs(n,(i,r,s)=>{const a=r.PATTERN;return a===Qs.NA||(Wr(a)?i.push({str:a,idx:s,tokenType:r}):Vo(a)&&Soe(a)&&i.push({str:a.source,idx:s,tokenType:r})),i},[]);return wt(n,(i,r)=>{wt(t,({str:s,idx:a,tokenType:o})=>{if(r<a&&Eoe(s,i.PATTERN)){const l=`Token: ->${o.name}<- can never be matched.
Because it appears AFTER the Token Type ->${i.name}<-in the lexer's definition.
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:l,type:ci.UNREACHABLE_PATTERN,tokenTypes:[i,o]})}})}),e}function Eoe(n,e){if(Vo(e)){const t=e.exec(n);return t!==null&&t.index===0}else{if(Jo(e))return e(n,0,[],{});if(_t(e,"exec"))return e.exec(n,0,[],{});if(typeof e=="string")return e===n;throw Error("non exhaustive match")}}function Soe(n){return af([".","\\","[","]","|","^","$","(",")","?","*","+","{"],t=>n.source.indexOf(t)!==-1)===void 0}function q9(n){const e=n.ignoreCase?"i":"";return new RegExp(`^(?:${n.source})`,e)}function X9(n){const e=n.ignoreCase?"iy":"y";return new RegExp(`${n.source}`,e)}function woe(n,e,t){const i=[];return _t(n,Vd)||i.push({message:"A MultiMode Lexer cannot be initialized without a <"+Vd+`> property in its definition
`,type:ci.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),_t(n,Zg)||i.push({message:"A MultiMode Lexer cannot be initialized without a <"+Zg+`> property in its definition
`,type:ci.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),_t(n,Zg)&&_t(n,Vd)&&!_t(n.modes,n.defaultMode)&&i.push({message:`A MultiMode Lexer cannot be initialized with a ${Vd}: <${n.defaultMode}>which does not exist
`,type:ci.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),_t(n,Zg)&&wt(n.modes,(r,s)=>{wt(r,(a,o)=>{if(Wo(a))i.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${o}>
`,type:ci.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(_t(a,"LONGER_ALT")){const l=an(a.LONGER_ALT)?a.LONGER_ALT:[a.LONGER_ALT];wt(l,c=>{!Wo(c)&&!Dr(r,c)&&i.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${c.name}> on token <${a.name}> outside of mode <${s}>
`,type:ci.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),i}function Coe(n,e,t){const i=[];let r=!1;const s=Q0(ua(Ii(n.modes))),a=G1(s,l=>l[pu]===Qs.NA),o=dB(t);return e&&wt(a,l=>{const c=fB(l,o);if(c!==!1){const h={message:Moe(l,c),type:c.issue,tokenType:l};i.push(h)}else _t(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(r=!0):B8(o,l.PATTERN)&&(r=!0)}),e&&!r&&i.push({message:`Warning: No LINE_BREAKS Found.
This Lexer has been defined to track line and column information,
But none of the Token Types can be identified as matching a line terminator.
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
for details.`,type:ci.NO_LINE_BREAKS_FLAGS}),i}function Toe(n){const e={},t=us(n);return wt(t,i=>{const r=n[i];if(an(r))e[i]=[];else throw Error("non exhaustive match")}),e}function hB(n){const e=n.PATTERN;if(Vo(e))return!1;if(Jo(e))return!0;if(_t(e,"exec"))return!0;if(Wr(e))return!1;throw Error("non exhaustive match")}function boe(n){return Wr(n)&&n.length===1?n.charCodeAt(0):!1}const Ioe={test:function(n){const e=n.length;for(let t=this.lastIndex;t<e;t++){const i=n.charCodeAt(t);if(i===10)return this.lastIndex=t+1,!0;if(i===13)return n.charCodeAt(t+1)===10?this.lastIndex=t+2:this.lastIndex=t+1,!0}return!1},lastIndex:0};function fB(n,e){if(_t(n,"LINE_BREAKS"))return!1;if(Vo(n.PATTERN)){try{B8(e,n.PATTERN)}catch(t){return{issue:ci.IDENTIFY_TERMINATOR,errMsg:t.message}}return!1}else{if(Wr(n.PATTERN))return!1;if(hB(n))return{issue:ci.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function Moe(n,e){if(e.issue===ci.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
The problem is in the <${n.name}> Token Type
Root cause: ${e.errMsg}.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===ci.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
The problem is in the <${n.name}> Token Type
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function dB(n){return pt(n,t=>Wr(t)?t.charCodeAt(0):t)}function g5(n,e,t){n[e]===void 0?n[e]=[t]:n[e].push(t)}const Wd=256;let Cm=[];function Hl(n){return n<Wd?n:Cm[n]}function Roe(){if(Fn(Cm)){Cm=new Array(65536);for(let n=0;n<65536;n++)Cm[n]=n>255?255+~~(n/255):n}}function V0(n,e){const t=n.tokenTypeIdx;return t===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[t]===!0}function v2(n,e){return n.tokenTypeIdx===e.tokenTypeIdx}let j9=1;const pB={};function W0(n){const e=Boe(n);Doe(e),Loe(e),Poe(e),wt(e,t=>{t.isParent=t.categoryMatches.length>0})}function Boe(n){let e=cr(n),t=n,i=!0;for(;i;){t=Q0(ua(pt(t,s=>s.CATEGORIES)));const r=N1(t,e);e=e.concat(r),Fn(r)?i=!1:t=r}return e}function Doe(n){wt(n,e=>{mB(e)||(pB[j9]=e,e.tokenTypeIdx=j9++),K9(e)&&!an(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),K9(e)||(e.CATEGORIES=[]),Uoe(e)||(e.categoryMatches=[]),Ooe(e)||(e.categoryMatchesMap={})})}function Poe(n){wt(n,e=>{e.categoryMatches=[],wt(e.categoryMatchesMap,(t,i)=>{e.categoryMatches.push(pB[i].tokenTypeIdx)})})}function Loe(n){wt(n,e=>{gB([],e)})}function gB(n,e){wt(n,t=>{e.categoryMatchesMap[t.tokenTypeIdx]=!0}),wt(e.CATEGORIES,t=>{const i=n.concat(e);Dr(i,t)||gB(i,t)})}function mB(n){return _t(n,"tokenTypeIdx")}function K9(n){return _t(n,"CATEGORIES")}function Uoe(n){return _t(n,"categoryMatches")}function Ooe(n){return _t(n,"categoryMatchesMap")}function Foe(n){return _t(n,"tokenTypeIdx")}const koe={buildUnableToPopLexerModeMessage(n){return`Unable to pop Lexer Mode after encountering Token ->${n.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(n,e,t,i,r){return`unexpected character: ->${n.charAt(e)}<- at offset: ${e}, skipped ${t} characters.`}};var ci;(function(n){n[n.MISSING_PATTERN=0]="MISSING_PATTERN",n[n.INVALID_PATTERN=1]="INVALID_PATTERN",n[n.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",n[n.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",n[n.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",n[n.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",n[n.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",n[n.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",n[n.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",n[n.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",n[n.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",n[n.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",n[n.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",n[n.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",n[n.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",n[n.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",n[n.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",n[n.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(ci||(ci={}));const Yd={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:koe,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Yd);class Qs{constructor(e,t=Yd){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(r,s)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;const a=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${a}--> <${r}>`);const{time:o,value:l}=aB(s),c=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&c(`${a}<-- <${r}> time: ${o}ms`),this.traceInitIndent--,l}else return s()},typeof t=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
a boolean 2nd argument is no longer supported`);this.config=hs({},Yd,t);const i=this.config.traceInitPerf;i===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof i=="number"&&(this.traceInitMaxIdent=i,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let r,s=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===Yd.lineTerminatorsPattern)this.config.lineTerminatorsPattern=Ioe;else if(this.config.lineTerminatorCharacters===Yd.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(t.safeMode&&t.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),an(e)?r={modes:{defaultMode:cr(e)},defaultMode:Vd}:(s=!1,r=cr(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(woe(r,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(Coe(r,this.trackStartLines,this.config.lineTerminatorCharacters))})),r.modes=r.modes?r.modes:{},wt(r.modes,(o,l)=>{r.modes[l]=G1(o,c=>Wo(c))});const a=us(r.modes);if(wt(r.modes,(o,l)=>{this.TRACE_INIT(`Mode: <${l}> processing`,()=>{if(this.modes.push(l),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(loe(o,a))}),Fn(this.lexerDefinitionErrors)){W0(o);let c;this.TRACE_INIT("analyzeTokenTypes",()=>{c=ooe(o,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[l]=c.patternIdxToConfig,this.charCodeToPatternIdxToConfig[l]=c.charCodeToPatternIdxToConfig,this.emptyGroups=hs({},this.emptyGroups,c.emptyGroups),this.hasCustom=c.hasCustom||this.hasCustom,this.canModeBeOptimized[l]=c.canBeOptimized}})}),this.defaultMode=r.defaultMode,!Fn(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const l=pt(this.lexerDefinitionErrors,c=>c.message).join(`-----------------------
`);throw new Error(`Errors detected in definition of Lexer:
`+l)}wt(this.lexerDefinitionWarning,o=>{sB(o.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(uB?(this.chopInput=tf,this.match=this.matchWithTest):(this.updateLastIndex=Ti,this.match=this.matchWithExec),s&&(this.handleModes=Ti),this.trackStartLines===!1&&(this.computeNewColumn=tf),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=Ti),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{const o=fs(this.canModeBeOptimized,(l,c,u)=>(c===!1&&l.push(u),l),[]);if(t.ensureOptimizations&&!Fn(o))throw Error(`Lexer Modes: < ${o.join(", ")} > cannot be optimized.
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{ioe()}),this.TRACE_INIT("toFastProperties",()=>{oB(this)})})}tokenize(e,t=this.defaultMode){if(!Fn(this.lexerDefinitionErrors)){const r=pt(this.lexerDefinitionErrors,s=>s.message).join(`-----------------------
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
`+r)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let i,r,s,a,o,l,c,u,h,f,p,m,y,v,A;const _=e,x=_.length;let E=0,w=0;const I=this.hasCustom?0:Math.floor(e.length/10),T=new Array(I),M=[];let b=this.trackStartLines?1:void 0,B=this.trackStartLines?1:void 0;const L=Toe(this.emptyGroups),U=this.trackStartLines,O=this.config.lineTerminatorsPattern;let Q=0,G=[],F=[];const q=[],Y=[];Object.freeze(Y);let H;function V(){return G}function D(ie){const te=Hl(ie),re=F[te];return re===void 0?Y:re}const k=ie=>{if(q.length===1&&ie.tokenType.PUSH_MODE===void 0){const te=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(ie);M.push({offset:ie.startOffset,line:ie.startLine,column:ie.startColumn,length:ie.image.length,message:te})}else{q.pop();const te=sf(q);G=this.patternIdxToConfig[te],F=this.charCodeToPatternIdxToConfig[te],Q=G.length;const re=this.canModeBeOptimized[te]&&this.config.safeMode===!1;F&&re?H=D:H=V}};function Z(ie){q.push(ie),F=this.charCodeToPatternIdxToConfig[ie],G=this.patternIdxToConfig[ie],Q=G.length,Q=G.length;const te=this.canModeBeOptimized[ie]&&this.config.safeMode===!1;F&&te?H=D:H=V}Z.call(this,t);let j;const ee=this.config.recoveryEnabled;for(;E<x;){l=null;const ie=_.charCodeAt(E),te=H(ie),re=te.length;for(i=0;i<re;i++){j=te[i];const ce=j.pattern;c=null;const ye=j.short;if(ye!==!1?ie===ye&&(l=ce):j.isCustom===!0?(A=ce.exec(_,E,T,L),A!==null?(l=A[0],A.payload!==void 0&&(c=A.payload)):l=null):(this.updateLastIndex(ce,E),l=this.match(ce,e,E)),l!==null){if(o=j.longerAlt,o!==void 0){const oe=o.length;for(s=0;s<oe;s++){const W=G[o[s]],ge=W.pattern;if(u=null,W.isCustom===!0?(A=ge.exec(_,E,T,L),A!==null?(a=A[0],A.payload!==void 0&&(u=A.payload)):a=null):(this.updateLastIndex(ge,E),a=this.match(ge,e,E)),a&&a.length>l.length){l=a,c=u,j=W;break}}}break}}if(l!==null){if(h=l.length,f=j.group,f!==void 0&&(p=j.tokenTypeIdx,m=this.createTokenInstance(l,E,p,j.tokenType,b,B,h),this.handlePayload(m,c),f===!1?w=this.addToken(T,w,m):L[f].push(m)),e=this.chopInput(e,h),E=E+h,B=this.computeNewColumn(B,h),U===!0&&j.canLineTerminator===!0){let ce=0,ye,oe;O.lastIndex=0;do ye=O.test(l),ye===!0&&(oe=O.lastIndex-1,ce++);while(ye===!0);ce!==0&&(b=b+ce,B=h-oe,this.updateTokenEndLineColumnLocation(m,f,oe,ce,b,B,h))}this.handleModes(j,k,Z,m)}else{const ce=E,ye=b,oe=B;let W=ee===!1;for(;W===!1&&E<x;)for(e=this.chopInput(e,1),E++,r=0;r<Q;r++){const ge=G[r],he=ge.pattern,ue=ge.short;if(ue!==!1?_.charCodeAt(E)===ue&&(W=!0):ge.isCustom===!0?W=he.exec(_,E,T,L)!==null:(this.updateLastIndex(he,E),W=he.exec(e)!==null),W===!0)break}if(y=E-ce,B=this.computeNewColumn(B,y),v=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(_,ce,y,ye,oe),M.push({offset:ce,line:ye,column:oe,length:y,message:v}),ee===!1)break}}return this.hasCustom||(T.length=w),{tokens:T,groups:L,errors:M}}handleModes(e,t,i,r){if(e.pop===!0){const s=e.push;t(r),s!==void 0&&i.call(this,s)}else e.push!==void 0&&i.call(this,e.push)}chopInput(e,t){return e.substring(t)}updateLastIndex(e,t){e.lastIndex=t}updateTokenEndLineColumnLocation(e,t,i,r,s,a,o){let l,c;t!==void 0&&(l=i===o-1,c=l?-1:0,r===1&&l===!0||(e.endLine=s+c,e.endColumn=a-1+-c))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,i,r){return{image:e,startOffset:t,tokenTypeIdx:i,tokenType:r}}createStartOnlyToken(e,t,i,r,s,a){return{image:e,startOffset:t,startLine:s,startColumn:a,tokenTypeIdx:i,tokenType:r}}createFullToken(e,t,i,r,s,a,o){return{image:e,startOffset:t,endOffset:t+o-1,startLine:s,endLine:s,startColumn:a,endColumn:a+o-1,tokenTypeIdx:i,tokenType:r}}addTokenUsingPush(e,t,i){return e.push(i),t}addTokenUsingMemberAccess(e,t,i){return e[t]=i,t++,t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){t!==null&&(e.payload=t)}matchWithTest(e,t,i){return e.test(t)===!0?t.substring(i,e.lastIndex):null}matchWithExec(e,t){const i=e.exec(t);return i!==null?i[0]:null}}Qs.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";Qs.NA=/NOT_APPLICABLE/;function cp(n){return AB(n)?n.LABEL:n.name}function AB(n){return Wr(n.LABEL)&&n.LABEL!==""}const Noe="parent",$9="categories",J9="label",Z9="group",ew="push_mode",tw="pop_mode",nw="longer_alt",iw="line_breaks",rw="start_chars_hint";function vB(n){return Goe(n)}function Goe(n){const e=n.pattern,t={};if(t.name=n.name,Wo(e)||(t.PATTERN=e),_t(n,Noe))throw`The parent property is no longer supported.
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return _t(n,$9)&&(t.CATEGORIES=n[$9]),W0([t]),_t(n,J9)&&(t.LABEL=n[J9]),_t(n,Z9)&&(t.GROUP=n[Z9]),_t(n,tw)&&(t.POP_MODE=n[tw]),_t(n,ew)&&(t.PUSH_MODE=n[ew]),_t(n,nw)&&(t.LONGER_ALT=n[nw]),_t(n,iw)&&(t.LINE_BREAKS=n[iw]),_t(n,rw)&&(t.START_CHARS_HINT=n[rw]),t}const gu=vB({name:"EOF",pattern:Qs.NA});W0([gu]);function D8(n,e,t,i,r,s,a,o){return{image:e,startOffset:t,endOffset:i,startLine:r,endLine:s,startColumn:a,endColumn:o,tokenTypeIdx:n.tokenTypeIdx,tokenType:n}}function zoe(n,e){return V0(n,e)}const yB={buildMismatchTokenMessage({expected:n,actual:e,previous:t,ruleName:i}){return`Expecting ${AB(n)?`--> ${cp(n)} <--`:`token of type --> ${n.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:n,ruleName:e}){return"Redundant input, expecting EOF but found: "+n.image},buildNoViableAltMessage({expectedPathsPerAlt:n,actual:e,previous:t,customUserDescription:i,ruleName:r}){const s="Expecting: ",o=`
but found: '`+ma(e).image+"'";if(i)return s+i+o;{const l=fs(n,(f,p)=>f.concat(p),[]),c=pt(l,f=>`[${pt(f,p=>cp(p)).join(", ")}]`),h=`one of these possible Token sequences:
${pt(c,(f,p)=>` ${p+1}. ${f}`).join(`
`)}`;return s+h+o}},buildEarlyExitMessage({expectedIterationPaths:n,actual:e,customUserDescription:t,ruleName:i}){const r="Expecting: ",a=`
but found: '`+ma(e).image+"'";if(t)return r+t+a;{const l=`expecting at least one iteration which starts with one of these possible Token sequences::
<${pt(n,c=>`[${pt(c,u=>cp(u)).join(",")}]`).join(" ,")}>`;return r+l+a}}};Object.freeze(yB);const Qoe={buildRuleNotFoundError(n,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
inside top level rule: ->`+n.name+"<-"}},Xc={buildDuplicateFoundError(n,e){function t(u){return u instanceof ei?u.terminalType.name:u instanceof ds?u.nonTerminalName:""}const i=n.name,r=ma(e),s=r.idx,a=Ga(r),o=t(r),l=s>0;let c=`->${a}${l?s:""}<- ${o?`with argument: ->${o}<-`:""}
appears more than once (${e.length} times) in the top level rule: ->${i}<-.
For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
`;return c=c.replace(/[ \t]+/g," "),c=c.replace(/\s\s+/g,`
`),c},buildNamespaceConflictError(n){return`Namespace conflict found in grammar.
The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${n.name}>.
To resolve this make sure each Terminal and Non-Terminal names are unique
This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(n){const e=pt(n.prefixPath,r=>cp(r)).join(", "),t=n.alternation.idx===0?"":n.alternation.idx;return`Ambiguous alternatives: <${n.ambiguityIndices.join(" ,")}> due to common lookahead prefix
in <OR${t}> inside <${n.topLevelRule.name}> Rule,
<${e}> may appears as a prefix path in all these alternatives.
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
For Further details.`},buildAlternationAmbiguityError(n){const e=pt(n.prefixPath,r=>cp(r)).join(", "),t=n.alternation.idx===0?"":n.alternation.idx;let i=`Ambiguous Alternatives Detected: <${n.ambiguityIndices.join(" ,")}> in <OR${t}> inside <${n.topLevelRule.name}> Rule,
<${e}> may appears as a prefix path in all these alternatives.
`;return i=i+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
For Further details.`,i},buildEmptyRepetitionError(n){let e=Ga(n.repetition);return n.repetition.idx!==0&&(e+=n.repetition.idx),`The repetition <${e}> within Rule <${n.topLevelRule.name}> can never consume any tokens.
This could lead to an infinite loop.`},buildTokenNameError(n){return"deprecated"},buildEmptyAlternationError(n){return`Ambiguous empty alternative: <${n.emptyChoiceIdx+1}> in <OR${n.alternation.idx}> inside <${n.topLevelRule.name}> Rule.
Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(n){return`An Alternation cannot have more than 256 alternatives:
<OR${n.alternation.idx}> inside <${n.topLevelRule.name}> Rule.
has ${n.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(n){const e=n.topLevelRule.name,t=pt(n.leftRecursionPath,s=>s.name),i=`${e} --> ${t.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar.
rule: <${e}> can be invoked from itself (directly or indirectly)
without consuming any Tokens. The grammar path that causes this is:
${i}
To fix this refactor your grammar to remove the left recursion.
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(n){return"deprecated"},buildDuplicateRuleNameError(n){let e;return n.topLevelRule instanceof _f?e=n.topLevelRule.name:e=n.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${n.grammarName}<-`}};function Hoe(n,e){const t=new Voe(n,e);return t.resolveRefs(),t.errors}class Voe extends Ef{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){wt(Ii(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{const i=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:i,type:Mr.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class Woe extends z1{constructor(e,t){super(),this.topProd=e,this.path=t,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=cr(this.path.ruleStack).reverse(),this.occurrenceStack=cr(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,i){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const r=t.concat(i);this.updateExpectedNext(),this.walk(e.referencedRule,r)}}updateExpectedNext(){Fn(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class Yoe extends Woe{constructor(e,t){super(e,t),this.path=t,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,i){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const r=t.concat(i),s=new Yr({definition:r});this.possibleTokTypes=H0(s),this.found=!0}}}class H1 extends z1{constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class qoe extends H1{walkMany(e,t,i){if(e.idx===this.occurrence){const r=ma(t.concat(i));this.result.isEndOfRule=r===void 0,r instanceof ei&&(this.result.token=r.terminalType,this.result.occurrence=r.idx)}else super.walkMany(e,t,i)}}class sw extends H1{walkManySep(e,t,i){if(e.idx===this.occurrence){const r=ma(t.concat(i));this.result.isEndOfRule=r===void 0,r instanceof ei&&(this.result.token=r.terminalType,this.result.occurrence=r.idx)}else super.walkManySep(e,t,i)}}class Xoe extends H1{walkAtLeastOne(e,t,i){if(e.idx===this.occurrence){const r=ma(t.concat(i));this.result.isEndOfRule=r===void 0,r instanceof ei&&(this.result.token=r.terminalType,this.result.occurrence=r.idx)}else super.walkAtLeastOne(e,t,i)}}class aw extends H1{walkAtLeastOneSep(e,t,i){if(e.idx===this.occurrence){const r=ma(t.concat(i));this.result.isEndOfRule=r===void 0,r instanceof ei&&(this.result.token=r.terminalType,this.result.occurrence=r.idx)}else super.walkAtLeastOneSep(e,t,i)}}function a6(n,e,t=[]){t=cr(t);let i=[],r=0;function s(o){return o.concat(Xi(n,r+1))}function a(o){const l=a6(s(o),e,t);return i.concat(l)}for(;t.length<e&&r<n.length;){const o=n[r];if(o instanceof Yr)return a(o.definition);if(o instanceof ds)return a(o.definition);if(o instanceof Vr)i=a(o.definition);else if(o instanceof oo){const l=o.definition.concat([new Bi({definition:o.definition})]);return a(l)}else if(o instanceof lo){const l=[new Yr({definition:o.definition}),new Bi({definition:[new ei({terminalType:o.separator})].concat(o.definition)})];return a(l)}else if(o instanceof Ea){const l=o.definition.concat([new Bi({definition:[new ei({terminalType:o.separator})].concat(o.definition)})]);i=a(l)}else if(o instanceof Bi){const l=o.definition.concat([new Bi({definition:o.definition})]);i=a(l)}else{if(o instanceof Sa)return wt(o.definition,l=>{Fn(l.definition)===!1&&(i=a(l.definition))}),i;if(o instanceof ei)t.push(o.terminalType);else throw Error("non exhaustive match")}r++}return i.push({partialPath:t,suffixDef:Xi(n,r)}),i}function xB(n,e,t,i){const r="EXIT_NONE_TERMINAL",s=[r],a="EXIT_ALTERNATIVE";let o=!1;const l=e.length,c=l-i-1,u=[],h=[];for(h.push({idx:-1,def:n,ruleStack:[],occurrenceStack:[]});!Fn(h);){const f=h.pop();if(f===a){o&&sf(h).idx<=c&&h.pop();continue}const p=f.def,m=f.idx,y=f.ruleStack,v=f.occurrenceStack;if(Fn(p))continue;const A=p[0];if(A===r){const _={idx:m,def:Xi(p),ruleStack:i0(y),occurrenceStack:i0(v)};h.push(_)}else if(A instanceof ei)if(m<l-1){const _=m+1,x=e[_];if(t(x,A.terminalType)){const E={idx:_,def:Xi(p),ruleStack:y,occurrenceStack:v};h.push(E)}}else if(m===l-1)u.push({nextTokenType:A.terminalType,nextTokenOccurrence:A.idx,ruleStack:y,occurrenceStack:v}),o=!0;else throw Error("non exhaustive match");else if(A instanceof ds){const _=cr(y);_.push(A.nonTerminalName);const x=cr(v);x.push(A.idx);const E={idx:m,def:A.definition.concat(s,Xi(p)),ruleStack:_,occurrenceStack:x};h.push(E)}else if(A instanceof Vr){const _={idx:m,def:Xi(p),ruleStack:y,occurrenceStack:v};h.push(_),h.push(a);const x={idx:m,def:A.definition.concat(Xi(p)),ruleStack:y,occurrenceStack:v};h.push(x)}else if(A instanceof oo){const _=new Bi({definition:A.definition,idx:A.idx}),x=A.definition.concat([_],Xi(p)),E={idx:m,def:x,ruleStack:y,occurrenceStack:v};h.push(E)}else if(A instanceof lo){const _=new ei({terminalType:A.separator}),x=new Bi({definition:[_].concat(A.definition),idx:A.idx}),E=A.definition.concat([x],Xi(p)),w={idx:m,def:E,ruleStack:y,occurrenceStack:v};h.push(w)}else if(A instanceof Ea){const _={idx:m,def:Xi(p),ruleStack:y,occurrenceStack:v};h.push(_),h.push(a);const x=new ei({terminalType:A.separator}),E=new Bi({definition:[x].concat(A.definition),idx:A.idx}),w=A.definition.concat([E],Xi(p)),I={idx:m,def:w,ruleStack:y,occurrenceStack:v};h.push(I)}else if(A instanceof Bi){const _={idx:m,def:Xi(p),ruleStack:y,occurrenceStack:v};h.push(_),h.push(a);const x=new Bi({definition:A.definition,idx:A.idx}),E=A.definition.concat([x],Xi(p)),w={idx:m,def:E,ruleStack:y,occurrenceStack:v};h.push(w)}else if(A instanceof Sa)for(let _=A.definition.length-1;_>=0;_--){const x=A.definition[_],E={idx:m,def:x.definition.concat(Xi(p)),ruleStack:y,occurrenceStack:v};h.push(E),h.push(a)}else if(A instanceof Yr)h.push({idx:m,def:A.definition.concat(Xi(p)),ruleStack:y,occurrenceStack:v});else if(A instanceof _f)h.push(joe(A,m,y,v));else throw Error("non exhaustive match")}return u}function joe(n,e,t,i){const r=cr(t);r.push(n.name);const s=cr(i);return s.push(1),{idx:e,def:n.definition,ruleStack:r,occurrenceStack:s}}var ai;(function(n){n[n.OPTION=0]="OPTION",n[n.REPETITION=1]="REPETITION",n[n.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",n[n.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",n[n.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",n[n.ALTERNATION=5]="ALTERNATION"})(ai||(ai={}));function _B(n){if(n instanceof Vr||n==="Option")return ai.OPTION;if(n instanceof Bi||n==="Repetition")return ai.REPETITION;if(n instanceof oo||n==="RepetitionMandatory")return ai.REPETITION_MANDATORY;if(n instanceof lo||n==="RepetitionMandatoryWithSeparator")return ai.REPETITION_MANDATORY_WITH_SEPARATOR;if(n instanceof Ea||n==="RepetitionWithSeparator")return ai.REPETITION_WITH_SEPARATOR;if(n instanceof Sa||n==="Alternation")return ai.ALTERNATION;throw Error("non exhaustive match")}function Koe(n,e,t,i,r,s){const a=P8(n,e,t),o=wB(a)?v2:V0;return s(a,i,o,r)}function $oe(n,e,t,i,r,s){const a=L8(n,e,r,t),o=wB(a)?v2:V0;return s(a[0],o,i)}function Joe(n,e,t,i){const r=n.length,s=ha(n,a=>ha(a,o=>o.length===1));if(e)return function(a){const o=pt(a,l=>l.GATE);for(let l=0;l<r;l++){const c=n[l],u=c.length,h=o[l];if(!(h!==void 0&&h.call(this)===!1))e:for(let f=0;f<u;f++){const p=c[f],m=p.length;for(let y=0;y<m;y++){const v=this.LA(y+1);if(t(v,p[y])===!1)continue e}return l}}};if(s&&!i){const a=pt(n,l=>ua(l)),o=fs(a,(l,c,u)=>(wt(c,h=>{_t(l,h.tokenTypeIdx)||(l[h.tokenTypeIdx]=u),wt(h.categoryMatches,f=>{_t(l,f)||(l[f]=u)})}),l),{});return function(){const l=this.LA(1);return o[l.tokenTypeIdx]}}else return function(){for(let a=0;a<r;a++){const o=n[a],l=o.length;e:for(let c=0;c<l;c++){const u=o[c],h=u.length;for(let f=0;f<h;f++){const p=this.LA(f+1);if(t(p,u[f])===!1)continue e}return a}}}}function Zoe(n,e,t){const i=ha(n,s=>s.length===1),r=n.length;if(i&&!t){const s=ua(n);if(s.length===1&&Fn(s[0].categoryMatches)){const o=s[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===o}}else{const a=fs(s,(o,l,c)=>(o[l.tokenTypeIdx]=!0,wt(l.categoryMatches,u=>{o[u]=!0}),o),[]);return function(){const o=this.LA(1);return a[o.tokenTypeIdx]===!0}}}else return function(){e:for(let s=0;s<r;s++){const a=n[s],o=a.length;for(let l=0;l<o;l++){const c=this.LA(l+1);if(e(c,a[l])===!1)continue e}return!0}return!1}}class ele extends z1{constructor(e,t,i){super(),this.topProd=e,this.targetOccurrence=t,this.targetProdType=i}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,t,i,r){return e.idx===this.targetOccurrence&&this.targetProdType===t?(this.restDef=i.concat(r),!0):!1}walkOption(e,t,i){this.checkIsTarget(e,ai.OPTION,t,i)||super.walkOption(e,t,i)}walkAtLeastOne(e,t,i){this.checkIsTarget(e,ai.REPETITION_MANDATORY,t,i)||super.walkOption(e,t,i)}walkAtLeastOneSep(e,t,i){this.checkIsTarget(e,ai.REPETITION_MANDATORY_WITH_SEPARATOR,t,i)||super.walkOption(e,t,i)}walkMany(e,t,i){this.checkIsTarget(e,ai.REPETITION,t,i)||super.walkOption(e,t,i)}walkManySep(e,t,i){this.checkIsTarget(e,ai.REPETITION_WITH_SEPARATOR,t,i)||super.walkOption(e,t,i)}}class EB extends Ef{constructor(e,t,i){super(),this.targetOccurrence=e,this.targetProdType=t,this.targetRef=i,this.result=[]}checkIsTarget(e,t){e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,ai.OPTION)}visitRepetition(e){this.checkIsTarget(e,ai.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,ai.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,ai.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,ai.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,ai.ALTERNATION)}}function ow(n){const e=new Array(n);for(let t=0;t<n;t++)e[t]=[];return e}function m5(n){let e=[""];for(let t=0;t<n.length;t++){const i=n[t],r=[];for(let s=0;s<e.length;s++){const a=e[s];r.push(a+"_"+i.tokenTypeIdx);for(let o=0;o<i.categoryMatches.length;o++){const l="_"+i.categoryMatches[o];r.push(a+l)}}e=r}return e}function tle(n,e,t){for(let i=0;i<n.length;i++){if(i===t)continue;const r=n[i];for(let s=0;s<e.length;s++){const a=e[s];if(r[a]===!0)return!1}}return!0}function SB(n,e){const t=pt(n,a=>a6([a],1)),i=ow(t.length),r=pt(t,a=>{const o={};return wt(a,l=>{const c=m5(l.partialPath);wt(c,u=>{o[u]=!0})}),o});let s=t;for(let a=1;a<=e;a++){const o=s;s=ow(o.length);for(let l=0;l<o.length;l++){const c=o[l];for(let u=0;u<c.length;u++){const h=c[u].partialPath,f=c[u].suffixDef,p=m5(h);if(tle(r,p,l)||Fn(f)||h.length===e){const y=i[l];if(o6(y,h)===!1){y.push(h);for(let v=0;v<p.length;v++){const A=p[v];r[l][A]=!0}}}else{const y=a6(f,a+1,h);s[l]=s[l].concat(y),wt(y,v=>{const A=m5(v.partialPath);wt(A,_=>{r[l][_]=!0})})}}}}return i}function P8(n,e,t,i){const r=new EB(n,ai.ALTERNATION,i);return e.accept(r),SB(r.result,t)}function L8(n,e,t,i){const r=new EB(n,t);e.accept(r);const s=r.result,o=new ele(e,n,t).startWalking(),l=new Yr({definition:s}),c=new Yr({definition:o});return SB([l,c],i)}function o6(n,e){e:for(let t=0;t<n.length;t++){const i=n[t];if(i.length===e.length){for(let r=0;r<i.length;r++){const s=e[r],a=i[r];if((s===a||a.categoryMatchesMap[s.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function nle(n,e){return n.length<e.length&&ha(n,(t,i)=>{const r=e[i];return t===r||r.categoryMatchesMap[t.tokenTypeIdx]})}function wB(n){return ha(n,e=>ha(e,t=>ha(t,i=>Fn(i.categoryMatches))))}function ile(n){const e=n.lookaheadStrategy.validate({rules:n.rules,tokenTypes:n.tokenTypes,grammarName:n.grammarName});return pt(e,t=>Object.assign({type:Mr.CUSTOM_LOOKAHEAD_VALIDATION},t))}function rle(n,e,t,i){const r=zs(n,l=>sle(l,t)),s=Ale(n,e,t),a=zs(n,l=>dle(l,t)),o=zs(n,l=>lle(l,n,i,t));return r.concat(s,a,o)}function sle(n,e){const t=new ole;n.accept(t);const i=t.allProductions,r=gae(i,ale),s=_a(r,o=>o.length>1);return pt(Ii(s),o=>{const l=ma(o),c=e.buildDuplicateFoundError(n,o),u=Ga(l),h={message:c,type:Mr.DUPLICATE_PRODUCTIONS,ruleName:n.name,dslName:u,occurrence:l.idx},f=CB(l);return f&&(h.parameter=f),h})}function ale(n){return`${Ga(n)}_#_${n.idx}_#_${CB(n)}`}function CB(n){return n instanceof ei?n.terminalType.name:n instanceof ds?n.nonTerminalName:""}class ole extends Ef{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}}function lle(n,e,t,i){const r=[];if(fs(e,(a,o)=>o.name===n.name?a+1:a,0)>1){const a=i.buildDuplicateRuleNameError({topLevelRule:n,grammarName:t});r.push({message:a,type:Mr.DUPLICATE_RULE_NAME,ruleName:n.name})}return r}function cle(n,e,t){const i=[];let r;return Dr(e,n)||(r=`Invalid rule override, rule: ->${n}<- cannot be overridden in the grammar: ->${t}<-as it is not defined in any of the super grammars `,i.push({message:r,type:Mr.INVALID_RULE_OVERRIDE,ruleName:n})),i}function TB(n,e,t,i=[]){const r=[],s=Tm(e.definition);if(Fn(s))return[];{const a=n.name;Dr(s,n)&&r.push({message:t.buildLeftRecursionError({topLevelRule:n,leftRecursionPath:i}),type:Mr.LEFT_RECURSION,ruleName:a});const l=N1(s,i.concat([n])),c=zs(l,u=>{const h=cr(i);return h.push(u),TB(n,u,t,h)});return r.concat(c)}}function Tm(n){let e=[];if(Fn(n))return e;const t=ma(n);if(t instanceof ds)e.push(t.referencedRule);else if(t instanceof Yr||t instanceof Vr||t instanceof oo||t instanceof lo||t instanceof Ea||t instanceof Bi)e=e.concat(Tm(t.definition));else if(t instanceof Sa)e=ua(pt(t.definition,s=>Tm(s.definition)));else if(!(t instanceof ei))throw Error("non exhaustive match");const i=p2(t),r=n.length>1;if(i&&r){const s=Xi(n);return e.concat(Tm(s))}else return e}class U8 extends Ef{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function ule(n,e){const t=new U8;n.accept(t);const i=t.alternations;return zs(i,s=>{const a=i0(s.definition);return zs(a,(o,l)=>{const c=xB([o],[],V0,1);return Fn(c)?[{message:e.buildEmptyAlternationError({topLevelRule:n,alternation:s,emptyChoiceIdx:l}),type:Mr.NONE_LAST_EMPTY_ALT,ruleName:n.name,occurrence:s.idx,alternative:l+1}]:[]})})}function hle(n,e,t){const i=new U8;n.accept(i);let r=i.alternations;return r=G1(r,a=>a.ignoreAmbiguities===!0),zs(r,a=>{const o=a.idx,l=a.maxLookahead||e,c=P8(o,n,l,a),u=gle(c,a,n,t),h=mle(c,a,n,t);return u.concat(h)})}class fle extends Ef{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}}function dle(n,e){const t=new U8;n.accept(t);const i=t.alternations;return zs(i,s=>s.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:n,alternation:s}),type:Mr.TOO_MANY_ALTS,ruleName:n.name,occurrence:s.idx}]:[])}function ple(n,e,t){const i=[];return wt(n,r=>{const s=new fle;r.accept(s);const a=s.allProductions;wt(a,o=>{const l=_B(o),c=o.maxLookahead||e,u=o.idx,f=L8(u,r,l,c)[0];if(Fn(ua(f))){const p=t.buildEmptyRepetitionError({topLevelRule:r,repetition:o});i.push({message:p,type:Mr.NO_NON_EMPTY_LOOKAHEAD,ruleName:r.name})}})}),i}function gle(n,e,t,i){const r=[],s=fs(n,(o,l,c)=>(e.definition[c].ignoreAmbiguities===!0||wt(l,u=>{const h=[c];wt(n,(f,p)=>{c!==p&&o6(f,u)&&e.definition[p].ignoreAmbiguities!==!0&&h.push(p)}),h.length>1&&!o6(r,u)&&(r.push(u),o.push({alts:h,path:u}))}),o),[]);return pt(s,o=>{const l=pt(o.alts,u=>u+1);return{message:i.buildAlternationAmbiguityError({topLevelRule:t,alternation:e,ambiguityIndices:l,prefixPath:o.path}),type:Mr.AMBIGUOUS_ALTS,ruleName:t.name,occurrence:e.idx,alternatives:o.alts}})}function mle(n,e,t,i){const r=fs(n,(a,o,l)=>{const c=pt(o,u=>({idx:l,path:u}));return a.concat(c)},[]);return Q0(zs(r,a=>{if(e.definition[a.idx].ignoreAmbiguities===!0)return[];const l=a.idx,c=a.path,u=js(r,f=>e.definition[f.idx].ignoreAmbiguities!==!0&&f.idx<l&&nle(f.path,c));return pt(u,f=>{const p=[f.idx+1,l+1],m=e.idx===0?"":e.idx;return{message:i.buildAlternationPrefixAmbiguityError({topLevelRule:t,alternation:e,ambiguityIndices:p,prefixPath:f.path}),type:Mr.AMBIGUOUS_PREFIX_ALTS,ruleName:t.name,occurrence:m,alternatives:p}})}))}function Ale(n,e,t){const i=[],r=pt(e,s=>s.name);return wt(n,s=>{const a=s.name;if(Dr(r,a)){const o=t.buildNamespaceConflictError(s);i.push({message:o,type:Mr.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:a})}}),i}function vle(n){const e=I8(n,{errMsgProvider:Qoe}),t={};return wt(n.rules,i=>{t[i.name]=i}),Hoe(t,e.errMsgProvider)}function yle(n){return n=I8(n,{errMsgProvider:Xc}),rle(n.rules,n.tokenTypes,n.errMsgProvider,n.grammarName)}const bB="MismatchedTokenException",IB="NoViableAltException",MB="EarlyExitException",RB="NotAllInputParsedException",BB=[bB,IB,MB,RB];Object.freeze(BB);function y2(n){return Dr(BB,n.name)}class V1 extends Error{constructor(e,t){super(e),this.token=t,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class DB extends V1{constructor(e,t,i){super(e,t),this.previousToken=i,this.name=bB}}class xle extends V1{constructor(e,t,i){super(e,t),this.previousToken=i,this.name=IB}}class _le extends V1{constructor(e,t){super(e,t),this.name=RB}}class Ele extends V1{constructor(e,t,i){super(e,t),this.previousToken=i,this.name=MB}}const A5={},PB="InRuleRecoveryException";class Sle extends Error{constructor(e){super(e),this.name=PB}}class wle{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=_t(e,"recoveryEnabled")?e.recoveryEnabled:Vl.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=Cle)}getTokenToInsert(e){const t=D8(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,i,r){const s=this.findReSyncTokenType(),a=this.exportLexerState(),o=[];let l=!1;const c=this.LA(1);let u=this.LA(1);const h=()=>{const f=this.LA(0),p=this.errorMessageProvider.buildMismatchTokenMessage({expected:r,actual:c,previous:f,ruleName:this.getCurrRuleFullName()}),m=new DB(p,c,this.LA(0));m.resyncedTokens=i0(o),this.SAVE_ERROR(m)};for(;!l;)if(this.tokenMatcher(u,r)){h();return}else if(i.call(this)){h(),e.apply(this,t);return}else this.tokenMatcher(u,s)?l=!0:(u=this.SKIP_TOKEN(),this.addToResyncTokens(u,o));this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,t,i){return!(i===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))}getFollowsForInRuleRecovery(e,t){const i=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(i)}tryInRuleRecovery(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){const i=this.SKIP_TOKEN();return this.consumeToken(),i}throw new Sle("sad sad panda")}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e)||Fn(t))return!1;const i=this.LA(1);return af(t,s=>this.tokenMatcher(i,s))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){const t=this.getCurrFollowKey(),i=this.getFollowSetFromFollowKey(t);return Dr(i,e)}findReSyncTokenType(){const e=this.flattenFollowSet();let t=this.LA(1),i=2;for(;;){const r=af(e,s=>zoe(t,s));if(r!==void 0)return r;t=this.LA(i),i++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return A5;const e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),i=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(i)}}buildFullFollowKeyStack(){const e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK;return pt(e,(i,r)=>r===0?A5:{ruleName:this.shortRuleNameToFullName(i),idxInCallingRule:t[r],inRule:this.shortRuleNameToFullName(e[r-1])})}flattenFollowSet(){const e=pt(this.buildFullFollowKeyStack(),t=>this.getFollowSetFromFollowKey(t));return ua(e)}getFollowSetFromFollowKey(e){if(e===A5)return[gu];const t=e.ruleName+e.idxInCallingRule+lB+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,gu)||t.push(e),t}reSyncTo(e){const t=[];let i=this.LA(1);for(;this.tokenMatcher(i,e)===!1;)i=this.SKIP_TOKEN(),this.addToResyncTokens(i,t);return i0(t)}attemptInRepetitionRecovery(e,t,i,r,s,a,o){}getCurrentGrammarPath(e,t){const i=this.getHumanReadableRuleStack(),r=cr(this.RULE_OCCURRENCE_STACK);return{ruleStack:i,occurrenceStack:r,lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){return pt(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}}function Cle(n,e,t,i,r,s,a){const o=this.getKeyForAutomaticLookahead(i,r);let l=this.firstAfterRepMap[o];if(l===void 0){const f=this.getCurrRuleFullName(),p=this.getGAstProductions()[f];l=new s(p,r).startWalking(),this.firstAfterRepMap[o]=l}let c=l.token,u=l.occurrence;const h=l.isEndOfRule;this.RULE_STACK.length===1&&h&&c===void 0&&(c=gu,u=1),!(c===void 0||u===void 0)&&this.shouldInRepetitionRecoveryBeTried(c,u,a)&&this.tryInRepetitionRecovery(n,e,t,c)}const Tle=4,tc=8,LB=1<<tc,UB=2<<tc,l6=3<<tc,c6=4<<tc,u6=5<<tc,bm=6<<tc;function v5(n,e,t){return t|e|n}class ble{constructor(e){var t;this.maxLookahead=(t=e==null?void 0:e.maxLookahead)!==null&&t!==void 0?t:Vl.maxLookahead}validate(e){const t=this.validateNoLeftRecursion(e.rules);if(Fn(t)){const i=this.validateEmptyOrAlternatives(e.rules),r=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),s=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...t,...i,...r,...s]}return t}validateNoLeftRecursion(e){return zs(e,t=>TB(t,t,Xc))}validateEmptyOrAlternatives(e){return zs(e,t=>ule(t,Xc))}validateAmbiguousAlternationAlternatives(e,t){return zs(e,i=>hle(i,t,Xc))}validateSomeNonEmptyLookaheadPath(e,t){return ple(e,t,Xc)}buildLookaheadForAlternation(e){return Koe(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,Joe)}buildLookaheadForOptional(e){return $oe(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,_B(e.prodType),Zoe)}}class Ile{initLooksAhead(e){this.dynamicTokensEnabled=_t(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Vl.dynamicTokensEnabled,this.maxLookahead=_t(e,"maxLookahead")?e.maxLookahead:Vl.maxLookahead,this.lookaheadStrategy=_t(e,"lookaheadStrategy")?e.lookaheadStrategy:new ble({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){wt(e,t=>{this.TRACE_INIT(`${t.name} Rule Lookahead`,()=>{const{alternation:i,repetition:r,option:s,repetitionMandatory:a,repetitionMandatoryWithSeparator:o,repetitionWithSeparator:l}=Rle(t);wt(i,c=>{const u=c.idx===0?"":c.idx;this.TRACE_INIT(`${Ga(c)}${u}`,()=>{const h=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:c.idx,rule:t,maxLookahead:c.maxLookahead||this.maxLookahead,hasPredicates:c.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),f=v5(this.fullRuleNameToShort[t.name],LB,c.idx);this.setLaFuncCache(f,h)})}),wt(r,c=>{this.computeLookaheadFunc(t,c.idx,l6,"Repetition",c.maxLookahead,Ga(c))}),wt(s,c=>{this.computeLookaheadFunc(t,c.idx,UB,"Option",c.maxLookahead,Ga(c))}),wt(a,c=>{this.computeLookaheadFunc(t,c.idx,c6,"RepetitionMandatory",c.maxLookahead,Ga(c))}),wt(o,c=>{this.computeLookaheadFunc(t,c.idx,bm,"RepetitionMandatoryWithSeparator",c.maxLookahead,Ga(c))}),wt(l,c=>{this.computeLookaheadFunc(t,c.idx,u6,"RepetitionWithSeparator",c.maxLookahead,Ga(c))})})})}computeLookaheadFunc(e,t,i,r,s,a){this.TRACE_INIT(`${a}${t===0?"":t}`,()=>{const o=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:s||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:r}),l=v5(this.fullRuleNameToShort[e.name],i,t);this.setLaFuncCache(l,o)})}getKeyForAutomaticLookahead(e,t){const i=this.getLastExplicitRuleShortName();return v5(i,e,t)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,t){this.lookAheadFuncsCache.set(e,t)}}class Mle extends Ef{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}}const em=new Mle;function Rle(n){em.reset(),n.accept(em);const e=em.dslMethods;return em.reset(),e}function lw(n,e){isNaN(n.startOffset)===!0?(n.startOffset=e.startOffset,n.endOffset=e.endOffset):n.endOffset<e.endOffset&&(n.endOffset=e.endOffset)}function cw(n,e){isNaN(n.startOffset)===!0?(n.startOffset=e.startOffset,n.startColumn=e.startColumn,n.startLine=e.startLine,n.endOffset=e.endOffset,n.endColumn=e.endColumn,n.endLine=e.endLine):n.endOffset<e.endOffset&&(n.endOffset=e.endOffset,n.endColumn=e.endColumn,n.endLine=e.endLine)}function Ble(n,e,t){n.children[t]===void 0?n.children[t]=[e]:n.children[t].push(e)}function Dle(n,e,t){n.children[e]===void 0?n.children[e]=[t]:n.children[e].push(t)}const Ple="name";function OB(n,e){Object.defineProperty(n,Ple,{enumerable:!1,configurable:!0,writable:!1,value:e})}function Lle(n,e){const t=us(n),i=t.length;for(let r=0;r<i;r++){const s=t[r],a=n[s],o=a.length;for(let l=0;l<o;l++){const c=a[l];c.tokenTypeIdx===void 0&&this[c.name](c.children,e)}}}function Ule(n,e){const t=function(){};OB(t,n+"BaseSemantics");const i={visit:function(r,s){if(an(r)&&(r=r[0]),!Wo(r))return this[r.name](r.children,s)},validateVisitor:function(){const r=Fle(this,e);if(!Fn(r)){const s=pt(r,a=>a.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
${s.join(`
`).replace(/\n/g,`
`)}`)}}};return t.prototype=i,t.prototype.constructor=t,t._RULE_NAMES=e,t}function Ole(n,e,t){const i=function(){};OB(i,n+"BaseSemanticsWithDefaults");const r=Object.create(t.prototype);return wt(e,s=>{r[s]=Lle}),i.prototype=r,i.prototype.constructor=i,i}var h6;(function(n){n[n.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",n[n.MISSING_METHOD=1]="MISSING_METHOD"})(h6||(h6={}));function Fle(n,e){return kle(n,e)}function kle(n,e){const t=js(e,r=>Jo(n[r])===!1),i=pt(t,r=>({msg:`Missing visitor method: <${r}> on ${n.constructor.name} CST Visitor.`,type:h6.MISSING_METHOD,methodName:r}));return Q0(i)}class Nle{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=_t(e,"nodeLocationTracking")?e.nodeLocationTracking:Vl.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=Ti,this.cstFinallyStateUpdate=Ti,this.cstPostTerminal=Ti,this.cstPostNonTerminal=Ti,this.cstPostRule=Ti;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=cw,this.setNodeLocationFromNode=cw,this.cstPostRule=Ti,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=Ti,this.setNodeLocationFromNode=Ti,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=lw,this.setNodeLocationFromNode=lw,this.cstPostRule=Ti,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=Ti,this.setNodeLocationFromNode=Ti,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=Ti,this.setNodeLocationFromNode=Ti,this.cstPostRule=Ti,this.setInitialNodeLocation=Ti;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){const t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){const t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){const t=this.LA(0),i=e.location;i.startOffset<=t.startOffset?(i.endOffset=t.endOffset,i.endLine=t.endLine,i.endColumn=t.endColumn):(i.startOffset=NaN,i.startLine=NaN,i.startColumn=NaN)}cstPostRuleOnlyOffset(e){const t=this.LA(0),i=e.location;i.startOffset<=t.startOffset?i.endOffset=t.endOffset:i.startOffset=NaN}cstPostTerminal(e,t){const i=this.CST_STACK[this.CST_STACK.length-1];Ble(i,t,e),this.setNodeLocationFromToken(i.location,t)}cstPostNonTerminal(e,t){const i=this.CST_STACK[this.CST_STACK.length-1];Dle(i,t,e),this.setNodeLocationFromNode(i.location,e.location)}getBaseCstVisitorConstructor(){if(Wo(this.baseCstVisitorConstructor)){const e=Ule(this.className,us(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(Wo(this.baseCstVisitorWithDefaultsConstructor)){const e=Ole(this.className,us(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){const e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}}class Gle{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):_2}LA(e){const t=this.currIdx+e;return t<0||this.tokVectorLength<=t?_2:this.tokVector[t]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}}class zle{ACTION(e){return e.call(this)}consume(e,t,i){return this.consumeInternal(t,e,i)}subrule(e,t,i){return this.subruleInternal(t,e,i)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(e,t)}atLeastOne(e,t){return this.atLeastOneInternal(e,t)}CONSUME(e,t){return this.consumeInternal(e,0,t)}CONSUME1(e,t){return this.consumeInternal(e,1,t)}CONSUME2(e,t){return this.consumeInternal(e,2,t)}CONSUME3(e,t){return this.consumeInternal(e,3,t)}CONSUME4(e,t){return this.consumeInternal(e,4,t)}CONSUME5(e,t){return this.consumeInternal(e,5,t)}CONSUME6(e,t){return this.consumeInternal(e,6,t)}CONSUME7(e,t){return this.consumeInternal(e,7,t)}CONSUME8(e,t){return this.consumeInternal(e,8,t)}CONSUME9(e,t){return this.consumeInternal(e,9,t)}SUBRULE(e,t){return this.subruleInternal(e,0,t)}SUBRULE1(e,t){return this.subruleInternal(e,1,t)}SUBRULE2(e,t){return this.subruleInternal(e,2,t)}SUBRULE3(e,t){return this.subruleInternal(e,3,t)}SUBRULE4(e,t){return this.subruleInternal(e,4,t)}SUBRULE5(e,t){return this.subruleInternal(e,5,t)}SUBRULE6(e,t){return this.subruleInternal(e,6,t)}SUBRULE7(e,t){return this.subruleInternal(e,7,t)}SUBRULE8(e,t){return this.subruleInternal(e,8,t)}SUBRULE9(e,t){return this.subruleInternal(e,9,t)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,t,i=E2){if(Dr(this.definedRulesNames,e)){const a={message:Xc.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:Mr.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(a)}this.definedRulesNames.push(e);const r=this.defineRule(e,t,i);return this[e]=r,r}OVERRIDE_RULE(e,t,i=E2){const r=cle(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(r);const s=this.defineRule(e,t,i);return this[e]=s,s}BACKTRACK(e,t){return function(){this.isBackTrackingStack.push(1);const i=this.saveRecogState();try{return e.apply(this,t),!0}catch(r){if(y2(r))return!1;throw r}finally{this.reloadRecogState(i),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Hae(Ii(this.gastProductionsCache))}}class Qle{initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=v2,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},_t(t,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
For Further details.`);if(an(e)){if(Fn(e))throw Error(`A Token Vocabulary cannot be empty.
Note that the first argument for the parser constructor
is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
For Further details.`)}if(an(e))this.tokensMap=fs(e,(s,a)=>(s[a.name]=a,s),{});else if(_t(e,"modes")&&ha(ua(Ii(e.modes)),Foe)){const s=ua(Ii(e.modes)),a=M8(s);this.tokensMap=fs(a,(o,l)=>(o[l.name]=l,o),{})}else if(Ys(e))this.tokensMap=cr(e);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=gu;const i=_t(e,"modes")?ua(Ii(e.modes)):Ii(e),r=ha(i,s=>Fn(s.categoryMatches));this.tokenMatcher=r?v2:V0,W0(Ii(this.tokensMap))}defineRule(e,t,i){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const r=_t(i,"resyncEnabled")?i.resyncEnabled:E2.resyncEnabled,s=_t(i,"recoveryValueFunc")?i.recoveryValueFunc:E2.recoveryValueFunc,a=this.ruleShortNameIdx<<Tle+tc;this.ruleShortNameIdx++,this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;let o;return this.outputCst===!0?o=function(...u){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,u);const h=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(h),h}catch(h){return this.invokeRuleCatch(h,r,s)}finally{this.ruleFinallyStateUpdate()}}:o=function(...u){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,u)}catch(h){return this.invokeRuleCatch(h,r,s)}finally{this.ruleFinallyStateUpdate()}},Object.assign(o,{ruleName:e,originalGrammarAction:t})}invokeRuleCatch(e,t,i){const r=this.RULE_STACK.length===1,s=t&&!this.isBackTracking()&&this.recoveryEnabled;if(y2(e)){const a=e;if(s){const o=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(o))if(a.resyncedTokens=this.reSyncTo(o),this.outputCst){const l=this.CST_STACK[this.CST_STACK.length-1];return l.recoveredNode=!0,l}else return i(e);else{if(this.outputCst){const l=this.CST_STACK[this.CST_STACK.length-1];l.recoveredNode=!0,a.partialCstResult=l}throw a}}else{if(r)return this.moveToTerminatedState(),i(e);throw a}}else throw e}optionInternal(e,t){const i=this.getKeyForAutomaticLookahead(UB,t);return this.optionInternalLogic(e,t,i)}optionInternalLogic(e,t,i){let r=this.getLaFuncFromCache(i),s;if(typeof e!="function"){s=e.DEF;const a=e.GATE;if(a!==void 0){const o=r;r=()=>a.call(this)&&o.call(this)}}else s=e;if(r.call(this)===!0)return s.call(this)}atLeastOneInternal(e,t){const i=this.getKeyForAutomaticLookahead(c6,e);return this.atLeastOneInternalLogic(e,t,i)}atLeastOneInternalLogic(e,t,i){let r=this.getLaFuncFromCache(i),s;if(typeof t!="function"){s=t.DEF;const a=t.GATE;if(a!==void 0){const o=r;r=()=>a.call(this)&&o.call(this)}}else s=t;if(r.call(this)===!0){let a=this.doSingleRepetition(s);for(;r.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s)}else throw this.raiseEarlyExitException(e,ai.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],r,c6,e,Xoe)}atLeastOneSepFirstInternal(e,t){const i=this.getKeyForAutomaticLookahead(bm,e);this.atLeastOneSepFirstInternalLogic(e,t,i)}atLeastOneSepFirstInternalLogic(e,t,i){const r=t.DEF,s=t.SEP;if(this.getLaFuncFromCache(i).call(this)===!0){r.call(this);const o=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,o,r,aw],o,bm,e,aw)}else throw this.raiseEarlyExitException(e,ai.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)}manyInternal(e,t){const i=this.getKeyForAutomaticLookahead(l6,e);return this.manyInternalLogic(e,t,i)}manyInternalLogic(e,t,i){let r=this.getLaFuncFromCache(i),s;if(typeof t!="function"){s=t.DEF;const o=t.GATE;if(o!==void 0){const l=r;r=()=>o.call(this)&&l.call(this)}}else s=t;let a=!0;for(;r.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],r,l6,e,qoe,a)}manySepFirstInternal(e,t){const i=this.getKeyForAutomaticLookahead(u6,e);this.manySepFirstInternalLogic(e,t,i)}manySepFirstInternalLogic(e,t,i){const r=t.DEF,s=t.SEP;if(this.getLaFuncFromCache(i).call(this)===!0){r.call(this);const o=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,o,r,sw],o,u6,e,sw)}}repetitionSepSecondInternal(e,t,i,r,s){for(;i();)this.CONSUME(t),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,i,r,s],i,bm,e,s)}doSingleRepetition(e){const t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){const i=this.getKeyForAutomaticLookahead(LB,t),r=an(e)?e:e.DEF,a=this.getLaFuncFromCache(i).call(this,r);if(a!==void 0)return r[a].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){const e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new _le(t,e))}}subruleInternal(e,t,i){let r;try{const s=i!==void 0?i.ARGS:void 0;return this.subruleIdx=t,r=e.apply(this,s),this.cstPostNonTerminal(r,i!==void 0&&i.LABEL!==void 0?i.LABEL:e.ruleName),r}catch(s){throw this.subruleInternalError(s,i,e.ruleName)}}subruleInternalError(e,t,i){throw y2(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:i),delete e.partialCstResult),e}consumeInternal(e,t,i){let r;try{const s=this.LA(1);this.tokenMatcher(s,e)===!0?(this.consumeToken(),r=s):this.consumeInternalError(e,s,i)}catch(s){r=this.consumeInternalRecovery(e,t,s)}return this.cstPostTerminal(i!==void 0&&i.LABEL!==void 0?i.LABEL:e.name,r),r}consumeInternalError(e,t,i){let r;const s=this.LA(0);throw i!==void 0&&i.ERR_MSG?r=i.ERR_MSG:r=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:s,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new DB(r,t,s))}consumeInternalRecovery(e,t,i){if(this.recoveryEnabled&&i.name==="MismatchedTokenException"&&!this.isBackTracking()){const r=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,r)}catch(s){throw s.name===PB?i:s}}else throw i}saveRecogState(){const e=this.errors,t=cr(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,t,i){this.RULE_OCCURRENCE_STACK.push(i),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){const e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),gu)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}}class Hle{initErrorHandler(e){this._errors=[],this.errorMessageProvider=_t(e,"errorMessageProvider")?e.errorMessageProvider:Vl.errorMessageProvider}SAVE_ERROR(e){if(y2(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:cr(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return cr(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,t,i){const r=this.getCurrRuleFullName(),s=this.getGAstProductions()[r],o=L8(e,s,t,this.maxLookahead)[0],l=[];for(let u=1;u<=this.maxLookahead;u++)l.push(this.LA(u));const c=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:o,actual:l,previous:this.LA(0),customUserDescription:i,ruleName:r});throw this.SAVE_ERROR(new Ele(c,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){const i=this.getCurrRuleFullName(),r=this.getGAstProductions()[i],s=P8(e,r,this.maxLookahead),a=[];for(let c=1;c<=this.maxLookahead;c++)a.push(this.LA(c));const o=this.LA(0),l=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:a,previous:o,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new xle(l,this.LA(1),o))}}class Vle{initContentAssist(){}computeContentAssist(e,t){const i=this.gastProductionsCache[e];if(Wo(i))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return xB([i],t,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const t=ma(e.ruleStack),r=this.getGAstProductions()[t];return new Yoe(r,e).startWalking()}}const W1={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(W1);const uw=!0,hw=Math.pow(2,tc)-1,FB=vB({name:"RECORDING_PHASE_TOKEN",pattern:Qs.NA});W0([FB]);const kB=D8(FB,`This IToken indicates the Parser is in Recording Phase
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(kB);const Wle={name:`This CSTNode indicates the Parser is in Recording Phase
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class Yle{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){const t=e>0?e:"";this[`CONSUME${t}`]=function(i,r){return this.consumeInternalRecord(i,e,r)},this[`SUBRULE${t}`]=function(i,r){return this.subruleInternalRecord(i,e,r)},this[`OPTION${t}`]=function(i){return this.optionInternalRecord(i,e)},this[`OR${t}`]=function(i){return this.orInternalRecord(i,e)},this[`MANY${t}`]=function(i){this.manyInternalRecord(e,i)},this[`MANY_SEP${t}`]=function(i){this.manySepFirstInternalRecord(e,i)},this[`AT_LEAST_ONE${t}`]=function(i){this.atLeastOneInternalRecord(e,i)},this[`AT_LEAST_ONE_SEP${t}`]=function(i){this.atLeastOneSepFirstInternalRecord(e,i)}}this.consume=function(e,t,i){return this.consumeInternalRecord(t,e,i)},this.subrule=function(e,t,i){return this.subruleInternalRecord(t,e,i)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{const e=this;for(let t=0;t<10;t++){const i=t>0?t:"";delete e[`CONSUME${i}`],delete e[`SUBRULE${i}`],delete e[`OPTION${i}`],delete e[`OR${i}`],delete e[`MANY${i}`],delete e[`MANY_SEP${i}`],delete e[`AT_LEAST_ONE${i}`],delete e[`AT_LEAST_ONE_SEP${i}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return _2}topLevelRuleRecord(e,t){try{const i=new _f({definition:[],name:e});return i.name=e,this.recordingProdStack.push(i),t.call(this),this.recordingProdStack.pop(),i}catch(i){if(i.KNOWN_RECORDER_ERROR!==!0)try{i.message=i.message+`
This error was thrown during the "grammar recording phase" For more info see:
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw i}throw i}}optionInternalRecord(e,t){return Rd.call(this,Vr,e,t)}atLeastOneInternalRecord(e,t){Rd.call(this,oo,t,e)}atLeastOneSepFirstInternalRecord(e,t){Rd.call(this,lo,t,e,uw)}manyInternalRecord(e,t){Rd.call(this,Bi,t,e)}manySepFirstInternalRecord(e,t){Rd.call(this,Ea,t,e,uw)}orInternalRecord(e,t){return qle.call(this,e,t)}subruleInternalRecord(e,t,i){if(x2(t),!e||_t(e,"ruleName")===!1){const o=new Error(`<SUBRULE${fw(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}const r=sf(this.recordingProdStack),s=e.ruleName,a=new ds({idx:t,nonTerminalName:s,label:i==null?void 0:i.LABEL,referencedRule:void 0});return r.definition.push(a),this.outputCst?Wle:W1}consumeInternalRecord(e,t,i){if(x2(t),!mB(e)){const a=new Error(`<CONSUME${fw(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}const r=sf(this.recordingProdStack),s=new ei({idx:t,terminalType:e,label:i==null?void 0:i.LABEL});return r.definition.push(s),kB}}function Rd(n,e,t,i=!1){x2(t);const r=sf(this.recordingProdStack),s=Jo(e)?e:e.DEF,a=new n({definition:[],idx:t});return i&&(a.separator=e.SEP),_t(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(a),s.call(this),r.definition.push(a),this.recordingProdStack.pop(),W1}function qle(n,e){x2(e);const t=sf(this.recordingProdStack),i=an(n)===!1,r=i===!1?n:n.DEF,s=new Sa({definition:[],idx:e,ignoreAmbiguities:i&&n.IGNORE_AMBIGUITIES===!0});_t(n,"MAX_LOOKAHEAD")&&(s.maxLookahead=n.MAX_LOOKAHEAD);const a=rB(r,o=>Jo(o.GATE));return s.hasPredicates=a,t.definition.push(s),wt(r,o=>{const l=new Yr({definition:[]});s.definition.push(l),_t(o,"IGNORE_AMBIGUITIES")?l.ignoreAmbiguities=o.IGNORE_AMBIGUITIES:_t(o,"GATE")&&(l.ignoreAmbiguities=!0),this.recordingProdStack.push(l),o.ALT.call(this),this.recordingProdStack.pop()}),W1}function fw(n){return n===0?"":`${n}`}function x2(n){if(n<0||n>hw){const e=new Error(`Invalid DSL Method idx value: <${n}>
Idx value must be a none negative value smaller than ${hw+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class Xle{initPerformanceTracer(e){if(_t(e,"traceInitPerf")){const t=e.traceInitPerf,i=typeof t=="number";this.traceInitMaxIdent=i?t:1/0,this.traceInitPerf=i?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=Vl.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;const i=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${i}--> <${e}>`);const{time:r,value:s}=aB(t),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${i}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,s}else return t()}}function jle(n,e){e.forEach(t=>{const i=t.prototype;Object.getOwnPropertyNames(i).forEach(r=>{if(r==="constructor")return;const s=Object.getOwnPropertyDescriptor(i,r);s&&(s.get||s.set)?Object.defineProperty(n.prototype,r,s):n.prototype[r]=t.prototype[r]})})}const _2=D8(gu,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(_2);const Vl=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:yB,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),E2=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var Mr;(function(n){n[n.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",n[n.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",n[n.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",n[n.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",n[n.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",n[n.LEFT_RECURSION=5]="LEFT_RECURSION",n[n.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",n[n.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",n[n.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",n[n.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",n[n.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",n[n.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",n[n.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",n[n.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(Mr||(Mr={}));class Y1{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;const t=this.className;this.TRACE_INIT("toFastProps",()=>{oB(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),wt(this.definedRulesNames,r=>{const a=this[r].originalGrammarAction;let o;this.TRACE_INIT(`${r} Rule`,()=>{o=this.topLevelRuleRecord(r,a)}),this.gastProductionsCache[r]=o})}finally{this.disableRecording()}});let i=[];if(this.TRACE_INIT("Grammar Resolving",()=>{i=vle({rules:Ii(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(i)}),this.TRACE_INIT("Grammar Validations",()=>{if(Fn(i)&&this.skipValidations===!1){const r=yle({rules:Ii(this.gastProductionsCache),tokenTypes:Ii(this.tokensMap),errMsgProvider:Xc,grammarName:t}),s=ile({lookaheadStrategy:this.lookaheadStrategy,rules:Ii(this.gastProductionsCache),tokenTypes:Ii(this.tokensMap),grammarName:t});this.definitionErrors=this.definitionErrors.concat(r,s)}}),Fn(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const r=Kae(Ii(this.gastProductionsCache));this.resyncFollows=r}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var r,s;(s=(r=this.lookaheadStrategy).initialize)===null||s===void 0||s.call(r,{rules:Ii(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Ii(this.gastProductionsCache))})),!Y1.DEFER_DEFINITION_ERRORS_HANDLING&&!Fn(this.definitionErrors))throw e=pt(this.definitionErrors,r=>r.message),new Error(`Parser Definition Errors detected:
${e.join(`
-------------------------------
`)}`)})}constructor(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;const i=this;if(i.initErrorHandler(t),i.initLexerAdapter(),i.initLooksAhead(t),i.initRecognizerEngine(e,t),i.initRecoverable(t),i.initTreeBuilder(t),i.initContentAssist(),i.initGastRecorder(t),i.initPerformanceTracer(t),_t(t,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
For further details.`);this.skipValidations=_t(t,"skipValidations")?t.skipValidations:Vl.skipValidations}}Y1.DEFER_DEFINITION_ERRORS_HANDLING=!1;jle(Y1,[wle,Ile,Nle,Gle,Qle,zle,Hle,Vle,Yle,Xle]);class Kle{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const i=this.workersResolve[e];if(i&&i(t),this.queue.length){const{resolve:r,msg:s,transfer:a}=this.queue.shift();this.workersResolve[e]=r,this.workers[e].postMessage(s,a)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(i=>{const r=this._getIdleWorker();r!==-1?(this._initWorker(r),this.workerStatus|=1<<r,this.workersResolve[r]=i,this.workers[r].postMessage(e,t)):this.queue.push({resolve:i,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}class $le extends iu{constructor(e,t,i,r,s,a){super(e,t,i,s,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=oi}}const y5=new WeakMap;let x5=0,_5;const qd=class extends ur{constructor(n){super(n),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new Kle,this.workerSourceURL="",this.workerConfig=null,typeof MSC_TRANSCODER<"u"&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(n){return this.transcoderPath=n,this}setWorkerLimit(n){return this.workerPool.setWorkerLimit(n),this}detectSupport(n){return this.workerConfig={astcSupported:n.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:n.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:n.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:n.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:n.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:n.extensions.has("WEBGL_compressed_texture_pvrtc")||n.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},n.capabilities.isWebGL2&&(this.workerConfig.etc1Supported=!1),this}init(){if(!this.transcoderPending){const n=new Ir(this.manager);n.setPath(this.transcoderPath),n.setWithCredentials(this.withCredentials);const e=n.loadAsync("basis_transcoder.js"),t=new Ir(this.manager);t.setPath(this.transcoderPath),t.setResponseType("arraybuffer"),t.setWithCredentials(this.withCredentials);const i=t.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([e,i]).then(([r,s])=>{const a=qd.BasisWorker.toString(),o=["/* constants */","let _EngineFormat = "+JSON.stringify(qd.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(qd.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(qd.BasisFormat),"/* basis_transcoder.js */",r,"/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join(`
`);this.workerSourceURL=URL.createObjectURL(new Blob([o])),this.transcoderBinary=s,this.workerPool.setWorkerCreator(()=>{const l=new Worker(this.workerSourceURL),c=this.transcoderBinary.slice(0);return l.postMessage({type:"init",config:this.workerConfig,transcoderBinary:c},[c]),l})}),x5>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),x5++}return this.transcoderPending}load(n,e,t,i){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const r=new Ir(this.manager);r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials),r.load(n,s=>{if(y5.has(s))return y5.get(s).promise.then(e).catch(i);this._createTexture(s).then(a=>e?e(a):null).catch(i)},t,i)}_createTextureFrom(n,e){const{mipmaps:t,width:i,height:r,format:s,type:a,error:o,dfdTransferFn:l,dfdFlags:c}=n;if(a==="error")return Promise.reject(o);const u=e.layerCount>1?new $le(t,i,r,e.layerCount,s,Ri):new iu(t,i,r,s,Ri);return u.minFilter=t.length===1?Tn:Ja,u.magFilter=Tn,u.generateMipmaps=!1,u.needsUpdate=!0,"colorSpace"in u?u.colorSpace=l===Ny?"srgb":"srgb-linear":u.encoding=l===Ny?3001:3e3,u.premultiplyAlpha=!!(c&lK),u}async _createTexture(n,e={}){const t=fK(new Uint8Array(n));if(t.vkFormat!==PM)return Zle(t);const i=e,r=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:n,taskConfig:i},[n])).then(s=>this._createTextureFrom(s.data,t));return y5.set(n,{promise:r}),r}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),x5--,this}};let q1=qd;ut(q1,"BasisFormat",{ETC1S:0,UASTC_4x4:1});ut(q1,"TranscoderFormat",{ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16});ut(q1,"EngineFormat",{RGBAFormat:li,RGBA_ASTC_4x4_Format:wp,RGBA_BPTC_Format:Uh,RGBA_ETC2_EAC_Format:Sp,RGBA_PVRTC_4BPPV1_Format:_p,RGBA_S3TC_DXT5_Format:Lh,RGB_ETC1_Format:B2,RGB_ETC2_Format:Ep,RGB_PVRTC_4BPPV1_Format:xp,RGB_S3TC_DXT1_Format:Ph});ut(q1,"BasisWorker",function(){let n,e,t;const i=_EngineFormat,r=_TranscoderFormat,s=_BasisFormat;self.addEventListener("message",function(m){const y=m.data;switch(y.type){case"init":n=y.config,a(y.transcoderBinary);break;case"transcode":e.then(()=>{try{const{width:v,height:A,hasAlpha:_,mipmaps:x,format:E,dfdTransferFn:w,dfdFlags:I}=o(y.buffer),T=[];for(let M=0;M<x.length;++M)T.push(x[M].data.buffer);self.postMessage({type:"transcode",id:y.id,width:v,height:A,hasAlpha:_,mipmaps:x,format:E,dfdTransferFn:w,dfdFlags:I},T)}catch(v){console.error(v),self.postMessage({type:"error",id:y.id,error:v.message})}});break}});function a(m){e=new Promise(y=>{t={wasmBinary:m,onRuntimeInitialized:y},BASIS(t)}).then(()=>{t.initializeBasis(),t.KTX2File===void 0&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")})}function o(m){const y=new t.KTX2File(new Uint8Array(m));function v(){y.close(),y.delete()}if(!y.isValid())throw v(),new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");const A=y.isUASTC()?s.UASTC_4x4:s.ETC1S,_=y.getWidth(),x=y.getHeight(),E=y.getLayers()||1,w=y.getLevels(),I=y.getHasAlpha(),T=y.getDFDTransferFunc(),M=y.getDFDFlags(),{transcoderFormat:b,engineFormat:B}=h(A,_,x,I);if(!_||!x||!w)throw v(),new Error("THREE.KTX2Loader: Invalid texture");if(!y.startTranscoding())throw v(),new Error("THREE.KTX2Loader: .startTranscoding failed");const L=[];for(let U=0;U<w;U++){const O=[];let Q,G;for(let F=0;F<E;F++){const q=y.getImageLevelInfo(U,F,0);Q=q.origWidth<4?q.origWidth:q.width,G=q.origHeight<4?q.origHeight:q.height;const Y=new Uint8Array(y.getImageTranscodedSizeInBytes(U,F,0,b));if(!y.transcodeImage(Y,U,F,0,b,0,-1,-1))throw v(),new Error("THREE.KTX2Loader: .transcodeImage failed.");O.push(Y)}L.push({data:p(O),width:Q,height:G})}return v(),{width:_,height:x,hasAlpha:I,mipmaps:L,format:B,dfdTransferFn:T,dfdFlags:M}}const l=[{if:"astcSupported",basisFormat:[s.UASTC_4x4],transcoderFormat:[r.ASTC_4x4,r.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[r.BC7_M5,r.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[r.BC1,r.BC3],engineFormat:[i.RGB_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[r.ETC1,r.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[r.ETC1],engineFormat:[i.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[r.PVRTC1_4_RGB,r.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],c=l.sort(function(m,y){return m.priorityETC1S-y.priorityETC1S}),u=l.sort(function(m,y){return m.priorityUASTC-y.priorityUASTC});function h(m,y,v,A){let _,x;const E=m===s.ETC1S?c:u;for(let w=0;w<E.length;w++){const I=E[w];if(n[I.if]&&I.basisFormat.includes(m)&&!(A&&I.transcoderFormat.length<2)&&!(I.needsPowerOfTwo&&!(f(y)&&f(v))))return _=I.transcoderFormat[A?1:0],x=I.engineFormat[A?1:0],{transcoderFormat:_,engineFormat:x}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),_=r.RGBA32,x=i.RGBAFormat,{transcoderFormat:_,engineFormat:x}}function f(m){return m<=2?!0:(m&m-1)===0&&m!==0}function p(m){let y=0;for(let _=0;_<m.length;_++){const x=m[_];y+=x.byteLength}const v=new Uint8Array(y);let A=0;for(let _=0;_<m.length;_++){const x=m[_];v.set(x,A),A+=x.byteLength}return v}});const dw={[QM]:li,[NM]:li,[OM]:li,[s8]:li,[zM]:wh,[kM]:wh,[UM]:wh,[r8]:wh,[GM]:Qc,[FM]:Qc,[i8]:Qc,[LM]:Qc},E5={[QM]:br,[NM]:Ai,[OM]:Ri,[s8]:Ri,[zM]:br,[kM]:Ai,[UM]:Ri,[r8]:Ri,[GM]:br,[FM]:Ai,[i8]:Ri,[LM]:Ri},Jle={[s8]:3001,[r8]:3001,[i8]:3001};async function Zle(n){const{vkFormat:e,pixelWidth:t,pixelHeight:i,pixelDepth:r}=n;if(dw[e]===void 0)throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");const s=n.levels[0];let a,o;if(n.supercompressionScheme===DM)a=s.levelData;else if(n.supercompressionScheme===nK)_5||(_5=new Promise(async c=>{const u=new dK;await u.init(),c(u)})),a=(await _5).decode(s.levelData,s.uncompressedByteLength);else throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");E5[e]===br?o=new Float32Array(a.buffer,a.byteOffset,a.byteLength/Float32Array.BYTES_PER_ELEMENT):E5[e]===Ai?o=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/Uint16Array.BYTES_PER_ELEMENT):o=a;const l=r===0?new Va(o,t,i):new See(o,t,i,r);return l.type=E5[e],l.format=dw[e],l.encoding=Jle[e]||3e3,l.needsUpdate=!0,Promise.resolve(l)}const S5=new WeakMap,Xd=class extends ur{constructor(n){super(n),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.workerConfig=null}setTranscoderPath(n){return this.transcoderPath=n,this}setWorkerLimit(n){return this.workerLimit=n,this}detectSupport(n){return this.workerConfig={astcSupported:n.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:n.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:n.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:n.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:n.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:n.extensions.has("WEBGL_compressed_texture_pvrtc")||n.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}load(n,e,t,i){const r=new Ir(this.manager);r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials);const s=new iu;return r.load(n,a=>{if(S5.has(a))return S5.get(a).promise.then(e).catch(i);this._createTexture([a]).then(function(o){s.copy(o),s.needsUpdate=!0,e&&e(s)}).catch(i)},t,i),s}parseInternalAsync(n){const{levels:e}=n,t=new Set;for(let i=0;i<e.length;i++)t.add(e[i].data.buffer);return this._createTexture(Array.from(t),{...n,lowLevel:!0})}_createTexture(n,e={}){let t,i;const r=e;let s=0;for(let o=0;o<n.length;o++)s+=n[o].byteLength;const a=this._allocateWorker(s).then(o=>(t=o,i=this.workerNextTaskID++,new Promise((l,c)=>{t._callbacks[i]={resolve:l,reject:c},t.postMessage({type:"transcode",id:i,buffers:n,taskConfig:r},n)}))).then(o=>{const{mipmaps:l,width:c,height:u,format:h}=o,f=new iu(l,c,u,h,Ri);return f.minFilter=l.length===1?Tn:Ja,f.magFilter=Tn,f.generateMipmaps=!1,f.needsUpdate=!0,f});return a.catch(()=>!0).then(()=>{t&&i&&(t._taskLoad-=s,delete t._callbacks[i])}),S5.set(n[0],{promise:a}),a}_initTranscoder(){if(!this.transcoderPending){const n=new Ir(this.manager);n.setPath(this.transcoderPath),n.setWithCredentials(this.withCredentials);const e=new Promise((r,s)=>{n.load("basis_transcoder.js",r,void 0,s)}),t=new Ir(this.manager);t.setPath(this.transcoderPath),t.setResponseType("arraybuffer"),t.setWithCredentials(this.withCredentials);const i=new Promise((r,s)=>{t.load("basis_transcoder.wasm",r,void 0,s)});this.transcoderPending=Promise.all([e,i]).then(([r,s])=>{const a=Xd.BasisWorker.toString(),o=["/* constants */","let _EngineFormat = "+JSON.stringify(Xd.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(Xd.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Xd.BasisFormat),"/* basis_transcoder.js */",r,"/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join(`
`);this.workerSourceURL=URL.createObjectURL(new Blob([o])),this.transcoderBinary=s})}return this.transcoderPending}_allocateWorker(n){return this._initTranscoder().then(()=>{if(this.workerPool.length<this.workerLimit){const t=new Worker(this.workerSourceURL);t._callbacks={},t._taskLoad=0,t.postMessage({type:"init",config:this.workerConfig,transcoderBinary:this.transcoderBinary}),t.onmessage=function(i){const r=i.data;switch(r.type){case"transcode":t._callbacks[r.id].resolve(r);break;case"error":t._callbacks[r.id].reject(r);break;default:console.error('THREE.BasisTextureLoader: Unexpected message, "'+r.type+'"')}},this.workerPool.push(t)}else this.workerPool.sort(function(t,i){return t._taskLoad>i._taskLoad?-1:1});const e=this.workerPool[this.workerPool.length-1];return e._taskLoad+=n,e})}dispose(){for(let n=0;n<this.workerPool.length;n++)this.workerPool[n].terminate();return this.workerPool.length=0,this}};let X1=Xd;ut(X1,"BasisFormat",{ETC1S:0,UASTC_4x4:1});ut(X1,"TranscoderFormat",{ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16});ut(X1,"EngineFormat",{RGBAFormat:li,RGBA_ASTC_4x4_Format:wp,RGBA_BPTC_Format:Uh,RGBA_ETC2_EAC_Format:Sp,RGBA_PVRTC_4BPPV1_Format:_p,RGBA_S3TC_DXT5_Format:Lh,RGB_ETC1_Format:B2,RGB_ETC2_Format:Ep,RGB_PVRTC_4BPPV1_Format:xp,RGB_S3TC_DXT1_Format:Ph});ut(X1,"BasisWorker",function(){let n,e,t;const i=_EngineFormat,r=_TranscoderFormat,s=_BasisFormat;onmessage=function(_){const x=_.data;switch(x.type){case"init":n=x.config,a(x.transcoderBinary);break;case"transcode":e.then(()=>{try{const{width:E,height:w,hasAlpha:I,mipmaps:T,format:M}=x.taskConfig.lowLevel?o(x.taskConfig):l(x.buffers[0]),b=[];for(let B=0;B<T.length;++B)b.push(T[B].data.buffer);self.postMessage({type:"transcode",id:x.id,width:E,height:w,hasAlpha:I,mipmaps:T,format:M},b)}catch(E){console.error(E),self.postMessage({type:"error",id:x.id,error:E.message})}});break}};function a(_){e=new Promise(x=>{t={wasmBinary:_,onRuntimeInitialized:x},BASIS(t)}).then(()=>{t.initializeBasis()})}function o(_){const{basisFormat:x,width:E,height:w,hasAlpha:I}=_,{transcoderFormat:T,engineFormat:M}=f(x,E,w,I),b=t.getBytesPerBlockOrPixel(T);p(t.isFormatSupported(T),"THREE.BasisTextureLoader: Unsupported format.");const B=[];if(x===s.ETC1S){const L=new t.LowLevelETC1SImageTranscoder,{endpointCount:U,endpointsData:O,selectorCount:Q,selectorsData:G,tablesData:F}=_.globalData;try{let q;q=L.decodePalettes(U,O,Q,G),p(q,"THREE.BasisTextureLoader: decodePalettes() failed."),q=L.decodeTables(F),p(q,"THREE.BasisTextureLoader: decodeTables() failed.");for(let Y=0;Y<_.levels.length;Y++){const H=_.levels[Y],V=_.globalData.imageDescs[Y],D=v(T,H.width,H.height),k=new Uint8Array(D);q=L.transcodeImage(T,k,D/b,H.data,m(T,H.width),y(T,H.height),H.width,H.height,H.index,V.rgbSliceByteOffset,V.rgbSliceByteLength,V.alphaSliceByteOffset,V.alphaSliceByteLength,V.imageFlags,I,!1,0,0),p(q,"THREE.BasisTextureLoader: transcodeImage() failed for level "+H.index+"."),B.push({data:k,width:H.width,height:H.height})}}finally{L.delete()}}else for(let L=0;L<_.levels.length;L++){const U=_.levels[L],O=v(T,U.width,U.height),Q=new Uint8Array(O),G=t.transcodeUASTCImage(T,Q,O/b,U.data,m(T,U.width),y(T,U.height),U.width,U.height,U.index,0,U.data.byteLength,0,I,!1,0,0,-1,-1);p(G,"THREE.BasisTextureLoader: transcodeUASTCImage() failed for level "+U.index+"."),B.push({data:Q,width:U.width,height:U.height})}return{width:E,height:w,hasAlpha:I,mipmaps:B,format:M}}function l(_){const x=new t.BasisFile(new Uint8Array(_)),E=x.isUASTC()?s.UASTC_4x4:s.ETC1S,w=x.getImageWidth(0,0),I=x.getImageHeight(0,0),T=x.getNumLevels(0),M=x.getHasAlpha();function b(){x.close(),x.delete()}const{transcoderFormat:B,engineFormat:L}=f(E,w,I,M);if(!w||!I||!T)throw b(),new Error("THREE.BasisTextureLoader: Invalid texture");if(!x.startTranscoding())throw b(),new Error("THREE.BasisTextureLoader: .startTranscoding failed");const U=[];for(let O=0;O<T;O++){const Q=x.getImageWidth(0,O),G=x.getImageHeight(0,O),F=new Uint8Array(x.getImageTranscodedSizeInBytes(0,O,B));if(!x.transcodeImage(F,0,O,B,0,M))throw b(),new Error("THREE.BasisTextureLoader: .transcodeImage failed.");U.push({data:F,width:Q,height:G})}return b(),{width:w,height:I,hasAlpha:M,mipmaps:U,format:L}}const c=[{if:"astcSupported",basisFormat:[s.UASTC_4x4],transcoderFormat:[r.ASTC_4x4,r.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[r.BC7_M5,r.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[r.BC1,r.BC3],engineFormat:[i.RGB_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[r.ETC1,r.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[r.ETC1,r.ETC1],engineFormat:[i.RGB_ETC1_Format,i.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[r.PVRTC1_4_RGB,r.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],u=c.sort(function(_,x){return _.priorityETC1S-x.priorityETC1S}),h=c.sort(function(_,x){return _.priorityUASTC-x.priorityUASTC});function f(_,x,E,w){let I,T;const M=_===s.ETC1S?u:h;for(let b=0;b<M.length;b++){const B=M[b];if(n[B.if]&&B.basisFormat.includes(_)&&!(B.needsPowerOfTwo&&!(A(x)&&A(E))))return I=B.transcoderFormat[w?1:0],T=B.engineFormat[w?1:0],{transcoderFormat:I,engineFormat:T}}return console.warn("THREE.BasisTextureLoader: No suitable compressed texture format found. Decoding to RGBA32."),I=r.RGBA32,T=i.RGBAFormat,{transcoderFormat:I,engineFormat:T}}function p(_,x){if(!_)throw new Error(x)}function m(_,x){return Math.ceil(x/t.getFormatBlockWidth(_))}function y(_,x){return Math.ceil(x/t.getFormatBlockHeight(_))}function v(_,x,E){const w=t.getBytesPerBlockOrPixel(_);if(t.formatIsUncompressed(_))return x*E*w;if(_===r.PVRTC1_4_RGB||_===r.PVRTC1_4_RGBA){const I=x+3&-4,T=E+3&-4;return(Math.max(8,I)*Math.max(8,T)*4+7)/8}return m(_,x)*y(_,E)*w}function A(_){return _<=2?!0:(_&_-1)===0&&_!==0}});const NB=$.forwardRef(function({follow:e=!0,lockX:t=!1,lockY:i=!1,lockZ:r=!1,...s},a){const o=$.useRef();return a1(({camera:l})=>{if(!e||!o.current)return;const c=o.current.rotation.clone();l.getWorldQuaternion(o.current.quaternion),t&&(o.current.rotation.x=c.x),i&&(o.current.rotation.y=c.y),r&&(o.current.rotation.z=c.z)}),$.createElement("group",ou({ref:zX([o,a])},s))});function ece(){var n=Object.create(null);function e(r,s){var a=r.id,o=r.name,l=r.dependencies;l===void 0&&(l=[]);var c=r.init;c===void 0&&(c=function(){});var u=r.getTransferables;if(u===void 0&&(u=null),!n[a])try{l=l.map(function(f){return f&&f.isWorkerModule&&(e(f,function(p){if(p instanceof Error)throw p}),f=n[f.id].value),f}),c=i("<"+o+">.init",c),u&&(u=i("<"+o+">.getTransferables",u));var h=null;typeof c=="function"?h=c.apply(void 0,l):console.error("worker module init function failed to rehydrate"),n[a]={id:a,value:h,getTransferables:u},s(h)}catch(f){f&&f.noLog||console.error(f),s(f)}}function t(r,s){var a,o=r.id,l=r.args;(!n[o]||typeof n[o].value!="function")&&s(new Error("Worker module "+o+": not found or its 'init' did not return a function"));try{var c=(a=n[o]).value.apply(a,l);c&&typeof c.then=="function"?c.then(u,function(h){return s(h instanceof Error?h:new Error(""+h))}):u(c)}catch(h){s(h)}function u(h){try{var f=n[o].getTransferables&&n[o].getTransferables(h);(!f||!Array.isArray(f)||!f.length)&&(f=void 0),s(h,f)}catch(p){console.error(p),s(p)}}}function i(r,s){var a=void 0;self.troikaDefine=function(l){return a=l};var o=URL.createObjectURL(new Blob(["/** "+r.replace(/\*/g,"")+` **/
troikaDefine(
`+s+`
)`],{type:"application/javascript"}));try{importScripts(o)}catch(l){console.error(l)}return URL.revokeObjectURL(o),delete self.troikaDefine,a}self.addEventListener("message",function(r){var s=r.data,a=s.messageId,o=s.action,l=s.data;try{o==="registerModule"&&e(l,function(c){c instanceof Error?postMessage({messageId:a,success:!1,error:c.message}):postMessage({messageId:a,success:!0,result:{isCallable:typeof c=="function"}})}),o==="callModule"&&t(l,function(c,u){c instanceof Error?postMessage({messageId:a,success:!1,error:c.message}):postMessage({messageId:a,success:!0,result:c},u||void 0)})}catch(c){postMessage({messageId:a,success:!1,error:c.stack})}})}function tce(n){var e=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];return e._getInitResult().then(function(r){if(typeof r=="function")return r.apply(void 0,t);throw new Error("Worker module function was called but `init` did not return a callable function")})};return e._getInitResult=function(){var t=n.dependencies,i=n.init;t=Array.isArray(t)?t.map(function(s){return s&&s._getInitResult?s._getInitResult():s}):[];var r=Promise.all(t).then(function(s){return i.apply(null,s)});return e._getInitResult=function(){return r},r},e}var GB=function(){var n=!1;if(typeof window<"u"&&typeof window.document<"u")try{var e=new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"})));e.terminate(),n=!0}catch(t){typeof process<"u",console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+t.message+"]")}return GB=function(){return n},n},nce=0,ice=0,w5=!1,up=Object.create(null),hp=Object.create(null),f6=Object.create(null);function Y0(n){if((!n||typeof n.init!="function")&&!w5)throw new Error("requires `options.init` function");var e=n.dependencies,t=n.init,i=n.getTransferables,r=n.workerId;if(!GB())return tce(n);r==null&&(r="#default");var s="workerModule"+ ++nce,a=n.name||s,o=null;e=e&&e.map(function(c){return typeof c=="function"&&!c.workerModuleData&&(w5=!0,c=Y0({workerId:r,name:"<"+a+"> function dependency: "+c.name,init:`function(){return (
`+Im(c)+`
)}`}),w5=!1),c&&c.workerModuleData&&(c=c.workerModuleData),c});function l(){for(var c=[],u=arguments.length;u--;)c[u]=arguments[u];if(!o){o=pw(r,"registerModule",l.workerModuleData);var h=function(){o=null,hp[r].delete(h)};(hp[r]||(hp[r]=new Set)).add(h)}return o.then(function(f){var p=f.isCallable;if(p)return pw(r,"callModule",{id:s,args:c});throw new Error("Worker module function was called but `init` did not return a callable function")})}return l.workerModuleData={isWorkerModule:!0,id:s,name:a,dependencies:e,init:Im(t),getTransferables:i&&Im(i)},l}function rce(n){hp[n]&&hp[n].forEach(function(e){e()}),up[n]&&(up[n].terminate(),delete up[n])}function Im(n){var e=n.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function sce(n){var e=up[n];if(!e){var t=Im(ece);e=up[n]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+n.replace(/\*/g,"")+` **/
;(`+t+")()"],{type:"application/javascript"}))),e.onmessage=function(i){var r=i.data,s=r.messageId,a=f6[s];if(!a)throw new Error("WorkerModule response with empty or unknown messageId");delete f6[s],a(r)}}return e}function pw(n,e,t){return new Promise(function(i,r){var s=++ice;f6[s]=function(a){a.success?i(a.result):r(new Error("Error in worker "+e+" call: "+a.error))},sce(n).postMessage({messageId:s,action:e,data:t})})}function zB(){var n=function(e){function t(H,V,D,k,Z,j,ee,ie){var te=1-ee;ie.x=te*te*H+2*te*ee*D+ee*ee*Z,ie.y=te*te*V+2*te*ee*k+ee*ee*j}function i(H,V,D,k,Z,j,ee,ie,te,re){var ce=1-te;re.x=ce*ce*ce*H+3*ce*ce*te*D+3*ce*te*te*Z+te*te*te*ee,re.y=ce*ce*ce*V+3*ce*ce*te*k+3*ce*te*te*j+te*te*te*ie}function r(H,V){for(var D=/([MLQCZ])([^MLQCZ]*)/g,k,Z,j,ee,ie;k=D.exec(H);){var te=k[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(re){return parseFloat(re)});switch(k[1]){case"M":ee=Z=te[0],ie=j=te[1];break;case"L":(te[0]!==ee||te[1]!==ie)&&V("L",ee,ie,ee=te[0],ie=te[1]);break;case"Q":{V("Q",ee,ie,ee=te[2],ie=te[3],te[0],te[1]);break}case"C":{V("C",ee,ie,ee=te[4],ie=te[5],te[0],te[1],te[2],te[3]);break}case"Z":(ee!==Z||ie!==j)&&V("L",ee,ie,Z,j);break}}}function s(H,V,D){D===void 0&&(D=16);var k={x:0,y:0};r(H,function(Z,j,ee,ie,te,re,ce,ye,oe){switch(Z){case"L":V(j,ee,ie,te);break;case"Q":{for(var W=j,ge=ee,he=1;he<D;he++)t(j,ee,re,ce,ie,te,he/(D-1),k),V(W,ge,k.x,k.y),W=k.x,ge=k.y;break}case"C":{for(var ue=j,fe=ee,Pe=1;Pe<D;Pe++)i(j,ee,re,ce,ye,oe,ie,te,Pe/(D-1),k),V(ue,fe,k.x,k.y),ue=k.x,fe=k.y;break}}})}var a="precision highp float;attribute vec2 aUV;varying vec2 vUV;void main(){vUV=aUV;gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",o="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){gl_FragColor=texture2D(tex,vUV);}",l=new WeakMap,c={premultipliedAlpha:!1,preserveDrawingBuffer:!0,antialias:!1,depth:!1};function u(H,V){var D=H.getContext?H.getContext("webgl",c):H,k=l.get(D);if(!k){let ce=function(ue){var fe=j[ue];if(!fe&&(fe=j[ue]=D.getExtension(ue),!fe))throw new Error(ue+" not supported");return fe},ye=function(ue,fe){var Pe=D.createShader(fe);return D.shaderSource(Pe,ue),D.compileShader(Pe),Pe},oe=function(ue,fe,Pe,pe){if(!ee[ue]){var Re={},Le={},Se=D.createProgram();D.attachShader(Se,ye(fe,D.VERTEX_SHADER)),D.attachShader(Se,ye(Pe,D.FRAGMENT_SHADER)),D.linkProgram(Se),ee[ue]={program:Se,transaction:function(X){D.useProgram(Se),X({setUniform:function(se,Be){for(var Ce=[],we=arguments.length-2;we-- >0;)Ce[we]=arguments[we+2];var ke=Le[Be]||(Le[Be]=D.getUniformLocation(Se,Be));D["uniform"+se].apply(D,[ke].concat(Ce))},setAttribute:function(se,Be,Ce,we,ke){var Ue=Re[se];Ue||(Ue=Re[se]={buf:D.createBuffer(),loc:D.getAttribLocation(Se,se),data:null}),D.bindBuffer(D.ARRAY_BUFFER,Ue.buf),D.vertexAttribPointer(Ue.loc,Be,D.FLOAT,!1,0,0),D.enableVertexAttribArray(Ue.loc),Z?D.vertexAttribDivisor(Ue.loc,we):ce("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(Ue.loc,we),ke!==Ue.data&&(D.bufferData(D.ARRAY_BUFFER,ke,Ce),Ue.data=ke)}})}}}ee[ue].transaction(pe)},W=function(ue,fe){te++;try{D.activeTexture(D.TEXTURE0+te);var Pe=ie[ue];Pe||(Pe=ie[ue]=D.createTexture(),D.bindTexture(D.TEXTURE_2D,Pe),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_MIN_FILTER,D.NEAREST),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_MAG_FILTER,D.NEAREST)),D.bindTexture(D.TEXTURE_2D,Pe),fe(Pe,te)}finally{te--}},ge=function(ue,fe,Pe){var pe=D.createFramebuffer();re.push(pe),D.bindFramebuffer(D.FRAMEBUFFER,pe),D.activeTexture(D.TEXTURE0+fe),D.bindTexture(D.TEXTURE_2D,ue),D.framebufferTexture2D(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,D.TEXTURE_2D,ue,0);try{Pe(pe)}finally{D.deleteFramebuffer(pe),D.bindFramebuffer(D.FRAMEBUFFER,re[--re.length-1]||null)}},he=function(){j={},ee={},ie={},te=-1,re.length=0};var Z=typeof WebGL2RenderingContext<"u"&&D instanceof WebGL2RenderingContext,j={},ee={},ie={},te=-1,re=[];D.canvas.addEventListener("webglcontextlost",function(ue){he(),ue.preventDefault()},!1),l.set(D,k={gl:D,isWebGL2:Z,getExtension:ce,withProgram:oe,withTexture:W,withTextureFramebuffer:ge,handleContextLoss:he})}V(k)}function h(H,V,D,k,Z,j,ee,ie){ee===void 0&&(ee=15),ie===void 0&&(ie=null),u(H,function(te){var re=te.gl,ce=te.withProgram,ye=te.withTexture;ye("copy",function(oe,W){re.texImage2D(re.TEXTURE_2D,0,re.RGBA,Z,j,0,re.RGBA,re.UNSIGNED_BYTE,V),ce("copy",a,o,function(ge){var he=ge.setUniform,ue=ge.setAttribute;ue("aUV",2,re.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),he("1i","image",W),re.bindFramebuffer(re.FRAMEBUFFER,ie||null),re.disable(re.BLEND),re.colorMask(ee&8,ee&4,ee&2,ee&1),re.viewport(D,k,Z,j),re.scissor(D,k,Z,j),re.drawArrays(re.TRIANGLES,0,3)})})})}function f(H,V,D){var k=H.width,Z=H.height;u(H,function(j){var ee=j.gl,ie=new Uint8Array(k*Z*4);ee.readPixels(0,0,k,Z,ee.RGBA,ee.UNSIGNED_BYTE,ie),H.width=V,H.height=D,h(ee,ie,0,0,k,Z)})}var p=Object.freeze({__proto__:null,withWebGLContext:u,renderImageData:h,resizeWebGLCanvasWithoutClearing:f});function m(H,V,D,k,Z,j){j===void 0&&(j=1);var ee=new Uint8Array(H*V),ie=k[2]-k[0],te=k[3]-k[1],re=[];s(D,function(ue,fe,Pe,pe){re.push({x1:ue,y1:fe,x2:Pe,y2:pe,minX:Math.min(ue,Pe),minY:Math.min(fe,pe),maxX:Math.max(ue,Pe),maxY:Math.max(fe,pe)})}),re.sort(function(ue,fe){return ue.maxX-fe.maxX});for(var ce=0;ce<H;ce++)for(var ye=0;ye<V;ye++){var oe=ge(k[0]+ie*(ce+.5)/H,k[1]+te*(ye+.5)/V),W=Math.pow(1-Math.abs(oe)/Z,j)/2;oe<0&&(W=1-W),W=Math.max(0,Math.min(255,Math.round(W*255))),ee[ye*H+ce]=W}return ee;function ge(ue,fe){for(var Pe=1/0,pe=1/0,Re=re.length;Re--;){var Le=re[Re];if(Le.maxX+pe<=ue)break;if(ue+pe>Le.minX&&fe-pe<Le.maxY&&fe+pe>Le.minY){var Se=A(ue,fe,Le.x1,Le.y1,Le.x2,Le.y2);Se<Pe&&(Pe=Se,pe=Math.sqrt(Pe))}}return he(ue,fe)&&(pe=-pe),pe}function he(ue,fe){for(var Pe=0,pe=re.length;pe--;){var Re=re[pe];if(Re.maxX<=ue)break;var Le=Re.y1>fe!=Re.y2>fe&&ue<(Re.x2-Re.x1)*(fe-Re.y1)/(Re.y2-Re.y1)+Re.x1;Le&&(Pe+=Re.y1<Re.y2?1:-1)}return Pe!==0}}function y(H,V,D,k,Z,j,ee,ie,te,re){j===void 0&&(j=1),ie===void 0&&(ie=0),te===void 0&&(te=0),re===void 0&&(re=0),v(H,V,D,k,Z,j,ee,null,ie,te,re)}function v(H,V,D,k,Z,j,ee,ie,te,re,ce){j===void 0&&(j=1),te===void 0&&(te=0),re===void 0&&(re=0),ce===void 0&&(ce=0);for(var ye=m(H,V,D,k,Z,j),oe=new Uint8Array(ye.length*4),W=0;W<ye.length;W++)oe[W*4+ce]=ye[W];h(ee,oe,te,re,H,V,1<<3-ce,ie)}function A(H,V,D,k,Z,j){var ee=Z-D,ie=j-k,te=ee*ee+ie*ie,re=te?Math.max(0,Math.min(1,((H-D)*ee+(V-k)*ie)/te)):0,ce=H-(D+re*ee),ye=V-(k+re*ie);return ce*ce+ye*ye}var _=Object.freeze({__proto__:null,generate:m,generateIntoCanvas:y,generateIntoFramebuffer:v}),x="precision highp float;uniform vec4 uGlyphBounds;attribute vec2 aUV;attribute vec4 aLineSegment;varying vec4 vLineSegment;varying vec2 vGlyphXY;void main(){vLineSegment=aLineSegment;vGlyphXY=mix(uGlyphBounds.xy,uGlyphBounds.zw,aUV);gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",E="precision highp float;uniform vec4 uGlyphBounds;uniform float uMaxDistance;uniform float uExponent;varying vec4 vLineSegment;varying vec2 vGlyphXY;float absDistToSegment(vec2 point,vec2 lineA,vec2 lineB){vec2 lineDir=lineB-lineA;float lenSq=dot(lineDir,lineDir);float t=lenSq==0.0 ? 0.0 : clamp(dot(point-lineA,lineDir)/lenSq,0.0,1.0);vec2 linePt=lineA+t*lineDir;return distance(point,linePt);}void main(){vec4 seg=vLineSegment;vec2 p=vGlyphXY;float dist=absDistToSegment(p,seg.xy,seg.zw);float val=pow(1.0-clamp(dist/uMaxDistance,0.0,1.0),uExponent)*0.5;bool crossing=(seg.y>p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y<vLineSegment.w;gl_FragColor=vec4(crossingUp ? 1.0/255.0 : 0.0,crossing&&!crossingUp ? 1.0/255.0 : 0.0,0.0,val);}",w="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){vec4 color=texture2D(tex,vUV);bool inside=color.r!=color.g;float val=inside ? 1.0-color.a : color.a;gl_FragColor=vec4(val);}",I=new Float32Array([0,0,2,0,0,2]),T=null,M=!1,b={},B=new WeakMap;function L(H){if(!M&&!G(H))throw new Error("WebGL generation not supported")}function U(H,V,D,k,Z,j,ee){if(j===void 0&&(j=1),ee===void 0&&(ee=null),!ee&&(ee=T,!ee)){var ie=typeof OffscreenCanvas=="function"?new OffscreenCanvas(1,1):typeof document<"u"?document.createElement("canvas"):null;if(!ie)throw new Error("OffscreenCanvas or DOM canvas not supported");ee=T=ie.getContext("webgl",{depth:!1})}L(ee);var te=new Uint8Array(H*V*4);u(ee,function(oe){var W=oe.gl,ge=oe.withTexture,he=oe.withTextureFramebuffer;ge("readable",function(ue,fe){W.texImage2D(W.TEXTURE_2D,0,W.RGBA,H,V,0,W.RGBA,W.UNSIGNED_BYTE,null),he(ue,fe,function(Pe){Q(H,V,D,k,Z,j,W,Pe,0,0,0),W.readPixels(0,0,H,V,W.RGBA,W.UNSIGNED_BYTE,te)})})});for(var re=new Uint8Array(H*V),ce=0,ye=0;ce<te.length;ce+=4)re[ye++]=te[ce];return re}function O(H,V,D,k,Z,j,ee,ie,te,re){j===void 0&&(j=1),ie===void 0&&(ie=0),te===void 0&&(te=0),re===void 0&&(re=0),Q(H,V,D,k,Z,j,ee,null,ie,te,re)}function Q(H,V,D,k,Z,j,ee,ie,te,re,ce){j===void 0&&(j=1),te===void 0&&(te=0),re===void 0&&(re=0),ce===void 0&&(ce=0),L(ee);var ye=[];s(D,function(oe,W,ge,he){ye.push(oe,W,ge,he)}),ye=new Float32Array(ye),u(ee,function(oe){var W=oe.gl,ge=oe.isWebGL2,he=oe.getExtension,ue=oe.withProgram,fe=oe.withTexture,Pe=oe.withTextureFramebuffer,pe=oe.handleContextLoss;if(fe("rawDistances",function(Re,Le){(H!==Re._lastWidth||V!==Re._lastHeight)&&W.texImage2D(W.TEXTURE_2D,0,W.RGBA,Re._lastWidth=H,Re._lastHeight=V,0,W.RGBA,W.UNSIGNED_BYTE,null),ue("main",x,E,function(Se){var $e=Se.setAttribute,X=Se.setUniform,z=!ge&&he("ANGLE_instanced_arrays"),se=!ge&&he("EXT_blend_minmax");$e("aUV",2,W.STATIC_DRAW,0,I),$e("aLineSegment",4,W.DYNAMIC_DRAW,1,ye),X.apply(void 0,["4f","uGlyphBounds"].concat(k)),X("1f","uMaxDistance",Z),X("1f","uExponent",j),Pe(Re,Le,function(Be){W.enable(W.BLEND),W.colorMask(!0,!0,!0,!0),W.viewport(0,0,H,V),W.scissor(0,0,H,V),W.blendFunc(W.ONE,W.ONE),W.blendEquationSeparate(W.FUNC_ADD,ge?W.MAX:se.MAX_EXT),W.clear(W.COLOR_BUFFER_BIT),ge?W.drawArraysInstanced(W.TRIANGLES,0,3,ye.length/4):z.drawArraysInstancedANGLE(W.TRIANGLES,0,3,ye.length/4)})}),ue("post",a,w,function(Se){Se.setAttribute("aUV",2,W.STATIC_DRAW,0,I),Se.setUniform("1i","tex",Le),W.bindFramebuffer(W.FRAMEBUFFER,ie),W.disable(W.BLEND),W.colorMask(ce===0,ce===1,ce===2,ce===3),W.viewport(te,re,H,V),W.scissor(te,re,H,V),W.drawArrays(W.TRIANGLES,0,3)})}),W.isContextLost())throw pe(),new Error("webgl context lost")})}function G(H){var V=!H||H===T?b:H.canvas||H,D=B.get(V);if(D===void 0){M=!0;var k=null;try{var Z=[97,106,97,61,99,137,118,80,80,118,137,99,61,97,106,97],j=U(4,4,"M8,8L16,8L24,24L16,24Z",[0,0,32,32],24,1,H);D=j&&Z.length===j.length&&j.every(function(ee,ie){return ee===Z[ie]}),D||(k="bad trial run results",console.info(Z,j))}catch(ee){D=!1,k=ee.message}k&&console.warn("WebGL SDF generation not supported:",k),M=!1,B.set(V,D)}return D}var F=Object.freeze({__proto__:null,generate:U,generateIntoCanvas:O,generateIntoFramebuffer:Q,isSupported:G});function q(H,V,D,k,Z,j){Z===void 0&&(Z=Math.max(k[2]-k[0],k[3]-k[1])/2),j===void 0&&(j=1);try{return U.apply(F,arguments)}catch(ee){return console.info("WebGL SDF generation failed, falling back to JS",ee),m.apply(_,arguments)}}function Y(H,V,D,k,Z,j,ee,ie,te,re){Z===void 0&&(Z=Math.max(k[2]-k[0],k[3]-k[1])/2),j===void 0&&(j=1),ie===void 0&&(ie=0),te===void 0&&(te=0),re===void 0&&(re=0);try{return O.apply(F,arguments)}catch(ce){return console.info("WebGL SDF generation failed, falling back to JS",ce),y.apply(_,arguments)}}return e.forEachPathCommand=r,e.generate=q,e.generateIntoCanvas=Y,e.javascript=_,e.pathToLineSegments=s,e.webgl=F,e.webglUtils=p,Object.defineProperty(e,"__esModule",{value:!0}),e}({});return n}function ace(){var n=function(e){var t={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},i={},r={};i.L=1,r[1]="L",Object.keys(t).forEach(function(pe,Re){i[pe]=1<<Re+1,r[i[pe]]=pe}),Object.freeze(i);var s=i.LRI|i.RLI|i.FSI,a=i.L|i.R|i.AL,o=i.B|i.S|i.WS|i.ON|i.FSI|i.LRI|i.RLI|i.PDI,l=i.BN|i.RLE|i.LRE|i.RLO|i.LRO|i.PDF,c=i.S|i.WS|i.B|s|i.PDI|l,u=null;function h(){if(!u){u=new Map;var pe=function(Le){if(t.hasOwnProperty(Le)){var Se=0;t[Le].split(",").forEach(function($e){var X=$e.split("+"),z=X[0],se=X[1];z=parseInt(z,36),se=se?parseInt(se,36):0,u.set(Se+=z,i[Le]);for(var Be=0;Be<se;Be++)u.set(++Se,i[Le])})}};for(var Re in t)pe(Re)}}function f(pe){return h(),u.get(pe.codePointAt(0))||i.L}function p(pe){return r[f(pe)]}var m={pairs:"14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function y(pe,Re){var Le=36,Se=0,$e=new Map,X=Re&&new Map,z;return pe.split(",").forEach(function se(Be){if(Be.indexOf("+")!==-1)for(var Ce=+Be;Ce--;)se(z);else{z=Be;var we=Be.split(">"),ke=we[0],Ue=we[1];ke=String.fromCodePoint(Se+=parseInt(ke,Le)),Ue=String.fromCodePoint(Se+=parseInt(Ue,Le)),$e.set(ke,Ue),Re&&X.set(Ue,ke)}}),{map:$e,reverseMap:X}}var v,A,_;function x(){if(!v){var pe=y(m.pairs,!0),Re=pe.map,Le=pe.reverseMap;v=Re,A=Le,_=y(m.canonical,!1).map}}function E(pe){return x(),v.get(pe)||null}function w(pe){return x(),A.get(pe)||null}function I(pe){return x(),_.get(pe)||null}var T=i.L,M=i.R,b=i.EN,B=i.ES,L=i.ET,U=i.AN,O=i.CS,Q=i.B,G=i.S,F=i.ON,q=i.BN,Y=i.NSM,H=i.AL,V=i.LRO,D=i.RLO,k=i.LRE,Z=i.RLE,j=i.PDF,ee=i.LRI,ie=i.RLI,te=i.FSI,re=i.PDI;function ce(pe,Re){for(var Le=125,Se=new Uint32Array(pe.length),$e=0;$e<pe.length;$e++)Se[$e]=f(pe[$e]);var X=new Map;function z(ki,Ar){var fi=Se[ki];Se[ki]=Ar,X.set(fi,X.get(fi)-1),fi&o&&X.set(o,X.get(o)-1),X.set(Ar,(X.get(Ar)||0)+1),Ar&o&&X.set(o,(X.get(o)||0)+1)}for(var se=new Uint8Array(pe.length),Be=new Map,Ce=[],we=null,ke=0;ke<pe.length;ke++)we||Ce.push(we={start:ke,end:pe.length-1,level:Re==="rtl"?1:Re==="ltr"?0:Bu(ke,!1)}),Se[ke]&Q&&(we.end=ke,we=null);for(var Ue=Z|k|D|V|s|re|j|Q,xe=function(ki){return ki+(ki&1?1:2)},ze=function(ki){return ki+(ki&1?2:1)},je=0;je<Ce.length;je++){we=Ce[je];var We=[{_level:we.level,_override:0,_isolate:0}],Oe=void 0,Ve=0,it=0,gt=0;X.clear();for(var ne=we.start;ne<=we.end;ne++){var Fe=Se[ne];if(Oe=We[We.length-1],X.set(Fe,(X.get(Fe)||0)+1),Fe&o&&X.set(o,(X.get(o)||0)+1),Fe&Ue)if(Fe&(Z|k)){se[ne]=Oe._level;var me=(Fe===Z?ze:xe)(Oe._level);me<=Le&&!Ve&&!it?We.push({_level:me,_override:0,_isolate:0}):Ve||it++}else if(Fe&(D|V)){se[ne]=Oe._level;var Qe=(Fe===D?ze:xe)(Oe._level);Qe<=Le&&!Ve&&!it?We.push({_level:Qe,_override:Fe&D?M:T,_isolate:0}):Ve||it++}else if(Fe&s){Fe&te&&(Fe=Bu(ne+1,!0)===1?ie:ee),se[ne]=Oe._level,Oe._override&&z(ne,Oe._override);var Xe=(Fe===ie?ze:xe)(Oe._level);Xe<=Le&&Ve===0&&it===0?(gt++,We.push({_level:Xe,_override:0,_isolate:1,_isolInitIndex:ne})):Ve++}else if(Fe&re){if(Ve>0)Ve--;else if(gt>0){for(it=0;!We[We.length-1]._isolate;)We.pop();var Dt=We[We.length-1]._isolInitIndex;Dt!=null&&(Be.set(Dt,ne),Be.set(ne,Dt)),We.pop(),gt--}Oe=We[We.length-1],se[ne]=Oe._level,Oe._override&&z(ne,Oe._override)}else Fe&j?(Ve===0&&(it>0?it--:!Oe._isolate&&We.length>1&&(We.pop(),Oe=We[We.length-1])),se[ne]=Oe._level):Fe&Q&&(se[ne]=we.level);else se[ne]=Oe._level,Oe._override&&Fe!==q&&z(ne,Oe._override)}for(var Yt=[],en=null,Jt=we.start;Jt<=we.end;Jt++){var dn=Se[Jt];if(!(dn&l)){var Zt=se[Jt],Ht=dn&s,Zi=dn===re;en&&Zt===en._level?(en._end=Jt,en._endsWithIsolInit=Ht):Yt.push(en={_start:Jt,_end:Jt,_level:Zt,_startsWithPDI:Zi,_endsWithIsolInit:Ht})}}for(var Ui=[],on=0;on<Yt.length;on++){var Pn=Yt[on];if(!Pn._startsWithPDI||Pn._startsWithPDI&&!Be.has(Pn._start)){for(var Wi=[en=Pn],Mn=void 0;en&&en._endsWithIsolInit&&(Mn=Be.get(en._end))!=null;)for(var Wn=on+1;Wn<Yt.length;Wn++)if(Yt[Wn]._start===Mn){Wi.push(en=Yt[Wn]);break}for(var wi=[],ys=0;ys<Wi.length;ys++)for(var fr=Wi[ys],K=fr._start;K<=fr._end;K++)wi.push(K);for(var Ae=se[wi[0]],Ie=we.level,de=wi[0]-1;de>=0;de--)if(!(Se[de]&l)){Ie=se[de];break}var Me=wi[wi.length-1],rt=se[Me],mt=we.level;if(!(Se[Me]&s)){for(var At=Me+1;At<=we.end;At++)if(!(Se[At]&l)){mt=se[At];break}}Ui.push({_seqIndices:wi,_sosType:Math.max(Ie,Ae)%2?M:T,_eosType:Math.max(mt,rt)%2?M:T})}}for(var Et=0;Et<Ui.length;Et++){var Ut=Ui[Et],Ge=Ut._seqIndices,vt=Ut._sosType,wn=Ut._eosType,ln=se[Ge[0]]&1?M:T;if(X.get(Y))for(var Oi=0;Oi<Ge.length;Oi++){var er=Ge[Oi];if(Se[er]&Y){for(var pn=vt,Ct=Oi-1;Ct>=0;Ct--)if(!(Se[Ge[Ct]]&l)){pn=Se[Ge[Ct]];break}z(er,pn&(s|re)?F:pn)}}if(X.get(b))for(var tn=0;tn<Ge.length;tn++){var Tt=Ge[tn];if(Se[Tt]&b)for(var hi=tn-1;hi>=-1;hi--){var ti=hi===-1?vt:Se[Ge[hi]];if(ti&a){ti===H&&z(Tt,U);break}}}if(X.get(H))for(var Gn=0;Gn<Ge.length;Gn++){var Lr=Ge[Gn];Se[Lr]&H&&z(Lr,M)}if(X.get(B)||X.get(O))for(var Cn=1;Cn<Ge.length-1;Cn++){var Ln=Ge[Cn];if(Se[Ln]&(B|O)){for(var dr=0,yi=0,wa=Cn-1;wa>=0&&(dr=Se[Ge[wa]],!!(dr&l));wa--);for(var Ca=Cn+1;Ca<Ge.length&&(yi=Se[Ge[Ca]],!!(yi&l));Ca++);dr===yi&&(Se[Ln]===B?dr===b:dr&(b|U))&&z(Ln,dr)}}if(X.get(b))for(var tr=0;tr<Ge.length;tr++){var Xr=Ge[tr];if(Se[Xr]&b){for(var bu=tr-1;bu>=0&&Se[Ge[bu]]&(L|l);bu--)z(Ge[bu],b);for(tr++;tr<Ge.length&&Se[Ge[tr]]&(L|l|b);tr++)Se[Ge[tr]]!==b&&z(Ge[tr],b)}}if(X.get(L)||X.get(B)||X.get(O))for(var nc=0;nc<Ge.length;nc++){var j0=Ge[nc];if(Se[j0]&(L|B|O)){z(j0,F);for(var uo=nc-1;uo>=0&&Se[Ge[uo]]&l;uo--)z(Ge[uo],F);for(var ho=nc+1;ho<Ge.length&&Se[Ge[ho]]&l;ho++)z(Ge[ho],F)}}if(X.get(b))for(var fo=0,ic=vt;fo<Ge.length;fo++){var K0=Ge[fo],Sf=Se[K0];Sf&b?ic===T&&z(K0,T):Sf&a&&(ic=Sf)}if(X.get(o)){var po=M|b|U,Iu=po|T,Ta=[];{for(var tl=[],ba=0;ba<Ge.length;ba++)if(Se[Ge[ba]]&o){var Xt=pe[Ge[ba]],wf=void 0;if(E(Xt)!==null)if(tl.length<63)tl.push({char:Xt,seqIndex:ba});else break;else if((wf=w(Xt))!==null)for(var go=tl.length-1;go>=0;go--){var Mu=tl[go].char;if(Mu===wf||Mu===w(I(Xt))||E(I(Mu))===Xt){Ta.push([tl[go].seqIndex,ba]),tl.length=go;break}}}Ta.sort(function(ki,Ar){return ki[0]-Ar[0]})}for(var Cf=0;Cf<Ta.length;Cf++){for(var $0=Ta[Cf],Yn=$0[0],rc=$0[1],J0=!1,pr=0,Tf=Yn+1;Tf<rc;Tf++){var sc=Ge[Tf];if(Se[sc]&Iu){J0=!0;var jr=Se[sc]&po?M:T;if(jr===ln){pr=jr;break}}}if(J0&&!pr){pr=vt;for(var bf=Yn-1;bf>=0;bf--){var Z0=Ge[bf];if(Se[Z0]&Iu){var Kr=Se[Z0]&po?M:T;Kr!==ln?pr=Kr:pr=ln;break}}}if(pr){if(Se[Ge[Yn]]=Se[Ge[rc]]=pr,pr!==ln){for(var gr=Yn+1;gr<Ge.length;gr++)if(!(Se[Ge[gr]]&l)){f(pe[Ge[gr]])&Y&&(Se[Ge[gr]]=pr);break}}if(pr!==ln){for(var Ia=rc+1;Ia<Ge.length;Ia++)if(!(Se[Ge[Ia]]&l)){f(pe[Ge[Ia]])&Y&&(Se[Ge[Ia]]=pr);break}}}}for(var xs=0;xs<Ge.length;xs++)if(Se[Ge[xs]]&o){for(var If=xs,Mf=xs,Ur=vt,ac=xs-1;ac>=0;ac--)if(Se[Ge[ac]]&l)If=ac;else{Ur=Se[Ge[ac]]&po?M:T;break}for(var oc=wn,lc=xs+1;lc<Ge.length;lc++)if(Se[Ge[lc]]&(o|l))Mf=lc;else{oc=Se[Ge[lc]]&po?M:T;break}for(var mr=If;mr<=Mf;mr++)Se[Ge[mr]]=Ur===oc?Ur:ln;xs=Mf}}}for(var Fi=we.start;Fi<=we.end;Fi++){var Ru=se[Fi],Ks=Se[Fi];if(Ru&1?Ks&(T|b|U)&&se[Fi]++:Ks&M?se[Fi]++:Ks&(U|b)&&(se[Fi]+=2),Ks&l&&(se[Fi]=Fi===0?we.level:se[Fi-1]),Fi===we.end||f(pe[Fi])&(G|Q))for(var nl=Fi;nl>=0&&f(pe[nl])&c;nl--)se[nl]=we.level}}return{levels:se,paragraphs:Ce};function Bu(ki,Ar){for(var fi=ki;fi<pe.length;fi++){var di=Se[fi];if(di&(M|H))return 1;if(di&(Q|T)||Ar&&di===re)return 0;if(di&s){var $r=e3(fi);fi=$r===-1?pe.length:$r}}return 0}function e3(ki){for(var Ar=1,fi=ki+1;fi<pe.length;fi++){var di=Se[fi];if(di&Q)break;if(di&re){if(--Ar===0)return fi}else di&s&&Ar++}return-1}}var ye="14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",oe;function W(){if(!oe){var pe=y(ye,!0),Re=pe.map,Le=pe.reverseMap;Le.forEach(function(Se,$e){Re.set($e,Se)}),oe=Re}}function ge(pe){return W(),oe.get(pe)||null}function he(pe,Re,Le,Se){var $e=pe.length;Le=Math.max(0,Le==null?0:+Le),Se=Math.min($e-1,Se==null?$e-1:+Se);for(var X=new Map,z=Le;z<=Se;z++)if(Re[z]&1){var se=ge(pe[z]);se!==null&&X.set(z,se)}return X}function ue(pe,Re,Le,Se){var $e=pe.length;Le=Math.max(0,Le==null?0:+Le),Se=Math.min($e-1,Se==null?$e-1:+Se);var X=[];return Re.paragraphs.forEach(function(z){var se=Math.max(Le,z.start),Be=Math.min(Se,z.end);if(se<Be){for(var Ce=Re.levels.slice(se,Be+1),we=Be;we>=se&&f(pe[we])&c;we--)Ce[we]=z.level;for(var ke=z.level,Ue=1/0,xe=0;xe<Ce.length;xe++){var ze=Ce[xe];ze>ke&&(ke=ze),ze<Ue&&(Ue=ze|1)}for(var je=ke;je>=Ue;je--)for(var We=0;We<Ce.length;We++)if(Ce[We]>=je){for(var Oe=We;We+1<Ce.length&&Ce[We+1]>=je;)We++;We>Oe&&X.push([Oe+se,We+se])}}}),X}function fe(pe,Re,Le,Se){var $e=Pe(pe,Re,Le,Se),X=[].concat(pe);return $e.forEach(function(z,se){X[se]=(Re.levels[z]&1?ge(pe[z]):null)||pe[z]}),X.join("")}function Pe(pe,Re,Le,Se){for(var $e=ue(pe,Re,Le,Se),X=[],z=0;z<pe.length;z++)X[z]=z;return $e.forEach(function(se){for(var Be=se[0],Ce=se[1],we=X.slice(Be,Ce+1),ke=we.length;ke--;)X[Ce-ke]=we[ke]}),X}return e.closingToOpeningBracket=w,e.getBidiCharType=f,e.getBidiCharTypeName=p,e.getCanonicalBracket=I,e.getEmbeddingLevels=ce,e.getMirroredCharacter=ge,e.getMirroredCharactersMap=he,e.getReorderSegments=ue,e.getReorderedIndices=Pe,e.getReorderedString=fe,e.openingToClosingBracket=E,Object.defineProperty(e,"__esModule",{value:!0}),e}({});return n}const QB=/\bvoid\s+main\s*\(\s*\)\s*{/g;function d6(n){const e=/^[ \t]*#include +<([\w\d./]+)>/gm;function t(i,r){let s=kt[r];return s?d6(s):i}return n.replace(e,t)}const qi=[];for(let n=0;n<256;n++)qi[n]=(n<16?"0":"")+n.toString(16);function oce(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(qi[n&255]+qi[n>>8&255]+qi[n>>16&255]+qi[n>>24&255]+"-"+qi[e&255]+qi[e>>8&255]+"-"+qi[e>>16&15|64]+qi[e>>24&255]+"-"+qi[t&63|128]+qi[t>>8&255]+"-"+qi[t>>16&255]+qi[t>>24&255]+qi[i&255]+qi[i>>8&255]+qi[i>>16&255]+qi[i>>24&255]).toUpperCase()}const Mc=Object.assign||function(){let n=arguments[0];for(let e=1,t=arguments.length;e<t;e++){let i=arguments[e];if(i)for(let r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n[r]=i[r])}return n},lce=Date.now(),gw=new WeakMap,mw=new Map;let cce=1e10;function p6(n,e){const t=dce(e);let i=gw.get(n);if(i||gw.set(n,i=Object.create(null)),i[t])return new i[t];const r=`_onBeforeCompile${t}`,s=function(c,u){n.onBeforeCompile.call(this,c,u);const h=this.customProgramCacheKey()+"|"+c.vertexShader+"|"+c.fragmentShader;let f=mw[h];if(!f){const p=uce(this,c,e,t);f=mw[h]=p}c.vertexShader=f.vertexShader,c.fragmentShader=f.fragmentShader,Mc(c.uniforms,this.uniforms),e.timeUniform&&(c.uniforms[e.timeUniform]={get value(){return Date.now()-lce}}),this[r]&&this[r](c)},a=function(){return o(e.chained?n:n.clone())},o=function(c){const u=Object.create(c,l);return Object.defineProperty(u,"baseMaterial",{value:n}),Object.defineProperty(u,"id",{value:cce++}),u.uuid=oce(),u.uniforms=Mc({},c.uniforms,e.uniforms),u.defines=Mc({},c.defines,e.defines),u.defines[`TROIKA_DERIVED_MATERIAL_${t}`]="",u.extensions=Mc({},c.extensions,e.extensions),u._listeners=void 0,u},l={constructor:{value:a},isDerivedMaterial:{value:!0},customProgramCacheKey:{writable:!0,configurable:!0,value:function(){return n.customProgramCacheKey()+"|"+t}},onBeforeCompile:{get(){return s},set(c){this[r]=c}},copy:{writable:!0,configurable:!0,value:function(c){return n.copy.call(this,c),!n.isShaderMaterial&&!n.isDerivedMaterial&&(Mc(this.extensions,c.extensions),Mc(this.defines,c.defines),Mc(this.uniforms,Hn.clone(c.uniforms))),this}},clone:{writable:!0,configurable:!0,value:function(){const c=new n.constructor;return o(c).copy(this)}},getDepthMaterial:{writable:!0,configurable:!0,value:function(){let c=this._depthMaterial;return c||(c=this._depthMaterial=p6(n.isDerivedMaterial?n.getDepthMaterial():new u0({depthPacking:P2}),e),c.defines.IS_DEPTH_MATERIAL="",c.uniforms=this.uniforms),c}},getDistanceMaterial:{writable:!0,configurable:!0,value:function(){let c=this._distanceMaterial;return c||(c=this._distanceMaterial=p6(n.isDerivedMaterial?n.getDistanceMaterial():new F2,e),c.defines.IS_DISTANCE_MATERIAL="",c.uniforms=this.uniforms),c}},dispose:{writable:!0,configurable:!0,value(){const{_depthMaterial:c,_distanceMaterial:u}=this;c&&c.dispose(),u&&u.dispose(),n.dispose.call(this)}}};return i[t]=a,new a}function uce(n,{vertexShader:e,fragmentShader:t},i,r){let{vertexDefs:s,vertexMainIntro:a,vertexMainOutro:o,vertexTransform:l,fragmentDefs:c,fragmentMainIntro:u,fragmentMainOutro:h,fragmentColorTransform:f,customRewriter:p,timeUniform:m}=i;if(s=s||"",a=a||"",o=o||"",c=c||"",u=u||"",h=h||"",(l||p)&&(e=d6(e)),(f||p)&&(t=t.replace(/^[ \t]*#include <((?:tonemapping|encodings|fog|premultiplied_alpha|dithering)_fragment)>/gm,`
//!BEGIN_POST_CHUNK $1
$&
//!END_POST_CHUNK
`),t=d6(t)),p){let y=p({vertexShader:e,fragmentShader:t});e=y.vertexShader,t=y.fragmentShader}if(f){let y=[];t=t.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,v=>(y.push(v),"")),h=`${f}
${y.join(`
`)}
${h}`}if(m){const y=`
uniform float ${m};
`;s=y+s,c=y+c}return l&&(e=`vec3 troika_position_${r};
vec3 troika_normal_${r};
vec2 troika_uv_${r};
${e}
`,s=`${s}
void troikaVertexTransform${r}(inout vec3 position, inout vec3 normal, inout vec2 uv) {
${l}
}
`,a=`
troika_position_${r} = vec3(position);
troika_normal_${r} = vec3(normal);
troika_uv_${r} = vec2(uv);
troikaVertexTransform${r}(troika_position_${r}, troika_normal_${r}, troika_uv_${r});
${a}
`,e=e.replace(/\b(position|normal|uv)\b/g,(y,v,A,_)=>/\battribute\s+vec[23]\s+$/.test(_.substr(0,A))?v:`troika_${v}_${r}`),n.map&&n.map.channel>0||(e=e.replace(/\bMAP_UV\b/g,`troika_uv_${r}`))),e=Aw(e,r,s,a,o),t=Aw(t,r,c,u,h),{vertexShader:e,fragmentShader:t}}function Aw(n,e,t,i,r){return(i||r||t)&&(n=n.replace(QB,`
${t}
void troikaOrigMain${e}() {`),n+=`
void main() {
${i}
troikaOrigMain${e}();
${r}
}`),n}function hce(n,e){return n==="uniforms"?void 0:typeof e=="function"?e.toString():e}let fce=0;const vw=new Map;function dce(n){const e=JSON.stringify(n,hce);let t=vw.get(e);return t==null&&vw.set(e,t=++fce),t}function pce(n,e,t){const{defaultFontURL:i}=t,r=Object.create(null),s=1/0,a=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,o="[^\\S\\u00A0]",l=new RegExp(`${o}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function c(_,x){function E(){const w=I=>{console.error(`Failure loading font ${_}${_===i?"":"; trying fallback"}`,I),_!==i&&(_=i,E())};try{const I=new XMLHttpRequest;I.open("get",_,!0),I.responseType="arraybuffer",I.onload=function(){if(I.status>=400)w(new Error(I.statusText));else if(I.status>0)try{const T=n(I.response);x(T)}catch(T){w(T)}},I.onerror=w,I.send()}catch(I){w(I)}}E()}function u(_,x){_||(_=i);let E=r[_];E?E.pending?E.pending.push(x):x(E):(r[_]={pending:[x]},c(_,w=>{let I=r[_].pending;r[_]=w,I.forEach(T=>T(w))}))}function h({text:_="",font:x=i,sdfGlyphSize:E=64,fontSize:w=1,letterSpacing:I=0,lineHeight:T="normal",maxWidth:M=s,direction:b,textAlign:B="left",textIndent:L=0,whiteSpace:U="normal",overflowWrap:O="normal",anchorX:Q=0,anchorY:G=0,includeCaretPositions:F=!1,chunkedBoundsSize:q=8192,colorRanges:Y=null},H,V=!1){const D=y(),k={fontLoad:0,typesetting:0};_.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),_=_.replace(/\r\n/g,`
`).replace(/\r/g,`
`)),w=+w,I=+I,M=+M,T=T||"normal",L=+L,u(x,Z=>{const j=isFinite(M);let ee=null,ie=null,te=null,re=null,ce=null,ye=null,oe=null,W=0,ge=0,he=U!=="nowrap";const{ascender:ue,descender:fe,unitsPerEm:Pe,lineGap:pe,capHeight:Re,xHeight:Le}=Z;k.fontLoad=y()-D;const Se=y(),$e=w/Pe;T==="normal"&&(T=(ue-fe+pe)/Pe),T=T*w;const X=(T-(ue-fe)*$e)/2,z=-(ue*$e+X),se=Math.min(T,(ue-fe)*$e),Be=(ue+fe)/2*$e-se/2;let Ce=L,we=new v;const ke=[we];Z.forEachGlyph(_,w,I,(ze,je,We)=>{const Oe=_.charAt(We),Ve=ze.advanceWidth*$e,it=we.count;let gt;if("isEmpty"in ze||(ze.isWhitespace=!!Oe&&new RegExp(o).test(Oe),ze.canBreakAfter=!!Oe&&l.test(Oe),ze.isEmpty=ze.xMin===ze.xMax||ze.yMin===ze.yMax||a.test(Oe)),!ze.isWhitespace&&!ze.isEmpty&&ge++,he&&j&&!ze.isWhitespace&&je+Ve+Ce>M&&it){if(we.glyphAt(it-1).glyphObj.canBreakAfter)gt=new v,Ce=-je;else for(let Fe=it;Fe--;)if(Fe===0&&O==="break-word"){gt=new v,Ce=-je;break}else if(we.glyphAt(Fe).glyphObj.canBreakAfter){gt=we.splitAt(Fe+1);const me=gt.glyphAt(0).x;Ce-=me;for(let Qe=gt.count;Qe--;)gt.glyphAt(Qe).x-=me;break}gt&&(we.isSoftWrapped=!0,we=gt,ke.push(we),W=M)}let ne=we.glyphAt(we.count);ne.glyphObj=ze,ne.x=je+Ce,ne.width=Ve,ne.charIndex=We,Oe===`
`&&(we=new v,ke.push(we),Ce=-(je+Ve+I*w)+L)}),ke.forEach(ze=>{for(let je=ze.count;je--;){let{glyphObj:We,x:Oe,width:Ve}=ze.glyphAt(je);if(!We.isWhitespace){ze.width=Oe+Ve,ze.width>W&&(W=ze.width);return}}});let Ue=0,xe=0;if(Q&&(typeof Q=="number"?Ue=-Q:typeof Q=="string"&&(Ue=-W*(Q==="left"?0:Q==="center"?.5:Q==="right"?1:p(Q)))),G){if(typeof G=="number")xe=-G;else if(typeof G=="string"){let ze=ke.length*T;xe=G==="top"?0:G==="top-baseline"?-z:G==="top-cap"?-z-Re*$e:G==="top-ex"?-z-Le*$e:G==="middle"?ze/2:G==="bottom"?ze:G==="bottom-baseline"?ze-X+fe*$e:p(G)*ze}}if(!V){const ze=e.getEmbeddingLevels(_,b);ee=new Uint16Array(ge),ie=new Float32Array(ge*2),te={},ye=[s,s,-s,-s],oe=[];let je=z;F&&(ce=new Float32Array(_.length*3)),Y&&(re=new Uint8Array(ge*3));let We=0,Oe=-1,Ve=-1,it,gt;if(ke.forEach((ne,Fe)=>{let{count:me,width:Qe}=ne;if(me>0){let Xe=0;for(let Zt=me;Zt--&&ne.glyphAt(Zt).glyphObj.isWhitespace;)Xe++;let Dt=0,Yt=0;if(B==="center")Dt=(W-Qe)/2;else if(B==="right")Dt=W-Qe;else if(B==="justify"&&ne.isSoftWrapped){let Zt=0;for(let Ht=me-Xe;Ht--;)ne.glyphAt(Ht).glyphObj.isWhitespace&&Zt++;Yt=(W-Qe)/Zt}if(Yt||Dt){let Zt=0;for(let Ht=0;Ht<me;Ht++){let Zi=ne.glyphAt(Ht);const Ui=Zi.glyphObj;Zi.x+=Dt+Zt,Yt!==0&&Ui.isWhitespace&&Ht<me-Xe&&(Zt+=Yt,Zi.width+=Yt)}}const en=e.getReorderSegments(_,ze,ne.glyphAt(0).charIndex,ne.glyphAt(ne.count-1).charIndex);for(let Zt=0;Zt<en.length;Zt++){const[Ht,Zi]=en[Zt];let Ui=1/0,on=-1/0;for(let Pn=0;Pn<me;Pn++)if(ne.glyphAt(Pn).charIndex>=Ht){let Wi=Pn,Mn=Pn;for(;Mn<me;Mn++){let Wn=ne.glyphAt(Mn);if(Wn.charIndex>Zi)break;Mn<me-Xe&&(Ui=Math.min(Ui,Wn.x),on=Math.max(on,Wn.x+Wn.width))}for(let Wn=Wi;Wn<Mn;Wn++){const wi=ne.glyphAt(Wn);wi.x=on-(wi.x+wi.width-Ui)}break}}let Jt;const dn=Zt=>Jt=Zt;for(let Zt=0;Zt<me;Zt++){let Ht=ne.glyphAt(Zt);Jt=Ht.glyphObj;const Zi=Jt.index,Ui=ze.levels[Ht.charIndex]&1;if(Ui){const on=e.getMirroredCharacter(_[Ht.charIndex]);on&&Z.forEachGlyph(on,0,0,dn)}if(F){const{charIndex:on}=Ht,Pn=Ht.x+Ue,Wi=Ht.x+Ht.width+Ue;ce[on*3]=Ui?Wi:Pn,ce[on*3+1]=Ui?Pn:Wi,ce[on*3+2]=je+Be+xe;const Mn=on-Oe;Mn>1&&m(ce,Oe,Mn),Oe=on}if(Y){const{charIndex:on}=Ht;for(;on>Ve;)Ve++,Y.hasOwnProperty(Ve)&&(gt=Y[Ve])}if(!Jt.isWhitespace&&!Jt.isEmpty){const on=We++;te[Zi]||(te[Zi]={path:Jt.path,pathBounds:[Jt.xMin,Jt.yMin,Jt.xMax,Jt.yMax]});const Pn=Ht.x+Ue,Wi=je+xe;ie[on*2]=Pn,ie[on*2+1]=Wi;const Mn=Pn+Jt.xMin*$e,Wn=Wi+Jt.yMin*$e,wi=Pn+Jt.xMax*$e,ys=Wi+Jt.yMax*$e;Mn<ye[0]&&(ye[0]=Mn),Wn<ye[1]&&(ye[1]=Wn),wi>ye[2]&&(ye[2]=wi),ys>ye[3]&&(ye[3]=ys),on%q===0&&(it={start:on,end:on,rect:[s,s,-s,-s]},oe.push(it)),it.end++;const fr=it.rect;if(Mn<fr[0]&&(fr[0]=Mn),Wn<fr[1]&&(fr[1]=Wn),wi>fr[2]&&(fr[2]=wi),ys>fr[3]&&(fr[3]=ys),ee[on]=Zi,Y){const K=on*3;re[K]=gt>>16&255,re[K+1]=gt>>8&255,re[K+2]=gt&255}}}}je-=T}),ce){const ne=_.length-Oe;ne>1&&m(ce,Oe,ne)}}k.typesetting=y()-Se,H({glyphIds:ee,glyphPositions:ie,glyphData:te,caretPositions:ce,caretHeight:se,glyphColors:re,chunkedBounds:oe,fontSize:w,unitsPerEm:Pe,ascender:ue*$e,descender:fe*$e,capHeight:Re*$e,xHeight:Le*$e,lineHeight:T,topBaseline:z,blockBounds:[Ue,xe-ke.length*T,Ue+W,xe],visibleBounds:ye,timings:k})})}function f(_,x){h(_,E=>{const[w,I,T,M]=E.blockBounds;x({width:T-w,height:M-I})},{metricsOnly:!0})}function p(_){let x=_.match(/^([\d.]+)%$/),E=x?parseFloat(x[1]):NaN;return isNaN(E)?0:E/100}function m(_,x,E){const w=_[x*3],I=_[x*3+1],T=_[x*3+2],M=(I-w)/E;for(let b=0;b<E;b++){const B=(x+b)*3;_[B]=w+M*b,_[B+1]=w+M*(b+1),_[B+2]=T}}function y(){return(self.performance||Date).now()}function v(){this.data=[]}const A=["glyphObj","x","width","charIndex"];return v.prototype={width:0,isSoftWrapped:!1,get count(){return Math.ceil(this.data.length/A.length)},glyphAt(_){let x=v.flyweight;return x.data=this.data,x.index=_,x},splitAt(_){let x=new v;return x.data=this.data.splice(_*A.length),x}},v.flyweight=A.reduce((_,x,E,w)=>(Object.defineProperty(_,x,{get(){return this.data[this.index*A.length+E]},set(I){this.data[this.index*A.length+E]=I}}),_),{data:null,index:0}),{typeset:h,measure:f,loadFont:u}}const eu=()=>(self.performance||Date).now(),j1=zB();let yw;function gce(n,e,t,i,r,s,a,o,l,c,u=!0){return u?Ace(n,e,t,i,r,s,a,o,l,c).then(null,h=>(yw||(console.warn("WebGL SDF generation failed, falling back to JS",h),yw=!0),_w(n,e,t,i,r,s,a,o,l,c))):_w(n,e,t,i,r,s,a,o,l,c)}const Mm=[],mce=5;let g6=0;function HB(){const n=eu();for(;Mm.length&&eu()-n<mce;)Mm.shift()();g6=Mm.length?setTimeout(HB,0):0}const Ace=(...n)=>new Promise((e,t)=>{Mm.push(()=>{const i=eu();try{j1.webgl.generateIntoCanvas(...n),e({timing:eu()-i})}catch(r){t(r)}}),g6||(g6=setTimeout(HB,0))}),vce=4,yce=2e3,xw={};let xce=0;function _w(n,e,t,i,r,s,a,o,l,c){const u="TroikaTextSDFGenerator_JS_"+xce++%vce;let h=xw[u];return h||(h=xw[u]={workerModule:Y0({name:u,workerId:u,dependencies:[zB,eu],init(f,p){const m=f().javascript.generate;return function(...y){const v=p();return{textureData:m(...y),timing:p()-v}}},getTransferables(f){return[f.textureData.buffer]}}),requests:0,idleTimer:null}),h.requests++,clearTimeout(h.idleTimer),h.workerModule(n,e,t,i,r,s).then(({textureData:f,timing:p})=>{const m=eu(),y=new Uint8Array(f.length*4);for(let v=0;v<f.length;v++)y[v*4+c]=f[v];return j1.webglUtils.renderImageData(a,y,o,l,n,e,1<<3-c),p+=eu()-m,--h.requests===0&&(h.idleTimer=setTimeout(()=>{rce(u)},yce)),{timing:p}})}function _ce(n){n._warm||(j1.webgl.isSupported(n),n._warm=!0)}const Ece=j1.webglUtils.resizeWebGLCanvasWithoutClearing;/*!
Custom build of Typr.ts (https://github.com/fredli74/Typr.ts) for use in Troika text rendering.
Original MIT license applies: https://github.com/fredli74/Typr.ts/blob/master/LICENSE
*/function Sce(){return typeof window>"u"&&(self.window=self),function(n){var e={parse:function(r){var s=e._bin,a=new Uint8Array(r);if(s.readASCII(a,0,4)=="ttcf"){var o=4;s.readUshort(a,o),o+=2,s.readUshort(a,o),o+=2;var l=s.readUint(a,o);o+=4;for(var c=[],u=0;u<l;u++){var h=s.readUint(a,o);o+=4,c.push(e._readFont(a,h))}return c}return[e._readFont(a,0)]},_readFont:function(r,s){var a=e._bin,o=s;a.readFixed(r,s),s+=4;var l=a.readUshort(r,s);s+=2,a.readUshort(r,s),s+=2,a.readUshort(r,s),s+=2,a.readUshort(r,s),s+=2;for(var c=["cmap","head","hhea","maxp","hmtx","name","OS/2","post","loca","glyf","kern","CFF ","GPOS","GSUB","SVG "],u={_data:r,_offset:o},h={},f=0;f<l;f++){var p=a.readASCII(r,s,4);s+=4,a.readUint(r,s),s+=4;var m=a.readUint(r,s);s+=4;var y=a.readUint(r,s);s+=4,h[p]={offset:m,length:y}}for(f=0;f<c.length;f++){var v=c[f];h[v]&&(u[v.trim()]=e[v.trim()].parse(r,h[v].offset,h[v].length,u))}return u},_tabOffset:function(r,s,a){for(var o=e._bin,l=o.readUshort(r,a+4),c=a+12,u=0;u<l;u++){var h=o.readASCII(r,c,4);c+=4,o.readUint(r,c),c+=4;var f=o.readUint(r,c);if(c+=4,o.readUint(r,c),c+=4,h==s)return f}return 0}};e._bin={readFixed:function(r,s){return(r[s]<<8|r[s+1])+(r[s+2]<<8|r[s+3])/65540},readF2dot14:function(r,s){return e._bin.readShort(r,s)/16384},readInt:function(r,s){return e._bin._view(r).getInt32(s)},readInt8:function(r,s){return e._bin._view(r).getInt8(s)},readShort:function(r,s){return e._bin._view(r).getInt16(s)},readUshort:function(r,s){return e._bin._view(r).getUint16(s)},readUshorts:function(r,s,a){for(var o=[],l=0;l<a;l++)o.push(e._bin.readUshort(r,s+2*l));return o},readUint:function(r,s){return e._bin._view(r).getUint32(s)},readUint64:function(r,s){return 4294967296*e._bin.readUint(r,s)+e._bin.readUint(r,s+4)},readASCII:function(r,s,a){for(var o="",l=0;l<a;l++)o+=String.fromCharCode(r[s+l]);return o},readUnicode:function(r,s,a){for(var o="",l=0;l<a;l++){var c=r[s++]<<8|r[s++];o+=String.fromCharCode(c)}return o},_tdec:typeof window<"u"&&window.TextDecoder?new window.TextDecoder:null,readUTF8:function(r,s,a){var o=e._bin._tdec;return o&&s==0&&a==r.length?o.decode(r):e._bin.readASCII(r,s,a)},readBytes:function(r,s,a){for(var o=[],l=0;l<a;l++)o.push(r[s+l]);return o},readASCIIArray:function(r,s,a){for(var o=[],l=0;l<a;l++)o.push(String.fromCharCode(r[s+l]));return o},_view:function(r){return r._dataView||(r._dataView=r.buffer?new DataView(r.buffer,r.byteOffset,r.byteLength):new DataView(new Uint8Array(r).buffer))}},e._lctf={},e._lctf.parse=function(r,s,a,o,l){var c=e._bin,u={},h=s;c.readFixed(r,s),s+=4;var f=c.readUshort(r,s);s+=2;var p=c.readUshort(r,s);s+=2;var m=c.readUshort(r,s);return s+=2,u.scriptList=e._lctf.readScriptList(r,h+f),u.featureList=e._lctf.readFeatureList(r,h+p),u.lookupList=e._lctf.readLookupList(r,h+m,l),u},e._lctf.readLookupList=function(r,s,a){var o=e._bin,l=s,c=[],u=o.readUshort(r,s);s+=2;for(var h=0;h<u;h++){var f=o.readUshort(r,s);s+=2;var p=e._lctf.readLookupTable(r,l+f,a);c.push(p)}return c},e._lctf.readLookupTable=function(r,s,a){var o=e._bin,l=s,c={tabs:[]};c.ltype=o.readUshort(r,s),s+=2,c.flag=o.readUshort(r,s),s+=2;var u=o.readUshort(r,s);s+=2;for(var h=c.ltype,f=0;f<u;f++){var p=o.readUshort(r,s);s+=2;var m=a(r,h,l+p,c);c.tabs.push(m)}return c},e._lctf.numOfOnes=function(r){for(var s=0,a=0;a<32;a++)r>>>a&1&&s++;return s},e._lctf.readClassDef=function(r,s){var a=e._bin,o=[],l=a.readUshort(r,s);if(s+=2,l==1){var c=a.readUshort(r,s);s+=2;var u=a.readUshort(r,s);s+=2;for(var h=0;h<u;h++)o.push(c+h),o.push(c+h),o.push(a.readUshort(r,s)),s+=2}if(l==2){var f=a.readUshort(r,s);for(s+=2,h=0;h<f;h++)o.push(a.readUshort(r,s)),s+=2,o.push(a.readUshort(r,s)),s+=2,o.push(a.readUshort(r,s)),s+=2}return o},e._lctf.getInterval=function(r,s){for(var a=0;a<r.length;a+=3){var o=r[a],l=r[a+1];if(r[a+2],o<=s&&s<=l)return a}return-1},e._lctf.readCoverage=function(r,s){var a=e._bin,o={};o.fmt=a.readUshort(r,s),s+=2;var l=a.readUshort(r,s);return s+=2,o.fmt==1&&(o.tab=a.readUshorts(r,s,l)),o.fmt==2&&(o.tab=a.readUshorts(r,s,3*l)),o},e._lctf.coverageIndex=function(r,s){var a=r.tab;if(r.fmt==1)return a.indexOf(s);if(r.fmt==2){var o=e._lctf.getInterval(a,s);if(o!=-1)return a[o+2]+(s-a[o])}return-1},e._lctf.readFeatureList=function(r,s){var a=e._bin,o=s,l=[],c=a.readUshort(r,s);s+=2;for(var u=0;u<c;u++){var h=a.readASCII(r,s,4);s+=4;var f=a.readUshort(r,s);s+=2;var p=e._lctf.readFeatureTable(r,o+f);p.tag=h.trim(),l.push(p)}return l},e._lctf.readFeatureTable=function(r,s){var a=e._bin,o=s,l={},c=a.readUshort(r,s);s+=2,c>0&&(l.featureParams=o+c);var u=a.readUshort(r,s);s+=2,l.tab=[];for(var h=0;h<u;h++)l.tab.push(a.readUshort(r,s+2*h));return l},e._lctf.readScriptList=function(r,s){var a=e._bin,o=s,l={},c=a.readUshort(r,s);s+=2;for(var u=0;u<c;u++){var h=a.readASCII(r,s,4);s+=4;var f=a.readUshort(r,s);s+=2,l[h.trim()]=e._lctf.readScriptTable(r,o+f)}return l},e._lctf.readScriptTable=function(r,s){var a=e._bin,o=s,l={},c=a.readUshort(r,s);s+=2,l.default=e._lctf.readLangSysTable(r,o+c);var u=a.readUshort(r,s);s+=2;for(var h=0;h<u;h++){var f=a.readASCII(r,s,4);s+=4;var p=a.readUshort(r,s);s+=2,l[f.trim()]=e._lctf.readLangSysTable(r,o+p)}return l},e._lctf.readLangSysTable=function(r,s){var a=e._bin,o={};a.readUshort(r,s),s+=2,o.reqFeature=a.readUshort(r,s),s+=2;var l=a.readUshort(r,s);return s+=2,o.features=a.readUshorts(r,s,l),o},e.CFF={},e.CFF.parse=function(r,s,a){var o=e._bin;(r=new Uint8Array(r.buffer,s,a))[s=0],r[++s],r[++s],r[++s],s++;var l=[];s=e.CFF.readIndex(r,s,l);for(var c=[],u=0;u<l.length-1;u++)c.push(o.readASCII(r,s+l[u],l[u+1]-l[u]));s+=l[l.length-1];var h=[];s=e.CFF.readIndex(r,s,h);var f=[];for(u=0;u<h.length-1;u++)f.push(e.CFF.readDict(r,s+h[u],s+h[u+1]));s+=h[h.length-1];var p=f[0],m=[];s=e.CFF.readIndex(r,s,m);var y=[];for(u=0;u<m.length-1;u++)y.push(o.readASCII(r,s+m[u],m[u+1]-m[u]));if(s+=m[m.length-1],e.CFF.readSubrs(r,s,p),p.CharStrings){s=p.CharStrings,m=[],s=e.CFF.readIndex(r,s,m);var v=[];for(u=0;u<m.length-1;u++)v.push(o.readBytes(r,s+m[u],m[u+1]-m[u]));p.CharStrings=v}if(p.ROS){s=p.FDArray;var A=[];for(s=e.CFF.readIndex(r,s,A),p.FDArray=[],u=0;u<A.length-1;u++){var _=e.CFF.readDict(r,s+A[u],s+A[u+1]);e.CFF._readFDict(r,_,y),p.FDArray.push(_)}s+=A[A.length-1],s=p.FDSelect,p.FDSelect=[];var x=r[s];if(s++,x!=3)throw x;var E=o.readUshort(r,s);for(s+=2,u=0;u<E+1;u++)p.FDSelect.push(o.readUshort(r,s),r[s+2]),s+=3}return p.Encoding&&(p.Encoding=e.CFF.readEncoding(r,p.Encoding,p.CharStrings.length)),p.charset&&(p.charset=e.CFF.readCharset(r,p.charset,p.CharStrings.length)),e.CFF._readFDict(r,p,y),p},e.CFF._readFDict=function(r,s,a){var o;for(var l in s.Private&&(o=s.Private[1],s.Private=e.CFF.readDict(r,o,o+s.Private[0]),s.Private.Subrs&&e.CFF.readSubrs(r,o+s.Private.Subrs,s.Private)),s)["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(l)!=-1&&(s[l]=a[s[l]-426+35])},e.CFF.readSubrs=function(r,s,a){var o=e._bin,l=[];s=e.CFF.readIndex(r,s,l);var c,u=l.length;c=u<1240?107:u<33900?1131:32768,a.Bias=c,a.Subrs=[];for(var h=0;h<l.length-1;h++)a.Subrs.push(o.readBytes(r,s+l[h],l[h+1]-l[h]))},e.CFF.tableSE=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,0,111,112,113,114,0,115,116,117,118,119,120,121,122,0,123,0,124,125,126,127,128,129,130,131,0,132,133,0,134,135,136,137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,0,139,0,0,0,0,140,141,142,143,0,0,0,0,0,144,0,0,0,145,0,0,146,147,148,149,0,0,0,0],e.CFF.glyphByUnicode=function(r,s){for(var a=0;a<r.charset.length;a++)if(r.charset[a]==s)return a;return-1},e.CFF.glyphBySE=function(r,s){return s<0||s>255?-1:e.CFF.glyphByUnicode(r,e.CFF.tableSE[s])},e.CFF.readEncoding=function(r,s,a){e._bin;var o=[".notdef"],l=r[s];if(s++,l!=0)throw"error: unknown encoding format: "+l;var c=r[s];s++;for(var u=0;u<c;u++)o.push(r[s+u]);return o},e.CFF.readCharset=function(r,s,a){var o=e._bin,l=[".notdef"],c=r[s];if(s++,c==0)for(var u=0;u<a;u++){var h=o.readUshort(r,s);s+=2,l.push(h)}else{if(c!=1&&c!=2)throw"error: format: "+c;for(;l.length<a;){h=o.readUshort(r,s),s+=2;var f=0;for(c==1?(f=r[s],s++):(f=o.readUshort(r,s),s+=2),u=0;u<=f;u++)l.push(h),h++}}return l},e.CFF.readIndex=function(r,s,a){var o=e._bin,l=o.readUshort(r,s)+1,c=r[s+=2];if(s++,c==1)for(var u=0;u<l;u++)a.push(r[s+u]);else if(c==2)for(u=0;u<l;u++)a.push(o.readUshort(r,s+2*u));else if(c==3)for(u=0;u<l;u++)a.push(16777215&o.readUint(r,s+3*u-1));else if(l!=1)throw"unsupported offset size: "+c+", count: "+l;return(s+=l*c)-1},e.CFF.getCharString=function(r,s,a){var o=e._bin,l=r[s],c=r[s+1];r[s+2],r[s+3],r[s+4];var u=1,h=null,f=null;l<=20&&(h=l,u=1),l==12&&(h=100*l+c,u=2),21<=l&&l<=27&&(h=l,u=1),l==28&&(f=o.readShort(r,s+1),u=3),29<=l&&l<=31&&(h=l,u=1),32<=l&&l<=246&&(f=l-139,u=1),247<=l&&l<=250&&(f=256*(l-247)+c+108,u=2),251<=l&&l<=254&&(f=256*-(l-251)-c-108,u=2),l==255&&(f=o.readInt(r,s+1)/65535,u=5),a.val=f??"o"+h,a.size=u},e.CFF.readCharString=function(r,s,a){for(var o=s+a,l=e._bin,c=[];s<o;){var u=r[s],h=r[s+1];r[s+2],r[s+3],r[s+4];var f=1,p=null,m=null;u<=20&&(p=u,f=1),u==12&&(p=100*u+h,f=2),u!=19&&u!=20||(p=u,f=2),21<=u&&u<=27&&(p=u,f=1),u==28&&(m=l.readShort(r,s+1),f=3),29<=u&&u<=31&&(p=u,f=1),32<=u&&u<=246&&(m=u-139,f=1),247<=u&&u<=250&&(m=256*(u-247)+h+108,f=2),251<=u&&u<=254&&(m=256*-(u-251)-h-108,f=2),u==255&&(m=l.readInt(r,s+1)/65535,f=5),c.push(m??"o"+p),s+=f}return c},e.CFF.readDict=function(r,s,a){for(var o=e._bin,l={},c=[];s<a;){var u=r[s],h=r[s+1];r[s+2],r[s+3],r[s+4];var f=1,p=null,m=null;if(u==28&&(m=o.readShort(r,s+1),f=3),u==29&&(m=o.readInt(r,s+1),f=5),32<=u&&u<=246&&(m=u-139,f=1),247<=u&&u<=250&&(m=256*(u-247)+h+108,f=2),251<=u&&u<=254&&(m=256*-(u-251)-h-108,f=2),u==255)throw m=o.readInt(r,s+1)/65535,f=5,"unknown number";if(u==30){var y=[];for(f=1;;){var v=r[s+f];f++;var A=v>>4,_=15&v;if(A!=15&&y.push(A),_!=15&&y.push(_),_==15)break}for(var x="",E=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],w=0;w<y.length;w++)x+=E[y[w]];m=parseFloat(x)}u<=21&&(p=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][u],f=1,u==12&&(p=["Copyright","isFixedPitch","ItalicAngle","UnderlinePosition","UnderlineThickness","PaintType","CharstringType","FontMatrix","StrokeWidth","BlueScale","BlueShift","BlueFuzz","StemSnapH","StemSnapV","ForceBold",0,0,"LanguageGroup","ExpansionFactor","initialRandomSeed","SyntheticBase","PostScript","BaseFontName","BaseFontBlend",0,0,0,0,0,0,"ROS","CIDFontVersion","CIDFontRevision","CIDFontType","CIDCount","UIDBase","FDArray","FDSelect","FontName"][h],f=2)),p!=null?(l[p]=c.length==1?c[0]:c,c=[]):c.push(m),s+=f}return l},e.cmap={},e.cmap.parse=function(r,s,a){r=new Uint8Array(r.buffer,s,a),s=0;var o=e._bin,l={};o.readUshort(r,s),s+=2;var c=o.readUshort(r,s);s+=2;var u=[];l.tables=[];for(var h=0;h<c;h++){var f=o.readUshort(r,s);s+=2;var p=o.readUshort(r,s);s+=2;var m=o.readUint(r,s);s+=4;var y="p"+f+"e"+p,v=u.indexOf(m);if(v==-1){var A;v=l.tables.length,u.push(m);var _=o.readUshort(r,m);_==0?A=e.cmap.parse0(r,m):_==4?A=e.cmap.parse4(r,m):_==6?A=e.cmap.parse6(r,m):_==12?A=e.cmap.parse12(r,m):console.debug("unknown format: "+_,f,p,m),l.tables.push(A)}if(l[y]!=null)throw"multiple tables for one platform+encoding";l[y]=v}return l},e.cmap.parse0=function(r,s){var a=e._bin,o={};o.format=a.readUshort(r,s),s+=2;var l=a.readUshort(r,s);s+=2,a.readUshort(r,s),s+=2,o.map=[];for(var c=0;c<l-6;c++)o.map.push(r[s+c]);return o},e.cmap.parse4=function(r,s){var a=e._bin,o=s,l={};l.format=a.readUshort(r,s),s+=2;var c=a.readUshort(r,s);s+=2,a.readUshort(r,s),s+=2;var u=a.readUshort(r,s);s+=2;var h=u/2;l.searchRange=a.readUshort(r,s),s+=2,l.entrySelector=a.readUshort(r,s),s+=2,l.rangeShift=a.readUshort(r,s),s+=2,l.endCount=a.readUshorts(r,s,h),s+=2*h,s+=2,l.startCount=a.readUshorts(r,s,h),s+=2*h,l.idDelta=[];for(var f=0;f<h;f++)l.idDelta.push(a.readShort(r,s)),s+=2;for(l.idRangeOffset=a.readUshorts(r,s,h),s+=2*h,l.glyphIdArray=[];s<o+c;)l.glyphIdArray.push(a.readUshort(r,s)),s+=2;return l},e.cmap.parse6=function(r,s){var a=e._bin,o={};o.format=a.readUshort(r,s),s+=2,a.readUshort(r,s),s+=2,a.readUshort(r,s),s+=2,o.firstCode=a.readUshort(r,s),s+=2;var l=a.readUshort(r,s);s+=2,o.glyphIdArray=[];for(var c=0;c<l;c++)o.glyphIdArray.push(a.readUshort(r,s)),s+=2;return o},e.cmap.parse12=function(r,s){var a=e._bin,o={};o.format=a.readUshort(r,s),s+=2,s+=2,a.readUint(r,s),s+=4,a.readUint(r,s),s+=4;var l=a.readUint(r,s);s+=4,o.groups=[];for(var c=0;c<l;c++){var u=s+12*c,h=a.readUint(r,u+0),f=a.readUint(r,u+4),p=a.readUint(r,u+8);o.groups.push([h,f,p])}return o},e.glyf={},e.glyf.parse=function(r,s,a,o){for(var l=[],c=0;c<o.maxp.numGlyphs;c++)l.push(null);return l},e.glyf._parseGlyf=function(r,s){var a=e._bin,o=r._data,l=e._tabOffset(o,"glyf",r._offset)+r.loca[s];if(r.loca[s]==r.loca[s+1])return null;var c={};if(c.noc=a.readShort(o,l),l+=2,c.xMin=a.readShort(o,l),l+=2,c.yMin=a.readShort(o,l),l+=2,c.xMax=a.readShort(o,l),l+=2,c.yMax=a.readShort(o,l),l+=2,c.xMin>=c.xMax||c.yMin>=c.yMax)return null;if(c.noc>0){c.endPts=[];for(var u=0;u<c.noc;u++)c.endPts.push(a.readUshort(o,l)),l+=2;var h=a.readUshort(o,l);if(l+=2,o.length-l<h)return null;c.instructions=a.readBytes(o,l,h),l+=h;var f=c.endPts[c.noc-1]+1;for(c.flags=[],u=0;u<f;u++){var p=o[l];if(l++,c.flags.push(p),(8&p)!=0){var m=o[l];l++;for(var y=0;y<m;y++)c.flags.push(p),u++}}for(c.xs=[],u=0;u<f;u++){var v=(2&c.flags[u])!=0,A=(16&c.flags[u])!=0;v?(c.xs.push(A?o[l]:-o[l]),l++):A?c.xs.push(0):(c.xs.push(a.readShort(o,l)),l+=2)}for(c.ys=[],u=0;u<f;u++)v=(4&c.flags[u])!=0,A=(32&c.flags[u])!=0,v?(c.ys.push(A?o[l]:-o[l]),l++):A?c.ys.push(0):(c.ys.push(a.readShort(o,l)),l+=2);var _=0,x=0;for(u=0;u<f;u++)_+=c.xs[u],x+=c.ys[u],c.xs[u]=_,c.ys[u]=x}else{var E;c.parts=[];do{E=a.readUshort(o,l),l+=2;var w={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(c.parts.push(w),w.glyphIndex=a.readUshort(o,l),l+=2,1&E){var I=a.readShort(o,l);l+=2;var T=a.readShort(o,l);l+=2}else I=a.readInt8(o,l),l++,T=a.readInt8(o,l),l++;2&E?(w.m.tx=I,w.m.ty=T):(w.p1=I,w.p2=T),8&E?(w.m.a=w.m.d=a.readF2dot14(o,l),l+=2):64&E?(w.m.a=a.readF2dot14(o,l),l+=2,w.m.d=a.readF2dot14(o,l),l+=2):128&E&&(w.m.a=a.readF2dot14(o,l),l+=2,w.m.b=a.readF2dot14(o,l),l+=2,w.m.c=a.readF2dot14(o,l),l+=2,w.m.d=a.readF2dot14(o,l),l+=2)}while(32&E);if(256&E){var M=a.readUshort(o,l);for(l+=2,c.instr=[],u=0;u<M;u++)c.instr.push(o[l]),l++}}return c},e.GPOS={},e.GPOS.parse=function(r,s,a,o){return e._lctf.parse(r,s,a,o,e.GPOS.subt)},e.GPOS.subt=function(r,s,a,o){var l=e._bin,c=a,u={};if(u.fmt=l.readUshort(r,a),a+=2,s==1||s==2||s==3||s==7||s==8&&u.fmt<=2){var h=l.readUshort(r,a);a+=2,u.coverage=e._lctf.readCoverage(r,h+c)}if(s==1&&u.fmt==1){var f=l.readUshort(r,a);a+=2;var p=e._lctf.numOfOnes(f);f!=0&&(u.pos=e.GPOS.readValueRecord(r,a,f))}else if(s==2&&u.fmt>=1&&u.fmt<=2){f=l.readUshort(r,a),a+=2;var m=l.readUshort(r,a);a+=2,p=e._lctf.numOfOnes(f);var y=e._lctf.numOfOnes(m);if(u.fmt==1){u.pairsets=[];var v=l.readUshort(r,a);a+=2;for(var A=0;A<v;A++){var _=c+l.readUshort(r,a);a+=2;var x=l.readUshort(r,_);_+=2;for(var E=[],w=0;w<x;w++){var I=l.readUshort(r,_);_+=2,f!=0&&(U=e.GPOS.readValueRecord(r,_,f),_+=2*p),m!=0&&(O=e.GPOS.readValueRecord(r,_,m),_+=2*y),E.push({gid2:I,val1:U,val2:O})}u.pairsets.push(E)}}if(u.fmt==2){var T=l.readUshort(r,a);a+=2;var M=l.readUshort(r,a);a+=2;var b=l.readUshort(r,a);a+=2;var B=l.readUshort(r,a);for(a+=2,u.classDef1=e._lctf.readClassDef(r,c+T),u.classDef2=e._lctf.readClassDef(r,c+M),u.matrix=[],A=0;A<b;A++){var L=[];for(w=0;w<B;w++){var U=null,O=null;f!=0&&(U=e.GPOS.readValueRecord(r,a,f),a+=2*p),m!=0&&(O=e.GPOS.readValueRecord(r,a,m),a+=2*y),L.push({val1:U,val2:O})}u.matrix.push(L)}}}else{if(s==9&&u.fmt==1){var Q=l.readUshort(r,a);a+=2;var G=l.readUint(r,a);if(a+=4,o.ltype==9)o.ltype=Q;else if(o.ltype!=Q)throw"invalid extension substitution";return e.GPOS.subt(r,o.ltype,c+G)}console.debug("unsupported GPOS table LookupType",s,"format",u.fmt)}return u},e.GPOS.readValueRecord=function(r,s,a){var o=e._bin,l=[];return l.push(1&a?o.readShort(r,s):0),s+=1&a?2:0,l.push(2&a?o.readShort(r,s):0),s+=2&a?2:0,l.push(4&a?o.readShort(r,s):0),s+=4&a?2:0,l.push(8&a?o.readShort(r,s):0),s+=8&a?2:0,l},e.GSUB={},e.GSUB.parse=function(r,s,a,o){return e._lctf.parse(r,s,a,o,e.GSUB.subt)},e.GSUB.subt=function(r,s,a,o){var l=e._bin,c=a,u={};if(u.fmt=l.readUshort(r,a),a+=2,s!=1&&s!=4&&s!=5&&s!=6)return null;if(s==1||s==4||s==5&&u.fmt<=2||s==6&&u.fmt<=2){var h=l.readUshort(r,a);a+=2,u.coverage=e._lctf.readCoverage(r,c+h)}if(s==1&&u.fmt>=1&&u.fmt<=2){if(u.fmt==1)u.delta=l.readShort(r,a),a+=2;else if(u.fmt==2){var f=l.readUshort(r,a);a+=2,u.newg=l.readUshorts(r,a,f),a+=2*u.newg.length}}else if(s==4){u.vals=[],f=l.readUshort(r,a),a+=2;for(var p=0;p<f;p++){var m=l.readUshort(r,a);a+=2,u.vals.push(e.GSUB.readLigatureSet(r,c+m))}}else if(s==5&&u.fmt==2){if(u.fmt==2){var y=l.readUshort(r,a);a+=2,u.cDef=e._lctf.readClassDef(r,c+y),u.scset=[];var v=l.readUshort(r,a);for(a+=2,p=0;p<v;p++){var A=l.readUshort(r,a);a+=2,u.scset.push(A==0?null:e.GSUB.readSubClassSet(r,c+A))}}}else if(s==6&&u.fmt==3){if(u.fmt==3){for(p=0;p<3;p++){f=l.readUshort(r,a),a+=2;for(var _=[],x=0;x<f;x++)_.push(e._lctf.readCoverage(r,c+l.readUshort(r,a+2*x)));a+=2*f,p==0&&(u.backCvg=_),p==1&&(u.inptCvg=_),p==2&&(u.ahedCvg=_)}f=l.readUshort(r,a),a+=2,u.lookupRec=e.GSUB.readSubstLookupRecords(r,a,f)}}else{if(s==7&&u.fmt==1){var E=l.readUshort(r,a);a+=2;var w=l.readUint(r,a);if(a+=4,o.ltype==9)o.ltype=E;else if(o.ltype!=E)throw"invalid extension substitution";return e.GSUB.subt(r,o.ltype,c+w)}console.debug("unsupported GSUB table LookupType",s,"format",u.fmt)}return u},e.GSUB.readSubClassSet=function(r,s){var a=e._bin.readUshort,o=s,l=[],c=a(r,s);s+=2;for(var u=0;u<c;u++){var h=a(r,s);s+=2,l.push(e.GSUB.readSubClassRule(r,o+h))}return l},e.GSUB.readSubClassRule=function(r,s){var a=e._bin.readUshort,o={},l=a(r,s),c=a(r,s+=2);s+=2,o.input=[];for(var u=0;u<l-1;u++)o.input.push(a(r,s)),s+=2;return o.substLookupRecords=e.GSUB.readSubstLookupRecords(r,s,c),o},e.GSUB.readSubstLookupRecords=function(r,s,a){for(var o=e._bin.readUshort,l=[],c=0;c<a;c++)l.push(o(r,s),o(r,s+2)),s+=4;return l},e.GSUB.readChainSubClassSet=function(r,s){var a=e._bin,o=s,l=[],c=a.readUshort(r,s);s+=2;for(var u=0;u<c;u++){var h=a.readUshort(r,s);s+=2,l.push(e.GSUB.readChainSubClassRule(r,o+h))}return l},e.GSUB.readChainSubClassRule=function(r,s){for(var a=e._bin,o={},l=["backtrack","input","lookahead"],c=0;c<l.length;c++){var u=a.readUshort(r,s);s+=2,c==1&&u--,o[l[c]]=a.readUshorts(r,s,u),s+=2*o[l[c]].length}return u=a.readUshort(r,s),s+=2,o.subst=a.readUshorts(r,s,2*u),s+=2*o.subst.length,o},e.GSUB.readLigatureSet=function(r,s){var a=e._bin,o=s,l=[],c=a.readUshort(r,s);s+=2;for(var u=0;u<c;u++){var h=a.readUshort(r,s);s+=2,l.push(e.GSUB.readLigature(r,o+h))}return l},e.GSUB.readLigature=function(r,s){var a=e._bin,o={chain:[]};o.nglyph=a.readUshort(r,s),s+=2;var l=a.readUshort(r,s);s+=2;for(var c=0;c<l-1;c++)o.chain.push(a.readUshort(r,s)),s+=2;return o},e.head={},e.head.parse=function(r,s,a){var o=e._bin,l={};return o.readFixed(r,s),s+=4,l.fontRevision=o.readFixed(r,s),s+=4,o.readUint(r,s),s+=4,o.readUint(r,s),s+=4,l.flags=o.readUshort(r,s),s+=2,l.unitsPerEm=o.readUshort(r,s),s+=2,l.created=o.readUint64(r,s),s+=8,l.modified=o.readUint64(r,s),s+=8,l.xMin=o.readShort(r,s),s+=2,l.yMin=o.readShort(r,s),s+=2,l.xMax=o.readShort(r,s),s+=2,l.yMax=o.readShort(r,s),s+=2,l.macStyle=o.readUshort(r,s),s+=2,l.lowestRecPPEM=o.readUshort(r,s),s+=2,l.fontDirectionHint=o.readShort(r,s),s+=2,l.indexToLocFormat=o.readShort(r,s),s+=2,l.glyphDataFormat=o.readShort(r,s),s+=2,l},e.hhea={},e.hhea.parse=function(r,s,a){var o=e._bin,l={};return o.readFixed(r,s),s+=4,l.ascender=o.readShort(r,s),s+=2,l.descender=o.readShort(r,s),s+=2,l.lineGap=o.readShort(r,s),s+=2,l.advanceWidthMax=o.readUshort(r,s),s+=2,l.minLeftSideBearing=o.readShort(r,s),s+=2,l.minRightSideBearing=o.readShort(r,s),s+=2,l.xMaxExtent=o.readShort(r,s),s+=2,l.caretSlopeRise=o.readShort(r,s),s+=2,l.caretSlopeRun=o.readShort(r,s),s+=2,l.caretOffset=o.readShort(r,s),s+=2,s+=8,l.metricDataFormat=o.readShort(r,s),s+=2,l.numberOfHMetrics=o.readUshort(r,s),s+=2,l},e.hmtx={},e.hmtx.parse=function(r,s,a,o){for(var l=e._bin,c={aWidth:[],lsBearing:[]},u=0,h=0,f=0;f<o.maxp.numGlyphs;f++)f<o.hhea.numberOfHMetrics&&(u=l.readUshort(r,s),s+=2,h=l.readShort(r,s),s+=2),c.aWidth.push(u),c.lsBearing.push(h);return c},e.kern={},e.kern.parse=function(r,s,a,o){var l=e._bin,c=l.readUshort(r,s);if(s+=2,c==1)return e.kern.parseV1(r,s-2,a,o);var u=l.readUshort(r,s);s+=2;for(var h={glyph1:[],rval:[]},f=0;f<u;f++){s+=2,a=l.readUshort(r,s),s+=2;var p=l.readUshort(r,s);s+=2;var m=p>>>8;if((m&=15)!=0)throw"unknown kern table format: "+m;s=e.kern.readFormat0(r,s,h)}return h},e.kern.parseV1=function(r,s,a,o){var l=e._bin;l.readFixed(r,s),s+=4;var c=l.readUint(r,s);s+=4;for(var u={glyph1:[],rval:[]},h=0;h<c;h++){l.readUint(r,s),s+=4;var f=l.readUshort(r,s);s+=2,l.readUshort(r,s),s+=2;var p=f>>>8;if((p&=15)!=0)throw"unknown kern table format: "+p;s=e.kern.readFormat0(r,s,u)}return u},e.kern.readFormat0=function(r,s,a){var o=e._bin,l=-1,c=o.readUshort(r,s);s+=2,o.readUshort(r,s),s+=2,o.readUshort(r,s),s+=2,o.readUshort(r,s),s+=2;for(var u=0;u<c;u++){var h=o.readUshort(r,s);s+=2;var f=o.readUshort(r,s);s+=2;var p=o.readShort(r,s);s+=2,h!=l&&(a.glyph1.push(h),a.rval.push({glyph2:[],vals:[]}));var m=a.rval[a.rval.length-1];m.glyph2.push(f),m.vals.push(p),l=h}return s},e.loca={},e.loca.parse=function(r,s,a,o){var l=e._bin,c=[],u=o.head.indexToLocFormat,h=o.maxp.numGlyphs+1;if(u==0)for(var f=0;f<h;f++)c.push(l.readUshort(r,s+(f<<1))<<1);if(u==1)for(f=0;f<h;f++)c.push(l.readUint(r,s+(f<<2)));return c},e.maxp={},e.maxp.parse=function(r,s,a){var o=e._bin,l={},c=o.readUint(r,s);return s+=4,l.numGlyphs=o.readUshort(r,s),s+=2,c==65536&&(l.maxPoints=o.readUshort(r,s),s+=2,l.maxContours=o.readUshort(r,s),s+=2,l.maxCompositePoints=o.readUshort(r,s),s+=2,l.maxCompositeContours=o.readUshort(r,s),s+=2,l.maxZones=o.readUshort(r,s),s+=2,l.maxTwilightPoints=o.readUshort(r,s),s+=2,l.maxStorage=o.readUshort(r,s),s+=2,l.maxFunctionDefs=o.readUshort(r,s),s+=2,l.maxInstructionDefs=o.readUshort(r,s),s+=2,l.maxStackElements=o.readUshort(r,s),s+=2,l.maxSizeOfInstructions=o.readUshort(r,s),s+=2,l.maxComponentElements=o.readUshort(r,s),s+=2,l.maxComponentDepth=o.readUshort(r,s),s+=2),l},e.name={},e.name.parse=function(r,s,a){var o=e._bin,l={};o.readUshort(r,s),s+=2;var c=o.readUshort(r,s);s+=2,o.readUshort(r,s);for(var u,h=["copyright","fontFamily","fontSubfamily","ID","fullName","version","postScriptName","trademark","manufacturer","designer","description","urlVendor","urlDesigner","licence","licenceURL","---","typoFamilyName","typoSubfamilyName","compatibleFull","sampleText","postScriptCID","wwsFamilyName","wwsSubfamilyName","lightPalette","darkPalette"],f=s+=2,p=0;p<c;p++){var m=o.readUshort(r,s);s+=2;var y=o.readUshort(r,s);s+=2;var v=o.readUshort(r,s);s+=2;var A=o.readUshort(r,s);s+=2;var _=o.readUshort(r,s);s+=2;var x=o.readUshort(r,s);s+=2;var E,w=h[A],I=f+12*c+x;if(m==0)E=o.readUnicode(r,I,_/2);else if(m==3&&y==0)E=o.readUnicode(r,I,_/2);else if(y==0)E=o.readASCII(r,I,_);else if(y==1)E=o.readUnicode(r,I,_/2);else if(y==3)E=o.readUnicode(r,I,_/2);else{if(m!=1)throw"unknown encoding "+y+", platformID: "+m;E=o.readASCII(r,I,_),console.debug("reading unknown MAC encoding "+y+" as ASCII")}var T="p"+m+","+v.toString(16);l[T]==null&&(l[T]={}),l[T][w!==void 0?w:A]=E,l[T]._lang=v}for(var M in l)if(l[M].postScriptName!=null&&l[M]._lang==1033)return l[M];for(var M in l)if(l[M].postScriptName!=null&&l[M]._lang==0)return l[M];for(var M in l)if(l[M].postScriptName!=null&&l[M]._lang==3084)return l[M];for(var M in l)if(l[M].postScriptName!=null)return l[M];for(var M in l){u=M;break}return console.debug("returning name table with languageID "+l[u]._lang),l[u]},e["OS/2"]={},e["OS/2"].parse=function(r,s,a){var o=e._bin.readUshort(r,s);s+=2;var l={};if(o==0)e["OS/2"].version0(r,s,l);else if(o==1)e["OS/2"].version1(r,s,l);else if(o==2||o==3||o==4)e["OS/2"].version2(r,s,l);else{if(o!=5)throw"unknown OS/2 table version: "+o;e["OS/2"].version5(r,s,l)}return l},e["OS/2"].version0=function(r,s,a){var o=e._bin;return a.xAvgCharWidth=o.readShort(r,s),s+=2,a.usWeightClass=o.readUshort(r,s),s+=2,a.usWidthClass=o.readUshort(r,s),s+=2,a.fsType=o.readUshort(r,s),s+=2,a.ySubscriptXSize=o.readShort(r,s),s+=2,a.ySubscriptYSize=o.readShort(r,s),s+=2,a.ySubscriptXOffset=o.readShort(r,s),s+=2,a.ySubscriptYOffset=o.readShort(r,s),s+=2,a.ySuperscriptXSize=o.readShort(r,s),s+=2,a.ySuperscriptYSize=o.readShort(r,s),s+=2,a.ySuperscriptXOffset=o.readShort(r,s),s+=2,a.ySuperscriptYOffset=o.readShort(r,s),s+=2,a.yStrikeoutSize=o.readShort(r,s),s+=2,a.yStrikeoutPosition=o.readShort(r,s),s+=2,a.sFamilyClass=o.readShort(r,s),s+=2,a.panose=o.readBytes(r,s,10),s+=10,a.ulUnicodeRange1=o.readUint(r,s),s+=4,a.ulUnicodeRange2=o.readUint(r,s),s+=4,a.ulUnicodeRange3=o.readUint(r,s),s+=4,a.ulUnicodeRange4=o.readUint(r,s),s+=4,a.achVendID=[o.readInt8(r,s),o.readInt8(r,s+1),o.readInt8(r,s+2),o.readInt8(r,s+3)],s+=4,a.fsSelection=o.readUshort(r,s),s+=2,a.usFirstCharIndex=o.readUshort(r,s),s+=2,a.usLastCharIndex=o.readUshort(r,s),s+=2,a.sTypoAscender=o.readShort(r,s),s+=2,a.sTypoDescender=o.readShort(r,s),s+=2,a.sTypoLineGap=o.readShort(r,s),s+=2,a.usWinAscent=o.readUshort(r,s),s+=2,a.usWinDescent=o.readUshort(r,s),s+=2},e["OS/2"].version1=function(r,s,a){var o=e._bin;return s=e["OS/2"].version0(r,s,a),a.ulCodePageRange1=o.readUint(r,s),s+=4,a.ulCodePageRange2=o.readUint(r,s),s+=4},e["OS/2"].version2=function(r,s,a){var o=e._bin;return s=e["OS/2"].version1(r,s,a),a.sxHeight=o.readShort(r,s),s+=2,a.sCapHeight=o.readShort(r,s),s+=2,a.usDefault=o.readUshort(r,s),s+=2,a.usBreak=o.readUshort(r,s),s+=2,a.usMaxContext=o.readUshort(r,s),s+=2},e["OS/2"].version5=function(r,s,a){var o=e._bin;return s=e["OS/2"].version2(r,s,a),a.usLowerOpticalPointSize=o.readUshort(r,s),s+=2,a.usUpperOpticalPointSize=o.readUshort(r,s),s+=2},e.post={},e.post.parse=function(r,s,a){var o=e._bin,l={};return l.version=o.readFixed(r,s),s+=4,l.italicAngle=o.readFixed(r,s),s+=4,l.underlinePosition=o.readShort(r,s),s+=2,l.underlineThickness=o.readShort(r,s),s+=2,l},e==null&&(e={}),e.U==null&&(e.U={}),e.U.codeToGlyph=function(r,s){var a=r.cmap,o=-1;if(a.p0e4!=null?o=a.p0e4:a.p3e1!=null?o=a.p3e1:a.p1e0!=null?o=a.p1e0:a.p0e3!=null&&(o=a.p0e3),o==-1)throw"no familiar platform and encoding!";var l=a.tables[o];if(l.format==0)return s>=l.map.length?0:l.map[s];if(l.format==4){for(var c=-1,u=0;u<l.endCount.length;u++)if(s<=l.endCount[u]){c=u;break}return c==-1||l.startCount[c]>s?0:65535&(l.idRangeOffset[c]!=0?l.glyphIdArray[s-l.startCount[c]+(l.idRangeOffset[c]>>1)-(l.idRangeOffset.length-c)]:s+l.idDelta[c])}if(l.format==12){if(s>l.groups[l.groups.length-1][1])return 0;for(u=0;u<l.groups.length;u++){var h=l.groups[u];if(h[0]<=s&&s<=h[1])return h[2]+(s-h[0])}return 0}throw"unknown cmap table format "+l.format},e.U.glyphToPath=function(r,s){var a={cmds:[],crds:[]};if(r.SVG&&r.SVG.entries[s]){var o=r.SVG.entries[s];return o==null?a:(typeof o=="string"&&(o=e.SVG.toPath(o),r.SVG.entries[s]=o),o)}if(r.CFF){var l={x:0,y:0,stack:[],nStems:0,haveWidth:!1,width:r.CFF.Private?r.CFF.Private.defaultWidthX:0,open:!1},c=r.CFF,u=r.CFF.Private;if(c.ROS){for(var h=0;c.FDSelect[h+2]<=s;)h+=2;u=c.FDArray[c.FDSelect[h+1]].Private}e.U._drawCFF(r.CFF.CharStrings[s],l,c,u,a)}else r.glyf&&e.U._drawGlyf(s,r,a);return a},e.U._drawGlyf=function(r,s,a){var o=s.glyf[r];o==null&&(o=s.glyf[r]=e.glyf._parseGlyf(s,r)),o!=null&&(o.noc>-1?e.U._simpleGlyph(o,a):e.U._compoGlyph(o,s,a))},e.U._simpleGlyph=function(r,s){for(var a=0;a<r.noc;a++){for(var o=a==0?0:r.endPts[a-1]+1,l=r.endPts[a],c=o;c<=l;c++){var u=c==o?l:c-1,h=c==l?o:c+1,f=1&r.flags[c],p=1&r.flags[u],m=1&r.flags[h],y=r.xs[c],v=r.ys[c];if(c==o)if(f){if(!p){e.U.P.moveTo(s,y,v);continue}e.U.P.moveTo(s,r.xs[u],r.ys[u])}else p?e.U.P.moveTo(s,r.xs[u],r.ys[u]):e.U.P.moveTo(s,(r.xs[u]+y)/2,(r.ys[u]+v)/2);f?p&&e.U.P.lineTo(s,y,v):m?e.U.P.qcurveTo(s,y,v,r.xs[h],r.ys[h]):e.U.P.qcurveTo(s,y,v,(y+r.xs[h])/2,(v+r.ys[h])/2)}e.U.P.closePath(s)}},e.U._compoGlyph=function(r,s,a){for(var o=0;o<r.parts.length;o++){var l={cmds:[],crds:[]},c=r.parts[o];e.U._drawGlyf(c.glyphIndex,s,l);for(var u=c.m,h=0;h<l.crds.length;h+=2){var f=l.crds[h],p=l.crds[h+1];a.crds.push(f*u.a+p*u.b+u.tx),a.crds.push(f*u.c+p*u.d+u.ty)}for(h=0;h<l.cmds.length;h++)a.cmds.push(l.cmds[h])}},e.U._getGlyphClass=function(r,s){var a=e._lctf.getInterval(s,r);return a==-1?0:s[a+2]},e.U.getPairAdjustment=function(r,s,a){var o=!1;if(r.GPOS)for(var l=r.GPOS,c=l.lookupList,u=l.featureList,h=[],f=0;f<u.length;f++){var p=u[f];if(p.tag=="kern"){o=!0;for(var m=0;m<p.tab.length;m++)if(!h[p.tab[m]]){h[p.tab[m]]=!0;for(var y=c[p.tab[m]],v=0;v<y.tabs.length;v++)if(y.tabs[v]!=null){var A,_=y.tabs[v];if((!_.coverage||(A=e._lctf.coverageIndex(_.coverage,s))!=-1)&&y.ltype!=1){if(y.ltype==2){var x=null;if(_.fmt==1){var E=_.pairsets[A];for(f=0;f<E.length;f++)E[f].gid2==a&&(x=E[f])}else if(_.fmt==2){var w=e.U._getGlyphClass(s,_.classDef1),I=e.U._getGlyphClass(a,_.classDef2);x=_.matrix[w][I]}if(x){var T=0;return x.val1&&x.val1[2]&&(T+=x.val1[2]),x.val2&&x.val2[0]&&(T+=x.val2[0]),T}}}}}}}if(r.kern&&!o){var M=r.kern.glyph1.indexOf(s);if(M!=-1){var b=r.kern.rval[M].glyph2.indexOf(a);if(b!=-1)return r.kern.rval[M].vals[b]}}return 0},e.U._applySubs=function(r,s,a,o){for(var l=r.length-s-1,c=0;c<a.tabs.length;c++)if(a.tabs[c]!=null){var u,h=a.tabs[c];if(!h.coverage||(u=e._lctf.coverageIndex(h.coverage,r[s]))!=-1){if(a.ltype==1)r[s],h.fmt==1?r[s]=r[s]+h.delta:r[s]=h.newg[u];else if(a.ltype==4)for(var f=h.vals[u],p=0;p<f.length;p++){var m=f[p],y=m.chain.length;if(!(y>l)){for(var v=!0,A=0,_=0;_<y;_++){for(;r[s+A+(1+_)]==-1;)A++;m.chain[_]!=r[s+A+(1+_)]&&(v=!1)}if(v){for(r[s]=m.nglyph,_=0;_<y+A;_++)r[s+_+1]=-1;break}}}else if(a.ltype==5&&h.fmt==2)for(var x=e._lctf.getInterval(h.cDef,r[s]),E=h.cDef[x+2],w=h.scset[E],I=0;I<w.length;I++){var T=w[I],M=T.input;if(!(M.length>l)){for(v=!0,_=0;_<M.length;_++){var b=e._lctf.getInterval(h.cDef,r[s+1+_]);if(x==-1&&h.cDef[b+2]!=M[_]){v=!1;break}}if(v){var B=T.substLookupRecords;for(p=0;p<B.length;p+=2)B[p],B[p+1]}}}else if(a.ltype==6&&h.fmt==3){if(!e.U._glsCovered(r,h.backCvg,s-h.backCvg.length)||!e.U._glsCovered(r,h.inptCvg,s)||!e.U._glsCovered(r,h.ahedCvg,s+h.inptCvg.length))continue;var L=h.lookupRec;for(I=0;I<L.length;I+=2){x=L[I];var U=o[L[I+1]];e.U._applySubs(r,s+x,U,o)}}}}},e.U._glsCovered=function(r,s,a){for(var o=0;o<s.length;o++)if(e._lctf.coverageIndex(s[o],r[a+o])==-1)return!1;return!0},e.U.glyphsToPath=function(r,s,a){for(var o={cmds:[],crds:[]},l=0,c=0;c<s.length;c++){var u=s[c];if(u!=-1){for(var h=c<s.length-1&&s[c+1]!=-1?s[c+1]:0,f=e.U.glyphToPath(r,u),p=0;p<f.crds.length;p+=2)o.crds.push(f.crds[p]+l),o.crds.push(f.crds[p+1]);for(a&&o.cmds.push(a),p=0;p<f.cmds.length;p++)o.cmds.push(f.cmds[p]);a&&o.cmds.push("X"),l+=r.hmtx.aWidth[u],c<s.length-1&&(l+=e.U.getPairAdjustment(r,u,h))}}return o},e.U.P={},e.U.P.moveTo=function(r,s,a){r.cmds.push("M"),r.crds.push(s,a)},e.U.P.lineTo=function(r,s,a){r.cmds.push("L"),r.crds.push(s,a)},e.U.P.curveTo=function(r,s,a,o,l,c,u){r.cmds.push("C"),r.crds.push(s,a,o,l,c,u)},e.U.P.qcurveTo=function(r,s,a,o,l){r.cmds.push("Q"),r.crds.push(s,a,o,l)},e.U.P.closePath=function(r){r.cmds.push("Z")},e.U._drawCFF=function(r,s,a,o,l){for(var c=s.stack,u=s.nStems,h=s.haveWidth,f=s.width,p=s.open,m=0,y=s.x,v=s.y,A=0,_=0,x=0,E=0,w=0,I=0,T=0,M=0,b=0,B=0,L={val:0,size:0};m<r.length;){e.CFF.getCharString(r,m,L);var U=L.val;if(m+=L.size,U=="o1"||U=="o18")c.length%2!=0&&!h&&(f=c.shift()+o.nominalWidthX),u+=c.length>>1,c.length=0,h=!0;else if(U=="o3"||U=="o23")c.length%2!=0&&!h&&(f=c.shift()+o.nominalWidthX),u+=c.length>>1,c.length=0,h=!0;else if(U=="o4")c.length>1&&!h&&(f=c.shift()+o.nominalWidthX,h=!0),p&&e.U.P.closePath(l),v+=c.pop(),e.U.P.moveTo(l,y,v),p=!0;else if(U=="o5")for(;c.length>0;)y+=c.shift(),v+=c.shift(),e.U.P.lineTo(l,y,v);else if(U=="o6"||U=="o7")for(var O=c.length,Q=U=="o6",G=0;G<O;G++){var F=c.shift();Q?y+=F:v+=F,Q=!Q,e.U.P.lineTo(l,y,v)}else if(U=="o8"||U=="o24"){O=c.length;for(var q=0;q+6<=O;)A=y+c.shift(),_=v+c.shift(),x=A+c.shift(),E=_+c.shift(),y=x+c.shift(),v=E+c.shift(),e.U.P.curveTo(l,A,_,x,E,y,v),q+=6;U=="o24"&&(y+=c.shift(),v+=c.shift(),e.U.P.lineTo(l,y,v))}else{if(U=="o11")break;if(U=="o1234"||U=="o1235"||U=="o1236"||U=="o1237")U=="o1234"&&(_=v,x=(A=y+c.shift())+c.shift(),B=E=_+c.shift(),I=E,M=v,y=(T=(w=(b=x+c.shift())+c.shift())+c.shift())+c.shift(),e.U.P.curveTo(l,A,_,x,E,b,B),e.U.P.curveTo(l,w,I,T,M,y,v)),U=="o1235"&&(A=y+c.shift(),_=v+c.shift(),x=A+c.shift(),E=_+c.shift(),b=x+c.shift(),B=E+c.shift(),w=b+c.shift(),I=B+c.shift(),T=w+c.shift(),M=I+c.shift(),y=T+c.shift(),v=M+c.shift(),c.shift(),e.U.P.curveTo(l,A,_,x,E,b,B),e.U.P.curveTo(l,w,I,T,M,y,v)),U=="o1236"&&(A=y+c.shift(),_=v+c.shift(),x=A+c.shift(),B=E=_+c.shift(),I=E,T=(w=(b=x+c.shift())+c.shift())+c.shift(),M=I+c.shift(),y=T+c.shift(),e.U.P.curveTo(l,A,_,x,E,b,B),e.U.P.curveTo(l,w,I,T,M,y,v)),U=="o1237"&&(A=y+c.shift(),_=v+c.shift(),x=A+c.shift(),E=_+c.shift(),b=x+c.shift(),B=E+c.shift(),w=b+c.shift(),I=B+c.shift(),T=w+c.shift(),M=I+c.shift(),Math.abs(T-y)>Math.abs(M-v)?y=T+c.shift():v=M+c.shift(),e.U.P.curveTo(l,A,_,x,E,b,B),e.U.P.curveTo(l,w,I,T,M,y,v));else if(U=="o14"){if(c.length>0&&!h&&(f=c.shift()+a.nominalWidthX,h=!0),c.length==4){var Y=c.shift(),H=c.shift(),V=c.shift(),D=c.shift(),k=e.CFF.glyphBySE(a,V),Z=e.CFF.glyphBySE(a,D);e.U._drawCFF(a.CharStrings[k],s,a,o,l),s.x=Y,s.y=H,e.U._drawCFF(a.CharStrings[Z],s,a,o,l)}p&&(e.U.P.closePath(l),p=!1)}else if(U=="o19"||U=="o20")c.length%2!=0&&!h&&(f=c.shift()+o.nominalWidthX),u+=c.length>>1,c.length=0,h=!0,m+=u+7>>3;else if(U=="o21")c.length>2&&!h&&(f=c.shift()+o.nominalWidthX,h=!0),v+=c.pop(),y+=c.pop(),p&&e.U.P.closePath(l),e.U.P.moveTo(l,y,v),p=!0;else if(U=="o22")c.length>1&&!h&&(f=c.shift()+o.nominalWidthX,h=!0),y+=c.pop(),p&&e.U.P.closePath(l),e.U.P.moveTo(l,y,v),p=!0;else if(U=="o25"){for(;c.length>6;)y+=c.shift(),v+=c.shift(),e.U.P.lineTo(l,y,v);A=y+c.shift(),_=v+c.shift(),x=A+c.shift(),E=_+c.shift(),y=x+c.shift(),v=E+c.shift(),e.U.P.curveTo(l,A,_,x,E,y,v)}else if(U=="o26")for(c.length%2&&(y+=c.shift());c.length>0;)A=y,_=v+c.shift(),y=x=A+c.shift(),v=(E=_+c.shift())+c.shift(),e.U.P.curveTo(l,A,_,x,E,y,v);else if(U=="o27")for(c.length%2&&(v+=c.shift());c.length>0;)_=v,x=(A=y+c.shift())+c.shift(),E=_+c.shift(),y=x+c.shift(),v=E,e.U.P.curveTo(l,A,_,x,E,y,v);else if(U=="o10"||U=="o29"){var j=U=="o10"?o:a;if(c.length==0)console.debug("error: empty stack");else{var ee=c.pop(),ie=j.Subrs[ee+j.Bias];s.x=y,s.y=v,s.nStems=u,s.haveWidth=h,s.width=f,s.open=p,e.U._drawCFF(ie,s,a,o,l),y=s.x,v=s.y,u=s.nStems,h=s.haveWidth,f=s.width,p=s.open}}else if(U=="o30"||U=="o31"){var te=c.length,re=(q=0,U=="o31");for(q+=te-(O=-3&te);q<O;)re?(_=v,x=(A=y+c.shift())+c.shift(),v=(E=_+c.shift())+c.shift(),O-q==5?(y=x+c.shift(),q++):y=x,re=!1):(A=y,_=v+c.shift(),x=A+c.shift(),E=_+c.shift(),y=x+c.shift(),O-q==5?(v=E+c.shift(),q++):v=E,re=!0),e.U.P.curveTo(l,A,_,x,E,y,v),q+=4}else{if((U+"").charAt(0)=="o")throw console.debug("Unknown operation: "+U,r),U;c.push(U)}}}s.x=y,s.y=v,s.nStems=u,s.haveWidth=h,s.width=f,s.open=p};var t=e,i={Typr:t};return n.Typr=t,n.default=i,Object.defineProperty(n,"__esModule",{value:!0}),n}({}).Typr}/*!
Custom bundle of woff2otf (https://github.com/arty-name/woff2otf) with fflate
(https://github.com/101arrowz/fflate) for use in Troika text rendering.
Original licenses apply:
- fflate: https://github.com/101arrowz/fflate/blob/master/LICENSE (MIT)
- woff2otf.js: https://github.com/arty-name/woff2otf/blob/master/woff2otf.js (Apache2)
*/function wce(){return function(n){var e=Uint8Array,t=Uint16Array,i=Uint32Array,r=new e([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),s=new e([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new e([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=function(U,O){for(var Q=new t(31),G=0;G<31;++G)Q[G]=O+=1<<U[G-1];var F=new i(Q[30]);for(G=1;G<30;++G)for(var q=Q[G];q<Q[G+1];++q)F[q]=q-Q[G]<<5|G;return[Q,F]},l=o(r,2),c=l[0],u=l[1];c[28]=258,u[258]=28;for(var h=o(s,0)[0],f=new t(32768),p=0;p<32768;++p){var m=(43690&p)>>>1|(21845&p)<<1;m=(61680&(m=(52428&m)>>>2|(13107&m)<<2))>>>4|(3855&m)<<4,f[p]=((65280&m)>>>8|(255&m)<<8)>>>1}var y=function(U,O,Q){for(var G=U.length,F=0,q=new t(O);F<G;++F)++q[U[F]-1];var Y,H=new t(O);for(F=0;F<O;++F)H[F]=H[F-1]+q[F-1]<<1;if(Q){Y=new t(1<<O);var V=15-O;for(F=0;F<G;++F)if(U[F])for(var D=F<<4|U[F],k=O-U[F],Z=H[U[F]-1]++<<k,j=Z|(1<<k)-1;Z<=j;++Z)Y[f[Z]>>>V]=D}else for(Y=new t(G),F=0;F<G;++F)U[F]&&(Y[F]=f[H[U[F]-1]++]>>>15-U[F]);return Y},v=new e(288);for(p=0;p<144;++p)v[p]=8;for(p=144;p<256;++p)v[p]=9;for(p=256;p<280;++p)v[p]=7;for(p=280;p<288;++p)v[p]=8;var A=new e(32);for(p=0;p<32;++p)A[p]=5;var _=y(v,9,1),x=y(A,5,1),E=function(U){for(var O=U[0],Q=1;Q<U.length;++Q)U[Q]>O&&(O=U[Q]);return O},w=function(U,O,Q){var G=O/8|0;return(U[G]|U[G+1]<<8)>>(7&O)&Q},I=function(U,O){var Q=O/8|0;return(U[Q]|U[Q+1]<<8|U[Q+2]<<16)>>(7&O)},T=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],M=function(U,O,Q){var G=new Error(O||T[U]);if(G.code=U,Error.captureStackTrace&&Error.captureStackTrace(G,M),!Q)throw G;return G},b=function(U,O,Q){var G=U.length;if(!G||Q&&!Q.l&&G<5)return O||new e(0);var F=!O||Q,q=!Q||Q.i;Q||(Q={}),O||(O=new e(3*G));var Y,H=function(Oe){var Ve=O.length;if(Oe>Ve){var it=new e(Math.max(2*Ve,Oe));it.set(O),O=it}},V=Q.f||0,D=Q.p||0,k=Q.b||0,Z=Q.l,j=Q.d,ee=Q.m,ie=Q.n,te=8*G;do{if(!Z){Q.f=V=w(U,D,1);var re=w(U,D+1,3);if(D+=3,!re){var ce=U[(Le=((Y=D)/8|0)+(7&Y&&1)+4)-4]|U[Le-3]<<8,ye=Le+ce;if(ye>G){q&&M(0);break}F&&H(k+ce),O.set(U.subarray(Le,ye),k),Q.b=k+=ce,Q.p=D=8*ye;continue}if(re==1)Z=_,j=x,ee=9,ie=5;else if(re==2){var oe=w(U,D,31)+257,W=w(U,D+10,15)+4,ge=oe+w(U,D+5,31)+1;D+=14;for(var he=new e(ge),ue=new e(19),fe=0;fe<W;++fe)ue[a[fe]]=w(U,D+3*fe,7);D+=3*W;var Pe=E(ue),pe=(1<<Pe)-1,Re=y(ue,Pe,1);for(fe=0;fe<ge;){var Le,Se=Re[w(U,D,pe)];if(D+=15&Se,(Le=Se>>>4)<16)he[fe++]=Le;else{var $e=0,X=0;for(Le==16?(X=3+w(U,D,3),D+=2,$e=he[fe-1]):Le==17?(X=3+w(U,D,7),D+=3):Le==18&&(X=11+w(U,D,127),D+=7);X--;)he[fe++]=$e}}var z=he.subarray(0,oe),se=he.subarray(oe);ee=E(z),ie=E(se),Z=y(z,ee,1),j=y(se,ie,1)}else M(1);if(D>te){q&&M(0);break}}F&&H(k+131072);for(var Be=(1<<ee)-1,Ce=(1<<ie)-1,we=D;;we=D){var ke=($e=Z[I(U,D)&Be])>>>4;if((D+=15&$e)>te){q&&M(0);break}if($e||M(2),ke<256)O[k++]=ke;else{if(ke==256){we=D,Z=null;break}var Ue=ke-254;if(ke>264){var xe=r[fe=ke-257];Ue=w(U,D,(1<<xe)-1)+c[fe],D+=xe}var ze=j[I(U,D)&Ce],je=ze>>>4;if(ze||M(3),D+=15&ze,se=h[je],je>3&&(xe=s[je],se+=I(U,D)&(1<<xe)-1,D+=xe),D>te){q&&M(0);break}F&&H(k+131072);for(var We=k+Ue;k<We;k+=4)O[k]=O[k-se],O[k+1]=O[k+1-se],O[k+2]=O[k+2-se],O[k+3]=O[k+3-se];k=We}}Q.l=Z,Q.p=we,Q.b=k,Z&&(V=1,Q.m=ee,Q.d=j,Q.n=ie)}while(!V);return k==O.length?O:function(Oe,Ve,it){(Ve==null||Ve<0)&&(Ve=0),(it==null||it>Oe.length)&&(it=Oe.length);var gt=new(Oe instanceof t?t:Oe instanceof i?i:e)(it-Ve);return gt.set(Oe.subarray(Ve,it)),gt}(O,0,k)},B=new e(0),L=typeof TextDecoder<"u"&&new TextDecoder;try{L.decode(B,{stream:!0})}catch{}return n.convert_streams=function(U){var O=new DataView(U),Q=0;function G(){var oe=O.getUint16(Q);return Q+=2,oe}function F(){var oe=O.getUint32(Q);return Q+=4,oe}function q(oe){ce.setUint16(ye,oe),ye+=2}function Y(oe){ce.setUint32(ye,oe),ye+=4}for(var H={signature:F(),flavor:F(),length:F(),numTables:G(),reserved:G(),totalSfntSize:F(),majorVersion:G(),minorVersion:G(),metaOffset:F(),metaLength:F(),metaOrigLength:F(),privOffset:F(),privLength:F()},V=0;Math.pow(2,V)<=H.numTables;)V++;V--;for(var D=16*Math.pow(2,V),k=16*H.numTables-D,Z=12,j=[],ee=0;ee<H.numTables;ee++)j.push({tag:F(),offset:F(),compLength:F(),origLength:F(),origChecksum:F()}),Z+=16;var ie,te=new Uint8Array(12+16*j.length+j.reduce(function(oe,W){return oe+W.origLength+4},0)),re=te.buffer,ce=new DataView(re),ye=0;return Y(H.flavor),q(H.numTables),q(D),q(V),q(k),j.forEach(function(oe){Y(oe.tag),Y(oe.origChecksum),Y(Z),Y(oe.origLength),oe.outOffset=Z,(Z+=oe.origLength)%4!=0&&(Z+=4-Z%4)}),j.forEach(function(oe){var W,ge=U.slice(oe.offset,oe.offset+oe.compLength);if(oe.compLength!=oe.origLength){var he=new Uint8Array(oe.origLength);W=new Uint8Array(ge,2),b(W,he)}else he=new Uint8Array(ge);te.set(he,oe.outOffset);var ue=0;(Z=oe.outOffset+oe.origLength)%4!=0&&(ue=4-Z%4),te.set(new Uint8Array(ue).buffer,oe.outOffset+oe.origLength),ie=Z+ue}),re.slice(0,ie)},Object.defineProperty(n,"__esModule",{value:!0}),n}({}).convert_streams}function Cce(n,e){const t={M:2,L:2,Q:4,C:6,Z:0},i={C:"18g,ca,368,1kz",D:"17k,6,2,2+4,5+c,2+6,2+1,10+1,9+f,j+11,2+1,a,2,2+1,15+2,3,j+2,6+3,2+8,2,2,2+1,w+a,4+e,3+3,2,3+2,3+5,23+w,2f+4,3,2+9,2,b,2+3,3,1k+9,6+1,3+1,2+2,2+d,30g,p+y,1,1+1g,f+x,2,sd2+1d,jf3+4,f+3,2+4,2+2,b+3,42,2,4+2,2+1,2,3,t+1,9f+w,2,el+2,2+g,d+2,2l,2+1,5,3+1,2+1,2,3,6,16wm+1v",R:"17m+3,2,2,6+3,m,15+2,2+2,h+h,13,3+8,2,2,3+1,2,p+1,x,5+4,5,a,2,2,3,u,c+2,g+1,5,2+1,4+1,5j,6+1,2,b,2+2,f,2+1,1s+2,2,3+1,7,1ez0,2,2+1,4+4,b,4,3,b,42,2+2,4,3,2+1,2,o+3,ae,ep,x,2o+2,3+1,3,5+1,6",L:"x9u,jff,a,fd,jv",T:"4t,gj+33,7o+4,1+1,7c+18,2,2+1,2+1,2,21+a,2,1b+k,h,2u+6,3+5,3+1,2+3,y,2,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,3,7,6+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+d,1,1+1,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,ek,3+1,r+4,1e+4,6+5,2p+c,1+3,1,1+2,1+b,2db+2,3y,2p+v,ff+3,30+1,n9x,1+2,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,5s,6y+2,ea,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+9,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2,2b+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,470+8,at4+4,1o+6,t5,1s+3,2a,f5l+1,2+3,43o+2,a+7,1+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,1,gzau,v+2n,3l+6n"},r=1,s=2,a=4,o=8,l=16,c=32;let u;function h(w){if(!u){const I={R:s,L:r,D:a,C:l,U:c,T:o};u=new Map;for(let T in i){let M=0;i[T].split(",").forEach(b=>{let[B,L]=b.split("+");B=parseInt(B,36),L=L?parseInt(L,36):0,u.set(M+=B,I[T]);for(let U=L;U--;)u.set(++M,I[T])})}}return u.get(w)||c}const f=1,p=2,m=3,y=4,v=[null,"isol","init","fina","medi"];function A(w){const I=new Uint8Array(w.length);let T=c,M=f,b=-1;for(let B=0;B<w.length;B++){const L=w.codePointAt(B);let U=h(L)|0,O=f;U&o||(T&(r|a|l)?U&(s|a|l)?(O=m,(M===f||M===m)&&I[b]++):U&(r|c)&&(M===p||M===y)&&I[b]--:T&(s|c)&&(M===p||M===y)&&I[b]--,M=I[B]=O,T=U,b=B,L>65535&&B++)}return I}function _(w,I){const T=[];for(let b=0;b<I.length;b++){const B=I.codePointAt(b);B>65535&&b++,T.push(n.U.codeToGlyph(w,B))}const M=w.GSUB;if(M){const{lookupList:b,featureList:B}=M;let L;const U=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws)$/,O=[];B.forEach(Q=>{if(U.test(Q.tag))for(let G=0;G<Q.tab.length;G++){if(O[Q.tab[G]])continue;O[Q.tab[G]]=!0;const F=b[Q.tab[G]],q=/^(isol|init|fina|medi)$/.test(Q.tag);q&&!L&&(L=A(I));for(let Y=0;Y<T.length;Y++)(!L||!q||v[L[Y]]===Q.tag)&&n.U._applySubs(T,Y,F,b)}})}return T}function x(...w){for(let I=0;I<w.length;I++)if(typeof w[I]=="number")return w[I]}function E(w){const I=Object.create(null),T=w["OS/2"],M=w.hhea,b=w.head.unitsPerEm,B=x(T&&T.sTypoAscender,M&&M.ascender,b),L={unitsPerEm:b,ascender:B,descender:x(T&&T.sTypoDescender,M&&M.descender,0),capHeight:x(T&&T.sCapHeight,B),xHeight:x(T&&T.sxHeight,B),lineGap:x(T&&T.sTypoLineGap,M&&M.lineGap),forEachGlyph(U,O,Q,G){let F=0;const q=1/L.unitsPerEm*O,Y=_(w,U);let H=0,V=-1;return Y.forEach((D,k)=>{if(D!==-1){let Z=I[D];if(!Z){const{cmds:j,crds:ee}=n.U.glyphToPath(w,D);let ie="",te=0;for(let W=0,ge=j.length;W<ge;W++){const he=t[j[W]];ie+=j[W];for(let ue=1;ue<=he;ue++)ie+=(ue>1?",":"")+ee[te++]}let re,ce,ye,oe;if(ee.length){re=ce=1/0,ye=oe=-1/0;for(let W=0,ge=ee.length;W<ge;W+=2){let he=ee[W],ue=ee[W+1];he<re&&(re=he),ue<ce&&(ce=ue),he>ye&&(ye=he),ue>oe&&(oe=ue)}}else re=ye=ce=oe=0;Z=I[D]={index:D,advanceWidth:w.hmtx.aWidth[D],xMin:re,yMin:ce,xMax:ye,yMax:oe,path:ie,pathCommandCount:j.length}}V!==-1&&(F+=n.U.getPairAdjustment(w,V,D)*q),G.call(null,Z,F,H),Z.advanceWidth&&(F+=Z.advanceWidth*q),Q&&(F+=Q*O),V=D}H+=U.codePointAt(H)>65535?2:1}),F}};return L}return function(I){const T=new Uint8Array(I,0,4),M=n._bin.readASCII(T,0,4);if(M==="wOFF")I=e(I);else if(M==="wOF2")throw new Error("woff2 fonts not supported");return E(n.parse(I)[0])}}const Tce=Y0({name:"Typr Font Parser",dependencies:[Sce,wce,Cce],init(n,e,t){const i=n(),r=e();return t(i,r)}}),Dh={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff",sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},bce=new He;function mh(){return(self.performance||Date).now()}const Ew=Object.create(null);function VB(n,e){n=Rce({},n);const t=mh();if(n.font=Bce(n.font||Dh.defaultFontURL),n.text=""+n.text,n.sdfGlyphSize=n.sdfGlyphSize||Dh.sdfGlyphSize,n.colorRanges!=null){let h={};for(let f in n.colorRanges)if(n.colorRanges.hasOwnProperty(f)){let p=n.colorRanges[f];typeof p!="number"&&(p=bce.set(p).getHex()),h[f]=p}n.colorRanges=h}Object.freeze(n);const{textureWidth:i,sdfExponent:r}=Dh,{sdfGlyphSize:s}=n,a=i/s*4;let o=Ew[s];if(!o){const h=document.createElement("canvas");h.width=i,h.height=s*256/a,o=Ew[s]={glyphCount:0,sdfGlyphSize:s,sdfCanvas:h,sdfTexture:new Vn(h,void 0,void 0,void 0,Tn,Tn),contextLost:!1,glyphsByFont:new Map},o.sdfTexture.generateMipmaps=!1,Ice(o)}const{sdfTexture:l,sdfCanvas:c}=o;let u=o.glyphsByFont.get(n.font);u||o.glyphsByFont.set(n.font,u=new Map),Pce(n).then(h=>{const{glyphIds:f,glyphPositions:p,fontSize:m,unitsPerEm:y,timings:v}=h,A=[],_=new Float32Array(f.length*4),x=m/y;let E=0,w=0;const I=mh();f.forEach((L,U)=>{let O=u.get(L);if(!O){const{path:q,pathBounds:Y}=h.glyphData[L],H=Math.max(Y[2]-Y[0],Y[3]-Y[1])/s*(Dh.sdfMargin*s+.5),V=o.glyphCount++,D=[Y[0]-H,Y[1]-H,Y[2]+H,Y[3]+H];u.set(L,O={path:q,atlasIndex:V,sdfViewBox:D}),A.push(O)}const{sdfViewBox:Q}=O,G=p[w++],F=p[w++];_[E++]=G+Q[0]*x,_[E++]=F+Q[1]*x,_[E++]=G+Q[2]*x,_[E++]=F+Q[3]*x,f[U]=O.atlasIndex}),v.quads=(v.quads||0)+(mh()-I);const T=mh();v.sdf={};const M=c.height,b=Math.ceil(o.glyphCount/a),B=Math.pow(2,Math.ceil(Math.log2(b*s)));B>M&&(console.info(`Increasing SDF texture size ${M}->${B}`),Ece(c,i,B),l.dispose()),Promise.all(A.map(L=>WB(L,o,n.gpuAccelerateSDF).then(({timing:U})=>{v.sdf[L.atlasIndex]=U}))).then(()=>{A.length&&!o.contextLost&&(YB(o),l.needsUpdate=!0),v.sdfTotal=mh()-T,v.total=mh()-t,e(Object.freeze({parameters:n,sdfTexture:l,sdfGlyphSize:s,sdfExponent:r,glyphBounds:_,glyphAtlasIndices:f,glyphColors:h.glyphColors,caretPositions:h.caretPositions,caretHeight:h.caretHeight,chunkedBounds:h.chunkedBounds,ascender:h.ascender,descender:h.descender,lineHeight:h.lineHeight,capHeight:h.capHeight,xHeight:h.xHeight,topBaseline:h.topBaseline,blockBounds:h.blockBounds,visibleBounds:h.visibleBounds,timings:h.timings}))})}),Promise.resolve().then(()=>{o.contextLost||_ce(c)})}function WB({path:n,atlasIndex:e,sdfViewBox:t},{sdfGlyphSize:i,sdfCanvas:r,contextLost:s},a){if(s)return Promise.resolve({timing:-1});const{textureWidth:o,sdfExponent:l}=Dh,c=Math.max(t[2]-t[0],t[3]-t[1]),u=Math.floor(e/4),h=u%(o/i)*i,f=Math.floor(u/(o/i))*i,p=e%4;return gce(i,i,n,t,c,l,r,h,f,p,a)}function Ice(n){const e=n.sdfCanvas;e.addEventListener("webglcontextlost",t=>{console.log("Context Lost",t),t.preventDefault(),n.contextLost=!0}),e.addEventListener("webglcontextrestored",t=>{console.log("Context Restored",t),n.contextLost=!1;const i=[];n.glyphsByFont.forEach(r=>{r.forEach(s=>{i.push(WB(s,n,!0))})}),Promise.all(i).then(()=>{YB(n),n.sdfTexture.needsUpdate=!0})})}function Mce({font:n,characters:e,sdfGlyphSize:t},i){let r=Array.isArray(e)?e.join(`
`):""+e;VB({font:n,sdfGlyphSize:t,text:r},i)}function Rce(n,e){for(let t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n}let tm;function Bce(n){return tm||(tm=typeof document>"u"?{}:document.createElement("a")),tm.href=n,tm.href}function YB(n){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:e,sdfTexture:t}=n,{width:i,height:r}=e,s=n.sdfCanvas.getContext("webgl");let a=t.image.data;(!a||a.length!==i*r*4)&&(a=new Uint8Array(i*r*4),t.image={width:i,height:r,data:a},t.flipY=!1,t.isDataTexture=!0),s.readPixels(0,0,i,r,s.RGBA,s.UNSIGNED_BYTE,a)}}const Dce=Y0({name:"Typesetter",dependencies:[Dh,Tce,pce,ace],init(n,e,t,i){const{defaultFontURL:r}=n;return t(e,i(),{defaultFontURL:r})}}),Pce=Y0({name:"Typesetter",dependencies:[Dce],init(n){return function(e){return new Promise(t=>{n.typeset(e,t)})}},getTransferables(n){const e=[n.glyphPositions.buffer,n.glyphIds.buffer];return n.caretPositions&&e.push(n.caretPositions.buffer),n.glyphColors&&e.push(n.glyphColors.buffer),e}}),Sw={};function Lce(n){let e=Sw[n];if(!e){const t=new Xo(1,1,n,n),i=t.clone(),r=t.attributes,s=i.attributes,a=new Bt,o=r.uv.count;for(let l=0;l<o;l++)s.position.array[l*3]*=-1,s.normal.array[l*3+2]*=-1;["position","normal","uv"].forEach(l=>{a.setAttribute(l,new ot([...r[l].array,...s[l].array],r[l].itemSize))}),a.setIndex([...t.index.array,...i.index.array.map(l=>l+o)]),a.translate(.5,.5,0),e=Sw[n]=a}return e}const Uce="aTroikaGlyphBounds",ww="aTroikaGlyphIndex",Oce="aTroikaGlyphColor";class Fce extends Z6{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new ms,this.boundingBox=new gs}computeBoundingSphere(){}computeBoundingBox(){}setSide(e){const t=this.getIndex().count;this.setDrawRange(e===Ki?t/2:0,e===$n?t:t/2)}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let t=Lce(e);["position","normal","uv"].forEach(i=>{this.attributes[i]=t.attributes[i].clone()}),this.setIndex(t.getIndex().clone())}}get detail(){return this._detail}set curveRadius(e){e!==this._curveRadius&&(this._curveRadius=e,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(e,t,i,r,s){C5(this,Uce,e,4),C5(this,ww,t,1),C5(this,Oce,s,3),this._blockBounds=i,this._chunkedBounds=r,this.instanceCount=t.length,this._updateBounds()}_updateBounds(){const e=this._blockBounds;if(e){const{curveRadius:t,boundingBox:i}=this;if(t){const{PI:r,floor:s,min:a,max:o,sin:l,cos:c}=Math,u=r/2,h=r*2,f=Math.abs(t),p=e[0]/f,m=e[2]/f,y=s((p+u)/h)!==s((m+u)/h)?-f:a(l(p)*f,l(m)*f),v=s((p-u)/h)!==s((m-u)/h)?f:o(l(p)*f,l(m)*f),A=s((p+r)/h)!==s((m+r)/h)?f*2:o(f-c(p)*f,f-c(m)*f);i.min.set(y,e[1],t<0?-A:0),i.max.set(v,e[3],t<0?0:A)}else i.min.set(e[0],e[1],0),i.max.set(e[2],e[3],0);i.getBoundingSphere(this.boundingSphere)}}applyClipRect(e){let t=this.getAttribute(ww).count,i=this._chunkedBounds;if(i)for(let r=i.length;r--;){t=i[r].end;let s=i[r].rect;if(s[1]<e.w&&s[3]>e.y&&s[0]<e.z&&s[2]>e.x)break}this.instanceCount=t}}function C5(n,e,t,i){const r=n.getAttribute(e);t?r&&r.array.length===t.length?(r.array.set(t),r.needsUpdate=!0):(n.setAttribute(e,new nu(t,i)),delete n._maxInstanceCount,n.dispose()):r&&n.deleteAttribute(e)}const kce=`
uniform vec2 uTroikaSDFTextureSize;
uniform float uTroikaSDFGlyphSize;
uniform vec4 uTroikaTotalBounds;
uniform vec4 uTroikaClipRect;
uniform mat3 uTroikaOrient;
uniform bool uTroikaUseGlyphColors;
uniform float uTroikaDistanceOffset;
uniform float uTroikaBlurRadius;
uniform vec2 uTroikaPositionOffset;
uniform float uTroikaCurveRadius;
attribute vec4 aTroikaGlyphBounds;
attribute float aTroikaGlyphIndex;
attribute vec3 aTroikaGlyphColor;
varying vec2 vTroikaGlyphUV;
varying vec4 vTroikaTextureUVBounds;
varying float vTroikaTextureChannel;
varying vec3 vTroikaGlyphColor;
varying vec2 vTroikaGlyphDimensions;
`,Nce=`
vec4 bounds = aTroikaGlyphBounds;
bounds.xz += uTroikaPositionOffset.x;
bounds.yw -= uTroikaPositionOffset.y;
vec4 outlineBounds = vec4(
bounds.xy - uTroikaDistanceOffset - uTroikaBlurRadius,
bounds.zw + uTroikaDistanceOffset + uTroikaBlurRadius
);
vec4 clippedBounds = vec4(
clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw),
clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw)
);
vec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy);
position.xy = mix(bounds.xy, bounds.zw, clippedXY);
uv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy);
float rad = uTroikaCurveRadius;
if (rad != 0.0) {
float angle = position.x / rad;
position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad);
normal.xz = vec2(sin(angle), cos(angle));
}
position = uTroikaOrient * position;
normal = uTroikaOrient * normal;
vTroikaGlyphUV = clippedXY.xy;
vTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]);
float txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize;
vec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize;
vec2 txStartUV = txUvPerSquare * vec2(
mod(floor(aTroikaGlyphIndex / 4.0), txCols),
floor(floor(aTroikaGlyphIndex / 4.0) / txCols)
);
vTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare);
vTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0);
`,Gce=`
uniform sampler2D uTroikaSDFTexture;
uniform vec2 uTroikaSDFTextureSize;
uniform float uTroikaSDFGlyphSize;
uniform float uTroikaSDFExponent;
uniform float uTroikaDistanceOffset;
uniform float uTroikaFillOpacity;
uniform float uTroikaOutlineOpacity;
uniform float uTroikaBlurRadius;
uniform vec3 uTroikaStrokeColor;
uniform float uTroikaStrokeWidth;
uniform float uTroikaStrokeOpacity;
uniform bool uTroikaSDFDebug;
varying vec2 vTroikaGlyphUV;
varying vec4 vTroikaTextureUVBounds;
varying float vTroikaTextureChannel;
varying vec2 vTroikaGlyphDimensions;
float troikaSdfValueToSignedDistance(float alpha) {
// Inverse of exponential encoding in webgl-sdf-generator
float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y);
float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension;
float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0);
return signedDist;
}
float troikaGlyphUvToSdfValue(vec2 glyphUV) {
vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV);
vec4 rgba = texture2D(uTroikaSDFTexture, textureUV);
float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1
return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a;
}
float troikaGlyphUvToDistance(vec2 uv) {
return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv));
}
float troikaGetAADist() {
#if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300
return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5;
#else
return vTroikaGlyphDimensions.x / 64.0;
#endif
}
float troikaGetFragDistValue() {
vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize);
float distance = troikaGlyphUvToDistance(clampedGlyphUV);
// Extrapolate distance when outside bounds:
distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 :
length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions);
return distance;
}
float troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) {
#if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)
float alpha = step(-distanceOffset, -distance);
#else
float alpha = smoothstep(
distanceOffset + aaDist,
distanceOffset - aaDist,
distance
);
#endif
return alpha;
}
`,zce=`
float aaDist = troikaGetAADist();
float fragDistance = troikaGetFragDistValue();
float edgeAlpha = uTroikaSDFDebug ?
troikaGlyphUvToSdfValue(vTroikaGlyphUV) :
troikaGetEdgeAlpha(fragDistance, uTroikaDistanceOffset, max(aaDist, uTroikaBlurRadius));
#if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL)
vec4 fillRGBA = gl_FragColor;
fillRGBA.a *= uTroikaFillOpacity;
vec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity);
if (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb;
gl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep(
-uTroikaStrokeWidth - aaDist,
-uTroikaStrokeWidth + aaDist,
fragDistance
));
gl_FragColor.a *= edgeAlpha;
#endif
if (edgeAlpha == 0.0) {
discard;
}
`;function Qce(n){const e=p6(n,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new _e},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new jt(0,0,0,0)},uTroikaClipRect:{value:new jt(0,0,0,0)},uTroikaDistanceOffset:{value:0},uTroikaOutlineOpacity:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new _e},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new He},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new Qt},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:kce,vertexTransform:Nce,fragmentDefs:Gce,fragmentColorTransform:zce,customRewriter({vertexShader:t,fragmentShader:i}){let r=/\buniform\s+vec3\s+diffuse\b/;return r.test(i)&&(i=i.replace(r,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),r.test(t)||(t=t.replace(QB,`uniform vec3 diffuse;
$&
vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;
`))),{vertexShader:t,fragmentShader:i}}});return e.transparent=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const O8=new cs({color:16777215,side:$n,transparent:!0}),Cw=8421504,Tw=new ct,nm=new N,T5=new N,Bd=[],Hce=new N,b5="+x+y";function bw(n){return Array.isArray(n)?n[0]:n}let qB=()=>{const n=new nn(new Xo(1,1),O8);return qB=()=>n,n},XB=()=>{const n=new nn(new Xo(1,1,32,1),O8);return XB=()=>n,n};const Vce={type:"syncstart"},Wce={type:"synccomplete"},jB=["font","fontSize","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],Yce=jB.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let KB=class extends nn{constructor(){const e=new Fce;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.fontSize=.1,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=Cw,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=b5,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(Vce),VB({text:this.text,font:this.font,fontSize:this.fontSize||.1,letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF},t=>{this._isSyncing=!1,this._textRenderInfo=t,this.geometry.updateGlyphs(t.glyphBounds,t.glyphAtlasIndices,t.blockBounds,t.chunkedBounds,t.glyphColors);const i=this._queuedSyncs;i&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{i.forEach(r=>r&&r())})),this.dispatchEvent(Wce),e&&e()})))}onBeforeRender(e,t,i,r,s,a){this.sync(),s.isTroikaTextMaterial&&this._prepareForRender(s),s._hadOwnSide=s.hasOwnProperty("side"),this.geometry.setSide(s._actualSide=s.side),s.side=$a}onAfterRender(e,t,i,r,s,a){s._hadOwnSide?s.side=s._actualSide:delete s.side}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}get material(){let e=this._derivedMaterial;const t=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=O8.clone());if((!e||e.baseMaterial!==t)&&(e=this._derivedMaterial=Qce(t),t.addEventListener("dispose",function i(){t.removeEventListener("dispose",i),e.dispose()})),this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY){let i=e._outlineMtl;return i||(i=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),i.isTextOutlineMaterial=!0,i.depthWrite=!1,i.map=null,e.addEventListener("dispose",function r(){e.removeEventListener("dispose",r),i.dispose()})),[i,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return bw(this.material).getDepthMaterial()}get customDistanceMaterial(){return bw(this.material).getDistanceMaterial()}_prepareForRender(e){const t=e.isTextOutlineMaterial,i=e.uniforms,r=this.textRenderInfo;if(r){const{sdfTexture:o,blockBounds:l}=r;i.uTroikaSDFTexture.value=o,i.uTroikaSDFTextureSize.value.set(o.image.width,o.image.height),i.uTroikaSDFGlyphSize.value=r.sdfGlyphSize,i.uTroikaSDFExponent.value=r.sdfExponent,i.uTroikaTotalBounds.value.fromArray(l),i.uTroikaUseGlyphColors.value=!t&&!!r.glyphColors;let c=0,u=0,h=0,f,p,m,y=0,v=0;if(t){let{outlineWidth:_,outlineOffsetX:x,outlineOffsetY:E,outlineBlur:w,outlineOpacity:I}=this;c=this._parsePercent(_)||0,u=Math.max(0,this._parsePercent(w)||0),f=I,y=this._parsePercent(x)||0,v=this._parsePercent(E)||0}else h=Math.max(0,this._parsePercent(this.strokeWidth)||0),h&&(m=this.strokeColor,i.uTroikaStrokeColor.value.set(m??Cw),p=this.strokeOpacity,p==null&&(p=1)),f=this.fillOpacity;i.uTroikaDistanceOffset.value=c,i.uTroikaPositionOffset.value.set(y,v),i.uTroikaBlurRadius.value=u,i.uTroikaStrokeWidth.value=h,i.uTroikaStrokeOpacity.value=p,i.uTroikaFillOpacity.value=f??1,i.uTroikaCurveRadius.value=this.curveRadius||0;let A=this.clipRect;if(A&&Array.isArray(A)&&A.length===4)i.uTroikaClipRect.value.fromArray(A);else{const _=(this.fontSize||.1)*100;i.uTroikaClipRect.value.set(l[0]-_,l[1]-_,l[2]+_,l[3]+_)}this.geometry.applyClipRect(i.uTroikaClipRect.value)}i.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const s=t?this.outlineColor||0:this.color;if(s==null)delete e.color;else{const o=e.hasOwnProperty("color")?e.color:e.color=new He;(s!==o._input||typeof s=="object")&&o.set(o._input=s)}let a=this.orientation||b5;if(a!==e._orientation){let o=i.uTroikaOrient.value;a=a.replace(/[^-+xyz]/g,"");let l=a!==b5&&a.match(/^([-+])([xyz])([-+])([xyz])$/);if(l){let[,c,u,h,f]=l;nm.set(0,0,0)[u]=c==="-"?1:-1,T5.set(0,0,0)[f]=h==="-"?-1:1,Tw.lookAt(Hce,nm.cross(T5),T5),o.setFromMatrix4(Tw)}else o.identity();e._orientation=a}}_parsePercent(e){if(typeof e=="string"){let t=e.match(/^(-?[\d.]+)%$/),i=t?parseFloat(t[1]):NaN;e=(isNaN(i)?0:i/100)*this.fontSize}return e}localPositionToTextCoords(e,t=new _e){t.copy(e);const i=this.curveRadius;return i&&(t.x=Math.atan2(e.x,Math.abs(i)-Math.abs(e.z))*Math.abs(i)),t}worldPositionToTextCoords(e,t=new _e){return nm.copy(e),this.localPositionToTextCoords(this.worldToLocal(nm),t)}raycast(e,t){const{textRenderInfo:i,curveRadius:r}=this;if(i){const s=i.blockBounds,a=r?XB():qB(),o=a.geometry,{position:l,uv:c}=o.attributes;for(let u=0;u<c.count;u++){let h=s[0]+c.getX(u)*(s[2]-s[0]);const f=s[1]+c.getY(u)*(s[3]-s[1]);let p=0;r&&(p=r-Math.cos(h/r)*r,h=Math.sin(h/r)*r),l.setXYZ(u,h,f,p)}o.boundingSphere=this.geometry.boundingSphere,o.boundingBox=this.geometry.boundingBox,a.matrixWorld=this.matrixWorld,a.material.side=this.material.side,Bd.length=0,a.raycast(e,Bd);for(let u=0;u<Bd.length;u++)Bd[u].object=this,t.push(Bd[u])}}copy(e){const t=this.geometry;return super.copy(e),this.geometry=t,Yce.forEach(i=>{this[i]=e[i]}),this}clone(){return new this.constructor().copy(this)}};jB.forEach(n=>{const e="_private_"+n;Object.defineProperty(KB.prototype,n,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})});const qce=$.forwardRef(({sdfGlyphSize:n=64,anchorX:e="center",anchorY:t="middle",font:i,fontSize:r=1,children:s,characters:a,onSync:o,...l},c)=>{const u=Cr(({invalidate:m})=>m),[h]=$.useState(()=>new KB),[f,p]=$.useMemo(()=>{const m=[];let y="";return $.Children.forEach(s,v=>{typeof v=="string"||typeof v=="number"?y+=v:m.push(v)}),[m,y]},[s]);return $G(()=>new Promise(m=>Mce({font:i,characters:a},m)),["troika-text",i,a]),$.useLayoutEffect(()=>void h.sync(()=>{u(),o&&o(h)})),$.useEffect(()=>()=>h.dispose(),[h]),$.createElement("primitive",ou({object:h,ref:c,font:i,text:p,anchorX:e,anchorY:t,fontSize:r,sdfGlyphSize:n},l),f)});/*!
* camera-controls
* https://github.com/yomotsu/camera-controls
* (c) 2017 @yomotsu
* Released under the MIT License.
*/const It={LEFT:1,RIGHT:2,MIDDLE:4},De=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),Ah={NONE:0,IN:1,OUT:-1};function Rc(n){return n.isPerspectiveCamera}function Cl(n){return n.isOrthographicCamera}const vh=Math.PI*2,Iw=Math.PI/2,$B=1e-5,Dd=Math.PI/180;function ra(n,e,t){return Math.max(e,Math.min(t,n))}function Un(n,e=$B){return Math.abs(n)<e}function yn(n,e,t=$B){return Un(n-e,t)}function Mw(n,e){return Math.round(n/e)*e}function Pd(n){return isFinite(n)?n:n<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Ld(n){return Math.abs(n)<Number.MAX_VALUE?n:n*(1/0)}function im(n,e,t,i,r=1/0,s){i=Math.max(1e-4,i);const a=2/i,o=a*s,l=1/(1+o+.48*o*o+.235*o*o*o);let c=n-e;const u=e,h=r*i;c=ra(c,-h,h),e=n-c;const f=(t.value+a*c)*s;t.value=(t.value-a*f)*l;let p=e+(c+f)*l;return u-n>0==p>u&&(p=u,t.value=(p-u)/s),p}function Rw(n,e,t,i,r=1/0,s,a){i=Math.max(1e-4,i);const o=2/i,l=o*s,c=1/(1+l+.48*l*l+.235*l*l*l);let u=e.x,h=e.y,f=e.z,p=n.x-u,m=n.y-h,y=n.z-f;const v=u,A=h,_=f,x=r*i,E=x*x,w=p*p+m*m+y*y;if(w>E){const G=Math.sqrt(w);p=p/G*x,m=m/G*x,y=y/G*x}u=n.x-p,h=n.y-m,f=n.z-y;const I=(t.x+o*p)*s,T=(t.y+o*m)*s,M=(t.z+o*y)*s;t.x=(t.x-o*I)*c,t.y=(t.y-o*T)*c,t.z=(t.z-o*M)*c,a.x=u+(p+I)*c,a.y=h+(m+T)*c,a.z=f+(y+M)*c;const b=v-n.x,B=A-n.y,L=_-n.z,U=a.x-v,O=a.y-A,Q=a.z-_;return b*U+B*O+L*Q>0&&(a.x=v,a.y=A,a.z=_,t.x=(a.x-v)/s,t.y=(a.y-A)/s,t.z=(a.z-_)/s),a}function I5(n,e){e.set(0,0),n.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=n.length,e.y/=n.length}function M5(n,e){return Cl(n)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}let Xce=class{constructor(){this._listeners={}}addEventListener(e,t){const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e)}}};const jce="2.7.2",rm=1/8,JB=typeof window<"u",Kce=JB&&/Mac/.test(navigator.platform),$ce=!(JB&&"PointerEvent"in window);let St,Bw,sm,R5,Gr,zt,hn,yh,Ud,Oa,Fa,Bc,Dw,Pw,Bs,Od,xh,Lw,B5,Uw,D5,P5,am,Tl=class m6 extends Xce{static install(e){St=e.THREE,Bw=Object.freeze(new St.Vector3(0,0,0)),sm=Object.freeze(new St.Vector3(0,1,0)),R5=Object.freeze(new St.Vector3(0,0,1)),Gr=new St.Vector2,zt=new St.Vector3,hn=new St.Vector3,yh=new St.Vector3,Ud=new St.Vector3,Oa=new St.Vector3,Fa=new St.Vector3,Bc=new St.Vector3,Dw=new St.Vector3,Pw=new St.Vector3,Bs=new St.Spherical,Od=new St.Spherical,xh=new St.Box3,Lw=new St.Box3,B5=new St.Sphere,Uw=new St.Quaternion,D5=new St.Quaternion,P5=new St.Matrix4,am=new St.Raycaster}static get ACTION(){return De}constructor(e,t){super(),this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minDistance=Number.EPSILON,this.maxDistance=1/0,this.infinityDolly=!1,this.minZoom=.01,this.maxZoom=1/0,this.smoothTime=.25,this.draggingSmoothTime=.125,this.maxSpeed=1/0,this.azimuthRotateSpeed=1,this.polarRotateSpeed=1,this.dollySpeed=1,this.dollyDragInverted=!1,this.truckSpeed=2,this.dollyToCursor=!1,this.dragToOffset=!1,this.verticalDragToForward=!1,this.boundaryFriction=0,this.restThreshold=.01,this.colliderMeshes=[],this.cancel=()=>{},this._enabled=!0,this._state=De.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=Ah.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new St.Vector3,this._focalOffsetVelocity=new St.Vector3,this._zoomVelocity={value:0},this._truckInternal=(E,w,I)=>{let T,M;if(Rc(this._camera)){const b=zt.copy(this._camera.position).sub(this._target),B=this._camera.getEffectiveFOV()*Dd,L=b.length()*Math.tan(B*.5);T=this.truckSpeed*E*L/this._elementRect.height,M=this.truckSpeed*w*L/this._elementRect.height}else if(Cl(this._camera)){const b=this._camera;T=E*(b.right-b.left)/b.zoom/this._elementRect.width,M=w*(b.top-b.bottom)/b.zoom/this._elementRect.height}else return;this.verticalDragToForward?(I?this.setFocalOffset(this._focalOffsetEnd.x+T,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(T,0,!0),this.forward(-M,!0)):I?this.setFocalOffset(this._focalOffsetEnd.x+T,this._focalOffsetEnd.y+M,this._focalOffsetEnd.z,!0):this.truck(T,M,!0)},this._rotateInternal=(E,w)=>{const I=vh*this.azimuthRotateSpeed*E/this._elementRect.height,T=vh*this.polarRotateSpeed*w/this._elementRect.height;this.rotate(I,T,!0)},this._dollyInternal=(E,w,I)=>{const T=Math.pow(.95,-E*this.dollySpeed),M=this._sphericalEnd.radius,b=this._sphericalEnd.radius*T,B=ra(b,this.minDistance,this.maxDistance),L=B-b;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(b,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(L,!0),this._dollyToNoClamp(B,!0)):this._dollyToNoClamp(B,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?b:B)-M,this._dollyControlCoord.set(w,I)),this._lastDollyDirection=Math.sign(-E)},this._zoomInternal=(E,w,I)=>{const T=Math.pow(.95,E*this.dollySpeed),M=this._zoom,b=this._zoom*T;this.zoomTo(b,!0),this.dollyToCursor&&(this._changedZoom+=b-M,this._dollyControlCoord.set(w,I))},typeof St>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new St.Quaternion().setFromUnitVectors(this._camera.up,sm),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=De.NONE,this._target=new St.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new St.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new St.Spherical().setFromVector3(zt.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new St.Vector3,new St.Vector3,new St.Vector3,new St.Vector3],this._updateNearPlaneCorners(),this._boundary=new St.Box3(new St.Vector3(-1/0,-1/0,-1/0),new St.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new St.Vector2,this.mouseButtons={left:De.ROTATE,middle:De.DOLLY,right:De.TRUCK,wheel:Rc(this._camera)?De.DOLLY:Cl(this._camera)?De.ZOOM:De.NONE},this.touches={one:De.TOUCH_ROTATE,two:Rc(this._camera)?De.TOUCH_DOLLY_TRUCK:Cl(this._camera)?De.TOUCH_ZOOM_TRUCK:De.NONE,three:De.TOUCH_TRUCK};const i=new St.Vector2,r=new St.Vector2,s=new St.Vector2,a=E=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const T=this._domElement.getBoundingClientRect(),M=E.clientX/T.width,b=E.clientY/T.height;if(M<this._interactiveArea.left||M>this._interactiveArea.right||b<this._interactiveArea.top||b>this._interactiveArea.bottom)return}const w=E.pointerType!=="mouse"?null:(E.buttons&It.LEFT)===It.LEFT?It.LEFT:(E.buttons&It.MIDDLE)===It.MIDDLE?It.MIDDLE:(E.buttons&It.RIGHT)===It.RIGHT?It.RIGHT:null;if(w!==null){const T=this._findPointerByMouseButton(w);T&&this._disposePointer(T)}if((E.buttons&It.LEFT)===It.LEFT&&this._lockedPointer)return;const I={pointerId:E.pointerId,clientX:E.clientX,clientY:E.clientY,deltaX:0,deltaY:0,mouseButton:w};this._activePointers.push(I),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",u),this._isDragging=!0,y(E)},o=E=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const T=this._domElement.getBoundingClientRect(),M=E.clientX/T.width,b=E.clientY/T.height;if(M<this._interactiveArea.left||M>this._interactiveArea.right||b<this._interactiveArea.top||b>this._interactiveArea.bottom)return}const w=(E.buttons&It.LEFT)===It.LEFT?It.LEFT:(E.buttons&It.MIDDLE)===It.MIDDLE?It.MIDDLE:(E.buttons&It.RIGHT)===It.RIGHT?It.RIGHT:null;if(w!==null){const T=this._findPointerByMouseButton(w);T&&this._disposePointer(T)}const I={pointerId:1,clientX:E.clientX,clientY:E.clientY,deltaX:0,deltaY:0,mouseButton:(E.buttons&It.LEFT)===It.LEFT?It.LEFT:(E.buttons&It.MIDDLE)===It.LEFT?It.MIDDLE:(E.buttons&It.RIGHT)===It.LEFT?It.RIGHT:null};this._activePointers.push(I),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",h),this._domElement.ownerDocument.addEventListener("mousemove",c),this._domElement.ownerDocument.addEventListener("mouseup",h),this._isDragging=!0,y(E)},l=E=>{E.cancelable&&E.preventDefault();const w=E.pointerId,I=this._lockedPointer||this._findPointerById(w);if(I){if(I.clientX=E.clientX,I.clientY=E.clientY,I.deltaX=E.movementX,I.deltaY=E.movementY,this._state=0,E.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(E.buttons&It.LEFT)===It.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(E.buttons&It.MIDDLE)===It.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(E.buttons&It.RIGHT)===It.RIGHT&&(this._state=this._state|this.mouseButtons.right);v()}},c=E=>{const w=this._lockedPointer||this._findPointerById(1);w&&(w.clientX=E.clientX,w.clientY=E.clientY,w.deltaX=E.movementX,w.deltaY=E.movementY,this._state=0,(this._lockedPointer||(E.buttons&It.LEFT)===It.LEFT)&&(this._state=this._state|this.mouseButtons.left),(E.buttons&It.MIDDLE)===It.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(E.buttons&It.RIGHT)===It.RIGHT&&(this._state=this._state|this.mouseButtons.right),v())},u=E=>{const w=this._findPointerById(E.pointerId);if(!(w&&w===this._lockedPointer)){if(w&&this._disposePointer(w),E.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=De.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=De.NONE;A()}},h=()=>{const E=this._findPointerById(1);E&&E===this._lockedPointer||(E&&this._disposePointer(E),this._state=De.NONE,A())};let f=-1;const p=E=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===De.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const b=this._domElement.getBoundingClientRect(),B=E.clientX/b.width,L=E.clientY/b.height;if(B<this._interactiveArea.left||B>this._interactiveArea.right||L<this._interactiveArea.top||L>this._interactiveArea.bottom)return}if(E.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===De.ROTATE||this.mouseButtons.wheel===De.TRUCK){const b=performance.now();f-b<1e3&&this._getClientRect(this._elementRect),f=b}const w=Kce?-1:-3,I=E.deltaMode===1?E.deltaY/w:E.deltaY/(w*10),T=this.dollyToCursor?(E.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,M=this.dollyToCursor?(E.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case De.ROTATE:{this._rotateInternal(E.deltaX,E.deltaY),this._isUserControllingRotate=!0;break}case De.TRUCK:{this._truckInternal(E.deltaX,E.deltaY,!1),this._isUserControllingTruck=!0;break}case De.OFFSET:{this._truckInternal(E.deltaX,E.deltaY,!0),this._isUserControllingOffset=!0;break}case De.DOLLY:{this._dollyInternal(-I,T,M),this._isUserControllingDolly=!0;break}case De.ZOOM:{this._zoomInternal(-I,T,M),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},m=E=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===m6.ACTION.NONE){const w=E instanceof PointerEvent?E.pointerId:(E instanceof MouseEvent,0),I=this._findPointerById(w);I&&this._disposePointer(I),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",h);return}E.preventDefault()}},y=E=>{if(!this._enabled)return;if(I5(this._activePointers,Gr),this._getClientRect(this._elementRect),i.copy(Gr),r.copy(Gr),this._activePointers.length>=2){const I=Gr.x-this._activePointers[1].clientX,T=Gr.y-this._activePointers[1].clientY,M=Math.sqrt(I*I+T*T);s.set(0,M);const b=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,B=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;r.set(b,B)}if(this._state=0,!E)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in E&&E.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(E.buttons&It.LEFT)===It.LEFT&&(this._state=this._state|this.mouseButtons.left),(E.buttons&It.MIDDLE)===It.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(E.buttons&It.RIGHT)===It.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&De.ROTATE)===De.ROTATE||(this._state&De.TOUCH_ROTATE)===De.TOUCH_ROTATE||(this._state&De.TOUCH_DOLLY_ROTATE)===De.TOUCH_DOLLY_ROTATE||(this._state&De.TOUCH_ZOOM_ROTATE)===De.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&De.TRUCK)===De.TRUCK||(this._state&De.TOUCH_TRUCK)===De.TOUCH_TRUCK||(this._state&De.TOUCH_DOLLY_TRUCK)===De.TOUCH_DOLLY_TRUCK||(this._state&De.TOUCH_ZOOM_TRUCK)===De.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&De.DOLLY)===De.DOLLY||(this._state&De.TOUCH_DOLLY)===De.TOUCH_DOLLY||(this._state&De.TOUCH_DOLLY_TRUCK)===De.TOUCH_DOLLY_TRUCK||(this._state&De.TOUCH_DOLLY_OFFSET)===De.TOUCH_DOLLY_OFFSET||(this._state&De.TOUCH_DOLLY_ROTATE)===De.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&De.ZOOM)===De.ZOOM||(this._state&De.TOUCH_ZOOM)===De.TOUCH_ZOOM||(this._state&De.TOUCH_ZOOM_TRUCK)===De.TOUCH_ZOOM_TRUCK||(this._state&De.TOUCH_ZOOM_OFFSET)===De.TOUCH_ZOOM_OFFSET||(this._state&De.TOUCH_ZOOM_ROTATE)===De.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&De.OFFSET)===De.OFFSET||(this._state&De.TOUCH_OFFSET)===De.TOUCH_OFFSET||(this._state&De.TOUCH_DOLLY_OFFSET)===De.TOUCH_DOLLY_OFFSET||(this._state&De.TOUCH_ZOOM_OFFSET)===De.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},v=()=>{if(!this._enabled)return;I5(this._activePointers,Gr);const w=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,I=w?-w.deltaX:r.x-Gr.x,T=w?-w.deltaY:r.y-Gr.y;if(r.copy(Gr),((this._state&De.ROTATE)===De.ROTATE||(this._state&De.TOUCH_ROTATE)===De.TOUCH_ROTATE||(this._state&De.TOUCH_DOLLY_ROTATE)===De.TOUCH_DOLLY_ROTATE||(this._state&De.TOUCH_ZOOM_ROTATE)===De.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(I,T),this._isUserControllingRotate=!0),(this._state&De.DOLLY)===De.DOLLY||(this._state&De.ZOOM)===De.ZOOM){const M=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,b=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0,B=this.dollyDragInverted?-1:1;(this._state&De.DOLLY)===De.DOLLY?(this._dollyInternal(B*T*rm,M,b),this._isUserControllingDolly=!0):(this._zoomInternal(B*T*rm,M,b),this._isUserControllingZoom=!0)}if((this._state&De.TOUCH_DOLLY)===De.TOUCH_DOLLY||(this._state&De.TOUCH_ZOOM)===De.TOUCH_ZOOM||(this._state&De.TOUCH_DOLLY_TRUCK)===De.TOUCH_DOLLY_TRUCK||(this._state&De.TOUCH_ZOOM_TRUCK)===De.TOUCH_ZOOM_TRUCK||(this._state&De.TOUCH_DOLLY_OFFSET)===De.TOUCH_DOLLY_OFFSET||(this._state&De.TOUCH_ZOOM_OFFSET)===De.TOUCH_ZOOM_OFFSET||(this._state&De.TOUCH_DOLLY_ROTATE)===De.TOUCH_DOLLY_ROTATE||(this._state&De.TOUCH_ZOOM_ROTATE)===De.TOUCH_ZOOM_ROTATE){const M=Gr.x-this._activePointers[1].clientX,b=Gr.y-this._activePointers[1].clientY,B=Math.sqrt(M*M+b*b),L=s.y-B;s.set(0,B);const U=this.dollyToCursor?(r.x-this._elementRect.x)/this._elementRect.width*2-1:0,O=this.dollyToCursor?(r.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&De.TOUCH_DOLLY)===De.TOUCH_DOLLY||(this._state&De.TOUCH_DOLLY_ROTATE)===De.TOUCH_DOLLY_ROTATE||(this._state&De.TOUCH_DOLLY_TRUCK)===De.TOUCH_DOLLY_TRUCK||(this._state&De.TOUCH_DOLLY_OFFSET)===De.TOUCH_DOLLY_OFFSET?(this._dollyInternal(L*rm,U,O),this._isUserControllingDolly=!0):(this._zoomInternal(L*rm,U,O),this._isUserControllingZoom=!0)}((this._state&De.TRUCK)===De.TRUCK||(this._state&De.TOUCH_TRUCK)===De.TOUCH_TRUCK||(this._state&De.TOUCH_DOLLY_TRUCK)===De.TOUCH_DOLLY_TRUCK||(this._state&De.TOUCH_ZOOM_TRUCK)===De.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(I,T,!1),this._isUserControllingTruck=!0),((this._state&De.OFFSET)===De.OFFSET||(this._state&De.TOUCH_OFFSET)===De.TOUCH_OFFSET||(this._state&De.TOUCH_DOLLY_OFFSET)===De.TOUCH_DOLLY_OFFSET||(this._state&De.TOUCH_ZOOM_OFFSET)===De.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(I,T,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},A=()=>{I5(this._activePointers,Gr),r.copy(Gr),(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.removeEventListener("mouseup",h),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",_),this._domElement.ownerDocument.addEventListener("pointerlockerror",x),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",u),y())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",_),this._domElement.ownerDocument.removeEventListener("pointerlockerror",x))};const _=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},x=()=>{this.unlockPointer()};this._addAllEventListeners=E=>{this._domElement=E,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",a),$ce&&this._domElement.addEventListener("mousedown",o),this._domElement.addEventListener("pointercancel",u),this._domElement.addEventListener("wheel",p,{passive:!1}),this._domElement.addEventListener("contextmenu",m)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",a),this._domElement.removeEventListener("mousedown",o),this._domElement.removeEventListener("pointercancel",u),this._domElement.removeEventListener("wheel",p,{passive:!1}),this._domElement.removeEventListener("contextmenu",m),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.removeEventListener("mouseup",h),this._domElement.ownerDocument.removeEventListener("pointerlockchange",_),this._domElement.ownerDocument.removeEventListener("pointerlockerror",x))},this.cancel=()=>{this._state!==De.NONE&&(this._state=De.NONE,this._activePointers.length=0,A())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=ra(e.width,0,1),this._interactiveArea.height=ra(e.height,0,1),this._interactiveArea.x=ra(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=ra(e.x,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,i=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,i)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,i=!1){this._isUserControllingRotate=!1;const r=ra(e,this.minAzimuthAngle,this.maxAzimuthAngle),s=ra(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=r,this._sphericalEnd.phi=s,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,i||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const a=!i||yn(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&yn(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(a)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Ah.NONE,this._changedDolly=0,this._dollyToNoClamp(ra(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const i=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const a=this._collisionTest(),o=yn(a,this._spherical.radius);if(!(i>e)&&o)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,a)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const s=!t||yn(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(s)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(Ud).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const i=!t||yn(this._target.x,this._targetEnd.x,this.restThreshold)&&yn(this._target.y,this._targetEnd.y,this.restThreshold)&&yn(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(i)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=ra(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const i=!t||yn(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(i)}pan(e,t,i=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,i)}truck(e,t,i=!1){this._camera.updateMatrix(),Oa.setFromMatrixColumn(this._camera.matrix,0),Fa.setFromMatrixColumn(this._camera.matrix,1),Oa.multiplyScalar(e),Fa.multiplyScalar(-t);const r=zt.copy(Oa).add(Fa),s=hn.copy(this._targetEnd).add(r);return this.moveTo(s.x,s.y,s.z,i)}forward(e,t=!1){zt.setFromMatrixColumn(this._camera.matrix,0),zt.crossVectors(this._camera.up,zt),zt.multiplyScalar(e);const i=hn.copy(this._targetEnd).add(zt);return this.moveTo(i.x,i.y,i.z,t)}elevate(e,t=!1){return zt.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+zt.x,this._targetEnd.y+zt.y,this._targetEnd.z+zt.z,t)}moveTo(e,t,i,r=!1){this._isUserControllingTruck=!1;const s=zt.set(e,t,i).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,s,this.boundaryFriction),this._needsUpdate=!0,r||this._target.copy(this._targetEnd);const a=!r||yn(this._target.x,this._targetEnd.x,this.restThreshold)&&yn(this._target.y,this._targetEnd.y,this.restThreshold)&&yn(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(a)}lookInDirectionOf(e,t,i,r=!1){const o=zt.set(e,t,i).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(o.x,o.y,o.z,r)}fitToBox(e,t,{cover:i=!1,paddingLeft:r=0,paddingRight:s=0,paddingBottom:a=0,paddingTop:o=0}={}){const l=[],c=e.isBox3?xh.copy(e):xh.setFromObject(e);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const u=Mw(this._sphericalEnd.theta,Iw),h=Mw(this._sphericalEnd.phi,Iw);l.push(this.rotateTo(u,h,t));const f=zt.setFromSpherical(this._sphericalEnd).normalize(),p=Uw.setFromUnitVectors(f,R5),m=yn(Math.abs(f.y),1);m&&p.multiply(D5.setFromAxisAngle(sm,u)),p.multiply(this._yAxisUpSpaceInverse);const y=Lw.makeEmpty();hn.copy(c.min).applyQuaternion(p),y.expandByPoint(hn),hn.copy(c.min).setX(c.max.x).applyQuaternion(p),y.expandByPoint(hn),hn.copy(c.min).setY(c.max.y).applyQuaternion(p),y.expandByPoint(hn),hn.copy(c.max).setZ(c.min.z).applyQuaternion(p),y.expandByPoint(hn),hn.copy(c.min).setZ(c.max.z).applyQuaternion(p),y.expandByPoint(hn),hn.copy(c.max).setY(c.min.y).applyQuaternion(p),y.expandByPoint(hn),hn.copy(c.max).setX(c.min.x).applyQuaternion(p),y.expandByPoint(hn),hn.copy(c.max).applyQuaternion(p),y.expandByPoint(hn),y.min.x-=r,y.min.y-=a,y.max.x+=s,y.max.y+=o,p.setFromUnitVectors(R5,f),m&&p.premultiply(D5.invert()),p.premultiply(this._yAxisUpSpace);const v=y.getSize(zt),A=y.getCenter(hn).applyQuaternion(p);if(Rc(this._camera)){const _=this.getDistanceToFitBox(v.x,v.y,v.z,i);l.push(this.moveTo(A.x,A.y,A.z,t)),l.push(this.dollyTo(_,t)),l.push(this.setFocalOffset(0,0,0,t))}else if(Cl(this._camera)){const _=this._camera,x=_.right-_.left,E=_.top-_.bottom,w=i?Math.max(x/v.x,E/v.y):Math.min(x/v.x,E/v.y);l.push(this.moveTo(A.x,A.y,A.z,t)),l.push(this.zoomTo(w,t)),l.push(this.setFocalOffset(0,0,0,t))}return Promise.all(l)}fitToSphere(e,t){const i=[],s=e instanceof St.Sphere?B5.copy(e):m6.createBoundingSphere(e,B5);if(i.push(this.moveTo(s.center.x,s.center.y,s.center.z,t)),Rc(this._camera)){const a=this.getDistanceToFitSphere(s.radius);i.push(this.dollyTo(a,t))}else if(Cl(this._camera)){const a=this._camera.right-this._camera.left,o=this._camera.top-this._camera.bottom,l=2*s.radius,c=Math.min(a/l,o/l);i.push(this.zoomTo(c,t))}return i.push(this.setFocalOffset(0,0,0,t)),Promise.all(i)}setLookAt(e,t,i,r,s,a,o=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Ah.NONE,this._changedDolly=0;const l=hn.set(r,s,a),c=zt.set(e,t,i);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(c.sub(l).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,o||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const u=!o||yn(this._target.x,this._targetEnd.x,this.restThreshold)&&yn(this._target.y,this._targetEnd.y,this.restThreshold)&&yn(this._target.z,this._targetEnd.z,this.restThreshold)&&yn(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&yn(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&yn(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(u)}lerpLookAt(e,t,i,r,s,a,o,l,c,u,h,f,p,m=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Ah.NONE,this._changedDolly=0;const y=zt.set(r,s,a),v=hn.set(e,t,i);Bs.setFromVector3(v.sub(y).applyQuaternion(this._yAxisUpSpace));const A=yh.set(u,h,f),_=hn.set(o,l,c);Od.setFromVector3(_.sub(A).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(y.lerp(A,p));const x=Od.theta-Bs.theta,E=Od.phi-Bs.phi,w=Od.radius-Bs.radius;this._sphericalEnd.set(Bs.radius+w*p,Bs.phi+E*p,Bs.theta+x*p),this.normalizeRotations(),this._needsUpdate=!0,m||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const I=!m||yn(this._target.x,this._targetEnd.x,this.restThreshold)&&yn(this._target.y,this._targetEnd.y,this.restThreshold)&&yn(this._target.z,this._targetEnd.z,this.restThreshold)&&yn(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&yn(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&yn(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(I)}setPosition(e,t,i,r=!1){return this.setLookAt(e,t,i,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,r)}setTarget(e,t,i,r=!1){const s=this.getPosition(zt),a=this.setLookAt(s.x,s.y,s.z,e,t,i,r);return this._sphericalEnd.phi=ra(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),a}setFocalOffset(e,t,i,r=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,i),this._needsUpdate=!0,r||this._focalOffset.copy(this._focalOffsetEnd);const s=!r||yn(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&yn(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&yn(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}setOrbitPoint(e,t,i){this._camera.updateMatrixWorld(),Oa.setFromMatrixColumn(this._camera.matrixWorldInverse,0),Fa.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Bc.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const r=zt.set(e,t,i),s=r.distanceTo(this._camera.position),a=r.sub(this._camera.position);Oa.multiplyScalar(a.x),Fa.multiplyScalar(a.y),Bc.multiplyScalar(a.z),zt.copy(Oa).add(Fa).add(Bc),zt.z=zt.z+s,this.dollyTo(s,!1),this.setFocalOffset(-zt.x,zt.y,-zt.z,!1),this.moveTo(e,t,i,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,i,r){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new St.Vector4,typeof e=="number"?this._viewport.set(e,t,i,r):this._viewport.copy(e)}getDistanceToFitBox(e,t,i,r=!1){if(M5(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const s=e/t,a=this._camera.getEffectiveFOV()*Dd,o=this._camera.aspect;return((r?s>o:s<o)?t:e/o)*.5/Math.tan(a*.5)+i*.5}getDistanceToFitSphere(e){if(M5(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*Dd,i=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,r=1<this._camera.aspect?t:i;return e/Math.sin(r*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new St.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new St.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e&&e instanceof St.Spherical?e:new St.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new St.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%vh,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=vh),this._spherical.theta+=vh*Math.round((this._sphericalEnd.theta-this._spherical.theta)/vh)}reset(e=!1){if(!yn(this._camera.up.x,this._cameraUp0.x)||!yn(this._camera.up.y,this._cameraUp0.y)||!yn(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const i=this.getPosition(zt);this.updateCameraUp(),this.setPosition(i.x,i.y,i.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,e),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,e),this.zoomTo(this._zoom0,e)];return Promise.all(t)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,sm),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=zt.subVectors(this._target,this._camera.position).normalize(),t=hn.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const i=this.getPosition(zt);this.updateCameraUp(),this.setPosition(i.x,i.y,i.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,i=this._sphericalEnd.phi-this._spherical.phi,r=this._sphericalEnd.radius-this._spherical.radius,s=Dw.subVectors(this._targetEnd,this._target),a=Pw.subVectors(this._focalOffsetEnd,this._focalOffset),o=this._zoomEnd-this._zoom;if(Un(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const h=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=im(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,h,1/0,e),this._needsUpdate=!0}if(Un(i))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const h=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=im(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,h,1/0,e),this._needsUpdate=!0}if(Un(r))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const h=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=im(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,h,this.maxSpeed,e),this._needsUpdate=!0}if(Un(s.x)&&Un(s.y)&&Un(s.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const h=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;Rw(this._target,this._targetEnd,this._targetVelocity,h,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(Un(a.x)&&Un(a.y)&&Un(a.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const h=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;Rw(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,h,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(Un(o))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const h=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=im(this._zoom,this._zoomEnd,this._zoomVelocity,h,1/0,e)}if(this.dollyToCursor){if(Rc(this._camera)&&this._changedDolly!==0){const h=this._spherical.radius-this._lastDistance,f=this._camera,p=this._getCameraDirection(Ud),m=zt.copy(p).cross(f.up).normalize();m.lengthSq()===0&&(m.x=1);const y=hn.crossVectors(m,p),v=this._sphericalEnd.radius*Math.tan(f.getEffectiveFOV()*Dd*.5),_=(this._sphericalEnd.radius-h-this._sphericalEnd.radius)/this._sphericalEnd.radius,x=yh.copy(this._targetEnd).add(m.multiplyScalar(this._dollyControlCoord.x*v*f.aspect)).add(y.multiplyScalar(this._dollyControlCoord.y*v)),E=zt.copy(this._targetEnd).lerp(x,_),w=this._lastDollyDirection===Ah.IN&&this._spherical.radius<=this.minDistance,I=this._lastDollyDirection===Ah.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(w||I)){this._sphericalEnd.radius-=h,this._spherical.radius-=h;const M=hn.copy(p).multiplyScalar(-h);E.add(M)}this._boundary.clampPoint(E,E);const T=hn.subVectors(E,this._targetEnd);this._targetEnd.copy(E),this._target.add(T),this._changedDolly-=h,Un(this._changedDolly)&&(this._changedDolly=0)}else if(Cl(this._camera)&&this._changedZoom!==0){const h=this._zoom-this._lastZoom,f=this._camera,p=zt.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(f.near+f.far)/(f.near-f.far)).unproject(f),m=hn.set(0,0,-1).applyQuaternion(f.quaternion),y=yh.copy(p).add(m.multiplyScalar(-p.dot(f.up))),A=-(this._zoom-h-this._zoom)/this._zoom,_=this._getCameraDirection(Ud),x=this._targetEnd.dot(_),E=zt.copy(this._targetEnd).lerp(y,A),w=E.dot(_),I=_.multiplyScalar(w-x);E.sub(I),this._boundary.clampPoint(E,E);const T=hn.subVectors(E,this._targetEnd);this._targetEnd.copy(E),this._target.add(T),this._changedZoom-=h,Un(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0);const l=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,l),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!Un(this._focalOffset.x)||!Un(this._focalOffset.y)||!Un(this._focalOffset.z))&&(this._camera.updateMatrixWorld(),Oa.setFromMatrixColumn(this._camera.matrix,0),Fa.setFromMatrixColumn(this._camera.matrix,1),Bc.setFromMatrixColumn(this._camera.matrix,2),Oa.multiplyScalar(this._focalOffset.x),Fa.multiplyScalar(-this._focalOffset.y),Bc.multiplyScalar(this._focalOffset.z),zt.copy(Oa).add(Fa).add(Bc),this._camera.position.add(zt)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),zt.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const u=this._needsUpdate;return u&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):u?(this.dispatchEvent({type:"update"}),Un(t,this.restThreshold)&&Un(i,this.restThreshold)&&Un(r,this.restThreshold)&&Un(s.x,this.restThreshold)&&Un(s.y,this.restThreshold)&&Un(s.z,this.restThreshold)&&Un(a.x,this.restThreshold)&&Un(a.y,this.restThreshold)&&Un(a.z,this.restThreshold)&&Un(o,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!u&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=u,this._needsUpdate=!1,u}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:Pd(this.maxDistance),minZoom:this.minZoom,maxZoom:Pd(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:Pd(this.maxPolarAngle),minAzimuthAngle:Pd(this.minAzimuthAngle),maxAzimuthAngle:Pd(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,verticalDragToForward:this.verticalDragToForward,target:this._targetEnd.toArray(),position:zt.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(e,t=!1){const i=JSON.parse(e);this.enabled=i.enabled,this.minDistance=i.minDistance,this.maxDistance=Ld(i.maxDistance),this.minZoom=i.minZoom,this.maxZoom=Ld(i.maxZoom),this.minPolarAngle=i.minPolarAngle,this.maxPolarAngle=Ld(i.maxPolarAngle),this.minAzimuthAngle=Ld(i.minAzimuthAngle),this.maxAzimuthAngle=Ld(i.maxAzimuthAngle),this.smoothTime=i.smoothTime,this.draggingSmoothTime=i.draggingSmoothTime,this.dollySpeed=i.dollySpeed,this.truckSpeed=i.truckSpeed,this.dollyToCursor=i.dollyToCursor,this.verticalDragToForward=i.verticalDragToForward,this._target0.fromArray(i.target0),this._position0.fromArray(i.position0),this._zoom0=i.zoom0,this._focalOffset0.fromArray(i.focalOffset0),this.moveTo(i.target[0],i.target[1],i.target[2],t),Bs.setFromVector3(zt.fromArray(i.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(Bs.theta,Bs.phi,t),this.dollyTo(Bs.radius,t),this.zoomTo(i.zoom,t),this.setFocalOffset(i.focalOffset[0],i.focalOffset[1],i.focalOffset[2],t),this._needsUpdate=!0}connect(e){if(this._domElement){console.warn("camera-controls is already connected.");return}e.setAttribute("data-camera-controls-version",jce),this._addAllEventListeners(e),this._getClientRect(this._elementRect)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(e){return e.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(e){return this._getTargetDirection(e).negate()}_findPointerById(e){return this._activePointers.find(t=>t.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,i){const r=t.lengthSq();if(r===0)return e;const s=hn.copy(t).add(e),o=this._boundary.clampPoint(s,yh).sub(s),l=o.lengthSq();if(l===0)return e.add(t);if(l===r)return e;if(i===0)return e.add(t).add(o);{const c=1+i*l/t.dot(o);return e.add(hn.copy(t).multiplyScalar(c)).add(o.multiplyScalar(1-i))}}_updateNearPlaneCorners(){if(Rc(this._camera)){const e=this._camera,t=e.near,i=e.getEffectiveFOV()*Dd,r=Math.tan(i*.5)*t,s=r*e.aspect;this._nearPlaneCorners[0].set(-s,-r,0),this._nearPlaneCorners[1].set(s,-r,0),this._nearPlaneCorners[2].set(s,r,0),this._nearPlaneCorners[3].set(-s,r,0)}else if(Cl(this._camera)){const e=this._camera,t=1/e.zoom,i=e.left*t,r=e.right*t,s=e.top*t,a=e.bottom*t;this._nearPlaneCorners[0].set(i,s,0),this._nearPlaneCorners[1].set(r,s,0),this._nearPlaneCorners[2].set(r,a,0),this._nearPlaneCorners[3].set(i,a,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||M5(this._camera,"_collisionTest"))return e;const i=this._getTargetDirection(Ud);P5.lookAt(Bw,i,this._camera.up);for(let r=0;r<4;r++){const s=hn.copy(this._nearPlaneCorners[r]);s.applyMatrix4(P5);const a=yh.addVectors(this._target,s);am.set(a,i),am.far=this._spherical.radius+1;const o=am.intersectObjects(this.colliderMeshes);o.length!==0&&o[0].distance<e&&(e=o[0].distance)}return e}_getClientRect(e){if(!this._domElement)return;const t=this._domElement.getBoundingClientRect();return e.x=t.left,e.y=t.top,this._viewport?(e.x+=this._viewport.x,e.y+=t.height-this._viewport.w-this._viewport.y,e.width=this._viewport.z,e.height=this._viewport.w):(e.width=t.width,e.height=t.height),e}_createOnRestPromise(e){return e?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{const i=()=>{this.removeEventListener("rest",i),t()};this.addEventListener("rest",i)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new St.Sphere){const i=t,r=i.center;xh.makeEmpty(),e.traverseVisible(a=>{a.isMesh&&xh.expandByObject(a)}),xh.getCenter(r);let s=0;return e.traverseVisible(a=>{if(!a.isMesh)return;const o=a,l=o.geometry.clone();l.applyMatrix4(o.matrixWorld);const u=l.attributes.position;for(let h=0,f=u.count;h<f;h++)zt.fromBufferAttribute(u,h),s=Math.max(s,r.distanceToSquared(zt))}),i.radius=Math.sqrt(s),i}};var K1={exports:{}},Ow={ellipse:"…",chars:[" ","-"],max:140,truncate:!0};function ZB(n,e,t,i){if(n<=e)return n;if(e<2)return n.slice(0,e-t.length)+t;for(var r=e-t.length,s=Math.floor(r/2),a=s,o=n.length-s,l=0;l<s;l++){var c=n.charAt(l),u=n.length-l,h=n.charAt(u);i.indexOf(c)!==-1&&(a=l),i.indexOf(h)!==-1&&(o=u)}return n.slice(0,a)+t+n.slice(o)}function eD(n,e,t,i,r){if(n.length<=e)return n;for(var s=e-t.length,a=s,o=0;o<=s;o++){var l=n.charAt(o);i.indexOf(l)!==-1&&(a=o)}return!r&&a==s?"":n.slice(0,a)+t}K1.exports=function(n,e,t){if(typeof n!="string"||n.length===0||e===0)return"";t=t||{};for(var i in Ow)(t[i]===null||typeof t[i]>"u")&&(t[i]=Ow[i]);return t.max=e||t.max,t.truncate=="middle"?ZB(n,t.max,t.ellipse,t.chars):eD(n,t.max,t.ellipse,t.chars,t.truncate)};K1.exports.ellipsizeMiddle=ZB;K1.exports.ellipsize=eD;var Jce=K1.exports;const Zce=ps(Jce);var tD={exports:{}};(function(n){(function(e,t,i){if(!e)return;for(var r={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},s={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},a={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},o={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},l,c=1;c<20;++c)r[111+c]="f"+c;for(c=0;c<=9;++c)r[c+96]=c.toString();function u(T,M,b){if(T.addEventListener){T.addEventListener(M,b,!1);return}T.attachEvent("on"+M,b)}function h(T){if(T.type=="keypress"){var M=String.fromCharCode(T.which);return T.shiftKey||(M=M.toLowerCase()),M}return r[T.which]?r[T.which]:s[T.which]?s[T.which]:String.fromCharCode(T.which).toLowerCase()}function f(T,M){return T.sort().join(",")===M.sort().join(",")}function p(T){var M=[];return T.shiftKey&&M.push("shift"),T.altKey&&M.push("alt"),T.ctrlKey&&M.push("ctrl"),T.metaKey&&M.push("meta"),M}function m(T){if(T.preventDefault){T.preventDefault();return}T.returnValue=!1}function y(T){if(T.stopPropagation){T.stopPropagation();return}T.cancelBubble=!0}function v(T){return T=="shift"||T=="ctrl"||T=="alt"||T=="meta"}function A(){if(!l){l={};for(var T in r)T>95&&T<112||r.hasOwnProperty(T)&&(l[r[T]]=T)}return l}function _(T,M,b){return b||(b=A()[T]?"keydown":"keypress"),b=="keypress"&&M.length&&(b="keydown"),b}function x(T){return T==="+"?["+"]:(T=T.replace(/\+{2}/g,"+plus"),T.split("+"))}function E(T,M){var b,B,L,U=[];for(b=x(T),L=0;L<b.length;++L)B=b[L],o[B]&&(B=o[B]),M&&M!="keypress"&&a[B]&&(B=a[B],U.push("shift")),v(B)&&U.push(B);return M=_(B,U,M),{key:B,modifiers:U,action:M}}function w(T,M){return T===null||T===t?!1:T===M?!0:w(T.parentNode,M)}function I(T){var M=this;if(T=T||t,!(M instanceof I))return new I(T);M.target=T,M._callbacks={},M._directMap={};var b={},B,L=!1,U=!1,O=!1;function Q(D){D=D||{};var k=!1,Z;for(Z in b){if(D[Z]){k=!0;continue}b[Z]=0}k||(O=!1)}function G(D,k,Z,j,ee,ie){var te,re,ce=[],ye=Z.type;if(!M._callbacks[D])return[];for(ye=="keyup"&&v(D)&&(k=[D]),te=0;te<M._callbacks[D].length;++te)if(re=M._callbacks[D][te],!(!j&&re.seq&&b[re.seq]!=re.level)&&ye==re.action&&(ye=="keypress"&&!Z.metaKey&&!Z.ctrlKey||f(k,re.modifiers))){var oe=!j&&re.combo==ee,W=j&&re.seq==j&&re.level==ie;(oe||W)&&M._callbacks[D].splice(te,1),ce.push(re)}return ce}function F(D,k,Z,j){M.stopCallback(k,k.target||k.srcElement,Z,j)||D(k,Z)===!1&&(m(k),y(k))}M._handleKey=function(D,k,Z){var j=G(D,k,Z),ee,ie={},te=0,re=!1;for(ee=0;ee<j.length;++ee)j[ee].seq&&(te=Math.max(te,j[ee].level));for(ee=0;ee<j.length;++ee){if(j[ee].seq){if(j[ee].level!=te)continue;re=!0,ie[j[ee].seq]=1,F(j[ee].callback,Z,j[ee].combo,j[ee].seq);continue}re||F(j[ee].callback,Z,j[ee].combo)}var ce=Z.type=="keypress"&&U;Z.type==O&&!v(D)&&!ce&&Q(ie),U=re&&Z.type=="keydown"};function q(D){typeof D.which!="number"&&(D.which=D.keyCode);var k=h(D);if(k){if(D.type=="keyup"&&L===k){L=!1;return}M.handleKey(k,p(D),D)}}function Y(){clearTimeout(B),B=setTimeout(Q,1e3)}function H(D,k,Z,j){b[D]=0;function ee(ye){return function(){O=ye,++b[D],Y()}}function ie(ye){F(Z,ye,D),j!=="keyup"&&(L=h(ye)),setTimeout(Q,10)}for(var te=0;te<k.length;++te){var re=te+1===k.length,ce=re?ie:ee(j||E(k[te+1]).action);V(k[te],ce,j,D,te)}}function V(D,k,Z,j,ee){M._directMap[D+":"+Z]=k,D=D.replace(/\s+/g," ");var ie=D.split(" "),te;if(ie.length>1){H(D,ie,k,Z);return}te=E(D,Z),M._callbacks[te.key]=M._callbacks[te.key]||[],G(te.key,te.modifiers,{type:te.action},j,D,ee),M._callbacks[te.key][j?"unshift":"push"]({callback:k,modifiers:te.modifiers,action:te.action,seq:j,level:ee,combo:D})}M._bindMultiple=function(D,k,Z){for(var j=0;j<D.length;++j)V(D[j],k,Z)},u(T,"keypress",q),u(T,"keydown",q),u(T,"keyup",q)}I.prototype.bind=function(T,M,b){var B=this;return T=T instanceof Array?T:[T],B._bindMultiple.call(B,T,M,b),B},I.prototype.unbind=function(T,M){var b=this;return b.bind.call(b,T,function(){},M)},I.prototype.trigger=function(T,M){var b=this;return b._directMap[T+":"+M]&&b._directMap[T+":"+M]({},T),b},I.prototype.reset=function(){var T=this;return T._callbacks={},T._directMap={},T},I.prototype.stopCallback=function(T,M){var b=this;if((" "+M.className+" ").indexOf(" mousetrap ")>-1||w(M,b.target))return!1;if("composedPath"in T&&typeof T.composedPath=="function"){var B=T.composedPath()[0];B!==T.target&&(M=B)}return M.tagName=="INPUT"||M.tagName=="SELECT"||M.tagName=="TEXTAREA"||M.isContentEditable},I.prototype.handleKey=function(){var T=this;return T._handleKey.apply(T,arguments)},I.addKeycodes=function(T){for(var M in T)T.hasOwnProperty(M)&&(r[M]=T[M]);l=null},I.init=function(){var T=I(t);for(var M in T)M.charAt(0)!=="_"&&(I[M]=function(b){return function(){return T[b].apply(T,arguments)}}(M))},I.init(),e.Mousetrap=I,n.exports&&(n.exports=I),typeof i=="function"&&i.amd&&i(function(){return I})})(typeof window<"u"?window:null,typeof window<"u"?document:null)})(tD);var eue=tD.exports;const Fw=ps(eue),tue=()=>{const n=new Map;let e=[];const t=s=>{s.forEach(a=>{if(!a.disabled)if(a.ref){if(!a.ref.current)return;const o=a.ref.current;n.has(o)||n.set(o,new Fw(o)),n.get(o).bind(a.keys,a.callback,a.action)}else n.get(void 0)||n.set(void 0,Fw),n.get(void 0).bind(a.keys,a.callback,a.action)})},i=s=>{e=[...e,...s],t(s)},r=s=>{e=e.filter(a=>!s.includes(a)),s.forEach(a=>{var o,l;if(a.ref){if(!a.ref.current)return;(o=n.get(a.ref.current))==null||o.unbind(a.keys,a.action)}else(l=n.get(void 0))==null||l.unbind(a.keys,a.action)});for(const[a]of n){if(a===void 0){if(e.some(o=>o.ref===void 0))continue}else if(e.some(o=>{var l;return((l=o.ref)==null?void 0:l.current)===a}))continue;n.delete(a)}t(e)};return()=>{const[s,a]=$.useState([]);return $.useEffect(()=>{a(e)},[]),[s,i,r]}},nue=tue(),nD=n=>{const[e,t,i]=nue();return $.useLayoutEffect(()=>(n&&t(n),()=>{n&&i(n)}),[t,i,n]),$.useMemo(()=>e.reduce((r,s)=>(r.find(a=>a.keys===s.keys&&a.ref&&s.ref)||r.push(s),r),[]),[e])};let iue=!1;try{navigator&&(iue=navigator.platform.toUpperCase().indexOf("MAC")>=0)}catch(n){console.warn(n)}/*!
* hold-event
* https://github.com/yomotsu/hold-event
* (c) 2020 @yomotsu
* Released under the MIT License.
*/var fp;(function(n){n.HOLD_START="holdStart",n.HOLD_END="holdEnd",n.HOLDING="holding"})(fp||(fp={}));class rue{constructor(){this._listeners={}}addEventListener(e,t){const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}removeEventListener(e,t){const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e)}}}class sue extends rue{constructor(e){super(),this._enabled=!0,this._holding=!1,this._intervalId=-1,this._deltaTime=0,this._elapsedTime=0,this._lastTime=0,this._holdStart=t=>{if(!this._enabled||this._holding)return;this._deltaTime=0,this._elapsedTime=0,this._lastTime=performance.now(),this.dispatchEvent({type:fp.HOLD_START,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t}),this._holding=!0;const i=()=>{this._intervalId=this.holdIntervalDelay?window.setTimeout(i,this.holdIntervalDelay):window.requestAnimationFrame(i);const r=performance.now();this._deltaTime=r-this._lastTime,this._elapsedTime+=this._deltaTime,this._lastTime=performance.now(),this.dispatchEvent({type:fp.HOLDING,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t})};this._intervalId=this.holdIntervalDelay?window.setTimeout(i,this.holdIntervalDelay):window.requestAnimationFrame(i)},this._holdEnd=t=>{if(!this._enabled||!this._holding)return;const i=performance.now();this._deltaTime=i-this._lastTime,this._elapsedTime+=this._deltaTime,this._lastTime=performance.now(),this.dispatchEvent({type:fp.HOLD_END,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t}),window.clearTimeout(this._intervalId),window.cancelAnimationFrame(this._intervalId),this._holding=!1},this.holdIntervalDelay=e}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,this._enabled||this._holdEnd())}}class $1 extends sue{constructor(e,t){super(t),this._holdStart=this._holdStart.bind(this),this._holdEnd=this._holdEnd.bind(this);const i=s=>{aue(s)||s.keyCode===e&&this._holdStart(s)},r=s=>{s.keyCode===e&&this._holdEnd(s)};document.addEventListener("keydown",i),document.addEventListener("keyup",r),window.addEventListener("blur",this._holdEnd)}}function aue(n){const e=n.target;return e.tagName==="INPUT"||e.tagName==="SELECT"||e.tagName==="TEXTAREA"||e.isContentEditable}var oue={exports:{}};/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/(function(n){(function(){var e={}.hasOwnProperty;function t(){for(var i=[],r=0;r<arguments.length;r++){var s=arguments[r];if(s){var a=typeof s;if(a==="string"||a==="number")i.push(s);else if(Array.isArray(s)){if(s.length){var o=t.apply(null,s);o&&i.push(o)}}else if(a==="object"){if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]")){i.push(s.toString());continue}for(var l in s)e.call(s,l)&&s[l]&&i.push(l)}}}return i.join(" ")}n.exports?(t.default=t,n.exports=t):window.classNames=t})()})(oue);(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(`._canvas_670zp_1 {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
._container_155l7_1 {
transform-origin: bottom right;
overflow: hidden;
position: absolute;
border: solid 1px var(--radial-menu-border);
}
._container_155l7_1._disabled_155l7_7 {
opacity: 0.6;
}
._container_155l7_1._disabled_155l7_7 ._contentContainer_155l7_10 {
cursor: not-allowed;
}
._container_155l7_1:not(._disabled_155l7_7) ._contentContainer_155l7_10 {
cursor: pointer;
}
._container_155l7_1:not(._disabled_155l7_7) ._contentContainer_155l7_10:hover {
color: var(--radial-menu-active-color);
background: var(--radial-menu-active-background);
}
._container_155l7_1 ._contentContainer_155l7_10 {
width: 200%;
height: 200%;
transform-origin: 50% 50%;
border-radius: 50%;
outline: none;
transition: background 150ms ease-in-out;
color: var(--radial-menu-color);
}
._container_155l7_1 ._contentContainer_155l7_10 ._contentInner_155l7_35 {
position: absolute;
width: 100%;
text-align: center;
}
._container_155l7_1 ._contentContainer_155l7_10 ._contentInner_155l7_35 ._content_155l7_10 {
display: inline-block;
}
._container_155l7_1 svg {
margin: 0 auto;
fill: var(--radial-menu-active-color);
height: 25px;
width: 25px;
display: block;
}
._container_x9hyx_1 {
border-radius: 50%;
z-index: 9;
position: relative;
height: 175px;
width: 175px;
border: solid 5px var(--radial-menu-border);
overflow: hidden;
background: var(--radial-menu-background);
}
._container_x9hyx_1:before {
content: ' ';
background: var(--radial-menu-border);
border-radius: 50%;
height: 25px;
width: 25px;
position: absolute;
z-index: 9;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}`)),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var kw,Nw;function iD(n,e=[]){const t=e.length;for(const i of n){const r=e.indexOf(i);if(r>-1){const s=[...e.slice(r),i].map(a=>a.data.id);throw new Error(`Invalid Graph: Circular node path detected: ${s.join(" -> ")}.`)}t>i.depth&&(i.depth=t,iD(i.out,[...e,i]))}}function rD(n,e){let t=!1;const i=n.reduce((a,o)=>({...a,[o.id]:{data:o,out:[],depth:-1,ins:[]}}),{});try{for(const a of e){const o=a.source,l=a.target;if(!i.hasOwnProperty(o))throw new Error(`Missing source Node ${o}`);if(!i.hasOwnProperty(l))throw new Error(`Missing target Node ${l}`);const c=i[o],u=i[l];u.ins.push(c),c.out.push(u)}iD(Object.values(i))}catch{t=!0}const r=Object.keys(i).map(a=>i[a].depth),s=Math.max(...r);return{invalid:t,depths:i,maxDepth:s||1}}const Gw=["radialin","radialout"];function lue({nodes:n,edges:e,mode:t="lr",nodeLevelRatio:i=2}){const{depths:r,maxDepth:s,invalid:a}=rD(n,e);if(a)return null;const o=Gw.includes(t)?1:5,l=n.length/s*i*o;if(t){const c=(p,m)=>y=>p?(r[y.id].depth-s/2)*l*(m?-1:1):void 0,u=c(["lr","rl"].includes(t),t==="rl"),h=c(["td","bu"].includes(t),t==="td"),f=c(["zin","zout"].includes(t),t==="zout");n.forEach(p=>{p.fx=u(p),p.fy=h(p),p.fz=f(p)})}return Gw.includes(t)?WQ(c=>{const u=r[c.id];return(t==="radialin"?s-u.depth:u.depth)*l}).strength(1):null}function cue(n,e){let t;function i(){t?e(t):(t=n.step(),i())}i()}function q0(n){const e=[],t=[];return n.forEachNode((i,r)=>{e.push({...r,id:i,radius:r.size||1})}),n.forEachEdge((i,r)=>{t.push({...r,id:i})}),{nodes:e,edges:t}}function uue(){function n(F){return()=>F}function e(F){return F.index}let t=e,i=[],r=[],s,a=[100,100],o=n(1),l=n(-1),c=n(100),u=n(.1),h={},f=.1,p=.001,m=[],y=[0,0],v,A=F=>F.cluster,_="treemap",x=!0,E=.1;function w(F){if(!x)return w;_==="force"&&(v.tick(),U());for(let q=0,Y=i.length,H,V=F*E;q<Y;++q)H=i[q],H.vx+=(h[A(H)].x-H.x)*V,H.vy+=(h[A(H)].y-H.y)*V}function I(){i&&(_==="treemap"?O():G())}w.initialize=function(F){i=F,I()};function T(F){let q=A(F.source),Y=A(F.target);return q<=Y?q+"~"+Y:Y+"~"+q}function M(F){let q=new Map,Y={};return F.forEach(function(H){q.has(A(H))||q.set(A(H),{count:0,sumforceNodeSize:0})}),F.forEach(function(H){Y=q.get(A(H)),Y.count=Y.count+1,Y.sumforceNodeSize=Y.sumforceNodeSize+Math.PI*(o(H)*o(H))*1.3,q.set(A(H),Y)}),q}function b(F){let q=new Map,Y=[];return F.forEach(function(H){let V=T(H),D;q.has(V)?D=q.get(V):D=0,D+=1,q.set(V,D)}),q.forEach(function(H,V){let D,k;D=V.split("~")[0],k=V.split("~")[1],D!==void 0&&k!==void 0&&Y.push({source:D,target:k,count:H})}),Y}function B(){let F=[],q=[],Y=new Map,H,V,D,k,Z;k=M(i),Z=b(r);for(H of k.keys())D=k.get(H),F.push({id:H,size:D.count,r:Math.sqrt(D.sumforceNodeSize/Math.PI)}),Y.set(H,V);return Z.forEach(function(j){let ee=Y.get(j.source),ie=Y.get(j.target);ee!==void 0&&ie!==void 0&&q.push({source:ee,target:ie,count:j.count})}),{nodes:F,links:q}}function L(){let F=[],q,Y,H;H=M(w.nodes());for(q of H.keys())Y=H.get(q),F.push({id:q,size:Y.count});return{id:"clustersTree",children:F}}function U(){return h.none={x:0,y:0},m.forEach(function(F){_==="treemap"?h[F.data.id]={x:F.x0+(F.x1-F.x0)/2-y[0],y:F.y0+(F.y1-F.y0)/2-y[1]}:h[F.id]={x:F.x-y[0],y:F.y-y[1]}}),h}function O(){let F=MH().size(w.size());s=l1(L()).sum(q=>q.radius).sort(function(q,Y){return Y.height-q.height||Y.value-q.value}),m=F(s).leaves(),U()}function Q(){let F=0;i.length!==0&&r.forEach(function(q){let Y,H;if(i){if(Y=q.source,H=q.target,typeof q.source!="object"&&(Y=i.find(V=>V.id===q.source)),typeof q.target!="object"&&(H=i.find(V=>V.id===q.target)),Y===void 0||H===void 0)throw Error("Error setting links, couldnt find nodes for a link (see it on the console)");q.source=Y,q.target=H,q.index=F++}})}function G(){let F;if(!(!i||!i.length)){if(i&&i.length>0&&A(i[0])===void 0)throw Error('Couldnt find the grouping attribute for the nodes. Make sure to set it up with forceInABox.groupBy("clusterAttr") before calling .links()');Q(),F=B(),v=Mb(F.nodes).force("x",Bb(a[0]/2).strength(.1)).force("y",Db(a[1]/2).strength(.1)).force("collide",Eb(q=>q.r).iterations(4)).force("charge",Rb().strength(l)).force("links",Sb(F.nodes.length?F.links:[]).distance(c).strength(u)),m=v.nodes(),U()}}return w.template=function(F){return arguments.length?(_=F,I(),w):_},w.groupBy=function(F){return arguments.length?typeof F=="string"?(A=function(q){return q[F]},w):(A=F,w):A},w.enableGrouping=function(F){return arguments.length?(x=F,w):x},w.strength=function(F){return arguments.length?(E=F,w):E},w.getLinkStrength=function(F){return x?A(F.source)===A(F.target)?typeof f=="function"?f(F):f:typeof p=="function"?p(F):p:typeof f=="function"?f(F):f},w.id=function(F){return arguments.length?(t=F,w):t},w.size=function(F){return arguments.length?(a=F,w):a},w.linkStrengthInterCluster=function(F){return arguments.length?(p=F,w):p},w.linkStrengthIntraCluster=function(F){return arguments.length?(f=F,w):f},w.nodes=function(F){return arguments.length?(i=F,w):i},w.links=function(F){return arguments.length?(F===null?r=[]:r=F,I(),w):r},w.template=function(F){return arguments.length?(_=F,I(),w):_},w.forceNodeSize=function(F){return arguments.length?(o=typeof F=="function"?F:n(+F),I(),w):o},w.nodeSize=w.forceNodeSize,w.forceCharge=function(F){return arguments.length?(l=typeof F=="function"?F:n(+F),I(),w):l},w.forceLinkDistance=function(F){return arguments.length?(c=typeof F=="function"?F:n(+F),I(),w):c},w.forceLinkStrength=function(F){return arguments.length?(u=typeof F=="function"?F:n(+F),I(),w):u},w.offset=function(F){return arguments.length?(y=typeof F=="function"?F:n(+F),w):y},w.getFocis=U,w}const hue=100;function El({graph:n,nodeLevelRatio:e=2,mode:t=null,dimensions:i=2,nodeStrength:r=-250,linkDistance:s=50,clusterStrength:a=.5,linkStrengthInterCluster:o=.01,linkStrengthIntraCluster:l=.5,forceLinkDistance:c=100,forceLinkStrength:u=.1,clusterType:h="force",forceCharge:f=-700,getNodePosition:p,drags:m,clusterAttribute:y}){const{nodes:v,edges:A}=q0(n),x=i===2&&A.length>25?r*2:r,E=Mb().force("link",Sb()).force("charge",Rb().strength(x)).force("x",Bb(1200/2).strength(.05)).force("y",Db(1200/2).strength(.05)).force("z",YQ()).force("collide",Eb(M=>M.radius)).force("dagRadial",lue({nodes:v,edges:A,mode:t,nodeLevelRatio:e})).stop();let w;y&&(w=uue().strength(a).template(h).groupBy(M=>M.data[y]).links(A).size([100,100]).linkStrengthInterCluster(o).linkStrengthIntraCluster(l).forceLinkDistance(c).forceLinkStrength(u).forceCharge(f).forceNodeSize(M=>M.radius));let I=E.numDimensions(i).nodes(v);if(w&&(I=I.force("group",w)),s){let M=I.force("link");M&&(M.id(b=>b.id).links(A).distance(s),w&&(M=M.strength((w==null?void 0:w.getLinkStrength)??.1)))}const T=new Map(v.map(M=>[M.id,M]));return{step(){return E.tick(hue),!0},getNodePosition(M){var b,B;if(p){const L=p(M,{graph:n,drags:m,nodes:v,edges:A});if(L)return L}return(b=m==null?void 0:m[M])!=null&&b.position?(B=m==null?void 0:m[M])==null?void 0:B.position:T.get(M)}}}function fue({graph:n,radius:e,drags:t,getNodePosition:i}){const r=UH(n,{scale:e}),{nodes:s,edges:a}=q0(n);return{step(){return!0},getNodePosition(o){var l,c;if(i){const u=i(o,{graph:n,drags:t,nodes:s,edges:a});if(u)return u}return(l=t==null?void 0:t[o])!=null&&l.position?(c=t==null?void 0:t[o])==null?void 0:c.position:r==null?void 0:r[o]}}}const due={td:{x:"x",y:"y",factor:-1},lr:{x:"y",y:"x",factor:1}};function zw({graph:n,drags:e,mode:t="td",getNodePosition:i}){const{nodes:r,edges:s}=q0(n),{depths:a}=rD(r,s),o=Object.keys(a).map(p=>a[p]),l=AH().id(p=>p.data.id).parentId(p=>{var m,y,v;return(v=(y=(m=p.ins)==null?void 0:m[0])==null?void 0:y.data)==null?void 0:v.id})(o),u=wH().separation(()=>1).nodeSize([50,50])(l1(l)).descendants(),h=due[t],f=new Map(r.map(p=>{const{x:m,y}=u.find(v=>v.data.id===p.id);return[p.id,{...p,[h.x]:m*h.factor,[h.y]:y*h.factor,z:0}]}));return{step(){return!0},getNodePosition(p){var m,y;if(i){const v=i(p,{graph:n,drags:e,nodes:r,edges:s});if(v)return v}return(m=e==null?void 0:e[p])!=null&&m.position?(y=e==null?void 0:e[p])==null?void 0:y.position:f.get(p)}}}function pue({graph:n,margin:e,drags:t,getNodePosition:i,ratio:r,gridSize:s,maxIterations:a}){const{nodes:o,edges:l}=q0(n),c=VH(n,{maxIterations:a,inputReducer:(u,h)=>({...h,x:h.x||0,y:h.y||0}),settings:{ratio:r,margin:e,gridSize:s}});return{step(){return!0},getNodePosition(u){var h,f;if(i){const p=i(u,{graph:n,drags:t,nodes:o,edges:l});if(p)return p}return(h=t==null?void 0:t[u])!=null&&h.position?(f=t==null?void 0:t[u])==null?void 0:f.position:c==null?void 0:c[u]}}}function gue({graph:n,drags:e,iterations:t,...i}){uV.assign(n);const r=sV(n,{iterations:t,settings:i});return{step(){return!0},getNodePosition(s){var a;return((a=e==null?void 0:e[s])==null?void 0:a.position)||(r==null?void 0:r[s])}}}function mue({graph:n,drags:e,getNodePosition:t}){const{nodes:i,edges:r}=q0(n);return{step(){return!0},getNodePosition(s){return t(s,{graph:n,drags:e,nodes:i,edges:r})}}}const Aue=["forceDirected2d","treeTd2d","treeLr2d","radialOut2d","treeTd3d","treeLr3d","radialOut3d","forceDirected3d"];function vue({type:n,...e}){if(Aue.includes(n)){const{nodeStrength:t,linkDistance:i,nodeLevelRatio:r}=e;if(n==="forceDirected2d")return El({...e,dimensions:2,nodeLevelRatio:r||2,nodeStrength:t||-250,linkDistance:i});if(n==="treeTd2d")return El({...e,mode:"td",dimensions:2,nodeLevelRatio:r||5,nodeStrength:t||-250,linkDistance:i||50});if(n==="treeLr2d")return El({...e,mode:"lr",dimensions:2,nodeLevelRatio:r||5,nodeStrength:t||-250,linkDistance:i||50});if(n==="radialOut2d")return El({...e,mode:"radialout",dimensions:2,nodeLevelRatio:r||5,nodeStrength:t||-500,linkDistance:i||100});if(n==="treeTd3d")return El({...e,mode:"td",dimensions:3,nodeLevelRatio:r||2,nodeStrength:t||-500,linkDistance:i||50});if(n==="treeLr3d")return El({...e,mode:"lr",dimensions:3,nodeLevelRatio:r||2,nodeStrength:t||-500,linkDistance:i||50});if(n==="radialOut3d")return El({...e,mode:"radialout",dimensions:3,nodeLevelRatio:r||2,nodeStrength:t||-500,linkDistance:i||100});if(n==="forceDirected3d")return El({...e,dimensions:3,nodeLevelRatio:r||2,nodeStrength:t||-250,linkDistance:i})}else if(n==="circular2d"){const{radius:t}=e;return fue({...e,radius:t||300})}else{if(n==="hierarchicalTd")return zw({...e,mode:"td"});if(n==="hierarchicalLr")return zw({...e,mode:"lr"});if(n==="nooverlap"){const{graph:t,maxIterations:i,ratio:r,margin:s,gridSize:a,...o}=e;return pue({type:"nooverlap",graph:t,margin:s||10,maxIterations:i||50,ratio:r||10,gridSize:a||20,...o})}else if(n==="forceatlas2"){const{graph:t,iterations:i,gravity:r,scalingRatio:s,...a}=e;return gue({type:"forceatlas2",graph:t,...a,scalingRatio:s||100,gravity:r||10,iterations:i||50})}else if(n==="custom")return mue({type:"custom",...e})}throw new Error(`Layout ${n} not found.`)}function yue({graph:n}){const e=AV(n);return{ranks:e,getSizeForNode:t=>e[t]*80}}function xue({graph:n}){const e=_V(n);return{ranks:e,getSizeForNode:t=>e[t]*20}}function _ue({graph:n,attribute:e,defaultSize:t}){const i=new Map;return e?n.forEachNode((r,s)=>{var a;const o=(a=s.data)==null?void 0:a[e];isNaN(o)&&console.warn(`Attribute ${o} is not a number for node ${s.id}`),i.set(r,o||0)}):console.warn("Attribute sizing configured but no attribute provided"),{getSizeForNode:r=>!e||!i?t:i.get(r)}}const Qw={pagerank:yue,centrality:xue,attribute:_ue,none:({defaultSize:n})=>({getSizeForNode:e=>n})};function Eue({type:n,...e}){var t;const i=(t=Qw[n])==null?void 0:t.call(Qw,e);if(!i&&n!=="default")throw new Error(`Unknown sizing strategy: ${n}`);const{graph:r,minSize:s,maxSize:a}=e,o=new Map;let l,c;if(r.forEachNode((u,h)=>{let f;n==="default"?f=h.size||e.defaultSize:f=i.getSizeForNode(u),(l===void 0||f<l)&&(l=f),(c===void 0||f>c)&&(c=f),o.set(u,f)}),n!=="none"){const u=tI().domain([l,c]).rangeRound([s,a]);for(const[h,f]of o)o.set(h,u(f))}return o}const Sue=20;function wue(n,e){return(t,i)=>e==="all"||e==="nodes"&&t==="node"||e==="edges"&&t==="edge"?!0:e==="auto"&&t==="node"?n<=Sue?!0:i>7:!1}function sD(n,e){switch(e){case"above":return n;case"below":return-n;case"inline":case"natural":default:return 0}}function Cue(n,e,t){n.clear();for(const i of e)try{n.addNode(i.id,i)}catch({message:r}){console.error(`[Graph] ${r}`)}for(const i of t)try{n.addEdge(i.source,i.target,i)}catch({message:r}){console.error(`[Graph] ${r}`)}return n}function Tue({graph:n,layout:e,sizingType:t,labelType:i,sizingAttribute:r,defaultNodeSize:s,minNodeSize:a,maxNodeSize:o}){const l=[],c=[],u=new Map,h=Eue({graph:n,type:t,attribute:r,minSize:a,maxSize:o,defaultSize:s}),f=n.nodes.length,p=wue(f,i);return n.forEachNode((m,y)=>{const v=e.getNodePosition(m),{data:A,fill:_,icon:x,label:E,size:w,...I}=y,T=h.get(y.id),M=p("node",T),B=(n.inboundNeighbors(y.id)||[]).map(U=>n.getNodeAttributes(U)),L={...y,size:T,labelVisible:M,label:E,icon:x,fill:_,parents:B,data:{...I,...A??{}},position:{...v,x:v.x||0,y:v.y||0,z:v.z||1}};u.set(y.id,L),l.push(L)}),n.forEachEdge((m,y)=>{const v=u.get(y.source),A=u.get(y.target);if(v&&A){const{data:_,id:x,label:E,size:w,...I}=y,T=p("edge",w);c.push({...y,id:x,label:E,labelVisible:T,size:w,data:{...I,id:x,..._||{}}})}}),{nodes:l,edges:c}}const qs={mass:10,tension:1e3,friction:300,precision:.1};function aD(n,e,t){const i=e.getLength(),r=n==="end"?i:i/2,s=n==="end"?t/2:0,a=(r-s)/i,o=e.getPointAt(a),l=e.getTangentAt(a);return[o,l]}function oD(n){return[n+6,2+n/1.5]}function lD(n,e,t=0){const i=new N(n.x,n.y||0,n.z||0),r=new N(e.x,e.y||0,e.z||0),s=new N().addVectors(i,r).divideScalar(2);return s.setLength(s.length()+t)}function bue(n,e,t=-1){const i=n.clone(),r=e.clone(),s=new N().subVectors(r,i),a=s.length(),o=s.clone().normalize(),l=new N().subVectors(r,i).divideScalar(2),c=Math.abs(o.x)%1,u=new N(-o.y,o.x-c*o.z,c*o.y).normalize(),h=new N().add(i).add(l).add(u.multiplyScalar(a/4).multiplyScalar(t));return[n,h,e]}function r0(n,e,t,i,r){const s=Hw(n,t,e),a=Hw(t,n,i);return r?new V2(...bue(s,a)):new Q6(s,a)}function s0(n){return new N(n.position.x,n.position.y,n.position.z||0)}function Hw(n,e,t){const i=n.distanceTo(e);return n.clone().add(e.clone().sub(n).multiplyScalar(t/i))}function Vw(n,e){return{...n,position:{...n.position,x:n.position.x+e.x,y:n.position.y+e.y,z:n.position.z+e.z}}}function A6(n){let e=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY;for(let o of n)e=Math.min(e,o.position.x),t=Math.max(t,o.position.x),i=Math.min(i,o.position.y),r=Math.max(r,o.position.y),s=Math.min(s,o.position.z),a=Math.max(a,o.position.z);return{height:r-i,width:t-e,minX:e,maxX:t,minY:i,maxY:r,minZ:s,maxZ:a,x:(t+e)/2,y:(r+i)/2,z:(a+s)/2}}function Iue(n,e){return e?n.reduce((t,i)=>{const r=i.data[e];return t.set(r,[...t.get(r)||[],i]),t},new Map):new Map}function Mue({nodes:n,clusterAttribute:e}){const t=new Map;if(e){const i=Iue(n,e);for(const[r,s]of i){const a=A6(s);t.set(r,{label:r,nodes:s,position:a})}}return t}const F8=({sensitivity:n=7,interval:e=50,timeout:t=0,disabled:i,onPointerOver:r,onPointerOut:s})=>{const a=$.useRef(!1),o=$.useRef(null),l=$.useRef(0),c=$.useRef({x:null,y:null,px:null,py:null}),u=$.useCallback(v=>{c.current.x=v.clientX,c.current.y=v.clientY},[]),h=$.useCallback(v=>{o.current=clearTimeout(o.current);const{px:A,x:_,py:x,y:E}=c.current;Math.abs(A-_)+Math.abs(x-E)<n?(l.current=1,r(v)):(c.current.px=_,c.current.py=E,o.current=setTimeout(()=>h(v),e))},[e,r,n]),f=$.useCallback(()=>{clearTimeout(o.current),document.removeEventListener("mousemove",u,!1)},[u]),p=$.useCallback(v=>{i||(a.current=!0,f(),l.current!==1&&(c.current.px=v.pointer.x,c.current.py=v.pointer.y,document.addEventListener("mousemove",u,!1),o.current=setTimeout(()=>h(v),t)))},[f,h,i,u,t]),m=$.useCallback(v=>{o.current=clearTimeout(o.current),l.current=0,s(v)},[s]),y=$.useCallback(v=>{a.current=!1,f(),l.current===1&&(o.current=setTimeout(()=>m(v),t))},[f,m,t]);return{pointerOver:p,pointerOut:y}},Rue=({draggable:n,set:e,position:t,onDragStart:i,onDragEnd:r})=>{const s=Cr(y=>y.camera),a=Cr(y=>y.raycaster),o=Cr(y=>y.size),l=Cr(y=>y.gl),{mouse2D:c,mouse3D:u,offset:h,normal:f,plane:p}=$.useMemo(()=>({mouse2D:new _e,mouse3D:new N,offset:new N,normal:new N,plane:new rs}),[]),m=$.useMemo(()=>l.domElement.getBoundingClientRect(),[l.domElement]);return OY({onDragStart:({event:y})=>{const{eventObject:v,point:A}=y;v.getWorldPosition(h).sub(A),u.copy(A),i()},onDrag:({event:y})=>{const v=(y.clientX-((m==null?void 0:m.left)??0))/o.width*2-1,A=-((y.clientY-((m==null?void 0:m.top)??0))/o.height)*2+1;c.set(v,A),a.setFromCamera(c,s),s.getWorldDirection(f).negate(),p.setFromNormalAndCoplanarPoint(f,u),a.ray.intersectPlane(p,u);const _=new N(t.x,t.y,t.z).copy(u).add(h);return e(_)},onDragEnd:r},{drag:{enabled:n,threshold:10}})},{Provider:Bue,useStore:ft}=XW(),Due=({actives:n=[],selections:e=[],collapsedNodeIds:t=[],theme:i})=>qW(r=>({theme:i,edges:[],nodes:[],collapsedNodeIds:t,clusters:new Map,panning:!1,draggingId:null,actives:n,edgeContextMenus:new Set,edgeMeshes:[],selections:e,drags:{},graph:new In,setTheme:s=>r(a=>({...a,theme:s})),setClusters:s=>r(a=>({...a,clusters:s})),setEdgeContextMenus:s=>r(a=>({...a,edgeContextMenus:s})),setEdgeMeshes:s=>r(a=>({...a,edgeMeshes:s})),setPanning:s=>r(a=>({...a,panning:s})),setDrags:s=>r(a=>({...a,drags:s})),setDraggingId:s=>r(a=>({...a,draggingId:s})),setActives:s=>r(a=>({...a,actives:s})),setSelections:s=>r(a=>({...a,selections:s})),setNodes:s=>r(a=>({...a,nodes:s})),setEdges:s=>r(a=>({...a,edges:s})),setNodePosition:(s,a)=>r(o=>{var l,c;const u=o.nodes.find(y=>y.id===s),h=s0(u),p=new N(a.x,a.y,a.z).sub(h),m=[...o.nodes];if((l=o.selections)!=null&&l.includes(s))(c=o.selections)==null||c.forEach(y=>{const v=o.nodes.find(A=>A.id===y);if(v){const A=o.nodes.indexOf(v);m[A]=Vw(v,p)}});else{const y=o.nodes.indexOf(u);m[y]=Vw(u,p)}return{...o,drags:{...o.drags,[s]:u},nodes:m}}),setCollapsedNodeIds:(s=[])=>r(a=>({...a,collapsedNodeIds:s}))}));function cD({nodeId:n,nodes:e,edges:t,currentHiddenNodes:i,currentHiddenEdges:r}){const s=[],a=[],o=i.map(p=>p.id),l=r.map(p=>p.id),c=t.filter(p=>p.source===n),u=c.map(p=>p.target);a.push(...c);for(const p of u){const m=t.filter(v=>v.target===p&&v.source!==n);let y=!1;if((m.length===0||m.length>0&&!o.includes(p)&&m.map(A=>A.id).every(A=>l.includes(A)))&&(y=!0),y){const v=e.find(_=>_.id===p);v&&s.push(v);const A=cD({nodeId:p,nodes:e,edges:t,currentHiddenEdges:a,currentHiddenNodes:s});a.push(...A.hiddenEdges),s.push(...A.hiddenNodes)}}const h=Object.values(a.reduce((p,m)=>({...p,[m.id]:m}),{})),f=Object.values(s.reduce((p,m)=>({...p,[m.id]:m}),{}));return{hiddenEdges:h,hiddenNodes:f}}const Pue=({collapsedIds:n,nodes:e,edges:t})=>{const i=[],r=[];for(const c of n){const{hiddenEdges:u,hiddenNodes:h}=cD({nodeId:c,nodes:e,edges:t,currentHiddenEdges:r,currentHiddenNodes:i});i.push(...h),r.push(...u)}const s=i.map(c=>c.id),a=r.map(c=>c.id),o=e.filter(c=>!s.includes(c.id)),l=t.filter(c=>!a.includes(c.id));return{visibleNodes:o,visibleEdges:l}},Lue=({layoutType:n,sizingType:e,labelType:t,sizingAttribute:i,clusterAttribute:r,selections:s,nodes:a,edges:o,actives:l,collapsedNodeIds:c,defaultNodeSize:u,maxNodeSize:h,minNodeSize:f,layoutOverrides:p})=>{const m=ft(F=>F.graph),y=ft(F=>F.setClusters),v=ft(F=>F.collapsedNodeIds),A=ft(F=>F.setEdges),_=ft(F=>F.setNodes),x=ft(F=>F.setSelections),E=ft(F=>F.setActives),w=ft(F=>F.drags),I=ft(F=>F.setDrags),T=ft(F=>F.setCollapsedNodeIds),[M,b]=$.useState(!1),B=$.useRef(!1),L=$.useRef(null),{visibleEdges:U,visibleNodes:O}=$.useMemo(()=>{const{visibleEdges:F,visibleNodes:q}=Pue({collapsedIds:v,nodes:a,edges:o});return{visibleEdges:F,visibleNodes:q}},[v,a,o]),Q=$.useRef(w);$.useEffect(()=>{Q.current=w},[w]);const G=$.useCallback(F=>{L.current=F||vue({...p,type:n,graph:m,drags:Q.current,clusterAttribute:r}),cue(L.current,()=>{const q=Tue({graph:m,layout:L.current,sizingType:e,labelType:t,sizingAttribute:i,maxNodeSize:h,minNodeSize:f,defaultNodeSize:u}),Y=Mue({nodes:q.nodes,clusterAttribute:r});A(q.edges),_(q.nodes),y(Y)})},[p,y,n,m,r,e,t,i,h,f,u,A,_]);return $.useEffect(()=>{x(s)},[s,x]),$.useEffect(()=>{E(l)},[l,E]),$.useLayoutEffect(()=>{B.current=!1,Cue(m,O,U),G(),requestAnimationFrame(()=>{B.current=!0,b(!0)})},[O,U,m]),$.useEffect(()=>{T(c)},[c,T]),$.useEffect(()=>{B.current&&(Q.current={},I({}),G())},[m,n,G,I]),$.useEffect(()=>{B.current&&G(L.current)},[m,e,i,t,G]),{mounted:M}},X0=({text:n,fontSize:e,fontUrl:t,color:i,opacity:r,stroke:s,active:a,ellipsis:o})=>{const l=o&&!a?Zce(n,o):n,c=$.useMemo(()=>new He(i),[i]),u=$.useMemo(()=>s?new He(s):void 0,[s]);return Ne.jsx(NB,{position:[0,0,1],children:Ne.jsx(qce,{font:t,fontSize:e,color:c,fillOpacity:r,textAlign:"center",outlineWidth:s?1:0,outlineColor:u,depthOffset:0,maxWidth:100,overflowWrap:"break-word",children:l})})};X0.defaultProps={opacity:1,fontSize:7,color:"#2A6475",ellipsis:75};const uD=({color:n,id:e,size:t,opacity:i,animated:r})=>{const{scale:s,nodeOpacity:a}=Vs({from:{scale:[1e-5,1e-5,1e-5],nodeOpacity:0},to:{scale:[t,t,t],nodeOpacity:i},config:{...qs,duration:r?void 0:0}}),o=$.useMemo(()=>new He(n),[n]);return Ne.jsxs(mi.mesh,{userData:{id:e,type:"node"},scale:s,children:[Ne.jsx("sphereGeometry",{attach:"geometry",args:[1,25,25]}),Ne.jsx(mi.meshPhongMaterial,{attach:"material",side:$n,transparent:!0,fog:!0,opacity:a,color:o})]})};uD.defaultProps={opacity:1,active:!1};const hD=({color:n,size:e,opacity:t,animated:i})=>{const r=$.useMemo(()=>new He(n),[n]),{ringSize:s,ringOpacity:a}=Vs({from:{ringOpacity:0,ringSize:[1e-5,1e-5,1e-5]},to:{ringOpacity:t,ringSize:[e/2,e/2,1]},config:{...qs,duration:i?void 0:0}});return Ne.jsx(NB,{position:[0,0,1],children:Ne.jsxs(mi.mesh,{scale:s,children:[Ne.jsx("ringGeometry",{attach:"geometry",args:[4,4.5,25]}),Ne.jsx(mi.meshBasicMaterial,{attach:"material",color:r,transparent:!0,depthTest:!1,opacity:a,side:$n,fog:!0})]})})};hD.defaultProps={color:"#D8E6EA",size:1,opacity:.5};const fD=$.createContext({controls:null,resetControls:()=>{},zoomIn:()=>{},zoomOut:()=>{},panLeft:()=>{},panRight:()=>{},panUp:()=>{},panDown:()=>{}}),k8=()=>{const n=$.useContext(fD);if(n===void 0)throw new Error("`useCameraControls` hook must be used within a `ControlsProvider` component");return n};Tl.install({THREE:{MOUSE:iC,Vector2:_e,Vector3:N,Vector4:jt,Quaternion:$i,Matrix4:ct,Spherical:YT,Box3:gs,Sphere:ms,Raycaster:r4,MathUtils:{DEG2RAD:(kw=Ll)==null?void 0:kw.DEG2RAD,clamp:(Nw=Ll)==null?void 0:Nw.clamp}}});tb({ThreeCameraControls:Tl});const J1={ARROW_LEFT:37,ARROW_UP:38,ARROW_RIGHT:39,ARROW_DOWN:40},Ww=new $1(J1.ARROW_LEFT,100),Yw=new $1(J1.ARROW_RIGHT,100),qw=new $1(J1.ARROW_UP,100),Xw=new $1(J1.ARROW_DOWN,100),dD=$.forwardRef(({mode:n,children:e,animated:t,disabled:i},r)=>{const s=$.useRef(null),a=Cr(x=>x.camera),o=Cr(x=>x.gl),l=n==="orbit",c=ft(x=>x.setPanning);a1((x,E)=>{var w,I;(w=s.current)!=null&&w.enabled&&((I=s.current)==null||I.update(E)),l&&(s.current.azimuthAngle+=20*E*Ll.DEG2RAD)},-1),$.useEffect(()=>()=>{var x;return(x=s.current)==null?void 0:x.dispose()},[]);const u=$.useCallback(()=>{var x;(x=s.current)==null||x.zoom(a.zoom/2,t)},[t,a.zoom]),h=$.useCallback(()=>{var x;(x=s.current)==null||x.zoom(-a.zoom/2,t)},[t,a.zoom]),f=$.useCallback(x=>{var E;l||(E=s.current)==null||E.truck(-.03*x.deltaTime,0,t)},[t,l]),p=$.useCallback(x=>{var E;l||(E=s.current)==null||E.truck(.03*x.deltaTime,0,t)},[t,l]),m=$.useCallback(x=>{var E;l||(E=s.current)==null||E.truck(0,.03*x.deltaTime,t)},[t,l]),y=$.useCallback(x=>{var E;l||(E=s.current)==null||E.truck(0,-.03*x.deltaTime,t)},[t,l]),v=$.useCallback(x=>{x.code==="Space"&&(n==="rotate"?s.current.mouseButtons.left=Tl.ACTION.TRUCK:s.current.mouseButtons.left=Tl.ACTION.ROTATE)},[n]),A=$.useCallback(x=>{x.code==="Space"&&(n==="rotate"?s.current.mouseButtons.left=Tl.ACTION.ROTATE:s.current.mouseButtons.left=Tl.ACTION.TRUCK)},[n]);$.useEffect(()=>(Ww.addEventListener("holding",p),Yw.addEventListener("holding",f),qw.addEventListener("holding",m),Xw.addEventListener("holding",y),window.addEventListener("keydown",v),window.addEventListener("keyup",A),()=>{Ww.removeEventListener("holding",p),Yw.removeEventListener("holding",f),qw.removeEventListener("holding",m),Xw.removeEventListener("holding",y),window.removeEventListener("keydown",v),window.removeEventListener("keyup",A)}),[v,A,y,p,f,m]),$.useEffect(()=>{const x=()=>c(!0),E=()=>c(!1),w=s.current;return w&&(w.addEventListener("control",x),w.addEventListener("controlend",E)),()=>{w&&(w.removeEventListener("control",x),w.removeEventListener("controlend",E))}},[s,c]),$.useEffect(()=>{n==="rotate"?s.current.mouseButtons.left=Tl.ACTION.ROTATE:s.current.mouseButtons.left=Tl.ACTION.TRUCK},[n]),nD([{name:"Zoom In",category:"Graph",keys:"command+shift+i",callback:x=>{x.preventDefault(),u()}},{name:"Zoom Out",category:"Graph",keys:"command+shift+o",callback:x=>{x.preventDefault(),h()}}]);const _=$.useMemo(()=>({controls:s.current,zoomIn:()=>u(),zoomOut:()=>h(),panLeft:()=>p({deltaTime:1}),panRight:()=>f({deltaTime:1}),panDown:()=>y({deltaTime:1}),panUp:()=>m({deltaTime:1}),resetControls:x=>{var E;return(E=s.current)==null?void 0:E.reset(x)}}),[u,h,p,f,y,m,s.current]);return $.useImperativeHandle(r,()=>_),Ne.jsxs(fD.Provider,{value:_,children:[Ne.jsx("threeCameraControls",{ref:s,args:[a,o.domElement],enabled:!i,smoothTime:.1,minDistance:1e3,maxDistance:5e4}),e]})});dD.defaultProps={mode:"rotate"};const L5=50,Uue=({animated:n})=>{const e=ft(l=>l.nodes),t=Cr(l=>l.invalidate),{controls:i}=k8(),r=$.useMemo(()=>{const{maxX:l,maxY:c}=A6(e);return Math.max(l,c)},[e]),s=$.useCallback((l,c=L5,u=!1)=>{const{minX:h,maxX:f,minY:p,maxY:m,minZ:y,maxZ:v}=A6(l);i==null||i.fitToBox(new gs(new N(h,p,y),new N(f,m,v)),n,{cover:u,paddingLeft:c,paddingRight:c,paddingBottom:c,paddingTop:c}),t()},[t,i,n]),a=$.useCallback(l=>{let c=null,u=L5;l!=null&&l.length&&(u=r+L5,c=l.reduce((h,f)=>{const p=e.find(m=>m.id===f);if(p)h.push(p);else throw new Error(`Attempted to center ${f} but it was not found in the nodes`);return h},[])),s(c||e,u,!!c)},[s,e,r]),o=$.useRef(!1);return $.useLayoutEffect(()=>{i&&(e!=null&&e.length)&&!o.current&&(s(e),o.current=!0)},[i,s,e]),nD([{name:"Center",category:"Graph",keys:["command+shift+c"],callback:()=>s(e)}]),{centerNodes:s,centerNodesById:a}},pD=({image:n,id:e,size:t,opacity:i,animated:r})=>{const s=$.useMemo(()=>new LT().load(n),[n]),{scale:a,spriteOpacity:o}=Vs({from:{scale:[1e-5,1e-5,1e-5],spriteOpacity:0},to:{scale:[t,t,t],spriteOpacity:i},config:{...qs,duration:r?void 0:0}});return Ne.jsx(mi.sprite,{userData:{id:e,type:"node"},scale:a,children:Ne.jsx(mi.spriteMaterial,{attach:"material",opacity:o,fog:!0,depthTest:!1,transparent:!0,side:$n,children:Ne.jsx("primitive",{attach:"map",object:s,minFilter:Tn})})})};pD.defaultProps={opacity:1};const gD=({animated:n,disabled:e,id:t,draggable:i,labelFontUrl:r,contextMenu:s,onClick:a,onPointerOver:o,onDragged:l,onPointerOut:c,onContextMenu:u,renderNode:h})=>{const f=k8(),p=ft(ce=>ce.theme),m=ft(ce=>ce.nodes.find(ye=>ye.id===t)),y=ft(ce=>ce.edges),v=ft(ce=>ce.draggingId),A=ft(ce=>ce.collapsedNodeIds),_=ft(ce=>ce.setDraggingId),x=ft(ce=>ce.setNodePosition),E=ft(ce=>ce.setCollapsedNodeIds),w=ft(ce=>ce.collapsedNodeIds.includes(t)),I=ft(ce=>{var ye;return(ye=ce.actives)==null?void 0:ye.includes(t)}),T=ft(ce=>{var ye;return(ye=ce.selections)==null?void 0:ye.includes(t)}),M=ft(ce=>{var ye;return((ye=ce.selections)==null?void 0:ye.length)>0}),b=v===t,{position:B,label:L,size:U=7,labelVisible:O=!0}=m,Q=$.useRef(null),[G,F]=$.useState(!1),[q,Y]=$.useState(!1),H=M?T||G||I?p.node.selectedOpacity:p.node.inactiveOpacity:p.node.opacity,V=$.useMemo(()=>y.filter(ye=>ye.source===t).length>0||w,[y,t,w]),D=$.useCallback(()=>{V&&E(w?A.filter(ce=>ce!==t):[...A,t])},[V,A,t,w,E]),[{nodePosition:k,labelPosition:Z}]=Vs(()=>({from:{nodePosition:[0,0,0],labelPosition:[0,-(U+7),2]},to:{nodePosition:B?[B.x,B.y,B.z]:[0,0,0],labelPosition:[0,-(U+7),2]},config:{...qs,duration:n&&!v?void 0:0}}),[b,B,n,U]),j=Rue({draggable:i,position:B,set:ce=>x(t,ce),onDragStart:()=>{_(t),F(!0),f.controls.enabled=!1},onDragEnd:()=>{_(null),F(!1),f.controls.enabled=!0,l==null||l(m)}});np(G&&!v&&a!==void 0,"pointer"),np(G&&i&&!b&&a===void 0,"grab"),np(b,"grabbing");const ee=T||G||b||I,ie=ee?p.node.activeFill:m.fill||p.node.fill,{pointerOver:te,pointerOut:re}=F8({disabled:e||b,onPointerOver:()=>{F(!0),o==null||o(m)},onPointerOut:()=>{F(!1),c==null||c(m)}});return Ne.jsxs(mi.group,{userData:{id:t,type:"node"},ref:Q,position:k,onPointerOver:te,onPointerOut:re,onClick:()=>{!e&&!b&&(a==null||a(m,{canCollapse:V,isCollapsed:w}))},onContextMenu:()=>{e||(Y(!0),u==null||u(m,{canCollapse:V,isCollapsed:w,onCollapse:D}))},...j(),children:[h?h({id:t,color:ie,size:U,active:ee,opacity:H,animated:n,node:m}):Ne.jsx(Ne.Fragment,{children:m.icon?Ne.jsx(pD,{id:t,image:m.icon||"",size:U+8,opacity:H,animated:n,color:ie,node:m,active:ee}):Ne.jsx(uD,{id:t,size:U,opacity:H,animated:n,color:ie,node:m,active:ee})}),Ne.jsx(hD,{opacity:T?.5:0,size:U,animated:n,color:T||G?p.ring.activeFill:p.ring.fill}),q&&s&&Ne.jsx(N4,{prepend:!0,center:!0,children:s({data:m,canCollapse:V,isCollapsed:w,onCollapse:D,onClose:()=>Y(!1)})}),(O||T||G)&&L&&Ne.jsx(mi.group,{position:Z,children:Ne.jsx(X0,{text:L,fontUrl:r,opacity:H,stroke:p.node.label.stroke,active:T||G||b||I,color:T||G||b||I?p.node.label.activeColor:p.node.label.color})})]})};gD.defaultProps={draggable:!1};const mD=({animated:n,color:e,length:t,opacity:i,position:r,rotation:s,size:a,onActive:o,onContextMenu:l})=>{const c=$.useMemo(()=>new He(e),[e]),u=$.useRef(null),h=ft(y=>y.draggingId),[{pos:f,arrowOpacity:p}]=Vs(()=>({from:{pos:[0,0,0],arrowOpacity:0},to:{pos:[r.x,r.y,r.z],arrowOpacity:i},config:{...qs,duration:n&&!h?void 0:0}}),[n,h,i,r]),m=$.useCallback(()=>{var y;const v=new N(0,1,0);(y=u.current)==null||y.quaternion.setFromUnitVectors(v,s)},[s,u]);return $.useEffect(()=>m(),[m]),Ne.jsxs(mi.mesh,{position:f,ref:u,scale:[1,1,1],onPointerOver:()=>o(!0),onPointerOut:()=>o(!1),onPointerDown:y=>{y.nativeEvent.buttons===2&&(y.stopPropagation(),l())},children:[Ne.jsx("cylinderGeometry",{args:[0,a,t,20,1,!0],attach:"geometry"}),Ne.jsx(mi.meshBasicMaterial,{attach:"material",color:c,depthTest:!1,opacity:p,transparent:!0,side:$n,fog:!0})]})};mD.defaultProps={size:1,opacity:.5,color:"#D8E6EA"};const AD=({animated:n,color:e,curve:t,curved:i=!1,id:r,opacity:s,size:a,onContextMenu:o,onClick:l,onPointerOver:c,onPointerOut:u})=>{const h=$.useRef(null),f=ft(y=>y.draggingId),p=$.useMemo(()=>new He(e),[e]),{lineOpacity:m}=Vs({from:{lineOpacity:0},to:{lineOpacity:s},config:{...qs,duration:n?void 0:0}});return Vs(()=>{const y=t.getPoint(0),v=t.getPoint(1);return{from:{fromVertices:[0,0,0],toVertices:[0,0,0]},to:{fromVertices:[y==null?void 0:y.x,y==null?void 0:y.y,(y==null?void 0:y.z)||0],toVertices:[v==null?void 0:v.x,v==null?void 0:v.y,(v==null?void 0:v.z)||0]},onChange:A=>{const{fromVertices:_,toVertices:x}=A.value,E=new N(..._),w=new N(...x),I=r0(E,0,w,0,i);h.current.copy(new su(I,20,a/2,5,!1))},config:{...qs,duration:n&&!f?void 0:0}}},[n,f,t,a]),Ne.jsxs("mesh",{userData:{id:r,type:"edge"},onPointerOver:c,onPointerOut:u,onClick:l,onPointerDown:y=>{y.nativeEvent.buttons===2&&(y.stopPropagation(),o())},children:[Ne.jsx("tubeGeometry",{attach:"geometry",ref:h}),Ne.jsx(mi.meshBasicMaterial,{attach:"material",opacity:m,fog:!0,transparent:!0,depthTest:!1,color:p})]})};AD.defaultProps={color:"#000",size:1,opacity:1};const S2=6,vD=({animated:n,arrowPlacement:e,contextMenu:t,disabled:i,labelPlacement:r,id:s,interpolation:a,labelFontUrl:o,onContextMenu:l,onClick:c,onPointerOver:u,onPointerOut:h})=>{const f=ft(ie=>ie.theme),p=ft(ie=>ie.edges.find(te=>te.id===s)),{target:m,source:y,label:v,labelVisible:A=!1,size:_=1}=p,x=a==="curved",E=ft(ie=>ie.nodes.find(te=>te.id===y)),w=ft(ie=>ie.nodes.find(te=>te.id===m)),I=ft(ie=>ie.draggingId),[T,M]=$.useState(!1),[b,B]=$.useState(!1),L=(_+S2)/2,[U,O]=$.useMemo(()=>oD(_),[_]),[Q,G,F]=$.useMemo(()=>{const ie=s0(E),te=E.size,re=s0(w),ce=w.size;let ye=r0(ie,te,re,ce,x);const[oe,W]=aD(e,ye,U);return e==="end"&&(ye=r0(ie,te,oe,0,x)),[ye,oe,W]},[x,E,w,e,U]),q=$.useMemo(()=>lD(E.position,w.position,sD(L,r)),[E.position,w.position,L,r]),Y=ft(ie=>{var te;return(te=ie.selections)==null?void 0:te.includes(s)}),H=ft(ie=>{var te;return(te=ie.selections)==null?void 0:te.length}),V=ft(ie=>{var te;return(te=ie.actives)==null?void 0:te.includes(s)}),D=H?Y||V?f.edge.selectedOpacity:f.edge.inactiveOpacity:f.edge.opacity,[{labelPosition:k}]=Vs(()=>({from:{labelPosition:[0,0,0]},to:{labelPosition:[q.x,q.y,q.z]},config:{...qs,duration:n&&!I?void 0:0}}),[q,n,I]),Z=$.useMemo(()=>new vu(0,0,r==="natural"?0:Math.atan((w.position.y-E.position.y)/(w.position.x-E.position.x))),[w.position.x,w.position.y,E.position.x,E.position.y,r]);np(T&&!I&&c!==void 0,"pointer");const{pointerOver:j,pointerOut:ee}=F8({disabled:i,onPointerOver:()=>{M(!0),u==null||u(p)},onPointerOut:()=>{M(!1),h==null||h(p)}});return Ne.jsxs("group",{children:[Ne.jsx(AD,{animated:n,color:Y||T||V?f.edge.activeFill:f.edge.fill,curve:Q,curved:x,id:s,opacity:D,size:_,onClick:()=>{i||c==null||c(p)},onPointerOver:j,onPointerOut:ee,onContextMenu:()=>{i||(B(!0),l==null||l(p))}}),e!=="none"&&Ne.jsx(mD,{animated:n,color:Y||T||V?f.arrow.activeFill:f.arrow.fill,length:U,opacity:D,position:G,rotation:F,size:O,onActive:M,onContextMenu:()=>{i||(B(!0),l==null||l(p))}}),A&&v&&Ne.jsx(mi.group,{position:k,rotation:Z,children:Ne.jsx(X0,{text:v,ellipsis:15,fontUrl:o,stroke:f.edge.label.stroke,color:Y||T||V?f.edge.label.activeColor:f.edge.label.color,opacity:D,fontSize:S2})}),b&&t&&Ne.jsx(N4,{prepend:!0,center:!0,children:t({data:p,onClose:()=>B(!1)})})]})};vD.defaultProps={labelPlacement:"inline",arrowPlacement:"end"};const jw=new qo(0,0,0);function Oue(n,e){const t=$.useRef();ft(o=>{t.current=o});const i=$.useRef(new Map),r=e==="curved",s=$.useCallback(o=>{const l=[],c=i.current,{nodes:u}=t.current;return o.forEach(h=>{const{target:f,source:p,size:m=1}=h,y=u.find(G=>G.id===p),v=u.find(G=>G.id===f);if(!y||!v)return;const A=`fromX:${y.position.x},fromY:${y.position.y},toX:${v.position.x}},toY:${v.position.y}`;if(c.has(A)){const G=c.get(A);l.push(G);return}const _=s0(y),x=y.size+S2,E=s0(v),w=v.size+S2;let I=r0(_,x,E,w,r),T=new su(I,20,m/2,5,!1);if(n==="none"){l.push(T),c.set(A,T);return}const[M,b]=oD(m),[B,L]=aD(n,I,M),U=new $i;U.setFromUnitVectors(new N(0,1,0),L);const O=new yu(0,b,M,20,1,!0);if(O.applyQuaternion(U),O.translate(B.x,B.y,B.z),n&&n==="end"){const G=r0(_,x,B,0,r);T=new su(G,20,m/2,5,!1)}const Q=Vg([T,O]);l.push(Q),c.set(A,Q)}),l},[n,r]),a=$.useCallback((o,l)=>{const c=s(o),u=s(l);return Vg([u.length?Vg(u):jw,c.length?Vg(c):jw],!0)},[s]);return{getGeometries:s,getGeometry:a}}function Fue(n,e,t){const{onClick:i,onContextMenu:r,onPointerOut:s,onPointerOver:a}=n,o=ft(m=>m.edgeContextMenus),l=ft(m=>m.setEdgeContextMenus),c=$.useRef(!1),u=$.useCallback(()=>{c.current=!0},[]),h=$.useRef(!1),f=$.useCallback(()=>{h.current=!0},[]),p=$.useCallback((m,y)=>{i&&c.current&&(c.current=!1,t||y.forEach(v=>{i(v)})),(e||r)&&h.current&&(h.current=!1,t||y.forEach(v=>{o.has(v.id)||(l(new Set([...o,v.id])),r==null||r(v))})),a&&y.filter(A=>!m.includes(A)).forEach(A=>{a(A)}),s&&m.filter(A=>!y.includes(A)).forEach(A=>{s(A)})},[e,t,o,l,i,r,a,s]);return{handleClick:u,handleContextMenu:f,handleIntersections:p}}function kue(n,e){const t=$.useRef(n);$.useEffect(()=>{t.current=n},[n]);const i=$.useCallback(()=>{const s=t.current.getAttribute("position"),a=Array.from({length:s.array.length}).fill(0),o=Array.from(s.array);return{from:a,to:o}},[]),r=$.useCallback(s=>{const a=new Float32Array(s),o=new En(a,3,!1);t.current.setAttribute("position",o),o.needsUpdate=!0},[]);Vs(()=>{if(!e)return null;const s=i();return{from:{positions:s.from},to:{positions:s.to},onChange:a=>{r(a.value.positions)},config:{...qs,duration:e?void 0:0}}},[e])}function Nue(n,e,t){const[{activeOpacity:i,inactiveOpacity:r}]=Vs(()=>({from:{activeOpacity:0,inactiveOpacity:0},to:{activeOpacity:e?t.edge.selectedOpacity:t.edge.opacity,inactiveOpacity:e?t.edge.inactiveOpacity:t.edge.opacity},config:{...qs,duration:n?void 0:0}}),[n,e,t]);return{activeOpacity:i,inactiveOpacity:r}}const Kw=6,yD=({animated:n,color:e,contextMenu:t,edge:i,labelFontUrl:r,labelPlacement:s,opacity:a,theme:o})=>{const{target:l,source:c,label:u,labelVisible:h=!1,size:f=1}=i,p=ft(M=>M.nodes),m=p.find(M=>M.id===c),y=p.find(M=>M.id===l),v=ft(M=>M.draggingId),A=(f+Kw)/2,_=$.useMemo(()=>lD(m.position,y.position,sD(A,s)),[m.position,y.position,A,s]),x=ft(M=>M.edgeContextMenus),E=ft(M=>M.setEdgeContextMenus),[{labelPosition:w}]=Vs(()=>({from:{labelPosition:[0,0,0]},to:{labelPosition:[_.x,_.y,_.z]},config:{...qs,duration:n&&!v?void 0:0}}),[_,n,v]),I=$.useCallback(M=>{x.delete(M.id),E(new Set(x.values()))},[x,E]),T=$.useMemo(()=>new vu(0,0,s==="natural"?0:Math.atan((y.position.y-m.position.y)/(y.position.x-m.position.x))),[y.position.x,y.position.y,m.position.x,m.position.y,s]);return Ne.jsxs("group",{children:[h&&u&&Ne.jsx(mi.group,{position:w,rotation:T,children:Ne.jsx(X0,{text:u,ellipsis:15,fontUrl:r,stroke:o.edge.label.stroke,color:e,opacity:a,fontSize:Kw})}),t&&x.has(i.id)&&Ne.jsx(N4,{prepend:!0,center:!0,position:_,children:t({data:i,onClose:()=>I(i)})})]})};yD.defaultProps={labelPlacement:"inline"};const Gue=({animated:n,arrowPlacement:e="end",contextMenu:t,disabled:i,edges:r,interpolation:s="linear",labelFontUrl:a,labelPlacement:o="inline",theme:l,onClick:c,onContextMenu:u,onPointerOut:h,onPointerOver:f})=>{const{getGeometries:p,getGeometry:m}=Oue(e,s),y=ft(V=>V.draggingId),v=ft(V=>V.edgeMeshes),A=ft(V=>V.setEdgeMeshes),_=ft(V=>V.actives||[]),x=ft(V=>V.selections||[]),[E,w,I,T]=$.useMemo(()=>{const V=[],D=[],k=[],Z=[];return r.forEach(j=>{if(y===j.source||y===j.target){x.includes(j.id)||_.includes(j.id)?k.push(j):Z.push(j);return}x.includes(j.id)||_.includes(j.id)?V.push(j):D.push(j)}),[V,D,k,Z]},[r,_,x,y]),M=!!x.length,b=$.useMemo(()=>m(E,w),[m,E,w]),{activeOpacity:B,inactiveOpacity:L}=Nue(n,M,l);kue(b,n),$.useEffect(()=>{if(y===null){const D=p(r).map(k=>new nn(k));A(D)}},[p,A,r,y]);const U=$.useRef(new nn),O=$.useRef(new nn),Q=$.useCallback(V=>{if(!V.camera)return[];const D=V.intersectObjects(v);return D.length?D.map(k=>r[v.indexOf(k.object)]):[]},[v,r]),{handleClick:G,handleContextMenu:F,handleIntersections:q}=Fue({onClick:c,onContextMenu:u,onPointerOut:h,onPointerOver:f},t,i),Y=$.useRef(null),H=$.useRef([]);return a1(V=>{if(U.current.geometry=b,i)return;const D=Y.current;if((y||y===null&&D!==null)&&(O.current.geometry=m(I,T)),Y.current=y,y)return;const k=H.current,Z=Q(V.raycaster);q(k,Z),Z.join()!==k.join()&&(O.current.geometry=m(Z,[])),H.current=Z}),Ne.jsxs("group",{onClick:G,onContextMenu:F,children:[Ne.jsxs("mesh",{ref:U,children:[Ne.jsx(mi.meshBasicMaterial,{attach:"material-0",color:l.edge.fill,depthTest:!1,fog:!0,opacity:L,side:$n,transparent:!0}),Ne.jsx(mi.meshBasicMaterial,{attach:"material-1",color:l.edge.activeFill,depthTest:!1,fog:!0,opacity:B,side:$n,transparent:!0})]}),Ne.jsxs("mesh",{ref:O,children:[Ne.jsx(mi.meshBasicMaterial,{attach:"material-0",color:l.edge.fill,depthTest:!1,fog:!0,opacity:L,side:$n,transparent:!0}),Ne.jsx(mi.meshBasicMaterial,{attach:"material-1",color:l.edge.activeFill,depthTest:!1,fog:!0,opacity:B,side:$n,transparent:!0})]}),r.map(V=>Ne.jsx(yD,{animated:n,contextMenu:t,color:l.edge.label.color,disabled:i,edge:V,labelFontUrl:a,labelPlacement:o,theme:l},V.id))]})},xD=({animated:n,position:e,padding:t,labelFontUrl:i,disabled:r,radius:s,nodes:a,label:o,onClick:l,onPointerOver:c,onPointerOut:u})=>{var h,f,p,m;const y=ft(G=>G.theme),v=Math.max(e.width,e.height)/2,A=v-s+t,[_,x]=$.useState(!1),E=ft(G=>{var F;return(F=G.actives)==null?void 0:F.some(q=>a.some(Y=>Y.id===q))}),w=ft(G=>{var F;return(F=G.selections)==null?void 0:F.some(q=>a.some(Y=>Y.id===q))}),T=ft(G=>{var F;return((F=G.selections)==null?void 0:F.length)>0})?w||_||E?y.cluster.selectedOpacity:y.cluster.inactiveOpacity:y.cluster.opacity,{circleOpacity:M,circlePosition:b,labelPosition:B}=Vs({from:{circlePosition:[0,0,-1],circleOpacity:0,labelPosition:[0,0,2]},to:{labelPosition:[0,-A,2],circlePosition:e?[e.x,e.y,-1]:[0,0,-1],circleOpacity:T},config:{...qs,duration:n?void 0:0}}),L=$.useMemo(()=>{var G;return new He((G=y.cluster)==null?void 0:G.stroke)},[(h=y.cluster)==null?void 0:h.stroke]),U=$.useMemo(()=>{var G;return new He((G=y.cluster)==null?void 0:G.fill)},[(f=y.cluster)==null?void 0:f.fill]);np(_&&l!==void 0,"pointer");const{pointerOver:O,pointerOut:Q}=F8({disabled:r,onPointerOver:()=>{x(!0),c==null||c({nodes:a,label:o})},onPointerOut:()=>{x(!1),u==null||u({nodes:a,label:o})}});return Ne.jsx(Ne.Fragment,{children:y.cluster&&Ne.jsxs(mi.group,{position:b,onPointerOver:O,onPointerOut:Q,onClick:()=>{r||l==null||l({nodes:a,label:o})},children:[Ne.jsxs("mesh",{children:[Ne.jsx("ringGeometry",{attach:"geometry",args:[A,0,128]}),Ne.jsx(mi.meshBasicMaterial,{attach:"material",color:U,transparent:!0,depthTest:!1,opacity:(p=y.cluster)!=null&&p.fill?M:0,side:$n,fog:!0})]}),Ne.jsxs("mesh",{children:[Ne.jsx("ringGeometry",{attach:"geometry",args:[A,v+t,128]}),Ne.jsx(mi.meshBasicMaterial,{attach:"material",color:L,transparent:!0,depthTest:!1,opacity:M,side:$n,fog:!0})]}),((m=y.cluster)==null?void 0:m.label)&&Ne.jsx(mi.group,{position:B,children:Ne.jsx(X0,{text:o,opacity:T,labelFontUrl:i,stroke:y.cluster.label.stroke,active:!1,color:y.cluster.label.color,fontSize:12})})]})})};xD.defaultProps={opacity:1,radius:2,padding:40};const _D=$.forwardRef(({onNodeClick:n,onNodeContextMenu:e,onEdgeContextMenu:t,onEdgeClick:i,onEdgePointerOver:r,onEdgePointerOut:s,onNodePointerOver:a,onNodePointerOut:o,onClusterClick:l,onNodeDragged:c,onClusterPointerOver:u,onClusterPointerOut:h,contextMenu:f,theme:p,animated:m,disabled:y,draggable:v,edgeLabelPosition:A,edgeArrowPosition:_,edgeInterpolation:x,labelFontUrl:E,renderNode:w,...I},T)=>{const{mounted:M}=Lue(I),b=ft(F=>F.graph),B=ft(F=>F.nodes),L=ft(F=>F.edges),U=ft(F=>[...F.clusters.values()]),O=$.useMemo(()=>B.map(F=>F.id),[B]),Q=$.useMemo(()=>L.map(F=>F.id),[L]),{centerNodesById:G}=Uue({animated:m});return $.useImperativeHandle(T,()=>({centerGraph:G,graph:b}),[G,b]),Ne.jsx($.Fragment,{children:M&&Ne.jsxs($.Fragment,{children:[O.map(F=>Ne.jsx(gD,{id:F,labelFontUrl:E,draggable:v,disabled:y,animated:m,contextMenu:f,renderNode:w,onClick:n,onContextMenu:e,onPointerOver:a,onPointerOut:o,onDragged:c},F)),m?Q.map(F=>Ne.jsx(vD,{id:F,disabled:y,animated:m,labelFontUrl:E,labelPlacement:A,arrowPlacement:_,interpolation:x,contextMenu:f,onClick:i,onContextMenu:t,onPointerOver:r,onPointerOut:s},F)):Ne.jsx(Gue,{theme:p,edges:L,disabled:y,animated:m,labelFontUrl:E,labelPlacement:A,arrowPlacement:_,interpolation:x,contextMenu:f,onClick:i,onContextMenu:t,onPointerOver:r,onPointerOut:s}),U.map(F=>Ne.jsx(xD,{animated:m,disabled:y,labelFontUrl:E,onClick:l,onPointerOver:u,onPointerOut:h,...F},F.label))]})})});_D.defaultProps={edgeInterpolation:"linear"};const zue={canvas:{background:"#fff"},node:{fill:"#7CA0AB",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.2,label:{color:"#2A6475",stroke:"#fff",activeColor:"#1DE9AC"}},lasso:{border:"1px solid #55aaff",background:"rgba(75, 160, 255, 0.1)"},ring:{fill:"#D8E6EA",activeFill:"#1DE9AC"},edge:{fill:"#D8E6EA",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#fff",color:"#2A6475",activeColor:"#1DE9AC"}},arrow:{fill:"#D8E6EA",activeFill:"#1DE9AC"},cluster:{stroke:"#D8E6EA",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#fff",color:"#2A6475"}}};function om(n,e,t){const{offsetX:i,offsetY:r}=n,{width:s,height:a}=t;e.set(i/s*2-1,-(r/a)*2+1)}function Que(n){const e=document.createElement("div");return e.style.pointerEvents="none",e.style.border=n.lasso.border,e.style.backgroundColor=n.lasso.background,e.style.position="fixed",e}const Hue=({children:n,theme:e,type:t="none",onLasso:i,onLassoEnd:r,disabled:s})=>{var a;const o=Cr(O=>O.camera),l=Cr(O=>O.gl),c=Cr(O=>O.setEvents),u=Cr(O=>O.size),h=Cr(O=>O.get),f=Cr(O=>O.scene),p=k8(),m=ft(O=>O.actives),y=ft(O=>O.setActives),v=ft(O=>O.edges),A=ft(O=>O.edgeMeshes),_=$.useRef(!1),x=$.useRef(null),E=$.useRef(null),w=$.useRef(Que(e)),I=$.useRef(null),T=$.useRef(!1),M=$.useRef(h().events.enabled),b=$.useRef((a=p.controls)==null?void 0:a.enabled);$.useEffect(()=>{_.current&&(i==null||i(m)),_.current=!0},[m,i]);const B=$.useCallback(O=>{if(T.current){const[Q,G,F]=I.current;F.x=Math.max(Q.x,O.clientX),F.y=Math.max(Q.y,O.clientY),G.x=Math.min(Q.x,O.clientX),G.y=Math.min(Q.y,O.clientY),w.current.style.left=`${G.x}px`,w.current.style.top=`${G.y}px`,w.current.style.width=`${F.x-G.x}px`,w.current.style.height=`${F.y-G.y}px`,om(O,x.current.endPoint,u),om(O,E.current.endPoint,u);const q=[],Y=E.current.select().sort(V=>V.uuid).map(V=>v[A.indexOf(V)].id);q.push(...Y);const H=x.current.select().sort(V=>V.uuid).filter(V=>{var D,k;return V.isMesh&&((D=V.userData)==null?void 0:D.id)&&(((k=V.userData)==null?void 0:k.type)===t||t==="all")}).map(V=>V.userData.id);q.push(...H),requestAnimationFrame(()=>{y(q)}),document.addEventListener("pointermove",B,{passive:!0,capture:!0,once:!0})}},[v,A,y,u,t]),L=$.useCallback(()=>{var O;T.current&&(c({enabled:M.current}),T.current=!1,(O=w.current.parentElement)==null||O.removeChild(w.current),p.controls.enabled=b.current,r==null||r(m),document.removeEventListener("pointermove",B),document.removeEventListener("pointerup",L))},[c,p.controls,r,m,B]),U=$.useCallback(O=>{var Q,G;if(O.shiftKey){M.current=h().events.enabled,b.current=(Q=p.controls)==null?void 0:Q.enabled,x.current=new c9(o,f);const F=new Bp;A.length&&F.add(...A),E.current=new c9(o,F),I.current=[new _e,new _e,new _e];const[q]=I.current;p.controls.enabled=!1,c({enabled:!1}),T.current=!0,(G=l.domElement.parentElement)==null||G.appendChild(w.current),w.current.style.left=`${O.clientX}px`,w.current.style.top=`${O.clientY}px`,w.current.style.width="0px",w.current.style.height="0px",q.x=O.clientX,q.y=O.clientY,om(O,x.current.startPoint,u),om(O,E.current.startPoint,u),document.addEventListener("pointermove",B,{passive:!0,capture:!0,once:!0}),document.addEventListener("pointerup",L,{passive:!0})}},[o,p.controls,A,h,l.domElement.parentElement,B,L,f,c,u]);return $.useEffect(()=>{if(!(s||t==="none"))return document.addEventListener("pointerdown",U,{passive:!0}),document.addEventListener("pointermove",B,{passive:!0}),document.addEventListener("pointerup",L,{passive:!0}),()=>{document.removeEventListener("pointerdown",U),document.removeEventListener("pointermove",B),document.removeEventListener("pointerup",L)}},[t,s,U,B,L]),Ne.jsx("group",{children:n})},Vue="_canvas_670zp_1",Wue={canvas:Vue},Yue={alpha:!0,antialias:!0},que={position:[0,0,1e3],near:5,far:5e4,fov:10},ED=$.forwardRef(({cameraMode:n,edges:e,children:t,nodes:i,theme:r,onCanvasClick:s,animated:a,disabled:o,lassoType:l,onLasso:c,onLassoEnd:u,...h},f)=>{const p=$.useRef(null),m=$.useRef(null);$.useImperativeHandle(f,()=>({centerGraph:x=>{var E;return(E=p.current)==null?void 0:E.centerGraph(x)},zoomIn:()=>{var x;return(x=m.current)==null?void 0:x.zoomIn()},zoomOut:()=>{var x;return(x=m.current)==null?void 0:x.zoomOut()},panLeft:()=>{var x;return(x=m.current)==null?void 0:x.panLeft()},panRight:()=>{var x;return(x=m.current)==null?void 0:x.panRight()},panDown:()=>{var x;return(x=m.current)==null?void 0:x.panDown()},panUp:()=>{var x;return(x=m.current)==null?void 0:x.panUp()},resetControls:x=>{var E;return(E=m.current)==null?void 0:E.resetControls(x)},getControls:()=>{var x;return(x=m.current)==null?void 0:x.controls},getGraph:()=>{var x;return(x=p.current)==null?void 0:x.graph}}));const{selections:y,actives:v,collapsedNodeIds:A}=h,_=e.length+i.length>400?!1:a;return Ne.jsx("div",{className:Wue.canvas,children:Ne.jsx(Lz,{legacy:!0,linear:!0,flat:!0,gl:Yue,camera:que,onPointerMissed:s,children:Ne.jsxs(Bue,{createStore:()=>Due({selections:y,actives:v,theme:r,collapsedNodeIds:A}),children:[Ne.jsx("color",{attach:"background",args:[r.canvas.background]}),Ne.jsx("ambientLight",{intensity:1}),t,r.canvas.fog&&Ne.jsx("fog",{attach:"fog",args:[r.canvas.fog,4e3,9e3]}),Ne.jsx(dD,{mode:n,ref:m,animated:a,disabled:o,children:Ne.jsx(Hue,{theme:r,disabled:o,type:l,onLasso:c,onLassoEnd:u,children:Ne.jsx($.Suspense,{children:Ne.jsx(_D,{ref:p,theme:r,disabled:o,animated:_,edges:e,nodes:i,...h})})})})]})})})});ED.defaultProps={cameraMode:"pan",layoutType:"forceDirected2d",sizingType:"default",labelType:"auto",theme:zue,animated:!0,defaultNodeSize:7,minNodeSize:5,maxNodeSize:15,lassoType:"none"};function w2(n){"@babel/helpers - typeof";return w2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w2(n)}function mu(n){if(n===null||n===!0||n===!1)return NaN;var e=Number(n);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}function Pr(n,e){if(e.length<n)throw new TypeError(n+" argument"+(n>1?"s":"")+" required, but only "+e.length+" present")}function co(n){Pr(1,arguments);var e=Object.prototype.toString.call(n);return n instanceof Date||w2(n)==="object"&&e==="[object Date]"?new Date(n.getTime()):typeof n=="number"||e==="[object Number]"?new Date(n):((typeof n=="string"||e==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function Xue(n,e){Pr(2,arguments);var t=co(n).getTime(),i=mu(e);return new Date(t+i)}var jue={};function Z1(){return jue}function Kue(n){var e=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return e.setUTCFullYear(n.getFullYear()),n.getTime()-e.getTime()}function $ue(n){return Pr(1,arguments),n instanceof Date||w2(n)==="object"&&Object.prototype.toString.call(n)==="[object Date]"}function Jue(n){if(Pr(1,arguments),!$ue(n)&&typeof n!="number")return!1;var e=co(n);return!isNaN(Number(e))}function Zue(n,e){Pr(2,arguments);var t=mu(e);return Xue(n,-t)}var ehe=864e5;function the(n){Pr(1,arguments);var e=co(n),t=e.getTime();e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);var i=e.getTime(),r=t-i;return Math.floor(r/ehe)+1}function C2(n){Pr(1,arguments);var e=1,t=co(n),i=t.getUTCDay(),r=(i<e?7:0)+i-e;return t.setUTCDate(t.getUTCDate()-r),t.setUTCHours(0,0,0,0),t}function SD(n){Pr(1,arguments);var e=co(n),t=e.getUTCFullYear(),i=new Date(0);i.setUTCFullYear(t+1,0,4),i.setUTCHours(0,0,0,0);var r=C2(i),s=new Date(0);s.setUTCFullYear(t,0,4),s.setUTCHours(0,0,0,0);var a=C2(s);return e.getTime()>=r.getTime()?t+1:e.getTime()>=a.getTime()?t:t-1}function nhe(n){Pr(1,arguments);var e=SD(n),t=new Date(0);t.setUTCFullYear(e,0,4),t.setUTCHours(0,0,0,0);var i=C2(t);return i}var ihe=6048e5;function rhe(n){Pr(1,arguments);var e=co(n),t=C2(e).getTime()-nhe(e).getTime();return Math.round(t/ihe)+1}function T2(n,e){var t,i,r,s,a,o,l,c;Pr(1,arguments);var u=Z1(),h=mu((t=(i=(r=(s=e==null?void 0:e.weekStartsOn)!==null&&s!==void 0?s:e==null||(a=e.locale)===null||a===void 0||(o=a.options)===null||o===void 0?void 0:o.weekStartsOn)!==null&&r!==void 0?r:u.weekStartsOn)!==null&&i!==void 0?i:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&t!==void 0?t:0);if(!(h>=0&&h<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var f=co(n),p=f.getUTCDay(),m=(p<h?7:0)+p-h;return f.setUTCDate(f.getUTCDate()-m),f.setUTCHours(0,0,0,0),f}function wD(n,e){var t,i,r,s,a,o,l,c;Pr(1,arguments);var u=co(n),h=u.getUTCFullYear(),f=Z1(),p=mu((t=(i=(r=(s=e==null?void 0:e.firstWeekContainsDate)!==null&&s!==void 0?s:e==null||(a=e.locale)===null||a===void 0||(o=a.options)===null||o===void 0?void 0:o.firstWeekContainsDate)!==null&&r!==void 0?r:f.firstWeekContainsDate)!==null&&i!==void 0?i:(l=f.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&t!==void 0?t:1);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setUTCFullYear(h+1,0,p),m.setUTCHours(0,0,0,0);var y=T2(m,e),v=new Date(0);v.setUTCFullYear(h,0,p),v.setUTCHours(0,0,0,0);var A=T2(v,e);return u.getTime()>=y.getTime()?h+1:u.getTime()>=A.getTime()?h:h-1}function she(n,e){var t,i,r,s,a,o,l,c;Pr(1,arguments);var u=Z1(),h=mu((t=(i=(r=(s=e==null?void 0:e.firstWeekContainsDate)!==null&&s!==void 0?s:e==null||(a=e.locale)===null||a===void 0||(o=a.options)===null||o===void 0?void 0:o.firstWeekContainsDate)!==null&&r!==void 0?r:u.firstWeekContainsDate)!==null&&i!==void 0?i:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&t!==void 0?t:1),f=wD(n,e),p=new Date(0);p.setUTCFullYear(f,0,h),p.setUTCHours(0,0,0,0);var m=T2(p,e);return m}var ahe=6048e5;function ohe(n,e){Pr(1,arguments);var t=co(n),i=T2(t,e).getTime()-she(t,e).getTime();return Math.round(i/ahe)+1}function _n(n,e){for(var t=n<0?"-":"",i=Math.abs(n).toString();i.length<e;)i="0"+i;return t+i}var lhe={y:function(e,t){var i=e.getUTCFullYear(),r=i>0?i:1-i;return _n(t==="yy"?r%100:r,t.length)},M:function(e,t){var i=e.getUTCMonth();return t==="M"?String(i+1):_n(i+1,2)},d:function(e,t){return _n(e.getUTCDate(),t.length)},a:function(e,t){var i=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return i.toUpperCase();case"aaa":return i;case"aaaaa":return i[0];case"aaaa":default:return i==="am"?"a.m.":"p.m."}},h:function(e,t){return _n(e.getUTCHours()%12||12,t.length)},H:function(e,t){return _n(e.getUTCHours(),t.length)},m:function(e,t){return _n(e.getUTCMinutes(),t.length)},s:function(e,t){return _n(e.getUTCSeconds(),t.length)},S:function(e,t){var i=t.length,r=e.getUTCMilliseconds(),s=Math.floor(r*Math.pow(10,i-3));return _n(s,t.length)}};const Sl=lhe;var _h={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},che={G:function(e,t,i){var r=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return i.era(r,{width:"abbreviated"});case"GGGGG":return i.era(r,{width:"narrow"});case"GGGG":default:return i.era(r,{width:"wide"})}},y:function(e,t,i){if(t==="yo"){var r=e.getUTCFullYear(),s=r>0?r:1-r;return i.ordinalNumber(s,{unit:"year"})}return Sl.y(e,t)},Y:function(e,t,i,r){var s=wD(e,r),a=s>0?s:1-s;if(t==="YY"){var o=a%100;return _n(o,2)}return t==="Yo"?i.ordinalNumber(a,{unit:"year"}):_n(a,t.length)},R:function(e,t){var i=SD(e);return _n(i,t.length)},u:function(e,t){var i=e.getUTCFullYear();return _n(i,t.length)},Q:function(e,t,i){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return _n(r,2);case"Qo":return i.ordinalNumber(r,{unit:"quarter"});case"QQQ":return i.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return i.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return i.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,i){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return _n(r,2);case"qo":return i.ordinalNumber(r,{unit:"quarter"});case"qqq":return i.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return i.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return i.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,i){var r=e.getUTCMonth();switch(t){case"M":case"MM":return Sl.M(e,t);case"Mo":return i.ordinalNumber(r+1,{unit:"month"});case"MMM":return i.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return i.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return i.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,i){var r=e.getUTCMonth();switch(t){case"L":return String(r+1);case"LL":return _n(r+1,2);case"Lo":return i.ordinalNumber(r+1,{unit:"month"});case"LLL":return i.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return i.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return i.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,i,r){var s=ohe(e,r);return t==="wo"?i.ordinalNumber(s,{unit:"week"}):_n(s,t.length)},I:function(e,t,i){var r=rhe(e);return t==="Io"?i.ordinalNumber(r,{unit:"week"}):_n(r,t.length)},d:function(e,t,i){return t==="do"?i.ordinalNumber(e.getUTCDate(),{unit:"date"}):Sl.d(e,t)},D:function(e,t,i){var r=the(e);return t==="Do"?i.ordinalNumber(r,{unit:"dayOfYear"}):_n(r,t.length)},E:function(e,t,i){var r=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return i.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return i.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return i.day(r,{width:"short",context:"formatting"});case"EEEE":default:return i.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,i,r){var s=e.getUTCDay(),a=(s-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return _n(a,2);case"eo":return i.ordinalNumber(a,{unit:"day"});case"eee":return i.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return i.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return i.day(s,{width:"short",context:"formatting"});case"eeee":default:return i.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,i,r){var s=e.getUTCDay(),a=(s-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return _n(a,t.length);case"co":return i.ordinalNumber(a,{unit:"day"});case"ccc":return i.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return i.day(s,{width:"narrow",context:"standalone"});case"cccccc":return i.day(s,{width:"short",context:"standalone"});case"cccc":default:return i.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,i){var r=e.getUTCDay(),s=r===0?7:r;switch(t){case"i":return String(s);case"ii":return _n(s,t.length);case"io":return i.ordinalNumber(s,{unit:"day"});case"iii":return i.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return i.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return i.day(r,{width:"short",context:"formatting"});case"iiii":default:return i.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,i){var r=e.getUTCHours(),s=r/12>=1?"pm":"am";switch(t){case"a":case"aa":return i.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return i.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return i.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return i.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,i){var r=e.getUTCHours(),s;switch(r===12?s=_h.noon:r===0?s=_h.midnight:s=r/12>=1?"pm":"am",t){case"b":case"bb":return i.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return i.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return i.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return i.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,i){var r=e.getUTCHours(),s;switch(r>=17?s=_h.evening:r>=12?s=_h.afternoon:r>=4?s=_h.morning:s=_h.night,t){case"B":case"BB":case"BBB":return i.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return i.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return i.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,i){if(t==="ho"){var r=e.getUTCHours()%12;return r===0&&(r=12),i.ordinalNumber(r,{unit:"hour"})}return Sl.h(e,t)},H:function(e,t,i){return t==="Ho"?i.ordinalNumber(e.getUTCHours(),{unit:"hour"}):Sl.H(e,t)},K:function(e,t,i){var r=e.getUTCHours()%12;return t==="Ko"?i.ordinalNumber(r,{unit:"hour"}):_n(r,t.length)},k:function(e,t,i){var r=e.getUTCHours();return r===0&&(r=24),t==="ko"?i.ordinalNumber(r,{unit:"hour"}):_n(r,t.length)},m:function(e,t,i){return t==="mo"?i.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):Sl.m(e,t)},s:function(e,t,i){return t==="so"?i.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):Sl.s(e,t)},S:function(e,t){return Sl.S(e,t)},X:function(e,t,i,r){var s=r._originalDate||e,a=s.getTimezoneOffset();if(a===0)return"Z";switch(t){case"X":return Jw(a);case"XXXX":case"XX":return kc(a);case"XXXXX":case"XXX":default:return kc(a,":")}},x:function(e,t,i,r){var s=r._originalDate||e,a=s.getTimezoneOffset();switch(t){case"x":return Jw(a);case"xxxx":case"xx":return kc(a);case"xxxxx":case"xxx":default:return kc(a,":")}},O:function(e,t,i,r){var s=r._originalDate||e,a=s.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+$w(a,":");case"OOOO":default:return"GMT"+kc(a,":")}},z:function(e,t,i,r){var s=r._originalDate||e,a=s.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+$w(a,":");case"zzzz":default:return"GMT"+kc(a,":")}},t:function(e,t,i,r){var s=r._originalDate||e,a=Math.floor(s.getTime()/1e3);return _n(a,t.length)},T:function(e,t,i,r){var s=r._originalDate||e,a=s.getTime();return _n(a,t.length)}};function $w(n,e){var t=n>0?"-":"+",i=Math.abs(n),r=Math.floor(i/60),s=i%60;if(s===0)return t+String(r);var a=e||"";return t+String(r)+a+_n(s,2)}function Jw(n,e){if(n%60===0){var t=n>0?"-":"+";return t+_n(Math.abs(n)/60,2)}return kc(n,e)}function kc(n,e){var t=e||"",i=n>0?"-":"+",r=Math.abs(n),s=_n(Math.floor(r/60),2),a=_n(r%60,2);return i+s+t+a}const uhe=che;var Zw=function(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},CD=function(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},hhe=function(e,t){var i=e.match(/(P+)(p+)?/)||[],r=i[1],s=i[2];if(!s)return Zw(e,t);var a;switch(r){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;case"PPPP":default:a=t.dateTime({width:"full"});break}return a.replace("{{date}}",Zw(r,t)).replace("{{time}}",CD(s,t))},fhe={p:CD,P:hhe};const dhe=fhe;var phe=["D","DD"],ghe=["YY","YYYY"];function mhe(n){return phe.indexOf(n)!==-1}function Ahe(n){return ghe.indexOf(n)!==-1}function eC(n,e,t){if(n==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(e,"`) for formatting years to the input `").concat(t,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(n==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(e,"`) for formatting years to the input `").concat(t,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(n==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(e,"`) for formatting days of the month to the input `").concat(t,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(n==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(e,"`) for formatting days of the month to the input `").concat(t,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var vhe={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},yhe=function(e,t,i){var r,s=vhe[e];return typeof s=="string"?r=s:t===1?r=s.one:r=s.other.replace("{{count}}",t.toString()),i!=null&&i.addSuffix?i.comparison&&i.comparison>0?"in "+r:r+" ago":r};const xhe=yhe;function U5(n){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.width?String(e.width):n.defaultWidth,i=n.formats[t]||n.formats[n.defaultWidth];return i}}var _he={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Ehe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},She={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},whe={date:U5({formats:_he,defaultWidth:"full"}),time:U5({formats:Ehe,defaultWidth:"full"}),dateTime:U5({formats:She,defaultWidth:"full"})};const Che=whe;var The={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},bhe=function(e,t,i,r){return The[e]};const Ihe=bhe;function Fd(n){return function(e,t){var i=t!=null&&t.context?String(t.context):"standalone",r;if(i==="formatting"&&n.formattingValues){var s=n.defaultFormattingWidth||n.defaultWidth,a=t!=null&&t.width?String(t.width):s;r=n.formattingValues[a]||n.formattingValues[s]}else{var o=n.defaultWidth,l=t!=null&&t.width?String(t.width):n.defaultWidth;r=n.values[l]||n.values[o]}var c=n.argumentCallback?n.argumentCallback(e):e;return r[c]}}var Mhe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Rhe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Bhe={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Dhe={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Phe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Lhe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Uhe=function(e,t){var i=Number(e),r=i%100;if(r>20||r<10)switch(r%10){case 1:return i+"st";case 2:return i+"nd";case 3:return i+"rd"}return i+"th"},Ohe={ordinalNumber:Uhe,era:Fd({values:Mhe,defaultWidth:"wide"}),quarter:Fd({values:Rhe,defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:Fd({values:Bhe,defaultWidth:"wide"}),day:Fd({values:Dhe,defaultWidth:"wide"}),dayPeriod:Fd({values:Phe,defaultWidth:"wide",formattingValues:Lhe,defaultFormattingWidth:"wide"})};const Fhe=Ohe;function kd(n){return function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=t.width,r=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],s=e.match(r);if(!s)return null;var a=s[0],o=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(o)?Nhe(o,function(h){return h.test(a)}):khe(o,function(h){return h.test(a)}),c;c=n.valueCallback?n.valueCallback(l):l,c=t.valueCallback?t.valueCallback(c):c;var u=e.slice(a.length);return{value:c,rest:u}}}function khe(n,e){for(var t in n)if(n.hasOwnProperty(t)&&e(n[t]))return t}function Nhe(n,e){for(var t=0;t<n.length;t++)if(e(n[t]))return t}function Ghe(n){return function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=e.match(n.matchPattern);if(!i)return null;var r=i[0],s=e.match(n.parsePattern);if(!s)return null;var a=n.valueCallback?n.valueCallback(s[0]):s[0];a=t.valueCallback?t.valueCallback(a):a;var o=e.slice(r.length);return{value:a,rest:o}}}var zhe=/^(\d+)(th|st|nd|rd)?/i,Qhe=/\d+/i,Hhe={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Vhe={any:[/^b/i,/^(a|c)/i]},Whe={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Yhe={any:[/1/i,/2/i,/3/i,/4/i]},qhe={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Xhe={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},jhe={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Khe={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},$he={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Jhe={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Zhe={ordinalNumber:Ghe({matchPattern:zhe,parsePattern:Qhe,valueCallback:function(e){return parseInt(e,10)}}),era:kd({matchPatterns:Hhe,defaultMatchWidth:"wide",parsePatterns:Vhe,defaultParseWidth:"any"}),quarter:kd({matchPatterns:Whe,defaultMatchWidth:"wide",parsePatterns:Yhe,defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:kd({matchPatterns:qhe,defaultMatchWidth:"wide",parsePatterns:Xhe,defaultParseWidth:"any"}),day:kd({matchPatterns:jhe,defaultMatchWidth:"wide",parsePatterns:Khe,defaultParseWidth:"any"}),dayPeriod:kd({matchPatterns:$he,defaultMatchWidth:"any",parsePatterns:Jhe,defaultParseWidth:"any"})};const efe=Zhe;var tfe={code:"en-US",formatDistance:xhe,formatLong:Che,formatRelative:Ihe,localize:Fhe,match:efe,options:{weekStartsOn:0,firstWeekContainsDate:1}};const nfe=tfe;var ife=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,rfe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,sfe=/^'([^]*?)'?$/,afe=/''/g,ofe=/[a-zA-Z]/;function tC(n,e,t){var i,r,s,a,o,l,c,u,h,f,p,m,y,v,A,_,x,E;Pr(2,arguments);var w=String(e),I=Z1(),T=(i=(r=t==null?void 0:t.locale)!==null&&r!==void 0?r:I.locale)!==null&&i!==void 0?i:nfe,M=mu((s=(a=(o=(l=t==null?void 0:t.firstWeekContainsDate)!==null&&l!==void 0?l:t==null||(c=t.locale)===null||c===void 0||(u=c.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&o!==void 0?o:I.firstWeekContainsDate)!==null&&a!==void 0?a:(h=I.locale)===null||h===void 0||(f=h.options)===null||f===void 0?void 0:f.firstWeekContainsDate)!==null&&s!==void 0?s:1);if(!(M>=1&&M<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var b=mu((p=(m=(y=(v=t==null?void 0:t.weekStartsOn)!==null&&v!==void 0?v:t==null||(A=t.locale)===null||A===void 0||(_=A.options)===null||_===void 0?void 0:_.weekStartsOn)!==null&&y!==void 0?y:I.weekStartsOn)!==null&&m!==void 0?m:(x=I.locale)===null||x===void 0||(E=x.options)===null||E===void 0?void 0:E.weekStartsOn)!==null&&p!==void 0?p:0);if(!(b>=0&&b<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!T.localize)throw new RangeError("locale must contain localize property");if(!T.formatLong)throw new RangeError("locale must contain formatLong property");var B=co(n);if(!Jue(B))throw new RangeError("Invalid time value");var L=Kue(B),U=Zue(B,L),O={firstWeekContainsDate:M,weekStartsOn:b,locale:T,_originalDate:B},Q=w.match(rfe).map(function(G){var F=G[0];if(F==="p"||F==="P"){var q=dhe[F];return q(G,T.formatLong)}return G}).join("").match(ife).map(function(G){if(G==="''")return"'";var F=G[0];if(F==="'")return lfe(G);var q=uhe[F];if(q)return!(t!=null&&t.useAdditionalWeekYearTokens)&&Ahe(G)&&eC(G,e,String(n)),!(t!=null&&t.useAdditionalDayOfYearTokens)&&mhe(G)&&eC(G,e,String(n)),q(U,G,T.localize,O);if(F.match(ofe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+F+"`");return G}).join("");return Q}function lfe(n){var e=n.match(sfe);return e?e[1].replace(afe,"'"):n}const cfe=({node:n,output:e})=>{const t=$.useMemo(()=>n.planable?e.result.planables.find(r=>r.id===n.planable):null,[n,e]),i=$.useMemo(()=>{const r=new Date(n.time),s=new Date(r.getTime()+n.duration);return Ne.jsxs("span",{children:[tC(r,"HH:mm")," - ",tC(s,"HH:mm")]})},[n.duration,n.time]);return t?Ne.jsxs("div",{children:[i," Planable: ",t.id]}):n.type==="travel"?Ne.jsxs("div",{children:[i," Travel: ",n.location]}):null},ufe=({id:n,output:e})=>{const t=$.useMemo(()=>{const i=[];let r=e.result.nodes.find(s=>s.id===n);for(;r&&(i.push(r),!!r.parent);)r=e.result.nodes.find(s=>s.id===(r==null?void 0:r.parent));return i},[n,e]);return Ne.jsx(Ne.Fragment,{children:t.map(i=>Ne.jsx(cfe,{node:i,output:e},i.id))})},hfe=({output:n})=>{var h;const[e,t]=$.useState(0),[i,r]=$.useState(!1),[s,a]=$.useState(void 0),o=$.useMemo(()=>{if(!s)return[];const f=[];let p=n.result.nodes.find(m=>m.id===s);for(;p&&(f.push(p.id),!!p.parent);)p=n.result.nodes.find(m=>m.id===(p==null?void 0:p.parent));return f},[s,n]),l=$.useMemo(()=>{var f;return((f=n==null?void 0:n.result)==null?void 0:f.completed.map(p=>({id:p.id,score:p.score})).sort((p,m)=>m.score-p.score).slice(0,10))||[]},[(h=n==null?void 0:n.result)==null?void 0:h.completed]),c=$.useMemo(()=>{var f;return Math.max(...((f=n==null?void 0:n.nodes)==null?void 0:f.map(p=>{var m;return(m=p.data)==null?void 0:m.exploreId}))||[])},[n]),u=$.useMemo(()=>{var f;return(f=n==null?void 0:n.nodes)==null?void 0:f.filter(p=>{var m;return((m=p.data)==null?void 0:m.exploreId)>e}).map(p=>p.id)},[n,e]);return n?Ne.jsxs(Ne.Fragment,{children:["Nodes count: ",n.nodes.length,Ne.jsxs("button",{onClick:()=>r(!i),children:[i?"Hide":"Show"," Visualize"]}),i&&Ne.jsxs(Ne.Fragment,{children:[Ne.jsx("button",{onClick:()=>t(e-1),children:"Prev"}),Ne.jsx("input",{type:"range",min:0,max:c,value:e,onChange:f=>t(parseInt(f.target.value))}),Ne.jsx("button",{onClick:()=>t(e+1),children:"Next"})]}),l.map(f=>Ne.jsxs("div",{onClick:()=>a(f.id),children:[f.id," - ",f.score]},f.id)),s&&Ne.jsx(ufe,{id:s,output:n}),i&&Ne.jsx("div",{style:{position:"relative",height:"70vh"},children:Ne.jsx(ED,{...n,collapsedNodeIds:u,labelType:"all",onNodeClick:f=>{if(f.id===s){a(void 0);return}a(f.id)},selections:o,renderNode:({size:f,opacity:p,node:m})=>{var v,A,_,x,E,w;let y="gray";return((v=m.data)==null?void 0:v.exploreId)<e&&((A=m.data)==null?void 0:A.exploreId)>0&&(y="yellow"),((_=m.data)==null?void 0:_.exploreId)===e&&(y="blue"),(x=m.data)!=null&&x.deadEnd&&(y="red"),(E=m.data)!=null&&E.completed&&(y="green"),((w=m.data)==null?void 0:w.type)==="root"&&(y="black"),Ne.jsx("group",{children:Ne.jsxs("mesh",{children:[Ne.jsx("circleGeometry",{attach:"geometry",args:[f]}),Ne.jsx("meshBasicMaterial",{attach:"material",color:y,opacity:p,transparent:!0})]})})}})})]}):null};function nC(n){const e=Object.assign({h1:"h1"},n.components);return Ne.jsxs(Ne.Fragment,{children:[Ne.jsx(e.h1,{children:"Hello World"}),`
`,Ne.jsx(iP,{worker:rP,action:"realistic",presenter:hfe})]})}function Sfe(n={}){const{wrapper:e}=n.components||{};return e?Ne.jsx(e,Object.assign({},n,{children:Ne.jsx(nC,n)})):nC(n)}export{Sfe as default};