clone

an offline map explorer where each world, from a game map to a city's open data, ships as one .atlas file

frontend: a label is a capability, not a way of drawing

Dami committed 9c906f5
The last correction of the text special case corrected it into a new
one: the toggle swapped a point collection's markers for the old
floating-name rendering, whose zoom gate then swallowed the names --
icons gone, nothing in their place. The honest model is the one areas
already had. Markers always draw. Labels are a policy, always or
quiet: curated text means the names speak unasked beside their
markers, curated pins wait for Z, and the toggle -- reading
"Display X labels" or "Hide X labels", whichever pressing it would
do -- flips the policy for points exactly as it does for ground. The
floating-text rendering and its three layers leave entirely, and Z
keeps its word: it reveals curated-quiet names, never ones the reader
silenced.

Verified on the truck simulator: cities draw markers under static
names, the toggle strips the names and leaves the icons, and Z
declines to speak for a silenced collection. The tour walks the point
toggle; forty-three steps, byte-identical across runs.
commit
9c906f5c6ddde7c567b50f3b423f92ef4dd7e2dc
parent
b6bf5ae170008aaff32e5e92b6f00d00d78d1219
author
Dami <dami.etoile@gmail.com>
14 files changed, +341 -427
Massets/app.js482+++++++++++++++---------------
Mfrontend/parity/tour.js17+-
Mfrontend/src/detail.js4-
Mfrontend/src/engine.js33+--
Mfrontend/src/events.js8-
Mfrontend/src/features.js17+-
Mfrontend/src/grid.js3-
Mfrontend/src/legend.js71++---
Mfrontend/src/navigation.js3-
Mfrontend/src/semconv.js44++-
Mfrontend/src/session.js1-
Mfrontend/src/state.js1-
Mfrontend/src/styles.js67+----
Mfrontend/test/semconv.test.mjs17+-
M assets/app.js +241 -241
@@ -1,19 +1,19 @@
1-(()=>{var ahe=Object.create;var LL=Object.defineProperty;var lhe=Object.getOwnPropertyDescriptor;var che=Object.getOwnPropertyNames;var uhe=Object.getPrototypeOf,hhe=Object.prototype.hasOwnProperty;var Bq=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},fhe=(i,e)=>{for(var t in e)LL(i,t,{get:e[t],enumerable:!0})},dhe=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of che(e))!hhe.call(i,r)&&r!==t&&LL(i,r,{get:()=>e[r],enumerable:!(n=lhe(e,r))||n.enumerable});return i};var Oq=(i,e,t)=>(t=i!=null?ahe(uhe(i)):{},dhe(e||!i||!i.__esModule?LL(t,"default",{value:i,enumerable:!0}):t,i));var Hq=Bq((xT,qq)=>{(function(i,e){typeof xT=="object"&&typeof qq<"u"?e(xT):typeof define=="function"&&define.amd?define(["exports"],e):e(i.bigfloat={})})(xT,(function(i){"use strict";var e=Math.pow(2,32),t=Math.pow(2,-32),n=Math.log(10)/(32*Math.log(2));function r(D){return new Array(D+1).join("0")}var s=(function(){function D(L){this.base=L,this.limbDigitsExact=Math.log(e)/Math.log(this.base),this.limbDigits=~~this.limbDigitsExact,this.limbBase=Math.pow(this.base,this.limbDigits),this.pad=r(this.limbDigits)}return D.init=function(L){return D.baseTbl[L]||(D.baseTbl[L]=new D(L))},D.baseTbl={},D})();function o(D){return D.replace(/^(-?)0+([1-9a-z]|0(\.|$))/,"$1$2").replace(/(\.|(\.[0-9a-z]*[1-9a-z]))0+$/,"$2")}function a(D,L){L===void 0&&(L=10);var C=s.init(L),B=C.pad,k=C.limbBase,z="",G="",W,Y;if(isNaN(D))return"NaN";if(D<0&&(z="-",D=-D),!isFinite(D))return z+"Inf";if(D<1)G+="0";else{var H=Math.floor(D);for(D-=H;H;)W=H%k,H=(H-W)/k,Y=W.toString(L),G=Y+G,H&&(G=B.substr(Y.length)+G)}if(D>0)for(G+=".",k!=e&&(k=L,B="");D;)D*=k,W=D>>>0,D-=W,Y=W.toString(L),G+=B.substr(Y.length)+Y;return z+G.replace(/(\.[0-9a-z]*[1-9a-z])0+$/,"$1")}var l=(function(){function D(L,C){this.limbList=[],L?this.setValue(L,C):this.setZero()}return D.prototype.clone=function(){return new D().setBig(this)},D.prototype.setZero=function(){return this.sign=1,this.fractionLen=0,this.len=0,this},D.prototype.setValue=function(L,C){return typeof L=="number"?this.setNumber(L):L instanceof D?this.setBig(L):this.setString(L.toString(),C||10)},D.prototype.setBig=function(L){var C=L.len;this.sign=L.sign,this.fractionLen=L.fractionLen,this.len=C;for(var B=0;B<C;++B)this.limbList[B]=L.limbList[B];return this},D.prototype.setNumber=function(L){L<0?(L=-L,this.sign=-1):this.sign=1;for(var C=Math.floor(L),B=L-C,k=0,z=this.limbList,G,W=0;B;)B*=e,G=B>>>0,B-=G,z[W++]=G,++k;for(var Y=0;--W>Y;)G=z[Y],z[Y++]=z[W],z[W]=G;for(W+=Y+1;C;)G=C%e,C=(C-G)/e,z[W++]=G;return this.limbList=z,this.fractionLen=k,this.len=W,this},D.prototype.parseFraction=function(L,C,B,k,z,G){for(var W=this.limbList,Y=L.length,H=k-1;H;)W[--H]=0;var $=Y-((Y-B+G-1)%G+1);for(W[k-1]=parseInt(L.substr($,Y-$),C),this.divInt(Math.pow(C,Y-$),k),Y=$;Y>B;)Y-=G,W[k-1]=parseInt(L.substr(Y,G),C),this.divInt(z,k)},D.prototype.setString=function(L,C){var B=s.init(C),k=B.limbBase,z=B.limbDigits,G=B.limbDigitsExact,W=this.limbList,Y=-1,H;for(this.sign=1;;){switch(H=L.charAt(++Y),H){case"-":this.sign=-1;case"+":case"0":continue}break}var $=(L.indexOf(".",Y)+1||L.length+1)-1;if($<L.length-1){var J=~~((L.length-$-1)/G)+1;this.parseFraction(L,C,$+1,J+1,k,z),this.fractionLen=J,this.len=J,this.trimLeast()}else this.fractionLen=0,this.len=0;var te=this.fractionLen;if($>Y){var ce=Y+($-Y+z-1)%z+1;for(++this.len,W[te]=parseInt(L.substr(Y,ce-Y),C),Y=ce;Y<$;)this.mulInt(k,W,te,te,0)&&++this.len,W[te]+=parseInt(L.substr(Y,z),C),Y+=z}return this},D.prototype.trimMost=function(){for(var L=this.limbList,C=this.fractionLen,B=this.len;B>C&&!L[B-1];)--B;this.len=B},D.prototype.trimLeast=function(){for(var L=this.limbList,C=this.fractionLen,B=0;B<C&&!L[B];)++B;B&&this.truncate(C-B)},D.prototype.mulInt=function(L,C,B,k,z){if(!L)return 0;for(var G=this.limbList,W=this.len,Y,H,$=0;B<W;)Y=G[B++],$+=L*(Y&65535),H=$&65535,$=($-H)/65536,$+=L*(Y>>>16),H|=$<<16,Y=(C[k]&z)+H>>>0,C[k++]=Y,$=$/65536>>>0,$+=(H^(Y-H^H)&~(Y^H))>>>31;return $&&(C[k]=$),$},D.prototype.mulBig=function(L,C){if(this.isZero()||L.isZero())return C.setZero();var B=L.limbList,k=L.len,z=C.limbList,G=this.len+k;for(C.len=G;G--;)z[G]=0;this.mulInt(B[0],z,0,0,0);for(var W=1;W<k;++W)this.mulInt(B[W],z,0,W,4294967295);return C.sign=this.sign*L.sign,C.fractionLen=this.fractionLen+L.fractionLen,C.trimMost(),C.trimLeast(),C},D.prototype.mul=function(L,C){if(C=C||new D,typeof L=="number"&&(L=c.setNumber(L)),C==this)throw new Error("Multiplication in place is unsupported");return this.mulBig(L,C)},D.prototype.absDeltaFrom=function(L){typeof L=="number"&&(L=c.setNumber(L));for(var C=this.limbList,B=L.limbList,k=this.len,z=L.len,G=k-this.fractionLen-(z-L.fractionLen);!G&&k&&z;)G=C[--k]-B[--z];if(G)return G;if(k)do G=C[--k];while(!G&&k);else if(z)do G=-B[--z];while(!G&&z);return G},D.prototype.isZero=function(){return this.len==0},D.prototype.getSign=function(){return this.len&&this.sign},D.prototype.deltaFrom=function(L){return typeof L=="number"&&(L=c.setNumber(L)),this.len+L.len&&(this.sign-L.sign||this.absDeltaFrom(L)*this.sign)},D.prototype.addBig=function(L,C){var B=this,k=B.fractionLen,z=k-L.fractionLen;z<0&&(z=-z,k+=z,B=L,L=this),C.sign=this.sign,C.fractionLen=k;for(var G=C.limbList,W=B.limbList,Y=L.limbList,H=0,$=0,J=0,te;H<z;)G[H]=W[H],++H;var ce=L.len;for(z=B.len-H,z>ce&&(z=ce);$<z;)J+=W[H]+Y[$++],te=J>>>0,J=J-te&&1,G[H++]=te;var he=H;for(z<ce?(z=ce,B=L,H=$,W=Y):z=B.len;H<z;)J+=W[H++],te=J>>>0,J=J-te&&1,G[he++]=te;return J&&(G[he++]=J),C.len=he,C.trimLeast(),C},D.prototype.subBig=function(L,C){var B=this;C.sign=this.sign,B.absDeltaFrom(L)<0&&(B=L,L=this,C.sign=-this.sign);var k=B.fractionLen,z=k-L.fractionLen,G=C.limbList,W=B.limbList,Y=L.limbList,H=B.len,$=L.len,J=H,te=0,ce=0,he=0,ve=0,Re;if(z>=0){for(;te<z;)G[te]=W[te],++te;z+=$,z>H&&(z=H),he=te}else{for(z=-z,k+=z,J+=z;ce<z;)ve-=Y[ce],Re=ve>>>0,ve=-(ve<0),G[ce++]=Re;z+=H,z>$&&(z=$),he=ce}for(C.fractionLen=k;he<z;)ve+=W[te++]-Y[ce++],Re=ve>>>0,ve=-(ve<0),G[he++]=Re;for(;he<J;)ve+=W[te++],Re=ve>>>0,ve=-(ve<0),G[he++]=Re;return C.len=he,C.trimMost(),C.trimLeast(),C},D.prototype.addSub=function(L,C,B){if(B=B||new D,B==this)throw new Error("Addition and subtraction in place is unsupported");return typeof L=="number"&&(L=c.setNumber(L)),this.sign*L.sign*C<0?this.subBig(L,B):this.addBig(L,B)},D.prototype.add=function(L,C){return this.addSub(L,1,C)},D.prototype.sub=function(L,C){return this.addSub(L,-1,C)},D.prototype.truncate=function(L){var C=this.fractionLen-L;if(C>0){this.fractionLen=L,this.len-=C;for(var B=this.len,k=this.limbList,z=0;z<B;++z)k[z]=k[z+C]}return this},D.prototype.round=function(L){return this.truncate(1+~~(L*n))},D.prototype.divInt=function(L,C){var B=this.limbList,k,z,G,W=0;for(B[C-1]<L&&(W=B[--C],this.len=C);C--;)k=B[C],W=W*65536+(k>>>16),z=W/L>>>0,W=W-z*L,W=W*65536+(k&65535),G=W/L>>>0,W=W-G*L,B[C]=(z<<16|G)>>>0;return W},D.prototype.fractionToString=function(L,C){var B=s.init(L),k=B.pad,z=B.limbBase,G=this.limbList,W=this.fractionLen,Y=0,H;if(L&1)throw new Error("Conversion of floating point values to odd bases is unsupported");for(;Y<W&&!G[Y];)++Y;if(!(Y>=W)){C.push(".");var $=c;for($.limbList=G.slice(Y,W),$.len=W-Y,Y=0;Y<$.len;)if($.limbList[Y]){var J=$.mulInt(z,$.limbList,Y,Y,0);H=J.toString(L),C.push(k.substr(H.length)+H)}else++Y}},D.prototype.getExpansion=function(L){for(var C=this.limbList,B=this.len,k=this.sign,z=this.fractionLen;z--;)k*=t;for(;++z<B;)L[z]=C[z]*k,k*=e;return B},D.prototype.valueOf=function(){for(var L=this.limbList,C=0,B=t*this.sign,k=this.fractionLen,z=0;z<k;)C=C*t+L[z++];for(k=this.len;z<k;)C=C*t+L[z++],B*=e;return C*B},D.prototype.toString=function(L){L===void 0&&(L=10);var C=s.init(L),B=C.pad,k=C.limbBase,z=[],G=this.limbList,W;if(k!=e){var Y=c;for(Y.limbList=G.slice(this.fractionLen,this.len),Y.len=this.len-this.fractionLen;Y.len>1;)W=Y.divInt(k,Y.len).toString(L),z.push(B.substr(W.length)+W);z.push(""+(Y.limbList[0]||0)),this.sign<0&&z.push("-"),z.reverse(),this.fractionToString(L,z)}else{var H=this.len,$=this.fractionLen;for(this.sign<0&&z.push("-"),H==$&&z.push("0");H--;)W=G[H].toString(L),H==$-1&&z.push("."),z.push(B.substr(W.length)+W)}return o(z.join(""))},D})();l.prototype.cmp=l.prototype.deltaFrom;var c=new l,u=(1<<27)+1,f=Math.log(10)/(53*Math.log(2));function d(D,L,C){var B=D+L,k=B-D,z=B-k;return C[0]=D-z+(L-k),C[1]=B,C}function A(D,L){w=D*L;var C=D*u,B=C-(C-D),k=D-B,z=L*u,G=z-(z-L),W=L-G;return k*W-(w-B*G-k*G-B*W)}var y=(function(){function D(L,C){this.limbList=[],L&&this.setValue(L,C)}return D.prototype.clone=function(){return new D().setBig(this)},D.prototype.setZero=function(){return this.len=0,this},D.prototype.setValue=function(L,C){return typeof L=="number"?this.setNumber(L):L instanceof D?this.setBig(L):this.setString(L.toString(),C||10)},D.prototype.setBig=function(L){var C=L.len;this.len=C;for(var B=0;B<C;++B)this.limbList[B]=L.limbList[B];return this},D.prototype.setNumber=function(L){return this.limbList[0]=L,this.len=L&&1,this},D.prototype.setString=function(L,C){return S[0].setValue(L,C),this.len=S[0].getExpansion(this.limbList),this.normalize(),this},D.prototype.setSum=function(L,C){return this.len=2,d(L,C,this.limbList),this},D.prototype.setProduct=function(L,C){return this.len=2,this.limbList[0]=A(L,C),this.limbList[1]=w,this},D.prototype.normalize=function(){var L=this.limbList,C=this.len,B;if(C){for(var k=C-1,z=C-1,G=L[k],W=void 0;k;)B=L[--k],W=G,G+=B,W=B-(G-W),L[z]=G,z-=W&&1,G=W||G;for(L[z]=G;++z<C;)B=L[z],W=G,G+=B,W-=G-B,L[k]=W,k+=W&&1;L[k]=G,this.len=k+(G&&1)}return this},D.prototype.mulSmall=function(L,C){var B=this.limbList,k=C.limbList,z=this.len,G,W,Y,H=0,$=0;function J(ce){k[$]=ce,$+=ce&&1}J(A(B[H++],L));for(var te=w;H<z;)G=A(B[H++],L),W=te+G,Y=W-te,J(te-(W-Y)+(G-Y)),te=w+W,J(W-(te-w));return k[$]=te,C.len=$+(te&&1),C},D.prototype.mulBig=function(L,C){var B=L.limbList,k=L.len;if(!k)return C.setZero();for(--k,this.mulSmall(B[k],k?T[k&1]:C);k;)--k,this.mulSmall(B[k],C).addBig(T[~k&1],1,k?T[k&1]:C);return C},D.prototype.mul=function(L,C){if(C=C||new D,typeof L=="number")return this.mulSmall(L,C);if(C==this)throw new Error("Cannot multiply in place");return this.mulBig(L,C)},D.prototype.isZero=function(){for(var L=this.limbList,C=this.len;C--;)if(L[C])return!1;return!0},D.prototype.getSign=function(){var L=this.len;return L&&(L=this.limbList[L-1])&&(L>0?1:-1)},D.prototype.deltaFrom=function(L){var C=this.len,B=this.getSign(),k=B;if(typeof L!="number"){if(C=L.len,k-=C&&(C=L.limbList[C-1])&&(C>0?1:-1),k||!B)return k;this.addBig(L,-1,T[0])}else{if(k-=L&&(L>0?1:-1),k||!B)return k;this.addSmall(-L,T[0])}return C=T[0].len,C&&T[0].limbList[C-1]},D.prototype.addSmall=function(L,C){for(var B=this.limbList,k=C.limbList,z=this.len,G,W,Y,H,$=0,J=0;$<z;)W=B[$++],G=W+L,Y=G-W,W-=G-Y,H=W+(L-Y),k[J]=H,J+=H&&1,L=G;return k[J]=L,C.len=J+(L&&1),C},D.prototype.addBig=function(L,C,B){var k=this.limbList,z=L.limbList,G=B.limbList,W=this.len+L.len,Y=0,H=0,$=0,J=k[Y++],te=z[H++]*C,ce=J<0?-J:J,he=te<0?-te:te,ve,Re,Qe,Fe;if(!W)return B.setZero();k[this.len]=1/0,z[L.len]=1/0;function mt(){var Ve;return ce<he?(Ve=J,J=k[Y++],ce=J<0?-J:J):(Ve=te,te=z[H++]*C,he=te<0?-te:te),Ve}for(var Ee=mt();--W;)ve=mt(),Qe=Ee,Ee+=ve,Re=Ee-Qe,Fe=Qe-(Ee-Re)+(ve-Re),G[$]=Fe,$+=Fe&&1;return G[$]=Ee,B.len=$+(Ee&&1),B},D.prototype.addSub=function(L,C,B){return B=B||new D,typeof L=="number"?this.addSmall(C*L,B):this.addBig(L,C,B)},D.prototype.add=function(L,C){return this.addSub(L,1,C)},D.prototype.sub=function(L,C){return this.addSub(L,-1,C)},D.prototype.truncate=function(L){this.normalize();for(var C=this.limbList,B=this.len,k=0,z=B,G=0,W=0;k<z;)G=k+z>>1,W=C[G],W>-1&&W<1?k=G+1:z=G;if(G&&(W<=-1||W>=1)&&(W=C[--G]),G-=L-1,G>0){this.len-=G,B=this.len;for(var Y=0;Y<B;++Y)C[Y]=C[Y+G]}return this},D.prototype.round=function(L){return this.truncate(1+~~(L*f))},D.prototype.valueOf=function(){for(var L=this.limbList,C=this.len,B=0,k=0;k<C;++k)B+=L[k];return B},D.prototype.toString=function(L){var C=this.limbList,B=this.len;for(S[B&1].setZero();B--;)S[~B&1].add(C[B],S[B&1]);return S[~B&1].toString(L)},D})();y.prototype.cmp=y.prototype.deltaFrom;var w=0,S=[new l,new l],T=[new y,new y];function R(D,L){function C(){this.constructor=D}C.prototype=L.prototype,D.prototype=new C}var P=(function(){function D(L,C,B){this.real=typeof L=="object"?L:new this.Base(L,B),this.imag=typeof C=="object"?C:new this.Base(C,B)}return D.prototype.clone=function(){var L=new this.constructor(this.real.clone(),this.imag.clone());return L},D.prototype.setZero=function(){return this.real.setZero(),this.imag.setZero(),this},D.prototype.setValue=function(L){return this.real.setValue(L.real),this.imag.setValue(L.imag),this},D.prototype.mul=function(L,C){return C=C||new this.constructor,L instanceof D?(this.real.mul(L.real,this.temp1),this.imag.mul(L.imag,this.temp2),this.temp1.sub(this.temp2,C.real),this.real.mul(L.imag,this.temp1),this.imag.mul(L.real,this.temp2),this.temp1.add(this.temp2,C.imag)):(this.real.mul(L,C.real),this.imag.mul(L,C.imag)),C},D.prototype.sqr=function(L){return L=L||new this.constructor,this.real.mul(this.real,this.temp1),this.imag.mul(this.imag,this.temp2),this.temp1.sub(this.temp2,L.real),this.real.mul(this.imag,this.temp1),this.temp1.add(this.temp1,L.imag),L},D.prototype.add=function(L,C){return C=C||new this.constructor,L instanceof D?(this.real.add(L.real,C.real),this.imag.add(L.imag,C.imag)):this.real.add(L,C.real),C},D.prototype.sub=function(L,C){return C=C||new this.constructor,L instanceof D?(this.real.sub(L.real,C.real),this.imag.sub(L.imag,C.imag)):this.real.sub(L,C.real),C},D.prototype.truncate=function(L){return this.real.truncate(L),this.imag.truncate(L),this},D})(),I=(function(D){R(L,D);function L(){return D!==null&&D.apply(this,arguments)||this}return L})(P),F=(function(D){R(L,D);function L(){return D!==null&&D.apply(this,arguments)||this}return L})(P);I.prototype.Base=l,I.prototype.temp1=new l,I.prototype.temp2=new l,F.prototype.Base=y,F.prototype.temp1=new y,F.prototype.temp2=new y,i.BigFloat32=l,i.BigFloat53=y,i.BigComplex32=I,i.BigComplex53=F,i.trimNumber=o,i.numberToString=a,Object.defineProperty(i,"__esModule",{value:!0})}))});var eee=Bq((Cw,gO)=>{(function(i,e){typeof Cw=="object"&&typeof gO=="object"?gO.exports=e():typeof define=="function"&&define.amd?define("FrameTicker",[],e):typeof Cw=="object"?Cw.FrameTicker=e():i.FrameTicker=e()})(Cw,function(){return(function(i){function e(n){if(t[n])return t[n].exports;var r=t[n]={exports:{},id:n,loaded:!1};return i[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var t={};return e.m=i,e.c=t,e.p="",e(0)})([function(i,e,t){"use strict";var n=t(1),r=(function(){function s(o,a,l){o===void 0&&(o=NaN),a===void 0&&(a=NaN),l===void 0&&(l=!1),this._minFPS=a,this._maxFPS=o,this._timeScale=1,this._currentTick=0,this._currentTime=0,this._tickDeltaTime=0,this._isRunning=!1,this._maxInterval=isNaN(this._minFPS)?NaN:1e3/this._minFPS,this._minInterval=isNaN(this._maxFPS)?NaN:1e3/this._maxFPS,this._onResume=new n.default,this._onPause=new n.default,this._onTick=new n.default,this._onTickOncePerFrame=new n.default,l||this.resume()}return s.prototype.updateOnce=function(o){o(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},s.prototype.resume=function(){this._isRunning||(this._isRunning=!0,this._lastTimeUpdated=this.getTimer(),this._onResume.dispatch(),this.animateOnce())},s.prototype.pause=function(){this._isRunning&&(this._isRunning=!1,this._onPause.dispatch(),window.cancelAnimationFrame(this._animationFrameHandle))},s.prototype.dispose=function(){this.pause(),this._onResume.removeAll(),this._onPause.removeAll(),this._onTick.removeAll()},Object.defineProperty(s.prototype,"currentTick",{get:function(){return this._currentTick},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"currentTimeSeconds",{get:function(){return this._currentTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"tickDeltaTimeSeconds",{get:function(){return this._tickDeltaTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"timeScale",{get:function(){return this._timeScale},set:function(o){this._timeScale!==o&&(this._timeScale=o)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onResume",{get:function(){return this._onResume},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onPause",{get:function(){return this._onPause},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onTick",{get:function(){return this._onTick},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onTickOncePerFrame",{get:function(){return this._onTickOncePerFrame},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"isRunning",{get:function(){return this._isRunning},enumerable:!0,configurable:!0}),s.prototype.animateOnce=function(){var o=this;this._animationFrameHandle=window.requestAnimationFrame(function(){return o.onFrame()})},s.prototype.onFrame=function(){if(this._now=this.getTimer(),this._frameDeltaTime=this._now-this._lastTimeUpdated,isNaN(this._minInterval)||this._frameDeltaTime>=this._minInterval)if(isNaN(this._maxInterval))this.update(this._frameDeltaTime*this._timeScale,!0),this._lastTimeUpdated=this._now;else for(this._interval=Math.min(this._frameDeltaTime,this._maxInterval);this._now>=this._lastTimeUpdated+this._interval;)this.update(this._interval*this._timeScale,this._now<=this._lastTimeUpdated+2*this._maxInterval),this._lastTimeUpdated+=this._interval;this._isRunning&&this.animateOnce()},s.prototype.update=function(o,a){a===void 0&&(a=!0),this._currentTick++,this._currentTime+=o,this._tickDeltaTime=o,this._onTick.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick),a&&this._onTickOncePerFrame.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},s.prototype.getTimer=function(){return Date.now()},s})();Object.defineProperty(e,"__esModule",{value:!0}),e.default=r},function(i,e,t){(function(n,r){i.exports=r()})(this,function(){return(function(n){function r(o){if(s[o])return s[o].exports;var a=s[o]={exports:{},id:o,loaded:!1};return n[o].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}var s={};return r.m=n,r.c=s,r.p="",r(0)})([function(n,r){"use strict";var s=(function(){function o(){this.functions=[]}return o.prototype.add=function(a){return this.functions.indexOf(a)===-1&&(this.functions.push(a),!0)},o.prototype.remove=function(a){var l=this.functions.indexOf(a);return l>-1&&(this.functions.splice(l,1),!0)},o.prototype.removeAll=function(){return this.functions.length>0&&(this.functions.length=0,!0)},o.prototype.dispatch=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var c=this.functions.concat();c.forEach(function(u){u.apply(void 0,a)})},Object.defineProperty(o.prototype,"numItems",{get:function(){return this.functions.length},enumerable:!0,configurable:!0}),o})();Object.defineProperty(r,"__esModule",{value:!0}),r.default=s}])})}])})});var kq=i=>new Promise(e=>setTimeout(e,i)),Sr=i=>document.querySelector(i);async function phe(){for(let i=0;i<300&&!(window.__atlasDebug&&!Sr("#map-loading")?.checkVisibility?.());i+=1)await kq(100)}async function mhe(){let i="";for(let e=0;e<100;e+=1){await kq(120),await new Promise(r=>requestAnimationFrame(r)),window.advanceTime?.();let t=window.__atlasDebug.snapshot(),n=JSON.stringify([t.zoom,t.center,t.resolution,t.tileStats]);if(n===i)return;i=n}}function Xf(i,e={}){window.dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0,...e}))}function Uq(i,e={}){window.dispatchEvent(new KeyboardEvent("keyup",{key:i,bubbles:!0,cancelable:!0,...e}))}function Ahe(i){Sr("#map").dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0}))}function qm(i,e){i.value=e,i.dispatchEvent(new Event("change",{bubbles:!0}))}function DL(i,e){let t=Sr(i);t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function NL(i,e=!1){let t=Sr("#parity-badge");t||(t=document.createElement("div"),t.id="parity-badge",t.style.cssText="position:fixed;top:8px;right:8px;z-index:9999;padding:6px 12px;font:700 13px monospace;border-radius:6px;color:#fff;pointer-events:none;",document.body.append(t)),t.style.background=e?"#b3261e":"#1a7f37",t.textContent=i}async function ghe(){let i=[],e=async R=>{await mhe(),i.push({name:R,snapshot:JSON.parse(window.render_game_to_text())})};await phe(),localStorage.clear();let t=Sr("#volume-select"),n=t.options[0].value;qm(t,n),await e("initial"),DL("#pin-search","a"),await e("search-a");let r=Sr(".search-result");r&&(r.click(),await e("search-select-first"),Sr("#close-detail").click(),await e("detail-closed")),DL("#pin-search",""),await e("search-cleared");let s=Sr(".category-row input");s&&(s.click(),await e("category-hidden"),s.click(),await e("category-restored"));let o=Sr(".only-button");if(o){o.click(),await e("solo-first");let R=Sr("#solo-chip");R&&!R.hidden&&R.click(),await e("solo-cleared")}let a=Sr("#legend .layer-title");a&&(a.click(),await e("section-folded"),Sr("#expand-all").click(),await e("sections-unfolded")),Sr("#hide-all").click(),await e("all-hidden"),Sr("#show-all").click(),await e("all-shown");let l=Sr(".zone-index-item");l&&(l.click(),await e("zone-jumped"),l.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),await e("zone-highlighted"),l.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),await e("zone-unhighlighted"));let c=Sr("[data-expand-collection]");c&&(c.click(),await e("collection-folded"),c.click(),await e("collection-unfolded"));let u=[...document.querySelectorAll(".category-row")].filter(R=>R.querySelector("[data-expand-collection]")),f=u[1]||u[0];if(f){let R=f.querySelector("input[data-collection]");R.click(),await e("collection-hidden"),R.click(),await e("collection-restored");let P=f.querySelector("[data-only-collection]");if(P){P.click(),await e("collection-solo");let I=Sr("#solo-chip");I&&!I.hidden&&I.click(),await e("collection-solo-cleared")}}let d=Sr("[data-label-toggle]");d&&(d.click(),await e("labels-flipped"),d.click(),await e("labels-curated"));let A=Sr("[data-render-toggle]");A&&(A.click(),await e("render-flipped"),A.click(),await e("render-curated"));let y=[...document.querySelectorAll(".feature-index")].map(R=>R.querySelector(".zone-index-item")).filter(Boolean);if(y.length>1){let R=F=>F.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),P=y[0],I=y[y.length-1];R(P),R(I),await e("and-highlighted"),Xf("z"),await e("labels-held-highlighted"),Uq("z"),R(P),R(I),await e("and-cleared")}Xf("g"),await e("grid-open"),DL("#grid-input","m"),await e("grid-descended"),Xf(" "),await e("subgrid-hidden"),Xf(" "),Xf("Escape"),await e("grid-ascended"),Xf("Escape"),await e("grid-closed"),Xf("z"),await e("labels-on"),Uq("z"),await e("labels-off"),Xf("b",{metaKey:!0}),await e("sidebar-collapsed"),Xf("b",{metaKey:!0}),await e("sidebar-restored"),Sr("#zoom-in").click(),await e("zoomed-in");let w=Sr("#overview-dock");w&&!Sr("#overview-shelf").hidden&&(w.click(),await e("overview-docked"),w.click(),await e("overview-undocked")),Sr("#zoom-out").click(),await e("zoomed-out"),Ahe("Escape"),await e("viewport-escape");let S=Sr("#lens-select");S.options.length>1&&(qm(S,S.options[1].value),await e("variant-second"),qm(S,S.options[0].value),await e("variant-first"));let T=Sr("#world-select");return T.options.length>1&&(qm(T,T.options[1].value),await e("map-second"),qm(T,T.options[0].value),await e("map-first")),t.options.length>1&&(qm(t,t.options[1].value),await e("game-second"),qm(t,n),await e("game-first")),localStorage.clear(),{viewport:[window.innerWidth,window.innerHeight],steps:i}}var FL=!1;async function zq(){if(!FL){FL=!0,NL("parity tour running\u2026");try{let i=await ghe(),e=await fetch("/parity/result",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i,null,2)}),t=(await e.text()).trim();if(!e.ok)throw new Error(`saving failed: ${e.status} ${t}`);NL(`parity tour complete \u2713 ${i.steps.length} steps`),console.log("parity tour saved to",t)}catch(i){NL(`parity tour failed: ${i}`,!0),console.error("parity tour failed",i)}finally{FL=!1}}}window.__atlasTour=zq;window.addEventListener("keydown",i=>{i.key==="F9"&&zq()});var on=i=>document.querySelector(i),ge={volume:on("#volume-select"),world:on("#world-select"),lens:on("#lens-select"),lensField:on("#lens-field"),legend:on("#legend"),search:on("#pin-search"),searchResults:on("#dock-results"),dock:on("#dock"),dockCount:on("#dock-count"),dockFlag:on("#dock-flag"),dockFold:on("#dock-fold"),dockRailName:on("#dock-rail-name"),visibleCount:on("#visible-count"),viewport:on("#map"),globe:on("#globe"),globeToggle:on("#globe-toggle"),layers:on("#layers"),loading:on("#map-loading"),labelsHint:on("#labels-hint"),gridHint:on("#grid-hint"),soloChip:on("#solo-chip"),overview:on("#overview"),overviewShelf:on("#overview-shelf"),overviewDock:on("#overview-dock"),overviewCanvas:on("#overview-canvas"),overviewViewport:on("#overview-viewport"),gridNavigator:on("#grid-navigator"),gridSystem:on("#grid-system"),gridSystemName:on("#grid-system-name"),gridInput:on("#grid-input"),gridBack:on("#grid-back"),subgridToggle:on("#subgrid-toggle"),detail:on("#pin-detail"),detailTitle:on("#detail-title"),detailCategory:on("#detail-category"),detailDescription:on("#detail-description"),detailID:on("#detail-id"),detailCoordinates:on("#detail-coordinates"),detailCoordinatesField:on("#detail-coordinates-field"),detailCell:on("#detail-cell"),detailCellField:on("#detail-cell-field"),detailSource:on("#detail-source"),detailSourceField:on("#detail-source-field"),detailLinks:on("#detail-links"),detailDot:on("#detail-dot"),sidebar:on("#sidebar"),mobileLegend:on("#mobile-legend"),fatal:on("#fatal-error"),fatalMessage:on("#fatal-message"),emptyState:on("#empty-state"),emptyPath:on("#empty-path"),emptyOpen:on("#empty-open"),addBundles:on("#add-bundles")};function Hm(i,e,t,n){i.replaceChildren(),e.forEach((r,s)=>{let o=document.createElement("option");o.value=n?String(r[n]):r.slug||String(s),o.textContent=r[t],i.append(o)})}var O={catalog:null,volume:null,world:null,lens:null,engine:null,projection:null,layers:null,sources:null,hiddenCollections:new Set,collapsedSections:new Set,expandedCollections:new Set,features:[],featureByID:new Map,selectedPin:null,selectedZone:null,hoveredPin:null,labelsHeld:!1,gridEnabled:!1,gridSystem:"geohash",globeActive:!1,subgridVisible:!0,gridCell:"",zoneRecords:new Map,highlightedZones:new Set,focusedZoneID:null,labelOverrides:new Map,renderOverrides:new Map,search:"",fitZoom:0,zoneTitleCount:0,eligibleLocations:0,tileRun:0,tileStats:{requested:0,loaded:0,errors:0,peakPending:0},overviewRun:0,overviewKey:"",overviewPointer:null,overviewDocked:!1,dockFolded:!0,dockDismissed:!1,renderedShard:0,worldRun:0,textByWorld:new Map,restore:null,settling:!1,styleCache:new Map,markerIcons:new Map};var $f=["#4fb3d5","#c9924b","#82b56a","#c96a6a","#9581cc","#4bc9a9","#d4b04a","#6a92c9","#b08a5a","#8fb3a2"],Wm="0123456789bcdefghjkmnpqrstuvwxyz";var BL="atlas.session.v3";var Vq={light:"rgba(255, 255, 255, 0.96)",dark:"rgba(7, 9, 7, 0.98)"},Vi={labelSizePx:11,neighborLabelSizePx:10,labelInsetPx:5,labelFont:"ui-monospace, SFMono-Regular, Menlo, monospace",prefixAlpha:.55,chip:"rgba(12, 15, 22, 0.76)",neighborChip:"rgba(8, 11, 18, 0.88)",lineWhite:"#ffffff",widths:{leaf:2.5,scope:2.5,scopeBare:1.8,child:1.4,neighbor:1},childLineAlpha:.82,neighborLineAlpha:.44,leafFillAlpha:.14,childFillAlpha:.055,neighborTextAlpha:.72,dimColor:"#050810",dimBase:.3,dimStep:.06,dimCap:.52};function _T(i){let e=[...Yf()],t=!0;for(let n of i){let r=Wm.indexOf(n);if(!(r<0))for(let s of[16,8,4,2,1]){if(t){let o=(e[0]+e[2])/2;r&s?e[0]=o:e[2]=o}else{let o=(e[1]+e[3])/2;r&s?e[1]=o:e[3]=o}t=!t}}return e}function UL(i,e){let t=[...Yf()],[n,r]=i;if(n<t[0]||n>t[2]||r<t[1]||r>t[3])return"";let s=!0,o="";for(let a=0;a<e;a++){let l=0;for(let c of[16,8,4,2,1]){if(s){let u=(t[0]+t[2])/2;n>=u?(l|=c,t[0]=u):t[2]=u}else{let u=(t[1]+t[3])/2;r>=u?(l|=c,t[1]=u):t[3]=u}s=!s}o+=Wm[l]}return o}var OL={key:null,extent:null};function vhe(i){let t=`${Yf().join(",")}|${i}`;return OL.key!==t&&(OL={key:t,extent:_T(i)}),OL.extent}var kL={slug:"geohash",name:"Geohash",short:"G",appliesTo(){return!0},maxLevel(){return 3},inputLength(){return 3},level(i){return i.length},parent(i){return i.slice(0,-1)},children(i){return[...Wm].map(e=>i+e)},childIndex(i){return Math.max(0,Wm.indexOf(i[i.length-1]))},contains(i,e){let t=vhe(i),[n,r]=e;return n>=t[0]&&n<=t[2]&&r>=t[1]&&r<=t[3]},descendTarget(i,e){return UL(e,i.length+1)},bbox:_T,center(i){let e=_T(i);return[(e[0]+e[2])/2,(e[1]+e[3])/2]},ring(i){let[e,t,n,r]=_T(i);return[[e,t],[e,r],[n,r],[n,t],[e,t]]},poleContained(){return null},label(i){return{context:i.slice(0,-1),principal:i.slice(-1)}},colorKey(i){return Math.max(0,Wm.indexOf(i[i.length-1]))%$f.length},normalizeInput(i){return[...i.toLocaleLowerCase()].filter(e=>Wm.includes(e)).slice(0,3).join("")},parseInput(i){return i},locate(i){let e=UL(i,3);return e?{label:"Geohash",value:e}:null}};function Gq(i,e=3){return UL(i,e)}var E1=Oq(Hq());function Wq(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function ay(i,e,t){if(bH())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&ly(r,t.prototype),r}function jq(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,bhe(n.key),n)}}function _he(i,e,t){return e&&jq(i.prototype,e),t&&jq(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function Ct(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t)return(t=t.call(i)).next.bind(t);if(Array.isArray(i)||(t=whe(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var n=0;return function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.2-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ST(){return ST=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},ST.apply(null,arguments)}function YL(i){return YL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},YL(i)}function dy(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,ly(i,e)}function xhe(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function bH(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bH=function(){return!!i})()}function ly(i,e){return ly=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},ly(i,e)}function yhe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function bhe(i){var e=yhe(i,"string");return typeof e=="symbol"?e:e+""}function whe(i,e){if(i){if(typeof i=="string")return Wq(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Wq(i,e):void 0}}function L1(i){var e=typeof Map=="function"?new Map:void 0;return L1=function(t){if(t===null||!xhe(t))return t;if(typeof t!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return ay(t,arguments,YL(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ly(n,t)},L1(i)}var Li=(function(){function i(t,n){this.lo=0,this.hi=0,this.lo=t,this.hi=n}var e=i.prototype;return e.isEmpty=function(){return this.lo>this.hi},e.equals=function(n){return this.lo==n.lo&&this.hi==n.hi||this.isEmpty()&&n.isEmpty()},e.center=function(){return .5*(this.lo+this.hi)},e.length=function(){return this.hi-this.lo},e.contains=function(n){return this.lo<=n&&n<=this.hi},e.containsInterval=function(n){return n.isEmpty()?!0:this.lo<=n.lo&&n.hi<=this.hi},e.interiorContains=function(n){return this.lo<n&&n<this.hi},e.interiorContainsInterval=function(n){return n.isEmpty()?!0:this.lo<n.lo&&n.hi<this.hi},e.intersects=function(n){return this.lo<=n.lo?n.lo<=this.hi&&n.lo<=n.hi:this.lo<=n.hi&&this.lo<=this.hi},e.interiorIntersects=function(n){return n.lo<this.hi&&this.lo<n.hi&&this.lo<this.hi&&n.lo<=n.hi},e.intersection=function(n){return new i(Math.max(this.lo,n.lo),Math.min(this.hi,n.hi))},e.union=function(n){return this.isEmpty()?n:n.isEmpty()?this:new i(Math.min(this.lo,n.lo),Math.max(this.hi,n.hi))},e.addPoint=function(n){return this.isEmpty()?new i(n,n):n<this.lo?new i(n,this.hi):n>this.hi?new i(this.lo,n):this},e.clampPoint=function(n){return Math.max(this.lo,Math.min(this.hi,n))},e.expanded=function(n){return this.isEmpty()?this:new i(this.lo-n,this.hi+n)},e.approxEqual=function(n,r){return r===void 0&&(r=1e-15),this.isEmpty()?n.length()<=2*r:n.isEmpty()?this.length()<=2*r:Math.abs(n.lo-this.lo)<=r&&Math.abs(n.hi-this.hi)<=r},e.directedHausdorffDistance=function(n){return this.isEmpty()?0:n.isEmpty()?1/0:Math.max(0,Math.max(this.hi-n.hi,n.lo-this.lo))},e.trunc=function(n){n===void 0&&(n=15);var r=+("1e"+n),s=function(a){return Math.round(a*r)/r};return new i(s(this.lo),s(this.hi))},e.toString=function(){var n=this.trunc(7);return"["+n.lo.toFixed(7)+", "+n.hi.toFixed(7)+"]"},i.empty=function(){return new i(1,0)},i.fromPoint=function(n){return new i(n,n)},i})();var Ci=(function(){function i(t,n){t===void 0&&(t=0),n===void 0&&(n=0),this.x=0,this.y=0,this.x=t,this.y=n}var e=i.prototype;return e.add=function(n){return new i(this.x+n.x,this.y+n.y)},e.sub=function(n){return new i(this.x-n.x,this.y-n.y)},e.mul=function(n){return new i(this.x*n,this.y*n)},e.ortho=function(){return new i(-this.y,this.x)},e.dot=function(n){return this.x*n.x+this.y*n.y},e.cross=function(n){return this.x*n.y-this.y*n.x},e.norm=function(){return Math.hypot(this.x,this.y)},e.normalize=function(){return this.x==0&&this.y==0?this:this.mul(1/this.norm())},e.trunc=function(n){n===void 0&&(n=15);var r=+("1e"+n),s=function(a){return Math.round(a*r)/r};return new i(s(this.x),s(this.y))},e.equals=function(n){return this.x===n.x&&this.y===n.y},e.toString=function(){var n=this.trunc(12);return"("+n.x.toFixed(12)+", "+n.y.toFixed(12)+")"},i})(),Wr=(function(){function i(t,n){t===void 0&&(t=new Li(0,0)),n===void 0&&(n=new Li(0,0)),this.x=t,this.y=n}var e=i.prototype;return e.isValid=function(){return this.x.isEmpty()==this.y.isEmpty()},e.isEmpty=function(){return this.x.isEmpty()},e.vertices=function(){return[new Ci(this.x.lo,this.y.lo),new Ci(this.x.hi,this.y.lo),new Ci(this.x.hi,this.y.hi),new Ci(this.x.lo,this.y.hi)]},e.vertexIJ=function(n,r){var s=this.x.lo;n==1&&(s=this.x.hi);var o=this.y.lo;return r==1&&(o=this.y.hi),new Ci(s,o)},e.lo=function(){return new Ci(this.x.lo,this.y.lo)},e.hi=function(){return new Ci(this.x.hi,this.y.hi)},e.center=function(){return new Ci(this.x.center(),this.y.center())},e.size=function(){return new Ci(this.x.length(),this.y.length())},e.containsPoint=function(n){return this.x.contains(n.x)&&this.y.contains(n.y)},e.interiorContainsPoint=function(n){return this.x.interiorContains(n.x)&&this.y.interiorContains(n.y)},e.contains=function(n){return this.x.containsInterval(n.x)&&this.y.containsInterval(n.y)},e.interiorContains=function(n){return this.x.interiorContainsInterval(n.x)&&this.y.interiorContainsInterval(n.y)},e.intersects=function(n){return this.x.intersects(n.x)&&this.y.intersects(n.y)},e.interiorIntersects=function(n){return this.x.interiorIntersects(n.x)&&this.y.interiorIntersects(n.y)},e.addPoint=function(n){return new i(this.x.addPoint(n.x),this.y.addPoint(n.y))},e.addRect=function(n){return new i(this.x.union(n.x),this.y.union(n.y))},e.clampPoint=function(n){return new Ci(this.x.clampPoint(n.x),this.y.clampPoint(n.y))},e.expanded=function(n){var r=this.x.expanded(n.x),s=this.y.expanded(n.y);return r.isEmpty()||s.isEmpty()?i.empty():new i(r,s)},e.expandedByMargin=function(n){return this.expanded(new Ci(n,n))},e.union=function(n){return new i(this.x.union(n.x),this.y.union(n.y))},e.intersection=function(n){var r=this.x.intersection(n.x),s=this.y.intersection(n.y);return r.isEmpty()||s.isEmpty()?i.empty():new i(r,s)},e.approxEqual=function(n){return this.x.approxEqual(n.x)&&this.y.approxEqual(n.y)},e.string=function(){return"["+this.lo().toString()+", "+this.hi.toString()+"]"},i.fromPoints=function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];if(r.length==0)return new i;for(var o=new i(new Li(r[0].x,r[0].x),new Li(r[0].y,r[0].y)),a=1;a<r.length;a++)o=o.addPoint(r[a]);return o},i.fromCenterSize=function(n,r){return new i(new Li(n.x-r.x/2,n.x+r.x/2),new Li(n.y-r.y/2,n.y+r.y/2))},i.fromRect=function(n){return new i(new Li(n.x.lo,n.x.hi),new Li(n.y.lo,n.y.hi))},i.empty=function(){return new i(Li.empty(),Li.empty())},i})();var Wt=(function(){function i(t,n,r){this.x=0,this.y=0,this.z=0,this.x=t,this.y=n,this.z=r}var e=i.prototype;return e.approxEqual=function(n){var r=1e-16;return Math.abs(this.x-n.x)<r&&Math.abs(this.y-n.y)<r&&Math.abs(this.z-n.z)<r},e.toString=function(){return"("+this.x.toFixed(24)+", "+this.y.toFixed(24)+", "+this.z.toFixed(24)+")"},e.norm=function(){return Math.sqrt(this.dot(this))},e.norm2=function(){return this.dot(this)},e.normalize=function(){var n=this.norm2();return n==0?new i(0,0,0):this.mul(1/Math.sqrt(n))},e.isUnit=function(){var n=5e-14;return Math.abs(this.norm2()-1)<=n},e.abs=function(){return new i(Math.abs(this.x),Math.abs(this.y),Math.abs(this.z))},e.add=function(n){return new i(this.x+n.x,this.y+n.y,this.z+n.z)},e.sub=function(n){return new i(this.x-n.x,this.y-n.y,this.z-n.z)},e.mul=function(n){return new i(n*this.x,n*this.y,n*this.z)},e.dot=function(n){return this.x*n.x+this.y*n.y+this.z*n.z||0},e.cross=function(n){return new i(this.y*n.z-this.z*n.y,this.z*n.x-this.x*n.z,this.x*n.y-this.y*n.x)},e.distance=function(n){return this.sub(n).norm()},e.angle=function(n){return Math.atan2(this.cross(n).norm(),this.dot(n))},e.ortho=function(){var n=new i(0,0,0),r=this.largestComponent();return r===i.X_AXIS?n.z=1:r===i.Y_AXIS?n.x=1:n.y=1,this.cross(n).normalize()},e.largestComponent=function(){var n=this.abs();return n.x>n.y?n.x>n.z?i.X_AXIS:i.Z_AXIS:n.y>n.z?i.Y_AXIS:i.Z_AXIS},e.smallestComponent=function(){var n=this.abs();return n.x<n.y?n.x<n.z?i.X_AXIS:i.Z_AXIS:n.y<n.z?i.Y_AXIS:i.Z_AXIS},e.equals=function(n){return this.x==n.x&&this.y==n.y&&this.z==n.z},e.cmp=function(n){return this.x<n.x?-1:this.x>n.x?1:this.y<n.y?-1:this.y>n.y?1:this.z<n.z?-1:this.z>n.z?1:0},i})();Wt.X_AXIS=0;Wt.Y_AXIS=1;Wt.Z_AXIS=2;var zL=(function(){function i(t,n,r){this.x=t,this.y=n,this.z=r}i.fromVector=function(n){return new i(new E1.BigFloat32(n.x),new E1.BigFloat32(n.y),new E1.BigFloat32(n.z))};var e=i.prototype;return e.vector=function(){return new Wt(this.x.valueOf(),this.y.valueOf(),this.z.valueOf()).normalize()},e.equals=function(n){return this.x.cmp(n.x)===0&&this.y.cmp(n.y)===0&&this.z.cmp(n.z)===0},e.toString=function(){return"("+this.x.toString()+", "+this.y.toString()+", "+this.z.toString()+")"},e.norm2=function(){return this.dot(this)},e.isUnit=function(){return this.norm2().cmp(new E1.BigFloat32(1))===0},e.abs=function(){var n=this.x.mul(this.x.getSign()),r=this.y.mul(this.y.getSign()),s=this.z.mul(this.z.getSign());return new i(n,r,s)},e.add=function(n){return new i(this.x.add(n.x),this.y.add(n.y),this.z.add(n.z))},e.sub=function(n){return new i(this.x.sub(n.x),this.y.sub(n.y),this.z.sub(n.z))},e.mul=function(n){return new i(this.x.mul(n),this.y.mul(n),this.z.mul(n))},e.mulByFloat64=function(n){return this.mul(new E1.BigFloat32(n))},e.dot=function(n){return this.x.mul(n.x).add(this.y.mul(n.y).add(this.z.mul(n.z)))},e.cross=function(n){return new i(this.y.mul(n.z).sub(this.z.mul(n.y)),this.z.mul(n.x).sub(this.x.mul(n.z)),this.x.mul(n.y).sub(this.y.mul(n.x)))},e.largestComponent=function(){var n=this.abs();return n.x.cmp(n.y)>0?n.x.cmp(n.z)>0?Wt.X_AXIS:Wt.Z_AXIS:n.y.cmp(n.z)>0?Wt.Y_AXIS:Wt.Z_AXIS},e.smallestComponent=function(){var n=this.abs();return n.x.cmp(n.y)<0?n.x.cmp(n.z)<0?Wt.X_AXIS:Wt.Z_AXIS:n.y.cmp(n.z)<0?Wt.Y_AXIS:Wt.Z_AXIS},e.isZero=function(){return this.x.isZero()&&this.y.isZero()&&this.z.isZero()},i})();var ZL=Math.PI/180,pp=function(e,t){if(isNaN(e)||isNaN(t)||!isFinite(e)||t===0)return NaN;var n=e/t,r=Math.round(n);Math.abs(n-r)===.5&&(r=2*Math.round(n/2));var s=e-r*t;return s||Math.sign(e)*0},wH=function(e,t){if(isNaN(e)||isNaN(t))return NaN;if(e===t)return t;if(e===0)return t>0?Number.MIN_VALUE:-Number.MIN_VALUE;var n=new ArrayBuffer(8),r=new DataView(n);r.setFloat64(0,e,!0);var s=r.getBigUint64(0,!0);return e>0==t>e?s+=1n:s-=1n,r.setBigUint64(0,s,!0),r.getFloat64(0,!0)},She=function(e){var t=e&-e&0xffffffffffffffffn;if(t===0n)return 64;var n=Math.clz32(Number(t&0xffffffffn));if(n<32)return 31-n;var r=Math.clz32(Number(t>>32n&0xffffffffn));return 63-r},SH=function(e){var t=e&0xffffffffffffffffn;if(t===0n)return 64;var n=Math.clz32(Number(t>>32n&0xffffffffn));if(n<32)return 63-n;var r=Math.clz32(Number(t&0xffffffffn));return 31-r},KL=function(e,t){return e*Math.pow(2,t)},Xq=function(e){return isNaN(e)?NaN:e===0?-1/0:isFinite(e)?(e=Math.abs(e),e<Number.MIN_VALUE?-1074:Math.floor(Math.log2(e))):1/0},Tc=function(e){return e},TH=function(e){return e/ZL||0};var The=function(){return 1/0},Ehe=function(e){return e==1/0};var $q=function(e){return TH(e).toFixed(7)},Yq=function(e,t,n){return n===void 0&&(n=1e-15),Math.abs(e-t)<=n};var TT=-1,D1=2,Mc=4,pD=4,jm=1e-15,oy=2220446049e-25,bT=function(e){if(e<0)return TT;if(Ehe(e))return Pc();var t=2*Math.sin(.5*Math.min(Math.PI,Tc(e)));return t*t},QL=function(e){return e>pD?Mc:e},FT=function(e,t){return Mhe(e)?e:Math.max(0,Math.min(pD,e+t))},ET=function(e){return e<0?-1:EH(e)?The():2*Math.asin(.5*Math.sqrt(e))},Pc=function(){return 1/0},EH=function(e){return e==1/0},Mhe=function(e){return e<0||EH(e)};var N1=function(e){return e>=pD?Pc():e<0?0:wH(e,10)};var mD=function(e){return 4.5*oy*e+16*oy*oy};var ny=function(e,t){return bT(ET(e)+ET(t))},Che=function(e,t){if(t==0)return e;if(e<=t)return 0;var n=e*(1-.25*t),r=t*(1-.25*e);return Math.max(0,n+r-2*Math.sqrt(n*r))},Rhe=function(e){return Math.sqrt(MH(e))||0},MH=function(e){return e*(1-.25*e)||0};var to=(function(){function i(t,n){this.lo=t,this.hi=n}i.fromEndpoints=function(n,r){var s=new i(n,r);return n===-Math.PI&&r!==Math.PI&&(s.lo=Math.PI),r===-Math.PI&&n!==Math.PI&&(s.hi=Math.PI),s},i.fromPointPair=function(n,r){return n===-Math.PI&&(n=Math.PI),r===-Math.PI&&(r=Math.PI),i.positiveDistance(n,r)<=Math.PI?new i(n,r):new i(r,n)},i.emptyInterval=function(){return new i(Math.PI,-Math.PI)},i.fullInterval=function(){return new i(-Math.PI,Math.PI)};var e=i.prototype;return e.isValid=function(){return Math.abs(this.lo)<=Math.PI&&Math.abs(this.hi)<=Math.PI&&!(this.lo===-Math.PI&&this.hi!==Math.PI)&&!(this.hi===-Math.PI&&this.lo!==Math.PI)},e.isFull=function(){return this.lo===-Math.PI&&this.hi===Math.PI},e.isEmpty=function(){return this.lo===Math.PI&&this.hi===-Math.PI},e.isInverted=function(){return this.lo>this.hi},e.equals=function(n){return this.lo==n.lo&&this.hi==n.hi||this.isEmpty()&&n.isEmpty()},e.invert=function(){return new i(this.hi,this.lo)},e.center=function(){var n=.5*(this.lo+this.hi);return this.isInverted()?n<=0?n+Math.PI:n-Math.PI:n},e.length=function(){var n=this.hi-this.lo;return n>=0||(n+=2*Math.PI,n>0)?n:-1},e.fastContains=function(n){return this.isInverted()?(n>=this.lo||n<=this.hi)&&!this.isEmpty():n>=this.lo&&n<=this.hi},e.contains=function(n){return n===-Math.PI&&(n=Math.PI),this.fastContains(n)},e.containsInterval=function(n){return this.isInverted()?n.isInverted()?n.lo>=this.lo&&n.hi<=this.hi:(n.lo>=this.lo||n.hi<=this.hi)&&!this.isEmpty():n.isInverted()?this.isFull()||n.isEmpty():n.lo>=this.lo&&n.hi<=this.hi},e.interiorContains=function(n){return n===-Math.PI&&(n=Math.PI),this.isInverted()?n>this.lo||n<this.hi:n>this.lo&&n<this.hi||this.isFull()},e.interiorContainsInterval=function(n){return this.isInverted()?n.isInverted()?n.lo>this.lo&&n.hi<this.hi||n.isEmpty():n.lo>this.lo||n.hi<this.hi:n.isInverted()?this.isFull()||n.isEmpty():n.lo>this.lo&&n.hi<this.hi||this.isFull()},e.intersects=function(n){return this.isEmpty()||n.isEmpty()?!1:this.isInverted()?n.isInverted()||n.lo<=this.hi||n.hi>=this.lo:n.isInverted()?n.lo<=this.hi||n.hi>=this.lo:n.lo<=this.hi&&n.hi>=this.lo},e.interiorIntersects=function(n){return this.isEmpty()||n.isEmpty()||this.lo===this.hi?!1:this.isInverted()?n.isInverted()||n.lo<this.hi||n.hi>this.lo:n.isInverted()?n.lo<this.hi||n.hi>this.lo:n.lo<this.hi&&n.hi>this.lo||this.isFull()},i.positiveDistance=function(n,r){var s=r-n;return s>=0?s:r+Math.PI-(n-Math.PI)},e.union=function(n){return n.isEmpty()?this:this.fastContains(n.lo)?this.fastContains(n.hi)?this.containsInterval(n)?this:i.fullInterval():new i(this.lo,n.hi):this.fastContains(n.hi)?new i(n.lo,this.hi):this.isEmpty()||n.fastContains(this.lo)?n:i.positiveDistance(n.hi,this.lo)<i.positiveDistance(this.hi,n.lo)?new i(n.lo,this.hi):new i(this.lo,n.hi)},e.intersection=function(n){return n.isEmpty()?i.emptyInterval():this.fastContains(n.lo)?this.fastContains(n.hi)?n.length()<this.length()?n:this:new i(n.lo,this.hi):this.fastContains(n.hi)?new i(this.lo,n.hi):n.fastContains(this.lo)?this:i.emptyInterval()},e.addPoint=function(n){return Math.abs(n)>Math.PI?this:(n===-Math.PI&&(n=Math.PI),this.fastContains(n)?this:this.isEmpty()?new i(n,n):i.positiveDistance(n,this.lo)<i.positiveDistance(this.hi,n)?new i(n,this.hi):new i(this.lo,n))},e.expanded=function(n){if(n>=0){if(this.isEmpty())return this;if(this.length()+2*n+2*oy>=2*Math.PI)return i.fullInterval()}else{if(this.isFull())return this;if(this.length()+2*n-2*oy<=0)return i.emptyInterval()}var r=i.fromEndpoints(pp(this.lo-n,2*Math.PI),pp(this.hi+n,2*Math.PI));return r.lo<=-Math.PI&&(r.lo=Math.PI),r},e.approxEqual=function(n){return this.isEmpty()?n.length()<=2*jm:n.isEmpty()?this.length()<=2*jm:this.isFull()?n.length()>=2*(Math.PI-jm):n.isFull()?this.length()>=2*(Math.PI-jm):Math.abs(pp(n.lo-this.lo,2*Math.PI))<=jm&&Math.abs(pp(n.hi-this.hi,2*Math.PI))<=jm&&Math.abs(this.length()-n.length())<=2*jm},e.toString=function(){return"["+this.lo.toFixed(7)+", "+this.hi.toFixed(7)+"]"},e.complement=function(){return this.lo===this.hi?i.fullInterval():new i(this.hi,this.lo)},e.complementCenter=function(){return this.lo!==this.hi?this.complement().center():this.hi<=0?this.hi+Math.PI:this.hi-Math.PI},e.directedHausdorffDistance=function(n){if(n.containsInterval(this))return 0;if(n.isEmpty())return Math.PI;var r=n.complementCenter();if(this.contains(r))return i.positiveDistance(n.hi,r);var s=0;i.fromEndpoints(n.hi,r).contains(this.hi)&&(s=i.positiveDistance(n.hi,this.hi));var o=0;return i.fromEndpoints(r,n.lo).contains(this.lo)&&(o=i.positiveDistance(this.lo,n.lo)),Math.max(s,o)},e.project=function(n){if(n===-Math.PI&&(n=Math.PI),this.fastContains(n))return n;var r=i.positiveDistance(n,this.lo),s=i.positiveDistance(this.hi,n);return r<s?this.lo:this.hi},i})();var ul=4,Ic=1,Kf=2,Ihe=[[0,1,3,2],[0,3,1,2],[2,3,1,0],[2,1,3,0]],AD=[[0,1,3,2],[0,2,3,1],[3,2,0,1],[3,1,0,2]],C1=[Ic,0,0,Kf|Ic],CH=[],RH=[];mp(0,0,0,0,0,0);mp(0,0,0,Ic,0,Ic);mp(0,0,0,Kf,0,Kf);mp(0,0,0,Ic|Kf,0,Ic|Kf);function mp(i,e,t,n,r,s){if(i==ul){var o=(e<<ul)+t;RH[(o<<2)+n]=(r<<2)+s,CH[(r<<2)+n]=(o<<2)+s;return}i++,e<<=1,t<<=1,r<<=2;var a=AD[s];mp(i,e+(a[0]>>1),t+(a[0]&1),n,r,s^C1[0]),mp(i,e+(a[1]>>1),t+(a[1]&1),n,r+1,s^C1[1]),mp(i,e+(a[2]>>1),t+(a[2]&1),n,r+2,s^C1[2]),mp(i,e+(a[3]>>1),t+(a[3]&1),n,r+3,s^C1[3])}var Phe=3,IH=6,_i=30,py=2*_i+1,hl=Number(1n<<BigInt(_i)),vp=BigInt(IH)<<BigInt(py),Zq=Number(BigInt(hl)<<1n),Ap=function(e){return e>Zq?1:e/Zq},Cc=function(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))},ch=function(e){return e>=0?.5*Math.sqrt(1+3*e):1-.5*Math.sqrt(1-3*e)},cy=function(e){var t=e.largestComponent();switch(t){case Wt.X_AXIS:e.x<0&&(t+=3);break;case Wt.Y_AXIS:e.y<0&&(t+=3);break;case Wt.Z_AXIS:e.z<0&&(t+=3);break}return t},Ym=function(e,t){switch(e){case 0:return[t.y/t.x,t.z/t.x];case 1:return[-t.x/t.y,t.z/t.y];case 2:return[-t.x/t.z,-t.y/t.z];case 3:return[t.z/t.x,t.y/t.x];case 4:return[t.z/t.y,-t.x/t.y];default:return[-t.y/t.z,-t.x/t.z]}},MT=function(e){var t=cy(e),n=Ym(t,e),r=n[0],s=n[1];return[t,r,s]},uh=function(e,t,n){switch(e){case 0:return new Wt(1,t,n);case 1:return new Wt(-t,1,n);case 2:return new Wt(-t,-n,1);case 3:return new Wt(-1,-n,-t);case 4:return new Wt(n,-1,-t);default:return new Wt(n,t,-1)}},Lhe=function(e,t){switch(e){case 0:if(t.x<=0)return[0,0,!1];break;case 1:if(t.y<=0)return[0,0,!1];break;case 2:if(t.z<=0)return[0,0,!1];break;case 3:if(t.x>=0)return[0,0,!1];break;case 4:if(t.y>=0)return[0,0,!1];break;default:if(t.z>=0)return[0,0,!1];break}var n=Ym(e,t),r=n[0],s=n[1];return[r,s,!0]},_p=function(e,t){switch(e){case 0:return new Wt(t.y,t.z,t.x);case 1:return new Wt(-t.x,t.z,t.y);case 2:return new Wt(-t.x,-t.y,t.z);case 3:return new Wt(-t.z,-t.y,-t.x);case 4:return new Wt(-t.z,t.x,-t.y);default:return new Wt(t.y,t.x,-t.z)}},wT=function(e,t,n){return uh(e,Cc(Ap(t)),Cc(Ap(n)))},Kq=function(e,t){switch(e){case 0:return new Wt(t,-1,0);case 1:return new Wt(1,t,0);case 2:return new Wt(1,0,t);case 3:return new Wt(-t,0,1);case 4:return new Wt(0,-t,1);default:return new Wt(0,-1,-t)}},Qq=function(e,t){switch(e){case 0:return new Wt(-t,0,1);case 1:return new Wt(0,-t,1);case 2:return new Wt(0,-1,-t);case 3:return new Wt(t,-1,0);case 4:return new Wt(1,t,0);default:return new Wt(1,0,t)}},Dhe=[[new Wt(0,1,0),new Wt(0,0,1),new Wt(1,0,0)],[new Wt(-1,0,0),new Wt(0,0,1),new Wt(0,1,0)],[new Wt(-1,0,0),new Wt(0,-1,0),new Wt(0,0,1)],[new Wt(0,0,-1),new Wt(0,-1,0),new Wt(-1,0,0)],[new Wt(0,0,-1),new Wt(1,0,0),new Wt(0,-1,0)],[new Wt(0,1,0),new Wt(1,0,0),new Wt(0,0,-1)]],Nhe=[[[4,1],[5,2],[3,0]],[[0,3],[5,2],[4,1]],[[0,3],[1,4],[5,2]],[[2,5],[1,4],[0,3]],[[2,5],[3,0],[1,4]],[[4,1],[3,0],[2,5]]],PH=function(e,t){return Dhe[e][t]},CT=function(e,t,n){return Nhe[e][t][n]},Fhe=function(e){return PH(e,0)},Bhe=function(e){return PH(e,1)},JL=Math.PI/2,Jq=-JL,ar=(function(){function i(t,n){this.lat=t,this.lng=n}i.fromDegrees=function(n,r){return new i(n*ZL,r*ZL)},i.latitude=function(n){var r=n.vector;return Math.atan2(r.z,Math.sqrt(r.x*r.x+r.y*r.y))},i.longitude=function(n){return Math.atan2(n.vector.y,n.vector.x)},i.fromPoint=function(n){return new i(this.latitude(n),this.longitude(n))};var e=i.prototype;return e.isValid=function(){return Math.abs(this.lat)<=Math.PI/2&&Math.abs(this.lng)<=Math.PI},e.normalized=function(){var n=this.lat;n>JL?n=JL:n<Jq&&(n=Jq);var r=pp(this.lng,2*Math.PI);return new i(n,r)},e.toString=function(){return"["+$q(this.lat)+", "+$q(this.lng)+"]"},e.distance=function(n){var r=Math.sin(.5*(n.lat-this.lat)),s=Math.sin(.5*(n.lng-this.lng)),o=r*r+s*s*Math.cos(this.lat)*Math.cos(n.lat);return 2*Math.atan2(Math.sqrt(o),Math.sqrt(Math.max(0,1-o)))},e.approxEqual=function(n){return Yq(this.lat,n.lat)&&Yq(this.lng,n.lng)},i})(),Ohe=function(e,t){return new We(e[0][t],e[1][t],e[2][t])},VL=function(e,t,n){return e[0][t]=n.x,e[1][t]=n.y,e[2][t]=n.z,e},LH=function(e,t){return new We(e[0][0]*t.x+e[0][1]*t.y+e[0][2]*t.z,e[1][0]*t.x+e[1][1]*t.y+e[1][2]*t.z,e[2][0]*t.x+e[2][1]*t.y+e[2][2]*t.z)},Uhe=function(e){return[[e[0][0],e[1][0],e[2][0]],[e[0][1],e[1][1],e[2][1]],[e[0][2],e[1][2],e[2][2]]]},gD=function(e){var t=[[0,0,0],[0,0,0],[0,0,0]];return VL(t,2,e),VL(t,1,We.ortho(e)),VL(t,0,We.fromVector(Ohe(t,1).vector.cross(e.vector))),t},khe=function(e,t){return LH(Uhe(e),t)},zhe=function(e,t){return LH(e,t)},RT=-1,Zf=0,U1=1,DH=1e-15,Ki=2220446049250313e-31,eH=1.8274*Ki,Vhe=3.2321*Ki,eD=function(e,t,n){return n.vector.cross(e.vector).dot(t.vector)>0},Xm=function(e,t,n){var r=tD(e,t,n);return r===Zf&&(r=nD(e,t,n)),r},Ghe=function(e,t,n){var r=t.vector.sub(e.vector),s=r.norm2(),o=n.vector.sub(t.vector),a=o.norm2(),l=e.vector.sub(n.vector),c=l.norm2(),u,f,d;s>=a&&s>=c?(u=l,f=o,d=n.vector):a>=c?(u=r,f=l,d=e.vector):(u=o,f=r,d=t.vector);var A=-u.cross(f).dot(d),y=Vhe*Math.sqrt(u.norm2()*f.norm2());return A>y?U1:A<-y?RT:Zf},tD=function(e,t,n){var r=e.vector.cross(t.vector).dot(n.vector);return r>eH?U1:r<-eH?RT:Zf},nD=function(e,t,n){if(e.equals(t)||t.equals(n)||n.equals(e))return Zf;var r=Ghe(e,t,n);return r!==Zf?r:qhe(e,t,n,!0)},qhe=function(e,t,n,r){var s=U1,o=e,a=t,l=n;if(o.vector.cmp(a.vector)>0){var c=[a,o];o=c[0],a=c[1],s=-s}if(a.vector.cmp(l.vector)>0){var u=[l,a];a=u[0],l=u[1],s=-s}if(o.vector.cmp(a.vector)>0){var f=[a,o];o=f[0],a=f[1],s=-s}var d=zL.fromVector(o.vector),A=zL.fromVector(a.vector),y=zL.fromVector(l.vector),w=A.cross(y),S=d.dot(w),T=S.getSign();return T===Zf&&r&&(T=Hhe(d,A,y,w)),s*T},Hhe=function(e,t,n,r){var s=r.z.getSign();return s!==0||(s=r.y.getSign(),s!==0)||(s=r.x.getSign(),s!==0)||(s=n.x.mul(e.y).sub(n.y.mul(e.x)).getSign(),s!==0)||(s=n.x.getSign(),s!==0)||(s=-n.y.getSign(),s!==0)||(s=n.z.mul(e.x).sub(n.x.mul(e.z)).getSign(),s!==0)||(s=n.z.getSign(),s!==0)||(s=e.x.mul(t.y).sub(e.y.mul(t.x)).getSign(),s!==0)||(s=-t.x.getSign(),s!==0)||(s=t.y.getSign(),s!==0)||(s=e.x.getSign(),s!==0)?s:U1},We=(function(){function i(t,n,r){this.vector=new Wt(t,n,r)}i.fromVector=function(n){return new i(n.x,n.y,n.z)},i.fromLatLng=function(n){var r=n.lat,s=n.lng,o=Math.cos(r);return new i(Math.cos(s)*o,Math.sin(s)*o,Math.sin(r))},i.fromCoords=function(n,r,s){return n===0&&r===0&&s===0?this.originPoint():i.fromVector(new Wt(n,r,s).normalize())},i.originPoint=function(){return new i(-.00999946643502502,.002592454260932412,.999946643502502)};var e=i.prototype;return e.pointCross=function(n){var r=this.vector.add(n.vector).cross(n.vector.sub(this.vector));return r.x===0&&r.y===0&&r.z===0&&(r=this.vector.ortho()),i.fromVector(r)},i.orderedCCW=function(n,r,s,o){var a=0;return Xm(r,o,n)!==RT&&a++,Xm(s,o,r)!==RT&&a++,Xm(n,o,s)===U1&&a++,a>=2},e.distance=function(n){return this.vector.angle(n.vector)},e.equals=function(n){return this.vector.equals(n.vector)},e.approxEqual=function(n,r){return r===void 0&&(r=DH),this.vector.angle(n.vector)<=r},e.stableAngle=function(n){return 2*Math.atan2(this.vector.sub(n.vector).norm(),this.vector.add(n.vector).norm())},i.chordAngleBetweenPoints=function(n,r){return Math.min(4,n.vector.sub(r.vector).norm2())},i.regularPoints=function(n,r,s){return this.regularPointsForFrame(gD(n),r,s)},i.regularPointsForFrame=function(n,r,s){for(var o=Math.cos(r),a=Math.sin(r),l=2*Math.PI/s,c=[],u=0;u<s;u++){var f=u*l,d=new i(a*Math.cos(f),a*Math.sin(f),o);c.push(i.fromVector(zhe(n,d).vector.normalize()))}return c},e.containsCell=function(n){return!1},e.intersectsCell=function(n){return n.containsPoint(this)},e.containsPoint=function(n){return this.contains(n)},e.cellUnionBound=function(){return[z1(this)]},e.contains=function(n){return this.equals(n)},e.referenceDir=function(){return i.ortho(this)},e.toString=function(){return this.vector.toString()},i.ortho=function(n){var r=n.vector.largestComponent(),s=new Wt(.012,.0053,.00457);return r===Wt.X_AXIS?s.z=1:r===Wt.Y_AXIS?s.x=1:s.y=1,i.fromVector(n.vector.cross(s).normalize())},i.sortPoints=function(n){n.sort(function(r,s){return r.vector.cmp(s.vector)})},_he(i,[{key:"x",get:function(){return this.vector.x}},{key:"y",get:function(){return this.vector.y}},{key:"z",get:function(){return this.vector.z}}])})(),IT=function(e,t,n){return e<t?t:e>n?n:e},Whe=function(e){for(var t=e,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];for(var o=0,a=r;o<a.length;o++){var l=a[o];l>t&&(t=l)}return t},jhe=function(e){for(var t=e,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];for(var o=0,a=r;o<a.length;o++){var l=a[o];l<t&&(t=l)}return t},Xhe=function(e){return e<0n?-e:e},iD=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Whe.apply(void 0,[e].concat(n))},GL=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return jhe.apply(void 0,[e].concat(n))},rD=function(e,t){for(var n=0,r=e;n<r;){var s=Math.floor((n+r)/2);t(s)?r=s:n=s+1}return n},fl=(1n<<64n)-1n,pu=function(e){return Number(e>>BigInt(py))},$he=function(e){return e&fl>>BigInt(Phe)},no=function(e){return _i-(She(e)>>>1)},Tr=function(e,t){var n=Zm(t);return e&-n|n},vD=function(e){var t=ls(e)<<2n;return e&-t|t},my=function(e){return(e&Zm(0)-1n)===0n},uy=function(e){return typeof e!="bigint"||BigInt.asUintN(64,e)!=e?!1:pu(e)<=IH&&(ls(e)&0x1555555555555555n)!=0n},_D=function(e){return(e&1n)!=0n},NH=function(e,t){return Number(e>>2n*BigInt(_i-t)+1n)&3},ls=function(e){return e&-e},Zm=function(e){return 1n<<BigInt(2*(_i-e))},k1=function(e){var t=[e,e,e,e],n=ls(e);return t[0]=e-n+(n>>2n),n>>=1n,t[1]=t[0]+n,t[2]=t[1]+n,t[3]=t[2]+n,t},FH=function(e,t){var n=[],r=Sp(e),s=r.f,o=r.i,a=r.j,l=Ra(no(e));o&=-l,a&=-l;for(var c=Ra(t),u=-c;;u+=c){var f=void 0;if(u<0?f=a+u>=0:u>=l?f=a+u<hl:(f=!0,n.push(Tr(gp(s,o+u,a-c,a-l>=0),t)),n.push(Tr(gp(s,o+u,a+l,a+l<hl),t))),n.push(Tr(gp(s,o-c,a+u,f&&o-l>=0),t)),n.push(Tr(gp(s,o+l,a+u,f&&o+l<hl),t)),u>=l)break}return n},qi=function(e){return e-(ls(e)-1n)},Gi=function(e){return e+(ls(e)-1n)},$m=function(e,t){return qi(e)<=t&&t<=Gi(e)},BH=function(e,t){return qi(t)<=Gi(e)&&Gi(t)>=qi(e)},Yhe=function(e){var t=e.toString(16).padStart(16,"0").replace(/0+$/,"");return t.length===0?"X":t},Zhe=function(e){if(e.length>16||!/^[A-F0-9]+$/i.test(e))return 0n;var t=BigInt("0x"+e);return e.length<16&&(t=t<<BigInt(4*(16-e.length))),t},Khe=function(e){if(!uy(e))return"Invalid: "+e.toString(16);for(var t=pu(e)+"/",n=1;n<=no(e);n++)t+=NH(e,n);return t},Qhe=function(e){var t=e.length-2;if(t<0||t>_i)return 0n;var n=parseInt(e[0],10);if(isNaN(n)||n<0||n>5||e[1]!=="/")return 0n;for(var r=yp(n),s=2;s<e.length;s++){var o=parseInt(e[s],10);if(isNaN(o)||o<0||o>3)return 0n;r=k1(r)[o]}return r},Jhe=function(e,t,n){return Tr((BigInt(e)<<BigInt(py))+(t||1n),n)},yp=function(e){return(BigInt(e)<<BigInt(py))+Zm(0)},z1=function(e){var t=MT(e.vector),n=t[0],r=t[1],s=t[2],o=Vl(ch(r)),a=Vl(ch(s));return Ay(n,o,a)},OH=function(e){return z1(We.fromLatLng(e))},Vl=function(e){return IT(Math.floor(hl*e),0,hl-1)},Ra=function(e){return 1<<IT(_i-e,0,_i)},UH=function(e){return R1(Ra(e))},R1=function(e){return e/hl},kH=function(e){var t=xD(e),n=t.si,r=t.ti;return new Ci(Cc(Ap(n)),Cc(Ap(r)))},efe=function(e){var t=Sp(e),n=t.i,r=t.j;return BT(n,r,no(e))},Ay=function(e,t,n){for(var r=BigInt(e)<<BigInt(py-1),s=e&Ic,o=7;o>=0;o--){var a=(1<<ul)-1;s+=(t>>o*ul&a)<<ul+2,s+=(n>>o*ul&a)<<2,s=RH[s],r|=BigInt(s>>2)<<BigInt(o*2*ul),s&=Ic|Kf}return r*2n+1n},I1=function(e,t,n){t=IT(t,-1,hl),n=IT(n,-1,hl);var r=1/hl,s=wH(1,2),o=Math.max(-s,Math.min(s,r*(Number(BigInt(t)<<1n)+1-hl))),a=Math.max(-s,Math.min(s,r*(Number(BigInt(n)<<1n)+1-hl))),l=MT(uh(e,o,a));return e=l[0],o=l[1],a=l[2],Ay(e,Vl(.5*(o+1)),Vl(.5*(a+1)))},gp=function(e,t,n,r){return r?Ay(e,t,n):I1(e,t,n)},Sp=function(e){for(var t=pu(e),n=t&Ic,r=_i-7*ul,s=0,o=0,a=7;a>=0;a--)n+=Number((e>>BigInt(a*2*ul+1)&(1n<<BigInt(2*r))-1n)<<2n),n=CH[n],s+=n>>ul+2<<a*ul,o+=(n>>2&(1<<ul)-1)<<a*ul,n&=Ic|Kf,r=ul;return(ls(e)&BigInt("0x1111111111111110"))!=0n&&(n^=Ic),{f:t,i:s,j:o,orientation:n}},xD=function(e){var t=Sp(e),n=t.f,r=t.i,s=t.j,o=0;return _D(e)?o=1:((BigInt(r)^e>>2n)&1n)!=0n&&(o=2),{face:n,si:2*r+o,ti:2*s+o}},BT=function(e,t,n){var r=Ra(n),s=e&-r,o=t&-r;return new Wr(new Li(Cc(R1(s)),Cc(R1(s+r))),new Li(Cc(R1(o)),Cc(R1(o+r))))},tfe=function(e){return e>>2n*BigInt(_i-no(e))+1n},gy=function(e){var t=xD(e),n=t.face,r=t.si,s=t.ti;return wT(n,r,s)},yD=function(e){return We.fromVector(gy(e).normalize())},nfe=function(e){return ar.fromPoint(We.fromVector(gy(e)))},ife=function(e){var t=no(e),n=Ra(t),r=Sp(e),s=r.f,o=r.i,a=r.j;return[Tr(I1(s,o,a-n),t),Tr(I1(s,o+n,a),t),Tr(I1(s,o,a+n),t),Tr(I1(s,o-n,a),t)]},zH=function(e,t){var n=Ra(t+1),r=n<<1,s=Sp(e),o=s.f,a=s.i,l=s.j,c=!1,u=!1,f=0,d=0;(a&n)!=0?(f=r,c=a+r<hl):(f=-r,c=a-r>=0),(l&n)!=0?(d=r,u=l+r<hl):(d=-r,u=l-r>=0);var A=[Tr(e,t),Tr(gp(o,a+f,l,c),t),Tr(gp(o,a,l+d,u),t)];return(c||u)&&A.push(Tr(gp(o,a+f,l+d,c&&u),t)),A},bD=function(e){var t=ls(e);return e-t+(t>>2n)},vy=function(e,t){return e-ls(e)+Zm(t)},VH=function(e){var t=ls(e);return e+t+(t>>2n)},OT=function(e,t){return e+ls(e)+Zm(t)},Pa=function(e){return e+(ls(e)<<1n)&fl},GH=function(e){return e-(ls(e)<<1n)&fl},rfe=function(e){var t=Pa(e);return t<vp?t:t-vp&fl},sfe=function(e){var t=GH(e);return t<vp?t:t+vp&fl},ofe=function(e,t){if(t===0n)return e;var n=BigInt(2*(_i-no(e))+1);if(t<0n){var r=-(e>>n);if(t<r){var s=vp>>n;t%=s,t<r&&(t+=s)}}else{var o=vp-e>>n;if(t>o){var a=vp>>n;t%=a,t>o&&(t-=a)}}return e+(t<<Xhe(n))},hy=function(e,t){var n=e^t;n<ls(e)&&(n=ls(e)),n<ls(t)&&(n=ls(t));var r=SH(n);return r>60?[0,!1]:[60-r>>1,!0]},sD=function(e,t){var n=qi(e);if(n>=qi(t))return t;if(Gi(e)>=t){for(;e=k1(e)[0],!(Gi(e)<t););return e}for(;!my(e);){var r=vD(e);if(qi(r)!==n||Gi(r)>=t)break;e=r}return e},afe=function(e,t){if(t===0n)return e;var n=BigInt(2*(_i-no(e))+1);if(t<0n){var r=-(e>>n);t<r&&(t=r)}else{var s=vp+ls(e)-e>>n;t>s&&(t=s)}return e+(t<<n)},oD=function(e,t){return e<t?-1:e>t?1:0},lfe=function(e,t){return e>t?-1:e<t?1:0},cfe={__proto__:null,SentinelCellID:fl,face:pu,pos:$he,level:no,parent:Tr,immediateParent:vD,isFace:my,valid:uy,isLeaf:_D,childPosition:NH,lsb:ls,lsbForLevel:Zm,children:k1,allNeighbors:FH,rangeMin:qi,rangeMax:Gi,contains:$m,intersects:BH,toToken:Yhe,fromToken:Zhe,toString:Khe,fromString:Qhe,fromFacePosLevel:Jhe,fromFace:yp,fromPoint:z1,fromLatLng:OH,stToIJ:Vl,sizeIJ:Ra,sizeST:UH,ijToSTMin:R1,centerUV:kH,boundUV:efe,fromFaceIJ:Ay,fromFaceIJWrap:I1,fromFaceIJSame:gp,faceIJOrientation:Sp,faceSiTi:xD,ijLevelToBoundUV:BT,distanceFromBegin:tfe,rawPoint:gy,point:yD,latLng:nfe,edgeNeighbors:ife,vertexNeighbors:zH,childBegin:bD,childBeginAtLevel:vy,childEnd:VH,childEndAtLevel:OT,next:Pa,prev:GH,nextWrap:rfe,prevWrap:sfe,advanceWrap:ofe,commonAncestorLevel:hy,maxTile:sD,advance:afe,ascending:oD,descending:lfe},ql=(function(){function i(t,n){var r=t.pointCross(n);this.a=t,this.b=n,this.aXb=We.fromVector(t.vector.cross(n.vector)),this.aTangent=We.fromVector(t.vector.cross(r.vector)),this.bTangent=We.fromVector(r.vector.cross(n.vector)),this.c=new We(0,0,0),this.acb=Rc}i.newChainEdgeCrosser=function(n,r,s){var o=new i(n,r);return o.restartAt(s),o};var e=i.prototype;return e.crossingSign=function(n,r){return n.equals(this.c)||this.restartAt(n),this.chainCrossingSign(r)},e.edgeOrVertexCrossing=function(n,r){return n.equals(this.c)||this.restartAt(n),this.edgeOrVertexChainCrossing(r)},e.restartAt=function(n){this.c=n,this.acb=-tD(this.a,this.b,this.c)},e.chainCrossingSign=function(n){var r=tD(this.a,this.b,n);return this.acb===-r&&r!==Zf?(this.c=n,this.acb=-r,Gl):this._crossingSign(n,r)},e.edgeOrVertexChainCrossing=function(n){var r=We.fromVector(this.c.vector);switch(this.chainCrossingSign(n)){case Gl:return!1;case Rc:return!0}return HH(this.a,this.b,r,n)},e._crossingSign=function(n,r){var s=(1.5+1/Math.sqrt(3))*Ki;if(this.c.vector.dot(this.aTangent.vector)>s&&n.vector.dot(this.aTangent.vector)>s||this.c.vector.dot(this.bTangent.vector)>s&&n.vector.dot(this.bTangent.vector)>s)return this.c=n,this.acb=-r,Gl;if(this.a.equals(this.c)||this.a.equals(n)||this.b.equals(this.c)||this.b.equals(n))return this.c=n,this.acb=-r,PT;if(this.a.equals(this.b)||this.c.equals(n))return this.c=n,this.acb=-r,Gl;if(this.acb===Zf&&(this.acb=-nD(this.a,this.b,this.c)),r===Zf&&(r=nD(this.a,this.b,n)),r!==this.acb)return this.c=n,this.acb=-r,Gl;var o=-Xm(this.c,n,this.b);if(o!==this.acb)return this.c=n,this.acb=-r,Gl;var a=Xm(this.c,n,this.a);return a!==this.acb?(this.c=n,this.acb=-r,Gl):(this.c=n,this.acb=-r,Rc)},i})(),Rc=0,PT=1,Gl=2,qH=function(e,t,n,r){var s=ql.newChainEdgeCrosser(e,t,n);return s.chainCrossingSign(r)},HH=function(e,t,n,r){if(e.equals(t)||n.equals(r))return!1;switch(!0){case e.equals(n):return t.equals(r)||We.orderedCCW(e.referenceDir(),r,t,e);case t.equals(r):return We.orderedCCW(t.referenceDir(),n,e,t);case e.equals(r):return t.equals(n)||We.orderedCCW(e.referenceDir(),n,t,e);case t.equals(n):return We.orderedCCW(t.referenceDir(),r,e,t)}return!1},ufe=function(e,t,n){return!We.orderedCCW(t.referenceDir(),n,e,t)},Ri=(function(){function i(t,n){this.lat=t,this.lng=n}i.emptyRect=function(){return new i(Li.empty(),to.emptyInterval())},i.fullRect=function(){return new i(i.validRectLatRange,i.validRectLngRange)},i.fromLatLng=function(n){return new i(new Li(Tc(n.lat),Tc(n.lat)),new to(Tc(n.lng),Tc(n.lng)))},i.fromCenterSize=function(n,r){var s=new ar(r.lat/2,r.lng/2);return i.fromLatLng(n).expanded(s)};var e=i.prototype;return e.equals=function(n){return this.lat.equals(n.lat)&&this.lng.equals(n.lng)},e.isValid=function(){return Math.abs(this.lat.lo)<=Math.PI/2&&Math.abs(this.lat.hi)<=Math.PI/2&&this.lng.isValid()&&this.lat.isEmpty()===this.lng.isEmpty()},e.isEmpty=function(){return this.lat.isEmpty()},e.isFull=function(){return this.lat.equals(i.validRectLatRange)&&this.lng.isFull()},e.isPoint=function(){return this.lat.lo===this.lat.hi&&this.lng.lo===this.lng.hi},e.vertex=function(n){var r,s;switch(n){case 0:r=this.lat.lo,s=this.lng.lo;break;case 1:r=this.lat.lo,s=this.lng.hi;break;case 2:r=this.lat.hi,s=this.lng.hi;break;default:r=this.lat.hi,s=this.lng.lo;break}return new ar(r,s)},e.lo=function(){return new ar(this.lat.lo,this.lng.lo)},e.hi=function(){return new ar(this.lat.hi,this.lng.hi)},e.center=function(){return new ar(this.lat.center(),this.lng.center())},e.size=function(){return new ar(this.lat.length(),this.lng.length())},e.area=function(){if(this.isEmpty())return 0;var n=Math.abs(Math.sin(this.lat.hi)-Math.sin(this.lat.lo));return this.lng.length()*n},e.addPoint=function(n){return n.isValid()?new i(this.lat.addPoint(Tc(n.lat)),this.lng.addPoint(Tc(n.lng))):this},e.expanded=function(n){var r=this.lat.expanded(Tc(n.lat)),s=this.lng.expanded(Tc(n.lng));return r.isEmpty()||s.isEmpty()?i.emptyRect():new i(r.intersection(i.validRectLatRange),s)},e.toString=function(){return"[Lo"+this.lo()+", Hi"+this.hi()+"]"},e.polarClosure=function(){return this.lat.lo===-Math.PI/2||this.lat.hi===Math.PI/2?new i(this.lat,to.fullInterval()):this},e.union=function(n){return new i(this.lat.union(n.lat),this.lng.union(n.lng))},e.intersection=function(n){var r=this.lat.intersection(n.lat),s=this.lng.intersection(n.lng);return r.isEmpty()||s.isEmpty()?i.emptyRect():new i(r,s)},e.intersects=function(n){return this.lat.intersects(n.lat)&&this.lng.intersects(n.lng)},e.capBound=function(){if(this.isEmpty())return xp.emptyCap();var n,r;this.lat.hi+this.lat.lo<0?(n=-1,r=Math.PI/2+this.lat.hi):(n=1,r=Math.PI/2-this.lat.lo);var s=xp.fromCenterAngle(new We(0,0,n),r);if(pp(this.lng.hi-this.lng.lo,2*Math.PI)>=0&&this.lng.hi-this.lng.lo<2*Math.PI){var o=xp.fromPoint(We.fromLatLng(this.center())).addPoint(We.fromLatLng(this.lo())).addPoint(We.fromLatLng(this.hi()));if(o.height()<s.height())return o}return s},e.rectBound=function(){return this},e.contains=function(n){return this.lat.containsInterval(n.lat)&&this.lng.containsInterval(n.lng)},e.containsCell=function(n){return this.contains(n.rectBound())},e.containsLatLng=function(n){return n.isValid()?this.lat.contains(Tc(n.lat))&&this.lng.contains(Tc(n.lng)):!1},e.containsPoint=function(n){return this.containsLatLng(ar.fromPoint(n))},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.approxEqual=function(n){return this.lat.approxEqual(n.lat)&&this.lng.approxEqual(n.lng)},i.bisectorIntersection=function(n,r){r=Math.abs(r);var s=n.center(),o=new ar(s-Math.PI/2,r);s<0&&(o=new ar(-s-Math.PI/2,r-Math.PI));var a=new We(0,-1,0);return a.pointCross(We.fromLatLng(o))},e.centroid=function(){if(this.isEmpty())return new We(0,0,0);var n=Math.sin(this.lat.lo),r=Math.sin(this.lat.hi),s=Math.cos(this.lat.lo),o=Math.cos(this.lat.hi),a=.5*this.lng.length(),l=Math.sin(a)*(o*r-s*n+this.lat.length()),c=this.lng.center(),u=a*(r+n)*(r-n);return new We(l*Math.cos(c),l*Math.sin(c),u)},e.intersectsCell=function(n){if(this.isEmpty())return!1;if(this.containsPoint(We.fromVector(gy(n.id)))||n.containsPoint(We.fromLatLng(this.center())))return!0;if(!this.intersects(n.rectBound()))return!1;for(var r=[],s=[],o=0;o<4;o++){var a=n.vertex(o);r.push(a);var l=ar.fromPoint(a);if(s.push(l),this.containsLatLng(l)||n.containsPoint(We.fromLatLng(this.vertex(o))))return!0}for(var c=0;c<4;c++){var u=to.fromEndpoints(s[c].lng,s[c+1&3].lng);if(this.lng.intersects(u)){var f=r[c],d=r[c+1&3];if(u.contains(this.lng.lo)&&nH(f,d,this.lat,this.lng.lo)||u.contains(this.lng.hi)&&nH(f,d,this.lat,this.lng.hi)||tH(f,d,this.lat.lo,this.lng)||tH(f,d,this.lat.hi,this.lng))return!0}}return!1},i})();Ri.validRectLatRange=new Li(-Math.PI/2,Math.PI/2);Ri.validRectLngRange=to.fullInterval();var tH=function(e,t,n,r){var s=e.vector.cross(t.vector).normalize();s.z<0&&(s=s.mul(-1));var o=s.cross(We.fromCoords(0,0,1).vector).normalize(),a=o.cross(s),l=Math.sin(Tc(n));if(Math.abs(l)>=a.z)return!1;var c=l/a.z,u=Math.sqrt(1-c*c),f=Math.atan2(u,c),d=to.fromPointPair(Math.atan2(e.vector.dot(o),e.vector.dot(a)),Math.atan2(t.vector.dot(o),t.vector.dot(a)));if(d.contains(f)){var A=a.mul(c).add(o.mul(u));if(r.contains(Math.atan2(A.y,A.x)))return!0}if(d.contains(-f)){var y=a.mul(c).sub(o.mul(u));if(r.contains(Math.atan2(y.y,y.x)))return!0}return!1},nH=function(e,t,n,r){return qH(e,t,We.fromLatLng(new ar(n.lo,r)),We.fromLatLng(new ar(n.hi,r)))===Rc},wD=(function(){function i(t,n){this.dim=t,this.deriv=n}var e=i.prototype;return e.value=function(n){return KL(this.deriv,-this.dim*n)},e.minLevel=function(n){if(n<=0)return _i;var r=-(Xq(n/this.deriv)>>this.dim-1);return r>_i&&(r=_i),r<0&&(r=0),r||0},e.maxLevel=function(n){if(n<=0)return _i;var r=Xq(this.deriv/n)>>this.dim-1;return r>_i&&(r=_i),r<0&&(r=0),r||0},e.closestLevel=function(n){var r=Math.SQRT2;return this.dim===2&&(r=2),this.minLevel(r*n)},i})(),aD=new wD(1,2*Math.SQRT2/3),hfe=new wD(1,1.4592137463861061),lD=new wD(2,4*Math.PI/6),ffe=function(e,t,n){return ET(SD(e,t,n,0,!0).dist)},mu=function(e,t,n,r){return SD(e,t,n,r,!1)},iH=function(e,t,n,r){var s=iD(We.chordAngleBetweenPoints(e,t),We.chordAngleBetweenPoints(e,n));if(s>D1){var o=SD(We.fromVector(e.vector.mul(-1)),t,n,s,!0);s=o.dist,s=Mc-s}return r<s?{dist:s,less:!0}:{dist:r,less:!1}},WH=function(e,t,n){var r=t.pointCross(n),s=e.vector.sub(r.vector.mul(e.vector.dot(r.vector)/r.vector.norm2()));return eD(r,t,We.fromVector(s))&&eD(We.fromVector(s),n,r)?We.fromVector(s.normalize()):e.vector.sub(t.vector).norm2()<=e.vector.sub(n.vector).norm2()?t:n},jH=function(e,t,n){var r=e,s=t.pointCross(n),o=s.vector.cross(t.vector);return We.fromVector(t.vector.mul(Math.cos(r)).add(o.mul(Math.sin(r)/o.norm())).normalize())},dfe=function(e){return Math.max(pfe(e),mD(e))},pfe=function(e){if(e>=D1)return 0;var t=Math.min(1,.5*e),n=Math.sqrt(t*(2-t));return((2.5+2*Math.sqrt(3)+8.5*n)*n+(2+2*Math.sqrt(3)/3+6.5*(1-t))*t+(23+16/Math.sqrt(3))*Ki)*Ki},SD=function(e,t,n,r,s){var o=mfe(e,t,n,r,s),a=o.dist,l=o.less;if(l)return{dist:a,less:!0};var c=e.vector.sub(t.vector).norm2(),u=e.vector.sub(n.vector).norm2(),f=Math.min(c,u);return!s&&f>=r?{dist:r,less:!1}:{dist:f,less:!0}},mfe=function(e,t,n,r,s){var o=e.vector.sub(t.vector).norm2(),a=e.vector.sub(n.vector).norm2(),l=t.vector.sub(n.vector).norm2(),c=4.75*Ki*(o+a+l)+8*Ki*Ki;if(Math.abs(o-a)>=l+c)return{dist:r,less:!1};var u=t.pointCross(n),f=u.vector.norm2(),d=e.vector.dot(u.vector),A=d*d;if(!s&&A>f*r)return{dist:r,less:!1};var y=u.vector.cross(e.vector);if(t.vector.sub(e.vector).dot(y)>=0||n.vector.sub(e.vector).dot(y)<=0)return{dist:r,less:!1};var w=1-Math.sqrt(y.norm2()/f),S=A/f+w*w;return!s&&S>=r?{dist:r,less:!1}:{dist:S,less:!0}},rH=We.fromCoords(1,0,0),xp=(function(){function i(t,n){this.center=t,this.rad=n}i.fromPoint=function(n){return i.fromCenterChordAngle(n,0)},i.fromCenterAngle=function(n,r){return i.fromCenterChordAngle(n,bT(r))},i.fromCenterChordAngle=function(n,r){return new i(n,r)},i.fromCenterHeight=function(n,r){return i.fromCenterChordAngle(n,QL(2*r))},i.fromCenterArea=function(n,r){return i.fromCenterChordAngle(n,QL(r/Math.PI))},i.fromCap=function(n){return new i(We.fromVector(n.center.vector),n.rad)},i.emptyCap=function(){return i.fromCenterChordAngle(rH,TT)},i.fullCap=function(){return i.fromCenterChordAngle(rH,Mc)};var e=i.prototype;return e.isValid=function(){return this.center.vector.isUnit()&&this.rad<=Mc},e.isEmpty=function(){return this.rad<0},e.isFull=function(){return this.rad==Mc},e.centerPoint=function(){return this.center},e.height=function(){return .5*this.rad},e.radius=function(){return ET(this.rad)},e.area=function(){return 2*Math.PI*Math.max(0,this.height())},e.contains=function(n){return this.isFull()||n.isEmpty()?!0:this.rad>=ny(We.chordAngleBetweenPoints(this.center,n.center),n.rad)},e.intersects=function(n){return this.isEmpty()||n.isEmpty()?!1:ny(this.rad,n.rad)>=We.chordAngleBetweenPoints(this.center,n.center)},e.interiorIntersects=function(n){return this.rad<=0||n.isEmpty()?!1:ny(this.rad,n.rad)>We.chordAngleBetweenPoints(this.center,n.center)},e.intersectsCell=function(n){for(var r=[],s=0;s<4;s++)if(r[s]=n.vertex(s),this.containsPoint(r[s]))return!0;return this._intersects(n,r)},e._intersects=function(n,r){if(this.rad>=D1||this.isEmpty())return!1;if(n.containsPoint(this.center))return!0;for(var s=MH(this.rad),o=0;o<4;o++){var a=n.edge(o).vector,l=this.center.vector.dot(a);if(!(l>0)){if(l*l>s*a.norm2())return!1;var c=a.cross(this.center.vector);if(c.dot(r[o].vector)<0&&c.dot(r[o+1&3].vector)>0)return!0}}return!1},e.containsPoint=function(n){return We.chordAngleBetweenPoints(this.center,n)<=this.rad},e.containsCell=function(n){for(var r=[],s=0;s<4;s++)if(r[s]=n.vertex(s),!this.containsPoint(r[s]))return!1;return!this.complement()._intersects(n,r)},e.interiorContainsPoint=function(n){return this.isFull()||We.chordAngleBetweenPoints(this.center,n)<this.rad},e.complement=function(){return this.isFull()?i.emptyCap():this.isEmpty()?i.fullCap():i.fromCenterChordAngle(We.fromVector(this.center.vector.mul(-1)),Che(Mc,this.rad))},e.capBound=function(){return this},e.rectBound=function(){if(this.isEmpty())return Ri.emptyRect();var n=this.radius(),r=!1,s=new Li(ar.latitude(this.center)-n,ar.latitude(this.center)+n),o=to.fullInterval();if(s.lo<=-Math.PI/2&&(s.lo=-Math.PI/2,r=!0),s.hi>=Math.PI/2&&(s.hi=Math.PI/2,r=!0),!r){var a=Rhe(this.rad),l=Math.cos(ar.latitude(this.center));if(a<=l){var c=Math.asin(a/l);o.lo=pp(ar.longitude(this.center)-c,Math.PI*2),o.hi=pp(ar.longitude(this.center)+c,Math.PI*2)}}return new Ri(s,o)},e.equals=function(n){return this.rad===n.rad&&this.center.equals(n.center)||this.isEmpty()&&n.isEmpty()||this.isFull()&&n.isFull()},e.approxEqual=function(n){var r=1e-14,s=this.rad,o=n.rad;return this.center.approxEqual(n.center)&&Math.abs(s-o)<=r||this.isEmpty()&&o<=r||n.isEmpty()&&s<=r||this.isFull()&&o>=2-r||n.isFull()&&s>=2-r},e.addPoint=function(n){if(this.isEmpty())return new i(n,0);var r=We.chordAngleBetweenPoints(this.center,n);return r>this.rad&&(this.rad=r),this},e.addCap=function(n){if(this.isEmpty())return n;if(n.isEmpty())return this;var r=ny(We.chordAngleBetweenPoints(this.center,n.center),n.rad),s=FT(r,Ki*r);return s>this.rad&&(this.rad=s),this},e.expanded=function(n){return this.isEmpty()?i.emptyCap():i.fromCenterChordAngle(this.center,ny(this.rad,bT(n)))},e.toString=function(){return"[Center="+this.center.vector+", Radius="+TH(this.radius())+"]"},i.radiusToHeight=function(n){return n<0?TT:n>=Math.PI?D1:.5*bT(n)},e.cellUnionBound=function(){var n=aD.maxLevel(this.radius())-1;if(n<0){for(var r=[],s=0;s<6;s++)r[s]=yp(s);return r}return zH(z1(this.center),n)},e.centroid=function(){if(this.isEmpty())return new We(0,0,0);var n=1-.5*this.height();return We.fromVector(this.center.vector.mul(n*this.area()))},e.union=function(n){var r=this;if(r.rad<n.rad){var s=[n,r];r=s[0],n=s[1]}if(r.isFull()||n.isEmpty())return r;var o=r.radius(),a=n.radius(),l=r.center.distance(n.center);if(o>=l+a)return r;var c=.5*(l+o+a),u=jH(.5*(l-o+a),r.center,n.center);return i.fromCenterAngle(u,c)},i})(),cD=function(e,t,n){var r=t.stableAngle(n),s=n.stableAngle(e),o=e.stableAngle(t),a=.5*(r+s+o);if(a>=3e-4){var l=a-Math.max(r,s,o);if(l<.01*a*a*a*a*a){var c=Afe(e,t,n);if(l<a*.1*(c+5e-15))return c}}return 4*Math.atan(Math.sqrt(Math.max(0,Math.tan(.5*a)*Math.tan(.5*(a-r))*Math.tan(.5*(a-s))*Math.tan(.5*(a-o)))))},Afe=function(e,t,n){var r=e.pointCross(t),s=t.pointCross(n),o=e.pointCross(n),a=r.vector.angle(o.vector)-r.vector.angle(s.vector)+s.vector.angle(o.vector);return a<0&&(a=0),a},gfe=function(e,t,n){return Xm(e,t,n)*cD(e,t,n)},sH=function(e,t,n){var r=e.pointCross(t).vector.angle(t.pointCross(n).vector);return Xm(e,t,n)===U1?r:-r},oH=Math.asin(Math.sqrt(1/3))-.5*Ki,Ia=(function(){function i(t,n,r,s,o){this.face=t,this.level=n,this.orientation=r,this.id=s,this.uv=o}i.fromCellID=function(n){var r=Sp(n),s=r.f,o=r.i,a=r.j,l=r.orientation,c=no(n);return new i(s,c,l,n,BT(o,a,c))},i.fromPoint=function(n){return i.fromCellID(z1(n))},i.fromLatLng=function(n){return i.fromCellID(OH(n))},i.oppositeFace=function(n){return(n+3)%6};var e=i.prototype;return e.isLeaf=function(){return this.level===_i},e.sizeIJ=function(){return Ra(this.level)},e.sizeST=function(){return UH(this.level)},e.vertex=function(n){var r=this.uv.vertices()[n];return We.fromVector(uh(this.face,r.x,r.y).normalize())},e.edge=function(n){switch(n){case 0:return We.fromVector(Qq(this.face,this.uv.y.lo).normalize());case 1:return We.fromVector(Kq(this.face,this.uv.x.hi).normalize());case 2:return We.fromVector(Qq(this.face,this.uv.y.hi).mul(-1).normalize());default:return We.fromVector(Kq(this.face,this.uv.x.lo).mul(-1).normalize())}},e.boundUV=function(){return this.uv},e.center=function(){return We.fromVector(gy(this.id).normalize())},e.children=function(){var n=[];if(_D(this.id))return n;for(var r=kH(this.id),s=bD(this.id),o=0;o<4;o++){var a=new i(this.face,this.level+1,this.orientation^C1[o],s,Wr.empty()),l=AD[this.orientation][o],c=l>>1,u=l&1;c===1?(a.uv.x.hi=this.uv.x.hi,a.uv.x.lo=r.x):(a.uv.x.lo=this.uv.x.lo,a.uv.x.hi=r.x),u===1?(a.uv.y.hi=this.uv.y.hi,a.uv.y.lo=r.y):(a.uv.y.lo=this.uv.y.lo,a.uv.y.hi=r.y),s=Pa(s),n.push(a)}return n},e.exactArea=function(){var n=this.vertex(0),r=this.vertex(1),s=this.vertex(2),o=this.vertex(3);return cD(n,r,s)+cD(n,s,o)},e.approxArea=function(){if(this.level<2)return this.averageArea();var n=.5*this.vertex(2).vector.sub(this.vertex(0).vector).cross(this.vertex(3).vector.sub(this.vertex(1).vector)).norm();return n*2/(1+Math.sqrt(1-Math.min(1/Math.PI*n,1)))},e.averageArea=function(){return lD.value(this.level)},e.intersectsCell=function(n){return BH(this.id,n.id)},e.containsCell=function(n){return $m(this.id,n.id)},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.latitude=function(n,r){var s,o;switch(!0){case(n===0&&r===0):s=this.uv.x.lo,o=this.uv.y.lo;break;case(n===0&&r===1):s=this.uv.x.lo,o=this.uv.y.hi;break;case(n===1&&r===0):s=this.uv.x.hi,o=this.uv.y.lo;break;case(n===1&&r===1):s=this.uv.x.hi,o=this.uv.y.hi;break;default:throw new Error("i and/or j is out of bounds")}return ar.latitude(We.fromVector(uh(this.face,s,o)))},e.longitude=function(n,r){var s,o;switch(!0){case(n===0&&r===0):s=this.uv.x.lo,o=this.uv.y.lo;break;case(n===0&&r===1):s=this.uv.x.lo,o=this.uv.y.hi;break;case(n===1&&r===0):s=this.uv.x.hi,o=this.uv.y.lo;break;case(n===1&&r===1):s=this.uv.x.hi,o=this.uv.y.hi;break;default:throw new Error("i and/or j is out of bounds")}return ar.longitude(We.fromVector(uh(this.face,s,o)))},e.rectBound=function(){if(this.level>0){var n=this.uv.x.lo+this.uv.x.hi,r=this.uv.y.lo+this.uv.y.hi,s,o;Fhe(this.face).z===0?s=n<0?1:0:s=n>0?1:0,Bhe(this.face).z===0?o=r<0?1:0:o=r>0?1:0;var a=Li.fromPoint(this.latitude(s,o)).addPoint(this.latitude(1-s,1-o)),l=to.emptyInterval().addPoint(this.longitude(s,1-o)).addPoint(this.longitude(1-s,o));return new Ri(a,l).expanded(new ar(2*Ki,2*Ki)).polarClosure()}var c;switch(this.face){case 0:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new to(-Math.PI/4,Math.PI/4));break;case 1:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new to(Math.PI/4,3*Math.PI/4));break;case 2:c=new Ri(new Li(oH,Math.PI/2),to.fullInterval());break;case 3:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new to(3*Math.PI/4,-3*Math.PI/4));break;case 4:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new to(-3*Math.PI/4,-Math.PI/4));break;default:c=new Ri(new Li(-Math.PI/2,-oH),to.fullInterval())}return c.expanded(new ar(Ki,0))},e.capBound=function(){for(var n=xp.fromPoint(We.fromVector(uh(this.face,this.uv.center().x,this.uv.center().y).normalize())),r=0;r<4;r++)n=n.addPoint(this.vertex(r));return n},e.containsPoint=function(n){var r=Lhe(this.face,n.vector),s=r[0],o=r[1],a=r[2];return a?this.uv.expandedByMargin(Ki).containsPoint(new Ci(s,o)):!1},e.vertexChordDist2=function(n,r,s){var o=this.uv.x.lo,a=this.uv.y.lo;return r&&(o=this.uv.x.hi),s&&(a=this.uv.y.hi),We.chordAngleBetweenPoints(n,We.fromCoords(o,a,1))},e.uEdgeIsClosest=function(n,r){var s=this.uv.x.lo,o=this.uv.x.hi,a=this.uv.y.lo;r&&(a=this.uv.y.hi);var l=new Wt(a*a+1,-s*a,-s),c=new Wt(a*a+1,-o*a,-o);return n.vector.dot(l)>0&&n.vector.dot(c)<0},e.vEdgeIsClosest=function(n,r){var s=this.uv.y.lo,o=this.uv.y.hi,a=this.uv.x.lo;r&&(a=this.uv.x.hi);var l=new Wt(-a*s,a*a+1,-s),c=new Wt(-a*o,a*a+1,-o);return n.vector.dot(l)>0&&n.vector.dot(c)<0},i.edgeDistance=function(n,r){var s=n*n/(1+r*r),o=1-Math.sqrt(1-s);return QL(s+o*o)},e.distanceInternal=function(n,r){var s=We.fromVector(_p(this.face,n.vector)),o=s.x-s.z*this.uv.x.lo,a=s.x-s.z*this.uv.x.hi,l=s.y-s.z*this.uv.y.lo,c=s.y-s.z*this.uv.y.hi,u=!0;return o<0&&(u=!1,this.vEdgeIsClosest(s,!1))?i.edgeDistance(-o,this.uv.x.lo):a>0&&(u=!1,this.vEdgeIsClosest(s,!0))?i.edgeDistance(a,this.uv.x.hi):l<0&&(u=!1,this.uEdgeIsClosest(s,!1))?i.edgeDistance(-l,this.uv.y.lo):c>0&&(u=!1,this.uEdgeIsClosest(s,!0))?i.edgeDistance(c,this.uv.y.hi):u?r?0:GL(i.edgeDistance(-o,this.uv.x.lo),i.edgeDistance(a,this.uv.x.hi),i.edgeDistance(-l,this.uv.y.lo),i.edgeDistance(c,this.uv.y.hi)):GL(this.vertexChordDist2(s,!1,!1),this.vertexChordDist2(s,!0,!1),this.vertexChordDist2(s,!1,!0),this.vertexChordDist2(s,!0,!0))},e.distance=function(n){return this.distanceInternal(n,!0)},e.maxDistance=function(n){var r=We.fromVector(_p(this.face,n.vector)),s=iD(this.vertexChordDist2(r,!1,!1),this.vertexChordDist2(r,!0,!1),this.vertexChordDist2(r,!1,!0),this.vertexChordDist2(r,!0,!0));return s<=D1?s:Mc-this.distance(We.fromVector(n.vector.mul(-1)))},e.boundaryDistance=function(n){return this.distanceInternal(n,!1)},e.distanceToEdge=function(n,r){var s=GL(this.distance(n),this.distance(r));if(s===0)return s;for(var o=ql.newChainEdgeCrosser(n,r,this.vertex(3)),a=0;a<4;a++)if(o.chainCrossingSign(this.vertex(a))!==Gl)return 0;for(var l=0;l<4;l++)s=mu(this.vertex(l),n,r,s).dist;return s},e.maxDistanceToEdge=function(n,r){var s=iD(this.maxDistance(n),this.maxDistance(r));return s<=D1?s:Mc-this.distanceToEdge(We.fromVector(n.vector.mul(-1)),We.fromVector(r.vector.mul(-1)))},e.distanceToCell=function(n){if(this.face===n.face&&this.uv.intersects(n.uv))return 0;for(var r=[],s=[],o=0;o<4;o++)r.push(this.vertex(o)),s.push(n.vertex(o));for(var a=Pc(),l=0;l<4;l++)for(var c=0;c<4;c++)a=mu(r[l],s[c],s[c+1&3],a).dist,a=mu(s[l],r[c],r[c+1&3],a).dist;return a},e.maxDistanceToCell=function(n){var r=new Wr(n.uv.y,n.uv.x);if(this.face===i.oppositeFace(n.face)&&this.uv.intersects(r))return Mc;for(var s=[],o=[],a=0;a<4;a++)s.push(this.vertex(a)),o.push(n.vertex(a));for(var l=TT,c=0;c<4;c++)for(var u=0;u<4;u++)l=iH(s[c],o[u],o[u+1&3],l).dist,l=iH(o[c],s[u],s[u+1&3],l).dist;return l},i})(),M1=-1,XH=(function(){function i(t,n){n===void 0&&(n=!1),this.nonEmpty=n,this.rangeNodes=t.rangeNodes,this.pos=0}var e=i.prototype;return e.startID=function(){return this.rangeNodes[this.pos].startID},e.limitID=function(){return this.rangeNodes[this.pos+1].startID},e.isEmpty=function(){return this.rangeNodes[this.pos].contents===M1},e.begin=function(){for(this.pos=0;this.nonEmpty&&this.isEmpty()&&!this.done();)this.pos++},e.internalPrev=function(){return this.pos===0?!1:(this.pos--,!0)},e.nonEmptyPrev=function(){for(;this.internalPrev();)if(!this.isEmpty())return!0;return this.isEmpty()&&!this.done()&&this.next(),!1},e.prev=function(){return this.nonEmpty?this.nonEmptyPrev():this.internalPrev()},e.next=function(){for(this.pos++;this.nonEmpty&&this.isEmpty()&&!this.done();)this.pos++},e.advance=function(n){return n>=this.rangeNodes.length-1-this.pos?!1:(this.pos+=n,!0)},e.finish=function(){this.pos=this.rangeNodes.length-1},e.done=function(){return this.pos>=this.rangeNodes.length-1},e.seek=function(n){for(var r=0,s=this.rangeNodes.length;r<s;){var o=r+s>>>1;this.rangeNodes[o].startID>n?s=o:r=o+1}for(this.pos=Math.max(r-1,0);this.nonEmpty&&this.isEmpty()&&!this.done();)this.pos++},i})(),$H=(function(){function i(t){this.cellTree=t.cellTree,this.prevStartID=0n,this.nodeCutoff=-1,this.nextNodeCutoff=-1,this.node={cellID:0n,label:M1,parent:-1}}var e=i.prototype;return e.clear=function(){this.prevStartID=0n,this.nodeCutoff=-1,this.nextNodeCutoff=-1,this.node.label=M1},e.cellID=function(){return this.node.cellID},e.label=function(){return this.node.label},e.next=function(){this.node.parent<=this.nodeCutoff?(this.nodeCutoff=this.nextNodeCutoff,this.node.label=M1):this.node=ST({},this.cellTree[this.node.parent])},e.done=function(){return this.node.label===M1},e.startUnion=function(n){n.startID()<this.prevStartID&&(this.nodeCutoff=-1),this.prevStartID=n.startID();var r=n.rangeNodes[n.pos].contents;r<=this.nodeCutoff?this.node.label=M1:this.node=ST({},this.cellTree[r]),this.nextNodeCutoff=r},i})(),vfe=(function(){function i(){this.cellTree=[],this.rangeNodes=[]}var e=i.prototype;return e.add=function(n,r){if(r<0)throw new Error("labels must be non-negative");this.cellTree.push({cellID:n,label:r,parent:-1})},e.addCellUnion=function(n,r){if(r<0)throw new Error("labels must be non-negative");for(var s=Ct(n),o;!(o=s()).done;){var a=o.value;this.add(a,r)}},e.build=function(){for(var n=[],r=Ct(this.cellTree),s;!(s=r()).done;){var o=s.value;n.push({startID:qi(o.cellID),cellID:o.cellID,label:o.label}),n.push({startID:Pa(Gi(o.cellID)),cellID:fl,label:-1})}n.push({startID:vy(yp(0),_i),cellID:0n,label:-1}),n.push({startID:OT(yp(5),_i),cellID:0n,label:-1}),n.sort(function(u,f){return u.startID!==f.startID?u.startID<f.startID?-1:1:u.cellID!==f.cellID?u.cellID>f.cellID?-1:1:u.label<f.label?-1:u.label>f.label?1:0}),this.cellTree=[],this.rangeNodes=[];for(var a=-1,l=0;l<n.length;){for(var c=n[l].startID;l<n.length&&n[l].startID===c;)n[l].label>=0?(this.cellTree.push({cellID:n[l].cellID,label:n[l].label,parent:a}),a=this.cellTree.length-1):n[l].cellID===fl&&(a=this.cellTree[a].parent),l++;this.rangeNodes.push({startID:c,contents:a})}},i})(),F1=(function(i){function e(){return i.apply(this,arguments)||this}dy(e,i),e.fromRange=function(r,s){for(var o=new e,a=sD(r,s);a!==s;a=sD(Pa(a),s))o.push(a);return o},e.fromUnion=function(){for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];var a=ay(e,s.flat(1));return a.normalize(),a},e.fromIntersection=function(r,s){for(var o=new e,a=0,l=0;a<r.length&&l<s.length;){var c=qi(r[a]),u=qi(s[l]);c>u?r[a]<=Gi(s[l])?(o.push(r[a]),a++):(l=s.lowerBound(l+1,s.length,c),r[a]<=Gi(s[l-1])&&l--):u>c?s[l]<=Gi(r[a])?(o.push(s[l]),l++):(a=r.lowerBound(a+1,r.length,u),s[l]<=Gi(r[a-1])&&a--):r[a]<s[l]?(o.push(r[a]),a++):(o.push(s[l]),l++)}return o.normalize(),o},e.fromIntersectionWithCellID=function(r,s){var o=new e;if(r.containsCellID(s))return o.push(s),o.normalize(),o;for(var a=Gi(s),l=r.lowerBound(0,r.length,qi(s));l<r.length&&r[l]<=a;l++)o.push(r[l]);return o.normalize(),o},e.fromDifference=function(r,s){for(var o=new e,a=Ct(r),l;!(l=a()).done;){var c=l.value;o.cellUnionDifferenceInternal(c,s)}return o};var t=e.prototype;return t.isValid=function(){for(var r=0;r<this.length;r++){var s=this[r];if(!uy(s)||r>0&&Gi(this[r-1])>=qi(s))return!1}return!0},t.isNormalized=function(){for(var r=0;r<this.length;r++){var s=this[r];if(!uy(s)||r>0&&Gi(this[r-1])>=qi(s)||r>=3&&e.areSiblings(this[r-3],this[r-2],this[r-1],s))return!1}return!0},t.normalize=function(){this.sort(oD);for(var r=[],s=Ct(this),o;!(o=s()).done;){var a=o.value;if(!(r.length>0&&$m(r[r.length-1],a))){for(var l=r.length-1;l>=0&&$m(a,r[l]);)l--;for(r.length=l+1;r.length>=3&&e.areSiblings(r[r.length-3],r[r.length-2],r[r.length-1],a);)r.length-=3,a=vD(a);r.push(a)}}this.length=0,this.push.apply(this,r)},t.intersectsCellID=function(r){var s=this.lowerBound(0,this.length,r);return s!==this.length&&qi(this[s])<=Gi(r)?!0:s!==0&&Gi(this[s-1])>=qi(r)},t.containsCellID=function(r){var s=this.lowerBound(0,this.length,r);return s!==this.length&&qi(this[s])<=r?!0:s!==0&&Gi(this[s-1])>=r},t.denormalize=function(r,s){for(var o=new e,a=Ct(this),l;!(l=a()).done;){var c=l.value,u=no(c),f=u;if(f<r&&(f=r),s>1&&(f+=(_i-(f-r))%s,f>_i&&(f=_i)),f===u)o.push(c);else for(var d=OT(c,f),A=vy(c,f);A!==d;A=Pa(A))o.push(A)}this.length=0,this.push.apply(this,o)},t.rectBound=function(){for(var r=Ri.emptyRect(),s=Ct(this),o;!(o=s()).done;){var a=o.value;r=r.union(Ia.fromCellID(a).rectBound())}return r},t.capBound=function(){if(this.length===0)return xp.emptyCap();for(var r=new We(0,0,0),s=Ct(this),o;!(o=s()).done;){var a=o.value,l=lD.value(no(a));r=We.fromVector(r.vector.add(yD(a).vector.mul(l)))}r.equals(new We(0,0,0))?r=We.fromCoords(1,0,0):r=We.fromVector(r.vector.normalize());for(var c=xp.fromPoint(r),u=Ct(this),f;!(f=u()).done;){var d=f.value;c=c.addCap(Ia.fromCellID(d).capBound())}return c},t.containsCell=function(r){return this.containsCellID(r.id)},t.intersectsCell=function(r){return this.intersectsCellID(r.id)},t.containsPoint=function(r){return this.containsCell(Ia.fromPoint(r))},t.cellUnionBound=function(){return this.capBound().cellUnionBound()},t.leafCellsCovered=function(){for(var r=0n,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=1n<<BigInt(_i-no(a)<<1)}return r},e.areSiblings=function(r,s,o,a){if((r^s^o)!==a)return!1;var l=ls(a)<<1n;l=~(l+(l<<1n));var c=a&l;return(r&l)===c&&(s&l)===c&&(o&l)===c&&!my(a)},t.contains=function(r){for(var s=Ct(r),o;!(o=s()).done;){var a=o.value;if(!this.containsCellID(a))return!1}return!0},t.intersects=function(r){for(var s=Ct(this),o;!(o=s()).done;){var a=o.value;if(r.intersectsCellID(a))return!0}return!1},t.lowerBound=function(r,s,o){for(var a=r;a<s;a++)if(this[a]>=o)return a;return s},t.cellUnionDifferenceInternal=function(r,s){if(!s.intersectsCellID(r)){this.push(r);return}if(!s.containsCellID(r))for(var o=Ct(k1(r)),a;!(a=o()).done;){var l=a.value;this.cellUnionDifferenceInternal(l,s)}},t.expandAtLevel=function(r){for(var s=new e,o=Zm(r),a=this.length-1;a>=0;a--){var l=this[a];if(ls(l)<o)for(l=Tr(l,r);a>0&&$m(l,this[a-1]);)a--;s.push(l),s.push.apply(s,FH(l,r))}s.sort(oD),this.length=0,this.push.apply(this,s),this.normalize()},t.expandByRadius=function(r,s){for(var o=_i,a=Ct(this),l;!(l=a()).done;){var c=l.value;o=Math.min(o,no(c))}var u=aD.maxLevel(r);u===0&&r>aD.value(0)&&this.expandAtLevel(0),this.expandAtLevel(Math.min(o+s,u))},t.equals=function(r){if(this.length!==r.length)return!1;for(var s=0;s<this.length;s++)if(this[s]!==r[s])return!1;return!0},t.averageArea=function(){return lD.value(_i)*Number(this.leafCellsCovered())},t.approxArea=function(){for(var r=0,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=Ia.fromCellID(a).approxArea()}return r},t.exactArea=function(){for(var r=0,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=Ia.fromCellID(a).exactArea()}return r},e})(L1(Array)),hh=(function(){function i(t,n){this.v0=t,this.v1=n}var e=i.prototype;return e.cmp=function(n){var r=this.v0.vector.cmp(n.v0.vector);return r!==0?r:this.v1.vector.cmp(n.v1.vector)},e.equals=function(n){return this.v0.equals(n.v0)&&this.v1.equals(n.v1)},i})(),P1=function(e,t){this.start=e,this.length=t},UT=function(e,t){this.chainID=e,this.offset=t},_fe=function(e,t){this.point=e,this.contained=t},kT=function(e){return new _fe(We.originPoint(),e)},YH=0,xfe=1,yfe=2,bfe=function(e){return e.numEdges()===0&&(e.dimension()!==2||e.numChains()===0)},wfe=function(e){return e.numEdges()===0&&e.dimension()===2&&e.numChains()>0},ry=(function(){function i(){}var e=i.prototype;return e.numEdges=function(){return 0},e.edge=function(n){return new hh(We.originPoint(),We.originPoint())},e.referencePoint=function(){return kT(!1)},e.numChains=function(){return 0},e.chain=function(n){return new P1(0,0)},e.chainEdge=function(n,r){return new hh(We.originPoint(),We.originPoint())},e.chainPosition=function(n){return new UT(0,0)},e.dimension=function(){return-1},e.isEmpty=function(){return!0},e.isFull=function(){return!1},e.typeTag=function(){return YH},e.privateInterface=function(){},i})(),aH=(function(){function i(t,n){this.containsCenter=!1,this.shapeID=t,this.containsCenter=!1,this.edges=new Array(n)}var e=i.prototype;return e.numEdges=function(){return this.edges.length},e.containsEdge=function(n){for(var r=Ct(this.edges),s;!(s=r()).done;){var o=s.value;if(o===n)return!0}return!1},i})(),ZH=(function(){function i(){this.shapeID=0,this.containsCenter=!1,this.edges=[]}var e=i.prototype;return e.numEdges=function(){return 0},e.containsEdge=function(n){return!1},i})(),Sfe=(function(){function i(t){this.shapes=new Array(t)}var e=i.prototype;return e.numEdges=function(){for(var n=0,r=Ct(this.shapes),s;!(s=r()).done;){var o=s.value;n+=o.numEdges()}return n},e.add=function(n){this.shapes.push(n)},e.findByShapeID=function(n){for(var r=Ct(this.shapes),s;!(s=r()).done;){var o=s.value;if(o.shapeID===n)return o}return new ZH},i})(),qL=(function(){function i(){this.shapes=[]}var e=i.prototype;return e.numEdges=function(){return 0},e.add=function(n){},e.findByShapeID=function(n){return new ZH},i})(),uD=0,KH=0,HL=(function(){function i(t,n){if(this.index=t,this.position=0,this.id=fl,this.cell=new qL,n!==void 0)switch(n){case uD:this.begin();break;case KH:this.end();break;default:throw new Error("unknown ShapeIndexIteratorPos value")}}var e=i.prototype;return e.clone=function(){var n=new i(this.index);return n.position=this.position,n.id=this.id,n.cell=this.cell,n},e.cellID=function(){return this.id},e.indexCell=function(){return this.cell},e.center=function(){return yD(this.cellID())},e.begin=function(){this.index.isFresh()||this.index.maybeApplyUpdates(),this.position=0,this.refresh()},e.next=function(){this.position++,this.refresh()},e.prev=function(){return this.position<=0?!1:(this.position--,this.refresh(),!0)},e.end=function(){this.position=this.index.cells.length,this.refresh()},e.done=function(){return this.id===fl},e.refresh=function(){this.position<this.index.cells.length?(this.id=this.index.cells[this.position],this.cell=this.index.cellMap.get(this.cellID())||new qL):(this.id=fl,this.cell=new qL)},e.seek=function(n){var r=this;this.position=rD(this.index.cells.length,function(s){return r.index.cells[s]>=n}),this.refresh()},e.locatePoint=function(n){var r=z1(n);return this.seek(r),!!(!this.done()&&qi(this.cellID())<=r||this.prev()&&Gi(this.cellID())>=r)},e.locateCellID=function(n){if(this.seek(qi(n)),!this.done()){if(this.cellID()>=n&&qi(this.cellID())<=n)return wp;if(this.cellID()<=Gi(n))return xy}return this.prev()&&Gi(this.cellID())>=n?wp:zT},i})(),Tfe=(function(){function i(){this.isActive=!1,this.a=this.b=i.trackerOrigin(),this.nextCellID=vy(yp(0),_i),this.crosser=null,this.shapeIDs=[],this.savedIDs=[],this.drawTo(We.fromVector(uh(0,-1,-1).normalize()))}i.trackerOrigin=function(){return We.fromVector(uh(0,-1,-1).normalize())};var e=i.prototype;return e.focus=function(){return this.b},e.addShape=function(n,r){this.isActive=!0,r&&this.toggleShape(n)},e.moveTo=function(n){this.b=n},e.drawTo=function(n){this.a=this.b,this.b=n,this.crosser=new ql(this.a,this.b)},e.testEdge=function(n,r){var s;(s=this.crosser)!=null&&s.edgeOrVertexCrossing(r.v0,r.v1)&&this.toggleShape(n)},e.setNextCellID=function(n){this.nextCellID=qi(n)},e.atCellID=function(n){return qi(n)===this.nextCellID},e.toggleShape=function(n){if(this.shapeIDs.length===0){this.shapeIDs.push(n);return}if(this.shapeIDs[0]===n){this.shapeIDs.shift();return}for(var r=0;r<this.shapeIDs.length;r++){var s=this.shapeIDs[r];if(!(s<n)){if(s===n){this.shapeIDs.splice(r,1);return}this.shapeIDs.splice(r,0,n);return}}this.shapeIDs.push(n)},e.saveAndClearStateBefore=function(n){var r=this.lowerBound(n);this.savedIDs=this.shapeIDs.slice(0,r),this.shapeIDs=this.shapeIDs.slice(r)},e.restoreStateBefore=function(n){var r=this.lowerBound(n);this.shapeIDs=this.savedIDs.concat(this.shapeIDs.slice(r)),this.savedIDs=[]},e.lowerBound=function(n){for(var r=0;r<this.shapeIDs.length;r++)if(this.shapeIDs[r]>=n)return r;return this.shapeIDs.length},i})(),Qf=1,lH=2,bp=(function(){function i(t,n){this.index=t,this.model=n,this.iter=t.iterator()}var e=i.prototype;return e.contains=function(n){if(!this.iter.locatePoint(n))return!1;for(var r=this.iter.indexCell(),s=Ct(r.shapes),o;!(o=s()).done;){var a=o.value;if(this._shapeContains(a,this.iter.center(),n))return!0}return!1},e._shapeContains=function(n,r,s){var o=n.containsCenter,a=n.numEdges();if(a<=0)return o;var l=this.index.shape(n.shapeID);if(l.dimension()!==2){if(this.model!==lH)return!1;for(var c=Ct(n.edges),u;!(u=c()).done;){var f=u.value,d=l.edge(f);if(d.v0.equals(s)||d.v1.equals(s))return!0}return!1}for(var A=new ql(r,s),y=Ct(n.edges),w;!(w=y()).done;){var S=w.value,T=l.edge(S),R=A.crossingSign(T.v0,T.v1);if(R!==Gl){if(R===PT){if(this.model!==Qf&&(T.v0.equals(s)||T.v1.equals(s)))return this.model===lH;HH(A.a,A.b,T.v0,T.v1)?R=Rc:R=Gl}o=o!==(R===Rc)}}return o},e.shapeContains=function(n,r){if(!n||n instanceof ry||!this.iter.locatePoint(r))return!1;var s=this.iter.indexCell(),o=s.findByShapeID(this.index.idForShape(n));return o?this._shapeContains(o,this.iter.center(),r):!1},e.shapeVisitorFunc=function(n){return!0},e.visitContainingShapes=function(n,r){if(!this.iter.locatePoint(n))return!0;for(var s=this.iter.indexCell(),o=Ct(s.shapes),a;!(a=o()).done;){var l=a.value;if(this._shapeContains(l,this.iter.center(),n)&&!r(this.index.shape(l.shapeID)))return!1}return!0},e.containingShapes=function(n){var r=[];return this.visitContainingShapes(n,function(s){return r.push(s),!0}),r},i})(),Efe=(function(){function i(t,n){n===void 0&&(n=new bp(t,Qf)),this.index=t,this.containsQuery=n,this.iter=t.iterator()}var e=i.prototype;return e.capBound=function(){var n=ay(F1,this.cellUnionBound());return n.capBound()},e.rectBound=function(){var n=ay(F1,this.cellUnionBound());return n.rectBound()},e.cellUnionBound=function(){var n=[];if(this.iter.end(),!this.iter.prev())return n;var r=this.iter.cellID();if(this.iter.begin(),this.iter.cellID()!==r){var s=hy(this.iter.cellID(),r),o=s[0];o===void 0&&(o=-1),o++;for(var a=Tr(r,o),l=Tr(this.iter.cellID(),o);l!=a;l=Pa(l))if(!(Gi(l)<this.iter.cellID())){var c=this.iter.cellID();this.iter.seek(Pa(Gi(l))),this.iter.prev(),n.push.apply(n,this.coverRange(c,this.iter.cellID(),[])),this.iter.next()}}return this.coverRange(this.iter.cellID(),r,n)},e.coverRange=function(n,r,s){if(n==r)return s.concat([n]);var o=hy(n,r),a=o[0],l=o[1];return l||s.concat([0n]),s.concat([Tr(n,a)])},i})(),Mfe=2.25*Ki,Cfe=3*Ki,_y=9*(1/Math.SQRT2)*Ki,QH=3*Math.SQRT2*Ki,Rfe=function(e,t,n){return fy(e,t,n,0)},fy=function(e,t,n,r){if(cy(e.vector)===n&&cy(t.vector)===n){var s=Ym(n,e.vector),o=s[0],a=s[1],l=Ym(n,t.vector),c=l[0],u=l[1];return[new Ci(o,a),new Ci(c,u),!0]}var f=new Ec(_p(n,e.pointCross(t).vector)),d=new Ec(_p(n,e.vector)),A=new Ec(_p(n,t.vector)),y=1+r,w=new Ec(new We(y*f.x,y*f.y,f.z));if(!w.intersectsFace())return[null,null,!1];Math.max(Math.abs(f.x),Math.max(Math.abs(f.y),Math.abs(f.z)))<KL(1,-511)&&(f=new Ec(We.fromVector(f.vector.mul(KL(1,563)))));var S=new Ec(We.fromVector(f.vector.normalize())),T=new Ec(We.fromVector(S.vector.cross(d.vector))),R=new Ec(We.fromVector(A.vector.cross(S.vector))),P=cH(A,d,new Ec(We.fromVector(w.vector.mul(-1))),R,T,y),I=P[0],F=P[1],D=cH(d,A,w,T,R,y),L=D[0],C=D[1];return[I,L,F+C<3]},Ife=function(e,t,n){return e+t===n&&e===n-t&&t===n-e},WL=0,hD=1,Ec=(function(i){function e(n){return i.call(this,n.x,n.y,n.z)||this}dy(e,i);var t=e.prototype;return t.intersectsFace=function(){var r=Math.abs(this.x),s=Math.abs(this.y),o=Math.abs(this.z);return s>=o-r&&r>=o-s},t.intersectsOppositeEdges=function(){var r=Math.abs(this.x),s=Math.abs(this.y),o=Math.abs(this.z);return Math.abs(r-s)!==o?Math.abs(r-s)>=o:r>=s?r-o>=s:s-o>=r},t.exitAxis=function(){if(this.intersectsOppositeEdges())return Math.abs(this.x)>=Math.abs(this.y)?hD:WL;var r=0,s=0,o=0;return Math.sign(this.x)<0&&(r=1),Math.sign(this.y)<0&&(s=1),Math.sign(this.z)<0&&(o=1),(r^s^o)===0?hD:WL},t.exitPoint=function(r){if(r===WL){var s=this.y>0?1:-1;return new Ci(s,(-s*this.x-this.z)/this.y)}var o=this.x<0?1:-1;return new Ci((-o*this.y-this.z)/this.x,o)},e})(We),cH=function(e,t,n,r,s,o){var a=1-_y;if(t.z>0){var l=new Ci(t.x/t.z,t.y/t.z);if(Math.max(Math.abs(l.x),Math.abs(l.y))<=a)return[l,0]}var c=n.exitPoint(n.exitAxis()).mul(o),u=new Ec(new We(c.x,c.y,1)),f=0;return u.vector.sub(e.vector).dot(r.vector)<0?f=2:u.vector.sub(t.vector).dot(s.vector)<0&&(f=1),f>0&&(t.z<=0?f=3:c=new Ci(t.x/t.z,t.y/t.z)),[c,f]},uH=function(e,t,n){return t?e.lo>n?[e,!1]:(e.hi>n&&(e.hi=n),[e,!0]):e.hi<n?[e,!1]:(e.lo<n&&(e.lo=n),[e,!0])},hH=function(e,t,n,r,s,o,a,l){var c=!1;if(n.lo<l.lo){if(n.hi<l.lo)return[n,o,!1];n.lo=l.lo;var u=uH(o,a,B1(l.lo,e,t,r,s));if(o=u[0],c=u[1],!c)return[n,o,!1]}if(n.hi>l.hi){if(n.lo>l.hi)return[n,o,!1];n.hi=l.hi;var f=uH(o,!a,B1(l.hi,e,t,r,s));if(o=f[0],c=f[1],!c)return[n,o,!1]}return[n,o,!0]},JH=function(e,t,n){if(!n.intersects(Wr.fromPoints(e,t)))return!1;var r=t.sub(e).ortho(),s=r.x>=0?1:0,o=r.y>=0?1:0,a=r.dot(n.vertexIJ(s,o).sub(e)),l=r.dot(n.vertexIJ(1-s,1-o).sub(e));return a>=0&&l<=0},Pfe=function(e,t,n){var r=Wr.fromPoints(e,t),s=Lfe(e,t,n,r),o=s[0],a=s[1];return a?o:Wr.empty()},Lfe=function(e,t,n,r){var s=e.x>t.x!=e.y>t.y,o=hH(e.x,t.x,r.x,e.y,t.y,r.y,s,n.x),a=o[0],l=o[1],c=o[2];if(!c)return[r,!1];var u=hH(e.y,t.y,l,e.x,t.x,a,s,n.y),f=u[0],d=u[1],A=u[2];return A?[new Wr(d,f),!0]:[new Wr(a,l),!1]},B1=function(e,t,n,r,s){return Math.abs(t-e)<=Math.abs(n-e)?r+(s-r)*(e-t)/(n-t):s+(r-s)*(e-n)/(t-n)},Dfe=(function(){function i(t,n,r){this.face=t,this.a=n,this.b=r}var e=i.prototype;return e.clone=function(){return new i(this.face,new Ci(this.a.x,this.a.y),new Ci(this.b.x,this.b.y))},i})(),Nfe=function(e,t){var n=new Dfe(0,new Ci(0,0),new Ci(0,0)),r=MT(e.vector),s=r[0],o=r[1],a=r[2],l=MT(t.vector),c=l[0],u=l[1],f=l[2];if(n.a.x=o,n.a.y=a,n.b.x=u,n.b.y=f,s===c)return n.face=s,[n];var d=e.pointCross(t),A=fH(s,e,d,n.a),y=A[0],w=A[1],S=fH(c,t,We.fromVector(d.vector.mul(-1)),n.b),T=S[0],R=S[1];n.a=w,n.b=R;var P=[];n.face=y;for(var I=n.b,F=y;F!==T;){var D=_p(F,d.vector),L=new Ec(D),C=L.exitAxis();n.b=L.exitPoint(C),P.push(n.clone());var B=uh(F,n.b.x,n.b.y);F=Ffe(F,n.b,C,L,T);var k=_p(F,B);n.face=F,n.a=new Ci(k.x,k.y)}return n.b=I,P.push(n),P},fH=function(e,t,n,r){var s=1-_y;if(Math.max(Math.abs(r.x),Math.abs(r.y))<=s)return[e,r];var o=_p(e,n.vector),a=new Ec(o);if(a.intersectsFace()){var l=a.exitPoint(a.exitAxis()),c=uh(e,l.x,l.y),u=n.vector.normalize().cross(t.vector);if(c.sub(t.vector).dot(u)>=-Cfe)return[e,r]}var f=0;Math.abs(r.x)>=Math.abs(r.y)?(r.x>0&&(f=1),e=CT(e,0,f)):(r.y>0&&(f=1),e=CT(e,1,f));var d=Ym(e,t.vector);return r.x=d[0],r.y=d[1],r.x=Math.max(-1,Math.min(1,r.x)),r.y=Math.max(-1,Math.min(1,r.y)),[e,r]},Ffe=function(e,t,n,r,s){var o=t.x,a=t.y;n==hD&&(o=t.y,a=t.x);var l=0;o>0&&(l=1);var c=0;return a>0&&(c=1),Math.abs(a)===1&&CT(e,1-n,c)===s&&Ife(t.x*r.x,t.y*r.y,-r.z)?s:CT(e,n,l)},yT=1,dH=(function(){function i(t){this.rangeMin=fl,this.rangeMax=fl,this.it=t.iterator(),this.refresh()}var e=i.prototype;return e.cellID=function(){return this.it.cellID()},e.indexCell=function(){return this.it.indexCell()},e.next=function(){this.it.next(),this.refresh()},e.done=function(){return this.it.done()},e.seekTo=function(n){this.it.seek(n.rangeMin),(this.it.done()||qi(this.it.cellID())>n.rangeMax)&&this.it.prev()&&Gi(this.it.cellID())<n.cellID()&&this.it.next(),this.refresh()},e.seekBeyond=function(n){this.it.seek(Pa(n.rangeMax)),!this.it.done()&&qi(this.it.cellID())<=n.rangeMax&&this.it.next(),this.refresh()},e.refresh=function(){this.rangeMin=qi(this.cellID()),this.rangeMax=Gi(this.cellID())},i})(),Bfe=function(e,t){if(e.dimension()!==2)return!1;var n=e.referencePoint();if(n.point===t)return n.contained;for(var r=new ql(n.point,t),s=n.contained,o=0;o<e.numEdges();o++){var a=e.edge(o);s=s!==r.edgeOrVertexCrossing(a.v0,a.v1)}return s},Ca=(function(){function i(){this.id=0n,this.padding=0,this.boundRect=Wr.empty(),this.middleRect=Wr.empty(),this.iLo=0,this.jLo=0,this.orientation=0,this.level=0}i.fromCellID=function(n,r){var s=new i;if(s.id=n,s.padding=r,s.middleRect=Wr.empty(),my(n)){var o=r+1;return s.boundRect=new Wr(new Li(-o,o),new Li(-o,o)),s.middleRect=new Wr(new Li(-r,r),new Li(-r,r)),s.orientation=pu(n)&1,s}var a=Sp(n),l=a.i,c=a.j,u=a.orientation;s.iLo=l,s.jLo=c,s.orientation=u,s.level=no(n),s.boundRect=BT(l,c,s.level).expandedByMargin(r);var f=Ra(s.level);return s.iLo&=-f,s.jLo&=-f,s},i.fromParentIJ=function(n,r,s){var o=Ihe[n.orientation][2*r+s],a=new i;a.id=k1(n.id)[o],a.padding=n.padding,a.boundRect=Wr.fromRect(n.boundRect),a.orientation=n.orientation^C1[o],a.level=n.level+1,a.middleRect=Wr.empty();var l=Ra(a.level);a.iLo=n.iLo+r*l,a.jLo=n.jLo+s*l;var c=n.middle();return r===1?a.boundRect.x.lo=c.x.lo:a.boundRect.x.hi=c.x.hi,s===1?a.boundRect.y.lo=c.y.lo:a.boundRect.y.hi=c.y.hi,a};var e=i.prototype;return e.cellID=function(){return this.id},e.paddingValue=function(){return this.padding},e.levelValue=function(){return this.level},e.center=function(){var n=Ra(this.level),r=2*this.iLo+n,s=2*this.jLo+n;return We.fromVector(wT(pu(this.id),r,s).normalize())},e.middle=function(){if(this.middleRect.isEmpty()){var n=Ra(this.level),r=Cc(Ap(2*this.iLo+n)),s=Cc(Ap(2*this.jLo+n));this.middleRect=new Wr(new Li(r-this.padding,r+this.padding),new Li(s-this.padding,s+this.padding))}return this.middleRect},e.bound=function(){return this.boundRect},e.childIJ=function(n){var r=AD[this.orientation][n];return[r>>1,r&1]},e.entryVertex=function(){var n=this.iLo,r=this.jLo;if(this.orientation&Kf){var s=Ra(this.level);n+=s,r+=s}return We.fromVector(wT(pu(this.id),2*n,2*r).normalize())},e.exitVertex=function(){var n=this.iLo,r=this.jLo,s=Ra(this.level);return this.orientation===0||this.orientation===Ic+Kf?n+=s:r+=s,We.fromVector(wT(pu(this.id),2*n,2*r).normalize())},e.shrinkToFit=function(n){if(this.level===0&&(n.x.contains(0)||n.y.contains(0)))return this.id;var r=Ra(this.level);if(n.x.contains(Cc(Ap(2*this.iLo+r)))||n.y.contains(Cc(Ap(2*this.jLo+r))))return this.id;var s=n.expandedByMargin(this.padding+1.5*Ki),o=this.iLo,a=this.jLo,l=0,c=0;o<Vl(ch(s.x.lo))&&(o=Vl(ch(s.x.lo))),this.iLo+r-1<=Vl(ch(s.x.hi))?l=o^this.iLo+r-1:l=o^Vl(ch(s.x.hi)),a<Vl(ch(s.y.lo))&&(a=Vl(ch(s.y.lo))),this.jLo+r-1<=Vl(ch(s.y.hi))?c=a^this.jLo+r-1:c=a^Vl(ch(s.y.hi));var u=BigInt((l|c)<<1)+1n,f=_i-SH(u);return f<=this.level?this.id:Tr(Ay(pu(this.id),o,a),f)},i})(),wp=0,xy=1,zT=2,pH=0,iy=2,T1=2*(_y+Mfe),Ofe=1,mH=(function(){function i(t,n,r,s,o,a,l){t===void 0&&(t=0),n===void 0&&(n=0),r===void 0&&(r=0),s===void 0&&(s=!1),o===void 0&&(o=new Ci(0,0)),a===void 0&&(a=new Ci(0,0)),l===void 0&&(l=new hh(new We(0,0,0),new We(0,0,0))),this.shapeID=t,this.edgeID=n,this.maxLevel=r,this.hasInterior=s,this.a=o,this.b=a,this.edge=l}var e=i.prototype;return e.copy=function(){return new i(this.shapeID,this.edgeID,this.maxLevel,this.hasInterior,new Ci(this.a.x,this.a.y),new Ci(this.b.x,this.b.y),new hh(We.fromVector(this.edge.v0.vector),We.fromVector(this.edge.v1.vector)))},i})(),jL=function(e,t){this.faceEdge=e,this.bound=t},LT=(function(){function i(){var t=this;this.iterator=function(){return t.maybeApplyUpdates(),new HL(t,uD)},this.begin=function(){return t.maybeApplyUpdates(),new HL(t,uD)},this.end=function(){return t.maybeApplyUpdates(),new HL(t,KH)},this.region=function(){return new Efe(t,new bp(t,Qf))},this.len=function(){return t.shapes.size},this.reset=function(){t.shapes.clear(),t.nextID=0,t.cellMap.clear(),t.cells=[],t.status=iy},this.numEdges=function(){var n=0;return t.shapes.forEach(function(r){n+=r.numEdges()}),n},this.numEdgesUpTo=function(n){for(var r=0,s=0;s<=t.nextID;s++){var o=t.shape(s);if(!(o instanceof ry)&&(r+=o.numEdges(),r>=n))break}return r},this.shape=function(n){return t.shapes.get(n)||new ry},this.idForShape=function(n){for(var r=Ct(t.shapes.entries()),s;!(s=r()).done;){var o=s.value,a=o[0],l=o[1];if(l===n)return a}return-1},this.add=function(n){return t.shapes.set(t.nextID,n),t.nextID++,t.status=pH,t.nextID-1},this.remove=function(n){var r=t.idForShape(n);if(t.shapes.has(r)&&(t.shapes.delete(r),!(r>=t.pendingAdditionsPos))){for(var s=n.numEdges(),o=new Ufe(r,n.dimension()===2,n.referencePoint().contained,new Array(s)),a=0;a<s;a++)o.edges[a]=n.edge(a);t.pendingRemovals.push(o),t.status=pH}},this.build=function(){return t.maybeApplyUpdates()},this.isFresh=function(){return t.status===iy},this.isFirstUpdate=function(){return t.pendingAdditionsPos===0},this.isShapeBeingRemoved=function(n){return n<t.pendingAdditionsPos},this.maybeApplyUpdates=function(){t.status!==iy&&(t.applyUpdatesInternal(),t.status=iy)},this.applyUpdatesInternal=function(){for(var n=new Tfe,r=Array.from({length:6},function(){return[]}),s=Ct(t.pendingRemovals),o;!(o=s()).done;){var a=o.value;t.removeShapeInternal(a,r,n)}for(var l=t.pendingAdditionsPos;l<t.shapes.size;l++)t.addShapeInternal(l,r,n);for(var c=0;c<6;c++)t.updateFaceEdges(c,r[c],n);t.pendingRemovals.length=0,t.pendingAdditionsPos=t.shapes.size},this.addShapeInternal=function(n,r,s){var o=t.shapes.get(n)||new ry;if(!(o instanceof ry)){var a=new mH(n,void 0,void 0,o.dimension()===2);a.hasInterior&&s.addShape(n,Bfe(o,s.focus()));for(var l=o.numEdges(),c=0;c<l;c++){var u=o.edge(c);a.edgeID=c,a.edge=u,a.maxLevel=AH(u),t.addFaceEdge(a,r)}}},this.addFaceEdge=function(n,r){var s=n.copy(),o=cy(s.edge.v0.vector);if(o===cy(s.edge.v1.vector)){var a=Ym(o,s.edge.v0.vector),l=a[0],c=a[1];s.a=new Ci(l,c);var u=Ym(o,s.edge.v1.vector);l=u[0],c=u[1],s.b=new Ci(l,c);var f=1-T1;if(Math.abs(s.a.x)<=f&&Math.abs(s.a.y)<=f&&Math.abs(s.b.x)<=f&&Math.abs(s.b.y)<=f){r[o].push(s);return}}for(var d=0;d<6;d++){var A=fy(s.edge.v0,s.edge.v1,d,T1),y=A[0],w=A[1],S=A[2];if(S){var T=n.copy();T.a=y,T.b=w,r[d].push(T)}}},this.updateFaceEdges=function(n,r,s){var o=r.length;if(!(o===0&&s.shapeIDs.length===0)){for(var a=Array(o),l=Wr.empty(),c=0;c<o;c++){var u=new jL(r[c],Wr.fromPoints(r[c].a,r[c].b));a[c]=u,l=l.addRect(u.bound)}var f=yp(n),d=Ca.fromCellID(f,T1),A=t.isFirstUpdate();if(o>0){var y=t.shrinkToFit(d,l);if(y!==d.id){t.skipCellRange(qi(f),qi(y),s,A),d=Ca.fromCellID(y,T1),t.updateEdges(d,a,s,A),t.skipCellRange(Pa(Gi(y)),Pa(Gi(f)),s,A);return}}t.updateEdges(d,a,s,A)}},this.shrinkToFit=function(n,r){var s=n.shrinkToFit(r);if(!t.isFirstUpdate()&&s!==n.id){var o=t.iterator();o.locateCellID(s)===wp&&(s=o.cellID())}return s},this.skipCellRange=function(n,r,s,o){if(s.shapeIDs.length!==0)for(var a=F1.fromRange(n,r),l=Ct(a),c;!(c=l()).done;){var u=c.value,f=[];t.updateEdges(Ca.fromCellID(u,T1),f,s,o)}},this.updateEdges=function(n,r,s,o){var a=!1;if(!o){var l=t.iterator(),c=l.locateCellID(n.id);c===zT?o=!0:c===wp&&(t.absorbIndexCell(n,l,r,s),a=!0,o=!0)}if(!o||!t.makeIndexCell(n,r,s)){for(var u=[[[],[]],[[],[]]],f=n.middle(),d=Ct(r),A;!(A=d()).done;){var y=A.value;if(y.bound.x.hi<=f.x.lo){var w=t.clipVAxis(y,f.y),S=w[0],T=w[1];S&&u[0][0].push(S),T&&u[0][1].push(T)}else if(y.bound.x.lo>=f.x.hi){var R=t.clipVAxis(y,f.y),P=R[0],I=R[1];P&&u[1][0].push(P),I&&u[1][1].push(I)}else if(y.bound.y.hi<=f.y.lo){var F=t.clipUBound(y,1,f.x.hi);F&&u[0][0].push(F);var D=t.clipUBound(y,0,f.x.lo);D&&u[1][0].push(D)}else if(y.bound.y.lo>=f.y.hi){var L=t.clipUBound(y,1,f.x.hi);L&&u[0][1].push(L);var C=t.clipUBound(y,0,f.x.lo);C&&u[1][1].push(C)}else{var B=t.clipUBound(y,1,f.x.hi),k=t.clipVAxis(B,f.y),z=k[0],G=k[1];z&&u[0][0].push(z),G&&u[0][1].push(G);var W=t.clipUBound(y,0,f.x.lo),Y=t.clipVAxis(W,f.y);z=Y[0],G=Y[1],z&&u[1][0].push(z),G&&u[1][1].push(G)}}for(var H=0;H<4;H++){var $=n.childIJ(H),J=$[0],te=$[1];(u[J][te].length>0||s.shapeIDs.length>0)&&t.updateEdges(Ca.fromParentIJ(n,J,te),u[J][te],s,o)}}a&&s.restoreStateBefore(t.pendingAdditionsPos)},this.makeIndexCell=function(n,r,s){if(r.length===0&&s.shapeIDs.length===0)return!0;for(var o=0,a=Ct(r),l;!(l=a()).done;){var c=l.value;if(n.level<c.faceEdge.maxLevel&&o++,o>t.maxEdgesPerCell)return!1}s.isActive&&r.length!==0&&(s.atCellID(n.id)||s.moveTo(n.entryVertex()),s.drawTo(n.center()),t.testAllEdges(r,s));for(var u=s.shapeIDs,f=t.countShapes(r,u),d=new Sfe(f),A=0,y=0,w=0;w<f;w++){var S=void 0,T=t.shapes.size,R=T;A!==r.length&&(T=r[A].faceEdge.shapeID),y<u.length&&(R=u[y]);var P=A;if(R<T)S=new aH(R,0),S.containsCenter=!0,y++;else{for(;A<r.length&&r[A].faceEdge.shapeID===T;)A++;S=new aH(T,A-P);for(var I=P;I<A;I++)S.edges[I-P]=r[I].faceEdge.edgeID;R===T&&(S.containsCenter=!0,y++)}d.shapes[w]=S}return t.cellMap.set(n.id,d),t.cells.push(n.id),s.isActive&&r.length!==0&&(s.drawTo(n.exitVertex()),t.testAllEdges(r,s),s.setNextCellID(Pa(n.id))),!0},this.updateBound=function(n,r,s,o,a){var l=new jL(n.faceEdge,new Wr);return r===0?(l.bound.x.lo=s,l.bound.x.hi=n.bound.x.hi):(l.bound.x.lo=n.bound.x.lo,l.bound.x.hi=s),o===0?(l.bound.y.lo=a,l.bound.y.hi=n.bound.y.hi):(l.bound.y.lo=n.bound.y.lo,l.bound.y.hi=a),l},this.clipUBound=function(n,r,s){if(r===0&&n.bound.x.lo>=s||r===1&&n.bound.x.hi<=s)return n;var o=n.faceEdge,a=n.bound.y.clampPoint(B1(s,o.a.x,o.b.x,o.a.y,o.b.y)),l=o.a.x>o.b.x==o.a.y>o.b.y,c=r===1===l?1:0;return t.updateBound(n,r,s,c,a)},this.clipVBound=function(n,r,s){if(r===0&&n.bound.y.lo>=s||r===1&&n.bound.y.hi<=s)return n;var o=n.faceEdge,a=n.bound.x.clampPoint(B1(s,o.a.y,o.b.y,o.a.x,o.b.x)),l=o.a.x>o.b.x==o.a.y>o.b.y,c=r===1===l?1:0;return t.updateBound(n,c,a,r,s)},this.clipVAxis=function(n,r){return n.bound.y.hi<=r.lo?[n,void 0]:n.bound.y.lo>=r.hi?[void 0,n]:[t.clipVBound(n,1,r.hi),t.clipVBound(n,0,r.lo)]},this.absorbIndexCell=function(n,r,s,o){if(o.isActive&&s.length!==0&&t.isShapeBeingRemoved(s[0].faceEdge.shapeID)){o.atCellID(n.id)||o.moveTo(n.entryVertex()),o.drawTo(n.exitVertex()),o.setNextCellID(Pa(n.id));for(var a=Ct(s),l;!(l=a()).done;){var c=l.value,u=c.faceEdge;if(!t.isShapeBeingRemoved(u.shapeID))break;u.hasInterior&&o.testEdge(u.shapeID,u.edge)}}o.saveAndClearStateBefore(t.pendingAdditionsPos);var f=[],d=!1,A=r.indexCell();if(A)for(var y=Ct(A.shapes),w;!(w=y()).done;){var S=w.value,T=S.shapeID,R=t.shape(T);if(R){var P=S.numEdges(),I=new mH(T,void 0,void 0,R.dimension()===2);I.hasInterior&&(o.addShape(T,S.containsCenter),!d&&P>0&&(o.moveTo(n.center()),o.drawTo(n.entryVertex()),o.setNextCellID(n.id),d=!0));for(var F=0;F<P;F++){var D=S.edges[F];I.edgeID=D,I.edge=R.edge(D),I.maxLevel=AH(I.edge),I.hasInterior&&o.testEdge(T,I.edge);var L=fy(I.edge.v0,I.edge.v1,pu(n.id),T1),C=L[0],B=L[1],k=L[2];if(!k)throw new Error("invariant failure in ShapeIndex");I.a=C,I.b=B,f.push(I)}}}for(var z=f.map(function(H){return new jL(H,Pfe(H.a,H.b,n.bound()))}),G=Ct(s),W;!(W=G()).done;){var Y=W.value;if(!t.isShapeBeingRemoved(Y.faceEdge.shapeID)){z.push.apply(z,s.slice(s.indexOf(Y)));break}}s=z,t.cellMap.delete(n.id)},this.testAllEdges=function(n,r){for(var s=Ct(n),o;!(o=s()).done;){var a=o.value;a.faceEdge.hasInterior&&r.testEdge(a.faceEdge.shapeID,a.faceEdge.edge)}},this.countShapes=function(n,r){for(var s=0,o=-1,a=0,l=0,c=Ct(n),u;!(u=c()).done;){var f=u.value;if(f.faceEdge.shapeID!==o)for(s++,o=f.faceEdge.shapeID;l<r.length&&(a=r[l],!(a>o));)a<o&&s++,l++}return s+=r.length-l,s},this.maxEdgesPerCell=10,this.nextID=0,this.shapes=new Map,this.cellMap=new Map,this.cells=[],this.status=iy,this.pendingAdditionsPos=0,this.pendingRemovals=[]}var e=i.prototype;return e.removeShapeInternal=function(n,r,s){},i})(),AH=function(e){var t=e.v0.vector.sub(e.v1.vector).norm()*Ofe;return hfe.minLevel(t)},Ufe=function(e,t,n,r){this.shapeID=e,this.hasInterior=t,this.containsTrackerOrigin=n,this.edges=r};function kfe(){return{distance:Pc(),shapeID:-1,edgeID:-1}}function XL(i,e){return i.distance<e.distance?-1:i.distance>e.distance?1:i.shapeID<e.shapeID?-1:i.shapeID>e.shapeID?1:i.edgeID<e.edgeID?-1:i.edgeID>e.edgeID?1:0}var eW=(function(){function i(){this.maxResults=1/0,this.maxDistance=Pc(),this.maxError=0,this.includeInteriors=!0,this.useBruteForce=!1}var e=i.prototype;return e.setInclusiveMaxDistance=function(n){this.maxDistance=N1(n)},e.setConservativeMaxDistance=function(n){this.maxDistance=N1(FT(n,dfe(n)))},e.clone=function(){var n=new i;return n.maxResults=this.maxResults,n.maxDistance=this.maxDistance,n.maxError=this.maxError,n.includeInteriors=this.includeInteriors,n.useBruteForce=this.useBruteForce,n},i})(),zfe=(function(){function i(t){this._includeInteriors=!0,this.point=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 120},e.updateMinDistanceToEdge=function(n,r,s){var o=mu(this.point,n,r,s);return{distance:o.dist,updated:o.less}},e.updateMinDistanceToPoint=function(n,r){var s=We.chordAngleBetweenPoints(this.point,n);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.updateMinDistanceToCell=function(n,r){var s=n.distance(this.point);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){var s=this,o=new bp(n,Qf);return o.visitContainingShapes(this.point,function(a){var l=n.idForShape(a);return l>=0?r(l,s.point):!0})},e.getCapBound=function(){return{center:this.point,radius:0}},i})(),Vfe=(function(){function i(t,n){this._includeInteriors=!0,this.a=t,this.b=n}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 60},e.updateMinDistanceToEdge=function(n,r,s){return nW(this.a,this.b,n,r,s)},e.updateMinDistanceToPoint=function(n,r){var s=mu(n,this.a,this.b,r);return{distance:s.dist,updated:s.less}},e.updateMinDistanceToCell=function(n,r){var s=n.distanceToEdge(this.a,this.b);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){for(var s=new bp(n,Qf),o=new Set,a=function(){var d=u[c],A=s.visitContainingShapes(d,function(y){var w=n.idForShape(y);return w>=0&&!o.has(w)?(o.add(w),r(w,d)):!0});if(!A)return{v:!1}},l,c=0,u=[this.a,this.b];c<u.length;c++)if(l=a(),l)return l.v;return!0},e.getCapBound=function(){var n=We.fromVector(this.a.vector.add(this.b.vector).normalize()),r=Math.max(We.chordAngleBetweenPoints(n,this.a),We.chordAngleBetweenPoints(n,this.b));return{center:n,radius:r}},i})(),Gfe=(function(){function i(t){this._includeInteriors=!0,this.cell=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 30},e.updateMinDistanceToEdge=function(n,r,s){var o=this.cell.distanceToEdge(n,r);return o<s?{distance:o,updated:!0}:{distance:s,updated:!1}},e.updateMinDistanceToPoint=function(n,r){var s=this.cell.distance(n);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.updateMinDistanceToCell=function(n,r){var s=this.cell.distanceToCell(n);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){var s=new bp(n,Qf),o=this.cell.center();return s.visitContainingShapes(o,function(a){var l=n.idForShape(a);return l>=0?r(l,o):!0})},e.getCapBound=function(){for(var n=this.cell.center(),r=0,s=0;s<4;s++){var o=We.chordAngleBetweenPoints(n,this.cell.vertex(s));o>r&&(r=o)}return{center:n,radius:r}},i})(),tW=(function(){function i(t){this._includeInteriors=!0,this.index=t,this.query=new bp(t,Qf)}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 25},e.updateMinDistanceToEdge=function(n,r,s){if(this._includeInteriors&&(this.query.contains(n)||this.query.contains(r)))return{distance:0,updated:s>0};for(var o=!1,a=Ct(this.index.shapes),l;!(l=a()).done;){var c=l.value,u=c[1];if(u)for(var f=u.numEdges(),d=0;d<f;d++){var A=u.edge(d),y=nW(n,r,A.v0,A.v1,s);if(y.updated&&(s=y.distance,o=!0),s===0)return{distance:0,updated:o}}}return{distance:s,updated:o}},e.updateMinDistanceToPoint=function(n,r){if(this._includeInteriors&&this.query.contains(n))return{distance:0,updated:r>0};for(var s=!1,o=Ct(this.index.shapes),a;!(a=o()).done;){var l=a.value,c=l[1];if(c)for(var u=c.numEdges(),f=0;f<u;f++){var d=c.edge(f),A=mu(n,d.v0,d.v1,r);if(A.less&&(r=A.dist,s=!0),r===0)return{distance:0,updated:s}}}return{distance:r,updated:s}},e.updateMinDistanceToCell=function(n,r){if(this._includeInteriors&&this.query.contains(n.center()))return{distance:0,updated:r>0};for(var s=!1,o=Ct(this.index.shapes),a;!(a=o()).done;){var l=a.value,c=l[1];if(c)for(var u=c.numEdges(),f=0;f<u;f++){var d=c.edge(f),A=n.distanceToEdge(d.v0,d.v1);if(A<r&&(r=A,s=!0),r===0)return{distance:0,updated:s}}}return{distance:r,updated:s}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){for(var s=new bp(n,Qf),o=new Set,a=Ct(this.index.shapes),l;!(l=a()).done;){var c=l.value,u=c[1];if(u){for(var f=u.numEdges(),d=0;d<f;d++)for(var A=u.edge(d),y=function(){var P=T[S],I=s.visitContainingShapes(P,function(F){var D=n.idForShape(F);return D>=0&&!o.has(D)?(o.add(D),r(D,P)):!0});if(!I)return{v:!1}},w,S=0,T=[A.v0,A.v1];S<T.length;S++)if(w=y(),w)return w.v}}return!0},e.getCapBound=function(){if(this.index.len()===0)return null;for(var n=null,r=0,s=Ct(this.index.shapes),o;!(o=s()).done;){var a=o.value,l=a[1];if(l)for(var c=l.numEdges(),u=0;u<c;u++){var f=l.edge(u);n===null&&(n=f.v0);var d=We.chordAngleBetweenPoints(n,f.v0),A=We.chordAngleBetweenPoints(n,f.v1);r=Math.max(r,d,A)}}return n===null?null:{center:n,radius:r}},i})();function nW(i,e,t,n,r){if(r===0)return{distance:0,updated:!1};if(qH(i,e,t,n)===Rc)return{distance:0,updated:!0};var s=!1,o=mu(i,t,n,r);return o.less&&(r=o.dist,s=!0),o=mu(e,t,n,r),o.less&&(r=o.dist,s=!0),o=mu(t,i,e,r),o.less&&(r=o.dist,s=!0),o=mu(n,i,e,r),o.less&&(r=o.dist,s=!0),{distance:r,updated:s}}var qfe=(function(){function i(t,n){n===void 0&&(n=new eW),this.indexNumEdges=0,this.indexNumEdgesLimit=0,this.index=t,this.options=n,this.iter=t.iterator()}var e=i.prototype;return e.reInit=function(){this.indexNumEdges=0,this.indexNumEdgesLimit=0,this.iter=this.index.iterator()},e.findClosestEdges=function(n,r){return this.findClosestEdgesInternal(n,this.options,r)},e.visitClosestEdges=function(n,r,s,o){for(var a=this.findClosestEdgesInternal(n,r,o),l=Ct(a),c;!(c=l()).done;){var u=c.value;if(!s(u))break}},e.visitClosestShapes=function(n,r,s,o){for(var a=this.findClosestEdgesInternal(n,r,o),l=new Set,c=-1,u=Ct(a),f;!(f=u()).done;){var d=f.value,A=d.shapeID;if(A!==c&&!l.has(A)&&(l.add(A),c=A,!s(d)))break}},e.findClosestEdge=function(n,r){var s=this.options.clone();s.maxResults=1;var o=this.findClosestEdgesInternal(n,s,r);return o.length===0?kfe():o[0]},e.getDistance=function(n,r){return this.findClosestEdge(n,r).distance},e.isDistanceLess=function(n,r,s){var o=this.options.clone();o.maxResults=1,o.maxDistance=r,o.maxError=Mc;var a=this.findClosestEdgesInternal(n,o,s);return a.length>0},e.isDistanceLessOrEqual=function(n,r,s){var o=this.options.clone();o.maxResults=1,o.setInclusiveMaxDistance(r),o.maxError=Mc;var a=this.findClosestEdgesInternal(n,o,s);return a.length>0},e.isConservativeDistanceLessOrEqual=function(n,r,s){var o=this.options.clone();o.maxResults=1,o.setConservativeMaxDistance(r),o.maxError=Mc;var a=this.findClosestEdgesInternal(n,o,s);return a.length>0},e.getEdge=function(n){var r=this.index.shape(n.shapeID);return r.edge(n.edgeID)},e.project=function(n,r){if(r.edgeID<0)return n;var s=this.getEdge(r);return WH(n,s.v0,s.v1)},e.findClosestEdgesInternal=function(n,r,s){var o=r.maxDistance,a=[];if(o===0)return a;if(r.includeInteriors){var l=new Set;n.visitContainingShapeIds(this.index,function(T,R){return(!s||s(T))&&l.add(T),l.size<r.maxResults});for(var c=Ct(l),u;!(u=c()).done;){var f=u.value;a.push({distance:0,shapeID:f,edgeID:-1})}if(o===0)return a}var d=n.maxBruteForceIndexSize()+1;d>this.indexNumEdgesLimit&&this.indexNumEdges>=this.indexNumEdgesLimit&&(this.indexNumEdges=this.countEdgesUpTo(d),this.indexNumEdgesLimit=d),r.useBruteForce||this.indexNumEdges<d?this.findClosestEdgesBruteForce(n,r,s,o,a):this.findClosestEdgesOptimized(n,r,s,o,a),a.sort(XL);for(var A=[],y=0,w=a;y<w.length;y++){var S=w[y];(A.length===0||A[A.length-1].shapeID!==S.shapeID||A[A.length-1].edgeID!==S.edgeID)&&A.push(S)}return A.length>r.maxResults&&(A.length=r.maxResults),A},e.findClosestEdgesBruteForce=function(n,r,s,o,a){for(var l=Ct(this.index.shapes),c;!(c=l()).done;){var u=c.value,f=u[0],d=u[1];if(d&&!(s&&!s(f)))for(var A=d.numEdges(),y=0;y<A;y++){var w=d.edge(y),S=n.updateMinDistanceToEdge(w.v0,w.v1,o);if(S.updated){var T={distance:S.distance,shapeID:f,edgeID:y};r.maxResults===1?(a.length===0?a.push(T):a[0]=T,o=S.distance-r.maxError):r.maxResults===1/0?a.push(T):(a.push(T),a.length>r.maxResults&&(a.sort(XL),a.length=r.maxResults,o=a[a.length-1].distance-r.maxError))}}}},e.findClosestEdgesOptimized=function(n,r,s,o,a){var l=n.getCapBound();if(l){if(this.iter=this.index.iterator(),r.maxResults===1&&this.iter.locatePoint(l.center)){var c=this.iter.indexCell();if(o=this.processIndexCell(n,r,s,c,o,a),o===0)return}var u=[];for(this.iter.begin();!this.iter.done();){var f=this.iter.cellID(),d=Ia.fromCellID(f),A=n.updateMinDistanceToCell(d,o);A.distance<o&&u.push({distance:A.distance,id:f,indexCell:this.iter.indexCell()}),this.iter.next()}for(u.sort(function(C,B){return C.distance-B.distance});u.length>0;){var y=u.shift();if(y.distance>=o)break;if(y.indexCell!==null)o=this.processIndexCell(n,r,s,y.indexCell,o,a);else{console.log("HEYYYY");for(var w=k1(y.id),S=Ct(w),T;!(T=S()).done;){var R=T.value,P=this.iter.locateCellID(R);if(P===wp){var I=Ia.fromCellID(this.iter.cellID()),F=n.updateMinDistanceToCell(I,o);F.distance<o&&u.push({distance:F.distance,id:this.iter.cellID(),indexCell:this.iter.indexCell()})}else if(P===xy){var D=Ia.fromCellID(R),L=n.updateMinDistanceToCell(D,o);L.distance<o&&u.push({distance:L.distance,id:R,indexCell:null})}}u.sort(function(C,B){return C.distance-B.distance})}}}},e.processIndexCell=function(n,r,s,o,a,l){for(var c=Ct(o.shapes),u;!(u=c()).done;){var f=u.value,d=f.shapeID;if(!(s&&!s(d))){var A=this.index.shape(d);if(A)for(var y=Ct(f.edges),w;!(w=y()).done;){var S=w.value,T=A.edge(S),R=n.updateMinDistanceToEdge(T.v0,T.v1,a);if(R.updated){var P={distance:R.distance,shapeID:d,edgeID:S};r.maxResults===1?(l.length===0?l.push(P):l[0]=P,a=R.distance-r.maxError):r.maxResults===1/0?l.push(P):(l.push(P),l.length>r.maxResults&&(l.sort(XL),l.length=r.maxResults,a=l[l.length-1].distance-r.maxError))}}}}return a},e.countEdgesUpTo=function(n){for(var r=0,s=Ct(this.index.shapes),o;!(o=s()).done;){var a=o.value,l=a[1];if(l&&(r+=l.numEdges(),r>=n))break}return r},i})();function Hfe(){return{distance:Pc(),cellID:0n,label:-1}}function Wfe(i){return i.label<0}var iW=(function(){function i(){this.maxResults=1/0,this.maxDistance=Pc(),this.maxError=0}var e=i.prototype;return e.setInclusiveMaxDistance=function(n){this.maxDistance=N1(n)},e.setConservativeMaxDistance=function(n){this.maxDistance=N1(FT(n,this.computeMaxDistanceError(n)))},e.computeMaxDistanceError=function(n){return mD(n)},i})(),jfe=(function(){function i(t){this.point=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){return n.distance(this.point)},e.distanceToPoint=function(n){return We.chordAngleBetweenPoints(this.point,n)},i})(),Xfe=(function(){function i(t,n){this.a=t,this.b=n}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){return n.distanceToEdge(this.a,this.b)},e.distanceToPoint=function(n){return mu(n,this.a,this.b,Pc()).dist},i})(),$fe=(function(){function i(t){this.cell=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){return this.cell.distanceToCell(n)},e.distanceToPoint=function(n){return this.cell.distance(n)},i})(),Yfe=(function(){function i(t){this.cellUnion=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){for(var r=Pc(),s=Ct(this.cellUnion),o;!(o=s()).done;){var a=o.value,l=Ia.fromCellID(a),c=l.distanceToCell(n);if(c<r&&(r=c),r===0)break}return r},e.distanceToPoint=function(n){for(var r=Pc(),s=Ct(this.cellUnion),o;!(o=s()).done;){var a=o.value,l=Ia.fromCellID(a),c=l.distance(n);if(c<r&&(r=c),r===0)break}return r},i})(),Zfe=(function(){function i(t){this.index=t,this.edgeTarget=new tW(t)}var e=i.prototype;return e.setIncludeInteriors=function(n){this.edgeTarget.setIncludeInteriors(n)},e.maxBruteForceIndexSize=function(){return this.edgeTarget.maxBruteForceIndexSize()},e.distanceToCell=function(n){var r=this.edgeTarget.updateMinDistanceToCell(n,Pc());return r.distance},e.distanceToPoint=function(n){var r=this.edgeTarget.updateMinDistanceToPoint(n,Pc());return r.distance},i})(),Kfe=(function(){function i(t,n){n===void 0&&(n=new iW),this.index=t,this.options=n}var e=i.prototype;return e.findClosestCells=function(n){var r=new XH(this.index,!0),s=new $H(this.index),o=[];for(r.begin();!r.done();r.next())for(s.startUnion(r);!s.done();){var a=s.cellID(),l=s.label(),c=Ia.fromCellID(a);if(this.options.region&&!this.options.region.intersectsCell(c)){s.next();continue}var u=n.distanceToCell(c);u<this.options.maxDistance&&o.push({cellID:a,label:l,distance:u}),s.next()}o.sort(function(d,A){return d.distance-A.distance});var f=Math.min(o.length,this.options.maxResults);return o.slice(0,f)},e.findClosestCell=function(n){var r=this.options.maxResults;this.options.maxResults=1;var s=this.findClosestCells(n);return this.options.maxResults=r,s.length===0?Hfe():s[0]},e.getDistance=function(n){return this.findClosestCell(n).distance},e.isDistanceLess=function(n,r){var s=this.options.maxResults,o=this.options.maxDistance;this.options.maxResults=1,this.options.maxDistance=r;var a=this.findClosestCell(n);return this.options.maxResults=s,this.options.maxDistance=o,!Wfe(a)},e.isDistanceLessOrEqual=function(n,r){return this.isDistanceLess(n,N1(r))},e.isConservativeDistanceLessOrEqual=function(n,r){return this.isDistanceLess(n,N1(FT(r,mD(r))))},i})(),O1=(function(){function i(){this.a=new We(0,0,0),this.aLL=new ar(0,0),this.bound=Ri.emptyRect()}i.maxErrorForTests=function(){return new ar(10*Ki,1*Ki)};var e=i.prototype;return e.addPoint=function(n){var r=ar.fromPoint(n);if(this.bound.isEmpty()){this.a=n,this.aLL=r,this.bound=this.bound.addPoint(r);return}var s=this.a.vector.sub(n.vector).cross(this.a.vector.add(n.vector)),o=s.norm();if(o<191346e-20){this.a.vector.dot(n.vector)<0?this.bound=Ri.fullRect():this.bound=this.bound.union(Ri.fromLatLng(this.aLL).addPoint(r)),this.a=n,this.aLL=r;return}var a=to.emptyInterval().addPoint(this.aLL.lng).addPoint(r.lng);a.length()>=Math.PI-2*Ki&&(a=to.fullInterval());var l=Li.fromPoint(this.aLL.lat).addPoint(r.lat),c=s.cross(new Wt(0,0,1)),u=c.dot(this.a.vector),f=c.dot(n.vector),d=606638e-21*o+683174e-36;if(u*f<0||Math.abs(u)<=d||Math.abs(f)<=d){var A=Math.min(Math.atan2(Math.sqrt(s.x*s.x+s.y*s.y),Math.abs(s.z))+3*Ki,Math.PI/2),y=2*Math.asin(.5*this.a.vector.sub(n.vector).norm()*Math.sin(A)),w=.5*(y-l.length())+Ki;u<=d&&f>=-d&&(l.hi=Math.min(A,l.hi+w)),f<=d&&u>=-d&&(l.lo=Math.max(-A,l.lo-w))}this.a=n,this.aLL=r,this.bound=this.bound.union(new Ri(l,a))},e.rectBound=function(){return this.bound.expanded(new ar(2*Ki,0)).polarClosure()},i})();O1.expandForSubregions=function(i){if(i.isEmpty())return i;var e=Math.max(0,Math.PI-i.lng.length()-2.5*Ki),t=Math.max(i.lat.lo,-i.lat.hi),n=Math.PI/2+i.lat.lo,r=Math.PI/2-i.lat.hi;if(t>=0){if(2*t+e<1354e-18)return Ri.fullRect()}else if(e>=Math.PI/2){if(n+r<1687e-18)return Ri.fullRect()}else if(Math.max(n,r)*e<1765e-18)return Ri.fullRect();var s=9*Ki,o=0;return e<=0&&(o=Math.PI),i.expanded(new ar(s,o)).polarClosure()};var rW=function(e,t,n,r,s){return We.orderedCCW(n,s,r,t)&&We.orderedCCW(r,e,n,t)},Qfe=function(e,t,n,r,s){return!(We.orderedCCW(e,s,r,t)&&We.orderedCCW(r,n,e,t))},Jfe=(function(){function i(t){this.a=new Ci(0,0),this.b=new Ci(0,0),this.index=t,this.iter=t.iterator(),this.cells=[]}var e=i.prototype;return e.crossings=function(n,r,s,o){var a=this.candidates(n,r,s);if(a.length===0)return[];for(var l=new ql(n,r),c=0,u=a.length,f=0;f<u;f++){var d=s.edge(a[f]),A=l.crossingSign(d.v0,d.v1);(o===yT&&(A===PT||A===Rc)||o!==yT&&A===Rc)&&(a[c]=a[f],c++)}return c<u&&(a=a.slice(0,c)),a},e.crossingsEdgeMap=function(n,r,s){var o=this.candidatesEdgeMap(n,r);if(o.size===0)return o;var a=new ql(n,r);return o.forEach(function(l,c){for(var u=l.length,f=0,d=0;d<u;d++){var A=c.edge(l[d]),y=a.crossingSign(A.v0,A.v1);(s===yT&&(y===PT||y===Rc)||s!==yT&&y===Rc)&&(l[f]=l[d],o.set(c,l),f++)}f===0?o.delete(c):f<u&&o.set(c,o.get(c).slice(0,f))}),o},e.candidates=function(n,r,s){var o=[],a=27,l=s.numEdges();if(l<=a)return o=Array.from({length:l},function(w,S){return S}),o;if(this.getCellsForEdge(n,r),this.cells.length===0)return[];var c=-1;this.index.shapes.forEach(function(w,S){w===s&&(c=S)});for(var u=Ct(this.cells),f;!(f=u()).done;){var d,A=f.value;if(A){var y=A.findByShapeID(c);y&&(d=o).push.apply(d,y.edges)}}return this.cells.length>1&&(o=i.uniqueInts(o)),o},i.uniqueInts=function(n){for(var r=[],s={},o=Ct(n),a;!(a=o()).done;){var l=a.value;s[l]||(s[l]=!0,r.push(l))}return r.sort(function(c,u){return c-u}),r},e.candidatesEdgeMap=function(n,r){var s=new ede;if(this.index.shapes.size===1){var o=this.index.shape(0);return s.set(o,this.candidates(n,r,o)),s}if(this.getCellsForEdge(n,r),this.cells.length===0)return s;for(var a=Ct(this.cells),l;!(l=a()).done;)for(var c=l.value,u=Ct(c.shapes),f;!(f=u()).done;)for(var d=f.value,A=this.index.shape(d.shapeID),y=0;y<d.numEdges();y++)s.set(A,(s.get(A)||[]).concat([d.edges[y]]));return this.cells.length>1&&s.forEach(function(w,S){s.set(S,i.uniqueInts(w))}),s},e.getCells=function(n,r,s){var o=Rfe(n,r,pu(s.id)),a=o[0],l=o[1],c=o[2];if(c){this.a=a,this.b=l;var u=Wr.fromPoints(this.a,this.b);s.bound().intersects(u)&&this.computeCellsIntersected(s,u)}return this.cells.length===0?[]:this.cells},e.getCellsForEdge=function(n,r){this.cells=[];for(var s=Nfe(n,r),o=Ct(s),a;!(a=o()).done;){var l=a.value;this.a=l.a,this.b=l.b;var c=Wr.fromPoints(this.a,this.b),u=Ca.fromCellID(yp(l.face),0),f=u.shrinkToFit(c),d=this.iter.locateCellID(f);d===wp?this.cells.push(this.iter.indexCell()):d===xy&&(my(f)||(u=Ca.fromCellID(f,0)),this.computeCellsIntersected(u,c))}},e.computeCellsIntersected=function(n,r){if(this.iter.seek(qi(n.id)),!(this.iter.done()||this.iter.cellID()>Gi(n.id))){if(this.iter.cellID()===n.id){this.cells.push(this.iter.indexCell());return}var s=n.middle().lo();if(r.x.hi<s.x){this.clipVAxis(r,s.y,0,n);return}else if(r.x.lo>=s.x){this.clipVAxis(r,s.y,1,n);return}var o=this.splitUBound(r,s.x);r.y.hi<s.y?(this.computeCellsIntersected(Ca.fromParentIJ(n,0,0),o[0]),this.computeCellsIntersected(Ca.fromParentIJ(n,1,0),o[1])):r.y.lo>=s.y?(this.computeCellsIntersected(Ca.fromParentIJ(n,0,1),o[0]),this.computeCellsIntersected(Ca.fromParentIJ(n,1,1),o[1])):(this.clipVAxis(o[0],s.y,0,n),this.clipVAxis(o[1],s.y,1,n))}},e.clipVAxis=function(n,r,s,o){if(n.y.hi<r)this.computeCellsIntersected(Ca.fromParentIJ(o,s,0),n);else if(n.y.lo>=r)this.computeCellsIntersected(Ca.fromParentIJ(o,s,1),n);else{var a=this.splitVBound(n,r);this.computeCellsIntersected(Ca.fromParentIJ(o,s,0),a[0]),this.computeCellsIntersected(Ca.fromParentIJ(o,s,1),a[1])}},e.splitUBound=function(n,r){var s=n.y.clampPoint(B1(r,this.a.x,this.b.x,this.a.y,this.b.y)),o=this.a.x>this.b.x!=this.a.y>this.b.y?1:0;return this.splitBound(n,0,o,r,s)},e.splitVBound=function(n,r){var s=n.x.clampPoint(B1(r,this.a.y,this.b.y,this.a.x,this.b.x)),o=this.a.x>this.b.x!=this.a.y>this.b.y?1:0;return this.splitBound(n,o,0,s,r)},e.splitBound=function(n,r,s,o,a){var l=[Wr.fromRect(n),Wr.fromRect(n)];return r===1?(l[0].x.lo=o,l[1].x.hi=o):(l[0].x.hi=o,l[1].x.lo=o),s===1?(l[0].y.lo=a,l[1].y.hi=a):(l[0].y.hi=a,l[1].y.lo=a),l},i})(),ede=(function(i){function e(){return i.apply(this,arguments)||this}return dy(e,i),e})(L1(Map)),tde=function(e,t,n){var r=1,s=t.distance(n);s!==0&&(r=s/Math.sin(s));var o=1,a=n.distance(e);a!==0&&(o=a/Math.sin(a));var l=1,c=e.distance(t);c!==0&&(l=c/Math.sin(c));var u=new Wt(e.x,t.x-e.x,n.x-e.x),f=new Wt(e.y,t.y-e.y,n.y-e.y),d=new Wt(e.z,t.z-e.z,n.z-e.z),A=new Wt(r,o-r,l-r);return We.fromVector(new Wt(f.cross(d).dot(A),d.cross(u).dot(A),u.cross(f).dot(A)).mul(.5))},gH=new We(0,0,1),vH=new We(0,0,-1),fD=(function(){function i(t){this.originInside=!1,this.depth=0,this.bound=Ri.emptyRect(),this.subregionBound=Ri.emptyRect(),this.vertices=t,this.index=new LT,this.initOriginAndBound()}i.fromCell=function(n){var r=[n.vertex(0),n.vertex(1),n.vertex(2),n.vertex(3)];return new i(r)},i.fromLoop=function(n){return new i(n.vertices.map(function(r){return We.fromVector(r.vector)}))},i.emptyLoop=function(){return new i([gH])},i.fullLoop=function(){return new i([vH])};var e=i.prototype;return e.initOriginAndBound=function(){if(this.vertices.length<3){if(!this.isEmptyOrFull()){this.originInside=!1;return}this.originInside=this.vertices[0].z<0}else{var n=this.vertices[0]!==this.vertices[1]&&this.vertices[2]!==this.vertices[1]&&ufe(this.vertices[0],this.vertices[1],this.vertices[2]);this.originInside=!1,n!==this.containsPoint(this.vertices[1])&&(this.originInside=!0)}this.initBound(),this.index.add(this)},e.copyFrom=function(n){this.vertices=n.vertices,this.originInside=n.originInside,this.depth=n.depth,this.bound=n.bound,this.subregionBound=n.subregionBound,this.index=n.index},e.initBound=function(){if(this.vertices.length===0){this.copyFrom(i.emptyLoop());return}if(this.isEmptyOrFull()){this.isEmpty()?this.bound=Ri.emptyRect():this.bound=Ri.fullRect(),this.subregionBound=this.bound;return}for(var n=new O1,r=0;r<=this.vertices.length;r++)n.addPoint(this.vertex(r));var s=n.rectBound();this.containsPoint(new We(0,0,1))&&(s=new Ri(new Li(s.lat.lo,Math.PI/2),to.fullInterval())),s.lng.isFull()&&this.containsPoint(new We(0,0,-1))&&(s.lat.lo=-Math.PI/2),this.bound=s,this.subregionBound=O1.expandForSubregions(this.bound)},e.validate=function(){var n=this.findValidationErrorNoIndex();return n||null},e.findValidationErrorNoIndex=function(){for(var n=0;n<this.vertices.length;n++){var r=this.vertices[n];if(!r.vector.isUnit())return new Error("vertex "+n+" is not unit length")}if(this.vertices.length<3)return this.isEmptyOrFull()?null:new Error("non-empty, non-full loops must have at least 3 vertices");for(var s=0;s<this.vertices.length;s++){if(this.vertices[s].equals(this.vertex(s+1)))return new Error("edge "+s+" is degenerate (duplicate vertex)");var o=We.fromVector(this.vertex(s+1).vector.mul(-1));if(this.vertices[s].equals(o))return new Error("vertices "+s+" and "+(s+1)%this.vertices.length+" are antipodal")}return null},e.contains=function(n){if(!this.subregionBound.contains(n.bound))return!1;if(this.isEmptyOrFull()||n.isEmptyOrFull())return this.isFull()||n.isEmpty();var r=new nde;return $L(this,n,r)?!1:r.foundSharedVertex?!0:!(!this.containsPoint(n.vertex(0))||(n.subregionBound.contains(this.bound)||n.bound.union(this.bound).isFull())&&n.containsPoint(this.vertex(0)))},e.intersects=function(n){if(!this.bound.intersects(n.bound))return!1;var r=new ide;return $L(this,n,r)?!0:r.foundSharedVertex?!1:!!((this.subregionBound.contains(n.bound)||this.bound.union(n.bound).isFull())&&this.containsPoint(n.vertex(0))||n.subregionBound.contains(this.bound)&&n.containsPoint(this.vertex(0)))},e.equal=function(n){if(this.vertices.length!==n.vertices.length)return!1;for(var r=0;r<this.vertices.length;r++)if(this.vertices[r]!==n.vertex(r))return!1;return!0},e.boundaryEqual=function(n){if(this.vertices.length!==n.vertices.length)return!1;if(this.isEmptyOrFull())return this.isEmpty()===n.isEmpty();for(var r=0;r<this.vertices.length;r++)if(this.vertices[r].equals(n.vertex(0))){for(var s=0;s<this.vertices.length;s++)if(this.vertex(s+r)!==n.vertex(s))return!1;return!0}return!1},e.compareBoundary=function(n){if(!this.bound.intersects(n.bound))return-1;if(this.isFull())return 1;if(n.isFull())return-1;var r=new rde(n.isHole());return $L(this,n,r)?0:r.foundSharedVertex?r.containsEdge?1:-1:this.containsPoint(n.vertex(0))?1:-1},e.containsOrigin=function(){return this.originInside},e.referencePoint=function(){return kT(this.originInside)},e.numEdges=function(){return this.isEmptyOrFull()?0:this.vertices.length},e.edge=function(n){return new hh(this.vertex(n),this.vertex(n+1))},e.numChains=function(){return this.isEmpty()?0:1},e.chain=function(n){return new P1(0,this.numEdges())},e.chainEdge=function(n,r){return new hh(this.vertex(r),this.vertex(r+1))},e.chainPosition=function(n){return new UT(0,n)},e.dimension=function(){return 2},e.typeTag=function(){return YH},e.privateInterface=function(){},e.isEmpty=function(){return this.isEmptyOrFull()&&!this.containsOrigin()},e.isFull=function(){return this.isEmptyOrFull()&&this.containsOrigin()},e.isEmptyOrFull=function(){return this.vertices.length===1},e.rectBound=function(){return this.bound},e.capBound=function(){return this.bound.capBound()},e.vertex=function(n){return this.vertices[n%this.vertices.length]},e.orientedVertex=function(n){var r=n-this.vertices.length;return r<0&&(r=n),this.isHole()&&(r=this.vertices.length-1-r),this.vertex(r)},e.numVertices=function(){return this.vertices.length},e.bruteForceContainsPoint=function(n){for(var r=We.originPoint(),s=this.originInside,o=ql.newChainEdgeCrosser(r,n,this.vertex(0)),a=1;a<=this.vertices.length;a++)s=s!==o.edgeOrVertexChainCrossing(this.vertex(a));return s},e.containsPoint=function(n){if(!this.index.isFresh()&&!this.bound.containsPoint(n))return!1;var r=32;if(this.index.shapes.size===0||this.vertices.length<=r)return this.bruteForceContainsPoint(n);var s=this.index.iterator();return s.locatePoint(n)?this.iteratorContainsPoint(s,n):!1},e.containsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s!==wp||this.boundaryApproxIntersects(r,n)?!1:this.iteratorContainsPoint(r,n.center())},e.intersectsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s===zT?!1:s===xy||r.cellID()===n.id||this.boundaryApproxIntersects(r,n)?!0:this.iteratorContainsPoint(r,n.center())},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.boundaryApproxIntersects=function(n,r){var s=n.indexCell().findByShapeID(0);if(s.edges.length===0)return!1;if(n.cellID()===r.id)return!0;for(var o=_y+QH,a=r.boundUV().expandedByMargin(o),l=Ct(s.edges),c;!(c=l()).done;){var u=c.value,f=fy(this.vertex(u),this.vertex(u+1),r.face,o),d=f[0],A=f[1],y=f[2];if(y&&JH(d,A,a))return!0}return!1},e.iteratorContainsPoint=function(n,r){var s,o=(s=n.indexCell())==null?void 0:s.findByShapeID(0),a=o?.containsCenter||!1;if(o&&o.edges.length>0)for(var l=n.center(),c=new ql(l,r),u=-2,f=Ct(o.edges),d;!(d=f()).done;){var A=d.value;A!==u+1&&c.restartAt(this.vertex(A)),u=A,a=a!==c.edgeOrVertexChainCrossing(this.vertex(A+1))}return a},i.regularLoop=function(n,r,s){return i.regularLoopForFrame(gD(n),r,s)},i.regularLoopForFrame=function(n,r,s){return new i(We.regularPointsForFrame(n,r,s))},e.canonicalFirstVertex=function(){for(var n=0,r=this.vertices.length,s=1;s<r;s++)this.vertex(s).vector.cmp(this.vertex(n).vector)===-1&&(n=s);return this.vertex(n+1).vector.cmp(this.vertex(n+r-1).vector)===-1?[n,1]:(n+=r,[n,-1])},e.turningAngle=function(){if(this.isEmptyOrFull())return this.containsOrigin()?-2*Math.PI:2*Math.PI;if(this.vertices.length<3)return 0;for(var n=this.canonicalFirstVertex(),r=n[0],s=n[1],o=sH(this.vertex((r+this.vertices.length-s)%this.vertices.length),this.vertex(r),this.vertex((r+s)%this.vertices.length)),a=0,l=this.vertices.length-1;l>0;l--){r+=s;var c=sH(this.vertex(r-s),this.vertex(r),this.vertex(r+s)),u=o;o+=c+a,a=u-o+c}var f=2*Math.PI-4*Ki;return Math.max(-f,Math.min(f,s*(o+a)))},e.turningAngleMaxError=function(){var n=11.25*Ki;return n*this.vertices.length},e.isHole=function(){return(this.depth&1)!==0},e.sign=function(){return this.isHole()?-1:1},e.isNormalized=function(){return this.bound.lng.length()<Math.PI?!0:this.turningAngle()>=-this.turningAngleMaxError()},e.normalize=function(){this.isNormalized()||this.invert()},e.invert=function(){if(this.index.reset(),this.isEmptyOrFull())this.vertices[0]=this.isFull()?gH:vH;else for(var n=Math.floor(this.vertices.length/2)-1;n>=0;n--){var r=this.vertices.length-1-n,s=[this.vertices[r],this.vertices[n]];this.vertices[n]=s[0],this.vertices[r]=s[1]}this.originInside=!this.originInside,this.bound.lat.lo>-Math.PI/2&&this.bound.lat.hi<Math.PI/2?(this.bound=Ri.fullRect(),this.subregionBound=this.bound):this.initBound(),this.index.add(this)},e.findVertex=function(n){var r=0;if(this.vertices.length<10){for(var s=1;s<=this.vertices.length;s++)if(this.vertex(s).equals(n))return[s,!0];return[r,!1]}var o=this.index.iterator();if(!o.locatePoint(n))return[r,!1];for(var a=o.indexCell().findByShapeID(0),l=a.numEdges()-1;l>=0;l--){var c=a.edges[l];if(this.vertex(c).equals(n))return c===0?[this.vertices.length,!0]:[c,!0];if(this.vertex(c+1).equals(n))return[c+1,!0]}return[r,!1]},e.containsNested=function(n){if(!this.subregionBound.contains(n.bound))return!1;if(this.isEmptyOrFull()||n.numVertices()<2)return this.isFull()||n.isEmpty();var r=this.findVertex(n.vertex(1)),s=r[0],o=r[1];return o?rW(this.vertex(s-1),this.vertex(s),this.vertex(s+1),n.vertex(0),n.vertex(2)):this.containsPoint(n.vertex(1))},e.surfaceIntegralFloat64=function(n){for(var r=Math.PI-1e-5,s=0,o=this.vertex(0),a=1;a+1<this.vertices.length;a++){if(this.vertex(a+1).vector.angle(o.vector)>r){var l=o;o.equals(this.vertex(0))?o=We.fromVector(this.vertex(0).pointCross(this.vertex(a)).vector.normalize()):this.vertex(a).vector.angle(this.vertex(0).vector)<r?o=this.vertex(0):(o=We.fromVector(this.vertex(0).vector.cross(l.vector)),s+=n(this.vertex(0),l,o)),s+=n(l,this.vertex(a),o)}s+=n(o,this.vertex(a),this.vertex(a+1))}return o!==this.vertex(0)&&(s+=n(o,this.vertex(this.vertices.length-1),this.vertex(0))),s},e.surfaceIntegralPoint=function(n){for(var r=Math.PI-1e-5,s=new We(0,0,0).vector,o=this.vertex(0),a=1;a+1<this.vertices.length;a++){if(this.vertex(a+1).vector.angle(o.vector)>r){var l=o;o.equals(this.vertex(0))?o=We.fromVector(this.vertex(0).pointCross(this.vertex(a)).vector.normalize()):this.vertex(a).vector.angle(this.vertex(0).vector)<r?o=this.vertex(0):(o=We.fromVector(this.vertex(0).vector.cross(l.vector)),s=s.add(n(this.vertex(0),l,o).vector)),s=s.add(n(l,this.vertex(a),o).vector)}s=s.add(n(o,this.vertex(a),this.vertex(a+1)).vector)}return o!==this.vertex(0)&&(s=s.add(n(o,this.vertex(this.vertices.length-1),this.vertex(0)).vector)),We.fromVector(s)},e.area=function(){if(this.isEmptyOrFull())return this.containsOrigin()?4*Math.PI:0;var n=this.surfaceIntegralFloat64(gfe),r=this.turningAngleMaxError();return n<0&&(n+=4*Math.PI),n>4*Math.PI&&(n=4*Math.PI),n<0&&(n=0),n<r&&!this.isNormalized()?4*Math.PI:n>4*Math.PI-r&&this.isNormalized()?0:n},e.centroid=function(){return this.surfaceIntegralPoint(tde)},e.containsNonCrossingBoundary=function(n,r){if(!this.bound.intersects(n.bound))return!1;if(this.isFull())return!0;if(n.isFull())return!1;var s=this.findVertex(n.vertex(0)),o=s[0],a=s[1];return a?oW(this.vertex(o-1),this.vertex(o),this.vertex(o+1),n.vertex(1),r):this.containsPoint(n.vertex(0))},i})(),DT=function(e,t){return!e.containsCenter&&t===sW||e.containsCenter&&t===NT},$L=function(e,t,n){for(var r=new dH(e.index),s=new dH(t.index),o=new xH(e,t,n,!1),a=new xH(t,e,n,!0);!r.done()||!s.done();)if(r.rangeMax<s.rangeMin)r.seekTo(s);else if(s.rangeMax<r.rangeMin)s.seekTo(r);else{var l=ls(r.it.cellID())-ls(s.it.cellID());if(l>0){if(o.hasCrossingRelation(r,s))return!0}else if(l<0){if(a.hasCrossingRelation(s,r))return!0}else{var c=r.it.indexCell().shapes[0],u=s.it.indexCell().shapes[0];if(DT(c,o.aCrossingTarget)&&DT(u,o.bCrossingTarget)||c.numEdges()>0&&u.numEdges()>0&&o.cellCrossesCell(c,u))return!0;r.next(),s.next()}}return!1},_H=0,sW=1,NT=2,nde=(function(){function i(){this.foundSharedVertex=!1}var e=i.prototype;return e.aCrossingTarget=function(){return sW},e.bCrossingTarget=function(){return NT},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,!rW(n,r,s,o,a)},i})(),ide=(function(){function i(){this.foundSharedVertex=!1}var e=i.prototype;return e.aCrossingTarget=function(){return NT},e.bCrossingTarget=function(){return NT},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,Qfe(n,r,s,o,a)},i})(),rde=(function(){function i(t){this.foundSharedVertex=!1,this.containsEdge=!1,this.excludesEdge=!1,this.reverse=t}var e=i.prototype;return e.aCrossingTarget=function(){return _H},e.bCrossingTarget=function(){return _H},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,oW(n,r,s,a,this.reverse)?this.containsEdge=!0:this.excludesEdge=!0,this.containsEdge&&this.excludesEdge},i})(),oW=function(e,t,n,r,s){return r.equals(e)||r.equals(n)?r.equals(e)===s:We.orderedCCW(e,n,r,t)},xH=(function(){function i(t,n,r,s){if(this.crosser=null,this.aj=0,this.bjPrev=-2,this.bCells=[],this.a=t,this.b=n,this.relation=r,this.swapped=s,this.aCrossingTarget=r.aCrossingTarget(),this.bCrossingTarget=r.bCrossingTarget(),this.bQuery=new Jfe(n.index),s){var o=[this.bCrossingTarget,this.aCrossingTarget];this.aCrossingTarget=o[0],this.bCrossingTarget=o[1]}}var e=i.prototype;return e.startEdge=function(n){this.crosser=new ql(this.a.vertex(n),this.a.vertex(n+1)),this.aj=n,this.bjPrev=-2},e.edgeCrossesCell=function(n){for(var r=n.numEdges(),s=0;s<r;s++){var o,a=n.edges[s];if(a!==this.bjPrev+1){var l;(l=this.crosser)==null||l.restartAt(this.b.vertex(a))}this.bjPrev=a;var c=(o=this.crosser)==null?void 0:o.chainCrossingSign(this.b.vertex(a+1));if(c!==Gl){if(c===Rc)return!0;if(this.a.vertex(this.aj+1).equals(this.b.vertex(a+1))){if(this.swapped){if(this.relation.wedgesCross(this.b.vertex(a),this.b.vertex(a+1),this.b.vertex(a+2),this.a.vertex(this.aj),this.a.vertex(this.aj+2)))return!0}else if(this.relation.wedgesCross(this.a.vertex(this.aj),this.a.vertex(this.aj+1),this.a.vertex(this.aj+2),this.b.vertex(a),this.b.vertex(a+2)))return!0}}}return!1},e.cellCrossesCell=function(n,r){for(var s=Ct(n.edges),o;!(o=s()).done;){var a=o.value;if(this.startEdge(a),this.edgeCrossesCell(r))return!0}return!1},e.cellCrossesAnySubcell=function(n,r){for(var s=Ca.fromCellID(r,0),o=Ct(n.edges),a;!(a=o()).done;){var l=a.value;if(this.bCells=this.bQuery.getCells(this.a.vertex(l),this.a.vertex(l+1),s),this.bCells.length!==0){this.startEdge(l);for(var c=Ct(this.bCells),u;!(u=c()).done;){var f=u.value;if(this.edgeCrossesCell(f.shapes[0]))return!0}}}return!1},e.hasCrossing=function(n,r){var s=20,o=0;for(this.bCells=[];;){var a=r.it.indexCell().shapes[0].numEdges();if(a>0){if(o+=a,o>=s)return this.cellCrossesAnySubcell(n.it.indexCell().shapes[0],n.cellID())?!0:(r.seekBeyond(n),!1);this.bCells.push(r.indexCell())}if(r.next(),r.cellID()>n.rangeMax)break}for(var l=Ct(this.bCells),c;!(c=l()).done;){var u=c.value;if(this.cellCrossesCell(n.it.indexCell().shapes[0],u.shapes[0]))return!0}return!1},e.hasCrossingRelation=function(n,r){var s=n.it.indexCell().shapes[0];if(s.numEdges()!==0)return this.hasCrossing(n,r)?!0:(n.next(),!1);if(DT(s,this.aCrossingTarget))return r.seekBeyond(n),n.next(),!1;for(;r.cellID()<=n.rangeMax;){var o=r.it.indexCell().shapes[0];if(DT(o,this.bCrossingTarget))return!0;r.next()}return n.next(),!1},i})(),sde=(function(){function i(t){var n=this;if(t===void 0&&(t=[]),this.loops=[],this.index=new LT,this.hasHoles=!1,this.numVertices=0,this.nEdges=0,this.bound=Ri.emptyRect(),this.subregionBound=Ri.emptyRect(),this.cumulativeEdges=[],this.initLoops=function(r){var s=new Array;s.push(null);for(var o=-1;s.length>0;){var a=s.pop();a!=null&&(o=a.depth,n.loops.push(a));for(var l=r.get(a)||[],c=l.length-1;c>=0;c--){var u=l[c];u.depth=o+1,s.push(u)}}},t.length===1&&t[0].isEmpty()){this.initLoopProperties();return}this.loops=t,this.initNested()}i.fromOrientedLoops=function(n){for(var r=new Map,s=Ct(n),o;!(o=s()).done;){var a=o.value;r.set(a,a.containsOrigin())}for(var l=Ct(n),c;!(c=l()).done;){var u=c.value,f=u.turningAngle();Math.abs(f)>u.turningAngleMaxError()?f<0&&u.invert():u.containsOrigin()&&u.invert()}var d=new i(n);if(d.numLoops()>0){for(var A=d.loop(0),y=!1,w=Ct(d.loops),S;!(S=w()).done;){var T=S.value;T.containsOrigin()&&(y=!y,A=T)}r.get(A)!==y&&d.invert()}return d};var e=i.prototype;return e.invert=function(){if(this.isEmpty()){Object.assign(this,i.fullPolygon()),this.initLoopProperties();return}if(this.isFull()){Object.assign(this,new i),this.initLoopProperties();return}for(var n=0,r=10,s=r,o=1;o<this.numLoops();o++)if(this.loop(o).depth===0){s===r&&(s=this.loop(n).turningAngle());var a=this.loop(o).turningAngle();(a<s||a===s&&this.compareLoops(this.loop(o),this.loop(n))<0)&&(n=o,s=a)}this.loop(n).invert();var l=[],c=this.lastDescendant(n);l.push(this.loop(n));for(var u=0;u<this.loops.length;u++)(u<n||u>c)&&(this.loop(u).depth++,l.push(this.loop(u)));for(var f=0;f<this.loops.length;f++)f>n&&f<=c&&(this.loop(f).depth--,l.push(this.loop(f)));this.loops=l,this.initLoopProperties()},e.compareLoops=function(n,r){if(n.numVertices()!==r.numVertices())return n.numVertices()-r.numVertices();var s=n.canonicalFirstVertex(),o=s[0],a=s[1],l=r.canonicalFirstVertex(),c=l[0],u=l[1];if(a!==u)return a-u;for(var f=n.numVertices()-1;f>=0;f--,o+=a,c+=u){var d=n.vertex(o).vector.cmp(r.vertex(c).vector);if(d!==0)return d}return 0},i.fromCell=function(n){return new i([fD.fromCell(n)])},e.initNested=function(){if(this.loops.length===1){this.initOneLoop();return}var n=new ode;this.loops.forEach(function(r){n.insertLoop(r,null)}),this.loops=[],this.initLoops(n),this.initLoopProperties()},e.initOneLoop=function(){this.hasHoles=!1,this.numVertices=this.loops[0].vertices.length,this.bound=this.loops[0].rectBound(),this.subregionBound=O1.expandForSubregions(this.bound),this.loops[0].depth=0,this.initEdgesAndIndex()},e.initLoopProperties=function(){this.numVertices=0,this.bound=Ri.emptyRect(),this.hasHoles=!1;for(var n=Ct(this.loops),r;!(r=n()).done;){var s=r.value;s.isHole()?this.hasHoles=!0:this.bound=this.bound.union(s.rectBound()),this.numVertices+=s.numVertices()}this.subregionBound=O1.expandForSubregions(this.bound),this.initEdgesAndIndex()},e.initEdgesAndIndex=function(){if(this.nEdges=0,this.cumulativeEdges=[],!this.isFull()){var n=12;this.loops.length>n&&(this.cumulativeEdges=[]);for(var r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;this.cumulativeEdges.length>0&&this.cumulativeEdges.push(this.nEdges),this.nEdges+=o.vertices.length}this.index=new LT,this.index.add(this)}},i.fullPolygon=function(){var n=fD.fullLoop(),r=new i;return r.loops=[n],r.numVertices=n.vertices.length,r.bound=Ri.fullRect(),r.subregionBound=Ri.fullRect(),r.initEdgesAndIndex(),r},e.validate=function(){for(var n=0;n<this.loops.length;n++){var r=this.loops[n],s=r.findValidationErrorNoIndex();if(s)return new Error("loop "+n+": "+s.message);if(r.isEmpty())return new Error("loop "+n+": empty loops are not allowed");if(r.isFull()&&this.loops.length>1)return new Error("loop "+n+": full loop appears in non-full polygon")}return this.findLoopNestingError()},e.findLoopNestingError=function(){for(var n=-1,r=0;r<this.loops.length;r++){var s=this.loops[r].depth;if(s<0||s>n+1)return new Error("loop "+r+": invalid loop depth ("+s+")");n=s}for(var o=0;o<this.loops.length;o++)for(var a=this.loops[o],l=this.lastDescendant(o),c=0;c<this.loops.length;c++)if(o!==c){var u=c>=o+1&&c<=l,f=!1;if(a.containsNonCrossingBoundary(this.loops[c],f)!==u){var d=u?"":"not ";return new Error("invalid nesting: loop "+o+" should "+d+"contain loop "+c)}}return null},e.isEmpty=function(){return this.loops.length===0},e.isFull=function(){return this.loops.length===1&&this.loops[0].isFull()},e.numLoops=function(){return this.loops.length},e.loop=function(n){return this.loops[n]},e.parent=function(n){var r,s=((r=this.loops[n])==null?void 0:r.depth)||0;if(s===0)return[-1,!1];for(n--;n>=0&&this.loops[n].depth<=s;n--);return[n,!0]},e.lastDescendant=function(n){var r;if(n<0)return this.loops.length-1;var s=((r=this.loops[n])==null?void 0:r.depth)||0;for(n++;n<this.loops.length&&this.loops[n].depth>s;n++);return n-1},e.capBound=function(){return this.bound.capBound()},e.rectBound=function(){return this.bound},e.containsPoint=function(n){if(!this.index.isFresh()&&!this.bound.containsPoint(n))return!1;var r=32;if(this.numVertices<r||this.index==null){for(var s=!1,o=Ct(this.loops),a;!(a=o()).done;){var l=a.value;s=s!==l.bruteForceContainsPoint(n)}return s}return new bp(this.index,Qf).contains(n)},e.containsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s!==wp||this.boundaryApproxIntersects(r,n)?!1:this.iteratorContainsPoint(r,n.center())},e.intersectsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s===zT?!1:s===xy||r.cellID()===n.id||this.boundaryApproxIntersects(r,n)?!0:this.iteratorContainsPoint(r,n.center())},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.boundaryApproxIntersects=function(n,r){var s=n.indexCell().findByShapeID(0);if(s.edges.length===0)return!1;if(n.cellID()===r.id)return!0;for(var o=_y+QH,a=r.boundUV().expandedByMargin(o),l=Ct(s.edges),c;!(c=l()).done;){var u=c.value,f=this.index.shape(0).edge(u),d=fy(f.v0,f.v1,r.face,o),A=d[0],y=d[1],w=d[2];if(w&&JH(A,y,a))return!0}return!1},e.iteratorContainsPoint=function(n,r){var s=n.indexCell().findByShapeID(0),o=s.containsCenter;if(s.edges.length===0)return o;for(var a=new ql(n.center(),r),l=this.index.shape(0),c=Ct(s.edges),u;!(u=c()).done;){var f=u.value,d=l.edge(f);o=o!==a.edgeOrVertexCrossing(d.v0,d.v1)}return o},e.numEdges=function(){return this.nEdges},e.edge=function(n){var r=0;if(this.cumulativeEdges.length>0){for(r=0;r<this.cumulativeEdges.length;r++)if(r+1>=this.cumulativeEdges.length||n<this.cumulativeEdges[r+1]){n-=this.cumulativeEdges[r];break}}else for(r=0;n>=this.loop(r).vertices.length;r++)n-=this.loop(r).vertices.length;return new hh(this.loop(r).orientedVertex(n),this.loop(r).orientedVertex(n+1))},e.referencePoint=function(){for(var n=!1,r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;n=n!==o.containsOrigin()}return kT(n)},e.numChains=function(){return this.numLoops()},e.chain=function(n){if(this.cumulativeEdges.length>0)return new P1(this.cumulativeEdges[n],this.loop(n).vertices.length);for(var r=0,s=0;s<n;s++)r+=this.loop(s).vertices.length;var o=this.loop(n).numVertices();return o!==1?new P1(r,o):new P1(r,0)},e.chainEdge=function(n,r){return new hh(this.loop(n).orientedVertex(r),this.loop(n).orientedVertex(r+1))},e.chainPosition=function(n){var r=0;if(this.cumulativeEdges.length>0){for(r=0;r<this.cumulativeEdges.length;r++)if(r+1>=this.cumulativeEdges.length||n<this.cumulativeEdges[r+1]){n-=this.cumulativeEdges[r];break}}else for(r=0;n>=this.loop(r).vertices.length;r++)n-=this.loop(r).vertices.length;return new UT(r,n)},e.dimension=function(){return 2},e.typeTag=function(){return xfe},e.privateInterface=function(){},e.contains=function(n){if(this.loops.length===1&&n.loops.length===1)return this.loops[0].contains(n.loops[0]);if(!this.subregionBound.contains(n.bound)&&!this.bound.lng.union(n.bound.lng).isFull())return!1;if(!this.hasHoles&&!n.hasHoles){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(!this.anyLoopContains(o))return!1}return!0}return this.containsBoundary(n)&&n.excludesNonCrossingComplementShells(this)},e.intersects=function(n){if(this.loops.length===1&&n.loops.length===1)return this.loops[0].intersects(n.loops[0]);if(!this.bound.intersects(n.bound))return!1;if(!this.hasHoles&&!n.hasHoles){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(this.anyLoopIntersects(o))return!0}return!1}return!this.excludesBoundary(n)||!n.excludesNonCrossingShells(this)},e.compareBoundary=function(n){for(var r=-1,s=0;s<this.loops.length&&r!==0;s++)r*=-this.loops[s].compareBoundary(n);return r},e.containsBoundary=function(n){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(this.compareBoundary(o)<=0)return!1}return!0},e.excludesBoundary=function(n){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(this.compareBoundary(o)>=0)return!1}return!0},e.containsNonCrossingBoundary=function(n,r){for(var s=!1,o=Ct(this.loops),a;!(a=o()).done;){var l=a.value,c=l.containsNonCrossingBoundary(n,r);s=s!=c}return s},e.excludesNonCrossingShells=function(n){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(!o.isHole()&&this.containsNonCrossingBoundary(o,!1))return!1}return!0},e.excludesNonCrossingComplementShells=function(n){if(n.isEmpty())return!this.isFull();if(n.isFull())return!0;for(var r=0;r<n.loops.length;r++){var s=n.loops[r];if(!(r>0&&!s.isHole())&&this.containsNonCrossingBoundary(s,r===0))return!1}return!0},e.anyLoopContains=function(n){for(var r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;if(o.contains(n))return!0}return!1},e.anyLoopIntersects=function(n){for(var r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;if(o.intersects(n))return!0}return!1},e.area=function(){for(var n=0,r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;n+=o.sign()*o.area()}return n},e.centroid=function(){for(var n=new We(0,0,0).vector,r=Ct(this.loops),s;!(s=r()).done;){var o=s.value,a=o.centroid().vector;o.sign()<0?n=n.sub(a):n=n.add(a)}return We.fromVector(n)},i})(),ode=(function(i){function e(){return i.apply(this,arguments)||this}dy(e,i);var t=e.prototype;return t.insertLoop=function(r,s){for(var o=[],a=!1;!a;){o=i.prototype.get.call(this,s)||[],a=!0;for(var l=Ct(o),c;!(c=l()).done;){var u=c.value;if(u.containsNested(r)){s=u,a=!1;break}}}for(var f=i.prototype.get.call(this,r)||[],d=0;d<o.length;){var A=o[d];r.containsNested(A)?(f.push(A),o.splice(d,1)):d++}i.prototype.set.call(this,r,f),i.prototype.set.call(this,s,[].concat(o,[r]))},e})(L1(Map)),ade=(function(){function i(t){t===void 0&&(t=[]),this.points=t}i.fromLatLngs=function(n){return new i(n.map(We.fromLatLng))};var e=i.prototype;return e.reverse=function(){for(var n=this.points.length,r=0;r<n/2;r++){var s=n-r-1,o=[this.points[s],this.points[r]];this.points[r]=o[0],this.points[s]=o[1]}},e.length=function(){for(var n=0,r=1;r<this.points.length;r++)n+=this.points[r-1].distance(this.points[r]);return n},e.centroid=function(){for(var n=new We(0,0,0),r=1;r<this.points.length;r++){var s=this.points[r-1].vector.add(this.points[r].vector),o=this.points[r-1].vector.sub(this.points[r].vector);n=We.fromVector(n.vector.add(s.mul(Math.sqrt(o.norm2()/s.norm2()))))}return n},e.equal=function(n){if(this.points.length!==n.points.length)return!1;for(var r=0;r<this.points.length;r++)if(!this.points[r].equals(n.points[r]))return!1;return!0},e.approxEqual=function(n,r){if(r===void 0&&(r=DH),this.points.length!==n.points.length)return!1;for(var s=0;s<this.points.length;s++)if(!this.points[s].approxEqual(n.points[s],r))return!1;return!0},e.capBound=function(){return this.rectBound().capBound()},e.rectBound=function(){for(var n=new O1,r=Ct(this.points),s;!(s=r()).done;){var o=s.value;n.addPoint(o)}return n.rectBound()},e.containsCell=function(n){return!1},e.intersectsCell=function(n){if(this.points.length===0)return!1;for(var r=Ct(this.points),s;!(s=r()).done;){var o=s.value;if(n.containsPoint(o))return!0}for(var a=[n.vertex(0),n.vertex(1),n.vertex(2),n.vertex(3)],l=0;l<4;l++)for(var c=ql.newChainEdgeCrosser(a[l],a[l+1&3],this.points[0]),u=1;u<this.points.length;u++)if(c.chainCrossingSign(this.points[u])!==Gl)return!0;return!1},e.containsPoint=function(n){return!1},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.numEdges=function(){return this.points.length===0?0:this.points.length-1},e.edge=function(n){return new hh(this.points[n],this.points[n+1])},e.referencePoint=function(){return kT(!1)},e.numChains=function(){return Math.min(1,this.numEdges())},e.chain=function(n){return new P1(0,this.numEdges())},e.chainEdge=function(n,r){return new hh(this.points[r],this.points[r+1])},e.chainPosition=function(n){return new UT(0,n)},e.dimension=function(){return 1},e.isEmpty=function(){return bfe(this)},e.isFull=function(){return wfe(this)},e.typeTag=function(){return yfe},e.privateInterface=function(){},i.findEndVertex=function(n,r,s){var o=n.points[s],a=gD(o),l=to.fullInterval(),c=0;for(s++;s<n.points.length;s++){var u=n.points[s],f=o.distance(u);if(f>Math.PI/2&&c>0||f<c&&c>r)break;if(c=f,!(f<=r)){var d=khe(a,u),A=Math.atan2(d.y,d.x);if(!l.contains(A))break;var y=Math.asin(Math.sin(r)/Math.sin(f)),w=to.fromPointPair(A,A).expanded(y);l=l.intersection(w)}}return s-1},e.subsampleVertices=function(n){var r=[];if(this.points.length<1)return r;r.push(0);for(var s=Math.max(n,0),o=0;o+1<this.points.length;){var a=i.findEndVertex(this,s,o);this.points[a].equals(this.points[o])||r.push(a),o=a}return r},e.project=function(n){if(this.points.length===1)return[this.points[0],1];for(var r=10,s=-1,o=1;o<this.points.length;o++){var a=ffe(n,this.points[o-1],this.points[o]);a<r&&(r=a,s=o)}var l=WH(n,this.points[s-1],this.points[s]);return l.equals(this.points[s])&&s++,[l,s]},e.isOnRight=function(n){var r=this.project(n),s=r[0],o=r[1];return s.equals(this.points[o-1])&&o>1&&o<this.points.length?n.equals(this.points[o-1])?!1:We.orderedCCW(this.points[o-2],n,this.points[o],this.points[o-1]):(o===this.points.length&&o--,eD(n,this.points[o],this.points[o-1]))},e.validate=function(){for(var n=0;n<this.points.length;n++)if(!this.points[n].vector.isUnit())return new Error("vertex "+n+" is not unit length");for(var r=1;r<this.points.length;r++){var s=this.points[r-1],o=this.points[r];if(s.equals(o))return new Error("vertices "+(r-1)+" and "+r+" are identical");if(s.equals(We.fromVector(o.vector.mul(-1))))return new Error("vertices "+(r-1)+" and "+r+" are antipodal")}return null},e.intersects=function(n){if(this.points.length===0||n.points.length===0||!this.rectBound().intersects(n.rectBound()))return!1;for(var r=1;r<this.points.length;r++)for(var s=ql.newChainEdgeCrosser(this.points[r-1],this.points[r],n.points[0]),o=1;o<n.points.length;o++)if(s.chainCrossingSign(n.points[o])!==Gl)return!0;return!1},e.interpolate=function(n){if(n<=0)return[this.points[0],1];for(var r=n*this.length(),s=1;s<this.points.length;s++){var o=this.points[s-1].distance(this.points[s]);if(r<o){var a=jH(r,this.points[s-1],this.points[s]);return a.equals(this.points[s])?[a,s+1]:[a,s]}r-=o}return[this.points[this.points.length-1],this.points.length]},e.uninterpolate=function(n,r){if(this.points.length<2)return 0;for(var s=0,o=1;o<r;o++)s+=this.points[o-1].distance(this.points[o]);for(var a=s+this.points[r-1].distance(n),l=r;l<this.points.length;l++)s+=this.points[l-1].distance(this.points[l]);return Math.min(1,a/s)},i})(),yH=(function(){function i(){}var e=i.prototype;return e.capBound=function(){return xp.emptyCap()},e.rectBound=function(){return Ri.emptyRect()},e.containsCell=function(n){return!1},e.intersectsCell=function(n){return!1},e.containsPoint=function(n){return!1},e.cellUnionBound=function(){return[]},i})(),dD=(function(){function i(t){var n=t===void 0?{}:t,r=n.minLevel,s=r===void 0?0:r,o=n.maxLevel,a=o===void 0?_i:o,l=n.levelMod,c=l===void 0?1:l,u=n.maxCells,f=u===void 0?8:u;this.minLevel=s,this.maxLevel=a,this.levelMod=c,this.maxCells=f}var e=i.prototype;return e.coverer=function(){return new aW(Math.max(0,Math.min(_i,this.minLevel)),Math.max(0,Math.min(_i,this.maxLevel)),Math.max(1,Math.min(3,this.levelMod)),this.maxCells)},e.covering=function(n){var r=this.cellUnion(n);return r.denormalize(Math.max(0,Math.min(_i,this.minLevel)),Math.max(1,Math.min(3,this.levelMod))),r},e.interiorCovering=function(n){var r=this.interiorCellUnion(n);return r.denormalize(Math.max(0,Math.min(_i,this.minLevel)),Math.max(1,Math.min(3,this.levelMod))),r},e.cellUnion=function(n){var r=this.coverer();r.coveringInternal(n);var s=r.result;return s.normalize(),s},e.interiorCellUnion=function(n){var r=this.coverer();r.interiorCovering=!0,r.coveringInternal(n);var s=r.result;return s.normalize(),s},e.fastCovering=function(n){var r=this.coverer(),s=ay(F1,n.cellUnionBound());return r.normalizeCovering(s),s},e.isCanonical=function(n){return this.coverer().isCanonical(n)},i})(),aW=(function(){function i(t,n,r,s){this.region=new yH,this.result=new F1,this.pq=new cde,this.interiorCovering=!1,this.minLevel=t,this.maxLevel=n,this.levelMod=r,this.maxCells=s}var e=i.prototype;return e.newCandidate=function(n){if(!this.region.intersectsCell(n))return new sy;var r=new lde(n),s=n.level;if(s>=this.minLevel)if(this.interiorCovering){if(this.region.containsCell(n))r.terminal=!0;else if(s+this.levelMod>this.maxLevel)return new sy}else(s+this.levelMod>this.maxLevel||this.region.containsCell(n))&&(r.terminal=!0);return r},e.expandChildren=function(n,r,s){s--;for(var o=0,a=VH(r.id),l=bD(r.id);l!==a;l=Pa(l)){var c=Ia.fromCellID(l);if(s>0){this.region.intersectsCell(c)&&(o+=this.expandChildren(n,c,s));continue}var u=this.newCandidate(c);u instanceof sy||(n.children.push(u),n.numChildren++,u.terminal&&o++)}return o},e.addCandidate=function(n){if(!(n instanceof sy)){if(n.terminal){this.result.push(n.cell.id);return}var r=this.levelMod,s=n.cell.level;s<this.minLevel&&(r=1);var o=this.expandChildren(n,n.cell,r),a=2*this.levelMod;n.numChildren!==0&&(!this.interiorCovering&&o===1<<a&&s>=this.minLevel?(n.terminal=!0,this.addCandidate(n)):(n.priority=-((s<<a)+n.numChildren<<a+o),this.pq.push(n)))}},e.adjustLevel=function(n){return this.levelMod>1&&n>this.minLevel&&(n-=(n-this.minLevel)%this.levelMod),n},e.adjustCellLevels=function(n){if(this.levelMod!==1){for(var r=0,s=Ct(n),o;!(o=s()).done;){var a=o.value,l=no(a),c=this.adjustLevel(l);if(c!==l&&(a=Tr(a,c)),!(r>0&&$m(n[r-1],a))){for(;r>0&&$m(a,n[r-1]);)r--;n[r]=a,r++}}n.length=r}},e.initialCandidates=function(n){var r=new dD;r.maxLevel=this.maxLevel,r.levelMod=1,r.maxCells=Math.min(4,this.maxCells);var s=r.fastCovering(n);this.adjustCellLevels(s);for(var o=Ct(s),a;!(a=o()).done;){var l=a.value;this.addCandidate(this.newCandidate(Ia.fromCellID(l)))}},e.coveringInternal=function(n){for(this.region=n,this.initialCandidates(n);this.pq.length>0&&(!this.interiorCovering||this.result.length<this.maxCells);){var r=this.pq.pop();if(this.interiorCovering||r.cell.level<this.minLevel||r.numChildren===1||this.result.length+this.pq.length+r.numChildren<=this.maxCells)for(var s=Ct(r.children),o;!(o=s()).done;){var a=o.value;(!this.interiorCovering||this.result.length<this.maxCells)&&this.addCandidate(a)}else r.terminal=!0,this.addCandidate(r)}this.region=new yH,this.pq.reset(),this.result.normalize(),(this.minLevel>0||this.levelMod>1)&&this.result.denormalize(this.minLevel,this.levelMod)},e.normalizeCovering=function(n){if(this.maxLevel<_i||this.levelMod>1)for(var r=0;r<n.length;r++){var s=no(n[r]),o=this.adjustLevel(Math.min(s,this.maxLevel));o!==s&&(n[r]=Tr(n[r],o))}n.normalize(),(this.minLevel>0||this.levelMod>1)&&n.denormalize(this.minLevel,this.levelMod);var a=n.length-this.maxCells;if(!(a<=0||this.isCanonical(n))){if(a*n.length>1e4){var l=new dD,c=l.covering(n);n.length=0,n.push.apply(n,c);return}for(;n.length>this.maxCells;){for(var u=-1,f=-1,d=0;d+1<n.length;d++){var A=hy(n[d],n[d+1]),y=A[0],w=A[1];if(w){var S=this.adjustLevel(y);S>f&&(f=S,u=d)}}if(f<this.minLevel)break;var T=Tr(n[u],f),R=this.replaceCellsWithAncestor(n,T);for(n.length=0,n.push.apply(n,R);f>this.minLevel&&(f-=this.levelMod,T=Tr(T,f),!!this.containsAllChildren(n,T));){var P=this.replaceCellsWithAncestor(n,T);n.length=0,n.push.apply(n,P)}}}},e.isCanonical=function(n){var r=this.maxLevel;this.levelMod!==1&&(r=this.maxLevel-(this.maxLevel-this.minLevel)%this.levelMod);for(var s=n.length>this.maxCells,o=1,a=0n,l=Ct(n),c;!(c=l()).done;){var u=c.value;if(!uy(u))return!1;var f=no(u);if(f<this.minLevel||f>r||this.levelMod>1&&(f-this.minLevel)%this.levelMod!==0)return!1;if(a!==0n){if(Gi(a)>=qi(u))return!1;var d=hy(u,a),A=d[0],y=d[1];if(s&&y&&A>=this.minLevel)return!1;var w=f-this.levelMod;if(w<this.minLevel||f!==no(a)||Tr(u,w)!==Tr(a,w))o=1;else if(o++,o===1<<2*this.levelMod)return!1}a=u}return!0},e.containsAllChildren=function(n,r){for(var s=n.findIndex(function(l){return l>=qi(r)}),o=no(r)+this.levelMod,a=vy(r,o);a!==OT(r,o);a=Pa(a)){if(s===-1||n[s]!==a)return!1;s++}return!0},e.replaceCellsWithAncestor=function(n,r){var s=rD(n.length,function(a){return n[a]>qi(r)}),o=rD(n.length,function(a){return n[a]>Gi(r)});return[].concat(n.slice(0,s),[r],n.slice(o))},i})(),lde=function(e){this.terminal=!1,this.numChildren=0,this.children=[],this.priority=0,this.cell=e},sy=function(){this.cell=Ia.fromCellID(fl),this.terminal=!1,this.numChildren=0,this.children=[],this.priority=0},cde=(function(i){function e(){return i.apply(this,arguments)||this}dy(e,i);var t=e.prototype;return t.len=function(){return this.length},t.swap=function(r,s){var o=[this[s],this[r]];this[r]=o[0],this[s]=o[1]},t.push=function(){for(var r,s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];var l=(r=i.prototype.push).call.apply(r,[this].concat(o));return this.sort(e.ascending),l},t.pop=function(){var r=i.prototype.pop.call(this);return r||new sy},t.reset=function(){this.length=0},e.ascending=function(r,s){return r.priority<s.priority?-1:r.priority>s.priority?1:0},e})(L1(Array)),Gn={__proto__:null,cellid:cfe,Cap:xp,Cell:Ia,CellIndex:vfe,CellIndexRangeIterator:XH,CellIndexContentsIterator:$H,CellUnion:F1,ClosestCellQuery:Kfe,ClosestCellQueryOptions:iW,PointTarget:jfe,EdgeTarget:Xfe,CellTarget:$fe,CellUnionTarget:Yfe,ShapeIndexTarget:Zfe,ClosestEdgeQuery:qfe,ClosestEdgeQueryOptions:eW,EdgeQueryPointTarget:zfe,EdgeQueryEdgeTarget:Vfe,EdgeQueryCellTarget:Gfe,EdgeQueryShapeIndexTarget:tW,LatLng:ar,Loop:fD,Point:We,Polygon:sde,Polyline:ade,Rect:Ri,RegionCoverer:dD,Coverer:aW,ShapeIndex:LT};function Au(i){return i?.collectionId}function V1(i){return O.world?.collectionsById?.get(i?.collectionId)}function G1(){return(O.world?.collections||[]).some(i=>i.kind!=="point"&&!Po(i.id))}function Po(i){return O.hiddenCollections.has(i)}function lW(i){let e=new Map;for(let t of i){let n=Au(t.zone);e.has(n)||e.set(n,[]),e.get(n).push(t)}return e}function cW(i,e){for(let t of i.values())if(!t.some(r=>r.geometries.some(s=>TD(s,e))))return!1;return!0}function TD(i,e){if(i.intersectsCoordinate(e))return!0;let t=i.getClosestPoint(e),n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r<=1}var ude=Object.freeze({point:"point",path:"path",area:"area"}),uW=Object.freeze({always:"always",quiet:"quiet"});function Jf(i,e){let t=e??V1(i),n=O.labelOverrides.get(t?.id);if(n)return n;let r=t?.attrs?.["atlas.label.policy"];return r||(t?.kind===ude.path?uW.quiet:uW.always)}function gu(i){return O.renderOverrides.get(i?.id)??(i.attrs?.["atlas.render.as"]||"pin")}var hde={"atlas.hydro.huc12":"HUC-12"},fde=new Set(["atlas.geo.lat","atlas.geo.lon"]),dde=["atlas.render.","atlas.label.","atlas.stroke.","atlas.geometry."];function ED(i){let e=[];for(let[t,n]of Object.entries(i||{}))fde.has(t)||dde.some(r=>t.startsWith(r))||e.push({label:hde[t]||t,value:n});return e.sort((t,n)=>t.label.localeCompare(n.label))}function VT(i){return i?.attrs?.["atlas.geometry.surface"]||"plane"}function yy(i){let e=fh(i);return e||pde(i)}function pde(i){let e=i?.attrs||{};if(e["atlas.geometry.projection"]!=="mercator")return null;let t=(e["atlas.geometry.mercator.px"]||"").split(",").map(Number),n=(e["atlas.geometry.mercator.deg"]||"").split(",").map(Number);if(t.length!==4||n.length!==4||t.some(Number.isNaN)||n.some(Number.isNaN))return null;let[r,s,o,a]=t,[l,c,u,f]=n;if(!o||!a||c===f||l===u)return null;let d=S=>Math.asinh(Math.tan(S*Math.PI/180)),A=S=>Math.atan(Math.sinh(S))*180/Math.PI,y=d(c),w=d(f);return{toLatLng(S,T){return[A(y-(T-s)/a*(y-w)),l+(S-r)/o*(u-l)]},toWorld(S,T){return[r+(T-l)/(u-l)*o,s+(y-d(S))/(y-w)*a]}}}function fh(i){let e=i?.attrs||{};if(e["atlas.geometry.projection"]!=="equirect")return null;let t=(e["atlas.geometry.equirect.px"]||"").split(",").map(Number),n=(e["atlas.geometry.equirect.deg"]||"").split(",").map(Number);if(t.length!==4||n.length!==4||t.some(Number.isNaN)||n.some(Number.isNaN))return null;let[r,s,o,a]=t,[l,c,u,f]=n;return!o||!a||c===f||l===u?null:{toLatLng(d,A){return[c-(A-s)/a*(c-f),l+(d-r)/o*(u-l)]},toWorld(d,A){return[r+(A-l)/(u-l)*o,s+(c-d)/(c-f)*a]}}}var by=10,hW=i=>i+1,fW=i=>Gn.cellid.level(Gn.cellid.fromToken(i)),MD={map:null,mapping:null};function GT(){return MD.map!==O.world&&(MD={map:O.world,mapping:yy(O.world)}),MD.mapping}function mde(i){let e=GT();if(!e)return null;let[t,n]=e.toLatLng(i[0],-i[1]);return Gn.LatLng.fromDegrees(t,n)}function dW(i){let e=Gn.LatLng.fromPoint(i);return[e.lat*180/Math.PI,e.lng*180/Math.PI]}var pW=new WeakMap;function CD(i){let e=GT();if(!e)return 0n;let t=pW.get(i);if(t&&t.mapping===e)return t.leaf;let n=mde(i),r=n?Gn.cellid.fromLatLng(n):0n;return typeof i=="object"&&pW.set(i,{mapping:e,leaf:r}),r}var mW={slug:"s2",name:"S2",short:"S2",appliesTo(i){return VT(i)==="sphere"&&yy(i)!==null},maxLevel(){return hW(by)},inputLength(){return 6},level(i){return i===""?0:hW(fW(i))},parent(i){let e=Gn.cellid.fromToken(i),t=Gn.cellid.level(e);return t===0?"":Gn.cellid.toToken(Gn.cellid.parent(e,t-1))},children(i){return i===""?[0,1,2,3,4,5].map(e=>Gn.cellid.toToken(Gn.cellid.fromFace(e))):Gn.cellid.children(Gn.cellid.fromToken(i)).map(Gn.cellid.toToken)},childIndex(i){let e=Gn.cellid.fromToken(i),t=Gn.cellid.level(e);return t===0?Gn.cellid.face(e):Gn.cellid.childPosition(e,t)},contains(i,e){return Gn.cellid.contains(Gn.cellid.fromToken(i),CD(e))},descendTarget(i,e){let t=CD(e);if(t===0n)return"";let n=i===""?0:fW(i)+1;return n>by?"":Gn.cellid.toToken(Gn.cellid.parent(t,n))},bbox(i){if(i==="")return Yf();let e=this.ring(i),t=1/0,n=1/0,r=-1/0,s=-1/0;for(let[o,a]of e)t=Math.min(t,o),n=Math.min(n,a),r=Math.max(r,o),s=Math.max(s,a);return[t,n,r,s]},center(i){let e=GT(),[t,n]=dW(Gn.Cell.fromCellID(Gn.cellid.fromToken(i)).center()),[r,s]=e.toWorld(t,n);return[r,-s]},ring(i){let e=GT(),t=Gn.Cell.fromCellID(Gn.cellid.fromToken(i)),n=Gn.cellid.level(Gn.cellid.fromToken(i)),r=Math.max(2,Math.min(16,2**(4-n)*2)),s=Yf(),o=s[2]-s[0],a=[];for(let u=0;u<4;u++){let f=t.vertex(u).vector,d=t.vertex((u+1)%4).vector;for(let A=0;A<r;A++){let y=A/r,w=f.x+(d.x-f.x)*y,S=f.y+(d.y-f.y)*y,T=f.z+(d.z-f.z)*y,R=Math.hypot(w,S,T)||1,[P,I]=dW(new Gn.Point(w/R,S/R,T/R)),[F,D]=e.toWorld(P,I);a.push([F,-D])}}for(let u=1;u<a.length;u++){let f=a[u][0]-a[u-1][0];f>o/2?a[u][0]-=o:f<-o/2&&(a[u][0]+=o)}let l=[...a[0]],c=l[0]-a[a.length-1][0];return c>o/2?l[0]-=o:c<-o/2&&(l[0]+=o),a.push(l),a},poleContained(i){let e=Gn.cellid.fromToken(i);return Gn.cellid.contains(e,Gn.cellid.fromLatLng(Gn.LatLng.fromDegrees(90,0)))?"north":Gn.cellid.contains(e,Gn.cellid.fromLatLng(Gn.LatLng.fromDegrees(-90,0)))?"south":null},label(i){return{context:i.slice(0,-1),principal:i.slice(-1)}},colorKey(i){return this.childIndex(i)%$f.length},normalizeInput(i){return[...i.toLocaleLowerCase()].filter(e=>"0123456789abcdef".includes(e)).slice(0,6).join("")},parseInput(i){if(i==="")return"";let e=Gn.cellid.fromToken(i);return e===0n||!Gn.cellid.valid(e)?null:Gn.cellid.level(e)>by?Gn.cellid.toToken(Gn.cellid.parent(e,by)):Gn.cellid.toToken(e)},locate(i){let e=CD(i);return e===0n?null:{label:"S2",value:Gn.cellid.toToken(Gn.cellid.parent(e,by))}}};function Yf(){let i=O.lens?.surface;if(i)return[i.x,-(i.y+i.height),i.x+i.width,-i.y];let e=O.volume?.tileGrid.size??0,t=O.lens?.bounds||{x:0,y:0,width:e,height:e};return[t.x,-(t.y+t.height),t.x+t.width,-t.y]}var gW=[kL,mW];function wy(i){return gW.filter(e=>e.appliesTo(i))}function Ts(){return gW.find(i=>i.slug===O.gridSystem)||kL}function vW(i,e,t,n){if(!t)return"";let r=i.center(t),s=AW(i.bbox(t)),o="",a="",l=1/0;for(;e.level(o)<e.maxLevel(n);){let c=e.descendTarget(o,r);if(!c)break;let u=AW(e.bbox(c)),f=Math.abs(Math.log(u/s));if(f<l&&(a=c,l=f),u<=s)break;o=c}return a}function AW([i,e,t,n]){return(t-i)*(n-e)}function _W(i,e,t){let n=i[0]===i[i.length-1]||Ade(i[0],i[i.length-1])?i.slice(0,-1):[...i];for(let[r,s]of[[e,([o])=>o>=e],[t,([o])=>o<=t]]){let o=[];for(let a=0;a<n.length;a++){let l=n[a],c=n[(a+n.length-1)%n.length],u=s(l),f=s(c);if(u!==f){let d=(r-c[0])/(l[0]-c[0]);o.push([r,c[1]+d*(l[1]-c[1])])}u&&o.push(l)}if(n=o,n.length===0)return[]}return[...n,n[0]]}function Ade(i,e){return i[0]===e[0]&&i[1]===e[1]}var Us={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function RD(i){let e=jr();for(let t=0,n=i.length;t<n;++t)Jm(e,i[t]);return e}function gde(i,e,t){let n=Math.min.apply(null,i),r=Math.min.apply(null,e),s=Math.max.apply(null,i),o=Math.max.apply(null,e);return Hl(n,r,s,o,t)}function q1(i,e,t){return t?(t[0]=i[0]-e,t[1]=i[1]-e,t[2]=i[2]+e,t[3]=i[3]+e,t):[i[0]-e,i[1]-e,i[2]+e,i[3]+e]}function HT(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function Lc(i,e,t){let n,r;return e<i[0]?n=i[0]-e:i[2]<e?n=e-i[2]:n=0,t<i[1]?r=i[1]-t:i[3]<t?r=t-i[3]:r=0,n*n+r*r}function vu(i,e){return Sy(i,e[0],e[1])}function dh(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function Sy(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function qT(i,e){let t=i[0],n=i[1],r=i[2],s=i[3],o=e[0],a=e[1],l=Us.UNKNOWN;return o<t?l=l|Us.LEFT:o>r&&(l=l|Us.RIGHT),a<n?l=l|Us.BELOW:a>s&&(l=l|Us.ABOVE),l===Us.UNKNOWN&&(l=Us.INTERSECTING),l}function jr(){return[1/0,1/0,-1/0,-1/0]}function Hl(i,e,t,n,r){return r?(r[0]=i,r[1]=e,r[2]=t,r[3]=n,r):[i,e,t,n]}function Km(i){return Hl(1/0,1/0,-1/0,-1/0,i)}function WT(i,e){let t=i[0],n=i[1];return Hl(t,n,t,n,e)}function H1(i,e,t,n,r){let s=Km(r);return ID(s,i,e,t,n)}function Qm(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function jT(i,e){return e[0]<i[0]&&(i[0]=e[0]),e[2]>i[2]&&(i[2]=e[2]),e[1]<i[1]&&(i[1]=e[1]),e[3]>i[3]&&(i[3]=e[3]),i}function Jm(i,e){e[0]<i[0]&&(i[0]=e[0]),e[0]>i[2]&&(i[2]=e[0]),e[1]<i[1]&&(i[1]=e[1]),e[1]>i[3]&&(i[3]=e[1])}function ID(i,e,t,n,r){for(;t<n;t+=r)vde(i,e[t],e[t+1]);return i}function vde(i,e,t){i[0]=Math.min(i[0],e),i[1]=Math.min(i[1],t),i[2]=Math.max(i[2],e),i[3]=Math.max(i[3],t)}function XT(i,e){let t;return t=e(W1(i)),t||(t=e(j1(i)),t)||(t=e(X1(i)),t)||(t=e(Dc(i)),t)?t:!1}function Ty(i){let e=0;return mh(i)||(e=Kn(i)*Nr(i)),e}function W1(i){return[i[0],i[1]]}function j1(i){return[i[2],i[1]]}function dl(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function xW(i,e){let t;if(e==="bottom-left")t=W1(i);else if(e==="bottom-right")t=j1(i);else if(e==="top-left")t=Dc(i);else if(e==="top-right")t=X1(i);else throw new Error("Invalid corner");return t}function Ey(i,e,t,n,r){let[s,o,a,l,c,u,f,d]=PD(i,e,t,n);return Hl(Math.min(s,a,c,f),Math.min(o,l,u,d),Math.max(s,a,c,f),Math.max(o,l,u,d),r)}function PD(i,e,t,n){let r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(t),a=Math.sin(t),l=r*o,c=r*a,u=s*o,f=s*a,d=i[0],A=i[1];return[d-l+f,A-c-u,d-l-f,A-c+u,d+l-f,A+c+u,d+l+f,A+c-u,d-l+f,A-c-u]}function Nr(i){return i[3]-i[1]}function ph(i,e,t){let n=t||jr();return Ar(i,e)?(i[0]>e[0]?n[0]=i[0]:n[0]=e[0],i[1]>e[1]?n[1]=i[1]:n[1]=e[1],i[2]<e[2]?n[2]=i[2]:n[2]=e[2],i[3]<e[3]?n[3]=i[3]:n[3]=e[3]):Km(n),n}function LD(i,e){if(!Ar(i,e))return[i.slice()];if(dh(e,i))return[];let[t,n,r,s]=i,o=Math.max(t,e[0]),a=Math.max(n,e[1]),l=Math.min(r,e[2]),c=Math.min(s,e[3]),u=[];return o>t&&u.push([t,n,o,s]),l<r&&u.push([l,n,r,s]),a>n&&u.push([o,n,l,a]),c<s&&u.push([o,c,l,s]),u}function Dc(i){return[i[0],i[3]]}function X1(i){return[i[2],i[3]]}function Kn(i){return i[2]-i[0]}function Ar(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function mh(i){return i[2]<i[0]||i[3]<i[1]}function yW(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function bW(i,e,t){let n=!1,r=qT(i,e),s=qT(i,t);if(r===Us.INTERSECTING||s===Us.INTERSECTING)n=!0;else{let o=i[0],a=i[1],l=i[2],c=i[3],u=e[0],f=e[1],d=t[0],A=t[1],y=(A-f)/(d-u),w,S;s&Us.ABOVE&&!(r&Us.ABOVE)&&(w=d-(A-c)/y,n=w>=o&&w<=l),!n&&s&Us.RIGHT&&!(r&Us.RIGHT)&&(S=A-(d-l)*y,n=S>=a&&S<=c),!n&&s&Us.BELOW&&!(r&Us.BELOW)&&(w=d-(A-a)/y,n=w>=o&&w<=l),!n&&s&Us.LEFT&&!(r&Us.LEFT)&&(S=A-(d-o)*y,n=S>=a&&S<=c)}return n}function wW(i,e,t,n){if(mh(i))return Km(t);let r=[];if(n>1){let a=i[2]-i[0],l=i[3]-i[1];for(let c=0;c<n;++c)r.push(i[0]+a*c/n,i[1],i[2],i[1]+l*c/n,i[2]-a*c/n,i[3],i[0],i[3]-l*c/n)}else r=[i[0],i[1],i[2],i[1],i[2],i[3],i[0],i[3]];e(r,r,2);let s=[],o=[];for(let a=0,l=r.length;a<l;a+=2)s.push(r[a]),o.push(r[a+1]);return gde(s,o,t)}function DD(i,e){let t=e.getExtent(),n=dl(i);if(e.canWrapX()&&(n[0]<t[0]||n[0]>=t[2])){let r=Kn(t),o=Math.floor((n[0]-t[0])/r)*r;i[0]-=o,i[2]-=o}return i}function $T(i,e,t){if(e.canWrapX()){let n=e.getExtent();if(!isFinite(i[0])||!isFinite(i[2]))return[[n[0],i[1],n[2],i[3]]];DD(i,e);let r=Kn(n);if(Kn(i)>r&&!t)return[[n[0],i[1],n[2],i[3]]];if(i[0]<n[0])return[[i[0]+r,i[1],n[2],i[3]],[n[0],i[1],i[2],i[3]]];if(i[2]>n[2])return[[i[0],i[1],n[2],i[3]],[n[0],i[1],i[2]-r,i[3]]]}return[i]}function SW(i,e){let t=[i];for(let n=0,r=e.length;n<r&&t.length>0;++n){let s=[];for(let o=0,a=t.length;o<a;++o)s.push(...LD(t[o],e[n]));t=s}return t}var TW={info:1,warn:2,error:3,none:4},_de=TW.info;function YT(...i){_de>TW.warn||console.warn(...i)}function Si(i,e,t){return Math.min(Math.max(i,e),t)}function EW(i,e,t,n,r,s){let o=r-t,a=s-n;if(o!==0||a!==0){let l=((i-t)*o+(e-n)*a)/(o*o+a*a);l>1?(t=r,n=s):l>0&&(t+=o*l,n+=a*l)}return _u(i,e,t,n)}function _u(i,e,t,n){let r=t-i,s=n-e;return r*r+s*s}function MW(i){let e=i.length;for(let n=0;n<e;n++){let r=n,s=Math.abs(i[n][n]);for(let a=n+1;a<e;a++){let l=Math.abs(i[a][n]);l>s&&(s=l,r=a)}if(s===0)return null;let o=i[r];i[r]=i[n],i[n]=o;for(let a=n+1;a<e;a++){let l=-i[a][n]/i[n][n];for(let c=n;c<e+1;c++)n==c?i[a][c]=0:i[a][c]+=l*i[n][c]}}let t=new Array(e);for(let n=e-1;n>=0;n--){t[n]=i[n][e]/i[n][n];for(let r=n-1;r>=0;r--)i[r][e]-=i[r][n]*t[n]}return t}function ZT(i){return i*180/Math.PI}function xu(i){return i*Math.PI/180}function Ah(i,e){let t=i%e;return t*e<0?t+e:t}function Lo(i,e,t){return i+t*(e-i)}function eA(i,e){let t=Math.pow(10,e);return Math.round(i*t)/t}function My(i,e){return Math.floor(eA(i,e))}function Cy(i,e){return Math.ceil(eA(i,e))}function KT(i,e,t){if(i>=e&&i<t)return i;let n=t-e;return((i-e)%n+n)%n+e}function CW(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function tA(i,e){let t=!0;for(let n=i.length-1;n>=0;--n)if(i[n]!=e[n]){t=!1;break}return t}function $1(i,e){let t=Math.cos(e),n=Math.sin(e),r=i[0]*t-i[1]*n,s=i[1]*t+i[0]*n;return i[0]=r,i[1]=s,i}function RW(i,e){return i[0]*=e,i[1]*=e,i}function QT(i,e){if(e.canWrapX()){let t=Kn(e.getExtent()),n=IW(i,e,t);n&&(i[0]-=n*t)}return i}function IW(i,e,t){let n=e.getExtent(),r=0;return e.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(t=t||Kn(n),r=Math.floor((i[0]-n[0])/t)),r}function PW(i,e,t){let n=Math.sqrt((e[0]-i[0])*(e[0]-i[0])+(e[1]-i[1])*(e[1]-i[1])),r=[(e[0]-i[0])/n,(e[1]-i[1])/n],s=[-r[1],r[0]],o=Math.sqrt((t[0]-i[0])*(t[0]-i[0])+(t[1]-i[1])*(t[1]-i[1])),a=[(t[0]-i[0])/o,(t[1]-i[1])/o],l=n===0||o===0?0:Math.acos(Si(a[0]*r[0]+a[1]*r[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:Math.PI*2-l}var ed={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var ND=class{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent!==void 0?e.extent:null,this.worldExtent_=e.worldExtent!==void 0?e.worldExtent:null,this.axisOrientation_=e.axisOrientation!==void 0?e.axisOrientation:"enu",this.global_=e.global!==void 0?e.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||ed[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}},Tp=ND;var Ry=6378137,Y1=Math.PI*Ry,xde=[-Y1,-Y1,Y1,Y1],yde=[-180,-85,180,85],JT=Ry*Math.log(Math.tan(Math.PI/2)),Ep=class extends Tp{constructor(e){super({code:e,units:"m",extent:xde,global:!0,worldExtent:yde,getPointResolution:function(t,n){return t/Math.cosh(n[1]/Ry)}})}},FD=[new Ep("EPSG:3857"),new Ep("EPSG:102100"),new Ep("EPSG:102113"),new Ep("EPSG:900913"),new Ep("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ep("http://www.opengis.net/gml/srs/epsg.xml#3857")];function LW(i,e,t,n){let r=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(r));for(let s=0;s<r;s+=n){e[s]=Y1*i[s]/180;let o=Ry*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>JT?o=JT:o<-JT&&(o=-JT),e[s+1]=o}return e}function DW(i,e,t,n){let r=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(r));for(let s=0;s<r;s+=n)e[s]=180*i[s]/Y1,e[s+1]=360*Math.atan(Math.exp(i[s+1]/Ry))/Math.PI-90;return e}var bde=6378137,NW=[-180,-90,180,90],wde=Math.PI*bde/180,td=class extends Tp{constructor(e,t){super({code:e,units:"degrees",extent:NW,axisOrientation:t,global:!0,metersPerUnit:wde,worldExtent:NW})}},BD=[new td("CRS:84"),new td("EPSG:4326","neu"),new td("urn:ogc:def:crs:OGC:1.3:CRS84"),new td("urn:ogc:def:crs:OGC:2:84"),new td("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new td("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new td("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var OD={};function FW(i){return OD[i]||OD[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function BW(i,e){OD[i]=e}function gh(i){for(let e in i)delete i[e]}function yu(i){let e;for(e in i)return!1;return!e}var Z1={};function K1(i,e,t){let n=i.getCode(),r=e.getCode();n in Z1||(Z1[n]={}),Z1[n][r]=t}function eE(i,e){return i in Z1&&e in Z1[i]?Z1[i][e]:null}var tE=.9996,Nc=.00669438,iE=Nc*Nc,rE=iE*Nc,nA=Nc/(1-Nc),OW=Math.sqrt(1-Nc),Q1=(1-OW)/(1+OW),VW=Q1*Q1,UD=VW*Q1,kD=UD*Q1,GW=kD*Q1,qW=1-Nc/4-3*iE/64-5*rE/256,Sde=3*Nc/8+3*iE/32+45*rE/1024,Tde=15*iE/256+45*rE/1024,Ede=35*rE/3072,Mde=3/2*Q1-27/32*UD+269/512*GW,Cde=21/16*VW-55/32*kD,Rde=151/96*UD-417/128*GW,Ide=1097/512*kD,nE=6378137;function Pde(i,e,t){let n=i-5e5,o=(t.north?e:e-1e7)/tE/(nE*qW),a=o+Mde*Math.sin(2*o)+Cde*Math.sin(4*o)+Rde*Math.sin(6*o)+Ide*Math.sin(8*o),l=Math.sin(a),c=l*l,u=Math.cos(a),f=l/u,d=f*f,A=d*d,y=1-Nc*c,w=Math.sqrt(1-Nc*c),S=nE/w,T=(1-Nc)/y,R=nA*u**2,P=R*R,I=n/(S*tE),F=I*I,D=F*I,L=D*I,C=L*I,B=C*I,k=a-f/T*(F/2-L/24*(5+3*d+10*R-4*P-9*nA))+B/720*(61+90*d+298*R+45*A-252*nA-3*P),z=(I-D/6*(1+2*d+R)+C/120*(5-2*R+28*d-3*P+8*nA+24*A))/u;return z=KT(z+xu(HW(t.number)),-Math.PI,Math.PI),[ZT(z),ZT(k)]}var UW=-80,kW=84,Lde=-180,Dde=180;function Nde(i,e,t){i=KT(i,Lde,Dde),e<UW?e=UW:e>kW&&(e=kW);let n=xu(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,c=xu(i),u=HW(t.number),f=xu(u),d=nE/Math.sqrt(1-Nc*r**2),A=nA*s**2,y=s*KT(c-f,-Math.PI,Math.PI),w=y*y,S=w*y,T=S*y,R=T*y,P=R*y,I=nE*(qW*n-Sde*Math.sin(2*n)+Tde*Math.sin(4*n)-Ede*Math.sin(6*n)),F=tE*d*(y+S/6*(1-a+A)+R/120*(5-18*a+l+72*A-58*nA))+5e5,D=tE*(I+d*o*(w/2+T/24*(5-a+9*A+4*A**2)+P/720*(61-58*a+l+600*A-330*nA)));return t.north||(D+=1e7),[F,D]}function HW(i){return(i-1)*6-180+3}var Fde=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function WW(i){let e=0;for(let r of Fde){let s=i.match(r);if(s){e=parseInt(s[1]);break}}if(!e)return null;let t=0,n=!1;return e>32700&&e<32761?t=e-32700:e>32600&&e<32661&&(n=!0,t=e-32600),t?{number:t,north:n}:null}function zW(i,e){return function(t,n,r,s){let o=t.length;r=r>1?r:2,s=s??r,n||(r>2?n=t.slice():n=new Array(o));for(let a=0;a<o;a+=s){let l=t[a],c=t[a+1],u=i(l,c,e);n[a]=u[0],n[a+1]=u[1]}return n}}function jW(i){return WW(i)?new Tp({code:i,units:"m"}):null}function XW(i){let e=WW(i.getCode());return e?{forward:zW(Nde,e),inverse:zW(Pde,e)}:null}var Bde=63710088e-1;function zD(i,e,t){t=t||Bde;let n=xu(i[1]),r=xu(e[1]),s=(r-n)/2,o=xu(e[0]-i[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*t*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}var Ode=[XW],Ude=[jW];var GD=!0;function YW(i){GD=!(i===void 0?!0:i)}function HD(i,e){if(e!==void 0){for(let t=0,n=i.length;t<n;++t)e[t]=i[t];e=e}else e=i.slice();return e}function qD(i){BW(i.getCode(),i),K1(i,i,HD)}function kde(i){i.forEach(qD)}function ks(i){if(typeof i!="string")return i;let e=FW(i);if(e)return e;for(let t of Ude){let n=t(i);if(n)return n}return null}function WD(i,e,t,n){i=ks(i);let r,s=i.getPointResolutionFunc();if(s){if(r=s(e,t),n&&n!==i.getUnits()){let o=i.getMetersPerUnit();o&&(r=r*o/ed[n])}}else{let o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{let a=iA(i,ks("EPSG:4326"));if(!a&&o!=="degrees")r=e*i.getMetersPerUnit();else{let c=[t[0]-e/2,t[1],t[0]+e/2,t[1],t[0],t[1]-e/2,t[0],t[1]+e/2];c=a(c,c,2);let u=zD(c.slice(0,2),c.slice(2,4)),f=zD(c.slice(4,6),c.slice(6,8));r=(u+f)/2}let l=n?ed[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function $W(i){kde(i),i.forEach(function(e){i.forEach(function(t){e!==t&&K1(e,t,HD)})})}function zde(i,e,t,n){i.forEach(function(r){e.forEach(function(s){K1(r,s,t),K1(s,r,n)})})}function sE(i,e){return i?typeof i=="string"?ks(i):i:ks(e)}function ZW(i){return(function(e,t,n,r){let s=e.length;n=n!==void 0?n:2,r=r??n,t=t!==void 0?t:new Array(s);for(let o=0;o<s;o+=r){let a=i(e.slice(o,o+n)),l=a.length;for(let c=0,u=r;c<u;++c)t[o+c]=c>=l?e[o+c]:a[c]}return t})}function J1(i,e){if(i===e)return!0;let t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||iA(i,e)===HD)&&t}function iA(i,e){let t=i.getCode(),n=e.getCode(),r=eE(t,n);if(r)return r;let s=null,o=null;for(let l of Ode)s||(s=l(i)),o||(o=l(e));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=VD(s.inverse,o.forward);else{let l=eE(t,a);l&&(r=VD(l,o.forward))}else{let l=eE(a,n);l&&(r=VD(s.inverse,l))}return r&&(qD(i),qD(e),K1(i,e,r)),r}function VD(i,e){return function(t,n,r,s){return n=i(t,n,r,s),e(n,n,r,s)}}function rA(i,e){let t=ks(i),n=ks(e);return iA(t,n)}function ev(i,e,t){let n=rA(e,t);if(!n){let r=ks(e).getCode(),s=ks(t).getCode();throw new Error(`No transform available between ${r} and ${s}`)}return n(i,void 0,i.length)}function KW(i,e,t,n){let r=rA(e,t);return wW(i,r,void 0,n)}var bu=null;function sA(){return bu}function Iy(i,e){return bu?ev(i,e,bu):i}function wu(i,e){return bu?ev(i,bu,e):(GD&&!tA(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(GD=!1,YT("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i)}function Mp(i,e){return bu?KW(i,e,bu):i}function Su(i,e){return bu?KW(i,bu,e):i}function QW(i,e){if(!bu)return i;let t=ks(e).getMetersPerUnit(),n=bu.getMetersPerUnit();return t&&n?i*t/n:i}function Vde(){$W(FD),$W(BD),zde(BD,FD,LW,DW)}Vde();function jD(i){return i[0]>0&&i[1]>0}function JW(i,e,t){return t===void 0&&(t=[0,0]),t[0]=i[0]*e+.5|0,t[1]=i[1]*e+.5|0,t}function cs(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}var oE=class{constructor(e,t,n,r){this.minX=e,this.maxX=t,this.minY=n,this.maxY=r}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}};function oA(i,e,t,n,r){return r!==void 0?(r.minX=i,r.maxX=e,r.minY=t,r.maxY=n,r):new oE(i,e,t,n)}var aE=oE;function ej(i,e,t){let n,r;t=t||pl;let s=0,o=i.length,a=!1;for(;s<o;)n=s+(o-s>>1),r=+t(i[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}function pl(i,e){return i>e?1:i<e?-1:0}function tj(i,e){return i<e?1:i>e?-1:0}function tv(i,e,t){if(i[0]<=e)return 0;let n=i.length;if(e<=i[n-1])return n-1;if(typeof t=="function"){for(let r=1;r<n;++r){let s=i[r];if(s===e)return r;if(s<e)return t(e,i[r-1],s)>0?r-1:r}return n-1}if(t>0){for(let r=1;r<n;++r)if(i[r]<e)return r-1;return n-1}if(t<0){for(let r=1;r<n;++r)if(i[r]<=e)return r;return n-1}for(let r=1;r<n;++r){if(i[r]==e)return r;if(i[r]<e)return i[r-1]-e<e-i[r]?r-1:r}return n-1}function nj(i,e,t){for(;e<t;){let n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function Do(i,e){let t=Array.isArray(e)?e:[e],n=t.length;for(let r=0;r<n;r++)i[i.length]=t[r]}function ta(i,e){let t=i.length;if(t!==e.length)return!1;for(let n=0;n<t;n++)if(i[n]!==e[n])return!1;return!0}function ij(i,e,t){let n=e||pl;return i.every(function(r,s){if(s===0)return!0;let o=n(i[s-1],r);return!(o>0||t&&o===0)})}function jn(i,e){if(!i)throw new Error(e)}function rj(i,e,t,n,r){return!XT(r,function(o){return!Cp(i,e,t,n,o[0],o[1])})}function Cp(i,e,t,n,r,s){let o=0,a=i[t-n],l=i[t-n+1];for(;e<t;e+=n){let c=i[e],u=i[e+1];l<=s?u>s&&(c-a)*(s-l)-(r-a)*(u-l)>0&&o++:u<=s&&(c-a)*(s-l)-(r-a)*(u-l)<0&&o--,a=c,l=u}return o!==0}function Py(i,e,t,n,r,s){if(t.length===0||!Cp(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(Cp(i,t[o-1],t[o],n,r,s))return!1;return!0}function sj(i,e,t,n,r,s){if(t.length===0)return!1;for(let o=0,a=t.length;o<a;++o){let l=t[o];if(Py(i,e,l,n,r,s))return!0;e=l[l.length-1]}return!1}function lE(i,e,t,n,r){let s;for(e+=n;e<t;e+=n)if(s=r(i.slice(e-n,e),i.slice(e,e+n)),s)return s;return!1}function aA(i,e,t,n,r,s){return s=s??ID(jr(),i,e,t,n),Ar(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:lE(i,e,t,n,function(o,a){return bW(r,o,a)}):!1}function oj(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){if(aA(i,e,t[s],n,r))return!0;e=t[s]}return!1}function XD(i,e,t,n,r){return!!(aA(i,e,t,n,r)||Cp(i,e,t,n,r[0],r[1])||Cp(i,e,t,n,r[0],r[3])||Cp(i,e,t,n,r[2],r[1])||Cp(i,e,t,n,r[2],r[3]))}function $D(i,e,t,n,r){if(!XD(i,e,t[0],n,r))return!1;if(t.length===1)return!0;for(let s=1,o=t.length;s<o;++s)if(rj(i,t[s-1],t[s],n,r)&&!aA(i,t[s-1],t[s],n,r))return!1;return!0}function aj(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if($D(i,e,a,n,r))return!0;e=a[a.length-1]}return!1}function ei(){throw new Error("Unimplemented abstract method.")}var Gde=0;function Bn(i){return i.ol_uid||(i.ol_uid=String(++Gde))}function nv(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function qde(i,e,t){return i+"/"+e+"/"+t}function iv(i,e,t,n,r){return`${Bn(i)},${e},${qde(t,n,r)}`}function lj(i){return Hde(i[0],i[1],i[2])}function Hde(i,e,t){return(e<<i)+t}function cj(i,e){let t=i[0],n=i[1],r=i[2];if(e.getMinZoom()>t||t>e.getMaxZoom())return!1;let s=e.getFullTileRange(t);return s?s.containsXY(n,r):!0}var rv=[0,0,0],Rp=5,YD=class{constructor(e){let t=e.minZoom,n=e.resolutions;t===void 0&&n&&(t=n.findIndex(o=>o!==void 0)),this.minZoom=t!==void 0?t:0,this.resolutions_=n,jn(ij(this.resolutions_,(o,a)=>a-o,!0),"`resolutions` must be sorted in descending order");let r;if(!e.origins){for(let o=0,a=this.resolutions_.length-1;o<a;++o)if(!r)r=this.resolutions_[o]/this.resolutions_[o+1];else if(this.resolutions_[o]/this.resolutions_[o+1]!==r){r=void 0;break}}this.zoomFactor_=r,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,jn(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));let s=e.extent;s!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=Dc(s)),jn(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,jn(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:256,jn(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=s!==void 0?s:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.tileRanges!==void 0?this.fullTileRanges_=e.tileRanges:e.sizes!==void 0?this.fullTileRanges_=e.sizes.map((o,a)=>{let l=new aE(Math.min(0,o[0]),Math.max(o[0]-1,-1),Math.min(0,o[1]),Math.max(o[1]-1,-1));if(s){let c=this.getTileRangeForExtentAndZ(s,a);l.minX=Math.max(c.minX,l.minX),l.maxX=Math.min(c.maxX,l.maxX),l.minY=Math.max(c.minY,l.minY),l.maxY=Math.min(c.maxY,l.maxY)}return l}):s&&this.calculateTileRanges_(s)}forEachTileCoord(e,t,n){let r=this.getTileRangeForExtentAndZ(e,t);for(let s=r.minX,o=r.maxX;s<=o;++s)for(let a=r.minY,l=r.maxY;a<=l;++a)n([t,s,a])}forEachTileCoordParentTileRange(e,t,n,r){let s,o,a,l=null,c=e[0]-1;for(this.zoomFactor_===2?(o=e[1],a=e[2]):l=this.getTileCoordExtent(e,r);c>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),s=oA(o,o,a,a,n)):s=this.getTileRangeForExtentAndZ(l,c,n),t(c,s))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getOrigins(){return this.origins_}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,n){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){let s=e[1]*2,o=e[2]*2;return oA(s,s+1,o,o+1,t)}let r=this.getTileCoordExtent(e,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(r,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,n){if(t>this.maxZoom||t<this.minZoom)return null;let r=e[0],s=e[1],o=e[2];if(t===r)return oA(s,o,s,o,n);if(this.zoomFactor_){let l=Math.pow(this.zoomFactor_,t-r),c=Math.floor(s*l),u=Math.floor(o*l);if(t<r)return oA(c,c,u,u,n);let f=Math.floor(l*(s+1))-1,d=Math.floor(l*(o+1))-1;return oA(c,f,u,d,n)}let a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,n)}getTileRangeForExtentAndZ(e,t,n){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,rv);let r=rv[1],s=rv[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,rv);let o=rv[1],a=rv[2];return oA(r,o,s,a,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=cs(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*r[0]*n,t[1]-(e[2]+.5)*r[1]*n]}getTileCoordExtent(e,t){let n=this.getOrigin(e[0]),r=this.getResolution(e[0]),s=cs(this.getTileSize(e[0]),this.tmpSize_),o=n[0]+e[1]*s[0]*r,a=n[1]-(e[2]+1)*s[1]*r,l=o+s[0]*r,c=a+s[1]*r;return Hl(o,a,l,c,t)}getTileCoordForCoordAndResolution(e,t,n){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,n)}getTileCoordForXYAndResolution_(e,t,n,r,s){let o=this.getZForResolution(n),a=n/this.getResolution(o),l=this.getOrigin(o),c=cs(this.getTileSize(o),this.tmpSize_),u=a*(e-l[0])/n/c[0],f=a*(l[1]-t)/n/c[1];return r?(u=Cy(u,Rp)-1,f=Cy(f,Rp)-1):(u=My(u,Rp),f=My(f,Rp)),nv(o,u,f,s)}getTileCoordForXYAndZ_(e,t,n,r,s){let o=this.getOrigin(n),a=this.getResolution(n),l=cs(this.getTileSize(n),this.tmpSize_),c=(e-o[0])/a/l[0],u=(o[1]-t)/a/l[1];return r?(c=Cy(c,Rp)-1,u=Cy(u,Rp)-1):(c=My(c,Rp),u=My(u,Rp)),nv(n,c,u,s)}getTileCoordForCoordAndZ(e,t,n){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,n)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){let n=tv(this.resolutions_,e,t||0);return Si(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return XD(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){let t=this.resolutions_.length,n=new Array(t);for(let r=this.minZoom;r<t;++r)n[r]=this.getTileRangeForExtentAndZ(e,r);this.fullTileRanges_=n}},Ly=YD;function cE(i){let e=i.getDefaultTileGrid();return e||(e=jde(i),i.setDefaultTileGrid(e)),e}function hj(i,e,t){let n=e[0],r=i.getTileCoordCenter(e),s=uE(t);if(!vu(s,r)){let o=Kn(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,i.getTileCoordForCoordAndZ(r,n)}return e}function Wde(i,e,t,n){n=n!==void 0?n:"top-left";let r=dj(i,e,t);return new Ly({extent:i,origin:xW(i,n),resolutions:r,tileSize:t})}function fj(i){let e=i||{},t=e.extent||ks("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:dj(t,e.maxZoom,e.tileSize,e.maxResolution)};return new Ly(n)}function dj(i,e,t,n){e=e!==void 0?e:42,t=cs(t!==void 0?t:256);let r=Nr(i),s=Kn(i);n=n>0?n:Math.max(s/t[0],r/t[1]);let o=e+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=n/Math.pow(2,l);return a}function jde(i,e,t,n){let r=uE(i);return Wde(r,e,t,n)}function uE(i){i=ks(i);let e=i.getExtent();if(!e){let t=180*ed.degrees/i.getMetersPerUnit();e=Hl(-t,-t,t,t)}return e}var In={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function qn(i,e,t,n,r){if(r){let o=t;t=function(a){return i.removeEventListener(e,t),o.call(n??this,a)}}else n&&n!==i&&(t=t.bind(n));let s={target:i,type:e,listener:t};return i.addEventListener(e,t),s}function sv(i,e,t,n){return qn(i,e,t,n,!0)}function li(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),gh(i))}var nn={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};var ZD=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},Ip=ZD;function nd(){return!0}function id(){return!1}function rd(){}function hE(i){let e,t,n;return function(){let r=Array.prototype.slice.call(arguments);return(!t||this!==n||!ta(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function pj(i){function e(){let t;try{t=i()}catch(n){return Promise.reject(n)}return t instanceof Promise?t:Promise.resolve(t)}return e()}var KD=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var Ao=KD;var QD=class extends Ip{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;let n=this.listeners_||(this.listeners_={}),r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){let t=typeof e=="string",n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;let s=t?new Ao(e):e;s.target||(s.target=this.eventTarget_||this);let o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});n in o||(o[n]=0,a[n]=0),++o[n];let l;for(let c=0,u=r.length;c<u;++c)if("handleEvent"in r[c]?l=r[c].handleEvent(s):l=r[c].call(this,s),l===!1||s.propagationStopped){l=!1;break}if(--o[n]===0){let c=a[n];for(delete a[n];c--;)this.removeEventListener(n,rd);delete o[n]}return l}disposeInternal(){this.listeners_&&gh(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){if(!this.listeners_)return;let n=this.listeners_[e];if(!n)return;let r=n.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=rd,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},Pp=QD;var lA=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",Xde=lA.includes("safari")&&!lA.includes("chrom"),tOe=Xde&&(lA.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(lA)),mj=lA.includes("webkit")&&!lA.includes("edge"),JD=lA.includes("macintosh"),Aj=typeof devicePixelRatio<"u"?devicePixelRatio:1,io=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,eN=typeof Image<"u"&&Image.prototype.decode;var fE=(function(){let i=!1;try{let e=Object.defineProperty({},"passive",{get:function(){i=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return i})();function gj(i,e,t){let n=i,r=!0,s=!1,o=!1,a=[sv(n,nn.LOAD,function(){o=!0,s||e()})];return n.src&&eN?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(sv(n,nn.ERROR,t)),function(){r=!1,a.forEach(li)}}function $de(i,e){return new Promise((t,n)=>{function r(){o(),t(i)}function s(){o(),n(new Error("Image load error"))}function o(){i.removeEventListener("load",r),i.removeEventListener("error",s)}i.addEventListener("load",r),i.addEventListener("error",s),e&&(i.src=e)})}function vj(i,e){return e&&(i.src=e),i.src&&eN?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(r=>i.complete&&i.width?t(i):n(r))):$de(i)}var an={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function tN(i){return Math.pow(i,3)}function Fc(i){return 1-tN(1-i)}function _j(i){return 3*i*i-2*i*i*i}function xj(i){return i}var nN=class extends Pp{constructor(e,t,n){super(),n=n||{},this.tileCoord=e,this.state=t,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(nn.CHANGE)}release(){this.setState(an.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==an.EMPTY){if(this.state!==an.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}}load(){ei()}getAlpha(e,t){if(!this.transition_)return 1;let n=this.transitionStarts_[e];if(!n)n=t,this.transitionStarts_[e]=n;else if(n===-1)return 1;let r=t-n+1e3/60;return r>=this.transition_?1:tN(r/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}disposeInternal(){this.release(),super.disposeInternal()}},ov=nN;function Di(i,e,t,n){let r;return t&&t.length?r=t.shift():io?r=new class extends OffscreenCanvas{style={}}(i??300,e??150):r=document.createElement("canvas"),i&&(r.width=i),e&&(r.height=e),r.getContext("2d",n)}var iN;function Dy(){return iN||(iN=Di(1,1)),iN}function cA(i){let e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function rN(i,e){let t=e.parentNode;t&&t.replaceChild(i,e)}function yj(i){for(;i.lastChild;)i.lastChild.remove()}function bj(i,e){let t=i.childNodes;for(let n=0;;++n){let r=t[n],s=e[n];if(!r&&!s)break;if(r!==s){if(!r){i.appendChild(s);continue}if(!s){i.removeChild(r),--n;continue}i.insertBefore(s,r)}}}function dE(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){let t=this.childNodes.indexOf(e);if(t===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(t,1),e},insertBefore:function(e,t){let n=this.childNodes.indexOf(t);if(n===-1)throw new Error("Reference node not found");return this.childNodes.splice(n,0,e),e},style:{}},{get(e,t,n){return t==="firstElementChild"?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,n)}})}function Wl(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}var sN=class extends ov{constructor(e,t,n,r,s,o){super(e,t,o),this.crossOrigin_=r?.crossOrigin,this.referrerPolicy_=r?.referrerPolicy,this.src_=n,this.key=n,this.image_,io?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(e){this.image_=e,this.state=an.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=an.ERROR,this.unlistenImage_(),this.image_=Yde(),this.changed()}handleImageLoad_(){if(io)this.state=an.LOADED;else{let e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=an.LOADED:this.state=an.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==an.ERROR&&(this.state=an.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==an.IDLE&&(this.state=an.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=gj(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};function Yde(){let i=Di(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}var pE=sN;var oN,uA=[];function wj(i,e,t,n,r){i.beginPath(),i.moveTo(0,0),i.lineTo(e,t),i.lineTo(n,r),i.closePath(),i.save(),i.clip(),i.fillRect(0,0,Math.max(e,n)+1,Math.max(t,r)),i.restore()}function aN(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function Zde(){if(oN===void 0){let i=Di(6,6,uA);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",wj(i,4,5,4,0),wj(i,4,5,0,5);let e=i.getImageData(0,0,3,3).data;oN=aN(e,0)||aN(e,4)||aN(e,8),cA(i),uA.push(i.canvas)}return oN}function Sj(i,e,t,n){let r=ev(t,e,i),s=WD(e,n,t),o=e.getMetersPerUnit();o!==void 0&&(s*=o);let a=i.getMetersPerUnit();a!==void 0&&(s/=a);let l=i.getExtent();if(!l||vu(l,r)){let c=WD(i,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function Tj(i,e,t,n){let r=dl(t),s=Sj(i,e,r,n);return(!isFinite(s)||s<=0)&&XT(t,function(o){return s=Sj(i,e,o,n),isFinite(s)&&s>0}),s}function Ej(i,e,t,n,r,s,o,a,l,c,u,f,d,A){let y=Di(Math.round(t*i),Math.round(t*e),uA);if(f||(y.imageSmoothingEnabled=!1),l.length===0)return y.canvas;y.scale(t,t);function w(F){return Math.round(F*t)/t}y.globalCompositeOperation="lighter";let S=jr();l.forEach(function(F,D,L){jT(S,F.extent)});let T,R=t/n,P=(f?1:1+Math.pow(2,-24))/R;if(!d||l.length!==1||c!==0){if(T=Di(Math.round(Kn(S)*R),Math.round(Nr(S)*R),uA),f||(T.imageSmoothingEnabled=!1),r&&A){let F=(r[0]-S[0])*R,D=-(r[3]-S[3])*R,L=Kn(r)*R,C=Nr(r)*R;T.rect(F,D,L,C),T.clip()}l.forEach(function(F,D,L){if(F.image.width>0&&F.image.height>0){if(F.clipExtent){T.save();let G=(F.clipExtent[0]-S[0])*R,W=-(F.clipExtent[3]-S[3])*R,Y=Kn(F.clipExtent)*R,H=Nr(F.clipExtent)*R;T.rect(f?G:Math.round(G),f?W:Math.round(W),f?Y:Math.round(G+Y)-Math.round(G),f?H:Math.round(W+H)-Math.round(W)),T.clip()}let C=(F.extent[0]-S[0])*R,B=-(F.extent[3]-S[3])*R,k=Kn(F.extent)*R,z=Nr(F.extent)*R;T.drawImage(F.image,c,c,F.image.width-2*c,F.image.height-2*c,f?C:Math.round(C),f?B:Math.round(B),f?k:Math.round(C+k)-Math.round(C),f?z:Math.round(B+z)-Math.round(B)),F.clipExtent&&T.restore()}})}let I=Dc(o);return a.getTriangles().forEach(function(F,D,L){let C=F.source,B=F.target,k=C[0][0],z=C[0][1],G=C[1][0],W=C[1][1],Y=C[2][0],H=C[2][1],$=w((B[0][0]-I[0])/s),J=w(-(B[0][1]-I[1])/s),te=w((B[1][0]-I[0])/s),ce=w(-(B[1][1]-I[1])/s),he=w((B[2][0]-I[0])/s),ve=w(-(B[2][1]-I[1])/s),Re=k,Qe=z;k=0,z=0,G-=Re,W-=Qe,Y-=Re,H-=Qe;let Fe=[[G,W,0,0,te-$],[Y,H,0,0,he-$],[0,0,G,W,ce-J],[0,0,Y,H,ve-J]],mt=MW(Fe);if(!mt)return;if(y.save(),y.beginPath(),Zde()||!f){y.moveTo(te,ce);let Ve=4,Ye=$-te,Mt=J-ce;for(let Et=0;Et<Ve;Et++)y.lineTo(te+w((Et+1)*Ye/Ve),ce+w(Et*Mt/(Ve-1))),Et!=Ve-1&&y.lineTo(te+w((Et+1)*Ye/Ve),ce+w((Et+1)*Mt/(Ve-1)));y.lineTo(he,ve)}else y.moveTo(te,ce),y.lineTo($,J),y.lineTo(he,ve);y.clip(),y.transform(mt[0],mt[2],mt[1],mt[3],$,J),y.translate(S[0]-Re,S[3]-Qe);let Ee;if(T)Ee=T.canvas,y.scale(P,-P);else{let Ve=l[0],Ye=Ve.extent;Ee=Ve.image,y.scale(Kn(Ye)/Ee.width,-Nr(Ye)/Ee.height)}y.drawImage(Ee,0,0),y.restore()}),T&&(cA(T),uA.push(T.canvas)),u&&(y.save(),y.globalCompositeOperation="source-over",y.strokeStyle="black",y.lineWidth=1,a.getTriangles().forEach(function(F,D,L){let C=F.target,B=(C[0][0]-I[0])/s,k=-(C[0][1]-I[1])/s,z=(C[1][0]-I[0])/s,G=-(C[1][1]-I[1])/s,W=(C[2][0]-I[0])/s,Y=-(C[2][1]-I[1])/s;y.beginPath(),y.moveTo(z,G),y.lineTo(B,k),y.lineTo(W,Y),y.closePath(),y.stroke()}),y.restore()),y.canvas}var Kde=[1,0,0,1,0,0],POe=new Array(6);function go(){return Kde.slice(0)}function Mj(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i}function Xr(i,e){let t=e[0],n=e[1];return e[0]=i[0]*t+i[2]*n+i[4],e[1]=i[1]*t+i[3]*n+i[5],e}function No(i,e,t,n,r,s,o,a){let l=Math.sin(s),c=Math.cos(s);return i[0]=n*c,i[1]=r*l,i[2]=-n*l,i[3]=r*c,i[4]=o*n*c-a*n*l+e,i[5]=o*r*l+a*r*c+t,i}function AE(i,e){let t=Qde(e);jn(t!==0,"Transformation matrix cannot be inverted");let n=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5];return i[0]=o/t,i[1]=-r/t,i[2]=-s/t,i[3]=n/t,i[4]=(s*l-o*a)/t,i[5]=-(n*l-r*a)/t,i}function Qde(i){return i[0]*i[3]-i[1]*i[2]}var Jde=[1e5,1e5,1e5,1e5,2,2];function Cj(i){return"matrix("+i.join(", ")+")"}function mE(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function Rj(i,e){let t=mE(i),n=mE(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*Jde[r])!==0)return!1;return!0}var epe=10,Ij=.25,lN=class{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={},c=a?ZW(P=>Xr(a,ev(P,this.targetProj_,this.sourceProj_))):rA(this.targetProj_,this.sourceProj_);this.transformInv_=function(P){let I=P[0]+"/"+P[1];return l[I]||(l[I]=c(P)),l[I]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&Kn(r)>=Kn(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Kn(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Kn(this.targetProj_.getExtent()):null;let u=Dc(n),f=X1(n),d=j1(n),A=W1(n),y=this.transformInv_(u),w=this.transformInv_(f),S=this.transformInv_(d),T=this.transformInv_(A),R=epe+(o?Math.max(0,Math.ceil(Math.log2(Ty(n)/(o*o*256*256)))):0);if(this.addQuad_(u,f,d,A,y,w,S,T,R),this.wrapsXInSource_){let P=1/0;this.triangles_.forEach(function(I,F,D){P=Math.min(P,I.source[0][0],I.source[1][0],I.source[2][0])}),this.triangles_.forEach(I=>{if(Math.max(I.source[0][0],I.source[1][0],I.source[2][0])-P>this.sourceWorldWidth_/2){let F=[[I.source[0][0],I.source[0][1]],[I.source[1][0],I.source[1][1]],[I.source[2][0],I.source[2][1]]];F[0][0]-P>this.sourceWorldWidth_/2&&(F[0][0]-=this.sourceWorldWidth_),F[1][0]-P>this.sourceWorldWidth_/2&&(F[1][0]-=this.sourceWorldWidth_),F[2][0]-P>this.sourceWorldWidth_/2&&(F[2][0]-=this.sourceWorldWidth_);let D=Math.min(F[0][0],F[1][0],F[2][0]);Math.max(F[0][0],F[1][0],F[2][0])-D<this.sourceWorldWidth_/2&&(I.source=F)}})}l={}}addTriangle_(e,t,n,r,s,o){this.triangles_.push({source:[r,s,o],target:[e,t,n]})}addQuad_(e,t,n,r,s,o,a,l,c){let u=RD([s,o,a,l]),f=this.sourceWorldWidth_?Kn(u)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,A=this.sourceProj_.canWrapX()&&f>.5&&f<1,y=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){let S=RD([e,t,n,r]);y=Kn(S)/this.targetWorldWidth_>Ij||y}!A&&this.sourceProj_.isGlobal()&&f&&(y=f>Ij||y)}if(!y&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!Ar(u,this.maxSourceExtent_))return;let w=0;if(!y&&(!isFinite(s[0])||!isFinite(s[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(c>0)y=!0;else if(w=(!isFinite(s[0])||!isFinite(s[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),w!=1&&w!=2&&w!=4&&w!=8)return}if(c>0){if(!y){let S=[(e[0]+n[0])/2,(e[1]+n[1])/2],T=this.transformInv_(S),R;A?R=(Ah(s[0],d)+Ah(a[0],d))/2-Ah(T[0],d):R=(s[0]+a[0])/2-T[0];let P=(s[1]+a[1])/2-T[1];y=R*R+P*P>this.errorThresholdSquared_}if(y){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){let S=[(t[0]+n[0])/2,(t[1]+n[1])/2],T=this.transformInv_(S),R=[(r[0]+e[0])/2,(r[1]+e[1])/2],P=this.transformInv_(R);this.addQuad_(e,t,S,R,s,o,T,P,c-1),this.addQuad_(R,S,n,r,P,T,a,l,c-1)}else{let S=[(e[0]+t[0])/2,(e[1]+t[1])/2],T=this.transformInv_(S),R=[(n[0]+r[0])/2,(n[1]+r[1])/2],P=this.transformInv_(R);this.addQuad_(e,S,R,r,s,T,P,l,c-1),this.addQuad_(S,t,n,R,T,o,a,P,c-1)}return}}if(A){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(w&11)==0&&this.addTriangle_(e,n,r,s,a,l),(w&14)==0&&this.addTriangle_(e,n,t,s,a,o),w&&((w&13)==0&&this.addTriangle_(t,r,e,o,l,s),(w&7)==0&&this.addTriangle_(t,r,n,o,l,a))}calculateSourceExtent(){let e=jr();return this.triangles_.forEach(function(t,n,r){let s=t.source;Jm(e,s[0]),Jm(e,s[1]),Jm(e,s[2])}),e}getTriangles(){return this.triangles_}},Pj=lN;var cN=class extends ov{constructor(e,t,n,r,s,o,a,l,c,u,f,d){super(s,an.IDLE,d),this.renderEdges_=f!==void 0?f:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=r,this.wrappedTileCoord_=o||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;let A=r.getTileCoordExtent(this.wrappedTileCoord_),y=this.targetTileGrid_.getExtent(),w=this.sourceTileGrid_.getExtent(),S=y?ph(A,y):A;if(Ty(S)===0){this.state=an.EMPTY;return}let T=e.getExtent();T&&(w?w=ph(w,T):w=T);let R=r.getResolution(this.wrappedTileCoord_[0]),P=Tj(e,n,S,R);if(!isFinite(P)||P<=0){this.state=an.EMPTY;return}let I=u!==void 0?u:.5;if(this.triangulation_=new Pj(e,n,S,w,P*I,R),this.triangulation_.getTriangles().length===0){this.state=an.EMPTY;return}this.sourceZ_=t.getZForResolution(P);let F=this.triangulation_.calculateSourceExtent();if(w&&(e.canWrapX()?(F[1]=Si(F[1],w[1],w[3]),F[3]=Si(F[3],w[1],w[3])):F=ph(F,w)),!Ty(F))this.state=an.EMPTY;else{let D=0,L=0;e.canWrapX()&&(D=Kn(T),L=Math.floor((F[0]-T[0])/D)),$T(F.slice(),e,!0).forEach(B=>{let k=t.getTileRangeForExtentAndZ(B,this.sourceZ_);for(let z=k.minX;z<=k.maxX;z++)for(let G=k.minY;G<=k.maxY;G++){let W=L*D;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,z,G,a),offset:W})}++L}),this.sourceTiles_.length===0&&(this.state=an.EMPTY)}}getImage(){return this.canvas_}reproject_(){let e=[];if(this.sourceTiles_.forEach(t=>{let n=t.tile;if(n&&n.getState()==an.LOADED){let r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=t.offset,r[2]+=t.offset;let s=this.clipExtent_?.slice();s&&(s[0]+=t.offset,s[2]+=t.offset),e.push({extent:r,clipExtent:s,image:n.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=an.ERROR;else{let t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),r=typeof n=="number"?n:n[0],s=typeof n=="number"?n:n[1],o=this.targetTileGrid_.getResolution(t),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Ej(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=an.LOADED}this.changed()}load(){for(let e of this.sourceTiles_)e.tile=e.getTile();if(this.state==an.IDLE){this.state=an.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{let n=t.getState();if(n==an.IDLE||n==an.LOADING){e++;let r=qn(t,nn.CHANGE,s=>{let o=t.getState();(o==an.LOADED||o==an.ERROR||o==an.EMPTY)&&(li(r),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(r)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},n,r){t.getState()==an.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(li),this.sourcesListenerKeys_=null}release(){this.canvas_&&(cA(this.canvas_.getContext("2d")),uA.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},gE=cN;var tpe=/\{z\}/g,npe=/\{x\}/g,ipe=/\{y\}/g,rpe=/\{-y\}/g;function Lj(i,e,t,n,r){return i.replace(tpe,e.toString()).replace(npe,t.toString()).replace(ipe,n.toString()).replace(rpe,function(){if(r===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(r-n).toString()})}function Dj(i){let e=[],t=/\{([a-z])-([a-z])\}/.exec(i);if(t){let n=t[1].charCodeAt(0),r=t[2].charCodeAt(0),s;for(s=n;s<=r;++s)e.push(i.replace(t[0],String.fromCharCode(s)));return e}if(t=/\{(\d+)-(\d+)\}/.exec(i),t){let n=parseInt(t[2],10);for(let r=parseInt(t[1],10);r<=n;r++)e.push(i.replace(t[0],r.toString()));return e}return e.push(i),e}function spe(i,e){return(function(t,n,r){if(!t)return;let s,o=t[0];if(e){let a=e.getFullTileRange(o);a&&(s=a.getHeight()-1)}return Lj(i,o,t[1],t[2],s)})}function Nj(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=spe(i[r],e);return ope(n)}function ope(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;let r=lj(e),s=Ah(r,i.length);return i[s](e,t,n)})}var Tu={PROPERTYCHANGE:"propertychange"};var av=class extends Pp{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(nn.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){let n=e.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=qn(this,e[s],t);return r}return qn(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){let r=e.length;n=new Array(r);for(let s=0;s<r;++s)n[s]=sv(this,e[s],t)}else n=sv(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)ape(n);else if(Array.isArray(e))for(let r=0,s=e.length;r<s;++r)this.removeEventListener(e[r],t);else this.removeEventListener(e,t)}};av.prototype.on;av.prototype.once;av.prototype.un;function ape(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)li(i[e]);else li(i)}var vE=av;var _E=class extends Ao{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},uN=class extends vE{constructor(e){super(),this.on,this.once,this.un,Bn(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new _E(n,e,t)),n=Tu.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new _E(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){let r=this.values_||(this.values_={});if(n)r[e]=t;else{let s=r[e];r[e]=t,s!==t&&this.notify(e,s)}}setProperties(e,t){for(let n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){let n=this.values_[e];delete this.values_[e],yu(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},zs=uN;var hN=class extends zs{constructor(e){super(),this.projection=ks(e.projection),this.attributions_=Fj(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible??!0,this.loading=!1,this.state_=e.state!==void 0?e.state:"ready",this.wrapX_=e.wrapX!==void 0?e.wrapX:!1,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;let t=this;this.viewPromise_=new Promise(function(n,r){t.viewResolver=n,t.viewRejector=r})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}ready(){let e=this.getState();return e==="ready"?Promise.resolve():e==="error"?Promise.reject(new Error("Source failed to load")):new Promise((t,n)=>{let r=()=>{let s=this.getState();s==="ready"?(this.un("change",r),t()):s==="error"&&(this.un("change",r),n(new Error("Source failed to load")))};this.on("change",r)})}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=Fj(e),this.changed()}setState(e){this.state_=e,this.changed()}};function Fj(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}var xE=hN;var fN=class extends xE{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio!==void 0?e.tilePixelRatio:1,this.tileGrid=e.tileGrid!==void 0?e.tileGrid:null;let t=[256,256];this.tileGrid&&cs(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||Bn(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){let t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,n,r,s,o){return ei()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:cE(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=cs(r.getTileSize(e),this.tmpSize);return s==1?o:JW(o,s,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){let n=t!==void 0?t:this.getProjection(),r=t!==void 0?this.getTileGridForProjection(n):this.tileGrid||this.getTileGridForProjection(n);return this.getWrapX()&&n.isGlobal()&&(e=hj(r,e,n)),cj(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},yE=class extends Ao{constructor(e,t){super(e),this.tile=t}},Bj=fN;var bE={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var dN=class i extends Bj{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===i.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){let t=e.target,n=Bn(t),r=t.getState(),s;r==an.LOADING?(this.tileLoadingKeys_[n]=!0,s=bE.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==an.ERROR?bE.TILELOADERROR:r==an.LOADED?bE.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new yE(s,t))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,typeof t<"u"?this.setKey(t):this.changed()}setUrl(e){let t=Dj(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`3-`);this.generateTileUrlFunction_?this.setTileUrlFunction(Nj(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},Oj=dN;var pN=class extends Oj{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:lpe,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate!==void 0?e.interpolate:!0,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy=e.referrerPolicy,this.tileClass=e.tileClass!==void 0?e.tileClass:pE,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!J1(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getTileGridForProjection(e){let t=this.getProjection();if(this.tileGrid&&(!t||J1(t,e)))return this.tileGrid;let n=Bn(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=cE(e)),this.tileGridForProjection[n]}createTile_(e,t,n,r,s,o){let a=[e,t,n],l=this.getTileCoordForTileUrlFunction(a,s),c=l?this.tileUrlFunction(l,r,s):void 0,u=new this.tileClass(a,c!==void 0?an.IDLE:an.EMPTY,c!==void 0?c:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return u.key=o,u.addEventListener(nn.CHANGE,this.handleTileChange.bind(this)),u}getTile(e,t,n,r,s,o){let a=this.getProjection();if(!a||!s||J1(a,s))return this.getTileInternal(e,t,n,r,a||s);let l=[e,t,n],c=this.getKey(),u=this.getTileGridForProjection(a),f=this.getTileGridForProjection(s),d=this.getTileCoordForTileUrlFunction(l,s),A=new gE(a,u,s,f,l,d,this.getTilePixelRatio(r),this.getGutter(),(y,w,S,T)=>this.getTileInternal(y,w,S,T,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return A.key=c,A}getTileInternal(e,t,n,r,s,o){let a=this.getKey(),l=iv(this,a,e,t,n);if(o&&o.containsKey(l))return o.get(l);let c=this.createTile_(e,t,n,r,s,a);return o?.set(l,c),c}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){let n=ks(e);if(n){let r=Bn(n);r in this.tileGridForProjection||(this.tileGridForProjection[r]=t)}}};function lpe(i,e){if(io){let t=i.getCrossOrigin(),n="same-origin",r="same-origin";t==="anonymous"||t===""?(n="cors",r="omit"):t==="use-credentials"&&(n="cors",r="include");let s={mode:n,credentials:r,referrerPolicy:i.getReferrerPolicy()};fetch(e,s).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.blob()}).then(o=>createImageBitmap(o)).then(o=>{let a=i.getImage();a.width=o.width,a.height=o.height,a.getContext("2d").drawImage(o,0,0),o.close?.(),a.dispatchEvent(new Event("load"))}).catch(()=>{i.getImage().dispatchEvent(new Event("error"))});return}i.getImage().src=e}var Uj=pN;var mN=class extends Uj{constructor(e){e=e||{};let t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:fj({extent:uE(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,referrerPolicy:e.referrerPolicy,interpolate:e.interpolate,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}},kj=mN;function ml(){if(!O.world||!O.lens||O.settling)return;let i=O.engine?.getView();try{let e=zj();e.last=O.volume.slug,e.volumes[O.volume.slug]={volume:O.volume.slug,world:O.world.slug,lens:O.world.lenses.indexOf(O.lens),center:i?.getCenter(),zoom:i?.getZoom(),hidden:[...O.hiddenCollections],collapsed:[...O.collapsedSections],expanded:[...O.expandedCollections],labels:[...O.labelOverrides],render:[...O.renderOverrides],overviewDocked:O.overviewDocked,dockFolded:O.dockFolded,dockDismissed:O.dockDismissed},localStorage.setItem(BL,JSON.stringify(e))}catch{}}function zj(){try{let i=JSON.parse(localStorage.getItem(BL)||"null");if(i&&i.volumes)return i}catch{}return{last:"",volumes:{}}}function lv(i){let e=zj(),t=i||e.last,n=t&&e.volumes[t];return n&&n.volume&&n.world?n:null}function cv(){let[i,e]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(t=>t.trim());return{volume:i,world:e}}function Vj(){if(!O.volume||!O.world)return;let i=`#${O.volume.slug}/${O.world.slug}`;location.hash!==i&&history.replaceState(null,"",i)}var AN=class i extends zs{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e)if(typeof e.getSimplifiedGeometry=="function"){let t=e;this.setGeometry(t)}else{let t=e;this.setProperties(t)}}clone(){let e=new i,t=this.geometryName_;e.setGeometryName(t);let n=this.getPropertiesInternal();if(n){let s=this.getGeometry();for(let o in n)o===t&&s?e.set(o,s.clone()):e.set(o,n[o],!0)}let r=this.getStyle();return r&&e.setStyle(r),e}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(li(this.geometryChangeKey_),this.geometryChangeKey_=null);let e=this.getGeometry();e&&(this.geometryChangeKey_=qn(e,nn.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?cpe(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){e!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}};function cpe(i){if(typeof i=="function")return i;let e;return Array.isArray(i)?e=i:(jn(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[i]),function(){return e}}var Lp=AN;function Al(i,e,t,n,r,s,o){s=s||[],o=o||2;let a=0;for(let l=e;l<t;l+=n){let c=i[l],u=i[l+1];s[a++]=r[0]*c+r[2]*u+r[4],s[a++]=r[1]*c+r[3]*u+r[5];for(let f=2;f<o;f++)s[a++]=i[l+f]}return s&&s.length!=a&&(s.length=a),s}function wE(i,e,t,n,r,s,o){o=o||[];let a=Math.cos(r),l=Math.sin(r),c=s[0],u=s[1],f=0;for(let d=e;d<t;d+=n){let A=i[d]-c,y=i[d+1]-u;o[f++]=c+A*a-y*l,o[f++]=u+A*l+y*a;for(let w=d+2;w<d+n;++w)o[f++]=i[w]}return o&&o.length!=f&&(o.length=f),o}function Gj(i,e,t,n,r,s,o,a){a=a||[];let l=o[0],c=o[1],u=0;for(let f=e;f<t;f+=n){let d=i[f]-l,A=i[f+1]-c;a[u++]=l+r*d,a[u++]=c+s*A;for(let y=f+2;y<f+n;++y)a[u++]=i[y]}return a&&a.length!=u&&(a.length=u),a}function qj(i,e,t,n,r,s,o){o=o||[];let a=0;for(let l=e;l<t;l+=n){o[a++]=i[l]+r,o[a++]=i[l+1]+s;for(let c=l+2;c<l+n;++c)o[a++]=i[c]}return o&&o.length!=a&&(o.length=a),o}var Hj=go(),upe=[NaN,NaN],gN=class extends zs{constructor(){super(),this.extent_=jr(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=hE((e,t,n)=>{if(!n)return this.getSimplifiedGeometry(t);let r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return ei()}closestPointXY(e,t,n,r){return ei()}containsXY(e,t){return this.closestPointXY(e,t,upe,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t=t||[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return ei()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Km(t),this.extentRevision_=this.getRevision()}return yW(this.extent_,e)}rotate(e,t){ei()}scale(e,t,n){ei()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return ei()}getType(){return ei()}applyTransform(e){ei()}intersectsExtent(e){return ei()}translate(e,t){ei()}transform(e,t){let n=ks(e),r=n.getUnits()=="tile-pixels"?function(s,o,a){let l=n.getExtent(),c=n.getWorldExtent(),u=Nr(c)/Nr(l);No(Hj,c[0],c[3],u,-u,0,0,0);let f=Al(s,0,s.length,a,Hj,o),d=rA(n,t);return d?d(f,f,a):f}:rA(n,t);return this.applyTransform(r),this}},Wj=gN;var vN=class extends Wj{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return H1(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return ei()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=jj(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){ei()}setLayout(e,t,n){let r;if(e)r=jj(e);else{for(let s=0;s<n;++s){if(t.length===0){this.layout="XY",this.stride=2;return}t=t[0]}r=t.length,e=hpe(r)}this.layout=e,this.stride=r}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();wE(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=dl(this.getExtent()));let r=this.getFlatCoordinates();if(r){let s=this.getStride();Gj(r,0,r.length,s,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();qj(n,0,n.length,r,e,t,n),this.changed()}}};function hpe(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function jj(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function Xj(i,e,t){let n=i.getFlatCoordinates();if(!n)return null;let r=i.getStride();return Al(n,0,n.length,r,e,t)}var gl=vN;function $j(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function hA(i,e,t,n){for(let r=0,s=t.length;r<s;++r){let o=t[r];for(let a=0;a<n;++a)i[e++]=o[a]}return e}function Ny(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=hA(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function Yj(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=Ny(i,e,t[o],n,r[s]);l.length===0&&(l[0]=e),r[s++]=l,e=l[l.length-1]}return r.length=s,r}var _N=class i extends gl{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){let s=this.flatCoordinates,o=_u(e,t,s[0],s[1]);if(o<r){let a=this.stride;for(let l=0;l<a;++l)n[l]=s[l];return n.length=a,o}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return WT(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return Sy(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=$j(this.flatCoordinates,0,e,this.stride),this.changed()}},Eu=_N;function fA(){return Vq[O.world?.iconOutset==="dark"?"dark":"light"]}function fpe(i){let e=O.world?.iconOutset==="dark",t=ppe(i);return(e?t>.3:t<.88)?i:dpe(i,e?.74:.42)}function dpe(i,e){let t=String(i).replace("#","");if(t.length!==6)return i;let[n,r,s]=[0,2,4].map(P=>parseInt(t.slice(P,P+2),16)/255),o=Math.max(n,r,s),a=Math.min(n,r,s),l=(o+a)/2,c=0,u=o-a,f=u===0?0:u/(1-Math.abs(2*l-1));u!==0&&(o===n?c=(r-s)/u%6:o===r?c=(s-n)/u+2:c=(n-r)/u+4,c*=60,c<0&&(c+=360));let d=(1-Math.abs(2*e-1))*f,A=d*(1-Math.abs(c/60%2-1)),y=e-d/2,[w,S,T]=c<60?[d,A,0]:c<120?[A,d,0]:c<180?[0,d,A]:c<240?[0,A,d]:c<300?[A,0,d]:[d,0,A],R=P=>Math.round((P+y)*255).toString(16).padStart(2,"0");return`#${R(w)}${R(S)}${R(T)}`}function ppe(i){let e=String(i).replace("#","");if(e.length!==6)return .5;let t=n=>parseInt(e.slice(n,n+2),16)/255;return .2126*t(0)+.7152*t(2)+.0722*t(4)}function uv(i){let e=Math.abs(Number(i)||0);return $f[(Math.imul(e,2654435761)>>>0)%$f.length]}function Bc(i,e){let t=String(i||"#ffffff").replace("#",""),n=t.length===3?t.split("").map(s=>s+s).join(""):t.slice(0,6).padEnd(6,"f"),r=Number.parseInt(n,16);return`rgba(${r>>16&255}, ${r>>8&255}, ${r&255}, ${e})`}function hv(i,e){i.style.setProperty("--pin-color",dA(e))}function dA(i){return fpe(i.color||uv(i.id))}function fv(i,e,t){if(i.classList.remove("has-source-icon"),i.style.removeProperty("--pin-icon"),i.textContent="",!e.iconAsset){i.textContent=t;return}i.style.setProperty("--pin-icon",`url("${xN(e.iconAsset)}")`),i.classList.add("has-source-icon")}function xN(i){let e=i.split("/").map(t=>encodeURIComponent(t)).join("/");return`${O.volume.base}/icons/${e}`}function Mu(i){return i.split(/\s+/).slice(0,2).map(e=>e[0]||"").join("")}function Zj(i){return Math.imul(Number(i)||0,2654435761)>>>0}function yN(i){return String(i||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`1+(()=>{var ihe=Object.create;var ML=Object.defineProperty;var rhe=Object.getOwnPropertyDescriptor;var she=Object.getOwnPropertyNames;var ohe=Object.getPrototypeOf,ahe=Object.prototype.hasOwnProperty;var Bq=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},lhe=(i,e)=>{for(var t in e)ML(i,t,{get:e[t],enumerable:!0})},che=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of she(e))!ahe.call(i,r)&&r!==t&&ML(i,r,{get:()=>e[r],enumerable:!(n=rhe(e,r))||n.enumerable});return i};var Oq=(i,e,t)=>(t=i!=null?ihe(ohe(i)):{},che(e||!i||!i.__esModule?ML(t,"default",{value:i,enumerable:!0}):t,i));var Hq=Bq((gT,qq)=>{(function(i,e){typeof gT=="object"&&typeof qq<"u"?e(gT):typeof define=="function"&&define.amd?define(["exports"],e):e(i.bigfloat={})})(gT,(function(i){"use strict";var e=Math.pow(2,32),t=Math.pow(2,-32),n=Math.log(10)/(32*Math.log(2));function r(D){return new Array(D+1).join("0")}var s=(function(){function D(L){this.base=L,this.limbDigitsExact=Math.log(e)/Math.log(this.base),this.limbDigits=~~this.limbDigitsExact,this.limbBase=Math.pow(this.base,this.limbDigits),this.pad=r(this.limbDigits)}return D.init=function(L){return D.baseTbl[L]||(D.baseTbl[L]=new D(L))},D.baseTbl={},D})();function o(D){return D.replace(/^(-?)0+([1-9a-z]|0(\.|$))/,"$1$2").replace(/(\.|(\.[0-9a-z]*[1-9a-z]))0+$/,"$2")}function a(D,L){L===void 0&&(L=10);var C=s.init(L),B=C.pad,k=C.limbBase,z="",G="",W,Y;if(isNaN(D))return"NaN";if(D<0&&(z="-",D=-D),!isFinite(D))return z+"Inf";if(D<1)G+="0";else{var H=Math.floor(D);for(D-=H;H;)W=H%k,H=(H-W)/k,Y=W.toString(L),G=Y+G,H&&(G=B.substr(Y.length)+G)}if(D>0)for(G+=".",k!=e&&(k=L,B="");D;)D*=k,W=D>>>0,D-=W,Y=W.toString(L),G+=B.substr(Y.length)+Y;return z+G.replace(/(\.[0-9a-z]*[1-9a-z])0+$/,"$1")}var l=(function(){function D(L,C){this.limbList=[],L?this.setValue(L,C):this.setZero()}return D.prototype.clone=function(){return new D().setBig(this)},D.prototype.setZero=function(){return this.sign=1,this.fractionLen=0,this.len=0,this},D.prototype.setValue=function(L,C){return typeof L=="number"?this.setNumber(L):L instanceof D?this.setBig(L):this.setString(L.toString(),C||10)},D.prototype.setBig=function(L){var C=L.len;this.sign=L.sign,this.fractionLen=L.fractionLen,this.len=C;for(var B=0;B<C;++B)this.limbList[B]=L.limbList[B];return this},D.prototype.setNumber=function(L){L<0?(L=-L,this.sign=-1):this.sign=1;for(var C=Math.floor(L),B=L-C,k=0,z=this.limbList,G,W=0;B;)B*=e,G=B>>>0,B-=G,z[W++]=G,++k;for(var Y=0;--W>Y;)G=z[Y],z[Y++]=z[W],z[W]=G;for(W+=Y+1;C;)G=C%e,C=(C-G)/e,z[W++]=G;return this.limbList=z,this.fractionLen=k,this.len=W,this},D.prototype.parseFraction=function(L,C,B,k,z,G){for(var W=this.limbList,Y=L.length,H=k-1;H;)W[--H]=0;var $=Y-((Y-B+G-1)%G+1);for(W[k-1]=parseInt(L.substr($,Y-$),C),this.divInt(Math.pow(C,Y-$),k),Y=$;Y>B;)Y-=G,W[k-1]=parseInt(L.substr(Y,G),C),this.divInt(z,k)},D.prototype.setString=function(L,C){var B=s.init(C),k=B.limbBase,z=B.limbDigits,G=B.limbDigitsExact,W=this.limbList,Y=-1,H;for(this.sign=1;;){switch(H=L.charAt(++Y),H){case"-":this.sign=-1;case"+":case"0":continue}break}var $=(L.indexOf(".",Y)+1||L.length+1)-1;if($<L.length-1){var J=~~((L.length-$-1)/G)+1;this.parseFraction(L,C,$+1,J+1,k,z),this.fractionLen=J,this.len=J,this.trimLeast()}else this.fractionLen=0,this.len=0;var te=this.fractionLen;if($>Y){var ce=Y+($-Y+z-1)%z+1;for(++this.len,W[te]=parseInt(L.substr(Y,ce-Y),C),Y=ce;Y<$;)this.mulInt(k,W,te,te,0)&&++this.len,W[te]+=parseInt(L.substr(Y,z),C),Y+=z}return this},D.prototype.trimMost=function(){for(var L=this.limbList,C=this.fractionLen,B=this.len;B>C&&!L[B-1];)--B;this.len=B},D.prototype.trimLeast=function(){for(var L=this.limbList,C=this.fractionLen,B=0;B<C&&!L[B];)++B;B&&this.truncate(C-B)},D.prototype.mulInt=function(L,C,B,k,z){if(!L)return 0;for(var G=this.limbList,W=this.len,Y,H,$=0;B<W;)Y=G[B++],$+=L*(Y&65535),H=$&65535,$=($-H)/65536,$+=L*(Y>>>16),H|=$<<16,Y=(C[k]&z)+H>>>0,C[k++]=Y,$=$/65536>>>0,$+=(H^(Y-H^H)&~(Y^H))>>>31;return $&&(C[k]=$),$},D.prototype.mulBig=function(L,C){if(this.isZero()||L.isZero())return C.setZero();var B=L.limbList,k=L.len,z=C.limbList,G=this.len+k;for(C.len=G;G--;)z[G]=0;this.mulInt(B[0],z,0,0,0);for(var W=1;W<k;++W)this.mulInt(B[W],z,0,W,4294967295);return C.sign=this.sign*L.sign,C.fractionLen=this.fractionLen+L.fractionLen,C.trimMost(),C.trimLeast(),C},D.prototype.mul=function(L,C){if(C=C||new D,typeof L=="number"&&(L=c.setNumber(L)),C==this)throw new Error("Multiplication in place is unsupported");return this.mulBig(L,C)},D.prototype.absDeltaFrom=function(L){typeof L=="number"&&(L=c.setNumber(L));for(var C=this.limbList,B=L.limbList,k=this.len,z=L.len,G=k-this.fractionLen-(z-L.fractionLen);!G&&k&&z;)G=C[--k]-B[--z];if(G)return G;if(k)do G=C[--k];while(!G&&k);else if(z)do G=-B[--z];while(!G&&z);return G},D.prototype.isZero=function(){return this.len==0},D.prototype.getSign=function(){return this.len&&this.sign},D.prototype.deltaFrom=function(L){return typeof L=="number"&&(L=c.setNumber(L)),this.len+L.len&&(this.sign-L.sign||this.absDeltaFrom(L)*this.sign)},D.prototype.addBig=function(L,C){var B=this,k=B.fractionLen,z=k-L.fractionLen;z<0&&(z=-z,k+=z,B=L,L=this),C.sign=this.sign,C.fractionLen=k;for(var G=C.limbList,W=B.limbList,Y=L.limbList,H=0,$=0,J=0,te;H<z;)G[H]=W[H],++H;var ce=L.len;for(z=B.len-H,z>ce&&(z=ce);$<z;)J+=W[H]+Y[$++],te=J>>>0,J=J-te&&1,G[H++]=te;var he=H;for(z<ce?(z=ce,B=L,H=$,W=Y):z=B.len;H<z;)J+=W[H++],te=J>>>0,J=J-te&&1,G[he++]=te;return J&&(G[he++]=J),C.len=he,C.trimLeast(),C},D.prototype.subBig=function(L,C){var B=this;C.sign=this.sign,B.absDeltaFrom(L)<0&&(B=L,L=this,C.sign=-this.sign);var k=B.fractionLen,z=k-L.fractionLen,G=C.limbList,W=B.limbList,Y=L.limbList,H=B.len,$=L.len,J=H,te=0,ce=0,he=0,ve=0,Re;if(z>=0){for(;te<z;)G[te]=W[te],++te;z+=$,z>H&&(z=H),he=te}else{for(z=-z,k+=z,J+=z;ce<z;)ve-=Y[ce],Re=ve>>>0,ve=-(ve<0),G[ce++]=Re;z+=H,z>$&&(z=$),he=ce}for(C.fractionLen=k;he<z;)ve+=W[te++]-Y[ce++],Re=ve>>>0,ve=-(ve<0),G[he++]=Re;for(;he<J;)ve+=W[te++],Re=ve>>>0,ve=-(ve<0),G[he++]=Re;return C.len=he,C.trimMost(),C.trimLeast(),C},D.prototype.addSub=function(L,C,B){if(B=B||new D,B==this)throw new Error("Addition and subtraction in place is unsupported");return typeof L=="number"&&(L=c.setNumber(L)),this.sign*L.sign*C<0?this.subBig(L,B):this.addBig(L,B)},D.prototype.add=function(L,C){return this.addSub(L,1,C)},D.prototype.sub=function(L,C){return this.addSub(L,-1,C)},D.prototype.truncate=function(L){var C=this.fractionLen-L;if(C>0){this.fractionLen=L,this.len-=C;for(var B=this.len,k=this.limbList,z=0;z<B;++z)k[z]=k[z+C]}return this},D.prototype.round=function(L){return this.truncate(1+~~(L*n))},D.prototype.divInt=function(L,C){var B=this.limbList,k,z,G,W=0;for(B[C-1]<L&&(W=B[--C],this.len=C);C--;)k=B[C],W=W*65536+(k>>>16),z=W/L>>>0,W=W-z*L,W=W*65536+(k&65535),G=W/L>>>0,W=W-G*L,B[C]=(z<<16|G)>>>0;return W},D.prototype.fractionToString=function(L,C){var B=s.init(L),k=B.pad,z=B.limbBase,G=this.limbList,W=this.fractionLen,Y=0,H;if(L&1)throw new Error("Conversion of floating point values to odd bases is unsupported");for(;Y<W&&!G[Y];)++Y;if(!(Y>=W)){C.push(".");var $=c;for($.limbList=G.slice(Y,W),$.len=W-Y,Y=0;Y<$.len;)if($.limbList[Y]){var J=$.mulInt(z,$.limbList,Y,Y,0);H=J.toString(L),C.push(k.substr(H.length)+H)}else++Y}},D.prototype.getExpansion=function(L){for(var C=this.limbList,B=this.len,k=this.sign,z=this.fractionLen;z--;)k*=t;for(;++z<B;)L[z]=C[z]*k,k*=e;return B},D.prototype.valueOf=function(){for(var L=this.limbList,C=0,B=t*this.sign,k=this.fractionLen,z=0;z<k;)C=C*t+L[z++];for(k=this.len;z<k;)C=C*t+L[z++],B*=e;return C*B},D.prototype.toString=function(L){L===void 0&&(L=10);var C=s.init(L),B=C.pad,k=C.limbBase,z=[],G=this.limbList,W;if(k!=e){var Y=c;for(Y.limbList=G.slice(this.fractionLen,this.len),Y.len=this.len-this.fractionLen;Y.len>1;)W=Y.divInt(k,Y.len).toString(L),z.push(B.substr(W.length)+W);z.push(""+(Y.limbList[0]||0)),this.sign<0&&z.push("-"),z.reverse(),this.fractionToString(L,z)}else{var H=this.len,$=this.fractionLen;for(this.sign<0&&z.push("-"),H==$&&z.push("0");H--;)W=G[H].toString(L),H==$-1&&z.push("."),z.push(B.substr(W.length)+W)}return o(z.join(""))},D})();l.prototype.cmp=l.prototype.deltaFrom;var c=new l,u=(1<<27)+1,f=Math.log(10)/(53*Math.log(2));function d(D,L,C){var B=D+L,k=B-D,z=B-k;return C[0]=D-z+(L-k),C[1]=B,C}function A(D,L){w=D*L;var C=D*u,B=C-(C-D),k=D-B,z=L*u,G=z-(z-L),W=L-G;return k*W-(w-B*G-k*G-B*W)}var y=(function(){function D(L,C){this.limbList=[],L&&this.setValue(L,C)}return D.prototype.clone=function(){return new D().setBig(this)},D.prototype.setZero=function(){return this.len=0,this},D.prototype.setValue=function(L,C){return typeof L=="number"?this.setNumber(L):L instanceof D?this.setBig(L):this.setString(L.toString(),C||10)},D.prototype.setBig=function(L){var C=L.len;this.len=C;for(var B=0;B<C;++B)this.limbList[B]=L.limbList[B];return this},D.prototype.setNumber=function(L){return this.limbList[0]=L,this.len=L&&1,this},D.prototype.setString=function(L,C){return S[0].setValue(L,C),this.len=S[0].getExpansion(this.limbList),this.normalize(),this},D.prototype.setSum=function(L,C){return this.len=2,d(L,C,this.limbList),this},D.prototype.setProduct=function(L,C){return this.len=2,this.limbList[0]=A(L,C),this.limbList[1]=w,this},D.prototype.normalize=function(){var L=this.limbList,C=this.len,B;if(C){for(var k=C-1,z=C-1,G=L[k],W=void 0;k;)B=L[--k],W=G,G+=B,W=B-(G-W),L[z]=G,z-=W&&1,G=W||G;for(L[z]=G;++z<C;)B=L[z],W=G,G+=B,W-=G-B,L[k]=W,k+=W&&1;L[k]=G,this.len=k+(G&&1)}return this},D.prototype.mulSmall=function(L,C){var B=this.limbList,k=C.limbList,z=this.len,G,W,Y,H=0,$=0;function J(ce){k[$]=ce,$+=ce&&1}J(A(B[H++],L));for(var te=w;H<z;)G=A(B[H++],L),W=te+G,Y=W-te,J(te-(W-Y)+(G-Y)),te=w+W,J(W-(te-w));return k[$]=te,C.len=$+(te&&1),C},D.prototype.mulBig=function(L,C){var B=L.limbList,k=L.len;if(!k)return C.setZero();for(--k,this.mulSmall(B[k],k?T[k&1]:C);k;)--k,this.mulSmall(B[k],C).addBig(T[~k&1],1,k?T[k&1]:C);return C},D.prototype.mul=function(L,C){if(C=C||new D,typeof L=="number")return this.mulSmall(L,C);if(C==this)throw new Error("Cannot multiply in place");return this.mulBig(L,C)},D.prototype.isZero=function(){for(var L=this.limbList,C=this.len;C--;)if(L[C])return!1;return!0},D.prototype.getSign=function(){var L=this.len;return L&&(L=this.limbList[L-1])&&(L>0?1:-1)},D.prototype.deltaFrom=function(L){var C=this.len,B=this.getSign(),k=B;if(typeof L!="number"){if(C=L.len,k-=C&&(C=L.limbList[C-1])&&(C>0?1:-1),k||!B)return k;this.addBig(L,-1,T[0])}else{if(k-=L&&(L>0?1:-1),k||!B)return k;this.addSmall(-L,T[0])}return C=T[0].len,C&&T[0].limbList[C-1]},D.prototype.addSmall=function(L,C){for(var B=this.limbList,k=C.limbList,z=this.len,G,W,Y,H,$=0,J=0;$<z;)W=B[$++],G=W+L,Y=G-W,W-=G-Y,H=W+(L-Y),k[J]=H,J+=H&&1,L=G;return k[J]=L,C.len=J+(L&&1),C},D.prototype.addBig=function(L,C,B){var k=this.limbList,z=L.limbList,G=B.limbList,W=this.len+L.len,Y=0,H=0,$=0,J=k[Y++],te=z[H++]*C,ce=J<0?-J:J,he=te<0?-te:te,ve,Re,Qe,Fe;if(!W)return B.setZero();k[this.len]=1/0,z[L.len]=1/0;function mt(){var Ve;return ce<he?(Ve=J,J=k[Y++],ce=J<0?-J:J):(Ve=te,te=z[H++]*C,he=te<0?-te:te),Ve}for(var Ee=mt();--W;)ve=mt(),Qe=Ee,Ee+=ve,Re=Ee-Qe,Fe=Qe-(Ee-Re)+(ve-Re),G[$]=Fe,$+=Fe&&1;return G[$]=Ee,B.len=$+(Ee&&1),B},D.prototype.addSub=function(L,C,B){return B=B||new D,typeof L=="number"?this.addSmall(C*L,B):this.addBig(L,C,B)},D.prototype.add=function(L,C){return this.addSub(L,1,C)},D.prototype.sub=function(L,C){return this.addSub(L,-1,C)},D.prototype.truncate=function(L){this.normalize();for(var C=this.limbList,B=this.len,k=0,z=B,G=0,W=0;k<z;)G=k+z>>1,W=C[G],W>-1&&W<1?k=G+1:z=G;if(G&&(W<=-1||W>=1)&&(W=C[--G]),G-=L-1,G>0){this.len-=G,B=this.len;for(var Y=0;Y<B;++Y)C[Y]=C[Y+G]}return this},D.prototype.round=function(L){return this.truncate(1+~~(L*f))},D.prototype.valueOf=function(){for(var L=this.limbList,C=this.len,B=0,k=0;k<C;++k)B+=L[k];return B},D.prototype.toString=function(L){var C=this.limbList,B=this.len;for(S[B&1].setZero();B--;)S[~B&1].add(C[B],S[B&1]);return S[~B&1].toString(L)},D})();y.prototype.cmp=y.prototype.deltaFrom;var w=0,S=[new l,new l],T=[new y,new y];function R(D,L){function C(){this.constructor=D}C.prototype=L.prototype,D.prototype=new C}var I=(function(){function D(L,C,B){this.real=typeof L=="object"?L:new this.Base(L,B),this.imag=typeof C=="object"?C:new this.Base(C,B)}return D.prototype.clone=function(){var L=new this.constructor(this.real.clone(),this.imag.clone());return L},D.prototype.setZero=function(){return this.real.setZero(),this.imag.setZero(),this},D.prototype.setValue=function(L){return this.real.setValue(L.real),this.imag.setValue(L.imag),this},D.prototype.mul=function(L,C){return C=C||new this.constructor,L instanceof D?(this.real.mul(L.real,this.temp1),this.imag.mul(L.imag,this.temp2),this.temp1.sub(this.temp2,C.real),this.real.mul(L.imag,this.temp1),this.imag.mul(L.real,this.temp2),this.temp1.add(this.temp2,C.imag)):(this.real.mul(L,C.real),this.imag.mul(L,C.imag)),C},D.prototype.sqr=function(L){return L=L||new this.constructor,this.real.mul(this.real,this.temp1),this.imag.mul(this.imag,this.temp2),this.temp1.sub(this.temp2,L.real),this.real.mul(this.imag,this.temp1),this.temp1.add(this.temp1,L.imag),L},D.prototype.add=function(L,C){return C=C||new this.constructor,L instanceof D?(this.real.add(L.real,C.real),this.imag.add(L.imag,C.imag)):this.real.add(L,C.real),C},D.prototype.sub=function(L,C){return C=C||new this.constructor,L instanceof D?(this.real.sub(L.real,C.real),this.imag.sub(L.imag,C.imag)):this.real.sub(L,C.real),C},D.prototype.truncate=function(L){return this.real.truncate(L),this.imag.truncate(L),this},D})(),P=(function(D){R(L,D);function L(){return D!==null&&D.apply(this,arguments)||this}return L})(I),F=(function(D){R(L,D);function L(){return D!==null&&D.apply(this,arguments)||this}return L})(I);P.prototype.Base=l,P.prototype.temp1=new l,P.prototype.temp2=new l,F.prototype.Base=y,F.prototype.temp1=new y,F.prototype.temp2=new y,i.BigFloat32=l,i.BigFloat53=y,i.BigComplex32=P,i.BigComplex53=F,i.trimNumber=o,i.numberToString=a,Object.defineProperty(i,"__esModule",{value:!0})}))});var ZJ=Bq((Tw,gO)=>{(function(i,e){typeof Tw=="object"&&typeof gO=="object"?gO.exports=e():typeof define=="function"&&define.amd?define("FrameTicker",[],e):typeof Tw=="object"?Tw.FrameTicker=e():i.FrameTicker=e()})(Tw,function(){return(function(i){function e(n){if(t[n])return t[n].exports;var r=t[n]={exports:{},id:n,loaded:!1};return i[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var t={};return e.m=i,e.c=t,e.p="",e(0)})([function(i,e,t){"use strict";var n=t(1),r=(function(){function s(o,a,l){o===void 0&&(o=NaN),a===void 0&&(a=NaN),l===void 0&&(l=!1),this._minFPS=a,this._maxFPS=o,this._timeScale=1,this._currentTick=0,this._currentTime=0,this._tickDeltaTime=0,this._isRunning=!1,this._maxInterval=isNaN(this._minFPS)?NaN:1e3/this._minFPS,this._minInterval=isNaN(this._maxFPS)?NaN:1e3/this._maxFPS,this._onResume=new n.default,this._onPause=new n.default,this._onTick=new n.default,this._onTickOncePerFrame=new n.default,l||this.resume()}return s.prototype.updateOnce=function(o){o(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},s.prototype.resume=function(){this._isRunning||(this._isRunning=!0,this._lastTimeUpdated=this.getTimer(),this._onResume.dispatch(),this.animateOnce())},s.prototype.pause=function(){this._isRunning&&(this._isRunning=!1,this._onPause.dispatch(),window.cancelAnimationFrame(this._animationFrameHandle))},s.prototype.dispose=function(){this.pause(),this._onResume.removeAll(),this._onPause.removeAll(),this._onTick.removeAll()},Object.defineProperty(s.prototype,"currentTick",{get:function(){return this._currentTick},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"currentTimeSeconds",{get:function(){return this._currentTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"tickDeltaTimeSeconds",{get:function(){return this._tickDeltaTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"timeScale",{get:function(){return this._timeScale},set:function(o){this._timeScale!==o&&(this._timeScale=o)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onResume",{get:function(){return this._onResume},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onPause",{get:function(){return this._onPause},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onTick",{get:function(){return this._onTick},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onTickOncePerFrame",{get:function(){return this._onTickOncePerFrame},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"isRunning",{get:function(){return this._isRunning},enumerable:!0,configurable:!0}),s.prototype.animateOnce=function(){var o=this;this._animationFrameHandle=window.requestAnimationFrame(function(){return o.onFrame()})},s.prototype.onFrame=function(){if(this._now=this.getTimer(),this._frameDeltaTime=this._now-this._lastTimeUpdated,isNaN(this._minInterval)||this._frameDeltaTime>=this._minInterval)if(isNaN(this._maxInterval))this.update(this._frameDeltaTime*this._timeScale,!0),this._lastTimeUpdated=this._now;else for(this._interval=Math.min(this._frameDeltaTime,this._maxInterval);this._now>=this._lastTimeUpdated+this._interval;)this.update(this._interval*this._timeScale,this._now<=this._lastTimeUpdated+2*this._maxInterval),this._lastTimeUpdated+=this._interval;this._isRunning&&this.animateOnce()},s.prototype.update=function(o,a){a===void 0&&(a=!0),this._currentTick++,this._currentTime+=o,this._tickDeltaTime=o,this._onTick.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick),a&&this._onTickOncePerFrame.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},s.prototype.getTimer=function(){return Date.now()},s})();Object.defineProperty(e,"__esModule",{value:!0}),e.default=r},function(i,e,t){(function(n,r){i.exports=r()})(this,function(){return(function(n){function r(o){if(s[o])return s[o].exports;var a=s[o]={exports:{},id:o,loaded:!1};return n[o].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}var s={};return r.m=n,r.c=s,r.p="",r(0)})([function(n,r){"use strict";var s=(function(){function o(){this.functions=[]}return o.prototype.add=function(a){return this.functions.indexOf(a)===-1&&(this.functions.push(a),!0)},o.prototype.remove=function(a){var l=this.functions.indexOf(a);return l>-1&&(this.functions.splice(l,1),!0)},o.prototype.removeAll=function(){return this.functions.length>0&&(this.functions.length=0,!0)},o.prototype.dispatch=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var c=this.functions.concat();c.forEach(function(u){u.apply(void 0,a)})},Object.defineProperty(o.prototype,"numItems",{get:function(){return this.functions.length},enumerable:!0,configurable:!0}),o})();Object.defineProperty(r,"__esModule",{value:!0}),r.default=s}])})}])})});var kq=i=>new Promise(e=>setTimeout(e,i)),Dr=i=>document.querySelector(i);async function uhe(){for(let i=0;i<300&&!(window.__atlasDebug&&!Dr("#map-loading")?.checkVisibility?.());i+=1)await kq(100)}async function hhe(){let i="";for(let e=0;e<100;e+=1){await kq(120),await new Promise(r=>requestAnimationFrame(r)),window.advanceTime?.();let t=window.__atlasDebug.snapshot(),n=JSON.stringify([t.zoom,t.center,t.resolution,t.tileStats]);if(n===i)return;i=n}}function Hf(i,e={}){window.dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0,...e}))}function Uq(i,e={}){window.dispatchEvent(new KeyboardEvent("keyup",{key:i,bubbles:!0,cancelable:!0,...e}))}function fhe(i){Dr("#map").dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0}))}function Gm(i,e){i.value=e,i.dispatchEvent(new Event("change",{bubbles:!0}))}function CL(i,e){let t=Dr(i);t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function RL(i,e=!1){let t=Dr("#parity-badge");t||(t=document.createElement("div"),t.id="parity-badge",t.style.cssText="position:fixed;top:8px;right:8px;z-index:9999;padding:6px 12px;font:700 13px monospace;border-radius:6px;color:#fff;pointer-events:none;",document.body.append(t)),t.style.background=e?"#b3261e":"#1a7f37",t.textContent=i}async function dhe(){let i=[],e=async R=>{await hhe(),i.push({name:R,snapshot:JSON.parse(window.render_game_to_text())})};await uhe(),localStorage.clear();let t=Dr("#volume-select"),n=t.options[0].value;Gm(t,n),await e("initial"),CL("#pin-search","a"),await e("search-a");let r=Dr(".search-result");r&&(r.click(),await e("search-select-first"),Dr("#close-detail").click(),await e("detail-closed")),CL("#pin-search",""),await e("search-cleared");let s=Dr(".category-row input");s&&(s.click(),await e("category-hidden"),s.click(),await e("category-restored"));let o=Dr(".only-button");if(o){o.click(),await e("solo-first");let R=Dr("#solo-chip");R&&!R.hidden&&R.click(),await e("solo-cleared")}let a=Dr("#legend .layer-title");a&&(a.click(),await e("section-folded"),Dr("#expand-all").click(),await e("sections-unfolded")),Dr("#hide-all").click(),await e("all-hidden"),Dr("#show-all").click(),await e("all-shown");let l=Dr(".zone-index-item");l&&(l.click(),await e("zone-jumped"),l.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),await e("zone-highlighted"),l.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),await e("zone-unhighlighted"));let c=Dr("[data-expand-collection]");c&&(c.click(),await e("collection-folded"),c.click(),await e("collection-unfolded"));let u=[...document.querySelectorAll(".category-row")].filter(R=>R.querySelector("[data-expand-collection]")),f=u[1]||u[0];if(f){let R=f.querySelector("input[data-collection]");R.click(),await e("collection-hidden"),R.click(),await e("collection-restored");let I=f.querySelector("[data-only-collection]");if(I){I.click(),await e("collection-solo");let P=Dr("#solo-chip");P&&!P.hidden&&P.click(),await e("collection-solo-cleared")}}let d=Dr("[data-label-toggle]");d&&(d.click(),await e("labels-flipped"),d.click(),await e("labels-curated"));let A=[...document.querySelectorAll(".category-row")].filter(R=>!R.querySelector("[data-expand-collection]")).map(R=>R.querySelector("[data-label-toggle]")).find(Boolean);A&&(A.click(),await e("point-labels-flipped"),A.click(),await e("point-labels-curated"));let y=[...document.querySelectorAll(".feature-index")].map(R=>R.querySelector(".zone-index-item")).filter(Boolean);if(y.length>1){let R=F=>F.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),I=y[0],P=y[y.length-1];R(I),R(P),await e("and-highlighted"),Hf("z"),await e("labels-held-highlighted"),Uq("z"),R(I),R(P),await e("and-cleared")}Hf("g"),await e("grid-open"),CL("#grid-input","m"),await e("grid-descended"),Hf(" "),await e("subgrid-hidden"),Hf(" "),Hf("Escape"),await e("grid-ascended"),Hf("Escape"),await e("grid-closed"),Hf("z"),await e("labels-on"),Uq("z"),await e("labels-off"),Hf("b",{metaKey:!0}),await e("sidebar-collapsed"),Hf("b",{metaKey:!0}),await e("sidebar-restored"),Dr("#zoom-in").click(),await e("zoomed-in");let w=Dr("#overview-dock");w&&!Dr("#overview-shelf").hidden&&(w.click(),await e("overview-docked"),w.click(),await e("overview-undocked")),Dr("#zoom-out").click(),await e("zoomed-out"),fhe("Escape"),await e("viewport-escape");let S=Dr("#lens-select");S.options.length>1&&(Gm(S,S.options[1].value),await e("variant-second"),Gm(S,S.options[0].value),await e("variant-first"));let T=Dr("#world-select");return T.options.length>1&&(Gm(T,T.options[1].value),await e("map-second"),Gm(T,T.options[0].value),await e("map-first")),t.options.length>1&&(Gm(t,t.options[1].value),await e("game-second"),Gm(t,n),await e("game-first")),localStorage.clear(),{viewport:[window.innerWidth,window.innerHeight],steps:i}}var PL=!1;async function zq(){if(!PL){PL=!0,RL("parity tour running\u2026");try{let i=await dhe(),e=await fetch("/parity/result",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i,null,2)}),t=(await e.text()).trim();if(!e.ok)throw new Error(`saving failed: ${e.status} ${t}`);RL(`parity tour complete \u2713 ${i.steps.length} steps`),console.log("parity tour saved to",t)}catch(i){RL(`parity tour failed: ${i}`,!0),console.error("parity tour failed",i)}finally{PL=!1}}}window.__atlasTour=zq;window.addEventListener("keydown",i=>{i.key==="F9"&&zq()});var on=i=>document.querySelector(i),ge={volume:on("#volume-select"),world:on("#world-select"),lens:on("#lens-select"),lensField:on("#lens-field"),legend:on("#legend"),search:on("#pin-search"),searchResults:on("#dock-results"),dock:on("#dock"),dockCount:on("#dock-count"),dockFlag:on("#dock-flag"),dockFold:on("#dock-fold"),dockRailName:on("#dock-rail-name"),visibleCount:on("#visible-count"),viewport:on("#map"),globe:on("#globe"),globeToggle:on("#globe-toggle"),layers:on("#layers"),loading:on("#map-loading"),labelsHint:on("#labels-hint"),gridHint:on("#grid-hint"),soloChip:on("#solo-chip"),overview:on("#overview"),overviewShelf:on("#overview-shelf"),overviewDock:on("#overview-dock"),overviewCanvas:on("#overview-canvas"),overviewViewport:on("#overview-viewport"),gridNavigator:on("#grid-navigator"),gridSystem:on("#grid-system"),gridSystemName:on("#grid-system-name"),gridInput:on("#grid-input"),gridBack:on("#grid-back"),subgridToggle:on("#subgrid-toggle"),detail:on("#pin-detail"),detailTitle:on("#detail-title"),detailCategory:on("#detail-category"),detailDescription:on("#detail-description"),detailID:on("#detail-id"),detailCoordinates:on("#detail-coordinates"),detailCoordinatesField:on("#detail-coordinates-field"),detailCell:on("#detail-cell"),detailCellField:on("#detail-cell-field"),detailSource:on("#detail-source"),detailSourceField:on("#detail-source-field"),detailLinks:on("#detail-links"),detailDot:on("#detail-dot"),sidebar:on("#sidebar"),mobileLegend:on("#mobile-legend"),fatal:on("#fatal-error"),fatalMessage:on("#fatal-message"),emptyState:on("#empty-state"),emptyPath:on("#empty-path"),emptyOpen:on("#empty-open"),addBundles:on("#add-bundles")};function qm(i,e,t,n){i.replaceChildren(),e.forEach((r,s)=>{let o=document.createElement("option");o.value=n?String(r[n]):r.slug||String(s),o.textContent=r[t],i.append(o)})}var O={catalog:null,volume:null,world:null,lens:null,engine:null,projection:null,layers:null,sources:null,hiddenCollections:new Set,collapsedSections:new Set,expandedCollections:new Set,features:[],featureByID:new Map,selectedPin:null,selectedZone:null,hoveredPin:null,labelsHeld:!1,gridEnabled:!1,gridSystem:"geohash",globeActive:!1,subgridVisible:!0,gridCell:"",zoneRecords:new Map,highlightedZones:new Set,focusedZoneID:null,labelOverrides:new Map,search:"",fitZoom:0,zoneTitleCount:0,eligibleLocations:0,tileRun:0,tileStats:{requested:0,loaded:0,errors:0,peakPending:0},overviewRun:0,overviewKey:"",overviewPointer:null,overviewDocked:!1,dockFolded:!0,dockDismissed:!1,renderedShard:0,worldRun:0,textByWorld:new Map,restore:null,settling:!1,styleCache:new Map,markerIcons:new Map};var Wf=["#4fb3d5","#c9924b","#82b56a","#c96a6a","#9581cc","#4bc9a9","#d4b04a","#6a92c9","#b08a5a","#8fb3a2"],Hm="0123456789bcdefghjkmnpqrstuvwxyz";var IL="atlas.session.v3";var Vq={light:"rgba(255, 255, 255, 0.96)",dark:"rgba(7, 9, 7, 0.98)"},Vi={labelSizePx:11,neighborLabelSizePx:10,labelInsetPx:5,labelFont:"ui-monospace, SFMono-Regular, Menlo, monospace",prefixAlpha:.55,chip:"rgba(12, 15, 22, 0.76)",neighborChip:"rgba(8, 11, 18, 0.88)",lineWhite:"#ffffff",widths:{leaf:2.5,scope:2.5,scopeBare:1.8,child:1.4,neighbor:1},childLineAlpha:.82,neighborLineAlpha:.44,leafFillAlpha:.14,childFillAlpha:.055,neighborTextAlpha:.72,dimColor:"#050810",dimBase:.3,dimStep:.06,dimCap:.52};function AT(i){let e=[...jf()],t=!0;for(let n of i){let r=Hm.indexOf(n);if(!(r<0))for(let s of[16,8,4,2,1]){if(t){let o=(e[0]+e[2])/2;r&s?e[0]=o:e[2]=o}else{let o=(e[1]+e[3])/2;r&s?e[1]=o:e[3]=o}t=!t}}return e}function DL(i,e){let t=[...jf()],[n,r]=i;if(n<t[0]||n>t[2]||r<t[1]||r>t[3])return"";let s=!0,o="";for(let a=0;a<e;a++){let l=0;for(let c of[16,8,4,2,1]){if(s){let u=(t[0]+t[2])/2;n>=u?(l|=c,t[0]=u):t[2]=u}else{let u=(t[1]+t[3])/2;r>=u?(l|=c,t[1]=u):t[3]=u}s=!s}o+=Hm[l]}return o}var LL={key:null,extent:null};function phe(i){let t=`${jf().join(",")}|${i}`;return LL.key!==t&&(LL={key:t,extent:AT(i)}),LL.extent}var NL={slug:"geohash",name:"Geohash",short:"G",appliesTo(){return!0},maxLevel(){return 3},inputLength(){return 3},level(i){return i.length},parent(i){return i.slice(0,-1)},children(i){return[...Hm].map(e=>i+e)},childIndex(i){return Math.max(0,Hm.indexOf(i[i.length-1]))},contains(i,e){let t=phe(i),[n,r]=e;return n>=t[0]&&n<=t[2]&&r>=t[1]&&r<=t[3]},descendTarget(i,e){return DL(e,i.length+1)},bbox:AT,center(i){let e=AT(i);return[(e[0]+e[2])/2,(e[1]+e[3])/2]},ring(i){let[e,t,n,r]=AT(i);return[[e,t],[e,r],[n,r],[n,t],[e,t]]},poleContained(){return null},label(i){return{context:i.slice(0,-1),principal:i.slice(-1)}},colorKey(i){return Math.max(0,Hm.indexOf(i[i.length-1]))%Wf.length},normalizeInput(i){return[...i.toLocaleLowerCase()].filter(e=>Hm.includes(e)).slice(0,3).join("")},parseInput(i){return i},locate(i){let e=DL(i,3);return e?{label:"Geohash",value:e}:null}};function Gq(i,e=3){return DL(i,e)}var T1=Oq(Hq());function Wq(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function sy(i,e,t){if(bH())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&oy(r,t.prototype),r}function jq(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,vhe(n.key),n)}}function mhe(i,e,t){return e&&jq(i.prototype,e),t&&jq(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function Ct(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t)return(t=t.call(i)).next.bind(t);if(Array.isArray(i)||(t=_he(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var n=0;return function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.2+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yT(){return yT=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},yT.apply(null,arguments)}function HL(i){return HL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},HL(i)}function hy(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,oy(i,e)}function Ahe(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function bH(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bH=function(){return!!i})()}function oy(i,e){return oy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},oy(i,e)}function ghe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function vhe(i){var e=ghe(i,"string");return typeof e=="symbol"?e:e+""}function _he(i,e){if(i){if(typeof i=="string")return Wq(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Wq(i,e):void 0}}function I1(i){var e=typeof Map=="function"?new Map:void 0;return I1=function(t){if(t===null||!Ahe(t))return t;if(typeof t!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return sy(t,arguments,HL(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),oy(n,t)},I1(i)}var Li=(function(){function i(t,n){this.lo=0,this.hi=0,this.lo=t,this.hi=n}var e=i.prototype;return e.isEmpty=function(){return this.lo>this.hi},e.equals=function(n){return this.lo==n.lo&&this.hi==n.hi||this.isEmpty()&&n.isEmpty()},e.center=function(){return .5*(this.lo+this.hi)},e.length=function(){return this.hi-this.lo},e.contains=function(n){return this.lo<=n&&n<=this.hi},e.containsInterval=function(n){return n.isEmpty()?!0:this.lo<=n.lo&&n.hi<=this.hi},e.interiorContains=function(n){return this.lo<n&&n<this.hi},e.interiorContainsInterval=function(n){return n.isEmpty()?!0:this.lo<n.lo&&n.hi<this.hi},e.intersects=function(n){return this.lo<=n.lo?n.lo<=this.hi&&n.lo<=n.hi:this.lo<=n.hi&&this.lo<=this.hi},e.interiorIntersects=function(n){return n.lo<this.hi&&this.lo<n.hi&&this.lo<this.hi&&n.lo<=n.hi},e.intersection=function(n){return new i(Math.max(this.lo,n.lo),Math.min(this.hi,n.hi))},e.union=function(n){return this.isEmpty()?n:n.isEmpty()?this:new i(Math.min(this.lo,n.lo),Math.max(this.hi,n.hi))},e.addPoint=function(n){return this.isEmpty()?new i(n,n):n<this.lo?new i(n,this.hi):n>this.hi?new i(this.lo,n):this},e.clampPoint=function(n){return Math.max(this.lo,Math.min(this.hi,n))},e.expanded=function(n){return this.isEmpty()?this:new i(this.lo-n,this.hi+n)},e.approxEqual=function(n,r){return r===void 0&&(r=1e-15),this.isEmpty()?n.length()<=2*r:n.isEmpty()?this.length()<=2*r:Math.abs(n.lo-this.lo)<=r&&Math.abs(n.hi-this.hi)<=r},e.directedHausdorffDistance=function(n){return this.isEmpty()?0:n.isEmpty()?1/0:Math.max(0,Math.max(this.hi-n.hi,n.lo-this.lo))},e.trunc=function(n){n===void 0&&(n=15);var r=+("1e"+n),s=function(a){return Math.round(a*r)/r};return new i(s(this.lo),s(this.hi))},e.toString=function(){var n=this.trunc(7);return"["+n.lo.toFixed(7)+", "+n.hi.toFixed(7)+"]"},i.empty=function(){return new i(1,0)},i.fromPoint=function(n){return new i(n,n)},i})();var Ci=(function(){function i(t,n){t===void 0&&(t=0),n===void 0&&(n=0),this.x=0,this.y=0,this.x=t,this.y=n}var e=i.prototype;return e.add=function(n){return new i(this.x+n.x,this.y+n.y)},e.sub=function(n){return new i(this.x-n.x,this.y-n.y)},e.mul=function(n){return new i(this.x*n,this.y*n)},e.ortho=function(){return new i(-this.y,this.x)},e.dot=function(n){return this.x*n.x+this.y*n.y},e.cross=function(n){return this.x*n.y-this.y*n.x},e.norm=function(){return Math.hypot(this.x,this.y)},e.normalize=function(){return this.x==0&&this.y==0?this:this.mul(1/this.norm())},e.trunc=function(n){n===void 0&&(n=15);var r=+("1e"+n),s=function(a){return Math.round(a*r)/r};return new i(s(this.x),s(this.y))},e.equals=function(n){return this.x===n.x&&this.y===n.y},e.toString=function(){var n=this.trunc(12);return"("+n.x.toFixed(12)+", "+n.y.toFixed(12)+")"},i})(),Hr=(function(){function i(t,n){t===void 0&&(t=new Li(0,0)),n===void 0&&(n=new Li(0,0)),this.x=t,this.y=n}var e=i.prototype;return e.isValid=function(){return this.x.isEmpty()==this.y.isEmpty()},e.isEmpty=function(){return this.x.isEmpty()},e.vertices=function(){return[new Ci(this.x.lo,this.y.lo),new Ci(this.x.hi,this.y.lo),new Ci(this.x.hi,this.y.hi),new Ci(this.x.lo,this.y.hi)]},e.vertexIJ=function(n,r){var s=this.x.lo;n==1&&(s=this.x.hi);var o=this.y.lo;return r==1&&(o=this.y.hi),new Ci(s,o)},e.lo=function(){return new Ci(this.x.lo,this.y.lo)},e.hi=function(){return new Ci(this.x.hi,this.y.hi)},e.center=function(){return new Ci(this.x.center(),this.y.center())},e.size=function(){return new Ci(this.x.length(),this.y.length())},e.containsPoint=function(n){return this.x.contains(n.x)&&this.y.contains(n.y)},e.interiorContainsPoint=function(n){return this.x.interiorContains(n.x)&&this.y.interiorContains(n.y)},e.contains=function(n){return this.x.containsInterval(n.x)&&this.y.containsInterval(n.y)},e.interiorContains=function(n){return this.x.interiorContainsInterval(n.x)&&this.y.interiorContainsInterval(n.y)},e.intersects=function(n){return this.x.intersects(n.x)&&this.y.intersects(n.y)},e.interiorIntersects=function(n){return this.x.interiorIntersects(n.x)&&this.y.interiorIntersects(n.y)},e.addPoint=function(n){return new i(this.x.addPoint(n.x),this.y.addPoint(n.y))},e.addRect=function(n){return new i(this.x.union(n.x),this.y.union(n.y))},e.clampPoint=function(n){return new Ci(this.x.clampPoint(n.x),this.y.clampPoint(n.y))},e.expanded=function(n){var r=this.x.expanded(n.x),s=this.y.expanded(n.y);return r.isEmpty()||s.isEmpty()?i.empty():new i(r,s)},e.expandedByMargin=function(n){return this.expanded(new Ci(n,n))},e.union=function(n){return new i(this.x.union(n.x),this.y.union(n.y))},e.intersection=function(n){var r=this.x.intersection(n.x),s=this.y.intersection(n.y);return r.isEmpty()||s.isEmpty()?i.empty():new i(r,s)},e.approxEqual=function(n){return this.x.approxEqual(n.x)&&this.y.approxEqual(n.y)},e.string=function(){return"["+this.lo().toString()+", "+this.hi.toString()+"]"},i.fromPoints=function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];if(r.length==0)return new i;for(var o=new i(new Li(r[0].x,r[0].x),new Li(r[0].y,r[0].y)),a=1;a<r.length;a++)o=o.addPoint(r[a]);return o},i.fromCenterSize=function(n,r){return new i(new Li(n.x-r.x/2,n.x+r.x/2),new Li(n.y-r.y/2,n.y+r.y/2))},i.fromRect=function(n){return new i(new Li(n.x.lo,n.x.hi),new Li(n.y.lo,n.y.hi))},i.empty=function(){return new i(Li.empty(),Li.empty())},i})();var Wt=(function(){function i(t,n,r){this.x=0,this.y=0,this.z=0,this.x=t,this.y=n,this.z=r}var e=i.prototype;return e.approxEqual=function(n){var r=1e-16;return Math.abs(this.x-n.x)<r&&Math.abs(this.y-n.y)<r&&Math.abs(this.z-n.z)<r},e.toString=function(){return"("+this.x.toFixed(24)+", "+this.y.toFixed(24)+", "+this.z.toFixed(24)+")"},e.norm=function(){return Math.sqrt(this.dot(this))},e.norm2=function(){return this.dot(this)},e.normalize=function(){var n=this.norm2();return n==0?new i(0,0,0):this.mul(1/Math.sqrt(n))},e.isUnit=function(){var n=5e-14;return Math.abs(this.norm2()-1)<=n},e.abs=function(){return new i(Math.abs(this.x),Math.abs(this.y),Math.abs(this.z))},e.add=function(n){return new i(this.x+n.x,this.y+n.y,this.z+n.z)},e.sub=function(n){return new i(this.x-n.x,this.y-n.y,this.z-n.z)},e.mul=function(n){return new i(n*this.x,n*this.y,n*this.z)},e.dot=function(n){return this.x*n.x+this.y*n.y+this.z*n.z||0},e.cross=function(n){return new i(this.y*n.z-this.z*n.y,this.z*n.x-this.x*n.z,this.x*n.y-this.y*n.x)},e.distance=function(n){return this.sub(n).norm()},e.angle=function(n){return Math.atan2(this.cross(n).norm(),this.dot(n))},e.ortho=function(){var n=new i(0,0,0),r=this.largestComponent();return r===i.X_AXIS?n.z=1:r===i.Y_AXIS?n.x=1:n.y=1,this.cross(n).normalize()},e.largestComponent=function(){var n=this.abs();return n.x>n.y?n.x>n.z?i.X_AXIS:i.Z_AXIS:n.y>n.z?i.Y_AXIS:i.Z_AXIS},e.smallestComponent=function(){var n=this.abs();return n.x<n.y?n.x<n.z?i.X_AXIS:i.Z_AXIS:n.y<n.z?i.Y_AXIS:i.Z_AXIS},e.equals=function(n){return this.x==n.x&&this.y==n.y&&this.z==n.z},e.cmp=function(n){return this.x<n.x?-1:this.x>n.x?1:this.y<n.y?-1:this.y>n.y?1:this.z<n.z?-1:this.z>n.z?1:0},i})();Wt.X_AXIS=0;Wt.Y_AXIS=1;Wt.Z_AXIS=2;var FL=(function(){function i(t,n,r){this.x=t,this.y=n,this.z=r}i.fromVector=function(n){return new i(new T1.BigFloat32(n.x),new T1.BigFloat32(n.y),new T1.BigFloat32(n.z))};var e=i.prototype;return e.vector=function(){return new Wt(this.x.valueOf(),this.y.valueOf(),this.z.valueOf()).normalize()},e.equals=function(n){return this.x.cmp(n.x)===0&&this.y.cmp(n.y)===0&&this.z.cmp(n.z)===0},e.toString=function(){return"("+this.x.toString()+", "+this.y.toString()+", "+this.z.toString()+")"},e.norm2=function(){return this.dot(this)},e.isUnit=function(){return this.norm2().cmp(new T1.BigFloat32(1))===0},e.abs=function(){var n=this.x.mul(this.x.getSign()),r=this.y.mul(this.y.getSign()),s=this.z.mul(this.z.getSign());return new i(n,r,s)},e.add=function(n){return new i(this.x.add(n.x),this.y.add(n.y),this.z.add(n.z))},e.sub=function(n){return new i(this.x.sub(n.x),this.y.sub(n.y),this.z.sub(n.z))},e.mul=function(n){return new i(this.x.mul(n),this.y.mul(n),this.z.mul(n))},e.mulByFloat64=function(n){return this.mul(new T1.BigFloat32(n))},e.dot=function(n){return this.x.mul(n.x).add(this.y.mul(n.y).add(this.z.mul(n.z)))},e.cross=function(n){return new i(this.y.mul(n.z).sub(this.z.mul(n.y)),this.z.mul(n.x).sub(this.x.mul(n.z)),this.x.mul(n.y).sub(this.y.mul(n.x)))},e.largestComponent=function(){var n=this.abs();return n.x.cmp(n.y)>0?n.x.cmp(n.z)>0?Wt.X_AXIS:Wt.Z_AXIS:n.y.cmp(n.z)>0?Wt.Y_AXIS:Wt.Z_AXIS},e.smallestComponent=function(){var n=this.abs();return n.x.cmp(n.y)<0?n.x.cmp(n.z)<0?Wt.X_AXIS:Wt.Z_AXIS:n.y.cmp(n.z)<0?Wt.Y_AXIS:Wt.Z_AXIS},e.isZero=function(){return this.x.isZero()&&this.y.isZero()&&this.z.isZero()},i})();var WL=Math.PI/180,hp=function(e,t){if(isNaN(e)||isNaN(t)||!isFinite(e)||t===0)return NaN;var n=e/t,r=Math.round(n);Math.abs(n-r)===.5&&(r=2*Math.round(n/2));var s=e-r*t;return s||Math.sign(e)*0},wH=function(e,t){if(isNaN(e)||isNaN(t))return NaN;if(e===t)return t;if(e===0)return t>0?Number.MIN_VALUE:-Number.MIN_VALUE;var n=new ArrayBuffer(8),r=new DataView(n);r.setFloat64(0,e,!0);var s=r.getBigUint64(0,!0);return e>0==t>e?s+=1n:s-=1n,r.setBigUint64(0,s,!0),r.getFloat64(0,!0)},xhe=function(e){var t=e&-e&0xffffffffffffffffn;if(t===0n)return 64;var n=Math.clz32(Number(t&0xffffffffn));if(n<32)return 31-n;var r=Math.clz32(Number(t>>32n&0xffffffffn));return 63-r},SH=function(e){var t=e&0xffffffffffffffffn;if(t===0n)return 64;var n=Math.clz32(Number(t>>32n&0xffffffffn));if(n<32)return 63-n;var r=Math.clz32(Number(t&0xffffffffn));return 31-r},jL=function(e,t){return e*Math.pow(2,t)},Xq=function(e){return isNaN(e)?NaN:e===0?-1/0:isFinite(e)?(e=Math.abs(e),e<Number.MIN_VALUE?-1074:Math.floor(Math.log2(e))):1/0},bc=function(e){return e},TH=function(e){return e/WL||0};var yhe=function(){return 1/0},bhe=function(e){return e==1/0};var $q=function(e){return TH(e).toFixed(7)},Yq=function(e,t,n){return n===void 0&&(n=1e-15),Math.abs(e-t)<=n};var bT=-1,L1=2,Sc=4,cD=4,Wm=1e-15,ry=2220446049e-25,_T=function(e){if(e<0)return bT;if(bhe(e))return Cc();var t=2*Math.sin(.5*Math.min(Math.PI,bc(e)));return t*t},XL=function(e){return e>cD?Sc:e},LT=function(e,t){return whe(e)?e:Math.max(0,Math.min(cD,e+t))},wT=function(e){return e<0?-1:EH(e)?yhe():2*Math.asin(.5*Math.sqrt(e))},Cc=function(){return 1/0},EH=function(e){return e==1/0},whe=function(e){return e<0||EH(e)};var D1=function(e){return e>=cD?Cc():e<0?0:wH(e,10)};var uD=function(e){return 4.5*ry*e+16*ry*ry};var ey=function(e,t){return _T(wT(e)+wT(t))},She=function(e,t){if(t==0)return e;if(e<=t)return 0;var n=e*(1-.25*t),r=t*(1-.25*e);return Math.max(0,n+r-2*Math.sqrt(n*r))},The=function(e){return Math.sqrt(MH(e))||0},MH=function(e){return e*(1-.25*e)||0};var eo=(function(){function i(t,n){this.lo=t,this.hi=n}i.fromEndpoints=function(n,r){var s=new i(n,r);return n===-Math.PI&&r!==Math.PI&&(s.lo=Math.PI),r===-Math.PI&&n!==Math.PI&&(s.hi=Math.PI),s},i.fromPointPair=function(n,r){return n===-Math.PI&&(n=Math.PI),r===-Math.PI&&(r=Math.PI),i.positiveDistance(n,r)<=Math.PI?new i(n,r):new i(r,n)},i.emptyInterval=function(){return new i(Math.PI,-Math.PI)},i.fullInterval=function(){return new i(-Math.PI,Math.PI)};var e=i.prototype;return e.isValid=function(){return Math.abs(this.lo)<=Math.PI&&Math.abs(this.hi)<=Math.PI&&!(this.lo===-Math.PI&&this.hi!==Math.PI)&&!(this.hi===-Math.PI&&this.lo!==Math.PI)},e.isFull=function(){return this.lo===-Math.PI&&this.hi===Math.PI},e.isEmpty=function(){return this.lo===Math.PI&&this.hi===-Math.PI},e.isInverted=function(){return this.lo>this.hi},e.equals=function(n){return this.lo==n.lo&&this.hi==n.hi||this.isEmpty()&&n.isEmpty()},e.invert=function(){return new i(this.hi,this.lo)},e.center=function(){var n=.5*(this.lo+this.hi);return this.isInverted()?n<=0?n+Math.PI:n-Math.PI:n},e.length=function(){var n=this.hi-this.lo;return n>=0||(n+=2*Math.PI,n>0)?n:-1},e.fastContains=function(n){return this.isInverted()?(n>=this.lo||n<=this.hi)&&!this.isEmpty():n>=this.lo&&n<=this.hi},e.contains=function(n){return n===-Math.PI&&(n=Math.PI),this.fastContains(n)},e.containsInterval=function(n){return this.isInverted()?n.isInverted()?n.lo>=this.lo&&n.hi<=this.hi:(n.lo>=this.lo||n.hi<=this.hi)&&!this.isEmpty():n.isInverted()?this.isFull()||n.isEmpty():n.lo>=this.lo&&n.hi<=this.hi},e.interiorContains=function(n){return n===-Math.PI&&(n=Math.PI),this.isInverted()?n>this.lo||n<this.hi:n>this.lo&&n<this.hi||this.isFull()},e.interiorContainsInterval=function(n){return this.isInverted()?n.isInverted()?n.lo>this.lo&&n.hi<this.hi||n.isEmpty():n.lo>this.lo||n.hi<this.hi:n.isInverted()?this.isFull()||n.isEmpty():n.lo>this.lo&&n.hi<this.hi||this.isFull()},e.intersects=function(n){return this.isEmpty()||n.isEmpty()?!1:this.isInverted()?n.isInverted()||n.lo<=this.hi||n.hi>=this.lo:n.isInverted()?n.lo<=this.hi||n.hi>=this.lo:n.lo<=this.hi&&n.hi>=this.lo},e.interiorIntersects=function(n){return this.isEmpty()||n.isEmpty()||this.lo===this.hi?!1:this.isInverted()?n.isInverted()||n.lo<this.hi||n.hi>this.lo:n.isInverted()?n.lo<this.hi||n.hi>this.lo:n.lo<this.hi&&n.hi>this.lo||this.isFull()},i.positiveDistance=function(n,r){var s=r-n;return s>=0?s:r+Math.PI-(n-Math.PI)},e.union=function(n){return n.isEmpty()?this:this.fastContains(n.lo)?this.fastContains(n.hi)?this.containsInterval(n)?this:i.fullInterval():new i(this.lo,n.hi):this.fastContains(n.hi)?new i(n.lo,this.hi):this.isEmpty()||n.fastContains(this.lo)?n:i.positiveDistance(n.hi,this.lo)<i.positiveDistance(this.hi,n.lo)?new i(n.lo,this.hi):new i(this.lo,n.hi)},e.intersection=function(n){return n.isEmpty()?i.emptyInterval():this.fastContains(n.lo)?this.fastContains(n.hi)?n.length()<this.length()?n:this:new i(n.lo,this.hi):this.fastContains(n.hi)?new i(this.lo,n.hi):n.fastContains(this.lo)?this:i.emptyInterval()},e.addPoint=function(n){return Math.abs(n)>Math.PI?this:(n===-Math.PI&&(n=Math.PI),this.fastContains(n)?this:this.isEmpty()?new i(n,n):i.positiveDistance(n,this.lo)<i.positiveDistance(this.hi,n)?new i(n,this.hi):new i(this.lo,n))},e.expanded=function(n){if(n>=0){if(this.isEmpty())return this;if(this.length()+2*n+2*ry>=2*Math.PI)return i.fullInterval()}else{if(this.isFull())return this;if(this.length()+2*n-2*ry<=0)return i.emptyInterval()}var r=i.fromEndpoints(hp(this.lo-n,2*Math.PI),hp(this.hi+n,2*Math.PI));return r.lo<=-Math.PI&&(r.lo=Math.PI),r},e.approxEqual=function(n){return this.isEmpty()?n.length()<=2*Wm:n.isEmpty()?this.length()<=2*Wm:this.isFull()?n.length()>=2*(Math.PI-Wm):n.isFull()?this.length()>=2*(Math.PI-Wm):Math.abs(hp(n.lo-this.lo,2*Math.PI))<=Wm&&Math.abs(hp(n.hi-this.hi,2*Math.PI))<=Wm&&Math.abs(this.length()-n.length())<=2*Wm},e.toString=function(){return"["+this.lo.toFixed(7)+", "+this.hi.toFixed(7)+"]"},e.complement=function(){return this.lo===this.hi?i.fullInterval():new i(this.hi,this.lo)},e.complementCenter=function(){return this.lo!==this.hi?this.complement().center():this.hi<=0?this.hi+Math.PI:this.hi-Math.PI},e.directedHausdorffDistance=function(n){if(n.containsInterval(this))return 0;if(n.isEmpty())return Math.PI;var r=n.complementCenter();if(this.contains(r))return i.positiveDistance(n.hi,r);var s=0;i.fromEndpoints(n.hi,r).contains(this.hi)&&(s=i.positiveDistance(n.hi,this.hi));var o=0;return i.fromEndpoints(r,n.lo).contains(this.lo)&&(o=i.positiveDistance(this.lo,n.lo)),Math.max(s,o)},e.project=function(n){if(n===-Math.PI&&(n=Math.PI),this.fastContains(n))return n;var r=i.positiveDistance(n,this.lo),s=i.positiveDistance(this.hi,n);return r<s?this.lo:this.hi},i})();var ul=4,Mc=1,$f=2,Ehe=[[0,1,3,2],[0,3,1,2],[2,3,1,0],[2,1,3,0]],hD=[[0,1,3,2],[0,2,3,1],[3,2,0,1],[3,1,0,2]],M1=[Mc,0,0,$f|Mc],CH=[],RH=[];fp(0,0,0,0,0,0);fp(0,0,0,Mc,0,Mc);fp(0,0,0,$f,0,$f);fp(0,0,0,Mc|$f,0,Mc|$f);function fp(i,e,t,n,r,s){if(i==ul){var o=(e<<ul)+t;RH[(o<<2)+n]=(r<<2)+s,CH[(r<<2)+n]=(o<<2)+s;return}i++,e<<=1,t<<=1,r<<=2;var a=hD[s];fp(i,e+(a[0]>>1),t+(a[0]&1),n,r,s^M1[0]),fp(i,e+(a[1]>>1),t+(a[1]&1),n,r+1,s^M1[1]),fp(i,e+(a[2]>>1),t+(a[2]&1),n,r+2,s^M1[2]),fp(i,e+(a[3]>>1),t+(a[3]&1),n,r+3,s^M1[3])}var Mhe=3,PH=6,_i=30,fy=2*_i+1,hl=Number(1n<<BigInt(_i)),mp=BigInt(PH)<<BigInt(fy),Zq=Number(BigInt(hl)<<1n),dp=function(e){return e>Zq?1:e/Zq},Tc=function(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))},sh=function(e){return e>=0?.5*Math.sqrt(1+3*e):1-.5*Math.sqrt(1-3*e)},ay=function(e){var t=e.largestComponent();switch(t){case Wt.X_AXIS:e.x<0&&(t+=3);break;case Wt.Y_AXIS:e.y<0&&(t+=3);break;case Wt.Z_AXIS:e.z<0&&(t+=3);break}return t},$m=function(e,t){switch(e){case 0:return[t.y/t.x,t.z/t.x];case 1:return[-t.x/t.y,t.z/t.y];case 2:return[-t.x/t.z,-t.y/t.z];case 3:return[t.z/t.x,t.y/t.x];case 4:return[t.z/t.y,-t.x/t.y];default:return[-t.y/t.z,-t.x/t.z]}},ST=function(e){var t=ay(e),n=$m(t,e),r=n[0],s=n[1];return[t,r,s]},oh=function(e,t,n){switch(e){case 0:return new Wt(1,t,n);case 1:return new Wt(-t,1,n);case 2:return new Wt(-t,-n,1);case 3:return new Wt(-1,-n,-t);case 4:return new Wt(n,-1,-t);default:return new Wt(n,t,-1)}},Che=function(e,t){switch(e){case 0:if(t.x<=0)return[0,0,!1];break;case 1:if(t.y<=0)return[0,0,!1];break;case 2:if(t.z<=0)return[0,0,!1];break;case 3:if(t.x>=0)return[0,0,!1];break;case 4:if(t.y>=0)return[0,0,!1];break;default:if(t.z>=0)return[0,0,!1];break}var n=$m(e,t),r=n[0],s=n[1];return[r,s,!0]},Ap=function(e,t){switch(e){case 0:return new Wt(t.y,t.z,t.x);case 1:return new Wt(-t.x,t.z,t.y);case 2:return new Wt(-t.x,-t.y,t.z);case 3:return new Wt(-t.z,-t.y,-t.x);case 4:return new Wt(-t.z,t.x,-t.y);default:return new Wt(t.y,t.x,-t.z)}},xT=function(e,t,n){return oh(e,Tc(dp(t)),Tc(dp(n)))},Kq=function(e,t){switch(e){case 0:return new Wt(t,-1,0);case 1:return new Wt(1,t,0);case 2:return new Wt(1,0,t);case 3:return new Wt(-t,0,1);case 4:return new Wt(0,-t,1);default:return new Wt(0,-1,-t)}},Qq=function(e,t){switch(e){case 0:return new Wt(-t,0,1);case 1:return new Wt(0,-t,1);case 2:return new Wt(0,-1,-t);case 3:return new Wt(t,-1,0);case 4:return new Wt(1,t,0);default:return new Wt(1,0,t)}},Rhe=[[new Wt(0,1,0),new Wt(0,0,1),new Wt(1,0,0)],[new Wt(-1,0,0),new Wt(0,0,1),new Wt(0,1,0)],[new Wt(-1,0,0),new Wt(0,-1,0),new Wt(0,0,1)],[new Wt(0,0,-1),new Wt(0,-1,0),new Wt(-1,0,0)],[new Wt(0,0,-1),new Wt(1,0,0),new Wt(0,-1,0)],[new Wt(0,1,0),new Wt(1,0,0),new Wt(0,0,-1)]],Phe=[[[4,1],[5,2],[3,0]],[[0,3],[5,2],[4,1]],[[0,3],[1,4],[5,2]],[[2,5],[1,4],[0,3]],[[2,5],[3,0],[1,4]],[[4,1],[3,0],[2,5]]],IH=function(e,t){return Rhe[e][t]},TT=function(e,t,n){return Phe[e][t][n]},Ihe=function(e){return IH(e,0)},Lhe=function(e){return IH(e,1)},$L=Math.PI/2,Jq=-$L,ar=(function(){function i(t,n){this.lat=t,this.lng=n}i.fromDegrees=function(n,r){return new i(n*WL,r*WL)},i.latitude=function(n){var r=n.vector;return Math.atan2(r.z,Math.sqrt(r.x*r.x+r.y*r.y))},i.longitude=function(n){return Math.atan2(n.vector.y,n.vector.x)},i.fromPoint=function(n){return new i(this.latitude(n),this.longitude(n))};var e=i.prototype;return e.isValid=function(){return Math.abs(this.lat)<=Math.PI/2&&Math.abs(this.lng)<=Math.PI},e.normalized=function(){var n=this.lat;n>$L?n=$L:n<Jq&&(n=Jq);var r=hp(this.lng,2*Math.PI);return new i(n,r)},e.toString=function(){return"["+$q(this.lat)+", "+$q(this.lng)+"]"},e.distance=function(n){var r=Math.sin(.5*(n.lat-this.lat)),s=Math.sin(.5*(n.lng-this.lng)),o=r*r+s*s*Math.cos(this.lat)*Math.cos(n.lat);return 2*Math.atan2(Math.sqrt(o),Math.sqrt(Math.max(0,1-o)))},e.approxEqual=function(n){return Yq(this.lat,n.lat)&&Yq(this.lng,n.lng)},i})(),Dhe=function(e,t){return new We(e[0][t],e[1][t],e[2][t])},BL=function(e,t,n){return e[0][t]=n.x,e[1][t]=n.y,e[2][t]=n.z,e},LH=function(e,t){return new We(e[0][0]*t.x+e[0][1]*t.y+e[0][2]*t.z,e[1][0]*t.x+e[1][1]*t.y+e[1][2]*t.z,e[2][0]*t.x+e[2][1]*t.y+e[2][2]*t.z)},Nhe=function(e){return[[e[0][0],e[1][0],e[2][0]],[e[0][1],e[1][1],e[2][1]],[e[0][2],e[1][2],e[2][2]]]},fD=function(e){var t=[[0,0,0],[0,0,0],[0,0,0]];return BL(t,2,e),BL(t,1,We.ortho(e)),BL(t,0,We.fromVector(Dhe(t,1).vector.cross(e.vector))),t},Fhe=function(e,t){return LH(Nhe(e),t)},Bhe=function(e,t){return LH(e,t)},ET=-1,Xf=0,O1=1,DH=1e-15,Ki=2220446049250313e-31,eH=1.8274*Ki,Ohe=3.2321*Ki,YL=function(e,t,n){return n.vector.cross(e.vector).dot(t.vector)>0},jm=function(e,t,n){var r=ZL(e,t,n);return r===Xf&&(r=KL(e,t,n)),r},Uhe=function(e,t,n){var r=t.vector.sub(e.vector),s=r.norm2(),o=n.vector.sub(t.vector),a=o.norm2(),l=e.vector.sub(n.vector),c=l.norm2(),u,f,d;s>=a&&s>=c?(u=l,f=o,d=n.vector):a>=c?(u=r,f=l,d=e.vector):(u=o,f=r,d=t.vector);var A=-u.cross(f).dot(d),y=Ohe*Math.sqrt(u.norm2()*f.norm2());return A>y?O1:A<-y?ET:Xf},ZL=function(e,t,n){var r=e.vector.cross(t.vector).dot(n.vector);return r>eH?O1:r<-eH?ET:Xf},KL=function(e,t,n){if(e.equals(t)||t.equals(n)||n.equals(e))return Xf;var r=Uhe(e,t,n);return r!==Xf?r:khe(e,t,n,!0)},khe=function(e,t,n,r){var s=O1,o=e,a=t,l=n;if(o.vector.cmp(a.vector)>0){var c=[a,o];o=c[0],a=c[1],s=-s}if(a.vector.cmp(l.vector)>0){var u=[l,a];a=u[0],l=u[1],s=-s}if(o.vector.cmp(a.vector)>0){var f=[a,o];o=f[0],a=f[1],s=-s}var d=FL.fromVector(o.vector),A=FL.fromVector(a.vector),y=FL.fromVector(l.vector),w=A.cross(y),S=d.dot(w),T=S.getSign();return T===Xf&&r&&(T=zhe(d,A,y,w)),s*T},zhe=function(e,t,n,r){var s=r.z.getSign();return s!==0||(s=r.y.getSign(),s!==0)||(s=r.x.getSign(),s!==0)||(s=n.x.mul(e.y).sub(n.y.mul(e.x)).getSign(),s!==0)||(s=n.x.getSign(),s!==0)||(s=-n.y.getSign(),s!==0)||(s=n.z.mul(e.x).sub(n.x.mul(e.z)).getSign(),s!==0)||(s=n.z.getSign(),s!==0)||(s=e.x.mul(t.y).sub(e.y.mul(t.x)).getSign(),s!==0)||(s=-t.x.getSign(),s!==0)||(s=t.y.getSign(),s!==0)||(s=e.x.getSign(),s!==0)?s:O1},We=(function(){function i(t,n,r){this.vector=new Wt(t,n,r)}i.fromVector=function(n){return new i(n.x,n.y,n.z)},i.fromLatLng=function(n){var r=n.lat,s=n.lng,o=Math.cos(r);return new i(Math.cos(s)*o,Math.sin(s)*o,Math.sin(r))},i.fromCoords=function(n,r,s){return n===0&&r===0&&s===0?this.originPoint():i.fromVector(new Wt(n,r,s).normalize())},i.originPoint=function(){return new i(-.00999946643502502,.002592454260932412,.999946643502502)};var e=i.prototype;return e.pointCross=function(n){var r=this.vector.add(n.vector).cross(n.vector.sub(this.vector));return r.x===0&&r.y===0&&r.z===0&&(r=this.vector.ortho()),i.fromVector(r)},i.orderedCCW=function(n,r,s,o){var a=0;return jm(r,o,n)!==ET&&a++,jm(s,o,r)!==ET&&a++,jm(n,o,s)===O1&&a++,a>=2},e.distance=function(n){return this.vector.angle(n.vector)},e.equals=function(n){return this.vector.equals(n.vector)},e.approxEqual=function(n,r){return r===void 0&&(r=DH),this.vector.angle(n.vector)<=r},e.stableAngle=function(n){return 2*Math.atan2(this.vector.sub(n.vector).norm(),this.vector.add(n.vector).norm())},i.chordAngleBetweenPoints=function(n,r){return Math.min(4,n.vector.sub(r.vector).norm2())},i.regularPoints=function(n,r,s){return this.regularPointsForFrame(fD(n),r,s)},i.regularPointsForFrame=function(n,r,s){for(var o=Math.cos(r),a=Math.sin(r),l=2*Math.PI/s,c=[],u=0;u<s;u++){var f=u*l,d=new i(a*Math.cos(f),a*Math.sin(f),o);c.push(i.fromVector(Bhe(n,d).vector.normalize()))}return c},e.containsCell=function(n){return!1},e.intersectsCell=function(n){return n.containsPoint(this)},e.containsPoint=function(n){return this.contains(n)},e.cellUnionBound=function(){return[k1(this)]},e.contains=function(n){return this.equals(n)},e.referenceDir=function(){return i.ortho(this)},e.toString=function(){return this.vector.toString()},i.ortho=function(n){var r=n.vector.largestComponent(),s=new Wt(.012,.0053,.00457);return r===Wt.X_AXIS?s.z=1:r===Wt.Y_AXIS?s.x=1:s.y=1,i.fromVector(n.vector.cross(s).normalize())},i.sortPoints=function(n){n.sort(function(r,s){return r.vector.cmp(s.vector)})},mhe(i,[{key:"x",get:function(){return this.vector.x}},{key:"y",get:function(){return this.vector.y}},{key:"z",get:function(){return this.vector.z}}])})(),MT=function(e,t,n){return e<t?t:e>n?n:e},Vhe=function(e){for(var t=e,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];for(var o=0,a=r;o<a.length;o++){var l=a[o];l>t&&(t=l)}return t},Ghe=function(e){for(var t=e,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];for(var o=0,a=r;o<a.length;o++){var l=a[o];l<t&&(t=l)}return t},qhe=function(e){return e<0n?-e:e},QL=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Vhe.apply(void 0,[e].concat(n))},OL=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Ghe.apply(void 0,[e].concat(n))},JL=function(e,t){for(var n=0,r=e;n<r;){var s=Math.floor((n+r)/2);t(s)?r=s:n=s+1}return n},fl=(1n<<64n)-1n,uu=function(e){return Number(e>>BigInt(fy))},Hhe=function(e){return e&fl>>BigInt(Mhe)},to=function(e){return _i-(xhe(e)>>>1)},Sr=function(e,t){var n=Ym(t);return e&-n|n},dD=function(e){var t=ls(e)<<2n;return e&-t|t},dy=function(e){return(e&Ym(0)-1n)===0n},ly=function(e){return typeof e!="bigint"||BigInt.asUintN(64,e)!=e?!1:uu(e)<=PH&&(ls(e)&0x1555555555555555n)!=0n},pD=function(e){return(e&1n)!=0n},NH=function(e,t){return Number(e>>2n*BigInt(_i-t)+1n)&3},ls=function(e){return e&-e},Ym=function(e){return 1n<<BigInt(2*(_i-e))},U1=function(e){var t=[e,e,e,e],n=ls(e);return t[0]=e-n+(n>>2n),n>>=1n,t[1]=t[0]+n,t[2]=t[1]+n,t[3]=t[2]+n,t},FH=function(e,t){var n=[],r=yp(e),s=r.f,o=r.i,a=r.j,l=Ra(to(e));o&=-l,a&=-l;for(var c=Ra(t),u=-c;;u+=c){var f=void 0;if(u<0?f=a+u>=0:u>=l?f=a+u<hl:(f=!0,n.push(Sr(pp(s,o+u,a-c,a-l>=0),t)),n.push(Sr(pp(s,o+u,a+l,a+l<hl),t))),n.push(Sr(pp(s,o-c,a+u,f&&o-l>=0),t)),n.push(Sr(pp(s,o+l,a+u,f&&o+l<hl),t)),u>=l)break}return n},qi=function(e){return e-(ls(e)-1n)},Gi=function(e){return e+(ls(e)-1n)},Xm=function(e,t){return qi(e)<=t&&t<=Gi(e)},BH=function(e,t){return qi(t)<=Gi(e)&&Gi(t)>=qi(e)},Whe=function(e){var t=e.toString(16).padStart(16,"0").replace(/0+$/,"");return t.length===0?"X":t},jhe=function(e){if(e.length>16||!/^[A-F0-9]+$/i.test(e))return 0n;var t=BigInt("0x"+e);return e.length<16&&(t=t<<BigInt(4*(16-e.length))),t},Xhe=function(e){if(!ly(e))return"Invalid: "+e.toString(16);for(var t=uu(e)+"/",n=1;n<=to(e);n++)t+=NH(e,n);return t},$he=function(e){var t=e.length-2;if(t<0||t>_i)return 0n;var n=parseInt(e[0],10);if(isNaN(n)||n<0||n>5||e[1]!=="/")return 0n;for(var r=vp(n),s=2;s<e.length;s++){var o=parseInt(e[s],10);if(isNaN(o)||o<0||o>3)return 0n;r=U1(r)[o]}return r},Yhe=function(e,t,n){return Sr((BigInt(e)<<BigInt(fy))+(t||1n),n)},vp=function(e){return(BigInt(e)<<BigInt(fy))+Ym(0)},k1=function(e){var t=ST(e.vector),n=t[0],r=t[1],s=t[2],o=zl(sh(r)),a=zl(sh(s));return py(n,o,a)},OH=function(e){return k1(We.fromLatLng(e))},zl=function(e){return MT(Math.floor(hl*e),0,hl-1)},Ra=function(e){return 1<<MT(_i-e,0,_i)},UH=function(e){return C1(Ra(e))},C1=function(e){return e/hl},kH=function(e){var t=mD(e),n=t.si,r=t.ti;return new Ci(Tc(dp(n)),Tc(dp(r)))},Zhe=function(e){var t=yp(e),n=t.i,r=t.j;return DT(n,r,to(e))},py=function(e,t,n){for(var r=BigInt(e)<<BigInt(fy-1),s=e&Mc,o=7;o>=0;o--){var a=(1<<ul)-1;s+=(t>>o*ul&a)<<ul+2,s+=(n>>o*ul&a)<<2,s=RH[s],r|=BigInt(s>>2)<<BigInt(o*2*ul),s&=Mc|$f}return r*2n+1n},R1=function(e,t,n){t=MT(t,-1,hl),n=MT(n,-1,hl);var r=1/hl,s=wH(1,2),o=Math.max(-s,Math.min(s,r*(Number(BigInt(t)<<1n)+1-hl))),a=Math.max(-s,Math.min(s,r*(Number(BigInt(n)<<1n)+1-hl))),l=ST(oh(e,o,a));return e=l[0],o=l[1],a=l[2],py(e,zl(.5*(o+1)),zl(.5*(a+1)))},pp=function(e,t,n,r){return r?py(e,t,n):R1(e,t,n)},yp=function(e){for(var t=uu(e),n=t&Mc,r=_i-7*ul,s=0,o=0,a=7;a>=0;a--)n+=Number((e>>BigInt(a*2*ul+1)&(1n<<BigInt(2*r))-1n)<<2n),n=CH[n],s+=n>>ul+2<<a*ul,o+=(n>>2&(1<<ul)-1)<<a*ul,n&=Mc|$f,r=ul;return(ls(e)&BigInt("0x1111111111111110"))!=0n&&(n^=Mc),{f:t,i:s,j:o,orientation:n}},mD=function(e){var t=yp(e),n=t.f,r=t.i,s=t.j,o=0;return pD(e)?o=1:((BigInt(r)^e>>2n)&1n)!=0n&&(o=2),{face:n,si:2*r+o,ti:2*s+o}},DT=function(e,t,n){var r=Ra(n),s=e&-r,o=t&-r;return new Hr(new Li(Tc(C1(s)),Tc(C1(s+r))),new Li(Tc(C1(o)),Tc(C1(o+r))))},Khe=function(e){return e>>2n*BigInt(_i-to(e))+1n},my=function(e){var t=mD(e),n=t.face,r=t.si,s=t.ti;return xT(n,r,s)},AD=function(e){return We.fromVector(my(e).normalize())},Qhe=function(e){return ar.fromPoint(We.fromVector(my(e)))},Jhe=function(e){var t=to(e),n=Ra(t),r=yp(e),s=r.f,o=r.i,a=r.j;return[Sr(R1(s,o,a-n),t),Sr(R1(s,o+n,a),t),Sr(R1(s,o,a+n),t),Sr(R1(s,o-n,a),t)]},zH=function(e,t){var n=Ra(t+1),r=n<<1,s=yp(e),o=s.f,a=s.i,l=s.j,c=!1,u=!1,f=0,d=0;(a&n)!=0?(f=r,c=a+r<hl):(f=-r,c=a-r>=0),(l&n)!=0?(d=r,u=l+r<hl):(d=-r,u=l-r>=0);var A=[Sr(e,t),Sr(pp(o,a+f,l,c),t),Sr(pp(o,a,l+d,u),t)];return(c||u)&&A.push(Sr(pp(o,a+f,l+d,c&&u),t)),A},gD=function(e){var t=ls(e);return e-t+(t>>2n)},Ay=function(e,t){return e-ls(e)+Ym(t)},VH=function(e){var t=ls(e);return e+t+(t>>2n)},NT=function(e,t){return e+ls(e)+Ym(t)},Ia=function(e){return e+(ls(e)<<1n)&fl},GH=function(e){return e-(ls(e)<<1n)&fl},efe=function(e){var t=Ia(e);return t<mp?t:t-mp&fl},tfe=function(e){var t=GH(e);return t<mp?t:t+mp&fl},nfe=function(e,t){if(t===0n)return e;var n=BigInt(2*(_i-to(e))+1);if(t<0n){var r=-(e>>n);if(t<r){var s=mp>>n;t%=s,t<r&&(t+=s)}}else{var o=mp-e>>n;if(t>o){var a=mp>>n;t%=a,t>o&&(t-=a)}}return e+(t<<qhe(n))},cy=function(e,t){var n=e^t;n<ls(e)&&(n=ls(e)),n<ls(t)&&(n=ls(t));var r=SH(n);return r>60?[0,!1]:[60-r>>1,!0]},eD=function(e,t){var n=qi(e);if(n>=qi(t))return t;if(Gi(e)>=t){for(;e=U1(e)[0],!(Gi(e)<t););return e}for(;!dy(e);){var r=dD(e);if(qi(r)!==n||Gi(r)>=t)break;e=r}return e},ife=function(e,t){if(t===0n)return e;var n=BigInt(2*(_i-to(e))+1);if(t<0n){var r=-(e>>n);t<r&&(t=r)}else{var s=mp+ls(e)-e>>n;t>s&&(t=s)}return e+(t<<n)},tD=function(e,t){return e<t?-1:e>t?1:0},rfe=function(e,t){return e>t?-1:e<t?1:0},sfe={__proto__:null,SentinelCellID:fl,face:uu,pos:Hhe,level:to,parent:Sr,immediateParent:dD,isFace:dy,valid:ly,isLeaf:pD,childPosition:NH,lsb:ls,lsbForLevel:Ym,children:U1,allNeighbors:FH,rangeMin:qi,rangeMax:Gi,contains:Xm,intersects:BH,toToken:Whe,fromToken:jhe,toString:Xhe,fromString:$he,fromFacePosLevel:Yhe,fromFace:vp,fromPoint:k1,fromLatLng:OH,stToIJ:zl,sizeIJ:Ra,sizeST:UH,ijToSTMin:C1,centerUV:kH,boundUV:Zhe,fromFaceIJ:py,fromFaceIJWrap:R1,fromFaceIJSame:pp,faceIJOrientation:yp,faceSiTi:mD,ijLevelToBoundUV:DT,distanceFromBegin:Khe,rawPoint:my,point:AD,latLng:Qhe,edgeNeighbors:Jhe,vertexNeighbors:zH,childBegin:gD,childBeginAtLevel:Ay,childEnd:VH,childEndAtLevel:NT,next:Ia,prev:GH,nextWrap:efe,prevWrap:tfe,advanceWrap:nfe,commonAncestorLevel:cy,maxTile:eD,advance:ife,ascending:tD,descending:rfe},Gl=(function(){function i(t,n){var r=t.pointCross(n);this.a=t,this.b=n,this.aXb=We.fromVector(t.vector.cross(n.vector)),this.aTangent=We.fromVector(t.vector.cross(r.vector)),this.bTangent=We.fromVector(r.vector.cross(n.vector)),this.c=new We(0,0,0),this.acb=Ec}i.newChainEdgeCrosser=function(n,r,s){var o=new i(n,r);return o.restartAt(s),o};var e=i.prototype;return e.crossingSign=function(n,r){return n.equals(this.c)||this.restartAt(n),this.chainCrossingSign(r)},e.edgeOrVertexCrossing=function(n,r){return n.equals(this.c)||this.restartAt(n),this.edgeOrVertexChainCrossing(r)},e.restartAt=function(n){this.c=n,this.acb=-ZL(this.a,this.b,this.c)},e.chainCrossingSign=function(n){var r=ZL(this.a,this.b,n);return this.acb===-r&&r!==Xf?(this.c=n,this.acb=-r,Vl):this._crossingSign(n,r)},e.edgeOrVertexChainCrossing=function(n){var r=We.fromVector(this.c.vector);switch(this.chainCrossingSign(n)){case Vl:return!1;case Ec:return!0}return HH(this.a,this.b,r,n)},e._crossingSign=function(n,r){var s=(1.5+1/Math.sqrt(3))*Ki;if(this.c.vector.dot(this.aTangent.vector)>s&&n.vector.dot(this.aTangent.vector)>s||this.c.vector.dot(this.bTangent.vector)>s&&n.vector.dot(this.bTangent.vector)>s)return this.c=n,this.acb=-r,Vl;if(this.a.equals(this.c)||this.a.equals(n)||this.b.equals(this.c)||this.b.equals(n))return this.c=n,this.acb=-r,CT;if(this.a.equals(this.b)||this.c.equals(n))return this.c=n,this.acb=-r,Vl;if(this.acb===Xf&&(this.acb=-KL(this.a,this.b,this.c)),r===Xf&&(r=KL(this.a,this.b,n)),r!==this.acb)return this.c=n,this.acb=-r,Vl;var o=-jm(this.c,n,this.b);if(o!==this.acb)return this.c=n,this.acb=-r,Vl;var a=jm(this.c,n,this.a);return a!==this.acb?(this.c=n,this.acb=-r,Vl):(this.c=n,this.acb=-r,Ec)},i})(),Ec=0,CT=1,Vl=2,qH=function(e,t,n,r){var s=Gl.newChainEdgeCrosser(e,t,n);return s.chainCrossingSign(r)},HH=function(e,t,n,r){if(e.equals(t)||n.equals(r))return!1;switch(!0){case e.equals(n):return t.equals(r)||We.orderedCCW(e.referenceDir(),r,t,e);case t.equals(r):return We.orderedCCW(t.referenceDir(),n,e,t);case e.equals(r):return t.equals(n)||We.orderedCCW(e.referenceDir(),n,t,e);case t.equals(n):return We.orderedCCW(t.referenceDir(),r,e,t)}return!1},ofe=function(e,t,n){return!We.orderedCCW(t.referenceDir(),n,e,t)},Ri=(function(){function i(t,n){this.lat=t,this.lng=n}i.emptyRect=function(){return new i(Li.empty(),eo.emptyInterval())},i.fullRect=function(){return new i(i.validRectLatRange,i.validRectLngRange)},i.fromLatLng=function(n){return new i(new Li(bc(n.lat),bc(n.lat)),new eo(bc(n.lng),bc(n.lng)))},i.fromCenterSize=function(n,r){var s=new ar(r.lat/2,r.lng/2);return i.fromLatLng(n).expanded(s)};var e=i.prototype;return e.equals=function(n){return this.lat.equals(n.lat)&&this.lng.equals(n.lng)},e.isValid=function(){return Math.abs(this.lat.lo)<=Math.PI/2&&Math.abs(this.lat.hi)<=Math.PI/2&&this.lng.isValid()&&this.lat.isEmpty()===this.lng.isEmpty()},e.isEmpty=function(){return this.lat.isEmpty()},e.isFull=function(){return this.lat.equals(i.validRectLatRange)&&this.lng.isFull()},e.isPoint=function(){return this.lat.lo===this.lat.hi&&this.lng.lo===this.lng.hi},e.vertex=function(n){var r,s;switch(n){case 0:r=this.lat.lo,s=this.lng.lo;break;case 1:r=this.lat.lo,s=this.lng.hi;break;case 2:r=this.lat.hi,s=this.lng.hi;break;default:r=this.lat.hi,s=this.lng.lo;break}return new ar(r,s)},e.lo=function(){return new ar(this.lat.lo,this.lng.lo)},e.hi=function(){return new ar(this.lat.hi,this.lng.hi)},e.center=function(){return new ar(this.lat.center(),this.lng.center())},e.size=function(){return new ar(this.lat.length(),this.lng.length())},e.area=function(){if(this.isEmpty())return 0;var n=Math.abs(Math.sin(this.lat.hi)-Math.sin(this.lat.lo));return this.lng.length()*n},e.addPoint=function(n){return n.isValid()?new i(this.lat.addPoint(bc(n.lat)),this.lng.addPoint(bc(n.lng))):this},e.expanded=function(n){var r=this.lat.expanded(bc(n.lat)),s=this.lng.expanded(bc(n.lng));return r.isEmpty()||s.isEmpty()?i.emptyRect():new i(r.intersection(i.validRectLatRange),s)},e.toString=function(){return"[Lo"+this.lo()+", Hi"+this.hi()+"]"},e.polarClosure=function(){return this.lat.lo===-Math.PI/2||this.lat.hi===Math.PI/2?new i(this.lat,eo.fullInterval()):this},e.union=function(n){return new i(this.lat.union(n.lat),this.lng.union(n.lng))},e.intersection=function(n){var r=this.lat.intersection(n.lat),s=this.lng.intersection(n.lng);return r.isEmpty()||s.isEmpty()?i.emptyRect():new i(r,s)},e.intersects=function(n){return this.lat.intersects(n.lat)&&this.lng.intersects(n.lng)},e.capBound=function(){if(this.isEmpty())return gp.emptyCap();var n,r;this.lat.hi+this.lat.lo<0?(n=-1,r=Math.PI/2+this.lat.hi):(n=1,r=Math.PI/2-this.lat.lo);var s=gp.fromCenterAngle(new We(0,0,n),r);if(hp(this.lng.hi-this.lng.lo,2*Math.PI)>=0&&this.lng.hi-this.lng.lo<2*Math.PI){var o=gp.fromPoint(We.fromLatLng(this.center())).addPoint(We.fromLatLng(this.lo())).addPoint(We.fromLatLng(this.hi()));if(o.height()<s.height())return o}return s},e.rectBound=function(){return this},e.contains=function(n){return this.lat.containsInterval(n.lat)&&this.lng.containsInterval(n.lng)},e.containsCell=function(n){return this.contains(n.rectBound())},e.containsLatLng=function(n){return n.isValid()?this.lat.contains(bc(n.lat))&&this.lng.contains(bc(n.lng)):!1},e.containsPoint=function(n){return this.containsLatLng(ar.fromPoint(n))},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.approxEqual=function(n){return this.lat.approxEqual(n.lat)&&this.lng.approxEqual(n.lng)},i.bisectorIntersection=function(n,r){r=Math.abs(r);var s=n.center(),o=new ar(s-Math.PI/2,r);s<0&&(o=new ar(-s-Math.PI/2,r-Math.PI));var a=new We(0,-1,0);return a.pointCross(We.fromLatLng(o))},e.centroid=function(){if(this.isEmpty())return new We(0,0,0);var n=Math.sin(this.lat.lo),r=Math.sin(this.lat.hi),s=Math.cos(this.lat.lo),o=Math.cos(this.lat.hi),a=.5*this.lng.length(),l=Math.sin(a)*(o*r-s*n+this.lat.length()),c=this.lng.center(),u=a*(r+n)*(r-n);return new We(l*Math.cos(c),l*Math.sin(c),u)},e.intersectsCell=function(n){if(this.isEmpty())return!1;if(this.containsPoint(We.fromVector(my(n.id)))||n.containsPoint(We.fromLatLng(this.center())))return!0;if(!this.intersects(n.rectBound()))return!1;for(var r=[],s=[],o=0;o<4;o++){var a=n.vertex(o);r.push(a);var l=ar.fromPoint(a);if(s.push(l),this.containsLatLng(l)||n.containsPoint(We.fromLatLng(this.vertex(o))))return!0}for(var c=0;c<4;c++){var u=eo.fromEndpoints(s[c].lng,s[c+1&3].lng);if(this.lng.intersects(u)){var f=r[c],d=r[c+1&3];if(u.contains(this.lng.lo)&&nH(f,d,this.lat,this.lng.lo)||u.contains(this.lng.hi)&&nH(f,d,this.lat,this.lng.hi)||tH(f,d,this.lat.lo,this.lng)||tH(f,d,this.lat.hi,this.lng))return!0}}return!1},i})();Ri.validRectLatRange=new Li(-Math.PI/2,Math.PI/2);Ri.validRectLngRange=eo.fullInterval();var tH=function(e,t,n,r){var s=e.vector.cross(t.vector).normalize();s.z<0&&(s=s.mul(-1));var o=s.cross(We.fromCoords(0,0,1).vector).normalize(),a=o.cross(s),l=Math.sin(bc(n));if(Math.abs(l)>=a.z)return!1;var c=l/a.z,u=Math.sqrt(1-c*c),f=Math.atan2(u,c),d=eo.fromPointPair(Math.atan2(e.vector.dot(o),e.vector.dot(a)),Math.atan2(t.vector.dot(o),t.vector.dot(a)));if(d.contains(f)){var A=a.mul(c).add(o.mul(u));if(r.contains(Math.atan2(A.y,A.x)))return!0}if(d.contains(-f)){var y=a.mul(c).sub(o.mul(u));if(r.contains(Math.atan2(y.y,y.x)))return!0}return!1},nH=function(e,t,n,r){return qH(e,t,We.fromLatLng(new ar(n.lo,r)),We.fromLatLng(new ar(n.hi,r)))===Ec},vD=(function(){function i(t,n){this.dim=t,this.deriv=n}var e=i.prototype;return e.value=function(n){return jL(this.deriv,-this.dim*n)},e.minLevel=function(n){if(n<=0)return _i;var r=-(Xq(n/this.deriv)>>this.dim-1);return r>_i&&(r=_i),r<0&&(r=0),r||0},e.maxLevel=function(n){if(n<=0)return _i;var r=Xq(this.deriv/n)>>this.dim-1;return r>_i&&(r=_i),r<0&&(r=0),r||0},e.closestLevel=function(n){var r=Math.SQRT2;return this.dim===2&&(r=2),this.minLevel(r*n)},i})(),nD=new vD(1,2*Math.SQRT2/3),afe=new vD(1,1.4592137463861061),iD=new vD(2,4*Math.PI/6),lfe=function(e,t,n){return wT(_D(e,t,n,0,!0).dist)},hu=function(e,t,n,r){return _D(e,t,n,r,!1)},iH=function(e,t,n,r){var s=QL(We.chordAngleBetweenPoints(e,t),We.chordAngleBetweenPoints(e,n));if(s>L1){var o=_D(We.fromVector(e.vector.mul(-1)),t,n,s,!0);s=o.dist,s=Sc-s}return r<s?{dist:s,less:!0}:{dist:r,less:!1}},WH=function(e,t,n){var r=t.pointCross(n),s=e.vector.sub(r.vector.mul(e.vector.dot(r.vector)/r.vector.norm2()));return YL(r,t,We.fromVector(s))&&YL(We.fromVector(s),n,r)?We.fromVector(s.normalize()):e.vector.sub(t.vector).norm2()<=e.vector.sub(n.vector).norm2()?t:n},jH=function(e,t,n){var r=e,s=t.pointCross(n),o=s.vector.cross(t.vector);return We.fromVector(t.vector.mul(Math.cos(r)).add(o.mul(Math.sin(r)/o.norm())).normalize())},cfe=function(e){return Math.max(ufe(e),uD(e))},ufe=function(e){if(e>=L1)return 0;var t=Math.min(1,.5*e),n=Math.sqrt(t*(2-t));return((2.5+2*Math.sqrt(3)+8.5*n)*n+(2+2*Math.sqrt(3)/3+6.5*(1-t))*t+(23+16/Math.sqrt(3))*Ki)*Ki},_D=function(e,t,n,r,s){var o=hfe(e,t,n,r,s),a=o.dist,l=o.less;if(l)return{dist:a,less:!0};var c=e.vector.sub(t.vector).norm2(),u=e.vector.sub(n.vector).norm2(),f=Math.min(c,u);return!s&&f>=r?{dist:r,less:!1}:{dist:f,less:!0}},hfe=function(e,t,n,r,s){var o=e.vector.sub(t.vector).norm2(),a=e.vector.sub(n.vector).norm2(),l=t.vector.sub(n.vector).norm2(),c=4.75*Ki*(o+a+l)+8*Ki*Ki;if(Math.abs(o-a)>=l+c)return{dist:r,less:!1};var u=t.pointCross(n),f=u.vector.norm2(),d=e.vector.dot(u.vector),A=d*d;if(!s&&A>f*r)return{dist:r,less:!1};var y=u.vector.cross(e.vector);if(t.vector.sub(e.vector).dot(y)>=0||n.vector.sub(e.vector).dot(y)<=0)return{dist:r,less:!1};var w=1-Math.sqrt(y.norm2()/f),S=A/f+w*w;return!s&&S>=r?{dist:r,less:!1}:{dist:S,less:!0}},rH=We.fromCoords(1,0,0),gp=(function(){function i(t,n){this.center=t,this.rad=n}i.fromPoint=function(n){return i.fromCenterChordAngle(n,0)},i.fromCenterAngle=function(n,r){return i.fromCenterChordAngle(n,_T(r))},i.fromCenterChordAngle=function(n,r){return new i(n,r)},i.fromCenterHeight=function(n,r){return i.fromCenterChordAngle(n,XL(2*r))},i.fromCenterArea=function(n,r){return i.fromCenterChordAngle(n,XL(r/Math.PI))},i.fromCap=function(n){return new i(We.fromVector(n.center.vector),n.rad)},i.emptyCap=function(){return i.fromCenterChordAngle(rH,bT)},i.fullCap=function(){return i.fromCenterChordAngle(rH,Sc)};var e=i.prototype;return e.isValid=function(){return this.center.vector.isUnit()&&this.rad<=Sc},e.isEmpty=function(){return this.rad<0},e.isFull=function(){return this.rad==Sc},e.centerPoint=function(){return this.center},e.height=function(){return .5*this.rad},e.radius=function(){return wT(this.rad)},e.area=function(){return 2*Math.PI*Math.max(0,this.height())},e.contains=function(n){return this.isFull()||n.isEmpty()?!0:this.rad>=ey(We.chordAngleBetweenPoints(this.center,n.center),n.rad)},e.intersects=function(n){return this.isEmpty()||n.isEmpty()?!1:ey(this.rad,n.rad)>=We.chordAngleBetweenPoints(this.center,n.center)},e.interiorIntersects=function(n){return this.rad<=0||n.isEmpty()?!1:ey(this.rad,n.rad)>We.chordAngleBetweenPoints(this.center,n.center)},e.intersectsCell=function(n){for(var r=[],s=0;s<4;s++)if(r[s]=n.vertex(s),this.containsPoint(r[s]))return!0;return this._intersects(n,r)},e._intersects=function(n,r){if(this.rad>=L1||this.isEmpty())return!1;if(n.containsPoint(this.center))return!0;for(var s=MH(this.rad),o=0;o<4;o++){var a=n.edge(o).vector,l=this.center.vector.dot(a);if(!(l>0)){if(l*l>s*a.norm2())return!1;var c=a.cross(this.center.vector);if(c.dot(r[o].vector)<0&&c.dot(r[o+1&3].vector)>0)return!0}}return!1},e.containsPoint=function(n){return We.chordAngleBetweenPoints(this.center,n)<=this.rad},e.containsCell=function(n){for(var r=[],s=0;s<4;s++)if(r[s]=n.vertex(s),!this.containsPoint(r[s]))return!1;return!this.complement()._intersects(n,r)},e.interiorContainsPoint=function(n){return this.isFull()||We.chordAngleBetweenPoints(this.center,n)<this.rad},e.complement=function(){return this.isFull()?i.emptyCap():this.isEmpty()?i.fullCap():i.fromCenterChordAngle(We.fromVector(this.center.vector.mul(-1)),She(Sc,this.rad))},e.capBound=function(){return this},e.rectBound=function(){if(this.isEmpty())return Ri.emptyRect();var n=this.radius(),r=!1,s=new Li(ar.latitude(this.center)-n,ar.latitude(this.center)+n),o=eo.fullInterval();if(s.lo<=-Math.PI/2&&(s.lo=-Math.PI/2,r=!0),s.hi>=Math.PI/2&&(s.hi=Math.PI/2,r=!0),!r){var a=The(this.rad),l=Math.cos(ar.latitude(this.center));if(a<=l){var c=Math.asin(a/l);o.lo=hp(ar.longitude(this.center)-c,Math.PI*2),o.hi=hp(ar.longitude(this.center)+c,Math.PI*2)}}return new Ri(s,o)},e.equals=function(n){return this.rad===n.rad&&this.center.equals(n.center)||this.isEmpty()&&n.isEmpty()||this.isFull()&&n.isFull()},e.approxEqual=function(n){var r=1e-14,s=this.rad,o=n.rad;return this.center.approxEqual(n.center)&&Math.abs(s-o)<=r||this.isEmpty()&&o<=r||n.isEmpty()&&s<=r||this.isFull()&&o>=2-r||n.isFull()&&s>=2-r},e.addPoint=function(n){if(this.isEmpty())return new i(n,0);var r=We.chordAngleBetweenPoints(this.center,n);return r>this.rad&&(this.rad=r),this},e.addCap=function(n){if(this.isEmpty())return n;if(n.isEmpty())return this;var r=ey(We.chordAngleBetweenPoints(this.center,n.center),n.rad),s=LT(r,Ki*r);return s>this.rad&&(this.rad=s),this},e.expanded=function(n){return this.isEmpty()?i.emptyCap():i.fromCenterChordAngle(this.center,ey(this.rad,_T(n)))},e.toString=function(){return"[Center="+this.center.vector+", Radius="+TH(this.radius())+"]"},i.radiusToHeight=function(n){return n<0?bT:n>=Math.PI?L1:.5*_T(n)},e.cellUnionBound=function(){var n=nD.maxLevel(this.radius())-1;if(n<0){for(var r=[],s=0;s<6;s++)r[s]=vp(s);return r}return zH(k1(this.center),n)},e.centroid=function(){if(this.isEmpty())return new We(0,0,0);var n=1-.5*this.height();return We.fromVector(this.center.vector.mul(n*this.area()))},e.union=function(n){var r=this;if(r.rad<n.rad){var s=[n,r];r=s[0],n=s[1]}if(r.isFull()||n.isEmpty())return r;var o=r.radius(),a=n.radius(),l=r.center.distance(n.center);if(o>=l+a)return r;var c=.5*(l+o+a),u=jH(.5*(l-o+a),r.center,n.center);return i.fromCenterAngle(u,c)},i})(),rD=function(e,t,n){var r=t.stableAngle(n),s=n.stableAngle(e),o=e.stableAngle(t),a=.5*(r+s+o);if(a>=3e-4){var l=a-Math.max(r,s,o);if(l<.01*a*a*a*a*a){var c=ffe(e,t,n);if(l<a*.1*(c+5e-15))return c}}return 4*Math.atan(Math.sqrt(Math.max(0,Math.tan(.5*a)*Math.tan(.5*(a-r))*Math.tan(.5*(a-s))*Math.tan(.5*(a-o)))))},ffe=function(e,t,n){var r=e.pointCross(t),s=t.pointCross(n),o=e.pointCross(n),a=r.vector.angle(o.vector)-r.vector.angle(s.vector)+s.vector.angle(o.vector);return a<0&&(a=0),a},dfe=function(e,t,n){return jm(e,t,n)*rD(e,t,n)},sH=function(e,t,n){var r=e.pointCross(t).vector.angle(t.pointCross(n).vector);return jm(e,t,n)===O1?r:-r},oH=Math.asin(Math.sqrt(1/3))-.5*Ki,Pa=(function(){function i(t,n,r,s,o){this.face=t,this.level=n,this.orientation=r,this.id=s,this.uv=o}i.fromCellID=function(n){var r=yp(n),s=r.f,o=r.i,a=r.j,l=r.orientation,c=to(n);return new i(s,c,l,n,DT(o,a,c))},i.fromPoint=function(n){return i.fromCellID(k1(n))},i.fromLatLng=function(n){return i.fromCellID(OH(n))},i.oppositeFace=function(n){return(n+3)%6};var e=i.prototype;return e.isLeaf=function(){return this.level===_i},e.sizeIJ=function(){return Ra(this.level)},e.sizeST=function(){return UH(this.level)},e.vertex=function(n){var r=this.uv.vertices()[n];return We.fromVector(oh(this.face,r.x,r.y).normalize())},e.edge=function(n){switch(n){case 0:return We.fromVector(Qq(this.face,this.uv.y.lo).normalize());case 1:return We.fromVector(Kq(this.face,this.uv.x.hi).normalize());case 2:return We.fromVector(Qq(this.face,this.uv.y.hi).mul(-1).normalize());default:return We.fromVector(Kq(this.face,this.uv.x.lo).mul(-1).normalize())}},e.boundUV=function(){return this.uv},e.center=function(){return We.fromVector(my(this.id).normalize())},e.children=function(){var n=[];if(pD(this.id))return n;for(var r=kH(this.id),s=gD(this.id),o=0;o<4;o++){var a=new i(this.face,this.level+1,this.orientation^M1[o],s,Hr.empty()),l=hD[this.orientation][o],c=l>>1,u=l&1;c===1?(a.uv.x.hi=this.uv.x.hi,a.uv.x.lo=r.x):(a.uv.x.lo=this.uv.x.lo,a.uv.x.hi=r.x),u===1?(a.uv.y.hi=this.uv.y.hi,a.uv.y.lo=r.y):(a.uv.y.lo=this.uv.y.lo,a.uv.y.hi=r.y),s=Ia(s),n.push(a)}return n},e.exactArea=function(){var n=this.vertex(0),r=this.vertex(1),s=this.vertex(2),o=this.vertex(3);return rD(n,r,s)+rD(n,s,o)},e.approxArea=function(){if(this.level<2)return this.averageArea();var n=.5*this.vertex(2).vector.sub(this.vertex(0).vector).cross(this.vertex(3).vector.sub(this.vertex(1).vector)).norm();return n*2/(1+Math.sqrt(1-Math.min(1/Math.PI*n,1)))},e.averageArea=function(){return iD.value(this.level)},e.intersectsCell=function(n){return BH(this.id,n.id)},e.containsCell=function(n){return Xm(this.id,n.id)},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.latitude=function(n,r){var s,o;switch(!0){case(n===0&&r===0):s=this.uv.x.lo,o=this.uv.y.lo;break;case(n===0&&r===1):s=this.uv.x.lo,o=this.uv.y.hi;break;case(n===1&&r===0):s=this.uv.x.hi,o=this.uv.y.lo;break;case(n===1&&r===1):s=this.uv.x.hi,o=this.uv.y.hi;break;default:throw new Error("i and/or j is out of bounds")}return ar.latitude(We.fromVector(oh(this.face,s,o)))},e.longitude=function(n,r){var s,o;switch(!0){case(n===0&&r===0):s=this.uv.x.lo,o=this.uv.y.lo;break;case(n===0&&r===1):s=this.uv.x.lo,o=this.uv.y.hi;break;case(n===1&&r===0):s=this.uv.x.hi,o=this.uv.y.lo;break;case(n===1&&r===1):s=this.uv.x.hi,o=this.uv.y.hi;break;default:throw new Error("i and/or j is out of bounds")}return ar.longitude(We.fromVector(oh(this.face,s,o)))},e.rectBound=function(){if(this.level>0){var n=this.uv.x.lo+this.uv.x.hi,r=this.uv.y.lo+this.uv.y.hi,s,o;Ihe(this.face).z===0?s=n<0?1:0:s=n>0?1:0,Lhe(this.face).z===0?o=r<0?1:0:o=r>0?1:0;var a=Li.fromPoint(this.latitude(s,o)).addPoint(this.latitude(1-s,1-o)),l=eo.emptyInterval().addPoint(this.longitude(s,1-o)).addPoint(this.longitude(1-s,o));return new Ri(a,l).expanded(new ar(2*Ki,2*Ki)).polarClosure()}var c;switch(this.face){case 0:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new eo(-Math.PI/4,Math.PI/4));break;case 1:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new eo(Math.PI/4,3*Math.PI/4));break;case 2:c=new Ri(new Li(oH,Math.PI/2),eo.fullInterval());break;case 3:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new eo(3*Math.PI/4,-3*Math.PI/4));break;case 4:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new eo(-3*Math.PI/4,-Math.PI/4));break;default:c=new Ri(new Li(-Math.PI/2,-oH),eo.fullInterval())}return c.expanded(new ar(Ki,0))},e.capBound=function(){for(var n=gp.fromPoint(We.fromVector(oh(this.face,this.uv.center().x,this.uv.center().y).normalize())),r=0;r<4;r++)n=n.addPoint(this.vertex(r));return n},e.containsPoint=function(n){var r=Che(this.face,n.vector),s=r[0],o=r[1],a=r[2];return a?this.uv.expandedByMargin(Ki).containsPoint(new Ci(s,o)):!1},e.vertexChordDist2=function(n,r,s){var o=this.uv.x.lo,a=this.uv.y.lo;return r&&(o=this.uv.x.hi),s&&(a=this.uv.y.hi),We.chordAngleBetweenPoints(n,We.fromCoords(o,a,1))},e.uEdgeIsClosest=function(n,r){var s=this.uv.x.lo,o=this.uv.x.hi,a=this.uv.y.lo;r&&(a=this.uv.y.hi);var l=new Wt(a*a+1,-s*a,-s),c=new Wt(a*a+1,-o*a,-o);return n.vector.dot(l)>0&&n.vector.dot(c)<0},e.vEdgeIsClosest=function(n,r){var s=this.uv.y.lo,o=this.uv.y.hi,a=this.uv.x.lo;r&&(a=this.uv.x.hi);var l=new Wt(-a*s,a*a+1,-s),c=new Wt(-a*o,a*a+1,-o);return n.vector.dot(l)>0&&n.vector.dot(c)<0},i.edgeDistance=function(n,r){var s=n*n/(1+r*r),o=1-Math.sqrt(1-s);return XL(s+o*o)},e.distanceInternal=function(n,r){var s=We.fromVector(Ap(this.face,n.vector)),o=s.x-s.z*this.uv.x.lo,a=s.x-s.z*this.uv.x.hi,l=s.y-s.z*this.uv.y.lo,c=s.y-s.z*this.uv.y.hi,u=!0;return o<0&&(u=!1,this.vEdgeIsClosest(s,!1))?i.edgeDistance(-o,this.uv.x.lo):a>0&&(u=!1,this.vEdgeIsClosest(s,!0))?i.edgeDistance(a,this.uv.x.hi):l<0&&(u=!1,this.uEdgeIsClosest(s,!1))?i.edgeDistance(-l,this.uv.y.lo):c>0&&(u=!1,this.uEdgeIsClosest(s,!0))?i.edgeDistance(c,this.uv.y.hi):u?r?0:OL(i.edgeDistance(-o,this.uv.x.lo),i.edgeDistance(a,this.uv.x.hi),i.edgeDistance(-l,this.uv.y.lo),i.edgeDistance(c,this.uv.y.hi)):OL(this.vertexChordDist2(s,!1,!1),this.vertexChordDist2(s,!0,!1),this.vertexChordDist2(s,!1,!0),this.vertexChordDist2(s,!0,!0))},e.distance=function(n){return this.distanceInternal(n,!0)},e.maxDistance=function(n){var r=We.fromVector(Ap(this.face,n.vector)),s=QL(this.vertexChordDist2(r,!1,!1),this.vertexChordDist2(r,!0,!1),this.vertexChordDist2(r,!1,!0),this.vertexChordDist2(r,!0,!0));return s<=L1?s:Sc-this.distance(We.fromVector(n.vector.mul(-1)))},e.boundaryDistance=function(n){return this.distanceInternal(n,!1)},e.distanceToEdge=function(n,r){var s=OL(this.distance(n),this.distance(r));if(s===0)return s;for(var o=Gl.newChainEdgeCrosser(n,r,this.vertex(3)),a=0;a<4;a++)if(o.chainCrossingSign(this.vertex(a))!==Vl)return 0;for(var l=0;l<4;l++)s=hu(this.vertex(l),n,r,s).dist;return s},e.maxDistanceToEdge=function(n,r){var s=QL(this.maxDistance(n),this.maxDistance(r));return s<=L1?s:Sc-this.distanceToEdge(We.fromVector(n.vector.mul(-1)),We.fromVector(r.vector.mul(-1)))},e.distanceToCell=function(n){if(this.face===n.face&&this.uv.intersects(n.uv))return 0;for(var r=[],s=[],o=0;o<4;o++)r.push(this.vertex(o)),s.push(n.vertex(o));for(var a=Cc(),l=0;l<4;l++)for(var c=0;c<4;c++)a=hu(r[l],s[c],s[c+1&3],a).dist,a=hu(s[l],r[c],r[c+1&3],a).dist;return a},e.maxDistanceToCell=function(n){var r=new Hr(n.uv.y,n.uv.x);if(this.face===i.oppositeFace(n.face)&&this.uv.intersects(r))return Sc;for(var s=[],o=[],a=0;a<4;a++)s.push(this.vertex(a)),o.push(n.vertex(a));for(var l=bT,c=0;c<4;c++)for(var u=0;u<4;u++)l=iH(s[c],o[u],o[u+1&3],l).dist,l=iH(o[c],s[u],s[u+1&3],l).dist;return l},i})(),E1=-1,XH=(function(){function i(t,n){n===void 0&&(n=!1),this.nonEmpty=n,this.rangeNodes=t.rangeNodes,this.pos=0}var e=i.prototype;return e.startID=function(){return this.rangeNodes[this.pos].startID},e.limitID=function(){return this.rangeNodes[this.pos+1].startID},e.isEmpty=function(){return this.rangeNodes[this.pos].contents===E1},e.begin=function(){for(this.pos=0;this.nonEmpty&&this.isEmpty()&&!this.done();)this.pos++},e.internalPrev=function(){return this.pos===0?!1:(this.pos--,!0)},e.nonEmptyPrev=function(){for(;this.internalPrev();)if(!this.isEmpty())return!0;return this.isEmpty()&&!this.done()&&this.next(),!1},e.prev=function(){return this.nonEmpty?this.nonEmptyPrev():this.internalPrev()},e.next=function(){for(this.pos++;this.nonEmpty&&this.isEmpty()&&!this.done();)this.pos++},e.advance=function(n){return n>=this.rangeNodes.length-1-this.pos?!1:(this.pos+=n,!0)},e.finish=function(){this.pos=this.rangeNodes.length-1},e.done=function(){return this.pos>=this.rangeNodes.length-1},e.seek=function(n){for(var r=0,s=this.rangeNodes.length;r<s;){var o=r+s>>>1;this.rangeNodes[o].startID>n?s=o:r=o+1}for(this.pos=Math.max(r-1,0);this.nonEmpty&&this.isEmpty()&&!this.done();)this.pos++},i})(),$H=(function(){function i(t){this.cellTree=t.cellTree,this.prevStartID=0n,this.nodeCutoff=-1,this.nextNodeCutoff=-1,this.node={cellID:0n,label:E1,parent:-1}}var e=i.prototype;return e.clear=function(){this.prevStartID=0n,this.nodeCutoff=-1,this.nextNodeCutoff=-1,this.node.label=E1},e.cellID=function(){return this.node.cellID},e.label=function(){return this.node.label},e.next=function(){this.node.parent<=this.nodeCutoff?(this.nodeCutoff=this.nextNodeCutoff,this.node.label=E1):this.node=yT({},this.cellTree[this.node.parent])},e.done=function(){return this.node.label===E1},e.startUnion=function(n){n.startID()<this.prevStartID&&(this.nodeCutoff=-1),this.prevStartID=n.startID();var r=n.rangeNodes[n.pos].contents;r<=this.nodeCutoff?this.node.label=E1:this.node=yT({},this.cellTree[r]),this.nextNodeCutoff=r},i})(),pfe=(function(){function i(){this.cellTree=[],this.rangeNodes=[]}var e=i.prototype;return e.add=function(n,r){if(r<0)throw new Error("labels must be non-negative");this.cellTree.push({cellID:n,label:r,parent:-1})},e.addCellUnion=function(n,r){if(r<0)throw new Error("labels must be non-negative");for(var s=Ct(n),o;!(o=s()).done;){var a=o.value;this.add(a,r)}},e.build=function(){for(var n=[],r=Ct(this.cellTree),s;!(s=r()).done;){var o=s.value;n.push({startID:qi(o.cellID),cellID:o.cellID,label:o.label}),n.push({startID:Ia(Gi(o.cellID)),cellID:fl,label:-1})}n.push({startID:Ay(vp(0),_i),cellID:0n,label:-1}),n.push({startID:NT(vp(5),_i),cellID:0n,label:-1}),n.sort(function(u,f){return u.startID!==f.startID?u.startID<f.startID?-1:1:u.cellID!==f.cellID?u.cellID>f.cellID?-1:1:u.label<f.label?-1:u.label>f.label?1:0}),this.cellTree=[],this.rangeNodes=[];for(var a=-1,l=0;l<n.length;){for(var c=n[l].startID;l<n.length&&n[l].startID===c;)n[l].label>=0?(this.cellTree.push({cellID:n[l].cellID,label:n[l].label,parent:a}),a=this.cellTree.length-1):n[l].cellID===fl&&(a=this.cellTree[a].parent),l++;this.rangeNodes.push({startID:c,contents:a})}},i})(),N1=(function(i){function e(){return i.apply(this,arguments)||this}hy(e,i),e.fromRange=function(r,s){for(var o=new e,a=eD(r,s);a!==s;a=eD(Ia(a),s))o.push(a);return o},e.fromUnion=function(){for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];var a=sy(e,s.flat(1));return a.normalize(),a},e.fromIntersection=function(r,s){for(var o=new e,a=0,l=0;a<r.length&&l<s.length;){var c=qi(r[a]),u=qi(s[l]);c>u?r[a]<=Gi(s[l])?(o.push(r[a]),a++):(l=s.lowerBound(l+1,s.length,c),r[a]<=Gi(s[l-1])&&l--):u>c?s[l]<=Gi(r[a])?(o.push(s[l]),l++):(a=r.lowerBound(a+1,r.length,u),s[l]<=Gi(r[a-1])&&a--):r[a]<s[l]?(o.push(r[a]),a++):(o.push(s[l]),l++)}return o.normalize(),o},e.fromIntersectionWithCellID=function(r,s){var o=new e;if(r.containsCellID(s))return o.push(s),o.normalize(),o;for(var a=Gi(s),l=r.lowerBound(0,r.length,qi(s));l<r.length&&r[l]<=a;l++)o.push(r[l]);return o.normalize(),o},e.fromDifference=function(r,s){for(var o=new e,a=Ct(r),l;!(l=a()).done;){var c=l.value;o.cellUnionDifferenceInternal(c,s)}return o};var t=e.prototype;return t.isValid=function(){for(var r=0;r<this.length;r++){var s=this[r];if(!ly(s)||r>0&&Gi(this[r-1])>=qi(s))return!1}return!0},t.isNormalized=function(){for(var r=0;r<this.length;r++){var s=this[r];if(!ly(s)||r>0&&Gi(this[r-1])>=qi(s)||r>=3&&e.areSiblings(this[r-3],this[r-2],this[r-1],s))return!1}return!0},t.normalize=function(){this.sort(tD);for(var r=[],s=Ct(this),o;!(o=s()).done;){var a=o.value;if(!(r.length>0&&Xm(r[r.length-1],a))){for(var l=r.length-1;l>=0&&Xm(a,r[l]);)l--;for(r.length=l+1;r.length>=3&&e.areSiblings(r[r.length-3],r[r.length-2],r[r.length-1],a);)r.length-=3,a=dD(a);r.push(a)}}this.length=0,this.push.apply(this,r)},t.intersectsCellID=function(r){var s=this.lowerBound(0,this.length,r);return s!==this.length&&qi(this[s])<=Gi(r)?!0:s!==0&&Gi(this[s-1])>=qi(r)},t.containsCellID=function(r){var s=this.lowerBound(0,this.length,r);return s!==this.length&&qi(this[s])<=r?!0:s!==0&&Gi(this[s-1])>=r},t.denormalize=function(r,s){for(var o=new e,a=Ct(this),l;!(l=a()).done;){var c=l.value,u=to(c),f=u;if(f<r&&(f=r),s>1&&(f+=(_i-(f-r))%s,f>_i&&(f=_i)),f===u)o.push(c);else for(var d=NT(c,f),A=Ay(c,f);A!==d;A=Ia(A))o.push(A)}this.length=0,this.push.apply(this,o)},t.rectBound=function(){for(var r=Ri.emptyRect(),s=Ct(this),o;!(o=s()).done;){var a=o.value;r=r.union(Pa.fromCellID(a).rectBound())}return r},t.capBound=function(){if(this.length===0)return gp.emptyCap();for(var r=new We(0,0,0),s=Ct(this),o;!(o=s()).done;){var a=o.value,l=iD.value(to(a));r=We.fromVector(r.vector.add(AD(a).vector.mul(l)))}r.equals(new We(0,0,0))?r=We.fromCoords(1,0,0):r=We.fromVector(r.vector.normalize());for(var c=gp.fromPoint(r),u=Ct(this),f;!(f=u()).done;){var d=f.value;c=c.addCap(Pa.fromCellID(d).capBound())}return c},t.containsCell=function(r){return this.containsCellID(r.id)},t.intersectsCell=function(r){return this.intersectsCellID(r.id)},t.containsPoint=function(r){return this.containsCell(Pa.fromPoint(r))},t.cellUnionBound=function(){return this.capBound().cellUnionBound()},t.leafCellsCovered=function(){for(var r=0n,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=1n<<BigInt(_i-to(a)<<1)}return r},e.areSiblings=function(r,s,o,a){if((r^s^o)!==a)return!1;var l=ls(a)<<1n;l=~(l+(l<<1n));var c=a&l;return(r&l)===c&&(s&l)===c&&(o&l)===c&&!dy(a)},t.contains=function(r){for(var s=Ct(r),o;!(o=s()).done;){var a=o.value;if(!this.containsCellID(a))return!1}return!0},t.intersects=function(r){for(var s=Ct(this),o;!(o=s()).done;){var a=o.value;if(r.intersectsCellID(a))return!0}return!1},t.lowerBound=function(r,s,o){for(var a=r;a<s;a++)if(this[a]>=o)return a;return s},t.cellUnionDifferenceInternal=function(r,s){if(!s.intersectsCellID(r)){this.push(r);return}if(!s.containsCellID(r))for(var o=Ct(U1(r)),a;!(a=o()).done;){var l=a.value;this.cellUnionDifferenceInternal(l,s)}},t.expandAtLevel=function(r){for(var s=new e,o=Ym(r),a=this.length-1;a>=0;a--){var l=this[a];if(ls(l)<o)for(l=Sr(l,r);a>0&&Xm(l,this[a-1]);)a--;s.push(l),s.push.apply(s,FH(l,r))}s.sort(tD),this.length=0,this.push.apply(this,s),this.normalize()},t.expandByRadius=function(r,s){for(var o=_i,a=Ct(this),l;!(l=a()).done;){var c=l.value;o=Math.min(o,to(c))}var u=nD.maxLevel(r);u===0&&r>nD.value(0)&&this.expandAtLevel(0),this.expandAtLevel(Math.min(o+s,u))},t.equals=function(r){if(this.length!==r.length)return!1;for(var s=0;s<this.length;s++)if(this[s]!==r[s])return!1;return!0},t.averageArea=function(){return iD.value(_i)*Number(this.leafCellsCovered())},t.approxArea=function(){for(var r=0,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=Pa.fromCellID(a).approxArea()}return r},t.exactArea=function(){for(var r=0,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=Pa.fromCellID(a).exactArea()}return r},e})(I1(Array)),ah=(function(){function i(t,n){this.v0=t,this.v1=n}var e=i.prototype;return e.cmp=function(n){var r=this.v0.vector.cmp(n.v0.vector);return r!==0?r:this.v1.vector.cmp(n.v1.vector)},e.equals=function(n){return this.v0.equals(n.v0)&&this.v1.equals(n.v1)},i})(),P1=function(e,t){this.start=e,this.length=t},FT=function(e,t){this.chainID=e,this.offset=t},mfe=function(e,t){this.point=e,this.contained=t},BT=function(e){return new mfe(We.originPoint(),e)},YH=0,Afe=1,gfe=2,vfe=function(e){return e.numEdges()===0&&(e.dimension()!==2||e.numChains()===0)},_fe=function(e){return e.numEdges()===0&&e.dimension()===2&&e.numChains()>0},ny=(function(){function i(){}var e=i.prototype;return e.numEdges=function(){return 0},e.edge=function(n){return new ah(We.originPoint(),We.originPoint())},e.referencePoint=function(){return BT(!1)},e.numChains=function(){return 0},e.chain=function(n){return new P1(0,0)},e.chainEdge=function(n,r){return new ah(We.originPoint(),We.originPoint())},e.chainPosition=function(n){return new FT(0,0)},e.dimension=function(){return-1},e.isEmpty=function(){return!0},e.isFull=function(){return!1},e.typeTag=function(){return YH},e.privateInterface=function(){},i})(),aH=(function(){function i(t,n){this.containsCenter=!1,this.shapeID=t,this.containsCenter=!1,this.edges=new Array(n)}var e=i.prototype;return e.numEdges=function(){return this.edges.length},e.containsEdge=function(n){for(var r=Ct(this.edges),s;!(s=r()).done;){var o=s.value;if(o===n)return!0}return!1},i})(),ZH=(function(){function i(){this.shapeID=0,this.containsCenter=!1,this.edges=[]}var e=i.prototype;return e.numEdges=function(){return 0},e.containsEdge=function(n){return!1},i})(),xfe=(function(){function i(t){this.shapes=new Array(t)}var e=i.prototype;return e.numEdges=function(){for(var n=0,r=Ct(this.shapes),s;!(s=r()).done;){var o=s.value;n+=o.numEdges()}return n},e.add=function(n){this.shapes.push(n)},e.findByShapeID=function(n){for(var r=Ct(this.shapes),s;!(s=r()).done;){var o=s.value;if(o.shapeID===n)return o}return new ZH},i})(),UL=(function(){function i(){this.shapes=[]}var e=i.prototype;return e.numEdges=function(){return 0},e.add=function(n){},e.findByShapeID=function(n){return new ZH},i})(),sD=0,KH=0,kL=(function(){function i(t,n){if(this.index=t,this.position=0,this.id=fl,this.cell=new UL,n!==void 0)switch(n){case sD:this.begin();break;case KH:this.end();break;default:throw new Error("unknown ShapeIndexIteratorPos value")}}var e=i.prototype;return e.clone=function(){var n=new i(this.index);return n.position=this.position,n.id=this.id,n.cell=this.cell,n},e.cellID=function(){return this.id},e.indexCell=function(){return this.cell},e.center=function(){return AD(this.cellID())},e.begin=function(){this.index.isFresh()||this.index.maybeApplyUpdates(),this.position=0,this.refresh()},e.next=function(){this.position++,this.refresh()},e.prev=function(){return this.position<=0?!1:(this.position--,this.refresh(),!0)},e.end=function(){this.position=this.index.cells.length,this.refresh()},e.done=function(){return this.id===fl},e.refresh=function(){this.position<this.index.cells.length?(this.id=this.index.cells[this.position],this.cell=this.index.cellMap.get(this.cellID())||new UL):(this.id=fl,this.cell=new UL)},e.seek=function(n){var r=this;this.position=JL(this.index.cells.length,function(s){return r.index.cells[s]>=n}),this.refresh()},e.locatePoint=function(n){var r=k1(n);return this.seek(r),!!(!this.done()&&qi(this.cellID())<=r||this.prev()&&Gi(this.cellID())>=r)},e.locateCellID=function(n){if(this.seek(qi(n)),!this.done()){if(this.cellID()>=n&&qi(this.cellID())<=n)return xp;if(this.cellID()<=Gi(n))return vy}return this.prev()&&Gi(this.cellID())>=n?xp:OT},i})(),yfe=(function(){function i(){this.isActive=!1,this.a=this.b=i.trackerOrigin(),this.nextCellID=Ay(vp(0),_i),this.crosser=null,this.shapeIDs=[],this.savedIDs=[],this.drawTo(We.fromVector(oh(0,-1,-1).normalize()))}i.trackerOrigin=function(){return We.fromVector(oh(0,-1,-1).normalize())};var e=i.prototype;return e.focus=function(){return this.b},e.addShape=function(n,r){this.isActive=!0,r&&this.toggleShape(n)},e.moveTo=function(n){this.b=n},e.drawTo=function(n){this.a=this.b,this.b=n,this.crosser=new Gl(this.a,this.b)},e.testEdge=function(n,r){var s;(s=this.crosser)!=null&&s.edgeOrVertexCrossing(r.v0,r.v1)&&this.toggleShape(n)},e.setNextCellID=function(n){this.nextCellID=qi(n)},e.atCellID=function(n){return qi(n)===this.nextCellID},e.toggleShape=function(n){if(this.shapeIDs.length===0){this.shapeIDs.push(n);return}if(this.shapeIDs[0]===n){this.shapeIDs.shift();return}for(var r=0;r<this.shapeIDs.length;r++){var s=this.shapeIDs[r];if(!(s<n)){if(s===n){this.shapeIDs.splice(r,1);return}this.shapeIDs.splice(r,0,n);return}}this.shapeIDs.push(n)},e.saveAndClearStateBefore=function(n){var r=this.lowerBound(n);this.savedIDs=this.shapeIDs.slice(0,r),this.shapeIDs=this.shapeIDs.slice(r)},e.restoreStateBefore=function(n){var r=this.lowerBound(n);this.shapeIDs=this.savedIDs.concat(this.shapeIDs.slice(r)),this.savedIDs=[]},e.lowerBound=function(n){for(var r=0;r<this.shapeIDs.length;r++)if(this.shapeIDs[r]>=n)return r;return this.shapeIDs.length},i})(),Yf=1,lH=2,_p=(function(){function i(t,n){this.index=t,this.model=n,this.iter=t.iterator()}var e=i.prototype;return e.contains=function(n){if(!this.iter.locatePoint(n))return!1;for(var r=this.iter.indexCell(),s=Ct(r.shapes),o;!(o=s()).done;){var a=o.value;if(this._shapeContains(a,this.iter.center(),n))return!0}return!1},e._shapeContains=function(n,r,s){var o=n.containsCenter,a=n.numEdges();if(a<=0)return o;var l=this.index.shape(n.shapeID);if(l.dimension()!==2){if(this.model!==lH)return!1;for(var c=Ct(n.edges),u;!(u=c()).done;){var f=u.value,d=l.edge(f);if(d.v0.equals(s)||d.v1.equals(s))return!0}return!1}for(var A=new Gl(r,s),y=Ct(n.edges),w;!(w=y()).done;){var S=w.value,T=l.edge(S),R=A.crossingSign(T.v0,T.v1);if(R!==Vl){if(R===CT){if(this.model!==Yf&&(T.v0.equals(s)||T.v1.equals(s)))return this.model===lH;HH(A.a,A.b,T.v0,T.v1)?R=Ec:R=Vl}o=o!==(R===Ec)}}return o},e.shapeContains=function(n,r){if(!n||n instanceof ny||!this.iter.locatePoint(r))return!1;var s=this.iter.indexCell(),o=s.findByShapeID(this.index.idForShape(n));return o?this._shapeContains(o,this.iter.center(),r):!1},e.shapeVisitorFunc=function(n){return!0},e.visitContainingShapes=function(n,r){if(!this.iter.locatePoint(n))return!0;for(var s=this.iter.indexCell(),o=Ct(s.shapes),a;!(a=o()).done;){var l=a.value;if(this._shapeContains(l,this.iter.center(),n)&&!r(this.index.shape(l.shapeID)))return!1}return!0},e.containingShapes=function(n){var r=[];return this.visitContainingShapes(n,function(s){return r.push(s),!0}),r},i})(),bfe=(function(){function i(t,n){n===void 0&&(n=new _p(t,Yf)),this.index=t,this.containsQuery=n,this.iter=t.iterator()}var e=i.prototype;return e.capBound=function(){var n=sy(N1,this.cellUnionBound());return n.capBound()},e.rectBound=function(){var n=sy(N1,this.cellUnionBound());return n.rectBound()},e.cellUnionBound=function(){var n=[];if(this.iter.end(),!this.iter.prev())return n;var r=this.iter.cellID();if(this.iter.begin(),this.iter.cellID()!==r){var s=cy(this.iter.cellID(),r),o=s[0];o===void 0&&(o=-1),o++;for(var a=Sr(r,o),l=Sr(this.iter.cellID(),o);l!=a;l=Ia(l))if(!(Gi(l)<this.iter.cellID())){var c=this.iter.cellID();this.iter.seek(Ia(Gi(l))),this.iter.prev(),n.push.apply(n,this.coverRange(c,this.iter.cellID(),[])),this.iter.next()}}return this.coverRange(this.iter.cellID(),r,n)},e.coverRange=function(n,r,s){if(n==r)return s.concat([n]);var o=cy(n,r),a=o[0],l=o[1];return l||s.concat([0n]),s.concat([Sr(n,a)])},i})(),wfe=2.25*Ki,Sfe=3*Ki,gy=9*(1/Math.SQRT2)*Ki,QH=3*Math.SQRT2*Ki,Tfe=function(e,t,n){return uy(e,t,n,0)},uy=function(e,t,n,r){if(ay(e.vector)===n&&ay(t.vector)===n){var s=$m(n,e.vector),o=s[0],a=s[1],l=$m(n,t.vector),c=l[0],u=l[1];return[new Ci(o,a),new Ci(c,u),!0]}var f=new wc(Ap(n,e.pointCross(t).vector)),d=new wc(Ap(n,e.vector)),A=new wc(Ap(n,t.vector)),y=1+r,w=new wc(new We(y*f.x,y*f.y,f.z));if(!w.intersectsFace())return[null,null,!1];Math.max(Math.abs(f.x),Math.max(Math.abs(f.y),Math.abs(f.z)))<jL(1,-511)&&(f=new wc(We.fromVector(f.vector.mul(jL(1,563)))));var S=new wc(We.fromVector(f.vector.normalize())),T=new wc(We.fromVector(S.vector.cross(d.vector))),R=new wc(We.fromVector(A.vector.cross(S.vector))),I=cH(A,d,new wc(We.fromVector(w.vector.mul(-1))),R,T,y),P=I[0],F=I[1],D=cH(d,A,w,T,R,y),L=D[0],C=D[1];return[P,L,F+C<3]},Efe=function(e,t,n){return e+t===n&&e===n-t&&t===n-e},zL=0,oD=1,wc=(function(i){function e(n){return i.call(this,n.x,n.y,n.z)||this}hy(e,i);var t=e.prototype;return t.intersectsFace=function(){var r=Math.abs(this.x),s=Math.abs(this.y),o=Math.abs(this.z);return s>=o-r&&r>=o-s},t.intersectsOppositeEdges=function(){var r=Math.abs(this.x),s=Math.abs(this.y),o=Math.abs(this.z);return Math.abs(r-s)!==o?Math.abs(r-s)>=o:r>=s?r-o>=s:s-o>=r},t.exitAxis=function(){if(this.intersectsOppositeEdges())return Math.abs(this.x)>=Math.abs(this.y)?oD:zL;var r=0,s=0,o=0;return Math.sign(this.x)<0&&(r=1),Math.sign(this.y)<0&&(s=1),Math.sign(this.z)<0&&(o=1),(r^s^o)===0?oD:zL},t.exitPoint=function(r){if(r===zL){var s=this.y>0?1:-1;return new Ci(s,(-s*this.x-this.z)/this.y)}var o=this.x<0?1:-1;return new Ci((-o*this.y-this.z)/this.x,o)},e})(We),cH=function(e,t,n,r,s,o){var a=1-gy;if(t.z>0){var l=new Ci(t.x/t.z,t.y/t.z);if(Math.max(Math.abs(l.x),Math.abs(l.y))<=a)return[l,0]}var c=n.exitPoint(n.exitAxis()).mul(o),u=new wc(new We(c.x,c.y,1)),f=0;return u.vector.sub(e.vector).dot(r.vector)<0?f=2:u.vector.sub(t.vector).dot(s.vector)<0&&(f=1),f>0&&(t.z<=0?f=3:c=new Ci(t.x/t.z,t.y/t.z)),[c,f]},uH=function(e,t,n){return t?e.lo>n?[e,!1]:(e.hi>n&&(e.hi=n),[e,!0]):e.hi<n?[e,!1]:(e.lo<n&&(e.lo=n),[e,!0])},hH=function(e,t,n,r,s,o,a,l){var c=!1;if(n.lo<l.lo){if(n.hi<l.lo)return[n,o,!1];n.lo=l.lo;var u=uH(o,a,F1(l.lo,e,t,r,s));if(o=u[0],c=u[1],!c)return[n,o,!1]}if(n.hi>l.hi){if(n.lo>l.hi)return[n,o,!1];n.hi=l.hi;var f=uH(o,!a,F1(l.hi,e,t,r,s));if(o=f[0],c=f[1],!c)return[n,o,!1]}return[n,o,!0]},JH=function(e,t,n){if(!n.intersects(Hr.fromPoints(e,t)))return!1;var r=t.sub(e).ortho(),s=r.x>=0?1:0,o=r.y>=0?1:0,a=r.dot(n.vertexIJ(s,o).sub(e)),l=r.dot(n.vertexIJ(1-s,1-o).sub(e));return a>=0&&l<=0},Mfe=function(e,t,n){var r=Hr.fromPoints(e,t),s=Cfe(e,t,n,r),o=s[0],a=s[1];return a?o:Hr.empty()},Cfe=function(e,t,n,r){var s=e.x>t.x!=e.y>t.y,o=hH(e.x,t.x,r.x,e.y,t.y,r.y,s,n.x),a=o[0],l=o[1],c=o[2];if(!c)return[r,!1];var u=hH(e.y,t.y,l,e.x,t.x,a,s,n.y),f=u[0],d=u[1],A=u[2];return A?[new Hr(d,f),!0]:[new Hr(a,l),!1]},F1=function(e,t,n,r,s){return Math.abs(t-e)<=Math.abs(n-e)?r+(s-r)*(e-t)/(n-t):s+(r-s)*(e-n)/(t-n)},Rfe=(function(){function i(t,n,r){this.face=t,this.a=n,this.b=r}var e=i.prototype;return e.clone=function(){return new i(this.face,new Ci(this.a.x,this.a.y),new Ci(this.b.x,this.b.y))},i})(),Pfe=function(e,t){var n=new Rfe(0,new Ci(0,0),new Ci(0,0)),r=ST(e.vector),s=r[0],o=r[1],a=r[2],l=ST(t.vector),c=l[0],u=l[1],f=l[2];if(n.a.x=o,n.a.y=a,n.b.x=u,n.b.y=f,s===c)return n.face=s,[n];var d=e.pointCross(t),A=fH(s,e,d,n.a),y=A[0],w=A[1],S=fH(c,t,We.fromVector(d.vector.mul(-1)),n.b),T=S[0],R=S[1];n.a=w,n.b=R;var I=[];n.face=y;for(var P=n.b,F=y;F!==T;){var D=Ap(F,d.vector),L=new wc(D),C=L.exitAxis();n.b=L.exitPoint(C),I.push(n.clone());var B=oh(F,n.b.x,n.b.y);F=Ife(F,n.b,C,L,T);var k=Ap(F,B);n.face=F,n.a=new Ci(k.x,k.y)}return n.b=P,I.push(n),I},fH=function(e,t,n,r){var s=1-gy;if(Math.max(Math.abs(r.x),Math.abs(r.y))<=s)return[e,r];var o=Ap(e,n.vector),a=new wc(o);if(a.intersectsFace()){var l=a.exitPoint(a.exitAxis()),c=oh(e,l.x,l.y),u=n.vector.normalize().cross(t.vector);if(c.sub(t.vector).dot(u)>=-Sfe)return[e,r]}var f=0;Math.abs(r.x)>=Math.abs(r.y)?(r.x>0&&(f=1),e=TT(e,0,f)):(r.y>0&&(f=1),e=TT(e,1,f));var d=$m(e,t.vector);return r.x=d[0],r.y=d[1],r.x=Math.max(-1,Math.min(1,r.x)),r.y=Math.max(-1,Math.min(1,r.y)),[e,r]},Ife=function(e,t,n,r,s){var o=t.x,a=t.y;n==oD&&(o=t.y,a=t.x);var l=0;o>0&&(l=1);var c=0;return a>0&&(c=1),Math.abs(a)===1&&TT(e,1-n,c)===s&&Efe(t.x*r.x,t.y*r.y,-r.z)?s:TT(e,n,l)},vT=1,dH=(function(){function i(t){this.rangeMin=fl,this.rangeMax=fl,this.it=t.iterator(),this.refresh()}var e=i.prototype;return e.cellID=function(){return this.it.cellID()},e.indexCell=function(){return this.it.indexCell()},e.next=function(){this.it.next(),this.refresh()},e.done=function(){return this.it.done()},e.seekTo=function(n){this.it.seek(n.rangeMin),(this.it.done()||qi(this.it.cellID())>n.rangeMax)&&this.it.prev()&&Gi(this.it.cellID())<n.cellID()&&this.it.next(),this.refresh()},e.seekBeyond=function(n){this.it.seek(Ia(n.rangeMax)),!this.it.done()&&qi(this.it.cellID())<=n.rangeMax&&this.it.next(),this.refresh()},e.refresh=function(){this.rangeMin=qi(this.cellID()),this.rangeMax=Gi(this.cellID())},i})(),Lfe=function(e,t){if(e.dimension()!==2)return!1;var n=e.referencePoint();if(n.point===t)return n.contained;for(var r=new Gl(n.point,t),s=n.contained,o=0;o<e.numEdges();o++){var a=e.edge(o);s=s!==r.edgeOrVertexCrossing(a.v0,a.v1)}return s},Ca=(function(){function i(){this.id=0n,this.padding=0,this.boundRect=Hr.empty(),this.middleRect=Hr.empty(),this.iLo=0,this.jLo=0,this.orientation=0,this.level=0}i.fromCellID=function(n,r){var s=new i;if(s.id=n,s.padding=r,s.middleRect=Hr.empty(),dy(n)){var o=r+1;return s.boundRect=new Hr(new Li(-o,o),new Li(-o,o)),s.middleRect=new Hr(new Li(-r,r),new Li(-r,r)),s.orientation=uu(n)&1,s}var a=yp(n),l=a.i,c=a.j,u=a.orientation;s.iLo=l,s.jLo=c,s.orientation=u,s.level=to(n),s.boundRect=DT(l,c,s.level).expandedByMargin(r);var f=Ra(s.level);return s.iLo&=-f,s.jLo&=-f,s},i.fromParentIJ=function(n,r,s){var o=Ehe[n.orientation][2*r+s],a=new i;a.id=U1(n.id)[o],a.padding=n.padding,a.boundRect=Hr.fromRect(n.boundRect),a.orientation=n.orientation^M1[o],a.level=n.level+1,a.middleRect=Hr.empty();var l=Ra(a.level);a.iLo=n.iLo+r*l,a.jLo=n.jLo+s*l;var c=n.middle();return r===1?a.boundRect.x.lo=c.x.lo:a.boundRect.x.hi=c.x.hi,s===1?a.boundRect.y.lo=c.y.lo:a.boundRect.y.hi=c.y.hi,a};var e=i.prototype;return e.cellID=function(){return this.id},e.paddingValue=function(){return this.padding},e.levelValue=function(){return this.level},e.center=function(){var n=Ra(this.level),r=2*this.iLo+n,s=2*this.jLo+n;return We.fromVector(xT(uu(this.id),r,s).normalize())},e.middle=function(){if(this.middleRect.isEmpty()){var n=Ra(this.level),r=Tc(dp(2*this.iLo+n)),s=Tc(dp(2*this.jLo+n));this.middleRect=new Hr(new Li(r-this.padding,r+this.padding),new Li(s-this.padding,s+this.padding))}return this.middleRect},e.bound=function(){return this.boundRect},e.childIJ=function(n){var r=hD[this.orientation][n];return[r>>1,r&1]},e.entryVertex=function(){var n=this.iLo,r=this.jLo;if(this.orientation&$f){var s=Ra(this.level);n+=s,r+=s}return We.fromVector(xT(uu(this.id),2*n,2*r).normalize())},e.exitVertex=function(){var n=this.iLo,r=this.jLo,s=Ra(this.level);return this.orientation===0||this.orientation===Mc+$f?n+=s:r+=s,We.fromVector(xT(uu(this.id),2*n,2*r).normalize())},e.shrinkToFit=function(n){if(this.level===0&&(n.x.contains(0)||n.y.contains(0)))return this.id;var r=Ra(this.level);if(n.x.contains(Tc(dp(2*this.iLo+r)))||n.y.contains(Tc(dp(2*this.jLo+r))))return this.id;var s=n.expandedByMargin(this.padding+1.5*Ki),o=this.iLo,a=this.jLo,l=0,c=0;o<zl(sh(s.x.lo))&&(o=zl(sh(s.x.lo))),this.iLo+r-1<=zl(sh(s.x.hi))?l=o^this.iLo+r-1:l=o^zl(sh(s.x.hi)),a<zl(sh(s.y.lo))&&(a=zl(sh(s.y.lo))),this.jLo+r-1<=zl(sh(s.y.hi))?c=a^this.jLo+r-1:c=a^zl(sh(s.y.hi));var u=BigInt((l|c)<<1)+1n,f=_i-SH(u);return f<=this.level?this.id:Sr(py(uu(this.id),o,a),f)},i})(),xp=0,vy=1,OT=2,pH=0,ty=2,S1=2*(gy+wfe),Dfe=1,mH=(function(){function i(t,n,r,s,o,a,l){t===void 0&&(t=0),n===void 0&&(n=0),r===void 0&&(r=0),s===void 0&&(s=!1),o===void 0&&(o=new Ci(0,0)),a===void 0&&(a=new Ci(0,0)),l===void 0&&(l=new ah(new We(0,0,0),new We(0,0,0))),this.shapeID=t,this.edgeID=n,this.maxLevel=r,this.hasInterior=s,this.a=o,this.b=a,this.edge=l}var e=i.prototype;return e.copy=function(){return new i(this.shapeID,this.edgeID,this.maxLevel,this.hasInterior,new Ci(this.a.x,this.a.y),new Ci(this.b.x,this.b.y),new ah(We.fromVector(this.edge.v0.vector),We.fromVector(this.edge.v1.vector)))},i})(),VL=function(e,t){this.faceEdge=e,this.bound=t},RT=(function(){function i(){var t=this;this.iterator=function(){return t.maybeApplyUpdates(),new kL(t,sD)},this.begin=function(){return t.maybeApplyUpdates(),new kL(t,sD)},this.end=function(){return t.maybeApplyUpdates(),new kL(t,KH)},this.region=function(){return new bfe(t,new _p(t,Yf))},this.len=function(){return t.shapes.size},this.reset=function(){t.shapes.clear(),t.nextID=0,t.cellMap.clear(),t.cells=[],t.status=ty},this.numEdges=function(){var n=0;return t.shapes.forEach(function(r){n+=r.numEdges()}),n},this.numEdgesUpTo=function(n){for(var r=0,s=0;s<=t.nextID;s++){var o=t.shape(s);if(!(o instanceof ny)&&(r+=o.numEdges(),r>=n))break}return r},this.shape=function(n){return t.shapes.get(n)||new ny},this.idForShape=function(n){for(var r=Ct(t.shapes.entries()),s;!(s=r()).done;){var o=s.value,a=o[0],l=o[1];if(l===n)return a}return-1},this.add=function(n){return t.shapes.set(t.nextID,n),t.nextID++,t.status=pH,t.nextID-1},this.remove=function(n){var r=t.idForShape(n);if(t.shapes.has(r)&&(t.shapes.delete(r),!(r>=t.pendingAdditionsPos))){for(var s=n.numEdges(),o=new Nfe(r,n.dimension()===2,n.referencePoint().contained,new Array(s)),a=0;a<s;a++)o.edges[a]=n.edge(a);t.pendingRemovals.push(o),t.status=pH}},this.build=function(){return t.maybeApplyUpdates()},this.isFresh=function(){return t.status===ty},this.isFirstUpdate=function(){return t.pendingAdditionsPos===0},this.isShapeBeingRemoved=function(n){return n<t.pendingAdditionsPos},this.maybeApplyUpdates=function(){t.status!==ty&&(t.applyUpdatesInternal(),t.status=ty)},this.applyUpdatesInternal=function(){for(var n=new yfe,r=Array.from({length:6},function(){return[]}),s=Ct(t.pendingRemovals),o;!(o=s()).done;){var a=o.value;t.removeShapeInternal(a,r,n)}for(var l=t.pendingAdditionsPos;l<t.shapes.size;l++)t.addShapeInternal(l,r,n);for(var c=0;c<6;c++)t.updateFaceEdges(c,r[c],n);t.pendingRemovals.length=0,t.pendingAdditionsPos=t.shapes.size},this.addShapeInternal=function(n,r,s){var o=t.shapes.get(n)||new ny;if(!(o instanceof ny)){var a=new mH(n,void 0,void 0,o.dimension()===2);a.hasInterior&&s.addShape(n,Lfe(o,s.focus()));for(var l=o.numEdges(),c=0;c<l;c++){var u=o.edge(c);a.edgeID=c,a.edge=u,a.maxLevel=AH(u),t.addFaceEdge(a,r)}}},this.addFaceEdge=function(n,r){var s=n.copy(),o=ay(s.edge.v0.vector);if(o===ay(s.edge.v1.vector)){var a=$m(o,s.edge.v0.vector),l=a[0],c=a[1];s.a=new Ci(l,c);var u=$m(o,s.edge.v1.vector);l=u[0],c=u[1],s.b=new Ci(l,c);var f=1-S1;if(Math.abs(s.a.x)<=f&&Math.abs(s.a.y)<=f&&Math.abs(s.b.x)<=f&&Math.abs(s.b.y)<=f){r[o].push(s);return}}for(var d=0;d<6;d++){var A=uy(s.edge.v0,s.edge.v1,d,S1),y=A[0],w=A[1],S=A[2];if(S){var T=n.copy();T.a=y,T.b=w,r[d].push(T)}}},this.updateFaceEdges=function(n,r,s){var o=r.length;if(!(o===0&&s.shapeIDs.length===0)){for(var a=Array(o),l=Hr.empty(),c=0;c<o;c++){var u=new VL(r[c],Hr.fromPoints(r[c].a,r[c].b));a[c]=u,l=l.addRect(u.bound)}var f=vp(n),d=Ca.fromCellID(f,S1),A=t.isFirstUpdate();if(o>0){var y=t.shrinkToFit(d,l);if(y!==d.id){t.skipCellRange(qi(f),qi(y),s,A),d=Ca.fromCellID(y,S1),t.updateEdges(d,a,s,A),t.skipCellRange(Ia(Gi(y)),Ia(Gi(f)),s,A);return}}t.updateEdges(d,a,s,A)}},this.shrinkToFit=function(n,r){var s=n.shrinkToFit(r);if(!t.isFirstUpdate()&&s!==n.id){var o=t.iterator();o.locateCellID(s)===xp&&(s=o.cellID())}return s},this.skipCellRange=function(n,r,s,o){if(s.shapeIDs.length!==0)for(var a=N1.fromRange(n,r),l=Ct(a),c;!(c=l()).done;){var u=c.value,f=[];t.updateEdges(Ca.fromCellID(u,S1),f,s,o)}},this.updateEdges=function(n,r,s,o){var a=!1;if(!o){var l=t.iterator(),c=l.locateCellID(n.id);c===OT?o=!0:c===xp&&(t.absorbIndexCell(n,l,r,s),a=!0,o=!0)}if(!o||!t.makeIndexCell(n,r,s)){for(var u=[[[],[]],[[],[]]],f=n.middle(),d=Ct(r),A;!(A=d()).done;){var y=A.value;if(y.bound.x.hi<=f.x.lo){var w=t.clipVAxis(y,f.y),S=w[0],T=w[1];S&&u[0][0].push(S),T&&u[0][1].push(T)}else if(y.bound.x.lo>=f.x.hi){var R=t.clipVAxis(y,f.y),I=R[0],P=R[1];I&&u[1][0].push(I),P&&u[1][1].push(P)}else if(y.bound.y.hi<=f.y.lo){var F=t.clipUBound(y,1,f.x.hi);F&&u[0][0].push(F);var D=t.clipUBound(y,0,f.x.lo);D&&u[1][0].push(D)}else if(y.bound.y.lo>=f.y.hi){var L=t.clipUBound(y,1,f.x.hi);L&&u[0][1].push(L);var C=t.clipUBound(y,0,f.x.lo);C&&u[1][1].push(C)}else{var B=t.clipUBound(y,1,f.x.hi),k=t.clipVAxis(B,f.y),z=k[0],G=k[1];z&&u[0][0].push(z),G&&u[0][1].push(G);var W=t.clipUBound(y,0,f.x.lo),Y=t.clipVAxis(W,f.y);z=Y[0],G=Y[1],z&&u[1][0].push(z),G&&u[1][1].push(G)}}for(var H=0;H<4;H++){var $=n.childIJ(H),J=$[0],te=$[1];(u[J][te].length>0||s.shapeIDs.length>0)&&t.updateEdges(Ca.fromParentIJ(n,J,te),u[J][te],s,o)}}a&&s.restoreStateBefore(t.pendingAdditionsPos)},this.makeIndexCell=function(n,r,s){if(r.length===0&&s.shapeIDs.length===0)return!0;for(var o=0,a=Ct(r),l;!(l=a()).done;){var c=l.value;if(n.level<c.faceEdge.maxLevel&&o++,o>t.maxEdgesPerCell)return!1}s.isActive&&r.length!==0&&(s.atCellID(n.id)||s.moveTo(n.entryVertex()),s.drawTo(n.center()),t.testAllEdges(r,s));for(var u=s.shapeIDs,f=t.countShapes(r,u),d=new xfe(f),A=0,y=0,w=0;w<f;w++){var S=void 0,T=t.shapes.size,R=T;A!==r.length&&(T=r[A].faceEdge.shapeID),y<u.length&&(R=u[y]);var I=A;if(R<T)S=new aH(R,0),S.containsCenter=!0,y++;else{for(;A<r.length&&r[A].faceEdge.shapeID===T;)A++;S=new aH(T,A-I);for(var P=I;P<A;P++)S.edges[P-I]=r[P].faceEdge.edgeID;R===T&&(S.containsCenter=!0,y++)}d.shapes[w]=S}return t.cellMap.set(n.id,d),t.cells.push(n.id),s.isActive&&r.length!==0&&(s.drawTo(n.exitVertex()),t.testAllEdges(r,s),s.setNextCellID(Ia(n.id))),!0},this.updateBound=function(n,r,s,o,a){var l=new VL(n.faceEdge,new Hr);return r===0?(l.bound.x.lo=s,l.bound.x.hi=n.bound.x.hi):(l.bound.x.lo=n.bound.x.lo,l.bound.x.hi=s),o===0?(l.bound.y.lo=a,l.bound.y.hi=n.bound.y.hi):(l.bound.y.lo=n.bound.y.lo,l.bound.y.hi=a),l},this.clipUBound=function(n,r,s){if(r===0&&n.bound.x.lo>=s||r===1&&n.bound.x.hi<=s)return n;var o=n.faceEdge,a=n.bound.y.clampPoint(F1(s,o.a.x,o.b.x,o.a.y,o.b.y)),l=o.a.x>o.b.x==o.a.y>o.b.y,c=r===1===l?1:0;return t.updateBound(n,r,s,c,a)},this.clipVBound=function(n,r,s){if(r===0&&n.bound.y.lo>=s||r===1&&n.bound.y.hi<=s)return n;var o=n.faceEdge,a=n.bound.x.clampPoint(F1(s,o.a.y,o.b.y,o.a.x,o.b.x)),l=o.a.x>o.b.x==o.a.y>o.b.y,c=r===1===l?1:0;return t.updateBound(n,c,a,r,s)},this.clipVAxis=function(n,r){return n.bound.y.hi<=r.lo?[n,void 0]:n.bound.y.lo>=r.hi?[void 0,n]:[t.clipVBound(n,1,r.hi),t.clipVBound(n,0,r.lo)]},this.absorbIndexCell=function(n,r,s,o){if(o.isActive&&s.length!==0&&t.isShapeBeingRemoved(s[0].faceEdge.shapeID)){o.atCellID(n.id)||o.moveTo(n.entryVertex()),o.drawTo(n.exitVertex()),o.setNextCellID(Ia(n.id));for(var a=Ct(s),l;!(l=a()).done;){var c=l.value,u=c.faceEdge;if(!t.isShapeBeingRemoved(u.shapeID))break;u.hasInterior&&o.testEdge(u.shapeID,u.edge)}}o.saveAndClearStateBefore(t.pendingAdditionsPos);var f=[],d=!1,A=r.indexCell();if(A)for(var y=Ct(A.shapes),w;!(w=y()).done;){var S=w.value,T=S.shapeID,R=t.shape(T);if(R){var I=S.numEdges(),P=new mH(T,void 0,void 0,R.dimension()===2);P.hasInterior&&(o.addShape(T,S.containsCenter),!d&&I>0&&(o.moveTo(n.center()),o.drawTo(n.entryVertex()),o.setNextCellID(n.id),d=!0));for(var F=0;F<I;F++){var D=S.edges[F];P.edgeID=D,P.edge=R.edge(D),P.maxLevel=AH(P.edge),P.hasInterior&&o.testEdge(T,P.edge);var L=uy(P.edge.v0,P.edge.v1,uu(n.id),S1),C=L[0],B=L[1],k=L[2];if(!k)throw new Error("invariant failure in ShapeIndex");P.a=C,P.b=B,f.push(P)}}}for(var z=f.map(function(H){return new VL(H,Mfe(H.a,H.b,n.bound()))}),G=Ct(s),W;!(W=G()).done;){var Y=W.value;if(!t.isShapeBeingRemoved(Y.faceEdge.shapeID)){z.push.apply(z,s.slice(s.indexOf(Y)));break}}s=z,t.cellMap.delete(n.id)},this.testAllEdges=function(n,r){for(var s=Ct(n),o;!(o=s()).done;){var a=o.value;a.faceEdge.hasInterior&&r.testEdge(a.faceEdge.shapeID,a.faceEdge.edge)}},this.countShapes=function(n,r){for(var s=0,o=-1,a=0,l=0,c=Ct(n),u;!(u=c()).done;){var f=u.value;if(f.faceEdge.shapeID!==o)for(s++,o=f.faceEdge.shapeID;l<r.length&&(a=r[l],!(a>o));)a<o&&s++,l++}return s+=r.length-l,s},this.maxEdgesPerCell=10,this.nextID=0,this.shapes=new Map,this.cellMap=new Map,this.cells=[],this.status=ty,this.pendingAdditionsPos=0,this.pendingRemovals=[]}var e=i.prototype;return e.removeShapeInternal=function(n,r,s){},i})(),AH=function(e){var t=e.v0.vector.sub(e.v1.vector).norm()*Dfe;return afe.minLevel(t)},Nfe=function(e,t,n,r){this.shapeID=e,this.hasInterior=t,this.containsTrackerOrigin=n,this.edges=r};function Ffe(){return{distance:Cc(),shapeID:-1,edgeID:-1}}function GL(i,e){return i.distance<e.distance?-1:i.distance>e.distance?1:i.shapeID<e.shapeID?-1:i.shapeID>e.shapeID?1:i.edgeID<e.edgeID?-1:i.edgeID>e.edgeID?1:0}var eW=(function(){function i(){this.maxResults=1/0,this.maxDistance=Cc(),this.maxError=0,this.includeInteriors=!0,this.useBruteForce=!1}var e=i.prototype;return e.setInclusiveMaxDistance=function(n){this.maxDistance=D1(n)},e.setConservativeMaxDistance=function(n){this.maxDistance=D1(LT(n,cfe(n)))},e.clone=function(){var n=new i;return n.maxResults=this.maxResults,n.maxDistance=this.maxDistance,n.maxError=this.maxError,n.includeInteriors=this.includeInteriors,n.useBruteForce=this.useBruteForce,n},i})(),Bfe=(function(){function i(t){this._includeInteriors=!0,this.point=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 120},e.updateMinDistanceToEdge=function(n,r,s){var o=hu(this.point,n,r,s);return{distance:o.dist,updated:o.less}},e.updateMinDistanceToPoint=function(n,r){var s=We.chordAngleBetweenPoints(this.point,n);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.updateMinDistanceToCell=function(n,r){var s=n.distance(this.point);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){var s=this,o=new _p(n,Yf);return o.visitContainingShapes(this.point,function(a){var l=n.idForShape(a);return l>=0?r(l,s.point):!0})},e.getCapBound=function(){return{center:this.point,radius:0}},i})(),Ofe=(function(){function i(t,n){this._includeInteriors=!0,this.a=t,this.b=n}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 60},e.updateMinDistanceToEdge=function(n,r,s){return nW(this.a,this.b,n,r,s)},e.updateMinDistanceToPoint=function(n,r){var s=hu(n,this.a,this.b,r);return{distance:s.dist,updated:s.less}},e.updateMinDistanceToCell=function(n,r){var s=n.distanceToEdge(this.a,this.b);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){for(var s=new _p(n,Yf),o=new Set,a=function(){var d=u[c],A=s.visitContainingShapes(d,function(y){var w=n.idForShape(y);return w>=0&&!o.has(w)?(o.add(w),r(w,d)):!0});if(!A)return{v:!1}},l,c=0,u=[this.a,this.b];c<u.length;c++)if(l=a(),l)return l.v;return!0},e.getCapBound=function(){var n=We.fromVector(this.a.vector.add(this.b.vector).normalize()),r=Math.max(We.chordAngleBetweenPoints(n,this.a),We.chordAngleBetweenPoints(n,this.b));return{center:n,radius:r}},i})(),Ufe=(function(){function i(t){this._includeInteriors=!0,this.cell=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 30},e.updateMinDistanceToEdge=function(n,r,s){var o=this.cell.distanceToEdge(n,r);return o<s?{distance:o,updated:!0}:{distance:s,updated:!1}},e.updateMinDistanceToPoint=function(n,r){var s=this.cell.distance(n);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.updateMinDistanceToCell=function(n,r){var s=this.cell.distanceToCell(n);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){var s=new _p(n,Yf),o=this.cell.center();return s.visitContainingShapes(o,function(a){var l=n.idForShape(a);return l>=0?r(l,o):!0})},e.getCapBound=function(){for(var n=this.cell.center(),r=0,s=0;s<4;s++){var o=We.chordAngleBetweenPoints(n,this.cell.vertex(s));o>r&&(r=o)}return{center:n,radius:r}},i})(),tW=(function(){function i(t){this._includeInteriors=!0,this.index=t,this.query=new _p(t,Yf)}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 25},e.updateMinDistanceToEdge=function(n,r,s){if(this._includeInteriors&&(this.query.contains(n)||this.query.contains(r)))return{distance:0,updated:s>0};for(var o=!1,a=Ct(this.index.shapes),l;!(l=a()).done;){var c=l.value,u=c[1];if(u)for(var f=u.numEdges(),d=0;d<f;d++){var A=u.edge(d),y=nW(n,r,A.v0,A.v1,s);if(y.updated&&(s=y.distance,o=!0),s===0)return{distance:0,updated:o}}}return{distance:s,updated:o}},e.updateMinDistanceToPoint=function(n,r){if(this._includeInteriors&&this.query.contains(n))return{distance:0,updated:r>0};for(var s=!1,o=Ct(this.index.shapes),a;!(a=o()).done;){var l=a.value,c=l[1];if(c)for(var u=c.numEdges(),f=0;f<u;f++){var d=c.edge(f),A=hu(n,d.v0,d.v1,r);if(A.less&&(r=A.dist,s=!0),r===0)return{distance:0,updated:s}}}return{distance:r,updated:s}},e.updateMinDistanceToCell=function(n,r){if(this._includeInteriors&&this.query.contains(n.center()))return{distance:0,updated:r>0};for(var s=!1,o=Ct(this.index.shapes),a;!(a=o()).done;){var l=a.value,c=l[1];if(c)for(var u=c.numEdges(),f=0;f<u;f++){var d=c.edge(f),A=n.distanceToEdge(d.v0,d.v1);if(A<r&&(r=A,s=!0),r===0)return{distance:0,updated:s}}}return{distance:r,updated:s}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){for(var s=new _p(n,Yf),o=new Set,a=Ct(this.index.shapes),l;!(l=a()).done;){var c=l.value,u=c[1];if(u){for(var f=u.numEdges(),d=0;d<f;d++)for(var A=u.edge(d),y=function(){var I=T[S],P=s.visitContainingShapes(I,function(F){var D=n.idForShape(F);return D>=0&&!o.has(D)?(o.add(D),r(D,I)):!0});if(!P)return{v:!1}},w,S=0,T=[A.v0,A.v1];S<T.length;S++)if(w=y(),w)return w.v}}return!0},e.getCapBound=function(){if(this.index.len()===0)return null;for(var n=null,r=0,s=Ct(this.index.shapes),o;!(o=s()).done;){var a=o.value,l=a[1];if(l)for(var c=l.numEdges(),u=0;u<c;u++){var f=l.edge(u);n===null&&(n=f.v0);var d=We.chordAngleBetweenPoints(n,f.v0),A=We.chordAngleBetweenPoints(n,f.v1);r=Math.max(r,d,A)}}return n===null?null:{center:n,radius:r}},i})();function nW(i,e,t,n,r){if(r===0)return{distance:0,updated:!1};if(qH(i,e,t,n)===Ec)return{distance:0,updated:!0};var s=!1,o=hu(i,t,n,r);return o.less&&(r=o.dist,s=!0),o=hu(e,t,n,r),o.less&&(r=o.dist,s=!0),o=hu(t,i,e,r),o.less&&(r=o.dist,s=!0),o=hu(n,i,e,r),o.less&&(r=o.dist,s=!0),{distance:r,updated:s}}var kfe=(function(){function i(t,n){n===void 0&&(n=new eW),this.indexNumEdges=0,this.indexNumEdgesLimit=0,this.index=t,this.options=n,this.iter=t.iterator()}var e=i.prototype;return e.reInit=function(){this.indexNumEdges=0,this.indexNumEdgesLimit=0,this.iter=this.index.iterator()},e.findClosestEdges=function(n,r){return this.findClosestEdgesInternal(n,this.options,r)},e.visitClosestEdges=function(n,r,s,o){for(var a=this.findClosestEdgesInternal(n,r,o),l=Ct(a),c;!(c=l()).done;){var u=c.value;if(!s(u))break}},e.visitClosestShapes=function(n,r,s,o){for(var a=this.findClosestEdgesInternal(n,r,o),l=new Set,c=-1,u=Ct(a),f;!(f=u()).done;){var d=f.value,A=d.shapeID;if(A!==c&&!l.has(A)&&(l.add(A),c=A,!s(d)))break}},e.findClosestEdge=function(n,r){var s=this.options.clone();s.maxResults=1;var o=this.findClosestEdgesInternal(n,s,r);return o.length===0?Ffe():o[0]},e.getDistance=function(n,r){return this.findClosestEdge(n,r).distance},e.isDistanceLess=function(n,r,s){var o=this.options.clone();o.maxResults=1,o.maxDistance=r,o.maxError=Sc;var a=this.findClosestEdgesInternal(n,o,s);return a.length>0},e.isDistanceLessOrEqual=function(n,r,s){var o=this.options.clone();o.maxResults=1,o.setInclusiveMaxDistance(r),o.maxError=Sc;var a=this.findClosestEdgesInternal(n,o,s);return a.length>0},e.isConservativeDistanceLessOrEqual=function(n,r,s){var o=this.options.clone();o.maxResults=1,o.setConservativeMaxDistance(r),o.maxError=Sc;var a=this.findClosestEdgesInternal(n,o,s);return a.length>0},e.getEdge=function(n){var r=this.index.shape(n.shapeID);return r.edge(n.edgeID)},e.project=function(n,r){if(r.edgeID<0)return n;var s=this.getEdge(r);return WH(n,s.v0,s.v1)},e.findClosestEdgesInternal=function(n,r,s){var o=r.maxDistance,a=[];if(o===0)return a;if(r.includeInteriors){var l=new Set;n.visitContainingShapeIds(this.index,function(T,R){return(!s||s(T))&&l.add(T),l.size<r.maxResults});for(var c=Ct(l),u;!(u=c()).done;){var f=u.value;a.push({distance:0,shapeID:f,edgeID:-1})}if(o===0)return a}var d=n.maxBruteForceIndexSize()+1;d>this.indexNumEdgesLimit&&this.indexNumEdges>=this.indexNumEdgesLimit&&(this.indexNumEdges=this.countEdgesUpTo(d),this.indexNumEdgesLimit=d),r.useBruteForce||this.indexNumEdges<d?this.findClosestEdgesBruteForce(n,r,s,o,a):this.findClosestEdgesOptimized(n,r,s,o,a),a.sort(GL);for(var A=[],y=0,w=a;y<w.length;y++){var S=w[y];(A.length===0||A[A.length-1].shapeID!==S.shapeID||A[A.length-1].edgeID!==S.edgeID)&&A.push(S)}return A.length>r.maxResults&&(A.length=r.maxResults),A},e.findClosestEdgesBruteForce=function(n,r,s,o,a){for(var l=Ct(this.index.shapes),c;!(c=l()).done;){var u=c.value,f=u[0],d=u[1];if(d&&!(s&&!s(f)))for(var A=d.numEdges(),y=0;y<A;y++){var w=d.edge(y),S=n.updateMinDistanceToEdge(w.v0,w.v1,o);if(S.updated){var T={distance:S.distance,shapeID:f,edgeID:y};r.maxResults===1?(a.length===0?a.push(T):a[0]=T,o=S.distance-r.maxError):r.maxResults===1/0?a.push(T):(a.push(T),a.length>r.maxResults&&(a.sort(GL),a.length=r.maxResults,o=a[a.length-1].distance-r.maxError))}}}},e.findClosestEdgesOptimized=function(n,r,s,o,a){var l=n.getCapBound();if(l){if(this.iter=this.index.iterator(),r.maxResults===1&&this.iter.locatePoint(l.center)){var c=this.iter.indexCell();if(o=this.processIndexCell(n,r,s,c,o,a),o===0)return}var u=[];for(this.iter.begin();!this.iter.done();){var f=this.iter.cellID(),d=Pa.fromCellID(f),A=n.updateMinDistanceToCell(d,o);A.distance<o&&u.push({distance:A.distance,id:f,indexCell:this.iter.indexCell()}),this.iter.next()}for(u.sort(function(C,B){return C.distance-B.distance});u.length>0;){var y=u.shift();if(y.distance>=o)break;if(y.indexCell!==null)o=this.processIndexCell(n,r,s,y.indexCell,o,a);else{console.log("HEYYYY");for(var w=U1(y.id),S=Ct(w),T;!(T=S()).done;){var R=T.value,I=this.iter.locateCellID(R);if(I===xp){var P=Pa.fromCellID(this.iter.cellID()),F=n.updateMinDistanceToCell(P,o);F.distance<o&&u.push({distance:F.distance,id:this.iter.cellID(),indexCell:this.iter.indexCell()})}else if(I===vy){var D=Pa.fromCellID(R),L=n.updateMinDistanceToCell(D,o);L.distance<o&&u.push({distance:L.distance,id:R,indexCell:null})}}u.sort(function(C,B){return C.distance-B.distance})}}}},e.processIndexCell=function(n,r,s,o,a,l){for(var c=Ct(o.shapes),u;!(u=c()).done;){var f=u.value,d=f.shapeID;if(!(s&&!s(d))){var A=this.index.shape(d);if(A)for(var y=Ct(f.edges),w;!(w=y()).done;){var S=w.value,T=A.edge(S),R=n.updateMinDistanceToEdge(T.v0,T.v1,a);if(R.updated){var I={distance:R.distance,shapeID:d,edgeID:S};r.maxResults===1?(l.length===0?l.push(I):l[0]=I,a=R.distance-r.maxError):r.maxResults===1/0?l.push(I):(l.push(I),l.length>r.maxResults&&(l.sort(GL),l.length=r.maxResults,a=l[l.length-1].distance-r.maxError))}}}}return a},e.countEdgesUpTo=function(n){for(var r=0,s=Ct(this.index.shapes),o;!(o=s()).done;){var a=o.value,l=a[1];if(l&&(r+=l.numEdges(),r>=n))break}return r},i})();function zfe(){return{distance:Cc(),cellID:0n,label:-1}}function Vfe(i){return i.label<0}var iW=(function(){function i(){this.maxResults=1/0,this.maxDistance=Cc(),this.maxError=0}var e=i.prototype;return e.setInclusiveMaxDistance=function(n){this.maxDistance=D1(n)},e.setConservativeMaxDistance=function(n){this.maxDistance=D1(LT(n,this.computeMaxDistanceError(n)))},e.computeMaxDistanceError=function(n){return uD(n)},i})(),Gfe=(function(){function i(t){this.point=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){return n.distance(this.point)},e.distanceToPoint=function(n){return We.chordAngleBetweenPoints(this.point,n)},i})(),qfe=(function(){function i(t,n){this.a=t,this.b=n}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){return n.distanceToEdge(this.a,this.b)},e.distanceToPoint=function(n){return hu(n,this.a,this.b,Cc()).dist},i})(),Hfe=(function(){function i(t){this.cell=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){return this.cell.distanceToCell(n)},e.distanceToPoint=function(n){return this.cell.distance(n)},i})(),Wfe=(function(){function i(t){this.cellUnion=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){for(var r=Cc(),s=Ct(this.cellUnion),o;!(o=s()).done;){var a=o.value,l=Pa.fromCellID(a),c=l.distanceToCell(n);if(c<r&&(r=c),r===0)break}return r},e.distanceToPoint=function(n){for(var r=Cc(),s=Ct(this.cellUnion),o;!(o=s()).done;){var a=o.value,l=Pa.fromCellID(a),c=l.distance(n);if(c<r&&(r=c),r===0)break}return r},i})(),jfe=(function(){function i(t){this.index=t,this.edgeTarget=new tW(t)}var e=i.prototype;return e.setIncludeInteriors=function(n){this.edgeTarget.setIncludeInteriors(n)},e.maxBruteForceIndexSize=function(){return this.edgeTarget.maxBruteForceIndexSize()},e.distanceToCell=function(n){var r=this.edgeTarget.updateMinDistanceToCell(n,Cc());return r.distance},e.distanceToPoint=function(n){var r=this.edgeTarget.updateMinDistanceToPoint(n,Cc());return r.distance},i})(),Xfe=(function(){function i(t,n){n===void 0&&(n=new iW),this.index=t,this.options=n}var e=i.prototype;return e.findClosestCells=function(n){var r=new XH(this.index,!0),s=new $H(this.index),o=[];for(r.begin();!r.done();r.next())for(s.startUnion(r);!s.done();){var a=s.cellID(),l=s.label(),c=Pa.fromCellID(a);if(this.options.region&&!this.options.region.intersectsCell(c)){s.next();continue}var u=n.distanceToCell(c);u<this.options.maxDistance&&o.push({cellID:a,label:l,distance:u}),s.next()}o.sort(function(d,A){return d.distance-A.distance});var f=Math.min(o.length,this.options.maxResults);return o.slice(0,f)},e.findClosestCell=function(n){var r=this.options.maxResults;this.options.maxResults=1;var s=this.findClosestCells(n);return this.options.maxResults=r,s.length===0?zfe():s[0]},e.getDistance=function(n){return this.findClosestCell(n).distance},e.isDistanceLess=function(n,r){var s=this.options.maxResults,o=this.options.maxDistance;this.options.maxResults=1,this.options.maxDistance=r;var a=this.findClosestCell(n);return this.options.maxResults=s,this.options.maxDistance=o,!Vfe(a)},e.isDistanceLessOrEqual=function(n,r){return this.isDistanceLess(n,D1(r))},e.isConservativeDistanceLessOrEqual=function(n,r){return this.isDistanceLess(n,D1(LT(r,uD(r))))},i})(),B1=(function(){function i(){this.a=new We(0,0,0),this.aLL=new ar(0,0),this.bound=Ri.emptyRect()}i.maxErrorForTests=function(){return new ar(10*Ki,1*Ki)};var e=i.prototype;return e.addPoint=function(n){var r=ar.fromPoint(n);if(this.bound.isEmpty()){this.a=n,this.aLL=r,this.bound=this.bound.addPoint(r);return}var s=this.a.vector.sub(n.vector).cross(this.a.vector.add(n.vector)),o=s.norm();if(o<191346e-20){this.a.vector.dot(n.vector)<0?this.bound=Ri.fullRect():this.bound=this.bound.union(Ri.fromLatLng(this.aLL).addPoint(r)),this.a=n,this.aLL=r;return}var a=eo.emptyInterval().addPoint(this.aLL.lng).addPoint(r.lng);a.length()>=Math.PI-2*Ki&&(a=eo.fullInterval());var l=Li.fromPoint(this.aLL.lat).addPoint(r.lat),c=s.cross(new Wt(0,0,1)),u=c.dot(this.a.vector),f=c.dot(n.vector),d=606638e-21*o+683174e-36;if(u*f<0||Math.abs(u)<=d||Math.abs(f)<=d){var A=Math.min(Math.atan2(Math.sqrt(s.x*s.x+s.y*s.y),Math.abs(s.z))+3*Ki,Math.PI/2),y=2*Math.asin(.5*this.a.vector.sub(n.vector).norm()*Math.sin(A)),w=.5*(y-l.length())+Ki;u<=d&&f>=-d&&(l.hi=Math.min(A,l.hi+w)),f<=d&&u>=-d&&(l.lo=Math.max(-A,l.lo-w))}this.a=n,this.aLL=r,this.bound=this.bound.union(new Ri(l,a))},e.rectBound=function(){return this.bound.expanded(new ar(2*Ki,0)).polarClosure()},i})();B1.expandForSubregions=function(i){if(i.isEmpty())return i;var e=Math.max(0,Math.PI-i.lng.length()-2.5*Ki),t=Math.max(i.lat.lo,-i.lat.hi),n=Math.PI/2+i.lat.lo,r=Math.PI/2-i.lat.hi;if(t>=0){if(2*t+e<1354e-18)return Ri.fullRect()}else if(e>=Math.PI/2){if(n+r<1687e-18)return Ri.fullRect()}else if(Math.max(n,r)*e<1765e-18)return Ri.fullRect();var s=9*Ki,o=0;return e<=0&&(o=Math.PI),i.expanded(new ar(s,o)).polarClosure()};var rW=function(e,t,n,r,s){return We.orderedCCW(n,s,r,t)&&We.orderedCCW(r,e,n,t)},$fe=function(e,t,n,r,s){return!(We.orderedCCW(e,s,r,t)&&We.orderedCCW(r,n,e,t))},Yfe=(function(){function i(t){this.a=new Ci(0,0),this.b=new Ci(0,0),this.index=t,this.iter=t.iterator(),this.cells=[]}var e=i.prototype;return e.crossings=function(n,r,s,o){var a=this.candidates(n,r,s);if(a.length===0)return[];for(var l=new Gl(n,r),c=0,u=a.length,f=0;f<u;f++){var d=s.edge(a[f]),A=l.crossingSign(d.v0,d.v1);(o===vT&&(A===CT||A===Ec)||o!==vT&&A===Ec)&&(a[c]=a[f],c++)}return c<u&&(a=a.slice(0,c)),a},e.crossingsEdgeMap=function(n,r,s){var o=this.candidatesEdgeMap(n,r);if(o.size===0)return o;var a=new Gl(n,r);return o.forEach(function(l,c){for(var u=l.length,f=0,d=0;d<u;d++){var A=c.edge(l[d]),y=a.crossingSign(A.v0,A.v1);(s===vT&&(y===CT||y===Ec)||s!==vT&&y===Ec)&&(l[f]=l[d],o.set(c,l),f++)}f===0?o.delete(c):f<u&&o.set(c,o.get(c).slice(0,f))}),o},e.candidates=function(n,r,s){var o=[],a=27,l=s.numEdges();if(l<=a)return o=Array.from({length:l},function(w,S){return S}),o;if(this.getCellsForEdge(n,r),this.cells.length===0)return[];var c=-1;this.index.shapes.forEach(function(w,S){w===s&&(c=S)});for(var u=Ct(this.cells),f;!(f=u()).done;){var d,A=f.value;if(A){var y=A.findByShapeID(c);y&&(d=o).push.apply(d,y.edges)}}return this.cells.length>1&&(o=i.uniqueInts(o)),o},i.uniqueInts=function(n){for(var r=[],s={},o=Ct(n),a;!(a=o()).done;){var l=a.value;s[l]||(s[l]=!0,r.push(l))}return r.sort(function(c,u){return c-u}),r},e.candidatesEdgeMap=function(n,r){var s=new Zfe;if(this.index.shapes.size===1){var o=this.index.shape(0);return s.set(o,this.candidates(n,r,o)),s}if(this.getCellsForEdge(n,r),this.cells.length===0)return s;for(var a=Ct(this.cells),l;!(l=a()).done;)for(var c=l.value,u=Ct(c.shapes),f;!(f=u()).done;)for(var d=f.value,A=this.index.shape(d.shapeID),y=0;y<d.numEdges();y++)s.set(A,(s.get(A)||[]).concat([d.edges[y]]));return this.cells.length>1&&s.forEach(function(w,S){s.set(S,i.uniqueInts(w))}),s},e.getCells=function(n,r,s){var o=Tfe(n,r,uu(s.id)),a=o[0],l=o[1],c=o[2];if(c){this.a=a,this.b=l;var u=Hr.fromPoints(this.a,this.b);s.bound().intersects(u)&&this.computeCellsIntersected(s,u)}return this.cells.length===0?[]:this.cells},e.getCellsForEdge=function(n,r){this.cells=[];for(var s=Pfe(n,r),o=Ct(s),a;!(a=o()).done;){var l=a.value;this.a=l.a,this.b=l.b;var c=Hr.fromPoints(this.a,this.b),u=Ca.fromCellID(vp(l.face),0),f=u.shrinkToFit(c),d=this.iter.locateCellID(f);d===xp?this.cells.push(this.iter.indexCell()):d===vy&&(dy(f)||(u=Ca.fromCellID(f,0)),this.computeCellsIntersected(u,c))}},e.computeCellsIntersected=function(n,r){if(this.iter.seek(qi(n.id)),!(this.iter.done()||this.iter.cellID()>Gi(n.id))){if(this.iter.cellID()===n.id){this.cells.push(this.iter.indexCell());return}var s=n.middle().lo();if(r.x.hi<s.x){this.clipVAxis(r,s.y,0,n);return}else if(r.x.lo>=s.x){this.clipVAxis(r,s.y,1,n);return}var o=this.splitUBound(r,s.x);r.y.hi<s.y?(this.computeCellsIntersected(Ca.fromParentIJ(n,0,0),o[0]),this.computeCellsIntersected(Ca.fromParentIJ(n,1,0),o[1])):r.y.lo>=s.y?(this.computeCellsIntersected(Ca.fromParentIJ(n,0,1),o[0]),this.computeCellsIntersected(Ca.fromParentIJ(n,1,1),o[1])):(this.clipVAxis(o[0],s.y,0,n),this.clipVAxis(o[1],s.y,1,n))}},e.clipVAxis=function(n,r,s,o){if(n.y.hi<r)this.computeCellsIntersected(Ca.fromParentIJ(o,s,0),n);else if(n.y.lo>=r)this.computeCellsIntersected(Ca.fromParentIJ(o,s,1),n);else{var a=this.splitVBound(n,r);this.computeCellsIntersected(Ca.fromParentIJ(o,s,0),a[0]),this.computeCellsIntersected(Ca.fromParentIJ(o,s,1),a[1])}},e.splitUBound=function(n,r){var s=n.y.clampPoint(F1(r,this.a.x,this.b.x,this.a.y,this.b.y)),o=this.a.x>this.b.x!=this.a.y>this.b.y?1:0;return this.splitBound(n,0,o,r,s)},e.splitVBound=function(n,r){var s=n.x.clampPoint(F1(r,this.a.y,this.b.y,this.a.x,this.b.x)),o=this.a.x>this.b.x!=this.a.y>this.b.y?1:0;return this.splitBound(n,o,0,s,r)},e.splitBound=function(n,r,s,o,a){var l=[Hr.fromRect(n),Hr.fromRect(n)];return r===1?(l[0].x.lo=o,l[1].x.hi=o):(l[0].x.hi=o,l[1].x.lo=o),s===1?(l[0].y.lo=a,l[1].y.hi=a):(l[0].y.hi=a,l[1].y.lo=a),l},i})(),Zfe=(function(i){function e(){return i.apply(this,arguments)||this}return hy(e,i),e})(I1(Map)),Kfe=function(e,t,n){var r=1,s=t.distance(n);s!==0&&(r=s/Math.sin(s));var o=1,a=n.distance(e);a!==0&&(o=a/Math.sin(a));var l=1,c=e.distance(t);c!==0&&(l=c/Math.sin(c));var u=new Wt(e.x,t.x-e.x,n.x-e.x),f=new Wt(e.y,t.y-e.y,n.y-e.y),d=new Wt(e.z,t.z-e.z,n.z-e.z),A=new Wt(r,o-r,l-r);return We.fromVector(new Wt(f.cross(d).dot(A),d.cross(u).dot(A),u.cross(f).dot(A)).mul(.5))},gH=new We(0,0,1),vH=new We(0,0,-1),aD=(function(){function i(t){this.originInside=!1,this.depth=0,this.bound=Ri.emptyRect(),this.subregionBound=Ri.emptyRect(),this.vertices=t,this.index=new RT,this.initOriginAndBound()}i.fromCell=function(n){var r=[n.vertex(0),n.vertex(1),n.vertex(2),n.vertex(3)];return new i(r)},i.fromLoop=function(n){return new i(n.vertices.map(function(r){return We.fromVector(r.vector)}))},i.emptyLoop=function(){return new i([gH])},i.fullLoop=function(){return new i([vH])};var e=i.prototype;return e.initOriginAndBound=function(){if(this.vertices.length<3){if(!this.isEmptyOrFull()){this.originInside=!1;return}this.originInside=this.vertices[0].z<0}else{var n=this.vertices[0]!==this.vertices[1]&&this.vertices[2]!==this.vertices[1]&&ofe(this.vertices[0],this.vertices[1],this.vertices[2]);this.originInside=!1,n!==this.containsPoint(this.vertices[1])&&(this.originInside=!0)}this.initBound(),this.index.add(this)},e.copyFrom=function(n){this.vertices=n.vertices,this.originInside=n.originInside,this.depth=n.depth,this.bound=n.bound,this.subregionBound=n.subregionBound,this.index=n.index},e.initBound=function(){if(this.vertices.length===0){this.copyFrom(i.emptyLoop());return}if(this.isEmptyOrFull()){this.isEmpty()?this.bound=Ri.emptyRect():this.bound=Ri.fullRect(),this.subregionBound=this.bound;return}for(var n=new B1,r=0;r<=this.vertices.length;r++)n.addPoint(this.vertex(r));var s=n.rectBound();this.containsPoint(new We(0,0,1))&&(s=new Ri(new Li(s.lat.lo,Math.PI/2),eo.fullInterval())),s.lng.isFull()&&this.containsPoint(new We(0,0,-1))&&(s.lat.lo=-Math.PI/2),this.bound=s,this.subregionBound=B1.expandForSubregions(this.bound)},e.validate=function(){var n=this.findValidationErrorNoIndex();return n||null},e.findValidationErrorNoIndex=function(){for(var n=0;n<this.vertices.length;n++){var r=this.vertices[n];if(!r.vector.isUnit())return new Error("vertex "+n+" is not unit length")}if(this.vertices.length<3)return this.isEmptyOrFull()?null:new Error("non-empty, non-full loops must have at least 3 vertices");for(var s=0;s<this.vertices.length;s++){if(this.vertices[s].equals(this.vertex(s+1)))return new Error("edge "+s+" is degenerate (duplicate vertex)");var o=We.fromVector(this.vertex(s+1).vector.mul(-1));if(this.vertices[s].equals(o))return new Error("vertices "+s+" and "+(s+1)%this.vertices.length+" are antipodal")}return null},e.contains=function(n){if(!this.subregionBound.contains(n.bound))return!1;if(this.isEmptyOrFull()||n.isEmptyOrFull())return this.isFull()||n.isEmpty();var r=new Qfe;return qL(this,n,r)?!1:r.foundSharedVertex?!0:!(!this.containsPoint(n.vertex(0))||(n.subregionBound.contains(this.bound)||n.bound.union(this.bound).isFull())&&n.containsPoint(this.vertex(0)))},e.intersects=function(n){if(!this.bound.intersects(n.bound))return!1;var r=new Jfe;return qL(this,n,r)?!0:r.foundSharedVertex?!1:!!((this.subregionBound.contains(n.bound)||this.bound.union(n.bound).isFull())&&this.containsPoint(n.vertex(0))||n.subregionBound.contains(this.bound)&&n.containsPoint(this.vertex(0)))},e.equal=function(n){if(this.vertices.length!==n.vertices.length)return!1;for(var r=0;r<this.vertices.length;r++)if(this.vertices[r]!==n.vertex(r))return!1;return!0},e.boundaryEqual=function(n){if(this.vertices.length!==n.vertices.length)return!1;if(this.isEmptyOrFull())return this.isEmpty()===n.isEmpty();for(var r=0;r<this.vertices.length;r++)if(this.vertices[r].equals(n.vertex(0))){for(var s=0;s<this.vertices.length;s++)if(this.vertex(s+r)!==n.vertex(s))return!1;return!0}return!1},e.compareBoundary=function(n){if(!this.bound.intersects(n.bound))return-1;if(this.isFull())return 1;if(n.isFull())return-1;var r=new ede(n.isHole());return qL(this,n,r)?0:r.foundSharedVertex?r.containsEdge?1:-1:this.containsPoint(n.vertex(0))?1:-1},e.containsOrigin=function(){return this.originInside},e.referencePoint=function(){return BT(this.originInside)},e.numEdges=function(){return this.isEmptyOrFull()?0:this.vertices.length},e.edge=function(n){return new ah(this.vertex(n),this.vertex(n+1))},e.numChains=function(){return this.isEmpty()?0:1},e.chain=function(n){return new P1(0,this.numEdges())},e.chainEdge=function(n,r){return new ah(this.vertex(r),this.vertex(r+1))},e.chainPosition=function(n){return new FT(0,n)},e.dimension=function(){return 2},e.typeTag=function(){return YH},e.privateInterface=function(){},e.isEmpty=function(){return this.isEmptyOrFull()&&!this.containsOrigin()},e.isFull=function(){return this.isEmptyOrFull()&&this.containsOrigin()},e.isEmptyOrFull=function(){return this.vertices.length===1},e.rectBound=function(){return this.bound},e.capBound=function(){return this.bound.capBound()},e.vertex=function(n){return this.vertices[n%this.vertices.length]},e.orientedVertex=function(n){var r=n-this.vertices.length;return r<0&&(r=n),this.isHole()&&(r=this.vertices.length-1-r),this.vertex(r)},e.numVertices=function(){return this.vertices.length},e.bruteForceContainsPoint=function(n){for(var r=We.originPoint(),s=this.originInside,o=Gl.newChainEdgeCrosser(r,n,this.vertex(0)),a=1;a<=this.vertices.length;a++)s=s!==o.edgeOrVertexChainCrossing(this.vertex(a));return s},e.containsPoint=function(n){if(!this.index.isFresh()&&!this.bound.containsPoint(n))return!1;var r=32;if(this.index.shapes.size===0||this.vertices.length<=r)return this.bruteForceContainsPoint(n);var s=this.index.iterator();return s.locatePoint(n)?this.iteratorContainsPoint(s,n):!1},e.containsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s!==xp||this.boundaryApproxIntersects(r,n)?!1:this.iteratorContainsPoint(r,n.center())},e.intersectsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s===OT?!1:s===vy||r.cellID()===n.id||this.boundaryApproxIntersects(r,n)?!0:this.iteratorContainsPoint(r,n.center())},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.boundaryApproxIntersects=function(n,r){var s=n.indexCell().findByShapeID(0);if(s.edges.length===0)return!1;if(n.cellID()===r.id)return!0;for(var o=gy+QH,a=r.boundUV().expandedByMargin(o),l=Ct(s.edges),c;!(c=l()).done;){var u=c.value,f=uy(this.vertex(u),this.vertex(u+1),r.face,o),d=f[0],A=f[1],y=f[2];if(y&&JH(d,A,a))return!0}return!1},e.iteratorContainsPoint=function(n,r){var s,o=(s=n.indexCell())==null?void 0:s.findByShapeID(0),a=o?.containsCenter||!1;if(o&&o.edges.length>0)for(var l=n.center(),c=new Gl(l,r),u=-2,f=Ct(o.edges),d;!(d=f()).done;){var A=d.value;A!==u+1&&c.restartAt(this.vertex(A)),u=A,a=a!==c.edgeOrVertexChainCrossing(this.vertex(A+1))}return a},i.regularLoop=function(n,r,s){return i.regularLoopForFrame(fD(n),r,s)},i.regularLoopForFrame=function(n,r,s){return new i(We.regularPointsForFrame(n,r,s))},e.canonicalFirstVertex=function(){for(var n=0,r=this.vertices.length,s=1;s<r;s++)this.vertex(s).vector.cmp(this.vertex(n).vector)===-1&&(n=s);return this.vertex(n+1).vector.cmp(this.vertex(n+r-1).vector)===-1?[n,1]:(n+=r,[n,-1])},e.turningAngle=function(){if(this.isEmptyOrFull())return this.containsOrigin()?-2*Math.PI:2*Math.PI;if(this.vertices.length<3)return 0;for(var n=this.canonicalFirstVertex(),r=n[0],s=n[1],o=sH(this.vertex((r+this.vertices.length-s)%this.vertices.length),this.vertex(r),this.vertex((r+s)%this.vertices.length)),a=0,l=this.vertices.length-1;l>0;l--){r+=s;var c=sH(this.vertex(r-s),this.vertex(r),this.vertex(r+s)),u=o;o+=c+a,a=u-o+c}var f=2*Math.PI-4*Ki;return Math.max(-f,Math.min(f,s*(o+a)))},e.turningAngleMaxError=function(){var n=11.25*Ki;return n*this.vertices.length},e.isHole=function(){return(this.depth&1)!==0},e.sign=function(){return this.isHole()?-1:1},e.isNormalized=function(){return this.bound.lng.length()<Math.PI?!0:this.turningAngle()>=-this.turningAngleMaxError()},e.normalize=function(){this.isNormalized()||this.invert()},e.invert=function(){if(this.index.reset(),this.isEmptyOrFull())this.vertices[0]=this.isFull()?gH:vH;else for(var n=Math.floor(this.vertices.length/2)-1;n>=0;n--){var r=this.vertices.length-1-n,s=[this.vertices[r],this.vertices[n]];this.vertices[n]=s[0],this.vertices[r]=s[1]}this.originInside=!this.originInside,this.bound.lat.lo>-Math.PI/2&&this.bound.lat.hi<Math.PI/2?(this.bound=Ri.fullRect(),this.subregionBound=this.bound):this.initBound(),this.index.add(this)},e.findVertex=function(n){var r=0;if(this.vertices.length<10){for(var s=1;s<=this.vertices.length;s++)if(this.vertex(s).equals(n))return[s,!0];return[r,!1]}var o=this.index.iterator();if(!o.locatePoint(n))return[r,!1];for(var a=o.indexCell().findByShapeID(0),l=a.numEdges()-1;l>=0;l--){var c=a.edges[l];if(this.vertex(c).equals(n))return c===0?[this.vertices.length,!0]:[c,!0];if(this.vertex(c+1).equals(n))return[c+1,!0]}return[r,!1]},e.containsNested=function(n){if(!this.subregionBound.contains(n.bound))return!1;if(this.isEmptyOrFull()||n.numVertices()<2)return this.isFull()||n.isEmpty();var r=this.findVertex(n.vertex(1)),s=r[0],o=r[1];return o?rW(this.vertex(s-1),this.vertex(s),this.vertex(s+1),n.vertex(0),n.vertex(2)):this.containsPoint(n.vertex(1))},e.surfaceIntegralFloat64=function(n){for(var r=Math.PI-1e-5,s=0,o=this.vertex(0),a=1;a+1<this.vertices.length;a++){if(this.vertex(a+1).vector.angle(o.vector)>r){var l=o;o.equals(this.vertex(0))?o=We.fromVector(this.vertex(0).pointCross(this.vertex(a)).vector.normalize()):this.vertex(a).vector.angle(this.vertex(0).vector)<r?o=this.vertex(0):(o=We.fromVector(this.vertex(0).vector.cross(l.vector)),s+=n(this.vertex(0),l,o)),s+=n(l,this.vertex(a),o)}s+=n(o,this.vertex(a),this.vertex(a+1))}return o!==this.vertex(0)&&(s+=n(o,this.vertex(this.vertices.length-1),this.vertex(0))),s},e.surfaceIntegralPoint=function(n){for(var r=Math.PI-1e-5,s=new We(0,0,0).vector,o=this.vertex(0),a=1;a+1<this.vertices.length;a++){if(this.vertex(a+1).vector.angle(o.vector)>r){var l=o;o.equals(this.vertex(0))?o=We.fromVector(this.vertex(0).pointCross(this.vertex(a)).vector.normalize()):this.vertex(a).vector.angle(this.vertex(0).vector)<r?o=this.vertex(0):(o=We.fromVector(this.vertex(0).vector.cross(l.vector)),s=s.add(n(this.vertex(0),l,o).vector)),s=s.add(n(l,this.vertex(a),o).vector)}s=s.add(n(o,this.vertex(a),this.vertex(a+1)).vector)}return o!==this.vertex(0)&&(s=s.add(n(o,this.vertex(this.vertices.length-1),this.vertex(0)).vector)),We.fromVector(s)},e.area=function(){if(this.isEmptyOrFull())return this.containsOrigin()?4*Math.PI:0;var n=this.surfaceIntegralFloat64(dfe),r=this.turningAngleMaxError();return n<0&&(n+=4*Math.PI),n>4*Math.PI&&(n=4*Math.PI),n<0&&(n=0),n<r&&!this.isNormalized()?4*Math.PI:n>4*Math.PI-r&&this.isNormalized()?0:n},e.centroid=function(){return this.surfaceIntegralPoint(Kfe)},e.containsNonCrossingBoundary=function(n,r){if(!this.bound.intersects(n.bound))return!1;if(this.isFull())return!0;if(n.isFull())return!1;var s=this.findVertex(n.vertex(0)),o=s[0],a=s[1];return a?oW(this.vertex(o-1),this.vertex(o),this.vertex(o+1),n.vertex(1),r):this.containsPoint(n.vertex(0))},i})(),PT=function(e,t){return!e.containsCenter&&t===sW||e.containsCenter&&t===IT},qL=function(e,t,n){for(var r=new dH(e.index),s=new dH(t.index),o=new xH(e,t,n,!1),a=new xH(t,e,n,!0);!r.done()||!s.done();)if(r.rangeMax<s.rangeMin)r.seekTo(s);else if(s.rangeMax<r.rangeMin)s.seekTo(r);else{var l=ls(r.it.cellID())-ls(s.it.cellID());if(l>0){if(o.hasCrossingRelation(r,s))return!0}else if(l<0){if(a.hasCrossingRelation(s,r))return!0}else{var c=r.it.indexCell().shapes[0],u=s.it.indexCell().shapes[0];if(PT(c,o.aCrossingTarget)&&PT(u,o.bCrossingTarget)||c.numEdges()>0&&u.numEdges()>0&&o.cellCrossesCell(c,u))return!0;r.next(),s.next()}}return!1},_H=0,sW=1,IT=2,Qfe=(function(){function i(){this.foundSharedVertex=!1}var e=i.prototype;return e.aCrossingTarget=function(){return sW},e.bCrossingTarget=function(){return IT},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,!rW(n,r,s,o,a)},i})(),Jfe=(function(){function i(){this.foundSharedVertex=!1}var e=i.prototype;return e.aCrossingTarget=function(){return IT},e.bCrossingTarget=function(){return IT},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,$fe(n,r,s,o,a)},i})(),ede=(function(){function i(t){this.foundSharedVertex=!1,this.containsEdge=!1,this.excludesEdge=!1,this.reverse=t}var e=i.prototype;return e.aCrossingTarget=function(){return _H},e.bCrossingTarget=function(){return _H},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,oW(n,r,s,a,this.reverse)?this.containsEdge=!0:this.excludesEdge=!0,this.containsEdge&&this.excludesEdge},i})(),oW=function(e,t,n,r,s){return r.equals(e)||r.equals(n)?r.equals(e)===s:We.orderedCCW(e,n,r,t)},xH=(function(){function i(t,n,r,s){if(this.crosser=null,this.aj=0,this.bjPrev=-2,this.bCells=[],this.a=t,this.b=n,this.relation=r,this.swapped=s,this.aCrossingTarget=r.aCrossingTarget(),this.bCrossingTarget=r.bCrossingTarget(),this.bQuery=new Yfe(n.index),s){var o=[this.bCrossingTarget,this.aCrossingTarget];this.aCrossingTarget=o[0],this.bCrossingTarget=o[1]}}var e=i.prototype;return e.startEdge=function(n){this.crosser=new Gl(this.a.vertex(n),this.a.vertex(n+1)),this.aj=n,this.bjPrev=-2},e.edgeCrossesCell=function(n){for(var r=n.numEdges(),s=0;s<r;s++){var o,a=n.edges[s];if(a!==this.bjPrev+1){var l;(l=this.crosser)==null||l.restartAt(this.b.vertex(a))}this.bjPrev=a;var c=(o=this.crosser)==null?void 0:o.chainCrossingSign(this.b.vertex(a+1));if(c!==Vl){if(c===Ec)return!0;if(this.a.vertex(this.aj+1).equals(this.b.vertex(a+1))){if(this.swapped){if(this.relation.wedgesCross(this.b.vertex(a),this.b.vertex(a+1),this.b.vertex(a+2),this.a.vertex(this.aj),this.a.vertex(this.aj+2)))return!0}else if(this.relation.wedgesCross(this.a.vertex(this.aj),this.a.vertex(this.aj+1),this.a.vertex(this.aj+2),this.b.vertex(a),this.b.vertex(a+2)))return!0}}}return!1},e.cellCrossesCell=function(n,r){for(var s=Ct(n.edges),o;!(o=s()).done;){var a=o.value;if(this.startEdge(a),this.edgeCrossesCell(r))return!0}return!1},e.cellCrossesAnySubcell=function(n,r){for(var s=Ca.fromCellID(r,0),o=Ct(n.edges),a;!(a=o()).done;){var l=a.value;if(this.bCells=this.bQuery.getCells(this.a.vertex(l),this.a.vertex(l+1),s),this.bCells.length!==0){this.startEdge(l);for(var c=Ct(this.bCells),u;!(u=c()).done;){var f=u.value;if(this.edgeCrossesCell(f.shapes[0]))return!0}}}return!1},e.hasCrossing=function(n,r){var s=20,o=0;for(this.bCells=[];;){var a=r.it.indexCell().shapes[0].numEdges();if(a>0){if(o+=a,o>=s)return this.cellCrossesAnySubcell(n.it.indexCell().shapes[0],n.cellID())?!0:(r.seekBeyond(n),!1);this.bCells.push(r.indexCell())}if(r.next(),r.cellID()>n.rangeMax)break}for(var l=Ct(this.bCells),c;!(c=l()).done;){var u=c.value;if(this.cellCrossesCell(n.it.indexCell().shapes[0],u.shapes[0]))return!0}return!1},e.hasCrossingRelation=function(n,r){var s=n.it.indexCell().shapes[0];if(s.numEdges()!==0)return this.hasCrossing(n,r)?!0:(n.next(),!1);if(PT(s,this.aCrossingTarget))return r.seekBeyond(n),n.next(),!1;for(;r.cellID()<=n.rangeMax;){var o=r.it.indexCell().shapes[0];if(PT(o,this.bCrossingTarget))return!0;r.next()}return n.next(),!1},i})(),tde=(function(){function i(t){var n=this;if(t===void 0&&(t=[]),this.loops=[],this.index=new RT,this.hasHoles=!1,this.numVertices=0,this.nEdges=0,this.bound=Ri.emptyRect(),this.subregionBound=Ri.emptyRect(),this.cumulativeEdges=[],this.initLoops=function(r){var s=new Array;s.push(null);for(var o=-1;s.length>0;){var a=s.pop();a!=null&&(o=a.depth,n.loops.push(a));for(var l=r.get(a)||[],c=l.length-1;c>=0;c--){var u=l[c];u.depth=o+1,s.push(u)}}},t.length===1&&t[0].isEmpty()){this.initLoopProperties();return}this.loops=t,this.initNested()}i.fromOrientedLoops=function(n){for(var r=new Map,s=Ct(n),o;!(o=s()).done;){var a=o.value;r.set(a,a.containsOrigin())}for(var l=Ct(n),c;!(c=l()).done;){var u=c.value,f=u.turningAngle();Math.abs(f)>u.turningAngleMaxError()?f<0&&u.invert():u.containsOrigin()&&u.invert()}var d=new i(n);if(d.numLoops()>0){for(var A=d.loop(0),y=!1,w=Ct(d.loops),S;!(S=w()).done;){var T=S.value;T.containsOrigin()&&(y=!y,A=T)}r.get(A)!==y&&d.invert()}return d};var e=i.prototype;return e.invert=function(){if(this.isEmpty()){Object.assign(this,i.fullPolygon()),this.initLoopProperties();return}if(this.isFull()){Object.assign(this,new i),this.initLoopProperties();return}for(var n=0,r=10,s=r,o=1;o<this.numLoops();o++)if(this.loop(o).depth===0){s===r&&(s=this.loop(n).turningAngle());var a=this.loop(o).turningAngle();(a<s||a===s&&this.compareLoops(this.loop(o),this.loop(n))<0)&&(n=o,s=a)}this.loop(n).invert();var l=[],c=this.lastDescendant(n);l.push(this.loop(n));for(var u=0;u<this.loops.length;u++)(u<n||u>c)&&(this.loop(u).depth++,l.push(this.loop(u)));for(var f=0;f<this.loops.length;f++)f>n&&f<=c&&(this.loop(f).depth--,l.push(this.loop(f)));this.loops=l,this.initLoopProperties()},e.compareLoops=function(n,r){if(n.numVertices()!==r.numVertices())return n.numVertices()-r.numVertices();var s=n.canonicalFirstVertex(),o=s[0],a=s[1],l=r.canonicalFirstVertex(),c=l[0],u=l[1];if(a!==u)return a-u;for(var f=n.numVertices()-1;f>=0;f--,o+=a,c+=u){var d=n.vertex(o).vector.cmp(r.vertex(c).vector);if(d!==0)return d}return 0},i.fromCell=function(n){return new i([aD.fromCell(n)])},e.initNested=function(){if(this.loops.length===1){this.initOneLoop();return}var n=new nde;this.loops.forEach(function(r){n.insertLoop(r,null)}),this.loops=[],this.initLoops(n),this.initLoopProperties()},e.initOneLoop=function(){this.hasHoles=!1,this.numVertices=this.loops[0].vertices.length,this.bound=this.loops[0].rectBound(),this.subregionBound=B1.expandForSubregions(this.bound),this.loops[0].depth=0,this.initEdgesAndIndex()},e.initLoopProperties=function(){this.numVertices=0,this.bound=Ri.emptyRect(),this.hasHoles=!1;for(var n=Ct(this.loops),r;!(r=n()).done;){var s=r.value;s.isHole()?this.hasHoles=!0:this.bound=this.bound.union(s.rectBound()),this.numVertices+=s.numVertices()}this.subregionBound=B1.expandForSubregions(this.bound),this.initEdgesAndIndex()},e.initEdgesAndIndex=function(){if(this.nEdges=0,this.cumulativeEdges=[],!this.isFull()){var n=12;this.loops.length>n&&(this.cumulativeEdges=[]);for(var r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;this.cumulativeEdges.length>0&&this.cumulativeEdges.push(this.nEdges),this.nEdges+=o.vertices.length}this.index=new RT,this.index.add(this)}},i.fullPolygon=function(){var n=aD.fullLoop(),r=new i;return r.loops=[n],r.numVertices=n.vertices.length,r.bound=Ri.fullRect(),r.subregionBound=Ri.fullRect(),r.initEdgesAndIndex(),r},e.validate=function(){for(var n=0;n<this.loops.length;n++){var r=this.loops[n],s=r.findValidationErrorNoIndex();if(s)return new Error("loop "+n+": "+s.message);if(r.isEmpty())return new Error("loop "+n+": empty loops are not allowed");if(r.isFull()&&this.loops.length>1)return new Error("loop "+n+": full loop appears in non-full polygon")}return this.findLoopNestingError()},e.findLoopNestingError=function(){for(var n=-1,r=0;r<this.loops.length;r++){var s=this.loops[r].depth;if(s<0||s>n+1)return new Error("loop "+r+": invalid loop depth ("+s+")");n=s}for(var o=0;o<this.loops.length;o++)for(var a=this.loops[o],l=this.lastDescendant(o),c=0;c<this.loops.length;c++)if(o!==c){var u=c>=o+1&&c<=l,f=!1;if(a.containsNonCrossingBoundary(this.loops[c],f)!==u){var d=u?"":"not ";return new Error("invalid nesting: loop "+o+" should "+d+"contain loop "+c)}}return null},e.isEmpty=function(){return this.loops.length===0},e.isFull=function(){return this.loops.length===1&&this.loops[0].isFull()},e.numLoops=function(){return this.loops.length},e.loop=function(n){return this.loops[n]},e.parent=function(n){var r,s=((r=this.loops[n])==null?void 0:r.depth)||0;if(s===0)return[-1,!1];for(n--;n>=0&&this.loops[n].depth<=s;n--);return[n,!0]},e.lastDescendant=function(n){var r;if(n<0)return this.loops.length-1;var s=((r=this.loops[n])==null?void 0:r.depth)||0;for(n++;n<this.loops.length&&this.loops[n].depth>s;n++);return n-1},e.capBound=function(){return this.bound.capBound()},e.rectBound=function(){return this.bound},e.containsPoint=function(n){if(!this.index.isFresh()&&!this.bound.containsPoint(n))return!1;var r=32;if(this.numVertices<r||this.index==null){for(var s=!1,o=Ct(this.loops),a;!(a=o()).done;){var l=a.value;s=s!==l.bruteForceContainsPoint(n)}return s}return new _p(this.index,Yf).contains(n)},e.containsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s!==xp||this.boundaryApproxIntersects(r,n)?!1:this.iteratorContainsPoint(r,n.center())},e.intersectsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s===OT?!1:s===vy||r.cellID()===n.id||this.boundaryApproxIntersects(r,n)?!0:this.iteratorContainsPoint(r,n.center())},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.boundaryApproxIntersects=function(n,r){var s=n.indexCell().findByShapeID(0);if(s.edges.length===0)return!1;if(n.cellID()===r.id)return!0;for(var o=gy+QH,a=r.boundUV().expandedByMargin(o),l=Ct(s.edges),c;!(c=l()).done;){var u=c.value,f=this.index.shape(0).edge(u),d=uy(f.v0,f.v1,r.face,o),A=d[0],y=d[1],w=d[2];if(w&&JH(A,y,a))return!0}return!1},e.iteratorContainsPoint=function(n,r){var s=n.indexCell().findByShapeID(0),o=s.containsCenter;if(s.edges.length===0)return o;for(var a=new Gl(n.center(),r),l=this.index.shape(0),c=Ct(s.edges),u;!(u=c()).done;){var f=u.value,d=l.edge(f);o=o!==a.edgeOrVertexCrossing(d.v0,d.v1)}return o},e.numEdges=function(){return this.nEdges},e.edge=function(n){var r=0;if(this.cumulativeEdges.length>0){for(r=0;r<this.cumulativeEdges.length;r++)if(r+1>=this.cumulativeEdges.length||n<this.cumulativeEdges[r+1]){n-=this.cumulativeEdges[r];break}}else for(r=0;n>=this.loop(r).vertices.length;r++)n-=this.loop(r).vertices.length;return new ah(this.loop(r).orientedVertex(n),this.loop(r).orientedVertex(n+1))},e.referencePoint=function(){for(var n=!1,r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;n=n!==o.containsOrigin()}return BT(n)},e.numChains=function(){return this.numLoops()},e.chain=function(n){if(this.cumulativeEdges.length>0)return new P1(this.cumulativeEdges[n],this.loop(n).vertices.length);for(var r=0,s=0;s<n;s++)r+=this.loop(s).vertices.length;var o=this.loop(n).numVertices();return o!==1?new P1(r,o):new P1(r,0)},e.chainEdge=function(n,r){return new ah(this.loop(n).orientedVertex(r),this.loop(n).orientedVertex(r+1))},e.chainPosition=function(n){var r=0;if(this.cumulativeEdges.length>0){for(r=0;r<this.cumulativeEdges.length;r++)if(r+1>=this.cumulativeEdges.length||n<this.cumulativeEdges[r+1]){n-=this.cumulativeEdges[r];break}}else for(r=0;n>=this.loop(r).vertices.length;r++)n-=this.loop(r).vertices.length;return new FT(r,n)},e.dimension=function(){return 2},e.typeTag=function(){return Afe},e.privateInterface=function(){},e.contains=function(n){if(this.loops.length===1&&n.loops.length===1)return this.loops[0].contains(n.loops[0]);if(!this.subregionBound.contains(n.bound)&&!this.bound.lng.union(n.bound.lng).isFull())return!1;if(!this.hasHoles&&!n.hasHoles){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(!this.anyLoopContains(o))return!1}return!0}return this.containsBoundary(n)&&n.excludesNonCrossingComplementShells(this)},e.intersects=function(n){if(this.loops.length===1&&n.loops.length===1)return this.loops[0].intersects(n.loops[0]);if(!this.bound.intersects(n.bound))return!1;if(!this.hasHoles&&!n.hasHoles){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(this.anyLoopIntersects(o))return!0}return!1}return!this.excludesBoundary(n)||!n.excludesNonCrossingShells(this)},e.compareBoundary=function(n){for(var r=-1,s=0;s<this.loops.length&&r!==0;s++)r*=-this.loops[s].compareBoundary(n);return r},e.containsBoundary=function(n){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(this.compareBoundary(o)<=0)return!1}return!0},e.excludesBoundary=function(n){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(this.compareBoundary(o)>=0)return!1}return!0},e.containsNonCrossingBoundary=function(n,r){for(var s=!1,o=Ct(this.loops),a;!(a=o()).done;){var l=a.value,c=l.containsNonCrossingBoundary(n,r);s=s!=c}return s},e.excludesNonCrossingShells=function(n){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(!o.isHole()&&this.containsNonCrossingBoundary(o,!1))return!1}return!0},e.excludesNonCrossingComplementShells=function(n){if(n.isEmpty())return!this.isFull();if(n.isFull())return!0;for(var r=0;r<n.loops.length;r++){var s=n.loops[r];if(!(r>0&&!s.isHole())&&this.containsNonCrossingBoundary(s,r===0))return!1}return!0},e.anyLoopContains=function(n){for(var r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;if(o.contains(n))return!0}return!1},e.anyLoopIntersects=function(n){for(var r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;if(o.intersects(n))return!0}return!1},e.area=function(){for(var n=0,r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;n+=o.sign()*o.area()}return n},e.centroid=function(){for(var n=new We(0,0,0).vector,r=Ct(this.loops),s;!(s=r()).done;){var o=s.value,a=o.centroid().vector;o.sign()<0?n=n.sub(a):n=n.add(a)}return We.fromVector(n)},i})(),nde=(function(i){function e(){return i.apply(this,arguments)||this}hy(e,i);var t=e.prototype;return t.insertLoop=function(r,s){for(var o=[],a=!1;!a;){o=i.prototype.get.call(this,s)||[],a=!0;for(var l=Ct(o),c;!(c=l()).done;){var u=c.value;if(u.containsNested(r)){s=u,a=!1;break}}}for(var f=i.prototype.get.call(this,r)||[],d=0;d<o.length;){var A=o[d];r.containsNested(A)?(f.push(A),o.splice(d,1)):d++}i.prototype.set.call(this,r,f),i.prototype.set.call(this,s,[].concat(o,[r]))},e})(I1(Map)),ide=(function(){function i(t){t===void 0&&(t=[]),this.points=t}i.fromLatLngs=function(n){return new i(n.map(We.fromLatLng))};var e=i.prototype;return e.reverse=function(){for(var n=this.points.length,r=0;r<n/2;r++){var s=n-r-1,o=[this.points[s],this.points[r]];this.points[r]=o[0],this.points[s]=o[1]}},e.length=function(){for(var n=0,r=1;r<this.points.length;r++)n+=this.points[r-1].distance(this.points[r]);return n},e.centroid=function(){for(var n=new We(0,0,0),r=1;r<this.points.length;r++){var s=this.points[r-1].vector.add(this.points[r].vector),o=this.points[r-1].vector.sub(this.points[r].vector);n=We.fromVector(n.vector.add(s.mul(Math.sqrt(o.norm2()/s.norm2()))))}return n},e.equal=function(n){if(this.points.length!==n.points.length)return!1;for(var r=0;r<this.points.length;r++)if(!this.points[r].equals(n.points[r]))return!1;return!0},e.approxEqual=function(n,r){if(r===void 0&&(r=DH),this.points.length!==n.points.length)return!1;for(var s=0;s<this.points.length;s++)if(!this.points[s].approxEqual(n.points[s],r))return!1;return!0},e.capBound=function(){return this.rectBound().capBound()},e.rectBound=function(){for(var n=new B1,r=Ct(this.points),s;!(s=r()).done;){var o=s.value;n.addPoint(o)}return n.rectBound()},e.containsCell=function(n){return!1},e.intersectsCell=function(n){if(this.points.length===0)return!1;for(var r=Ct(this.points),s;!(s=r()).done;){var o=s.value;if(n.containsPoint(o))return!0}for(var a=[n.vertex(0),n.vertex(1),n.vertex(2),n.vertex(3)],l=0;l<4;l++)for(var c=Gl.newChainEdgeCrosser(a[l],a[l+1&3],this.points[0]),u=1;u<this.points.length;u++)if(c.chainCrossingSign(this.points[u])!==Vl)return!0;return!1},e.containsPoint=function(n){return!1},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.numEdges=function(){return this.points.length===0?0:this.points.length-1},e.edge=function(n){return new ah(this.points[n],this.points[n+1])},e.referencePoint=function(){return BT(!1)},e.numChains=function(){return Math.min(1,this.numEdges())},e.chain=function(n){return new P1(0,this.numEdges())},e.chainEdge=function(n,r){return new ah(this.points[r],this.points[r+1])},e.chainPosition=function(n){return new FT(0,n)},e.dimension=function(){return 1},e.isEmpty=function(){return vfe(this)},e.isFull=function(){return _fe(this)},e.typeTag=function(){return gfe},e.privateInterface=function(){},i.findEndVertex=function(n,r,s){var o=n.points[s],a=fD(o),l=eo.fullInterval(),c=0;for(s++;s<n.points.length;s++){var u=n.points[s],f=o.distance(u);if(f>Math.PI/2&&c>0||f<c&&c>r)break;if(c=f,!(f<=r)){var d=Fhe(a,u),A=Math.atan2(d.y,d.x);if(!l.contains(A))break;var y=Math.asin(Math.sin(r)/Math.sin(f)),w=eo.fromPointPair(A,A).expanded(y);l=l.intersection(w)}}return s-1},e.subsampleVertices=function(n){var r=[];if(this.points.length<1)return r;r.push(0);for(var s=Math.max(n,0),o=0;o+1<this.points.length;){var a=i.findEndVertex(this,s,o);this.points[a].equals(this.points[o])||r.push(a),o=a}return r},e.project=function(n){if(this.points.length===1)return[this.points[0],1];for(var r=10,s=-1,o=1;o<this.points.length;o++){var a=lfe(n,this.points[o-1],this.points[o]);a<r&&(r=a,s=o)}var l=WH(n,this.points[s-1],this.points[s]);return l.equals(this.points[s])&&s++,[l,s]},e.isOnRight=function(n){var r=this.project(n),s=r[0],o=r[1];return s.equals(this.points[o-1])&&o>1&&o<this.points.length?n.equals(this.points[o-1])?!1:We.orderedCCW(this.points[o-2],n,this.points[o],this.points[o-1]):(o===this.points.length&&o--,YL(n,this.points[o],this.points[o-1]))},e.validate=function(){for(var n=0;n<this.points.length;n++)if(!this.points[n].vector.isUnit())return new Error("vertex "+n+" is not unit length");for(var r=1;r<this.points.length;r++){var s=this.points[r-1],o=this.points[r];if(s.equals(o))return new Error("vertices "+(r-1)+" and "+r+" are identical");if(s.equals(We.fromVector(o.vector.mul(-1))))return new Error("vertices "+(r-1)+" and "+r+" are antipodal")}return null},e.intersects=function(n){if(this.points.length===0||n.points.length===0||!this.rectBound().intersects(n.rectBound()))return!1;for(var r=1;r<this.points.length;r++)for(var s=Gl.newChainEdgeCrosser(this.points[r-1],this.points[r],n.points[0]),o=1;o<n.points.length;o++)if(s.chainCrossingSign(n.points[o])!==Vl)return!0;return!1},e.interpolate=function(n){if(n<=0)return[this.points[0],1];for(var r=n*this.length(),s=1;s<this.points.length;s++){var o=this.points[s-1].distance(this.points[s]);if(r<o){var a=jH(r,this.points[s-1],this.points[s]);return a.equals(this.points[s])?[a,s+1]:[a,s]}r-=o}return[this.points[this.points.length-1],this.points.length]},e.uninterpolate=function(n,r){if(this.points.length<2)return 0;for(var s=0,o=1;o<r;o++)s+=this.points[o-1].distance(this.points[o]);for(var a=s+this.points[r-1].distance(n),l=r;l<this.points.length;l++)s+=this.points[l-1].distance(this.points[l]);return Math.min(1,a/s)},i})(),yH=(function(){function i(){}var e=i.prototype;return e.capBound=function(){return gp.emptyCap()},e.rectBound=function(){return Ri.emptyRect()},e.containsCell=function(n){return!1},e.intersectsCell=function(n){return!1},e.containsPoint=function(n){return!1},e.cellUnionBound=function(){return[]},i})(),lD=(function(){function i(t){var n=t===void 0?{}:t,r=n.minLevel,s=r===void 0?0:r,o=n.maxLevel,a=o===void 0?_i:o,l=n.levelMod,c=l===void 0?1:l,u=n.maxCells,f=u===void 0?8:u;this.minLevel=s,this.maxLevel=a,this.levelMod=c,this.maxCells=f}var e=i.prototype;return e.coverer=function(){return new aW(Math.max(0,Math.min(_i,this.minLevel)),Math.max(0,Math.min(_i,this.maxLevel)),Math.max(1,Math.min(3,this.levelMod)),this.maxCells)},e.covering=function(n){var r=this.cellUnion(n);return r.denormalize(Math.max(0,Math.min(_i,this.minLevel)),Math.max(1,Math.min(3,this.levelMod))),r},e.interiorCovering=function(n){var r=this.interiorCellUnion(n);return r.denormalize(Math.max(0,Math.min(_i,this.minLevel)),Math.max(1,Math.min(3,this.levelMod))),r},e.cellUnion=function(n){var r=this.coverer();r.coveringInternal(n);var s=r.result;return s.normalize(),s},e.interiorCellUnion=function(n){var r=this.coverer();r.interiorCovering=!0,r.coveringInternal(n);var s=r.result;return s.normalize(),s},e.fastCovering=function(n){var r=this.coverer(),s=sy(N1,n.cellUnionBound());return r.normalizeCovering(s),s},e.isCanonical=function(n){return this.coverer().isCanonical(n)},i})(),aW=(function(){function i(t,n,r,s){this.region=new yH,this.result=new N1,this.pq=new sde,this.interiorCovering=!1,this.minLevel=t,this.maxLevel=n,this.levelMod=r,this.maxCells=s}var e=i.prototype;return e.newCandidate=function(n){if(!this.region.intersectsCell(n))return new iy;var r=new rde(n),s=n.level;if(s>=this.minLevel)if(this.interiorCovering){if(this.region.containsCell(n))r.terminal=!0;else if(s+this.levelMod>this.maxLevel)return new iy}else(s+this.levelMod>this.maxLevel||this.region.containsCell(n))&&(r.terminal=!0);return r},e.expandChildren=function(n,r,s){s--;for(var o=0,a=VH(r.id),l=gD(r.id);l!==a;l=Ia(l)){var c=Pa.fromCellID(l);if(s>0){this.region.intersectsCell(c)&&(o+=this.expandChildren(n,c,s));continue}var u=this.newCandidate(c);u instanceof iy||(n.children.push(u),n.numChildren++,u.terminal&&o++)}return o},e.addCandidate=function(n){if(!(n instanceof iy)){if(n.terminal){this.result.push(n.cell.id);return}var r=this.levelMod,s=n.cell.level;s<this.minLevel&&(r=1);var o=this.expandChildren(n,n.cell,r),a=2*this.levelMod;n.numChildren!==0&&(!this.interiorCovering&&o===1<<a&&s>=this.minLevel?(n.terminal=!0,this.addCandidate(n)):(n.priority=-((s<<a)+n.numChildren<<a+o),this.pq.push(n)))}},e.adjustLevel=function(n){return this.levelMod>1&&n>this.minLevel&&(n-=(n-this.minLevel)%this.levelMod),n},e.adjustCellLevels=function(n){if(this.levelMod!==1){for(var r=0,s=Ct(n),o;!(o=s()).done;){var a=o.value,l=to(a),c=this.adjustLevel(l);if(c!==l&&(a=Sr(a,c)),!(r>0&&Xm(n[r-1],a))){for(;r>0&&Xm(a,n[r-1]);)r--;n[r]=a,r++}}n.length=r}},e.initialCandidates=function(n){var r=new lD;r.maxLevel=this.maxLevel,r.levelMod=1,r.maxCells=Math.min(4,this.maxCells);var s=r.fastCovering(n);this.adjustCellLevels(s);for(var o=Ct(s),a;!(a=o()).done;){var l=a.value;this.addCandidate(this.newCandidate(Pa.fromCellID(l)))}},e.coveringInternal=function(n){for(this.region=n,this.initialCandidates(n);this.pq.length>0&&(!this.interiorCovering||this.result.length<this.maxCells);){var r=this.pq.pop();if(this.interiorCovering||r.cell.level<this.minLevel||r.numChildren===1||this.result.length+this.pq.length+r.numChildren<=this.maxCells)for(var s=Ct(r.children),o;!(o=s()).done;){var a=o.value;(!this.interiorCovering||this.result.length<this.maxCells)&&this.addCandidate(a)}else r.terminal=!0,this.addCandidate(r)}this.region=new yH,this.pq.reset(),this.result.normalize(),(this.minLevel>0||this.levelMod>1)&&this.result.denormalize(this.minLevel,this.levelMod)},e.normalizeCovering=function(n){if(this.maxLevel<_i||this.levelMod>1)for(var r=0;r<n.length;r++){var s=to(n[r]),o=this.adjustLevel(Math.min(s,this.maxLevel));o!==s&&(n[r]=Sr(n[r],o))}n.normalize(),(this.minLevel>0||this.levelMod>1)&&n.denormalize(this.minLevel,this.levelMod);var a=n.length-this.maxCells;if(!(a<=0||this.isCanonical(n))){if(a*n.length>1e4){var l=new lD,c=l.covering(n);n.length=0,n.push.apply(n,c);return}for(;n.length>this.maxCells;){for(var u=-1,f=-1,d=0;d+1<n.length;d++){var A=cy(n[d],n[d+1]),y=A[0],w=A[1];if(w){var S=this.adjustLevel(y);S>f&&(f=S,u=d)}}if(f<this.minLevel)break;var T=Sr(n[u],f),R=this.replaceCellsWithAncestor(n,T);for(n.length=0,n.push.apply(n,R);f>this.minLevel&&(f-=this.levelMod,T=Sr(T,f),!!this.containsAllChildren(n,T));){var I=this.replaceCellsWithAncestor(n,T);n.length=0,n.push.apply(n,I)}}}},e.isCanonical=function(n){var r=this.maxLevel;this.levelMod!==1&&(r=this.maxLevel-(this.maxLevel-this.minLevel)%this.levelMod);for(var s=n.length>this.maxCells,o=1,a=0n,l=Ct(n),c;!(c=l()).done;){var u=c.value;if(!ly(u))return!1;var f=to(u);if(f<this.minLevel||f>r||this.levelMod>1&&(f-this.minLevel)%this.levelMod!==0)return!1;if(a!==0n){if(Gi(a)>=qi(u))return!1;var d=cy(u,a),A=d[0],y=d[1];if(s&&y&&A>=this.minLevel)return!1;var w=f-this.levelMod;if(w<this.minLevel||f!==to(a)||Sr(u,w)!==Sr(a,w))o=1;else if(o++,o===1<<2*this.levelMod)return!1}a=u}return!0},e.containsAllChildren=function(n,r){for(var s=n.findIndex(function(l){return l>=qi(r)}),o=to(r)+this.levelMod,a=Ay(r,o);a!==NT(r,o);a=Ia(a)){if(s===-1||n[s]!==a)return!1;s++}return!0},e.replaceCellsWithAncestor=function(n,r){var s=JL(n.length,function(a){return n[a]>qi(r)}),o=JL(n.length,function(a){return n[a]>Gi(r)});return[].concat(n.slice(0,s),[r],n.slice(o))},i})(),rde=function(e){this.terminal=!1,this.numChildren=0,this.children=[],this.priority=0,this.cell=e},iy=function(){this.cell=Pa.fromCellID(fl),this.terminal=!1,this.numChildren=0,this.children=[],this.priority=0},sde=(function(i){function e(){return i.apply(this,arguments)||this}hy(e,i);var t=e.prototype;return t.len=function(){return this.length},t.swap=function(r,s){var o=[this[s],this[r]];this[r]=o[0],this[s]=o[1]},t.push=function(){for(var r,s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];var l=(r=i.prototype.push).call.apply(r,[this].concat(o));return this.sort(e.ascending),l},t.pop=function(){var r=i.prototype.pop.call(this);return r||new iy},t.reset=function(){this.length=0},e.ascending=function(r,s){return r.priority<s.priority?-1:r.priority>s.priority?1:0},e})(I1(Array)),Gn={__proto__:null,cellid:sfe,Cap:gp,Cell:Pa,CellIndex:pfe,CellIndexRangeIterator:XH,CellIndexContentsIterator:$H,CellUnion:N1,ClosestCellQuery:Xfe,ClosestCellQueryOptions:iW,PointTarget:Gfe,EdgeTarget:qfe,CellTarget:Hfe,CellUnionTarget:Wfe,ShapeIndexTarget:jfe,ClosestEdgeQuery:kfe,ClosestEdgeQueryOptions:eW,EdgeQueryPointTarget:Bfe,EdgeQueryEdgeTarget:Ofe,EdgeQueryCellTarget:Ufe,EdgeQueryShapeIndexTarget:tW,LatLng:ar,Loop:aD,Point:We,Polygon:tde,Polyline:ide,Rect:Ri,RegionCoverer:lD,Coverer:aW,ShapeIndex:RT};function fu(i){return i?.collectionId}function z1(i){return O.world?.collectionsById?.get(i?.collectionId)}function V1(){return(O.world?.collections||[]).some(i=>i.kind!=="point"&&!Io(i.id))}function Io(i){return O.hiddenCollections.has(i)}function lW(i){let e=new Map;for(let t of i){let n=fu(t.zone);e.has(n)||e.set(n,[]),e.get(n).push(t)}return e}function cW(i,e){for(let t of i.values())if(!t.some(r=>r.geometries.some(s=>xD(s,e))))return!1;return!0}function xD(i,e){if(i.intersectsCoordinate(e))return!0;let t=i.getClosestPoint(e),n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r<=1}var yD=Object.freeze({point:"point",path:"path",area:"area"}),_y=Object.freeze({always:"always",quiet:"quiet"});function Zf(i,e){let t=e??z1(i),n=O.labelOverrides.get(t?.id);return n||bD(t)}function bD(i){let e=i?.attrs?.["atlas.label.policy"];return e||((i?.kind??yD.point)===yD.point?ode(i)==="text"?_y.always:_y.quiet:i?.kind===yD.path?_y.quiet:_y.always)}function uW(i){return O.labelOverrides.get(i?.id)===_y.quiet}function ode(i){return i?.attrs?.["atlas.render.as"]||"pin"}var ade={"atlas.hydro.huc12":"HUC-12"},lde=new Set(["atlas.geo.lat","atlas.geo.lon"]),cde=["atlas.render.","atlas.label.","atlas.stroke.","atlas.geometry."];function wD(i){let e=[];for(let[t,n]of Object.entries(i||{}))lde.has(t)||cde.some(r=>t.startsWith(r))||e.push({label:ade[t]||t,value:n});return e.sort((t,n)=>t.label.localeCompare(n.label))}function UT(i){return i?.attrs?.["atlas.geometry.surface"]||"plane"}function xy(i){let e=lh(i);return e||ude(i)}function ude(i){let e=i?.attrs||{};if(e["atlas.geometry.projection"]!=="mercator")return null;let t=(e["atlas.geometry.mercator.px"]||"").split(",").map(Number),n=(e["atlas.geometry.mercator.deg"]||"").split(",").map(Number);if(t.length!==4||n.length!==4||t.some(Number.isNaN)||n.some(Number.isNaN))return null;let[r,s,o,a]=t,[l,c,u,f]=n;if(!o||!a||c===f||l===u)return null;let d=S=>Math.asinh(Math.tan(S*Math.PI/180)),A=S=>Math.atan(Math.sinh(S))*180/Math.PI,y=d(c),w=d(f);return{toLatLng(S,T){return[A(y-(T-s)/a*(y-w)),l+(S-r)/o*(u-l)]},toWorld(S,T){return[r+(T-l)/(u-l)*o,s+(y-d(S))/(y-w)*a]}}}function lh(i){let e=i?.attrs||{};if(e["atlas.geometry.projection"]!=="equirect")return null;let t=(e["atlas.geometry.equirect.px"]||"").split(",").map(Number),n=(e["atlas.geometry.equirect.deg"]||"").split(",").map(Number);if(t.length!==4||n.length!==4||t.some(Number.isNaN)||n.some(Number.isNaN))return null;let[r,s,o,a]=t,[l,c,u,f]=n;return!o||!a||c===f||l===u?null:{toLatLng(d,A){return[c-(A-s)/a*(c-f),l+(d-r)/o*(u-l)]},toWorld(d,A){return[r+(A-l)/(u-l)*o,s+(c-d)/(c-f)*a]}}}var yy=10,hW=i=>i+1,fW=i=>Gn.cellid.level(Gn.cellid.fromToken(i)),SD={map:null,mapping:null};function kT(){return SD.map!==O.world&&(SD={map:O.world,mapping:xy(O.world)}),SD.mapping}function hde(i){let e=kT();if(!e)return null;let[t,n]=e.toLatLng(i[0],-i[1]);return Gn.LatLng.fromDegrees(t,n)}function dW(i){let e=Gn.LatLng.fromPoint(i);return[e.lat*180/Math.PI,e.lng*180/Math.PI]}var pW=new WeakMap;function TD(i){let e=kT();if(!e)return 0n;let t=pW.get(i);if(t&&t.mapping===e)return t.leaf;let n=hde(i),r=n?Gn.cellid.fromLatLng(n):0n;return typeof i=="object"&&pW.set(i,{mapping:e,leaf:r}),r}var mW={slug:"s2",name:"S2",short:"S2",appliesTo(i){return UT(i)==="sphere"&&xy(i)!==null},maxLevel(){return hW(yy)},inputLength(){return 6},level(i){return i===""?0:hW(fW(i))},parent(i){let e=Gn.cellid.fromToken(i),t=Gn.cellid.level(e);return t===0?"":Gn.cellid.toToken(Gn.cellid.parent(e,t-1))},children(i){return i===""?[0,1,2,3,4,5].map(e=>Gn.cellid.toToken(Gn.cellid.fromFace(e))):Gn.cellid.children(Gn.cellid.fromToken(i)).map(Gn.cellid.toToken)},childIndex(i){let e=Gn.cellid.fromToken(i),t=Gn.cellid.level(e);return t===0?Gn.cellid.face(e):Gn.cellid.childPosition(e,t)},contains(i,e){return Gn.cellid.contains(Gn.cellid.fromToken(i),TD(e))},descendTarget(i,e){let t=TD(e);if(t===0n)return"";let n=i===""?0:fW(i)+1;return n>yy?"":Gn.cellid.toToken(Gn.cellid.parent(t,n))},bbox(i){if(i==="")return jf();let e=this.ring(i),t=1/0,n=1/0,r=-1/0,s=-1/0;for(let[o,a]of e)t=Math.min(t,o),n=Math.min(n,a),r=Math.max(r,o),s=Math.max(s,a);return[t,n,r,s]},center(i){let e=kT(),[t,n]=dW(Gn.Cell.fromCellID(Gn.cellid.fromToken(i)).center()),[r,s]=e.toWorld(t,n);return[r,-s]},ring(i){let e=kT(),t=Gn.Cell.fromCellID(Gn.cellid.fromToken(i)),n=Gn.cellid.level(Gn.cellid.fromToken(i)),r=Math.max(2,Math.min(16,2**(4-n)*2)),s=jf(),o=s[2]-s[0],a=[];for(let u=0;u<4;u++){let f=t.vertex(u).vector,d=t.vertex((u+1)%4).vector;for(let A=0;A<r;A++){let y=A/r,w=f.x+(d.x-f.x)*y,S=f.y+(d.y-f.y)*y,T=f.z+(d.z-f.z)*y,R=Math.hypot(w,S,T)||1,[I,P]=dW(new Gn.Point(w/R,S/R,T/R)),[F,D]=e.toWorld(I,P);a.push([F,-D])}}for(let u=1;u<a.length;u++){let f=a[u][0]-a[u-1][0];f>o/2?a[u][0]-=o:f<-o/2&&(a[u][0]+=o)}let l=[...a[0]],c=l[0]-a[a.length-1][0];return c>o/2?l[0]-=o:c<-o/2&&(l[0]+=o),a.push(l),a},poleContained(i){let e=Gn.cellid.fromToken(i);return Gn.cellid.contains(e,Gn.cellid.fromLatLng(Gn.LatLng.fromDegrees(90,0)))?"north":Gn.cellid.contains(e,Gn.cellid.fromLatLng(Gn.LatLng.fromDegrees(-90,0)))?"south":null},label(i){return{context:i.slice(0,-1),principal:i.slice(-1)}},colorKey(i){return this.childIndex(i)%Wf.length},normalizeInput(i){return[...i.toLocaleLowerCase()].filter(e=>"0123456789abcdef".includes(e)).slice(0,6).join("")},parseInput(i){if(i==="")return"";let e=Gn.cellid.fromToken(i);return e===0n||!Gn.cellid.valid(e)?null:Gn.cellid.level(e)>yy?Gn.cellid.toToken(Gn.cellid.parent(e,yy)):Gn.cellid.toToken(e)},locate(i){let e=TD(i);return e===0n?null:{label:"S2",value:Gn.cellid.toToken(Gn.cellid.parent(e,yy))}}};function jf(){let i=O.lens?.surface;if(i)return[i.x,-(i.y+i.height),i.x+i.width,-i.y];let e=O.volume?.tileGrid.size??0,t=O.lens?.bounds||{x:0,y:0,width:e,height:e};return[t.x,-(t.y+t.height),t.x+t.width,-t.y]}var gW=[NL,mW];function by(i){return gW.filter(e=>e.appliesTo(i))}function Ss(){return gW.find(i=>i.slug===O.gridSystem)||NL}function vW(i,e,t,n){if(!t)return"";let r=i.center(t),s=AW(i.bbox(t)),o="",a="",l=1/0;for(;e.level(o)<e.maxLevel(n);){let c=e.descendTarget(o,r);if(!c)break;let u=AW(e.bbox(c)),f=Math.abs(Math.log(u/s));if(f<l&&(a=c,l=f),u<=s)break;o=c}return a}function AW([i,e,t,n]){return(t-i)*(n-e)}function _W(i,e,t){let n=i[0]===i[i.length-1]||fde(i[0],i[i.length-1])?i.slice(0,-1):[...i];for(let[r,s]of[[e,([o])=>o>=e],[t,([o])=>o<=t]]){let o=[];for(let a=0;a<n.length;a++){let l=n[a],c=n[(a+n.length-1)%n.length],u=s(l),f=s(c);if(u!==f){let d=(r-c[0])/(l[0]-c[0]);o.push([r,c[1]+d*(l[1]-c[1])])}u&&o.push(l)}if(n=o,n.length===0)return[]}return[...n,n[0]]}function fde(i,e){return i[0]===e[0]&&i[1]===e[1]}var Bs={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function ED(i){let e=Wr();for(let t=0,n=i.length;t<n;++t)Qm(e,i[t]);return e}function dde(i,e,t){let n=Math.min.apply(null,i),r=Math.min.apply(null,e),s=Math.max.apply(null,i),o=Math.max.apply(null,e);return ql(n,r,s,o,t)}function G1(i,e,t){return t?(t[0]=i[0]-e,t[1]=i[1]-e,t[2]=i[2]+e,t[3]=i[3]+e,t):[i[0]-e,i[1]-e,i[2]+e,i[3]+e]}function VT(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function Rc(i,e,t){let n,r;return e<i[0]?n=i[0]-e:i[2]<e?n=e-i[2]:n=0,t<i[1]?r=i[1]-t:i[3]<t?r=t-i[3]:r=0,n*n+r*r}function du(i,e){return wy(i,e[0],e[1])}function ch(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function wy(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function zT(i,e){let t=i[0],n=i[1],r=i[2],s=i[3],o=e[0],a=e[1],l=Bs.UNKNOWN;return o<t?l=l|Bs.LEFT:o>r&&(l=l|Bs.RIGHT),a<n?l=l|Bs.BELOW:a>s&&(l=l|Bs.ABOVE),l===Bs.UNKNOWN&&(l=Bs.INTERSECTING),l}function Wr(){return[1/0,1/0,-1/0,-1/0]}function ql(i,e,t,n,r){return r?(r[0]=i,r[1]=e,r[2]=t,r[3]=n,r):[i,e,t,n]}function Zm(i){return ql(1/0,1/0,-1/0,-1/0,i)}function GT(i,e){let t=i[0],n=i[1];return ql(t,n,t,n,e)}function q1(i,e,t,n,r){let s=Zm(r);return MD(s,i,e,t,n)}function Km(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function qT(i,e){return e[0]<i[0]&&(i[0]=e[0]),e[2]>i[2]&&(i[2]=e[2]),e[1]<i[1]&&(i[1]=e[1]),e[3]>i[3]&&(i[3]=e[3]),i}function Qm(i,e){e[0]<i[0]&&(i[0]=e[0]),e[0]>i[2]&&(i[2]=e[0]),e[1]<i[1]&&(i[1]=e[1]),e[1]>i[3]&&(i[3]=e[1])}function MD(i,e,t,n,r){for(;t<n;t+=r)pde(i,e[t],e[t+1]);return i}function pde(i,e,t){i[0]=Math.min(i[0],e),i[1]=Math.min(i[1],t),i[2]=Math.max(i[2],e),i[3]=Math.max(i[3],t)}function HT(i,e){let t;return t=e(H1(i)),t||(t=e(W1(i)),t)||(t=e(j1(i)),t)||(t=e(Pc(i)),t)?t:!1}function Sy(i){let e=0;return hh(i)||(e=Kn(i)*Nr(i)),e}function H1(i){return[i[0],i[1]]}function W1(i){return[i[2],i[1]]}function dl(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function xW(i,e){let t;if(e==="bottom-left")t=H1(i);else if(e==="bottom-right")t=W1(i);else if(e==="top-left")t=Pc(i);else if(e==="top-right")t=j1(i);else throw new Error("Invalid corner");return t}function Ty(i,e,t,n,r){let[s,o,a,l,c,u,f,d]=CD(i,e,t,n);return ql(Math.min(s,a,c,f),Math.min(o,l,u,d),Math.max(s,a,c,f),Math.max(o,l,u,d),r)}function CD(i,e,t,n){let r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(t),a=Math.sin(t),l=r*o,c=r*a,u=s*o,f=s*a,d=i[0],A=i[1];return[d-l+f,A-c-u,d-l-f,A-c+u,d+l-f,A+c+u,d+l+f,A+c-u,d-l+f,A-c-u]}function Nr(i){return i[3]-i[1]}function uh(i,e,t){let n=t||Wr();return Ar(i,e)?(i[0]>e[0]?n[0]=i[0]:n[0]=e[0],i[1]>e[1]?n[1]=i[1]:n[1]=e[1],i[2]<e[2]?n[2]=i[2]:n[2]=e[2],i[3]<e[3]?n[3]=i[3]:n[3]=e[3]):Zm(n),n}function RD(i,e){if(!Ar(i,e))return[i.slice()];if(ch(e,i))return[];let[t,n,r,s]=i,o=Math.max(t,e[0]),a=Math.max(n,e[1]),l=Math.min(r,e[2]),c=Math.min(s,e[3]),u=[];return o>t&&u.push([t,n,o,s]),l<r&&u.push([l,n,r,s]),a>n&&u.push([o,n,l,a]),c<s&&u.push([o,c,l,s]),u}function Pc(i){return[i[0],i[3]]}function j1(i){return[i[2],i[3]]}function Kn(i){return i[2]-i[0]}function Ar(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function hh(i){return i[2]<i[0]||i[3]<i[1]}function yW(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function bW(i,e,t){let n=!1,r=zT(i,e),s=zT(i,t);if(r===Bs.INTERSECTING||s===Bs.INTERSECTING)n=!0;else{let o=i[0],a=i[1],l=i[2],c=i[3],u=e[0],f=e[1],d=t[0],A=t[1],y=(A-f)/(d-u),w,S;s&Bs.ABOVE&&!(r&Bs.ABOVE)&&(w=d-(A-c)/y,n=w>=o&&w<=l),!n&&s&Bs.RIGHT&&!(r&Bs.RIGHT)&&(S=A-(d-l)*y,n=S>=a&&S<=c),!n&&s&Bs.BELOW&&!(r&Bs.BELOW)&&(w=d-(A-a)/y,n=w>=o&&w<=l),!n&&s&Bs.LEFT&&!(r&Bs.LEFT)&&(S=A-(d-o)*y,n=S>=a&&S<=c)}return n}function wW(i,e,t,n){if(hh(i))return Zm(t);let r=[];if(n>1){let a=i[2]-i[0],l=i[3]-i[1];for(let c=0;c<n;++c)r.push(i[0]+a*c/n,i[1],i[2],i[1]+l*c/n,i[2]-a*c/n,i[3],i[0],i[3]-l*c/n)}else r=[i[0],i[1],i[2],i[1],i[2],i[3],i[0],i[3]];e(r,r,2);let s=[],o=[];for(let a=0,l=r.length;a<l;a+=2)s.push(r[a]),o.push(r[a+1]);return dde(s,o,t)}function PD(i,e){let t=e.getExtent(),n=dl(i);if(e.canWrapX()&&(n[0]<t[0]||n[0]>=t[2])){let r=Kn(t),o=Math.floor((n[0]-t[0])/r)*r;i[0]-=o,i[2]-=o}return i}function WT(i,e,t){if(e.canWrapX()){let n=e.getExtent();if(!isFinite(i[0])||!isFinite(i[2]))return[[n[0],i[1],n[2],i[3]]];PD(i,e);let r=Kn(n);if(Kn(i)>r&&!t)return[[n[0],i[1],n[2],i[3]]];if(i[0]<n[0])return[[i[0]+r,i[1],n[2],i[3]],[n[0],i[1],i[2],i[3]]];if(i[2]>n[2])return[[i[0],i[1],n[2],i[3]],[n[0],i[1],i[2]-r,i[3]]]}return[i]}function SW(i,e){let t=[i];for(let n=0,r=e.length;n<r&&t.length>0;++n){let s=[];for(let o=0,a=t.length;o<a;++o)s.push(...RD(t[o],e[n]));t=s}return t}var TW={info:1,warn:2,error:3,none:4},mde=TW.info;function jT(...i){mde>TW.warn||console.warn(...i)}function Si(i,e,t){return Math.min(Math.max(i,e),t)}function EW(i,e,t,n,r,s){let o=r-t,a=s-n;if(o!==0||a!==0){let l=((i-t)*o+(e-n)*a)/(o*o+a*a);l>1?(t=r,n=s):l>0&&(t+=o*l,n+=a*l)}return pu(i,e,t,n)}function pu(i,e,t,n){let r=t-i,s=n-e;return r*r+s*s}function MW(i){let e=i.length;for(let n=0;n<e;n++){let r=n,s=Math.abs(i[n][n]);for(let a=n+1;a<e;a++){let l=Math.abs(i[a][n]);l>s&&(s=l,r=a)}if(s===0)return null;let o=i[r];i[r]=i[n],i[n]=o;for(let a=n+1;a<e;a++){let l=-i[a][n]/i[n][n];for(let c=n;c<e+1;c++)n==c?i[a][c]=0:i[a][c]+=l*i[n][c]}}let t=new Array(e);for(let n=e-1;n>=0;n--){t[n]=i[n][e]/i[n][n];for(let r=n-1;r>=0;r--)i[r][e]-=i[r][n]*t[n]}return t}function XT(i){return i*180/Math.PI}function mu(i){return i*Math.PI/180}function fh(i,e){let t=i%e;return t*e<0?t+e:t}function Lo(i,e,t){return i+t*(e-i)}function Jm(i,e){let t=Math.pow(10,e);return Math.round(i*t)/t}function Ey(i,e){return Math.floor(Jm(i,e))}function My(i,e){return Math.ceil(Jm(i,e))}function $T(i,e,t){if(i>=e&&i<t)return i;let n=t-e;return((i-e)%n+n)%n+e}function CW(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function eA(i,e){let t=!0;for(let n=i.length-1;n>=0;--n)if(i[n]!=e[n]){t=!1;break}return t}function X1(i,e){let t=Math.cos(e),n=Math.sin(e),r=i[0]*t-i[1]*n,s=i[1]*t+i[0]*n;return i[0]=r,i[1]=s,i}function RW(i,e){return i[0]*=e,i[1]*=e,i}function YT(i,e){if(e.canWrapX()){let t=Kn(e.getExtent()),n=PW(i,e,t);n&&(i[0]-=n*t)}return i}function PW(i,e,t){let n=e.getExtent(),r=0;return e.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(t=t||Kn(n),r=Math.floor((i[0]-n[0])/t)),r}function IW(i,e,t){let n=Math.sqrt((e[0]-i[0])*(e[0]-i[0])+(e[1]-i[1])*(e[1]-i[1])),r=[(e[0]-i[0])/n,(e[1]-i[1])/n],s=[-r[1],r[0]],o=Math.sqrt((t[0]-i[0])*(t[0]-i[0])+(t[1]-i[1])*(t[1]-i[1])),a=[(t[0]-i[0])/o,(t[1]-i[1])/o],l=n===0||o===0?0:Math.acos(Si(a[0]*r[0]+a[1]*r[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:Math.PI*2-l}var Kf={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var ID=class{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent!==void 0?e.extent:null,this.worldExtent_=e.worldExtent!==void 0?e.worldExtent:null,this.axisOrientation_=e.axisOrientation!==void 0?e.axisOrientation:"enu",this.global_=e.global!==void 0?e.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Kf[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}},bp=ID;var Cy=6378137,$1=Math.PI*Cy,Ade=[-$1,-$1,$1,$1],gde=[-180,-85,180,85],ZT=Cy*Math.log(Math.tan(Math.PI/2)),wp=class extends bp{constructor(e){super({code:e,units:"m",extent:Ade,global:!0,worldExtent:gde,getPointResolution:function(t,n){return t/Math.cosh(n[1]/Cy)}})}},LD=[new wp("EPSG:3857"),new wp("EPSG:102100"),new wp("EPSG:102113"),new wp("EPSG:900913"),new wp("http://www.opengis.net/def/crs/EPSG/0/3857"),new wp("http://www.opengis.net/gml/srs/epsg.xml#3857")];function LW(i,e,t,n){let r=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(r));for(let s=0;s<r;s+=n){e[s]=$1*i[s]/180;let o=Cy*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>ZT?o=ZT:o<-ZT&&(o=-ZT),e[s+1]=o}return e}function DW(i,e,t,n){let r=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(r));for(let s=0;s<r;s+=n)e[s]=180*i[s]/$1,e[s+1]=360*Math.atan(Math.exp(i[s+1]/Cy))/Math.PI-90;return e}var vde=6378137,NW=[-180,-90,180,90],_de=Math.PI*vde/180,Qf=class extends bp{constructor(e,t){super({code:e,units:"degrees",extent:NW,axisOrientation:t,global:!0,metersPerUnit:_de,worldExtent:NW})}},DD=[new Qf("CRS:84"),new Qf("EPSG:4326","neu"),new Qf("urn:ogc:def:crs:OGC:1.3:CRS84"),new Qf("urn:ogc:def:crs:OGC:2:84"),new Qf("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Qf("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Qf("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var ND={};function FW(i){return ND[i]||ND[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function BW(i,e){ND[i]=e}function dh(i){for(let e in i)delete i[e]}function Au(i){let e;for(e in i)return!1;return!e}var Y1={};function Z1(i,e,t){let n=i.getCode(),r=e.getCode();n in Y1||(Y1[n]={}),Y1[n][r]=t}function KT(i,e){return i in Y1&&e in Y1[i]?Y1[i][e]:null}var QT=.9996,Ic=.00669438,eE=Ic*Ic,tE=eE*Ic,tA=Ic/(1-Ic),OW=Math.sqrt(1-Ic),K1=(1-OW)/(1+OW),VW=K1*K1,FD=VW*K1,BD=FD*K1,GW=BD*K1,qW=1-Ic/4-3*eE/64-5*tE/256,xde=3*Ic/8+3*eE/32+45*tE/1024,yde=15*eE/256+45*tE/1024,bde=35*tE/3072,wde=3/2*K1-27/32*FD+269/512*GW,Sde=21/16*VW-55/32*BD,Tde=151/96*FD-417/128*GW,Ede=1097/512*BD,JT=6378137;function Mde(i,e,t){let n=i-5e5,o=(t.north?e:e-1e7)/QT/(JT*qW),a=o+wde*Math.sin(2*o)+Sde*Math.sin(4*o)+Tde*Math.sin(6*o)+Ede*Math.sin(8*o),l=Math.sin(a),c=l*l,u=Math.cos(a),f=l/u,d=f*f,A=d*d,y=1-Ic*c,w=Math.sqrt(1-Ic*c),S=JT/w,T=(1-Ic)/y,R=tA*u**2,I=R*R,P=n/(S*QT),F=P*P,D=F*P,L=D*P,C=L*P,B=C*P,k=a-f/T*(F/2-L/24*(5+3*d+10*R-4*I-9*tA))+B/720*(61+90*d+298*R+45*A-252*tA-3*I),z=(P-D/6*(1+2*d+R)+C/120*(5-2*R+28*d-3*I+8*tA+24*A))/u;return z=$T(z+mu(HW(t.number)),-Math.PI,Math.PI),[XT(z),XT(k)]}var UW=-80,kW=84,Cde=-180,Rde=180;function Pde(i,e,t){i=$T(i,Cde,Rde),e<UW?e=UW:e>kW&&(e=kW);let n=mu(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,c=mu(i),u=HW(t.number),f=mu(u),d=JT/Math.sqrt(1-Ic*r**2),A=tA*s**2,y=s*$T(c-f,-Math.PI,Math.PI),w=y*y,S=w*y,T=S*y,R=T*y,I=R*y,P=JT*(qW*n-xde*Math.sin(2*n)+yde*Math.sin(4*n)-bde*Math.sin(6*n)),F=QT*d*(y+S/6*(1-a+A)+R/120*(5-18*a+l+72*A-58*tA))+5e5,D=QT*(P+d*o*(w/2+T/24*(5-a+9*A+4*A**2)+I/720*(61-58*a+l+600*A-330*tA)));return t.north||(D+=1e7),[F,D]}function HW(i){return(i-1)*6-180+3}var Ide=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function WW(i){let e=0;for(let r of Ide){let s=i.match(r);if(s){e=parseInt(s[1]);break}}if(!e)return null;let t=0,n=!1;return e>32700&&e<32761?t=e-32700:e>32600&&e<32661&&(n=!0,t=e-32600),t?{number:t,north:n}:null}function zW(i,e){return function(t,n,r,s){let o=t.length;r=r>1?r:2,s=s??r,n||(r>2?n=t.slice():n=new Array(o));for(let a=0;a<o;a+=s){let l=t[a],c=t[a+1],u=i(l,c,e);n[a]=u[0],n[a+1]=u[1]}return n}}function jW(i){return WW(i)?new bp({code:i,units:"m"}):null}function XW(i){let e=WW(i.getCode());return e?{forward:zW(Pde,e),inverse:zW(Mde,e)}:null}var Lde=63710088e-1;function OD(i,e,t){t=t||Lde;let n=mu(i[1]),r=mu(e[1]),s=(r-n)/2,o=mu(e[0]-i[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*t*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}var Dde=[XW],Nde=[jW];var kD=!0;function YW(i){kD=!(i===void 0?!0:i)}function VD(i,e){if(e!==void 0){for(let t=0,n=i.length;t<n;++t)e[t]=i[t];e=e}else e=i.slice();return e}function zD(i){BW(i.getCode(),i),Z1(i,i,VD)}function Fde(i){i.forEach(zD)}function Os(i){if(typeof i!="string")return i;let e=FW(i);if(e)return e;for(let t of Nde){let n=t(i);if(n)return n}return null}function GD(i,e,t,n){i=Os(i);let r,s=i.getPointResolutionFunc();if(s){if(r=s(e,t),n&&n!==i.getUnits()){let o=i.getMetersPerUnit();o&&(r=r*o/Kf[n])}}else{let o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{let a=nA(i,Os("EPSG:4326"));if(!a&&o!=="degrees")r=e*i.getMetersPerUnit();else{let c=[t[0]-e/2,t[1],t[0]+e/2,t[1],t[0],t[1]-e/2,t[0],t[1]+e/2];c=a(c,c,2);let u=OD(c.slice(0,2),c.slice(2,4)),f=OD(c.slice(4,6),c.slice(6,8));r=(u+f)/2}let l=n?Kf[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function $W(i){Fde(i),i.forEach(function(e){i.forEach(function(t){e!==t&&Z1(e,t,VD)})})}function Bde(i,e,t,n){i.forEach(function(r){e.forEach(function(s){Z1(r,s,t),Z1(s,r,n)})})}function nE(i,e){return i?typeof i=="string"?Os(i):i:Os(e)}function ZW(i){return(function(e,t,n,r){let s=e.length;n=n!==void 0?n:2,r=r??n,t=t!==void 0?t:new Array(s);for(let o=0;o<s;o+=r){let a=i(e.slice(o,o+n)),l=a.length;for(let c=0,u=r;c<u;++c)t[o+c]=c>=l?e[o+c]:a[c]}return t})}function Q1(i,e){if(i===e)return!0;let t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||nA(i,e)===VD)&&t}function nA(i,e){let t=i.getCode(),n=e.getCode(),r=KT(t,n);if(r)return r;let s=null,o=null;for(let l of Dde)s||(s=l(i)),o||(o=l(e));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=UD(s.inverse,o.forward);else{let l=KT(t,a);l&&(r=UD(l,o.forward))}else{let l=KT(a,n);l&&(r=UD(s.inverse,l))}return r&&(zD(i),zD(e),Z1(i,e,r)),r}function UD(i,e){return function(t,n,r,s){return n=i(t,n,r,s),e(n,n,r,s)}}function iA(i,e){let t=Os(i),n=Os(e);return nA(t,n)}function J1(i,e,t){let n=iA(e,t);if(!n){let r=Os(e).getCode(),s=Os(t).getCode();throw new Error(`No transform available between ${r} and ${s}`)}return n(i,void 0,i.length)}function KW(i,e,t,n){let r=iA(e,t);return wW(i,r,void 0,n)}var gu=null;function rA(){return gu}function Ry(i,e){return gu?J1(i,e,gu):i}function vu(i,e){return gu?J1(i,gu,e):(kD&&!eA(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(kD=!1,jT("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i)}function Sp(i,e){return gu?KW(i,e,gu):i}function _u(i,e){return gu?KW(i,gu,e):i}function QW(i,e){if(!gu)return i;let t=Os(e).getMetersPerUnit(),n=gu.getMetersPerUnit();return t&&n?i*t/n:i}function Ode(){$W(LD),$W(DD),Bde(DD,LD,LW,DW)}Ode();function qD(i){return i[0]>0&&i[1]>0}function JW(i,e,t){return t===void 0&&(t=[0,0]),t[0]=i[0]*e+.5|0,t[1]=i[1]*e+.5|0,t}function cs(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}var iE=class{constructor(e,t,n,r){this.minX=e,this.maxX=t,this.minY=n,this.maxY=r}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}};function sA(i,e,t,n,r){return r!==void 0?(r.minX=i,r.maxX=e,r.minY=t,r.maxY=n,r):new iE(i,e,t,n)}var rE=iE;function ej(i,e,t){let n,r;t=t||pl;let s=0,o=i.length,a=!1;for(;s<o;)n=s+(o-s>>1),r=+t(i[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}function pl(i,e){return i>e?1:i<e?-1:0}function tj(i,e){return i<e?1:i>e?-1:0}function ev(i,e,t){if(i[0]<=e)return 0;let n=i.length;if(e<=i[n-1])return n-1;if(typeof t=="function"){for(let r=1;r<n;++r){let s=i[r];if(s===e)return r;if(s<e)return t(e,i[r-1],s)>0?r-1:r}return n-1}if(t>0){for(let r=1;r<n;++r)if(i[r]<e)return r-1;return n-1}if(t<0){for(let r=1;r<n;++r)if(i[r]<=e)return r;return n-1}for(let r=1;r<n;++r){if(i[r]==e)return r;if(i[r]<e)return i[r-1]-e<e-i[r]?r-1:r}return n-1}function nj(i,e,t){for(;e<t;){let n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function Do(i,e){let t=Array.isArray(e)?e:[e],n=t.length;for(let r=0;r<n;r++)i[i.length]=t[r]}function ta(i,e){let t=i.length;if(t!==e.length)return!1;for(let n=0;n<t;n++)if(i[n]!==e[n])return!1;return!0}function ij(i,e,t){let n=e||pl;return i.every(function(r,s){if(s===0)return!0;let o=n(i[s-1],r);return!(o>0||t&&o===0)})}function jn(i,e){if(!i)throw new Error(e)}function rj(i,e,t,n,r){return!HT(r,function(o){return!Tp(i,e,t,n,o[0],o[1])})}function Tp(i,e,t,n,r,s){let o=0,a=i[t-n],l=i[t-n+1];for(;e<t;e+=n){let c=i[e],u=i[e+1];l<=s?u>s&&(c-a)*(s-l)-(r-a)*(u-l)>0&&o++:u<=s&&(c-a)*(s-l)-(r-a)*(u-l)<0&&o--,a=c,l=u}return o!==0}function Py(i,e,t,n,r,s){if(t.length===0||!Tp(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(Tp(i,t[o-1],t[o],n,r,s))return!1;return!0}function sj(i,e,t,n,r,s){if(t.length===0)return!1;for(let o=0,a=t.length;o<a;++o){let l=t[o];if(Py(i,e,l,n,r,s))return!0;e=l[l.length-1]}return!1}function sE(i,e,t,n,r){let s;for(e+=n;e<t;e+=n)if(s=r(i.slice(e-n,e),i.slice(e,e+n)),s)return s;return!1}function oA(i,e,t,n,r,s){return s=s??MD(Wr(),i,e,t,n),Ar(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:sE(i,e,t,n,function(o,a){return bW(r,o,a)}):!1}function oj(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){if(oA(i,e,t[s],n,r))return!0;e=t[s]}return!1}function HD(i,e,t,n,r){return!!(oA(i,e,t,n,r)||Tp(i,e,t,n,r[0],r[1])||Tp(i,e,t,n,r[0],r[3])||Tp(i,e,t,n,r[2],r[1])||Tp(i,e,t,n,r[2],r[3]))}function WD(i,e,t,n,r){if(!HD(i,e,t[0],n,r))return!1;if(t.length===1)return!0;for(let s=1,o=t.length;s<o;++s)if(rj(i,t[s-1],t[s],n,r)&&!oA(i,t[s-1],t[s],n,r))return!1;return!0}function aj(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(WD(i,e,a,n,r))return!0;e=a[a.length-1]}return!1}function ei(){throw new Error("Unimplemented abstract method.")}var Ude=0;function Bn(i){return i.ol_uid||(i.ol_uid=String(++Ude))}function tv(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function kde(i,e,t){return i+"/"+e+"/"+t}function nv(i,e,t,n,r){return`${Bn(i)},${e},${kde(t,n,r)}`}function lj(i){return zde(i[0],i[1],i[2])}function zde(i,e,t){return(e<<i)+t}function cj(i,e){let t=i[0],n=i[1],r=i[2];if(e.getMinZoom()>t||t>e.getMaxZoom())return!1;let s=e.getFullTileRange(t);return s?s.containsXY(n,r):!0}var iv=[0,0,0],Ep=5,jD=class{constructor(e){let t=e.minZoom,n=e.resolutions;t===void 0&&n&&(t=n.findIndex(o=>o!==void 0)),this.minZoom=t!==void 0?t:0,this.resolutions_=n,jn(ij(this.resolutions_,(o,a)=>a-o,!0),"`resolutions` must be sorted in descending order");let r;if(!e.origins){for(let o=0,a=this.resolutions_.length-1;o<a;++o)if(!r)r=this.resolutions_[o]/this.resolutions_[o+1];else if(this.resolutions_[o]/this.resolutions_[o+1]!==r){r=void 0;break}}this.zoomFactor_=r,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,jn(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));let s=e.extent;s!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=Pc(s)),jn(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,jn(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:256,jn(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=s!==void 0?s:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.tileRanges!==void 0?this.fullTileRanges_=e.tileRanges:e.sizes!==void 0?this.fullTileRanges_=e.sizes.map((o,a)=>{let l=new rE(Math.min(0,o[0]),Math.max(o[0]-1,-1),Math.min(0,o[1]),Math.max(o[1]-1,-1));if(s){let c=this.getTileRangeForExtentAndZ(s,a);l.minX=Math.max(c.minX,l.minX),l.maxX=Math.min(c.maxX,l.maxX),l.minY=Math.max(c.minY,l.minY),l.maxY=Math.min(c.maxY,l.maxY)}return l}):s&&this.calculateTileRanges_(s)}forEachTileCoord(e,t,n){let r=this.getTileRangeForExtentAndZ(e,t);for(let s=r.minX,o=r.maxX;s<=o;++s)for(let a=r.minY,l=r.maxY;a<=l;++a)n([t,s,a])}forEachTileCoordParentTileRange(e,t,n,r){let s,o,a,l=null,c=e[0]-1;for(this.zoomFactor_===2?(o=e[1],a=e[2]):l=this.getTileCoordExtent(e,r);c>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),s=sA(o,o,a,a,n)):s=this.getTileRangeForExtentAndZ(l,c,n),t(c,s))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getOrigins(){return this.origins_}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,n){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){let s=e[1]*2,o=e[2]*2;return sA(s,s+1,o,o+1,t)}let r=this.getTileCoordExtent(e,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(r,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,n){if(t>this.maxZoom||t<this.minZoom)return null;let r=e[0],s=e[1],o=e[2];if(t===r)return sA(s,o,s,o,n);if(this.zoomFactor_){let l=Math.pow(this.zoomFactor_,t-r),c=Math.floor(s*l),u=Math.floor(o*l);if(t<r)return sA(c,c,u,u,n);let f=Math.floor(l*(s+1))-1,d=Math.floor(l*(o+1))-1;return sA(c,f,u,d,n)}let a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,n)}getTileRangeForExtentAndZ(e,t,n){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,iv);let r=iv[1],s=iv[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,iv);let o=iv[1],a=iv[2];return sA(r,o,s,a,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=cs(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*r[0]*n,t[1]-(e[2]+.5)*r[1]*n]}getTileCoordExtent(e,t){let n=this.getOrigin(e[0]),r=this.getResolution(e[0]),s=cs(this.getTileSize(e[0]),this.tmpSize_),o=n[0]+e[1]*s[0]*r,a=n[1]-(e[2]+1)*s[1]*r,l=o+s[0]*r,c=a+s[1]*r;return ql(o,a,l,c,t)}getTileCoordForCoordAndResolution(e,t,n){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,n)}getTileCoordForXYAndResolution_(e,t,n,r,s){let o=this.getZForResolution(n),a=n/this.getResolution(o),l=this.getOrigin(o),c=cs(this.getTileSize(o),this.tmpSize_),u=a*(e-l[0])/n/c[0],f=a*(l[1]-t)/n/c[1];return r?(u=My(u,Ep)-1,f=My(f,Ep)-1):(u=Ey(u,Ep),f=Ey(f,Ep)),tv(o,u,f,s)}getTileCoordForXYAndZ_(e,t,n,r,s){let o=this.getOrigin(n),a=this.getResolution(n),l=cs(this.getTileSize(n),this.tmpSize_),c=(e-o[0])/a/l[0],u=(o[1]-t)/a/l[1];return r?(c=My(c,Ep)-1,u=My(u,Ep)-1):(c=Ey(c,Ep),u=Ey(u,Ep)),tv(n,c,u,s)}getTileCoordForCoordAndZ(e,t,n){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,n)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){let n=ev(this.resolutions_,e,t||0);return Si(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return HD(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){let t=this.resolutions_.length,n=new Array(t);for(let r=this.minZoom;r<t;++r)n[r]=this.getTileRangeForExtentAndZ(e,r);this.fullTileRanges_=n}},Iy=jD;function oE(i){let e=i.getDefaultTileGrid();return e||(e=Gde(i),i.setDefaultTileGrid(e)),e}function hj(i,e,t){let n=e[0],r=i.getTileCoordCenter(e),s=aE(t);if(!du(s,r)){let o=Kn(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,i.getTileCoordForCoordAndZ(r,n)}return e}function Vde(i,e,t,n){n=n!==void 0?n:"top-left";let r=dj(i,e,t);return new Iy({extent:i,origin:xW(i,n),resolutions:r,tileSize:t})}function fj(i){let e=i||{},t=e.extent||Os("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:dj(t,e.maxZoom,e.tileSize,e.maxResolution)};return new Iy(n)}function dj(i,e,t,n){e=e!==void 0?e:42,t=cs(t!==void 0?t:256);let r=Nr(i),s=Kn(i);n=n>0?n:Math.max(s/t[0],r/t[1]);let o=e+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=n/Math.pow(2,l);return a}function Gde(i,e,t,n){let r=aE(i);return Vde(r,e,t,n)}function aE(i){i=Os(i);let e=i.getExtent();if(!e){let t=180*Kf.degrees/i.getMetersPerUnit();e=ql(-t,-t,t,t)}return e}var Pn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function qn(i,e,t,n,r){if(r){let o=t;t=function(a){return i.removeEventListener(e,t),o.call(n??this,a)}}else n&&n!==i&&(t=t.bind(n));let s={target:i,type:e,listener:t};return i.addEventListener(e,t),s}function rv(i,e,t,n){return qn(i,e,t,n,!0)}function li(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),dh(i))}var nn={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};var XD=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},Mp=XD;function Jf(){return!0}function ed(){return!1}function td(){}function lE(i){let e,t,n;return function(){let r=Array.prototype.slice.call(arguments);return(!t||this!==n||!ta(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function pj(i){function e(){let t;try{t=i()}catch(n){return Promise.reject(n)}return t instanceof Promise?t:Promise.resolve(t)}return e()}var $D=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var Ao=$D;var YD=class extends Mp{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;let n=this.listeners_||(this.listeners_={}),r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){let t=typeof e=="string",n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;let s=t?new Ao(e):e;s.target||(s.target=this.eventTarget_||this);let o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});n in o||(o[n]=0,a[n]=0),++o[n];let l;for(let c=0,u=r.length;c<u;++c)if("handleEvent"in r[c]?l=r[c].handleEvent(s):l=r[c].call(this,s),l===!1||s.propagationStopped){l=!1;break}if(--o[n]===0){let c=a[n];for(delete a[n];c--;)this.removeEventListener(n,td);delete o[n]}return l}disposeInternal(){this.listeners_&&dh(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){if(!this.listeners_)return;let n=this.listeners_[e];if(!n)return;let r=n.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=td,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},Cp=YD;var aA=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",qde=aA.includes("safari")&&!aA.includes("chrom"),QBe=qde&&(aA.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(aA)),mj=aA.includes("webkit")&&!aA.includes("edge"),ZD=aA.includes("macintosh"),Aj=typeof devicePixelRatio<"u"?devicePixelRatio:1,no=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,KD=typeof Image<"u"&&Image.prototype.decode;var cE=(function(){let i=!1;try{let e=Object.defineProperty({},"passive",{get:function(){i=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return i})();function gj(i,e,t){let n=i,r=!0,s=!1,o=!1,a=[rv(n,nn.LOAD,function(){o=!0,s||e()})];return n.src&&KD?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(rv(n,nn.ERROR,t)),function(){r=!1,a.forEach(li)}}function Hde(i,e){return new Promise((t,n)=>{function r(){o(),t(i)}function s(){o(),n(new Error("Image load error"))}function o(){i.removeEventListener("load",r),i.removeEventListener("error",s)}i.addEventListener("load",r),i.addEventListener("error",s),e&&(i.src=e)})}function vj(i,e){return e&&(i.src=e),i.src&&KD?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(r=>i.complete&&i.width?t(i):n(r))):Hde(i)}var an={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function QD(i){return Math.pow(i,3)}function Lc(i){return 1-QD(1-i)}function _j(i){return 3*i*i-2*i*i*i}function xj(i){return i}var JD=class extends Cp{constructor(e,t,n){super(),n=n||{},this.tileCoord=e,this.state=t,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(nn.CHANGE)}release(){this.setState(an.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==an.EMPTY){if(this.state!==an.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}}load(){ei()}getAlpha(e,t){if(!this.transition_)return 1;let n=this.transitionStarts_[e];if(!n)n=t,this.transitionStarts_[e]=n;else if(n===-1)return 1;let r=t-n+1e3/60;return r>=this.transition_?1:QD(r/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}disposeInternal(){this.release(),super.disposeInternal()}},sv=JD;function Di(i,e,t,n){let r;return t&&t.length?r=t.shift():no?r=new class extends OffscreenCanvas{style={}}(i??300,e??150):r=document.createElement("canvas"),i&&(r.width=i),e&&(r.height=e),r.getContext("2d",n)}var eN;function Ly(){return eN||(eN=Di(1,1)),eN}function lA(i){let e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function tN(i,e){let t=e.parentNode;t&&t.replaceChild(i,e)}function yj(i){for(;i.lastChild;)i.lastChild.remove()}function bj(i,e){let t=i.childNodes;for(let n=0;;++n){let r=t[n],s=e[n];if(!r&&!s)break;if(r!==s){if(!r){i.appendChild(s);continue}if(!s){i.removeChild(r),--n;continue}i.insertBefore(s,r)}}}function uE(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){let t=this.childNodes.indexOf(e);if(t===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(t,1),e},insertBefore:function(e,t){let n=this.childNodes.indexOf(t);if(n===-1)throw new Error("Reference node not found");return this.childNodes.splice(n,0,e),e},style:{}},{get(e,t,n){return t==="firstElementChild"?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,n)}})}function Hl(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}var nN=class extends sv{constructor(e,t,n,r,s,o){super(e,t,o),this.crossOrigin_=r?.crossOrigin,this.referrerPolicy_=r?.referrerPolicy,this.src_=n,this.key=n,this.image_,no?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(e){this.image_=e,this.state=an.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=an.ERROR,this.unlistenImage_(),this.image_=Wde(),this.changed()}handleImageLoad_(){if(no)this.state=an.LOADED;else{let e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=an.LOADED:this.state=an.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==an.ERROR&&(this.state=an.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==an.IDLE&&(this.state=an.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=gj(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};function Wde(){let i=Di(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}var hE=nN;var iN,cA=[];function wj(i,e,t,n,r){i.beginPath(),i.moveTo(0,0),i.lineTo(e,t),i.lineTo(n,r),i.closePath(),i.save(),i.clip(),i.fillRect(0,0,Math.max(e,n)+1,Math.max(t,r)),i.restore()}function rN(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function jde(){if(iN===void 0){let i=Di(6,6,cA);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",wj(i,4,5,4,0),wj(i,4,5,0,5);let e=i.getImageData(0,0,3,3).data;iN=rN(e,0)||rN(e,4)||rN(e,8),lA(i),cA.push(i.canvas)}return iN}function Sj(i,e,t,n){let r=J1(t,e,i),s=GD(e,n,t),o=e.getMetersPerUnit();o!==void 0&&(s*=o);let a=i.getMetersPerUnit();a!==void 0&&(s/=a);let l=i.getExtent();if(!l||du(l,r)){let c=GD(i,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function Tj(i,e,t,n){let r=dl(t),s=Sj(i,e,r,n);return(!isFinite(s)||s<=0)&&HT(t,function(o){return s=Sj(i,e,o,n),isFinite(s)&&s>0}),s}function Ej(i,e,t,n,r,s,o,a,l,c,u,f,d,A){let y=Di(Math.round(t*i),Math.round(t*e),cA);if(f||(y.imageSmoothingEnabled=!1),l.length===0)return y.canvas;y.scale(t,t);function w(F){return Math.round(F*t)/t}y.globalCompositeOperation="lighter";let S=Wr();l.forEach(function(F,D,L){qT(S,F.extent)});let T,R=t/n,I=(f?1:1+Math.pow(2,-24))/R;if(!d||l.length!==1||c!==0){if(T=Di(Math.round(Kn(S)*R),Math.round(Nr(S)*R),cA),f||(T.imageSmoothingEnabled=!1),r&&A){let F=(r[0]-S[0])*R,D=-(r[3]-S[3])*R,L=Kn(r)*R,C=Nr(r)*R;T.rect(F,D,L,C),T.clip()}l.forEach(function(F,D,L){if(F.image.width>0&&F.image.height>0){if(F.clipExtent){T.save();let G=(F.clipExtent[0]-S[0])*R,W=-(F.clipExtent[3]-S[3])*R,Y=Kn(F.clipExtent)*R,H=Nr(F.clipExtent)*R;T.rect(f?G:Math.round(G),f?W:Math.round(W),f?Y:Math.round(G+Y)-Math.round(G),f?H:Math.round(W+H)-Math.round(W)),T.clip()}let C=(F.extent[0]-S[0])*R,B=-(F.extent[3]-S[3])*R,k=Kn(F.extent)*R,z=Nr(F.extent)*R;T.drawImage(F.image,c,c,F.image.width-2*c,F.image.height-2*c,f?C:Math.round(C),f?B:Math.round(B),f?k:Math.round(C+k)-Math.round(C),f?z:Math.round(B+z)-Math.round(B)),F.clipExtent&&T.restore()}})}let P=Pc(o);return a.getTriangles().forEach(function(F,D,L){let C=F.source,B=F.target,k=C[0][0],z=C[0][1],G=C[1][0],W=C[1][1],Y=C[2][0],H=C[2][1],$=w((B[0][0]-P[0])/s),J=w(-(B[0][1]-P[1])/s),te=w((B[1][0]-P[0])/s),ce=w(-(B[1][1]-P[1])/s),he=w((B[2][0]-P[0])/s),ve=w(-(B[2][1]-P[1])/s),Re=k,Qe=z;k=0,z=0,G-=Re,W-=Qe,Y-=Re,H-=Qe;let Fe=[[G,W,0,0,te-$],[Y,H,0,0,he-$],[0,0,G,W,ce-J],[0,0,Y,H,ve-J]],mt=MW(Fe);if(!mt)return;if(y.save(),y.beginPath(),jde()||!f){y.moveTo(te,ce);let Ve=4,Ye=$-te,Mt=J-ce;for(let Et=0;Et<Ve;Et++)y.lineTo(te+w((Et+1)*Ye/Ve),ce+w(Et*Mt/(Ve-1))),Et!=Ve-1&&y.lineTo(te+w((Et+1)*Ye/Ve),ce+w((Et+1)*Mt/(Ve-1)));y.lineTo(he,ve)}else y.moveTo(te,ce),y.lineTo($,J),y.lineTo(he,ve);y.clip(),y.transform(mt[0],mt[2],mt[1],mt[3],$,J),y.translate(S[0]-Re,S[3]-Qe);let Ee;if(T)Ee=T.canvas,y.scale(I,-I);else{let Ve=l[0],Ye=Ve.extent;Ee=Ve.image,y.scale(Kn(Ye)/Ee.width,-Nr(Ye)/Ee.height)}y.drawImage(Ee,0,0),y.restore()}),T&&(lA(T),cA.push(T.canvas)),u&&(y.save(),y.globalCompositeOperation="source-over",y.strokeStyle="black",y.lineWidth=1,a.getTriangles().forEach(function(F,D,L){let C=F.target,B=(C[0][0]-P[0])/s,k=-(C[0][1]-P[1])/s,z=(C[1][0]-P[0])/s,G=-(C[1][1]-P[1])/s,W=(C[2][0]-P[0])/s,Y=-(C[2][1]-P[1])/s;y.beginPath(),y.moveTo(z,G),y.lineTo(B,k),y.lineTo(W,Y),y.closePath(),y.stroke()}),y.restore()),y.canvas}var Xde=[1,0,0,1,0,0],COe=new Array(6);function go(){return Xde.slice(0)}function Mj(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i}function jr(i,e){let t=e[0],n=e[1];return e[0]=i[0]*t+i[2]*n+i[4],e[1]=i[1]*t+i[3]*n+i[5],e}function No(i,e,t,n,r,s,o,a){let l=Math.sin(s),c=Math.cos(s);return i[0]=n*c,i[1]=r*l,i[2]=-n*l,i[3]=r*c,i[4]=o*n*c-a*n*l+e,i[5]=o*r*l+a*r*c+t,i}function dE(i,e){let t=$de(e);jn(t!==0,"Transformation matrix cannot be inverted");let n=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5];return i[0]=o/t,i[1]=-r/t,i[2]=-s/t,i[3]=n/t,i[4]=(s*l-o*a)/t,i[5]=-(n*l-r*a)/t,i}function $de(i){return i[0]*i[3]-i[1]*i[2]}var Yde=[1e5,1e5,1e5,1e5,2,2];function Cj(i){return"matrix("+i.join(", ")+")"}function fE(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function Rj(i,e){let t=fE(i),n=fE(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*Yde[r])!==0)return!1;return!0}var Zde=10,Pj=.25,sN=class{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={},c=a?ZW(I=>jr(a,J1(I,this.targetProj_,this.sourceProj_))):iA(this.targetProj_,this.sourceProj_);this.transformInv_=function(I){let P=I[0]+"/"+I[1];return l[P]||(l[P]=c(I)),l[P]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&Kn(r)>=Kn(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Kn(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Kn(this.targetProj_.getExtent()):null;let u=Pc(n),f=j1(n),d=W1(n),A=H1(n),y=this.transformInv_(u),w=this.transformInv_(f),S=this.transformInv_(d),T=this.transformInv_(A),R=Zde+(o?Math.max(0,Math.ceil(Math.log2(Sy(n)/(o*o*256*256)))):0);if(this.addQuad_(u,f,d,A,y,w,S,T,R),this.wrapsXInSource_){let I=1/0;this.triangles_.forEach(function(P,F,D){I=Math.min(I,P.source[0][0],P.source[1][0],P.source[2][0])}),this.triangles_.forEach(P=>{if(Math.max(P.source[0][0],P.source[1][0],P.source[2][0])-I>this.sourceWorldWidth_/2){let F=[[P.source[0][0],P.source[0][1]],[P.source[1][0],P.source[1][1]],[P.source[2][0],P.source[2][1]]];F[0][0]-I>this.sourceWorldWidth_/2&&(F[0][0]-=this.sourceWorldWidth_),F[1][0]-I>this.sourceWorldWidth_/2&&(F[1][0]-=this.sourceWorldWidth_),F[2][0]-I>this.sourceWorldWidth_/2&&(F[2][0]-=this.sourceWorldWidth_);let D=Math.min(F[0][0],F[1][0],F[2][0]);Math.max(F[0][0],F[1][0],F[2][0])-D<this.sourceWorldWidth_/2&&(P.source=F)}})}l={}}addTriangle_(e,t,n,r,s,o){this.triangles_.push({source:[r,s,o],target:[e,t,n]})}addQuad_(e,t,n,r,s,o,a,l,c){let u=ED([s,o,a,l]),f=this.sourceWorldWidth_?Kn(u)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,A=this.sourceProj_.canWrapX()&&f>.5&&f<1,y=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){let S=ED([e,t,n,r]);y=Kn(S)/this.targetWorldWidth_>Pj||y}!A&&this.sourceProj_.isGlobal()&&f&&(y=f>Pj||y)}if(!y&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!Ar(u,this.maxSourceExtent_))return;let w=0;if(!y&&(!isFinite(s[0])||!isFinite(s[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(c>0)y=!0;else if(w=(!isFinite(s[0])||!isFinite(s[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),w!=1&&w!=2&&w!=4&&w!=8)return}if(c>0){if(!y){let S=[(e[0]+n[0])/2,(e[1]+n[1])/2],T=this.transformInv_(S),R;A?R=(fh(s[0],d)+fh(a[0],d))/2-fh(T[0],d):R=(s[0]+a[0])/2-T[0];let I=(s[1]+a[1])/2-T[1];y=R*R+I*I>this.errorThresholdSquared_}if(y){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){let S=[(t[0]+n[0])/2,(t[1]+n[1])/2],T=this.transformInv_(S),R=[(r[0]+e[0])/2,(r[1]+e[1])/2],I=this.transformInv_(R);this.addQuad_(e,t,S,R,s,o,T,I,c-1),this.addQuad_(R,S,n,r,I,T,a,l,c-1)}else{let S=[(e[0]+t[0])/2,(e[1]+t[1])/2],T=this.transformInv_(S),R=[(n[0]+r[0])/2,(n[1]+r[1])/2],I=this.transformInv_(R);this.addQuad_(e,S,R,r,s,T,I,l,c-1),this.addQuad_(S,t,n,R,T,o,a,I,c-1)}return}}if(A){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(w&11)==0&&this.addTriangle_(e,n,r,s,a,l),(w&14)==0&&this.addTriangle_(e,n,t,s,a,o),w&&((w&13)==0&&this.addTriangle_(t,r,e,o,l,s),(w&7)==0&&this.addTriangle_(t,r,n,o,l,a))}calculateSourceExtent(){let e=Wr();return this.triangles_.forEach(function(t,n,r){let s=t.source;Qm(e,s[0]),Qm(e,s[1]),Qm(e,s[2])}),e}getTriangles(){return this.triangles_}},Ij=sN;var oN=class extends sv{constructor(e,t,n,r,s,o,a,l,c,u,f,d){super(s,an.IDLE,d),this.renderEdges_=f!==void 0?f:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=r,this.wrappedTileCoord_=o||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;let A=r.getTileCoordExtent(this.wrappedTileCoord_),y=this.targetTileGrid_.getExtent(),w=this.sourceTileGrid_.getExtent(),S=y?uh(A,y):A;if(Sy(S)===0){this.state=an.EMPTY;return}let T=e.getExtent();T&&(w?w=uh(w,T):w=T);let R=r.getResolution(this.wrappedTileCoord_[0]),I=Tj(e,n,S,R);if(!isFinite(I)||I<=0){this.state=an.EMPTY;return}let P=u!==void 0?u:.5;if(this.triangulation_=new Ij(e,n,S,w,I*P,R),this.triangulation_.getTriangles().length===0){this.state=an.EMPTY;return}this.sourceZ_=t.getZForResolution(I);let F=this.triangulation_.calculateSourceExtent();if(w&&(e.canWrapX()?(F[1]=Si(F[1],w[1],w[3]),F[3]=Si(F[3],w[1],w[3])):F=uh(F,w)),!Sy(F))this.state=an.EMPTY;else{let D=0,L=0;e.canWrapX()&&(D=Kn(T),L=Math.floor((F[0]-T[0])/D)),WT(F.slice(),e,!0).forEach(B=>{let k=t.getTileRangeForExtentAndZ(B,this.sourceZ_);for(let z=k.minX;z<=k.maxX;z++)for(let G=k.minY;G<=k.maxY;G++){let W=L*D;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,z,G,a),offset:W})}++L}),this.sourceTiles_.length===0&&(this.state=an.EMPTY)}}getImage(){return this.canvas_}reproject_(){let e=[];if(this.sourceTiles_.forEach(t=>{let n=t.tile;if(n&&n.getState()==an.LOADED){let r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=t.offset,r[2]+=t.offset;let s=this.clipExtent_?.slice();s&&(s[0]+=t.offset,s[2]+=t.offset),e.push({extent:r,clipExtent:s,image:n.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=an.ERROR;else{let t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),r=typeof n=="number"?n:n[0],s=typeof n=="number"?n:n[1],o=this.targetTileGrid_.getResolution(t),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Ej(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=an.LOADED}this.changed()}load(){for(let e of this.sourceTiles_)e.tile=e.getTile();if(this.state==an.IDLE){this.state=an.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{let n=t.getState();if(n==an.IDLE||n==an.LOADING){e++;let r=qn(t,nn.CHANGE,s=>{let o=t.getState();(o==an.LOADED||o==an.ERROR||o==an.EMPTY)&&(li(r),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(r)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},n,r){t.getState()==an.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(li),this.sourcesListenerKeys_=null}release(){this.canvas_&&(lA(this.canvas_.getContext("2d")),cA.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},pE=oN;var Kde=/\{z\}/g,Qde=/\{x\}/g,Jde=/\{y\}/g,epe=/\{-y\}/g;function Lj(i,e,t,n,r){return i.replace(Kde,e.toString()).replace(Qde,t.toString()).replace(Jde,n.toString()).replace(epe,function(){if(r===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(r-n).toString()})}function Dj(i){let e=[],t=/\{([a-z])-([a-z])\}/.exec(i);if(t){let n=t[1].charCodeAt(0),r=t[2].charCodeAt(0),s;for(s=n;s<=r;++s)e.push(i.replace(t[0],String.fromCharCode(s)));return e}if(t=/\{(\d+)-(\d+)\}/.exec(i),t){let n=parseInt(t[2],10);for(let r=parseInt(t[1],10);r<=n;r++)e.push(i.replace(t[0],r.toString()));return e}return e.push(i),e}function tpe(i,e){return(function(t,n,r){if(!t)return;let s,o=t[0];if(e){let a=e.getFullTileRange(o);a&&(s=a.getHeight()-1)}return Lj(i,o,t[1],t[2],s)})}function Nj(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=tpe(i[r],e);return npe(n)}function npe(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;let r=lj(e),s=fh(r,i.length);return i[s](e,t,n)})}var xu={PROPERTYCHANGE:"propertychange"};var ov=class extends Cp{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(nn.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){let n=e.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=qn(this,e[s],t);return r}return qn(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){let r=e.length;n=new Array(r);for(let s=0;s<r;++s)n[s]=rv(this,e[s],t)}else n=rv(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)ipe(n);else if(Array.isArray(e))for(let r=0,s=e.length;r<s;++r)this.removeEventListener(e[r],t);else this.removeEventListener(e,t)}};ov.prototype.on;ov.prototype.once;ov.prototype.un;function ipe(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)li(i[e]);else li(i)}var mE=ov;var AE=class extends Ao{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},aN=class extends mE{constructor(e){super(),this.on,this.once,this.un,Bn(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new AE(n,e,t)),n=xu.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new AE(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){let r=this.values_||(this.values_={});if(n)r[e]=t;else{let s=r[e];r[e]=t,s!==t&&this.notify(e,s)}}setProperties(e,t){for(let n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){let n=this.values_[e];delete this.values_[e],Au(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},Us=aN;var lN=class extends Us{constructor(e){super(),this.projection=Os(e.projection),this.attributions_=Fj(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible??!0,this.loading=!1,this.state_=e.state!==void 0?e.state:"ready",this.wrapX_=e.wrapX!==void 0?e.wrapX:!1,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;let t=this;this.viewPromise_=new Promise(function(n,r){t.viewResolver=n,t.viewRejector=r})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}ready(){let e=this.getState();return e==="ready"?Promise.resolve():e==="error"?Promise.reject(new Error("Source failed to load")):new Promise((t,n)=>{let r=()=>{let s=this.getState();s==="ready"?(this.un("change",r),t()):s==="error"&&(this.un("change",r),n(new Error("Source failed to load")))};this.on("change",r)})}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=Fj(e),this.changed()}setState(e){this.state_=e,this.changed()}};function Fj(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}var gE=lN;var cN=class extends gE{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio!==void 0?e.tilePixelRatio:1,this.tileGrid=e.tileGrid!==void 0?e.tileGrid:null;let t=[256,256];this.tileGrid&&cs(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||Bn(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){let t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,n,r,s,o){return ei()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:oE(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=cs(r.getTileSize(e),this.tmpSize);return s==1?o:JW(o,s,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){let n=t!==void 0?t:this.getProjection(),r=t!==void 0?this.getTileGridForProjection(n):this.tileGrid||this.getTileGridForProjection(n);return this.getWrapX()&&n.isGlobal()&&(e=hj(r,e,n)),cj(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},vE=class extends Ao{constructor(e,t){super(e),this.tile=t}},Bj=cN;var _E={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var uN=class i extends Bj{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===i.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){let t=e.target,n=Bn(t),r=t.getState(),s;r==an.LOADING?(this.tileLoadingKeys_[n]=!0,s=_E.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==an.ERROR?_E.TILELOADERROR:r==an.LOADED?_E.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new vE(s,t))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,typeof t<"u"?this.setKey(t):this.changed()}setUrl(e){let t=Dj(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`3+`);this.generateTileUrlFunction_?this.setTileUrlFunction(Nj(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},Oj=uN;var hN=class extends Oj{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:rpe,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate!==void 0?e.interpolate:!0,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy=e.referrerPolicy,this.tileClass=e.tileClass!==void 0?e.tileClass:hE,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!Q1(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getTileGridForProjection(e){let t=this.getProjection();if(this.tileGrid&&(!t||Q1(t,e)))return this.tileGrid;let n=Bn(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=oE(e)),this.tileGridForProjection[n]}createTile_(e,t,n,r,s,o){let a=[e,t,n],l=this.getTileCoordForTileUrlFunction(a,s),c=l?this.tileUrlFunction(l,r,s):void 0,u=new this.tileClass(a,c!==void 0?an.IDLE:an.EMPTY,c!==void 0?c:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return u.key=o,u.addEventListener(nn.CHANGE,this.handleTileChange.bind(this)),u}getTile(e,t,n,r,s,o){let a=this.getProjection();if(!a||!s||Q1(a,s))return this.getTileInternal(e,t,n,r,a||s);let l=[e,t,n],c=this.getKey(),u=this.getTileGridForProjection(a),f=this.getTileGridForProjection(s),d=this.getTileCoordForTileUrlFunction(l,s),A=new pE(a,u,s,f,l,d,this.getTilePixelRatio(r),this.getGutter(),(y,w,S,T)=>this.getTileInternal(y,w,S,T,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return A.key=c,A}getTileInternal(e,t,n,r,s,o){let a=this.getKey(),l=nv(this,a,e,t,n);if(o&&o.containsKey(l))return o.get(l);let c=this.createTile_(e,t,n,r,s,a);return o?.set(l,c),c}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){let n=Os(e);if(n){let r=Bn(n);r in this.tileGridForProjection||(this.tileGridForProjection[r]=t)}}};function rpe(i,e){if(no){let t=i.getCrossOrigin(),n="same-origin",r="same-origin";t==="anonymous"||t===""?(n="cors",r="omit"):t==="use-credentials"&&(n="cors",r="include");let s={mode:n,credentials:r,referrerPolicy:i.getReferrerPolicy()};fetch(e,s).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.blob()}).then(o=>createImageBitmap(o)).then(o=>{let a=i.getImage();a.width=o.width,a.height=o.height,a.getContext("2d").drawImage(o,0,0),o.close?.(),a.dispatchEvent(new Event("load"))}).catch(()=>{i.getImage().dispatchEvent(new Event("error"))});return}i.getImage().src=e}var Uj=hN;var fN=class extends Uj{constructor(e){e=e||{};let t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:fj({extent:aE(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,referrerPolicy:e.referrerPolicy,interpolate:e.interpolate,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}},kj=fN;function Wl(){if(!O.world||!O.lens||O.settling)return;let i=O.engine?.getView();try{let e=zj();e.last=O.volume.slug,e.volumes[O.volume.slug]={volume:O.volume.slug,world:O.world.slug,lens:O.world.lenses.indexOf(O.lens),center:i?.getCenter(),zoom:i?.getZoom(),hidden:[...O.hiddenCollections],collapsed:[...O.collapsedSections],expanded:[...O.expandedCollections],labels:[...O.labelOverrides],overviewDocked:O.overviewDocked,dockFolded:O.dockFolded,dockDismissed:O.dockDismissed},localStorage.setItem(IL,JSON.stringify(e))}catch{}}function zj(){try{let i=JSON.parse(localStorage.getItem(IL)||"null");if(i&&i.volumes)return i}catch{}return{last:"",volumes:{}}}function av(i){let e=zj(),t=i||e.last,n=t&&e.volumes[t];return n&&n.volume&&n.world?n:null}function lv(){let[i,e]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(t=>t.trim());return{volume:i,world:e}}function Vj(){if(!O.volume||!O.world)return;let i=`#${O.volume.slug}/${O.world.slug}`;location.hash!==i&&history.replaceState(null,"",i)}var dN=class i extends Us{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e)if(typeof e.getSimplifiedGeometry=="function"){let t=e;this.setGeometry(t)}else{let t=e;this.setProperties(t)}}clone(){let e=new i,t=this.geometryName_;e.setGeometryName(t);let n=this.getPropertiesInternal();if(n){let s=this.getGeometry();for(let o in n)o===t&&s?e.set(o,s.clone()):e.set(o,n[o],!0)}let r=this.getStyle();return r&&e.setStyle(r),e}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(li(this.geometryChangeKey_),this.geometryChangeKey_=null);let e=this.getGeometry();e&&(this.geometryChangeKey_=qn(e,nn.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?spe(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){e!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}};function spe(i){if(typeof i=="function")return i;let e;return Array.isArray(i)?e=i:(jn(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[i]),function(){return e}}var Rp=dN;function ml(i,e,t,n,r,s,o){s=s||[],o=o||2;let a=0;for(let l=e;l<t;l+=n){let c=i[l],u=i[l+1];s[a++]=r[0]*c+r[2]*u+r[4],s[a++]=r[1]*c+r[3]*u+r[5];for(let f=2;f<o;f++)s[a++]=i[l+f]}return s&&s.length!=a&&(s.length=a),s}function xE(i,e,t,n,r,s,o){o=o||[];let a=Math.cos(r),l=Math.sin(r),c=s[0],u=s[1],f=0;for(let d=e;d<t;d+=n){let A=i[d]-c,y=i[d+1]-u;o[f++]=c+A*a-y*l,o[f++]=u+A*l+y*a;for(let w=d+2;w<d+n;++w)o[f++]=i[w]}return o&&o.length!=f&&(o.length=f),o}function Gj(i,e,t,n,r,s,o,a){a=a||[];let l=o[0],c=o[1],u=0;for(let f=e;f<t;f+=n){let d=i[f]-l,A=i[f+1]-c;a[u++]=l+r*d,a[u++]=c+s*A;for(let y=f+2;y<f+n;++y)a[u++]=i[y]}return a&&a.length!=u&&(a.length=u),a}function qj(i,e,t,n,r,s,o){o=o||[];let a=0;for(let l=e;l<t;l+=n){o[a++]=i[l]+r,o[a++]=i[l+1]+s;for(let c=l+2;c<l+n;++c)o[a++]=i[c]}return o&&o.length!=a&&(o.length=a),o}var Hj=go(),ope=[NaN,NaN],pN=class extends Us{constructor(){super(),this.extent_=Wr(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=lE((e,t,n)=>{if(!n)return this.getSimplifiedGeometry(t);let r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return ei()}closestPointXY(e,t,n,r){return ei()}containsXY(e,t){return this.closestPointXY(e,t,ope,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t=t||[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return ei()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Zm(t),this.extentRevision_=this.getRevision()}return yW(this.extent_,e)}rotate(e,t){ei()}scale(e,t,n){ei()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return ei()}getType(){return ei()}applyTransform(e){ei()}intersectsExtent(e){return ei()}translate(e,t){ei()}transform(e,t){let n=Os(e),r=n.getUnits()=="tile-pixels"?function(s,o,a){let l=n.getExtent(),c=n.getWorldExtent(),u=Nr(c)/Nr(l);No(Hj,c[0],c[3],u,-u,0,0,0);let f=ml(s,0,s.length,a,Hj,o),d=iA(n,t);return d?d(f,f,a):f}:iA(n,t);return this.applyTransform(r),this}},Wj=pN;var mN=class extends Wj{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return q1(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return ei()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=jj(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){ei()}setLayout(e,t,n){let r;if(e)r=jj(e);else{for(let s=0;s<n;++s){if(t.length===0){this.layout="XY",this.stride=2;return}t=t[0]}r=t.length,e=ape(r)}this.layout=e,this.stride=r}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();xE(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=dl(this.getExtent()));let r=this.getFlatCoordinates();if(r){let s=this.getStride();Gj(r,0,r.length,s,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();qj(n,0,n.length,r,e,t,n),this.changed()}}};function ape(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function jj(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function Xj(i,e,t){let n=i.getFlatCoordinates();if(!n)return null;let r=i.getStride();return ml(n,0,n.length,r,e,t)}var Al=mN;function $j(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function uA(i,e,t,n){for(let r=0,s=t.length;r<s;++r){let o=t[r];for(let a=0;a<n;++a)i[e++]=o[a]}return e}function Dy(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=uA(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function Yj(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=Dy(i,e,t[o],n,r[s]);l.length===0&&(l[0]=e),r[s++]=l,e=l[l.length-1]}return r.length=s,r}var AN=class i extends Al{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){let s=this.flatCoordinates,o=pu(e,t,s[0],s[1]);if(o<r){let a=this.stride;for(let l=0;l<a;++l)n[l]=s[l];return n.length=a,o}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return GT(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return wy(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=$j(this.flatCoordinates,0,e,this.stride),this.changed()}},yu=AN;function hA(){return Vq[O.world?.iconOutset==="dark"?"dark":"light"]}function lpe(i){let e=O.world?.iconOutset==="dark",t=upe(i);return(e?t>.3:t<.88)?i:cpe(i,e?.74:.42)}function cpe(i,e){let t=String(i).replace("#","");if(t.length!==6)return i;let[n,r,s]=[0,2,4].map(I=>parseInt(t.slice(I,I+2),16)/255),o=Math.max(n,r,s),a=Math.min(n,r,s),l=(o+a)/2,c=0,u=o-a,f=u===0?0:u/(1-Math.abs(2*l-1));u!==0&&(o===n?c=(r-s)/u%6:o===r?c=(s-n)/u+2:c=(n-r)/u+4,c*=60,c<0&&(c+=360));let d=(1-Math.abs(2*e-1))*f,A=d*(1-Math.abs(c/60%2-1)),y=e-d/2,[w,S,T]=c<60?[d,A,0]:c<120?[A,d,0]:c<180?[0,d,A]:c<240?[0,A,d]:c<300?[A,0,d]:[d,0,A],R=I=>Math.round((I+y)*255).toString(16).padStart(2,"0");return`#${R(w)}${R(S)}${R(T)}`}function upe(i){let e=String(i).replace("#","");if(e.length!==6)return .5;let t=n=>parseInt(e.slice(n,n+2),16)/255;return .2126*t(0)+.7152*t(2)+.0722*t(4)}function cv(i){let e=Math.abs(Number(i)||0);return Wf[(Math.imul(e,2654435761)>>>0)%Wf.length]}function Dc(i,e){let t=String(i||"#ffffff").replace("#",""),n=t.length===3?t.split("").map(s=>s+s).join(""):t.slice(0,6).padEnd(6,"f"),r=Number.parseInt(n,16);return`rgba(${r>>16&255}, ${r>>8&255}, ${r&255}, ${e})`}function uv(i,e){i.style.setProperty("--pin-color",fA(e))}function fA(i){return lpe(i.color||cv(i.id))}function hv(i,e,t){if(i.classList.remove("has-source-icon"),i.style.removeProperty("--pin-icon"),i.textContent="",!e.iconAsset){i.textContent=t;return}i.style.setProperty("--pin-icon",`url("${gN(e.iconAsset)}")`),i.classList.add("has-source-icon")}function gN(i){let e=i.split("/").map(t=>encodeURIComponent(t)).join("/");return`${O.volume.base}/icons/${e}`}function bu(i){return i.split(/\s+/).slice(0,2).map(e=>e[0]||"").join("")}function Zj(i){return Math.imul(Number(i)||0,2654435761)>>>0}function vN(i){return String(i||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`44 5-`).trim()}function jl(i){return new Intl.NumberFormat().format(i)}function us(i,e,t){return Math.min(t,Math.max(e,i))}function SE(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var mpe=100;function sd(){if(!ge.searchResults)return;let i=[...O.features.filter(n=>!n.filteredHidden).map(n=>({title:n.location.title,pin:n})),...[...O.zoneRecords.values()].filter(n=>n.zone.title&&!Po(n.zone.collectionId)&&(!O.search||n.zone.title.toLocaleLowerCase().includes(O.search))).map(n=>({title:n.zone.title,record:n}))].sort((n,r)=>n.title.localeCompare(r.title)),e=i.slice(0,mpe),t=document.createDocumentFragment();if(!e.length){let n=document.createElement("p");n.className="search-empty",n.textContent=O.search?"No visible features match.":"Nothing is enabled. Show a collection to list its features.",t.append(n)}for(let n of e)t.append(n.pin?Ape(n.pin):gpe(n.record));if(i.length>e.length){let n=document.createElement("p");n.className="dock-note",n.textContent=`First ${e.length} of ${jl(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}ge.searchResults.replaceChildren(t),_pe(i.length),vpe()}function Ape(i){let e=document.createElement("button");e.type="button",e.className="search-result",O.selectedPin===i&&e.classList.add("is-selected"),e.dataset.location=String(i.location.id),hv(e,i.category);let t=document.createElement("span");t.className="result-dot",fv(t,i.category,Mu(i.category.title));let n=document.createElement("span"),r=document.createElement("strong");r.textContent=i.location.title;let s=document.createElement("small");return s.textContent=[i.category.title,i.category.group].filter(Boolean).join(" \xB7 "),n.append(r,s),e.append(t,n),e}function gpe(i){let e=document.createElement("button");e.type="button",e.className="search-result",O.selectedZone===i.zone&&e.classList.add("is-selected"),e.dataset.zone=String(i.zone.id);let t=document.createElement("span");t.className="result-dot",t.style.setProperty("background",i.color);let n=document.createElement("span"),r=document.createElement("strong");r.textContent=i.zone.title;let s=document.createElement("small");return s.textContent=i.collection?.title||"Zone",n.append(r,s),e.append(t,n),e}var Kj=28;function vpe(){let i=O.selectedPin?.location.title||"",e=i.length>Kj?`${i.slice(0,Kj-1).trimEnd()}\u2026`:i;ge.dockRailName.textContent=e?` \xB7 ${e}`:"",ge.dockRailName.hidden=!e}function _pe(i){ge.dockCount.textContent=`${jl(i)} ${i===1?"feature":"features"}`,O.search?(ge.dockFlag.textContent=`\u201C${O.search}\u201D`,ge.dockFlag.hidden=!1):O.hiddenCollections.size>0?(ge.dockFlag.textContent="filtered",ge.dockFlag.hidden=!1):ge.dockFlag.hidden=!0}function Fy(){!O.dockFolded||O.dockDismissed||TE(!1)}function bN(i){O.dockDismissed=i,TE(i)}function TE(i,e=!0){O.dockFolded=i,ge.dock.classList.toggle("is-folded",i),ge.dockFold.setAttribute("aria-expanded",String(!i));let t=i?"Bring the panel back (\u2318\u2325B)":"Put the panel away (\u2318\u2325B)";ge.dockFold.setAttribute("aria-label",t),ge.dockFold.setAttribute("title",t),e&&ml()}function TN(i){O.hiddenCollections.delete(i.category.id),pA(),Xl(),vh(),By(i,!0)}function By(i,e=!1){O.selectedPin=i,O.selectedZone=null,ge.detailCoordinatesField.hidden=!1,document.dispatchEvent(new Event("atlas:selection")),Oc(),O.layers.pins.changed(),O.layers.pinLabels.changed(),O.layers.text.changed(),O.layers.textDetail.changed(),O.layers.priority.changed(),ge.detailTitle.textContent=i.location.title,ge.detailCategory.textContent=[i.category.group,i.category.title].filter(Boolean).join(" / "),ge.detailDescription.textContent="",ge.detailLinks.hidden=!0,EN(),Cpe(i),ge.detailID.textContent=String(i.location.id),ge.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=Gq(i.coordinate);ge.detailCell.textContent=t,ge.detailCellField.hidden=!t;for(let r of ge.detail.querySelectorAll("[data-cell-system-row]"))r.remove();for(let r of wy(O.world)){if(r.slug==="geohash")continue;let s=r.locate(i.coordinate,O.world);if(!s)continue;let o=document.createElement("div");o.dataset.cellSystemRow=r.slug;let a=document.createElement("dt");a.textContent=s.label;let l=document.createElement("dd");l.textContent=s.value,o.append(a,l),ge.detailCellField.after(o)}let n=Mpe(i);if(ge.detailSource.textContent=n,ge.detailSourceField.hidden=!n,hv(ge.detailDot,i.category),fv(ge.detailDot,i.category,Mu(i.category.title)),ge.detail.hidden=!1,Fy(),sd(),e){let r=O.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(_h(O.lens),Math.max(r.getZoom()||0,4)),duration:220})}}function EE(i){O.selectedPin=null,O.selectedZone=i,document.dispatchEvent(new Event("atlas:selection")),Oc(),O.layers.pins.changed(),O.layers.priority.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed();let e=V1(i);ge.detailTitle.textContent=i.title,ge.detailCategory.textContent=[e?.group,e?.title].filter(Boolean).join(" / ")||i.subtitle||"Zone",ge.detailDescription.textContent="",ge.detailLinks.hidden=!0,ge.detailLinks.replaceChildren(),ge.detailID.textContent=String(i.id),ge.detailCoordinatesField.hidden=!0,ge.detailCellField.hidden=!0;for(let n of ge.detail.querySelectorAll("[data-cell-system-row]"))n.remove();let t=O.world?.merged?.find(n=>n.origin)?.source||"";ge.detailSource.textContent=t,ge.detailSourceField.hidden=!t,ge.detailDot.textContent="",ge.detailDot.removeAttribute("style"),ge.detailDot.style.setProperty("background",uv(i.id)),EN(),Qj([...xpe(i,e),...ED(i.attrs)]),i.hasText?Epe(i):ge.detailDescription.textContent="No description is included in the archive.",ge.detail.hidden=!1,Fy(),sd()}function xpe(i,e){let t=O.zoneRecords.get(i.id);if(!t||!e)return[];let n=[],r=yy(O.world);if(e.kind==="area"){if(r){let o=t.geometries.reduce((a,l)=>a+bpe(l,r),0);o>0&&n.push({label:"Area",value:Spe(o)})}let s=O.features.filter(o=>!o.filteredHidden&&Oy(o.location)&&t.geometries.some(a=>TD(a,o.coordinate))).length;n.push({label:"Locations inside",value:jl(s)})}if(e.kind==="path"&&r){let s=t.geometries.reduce((o,a)=>o+wpe(a,r),0);s>0&&n.push({label:"Length",value:Tpe(s)})}return n}var wN=110.574;function SN(i,[e,t]){return i.toLatLng(e,-t)}function ype(i,e){let t=i.map(o=>SN(e,o));if(t.length<3)return 0;let n=t.reduce((o,a)=>o+a[0],0)/t.length,r=111.32*Math.cos(n*Math.PI/180),s=0;for(let o=0,a=t.length-1;o<t.length;a=o++){let[l,c]=t[a],[u,f]=t[o];s+=c*r*u*wN-f*r*l*wN}return Math.abs(s)/2}function bpe(i,e){let t=i.getType()==="MultiPolygon"?i.getPolygons():i.getType()==="Polygon"?[i]:[],n=0;for(let r of t)r.getLinearRings().forEach((s,o)=>{let a=ype(s.getCoordinates(),e);n+=o===0?a:-a});return Math.max(0,n)}function wpe(i,e){let t=i.getType()==="MultiLineString"?i.getCoordinates():i.getType()==="LineString"?[i.getCoordinates()]:[],n=0;for(let r of t)for(let s=1;s<r.length;s++){let[o,a]=SN(e,r[s-1]),[l,c]=SN(e,r[s]),u=(o+l)/2*(Math.PI/180),f=(c-a)*111.32*Math.cos(u),d=(l-o)*wN;n+=Math.hypot(f,d)}return n}function Spe(i){return`${i>=10?jl(Math.round(i)):i.toFixed(2)} km\xB2`}function Tpe(i){return i<1?`${Math.round(i*1e3)} m`:`${i>=10?jl(Math.round(i)):i.toFixed(1)} km`}function EN(){for(let i of ge.detail.querySelectorAll("[data-feature-row]"))i.remove()}function Qj(i){let e=ge.detailSourceField;for(let t of i){let n=document.createElement("div");n.dataset.featureRow="";let r=document.createElement("dt");r.textContent=t.label;let s=document.createElement("dd");s.textContent=t.value,n.append(r,s),e.after(n),e=n}}async function Epe(i){let e=await MN();if(O.selectedZone!==i)return;let t=e[String(i.id)]||{};ge.detailDescription.textContent=yN(t.d)||"No description is included in the archive."}function Mpe(i){let e=O.world?.merged;if(!e?.length)return"";let t=e.find(n=>n.origin)?.source||"";if(O.pinSourceIndex?.world!==O.world){let n=new Map;for(let r of e){for(let s of r.adopted||[])n.set(s.d,r.source);for(let s of r.matched||[]){let o=`confirmed by ${r.source}`;n.set(s.w,t?`${t} \xB7 ${o}`:o)}}O.pinSourceIndex={world:O.world,byID:n}}for(let n of e)if(!n.origin&&i.category.group===n.source)return n.source;return O.pinSourceIndex.byID.get(i.location.id)||t}async function Cpe(i){let e=await MN();if(O.selectedPin!==i)return;let t=e[String(i.location.id)]||{};i.location.description=t.d||"",i.location.links=t.l||[],ge.detailDescription.textContent=yN(t.d)||"No description is included in the archive.",EN(),Qj(ED(t.a)),Rpe(i)}function Rpe(i){let e=(i.location.links||[]).filter(n=>O.featureByID.has(n.locationId));if(ge.detailLinks.hidden=e.length===0,!e.length){ge.detailLinks.replaceChildren();return}let t=document.createDocumentFragment();for(let n of e){let r=document.createElement("button");r.type="button",r.className="detail-link",r.dataset.location=String(n.locationId),r.textContent=n.title,t.append(r)}ge.detailLinks.replaceChildren(t)}function od(){let i=O.selectedPin!==null||O.selectedZone!==null;O.selectedPin=null,O.selectedZone=null,document.dispatchEvent(new Event("atlas:selection")),O.sources&&(Oc(),O.layers.pins.changed(),O.layers.pinLabels.changed(),O.layers.text.changed(),O.layers.textDetail.changed(),O.layers.priority.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed()),ge.detail.hidden=!0,i&&sd()}function Uc(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=e;o<t;o+=n)r[s++]=i.slice(o,o+n);return r.length=s,r}function Dp(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o];r[s++]=Uc(i,e,l,n,r[s]),e=l}return r.length=s,r}function Uy(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o];r[s++]=l.length===1&&l[0]===e?[]:Dp(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}var CN=class i extends gl{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Do(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){if(r<Lc(this.getExtent(),e,t))return r;let s=this.flatCoordinates,o=this.stride;for(let a=0,l=s.length;a<l;a+=o){let c=_u(e,t,s[a],s[a+1]);if(c<r){r=c;for(let u=0;u<o;++u)n[u]=s[a+u];n.length=o}}return r}getCoordinates(){return Uc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Eu(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){let e=this.flatCoordinates,t=this.layout,n=this.stride,r=[];for(let s=0,o=e.length;s<o;s+=n){let a=new Eu(e.slice(s,s+n),t);r.push(a)}return r}getType(){return"MultiPoint"}intersectsExtent(e){let t=this.flatCoordinates,n=this.stride;for(let r=0,s=t.length;r<s;r+=n){let o=t[r],a=t[r+1];if(Sy(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=hA(this.flatCoordinates,0,e,this.stride),this.changed()}},Jj=CN;function RN(i,e,t,n){let r=0,s=i[t-n],o=i[t-n+1],a=0,l=0;for(;e<t;e+=n){let c=i[e]-s,u=i[e+1]-o;r+=l*c-a*u,a=c,l=u}return r/2}function IN(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=RN(i,e,a,n),e=a}return r}function eX(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=IN(i,e,a,n),e=a[a.length-1]}return r}function tX(i,e,t,n,r,s,o){let a=i[e],l=i[e+1],c=i[t]-a,u=i[t+1]-l,f;if(c===0&&u===0)f=e;else{let d=((r-a)*c+(s-l)*u)/(c*c+u*u);if(d>1)f=t;else if(d>0){for(let A=0;A<n;++A)o[A]=Lo(i[e+A],i[t+A],d);o.length=n;return}else f=e}for(let d=0;d<n;++d)o[d]=i[f+d];o.length=n}function ky(i,e,t,n,r){let s=i[e],o=i[e+1];for(e+=n;e<t;e+=n){let a=i[e],l=i[e+1],c=_u(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function zy(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=ky(i,e,a,n,r),e=a}return r}function nX(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=zy(i,e,a,n,r),e=a[a.length-1]}return r}function Vy(i,e,t,n,r,s,o,a,l,c,u){if(e==t)return c;let f,d;if(r===0){if(d=_u(o,a,i[e],i[e+1]),d<c){for(f=0;f<n;++f)l[f]=i[e+f];return l.length=n,d}return c}u=u||[NaN,NaN];let A=e+n;for(;A<t;)if(tX(i,A-n,A,n,o,a,u),d=_u(o,a,u[0],u[1]),d<c){for(c=d,f=0;f<n;++f)l[f]=u[f];l.length=n,A+=n}else A+=n*Math.max((Math.sqrt(d)-Math.sqrt(c))/r|0,1);if(s&&(tX(i,t-n,e,n,o,a,u),d=_u(o,a,u[0],u[1]),d<c)){for(c=d,f=0;f<n;++f)l[f]=u[f];l.length=n}return c}function Gy(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,d=t.length;f<d;++f){let A=t[f];c=Vy(i,e,A,n,r,s,o,a,l,c,u),e=A}return c}function iX(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,d=t.length;f<d;++f){let A=t[f];c=Gy(i,e,A,n,r,s,o,a,l,c,u),e=A[A.length-1]}return c}function mA(i,e,t,n,r,s,o){let a=(t-e)/n;if(a<3){for(;e<t;e+=n)s[o++]=i[e],s[o++]=i[e+1];return o}let l=new Array(a);l[0]=1,l[a-1]=1;let c=[e,t-n],u=0;for(;c.length>0;){let f=c.pop(),d=c.pop(),A=0,y=i[d],w=i[d+1],S=i[f],T=i[f+1];for(let R=d+n;R<f;R+=n){let P=i[R],I=i[R+1],F=EW(P,I,y,w,S,T);F>A&&(u=R,A=F)}A>r&&(l[(u-e)/n]=1,d+n<u&&c.push(d,u),u+n<f&&c.push(u,f))}for(let f=0;f<a;++f)l[f]&&(s[o++]=i[e+f*n],s[o++]=i[e+f*n+1]);return o}function ME(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=mA(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Np(i,e){return e*Math.round(i/e)}function Ipe(i,e,t,n,r,s,o){if(e==t)return o;let a=Np(i[e],r),l=Np(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,u;do if(c=Np(i[e],r),u=Np(i[e+1],r),e+=n,e==t)return s[o++]=c,s[o++]=u,o;while(c==a&&u==l);for(;e<t;){let f=Np(i[e],r),d=Np(i[e+1],r);if(e+=n,f==c&&d==u)continue;let A=c-a,y=u-l,w=f-a,S=d-l;if(A*S==y*w&&(A<0&&w<A||A==w||A>0&&w>A)&&(y<0&&S<y||y==S||y>0&&S>y)){c=f,u=d;continue}s[o++]=c,s[o++]=u,a=c,l=u,c=f,u=d}return s[o++]=c,s[o++]=u,o}function qy(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=Ipe(i,e,u,n,r,s,o),a.push(o),e=u}return o}function rX(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l],f=[];o=qy(i,e,u,n,r,s,o,f),a.push(f),e=u[u.length-1]}return o}var PN=class i extends gl{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new i(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,n,r){return r<Lc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ky(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Vy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return RN(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Uc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=mA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return aA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=hA(this.flatCoordinates,0,e,this.stride),this.changed()}},LN=PN;function Hy(i,e,t,n,r,s,o){let a,l,c,u,f,d,A,y=r[s+1],w=[];for(let R=0,P=t.length;R<P;++R){let I=t[R];for(u=i[I-n],d=i[I-n+1],a=e;a<I;a+=n)f=i[a],A=i[a+1],(y<=d&&A<=y||d<=y&&y<=A)&&(c=(y-d)/(A-d)*(f-u)+u,w.push(c)),u=f,d=A}let S=NaN,T=-1/0;for(w.sort(pl),u=w[0],a=1,l=w.length;a<l;++a){f=w[a];let R=Math.abs(f-u);R>T&&(c=(u+f)/2,Py(i,e,t,n,c,y)&&(S=c,T=R)),u=f}return isNaN(S)&&(S=r[s]),o?(o.push(S,y,T),o):[S,y,T]}function CE(i,e,t,n,r){let s=[];for(let o=0,a=t.length;o<a;++o){let l=t[o];s=Hy(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function sX(i,e,t,n){for(;e<t-n;){for(let r=0;r<n;++r){let s=i[e+r];i[e+r]=i[t-n+r],i[t-n+r]=s}e+=n,t-=n}}function DN(i,e,t,n){let r=0,s=i[t-n],o=i[t-n+1];for(;e<t;e+=n){let a=i[e],l=i[e+1];r+=(a-s)*(l+o),s=a,o=l}return r===0?void 0:r>0}function NN(i,e,t,n,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){let a=t[s],l=DN(i,e,a,n);if(s===0){if(r&&l||!r&&!l)return!1}else if(r&&!l||!r&&l)return!1;e=a}return!0}function oX(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(!NN(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function RE(i,e,t,n,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){let a=t[s],l=DN(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&sX(i,e,a,n),e=a}return e}function FN(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s)e=RE(i,e,t[s],n,r);return e}function aX(i,e){let t=[],n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){let l=e[o],c=DN(i,n,l,2);if(s===void 0&&(s=c),c===s)t.push(e.slice(r,o+1));else{if(t.length===0)continue;t[t.length-1].push(e[r])}r=o+1,n=l}return t}var IE=class i extends gl{constructor(e,t,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&n?(this.setFlatCoordinates(t,e),this.ends_=n):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?Do(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<Lc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(zy(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Gy(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return Py(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return IN(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),RE(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,Dp(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=dl(this.getExtent());this.flatInteriorPoint_=Hy(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Eu(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new LN(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){let e=this.layout,t=this.flatCoordinates,n=this.ends_,r=[],s=0;for(let o=0,a=n.length;o<a;++o){let l=n[o],c=new LN(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;NN(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=RE(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=qy(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return $D(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=Ny(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},xh=IE;function BN(i){if(mh(i))throw new Error("Cannot create polygon from empty extent");let e=i[0],t=i[1],n=i[2],r=i[3],s=[e,t,e,r,n,r,n,t,e,t];return new IE(s,"XY",[s.length])}function PE(i,e,t,n){let r=[],s=jr();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=H1(i,e,l[0],n),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),e=l[l.length-1]}return r}var ON=class i extends gl{constructor(e,t,n){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!n&&!Array.isArray(e[0])){let r=e,s=[],o=[];for(let a=0,l=r.length;a<l;++a){let c=r[a],u=s.length,f=c.getEnds();for(let d=0,A=f.length;d<A;++d)f[d]+=u;Do(s,c.getFlatCoordinates()),o.push(f)}t=r.length===0?this.getLayout():r[0].getLayout(),e=s,n=o}t!==void 0&&n?(this.setFlatCoordinates(t,e),this.endss_=n):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{let n=this.flatCoordinates.length;Do(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let r=0,s=t.length;r<s;++r)t[r]+=n}this.endss_.push(t),this.changed()}clone(){let e=this.endss_.length,t=new Array(e);for(let r=0;r<e;++r)t[r]=this.endss_[r].slice();let n=new i(this.flatCoordinates.slice(),this.layout,t);return n.applyProperties(this),n}closestPointXY(e,t,n,r){return r<Lc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(nX(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),iX(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return sj(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return eX(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),FN(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,Uy(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=PE(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=CE(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Jj(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;oX(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=FN(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=rX(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{let s=this.endss_[e-1];t=s[s.length-1]}let n=this.endss_[e].slice(),r=n[n.length-1];if(t!==0)for(let s=0,o=n.length;s<o;++s)n[s]-=t;return new xh(this.flatCoordinates.slice(t,r),this.layout,n)}getPolygons(){let e=this.layout,t=this.flatCoordinates,n=this.endss_,r=[],s=0;for(let o=0,a=n.length;o<a;++o){let l=n[o].slice(),c=l[l.length-1];if(s!==0)for(let f=0,d=l.length;f<d;++f)l[f]-=s;let u=new xh(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return aj(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=Yj(this.flatCoordinates,0,e,this.stride,this.endss_);if(n.length===0)this.flatCoordinates.length=0;else{let r=n[n.length-1];this.flatCoordinates.length=r.length===0?0:r[r.length-1]}this.changed()}},LE=ON;function lX(i){return i.key.toLocaleLowerCase()==="g"?(i.preventDefault(),cX(),O.gridEnabled?(ge.gridInput.focus(),ge.gridInput.select()):ge.viewport.focus({preventScroll:!0}),!0):i.key===" "&&O.gridEnabled&&i.target!==ge.subgridToggle?(i.preventDefault(),Wy(!O.subgridVisible),!0):i.key==="Escape"&&O.gridEnabled?(i.preventDefault(),UN(),!0):!1}function cX(i=!O.gridEnabled){O.gridEnabled=i,i&&Wy(!0),jy(),Oc(),O.layers.pins.changed(),O.layers.text.changed(),O.layers.priority.changed()}function Wy(i){O.subgridVisible=i,O.layers.grid.changed(),O.layers.gridContext.changed(),ge.subgridToggle.setAttribute("aria-pressed",String(i)),ge.subgridToggle.setAttribute("aria-label",i?"Hide the subgrid":"Show the subgrid"),uX(),document.dispatchEvent(new Event("atlas:grid"))}function uX(){if(!O.gridEnabled){ge.gridHint.textContent="G \xB7 grid off";return}ge.gridHint.textContent=`G-${O.gridCell||"root"}`+(O.subgridVisible?"":" no subgrid")}function AA(i){let e=Ts(),t=e.parseInput(e.normalizeInput(i));if(t===null)return;let n=t!==O.gridCell;O.gridCell=t,O.gridEnabled||(O.gridEnabled=!0),jy(),Oc(),O.layers.pins.changed(),O.layers.text.changed(),O.layers.priority.changed(),n&&(od(),O.engine.getView().fit(zN(),{size:O.engine.getSize(),padding:[52,52,52,52],maxZoom:_h(O.lens),duration:180}))}function UN(){if(O.gridEnabled){if(!O.gridCell){cX(!1);return}AA(Ts().parent(O.gridCell))}}function jy(){if(O.sources){if(O.sources.grid.clear(),O.sources.gridContext.clear(),ge.gridNavigator.hidden=!O.gridEnabled,uX(),Ppe(),O.gridEnabled&&O.lens){let i=Ts();ge.gridInput.maxLength=i.inputLength(O.world),ge.gridInput.value=O.gridCell,ge.gridBack.title=O.gridCell?`Back one ${i.slug} level`:`Close ${i.slug} grid`;for(let e of FE())Fpe(e)}document.dispatchEvent(new Event("atlas:grid"))}}function Ppe(){let i=wy(O.world),e=Ts();if(ge.gridSystemName.textContent=e.name,ge.gridSystem.hidden=i.length<2,i.length<2)return;let t=i[(i.indexOf(e)+1)%i.length];ge.gridSystem.textContent=e.short,ge.gridSystem.title=`Dividing by ${e.name} \xB7 \u2318G for ${t.name}`,ge.gridSystem.setAttribute("aria-label",`Cell system: ${e.name}. Switch to ${t.name}`)}function kN(){let i=wy(O.world);if(i.length<2)return;let e=i.indexOf(Ts());Lpe(i[(e+1)%i.length].slug)}function Lpe(i){if(i===O.gridSystem)return;let e=Ts(),t=O.gridCell;O.gridSystem=i,O.gridCell=t?vW(e,Ts(),t,O.world):"",jy(),Oc(),O.layers.pins.changed(),O.layers.text.changed(),O.layers.priority.changed()}function Dpe(i){return $f[Ts().colorKey(i)]}function NE(i,{subgridVisible:e,labelled:t}){let{role:n,contextDistance:r}=i;if(n==="child"&&(!t||!e))return null;let s=Dpe(i.hash),o=n==="leaf"||n==="scope",a=n==="scope"&&e,l={color:o?Vi.lineWhite:s,opacity:n==="neighbor"?Vi.neighborLineAlpha:n==="child"?Vi.childLineAlpha:1,widthPx:a?Vi.widths.scopeBare:Vi.widths[n]},c=null;n==="neighbor"?c={color:Vi.dimColor,opacity:Math.min(Vi.dimCap,Vi.dimBase+r*Vi.dimStep)}:n==="leaf"?c={color:s,opacity:Vi.leafFillAlpha}:n==="child"&&(c={color:s,opacity:Vi.childFillAlpha});let u=null;if(t&&!a){let{context:f,principal:d}=Ts().label(i.hash);u={prefix:f,final:d,color:o?Vi.lineWhite:s,textAlpha:n==="neighbor"?Vi.neighborTextAlpha:1,chip:n==="neighbor"?Vi.neighborChip:Vi.chip,sizePx:n==="neighbor"?Vi.neighborLabelSizePx:Vi.labelSizePx}}return{line:l,fill:c,label:u,bare:a}}function FE(){let i=Ts(),e=[],t=Npe(i,O.gridCell);for(let n=0;n<t.length-1;n++){let r=t[n+1];for(let s of i.children(t[n]))s!==r&&e.push(DE(i,s,"neighbor",t.length-1-n))}if(O.gridCell&&i.level(O.gridCell)>=i.maxLevel(O.world))return e.push(DE(i,O.gridCell,"leaf",0)),e;O.gridCell&&e.push(DE(i,O.gridCell,"scope",0));for(let n of i.children(O.gridCell))e.push(DE(i,n,"child",0));return e}function Npe(i,e){let t=[e],n=e;for(;n;)n=i.parent(n),t.unshift(n);return t}function DE(i,e,t,n){return{hash:e,extent:i.bbox(e),ring:i.ring(e),pole:i.poleContained(e),childIndex:i.childIndex(e),role:t,contextDistance:n}}function Fpe(i){let e=Ts(),t=O.features.filter(s=>!s.filteredHidden&&e.contains(i.hash,s.coordinate)).length,n=new Lp({geometry:Bpe(i),gridCell:{hash:i.hash,extent:i.extent,role:i.role,count:t,contextDistance:i.contextDistance},priority:i.role==="neighbor"?-i.contextDistance*100+i.childIndex:i.childIndex});(i.role==="neighbor"?O.sources.gridContext:O.sources.grid).addFeature(n)}function Bpe(i){let e=Yf(),t=i.ring;if(i.pole){let o=i.pole==="north"?e[3]:e[1];t=[...t,[t[t.length-1][0],o],[t[0][0],o],t[0]]}if(t.every(([o])=>o>=e[0]&&o<=e[2]))return new xh([t]);let r=e[2]-e[0],s=[];for(let o of[0,-r,r]){let a=_W(t.map(([l,c])=>[l+o,c]),e[0],e[2]);a.length>=4&&s.push([a])}return new LE(s)}function zN(){return Ts().bbox(O.gridCell)}function hX(){return Ts().maxLevel(O.world)}function Fp(i){return!O.gridEnabled||!O.gridCell?!1:Ts().contains(O.gridCell,i.coordinate)}var OE=[NaN,NaN,NaN,0],VN;function Ope(){return VN||(VN=Di(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),VN}var Upe=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,kpe=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,zpe=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Vpe=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function BE(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function $y(i){throw new Error('failed to parse "'+i+'" as color')}function fX(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(kpe)||i.match(Upe)||i.match(zpe);if(s){let o=s[4],a=100/255;return[Si(BE(s[1],a)+.5|0,0,255),Si(BE(s[2],a)+.5|0,0,255),Si(BE(s[3],a)+.5|0,0,255),o!==void 0?Si(BE(o,100),0,1):1]}$y(i)}if(i.startsWith("#")){if(Vpe.test(i)){let s=i.substring(1),o=s.length<=4?1:2,a=[0,0,0,255];for(let l=0,c=s.length;l<c;l+=o){let u=parseInt(s.substring(l,l+o),16);o===1&&(u+=u<<4),a[l/o]=u}return a[3]=a[3]/255,a}$y(i)}let e=Ope();e.fillStyle="#abcdef";let t=e.fillStyle;e.fillStyle=i,e.fillStyle===t&&(e.fillStyle="#fedcba",t=e.fillStyle,e.fillStyle=i,e.fillStyle===t&&$y(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return fX(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);let r=Array.from(e.getImageData(0,0,1,1).data);return r[3]=eA(r[3]/255,3),r}function dX(i){return typeof i=="string"?i:Zy(i)}var Gpe=1024,Xy={},GN=0;function pX(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function qN(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function HN(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function WN(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function jN(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function XN(i){let e=WN(i[0]),t=WN(i[1]),n=WN(i[2]),r=jN(e*.222488403+t*.716873169+n*.06060791),s=500*(jN(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-jN(e*.016863605+t*.117638439+n*.865350722)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,i[3]]}function mX(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=HN(e),s=HN(e+t/500*Math.cos(n)),o=HN(e-t/200*Math.sin(n)),a=qN(s*3.021973625-r*1.617392459-o*.404875592),l=qN(s*-.943766287+r*1.916279586+o*.027607165),c=qN(s*.069407491-r*.22898585+o*1.159737864);return[Si(a+.5|0,0,255),Si(l+.5|0,0,255),Si(c+.5|0,0,255),i[3]]}function Yy(i){if(i==="none")return OE;if(Xy.hasOwnProperty(i))return Xy[i];if(GN>=Gpe){let t=0;for(let n in Xy)(t++&3)===0&&(delete Xy[n],--GN)}let e=fX(i);e.length!==4&&$y(i);for(let t of e)isNaN(t)&&$y(i);return Xy[i]=e,++GN,e}function kc(i){return Array.isArray(i)?i:Yy(i)}function Zy(i){let e=i[0];e!=(e|0)&&(e=e+.5|0);let t=i[1];t!=(t|0)&&(t=t+.5|0);let n=i[2];n!=(n|0)&&(n=n+.5|0);let r=i[3]===void 0?1:Math.round(i[3]*1e3)/1e3;return"rgba("+e+","+t+","+n+","+r+")"}var YN=class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(let t in this.cache_){let n=this.cache_[t];(e++&3)===0&&!n.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t){let n=$N(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=$N(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=$N(e,t),o=s in this.cache_;this.cache_[s]=n,r&&(n.getImageState()===In.IDLE&&n.load(),n.getImageState()===In.LOADING?n.ready().then(()=>{this.patternCache_[s]=Dy().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=Dy().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function $N(i,e){let t=e?kc(e):"null";return i+":"+t}var na=new YN;var Ky=null,UE=class extends Pp{constructor(e,t,n,r,s){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.canvas_={},this.color_=s,this.imageState_=r===void 0?In.IDLE:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===In.LOADED){Ky||(Ky=Di(1,1,void 0,{willReadFrequently:!0})),Ky.drawImage(this.image_,0,0);try{Ky.getImageData(0,0,1,1),this.tainted_=!1}catch{Ky=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(nn.CHANGE)}handleImageError_(){this.imageState_=In.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=In.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let e=this.size_[0],t=this.size_[1],n=Di(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===In.IDLE){this.image_||this.initializeImage_(),this.imageState_=In.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&vj(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==In.LOADED)return;let t=this.image_,n=Di(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation="multiply",n.fillStyle=dX(this.color_),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation="destination-in",n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||(this.ready_=new Promise(e=>{if(this.imageState_===In.LOADED||this.imageState_===In.ERROR)e();else{let t=()=>{(this.imageState_===In.LOADED||this.imageState_===In.ERROR)&&(this.removeEventListener(nn.CHANGE,t),e())};this.addEventListener(nn.CHANGE,t)}})),this.ready_}};function Bp(i,e,t,n,r,s){let o=e===void 0?void 0:na.get(e,r);return o||(o=new UE(i,i&&"src"in i?i.src||void 0:e,t,n,r),na.set(e,r,o,s)),s&&o&&!na.getPattern(e,r)&&na.set(e,r,o,s),o}var AX=UE;function vl(i){return i?Array.isArray(i)?Zy(i):typeof i=="object"&&"src"in i?qpe(i):i:null}function qpe(i){if(!i.offset||!i.size)return na.getPattern(i.src,i.color);let e=i.src+":"+i.offset,t=na.getPattern(e,i.color);if(t)return t;let n=na.get(i.src,null);if(n.getImageState()!==In.LOADED)return null;let r=Di(i.size[0],i.size[1]);return r.drawImage(n.getImage(1),i.offset[0],i.offset[1],i.size[0],i.size[1],0,0,i.size[0],i.size[1]),Bp(r.canvas,e,void 0,In.LOADED,i.color,!0),na.getPattern(e,i.color)}var Qy="ol-hidden";var Op="ol-unselectable";var dv="ol-control",ZN="ol-collapsed",Hpe=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(""),"i"),gX=["style","variant","weight","size","lineHeight","family"],kE={normal:400,bold:700},zE=function(i){let e=i.match(Hpe);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=gX.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[gX[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in kE&&(t.weight=kE[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var VE="10px sans-serif",ro="#000",yh="round",_l=[],xl=0,bh="round",ad=10,_X=0,ia="#000",Up="center",vA="middle",ld=[0,0,0,0],cd=1,gA=new zs,Jy=null,vX,KN={},Wpe=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function jpe(i,e,t){return`${i} ${e} 16px "${t}"`}var xX=(function(){let e,t;async function n(s){await t.ready;let o=zE(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let d=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),A=kE[f.weight]||f.weight;d===a&&f.style===o.style&&A==l&&c.push(f)}),c.length===0?!1:(await Promise.all(c.map(f=>f.load().then(()=>!0,()=>!1)))).some(f=>f)}async function r(){await t.ready;let s=!0,o=gA.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){let c=a[l],u=o[c];u<100&&(await n(c)?(gh(KN),gA.set(c,100)):(u+=10,gA.set(c,u,!0),u<100&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(s){t||(t=io?self.fonts:document.fonts);let o=zE(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(Wpe.has(c))continue;let u=jpe(o.style,o.weight,c);gA.get(u)===void 0&&(gA.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),Xpe=(function(){let i;return function(e){let t=KN[e];if(t==null){if(io){let n=zE(e),r=yX(e,"\u017Dg");t=(isNaN(Number(n.lineHeight))?1.2:Number(n.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else i||(i=document.createElement("div"),i.innerHTML="M",i.style.minHeight="0",i.style.maxHeight="none",i.style.height="auto",i.style.padding="0",i.style.border="none",i.style.position="absolute",i.style.display="block",i.style.left="-99999px"),i.style.font=e,document.body.appendChild(i),t=i.offsetHeight,document.body.removeChild(i);KN[e]=t}return t}})();function yX(i,e){return Jy||(Jy=Di(1,1)),i!=vX&&(Jy.font=i,vX=Jy.font),Jy.measureText(e)}function bX(i,e){return yX(i,e).width}function QN(i,e,t){if(e in t)return t[e];let n=e.split(`5+`).trim()}function jl(i){return new Intl.NumberFormat().format(i)}function us(i,e,t){return Math.min(t,Math.max(e,i))}function yE(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var hpe=100;function nd(){if(!ge.searchResults)return;let i=[...O.features.filter(n=>!n.filteredHidden).map(n=>({title:n.location.title,pin:n})),...[...O.zoneRecords.values()].filter(n=>n.zone.title&&!Io(n.zone.collectionId)&&(!O.search||n.zone.title.toLocaleLowerCase().includes(O.search))).map(n=>({title:n.zone.title,record:n}))].sort((n,r)=>n.title.localeCompare(r.title)),e=i.slice(0,hpe),t=document.createDocumentFragment();if(!e.length){let n=document.createElement("p");n.className="search-empty",n.textContent=O.search?"No visible features match.":"Nothing is enabled. Show a collection to list its features.",t.append(n)}for(let n of e)t.append(n.pin?fpe(n.pin):dpe(n.record));if(i.length>e.length){let n=document.createElement("p");n.className="dock-note",n.textContent=`First ${e.length} of ${jl(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}ge.searchResults.replaceChildren(t),mpe(i.length),ppe()}function fpe(i){let e=document.createElement("button");e.type="button",e.className="search-result",O.selectedPin===i&&e.classList.add("is-selected"),e.dataset.location=String(i.location.id),uv(e,i.category);let t=document.createElement("span");t.className="result-dot",hv(t,i.category,bu(i.category.title));let n=document.createElement("span"),r=document.createElement("strong");r.textContent=i.location.title;let s=document.createElement("small");return s.textContent=[i.category.title,i.category.group].filter(Boolean).join(" \xB7 "),n.append(r,s),e.append(t,n),e}function dpe(i){let e=document.createElement("button");e.type="button",e.className="search-result",O.selectedZone===i.zone&&e.classList.add("is-selected"),e.dataset.zone=String(i.zone.id);let t=document.createElement("span");t.className="result-dot",t.style.setProperty("background",i.color);let n=document.createElement("span"),r=document.createElement("strong");r.textContent=i.zone.title;let s=document.createElement("small");return s.textContent=i.collection?.title||"Zone",n.append(r,s),e.append(t,n),e}var Kj=28;function ppe(){let i=O.selectedPin?.location.title||"",e=i.length>Kj?`${i.slice(0,Kj-1).trimEnd()}\u2026`:i;ge.dockRailName.textContent=e?` \xB7 ${e}`:"",ge.dockRailName.hidden=!e}function mpe(i){ge.dockCount.textContent=`${jl(i)} ${i===1?"feature":"features"}`,O.search?(ge.dockFlag.textContent=`\u201C${O.search}\u201D`,ge.dockFlag.hidden=!1):O.hiddenCollections.size>0?(ge.dockFlag.textContent="filtered",ge.dockFlag.hidden=!1):ge.dockFlag.hidden=!0}function Ny(){!O.dockFolded||O.dockDismissed||bE(!1)}function _N(i){O.dockDismissed=i,bE(i)}function bE(i,e=!0){O.dockFolded=i,ge.dock.classList.toggle("is-folded",i),ge.dockFold.setAttribute("aria-expanded",String(!i));let t=i?"Bring the panel back (\u2318\u2325B)":"Put the panel away (\u2318\u2325B)";ge.dockFold.setAttribute("aria-label",t),ge.dockFold.setAttribute("title",t),e&&Wl()}function bN(i){O.hiddenCollections.delete(i.category.id),dA(),Nc(),ph(),Fy(i,!0)}function Fy(i,e=!1){O.selectedPin=i,O.selectedZone=null,ge.detailCoordinatesField.hidden=!1,document.dispatchEvent(new Event("atlas:selection")),Fc(),O.layers.pins.changed(),O.layers.pinLabels.changed(),O.layers.priority.changed(),ge.detailTitle.textContent=i.location.title,ge.detailCategory.textContent=[i.category.group,i.category.title].filter(Boolean).join(" / "),ge.detailDescription.textContent="",ge.detailLinks.hidden=!0,wN(),Spe(i),ge.detailID.textContent=String(i.location.id),ge.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=Gq(i.coordinate);ge.detailCell.textContent=t,ge.detailCellField.hidden=!t;for(let r of ge.detail.querySelectorAll("[data-cell-system-row]"))r.remove();for(let r of by(O.world)){if(r.slug==="geohash")continue;let s=r.locate(i.coordinate,O.world);if(!s)continue;let o=document.createElement("div");o.dataset.cellSystemRow=r.slug;let a=document.createElement("dt");a.textContent=s.label;let l=document.createElement("dd");l.textContent=s.value,o.append(a,l),ge.detailCellField.after(o)}let n=wpe(i);if(ge.detailSource.textContent=n,ge.detailSourceField.hidden=!n,uv(ge.detailDot,i.category),hv(ge.detailDot,i.category,bu(i.category.title)),ge.detail.hidden=!1,Ny(),nd(),e){let r=O.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(mh(O.lens),Math.max(r.getZoom()||0,4)),duration:220})}}function wE(i){O.selectedPin=null,O.selectedZone=i,document.dispatchEvent(new Event("atlas:selection")),Fc(),O.layers.pins.changed(),O.layers.priority.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed();let e=z1(i);ge.detailTitle.textContent=i.title,ge.detailCategory.textContent=[e?.group,e?.title].filter(Boolean).join(" / ")||i.subtitle||"Zone",ge.detailDescription.textContent="",ge.detailLinks.hidden=!0,ge.detailLinks.replaceChildren(),ge.detailID.textContent=String(i.id),ge.detailCoordinatesField.hidden=!0,ge.detailCellField.hidden=!0;for(let n of ge.detail.querySelectorAll("[data-cell-system-row]"))n.remove();let t=O.world?.merged?.find(n=>n.origin)?.source||"";ge.detailSource.textContent=t,ge.detailSourceField.hidden=!t,ge.detailDot.textContent="",ge.detailDot.removeAttribute("style"),ge.detailDot.style.setProperty("background",cv(i.id)),wN(),Qj([...Ape(i,e),...wD(i.attrs)]),i.hasText?bpe(i):ge.detailDescription.textContent="No description is included in the archive.",ge.detail.hidden=!1,Ny(),nd()}function Ape(i,e){let t=O.zoneRecords.get(i.id);if(!t||!e)return[];let n=[],r=xy(O.world);if(e.kind==="area"){if(r){let o=t.geometries.reduce((a,l)=>a+vpe(l,r),0);o>0&&n.push({label:"Area",value:xpe(o)})}let s=O.features.filter(o=>!o.filteredHidden&&By(o.location)&&t.geometries.some(a=>xD(a,o.coordinate))).length;n.push({label:"Locations inside",value:jl(s)})}if(e.kind==="path"&&r){let s=t.geometries.reduce((o,a)=>o+_pe(a,r),0);s>0&&n.push({label:"Length",value:ype(s)})}return n}var xN=110.574;function yN(i,[e,t]){return i.toLatLng(e,-t)}function gpe(i,e){let t=i.map(o=>yN(e,o));if(t.length<3)return 0;let n=t.reduce((o,a)=>o+a[0],0)/t.length,r=111.32*Math.cos(n*Math.PI/180),s=0;for(let o=0,a=t.length-1;o<t.length;a=o++){let[l,c]=t[a],[u,f]=t[o];s+=c*r*u*xN-f*r*l*xN}return Math.abs(s)/2}function vpe(i,e){let t=i.getType()==="MultiPolygon"?i.getPolygons():i.getType()==="Polygon"?[i]:[],n=0;for(let r of t)r.getLinearRings().forEach((s,o)=>{let a=gpe(s.getCoordinates(),e);n+=o===0?a:-a});return Math.max(0,n)}function _pe(i,e){let t=i.getType()==="MultiLineString"?i.getCoordinates():i.getType()==="LineString"?[i.getCoordinates()]:[],n=0;for(let r of t)for(let s=1;s<r.length;s++){let[o,a]=yN(e,r[s-1]),[l,c]=yN(e,r[s]),u=(o+l)/2*(Math.PI/180),f=(c-a)*111.32*Math.cos(u),d=(l-o)*xN;n+=Math.hypot(f,d)}return n}function xpe(i){return`${i>=10?jl(Math.round(i)):i.toFixed(2)} km\xB2`}function ype(i){return i<1?`${Math.round(i*1e3)} m`:`${i>=10?jl(Math.round(i)):i.toFixed(1)} km`}function wN(){for(let i of ge.detail.querySelectorAll("[data-feature-row]"))i.remove()}function Qj(i){let e=ge.detailSourceField;for(let t of i){let n=document.createElement("div");n.dataset.featureRow="";let r=document.createElement("dt");r.textContent=t.label;let s=document.createElement("dd");s.textContent=t.value,n.append(r,s),e.after(n),e=n}}async function bpe(i){let e=await SN();if(O.selectedZone!==i)return;let t=e[String(i.id)]||{};ge.detailDescription.textContent=vN(t.d)||"No description is included in the archive."}function wpe(i){let e=O.world?.merged;if(!e?.length)return"";let t=e.find(n=>n.origin)?.source||"";if(O.pinSourceIndex?.world!==O.world){let n=new Map;for(let r of e){for(let s of r.adopted||[])n.set(s.d,r.source);for(let s of r.matched||[]){let o=`confirmed by ${r.source}`;n.set(s.w,t?`${t} \xB7 ${o}`:o)}}O.pinSourceIndex={world:O.world,byID:n}}for(let n of e)if(!n.origin&&i.category.group===n.source)return n.source;return O.pinSourceIndex.byID.get(i.location.id)||t}async function Spe(i){let e=await SN();if(O.selectedPin!==i)return;let t=e[String(i.location.id)]||{};i.location.description=t.d||"",i.location.links=t.l||[],ge.detailDescription.textContent=vN(t.d)||"No description is included in the archive.",wN(),Qj(wD(t.a)),Tpe(i)}function Tpe(i){let e=(i.location.links||[]).filter(n=>O.featureByID.has(n.locationId));if(ge.detailLinks.hidden=e.length===0,!e.length){ge.detailLinks.replaceChildren();return}let t=document.createDocumentFragment();for(let n of e){let r=document.createElement("button");r.type="button",r.className="detail-link",r.dataset.location=String(n.locationId),r.textContent=n.title,t.append(r)}ge.detailLinks.replaceChildren(t)}function id(){let i=O.selectedPin!==null||O.selectedZone!==null;O.selectedPin=null,O.selectedZone=null,document.dispatchEvent(new Event("atlas:selection")),O.sources&&(Fc(),O.layers.pins.changed(),O.layers.pinLabels.changed(),O.layers.priority.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed()),ge.detail.hidden=!0,i&&nd()}function Bc(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=e;o<t;o+=n)r[s++]=i.slice(o,o+n);return r.length=s,r}function Pp(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o];r[s++]=Bc(i,e,l,n,r[s]),e=l}return r.length=s,r}function Oy(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o];r[s++]=l.length===1&&l[0]===e?[]:Pp(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}var TN=class i extends Al{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Do(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){if(r<Rc(this.getExtent(),e,t))return r;let s=this.flatCoordinates,o=this.stride;for(let a=0,l=s.length;a<l;a+=o){let c=pu(e,t,s[a],s[a+1]);if(c<r){r=c;for(let u=0;u<o;++u)n[u]=s[a+u];n.length=o}}return r}getCoordinates(){return Bc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new yu(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){let e=this.flatCoordinates,t=this.layout,n=this.stride,r=[];for(let s=0,o=e.length;s<o;s+=n){let a=new yu(e.slice(s,s+n),t);r.push(a)}return r}getType(){return"MultiPoint"}intersectsExtent(e){let t=this.flatCoordinates,n=this.stride;for(let r=0,s=t.length;r<s;r+=n){let o=t[r],a=t[r+1];if(wy(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=uA(this.flatCoordinates,0,e,this.stride),this.changed()}},Jj=TN;function EN(i,e,t,n){let r=0,s=i[t-n],o=i[t-n+1],a=0,l=0;for(;e<t;e+=n){let c=i[e]-s,u=i[e+1]-o;r+=l*c-a*u,a=c,l=u}return r/2}function MN(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=EN(i,e,a,n),e=a}return r}function eX(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=MN(i,e,a,n),e=a[a.length-1]}return r}function tX(i,e,t,n,r,s,o){let a=i[e],l=i[e+1],c=i[t]-a,u=i[t+1]-l,f;if(c===0&&u===0)f=e;else{let d=((r-a)*c+(s-l)*u)/(c*c+u*u);if(d>1)f=t;else if(d>0){for(let A=0;A<n;++A)o[A]=Lo(i[e+A],i[t+A],d);o.length=n;return}else f=e}for(let d=0;d<n;++d)o[d]=i[f+d];o.length=n}function Uy(i,e,t,n,r){let s=i[e],o=i[e+1];for(e+=n;e<t;e+=n){let a=i[e],l=i[e+1],c=pu(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function ky(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=Uy(i,e,a,n,r),e=a}return r}function nX(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=ky(i,e,a,n,r),e=a[a.length-1]}return r}function zy(i,e,t,n,r,s,o,a,l,c,u){if(e==t)return c;let f,d;if(r===0){if(d=pu(o,a,i[e],i[e+1]),d<c){for(f=0;f<n;++f)l[f]=i[e+f];return l.length=n,d}return c}u=u||[NaN,NaN];let A=e+n;for(;A<t;)if(tX(i,A-n,A,n,o,a,u),d=pu(o,a,u[0],u[1]),d<c){for(c=d,f=0;f<n;++f)l[f]=u[f];l.length=n,A+=n}else A+=n*Math.max((Math.sqrt(d)-Math.sqrt(c))/r|0,1);if(s&&(tX(i,t-n,e,n,o,a,u),d=pu(o,a,u[0],u[1]),d<c)){for(c=d,f=0;f<n;++f)l[f]=u[f];l.length=n}return c}function Vy(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,d=t.length;f<d;++f){let A=t[f];c=zy(i,e,A,n,r,s,o,a,l,c,u),e=A}return c}function iX(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,d=t.length;f<d;++f){let A=t[f];c=Vy(i,e,A,n,r,s,o,a,l,c,u),e=A[A.length-1]}return c}function pA(i,e,t,n,r,s,o){let a=(t-e)/n;if(a<3){for(;e<t;e+=n)s[o++]=i[e],s[o++]=i[e+1];return o}let l=new Array(a);l[0]=1,l[a-1]=1;let c=[e,t-n],u=0;for(;c.length>0;){let f=c.pop(),d=c.pop(),A=0,y=i[d],w=i[d+1],S=i[f],T=i[f+1];for(let R=d+n;R<f;R+=n){let I=i[R],P=i[R+1],F=EW(I,P,y,w,S,T);F>A&&(u=R,A=F)}A>r&&(l[(u-e)/n]=1,d+n<u&&c.push(d,u),u+n<f&&c.push(u,f))}for(let f=0;f<a;++f)l[f]&&(s[o++]=i[e+f*n],s[o++]=i[e+f*n+1]);return o}function SE(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=pA(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Ip(i,e){return e*Math.round(i/e)}function Epe(i,e,t,n,r,s,o){if(e==t)return o;let a=Ip(i[e],r),l=Ip(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,u;do if(c=Ip(i[e],r),u=Ip(i[e+1],r),e+=n,e==t)return s[o++]=c,s[o++]=u,o;while(c==a&&u==l);for(;e<t;){let f=Ip(i[e],r),d=Ip(i[e+1],r);if(e+=n,f==c&&d==u)continue;let A=c-a,y=u-l,w=f-a,S=d-l;if(A*S==y*w&&(A<0&&w<A||A==w||A>0&&w>A)&&(y<0&&S<y||y==S||y>0&&S>y)){c=f,u=d;continue}s[o++]=c,s[o++]=u,a=c,l=u,c=f,u=d}return s[o++]=c,s[o++]=u,o}function Gy(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=Epe(i,e,u,n,r,s,o),a.push(o),e=u}return o}function rX(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l],f=[];o=Gy(i,e,u,n,r,s,o,f),a.push(f),e=u[u.length-1]}return o}var CN=class i extends Al{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new i(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,n,r){return r<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Uy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),zy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return EN(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Bc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=pA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return oA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=uA(this.flatCoordinates,0,e,this.stride),this.changed()}},RN=CN;function qy(i,e,t,n,r,s,o){let a,l,c,u,f,d,A,y=r[s+1],w=[];for(let R=0,I=t.length;R<I;++R){let P=t[R];for(u=i[P-n],d=i[P-n+1],a=e;a<P;a+=n)f=i[a],A=i[a+1],(y<=d&&A<=y||d<=y&&y<=A)&&(c=(y-d)/(A-d)*(f-u)+u,w.push(c)),u=f,d=A}let S=NaN,T=-1/0;for(w.sort(pl),u=w[0],a=1,l=w.length;a<l;++a){f=w[a];let R=Math.abs(f-u);R>T&&(c=(u+f)/2,Py(i,e,t,n,c,y)&&(S=c,T=R)),u=f}return isNaN(S)&&(S=r[s]),o?(o.push(S,y,T),o):[S,y,T]}function TE(i,e,t,n,r){let s=[];for(let o=0,a=t.length;o<a;++o){let l=t[o];s=qy(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function sX(i,e,t,n){for(;e<t-n;){for(let r=0;r<n;++r){let s=i[e+r];i[e+r]=i[t-n+r],i[t-n+r]=s}e+=n,t-=n}}function PN(i,e,t,n){let r=0,s=i[t-n],o=i[t-n+1];for(;e<t;e+=n){let a=i[e],l=i[e+1];r+=(a-s)*(l+o),s=a,o=l}return r===0?void 0:r>0}function IN(i,e,t,n,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){let a=t[s],l=PN(i,e,a,n);if(s===0){if(r&&l||!r&&!l)return!1}else if(r&&!l||!r&&l)return!1;e=a}return!0}function oX(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(!IN(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function EE(i,e,t,n,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){let a=t[s],l=PN(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&sX(i,e,a,n),e=a}return e}function LN(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s)e=EE(i,e,t[s],n,r);return e}function aX(i,e){let t=[],n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){let l=e[o],c=PN(i,n,l,2);if(s===void 0&&(s=c),c===s)t.push(e.slice(r,o+1));else{if(t.length===0)continue;t[t.length-1].push(e[r])}r=o+1,n=l}return t}var ME=class i extends Al{constructor(e,t,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&n?(this.setFlatCoordinates(t,e),this.ends_=n):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?Do(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ky(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Vy(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return Py(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return MN(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),EE(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,Pp(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=dl(this.getExtent());this.flatInteriorPoint_=qy(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new yu(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new RN(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){let e=this.layout,t=this.flatCoordinates,n=this.ends_,r=[],s=0;for(let o=0,a=n.length;o<a;++o){let l=n[o],c=new RN(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;IN(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=EE(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Gy(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return WD(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=Dy(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},Ah=ME;function DN(i){if(hh(i))throw new Error("Cannot create polygon from empty extent");let e=i[0],t=i[1],n=i[2],r=i[3],s=[e,t,e,r,n,r,n,t,e,t];return new ME(s,"XY",[s.length])}function CE(i,e,t,n){let r=[],s=Wr();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=q1(i,e,l[0],n),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),e=l[l.length-1]}return r}var NN=class i extends Al{constructor(e,t,n){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!n&&!Array.isArray(e[0])){let r=e,s=[],o=[];for(let a=0,l=r.length;a<l;++a){let c=r[a],u=s.length,f=c.getEnds();for(let d=0,A=f.length;d<A;++d)f[d]+=u;Do(s,c.getFlatCoordinates()),o.push(f)}t=r.length===0?this.getLayout():r[0].getLayout(),e=s,n=o}t!==void 0&&n?(this.setFlatCoordinates(t,e),this.endss_=n):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{let n=this.flatCoordinates.length;Do(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let r=0,s=t.length;r<s;++r)t[r]+=n}this.endss_.push(t),this.changed()}clone(){let e=this.endss_.length,t=new Array(e);for(let r=0;r<e;++r)t[r]=this.endss_[r].slice();let n=new i(this.flatCoordinates.slice(),this.layout,t);return n.applyProperties(this),n}closestPointXY(e,t,n,r){return r<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(nX(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),iX(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return sj(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return eX(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),LN(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,Oy(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=CE(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=TE(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Jj(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;oX(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=LN(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=rX(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{let s=this.endss_[e-1];t=s[s.length-1]}let n=this.endss_[e].slice(),r=n[n.length-1];if(t!==0)for(let s=0,o=n.length;s<o;++s)n[s]-=t;return new Ah(this.flatCoordinates.slice(t,r),this.layout,n)}getPolygons(){let e=this.layout,t=this.flatCoordinates,n=this.endss_,r=[],s=0;for(let o=0,a=n.length;o<a;++o){let l=n[o].slice(),c=l[l.length-1];if(s!==0)for(let f=0,d=l.length;f<d;++f)l[f]-=s;let u=new Ah(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return aj(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=Yj(this.flatCoordinates,0,e,this.stride,this.endss_);if(n.length===0)this.flatCoordinates.length=0;else{let r=n[n.length-1];this.flatCoordinates.length=r.length===0?0:r[r.length-1]}this.changed()}},RE=NN;function lX(i){return i.key.toLocaleLowerCase()==="g"?(i.preventDefault(),cX(),O.gridEnabled?(ge.gridInput.focus(),ge.gridInput.select()):ge.viewport.focus({preventScroll:!0}),!0):i.key===" "&&O.gridEnabled&&i.target!==ge.subgridToggle?(i.preventDefault(),Hy(!O.subgridVisible),!0):i.key==="Escape"&&O.gridEnabled?(i.preventDefault(),FN(),!0):!1}function cX(i=!O.gridEnabled){O.gridEnabled=i,i&&Hy(!0),Wy(),Fc(),O.layers.pins.changed(),O.layers.priority.changed()}function Hy(i){O.subgridVisible=i,O.layers.grid.changed(),O.layers.gridContext.changed(),ge.subgridToggle.setAttribute("aria-pressed",String(i)),ge.subgridToggle.setAttribute("aria-label",i?"Hide the subgrid":"Show the subgrid"),uX(),document.dispatchEvent(new Event("atlas:grid"))}function uX(){if(!O.gridEnabled){ge.gridHint.textContent="G \xB7 grid off";return}ge.gridHint.textContent=`G-${O.gridCell||"root"}`+(O.subgridVisible?"":" no subgrid")}function mA(i){let e=Ss(),t=e.parseInput(e.normalizeInput(i));if(t===null)return;let n=t!==O.gridCell;O.gridCell=t,O.gridEnabled||(O.gridEnabled=!0),Wy(),Fc(),O.layers.pins.changed(),O.layers.priority.changed(),n&&(id(),O.engine.getView().fit(ON(),{size:O.engine.getSize(),padding:[52,52,52,52],maxZoom:mh(O.lens),duration:180}))}function FN(){if(O.gridEnabled){if(!O.gridCell){cX(!1);return}mA(Ss().parent(O.gridCell))}}function Wy(){if(O.sources){if(O.sources.grid.clear(),O.sources.gridContext.clear(),ge.gridNavigator.hidden=!O.gridEnabled,uX(),Mpe(),O.gridEnabled&&O.lens){let i=Ss();ge.gridInput.maxLength=i.inputLength(O.world),ge.gridInput.value=O.gridCell,ge.gridBack.title=O.gridCell?`Back one ${i.slug} level`:`Close ${i.slug} grid`;for(let e of LE())Ipe(e)}document.dispatchEvent(new Event("atlas:grid"))}}function Mpe(){let i=by(O.world),e=Ss();if(ge.gridSystemName.textContent=e.name,ge.gridSystem.hidden=i.length<2,i.length<2)return;let t=i[(i.indexOf(e)+1)%i.length];ge.gridSystem.textContent=e.short,ge.gridSystem.title=`Dividing by ${e.name} \xB7 \u2318G for ${t.name}`,ge.gridSystem.setAttribute("aria-label",`Cell system: ${e.name}. Switch to ${t.name}`)}function BN(){let i=by(O.world);if(i.length<2)return;let e=i.indexOf(Ss());Cpe(i[(e+1)%i.length].slug)}function Cpe(i){if(i===O.gridSystem)return;let e=Ss(),t=O.gridCell;O.gridSystem=i,O.gridCell=t?vW(e,Ss(),t,O.world):"",Wy(),Fc(),O.layers.pins.changed(),O.layers.priority.changed()}function Rpe(i){return Wf[Ss().colorKey(i)]}function IE(i,{subgridVisible:e,labelled:t}){let{role:n,contextDistance:r}=i;if(n==="child"&&(!t||!e))return null;let s=Rpe(i.hash),o=n==="leaf"||n==="scope",a=n==="scope"&&e,l={color:o?Vi.lineWhite:s,opacity:n==="neighbor"?Vi.neighborLineAlpha:n==="child"?Vi.childLineAlpha:1,widthPx:a?Vi.widths.scopeBare:Vi.widths[n]},c=null;n==="neighbor"?c={color:Vi.dimColor,opacity:Math.min(Vi.dimCap,Vi.dimBase+r*Vi.dimStep)}:n==="leaf"?c={color:s,opacity:Vi.leafFillAlpha}:n==="child"&&(c={color:s,opacity:Vi.childFillAlpha});let u=null;if(t&&!a){let{context:f,principal:d}=Ss().label(i.hash);u={prefix:f,final:d,color:o?Vi.lineWhite:s,textAlpha:n==="neighbor"?Vi.neighborTextAlpha:1,chip:n==="neighbor"?Vi.neighborChip:Vi.chip,sizePx:n==="neighbor"?Vi.neighborLabelSizePx:Vi.labelSizePx}}return{line:l,fill:c,label:u,bare:a}}function LE(){let i=Ss(),e=[],t=Ppe(i,O.gridCell);for(let n=0;n<t.length-1;n++){let r=t[n+1];for(let s of i.children(t[n]))s!==r&&e.push(PE(i,s,"neighbor",t.length-1-n))}if(O.gridCell&&i.level(O.gridCell)>=i.maxLevel(O.world))return e.push(PE(i,O.gridCell,"leaf",0)),e;O.gridCell&&e.push(PE(i,O.gridCell,"scope",0));for(let n of i.children(O.gridCell))e.push(PE(i,n,"child",0));return e}function Ppe(i,e){let t=[e],n=e;for(;n;)n=i.parent(n),t.unshift(n);return t}function PE(i,e,t,n){return{hash:e,extent:i.bbox(e),ring:i.ring(e),pole:i.poleContained(e),childIndex:i.childIndex(e),role:t,contextDistance:n}}function Ipe(i){let e=Ss(),t=O.features.filter(s=>!s.filteredHidden&&e.contains(i.hash,s.coordinate)).length,n=new Rp({geometry:Lpe(i),gridCell:{hash:i.hash,extent:i.extent,role:i.role,count:t,contextDistance:i.contextDistance},priority:i.role==="neighbor"?-i.contextDistance*100+i.childIndex:i.childIndex});(i.role==="neighbor"?O.sources.gridContext:O.sources.grid).addFeature(n)}function Lpe(i){let e=jf(),t=i.ring;if(i.pole){let o=i.pole==="north"?e[3]:e[1];t=[...t,[t[t.length-1][0],o],[t[0][0],o],t[0]]}if(t.every(([o])=>o>=e[0]&&o<=e[2]))return new Ah([t]);let r=e[2]-e[0],s=[];for(let o of[0,-r,r]){let a=_W(t.map(([l,c])=>[l+o,c]),e[0],e[2]);a.length>=4&&s.push([a])}return new RE(s)}function ON(){return Ss().bbox(O.gridCell)}function hX(){return Ss().maxLevel(O.world)}function Lp(i){return!O.gridEnabled||!O.gridCell?!1:Ss().contains(O.gridCell,i.coordinate)}var NE=[NaN,NaN,NaN,0],UN;function Dpe(){return UN||(UN=Di(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),UN}var Npe=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Fpe=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Bpe=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Ope=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function DE(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function Xy(i){throw new Error('failed to parse "'+i+'" as color')}function fX(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(Fpe)||i.match(Npe)||i.match(Bpe);if(s){let o=s[4],a=100/255;return[Si(DE(s[1],a)+.5|0,0,255),Si(DE(s[2],a)+.5|0,0,255),Si(DE(s[3],a)+.5|0,0,255),o!==void 0?Si(DE(o,100),0,1):1]}Xy(i)}if(i.startsWith("#")){if(Ope.test(i)){let s=i.substring(1),o=s.length<=4?1:2,a=[0,0,0,255];for(let l=0,c=s.length;l<c;l+=o){let u=parseInt(s.substring(l,l+o),16);o===1&&(u+=u<<4),a[l/o]=u}return a[3]=a[3]/255,a}Xy(i)}let e=Dpe();e.fillStyle="#abcdef";let t=e.fillStyle;e.fillStyle=i,e.fillStyle===t&&(e.fillStyle="#fedcba",t=e.fillStyle,e.fillStyle=i,e.fillStyle===t&&Xy(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return fX(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);let r=Array.from(e.getImageData(0,0,1,1).data);return r[3]=Jm(r[3]/255,3),r}function dX(i){return typeof i=="string"?i:Yy(i)}var Upe=1024,jy={},kN=0;function pX(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function zN(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function VN(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function GN(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function qN(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function HN(i){let e=GN(i[0]),t=GN(i[1]),n=GN(i[2]),r=qN(e*.222488403+t*.716873169+n*.06060791),s=500*(qN(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-qN(e*.016863605+t*.117638439+n*.865350722)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,i[3]]}function mX(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=VN(e),s=VN(e+t/500*Math.cos(n)),o=VN(e-t/200*Math.sin(n)),a=zN(s*3.021973625-r*1.617392459-o*.404875592),l=zN(s*-.943766287+r*1.916279586+o*.027607165),c=zN(s*.069407491-r*.22898585+o*1.159737864);return[Si(a+.5|0,0,255),Si(l+.5|0,0,255),Si(c+.5|0,0,255),i[3]]}function $y(i){if(i==="none")return NE;if(jy.hasOwnProperty(i))return jy[i];if(kN>=Upe){let t=0;for(let n in jy)(t++&3)===0&&(delete jy[n],--kN)}let e=fX(i);e.length!==4&&Xy(i);for(let t of e)isNaN(t)&&Xy(i);return jy[i]=e,++kN,e}function Oc(i){return Array.isArray(i)?i:$y(i)}function Yy(i){let e=i[0];e!=(e|0)&&(e=e+.5|0);let t=i[1];t!=(t|0)&&(t=t+.5|0);let n=i[2];n!=(n|0)&&(n=n+.5|0);let r=i[3]===void 0?1:Math.round(i[3]*1e3)/1e3;return"rgba("+e+","+t+","+n+","+r+")"}var jN=class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(let t in this.cache_){let n=this.cache_[t];(e++&3)===0&&!n.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t){let n=WN(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=WN(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=WN(e,t),o=s in this.cache_;this.cache_[s]=n,r&&(n.getImageState()===Pn.IDLE&&n.load(),n.getImageState()===Pn.LOADING?n.ready().then(()=>{this.patternCache_[s]=Ly().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=Ly().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function WN(i,e){let t=e?Oc(e):"null";return i+":"+t}var na=new jN;var Zy=null,FE=class extends Cp{constructor(e,t,n,r,s){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.canvas_={},this.color_=s,this.imageState_=r===void 0?Pn.IDLE:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===Pn.LOADED){Zy||(Zy=Di(1,1,void 0,{willReadFrequently:!0})),Zy.drawImage(this.image_,0,0);try{Zy.getImageData(0,0,1,1),this.tainted_=!1}catch{Zy=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(nn.CHANGE)}handleImageError_(){this.imageState_=Pn.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Pn.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let e=this.size_[0],t=this.size_[1],n=Di(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Pn.IDLE){this.image_||this.initializeImage_(),this.imageState_=Pn.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&vj(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==Pn.LOADED)return;let t=this.image_,n=Di(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation="multiply",n.fillStyle=dX(this.color_),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation="destination-in",n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||(this.ready_=new Promise(e=>{if(this.imageState_===Pn.LOADED||this.imageState_===Pn.ERROR)e();else{let t=()=>{(this.imageState_===Pn.LOADED||this.imageState_===Pn.ERROR)&&(this.removeEventListener(nn.CHANGE,t),e())};this.addEventListener(nn.CHANGE,t)}})),this.ready_}};function Dp(i,e,t,n,r,s){let o=e===void 0?void 0:na.get(e,r);return o||(o=new FE(i,i&&"src"in i?i.src||void 0:e,t,n,r),na.set(e,r,o,s)),s&&o&&!na.getPattern(e,r)&&na.set(e,r,o,s),o}var AX=FE;function gl(i){return i?Array.isArray(i)?Yy(i):typeof i=="object"&&"src"in i?kpe(i):i:null}function kpe(i){if(!i.offset||!i.size)return na.getPattern(i.src,i.color);let e=i.src+":"+i.offset,t=na.getPattern(e,i.color);if(t)return t;let n=na.get(i.src,null);if(n.getImageState()!==Pn.LOADED)return null;let r=Di(i.size[0],i.size[1]);return r.drawImage(n.getImage(1),i.offset[0],i.offset[1],i.size[0],i.size[1],0,0,i.size[0],i.size[1]),Dp(r.canvas,e,void 0,Pn.LOADED,i.color,!0),na.getPattern(e,i.color)}var Ky="ol-hidden";var Np="ol-unselectable";var fv="ol-control",XN="ol-collapsed",zpe=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(""),"i"),gX=["style","variant","weight","size","lineHeight","family"],BE={normal:400,bold:700},OE=function(i){let e=i.match(zpe);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=gX.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[gX[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in BE&&(t.weight=BE[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var UE="10px sans-serif",io="#000",gh="round",vl=[],_l=0,vh="round",rd=10,_X=0,ia="#000",Fp="center",gA="middle",sd=[0,0,0,0],od=1,AA=new Us,Qy=null,vX,$N={},Vpe=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Gpe(i,e,t){return`${i} ${e} 16px "${t}"`}var xX=(function(){let e,t;async function n(s){await t.ready;let o=OE(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let d=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),A=BE[f.weight]||f.weight;d===a&&f.style===o.style&&A==l&&c.push(f)}),c.length===0?!1:(await Promise.all(c.map(f=>f.load().then(()=>!0,()=>!1)))).some(f=>f)}async function r(){await t.ready;let s=!0,o=AA.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){let c=a[l],u=o[c];u<100&&(await n(c)?(dh($N),AA.set(c,100)):(u+=10,AA.set(c,u,!0),u<100&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(s){t||(t=no?self.fonts:document.fonts);let o=OE(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(Vpe.has(c))continue;let u=Gpe(o.style,o.weight,c);AA.get(u)===void 0&&(AA.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),qpe=(function(){let i;return function(e){let t=$N[e];if(t==null){if(no){let n=OE(e),r=yX(e,"\u017Dg");t=(isNaN(Number(n.lineHeight))?1.2:Number(n.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else i||(i=document.createElement("div"),i.innerHTML="M",i.style.minHeight="0",i.style.maxHeight="none",i.style.height="auto",i.style.padding="0",i.style.border="none",i.style.position="absolute",i.style.display="block",i.style.left="-99999px"),i.style.font=e,document.body.appendChild(i),t=i.offsetHeight,document.body.removeChild(i);$N[e]=t}return t}})();function yX(i,e){return Qy||(Qy=Di(1,1)),i!=vX&&(Qy.font=i,vX=Qy.font),Qy.measureText(e)}function bX(i,e){return yX(i,e).width}function YN(i,e,t){if(e in t)return t[e];let n=e.split(`66 `).reduce((r,s)=>Math.max(r,bX(i,s)),0);return t[e]=n,n}function wX(i,e){let t=[],n=[],r=[],s=0,o=0,a=0,l=0;for(let c=0,u=e.length;c<=u;c+=2){let f=e[c];if(f===`7-`||c===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}let d=e[c+1]||i.font,A=bX(d,f);t.push(A),o+=A;let y=Xpe(d);n.push(y),l=Math.max(l,y)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function SX(i,e,t,n,r,s,o,a,l,c,u){i.save(),t!==1&&(i.globalAlpha===void 0?i.globalAlpha=f=>f.globalAlpha*=t:i.globalAlpha*=t),e&&i.transform.apply(i,e),n.contextInstructions?(i.translate(l,c),i.scale(u[0],u[1]),$pe(n,i)):u[0]<0||u[1]<0?(i.translate(l,c),i.scale(u[0],u[1]),i.drawImage(n,r,s,o,a,0,0,o,a)):i.drawImage(n,r,s,o,a,l,c,o*u[0],a*u[1]),i.restore()}function $pe(i,e){let t=i.contextInstructions;for(let n=0,r=t.length;n<r;n+=2)Array.isArray(t[n+1])?e[t[n]].apply(e,t[n+1]):e[t[n]]=t[n+1]}var JN=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=cs(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new i({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return ei()}getImage(e){return ei()}getHitDetectionImage(){return ei()}getPixelRatio(e){return 1}getImageState(){return ei()}getImageSize(){return ei()}getOrigin(){return ei()}getSize(){return ei()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=cs(e)}listenImageChange(e){ei()}load(){ei()}unlistenImageChange(e){ei()}ready(){return Promise.resolve()}},GE=JN;var e5=class i extends GE{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,rotation:e.rotation!==void 0?e.rotation:0,scale:e.scale!==void 0?e.scale:1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?In.LOADING:In.LOADED,this.imageState_===In.LOADING&&this.ready().then(()=>this.imageState_=In.LOADED),this.render()}clone(){let e=this.getScale(),t=new i({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){let e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){let t=this.fill_?.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(","),r=na.get(n,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*e),a=Di(o,o);this.draw_(s,a,e),r=a.canvas;let l=new AX(r,void 0,null,In.LOADED,null);na.set(n,null,l),createImageBitmap(r).then(c=>{l.setImage(c)})}return r}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let r=this.radius,s=this.radius2_===void 0?r:this.radius2_;if(r<s){let D=r;r=s,s=D}let o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=s*Math.sin(a),c=Math.sqrt(s*s-l*l),u=r-c,f=Math.sqrt(l*l+u*u),d=f/l;if(e==="miter"&&d<=n)return d*t;let A=t/2/d,y=t/2*(u/f),S=Math.sqrt((r+A)*(r+A)+y*y)-r;if(this.radius2_===void 0||e==="bevel")return S*2;let T=r*Math.sin(a),R=Math.sqrt(r*r-T*T),P=s-R,F=Math.sqrt(T*T+P*P)/T;if(F<=n){let D=F*t/2-s-r;return 2*Math.max(S,D)}return S*2}createRenderOptions(){let e=yh,t=bh,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=vl(this.stroke_.getColor()??ia),a=this.stroke_.getWidth()??cd,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??bh,e=this.stroke_.getLineCap()??yh,n=this.stroke_.getMiterLimit()??ad);let l=this.calculateLineJoinSize_(t,a,n),c=Math.max(this.radius,this.radius2_||0),u=Math.ceil(2*c+l);return{strokeStyle:o,strokeWidth:a,size:u,lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:t,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();let e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,n){if(t.scale(n,n),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let r=this.fill_.getColor();r===null&&(r=ro),t.fillStyle=vl(r),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let n=this.fill_.getColor(),r=0;typeof n=="string"&&(n=kc(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Di(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_,n=this.radius;if(t===1/0)e.arc(0,0,n,0,2*Math.PI);else{let r=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(t*=2);let s=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){let l=s+a*o,c=a%2===0?n:r;e.lineTo(c*Math.cos(l),c*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=ro,t.fill(),e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}},qE=e5;var t5=class i extends qE{constructor(e){e=e||{radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale!==void 0?e.scale:1,rotation:e.rotation!==void 0?e.rotation:0,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode})}clone(){let e=this.getScale(),t=new i({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}},HE=t5;var n5=class i{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){let e=this.getColor();return new i({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){if(e!==null&&typeof e=="object"&&"src"in e){let t=Bp(null,e.src,{crossOrigin:"anonymous"},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===In.IDLE&&t.load(),t.getImageState()===In.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?Bn(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:kc(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},hs=n5;function TX(i,e,t,n){return t!==void 0&&n!==void 0?[t/i,n/e]:t!==void 0?t/i:n!==void 0?n/e:1}var i5=class i extends GE{constructor(e){e=e||{};let t=e.opacity!==void 0?e.opacity:1,n=e.rotation!==void 0?e.rotation:0,r=e.scale!==void 0?e.scale:1,s=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:n,scale:r,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:s,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy_=e.referrerPolicy;let o=e.img!==void 0?e.img:null,a=e.src;jn(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Bn(o)),jn(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),jn(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(e.src!==void 0?l=In.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?In.LOADED:In.IDLE:l=In.LOADING:l=In.LOADED),this.color_=e.color!==void 0?kc(e.color):null,this.iconImage_=Bp(o,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null,this.initialOptions_,e.width!==void 0||e.height!==void 0){let c,u;if(e.size)[c,u]=e.size;else{let f=this.getImage(1);if(f.width&&f.height)c=f.width,u=f.height;else if(f instanceof HTMLImageElement){this.initialOptions_=e;let d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;let A=this.iconImage_.getSize();this.setScale(TX(A[0],A[1],e.width,e.height))};this.listenImageChange(d);return}}c!==void 0&&this.setScale(TX(c,u,e.width,e.height))}}clone(){let e,t,n;return this.initialOptions_?(t=this.initialOptions_.width,n=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new i({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:e,width:t,height:n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;let r=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!r)return null;e=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(e[0]*=r[0]),this.anchorYUnits_=="fraction"&&(e[1]*=r[1])}if(this.anchorOrigin_!="top-left"){if(!r)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(e[0]=-e[0]+r[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(e[1]=-e[1]+r[1])}this.normalizedAnchor_=e}let t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){let t=e?kc(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((o,a)=>o===t[a]))return;this.color_=t;let n=this.getSrc(),r=n!==void 0?null:this.getHitDetectionImage(),s=n!==void 0?In.IDLE:this.iconImage_.getImageState();this.iconImage_=Bp(r,n,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){let t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=Bp(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},In.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==In.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){let e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==In.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(nn.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(nn.CHANGE,e)}ready(){return this.iconImage_.ready()}},_A=i5;var r5=class i{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash!==void 0?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.offset_=e.offset,this.width_=e.width}clone(){let e=this.getColor();return new i({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setOffset(e){this.offset_=e}setWidth(e){this.width_=e}},Es=r5;var WE=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=EX,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill!==void 0?e.fill:null,this.image_=e.image!==void 0?e.image:null,this.renderer_=e.renderer!==void 0?e.renderer:null,this.hitDetectionRenderer_=e.hitDetectionRenderer!==void 0?e.hitDetectionRenderer:null,this.stroke_=e.stroke!==void 0?e.stroke:null,this.text_=e.text!==void 0?e.text:null,this.zIndex_=e.zIndex}clone(){let e=this.getGeometry();return e&&typeof e=="object"&&(e=e.clone()),new i({geometry:e??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e=="function"?this.geometryFunction_=e:typeof e=="string"?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=EX,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function MX(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(jn(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}var s5=null;function o5(i,e){if(!s5){let t=new hs({color:"rgba(255,255,255,0.4)"}),n=new Es({color:"#3399CC",width:1.25});s5=[new WE({image:new HE({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return s5}function EX(i){return i.getGeometry()}var Fr=WE;var Ype="#333",a5=class i{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=cs(e.scale!==void 0?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill!==void 0?e.fill:new hs({color:Ype}),this.maxAngle_=e.maxAngle!==void 0?e.maxAngle:Math.PI/4,this.placement_=e.placement!==void 0?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=e.stroke!==void 0?e.stroke:null,this.offsetX_=e.offsetX!==void 0?e.offsetX:0,this.offsetY_=e.offsetY!==void 0?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new i({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof hs?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=cs(e!==void 0?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}},ud=a5;function zc(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function IX(i){let e=i.get("pin");return!e||Vc(e)||e.passesZoneFilters||pv(e)?null:c5(e,!1)}function PX(i){let e=i.get("pin");return!e||!O.highlightedZones.size||!e.passesZoneFilters||Vc(e)||pv(e)?null:c5(e,!1)}function LX(i){let e=i.get("pin");return!e||Vc(e)||!O.labelsHeld?null:OX(e)}function DX(i){let e=i.get("pin");if(!e||Vc(e)||e.passesZoneFilters||pv(e)||n2())return null;if(O.labelsHeld)return e2(e,!1);let t=O.fitZoom+Math.log2(WX(e.category));return(O.engine.getView().getZoom()||0)<t?null:e2(e,!1)}function NX(i){let e=i.get("pin");return!e||Vc(e)||e.passesZoneFilters||pv(e)||!n2()?null:e2(e,!1)}function FX(i){let e=i.get("pin");return!e||!O.highlightedZones.size||!e.passesZoneFilters||Vc(e)||pv(e)?null:e2(e,!1)}function BX(i){let e=i.get("pin");if(!e||Vc(e))return null;if(gu(e.category)==="text")return e2(e,e===O.selectedPin);let t=c5(e,e===O.selectedPin);return e===O.hoveredPin||e===O.selectedPin?[t,OX(e)]:t}function c5(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(O.styleCache.has(t))return O.styleCache.get(t);let n=dA(i.category),r=e?2e7:i.priority,s=O.markerIcons.get(t2(i.category)),o;return s?o=new Fr({image:new _A({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new Fr({text:new ud({text:Mu(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new hs({color:n}),stroke:new Es({color:fA(),width:e?4:3})}),zIndex:r}),O.styleCache.set(t,o),o}function OX(i){let e=`marker-label:${i.location.id}`;if(O.styleCache.has(e))return O.styleCache.get(e);let t=new Fr({text:new ud({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new hs({color:"#f2ece0"}),stroke:new Es({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new hs({color:"rgba(10,12,17,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:i.priority});return O.styleCache.set(e,t),t}function UX(i){if(!i.iconAsset)return;let e=t2(i);if(O.markerIcons.has(e))return;O.markerIcons.set(e,null);let t=new Image;t.onload=()=>{let n=document.createElement("canvas");n.width=64,n.height=64;let r=n.getContext("2d"),s=dA(i),o=document.createElement("canvas");o.width=64,o.height=64;let a=o.getContext("2d");a.imageSmoothingEnabled=!i.iconPicture,a.drawImage(t,6,6,52,52),i.iconPicture||(a.globalCompositeOperation="source-in",a.fillStyle=s,a.fillRect(0,0,64,64));let l=document.createElement("canvas");l.width=64,l.height=64;let c=l.getContext("2d");c.drawImage(t,6,6,52,52),c.globalCompositeOperation="source-in",c.fillStyle=fA(),c.fillRect(0,0,64,64);for(let u=-3;u<=3;u++)for(let f=-3;f<=3;f++)f*f+u*u<=10&&r.drawImage(l,f,u);r.drawImage(o,0,0),O.markerIcons.set(e,n.toDataURL("image/png")),Zpe(),O.layers.pins.changed(),O.layers.zonePins.changed(),O.layers.priority.changed()},t.onerror=()=>O.markerIcons.set(e,!1),t.src=xN(i.iconAsset)}function Zpe(){for(let i of O.styleCache.keys())i.startsWith("marker:")&&O.styleCache.delete(i)}function t2(i){return`${i.iconAsset||""}:${dA(i)}:${O.world?.iconOutset||"light"}`}function e2(i,e){let t=`text:${i.location.id}:${e?1:0}`;if(O.styleCache.has(t))return O.styleCache.get(t);let r=[new Fr({text:new ud({text:i.location.title,font:`${e?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new hs({color:e?"#7fd0ea":"#f2ece0"}),stroke:new Es({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new hs({color:e?"rgba(13,16,23,0.9)":"rgba(10,12,17,0.58)"}),backgroundStroke:e?new Es({color:"#3aa5c9",width:1}):void 0,padding:[3,6,3,6],overflow:!0}),zIndex:e?2e7:i.priority+3e6})];return O.styleCache.set(t,r),r}function jE(i,e){return`${i} ${e}px ${Vi.labelFont}`}function u5(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="neighbor",r=n?Vi.neighborLabelSizePx:Vi.labelSizePx,s=jE(900,r),o=n?[2,4,2,4]:[3,5,3,5],a=Qpe(t,s,r,o,e),l=NE(t,{subgridVisible:O.subgridVisible,labelled:a});if(!l)return null;let c=`grid:${O.gridSystem}:${t.hash}:${t.role}:${t.contextDistance}:${a?1:0}:${l.bare?1:0}`;if(O.styleCache.has(c))return O.styleCache.get(c);let u=t.role==="leaf"||t.role==="scope"?100:i.get("priority"),f=[new Fr({fill:l.fill?new hs({color:Bc(l.fill.color,l.fill.opacity)}):void 0,stroke:new Es({color:Bc(l.line.color,l.line.opacity),width:l.line.widthPx}),zIndex:u})];if(l.label){let d=l.label.prefix?[l.label.prefix,jE(500,r),l.label.final,jE(900,r)]:l.label.final,A=Vi.labelInsetPx*e,y=Kpe(i.getGeometry());y&&f.push(new Fr({geometry:new Eu([y[0]-A,y[1]+A]),text:new ud({text:d,font:jE(900,r),textAlign:"right",textBaseline:"bottom",fill:new hs({color:Bc(l.label.color,l.label.textAlpha)}),backgroundFill:new hs({color:l.label.chip}),padding:o,overflow:!0}),zIndex:u+1}))}return O.styleCache.set(c,f),f}function Kpe(i){let e=i.getType()==="MultiPolygon"?i.getCoordinates():[i.getCoordinates()],t=null;for(let n of e)for(let[r,s]of n[0]||[])(!t||r-s>t[0]-t[1])&&(t=[r,s]);return t}function Qpe(i,e,t,n,r){if(!r)return!0;let s=h5(i.hash,e)+n[1]+n[3],o=t+n[0]+n[2];return s<=(i.extent[2]-i.extent[0])/r&&o<=(i.extent[3]-i.extent[1])/r}var CX=document.createElement("canvas").getContext("2d"),RX=new Map;function h5(i,e){let t=`${e}|${i}`,n=RX.get(t);return n===void 0&&(CX.font=e,n=CX.measureText(i).width,RX.set(t,n)),n}var Jpe=new Fr({fill:new hs({color:"rgba(5, 8, 16, 0.62)"})});function kX(){return G1()?Jpe:null}function zX(i,e){let t=i.get("zone");if(Po(Au(t)))return null;let n=i.get("child"),r=O.highlightedZones.has(t.id),s=HX(t.id),o=Number(t.attrs?.["atlas.stroke.width_px"])||Number(V1(t)?.attrs?.["atlas.stroke.width_px"])||0;if(o>0&&i.getGeometry()?.getType()==="MultiLineString")return e0e(t,i.get("color"),o/e,r,s);let a=`zone:${t.id}:${n?1:0}:${r?1:s?2:0}`;if(O.styleCache.has(a))return O.styleCache.get(a);let l=i.get("color");if(s){let f=new Fr({stroke:new Es({color:Bc(l,n?.34:.44),width:n?1:1.3,lineDash:n?[3,4]:[7,5]}),zIndex:n?101:100});return O.styleCache.set(a,f),f}let c=new Fr({fill:new hs({color:Bc(l,n?.035:.07)}),stroke:new Es({color:Bc(l,n?.5:.72),width:n?1.2:1.8,lineDash:n?[3,4]:[7,5]})});if(!r)return O.styleCache.set(a,c),c;let u=[new Fr({stroke:new Es({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new Fr({fill:new hs({color:Bc(l,.22)}),stroke:new Es({color:l,width:2.6}),zIndex:9001})];return O.styleCache.set(a,u),u}function e0e(i,e,t,n,r){let s=Math.max(t,1.5);return n?[new Fr({stroke:new Es({color:"rgba(255,255,255,0.94)",width:s+4,lineCap:"round",lineJoin:"round"}),zIndex:9e3}),new Fr({stroke:new Es({color:Bc(e,.9),width:s,lineCap:"round",lineJoin:"round"}),zIndex:9001})]:[new Fr({stroke:new Es({color:Bc(e,r?.14:.3),width:s,lineCap:"round",lineJoin:"round"})}),new Fr({stroke:new Es({color:Bc(e,r?.4:.8),width:Math.min(1.6,s),lineDash:[7,5]})})]}function VX(i){if(n2())return null;let e=i.get("zone");if(Po(Au(e))||qX(e))return null;let t=O.highlightedZones.has(e.id);if(Jf(e)==="quiet")return l5(i);let n=i.get("child"),r=O.engine.getView().getZoom()||0;if(!t&&n&&r<O.fitZoom+3)return null;let s=i.get("span")/O.engine.getView().getResolution();return!t&&O.zoneTitleCount>40&&s<52?null:l5(i)}function GX(i){if(!n2())return null;let e=i.get("zone");return Po(Au(e))||qX(e)?null:l5(i)}function qX(i){return Jf(i)!=="quiet"||O.highlightedZones.has(i.id)||O.selectedZone===i?!1:O.labelOverrides.get(Au(i))==="quiet"||!O.labelsHeld}function l5(i){let e=i.get("child"),t=i.get("zone"),n=O.highlightedZones.has(t.id),r=HX(t.id),s=`zone-title:${t.id}:${e?1:0}:${n?1:r?2:0}`;if(O.styleCache.has(s))return O.styleCache.get(s);let o=i.get("color"),a=new Fr({text:new ud({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new hs({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new Es({color:n?"rgba(255,255,255,0.96)":r?"rgba(0,0,0,0.82)":"rgba(0,0,0,0.95)",width:n?2:r?3:4}),backgroundFill:new hs({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new Es({color:n?"#ffffff":Bc(o,r?.24:.55),width:n?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:n?91e5:i.get("priority")});return O.styleCache.set(s,a),a}function HX(i){if(!O.highlightedZones.size||O.highlightedZones.has(i))return!1;for(let e of O.highlightedZones)if(t0e(i,e))return!1;return!0}function t0e(i,e){let t=new Set,n=O.zoneRecords.get(e)?.zone.parent;for(;n!=null&&!t.has(n);){if(n===i)return!0;t.add(n),n=O.zoneRecords.get(n)?.zone.parent}return!1}function xA(i,e,t,n,r,s,o){let a,l,c=(t-e)/n;if(c===1)a=e;else if(c===2)a=e,l=r;else if(c!==0){let u=i[e],f=i[e+1],d=0,A=[0];for(let S=e+n;S<t;S+=n){let T=i[S],R=i[S+1];d+=Math.sqrt((T-u)*(T-u)+(R-f)*(R-f)),A.push(d),u=T,f=R}let y=r*d,w=ej(A,y);w<0?(l=(y-A[-w-2])/(A[-w-1]-A[-w-2]),a=e+(-w-2)*n):a=e+w*n}o=o>1?o:2,s=s||new Array(o);for(let u=0;u<o;++u)s[u]=a===void 0?NaN:l===void 0?i[a+u]:Lo(i[a+u],i[a+n+u],l);return s}function XE(i,e,t,n,r,s){if(t==e)return null;let o;if(r<i[e+n-1])return s?(o=i.slice(e,e+n),o[n-1]=r,o):null;if(i[t-1]<r)return s?(o=i.slice(t-n,t),o[n-1]=r,o):null;if(r==i[e+n-1])return i.slice(e,e+n);let a=e/n,l=t/n;for(;a<l;){let d=a+l>>1;r<i[(d+1)*n-1]?l=d:a=d+1}let c=i[a*n-1];if(r==c)return i.slice((a-1)*n,(a-1)*n+n);let u=i[(a+1)*n-1],f=(r-c)/(u-c);o=[];for(let d=0;d<n-1;++d)o.push(Lo(i[(a-1)*n+d],i[a*n+d],f));return o.push(r),o}function jX(i,e,t,n,r,s,o){if(o)return XE(i,e,t[t.length-1],n,r,s);let a;if(r<i[n-1])return s?(a=i.slice(0,n),a[n-1]=r,a):null;if(i[i.length-1]<r)return s?(a=i.slice(i.length-n),a[n-1]=r,a):null;for(let l=0,c=t.length;l<c;++l){let u=t[l];if(e!=u){if(r<i[e+n-1])return null;if(r<=i[u-1])return XE(i,e,u,n,r,!1);e=u}}return null}function mv(i,e,t,n){let r=i[e],s=i[e+1],o=0;for(let a=e+n;a<t;a+=n){let l=i[a],c=i[a+1];o+=Math.sqrt((l-r)*(l-r)+(c-s)*(c-s)),r=l,s=c}return o}var f5=class i extends gl{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){Do(this.flatCoordinates,e),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<Lc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ky(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Vy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,n,r))}forEachSegment(e){return lE(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!="XYM"&&this.layout!="XYZM"?null:(t=t!==void 0?t:!1,XE(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return Uc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return xA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return mv(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(e){let t=[];return t.length=mA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LineString"}intersectsExtent(e){return aA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=hA(this.flatCoordinates,0,e,this.stride),this.changed()}},d5=f5;var p5=class i extends gl{constructor(e,t,n){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&n)this.setFlatCoordinates(t,e),this.ends_=n;else{let r=e,s=[],o=[];for(let l=0,c=r.length;l<c;++l){let u=r[l];Do(s,u.getFlatCoordinates()),o.push(s.length)}let a=r.length===0?this.getLayout():r[0].getLayout();this.setFlatCoordinates(a,s),this.ends_=o}}appendLineString(e){Do(this.flatCoordinates,e.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<Lc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(zy(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Gy(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,n,r))}getCoordinateAtM(e,t,n){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(t=t!==void 0?t:!1,n=n!==void 0?n:!1,jX(this.flatCoordinates,0,this.ends_,this.stride,e,t,n))}getCoordinates(){return Dp(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new d5(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){let e=this.flatCoordinates,t=this.ends_,n=this.layout,r=[],s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o],c=new d5(e.slice(s,l),n);r.push(c),s=l}return r}getLength(){let e=this.ends_,t=0,n=0;for(let r=0,s=e.length;r<s;++r)n+=mv(this.flatCoordinates,t,e[r],this.stride),t=e[r];return n}getFlatMidpoints(){let e=[],t=this.flatCoordinates,n=0,r=this.ends_,s=this.stride;for(let o=0,a=r.length;o<a;++o){let l=r[o],c=xA(t,n,l,s,.5);Do(e,c),n=l}return e}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=ME(this.flatCoordinates,0,this.ends_,this.stride,e,t,0,n),new i(t,"XY",n)}getType(){return"MultiLineString"}intersectsExtent(e){return oj(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=Ny(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},XX=p5;function m5(){O.renderedShard=O.lens?.shard||0,O.sources.zones.clear(),O.sources.zoneTitles.clear(),O.zoneRecords.clear(),O.highlightedZones.clear(),O.focusedZoneID=null,O.zoneTitleCount=0,kp();for(let i of O.world.collections)if(i.kind!=="point")for(let e of i.features||[]){if(!Oy(e))continue;e.collectionId=i.id;let t=jr(),n=[],r=!1;for(let l of e.geometry||[]){let c=r0e(l);c&&(r=!0,n.push(c),jT(t,c.getExtent()),O.sources.zones.addFeature(new Lp({geometry:c,zone:e,color:uv(e.id),child:e.parent!=null})))}if(!r)continue;let s=uv(e.id),o=e.center?Av(e.center.lat,e.center.lng):dl(t),a=Math.max(t[2]-t[0],t[3]-t[1]);O.sources.zoneTitles.addFeature(new Lp({geometry:new Eu(o),zone:e,color:s,child:e.parent!=null,span:a,priority:(e.parent==null?2e6:1e6)+Math.round(a)})),O.zoneRecords.set(e.id,{zone:e,collection:i,extent:t.slice(),geometries:n,color:s})}A5(),g5(),n0e()}function A5(){O.zoneTitleCount=O.sources.zoneTitles.getFeatures().filter(i=>Jf(i.get("zone"))!=="quiet").length}function g5(){if(O.sources.zoneScrim.clear(),!O.highlightedZones.size)return;let[i,e,t,n]=O.projection.getExtent(),r=[$X([[i,e],[t,e],[t,n],[i,n],[i,e]],!0)];for(let s of O.highlightedZones)for(let o of O.zoneRecords.get(s)?.geometries||[]){if(o.getType()==="MultiLineString")continue;let a=o.getType()==="MultiPolygon"?o.getPolygons():[o];for(let l of a)l.getLinearRings().forEach((c,u)=>{r.push($X(c.getCoordinates(),u>0))})}O.sources.zoneScrim.addFeature(new Lp({geometry:new xh(r)}))}function $X(i,e){let t=0;for(let n=0,r=i.length-1;n<i.length;r=n++)t+=i[r][0]*i[n][1]-i[n][0]*i[r][1];return t<0===e?i:i.slice().reverse()}function n0e(){for(let i of ge.legend.querySelectorAll(".feature-index")){let e=document.createDocumentFragment();for(let{zone:t,depth:n}of i0e($l(i.dataset.featureIndex))){let r=O.zoneRecords.get(t.id);if(!r)continue;let s=document.createElement("button");s.type="button",s.className="zone-index-item",s.dataset.zone=String(t.id),s.style.setProperty("--zone-color",r.color),s.style.setProperty("--zone-depth",String(n)),s.setAttribute("aria-pressed","false"),s.title=`${t.title}: click to jump; right-click to toggle highlight`;let o=document.createElement("span");o.className="zone-index-marker",o.setAttribute("aria-hidden","true");let a=document.createElement("span");a.textContent=t.title,s.append(o,a),e.append(s)}i.replaceChildren(e)}}function i0e(i){let e=[...O.zoneRecords.values()].filter(a=>a.zone.collectionId===i).map(a=>a.zone),t=new Set(e.map(a=>a.id)),n=new Map;for(let a of e){let l=t.has(a.parent)?a.parent:null;n.has(l)||n.set(l,[]),n.get(l).push(a)}for(let a of n.values())a.sort((l,c)=>l.title.localeCompare(c.title,void 0,{numeric:!0,sensitivity:"base"}));let r=[],s=new Set,o=(a,l)=>{if(!s.has(a.id)){s.add(a.id),r.push({zone:a,depth:l});for(let c of n.get(a.id)||[])o(c,l+1)}};for(let a of n.get(null)||[])o(a,0);for(let a of e)o(a,0);return r}function kp(){let i=G1();O.layers.zoneScrim.setVisible(i),O.layers.zones.setVisible(i),O.layers.zoneTitles.setVisible(i),O.layers.zoneTitleDetail.setVisible(i);let e=!1;for(let t of[...O.highlightedZones]){let n=O.zoneRecords.get(t);(!n||Po(Au(n.zone)))&&(O.highlightedZones.delete(t),e=!0)}e&&($E(),g5(),_5()),O.layers.zones.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed()}function v5(i){let e=O.zoneRecords.get(i);e&&(O.focusedZoneID=i,_5(),EE(e.zone),O.engine.getView().fit(e.extent,{size:O.engine.getSize(),padding:[54,54,54,54],maxZoom:_h(O.lens),duration:220}),ge.sidebar.classList.remove("is-open"),ge.mobileLegend.setAttribute("aria-expanded","false"))}function YX(i){let e=O.zoneRecords.get(i);e&&(O.highlightedZones.has(i)?O.highlightedZones.delete(i):(O.highlightedZones.add(i),O.hiddenCollections.delete(Au(e.zone))&&(pA(),vh()),kp()),O.hoveredPin=null,$E(),x5(),_5(),g5(),O.layers.zones.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed())}function _5(){for(let i of ge.legend.querySelectorAll(".feature-index"))i.classList.toggle("has-highlights",O.highlightedZones.size>0);for(let i of ge.legend.querySelectorAll("[data-zone]")){let e=Number(i.dataset.zone),t=O.highlightedZones.has(e);i.classList.toggle("is-highlighted",t),i.classList.toggle("is-current",O.focusedZoneID===e),i.setAttribute("aria-pressed",String(t))}}function r0e(i){if(!i?.coordinates)return null;let e=([t,n])=>Av(n,t);return i.type==="Polygon"?new xh(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new LE(i.coordinates.map(t=>t.map(n=>n.map(e)))):i.type==="MultiLineString"?new XX(i.coordinates.map(t=>t.map(e))):null}function Av(i,e){let t=s0e(),n=2**t.sourceZoom,r=(e+180)/360*n,s=i*Math.PI/180,o=(1-Math.asinh(Math.tan(s))/Math.PI)/2*n;return[(r-t.firstTile)*t.tileSize,-(o-t.firstTile)*t.tileSize]}function s0e(){let i=O.volume.tileGrid,e=O.world?.grid;return e?{...i,...e}:i}function YE(){O.sources.pins.clear(),O.sources.text.clear(),O.sources.priority.clear(),O.features=[],O.featureByID.clear();for(let i of O.world.collections)if(i.kind==="point"){gu(i)!=="text"&&UX(i);for(let e of i.locations){let t={location:e,category:i,coordinate:Av(e.lat,e.lng),filteredHidden:!1,priority:l0e(i,e),feature:null};t.feature=new Lp({geometry:new Eu(t.coordinate),pin:t,priority:t.priority}),O.features.push(t),O.featureByID.set(e.id,t),gu(i)==="text"?O.sources.text.addFeature(t.feature):O.sources.pins.addFeature(t.feature)}}Xl()}function Xl(){for(let i of O.features){let e=Po(i.category.id),t=O.search&&!i.location.title.toLocaleLowerCase().includes(O.search);i.filteredHidden=!!(e||t)}$E(),x5(),O.selectedPin?.filteredHidden&&od(),sd(),document.dispatchEvent(new Event("atlas:filters"))}function $E(){if(!O.highlightedZones.size){for(let e of O.features)e.passesZoneFilters=!1;return}let i=lW([...O.highlightedZones].map(e=>O.zoneRecords.get(e)).filter(Boolean));for(let e of O.features)e.passesZoneFilters=cW(i,e.coordinate)}function x5(){O.eligibleLocations=O.features.filter(i=>!Vc(i)).length,Oc(),O.layers.pins.changed(),O.layers.zonePins.changed(),O.layers.pinLabels.changed(),O.layers.text.changed(),O.layers.zoneText.changed(),O.layers.textDetail.changed(),O.layers.priority.changed(),yA()}function Oc(){O.sources.priority.clear();for(let i of O.features){if(Vc(i))continue;let e=!!O.search&&i.location.title.toLocaleLowerCase().includes(O.search);(i===O.selectedPin||i===O.hoveredPin||e||Fp(i))&&O.sources.priority.addFeature(i.feature)}}function gv(i){O.hoveredPin!==i&&(O.hoveredPin=i,O.sources&&(Oc(),O.layers.pins.changed(),O.layers.priority.changed()))}function ZE(i){O.labelsHeld!==i&&(O.labelsHeld=i,ge.labelsHint.textContent=i?"Z \xB7 labels shown":"Z \xB7 hold for labels",O.layers.pinLabels.changed(),O.layers.text.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed(),document.dispatchEvent(new Event("atlas:labels")))}function pv(i){return i===O.selectedPin||i===O.hoveredPin||Fp(i)||!!O.search&&i.location.title.toLocaleLowerCase().includes(O.search)}function Vc(i){return i.filteredHidden||o0e(i)||a0e(i)||!Oy(i.location)}function Oy(i){let e=O.lens?.shard;return!e||!i.shard||i.shard===e}function o0e(i){return!O.highlightedZones.size||i.passesZoneFilters||i===O.selectedPin?!1:!(O.search&&i.location.title.toLocaleLowerCase().includes(O.search))}function a0e(i){return!O.gridEnabled||!O.gridCell||Fp(i)||i===O.selectedPin?!1:!(O.search&&i.location.title.toLocaleLowerCase().includes(O.search))}function l0e(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+Zj(e.id)%1e3}function WX(i){return i.locations.length>200?4:i.locations.length>75?2.5:1}function n2(){return(O.engine?.getView().getZoom()||0)>=(O.lens?.maxZoom||0)-.05}function ZX(i){let e=[],t=new Map,n=(s,o,a)=>{t.has(s)||(t.set(s,e.length),e.push({key:s,title:o,collections:[]})),e[t.get(s)].collections.push(a)},r=[];for(let s of i)s.kind!=="point"&&!s.group?r.push(s):n(`group-${s.group}`,s.group,s);return r.length&&e.unshift({key:"zones",title:"Zones",collections:r}),e}function KX(i){return i.kind||"point"}function QX(i){return(i.features||i.locations||[]).length}function $l(i){return/^\d+$/.test(i)?Number(i):i}function KE(i){for(let e of O.world?.sections||[])for(let t of e.collections)if(t.id===i)return t;return null}function JX(){let i=document.createDocumentFragment();for(let e of O.world.sections){let t=document.createElement("section");t.className="layer-section",t.dataset.layerSection=e.key;let n=e.collections.reduce((s,o)=>s+QX(o),0);t.append(c0e(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.collections)if(r.append(u0e(s)),KX(s)!=="point"){let o=document.createElement("div");o.className="feature-index",o.dataset.featureIndex=String(s.id),r.append(o)}t.append(r),i.append(t)}ge.legend.replaceChildren(i),QE(),n$(),vh()}function c0e(i,e,t){let n=document.createElement("div");n.className="layer-header";let r=document.createElement("button");r.type="button",r.className="layer-title",r.dataset.section=i;let s=document.createElement("span");s.className="layer-chevron",s.setAttribute("aria-hidden","true"),s.innerHTML='<svg viewBox="0 0 24 24"><path d="m9 6 6 6-6 6"/></svg>';let o=document.createElement("span");o.textContent=e;let a=document.createElement("span");a.className="layer-count",a.textContent=jl(t),r.append(s,o,a);let l=e$(`Show only ${e}`);l.dataset.onlySection=i;let c=document.createElement("label");c.className="layer-switch";let u=document.createElement("input");u.type="checkbox",u.dataset.sectionToggle=i,u.setAttribute("aria-label",`Show ${e}`);let f=document.createElement("span");return f.setAttribute("aria-hidden","true"),c.append(u,f),n.append(r,l,c),n}function e$(i){let e=document.createElement("button");return e.type="button",e.className="only-button",e.dataset.label=i,e.setAttribute("aria-label",i),e.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="4.6"/><circle cx="8" cy="8" r="1.3" fill="currentColor" stroke="none"/><path d="M8 1v2M8 13v2M1 8h2M13 8h2"/></svg>',e}function u0e(i){let e=KX(i),t=document.createElement("label");t.className="category-row";let n=document.createElement("input");n.type="checkbox",n.dataset.collection=String(i.id),n.checked=!O.hiddenCollections.has(i.id);let r;e!=="point"?(r=document.createElement("button"),r.type="button",r.className="collection-expand",r.dataset.expandCollection=String(i.id),r.setAttribute("aria-label",`Unfold the ${i.title} index`),r.innerHTML='<svg class="collection-chevron" viewBox="0 0 16 16" aria-hidden="true"><path d="m6 4 4 4-4 4"/></svg>'+(e==="path"?'<svg class="collection-kind" viewBox="0 0 16 16" aria-hidden="true"><path d="M2.5 12.5c3-6 8-2 11-9"/></svg>':'<svg class="collection-kind collection-kind-area" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 4.2 12.6 11.6H3.4z"/></svg>')):(r=document.createElement("span"),r.className="category-icon",hv(t,i),fv(r,i,Mu(i.title)),r.title=i.icon||i.title);let s=document.createElement("span");s.className="category-name",s.textContent=i.title;let o=e$(`Show only ${i.title}`);o.dataset.onlyCollection=String(i.id);let a;e==="area"?(a=document.createElement("button"),a.type="button",a.className="label-toggle",a.dataset.labelToggle=String(i.id),a.dataset.label=`Label ${i.title} on the map`,a.setAttribute("aria-label",`Label ${i.title} on the map`),a.setAttribute("aria-pressed",String(Jf(null,i)==="always")),a.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 3.5h9M8 3.5v9"/></svg>'):e==="point"?(a=document.createElement("button"),a.type="button",a.className="label-toggle render-toggle",a.dataset.renderToggle=String(i.id),a.dataset.label=`Draw ${i.title} as text`,a.setAttribute("aria-label",`Draw ${i.title} as text`),a.setAttribute("aria-pressed",String(gu(i)==="text")),a.textContent="Tt"):(a=document.createElement("span"),a.className="label-toggle-spacer");let l=document.createElement("span");return l.className="category-count",l.textContent=jl(QX(i)),t.append(n,r,s,o,a,l),t}function y5(i){if(O.collapsedSections.clear(),i)for(let e of ge.layers.querySelectorAll("[data-section]"))O.collapsedSections.add(e.dataset.section);QE()}function QE(){for(let i of ge.layers.querySelectorAll("[data-section]")){let e=O.collapsedSections.has(i.dataset.section);i.setAttribute("aria-expanded",String(!e)),i.closest(".layer-section").classList.toggle("is-collapsed",e)}ml()}function t$(i){O.expandedCollections.has(i)?O.expandedCollections.delete(i):O.expandedCollections.add(i),n$()}function n$(){for(let i of ge.legend.querySelectorAll("[data-expand-collection]")){let e=O.expandedCollections.has($l(i.dataset.expandCollection));i.setAttribute("aria-expanded",String(e)),i.closest(".category-row").classList.toggle("is-expanded",e)}for(let i of ge.legend.querySelectorAll(".feature-index"))i.hidden=!O.expandedCollections.has($l(i.dataset.featureIndex));ml()}function i$(i){let e=KE(i);if(!e)return;let t=Jf(null,e)==="always"?"quiet":"always",n=e.attrs?.["atlas.label.policy"]??"always";t===n?O.labelOverrides.delete(e.id):O.labelOverrides.set(e.id,t),r$(),A5(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed(),ml()}function r$(){for(let i of ge.legend.querySelectorAll("[data-label-toggle]")){let e=KE($l(i.dataset.labelToggle));e&&i.setAttribute("aria-pressed",String(Jf(null,e)==="always"))}for(let i of ge.legend.querySelectorAll("[data-render-toggle]")){let e=KE($l(i.dataset.renderToggle));e&&i.setAttribute("aria-pressed",String(gu(e)==="text"))}}function s$(i){let e=KE(i);if(!e)return;let t=gu(e)==="text"?"pin":"text",n=e.attrs?.["atlas.render.as"]||"pin";t===n?O.renderOverrides.delete(e.id):O.renderOverrides.set(e.id,t),YE(),Xl(),r$(),ml()}function i2(i){if(O.hiddenCollections.clear(),!i)for(let e of O.world.sections)for(let t of e.collections)O.hiddenCollections.add(t.id);pA(),kp(),Xl(),sd(),vh()}function pA(){for(let i of document.querySelectorAll("[data-collection]"))i.checked=!O.hiddenCollections.has($l(i.dataset.collection))}function o$(i){let e=O.world.sections.find(n=>n.key===i);if(!e)return;let t=e.collections.some(n=>!O.hiddenCollections.has(n.id));for(let n of e.collections)t?O.hiddenCollections.add(n.id):O.hiddenCollections.delete(n.id);pA(),kp(),Xl(),vh()}function a$(i){if(O.world){if(h0e(i)){i2(!0);return}O.hiddenCollections.clear();for(let e of O.world.sections){let t=i.section===e.key;for(let n of e.collections)!t&&i.collection!==n.id&&O.hiddenCollections.add(n.id)}pA(),kp(),Xl(),sd(),vh()}}function h0e(i){for(let e of O.world.sections)for(let t of e.collections)if((i.section===e.key||i.collection===t.id)===O.hiddenCollections.has(t.id))return!1;return!0}function f0e(){let i=ge.soloChip;if(!O.world){i.hidden=!0;return}let e=null,t=0,n=null,r=0;for(let o of O.world.sections){let a=0;for(let l of o.collections)O.hiddenCollections.has(l.id)||(a++,t++,e=l);a>0&&(r++,n=a===o.collections.length?o:null)}let s="";t===1&&e?s=e.title:r===1&&n&&(s=n.title),i.hidden=!s,i.textContent=s?`only: ${s}`:"",i.title=s?`Showing only ${s} \u2014 click to show everything`:""}function vh(){if(O.world){for(let i of O.world.sections){let e=ge.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.collections.some(t=>!O.hiddenCollections.has(t.id)))}f0e(),ml()}}async function l$(i){let[e,t]=await Promise.all([fetch(`${O.volume.base}/worlds/${i.slug}.json`),fetch(`${O.volume.base}/worlds/${i.slug}.bin`)]);if(!e.ok||!t.ok)throw new Error(`world ${i.slug} is not served under this catalog any more`);let[n,r]=await Promise.all([e.json(),t.arrayBuffer()]),s=n.collections||[];d0e(r,s);let o=ZX(s);return{...i,grid:n.grid,lenses:n.lenses,collections:s,collectionsById:new Map(s.map(a=>[a.id,a])),attrs:n.attrs||{},merged:n.merged||[],sections:o}}function d0e(i,e){let t=new DataView(i);if(String.fromCharCode(...new Uint8Array(i,0,8))!=="ATLASLOC")throw new Error("location payload is not in the expected form");let r=t.getUint16(8,!0);if(r!==3)throw new Error(`location payload is version ${r}, and this reads 3`);let s=t.getUint32(10,!0),o=16,a=new Int32Array(i,o,s),l=new Float32Array(i,o+=s*4,s),c=new Float32Array(i,o+=s*4,s),u=new Int32Array(i,o+=s*4,s),f=new Int32Array(i,o+=s*4,s),d=new Uint32Array(i,o+=s*4,s+1),A=new Uint16Array(i,o+=(s+1)*4,s),y=new Uint8Array(i,o+s*2),w=new TextDecoder;for(let S of e)S.kind==="point"&&(S.locations=[]);for(let S=0;S<s;S++){let T=e[A[S]];if(!T||T.kind!=="point")throw new Error(`location ${a[S]} names collection ${A[S]}, which is no point collection`);T.locations.push({id:a[S],title:w.decode(y.subarray(d[S],d[S+1])),lat:l[S],lng:c[S],memberId:u[S]||void 0,shard:f[S]||void 0})}}async function MN(){let i=`${O.volume.base}/${O.world.slug}`;return O.textByWorld.has(i)||O.textByWorld.set(i,fetch(`${O.volume.base}/worlds/${O.world.slug}.text`).then(e=>e.json()).catch(()=>({}))),O.textByWorld.get(i)}var JE=null;function bA(){return JE||(JE=p0e().finally(()=>{JE=null})),JE}async function p0e(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=O.volume;if(O.catalog=await i.json(),Hm(ge.volume,O.catalog.volumes,"title"),b5(),!O.catalog.volumes.length)return;let t=e&&O.catalog.volumes.find(n=>n.slug===e.slug);if(!t){let n=cv();await hd(n.volume||lv()?.volume||O.catalog.volumes[0].slug,n.volume?n.world:void 0);return}if(t.stamp!==e.stamp){for(let r of O.textByWorld.keys())r.startsWith(e.base+"/")&&O.textByWorld.delete(r);let n=O.engine?.getView();O.restore={volume:t.slug,world:O.world?.slug,lens:O.world?O.world.lenses.indexOf(O.lens):0,center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...O.hiddenCollections],collapsed:[...O.collapsedSections],expanded:[...O.expandedCollections],labels:[...O.labelOverrides],overviewDocked:O.overviewDocked,dockFolded:O.dockFolded,dockDismissed:O.dockDismissed},await hd(t.slug,O.world?.slug);return}O.volume=t,ge.volume.value=t.slug}function b5(){let i=!O.catalog?.volumes?.length;ge.emptyState.hidden=!i,O.catalog?.bundlesDir&&(ge.emptyPath.textContent=O.catalog.bundlesDir)}async function w5(){for(let i of[ge.emptyOpen,ge.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await bA();let t=e.imported?.[0];t&&O.catalog.volumes.some(n=>n.slug===t)&&await hd(t)}finally{for(let i of[ge.emptyOpen,ge.addBundles])i.disabled=!1}}var vo={ADD:"add",REMOVE:"remove"};var c$={LENGTH:"length"},vv=class extends Ao{constructor(e,t,n){super(e),this.element=t,this.index=n}},S5=class extends zs{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e??[],this.unique_)for(let n=1,r=this.array_.length;n<r;++n)this.assertUnique_(this.array_[n],n);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,n=e.length;t<n;++t)this.push(e[t]);return this}forEach(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)e(t[n],n,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(c$.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new vv(vo.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)if(t[n]===e)return this.removeAt(n)}removeAt(e){if(e<0||e>=this.getLength())return;let t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new vv(vo.REMOVE,t,e)),t}setAt(e,t){let n=this.getLength();if(e>=n){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);let r=this.array_[e];this.array_[e]=t,this.dispatchEvent(new vv(vo.REMOVE,r,e)),this.dispatchEvent(new vv(vo.ADD,t,e))}updateLength_(){this.set(c$.LENGTH,this.array_.length)}assertUnique_(e,t){let n=this.array_;for(let r=0,s=n.length;r<s;++r)if(n[r]===e&&r!==t)throw new Error("Duplicate item added to a unique collection")}},Fo=S5;var T5=class extends Ao{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},zp=T5;var E5=class extends zp{constructor(e,t,n,r,s,o){super(e,t,s),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=r!==void 0?r:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},wh=E5;var gr={SINGLECLICK:"singleclick",CLICK:nn.CLICK,DBLCLICK:nn.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var r2={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var M5=class extends Pp{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;let n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=qn(n,r2.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=qn(n,r2.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(nn.TOUCHMOVE,this.boundHandleTouchMove_,fE?{passive:!1}:!1)}emulateClick_(e){let t=new wh(gr.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new wh(gr.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new wh(gr.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==gr.POINTERUP||t.type==gr.POINTERCANCEL){delete this.trackedTouches_[n];for(let r in this.trackedTouches_)if(this.trackedTouches_[r].target!==t.target){delete this.trackedTouches_[r];break}}else(t.type==gr.POINTERDOWN||t.type==gr.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new wh(gr.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(li),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);let t=new wh(gr.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){let n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(qn(n,gr.POINTERMOVE,this.handlePointerMove_,this),qn(n,gr.POINTERUP,this.handlePointerUp_,this),qn(this.element_,gr.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(qn(this.element_.getRootNode(),gr.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new wh(gr.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;let t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new wh(gr.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){let t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(li(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(nn.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(li(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(li),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},u$=M5;var Sh={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var Bo={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var s2=1/0,C5=class{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,gh(this.queuedElements_)}dequeue(){let e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));let r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){jn(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let t=this.priorityFunction_(e);return t!=s2?(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){let t=this.elements_,n=this.priorities_,r=t.length,s=t[e],o=n[e],a=e;for(;e<r>>1;){let l=this.getLeftChildIndex_(e),c=this.getRightChildIndex_(e),u=c<r&&n[c]<n[l]?c:l;t[e]=t[u],n[e]=n[u],e=u}t[e]=s,n[e]=o,this.siftDown_(a,e)}siftDown_(e,t){let n=this.elements_,r=this.priorities_,s=n[t],o=r[t];for(;t>e;){let a=this.getParentIndex_(t);if(r[a]>o)n[t]=n[a],r[t]=r[a],t=a;else break}n[t]=s,r[t]=o}reprioritize(){let e=this.priorityFunction_,t=this.elements_,n=this.priorities_,r=0,s=t.length,o,a,l;for(a=0;a<s;++a)o=t[a],l=e(o),l==s2?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},h$=C5;var R5=class extends h${constructor(e,t){super(n=>e.apply(null,n),n=>n[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){let t=super.enqueue(e);return t&&e[0].addEventListener(nn.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===an.LOADED||n===an.ERROR||n===an.EMPTY){n!==an.ERROR&&t.removeEventListener(nn.CHANGE,this.boundHandleTileChange_);let r=t.getKey();r in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[r],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_<e&&n<t&&this.getCount()>0;){let r=this.dequeue()[0],s=r.getKey();r.getState()===an.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++n,r.load())}}},f$=R5;function d$(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return s2;if(!i.wantedTiles[t][e.getKey()])return s2;let s=i.viewState.center,o=n[0]-s[0],a=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}var so={ANIMATING:0,INTERACTING:1};var Gc={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function I5(i,e,t){return(function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;let l=e?0:s[0]*r,c=e?0:s[1]*r,u=a?a[0]:0,f=a?a[1]:0,d=i[0]+l/2+u,A=i[2]-l/2+u,y=i[1]+c/2+f,w=i[3]-c/2+f;d>A&&(d=(A+d)/2,A=d),y>w&&(y=(w+y)/2,w=y);let S=Si(n[0],d,A),T=Si(n[1],y,w);if(o&&t&&r){let R=30*r;S+=-R*Math.log(1+Math.max(0,d-n[0])/R)+R*Math.log(1+Math.max(0,n[0]-A)/R),T+=-R*Math.log(1+Math.max(0,y-n[1])/R)+R*Math.log(1+Math.max(0,n[1]-w)/R)}return[S,T]})}function p$(i){return i}function P5(i,e,t,n){let r=Kn(e)/t[0],s=Nr(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function L5(i,e,t){let n=Math.min(i,e),r=50;return n*=Math.log(1+r*Math.max(0,i/e-1))/r+1,t&&(n=Math.max(n,t),n/=Math.log(1+r*Math.max(0,t/i-1))/r+1),Si(n,t/2,e*2)}function m$(i,e,t,n){return e=e!==void 0?e:!0,(function(r,s,o,a){if(r!==void 0){let l=i[0],c=i[i.length-1],u=t?P5(l,t,o,n):l;if(a)return e?L5(r,u,c):Si(r,c,u);let f=Math.min(u,r),d=Math.floor(tv(i,f,s));return i[d]>u&&d<i.length-1?i[d+1]:i[d]}})}function A$(i,e,t,n,r,s){return n=n!==void 0?n:!0,t=t!==void 0?t:0,(function(o,a,l,c){if(o!==void 0){let u=r?P5(e,r,l,s):e;if(c)return n?L5(o,u,t):Si(o,t,u);let f=1e-9,d=Math.ceil(Math.log(e/u)/Math.log(i)-f),A=-a*(.5-f)+.5,y=Math.min(u,o),w=Math.floor(Math.log(e/y)/Math.log(i)+A),S=Math.max(d,w),T=e/Math.pow(i,S);return Si(T,t,u)}})}function D5(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?P5(i,n,a,r):i;return!t||!l?Si(s,e,c):L5(s,c,e)}})}function _v(i){if(i!==void 0)return 0}function N5(i){if(i!==void 0)return i}function g$(i){let e=2*Math.PI/i;return(function(t,n){if(n)return t;if(t!==void 0)return t=Math.floor(t/e+.5)*e,t})}function v$(i){let e=i===void 0?xu(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var F5=0,O5=class extends zs{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=sE(e.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,e.projection&&YW(),e.center&&(e.center=wu(e.center,this.projection_)),e.extent&&(e.extent=Su(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in Gc)delete t[a];this.setProperties(t,!0);let n=A0e(e);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=n.minZoom;let r=m0e(e),s=n.constraint,o=g0e(e);this.constraints_={center:r,resolution:s,rotation:o},this.setRotation(e.rotation!==void 0?e.rotation:0),this.setCenterInternal(e.center!==void 0?e.center:null),e.resolution!==void 0?this.setResolution(e.resolution):e.zoom!==void 0&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;let n=this.getCenterInternal();if(n){let r=e||[0,0,0,0];t=t||[0,0,0,0];let s=this.getResolution(),o=s/2*(r[3]-t[3]+t[1]-r[1]),a=s/2*(r[0]-t[0]+t[2]-r[2]);this.setCenterInternal([n[0]+o,n[1]-a])}}getUpdatedOptions_(e){let t=this.getProperties();return t.resolution!==void 0?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let t=new Array(arguments.length);for(let n=0;n<t.length;++n){let r=arguments[n];r.center&&(r=Object.assign({},r),r.center=wu(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=wu(r.anchor,this.getProjection())),t[n]=r}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,n;t>1&&typeof arguments[t-1]=="function"&&(n=arguments[t-1],--t);let r=0;for(;r<t&&!this.isDef();++r){let u=arguments[r];u.center&&this.setCenterInternal(u.center),u.zoom!==void 0?this.setZoom(u.zoom):u.resolution&&this.setResolution(u.resolution),u.rotation!==void 0&&this.setRotation(u.rotation)}if(r===t){n&&e3(n,!0);return}let s=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_,c=[];for(;r<t;++r){let u=arguments[r],f={start:s,complete:!1,anchor:u.anchor,duration:u.duration!==void 0?u.duration:1e3,easing:u.easing||_j,callback:n};if(u.center&&(f.sourceCenter=o,f.targetCenter=u.center.slice(),o=f.targetCenter),u.zoom!==void 0?(f.sourceResolution=a,f.targetResolution=this.getResolutionForZoom(u.zoom),a=f.targetResolution):u.resolution&&(f.sourceResolution=a,f.targetResolution=u.resolution,a=f.targetResolution),u.rotation!==void 0){f.sourceRotation=l;let d=Ah(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+d,l=f.targetRotation}v0e(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(so.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[so.ANIMATING]>0}getInteracting(){return this.hints_[so.INTERACTING]>0}cancelAnimations(){this.setHint(so.ANIMATING,-this.hints_[so.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&e3(r[0].callback,!1),!e)for(let s=0,o=r.length;s<o;++s){let a=r[s];if(!a.complete){e=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let e=Date.now(),t=!1;for(let n=this.animations_.length-1;n>=0;--n){let r=this.animations_[n],s=!0;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l.complete)continue;let c=e-l.start,u=l.duration>0?c/l.duration:1;u>=1?(l.complete=!0,u=1):s=!1;let f=l.easing(u);if(l.sourceCenter){let d=l.sourceCenter[0],A=l.sourceCenter[1],y=l.targetCenter[0],w=l.targetCenter[1];this.nextCenter_=l.targetCenter;let S=d+f*(y-d),T=A+f*(w-A);this.targetCenter_=[S,T]}if(l.sourceResolution&&l.targetResolution){let d=f===1?l.targetResolution:l.sourceResolution+f*(l.targetResolution-l.sourceResolution);if(l.anchor){let A=this.getViewportSize_(this.getRotation()),y=this.constraints_.resolution(d,0,A,!0);this.targetCenter_=this.calculateCenterZoom(y,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){let d=f===1?Ah(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+f*(l.targetRotation-l.sourceRotation);if(l.anchor){let A=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(A,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(s){this.animations_[n]=null,this.setHint(so.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&e3(o,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n,r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-t[0],r[1]-t[1]],$1(n,e-this.getRotation()),CW(n,t)),n}calculateCenterZoom(e,t){let n,r=this.getCenterInternal(),s=this.getResolution();if(r!==void 0&&s!==void 0){let o=t[0]-e*(t[0]-r[0])/s,a=t[1]-e*(t[1]-r[1])/s;n=[o,a]}return n}getViewportSize_(e){let t=this.viewportSize_;if(e){let n=t[0],r=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(r*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let e=this.getCenterInternal();return e&&Iy(e,this.getProjection())}getCenterInternal(){return this.get(Gc.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){let t=this.calculateExtentInternal(e);return Mp(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();jn(t,"The view center is not defined");let n=this.getResolution();jn(n!==void 0,"The view resolution is not defined");let r=this.getRotation();return jn(r!==void 0,"The view rotation is not defined"),Ey(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(Gc.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(Su(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=Kn(e)/t[0],r=Nr(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e=e||2;let t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(s){return t/Math.pow(e,s*r)})}getRotation(){return this.get(Gc.ROTATION)}getValueForResolutionFunction(e){let t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,s=Math.log(n/r)/t;return(function(o){return Math.log(n/o)/t/s})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e),n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){let e=this.getProjection(),t=this.getResolution(),n=this.getRotation(),r=this.getCenterInternal(),s=this.padding_;if(s){let o=this.getViewportSizeMinusPadding_();r=B5(r,this.getViewportSize_(),[o[0]/2+s[3],o[1]/2+s[0]],t,n)}return{center:r.slice(0),projection:e!==void 0?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e,t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,r;if(this.resolutions_){let s=tv(this.resolutions_,e,1);t=s,n=this.resolutions_[s],s==this.resolutions_.length-1?r=2:r=n/this.resolutions_[s+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=Si(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,Si(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(jn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){jn(!mh(e),"Cannot fit empty extent provided as `geometry`");let r=Su(e,this.getProjection());n=BN(r)}else if(e.getType()==="Circle"){let r=Su(e.getExtent(),this.getProjection());n=BN(r),n.rotate(this.getRotation(),dl(r))}else{let r=sA();r?n=e.clone().transform(r,this.getProjection()):n=e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),s=e.getFlatCoordinates(),o=e.getStride(),a=1/0,l=1/0,c=-1/0,u=-1/0;for(let f=0,d=s.length;f<d;f+=o){let A=s[f]*n-s[f+1]*r,y=s[f]*r+s[f+1]*n;a=Math.min(a,A),l=Math.min(l,y),c=Math.max(c,A),u=Math.max(u,y)}return[a,l,c,u]}fitInternal(e,t){t=t||{};let n=t.size;n||(n=this.getViewportSizeMinusPadding_());let r=t.padding!==void 0?t.padding:[0,0,0,0],s=t.nearest!==void 0?t.nearest:!1,o;t.minResolution!==void 0?o=t.minResolution:t.maxZoom!==void 0?o=this.getResolutionForZoom(t.maxZoom):o=0;let a=this.rotatedExtentForGeometry(e),l=this.getResolutionForExtentInternal(a,[n[0]-r[1]-r[3],n[1]-r[0]-r[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,s?0:1);let c=this.getRotation(),u=Math.sin(c),f=Math.cos(c),d=dl(a);d[0]+=(r[1]-r[3])/2*l,d[1]+=(r[0]-r[2])/2*l;let A=d[0]*f-d[1]*u,y=d[1]*f+d[0]*u,w=this.getConstrainedCenter([A,y],l),S=t.callback?t.callback:rd;t.duration!==void 0?this.animateInternal({resolution:l,center:w,duration:t.duration,easing:t.easing},S):(this.targetResolution_=l,this.targetCenter_=w,this.applyTargetState_(!1,!0),e3(S,!0))}centerOn(e,t,n){this.centerOnInternal(wu(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(B5(e,t,n,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,n,r){let s,o=this.padding_;if(o&&e){let a=this.getViewportSizeMinusPadding_(-n),l=B5(e,r,[a[0]/2+o[3],a[1]/2+o[0]],t,n);s=[e[0]-l[0],e[1]-l[1]]}return s}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){let t=Iy(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){let t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&wu(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*e,0,r,n);t&&(this.targetCenter_=this.calculateCenterZoom(s,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=wu(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+e,n);t&&(this.targetCenter_=this.calculateCenterRotate(r,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&wu(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){let n=this.getAnimating()||this.getInteracting()||t,r=this.constraints_.rotation(this.targetRotation_,n),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,0,s,n),a=this.constraints_.center(this.targetCenter_,o,s,n,this.calculateCenterShift(this.targetCenter_,o,r,s));this.get(Gc.ROTATION)!==r&&this.set(Gc.ROTATION,r),this.get(Gc.RESOLUTION)!==o&&(this.set(Gc.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Gc.CENTER)||!tA(this.get(Gc.CENTER),a))&&this.set(Gc.CENTER,a),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,n){e=e!==void 0?e:200;let r=t||0,s=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(s),a=this.constraints_.resolution(this.targetResolution_,r,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,s,o));if(e===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=s,this.targetCenter_=l,this.applyTargetState_();return}n=n||(e===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==s||!this.getCenterInternal()||!tA(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:Fc,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(so.INTERACTING,1)}endInteraction(e,t,n){n=n&&wu(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(so.INTERACTING,-1),this.resolveConstraints(e,t,n))}getConstrainedCenter(e,t){let n=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),n)}getConstrainedZoom(e,t){let n=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(n,t))}getConstrainedResolution(e,t){t=t||0;let n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,n)}};function e3(i,e){setTimeout(function(){i(e)},0)}function m0e(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return I5(i.extent,i.constrainOnlyCenter,t)}let e=sE(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,I5(t,!1,!1)}return p$}function A0e(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:F5,a=i.maxZoom!==void 0?i.maxZoom:28,l=i.zoomFactor!==void 0?i.zoomFactor:2,c=i.multiWorld!==void 0?i.multiWorld:!1,u=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,f=i.showFullExtent!==void 0?i.showFullExtent:!1,d=sE(i.projection,"EPSG:3857"),A=d.getExtent(),y=i.constrainOnlyCenter,w=i.extent;if(!c&&!w&&d.isGlobal()&&(y=!1,w=A),i.resolutions!==void 0){let S=i.resolutions;t=S[o],n=S[a]!==void 0?S[a]:S[S.length-1],i.constrainResolution?e=m$(S,u,!y&&w,f):e=D5(t,n,u,!y&&w,f)}else{let T=(A?Math.max(Kn(A),Nr(A)):360*ed.degrees/d.getMetersPerUnit())/256/Math.pow(2,F5),R=T/Math.pow(2,28-F5);t=i.maxResolution,t!==void 0?o=0:t=T/Math.pow(l,o),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=t/Math.pow(l,a):n=T/Math.pow(l,a):n=R),a=o+Math.floor(Math.log(t/n)/Math.log(l)),n=t/Math.pow(l,a-o),i.constrainResolution?e=A$(l,t,n,u,!y&&w,f):e=D5(t,n,u,!y&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function g0e(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?v$():t===!1?N5:typeof t=="number"?g$(t):N5}return _v}function v0e(i){return!(i.sourceCenter&&i.targetCenter&&!tA(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function B5(i,e,t,n,r){let s=Math.cos(-r),o=Math.sin(-r),a=i[0]*s-i[1]*o,l=i[1]*s+i[0]*o;a+=(e[0]/2-t[0])*n,l+=(t[1]-e[1]/2)*n,o=-o;let c=a*s-l*o,u=l*s+a*o;return[c,u]}var Yl=O5;var U5=class extends zs{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let t=0,n=this.listenerKeys.length;t<n;++t)li(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=e,e){let t=this.target_??e.getOverlayContainerStopEvent();this.element&&t.appendChild(this.element),this.render!==rd&&this.listenerKeys.push(qn(e,Sh.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},xv=U5;var k5=class extends xv{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=e.collapsed!==void 0?e.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible!==void 0?e.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;let t=e.className!==void 0?e.className:"ol-attribution",n=e.tipLabel!==void 0?e.tipLabel:"Attributions",r=e.expandClassName!==void 0?e.expandClassName:t+"-expand",s=e.collapseLabel!==void 0?e.collapseLabel:"\u203A",o=e.collapseClassName!==void 0?e.collapseClassName:t+"-collapse";typeof s=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=o):this.collapseLabel_=s;let a=e.label!==void 0?e.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=r):this.label_=a;let l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(nn.CLICK,this.handleClick_.bind(this),!1);let c=t+" "+Op+" "+dv+(this.collapsed_&&this.collapsible_?" "+ZN:"")+(this.collapsible_?"":" ol-uncollapsible"),u=this.element;u.className=c,u.appendChild(this.toggleButton_),u.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){let t=this.getMap().getAllLayers(),n=new Set(t.flatMap(r=>r.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(r=>n.add(r)):n.add(this.attributions_)),!this.overrideCollapsible_){let r=!t.some(s=>s.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(r)}return Array.from(n)}async updateElement_(e){if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}let t=await Promise.all(this.collectSourceAttributions_(e).map(r=>pj(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!ta(t,this.renderedAttributions_)){yj(this.ulElement_);for(let r=0,s=t.length;r<s;++r){let o=document.createElement("li");o.innerHTML=t[r],this.ulElement_.appendChild(o)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(ZN),this.collapsed_?rN(this.collapseLabel_,this.label_):rN(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,!(!this.collapsible_||this.collapsed_===e)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}},_$=k5;var z5=class extends xv{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});let t=e.className!==void 0?e.className:"ol-rotate",n=e.label!==void 0?e.label:"\u21E7",r=e.compassClassName!==void 0?e.compassClassName:"ol-compass";this.label_=null,typeof n=="string"?(this.label_=document.createElement("span"),this.label_.className=r,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(r));let s=e.tipLabel?e.tipLabel:"Reset rotation",o=document.createElement("button");o.className=t+"-reset",o.setAttribute("type","button"),o.title=s,o.appendChild(this.label_),o.addEventListener(nn.CLICK,this.handleClick_.bind(this),!1);let a=t+" "+Op+" "+dv,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration!==void 0?e.duration:250,this.autoHide_=e.autoHide!==void 0?e.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Qy)}handleClick_(e){e.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){let t=this.getMap().getView();if(!t)return;let n=t.getRotation();n!==void 0&&(this.duration_>0&&n%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:Fc}):t.setRotation(0))}render(e){let t=e.frameState;if(!t)return;let n=t.viewState.rotation;if(n!=this.rotation_){let r="rotate("+n+"rad)";if(this.autoHide_){let s=this.element.classList.contains(Qy);!s&&n===0?this.element.classList.add(Qy):s&&n!==0&&this.element.classList.remove(Qy)}this.label_.style.transform=r}this.rotation_=n}},x$=z5;var V5=class extends xv{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});let t=e.className!==void 0?e.className:"ol-zoom",n=e.delta!==void 0?e.delta:1,r=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",s=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",o=e.zoomInLabel!==void 0?e.zoomInLabel:"+",a=e.zoomOutLabel!==void 0?e.zoomOutLabel:"\u2013",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",c=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=l,u.appendChild(typeof o=="string"?document.createTextNode(o):o),u.addEventListener(nn.CLICK,this.handleClick_.bind(this,n),!1);let f=document.createElement("button");f.className=s,f.setAttribute("type","button"),f.title=c,f.appendChild(typeof a=="string"?document.createTextNode(a):a),f.addEventListener(nn.CLICK,this.handleClick_.bind(this,-n),!1);let d=t+" "+Op+" "+dv,A=this.element;A.className=d,A.appendChild(u),A.appendChild(f),this.duration_=e.duration!==void 0?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){let n=this.getMap().getView();if(!n)return;let r=n.getZoom();if(r!==void 0){let s=n.getConstrainedZoom(r+e);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:s,duration:this.duration_,easing:Fc})):n.setZoom(s)}}},y$=V5;function t3(i){i=i||{};let e=new Fo;return(i.zoom===void 0||i.zoom)&&e.push(new y$(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new x$(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new _$(i.attributionOptions)),e}var G5=class{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;let e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let n=t-3;for(;n>0&&this.points_[n+2]>e;)n-=3;let r=this.points_[t+2]-this.points_[n+2];if(r<1e3/60)return!1;let s=this.points_[t]-this.points_[n],o=this.points_[t+1]-this.points_[n+1];return this.angle_=Math.atan2(o,s),this.initialVelocity_=Math.sqrt(s*s+o*o)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},b$=G5;var q5={ACTIVE:"active"};var H5=class extends zs{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(q5.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(q5.ACTIVE,e)}setMap(e){this.map_=e}};function w$(i,e,t){let n=i.getCenterInternal();if(n){let r=[n[0]+e[0],n[1]+e[1]];i.animateInternal({duration:t!==void 0?t:250,easing:xj,center:i.getConstrainedCenter(r)})}}function yv(i,e,t,n){let r=i.getZoom();if(r===void 0)return;let s=i.getConstrainedZoom(r+e),o=i.getResolutionForZoom(s);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:o,anchor:t,duration:n!==void 0?n:250,easing:Fc})}var Th=H5;var W5=class extends Th{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:250}handleEvent(e){let t=!1;if(e.type==gr.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();yv(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},S$=W5;function o2(i){let e=arguments;return function(t){let n=!0;for(let r=0,s=e.length;r<s&&(n=n&&e[r](t),!!n);++r);return n}}var T$=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},_0e=function(i){let e=i.map.getTargetElement(),t=e.getRootNode(),n=i.map.getOwnerDocument().activeElement;return t instanceof ShadowRoot?t.host.contains(n):e.contains(n)},n3=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?_0e(i):!0},E$=nd;var i3=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(mj&&JD&&e.ctrlKey)};var r3=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var M$=function(i){let e=i.originalEvent;return JD?e.metaKey:e.ctrlKey},C$=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},s3=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},o3=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var R$=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var j5=class extends Th{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==gr.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==gr.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==gr.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==gr.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};function bv(i){let e=i.length,t=0,n=0;for(let r=0;r<e;r++)t+=i[r].clientX,n+=i[r].clientY;return{clientX:t/e,clientY:n/e}}var Eh=j5;var X5=class extends Eh{constructor(e){super({stopDown:id}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:o2(r3,R$);this.condition_=e.onFocusOnly?o2(n3,t):t,this.noKinetic_=!1}handleDragEvent(e){let t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());let n=this.targetPointers,r=t.getEventPixel(bv(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){let s=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],a=e.map.getView();RW(s,a.getResolution()),$1(s,a.getRotation()),a.adjustCenterInternal(s)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=n.length,e.originalEvent.preventDefault()}handleUpEvent(e){let t=e.map,n=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){let r=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),o=n.getCenterInternal(),a=t.getPixelFromCoordinateInternal(o),l=t.getCoordinateFromPixelInternal([a[0]-r*Math.cos(s),a[1]-r*Math.sin(s)]);n.animateInternal({center:n.getConstrainedCenter(l),duration:500,easing:Fc})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){let n=e.map.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},I$=X5;var $5=class extends Eh{constructor(e){e=e||{},super({stopDown:id}),this.condition_=e.condition?e.condition:T$,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!o3(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===_v)return;let r=t.getSize(),s=e.pixel,o=Math.atan2(r[1]/2-s[1],s[0]-r[0]/2);if(this.lastAngle_!==void 0){let a=o-this.lastAngle_;n.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(e){return o3(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return o3(e)&&i3(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},P$=$5;var Y5=class extends Ip{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){let e=this.startPixel_,t=this.endPixel_,n="px",r=this.element_.style;r.left=Math.min(e[0],t[0])+n,r.top=Math.min(e[1],t[1])+n,r.width=Math.abs(t[0]-e[0])+n,r.height=Math.abs(t[1]-e[1])+n}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);let t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;let e=this.startPixel_,t=this.endPixel_,r=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new xh([r])}getGeometry(){return this.geometry_}},L$=Y5;var wv={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},wA=class extends Ao{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},Z5=class extends Eh{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new L$(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??i3,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){let r=n[0]-t[0],s=n[1]-t[1];return r*r+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new wA(wv.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;let t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new wA(t?wv.BOXEND:wv.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new wA(wv.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new wA(wv.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new wA(wv.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},D$=Z5;var K5=class extends D${constructor(e){e=e||{};let t=e.condition?e.condition:C$;super({condition:t,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=e.duration!==void 0?e.duration:200,this.out_=e.out!==void 0?e.out:!1}onBoxEnd(e){let n=this.getMap().getView(),r=this.getGeometry();if(this.out_){let s=n.rotatedExtentForGeometry(r),o=n.getResolutionForExtentInternal(s),a=n.getResolution()/o;r=r.clone(),r.scale(a*a)}n.fitInternal(r,{duration:this.duration_,easing:Fc})}},N$=K5;var Vp={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var Q5=class extends Th{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return r3(t)&&s3(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==nn.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Vp.DOWN||r==Vp.LEFT||r==Vp.RIGHT||r==Vp.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==Vp.DOWN?c=-a:r==Vp.LEFT?l=-a:r==Vp.RIGHT?l=a:c=a;let u=[l,c];$1(u,o.getRotation()),w$(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},F$=Q5;var J5=class extends Th{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!M$(t)&&s3(t)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:100}handleEvent(e){let t=!1;if(e.type==nn.KEYDOWN||e.type==nn.KEYPRESS){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==="+"||r==="-")){let s=e.map,o=r==="+"?this.delta_:-this.delta_,a=s.getView();yv(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},B$=J5;var x0e=40,y0e=300,b0e=3,e6=class extends Th{constructor(e){e=e||{},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta!==void 0?e.maxDelta:1,this.duration_=e.duration!==void 0?e.duration:250,this.timeout_=e.timeout!==void 0?e.timeout:80,this.useAnchor_=e.useAnchor!==void 0?e.useAnchor:!0,this.constrainResolution_=e.constrainResolution!==void 0?e.constrainResolution:!1;let t=e.condition?e.condition:E$;this.condition_=e.onFocusOnly?o2(n3,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(e){if(this.ctrlKeyListenerKeys_.forEach(li),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(qn(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),qn(t,"keyup",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;let e=this.getMap();if(!e)return;let t=e.getView(),n=this.lastDelta_?this.lastDelta_>0?1:-1:0;t.endInteraction(this.constrainResolution_||t.getConstrainResolution()?100:void 0,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==nn.WHEEL)return!0;let n=e.map,r=e.originalEvent;r.preventDefault();let s=r.ctrlKey&&!this.ctrlKeyPressed_;r.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=e.pixel);let o=r.deltaY;switch(r.deltaMode){case WheelEvent.DOM_DELTA_LINE:o*=x0e;break;case WheelEvent.DOM_DELTA_PAGE:o*=y0e;break;default:}if(o===0)return!1;this.lastDelta_=o;let a=Date.now();this.startTime_===void 0&&(this.startTime_=a),(!this.mode_||a-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(o)<4?"trackpad":"wheel");let l=n.getView();if(this.mode_==="trackpad")return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(l.getAnimating()&&l.cancelAnimations(),l.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s&&(o=o*b0e),l.adjustZoom(-o/this.deltaPerZoom_,this.lastAnchor_?n.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=a,!1;this.totalDelta_+=o;let c=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),c),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-Si(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),yv(t,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}},O$=e6;var t6=class extends Eh{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=id),super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold!==void 0?e.threshold:.3,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){let t=0,n=this.targetPointers[0],r=this.targetPointers[1],s=Math.atan2(r.clientY-n.clientY,r.clientX-n.clientX);if(this.lastAngle_!==void 0){let l=s-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=l}this.lastAngle_=s;let o=e.map,a=o.getView();a.getConstraints().rotation!==_v&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(bv(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},U$=t6;var n6=class extends Eh{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=id),super(t),this.anchor_=null,this.duration_=e.duration!==void 0?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1,n=this.targetPointers[0],r=this.targetPointers[1],s=n.clientX-r.clientX,o=n.clientY-r.clientY,a=Math.sqrt(s*s+o*o);this.lastDistance_!==void 0&&(t=this.lastDistance_/a),this.lastDistance_=a;let l=e.map,c=l.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(bv(this.targetPointers))),l.render(),c.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){let n=e.map.getView(),r=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,r),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},k$=n6;function a3(i){i=i||{};let e=new Fo,t=new b$(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new P$),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new S$({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new I$({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new U$),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new k$({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new F$),e.push(new B$({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new O$({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new N$({duration:i.zoomDuration})),e}var Ni={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var i6=class extends zs{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[Ni.OPACITY]=e.opacity!==void 0?e.opacity:1,jn(typeof t[Ni.OPACITY]=="number","Layer opacity must be a number"),t[Ni.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ni.Z_INDEX]=e.zIndex,t[Ni.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ni.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ni.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ni.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0?!0:e},n=this.getZIndex();return t.opacity=Si(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return ei()}getLayerStatesArray(e){return ei()}getExtent(){return this.get(Ni.EXTENT)}getMaxResolution(){return this.get(Ni.MAX_RESOLUTION)}getMinResolution(){return this.get(Ni.MIN_RESOLUTION)}getMinZoom(){return this.get(Ni.MIN_ZOOM)}getMaxZoom(){return this.get(Ni.MAX_ZOOM)}getOpacity(){return this.get(Ni.OPACITY)}getSourceState(){return ei()}getVisible(){return this.get(Ni.VISIBLE)}getZIndex(){return this.get(Ni.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ni.EXTENT,e)}setMaxResolution(e){this.set(Ni.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ni.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ni.MAX_ZOOM,e)}setMinZoom(e){this.set(Ni.MIN_ZOOM,e)}setOpacity(e){jn(typeof e=="number","Layer opacity must be a number"),this.set(Ni.OPACITY,e)}setVisible(e){this.set(Ni.VISIBLE,e)}setZIndex(e){this.set(Ni.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},l3=i6;var Gp={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Cu=class extends Ao{constructor(e,t){super(e),this.layer=t}},r6={LAYERS:"layers"},s6=class i extends l3{constructor(e){e=e||{};let t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(r6.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new Fo(n.slice(),{unique:!0}):jn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new Fo(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(li),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(qn(e,vo.ADD,this.handleLayersAdd_,this),qn(e,vo.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(li);gh(this.listenerKeys_);let t=e.getArray();for(let n=0,r=t.length;n<r;n++){let s=t[n];this.registerLayerListeners_(s),this.dispatchEvent(new Cu(Gp.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[qn(e,Tu.PROPERTYCHANGE,this.handleLayerChange_,this),qn(e,nn.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(qn(e,Gp.ADDLAYER,this.handleLayerGroupAdd_,this),qn(e,Gp.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Bn(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Cu(Gp.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Cu(Gp.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Cu(Gp.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=Bn(t);this.listenerKeys_[n].forEach(li),delete this.listenerKeys_[n],this.dispatchEvent(new Cu(Gp.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(r6.LAYERS)}setLayers(e){let t=this.getLayers();if(t){let n=t.getArray();for(let r=0,s=n.length;r<s;++r)this.dispatchEvent(new Cu(Gp.REMOVELAYER,n[r]))}this.set(r6.LAYERS,e)}getLayersArray(e){return e=e!==void 0?e:[],this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){let t=e!==void 0?e:[],n=t.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(t)});let r=this.getLayerState(),s=r.zIndex;!e&&r.zIndex===void 0&&(s=0);for(let o=n,a=t.length;o<a;o++){let l=t[o];l.opacity*=r.opacity,l.visible=l.visible&&r.visible,l.maxResolution=Math.min(l.maxResolution,r.maxResolution),l.minResolution=Math.max(l.minResolution,r.minResolution),l.minZoom=Math.max(l.minZoom,r.minZoom),l.maxZoom=Math.min(l.maxZoom,r.maxZoom),r.extent!==void 0&&(l.extent!==void 0?l.extent=ph(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},a2=s6;var Oo={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var o6=class extends l3{constructor(e){let t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(Ni.SOURCE,this.handleSourcePropertyChange_);let n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(Ni.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(li(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=qn(e,nn.CHANGE,this.handleSourceChange_,this),e.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,n=this.getMapInternal();!e&&n&&(e=n.getView()),e instanceof Yl?t={viewState:e.getState(),extent:e.calculateExtent()}:t=e,!t.layerStatesArray&&n&&(t.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let r;if(t.layerStatesArray){if(r=t.layerStatesArray.find(o=>o.layer===this),!r)return!1}else r=this.getLayerState();let s=this.getExtent();return l2(r,t.viewState)&&(!s||Ar(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof Yl?e.getViewStateAndExtent():e,r=t(n);return Array.isArray(r)||(r=[r]),r}render(e,t){let n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(Ni.MAP,e)}getMapInternal(){return this.get(Ni.MAP)}setMap(e){this.mapPrecomposeKey_&&(li(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(li(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=qn(e,Oo.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=qn(this,nn.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);jn(!t.some(r=>r.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(Ni.SOURCE,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function l2(i,e){if(!i.visible)return!1;let t=e.resolution;if(t<i.minResolution||t>=i.maxResolution)return!1;let n=e.zoom;return n>i.minZoom&&n<=i.maxZoom}var SA=o6;function c3(i,e,t=0,n=i.length-1,r=w0e){for(;n>t;){if(n-t>600){let l=n-t+1,c=e-t+1,u=Math.log(l),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1),A=Math.max(t,Math.floor(e-c*f/l+d)),y=Math.min(n,Math.floor(e+(l-c)*f/l+d));c3(i,e,A,y,r)}let s=i[e],o=t,a=n;for(c2(i,t,e),r(i[n],s)>0&&c2(i,t,n);o<a;){for(c2(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?c2(i,t,a):(a++,c2(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function c2(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function w0e(i,e){return i<e?-1:i>e?1:0}var TA=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,n=[];if(!h3(e,t))return n;let r=this.toBBox,s=[];for(;t;){for(let o=0;o<t.children.length;o++){let a=t.children[o],l=t.leaf?r(a):a;h3(e,l)&&(t.leaf?n.push(a):l6(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!h3(e,t))return!1;let n=[];for(;t;){for(let r=0;r<t.children.length;r++){let s=t.children[r],o=t.leaf?this.toBBox(s):s;if(h3(e,o)){if(t.leaf||l6(e,o))return!0;n.push(s)}}t=n.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let n=0;n<e.length;n++)this.insert(e[n]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){let n=this.data;this.data=t,t=n}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=Tv([]),this}remove(e,t){if(!e)return this;let n=this.data,r=this.toBBox(e),s=[],o=[],a,l,c;for(;n||s.length;){if(n||(n=s.pop(),l=s[s.length-1],a=o.pop(),c=!0),n.leaf){let u=S0e(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&l6(n,r)?(s.push(n),o.push(a),a=0,l=n,n=n.children[0]):l?(a++,n=l.children[a],c=!1):n=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){let n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,r){let s=n-t+1,o=this._maxEntries,a;if(s<=o)return a=Tv(e.slice(t,n+1)),Sv(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=Tv([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));z$(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);z$(e,u,f,l,this.compareMinY);for(let d=u;d<=f;d+=l){let A=Math.min(d+l-1,f);a.children.push(this._build(e,d,A,r-1))}}return Sv(a,this.toBBox),a}_chooseSubtree(e,t,n,r){for(;r.push(t),!(t.leaf||r.length-1===n);){let s=1/0,o=1/0,a;for(let l=0;l<t.children.length;l++){let c=t.children[l],u=a6(c),f=M0e(e,c)-u;f<o?(o=f,s=u<s?u:s,a=c):f===o&&u<s&&(s=u,a=c)}t=a||t.children[0]}return t}_insert(e,t,n){let r=n?e:this.toBBox(e),s=[],o=this._chooseSubtree(r,this.data,t,s);for(o.children.push(e),h2(o,r);t>=0&&s[t].children.length>this._maxEntries;)this._split(s,t),t--;this._adjustParentBBoxes(r,s,t)}_split(e,t){let n=e[t],r=n.children.length,s=this._minEntries;this._chooseSplitAxis(n,s,r);let o=this._chooseSplitIndex(n,s,r),a=Tv(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,Sv(n,this.toBBox),Sv(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=Tv([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Sv(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,s=1/0,o=1/0;for(let a=t;a<=n-t;a++){let l=u2(e,0,a,this.toBBox),c=u2(e,a,n,this.toBBox),u=C0e(l,c),f=a6(l)+a6(c);u<s?(s=u,r=a,o=f<o?f:o):u===s&&f<o&&(o=f,r=a)}return r||n-t}_chooseSplitAxis(e,t,n){let r=e.leaf?this.compareMinX:T0e,s=e.leaf?this.compareMinY:E0e,o=this._allDistMargin(e,t,n,r),a=this._allDistMargin(e,t,n,s);o<a&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);let s=this.toBBox,o=u2(e,0,t,s),a=u2(e,n-t,n,s),l=u3(o)+u3(a);for(let c=t;c<n-t;c++){let u=e.children[c];h2(o,e.leaf?s(u):u),l+=u3(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];h2(a,e.leaf?s(u):u),l+=u3(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)h2(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():Sv(e[t],this.toBBox)}};function S0e(i,e,t){if(!t)return e.indexOf(i);for(let n=0;n<e.length;n++)if(t(i,e[n]))return n;return-1}function Sv(i,e){u2(i,0,i.children.length,e,i)}function u2(i,e,t,n,r){r||(r=Tv(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<t;s++){let o=i.children[s];h2(r,i.leaf?n(o):o)}return r}function h2(i,e){return i.minX=Math.min(i.minX,e.minX),i.minY=Math.min(i.minY,e.minY),i.maxX=Math.max(i.maxX,e.maxX),i.maxY=Math.max(i.maxY,e.maxY),i}function T0e(i,e){return i.minX-e.minX}function E0e(i,e){return i.minY-e.minY}function a6(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function u3(i){return i.maxX-i.minX+(i.maxY-i.minY)}function M0e(i,e){return(Math.max(e.maxX,i.maxX)-Math.min(e.minX,i.minX))*(Math.max(e.maxY,i.maxY)-Math.min(e.minY,i.minY))}function C0e(i,e){let t=Math.max(i.minX,e.minX),n=Math.max(i.minY,e.minY),r=Math.min(i.maxX,e.maxX),s=Math.min(i.maxY,e.maxY);return Math.max(0,r-t)*Math.max(0,s-n)}function l6(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function h3(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function Tv(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function z$(i,e,t,n,r){let s=[e,t];for(;s.length;){if(t=s.pop(),e=s.pop(),t-e<=n)continue;let o=e+Math.ceil((t-e)/n/2)*n;c3(i,o,e,t,r),s.push(e,o,o,t)}}var MA=0,d3=0,ra=1<<MA++,ci=1<<MA++,sa=1<<MA++,La=1<<MA++,dd=1<<MA++,EA=1<<MA++,p3=Math.pow(2,MA)-1,u6={[ra]:"boolean",[ci]:"number",[sa]:"string",[La]:"color",[dd]:"number[]",[EA]:"size"},R0e=Object.keys(u6).map(Number).sort(pl);function I0e(i){return i in u6}function fd(i){let e=[];for(let t of R0e)f2(i,t)&&e.push(u6[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function f2(i,e){return(i&e)===e}function f3(i,e){return!!(i&e)}function qp(i,e){return i===e}var $r=class{constructor(e,t){if(!I0e(e))throw new Error(`literal expressions must have a specific type, got ${fd(e)}`);this.type=e,this.value=t}},m3=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function A3(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function fs(i,e,t){switch(typeof i){case"boolean":{if(qp(e,sa))return new $r(sa,i?"true":"false");if(!f2(e,ra))throw new Error(`got a boolean, but expected ${fd(e)}`);return new $r(ra,i)}case"number":{if(qp(e,EA))return new $r(EA,cs(i));if(qp(e,ra))return new $r(ra,!!i);if(qp(e,sa))return new $r(sa,i.toString());if(!f2(e,ci))throw new Error(`got a number, but expected ${fd(e)}`);return new $r(ci,i)}case"string":{if(qp(e,La))return new $r(La,Yy(i));if(qp(e,ra))return new $r(ra,!!i);if(!f2(e,sa))throw new Error(`got a string, but expected ${fd(e)}`);return new $r(sa,i)}default:}if(!Array.isArray(i))throw new Error("expression must be an array or a primitive value");if(i.length===0)throw new Error("empty expression");if(typeof i[0]=="string")return G0e(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(qp(e,EA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new $r(EA,i)}if(qp(e,La)){if(i.length===3)return new $r(La,[...i,1]);if(i.length===4)return new $r(La,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!f2(e,dd))throw new Error(`got an array of numbers, but expected ${fd(e)}`);return new $r(dd,i)}var et={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},P0e={[et.Get]:Un(ti(1,1/0),V$),[et.Var]:L0e(),[et.Has]:Un(ti(1,1/0),V$),[et.Id]:Un(D0e,Ev),[et.Concat]:Un(ti(2,1/0),Qi(sa)),[et.GeometryType]:Un(N0e,Ev),[et.LineMetric]:Un(F0e,Ev),[et.Resolution]:Un(c6,Ev),[et.Zoom]:Un(c6,Ev),[et.Time]:Un(c6,Ev),[et.Any]:Un(ti(2,1/0),Qi(ra)),[et.All]:Un(ti(2,1/0),Qi(ra)),[et.Not]:Un(ti(1,1),Qi(ra)),[et.Equal]:Un(ti(2,2),q$()),[et.NotEqual]:Un(ti(2,2),q$()),[et.GreaterThan]:Un(ti(2,2),Qi(ci)),[et.GreaterThanOrEqualTo]:Un(ti(2,2),Qi(ci)),[et.LessThan]:Un(ti(2,2),Qi(ci)),[et.LessThanOrEqualTo]:Un(ti(2,2),Qi(ci)),[et.Multiply]:Un(ti(2,1/0),G$),[et.Coalesce]:Un(ti(2,1/0),G$),[et.Divide]:Un(ti(2,2),Qi(ci)),[et.Add]:Un(ti(2,1/0),Qi(ci)),[et.Subtract]:Un(ti(2,2),Qi(ci)),[et.Clamp]:Un(ti(3,3),Qi(ci)),[et.Mod]:Un(ti(2,2),Qi(ci)),[et.Pow]:Un(ti(2,2),Qi(ci)),[et.Abs]:Un(ti(1,1),Qi(ci)),[et.Floor]:Un(ti(1,1),Qi(ci)),[et.Ceil]:Un(ti(1,1),Qi(ci)),[et.Round]:Un(ti(1,1),Qi(ci)),[et.Sin]:Un(ti(1,1),Qi(ci)),[et.Cos]:Un(ti(1,1),Qi(ci)),[et.Atan]:Un(ti(1,2),Qi(ci)),[et.Sqrt]:Un(ti(1,1),Qi(ci)),[et.Match]:Un(ti(4,1/0),H$,O0e),[et.Between]:Un(ti(3,3),Qi(ci)),[et.Interpolate]:Un(ti(6,1/0),H$,U0e),[et.Case]:Un(ti(3,1/0),B0e,k0e),[et.In]:Un(ti(2,2),z0e),[et.Number]:Un(ti(1,1/0),Qi(p3)),[et.String]:Un(ti(1,1/0),Qi(p3)),[et.Array]:Un(ti(1,1/0),Qi(ci)),[et.Color]:Un(ti(1,4),Qi(ci)),[et.Band]:Un(ti(1,3),Qi(ci)),[et.Palette]:Un(ti(2,2),V0e),[et.ToString]:Un(ti(1,1),Qi(ra|ci|sa|La))};function V$(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=i[s+1];switch(typeof o){case"number":{r[s]=new $r(ci,o);break}case"string":{r[s]=new $r(sa,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}s===0&&t.properties.set(String(o),e)}return r}function L0e(){return function(i,e,t){let n=i[1];if(typeof n!="string")throw new Error("expected a string argument for var operation");let r=e,s=t.inputVariables?.[n];if(s!==void 0){let o=fs(s,p3,t);if(!(o instanceof $r))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&f3(r,La)&&!f3(r,sa)?a=La:Array.isArray(s)&&s.length===2&&f3(r,EA)&&!f3(r,dd)&&(a=EA),r&=a,r===d3)throw new Error(`the type expected from the var operator (${fd(e)}) did not have any overlap with the type of the corresponding style variables (${fd(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===d3)throw new Error(`a new type expected from the var operator (${fd(e)}) did not have any overlap with the previous type expected for it (${fd(o)}), variable name: ${n}`)}return t.variables.set(n,r),new m3(r,"var",new $r(sa,n))}}function D0e(i,e,t){t.featureId=!0}function N0e(i,e,t){t.geometryType=!0}function F0e(i,e,t){t.mCoordinate=!0}function c6(i,e,t){t.mapState=!0}function Ev(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function ti(i,e){return function(t,n,r){let s=t[0],o=t.length-1;if(i===e){if(o!==i){let a=i===1?"":"s";throw new Error(`expected ${i} argument${a} for ${s}, got ${o}`)}}else if(o<i||o>e){let a=e===1/0?`${i} or more`:`${i} to ${e}`;throw new Error(`expected ${a} arguments for ${s}, got ${o}`)}}}function G$(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=fs(i[s+1],e,t);r[s]=o}return r}function Qi(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=fs(e[o+1],i,n);s[o]=a}return s}}function q$(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=p3;for(let a=0;a<r;++a){let l=fs(i[a+1],o,t);o&=l.type}if(o===d3)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=fs(i[a+1],o,t);s[a]=l}return s}}function B0e(i,e,t){let n=i[0],r=i.length-1;if(r%2===0)throw new Error(`expected an odd number of arguments for ${n}, got ${r} instead`)}function H$(i,e,t){let n=i[0],r=i.length-1;if(r%2===1)throw new Error(`expected an even number of arguments for operation ${n}, got ${r} instead`)}function O0e(i,e,t){let n=i.length-1,r=fs(i[i.length-1],e,t),s=sa|ci|ra,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=fs(i[l+2],s,t);s&=c.type}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}if(s===d3)throw new Error("no common type was found among the arguments of match expression")}for(let l=0;l<n-2;l+=2){try{let c=fs(i[l+2],s,t);o[l]=c}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}try{let c=fs(i[l+3],r.type,t);o[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+2} of match expression: ${c.message}`)}}return[fs(i[1],s,t),...o,r]}function U0e(i,e,t){let n=i[1],r;switch(n[0]){case"linear":r=1;break;case"exponential":let l=n[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);r=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}let s=new $r(ci,r),o;try{o=fs(i[2],ci,t)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}let a=new Array(i.length-3);for(let l=0;l<a.length;l+=2){try{let c=fs(i[l+3],ci,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{let c=fs(i[l+4],e,t);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${c.message}`)}}return[s,o,...a]}function k0e(i,e,t){let n=fs(i[i.length-1],e,t),r=new Array(i.length-1);for(let s=0;s<r.length-1;s+=2){try{let o=fs(i[s+1],ra,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=fs(i[s+2],n.type,t);r[s+1]=o}catch(o){throw new Error(`failed to parse argument ${s+1} of case expression: ${o.message}`)}}return r[r.length-1]=n,r}function z0e(i,e,t){let n=i[2];if(!Array.isArray(n))throw new Error('the second argument for the "in" operator must be an array');let r;if(n[0]==="literal"){if(n=n[1],!Array.isArray(n))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if(typeof n[0]=="string")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');typeof n[0]=="string"?r=sa:r=ci;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=fs(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[fs(i[1],r,t),...s]}function V0e(i,e,t){let n;try{n=fs(i[1],ci,t)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}let r=i[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");let s=new Array(r.length);for(let o=0;o<s.length;o++){let a;try{a=fs(r[o],La,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof $r))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Un(...i){return function(e,t,n){let r=e[0],s;for(let o=0;o<i.length;o++){let a=i[o](e,t,n);if(o==i.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");s=a}}return new m3(t,r,...s)}}function G0e(i,e,t){let n=i[0],r=P0e[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function g3(i){if(!i)return"";let e=i.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return g3(i.getGeometries()[0]);default:return""}}function h6(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Iu(i,e,t){let n=fs(i,e,t);return Ru(n,t)}function Ru(i,e){if(i instanceof $r){if(i.type===La&&typeof i.value=="string"){let n=Yy(i.value);return function(){return n}}return function(){return i.value}}let t=i.operator;switch(t){case et.Number:case et.String:case et.Coalesce:return q0e(i,e);case et.Get:case et.Var:case et.Has:return H0e(i,e);case et.Id:return n=>n.featureId;case et.GeometryType:return n=>n.geometryType;case et.Concat:{let n=i.args.map(r=>Ru(r,e));return r=>"".concat(...n.map(s=>s(r).toString()))}case et.Resolution:return n=>n.resolution;case et.Any:case et.All:case et.Between:case et.In:case et.Not:return j0e(i,e);case et.Equal:case et.NotEqual:case et.LessThan:case et.LessThanOrEqualTo:case et.GreaterThan:case et.GreaterThanOrEqualTo:return W0e(i,e);case et.Multiply:case et.Divide:case et.Add:case et.Subtract:case et.Clamp:case et.Mod:case et.Pow:case et.Abs:case et.Floor:case et.Ceil:case et.Round:case et.Sin:case et.Cos:case et.Atan:case et.Sqrt:return X0e(i,e);case et.Case:return $0e(i,e);case et.Match:return Y0e(i,e);case et.Interpolate:return Z0e(i,e);case et.ToString:return K0e(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function q0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Ru(i.args[s],e);switch(t){case et.Coalesce:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case et.Number:case et.String:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a===t)return a}throw new Error(`Expected one of the values to be a ${t}`)};default:throw new Error(`Unsupported assertion operator ${t}`)}}function H0e(i,e){let n=i.args[0].value;switch(i.operator){case et.Get:return r=>{let s=i.args,o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;o=o[u]}return o};case et.Var:return r=>r.variables[n];case et.Has:return r=>{let s=i.args;if(!(n in r.properties))return!1;let o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;if(!o||!Object.hasOwn(o,u))return!1;o=o[u]}return!0};default:throw new Error(`Unsupported accessor operator ${i.operator}`)}}function W0e(i,e){let t=i.operator,n=Ru(i.args[0],e),r=Ru(i.args[1],e);switch(t){case et.Equal:return s=>n(s)===r(s);case et.NotEqual:return s=>n(s)!==r(s);case et.LessThan:return s=>n(s)<r(s);case et.LessThanOrEqualTo:return s=>n(s)<=r(s);case et.GreaterThan:return s=>n(s)>r(s);case et.GreaterThanOrEqualTo:return s=>n(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${t}`)}}function j0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Ru(i.args[s],e);switch(t){case et.Any:return s=>{for(let o=0;o<n;++o)if(r[o](s))return!0;return!1};case et.All:return s=>{for(let o=0;o<n;++o)if(!r[o](s))return!1;return!0};case et.Between:return s=>{let o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case et.In:return s=>{let o=r[0](s);for(let a=1;a<n;++a)if(o===r[a](s))return!0;return!1};case et.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${t}`)}}function X0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Ru(i.args[s],e);switch(t){case et.Multiply:return s=>{let o=1;for(let a=0;a<n;++a)o*=r[a](s);return o};case et.Divide:return s=>r[0](s)/r[1](s);case et.Add:return s=>{let o=0;for(let a=0;a<n;++a)o+=r[a](s);return o};case et.Subtract:return s=>r[0](s)-r[1](s);case et.Clamp:return s=>{let o=r[0](s),a=r[1](s);if(o<a)return a;let l=r[2](s);return o>l?l:o};case et.Mod:return s=>r[0](s)%r[1](s);case et.Pow:return s=>Math.pow(r[0](s),r[1](s));case et.Abs:return s=>Math.abs(r[0](s));case et.Floor:return s=>Math.floor(r[0](s));case et.Ceil:return s=>Math.ceil(r[0](s));case et.Round:return s=>Math.round(r[0](s));case et.Sin:return s=>Math.sin(r[0](s));case et.Cos:return s=>Math.cos(r[0](s));case et.Atan:return n===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case et.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${t}`)}}function $0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Ru(i.args[r],e);return r=>{for(let s=0;s<t-1;s+=2)if(n[s](r))return n[s+1](r);return n[t-1](r)}}function Y0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Ru(i.args[r],e);return r=>{let s=n[0](r);for(let o=1;o<t-1;o+=2)if(s===n[o](r))return n[o+1](r);return n[t-1](r)}}function Z0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Ru(i.args[r],e);return r=>{let s=n[0](r),o=n[1](r),a,l;for(let c=2;c<t;c+=2){let u=n[c](r),f=n[c+1](r),d=Array.isArray(f);if(d&&(f=pX(f)),u>=o)return c===2?f:d?Q0e(s,o,a,l,u,f):d2(s,o,a,l,u,f);a=u,l=f}return l}}function K0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Ru(i.args[s],e);if(t===et.ToString)return s=>{let o=r[0](s);return i.args[0].type===La?Zy(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function d2(i,e,t,n,r,s){let o=r-t;if(o===0)return n;let a=e-t,l=i===1?a/o:(Math.pow(i,a)-1)/(Math.pow(i,o)-1);return n+l*(s-n)}function Q0e(i,e,t,n,r,s){if(r-t===0)return n;let a=XN(n),l=XN(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[d2(i,e,t,a[0],r,l[0]),d2(i,e,t,a[1],r,l[1]),a[2]+d2(i,e,t,0,r,c),d2(i,e,t,n[3],r,s[3])];return mX(u)}function J0e(i){return!0}function eme(i,e){e=e??A3();let t=tme(i,e),n=h6();return function(r,s){if(n.properties=r.getPropertiesInternal(),n.resolution=s,e.featureId){let o=r.getId();o!==void 0?n.featureId=o:n.featureId=null}return e.geometryType&&(n.geometryType=g3(r.getGeometry())),t(n)}}function W$(i,e){e=e??A3();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=f6(i[o],e);let r=h6(),s=new Array(t);return function(o,a){if(r.properties=o.getPropertiesInternal(),r.resolution=a,e.featureId){let c=o.getId();c!==void 0?r.featureId=c:r.featureId=null}e.geometryType&&(r.geometryType=g3(o.getGeometry()));let l=0;for(let c=0;c<t;++c){let u=n[c](r);u&&(s[l]=u,l+=1)}return s.length=l,s}}function Y$(i,e){if(e=e??A3(),!Array.isArray(i))return W$([i],e);let t=i.length;if("style"in i[0]){let s=new Array(t);for(let o=0;o<t;++o){let a=i[o];if(!("style"in a))throw new Error("Expected a list of rules with a style property");s[o]=a}return eme(s,e)}return W$(i,e)}function tme(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r],o="filter"in s?Iu(s.filter,ra,e):J0e,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=f6(s.style[c],e)}else a=[f6(s.style,e)];n[r]={filter:o,styles:a}}return function(r){let s=[],o=!1;for(let a=0;a<t;++a){let l=n[a].filter;if(l(r)&&!(i[a].else&&o)){o=!0;for(let c of n[a].styles){let u=c(r);u&&s.push(u)}}}return s}}function f6(i,e){let t=p2(i,"",e),n=m2(i,"",e),r=nme(i,e),s=ime(i,e),o=Uo(i,"z-index",e);if(!t&&!n&&!r&&!s&&!yu(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new Fr;return function(l){let c=!0;if(t){let u=t(l);u&&(c=!1),a.setFill(u)}if(n){let u=n(l);u&&(c=!1),a.setStroke(u)}if(r){let u=r(l);u&&(c=!1),a.setText(u)}if(s){let u=s(l);u&&(c=!1),a.setImage(u)}return o&&a.setZIndex(o(l)),c?null:a}}function p2(i,e,t){let n;if(e+"fill-pattern-src"in i)n=ame(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=_3(i,e+"fill-color",t)}if(!n)return null;let r=new hs;return function(s){let o=n(s);return o===OE?null:(r.setColor(o),r)}}function m2(i,e,t){let n=Uo(i,e+"stroke-width",t),r=_3(i,e+"stroke-color",t);if(!n&&!r)return null;let s=pd(i,e+"stroke-line-cap",t),o=pd(i,e+"stroke-line-join",t),a=Z$(i,e+"stroke-line-dash",t),l=Uo(i,e+"stroke-line-dash-offset",t),c=Uo(i,e+"stroke-miter-limit",t),u=Uo(i,e+"stroke-offset",t),f=new Es;return function(d){if(r){let A=r(d);if(A===OE)return null;f.setColor(A)}if(n&&f.setWidth(n(d)),s){let A=s(d);if(A!=="butt"&&A!=="round"&&A!=="square")throw new Error("Expected butt, round, or square line cap");f.setLineCap(A)}if(o){let A=o(d);if(A!=="bevel"&&A!=="round"&&A!=="miter")throw new Error("Expected bevel, round, or miter line join");f.setLineJoin(A)}return a&&f.setLineDash(a(d)),l&&f.setLineDashOffset(l(d)),c&&f.setMiterLimit(c(d)),u&&f.setOffset(u(d)),f}}function nme(i,e){let t="text-",n=pd(i,t+"value",e);if(!n)return null;let r=p2(i,t,e),s=p2(i,t+"background-",e),o=m2(i,t,e),a=m2(i,t+"background-",e),l=pd(i,t+"font",e),c=Uo(i,t+"max-angle",e),u=Uo(i,t+"offset-x",e),f=Uo(i,t+"offset-y",e),d=Mv(i,t+"overflow",e),A=pd(i,t+"placement",e),y=Uo(i,t+"repeat",e),w=x3(i,t+"scale",e),S=Mv(i,t+"rotate-with-view",e),T=Uo(i,t+"rotation",e),R=pd(i,t+"align",e),P=pd(i,t+"justify",e),I=pd(i,t+"baseline",e),F=Mv(i,t+"keep-upright",e),D=Z$(i,t+"padding",e),L=y3(i,t+"declutter-mode"),C=new ud({declutterMode:L});return function(B){if(C.setText(n(B)),r&&C.setFill(r(B)),s&&C.setBackgroundFill(s(B)),o&&C.setStroke(o(B)),a&&C.setBackgroundStroke(a(B)),l&&C.setFont(l(B)),c&&C.setMaxAngle(c(B)),u&&C.setOffsetX(u(B)),f&&C.setOffsetY(f(B)),d&&C.setOverflow(d(B)),A){let k=A(B);if(k!=="point"&&k!=="line")throw new Error("Expected point or line for text-placement");C.setPlacement(k)}if(y&&C.setRepeat(y(B)),w&&C.setScale(w(B)),S&&C.setRotateWithView(S(B)),T&&C.setRotation(T(B)),R){let k=R(B);if(k!=="left"&&k!=="center"&&k!=="right"&&k!=="end"&&k!=="start")throw new Error("Expected left, right, center, start, or end for text-align");C.setTextAlign(k)}if(P){let k=P(B);if(k!=="left"&&k!=="right"&&k!=="center")throw new Error("Expected left, right, or center for text-justify");C.setJustify(k)}if(I){let k=I(B);if(k!=="bottom"&&k!=="top"&&k!=="middle"&&k!=="alphabetic"&&k!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");C.setTextBaseline(k)}return D&&C.setPadding(D(B)),F&&C.setKeepUpright(F(B)),C}}function ime(i,e){return"icon-src"in i?rme(i,e):"shape-points"in i?sme(i,e):"circle-radius"in i?ome(i,e):null}function rme(i,e){let t="icon-",n=t+"src",r=K$(i[n],n),s=v3(i,t+"anchor",e),o=x3(i,t+"scale",e),a=Uo(i,t+"opacity",e),l=v3(i,t+"displacement",e),c=Uo(i,t+"rotation",e),u=Mv(i,t+"rotate-with-view",e),f=X$(i,t+"anchor-origin"),d=$$(i,t+"anchor-x-units"),A=$$(i,t+"anchor-y-units"),y=md(i,t+"color"),w,S=null;y!==void 0&&(Array.isArray(y)&&y.length>0&&typeof y[0]=="string"?S=_3(i,t+"color",e):w=Q$(y,t+"color"));let T=cme(i,t+"cross-origin"),R=ume(i,t+"offset"),P=X$(i,t+"offset-origin"),I=d6(i,t+"width"),F=d6(i,t+"height"),D=lme(i,t+"size"),L=y3(i,t+"declutter-mode"),C={src:r,anchorOrigin:f,anchorXUnits:d,anchorYUnits:A,crossOrigin:T,offset:R,offsetOrigin:P,height:F,width:I,size:D,declutterMode:L},B=null;return function(k){if(B)S&&B.setColor(S(k));else{let z=S?S(k):w;B=new _A(z!==void 0?Object.assign({},C,{color:z}):Object.assign({},C))}return a&&B.setOpacity(a(k)),l&&B.setDisplacement(l(k)),c&&B.setRotation(c(k)),u&&B.setRotateWithView(u(k)),o&&B.setScale(o(k)),s&&B.setAnchor(s(k)),B}}function sme(i,e){let t="shape-",n=t+"points",r=t+"radius",s=p6(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=Uo(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=Uo(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=p2(i,t,e),d=m2(i,t,e),A=x3(i,t+"scale",e),y=v3(i,t+"displacement",e),w=Uo(i,t+"rotation",e),S=Mv(i,t+"rotate-with-view",e),T=d6(i,t+"angle"),R=y3(i,t+"declutter-mode"),P=new qE({points:s,radius:a,radius2:u,angle:T,declutterMode:R});return function(I){return o&&P.setRadius(o(I)),c&&P.setRadius2(c(I)),f&&P.setFill(f(I)),d&&P.setStroke(d(I)),y&&P.setDisplacement(y(I)),w&&P.setRotation(w(I)),S&&P.setRotateWithView(S(I)),A&&P.setScale(A(I)),P}}function ome(i,e){let t="circle-",n=p2(i,t,e),r=m2(i,t,e),s=Uo(i,t+"radius",e),o=x3(i,t+"scale",e),a=v3(i,t+"displacement",e),l=Uo(i,t+"rotation",e),c=Mv(i,t+"rotate-with-view",e),u=y3(i,t+"declutter-mode"),f=new HE({radius:5,declutterMode:u});return function(d){return s&&f.setRadius(s(d)),n&&f.setFill(n(d)),r&&f.setStroke(r(d)),a&&f.setDisplacement(a(d)),l&&f.setRotation(l(d)),c&&f.setRotateWithView(c(d)),o&&f.setScale(o(d)),f}}function md(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function Uo(i,e,t){let n=md(i,e);if(n===void 0)return;let r=Iu(n,ci,t);return function(s){return p6(r(s),e)}}function pd(i,e,t){let n=md(i,e);if(n===void 0)return null;let r=Iu(n,sa,t);return function(s){return K$(r(s),e)}}function ame(i,e,t){let n=pd(i,e+"pattern-src",t),r=j$(i,e+"pattern-offset",t),s=j$(i,e+"pattern-size",t),o=_3(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function Mv(i,e,t){let n=md(i,e);if(n===void 0)return null;let r=Iu(n,ra,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function _3(i,e,t){let n=md(i,e);if(n===void 0)return null;let r=Iu(n,La,t);return function(s){return Q$(r(s),e)}}function Z$(i,e,t){let n=md(i,e);if(n===void 0)return null;if(Array.isArray(n)&&(n.length===0||typeof n[0]!="string")){let s=n.map((o,a)=>{if(typeof o=="number")return()=>o;let l=Iu(o,ci,t);return function(c){return p6(l(c),`${e}[${a}]`)}});return function(o){let a=new Array(s.length);for(let l=0;l<s.length;++l)a[l]=s[l](o);return a}}let r=Iu(n,dd,t);return function(s){return A2(r(s),e)}}function v3(i,e,t){let n=md(i,e);if(n===void 0)return null;let r=Iu(n,dd,t);return function(s){let o=A2(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function j$(i,e,t){let n=md(i,e);if(n===void 0)return null;let r=Iu(n,dd,t);return function(s){return J$(r(s),e)}}function x3(i,e,t){let n=md(i,e);if(n===void 0)return null;let r=Iu(n,dd|ci,t);return function(s){return hme(r(s),e)}}function d6(i,e){let t=i[e];if(t!==void 0){if(typeof t!="number")throw new Error(`Expected a number for ${e}`);return t}}function lme(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return cs(t);if(!Array.isArray(t))throw new Error(`Expected a number or size array for ${e}`);if(t.length!==2||typeof t[0]!="number"||typeof t[1]!="number")throw new Error(`Expected a number or size array for ${e}`);return t}}function cme(i,e){let t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);return t}}function X$(i,e){let t=i[e];if(t!==void 0){if(t!=="bottom-left"&&t!=="bottom-right"&&t!=="top-left"&&t!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return t}}function $$(i,e){let t=i[e];if(t!==void 0){if(t!=="pixels"&&t!=="fraction")throw new Error(`Expected pixels or fraction for ${e}`);return t}}function ume(i,e){let t=i[e];if(t!==void 0)return A2(t,e)}function y3(i,e){let t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);if(t!=="declutter"&&t!=="obstacle"&&t!=="none")throw new Error(`Expected declutter, obstacle, or none for ${e}`);return t}}function A2(i,e){if(!Array.isArray(i))throw new Error(`Expected an array for ${e}`);let t=i.length;for(let n=0;n<t;++n)if(typeof i[n]!="number")throw new Error(`Expected an array of numbers for ${e}`);return i}function K$(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function p6(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function Q$(i,e){if(typeof i=="string")return i;let t=A2(i,e),n=t.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return t}function J$(i,e){let t=A2(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function hme(i,e){return typeof i=="number"?i:J$(i,e)}var eY={RENDER_ORDER:"renderOrder"},m6=class extends SA{constructor(e){e=e||{};let t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer!==void 0?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0?e.updateWhileAnimating:!1,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0?e.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(eY.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){let n=this.getDeclutter();n in e.declutter||(e.declutter[n]=new TA(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(eY.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?o5:e;let t=fme(e);this.styleFunction_=e===null?void 0:MX(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function fme(i){if(i===void 0)return o5;if(!i)return null;if(typeof i=="function"||i instanceof Fr)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof Fr){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof Fr))throw new Error("Expected a list of style instances");n[r]=s}return n}return Y$(i)}var b3=m6;var A6=class extends Ao{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},w3=A6;var g6=class extends Ip{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){ei()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;No(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),AE(r,n)}forEachFeatureAtCoordinate(e,t,n,r,s,o,a,l){let c,u=t.viewState;function f(I,F,D,L){return s.call(o,F,I?D:null,L)}let d=u.projection,A=QT(e.slice(),d),y=[[0,0]];if(d.canWrapX()&&r){let I=d.getExtent(),F=Kn(I);y.push([-F,0],[F,0])}let w=t.layerStatesArray,S=w.length,T=[],R=[];for(let I=0;I<y.length;I++)for(let F=S-1;F>=0;--F){let D=w[F],L=D.layer;if(L.hasRenderer()&&l2(D,u)&&a.call(l,L)){let C=L.getRenderer(),B=L.getSource();if(C&&B){let k=B.getWrapX()?A:e,z=f.bind(null,D.managed);R[0]=k[0]+y[I][0],R[1]=k[1]+y[I][1],c=C.forEachFeatureAtCoordinate(R,t,n,z,T)}if(c)return c}}if(T.length===0)return;let P=1/T.length;return T.forEach((I,F)=>I.distanceSq+=F*P),T.sort((I,F)=>I.distanceSq-F.distanceSq),T.some(I=>c=I.callback(I.feature,I.layer,I.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,s,o){return this.forEachFeatureAtCoordinate(e,t,n,r,nd,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){ei()}scheduleExpireIconCache(e){na.canExpireCache()&&e.postRenderFunctions.push(dme)}};function dme(i,e){na.expire()}var tY=g6;var v6=class extends tY{constructor(e){super(e),this.fontChangeListenerKey_=qn(gA,Tu.PROPERTYCHANGE,e.redrawText,e),this.element_=io?dE():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Op+" ol-layers";let n=e.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){let n=this.getMap();if(n.hasListener(e)){let r=new w3(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){li(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(Oo.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof b3&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;Wl(o)&&(a=o.getContext("2d"),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,o.width,o.height));let l=[],c=a?o:null;for(let u=0,f=t.length;u<f;++u){let d=t[u];e.layerIndex=u;let A=d.layer,y=A.getSourceState();if(!l2(d,r)||y!="ready"&&y!="undefined"){A.unrender();continue}let w=A.render(e,c);w&&(w!==c&&(this.children_.push(w),c=w),l.push(d))}this.declutter(e,l),bj(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,d=u.style.backgroundColor;if(d&&(!Wl(f)||f.width>0)&&(a.fillStyle=d,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!Wl(f)||f.width===0)continue;a.save();let A=u.style.opacity||f.style.opacity;a.globalAlpha=A===""?1:Number(A);let y=f.style.transform;if(y)a.transform(...mE(y));else{let w=parseFloat(f.style.width)/f.width,S=parseFloat(f.style.height)/f.height;a.transform(w,0,0,S,0,0)}a.drawImage(f,0,0),a.restore()}this.dispatchRenderEvent(Oo.POSTCOMPOSE,e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let n=t.length-1;n>=0;--n){let r=t[n],s=r.layer;s.getDeclutter()&&s.renderDeclutter(e,r)}t.forEach(n=>n.layer.renderDeferred(e))}}},nY=v6;function iY(i){if(i instanceof SA){i.setMapInternal(null);return}i instanceof a2&&i.getLayers().forEach(iY)}function rY(i,e){if(i instanceof SA){i.setMapInternal(e);return}if(i instanceof a2){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)rY(t[n],e)}}var _6=class extends zs{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=pme(e);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=e.maxTilesLoading!==void 0?e.maxTilesLoading:16,this.pixelRatio_=e.pixelRatio!==void 0?e.pixelRatio:Aj,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=go(),this.pixelToCoordinateTransform_=go(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,io||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,io||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(io?new Fo:t3()),this.interactions=t.interactions||(io?new Fo:a3({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new f$(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Bo.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Bo.VIEW,this.handleViewChanged_),this.addChangeListener(Bo.SIZE,this.handleSizeChanged_),this.addChangeListener(Bo.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof Yl)&&e.view.then(function(r){n.setView(new Yl(r))}),this.controls.addEventListener(vo.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(vo.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(vo.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(vo.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(vo.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(vo.REMOVE,r=>{let s=r.element.getId();s!==void 0&&delete this.overlayIdIndex_[s.toString()],r.element.setMap(null)}),this.controls.forEach(r=>{r.setMap(this)}),this.interactions.forEach(r=>{r.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){rY(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){let t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;let r=this.getCoordinateFromPixelInternal(e);n=n!==void 0?n:{};let s=n.hitTolerance!==void 0?n.hitTolerance:0,o=n.layerFilter!==void 0?n.layerFilter:nd,a=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,s,a,t,null,o,null)}getFeaturesAtPixel(e,t){let n=[];return this.forEachFeatureAtPixel(e,function(r){n.push(r)},t),n}getAllLayers(){let e=[];function t(n){n.forEach(function(r){r instanceof a2?t(r.getLayers()):e.push(r)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;let n=this.getCoordinateFromPixelInternal(e);t=t!==void 0?t:{};let r=t.layerFilter!==void 0?t.layerFilter:nd,s=t.hitTolerance!==void 0?t.hitTolerance:0,o=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,s,o,r,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){let n=this.viewport_.getBoundingClientRect(),r=this.getSize(),s=n.width/r[0],o=n.height/r[1],a="changedTouches"in e?e.changedTouches[0]:e;return[(a.clientX-n.left)/s,(a.clientY-n.top)/o]}getTarget(){return this.get(Bo.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Iy(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?Xr(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){let t=this.overlayIdIndex_[e.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(Bo.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof Fo){t.setLayers(e);return}let n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){let e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t<n;++t){let r=e[t];if(!r.visible)continue;let s=r.layer.getRenderer();if(s&&!s.ready)return!0;let o=r.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(e){let t=wu(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?Xr(t.coordinateToPixelTransform,e.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(e){this.pixelRatio_!==e&&(this.pixelRatio_=e,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(Bo.SIZE)}getView(){return this.get(Bo.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){let e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,n,r){return d$(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new wh(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===r2.POINTERDOWN||n===nn.WHEEL||n===nn.KEYDOWN){let r=this.getOwnerDocument(),s=this.viewport_.getRootNode?this.viewport_.getRootNode():r,o=t.target,a=s instanceof ShadowRoot?s.host===o?s.host.ownerDocument:s:s===r?r.documentElement:s;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){let r=this.getInteractions().getArray().slice();for(let s=r.length-1;s>=0;s--){let o=r[s];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){let e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let r=this.maxTilesLoading_,s=r,o=e?e.viewHints:void 0,a=o?o[so.ANIMATING]||o[so.INTERACTING]:!1;if(a){let l=Date.now()-e.time>8;r=l?0:8,s=l?0:2}t.getTilesLoading()<r&&(a&&t.reprioritize(),t.loadMoreTiles(r,s))}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(Oo.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Oo.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new zp(Sh.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new zp(Sh.LOADSTART,this,e))));let n=this.postRenderFunctions_;if(e)for(let r=0,s=n.length;r<s;++r)n[r](this,e);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let n=0,r=this.targetChangeHandlerKeys_.length;n<r;++n)li(this.targetChangeHandlerKeys_[n]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(nn.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(nn.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Wl(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);let n=this.targetElement_.getRootNode();n instanceof ShadowRoot&&this.resizeObserver_.unobserve(n.host),this.setSize(void 0)}let e=this.getTarget(),t=typeof e=="string"?document.getElementById(e):e;if(this.targetElement_=t,!t)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{if(Wl(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new nY(this)),!Wl(t)){this.mapBrowserEventHandler_=new u$(this,this.moveTolerance_);for(let r in gr)this.mapBrowserEventHandler_.addEventListener(gr[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(nn.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(nn.WHEEL,this.boundHandleBrowserEvent_,fE?{passive:!1}:!1);let n;if(this.keyboardEventTarget_)n=this.keyboardEventTarget_;else{let r=t.getRootNode();n=r instanceof ShadowRoot?r.host:t}if(this.targetChangeHandlerKeys_=[qn(n,nn.KEYDOWN,this.handleBrowserEvent,this),qn(n,nn.KEYPRESS,this.handleBrowserEvent,this)],!Wl(t)){let r=t.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.observe(r.host),this.resizeObserver_?.observe(t)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(li(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(li(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=qn(e,Tu.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=qn(e,nn.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(li),this.layerGroupPropertyListenerKeys_=null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Cu("addlayer",e)),this.layerGroupPropertyListenerKeys_=[qn(e,Tu.PROPERTYCHANGE,this.render,this),qn(e,nn.CHANGE,this.render,this),qn(e,"addlayer",this.handleLayerAdd_,this),qn(e,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;let e=this.frameState_.layerStatesArray;for(let t=0,n=e.length;t<n;++t){let r=e[t].layer;r.hasRenderer()&&r.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){iY(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){let t=this.getSize(),n=this.getView(),r=this.frameState_,s=null;if(t!==void 0&&jD(t)&&n&&n.isDef()){let o=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();if(s={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Ey(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:Bn(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=Ey(a.nextCenter,a.nextResolution,l,t)}}this.frameState_=s,this.renderer_.renderFrame(s),s&&(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),r&&(!this.previousExtent_||!mh(this.previousExtent_)&&!Qm(s.extent,this.previousExtent_))&&(this.dispatchEvent(new zp(Sh.MOVESTART,this,r)),this.previousExtent_=Km(this.previousExtent_)),this.previousExtent_&&!s.viewHints[so.ANIMATING]&&!s.viewHints[so.INTERACTING]&&!Qm(s.extent,this.previousExtent_)&&(this.dispatchEvent(new zp(Sh.MOVEEND,this,s)),HT(s.extent,this.previousExtent_))),this.dispatchEvent(new zp(Sh.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(Sh.LOADSTART)||this.hasListener(Sh.LOADEND)||this.hasListener(Oo.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){let t=this.getLayerGroup();t&&this.handleLayerRemove_(new Cu("removelayer",t)),this.set(Bo.LAYERGROUP,e)}setSize(e){this.set(Bo.SIZE,e)}setTarget(e){this.set(Bo.TARGET,e)}setView(e){if(!e||e instanceof Yl){this.set(Bo.VIEW,e);return}this.set(Bo.VIEW,new Yl);let t=this;e.then(function(n){t.setView(new Yl(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(Wl(e)){let o=e.getContext("2d").getTransform();r=e.width/o.a,s=e.height/o.d}else{let o=getComputedStyle(e);r=e.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),s=e.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(r)&&!isNaN(s)&&(t=[Math.max(0,r),Math.max(0,s)],!jD(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&YT("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!ta(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function pme(i){let e=null;i.keyboardEventTarget!==void 0&&(e=typeof i.keyboardEventTarget=="string"?document.getElementById(i.keyboardEventTarget):i.keyboardEventTarget);let t={},n=i.layers&&typeof i.layers.getLayers=="function"?i.layers:new a2({layers:i.layers});t[Bo.LAYERGROUP]=n,t[Bo.TARGET]=i.target,t[Bo.VIEW]=i.view instanceof Yl?i.view:new Yl;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new Fo(i.controls.slice()):(jn(typeof i.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),r=i.controls));let s;i.interactions!==void 0&&(Array.isArray(i.interactions)?s=new Fo(i.interactions.slice()):(jn(typeof i.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),s=i.interactions));let o;return i.overlays!==void 0?Array.isArray(i.overlays)?o=new Fo(i.overlays.slice()):(jn(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new Fo,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var sY=_6;function S3(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var mme=new Error("disposed");var Ame=[256,256],x6=class extends ov{constructor(e){let t=an.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;let e=S3(this.data_);return e?[e.width,e.height]:Ame}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==an.IDLE&&this.state!==an.ERROR)return;this.state=an.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=an.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=an.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(mme),this.controller_=null),super.disposeInternal()}},y6=x6;var b6=class{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){let e=this.pop();e instanceof Ip&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){let n=this.entries_[e];return jn(n!==void 0,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){let t=this.entries_[e];return jn(t!==void 0,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){let e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){jn(!(e in this.entries_),"Tried to set a value for a key that is used already");let n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}},w6=b6;var S6=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(Dy(),{get:(e,t)=>{if(typeof e[t]=="function")return this.pendingMethod_=t,this.pushMethodArgs_},set:(e,t,n)=>(this.push_(t,n),!0)})}push_(...e){let t=this.instructions_,n=this.zIndex+this.offset_;t[n]||(t[n]=[]),t[n].push(...e)}pushMethodArgs_=(...e)=>{this.push_(this.pendingMethod_,e)};pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,r=t.length;n<r;++n){let s=t[n];if(typeof s=="function"){s(e);continue}let o=t[++n];typeof e[s]=="function"?e[s](...o):typeof o=="function"?e[s]=o(e):e[s]=o}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},T3=S6;var gme=5,T6=class extends vE{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=gme,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(e){this.renderedSourceKey_?this.renderedSourceKey_!==e&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=e):this.renderedSourceKey_=e}getFeatures(e){return ei()}getData(e){return null}prepareFrame(e){return ei()}renderFrame(e,t){return ei()}forEachFeatureAtCoordinate(e,t,n,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===In.LOADED||t.getState()===In.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=In.LOADED&&t!=In.ERROR&&e.addEventListener(nn.CHANGE,this.boundHandleImageChange_),t==In.IDLE&&(e.load(),t=e.getState()),t==In.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},oY=T6;var M6=[],Cv=null;function vme(){Cv=Di(1,1,void 0,{willReadFrequently:!0})}var E6=class extends oY{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=go(),this.pixelTransform=go(),this.inversePixelTransform=go(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){Cv||vme(),Cv.clearRect(0,0,1,1);let r;try{Cv.drawImage(e,t,n,1,1,0,0,1,1),r=Cv.getImageData(0,0,1,1).data}catch{return Cv=null,null}return r}getBackground(e){let n=this.getLayer().getBackground();return typeof n=="function"&&(n=n(e.viewState.resolution)),n||void 0}useContainer(e,t,n,r,s){if(Wl(e)&&this.pixelTransform[1]===0&&this.pixelTransform[2]===0&&this.pixelTransform[4]===0&&this.pixelTransform[5]===0&&e.width===r&&e.height===s){let c=e,u=c.getContext("2d");if(u){this.container=e,this.context=u,this.containerReused=!0,n&&(u.fillStyle=n,u.fillRect(0,0,c.width,c.height));return}}let o=this.getLayer().getClassName(),a,l;if(e&&e.className===o&&(!n||e&&e.style.backgroundColor&&ta(kc(e.style.backgroundColor),kc(n)))){let c=e.firstElementChild;Wl(c)&&(l=c.getContext("2d"))}if(l&&Rj(l.canvas.style.transform,t)?(this.container=e,this.context=l,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){a=io?dE():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Di();let u=l.canvas;a.appendChild(u),c=u.style,c.position="absolute",c.left="0",c.transformOrigin="top left",this.container=a,this.context=l}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){let r=Dc(n),s=X1(n),o=j1(n),a=W1(n);Xr(t.coordinateToPixelTransform,r),Xr(t.coordinateToPixelTransform,s),Xr(t.coordinateToPixelTransform,o),Xr(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;Xr(l,r),Xr(l,s),Xr(l,o),Xr(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}prepareContainer(e,t){let n=e.extent,r=e.viewState.resolution,s=e.viewState.rotation,o=e.pixelRatio,a=Math.round(Kn(n)/r*o),l=Math.round(Nr(n)/r*o);No(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),AE(this.inversePixelTransform,this.pixelTransform);let c=Cj(this.pixelTransform),u=this.getBackground(e);if(this.useContainer(t,c,u,a,l),!this.containerReused){let f=this.context.canvas;f.width!=a||f.height!=l?(f.width=a,f.height=l):this.context.clearRect(0,0,a,l),c!==f.style.transform&&(f.style.transform=c)}}dispatchRenderEvent_(e,t,n){let r=this.getLayer();if(r.hasListener(e)){let s=new w3(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(Oo.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(Oo.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new T3),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(Oo.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(Oo.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,s,o,a){let l=s/2,c=o/2,u=r/t,f=-u,d=-e[0]+a,A=-e[1];return No(this.tempTransform,l,c,u,f,-n,d,A)}disposeInternal(){delete this.frameState,super.disposeInternal()}},E3=E6;function C6(i,e,t){if(!(t in i))return i[t]=new Set([e]),!0;let n=i[t],r=n.has(e);return r||n.add(e),!r}function _me(i,e,t){let n=i[t];return n?n.delete(e):!1}function aY(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=ph(e,Su(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=ph(e,r))}return e}var R6=class extends E3{constructor(e,t){super(e),t=t||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=jr(),this.tempTileRange_=new aE(0,0,0,0),this.tempTileCoord_=nv(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new w6(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new w6(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=iv(a,a.getKey(),e,t,n),c;if(s.containsKey(l))c=s.get(l);else{let u=r.viewState.projection,f=a.getProjection();if(c=a.getTile(e,t,n,r.pixelRatio,u,!f||J1(f,u)?void 0:this.getSourceTileCache()),!c)return null;s.set(l,c)}return c}getTile(e,t,n,r){let s=this.getOrCreateTile(e,t,n,r);return s||null}getData(e){let t=this.frameState;if(!t)return null;let n=this.getLayer(),r=Xr(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!vu(s,r))return null;let o=t.viewState,a=n.getRenderSource(),l=a.getTileGridForProjection(o.projection),c=a.getTilePixelRatio(t.pixelRatio);for(let u=l.getZForResolution(o.resolution);u>=l.getMinZoom();--u){let f=l.getTileCoordForCoordAndZ(r,u),d=this.getTile(u,f[1],f[2],t);if(!d||d.getState()!==an.LOADED)continue;let A=l.getOrigin(u),y=cs(l.getTileSize(u)),w=l.getResolution(u),S;if(d instanceof pE||d instanceof gE)S=d.getImage();else if(d instanceof y6){if(S=S3(d.getData()),!S)continue}else continue;let T=Math.floor(c*((r[0]-A[0])/w-f[1]*y[0])),R=Math.floor(c*((A[1]-r[1])/w-f[2]*y[1])),P=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(S,T+P,R+P)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;let t=this.getLayer().getSource();if(!t)return!1;let n=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,n,r,s){let o=e.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(o.projection),u=Bn(l);u in e.wantedTiles||(e.wantedTiles[u]={});let f=e.wantedTiles[u],d=a.getMapInternal(),A=Math.max(n-s,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),y=o.rotation,w=y?PD(o.center,o.resolution,y,e.size):void 0;for(let S=n;S>=A;--S){let T=c.getTileRangeForExtentAndZ(t,S,this.tempTileRange_),R=c.getResolution(S);for(let P=T.minX;P<=T.maxX;++P)for(let I=T.minY;I<=T.maxY;++I){if(y&&!c.tileCoordIntersectsViewport([S,P,I],w))continue;let F=this.getTile(S,P,I,e);if(!F||!C6(r,F,S))continue;let L=F.getKey();if(f[L]=!0,F.getState()===an.IDLE&&!e.tileQueue.isKeyQueued(L)){let C=nv(S,P,I,this.tempTileCoord_);e.tileQueue.enqueue([F,u,c.getTileCoordCenter(C),R])}}}}findStaleTile_(e,t){let n=this.tileCache_,r=e[0],s=e[1],o=e[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){let c=iv(this.getLayer().getSource(),a[l],r,s,o);if(n.containsKey(c)){let u=n.peek(c);if(u.getState()===an.LOADED)return u.endTransition(Bn(this)),C6(t,u,r),!0}}return!1}findAltTiles_(e,t,n,r){let s=e.getTileRangeForTileCoordAndZ(t,n,this.tempTileRange_);if(!s)return!1;let o=!0,a=this.tileCache_,l=this.getLayer().getRenderSource(),c=l.getKey();for(let u=s.minX;u<=s.maxX;++u)for(let f=s.minY;f<=s.maxY;++f){let d=iv(l,c,n,u,f),A=!1;if(a.containsKey(d)){let y=a.peek(d);y.getState()===an.LOADED&&(C6(r,y,n),A=!0)}A||(o=!1)}return o}renderFrame(e,t){this.renderComplete=!0;let n=e.layerStatesArray[e.layerIndex],r=e.viewState,s=r.projection,o=r.resolution,a=r.center,l=e.pixelRatio,c=this.getLayer(),u=c.getSource(),f=u.getTileGridForProjection(s),d=f.getZForResolution(o,u.zDirection),A=f.getResolution(d);this.updateStaleKeys(u.getKey());let y=e.extent,w=u.getTilePixelRatio(l);this.prepareContainer(e,t);let S=this.context.canvas.width,T=this.context.canvas.height;this.layerExtent=n.extent?Su(n.extent,s):null,this.layerExtent&&(y=ph(y,this.layerExtent));let R=A*S/2/w,P=A*T/2/w,I=[a[0]-R,a[1]-P,a[0]+R,a[1]+P],F={};this.renderedTiles.length=0;let D=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let $=f.getZForResolution(r.nextResolution,u.zDirection),J=aY(e,e.nextExtent);this.enqueueTiles(e,J,$,F,D)}let L=aY(e,y);if(this.enqueueTiles(e,L,d,F,0),D>0&&setTimeout(()=>{this.enqueueTiles(e,L,d-1,F,D-1)},0),!(d in F))return this.container;let C=Bn(this),B=e.time;for(let $ of F[d]){let J=$.getState();if(J===an.EMPTY)continue;let te=$.tileCoord;if(J===an.LOADED&&$.getAlpha(C,B)===1){$.endTransition(C);continue}if(J!==an.ERROR&&(this.renderComplete=!1),this.findStaleTile_(te,F)){_me(F,$,d),e.animate=!0;continue}if(this.findAltTiles_(f,te,d+1,F))continue;let ve=f.getMinZoom();for(let Re=d-1;Re>=ve&&!this.findAltTiles_(f,te,Re,F);--Re);}let k=A/o*l/w,z=this.getRenderContext(e);No(this.tempTransform,S/2,T/2,k,k,0,-S/2,-T/2),this.layerExtent&&this.clipUnrotated(z,e,this.layerExtent),u.getInterpolate()||(z.imageSmoothingEnabled=!1),this.preRender(z,e);let G=Object.keys(F).map(Number);G.sort(pl);let W=[],Y=[],H=[];for(let $=G.length-1;$>=0;--$){let J=G[$],te=u.getTilePixelSize(J,l,s),he=f.getResolution(J)/A,ve=te[0]*he*k,Re=te[1]*he*k,Qe=f.getTileCoordForCoordAndZ(Dc(I),J),Fe=f.getTileCoordExtent(Qe),mt=Xr(this.tempTransform,[w*(Fe[0]-I[0])/A,w*(I[3]-Fe[3])/A]),Ee=w*u.getGutterForProjection(s);for(let Ve of F[J]){if(Ve.getState()!==an.LOADED)continue;let Ye=Ve.tileCoord,Mt=Qe[1]-Ye[1],Et=Math.round(mt[0]-(Mt-1)*ve),It=Qe[2]-Ye[2],dn=Math.round(mt[1]-(It-1)*Re),Gt=Math.round(mt[0]-Mt*ve),$e=Math.round(mt[1]-It*Re),ot=Et-Gt,nt=dn-$e,bt=J===d;if(bt&&Ve.inTransition(C)){H.push({tile:Ve,x:Gt,y:$e,w:ot,h:nt,gutter:Ee}),this.renderedTiles.unshift(Ve),this.updateUsedTiles(e.usedTiles,u,Ve);continue}let yt=[Gt,$e,Gt+ot,$e+nt],hn=[];for(let tn=0,bn=W.length;tn<bn;++tn)J<Y[tn]&&Ar(yt,W[tn])&&hn.push(W[tn]);let en;hn.length>0&&(en=SW(yt,hn)),W.push(yt),Y.push(J),this.drawTile(Ve,e,Gt,$e,ot,nt,Ee,bt,en),this.renderedTiles.unshift(Ve),this.updateUsedTiles(e.usedTiles,u,Ve)}}for(let $=0,J=H.length;$<J;++$){let{tile:te,x:ce,y:he,w:ve,h:Re,gutter:Qe}=H[$];this.drawTile(te,e,ce,he,ve,Re,Qe,!0,void 0)}if(this.renderedResolution=A,this.extentChanged=!this.renderedExtent_||!Qm(this.renderedExtent_,I),this.renderedExtent_=I,this.renderedPixelRatio=l,this.postRender(this.context,e),this.layerExtent&&z.restore(),z.imageSmoothingEnabled=!0,this.renderComplete){let $=(J,te)=>{let ce=Bn(u),he=te.wantedTiles[ce],ve=he?Object.keys(he).length:0;this.updateCacheSize(ve),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push($)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,s,o,a,l,c){let u;if(e instanceof y6){if(u=S3(e.getData()),!u)throw new Error("Rendering array data is not yet supported")}else u=this.getTileImage(e);if(!u)return;let f=this.getRenderContext(t),d=Bn(this),A=t.layerStatesArray[t.layerIndex],y=A.opacity*(l?e.getAlpha(d,t.time):1),w=y!==f.globalAlpha;w&&(f.save(),f.globalAlpha=y);let S=u.width-2*a,T=u.height-2*a;if(c){let R=S/s,P=T/o;for(let I=0,F=c.length;I<F;++I){let D=c[I],L=D[0],C=D[1],B=D[2]-D[0],k=D[3]-D[1];f.drawImage(u,a+(L-n)*R,a+(C-r)*P,B*R,k*P,L,C,B,k)}}else f.drawImage(u,a,a,S,T,n,r,s,o);w&&f.restore(),y!==A.opacity?t.animate=!0:l&&e.endTransition(d)}getImage(){let e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){let r=Bn(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},lY=R6;var g2={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var I6=class extends SA{constructor(e){e=e||{};let t=Object.assign({},e),n=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(e.preload!==void 0?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(g2.PRELOAD)}setPreload(e){this.set(g2.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(g2.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(g2.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},cY=I6;var P6=class extends cY{constructor(e){super(e)}createRenderer(){return new lY(this,{cacheSize:this.getCacheSize()})}},L6=P6;var D6=class{drawCustom(e,t,n,r,s){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,n){}drawFeature(e,t,n){}drawGeometryCollection(e,t,n){}drawLineString(e,t,n){}drawMultiLineString(e,t,n){}drawMultiPoint(e,t,n){}drawMultiPolygon(e,t,n){}drawPoint(e,t,n){}drawPolygon(e,t,n){}drawText(e,t,n){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}},M3=D6;var v2={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},_2=[v2.FILL],Mh=[v2.STROKE],Ad=[v2.BEGIN_PATH],N6=[v2.CLOSE_PATH],vn=v2;var F6=class extends M3{constructor(e,t,n,r){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=n,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){let t=this.pixelRatio;return t==1?e:e.map(function(n){return n*t})}appendFlatPointCoordinates(e,t){let n=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,s=this.coordinates,o=s.length;for(let a=0,l=e.length;a<l;a+=t)r[0]=e[a],r[1]=e[a+1],vu(n,r)&&(s[o++]=r[0],s[o++]=r[1]);return o}appendFlatLineCoordinates(e,t,n,r,s,o){let a=this.coordinates,l=a.length,c=this.getBufferedMaxExtent();o&&(t+=r);let u=e[t],f=e[t+1],d=this.tmpCoordinate_,A=!0,y,w,S;for(y=t+r;y<n;y+=r)d[0]=e[y],d[1]=e[y+1],S=qT(c,d),S!==w?(A&&(a[l++]=u,a[l++]=f,A=!1),a[l++]=d[0],a[l++]=d[1]):S===Us.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],A=!1):A=!0,u=d[0],f=d[1],w=S;return(s&&A||y===t+r)&&(a[l++]=u,a[l++]=f),l}drawCustomCoordinates_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o){let l=n[o],c=this.appendFlatLineCoordinates(e,t,l,r,!1,!1);s.push(c),t=l}return t}drawCustom(e,t,n,r,s){this.beginGeometry(e,t,s);let o=e.getType(),a=e.getStride(),l=this.coordinates.length,c,u,f,d,A;switch(o){case"MultiPolygon":c=e.getOrientedFlatCoordinates(),d=[];let y=e.getEndss();A=0;for(let w=0,S=y.length;w<S;++w){let T=[];A=this.drawCustomCoordinates_(c,A,y[w],a,T),d.push(T)}this.instructions.push([vn.CUSTOM,l,d,e,n,Uy,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,d,e,r||n,Uy,s]);break;case"Polygon":case"MultiLineString":f=[],c=o=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),A=this.drawCustomCoordinates_(c,0,e.getEnds(),a,f),this.instructions.push([vn.CUSTOM,l,f,e,n,Dp,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,f,e,r||n,Dp,s]);break;case"LineString":case"Circle":c=e.getFlatCoordinates(),u=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([vn.CUSTOM,l,u,e,n,Uc,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,Uc,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([vn.CUSTOM,l,u,e,n,Uc,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,Uc,s]));break;case"Point":c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),u=this.coordinates.length,this.instructions.push([vn.CUSTOM,l,u,e,n,void 0,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,void 0,s]);break;default:}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[vn.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[vn.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let e=this.hitDetectionInstructions;e.reverse();let t,n=e.length,r,s,o=-1;for(t=0;t<n;++t)r=e[t],s=r[0],s==vn.END_GEOMETRY?o=t:s==vn.BEGIN_GEOMETRY&&(r[2]=t,nj(this.hitDetectionInstructions,o,t),o=-1)}fillStyleToState(e,t={}){if(e){let n=e.getColor();t.fillPatternScale=n&&typeof n=="object"&&"src"in n?this.pixelRatio:1,t.fillStyle=vl(n||ro)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=vl(n||ia);let r=e.getLineCap();t.lineCap=r!==void 0?r:yh;let s=e.getLineDash();t.lineDash=s?s.slice():_l;let o=e.getLineDashOffset();t.lineDashOffset=o||xl;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:bh;let l=e.getWidth();t.lineWidth=l!==void 0?l:cd;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:ad;let u=e.getOffset();t.strokeOffset=u??_X,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){let n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){let t=e.fillStyle,n=[vn.SET_FILL_STYLE,t];return typeof t!="string"&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[vn.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){let n=e.fillStyle;(n!==void 0&&typeof n!="string"||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){let n=e.strokeStyle,r=e.lineCap,s=e.lineDash,o=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,c=e.miterLimit,u=e.strokeOffset;(e.currentStrokeStyle!=n||e.currentLineCap!=r||s!=e.currentLineDash&&!ta(e.currentLineDash,s)||e.currentLineDashOffset!=o||e.currentLineJoin!=a||e.currentLineWidth!=l||e.currentMiterLimit!=c||e.currentStrokeOffset!=u)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=r,e.currentLineDash=s,e.currentLineDashOffset=o,e.currentLineJoin=a,e.currentLineWidth=l,e.currentMiterLimit=c,e.currentStrokeOffset=u)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let t=[vn.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=HT(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;q1(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Ch=F6;var B6=class extends Ch{constructor(e,t,n,r){super(e,t,n,r),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t,n){if(!this.image_||this.maxExtent&&!vu(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=e.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,s);this.instructions.push([vn.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([vn.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=[];for(let l=0,c=r.length;l<c;l+=e.getStride())(!this.maxExtent||vu(this.maxExtent,r.slice(l,l+2)))&&s.push(r[l],r[l+1]);let o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,2);this.instructions.push([vn.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([vn.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(e,t){let n=e.getAnchor(),r=e.getSize(),s=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=e.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=r[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},uY=B6;var O6=class extends Ch{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinates_(e,t,n,r,s){let o=this.coordinates.length,a=this.appendFlatLineCoordinates(e,t,n,r,!1,!1);return this.instructions.push([vn.MOVE_TO_LINE_TO,o,a,s*this.pixelRatio]),this.hitDetectionInstructions.push([vn.MOVE_TO_LINE_TO,o,a,s]),n}drawLineString(e,t,n){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,_l,xl],Ad);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(Mh),this.endGeometry(t)}drawMultiLineString(e,t,n){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,_l,xl],Ad);let l=e.getEnds(),c=e.getFlatCoordinates(),u=e.getStride(),f=0;for(let d=0,A=l.length;d<A;++d)f=this.drawFlatCoordinates_(c,f,l[d],u,a);this.hitDetectionInstructions.push(Mh),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Mh),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Mh),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(Ad)}},hY=O6;var U6=class extends Ch{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinatess_(e,t,n,r,s){let o=this.state,a=o.fillStyle!==void 0,l=o.strokeStyle!==void 0,c=n.length;this.instructions.push(Ad),this.hitDetectionInstructions.push(Ad);for(let u=0;u<c;++u){let f=n[u],d=this.coordinates.length,A=this.appendFlatLineCoordinates(e,t,f,r,!0,!l);this.instructions.push([vn.MOVE_TO_LINE_TO,d,A,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([vn.MOVE_TO_LINE_TO,d,A,s,!0]),l&&(this.instructions.push(N6),this.hitDetectionInstructions.push(N6)),t=f}return a&&(this.instructions.push(_2),this.hitDetectionInstructions.push(_2)),l&&(this.instructions.push(Mh),this.hitDetectionInstructions.push(Mh)),t}drawCircle(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawCircle(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_FILL_STYLE,ro]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,_l,xl]);let l=e.getFlatCoordinates(),c=e.getStride(),u=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);let f=[vn.CIRCLE,u,a];this.instructions.push(Ad,f),this.hitDetectionInstructions.push(Ad,f),r.fillStyle!==void 0&&(this.instructions.push(_2),this.hitDetectionInstructions.push(_2)),r.strokeStyle!==void 0&&(this.instructions.push(Mh),this.hitDetectionInstructions.push(Mh)),this.endGeometry(t)}drawPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_FILL_STYLE,ro]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,_l,xl]);let l=e.getEnds(),c=e.getOrientedFlatCoordinates(),u=e.getStride();this.drawFlatCoordinatess_(c,0,l,u,a),this.endGeometry(t)}drawMultiPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_FILL_STYLE,ro]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,_l,xl]);let l=e.getEndss(),c=e.getOrientedFlatCoordinates(),u=e.getStride(),f=0;for(let d=0,A=l.length;d<A;++d)f=this.drawFlatCoordinatess_(c,f,l[d],u,a);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let e=this.tolerance;if(e!==0){let t=this.coordinates;for(let n=0,r=t.length;n<r;++n)t[n]=Np(t[n],e)}return super.finish()}setFillStrokeStyles_(){let e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}handleStrokeOffset_(e){let t=this.state,n=t.fillStyle,r=t.strokeStyle,s=t.strokeOffset;return Math.abs(s)>0&&n!==void 0&&r!==void 0?(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=r,t.strokeOffset=s,e(),t.fillStyle=n,!0):!1}},k6=U6;var z6=0,V6=1;function xme(i,e,t,n,r,s,o,a){let l=o-r,c=a-s,u=0,f=1;if(l===0){if(r<i||r>t)return!1}else{let d=(i-r)/l,A=(t-r)/l;if(d>A){let y=d;d=A,A=y}if(d>u&&(u=d),A<f&&(f=A),u>f)return!1}if(c===0){if(s<e||s>n)return!1}else{let d=(e-s)/c,A=(n-s)/c;if(d>A){let y=d;d=A,A=y}if(d>u&&(u=d),A<f&&(f=A),u>f)return!1}return z6=u,V6=f,!0}function fY(i,e,t,n){let r=n[0],s=n[1],o=n[2],a=n[3],l=[],c=[],u=!1,f,d,A=0;for(let y=0,w=e.length;y<w;++y){let S=e[y],T=i[A],R=i[A+1],P=!1;for(let I=A+t;I<S;I+=t){let F=i[I],D=i[I+1];if(xme(r,s,o,a,T,R,F,D)){let L=F-T,C=D-R,B=T+z6*L,k=R+z6*C,z=T+V6*L,G=R+V6*C;u&&P&&B===f&&k===d?l.push(z,G):(u&&c.push(l.length),l.push(B,k,z,G),u=!0),f=z,d=G,P=!0}T=F,R=D}A=S}return u&&c.push(l.length),{flatCoordinates:l,ends:c}}function dY(i,e,t,n,r){let s=[],o=t,a=0,l=e.slice(t,2);for(;a<i&&o+r<n;){let[c,u]=l.slice(-2),f=e[o+r],d=e[o+r+1],A=Math.sqrt((f-c)*(f-c)+(d-u)*(d-u));if(a+=A,a>=i){let y=(i-a+A)/A,w=Lo(c,f,y),S=Lo(u,d,y);l.push(w,S),s.push(l),l=[w,S],a==i&&(o+=r),a=0}else if(a<i)l.push(e[o+r],e[o+r+1]),o+=r;else{let y=A-a,w=Lo(c,f,y/A),S=Lo(u,d,y/A);l.push(w,S),s.push(l),l=[w,S],a=0,o+=r}}return a>0&&s.push(l),s}function pY(i,e,t,n,r){let s=t,o=t,a=0,l=0,c=t,u,f,d,A,y,w,S,T,R,P;for(f=t;f<n;f+=r){let I=e[f],F=e[f+1];y!==void 0&&(R=I-y,P=F-w,A=Math.sqrt(R*R+P*P),S!==void 0&&(l+=d,u=Math.acos((S*R+T*P)/(d*A)),u>i&&(l>a&&(a=l,s=c,o=f),l=0,c=f-r)),d=A,S=R,T=P),y=I,w=F}return l+=A,l>a?[c,f]:[s,o]}var x2={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},G6=class extends Ch{constructor(e,t,n,r){super(e,t,n,r),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[ro]={fillStyle:ro},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){let r=this.textFillState_,s=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!r&&!s)return;let a=this.coordinates,l=a.length,c=e.getType(),u=null,f=e.getStride();if(o.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){let d=e.getExtent();if(!Ar(this.maxExtent,d))return;let A;if(u=e.getFlatCoordinates(),c=="LineString")A=[u.length];else if(c=="MultiLineString")A=e.getEnds();else if(c=="Polygon")A=e.getEnds().slice(0,1);else if(c=="MultiPolygon"){let T=e.getEndss();A=[];for(let R=0,P=T.length;R<P;++R)A.push(T[R][0])}if((c=="LineString"||c=="MultiLineString")&&!dh(this.getBufferedMaxExtent(),d)){let T=fY(u,A,f,this.getBufferedMaxExtent());if(u=T.flatCoordinates,A=T.ends,f=2,A.length===0)return}this.beginGeometry(e,t,n);let y=o.repeat,w=y?void 0:o.textAlign,S=0;for(let T=0,R=A.length;T<R;++T){let P;y?P=dY(y*this.resolution,u,S,A[T],f):P=[u.slice(S,A[T])];for(let I=0,F=P.length;I<F;++I){let D=P[I],L=0,C=D.length;if(w==null){let k=pY(o.maxAngle,D,0,D.length,2);L=k[0],C=k[1]}for(let k=L;k<C;k+=f)a.push(D[k],D[k+1]);let B=a.length;S=A[T],this.drawChars_(l,B),l=B}}this.endGeometry(t)}else{let d=o.overflow?null:[];switch(c){case"Point":case"MultiPoint":u=e.getFlatCoordinates();break;case"LineString":u=e.getFlatMidpoint();break;case"Circle":u=e.getCenter();break;case"MultiLineString":u=e.getFlatMidpoints(),f=2;break;case"Polygon":u=e.getFlatInteriorPoint(),o.overflow||d.push(u[2]/this.resolution),f=3;break;case"MultiPolygon":let I=e.getFlatInteriorPoints();u=[];for(let F=0,D=I.length;F<D;F+=3)o.overflow||d.push(I[F+2]/this.resolution),u.push(I[F],I[F+1]);if(u.length===0)return;f=2;break;default:}let A=this.appendFlatPointCoordinates(u,f);if(A===l)return;if(d&&(A-l)/2!==u.length/f){let I=l/2;d=d.filter((F,D)=>{let L=a[(I+D)*2]===u[D*f]&&a[(I+D)*2+1]===u[D*f+1];return L||--I,L})}this.saveTextStates_();let y=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,w=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(e,t,n);let S=o.padding;if(S!=ld&&(o.scale[0]<0||o.scale[1]<0)){let I=o.padding[0],F=o.padding[1],D=o.padding[2],L=o.padding[3];o.scale[0]<0&&(F=-F,L=-L),o.scale[1]<0&&(I=-I,D=-D),S=[I,F,D,L]}let T=this.pixelRatio;this.instructions.push([vn.DRAW_IMAGE,l,A,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,S==ld?ld:S.map(function(I){return I*T}),y,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);let R=1/T,P=y?y.slice(0):null;P&&(P[1]=ro),this.hitDetectionInstructions.push([vn.DRAW_IMAGE,l,A,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[R,R],NaN,this.declutterMode_,this.declutterImageWithText_,S,P,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?ro:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(t)}}saveTextStates_(){let e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));let s=this.textKey_;s in this.textStates||(this.textStates[s]={font:t.font,textAlign:t.textAlign||Up,justify:t.justify,textBaseline:t.textBaseline||vA,scale:t.scale});let o=this.fillKey_;n&&(o in this.fillStates||(this.fillStates[o]={fillStyle:n.fillStyle}))}drawChars_(e,t){let n=this.textStrokeState_,r=this.textState_,s=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();let l=this.pixelRatio,c=x2[r.textBaseline],u=this.textOffsetX_*l,f=this.textOffsetY_*l,d=this.text_,A=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([vn.DRAW_CHARS,e,t,c,r.overflow,a,r.maxAngle,l,f,s,A*l,d,o,1,this.declutterMode_,this.textKeepUpright_,u]),this.hitDetectionInstructions.push([vn.DRAW_CHARS,e,t,c,r.overflow,a&&ro,r.maxAngle,l,f,s,A*l,d,o,1/l,this.declutterMode_,this.textKeepUpright_,u])}setTextStyle(e,t){let n,r,s;if(!e)this.text_="";else{let o=e.getFill();o?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=vl(o.getColor()||ro)):(r=null,this.textFillState_=r);let a=e.getStroke();if(!a)s=null,this.textStrokeState_=s;else{s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);let w=a.getLineDash(),S=a.getLineDashOffset(),T=a.getWidth(),R=a.getMiterLimit();s.lineCap=a.getLineCap()||yh,s.lineDash=w?w.slice():_l,s.lineDashOffset=S===void 0?xl:S,s.lineJoin=a.getLineJoin()||bh,s.lineWidth=T===void 0?cd:T,s.miterLimit=R===void 0?ad:R,s.strokeStyle=vl(a.getColor()||ia)}n=this.textState_;let l=e.getFont()||VE;xX(l);let c=e.getScaleArray();n.overflow=e.getOverflow(),n.font=l,n.maxAngle=e.getMaxAngle(),n.placement=e.getPlacement(),n.textAlign=e.getTextAlign(),n.repeat=e.getRepeat(),n.justify=e.getJustify(),n.textBaseline=e.getTextBaseline()||vA,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||ld,n.scale=c===void 0?[1,1]:c;let u=e.getOffsetX(),f=e.getOffsetY(),d=e.getRotateWithView(),A=e.getKeepUpright(),y=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=u===void 0?0:u,this.textOffsetY_=f===void 0?0:f,this.textRotateWithView_=d===void 0?!1:d,this.textKeepUpright_=A===void 0?!0:A,this.textRotation_=y===void 0?0:y,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:Bn(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=n.font+n.scale+(n.textAlign||"?")+(n.repeat||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle=="string"?r.fillStyle:"|"+Bn(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},mY=G6;var yme={Circle:k6,Default:Ch,Image:uY,LineString:hY,Polygon:k6,Text:mY},q6=class{constructor(e,t,n,r){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=r,this.resolution_=n,this.buildersByZIndex_={}}finish(){let e={};for(let t in this.buildersByZIndex_){e[t]=e[t]||{};let n=this.buildersByZIndex_[t];for(let r in n){let s=n[r].finish();e[t][r]=s}}return e}getBuilder(e,t){let n=e!==void 0?e.toString():"0",r=this.buildersByZIndex_[n];r===void 0&&(r={},this.buildersByZIndex_[n]=r);let s=r[t];if(s===void 0){let o=yme[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},AY=q6;function C3(i,e,t,n,r,s,o,a){o=o??[],a=a??n;let l=i[e+n],c=i[e+n+1],u=i[t-2*n],f=i[t-2*n+1],d,A,y,w,S,T,R,P,I=0;for(let F=e;F<t;F+=n){y=d,w=A,S=void 0,T=void 0,F+n<t&&(S=i[F+n],T=i[F+n+1]),s&&F===e&&(y=u,w=f),s&&F===t-n&&(S=l,T=c),d=i[F],A=i[F+1],[R,P]=bme(d,A,y,w,S,T,r),o[I++]=R,o[I++]=P;for(let D=2;D<a;D++)o[I++]=i[F+D]}return o.length!=I&&(o.length=I),o}function bme(i,e,t,n,r,s,o){let a,l;t!==void 0&&n!==void 0?(a=i-t,l=e-n):r!==void 0&&s!==void 0?(a=r-i,l=s-e):(a=1,l=0);let c=Math.hypot(a,l),u=a/c,f=l/c;if(a=-f,l=u,t===void 0||n===void 0)return[i+a*o,e+l*o];if(r===void 0||s===void 0)return[i+a*o,e+l*o];let d=PW([i,e],[t,n],[r,s]);if(Math.cos(d)>.998)return[i+u*o,e+f*o];let A=Math.cos(d/2),y=Math.sin(d/2),w=y*a+A*l,S=-A*a+y*l,T=w*(1/y),R=S*(1/y);return[i+T*o,e+R*o]}function R3(i,e,t=!1){for(let n=0,r=i.length-2;n<r;n+=e){let s=t&&n===0?i.length-3*e:i.length-2*e;for(let o=s;o>n+e;o-=e){let a=i[n],l=i[n+1],c=i[n+e],u=i[n+e+1],f=i[o],d=i[o+1],A=i[o+e],y=i[o+e+1],w=(y-d)*(c-a)-(A-f)*(u-l);if(w===0)continue;let S=((A-f)*(l-d)-(y-d)*(a-f))/w,T=((c-a)*(l-d)-(u-l)*(a-f))/w;if(S>0&&S<1&&T>0&&T<1){let R=a+S*(c-a),P=l+S*(u-l);i[n+e]=R,i[n+e+1]=P,i.splice(n+2*e,o-n-e);break}}}return i}var H6;function wme(){return H6||(H6=new Intl.Segmenter(void 0,{granularity:"grapheme"})),H6}function gY(i,e,t,n,r,s,o,a,l,c,u,f,d=!0){let A=i[e],y=i[e+1],w=0,S=0,T=0,R=0;function P(){w=A,S=y,e+=n,A=i[e],y=i[e+1],R+=T,T=Math.sqrt((A-w)*(A-w)+(y-S)*(y-S))}do P();while(e<t-n&&R+T<s);let I=T===0?0:(s-R)/T,F=Lo(w,A,I),D=Lo(S,y,I),L=e-n,C=R,B=s+a*l(c,r,u);for(;e<t-n&&R+T<B;)P();I=T===0?0:(B-R)/T;let k=Lo(w,A,I),z=Lo(S,y,I),G=!1;if(d)if(f){let te=[F,D,k,z];wE(te,0,4,2,f,te,te),G=te[0]>te[2]}else G=F>k;let W=Math.PI,Y=[],H=L+n===e;e=L,T=0,R=C,A=i[e],y=i[e+1];let $;if(H){P(),$=Math.atan2(y-S,A-w),G&&($+=$>0?-W:W);let te=(k+F)/2,ce=(z+D)/2;return Y[0]=[te,ce,(B-s)/2,$,r],Y}r=r.replace(/\n/g," ");let J=Array.from(wme().segment(r),te=>te.segment);for(let te=0,ce=J.length;te<ce;){P();let he=Math.atan2(y-S,A-w);if(G&&(he+=he>0?-W:W),$!==void 0){let Ee=he-$;if(Ee+=Ee>W?-2*W:Ee<-W?2*W:0,Math.abs(Ee)>o)return null}$=he;let ve=te,Re=0;for(;te<ce;++te){let Ee=G?ce-te-1:te,Ve=a*l(c,J[Ee],u);if(e+n<t&&R+T<s+Re+Ve/2)break;Re+=Ve}if(te===ve)continue;let Qe=(G?J.slice(ce-te,ce-ve):J.slice(ve,te)).join("");I=T===0?0:(s+Re/2-R)/T;let Fe=Lo(w,A,I),mt=Lo(S,y,I);Y.push([Fe,mt,Re/2,he,Qe]),s+=Re}return Y}var Rv=jr(),Hp=[],gd=[],vd=[],Wp=[];function vY(i){return i[3].declutterBox}var _Y=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function W6(i,e){return e==="start"?e=_Y.test(i)?"right":"left":e==="end"&&(e=_Y.test(i)?"left":"right"),x2[e]}function Sme(i,e,t){return t>0&&i.push(`8-`,""),i.push(e,""),i}function Tme(i,e,t){return t%2===0&&(i+=e),i}var j6=class{constructor(e,t,n,r,s){this.overlaps=n,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=go(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=s?new T3:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,n,r){let s=e+t+n+r;if(this.labels_[s])return this.labels_[s];let o=r?this.strokeStates[r]:null,a=n?this.fillStates[n]:null,l=this.textStates[t],c=this.pixelRatio,u=[l.scale[0]*c,l.scale[1]*c],f=l.justify?x2[l.justify]:W6(Array.isArray(e)?e[0]:e,l.textAlign||Up),d=r&&o.lineWidth?o.lineWidth:0,A=Array.isArray(e)?e:String(e).split(`9-`).reduce(Sme,[]),{width:y,height:w,widths:S,heights:T,lineWidths:R}=wX(l,A),P=y+d,I=[],F=(P+2)*u[0],D=(w+d)*u[1],L={width:F<0?Math.floor(F):Math.ceil(F),height:D<0?Math.floor(D):Math.ceil(D),contextInstructions:I};(u[0]!=1||u[1]!=1)&&I.push("scale",u),r&&(I.push("strokeStyle",o.strokeStyle),I.push("lineWidth",d),I.push("lineCap",o.lineCap),I.push("lineJoin",o.lineJoin),I.push("miterLimit",o.miterLimit),I.push("setLineDash",[o.lineDash]),I.push("lineDashOffset",o.lineDashOffset)),n&&I.push("fillStyle",a.fillStyle),I.push("textBaseline","middle"),I.push("textAlign","center");let C=.5-f,B=f*P+C*d,k=[],z=[],G=0,W=0,Y=0,H=0,$;for(let J=0,te=A.length;J<te;J+=2){let ce=A[J];if(ce===`10-`){W+=G,G=0,B=f*P+C*d,++H;continue}let he=A[J+1]||l.font;he!==$&&(r&&k.push("font",he),n&&z.push("font",he),$=he),G=Math.max(G,T[Y]);let ve=[ce,B+C*S[Y]+f*(S[Y]-R[H]),.5*(d+G)+W];B+=S[Y],r&&k.push("strokeText",ve),n&&z.push("fillText",ve),++Y}return Array.prototype.push.apply(I,k),Array.prototype.push.apply(I,z),this.labels_[s]=L,L}replayTextBackground_(e,t,n,r,s,o,a){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,n),e.lineTo.apply(e,r),e.lineTo.apply(e,s),e.lineTo.apply(e,t),o&&(this.alignAndScaleFill_=o[2],e.fillStyle=o[1],this.fill_(e)),a&&(this.setStrokeStyle_(e,a),e.stroke())}calculateImageOrLabelDimensions_(e,t,n,r,s,o,a,l,c,u,f,d,A,y,w,S){a*=d[0],l*=d[1];let T=n-a,R=r-l,P=s+c>e?e-c:s,I=o+u>t?t-u:o,F=y[3]+P*d[0]+y[1],D=y[0]+I*d[1]+y[2],L=T-y[3],C=R-y[0];(w||f!==0)&&(Hp[0]=L,Wp[0]=L,Hp[1]=C,gd[1]=C,gd[0]=L+F,vd[0]=gd[0],vd[1]=C+D,Wp[1]=vd[1]);let B;return f!==0?(B=No(go(),n,r,1,1,f,-n,-r),Xr(B,Hp),Xr(B,gd),Xr(B,vd),Xr(B,Wp),Hl(Math.min(Hp[0],gd[0],vd[0],Wp[0]),Math.min(Hp[1],gd[1],vd[1],Wp[1]),Math.max(Hp[0],gd[0],vd[0],Wp[0]),Math.max(Hp[1],gd[1],vd[1],Wp[1]),Rv)):Hl(Math.min(L,L+F),Math.min(C,C+D),Math.max(L,L+F),Math.max(C,C+D),Rv),A&&(T=Math.round(T),R=Math.round(R)),{drawImageX:T,drawImageY:R,drawImageW:P,drawImageH:I,originX:c,originY:u,declutterBox:{minX:Rv[0],minY:Rv[1],maxX:Rv[2],maxY:Rv[3],value:S},canvasTransform:B,scale:d}}replayImageOrLabel_(e,t,n,r,s,o,a){let l=!!(o||a),c=r.declutterBox,u=a?a[2]*r.scale[0]/2:0;return c.minX-u<=t[0]&&c.maxX+u>=0&&c.minY-u<=t[1]&&c.maxY+u>=0&&(l&&this.replayTextBackground_(e,Hp,gd,vd,Wp,o,a),SX(e,r.canvasTransform,s,n,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(e){let t=this.alignAndScaleFill_;if(t){let n=Xr(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;e.save(),e.translate(n[0]%r,n[1]%r),t!==1&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,n,r){let s=this.textStates[t],o=this.createLabel(e,t,r,n),a=this.strokeStates[n],l=this.pixelRatio,c=W6(Array.isArray(e)?e[0]:e,s.textAlign||Up),u=x2[s.textBaseline||vA],f=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*s.scale[0],A=c*d+2*(.5-c)*f,y=u*o.height/l+2*(.5-u)*f;return{label:o,anchorX:A,anchorY:y}}execute_(e,t,n,r,s,o,a,l){let c=this.zIndexContext_,u;this.pixelCoordinates_&&ta(n,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=Al(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),Mj(this.renderedTransform_,n));let f=0,d=r.length,A=0,y,w=[],S,T,R,P,I,F,D,L,C,B,k,z,G,W=0,Y=0,H=this.coordinateCache_,$=this.viewRotation_,J=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,te={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:$},ce=this.instructions!=r||this.overlaps?0:200,he,ve,Re,Qe;for(;f<d;){let Fe=r[f];switch(Fe[0]){case vn.BEGIN_GEOMETRY:he=Fe[1],Qe=Fe[3],he.getGeometry()?a!==void 0&&!Ar(a,Qe.getExtent())?f=Fe[2]+1:++f:f=Fe[2],c&&(c.zIndex=Fe[4]);break;case vn.BEGIN_PATH:W>ce&&(this.fill_(e),W=0),Y>ce&&(e.stroke(),Y=0),!W&&!Y&&(e.beginPath(),I=NaN,F=NaN),++f;break;case vn.CIRCLE:A=Fe[1],R=Fe[2]??0;let Ee=u[A],Ve=u[A+1],Ye=u[A+2]-R,Mt=u[A+3]-R,Et=Ye-Ee,It=Mt-Ve,dn=Math.sqrt(Et*Et+It*It);e.moveTo(Ee+dn,Ve),e.arc(Ee,Ve,dn,0,2*Math.PI,!0),++f;break;case vn.CLOSE_PATH:e.closePath(),++f;break;case vn.CUSTOM:A=Fe[1],y=Fe[2];let Gt=Fe[3],$e=Fe[4],ot=Fe[5];te.geometry=Gt,te.feature=he,f in H||(H[f]=[]);let nt=H[f];ot?ot(u,A,y,2,nt):(nt[0]=u[A],nt[1]=u[A+1],nt.length=2),c&&(c.zIndex=Fe[6]),$e(nt,te),++f;break;case vn.DRAW_IMAGE:A=Fe[1],y=Fe[2],C=Fe[3],S=Fe[4],T=Fe[5];let bt=Fe[6],yt=Fe[7],hn=Fe[8],en=Fe[9],tn=Fe[10],bn=Fe[11],_e=Fe[12],vi=Fe[13];P=Fe[14]||"declutter";let zn=Fe[15];if(!C&&Fe.length>=20){B=Fe[19],k=Fe[20],z=Fe[21],G=Fe[22];let Fn=this.drawLabelWithPointPlacement_(B,k,z,G);C=Fn.label,Fe[3]=C;let rs=Fe[23];S=(Fn.anchorX-rs)*this.pixelRatio,Fe[4]=S;let Dr=Fe[24];T=(Fn.anchorY-Dr)*this.pixelRatio,Fe[5]=T,bt=C.height,Fe[6]=bt,vi=C.width,Fe[13]=vi}let le;Fe.length>25&&(le=Fe[25]);let Z,Te,Pe;Fe.length>17?(Z=Fe[16],Te=Fe[17],Pe=Fe[18]):(Z=ld,Te=null,Pe=null),tn&&J?bn+=$:!tn&&!J&&(bn-=$);let Ge=0;for(;A<y;A+=2){if(le&&le[Ge++]<vi/this.pixelRatio)continue;let Fn=this.calculateImageOrLabelDimensions_(C.width,C.height,u[A],u[A+1],vi,bt,S,T,hn,en,bn,_e,s,Z,!!Te||!!Pe,he),rs=[e,t,C,Fn,yt,Te,Pe];if(l){let Dr,Bl,Sa;if(zn){let xr=y-A;if(!zn[xr]){zn[xr]={args:rs,declutterMode:P};continue}let Ks=zn[xr];Dr=Ks.args,Bl=Ks.declutterMode,delete zn[xr],Sa=vY(Dr)}let Ol,rl;if(Dr&&(Bl!=="declutter"||!l.collides(Sa))&&(Ol=!0),(P!=="declutter"||!l.collides(Fn.declutterBox))&&(rl=!0),Bl==="declutter"&&P==="declutter"){let xr=Ol&&rl;Ol=xr,rl=xr}Ol&&(Bl!=="none"&&l.insert(Sa),this.replayImageOrLabel_.apply(this,Dr)),rl&&(P!=="none"&&l.insert(Fn.declutterBox),this.replayImageOrLabel_.apply(this,rs))}else this.replayImageOrLabel_.apply(this,rs)}++f;break;case vn.DRAW_CHARS:let vt=Fe[1],Tt=Fe[2],qe=Fe[3],Je=Fe[4];G=Fe[5];let Pt=Fe[6],rn=Fe[7],Lt=Fe[8];z=Fe[9];let Rt=Fe[10];B=Fe[11],Array.isArray(B)&&(B=B.reduce(Tme,"")),k=Fe[12];let fn=[Fe[13],Fe[13]];P=Fe[14]||"declutter";let wn=Fe[15],Dn=Fe[16],ye=this.textStates[k],wt=ye.font,Ze=[ye.scale[0]*rn,ye.scale[1]*rn],St;wt in this.widths_?St=this.widths_[wt]:(St={},this.widths_[wt]=St);let Bt=mv(u,vt,Tt,2),ut=Math.abs(Ze[0])*QN(wt,B,St);if(Je||ut<=Bt){let Fn=this.textStates[k].textAlign,rs=(Bt-ut)*W6(B,Fn),Dr=gY(u,vt,Tt,2,B,rs,Pt,Math.abs(Ze[0]),QN,wt,St,J?0:this.viewRotation_,wn);e:if(Dr){let Bl=[],Sa,Ol,rl,xr,Ks;if(z)for(Sa=0,Ol=Dr.length;Sa<Ol;++Sa){Ks=Dr[Sa],rl=Ks[4],xr=this.createLabel(rl,k,"",z),S=Ks[2]+(Ze[0]<0?-Rt:Rt)-Dn,T=qe*xr.height+(.5-qe)*2*Rt*Ze[1]/Ze[0]-Lt;let Ul=this.calculateImageOrLabelDimensions_(xr.width,xr.height,Ks[0],Ks[1],xr.width,xr.height,S,T,0,0,Ks[3],fn,!1,ld,!1,he);if(l&&P==="declutter"&&l.collides(Ul.declutterBox))break e;Bl.push([e,t,xr,Ul,1,null,null])}if(G)for(Sa=0,Ol=Dr.length;Sa<Ol;++Sa){Ks=Dr[Sa],rl=Ks[4],xr=this.createLabel(rl,k,G,""),S=Ks[2]-Dn,T=qe*xr.height-Lt;let Ul=this.calculateImageOrLabelDimensions_(xr.width,xr.height,Ks[0],Ks[1],xr.width,xr.height,S,T,0,0,Ks[3],fn,!1,ld,!1,he);if(l&&P==="declutter"&&l.collides(Ul.declutterBox))break e;Bl.push([e,t,xr,Ul,1,null,null])}l&&P!=="none"&&l.load(Bl.map(vY));for(let Ul=0,oh=Bl.length;Ul<oh;++Ul)this.replayImageOrLabel_.apply(this,Bl[Ul])}}++f;break;case vn.END_GEOMETRY:if(o!==void 0){he=Fe[1];let Fn=o(he,Qe,P);if(Fn)return Fn}++f;break;case vn.FILL:ce?W++:this.fill_(e),++f;break;case vn.MOVE_TO_LINE_TO:A=Fe[1],y=Fe[2],R=Fe[3];let Ce,Yt,nr;if(R){let rs=(Fe[4]??!1)||Math.abs(u[A]-u[y-2])<1e-6&&Math.abs(u[A+1]-u[y-1])<1e-6;C3(u,A,y,2,R,rs,w),R3(w,2,rs),Ce=w,Yt=0,nr=Ce.length}else Ce=u,Yt=A,nr=y;ve=Ce[Yt],Re=Ce[Yt+1],e.moveTo(ve,Re),I=ve+.5|0,F=Re+.5|0;for(let Fn=Yt+2;Fn<nr;Fn+=2)ve=Ce[Fn],Re=Ce[Fn+1],D=ve+.5|0,L=Re+.5|0,(Fn==nr-2||D!==I||L!==F)&&(e.lineTo(ve,Re),I=D,F=L);++f;break;case vn.SET_FILL_STYLE:this.alignAndScaleFill_=Fe[2],W?(this.fill_(e),W=0,Y&&(e.stroke(),Y=0)):Y&&Fe[1]&&(e.stroke(),Y=0),e.fillStyle=Fe[1],++f;break;case vn.SET_STROKE_STYLE:W&&Fe[1]&&(this.fill_(e),W=0),Y&&(e.stroke(),Y=0),this.setStrokeStyle_(e,Fe),++f;break;case vn.STROKE:ce?Y++:e.stroke(),++f;break;default:++f;break}}W&&this.fill_(e),Y&&e.stroke()}execute(e,t,n,r,s,o){this.viewRotation_=r,this.execute_(e,t,n,this.instructions,s,void 0,void 0,o)}executeHitDetection(e,t,n,r,s){return this.viewRotation_=n,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,r,s)}},xY=j6;var jp=["Polygon","Circle","LineString","Image","Text","Default"],Y6=["Image","Text"],yY=jp.filter(i=>!Y6.includes(i)),bY=!1,wY=!1;function Eme(){let i=0,e=n=>{let r=Di(1,1,null,{willReadFrequently:n}),s=0,o=performance.now();for(;performance.now()-o<50;++s)r.fillStyle=`rgba(255,0,${s%256},1)`,r.fillRect(0,0,1,1),r.getImageData(0,0,1,1);return i=s>i?s:i,s};bY={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],wY=!0}var $6=class{constructor(e,t,n,r,s,o,a){this.maxExtent_=e,this.overlaps_=r,this.pixelRatio_=n,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=go(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,a)}clip(e,t){let n=this.getClipCoords(t);e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(n[2],n[3]),e.lineTo(n[4],n[5]),e.lineTo(n[6],n[7]),e.clip()}createExecutors_(e,t){for(let n in e){let r=this.executorsByZIndex_[n];r===void 0&&(r={},this.executorsByZIndex_[n]=r);let s=e[n];for(let o in s){let a=s[o];r[o]=new xY(this.resolution_,this.pixelRatio_,this.overlaps_,a,t)}}}hasExecutors(e){for(let t in this.executorsByZIndex_){let n=this.executorsByZIndex_[t];for(let r=0,s=e.length;r<s;++r)if(e[r]in n)return!0}return!1}forEachFeatureAtCoordinate(e,t,n,r,s,o){wY===!1&&Eme(),r=Math.round(r);let a=r*2+1,l=No(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Di(a,a,null,{willReadFrequently:bY}));let u=this.hitDetectionContext_;u.canvas.width!==a||u.canvas.height!==a?(u.canvas.width=a,u.canvas.height=a):c||u.clearRect(0,0,a,a);let f;this.renderBuffer_!==void 0&&(f=jr(),Jm(f,e),q1(f,t*(this.renderBuffer_+r),f));let d=Mme(r),A;function y(F,D,L){let C=u.getImageData(0,0,a,a).data;for(let B=0,k=d.length;B<k;B++)if(C[d[B]]>0){if(!o||L==="none"||A!=="Image"&&A!=="Text"||o.includes(F)){let z=(d[B]-3)/4,G=r-z%a,W=r-(z/a|0),Y=s(F,D,G*G+W*W);if(Y)return Y}u.clearRect(0,0,a,a);break}}let w=Object.keys(this.executorsByZIndex_).map(Number);w.sort(pl);let S,T,R,P,I;for(S=w.length-1;S>=0;--S){let F=w[S].toString();for(R=this.executorsByZIndex_[F],T=jp.length-1;T>=0;--T)if(A=jp[T],P=R[A],P!==void 0&&(I=P.executeHitDetection(u,l,n,y,f),I))return I}}getClipCoords(e){let t=this.maxExtent_;if(!t)return null;let n=t[0],r=t[1],s=t[2],o=t[3],a=[n,r,n,o,s,o,s,r];return Al(a,0,8,2,e,a),a}isEmpty(){return yu(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?tj:pl),o=o||jp;let c=jp.length;for(let u=0,f=l.length;u<f;++u){let d=l[u].toString(),A=this.executorsByZIndex_[d];for(let y=0,w=o.length;y<w;++y){let S=o[y],T=A[S];if(T!==void 0){let R=a===null?void 0:T.getZIndexContext(),P=R?R.getContext():e,I=this.maxExtent_&&S!=="Image"&&S!=="Text";if(I&&(P.save(),this.clip(P,n)),!R||S==="Text"||S==="Image"?T.execute(P,t,n,r,s,a):R.pushFunction(F=>T.execute(F,t,n,r,s,a)),I&&P.restore(),R){R.offset();let F=l[u]*c+jp.indexOf(S);this.deferredZIndexContexts_[F]||(this.deferredZIndexContexts_[F]=[]),this.deferredZIndexContexts_[F].push(R)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(pl);for(let n=0,r=t.length;n<r;++n)e[t[n]].forEach(s=>{s.draw(this.renderedContext_),s.clear()}),e[t[n]].length=0}},X6={};function Mme(i){if(X6[i]!==void 0)return X6[i];let e=i*2+1,t=i*i,n=new Array(t+1);for(let s=0;s<=i;++s)for(let o=0;o<=i;++o){let a=s*s+o*o;if(a>t)break;let l=n[a];l||(l=[],n[a]=l),l.push(((i+s)*e+(i+o))*4+3),s>0&&l.push(((i-s)*e+(i+o))*4+3),o>0&&(l.push(((i+s)*e+(i-o))*4+3),s>0&&l.push(((i-s)*e+(i-o))*4+3))}let r=[];for(let s=0,o=n.length;s<o;++s)n[s]&&r.push(...n[s]);return X6[i]=r,r}var SY=$6;var Z6=class extends M3{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?eA(Math.atan2(r[1],r[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=go()}drawImages_(e,t,n,r){if(!this.image_)return;let s=Al(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let c=this.imageRotation_;this.transformRotation_===0&&(c-=this.viewRotation_),this.imageRotateWithView_&&(c+=this.viewRotation_);for(let u=0,f=s.length;u<f;u+=2){let d=s[u]-this.imageAnchorX_,A=s[u+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let y=d+this.imageAnchorX_,w=A+this.imageAnchorY_;No(a,y,w,1,1,c,-y,-w),o.save(),o.transform.apply(o,a),o.translate(y,w),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,A,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(e,t,n,r){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let s=Al(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);t<n;t+=r){let l=s[t]+this.textOffsetX_,c=s[t+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,c-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,c),this.textFillState_&&o.fillText(this.text_,l,c))}}moveToLineTo_(e,t,n,r,s,o){let a=this.context_,l=Al(e,t,n,r,this.transform_,this.pixelCoordinates_);if(Math.abs(o)>0){let u=l.length,f=s||Math.abs(l[0]-l[u-2])<1e-6&&Math.abs(l[1]-l[u-1])<1e-6;l=C3(l,0,u,2,o,f,l),R3(l,2,f)}a.moveTo(l[0],l[1]);let c=l.length;s&&(c-=2);for(let u=2;u<c;u+=2)a.lineTo(l[u],l[u+1]);return s&&a.closePath(),n}drawRings_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o)t=this.moveToLineTo_(e,t,n[o],r,!0,s);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ar(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=Xj(e,this.transform_,this.pixelCoordinates_),n=t[2]-t[0],r=t[3]-t[1],s=Math.sqrt(n*n+r*r),o=this.context_;o.beginPath(),o.arc(t[0],t[1],s,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e);break;default:}}drawFeature(e,t){let n=t.getGeometryFunction()(e);n&&(this.setStyle(t),this.drawGeometry(n))}drawGeometryCollection(e){let t=e.getGeometriesArray();for(let n=0,r=t.length;n<r;++n)this.drawGeometry(t[n])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ar(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(n,0,n.length,e.getStride(),!1,this.strokeState_.strokeOffset),t.stroke()}if(this.text_!==""){let t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getExtent();if(Ar(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let n=this.context_,r=e.getFlatCoordinates(),s=0,o=e.getEnds(),a=e.getStride();n.beginPath();for(let l=0,c=o.length;l<c;++l)s=this.moveToLineTo_(r,s,o[l],a,!1,this.strokeState_.strokeOffset);n.stroke()}if(this.text_!==""){let n=e.getFlatMidpoints();this.drawText_(n,0,n.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ar(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ar(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getOrientedFlatCoordinates(),r=0,s=e.getEndss(),o=e.getStride();t.beginPath();for(let a=0,l=s.length;a<l;++a){let c=s[a];r=this.drawRings_(n,r,c,o,this.strokeState_?.strokeOffset)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){let t=this.context_,n=this.contextFillState_;n?n.fillStyle!=e.fillStyle&&(n.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){let t=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=e.lineCap&&(n.lineCap=e.lineCap,t.lineCap=e.lineCap),ta(n.lineDash,e.lineDash)||t.setLineDash(n.lineDash=e.lineDash),n.lineDashOffset!=e.lineDashOffset&&(n.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),n.lineJoin!=e.lineJoin&&(n.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),n.lineWidth!=e.lineWidth&&(n.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),n.miterLimit!=e.miterLimit&&(n.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),n.strokeStyle!=e.strokeStyle&&(n.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){let t=this.context_,n=this.contextTextState_,r=e.textAlign?e.textAlign:Up;n?(n.font!=e.font&&(n.font=e.font,t.font=e.font),n.textAlign!=r&&(n.textAlign=r,t.textAlign=r),n.textBaseline!=e.textBaseline&&(n.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=r,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:r,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{let n=e.getColor();this.fillState_={fillStyle:vl(n||ro)}}if(!t)this.strokeState_=null;else{let n=t.getColor(),r=t.getLineCap(),s=t.getLineDash(),o=t.getLineDashOffset(),a=t.getLineJoin(),l=t.getWidth(),c=t.getMiterLimit(),u=s||_l,f=t.getOffset();this.strokeState_={lineCap:r!==void 0?r:yh,lineDash:this.pixelRatio_===1?u:u.map(d=>d*this.pixelRatio_),lineDashOffset:(o||xl)*this.pixelRatio_,lineJoin:a!==void 0?a:bh,lineWidth:(l!==void 0?l:cd)*this.pixelRatio_,miterLimit:c!==void 0?c:ad,strokeStyle:vl(n||ia),strokeOffset:(f??0)*this.pixelRatio_}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}let n=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),s=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();let o=e.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/n,o[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(!e)this.text_="";else{let t=e.getFill();if(!t)this.textFillState_=null;else{let A=t.getColor();this.textFillState_={fillStyle:vl(A||ro)}}let n=e.getStroke();if(!n)this.textStrokeState_=null;else{let A=n.getColor(),y=n.getLineCap(),w=n.getLineDash(),S=n.getLineDashOffset(),T=n.getLineJoin(),R=n.getWidth(),P=n.getMiterLimit();this.textStrokeState_={lineCap:y!==void 0?y:yh,lineDash:w||_l,lineDashOffset:S||xl,lineJoin:T!==void 0?T:bh,lineWidth:R!==void 0?R:cd,miterLimit:P!==void 0?P:ad,strokeStyle:vl(A||ia)}}let r=e.getFont(),s=e.getOffsetX(),o=e.getOffsetY(),a=e.getRotateWithView(),l=e.getRotation(),c=e.getScaleArray(),u=e.getText(),f=e.getTextAlign(),d=e.getTextBaseline();this.textState_={font:r!==void 0?r:VE,textAlign:f!==void 0?f:Up,textBaseline:d!==void 0?d:vA},this.text_=u!==void 0?Array.isArray(u)?u.reduce((A,y,w)=>A+=w%2?" ":y,""):u:"",this.textOffsetX_=s!==void 0?this.pixelRatio_*s:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}},TY=Z6;var Pu=.5;function EY(i,e,t,n,r,s,o,a,l){let c=l?Mp(r,l):r,u=i[0]*Pu,f=i[1]*Pu,d=Di(u,f);d.imageSmoothingEnabled=!1;let A=d.canvas,y=new TY(d,Pu,r,null,o,a,l?iA(sA(),l):null),w=t.length,S=Math.floor((256*256*256-1)/w),T={};for(let P=1;P<=w;++P){let I=t[P-1],F=I.getStyleFunction()||n;if(!F)continue;let D=F(I,s);if(!D)continue;Array.isArray(D)||(D=[D]);let C=(P*S).toString(16).padStart(7,"#00000");for(let B=0,k=D.length;B<k;++B){let z=D[B],G=z.getGeometryFunction()(I);if(!G||!Ar(c,G.getExtent()))continue;let W=z.clone(),Y=W.getFill();Y&&Y.setColor(C);let H=W.getStroke();H&&(H.setColor(C),H.setLineDash(null)),W.setText(void 0);let $=z.getImage();if($){let he=$.getImageSize();if(!he)continue;let ve=Di(he[0],he[1],void 0,{alpha:!1}),Re=ve.canvas;ve.fillStyle=C,ve.fillRect(0,0,Re.width,Re.height),W.setImage(new _A({img:Re,anchor:$.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:$.getOrigin(),opacity:1,size:$.getSize(),scale:$.getScale(),rotation:$.getRotation(),rotateWithView:$.getRotateWithView()}))}let J=W.getZIndex()||0,te=T[J];te||(te={},T[J]=te,te.Polygon=[],te.Circle=[],te.LineString=[],te.Point=[]);let ce=G.getType();if(ce==="GeometryCollection"){let he=G.getGeometriesArrayRecursive();for(let ve=0,Re=he.length;ve<Re;++ve){let Qe=he[ve];te[Qe.getType().replace("Multi","")].push(Qe,W)}}else te[ce.replace("Multi","")].push(G,W)}}let R=Object.keys(T).map(Number).sort(pl);for(let P=0,I=R.length;P<I;++P){let F=T[R[P]];for(let D in F){let L=F[D];for(let C=0,B=L.length;C<B;C+=2){y.setStyle(L[C+1]);for(let k=0,z=e.length;k<z;++k)y.setTransform(e[k]),y.drawGeometry(L[C])}}}return d.getImageData(0,0,A.width,A.height)}function MY(i,e,t){let n=[];if(t){let r=Math.floor(Math.round(i[0])*Pu),s=Math.floor(Math.round(i[1])*Pu),o=(Si(r,0,t.width-1)+Si(s,0,t.height-1)*t.width)*4,a=t.data[o],l=t.data[o+1],u=t.data[o+2]+256*(l+256*a),f=Math.floor((256*256*256-1)/e.length);u&&u%f===0&&n.push(e[u/f-1])}return n}var Cme=.5,CY={Point:Fme,LineString:Lme,Polygon:Ome,MultiPoint:Bme,MultiLineString:Dme,MultiPolygon:Nme,GeometryCollection:Pme,Circle:Rme};function RY(i,e){return parseInt(Bn(i),10)-parseInt(Bn(e),10)}function K6(i,e){let t=Q6(i,e);return t*t}function Q6(i,e){return Cme*i/e}function Rme(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(s||o){let l=i.getBuilder(t.getZIndex(),"Circle");l.setFillStrokeStyle(s,o),l.drawCircle(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}function J6(i,e,t,n,r,s,o,a){let l=[],c=t.getImage();if(c){let d=!0,A=c.getImageState();A==In.LOADED||A==In.ERROR?d=!1:A==In.IDLE&&c.load(),d&&l.push(c.ready())}let u=t.getFill();u&&u.loading()&&l.push(u.ready());let f=l.length>0;return f&&Promise.all(l).then(()=>r(null)),Ime(i,e,t,n,s,o,a),f}function Ime(i,e,t,n,r,s,o){let a=t.getGeometryFunction()(e);if(!a)return;let l=a.simplifyTransformed(n,r);if(t.getRenderer())IY(i,l,t,e,o);else{let u=CY[l.getType()];u(i,l,t,e,o,s)}}function IY(i,e,t,n,r){if(e.getType()=="GeometryCollection"){let o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)IY(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function Pme(i,e,t,n,r,s){let o=e.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=CY[o[a].getType()];c(i,o[a],t,n,r,s)}}function Lme(i,e,t,n,r){let s=t.getStroke();if(s){let a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawLineString(e,n,r)}let o=t.getText();if(o&&o.getText()){let a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,n,r)}}function Dme(i,e,t,n,r){let s=t.getStroke();if(s){let a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawMultiLineString(e,n,r)}let o=t.getText();if(o&&o.getText()){let a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,n,r)}}function Nme(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(o||s){let l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawMultiPolygon(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}function Fme(i,e,t,n,r,s){let o=t.getImage(),a=t.getText(),l=a&&a.getText(),c=s&&o&&l?{}:void 0;if(o){if(o.getImageState()!=In.LOADED)return;let u=i.getBuilder(t.getZIndex(),"Image");u.setImageStyle(o,c),u.drawPoint(e,n,r)}if(l){let u=i.getBuilder(t.getZIndex(),"Text");u.setTextStyle(a,c),u.drawText(e,n,r)}}function Bme(i,e,t,n,r,s){let o=t.getImage(),a=o&&o.getOpacity()!==0,l=t.getText(),c=l&&l.getText(),u=s&&a&&c?{}:void 0;if(a){if(o.getImageState()!=In.LOADED)return;let f=i.getBuilder(t.getZIndex(),"Image");f.setImageStyle(o,u),f.drawMultiPoint(e,n,r)}if(c){let f=i.getBuilder(t.getZIndex(),"Text");f.setTextStyle(l,u),f.drawText(e,n,r)}}function Ome(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(s||o){let l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawPolygon(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}var e8=class extends E3{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=jr(),this.wrappedRenderedExtent_=jr(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(e,t,n){let r=t.extent,s=t.viewState,o=s.center,a=s.resolution,l=s.projection,c=s.rotation,u=l.getExtent(),f=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),A=t.pixelRatio,y=t.viewHints,w=!(y[so.ANIMATING]||y[so.INTERACTING]),S=this.context,T=Math.round(Kn(r)/a*A),R=Math.round(Nr(r)/a*A),P=f.getWrapX()&&l.canWrapX(),I=P?Kn(u):null,F=P?Math.ceil((r[2]-u[2])/I)+(this.extendX_?2:1):1,D=P?Math.floor((r[0]-u[0])/I)-(this.extendX_?1:0):0;do{let L=this.getRenderTransform(o,a,0,A,T,R,D*I);t.declutter&&(L=L.slice(0)),e.execute(S,[S.canvas.width,S.canvas.height],L,c,w,n===void 0?jp:n?Y6:yY,n?d&&t.declutter[d]:void 0)}while(++D<F)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Di(this.context.canvas.width,this.context.canvas.height,M6))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){let e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,cA(this.context),M6.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,e,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(e,t){let n=e.layerStatesArray[e.layerIndex];this.opacity_=n.opacity;let r=e.viewState;this.prepareContainer(e,t);let s=this.context,o=this.replayGroup_,a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(Oo.PRERENDER)||this.getLayer().hasListener(Oo.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(s,e);let l=r.projection;this.clipExtent_=null;let c=!1;if(a&&n.extent&&this.clipping){let u=Su(n.extent,l);a=Ar(u,e.extent),a&&!dh(u,e.extent)&&(e.declutter?this.clipExtent_=u:(this.clipUnrotated(s,e,u),c=!0))}return a&&this.renderWorlds(o,e,this.getLayer().getDeclutter()?!1:void 0),c&&s.restore(),this.postRender(s,e),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let n=this.frameState.size.slice(),r=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,c=this.getLayer(),u=[],f=n[0]*Pu,d=n[1]*Pu;u.push(this.getRenderTransform(r,s,o,Pu,f,d,0).slice());let A=c.getSource(),y=a.getExtent();if(A.getWrapX()&&a.canWrapX()&&!dh(y,l)){let S=l[0],T=Kn(y),R=0,P;for(;S<y[0];)--R,P=T*R,u.push(this.getRenderTransform(r,s,o,Pu,f,d,P).slice()),S+=T;for(R=0,S=l[2];S>y[2];)++R,P=T*R,u.push(this.getRenderTransform(r,s,o,Pu,f,d,P).slice()),S-=T}let w=sA();this.hitDetectionImageData_=EY(n,u,this.renderedFeatures_,c.getStyleFunction(),l,s,o,K6(s,this.renderedPixelRatio_),w?a:null)}t(MY(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,n,r,s){if(!this.replayGroup_)return;let o=t.viewState.resolution,a=t.viewState.rotation,l=this.getLayer(),c={},u=function(d,A,y){let w=Bn(d),S=c[w];if(S){if(S!==!0&&y<S.distanceSq){if(y===0)return c[w]=!0,s.splice(s.lastIndexOf(S),1),r(d,l,A);S.geometry=A,S.distanceSq=y}}else{if(y===0)return c[w]=!0,r(d,l,A);s.push(c[w]={feature:d,layer:l,geometry:A,distanceSq:y,callback:r})}},f=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,o,a,n,u,f?t.declutter?.[f]?.all().map(d=>d.value):null)}handleFontsChanged(){let e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){let t=this.getLayer(),n=t.getSource();if(!n)return!1;let r=e.viewHints[so.ANIMATING],s=e.viewHints[so.INTERACTING],o=t.getUpdateWhileAnimating(),a=t.getUpdateWhileInteracting();if(this.ready&&!o&&r||!a&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let l=e.extent,c=e.viewState,u=c.projection,f=c.resolution,d=e.pixelRatio,A=t.getRevision(),y=t.getRenderBuffer(),w=t.getRenderOrder();w===void 0&&(w=RY);let S=c.center.slice(),T=q1(l,y*f),R=T.slice(),P=[T.slice()],I=u.getExtent(),F=n.getWrapX()&&u.canWrapX();if(this.extendX_=!1,F){let $=n.getExtent();$&&!mh($)&&(this.extendX_=$[0]<I[0]||$[2]>I[2])}if(F&&(!dh(I,e.extent)||this.extendX_)){let $=Kn(I),J=Math.max(Kn(T)/2,$),te=I[0],ce=I[2];this.extendX_&&(te-=$,ce+=$),T[0]=te-J,T[2]=ce+J,QT(S,u);let he=DD(P[0],u);he[0]<I[0]&&he[2]<I[2]?P.push([he[0]+$,he[1],he[2]+$,he[3]]):he[0]>I[0]&&he[2]>I[2]&&P.push([he[0]-$,he[1],he[2]-$,he[3]])}if(this.ready&&this.renderedResolution_==f&&this.renderedPixelRatio_===d&&this.renderedRevision_==A&&this.renderedRenderOrder_==w&&this.renderedFrameDeclutter_===!!e.declutter&&dh(this.wrappedRenderedExtent_,T))return ta(this.renderedExtent_,R)||(this.hitDetectionImageData_=null,this.renderedExtent_=R),this.renderedCenter_=S,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let D=new AY(Q6(f,d),T,f,d),L=sA(),C;if(L){for(let $=0,J=P.length;$<J;++$){let te=P[$],ce=Mp(te,u);n.loadFeatures(ce,QW(f,u),L)}C=iA(L,u)}else for(let $=0,J=P.length;$<J;++$)n.loadFeatures(P[$],f,u);let B=K6(f,d),k=!0,z=($,J)=>{let te,ce=$.getStyleFunction()||t.getStyleFunction();if(ce&&(te=ce($,f)),te){let he=this.renderFeature($,B,te,D,C,this.getLayer().getDeclutter(),J);k=k&&!he}},G=Mp(T,u),W=n.getFeaturesInExtent(G);w&&W.sort(w);for(let $=0,J=W.length;$<J;++$)z(W[$],$);this.renderedFeatures_=W,this.ready=k;let Y=D.finish(),H=new SY(T,f,d,n.getOverlaps(),Y,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=f,this.renderedRevision_=A,this.renderedRenderOrder_=w,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=R,this.wrappedRenderedExtent_=T,this.renderedCenter_=S,this.renderedProjection_=u,this.renderedPixelRatio_=d,this.replayGroup_=H,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,n,r,s,o,a){if(!n)return!1;let l=!1;if(Array.isArray(n))for(let c=0,u=n.length;c<u;++c)l=J6(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=J6(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}},PY=e8;var t8=class extends b3{constructor(e){super(e)}createRenderer(){return new PY(this)}},LY=t8;var Ume=!1;function kme(i,e,t,n,r,s,o){let a=new XMLHttpRequest;a.open("GET",typeof i=="function"?i(t,n,r):i,!0),e.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=Ume,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){let c=e.getType();try{let u;c=="text"||c=="json"?u=a.responseText:c=="xml"?u=a.responseXML||a.responseText:c=="arraybuffer"&&(u=a.response),u?s(e.readFeatures(u,{extent:t,featureProjection:r}),e.readProjection(u)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function n8(i,e){return function(t,n,r,s,o){kme(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function DY(i,e){return[[-1/0,-1/0,1/0,1/0]]}var NY=go(),y2=class i{constructor(e,t,n,r,s,o){this.styleFunction,this.extent_,this.id_=o,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=s,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?WT(this.flatCoordinates_):H1(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=dl(this.getExtent());this.flatInteriorPoints_=Hy(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=aX(this.flatCoordinates_,this.ends_),t=PE(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=CE(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=xA(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];let e=this.flatCoordinates_,t=0,n=this.ends_;for(let r=0,s=n.length;r<s;++r){let o=n[r],a=xA(e,t,o,this.stride_,.5);Do(this.flatMidpoints_,a),t=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=ks(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let r=Nr(n)/Nr(t);No(NY,n[0],n[3],r,-r,0,0,0),Al(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,NY,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new i(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=hE((e,t)=>{if(e===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),t&&this.simplifiedGeometry_.applyTransform(t);let n=this.simplifiedGeometry_.getFlatCoordinates(),r;switch(this.type_){case"LineString":n.length=mA(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=ME(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=qy(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(e),n,0,r);break;default:}return r&&(this.simplifiedGeometry_=new i(this.type_,n,r,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=e,this.simplifiedGeometry_}),this}};y2.prototype.getFlatCoordinates=y2.prototype.getOrientedFlatCoordinates;var CA=y2;var i8=class{constructor(e){this.rbush_=new TA(e),this.items_={}}insert(e,t){let n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(n),this.items_[Bn(t)]=n}load(e,t){let n=new Array(t.length);for(let r=0,s=t.length;r<s;r++){let o=e[r],a=t[r],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};n[r]=l,this.items_[Bn(a)]=l}this.rbush_.load(n)}remove(e){let t=Bn(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[Bn(t)],r=[n.minX,n.minY,n.maxX,n.maxY];Qm(r,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){let t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(r){return r.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let n;for(let r=0,s=e.length;r<s;r++)if(n=t(e[r]),n)return n;return n}isEmpty(){return yu(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return Hl(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(let t in e.items_)this.items_[t]=e.items_[t]}},r8=i8;var Zl={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Rh=class extends Ao{constructor(e,t,n){super(e),this.feature=t,this.features=n}},s8=class extends xE{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:e.wrapX!==void 0?e.wrapX:!0}),this.on,this.once,this.un,this.loader_=rd,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&(jn(this.format_,"`format` must be set when `url` is set"),this.loader_=n8(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:DY;let t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new r8:null,this.loadedExtentsRtree_=new r8,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,r;Array.isArray(e.features)?r=e.features:e.features&&(n=e.features,r=n.getArray()),!t&&n===void 0&&(n=new Fo(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=Bn(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);let n=e.getGeometry();if(n){let r=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new Rh(Zl.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof CA||(this.featureChangeKeys_[e]=[qn(t,nn.CHANGE,this.handleFeatureChange_,this),qn(t,Tu.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let n=!0;if(t.getId()!==void 0){let r=String(t.getId());if(!(r in this.idIndex_))this.idIndex_[r]=t;else if(t instanceof CA){let s=this.idIndex_[r];s instanceof CA?Array.isArray(s)?s.push(t):this.idIndex_[r]=[s,t]:n=!1}else n=!1}return n&&(jn(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),n}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){let t=[],n=[],r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s],l=Bn(a);this.addToIndex_(l,a)&&n.push(a)}for(let s=0,o=n.length;s<o;s++){let a=n[s],l=Bn(a);this.setupChangeEvents_(l,a);let c=a.getGeometry();if(c){let u=c.getExtent();t.push(u),r.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(t,r),this.hasListener(Zl.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new Rh(Zl.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(Zl.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener(Zl.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(vo.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(vo.REMOVE,n=>{t||(t=!0,this.removeFeature(n.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(let n in this.featureChangeKeys_)this.featureChangeKeys_[n].forEach(li);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(n=>{this.removeFeatureInternal(n)});for(let n in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[n])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let t=new Rh(Zl.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){let n=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(n,function(r){let s=r.getGeometry();if(s instanceof CA||s.intersectsCoordinate(e))return t(r)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(n){let r=n.getGeometry();if(r instanceof CA||r.intersectsExtent(e)){let s=t(n);if(s)return s}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),yu(this.nullGeometryFeatures_)||Do(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){let t=[];return this.forEachFeatureAtCoordinateDirect(e,function(n){t.push(n)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);let r=$T(e,t);return[].concat(...r.map(s=>this.featuresRtree_.getInExtent(s)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){let n=e[0],r=e[1],s=null,o=[NaN,NaN],a=1/0,l=[-1/0,-1/0,1/0,1/0];return t=t||nd,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){let u=c.getGeometry(),f=a;if(a=u instanceof CA?0:u.closestPointXY(n,r,o,a),a<f){s=c;let d=Math.sqrt(a);l[0]=n-d,l[1]=r-d,l[2]=n+d,l[3]=r+d}}}),s}getExtent(e){return this.featuresRtree_?.getExtent(e)??null}getFeatureById(e){let t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){let t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){let t=e.target,n=Bn(t),r=t.getGeometry();if(!r)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[n]=t);else{let o=r.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(o,t)):this.featuresRtree_&&this.featuresRtree_.update(o,t)}let s=t.getId();if(s!==void 0){let o=s.toString();this.idIndex_[o]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[o]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[n]=t;this.changed(),this.dispatchEvent(new Rh(Zl.CHANGEFEATURE,t))}hasFeature(e){let t=e.getId();if(t!==void 0){let n=this.idIndex_[String(t)];return Array.isArray(n)?n.includes(e):n===e}return Bn(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&yu(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,n){let r=this.loadedExtentsRtree_,s=this.strategy_(e,t,n);for(let o=0,a=s.length;o<a;++o){let l=s[o];if(!r.forEachInExtent(l,function(u){return dh(u.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Rh(Zl.FEATURESLOADSTART));let u=y=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Rh(Zl.FEATURESLOADEND,void 0,y))},f=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Rh(Zl.FEATURESLOADERROR))},d=!1,A=this.loader_.call(this,l,t,n,y=>d||u(y),()=>d||f());A instanceof Promise?(d=!0,A.then(y=>{this.addFeatures(y),u(y)}).catch(f)):this.loader_.length<4&&(this.loading=!1),r.insert(l,{extent:l.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){let t=this.loadedExtentsRtree_,n=[];t.forEachInExtent(e,function(r){n.push(r)}),n.forEach(r=>{t.remove(r);let s=LD(r.extent,e);for(let o of s)t.insert(o,{extent:o})})}removeFeatures(e){let t=!1;for(let n=0,r=e.length;n<r;++n)t=this.removeFeatureInternal(e[n])||t;t&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){let t=Bn(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(li),delete this.featureChangeKeys_[t];let r=e.getId();if(r!==void 0){let s=r.toString(),o=this.idIndex_[s];o===e?delete this.idIndex_[s]:Array.isArray(o)&&(o.splice(o.indexOf(e),1),o.length===1&&(this.idIndex_[s]=o[0]))}return delete this.uidIndex_[t],this.hasListener(Zl.REMOVEFEATURE)&&this.dispatchEvent(new Rh(Zl.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(let t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){jn(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(n8(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},_d=s8;var qa={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},d0={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},FM=0,pb=1,BM=2;var X8=0,p0=1,OM=2,Wc=3,zo=0,mi=1,vr=2,ms=0,Ms=1,Oh=2,Uh=3,kh=4,Bd=5,mb=6,oo=100,Ab=101,gb=102,UM=103,kM=104,Uu=200,vb=201,_b=202,xb=203,e0=204,t0=205,yb=206,bb=207,wb=208,Sb=209,Tb=210,wZ=211,SZ=212,TZ=213,EZ=214,DA=0,NA=1,FA=2,Lh=3,BA=4,OA=5,UA=6,kA=7,ng=0,zM=1,VM=2,ao=0,Eb=1,Mb=2,Cb=3,Rb=4,$8=5,Ib=6,Pb=7;var Lb=300,nc=301,jc=302,m0=303,A0=304,zh=306,Rd=1e3,la=1001,Id=1002,Ti=1003,Db=1004;var Xc=1005;var Mi=1006,g0=1007;var Go=1008,Y8=1008,Ji=1009,Vh=1010,Gh=1011,Sl=1012,Kr=1013,xi=1014,cr=1015,Wi=1016,ig=1017,rg=1018,ua=1020,sg=35902,og=35899,f_=1021,Od=1022,Ur=1023,Gs=1026,xo=1027,Ud=1028,qh=1029,js=1030,Hh=1031,Nb=1032,v0=1033,Wh=33776,jh=33777,Xh=33778,$h=33779,ag=35840,lg=35841,cg=35842,ug=35843,_0=36196,x0=37492,y0=37496,b0=37488,w0=37489,Yh=37490,S0=37491,T0=37808,E0=37809,M0=37810,C0=37811,R0=37812,I0=37813,P0=37814,L0=37815,D0=37816,N0=37817,F0=37818,B0=37819,O0=37820,U0=37821,k0=36492,z0=36494,V0=36495,G0=36283,q0=36284,Zh=36285,H0=36286;var F2=2300,cM=2301,aM=2302,N8=2303,F8=2400,B8=2401,O8=2402;var Z8=0,K8=1,GM=2,MZ=3200;var ic=0,qM=1,ha="",Br="srgb",n0="srgb-linear",i0="linear",kt="srgb",Fb="",HM="rg",Q8="ga",J8=0,Td=7680,eF=7681,tF=7682,nF=7683,iF=34055,rF=34056,sF=5386,oF=512,aF=513,lF=514,cF=515,uF=516,hF=517,fF=518,B2=519,Bb=512,d_=513,Ob=514,Kh=515,hg=516,Ub=517,ku=518,kb=519,r0=35044,fg=35048;var dF="300 es",ko=2e3,yl=2001,$c={COMPUTE:"compute",RENDER:"render"};var kd={TEXTURE_COMPARE:"depthTextureCompare"};function zme(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function p_(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function Zv(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function WM(){let i=Zv("canvas");return i.style.display="block",i}var FY={},Kv=null;function zA(...i){let e="THREE."+i.shift();Kv?Kv("log",e,...i):console.log(e,...i)}function CZ(i){let e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function Xe(...i){i=CZ(i);let e="THREE."+i.shift();if(Kv)Kv("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function ze(...i){i=CZ(i);let e="THREE."+i.shift();if(Kv)Kv("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function ni(...i){let e=i.join(" ");e in FY||(FY[e]=!0,Xe(...i))}function pF(){return typeof self<"u"&&typeof self.scheduler<"u"&&typeof self.scheduler.yield<"u"?self.scheduler.yield():new Promise(i=>{requestAnimationFrame(i)})}function RZ(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}var zb={[DA]:NA,[FA]:UA,[BA]:kA,[Lh]:OA,[NA]:DA,[UA]:FA,[kA]:BA,[OA]:Lh},ca=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let r=n.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}},oa=["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"],BY=1234567,P2=Math.PI/180,Pd=180/Math.PI;function Ph(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(oa[i&255]+oa[i>>8&255]+oa[i>>16&255]+oa[i>>24&255]+"-"+oa[e&255]+oa[e>>8&255]+"-"+oa[e>>16&15|64]+oa[e>>24&255]+"-"+oa[t&63|128]+oa[t>>8&255]+"-"+oa[t>>16&255]+oa[t>>24&255]+oa[n&255]+oa[n>>8&255]+oa[n>>16&255]+oa[n>>24&255]).toLowerCase()}function Nn(i,e,t){return Math.max(e,Math.min(t,i))}function mF(i,e){return(i%e+e)%e}function Vme(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function Gme(i,e,t){return i!==e?(t-i)/(e-i):0}function L2(i,e,t){return(1-t)*i+t*e}function qme(i,e,t,n){return L2(i,e,1-Math.exp(-t*n))}function Hme(i,e=1){return e-Math.abs(mF(i,e*2)-e)}function Wme(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function jme(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Xme(i,e){return i+Math.floor(Math.random()*(e-i+1))}function $me(i,e){return i+Math.random()*(e-i)}function Yme(i){return i*(.5-Math.random())}function Zme(i){i!==void 0&&(BY=i);let e=BY+=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 Kme(i){return i*P2}function Qme(i){return i*Pd}function Jme(i){return(i&i-1)===0&&i!==0}function eAe(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function tAe(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function nAe(i,e,t,n,r){let s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),f=s((e-n)/2),d=o((e-n)/2),A=s((n-e)/2),y=o((n-e)/2);switch(r){case"XYX":i.set(a*u,l*f,l*d,a*c);break;case"YZY":i.set(l*d,a*u,l*f,a*c);break;case"ZXZ":i.set(l*f,l*d,a*u,a*c);break;case"XZX":i.set(a*u,l*y,l*A,a*c);break;case"YXY":i.set(l*A,a*u,l*y,a*c);break;case"ZYZ":i.set(l*y,l*A,a*u,a*c);break;default:Xe("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Fa(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function Zn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}var zu={DEG2RAD:P2,RAD2DEG:Pd,generateUUID:Ph,clamp:Nn,euclideanModulo:mF,mapLinear:Vme,inverseLerp:Gme,lerp:L2,damp:qme,pingpong:Hme,smoothstep:Wme,smootherstep:jme,randInt:Xme,randFloat:$me,randFloatSpread:Yme,seededRandom:Zme,degToRad:Kme,radToDeg:Qme,isPowerOfTwo:Jme,ceilPowerOfTwo:eAe,floorPowerOfTwo:tAe,setQuaternionFromProperEuler:nAe,normalize:Zn,denormalize:Fa},xF=class xF{constructor(e=0,t=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("THREE.Vector2: 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("THREE.Vector2: 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){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Nn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};xF.prototype.isVector2=!0;var Oe=xF,qs=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,o,a){let l=n[r+0],c=n[r+1],u=n[r+2],f=n[r+3],d=s[o+0],A=s[o+1],y=s[o+2],w=s[o+3];if(f!==w||l!==d||c!==A||u!==y){let S=l*d+c*A+u*y+f*w;S<0&&(d=-d,A=-A,y=-y,w=-w,S=-S);let T=1-a;if(S<.9995){let R=Math.acos(S),P=Math.sin(R);T=Math.sin(T*R)/P,a=Math.sin(a*R)/P,l=l*T+d*a,c=c*T+A*a,u=u*T+y*a,f=f*T+w*a}else{l=l*T+d*a,c=c*T+A*a,u=u*T+y*a,f=f*T+w*a;let R=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=R,c*=R,u*=R,f*=R}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,r,s,o){let a=n[r],l=n[r+1],c=n[r+2],u=n[r+3],f=s[o],d=s[o+1],A=s[o+2],y=s[o+3];return e[t]=a*y+u*f+l*A-c*d,e[t+1]=l*y+u*d+c*f-a*A,e[t+2]=c*y+u*A+a*d-l*f,e[t+3]=u*y-a*f-l*d-c*A,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(r/2),f=a(s/2),d=l(n/2),A=l(r/2),y=l(s/2);switch(o){case"XYZ":this._x=d*u*f+c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f-d*A*y;break;case"YXZ":this._x=d*u*f+c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f+d*A*y;break;case"ZXY":this._x=d*u*f-c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f-d*A*y;break;case"ZYX":this._x=d*u*f-c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f+d*A*y;break;case"YZX":this._x=d*u*f+c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f-d*A*y;break;case"XZY":this._x=d*u*f-c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f+d*A*y;break;default:Xe("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],d=n+a+f;if(d>0){let A=.5/Math.sqrt(d+1);this._w=.25/A,this._x=(u-l)*A,this._y=(s-c)*A,this._z=(o-r)*A}else if(n>a&&n>f){let A=2*Math.sqrt(1+n-a-f);this._w=(u-l)/A,this._x=.25*A,this._y=(r+o)/A,this._z=(s+c)/A}else if(a>f){let A=2*Math.sqrt(1+a-n-f);this._w=(s-c)/A,this._x=(r+o)/A,this._y=.25*A,this._z=(l+u)/A}else{let A=2*Math.sqrt(1+f-n-a);this._w=(o-r)/A,this._x=(s+c)/A,this._y=(l+u)/A,this._z=.25*A}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Nn(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-r*a,this._w=o*u-n*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,r=-r,s=-s,o=-o,a=-a);let l=1-t;if(a<.9995){let c=Math.acos(a),u=Math.sin(c);l=Math.sin(l*c)/u,t=Math.sin(t*c)/u,this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},yF=class yF{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: 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("THREE.Vector3: 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(OY.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(OY.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*n),u=2*(a*t-s*r),f=2*(s*n-o*t);return this.x=t+l*c+o*f-a*u,this.y=n+l*u+a*c-s*f,this.z=r+l*f+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this.z=Nn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this.z=Nn(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return o8.copy(this).projectOnVector(e),this.sub(o8)}reflect(e){return this.sub(o8.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Nn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};yF.prototype.isVector3=!0;var re=yF,o8=new re,OY=new qs,bF=class bF{constructor(e,t,n,r,s,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c)}set(e,t,n,r,s,o,a,l,c){let u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let 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){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],f=n[7],d=n[2],A=n[5],y=n[8],w=r[0],S=r[3],T=r[6],R=r[1],P=r[4],I=r[7],F=r[2],D=r[5],L=r[8];return s[0]=o*w+a*R+l*F,s[3]=o*S+a*P+l*D,s[6]=o*T+a*I+l*L,s[1]=c*w+u*R+f*F,s[4]=c*S+u*P+f*D,s[7]=c*T+u*I+f*L,s[2]=d*w+A*R+y*F,s[5]=d*S+A*P+y*D,s[8]=d*T+A*I+y*L,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+r*s*c-r*o*l}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,d=a*l-u*s,A=c*s-o*l,y=t*f+n*d+r*A;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);let w=1/y;return e[0]=f*w,e[1]=(r*c-u*n)*w,e[2]=(a*n-r*o)*w,e[3]=d*w,e[4]=(u*t-r*l)*w,e[5]=(r*s-a*t)*w,e[6]=A*w,e[7]=(n*l-c*t)*w,e[8]=(o*t-n*s)*w,this}transpose(){let e,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){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,o,a){let l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return ni("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(a8.makeScale(e,t)),this}rotate(e){return ni("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(a8.makeRotation(-e)),this}translate(e,t){return ni("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(a8.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){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};bF.prototype.isMatrix3=!0;var Mn=bF,a8=new Mn,UY=new Mn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),kY=new Mn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function iAe(){let i={enabled:!0,workingColorSpace:n0,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===kt&&(r.r=Cd(r.r),r.g=Cd(r.g),r.b=Cd(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===kt&&(r.r=Yv(r.r),r.g=Yv(r.g),r.b=Yv(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===ha?i0:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return ni("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return ni("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[n0]:{primaries:e,whitePoint:n,transfer:i0,toXYZ:UY,fromXYZ:kY,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Br},outputColorSpaceConfig:{drawingBufferColorSpace:Br}},[Br]:{primaries:e,whitePoint:n,transfer:kt,toXYZ:UY,fromXYZ:kY,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Br}}}),i}var ln=iAe();function Cd(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Yv(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Iv,uM=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Iv===void 0&&(Iv=Zv("canvas")),Iv.width=e.width,Iv.height=e.height;let r=Iv.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Iv}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=Zv("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=Cd(s[o]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Cd(t[n]/255)*255):t[n]=Cd(t[n]);return{data:t,width:e.width,height:e.height}}else return Xe("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},rAe=0,Qv=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:rAe++}),this.uuid=Ph(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(l8(r[o].image)):s.push(l8(r[o]))}else s=l8(r);n.url=s}return t||(e.images[this.uuid]=n),n}};function l8(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?uM.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(Xe("Texture: Unable to serialize Texture."),{})}var sAe=0,c8=new re,Hs=class i extends ca{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=la,r=la,s=Mi,o=Go,a=Ur,l=Ji,c=i.DEFAULT_ANISOTROPY,u=ha){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:sAe++}),this.uuid=Ph(),this.name="",this.source=new Qv(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Oe(0,0),this.repeat=new Oe(1,1),this.center=new Oe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Mn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(c8).x}get height(){return this.source.getSize(c8).y}get depth(){return this.source.getSize(c8).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){Xe(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Xe(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Lb)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Rd:e.x=e.x-Math.floor(e.x);break;case la:e.x=e.x<0?0:1;break;case Id: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 Rd:e.y=e.y-Math.floor(e.y);break;case la:e.y=e.y<0?0:1;break;case Id:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};Hs.DEFAULT_IMAGE=null;Hs.DEFAULT_MAPPING=Lb;Hs.DEFAULT_ANISOTROPY=1;var wF=class wF{constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: 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("THREE.Vector4: 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){let t=this.x,n=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s,l=e.elements,c=l[0],u=l[4],f=l[8],d=l[1],A=l[5],y=l[9],w=l[2],S=l[6],T=l[10];if(Math.abs(u-d)<.01&&Math.abs(f-w)<.01&&Math.abs(y-S)<.01){if(Math.abs(u+d)<.1&&Math.abs(f+w)<.1&&Math.abs(y+S)<.1&&Math.abs(c+A+T-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let P=(c+1)/2,I=(A+1)/2,F=(T+1)/2,D=(u+d)/4,L=(f+w)/4,C=(y+S)/4;return P>I&&P>F?P<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(P),r=D/n,s=L/n):I>F?I<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(I),n=D/r,s=C/r):F<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(F),n=L/s,r=C/s),this.set(n,r,s,t),this}let R=Math.sqrt((S-y)*(S-y)+(f-w)*(f-w)+(d-u)*(d-u));return Math.abs(R)<.001&&(R=1),this.x=(S-y)/R,this.y=(f-w)/R,this.z=(d-u)/R,this.w=Math.acos((c+A+T-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this.z=Nn(this.z,e.z,t.z),this.w=Nn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this.z=Nn(this.z,e,t),this.w=Nn(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};wF.prototype.isVector4=!0;var xn=wF,Ba=class extends ca{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Mi,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new xn(0,0,e,t),this.scissorTest=!1,this.viewport=new xn(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:n.depth},s=new Hs(r),o=n.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:Mi,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let r=Object.assign({},e.textures[t].image);this.textures[t].source=new Qv(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},Oa=class extends Ba{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},VA=class extends Hs{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Ti,this.minFilter=Ti,this.wrapR=la,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var hM=class extends Hs{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Ti,this.minFilter=Ti,this.wrapR=la,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var NM=class NM{constructor(e,t,n,r,s,o,a,l,c,u,f,d,A,y,w,S){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c,u,f,d,A,y,w,S)}set(e,t,n,r,s,o,a,l,c,u,f,d,A,y,w,S){let T=this.elements;return T[0]=e,T[4]=t,T[8]=n,T[12]=r,T[1]=s,T[5]=o,T[9]=a,T[13]=l,T[2]=c,T[6]=u,T[10]=f,T[14]=d,T[3]=A,T[7]=y,T[11]=w,T[15]=S,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new NM().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,r=1/Pv.setFromMatrixColumn(e,0).length(),s=1/Pv.setFromMatrixColumn(e,1).length(),o=1/Pv.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){let d=o*u,A=o*f,y=a*u,w=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=A+y*c,t[5]=d-w*c,t[9]=-a*l,t[2]=w-d*c,t[6]=y+A*c,t[10]=o*l}else if(e.order==="YXZ"){let d=l*u,A=l*f,y=c*u,w=c*f;t[0]=d+w*a,t[4]=y*a-A,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=A*a-y,t[6]=w+d*a,t[10]=o*l}else if(e.order==="ZXY"){let d=l*u,A=l*f,y=c*u,w=c*f;t[0]=d-w*a,t[4]=-o*f,t[8]=y+A*a,t[1]=A+y*a,t[5]=o*u,t[9]=w-d*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){let d=o*u,A=o*f,y=a*u,w=a*f;t[0]=l*u,t[4]=y*c-A,t[8]=d*c+w,t[1]=l*f,t[5]=w*c+d,t[9]=A*c-y,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){let d=o*l,A=o*c,y=a*l,w=a*c;t[0]=l*u,t[4]=w-d*f,t[8]=y*f+A,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=A*f+y,t[10]=d-w*f}else if(e.order==="XZY"){let d=o*l,A=o*c,y=a*l,w=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=d*f+w,t[5]=o*u,t[9]=A*f-y,t[2]=y*f-A,t[6]=a*u,t[10]=w*f+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(oAe,e,aAe)}lookAt(e,t,n){let r=this.elements;return Kl.subVectors(e,t),Kl.lengthSq()===0&&(Kl.z=1),Kl.normalize(),Xp.crossVectors(n,Kl),Xp.lengthSq()===0&&(Math.abs(n.z)===1?Kl.x+=1e-4:Kl.z+=1e-4,Kl.normalize(),Xp.crossVectors(n,Kl)),Xp.normalize(),I3.crossVectors(Kl,Xp),r[0]=Xp.x,r[4]=I3.x,r[8]=Kl.x,r[1]=Xp.y,r[5]=I3.y,r[9]=Kl.y,r[2]=Xp.z,r[6]=I3.z,r[10]=Kl.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],f=n[5],d=n[9],A=n[13],y=n[2],w=n[6],S=n[10],T=n[14],R=n[3],P=n[7],I=n[11],F=n[15],D=r[0],L=r[4],C=r[8],B=r[12],k=r[1],z=r[5],G=r[9],W=r[13],Y=r[2],H=r[6],$=r[10],J=r[14],te=r[3],ce=r[7],he=r[11],ve=r[15];return s[0]=o*D+a*k+l*Y+c*te,s[4]=o*L+a*z+l*H+c*ce,s[8]=o*C+a*G+l*$+c*he,s[12]=o*B+a*W+l*J+c*ve,s[1]=u*D+f*k+d*Y+A*te,s[5]=u*L+f*z+d*H+A*ce,s[9]=u*C+f*G+d*$+A*he,s[13]=u*B+f*W+d*J+A*ve,s[2]=y*D+w*k+S*Y+T*te,s[6]=y*L+w*z+S*H+T*ce,s[10]=y*C+w*G+S*$+T*he,s[14]=y*B+w*W+S*J+T*ve,s[3]=R*D+P*k+I*Y+F*te,s[7]=R*L+P*z+I*H+F*ce,s[11]=R*C+P*G+I*$+F*he,s[15]=R*B+P*W+I*J+F*ve,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],d=e[10],A=e[14],y=e[3],w=e[7],S=e[11],T=e[15],R=l*A-c*d,P=a*A-c*f,I=a*d-l*f,F=o*A-c*u,D=o*d-l*u,L=o*f-a*u;return t*(w*R-S*P+T*I)-n*(y*R-S*F+T*D)+r*(y*P-w*F+T*L)-s*(y*I-w*D+S*L)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[1],o=e[5],a=e[9],l=e[2],c=e[6],u=e[10];return t*(o*u-a*c)-n*(s*u-a*l)+r*(s*c-o*l)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],d=e[10],A=e[11],y=e[12],w=e[13],S=e[14],T=e[15],R=t*a-n*o,P=t*l-r*o,I=t*c-s*o,F=n*l-r*a,D=n*c-s*a,L=r*c-s*l,C=u*w-f*y,B=u*S-d*y,k=u*T-A*y,z=f*S-d*w,G=f*T-A*w,W=d*T-A*S,Y=R*W-P*G+I*z+F*k-D*B+L*C;if(Y===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let H=1/Y;return e[0]=(a*W-l*G+c*z)*H,e[1]=(r*G-n*W-s*z)*H,e[2]=(w*L-S*D+T*F)*H,e[3]=(d*D-f*L-A*F)*H,e[4]=(l*k-o*W-c*B)*H,e[5]=(t*W-r*k+s*B)*H,e[6]=(S*I-y*L-T*P)*H,e[7]=(u*L-d*I+A*P)*H,e[8]=(o*G-a*k+c*C)*H,e[9]=(n*k-t*G-s*C)*H,e[10]=(y*D-w*I+T*R)*H,e[11]=(f*I-u*D-A*R)*H,e[12]=(a*B-o*z-l*C)*H,e[13]=(t*z-n*B+r*C)*H,e[14]=(w*P-y*F-S*R)*H,e[15]=(u*F-f*P+d*R)*H,this}scale(e){let t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),s=1-n,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+n,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,o){return this.set(1,n,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,f=a+a,d=s*c,A=s*u,y=s*f,w=o*u,S=o*f,T=a*f,R=l*c,P=l*u,I=l*f,F=n.x,D=n.y,L=n.z;return r[0]=(1-(w+T))*F,r[1]=(A+I)*F,r[2]=(y-P)*F,r[3]=0,r[4]=(A-I)*D,r[5]=(1-(d+T))*D,r[6]=(S+R)*D,r[7]=0,r[8]=(y+P)*L,r[9]=(S-R)*L,r[10]=(1-(d+w))*L,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let s=this.determinantAffine();if(s===0)return n.set(1,1,1),t.identity(),this;let o=Pv.set(r[0],r[1],r[2]).length(),a=Pv.set(r[4],r[5],r[6]).length(),l=Pv.set(r[8],r[9],r[10]).length();s<0&&(o=-o),Lu.copy(this);let c=1/o,u=1/a,f=1/l;return Lu.elements[0]*=c,Lu.elements[1]*=c,Lu.elements[2]*=c,Lu.elements[4]*=u,Lu.elements[5]*=u,Lu.elements[6]*=u,Lu.elements[8]*=f,Lu.elements[9]*=f,Lu.elements[10]*=f,t.setFromRotationMatrix(Lu),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=ko,l=!1){let c=this.elements,u=2*s/(t-e),f=2*s/(n-r),d=(t+e)/(t-e),A=(n+r)/(n-r),y,w;if(l)y=s/(o-s),w=o*s/(o-s);else if(a===ko)y=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(a===yl)y=-o/(o-s),w=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=f,c[9]=A,c[13]=0,c[2]=0,c[6]=0,c[10]=y,c[14]=w,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,s,o,a=ko,l=!1){let c=this.elements,u=2/(t-e),f=2/(n-r),d=-(t+e)/(t-e),A=-(n+r)/(n-r),y,w;if(l)y=1/(o-s),w=o/(o-s);else if(a===ko)y=-2/(o-s),w=-(o+s)/(o-s);else if(a===yl)y=-1/(o-s),w=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=f,c[9]=0,c[13]=A,c[2]=0,c[6]=0,c[10]=y,c[14]=w,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};NM.prototype.isMatrix4=!0;var cn=NM,Pv=new re,Lu=new cn,oAe=new re(0,0,0),aAe=new re(1,1,1),Xp=new re,I3=new re,Kl=new re,zY=new cn,VY=new qs,Ua=class i{constructor(e=0,t=0,n=0,r=i.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],f=r[2],d=r[6],A=r[10];switch(t){case"XYZ":this._y=Math.asin(Nn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,A),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Nn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,A),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Nn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-f,A),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Nn(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(d,A),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Nn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,A));break;case"XZY":this._z=Math.asin(-Nn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,A),this._y=0);break;default:Xe("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return zY.makeRotationFromQuaternion(e),this.setFromRotationMatrix(zY,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return VY.setFromEuler(this),this.setFromQuaternion(VY,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}};Ua.DEFAULT_ORDER="XYZ";var Jv=class{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}},lAe=0,GY=new re,Lv=new qs,xd=new cn,P3=new re,b2=new re,cAe=new re,uAe=new qs,qY=new re(1,0,0),HY=new re(0,1,0),WY=new re(0,0,1),jY={type:"added"},hAe={type:"removed"},Dv={type:"childadded",child:null},u8={type:"childremoved",child:null},lr=class i extends ca{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:lAe++}),this.uuid=Ph(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new re,t=new Ua,n=new qs,r=new re(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new cn},normalMatrix:{value:new Mn}}),this.matrix=new cn,this.matrixWorld=new cn,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Jv,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Lv.setFromAxisAngle(e,t),this.quaternion.multiply(Lv),this}rotateOnWorldAxis(e,t){return Lv.setFromAxisAngle(e,t),this.quaternion.premultiply(Lv),this}rotateX(e){return this.rotateOnAxis(qY,e)}rotateY(e){return this.rotateOnAxis(HY,e)}rotateZ(e){return this.rotateOnAxis(WY,e)}translateOnAxis(e,t){return GY.copy(e).applyQuaternion(this.quaternion),this.position.add(GY.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(qY,e)}translateY(e){return this.translateOnAxis(HY,e)}translateZ(e){return this.translateOnAxis(WY,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(xd.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?P3.copy(e):P3.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),b2.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?xd.lookAt(b2,P3,this.up):xd.lookAt(P3,b2,this.up),this.quaternion.setFromRotationMatrix(xd),r&&(xd.extractRotation(r.matrixWorld),Lv.setFromRotationMatrix(xd),this.quaternion.premultiply(Lv.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(ze("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(jY),Dv.child=e,this.dispatchEvent(Dv),Dv.child=null):ze("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(hAe),u8.child=e,this.dispatchEvent(u8),u8.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),xd.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),xd.multiply(e.parent.matrixWorld)),e.applyMatrix4(xd),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(jY),Dv.child=e,this.dispatchEvent(Dv),Dv.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(b2,e,cAe),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(b2,uAe,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*r,s[13]+=n-s[1]*t-s[5]*n-s[9]*r,s[14]+=r-s[2]*t-s[6]*n-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){let s=this.children;for(let o=0,a=s.length;o<a;o++)s[o].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(a=>({...a})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){let f=l[c];s(e.shapes,f)}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)){let a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){let l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){let a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),f=o(e.shapes),d=o(e.skeletons),A=o(e.animations),y=o(e.nodes);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),d.length>0&&(n.skeletons=d),A.length>0&&(n.animations=A),y.length>0&&(n.nodes=y)}return n.object=r,n;function o(a){let l=[];for(let c in a){let u=a[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.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let r=e.children[n];this.add(r.clone())}return this}};lr.DEFAULT_UP=new re(0,1,0);lr.DEFAULT_MATRIX_AUTO_UPDATE=!0;lr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Or=class extends lr{constructor(){super(),this.isGroup=!0,this.type="Group"}},fAe={type:"move"},s0=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Or,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 Or,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new re,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new re),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Or,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new re,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new re,this._grip.eventsEnabled=!1),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){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,o=null,a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(let w of e.hand.values()){let S=t.getJointPose(w,n),T=this._getHandJoint(c,w);S!==null&&(T.matrix.fromArray(S.transform.matrix),T.matrix.decompose(T.position,T.rotation,T.scale),T.matrixWorldNeedsUpdate=!0,T.jointRadius=S.radius),T.visible=S!==null}let u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],d=u.position.distanceTo(f.position),A=.02,y=.005;c.inputState.pinching&&d>A+y?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=A-y&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));a!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(fAe)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new Or;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},IZ={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},$p={h:0,s:0,l:0},L3={h:0,s:0,l:0};function h8(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}var zt=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Br){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ln.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=ln.workingColorSpace){return this.r=e,this.g=t,this.b=n,ln.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=ln.workingColorSpace){if(e=mF(e,1),t=Nn(t,0,1),n=Nn(n,0,1),t===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=h8(o,s,e+1/3),this.g=h8(o,s,e),this.b=h8(o,s,e-1/3)}return ln.colorSpaceToWorking(this,r),this}setStyle(e,t=Br){function n(s){s!==void 0&&parseFloat(s)<1&&Xe("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s,o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Xe("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);Xe("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Br){let n=IZ[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Xe("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=Cd(e.r),this.g=Cd(e.g),this.b=Cd(e.b),this}copyLinearToSRGB(e){return this.r=Yv(e.r),this.g=Yv(e.g),this.b=Yv(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Br){return ln.workingToColorSpace(aa.copy(this),e),Math.round(Nn(aa.r*255,0,255))*65536+Math.round(Nn(aa.g*255,0,255))*256+Math.round(Nn(aa.b*255,0,255))}getHexString(e=Br){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ln.workingColorSpace){ln.workingToColorSpace(aa.copy(this),t);let n=aa.r,r=aa.g,s=aa.b,o=Math.max(n,r,s),a=Math.min(n,r,s),l,c,u=(a+o)/2;if(a===o)l=0,c=0;else{let f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case n:l=(r-s)/f+(r<s?6:0);break;case r:l=(s-n)/f+2;break;case s:l=(n-r)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=ln.workingColorSpace){return ln.workingToColorSpace(aa.copy(this),t),e.r=aa.r,e.g=aa.g,e.b=aa.b,e}getStyle(e=Br){ln.workingToColorSpace(aa.copy(this),e);let t=aa.r,n=aa.g,r=aa.b;return e!==Br?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL($p),this.setHSL($p.h+e,$p.s+t,$p.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL($p),e.getHSL(L3);let n=L2($p.h,L3.h,t),r=L2($p.s,L3.s,t),s=L2($p.l,L3.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},aa=new zt;zt.NAMES=IZ;var o0=class extends lr{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Ua,this.environmentIntensity=1,this.environmentRotation=new Ua,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},Du=new re,yd=new re,f8=new re,bd=new re,Nv=new re,Fv=new re,XY=new re,d8=new re,p8=new re,m8=new re,A8=new xn,g8=new xn,v8=new xn,Ed=class i{constructor(e=new re,t=new re,n=new re){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Du.subVectors(e,t),r.cross(Du);let s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Du.subVectors(r,t),yd.subVectors(n,t),f8.subVectors(e,t);let o=Du.dot(Du),a=Du.dot(yd),l=Du.dot(f8),c=yd.dot(yd),u=yd.dot(f8),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;let d=1/f,A=(c*l-a*u)*d,y=(o*u-a*l)*d;return s.set(1-A-y,y,A)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,bd)===null?!1:bd.x>=0&&bd.y>=0&&bd.x+bd.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,bd)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,bd.x),l.addScaledVector(o,bd.y),l.addScaledVector(a,bd.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return A8.setScalar(0),g8.setScalar(0),v8.setScalar(0),A8.fromBufferAttribute(e,t),g8.fromBufferAttribute(e,n),v8.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(A8,s.x),o.addScaledVector(g8,s.y),o.addScaledVector(v8,s.z),o}static isFrontFacing(e,t,n,r){return Du.subVectors(n,t),yd.subVectors(e,t),Du.cross(yd).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Du.subVectors(this.c,this.b),yd.subVectors(this.a,this.b),Du.cross(yd).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return i.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return i.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return i.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return i.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return i.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,s=this.c,o,a;Nv.subVectors(r,n),Fv.subVectors(s,n),d8.subVectors(e,n);let l=Nv.dot(d8),c=Fv.dot(d8);if(l<=0&&c<=0)return t.copy(n);p8.subVectors(e,r);let u=Nv.dot(p8),f=Fv.dot(p8);if(u>=0&&f<=u)return t.copy(r);let d=l*f-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(Nv,o);m8.subVectors(e,s);let A=Nv.dot(m8),y=Fv.dot(m8);if(y>=0&&A<=y)return t.copy(s);let w=A*c-l*y;if(w<=0&&c>=0&&y<=0)return a=c/(c-y),t.copy(n).addScaledVector(Fv,a);let S=u*y-A*f;if(S<=0&&f-u>=0&&A-y>=0)return XY.subVectors(s,r),a=(f-u)/(f-u+(A-y)),t.copy(r).addScaledVector(XY,a);let T=1/(S+w+d);return o=w*T,a=d*T,t.copy(n).addScaledVector(Nv,o).addScaledVector(Fv,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},ka=class{constructor(e=new re(1/0,1/0,1/0),t=new re(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Nu.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Nu.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Nu.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Nu):Nu.fromBufferAttribute(s,o),Nu.applyMatrix4(e.matrixWorld),this.expandByPoint(Nu);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),D3.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),D3.copy(n.boundingBox)),D3.applyMatrix4(e.matrixWorld),this.union(D3)}let r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Nu),Nu.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(w2),N3.subVectors(this.max,w2),Bv.subVectors(e.a,w2),Ov.subVectors(e.b,w2),Uv.subVectors(e.c,w2),Yp.subVectors(Ov,Bv),Zp.subVectors(Uv,Ov),RA.subVectors(Bv,Uv);let t=[0,-Yp.z,Yp.y,0,-Zp.z,Zp.y,0,-RA.z,RA.y,Yp.z,0,-Yp.x,Zp.z,0,-Zp.x,RA.z,0,-RA.x,-Yp.y,Yp.x,0,-Zp.y,Zp.x,0,-RA.y,RA.x,0];return!_8(t,Bv,Ov,Uv,N3)||(t=[1,0,0,0,1,0,0,0,1],!_8(t,Bv,Ov,Uv,N3))?!1:(F3.crossVectors(Yp,Zp),t=[F3.x,F3.y,F3.z],_8(t,Bv,Ov,Uv,N3))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Nu).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Nu).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:(wd[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),wd[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),wd[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),wd[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),wd[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),wd[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),wd[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),wd[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(wd),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},wd=[new re,new re,new re,new re,new re,new re,new re,new re],Nu=new re,D3=new ka,Bv=new re,Ov=new re,Uv=new re,Yp=new re,Zp=new re,RA=new re,w2=new re,N3=new re,F3=new re,IA=new re;function _8(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){IA.fromArray(i,s);let a=r.x*Math.abs(IA.x)+r.y*Math.abs(IA.y)+r.z*Math.abs(IA.z),l=e.dot(IA),c=t.dot(IA),u=n.dot(IA);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var Md=dAe();function dAe(){let i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){let c=l-127;c<-27?(n[l]=0,n[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,r[l]=24,r[l|256]=24):(n[l]=31744,n[l|256]=64512,r[l]=13,r[l|256]=13)}let s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;(c&8388608)===0;)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)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function Ql(i){Math.abs(i)>65504&&Xe("DataUtils.toHalfFloat(): Value out of range."),i=Nn(i,-65504,65504),Md.floatView[0]=i;let e=Md.uint32View[0],t=e>>23&511;return Md.baseTable[t]+((e&8388607)>>Md.shiftTable[t])}function B3(i){let e=i>>10;return Md.uint32View[0]=Md.mantissaTable[Md.offsetTable[e]+(i&1023)]+Md.exponentTable[e],Md.floatView[0]}var Vs=new re,O3=new Oe,pAe=0,Hi=class extends ca{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:pAe++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=r0,this.updateRanges=[],this.gpuType=cr,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)O3.fromBufferAttribute(this,t),O3.applyMatrix3(e),this.setXY(t,O3.x,O3.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Vs.fromBufferAttribute(this,t),Vs.applyMatrix3(e),this.setXYZ(t,Vs.x,Vs.y,Vs.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Vs.fromBufferAttribute(this,t),Vs.applyMatrix4(e),this.setXYZ(t,Vs.x,Vs.y,Vs.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Vs.fromBufferAttribute(this,t),Vs.applyNormalMatrix(e),this.setXYZ(t,Vs.x,Vs.y,Vs.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Vs.fromBufferAttribute(this,t),Vs.transformDirection(e),this.setXYZ(t,Vs.x,Vs.y,Vs.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Fa(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Zn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Fa(t,this.array)),t}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Fa(t,this.array)),t}setY(e,t){return this.normalized&&(t=Zn(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=Fa(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Zn(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=Fa(t,this.array)),t}setW(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let 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!==r0&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var GA=class extends Hi{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var qA=class extends Hi{constructor(e,t,n){super(new Uint32Array(e),t,n)}},e_=class extends Hi{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=B3(this.array[e*this.itemSize]);return this.normalized&&(t=Fa(t,this.array)),t}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize]=Ql(t),this}getY(e){let t=B3(this.array[e*this.itemSize+1]);return this.normalized&&(t=Fa(t,this.array)),t}setY(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+1]=Ql(t),this}getZ(e){let t=B3(this.array[e*this.itemSize+2]);return this.normalized&&(t=Fa(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+2]=Ql(t),this}getW(e){let t=B3(this.array[e*this.itemSize+3]);return this.normalized&&(t=Fa(t,this.array)),t}setW(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+3]=Ql(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array)),this.array[e+0]=Ql(t),this.array[e+1]=Ql(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array)),this.array[e+0]=Ql(t),this.array[e+1]=Ql(n),this.array[e+2]=Ql(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(s,this.array)),this.array[e+0]=Ql(t),this.array[e+1]=Ql(n),this.array[e+2]=Ql(r),this.array[e+3]=Ql(s),this}},Ln=class extends Hi{constructor(e,t,n){super(new Float32Array(e),t,n)}},mAe=new ka,S2=new re,x8=new re,bl=class{constructor(e=new re,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):mAe.setFromPoints(e).getCenter(n);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let 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){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;S2.subVectors(e,this.center);let t=S2.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(S2,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(x8.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(S2.copy(e.center).add(x8)),this.expandByPoint(S2.copy(e.center).sub(x8))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},AAe=0,qc=new cn,y8=new lr,kv=new re,Jl=new ka,T2=new ka,_o=new re,Xn=class i extends ca{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:AAe++}),this.uuid=Ph(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(zme(e)?qA:GA)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let s=new Mn().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}let 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._transformed=!0,this}applyQuaternion(e){return qc.makeRotationFromQuaternion(e),this.applyMatrix4(qc),this}rotateX(e){return qc.makeRotationX(e),this.applyMatrix4(qc),this}rotateY(e){return qc.makeRotationY(e),this.applyMatrix4(qc),this}rotateZ(e){return qc.makeRotationZ(e),this.applyMatrix4(qc),this}translate(e,t,n){return qc.makeTranslation(e,t,n),this.applyMatrix4(qc),this}scale(e,t,n){return qc.makeScale(e,t,n),this.applyMatrix4(qc),this}lookAt(e){return y8.lookAt(e),y8.updateMatrix(),this.applyMatrix4(y8.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(kv).negate(),this.translate(kv.x,kv.y,kv.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let r=0,s=e.length;r<s;r++){let o=e[r];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new Ln(n,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&Xe("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ka);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ze("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new re(-1/0,-1/0,-1/0),new re(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){let s=t[n];Jl.setFromBufferAttribute(s),this.morphTargetsRelative?(_o.addVectors(this.boundingBox.min,Jl.min),this.boundingBox.expandByPoint(_o),_o.addVectors(this.boundingBox.max,Jl.max),this.boundingBox.expandByPoint(_o)):(this.boundingBox.expandByPoint(Jl.min),this.boundingBox.expandByPoint(Jl.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&ze('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 bl);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ze("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new re,1/0);return}if(e){let n=this.boundingSphere.center;if(Jl.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];T2.setFromBufferAttribute(a),this.morphTargetsRelative?(_o.addVectors(Jl.min,T2.min),Jl.expandByPoint(_o),_o.addVectors(Jl.max,T2.max),Jl.expandByPoint(_o)):(Jl.expandByPoint(T2.min),Jl.expandByPoint(T2.max))}Jl.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)_o.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(_o));if(t)for(let s=0,o=t.length;s<o;s++){let a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)_o.fromBufferAttribute(a,c),l&&(kv.fromBufferAttribute(e,c),_o.add(kv)),r=Math.max(r,n.distanceToSquared(_o))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&ze('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){ze("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=t.position,r=t.normal,s=t.uv,o=this.getAttribute("tangent");(o===void 0||o.count!==n.count)&&(o=new Hi(new Float32Array(4*n.count),4),this.setAttribute("tangent",o));let a=[],l=[];for(let C=0;C<n.count;C++)a[C]=new re,l[C]=new re;let c=new re,u=new re,f=new re,d=new Oe,A=new Oe,y=new Oe,w=new re,S=new re;function T(C,B,k){c.fromBufferAttribute(n,C),u.fromBufferAttribute(n,B),f.fromBufferAttribute(n,k),d.fromBufferAttribute(s,C),A.fromBufferAttribute(s,B),y.fromBufferAttribute(s,k),u.sub(c),f.sub(c),A.sub(d),y.sub(d);let z=1/(A.x*y.y-y.x*A.y);isFinite(z)&&(w.copy(u).multiplyScalar(y.y).addScaledVector(f,-A.y).multiplyScalar(z),S.copy(f).multiplyScalar(A.x).addScaledVector(u,-y.x).multiplyScalar(z),a[C].add(w),a[B].add(w),a[k].add(w),l[C].add(S),l[B].add(S),l[k].add(S))}let R=this.groups;R.length===0&&(R=[{start:0,count:e.count}]);for(let C=0,B=R.length;C<B;++C){let k=R[C],z=k.start,G=k.count;for(let W=z,Y=z+G;W<Y;W+=3)T(e.getX(W+0),e.getX(W+1),e.getX(W+2))}let P=new re,I=new re,F=new re,D=new re;function L(C){F.fromBufferAttribute(r,C),D.copy(F);let B=a[C];P.copy(B),P.sub(F.multiplyScalar(F.dot(B))).normalize(),I.crossVectors(D,B);let z=I.dot(l[C])<0?-1:1;o.setXYZW(C,P.x,P.y,P.z,z)}for(let C=0,B=R.length;C<B;++C){let k=R[C],z=k.start,G=k.count;for(let W=z,Y=z+G;W<Y;W+=3)L(e.getX(W+0)),L(e.getX(W+1)),L(e.getX(W+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new Hi(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,A=n.count;d<A;d++)n.setXYZ(d,0,0,0);let r=new re,s=new re,o=new re,a=new re,l=new re,c=new re,u=new re,f=new re;if(e)for(let d=0,A=e.count;d<A;d+=3){let y=e.getX(d+0),w=e.getX(d+1),S=e.getX(d+2);r.fromBufferAttribute(t,y),s.fromBufferAttribute(t,w),o.fromBufferAttribute(t,S),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),a.fromBufferAttribute(n,y),l.fromBufferAttribute(n,w),c.fromBufferAttribute(n,S),a.add(u),l.add(u),c.add(u),n.setXYZ(y,a.x,a.y,a.z),n.setXYZ(w,l.x,l.y,l.z),n.setXYZ(S,c.x,c.y,c.z)}else for(let d=0,A=t.count;d<A;d+=3)r.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),o.fromBufferAttribute(t,d+2),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),n.setXYZ(d+0,u.x,u.y,u.z),n.setXYZ(d+1,u.x,u.y,u.z),n.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)_o.fromBufferAttribute(e,t),_o.normalize(),e.setXYZ(t,_o.x,_o.y,_o.z)}toNonIndexed(){function e(a,l){let c=a.array,u=a.itemSize,f=a.normalized,d=new c.constructor(l.length*u),A=0,y=0;for(let w=0,S=l.length;w<S;w++){a.isInterleavedBufferAttribute?A=l[w]*a.data.stride+a.offset:A=l[w]*u;for(let T=0;T<u;T++)d[y++]=c[A++]}return new Hi(d,u,f)}if(this.index===null)return Xe("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new i,n=this.index.array,r=this.attributes;for(let a in r){let l=r[a],c=e(l,n);t.setAttribute(a,c)}let s=this.morphAttributes;for(let a in s){let l=[],c=s[a];for(let u=0,f=c.length;u<f;u++){let d=c[u],A=e(d,n);l.push(A)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let a=0,l=o.length;a<l;a++){let c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let c=n[l];e.data.attributes[l]=c.toJSON(e.data)}let r={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],u=[];for(let f=0,d=c.length;f<d;f++){let A=c[f];u.push(A.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let c in r){let u=r[c];this.setAttribute(c,u.clone(t))}let s=e.morphAttributes;for(let c in s){let u=[],f=s[c];for(let d=0,A=f.length;d<A;d++)u.push(f[d].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let c=0,u=o.length;c<u;c++){let f=o[c];this.addGroup(f.start,f.count,f.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let 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._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}},Ld=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=r0,this.updateRanges=[],this.version=0,this.uuid=Ph()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ph()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ph()),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}}},Da=new re,Vo=class i{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Da.fromBufferAttribute(this,t),Da.applyMatrix4(e),this.setXYZ(t,Da.x,Da.y,Da.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Da.fromBufferAttribute(this,t),Da.applyNormalMatrix(e),this.setXYZ(t,Da.x,Da.y,Da.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Da.fromBufferAttribute(this,t),Da.transformDirection(e),this.setXYZ(t,Da.x,Da.y,Da.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Fa(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Zn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Zn(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=Fa(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Fa(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Fa(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Fa(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){zA("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new Hi(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 i(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){zA("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},gAe=0,Ws=class extends ca{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:gAe++}),this.uuid=Ph(),this.name="",this.type="Material",this.blending=Ms,this.side=zo,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=e0,this.blendDst=t0,this.blendEquation=oo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new zt(0,0,0),this.blendAlpha=0,this.depthFunc=Lh,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=B2,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Td,this.stencilZFail=Td,this.stencilZPass=Td,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){Xe(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Xe(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ms&&(n.blending=this.blending),this.side!==zo&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==e0&&(n.blendSrc=this.blendSrc),this.blendDst!==t0&&(n.blendDst=this.blendDst),this.blendEquation!==oo&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Lh&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==B2&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Td&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Td&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Td&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new zt().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new Oe().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Oe().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},Dh=class extends Ws{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new zt(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}},zv,E2=new re,Vv=new re,Gv=new re,qv=new Oe,M2=new Oe,PZ=new cn,U3=new re,C2=new re,k3=new re,$Y=new Oe,b8=new Oe,YY=new Oe,HA=class extends lr{constructor(e=new Dh){if(super(),this.isSprite=!0,this.type="Sprite",zv===void 0){zv=new Xn;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Ld(t,5);zv.setIndex([0,1,2,0,2,3]),zv.setAttribute("position",new Vo(n,3,0,!1)),zv.setAttribute("uv",new Vo(n,2,3,!1))}this.geometry=zv,this.material=e,this.center=new Oe(.5,.5),this.count=1}raycast(e,t){e.camera===null&&ze('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Vv.setFromMatrixScale(this.matrixWorld),PZ.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Gv.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Vv.multiplyScalar(-Gv.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;z3(U3.set(-.5,-.5,0),Gv,o,Vv,r,s),z3(C2.set(.5,-.5,0),Gv,o,Vv,r,s),z3(k3.set(.5,.5,0),Gv,o,Vv,r,s),$Y.set(0,0),b8.set(1,0),YY.set(1,1);let a=e.ray.intersectTriangle(U3,C2,k3,!1,E2);if(a===null&&(z3(C2.set(-.5,.5,0),Gv,o,Vv,r,s),b8.set(0,1),a=e.ray.intersectTriangle(U3,k3,C2,!1,E2),a===null))return;let l=e.ray.origin.distanceTo(E2);l<e.near||l>e.far||t.push({distance:l,point:E2.clone(),uv:Ed.getInterpolation(E2,U3,C2,k3,$Y,b8,YY,new Oe),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 z3(i,e,t,n,r,s){qv.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(M2.x=s*qv.x-r*qv.y,M2.y=r*qv.x+s*qv.y):M2.copy(qv),i.copy(e),i.x+=M2.x,i.y+=M2.y,i.applyMatrix4(PZ)}var Sd=new re,w8=new re,V3=new re,Kp=new re,S8=new re,G3=new re,T8=new re,Dd=class{constructor(e=new re,t=new re(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,Sd)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Sd.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Sd.copy(this.origin).addScaledVector(this.direction,t),Sd.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){w8.copy(e).add(t).multiplyScalar(.5),V3.copy(t).sub(e).normalize(),Kp.copy(this.origin).sub(w8);let s=e.distanceTo(t)*.5,o=-this.direction.dot(V3),a=Kp.dot(this.direction),l=-Kp.dot(V3),c=Kp.lengthSq(),u=Math.abs(1-o*o),f,d,A,y;if(u>0)if(f=o*l-a,d=o*a-l,y=s*u,f>=0)if(d>=-y)if(d<=y){let w=1/u;f*=w,d*=w,A=f*(f+o*d+2*a)+d*(o*f+d+2*l)+c}else d=s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;else d=-s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;else d<=-y?(f=Math.max(0,-(-o*s+a)),d=f>0?-s:Math.min(Math.max(-s,-l),s),A=-f*f+d*(d+2*l)+c):d<=y?(f=0,d=Math.min(Math.max(-s,-l),s),A=d*(d+2*l)+c):(f=Math.max(0,-(o*s+a)),d=f>0?s:Math.min(Math.max(-s,-l),s),A=-f*f+d*(d+2*l)+c);else d=o>0?-s:s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(w8).addScaledVector(V3,d),A}intersectSphere(e,t){Sd.subVectors(e.center,this.origin);let n=Sd.dot(this.direction),r=Sd.dot(Sd)-n*n,s=e.radius*e.radius;if(r>s)return null;let o=Math.sqrt(s-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,o,a,l,c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),u>=0?(s=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(s=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o<r||isNaN(r))&&(r=o),f>=0?(a=(e.min.z-d.z)*f,l=(e.max.z-d.z)*f):(a=(e.max.z-d.z)*f,l=(e.min.z-d.z)*f),n>l||a>r)||((a>n||n!==n)&&(n=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Sd)!==null}intersectTriangle(e,t,n,r,s){S8.subVectors(t,e),G3.subVectors(n,e),T8.crossVectors(S8,G3);let o=this.direction.dot(T8),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Kp.subVectors(this.origin,e);let l=a*this.direction.dot(G3.crossVectors(Kp,G3));if(l<0)return null;let c=a*this.direction.dot(S8.cross(Kp));if(c<0||l+c>o)return null;let u=-a*Kp.dot(T8);return u<0?null:this.at(u/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},ds=class extends Ws{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new zt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.combine=ng,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},ZY=new cn,PA=new Dd,q3=new bl,KY=new re,H3=new re,W3=new re,j3=new re,E8=new re,X3=new re,QY=new re,$3=new re,Hn=class extends lr{constructor(e=new Xn,t=new ds){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let a=this.morphTargetInfluences;if(s&&a){X3.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let u=a[l],f=s[l];u!==0&&(E8.fromBufferAttribute(f,e),o?X3.addScaledVector(E8,u):X3.addScaledVector(E8.sub(t),u))}t.add(X3)}return t}raycast(e,t){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),q3.copy(n.boundingSphere),q3.applyMatrix4(s),PA.copy(e.ray).recast(e.near),!(q3.containsPoint(PA.origin)===!1&&(PA.intersectSphere(q3,KY)===null||PA.origin.distanceToSquared(KY)>(e.far-e.near)**2))&&(ZY.copy(s).invert(),PA.copy(e.ray).applyMatrix4(ZY),!(n.boundingBox!==null&&PA.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,PA)))}_computeIntersections(e,t,n){let r,s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,f=s.attributes.normal,d=s.groups,A=s.drawRange;if(a!==null)if(Array.isArray(o))for(let y=0,w=d.length;y<w;y++){let S=d[y],T=o[S.materialIndex],R=Math.max(S.start,A.start),P=Math.min(a.count,Math.min(S.start+S.count,A.start+A.count));for(let I=R,F=P;I<F;I+=3){let D=a.getX(I),L=a.getX(I+1),C=a.getX(I+2);r=Y3(this,T,e,n,c,u,f,D,L,C),r&&(r.faceIndex=Math.floor(I/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let y=Math.max(0,A.start),w=Math.min(a.count,A.start+A.count);for(let S=y,T=w;S<T;S+=3){let R=a.getX(S),P=a.getX(S+1),I=a.getX(S+2);r=Y3(this,o,e,n,c,u,f,R,P,I),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let y=0,w=d.length;y<w;y++){let S=d[y],T=o[S.materialIndex],R=Math.max(S.start,A.start),P=Math.min(l.count,Math.min(S.start+S.count,A.start+A.count));for(let I=R,F=P;I<F;I+=3){let D=I,L=I+1,C=I+2;r=Y3(this,T,e,n,c,u,f,D,L,C),r&&(r.faceIndex=Math.floor(I/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let y=Math.max(0,A.start),w=Math.min(l.count,A.start+A.count);for(let S=y,T=w;S<T;S+=3){let R=S,P=S+1,I=S+2;r=Y3(this,o,e,n,c,u,f,R,P,I),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}};function vAe(i,e,t,n,r,s,o,a){let l;if(e.side===mi?l=n.intersectTriangle(o,s,r,!0,a):l=n.intersectTriangle(r,s,o,e.side===zo,a),l===null)return null;$3.copy(a),$3.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo($3);return c<t.near||c>t.far?null:{distance:c,point:$3.clone(),object:i}}function Y3(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,H3),i.getVertexPosition(l,W3),i.getVertexPosition(c,j3);let u=vAe(i,e,t,n,H3,W3,j3,QY);if(u){let f=new re;Ed.getBarycoord(QY,H3,W3,j3,f),r&&(u.uv=Ed.getInterpolatedAttribute(r,a,l,c,f,new Oe)),s&&(u.uv1=Ed.getInterpolatedAttribute(s,a,l,c,f,new Oe)),o&&(u.normal=Ed.getInterpolatedAttribute(o,a,l,c,f,new re),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));let d={a,b:l,c,normal:new re,materialIndex:0};Ed.getNormal(H3,W3,j3,d.normal),u.face=d,u.barycoord=f}return u}var WA=class extends Hs{constructor(e=null,t=1,n=1,r,s,o,a,l,c=Ti,u=Ti,f,d){super(null,o,a,l,c,u,r,s,f,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var ec=class extends Hi{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};var M8=new re,_Ae=new re,xAe=new Mn,Na=class{constructor(e=new re(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=M8.subVectors(n,t).cross(_Ae.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let 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,n=!0){let r=e.delta(M8),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let o=-(e.start.dot(this.normal)+this.constant)/s;return n===!0&&(o<0||o>1)?null:t.copy(e.start).addScaledVector(r,o)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||xAe.getNormalMatrix(e),r=this.coplanarPoint(M8).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},LA=new bl,yAe=new Oe(.5,.5),Z3=new re,Hc=class{constructor(e=new Na,t=new Na,n=new Na,r=new Na,s=new Na,o=new Na){this.planes=[e,t,n,r,s,o]}set(e,t,n,r,s,o){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=ko,n=!1){let r=this.planes,s=e.elements,o=s[0],a=s[1],l=s[2],c=s[3],u=s[4],f=s[5],d=s[6],A=s[7],y=s[8],w=s[9],S=s[10],T=s[11],R=s[12],P=s[13],I=s[14],F=s[15];if(r[0].setComponents(c-o,A-u,T-y,F-R).normalize(),r[1].setComponents(c+o,A+u,T+y,F+R).normalize(),r[2].setComponents(c+a,A+f,T+w,F+P).normalize(),r[3].setComponents(c-a,A-f,T-w,F-P).normalize(),n)r[4].setComponents(l,d,S,I).normalize(),r[5].setComponents(c-l,A-d,T-S,F-I).normalize();else if(r[4].setComponents(c-l,A-d,T-S,F-I).normalize(),t===ko)r[5].setComponents(c+l,A+d,T+S,F+I).normalize();else if(t===yl)r[5].setComponents(l,d,S,I).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(),LA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),LA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(LA)}intersectsSprite(e){LA.center.set(0,0,0);let t=yAe.distanceTo(e.center);return LA.radius=.7071067811865476+t,LA.applyMatrix4(e.matrixWorld),this.intersectsSphere(LA)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(Z3.x=r.normal.x>0?e.max.x:e.min.x,Z3.y=r.normal.y>0?e.max.y:e.min.y,Z3.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Z3)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},JY=new cn,O2=class i{constructor(){this.coordinateSystem=ko,this._frustums=[],this._count=0}setFromArrayCamera(e){let t=e.cameras,n=this._frustums;for(let r=0;r<t.length;r++){let s=t[r];JY.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[r]===void 0&&(n[r]=new Hc),n[r].setFromProjectionMatrix(JY,s.coordinateSystem,s.reversedDepth)}return this._count=t.length,this}intersectsObject(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsObject(e))return!0;return!1}intersectsSprite(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSprite(e))return!0;return!1}intersectsSphere(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSphere(e))return!0;return!1}intersectsBox(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsBox(e))return!0;return!1}containsPoint(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].containsPoint(e))return!0;return!1}copy(e){this.coordinateSystem=e.coordinateSystem;let t=this._frustums,n=e._frustums;for(let r=0;r<e._count;r++)t[r]===void 0&&(t[r]=new Hc),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new i().copy(this)}};var Fu=class extends Ws{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new zt(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}},fM=new re,dM=new re,eZ=new cn,R2=new Dd,K3=new bl,C8=new re,tZ=new re,a0=class extends lr{constructor(e=new Xn,t=new Fu){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)fM.fromBufferAttribute(t,r-1),dM.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=fM.distanceTo(dM);e.setAttribute("lineDistance",new Ln(n,1))}else Xe("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),K3.copy(n.boundingSphere),K3.applyMatrix4(r),K3.radius+=s,e.ray.intersectsSphere(K3)===!1)return;eZ.copy(r).invert(),R2.copy(e.ray).applyMatrix4(eZ);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=n.index,d=n.attributes.position;if(u!==null){let A=Math.max(0,o.start),y=Math.min(u.count,o.start+o.count);for(let w=A,S=y-1;w<S;w+=c){let T=u.getX(w),R=u.getX(w+1),P=Q3(this,e,R2,l,T,R,w);P&&t.push(P)}if(this.isLineLoop){let w=u.getX(y-1),S=u.getX(A),T=Q3(this,e,R2,l,w,S,y-1);T&&t.push(T)}}else{let A=Math.max(0,o.start),y=Math.min(d.count,o.start+o.count);for(let w=A,S=y-1;w<S;w+=c){let T=Q3(this,e,R2,l,w,w+1,w);T&&t.push(T)}if(this.isLineLoop){let w=Q3(this,e,R2,l,y-1,A,y-1);w&&t.push(w)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function Q3(i,e,t,n,r,s,o){let a=i.geometry.attributes.position;if(fM.fromBufferAttribute(a,r),dM.fromBufferAttribute(a,s),t.distanceSqToSegment(fM,dM,C8,tZ)>n)return;C8.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(C8);if(!(c<e.near||c>e.far))return{distance:c,point:tZ.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var nZ=new re,iZ=new re,t_=class extends a0{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)nZ.fromBufferAttribute(t,r),iZ.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+nZ.distanceTo(iZ);e.setAttribute("lineDistance",new Ln(n,1))}else Xe("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var l0=class extends Ws{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new zt(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}},rZ=new cn,U8=new Dd,J3=new bl,eM=new re,U2=class extends lr{constructor(e=new Xn,t=new l0){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),J3.copy(n.boundingSphere),J3.applyMatrix4(r),J3.radius+=s,e.ray.intersectsSphere(J3)===!1)return;rZ.copy(r).invert(),U8.copy(e.ray).applyMatrix4(rZ);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=n.index,f=n.attributes.position;if(c!==null){let d=Math.max(0,o.start),A=Math.min(c.count,o.start+o.count);for(let y=d,w=A;y<w;y++){let S=c.getX(y);eM.fromBufferAttribute(f,S),sZ(eM,S,l,r,e,t,this)}}else{let d=Math.max(0,o.start),A=Math.min(f.count,o.start+o.count);for(let y=d,w=A;y<w;y++)eM.fromBufferAttribute(f,y),sZ(eM,y,l,r,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function sZ(i,e,t,n,r,s,o){let a=U8.distanceSqToPoint(i);if(a<t){let l=new re;U8.closestPointToPoint(i,l),l.applyMatrix4(n);let c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}var jA=class extends Hs{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Ti,this.minFilter=Ti,this.generateMipmaps=!1,this.needsUpdate=!0}};var Nh=class extends Hs{constructor(e=[],t=nc,n,r,s,o,a,l,c,u){super(e,t,n,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};var Cs=class extends Hs{constructor(e,t,n=xi,r,s,o,a=Ti,l=Ti,c,u=Gs,f=1){if(u!==Gs&&u!==xo)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let d={width:e,height:t,depth:f};super(d,r,s,o,a,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Qv(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},n_=class extends Cs{constructor(e,t=xi,n=nc,r,s,o=Ti,a=Ti,l,c=Gs){let u={width:e,height:e,depth:1},f=[u,u,u,u,u,u];super(e,e,t,n,r,s,o,a,l,c),this.image=f,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},k2=class extends Hs{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Bu=class i extends Xn{constructor(e=1,t=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};let a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);let l=[],c=[],u=[],f=[],d=0,A=0;y("z","y","x",-1,-1,n,t,e,o,s,0),y("z","y","x",1,-1,n,t,-e,o,s,1),y("x","z","y",1,1,e,n,t,r,o,2),y("x","z","y",1,-1,e,n,-t,r,o,3),y("x","y","z",1,-1,e,t,n,r,s,4),y("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Ln(c,3)),this.setAttribute("normal",new Ln(u,3)),this.setAttribute("uv",new Ln(f,2));function y(w,S,T,R,P,I,F,D,L,C,B){let k=I/L,z=F/C,G=I/2,W=F/2,Y=D/2,H=L+1,$=C+1,J=0,te=0,ce=new re;for(let he=0;he<$;he++){let ve=he*z-W;for(let Re=0;Re<H;Re++){let Qe=Re*k-G;ce[w]=Qe*R,ce[S]=ve*P,ce[T]=Y,c.push(ce.x,ce.y,ce.z),ce[w]=0,ce[S]=0,ce[T]=D>0?1:-1,u.push(ce.x,ce.y,ce.z),f.push(Re/L),f.push(1-he/C),J+=1}}for(let he=0;he<C;he++)for(let ve=0;ve<L;ve++){let Re=d+ve+H*he,Qe=d+ve+H*(he+1),Fe=d+(ve+1)+H*(he+1),mt=d+(ve+1)+H*he;l.push(Re,Qe,mt),l.push(Qe,Fe,mt),te+=6}a.addGroup(A,te,B),A+=te,d+=J}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};var i_=class i extends Xn{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);let s=[],o=[],a=[],l=[],c=new re,u=new Oe;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let f=0,d=3;f<=t;f++,d+=3){let A=n+f/t*r;c.x=e*Math.cos(A),c.y=e*Math.sin(A),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[d]/e+1)/2,u.y=(o[d+1]/e+1)/2,l.push(u.x,u.y)}for(let f=1;f<=t;f++)s.push(f,f+1,0);this.setIndex(s),this.setAttribute("position",new Ln(o,3)),this.setAttribute("normal",new Ln(a,3)),this.setAttribute("uv",new Ln(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.segments,e.thetaStart,e.thetaLength)}},XA=class i extends Xn{constructor(e=1,t=1,n=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};let c=this;r=Math.floor(r),s=Math.floor(s);let u=[],f=[],d=[],A=[],y=0,w=[],S=n/2,T=0;R(),o===!1&&(e>0&&P(!0),t>0&&P(!1)),this.setIndex(u),this.setAttribute("position",new Ln(f,3)),this.setAttribute("normal",new Ln(d,3)),this.setAttribute("uv",new Ln(A,2));function R(){let I=new re,F=new re,D=0,L=(t-e)/n;for(let C=0;C<=s;C++){let B=[],k=C/s,z=k*(t-e)+e;for(let G=0;G<=r;G++){let W=G/r,Y=W*l+a,H=Math.sin(Y),$=Math.cos(Y);F.x=z*H,F.y=-k*n+S,F.z=z*$,f.push(F.x,F.y,F.z),I.set(H,L,$).normalize(),d.push(I.x,I.y,I.z),A.push(W,1-k),B.push(y++)}w.push(B)}for(let C=0;C<r;C++)for(let B=0;B<s;B++){let k=w[B][C],z=w[B+1][C],G=w[B+1][C+1],W=w[B][C+1];(e>0||B!==0)&&(u.push(k,z,W),D+=3),(t>0||B!==s-1)&&(u.push(z,G,W),D+=3)}c.addGroup(T,D,0),T+=D}function P(I){let F=y,D=new Oe,L=new re,C=0,B=I===!0?e:t,k=I===!0?1:-1;for(let G=1;G<=r;G++)f.push(0,S*k,0),d.push(0,k,0),A.push(.5,.5),y++;let z=y;for(let G=0;G<=r;G++){let Y=G/r*l+a,H=Math.cos(Y),$=Math.sin(Y);L.x=B*$,L.y=S*k,L.z=B*H,f.push(L.x,L.y,L.z),d.push(0,k,0),D.x=H*.5+.5,D.y=$*.5*k+.5,A.push(D.x,D.y),y++}for(let G=0;G<r;G++){let W=F+G,Y=z+G;I===!0?u.push(Y,Y+1,W):u.push(Y+1,Y,W),C+=3}c.addGroup(T,C,I===!0?1:2),T+=C}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}};var za=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Xe("Curve: .getPoint() not implemented.")}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let 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;let t=[],n,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let n=this.getLengths(),r=0,s=n.length,o;t?o=t:o=e*n[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=n[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,n[r]===o)return r/(s-1);let u=n[r],d=n[r+1]-u,A=(o-u)/d;return(r+A)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);let o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new Oe:new re);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new re,r=[],s=[],o=[],a=new re,l=new cn;for(let A=0;A<=e;A++){let y=A/e;r[A]=this.getTangentAt(y,new re)}s[0]=new re,o[0]=new re;let c=Number.MAX_VALUE,u=Math.abs(r[0].x),f=Math.abs(r[0].y),d=Math.abs(r[0].z);u<=c&&(c=u,n.set(1,0,0)),f<=c&&(c=f,n.set(0,1,0)),d<=c&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let A=1;A<=e;A++){if(s[A]=s[A-1].clone(),o[A]=o[A-1].clone(),a.crossVectors(r[A-1],r[A]),a.length()>Number.EPSILON){a.normalize();let y=Math.acos(Nn(r[A-1].dot(r[A]),-1,1));s[A].applyMatrix4(l.makeRotationAxis(a,y))}o[A].crossVectors(r[A],s[A])}if(t===!0){let A=Math.acos(Nn(s[0].dot(s[e]),-1,1));A/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(A=-A);for(let y=1;y<=e;y++)s[y].applyMatrix4(l.makeRotationAxis(r[y],A*y)),o[y].crossVectors(r[y],s[y])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},r_=class extends za{constructor(e=0,t=0,n=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new Oe){let n=t,r=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);let a=this.aStartAngle+e*s,l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let u=Math.cos(this.aRotation),f=Math.sin(this.aRotation),d=l-this.aX,A=c-this.aY;l=d*u-A*f+this.aX,c=d*f+A*u+this.aY}return n.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(){let 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}},pM=class extends r_{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function AF(){let i=0,e=0,t=0,n=0;function r(s,o,a,l){i=s,e=a,t=-3*s+3*o-2*a-l,n=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,f){let d=(o-s)/c-(a-s)/(c+u)+(a-o)/u,A=(a-o)/u-(l-o)/(u+f)+(l-a)/f;d*=u,A*=u,r(o,a,d,A)},calc:function(s){let o=s*s,a=o*s;return i+e*s+t*o+n*a}}}var oZ=new re,aZ=new re,R8=new AF,I8=new AF,P8=new AF,mM=class extends za{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new re){let n=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e,a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=r[(a-1)%s]:(aZ.subVectors(r[0],r[1]).add(r[0]),c=aZ);let f=r[a%s],d=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(oZ.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=oZ),this.curveType==="centripetal"||this.curveType==="chordal"){let A=this.curveType==="chordal"?.5:.25,y=Math.pow(c.distanceToSquared(f),A),w=Math.pow(f.distanceToSquared(d),A),S=Math.pow(d.distanceToSquared(u),A);w<1e-4&&(w=1),y<1e-4&&(y=w),S<1e-4&&(S=w),R8.initNonuniformCatmullRom(c.x,f.x,d.x,u.x,y,w,S),I8.initNonuniformCatmullRom(c.y,f.y,d.y,u.y,y,w,S),P8.initNonuniformCatmullRom(c.z,f.z,d.z,u.z,y,w,S)}else this.curveType==="catmullrom"&&(R8.initCatmullRom(c.x,f.x,d.x,u.x,this.tension),I8.initCatmullRom(c.y,f.y,d.y,u.y,this.tension),P8.initCatmullRom(c.z,f.z,d.z,u.z,this.tension));return n.set(R8.calc(l),I8.calc(l),P8.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(new re().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function lZ(i,e,t,n,r){let s=(n-e)*.5,o=(r-t)*.5,a=i*i,l=i*a;return(2*t-2*n+s+o)*l+(-3*t+3*n-2*s-o)*a+s*i+t}function bAe(i,e){let t=1-i;return t*t*e}function wAe(i,e){return 2*(1-i)*i*e}function SAe(i,e){return i*i*e}function D2(i,e,t,n){return bAe(i,e)+wAe(i,t)+SAe(i,n)}function TAe(i,e){let t=1-i;return t*t*t*e}function EAe(i,e){let t=1-i;return 3*t*t*i*e}function MAe(i,e){return 3*(1-i)*i*i*e}function CAe(i,e){return i*i*i*e}function N2(i,e,t,n,r){return TAe(i,e)+EAe(i,t)+MAe(i,n)+CAe(i,r)}var z2=class extends za{constructor(e=new Oe,t=new Oe,n=new Oe,r=new Oe){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new Oe){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(N2(e,r.x,s.x,o.x,a.x),N2(e,r.y,s.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let 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}},s_=class extends za{constructor(e=new re,t=new re,n=new re,r=new re){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new re){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(N2(e,r.x,s.x,o.x,a.x),N2(e,r.y,s.y,o.y,a.y),N2(e,r.z,s.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let 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}},V2=class extends za{constructor(e=new Oe,t=new Oe){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Oe){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Oe){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(){let 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}},AM=class extends za{constructor(e=new re,t=new re){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new re){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new re){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(){let 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}},G2=class extends za{constructor(e=new Oe,t=new Oe,n=new Oe){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Oe){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(D2(e,r.x,s.x,o.x),D2(e,r.y,s.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}},q2=class extends za{constructor(e=new re,t=new re,n=new re){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new re){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(D2(e,r.x,s.x,o.x),D2(e,r.y,s.y,o.y),D2(e,r.z,s.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}},H2=class extends za{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Oe){let n=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],c=r[o],u=r[o>r.length-2?r.length-1:o+1],f=r[o>r.length-3?r.length-1:o+2];return n.set(lZ(a,l.x,c.x,u.x,f.x),lZ(a,l.y,c.y,u.y,f.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(new Oe().fromArray(r))}return this}},gM=Object.freeze({__proto__:null,ArcCurve:pM,CatmullRomCurve3:mM,CubicBezierCurve:z2,CubicBezierCurve3:s_,EllipseCurve:r_,LineCurve:V2,LineCurve3:AM,QuadraticBezierCurve:G2,QuadraticBezierCurve3:q2,SplineCurve:H2}),vM=class extends za{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new gM[n](t,e))}return this}getPoint(e,t){let n=e*this.getLength(),r=this.getCurveLengths(),s=0;for(;s<r.length;){if(r[s]>=n){let o=r[s]-n,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){let 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;let e=[],t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let r=0,s=this.curves;r<s.length;r++){let o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){let u=l[c];n&&n.equals(u)||(t.push(u),n=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,n=e.curves.length;t<n;t++){let r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let r=e.curves[t];this.curves.push(new gM[r.type]().fromJSON(r))}return this}},$A=class extends vM{constructor(e){super(),this.type="Path",this.currentPoint=new Oe,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new V2(this.currentPoint.clone(),new Oe(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){let s=new G2(this.currentPoint.clone(),new Oe(e,t),new Oe(n,r));return this.curves.push(s),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,s,o){let a=new z2(this.currentPoint.clone(),new Oe(e,t),new Oe(n,r),new Oe(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),n=new H2(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,s,o){let a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,n,r,s,o),this}absarc(e,t,n,r,s,o){return this.absellipse(e,t,n,n,r,s,o),this}ellipse(e,t,n,r,s,o,a,l){let c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,n,r,s,o,a,l),this}absellipse(e,t,n,r,s,o,a,l){let c=new r_(e,t,n,r,s,o,a,l);if(this.curves.length>0){let f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);let u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},W2=class extends $A{constructor(e){super(e),this.uuid=Ph(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let r=e.holes[t];this.holes.push(new $A().fromJSON(r))}return this}};function RAe(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length,s=LZ(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=NAe(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let d=t;d<r;d+=t){let A=i[d],y=i[d+1];A<a&&(a=A),y<l&&(l=y),A>u&&(u=A),y>f&&(f=y)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return j2(s,o,t,a,l,c,0),o}function LZ(i,e,t,n,r){let s;if(r===WAe(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=cZ(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=cZ(o/n|0,i[o],i[o+1],s);return s&&o_(s,s.next)&&($2(s),s=s.next),s}function YA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(o_(t,t.next)||Zr(t.prev,t,t.next)===0)){if($2(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function j2(i,e,t,n,r,s,o){if(!i)return;!o&&s&&kAe(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?PAe(i,n,r,s):IAe(i)){e.push(l.i,i.i,c.i),$2(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=LAe(YA(i),e),j2(i,e,t,n,r,s,2)):o===2&&DAe(i,e,t,n,r,s):j2(YA(i),e,t,n,r,s,1);break}}}function IAe(i){let e=i.prev,t=i,n=i.next;if(Zr(e,t,n)>=0)return!1;let r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=Math.min(r,s,o),f=Math.min(a,l,c),d=Math.max(r,s,o),A=Math.max(a,l,c),y=n.next;for(;y!==e;){if(y.x>=u&&y.x<=d&&y.y>=f&&y.y<=A&&I2(r,a,s,l,o,c,y.x,y.y)&&Zr(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function PAe(i,e,t,n){let r=i.prev,s=i,o=i.next;if(Zr(r,s,o)>=0)return!1;let a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,d=o.y,A=Math.min(a,l,c),y=Math.min(u,f,d),w=Math.max(a,l,c),S=Math.max(u,f,d),T=k8(A,y,e,t,n),R=k8(w,S,e,t,n),P=i.prevZ,I=i.nextZ;for(;P&&P.z>=T&&I&&I.z<=R;){if(P.x>=A&&P.x<=w&&P.y>=y&&P.y<=S&&P!==r&&P!==o&&I2(a,u,l,f,c,d,P.x,P.y)&&Zr(P.prev,P,P.next)>=0||(P=P.prevZ,I.x>=A&&I.x<=w&&I.y>=y&&I.y<=S&&I!==r&&I!==o&&I2(a,u,l,f,c,d,I.x,I.y)&&Zr(I.prev,I,I.next)>=0))return!1;I=I.nextZ}for(;P&&P.z>=T;){if(P.x>=A&&P.x<=w&&P.y>=y&&P.y<=S&&P!==r&&P!==o&&I2(a,u,l,f,c,d,P.x,P.y)&&Zr(P.prev,P,P.next)>=0)return!1;P=P.prevZ}for(;I&&I.z<=R;){if(I.x>=A&&I.x<=w&&I.y>=y&&I.y<=S&&I!==r&&I!==o&&I2(a,u,l,f,c,d,I.x,I.y)&&Zr(I.prev,I,I.next)>=0)return!1;I=I.nextZ}return!0}function LAe(i,e){let t=i;do{let n=t.prev,r=t.next.next;!o_(n,r)&&NZ(n,t,t.next,r)&&X2(n,r)&&X2(r,n)&&(e.push(n.i,t.i,r.i),$2(t),$2(t.next),t=i=r),t=t.next}while(t!==i);return YA(t)}function DAe(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&GAe(o,a)){let l=FZ(o,a);o=YA(o,o.next),l=YA(l,l.next),j2(o,e,t,n,r,s,0),j2(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function NAe(i,e,t,n){let r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s]*n,l=s<o-1?e[s+1]*n:i.length,c=LZ(i,a,l,n,!1);c===c.next&&(c.steiner=!0),r.push(VAe(c))}r.sort(FAe);for(let s=0;s<r.length;s++)t=BAe(r[s],t);return t}function FAe(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){let n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function BAe(i,e){let t=OAe(i,e);if(!t)return e;let n=FZ(t,i);return YA(n,n.next),YA(t,t.next)}function OAe(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(o_(i,t))return t;do{if(o_(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){let f=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>s&&(s=f,o=t.x<t.next.x?t:t.next,f===n))return o}t=t.next}while(t!==e);if(!o)return null;let a=o,l=o.x,c=o.y,u=1/0;t=o;do{if(n>=t.x&&t.x>=l&&n!==t.x&&DZ(r<c?n:s,r,l,c,r<c?s:n,r,t.x,t.y)){let f=Math.abs(r-t.y)/(n-t.x);X2(t,i)&&(f<u||f===u&&(t.x>o.x||t.x===o.x&&UAe(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function UAe(i,e){return Zr(i.prev,i,e.prev)<0&&Zr(e.next,i,i.next)<0}function kAe(i,e,t,n){let r=i;do r.z===0&&(r.z=k8(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,zAe(r)}function zAe(i){let e,t=1;do{let n=i,r;i=null;let s=null;for(e=0;n;){e++;let o=n,a=0;for(let c=0;c<t&&(a++,o=o.nextZ,!!o);c++);let l=t;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||n.z<=o.z)?(r=n,n=n.nextZ,a--):(r=o,o=o.nextZ,l--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;n=o}s.nextZ=null,t*=2}while(e>1);return i}function k8(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function VAe(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function DZ(i,e,t,n,r,s,o,a){return(r-o)*(e-a)>=(i-o)*(s-a)&&(i-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(n-a)}function I2(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&DZ(i,e,t,n,r,s,o,a)}function GAe(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!qAe(i,e)&&(X2(i,e)&&X2(e,i)&&HAe(i,e)&&(Zr(i.prev,i,e.prev)||Zr(i,e.prev,e))||o_(i,e)&&Zr(i.prev,i,i.next)>0&&Zr(e.prev,e,e.next)>0)}function Zr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function o_(i,e){return i.x===e.x&&i.y===e.y}function NZ(i,e,t,n){let r=nM(Zr(i,e,t)),s=nM(Zr(i,e,n)),o=nM(Zr(t,n,i)),a=nM(Zr(t,n,e));return!!(r!==s&&o!==a||r===0&&tM(i,t,e)||s===0&&tM(i,n,e)||o===0&&tM(t,i,n)||a===0&&tM(t,e,n))}function tM(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function nM(i){return i>0?1:i<0?-1:0}function qAe(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&NZ(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function X2(i,e){return Zr(i.prev,i,i.next)<0?Zr(i,e,i.next)>=0&&Zr(i,i.prev,e)>=0:Zr(i,e,i.prev)<0||Zr(i,i.next,e)<0}function HAe(i,e){let t=i,n=!1,r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function FZ(i,e){let t=z8(i.i,i.x,i.y),n=z8(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function cZ(i,e,t,n){let r=z8(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function $2(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function z8(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function WAe(i,e,t,n){let r=0;for(let s=e,o=t-n;s<t;s+=n)r+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return r}var V8=class{static triangulate(e,t,n=2){return RAe(e,t,n)}},Jp=class i{static area(e){let t=e.length,n=0;for(let r=t-1,s=0;s<t;r=s++)n+=e[r].x*e[s].y-e[s].x*e[r].y;return n*.5}static isClockWise(e){return i.area(e)<0}static triangulateShape(e,t){let n=[],r=[],s=[];uZ(e),hZ(n,e);let o=e.length;t.forEach(uZ);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,hZ(n,t[l]);let a=V8.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function uZ(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function hZ(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var Y2=class i extends Xn{constructor(e=new W2([new Oe(.5,.5),new Oe(-.5,.5),new Oe(-.5,-.5),new Oe(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){let c=e[a];o(c)}this.setAttribute("position",new Ln(r,3)),this.setAttribute("uv",new Ln(s,2)),this.computeVertexNormals();function o(a){let l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:1,d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,A=t.bevelThickness!==void 0?t.bevelThickness:.2,y=t.bevelSize!==void 0?t.bevelSize:A-.1,w=t.bevelOffset!==void 0?t.bevelOffset:0,S=t.bevelSegments!==void 0?t.bevelSegments:3,T=t.extrudePath,R=t.UVGenerator!==void 0?t.UVGenerator:jAe,P,I=!1,F,D,L,C;if(T){P=T.getSpacedPoints(u),I=!0,d=!1;let $e=T.isCatmullRomCurve3?T.closed:!1;F=T.computeFrenetFrames(u,$e),D=new re,L=new re,C=new re}d||(S=0,A=0,y=0,w=0);let B=a.extractPoints(c),k=B.shape,z=B.holes;if(!Jp.isClockWise(k)){k=k.reverse();for(let $e=0,ot=z.length;$e<ot;$e++){let nt=z[$e];Jp.isClockWise(nt)&&(z[$e]=nt.reverse())}}function W($e){let nt=10000000000000001e-36,bt=$e[0];for(let yt=1;yt<=$e.length;yt++){let hn=yt%$e.length,en=$e[hn],tn=en.x-bt.x,bn=en.y-bt.y,_e=tn*tn+bn*bn,vi=Math.max(Math.abs(en.x),Math.abs(en.y),Math.abs(bt.x),Math.abs(bt.y)),zn=nt*vi*vi;if(_e<=zn){$e.splice(hn,1),yt--;continue}bt=en}}W(k),z.forEach(W);let Y=z.length,H=k;for(let $e=0;$e<Y;$e++){let ot=z[$e];k=k.concat(ot)}function $($e,ot,nt){return ot||ze("ExtrudeGeometry: vec does not exist"),$e.clone().addScaledVector(ot,nt)}let J=k.length;function te($e,ot,nt){let bt,yt,hn,en=$e.x-ot.x,tn=$e.y-ot.y,bn=nt.x-$e.x,_e=nt.y-$e.y,vi=en*en+tn*tn,zn=en*_e-tn*bn;if(Math.abs(zn)>Number.EPSILON){let le=Math.sqrt(vi),Z=Math.sqrt(bn*bn+_e*_e),Te=ot.x-tn/le,Pe=ot.y+en/le,Ge=nt.x-_e/Z,vt=nt.y+bn/Z,Tt=((Ge-Te)*_e-(vt-Pe)*bn)/(en*_e-tn*bn);bt=Te+en*Tt-$e.x,yt=Pe+tn*Tt-$e.y;let qe=bt*bt+yt*yt;if(qe<=2)return new Oe(bt,yt);hn=Math.sqrt(qe/2)}else{let le=!1;en>Number.EPSILON?bn>Number.EPSILON&&(le=!0):en<-Number.EPSILON?bn<-Number.EPSILON&&(le=!0):Math.sign(tn)===Math.sign(_e)&&(le=!0),le?(bt=-tn,yt=en,hn=Math.sqrt(vi)):(bt=en,yt=tn,hn=Math.sqrt(vi/2))}return new Oe(bt/hn,yt/hn)}let ce=[];for(let $e=0,ot=H.length,nt=ot-1,bt=$e+1;$e<ot;$e++,nt++,bt++)nt===ot&&(nt=0),bt===ot&&(bt=0),ce[$e]=te(H[$e],H[nt],H[bt]);let he=[],ve,Re=ce.concat();for(let $e=0,ot=Y;$e<ot;$e++){let nt=z[$e];ve=[];for(let bt=0,yt=nt.length,hn=yt-1,en=bt+1;bt<yt;bt++,hn++,en++)hn===yt&&(hn=0),en===yt&&(en=0),ve[bt]=te(nt[bt],nt[hn],nt[en]);he.push(ve),Re=Re.concat(ve)}let Qe;if(S===0)Qe=Jp.triangulateShape(H,z);else{let $e=[],ot=[];for(let nt=0;nt<S;nt++){let bt=nt/S,yt=A*Math.cos(bt*Math.PI/2),hn=y*Math.sin(bt*Math.PI/2)+w;for(let en=0,tn=H.length;en<tn;en++){let bn=$(H[en],ce[en],hn);Mt(bn.x,bn.y,-yt),bt===0&&$e.push(bn)}for(let en=0,tn=Y;en<tn;en++){let bn=z[en];ve=he[en];let _e=[];for(let vi=0,zn=bn.length;vi<zn;vi++){let le=$(bn[vi],ve[vi],hn);Mt(le.x,le.y,-yt),bt===0&&_e.push(le)}bt===0&&ot.push(_e)}}Qe=Jp.triangulateShape($e,ot)}let Fe=Qe.length,mt=y+w;for(let $e=0;$e<J;$e++){let ot=d?$(k[$e],Re[$e],mt):k[$e];I?(L.copy(F.normals[0]).multiplyScalar(ot.x),D.copy(F.binormals[0]).multiplyScalar(ot.y),C.copy(P[0]).add(L).add(D),Mt(C.x,C.y,C.z)):Mt(ot.x,ot.y,0)}for(let $e=1;$e<=u;$e++)for(let ot=0;ot<J;ot++){let nt=d?$(k[ot],Re[ot],mt):k[ot];I?(L.copy(F.normals[$e]).multiplyScalar(nt.x),D.copy(F.binormals[$e]).multiplyScalar(nt.y),C.copy(P[$e]).add(L).add(D),Mt(C.x,C.y,C.z)):Mt(nt.x,nt.y,f/u*$e)}for(let $e=S-1;$e>=0;$e--){let ot=$e/S,nt=A*Math.cos(ot*Math.PI/2),bt=y*Math.sin(ot*Math.PI/2)+w;for(let yt=0,hn=H.length;yt<hn;yt++){let en=$(H[yt],ce[yt],bt);Mt(en.x,en.y,f+nt)}for(let yt=0,hn=z.length;yt<hn;yt++){let en=z[yt];ve=he[yt];for(let tn=0,bn=en.length;tn<bn;tn++){let _e=$(en[tn],ve[tn],bt);I?Mt(_e.x,_e.y+P[u-1].y,P[u-1].x+nt):Mt(_e.x,_e.y,f+nt)}}}Ee(),Ve();function Ee(){let $e=r.length/3;if(d){let ot=0,nt=J*ot;for(let bt=0;bt<Fe;bt++){let yt=Qe[bt];Et(yt[2]+nt,yt[1]+nt,yt[0]+nt)}ot=u+S*2,nt=J*ot;for(let bt=0;bt<Fe;bt++){let yt=Qe[bt];Et(yt[0]+nt,yt[1]+nt,yt[2]+nt)}}else{for(let ot=0;ot<Fe;ot++){let nt=Qe[ot];Et(nt[2],nt[1],nt[0])}for(let ot=0;ot<Fe;ot++){let nt=Qe[ot];Et(nt[0]+J*u,nt[1]+J*u,nt[2]+J*u)}}n.addGroup($e,r.length/3-$e,0)}function Ve(){let $e=r.length/3,ot=0;Ye(H,ot),ot+=H.length;for(let nt=0,bt=z.length;nt<bt;nt++){let yt=z[nt];Ye(yt,ot),ot+=yt.length}n.addGroup($e,r.length/3-$e,1)}function Ye($e,ot){let nt=$e.length;for(;--nt>=0;){let bt=nt,yt=nt-1;yt<0&&(yt=$e.length-1);for(let hn=0,en=u+S*2;hn<en;hn++){let tn=J*hn,bn=J*(hn+1),_e=ot+bt+tn,vi=ot+yt+tn,zn=ot+yt+bn,le=ot+bt+bn;It(_e,vi,zn,le)}}}function Mt($e,ot,nt){l.push($e),l.push(ot),l.push(nt)}function Et($e,ot,nt){dn($e),dn(ot),dn(nt);let bt=r.length/3,yt=R.generateTopUV(n,r,bt-3,bt-2,bt-1);Gt(yt[0]),Gt(yt[1]),Gt(yt[2])}function It($e,ot,nt,bt){dn($e),dn(ot),dn(bt),dn(ot),dn(nt),dn(bt);let yt=r.length/3,hn=R.generateSideWallUV(n,r,yt-6,yt-3,yt-2,yt-1);Gt(hn[0]),Gt(hn[1]),Gt(hn[3]),Gt(hn[1]),Gt(hn[2]),Gt(hn[3])}function dn($e){r.push(l[$e*3+0]),r.push(l[$e*3+1]),r.push(l[$e*3+2])}function Gt($e){s.push($e.x),s.push($e.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return XAe(t,n,e)}static fromJSON(e,t){let n=[];for(let s=0,o=e.shapes.length;s<o;s++){let a=t[e.shapes[s]];n.push(a)}let r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new gM[r.type]().fromJSON(r)),new i(n,e.options)}},jAe={generateTopUV:function(i,e,t,n,r){let s=e[t*3],o=e[t*3+1],a=e[n*3],l=e[n*3+1],c=e[r*3],u=e[r*3+1];return[new Oe(s,o),new Oe(a,l),new Oe(c,u)]},generateSideWallUV:function(i,e,t,n,r,s){let o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[n*3],u=e[n*3+1],f=e[n*3+2],d=e[r*3],A=e[r*3+1],y=e[r*3+2],w=e[s*3],S=e[s*3+1],T=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new Oe(o,1-l),new Oe(c,1-f),new Oe(d,1-y),new Oe(w,1-T)]:[new Oe(a,1-l),new Oe(u,1-f),new Oe(A,1-y),new Oe(S,1-T)]}};function XAe(i,e,t){if(t.shapes=[],Array.isArray(i))for(let n=0,r=i.length;n<r;n++){let s=i[n];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var ZA=class i extends Xn{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let s=e/2,o=t/2,a=Math.floor(n),l=Math.floor(r),c=a+1,u=l+1,f=e/a,d=t/l,A=[],y=[],w=[],S=[];for(let T=0;T<u;T++){let R=T*d-o;for(let P=0;P<c;P++){let I=P*f-s;y.push(I,-R,0),w.push(0,0,1),S.push(P/a),S.push(1-T/l)}}for(let T=0;T<l;T++)for(let R=0;R<a;R++){let P=R+c*T,I=R+c*(T+1),F=R+1+c*(T+1),D=R+1+c*T;A.push(P,I,D),A.push(I,F,D)}this.setIndex(A),this.setAttribute("position",new Ln(y,3)),this.setAttribute("normal",new Ln(w,3)),this.setAttribute("uv",new Ln(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.widthSegments,e.heightSegments)}};var Va=class i extends Xn{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let l=Math.min(o+a,Math.PI),c=0,u=[],f=new re,d=new re,A=[],y=[],w=[],S=[];for(let T=0;T<=n;T++){let R=[],P=T/n,I=o+P*a,F=e*Math.cos(I),D=Math.sqrt(e*e-F*F),L=0;T===0&&o===0?L=.5/t:T===n&&l===Math.PI&&(L=-.5/t);for(let C=0;C<=t;C++){let B=C/t,k=r+B*s;f.x=-D*Math.cos(k),f.y=F,f.z=D*Math.sin(k),y.push(f.x,f.y,f.z),d.copy(f).normalize(),w.push(d.x,d.y,d.z),S.push(B+L,1-P),R.push(c++)}u.push(R)}for(let T=0;T<n;T++)for(let R=0;R<t;R++){let P=u[T][R+1],I=u[T][R],F=u[T+1][R],D=u[T+1][R+1];(T!==0||o>0)&&A.push(P,I,D),(T!==n-1||l<Math.PI)&&A.push(I,F,D)}this.setIndex(A),this.setAttribute("position",new Ln(y,3)),this.setAttribute("normal",new Ln(w,3)),this.setAttribute("uv",new Ln(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var Z2=class i extends Xn{constructor(e=new q2(new re(-1,-1,0),new re(-1,1,0),new re(1,1,0)),t=64,n=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:s};let o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;let a=new re,l=new re,c=new Oe,u=new re,f=[],d=[],A=[],y=[];w(),this.setIndex(y),this.setAttribute("position",new Ln(f,3)),this.setAttribute("normal",new Ln(d,3)),this.setAttribute("uv",new Ln(A,2));function w(){for(let P=0;P<t;P++)S(P);S(s===!1?t:0),R(),T()}function S(P){u=e.getPointAt(P/t,u);let I=o.normals[P],F=o.binormals[P];for(let D=0;D<=r;D++){let L=D/r*Math.PI*2,C=Math.sin(L),B=-Math.cos(L);l.x=B*I.x+C*F.x,l.y=B*I.y+C*F.y,l.z=B*I.z+C*F.z,l.normalize(),d.push(l.x,l.y,l.z),a.x=u.x+n*l.x,a.y=u.y+n*l.y,a.z=u.z+n*l.z,f.push(a.x,a.y,a.z)}}function T(){for(let P=1;P<=t;P++)for(let I=1;I<=r;I++){let F=(r+1)*(P-1)+(I-1),D=(r+1)*P+(I-1),L=(r+1)*P+I,C=(r+1)*(P-1)+I;y.push(F,D,C),y.push(D,L,C)}}function R(){for(let P=0;P<=t;P++)for(let I=0;I<=r;I++)c.x=P/t,c.y=I/r,A.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new i(new gM[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},K2=class extends Xn{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){let t=[],n=new Set,r=new re,s=new re;if(e.index!==null){let o=e.attributes.position,a=e.index,l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){let f=l[c],d=f.start,A=f.count;for(let y=d,w=d+A;y<w;y+=3)for(let S=0;S<3;S++){let T=a.getX(y+S),R=a.getX(y+(S+1)%3);r.fromBufferAttribute(o,T),s.fromBufferAttribute(o,R),fZ(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{let o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){let u=3*a+c,f=3*a+(c+1)%3;r.fromBufferAttribute(o,u),s.fromBufferAttribute(o,f),fZ(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Ln(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function fZ(i,e,t){let n=`${i.x},${i.y},${i.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${i.x},${i.y},${i.z}`;return t.has(n)===!0||t.has(r)===!0?!1:(t.add(n),t.add(r),!0)}var Q2=class extends Ws{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new zt(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}};function dg(i){let e={};for(let t in i){e[t]={};for(let n in i[t]){let r=i[t][n];if(dZ(r))r.isRenderTargetTexture?(Xe("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone();else if(Array.isArray(r))if(dZ(r[0])){let s=[];for(let o=0,a=r.length;o<a;o++)s[o]=r[o].clone();e[t][n]=s}else e[t][n]=r.slice();else e[t][n]=r}}return e}function fa(i){let e={};for(let t=0;t<i.length;t++){let n=dg(i[t]);for(let r in n)e[r]=n[r]}return e}function dZ(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function $Ae(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function gF(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ln.workingColorSpace}var pg={clone:dg,merge:fa},YAe=`void main() {7+`||c===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}let d=e[c+1]||i.font,A=bX(d,f);t.push(A),o+=A;let y=qpe(d);n.push(y),l=Math.max(l,y)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function SX(i,e,t,n,r,s,o,a,l,c,u){i.save(),t!==1&&(i.globalAlpha===void 0?i.globalAlpha=f=>f.globalAlpha*=t:i.globalAlpha*=t),e&&i.transform.apply(i,e),n.contextInstructions?(i.translate(l,c),i.scale(u[0],u[1]),Hpe(n,i)):u[0]<0||u[1]<0?(i.translate(l,c),i.scale(u[0],u[1]),i.drawImage(n,r,s,o,a,0,0,o,a)):i.drawImage(n,r,s,o,a,l,c,o*u[0],a*u[1]),i.restore()}function Hpe(i,e){let t=i.contextInstructions;for(let n=0,r=t.length;n<r;n+=2)Array.isArray(t[n+1])?e[t[n]].apply(e,t[n+1]):e[t[n]]=t[n+1]}var ZN=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=cs(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new i({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return ei()}getImage(e){return ei()}getHitDetectionImage(){return ei()}getPixelRatio(e){return 1}getImageState(){return ei()}getImageSize(){return ei()}getOrigin(){return ei()}getSize(){return ei()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=cs(e)}listenImageChange(e){ei()}load(){ei()}unlistenImageChange(e){ei()}ready(){return Promise.resolve()}},kE=ZN;var KN=class i extends kE{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,rotation:e.rotation!==void 0?e.rotation:0,scale:e.scale!==void 0?e.scale:1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?Pn.LOADING:Pn.LOADED,this.imageState_===Pn.LOADING&&this.ready().then(()=>this.imageState_=Pn.LOADED),this.render()}clone(){let e=this.getScale(),t=new i({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){let e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){let t=this.fill_?.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(","),r=na.get(n,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*e),a=Di(o,o);this.draw_(s,a,e),r=a.canvas;let l=new AX(r,void 0,null,Pn.LOADED,null);na.set(n,null,l),createImageBitmap(r).then(c=>{l.setImage(c)})}return r}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let r=this.radius,s=this.radius2_===void 0?r:this.radius2_;if(r<s){let D=r;r=s,s=D}let o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=s*Math.sin(a),c=Math.sqrt(s*s-l*l),u=r-c,f=Math.sqrt(l*l+u*u),d=f/l;if(e==="miter"&&d<=n)return d*t;let A=t/2/d,y=t/2*(u/f),S=Math.sqrt((r+A)*(r+A)+y*y)-r;if(this.radius2_===void 0||e==="bevel")return S*2;let T=r*Math.sin(a),R=Math.sqrt(r*r-T*T),I=s-R,F=Math.sqrt(T*T+I*I)/T;if(F<=n){let D=F*t/2-s-r;return 2*Math.max(S,D)}return S*2}createRenderOptions(){let e=gh,t=vh,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=gl(this.stroke_.getColor()??ia),a=this.stroke_.getWidth()??od,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??vh,e=this.stroke_.getLineCap()??gh,n=this.stroke_.getMiterLimit()??rd);let l=this.calculateLineJoinSize_(t,a,n),c=Math.max(this.radius,this.radius2_||0),u=Math.ceil(2*c+l);return{strokeStyle:o,strokeWidth:a,size:u,lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:t,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();let e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,n){if(t.scale(n,n),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let r=this.fill_.getColor();r===null&&(r=io),t.fillStyle=gl(r),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let n=this.fill_.getColor(),r=0;typeof n=="string"&&(n=Oc(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Di(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_,n=this.radius;if(t===1/0)e.arc(0,0,n,0,2*Math.PI);else{let r=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(t*=2);let s=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){let l=s+a*o,c=a%2===0?n:r;e.lineTo(c*Math.cos(l),c*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=io,t.fill(),e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}},zE=KN;var QN=class i extends zE{constructor(e){e=e||{radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale!==void 0?e.scale:1,rotation:e.rotation!==void 0?e.rotation:0,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode})}clone(){let e=this.getScale(),t=new i({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}},VE=QN;var JN=class i{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){let e=this.getColor();return new i({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){if(e!==null&&typeof e=="object"&&"src"in e){let t=Dp(null,e.src,{crossOrigin:"anonymous"},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===Pn.IDLE&&t.load(),t.getImageState()===Pn.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?Bn(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:Oc(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},ks=JN;function TX(i,e,t,n){return t!==void 0&&n!==void 0?[t/i,n/e]:t!==void 0?t/i:n!==void 0?n/e:1}var e5=class i extends kE{constructor(e){e=e||{};let t=e.opacity!==void 0?e.opacity:1,n=e.rotation!==void 0?e.rotation:0,r=e.scale!==void 0?e.scale:1,s=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:n,scale:r,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:s,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy_=e.referrerPolicy;let o=e.img!==void 0?e.img:null,a=e.src;jn(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Bn(o)),jn(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),jn(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(e.src!==void 0?l=Pn.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?Pn.LOADED:Pn.IDLE:l=Pn.LOADING:l=Pn.LOADED),this.color_=e.color!==void 0?Oc(e.color):null,this.iconImage_=Dp(o,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null,this.initialOptions_,e.width!==void 0||e.height!==void 0){let c,u;if(e.size)[c,u]=e.size;else{let f=this.getImage(1);if(f.width&&f.height)c=f.width,u=f.height;else if(f instanceof HTMLImageElement){this.initialOptions_=e;let d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;let A=this.iconImage_.getSize();this.setScale(TX(A[0],A[1],e.width,e.height))};this.listenImageChange(d);return}}c!==void 0&&this.setScale(TX(c,u,e.width,e.height))}}clone(){let e,t,n;return this.initialOptions_?(t=this.initialOptions_.width,n=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new i({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:e,width:t,height:n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;let r=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!r)return null;e=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(e[0]*=r[0]),this.anchorYUnits_=="fraction"&&(e[1]*=r[1])}if(this.anchorOrigin_!="top-left"){if(!r)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(e[0]=-e[0]+r[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(e[1]=-e[1]+r[1])}this.normalizedAnchor_=e}let t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){let t=e?Oc(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((o,a)=>o===t[a]))return;this.color_=t;let n=this.getSrc(),r=n!==void 0?null:this.getHitDetectionImage(),s=n!==void 0?Pn.IDLE:this.iconImage_.getImageState();this.iconImage_=Dp(r,n,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){let t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=Dp(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Pn.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==Pn.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){let e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==Pn.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(nn.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(nn.CHANGE,e)}ready(){return this.iconImage_.ready()}},vA=e5;var t5=class i{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash!==void 0?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.offset_=e.offset,this.width_=e.width}clone(){let e=this.getColor();return new i({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setOffset(e){this.offset_=e}setWidth(e){this.width_=e}},ro=t5;var GE=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=EX,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill!==void 0?e.fill:null,this.image_=e.image!==void 0?e.image:null,this.renderer_=e.renderer!==void 0?e.renderer:null,this.hitDetectionRenderer_=e.hitDetectionRenderer!==void 0?e.hitDetectionRenderer:null,this.stroke_=e.stroke!==void 0?e.stroke:null,this.text_=e.text!==void 0?e.text:null,this.zIndex_=e.zIndex}clone(){let e=this.getGeometry();return e&&typeof e=="object"&&(e=e.clone()),new i({geometry:e??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e=="function"?this.geometryFunction_=e:typeof e=="string"?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=EX,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function MX(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(jn(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}var n5=null;function i5(i,e){if(!n5){let t=new ks({color:"rgba(255,255,255,0.4)"}),n=new ro({color:"#3399CC",width:1.25});n5=[new GE({image:new VE({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return n5}function EX(i){return i.getGeometry()}var Xr=GE;var Wpe="#333",r5=class i{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=cs(e.scale!==void 0?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill!==void 0?e.fill:new ks({color:Wpe}),this.maxAngle_=e.maxAngle!==void 0?e.maxAngle:Math.PI/4,this.placement_=e.placement!==void 0?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=e.stroke!==void 0?e.stroke:null,this.offsetX_=e.offsetX!==void 0?e.offsetX:0,this.offsetY_=e.offsetY!==void 0?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new i({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof ks?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=cs(e!==void 0?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}},Bp=r5;function ad(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function PX(i){let e=i.get("pin");return!e||ld(e)||e.passesZoneFilters||c5(e)?null:o5(e,!1)}function IX(i){let e=i.get("pin");return!e||!O.highlightedZones.size||!e.passesZoneFilters||ld(e)||c5(e)?null:o5(e,!1)}function LX(i){let e=i.get("pin");return!e||ld(e)||Zf(null,e.category)!=="always"&&!(O.labelsHeld&&!uW(e.category))?null:NX(e)}function DX(i){let e=i.get("pin");if(!e||ld(e))return null;let t=o5(e,e===O.selectedPin);return e===O.hoveredPin||e===O.selectedPin?[t,NX(e)]:t}function o5(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(O.styleCache.has(t))return O.styleCache.get(t);let n=fA(i.category),r=e?2e7:i.priority,s=O.markerIcons.get(Jy(i.category)),o;return s?o=new Xr({image:new vA({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new Xr({text:new Bp({text:bu(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new ks({color:n}),stroke:new ro({color:hA(),width:e?4:3})}),zIndex:r}),O.styleCache.set(t,o),o}function NX(i){let e=`marker-label:${i.location.id}`;if(O.styleCache.has(e))return O.styleCache.get(e);let t=new Xr({text:new Bp({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new ks({color:"#f2ece0"}),stroke:new ro({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new ks({color:"rgba(10,12,17,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:i.priority});return O.styleCache.set(e,t),t}function FX(i){if(!i.iconAsset)return;let e=Jy(i);if(O.markerIcons.has(e))return;O.markerIcons.set(e,null);let t=new Image;t.onload=()=>{let n=document.createElement("canvas");n.width=64,n.height=64;let r=n.getContext("2d"),s=fA(i),o=document.createElement("canvas");o.width=64,o.height=64;let a=o.getContext("2d");a.imageSmoothingEnabled=!i.iconPicture,a.drawImage(t,6,6,52,52),i.iconPicture||(a.globalCompositeOperation="source-in",a.fillStyle=s,a.fillRect(0,0,64,64));let l=document.createElement("canvas");l.width=64,l.height=64;let c=l.getContext("2d");c.drawImage(t,6,6,52,52),c.globalCompositeOperation="source-in",c.fillStyle=hA(),c.fillRect(0,0,64,64);for(let u=-3;u<=3;u++)for(let f=-3;f<=3;f++)f*f+u*u<=10&&r.drawImage(l,f,u);r.drawImage(o,0,0),O.markerIcons.set(e,n.toDataURL("image/png")),jpe(),O.layers.pins.changed(),O.layers.zonePins.changed(),O.layers.priority.changed()},t.onerror=()=>O.markerIcons.set(e,!1),t.src=gN(i.iconAsset)}function jpe(){for(let i of O.styleCache.keys())i.startsWith("marker:")&&O.styleCache.delete(i)}function Jy(i){return`${i.iconAsset||""}:${fA(i)}:${O.world?.iconOutset||"light"}`}function qE(i,e){return`${i} ${e}px ${Vi.labelFont}`}function a5(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="neighbor",r=n?Vi.neighborLabelSizePx:Vi.labelSizePx,s=qE(900,r),o=n?[2,4,2,4]:[3,5,3,5],a=$pe(t,s,r,o,e),l=IE(t,{subgridVisible:O.subgridVisible,labelled:a});if(!l)return null;let c=`grid:${O.gridSystem}:${t.hash}:${t.role}:${t.contextDistance}:${a?1:0}:${l.bare?1:0}`;if(O.styleCache.has(c))return O.styleCache.get(c);let u=t.role==="leaf"||t.role==="scope"?100:i.get("priority"),f=[new Xr({fill:l.fill?new ks({color:Dc(l.fill.color,l.fill.opacity)}):void 0,stroke:new ro({color:Dc(l.line.color,l.line.opacity),width:l.line.widthPx}),zIndex:u})];if(l.label){let d=l.label.prefix?[l.label.prefix,qE(500,r),l.label.final,qE(900,r)]:l.label.final,A=Vi.labelInsetPx*e,y=Xpe(i.getGeometry());y&&f.push(new Xr({geometry:new yu([y[0]-A,y[1]+A]),text:new Bp({text:d,font:qE(900,r),textAlign:"right",textBaseline:"bottom",fill:new ks({color:Dc(l.label.color,l.label.textAlpha)}),backgroundFill:new ks({color:l.label.chip}),padding:o,overflow:!0}),zIndex:u+1}))}return O.styleCache.set(c,f),f}function Xpe(i){let e=i.getType()==="MultiPolygon"?i.getCoordinates():[i.getCoordinates()],t=null;for(let n of e)for(let[r,s]of n[0]||[])(!t||r-s>t[0]-t[1])&&(t=[r,s]);return t}function $pe(i,e,t,n,r){if(!r)return!0;let s=l5(i.hash,e)+n[1]+n[3],o=t+n[0]+n[2];return s<=(i.extent[2]-i.extent[0])/r&&o<=(i.extent[3]-i.extent[1])/r}var CX=document.createElement("canvas").getContext("2d"),RX=new Map;function l5(i,e){let t=`${e}|${i}`,n=RX.get(t);return n===void 0&&(CX.font=e,n=CX.measureText(i).width,RX.set(t,n)),n}var Ype=new Xr({fill:new ks({color:"rgba(5, 8, 16, 0.62)"})});function BX(){return V1()?Ype:null}function OX(i,e){let t=i.get("zone");if(Io(fu(t)))return null;let n=i.get("child"),r=O.highlightedZones.has(t.id),s=VX(t.id),o=Number(t.attrs?.["atlas.stroke.width_px"])||Number(z1(t)?.attrs?.["atlas.stroke.width_px"])||0;if(o>0&&i.getGeometry()?.getType()==="MultiLineString")return Zpe(t,i.get("color"),o/e,r,s);let a=`zone:${t.id}:${n?1:0}:${r?1:s?2:0}`;if(O.styleCache.has(a))return O.styleCache.get(a);let l=i.get("color");if(s){let f=new Xr({stroke:new ro({color:Dc(l,n?.34:.44),width:n?1:1.3,lineDash:n?[3,4]:[7,5]}),zIndex:n?101:100});return O.styleCache.set(a,f),f}let c=new Xr({fill:new ks({color:Dc(l,n?.035:.07)}),stroke:new ro({color:Dc(l,n?.5:.72),width:n?1.2:1.8,lineDash:n?[3,4]:[7,5]})});if(!r)return O.styleCache.set(a,c),c;let u=[new Xr({stroke:new ro({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new Xr({fill:new ks({color:Dc(l,.22)}),stroke:new ro({color:l,width:2.6}),zIndex:9001})];return O.styleCache.set(a,u),u}function Zpe(i,e,t,n,r){let s=Math.max(t,1.5);return n?[new Xr({stroke:new ro({color:"rgba(255,255,255,0.94)",width:s+4,lineCap:"round",lineJoin:"round"}),zIndex:9e3}),new Xr({stroke:new ro({color:Dc(e,.9),width:s,lineCap:"round",lineJoin:"round"}),zIndex:9001})]:[new Xr({stroke:new ro({color:Dc(e,r?.14:.3),width:s,lineCap:"round",lineJoin:"round"})}),new Xr({stroke:new ro({color:Dc(e,r?.4:.8),width:Math.min(1.6,s),lineDash:[7,5]})})]}function UX(i){if(u5())return null;let e=i.get("zone");if(Io(fu(e))||zX(e))return null;let t=O.highlightedZones.has(e.id);if(Zf(e)==="quiet")return s5(i);let n=i.get("child"),r=O.engine.getView().getZoom()||0;if(!t&&n&&r<O.fitZoom+3)return null;let s=i.get("span")/O.engine.getView().getResolution();return!t&&O.zoneTitleCount>40&&s<52?null:s5(i)}function kX(i){if(!u5())return null;let e=i.get("zone");return Io(fu(e))||zX(e)?null:s5(i)}function zX(i){return Zf(i)!=="quiet"||O.highlightedZones.has(i.id)||O.selectedZone===i?!1:O.labelOverrides.get(fu(i))==="quiet"||!O.labelsHeld}function s5(i){let e=i.get("child"),t=i.get("zone"),n=O.highlightedZones.has(t.id),r=VX(t.id),s=`zone-title:${t.id}:${e?1:0}:${n?1:r?2:0}`;if(O.styleCache.has(s))return O.styleCache.get(s);let o=i.get("color"),a=new Xr({text:new Bp({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new ks({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new ro({color:n?"rgba(255,255,255,0.96)":r?"rgba(0,0,0,0.82)":"rgba(0,0,0,0.95)",width:n?2:r?3:4}),backgroundFill:new ks({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new ro({color:n?"#ffffff":Dc(o,r?.24:.55),width:n?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:n?91e5:i.get("priority")});return O.styleCache.set(s,a),a}function VX(i){if(!O.highlightedZones.size||O.highlightedZones.has(i))return!1;for(let e of O.highlightedZones)if(Kpe(i,e))return!1;return!0}function Kpe(i,e){let t=new Set,n=O.zoneRecords.get(e)?.zone.parent;for(;n!=null&&!t.has(n);){if(n===i)return!0;t.add(n),n=O.zoneRecords.get(n)?.zone.parent}return!1}function _A(i,e,t,n,r,s,o){let a,l,c=(t-e)/n;if(c===1)a=e;else if(c===2)a=e,l=r;else if(c!==0){let u=i[e],f=i[e+1],d=0,A=[0];for(let S=e+n;S<t;S+=n){let T=i[S],R=i[S+1];d+=Math.sqrt((T-u)*(T-u)+(R-f)*(R-f)),A.push(d),u=T,f=R}let y=r*d,w=ej(A,y);w<0?(l=(y-A[-w-2])/(A[-w-1]-A[-w-2]),a=e+(-w-2)*n):a=e+w*n}o=o>1?o:2,s=s||new Array(o);for(let u=0;u<o;++u)s[u]=a===void 0?NaN:l===void 0?i[a+u]:Lo(i[a+u],i[a+n+u],l);return s}function HE(i,e,t,n,r,s){if(t==e)return null;let o;if(r<i[e+n-1])return s?(o=i.slice(e,e+n),o[n-1]=r,o):null;if(i[t-1]<r)return s?(o=i.slice(t-n,t),o[n-1]=r,o):null;if(r==i[e+n-1])return i.slice(e,e+n);let a=e/n,l=t/n;for(;a<l;){let d=a+l>>1;r<i[(d+1)*n-1]?l=d:a=d+1}let c=i[a*n-1];if(r==c)return i.slice((a-1)*n,(a-1)*n+n);let u=i[(a+1)*n-1],f=(r-c)/(u-c);o=[];for(let d=0;d<n-1;++d)o.push(Lo(i[(a-1)*n+d],i[a*n+d],f));return o.push(r),o}function GX(i,e,t,n,r,s,o){if(o)return HE(i,e,t[t.length-1],n,r,s);let a;if(r<i[n-1])return s?(a=i.slice(0,n),a[n-1]=r,a):null;if(i[i.length-1]<r)return s?(a=i.slice(i.length-n),a[n-1]=r,a):null;for(let l=0,c=t.length;l<c;++l){let u=t[l];if(e!=u){if(r<i[e+n-1])return null;if(r<=i[u-1])return HE(i,e,u,n,r,!1);e=u}}return null}function dv(i,e,t,n){let r=i[e],s=i[e+1],o=0;for(let a=e+n;a<t;a+=n){let l=i[a],c=i[a+1];o+=Math.sqrt((l-r)*(l-r)+(c-s)*(c-s)),r=l,s=c}return o}var h5=class i extends Al{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){Do(this.flatCoordinates,e),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Uy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),zy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,n,r))}forEachSegment(e){return sE(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!="XYM"&&this.layout!="XYZM"?null:(t=t!==void 0?t:!1,HE(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return Bc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return _A(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return dv(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(e){let t=[];return t.length=pA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LineString"}intersectsExtent(e){return oA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=uA(this.flatCoordinates,0,e,this.stride),this.changed()}},f5=h5;var d5=class i extends Al{constructor(e,t,n){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&n)this.setFlatCoordinates(t,e),this.ends_=n;else{let r=e,s=[],o=[];for(let l=0,c=r.length;l<c;++l){let u=r[l];Do(s,u.getFlatCoordinates()),o.push(s.length)}let a=r.length===0?this.getLayout():r[0].getLayout();this.setFlatCoordinates(a,s),this.ends_=o}}appendLineString(e){Do(this.flatCoordinates,e.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ky(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Vy(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,n,r))}getCoordinateAtM(e,t,n){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(t=t!==void 0?t:!1,n=n!==void 0?n:!1,GX(this.flatCoordinates,0,this.ends_,this.stride,e,t,n))}getCoordinates(){return Pp(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new f5(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){let e=this.flatCoordinates,t=this.ends_,n=this.layout,r=[],s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o],c=new f5(e.slice(s,l),n);r.push(c),s=l}return r}getLength(){let e=this.ends_,t=0,n=0;for(let r=0,s=e.length;r<s;++r)n+=dv(this.flatCoordinates,t,e[r],this.stride),t=e[r];return n}getFlatMidpoints(){let e=[],t=this.flatCoordinates,n=0,r=this.ends_,s=this.stride;for(let o=0,a=r.length;o<a;++o){let l=r[o],c=_A(t,n,l,s,.5);Do(e,c),n=l}return e}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=SE(this.flatCoordinates,0,this.ends_,this.stride,e,t,0,n),new i(t,"XY",n)}getType(){return"MultiLineString"}intersectsExtent(e){return oj(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=Dy(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},qX=d5;function p5(){O.renderedShard=O.lens?.shard||0,O.sources.zones.clear(),O.sources.zoneTitles.clear(),O.zoneRecords.clear(),O.highlightedZones.clear(),O.focusedZoneID=null,O.zoneTitleCount=0,Op();for(let i of O.world.collections)if(i.kind!=="point")for(let e of i.features||[]){if(!By(e))continue;e.collectionId=i.id;let t=Wr(),n=[],r=!1;for(let l of e.geometry||[]){let c=e0e(l);c&&(r=!0,n.push(c),qT(t,c.getExtent()),O.sources.zones.addFeature(new Rp({geometry:c,zone:e,color:cv(e.id),child:e.parent!=null})))}if(!r)continue;let s=cv(e.id),o=e.center?pv(e.center.lat,e.center.lng):dl(t),a=Math.max(t[2]-t[0],t[3]-t[1]);O.sources.zoneTitles.addFeature(new Rp({geometry:new yu(o),zone:e,color:s,child:e.parent!=null,span:a,priority:(e.parent==null?2e6:1e6)+Math.round(a)})),O.zoneRecords.set(e.id,{zone:e,collection:i,extent:t.slice(),geometries:n,color:s})}m5(),A5(),Qpe()}function m5(){O.zoneTitleCount=O.sources.zoneTitles.getFeatures().filter(i=>Zf(i.get("zone"))!=="quiet").length}function A5(){if(O.sources.zoneScrim.clear(),!O.highlightedZones.size)return;let[i,e,t,n]=O.projection.getExtent(),r=[HX([[i,e],[t,e],[t,n],[i,n],[i,e]],!0)];for(let s of O.highlightedZones)for(let o of O.zoneRecords.get(s)?.geometries||[]){if(o.getType()==="MultiLineString")continue;let a=o.getType()==="MultiPolygon"?o.getPolygons():[o];for(let l of a)l.getLinearRings().forEach((c,u)=>{r.push(HX(c.getCoordinates(),u>0))})}O.sources.zoneScrim.addFeature(new Rp({geometry:new Ah(r)}))}function HX(i,e){let t=0;for(let n=0,r=i.length-1;n<i.length;r=n++)t+=i[r][0]*i[n][1]-i[n][0]*i[r][1];return t<0===e?i:i.slice().reverse()}function Qpe(){for(let i of ge.legend.querySelectorAll(".feature-index")){let e=document.createDocumentFragment();for(let{zone:t,depth:n}of Jpe(wu(i.dataset.featureIndex))){let r=O.zoneRecords.get(t.id);if(!r)continue;let s=document.createElement("button");s.type="button",s.className="zone-index-item",s.dataset.zone=String(t.id),s.style.setProperty("--zone-color",r.color),s.style.setProperty("--zone-depth",String(n)),s.setAttribute("aria-pressed","false"),s.title=`${t.title}: click to jump; right-click to toggle highlight`;let o=document.createElement("span");o.className="zone-index-marker",o.setAttribute("aria-hidden","true");let a=document.createElement("span");a.textContent=t.title,s.append(o,a),e.append(s)}i.replaceChildren(e)}}function Jpe(i){let e=[...O.zoneRecords.values()].filter(a=>a.zone.collectionId===i).map(a=>a.zone),t=new Set(e.map(a=>a.id)),n=new Map;for(let a of e){let l=t.has(a.parent)?a.parent:null;n.has(l)||n.set(l,[]),n.get(l).push(a)}for(let a of n.values())a.sort((l,c)=>l.title.localeCompare(c.title,void 0,{numeric:!0,sensitivity:"base"}));let r=[],s=new Set,o=(a,l)=>{if(!s.has(a.id)){s.add(a.id),r.push({zone:a,depth:l});for(let c of n.get(a.id)||[])o(c,l+1)}};for(let a of n.get(null)||[])o(a,0);for(let a of e)o(a,0);return r}function Op(){let i=V1();O.layers.zoneScrim.setVisible(i),O.layers.zones.setVisible(i),O.layers.zoneTitles.setVisible(i),O.layers.zoneTitleDetail.setVisible(i);let e=!1;for(let t of[...O.highlightedZones]){let n=O.zoneRecords.get(t);(!n||Io(fu(n.zone)))&&(O.highlightedZones.delete(t),e=!0)}e&&(WE(),A5(),v5()),O.layers.zones.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed()}function g5(i){let e=O.zoneRecords.get(i);e&&(O.focusedZoneID=i,v5(),wE(e.zone),O.engine.getView().fit(e.extent,{size:O.engine.getSize(),padding:[54,54,54,54],maxZoom:mh(O.lens),duration:220}),ge.sidebar.classList.remove("is-open"),ge.mobileLegend.setAttribute("aria-expanded","false"))}function WX(i){let e=O.zoneRecords.get(i);e&&(O.highlightedZones.has(i)?O.highlightedZones.delete(i):(O.highlightedZones.add(i),O.hiddenCollections.delete(fu(e.zone))&&(dA(),ph()),Op()),O.hoveredPin=null,WE(),_5(),v5(),A5(),O.layers.zones.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed())}function v5(){for(let i of ge.legend.querySelectorAll(".feature-index"))i.classList.toggle("has-highlights",O.highlightedZones.size>0);for(let i of ge.legend.querySelectorAll("[data-zone]")){let e=Number(i.dataset.zone),t=O.highlightedZones.has(e);i.classList.toggle("is-highlighted",t),i.classList.toggle("is-current",O.focusedZoneID===e),i.setAttribute("aria-pressed",String(t))}}function e0e(i){if(!i?.coordinates)return null;let e=([t,n])=>pv(n,t);return i.type==="Polygon"?new Ah(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new RE(i.coordinates.map(t=>t.map(n=>n.map(e)))):i.type==="MultiLineString"?new qX(i.coordinates.map(t=>t.map(e))):null}function pv(i,e){let t=t0e(),n=2**t.sourceZoom,r=(e+180)/360*n,s=i*Math.PI/180,o=(1-Math.asinh(Math.tan(s))/Math.PI)/2*n;return[(r-t.firstTile)*t.tileSize,-(o-t.firstTile)*t.tileSize]}function t0e(){let i=O.volume.tileGrid,e=O.world?.grid;return e?{...i,...e}:i}function jX(){O.sources.pins.clear(),O.sources.priority.clear(),O.features=[],O.featureByID.clear();for(let i of O.world.collections)if(i.kind==="point"){FX(i);for(let e of i.locations){let t={location:e,category:i,coordinate:pv(e.lat,e.lng),filteredHidden:!1,priority:r0e(i,e),feature:null};t.feature=new Rp({geometry:new yu(t.coordinate),pin:t,priority:t.priority}),O.features.push(t),O.featureByID.set(e.id,t),O.sources.pins.addFeature(t.feature)}}Nc()}function Nc(){for(let i of O.features){let e=Io(i.category.id),t=O.search&&!i.location.title.toLocaleLowerCase().includes(O.search);i.filteredHidden=!!(e||t)}WE(),_5(),O.selectedPin?.filteredHidden&&id(),nd(),document.dispatchEvent(new Event("atlas:filters"))}function WE(){if(!O.highlightedZones.size){for(let e of O.features)e.passesZoneFilters=!1;return}let i=lW([...O.highlightedZones].map(e=>O.zoneRecords.get(e)).filter(Boolean));for(let e of O.features)e.passesZoneFilters=cW(i,e.coordinate)}function _5(){O.eligibleLocations=O.features.filter(i=>!ld(i)).length,Fc(),O.layers.pins.changed(),O.layers.zonePins.changed(),O.layers.pinLabels.changed(),O.layers.priority.changed(),xA()}function Fc(){O.sources.priority.clear();for(let i of O.features){if(ld(i))continue;let e=!!O.search&&i.location.title.toLocaleLowerCase().includes(O.search);(i===O.selectedPin||i===O.hoveredPin||e||Lp(i))&&O.sources.priority.addFeature(i.feature)}}function mv(i){O.hoveredPin!==i&&(O.hoveredPin=i,O.sources&&(Fc(),O.layers.pins.changed(),O.layers.priority.changed()))}function jE(i){O.labelsHeld!==i&&(O.labelsHeld=i,ge.labelsHint.textContent=i?"Z \xB7 labels shown":"Z \xB7 hold for labels",O.layers.pinLabels.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed(),document.dispatchEvent(new Event("atlas:labels")))}function c5(i){return i===O.selectedPin||i===O.hoveredPin||Lp(i)||!!O.search&&i.location.title.toLocaleLowerCase().includes(O.search)}function ld(i){return i.filteredHidden||n0e(i)||i0e(i)||!By(i.location)}function By(i){let e=O.lens?.shard;return!e||!i.shard||i.shard===e}function n0e(i){return!O.highlightedZones.size||i.passesZoneFilters||i===O.selectedPin?!1:!(O.search&&i.location.title.toLocaleLowerCase().includes(O.search))}function i0e(i){return!O.gridEnabled||!O.gridCell||Lp(i)||i===O.selectedPin?!1:!(O.search&&i.location.title.toLocaleLowerCase().includes(O.search))}function r0e(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+Zj(e.id)%1e3}function u5(){return(O.engine?.getView().getZoom()||0)>=(O.lens?.maxZoom||0)-.05}function XX(i){let e=[],t=new Map,n=(s,o,a)=>{t.has(s)||(t.set(s,e.length),e.push({key:s,title:o,collections:[]})),e[t.get(s)].collections.push(a)},r=[];for(let s of i)s.kind!=="point"&&!s.group?r.push(s):n(`group-${s.group}`,s.group,s);return r.length&&e.unshift({key:"zones",title:"Zones",collections:r}),e}function $X(i){return i.kind||"point"}function YX(i){return(i.features||i.locations||[]).length}function wu(i){return/^\d+$/.test(i)?Number(i):i}function ZX(i){for(let e of O.world?.sections||[])for(let t of e.collections)if(t.id===i)return t;return null}function KX(){let i=document.createDocumentFragment();for(let e of O.world.sections){let t=document.createElement("section");t.className="layer-section",t.dataset.layerSection=e.key;let n=e.collections.reduce((s,o)=>s+YX(o),0);t.append(s0e(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.collections)if(r.append(o0e(s)),$X(s)!=="point"){let o=document.createElement("div");o.className="feature-index",o.dataset.featureIndex=String(s.id),r.append(o)}t.append(r),i.append(t)}ge.legend.replaceChildren(i),XE(),e$(),ph()}function s0e(i,e,t){let n=document.createElement("div");n.className="layer-header";let r=document.createElement("button");r.type="button",r.className="layer-title",r.dataset.section=i;let s=document.createElement("span");s.className="layer-chevron",s.setAttribute("aria-hidden","true"),s.innerHTML='<svg viewBox="0 0 24 24"><path d="m9 6 6 6-6 6"/></svg>';let o=document.createElement("span");o.textContent=e;let a=document.createElement("span");a.className="layer-count",a.textContent=jl(t),r.append(s,o,a);let l=QX(`Show only ${e}`);l.dataset.onlySection=i;let c=document.createElement("label");c.className="layer-switch";let u=document.createElement("input");u.type="checkbox",u.dataset.sectionToggle=i,u.setAttribute("aria-label",`Show ${e}`);let f=document.createElement("span");return f.setAttribute("aria-hidden","true"),c.append(u,f),n.append(r,l,c),n}function QX(i){let e=document.createElement("button");return e.type="button",e.className="only-button",e.dataset.label=i,e.setAttribute("aria-label",i),e.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="4.6"/><circle cx="8" cy="8" r="1.3" fill="currentColor" stroke="none"/><path d="M8 1v2M8 13v2M1 8h2M13 8h2"/></svg>',e}function o0e(i){let e=$X(i),t=document.createElement("label");t.className="category-row";let n=document.createElement("input");n.type="checkbox",n.dataset.collection=String(i.id),n.checked=!O.hiddenCollections.has(i.id);let r;e!=="point"?(r=document.createElement("button"),r.type="button",r.className="collection-expand",r.dataset.expandCollection=String(i.id),r.setAttribute("aria-label",`Unfold the ${i.title} index`),r.innerHTML='<svg class="collection-chevron" viewBox="0 0 16 16" aria-hidden="true"><path d="m6 4 4 4-4 4"/></svg>'+(e==="path"?'<svg class="collection-kind" viewBox="0 0 16 16" aria-hidden="true"><path d="M2.5 12.5c3-6 8-2 11-9"/></svg>':'<svg class="collection-kind collection-kind-area" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 4.2 12.6 11.6H3.4z"/></svg>')):(r=document.createElement("span"),r.className="category-icon",uv(t,i),hv(r,i,bu(i.title)),r.title=i.icon||i.title);let s=document.createElement("span");s.className="category-name",s.textContent=i.title;let o=QX(`Show only ${i.title}`);o.dataset.onlyCollection=String(i.id);let a;e==="area"?(a=document.createElement("button"),a.type="button",a.className="label-toggle",a.dataset.labelToggle=String(i.id),a.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 3.5h9M8 3.5v9"/></svg>',x5(a,i)):e==="point"?(a=document.createElement("button"),a.type="button",a.className="label-toggle render-toggle",a.dataset.labelToggle=String(i.id),a.textContent="Tt",x5(a,i)):(a=document.createElement("span"),a.className="label-toggle-spacer");let l=document.createElement("span");return l.className="category-count",l.textContent=jl(YX(i)),t.append(n,r,s,o,a,l),t}function y5(i){if(O.collapsedSections.clear(),i)for(let e of ge.layers.querySelectorAll("[data-section]"))O.collapsedSections.add(e.dataset.section);XE()}function XE(){for(let i of ge.layers.querySelectorAll("[data-section]")){let e=O.collapsedSections.has(i.dataset.section);i.setAttribute("aria-expanded",String(!e)),i.closest(".layer-section").classList.toggle("is-collapsed",e)}Wl()}function JX(i){O.expandedCollections.has(i)?O.expandedCollections.delete(i):O.expandedCollections.add(i),e$()}function e$(){for(let i of ge.legend.querySelectorAll("[data-expand-collection]")){let e=O.expandedCollections.has(wu(i.dataset.expandCollection));i.setAttribute("aria-expanded",String(e)),i.closest(".category-row").classList.toggle("is-expanded",e)}for(let i of ge.legend.querySelectorAll(".feature-index"))i.hidden=!O.expandedCollections.has(wu(i.dataset.featureIndex));Wl()}function t$(i){let e=ZX(i);if(!e)return;let t=Zf(null,e)==="always"?"quiet":"always";t===bD(e)?O.labelOverrides.delete(e.id):O.labelOverrides.set(e.id,t),a0e(),e.kind==="point"?O.layers.pinLabels.changed():(m5(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed()),Wl()}function x5(i,e){let t=Zf(null,e)==="always",n=`${t?"Hide":"Display"} ${e.title} labels`;i.dataset.label=n,i.setAttribute("aria-label",n),i.title=n,i.setAttribute("aria-pressed",String(t))}function a0e(){for(let i of ge.legend.querySelectorAll("[data-label-toggle]")){let e=ZX(wu(i.dataset.labelToggle));e&&x5(i,e)}}function e2(i){if(O.hiddenCollections.clear(),!i)for(let e of O.world.sections)for(let t of e.collections)O.hiddenCollections.add(t.id);dA(),Op(),Nc(),nd(),ph()}function dA(){for(let i of document.querySelectorAll("[data-collection]"))i.checked=!O.hiddenCollections.has(wu(i.dataset.collection))}function n$(i){let e=O.world.sections.find(n=>n.key===i);if(!e)return;let t=e.collections.some(n=>!O.hiddenCollections.has(n.id));for(let n of e.collections)t?O.hiddenCollections.add(n.id):O.hiddenCollections.delete(n.id);dA(),Op(),Nc(),ph()}function i$(i){if(O.world){if(l0e(i)){e2(!0);return}O.hiddenCollections.clear();for(let e of O.world.sections){let t=i.section===e.key;for(let n of e.collections)!t&&i.collection!==n.id&&O.hiddenCollections.add(n.id)}dA(),Op(),Nc(),nd(),ph()}}function l0e(i){for(let e of O.world.sections)for(let t of e.collections)if((i.section===e.key||i.collection===t.id)===O.hiddenCollections.has(t.id))return!1;return!0}function c0e(){let i=ge.soloChip;if(!O.world){i.hidden=!0;return}let e=null,t=0,n=null,r=0;for(let o of O.world.sections){let a=0;for(let l of o.collections)O.hiddenCollections.has(l.id)||(a++,t++,e=l);a>0&&(r++,n=a===o.collections.length?o:null)}let s="";t===1&&e?s=e.title:r===1&&n&&(s=n.title),i.hidden=!s,i.textContent=s?`only: ${s}`:"",i.title=s?`Showing only ${s} \u2014 click to show everything`:""}function ph(){if(O.world){for(let i of O.world.sections){let e=ge.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.collections.some(t=>!O.hiddenCollections.has(t.id)))}c0e(),Wl()}}async function r$(i){let[e,t]=await Promise.all([fetch(`${O.volume.base}/worlds/${i.slug}.json`),fetch(`${O.volume.base}/worlds/${i.slug}.bin`)]);if(!e.ok||!t.ok)throw new Error(`world ${i.slug} is not served under this catalog any more`);let[n,r]=await Promise.all([e.json(),t.arrayBuffer()]),s=n.collections||[];u0e(r,s);let o=XX(s);return{...i,grid:n.grid,lenses:n.lenses,collections:s,collectionsById:new Map(s.map(a=>[a.id,a])),attrs:n.attrs||{},merged:n.merged||[],sections:o}}function u0e(i,e){let t=new DataView(i);if(String.fromCharCode(...new Uint8Array(i,0,8))!=="ATLASLOC")throw new Error("location payload is not in the expected form");let r=t.getUint16(8,!0);if(r!==3)throw new Error(`location payload is version ${r}, and this reads 3`);let s=t.getUint32(10,!0),o=16,a=new Int32Array(i,o,s),l=new Float32Array(i,o+=s*4,s),c=new Float32Array(i,o+=s*4,s),u=new Int32Array(i,o+=s*4,s),f=new Int32Array(i,o+=s*4,s),d=new Uint32Array(i,o+=s*4,s+1),A=new Uint16Array(i,o+=(s+1)*4,s),y=new Uint8Array(i,o+s*2),w=new TextDecoder;for(let S of e)S.kind==="point"&&(S.locations=[]);for(let S=0;S<s;S++){let T=e[A[S]];if(!T||T.kind!=="point")throw new Error(`location ${a[S]} names collection ${A[S]}, which is no point collection`);T.locations.push({id:a[S],title:w.decode(y.subarray(d[S],d[S+1])),lat:l[S],lng:c[S],memberId:u[S]||void 0,shard:f[S]||void 0})}}async function SN(){let i=`${O.volume.base}/${O.world.slug}`;return O.textByWorld.has(i)||O.textByWorld.set(i,fetch(`${O.volume.base}/worlds/${O.world.slug}.text`).then(e=>e.json()).catch(()=>({}))),O.textByWorld.get(i)}var $E=null;function yA(){return $E||($E=h0e().finally(()=>{$E=null})),$E}async function h0e(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=O.volume;if(O.catalog=await i.json(),qm(ge.volume,O.catalog.volumes,"title"),b5(),!O.catalog.volumes.length)return;let t=e&&O.catalog.volumes.find(n=>n.slug===e.slug);if(!t){let n=lv();await cd(n.volume||av()?.volume||O.catalog.volumes[0].slug,n.volume?n.world:void 0);return}if(t.stamp!==e.stamp){for(let r of O.textByWorld.keys())r.startsWith(e.base+"/")&&O.textByWorld.delete(r);let n=O.engine?.getView();O.restore={volume:t.slug,world:O.world?.slug,lens:O.world?O.world.lenses.indexOf(O.lens):0,center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...O.hiddenCollections],collapsed:[...O.collapsedSections],expanded:[...O.expandedCollections],labels:[...O.labelOverrides],overviewDocked:O.overviewDocked,dockFolded:O.dockFolded,dockDismissed:O.dockDismissed},await cd(t.slug,O.world?.slug);return}O.volume=t,ge.volume.value=t.slug}function b5(){let i=!O.catalog?.volumes?.length;ge.emptyState.hidden=!i,O.catalog?.bundlesDir&&(ge.emptyPath.textContent=O.catalog.bundlesDir)}async function w5(){for(let i of[ge.emptyOpen,ge.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await yA();let t=e.imported?.[0];t&&O.catalog.volumes.some(n=>n.slug===t)&&await cd(t)}finally{for(let i of[ge.emptyOpen,ge.addBundles])i.disabled=!1}}var vo={ADD:"add",REMOVE:"remove"};var s$={LENGTH:"length"},Av=class extends Ao{constructor(e,t,n){super(e),this.element=t,this.index=n}},S5=class extends Us{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e??[],this.unique_)for(let n=1,r=this.array_.length;n<r;++n)this.assertUnique_(this.array_[n],n);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,n=e.length;t<n;++t)this.push(e[t]);return this}forEach(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)e(t[n],n,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(s$.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new Av(vo.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)if(t[n]===e)return this.removeAt(n)}removeAt(e){if(e<0||e>=this.getLength())return;let t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new Av(vo.REMOVE,t,e)),t}setAt(e,t){let n=this.getLength();if(e>=n){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);let r=this.array_[e];this.array_[e]=t,this.dispatchEvent(new Av(vo.REMOVE,r,e)),this.dispatchEvent(new Av(vo.ADD,t,e))}updateLength_(){this.set(s$.LENGTH,this.array_.length)}assertUnique_(e,t){let n=this.array_;for(let r=0,s=n.length;r<s;++r)if(n[r]===e&&r!==t)throw new Error("Duplicate item added to a unique collection")}},Fo=S5;var T5=class extends Ao{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},Up=T5;var E5=class extends Up{constructor(e,t,n,r,s,o){super(e,t,s),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=r!==void 0?r:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},_h=E5;var gr={SINGLECLICK:"singleclick",CLICK:nn.CLICK,DBLCLICK:nn.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var t2={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var M5=class extends Cp{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;let n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=qn(n,t2.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=qn(n,t2.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(nn.TOUCHMOVE,this.boundHandleTouchMove_,cE?{passive:!1}:!1)}emulateClick_(e){let t=new _h(gr.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new _h(gr.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new _h(gr.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==gr.POINTERUP||t.type==gr.POINTERCANCEL){delete this.trackedTouches_[n];for(let r in this.trackedTouches_)if(this.trackedTouches_[r].target!==t.target){delete this.trackedTouches_[r];break}}else(t.type==gr.POINTERDOWN||t.type==gr.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new _h(gr.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(li),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);let t=new _h(gr.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){let n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(qn(n,gr.POINTERMOVE,this.handlePointerMove_,this),qn(n,gr.POINTERUP,this.handlePointerUp_,this),qn(this.element_,gr.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(qn(this.element_.getRootNode(),gr.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new _h(gr.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;let t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new _h(gr.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){let t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(li(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(nn.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(li(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(li),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},o$=M5;var xh={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var Bo={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var n2=1/0,C5=class{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,dh(this.queuedElements_)}dequeue(){let e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));let r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){jn(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let t=this.priorityFunction_(e);return t!=n2?(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){let t=this.elements_,n=this.priorities_,r=t.length,s=t[e],o=n[e],a=e;for(;e<r>>1;){let l=this.getLeftChildIndex_(e),c=this.getRightChildIndex_(e),u=c<r&&n[c]<n[l]?c:l;t[e]=t[u],n[e]=n[u],e=u}t[e]=s,n[e]=o,this.siftDown_(a,e)}siftDown_(e,t){let n=this.elements_,r=this.priorities_,s=n[t],o=r[t];for(;t>e;){let a=this.getParentIndex_(t);if(r[a]>o)n[t]=n[a],r[t]=r[a],t=a;else break}n[t]=s,r[t]=o}reprioritize(){let e=this.priorityFunction_,t=this.elements_,n=this.priorities_,r=0,s=t.length,o,a,l;for(a=0;a<s;++a)o=t[a],l=e(o),l==n2?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},a$=C5;var R5=class extends a${constructor(e,t){super(n=>e.apply(null,n),n=>n[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){let t=super.enqueue(e);return t&&e[0].addEventListener(nn.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===an.LOADED||n===an.ERROR||n===an.EMPTY){n!==an.ERROR&&t.removeEventListener(nn.CHANGE,this.boundHandleTileChange_);let r=t.getKey();r in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[r],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_<e&&n<t&&this.getCount()>0;){let r=this.dequeue()[0],s=r.getKey();r.getState()===an.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++n,r.load())}}},l$=R5;function c$(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return n2;if(!i.wantedTiles[t][e.getKey()])return n2;let s=i.viewState.center,o=n[0]-s[0],a=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}var so={ANIMATING:0,INTERACTING:1};var Uc={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function P5(i,e,t){return(function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;let l=e?0:s[0]*r,c=e?0:s[1]*r,u=a?a[0]:0,f=a?a[1]:0,d=i[0]+l/2+u,A=i[2]-l/2+u,y=i[1]+c/2+f,w=i[3]-c/2+f;d>A&&(d=(A+d)/2,A=d),y>w&&(y=(w+y)/2,w=y);let S=Si(n[0],d,A),T=Si(n[1],y,w);if(o&&t&&r){let R=30*r;S+=-R*Math.log(1+Math.max(0,d-n[0])/R)+R*Math.log(1+Math.max(0,n[0]-A)/R),T+=-R*Math.log(1+Math.max(0,y-n[1])/R)+R*Math.log(1+Math.max(0,n[1]-w)/R)}return[S,T]})}function u$(i){return i}function I5(i,e,t,n){let r=Kn(e)/t[0],s=Nr(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function L5(i,e,t){let n=Math.min(i,e),r=50;return n*=Math.log(1+r*Math.max(0,i/e-1))/r+1,t&&(n=Math.max(n,t),n/=Math.log(1+r*Math.max(0,t/i-1))/r+1),Si(n,t/2,e*2)}function h$(i,e,t,n){return e=e!==void 0?e:!0,(function(r,s,o,a){if(r!==void 0){let l=i[0],c=i[i.length-1],u=t?I5(l,t,o,n):l;if(a)return e?L5(r,u,c):Si(r,c,u);let f=Math.min(u,r),d=Math.floor(ev(i,f,s));return i[d]>u&&d<i.length-1?i[d+1]:i[d]}})}function f$(i,e,t,n,r,s){return n=n!==void 0?n:!0,t=t!==void 0?t:0,(function(o,a,l,c){if(o!==void 0){let u=r?I5(e,r,l,s):e;if(c)return n?L5(o,u,t):Si(o,t,u);let f=1e-9,d=Math.ceil(Math.log(e/u)/Math.log(i)-f),A=-a*(.5-f)+.5,y=Math.min(u,o),w=Math.floor(Math.log(e/y)/Math.log(i)+A),S=Math.max(d,w),T=e/Math.pow(i,S);return Si(T,t,u)}})}function D5(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?I5(i,n,a,r):i;return!t||!l?Si(s,e,c):L5(s,c,e)}})}function gv(i){if(i!==void 0)return 0}function N5(i){if(i!==void 0)return i}function d$(i){let e=2*Math.PI/i;return(function(t,n){if(n)return t;if(t!==void 0)return t=Math.floor(t/e+.5)*e,t})}function p$(i){let e=i===void 0?mu(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var F5=0,O5=class extends Us{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=nE(e.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,e.projection&&YW(),e.center&&(e.center=vu(e.center,this.projection_)),e.extent&&(e.extent=_u(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in Uc)delete t[a];this.setProperties(t,!0);let n=d0e(e);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=n.minZoom;let r=f0e(e),s=n.constraint,o=p0e(e);this.constraints_={center:r,resolution:s,rotation:o},this.setRotation(e.rotation!==void 0?e.rotation:0),this.setCenterInternal(e.center!==void 0?e.center:null),e.resolution!==void 0?this.setResolution(e.resolution):e.zoom!==void 0&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;let n=this.getCenterInternal();if(n){let r=e||[0,0,0,0];t=t||[0,0,0,0];let s=this.getResolution(),o=s/2*(r[3]-t[3]+t[1]-r[1]),a=s/2*(r[0]-t[0]+t[2]-r[2]);this.setCenterInternal([n[0]+o,n[1]-a])}}getUpdatedOptions_(e){let t=this.getProperties();return t.resolution!==void 0?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let t=new Array(arguments.length);for(let n=0;n<t.length;++n){let r=arguments[n];r.center&&(r=Object.assign({},r),r.center=vu(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=vu(r.anchor,this.getProjection())),t[n]=r}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,n;t>1&&typeof arguments[t-1]=="function"&&(n=arguments[t-1],--t);let r=0;for(;r<t&&!this.isDef();++r){let u=arguments[r];u.center&&this.setCenterInternal(u.center),u.zoom!==void 0?this.setZoom(u.zoom):u.resolution&&this.setResolution(u.resolution),u.rotation!==void 0&&this.setRotation(u.rotation)}if(r===t){n&&YE(n,!0);return}let s=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_,c=[];for(;r<t;++r){let u=arguments[r],f={start:s,complete:!1,anchor:u.anchor,duration:u.duration!==void 0?u.duration:1e3,easing:u.easing||_j,callback:n};if(u.center&&(f.sourceCenter=o,f.targetCenter=u.center.slice(),o=f.targetCenter),u.zoom!==void 0?(f.sourceResolution=a,f.targetResolution=this.getResolutionForZoom(u.zoom),a=f.targetResolution):u.resolution&&(f.sourceResolution=a,f.targetResolution=u.resolution,a=f.targetResolution),u.rotation!==void 0){f.sourceRotation=l;let d=fh(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+d,l=f.targetRotation}m0e(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(so.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[so.ANIMATING]>0}getInteracting(){return this.hints_[so.INTERACTING]>0}cancelAnimations(){this.setHint(so.ANIMATING,-this.hints_[so.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&YE(r[0].callback,!1),!e)for(let s=0,o=r.length;s<o;++s){let a=r[s];if(!a.complete){e=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let e=Date.now(),t=!1;for(let n=this.animations_.length-1;n>=0;--n){let r=this.animations_[n],s=!0;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l.complete)continue;let c=e-l.start,u=l.duration>0?c/l.duration:1;u>=1?(l.complete=!0,u=1):s=!1;let f=l.easing(u);if(l.sourceCenter){let d=l.sourceCenter[0],A=l.sourceCenter[1],y=l.targetCenter[0],w=l.targetCenter[1];this.nextCenter_=l.targetCenter;let S=d+f*(y-d),T=A+f*(w-A);this.targetCenter_=[S,T]}if(l.sourceResolution&&l.targetResolution){let d=f===1?l.targetResolution:l.sourceResolution+f*(l.targetResolution-l.sourceResolution);if(l.anchor){let A=this.getViewportSize_(this.getRotation()),y=this.constraints_.resolution(d,0,A,!0);this.targetCenter_=this.calculateCenterZoom(y,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){let d=f===1?fh(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+f*(l.targetRotation-l.sourceRotation);if(l.anchor){let A=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(A,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(s){this.animations_[n]=null,this.setHint(so.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&YE(o,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n,r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-t[0],r[1]-t[1]],X1(n,e-this.getRotation()),CW(n,t)),n}calculateCenterZoom(e,t){let n,r=this.getCenterInternal(),s=this.getResolution();if(r!==void 0&&s!==void 0){let o=t[0]-e*(t[0]-r[0])/s,a=t[1]-e*(t[1]-r[1])/s;n=[o,a]}return n}getViewportSize_(e){let t=this.viewportSize_;if(e){let n=t[0],r=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(r*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let e=this.getCenterInternal();return e&&Ry(e,this.getProjection())}getCenterInternal(){return this.get(Uc.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){let t=this.calculateExtentInternal(e);return Sp(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();jn(t,"The view center is not defined");let n=this.getResolution();jn(n!==void 0,"The view resolution is not defined");let r=this.getRotation();return jn(r!==void 0,"The view rotation is not defined"),Ty(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(Uc.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(_u(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=Kn(e)/t[0],r=Nr(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e=e||2;let t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(s){return t/Math.pow(e,s*r)})}getRotation(){return this.get(Uc.ROTATION)}getValueForResolutionFunction(e){let t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,s=Math.log(n/r)/t;return(function(o){return Math.log(n/o)/t/s})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e),n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){let e=this.getProjection(),t=this.getResolution(),n=this.getRotation(),r=this.getCenterInternal(),s=this.padding_;if(s){let o=this.getViewportSizeMinusPadding_();r=B5(r,this.getViewportSize_(),[o[0]/2+s[3],o[1]/2+s[0]],t,n)}return{center:r.slice(0),projection:e!==void 0?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e,t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,r;if(this.resolutions_){let s=ev(this.resolutions_,e,1);t=s,n=this.resolutions_[s],s==this.resolutions_.length-1?r=2:r=n/this.resolutions_[s+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=Si(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,Si(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(jn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){jn(!hh(e),"Cannot fit empty extent provided as `geometry`");let r=_u(e,this.getProjection());n=DN(r)}else if(e.getType()==="Circle"){let r=_u(e.getExtent(),this.getProjection());n=DN(r),n.rotate(this.getRotation(),dl(r))}else{let r=rA();r?n=e.clone().transform(r,this.getProjection()):n=e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),s=e.getFlatCoordinates(),o=e.getStride(),a=1/0,l=1/0,c=-1/0,u=-1/0;for(let f=0,d=s.length;f<d;f+=o){let A=s[f]*n-s[f+1]*r,y=s[f]*r+s[f+1]*n;a=Math.min(a,A),l=Math.min(l,y),c=Math.max(c,A),u=Math.max(u,y)}return[a,l,c,u]}fitInternal(e,t){t=t||{};let n=t.size;n||(n=this.getViewportSizeMinusPadding_());let r=t.padding!==void 0?t.padding:[0,0,0,0],s=t.nearest!==void 0?t.nearest:!1,o;t.minResolution!==void 0?o=t.minResolution:t.maxZoom!==void 0?o=this.getResolutionForZoom(t.maxZoom):o=0;let a=this.rotatedExtentForGeometry(e),l=this.getResolutionForExtentInternal(a,[n[0]-r[1]-r[3],n[1]-r[0]-r[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,s?0:1);let c=this.getRotation(),u=Math.sin(c),f=Math.cos(c),d=dl(a);d[0]+=(r[1]-r[3])/2*l,d[1]+=(r[0]-r[2])/2*l;let A=d[0]*f-d[1]*u,y=d[1]*f+d[0]*u,w=this.getConstrainedCenter([A,y],l),S=t.callback?t.callback:td;t.duration!==void 0?this.animateInternal({resolution:l,center:w,duration:t.duration,easing:t.easing},S):(this.targetResolution_=l,this.targetCenter_=w,this.applyTargetState_(!1,!0),YE(S,!0))}centerOn(e,t,n){this.centerOnInternal(vu(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(B5(e,t,n,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,n,r){let s,o=this.padding_;if(o&&e){let a=this.getViewportSizeMinusPadding_(-n),l=B5(e,r,[a[0]/2+o[3],a[1]/2+o[0]],t,n);s=[e[0]-l[0],e[1]-l[1]]}return s}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){let t=Ry(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){let t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&vu(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*e,0,r,n);t&&(this.targetCenter_=this.calculateCenterZoom(s,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=vu(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+e,n);t&&(this.targetCenter_=this.calculateCenterRotate(r,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&vu(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){let n=this.getAnimating()||this.getInteracting()||t,r=this.constraints_.rotation(this.targetRotation_,n),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,0,s,n),a=this.constraints_.center(this.targetCenter_,o,s,n,this.calculateCenterShift(this.targetCenter_,o,r,s));this.get(Uc.ROTATION)!==r&&this.set(Uc.ROTATION,r),this.get(Uc.RESOLUTION)!==o&&(this.set(Uc.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Uc.CENTER)||!eA(this.get(Uc.CENTER),a))&&this.set(Uc.CENTER,a),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,n){e=e!==void 0?e:200;let r=t||0,s=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(s),a=this.constraints_.resolution(this.targetResolution_,r,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,s,o));if(e===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=s,this.targetCenter_=l,this.applyTargetState_();return}n=n||(e===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==s||!this.getCenterInternal()||!eA(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:Lc,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(so.INTERACTING,1)}endInteraction(e,t,n){n=n&&vu(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(so.INTERACTING,-1),this.resolveConstraints(e,t,n))}getConstrainedCenter(e,t){let n=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),n)}getConstrainedZoom(e,t){let n=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(n,t))}getConstrainedResolution(e,t){t=t||0;let n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,n)}};function YE(i,e){setTimeout(function(){i(e)},0)}function f0e(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return P5(i.extent,i.constrainOnlyCenter,t)}let e=nE(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,P5(t,!1,!1)}return u$}function d0e(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:F5,a=i.maxZoom!==void 0?i.maxZoom:28,l=i.zoomFactor!==void 0?i.zoomFactor:2,c=i.multiWorld!==void 0?i.multiWorld:!1,u=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,f=i.showFullExtent!==void 0?i.showFullExtent:!1,d=nE(i.projection,"EPSG:3857"),A=d.getExtent(),y=i.constrainOnlyCenter,w=i.extent;if(!c&&!w&&d.isGlobal()&&(y=!1,w=A),i.resolutions!==void 0){let S=i.resolutions;t=S[o],n=S[a]!==void 0?S[a]:S[S.length-1],i.constrainResolution?e=h$(S,u,!y&&w,f):e=D5(t,n,u,!y&&w,f)}else{let T=(A?Math.max(Kn(A),Nr(A)):360*Kf.degrees/d.getMetersPerUnit())/256/Math.pow(2,F5),R=T/Math.pow(2,28-F5);t=i.maxResolution,t!==void 0?o=0:t=T/Math.pow(l,o),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=t/Math.pow(l,a):n=T/Math.pow(l,a):n=R),a=o+Math.floor(Math.log(t/n)/Math.log(l)),n=t/Math.pow(l,a-o),i.constrainResolution?e=f$(l,t,n,u,!y&&w,f):e=D5(t,n,u,!y&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function p0e(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?p$():t===!1?N5:typeof t=="number"?d$(t):N5}return gv}function m0e(i){return!(i.sourceCenter&&i.targetCenter&&!eA(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function B5(i,e,t,n,r){let s=Math.cos(-r),o=Math.sin(-r),a=i[0]*s-i[1]*o,l=i[1]*s+i[0]*o;a+=(e[0]/2-t[0])*n,l+=(t[1]-e[1]/2)*n,o=-o;let c=a*s-l*o,u=l*s+a*o;return[c,u]}var Xl=O5;var U5=class extends Us{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let t=0,n=this.listenerKeys.length;t<n;++t)li(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=e,e){let t=this.target_??e.getOverlayContainerStopEvent();this.element&&t.appendChild(this.element),this.render!==td&&this.listenerKeys.push(qn(e,xh.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},vv=U5;var k5=class extends vv{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=e.collapsed!==void 0?e.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible!==void 0?e.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;let t=e.className!==void 0?e.className:"ol-attribution",n=e.tipLabel!==void 0?e.tipLabel:"Attributions",r=e.expandClassName!==void 0?e.expandClassName:t+"-expand",s=e.collapseLabel!==void 0?e.collapseLabel:"\u203A",o=e.collapseClassName!==void 0?e.collapseClassName:t+"-collapse";typeof s=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=o):this.collapseLabel_=s;let a=e.label!==void 0?e.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=r):this.label_=a;let l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(nn.CLICK,this.handleClick_.bind(this),!1);let c=t+" "+Np+" "+fv+(this.collapsed_&&this.collapsible_?" "+XN:"")+(this.collapsible_?"":" ol-uncollapsible"),u=this.element;u.className=c,u.appendChild(this.toggleButton_),u.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){let t=this.getMap().getAllLayers(),n=new Set(t.flatMap(r=>r.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(r=>n.add(r)):n.add(this.attributions_)),!this.overrideCollapsible_){let r=!t.some(s=>s.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(r)}return Array.from(n)}async updateElement_(e){if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}let t=await Promise.all(this.collectSourceAttributions_(e).map(r=>pj(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!ta(t,this.renderedAttributions_)){yj(this.ulElement_);for(let r=0,s=t.length;r<s;++r){let o=document.createElement("li");o.innerHTML=t[r],this.ulElement_.appendChild(o)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(XN),this.collapsed_?tN(this.collapseLabel_,this.label_):tN(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,!(!this.collapsible_||this.collapsed_===e)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}},m$=k5;var z5=class extends vv{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});let t=e.className!==void 0?e.className:"ol-rotate",n=e.label!==void 0?e.label:"\u21E7",r=e.compassClassName!==void 0?e.compassClassName:"ol-compass";this.label_=null,typeof n=="string"?(this.label_=document.createElement("span"),this.label_.className=r,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(r));let s=e.tipLabel?e.tipLabel:"Reset rotation",o=document.createElement("button");o.className=t+"-reset",o.setAttribute("type","button"),o.title=s,o.appendChild(this.label_),o.addEventListener(nn.CLICK,this.handleClick_.bind(this),!1);let a=t+" "+Np+" "+fv,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration!==void 0?e.duration:250,this.autoHide_=e.autoHide!==void 0?e.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Ky)}handleClick_(e){e.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){let t=this.getMap().getView();if(!t)return;let n=t.getRotation();n!==void 0&&(this.duration_>0&&n%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:Lc}):t.setRotation(0))}render(e){let t=e.frameState;if(!t)return;let n=t.viewState.rotation;if(n!=this.rotation_){let r="rotate("+n+"rad)";if(this.autoHide_){let s=this.element.classList.contains(Ky);!s&&n===0?this.element.classList.add(Ky):s&&n!==0&&this.element.classList.remove(Ky)}this.label_.style.transform=r}this.rotation_=n}},A$=z5;var V5=class extends vv{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});let t=e.className!==void 0?e.className:"ol-zoom",n=e.delta!==void 0?e.delta:1,r=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",s=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",o=e.zoomInLabel!==void 0?e.zoomInLabel:"+",a=e.zoomOutLabel!==void 0?e.zoomOutLabel:"\u2013",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",c=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=l,u.appendChild(typeof o=="string"?document.createTextNode(o):o),u.addEventListener(nn.CLICK,this.handleClick_.bind(this,n),!1);let f=document.createElement("button");f.className=s,f.setAttribute("type","button"),f.title=c,f.appendChild(typeof a=="string"?document.createTextNode(a):a),f.addEventListener(nn.CLICK,this.handleClick_.bind(this,-n),!1);let d=t+" "+Np+" "+fv,A=this.element;A.className=d,A.appendChild(u),A.appendChild(f),this.duration_=e.duration!==void 0?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){let n=this.getMap().getView();if(!n)return;let r=n.getZoom();if(r!==void 0){let s=n.getConstrainedZoom(r+e);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:s,duration:this.duration_,easing:Lc})):n.setZoom(s)}}},g$=V5;function ZE(i){i=i||{};let e=new Fo;return(i.zoom===void 0||i.zoom)&&e.push(new g$(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new A$(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new m$(i.attributionOptions)),e}var G5=class{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;let e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let n=t-3;for(;n>0&&this.points_[n+2]>e;)n-=3;let r=this.points_[t+2]-this.points_[n+2];if(r<1e3/60)return!1;let s=this.points_[t]-this.points_[n],o=this.points_[t+1]-this.points_[n+1];return this.angle_=Math.atan2(o,s),this.initialVelocity_=Math.sqrt(s*s+o*o)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},v$=G5;var q5={ACTIVE:"active"};var H5=class extends Us{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(q5.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(q5.ACTIVE,e)}setMap(e){this.map_=e}};function _$(i,e,t){let n=i.getCenterInternal();if(n){let r=[n[0]+e[0],n[1]+e[1]];i.animateInternal({duration:t!==void 0?t:250,easing:xj,center:i.getConstrainedCenter(r)})}}function _v(i,e,t,n){let r=i.getZoom();if(r===void 0)return;let s=i.getConstrainedZoom(r+e),o=i.getResolutionForZoom(s);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:o,anchor:t,duration:n!==void 0?n:250,easing:Lc})}var yh=H5;var W5=class extends yh{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:250}handleEvent(e){let t=!1;if(e.type==gr.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();_v(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},x$=W5;function i2(i){let e=arguments;return function(t){let n=!0;for(let r=0,s=e.length;r<s&&(n=n&&e[r](t),!!n);++r);return n}}var y$=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},A0e=function(i){let e=i.map.getTargetElement(),t=e.getRootNode(),n=i.map.getOwnerDocument().activeElement;return t instanceof ShadowRoot?t.host.contains(n):e.contains(n)},KE=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?A0e(i):!0},b$=Jf;var QE=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(mj&&ZD&&e.ctrlKey)};var JE=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var w$=function(i){let e=i.originalEvent;return ZD?e.metaKey:e.ctrlKey},S$=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},e3=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},t3=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var T$=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var j5=class extends yh{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==gr.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==gr.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==gr.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==gr.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};function xv(i){let e=i.length,t=0,n=0;for(let r=0;r<e;r++)t+=i[r].clientX,n+=i[r].clientY;return{clientX:t/e,clientY:n/e}}var bh=j5;var X5=class extends bh{constructor(e){super({stopDown:ed}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:i2(JE,T$);this.condition_=e.onFocusOnly?i2(KE,t):t,this.noKinetic_=!1}handleDragEvent(e){let t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());let n=this.targetPointers,r=t.getEventPixel(xv(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){let s=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],a=e.map.getView();RW(s,a.getResolution()),X1(s,a.getRotation()),a.adjustCenterInternal(s)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=n.length,e.originalEvent.preventDefault()}handleUpEvent(e){let t=e.map,n=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){let r=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),o=n.getCenterInternal(),a=t.getPixelFromCoordinateInternal(o),l=t.getCoordinateFromPixelInternal([a[0]-r*Math.cos(s),a[1]-r*Math.sin(s)]);n.animateInternal({center:n.getConstrainedCenter(l),duration:500,easing:Lc})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){let n=e.map.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},E$=X5;var $5=class extends bh{constructor(e){e=e||{},super({stopDown:ed}),this.condition_=e.condition?e.condition:y$,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!t3(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===gv)return;let r=t.getSize(),s=e.pixel,o=Math.atan2(r[1]/2-s[1],s[0]-r[0]/2);if(this.lastAngle_!==void 0){let a=o-this.lastAngle_;n.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(e){return t3(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return t3(e)&&QE(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},M$=$5;var Y5=class extends Mp{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){let e=this.startPixel_,t=this.endPixel_,n="px",r=this.element_.style;r.left=Math.min(e[0],t[0])+n,r.top=Math.min(e[1],t[1])+n,r.width=Math.abs(t[0]-e[0])+n,r.height=Math.abs(t[1]-e[1])+n}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);let t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;let e=this.startPixel_,t=this.endPixel_,r=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new Ah([r])}getGeometry(){return this.geometry_}},C$=Y5;var yv={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},bA=class extends Ao{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},Z5=class extends bh{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new C$(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??QE,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){let r=n[0]-t[0],s=n[1]-t[1];return r*r+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new bA(yv.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;let t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new bA(t?yv.BOXEND:yv.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new bA(yv.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new bA(yv.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new bA(yv.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},R$=Z5;var K5=class extends R${constructor(e){e=e||{};let t=e.condition?e.condition:S$;super({condition:t,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=e.duration!==void 0?e.duration:200,this.out_=e.out!==void 0?e.out:!1}onBoxEnd(e){let n=this.getMap().getView(),r=this.getGeometry();if(this.out_){let s=n.rotatedExtentForGeometry(r),o=n.getResolutionForExtentInternal(s),a=n.getResolution()/o;r=r.clone(),r.scale(a*a)}n.fitInternal(r,{duration:this.duration_,easing:Lc})}},P$=K5;var kp={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var Q5=class extends yh{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return JE(t)&&e3(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==nn.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==kp.DOWN||r==kp.LEFT||r==kp.RIGHT||r==kp.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==kp.DOWN?c=-a:r==kp.LEFT?l=-a:r==kp.RIGHT?l=a:c=a;let u=[l,c];X1(u,o.getRotation()),_$(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},I$=Q5;var J5=class extends yh{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!w$(t)&&e3(t)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:100}handleEvent(e){let t=!1;if(e.type==nn.KEYDOWN||e.type==nn.KEYPRESS){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==="+"||r==="-")){let s=e.map,o=r==="+"?this.delta_:-this.delta_,a=s.getView();_v(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},L$=J5;var g0e=40,v0e=300,_0e=3,e6=class extends yh{constructor(e){e=e||{},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta!==void 0?e.maxDelta:1,this.duration_=e.duration!==void 0?e.duration:250,this.timeout_=e.timeout!==void 0?e.timeout:80,this.useAnchor_=e.useAnchor!==void 0?e.useAnchor:!0,this.constrainResolution_=e.constrainResolution!==void 0?e.constrainResolution:!1;let t=e.condition?e.condition:b$;this.condition_=e.onFocusOnly?i2(KE,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(e){if(this.ctrlKeyListenerKeys_.forEach(li),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(qn(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),qn(t,"keyup",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;let e=this.getMap();if(!e)return;let t=e.getView(),n=this.lastDelta_?this.lastDelta_>0?1:-1:0;t.endInteraction(this.constrainResolution_||t.getConstrainResolution()?100:void 0,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==nn.WHEEL)return!0;let n=e.map,r=e.originalEvent;r.preventDefault();let s=r.ctrlKey&&!this.ctrlKeyPressed_;r.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=e.pixel);let o=r.deltaY;switch(r.deltaMode){case WheelEvent.DOM_DELTA_LINE:o*=g0e;break;case WheelEvent.DOM_DELTA_PAGE:o*=v0e;break;default:}if(o===0)return!1;this.lastDelta_=o;let a=Date.now();this.startTime_===void 0&&(this.startTime_=a),(!this.mode_||a-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(o)<4?"trackpad":"wheel");let l=n.getView();if(this.mode_==="trackpad")return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(l.getAnimating()&&l.cancelAnimations(),l.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s&&(o=o*_0e),l.adjustZoom(-o/this.deltaPerZoom_,this.lastAnchor_?n.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=a,!1;this.totalDelta_+=o;let c=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),c),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-Si(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),_v(t,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}},D$=e6;var t6=class extends bh{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=ed),super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold!==void 0?e.threshold:.3,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){let t=0,n=this.targetPointers[0],r=this.targetPointers[1],s=Math.atan2(r.clientY-n.clientY,r.clientX-n.clientX);if(this.lastAngle_!==void 0){let l=s-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=l}this.lastAngle_=s;let o=e.map,a=o.getView();a.getConstraints().rotation!==gv&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(xv(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},N$=t6;var n6=class extends bh{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=ed),super(t),this.anchor_=null,this.duration_=e.duration!==void 0?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1,n=this.targetPointers[0],r=this.targetPointers[1],s=n.clientX-r.clientX,o=n.clientY-r.clientY,a=Math.sqrt(s*s+o*o);this.lastDistance_!==void 0&&(t=this.lastDistance_/a),this.lastDistance_=a;let l=e.map,c=l.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(xv(this.targetPointers))),l.render(),c.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){let n=e.map.getView(),r=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,r),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},F$=n6;function n3(i){i=i||{};let e=new Fo,t=new v$(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new M$),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new x$({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new E$({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new N$),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new F$({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new I$),e.push(new L$({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new D$({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new P$({duration:i.zoomDuration})),e}var Ni={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var i6=class extends Us{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[Ni.OPACITY]=e.opacity!==void 0?e.opacity:1,jn(typeof t[Ni.OPACITY]=="number","Layer opacity must be a number"),t[Ni.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ni.Z_INDEX]=e.zIndex,t[Ni.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ni.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ni.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ni.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0?!0:e},n=this.getZIndex();return t.opacity=Si(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return ei()}getLayerStatesArray(e){return ei()}getExtent(){return this.get(Ni.EXTENT)}getMaxResolution(){return this.get(Ni.MAX_RESOLUTION)}getMinResolution(){return this.get(Ni.MIN_RESOLUTION)}getMinZoom(){return this.get(Ni.MIN_ZOOM)}getMaxZoom(){return this.get(Ni.MAX_ZOOM)}getOpacity(){return this.get(Ni.OPACITY)}getSourceState(){return ei()}getVisible(){return this.get(Ni.VISIBLE)}getZIndex(){return this.get(Ni.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ni.EXTENT,e)}setMaxResolution(e){this.set(Ni.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ni.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ni.MAX_ZOOM,e)}setMinZoom(e){this.set(Ni.MIN_ZOOM,e)}setOpacity(e){jn(typeof e=="number","Layer opacity must be a number"),this.set(Ni.OPACITY,e)}setVisible(e){this.set(Ni.VISIBLE,e)}setZIndex(e){this.set(Ni.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},i3=i6;var zp={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Su=class extends Ao{constructor(e,t){super(e),this.layer=t}},r6={LAYERS:"layers"},s6=class i extends i3{constructor(e){e=e||{};let t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(r6.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new Fo(n.slice(),{unique:!0}):jn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new Fo(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(li),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(qn(e,vo.ADD,this.handleLayersAdd_,this),qn(e,vo.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(li);dh(this.listenerKeys_);let t=e.getArray();for(let n=0,r=t.length;n<r;n++){let s=t[n];this.registerLayerListeners_(s),this.dispatchEvent(new Su(zp.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[qn(e,xu.PROPERTYCHANGE,this.handleLayerChange_,this),qn(e,nn.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(qn(e,zp.ADDLAYER,this.handleLayerGroupAdd_,this),qn(e,zp.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Bn(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Su(zp.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Su(zp.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Su(zp.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=Bn(t);this.listenerKeys_[n].forEach(li),delete this.listenerKeys_[n],this.dispatchEvent(new Su(zp.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(r6.LAYERS)}setLayers(e){let t=this.getLayers();if(t){let n=t.getArray();for(let r=0,s=n.length;r<s;++r)this.dispatchEvent(new Su(zp.REMOVELAYER,n[r]))}this.set(r6.LAYERS,e)}getLayersArray(e){return e=e!==void 0?e:[],this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){let t=e!==void 0?e:[],n=t.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(t)});let r=this.getLayerState(),s=r.zIndex;!e&&r.zIndex===void 0&&(s=0);for(let o=n,a=t.length;o<a;o++){let l=t[o];l.opacity*=r.opacity,l.visible=l.visible&&r.visible,l.maxResolution=Math.min(l.maxResolution,r.maxResolution),l.minResolution=Math.max(l.minResolution,r.minResolution),l.minZoom=Math.max(l.minZoom,r.minZoom),l.maxZoom=Math.min(l.maxZoom,r.maxZoom),r.extent!==void 0&&(l.extent!==void 0?l.extent=uh(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},r2=s6;var Oo={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var o6=class extends i3{constructor(e){let t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(Ni.SOURCE,this.handleSourcePropertyChange_);let n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(Ni.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(li(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=qn(e,nn.CHANGE,this.handleSourceChange_,this),e.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,n=this.getMapInternal();!e&&n&&(e=n.getView()),e instanceof Xl?t={viewState:e.getState(),extent:e.calculateExtent()}:t=e,!t.layerStatesArray&&n&&(t.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let r;if(t.layerStatesArray){if(r=t.layerStatesArray.find(o=>o.layer===this),!r)return!1}else r=this.getLayerState();let s=this.getExtent();return s2(r,t.viewState)&&(!s||Ar(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof Xl?e.getViewStateAndExtent():e,r=t(n);return Array.isArray(r)||(r=[r]),r}render(e,t){let n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(Ni.MAP,e)}getMapInternal(){return this.get(Ni.MAP)}setMap(e){this.mapPrecomposeKey_&&(li(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(li(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=qn(e,Oo.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=qn(this,nn.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);jn(!t.some(r=>r.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(Ni.SOURCE,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function s2(i,e){if(!i.visible)return!1;let t=e.resolution;if(t<i.minResolution||t>=i.maxResolution)return!1;let n=e.zoom;return n>i.minZoom&&n<=i.maxZoom}var wA=o6;function r3(i,e,t=0,n=i.length-1,r=x0e){for(;n>t;){if(n-t>600){let l=n-t+1,c=e-t+1,u=Math.log(l),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1),A=Math.max(t,Math.floor(e-c*f/l+d)),y=Math.min(n,Math.floor(e+(l-c)*f/l+d));r3(i,e,A,y,r)}let s=i[e],o=t,a=n;for(o2(i,t,e),r(i[n],s)>0&&o2(i,t,n);o<a;){for(o2(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?o2(i,t,a):(a++,o2(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function o2(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function x0e(i,e){return i<e?-1:i>e?1:0}var SA=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,n=[];if(!o3(e,t))return n;let r=this.toBBox,s=[];for(;t;){for(let o=0;o<t.children.length;o++){let a=t.children[o],l=t.leaf?r(a):a;o3(e,l)&&(t.leaf?n.push(a):l6(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!o3(e,t))return!1;let n=[];for(;t;){for(let r=0;r<t.children.length;r++){let s=t.children[r],o=t.leaf?this.toBBox(s):s;if(o3(e,o)){if(t.leaf||l6(e,o))return!0;n.push(s)}}t=n.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let n=0;n<e.length;n++)this.insert(e[n]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){let n=this.data;this.data=t,t=n}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=wv([]),this}remove(e,t){if(!e)return this;let n=this.data,r=this.toBBox(e),s=[],o=[],a,l,c;for(;n||s.length;){if(n||(n=s.pop(),l=s[s.length-1],a=o.pop(),c=!0),n.leaf){let u=y0e(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&l6(n,r)?(s.push(n),o.push(a),a=0,l=n,n=n.children[0]):l?(a++,n=l.children[a],c=!1):n=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){let n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,r){let s=n-t+1,o=this._maxEntries,a;if(s<=o)return a=wv(e.slice(t,n+1)),bv(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=wv([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));B$(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);B$(e,u,f,l,this.compareMinY);for(let d=u;d<=f;d+=l){let A=Math.min(d+l-1,f);a.children.push(this._build(e,d,A,r-1))}}return bv(a,this.toBBox),a}_chooseSubtree(e,t,n,r){for(;r.push(t),!(t.leaf||r.length-1===n);){let s=1/0,o=1/0,a;for(let l=0;l<t.children.length;l++){let c=t.children[l],u=a6(c),f=S0e(e,c)-u;f<o?(o=f,s=u<s?u:s,a=c):f===o&&u<s&&(s=u,a=c)}t=a||t.children[0]}return t}_insert(e,t,n){let r=n?e:this.toBBox(e),s=[],o=this._chooseSubtree(r,this.data,t,s);for(o.children.push(e),l2(o,r);t>=0&&s[t].children.length>this._maxEntries;)this._split(s,t),t--;this._adjustParentBBoxes(r,s,t)}_split(e,t){let n=e[t],r=n.children.length,s=this._minEntries;this._chooseSplitAxis(n,s,r);let o=this._chooseSplitIndex(n,s,r),a=wv(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,bv(n,this.toBBox),bv(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=wv([e,t]),this.data.height=e.height+1,this.data.leaf=!1,bv(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,s=1/0,o=1/0;for(let a=t;a<=n-t;a++){let l=a2(e,0,a,this.toBBox),c=a2(e,a,n,this.toBBox),u=T0e(l,c),f=a6(l)+a6(c);u<s?(s=u,r=a,o=f<o?f:o):u===s&&f<o&&(o=f,r=a)}return r||n-t}_chooseSplitAxis(e,t,n){let r=e.leaf?this.compareMinX:b0e,s=e.leaf?this.compareMinY:w0e,o=this._allDistMargin(e,t,n,r),a=this._allDistMargin(e,t,n,s);o<a&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);let s=this.toBBox,o=a2(e,0,t,s),a=a2(e,n-t,n,s),l=s3(o)+s3(a);for(let c=t;c<n-t;c++){let u=e.children[c];l2(o,e.leaf?s(u):u),l+=s3(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];l2(a,e.leaf?s(u):u),l+=s3(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)l2(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():bv(e[t],this.toBBox)}};function y0e(i,e,t){if(!t)return e.indexOf(i);for(let n=0;n<e.length;n++)if(t(i,e[n]))return n;return-1}function bv(i,e){a2(i,0,i.children.length,e,i)}function a2(i,e,t,n,r){r||(r=wv(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<t;s++){let o=i.children[s];l2(r,i.leaf?n(o):o)}return r}function l2(i,e){return i.minX=Math.min(i.minX,e.minX),i.minY=Math.min(i.minY,e.minY),i.maxX=Math.max(i.maxX,e.maxX),i.maxY=Math.max(i.maxY,e.maxY),i}function b0e(i,e){return i.minX-e.minX}function w0e(i,e){return i.minY-e.minY}function a6(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function s3(i){return i.maxX-i.minX+(i.maxY-i.minY)}function S0e(i,e){return(Math.max(e.maxX,i.maxX)-Math.min(e.minX,i.minX))*(Math.max(e.maxY,i.maxY)-Math.min(e.minY,i.minY))}function T0e(i,e){let t=Math.max(i.minX,e.minX),n=Math.max(i.minY,e.minY),r=Math.min(i.maxX,e.maxX),s=Math.min(i.maxY,e.maxY);return Math.max(0,r-t)*Math.max(0,s-n)}function l6(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function o3(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function wv(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function B$(i,e,t,n,r){let s=[e,t];for(;s.length;){if(t=s.pop(),e=s.pop(),t-e<=n)continue;let o=e+Math.ceil((t-e)/n/2)*n;r3(i,o,e,t,r),s.push(e,o,o,t)}}var EA=0,l3=0,ra=1<<EA++,ci=1<<EA++,sa=1<<EA++,La=1<<EA++,hd=1<<EA++,TA=1<<EA++,c3=Math.pow(2,EA)-1,u6={[ra]:"boolean",[ci]:"number",[sa]:"string",[La]:"color",[hd]:"number[]",[TA]:"size"},E0e=Object.keys(u6).map(Number).sort(pl);function M0e(i){return i in u6}function ud(i){let e=[];for(let t of E0e)c2(i,t)&&e.push(u6[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function c2(i,e){return(i&e)===e}function a3(i,e){return!!(i&e)}function Vp(i,e){return i===e}var $r=class{constructor(e,t){if(!M0e(e))throw new Error(`literal expressions must have a specific type, got ${ud(e)}`);this.type=e,this.value=t}},u3=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function h3(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function hs(i,e,t){switch(typeof i){case"boolean":{if(Vp(e,sa))return new $r(sa,i?"true":"false");if(!c2(e,ra))throw new Error(`got a boolean, but expected ${ud(e)}`);return new $r(ra,i)}case"number":{if(Vp(e,TA))return new $r(TA,cs(i));if(Vp(e,ra))return new $r(ra,!!i);if(Vp(e,sa))return new $r(sa,i.toString());if(!c2(e,ci))throw new Error(`got a number, but expected ${ud(e)}`);return new $r(ci,i)}case"string":{if(Vp(e,La))return new $r(La,$y(i));if(Vp(e,ra))return new $r(ra,!!i);if(!c2(e,sa))throw new Error(`got a string, but expected ${ud(e)}`);return new $r(sa,i)}default:}if(!Array.isArray(i))throw new Error("expression must be an array or a primitive value");if(i.length===0)throw new Error("empty expression");if(typeof i[0]=="string")return k0e(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Vp(e,TA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new $r(TA,i)}if(Vp(e,La)){if(i.length===3)return new $r(La,[...i,1]);if(i.length===4)return new $r(La,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!c2(e,hd))throw new Error(`got an array of numbers, but expected ${ud(e)}`);return new $r(hd,i)}var et={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},C0e={[et.Get]:Un(ti(1,1/0),O$),[et.Var]:R0e(),[et.Has]:Un(ti(1,1/0),O$),[et.Id]:Un(P0e,Sv),[et.Concat]:Un(ti(2,1/0),Qi(sa)),[et.GeometryType]:Un(I0e,Sv),[et.LineMetric]:Un(L0e,Sv),[et.Resolution]:Un(c6,Sv),[et.Zoom]:Un(c6,Sv),[et.Time]:Un(c6,Sv),[et.Any]:Un(ti(2,1/0),Qi(ra)),[et.All]:Un(ti(2,1/0),Qi(ra)),[et.Not]:Un(ti(1,1),Qi(ra)),[et.Equal]:Un(ti(2,2),k$()),[et.NotEqual]:Un(ti(2,2),k$()),[et.GreaterThan]:Un(ti(2,2),Qi(ci)),[et.GreaterThanOrEqualTo]:Un(ti(2,2),Qi(ci)),[et.LessThan]:Un(ti(2,2),Qi(ci)),[et.LessThanOrEqualTo]:Un(ti(2,2),Qi(ci)),[et.Multiply]:Un(ti(2,1/0),U$),[et.Coalesce]:Un(ti(2,1/0),U$),[et.Divide]:Un(ti(2,2),Qi(ci)),[et.Add]:Un(ti(2,1/0),Qi(ci)),[et.Subtract]:Un(ti(2,2),Qi(ci)),[et.Clamp]:Un(ti(3,3),Qi(ci)),[et.Mod]:Un(ti(2,2),Qi(ci)),[et.Pow]:Un(ti(2,2),Qi(ci)),[et.Abs]:Un(ti(1,1),Qi(ci)),[et.Floor]:Un(ti(1,1),Qi(ci)),[et.Ceil]:Un(ti(1,1),Qi(ci)),[et.Round]:Un(ti(1,1),Qi(ci)),[et.Sin]:Un(ti(1,1),Qi(ci)),[et.Cos]:Un(ti(1,1),Qi(ci)),[et.Atan]:Un(ti(1,2),Qi(ci)),[et.Sqrt]:Un(ti(1,1),Qi(ci)),[et.Match]:Un(ti(4,1/0),z$,N0e),[et.Between]:Un(ti(3,3),Qi(ci)),[et.Interpolate]:Un(ti(6,1/0),z$,F0e),[et.Case]:Un(ti(3,1/0),D0e,B0e),[et.In]:Un(ti(2,2),O0e),[et.Number]:Un(ti(1,1/0),Qi(c3)),[et.String]:Un(ti(1,1/0),Qi(c3)),[et.Array]:Un(ti(1,1/0),Qi(ci)),[et.Color]:Un(ti(1,4),Qi(ci)),[et.Band]:Un(ti(1,3),Qi(ci)),[et.Palette]:Un(ti(2,2),U0e),[et.ToString]:Un(ti(1,1),Qi(ra|ci|sa|La))};function O$(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=i[s+1];switch(typeof o){case"number":{r[s]=new $r(ci,o);break}case"string":{r[s]=new $r(sa,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}s===0&&t.properties.set(String(o),e)}return r}function R0e(){return function(i,e,t){let n=i[1];if(typeof n!="string")throw new Error("expected a string argument for var operation");let r=e,s=t.inputVariables?.[n];if(s!==void 0){let o=hs(s,c3,t);if(!(o instanceof $r))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&a3(r,La)&&!a3(r,sa)?a=La:Array.isArray(s)&&s.length===2&&a3(r,TA)&&!a3(r,hd)&&(a=TA),r&=a,r===l3)throw new Error(`the type expected from the var operator (${ud(e)}) did not have any overlap with the type of the corresponding style variables (${ud(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===l3)throw new Error(`a new type expected from the var operator (${ud(e)}) did not have any overlap with the previous type expected for it (${ud(o)}), variable name: ${n}`)}return t.variables.set(n,r),new u3(r,"var",new $r(sa,n))}}function P0e(i,e,t){t.featureId=!0}function I0e(i,e,t){t.geometryType=!0}function L0e(i,e,t){t.mCoordinate=!0}function c6(i,e,t){t.mapState=!0}function Sv(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function ti(i,e){return function(t,n,r){let s=t[0],o=t.length-1;if(i===e){if(o!==i){let a=i===1?"":"s";throw new Error(`expected ${i} argument${a} for ${s}, got ${o}`)}}else if(o<i||o>e){let a=e===1/0?`${i} or more`:`${i} to ${e}`;throw new Error(`expected ${a} arguments for ${s}, got ${o}`)}}}function U$(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=hs(i[s+1],e,t);r[s]=o}return r}function Qi(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=hs(e[o+1],i,n);s[o]=a}return s}}function k$(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=c3;for(let a=0;a<r;++a){let l=hs(i[a+1],o,t);o&=l.type}if(o===l3)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=hs(i[a+1],o,t);s[a]=l}return s}}function D0e(i,e,t){let n=i[0],r=i.length-1;if(r%2===0)throw new Error(`expected an odd number of arguments for ${n}, got ${r} instead`)}function z$(i,e,t){let n=i[0],r=i.length-1;if(r%2===1)throw new Error(`expected an even number of arguments for operation ${n}, got ${r} instead`)}function N0e(i,e,t){let n=i.length-1,r=hs(i[i.length-1],e,t),s=sa|ci|ra,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=hs(i[l+2],s,t);s&=c.type}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}if(s===l3)throw new Error("no common type was found among the arguments of match expression")}for(let l=0;l<n-2;l+=2){try{let c=hs(i[l+2],s,t);o[l]=c}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}try{let c=hs(i[l+3],r.type,t);o[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+2} of match expression: ${c.message}`)}}return[hs(i[1],s,t),...o,r]}function F0e(i,e,t){let n=i[1],r;switch(n[0]){case"linear":r=1;break;case"exponential":let l=n[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);r=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}let s=new $r(ci,r),o;try{o=hs(i[2],ci,t)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}let a=new Array(i.length-3);for(let l=0;l<a.length;l+=2){try{let c=hs(i[l+3],ci,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{let c=hs(i[l+4],e,t);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${c.message}`)}}return[s,o,...a]}function B0e(i,e,t){let n=hs(i[i.length-1],e,t),r=new Array(i.length-1);for(let s=0;s<r.length-1;s+=2){try{let o=hs(i[s+1],ra,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=hs(i[s+2],n.type,t);r[s+1]=o}catch(o){throw new Error(`failed to parse argument ${s+1} of case expression: ${o.message}`)}}return r[r.length-1]=n,r}function O0e(i,e,t){let n=i[2];if(!Array.isArray(n))throw new Error('the second argument for the "in" operator must be an array');let r;if(n[0]==="literal"){if(n=n[1],!Array.isArray(n))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if(typeof n[0]=="string")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');typeof n[0]=="string"?r=sa:r=ci;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=hs(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[hs(i[1],r,t),...s]}function U0e(i,e,t){let n;try{n=hs(i[1],ci,t)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}let r=i[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");let s=new Array(r.length);for(let o=0;o<s.length;o++){let a;try{a=hs(r[o],La,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof $r))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Un(...i){return function(e,t,n){let r=e[0],s;for(let o=0;o<i.length;o++){let a=i[o](e,t,n);if(o==i.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");s=a}}return new u3(t,r,...s)}}function k0e(i,e,t){let n=i[0],r=C0e[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function f3(i){if(!i)return"";let e=i.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return f3(i.getGeometries()[0]);default:return""}}function h6(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Eu(i,e,t){let n=hs(i,e,t);return Tu(n,t)}function Tu(i,e){if(i instanceof $r){if(i.type===La&&typeof i.value=="string"){let n=$y(i.value);return function(){return n}}return function(){return i.value}}let t=i.operator;switch(t){case et.Number:case et.String:case et.Coalesce:return z0e(i,e);case et.Get:case et.Var:case et.Has:return V0e(i,e);case et.Id:return n=>n.featureId;case et.GeometryType:return n=>n.geometryType;case et.Concat:{let n=i.args.map(r=>Tu(r,e));return r=>"".concat(...n.map(s=>s(r).toString()))}case et.Resolution:return n=>n.resolution;case et.Any:case et.All:case et.Between:case et.In:case et.Not:return q0e(i,e);case et.Equal:case et.NotEqual:case et.LessThan:case et.LessThanOrEqualTo:case et.GreaterThan:case et.GreaterThanOrEqualTo:return G0e(i,e);case et.Multiply:case et.Divide:case et.Add:case et.Subtract:case et.Clamp:case et.Mod:case et.Pow:case et.Abs:case et.Floor:case et.Ceil:case et.Round:case et.Sin:case et.Cos:case et.Atan:case et.Sqrt:return H0e(i,e);case et.Case:return W0e(i,e);case et.Match:return j0e(i,e);case et.Interpolate:return X0e(i,e);case et.ToString:return $0e(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function z0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);switch(t){case et.Coalesce:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case et.Number:case et.String:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a===t)return a}throw new Error(`Expected one of the values to be a ${t}`)};default:throw new Error(`Unsupported assertion operator ${t}`)}}function V0e(i,e){let n=i.args[0].value;switch(i.operator){case et.Get:return r=>{let s=i.args,o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;o=o[u]}return o};case et.Var:return r=>r.variables[n];case et.Has:return r=>{let s=i.args;if(!(n in r.properties))return!1;let o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;if(!o||!Object.hasOwn(o,u))return!1;o=o[u]}return!0};default:throw new Error(`Unsupported accessor operator ${i.operator}`)}}function G0e(i,e){let t=i.operator,n=Tu(i.args[0],e),r=Tu(i.args[1],e);switch(t){case et.Equal:return s=>n(s)===r(s);case et.NotEqual:return s=>n(s)!==r(s);case et.LessThan:return s=>n(s)<r(s);case et.LessThanOrEqualTo:return s=>n(s)<=r(s);case et.GreaterThan:return s=>n(s)>r(s);case et.GreaterThanOrEqualTo:return s=>n(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${t}`)}}function q0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);switch(t){case et.Any:return s=>{for(let o=0;o<n;++o)if(r[o](s))return!0;return!1};case et.All:return s=>{for(let o=0;o<n;++o)if(!r[o](s))return!1;return!0};case et.Between:return s=>{let o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case et.In:return s=>{let o=r[0](s);for(let a=1;a<n;++a)if(o===r[a](s))return!0;return!1};case et.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${t}`)}}function H0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);switch(t){case et.Multiply:return s=>{let o=1;for(let a=0;a<n;++a)o*=r[a](s);return o};case et.Divide:return s=>r[0](s)/r[1](s);case et.Add:return s=>{let o=0;for(let a=0;a<n;++a)o+=r[a](s);return o};case et.Subtract:return s=>r[0](s)-r[1](s);case et.Clamp:return s=>{let o=r[0](s),a=r[1](s);if(o<a)return a;let l=r[2](s);return o>l?l:o};case et.Mod:return s=>r[0](s)%r[1](s);case et.Pow:return s=>Math.pow(r[0](s),r[1](s));case et.Abs:return s=>Math.abs(r[0](s));case et.Floor:return s=>Math.floor(r[0](s));case et.Ceil:return s=>Math.ceil(r[0](s));case et.Round:return s=>Math.round(r[0](s));case et.Sin:return s=>Math.sin(r[0](s));case et.Cos:return s=>Math.cos(r[0](s));case et.Atan:return n===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case et.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${t}`)}}function W0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Tu(i.args[r],e);return r=>{for(let s=0;s<t-1;s+=2)if(n[s](r))return n[s+1](r);return n[t-1](r)}}function j0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Tu(i.args[r],e);return r=>{let s=n[0](r);for(let o=1;o<t-1;o+=2)if(s===n[o](r))return n[o+1](r);return n[t-1](r)}}function X0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Tu(i.args[r],e);return r=>{let s=n[0](r),o=n[1](r),a,l;for(let c=2;c<t;c+=2){let u=n[c](r),f=n[c+1](r),d=Array.isArray(f);if(d&&(f=pX(f)),u>=o)return c===2?f:d?Y0e(s,o,a,l,u,f):u2(s,o,a,l,u,f);a=u,l=f}return l}}function $0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);if(t===et.ToString)return s=>{let o=r[0](s);return i.args[0].type===La?Yy(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function u2(i,e,t,n,r,s){let o=r-t;if(o===0)return n;let a=e-t,l=i===1?a/o:(Math.pow(i,a)-1)/(Math.pow(i,o)-1);return n+l*(s-n)}function Y0e(i,e,t,n,r,s){if(r-t===0)return n;let a=HN(n),l=HN(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[u2(i,e,t,a[0],r,l[0]),u2(i,e,t,a[1],r,l[1]),a[2]+u2(i,e,t,0,r,c),u2(i,e,t,n[3],r,s[3])];return mX(u)}function Z0e(i){return!0}function K0e(i,e){e=e??h3();let t=Q0e(i,e),n=h6();return function(r,s){if(n.properties=r.getPropertiesInternal(),n.resolution=s,e.featureId){let o=r.getId();o!==void 0?n.featureId=o:n.featureId=null}return e.geometryType&&(n.geometryType=f3(r.getGeometry())),t(n)}}function V$(i,e){e=e??h3();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=f6(i[o],e);let r=h6(),s=new Array(t);return function(o,a){if(r.properties=o.getPropertiesInternal(),r.resolution=a,e.featureId){let c=o.getId();c!==void 0?r.featureId=c:r.featureId=null}e.geometryType&&(r.geometryType=f3(o.getGeometry()));let l=0;for(let c=0;c<t;++c){let u=n[c](r);u&&(s[l]=u,l+=1)}return s.length=l,s}}function W$(i,e){if(e=e??h3(),!Array.isArray(i))return V$([i],e);let t=i.length;if("style"in i[0]){let s=new Array(t);for(let o=0;o<t;++o){let a=i[o];if(!("style"in a))throw new Error("Expected a list of rules with a style property");s[o]=a}return K0e(s,e)}return V$(i,e)}function Q0e(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r],o="filter"in s?Eu(s.filter,ra,e):Z0e,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=f6(s.style[c],e)}else a=[f6(s.style,e)];n[r]={filter:o,styles:a}}return function(r){let s=[],o=!1;for(let a=0;a<t;++a){let l=n[a].filter;if(l(r)&&!(i[a].else&&o)){o=!0;for(let c of n[a].styles){let u=c(r);u&&s.push(u)}}}return s}}function f6(i,e){let t=h2(i,"",e),n=f2(i,"",e),r=J0e(i,e),s=eme(i,e),o=Uo(i,"z-index",e);if(!t&&!n&&!r&&!s&&!Au(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new Xr;return function(l){let c=!0;if(t){let u=t(l);u&&(c=!1),a.setFill(u)}if(n){let u=n(l);u&&(c=!1),a.setStroke(u)}if(r){let u=r(l);u&&(c=!1),a.setText(u)}if(s){let u=s(l);u&&(c=!1),a.setImage(u)}return o&&a.setZIndex(o(l)),c?null:a}}function h2(i,e,t){let n;if(e+"fill-pattern-src"in i)n=rme(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=p3(i,e+"fill-color",t)}if(!n)return null;let r=new ks;return function(s){let o=n(s);return o===NE?null:(r.setColor(o),r)}}function f2(i,e,t){let n=Uo(i,e+"stroke-width",t),r=p3(i,e+"stroke-color",t);if(!n&&!r)return null;let s=fd(i,e+"stroke-line-cap",t),o=fd(i,e+"stroke-line-join",t),a=j$(i,e+"stroke-line-dash",t),l=Uo(i,e+"stroke-line-dash-offset",t),c=Uo(i,e+"stroke-miter-limit",t),u=Uo(i,e+"stroke-offset",t),f=new ro;return function(d){if(r){let A=r(d);if(A===NE)return null;f.setColor(A)}if(n&&f.setWidth(n(d)),s){let A=s(d);if(A!=="butt"&&A!=="round"&&A!=="square")throw new Error("Expected butt, round, or square line cap");f.setLineCap(A)}if(o){let A=o(d);if(A!=="bevel"&&A!=="round"&&A!=="miter")throw new Error("Expected bevel, round, or miter line join");f.setLineJoin(A)}return a&&f.setLineDash(a(d)),l&&f.setLineDashOffset(l(d)),c&&f.setMiterLimit(c(d)),u&&f.setOffset(u(d)),f}}function J0e(i,e){let t="text-",n=fd(i,t+"value",e);if(!n)return null;let r=h2(i,t,e),s=h2(i,t+"background-",e),o=f2(i,t,e),a=f2(i,t+"background-",e),l=fd(i,t+"font",e),c=Uo(i,t+"max-angle",e),u=Uo(i,t+"offset-x",e),f=Uo(i,t+"offset-y",e),d=Tv(i,t+"overflow",e),A=fd(i,t+"placement",e),y=Uo(i,t+"repeat",e),w=m3(i,t+"scale",e),S=Tv(i,t+"rotate-with-view",e),T=Uo(i,t+"rotation",e),R=fd(i,t+"align",e),I=fd(i,t+"justify",e),P=fd(i,t+"baseline",e),F=Tv(i,t+"keep-upright",e),D=j$(i,t+"padding",e),L=A3(i,t+"declutter-mode"),C=new Bp({declutterMode:L});return function(B){if(C.setText(n(B)),r&&C.setFill(r(B)),s&&C.setBackgroundFill(s(B)),o&&C.setStroke(o(B)),a&&C.setBackgroundStroke(a(B)),l&&C.setFont(l(B)),c&&C.setMaxAngle(c(B)),u&&C.setOffsetX(u(B)),f&&C.setOffsetY(f(B)),d&&C.setOverflow(d(B)),A){let k=A(B);if(k!=="point"&&k!=="line")throw new Error("Expected point or line for text-placement");C.setPlacement(k)}if(y&&C.setRepeat(y(B)),w&&C.setScale(w(B)),S&&C.setRotateWithView(S(B)),T&&C.setRotation(T(B)),R){let k=R(B);if(k!=="left"&&k!=="center"&&k!=="right"&&k!=="end"&&k!=="start")throw new Error("Expected left, right, center, start, or end for text-align");C.setTextAlign(k)}if(I){let k=I(B);if(k!=="left"&&k!=="right"&&k!=="center")throw new Error("Expected left, right, or center for text-justify");C.setJustify(k)}if(P){let k=P(B);if(k!=="bottom"&&k!=="top"&&k!=="middle"&&k!=="alphabetic"&&k!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");C.setTextBaseline(k)}return D&&C.setPadding(D(B)),F&&C.setKeepUpright(F(B)),C}}function eme(i,e){return"icon-src"in i?tme(i,e):"shape-points"in i?nme(i,e):"circle-radius"in i?ime(i,e):null}function tme(i,e){let t="icon-",n=t+"src",r=X$(i[n],n),s=d3(i,t+"anchor",e),o=m3(i,t+"scale",e),a=Uo(i,t+"opacity",e),l=d3(i,t+"displacement",e),c=Uo(i,t+"rotation",e),u=Tv(i,t+"rotate-with-view",e),f=q$(i,t+"anchor-origin"),d=H$(i,t+"anchor-x-units"),A=H$(i,t+"anchor-y-units"),y=dd(i,t+"color"),w,S=null;y!==void 0&&(Array.isArray(y)&&y.length>0&&typeof y[0]=="string"?S=p3(i,t+"color",e):w=$$(y,t+"color"));let T=ome(i,t+"cross-origin"),R=ame(i,t+"offset"),I=q$(i,t+"offset-origin"),P=d6(i,t+"width"),F=d6(i,t+"height"),D=sme(i,t+"size"),L=A3(i,t+"declutter-mode"),C={src:r,anchorOrigin:f,anchorXUnits:d,anchorYUnits:A,crossOrigin:T,offset:R,offsetOrigin:I,height:F,width:P,size:D,declutterMode:L},B=null;return function(k){if(B)S&&B.setColor(S(k));else{let z=S?S(k):w;B=new vA(z!==void 0?Object.assign({},C,{color:z}):Object.assign({},C))}return a&&B.setOpacity(a(k)),l&&B.setDisplacement(l(k)),c&&B.setRotation(c(k)),u&&B.setRotateWithView(u(k)),o&&B.setScale(o(k)),s&&B.setAnchor(s(k)),B}}function nme(i,e){let t="shape-",n=t+"points",r=t+"radius",s=p6(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=Uo(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=Uo(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=h2(i,t,e),d=f2(i,t,e),A=m3(i,t+"scale",e),y=d3(i,t+"displacement",e),w=Uo(i,t+"rotation",e),S=Tv(i,t+"rotate-with-view",e),T=d6(i,t+"angle"),R=A3(i,t+"declutter-mode"),I=new zE({points:s,radius:a,radius2:u,angle:T,declutterMode:R});return function(P){return o&&I.setRadius(o(P)),c&&I.setRadius2(c(P)),f&&I.setFill(f(P)),d&&I.setStroke(d(P)),y&&I.setDisplacement(y(P)),w&&I.setRotation(w(P)),S&&I.setRotateWithView(S(P)),A&&I.setScale(A(P)),I}}function ime(i,e){let t="circle-",n=h2(i,t,e),r=f2(i,t,e),s=Uo(i,t+"radius",e),o=m3(i,t+"scale",e),a=d3(i,t+"displacement",e),l=Uo(i,t+"rotation",e),c=Tv(i,t+"rotate-with-view",e),u=A3(i,t+"declutter-mode"),f=new VE({radius:5,declutterMode:u});return function(d){return s&&f.setRadius(s(d)),n&&f.setFill(n(d)),r&&f.setStroke(r(d)),a&&f.setDisplacement(a(d)),l&&f.setRotation(l(d)),c&&f.setRotateWithView(c(d)),o&&f.setScale(o(d)),f}}function dd(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function Uo(i,e,t){let n=dd(i,e);if(n===void 0)return;let r=Eu(n,ci,t);return function(s){return p6(r(s),e)}}function fd(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,sa,t);return function(s){return X$(r(s),e)}}function rme(i,e,t){let n=fd(i,e+"pattern-src",t),r=G$(i,e+"pattern-offset",t),s=G$(i,e+"pattern-size",t),o=p3(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function Tv(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,ra,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function p3(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,La,t);return function(s){return $$(r(s),e)}}function j$(i,e,t){let n=dd(i,e);if(n===void 0)return null;if(Array.isArray(n)&&(n.length===0||typeof n[0]!="string")){let s=n.map((o,a)=>{if(typeof o=="number")return()=>o;let l=Eu(o,ci,t);return function(c){return p6(l(c),`${e}[${a}]`)}});return function(o){let a=new Array(s.length);for(let l=0;l<s.length;++l)a[l]=s[l](o);return a}}let r=Eu(n,hd,t);return function(s){return d2(r(s),e)}}function d3(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,hd,t);return function(s){let o=d2(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function G$(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,hd,t);return function(s){return Y$(r(s),e)}}function m3(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,hd|ci,t);return function(s){return lme(r(s),e)}}function d6(i,e){let t=i[e];if(t!==void 0){if(typeof t!="number")throw new Error(`Expected a number for ${e}`);return t}}function sme(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return cs(t);if(!Array.isArray(t))throw new Error(`Expected a number or size array for ${e}`);if(t.length!==2||typeof t[0]!="number"||typeof t[1]!="number")throw new Error(`Expected a number or size array for ${e}`);return t}}function ome(i,e){let t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);return t}}function q$(i,e){let t=i[e];if(t!==void 0){if(t!=="bottom-left"&&t!=="bottom-right"&&t!=="top-left"&&t!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return t}}function H$(i,e){let t=i[e];if(t!==void 0){if(t!=="pixels"&&t!=="fraction")throw new Error(`Expected pixels or fraction for ${e}`);return t}}function ame(i,e){let t=i[e];if(t!==void 0)return d2(t,e)}function A3(i,e){let t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);if(t!=="declutter"&&t!=="obstacle"&&t!=="none")throw new Error(`Expected declutter, obstacle, or none for ${e}`);return t}}function d2(i,e){if(!Array.isArray(i))throw new Error(`Expected an array for ${e}`);let t=i.length;for(let n=0;n<t;++n)if(typeof i[n]!="number")throw new Error(`Expected an array of numbers for ${e}`);return i}function X$(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function p6(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function $$(i,e){if(typeof i=="string")return i;let t=d2(i,e),n=t.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return t}function Y$(i,e){let t=d2(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function lme(i,e){return typeof i=="number"?i:Y$(i,e)}var Z$={RENDER_ORDER:"renderOrder"},m6=class extends wA{constructor(e){e=e||{};let t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer!==void 0?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0?e.updateWhileAnimating:!1,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0?e.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Z$.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){let n=this.getDeclutter();n in e.declutter||(e.declutter[n]=new SA(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(Z$.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?i5:e;let t=cme(e);this.styleFunction_=e===null?void 0:MX(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function cme(i){if(i===void 0)return i5;if(!i)return null;if(typeof i=="function"||i instanceof Xr)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof Xr){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof Xr))throw new Error("Expected a list of style instances");n[r]=s}return n}return W$(i)}var g3=m6;var A6=class extends Ao{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},v3=A6;var g6=class extends Mp{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){ei()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;No(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),dE(r,n)}forEachFeatureAtCoordinate(e,t,n,r,s,o,a,l){let c,u=t.viewState;function f(P,F,D,L){return s.call(o,F,P?D:null,L)}let d=u.projection,A=YT(e.slice(),d),y=[[0,0]];if(d.canWrapX()&&r){let P=d.getExtent(),F=Kn(P);y.push([-F,0],[F,0])}let w=t.layerStatesArray,S=w.length,T=[],R=[];for(let P=0;P<y.length;P++)for(let F=S-1;F>=0;--F){let D=w[F],L=D.layer;if(L.hasRenderer()&&s2(D,u)&&a.call(l,L)){let C=L.getRenderer(),B=L.getSource();if(C&&B){let k=B.getWrapX()?A:e,z=f.bind(null,D.managed);R[0]=k[0]+y[P][0],R[1]=k[1]+y[P][1],c=C.forEachFeatureAtCoordinate(R,t,n,z,T)}if(c)return c}}if(T.length===0)return;let I=1/T.length;return T.forEach((P,F)=>P.distanceSq+=F*I),T.sort((P,F)=>P.distanceSq-F.distanceSq),T.some(P=>c=P.callback(P.feature,P.layer,P.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,s,o){return this.forEachFeatureAtCoordinate(e,t,n,r,Jf,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){ei()}scheduleExpireIconCache(e){na.canExpireCache()&&e.postRenderFunctions.push(ume)}};function ume(i,e){na.expire()}var K$=g6;var v6=class extends K${constructor(e){super(e),this.fontChangeListenerKey_=qn(AA,xu.PROPERTYCHANGE,e.redrawText,e),this.element_=no?uE():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Np+" ol-layers";let n=e.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){let n=this.getMap();if(n.hasListener(e)){let r=new v3(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){li(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(Oo.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof g3&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;Hl(o)&&(a=o.getContext("2d"),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,o.width,o.height));let l=[],c=a?o:null;for(let u=0,f=t.length;u<f;++u){let d=t[u];e.layerIndex=u;let A=d.layer,y=A.getSourceState();if(!s2(d,r)||y!="ready"&&y!="undefined"){A.unrender();continue}let w=A.render(e,c);w&&(w!==c&&(this.children_.push(w),c=w),l.push(d))}this.declutter(e,l),bj(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,d=u.style.backgroundColor;if(d&&(!Hl(f)||f.width>0)&&(a.fillStyle=d,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!Hl(f)||f.width===0)continue;a.save();let A=u.style.opacity||f.style.opacity;a.globalAlpha=A===""?1:Number(A);let y=f.style.transform;if(y)a.transform(...fE(y));else{let w=parseFloat(f.style.width)/f.width,S=parseFloat(f.style.height)/f.height;a.transform(w,0,0,S,0,0)}a.drawImage(f,0,0),a.restore()}this.dispatchRenderEvent(Oo.POSTCOMPOSE,e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let n=t.length-1;n>=0;--n){let r=t[n],s=r.layer;s.getDeclutter()&&s.renderDeclutter(e,r)}t.forEach(n=>n.layer.renderDeferred(e))}}},Q$=v6;function J$(i){if(i instanceof wA){i.setMapInternal(null);return}i instanceof r2&&i.getLayers().forEach(J$)}function eY(i,e){if(i instanceof wA){i.setMapInternal(e);return}if(i instanceof r2){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)eY(t[n],e)}}var _6=class extends Us{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=hme(e);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=e.maxTilesLoading!==void 0?e.maxTilesLoading:16,this.pixelRatio_=e.pixelRatio!==void 0?e.pixelRatio:Aj,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=go(),this.pixelToCoordinateTransform_=go(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,no||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,no||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(no?new Fo:ZE()),this.interactions=t.interactions||(no?new Fo:n3({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new l$(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Bo.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Bo.VIEW,this.handleViewChanged_),this.addChangeListener(Bo.SIZE,this.handleSizeChanged_),this.addChangeListener(Bo.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof Xl)&&e.view.then(function(r){n.setView(new Xl(r))}),this.controls.addEventListener(vo.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(vo.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(vo.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(vo.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(vo.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(vo.REMOVE,r=>{let s=r.element.getId();s!==void 0&&delete this.overlayIdIndex_[s.toString()],r.element.setMap(null)}),this.controls.forEach(r=>{r.setMap(this)}),this.interactions.forEach(r=>{r.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){eY(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){let t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;let r=this.getCoordinateFromPixelInternal(e);n=n!==void 0?n:{};let s=n.hitTolerance!==void 0?n.hitTolerance:0,o=n.layerFilter!==void 0?n.layerFilter:Jf,a=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,s,a,t,null,o,null)}getFeaturesAtPixel(e,t){let n=[];return this.forEachFeatureAtPixel(e,function(r){n.push(r)},t),n}getAllLayers(){let e=[];function t(n){n.forEach(function(r){r instanceof r2?t(r.getLayers()):e.push(r)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;let n=this.getCoordinateFromPixelInternal(e);t=t!==void 0?t:{};let r=t.layerFilter!==void 0?t.layerFilter:Jf,s=t.hitTolerance!==void 0?t.hitTolerance:0,o=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,s,o,r,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){let n=this.viewport_.getBoundingClientRect(),r=this.getSize(),s=n.width/r[0],o=n.height/r[1],a="changedTouches"in e?e.changedTouches[0]:e;return[(a.clientX-n.left)/s,(a.clientY-n.top)/o]}getTarget(){return this.get(Bo.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Ry(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?jr(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){let t=this.overlayIdIndex_[e.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(Bo.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof Fo){t.setLayers(e);return}let n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){let e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t<n;++t){let r=e[t];if(!r.visible)continue;let s=r.layer.getRenderer();if(s&&!s.ready)return!0;let o=r.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(e){let t=vu(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?jr(t.coordinateToPixelTransform,e.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(e){this.pixelRatio_!==e&&(this.pixelRatio_=e,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(Bo.SIZE)}getView(){return this.get(Bo.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){let e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,n,r){return c$(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new _h(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===t2.POINTERDOWN||n===nn.WHEEL||n===nn.KEYDOWN){let r=this.getOwnerDocument(),s=this.viewport_.getRootNode?this.viewport_.getRootNode():r,o=t.target,a=s instanceof ShadowRoot?s.host===o?s.host.ownerDocument:s:s===r?r.documentElement:s;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){let r=this.getInteractions().getArray().slice();for(let s=r.length-1;s>=0;s--){let o=r[s];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){let e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let r=this.maxTilesLoading_,s=r,o=e?e.viewHints:void 0,a=o?o[so.ANIMATING]||o[so.INTERACTING]:!1;if(a){let l=Date.now()-e.time>8;r=l?0:8,s=l?0:2}t.getTilesLoading()<r&&(a&&t.reprioritize(),t.loadMoreTiles(r,s))}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(Oo.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Oo.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Up(xh.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Up(xh.LOADSTART,this,e))));let n=this.postRenderFunctions_;if(e)for(let r=0,s=n.length;r<s;++r)n[r](this,e);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let n=0,r=this.targetChangeHandlerKeys_.length;n<r;++n)li(this.targetChangeHandlerKeys_[n]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(nn.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(nn.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Hl(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);let n=this.targetElement_.getRootNode();n instanceof ShadowRoot&&this.resizeObserver_.unobserve(n.host),this.setSize(void 0)}let e=this.getTarget(),t=typeof e=="string"?document.getElementById(e):e;if(this.targetElement_=t,!t)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{if(Hl(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Q$(this)),!Hl(t)){this.mapBrowserEventHandler_=new o$(this,this.moveTolerance_);for(let r in gr)this.mapBrowserEventHandler_.addEventListener(gr[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(nn.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(nn.WHEEL,this.boundHandleBrowserEvent_,cE?{passive:!1}:!1);let n;if(this.keyboardEventTarget_)n=this.keyboardEventTarget_;else{let r=t.getRootNode();n=r instanceof ShadowRoot?r.host:t}if(this.targetChangeHandlerKeys_=[qn(n,nn.KEYDOWN,this.handleBrowserEvent,this),qn(n,nn.KEYPRESS,this.handleBrowserEvent,this)],!Hl(t)){let r=t.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.observe(r.host),this.resizeObserver_?.observe(t)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(li(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(li(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=qn(e,xu.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=qn(e,nn.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(li),this.layerGroupPropertyListenerKeys_=null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Su("addlayer",e)),this.layerGroupPropertyListenerKeys_=[qn(e,xu.PROPERTYCHANGE,this.render,this),qn(e,nn.CHANGE,this.render,this),qn(e,"addlayer",this.handleLayerAdd_,this),qn(e,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;let e=this.frameState_.layerStatesArray;for(let t=0,n=e.length;t<n;++t){let r=e[t].layer;r.hasRenderer()&&r.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){J$(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){let t=this.getSize(),n=this.getView(),r=this.frameState_,s=null;if(t!==void 0&&qD(t)&&n&&n.isDef()){let o=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();if(s={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Ty(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:Bn(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=Ty(a.nextCenter,a.nextResolution,l,t)}}this.frameState_=s,this.renderer_.renderFrame(s),s&&(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),r&&(!this.previousExtent_||!hh(this.previousExtent_)&&!Km(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Up(xh.MOVESTART,this,r)),this.previousExtent_=Zm(this.previousExtent_)),this.previousExtent_&&!s.viewHints[so.ANIMATING]&&!s.viewHints[so.INTERACTING]&&!Km(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Up(xh.MOVEEND,this,s)),VT(s.extent,this.previousExtent_))),this.dispatchEvent(new Up(xh.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(xh.LOADSTART)||this.hasListener(xh.LOADEND)||this.hasListener(Oo.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){let t=this.getLayerGroup();t&&this.handleLayerRemove_(new Su("removelayer",t)),this.set(Bo.LAYERGROUP,e)}setSize(e){this.set(Bo.SIZE,e)}setTarget(e){this.set(Bo.TARGET,e)}setView(e){if(!e||e instanceof Xl){this.set(Bo.VIEW,e);return}this.set(Bo.VIEW,new Xl);let t=this;e.then(function(n){t.setView(new Xl(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(Hl(e)){let o=e.getContext("2d").getTransform();r=e.width/o.a,s=e.height/o.d}else{let o=getComputedStyle(e);r=e.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),s=e.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(r)&&!isNaN(s)&&(t=[Math.max(0,r),Math.max(0,s)],!qD(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&jT("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!ta(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function hme(i){let e=null;i.keyboardEventTarget!==void 0&&(e=typeof i.keyboardEventTarget=="string"?document.getElementById(i.keyboardEventTarget):i.keyboardEventTarget);let t={},n=i.layers&&typeof i.layers.getLayers=="function"?i.layers:new r2({layers:i.layers});t[Bo.LAYERGROUP]=n,t[Bo.TARGET]=i.target,t[Bo.VIEW]=i.view instanceof Xl?i.view:new Xl;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new Fo(i.controls.slice()):(jn(typeof i.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),r=i.controls));let s;i.interactions!==void 0&&(Array.isArray(i.interactions)?s=new Fo(i.interactions.slice()):(jn(typeof i.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),s=i.interactions));let o;return i.overlays!==void 0?Array.isArray(i.overlays)?o=new Fo(i.overlays.slice()):(jn(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new Fo,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var tY=_6;function _3(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var fme=new Error("disposed");var dme=[256,256],x6=class extends sv{constructor(e){let t=an.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;let e=_3(this.data_);return e?[e.width,e.height]:dme}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==an.IDLE&&this.state!==an.ERROR)return;this.state=an.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=an.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=an.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(fme),this.controller_=null),super.disposeInternal()}},y6=x6;var b6=class{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){let e=this.pop();e instanceof Mp&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){let n=this.entries_[e];return jn(n!==void 0,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){let t=this.entries_[e];return jn(t!==void 0,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){let e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){jn(!(e in this.entries_),"Tried to set a value for a key that is used already");let n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}},w6=b6;var S6=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(Ly(),{get:(e,t)=>{if(typeof e[t]=="function")return this.pendingMethod_=t,this.pushMethodArgs_},set:(e,t,n)=>(this.push_(t,n),!0)})}push_(...e){let t=this.instructions_,n=this.zIndex+this.offset_;t[n]||(t[n]=[]),t[n].push(...e)}pushMethodArgs_=(...e)=>{this.push_(this.pendingMethod_,e)};pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,r=t.length;n<r;++n){let s=t[n];if(typeof s=="function"){s(e);continue}let o=t[++n];typeof e[s]=="function"?e[s](...o):typeof o=="function"?e[s]=o(e):e[s]=o}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},x3=S6;var pme=5,T6=class extends mE{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=pme,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(e){this.renderedSourceKey_?this.renderedSourceKey_!==e&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=e):this.renderedSourceKey_=e}getFeatures(e){return ei()}getData(e){return null}prepareFrame(e){return ei()}renderFrame(e,t){return ei()}forEachFeatureAtCoordinate(e,t,n,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===Pn.LOADED||t.getState()===Pn.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Pn.LOADED&&t!=Pn.ERROR&&e.addEventListener(nn.CHANGE,this.boundHandleImageChange_),t==Pn.IDLE&&(e.load(),t=e.getState()),t==Pn.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},nY=T6;var M6=[],Ev=null;function mme(){Ev=Di(1,1,void 0,{willReadFrequently:!0})}var E6=class extends nY{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=go(),this.pixelTransform=go(),this.inversePixelTransform=go(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){Ev||mme(),Ev.clearRect(0,0,1,1);let r;try{Ev.drawImage(e,t,n,1,1,0,0,1,1),r=Ev.getImageData(0,0,1,1).data}catch{return Ev=null,null}return r}getBackground(e){let n=this.getLayer().getBackground();return typeof n=="function"&&(n=n(e.viewState.resolution)),n||void 0}useContainer(e,t,n,r,s){if(Hl(e)&&this.pixelTransform[1]===0&&this.pixelTransform[2]===0&&this.pixelTransform[4]===0&&this.pixelTransform[5]===0&&e.width===r&&e.height===s){let c=e,u=c.getContext("2d");if(u){this.container=e,this.context=u,this.containerReused=!0,n&&(u.fillStyle=n,u.fillRect(0,0,c.width,c.height));return}}let o=this.getLayer().getClassName(),a,l;if(e&&e.className===o&&(!n||e&&e.style.backgroundColor&&ta(Oc(e.style.backgroundColor),Oc(n)))){let c=e.firstElementChild;Hl(c)&&(l=c.getContext("2d"))}if(l&&Rj(l.canvas.style.transform,t)?(this.container=e,this.context=l,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){a=no?uE():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Di();let u=l.canvas;a.appendChild(u),c=u.style,c.position="absolute",c.left="0",c.transformOrigin="top left",this.container=a,this.context=l}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){let r=Pc(n),s=j1(n),o=W1(n),a=H1(n);jr(t.coordinateToPixelTransform,r),jr(t.coordinateToPixelTransform,s),jr(t.coordinateToPixelTransform,o),jr(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;jr(l,r),jr(l,s),jr(l,o),jr(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}prepareContainer(e,t){let n=e.extent,r=e.viewState.resolution,s=e.viewState.rotation,o=e.pixelRatio,a=Math.round(Kn(n)/r*o),l=Math.round(Nr(n)/r*o);No(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),dE(this.inversePixelTransform,this.pixelTransform);let c=Cj(this.pixelTransform),u=this.getBackground(e);if(this.useContainer(t,c,u,a,l),!this.containerReused){let f=this.context.canvas;f.width!=a||f.height!=l?(f.width=a,f.height=l):this.context.clearRect(0,0,a,l),c!==f.style.transform&&(f.style.transform=c)}}dispatchRenderEvent_(e,t,n){let r=this.getLayer();if(r.hasListener(e)){let s=new v3(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(Oo.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(Oo.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new x3),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(Oo.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(Oo.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,s,o,a){let l=s/2,c=o/2,u=r/t,f=-u,d=-e[0]+a,A=-e[1];return No(this.tempTransform,l,c,u,f,-n,d,A)}disposeInternal(){delete this.frameState,super.disposeInternal()}},y3=E6;function C6(i,e,t){if(!(t in i))return i[t]=new Set([e]),!0;let n=i[t],r=n.has(e);return r||n.add(e),!r}function Ame(i,e,t){let n=i[t];return n?n.delete(e):!1}function iY(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=uh(e,_u(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=uh(e,r))}return e}var R6=class extends y3{constructor(e,t){super(e),t=t||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=Wr(),this.tempTileRange_=new rE(0,0,0,0),this.tempTileCoord_=tv(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new w6(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new w6(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=nv(a,a.getKey(),e,t,n),c;if(s.containsKey(l))c=s.get(l);else{let u=r.viewState.projection,f=a.getProjection();if(c=a.getTile(e,t,n,r.pixelRatio,u,!f||Q1(f,u)?void 0:this.getSourceTileCache()),!c)return null;s.set(l,c)}return c}getTile(e,t,n,r){let s=this.getOrCreateTile(e,t,n,r);return s||null}getData(e){let t=this.frameState;if(!t)return null;let n=this.getLayer(),r=jr(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!du(s,r))return null;let o=t.viewState,a=n.getRenderSource(),l=a.getTileGridForProjection(o.projection),c=a.getTilePixelRatio(t.pixelRatio);for(let u=l.getZForResolution(o.resolution);u>=l.getMinZoom();--u){let f=l.getTileCoordForCoordAndZ(r,u),d=this.getTile(u,f[1],f[2],t);if(!d||d.getState()!==an.LOADED)continue;let A=l.getOrigin(u),y=cs(l.getTileSize(u)),w=l.getResolution(u),S;if(d instanceof hE||d instanceof pE)S=d.getImage();else if(d instanceof y6){if(S=_3(d.getData()),!S)continue}else continue;let T=Math.floor(c*((r[0]-A[0])/w-f[1]*y[0])),R=Math.floor(c*((A[1]-r[1])/w-f[2]*y[1])),I=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(S,T+I,R+I)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;let t=this.getLayer().getSource();if(!t)return!1;let n=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,n,r,s){let o=e.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(o.projection),u=Bn(l);u in e.wantedTiles||(e.wantedTiles[u]={});let f=e.wantedTiles[u],d=a.getMapInternal(),A=Math.max(n-s,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),y=o.rotation,w=y?CD(o.center,o.resolution,y,e.size):void 0;for(let S=n;S>=A;--S){let T=c.getTileRangeForExtentAndZ(t,S,this.tempTileRange_),R=c.getResolution(S);for(let I=T.minX;I<=T.maxX;++I)for(let P=T.minY;P<=T.maxY;++P){if(y&&!c.tileCoordIntersectsViewport([S,I,P],w))continue;let F=this.getTile(S,I,P,e);if(!F||!C6(r,F,S))continue;let L=F.getKey();if(f[L]=!0,F.getState()===an.IDLE&&!e.tileQueue.isKeyQueued(L)){let C=tv(S,I,P,this.tempTileCoord_);e.tileQueue.enqueue([F,u,c.getTileCoordCenter(C),R])}}}}findStaleTile_(e,t){let n=this.tileCache_,r=e[0],s=e[1],o=e[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){let c=nv(this.getLayer().getSource(),a[l],r,s,o);if(n.containsKey(c)){let u=n.peek(c);if(u.getState()===an.LOADED)return u.endTransition(Bn(this)),C6(t,u,r),!0}}return!1}findAltTiles_(e,t,n,r){let s=e.getTileRangeForTileCoordAndZ(t,n,this.tempTileRange_);if(!s)return!1;let o=!0,a=this.tileCache_,l=this.getLayer().getRenderSource(),c=l.getKey();for(let u=s.minX;u<=s.maxX;++u)for(let f=s.minY;f<=s.maxY;++f){let d=nv(l,c,n,u,f),A=!1;if(a.containsKey(d)){let y=a.peek(d);y.getState()===an.LOADED&&(C6(r,y,n),A=!0)}A||(o=!1)}return o}renderFrame(e,t){this.renderComplete=!0;let n=e.layerStatesArray[e.layerIndex],r=e.viewState,s=r.projection,o=r.resolution,a=r.center,l=e.pixelRatio,c=this.getLayer(),u=c.getSource(),f=u.getTileGridForProjection(s),d=f.getZForResolution(o,u.zDirection),A=f.getResolution(d);this.updateStaleKeys(u.getKey());let y=e.extent,w=u.getTilePixelRatio(l);this.prepareContainer(e,t);let S=this.context.canvas.width,T=this.context.canvas.height;this.layerExtent=n.extent?_u(n.extent,s):null,this.layerExtent&&(y=uh(y,this.layerExtent));let R=A*S/2/w,I=A*T/2/w,P=[a[0]-R,a[1]-I,a[0]+R,a[1]+I],F={};this.renderedTiles.length=0;let D=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let $=f.getZForResolution(r.nextResolution,u.zDirection),J=iY(e,e.nextExtent);this.enqueueTiles(e,J,$,F,D)}let L=iY(e,y);if(this.enqueueTiles(e,L,d,F,0),D>0&&setTimeout(()=>{this.enqueueTiles(e,L,d-1,F,D-1)},0),!(d in F))return this.container;let C=Bn(this),B=e.time;for(let $ of F[d]){let J=$.getState();if(J===an.EMPTY)continue;let te=$.tileCoord;if(J===an.LOADED&&$.getAlpha(C,B)===1){$.endTransition(C);continue}if(J!==an.ERROR&&(this.renderComplete=!1),this.findStaleTile_(te,F)){Ame(F,$,d),e.animate=!0;continue}if(this.findAltTiles_(f,te,d+1,F))continue;let ve=f.getMinZoom();for(let Re=d-1;Re>=ve&&!this.findAltTiles_(f,te,Re,F);--Re);}let k=A/o*l/w,z=this.getRenderContext(e);No(this.tempTransform,S/2,T/2,k,k,0,-S/2,-T/2),this.layerExtent&&this.clipUnrotated(z,e,this.layerExtent),u.getInterpolate()||(z.imageSmoothingEnabled=!1),this.preRender(z,e);let G=Object.keys(F).map(Number);G.sort(pl);let W=[],Y=[],H=[];for(let $=G.length-1;$>=0;--$){let J=G[$],te=u.getTilePixelSize(J,l,s),he=f.getResolution(J)/A,ve=te[0]*he*k,Re=te[1]*he*k,Qe=f.getTileCoordForCoordAndZ(Pc(P),J),Fe=f.getTileCoordExtent(Qe),mt=jr(this.tempTransform,[w*(Fe[0]-P[0])/A,w*(P[3]-Fe[3])/A]),Ee=w*u.getGutterForProjection(s);for(let Ve of F[J]){if(Ve.getState()!==an.LOADED)continue;let Ye=Ve.tileCoord,Mt=Qe[1]-Ye[1],Et=Math.round(mt[0]-(Mt-1)*ve),Pt=Qe[2]-Ye[2],dn=Math.round(mt[1]-(Pt-1)*Re),Gt=Math.round(mt[0]-Mt*ve),$e=Math.round(mt[1]-Pt*Re),ot=Et-Gt,nt=dn-$e,bt=J===d;if(bt&&Ve.inTransition(C)){H.push({tile:Ve,x:Gt,y:$e,w:ot,h:nt,gutter:Ee}),this.renderedTiles.unshift(Ve),this.updateUsedTiles(e.usedTiles,u,Ve);continue}let yt=[Gt,$e,Gt+ot,$e+nt],hn=[];for(let tn=0,bn=W.length;tn<bn;++tn)J<Y[tn]&&Ar(yt,W[tn])&&hn.push(W[tn]);let en;hn.length>0&&(en=SW(yt,hn)),W.push(yt),Y.push(J),this.drawTile(Ve,e,Gt,$e,ot,nt,Ee,bt,en),this.renderedTiles.unshift(Ve),this.updateUsedTiles(e.usedTiles,u,Ve)}}for(let $=0,J=H.length;$<J;++$){let{tile:te,x:ce,y:he,w:ve,h:Re,gutter:Qe}=H[$];this.drawTile(te,e,ce,he,ve,Re,Qe,!0,void 0)}if(this.renderedResolution=A,this.extentChanged=!this.renderedExtent_||!Km(this.renderedExtent_,P),this.renderedExtent_=P,this.renderedPixelRatio=l,this.postRender(this.context,e),this.layerExtent&&z.restore(),z.imageSmoothingEnabled=!0,this.renderComplete){let $=(J,te)=>{let ce=Bn(u),he=te.wantedTiles[ce],ve=he?Object.keys(he).length:0;this.updateCacheSize(ve),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push($)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,s,o,a,l,c){let u;if(e instanceof y6){if(u=_3(e.getData()),!u)throw new Error("Rendering array data is not yet supported")}else u=this.getTileImage(e);if(!u)return;let f=this.getRenderContext(t),d=Bn(this),A=t.layerStatesArray[t.layerIndex],y=A.opacity*(l?e.getAlpha(d,t.time):1),w=y!==f.globalAlpha;w&&(f.save(),f.globalAlpha=y);let S=u.width-2*a,T=u.height-2*a;if(c){let R=S/s,I=T/o;for(let P=0,F=c.length;P<F;++P){let D=c[P],L=D[0],C=D[1],B=D[2]-D[0],k=D[3]-D[1];f.drawImage(u,a+(L-n)*R,a+(C-r)*I,B*R,k*I,L,C,B,k)}}else f.drawImage(u,a,a,S,T,n,r,s,o);w&&f.restore(),y!==A.opacity?t.animate=!0:l&&e.endTransition(d)}getImage(){let e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){let r=Bn(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},rY=R6;var p2={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var P6=class extends wA{constructor(e){e=e||{};let t=Object.assign({},e),n=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(e.preload!==void 0?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(p2.PRELOAD)}setPreload(e){this.set(p2.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(p2.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(p2.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},sY=P6;var I6=class extends sY{constructor(e){super(e)}createRenderer(){return new rY(this,{cacheSize:this.getCacheSize()})}},L6=I6;var D6=class{drawCustom(e,t,n,r,s){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,n){}drawFeature(e,t,n){}drawGeometryCollection(e,t,n){}drawLineString(e,t,n){}drawMultiLineString(e,t,n){}drawMultiPoint(e,t,n){}drawMultiPolygon(e,t,n){}drawPoint(e,t,n){}drawPolygon(e,t,n){}drawText(e,t,n){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}},b3=D6;var m2={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},A2=[m2.FILL],wh=[m2.STROKE],pd=[m2.BEGIN_PATH],N6=[m2.CLOSE_PATH],vn=m2;var F6=class extends b3{constructor(e,t,n,r){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=n,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){let t=this.pixelRatio;return t==1?e:e.map(function(n){return n*t})}appendFlatPointCoordinates(e,t){let n=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,s=this.coordinates,o=s.length;for(let a=0,l=e.length;a<l;a+=t)r[0]=e[a],r[1]=e[a+1],du(n,r)&&(s[o++]=r[0],s[o++]=r[1]);return o}appendFlatLineCoordinates(e,t,n,r,s,o){let a=this.coordinates,l=a.length,c=this.getBufferedMaxExtent();o&&(t+=r);let u=e[t],f=e[t+1],d=this.tmpCoordinate_,A=!0,y,w,S;for(y=t+r;y<n;y+=r)d[0]=e[y],d[1]=e[y+1],S=zT(c,d),S!==w?(A&&(a[l++]=u,a[l++]=f,A=!1),a[l++]=d[0],a[l++]=d[1]):S===Bs.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],A=!1):A=!0,u=d[0],f=d[1],w=S;return(s&&A||y===t+r)&&(a[l++]=u,a[l++]=f),l}drawCustomCoordinates_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o){let l=n[o],c=this.appendFlatLineCoordinates(e,t,l,r,!1,!1);s.push(c),t=l}return t}drawCustom(e,t,n,r,s){this.beginGeometry(e,t,s);let o=e.getType(),a=e.getStride(),l=this.coordinates.length,c,u,f,d,A;switch(o){case"MultiPolygon":c=e.getOrientedFlatCoordinates(),d=[];let y=e.getEndss();A=0;for(let w=0,S=y.length;w<S;++w){let T=[];A=this.drawCustomCoordinates_(c,A,y[w],a,T),d.push(T)}this.instructions.push([vn.CUSTOM,l,d,e,n,Oy,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,d,e,r||n,Oy,s]);break;case"Polygon":case"MultiLineString":f=[],c=o=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),A=this.drawCustomCoordinates_(c,0,e.getEnds(),a,f),this.instructions.push([vn.CUSTOM,l,f,e,n,Pp,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,f,e,r||n,Pp,s]);break;case"LineString":case"Circle":c=e.getFlatCoordinates(),u=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([vn.CUSTOM,l,u,e,n,Bc,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,Bc,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([vn.CUSTOM,l,u,e,n,Bc,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,Bc,s]));break;case"Point":c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),u=this.coordinates.length,this.instructions.push([vn.CUSTOM,l,u,e,n,void 0,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,void 0,s]);break;default:}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[vn.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[vn.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let e=this.hitDetectionInstructions;e.reverse();let t,n=e.length,r,s,o=-1;for(t=0;t<n;++t)r=e[t],s=r[0],s==vn.END_GEOMETRY?o=t:s==vn.BEGIN_GEOMETRY&&(r[2]=t,nj(this.hitDetectionInstructions,o,t),o=-1)}fillStyleToState(e,t={}){if(e){let n=e.getColor();t.fillPatternScale=n&&typeof n=="object"&&"src"in n?this.pixelRatio:1,t.fillStyle=gl(n||io)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=gl(n||ia);let r=e.getLineCap();t.lineCap=r!==void 0?r:gh;let s=e.getLineDash();t.lineDash=s?s.slice():vl;let o=e.getLineDashOffset();t.lineDashOffset=o||_l;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:vh;let l=e.getWidth();t.lineWidth=l!==void 0?l:od;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:rd;let u=e.getOffset();t.strokeOffset=u??_X,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){let n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){let t=e.fillStyle,n=[vn.SET_FILL_STYLE,t];return typeof t!="string"&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[vn.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){let n=e.fillStyle;(n!==void 0&&typeof n!="string"||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){let n=e.strokeStyle,r=e.lineCap,s=e.lineDash,o=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,c=e.miterLimit,u=e.strokeOffset;(e.currentStrokeStyle!=n||e.currentLineCap!=r||s!=e.currentLineDash&&!ta(e.currentLineDash,s)||e.currentLineDashOffset!=o||e.currentLineJoin!=a||e.currentLineWidth!=l||e.currentMiterLimit!=c||e.currentStrokeOffset!=u)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=r,e.currentLineDash=s,e.currentLineDashOffset=o,e.currentLineJoin=a,e.currentLineWidth=l,e.currentMiterLimit=c,e.currentStrokeOffset=u)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let t=[vn.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=VT(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;G1(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Sh=F6;var B6=class extends Sh{constructor(e,t,n,r){super(e,t,n,r),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t,n){if(!this.image_||this.maxExtent&&!du(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=e.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,s);this.instructions.push([vn.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([vn.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=[];for(let l=0,c=r.length;l<c;l+=e.getStride())(!this.maxExtent||du(this.maxExtent,r.slice(l,l+2)))&&s.push(r[l],r[l+1]);let o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,2);this.instructions.push([vn.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([vn.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(e,t){let n=e.getAnchor(),r=e.getSize(),s=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=e.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=r[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},oY=B6;var O6=class extends Sh{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinates_(e,t,n,r,s){let o=this.coordinates.length,a=this.appendFlatLineCoordinates(e,t,n,r,!1,!1);return this.instructions.push([vn.MOVE_TO_LINE_TO,o,a,s*this.pixelRatio]),this.hitDetectionInstructions.push([vn.MOVE_TO_LINE_TO,o,a,s]),n}drawLineString(e,t,n){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l],pd);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(wh),this.endGeometry(t)}drawMultiLineString(e,t,n){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l],pd);let l=e.getEnds(),c=e.getFlatCoordinates(),u=e.getStride(),f=0;for(let d=0,A=l.length;d<A;++d)f=this.drawFlatCoordinates_(c,f,l[d],u,a);this.hitDetectionInstructions.push(wh),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(wh),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(wh),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(pd)}},aY=O6;var U6=class extends Sh{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinatess_(e,t,n,r,s){let o=this.state,a=o.fillStyle!==void 0,l=o.strokeStyle!==void 0,c=n.length;this.instructions.push(pd),this.hitDetectionInstructions.push(pd);for(let u=0;u<c;++u){let f=n[u],d=this.coordinates.length,A=this.appendFlatLineCoordinates(e,t,f,r,!0,!l);this.instructions.push([vn.MOVE_TO_LINE_TO,d,A,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([vn.MOVE_TO_LINE_TO,d,A,s,!0]),l&&(this.instructions.push(N6),this.hitDetectionInstructions.push(N6)),t=f}return a&&(this.instructions.push(A2),this.hitDetectionInstructions.push(A2)),l&&(this.instructions.push(wh),this.hitDetectionInstructions.push(wh)),t}drawCircle(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawCircle(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_FILL_STYLE,io]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l]);let l=e.getFlatCoordinates(),c=e.getStride(),u=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);let f=[vn.CIRCLE,u,a];this.instructions.push(pd,f),this.hitDetectionInstructions.push(pd,f),r.fillStyle!==void 0&&(this.instructions.push(A2),this.hitDetectionInstructions.push(A2)),r.strokeStyle!==void 0&&(this.instructions.push(wh),this.hitDetectionInstructions.push(wh)),this.endGeometry(t)}drawPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_FILL_STYLE,io]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l]);let l=e.getEnds(),c=e.getOrientedFlatCoordinates(),u=e.getStride();this.drawFlatCoordinatess_(c,0,l,u,a),this.endGeometry(t)}drawMultiPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_FILL_STYLE,io]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l]);let l=e.getEndss(),c=e.getOrientedFlatCoordinates(),u=e.getStride(),f=0;for(let d=0,A=l.length;d<A;++d)f=this.drawFlatCoordinatess_(c,f,l[d],u,a);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let e=this.tolerance;if(e!==0){let t=this.coordinates;for(let n=0,r=t.length;n<r;++n)t[n]=Ip(t[n],e)}return super.finish()}setFillStrokeStyles_(){let e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}handleStrokeOffset_(e){let t=this.state,n=t.fillStyle,r=t.strokeStyle,s=t.strokeOffset;return Math.abs(s)>0&&n!==void 0&&r!==void 0?(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=r,t.strokeOffset=s,e(),t.fillStyle=n,!0):!1}},k6=U6;var z6=0,V6=1;function gme(i,e,t,n,r,s,o,a){let l=o-r,c=a-s,u=0,f=1;if(l===0){if(r<i||r>t)return!1}else{let d=(i-r)/l,A=(t-r)/l;if(d>A){let y=d;d=A,A=y}if(d>u&&(u=d),A<f&&(f=A),u>f)return!1}if(c===0){if(s<e||s>n)return!1}else{let d=(e-s)/c,A=(n-s)/c;if(d>A){let y=d;d=A,A=y}if(d>u&&(u=d),A<f&&(f=A),u>f)return!1}return z6=u,V6=f,!0}function lY(i,e,t,n){let r=n[0],s=n[1],o=n[2],a=n[3],l=[],c=[],u=!1,f,d,A=0;for(let y=0,w=e.length;y<w;++y){let S=e[y],T=i[A],R=i[A+1],I=!1;for(let P=A+t;P<S;P+=t){let F=i[P],D=i[P+1];if(gme(r,s,o,a,T,R,F,D)){let L=F-T,C=D-R,B=T+z6*L,k=R+z6*C,z=T+V6*L,G=R+V6*C;u&&I&&B===f&&k===d?l.push(z,G):(u&&c.push(l.length),l.push(B,k,z,G),u=!0),f=z,d=G,I=!0}T=F,R=D}A=S}return u&&c.push(l.length),{flatCoordinates:l,ends:c}}function cY(i,e,t,n,r){let s=[],o=t,a=0,l=e.slice(t,2);for(;a<i&&o+r<n;){let[c,u]=l.slice(-2),f=e[o+r],d=e[o+r+1],A=Math.sqrt((f-c)*(f-c)+(d-u)*(d-u));if(a+=A,a>=i){let y=(i-a+A)/A,w=Lo(c,f,y),S=Lo(u,d,y);l.push(w,S),s.push(l),l=[w,S],a==i&&(o+=r),a=0}else if(a<i)l.push(e[o+r],e[o+r+1]),o+=r;else{let y=A-a,w=Lo(c,f,y/A),S=Lo(u,d,y/A);l.push(w,S),s.push(l),l=[w,S],a=0,o+=r}}return a>0&&s.push(l),s}function uY(i,e,t,n,r){let s=t,o=t,a=0,l=0,c=t,u,f,d,A,y,w,S,T,R,I;for(f=t;f<n;f+=r){let P=e[f],F=e[f+1];y!==void 0&&(R=P-y,I=F-w,A=Math.sqrt(R*R+I*I),S!==void 0&&(l+=d,u=Math.acos((S*R+T*I)/(d*A)),u>i&&(l>a&&(a=l,s=c,o=f),l=0,c=f-r)),d=A,S=R,T=I),y=P,w=F}return l+=A,l>a?[c,f]:[s,o]}var g2={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},G6=class extends Sh{constructor(e,t,n,r){super(e,t,n,r),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[io]={fillStyle:io},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){let r=this.textFillState_,s=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!r&&!s)return;let a=this.coordinates,l=a.length,c=e.getType(),u=null,f=e.getStride();if(o.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){let d=e.getExtent();if(!Ar(this.maxExtent,d))return;let A;if(u=e.getFlatCoordinates(),c=="LineString")A=[u.length];else if(c=="MultiLineString")A=e.getEnds();else if(c=="Polygon")A=e.getEnds().slice(0,1);else if(c=="MultiPolygon"){let T=e.getEndss();A=[];for(let R=0,I=T.length;R<I;++R)A.push(T[R][0])}if((c=="LineString"||c=="MultiLineString")&&!ch(this.getBufferedMaxExtent(),d)){let T=lY(u,A,f,this.getBufferedMaxExtent());if(u=T.flatCoordinates,A=T.ends,f=2,A.length===0)return}this.beginGeometry(e,t,n);let y=o.repeat,w=y?void 0:o.textAlign,S=0;for(let T=0,R=A.length;T<R;++T){let I;y?I=cY(y*this.resolution,u,S,A[T],f):I=[u.slice(S,A[T])];for(let P=0,F=I.length;P<F;++P){let D=I[P],L=0,C=D.length;if(w==null){let k=uY(o.maxAngle,D,0,D.length,2);L=k[0],C=k[1]}for(let k=L;k<C;k+=f)a.push(D[k],D[k+1]);let B=a.length;S=A[T],this.drawChars_(l,B),l=B}}this.endGeometry(t)}else{let d=o.overflow?null:[];switch(c){case"Point":case"MultiPoint":u=e.getFlatCoordinates();break;case"LineString":u=e.getFlatMidpoint();break;case"Circle":u=e.getCenter();break;case"MultiLineString":u=e.getFlatMidpoints(),f=2;break;case"Polygon":u=e.getFlatInteriorPoint(),o.overflow||d.push(u[2]/this.resolution),f=3;break;case"MultiPolygon":let P=e.getFlatInteriorPoints();u=[];for(let F=0,D=P.length;F<D;F+=3)o.overflow||d.push(P[F+2]/this.resolution),u.push(P[F],P[F+1]);if(u.length===0)return;f=2;break;default:}let A=this.appendFlatPointCoordinates(u,f);if(A===l)return;if(d&&(A-l)/2!==u.length/f){let P=l/2;d=d.filter((F,D)=>{let L=a[(P+D)*2]===u[D*f]&&a[(P+D)*2+1]===u[D*f+1];return L||--P,L})}this.saveTextStates_();let y=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,w=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(e,t,n);let S=o.padding;if(S!=sd&&(o.scale[0]<0||o.scale[1]<0)){let P=o.padding[0],F=o.padding[1],D=o.padding[2],L=o.padding[3];o.scale[0]<0&&(F=-F,L=-L),o.scale[1]<0&&(P=-P,D=-D),S=[P,F,D,L]}let T=this.pixelRatio;this.instructions.push([vn.DRAW_IMAGE,l,A,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,S==sd?sd:S.map(function(P){return P*T}),y,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);let R=1/T,I=y?y.slice(0):null;I&&(I[1]=io),this.hitDetectionInstructions.push([vn.DRAW_IMAGE,l,A,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[R,R],NaN,this.declutterMode_,this.declutterImageWithText_,S,I,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?io:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(t)}}saveTextStates_(){let e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));let s=this.textKey_;s in this.textStates||(this.textStates[s]={font:t.font,textAlign:t.textAlign||Fp,justify:t.justify,textBaseline:t.textBaseline||gA,scale:t.scale});let o=this.fillKey_;n&&(o in this.fillStates||(this.fillStates[o]={fillStyle:n.fillStyle}))}drawChars_(e,t){let n=this.textStrokeState_,r=this.textState_,s=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();let l=this.pixelRatio,c=g2[r.textBaseline],u=this.textOffsetX_*l,f=this.textOffsetY_*l,d=this.text_,A=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([vn.DRAW_CHARS,e,t,c,r.overflow,a,r.maxAngle,l,f,s,A*l,d,o,1,this.declutterMode_,this.textKeepUpright_,u]),this.hitDetectionInstructions.push([vn.DRAW_CHARS,e,t,c,r.overflow,a&&io,r.maxAngle,l,f,s,A*l,d,o,1/l,this.declutterMode_,this.textKeepUpright_,u])}setTextStyle(e,t){let n,r,s;if(!e)this.text_="";else{let o=e.getFill();o?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=gl(o.getColor()||io)):(r=null,this.textFillState_=r);let a=e.getStroke();if(!a)s=null,this.textStrokeState_=s;else{s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);let w=a.getLineDash(),S=a.getLineDashOffset(),T=a.getWidth(),R=a.getMiterLimit();s.lineCap=a.getLineCap()||gh,s.lineDash=w?w.slice():vl,s.lineDashOffset=S===void 0?_l:S,s.lineJoin=a.getLineJoin()||vh,s.lineWidth=T===void 0?od:T,s.miterLimit=R===void 0?rd:R,s.strokeStyle=gl(a.getColor()||ia)}n=this.textState_;let l=e.getFont()||UE;xX(l);let c=e.getScaleArray();n.overflow=e.getOverflow(),n.font=l,n.maxAngle=e.getMaxAngle(),n.placement=e.getPlacement(),n.textAlign=e.getTextAlign(),n.repeat=e.getRepeat(),n.justify=e.getJustify(),n.textBaseline=e.getTextBaseline()||gA,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||sd,n.scale=c===void 0?[1,1]:c;let u=e.getOffsetX(),f=e.getOffsetY(),d=e.getRotateWithView(),A=e.getKeepUpright(),y=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=u===void 0?0:u,this.textOffsetY_=f===void 0?0:f,this.textRotateWithView_=d===void 0?!1:d,this.textKeepUpright_=A===void 0?!0:A,this.textRotation_=y===void 0?0:y,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:Bn(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=n.font+n.scale+(n.textAlign||"?")+(n.repeat||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle=="string"?r.fillStyle:"|"+Bn(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},hY=G6;var vme={Circle:k6,Default:Sh,Image:oY,LineString:aY,Polygon:k6,Text:hY},q6=class{constructor(e,t,n,r){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=r,this.resolution_=n,this.buildersByZIndex_={}}finish(){let e={};for(let t in this.buildersByZIndex_){e[t]=e[t]||{};let n=this.buildersByZIndex_[t];for(let r in n){let s=n[r].finish();e[t][r]=s}}return e}getBuilder(e,t){let n=e!==void 0?e.toString():"0",r=this.buildersByZIndex_[n];r===void 0&&(r={},this.buildersByZIndex_[n]=r);let s=r[t];if(s===void 0){let o=vme[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},fY=q6;function w3(i,e,t,n,r,s,o,a){o=o??[],a=a??n;let l=i[e+n],c=i[e+n+1],u=i[t-2*n],f=i[t-2*n+1],d,A,y,w,S,T,R,I,P=0;for(let F=e;F<t;F+=n){y=d,w=A,S=void 0,T=void 0,F+n<t&&(S=i[F+n],T=i[F+n+1]),s&&F===e&&(y=u,w=f),s&&F===t-n&&(S=l,T=c),d=i[F],A=i[F+1],[R,I]=_me(d,A,y,w,S,T,r),o[P++]=R,o[P++]=I;for(let D=2;D<a;D++)o[P++]=i[F+D]}return o.length!=P&&(o.length=P),o}function _me(i,e,t,n,r,s,o){let a,l;t!==void 0&&n!==void 0?(a=i-t,l=e-n):r!==void 0&&s!==void 0?(a=r-i,l=s-e):(a=1,l=0);let c=Math.hypot(a,l),u=a/c,f=l/c;if(a=-f,l=u,t===void 0||n===void 0)return[i+a*o,e+l*o];if(r===void 0||s===void 0)return[i+a*o,e+l*o];let d=IW([i,e],[t,n],[r,s]);if(Math.cos(d)>.998)return[i+u*o,e+f*o];let A=Math.cos(d/2),y=Math.sin(d/2),w=y*a+A*l,S=-A*a+y*l,T=w*(1/y),R=S*(1/y);return[i+T*o,e+R*o]}function S3(i,e,t=!1){for(let n=0,r=i.length-2;n<r;n+=e){let s=t&&n===0?i.length-3*e:i.length-2*e;for(let o=s;o>n+e;o-=e){let a=i[n],l=i[n+1],c=i[n+e],u=i[n+e+1],f=i[o],d=i[o+1],A=i[o+e],y=i[o+e+1],w=(y-d)*(c-a)-(A-f)*(u-l);if(w===0)continue;let S=((A-f)*(l-d)-(y-d)*(a-f))/w,T=((c-a)*(l-d)-(u-l)*(a-f))/w;if(S>0&&S<1&&T>0&&T<1){let R=a+S*(c-a),I=l+S*(u-l);i[n+e]=R,i[n+e+1]=I,i.splice(n+2*e,o-n-e);break}}}return i}var H6;function xme(){return H6||(H6=new Intl.Segmenter(void 0,{granularity:"grapheme"})),H6}function dY(i,e,t,n,r,s,o,a,l,c,u,f,d=!0){let A=i[e],y=i[e+1],w=0,S=0,T=0,R=0;function I(){w=A,S=y,e+=n,A=i[e],y=i[e+1],R+=T,T=Math.sqrt((A-w)*(A-w)+(y-S)*(y-S))}do I();while(e<t-n&&R+T<s);let P=T===0?0:(s-R)/T,F=Lo(w,A,P),D=Lo(S,y,P),L=e-n,C=R,B=s+a*l(c,r,u);for(;e<t-n&&R+T<B;)I();P=T===0?0:(B-R)/T;let k=Lo(w,A,P),z=Lo(S,y,P),G=!1;if(d)if(f){let te=[F,D,k,z];xE(te,0,4,2,f,te,te),G=te[0]>te[2]}else G=F>k;let W=Math.PI,Y=[],H=L+n===e;e=L,T=0,R=C,A=i[e],y=i[e+1];let $;if(H){I(),$=Math.atan2(y-S,A-w),G&&($+=$>0?-W:W);let te=(k+F)/2,ce=(z+D)/2;return Y[0]=[te,ce,(B-s)/2,$,r],Y}r=r.replace(/\n/g," ");let J=Array.from(xme().segment(r),te=>te.segment);for(let te=0,ce=J.length;te<ce;){I();let he=Math.atan2(y-S,A-w);if(G&&(he+=he>0?-W:W),$!==void 0){let Ee=he-$;if(Ee+=Ee>W?-2*W:Ee<-W?2*W:0,Math.abs(Ee)>o)return null}$=he;let ve=te,Re=0;for(;te<ce;++te){let Ee=G?ce-te-1:te,Ve=a*l(c,J[Ee],u);if(e+n<t&&R+T<s+Re+Ve/2)break;Re+=Ve}if(te===ve)continue;let Qe=(G?J.slice(ce-te,ce-ve):J.slice(ve,te)).join("");P=T===0?0:(s+Re/2-R)/T;let Fe=Lo(w,A,P),mt=Lo(S,y,P);Y.push([Fe,mt,Re/2,he,Qe]),s+=Re}return Y}var Mv=Wr(),Gp=[],md=[],Ad=[],qp=[];function pY(i){return i[3].declutterBox}var mY=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function W6(i,e){return e==="start"?e=mY.test(i)?"right":"left":e==="end"&&(e=mY.test(i)?"left":"right"),g2[e]}function yme(i,e,t){return t>0&&i.push(`8+`,""),i.push(e,""),i}function bme(i,e,t){return t%2===0&&(i+=e),i}var j6=class{constructor(e,t,n,r,s){this.overlaps=n,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=go(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=s?new x3:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,n,r){let s=e+t+n+r;if(this.labels_[s])return this.labels_[s];let o=r?this.strokeStates[r]:null,a=n?this.fillStates[n]:null,l=this.textStates[t],c=this.pixelRatio,u=[l.scale[0]*c,l.scale[1]*c],f=l.justify?g2[l.justify]:W6(Array.isArray(e)?e[0]:e,l.textAlign||Fp),d=r&&o.lineWidth?o.lineWidth:0,A=Array.isArray(e)?e:String(e).split(`9+`).reduce(yme,[]),{width:y,height:w,widths:S,heights:T,lineWidths:R}=wX(l,A),I=y+d,P=[],F=(I+2)*u[0],D=(w+d)*u[1],L={width:F<0?Math.floor(F):Math.ceil(F),height:D<0?Math.floor(D):Math.ceil(D),contextInstructions:P};(u[0]!=1||u[1]!=1)&&P.push("scale",u),r&&(P.push("strokeStyle",o.strokeStyle),P.push("lineWidth",d),P.push("lineCap",o.lineCap),P.push("lineJoin",o.lineJoin),P.push("miterLimit",o.miterLimit),P.push("setLineDash",[o.lineDash]),P.push("lineDashOffset",o.lineDashOffset)),n&&P.push("fillStyle",a.fillStyle),P.push("textBaseline","middle"),P.push("textAlign","center");let C=.5-f,B=f*I+C*d,k=[],z=[],G=0,W=0,Y=0,H=0,$;for(let J=0,te=A.length;J<te;J+=2){let ce=A[J];if(ce===`10+`){W+=G,G=0,B=f*I+C*d,++H;continue}let he=A[J+1]||l.font;he!==$&&(r&&k.push("font",he),n&&z.push("font",he),$=he),G=Math.max(G,T[Y]);let ve=[ce,B+C*S[Y]+f*(S[Y]-R[H]),.5*(d+G)+W];B+=S[Y],r&&k.push("strokeText",ve),n&&z.push("fillText",ve),++Y}return Array.prototype.push.apply(P,k),Array.prototype.push.apply(P,z),this.labels_[s]=L,L}replayTextBackground_(e,t,n,r,s,o,a){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,n),e.lineTo.apply(e,r),e.lineTo.apply(e,s),e.lineTo.apply(e,t),o&&(this.alignAndScaleFill_=o[2],e.fillStyle=o[1],this.fill_(e)),a&&(this.setStrokeStyle_(e,a),e.stroke())}calculateImageOrLabelDimensions_(e,t,n,r,s,o,a,l,c,u,f,d,A,y,w,S){a*=d[0],l*=d[1];let T=n-a,R=r-l,I=s+c>e?e-c:s,P=o+u>t?t-u:o,F=y[3]+I*d[0]+y[1],D=y[0]+P*d[1]+y[2],L=T-y[3],C=R-y[0];(w||f!==0)&&(Gp[0]=L,qp[0]=L,Gp[1]=C,md[1]=C,md[0]=L+F,Ad[0]=md[0],Ad[1]=C+D,qp[1]=Ad[1]);let B;return f!==0?(B=No(go(),n,r,1,1,f,-n,-r),jr(B,Gp),jr(B,md),jr(B,Ad),jr(B,qp),ql(Math.min(Gp[0],md[0],Ad[0],qp[0]),Math.min(Gp[1],md[1],Ad[1],qp[1]),Math.max(Gp[0],md[0],Ad[0],qp[0]),Math.max(Gp[1],md[1],Ad[1],qp[1]),Mv)):ql(Math.min(L,L+F),Math.min(C,C+D),Math.max(L,L+F),Math.max(C,C+D),Mv),A&&(T=Math.round(T),R=Math.round(R)),{drawImageX:T,drawImageY:R,drawImageW:I,drawImageH:P,originX:c,originY:u,declutterBox:{minX:Mv[0],minY:Mv[1],maxX:Mv[2],maxY:Mv[3],value:S},canvasTransform:B,scale:d}}replayImageOrLabel_(e,t,n,r,s,o,a){let l=!!(o||a),c=r.declutterBox,u=a?a[2]*r.scale[0]/2:0;return c.minX-u<=t[0]&&c.maxX+u>=0&&c.minY-u<=t[1]&&c.maxY+u>=0&&(l&&this.replayTextBackground_(e,Gp,md,Ad,qp,o,a),SX(e,r.canvasTransform,s,n,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(e){let t=this.alignAndScaleFill_;if(t){let n=jr(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;e.save(),e.translate(n[0]%r,n[1]%r),t!==1&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,n,r){let s=this.textStates[t],o=this.createLabel(e,t,r,n),a=this.strokeStates[n],l=this.pixelRatio,c=W6(Array.isArray(e)?e[0]:e,s.textAlign||Fp),u=g2[s.textBaseline||gA],f=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*s.scale[0],A=c*d+2*(.5-c)*f,y=u*o.height/l+2*(.5-u)*f;return{label:o,anchorX:A,anchorY:y}}execute_(e,t,n,r,s,o,a,l){let c=this.zIndexContext_,u;this.pixelCoordinates_&&ta(n,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=ml(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),Mj(this.renderedTransform_,n));let f=0,d=r.length,A=0,y,w=[],S,T,R,I,P,F,D,L,C,B,k,z,G,W=0,Y=0,H=this.coordinateCache_,$=this.viewRotation_,J=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,te={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:$},ce=this.instructions!=r||this.overlaps?0:200,he,ve,Re,Qe;for(;f<d;){let Fe=r[f];switch(Fe[0]){case vn.BEGIN_GEOMETRY:he=Fe[1],Qe=Fe[3],he.getGeometry()?a!==void 0&&!Ar(a,Qe.getExtent())?f=Fe[2]+1:++f:f=Fe[2],c&&(c.zIndex=Fe[4]);break;case vn.BEGIN_PATH:W>ce&&(this.fill_(e),W=0),Y>ce&&(e.stroke(),Y=0),!W&&!Y&&(e.beginPath(),P=NaN,F=NaN),++f;break;case vn.CIRCLE:A=Fe[1],R=Fe[2]??0;let Ee=u[A],Ve=u[A+1],Ye=u[A+2]-R,Mt=u[A+3]-R,Et=Ye-Ee,Pt=Mt-Ve,dn=Math.sqrt(Et*Et+Pt*Pt);e.moveTo(Ee+dn,Ve),e.arc(Ee,Ve,dn,0,2*Math.PI,!0),++f;break;case vn.CLOSE_PATH:e.closePath(),++f;break;case vn.CUSTOM:A=Fe[1],y=Fe[2];let Gt=Fe[3],$e=Fe[4],ot=Fe[5];te.geometry=Gt,te.feature=he,f in H||(H[f]=[]);let nt=H[f];ot?ot(u,A,y,2,nt):(nt[0]=u[A],nt[1]=u[A+1],nt.length=2),c&&(c.zIndex=Fe[6]),$e(nt,te),++f;break;case vn.DRAW_IMAGE:A=Fe[1],y=Fe[2],C=Fe[3],S=Fe[4],T=Fe[5];let bt=Fe[6],yt=Fe[7],hn=Fe[8],en=Fe[9],tn=Fe[10],bn=Fe[11],_e=Fe[12],vi=Fe[13];I=Fe[14]||"declutter";let zn=Fe[15];if(!C&&Fe.length>=20){B=Fe[19],k=Fe[20],z=Fe[21],G=Fe[22];let Fn=this.drawLabelWithPointPlacement_(B,k,z,G);C=Fn.label,Fe[3]=C;let rs=Fe[23];S=(Fn.anchorX-rs)*this.pixelRatio,Fe[4]=S;let Lr=Fe[24];T=(Fn.anchorY-Lr)*this.pixelRatio,Fe[5]=T,bt=C.height,Fe[6]=bt,vi=C.width,Fe[13]=vi}let le;Fe.length>25&&(le=Fe[25]);let Z,Te,Ie;Fe.length>17?(Z=Fe[16],Te=Fe[17],Ie=Fe[18]):(Z=sd,Te=null,Ie=null),tn&&J?bn+=$:!tn&&!J&&(bn-=$);let Ge=0;for(;A<y;A+=2){if(le&&le[Ge++]<vi/this.pixelRatio)continue;let Fn=this.calculateImageOrLabelDimensions_(C.width,C.height,u[A],u[A+1],vi,bt,S,T,hn,en,bn,_e,s,Z,!!Te||!!Ie,he),rs=[e,t,C,Fn,yt,Te,Ie];if(l){let Lr,Fl,Sa;if(zn){let xr=y-A;if(!zn[xr]){zn[xr]={args:rs,declutterMode:I};continue}let Zs=zn[xr];Lr=Zs.args,Fl=Zs.declutterMode,delete zn[xr],Sa=pY(Lr)}let Bl,rl;if(Lr&&(Fl!=="declutter"||!l.collides(Sa))&&(Bl=!0),(I!=="declutter"||!l.collides(Fn.declutterBox))&&(rl=!0),Fl==="declutter"&&I==="declutter"){let xr=Bl&&rl;Bl=xr,rl=xr}Bl&&(Fl!=="none"&&l.insert(Sa),this.replayImageOrLabel_.apply(this,Lr)),rl&&(I!=="none"&&l.insert(Fn.declutterBox),this.replayImageOrLabel_.apply(this,rs))}else this.replayImageOrLabel_.apply(this,rs)}++f;break;case vn.DRAW_CHARS:let vt=Fe[1],Tt=Fe[2],qe=Fe[3],Je=Fe[4];G=Fe[5];let It=Fe[6],rn=Fe[7],Lt=Fe[8];z=Fe[9];let Rt=Fe[10];B=Fe[11],Array.isArray(B)&&(B=B.reduce(bme,"")),k=Fe[12];let fn=[Fe[13],Fe[13]];I=Fe[14]||"declutter";let wn=Fe[15],Dn=Fe[16],ye=this.textStates[k],wt=ye.font,Ze=[ye.scale[0]*rn,ye.scale[1]*rn],St;wt in this.widths_?St=this.widths_[wt]:(St={},this.widths_[wt]=St);let Bt=dv(u,vt,Tt,2),ut=Math.abs(Ze[0])*YN(wt,B,St);if(Je||ut<=Bt){let Fn=this.textStates[k].textAlign,rs=(Bt-ut)*W6(B,Fn),Lr=dY(u,vt,Tt,2,B,rs,It,Math.abs(Ze[0]),YN,wt,St,J?0:this.viewRotation_,wn);e:if(Lr){let Fl=[],Sa,Bl,rl,xr,Zs;if(z)for(Sa=0,Bl=Lr.length;Sa<Bl;++Sa){Zs=Lr[Sa],rl=Zs[4],xr=this.createLabel(rl,k,"",z),S=Zs[2]+(Ze[0]<0?-Rt:Rt)-Dn,T=qe*xr.height+(.5-qe)*2*Rt*Ze[1]/Ze[0]-Lt;let Ol=this.calculateImageOrLabelDimensions_(xr.width,xr.height,Zs[0],Zs[1],xr.width,xr.height,S,T,0,0,Zs[3],fn,!1,sd,!1,he);if(l&&I==="declutter"&&l.collides(Ol.declutterBox))break e;Fl.push([e,t,xr,Ol,1,null,null])}if(G)for(Sa=0,Bl=Lr.length;Sa<Bl;++Sa){Zs=Lr[Sa],rl=Zs[4],xr=this.createLabel(rl,k,G,""),S=Zs[2]-Dn,T=qe*xr.height-Lt;let Ol=this.calculateImageOrLabelDimensions_(xr.width,xr.height,Zs[0],Zs[1],xr.width,xr.height,S,T,0,0,Zs[3],fn,!1,sd,!1,he);if(l&&I==="declutter"&&l.collides(Ol.declutterBox))break e;Fl.push([e,t,xr,Ol,1,null,null])}l&&I!=="none"&&l.load(Fl.map(pY));for(let Ol=0,nh=Fl.length;Ol<nh;++Ol)this.replayImageOrLabel_.apply(this,Fl[Ol])}}++f;break;case vn.END_GEOMETRY:if(o!==void 0){he=Fe[1];let Fn=o(he,Qe,I);if(Fn)return Fn}++f;break;case vn.FILL:ce?W++:this.fill_(e),++f;break;case vn.MOVE_TO_LINE_TO:A=Fe[1],y=Fe[2],R=Fe[3];let Ce,Yt,nr;if(R){let rs=(Fe[4]??!1)||Math.abs(u[A]-u[y-2])<1e-6&&Math.abs(u[A+1]-u[y-1])<1e-6;w3(u,A,y,2,R,rs,w),S3(w,2,rs),Ce=w,Yt=0,nr=Ce.length}else Ce=u,Yt=A,nr=y;ve=Ce[Yt],Re=Ce[Yt+1],e.moveTo(ve,Re),P=ve+.5|0,F=Re+.5|0;for(let Fn=Yt+2;Fn<nr;Fn+=2)ve=Ce[Fn],Re=Ce[Fn+1],D=ve+.5|0,L=Re+.5|0,(Fn==nr-2||D!==P||L!==F)&&(e.lineTo(ve,Re),P=D,F=L);++f;break;case vn.SET_FILL_STYLE:this.alignAndScaleFill_=Fe[2],W?(this.fill_(e),W=0,Y&&(e.stroke(),Y=0)):Y&&Fe[1]&&(e.stroke(),Y=0),e.fillStyle=Fe[1],++f;break;case vn.SET_STROKE_STYLE:W&&Fe[1]&&(this.fill_(e),W=0),Y&&(e.stroke(),Y=0),this.setStrokeStyle_(e,Fe),++f;break;case vn.STROKE:ce?Y++:e.stroke(),++f;break;default:++f;break}}W&&this.fill_(e),Y&&e.stroke()}execute(e,t,n,r,s,o){this.viewRotation_=r,this.execute_(e,t,n,this.instructions,s,void 0,void 0,o)}executeHitDetection(e,t,n,r,s){return this.viewRotation_=n,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,r,s)}},AY=j6;var Hp=["Polygon","Circle","LineString","Image","Text","Default"],Y6=["Image","Text"],gY=Hp.filter(i=>!Y6.includes(i)),vY=!1,_Y=!1;function wme(){let i=0,e=n=>{let r=Di(1,1,null,{willReadFrequently:n}),s=0,o=performance.now();for(;performance.now()-o<50;++s)r.fillStyle=`rgba(255,0,${s%256},1)`,r.fillRect(0,0,1,1),r.getImageData(0,0,1,1);return i=s>i?s:i,s};vY={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],_Y=!0}var $6=class{constructor(e,t,n,r,s,o,a){this.maxExtent_=e,this.overlaps_=r,this.pixelRatio_=n,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=go(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,a)}clip(e,t){let n=this.getClipCoords(t);e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(n[2],n[3]),e.lineTo(n[4],n[5]),e.lineTo(n[6],n[7]),e.clip()}createExecutors_(e,t){for(let n in e){let r=this.executorsByZIndex_[n];r===void 0&&(r={},this.executorsByZIndex_[n]=r);let s=e[n];for(let o in s){let a=s[o];r[o]=new AY(this.resolution_,this.pixelRatio_,this.overlaps_,a,t)}}}hasExecutors(e){for(let t in this.executorsByZIndex_){let n=this.executorsByZIndex_[t];for(let r=0,s=e.length;r<s;++r)if(e[r]in n)return!0}return!1}forEachFeatureAtCoordinate(e,t,n,r,s,o){_Y===!1&&wme(),r=Math.round(r);let a=r*2+1,l=No(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Di(a,a,null,{willReadFrequently:vY}));let u=this.hitDetectionContext_;u.canvas.width!==a||u.canvas.height!==a?(u.canvas.width=a,u.canvas.height=a):c||u.clearRect(0,0,a,a);let f;this.renderBuffer_!==void 0&&(f=Wr(),Qm(f,e),G1(f,t*(this.renderBuffer_+r),f));let d=Sme(r),A;function y(F,D,L){let C=u.getImageData(0,0,a,a).data;for(let B=0,k=d.length;B<k;B++)if(C[d[B]]>0){if(!o||L==="none"||A!=="Image"&&A!=="Text"||o.includes(F)){let z=(d[B]-3)/4,G=r-z%a,W=r-(z/a|0),Y=s(F,D,G*G+W*W);if(Y)return Y}u.clearRect(0,0,a,a);break}}let w=Object.keys(this.executorsByZIndex_).map(Number);w.sort(pl);let S,T,R,I,P;for(S=w.length-1;S>=0;--S){let F=w[S].toString();for(R=this.executorsByZIndex_[F],T=Hp.length-1;T>=0;--T)if(A=Hp[T],I=R[A],I!==void 0&&(P=I.executeHitDetection(u,l,n,y,f),P))return P}}getClipCoords(e){let t=this.maxExtent_;if(!t)return null;let n=t[0],r=t[1],s=t[2],o=t[3],a=[n,r,n,o,s,o,s,r];return ml(a,0,8,2,e,a),a}isEmpty(){return Au(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?tj:pl),o=o||Hp;let c=Hp.length;for(let u=0,f=l.length;u<f;++u){let d=l[u].toString(),A=this.executorsByZIndex_[d];for(let y=0,w=o.length;y<w;++y){let S=o[y],T=A[S];if(T!==void 0){let R=a===null?void 0:T.getZIndexContext(),I=R?R.getContext():e,P=this.maxExtent_&&S!=="Image"&&S!=="Text";if(P&&(I.save(),this.clip(I,n)),!R||S==="Text"||S==="Image"?T.execute(I,t,n,r,s,a):R.pushFunction(F=>T.execute(F,t,n,r,s,a)),P&&I.restore(),R){R.offset();let F=l[u]*c+Hp.indexOf(S);this.deferredZIndexContexts_[F]||(this.deferredZIndexContexts_[F]=[]),this.deferredZIndexContexts_[F].push(R)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(pl);for(let n=0,r=t.length;n<r;++n)e[t[n]].forEach(s=>{s.draw(this.renderedContext_),s.clear()}),e[t[n]].length=0}},X6={};function Sme(i){if(X6[i]!==void 0)return X6[i];let e=i*2+1,t=i*i,n=new Array(t+1);for(let s=0;s<=i;++s)for(let o=0;o<=i;++o){let a=s*s+o*o;if(a>t)break;let l=n[a];l||(l=[],n[a]=l),l.push(((i+s)*e+(i+o))*4+3),s>0&&l.push(((i-s)*e+(i+o))*4+3),o>0&&(l.push(((i+s)*e+(i-o))*4+3),s>0&&l.push(((i-s)*e+(i-o))*4+3))}let r=[];for(let s=0,o=n.length;s<o;++s)n[s]&&r.push(...n[s]);return X6[i]=r,r}var xY=$6;var Z6=class extends b3{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?Jm(Math.atan2(r[1],r[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=go()}drawImages_(e,t,n,r){if(!this.image_)return;let s=ml(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let c=this.imageRotation_;this.transformRotation_===0&&(c-=this.viewRotation_),this.imageRotateWithView_&&(c+=this.viewRotation_);for(let u=0,f=s.length;u<f;u+=2){let d=s[u]-this.imageAnchorX_,A=s[u+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let y=d+this.imageAnchorX_,w=A+this.imageAnchorY_;No(a,y,w,1,1,c,-y,-w),o.save(),o.transform.apply(o,a),o.translate(y,w),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,A,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(e,t,n,r){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let s=ml(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);t<n;t+=r){let l=s[t]+this.textOffsetX_,c=s[t+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,c-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,c),this.textFillState_&&o.fillText(this.text_,l,c))}}moveToLineTo_(e,t,n,r,s,o){let a=this.context_,l=ml(e,t,n,r,this.transform_,this.pixelCoordinates_);if(Math.abs(o)>0){let u=l.length,f=s||Math.abs(l[0]-l[u-2])<1e-6&&Math.abs(l[1]-l[u-1])<1e-6;l=w3(l,0,u,2,o,f,l),S3(l,2,f)}a.moveTo(l[0],l[1]);let c=l.length;s&&(c-=2);for(let u=2;u<c;u+=2)a.lineTo(l[u],l[u+1]);return s&&a.closePath(),n}drawRings_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o)t=this.moveToLineTo_(e,t,n[o],r,!0,s);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ar(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=Xj(e,this.transform_,this.pixelCoordinates_),n=t[2]-t[0],r=t[3]-t[1],s=Math.sqrt(n*n+r*r),o=this.context_;o.beginPath(),o.arc(t[0],t[1],s,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e);break;default:}}drawFeature(e,t){let n=t.getGeometryFunction()(e);n&&(this.setStyle(t),this.drawGeometry(n))}drawGeometryCollection(e){let t=e.getGeometriesArray();for(let n=0,r=t.length;n<r;++n)this.drawGeometry(t[n])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ar(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(n,0,n.length,e.getStride(),!1,this.strokeState_.strokeOffset),t.stroke()}if(this.text_!==""){let t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getExtent();if(Ar(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let n=this.context_,r=e.getFlatCoordinates(),s=0,o=e.getEnds(),a=e.getStride();n.beginPath();for(let l=0,c=o.length;l<c;++l)s=this.moveToLineTo_(r,s,o[l],a,!1,this.strokeState_.strokeOffset);n.stroke()}if(this.text_!==""){let n=e.getFlatMidpoints();this.drawText_(n,0,n.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ar(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ar(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getOrientedFlatCoordinates(),r=0,s=e.getEndss(),o=e.getStride();t.beginPath();for(let a=0,l=s.length;a<l;++a){let c=s[a];r=this.drawRings_(n,r,c,o,this.strokeState_?.strokeOffset)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){let t=this.context_,n=this.contextFillState_;n?n.fillStyle!=e.fillStyle&&(n.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){let t=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=e.lineCap&&(n.lineCap=e.lineCap,t.lineCap=e.lineCap),ta(n.lineDash,e.lineDash)||t.setLineDash(n.lineDash=e.lineDash),n.lineDashOffset!=e.lineDashOffset&&(n.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),n.lineJoin!=e.lineJoin&&(n.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),n.lineWidth!=e.lineWidth&&(n.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),n.miterLimit!=e.miterLimit&&(n.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),n.strokeStyle!=e.strokeStyle&&(n.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){let t=this.context_,n=this.contextTextState_,r=e.textAlign?e.textAlign:Fp;n?(n.font!=e.font&&(n.font=e.font,t.font=e.font),n.textAlign!=r&&(n.textAlign=r,t.textAlign=r),n.textBaseline!=e.textBaseline&&(n.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=r,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:r,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{let n=e.getColor();this.fillState_={fillStyle:gl(n||io)}}if(!t)this.strokeState_=null;else{let n=t.getColor(),r=t.getLineCap(),s=t.getLineDash(),o=t.getLineDashOffset(),a=t.getLineJoin(),l=t.getWidth(),c=t.getMiterLimit(),u=s||vl,f=t.getOffset();this.strokeState_={lineCap:r!==void 0?r:gh,lineDash:this.pixelRatio_===1?u:u.map(d=>d*this.pixelRatio_),lineDashOffset:(o||_l)*this.pixelRatio_,lineJoin:a!==void 0?a:vh,lineWidth:(l!==void 0?l:od)*this.pixelRatio_,miterLimit:c!==void 0?c:rd,strokeStyle:gl(n||ia),strokeOffset:(f??0)*this.pixelRatio_}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}let n=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),s=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();let o=e.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/n,o[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(!e)this.text_="";else{let t=e.getFill();if(!t)this.textFillState_=null;else{let A=t.getColor();this.textFillState_={fillStyle:gl(A||io)}}let n=e.getStroke();if(!n)this.textStrokeState_=null;else{let A=n.getColor(),y=n.getLineCap(),w=n.getLineDash(),S=n.getLineDashOffset(),T=n.getLineJoin(),R=n.getWidth(),I=n.getMiterLimit();this.textStrokeState_={lineCap:y!==void 0?y:gh,lineDash:w||vl,lineDashOffset:S||_l,lineJoin:T!==void 0?T:vh,lineWidth:R!==void 0?R:od,miterLimit:I!==void 0?I:rd,strokeStyle:gl(A||ia)}}let r=e.getFont(),s=e.getOffsetX(),o=e.getOffsetY(),a=e.getRotateWithView(),l=e.getRotation(),c=e.getScaleArray(),u=e.getText(),f=e.getTextAlign(),d=e.getTextBaseline();this.textState_={font:r!==void 0?r:UE,textAlign:f!==void 0?f:Fp,textBaseline:d!==void 0?d:gA},this.text_=u!==void 0?Array.isArray(u)?u.reduce((A,y,w)=>A+=w%2?" ":y,""):u:"",this.textOffsetX_=s!==void 0?this.pixelRatio_*s:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}},yY=Z6;var Mu=.5;function bY(i,e,t,n,r,s,o,a,l){let c=l?Sp(r,l):r,u=i[0]*Mu,f=i[1]*Mu,d=Di(u,f);d.imageSmoothingEnabled=!1;let A=d.canvas,y=new yY(d,Mu,r,null,o,a,l?nA(rA(),l):null),w=t.length,S=Math.floor((256*256*256-1)/w),T={};for(let I=1;I<=w;++I){let P=t[I-1],F=P.getStyleFunction()||n;if(!F)continue;let D=F(P,s);if(!D)continue;Array.isArray(D)||(D=[D]);let C=(I*S).toString(16).padStart(7,"#00000");for(let B=0,k=D.length;B<k;++B){let z=D[B],G=z.getGeometryFunction()(P);if(!G||!Ar(c,G.getExtent()))continue;let W=z.clone(),Y=W.getFill();Y&&Y.setColor(C);let H=W.getStroke();H&&(H.setColor(C),H.setLineDash(null)),W.setText(void 0);let $=z.getImage();if($){let he=$.getImageSize();if(!he)continue;let ve=Di(he[0],he[1],void 0,{alpha:!1}),Re=ve.canvas;ve.fillStyle=C,ve.fillRect(0,0,Re.width,Re.height),W.setImage(new vA({img:Re,anchor:$.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:$.getOrigin(),opacity:1,size:$.getSize(),scale:$.getScale(),rotation:$.getRotation(),rotateWithView:$.getRotateWithView()}))}let J=W.getZIndex()||0,te=T[J];te||(te={},T[J]=te,te.Polygon=[],te.Circle=[],te.LineString=[],te.Point=[]);let ce=G.getType();if(ce==="GeometryCollection"){let he=G.getGeometriesArrayRecursive();for(let ve=0,Re=he.length;ve<Re;++ve){let Qe=he[ve];te[Qe.getType().replace("Multi","")].push(Qe,W)}}else te[ce.replace("Multi","")].push(G,W)}}let R=Object.keys(T).map(Number).sort(pl);for(let I=0,P=R.length;I<P;++I){let F=T[R[I]];for(let D in F){let L=F[D];for(let C=0,B=L.length;C<B;C+=2){y.setStyle(L[C+1]);for(let k=0,z=e.length;k<z;++k)y.setTransform(e[k]),y.drawGeometry(L[C])}}}return d.getImageData(0,0,A.width,A.height)}function wY(i,e,t){let n=[];if(t){let r=Math.floor(Math.round(i[0])*Mu),s=Math.floor(Math.round(i[1])*Mu),o=(Si(r,0,t.width-1)+Si(s,0,t.height-1)*t.width)*4,a=t.data[o],l=t.data[o+1],u=t.data[o+2]+256*(l+256*a),f=Math.floor((256*256*256-1)/e.length);u&&u%f===0&&n.push(e[u/f-1])}return n}var Tme=.5,SY={Point:Lme,LineString:Rme,Polygon:Nme,MultiPoint:Dme,MultiLineString:Pme,MultiPolygon:Ime,GeometryCollection:Cme,Circle:Eme};function TY(i,e){return parseInt(Bn(i),10)-parseInt(Bn(e),10)}function K6(i,e){let t=Q6(i,e);return t*t}function Q6(i,e){return Tme*i/e}function Eme(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(s||o){let l=i.getBuilder(t.getZIndex(),"Circle");l.setFillStrokeStyle(s,o),l.drawCircle(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}function J6(i,e,t,n,r,s,o,a){let l=[],c=t.getImage();if(c){let d=!0,A=c.getImageState();A==Pn.LOADED||A==Pn.ERROR?d=!1:A==Pn.IDLE&&c.load(),d&&l.push(c.ready())}let u=t.getFill();u&&u.loading()&&l.push(u.ready());let f=l.length>0;return f&&Promise.all(l).then(()=>r(null)),Mme(i,e,t,n,s,o,a),f}function Mme(i,e,t,n,r,s,o){let a=t.getGeometryFunction()(e);if(!a)return;let l=a.simplifyTransformed(n,r);if(t.getRenderer())EY(i,l,t,e,o);else{let u=SY[l.getType()];u(i,l,t,e,o,s)}}function EY(i,e,t,n,r){if(e.getType()=="GeometryCollection"){let o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)EY(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function Cme(i,e,t,n,r,s){let o=e.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=SY[o[a].getType()];c(i,o[a],t,n,r,s)}}function Rme(i,e,t,n,r){let s=t.getStroke();if(s){let a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawLineString(e,n,r)}let o=t.getText();if(o&&o.getText()){let a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,n,r)}}function Pme(i,e,t,n,r){let s=t.getStroke();if(s){let a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawMultiLineString(e,n,r)}let o=t.getText();if(o&&o.getText()){let a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,n,r)}}function Ime(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(o||s){let l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawMultiPolygon(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}function Lme(i,e,t,n,r,s){let o=t.getImage(),a=t.getText(),l=a&&a.getText(),c=s&&o&&l?{}:void 0;if(o){if(o.getImageState()!=Pn.LOADED)return;let u=i.getBuilder(t.getZIndex(),"Image");u.setImageStyle(o,c),u.drawPoint(e,n,r)}if(l){let u=i.getBuilder(t.getZIndex(),"Text");u.setTextStyle(a,c),u.drawText(e,n,r)}}function Dme(i,e,t,n,r,s){let o=t.getImage(),a=o&&o.getOpacity()!==0,l=t.getText(),c=l&&l.getText(),u=s&&a&&c?{}:void 0;if(a){if(o.getImageState()!=Pn.LOADED)return;let f=i.getBuilder(t.getZIndex(),"Image");f.setImageStyle(o,u),f.drawMultiPoint(e,n,r)}if(c){let f=i.getBuilder(t.getZIndex(),"Text");f.setTextStyle(l,u),f.drawText(e,n,r)}}function Nme(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(s||o){let l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawPolygon(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}var e8=class extends y3{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Wr(),this.wrappedRenderedExtent_=Wr(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(e,t,n){let r=t.extent,s=t.viewState,o=s.center,a=s.resolution,l=s.projection,c=s.rotation,u=l.getExtent(),f=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),A=t.pixelRatio,y=t.viewHints,w=!(y[so.ANIMATING]||y[so.INTERACTING]),S=this.context,T=Math.round(Kn(r)/a*A),R=Math.round(Nr(r)/a*A),I=f.getWrapX()&&l.canWrapX(),P=I?Kn(u):null,F=I?Math.ceil((r[2]-u[2])/P)+(this.extendX_?2:1):1,D=I?Math.floor((r[0]-u[0])/P)-(this.extendX_?1:0):0;do{let L=this.getRenderTransform(o,a,0,A,T,R,D*P);t.declutter&&(L=L.slice(0)),e.execute(S,[S.canvas.width,S.canvas.height],L,c,w,n===void 0?Hp:n?Y6:gY,n?d&&t.declutter[d]:void 0)}while(++D<F)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Di(this.context.canvas.width,this.context.canvas.height,M6))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){let e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,lA(this.context),M6.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,e,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(e,t){let n=e.layerStatesArray[e.layerIndex];this.opacity_=n.opacity;let r=e.viewState;this.prepareContainer(e,t);let s=this.context,o=this.replayGroup_,a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(Oo.PRERENDER)||this.getLayer().hasListener(Oo.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(s,e);let l=r.projection;this.clipExtent_=null;let c=!1;if(a&&n.extent&&this.clipping){let u=_u(n.extent,l);a=Ar(u,e.extent),a&&!ch(u,e.extent)&&(e.declutter?this.clipExtent_=u:(this.clipUnrotated(s,e,u),c=!0))}return a&&this.renderWorlds(o,e,this.getLayer().getDeclutter()?!1:void 0),c&&s.restore(),this.postRender(s,e),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let n=this.frameState.size.slice(),r=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,c=this.getLayer(),u=[],f=n[0]*Mu,d=n[1]*Mu;u.push(this.getRenderTransform(r,s,o,Mu,f,d,0).slice());let A=c.getSource(),y=a.getExtent();if(A.getWrapX()&&a.canWrapX()&&!ch(y,l)){let S=l[0],T=Kn(y),R=0,I;for(;S<y[0];)--R,I=T*R,u.push(this.getRenderTransform(r,s,o,Mu,f,d,I).slice()),S+=T;for(R=0,S=l[2];S>y[2];)++R,I=T*R,u.push(this.getRenderTransform(r,s,o,Mu,f,d,I).slice()),S-=T}let w=rA();this.hitDetectionImageData_=bY(n,u,this.renderedFeatures_,c.getStyleFunction(),l,s,o,K6(s,this.renderedPixelRatio_),w?a:null)}t(wY(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,n,r,s){if(!this.replayGroup_)return;let o=t.viewState.resolution,a=t.viewState.rotation,l=this.getLayer(),c={},u=function(d,A,y){let w=Bn(d),S=c[w];if(S){if(S!==!0&&y<S.distanceSq){if(y===0)return c[w]=!0,s.splice(s.lastIndexOf(S),1),r(d,l,A);S.geometry=A,S.distanceSq=y}}else{if(y===0)return c[w]=!0,r(d,l,A);s.push(c[w]={feature:d,layer:l,geometry:A,distanceSq:y,callback:r})}},f=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,o,a,n,u,f?t.declutter?.[f]?.all().map(d=>d.value):null)}handleFontsChanged(){let e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){let t=this.getLayer(),n=t.getSource();if(!n)return!1;let r=e.viewHints[so.ANIMATING],s=e.viewHints[so.INTERACTING],o=t.getUpdateWhileAnimating(),a=t.getUpdateWhileInteracting();if(this.ready&&!o&&r||!a&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let l=e.extent,c=e.viewState,u=c.projection,f=c.resolution,d=e.pixelRatio,A=t.getRevision(),y=t.getRenderBuffer(),w=t.getRenderOrder();w===void 0&&(w=TY);let S=c.center.slice(),T=G1(l,y*f),R=T.slice(),I=[T.slice()],P=u.getExtent(),F=n.getWrapX()&&u.canWrapX();if(this.extendX_=!1,F){let $=n.getExtent();$&&!hh($)&&(this.extendX_=$[0]<P[0]||$[2]>P[2])}if(F&&(!ch(P,e.extent)||this.extendX_)){let $=Kn(P),J=Math.max(Kn(T)/2,$),te=P[0],ce=P[2];this.extendX_&&(te-=$,ce+=$),T[0]=te-J,T[2]=ce+J,YT(S,u);let he=PD(I[0],u);he[0]<P[0]&&he[2]<P[2]?I.push([he[0]+$,he[1],he[2]+$,he[3]]):he[0]>P[0]&&he[2]>P[2]&&I.push([he[0]-$,he[1],he[2]-$,he[3]])}if(this.ready&&this.renderedResolution_==f&&this.renderedPixelRatio_===d&&this.renderedRevision_==A&&this.renderedRenderOrder_==w&&this.renderedFrameDeclutter_===!!e.declutter&&ch(this.wrappedRenderedExtent_,T))return ta(this.renderedExtent_,R)||(this.hitDetectionImageData_=null,this.renderedExtent_=R),this.renderedCenter_=S,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let D=new fY(Q6(f,d),T,f,d),L=rA(),C;if(L){for(let $=0,J=I.length;$<J;++$){let te=I[$],ce=Sp(te,u);n.loadFeatures(ce,QW(f,u),L)}C=nA(L,u)}else for(let $=0,J=I.length;$<J;++$)n.loadFeatures(I[$],f,u);let B=K6(f,d),k=!0,z=($,J)=>{let te,ce=$.getStyleFunction()||t.getStyleFunction();if(ce&&(te=ce($,f)),te){let he=this.renderFeature($,B,te,D,C,this.getLayer().getDeclutter(),J);k=k&&!he}},G=Sp(T,u),W=n.getFeaturesInExtent(G);w&&W.sort(w);for(let $=0,J=W.length;$<J;++$)z(W[$],$);this.renderedFeatures_=W,this.ready=k;let Y=D.finish(),H=new xY(T,f,d,n.getOverlaps(),Y,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=f,this.renderedRevision_=A,this.renderedRenderOrder_=w,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=R,this.wrappedRenderedExtent_=T,this.renderedCenter_=S,this.renderedProjection_=u,this.renderedPixelRatio_=d,this.replayGroup_=H,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,n,r,s,o,a){if(!n)return!1;let l=!1;if(Array.isArray(n))for(let c=0,u=n.length;c<u;++c)l=J6(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=J6(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}},MY=e8;var t8=class extends g3{constructor(e){super(e)}createRenderer(){return new MY(this)}},CY=t8;var Fme=!1;function Bme(i,e,t,n,r,s,o){let a=new XMLHttpRequest;a.open("GET",typeof i=="function"?i(t,n,r):i,!0),e.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=Fme,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){let c=e.getType();try{let u;c=="text"||c=="json"?u=a.responseText:c=="xml"?u=a.responseXML||a.responseText:c=="arraybuffer"&&(u=a.response),u?s(e.readFeatures(u,{extent:t,featureProjection:r}),e.readProjection(u)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function n8(i,e){return function(t,n,r,s,o){Bme(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function RY(i,e){return[[-1/0,-1/0,1/0,1/0]]}var PY=go(),v2=class i{constructor(e,t,n,r,s,o){this.styleFunction,this.extent_,this.id_=o,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=s,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?GT(this.flatCoordinates_):q1(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=dl(this.getExtent());this.flatInteriorPoints_=qy(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=aX(this.flatCoordinates_,this.ends_),t=CE(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=TE(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=_A(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];let e=this.flatCoordinates_,t=0,n=this.ends_;for(let r=0,s=n.length;r<s;++r){let o=n[r],a=_A(e,t,o,this.stride_,.5);Do(this.flatMidpoints_,a),t=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=Os(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let r=Nr(n)/Nr(t);No(PY,n[0],n[3],r,-r,0,0,0),ml(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,PY,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new i(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=lE((e,t)=>{if(e===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),t&&this.simplifiedGeometry_.applyTransform(t);let n=this.simplifiedGeometry_.getFlatCoordinates(),r;switch(this.type_){case"LineString":n.length=pA(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=SE(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=Gy(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(e),n,0,r);break;default:}return r&&(this.simplifiedGeometry_=new i(this.type_,n,r,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=e,this.simplifiedGeometry_}),this}};v2.prototype.getFlatCoordinates=v2.prototype.getOrientedFlatCoordinates;var MA=v2;var i8=class{constructor(e){this.rbush_=new SA(e),this.items_={}}insert(e,t){let n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(n),this.items_[Bn(t)]=n}load(e,t){let n=new Array(t.length);for(let r=0,s=t.length;r<s;r++){let o=e[r],a=t[r],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};n[r]=l,this.items_[Bn(a)]=l}this.rbush_.load(n)}remove(e){let t=Bn(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[Bn(t)],r=[n.minX,n.minY,n.maxX,n.maxY];Km(r,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){let t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(r){return r.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let n;for(let r=0,s=e.length;r<s;r++)if(n=t(e[r]),n)return n;return n}isEmpty(){return Au(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return ql(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(let t in e.items_)this.items_[t]=e.items_[t]}},r8=i8;var $l={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Th=class extends Ao{constructor(e,t,n){super(e),this.feature=t,this.features=n}},s8=class extends gE{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:e.wrapX!==void 0?e.wrapX:!0}),this.on,this.once,this.un,this.loader_=td,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&(jn(this.format_,"`format` must be set when `url` is set"),this.loader_=n8(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:RY;let t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new r8:null,this.loadedExtentsRtree_=new r8,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,r;Array.isArray(e.features)?r=e.features:e.features&&(n=e.features,r=n.getArray()),!t&&n===void 0&&(n=new Fo(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=Bn(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);let n=e.getGeometry();if(n){let r=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new Th($l.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof MA||(this.featureChangeKeys_[e]=[qn(t,nn.CHANGE,this.handleFeatureChange_,this),qn(t,xu.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let n=!0;if(t.getId()!==void 0){let r=String(t.getId());if(!(r in this.idIndex_))this.idIndex_[r]=t;else if(t instanceof MA){let s=this.idIndex_[r];s instanceof MA?Array.isArray(s)?s.push(t):this.idIndex_[r]=[s,t]:n=!1}else n=!1}return n&&(jn(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),n}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){let t=[],n=[],r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s],l=Bn(a);this.addToIndex_(l,a)&&n.push(a)}for(let s=0,o=n.length;s<o;s++){let a=n[s],l=Bn(a);this.setupChangeEvents_(l,a);let c=a.getGeometry();if(c){let u=c.getExtent();t.push(u),r.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(t,r),this.hasListener($l.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new Th($l.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener($l.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener($l.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(vo.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(vo.REMOVE,n=>{t||(t=!0,this.removeFeature(n.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(let n in this.featureChangeKeys_)this.featureChangeKeys_[n].forEach(li);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(n=>{this.removeFeatureInternal(n)});for(let n in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[n])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let t=new Th($l.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){let n=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(n,function(r){let s=r.getGeometry();if(s instanceof MA||s.intersectsCoordinate(e))return t(r)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(n){let r=n.getGeometry();if(r instanceof MA||r.intersectsExtent(e)){let s=t(n);if(s)return s}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),Au(this.nullGeometryFeatures_)||Do(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){let t=[];return this.forEachFeatureAtCoordinateDirect(e,function(n){t.push(n)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);let r=WT(e,t);return[].concat(...r.map(s=>this.featuresRtree_.getInExtent(s)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){let n=e[0],r=e[1],s=null,o=[NaN,NaN],a=1/0,l=[-1/0,-1/0,1/0,1/0];return t=t||Jf,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){let u=c.getGeometry(),f=a;if(a=u instanceof MA?0:u.closestPointXY(n,r,o,a),a<f){s=c;let d=Math.sqrt(a);l[0]=n-d,l[1]=r-d,l[2]=n+d,l[3]=r+d}}}),s}getExtent(e){return this.featuresRtree_?.getExtent(e)??null}getFeatureById(e){let t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){let t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){let t=e.target,n=Bn(t),r=t.getGeometry();if(!r)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[n]=t);else{let o=r.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(o,t)):this.featuresRtree_&&this.featuresRtree_.update(o,t)}let s=t.getId();if(s!==void 0){let o=s.toString();this.idIndex_[o]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[o]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[n]=t;this.changed(),this.dispatchEvent(new Th($l.CHANGEFEATURE,t))}hasFeature(e){let t=e.getId();if(t!==void 0){let n=this.idIndex_[String(t)];return Array.isArray(n)?n.includes(e):n===e}return Bn(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Au(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,n){let r=this.loadedExtentsRtree_,s=this.strategy_(e,t,n);for(let o=0,a=s.length;o<a;++o){let l=s[o];if(!r.forEachInExtent(l,function(u){return ch(u.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Th($l.FEATURESLOADSTART));let u=y=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Th($l.FEATURESLOADEND,void 0,y))},f=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Th($l.FEATURESLOADERROR))},d=!1,A=this.loader_.call(this,l,t,n,y=>d||u(y),()=>d||f());A instanceof Promise?(d=!0,A.then(y=>{this.addFeatures(y),u(y)}).catch(f)):this.loader_.length<4&&(this.loading=!1),r.insert(l,{extent:l.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){let t=this.loadedExtentsRtree_,n=[];t.forEachInExtent(e,function(r){n.push(r)}),n.forEach(r=>{t.remove(r);let s=RD(r.extent,e);for(let o of s)t.insert(o,{extent:o})})}removeFeatures(e){let t=!1;for(let n=0,r=e.length;n<r;++n)t=this.removeFeatureInternal(e[n])||t;t&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){let t=Bn(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(li),delete this.featureChangeKeys_[t];let r=e.getId();if(r!==void 0){let s=r.toString(),o=this.idIndex_[s];o===e?delete this.idIndex_[s]:Array.isArray(o)&&(o.splice(o.indexOf(e),1),o.length===1&&(this.idIndex_[s]=o[0]))}return delete this.uidIndex_[t],this.hasListener($l.REMOVEFEATURE)&&this.dispatchEvent(new Th($l.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(let t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){jn(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(n8(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},Wp=s8;var qa={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},f0={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},PM=0,hb=1,IM=2;var X8=0,d0=1,LM=2,Vc=3,zo=0,mi=1,vr=2,ps=0,Ts=1,Dh=2,Nh=3,Fh=4,Dd=5,fb=6,oo=100,db=101,pb=102,DM=103,NM=104,Nu=200,mb=201,Ab=202,gb=203,Jp=204,e0=205,vb=206,_b=207,xb=208,yb=209,bb=210,_Z=211,xZ=212,yZ=213,bZ=214,LA=0,DA=1,NA=2,Ch=3,FA=4,BA=5,OA=6,UA=7,tg=0,FM=1,BM=2,ao=0,wb=1,Sb=2,Tb=3,Eb=4,$8=5,Mb=6,Cb=7;var Rb=300,ec=301,Gc=302,p0=303,m0=304,Bh=306,Ed=1e3,la=1001,Md=1002,Ti=1003,Pb=1004;var qc=1005;var Mi=1006,A0=1007;var Go=1008,Y8=1008,Ji=1009,Oh=1010,Uh=1011,wl=1012,Kr=1013,xi=1014,cr=1015,Wi=1016,ng=1017,ig=1018,ua=1020,rg=35902,sg=35899,u_=1021,Nd=1022,Or=1023,Vs=1026,xo=1027,Fd=1028,kh=1029,Ws=1030,zh=1031,Ib=1032,g0=1033,Vh=33776,Gh=33777,qh=33778,Hh=33779,og=35840,ag=35841,lg=35842,cg=35843,v0=36196,_0=37492,x0=37496,y0=37488,b0=37489,Wh=37490,w0=37491,S0=37808,T0=37809,E0=37810,M0=37811,C0=37812,R0=37813,P0=37814,I0=37815,L0=37816,D0=37817,N0=37818,F0=37819,B0=37820,O0=37821,U0=36492,k0=36494,z0=36495,V0=36283,G0=36284,jh=36285,q0=36286;var L2=2300,rM=2301,nM=2302,N8=2303,F8=2400,B8=2401,O8=2402;var Z8=0,K8=1,OM=2,wZ=3200;var tc=0,UM=1,ha="",Fr="srgb",t0="srgb-linear",n0="linear",kt="srgb",Lb="",kM="rg",Q8="ga",J8=0,bd=7680,eF=7681,tF=7682,nF=7683,iF=34055,rF=34056,sF=5386,oF=512,aF=513,lF=514,cF=515,uF=516,hF=517,fF=518,D2=519,Db=512,h_=513,Nb=514,Xh=515,ug=516,Fb=517,Fu=518,Bb=519,i0=35044,hg=35048;var dF="300 es",ko=2e3,xl=2001,Hc={COMPUTE:"compute",RENDER:"render"};var Bd={TEXTURE_COMPARE:"depthTextureCompare"};function Ome(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function f_(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function $v(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function zM(){let i=$v("canvas");return i.style.display="block",i}var IY={},Yv=null;function kA(...i){let e="THREE."+i.shift();Yv?Yv("log",e,...i):console.log(e,...i)}function SZ(i){let e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function Xe(...i){i=SZ(i);let e="THREE."+i.shift();if(Yv)Yv("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function ze(...i){i=SZ(i);let e="THREE."+i.shift();if(Yv)Yv("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function ni(...i){let e=i.join(" ");e in IY||(IY[e]=!0,Xe(...i))}function pF(){return typeof self<"u"&&typeof self.scheduler<"u"&&typeof self.scheduler.yield<"u"?self.scheduler.yield():new Promise(i=>{requestAnimationFrame(i)})}function TZ(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}var Ob={[LA]:DA,[NA]:OA,[FA]:UA,[Ch]:BA,[DA]:LA,[OA]:NA,[UA]:FA,[BA]:Ch},ca=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let r=n.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}},oa=["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"],LY=1234567,C2=Math.PI/180,Cd=180/Math.PI;function Mh(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(oa[i&255]+oa[i>>8&255]+oa[i>>16&255]+oa[i>>24&255]+"-"+oa[e&255]+oa[e>>8&255]+"-"+oa[e>>16&15|64]+oa[e>>24&255]+"-"+oa[t&63|128]+oa[t>>8&255]+"-"+oa[t>>16&255]+oa[t>>24&255]+oa[n&255]+oa[n>>8&255]+oa[n>>16&255]+oa[n>>24&255]).toLowerCase()}function Nn(i,e,t){return Math.max(e,Math.min(t,i))}function mF(i,e){return(i%e+e)%e}function Ume(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function kme(i,e,t){return i!==e?(t-i)/(e-i):0}function R2(i,e,t){return(1-t)*i+t*e}function zme(i,e,t,n){return R2(i,e,1-Math.exp(-t*n))}function Vme(i,e=1){return e-Math.abs(mF(i,e*2)-e)}function Gme(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function qme(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Hme(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Wme(i,e){return i+Math.random()*(e-i)}function jme(i){return i*(.5-Math.random())}function Xme(i){i!==void 0&&(LY=i);let e=LY+=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 $me(i){return i*C2}function Yme(i){return i*Cd}function Zme(i){return(i&i-1)===0&&i!==0}function Kme(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Qme(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Jme(i,e,t,n,r){let s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),f=s((e-n)/2),d=o((e-n)/2),A=s((n-e)/2),y=o((n-e)/2);switch(r){case"XYX":i.set(a*u,l*f,l*d,a*c);break;case"YZY":i.set(l*d,a*u,l*f,a*c);break;case"ZXZ":i.set(l*f,l*d,a*u,a*c);break;case"XZX":i.set(a*u,l*y,l*A,a*c);break;case"YXY":i.set(l*A,a*u,l*y,a*c);break;case"ZYZ":i.set(l*y,l*A,a*u,a*c);break;default:Xe("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Fa(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function Zn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}var Bu={DEG2RAD:C2,RAD2DEG:Cd,generateUUID:Mh,clamp:Nn,euclideanModulo:mF,mapLinear:Ume,inverseLerp:kme,lerp:R2,damp:zme,pingpong:Vme,smoothstep:Gme,smootherstep:qme,randInt:Hme,randFloat:Wme,randFloatSpread:jme,seededRandom:Xme,degToRad:$me,radToDeg:Yme,isPowerOfTwo:Zme,ceilPowerOfTwo:Kme,floorPowerOfTwo:Qme,setQuaternionFromProperEuler:Jme,normalize:Zn,denormalize:Fa},xF=class xF{constructor(e=0,t=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("THREE.Vector2: 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("THREE.Vector2: 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){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Nn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};xF.prototype.isVector2=!0;var Oe=xF,Gs=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,o,a){let l=n[r+0],c=n[r+1],u=n[r+2],f=n[r+3],d=s[o+0],A=s[o+1],y=s[o+2],w=s[o+3];if(f!==w||l!==d||c!==A||u!==y){let S=l*d+c*A+u*y+f*w;S<0&&(d=-d,A=-A,y=-y,w=-w,S=-S);let T=1-a;if(S<.9995){let R=Math.acos(S),I=Math.sin(R);T=Math.sin(T*R)/I,a=Math.sin(a*R)/I,l=l*T+d*a,c=c*T+A*a,u=u*T+y*a,f=f*T+w*a}else{l=l*T+d*a,c=c*T+A*a,u=u*T+y*a,f=f*T+w*a;let R=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=R,c*=R,u*=R,f*=R}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,r,s,o){let a=n[r],l=n[r+1],c=n[r+2],u=n[r+3],f=s[o],d=s[o+1],A=s[o+2],y=s[o+3];return e[t]=a*y+u*f+l*A-c*d,e[t+1]=l*y+u*d+c*f-a*A,e[t+2]=c*y+u*A+a*d-l*f,e[t+3]=u*y-a*f-l*d-c*A,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(r/2),f=a(s/2),d=l(n/2),A=l(r/2),y=l(s/2);switch(o){case"XYZ":this._x=d*u*f+c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f-d*A*y;break;case"YXZ":this._x=d*u*f+c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f+d*A*y;break;case"ZXY":this._x=d*u*f-c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f-d*A*y;break;case"ZYX":this._x=d*u*f-c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f+d*A*y;break;case"YZX":this._x=d*u*f+c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f-d*A*y;break;case"XZY":this._x=d*u*f-c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f+d*A*y;break;default:Xe("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],d=n+a+f;if(d>0){let A=.5/Math.sqrt(d+1);this._w=.25/A,this._x=(u-l)*A,this._y=(s-c)*A,this._z=(o-r)*A}else if(n>a&&n>f){let A=2*Math.sqrt(1+n-a-f);this._w=(u-l)/A,this._x=.25*A,this._y=(r+o)/A,this._z=(s+c)/A}else if(a>f){let A=2*Math.sqrt(1+a-n-f);this._w=(s-c)/A,this._x=(r+o)/A,this._y=.25*A,this._z=(l+u)/A}else{let A=2*Math.sqrt(1+f-n-a);this._w=(o-r)/A,this._x=(s+c)/A,this._y=(l+u)/A,this._z=.25*A}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Nn(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-r*a,this._w=o*u-n*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,r=-r,s=-s,o=-o,a=-a);let l=1-t;if(a<.9995){let c=Math.acos(a),u=Math.sin(c);l=Math.sin(l*c)/u,t=Math.sin(t*c)/u,this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},yF=class yF{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: 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("THREE.Vector3: 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(DY.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(DY.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*n),u=2*(a*t-s*r),f=2*(s*n-o*t);return this.x=t+l*c+o*f-a*u,this.y=n+l*u+a*c-s*f,this.z=r+l*f+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this.z=Nn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this.z=Nn(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return o8.copy(this).projectOnVector(e),this.sub(o8)}reflect(e){return this.sub(o8.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Nn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};yF.prototype.isVector3=!0;var re=yF,o8=new re,DY=new Gs,bF=class bF{constructor(e,t,n,r,s,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c)}set(e,t,n,r,s,o,a,l,c){let u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let 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){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],f=n[7],d=n[2],A=n[5],y=n[8],w=r[0],S=r[3],T=r[6],R=r[1],I=r[4],P=r[7],F=r[2],D=r[5],L=r[8];return s[0]=o*w+a*R+l*F,s[3]=o*S+a*I+l*D,s[6]=o*T+a*P+l*L,s[1]=c*w+u*R+f*F,s[4]=c*S+u*I+f*D,s[7]=c*T+u*P+f*L,s[2]=d*w+A*R+y*F,s[5]=d*S+A*I+y*D,s[8]=d*T+A*P+y*L,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+r*s*c-r*o*l}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,d=a*l-u*s,A=c*s-o*l,y=t*f+n*d+r*A;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);let w=1/y;return e[0]=f*w,e[1]=(r*c-u*n)*w,e[2]=(a*n-r*o)*w,e[3]=d*w,e[4]=(u*t-r*l)*w,e[5]=(r*s-a*t)*w,e[6]=A*w,e[7]=(n*l-c*t)*w,e[8]=(o*t-n*s)*w,this}transpose(){let e,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){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,o,a){let l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return ni("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(a8.makeScale(e,t)),this}rotate(e){return ni("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(a8.makeRotation(-e)),this}translate(e,t){return ni("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(a8.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){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};bF.prototype.isMatrix3=!0;var Mn=bF,a8=new Mn,NY=new Mn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),FY=new Mn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function eAe(){let i={enabled:!0,workingColorSpace:t0,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===kt&&(r.r=Td(r.r),r.g=Td(r.g),r.b=Td(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===kt&&(r.r=Xv(r.r),r.g=Xv(r.g),r.b=Xv(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===ha?n0:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return ni("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return ni("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[t0]:{primaries:e,whitePoint:n,transfer:n0,toXYZ:NY,fromXYZ:FY,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Fr},outputColorSpaceConfig:{drawingBufferColorSpace:Fr}},[Fr]:{primaries:e,whitePoint:n,transfer:kt,toXYZ:NY,fromXYZ:FY,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Fr}}}),i}var ln=eAe();function Td(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Xv(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Cv,sM=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Cv===void 0&&(Cv=$v("canvas")),Cv.width=e.width,Cv.height=e.height;let r=Cv.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Cv}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=$v("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=Td(s[o]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Td(t[n]/255)*255):t[n]=Td(t[n]);return{data:t,width:e.width,height:e.height}}else return Xe("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},tAe=0,Zv=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:tAe++}),this.uuid=Mh(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(l8(r[o].image)):s.push(l8(r[o]))}else s=l8(r);n.url=s}return t||(e.images[this.uuid]=n),n}};function l8(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?sM.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(Xe("Texture: Unable to serialize Texture."),{})}var nAe=0,c8=new re,qs=class i extends ca{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=la,r=la,s=Mi,o=Go,a=Or,l=Ji,c=i.DEFAULT_ANISOTROPY,u=ha){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:nAe++}),this.uuid=Mh(),this.name="",this.source=new Zv(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Oe(0,0),this.repeat=new Oe(1,1),this.center=new Oe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Mn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(c8).x}get height(){return this.source.getSize(c8).y}get depth(){return this.source.getSize(c8).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){Xe(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Xe(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Rb)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ed:e.x=e.x-Math.floor(e.x);break;case la:e.x=e.x<0?0:1;break;case Md: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 Ed:e.y=e.y-Math.floor(e.y);break;case la:e.y=e.y<0?0:1;break;case Md:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};qs.DEFAULT_IMAGE=null;qs.DEFAULT_MAPPING=Rb;qs.DEFAULT_ANISOTROPY=1;var wF=class wF{constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: 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("THREE.Vector4: 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){let t=this.x,n=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s,l=e.elements,c=l[0],u=l[4],f=l[8],d=l[1],A=l[5],y=l[9],w=l[2],S=l[6],T=l[10];if(Math.abs(u-d)<.01&&Math.abs(f-w)<.01&&Math.abs(y-S)<.01){if(Math.abs(u+d)<.1&&Math.abs(f+w)<.1&&Math.abs(y+S)<.1&&Math.abs(c+A+T-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let I=(c+1)/2,P=(A+1)/2,F=(T+1)/2,D=(u+d)/4,L=(f+w)/4,C=(y+S)/4;return I>P&&I>F?I<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(I),r=D/n,s=L/n):P>F?P<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(P),n=D/r,s=C/r):F<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(F),n=L/s,r=C/s),this.set(n,r,s,t),this}let R=Math.sqrt((S-y)*(S-y)+(f-w)*(f-w)+(d-u)*(d-u));return Math.abs(R)<.001&&(R=1),this.x=(S-y)/R,this.y=(f-w)/R,this.z=(d-u)/R,this.w=Math.acos((c+A+T-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this.z=Nn(this.z,e.z,t.z),this.w=Nn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this.z=Nn(this.z,e,t),this.w=Nn(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};wF.prototype.isVector4=!0;var xn=wF,Ba=class extends ca{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Mi,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new xn(0,0,e,t),this.scissorTest=!1,this.viewport=new xn(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:n.depth},s=new qs(r),o=n.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:Mi,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let r=Object.assign({},e.textures[t].image);this.textures[t].source=new Zv(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},Oa=class extends Ba{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},zA=class extends qs{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Ti,this.minFilter=Ti,this.wrapR=la,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var oM=class extends qs{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Ti,this.minFilter=Ti,this.wrapR=la,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var RM=class RM{constructor(e,t,n,r,s,o,a,l,c,u,f,d,A,y,w,S){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c,u,f,d,A,y,w,S)}set(e,t,n,r,s,o,a,l,c,u,f,d,A,y,w,S){let T=this.elements;return T[0]=e,T[4]=t,T[8]=n,T[12]=r,T[1]=s,T[5]=o,T[9]=a,T[13]=l,T[2]=c,T[6]=u,T[10]=f,T[14]=d,T[3]=A,T[7]=y,T[11]=w,T[15]=S,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new RM().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,r=1/Rv.setFromMatrixColumn(e,0).length(),s=1/Rv.setFromMatrixColumn(e,1).length(),o=1/Rv.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){let d=o*u,A=o*f,y=a*u,w=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=A+y*c,t[5]=d-w*c,t[9]=-a*l,t[2]=w-d*c,t[6]=y+A*c,t[10]=o*l}else if(e.order==="YXZ"){let d=l*u,A=l*f,y=c*u,w=c*f;t[0]=d+w*a,t[4]=y*a-A,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=A*a-y,t[6]=w+d*a,t[10]=o*l}else if(e.order==="ZXY"){let d=l*u,A=l*f,y=c*u,w=c*f;t[0]=d-w*a,t[4]=-o*f,t[8]=y+A*a,t[1]=A+y*a,t[5]=o*u,t[9]=w-d*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){let d=o*u,A=o*f,y=a*u,w=a*f;t[0]=l*u,t[4]=y*c-A,t[8]=d*c+w,t[1]=l*f,t[5]=w*c+d,t[9]=A*c-y,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){let d=o*l,A=o*c,y=a*l,w=a*c;t[0]=l*u,t[4]=w-d*f,t[8]=y*f+A,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=A*f+y,t[10]=d-w*f}else if(e.order==="XZY"){let d=o*l,A=o*c,y=a*l,w=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=d*f+w,t[5]=o*u,t[9]=A*f-y,t[2]=y*f-A,t[6]=a*u,t[10]=w*f+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(iAe,e,rAe)}lookAt(e,t,n){let r=this.elements;return Yl.subVectors(e,t),Yl.lengthSq()===0&&(Yl.z=1),Yl.normalize(),jp.crossVectors(n,Yl),jp.lengthSq()===0&&(Math.abs(n.z)===1?Yl.x+=1e-4:Yl.z+=1e-4,Yl.normalize(),jp.crossVectors(n,Yl)),jp.normalize(),T3.crossVectors(Yl,jp),r[0]=jp.x,r[4]=T3.x,r[8]=Yl.x,r[1]=jp.y,r[5]=T3.y,r[9]=Yl.y,r[2]=jp.z,r[6]=T3.z,r[10]=Yl.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],f=n[5],d=n[9],A=n[13],y=n[2],w=n[6],S=n[10],T=n[14],R=n[3],I=n[7],P=n[11],F=n[15],D=r[0],L=r[4],C=r[8],B=r[12],k=r[1],z=r[5],G=r[9],W=r[13],Y=r[2],H=r[6],$=r[10],J=r[14],te=r[3],ce=r[7],he=r[11],ve=r[15];return s[0]=o*D+a*k+l*Y+c*te,s[4]=o*L+a*z+l*H+c*ce,s[8]=o*C+a*G+l*$+c*he,s[12]=o*B+a*W+l*J+c*ve,s[1]=u*D+f*k+d*Y+A*te,s[5]=u*L+f*z+d*H+A*ce,s[9]=u*C+f*G+d*$+A*he,s[13]=u*B+f*W+d*J+A*ve,s[2]=y*D+w*k+S*Y+T*te,s[6]=y*L+w*z+S*H+T*ce,s[10]=y*C+w*G+S*$+T*he,s[14]=y*B+w*W+S*J+T*ve,s[3]=R*D+I*k+P*Y+F*te,s[7]=R*L+I*z+P*H+F*ce,s[11]=R*C+I*G+P*$+F*he,s[15]=R*B+I*W+P*J+F*ve,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],d=e[10],A=e[14],y=e[3],w=e[7],S=e[11],T=e[15],R=l*A-c*d,I=a*A-c*f,P=a*d-l*f,F=o*A-c*u,D=o*d-l*u,L=o*f-a*u;return t*(w*R-S*I+T*P)-n*(y*R-S*F+T*D)+r*(y*I-w*F+T*L)-s*(y*P-w*D+S*L)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[1],o=e[5],a=e[9],l=e[2],c=e[6],u=e[10];return t*(o*u-a*c)-n*(s*u-a*l)+r*(s*c-o*l)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],d=e[10],A=e[11],y=e[12],w=e[13],S=e[14],T=e[15],R=t*a-n*o,I=t*l-r*o,P=t*c-s*o,F=n*l-r*a,D=n*c-s*a,L=r*c-s*l,C=u*w-f*y,B=u*S-d*y,k=u*T-A*y,z=f*S-d*w,G=f*T-A*w,W=d*T-A*S,Y=R*W-I*G+P*z+F*k-D*B+L*C;if(Y===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let H=1/Y;return e[0]=(a*W-l*G+c*z)*H,e[1]=(r*G-n*W-s*z)*H,e[2]=(w*L-S*D+T*F)*H,e[3]=(d*D-f*L-A*F)*H,e[4]=(l*k-o*W-c*B)*H,e[5]=(t*W-r*k+s*B)*H,e[6]=(S*P-y*L-T*I)*H,e[7]=(u*L-d*P+A*I)*H,e[8]=(o*G-a*k+c*C)*H,e[9]=(n*k-t*G-s*C)*H,e[10]=(y*D-w*P+T*R)*H,e[11]=(f*P-u*D-A*R)*H,e[12]=(a*B-o*z-l*C)*H,e[13]=(t*z-n*B+r*C)*H,e[14]=(w*I-y*F-S*R)*H,e[15]=(u*F-f*I+d*R)*H,this}scale(e){let t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),s=1-n,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+n,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,o){return this.set(1,n,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,f=a+a,d=s*c,A=s*u,y=s*f,w=o*u,S=o*f,T=a*f,R=l*c,I=l*u,P=l*f,F=n.x,D=n.y,L=n.z;return r[0]=(1-(w+T))*F,r[1]=(A+P)*F,r[2]=(y-I)*F,r[3]=0,r[4]=(A-P)*D,r[5]=(1-(d+T))*D,r[6]=(S+R)*D,r[7]=0,r[8]=(y+I)*L,r[9]=(S-R)*L,r[10]=(1-(d+w))*L,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let s=this.determinantAffine();if(s===0)return n.set(1,1,1),t.identity(),this;let o=Rv.set(r[0],r[1],r[2]).length(),a=Rv.set(r[4],r[5],r[6]).length(),l=Rv.set(r[8],r[9],r[10]).length();s<0&&(o=-o),Cu.copy(this);let c=1/o,u=1/a,f=1/l;return Cu.elements[0]*=c,Cu.elements[1]*=c,Cu.elements[2]*=c,Cu.elements[4]*=u,Cu.elements[5]*=u,Cu.elements[6]*=u,Cu.elements[8]*=f,Cu.elements[9]*=f,Cu.elements[10]*=f,t.setFromRotationMatrix(Cu),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=ko,l=!1){let c=this.elements,u=2*s/(t-e),f=2*s/(n-r),d=(t+e)/(t-e),A=(n+r)/(n-r),y,w;if(l)y=s/(o-s),w=o*s/(o-s);else if(a===ko)y=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(a===xl)y=-o/(o-s),w=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=f,c[9]=A,c[13]=0,c[2]=0,c[6]=0,c[10]=y,c[14]=w,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,s,o,a=ko,l=!1){let c=this.elements,u=2/(t-e),f=2/(n-r),d=-(t+e)/(t-e),A=-(n+r)/(n-r),y,w;if(l)y=1/(o-s),w=o/(o-s);else if(a===ko)y=-2/(o-s),w=-(o+s)/(o-s);else if(a===xl)y=-1/(o-s),w=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=f,c[9]=0,c[13]=A,c[2]=0,c[6]=0,c[10]=y,c[14]=w,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};RM.prototype.isMatrix4=!0;var cn=RM,Rv=new re,Cu=new cn,iAe=new re(0,0,0),rAe=new re(1,1,1),jp=new re,T3=new re,Yl=new re,BY=new cn,OY=new Gs,Ua=class i{constructor(e=0,t=0,n=0,r=i.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],f=r[2],d=r[6],A=r[10];switch(t){case"XYZ":this._y=Math.asin(Nn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,A),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Nn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,A),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Nn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-f,A),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Nn(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(d,A),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Nn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,A));break;case"XZY":this._z=Math.asin(-Nn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,A),this._y=0);break;default:Xe("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return BY.makeRotationFromQuaternion(e),this.setFromRotationMatrix(BY,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return OY.setFromEuler(this),this.setFromQuaternion(OY,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}};Ua.DEFAULT_ORDER="XYZ";var Kv=class{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}},sAe=0,UY=new re,Pv=new Gs,gd=new cn,E3=new re,_2=new re,oAe=new re,aAe=new Gs,kY=new re(1,0,0),zY=new re(0,1,0),VY=new re(0,0,1),GY={type:"added"},lAe={type:"removed"},Iv={type:"childadded",child:null},u8={type:"childremoved",child:null},lr=class i extends ca{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:sAe++}),this.uuid=Mh(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new re,t=new Ua,n=new Gs,r=new re(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new cn},normalMatrix:{value:new Mn}}),this.matrix=new cn,this.matrixWorld=new cn,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Kv,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Pv.setFromAxisAngle(e,t),this.quaternion.multiply(Pv),this}rotateOnWorldAxis(e,t){return Pv.setFromAxisAngle(e,t),this.quaternion.premultiply(Pv),this}rotateX(e){return this.rotateOnAxis(kY,e)}rotateY(e){return this.rotateOnAxis(zY,e)}rotateZ(e){return this.rotateOnAxis(VY,e)}translateOnAxis(e,t){return UY.copy(e).applyQuaternion(this.quaternion),this.position.add(UY.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(kY,e)}translateY(e){return this.translateOnAxis(zY,e)}translateZ(e){return this.translateOnAxis(VY,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(gd.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?E3.copy(e):E3.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),_2.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?gd.lookAt(_2,E3,this.up):gd.lookAt(E3,_2,this.up),this.quaternion.setFromRotationMatrix(gd),r&&(gd.extractRotation(r.matrixWorld),Pv.setFromRotationMatrix(gd),this.quaternion.premultiply(Pv.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(ze("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(GY),Iv.child=e,this.dispatchEvent(Iv),Iv.child=null):ze("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(lAe),u8.child=e,this.dispatchEvent(u8),u8.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),gd.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),gd.multiply(e.parent.matrixWorld)),e.applyMatrix4(gd),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(GY),Iv.child=e,this.dispatchEvent(Iv),Iv.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_2,e,oAe),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_2,aAe,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*r,s[13]+=n-s[1]*t-s[5]*n-s[9]*r,s[14]+=r-s[2]*t-s[6]*n-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){let s=this.children;for(let o=0,a=s.length;o<a;o++)s[o].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(a=>({...a})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){let f=l[c];s(e.shapes,f)}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)){let a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){let l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){let a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),f=o(e.shapes),d=o(e.skeletons),A=o(e.animations),y=o(e.nodes);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),d.length>0&&(n.skeletons=d),A.length>0&&(n.animations=A),y.length>0&&(n.nodes=y)}return n.object=r,n;function o(a){let l=[];for(let c in a){let u=a[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.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let r=e.children[n];this.add(r.clone())}return this}};lr.DEFAULT_UP=new re(0,1,0);lr.DEFAULT_MATRIX_AUTO_UPDATE=!0;lr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Br=class extends lr{constructor(){super(),this.isGroup=!0,this.type="Group"}},cAe={type:"move"},r0=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Br,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 Br,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new re,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new re),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Br,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new re,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new re,this._grip.eventsEnabled=!1),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){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,o=null,a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(let w of e.hand.values()){let S=t.getJointPose(w,n),T=this._getHandJoint(c,w);S!==null&&(T.matrix.fromArray(S.transform.matrix),T.matrix.decompose(T.position,T.rotation,T.scale),T.matrixWorldNeedsUpdate=!0,T.jointRadius=S.radius),T.visible=S!==null}let u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],d=u.position.distanceTo(f.position),A=.02,y=.005;c.inputState.pinching&&d>A+y?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=A-y&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));a!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(cAe)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new Br;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},EZ={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},Xp={h:0,s:0,l:0},M3={h:0,s:0,l:0};function h8(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}var zt=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Fr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ln.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=ln.workingColorSpace){return this.r=e,this.g=t,this.b=n,ln.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=ln.workingColorSpace){if(e=mF(e,1),t=Nn(t,0,1),n=Nn(n,0,1),t===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=h8(o,s,e+1/3),this.g=h8(o,s,e),this.b=h8(o,s,e-1/3)}return ln.colorSpaceToWorking(this,r),this}setStyle(e,t=Fr){function n(s){s!==void 0&&parseFloat(s)<1&&Xe("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s,o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Xe("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);Xe("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Fr){let n=EZ[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Xe("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=Td(e.r),this.g=Td(e.g),this.b=Td(e.b),this}copyLinearToSRGB(e){return this.r=Xv(e.r),this.g=Xv(e.g),this.b=Xv(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Fr){return ln.workingToColorSpace(aa.copy(this),e),Math.round(Nn(aa.r*255,0,255))*65536+Math.round(Nn(aa.g*255,0,255))*256+Math.round(Nn(aa.b*255,0,255))}getHexString(e=Fr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ln.workingColorSpace){ln.workingToColorSpace(aa.copy(this),t);let n=aa.r,r=aa.g,s=aa.b,o=Math.max(n,r,s),a=Math.min(n,r,s),l,c,u=(a+o)/2;if(a===o)l=0,c=0;else{let f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case n:l=(r-s)/f+(r<s?6:0);break;case r:l=(s-n)/f+2;break;case s:l=(n-r)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=ln.workingColorSpace){return ln.workingToColorSpace(aa.copy(this),t),e.r=aa.r,e.g=aa.g,e.b=aa.b,e}getStyle(e=Fr){ln.workingToColorSpace(aa.copy(this),e);let t=aa.r,n=aa.g,r=aa.b;return e!==Fr?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(Xp),this.setHSL(Xp.h+e,Xp.s+t,Xp.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Xp),e.getHSL(M3);let n=R2(Xp.h,M3.h,t),r=R2(Xp.s,M3.s,t),s=R2(Xp.l,M3.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},aa=new zt;zt.NAMES=EZ;var s0=class extends lr{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Ua,this.environmentIntensity=1,this.environmentRotation=new Ua,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},Ru=new re,vd=new re,f8=new re,_d=new re,Lv=new re,Dv=new re,qY=new re,d8=new re,p8=new re,m8=new re,A8=new xn,g8=new xn,v8=new xn,wd=class i{constructor(e=new re,t=new re,n=new re){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Ru.subVectors(e,t),r.cross(Ru);let s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Ru.subVectors(r,t),vd.subVectors(n,t),f8.subVectors(e,t);let o=Ru.dot(Ru),a=Ru.dot(vd),l=Ru.dot(f8),c=vd.dot(vd),u=vd.dot(f8),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;let d=1/f,A=(c*l-a*u)*d,y=(o*u-a*l)*d;return s.set(1-A-y,y,A)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,_d)===null?!1:_d.x>=0&&_d.y>=0&&_d.x+_d.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,_d)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,_d.x),l.addScaledVector(o,_d.y),l.addScaledVector(a,_d.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return A8.setScalar(0),g8.setScalar(0),v8.setScalar(0),A8.fromBufferAttribute(e,t),g8.fromBufferAttribute(e,n),v8.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(A8,s.x),o.addScaledVector(g8,s.y),o.addScaledVector(v8,s.z),o}static isFrontFacing(e,t,n,r){return Ru.subVectors(n,t),vd.subVectors(e,t),Ru.cross(vd).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ru.subVectors(this.c,this.b),vd.subVectors(this.a,this.b),Ru.cross(vd).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return i.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return i.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return i.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return i.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return i.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,s=this.c,o,a;Lv.subVectors(r,n),Dv.subVectors(s,n),d8.subVectors(e,n);let l=Lv.dot(d8),c=Dv.dot(d8);if(l<=0&&c<=0)return t.copy(n);p8.subVectors(e,r);let u=Lv.dot(p8),f=Dv.dot(p8);if(u>=0&&f<=u)return t.copy(r);let d=l*f-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(Lv,o);m8.subVectors(e,s);let A=Lv.dot(m8),y=Dv.dot(m8);if(y>=0&&A<=y)return t.copy(s);let w=A*c-l*y;if(w<=0&&c>=0&&y<=0)return a=c/(c-y),t.copy(n).addScaledVector(Dv,a);let S=u*y-A*f;if(S<=0&&f-u>=0&&A-y>=0)return qY.subVectors(s,r),a=(f-u)/(f-u+(A-y)),t.copy(r).addScaledVector(qY,a);let T=1/(S+w+d);return o=w*T,a=d*T,t.copy(n).addScaledVector(Lv,o).addScaledVector(Dv,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},ka=class{constructor(e=new re(1/0,1/0,1/0),t=new re(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Pu.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Pu.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Pu.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Pu):Pu.fromBufferAttribute(s,o),Pu.applyMatrix4(e.matrixWorld),this.expandByPoint(Pu);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),C3.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),C3.copy(n.boundingBox)),C3.applyMatrix4(e.matrixWorld),this.union(C3)}let r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Pu),Pu.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(x2),R3.subVectors(this.max,x2),Nv.subVectors(e.a,x2),Fv.subVectors(e.b,x2),Bv.subVectors(e.c,x2),$p.subVectors(Fv,Nv),Yp.subVectors(Bv,Fv),CA.subVectors(Nv,Bv);let t=[0,-$p.z,$p.y,0,-Yp.z,Yp.y,0,-CA.z,CA.y,$p.z,0,-$p.x,Yp.z,0,-Yp.x,CA.z,0,-CA.x,-$p.y,$p.x,0,-Yp.y,Yp.x,0,-CA.y,CA.x,0];return!_8(t,Nv,Fv,Bv,R3)||(t=[1,0,0,0,1,0,0,0,1],!_8(t,Nv,Fv,Bv,R3))?!1:(P3.crossVectors($p,Yp),t=[P3.x,P3.y,P3.z],_8(t,Nv,Fv,Bv,R3))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Pu).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Pu).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:(xd[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),xd[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),xd[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),xd[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),xd[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),xd[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),xd[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),xd[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(xd),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},xd=[new re,new re,new re,new re,new re,new re,new re,new re],Pu=new re,C3=new ka,Nv=new re,Fv=new re,Bv=new re,$p=new re,Yp=new re,CA=new re,x2=new re,R3=new re,P3=new re,RA=new re;function _8(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){RA.fromArray(i,s);let a=r.x*Math.abs(RA.x)+r.y*Math.abs(RA.y)+r.z*Math.abs(RA.z),l=e.dot(RA),c=t.dot(RA),u=n.dot(RA);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var Sd=uAe();function uAe(){let i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){let c=l-127;c<-27?(n[l]=0,n[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,r[l]=24,r[l|256]=24):(n[l]=31744,n[l|256]=64512,r[l]=13,r[l|256]=13)}let s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;(c&8388608)===0;)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)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function Zl(i){Math.abs(i)>65504&&Xe("DataUtils.toHalfFloat(): Value out of range."),i=Nn(i,-65504,65504),Sd.floatView[0]=i;let e=Sd.uint32View[0],t=e>>23&511;return Sd.baseTable[t]+((e&8388607)>>Sd.shiftTable[t])}function I3(i){let e=i>>10;return Sd.uint32View[0]=Sd.mantissaTable[Sd.offsetTable[e]+(i&1023)]+Sd.exponentTable[e],Sd.floatView[0]}var zs=new re,L3=new Oe,hAe=0,Hi=class extends ca{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:hAe++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=i0,this.updateRanges=[],this.gpuType=cr,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)L3.fromBufferAttribute(this,t),L3.applyMatrix3(e),this.setXY(t,L3.x,L3.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)zs.fromBufferAttribute(this,t),zs.applyMatrix3(e),this.setXYZ(t,zs.x,zs.y,zs.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)zs.fromBufferAttribute(this,t),zs.applyMatrix4(e),this.setXYZ(t,zs.x,zs.y,zs.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)zs.fromBufferAttribute(this,t),zs.applyNormalMatrix(e),this.setXYZ(t,zs.x,zs.y,zs.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)zs.fromBufferAttribute(this,t),zs.transformDirection(e),this.setXYZ(t,zs.x,zs.y,zs.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Fa(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Zn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Fa(t,this.array)),t}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Fa(t,this.array)),t}setY(e,t){return this.normalized&&(t=Zn(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=Fa(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Zn(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=Fa(t,this.array)),t}setW(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let 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!==i0&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var VA=class extends Hi{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var GA=class extends Hi{constructor(e,t,n){super(new Uint32Array(e),t,n)}},Qv=class extends Hi{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=I3(this.array[e*this.itemSize]);return this.normalized&&(t=Fa(t,this.array)),t}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize]=Zl(t),this}getY(e){let t=I3(this.array[e*this.itemSize+1]);return this.normalized&&(t=Fa(t,this.array)),t}setY(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+1]=Zl(t),this}getZ(e){let t=I3(this.array[e*this.itemSize+2]);return this.normalized&&(t=Fa(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+2]=Zl(t),this}getW(e){let t=I3(this.array[e*this.itemSize+3]);return this.normalized&&(t=Fa(t,this.array)),t}setW(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+3]=Zl(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array)),this.array[e+0]=Zl(t),this.array[e+1]=Zl(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array)),this.array[e+0]=Zl(t),this.array[e+1]=Zl(n),this.array[e+2]=Zl(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(s,this.array)),this.array[e+0]=Zl(t),this.array[e+1]=Zl(n),this.array[e+2]=Zl(r),this.array[e+3]=Zl(s),this}},Ln=class extends Hi{constructor(e,t,n){super(new Float32Array(e),t,n)}},fAe=new ka,y2=new re,x8=new re,yl=class{constructor(e=new re,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):fAe.setFromPoints(e).getCenter(n);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let 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){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;y2.subVectors(e,this.center);let t=y2.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(y2,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(x8.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(y2.copy(e.center).add(x8)),this.expandByPoint(y2.copy(e.center).sub(x8))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},dAe=0,kc=new cn,y8=new lr,Ov=new re,Kl=new ka,b2=new ka,_o=new re,Xn=class i extends ca{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:dAe++}),this.uuid=Mh(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Ome(e)?GA:VA)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let s=new Mn().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}let 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._transformed=!0,this}applyQuaternion(e){return kc.makeRotationFromQuaternion(e),this.applyMatrix4(kc),this}rotateX(e){return kc.makeRotationX(e),this.applyMatrix4(kc),this}rotateY(e){return kc.makeRotationY(e),this.applyMatrix4(kc),this}rotateZ(e){return kc.makeRotationZ(e),this.applyMatrix4(kc),this}translate(e,t,n){return kc.makeTranslation(e,t,n),this.applyMatrix4(kc),this}scale(e,t,n){return kc.makeScale(e,t,n),this.applyMatrix4(kc),this}lookAt(e){return y8.lookAt(e),y8.updateMatrix(),this.applyMatrix4(y8.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ov).negate(),this.translate(Ov.x,Ov.y,Ov.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let r=0,s=e.length;r<s;r++){let o=e[r];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new Ln(n,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&Xe("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ka);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ze("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new re(-1/0,-1/0,-1/0),new re(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){let s=t[n];Kl.setFromBufferAttribute(s),this.morphTargetsRelative?(_o.addVectors(this.boundingBox.min,Kl.min),this.boundingBox.expandByPoint(_o),_o.addVectors(this.boundingBox.max,Kl.max),this.boundingBox.expandByPoint(_o)):(this.boundingBox.expandByPoint(Kl.min),this.boundingBox.expandByPoint(Kl.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&ze('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 yl);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ze("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new re,1/0);return}if(e){let n=this.boundingSphere.center;if(Kl.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];b2.setFromBufferAttribute(a),this.morphTargetsRelative?(_o.addVectors(Kl.min,b2.min),Kl.expandByPoint(_o),_o.addVectors(Kl.max,b2.max),Kl.expandByPoint(_o)):(Kl.expandByPoint(b2.min),Kl.expandByPoint(b2.max))}Kl.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)_o.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(_o));if(t)for(let s=0,o=t.length;s<o;s++){let a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)_o.fromBufferAttribute(a,c),l&&(Ov.fromBufferAttribute(e,c),_o.add(Ov)),r=Math.max(r,n.distanceToSquared(_o))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&ze('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){ze("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=t.position,r=t.normal,s=t.uv,o=this.getAttribute("tangent");(o===void 0||o.count!==n.count)&&(o=new Hi(new Float32Array(4*n.count),4),this.setAttribute("tangent",o));let a=[],l=[];for(let C=0;C<n.count;C++)a[C]=new re,l[C]=new re;let c=new re,u=new re,f=new re,d=new Oe,A=new Oe,y=new Oe,w=new re,S=new re;function T(C,B,k){c.fromBufferAttribute(n,C),u.fromBufferAttribute(n,B),f.fromBufferAttribute(n,k),d.fromBufferAttribute(s,C),A.fromBufferAttribute(s,B),y.fromBufferAttribute(s,k),u.sub(c),f.sub(c),A.sub(d),y.sub(d);let z=1/(A.x*y.y-y.x*A.y);isFinite(z)&&(w.copy(u).multiplyScalar(y.y).addScaledVector(f,-A.y).multiplyScalar(z),S.copy(f).multiplyScalar(A.x).addScaledVector(u,-y.x).multiplyScalar(z),a[C].add(w),a[B].add(w),a[k].add(w),l[C].add(S),l[B].add(S),l[k].add(S))}let R=this.groups;R.length===0&&(R=[{start:0,count:e.count}]);for(let C=0,B=R.length;C<B;++C){let k=R[C],z=k.start,G=k.count;for(let W=z,Y=z+G;W<Y;W+=3)T(e.getX(W+0),e.getX(W+1),e.getX(W+2))}let I=new re,P=new re,F=new re,D=new re;function L(C){F.fromBufferAttribute(r,C),D.copy(F);let B=a[C];I.copy(B),I.sub(F.multiplyScalar(F.dot(B))).normalize(),P.crossVectors(D,B);let z=P.dot(l[C])<0?-1:1;o.setXYZW(C,I.x,I.y,I.z,z)}for(let C=0,B=R.length;C<B;++C){let k=R[C],z=k.start,G=k.count;for(let W=z,Y=z+G;W<Y;W+=3)L(e.getX(W+0)),L(e.getX(W+1)),L(e.getX(W+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new Hi(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,A=n.count;d<A;d++)n.setXYZ(d,0,0,0);let r=new re,s=new re,o=new re,a=new re,l=new re,c=new re,u=new re,f=new re;if(e)for(let d=0,A=e.count;d<A;d+=3){let y=e.getX(d+0),w=e.getX(d+1),S=e.getX(d+2);r.fromBufferAttribute(t,y),s.fromBufferAttribute(t,w),o.fromBufferAttribute(t,S),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),a.fromBufferAttribute(n,y),l.fromBufferAttribute(n,w),c.fromBufferAttribute(n,S),a.add(u),l.add(u),c.add(u),n.setXYZ(y,a.x,a.y,a.z),n.setXYZ(w,l.x,l.y,l.z),n.setXYZ(S,c.x,c.y,c.z)}else for(let d=0,A=t.count;d<A;d+=3)r.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),o.fromBufferAttribute(t,d+2),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),n.setXYZ(d+0,u.x,u.y,u.z),n.setXYZ(d+1,u.x,u.y,u.z),n.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)_o.fromBufferAttribute(e,t),_o.normalize(),e.setXYZ(t,_o.x,_o.y,_o.z)}toNonIndexed(){function e(a,l){let c=a.array,u=a.itemSize,f=a.normalized,d=new c.constructor(l.length*u),A=0,y=0;for(let w=0,S=l.length;w<S;w++){a.isInterleavedBufferAttribute?A=l[w]*a.data.stride+a.offset:A=l[w]*u;for(let T=0;T<u;T++)d[y++]=c[A++]}return new Hi(d,u,f)}if(this.index===null)return Xe("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new i,n=this.index.array,r=this.attributes;for(let a in r){let l=r[a],c=e(l,n);t.setAttribute(a,c)}let s=this.morphAttributes;for(let a in s){let l=[],c=s[a];for(let u=0,f=c.length;u<f;u++){let d=c[u],A=e(d,n);l.push(A)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let a=0,l=o.length;a<l;a++){let c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let c=n[l];e.data.attributes[l]=c.toJSON(e.data)}let r={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],u=[];for(let f=0,d=c.length;f<d;f++){let A=c[f];u.push(A.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let c in r){let u=r[c];this.setAttribute(c,u.clone(t))}let s=e.morphAttributes;for(let c in s){let u=[],f=s[c];for(let d=0,A=f.length;d<A;d++)u.push(f[d].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let c=0,u=o.length;c<u;c++){let f=o[c];this.addGroup(f.start,f.count,f.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let 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._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}},Rd=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=i0,this.updateRanges=[],this.version=0,this.uuid=Mh()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Mh()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Mh()),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}}},Da=new re,Vo=class i{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Da.fromBufferAttribute(this,t),Da.applyMatrix4(e),this.setXYZ(t,Da.x,Da.y,Da.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Da.fromBufferAttribute(this,t),Da.applyNormalMatrix(e),this.setXYZ(t,Da.x,Da.y,Da.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Da.fromBufferAttribute(this,t),Da.transformDirection(e),this.setXYZ(t,Da.x,Da.y,Da.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Fa(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Zn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Zn(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=Fa(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Fa(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Fa(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Fa(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){kA("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new Hi(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 i(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){kA("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},pAe=0,Hs=class extends ca{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:pAe++}),this.uuid=Mh(),this.name="",this.type="Material",this.blending=Ts,this.side=zo,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Jp,this.blendDst=e0,this.blendEquation=oo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new zt(0,0,0),this.blendAlpha=0,this.depthFunc=Ch,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=D2,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=bd,this.stencilZFail=bd,this.stencilZPass=bd,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){Xe(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Xe(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ts&&(n.blending=this.blending),this.side!==zo&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Jp&&(n.blendSrc=this.blendSrc),this.blendDst!==e0&&(n.blendDst=this.blendDst),this.blendEquation!==oo&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ch&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==D2&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==bd&&(n.stencilFail=this.stencilFail),this.stencilZFail!==bd&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==bd&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new zt().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new Oe().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Oe().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},Rh=class extends Hs{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new zt(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}},Uv,w2=new re,kv=new re,zv=new re,Vv=new Oe,S2=new Oe,MZ=new cn,D3=new re,T2=new re,N3=new re,HY=new Oe,b8=new Oe,WY=new Oe,qA=class extends lr{constructor(e=new Rh){if(super(),this.isSprite=!0,this.type="Sprite",Uv===void 0){Uv=new Xn;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Rd(t,5);Uv.setIndex([0,1,2,0,2,3]),Uv.setAttribute("position",new Vo(n,3,0,!1)),Uv.setAttribute("uv",new Vo(n,2,3,!1))}this.geometry=Uv,this.material=e,this.center=new Oe(.5,.5),this.count=1}raycast(e,t){e.camera===null&&ze('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),kv.setFromMatrixScale(this.matrixWorld),MZ.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),zv.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&kv.multiplyScalar(-zv.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;F3(D3.set(-.5,-.5,0),zv,o,kv,r,s),F3(T2.set(.5,-.5,0),zv,o,kv,r,s),F3(N3.set(.5,.5,0),zv,o,kv,r,s),HY.set(0,0),b8.set(1,0),WY.set(1,1);let a=e.ray.intersectTriangle(D3,T2,N3,!1,w2);if(a===null&&(F3(T2.set(-.5,.5,0),zv,o,kv,r,s),b8.set(0,1),a=e.ray.intersectTriangle(D3,N3,T2,!1,w2),a===null))return;let l=e.ray.origin.distanceTo(w2);l<e.near||l>e.far||t.push({distance:l,point:w2.clone(),uv:wd.getInterpolation(w2,D3,T2,N3,HY,b8,WY,new Oe),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 F3(i,e,t,n,r,s){Vv.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(S2.x=s*Vv.x-r*Vv.y,S2.y=r*Vv.x+s*Vv.y):S2.copy(Vv),i.copy(e),i.x+=S2.x,i.y+=S2.y,i.applyMatrix4(MZ)}var yd=new re,w8=new re,B3=new re,Zp=new re,S8=new re,O3=new re,T8=new re,Pd=class{constructor(e=new re,t=new re(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,yd)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=yd.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(yd.copy(this.origin).addScaledVector(this.direction,t),yd.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){w8.copy(e).add(t).multiplyScalar(.5),B3.copy(t).sub(e).normalize(),Zp.copy(this.origin).sub(w8);let s=e.distanceTo(t)*.5,o=-this.direction.dot(B3),a=Zp.dot(this.direction),l=-Zp.dot(B3),c=Zp.lengthSq(),u=Math.abs(1-o*o),f,d,A,y;if(u>0)if(f=o*l-a,d=o*a-l,y=s*u,f>=0)if(d>=-y)if(d<=y){let w=1/u;f*=w,d*=w,A=f*(f+o*d+2*a)+d*(o*f+d+2*l)+c}else d=s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;else d=-s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;else d<=-y?(f=Math.max(0,-(-o*s+a)),d=f>0?-s:Math.min(Math.max(-s,-l),s),A=-f*f+d*(d+2*l)+c):d<=y?(f=0,d=Math.min(Math.max(-s,-l),s),A=d*(d+2*l)+c):(f=Math.max(0,-(o*s+a)),d=f>0?s:Math.min(Math.max(-s,-l),s),A=-f*f+d*(d+2*l)+c);else d=o>0?-s:s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(w8).addScaledVector(B3,d),A}intersectSphere(e,t){yd.subVectors(e.center,this.origin);let n=yd.dot(this.direction),r=yd.dot(yd)-n*n,s=e.radius*e.radius;if(r>s)return null;let o=Math.sqrt(s-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,o,a,l,c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),u>=0?(s=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(s=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o<r||isNaN(r))&&(r=o),f>=0?(a=(e.min.z-d.z)*f,l=(e.max.z-d.z)*f):(a=(e.max.z-d.z)*f,l=(e.min.z-d.z)*f),n>l||a>r)||((a>n||n!==n)&&(n=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,yd)!==null}intersectTriangle(e,t,n,r,s){S8.subVectors(t,e),O3.subVectors(n,e),T8.crossVectors(S8,O3);let o=this.direction.dot(T8),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Zp.subVectors(this.origin,e);let l=a*this.direction.dot(O3.crossVectors(Zp,O3));if(l<0)return null;let c=a*this.direction.dot(S8.cross(Zp));if(c<0||l+c>o)return null;let u=-a*Zp.dot(T8);return u<0?null:this.at(u/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},fs=class extends Hs{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new zt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.combine=tg,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},jY=new cn,PA=new Pd,U3=new yl,XY=new re,k3=new re,z3=new re,V3=new re,E8=new re,G3=new re,$Y=new re,q3=new re,Hn=class extends lr{constructor(e=new Xn,t=new fs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let a=this.morphTargetInfluences;if(s&&a){G3.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let u=a[l],f=s[l];u!==0&&(E8.fromBufferAttribute(f,e),o?G3.addScaledVector(E8,u):G3.addScaledVector(E8.sub(t),u))}t.add(G3)}return t}raycast(e,t){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),U3.copy(n.boundingSphere),U3.applyMatrix4(s),PA.copy(e.ray).recast(e.near),!(U3.containsPoint(PA.origin)===!1&&(PA.intersectSphere(U3,XY)===null||PA.origin.distanceToSquared(XY)>(e.far-e.near)**2))&&(jY.copy(s).invert(),PA.copy(e.ray).applyMatrix4(jY),!(n.boundingBox!==null&&PA.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,PA)))}_computeIntersections(e,t,n){let r,s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,f=s.attributes.normal,d=s.groups,A=s.drawRange;if(a!==null)if(Array.isArray(o))for(let y=0,w=d.length;y<w;y++){let S=d[y],T=o[S.materialIndex],R=Math.max(S.start,A.start),I=Math.min(a.count,Math.min(S.start+S.count,A.start+A.count));for(let P=R,F=I;P<F;P+=3){let D=a.getX(P),L=a.getX(P+1),C=a.getX(P+2);r=H3(this,T,e,n,c,u,f,D,L,C),r&&(r.faceIndex=Math.floor(P/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let y=Math.max(0,A.start),w=Math.min(a.count,A.start+A.count);for(let S=y,T=w;S<T;S+=3){let R=a.getX(S),I=a.getX(S+1),P=a.getX(S+2);r=H3(this,o,e,n,c,u,f,R,I,P),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let y=0,w=d.length;y<w;y++){let S=d[y],T=o[S.materialIndex],R=Math.max(S.start,A.start),I=Math.min(l.count,Math.min(S.start+S.count,A.start+A.count));for(let P=R,F=I;P<F;P+=3){let D=P,L=P+1,C=P+2;r=H3(this,T,e,n,c,u,f,D,L,C),r&&(r.faceIndex=Math.floor(P/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let y=Math.max(0,A.start),w=Math.min(l.count,A.start+A.count);for(let S=y,T=w;S<T;S+=3){let R=S,I=S+1,P=S+2;r=H3(this,o,e,n,c,u,f,R,I,P),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}};function mAe(i,e,t,n,r,s,o,a){let l;if(e.side===mi?l=n.intersectTriangle(o,s,r,!0,a):l=n.intersectTriangle(r,s,o,e.side===zo,a),l===null)return null;q3.copy(a),q3.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(q3);return c<t.near||c>t.far?null:{distance:c,point:q3.clone(),object:i}}function H3(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,k3),i.getVertexPosition(l,z3),i.getVertexPosition(c,V3);let u=mAe(i,e,t,n,k3,z3,V3,$Y);if(u){let f=new re;wd.getBarycoord($Y,k3,z3,V3,f),r&&(u.uv=wd.getInterpolatedAttribute(r,a,l,c,f,new Oe)),s&&(u.uv1=wd.getInterpolatedAttribute(s,a,l,c,f,new Oe)),o&&(u.normal=wd.getInterpolatedAttribute(o,a,l,c,f,new re),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));let d={a,b:l,c,normal:new re,materialIndex:0};wd.getNormal(k3,z3,V3,d.normal),u.face=d,u.barycoord=f}return u}var HA=class extends qs{constructor(e=null,t=1,n=1,r,s,o,a,l,c=Ti,u=Ti,f,d){super(null,o,a,l,c,u,r,s,f,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Ql=class extends Hi{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};var M8=new re,AAe=new re,gAe=new Mn,Na=class{constructor(e=new re(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=M8.subVectors(n,t).cross(AAe.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let 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,n=!0){let r=e.delta(M8),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let o=-(e.start.dot(this.normal)+this.constant)/s;return n===!0&&(o<0||o>1)?null:t.copy(e.start).addScaledVector(r,o)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||gAe.getNormalMatrix(e),r=this.coplanarPoint(M8).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},IA=new yl,vAe=new Oe(.5,.5),W3=new re,zc=class{constructor(e=new Na,t=new Na,n=new Na,r=new Na,s=new Na,o=new Na){this.planes=[e,t,n,r,s,o]}set(e,t,n,r,s,o){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=ko,n=!1){let r=this.planes,s=e.elements,o=s[0],a=s[1],l=s[2],c=s[3],u=s[4],f=s[5],d=s[6],A=s[7],y=s[8],w=s[9],S=s[10],T=s[11],R=s[12],I=s[13],P=s[14],F=s[15];if(r[0].setComponents(c-o,A-u,T-y,F-R).normalize(),r[1].setComponents(c+o,A+u,T+y,F+R).normalize(),r[2].setComponents(c+a,A+f,T+w,F+I).normalize(),r[3].setComponents(c-a,A-f,T-w,F-I).normalize(),n)r[4].setComponents(l,d,S,P).normalize(),r[5].setComponents(c-l,A-d,T-S,F-P).normalize();else if(r[4].setComponents(c-l,A-d,T-S,F-P).normalize(),t===ko)r[5].setComponents(c+l,A+d,T+S,F+P).normalize();else if(t===xl)r[5].setComponents(l,d,S,P).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(),IA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),IA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(IA)}intersectsSprite(e){IA.center.set(0,0,0);let t=vAe.distanceTo(e.center);return IA.radius=.7071067811865476+t,IA.applyMatrix4(e.matrixWorld),this.intersectsSphere(IA)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(W3.x=r.normal.x>0?e.max.x:e.min.x,W3.y=r.normal.y>0?e.max.y:e.min.y,W3.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(W3)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},YY=new cn,N2=class i{constructor(){this.coordinateSystem=ko,this._frustums=[],this._count=0}setFromArrayCamera(e){let t=e.cameras,n=this._frustums;for(let r=0;r<t.length;r++){let s=t[r];YY.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[r]===void 0&&(n[r]=new zc),n[r].setFromProjectionMatrix(YY,s.coordinateSystem,s.reversedDepth)}return this._count=t.length,this}intersectsObject(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsObject(e))return!0;return!1}intersectsSprite(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSprite(e))return!0;return!1}intersectsSphere(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSphere(e))return!0;return!1}intersectsBox(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsBox(e))return!0;return!1}containsPoint(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].containsPoint(e))return!0;return!1}copy(e){this.coordinateSystem=e.coordinateSystem;let t=this._frustums,n=e._frustums;for(let r=0;r<e._count;r++)t[r]===void 0&&(t[r]=new zc),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new i().copy(this)}};var Iu=class extends Hs{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new zt(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}},aM=new re,lM=new re,ZY=new cn,E2=new Pd,j3=new yl,C8=new re,KY=new re,o0=class extends lr{constructor(e=new Xn,t=new Iu){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)aM.fromBufferAttribute(t,r-1),lM.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=aM.distanceTo(lM);e.setAttribute("lineDistance",new Ln(n,1))}else Xe("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),j3.copy(n.boundingSphere),j3.applyMatrix4(r),j3.radius+=s,e.ray.intersectsSphere(j3)===!1)return;ZY.copy(r).invert(),E2.copy(e.ray).applyMatrix4(ZY);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=n.index,d=n.attributes.position;if(u!==null){let A=Math.max(0,o.start),y=Math.min(u.count,o.start+o.count);for(let w=A,S=y-1;w<S;w+=c){let T=u.getX(w),R=u.getX(w+1),I=X3(this,e,E2,l,T,R,w);I&&t.push(I)}if(this.isLineLoop){let w=u.getX(y-1),S=u.getX(A),T=X3(this,e,E2,l,w,S,y-1);T&&t.push(T)}}else{let A=Math.max(0,o.start),y=Math.min(d.count,o.start+o.count);for(let w=A,S=y-1;w<S;w+=c){let T=X3(this,e,E2,l,w,w+1,w);T&&t.push(T)}if(this.isLineLoop){let w=X3(this,e,E2,l,y-1,A,y-1);w&&t.push(w)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function X3(i,e,t,n,r,s,o){let a=i.geometry.attributes.position;if(aM.fromBufferAttribute(a,r),lM.fromBufferAttribute(a,s),t.distanceSqToSegment(aM,lM,C8,KY)>n)return;C8.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(C8);if(!(c<e.near||c>e.far))return{distance:c,point:KY.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var QY=new re,JY=new re,Jv=class extends o0{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)QY.fromBufferAttribute(t,r),JY.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+QY.distanceTo(JY);e.setAttribute("lineDistance",new Ln(n,1))}else Xe("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var a0=class extends Hs{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new zt(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}},eZ=new cn,U8=new Pd,$3=new yl,Y3=new re,F2=class extends lr{constructor(e=new Xn,t=new a0){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),$3.copy(n.boundingSphere),$3.applyMatrix4(r),$3.radius+=s,e.ray.intersectsSphere($3)===!1)return;eZ.copy(r).invert(),U8.copy(e.ray).applyMatrix4(eZ);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=n.index,f=n.attributes.position;if(c!==null){let d=Math.max(0,o.start),A=Math.min(c.count,o.start+o.count);for(let y=d,w=A;y<w;y++){let S=c.getX(y);Y3.fromBufferAttribute(f,S),tZ(Y3,S,l,r,e,t,this)}}else{let d=Math.max(0,o.start),A=Math.min(f.count,o.start+o.count);for(let y=d,w=A;y<w;y++)Y3.fromBufferAttribute(f,y),tZ(Y3,y,l,r,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function tZ(i,e,t,n,r,s,o){let a=U8.distanceSqToPoint(i);if(a<t){let l=new re;U8.closestPointToPoint(i,l),l.applyMatrix4(n);let c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}var WA=class extends qs{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Ti,this.minFilter=Ti,this.generateMipmaps=!1,this.needsUpdate=!0}};var Ph=class extends qs{constructor(e=[],t=ec,n,r,s,o,a,l,c,u){super(e,t,n,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};var Es=class extends qs{constructor(e,t,n=xi,r,s,o,a=Ti,l=Ti,c,u=Vs,f=1){if(u!==Vs&&u!==xo)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let d={width:e,height:t,depth:f};super(d,r,s,o,a,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Zv(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},e_=class extends Es{constructor(e,t=xi,n=ec,r,s,o=Ti,a=Ti,l,c=Vs){let u={width:e,height:e,depth:1},f=[u,u,u,u,u,u];super(e,e,t,n,r,s,o,a,l,c),this.image=f,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},B2=class extends qs{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Lu=class i extends Xn{constructor(e=1,t=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};let a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);let l=[],c=[],u=[],f=[],d=0,A=0;y("z","y","x",-1,-1,n,t,e,o,s,0),y("z","y","x",1,-1,n,t,-e,o,s,1),y("x","z","y",1,1,e,n,t,r,o,2),y("x","z","y",1,-1,e,n,-t,r,o,3),y("x","y","z",1,-1,e,t,n,r,s,4),y("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Ln(c,3)),this.setAttribute("normal",new Ln(u,3)),this.setAttribute("uv",new Ln(f,2));function y(w,S,T,R,I,P,F,D,L,C,B){let k=P/L,z=F/C,G=P/2,W=F/2,Y=D/2,H=L+1,$=C+1,J=0,te=0,ce=new re;for(let he=0;he<$;he++){let ve=he*z-W;for(let Re=0;Re<H;Re++){let Qe=Re*k-G;ce[w]=Qe*R,ce[S]=ve*I,ce[T]=Y,c.push(ce.x,ce.y,ce.z),ce[w]=0,ce[S]=0,ce[T]=D>0?1:-1,u.push(ce.x,ce.y,ce.z),f.push(Re/L),f.push(1-he/C),J+=1}}for(let he=0;he<C;he++)for(let ve=0;ve<L;ve++){let Re=d+ve+H*he,Qe=d+ve+H*(he+1),Fe=d+(ve+1)+H*(he+1),mt=d+(ve+1)+H*he;l.push(Re,Qe,mt),l.push(Qe,Fe,mt),te+=6}a.addGroup(A,te,B),A+=te,d+=J}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};var t_=class i extends Xn{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);let s=[],o=[],a=[],l=[],c=new re,u=new Oe;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let f=0,d=3;f<=t;f++,d+=3){let A=n+f/t*r;c.x=e*Math.cos(A),c.y=e*Math.sin(A),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[d]/e+1)/2,u.y=(o[d+1]/e+1)/2,l.push(u.x,u.y)}for(let f=1;f<=t;f++)s.push(f,f+1,0);this.setIndex(s),this.setAttribute("position",new Ln(o,3)),this.setAttribute("normal",new Ln(a,3)),this.setAttribute("uv",new Ln(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.segments,e.thetaStart,e.thetaLength)}},jA=class i extends Xn{constructor(e=1,t=1,n=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};let c=this;r=Math.floor(r),s=Math.floor(s);let u=[],f=[],d=[],A=[],y=0,w=[],S=n/2,T=0;R(),o===!1&&(e>0&&I(!0),t>0&&I(!1)),this.setIndex(u),this.setAttribute("position",new Ln(f,3)),this.setAttribute("normal",new Ln(d,3)),this.setAttribute("uv",new Ln(A,2));function R(){let P=new re,F=new re,D=0,L=(t-e)/n;for(let C=0;C<=s;C++){let B=[],k=C/s,z=k*(t-e)+e;for(let G=0;G<=r;G++){let W=G/r,Y=W*l+a,H=Math.sin(Y),$=Math.cos(Y);F.x=z*H,F.y=-k*n+S,F.z=z*$,f.push(F.x,F.y,F.z),P.set(H,L,$).normalize(),d.push(P.x,P.y,P.z),A.push(W,1-k),B.push(y++)}w.push(B)}for(let C=0;C<r;C++)for(let B=0;B<s;B++){let k=w[B][C],z=w[B+1][C],G=w[B+1][C+1],W=w[B][C+1];(e>0||B!==0)&&(u.push(k,z,W),D+=3),(t>0||B!==s-1)&&(u.push(z,G,W),D+=3)}c.addGroup(T,D,0),T+=D}function I(P){let F=y,D=new Oe,L=new re,C=0,B=P===!0?e:t,k=P===!0?1:-1;for(let G=1;G<=r;G++)f.push(0,S*k,0),d.push(0,k,0),A.push(.5,.5),y++;let z=y;for(let G=0;G<=r;G++){let Y=G/r*l+a,H=Math.cos(Y),$=Math.sin(Y);L.x=B*$,L.y=S*k,L.z=B*H,f.push(L.x,L.y,L.z),d.push(0,k,0),D.x=H*.5+.5,D.y=$*.5*k+.5,A.push(D.x,D.y),y++}for(let G=0;G<r;G++){let W=F+G,Y=z+G;P===!0?u.push(Y,Y+1,W):u.push(Y+1,Y,W),C+=3}c.addGroup(T,C,P===!0?1:2),T+=C}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}};var za=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Xe("Curve: .getPoint() not implemented.")}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let 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;let t=[],n,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let n=this.getLengths(),r=0,s=n.length,o;t?o=t:o=e*n[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=n[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,n[r]===o)return r/(s-1);let u=n[r],d=n[r+1]-u,A=(o-u)/d;return(r+A)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);let o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new Oe:new re);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new re,r=[],s=[],o=[],a=new re,l=new cn;for(let A=0;A<=e;A++){let y=A/e;r[A]=this.getTangentAt(y,new re)}s[0]=new re,o[0]=new re;let c=Number.MAX_VALUE,u=Math.abs(r[0].x),f=Math.abs(r[0].y),d=Math.abs(r[0].z);u<=c&&(c=u,n.set(1,0,0)),f<=c&&(c=f,n.set(0,1,0)),d<=c&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let A=1;A<=e;A++){if(s[A]=s[A-1].clone(),o[A]=o[A-1].clone(),a.crossVectors(r[A-1],r[A]),a.length()>Number.EPSILON){a.normalize();let y=Math.acos(Nn(r[A-1].dot(r[A]),-1,1));s[A].applyMatrix4(l.makeRotationAxis(a,y))}o[A].crossVectors(r[A],s[A])}if(t===!0){let A=Math.acos(Nn(s[0].dot(s[e]),-1,1));A/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(A=-A);for(let y=1;y<=e;y++)s[y].applyMatrix4(l.makeRotationAxis(r[y],A*y)),o[y].crossVectors(r[y],s[y])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},n_=class extends za{constructor(e=0,t=0,n=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new Oe){let n=t,r=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);let a=this.aStartAngle+e*s,l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let u=Math.cos(this.aRotation),f=Math.sin(this.aRotation),d=l-this.aX,A=c-this.aY;l=d*u-A*f+this.aX,c=d*f+A*u+this.aY}return n.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(){let 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}},cM=class extends n_{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function AF(){let i=0,e=0,t=0,n=0;function r(s,o,a,l){i=s,e=a,t=-3*s+3*o-2*a-l,n=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,f){let d=(o-s)/c-(a-s)/(c+u)+(a-o)/u,A=(a-o)/u-(l-o)/(u+f)+(l-a)/f;d*=u,A*=u,r(o,a,d,A)},calc:function(s){let o=s*s,a=o*s;return i+e*s+t*o+n*a}}}var nZ=new re,iZ=new re,R8=new AF,P8=new AF,I8=new AF,uM=class extends za{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new re){let n=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e,a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=r[(a-1)%s]:(iZ.subVectors(r[0],r[1]).add(r[0]),c=iZ);let f=r[a%s],d=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(nZ.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=nZ),this.curveType==="centripetal"||this.curveType==="chordal"){let A=this.curveType==="chordal"?.5:.25,y=Math.pow(c.distanceToSquared(f),A),w=Math.pow(f.distanceToSquared(d),A),S=Math.pow(d.distanceToSquared(u),A);w<1e-4&&(w=1),y<1e-4&&(y=w),S<1e-4&&(S=w),R8.initNonuniformCatmullRom(c.x,f.x,d.x,u.x,y,w,S),P8.initNonuniformCatmullRom(c.y,f.y,d.y,u.y,y,w,S),I8.initNonuniformCatmullRom(c.z,f.z,d.z,u.z,y,w,S)}else this.curveType==="catmullrom"&&(R8.initCatmullRom(c.x,f.x,d.x,u.x,this.tension),P8.initCatmullRom(c.y,f.y,d.y,u.y,this.tension),I8.initCatmullRom(c.z,f.z,d.z,u.z,this.tension));return n.set(R8.calc(l),P8.calc(l),I8.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(new re().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function rZ(i,e,t,n,r){let s=(n-e)*.5,o=(r-t)*.5,a=i*i,l=i*a;return(2*t-2*n+s+o)*l+(-3*t+3*n-2*s-o)*a+s*i+t}function _Ae(i,e){let t=1-i;return t*t*e}function xAe(i,e){return 2*(1-i)*i*e}function yAe(i,e){return i*i*e}function P2(i,e,t,n){return _Ae(i,e)+xAe(i,t)+yAe(i,n)}function bAe(i,e){let t=1-i;return t*t*t*e}function wAe(i,e){let t=1-i;return 3*t*t*i*e}function SAe(i,e){return 3*(1-i)*i*i*e}function TAe(i,e){return i*i*i*e}function I2(i,e,t,n,r){return bAe(i,e)+wAe(i,t)+SAe(i,n)+TAe(i,r)}var O2=class extends za{constructor(e=new Oe,t=new Oe,n=new Oe,r=new Oe){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new Oe){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(I2(e,r.x,s.x,o.x,a.x),I2(e,r.y,s.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let 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}},i_=class extends za{constructor(e=new re,t=new re,n=new re,r=new re){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new re){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(I2(e,r.x,s.x,o.x,a.x),I2(e,r.y,s.y,o.y,a.y),I2(e,r.z,s.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let 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}},U2=class extends za{constructor(e=new Oe,t=new Oe){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Oe){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Oe){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(){let 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}},hM=class extends za{constructor(e=new re,t=new re){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new re){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new re){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(){let 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}},k2=class extends za{constructor(e=new Oe,t=new Oe,n=new Oe){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Oe){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(P2(e,r.x,s.x,o.x),P2(e,r.y,s.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}},z2=class extends za{constructor(e=new re,t=new re,n=new re){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new re){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(P2(e,r.x,s.x,o.x),P2(e,r.y,s.y,o.y),P2(e,r.z,s.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}},V2=class extends za{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Oe){let n=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],c=r[o],u=r[o>r.length-2?r.length-1:o+1],f=r[o>r.length-3?r.length-1:o+2];return n.set(rZ(a,l.x,c.x,u.x,f.x),rZ(a,l.y,c.y,u.y,f.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(new Oe().fromArray(r))}return this}},fM=Object.freeze({__proto__:null,ArcCurve:cM,CatmullRomCurve3:uM,CubicBezierCurve:O2,CubicBezierCurve3:i_,EllipseCurve:n_,LineCurve:U2,LineCurve3:hM,QuadraticBezierCurve:k2,QuadraticBezierCurve3:z2,SplineCurve:V2}),dM=class extends za{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new fM[n](t,e))}return this}getPoint(e,t){let n=e*this.getLength(),r=this.getCurveLengths(),s=0;for(;s<r.length;){if(r[s]>=n){let o=r[s]-n,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){let 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;let e=[],t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let r=0,s=this.curves;r<s.length;r++){let o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){let u=l[c];n&&n.equals(u)||(t.push(u),n=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,n=e.curves.length;t<n;t++){let r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let r=e.curves[t];this.curves.push(new fM[r.type]().fromJSON(r))}return this}},XA=class extends dM{constructor(e){super(),this.type="Path",this.currentPoint=new Oe,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new U2(this.currentPoint.clone(),new Oe(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){let s=new k2(this.currentPoint.clone(),new Oe(e,t),new Oe(n,r));return this.curves.push(s),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,s,o){let a=new O2(this.currentPoint.clone(),new Oe(e,t),new Oe(n,r),new Oe(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),n=new V2(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,s,o){let a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,n,r,s,o),this}absarc(e,t,n,r,s,o){return this.absellipse(e,t,n,n,r,s,o),this}ellipse(e,t,n,r,s,o,a,l){let c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,n,r,s,o,a,l),this}absellipse(e,t,n,r,s,o,a,l){let c=new n_(e,t,n,r,s,o,a,l);if(this.curves.length>0){let f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);let u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},G2=class extends XA{constructor(e){super(e),this.uuid=Mh(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let r=e.holes[t];this.holes.push(new XA().fromJSON(r))}return this}};function EAe(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length,s=CZ(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=IAe(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let d=t;d<r;d+=t){let A=i[d],y=i[d+1];A<a&&(a=A),y<l&&(l=y),A>u&&(u=A),y>f&&(f=y)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return q2(s,o,t,a,l,c,0),o}function CZ(i,e,t,n,r){let s;if(r===GAe(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=sZ(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=sZ(o/n|0,i[o],i[o+1],s);return s&&r_(s,s.next)&&(W2(s),s=s.next),s}function $A(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(r_(t,t.next)||Zr(t.prev,t,t.next)===0)){if(W2(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function q2(i,e,t,n,r,s,o){if(!i)return;!o&&s&&BAe(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?CAe(i,n,r,s):MAe(i)){e.push(l.i,i.i,c.i),W2(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=RAe($A(i),e),q2(i,e,t,n,r,s,2)):o===2&&PAe(i,e,t,n,r,s):q2($A(i),e,t,n,r,s,1);break}}}function MAe(i){let e=i.prev,t=i,n=i.next;if(Zr(e,t,n)>=0)return!1;let r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=Math.min(r,s,o),f=Math.min(a,l,c),d=Math.max(r,s,o),A=Math.max(a,l,c),y=n.next;for(;y!==e;){if(y.x>=u&&y.x<=d&&y.y>=f&&y.y<=A&&M2(r,a,s,l,o,c,y.x,y.y)&&Zr(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function CAe(i,e,t,n){let r=i.prev,s=i,o=i.next;if(Zr(r,s,o)>=0)return!1;let a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,d=o.y,A=Math.min(a,l,c),y=Math.min(u,f,d),w=Math.max(a,l,c),S=Math.max(u,f,d),T=k8(A,y,e,t,n),R=k8(w,S,e,t,n),I=i.prevZ,P=i.nextZ;for(;I&&I.z>=T&&P&&P.z<=R;){if(I.x>=A&&I.x<=w&&I.y>=y&&I.y<=S&&I!==r&&I!==o&&M2(a,u,l,f,c,d,I.x,I.y)&&Zr(I.prev,I,I.next)>=0||(I=I.prevZ,P.x>=A&&P.x<=w&&P.y>=y&&P.y<=S&&P!==r&&P!==o&&M2(a,u,l,f,c,d,P.x,P.y)&&Zr(P.prev,P,P.next)>=0))return!1;P=P.nextZ}for(;I&&I.z>=T;){if(I.x>=A&&I.x<=w&&I.y>=y&&I.y<=S&&I!==r&&I!==o&&M2(a,u,l,f,c,d,I.x,I.y)&&Zr(I.prev,I,I.next)>=0)return!1;I=I.prevZ}for(;P&&P.z<=R;){if(P.x>=A&&P.x<=w&&P.y>=y&&P.y<=S&&P!==r&&P!==o&&M2(a,u,l,f,c,d,P.x,P.y)&&Zr(P.prev,P,P.next)>=0)return!1;P=P.nextZ}return!0}function RAe(i,e){let t=i;do{let n=t.prev,r=t.next.next;!r_(n,r)&&PZ(n,t,t.next,r)&&H2(n,r)&&H2(r,n)&&(e.push(n.i,t.i,r.i),W2(t),W2(t.next),t=i=r),t=t.next}while(t!==i);return $A(t)}function PAe(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&kAe(o,a)){let l=IZ(o,a);o=$A(o,o.next),l=$A(l,l.next),q2(o,e,t,n,r,s,0),q2(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function IAe(i,e,t,n){let r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s]*n,l=s<o-1?e[s+1]*n:i.length,c=CZ(i,a,l,n,!1);c===c.next&&(c.steiner=!0),r.push(UAe(c))}r.sort(LAe);for(let s=0;s<r.length;s++)t=DAe(r[s],t);return t}function LAe(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){let n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function DAe(i,e){let t=NAe(i,e);if(!t)return e;let n=IZ(t,i);return $A(n,n.next),$A(t,t.next)}function NAe(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(r_(i,t))return t;do{if(r_(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){let f=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>s&&(s=f,o=t.x<t.next.x?t:t.next,f===n))return o}t=t.next}while(t!==e);if(!o)return null;let a=o,l=o.x,c=o.y,u=1/0;t=o;do{if(n>=t.x&&t.x>=l&&n!==t.x&&RZ(r<c?n:s,r,l,c,r<c?s:n,r,t.x,t.y)){let f=Math.abs(r-t.y)/(n-t.x);H2(t,i)&&(f<u||f===u&&(t.x>o.x||t.x===o.x&&FAe(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function FAe(i,e){return Zr(i.prev,i,e.prev)<0&&Zr(e.next,i,i.next)<0}function BAe(i,e,t,n){let r=i;do r.z===0&&(r.z=k8(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,OAe(r)}function OAe(i){let e,t=1;do{let n=i,r;i=null;let s=null;for(e=0;n;){e++;let o=n,a=0;for(let c=0;c<t&&(a++,o=o.nextZ,!!o);c++);let l=t;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||n.z<=o.z)?(r=n,n=n.nextZ,a--):(r=o,o=o.nextZ,l--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;n=o}s.nextZ=null,t*=2}while(e>1);return i}function k8(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function UAe(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function RZ(i,e,t,n,r,s,o,a){return(r-o)*(e-a)>=(i-o)*(s-a)&&(i-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(n-a)}function M2(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&RZ(i,e,t,n,r,s,o,a)}function kAe(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!zAe(i,e)&&(H2(i,e)&&H2(e,i)&&VAe(i,e)&&(Zr(i.prev,i,e.prev)||Zr(i,e.prev,e))||r_(i,e)&&Zr(i.prev,i,i.next)>0&&Zr(e.prev,e,e.next)>0)}function Zr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function r_(i,e){return i.x===e.x&&i.y===e.y}function PZ(i,e,t,n){let r=K3(Zr(i,e,t)),s=K3(Zr(i,e,n)),o=K3(Zr(t,n,i)),a=K3(Zr(t,n,e));return!!(r!==s&&o!==a||r===0&&Z3(i,t,e)||s===0&&Z3(i,n,e)||o===0&&Z3(t,i,n)||a===0&&Z3(t,e,n))}function Z3(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function K3(i){return i>0?1:i<0?-1:0}function zAe(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&PZ(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function H2(i,e){return Zr(i.prev,i,i.next)<0?Zr(i,e,i.next)>=0&&Zr(i,i.prev,e)>=0:Zr(i,e,i.prev)<0||Zr(i,i.next,e)<0}function VAe(i,e){let t=i,n=!1,r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function IZ(i,e){let t=z8(i.i,i.x,i.y),n=z8(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function sZ(i,e,t,n){let r=z8(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function W2(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function z8(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function GAe(i,e,t,n){let r=0;for(let s=e,o=t-n;s<t;s+=n)r+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return r}var V8=class{static triangulate(e,t,n=2){return EAe(e,t,n)}},Qp=class i{static area(e){let t=e.length,n=0;for(let r=t-1,s=0;s<t;r=s++)n+=e[r].x*e[s].y-e[s].x*e[r].y;return n*.5}static isClockWise(e){return i.area(e)<0}static triangulateShape(e,t){let n=[],r=[],s=[];oZ(e),aZ(n,e);let o=e.length;t.forEach(oZ);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,aZ(n,t[l]);let a=V8.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function oZ(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function aZ(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var j2=class i extends Xn{constructor(e=new G2([new Oe(.5,.5),new Oe(-.5,.5),new Oe(-.5,-.5),new Oe(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){let c=e[a];o(c)}this.setAttribute("position",new Ln(r,3)),this.setAttribute("uv",new Ln(s,2)),this.computeVertexNormals();function o(a){let l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:1,d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,A=t.bevelThickness!==void 0?t.bevelThickness:.2,y=t.bevelSize!==void 0?t.bevelSize:A-.1,w=t.bevelOffset!==void 0?t.bevelOffset:0,S=t.bevelSegments!==void 0?t.bevelSegments:3,T=t.extrudePath,R=t.UVGenerator!==void 0?t.UVGenerator:qAe,I,P=!1,F,D,L,C;if(T){I=T.getSpacedPoints(u),P=!0,d=!1;let $e=T.isCatmullRomCurve3?T.closed:!1;F=T.computeFrenetFrames(u,$e),D=new re,L=new re,C=new re}d||(S=0,A=0,y=0,w=0);let B=a.extractPoints(c),k=B.shape,z=B.holes;if(!Qp.isClockWise(k)){k=k.reverse();for(let $e=0,ot=z.length;$e<ot;$e++){let nt=z[$e];Qp.isClockWise(nt)&&(z[$e]=nt.reverse())}}function W($e){let nt=10000000000000001e-36,bt=$e[0];for(let yt=1;yt<=$e.length;yt++){let hn=yt%$e.length,en=$e[hn],tn=en.x-bt.x,bn=en.y-bt.y,_e=tn*tn+bn*bn,vi=Math.max(Math.abs(en.x),Math.abs(en.y),Math.abs(bt.x),Math.abs(bt.y)),zn=nt*vi*vi;if(_e<=zn){$e.splice(hn,1),yt--;continue}bt=en}}W(k),z.forEach(W);let Y=z.length,H=k;for(let $e=0;$e<Y;$e++){let ot=z[$e];k=k.concat(ot)}function $($e,ot,nt){return ot||ze("ExtrudeGeometry: vec does not exist"),$e.clone().addScaledVector(ot,nt)}let J=k.length;function te($e,ot,nt){let bt,yt,hn,en=$e.x-ot.x,tn=$e.y-ot.y,bn=nt.x-$e.x,_e=nt.y-$e.y,vi=en*en+tn*tn,zn=en*_e-tn*bn;if(Math.abs(zn)>Number.EPSILON){let le=Math.sqrt(vi),Z=Math.sqrt(bn*bn+_e*_e),Te=ot.x-tn/le,Ie=ot.y+en/le,Ge=nt.x-_e/Z,vt=nt.y+bn/Z,Tt=((Ge-Te)*_e-(vt-Ie)*bn)/(en*_e-tn*bn);bt=Te+en*Tt-$e.x,yt=Ie+tn*Tt-$e.y;let qe=bt*bt+yt*yt;if(qe<=2)return new Oe(bt,yt);hn=Math.sqrt(qe/2)}else{let le=!1;en>Number.EPSILON?bn>Number.EPSILON&&(le=!0):en<-Number.EPSILON?bn<-Number.EPSILON&&(le=!0):Math.sign(tn)===Math.sign(_e)&&(le=!0),le?(bt=-tn,yt=en,hn=Math.sqrt(vi)):(bt=en,yt=tn,hn=Math.sqrt(vi/2))}return new Oe(bt/hn,yt/hn)}let ce=[];for(let $e=0,ot=H.length,nt=ot-1,bt=$e+1;$e<ot;$e++,nt++,bt++)nt===ot&&(nt=0),bt===ot&&(bt=0),ce[$e]=te(H[$e],H[nt],H[bt]);let he=[],ve,Re=ce.concat();for(let $e=0,ot=Y;$e<ot;$e++){let nt=z[$e];ve=[];for(let bt=0,yt=nt.length,hn=yt-1,en=bt+1;bt<yt;bt++,hn++,en++)hn===yt&&(hn=0),en===yt&&(en=0),ve[bt]=te(nt[bt],nt[hn],nt[en]);he.push(ve),Re=Re.concat(ve)}let Qe;if(S===0)Qe=Qp.triangulateShape(H,z);else{let $e=[],ot=[];for(let nt=0;nt<S;nt++){let bt=nt/S,yt=A*Math.cos(bt*Math.PI/2),hn=y*Math.sin(bt*Math.PI/2)+w;for(let en=0,tn=H.length;en<tn;en++){let bn=$(H[en],ce[en],hn);Mt(bn.x,bn.y,-yt),bt===0&&$e.push(bn)}for(let en=0,tn=Y;en<tn;en++){let bn=z[en];ve=he[en];let _e=[];for(let vi=0,zn=bn.length;vi<zn;vi++){let le=$(bn[vi],ve[vi],hn);Mt(le.x,le.y,-yt),bt===0&&_e.push(le)}bt===0&&ot.push(_e)}}Qe=Qp.triangulateShape($e,ot)}let Fe=Qe.length,mt=y+w;for(let $e=0;$e<J;$e++){let ot=d?$(k[$e],Re[$e],mt):k[$e];P?(L.copy(F.normals[0]).multiplyScalar(ot.x),D.copy(F.binormals[0]).multiplyScalar(ot.y),C.copy(I[0]).add(L).add(D),Mt(C.x,C.y,C.z)):Mt(ot.x,ot.y,0)}for(let $e=1;$e<=u;$e++)for(let ot=0;ot<J;ot++){let nt=d?$(k[ot],Re[ot],mt):k[ot];P?(L.copy(F.normals[$e]).multiplyScalar(nt.x),D.copy(F.binormals[$e]).multiplyScalar(nt.y),C.copy(I[$e]).add(L).add(D),Mt(C.x,C.y,C.z)):Mt(nt.x,nt.y,f/u*$e)}for(let $e=S-1;$e>=0;$e--){let ot=$e/S,nt=A*Math.cos(ot*Math.PI/2),bt=y*Math.sin(ot*Math.PI/2)+w;for(let yt=0,hn=H.length;yt<hn;yt++){let en=$(H[yt],ce[yt],bt);Mt(en.x,en.y,f+nt)}for(let yt=0,hn=z.length;yt<hn;yt++){let en=z[yt];ve=he[yt];for(let tn=0,bn=en.length;tn<bn;tn++){let _e=$(en[tn],ve[tn],bt);P?Mt(_e.x,_e.y+I[u-1].y,I[u-1].x+nt):Mt(_e.x,_e.y,f+nt)}}}Ee(),Ve();function Ee(){let $e=r.length/3;if(d){let ot=0,nt=J*ot;for(let bt=0;bt<Fe;bt++){let yt=Qe[bt];Et(yt[2]+nt,yt[1]+nt,yt[0]+nt)}ot=u+S*2,nt=J*ot;for(let bt=0;bt<Fe;bt++){let yt=Qe[bt];Et(yt[0]+nt,yt[1]+nt,yt[2]+nt)}}else{for(let ot=0;ot<Fe;ot++){let nt=Qe[ot];Et(nt[2],nt[1],nt[0])}for(let ot=0;ot<Fe;ot++){let nt=Qe[ot];Et(nt[0]+J*u,nt[1]+J*u,nt[2]+J*u)}}n.addGroup($e,r.length/3-$e,0)}function Ve(){let $e=r.length/3,ot=0;Ye(H,ot),ot+=H.length;for(let nt=0,bt=z.length;nt<bt;nt++){let yt=z[nt];Ye(yt,ot),ot+=yt.length}n.addGroup($e,r.length/3-$e,1)}function Ye($e,ot){let nt=$e.length;for(;--nt>=0;){let bt=nt,yt=nt-1;yt<0&&(yt=$e.length-1);for(let hn=0,en=u+S*2;hn<en;hn++){let tn=J*hn,bn=J*(hn+1),_e=ot+bt+tn,vi=ot+yt+tn,zn=ot+yt+bn,le=ot+bt+bn;Pt(_e,vi,zn,le)}}}function Mt($e,ot,nt){l.push($e),l.push(ot),l.push(nt)}function Et($e,ot,nt){dn($e),dn(ot),dn(nt);let bt=r.length/3,yt=R.generateTopUV(n,r,bt-3,bt-2,bt-1);Gt(yt[0]),Gt(yt[1]),Gt(yt[2])}function Pt($e,ot,nt,bt){dn($e),dn(ot),dn(bt),dn(ot),dn(nt),dn(bt);let yt=r.length/3,hn=R.generateSideWallUV(n,r,yt-6,yt-3,yt-2,yt-1);Gt(hn[0]),Gt(hn[1]),Gt(hn[3]),Gt(hn[1]),Gt(hn[2]),Gt(hn[3])}function dn($e){r.push(l[$e*3+0]),r.push(l[$e*3+1]),r.push(l[$e*3+2])}function Gt($e){s.push($e.x),s.push($e.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return HAe(t,n,e)}static fromJSON(e,t){let n=[];for(let s=0,o=e.shapes.length;s<o;s++){let a=t[e.shapes[s]];n.push(a)}let r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new fM[r.type]().fromJSON(r)),new i(n,e.options)}},qAe={generateTopUV:function(i,e,t,n,r){let s=e[t*3],o=e[t*3+1],a=e[n*3],l=e[n*3+1],c=e[r*3],u=e[r*3+1];return[new Oe(s,o),new Oe(a,l),new Oe(c,u)]},generateSideWallUV:function(i,e,t,n,r,s){let o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[n*3],u=e[n*3+1],f=e[n*3+2],d=e[r*3],A=e[r*3+1],y=e[r*3+2],w=e[s*3],S=e[s*3+1],T=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new Oe(o,1-l),new Oe(c,1-f),new Oe(d,1-y),new Oe(w,1-T)]:[new Oe(a,1-l),new Oe(u,1-f),new Oe(A,1-y),new Oe(S,1-T)]}};function HAe(i,e,t){if(t.shapes=[],Array.isArray(i))for(let n=0,r=i.length;n<r;n++){let s=i[n];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var YA=class i extends Xn{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let s=e/2,o=t/2,a=Math.floor(n),l=Math.floor(r),c=a+1,u=l+1,f=e/a,d=t/l,A=[],y=[],w=[],S=[];for(let T=0;T<u;T++){let R=T*d-o;for(let I=0;I<c;I++){let P=I*f-s;y.push(P,-R,0),w.push(0,0,1),S.push(I/a),S.push(1-T/l)}}for(let T=0;T<l;T++)for(let R=0;R<a;R++){let I=R+c*T,P=R+c*(T+1),F=R+1+c*(T+1),D=R+1+c*T;A.push(I,P,D),A.push(P,F,D)}this.setIndex(A),this.setAttribute("position",new Ln(y,3)),this.setAttribute("normal",new Ln(w,3)),this.setAttribute("uv",new Ln(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.widthSegments,e.heightSegments)}};var Va=class i extends Xn{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let l=Math.min(o+a,Math.PI),c=0,u=[],f=new re,d=new re,A=[],y=[],w=[],S=[];for(let T=0;T<=n;T++){let R=[],I=T/n,P=o+I*a,F=e*Math.cos(P),D=Math.sqrt(e*e-F*F),L=0;T===0&&o===0?L=.5/t:T===n&&l===Math.PI&&(L=-.5/t);for(let C=0;C<=t;C++){let B=C/t,k=r+B*s;f.x=-D*Math.cos(k),f.y=F,f.z=D*Math.sin(k),y.push(f.x,f.y,f.z),d.copy(f).normalize(),w.push(d.x,d.y,d.z),S.push(B+L,1-I),R.push(c++)}u.push(R)}for(let T=0;T<n;T++)for(let R=0;R<t;R++){let I=u[T][R+1],P=u[T][R],F=u[T+1][R],D=u[T+1][R+1];(T!==0||o>0)&&A.push(I,P,D),(T!==n-1||l<Math.PI)&&A.push(P,F,D)}this.setIndex(A),this.setAttribute("position",new Ln(y,3)),this.setAttribute("normal",new Ln(w,3)),this.setAttribute("uv",new Ln(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var X2=class i extends Xn{constructor(e=new z2(new re(-1,-1,0),new re(-1,1,0),new re(1,1,0)),t=64,n=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:s};let o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;let a=new re,l=new re,c=new Oe,u=new re,f=[],d=[],A=[],y=[];w(),this.setIndex(y),this.setAttribute("position",new Ln(f,3)),this.setAttribute("normal",new Ln(d,3)),this.setAttribute("uv",new Ln(A,2));function w(){for(let I=0;I<t;I++)S(I);S(s===!1?t:0),R(),T()}function S(I){u=e.getPointAt(I/t,u);let P=o.normals[I],F=o.binormals[I];for(let D=0;D<=r;D++){let L=D/r*Math.PI*2,C=Math.sin(L),B=-Math.cos(L);l.x=B*P.x+C*F.x,l.y=B*P.y+C*F.y,l.z=B*P.z+C*F.z,l.normalize(),d.push(l.x,l.y,l.z),a.x=u.x+n*l.x,a.y=u.y+n*l.y,a.z=u.z+n*l.z,f.push(a.x,a.y,a.z)}}function T(){for(let I=1;I<=t;I++)for(let P=1;P<=r;P++){let F=(r+1)*(I-1)+(P-1),D=(r+1)*I+(P-1),L=(r+1)*I+P,C=(r+1)*(I-1)+P;y.push(F,D,C),y.push(D,L,C)}}function R(){for(let I=0;I<=t;I++)for(let P=0;P<=r;P++)c.x=I/t,c.y=P/r,A.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new i(new fM[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},$2=class extends Xn{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){let t=[],n=new Set,r=new re,s=new re;if(e.index!==null){let o=e.attributes.position,a=e.index,l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){let f=l[c],d=f.start,A=f.count;for(let y=d,w=d+A;y<w;y+=3)for(let S=0;S<3;S++){let T=a.getX(y+S),R=a.getX(y+(S+1)%3);r.fromBufferAttribute(o,T),s.fromBufferAttribute(o,R),lZ(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{let o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){let u=3*a+c,f=3*a+(c+1)%3;r.fromBufferAttribute(o,u),s.fromBufferAttribute(o,f),lZ(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Ln(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function lZ(i,e,t){let n=`${i.x},${i.y},${i.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${i.x},${i.y},${i.z}`;return t.has(n)===!0||t.has(r)===!0?!1:(t.add(n),t.add(r),!0)}var Y2=class extends Hs{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new zt(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}};function fg(i){let e={};for(let t in i){e[t]={};for(let n in i[t]){let r=i[t][n];if(cZ(r))r.isRenderTargetTexture?(Xe("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone();else if(Array.isArray(r))if(cZ(r[0])){let s=[];for(let o=0,a=r.length;o<a;o++)s[o]=r[o].clone();e[t][n]=s}else e[t][n]=r.slice();else e[t][n]=r}}return e}function fa(i){let e={};for(let t=0;t<i.length;t++){let n=fg(i[t]);for(let r in n)e[r]=n[r]}return e}function cZ(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function WAe(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function gF(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ln.workingColorSpace}var dg={clone:fg,merge:fa},jAe=`void main() {1111 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );12-}`,ZAe=`void main() {12+}`,XAe=`void main() {1313 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );14-}`,ps=class extends Ws{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=YAe,this.fragmentShader=ZAe,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=dg(e.uniforms),this.uniformsGroups=$Ae(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let r in this.uniforms){let o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new zt().setHex(r.value);break;case"v2":this.uniforms[n].value=new Oe().fromArray(r.value);break;case"v3":this.uniforms[n].value=new re().fromArray(r.value);break;case"v4":this.uniforms[n].value=new xn().fromArray(r.value);break;case"m3":this.uniforms[n].value=new Mn().fromArray(r.value);break;case"m4":this.uniforms[n].value=new cn().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},_M=class extends ps{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},a_=class extends Ws{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new zt(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 zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ic,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},J2=class extends a_{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 Oe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Nn(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 zt(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 zt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new zt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},KA=class extends Ws{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new zt(16777215),this.specular=new zt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ic,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.combine=ng,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.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}},eb=class extends Ws{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new zt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ic,this.normalScale=new Oe(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}},tb=class extends Ws{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ic,this.normalScale=new Oe(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}},Ga=class extends Ws{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new zt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ic,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.combine=ng,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},xM=class extends Ws{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=MZ,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}},yM=class extends Ws{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}},nb=class extends Ws{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new zt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ic,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}},ib=class extends Fu{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 iM(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}var c0=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],s=t[n-1];e:{t:{let o;n:{i:if(!(e<r)){for(let a=n+2;;){if(r===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(s=r,r=t[++n],e<r)break t}o=t.length;break n}if(!(e>=s)){let a=t[1];e<a&&(n=2,s=a);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=s,s=t[--n-1],e>=s)break t}o=n,n=0;break n}break e}for(;n<o;){let a=n+o>>>1;e<t[a]?o=a:n=a+1}if(r=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}},bM=class extends c0{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:F8,endingEnd:F8}}intervalChanged_(e,t,n){let r=this.parameterPositions,s=e-2,o=e+1,a=r[s],l=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case B8:s=e,a=2*t-n;break;case O8:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case B8:o=e,l=2*n-t;break;case O8:o=1,l=n+r[1]-r[0];break;default:o=e-1,l=t}let c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,f=this._offsetNext,d=this._weightPrev,A=this._weightNext,y=(n-t)/(r-t),w=y*y,S=w*y,T=-d*S+2*d*w-d*y,R=(1+d)*S+(-1.5-2*d)*w+(-.5+d)*y+1,P=(-1-A)*S+(1.5+A)*w+.5*y,I=A*S-A*w;for(let F=0;F!==a;++F)s[F]=T*o[u+F]+R*o[c+F]+P*o[l+F]+I*o[f+F];return s}},wM=class extends c0{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(n-t)/(r-t),f=1-u;for(let d=0;d!==a;++d)s[d]=o[c+d]*f+o[l+d]*u;return s}},SM=class extends c0{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},TM=class extends c0{interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this.inTangents,f=this.outTangents;if(!u||!f){let y=(n-t)/(r-t),w=1-y;for(let S=0;S!==a;++S)s[S]=o[c+S]*w+o[l+S]*y;return s}let d=a*2,A=e-1;for(let y=0;y!==a;++y){let w=o[c+y],S=o[l+y],T=A*d+y*2,R=f[T],P=f[T+1],I=e*d+y*2,F=u[I],D=u[I+1],L=(n-t)/(r-t),C,B,k,z,G;for(let W=0;W<8;W++){C=L*L,B=C*L,k=1-L,z=k*k,G=z*k;let H=G*t+3*z*L*R+3*k*C*F+B*r-n;if(Math.abs(H)<1e-10)break;let $=3*z*(R-t)+6*k*L*(F-R)+3*C*(r-F);if(Math.abs($)<1e-10)break;L=L-H/$,L=Math.max(0,Math.min(1,L))}s[y]=G*w+3*z*L*P+3*k*C*D+B*S}return s}},tc=class{constructor(e,t,n,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=iM(t,this.TimeBufferType),this.values=iM(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:iM(e.times,Array),values:iM(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new SM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new wM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new bM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new TM(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case F2:t=this.InterpolantFactoryMethodDiscrete;break;case cM:t=this.InterpolantFactoryMethodLinear;break;case aM:t=this.InterpolantFactoryMethodSmooth;break;case N8:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Xe("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return F2;case this.InterpolantFactoryMethodLinear:return cM;case this.InterpolantFactoryMethodSmooth:return aM;case this.InterpolantFactoryMethodBezier:return N8}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){let n=this.times,r=n.length,s=0,o=r-1;for(;s!==r&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(ze("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,r=this.values,s=n.length;s===0&&(ze("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){ze("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){ze("KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&p_(r))for(let a=0,l=r.length;a!==l;++a){let c=r[a];if(isNaN(c)){ze("KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===aM,s=e.length-1,o=1;for(let a=1;a<s;++a){let l=!1,c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(r)l=!0;else{let f=a*n,d=f-n,A=f+n;for(let y=0;y!==n;++y){let w=t[f+y];if(w!==t[d+y]||w!==t[A+y]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];let f=a*n,d=o*n;for(let A=0;A!==n;++A)t[d+A]=t[f+A]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};tc.prototype.ValueTypeName="";tc.prototype.TimeBufferType=Float32Array;tc.prototype.ValueBufferType=Float32Array;tc.prototype.DefaultInterpolation=cM;var u0=class extends tc{constructor(e,t,n){super(e,t,n)}};u0.prototype.ValueTypeName="bool";u0.prototype.ValueBufferType=Array;u0.prototype.DefaultInterpolation=F2;u0.prototype.InterpolantFactoryMethodLinear=void 0;u0.prototype.InterpolantFactoryMethodSmooth=void 0;var EM=class extends tc{constructor(e,t,n,r){super(e,t,n,r)}};EM.prototype.ValueTypeName="color";var MM=class extends tc{constructor(e,t,n,r){super(e,t,n,r)}};MM.prototype.ValueTypeName="number";var CM=class extends c0{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(r-t),c=e*a;for(let u=c+a;c!==u;c+=4)qs.slerpFlat(s,0,o,c-a,o,c,l);return s}},rb=class extends tc{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new CM(this.times,this.values,this.getValueSize(),e)}};rb.prototype.ValueTypeName="quaternion";rb.prototype.InterpolantFactoryMethodSmooth=void 0;var h0=class extends tc{constructor(e,t,n){super(e,t,n)}};h0.prototype.ValueTypeName="string";h0.prototype.ValueBufferType=Array;h0.prototype.DefaultInterpolation=F2;h0.prototype.InterpolantFactoryMethodLinear=void 0;h0.prototype.InterpolantFactoryMethodSmooth=void 0;var RM=class extends tc{constructor(e,t,n,r){super(e,t,n,r)}};RM.prototype.ValueTypeName="vector";var lM={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(pZ(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!pZ(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function pZ(i){try{let e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var IM=class{constructor(e,t,n){let r=this,s=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return u=u.normalize("NFC"),l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,f){return c.push(u,f),this},this.removeHandler=function(u){let f=c.indexOf(u);return f!==-1&&c.splice(f,2),this},this.getHandler=function(u){for(let f=0,d=c.length;f<d;f+=2){let A=c[f],y=c[f+1];if(A.global&&(A.lastIndex=0),A.test(u))return y}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},BZ=new IM,f0=class{constructor(e){this.manager=e!==void 0?e:BZ,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};f0.DEFAULT_MATERIAL_NAME="__DEFAULT";var Hv=new WeakMap,PM=class extends f0{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=lM.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0);else{let f=Hv.get(o);f===void 0&&(f=[],Hv.set(o,f)),f.push({onLoad:t,onError:r})}return o}let a=Zv("img");function l(){u(),t&&t(this);let f=Hv.get(this)||[];for(let d=0;d<f.length;d++){let A=f[d];A.onLoad&&A.onLoad(this)}Hv.delete(this),s.manager.itemEnd(e)}function c(f){u(),r&&r(f),lM.remove(`image:${e}`);let d=Hv.get(this)||[];for(let A=0;A<d.length;A++){let y=d[A];y.onError&&y.onError(f)}Hv.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),lM.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}};var wl=class extends f0{constructor(e){super(e)}load(e,t,n,r){let s=new Hs,o=new PM(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,r),s}},Fh=class extends lr{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new zt(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},sb=class extends Fh{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(lr.DEFAULT_UP),this.updateMatrix(),this.groundColor=new zt(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},L8=new cn,mZ=new re,AZ=new re,ob=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Oe(512,512),this.mapType=Ji,this.map=null,this.mapPass=null,this.matrix=new cn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Hc,this._frameExtents=new Oe(1,1),this._viewportCount=1,this._viewports=[new xn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;mZ.setFromMatrixPosition(e.matrixWorld),t.position.copy(mZ),AZ.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(AZ),t.updateMatrixWorld(),L8.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(L8,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===yl||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(L8)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},rM=new re,sM=new qs,Ih=new re,Nd=class extends lr{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new cn,this.projectionMatrix=new cn,this.projectionMatrixInverse=new cn,this.coordinateSystem=ko,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(rM,sM,Ih),Ih.x===1&&Ih.y===1&&Ih.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(rM,sM,Ih.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(rM,sM,Ih),Ih.x===1&&Ih.y===1&&Ih.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(rM,sM,Ih.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},Qp=new re,gZ=new Oe,vZ=new Oe,Yr=class extends Nd{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Pd*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(P2*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Pd*2*Math.atan(Math.tan(P2*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Qp.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Qp.x,Qp.y).multiplyScalar(-e/Qp.z),Qp.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Qp.x,Qp.y).multiplyScalar(-e/Qp.z)}getViewSize(e,t){return this.getViewBounds(e,gZ,vZ),t.subVectors(vZ,gZ)}setViewOffset(e,t,n,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(P2*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r,o=this.view;if(this.view!==null&&this.view.enabled){let l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*n/c,r*=o.width/l,n*=o.height/c}let a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let 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}},G8=class extends ob{constructor(){super(new Yr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Pd*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},QA=class extends Fh{constructor(e,t,n=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(lr.DEFAULT_UP),this.updateMatrix(),this.target=new lr,this.distance=n,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new G8}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}},q8=class extends ob{constructor(){super(new Yr(90,1,.5,500)),this.isPointLightShadow=!0}},ab=class extends Fh{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new q8}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}},Ou=class extends Nd{constructor(e=-1,t=1,n=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,s=n-e,o=n+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){let 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,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let 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}},H8=class extends ob{constructor(){super(new Ou(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},JA=class extends Fh{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(lr.DEFAULT_UP),this.updateMatrix(),this.target=new lr,this.shadow=new H8}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},eg=class extends Fh{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}},lb=class extends Fh{constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}},LM=class{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new re)}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){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){let n=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-r*r)}},cb=class extends Fh{constructor(e=new LM,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}};var ub=class extends Xn{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}};var Wv=-90,jv=1,l_=class extends lr{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Yr(Wv,jv,e,t);r.layers=this.layers,this.add(r);let s=new Yr(Wv,jv,e,t);s.layers=this.layers,this.add(s);let o=new Yr(Wv,jv,e,t);o.layers=this.layers,this.add(o);let a=new Yr(Wv,jv,e,t);a.layers=this.layers,this.add(a);let l=new Yr(Wv,jv,e,t);l.layers=this.layers,this.add(l);let c=new Yr(Wv,jv,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,s,o,a,l]=t;for(let c of t)this.remove(c);if(e===ko)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===yl)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[s,o,a,l,c,u]=this.children,f=e.getRenderTarget(),d=e.getActiveCubeFace(),A=e.getActiveMipmapLevel(),y=e.xr.enabled;e.xr.enabled=!1;let w=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let S=!1;e.isWebGLRenderer===!0?S=e.state.buffers.depth.getReversed():S=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,2,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,3,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=w,e.setRenderTarget(n,5,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(f,d,A),e.xr.enabled=y,n.texture.needsPMREMUpdate=!0}},c_=class extends Yr{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},tg=class{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=KAe.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}};function KAe(){this._document.hidden===!1&&this.reset()}var vF="\\[\\]\\.:\\/",QAe=new RegExp("["+vF+"]","g"),_F="[^"+vF+"]",JAe="[^"+vF.replace("\\.","")+"]",ege=/((?:WC+[\/:])*)/.source.replace("WC",_F),tge=/(WCOD+)?/.source.replace("WCOD",JAe),nge=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",_F),ige=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",_F),rge=new RegExp("^"+ege+tge+nge+ige+"$"),sge=["material","materials","bones","map"],W8=class{constructor(e,t,n){let r=n||Er.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},Er=class i{constructor(e,t,n){this.path=t,this.parsedPath=n||i.parseTrackName(t),this.node=i.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new i.Composite(e,t,n):new i(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(QAe,"")}static parseTrackName(e){let t=rge.exec(e);if(t===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let s=n.nodeName.substring(r+1);sge.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let l=n(a.children);if(l)return l}return null},r=n(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){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)e[t++]=n[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){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[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,t=this.parsedPath,n=t.objectName,r=t.propertyName,s=t.propertyIndex;if(e||(e=i.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Xe("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){ze("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){ze("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){ze("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){ze("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){ze("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){ze("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){ze("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let o=e[r];if(o===void 0){let c=t.nodeName;ze("PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?a=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){ze("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){ze("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Er.Composite=W8;Er.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Er.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Er.prototype.GetterByBindingType=[Er.prototype._getValue_direct,Er.prototype._getValue_array,Er.prototype._getValue_arrayElement,Er.prototype._getValue_toArray];Er.prototype.SetterByBindingTypeAndVersioning=[[Er.prototype._setValue_direct,Er.prototype._setValue_direct_setNeedsUpdate,Er.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Er.prototype._setValue_array,Er.prototype._setValue_array_setNeedsUpdate,Er.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Er.prototype._setValue_arrayElement,Er.prototype._setValue_arrayElement_setNeedsUpdate,Er.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Er.prototype._setValue_fromArray,Er.prototype._setValue_fromArray_setNeedsUpdate,Er.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var FZe=new Float32Array(1);var Bh=class extends Ld{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}};var _Z=new cn,hb=class{constructor(e,t,n=0,r=1/0){this.ray=new Dd(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new Jv,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.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):ze("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return _Z.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(_Z),this}intersectObject(e,t=!0,n=[]){return j8(e,this,n,t),n.sort(xZ),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)j8(e[r],this,n,t);return n.sort(xZ),n}};function xZ(i,e){return i.distance-e.distance}function j8(i,e,t,n){let r=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(r=!1),r===!0&&n===!0){let s=i.children;for(let o=0,a=s.length;o<a;o++)j8(s[o],e,t,!0)}}var u_=class{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Nn(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Nn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var SF=class SF{constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){let s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=r,this}};SF.prototype.isMatrix2=!0;var h_=SF,yZ=new Oe,DM=class{constructor(e=new Oe(1/0,1/0),t=new Oe(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=yZ.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,yZ).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)}},bZ=new re,oM=new re,Xv=new re,$v=new re,D8=new re,oge=new re,age=new re,fb=class{constructor(e=new re,t=new re){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){bZ.subVectors(e,this.start),oM.subVectors(this.end,this.start);let n=oM.dot(oM);if(n===0)return 0;let s=oM.dot(bZ)/n;return t&&(s=Nn(s,0,1)),s}closestPointToPoint(e,t,n){let r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=oge,n=age){let r=10000000000000001e-32,s,o,a=this.start,l=e.start,c=this.end,u=e.end;Xv.subVectors(c,a),$v.subVectors(u,l),D8.subVectors(a,l);let f=Xv.dot(Xv),d=$v.dot($v),A=$v.dot(D8);if(f<=r&&d<=r)return t.copy(a),n.copy(l),t.sub(n),t.dot(t);if(f<=r)s=0,o=A/d,o=Nn(o,0,1);else{let y=Xv.dot(D8);if(d<=r)o=0,s=Nn(-y/f,0,1);else{let w=Xv.dot($v),S=f*d-w*w;S!==0?s=Nn((w*A-y*d)/S,0,1):s=0,o=(w*s+A)/d,o<0?(o=0,s=Nn(-y/f,0,1)):o>1&&(o=1,s=Nn((w-y)/f,0,1))}}return t.copy(a).addScaledVector(Xv,s),n.copy(l).addScaledVector($v,o),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}};var db=class{constructor(){this.type="ShapePath",this.color=new zt,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new $A,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,s,o){return this.currentPath.bezierCurveTo(e,t,n,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(){function e(l,c){let u=!1,f=c.length;for(let d=0,A=f-1;d<f;A=d++){let y=c[d],w=c[A];y.y>l.y!=w.y>l.y&&l.x<(w.x-y.x)*(l.y-y.y)/(w.y-y.y)+y.x&&(u=!u)}return u}function t(l,c){let u=c.getCenter(new Oe);if(e(u,l))return u;let f=u.y,d=[],A=l.length;for(let y=0;y<A;y++){let w=l[y],S=l[(y+1)%A];if(w.y>f!=S.y>f){let T=w.x+(f-w.y)*(S.x-w.x)/(S.y-w.y);d.push(T)}}return d.length>1&&(d.sort((y,w)=>y-w),u.x=(d[0]+d[1])/2),u}let n=this.userData.style&&this.userData.style.fillRule||"nonzero";n!=="nonzero"&&n!=="evenodd"&&(Xe('Fill-rule "'+n+'" is not supported, falling back to "nonzero".'),n="nonzero");let r=n==="nonzero"?(l=>l!==0):(l=>(l&1)!==0),s=[];for(let l of this.subPaths){let c=l.getPoints();if(c.length<3)continue;let u=Jp.area(c);if(u===0)continue;let f=new DM;for(let d=0;d<c.length;d++)f.expandByPoint(c[d]);s.push({subPath:l,points:c,boundingBox:f,interiorPoint:t(c,f),absArea:Math.abs(u),winding:u<0?-1:1,container:null,exclude:!1,role:null})}s.sort((l,c)=>c.absArea-l.absArea);for(let l=0;l<s.length;l++){let c=s[l],u=0;for(let f=l-1;f>=0;f--){let d=s[f];if(d.boundingBox.containsBox(c.boundingBox)&&e(c.interiorPoint,d.points)){c.container=d.exclude?d.container:d,u=d.winding,c.winding+=u;break}}r(c.winding)===r(u)&&(c.exclude=!0)}for(let l of s)l.exclude||(l.role=l.container===null||l.container.role==="hole"?"outer":"hole");let o=[],a=new Map;for(let l of s){if(l.exclude||l.role!=="outer")continue;let c=new W2;c.curves=l.subPath.curves,o.push(c),a.set(l,c)}for(let l of s){if(l.exclude||l.role!=="hole")continue;let c=a.get(l.container);if(!c)continue;let u=new $A;u.curves=l.subPath.curves,c.holes.push(u)}return o}},Fd=class extends ca{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){Xe("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}};function Vb(i,e,t,n){let r=lge(n);switch(t){case f_:return i*e;case Ud:return i*e/r.components*r.byteLength;case qh:return i*e/r.components*r.byteLength;case js:return i*e*2/r.components*r.byteLength;case Hh:return i*e*2/r.components*r.byteLength;case Od:return i*e*3/r.components*r.byteLength;case Ur:return i*e*4/r.components*r.byteLength;case v0:return i*e*4/r.components*r.byteLength;case Wh:case jh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Xh:case $h:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case lg:case ug:return Math.max(i,16)*Math.max(e,8)/4;case ag:case cg:return Math.max(i,8)*Math.max(e,8)/2;case _0:case x0:case b0:case w0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case y0:case Yh:case S0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case T0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case E0:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case M0:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case C0:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case R0:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case I0:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case P0:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case L0:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case D0:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case N0:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case F0:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case B0:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case O0:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case U0:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case k0:case z0:case V0:return Math.ceil(i/4)*Math.ceil(e/4)*16;case G0:case q0:return Math.ceil(i/4)*Math.ceil(e/4)*8;case Zh:case H0:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function lge(i){switch(i){case Ji:case Vh:return{byteLength:1,components:1};case Sl:case Gh:case Wi:return{byteLength:2,components:1};case ig:case rg:return{byteLength:2,components:4};case xi:case Kr:case cr:return{byteLength:4,components:1};case sg:case og:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}}));typeof window<"u"&&(window.__THREE__?Xe("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="185");function oK(){let i=null,e=!1,t=null,n=null;function r(s,o){t(s,o),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&i!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i!==null&&i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function hge(i){let e=new WeakMap;function t(a,l){let c=a.array,u=a.usage,f=c.byteLength,d=i.createBuffer();i.bindBuffer(l,d),i.bufferData(l,c,u),a.onUploadCallback();let A;if(c instanceof Float32Array)A=i.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)A=i.HALF_FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?A=i.HALF_FLOAT:A=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)A=i.SHORT;else if(c instanceof Uint32Array)A=i.UNSIGNED_INT;else if(c instanceof Int32Array)A=i.INT;else if(c instanceof Int8Array)A=i.BYTE;else if(c instanceof Uint8Array)A=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)A=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:A,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function n(a,l,c){let u=l.array,f=l.updateRanges;if(i.bindBuffer(c,a),f.length===0)i.bufferSubData(c,0,u);else{f.sort((A,y)=>A.start-y.start);let d=0;for(let A=1;A<f.length;A++){let y=f[d],w=f[A];w.start<=y.start+y.count+1?y.count=Math.max(y.count,w.start+w.count-y.start):(++d,f[d]=w)}f.length=d+1;for(let A=0,y=f.length;A<y;A++){let w=f[A];i.bufferSubData(c,w.start*u.BYTES_PER_ELEMENT,u,w.start,w.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);let l=e.get(a);l&&(i.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){let u=e.get(a);(!u||u.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}let c=e.get(a);if(c===void 0)e.set(a,t(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,a,l),c.version=a.version}}return{get:r,remove:s,update:o}}var fge=`#ifdef USE_ALPHAHASH14+}`,ds=class extends Hs{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=jAe,this.fragmentShader=XAe,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=fg(e.uniforms),this.uniformsGroups=WAe(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let r in this.uniforms){let o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new zt().setHex(r.value);break;case"v2":this.uniforms[n].value=new Oe().fromArray(r.value);break;case"v3":this.uniforms[n].value=new re().fromArray(r.value);break;case"v4":this.uniforms[n].value=new xn().fromArray(r.value);break;case"m3":this.uniforms[n].value=new Mn().fromArray(r.value);break;case"m4":this.uniforms[n].value=new cn().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},pM=class extends ds{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},s_=class extends Hs{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new zt(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 zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tc,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Z2=class extends s_{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 Oe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Nn(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 zt(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 zt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new zt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},ZA=class extends Hs{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new zt(16777215),this.specular=new zt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tc,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.combine=tg,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.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}},K2=class extends Hs{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new zt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tc,this.normalScale=new Oe(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}},Q2=class extends Hs{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tc,this.normalScale=new Oe(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}},Ga=class extends Hs{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new zt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tc,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.combine=tg,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},mM=class extends Hs{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=wZ,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}},AM=class extends Hs{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}},J2=class extends Hs{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new zt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tc,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}},eb=class extends Iu{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 Q3(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}var l0=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],s=t[n-1];e:{t:{let o;n:{i:if(!(e<r)){for(let a=n+2;;){if(r===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(s=r,r=t[++n],e<r)break t}o=t.length;break n}if(!(e>=s)){let a=t[1];e<a&&(n=2,s=a);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=s,s=t[--n-1],e>=s)break t}o=n,n=0;break n}break e}for(;n<o;){let a=n+o>>>1;e<t[a]?o=a:n=a+1}if(r=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}},gM=class extends l0{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:F8,endingEnd:F8}}intervalChanged_(e,t,n){let r=this.parameterPositions,s=e-2,o=e+1,a=r[s],l=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case B8:s=e,a=2*t-n;break;case O8:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case B8:o=e,l=2*n-t;break;case O8:o=1,l=n+r[1]-r[0];break;default:o=e-1,l=t}let c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,f=this._offsetNext,d=this._weightPrev,A=this._weightNext,y=(n-t)/(r-t),w=y*y,S=w*y,T=-d*S+2*d*w-d*y,R=(1+d)*S+(-1.5-2*d)*w+(-.5+d)*y+1,I=(-1-A)*S+(1.5+A)*w+.5*y,P=A*S-A*w;for(let F=0;F!==a;++F)s[F]=T*o[u+F]+R*o[c+F]+I*o[l+F]+P*o[f+F];return s}},vM=class extends l0{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(n-t)/(r-t),f=1-u;for(let d=0;d!==a;++d)s[d]=o[c+d]*f+o[l+d]*u;return s}},_M=class extends l0{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},xM=class extends l0{interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this.inTangents,f=this.outTangents;if(!u||!f){let y=(n-t)/(r-t),w=1-y;for(let S=0;S!==a;++S)s[S]=o[c+S]*w+o[l+S]*y;return s}let d=a*2,A=e-1;for(let y=0;y!==a;++y){let w=o[c+y],S=o[l+y],T=A*d+y*2,R=f[T],I=f[T+1],P=e*d+y*2,F=u[P],D=u[P+1],L=(n-t)/(r-t),C,B,k,z,G;for(let W=0;W<8;W++){C=L*L,B=C*L,k=1-L,z=k*k,G=z*k;let H=G*t+3*z*L*R+3*k*C*F+B*r-n;if(Math.abs(H)<1e-10)break;let $=3*z*(R-t)+6*k*L*(F-R)+3*C*(r-F);if(Math.abs($)<1e-10)break;L=L-H/$,L=Math.max(0,Math.min(1,L))}s[y]=G*w+3*z*L*I+3*k*C*D+B*S}return s}},Jl=class{constructor(e,t,n,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=Q3(t,this.TimeBufferType),this.values=Q3(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Q3(e.times,Array),values:Q3(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new _M(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new vM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new gM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new xM(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case L2:t=this.InterpolantFactoryMethodDiscrete;break;case rM:t=this.InterpolantFactoryMethodLinear;break;case nM:t=this.InterpolantFactoryMethodSmooth;break;case N8:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Xe("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return L2;case this.InterpolantFactoryMethodLinear:return rM;case this.InterpolantFactoryMethodSmooth:return nM;case this.InterpolantFactoryMethodBezier:return N8}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){let n=this.times,r=n.length,s=0,o=r-1;for(;s!==r&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(ze("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,r=this.values,s=n.length;s===0&&(ze("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){ze("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){ze("KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&f_(r))for(let a=0,l=r.length;a!==l;++a){let c=r[a];if(isNaN(c)){ze("KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===nM,s=e.length-1,o=1;for(let a=1;a<s;++a){let l=!1,c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(r)l=!0;else{let f=a*n,d=f-n,A=f+n;for(let y=0;y!==n;++y){let w=t[f+y];if(w!==t[d+y]||w!==t[A+y]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];let f=a*n,d=o*n;for(let A=0;A!==n;++A)t[d+A]=t[f+A]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};Jl.prototype.ValueTypeName="";Jl.prototype.TimeBufferType=Float32Array;Jl.prototype.ValueBufferType=Float32Array;Jl.prototype.DefaultInterpolation=rM;var c0=class extends Jl{constructor(e,t,n){super(e,t,n)}};c0.prototype.ValueTypeName="bool";c0.prototype.ValueBufferType=Array;c0.prototype.DefaultInterpolation=L2;c0.prototype.InterpolantFactoryMethodLinear=void 0;c0.prototype.InterpolantFactoryMethodSmooth=void 0;var yM=class extends Jl{constructor(e,t,n,r){super(e,t,n,r)}};yM.prototype.ValueTypeName="color";var bM=class extends Jl{constructor(e,t,n,r){super(e,t,n,r)}};bM.prototype.ValueTypeName="number";var wM=class extends l0{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(r-t),c=e*a;for(let u=c+a;c!==u;c+=4)Gs.slerpFlat(s,0,o,c-a,o,c,l);return s}},tb=class extends Jl{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new wM(this.times,this.values,this.getValueSize(),e)}};tb.prototype.ValueTypeName="quaternion";tb.prototype.InterpolantFactoryMethodSmooth=void 0;var u0=class extends Jl{constructor(e,t,n){super(e,t,n)}};u0.prototype.ValueTypeName="string";u0.prototype.ValueBufferType=Array;u0.prototype.DefaultInterpolation=L2;u0.prototype.InterpolantFactoryMethodLinear=void 0;u0.prototype.InterpolantFactoryMethodSmooth=void 0;var SM=class extends Jl{constructor(e,t,n,r){super(e,t,n,r)}};SM.prototype.ValueTypeName="vector";var iM={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(uZ(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!uZ(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function uZ(i){try{let e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var TM=class{constructor(e,t,n){let r=this,s=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return u=u.normalize("NFC"),l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,f){return c.push(u,f),this},this.removeHandler=function(u){let f=c.indexOf(u);return f!==-1&&c.splice(f,2),this},this.getHandler=function(u){for(let f=0,d=c.length;f<d;f+=2){let A=c[f],y=c[f+1];if(A.global&&(A.lastIndex=0),A.test(u))return y}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},LZ=new TM,h0=class{constructor(e){this.manager=e!==void 0?e:LZ,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};h0.DEFAULT_MATERIAL_NAME="__DEFAULT";var Gv=new WeakMap,EM=class extends h0{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=iM.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0);else{let f=Gv.get(o);f===void 0&&(f=[],Gv.set(o,f)),f.push({onLoad:t,onError:r})}return o}let a=$v("img");function l(){u(),t&&t(this);let f=Gv.get(this)||[];for(let d=0;d<f.length;d++){let A=f[d];A.onLoad&&A.onLoad(this)}Gv.delete(this),s.manager.itemEnd(e)}function c(f){u(),r&&r(f),iM.remove(`image:${e}`);let d=Gv.get(this)||[];for(let A=0;A<d.length;A++){let y=d[A];y.onError&&y.onError(f)}Gv.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),iM.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}};var bl=class extends h0{constructor(e){super(e)}load(e,t,n,r){let s=new qs,o=new EM(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,r),s}},Ih=class extends lr{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new zt(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},nb=class extends Ih{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(lr.DEFAULT_UP),this.updateMatrix(),this.groundColor=new zt(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},L8=new cn,hZ=new re,fZ=new re,ib=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Oe(512,512),this.mapType=Ji,this.map=null,this.mapPass=null,this.matrix=new cn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new zc,this._frameExtents=new Oe(1,1),this._viewportCount=1,this._viewports=[new xn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;hZ.setFromMatrixPosition(e.matrixWorld),t.position.copy(hZ),fZ.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(fZ),t.updateMatrixWorld(),L8.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(L8,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===xl||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(L8)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},J3=new re,eM=new Gs,Eh=new re,Id=class extends lr{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new cn,this.projectionMatrix=new cn,this.projectionMatrixInverse=new cn,this.coordinateSystem=ko,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(J3,eM,Eh),Eh.x===1&&Eh.y===1&&Eh.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(J3,eM,Eh.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(J3,eM,Eh),Eh.x===1&&Eh.y===1&&Eh.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(J3,eM,Eh.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},Kp=new re,dZ=new Oe,pZ=new Oe,Yr=class extends Id{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Cd*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(C2*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Cd*2*Math.atan(Math.tan(C2*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Kp.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Kp.x,Kp.y).multiplyScalar(-e/Kp.z),Kp.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Kp.x,Kp.y).multiplyScalar(-e/Kp.z)}getViewSize(e,t){return this.getViewBounds(e,dZ,pZ),t.subVectors(pZ,dZ)}setViewOffset(e,t,n,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(C2*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r,o=this.view;if(this.view!==null&&this.view.enabled){let l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*n/c,r*=o.width/l,n*=o.height/c}let a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let 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}},G8=class extends ib{constructor(){super(new Yr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Cd*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},KA=class extends Ih{constructor(e,t,n=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(lr.DEFAULT_UP),this.updateMatrix(),this.target=new lr,this.distance=n,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new G8}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}},q8=class extends ib{constructor(){super(new Yr(90,1,.5,500)),this.isPointLightShadow=!0}},rb=class extends Ih{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new q8}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}},Du=class extends Id{constructor(e=-1,t=1,n=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,s=n-e,o=n+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){let 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,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let 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}},H8=class extends ib{constructor(){super(new Du(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},QA=class extends Ih{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(lr.DEFAULT_UP),this.updateMatrix(),this.target=new lr,this.shadow=new H8}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},JA=class extends Ih{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}},sb=class extends Ih{constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}},MM=class{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new re)}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){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){let n=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-r*r)}},ob=class extends Ih{constructor(e=new MM,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}};var ab=class extends Xn{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}};var qv=-90,Hv=1,o_=class extends lr{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Yr(qv,Hv,e,t);r.layers=this.layers,this.add(r);let s=new Yr(qv,Hv,e,t);s.layers=this.layers,this.add(s);let o=new Yr(qv,Hv,e,t);o.layers=this.layers,this.add(o);let a=new Yr(qv,Hv,e,t);a.layers=this.layers,this.add(a);let l=new Yr(qv,Hv,e,t);l.layers=this.layers,this.add(l);let c=new Yr(qv,Hv,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,s,o,a,l]=t;for(let c of t)this.remove(c);if(e===ko)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===xl)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[s,o,a,l,c,u]=this.children,f=e.getRenderTarget(),d=e.getActiveCubeFace(),A=e.getActiveMipmapLevel(),y=e.xr.enabled;e.xr.enabled=!1;let w=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let S=!1;e.isWebGLRenderer===!0?S=e.state.buffers.depth.getReversed():S=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,2,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,3,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=w,e.setRenderTarget(n,5,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(f,d,A),e.xr.enabled=y,n.texture.needsPMREMUpdate=!0}},a_=class extends Yr{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},eg=class{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=$Ae.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}};function $Ae(){this._document.hidden===!1&&this.reset()}var vF="\\[\\]\\.:\\/",YAe=new RegExp("["+vF+"]","g"),_F="[^"+vF+"]",ZAe="[^"+vF.replace("\\.","")+"]",KAe=/((?:WC+[\/:])*)/.source.replace("WC",_F),QAe=/(WCOD+)?/.source.replace("WCOD",ZAe),JAe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",_F),ege=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",_F),tge=new RegExp("^"+KAe+QAe+JAe+ege+"$"),nge=["material","materials","bones","map"],W8=class{constructor(e,t,n){let r=n||Tr.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},Tr=class i{constructor(e,t,n){this.path=t,this.parsedPath=n||i.parseTrackName(t),this.node=i.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new i.Composite(e,t,n):new i(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(YAe,"")}static parseTrackName(e){let t=tge.exec(e);if(t===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let s=n.nodeName.substring(r+1);nge.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let l=n(a.children);if(l)return l}return null},r=n(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){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)e[t++]=n[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){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[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,t=this.parsedPath,n=t.objectName,r=t.propertyName,s=t.propertyIndex;if(e||(e=i.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Xe("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){ze("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){ze("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){ze("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){ze("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){ze("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){ze("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){ze("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let o=e[r];if(o===void 0){let c=t.nodeName;ze("PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?a=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){ze("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){ze("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Tr.Composite=W8;Tr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Tr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Tr.prototype.GetterByBindingType=[Tr.prototype._getValue_direct,Tr.prototype._getValue_array,Tr.prototype._getValue_arrayElement,Tr.prototype._getValue_toArray];Tr.prototype.SetterByBindingTypeAndVersioning=[[Tr.prototype._setValue_direct,Tr.prototype._setValue_direct_setNeedsUpdate,Tr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Tr.prototype._setValue_array,Tr.prototype._setValue_array_setNeedsUpdate,Tr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Tr.prototype._setValue_arrayElement,Tr.prototype._setValue_arrayElement_setNeedsUpdate,Tr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Tr.prototype._setValue_fromArray,Tr.prototype._setValue_fromArray_setNeedsUpdate,Tr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var IZe=new Float32Array(1);var Lh=class extends Rd{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}};var mZ=new cn,lb=class{constructor(e,t,n=0,r=1/0){this.ray=new Pd(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new Kv,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.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):ze("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return mZ.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(mZ),this}intersectObject(e,t=!0,n=[]){return j8(e,this,n,t),n.sort(AZ),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)j8(e[r],this,n,t);return n.sort(AZ),n}};function AZ(i,e){return i.distance-e.distance}function j8(i,e,t,n){let r=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(r=!1),r===!0&&n===!0){let s=i.children;for(let o=0,a=s.length;o<a;o++)j8(s[o],e,t,!0)}}var l_=class{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Nn(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Nn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var SF=class SF{constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){let s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=r,this}};SF.prototype.isMatrix2=!0;var c_=SF,gZ=new Oe,CM=class{constructor(e=new Oe(1/0,1/0),t=new Oe(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=gZ.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,gZ).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)}},vZ=new re,tM=new re,Wv=new re,jv=new re,D8=new re,ige=new re,rge=new re,cb=class{constructor(e=new re,t=new re){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){vZ.subVectors(e,this.start),tM.subVectors(this.end,this.start);let n=tM.dot(tM);if(n===0)return 0;let s=tM.dot(vZ)/n;return t&&(s=Nn(s,0,1)),s}closestPointToPoint(e,t,n){let r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=ige,n=rge){let r=10000000000000001e-32,s,o,a=this.start,l=e.start,c=this.end,u=e.end;Wv.subVectors(c,a),jv.subVectors(u,l),D8.subVectors(a,l);let f=Wv.dot(Wv),d=jv.dot(jv),A=jv.dot(D8);if(f<=r&&d<=r)return t.copy(a),n.copy(l),t.sub(n),t.dot(t);if(f<=r)s=0,o=A/d,o=Nn(o,0,1);else{let y=Wv.dot(D8);if(d<=r)o=0,s=Nn(-y/f,0,1);else{let w=Wv.dot(jv),S=f*d-w*w;S!==0?s=Nn((w*A-y*d)/S,0,1):s=0,o=(w*s+A)/d,o<0?(o=0,s=Nn(-y/f,0,1)):o>1&&(o=1,s=Nn((w-y)/f,0,1))}}return t.copy(a).addScaledVector(Wv,s),n.copy(l).addScaledVector(jv,o),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}};var ub=class{constructor(){this.type="ShapePath",this.color=new zt,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new XA,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,s,o){return this.currentPath.bezierCurveTo(e,t,n,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(){function e(l,c){let u=!1,f=c.length;for(let d=0,A=f-1;d<f;A=d++){let y=c[d],w=c[A];y.y>l.y!=w.y>l.y&&l.x<(w.x-y.x)*(l.y-y.y)/(w.y-y.y)+y.x&&(u=!u)}return u}function t(l,c){let u=c.getCenter(new Oe);if(e(u,l))return u;let f=u.y,d=[],A=l.length;for(let y=0;y<A;y++){let w=l[y],S=l[(y+1)%A];if(w.y>f!=S.y>f){let T=w.x+(f-w.y)*(S.x-w.x)/(S.y-w.y);d.push(T)}}return d.length>1&&(d.sort((y,w)=>y-w),u.x=(d[0]+d[1])/2),u}let n=this.userData.style&&this.userData.style.fillRule||"nonzero";n!=="nonzero"&&n!=="evenodd"&&(Xe('Fill-rule "'+n+'" is not supported, falling back to "nonzero".'),n="nonzero");let r=n==="nonzero"?(l=>l!==0):(l=>(l&1)!==0),s=[];for(let l of this.subPaths){let c=l.getPoints();if(c.length<3)continue;let u=Qp.area(c);if(u===0)continue;let f=new CM;for(let d=0;d<c.length;d++)f.expandByPoint(c[d]);s.push({subPath:l,points:c,boundingBox:f,interiorPoint:t(c,f),absArea:Math.abs(u),winding:u<0?-1:1,container:null,exclude:!1,role:null})}s.sort((l,c)=>c.absArea-l.absArea);for(let l=0;l<s.length;l++){let c=s[l],u=0;for(let f=l-1;f>=0;f--){let d=s[f];if(d.boundingBox.containsBox(c.boundingBox)&&e(c.interiorPoint,d.points)){c.container=d.exclude?d.container:d,u=d.winding,c.winding+=u;break}}r(c.winding)===r(u)&&(c.exclude=!0)}for(let l of s)l.exclude||(l.role=l.container===null||l.container.role==="hole"?"outer":"hole");let o=[],a=new Map;for(let l of s){if(l.exclude||l.role!=="outer")continue;let c=new G2;c.curves=l.subPath.curves,o.push(c),a.set(l,c)}for(let l of s){if(l.exclude||l.role!=="hole")continue;let c=a.get(l.container);if(!c)continue;let u=new XA;u.curves=l.subPath.curves,c.holes.push(u)}return o}},Ld=class extends ca{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){Xe("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}};function Ub(i,e,t,n){let r=sge(n);switch(t){case u_:return i*e;case Fd:return i*e/r.components*r.byteLength;case kh:return i*e/r.components*r.byteLength;case Ws:return i*e*2/r.components*r.byteLength;case zh:return i*e*2/r.components*r.byteLength;case Nd:return i*e*3/r.components*r.byteLength;case Or:return i*e*4/r.components*r.byteLength;case g0:return i*e*4/r.components*r.byteLength;case Vh:case Gh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case qh:case Hh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ag:case cg:return Math.max(i,16)*Math.max(e,8)/4;case og:case lg:return Math.max(i,8)*Math.max(e,8)/2;case v0:case _0:case y0:case b0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case x0:case Wh:case w0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case S0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case T0:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case E0:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case M0:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case C0:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case R0:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case P0:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case I0:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case L0:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case D0:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case N0:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case F0:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case B0:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case O0:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case U0:case k0:case z0:return Math.ceil(i/4)*Math.ceil(e/4)*16;case V0:case G0:return Math.ceil(i/4)*Math.ceil(e/4)*8;case jh:case q0:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function sge(i){switch(i){case Ji:case Oh:return{byteLength:1,components:1};case wl:case Uh:case Wi:return{byteLength:2,components:1};case ng:case ig:return{byteLength:2,components:4};case xi:case Kr:case cr:return{byteLength:4,components:1};case rg:case sg:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}}));typeof window<"u"&&(window.__THREE__?Xe("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="185");function nK(){let i=null,e=!1,t=null,n=null;function r(s,o){t(s,o),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&i!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i!==null&&i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function lge(i){let e=new WeakMap;function t(a,l){let c=a.array,u=a.usage,f=c.byteLength,d=i.createBuffer();i.bindBuffer(l,d),i.bufferData(l,c,u),a.onUploadCallback();let A;if(c instanceof Float32Array)A=i.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)A=i.HALF_FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?A=i.HALF_FLOAT:A=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)A=i.SHORT;else if(c instanceof Uint32Array)A=i.UNSIGNED_INT;else if(c instanceof Int32Array)A=i.INT;else if(c instanceof Int8Array)A=i.BYTE;else if(c instanceof Uint8Array)A=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)A=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:A,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function n(a,l,c){let u=l.array,f=l.updateRanges;if(i.bindBuffer(c,a),f.length===0)i.bufferSubData(c,0,u);else{f.sort((A,y)=>A.start-y.start);let d=0;for(let A=1;A<f.length;A++){let y=f[d],w=f[A];w.start<=y.start+y.count+1?y.count=Math.max(y.count,w.start+w.count-y.start):(++d,f[d]=w)}f.length=d+1;for(let A=0,y=f.length;A<y;A++){let w=f[A];i.bufferSubData(c,w.start*u.BYTES_PER_ELEMENT,u,w.start,w.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);let l=e.get(a);l&&(i.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){let u=e.get(a);(!u||u.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}let c=e.get(a);if(c===void 0)e.set(a,t(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,a,l),c.version=a.version}}return{get:r,remove:s,update:o}}var cge=`#ifdef USE_ALPHAHASH1515 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;16-#endif`,dge=`#ifdef USE_ALPHAHASH16+#endif`,uge=`#ifdef USE_ALPHAHASH1717 const float ALPHA_HASH_SCALE = 0.05;1818 float hash2D( vec2 value ) {1919 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
@@ -48,20 +48,20 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
4848 : cases.z;4949 return clamp( threshold , 1.0e-6, 1.0 );5050 }51-#endif`,pge=`#ifdef USE_ALPHAMAP51+#endif`,hge=`#ifdef USE_ALPHAMAP5252 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;53-#endif`,mge=`#ifdef USE_ALPHAMAP53+#endif`,fge=`#ifdef USE_ALPHAMAP5454 uniform sampler2D alphaMap;55-#endif`,Age=`#ifdef USE_ALPHATEST55+#endif`,dge=`#ifdef USE_ALPHATEST5656 #ifdef ALPHA_TO_COVERAGE5757 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );5858 if ( diffuseColor.a == 0.0 ) discard;5959 #else6060 if ( diffuseColor.a < alphaTest ) discard;6161 #endif62-#endif`,gge=`#ifdef USE_ALPHATEST62+#endif`,pge=`#ifdef USE_ALPHATEST6363 uniform float alphaTest;64-#endif`,vge=`#ifdef USE_AOMAP64+#endif`,mge=`#ifdef USE_AOMAP6565 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;6666 reflectedLight.indirectDiffuse *= ambientOcclusion;6767 #if defined( USE_CLEARCOAT )
@@ -74,10 +74,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
7474 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );7575 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );7676 #endif77-#endif`,_ge=`#ifdef USE_AOMAP77+#endif`,Age=`#ifdef USE_AOMAP7878 uniform sampler2D aoMap;7979 uniform float aoMapIntensity;80-#endif`,xge=`#ifdef USE_BATCHING80+#endif`,gge=`#ifdef USE_BATCHING8181 #if ! defined( GL_ANGLE_multi_draw )8282 #define gl_DrawID _gl_DrawID8383 uniform int _gl_DrawID;
@@ -111,15 +111,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
111111 int y = j / size;112112 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );113113 }114-#endif`,yge=`#ifdef USE_BATCHING114+#endif`,vge=`#ifdef USE_BATCHING115115 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );116-#endif`,bge=`vec3 transformed = vec3( position );116+#endif`,_ge=`vec3 transformed = vec3( position );117117 #ifdef USE_ALPHAHASH118118 vPosition = vec3( position );119-#endif`,wge=`vec3 objectNormal = vec3( normal );119+#endif`,xge=`vec3 objectNormal = vec3( normal );120120 #ifdef USE_TANGENT121121 vec3 objectTangent = vec3( tangent.xyz );122-#endif`,Sge=`float G_BlinnPhong_Implicit( ) {122+#endif`,yge=`float G_BlinnPhong_Implicit( ) {123123 return 0.25;124124 }125125 float D_BlinnPhong( const in float shininess, const in float dotNH ) {
@@ -133,7 +133,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
133133 float G = G_BlinnPhong_Implicit( );134134 float D = D_BlinnPhong( shininess, dotNH );135135 return F * ( G * D );136-} // validated`,Tge=`#ifdef USE_IRIDESCENCE136+} // validated`,bge=`#ifdef USE_IRIDESCENCE137137 const mat3 XYZ_TO_REC709 = mat3(138138 3.2404542, -0.9692660, 0.0556434,139139 -1.5371385, 1.8760108, -0.2040259,
@@ -196,7 +196,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
196196 }197197 return max( I, vec3( 0.0 ) );198198 }199-#endif`,Ege=`#ifdef USE_BUMPMAP199+#endif`,wge=`#ifdef USE_BUMPMAP200200 uniform sampler2D bumpMap;201201 uniform float bumpScale;202202 vec2 dHdxy_fwd() {
@@ -217,7 +217,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
217217 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );218218 return normalize( abs( fDet ) * surf_norm - vGrad );219219 }220-#endif`,Mge=`#if NUM_CLIPPING_PLANES > 0220+#endif`,Sge=`#if NUM_CLIPPING_PLANES > 0221221 vec4 plane;222222 #ifdef ALPHA_TO_COVERAGE223223 float distanceToPlane, distanceGradient;
@@ -263,20 +263,20 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
263263 if ( clipped ) discard;264264 #endif265265 #endif266-#endif`,Cge=`#if NUM_CLIPPING_PLANES > 0266+#endif`,Tge=`#if NUM_CLIPPING_PLANES > 0267267 varying vec3 vClipPosition;268268 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];269-#endif`,Rge=`#if NUM_CLIPPING_PLANES > 0269+#endif`,Ege=`#if NUM_CLIPPING_PLANES > 0270270 varying vec3 vClipPosition;271-#endif`,Ige=`#if NUM_CLIPPING_PLANES > 0271+#endif`,Mge=`#if NUM_CLIPPING_PLANES > 0272272 vClipPosition = - mvPosition.xyz;273-#endif`,Pge=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )273+#endif`,Cge=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )274274 diffuseColor *= vColor;275-#endif`,Lge=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )275+#endif`,Rge=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )276276 varying vec4 vColor;277-#endif`,Dge=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )277+#endif`,Pge=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )278278 varying vec4 vColor;279-#endif`,Nge=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )279+#endif`,Ige=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )280280 vColor = vec4( 1.0 );281281 #endif282282 #ifdef USE_COLOR_ALPHA
@@ -289,7 +289,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
289289 #endif290290 #ifdef USE_BATCHING_COLOR291291 vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );292-#endif`,Fge=`#define PI 3.141592653589793292+#endif`,Lge=`#define PI 3.141592653589793293293 #define PI2 6.283185307179586294294 #define PI_HALF 1.5707963267948966295295 #define RECIPROCAL_PI 0.3183098861837907
@@ -360,7 +360,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
360360 float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {361361 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );362362 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );363-} // validated`,Bge=`#ifdef ENVMAP_TYPE_CUBE_UV363+} // validated`,Dge=`#ifdef ENVMAP_TYPE_CUBE_UV364364 #define cubeUV_minMipLevel 4.0365365 #define cubeUV_minTileSize 16.0366366 float getFace( vec3 direction ) {
@@ -453,7 +453,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
453453 return vec4( mix( color0, color1, mipF ), 1.0 );454454 }455455 }456-#endif`,Oge=`vec3 transformedNormal = objectNormal;456+#endif`,Nge=`vec3 transformedNormal = objectNormal;457457 #ifdef USE_TANGENT458458 vec3 transformedTangent = objectTangent;459459 #endif
@@ -479,21 +479,21 @@ transformedNormal = normalMatrix * transformedNormal;
479479 #endif480480 #ifdef USE_TANGENT481481 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;482-#endif`,Uge=`#ifdef USE_DISPLACEMENTMAP482+#endif`,Fge=`#ifdef USE_DISPLACEMENTMAP483483 uniform sampler2D displacementMap;484484 uniform float displacementScale;485485 uniform float displacementBias;486-#endif`,kge=`#ifdef USE_DISPLACEMENTMAP486+#endif`,Bge=`#ifdef USE_DISPLACEMENTMAP487487 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );488-#endif`,zge=`#ifdef USE_EMISSIVEMAP488+#endif`,Oge=`#ifdef USE_EMISSIVEMAP489489 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );490490 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE491491 emissiveColor = sRGBTransferEOTF( emissiveColor );492492 #endif493493 totalEmissiveRadiance *= emissiveColor.rgb;494-#endif`,Vge=`#ifdef USE_EMISSIVEMAP494+#endif`,Uge=`#ifdef USE_EMISSIVEMAP495495 uniform sampler2D emissiveMap;496-#endif`,Gge="gl_FragColor = linearToOutputTexel( gl_FragColor );",qge=`vec4 LinearTransferOETF( in vec4 value ) {496+#endif`,kge="gl_FragColor = linearToOutputTexel( gl_FragColor );",zge=`vec4 LinearTransferOETF( in vec4 value ) {497497 return value;498498 }499499 vec4 sRGBTransferEOTF( in vec4 value ) {
@@ -501,7 +501,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
501501 }502502 vec4 sRGBTransferOETF( in vec4 value ) {503503 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 );504-}`,Hge=`#ifdef USE_ENVMAP504+}`,Vge=`#ifdef USE_ENVMAP505505 #ifdef ENV_WORLDPOS506506 vec3 cameraToFrag;507507 if ( isOrthographic ) {
@@ -528,7 +528,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
528528 outgoingLight += envColor.xyz * specularStrength * reflectivity;529529 #endif530530 #endif531-#endif`,Wge=`#ifdef USE_ENVMAP531+#endif`,Gge=`#ifdef USE_ENVMAP532532 uniform float envMapIntensity;533533 uniform mat3 envMapRotation;534534 #ifdef ENVMAP_TYPE_CUBE
@@ -536,7 +536,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
536536 #else537537 uniform sampler2D envMap;538538 #endif539-#endif`,jge=`#ifdef USE_ENVMAP539+#endif`,qge=`#ifdef USE_ENVMAP540540 uniform float reflectivity;541541 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )542542 #define ENV_WORLDPOS
@@ -547,7 +547,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
547547 #else548548 varying vec3 vReflect;549549 #endif550-#endif`,Xge=`#ifdef USE_ENVMAP550+#endif`,Hge=`#ifdef USE_ENVMAP551551 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )552552 #define ENV_WORLDPOS553553 #endif
@@ -558,7 +558,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
558558 varying vec3 vReflect;559559 uniform float refractionRatio;560560 #endif561-#endif`,$ge=`#ifdef USE_ENVMAP561+#endif`,Wge=`#ifdef USE_ENVMAP562562 #ifdef ENV_WORLDPOS563563 vWorldPosition = worldPosition.xyz;564564 #else
@@ -575,18 +575,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
575575 vReflect = refract( cameraToVertex, worldNormal, refractionRatio );576576 #endif577577 #endif578-#endif`,Yge=`#ifdef USE_FOG578+#endif`,jge=`#ifdef USE_FOG579579 vFogDepth = - mvPosition.z;580-#endif`,Zge=`#ifdef USE_FOG580+#endif`,Xge=`#ifdef USE_FOG581581 varying float vFogDepth;582-#endif`,Kge=`#ifdef USE_FOG582+#endif`,$ge=`#ifdef USE_FOG583583 #ifdef FOG_EXP2584584 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );585585 #else586586 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );587587 #endif588588 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );589-#endif`,Qge=`#ifdef USE_FOG589+#endif`,Yge=`#ifdef USE_FOG590590 uniform vec3 fogColor;591591 varying float vFogDepth;592592 #ifdef FOG_EXP2
@@ -595,7 +595,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
595595 uniform float fogNear;596596 uniform float fogFar;597597 #endif598-#endif`,Jge=`#ifdef USE_GRADIENTMAP598+#endif`,Zge=`#ifdef USE_GRADIENTMAP599599 uniform sampler2D gradientMap;600600 #endif601601 vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
@@ -607,12 +607,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
607607 vec2 fw = fwidth( coord ) * 0.5;608608 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );609609 #endif610-}`,e1e=`#ifdef USE_LIGHTMAP610+}`,Kge=`#ifdef USE_LIGHTMAP611611 uniform sampler2D lightMap;612612 uniform float lightMapIntensity;613-#endif`,t1e=`LambertMaterial material;613+#endif`,Qge=`LambertMaterial material;614614 material.diffuseColor = diffuseColor.rgb;615-material.specularStrength = specularStrength;`,n1e=`varying vec3 vViewPosition;615+material.specularStrength = specularStrength;`,Jge=`varying vec3 vViewPosition;616616 struct LambertMaterial {617617 vec3 diffuseColor;618618 float specularStrength;
@@ -626,7 +626,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
626626 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );627627 }628628 #define RE_Direct RE_Direct_Lambert629-#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,i1e=`uniform bool receiveShadow;629+#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,e1e=`uniform bool receiveShadow;630630 uniform vec3 ambientLightColor;631631 #if defined( USE_LIGHT_PROBES )632632 uniform vec3 lightProbe[ 9 ];
@@ -743,7 +743,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
743743 return irradiance;744744 }745745 #endif746-#include <lightprobes_pars_fragment>`,r1e=`#ifdef USE_ENVMAP746+#include <lightprobes_pars_fragment>`,t1e=`#ifdef USE_ENVMAP747747 vec3 getIBLIrradiance( const in vec3 normal ) {748748 #ifdef ENVMAP_TYPE_CUBE_UV749749 vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
@@ -776,8 +776,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
776776 #endif777777 }778778 #endif779-#endif`,s1e=`ToonMaterial material;780-material.diffuseColor = diffuseColor.rgb;`,o1e=`varying vec3 vViewPosition;779+#endif`,n1e=`ToonMaterial material;780+material.diffuseColor = diffuseColor.rgb;`,i1e=`varying vec3 vViewPosition;781781 struct ToonMaterial {782782 vec3 diffuseColor;783783 };
@@ -789,11 +789,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
789789 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );790790 }791791 #define RE_Direct RE_Direct_Toon792-#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,a1e=`BlinnPhongMaterial material;792+#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,r1e=`BlinnPhongMaterial material;793793 material.diffuseColor = diffuseColor.rgb;794794 material.specularColor = specular;795795 material.specularShininess = shininess;796-material.specularStrength = specularStrength;`,l1e=`varying vec3 vViewPosition;796+material.specularStrength = specularStrength;`,s1e=`varying vec3 vViewPosition;797797 struct BlinnPhongMaterial {798798 vec3 diffuseColor;799799 vec3 specularColor;
@@ -810,7 +810,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
810810 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );811811 }812812 #define RE_Direct RE_Direct_BlinnPhong813-#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,c1e=`PhysicalMaterial material;813+#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,o1e=`PhysicalMaterial material;814814 material.diffuseColor = diffuseColor.rgb;815815 material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );816816 material.metalness = metalnessFactor;
@@ -900,7 +900,7 @@ material.roughness = min( material.roughness, 1.0 );
900900 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );901901 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;902902 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;903-#endif`,u1e=`uniform sampler2D dfgLUT;903+#endif`,a1e=`uniform sampler2D dfgLUT;904904 struct PhysicalMaterial {905905 vec3 diffuseColor;906906 vec3 diffuseContribution;
@@ -1260,7 +1260,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
12601260 #define RE_IndirectSpecular RE_IndirectSpecular_Physical12611261 float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {12621262 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );1263-}`,h1e=`1263+}`,l1e=`12641264 vec3 geometryPosition = - vViewPosition;12651265 vec3 geometryNormal = normal;12661266 vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
@@ -1382,7 +1382,7 @@ IncidentLight directLight;
13821382 #if defined( RE_IndirectSpecular )13831383 vec3 radiance = vec3( 0.0 );13841384 vec3 clearcoatRadiance = vec3( 0.0 );1385-#endif`,f1e=`#if defined( RE_IndirectDiffuse )1385+#endif`,c1e=`#if defined( RE_IndirectDiffuse )13861386 #ifdef USE_LIGHTMAP13871387 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );13881388 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
@@ -1403,7 +1403,7 @@ IncidentLight directLight;
14031403 #ifdef USE_CLEARCOAT14041404 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );14051405 #endif1406-#endif`,d1e=`#if defined( RE_IndirectDiffuse )1406+#endif`,u1e=`#if defined( RE_IndirectDiffuse )14071407 #if defined( LAMBERT ) || defined( PHONG )14081408 irradiance += iblIrradiance;14091409 #endif
@@ -1411,7 +1411,7 @@ IncidentLight directLight;
14111411 #endif14121412 #if defined( RE_IndirectSpecular )14131413 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );1414-#endif`,p1e=`#ifdef USE_LIGHT_PROBES_GRID1414+#endif`,h1e=`#ifdef USE_LIGHT_PROBES_GRID14151415 uniform highp sampler3D probesSH;14161416 uniform vec3 probesMin;14171417 uniform vec3 probesMax;
@@ -1456,27 +1456,27 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
14561456 result += c8 * 0.429043 * ( x * x - y * y );14571457 return max( result, vec3( 0.0 ) );14581458 }1459-#endif`,m1e=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )1459+#endif`,f1e=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )14601460 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;1461-#endif`,A1e=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )1461+#endif`,d1e=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )14621462 uniform float logDepthBufFC;14631463 varying float vFragDepth;14641464 varying float vIsPerspective;1465-#endif`,g1e=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER1465+#endif`,p1e=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER14661466 varying float vFragDepth;14671467 varying float vIsPerspective;1468-#endif`,v1e=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER1468+#endif`,m1e=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER14691469 vFragDepth = 1.0 + gl_Position.w;14701470 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );1471-#endif`,_1e=`#ifdef USE_MAP1471+#endif`,A1e=`#ifdef USE_MAP14721472 vec4 sampledDiffuseColor = texture2D( map, vMapUv );14731473 #ifdef DECODE_VIDEO_TEXTURE14741474 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );14751475 #endif14761476 diffuseColor *= sampledDiffuseColor;1477-#endif`,x1e=`#ifdef USE_MAP1477+#endif`,g1e=`#ifdef USE_MAP14781478 uniform sampler2D map;1479-#endif`,y1e=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )1479+#endif`,v1e=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )14801480 #if defined( USE_POINTS_UV )14811481 vec2 uv = vUv;14821482 #else
@@ -1488,7 +1488,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
14881488 #endif14891489 #ifdef USE_ALPHAMAP14901490 diffuseColor.a *= texture2D( alphaMap, uv ).g;1491-#endif`,b1e=`#if defined( USE_POINTS_UV )1491+#endif`,_1e=`#if defined( USE_POINTS_UV )14921492 varying vec2 vUv;14931493 #else14941494 #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
@@ -1500,19 +1500,19 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
15001500 #endif15011501 #ifdef USE_ALPHAMAP15021502 uniform sampler2D alphaMap;1503-#endif`,w1e=`float metalnessFactor = metalness;1503+#endif`,x1e=`float metalnessFactor = metalness;15041504 #ifdef USE_METALNESSMAP15051505 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );15061506 metalnessFactor *= texelMetalness.b;1507-#endif`,S1e=`#ifdef USE_METALNESSMAP1507+#endif`,y1e=`#ifdef USE_METALNESSMAP15081508 uniform sampler2D metalnessMap;1509-#endif`,T1e=`#ifdef USE_INSTANCING_MORPH1509+#endif`,b1e=`#ifdef USE_INSTANCING_MORPH15101510 float morphTargetInfluences[ MORPHTARGETS_COUNT ];15111511 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;15121512 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {15131513 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;15141514 }1515-#endif`,E1e=`#if defined( USE_MORPHCOLORS )1515+#endif`,w1e=`#if defined( USE_MORPHCOLORS )15161516 vColor *= morphTargetBaseInfluence;15171517 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {15181518 #if defined( USE_COLOR_ALPHA )
@@ -1521,12 +1521,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
15211521 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];15221522 #endif15231523 }1524-#endif`,M1e=`#ifdef USE_MORPHNORMALS1524+#endif`,S1e=`#ifdef USE_MORPHNORMALS15251525 objectNormal *= morphTargetBaseInfluence;15261526 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {15271527 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];15281528 }1529-#endif`,C1e=`#ifdef USE_MORPHTARGETS1529+#endif`,T1e=`#ifdef USE_MORPHTARGETS15301530 #ifndef USE_INSTANCING_MORPH15311531 uniform float morphTargetBaseInfluence;15321532 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
@@ -1540,12 +1540,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
15401540 ivec3 morphUV = ivec3( x, y, morphTargetIndex );15411541 return texelFetch( morphTargetsTexture, morphUV, 0 );15421542 }1543-#endif`,R1e=`#ifdef USE_MORPHTARGETS1543+#endif`,E1e=`#ifdef USE_MORPHTARGETS15441544 transformed *= morphTargetBaseInfluence;15451545 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {15461546 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];15471547 }1548-#endif`,I1e=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;1548+#endif`,M1e=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;15491549 #ifdef FLAT_SHADED15501550 vec3 fdx = dFdx( vViewPosition );15511551 vec3 fdy = dFdy( vViewPosition );
@@ -1586,7 +1586,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
15861586 tbn2[1] *= faceDirection;15871587 #endif15881588 #endif1589-vec3 nonPerturbedNormal = normal;`,P1e=`#ifdef USE_NORMALMAP_OBJECTSPACE1589+vec3 nonPerturbedNormal = normal;`,C1e=`#ifdef USE_NORMALMAP_OBJECTSPACE15901590 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;15911591 #ifdef FLIP_SIDED15921592 normal = - normal;
@@ -1604,19 +1604,19 @@ vec3 nonPerturbedNormal = normal;`,P1e=`#ifdef USE_NORMALMAP_OBJECTSPACE
16041604 normal = normalize( tbn * mapN );16051605 #elif defined( USE_BUMPMAP )16061606 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );1607-#endif`,L1e=`#ifndef FLAT_SHADED1607+#endif`,R1e=`#ifndef FLAT_SHADED16081608 varying vec3 vNormal;16091609 #ifdef USE_TANGENT16101610 varying vec3 vTangent;16111611 varying vec3 vBitangent;16121612 #endif1613-#endif`,D1e=`#ifndef FLAT_SHADED1613+#endif`,P1e=`#ifndef FLAT_SHADED16141614 varying vec3 vNormal;16151615 #ifdef USE_TANGENT16161616 varying vec3 vTangent;16171617 varying vec3 vBitangent;16181618 #endif1619-#endif`,N1e=`#ifndef FLAT_SHADED1619+#endif`,I1e=`#ifndef FLAT_SHADED16201620 vNormal = normalize( transformedNormal );16211621 #ifdef USE_TANGENT16221622 vTangent = normalize( transformedTangent );
@@ -1625,7 +1625,7 @@ vec3 nonPerturbedNormal = normal;`,P1e=`#ifdef USE_NORMALMAP_OBJECTSPACE
16251625 vBitangent = - vBitangent;16261626 #endif16271627 #endif1628-#endif`,F1e=`#ifdef USE_NORMALMAP1628+#endif`,L1e=`#ifdef USE_NORMALMAP16291629 uniform sampler2D normalMap;16301630 uniform vec2 normalScale;16311631 #endif
@@ -1647,13 +1647,13 @@ vec3 nonPerturbedNormal = normal;`,P1e=`#ifdef USE_NORMALMAP_OBJECTSPACE
16471647 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );16481648 return mat3( T * scale, B * scale, N );16491649 }1650-#endif`,B1e=`#ifdef USE_CLEARCOAT1650+#endif`,D1e=`#ifdef USE_CLEARCOAT16511651 vec3 clearcoatNormal = nonPerturbedNormal;1652-#endif`,O1e=`#ifdef USE_CLEARCOAT_NORMALMAP1652+#endif`,N1e=`#ifdef USE_CLEARCOAT_NORMALMAP16531653 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;16541654 clearcoatMapN.xy *= clearcoatNormalScale;16551655 clearcoatNormal = normalize( tbn2 * clearcoatMapN );1656-#endif`,U1e=`#ifdef USE_CLEARCOATMAP1656+#endif`,F1e=`#ifdef USE_CLEARCOATMAP16571657 uniform sampler2D clearcoatMap;16581658 #endif16591659 #ifdef USE_CLEARCOAT_NORMALMAP
@@ -1662,18 +1662,18 @@ vec3 nonPerturbedNormal = normal;`,P1e=`#ifdef USE_NORMALMAP_OBJECTSPACE
16621662 #endif16631663 #ifdef USE_CLEARCOAT_ROUGHNESSMAP16641664 uniform sampler2D clearcoatRoughnessMap;1665-#endif`,k1e=`#ifdef USE_IRIDESCENCEMAP1665+#endif`,B1e=`#ifdef USE_IRIDESCENCEMAP16661666 uniform sampler2D iridescenceMap;16671667 #endif16681668 #ifdef USE_IRIDESCENCE_THICKNESSMAP16691669 uniform sampler2D iridescenceThicknessMap;1670-#endif`,z1e=`#ifdef OPAQUE1670+#endif`,O1e=`#ifdef OPAQUE16711671 diffuseColor.a = 1.0;16721672 #endif16731673 #ifdef USE_TRANSMISSION16741674 diffuseColor.a *= material.transmissionAlpha;16751675 #endif1676-gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,V1e=`vec3 packNormalToRGB( const in vec3 normal ) {1676+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,U1e=`vec3 packNormalToRGB( const in vec3 normal ) {16771677 return normalize( normal ) * 0.5 + 0.5;16781678 }16791679 vec3 unpackRGBToNormal( const in vec3 rgb ) {
@@ -1752,9 +1752,9 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
17521752 #else17531753 return ( near * far ) / ( ( far - near ) * depth - far );17541754 #endif1755-}`,G1e=`#ifdef PREMULTIPLIED_ALPHA1755+}`,k1e=`#ifdef PREMULTIPLIED_ALPHA17561756 gl_FragColor.rgb *= gl_FragColor.a;1757-#endif`,q1e=`vec4 mvPosition = vec4( transformed, 1.0 );1757+#endif`,z1e=`vec4 mvPosition = vec4( transformed, 1.0 );17581758 #ifdef USE_BATCHING17591759 mvPosition = batchingMatrix * mvPosition;17601760 #endif
@@ -1762,22 +1762,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
17621762 mvPosition = instanceMatrix * mvPosition;17631763 #endif17641764 mvPosition = modelViewMatrix * mvPosition;1765-gl_Position = projectionMatrix * mvPosition;`,H1e=`#ifdef DITHERING1765+gl_Position = projectionMatrix * mvPosition;`,V1e=`#ifdef DITHERING17661766 gl_FragColor.rgb = dithering( gl_FragColor.rgb );1767-#endif`,W1e=`#ifdef DITHERING1767+#endif`,G1e=`#ifdef DITHERING17681768 vec3 dithering( vec3 color ) {17691769 float grid_position = rand( gl_FragCoord.xy );17701770 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );17711771 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );17721772 return color + dither_shift_RGB;17731773 }1774-#endif`,j1e=`float roughnessFactor = roughness;1774+#endif`,q1e=`float roughnessFactor = roughness;17751775 #ifdef USE_ROUGHNESSMAP17761776 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );17771777 roughnessFactor *= texelRoughness.g;1778-#endif`,X1e=`#ifdef USE_ROUGHNESSMAP1778+#endif`,H1e=`#ifdef USE_ROUGHNESSMAP17791779 uniform sampler2D roughnessMap;1780-#endif`,$1e=`#if NUM_SPOT_LIGHT_COORDS > 01780+#endif`,W1e=`#if NUM_SPOT_LIGHT_COORDS > 017811781 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];17821782 #endif17831783 #if NUM_SPOT_LIGHT_MAPS > 0
@@ -1977,7 +1977,7 @@ gl_Position = projectionMatrix * mvPosition;`,H1e=`#ifdef DITHERING
19771977 }19781978 #endif19791979 #endif1980-#endif`,Y1e=`#if NUM_SPOT_LIGHT_COORDS > 01980+#endif`,j1e=`#if NUM_SPOT_LIGHT_COORDS > 019811981 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];19821982 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];19831983 #endif
@@ -2018,7 +2018,7 @@ gl_Position = projectionMatrix * mvPosition;`,H1e=`#ifdef DITHERING
20182018 };20192019 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];20202020 #endif2021-#endif`,Z1e=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )2021+#endif`,X1e=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )20222022 #ifdef HAS_NORMAL20232023 vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );20242024 #else
@@ -2054,7 +2054,7 @@ gl_Position = projectionMatrix * mvPosition;`,H1e=`#ifdef DITHERING
20542054 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;20552055 }20562056 #pragma unroll_loop_end2057-#endif`,K1e=`float getShadowMask() {2057+#endif`,$1e=`float getShadowMask() {20582058 float shadow = 1.0;20592059 #ifdef USE_SHADOWMAP20602060 #if NUM_DIR_LIGHT_SHADOWS > 0
@@ -2086,12 +2086,12 @@ gl_Position = projectionMatrix * mvPosition;`,H1e=`#ifdef DITHERING
20862086 #endif20872087 #endif20882088 return shadow;2089-}`,Q1e=`#ifdef USE_SKINNING2089+}`,Y1e=`#ifdef USE_SKINNING20902090 mat4 boneMatX = getBoneMatrix( skinIndex.x );20912091 mat4 boneMatY = getBoneMatrix( skinIndex.y );20922092 mat4 boneMatZ = getBoneMatrix( skinIndex.z );20932093 mat4 boneMatW = getBoneMatrix( skinIndex.w );2094-#endif`,J1e=`#ifdef USE_SKINNING2094+#endif`,Z1e=`#ifdef USE_SKINNING20952095 uniform mat4 bindMatrix;20962096 uniform mat4 bindMatrixInverse;20972097 uniform highp sampler2D boneTexture;
@@ -2106,7 +2106,7 @@ gl_Position = projectionMatrix * mvPosition;`,H1e=`#ifdef DITHERING
21062106 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );21072107 return mat4( v1, v2, v3, v4 );21082108 }2109-#endif`,eve=`#ifdef USE_SKINNING2109+#endif`,K1e=`#ifdef USE_SKINNING21102110 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );21112111 vec4 skinned = vec4( 0.0 );21122112 skinned += boneMatX * skinVertex * skinWeight.x;
@@ -2114,7 +2114,7 @@ gl_Position = projectionMatrix * mvPosition;`,H1e=`#ifdef DITHERING
21142114 skinned += boneMatZ * skinVertex * skinWeight.z;21152115 skinned += boneMatW * skinVertex * skinWeight.w;21162116 transformed = ( bindMatrixInverse * skinned ).xyz;2117-#endif`,tve=`#ifdef USE_SKINNING2117+#endif`,Q1e=`#ifdef USE_SKINNING21182118 mat4 skinMatrix = mat4( 0.0 );21192119 skinMatrix += skinWeight.x * boneMatX;21202120 skinMatrix += skinWeight.y * boneMatY;
@@ -2125,17 +2125,17 @@ gl_Position = projectionMatrix * mvPosition;`,H1e=`#ifdef DITHERING
21252125 #ifdef USE_TANGENT21262126 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;21272127 #endif2128-#endif`,nve=`float specularStrength;2128+#endif`,J1e=`float specularStrength;21292129 #ifdef USE_SPECULARMAP21302130 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );21312131 specularStrength = texelSpecular.r;21322132 #else21332133 specularStrength = 1.0;2134-#endif`,ive=`#ifdef USE_SPECULARMAP2134+#endif`,eve=`#ifdef USE_SPECULARMAP21352135 uniform sampler2D specularMap;2136-#endif`,rve=`#if defined( TONE_MAPPING )2136+#endif`,tve=`#if defined( TONE_MAPPING )21372137 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );2138-#endif`,sve=`#ifndef saturate2138+#endif`,nve=`#ifndef saturate21392139 #define saturate( a ) clamp( a, 0.0, 1.0 )21402140 #endif21412141 uniform float toneMappingExposure;
@@ -2232,7 +2232,7 @@ vec3 NeutralToneMapping( vec3 color ) {
22322232 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );22332233 return mix( color, vec3( newPeak ), g );22342234 }2235-vec3 CustomToneMapping( vec3 color ) { return color; }`,ove=`#ifdef USE_TRANSMISSION2235+vec3 CustomToneMapping( vec3 color ) { return color; }`,ive=`#ifdef USE_TRANSMISSION22362236 material.transmission = transmission;22372237 material.transmissionAlpha = 1.0;22382238 material.thickness = thickness;
@@ -2253,7 +2253,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ove=`#ifdef USE_TRANSMIS
22532253 material.attenuationColor, material.attenuationDistance );22542254 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );22552255 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );2256-#endif`,ave=`#ifdef USE_TRANSMISSION2256+#endif`,rve=`#ifdef USE_TRANSMISSION22572257 uniform float transmission;22582258 uniform float thickness;22592259 uniform float attenuationDistance;
@@ -2379,7 +2379,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ove=`#ifdef USE_TRANSMIS
23792379 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;23802380 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );23812381 }2382-#endif`,lve=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2382+#endif`,sve=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )23832383 varying vec2 vUv;23842384 #endif23852385 #ifdef USE_MAP
@@ -2449,7 +2449,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ove=`#ifdef USE_TRANSMIS
24492449 #ifdef USE_THICKNESSMAP24502450 uniform mat3 thicknessMapTransform;24512451 varying vec2 vThicknessMapUv;2452-#endif`,cve=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2452+#endif`,ove=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )24532453 varying vec2 vUv;24542454 #endif24552455 #ifdef USE_MAP
@@ -2543,7 +2543,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ove=`#ifdef USE_TRANSMIS
25432543 #ifdef USE_THICKNESSMAP25442544 uniform mat3 thicknessMapTransform;25452545 varying vec2 vThicknessMapUv;2546-#endif`,uve=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2546+#endif`,ave=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )25472547 vUv = vec3( uv, 1 ).xy;25482548 #endif25492549 #ifdef USE_MAP
@@ -2614,7 +2614,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ove=`#ifdef USE_TRANSMIS
26142614 #endif26152615 #ifdef USE_THICKNESSMAP26162616 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;2617-#endif`,hve=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 02617+#endif`,lve=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 026182618 vec4 worldPosition = vec4( transformed, 1.0 );26192619 #ifdef USE_BATCHING26202620 worldPosition = batchingMatrix * worldPosition;
@@ -2623,12 +2623,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ove=`#ifdef USE_TRANSMIS
26232623 worldPosition = instanceMatrix * worldPosition;26242624 #endif26252625 worldPosition = modelMatrix * worldPosition;2626-#endif`,fve=`varying vec2 vUv;2626+#endif`,cve=`varying vec2 vUv;26272627 uniform mat3 uvTransform;26282628 void main() {26292629 vUv = ( uvTransform * vec3( uv, 1 ) ).xy;26302630 gl_Position = vec4( position.xy, 1.0, 1.0 );2631-}`,dve=`uniform sampler2D t2D;2631+}`,uve=`uniform sampler2D t2D;26322632 uniform float backgroundIntensity;26332633 varying vec2 vUv;26342634 void main() {
@@ -2640,14 +2640,14 @@ void main() {
26402640 gl_FragColor = texColor;26412641 #include <tonemapping_fragment>26422642 #include <colorspace_fragment>2643-}`,pve=`varying vec3 vWorldDirection;2643+}`,hve=`varying vec3 vWorldDirection;26442644 #include <common>26452645 void main() {26462646 vWorldDirection = transformDirection( position, modelMatrix );26472647 #include <begin_vertex>26482648 #include <project_vertex>26492649 gl_Position.z = gl_Position.w;2650-}`,mve=`#ifdef ENVMAP_TYPE_CUBE2650+}`,fve=`#ifdef ENVMAP_TYPE_CUBE26512651 uniform samplerCube envMap;26522652 #elif defined( ENVMAP_TYPE_CUBE_UV )26532653 uniform sampler2D envMap;
@@ -2669,14 +2669,14 @@ void main() {
26692669 gl_FragColor = texColor;26702670 #include <tonemapping_fragment>26712671 #include <colorspace_fragment>2672-}`,Ave=`varying vec3 vWorldDirection;2672+}`,dve=`varying vec3 vWorldDirection;26732673 #include <common>26742674 void main() {26752675 vWorldDirection = transformDirection( position, modelMatrix );26762676 #include <begin_vertex>26772677 #include <project_vertex>26782678 gl_Position.z = gl_Position.w;2679-}`,gve=`uniform samplerCube tCube;2679+}`,pve=`uniform samplerCube tCube;26802680 uniform float tFlip;26812681 uniform float opacity;26822682 varying vec3 vWorldDirection;
@@ -2686,7 +2686,7 @@ void main() {
26862686 gl_FragColor.a *= opacity;26872687 #include <tonemapping_fragment>26882688 #include <colorspace_fragment>2689-}`,vve=`#include <common>2689+}`,mve=`#include <common>26902690 #include <batching_pars_vertex>26912691 #include <uv_pars_vertex>26922692 #include <displacementmap_pars_vertex>
@@ -2713,7 +2713,7 @@ void main() {
27132713 #include <logdepthbuf_vertex>27142714 #include <clipping_planes_vertex>27152715 vHighPrecisionZW = gl_Position.zw;2716-}`,_ve=`#if DEPTH_PACKING == 32002716+}`,Ave=`#if DEPTH_PACKING == 320027172717 uniform float opacity;27182718 #endif27192719 #include <common>
@@ -2751,7 +2751,7 @@ void main() {
27512751 #elif DEPTH_PACKING == 320327522752 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );27532753 #endif2754-}`,xve=`#define DISTANCE2754+}`,gve=`#define DISTANCE27552755 varying vec3 vWorldPosition;27562756 #include <common>27572757 #include <batching_pars_vertex>
@@ -2778,7 +2778,7 @@ void main() {
27782778 #include <worldpos_vertex>27792779 #include <clipping_planes_vertex>27802780 vWorldPosition = worldPosition.xyz;2781-}`,yve=`#define DISTANCE2781+}`,vve=`#define DISTANCE27822782 uniform vec3 referencePosition;27832783 uniform float nearDistance;27842784 uniform float farDistance;
@@ -2801,13 +2801,13 @@ void main() {
28012801 dist = ( dist - nearDistance ) / ( farDistance - nearDistance );28022802 dist = saturate( dist );28032803 gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );2804-}`,bve=`varying vec3 vWorldDirection;2804+}`,_ve=`varying vec3 vWorldDirection;28052805 #include <common>28062806 void main() {28072807 vWorldDirection = transformDirection( position, modelMatrix );28082808 #include <begin_vertex>28092809 #include <project_vertex>2810-}`,wve=`uniform sampler2D tEquirect;2810+}`,xve=`uniform sampler2D tEquirect;28112811 varying vec3 vWorldDirection;28122812 #include <common>28132813 void main() {
@@ -2816,7 +2816,7 @@ void main() {
28162816 gl_FragColor = texture2D( tEquirect, sampleUV );28172817 #include <tonemapping_fragment>28182818 #include <colorspace_fragment>2819-}`,Sve=`uniform float scale;2819+}`,yve=`uniform float scale;28202820 attribute float lineDistance;28212821 varying float vLineDistance;28222822 #include <common>
@@ -2838,7 +2838,7 @@ void main() {
28382838 #include <logdepthbuf_vertex>28392839 #include <clipping_planes_vertex>28402840 #include <fog_vertex>2841-}`,Tve=`uniform vec3 diffuse;2841+}`,bve=`uniform vec3 diffuse;28422842 uniform float opacity;28432843 uniform float dashSize;28442844 uniform float totalSize;
@@ -2866,7 +2866,7 @@ void main() {
28662866 #include <colorspace_fragment>28672867 #include <fog_fragment>28682868 #include <premultiplied_alpha_fragment>2869-}`,Eve=`#include <common>2869+}`,wve=`#include <common>28702870 #include <batching_pars_vertex>28712871 #include <uv_pars_vertex>28722872 #include <envmap_pars_vertex>
@@ -2898,7 +2898,7 @@ void main() {
28982898 #include <worldpos_vertex>28992899 #include <envmap_vertex>29002900 #include <fog_vertex>2901-}`,Mve=`uniform vec3 diffuse;2901+}`,Sve=`uniform vec3 diffuse;29022902 uniform float opacity;29032903 #ifndef FLAT_SHADED29042904 varying vec3 vNormal;
@@ -2946,7 +2946,7 @@ void main() {
29462946 #include <fog_fragment>29472947 #include <premultiplied_alpha_fragment>29482948 #include <dithering_fragment>2949-}`,Cve=`#define LAMBERT2949+}`,Tve=`#define LAMBERT29502950 varying vec3 vViewPosition;29512951 #include <common>29522952 #include <batching_pars_vertex>
@@ -2985,7 +2985,7 @@ void main() {
29852985 #include <envmap_vertex>29862986 #include <shadowmap_vertex>29872987 #include <fog_vertex>2988-}`,Rve=`#define LAMBERT2988+}`,Eve=`#define LAMBERT29892989 uniform vec3 diffuse;29902990 uniform vec3 emissive;29912991 uniform float opacity;
@@ -3043,7 +3043,7 @@ void main() {
30433043 #include <fog_fragment>30443044 #include <premultiplied_alpha_fragment>30453045 #include <dithering_fragment>3046-}`,Ive=`#define MATCAP3046+}`,Mve=`#define MATCAP30473047 varying vec3 vViewPosition;30483048 #include <common>30493049 #include <batching_pars_vertex>
@@ -3077,7 +3077,7 @@ void main() {
30773077 #include <clipping_planes_vertex>30783078 #include <fog_vertex>30793079 vViewPosition = - mvPosition.xyz;3080-}`,Pve=`#define MATCAP3080+}`,Cve=`#define MATCAP30813081 uniform vec3 diffuse;30823082 uniform float opacity;30833083 uniform sampler2D matcap;
@@ -3123,7 +3123,7 @@ void main() {
31233123 #include <fog_fragment>31243124 #include <premultiplied_alpha_fragment>31253125 #include <dithering_fragment>3126-}`,Lve=`#define NORMAL3126+}`,Rve=`#define NORMAL31273127 #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )31283128 varying vec3 vViewPosition;31293129 #endif
@@ -3156,7 +3156,7 @@ void main() {
31563156 #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )31573157 vViewPosition = - mvPosition.xyz;31583158 #endif3159-}`,Dve=`#define NORMAL3159+}`,Pve=`#define NORMAL31603160 uniform float opacity;31613161 #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )31623162 varying vec3 vViewPosition;
@@ -3177,7 +3177,7 @@ void main() {
31773177 #ifdef OPAQUE31783178 gl_FragColor.a = 1.0;31793179 #endif3180-}`,Nve=`#define PHONG3180+}`,Ive=`#define PHONG31813181 varying vec3 vViewPosition;31823182 #include <common>31833183 #include <batching_pars_vertex>
@@ -3216,7 +3216,7 @@ void main() {
32163216 #include <envmap_vertex>32173217 #include <shadowmap_vertex>32183218 #include <fog_vertex>3219-}`,Fve=`#define PHONG3219+}`,Lve=`#define PHONG32203220 uniform vec3 diffuse;32213221 uniform vec3 emissive;32223222 uniform vec3 specular;
@@ -3276,7 +3276,7 @@ void main() {
32763276 #include <fog_fragment>32773277 #include <premultiplied_alpha_fragment>32783278 #include <dithering_fragment>3279-}`,Bve=`#define STANDARD3279+}`,Dve=`#define STANDARD32803280 varying vec3 vViewPosition;32813281 #ifdef USE_TRANSMISSION32823282 varying vec3 vWorldPosition;
@@ -3319,7 +3319,7 @@ void main() {
33193319 #ifdef USE_TRANSMISSION33203320 vWorldPosition = worldPosition.xyz;33213321 #endif3322-}`,Ove=`#define STANDARD3322+}`,Nve=`#define STANDARD33233323 #ifdef PHYSICAL33243324 #define IOR33253325 #define USE_SPECULAR
@@ -3444,7 +3444,7 @@ void main() {
34443444 #include <fog_fragment>34453445 #include <premultiplied_alpha_fragment>34463446 #include <dithering_fragment>3447-}`,Uve=`#define TOON3447+}`,Fve=`#define TOON34483448 varying vec3 vViewPosition;34493449 #include <common>34503450 #include <batching_pars_vertex>
@@ -3481,7 +3481,7 @@ void main() {
34813481 #include <worldpos_vertex>34823482 #include <shadowmap_vertex>34833483 #include <fog_vertex>3484-}`,kve=`#define TOON3484+}`,Bve=`#define TOON34853485 uniform vec3 diffuse;34863486 uniform vec3 emissive;34873487 uniform float opacity;
@@ -3533,7 +3533,7 @@ void main() {
35333533 #include <fog_fragment>35343534 #include <premultiplied_alpha_fragment>35353535 #include <dithering_fragment>3536-}`,zve=`uniform float size;3536+}`,Ove=`uniform float size;35373537 uniform float scale;35383538 #include <common>35393539 #include <color_pars_vertex>
@@ -3564,7 +3564,7 @@ void main() {
35643564 #include <clipping_planes_vertex>35653565 #include <worldpos_vertex>35663566 #include <fog_vertex>3567-}`,Vve=`uniform vec3 diffuse;3567+}`,Uve=`uniform vec3 diffuse;35683568 uniform float opacity;35693569 #include <common>35703570 #include <color_pars_fragment>
@@ -3589,7 +3589,7 @@ void main() {
35893589 #include <colorspace_fragment>35903590 #include <fog_fragment>35913591 #include <premultiplied_alpha_fragment>3592-}`,Gve=`#include <common>3592+}`,kve=`#include <common>35933593 #include <batching_pars_vertex>35943594 #include <fog_pars_vertex>35953595 #include <morphtarget_pars_vertex>
@@ -3612,7 +3612,7 @@ void main() {
36123612 #include <worldpos_vertex>36133613 #include <shadowmap_vertex>36143614 #include <fog_vertex>3615-}`,qve=`uniform vec3 color;3615+}`,zve=`uniform vec3 color;36163616 uniform float opacity;36173617 #include <common>36183618 #include <fog_pars_fragment>
@@ -3628,7 +3628,7 @@ void main() {
36283628 #include <colorspace_fragment>36293629 #include <fog_fragment>36303630 #include <premultiplied_alpha_fragment>3631-}`,Hve=`uniform float rotation;3631+}`,Vve=`uniform float rotation;36323632 uniform vec2 center;36333633 #include <common>36343634 #include <uv_pars_vertex>
@@ -3652,7 +3652,7 @@ void main() {
36523652 #include <logdepthbuf_vertex>36533653 #include <clipping_planes_vertex>36543654 #include <fog_vertex>3655-}`,Wve=`uniform vec3 diffuse;3655+}`,Gve=`uniform vec3 diffuse;36563656 uniform float opacity;36573657 #include <common>36583658 #include <uv_pars_fragment>
@@ -3677,7 +3677,7 @@ void main() {
36773677 #include <tonemapping_fragment>36783678 #include <colorspace_fragment>36793679 #include <fog_fragment>3680-}`,kn={alphahash_fragment:fge,alphahash_pars_fragment:dge,alphamap_fragment:pge,alphamap_pars_fragment:mge,alphatest_fragment:Age,alphatest_pars_fragment:gge,aomap_fragment:vge,aomap_pars_fragment:_ge,batching_pars_vertex:xge,batching_vertex:yge,begin_vertex:bge,beginnormal_vertex:wge,bsdfs:Sge,iridescence_fragment:Tge,bumpmap_pars_fragment:Ege,clipping_planes_fragment:Mge,clipping_planes_pars_fragment:Cge,clipping_planes_pars_vertex:Rge,clipping_planes_vertex:Ige,color_fragment:Pge,color_pars_fragment:Lge,color_pars_vertex:Dge,color_vertex:Nge,common:Fge,cube_uv_reflection_fragment:Bge,defaultnormal_vertex:Oge,displacementmap_pars_vertex:Uge,displacementmap_vertex:kge,emissivemap_fragment:zge,emissivemap_pars_fragment:Vge,colorspace_fragment:Gge,colorspace_pars_fragment:qge,envmap_fragment:Hge,envmap_common_pars_fragment:Wge,envmap_pars_fragment:jge,envmap_pars_vertex:Xge,envmap_physical_pars_fragment:r1e,envmap_vertex:$ge,fog_vertex:Yge,fog_pars_vertex:Zge,fog_fragment:Kge,fog_pars_fragment:Qge,gradientmap_pars_fragment:Jge,lightmap_pars_fragment:e1e,lights_lambert_fragment:t1e,lights_lambert_pars_fragment:n1e,lights_pars_begin:i1e,lights_toon_fragment:s1e,lights_toon_pars_fragment:o1e,lights_phong_fragment:a1e,lights_phong_pars_fragment:l1e,lights_physical_fragment:c1e,lights_physical_pars_fragment:u1e,lights_fragment_begin:h1e,lights_fragment_maps:f1e,lights_fragment_end:d1e,lightprobes_pars_fragment:p1e,logdepthbuf_fragment:m1e,logdepthbuf_pars_fragment:A1e,logdepthbuf_pars_vertex:g1e,logdepthbuf_vertex:v1e,map_fragment:_1e,map_pars_fragment:x1e,map_particle_fragment:y1e,map_particle_pars_fragment:b1e,metalnessmap_fragment:w1e,metalnessmap_pars_fragment:S1e,morphinstance_vertex:T1e,morphcolor_vertex:E1e,morphnormal_vertex:M1e,morphtarget_pars_vertex:C1e,morphtarget_vertex:R1e,normal_fragment_begin:I1e,normal_fragment_maps:P1e,normal_pars_fragment:L1e,normal_pars_vertex:D1e,normal_vertex:N1e,normalmap_pars_fragment:F1e,clearcoat_normal_fragment_begin:B1e,clearcoat_normal_fragment_maps:O1e,clearcoat_pars_fragment:U1e,iridescence_pars_fragment:k1e,opaque_fragment:z1e,packing:V1e,premultiplied_alpha_fragment:G1e,project_vertex:q1e,dithering_fragment:H1e,dithering_pars_fragment:W1e,roughnessmap_fragment:j1e,roughnessmap_pars_fragment:X1e,shadowmap_pars_fragment:$1e,shadowmap_pars_vertex:Y1e,shadowmap_vertex:Z1e,shadowmask_pars_fragment:K1e,skinbase_vertex:Q1e,skinning_pars_vertex:J1e,skinning_vertex:eve,skinnormal_vertex:tve,specularmap_fragment:nve,specularmap_pars_fragment:ive,tonemapping_fragment:rve,tonemapping_pars_fragment:sve,transmission_fragment:ove,transmission_pars_fragment:ave,uv_pars_fragment:lve,uv_pars_vertex:cve,uv_vertex:uve,worldpos_vertex:hve,background_vert:fve,background_frag:dve,backgroundCube_vert:pve,backgroundCube_frag:mve,cube_vert:Ave,cube_frag:gve,depth_vert:vve,depth_frag:_ve,distance_vert:xve,distance_frag:yve,equirect_vert:bve,equirect_frag:wve,linedashed_vert:Sve,linedashed_frag:Tve,meshbasic_vert:Eve,meshbasic_frag:Mve,meshlambert_vert:Cve,meshlambert_frag:Rve,meshmatcap_vert:Ive,meshmatcap_frag:Pve,meshnormal_vert:Lve,meshnormal_frag:Dve,meshphong_vert:Nve,meshphong_frag:Fve,meshphysical_vert:Bve,meshphysical_frag:Ove,meshtoon_vert:Uve,meshtoon_frag:kve,points_vert:zve,points_frag:Vve,shadow_vert:Gve,shadow_frag:qve,sprite_vert:Hve,sprite_frag:Wve},Nt={common:{diffuse:{value:new zt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Mn},alphaMap:{value:null},alphaMapTransform:{value:new Mn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Mn}},envmap:{envMap:{value:null},envMapRotation:{value:new Mn},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Mn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Mn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Mn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Mn},normalScale:{value:new Oe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Mn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Mn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Mn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Mn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new zt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new re},probesMax:{value:new re},probesResolution:{value:new re}},points:{diffuse:{value:new zt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Mn},alphaTest:{value:0},uvTransform:{value:new Mn}},sprite:{diffuse:{value:new zt(16777215)},opacity:{value:1},center:{value:new Oe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Mn},alphaMap:{value:null},alphaMapTransform:{value:new Mn},alphaTest:{value:0}}},Ha={basic:{uniforms:fa([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.fog]),vertexShader:kn.meshbasic_vert,fragmentShader:kn.meshbasic_frag},lambert:{uniforms:fa([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)},envMapIntensity:{value:1}}]),vertexShader:kn.meshlambert_vert,fragmentShader:kn.meshlambert_frag},phong:{uniforms:fa([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)},specular:{value:new zt(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:kn.meshphong_vert,fragmentShader:kn.meshphong_frag},standard:{uniforms:fa([Nt.common,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.roughnessmap,Nt.metalnessmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:kn.meshphysical_vert,fragmentShader:kn.meshphysical_frag},toon:{uniforms:fa([Nt.common,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.gradientmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)}}]),vertexShader:kn.meshtoon_vert,fragmentShader:kn.meshtoon_frag},matcap:{uniforms:fa([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,{matcap:{value:null}}]),vertexShader:kn.meshmatcap_vert,fragmentShader:kn.meshmatcap_frag},points:{uniforms:fa([Nt.points,Nt.fog]),vertexShader:kn.points_vert,fragmentShader:kn.points_frag},dashed:{uniforms:fa([Nt.common,Nt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:kn.linedashed_vert,fragmentShader:kn.linedashed_frag},depth:{uniforms:fa([Nt.common,Nt.displacementmap]),vertexShader:kn.depth_vert,fragmentShader:kn.depth_frag},normal:{uniforms:fa([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,{opacity:{value:1}}]),vertexShader:kn.meshnormal_vert,fragmentShader:kn.meshnormal_frag},sprite:{uniforms:fa([Nt.sprite,Nt.fog]),vertexShader:kn.sprite_vert,fragmentShader:kn.sprite_frag},background:{uniforms:{uvTransform:{value:new Mn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:kn.background_vert,fragmentShader:kn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Mn}},vertexShader:kn.backgroundCube_vert,fragmentShader:kn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:kn.cube_vert,fragmentShader:kn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:kn.equirect_vert,fragmentShader:kn.equirect_frag},distance:{uniforms:fa([Nt.common,Nt.displacementmap,{referencePosition:{value:new re},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:kn.distance_vert,fragmentShader:kn.distance_frag},shadow:{uniforms:fa([Nt.lights,Nt.fog,{color:{value:new zt(0)},opacity:{value:1}}]),vertexShader:kn.shadow_vert,fragmentShader:kn.shadow_frag}};Ha.physical={uniforms:fa([Ha.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Mn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Mn},clearcoatNormalScale:{value:new Oe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Mn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Mn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Mn},sheen:{value:0},sheenColor:{value:new zt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Mn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Mn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Mn},transmissionSamplerSize:{value:new Oe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Mn},attenuationDistance:{value:0},attenuationColor:{value:new zt(0)},specularColor:{value:new zt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Mn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Mn},anisotropyVector:{value:new Oe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Mn}}]),vertexShader:kn.meshphysical_vert,fragmentShader:kn.meshphysical_frag};var jM={r:0,b:0,g:0},jve=new cn,aK=new Mn;aK.set(-1,0,0,0,1,0,0,0,1);function Xve(i,e,t,n,r,s){let o=new zt(0),a=r===!0?0:1,l,c,u=null,f=0,d=null;function A(R){let P=R.isScene===!0?R.background:null;if(P&&P.isTexture){let I=R.backgroundBlurriness>0;P=e.get(P,I)}return P}function y(R){let P=!1,I=A(R);I===null?S(o,a):I&&I.isColor&&(S(I,1),P=!0);let F=i.xr.getEnvironmentBlendMode();F==="additive"?t.buffers.color.setClear(0,0,0,1,s):F==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||P)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function w(R,P){let I=A(P);I&&(I.isCubeTexture||I.mapping===zh)?(c===void 0&&(c=new Hn(new Bu(1,1,1),new ps({name:"BackgroundCubeMaterial",uniforms:dg(Ha.backgroundCube.uniforms),vertexShader:Ha.backgroundCube.vertexShader,fragmentShader:Ha.backgroundCube.fragmentShader,side:mi,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(F,D,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=I,c.material.uniforms.backgroundBlurriness.value=P.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=P.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(jve.makeRotationFromEuler(P.backgroundRotation)).transpose(),I.isCubeTexture&&I.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(aK),c.material.toneMapped=ln.getTransfer(I.colorSpace)!==kt,(u!==I||f!==I.version||d!==i.toneMapping)&&(c.material.needsUpdate=!0,u=I,f=I.version,d=i.toneMapping),c.layers.enableAll(),R.unshift(c,c.geometry,c.material,0,0,null)):I&&I.isTexture&&(l===void 0&&(l=new Hn(new ZA(2,2),new ps({name:"BackgroundMaterial",uniforms:dg(Ha.background.uniforms),vertexShader:Ha.background.vertexShader,fragmentShader:Ha.background.fragmentShader,side:zo,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=I,l.material.uniforms.backgroundIntensity.value=P.backgroundIntensity,l.material.toneMapped=ln.getTransfer(I.colorSpace)!==kt,I.matrixAutoUpdate===!0&&I.updateMatrix(),l.material.uniforms.uvTransform.value.copy(I.matrix),(u!==I||f!==I.version||d!==i.toneMapping)&&(l.material.needsUpdate=!0,u=I,f=I.version,d=i.toneMapping),l.layers.enableAll(),R.unshift(l,l.geometry,l.material,0,0,null))}function S(R,P){R.getRGB(jM,gF(i)),t.buffers.color.setClear(jM.r,jM.g,jM.b,P,s)}function T(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(R,P=1){o.set(R),a=P,S(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(R){a=R,S(o,a)},render:y,addToRenderList:w,dispose:T}}function $ve(i,e){let t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=d(null),s=r,o=!1;function a(z,G,W,Y,H){let $=!1,J=f(z,Y,W,G);s!==J&&(s=J,c(s.object)),$=A(z,Y,W,H),$&&y(z,Y,W,H),H!==null&&e.update(H,i.ELEMENT_ARRAY_BUFFER),($||o)&&(o=!1,I(z,G,W,Y),H!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(H).buffer))}function l(){return i.createVertexArray()}function c(z){return i.bindVertexArray(z)}function u(z){return i.deleteVertexArray(z)}function f(z,G,W,Y){let H=Y.wireframe===!0,$=n[G.id];$===void 0&&($={},n[G.id]=$);let J=z.isInstancedMesh===!0?z.id:0,te=$[J];te===void 0&&(te={},$[J]=te);let ce=te[W.id];ce===void 0&&(ce={},te[W.id]=ce);let he=ce[H];return he===void 0&&(he=d(l()),ce[H]=he),he}function d(z){let G=[],W=[],Y=[];for(let H=0;H<t;H++)G[H]=0,W[H]=0,Y[H]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:G,enabledAttributes:W,attributeDivisors:Y,object:z,attributes:{},index:null}}function A(z,G,W,Y){let H=s.attributes,$=G.attributes,J=0,te=W.getAttributes();for(let ce in te)if(te[ce].location>=0){let ve=H[ce],Re=$[ce];if(Re===void 0&&(ce==="instanceMatrix"&&z.instanceMatrix&&(Re=z.instanceMatrix),ce==="instanceColor"&&z.instanceColor&&(Re=z.instanceColor)),ve===void 0||ve.attribute!==Re||Re&&ve.data!==Re.data)return!0;J++}return s.attributesNum!==J||s.index!==Y}function y(z,G,W,Y){let H={},$=G.attributes,J=0,te=W.getAttributes();for(let ce in te)if(te[ce].location>=0){let ve=$[ce];ve===void 0&&(ce==="instanceMatrix"&&z.instanceMatrix&&(ve=z.instanceMatrix),ce==="instanceColor"&&z.instanceColor&&(ve=z.instanceColor));let Re={};Re.attribute=ve,ve&&ve.data&&(Re.data=ve.data),H[ce]=Re,J++}s.attributes=H,s.attributesNum=J,s.index=Y}function w(){let z=s.newAttributes;for(let G=0,W=z.length;G<W;G++)z[G]=0}function S(z){T(z,0)}function T(z,G){let W=s.newAttributes,Y=s.enabledAttributes,H=s.attributeDivisors;W[z]=1,Y[z]===0&&(i.enableVertexAttribArray(z),Y[z]=1),H[z]!==G&&(i.vertexAttribDivisor(z,G),H[z]=G)}function R(){let z=s.newAttributes,G=s.enabledAttributes;for(let W=0,Y=G.length;W<Y;W++)G[W]!==z[W]&&(i.disableVertexAttribArray(W),G[W]=0)}function P(z,G,W,Y,H,$,J){J===!0?i.vertexAttribIPointer(z,G,W,H,$):i.vertexAttribPointer(z,G,W,Y,H,$)}function I(z,G,W,Y){w();let H=Y.attributes,$=W.getAttributes(),J=G.defaultAttributeValues;for(let te in $){let ce=$[te];if(ce.location>=0){let he=H[te];if(he===void 0&&(te==="instanceMatrix"&&z.instanceMatrix&&(he=z.instanceMatrix),te==="instanceColor"&&z.instanceColor&&(he=z.instanceColor)),he!==void 0){let ve=he.normalized,Re=he.itemSize,Qe=e.get(he);if(Qe===void 0)continue;let Fe=Qe.buffer,mt=Qe.type,Ee=Qe.bytesPerElement,Ve=mt===i.INT||mt===i.UNSIGNED_INT||he.gpuType===Kr;if(he.isInterleavedBufferAttribute){let Ye=he.data,Mt=Ye.stride,Et=he.offset;if(Ye.isInstancedInterleavedBuffer){for(let It=0;It<ce.locationSize;It++)T(ce.location+It,Ye.meshPerAttribute);z.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=Ye.meshPerAttribute*Ye.count)}else for(let It=0;It<ce.locationSize;It++)S(ce.location+It);i.bindBuffer(i.ARRAY_BUFFER,Fe);for(let It=0;It<ce.locationSize;It++)P(ce.location+It,Re/ce.locationSize,mt,ve,Mt*Ee,(Et+Re/ce.locationSize*It)*Ee,Ve)}else{if(he.isInstancedBufferAttribute){for(let Ye=0;Ye<ce.locationSize;Ye++)T(ce.location+Ye,he.meshPerAttribute);z.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=he.meshPerAttribute*he.count)}else for(let Ye=0;Ye<ce.locationSize;Ye++)S(ce.location+Ye);i.bindBuffer(i.ARRAY_BUFFER,Fe);for(let Ye=0;Ye<ce.locationSize;Ye++)P(ce.location+Ye,Re/ce.locationSize,mt,ve,Re*Ee,Re/ce.locationSize*Ye*Ee,Ve)}}else if(J!==void 0){let ve=J[te];if(ve!==void 0)switch(ve.length){case 2:i.vertexAttrib2fv(ce.location,ve);break;case 3:i.vertexAttrib3fv(ce.location,ve);break;case 4:i.vertexAttrib4fv(ce.location,ve);break;default:i.vertexAttrib1fv(ce.location,ve)}}}}R()}function F(){B();for(let z in n){let G=n[z];for(let W in G){let Y=G[W];for(let H in Y){let $=Y[H];for(let J in $)u($[J].object),delete $[J];delete Y[H]}}delete n[z]}}function D(z){if(n[z.id]===void 0)return;let G=n[z.id];for(let W in G){let Y=G[W];for(let H in Y){let $=Y[H];for(let J in $)u($[J].object),delete $[J];delete Y[H]}}delete n[z.id]}function L(z){for(let G in n){let W=n[G];for(let Y in W){let H=W[Y];if(H[z.id]===void 0)continue;let $=H[z.id];for(let J in $)u($[J].object),delete $[J];delete H[z.id]}}}function C(z){for(let G in n){let W=n[G],Y=z.isInstancedMesh===!0?z.id:0,H=W[Y];if(H!==void 0){for(let $ in H){let J=H[$];for(let te in J)u(J[te].object),delete J[te];delete H[$]}delete W[Y],Object.keys(W).length===0&&delete n[G]}}}function B(){k(),o=!0,s!==r&&(s=r,c(s.object))}function k(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:B,resetDefaultState:k,dispose:F,releaseStatesOfGeometry:D,releaseStatesOfObject:C,releaseStatesOfProgram:L,initAttributes:w,enableAttribute:S,disableUnusedAttributes:R}}function Yve(i,e,t){let n;function r(l){n=l}function s(l,c){i.drawArrays(n,l,c),t.update(c,n,1)}function o(l,c,u){u!==0&&(i.drawArraysInstanced(n,l,c,u),t.update(c,n,u))}function a(l,c,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,c,0,u);let d=0;for(let A=0;A<u;A++)d+=c[A];t.update(d,n,1)}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a}function Zve(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){let L=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(L){return!(L!==Ur&&n.convert(L)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(L){let C=L===Wi&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(L!==Ji&&n.convert(L)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&L!==cr&&!C)}function l(L){if(L==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp",u=l(c);u!==c&&(Xe("WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);let f=t.logarithmicDepthBuffer===!0,d=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&d===!1&&Xe("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let A=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),y=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),w=i.getParameter(i.MAX_TEXTURE_SIZE),S=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),T=i.getParameter(i.MAX_VERTEX_ATTRIBS),R=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),P=i.getParameter(i.MAX_VARYING_VECTORS),I=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),F=i.getParameter(i.MAX_SAMPLES),D=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reversedDepthBuffer:d,maxTextures:A,maxVertexTextures:y,maxTextureSize:w,maxCubemapSize:S,maxAttributes:T,maxVertexUniforms:R,maxVaryings:P,maxFragmentUniforms:I,maxSamples:F,samples:D}}function Kve(i){let e=this,t=null,n=0,r=!1,s=!1,o=new Na,a=new Mn,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,d){let A=f.length!==0||d||n!==0||r;return r=d,n=f.length,A},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,d){t=u(f,d,0)},this.setState=function(f,d,A){let y=f.clippingPlanes,w=f.clipIntersection,S=f.clipShadows,T=i.get(f);if(!r||y===null||y.length===0||s&&!S)s?u(null):c();else{let R=s?0:n,P=R*4,I=T.clippingState||null;l.value=I,I=u(y,d,P,A);for(let F=0;F!==P;++F)I[F]=t[F];T.clippingState=I,this.numIntersection=w?this.numPlanes:0,this.numPlanes+=R}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(f,d,A,y){let w=f!==null?f.length:0,S=null;if(w!==0){if(S=l.value,y!==!0||S===null){let T=A+w*4,R=d.matrixWorldInverse;a.getNormalMatrix(R),(S===null||S.length<T)&&(S=new Float32Array(T));for(let P=0,I=A;P!==w;++P,I+=4)o.copy(f[P]).applyMatrix4(R,a),o.normal.toArray(S,I),S[I+3]=o.constant}l.value=S,l.needsUpdate=!0}return e.numPlanes=w,e.numIntersection=0,S}}var W0=4,OZ=[.125,.215,.35,.446,.526,.582],mg=20,Qve=256,Gb=new Ou,UZ=new zt,TF=null,EF=0,MF=0,CF=!1,Jve=new re,$M=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,s={}){let{size:o=256,position:a=Jve}=s;TF=this._renderer.getRenderTarget(),EF=this._renderer.getActiveCubeFace(),MF=this._renderer.getActiveMipmapLevel(),CF=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,r,l,a),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=VZ(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=zZ(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(TF,EF,MF),this._renderer.xr.enabled=CF,e.scissorTest=!1,m_(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===nc||e.mapping===jc?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),TF=this._renderer.getRenderTarget(),EF=this._renderer.getActiveCubeFace(),MF=this._renderer.getActiveMipmapLevel(),CF=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Mi,minFilter:Mi,generateMipmaps:!1,type:Wi,format:Ur,colorSpace:n0,depthBuffer:!1},r=kZ(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=kZ(e,t,n);let{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=e_e(s)),this._blurMaterial=n_e(s,e,t),this._ggxMaterial=t_e(s,e,t)}return r}_compileMaterial(e){let t=new Hn(new Xn,e);this._renderer.compile(t,Gb)}_sceneToCubeUV(e,t,n,r,s){let l=new Yr(90,1,t,n),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],f=this._renderer,d=f.autoClear,A=f.toneMapping;f.getClearColor(UZ),f.toneMapping=ao,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Hn(new Bu,new ds({name:"PMREM.Background",side:mi,depthWrite:!1,depthTest:!1})));let w=this._backgroundBox,S=w.material,T=!1,R=e.background;R?R.isColor&&(S.color.copy(R),e.background=null,T=!0):(S.color.copy(UZ),T=!0);for(let P=0;P<6;P++){let I=P%3;I===0?(l.up.set(0,c[P],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[P],s.y,s.z)):I===1?(l.up.set(0,0,c[P]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[P],s.z)):(l.up.set(0,c[P],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[P]));let F=this._cubeSize;m_(r,I*F,P>2?F:0,F,F),f.setRenderTarget(r),T&&f.render(w,l),f.render(e,l)}f.toneMapping=A,f.autoClear=d,e.background=R}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===nc||e.mapping===jc;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=VZ()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=zZ());let s=r?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=s;let a=s.uniforms;a.envMap.value=e;let l=this._cubeSize;m_(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,Gb)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;let l=o.uniforms,c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-u*u),d=0+c*1.25,A=f*d,{_lodMax:y}=this,w=this._sizeLods[n],S=3*w*(n>y-W0?n-y+W0:0),T=4*(this._cubeSize-w);l.envMap.value=e.texture,l.roughness.value=A,l.mipInt.value=y-t,m_(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,Gb),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=y-n,m_(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,Gb)}_blur(e,t,n,r,s){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,o,a){let l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&ze("blur direction must be either latitudinal or longitudinal!");let u=3,f=this._lodMeshes[r];f.material=c;let d=c.uniforms,A=this._sizeLods[n]-1,y=isFinite(s)?Math.PI/(2*A):2*Math.PI/(2*mg-1),w=s/y,S=isFinite(s)?1+Math.floor(u*w):mg;S>mg&&Xe(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${mg}`);let T=[],R=0;for(let L=0;L<mg;++L){let C=L/w,B=Math.exp(-C*C/2);T.push(B),L===0?R+=B:L<S&&(R+=2*B)}for(let L=0;L<T.length;L++)T[L]=T[L]/R;d.envMap.value=e.texture,d.samples.value=S,d.weights.value=T,d.latitudinal.value=o==="latitudinal",a&&(d.poleAxis.value=a);let{_lodMax:P}=this;d.dTheta.value=y,d.mipInt.value=P-n;let I=this._sizeLods[r],F=3*I*(r>P-W0?r-P+W0:0),D=4*(this._cubeSize-I);m_(t,F,D,3*I,2*I),l.setRenderTarget(t),l.render(f,Gb)}};function e_e(i){let e=[],t=[],n=[],r=i,s=i-W0+1+OZ.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-W0?l=OZ[o-i+W0-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),u=-c,f=1+c,d=[u,u,f,u,f,f,u,u,f,f,u,f],A=6,y=6,w=3,S=2,T=1,R=new Float32Array(w*y*A),P=new Float32Array(S*y*A),I=new Float32Array(T*y*A);for(let D=0;D<A;D++){let L=D%3*2/3-1,C=D>2?0:-1,B=[L,C,0,L+2/3,C,0,L+2/3,C+1,0,L,C,0,L+2/3,C+1,0,L,C+1,0];R.set(B,w*y*D),P.set(d,S*y*D);let k=[D,D,D,D,D,D];I.set(k,T*y*D)}let F=new Xn;F.setAttribute("position",new Hi(R,w)),F.setAttribute("uv",new Hi(P,S)),F.setAttribute("faceIndex",new Hi(I,T)),n.push(new Hn(F,null)),r>W0&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function kZ(i,e,t){let n=new Oa(i,e,t);return n.texture.mapping=zh,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function m_(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function t_e(i,e,t){return new ps({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Qve,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:KM(),fragmentShader:`3680+}`,kn={alphahash_fragment:cge,alphahash_pars_fragment:uge,alphamap_fragment:hge,alphamap_pars_fragment:fge,alphatest_fragment:dge,alphatest_pars_fragment:pge,aomap_fragment:mge,aomap_pars_fragment:Age,batching_pars_vertex:gge,batching_vertex:vge,begin_vertex:_ge,beginnormal_vertex:xge,bsdfs:yge,iridescence_fragment:bge,bumpmap_pars_fragment:wge,clipping_planes_fragment:Sge,clipping_planes_pars_fragment:Tge,clipping_planes_pars_vertex:Ege,clipping_planes_vertex:Mge,color_fragment:Cge,color_pars_fragment:Rge,color_pars_vertex:Pge,color_vertex:Ige,common:Lge,cube_uv_reflection_fragment:Dge,defaultnormal_vertex:Nge,displacementmap_pars_vertex:Fge,displacementmap_vertex:Bge,emissivemap_fragment:Oge,emissivemap_pars_fragment:Uge,colorspace_fragment:kge,colorspace_pars_fragment:zge,envmap_fragment:Vge,envmap_common_pars_fragment:Gge,envmap_pars_fragment:qge,envmap_pars_vertex:Hge,envmap_physical_pars_fragment:t1e,envmap_vertex:Wge,fog_vertex:jge,fog_pars_vertex:Xge,fog_fragment:$ge,fog_pars_fragment:Yge,gradientmap_pars_fragment:Zge,lightmap_pars_fragment:Kge,lights_lambert_fragment:Qge,lights_lambert_pars_fragment:Jge,lights_pars_begin:e1e,lights_toon_fragment:n1e,lights_toon_pars_fragment:i1e,lights_phong_fragment:r1e,lights_phong_pars_fragment:s1e,lights_physical_fragment:o1e,lights_physical_pars_fragment:a1e,lights_fragment_begin:l1e,lights_fragment_maps:c1e,lights_fragment_end:u1e,lightprobes_pars_fragment:h1e,logdepthbuf_fragment:f1e,logdepthbuf_pars_fragment:d1e,logdepthbuf_pars_vertex:p1e,logdepthbuf_vertex:m1e,map_fragment:A1e,map_pars_fragment:g1e,map_particle_fragment:v1e,map_particle_pars_fragment:_1e,metalnessmap_fragment:x1e,metalnessmap_pars_fragment:y1e,morphinstance_vertex:b1e,morphcolor_vertex:w1e,morphnormal_vertex:S1e,morphtarget_pars_vertex:T1e,morphtarget_vertex:E1e,normal_fragment_begin:M1e,normal_fragment_maps:C1e,normal_pars_fragment:R1e,normal_pars_vertex:P1e,normal_vertex:I1e,normalmap_pars_fragment:L1e,clearcoat_normal_fragment_begin:D1e,clearcoat_normal_fragment_maps:N1e,clearcoat_pars_fragment:F1e,iridescence_pars_fragment:B1e,opaque_fragment:O1e,packing:U1e,premultiplied_alpha_fragment:k1e,project_vertex:z1e,dithering_fragment:V1e,dithering_pars_fragment:G1e,roughnessmap_fragment:q1e,roughnessmap_pars_fragment:H1e,shadowmap_pars_fragment:W1e,shadowmap_pars_vertex:j1e,shadowmap_vertex:X1e,shadowmask_pars_fragment:$1e,skinbase_vertex:Y1e,skinning_pars_vertex:Z1e,skinning_vertex:K1e,skinnormal_vertex:Q1e,specularmap_fragment:J1e,specularmap_pars_fragment:eve,tonemapping_fragment:tve,tonemapping_pars_fragment:nve,transmission_fragment:ive,transmission_pars_fragment:rve,uv_pars_fragment:sve,uv_pars_vertex:ove,uv_vertex:ave,worldpos_vertex:lve,background_vert:cve,background_frag:uve,backgroundCube_vert:hve,backgroundCube_frag:fve,cube_vert:dve,cube_frag:pve,depth_vert:mve,depth_frag:Ave,distance_vert:gve,distance_frag:vve,equirect_vert:_ve,equirect_frag:xve,linedashed_vert:yve,linedashed_frag:bve,meshbasic_vert:wve,meshbasic_frag:Sve,meshlambert_vert:Tve,meshlambert_frag:Eve,meshmatcap_vert:Mve,meshmatcap_frag:Cve,meshnormal_vert:Rve,meshnormal_frag:Pve,meshphong_vert:Ive,meshphong_frag:Lve,meshphysical_vert:Dve,meshphysical_frag:Nve,meshtoon_vert:Fve,meshtoon_frag:Bve,points_vert:Ove,points_frag:Uve,shadow_vert:kve,shadow_frag:zve,sprite_vert:Vve,sprite_frag:Gve},Nt={common:{diffuse:{value:new zt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Mn},alphaMap:{value:null},alphaMapTransform:{value:new Mn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Mn}},envmap:{envMap:{value:null},envMapRotation:{value:new Mn},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Mn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Mn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Mn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Mn},normalScale:{value:new Oe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Mn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Mn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Mn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Mn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new zt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new re},probesMax:{value:new re},probesResolution:{value:new re}},points:{diffuse:{value:new zt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Mn},alphaTest:{value:0},uvTransform:{value:new Mn}},sprite:{diffuse:{value:new zt(16777215)},opacity:{value:1},center:{value:new Oe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Mn},alphaMap:{value:null},alphaMapTransform:{value:new Mn},alphaTest:{value:0}}},Ha={basic:{uniforms:fa([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.fog]),vertexShader:kn.meshbasic_vert,fragmentShader:kn.meshbasic_frag},lambert:{uniforms:fa([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)},envMapIntensity:{value:1}}]),vertexShader:kn.meshlambert_vert,fragmentShader:kn.meshlambert_frag},phong:{uniforms:fa([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)},specular:{value:new zt(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:kn.meshphong_vert,fragmentShader:kn.meshphong_frag},standard:{uniforms:fa([Nt.common,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.roughnessmap,Nt.metalnessmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:kn.meshphysical_vert,fragmentShader:kn.meshphysical_frag},toon:{uniforms:fa([Nt.common,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.gradientmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)}}]),vertexShader:kn.meshtoon_vert,fragmentShader:kn.meshtoon_frag},matcap:{uniforms:fa([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,{matcap:{value:null}}]),vertexShader:kn.meshmatcap_vert,fragmentShader:kn.meshmatcap_frag},points:{uniforms:fa([Nt.points,Nt.fog]),vertexShader:kn.points_vert,fragmentShader:kn.points_frag},dashed:{uniforms:fa([Nt.common,Nt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:kn.linedashed_vert,fragmentShader:kn.linedashed_frag},depth:{uniforms:fa([Nt.common,Nt.displacementmap]),vertexShader:kn.depth_vert,fragmentShader:kn.depth_frag},normal:{uniforms:fa([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,{opacity:{value:1}}]),vertexShader:kn.meshnormal_vert,fragmentShader:kn.meshnormal_frag},sprite:{uniforms:fa([Nt.sprite,Nt.fog]),vertexShader:kn.sprite_vert,fragmentShader:kn.sprite_frag},background:{uniforms:{uvTransform:{value:new Mn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:kn.background_vert,fragmentShader:kn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Mn}},vertexShader:kn.backgroundCube_vert,fragmentShader:kn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:kn.cube_vert,fragmentShader:kn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:kn.equirect_vert,fragmentShader:kn.equirect_frag},distance:{uniforms:fa([Nt.common,Nt.displacementmap,{referencePosition:{value:new re},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:kn.distance_vert,fragmentShader:kn.distance_frag},shadow:{uniforms:fa([Nt.lights,Nt.fog,{color:{value:new zt(0)},opacity:{value:1}}]),vertexShader:kn.shadow_vert,fragmentShader:kn.shadow_frag}};Ha.physical={uniforms:fa([Ha.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Mn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Mn},clearcoatNormalScale:{value:new Oe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Mn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Mn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Mn},sheen:{value:0},sheenColor:{value:new zt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Mn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Mn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Mn},transmissionSamplerSize:{value:new Oe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Mn},attenuationDistance:{value:0},attenuationColor:{value:new zt(0)},specularColor:{value:new zt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Mn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Mn},anisotropyVector:{value:new Oe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Mn}}]),vertexShader:kn.meshphysical_vert,fragmentShader:kn.meshphysical_frag};var VM={r:0,b:0,g:0},qve=new cn,iK=new Mn;iK.set(-1,0,0,0,1,0,0,0,1);function Hve(i,e,t,n,r,s){let o=new zt(0),a=r===!0?0:1,l,c,u=null,f=0,d=null;function A(R){let I=R.isScene===!0?R.background:null;if(I&&I.isTexture){let P=R.backgroundBlurriness>0;I=e.get(I,P)}return I}function y(R){let I=!1,P=A(R);P===null?S(o,a):P&&P.isColor&&(S(P,1),I=!0);let F=i.xr.getEnvironmentBlendMode();F==="additive"?t.buffers.color.setClear(0,0,0,1,s):F==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||I)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function w(R,I){let P=A(I);P&&(P.isCubeTexture||P.mapping===Bh)?(c===void 0&&(c=new Hn(new Lu(1,1,1),new ds({name:"BackgroundCubeMaterial",uniforms:fg(Ha.backgroundCube.uniforms),vertexShader:Ha.backgroundCube.vertexShader,fragmentShader:Ha.backgroundCube.fragmentShader,side:mi,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(F,D,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=P,c.material.uniforms.backgroundBlurriness.value=I.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=I.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(qve.makeRotationFromEuler(I.backgroundRotation)).transpose(),P.isCubeTexture&&P.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(iK),c.material.toneMapped=ln.getTransfer(P.colorSpace)!==kt,(u!==P||f!==P.version||d!==i.toneMapping)&&(c.material.needsUpdate=!0,u=P,f=P.version,d=i.toneMapping),c.layers.enableAll(),R.unshift(c,c.geometry,c.material,0,0,null)):P&&P.isTexture&&(l===void 0&&(l=new Hn(new YA(2,2),new ds({name:"BackgroundMaterial",uniforms:fg(Ha.background.uniforms),vertexShader:Ha.background.vertexShader,fragmentShader:Ha.background.fragmentShader,side:zo,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=P,l.material.uniforms.backgroundIntensity.value=I.backgroundIntensity,l.material.toneMapped=ln.getTransfer(P.colorSpace)!==kt,P.matrixAutoUpdate===!0&&P.updateMatrix(),l.material.uniforms.uvTransform.value.copy(P.matrix),(u!==P||f!==P.version||d!==i.toneMapping)&&(l.material.needsUpdate=!0,u=P,f=P.version,d=i.toneMapping),l.layers.enableAll(),R.unshift(l,l.geometry,l.material,0,0,null))}function S(R,I){R.getRGB(VM,gF(i)),t.buffers.color.setClear(VM.r,VM.g,VM.b,I,s)}function T(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(R,I=1){o.set(R),a=I,S(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(R){a=R,S(o,a)},render:y,addToRenderList:w,dispose:T}}function Wve(i,e){let t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=d(null),s=r,o=!1;function a(z,G,W,Y,H){let $=!1,J=f(z,Y,W,G);s!==J&&(s=J,c(s.object)),$=A(z,Y,W,H),$&&y(z,Y,W,H),H!==null&&e.update(H,i.ELEMENT_ARRAY_BUFFER),($||o)&&(o=!1,P(z,G,W,Y),H!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(H).buffer))}function l(){return i.createVertexArray()}function c(z){return i.bindVertexArray(z)}function u(z){return i.deleteVertexArray(z)}function f(z,G,W,Y){let H=Y.wireframe===!0,$=n[G.id];$===void 0&&($={},n[G.id]=$);let J=z.isInstancedMesh===!0?z.id:0,te=$[J];te===void 0&&(te={},$[J]=te);let ce=te[W.id];ce===void 0&&(ce={},te[W.id]=ce);let he=ce[H];return he===void 0&&(he=d(l()),ce[H]=he),he}function d(z){let G=[],W=[],Y=[];for(let H=0;H<t;H++)G[H]=0,W[H]=0,Y[H]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:G,enabledAttributes:W,attributeDivisors:Y,object:z,attributes:{},index:null}}function A(z,G,W,Y){let H=s.attributes,$=G.attributes,J=0,te=W.getAttributes();for(let ce in te)if(te[ce].location>=0){let ve=H[ce],Re=$[ce];if(Re===void 0&&(ce==="instanceMatrix"&&z.instanceMatrix&&(Re=z.instanceMatrix),ce==="instanceColor"&&z.instanceColor&&(Re=z.instanceColor)),ve===void 0||ve.attribute!==Re||Re&&ve.data!==Re.data)return!0;J++}return s.attributesNum!==J||s.index!==Y}function y(z,G,W,Y){let H={},$=G.attributes,J=0,te=W.getAttributes();for(let ce in te)if(te[ce].location>=0){let ve=$[ce];ve===void 0&&(ce==="instanceMatrix"&&z.instanceMatrix&&(ve=z.instanceMatrix),ce==="instanceColor"&&z.instanceColor&&(ve=z.instanceColor));let Re={};Re.attribute=ve,ve&&ve.data&&(Re.data=ve.data),H[ce]=Re,J++}s.attributes=H,s.attributesNum=J,s.index=Y}function w(){let z=s.newAttributes;for(let G=0,W=z.length;G<W;G++)z[G]=0}function S(z){T(z,0)}function T(z,G){let W=s.newAttributes,Y=s.enabledAttributes,H=s.attributeDivisors;W[z]=1,Y[z]===0&&(i.enableVertexAttribArray(z),Y[z]=1),H[z]!==G&&(i.vertexAttribDivisor(z,G),H[z]=G)}function R(){let z=s.newAttributes,G=s.enabledAttributes;for(let W=0,Y=G.length;W<Y;W++)G[W]!==z[W]&&(i.disableVertexAttribArray(W),G[W]=0)}function I(z,G,W,Y,H,$,J){J===!0?i.vertexAttribIPointer(z,G,W,H,$):i.vertexAttribPointer(z,G,W,Y,H,$)}function P(z,G,W,Y){w();let H=Y.attributes,$=W.getAttributes(),J=G.defaultAttributeValues;for(let te in $){let ce=$[te];if(ce.location>=0){let he=H[te];if(he===void 0&&(te==="instanceMatrix"&&z.instanceMatrix&&(he=z.instanceMatrix),te==="instanceColor"&&z.instanceColor&&(he=z.instanceColor)),he!==void 0){let ve=he.normalized,Re=he.itemSize,Qe=e.get(he);if(Qe===void 0)continue;let Fe=Qe.buffer,mt=Qe.type,Ee=Qe.bytesPerElement,Ve=mt===i.INT||mt===i.UNSIGNED_INT||he.gpuType===Kr;if(he.isInterleavedBufferAttribute){let Ye=he.data,Mt=Ye.stride,Et=he.offset;if(Ye.isInstancedInterleavedBuffer){for(let Pt=0;Pt<ce.locationSize;Pt++)T(ce.location+Pt,Ye.meshPerAttribute);z.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=Ye.meshPerAttribute*Ye.count)}else for(let Pt=0;Pt<ce.locationSize;Pt++)S(ce.location+Pt);i.bindBuffer(i.ARRAY_BUFFER,Fe);for(let Pt=0;Pt<ce.locationSize;Pt++)I(ce.location+Pt,Re/ce.locationSize,mt,ve,Mt*Ee,(Et+Re/ce.locationSize*Pt)*Ee,Ve)}else{if(he.isInstancedBufferAttribute){for(let Ye=0;Ye<ce.locationSize;Ye++)T(ce.location+Ye,he.meshPerAttribute);z.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=he.meshPerAttribute*he.count)}else for(let Ye=0;Ye<ce.locationSize;Ye++)S(ce.location+Ye);i.bindBuffer(i.ARRAY_BUFFER,Fe);for(let Ye=0;Ye<ce.locationSize;Ye++)I(ce.location+Ye,Re/ce.locationSize,mt,ve,Re*Ee,Re/ce.locationSize*Ye*Ee,Ve)}}else if(J!==void 0){let ve=J[te];if(ve!==void 0)switch(ve.length){case 2:i.vertexAttrib2fv(ce.location,ve);break;case 3:i.vertexAttrib3fv(ce.location,ve);break;case 4:i.vertexAttrib4fv(ce.location,ve);break;default:i.vertexAttrib1fv(ce.location,ve)}}}}R()}function F(){B();for(let z in n){let G=n[z];for(let W in G){let Y=G[W];for(let H in Y){let $=Y[H];for(let J in $)u($[J].object),delete $[J];delete Y[H]}}delete n[z]}}function D(z){if(n[z.id]===void 0)return;let G=n[z.id];for(let W in G){let Y=G[W];for(let H in Y){let $=Y[H];for(let J in $)u($[J].object),delete $[J];delete Y[H]}}delete n[z.id]}function L(z){for(let G in n){let W=n[G];for(let Y in W){let H=W[Y];if(H[z.id]===void 0)continue;let $=H[z.id];for(let J in $)u($[J].object),delete $[J];delete H[z.id]}}}function C(z){for(let G in n){let W=n[G],Y=z.isInstancedMesh===!0?z.id:0,H=W[Y];if(H!==void 0){for(let $ in H){let J=H[$];for(let te in J)u(J[te].object),delete J[te];delete H[$]}delete W[Y],Object.keys(W).length===0&&delete n[G]}}}function B(){k(),o=!0,s!==r&&(s=r,c(s.object))}function k(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:B,resetDefaultState:k,dispose:F,releaseStatesOfGeometry:D,releaseStatesOfObject:C,releaseStatesOfProgram:L,initAttributes:w,enableAttribute:S,disableUnusedAttributes:R}}function jve(i,e,t){let n;function r(l){n=l}function s(l,c){i.drawArrays(n,l,c),t.update(c,n,1)}function o(l,c,u){u!==0&&(i.drawArraysInstanced(n,l,c,u),t.update(c,n,u))}function a(l,c,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,c,0,u);let d=0;for(let A=0;A<u;A++)d+=c[A];t.update(d,n,1)}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a}function Xve(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){let L=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(L){return!(L!==Or&&n.convert(L)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(L){let C=L===Wi&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(L!==Ji&&n.convert(L)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&L!==cr&&!C)}function l(L){if(L==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp",u=l(c);u!==c&&(Xe("WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);let f=t.logarithmicDepthBuffer===!0,d=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&d===!1&&Xe("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let A=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),y=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),w=i.getParameter(i.MAX_TEXTURE_SIZE),S=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),T=i.getParameter(i.MAX_VERTEX_ATTRIBS),R=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),I=i.getParameter(i.MAX_VARYING_VECTORS),P=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),F=i.getParameter(i.MAX_SAMPLES),D=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reversedDepthBuffer:d,maxTextures:A,maxVertexTextures:y,maxTextureSize:w,maxCubemapSize:S,maxAttributes:T,maxVertexUniforms:R,maxVaryings:I,maxFragmentUniforms:P,maxSamples:F,samples:D}}function $ve(i){let e=this,t=null,n=0,r=!1,s=!1,o=new Na,a=new Mn,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,d){let A=f.length!==0||d||n!==0||r;return r=d,n=f.length,A},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,d){t=u(f,d,0)},this.setState=function(f,d,A){let y=f.clippingPlanes,w=f.clipIntersection,S=f.clipShadows,T=i.get(f);if(!r||y===null||y.length===0||s&&!S)s?u(null):c();else{let R=s?0:n,I=R*4,P=T.clippingState||null;l.value=P,P=u(y,d,I,A);for(let F=0;F!==I;++F)P[F]=t[F];T.clippingState=P,this.numIntersection=w?this.numPlanes:0,this.numPlanes+=R}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(f,d,A,y){let w=f!==null?f.length:0,S=null;if(w!==0){if(S=l.value,y!==!0||S===null){let T=A+w*4,R=d.matrixWorldInverse;a.getNormalMatrix(R),(S===null||S.length<T)&&(S=new Float32Array(T));for(let I=0,P=A;I!==w;++I,P+=4)o.copy(f[I]).applyMatrix4(R,a),o.normal.toArray(S,P),S[P+3]=o.constant}l.value=S,l.needsUpdate=!0}return e.numPlanes=w,e.numIntersection=0,S}}var H0=4,DZ=[.125,.215,.35,.446,.526,.582],pg=20,Yve=256,kb=new Du,NZ=new zt,TF=null,EF=0,MF=0,CF=!1,Zve=new re,qM=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,s={}){let{size:o=256,position:a=Zve}=s;TF=this._renderer.getRenderTarget(),EF=this._renderer.getActiveCubeFace(),MF=this._renderer.getActiveMipmapLevel(),CF=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,r,l,a),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=OZ(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=BZ(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(TF,EF,MF),this._renderer.xr.enabled=CF,e.scissorTest=!1,d_(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===ec||e.mapping===Gc?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),TF=this._renderer.getRenderTarget(),EF=this._renderer.getActiveCubeFace(),MF=this._renderer.getActiveMipmapLevel(),CF=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Mi,minFilter:Mi,generateMipmaps:!1,type:Wi,format:Or,colorSpace:t0,depthBuffer:!1},r=FZ(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=FZ(e,t,n);let{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Kve(s)),this._blurMaterial=Jve(s,e,t),this._ggxMaterial=Qve(s,e,t)}return r}_compileMaterial(e){let t=new Hn(new Xn,e);this._renderer.compile(t,kb)}_sceneToCubeUV(e,t,n,r,s){let l=new Yr(90,1,t,n),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],f=this._renderer,d=f.autoClear,A=f.toneMapping;f.getClearColor(NZ),f.toneMapping=ao,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Hn(new Lu,new fs({name:"PMREM.Background",side:mi,depthWrite:!1,depthTest:!1})));let w=this._backgroundBox,S=w.material,T=!1,R=e.background;R?R.isColor&&(S.color.copy(R),e.background=null,T=!0):(S.color.copy(NZ),T=!0);for(let I=0;I<6;I++){let P=I%3;P===0?(l.up.set(0,c[I],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[I],s.y,s.z)):P===1?(l.up.set(0,0,c[I]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[I],s.z)):(l.up.set(0,c[I],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[I]));let F=this._cubeSize;d_(r,P*F,I>2?F:0,F,F),f.setRenderTarget(r),T&&f.render(w,l),f.render(e,l)}f.toneMapping=A,f.autoClear=d,e.background=R}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===ec||e.mapping===Gc;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=OZ()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=BZ());let s=r?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=s;let a=s.uniforms;a.envMap.value=e;let l=this._cubeSize;d_(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,kb)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;let l=o.uniforms,c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-u*u),d=0+c*1.25,A=f*d,{_lodMax:y}=this,w=this._sizeLods[n],S=3*w*(n>y-H0?n-y+H0:0),T=4*(this._cubeSize-w);l.envMap.value=e.texture,l.roughness.value=A,l.mipInt.value=y-t,d_(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,kb),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=y-n,d_(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,kb)}_blur(e,t,n,r,s){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,o,a){let l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&ze("blur direction must be either latitudinal or longitudinal!");let u=3,f=this._lodMeshes[r];f.material=c;let d=c.uniforms,A=this._sizeLods[n]-1,y=isFinite(s)?Math.PI/(2*A):2*Math.PI/(2*pg-1),w=s/y,S=isFinite(s)?1+Math.floor(u*w):pg;S>pg&&Xe(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${pg}`);let T=[],R=0;for(let L=0;L<pg;++L){let C=L/w,B=Math.exp(-C*C/2);T.push(B),L===0?R+=B:L<S&&(R+=2*B)}for(let L=0;L<T.length;L++)T[L]=T[L]/R;d.envMap.value=e.texture,d.samples.value=S,d.weights.value=T,d.latitudinal.value=o==="latitudinal",a&&(d.poleAxis.value=a);let{_lodMax:I}=this;d.dTheta.value=y,d.mipInt.value=I-n;let P=this._sizeLods[r],F=3*P*(r>I-H0?r-I+H0:0),D=4*(this._cubeSize-P);d_(t,F,D,3*P,2*P),l.setRenderTarget(t),l.render(f,kb)}};function Kve(i){let e=[],t=[],n=[],r=i,s=i-H0+1+DZ.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-H0?l=DZ[o-i+H0-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),u=-c,f=1+c,d=[u,u,f,u,f,f,u,u,f,f,u,f],A=6,y=6,w=3,S=2,T=1,R=new Float32Array(w*y*A),I=new Float32Array(S*y*A),P=new Float32Array(T*y*A);for(let D=0;D<A;D++){let L=D%3*2/3-1,C=D>2?0:-1,B=[L,C,0,L+2/3,C,0,L+2/3,C+1,0,L,C,0,L+2/3,C+1,0,L,C+1,0];R.set(B,w*y*D),I.set(d,S*y*D);let k=[D,D,D,D,D,D];P.set(k,T*y*D)}let F=new Xn;F.setAttribute("position",new Hi(R,w)),F.setAttribute("uv",new Hi(I,S)),F.setAttribute("faceIndex",new Hi(P,T)),n.push(new Hn(F,null)),r>H0&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function FZ(i,e,t){let n=new Oa(i,e,t);return n.texture.mapping=Bh,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function d_(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function Qve(i,e,t){return new ds({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Yve,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:jM(),fragmentShader:`36813681 36823682 precision highp float;36833683 precision highp int;
@@ -3781,7 +3781,7 @@ void main() {
37813781 37823782 gl_FragColor = vec4(prefilteredColor, 1.0);37833783 }3784- `,blending:ms,depthTest:!1,depthWrite:!1})}function n_e(i,e,t){let n=new Float32Array(mg),r=new re(0,1,0);return new ps({name:"SphericalGaussianBlur",defines:{n:mg,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:KM(),fragmentShader:`3784+ `,blending:ps,depthTest:!1,depthWrite:!1})}function Jve(i,e,t){let n=new Float32Array(pg),r=new re(0,1,0);return new ds({name:"SphericalGaussianBlur",defines:{n:pg,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:jM(),fragmentShader:`37853785 37863786 precision mediump float;37873787 precision mediump int;
@@ -3841,7 +3841,7 @@ void main() {
38413841 }38423842 38433843 }3844- `,blending:ms,depthTest:!1,depthWrite:!1})}function zZ(){return new ps({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:KM(),fragmentShader:`3844+ `,blending:ps,depthTest:!1,depthWrite:!1})}function BZ(){return new ds({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:jM(),fragmentShader:`38453845 38463846 precision mediump float;38473847 precision mediump int;
@@ -3860,7 +3860,7 @@ void main() {
38603860 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );38613861 38623862 }3863- `,blending:ms,depthTest:!1,depthWrite:!1})}function VZ(){return new ps({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:KM(),fragmentShader:`3863+ `,blending:ps,depthTest:!1,depthWrite:!1})}function OZ(){return new ds({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:jM(),fragmentShader:`38643864 38653865 precision mediump float;38663866 precision mediump int;
@@ -3876,7 +3876,7 @@ void main() {
38763876 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );38773877 38783878 }3879- `,blending:ms,depthTest:!1,depthWrite:!1})}function KM(){return`3879+ `,blending:ps,depthTest:!1,depthWrite:!1})}function jM(){return`38803880 38813881 precision mediump float;38823882 precision mediump int;
@@ -3931,7 +3931,7 @@ void main() {
39313931 gl_Position = vec4( position, 1.0 );39323932 39333933 }3934- `}var YM=class extends Oa{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Nh(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`3934+ `}var HM=class extends Oa{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Ph(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`39353935 39363936 varying vec3 vWorldDirection;39373937
@@ -3966,7 +3966,7 @@ void main() {
39663966 gl_FragColor = texture2D( tEquirect, sampleUV );39673967 39683968 }3969- `},r=new Bu(5,5,5),s=new ps({name:"CubemapFromEquirect",uniforms:dg(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:mi,blending:ms});s.uniforms.tEquirect.value=t;let o=new Hn(r,s),a=t.minFilter;return t.minFilter===Go&&(t.minFilter=Mi),new l_(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}};function i_e(i){let e=new WeakMap,t=new WeakMap,n=null;function r(d,A=!1){return d==null?null:A?o(d):s(d)}function s(d){if(d&&d.isTexture){let A=d.mapping;if(A===m0||A===A0)if(e.has(d)){let y=e.get(d).texture;return a(y,d.mapping)}else{let y=d.image;if(y&&y.height>0){let w=new YM(y.height);return w.fromEquirectangularTexture(i,d),e.set(d,w),d.addEventListener("dispose",c),a(w.texture,d.mapping)}else return null}}return d}function o(d){if(d&&d.isTexture){let A=d.mapping,y=A===m0||A===A0,w=A===nc||A===jc;if(y||w){let S=t.get(d),T=S!==void 0?S.texture.pmremVersion:0;if(d.isRenderTargetTexture&&d.pmremVersion!==T)return n===null&&(n=new $M(i)),S=y?n.fromEquirectangular(d,S):n.fromCubemap(d,S),S.texture.pmremVersion=d.pmremVersion,t.set(d,S),S.texture;if(S!==void 0)return S.texture;{let R=d.image;return y&&R&&R.height>0||w&&R&&l(R)?(n===null&&(n=new $M(i)),S=y?n.fromEquirectangular(d):n.fromCubemap(d),S.texture.pmremVersion=d.pmremVersion,t.set(d,S),d.addEventListener("dispose",u),S.texture):null}}}return d}function a(d,A){return A===m0?d.mapping=nc:A===A0&&(d.mapping=jc),d}function l(d){let A=0,y=6;for(let w=0;w<y;w++)d[w]!==void 0&&A++;return A===y}function c(d){let A=d.target;A.removeEventListener("dispose",c);let y=e.get(A);y!==void 0&&(e.delete(A),y.dispose())}function u(d){let A=d.target;A.removeEventListener("dispose",u);let y=t.get(A);y!==void 0&&(t.delete(A),y.dispose())}function f(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:f}}function r_e(i){let e={};function t(n){if(e[n]!==void 0)return e[n];let r=i.getExtension(n);return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){let r=t(n);return r===null&&ni("WebGLRenderer: "+n+" extension not supported."),r}}}function s_e(i,e,t,n){let r={},s=new WeakMap;function o(f){let d=f.target;d.index!==null&&e.remove(d.index);for(let y in d.attributes)e.remove(d.attributes[y]);d.removeEventListener("dispose",o),delete r[d.id];let A=s.get(d);A&&(e.remove(A),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function a(f,d){return r[d.id]===!0||(d.addEventListener("dispose",o),r[d.id]=!0,t.memory.geometries++),d}function l(f){let d=f.attributes;for(let A in d)e.update(d[A],i.ARRAY_BUFFER)}function c(f){let d=[],A=f.index,y=f.attributes.position,w=0;if(y===void 0)return;if(A!==null){let R=A.array;w=A.version;for(let P=0,I=R.length;P<I;P+=3){let F=R[P+0],D=R[P+1],L=R[P+2];d.push(F,D,D,L,L,F)}}else{let R=y.array;w=y.version;for(let P=0,I=R.length/3-1;P<I;P+=3){let F=P+0,D=P+1,L=P+2;d.push(F,D,D,L,L,F)}}let S=new(y.count>=65535?qA:GA)(d,1);S.version=w;let T=s.get(f);T&&e.remove(T),s.set(f,S)}function u(f){let d=s.get(f);if(d){let A=f.index;A!==null&&d.version<A.version&&c(f)}else c(f);return s.get(f)}return{get:a,update:l,getWireframeAttribute:u}}function o_e(i,e,t){let n;function r(f){n=f}let s,o;function a(f){s=f.type,o=f.bytesPerElement}function l(f,d){i.drawElements(n,d,s,f*o),t.update(d,n,1)}function c(f,d,A){A!==0&&(i.drawElementsInstanced(n,d,s,f*o,A),t.update(d,n,A))}function u(f,d,A){if(A===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,d,0,s,f,0,A);let w=0;for(let S=0;S<A;S++)w+=d[S];t.update(w,n,1)}this.setMode=r,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u}function a_e(i){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,a){switch(t.calls++,o){case i.TRIANGLES:t.triangles+=a*(s/3);break;case i.LINES:t.lines+=a*(s/2);break;case i.LINE_STRIP:t.lines+=a*(s-1);break;case i.LINE_LOOP:t.lines+=a*s;break;case i.POINTS:t.points+=a*s;break;default:ze("WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function l_e(i,e,t){let n=new WeakMap,r=new xn;function s(o,a,l){let c=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,f=u!==void 0?u.length:0,d=n.get(a);if(d===void 0||d.count!==f){let B=function(){L.dispose(),n.delete(a),a.removeEventListener("dispose",B)};d!==void 0&&d.texture.dispose();let A=a.morphAttributes.position!==void 0,y=a.morphAttributes.normal!==void 0,w=a.morphAttributes.color!==void 0,S=a.morphAttributes.position||[],T=a.morphAttributes.normal||[],R=a.morphAttributes.color||[],P=0;A===!0&&(P=1),y===!0&&(P=2),w===!0&&(P=3);let I=a.attributes.position.count*P,F=1;I>e.maxTextureSize&&(F=Math.ceil(I/e.maxTextureSize),I=e.maxTextureSize);let D=new Float32Array(I*F*4*f),L=new VA(D,I,F,f);L.type=cr,L.needsUpdate=!0;let C=P*4;for(let k=0;k<f;k++){let z=S[k],G=T[k],W=R[k],Y=I*F*4*k;for(let H=0;H<z.count;H++){let $=H*C;A===!0&&(r.fromBufferAttribute(z,H),D[Y+$+0]=r.x,D[Y+$+1]=r.y,D[Y+$+2]=r.z,D[Y+$+3]=0),y===!0&&(r.fromBufferAttribute(G,H),D[Y+$+4]=r.x,D[Y+$+5]=r.y,D[Y+$+6]=r.z,D[Y+$+7]=0),w===!0&&(r.fromBufferAttribute(W,H),D[Y+$+8]=r.x,D[Y+$+9]=r.y,D[Y+$+10]=r.z,D[Y+$+11]=W.itemSize===4?r.w:1)}}d={count:f,texture:L,size:new Oe(I,F)},n.set(a,d),a.addEventListener("dispose",B)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",o.morphTexture,t);else{let A=0;for(let w=0;w<c.length;w++)A+=c[w];let y=a.morphTargetsRelative?1:1-A;l.getUniforms().setValue(i,"morphTargetBaseInfluence",y),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",d.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",d.size)}return{update:s}}function c_e(i,e,t,n,r){let s=new WeakMap;function o(c){let u=r.render.frame,f=c.geometry,d=e.get(c,f);if(s.get(d)!==u&&(e.update(d),s.set(d,u)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==u&&(t.update(c.instanceMatrix,i.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,i.ARRAY_BUFFER),s.set(c,u))),c.isSkinnedMesh){let A=c.skeleton;s.get(A)!==u&&(A.update(),s.set(A,u))}return d}function a(){s=new WeakMap}function l(c){let u=c.target;u.removeEventListener("dispose",l),n.releaseStatesOfObject(u),t.remove(u.instanceMatrix),u.instanceColor!==null&&t.remove(u.instanceColor)}return{update:o,dispose:a}}var u_e={[Eb]:"LINEAR_TONE_MAPPING",[Mb]:"REINHARD_TONE_MAPPING",[Cb]:"CINEON_TONE_MAPPING",[Rb]:"ACES_FILMIC_TONE_MAPPING",[Ib]:"AGX_TONE_MAPPING",[Pb]:"NEUTRAL_TONE_MAPPING",[$8]:"CUSTOM_TONE_MAPPING"};function h_e(i,e,t,n,r,s){let o=new Oa(e,t,{type:i,depthBuffer:r,stencilBuffer:s,samples:n?4:0,depthTexture:r?new Cs(e,t):void 0}),a=new Oa(e,t,{type:Wi,depthBuffer:!1,stencilBuffer:!1}),l=new Xn;l.setAttribute("position",new Ln([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new Ln([0,2,0,0,2,0],2));let c=new _M({uniforms:{tDiffuse:{value:null}},vertexShader:`3969+ `},r=new Lu(5,5,5),s=new ds({name:"CubemapFromEquirect",uniforms:fg(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:mi,blending:ps});s.uniforms.tEquirect.value=t;let o=new Hn(r,s),a=t.minFilter;return t.minFilter===Go&&(t.minFilter=Mi),new o_(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}};function e_e(i){let e=new WeakMap,t=new WeakMap,n=null;function r(d,A=!1){return d==null?null:A?o(d):s(d)}function s(d){if(d&&d.isTexture){let A=d.mapping;if(A===p0||A===m0)if(e.has(d)){let y=e.get(d).texture;return a(y,d.mapping)}else{let y=d.image;if(y&&y.height>0){let w=new HM(y.height);return w.fromEquirectangularTexture(i,d),e.set(d,w),d.addEventListener("dispose",c),a(w.texture,d.mapping)}else return null}}return d}function o(d){if(d&&d.isTexture){let A=d.mapping,y=A===p0||A===m0,w=A===ec||A===Gc;if(y||w){let S=t.get(d),T=S!==void 0?S.texture.pmremVersion:0;if(d.isRenderTargetTexture&&d.pmremVersion!==T)return n===null&&(n=new qM(i)),S=y?n.fromEquirectangular(d,S):n.fromCubemap(d,S),S.texture.pmremVersion=d.pmremVersion,t.set(d,S),S.texture;if(S!==void 0)return S.texture;{let R=d.image;return y&&R&&R.height>0||w&&R&&l(R)?(n===null&&(n=new qM(i)),S=y?n.fromEquirectangular(d):n.fromCubemap(d),S.texture.pmremVersion=d.pmremVersion,t.set(d,S),d.addEventListener("dispose",u),S.texture):null}}}return d}function a(d,A){return A===p0?d.mapping=ec:A===m0&&(d.mapping=Gc),d}function l(d){let A=0,y=6;for(let w=0;w<y;w++)d[w]!==void 0&&A++;return A===y}function c(d){let A=d.target;A.removeEventListener("dispose",c);let y=e.get(A);y!==void 0&&(e.delete(A),y.dispose())}function u(d){let A=d.target;A.removeEventListener("dispose",u);let y=t.get(A);y!==void 0&&(t.delete(A),y.dispose())}function f(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:f}}function t_e(i){let e={};function t(n){if(e[n]!==void 0)return e[n];let r=i.getExtension(n);return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){let r=t(n);return r===null&&ni("WebGLRenderer: "+n+" extension not supported."),r}}}function n_e(i,e,t,n){let r={},s=new WeakMap;function o(f){let d=f.target;d.index!==null&&e.remove(d.index);for(let y in d.attributes)e.remove(d.attributes[y]);d.removeEventListener("dispose",o),delete r[d.id];let A=s.get(d);A&&(e.remove(A),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function a(f,d){return r[d.id]===!0||(d.addEventListener("dispose",o),r[d.id]=!0,t.memory.geometries++),d}function l(f){let d=f.attributes;for(let A in d)e.update(d[A],i.ARRAY_BUFFER)}function c(f){let d=[],A=f.index,y=f.attributes.position,w=0;if(y===void 0)return;if(A!==null){let R=A.array;w=A.version;for(let I=0,P=R.length;I<P;I+=3){let F=R[I+0],D=R[I+1],L=R[I+2];d.push(F,D,D,L,L,F)}}else{let R=y.array;w=y.version;for(let I=0,P=R.length/3-1;I<P;I+=3){let F=I+0,D=I+1,L=I+2;d.push(F,D,D,L,L,F)}}let S=new(y.count>=65535?GA:VA)(d,1);S.version=w;let T=s.get(f);T&&e.remove(T),s.set(f,S)}function u(f){let d=s.get(f);if(d){let A=f.index;A!==null&&d.version<A.version&&c(f)}else c(f);return s.get(f)}return{get:a,update:l,getWireframeAttribute:u}}function i_e(i,e,t){let n;function r(f){n=f}let s,o;function a(f){s=f.type,o=f.bytesPerElement}function l(f,d){i.drawElements(n,d,s,f*o),t.update(d,n,1)}function c(f,d,A){A!==0&&(i.drawElementsInstanced(n,d,s,f*o,A),t.update(d,n,A))}function u(f,d,A){if(A===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,d,0,s,f,0,A);let w=0;for(let S=0;S<A;S++)w+=d[S];t.update(w,n,1)}this.setMode=r,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u}function r_e(i){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,a){switch(t.calls++,o){case i.TRIANGLES:t.triangles+=a*(s/3);break;case i.LINES:t.lines+=a*(s/2);break;case i.LINE_STRIP:t.lines+=a*(s-1);break;case i.LINE_LOOP:t.lines+=a*s;break;case i.POINTS:t.points+=a*s;break;default:ze("WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function s_e(i,e,t){let n=new WeakMap,r=new xn;function s(o,a,l){let c=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,f=u!==void 0?u.length:0,d=n.get(a);if(d===void 0||d.count!==f){let B=function(){L.dispose(),n.delete(a),a.removeEventListener("dispose",B)};d!==void 0&&d.texture.dispose();let A=a.morphAttributes.position!==void 0,y=a.morphAttributes.normal!==void 0,w=a.morphAttributes.color!==void 0,S=a.morphAttributes.position||[],T=a.morphAttributes.normal||[],R=a.morphAttributes.color||[],I=0;A===!0&&(I=1),y===!0&&(I=2),w===!0&&(I=3);let P=a.attributes.position.count*I,F=1;P>e.maxTextureSize&&(F=Math.ceil(P/e.maxTextureSize),P=e.maxTextureSize);let D=new Float32Array(P*F*4*f),L=new zA(D,P,F,f);L.type=cr,L.needsUpdate=!0;let C=I*4;for(let k=0;k<f;k++){let z=S[k],G=T[k],W=R[k],Y=P*F*4*k;for(let H=0;H<z.count;H++){let $=H*C;A===!0&&(r.fromBufferAttribute(z,H),D[Y+$+0]=r.x,D[Y+$+1]=r.y,D[Y+$+2]=r.z,D[Y+$+3]=0),y===!0&&(r.fromBufferAttribute(G,H),D[Y+$+4]=r.x,D[Y+$+5]=r.y,D[Y+$+6]=r.z,D[Y+$+7]=0),w===!0&&(r.fromBufferAttribute(W,H),D[Y+$+8]=r.x,D[Y+$+9]=r.y,D[Y+$+10]=r.z,D[Y+$+11]=W.itemSize===4?r.w:1)}}d={count:f,texture:L,size:new Oe(P,F)},n.set(a,d),a.addEventListener("dispose",B)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",o.morphTexture,t);else{let A=0;for(let w=0;w<c.length;w++)A+=c[w];let y=a.morphTargetsRelative?1:1-A;l.getUniforms().setValue(i,"morphTargetBaseInfluence",y),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",d.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",d.size)}return{update:s}}function o_e(i,e,t,n,r){let s=new WeakMap;function o(c){let u=r.render.frame,f=c.geometry,d=e.get(c,f);if(s.get(d)!==u&&(e.update(d),s.set(d,u)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==u&&(t.update(c.instanceMatrix,i.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,i.ARRAY_BUFFER),s.set(c,u))),c.isSkinnedMesh){let A=c.skeleton;s.get(A)!==u&&(A.update(),s.set(A,u))}return d}function a(){s=new WeakMap}function l(c){let u=c.target;u.removeEventListener("dispose",l),n.releaseStatesOfObject(u),t.remove(u.instanceMatrix),u.instanceColor!==null&&t.remove(u.instanceColor)}return{update:o,dispose:a}}var a_e={[wb]:"LINEAR_TONE_MAPPING",[Sb]:"REINHARD_TONE_MAPPING",[Tb]:"CINEON_TONE_MAPPING",[Eb]:"ACES_FILMIC_TONE_MAPPING",[Mb]:"AGX_TONE_MAPPING",[Cb]:"NEUTRAL_TONE_MAPPING",[$8]:"CUSTOM_TONE_MAPPING"};function l_e(i,e,t,n,r,s){let o=new Oa(e,t,{type:i,depthBuffer:r,stencilBuffer:s,samples:n?4:0,depthTexture:r?new Es(e,t):void 0}),a=new Oa(e,t,{type:Wi,depthBuffer:!1,stencilBuffer:!1}),l=new Xn;l.setAttribute("position",new Ln([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new Ln([0,2,0,0,2,0],2));let c=new pM({uniforms:{tDiffuse:{value:null}},vertexShader:`39703970 precision highp float;39713971 39723972 uniform mat4 modelViewMatrix;
@@ -4012,17 +4012,17 @@ void main() {
40124012 #ifdef SRGB_TRANSFER40134013 gl_FragColor = sRGBTransferOETF( gl_FragColor );40144014 #endif4015- }`,depthTest:!1,depthWrite:!1}),u=new Hn(l,c),f=new Ou(-1,1,1,-1,0,1),d=null,A=null,y=!1,w,S=null,T=[],R=!1;this.setSize=function(P,I){o.setSize(P,I),a.setSize(P,I);for(let F=0;F<T.length;F++){let D=T[F];D.setSize&&D.setSize(P,I)}},this.setEffects=function(P){T=P,R=T.length>0&&T[0].isRenderPass===!0;let I=o.width,F=o.height;for(let D=0;D<T.length;D++){let L=T[D];L.setSize&&L.setSize(I,F)}},this.begin=function(P,I){if(y||P.toneMapping===ao&&T.length===0)return!1;if(S=I,I!==null){let F=I.width,D=I.height;(o.width!==F||o.height!==D)&&this.setSize(F,D)}return R===!1&&P.setRenderTarget(o),w=P.toneMapping,P.toneMapping=ao,!0},this.hasRenderPass=function(){return R},this.end=function(P,I){P.toneMapping=w,y=!0;let F=o,D=a;for(let L=0;L<T.length;L++){let C=T[L];if(C.enabled!==!1&&(C.render(P,D,F,I),C.needsSwap!==!1)){let B=F;F=D,D=B}}if(d!==P.outputColorSpace||A!==P.toneMapping){d=P.outputColorSpace,A=P.toneMapping,c.defines={},ln.getTransfer(d)===kt&&(c.defines.SRGB_TRANSFER="");let L=u_e[A];L&&(c.defines[L]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=F.texture,P.setRenderTarget(S),P.render(u,f),S=null,y=!1},this.isCompositing=function(){return y},this.dispose=function(){o.depthTexture&&o.depthTexture.dispose(),o.dispose(),a.dispose(),l.dispose(),c.dispose()}}var lK=new Hs,PF=new Cs(1,1),cK=new VA,uK=new hM,hK=new Nh,GZ=[],qZ=[],HZ=new Float32Array(16),WZ=new Float32Array(9),jZ=new Float32Array(4);function g_(i,e,t){let n=i[0];if(n<=0||n>0)return i;let r=e*t,s=GZ[r];if(s===void 0&&(s=new Float32Array(r),GZ[r]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(s,a)}return s}function lo(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function co(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function QM(i,e){let t=qZ[e];t===void 0&&(t=new Int32Array(e),qZ[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function f_e(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function d_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lo(t,e))return;i.uniform2fv(this.addr,e),co(t,e)}}function p_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(lo(t,e))return;i.uniform3fv(this.addr,e),co(t,e)}}function m_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lo(t,e))return;i.uniform4fv(this.addr,e),co(t,e)}}function A_e(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(lo(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),co(t,e)}else{if(lo(t,n))return;jZ.set(n),i.uniformMatrix2fv(this.addr,!1,jZ),co(t,n)}}function g_e(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(lo(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),co(t,e)}else{if(lo(t,n))return;WZ.set(n),i.uniformMatrix3fv(this.addr,!1,WZ),co(t,n)}}function v_e(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(lo(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),co(t,e)}else{if(lo(t,n))return;HZ.set(n),i.uniformMatrix4fv(this.addr,!1,HZ),co(t,n)}}function __e(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function x_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lo(t,e))return;i.uniform2iv(this.addr,e),co(t,e)}}function y_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(lo(t,e))return;i.uniform3iv(this.addr,e),co(t,e)}}function b_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lo(t,e))return;i.uniform4iv(this.addr,e),co(t,e)}}function w_e(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function S_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lo(t,e))return;i.uniform2uiv(this.addr,e),co(t,e)}}function T_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(lo(t,e))return;i.uniform3uiv(this.addr,e),co(t,e)}}function E_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lo(t,e))return;i.uniform4uiv(this.addr,e),co(t,e)}}function M_e(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(PF.compareFunction=t.isReversedDepthBuffer()?ku:Kh,s=PF):s=lK,t.setTexture2D(e||s,r)}function C_e(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||uK,r)}function R_e(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||hK,r)}function I_e(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||cK,r)}function P_e(i){switch(i){case 5126:return f_e;case 35664:return d_e;case 35665:return p_e;case 35666:return m_e;case 35674:return A_e;case 35675:return g_e;case 35676:return v_e;case 5124:case 35670:return __e;case 35667:case 35671:return x_e;case 35668:case 35672:return y_e;case 35669:case 35673:return b_e;case 5125:return w_e;case 36294:return S_e;case 36295:return T_e;case 36296:return E_e;case 35678:case 36198:case 36298:case 36306:case 35682:return M_e;case 35679:case 36299:case 36307:return C_e;case 35680:case 36300:case 36308:case 36293:return R_e;case 36289:case 36303:case 36311:case 36292:return I_e}}function L_e(i,e){i.uniform1fv(this.addr,e)}function D_e(i,e){let t=g_(e,this.size,2);i.uniform2fv(this.addr,t)}function N_e(i,e){let t=g_(e,this.size,3);i.uniform3fv(this.addr,t)}function F_e(i,e){let t=g_(e,this.size,4);i.uniform4fv(this.addr,t)}function B_e(i,e){let t=g_(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function O_e(i,e){let t=g_(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function U_e(i,e){let t=g_(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function k_e(i,e){i.uniform1iv(this.addr,e)}function z_e(i,e){i.uniform2iv(this.addr,e)}function V_e(i,e){i.uniform3iv(this.addr,e)}function G_e(i,e){i.uniform4iv(this.addr,e)}function q_e(i,e){i.uniform1uiv(this.addr,e)}function H_e(i,e){i.uniform2uiv(this.addr,e)}function W_e(i,e){i.uniform3uiv(this.addr,e)}function j_e(i,e){i.uniform4uiv(this.addr,e)}function X_e(i,e,t){let n=this.cache,r=e.length,s=QM(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));let o;this.type===i.SAMPLER_2D_SHADOW?o=PF:o=lK;for(let a=0;a!==r;++a)t.setTexture2D(e[a]||o,s[a])}function $_e(i,e,t){let n=this.cache,r=e.length,s=QM(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||uK,s[o])}function Y_e(i,e,t){let n=this.cache,r=e.length,s=QM(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||hK,s[o])}function Z_e(i,e,t){let n=this.cache,r=e.length,s=QM(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||cK,s[o])}function K_e(i){switch(i){case 5126:return L_e;case 35664:return D_e;case 35665:return N_e;case 35666:return F_e;case 35674:return B_e;case 35675:return O_e;case 35676:return U_e;case 5124:case 35670:return k_e;case 35667:case 35671:return z_e;case 35668:case 35672:return V_e;case 35669:case 35673:return G_e;case 5125:return q_e;case 36294:return H_e;case 36295:return W_e;case 36296:return j_e;case 35678:case 36198:case 36298:case 36306:case 35682:return X_e;case 35679:case 36299:case 36307:return $_e;case 35680:case 36300:case 36308:case 36293:return Y_e;case 36289:case 36303:case 36311:case 36292:return Z_e}}var LF=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=P_e(t.type)}},DF=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=K_e(t.type)}},NF=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let r=this.seq;for(let s=0,o=r.length;s!==o;++s){let a=r[s];a.setValue(e,t[a.id],n)}}},RF=/(\w+)(\])?(\[|\.)?/g;function XZ(i,e){i.seq.push(e),i.map[e.id]=e}function Q_e(i,e,t){let n=i.name,r=n.length;for(RF.lastIndex=0;;){let s=RF.exec(n),o=RF.lastIndex,a=s[1],l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){XZ(t,c===void 0?new LF(a,i,e):new DF(a,i,e));break}else{let f=t.map[a];f===void 0&&(f=new NF(a),XZ(t,f)),t=f}}}var A_=class{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let o=0;o<n;++o){let a=e.getActiveUniform(t,o),l=e.getUniformLocation(t,a.name);Q_e(a,l,this)}let r=[],s=[];for(let o of this.seq)o.type===e.SAMPLER_2D_SHADOW||o.type===e.SAMPLER_CUBE_SHADOW||o.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(o):s.push(o);r.length>0&&(this.seq=r.concat(s))}setValue(e,t,n,r){let s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){let r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,o=t.length;s!==o;++s){let a=t[s],l=n[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,t){let n=[];for(let r=0,s=e.length;r!==s;++r){let o=e[r];o.id in t&&n.push(o)}return n}};function $Z(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var J_e=37297,exe=0;function txe(i,e){let t=i.split(`4015+ }`,depthTest:!1,depthWrite:!1}),u=new Hn(l,c),f=new Du(-1,1,1,-1,0,1),d=null,A=null,y=!1,w,S=null,T=[],R=!1;this.setSize=function(I,P){o.setSize(I,P),a.setSize(I,P);for(let F=0;F<T.length;F++){let D=T[F];D.setSize&&D.setSize(I,P)}},this.setEffects=function(I){T=I,R=T.length>0&&T[0].isRenderPass===!0;let P=o.width,F=o.height;for(let D=0;D<T.length;D++){let L=T[D];L.setSize&&L.setSize(P,F)}},this.begin=function(I,P){if(y||I.toneMapping===ao&&T.length===0)return!1;if(S=P,P!==null){let F=P.width,D=P.height;(o.width!==F||o.height!==D)&&this.setSize(F,D)}return R===!1&&I.setRenderTarget(o),w=I.toneMapping,I.toneMapping=ao,!0},this.hasRenderPass=function(){return R},this.end=function(I,P){I.toneMapping=w,y=!0;let F=o,D=a;for(let L=0;L<T.length;L++){let C=T[L];if(C.enabled!==!1&&(C.render(I,D,F,P),C.needsSwap!==!1)){let B=F;F=D,D=B}}if(d!==I.outputColorSpace||A!==I.toneMapping){d=I.outputColorSpace,A=I.toneMapping,c.defines={},ln.getTransfer(d)===kt&&(c.defines.SRGB_TRANSFER="");let L=a_e[A];L&&(c.defines[L]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=F.texture,I.setRenderTarget(S),I.render(u,f),S=null,y=!1},this.isCompositing=function(){return y},this.dispose=function(){o.depthTexture&&o.depthTexture.dispose(),o.dispose(),a.dispose(),l.dispose(),c.dispose()}}var rK=new qs,IF=new Es(1,1),sK=new zA,oK=new oM,aK=new Ph,UZ=[],kZ=[],zZ=new Float32Array(16),VZ=new Float32Array(9),GZ=new Float32Array(4);function m_(i,e,t){let n=i[0];if(n<=0||n>0)return i;let r=e*t,s=UZ[r];if(s===void 0&&(s=new Float32Array(r),UZ[r]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(s,a)}return s}function lo(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function co(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function XM(i,e){let t=kZ[e];t===void 0&&(t=new Int32Array(e),kZ[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function c_e(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function u_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lo(t,e))return;i.uniform2fv(this.addr,e),co(t,e)}}function h_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(lo(t,e))return;i.uniform3fv(this.addr,e),co(t,e)}}function f_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lo(t,e))return;i.uniform4fv(this.addr,e),co(t,e)}}function d_e(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(lo(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),co(t,e)}else{if(lo(t,n))return;GZ.set(n),i.uniformMatrix2fv(this.addr,!1,GZ),co(t,n)}}function p_e(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(lo(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),co(t,e)}else{if(lo(t,n))return;VZ.set(n),i.uniformMatrix3fv(this.addr,!1,VZ),co(t,n)}}function m_e(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(lo(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),co(t,e)}else{if(lo(t,n))return;zZ.set(n),i.uniformMatrix4fv(this.addr,!1,zZ),co(t,n)}}function A_e(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function g_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lo(t,e))return;i.uniform2iv(this.addr,e),co(t,e)}}function v_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(lo(t,e))return;i.uniform3iv(this.addr,e),co(t,e)}}function __e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lo(t,e))return;i.uniform4iv(this.addr,e),co(t,e)}}function x_e(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function y_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lo(t,e))return;i.uniform2uiv(this.addr,e),co(t,e)}}function b_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(lo(t,e))return;i.uniform3uiv(this.addr,e),co(t,e)}}function w_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lo(t,e))return;i.uniform4uiv(this.addr,e),co(t,e)}}function S_e(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(IF.compareFunction=t.isReversedDepthBuffer()?Fu:Xh,s=IF):s=rK,t.setTexture2D(e||s,r)}function T_e(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||oK,r)}function E_e(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||aK,r)}function M_e(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||sK,r)}function C_e(i){switch(i){case 5126:return c_e;case 35664:return u_e;case 35665:return h_e;case 35666:return f_e;case 35674:return d_e;case 35675:return p_e;case 35676:return m_e;case 5124:case 35670:return A_e;case 35667:case 35671:return g_e;case 35668:case 35672:return v_e;case 35669:case 35673:return __e;case 5125:return x_e;case 36294:return y_e;case 36295:return b_e;case 36296:return w_e;case 35678:case 36198:case 36298:case 36306:case 35682:return S_e;case 35679:case 36299:case 36307:return T_e;case 35680:case 36300:case 36308:case 36293:return E_e;case 36289:case 36303:case 36311:case 36292:return M_e}}function R_e(i,e){i.uniform1fv(this.addr,e)}function P_e(i,e){let t=m_(e,this.size,2);i.uniform2fv(this.addr,t)}function I_e(i,e){let t=m_(e,this.size,3);i.uniform3fv(this.addr,t)}function L_e(i,e){let t=m_(e,this.size,4);i.uniform4fv(this.addr,t)}function D_e(i,e){let t=m_(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function N_e(i,e){let t=m_(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function F_e(i,e){let t=m_(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function B_e(i,e){i.uniform1iv(this.addr,e)}function O_e(i,e){i.uniform2iv(this.addr,e)}function U_e(i,e){i.uniform3iv(this.addr,e)}function k_e(i,e){i.uniform4iv(this.addr,e)}function z_e(i,e){i.uniform1uiv(this.addr,e)}function V_e(i,e){i.uniform2uiv(this.addr,e)}function G_e(i,e){i.uniform3uiv(this.addr,e)}function q_e(i,e){i.uniform4uiv(this.addr,e)}function H_e(i,e,t){let n=this.cache,r=e.length,s=XM(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));let o;this.type===i.SAMPLER_2D_SHADOW?o=IF:o=rK;for(let a=0;a!==r;++a)t.setTexture2D(e[a]||o,s[a])}function W_e(i,e,t){let n=this.cache,r=e.length,s=XM(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||oK,s[o])}function j_e(i,e,t){let n=this.cache,r=e.length,s=XM(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||aK,s[o])}function X_e(i,e,t){let n=this.cache,r=e.length,s=XM(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||sK,s[o])}function $_e(i){switch(i){case 5126:return R_e;case 35664:return P_e;case 35665:return I_e;case 35666:return L_e;case 35674:return D_e;case 35675:return N_e;case 35676:return F_e;case 5124:case 35670:return B_e;case 35667:case 35671:return O_e;case 35668:case 35672:return U_e;case 35669:case 35673:return k_e;case 5125:return z_e;case 36294:return V_e;case 36295:return G_e;case 36296:return q_e;case 35678:case 36198:case 36298:case 36306:case 35682:return H_e;case 35679:case 36299:case 36307:return W_e;case 35680:case 36300:case 36308:case 36293:return j_e;case 36289:case 36303:case 36311:case 36292:return X_e}}var LF=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=C_e(t.type)}},DF=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=$_e(t.type)}},NF=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let r=this.seq;for(let s=0,o=r.length;s!==o;++s){let a=r[s];a.setValue(e,t[a.id],n)}}},RF=/(\w+)(\])?(\[|\.)?/g;function qZ(i,e){i.seq.push(e),i.map[e.id]=e}function Y_e(i,e,t){let n=i.name,r=n.length;for(RF.lastIndex=0;;){let s=RF.exec(n),o=RF.lastIndex,a=s[1],l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){qZ(t,c===void 0?new LF(a,i,e):new DF(a,i,e));break}else{let f=t.map[a];f===void 0&&(f=new NF(a),qZ(t,f)),t=f}}}var p_=class{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let o=0;o<n;++o){let a=e.getActiveUniform(t,o),l=e.getUniformLocation(t,a.name);Y_e(a,l,this)}let r=[],s=[];for(let o of this.seq)o.type===e.SAMPLER_2D_SHADOW||o.type===e.SAMPLER_CUBE_SHADOW||o.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(o):s.push(o);r.length>0&&(this.seq=r.concat(s))}setValue(e,t,n,r){let s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){let r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,o=t.length;s!==o;++s){let a=t[s],l=n[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,t){let n=[];for(let r=0,s=e.length;r!==s;++r){let o=e[r];o.id in t&&n.push(o)}return n}};function HZ(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var Z_e=37297,K_e=0;function Q_e(i,e){let t=i.split(`40164016 `),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=r;o<s;o++){let a=o+1;n.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return n.join(`4017-`)}var YZ=new Mn;function nxe(i){ln._getMatrix(YZ,ln.workingColorSpace,i);let e=`mat3( ${YZ.elements.map(t=>t.toFixed(4))} )`;switch(ln.getTransfer(i)){case i0:return[e,"LinearTransferOETF"];case kt:return[e,"sRGBTransferOETF"];default:return Xe("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function ZZ(i,e,t){let n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";let o=/ERROR: 0:(\d+)/.exec(s);if(o){let a=parseInt(o[1]);return t.toUpperCase()+`4017+`)}var WZ=new Mn;function J_e(i){ln._getMatrix(WZ,ln.workingColorSpace,i);let e=`mat3( ${WZ.elements.map(t=>t.toFixed(4))} )`;switch(ln.getTransfer(i)){case n0:return[e,"LinearTransferOETF"];case kt:return[e,"sRGBTransferOETF"];default:return Xe("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function jZ(i,e,t){let n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";let o=/ERROR: 0:(\d+)/.exec(s);if(o){let a=parseInt(o[1]);return t.toUpperCase()+`40184018 40194019 `+s+`40204020 4021-`+txe(i.getShaderSource(e),a)}else return s}function ixe(i,e){let t=nxe(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`4022-`)}var rxe={[Eb]:"Linear",[Mb]:"Reinhard",[Cb]:"Cineon",[Rb]:"ACESFilmic",[Ib]:"AgX",[Pb]:"Neutral",[$8]:"Custom"};function sxe(i,e){let t=rxe[e];return t===void 0?(Xe("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}var XM=new re;function oxe(){ln.getLuminanceCoefficients(XM);let i=XM.x.toFixed(4),e=XM.y.toFixed(4),t=XM.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`4023-`)}function axe(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Hb).join(`4024-`)}function lxe(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`4025-`)}function cxe(i,e){let t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){let s=i.getActiveAttrib(e,r),o=s.name,a=1;s.type===i.FLOAT_MAT2&&(a=2),s.type===i.FLOAT_MAT3&&(a=3),s.type===i.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:i.getAttribLocation(e,o),locationSize:a}}return t}function Hb(i){return i!==""}function KZ(i,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function QZ(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var uxe=/^[ \t]*#include +<([\w\d./]+)>/gm;function FF(i){return i.replace(uxe,fxe)}var hxe=new Map;function fxe(i,e){let t=kn[e];if(t===void 0){let n=hxe.get(e);if(n!==void 0)t=kn[n],Xe('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return FF(t)}var dxe=/#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 JZ(i){return i.replace(dxe,pxe)}function pxe(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function eK(i){let e=`precision ${i.precision} float;4021+`+Q_e(i.getShaderSource(e),a)}else return s}function exe(i,e){let t=J_e(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`4022+`)}var txe={[wb]:"Linear",[Sb]:"Reinhard",[Tb]:"Cineon",[Eb]:"ACESFilmic",[Mb]:"AgX",[Cb]:"Neutral",[$8]:"Custom"};function nxe(i,e){let t=txe[e];return t===void 0?(Xe("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}var GM=new re;function ixe(){ln.getLuminanceCoefficients(GM);let i=GM.x.toFixed(4),e=GM.y.toFixed(4),t=GM.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`4023+`)}function rxe(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Vb).join(`4024+`)}function sxe(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`4025+`)}function oxe(i,e){let t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){let s=i.getActiveAttrib(e,r),o=s.name,a=1;s.type===i.FLOAT_MAT2&&(a=2),s.type===i.FLOAT_MAT3&&(a=3),s.type===i.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:i.getAttribLocation(e,o),locationSize:a}}return t}function Vb(i){return i!==""}function XZ(i,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function $Z(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var axe=/^[ \t]*#include +<([\w\d./]+)>/gm;function FF(i){return i.replace(axe,cxe)}var lxe=new Map;function cxe(i,e){let t=kn[e];if(t===void 0){let n=lxe.get(e);if(n!==void 0)t=kn[n],Xe('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return FF(t)}var uxe=/#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 YZ(i){return i.replace(uxe,hxe)}function hxe(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function ZZ(i){let e=`precision ${i.precision} float;40264026 precision ${i.precision} int;40274027 precision ${i.precision} sampler2D;40284028 precision ${i.precision} samplerCube;
@@ -4042,30 +4042,30 @@ void main() {
40424042 `;return i.precision==="highp"?e+=`40434043 #define HIGH_PRECISION`:i.precision==="mediump"?e+=`40444044 #define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=`4045-#define LOW_PRECISION`),e}var mxe={[p0]:"SHADOWMAP_TYPE_PCF",[Wc]:"SHADOWMAP_TYPE_VSM"};function Axe(i){return mxe[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var gxe={[nc]:"ENVMAP_TYPE_CUBE",[jc]:"ENVMAP_TYPE_CUBE",[zh]:"ENVMAP_TYPE_CUBE_UV"};function vxe(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":gxe[i.envMapMode]||"ENVMAP_TYPE_CUBE"}var _xe={[jc]:"ENVMAP_MODE_REFRACTION"};function xxe(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":_xe[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var yxe={[ng]:"ENVMAP_BLENDING_MULTIPLY",[zM]:"ENVMAP_BLENDING_MIX",[VM]:"ENVMAP_BLENDING_ADD"};function bxe(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":yxe[i.combine]||"ENVMAP_BLENDING_NONE"}function wxe(i){let e=i.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function Sxe(i,e,t,n){let r=i.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,l=Axe(t),c=vxe(t),u=xxe(t),f=bxe(t),d=wxe(t),A=axe(t),y=lxe(s),w=r.createProgram(),S,T,R=t.glslVersion?"#version "+t.glslVersion+`4046-`:"";t.isRawShaderMaterial?(S=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(Hb).join(`4045+#define LOW_PRECISION`),e}var fxe={[d0]:"SHADOWMAP_TYPE_PCF",[Vc]:"SHADOWMAP_TYPE_VSM"};function dxe(i){return fxe[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var pxe={[ec]:"ENVMAP_TYPE_CUBE",[Gc]:"ENVMAP_TYPE_CUBE",[Bh]:"ENVMAP_TYPE_CUBE_UV"};function mxe(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":pxe[i.envMapMode]||"ENVMAP_TYPE_CUBE"}var Axe={[Gc]:"ENVMAP_MODE_REFRACTION"};function gxe(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":Axe[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var vxe={[tg]:"ENVMAP_BLENDING_MULTIPLY",[FM]:"ENVMAP_BLENDING_MIX",[BM]:"ENVMAP_BLENDING_ADD"};function _xe(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":vxe[i.combine]||"ENVMAP_BLENDING_NONE"}function xxe(i){let e=i.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function yxe(i,e,t,n){let r=i.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,l=dxe(t),c=mxe(t),u=gxe(t),f=_xe(t),d=xxe(t),A=rxe(t),y=sxe(s),w=r.createProgram(),S,T,R=t.glslVersion?"#version "+t.glslVersion+`4046+`:"";t.isRawShaderMaterial?(S=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(Vb).join(`40474047 `),S.length>0&&(S+=`4048-`),T=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(Hb).join(`4048+`),T=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(Vb).join(`40494049 `),T.length>0&&(T+=`4050-`)):(S=[eK(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+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.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`4051-`].filter(Hb).join(`4052-`),T=[eK(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+f:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==ao?"#define TONE_MAPPING":"",t.toneMapping!==ao?kn.tonemapping_pars_fragment:"",t.toneMapping!==ao?sxe("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",kn.colorspace_pars_fragment,ixe("linearToOutputTexel",t.outputColorSpace),oxe(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`4053-`].filter(Hb).join(`4054-`)),o=FF(o),o=KZ(o,t),o=QZ(o,t),a=FF(a),a=KZ(a,t),a=QZ(a,t),o=JZ(o),a=JZ(a),t.isRawShaderMaterial!==!0&&(R=`#version 300 es4050+`)):(S=[ZZ(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+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.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`4051+`].filter(Vb).join(`4052+`),T=[ZZ(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+f:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==ao?"#define TONE_MAPPING":"",t.toneMapping!==ao?kn.tonemapping_pars_fragment:"",t.toneMapping!==ao?nxe("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",kn.colorspace_pars_fragment,exe("linearToOutputTexel",t.outputColorSpace),ixe(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`4053+`].filter(Vb).join(`4054+`)),o=FF(o),o=XZ(o,t),o=$Z(o,t),a=FF(a),a=XZ(a,t),a=$Z(a,t),o=YZ(o),a=YZ(a),t.isRawShaderMaterial!==!0&&(R=`#version 300 es40554055 `,S=[A,"#define attribute in","#define varying out","#define texture2D texture"].join(`40564056 `)+`40574057 `+S,T=["#define varying in",t.glslVersion===dF?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===dF?"":"#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(`40584058 `)+`4059-`+T);let P=R+S+o,I=R+T+a,F=$Z(r,r.VERTEX_SHADER,P),D=$Z(r,r.FRAGMENT_SHADER,I);r.attachShader(w,F),r.attachShader(w,D),t.index0AttributeName!==void 0?r.bindAttribLocation(w,0,t.index0AttributeName):t.hasPositionAttribute===!0&&r.bindAttribLocation(w,0,"position"),r.linkProgram(w);function L(z){if(i.debug.checkShaderErrors){let G=r.getProgramInfoLog(w)||"",W=r.getShaderInfoLog(F)||"",Y=r.getShaderInfoLog(D)||"",H=G.trim(),$=W.trim(),J=Y.trim(),te=!0,ce=!0;if(r.getProgramParameter(w,r.LINK_STATUS)===!1)if(te=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,w,F,D);else{let he=ZZ(r,F,"vertex"),ve=ZZ(r,D,"fragment");ze("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(w,r.VALIDATE_STATUS)+`4059+`+T);let I=R+S+o,P=R+T+a,F=HZ(r,r.VERTEX_SHADER,I),D=HZ(r,r.FRAGMENT_SHADER,P);r.attachShader(w,F),r.attachShader(w,D),t.index0AttributeName!==void 0?r.bindAttribLocation(w,0,t.index0AttributeName):t.hasPositionAttribute===!0&&r.bindAttribLocation(w,0,"position"),r.linkProgram(w);function L(z){if(i.debug.checkShaderErrors){let G=r.getProgramInfoLog(w)||"",W=r.getShaderInfoLog(F)||"",Y=r.getShaderInfoLog(D)||"",H=G.trim(),$=W.trim(),J=Y.trim(),te=!0,ce=!0;if(r.getProgramParameter(w,r.LINK_STATUS)===!1)if(te=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,w,F,D);else{let he=jZ(r,F,"vertex"),ve=jZ(r,D,"fragment");ze("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(w,r.VALIDATE_STATUS)+`40604060 40614061 Material Name: `+z.name+`40624062 Material Type: `+z.type+`40634063 40644064 Program Info Log: `+H+`40654065 `+he+`4066-`+ve)}else H!==""?Xe("WebGLProgram: Program Info Log:",H):($===""||J==="")&&(ce=!1);ce&&(z.diagnostics={runnable:te,programLog:H,vertexShader:{log:$,prefix:S},fragmentShader:{log:J,prefix:T}})}r.deleteShader(F),r.deleteShader(D),C=new A_(r,w),B=cxe(r,w)}let C;this.getUniforms=function(){return C===void 0&&L(this),C};let B;this.getAttributes=function(){return B===void 0&&L(this),B};let k=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=r.getProgramParameter(w,J_e)),k},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(w),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=exe++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=F,this.fragmentShader=D,this}var Txe=0,BF=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new OF(e),t.set(e,n)),n}},OF=class{constructor(e){this.id=Txe++,this.code=e,this.usedTimes=0}};function Exe(i){return i===js||i===Yh||i===Zh}function Mxe(i,e,t,n,r,s){let o=new Jv,a=new BF,l=new Set,c=[],u=new Map,f=n.logarithmicDepthBuffer,d=n.precision,A={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function y(C){return l.add(C),C===0?"uv":`uv${C}`}function w(C,B,k,z,G,W){let Y=z.fog,H=G.geometry,$=C.isMeshStandardMaterial||C.isMeshLambertMaterial||C.isMeshPhongMaterial?z.environment:null,J=C.isMeshStandardMaterial||C.isMeshLambertMaterial&&!C.envMap||C.isMeshPhongMaterial&&!C.envMap,te=e.get(C.envMap||$,J),ce=te&&te.mapping===zh?te.image.height:null,he=A[C.type];C.precision!==null&&(d=n.getMaxPrecision(C.precision),d!==C.precision&&Xe("WebGLProgram.getParameters:",C.precision,"not supported, using",d,"instead."));let ve=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,Re=ve!==void 0?ve.length:0,Qe=0;H.morphAttributes.position!==void 0&&(Qe=1),H.morphAttributes.normal!==void 0&&(Qe=2),H.morphAttributes.color!==void 0&&(Qe=3);let Fe,mt,Ee,Ve;if(he){let Yt=Ha[he];Fe=Yt.vertexShader,mt=Yt.fragmentShader}else{Fe=C.vertexShader,mt=C.fragmentShader;let Yt=a.getVertexShaderStage(C),nr=a.getFragmentShaderStage(C);a.update(C,Yt,nr),Ee=Yt.id,Ve=nr.id}let Ye=i.getRenderTarget(),Mt=i.state.buffers.depth.getReversed(),Et=G.isInstancedMesh===!0,It=G.isBatchedMesh===!0,dn=!!C.map,Gt=!!C.matcap,$e=!!te,ot=!!C.aoMap,nt=!!C.lightMap,bt=!!C.bumpMap&&C.wireframe===!1,yt=!!C.normalMap,hn=!!C.displacementMap,en=!!C.emissiveMap,tn=!!C.metalnessMap,bn=!!C.roughnessMap,_e=C.anisotropy>0,vi=C.clearcoat>0,zn=C.dispersion>0,le=C.iridescence>0,Z=C.sheen>0,Te=C.transmission>0,Pe=_e&&!!C.anisotropyMap,Ge=vi&&!!C.clearcoatMap,vt=vi&&!!C.clearcoatNormalMap,Tt=vi&&!!C.clearcoatRoughnessMap,qe=le&&!!C.iridescenceMap,Je=le&&!!C.iridescenceThicknessMap,Pt=Z&&!!C.sheenColorMap,rn=Z&&!!C.sheenRoughnessMap,Lt=!!C.specularMap,Rt=!!C.specularColorMap,fn=!!C.specularIntensityMap,wn=Te&&!!C.transmissionMap,Dn=Te&&!!C.thicknessMap,ye=!!C.gradientMap,wt=!!C.alphaMap,Ze=C.alphaTest>0,St=!!C.alphaHash,Bt=!!C.extensions,ut=ao;C.toneMapped&&(Ye===null||Ye.isXRRenderTarget===!0)&&(ut=i.toneMapping);let Ce={shaderID:he,shaderType:C.type,shaderName:C.name,vertexShader:Fe,fragmentShader:mt,defines:C.defines,customVertexShaderID:Ee,customFragmentShaderID:Ve,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:d,batching:It,batchingColor:It&&G._colorsTexture!==null,instancing:Et,instancingColor:Et&&G.instanceColor!==null,instancingMorph:Et&&G.morphTexture!==null,outputColorSpace:Ye===null?i.outputColorSpace:Ye.isXRRenderTarget===!0?Ye.texture.colorSpace:ln.workingColorSpace,alphaToCoverage:!!C.alphaToCoverage,map:dn,matcap:Gt,envMap:$e,envMapMode:$e&&te.mapping,envMapCubeUVHeight:ce,aoMap:ot,lightMap:nt,bumpMap:bt,normalMap:yt,displacementMap:hn,emissiveMap:en,normalMapObjectSpace:yt&&C.normalMapType===qM,normalMapTangentSpace:yt&&C.normalMapType===ic,packedNormalMap:yt&&C.normalMapType===ic&&Exe(C.normalMap.format),metalnessMap:tn,roughnessMap:bn,anisotropy:_e,anisotropyMap:Pe,clearcoat:vi,clearcoatMap:Ge,clearcoatNormalMap:vt,clearcoatRoughnessMap:Tt,dispersion:zn,iridescence:le,iridescenceMap:qe,iridescenceThicknessMap:Je,sheen:Z,sheenColorMap:Pt,sheenRoughnessMap:rn,specularMap:Lt,specularColorMap:Rt,specularIntensityMap:fn,transmission:Te,transmissionMap:wn,thicknessMap:Dn,gradientMap:ye,opaque:C.transparent===!1&&C.blending===Ms&&C.alphaToCoverage===!1,alphaMap:wt,alphaTest:Ze,alphaHash:St,combine:C.combine,mapUv:dn&&y(C.map.channel),aoMapUv:ot&&y(C.aoMap.channel),lightMapUv:nt&&y(C.lightMap.channel),bumpMapUv:bt&&y(C.bumpMap.channel),normalMapUv:yt&&y(C.normalMap.channel),displacementMapUv:hn&&y(C.displacementMap.channel),emissiveMapUv:en&&y(C.emissiveMap.channel),metalnessMapUv:tn&&y(C.metalnessMap.channel),roughnessMapUv:bn&&y(C.roughnessMap.channel),anisotropyMapUv:Pe&&y(C.anisotropyMap.channel),clearcoatMapUv:Ge&&y(C.clearcoatMap.channel),clearcoatNormalMapUv:vt&&y(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Tt&&y(C.clearcoatRoughnessMap.channel),iridescenceMapUv:qe&&y(C.iridescenceMap.channel),iridescenceThicknessMapUv:Je&&y(C.iridescenceThicknessMap.channel),sheenColorMapUv:Pt&&y(C.sheenColorMap.channel),sheenRoughnessMapUv:rn&&y(C.sheenRoughnessMap.channel),specularMapUv:Lt&&y(C.specularMap.channel),specularColorMapUv:Rt&&y(C.specularColorMap.channel),specularIntensityMapUv:fn&&y(C.specularIntensityMap.channel),transmissionMapUv:wn&&y(C.transmissionMap.channel),thicknessMapUv:Dn&&y(C.thicknessMap.channel),alphaMapUv:wt&&y(C.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(yt||_e),vertexNormals:!!H.attributes.normal,vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,pointsUvs:G.isPoints===!0&&!!H.attributes.uv&&(dn||wt),fog:!!Y,useFog:C.fog===!0,fogExp2:!!Y&&Y.isFogExp2,flatShading:C.wireframe===!1&&(C.flatShading===!0||H.attributes.normal===void 0&&yt===!1&&(C.isMeshLambertMaterial||C.isMeshPhongMaterial||C.isMeshStandardMaterial||C.isMeshPhysicalMaterial)),sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:Mt,skinning:G.isSkinnedMesh===!0,hasPositionAttribute:H.attributes.position!==void 0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:Re,morphTextureStride:Qe,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,numLightProbes:B.numLightProbes,numLightProbeGrids:W.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:C.dithering,shadowMapEnabled:i.shadowMap.enabled&&k.length>0,shadowMapType:i.shadowMap.type,toneMapping:ut,decodeVideoTexture:dn&&C.map.isVideoTexture===!0&&ln.getTransfer(C.map.colorSpace)===kt,decodeVideoTextureEmissive:en&&C.emissiveMap.isVideoTexture===!0&&ln.getTransfer(C.emissiveMap.colorSpace)===kt,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===vr,flipSided:C.side===mi,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionClipCullDistance:Bt&&C.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Bt&&C.extensions.multiDraw===!0||It)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()};return Ce.vertexUv1s=l.has(1),Ce.vertexUv2s=l.has(2),Ce.vertexUv3s=l.has(3),l.clear(),Ce}function S(C){let B=[];if(C.shaderID?B.push(C.shaderID):(B.push(C.customVertexShaderID),B.push(C.customFragmentShaderID)),C.defines!==void 0)for(let k in C.defines)B.push(k),B.push(C.defines[k]);return C.isRawShaderMaterial===!1&&(T(B,C),R(B,C),B.push(i.outputColorSpace)),B.push(C.customProgramCacheKey),B.join()}function T(C,B){C.push(B.precision),C.push(B.outputColorSpace),C.push(B.envMapMode),C.push(B.envMapCubeUVHeight),C.push(B.mapUv),C.push(B.alphaMapUv),C.push(B.lightMapUv),C.push(B.aoMapUv),C.push(B.bumpMapUv),C.push(B.normalMapUv),C.push(B.displacementMapUv),C.push(B.emissiveMapUv),C.push(B.metalnessMapUv),C.push(B.roughnessMapUv),C.push(B.anisotropyMapUv),C.push(B.clearcoatMapUv),C.push(B.clearcoatNormalMapUv),C.push(B.clearcoatRoughnessMapUv),C.push(B.iridescenceMapUv),C.push(B.iridescenceThicknessMapUv),C.push(B.sheenColorMapUv),C.push(B.sheenRoughnessMapUv),C.push(B.specularMapUv),C.push(B.specularColorMapUv),C.push(B.specularIntensityMapUv),C.push(B.transmissionMapUv),C.push(B.thicknessMapUv),C.push(B.combine),C.push(B.fogExp2),C.push(B.sizeAttenuation),C.push(B.morphTargetsCount),C.push(B.morphAttributeCount),C.push(B.numDirLights),C.push(B.numPointLights),C.push(B.numSpotLights),C.push(B.numSpotLightMaps),C.push(B.numHemiLights),C.push(B.numRectAreaLights),C.push(B.numDirLightShadows),C.push(B.numPointLightShadows),C.push(B.numSpotLightShadows),C.push(B.numSpotLightShadowsWithMaps),C.push(B.numLightProbes),C.push(B.shadowMapType),C.push(B.toneMapping),C.push(B.numClippingPlanes),C.push(B.numClipIntersection),C.push(B.depthPacking)}function R(C,B){o.disableAll(),B.instancing&&o.enable(0),B.instancingColor&&o.enable(1),B.instancingMorph&&o.enable(2),B.matcap&&o.enable(3),B.envMap&&o.enable(4),B.normalMapObjectSpace&&o.enable(5),B.normalMapTangentSpace&&o.enable(6),B.clearcoat&&o.enable(7),B.iridescence&&o.enable(8),B.alphaTest&&o.enable(9),B.vertexColors&&o.enable(10),B.vertexAlphas&&o.enable(11),B.vertexUv1s&&o.enable(12),B.vertexUv2s&&o.enable(13),B.vertexUv3s&&o.enable(14),B.vertexTangents&&o.enable(15),B.anisotropy&&o.enable(16),B.alphaHash&&o.enable(17),B.batching&&o.enable(18),B.dispersion&&o.enable(19),B.batchingColor&&o.enable(20),B.gradientMap&&o.enable(21),B.packedNormalMap&&o.enable(22),B.vertexNormals&&o.enable(23),C.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.reversedDepthBuffer&&o.enable(4),B.skinning&&o.enable(5),B.morphTargets&&o.enable(6),B.morphNormals&&o.enable(7),B.morphColors&&o.enable(8),B.premultipliedAlpha&&o.enable(9),B.shadowMapEnabled&&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.decodeVideoTexture&&o.enable(19),B.decodeVideoTextureEmissive&&o.enable(20),B.alphaToCoverage&&o.enable(21),B.numLightProbeGrids>0&&o.enable(22),B.hasPositionAttribute&&o.enable(23),C.push(o.mask)}function P(C){let B=A[C.type],k;if(B){let z=Ha[B];k=pg.clone(z.uniforms)}else k=C.uniforms;return k}function I(C,B){let k=u.get(B);return k!==void 0?++k.usedTimes:(k=new Sxe(i,B,C,r),c.push(k),u.set(B,k)),k}function F(C){if(--C.usedTimes===0){let B=c.indexOf(C);c[B]=c[c.length-1],c.pop(),u.delete(C.cacheKey),C.destroy()}}function D(C){a.remove(C)}function L(){a.dispose()}return{getParameters:w,getProgramCacheKey:S,getUniforms:P,acquireProgram:I,releaseProgram:F,releaseShaderCache:D,programs:c,dispose:L}}function Cxe(){let i=new WeakMap;function e(o){return i.has(o)}function t(o){let a=i.get(o);return a===void 0&&(a={},i.set(o,a)),a}function n(o){i.delete(o)}function r(o,a,l){i.get(o)[a]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function Rxe(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function tK(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function nK(){let i=[],e=0,t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function o(d){let A=0;return d.isInstancedMesh&&(A+=2),d.isSkinnedMesh&&(A+=1),A}function a(d,A,y,w,S,T){let R=i[e];return R===void 0?(R={id:d.id,object:d,geometry:A,material:y,materialVariant:o(d),groupOrder:w,renderOrder:d.renderOrder,z:S,group:T},i[e]=R):(R.id=d.id,R.object=d,R.geometry=A,R.material=y,R.materialVariant=o(d),R.groupOrder=w,R.renderOrder=d.renderOrder,R.z=S,R.group=T),e++,R}function l(d,A,y,w,S,T){let R=a(d,A,y,w,S,T);y.transmission>0?n.push(R):y.transparent===!0?r.push(R):t.push(R)}function c(d,A,y,w,S,T){let R=a(d,A,y,w,S,T);y.transmission>0?n.unshift(R):y.transparent===!0?r.unshift(R):t.unshift(R)}function u(d,A,y){t.length>1&&t.sort(d||Rxe),n.length>1&&n.sort(A||tK),r.length>1&&r.sort(A||tK),y&&(t.reverse(),n.reverse(),r.reverse())}function f(){for(let d=e,A=i.length;d<A;d++){let y=i[d];if(y.id===null)break;y.id=null,y.object=null,y.geometry=null,y.material=null,y.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:l,unshift:c,finish:f,sort:u}}function Ixe(){let i=new WeakMap;function e(n,r){let s=i.get(n),o;return s===void 0?(o=new nK,i.set(n,[o])):r>=s.length?(o=new nK,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function Pxe(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new re,color:new zt};break;case"SpotLight":t={position:new re,direction:new re,color:new zt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new re,color:new zt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new re,skyColor:new zt,groundColor:new zt};break;case"RectAreaLight":t={color:new zt,position:new re,halfWidth:new re,halfHeight:new re};break}return i[e.id]=t,t}}}function Lxe(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}var Dxe=0;function Nxe(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Fxe(i){let e=new Pxe,t=Lxe(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new re);let r=new re,s=new cn,o=new cn;function a(c){let u=0,f=0,d=0;for(let B=0;B<9;B++)n.probe[B].set(0,0,0);let A=0,y=0,w=0,S=0,T=0,R=0,P=0,I=0,F=0,D=0,L=0;c.sort(Nxe);for(let B=0,k=c.length;B<k;B++){let z=c[B],G=z.color,W=z.intensity,Y=z.distance,H=null;if(z.shadow&&z.shadow.map&&(z.shadow.map.texture.format===js?H=z.shadow.map.texture:H=z.shadow.map.depthTexture||z.shadow.map.texture),z.isAmbientLight)u+=G.r*W,f+=G.g*W,d+=G.b*W;else if(z.isLightProbe){for(let $=0;$<9;$++)n.probe[$].addScaledVector(z.sh.coefficients[$],W);L++}else if(z.isDirectionalLight){let $=e.get(z);if($.color.copy(z.color).multiplyScalar(z.intensity),z.castShadow){let J=z.shadow,te=t.get(z);te.shadowIntensity=J.intensity,te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,n.directionalShadow[A]=te,n.directionalShadowMap[A]=H,n.directionalShadowMatrix[A]=z.shadow.matrix,R++}n.directional[A]=$,A++}else if(z.isSpotLight){let $=e.get(z);$.position.setFromMatrixPosition(z.matrixWorld),$.color.copy(G).multiplyScalar(W),$.distance=Y,$.coneCos=Math.cos(z.angle),$.penumbraCos=Math.cos(z.angle*(1-z.penumbra)),$.decay=z.decay,n.spot[w]=$;let J=z.shadow;if(z.map&&(n.spotLightMap[F]=z.map,F++,J.updateMatrices(z),z.castShadow&&D++),n.spotLightMatrix[w]=J.matrix,z.castShadow){let te=t.get(z);te.shadowIntensity=J.intensity,te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,n.spotShadow[w]=te,n.spotShadowMap[w]=H,I++}w++}else if(z.isRectAreaLight){let $=e.get(z);$.color.copy(G).multiplyScalar(W),$.halfWidth.set(z.width*.5,0,0),$.halfHeight.set(0,z.height*.5,0),n.rectArea[S]=$,S++}else if(z.isPointLight){let $=e.get(z);if($.color.copy(z.color).multiplyScalar(z.intensity),$.distance=z.distance,$.decay=z.decay,z.castShadow){let J=z.shadow,te=t.get(z);te.shadowIntensity=J.intensity,te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,te.shadowCameraNear=J.camera.near,te.shadowCameraFar=J.camera.far,n.pointShadow[y]=te,n.pointShadowMap[y]=H,n.pointShadowMatrix[y]=z.shadow.matrix,P++}n.point[y]=$,y++}else if(z.isHemisphereLight){let $=e.get(z);$.skyColor.copy(z.color).multiplyScalar(W),$.groundColor.copy(z.groundColor).multiplyScalar(W),n.hemi[T]=$,T++}}S>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Nt.LTC_FLOAT_1,n.rectAreaLTC2=Nt.LTC_FLOAT_2):(n.rectAreaLTC1=Nt.LTC_HALF_1,n.rectAreaLTC2=Nt.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=f,n.ambient[2]=d;let C=n.hash;(C.directionalLength!==A||C.pointLength!==y||C.spotLength!==w||C.rectAreaLength!==S||C.hemiLength!==T||C.numDirectionalShadows!==R||C.numPointShadows!==P||C.numSpotShadows!==I||C.numSpotMaps!==F||C.numLightProbes!==L)&&(n.directional.length=A,n.spot.length=w,n.rectArea.length=S,n.point.length=y,n.hemi.length=T,n.directionalShadow.length=R,n.directionalShadowMap.length=R,n.pointShadow.length=P,n.pointShadowMap.length=P,n.spotShadow.length=I,n.spotShadowMap.length=I,n.directionalShadowMatrix.length=R,n.pointShadowMatrix.length=P,n.spotLightMatrix.length=I+F-D,n.spotLightMap.length=F,n.numSpotLightShadowsWithMaps=D,n.numLightProbes=L,C.directionalLength=A,C.pointLength=y,C.spotLength=w,C.rectAreaLength=S,C.hemiLength=T,C.numDirectionalShadows=R,C.numPointShadows=P,C.numSpotShadows=I,C.numSpotMaps=F,C.numLightProbes=L,n.version=Dxe++)}function l(c,u){let f=0,d=0,A=0,y=0,w=0,S=u.matrixWorldInverse;for(let T=0,R=c.length;T<R;T++){let P=c[T];if(P.isDirectionalLight){let I=n.directional[f];I.direction.setFromMatrixPosition(P.matrixWorld),r.setFromMatrixPosition(P.target.matrixWorld),I.direction.sub(r),I.direction.transformDirection(S),f++}else if(P.isSpotLight){let I=n.spot[A];I.position.setFromMatrixPosition(P.matrixWorld),I.position.applyMatrix4(S),I.direction.setFromMatrixPosition(P.matrixWorld),r.setFromMatrixPosition(P.target.matrixWorld),I.direction.sub(r),I.direction.transformDirection(S),A++}else if(P.isRectAreaLight){let I=n.rectArea[y];I.position.setFromMatrixPosition(P.matrixWorld),I.position.applyMatrix4(S),o.identity(),s.copy(P.matrixWorld),s.premultiply(S),o.extractRotation(s),I.halfWidth.set(P.width*.5,0,0),I.halfHeight.set(0,P.height*.5,0),I.halfWidth.applyMatrix4(o),I.halfHeight.applyMatrix4(o),y++}else if(P.isPointLight){let I=n.point[d];I.position.setFromMatrixPosition(P.matrixWorld),I.position.applyMatrix4(S),d++}else if(P.isHemisphereLight){let I=n.hemi[w];I.direction.setFromMatrixPosition(P.matrixWorld),I.direction.transformDirection(S),w++}}}return{setup:a,setupView:l,state:n}}function iK(i){let e=new Fxe(i),t=[],n=[],r=[];function s(d){f.camera=d,t.length=0,n.length=0,r.length=0}function o(d){t.push(d)}function a(d){n.push(d)}function l(d){r.push(d)}function c(){e.setup(t)}function u(d){e.setupView(t,d)}let f={lightsArray:t,shadowsArray:n,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:f,setupLights:c,setupLightsView:u,pushLight:o,pushShadow:a,pushLightProbeGrid:l}}function Bxe(i){let e=new WeakMap;function t(r,s=0){let o=e.get(r),a;return o===void 0?(a=new iK(i),e.set(r,[a])):s>=o.length?(a=new iK(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var Oxe=`void main() {4066+`+ve)}else H!==""?Xe("WebGLProgram: Program Info Log:",H):($===""||J==="")&&(ce=!1);ce&&(z.diagnostics={runnable:te,programLog:H,vertexShader:{log:$,prefix:S},fragmentShader:{log:J,prefix:T}})}r.deleteShader(F),r.deleteShader(D),C=new p_(r,w),B=oxe(r,w)}let C;this.getUniforms=function(){return C===void 0&&L(this),C};let B;this.getAttributes=function(){return B===void 0&&L(this),B};let k=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=r.getProgramParameter(w,Z_e)),k},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(w),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=K_e++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=F,this.fragmentShader=D,this}var bxe=0,BF=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new OF(e),t.set(e,n)),n}},OF=class{constructor(e){this.id=bxe++,this.code=e,this.usedTimes=0}};function wxe(i){return i===Ws||i===Wh||i===jh}function Sxe(i,e,t,n,r,s){let o=new Kv,a=new BF,l=new Set,c=[],u=new Map,f=n.logarithmicDepthBuffer,d=n.precision,A={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function y(C){return l.add(C),C===0?"uv":`uv${C}`}function w(C,B,k,z,G,W){let Y=z.fog,H=G.geometry,$=C.isMeshStandardMaterial||C.isMeshLambertMaterial||C.isMeshPhongMaterial?z.environment:null,J=C.isMeshStandardMaterial||C.isMeshLambertMaterial&&!C.envMap||C.isMeshPhongMaterial&&!C.envMap,te=e.get(C.envMap||$,J),ce=te&&te.mapping===Bh?te.image.height:null,he=A[C.type];C.precision!==null&&(d=n.getMaxPrecision(C.precision),d!==C.precision&&Xe("WebGLProgram.getParameters:",C.precision,"not supported, using",d,"instead."));let ve=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,Re=ve!==void 0?ve.length:0,Qe=0;H.morphAttributes.position!==void 0&&(Qe=1),H.morphAttributes.normal!==void 0&&(Qe=2),H.morphAttributes.color!==void 0&&(Qe=3);let Fe,mt,Ee,Ve;if(he){let Yt=Ha[he];Fe=Yt.vertexShader,mt=Yt.fragmentShader}else{Fe=C.vertexShader,mt=C.fragmentShader;let Yt=a.getVertexShaderStage(C),nr=a.getFragmentShaderStage(C);a.update(C,Yt,nr),Ee=Yt.id,Ve=nr.id}let Ye=i.getRenderTarget(),Mt=i.state.buffers.depth.getReversed(),Et=G.isInstancedMesh===!0,Pt=G.isBatchedMesh===!0,dn=!!C.map,Gt=!!C.matcap,$e=!!te,ot=!!C.aoMap,nt=!!C.lightMap,bt=!!C.bumpMap&&C.wireframe===!1,yt=!!C.normalMap,hn=!!C.displacementMap,en=!!C.emissiveMap,tn=!!C.metalnessMap,bn=!!C.roughnessMap,_e=C.anisotropy>0,vi=C.clearcoat>0,zn=C.dispersion>0,le=C.iridescence>0,Z=C.sheen>0,Te=C.transmission>0,Ie=_e&&!!C.anisotropyMap,Ge=vi&&!!C.clearcoatMap,vt=vi&&!!C.clearcoatNormalMap,Tt=vi&&!!C.clearcoatRoughnessMap,qe=le&&!!C.iridescenceMap,Je=le&&!!C.iridescenceThicknessMap,It=Z&&!!C.sheenColorMap,rn=Z&&!!C.sheenRoughnessMap,Lt=!!C.specularMap,Rt=!!C.specularColorMap,fn=!!C.specularIntensityMap,wn=Te&&!!C.transmissionMap,Dn=Te&&!!C.thicknessMap,ye=!!C.gradientMap,wt=!!C.alphaMap,Ze=C.alphaTest>0,St=!!C.alphaHash,Bt=!!C.extensions,ut=ao;C.toneMapped&&(Ye===null||Ye.isXRRenderTarget===!0)&&(ut=i.toneMapping);let Ce={shaderID:he,shaderType:C.type,shaderName:C.name,vertexShader:Fe,fragmentShader:mt,defines:C.defines,customVertexShaderID:Ee,customFragmentShaderID:Ve,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:d,batching:Pt,batchingColor:Pt&&G._colorsTexture!==null,instancing:Et,instancingColor:Et&&G.instanceColor!==null,instancingMorph:Et&&G.morphTexture!==null,outputColorSpace:Ye===null?i.outputColorSpace:Ye.isXRRenderTarget===!0?Ye.texture.colorSpace:ln.workingColorSpace,alphaToCoverage:!!C.alphaToCoverage,map:dn,matcap:Gt,envMap:$e,envMapMode:$e&&te.mapping,envMapCubeUVHeight:ce,aoMap:ot,lightMap:nt,bumpMap:bt,normalMap:yt,displacementMap:hn,emissiveMap:en,normalMapObjectSpace:yt&&C.normalMapType===UM,normalMapTangentSpace:yt&&C.normalMapType===tc,packedNormalMap:yt&&C.normalMapType===tc&&wxe(C.normalMap.format),metalnessMap:tn,roughnessMap:bn,anisotropy:_e,anisotropyMap:Ie,clearcoat:vi,clearcoatMap:Ge,clearcoatNormalMap:vt,clearcoatRoughnessMap:Tt,dispersion:zn,iridescence:le,iridescenceMap:qe,iridescenceThicknessMap:Je,sheen:Z,sheenColorMap:It,sheenRoughnessMap:rn,specularMap:Lt,specularColorMap:Rt,specularIntensityMap:fn,transmission:Te,transmissionMap:wn,thicknessMap:Dn,gradientMap:ye,opaque:C.transparent===!1&&C.blending===Ts&&C.alphaToCoverage===!1,alphaMap:wt,alphaTest:Ze,alphaHash:St,combine:C.combine,mapUv:dn&&y(C.map.channel),aoMapUv:ot&&y(C.aoMap.channel),lightMapUv:nt&&y(C.lightMap.channel),bumpMapUv:bt&&y(C.bumpMap.channel),normalMapUv:yt&&y(C.normalMap.channel),displacementMapUv:hn&&y(C.displacementMap.channel),emissiveMapUv:en&&y(C.emissiveMap.channel),metalnessMapUv:tn&&y(C.metalnessMap.channel),roughnessMapUv:bn&&y(C.roughnessMap.channel),anisotropyMapUv:Ie&&y(C.anisotropyMap.channel),clearcoatMapUv:Ge&&y(C.clearcoatMap.channel),clearcoatNormalMapUv:vt&&y(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Tt&&y(C.clearcoatRoughnessMap.channel),iridescenceMapUv:qe&&y(C.iridescenceMap.channel),iridescenceThicknessMapUv:Je&&y(C.iridescenceThicknessMap.channel),sheenColorMapUv:It&&y(C.sheenColorMap.channel),sheenRoughnessMapUv:rn&&y(C.sheenRoughnessMap.channel),specularMapUv:Lt&&y(C.specularMap.channel),specularColorMapUv:Rt&&y(C.specularColorMap.channel),specularIntensityMapUv:fn&&y(C.specularIntensityMap.channel),transmissionMapUv:wn&&y(C.transmissionMap.channel),thicknessMapUv:Dn&&y(C.thicknessMap.channel),alphaMapUv:wt&&y(C.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(yt||_e),vertexNormals:!!H.attributes.normal,vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,pointsUvs:G.isPoints===!0&&!!H.attributes.uv&&(dn||wt),fog:!!Y,useFog:C.fog===!0,fogExp2:!!Y&&Y.isFogExp2,flatShading:C.wireframe===!1&&(C.flatShading===!0||H.attributes.normal===void 0&&yt===!1&&(C.isMeshLambertMaterial||C.isMeshPhongMaterial||C.isMeshStandardMaterial||C.isMeshPhysicalMaterial)),sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:Mt,skinning:G.isSkinnedMesh===!0,hasPositionAttribute:H.attributes.position!==void 0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:Re,morphTextureStride:Qe,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,numLightProbes:B.numLightProbes,numLightProbeGrids:W.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:C.dithering,shadowMapEnabled:i.shadowMap.enabled&&k.length>0,shadowMapType:i.shadowMap.type,toneMapping:ut,decodeVideoTexture:dn&&C.map.isVideoTexture===!0&&ln.getTransfer(C.map.colorSpace)===kt,decodeVideoTextureEmissive:en&&C.emissiveMap.isVideoTexture===!0&&ln.getTransfer(C.emissiveMap.colorSpace)===kt,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===vr,flipSided:C.side===mi,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionClipCullDistance:Bt&&C.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Bt&&C.extensions.multiDraw===!0||Pt)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()};return Ce.vertexUv1s=l.has(1),Ce.vertexUv2s=l.has(2),Ce.vertexUv3s=l.has(3),l.clear(),Ce}function S(C){let B=[];if(C.shaderID?B.push(C.shaderID):(B.push(C.customVertexShaderID),B.push(C.customFragmentShaderID)),C.defines!==void 0)for(let k in C.defines)B.push(k),B.push(C.defines[k]);return C.isRawShaderMaterial===!1&&(T(B,C),R(B,C),B.push(i.outputColorSpace)),B.push(C.customProgramCacheKey),B.join()}function T(C,B){C.push(B.precision),C.push(B.outputColorSpace),C.push(B.envMapMode),C.push(B.envMapCubeUVHeight),C.push(B.mapUv),C.push(B.alphaMapUv),C.push(B.lightMapUv),C.push(B.aoMapUv),C.push(B.bumpMapUv),C.push(B.normalMapUv),C.push(B.displacementMapUv),C.push(B.emissiveMapUv),C.push(B.metalnessMapUv),C.push(B.roughnessMapUv),C.push(B.anisotropyMapUv),C.push(B.clearcoatMapUv),C.push(B.clearcoatNormalMapUv),C.push(B.clearcoatRoughnessMapUv),C.push(B.iridescenceMapUv),C.push(B.iridescenceThicknessMapUv),C.push(B.sheenColorMapUv),C.push(B.sheenRoughnessMapUv),C.push(B.specularMapUv),C.push(B.specularColorMapUv),C.push(B.specularIntensityMapUv),C.push(B.transmissionMapUv),C.push(B.thicknessMapUv),C.push(B.combine),C.push(B.fogExp2),C.push(B.sizeAttenuation),C.push(B.morphTargetsCount),C.push(B.morphAttributeCount),C.push(B.numDirLights),C.push(B.numPointLights),C.push(B.numSpotLights),C.push(B.numSpotLightMaps),C.push(B.numHemiLights),C.push(B.numRectAreaLights),C.push(B.numDirLightShadows),C.push(B.numPointLightShadows),C.push(B.numSpotLightShadows),C.push(B.numSpotLightShadowsWithMaps),C.push(B.numLightProbes),C.push(B.shadowMapType),C.push(B.toneMapping),C.push(B.numClippingPlanes),C.push(B.numClipIntersection),C.push(B.depthPacking)}function R(C,B){o.disableAll(),B.instancing&&o.enable(0),B.instancingColor&&o.enable(1),B.instancingMorph&&o.enable(2),B.matcap&&o.enable(3),B.envMap&&o.enable(4),B.normalMapObjectSpace&&o.enable(5),B.normalMapTangentSpace&&o.enable(6),B.clearcoat&&o.enable(7),B.iridescence&&o.enable(8),B.alphaTest&&o.enable(9),B.vertexColors&&o.enable(10),B.vertexAlphas&&o.enable(11),B.vertexUv1s&&o.enable(12),B.vertexUv2s&&o.enable(13),B.vertexUv3s&&o.enable(14),B.vertexTangents&&o.enable(15),B.anisotropy&&o.enable(16),B.alphaHash&&o.enable(17),B.batching&&o.enable(18),B.dispersion&&o.enable(19),B.batchingColor&&o.enable(20),B.gradientMap&&o.enable(21),B.packedNormalMap&&o.enable(22),B.vertexNormals&&o.enable(23),C.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.reversedDepthBuffer&&o.enable(4),B.skinning&&o.enable(5),B.morphTargets&&o.enable(6),B.morphNormals&&o.enable(7),B.morphColors&&o.enable(8),B.premultipliedAlpha&&o.enable(9),B.shadowMapEnabled&&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.decodeVideoTexture&&o.enable(19),B.decodeVideoTextureEmissive&&o.enable(20),B.alphaToCoverage&&o.enable(21),B.numLightProbeGrids>0&&o.enable(22),B.hasPositionAttribute&&o.enable(23),C.push(o.mask)}function I(C){let B=A[C.type],k;if(B){let z=Ha[B];k=dg.clone(z.uniforms)}else k=C.uniforms;return k}function P(C,B){let k=u.get(B);return k!==void 0?++k.usedTimes:(k=new yxe(i,B,C,r),c.push(k),u.set(B,k)),k}function F(C){if(--C.usedTimes===0){let B=c.indexOf(C);c[B]=c[c.length-1],c.pop(),u.delete(C.cacheKey),C.destroy()}}function D(C){a.remove(C)}function L(){a.dispose()}return{getParameters:w,getProgramCacheKey:S,getUniforms:I,acquireProgram:P,releaseProgram:F,releaseShaderCache:D,programs:c,dispose:L}}function Txe(){let i=new WeakMap;function e(o){return i.has(o)}function t(o){let a=i.get(o);return a===void 0&&(a={},i.set(o,a)),a}function n(o){i.delete(o)}function r(o,a,l){i.get(o)[a]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function Exe(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function KZ(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function QZ(){let i=[],e=0,t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function o(d){let A=0;return d.isInstancedMesh&&(A+=2),d.isSkinnedMesh&&(A+=1),A}function a(d,A,y,w,S,T){let R=i[e];return R===void 0?(R={id:d.id,object:d,geometry:A,material:y,materialVariant:o(d),groupOrder:w,renderOrder:d.renderOrder,z:S,group:T},i[e]=R):(R.id=d.id,R.object=d,R.geometry=A,R.material=y,R.materialVariant=o(d),R.groupOrder=w,R.renderOrder=d.renderOrder,R.z=S,R.group=T),e++,R}function l(d,A,y,w,S,T){let R=a(d,A,y,w,S,T);y.transmission>0?n.push(R):y.transparent===!0?r.push(R):t.push(R)}function c(d,A,y,w,S,T){let R=a(d,A,y,w,S,T);y.transmission>0?n.unshift(R):y.transparent===!0?r.unshift(R):t.unshift(R)}function u(d,A,y){t.length>1&&t.sort(d||Exe),n.length>1&&n.sort(A||KZ),r.length>1&&r.sort(A||KZ),y&&(t.reverse(),n.reverse(),r.reverse())}function f(){for(let d=e,A=i.length;d<A;d++){let y=i[d];if(y.id===null)break;y.id=null,y.object=null,y.geometry=null,y.material=null,y.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:l,unshift:c,finish:f,sort:u}}function Mxe(){let i=new WeakMap;function e(n,r){let s=i.get(n),o;return s===void 0?(o=new QZ,i.set(n,[o])):r>=s.length?(o=new QZ,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function Cxe(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new re,color:new zt};break;case"SpotLight":t={position:new re,direction:new re,color:new zt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new re,color:new zt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new re,skyColor:new zt,groundColor:new zt};break;case"RectAreaLight":t={color:new zt,position:new re,halfWidth:new re,halfHeight:new re};break}return i[e.id]=t,t}}}function Rxe(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}var Pxe=0;function Ixe(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Lxe(i){let e=new Cxe,t=Rxe(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new re);let r=new re,s=new cn,o=new cn;function a(c){let u=0,f=0,d=0;for(let B=0;B<9;B++)n.probe[B].set(0,0,0);let A=0,y=0,w=0,S=0,T=0,R=0,I=0,P=0,F=0,D=0,L=0;c.sort(Ixe);for(let B=0,k=c.length;B<k;B++){let z=c[B],G=z.color,W=z.intensity,Y=z.distance,H=null;if(z.shadow&&z.shadow.map&&(z.shadow.map.texture.format===Ws?H=z.shadow.map.texture:H=z.shadow.map.depthTexture||z.shadow.map.texture),z.isAmbientLight)u+=G.r*W,f+=G.g*W,d+=G.b*W;else if(z.isLightProbe){for(let $=0;$<9;$++)n.probe[$].addScaledVector(z.sh.coefficients[$],W);L++}else if(z.isDirectionalLight){let $=e.get(z);if($.color.copy(z.color).multiplyScalar(z.intensity),z.castShadow){let J=z.shadow,te=t.get(z);te.shadowIntensity=J.intensity,te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,n.directionalShadow[A]=te,n.directionalShadowMap[A]=H,n.directionalShadowMatrix[A]=z.shadow.matrix,R++}n.directional[A]=$,A++}else if(z.isSpotLight){let $=e.get(z);$.position.setFromMatrixPosition(z.matrixWorld),$.color.copy(G).multiplyScalar(W),$.distance=Y,$.coneCos=Math.cos(z.angle),$.penumbraCos=Math.cos(z.angle*(1-z.penumbra)),$.decay=z.decay,n.spot[w]=$;let J=z.shadow;if(z.map&&(n.spotLightMap[F]=z.map,F++,J.updateMatrices(z),z.castShadow&&D++),n.spotLightMatrix[w]=J.matrix,z.castShadow){let te=t.get(z);te.shadowIntensity=J.intensity,te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,n.spotShadow[w]=te,n.spotShadowMap[w]=H,P++}w++}else if(z.isRectAreaLight){let $=e.get(z);$.color.copy(G).multiplyScalar(W),$.halfWidth.set(z.width*.5,0,0),$.halfHeight.set(0,z.height*.5,0),n.rectArea[S]=$,S++}else if(z.isPointLight){let $=e.get(z);if($.color.copy(z.color).multiplyScalar(z.intensity),$.distance=z.distance,$.decay=z.decay,z.castShadow){let J=z.shadow,te=t.get(z);te.shadowIntensity=J.intensity,te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,te.shadowCameraNear=J.camera.near,te.shadowCameraFar=J.camera.far,n.pointShadow[y]=te,n.pointShadowMap[y]=H,n.pointShadowMatrix[y]=z.shadow.matrix,I++}n.point[y]=$,y++}else if(z.isHemisphereLight){let $=e.get(z);$.skyColor.copy(z.color).multiplyScalar(W),$.groundColor.copy(z.groundColor).multiplyScalar(W),n.hemi[T]=$,T++}}S>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Nt.LTC_FLOAT_1,n.rectAreaLTC2=Nt.LTC_FLOAT_2):(n.rectAreaLTC1=Nt.LTC_HALF_1,n.rectAreaLTC2=Nt.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=f,n.ambient[2]=d;let C=n.hash;(C.directionalLength!==A||C.pointLength!==y||C.spotLength!==w||C.rectAreaLength!==S||C.hemiLength!==T||C.numDirectionalShadows!==R||C.numPointShadows!==I||C.numSpotShadows!==P||C.numSpotMaps!==F||C.numLightProbes!==L)&&(n.directional.length=A,n.spot.length=w,n.rectArea.length=S,n.point.length=y,n.hemi.length=T,n.directionalShadow.length=R,n.directionalShadowMap.length=R,n.pointShadow.length=I,n.pointShadowMap.length=I,n.spotShadow.length=P,n.spotShadowMap.length=P,n.directionalShadowMatrix.length=R,n.pointShadowMatrix.length=I,n.spotLightMatrix.length=P+F-D,n.spotLightMap.length=F,n.numSpotLightShadowsWithMaps=D,n.numLightProbes=L,C.directionalLength=A,C.pointLength=y,C.spotLength=w,C.rectAreaLength=S,C.hemiLength=T,C.numDirectionalShadows=R,C.numPointShadows=I,C.numSpotShadows=P,C.numSpotMaps=F,C.numLightProbes=L,n.version=Pxe++)}function l(c,u){let f=0,d=0,A=0,y=0,w=0,S=u.matrixWorldInverse;for(let T=0,R=c.length;T<R;T++){let I=c[T];if(I.isDirectionalLight){let P=n.directional[f];P.direction.setFromMatrixPosition(I.matrixWorld),r.setFromMatrixPosition(I.target.matrixWorld),P.direction.sub(r),P.direction.transformDirection(S),f++}else if(I.isSpotLight){let P=n.spot[A];P.position.setFromMatrixPosition(I.matrixWorld),P.position.applyMatrix4(S),P.direction.setFromMatrixPosition(I.matrixWorld),r.setFromMatrixPosition(I.target.matrixWorld),P.direction.sub(r),P.direction.transformDirection(S),A++}else if(I.isRectAreaLight){let P=n.rectArea[y];P.position.setFromMatrixPosition(I.matrixWorld),P.position.applyMatrix4(S),o.identity(),s.copy(I.matrixWorld),s.premultiply(S),o.extractRotation(s),P.halfWidth.set(I.width*.5,0,0),P.halfHeight.set(0,I.height*.5,0),P.halfWidth.applyMatrix4(o),P.halfHeight.applyMatrix4(o),y++}else if(I.isPointLight){let P=n.point[d];P.position.setFromMatrixPosition(I.matrixWorld),P.position.applyMatrix4(S),d++}else if(I.isHemisphereLight){let P=n.hemi[w];P.direction.setFromMatrixPosition(I.matrixWorld),P.direction.transformDirection(S),w++}}}return{setup:a,setupView:l,state:n}}function JZ(i){let e=new Lxe(i),t=[],n=[],r=[];function s(d){f.camera=d,t.length=0,n.length=0,r.length=0}function o(d){t.push(d)}function a(d){n.push(d)}function l(d){r.push(d)}function c(){e.setup(t)}function u(d){e.setupView(t,d)}let f={lightsArray:t,shadowsArray:n,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:f,setupLights:c,setupLightsView:u,pushLight:o,pushShadow:a,pushLightProbeGrid:l}}function Dxe(i){let e=new WeakMap;function t(r,s=0){let o=e.get(r),a;return o===void 0?(a=new JZ(i),e.set(r,[a])):s>=o.length?(a=new JZ(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var Nxe=`void main() {40674067 gl_Position = vec4( position, 1.0 );4068-}`,Uxe=`uniform sampler2D shadow_pass;4068+}`,Fxe=`uniform sampler2D shadow_pass;40694069 uniform vec2 resolution;40704070 uniform float radius;40714071 void main() {
@@ -4090,12 +4090,12 @@ void main() {
40904090 squared_mean = squared_mean / samples;40914091 float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );40924092 gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );4093-}`,kxe=[new re(1,0,0),new re(-1,0,0),new re(0,1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1)],zxe=[new re(0,-1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1),new re(0,-1,0),new re(0,-1,0)],rK=new cn,qb=new re,IF=new re;function Vxe(i,e,t){let n=new Hc,r=new Oe,s=new Oe,o=new xn,a=new xM,l=new yM,c={},u=t.maxTextureSize,f={[zo]:mi,[mi]:zo,[vr]:vr},d=new ps({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Oe},radius:{value:4}},vertexShader:Oxe,fragmentShader:Uxe}),A=d.clone();A.defines.HORIZONTAL_PASS=1;let y=new Xn;y.setAttribute("position",new Hi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let w=new Hn(y,d),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=p0;let T=this.type;this.render=function(D,L,C){if(S.enabled===!1||S.autoUpdate===!1&&S.needsUpdate===!1||D.length===0)return;this.type===OM&&(Xe("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=p0);let B=i.getRenderTarget(),k=i.getActiveCubeFace(),z=i.getActiveMipmapLevel(),G=i.state;G.setBlending(ms),G.buffers.depth.getReversed()===!0?G.buffers.color.setClear(0,0,0,0):G.buffers.color.setClear(1,1,1,1),G.buffers.depth.setTest(!0),G.setScissorTest(!1);let W=T!==this.type;W&&L.traverse(function(Y){Y.material&&(Array.isArray(Y.material)?Y.material.forEach(H=>H.needsUpdate=!0):Y.material.needsUpdate=!0)});for(let Y=0,H=D.length;Y<H;Y++){let $=D[Y],J=$.shadow;if(J===void 0){Xe("WebGLShadowMap:",$,"has no shadow.");continue}if(J.autoUpdate===!1&&J.needsUpdate===!1)continue;r.copy(J.mapSize);let te=J.getFrameExtents();r.multiply(te),s.copy(J.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/te.x),r.x=s.x*te.x,J.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/te.y),r.y=s.y*te.y,J.mapSize.y=s.y));let ce=i.state.buffers.depth.getReversed();if(J.camera._reversedDepth=ce,J.map===null||W===!0){if(J.map!==null&&(J.map.depthTexture!==null&&(J.map.depthTexture.dispose(),J.map.depthTexture=null),J.map.dispose()),this.type===Wc){if($.isPointLight){Xe("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}J.map=new Oa(r.x,r.y,{format:js,type:Wi,minFilter:Mi,magFilter:Mi,generateMipmaps:!1}),J.map.texture.name=$.name+".shadowMap",J.map.depthTexture=new Cs(r.x,r.y,cr),J.map.depthTexture.name=$.name+".shadowMapDepth",J.map.depthTexture.format=Gs,J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=Ti,J.map.depthTexture.magFilter=Ti}else $.isPointLight?(J.map=new YM(r.x),J.map.depthTexture=new n_(r.x,xi)):(J.map=new Oa(r.x,r.y),J.map.depthTexture=new Cs(r.x,r.y,xi)),J.map.depthTexture.name=$.name+".shadowMap",J.map.depthTexture.format=Gs,this.type===p0?(J.map.depthTexture.compareFunction=ce?ku:Kh,J.map.depthTexture.minFilter=Mi,J.map.depthTexture.magFilter=Mi):(J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=Ti,J.map.depthTexture.magFilter=Ti);J.camera.updateProjectionMatrix()}let he=J.map.isWebGLCubeRenderTarget?6:1;for(let ve=0;ve<he;ve++){if(J.map.isWebGLCubeRenderTarget)i.setRenderTarget(J.map,ve),i.clear();else{ve===0&&(i.setRenderTarget(J.map),i.clear());let Re=J.getViewport(ve);o.set(s.x*Re.x,s.y*Re.y,s.x*Re.z,s.y*Re.w),G.viewport(o)}if($.isPointLight){let Re=J.camera,Qe=J.matrix,Fe=$.distance||Re.far;Fe!==Re.far&&(Re.far=Fe,Re.updateProjectionMatrix()),qb.setFromMatrixPosition($.matrixWorld),Re.position.copy(qb),IF.copy(Re.position),IF.add(kxe[ve]),Re.up.copy(zxe[ve]),Re.lookAt(IF),Re.updateMatrixWorld(),Qe.makeTranslation(-qb.x,-qb.y,-qb.z),rK.multiplyMatrices(Re.projectionMatrix,Re.matrixWorldInverse),J._frustum.setFromProjectionMatrix(rK,Re.coordinateSystem,Re.reversedDepth)}else J.updateMatrices($);n=J.getFrustum(),I(L,C,J.camera,$,this.type)}J.isPointLightShadow!==!0&&this.type===Wc&&R(J,C),J.needsUpdate=!1}T=this.type,S.needsUpdate=!1,i.setRenderTarget(B,k,z)};function R(D,L){let C=e.update(w);d.defines.VSM_SAMPLES!==D.blurSamples&&(d.defines.VSM_SAMPLES=D.blurSamples,A.defines.VSM_SAMPLES=D.blurSamples,d.needsUpdate=!0,A.needsUpdate=!0),D.mapPass===null&&(D.mapPass=new Oa(r.x,r.y,{format:js,type:Wi})),d.uniforms.shadow_pass.value=D.map.depthTexture,d.uniforms.resolution.value=D.mapSize,d.uniforms.radius.value=D.radius,i.setRenderTarget(D.mapPass),i.clear(),i.renderBufferDirect(L,null,C,d,w,null),A.uniforms.shadow_pass.value=D.mapPass.texture,A.uniforms.resolution.value=D.mapSize,A.uniforms.radius.value=D.radius,i.setRenderTarget(D.map),i.clear(),i.renderBufferDirect(L,null,C,A,w,null)}function P(D,L,C,B){let k=null,z=C.isPointLight===!0?D.customDistanceMaterial:D.customDepthMaterial;if(z!==void 0)k=z;else if(k=C.isPointLight===!0?l:a,i.localClippingEnabled&&L.clipShadows===!0&&Array.isArray(L.clippingPlanes)&&L.clippingPlanes.length!==0||L.displacementMap&&L.displacementScale!==0||L.alphaMap&&L.alphaTest>0||L.map&&L.alphaTest>0||L.alphaToCoverage===!0){let G=k.uuid,W=L.uuid,Y=c[G];Y===void 0&&(Y={},c[G]=Y);let H=Y[W];H===void 0&&(H=k.clone(),Y[W]=H,L.addEventListener("dispose",F)),k=H}if(k.visible=L.visible,k.wireframe=L.wireframe,B===Wc?k.side=L.shadowSide!==null?L.shadowSide:L.side:k.side=L.shadowSide!==null?L.shadowSide:f[L.side],k.alphaMap=L.alphaMap,k.alphaTest=L.alphaToCoverage===!0?.5:L.alphaTest,k.map=L.map,k.clipShadows=L.clipShadows,k.clippingPlanes=L.clippingPlanes,k.clipIntersection=L.clipIntersection,k.displacementMap=L.displacementMap,k.displacementScale=L.displacementScale,k.displacementBias=L.displacementBias,k.wireframeLinewidth=L.wireframeLinewidth,k.linewidth=L.linewidth,C.isPointLight===!0&&k.isMeshDistanceMaterial===!0){let G=i.properties.get(k);G.light=C}return k}function I(D,L,C,B,k){if(D.visible===!1)return;if(D.layers.test(L.layers)&&(D.isMesh||D.isLine||D.isPoints)&&(D.castShadow||D.receiveShadow&&k===Wc)&&(!D.frustumCulled||n.intersectsObject(D))){D.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,D.matrixWorld);let W=e.update(D),Y=D.material;if(Array.isArray(Y)){let H=W.groups;for(let $=0,J=H.length;$<J;$++){let te=H[$],ce=Y[te.materialIndex];if(ce&&ce.visible){let he=P(D,ce,B,k);D.onBeforeShadow(i,D,L,C,W,he,te),i.renderBufferDirect(C,null,W,he,D,te),D.onAfterShadow(i,D,L,C,W,he,te)}}}else if(Y.visible){let H=P(D,Y,B,k);D.onBeforeShadow(i,D,L,C,W,H,null),i.renderBufferDirect(C,null,W,H,D,null),D.onAfterShadow(i,D,L,C,W,H,null)}}let G=D.children;for(let W=0,Y=G.length;W<Y;W++)I(G[W],L,C,B,k)}function F(D){D.target.removeEventListener("dispose",F);for(let C in c){let B=c[C],k=D.target.uuid;k in B&&(B[k].dispose(),delete B[k])}}}function Gxe(i,e){function t(){let ye=!1,wt=new xn,Ze=null,St=new xn(0,0,0,0);return{setMask:function(Bt){Ze!==Bt&&!ye&&(i.colorMask(Bt,Bt,Bt,Bt),Ze=Bt)},setLocked:function(Bt){ye=Bt},setClear:function(Bt,ut,Ce,Yt,nr){nr===!0&&(Bt*=Yt,ut*=Yt,Ce*=Yt),wt.set(Bt,ut,Ce,Yt),St.equals(wt)===!1&&(i.clearColor(Bt,ut,Ce,Yt),St.copy(wt))},reset:function(){ye=!1,Ze=null,St.set(-1,0,0,0)}}}function n(){let ye=!1,wt=!1,Ze=null,St=null,Bt=null;return{setReversed:function(ut){if(wt!==ut){let Ce=e.get("EXT_clip_control");ut?Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.ZERO_TO_ONE_EXT):Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.NEGATIVE_ONE_TO_ONE_EXT),wt=ut;let Yt=Bt;Bt=null,this.setClear(Yt)}},getReversed:function(){return wt},setTest:function(ut){ut?Ye(i.DEPTH_TEST):Mt(i.DEPTH_TEST)},setMask:function(ut){Ze!==ut&&!ye&&(i.depthMask(ut),Ze=ut)},setFunc:function(ut){if(wt&&(ut=zb[ut]),St!==ut){switch(ut){case DA:i.depthFunc(i.NEVER);break;case NA:i.depthFunc(i.ALWAYS);break;case FA:i.depthFunc(i.LESS);break;case Lh:i.depthFunc(i.LEQUAL);break;case BA:i.depthFunc(i.EQUAL);break;case OA:i.depthFunc(i.GEQUAL);break;case UA:i.depthFunc(i.GREATER);break;case kA:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}St=ut}},setLocked:function(ut){ye=ut},setClear:function(ut){Bt!==ut&&(Bt=ut,wt&&(ut=1-ut),i.clearDepth(ut))},reset:function(){ye=!1,Ze=null,St=null,Bt=null,wt=!1}}}function r(){let ye=!1,wt=null,Ze=null,St=null,Bt=null,ut=null,Ce=null,Yt=null,nr=null;return{setTest:function(Fn){ye||(Fn?Ye(i.STENCIL_TEST):Mt(i.STENCIL_TEST))},setMask:function(Fn){wt!==Fn&&!ye&&(i.stencilMask(Fn),wt=Fn)},setFunc:function(Fn,rs,Dr){(Ze!==Fn||St!==rs||Bt!==Dr)&&(i.stencilFunc(Fn,rs,Dr),Ze=Fn,St=rs,Bt=Dr)},setOp:function(Fn,rs,Dr){(ut!==Fn||Ce!==rs||Yt!==Dr)&&(i.stencilOp(Fn,rs,Dr),ut=Fn,Ce=rs,Yt=Dr)},setLocked:function(Fn){ye=Fn},setClear:function(Fn){nr!==Fn&&(i.clearStencil(Fn),nr=Fn)},reset:function(){ye=!1,wt=null,Ze=null,St=null,Bt=null,ut=null,Ce=null,Yt=null,nr=null}}}let s=new t,o=new n,a=new r,l=new WeakMap,c=new WeakMap,u={},f={},d={},A=new WeakMap,y=[],w=null,S=!1,T=null,R=null,P=null,I=null,F=null,D=null,L=null,C=new zt(0,0,0),B=0,k=!1,z=null,G=null,W=null,Y=null,H=null,$=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS),J=!1,te=0,ce=i.getParameter(i.VERSION);ce.indexOf("WebGL")!==-1?(te=parseFloat(/^WebGL (\d)/.exec(ce)[1]),J=te>=1):ce.indexOf("OpenGL ES")!==-1&&(te=parseFloat(/^OpenGL ES (\d)/.exec(ce)[1]),J=te>=2);let he=null,ve={},Re=i.getParameter(i.SCISSOR_BOX),Qe=i.getParameter(i.VIEWPORT),Fe=new xn().fromArray(Re),mt=new xn().fromArray(Qe);function Ee(ye,wt,Ze,St){let Bt=new Uint8Array(4),ut=i.createTexture();i.bindTexture(ye,ut),i.texParameteri(ye,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(ye,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Ce=0;Ce<Ze;Ce++)ye===i.TEXTURE_3D||ye===i.TEXTURE_2D_ARRAY?i.texImage3D(wt,0,i.RGBA,1,1,St,0,i.RGBA,i.UNSIGNED_BYTE,Bt):i.texImage2D(wt+Ce,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,Bt);return ut}let Ve={};Ve[i.TEXTURE_2D]=Ee(i.TEXTURE_2D,i.TEXTURE_2D,1),Ve[i.TEXTURE_CUBE_MAP]=Ee(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Ve[i.TEXTURE_2D_ARRAY]=Ee(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Ve[i.TEXTURE_3D]=Ee(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),Ye(i.DEPTH_TEST),o.setFunc(Lh),bt(!1),yt(pb),Ye(i.CULL_FACE),ot(ms);function Ye(ye){u[ye]!==!0&&(i.enable(ye),u[ye]=!0)}function Mt(ye){u[ye]!==!1&&(i.disable(ye),u[ye]=!1)}function Et(ye,wt){return d[ye]!==wt?(i.bindFramebuffer(ye,wt),d[ye]=wt,ye===i.DRAW_FRAMEBUFFER&&(d[i.FRAMEBUFFER]=wt),ye===i.FRAMEBUFFER&&(d[i.DRAW_FRAMEBUFFER]=wt),!0):!1}function It(ye,wt){let Ze=y,St=!1;if(ye){Ze=A.get(wt),Ze===void 0&&(Ze=[],A.set(wt,Ze));let Bt=ye.textures;if(Ze.length!==Bt.length||Ze[0]!==i.COLOR_ATTACHMENT0){for(let ut=0,Ce=Bt.length;ut<Ce;ut++)Ze[ut]=i.COLOR_ATTACHMENT0+ut;Ze.length=Bt.length,St=!0}}else Ze[0]!==i.BACK&&(Ze[0]=i.BACK,St=!0);St&&i.drawBuffers(Ze)}function dn(ye){return w!==ye?(i.useProgram(ye),w=ye,!0):!1}let Gt={[oo]:i.FUNC_ADD,[Ab]:i.FUNC_SUBTRACT,[gb]:i.FUNC_REVERSE_SUBTRACT};Gt[UM]=i.MIN,Gt[kM]=i.MAX;let $e={[Uu]:i.ZERO,[vb]:i.ONE,[_b]:i.SRC_COLOR,[e0]:i.SRC_ALPHA,[Tb]:i.SRC_ALPHA_SATURATE,[wb]:i.DST_COLOR,[yb]:i.DST_ALPHA,[xb]:i.ONE_MINUS_SRC_COLOR,[t0]:i.ONE_MINUS_SRC_ALPHA,[Sb]:i.ONE_MINUS_DST_COLOR,[bb]:i.ONE_MINUS_DST_ALPHA,[wZ]:i.CONSTANT_COLOR,[SZ]:i.ONE_MINUS_CONSTANT_COLOR,[TZ]:i.CONSTANT_ALPHA,[EZ]:i.ONE_MINUS_CONSTANT_ALPHA};function ot(ye,wt,Ze,St,Bt,ut,Ce,Yt,nr,Fn){if(ye===ms){S===!0&&(Mt(i.BLEND),S=!1);return}if(S===!1&&(Ye(i.BLEND),S=!0),ye!==Bd){if(ye!==T||Fn!==k){if((R!==oo||F!==oo)&&(i.blendEquation(i.FUNC_ADD),R=oo,F=oo),Fn)switch(ye){case Ms:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Oh:i.blendFunc(i.ONE,i.ONE);break;case Uh:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case kh:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:ze("WebGLState: Invalid blending: ",ye);break}else switch(ye){case Ms:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Oh:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case Uh:ze("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case kh:ze("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ze("WebGLState: Invalid blending: ",ye);break}P=null,I=null,D=null,L=null,C.set(0,0,0),B=0,T=ye,k=Fn}return}Bt=Bt||wt,ut=ut||Ze,Ce=Ce||St,(wt!==R||Bt!==F)&&(i.blendEquationSeparate(Gt[wt],Gt[Bt]),R=wt,F=Bt),(Ze!==P||St!==I||ut!==D||Ce!==L)&&(i.blendFuncSeparate($e[Ze],$e[St],$e[ut],$e[Ce]),P=Ze,I=St,D=ut,L=Ce),(Yt.equals(C)===!1||nr!==B)&&(i.blendColor(Yt.r,Yt.g,Yt.b,nr),C.copy(Yt),B=nr),T=ye,k=!1}function nt(ye,wt){ye.side===vr?Mt(i.CULL_FACE):Ye(i.CULL_FACE);let Ze=ye.side===mi;wt&&(Ze=!Ze),bt(Ze),ye.blending===Ms&&ye.transparent===!1?ot(ms):ot(ye.blending,ye.blendEquation,ye.blendSrc,ye.blendDst,ye.blendEquationAlpha,ye.blendSrcAlpha,ye.blendDstAlpha,ye.blendColor,ye.blendAlpha,ye.premultipliedAlpha),o.setFunc(ye.depthFunc),o.setTest(ye.depthTest),o.setMask(ye.depthWrite),s.setMask(ye.colorWrite);let St=ye.stencilWrite;a.setTest(St),St&&(a.setMask(ye.stencilWriteMask),a.setFunc(ye.stencilFunc,ye.stencilRef,ye.stencilFuncMask),a.setOp(ye.stencilFail,ye.stencilZFail,ye.stencilZPass)),en(ye.polygonOffset,ye.polygonOffsetFactor,ye.polygonOffsetUnits),ye.alphaToCoverage===!0?Ye(i.SAMPLE_ALPHA_TO_COVERAGE):Mt(i.SAMPLE_ALPHA_TO_COVERAGE)}function bt(ye){z!==ye&&(ye?i.frontFace(i.CW):i.frontFace(i.CCW),z=ye)}function yt(ye){ye!==FM?(Ye(i.CULL_FACE),ye!==G&&(ye===pb?i.cullFace(i.BACK):ye===BM?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Mt(i.CULL_FACE),G=ye}function hn(ye){ye!==W&&(J&&i.lineWidth(ye),W=ye)}function en(ye,wt,Ze){ye?(Ye(i.POLYGON_OFFSET_FILL),(Y!==wt||H!==Ze)&&(Y=wt,H=Ze,o.getReversed()&&(wt=-wt),i.polygonOffset(wt,Ze))):Mt(i.POLYGON_OFFSET_FILL)}function tn(ye){ye?Ye(i.SCISSOR_TEST):Mt(i.SCISSOR_TEST)}function bn(ye){ye===void 0&&(ye=i.TEXTURE0+$-1),he!==ye&&(i.activeTexture(ye),he=ye)}function _e(ye,wt,Ze){Ze===void 0&&(he===null?Ze=i.TEXTURE0+$-1:Ze=he);let St=ve[Ze];St===void 0&&(St={type:void 0,texture:void 0},ve[Ze]=St),(St.type!==ye||St.texture!==wt)&&(he!==Ze&&(i.activeTexture(Ze),he=Ze),i.bindTexture(ye,wt||Ve[ye]),St.type=ye,St.texture=wt)}function vi(){let ye=ve[he];ye!==void 0&&ye.type!==void 0&&(i.bindTexture(ye.type,null),ye.type=void 0,ye.texture=void 0)}function zn(){try{i.compressedTexImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function le(){try{i.compressedTexImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Z(){try{i.texSubImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Te(){try{i.texSubImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Pe(){try{i.compressedTexSubImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Ge(){try{i.compressedTexSubImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function vt(){try{i.texStorage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Tt(){try{i.texStorage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function qe(){try{i.texImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Je(){try{i.texImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Pt(ye){return f[ye]!==void 0?f[ye]:i.getParameter(ye)}function rn(ye,wt){f[ye]!==wt&&(i.pixelStorei(ye,wt),f[ye]=wt)}function Lt(ye){Fe.equals(ye)===!1&&(i.scissor(ye.x,ye.y,ye.z,ye.w),Fe.copy(ye))}function Rt(ye){mt.equals(ye)===!1&&(i.viewport(ye.x,ye.y,ye.z,ye.w),mt.copy(ye))}function fn(ye,wt){let Ze=c.get(wt);Ze===void 0&&(Ze=new WeakMap,c.set(wt,Ze));let St=Ze.get(ye);St===void 0&&(St=i.getUniformBlockIndex(wt,ye.name),Ze.set(ye,St))}function wn(ye,wt){let St=c.get(wt).get(ye);l.get(wt)!==St&&(i.uniformBlockBinding(wt,St,ye.__bindingPointIndex),l.set(wt,St))}function Dn(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),o.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),i.pixelStorei(i.PACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.BROWSER_DEFAULT_WEBGL),i.pixelStorei(i.PACK_ROW_LENGTH,0),i.pixelStorei(i.PACK_SKIP_PIXELS,0),i.pixelStorei(i.PACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_ROW_LENGTH,0),i.pixelStorei(i.UNPACK_IMAGE_HEIGHT,0),i.pixelStorei(i.UNPACK_SKIP_PIXELS,0),i.pixelStorei(i.UNPACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_SKIP_IMAGES,0),u={},f={},he=null,ve={},d={},A=new WeakMap,y=[],w=null,S=!1,T=null,R=null,P=null,I=null,F=null,D=null,L=null,C=new zt(0,0,0),B=0,k=!1,z=null,G=null,W=null,Y=null,H=null,Fe.set(0,0,i.canvas.width,i.canvas.height),mt.set(0,0,i.canvas.width,i.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:Ye,disable:Mt,bindFramebuffer:Et,drawBuffers:It,useProgram:dn,setBlending:ot,setMaterial:nt,setFlipSided:bt,setCullFace:yt,setLineWidth:hn,setPolygonOffset:en,setScissorTest:tn,activeTexture:bn,bindTexture:_e,unbindTexture:vi,compressedTexImage2D:zn,compressedTexImage3D:le,texImage2D:qe,texImage3D:Je,pixelStorei:rn,getParameter:Pt,updateUBOMapping:fn,uniformBlockBinding:wn,texStorage2D:vt,texStorage3D:Tt,texSubImage2D:Z,texSubImage3D:Te,compressedTexSubImage2D:Pe,compressedTexSubImage3D:Ge,scissor:Lt,viewport:Rt,reset:Dn}}function qxe(i,e,t,n,r,s,o){let a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Oe,u=new WeakMap,f=new Set,d,A=new WeakMap,y=!1;try{y=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function w(le,Z){return y?new OffscreenCanvas(le,Z):Zv("canvas")}function S(le,Z,Te){let Pe=1,Ge=zn(le);if((Ge.width>Te||Ge.height>Te)&&(Pe=Te/Math.max(Ge.width,Ge.height)),Pe<1)if(typeof HTMLImageElement<"u"&&le instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&le instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&le instanceof ImageBitmap||typeof VideoFrame<"u"&&le instanceof VideoFrame){let vt=Math.floor(Pe*Ge.width),Tt=Math.floor(Pe*Ge.height);d===void 0&&(d=w(vt,Tt));let qe=Z?w(vt,Tt):d;return qe.width=vt,qe.height=Tt,qe.getContext("2d").drawImage(le,0,0,vt,Tt),Xe("WebGLRenderer: Texture has been resized from ("+Ge.width+"x"+Ge.height+") to ("+vt+"x"+Tt+")."),qe}else return"data"in le&&Xe("WebGLRenderer: Image in DataTexture is too big ("+Ge.width+"x"+Ge.height+")."),le;return le}function T(le){return le.generateMipmaps}function R(le){i.generateMipmap(le)}function P(le){return le.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:le.isWebGL3DRenderTarget?i.TEXTURE_3D:le.isWebGLArrayRenderTarget||le.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function I(le,Z,Te,Pe,Ge,vt=!1){if(le!==null){if(i[le]!==void 0)return i[le];Xe("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+le+"'")}let Tt;Pe&&(Tt=e.get("EXT_texture_norm16"),Tt||Xe("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let qe=Z;if(Z===i.RED&&(Te===i.FLOAT&&(qe=i.R32F),Te===i.HALF_FLOAT&&(qe=i.R16F),Te===i.UNSIGNED_BYTE&&(qe=i.R8),Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.R16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.R16_SNORM_EXT)),Z===i.RED_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.R8UI),Te===i.UNSIGNED_SHORT&&(qe=i.R16UI),Te===i.UNSIGNED_INT&&(qe=i.R32UI),Te===i.BYTE&&(qe=i.R8I),Te===i.SHORT&&(qe=i.R16I),Te===i.INT&&(qe=i.R32I)),Z===i.RG&&(Te===i.FLOAT&&(qe=i.RG32F),Te===i.HALF_FLOAT&&(qe=i.RG16F),Te===i.UNSIGNED_BYTE&&(qe=i.RG8),Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.RG16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.RG16_SNORM_EXT)),Z===i.RG_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RG8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RG16UI),Te===i.UNSIGNED_INT&&(qe=i.RG32UI),Te===i.BYTE&&(qe=i.RG8I),Te===i.SHORT&&(qe=i.RG16I),Te===i.INT&&(qe=i.RG32I)),Z===i.RGB_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RGB8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RGB16UI),Te===i.UNSIGNED_INT&&(qe=i.RGB32UI),Te===i.BYTE&&(qe=i.RGB8I),Te===i.SHORT&&(qe=i.RGB16I),Te===i.INT&&(qe=i.RGB32I)),Z===i.RGBA_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RGBA8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RGBA16UI),Te===i.UNSIGNED_INT&&(qe=i.RGBA32UI),Te===i.BYTE&&(qe=i.RGBA8I),Te===i.SHORT&&(qe=i.RGBA16I),Te===i.INT&&(qe=i.RGBA32I)),Z===i.RGB&&(Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.RGB16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.RGB16_SNORM_EXT),Te===i.UNSIGNED_INT_5_9_9_9_REV&&(qe=i.RGB9_E5),Te===i.UNSIGNED_INT_10F_11F_11F_REV&&(qe=i.R11F_G11F_B10F)),Z===i.RGBA){let Je=vt?i0:ln.getTransfer(Ge);Te===i.FLOAT&&(qe=i.RGBA32F),Te===i.HALF_FLOAT&&(qe=i.RGBA16F),Te===i.UNSIGNED_BYTE&&(qe=Je===kt?i.SRGB8_ALPHA8:i.RGBA8),Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.RGBA16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.RGBA16_SNORM_EXT),Te===i.UNSIGNED_SHORT_4_4_4_4&&(qe=i.RGBA4),Te===i.UNSIGNED_SHORT_5_5_5_1&&(qe=i.RGB5_A1)}return(qe===i.R16F||qe===i.R32F||qe===i.RG16F||qe===i.RG32F||qe===i.RGBA16F||qe===i.RGBA32F)&&e.get("EXT_color_buffer_float"),qe}function F(le,Z){let Te;return le?Z===null||Z===xi||Z===ua?Te=i.DEPTH24_STENCIL8:Z===cr?Te=i.DEPTH32F_STENCIL8:Z===Sl&&(Te=i.DEPTH24_STENCIL8,Xe("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):Z===null||Z===xi||Z===ua?Te=i.DEPTH_COMPONENT24:Z===cr?Te=i.DEPTH_COMPONENT32F:Z===Sl&&(Te=i.DEPTH_COMPONENT16),Te}function D(le,Z){return T(le)===!0||le.isFramebufferTexture&&le.minFilter!==Ti&&le.minFilter!==Mi?Math.log2(Math.max(Z.width,Z.height))+1:le.mipmaps!==void 0&&le.mipmaps.length>0?le.mipmaps.length:le.isCompressedTexture&&Array.isArray(le.image)?Z.mipmaps.length:1}function L(le){let Z=le.target;Z.removeEventListener("dispose",L),B(Z),Z.isVideoTexture&&u.delete(Z),Z.isHTMLTexture&&f.delete(Z)}function C(le){let Z=le.target;Z.removeEventListener("dispose",C),z(Z)}function B(le){let Z=n.get(le);if(Z.__webglInit===void 0)return;let Te=le.source,Pe=A.get(Te);if(Pe){let Ge=Pe[Z.__cacheKey];Ge.usedTimes--,Ge.usedTimes===0&&k(le),Object.keys(Pe).length===0&&A.delete(Te)}n.remove(le)}function k(le){let Z=n.get(le);i.deleteTexture(Z.__webglTexture);let Te=le.source,Pe=A.get(Te);delete Pe[Z.__cacheKey],o.memory.textures--}function z(le){let Z=n.get(le);if(le.depthTexture&&(le.depthTexture.dispose(),n.remove(le.depthTexture)),le.isWebGLCubeRenderTarget)for(let Pe=0;Pe<6;Pe++){if(Array.isArray(Z.__webglFramebuffer[Pe]))for(let Ge=0;Ge<Z.__webglFramebuffer[Pe].length;Ge++)i.deleteFramebuffer(Z.__webglFramebuffer[Pe][Ge]);else i.deleteFramebuffer(Z.__webglFramebuffer[Pe]);Z.__webglDepthbuffer&&i.deleteRenderbuffer(Z.__webglDepthbuffer[Pe])}else{if(Array.isArray(Z.__webglFramebuffer))for(let Pe=0;Pe<Z.__webglFramebuffer.length;Pe++)i.deleteFramebuffer(Z.__webglFramebuffer[Pe]);else i.deleteFramebuffer(Z.__webglFramebuffer);if(Z.__webglDepthbuffer&&i.deleteRenderbuffer(Z.__webglDepthbuffer),Z.__webglMultisampledFramebuffer&&i.deleteFramebuffer(Z.__webglMultisampledFramebuffer),Z.__webglColorRenderbuffer)for(let Pe=0;Pe<Z.__webglColorRenderbuffer.length;Pe++)Z.__webglColorRenderbuffer[Pe]&&i.deleteRenderbuffer(Z.__webglColorRenderbuffer[Pe]);Z.__webglDepthRenderbuffer&&i.deleteRenderbuffer(Z.__webglDepthRenderbuffer)}let Te=le.textures;for(let Pe=0,Ge=Te.length;Pe<Ge;Pe++){let vt=n.get(Te[Pe]);vt.__webglTexture&&(i.deleteTexture(vt.__webglTexture),o.memory.textures--),n.remove(Te[Pe])}n.remove(le)}let G=0;function W(){G=0}function Y(){return G}function H(le){G=le}function $(){let le=G;return le>=r.maxTextures&&Xe("WebGLTextures: Trying to use "+le+" texture units while this GPU supports only "+r.maxTextures),G+=1,le}function J(le){let Z=[];return Z.push(le.wrapS),Z.push(le.wrapT),Z.push(le.wrapR||0),Z.push(le.magFilter),Z.push(le.minFilter),Z.push(le.anisotropy),Z.push(le.internalFormat),Z.push(le.format),Z.push(le.type),Z.push(le.generateMipmaps),Z.push(le.premultiplyAlpha),Z.push(le.flipY),Z.push(le.unpackAlignment),Z.push(le.colorSpace),Z.join()}function te(le,Z){let Te=n.get(le);if(le.isVideoTexture&&_e(le),le.isRenderTargetTexture===!1&&le.isExternalTexture!==!0&&le.version>0&&Te.__version!==le.version){let Pe=le.image;if(Pe===null)Xe("WebGLRenderer: Texture marked for update but no image data found.");else if(Pe.complete===!1)Xe("WebGLRenderer: Texture marked for update but image is incomplete");else{Mt(Te,le,Z);return}}else le.isExternalTexture&&(Te.__webglTexture=le.sourceTexture?le.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,Te.__webglTexture,i.TEXTURE0+Z)}function ce(le,Z){let Te=n.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Te.__version!==le.version){Mt(Te,le,Z);return}else le.isExternalTexture&&(Te.__webglTexture=le.sourceTexture?le.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,Te.__webglTexture,i.TEXTURE0+Z)}function he(le,Z){let Te=n.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Te.__version!==le.version){Mt(Te,le,Z);return}t.bindTexture(i.TEXTURE_3D,Te.__webglTexture,i.TEXTURE0+Z)}function ve(le,Z){let Te=n.get(le);if(le.isCubeDepthTexture!==!0&&le.version>0&&Te.__version!==le.version){Et(Te,le,Z);return}t.bindTexture(i.TEXTURE_CUBE_MAP,Te.__webglTexture,i.TEXTURE0+Z)}let Re={[Rd]:i.REPEAT,[la]:i.CLAMP_TO_EDGE,[Id]:i.MIRRORED_REPEAT},Qe={[Ti]:i.NEAREST,[Db]:i.NEAREST_MIPMAP_NEAREST,[Xc]:i.NEAREST_MIPMAP_LINEAR,[Mi]:i.LINEAR,[g0]:i.LINEAR_MIPMAP_NEAREST,[Go]:i.LINEAR_MIPMAP_LINEAR},Fe={[Bb]:i.NEVER,[kb]:i.ALWAYS,[d_]:i.LESS,[Kh]:i.LEQUAL,[Ob]:i.EQUAL,[ku]:i.GEQUAL,[hg]:i.GREATER,[Ub]:i.NOTEQUAL};function mt(le,Z){if(Z.type===cr&&e.has("OES_texture_float_linear")===!1&&(Z.magFilter===Mi||Z.magFilter===g0||Z.magFilter===Xc||Z.magFilter===Go||Z.minFilter===Mi||Z.minFilter===g0||Z.minFilter===Xc||Z.minFilter===Go)&&Xe("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(le,i.TEXTURE_WRAP_S,Re[Z.wrapS]),i.texParameteri(le,i.TEXTURE_WRAP_T,Re[Z.wrapT]),(le===i.TEXTURE_3D||le===i.TEXTURE_2D_ARRAY)&&i.texParameteri(le,i.TEXTURE_WRAP_R,Re[Z.wrapR]),i.texParameteri(le,i.TEXTURE_MAG_FILTER,Qe[Z.magFilter]),i.texParameteri(le,i.TEXTURE_MIN_FILTER,Qe[Z.minFilter]),Z.compareFunction&&(i.texParameteri(le,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(le,i.TEXTURE_COMPARE_FUNC,Fe[Z.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(Z.magFilter===Ti||Z.minFilter!==Xc&&Z.minFilter!==Go||Z.type===cr&&e.has("OES_texture_float_linear")===!1)return;if(Z.anisotropy>1||n.get(Z).__currentAnisotropy){let Te=e.get("EXT_texture_filter_anisotropic");i.texParameterf(le,Te.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(Z.anisotropy,r.getMaxAnisotropy())),n.get(Z).__currentAnisotropy=Z.anisotropy}}}function Ee(le,Z){let Te=!1;le.__webglInit===void 0&&(le.__webglInit=!0,Z.addEventListener("dispose",L));let Pe=Z.source,Ge=A.get(Pe);Ge===void 0&&(Ge={},A.set(Pe,Ge));let vt=J(Z);if(vt!==le.__cacheKey){Ge[vt]===void 0&&(Ge[vt]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,Te=!0),Ge[vt].usedTimes++;let Tt=Ge[le.__cacheKey];Tt!==void 0&&(Ge[le.__cacheKey].usedTimes--,Tt.usedTimes===0&&k(Z)),le.__cacheKey=vt,le.__webglTexture=Ge[vt].texture}return Te}function Ve(le,Z,Te){return Math.floor(Math.floor(le/Te)/Z)}function Ye(le,Z,Te,Pe){let vt=le.updateRanges;if(vt.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,Z.width,Z.height,Te,Pe,Z.data);else{vt.sort((rn,Lt)=>rn.start-Lt.start);let Tt=0;for(let rn=1;rn<vt.length;rn++){let Lt=vt[Tt],Rt=vt[rn],fn=Lt.start+Lt.count,wn=Ve(Rt.start,Z.width,4),Dn=Ve(Lt.start,Z.width,4);Rt.start<=fn+1&&wn===Dn&&Ve(Rt.start+Rt.count-1,Z.width,4)===wn?Lt.count=Math.max(Lt.count,Rt.start+Rt.count-Lt.start):(++Tt,vt[Tt]=Rt)}vt.length=Tt+1;let qe=t.getParameter(i.UNPACK_ROW_LENGTH),Je=t.getParameter(i.UNPACK_SKIP_PIXELS),Pt=t.getParameter(i.UNPACK_SKIP_ROWS);t.pixelStorei(i.UNPACK_ROW_LENGTH,Z.width);for(let rn=0,Lt=vt.length;rn<Lt;rn++){let Rt=vt[rn],fn=Math.floor(Rt.start/4),wn=Math.ceil(Rt.count/4),Dn=fn%Z.width,ye=Math.floor(fn/Z.width),wt=wn,Ze=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,Dn),t.pixelStorei(i.UNPACK_SKIP_ROWS,ye),t.texSubImage2D(i.TEXTURE_2D,0,Dn,ye,wt,Ze,Te,Pe,Z.data)}le.clearUpdateRanges(),t.pixelStorei(i.UNPACK_ROW_LENGTH,qe),t.pixelStorei(i.UNPACK_SKIP_PIXELS,Je),t.pixelStorei(i.UNPACK_SKIP_ROWS,Pt)}}function Mt(le,Z,Te){let Pe=i.TEXTURE_2D;(Z.isDataArrayTexture||Z.isCompressedArrayTexture)&&(Pe=i.TEXTURE_2D_ARRAY),Z.isData3DTexture&&(Pe=i.TEXTURE_3D);let Ge=Ee(le,Z),vt=Z.source;t.bindTexture(Pe,le.__webglTexture,i.TEXTURE0+Te);let Tt=n.get(vt);if(vt.version!==Tt.__version||Ge===!0){if(t.activeTexture(i.TEXTURE0+Te),(typeof ImageBitmap<"u"&&Z.image instanceof ImageBitmap)===!1){let Ze=ln.getPrimaries(ln.workingColorSpace),St=Z.colorSpace===ha?null:ln.getPrimaries(Z.colorSpace),Bt=Z.colorSpace===ha||Ze===St?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,Z.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Z.premultiplyAlpha),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Bt)}t.pixelStorei(i.UNPACK_ALIGNMENT,Z.unpackAlignment);let Je=S(Z.image,!1,r.maxTextureSize);Je=vi(Z,Je);let Pt=s.convert(Z.format,Z.colorSpace),rn=s.convert(Z.type),Lt=I(Z.internalFormat,Pt,rn,Z.normalized,Z.colorSpace,Z.isVideoTexture);mt(Pe,Z);let Rt,fn=Z.mipmaps,wn=Z.isVideoTexture!==!0,Dn=Tt.__version===void 0||Ge===!0,ye=vt.dataReady,wt=D(Z,Je);if(Z.isDepthTexture)Lt=F(Z.format===xo,Z.type),Dn&&(wn?t.texStorage2D(i.TEXTURE_2D,1,Lt,Je.width,Je.height):t.texImage2D(i.TEXTURE_2D,0,Lt,Je.width,Je.height,0,Pt,rn,null));else if(Z.isDataTexture)if(fn.length>0){wn&&Dn&&t.texStorage2D(i.TEXTURE_2D,wt,Lt,fn[0].width,fn[0].height);for(let Ze=0,St=fn.length;Ze<St;Ze++)Rt=fn[Ze],wn?ye&&t.texSubImage2D(i.TEXTURE_2D,Ze,0,0,Rt.width,Rt.height,Pt,rn,Rt.data):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,Pt,rn,Rt.data);Z.generateMipmaps=!1}else wn?(Dn&&t.texStorage2D(i.TEXTURE_2D,wt,Lt,Je.width,Je.height),ye&&Ye(Z,Je,Pt,rn)):t.texImage2D(i.TEXTURE_2D,0,Lt,Je.width,Je.height,0,Pt,rn,Je.data);else if(Z.isCompressedTexture)if(Z.isCompressedArrayTexture){wn&&Dn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,wt,Lt,fn[0].width,fn[0].height,Je.depth);for(let Ze=0,St=fn.length;Ze<St;Ze++)if(Rt=fn[Ze],Z.format!==Ur)if(Pt!==null)if(wn){if(ye)if(Z.layerUpdates.size>0){let Bt=Vb(Rt.width,Rt.height,Z.format,Z.type);for(let ut of Z.layerUpdates){let Ce=Rt.data.subarray(ut*Bt/Rt.data.BYTES_PER_ELEMENT,(ut+1)*Bt/Rt.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ze,0,0,ut,Rt.width,Rt.height,1,Pt,Ce)}Z.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ze,0,0,0,Rt.width,Rt.height,Je.depth,Pt,Rt.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,Ze,Lt,Rt.width,Rt.height,Je.depth,0,Rt.data,0,0);else Xe("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else wn?ye&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,Ze,0,0,0,Rt.width,Rt.height,Je.depth,Pt,rn,Rt.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Ze,Lt,Rt.width,Rt.height,Je.depth,0,Pt,rn,Rt.data)}else{wn&&Dn&&t.texStorage2D(i.TEXTURE_2D,wt,Lt,fn[0].width,fn[0].height);for(let Ze=0,St=fn.length;Ze<St;Ze++)Rt=fn[Ze],Z.format!==Ur?Pt!==null?wn?ye&&t.compressedTexSubImage2D(i.TEXTURE_2D,Ze,0,0,Rt.width,Rt.height,Pt,Rt.data):t.compressedTexImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,Rt.data):Xe("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):wn?ye&&t.texSubImage2D(i.TEXTURE_2D,Ze,0,0,Rt.width,Rt.height,Pt,rn,Rt.data):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,Pt,rn,Rt.data)}else if(Z.isDataArrayTexture)if(wn){if(Dn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,wt,Lt,Je.width,Je.height,Je.depth),ye)if(Z.layerUpdates.size>0){let Ze=Vb(Je.width,Je.height,Z.format,Z.type);for(let St of Z.layerUpdates){let Bt=Je.data.subarray(St*Ze/Je.data.BYTES_PER_ELEMENT,(St+1)*Ze/Je.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,St,Je.width,Je.height,1,Pt,rn,Bt)}Z.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Je.width,Je.height,Je.depth,Pt,rn,Je.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Lt,Je.width,Je.height,Je.depth,0,Pt,rn,Je.data);else if(Z.isData3DTexture)wn?(Dn&&t.texStorage3D(i.TEXTURE_3D,wt,Lt,Je.width,Je.height,Je.depth),ye&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Je.width,Je.height,Je.depth,Pt,rn,Je.data)):t.texImage3D(i.TEXTURE_3D,0,Lt,Je.width,Je.height,Je.depth,0,Pt,rn,Je.data);else if(Z.isFramebufferTexture){if(Dn)if(wn)t.texStorage2D(i.TEXTURE_2D,wt,Lt,Je.width,Je.height);else{let Ze=Je.width,St=Je.height;for(let Bt=0;Bt<wt;Bt++)t.texImage2D(i.TEXTURE_2D,Bt,Lt,Ze,St,0,Pt,rn,null),Ze>>=1,St>>=1}}else if(Z.isHTMLTexture){if("texElementImage2D"in i){let Ze=i.canvas;if(Ze.hasAttribute("layoutsubtree")||Ze.setAttribute("layoutsubtree","true"),Je.parentNode!==Ze){Ze.appendChild(Je),f.add(Z),Ze.onpaint=St=>{let Bt=St.changedElements;for(let ut of f)Bt.includes(ut.image)&&(ut.needsUpdate=!0)},Ze.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,Je);else{let Bt=i.RGBA,ut=i.RGBA,Ce=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,Bt,ut,Ce,Je)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(fn.length>0){if(wn&&Dn){let Ze=zn(fn[0]);t.texStorage2D(i.TEXTURE_2D,wt,Lt,Ze.width,Ze.height)}for(let Ze=0,St=fn.length;Ze<St;Ze++)Rt=fn[Ze],wn?ye&&t.texSubImage2D(i.TEXTURE_2D,Ze,0,0,Pt,rn,Rt):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Pt,rn,Rt);Z.generateMipmaps=!1}else if(wn){if(Dn){let Ze=zn(Je);t.texStorage2D(i.TEXTURE_2D,wt,Lt,Ze.width,Ze.height)}ye&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Pt,rn,Je)}else t.texImage2D(i.TEXTURE_2D,0,Lt,Pt,rn,Je);T(Z)&&R(Pe),Tt.__version=vt.version,Z.onUpdate&&Z.onUpdate(Z)}le.__version=Z.version}function Et(le,Z,Te){if(Z.image.length!==6)return;let Pe=Ee(le,Z),Ge=Z.source;t.bindTexture(i.TEXTURE_CUBE_MAP,le.__webglTexture,i.TEXTURE0+Te);let vt=n.get(Ge);if(Ge.version!==vt.__version||Pe===!0){t.activeTexture(i.TEXTURE0+Te);let Tt=ln.getPrimaries(ln.workingColorSpace),qe=Z.colorSpace===ha?null:ln.getPrimaries(Z.colorSpace),Je=Z.colorSpace===ha||Tt===qe?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,Z.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Z.premultiplyAlpha),t.pixelStorei(i.UNPACK_ALIGNMENT,Z.unpackAlignment),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Je);let Pt=Z.isCompressedTexture||Z.image[0].isCompressedTexture,rn=Z.image[0]&&Z.image[0].isDataTexture,Lt=[];for(let ut=0;ut<6;ut++)!Pt&&!rn?Lt[ut]=S(Z.image[ut],!0,r.maxCubemapSize):Lt[ut]=rn?Z.image[ut].image:Z.image[ut],Lt[ut]=vi(Z,Lt[ut]);let Rt=Lt[0],fn=s.convert(Z.format,Z.colorSpace),wn=s.convert(Z.type),Dn=I(Z.internalFormat,fn,wn,Z.normalized,Z.colorSpace),ye=Z.isVideoTexture!==!0,wt=vt.__version===void 0||Pe===!0,Ze=Ge.dataReady,St=D(Z,Rt);mt(i.TEXTURE_CUBE_MAP,Z);let Bt;if(Pt){ye&&wt&&t.texStorage2D(i.TEXTURE_CUBE_MAP,St,Dn,Rt.width,Rt.height);for(let ut=0;ut<6;ut++){Bt=Lt[ut].mipmaps;for(let Ce=0;Ce<Bt.length;Ce++){let Yt=Bt[Ce];Z.format!==Ur?fn!==null?ye?Ze&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,0,0,Yt.width,Yt.height,fn,Yt.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,Dn,Yt.width,Yt.height,0,Yt.data):Xe("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,0,0,Yt.width,Yt.height,fn,wn,Yt.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,Dn,Yt.width,Yt.height,0,fn,wn,Yt.data)}}}else{if(Bt=Z.mipmaps,ye&&wt){Bt.length>0&&St++;let ut=zn(Lt[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,St,Dn,ut.width,ut.height)}for(let ut=0;ut<6;ut++)if(rn){ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,0,0,Lt[ut].width,Lt[ut].height,fn,wn,Lt[ut].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,Dn,Lt[ut].width,Lt[ut].height,0,fn,wn,Lt[ut].data);for(let Ce=0;Ce<Bt.length;Ce++){let nr=Bt[Ce].image[ut].image;ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,0,0,nr.width,nr.height,fn,wn,nr.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,Dn,nr.width,nr.height,0,fn,wn,nr.data)}}else{ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,0,0,fn,wn,Lt[ut]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,Dn,fn,wn,Lt[ut]);for(let Ce=0;Ce<Bt.length;Ce++){let Yt=Bt[Ce];ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,0,0,fn,wn,Yt.image[ut]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,Dn,fn,wn,Yt.image[ut])}}}T(Z)&&R(i.TEXTURE_CUBE_MAP),vt.__version=Ge.version,Z.onUpdate&&Z.onUpdate(Z)}le.__version=Z.version}function It(le,Z,Te,Pe,Ge,vt){let Tt=s.convert(Te.format,Te.colorSpace),qe=s.convert(Te.type),Je=I(Te.internalFormat,Tt,qe,Te.normalized,Te.colorSpace),Pt=n.get(Z),rn=n.get(Te);if(rn.__renderTarget=Z,!Pt.__hasExternalTextures){let Lt=Math.max(1,Z.width>>vt),Rt=Math.max(1,Z.height>>vt);Ge===i.TEXTURE_3D||Ge===i.TEXTURE_2D_ARRAY?t.texImage3D(Ge,vt,Je,Lt,Rt,Z.depth,0,Tt,qe,null):t.texImage2D(Ge,vt,Je,Lt,Rt,0,Tt,qe,null)}t.bindFramebuffer(i.FRAMEBUFFER,le),bn(Z)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Pe,Ge,rn.__webglTexture,0,tn(Z)):(Ge===i.TEXTURE_2D||Ge>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&Ge<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Pe,Ge,rn.__webglTexture,vt),t.bindFramebuffer(i.FRAMEBUFFER,null)}function dn(le,Z,Te){if(i.bindRenderbuffer(i.RENDERBUFFER,le),Z.depthBuffer){let Pe=Z.depthTexture,Ge=Pe&&Pe.isDepthTexture?Pe.type:null,vt=F(Z.stencilBuffer,Ge),Tt=Z.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;bn(Z)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,tn(Z),vt,Z.width,Z.height):Te?i.renderbufferStorageMultisample(i.RENDERBUFFER,tn(Z),vt,Z.width,Z.height):i.renderbufferStorage(i.RENDERBUFFER,vt,Z.width,Z.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,Tt,i.RENDERBUFFER,le)}else{let Pe=Z.textures;for(let Ge=0;Ge<Pe.length;Ge++){let vt=Pe[Ge],Tt=s.convert(vt.format,vt.colorSpace),qe=s.convert(vt.type),Je=I(vt.internalFormat,Tt,qe,vt.normalized,vt.colorSpace);bn(Z)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,tn(Z),Je,Z.width,Z.height):Te?i.renderbufferStorageMultisample(i.RENDERBUFFER,tn(Z),Je,Z.width,Z.height):i.renderbufferStorage(i.RENDERBUFFER,Je,Z.width,Z.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Gt(le,Z,Te){let Pe=Z.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,le),!(Z.depthTexture&&Z.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let Ge=n.get(Z.depthTexture);if(Ge.__renderTarget=Z,(!Ge.__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),Pe){if(Ge.__webglInit===void 0&&(Ge.__webglInit=!0,Z.depthTexture.addEventListener("dispose",L)),Ge.__webglTexture===void 0){Ge.__webglTexture=i.createTexture(),t.bindTexture(i.TEXTURE_CUBE_MAP,Ge.__webglTexture),mt(i.TEXTURE_CUBE_MAP,Z.depthTexture);let Pt=s.convert(Z.depthTexture.format),rn=s.convert(Z.depthTexture.type),Lt;Z.depthTexture.format===Gs?Lt=i.DEPTH_COMPONENT24:Z.depthTexture.format===xo&&(Lt=i.DEPTH24_STENCIL8);for(let Rt=0;Rt<6;Rt++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Rt,0,Lt,Z.width,Z.height,0,Pt,rn,null)}}else te(Z.depthTexture,0);let vt=Ge.__webglTexture,Tt=tn(Z),qe=Pe?i.TEXTURE_CUBE_MAP_POSITIVE_X+Te:i.TEXTURE_2D,Je=Z.depthTexture.format===xo?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(Z.depthTexture.format===Gs)bn(Z)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Je,qe,vt,0,Tt):i.framebufferTexture2D(i.FRAMEBUFFER,Je,qe,vt,0);else if(Z.depthTexture.format===xo)bn(Z)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Je,qe,vt,0,Tt):i.framebufferTexture2D(i.FRAMEBUFFER,Je,qe,vt,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function $e(le){let Z=n.get(le),Te=le.isWebGLCubeRenderTarget===!0;if(Z.__boundDepthTexture!==le.depthTexture){let Pe=le.depthTexture;if(Z.__depthDisposeCallback&&Z.__depthDisposeCallback(),Pe){let Ge=()=>{delete Z.__boundDepthTexture,delete Z.__depthDisposeCallback,Pe.removeEventListener("dispose",Ge)};Pe.addEventListener("dispose",Ge),Z.__depthDisposeCallback=Ge}Z.__boundDepthTexture=Pe}if(le.depthTexture&&!Z.__autoAllocateDepthBuffer)if(Te)for(let Pe=0;Pe<6;Pe++)Gt(Z.__webglFramebuffer[Pe],le,Pe);else{let Pe=le.texture.mipmaps;Pe&&Pe.length>0?Gt(Z.__webglFramebuffer[0],le,0):Gt(Z.__webglFramebuffer,le,0)}else if(Te){Z.__webglDepthbuffer=[];for(let Pe=0;Pe<6;Pe++)if(t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglFramebuffer[Pe]),Z.__webglDepthbuffer[Pe]===void 0)Z.__webglDepthbuffer[Pe]=i.createRenderbuffer(),dn(Z.__webglDepthbuffer[Pe],le,!1);else{let Ge=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,vt=Z.__webglDepthbuffer[Pe];i.bindRenderbuffer(i.RENDERBUFFER,vt),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ge,i.RENDERBUFFER,vt)}}else{let Pe=le.texture.mipmaps;if(Pe&&Pe.length>0?t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglFramebuffer),Z.__webglDepthbuffer===void 0)Z.__webglDepthbuffer=i.createRenderbuffer(),dn(Z.__webglDepthbuffer,le,!1);else{let Ge=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,vt=Z.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,vt),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ge,i.RENDERBUFFER,vt)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function ot(le,Z,Te){let Pe=n.get(le);Z!==void 0&&It(Pe.__webglFramebuffer,le,le.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Te!==void 0&&$e(le)}function nt(le){let Z=le.texture,Te=n.get(le),Pe=n.get(Z);le.addEventListener("dispose",C);let Ge=le.textures,vt=le.isWebGLCubeRenderTarget===!0,Tt=Ge.length>1;if(Tt||(Pe.__webglTexture===void 0&&(Pe.__webglTexture=i.createTexture()),Pe.__version=Z.version,o.memory.textures++),vt){Te.__webglFramebuffer=[];for(let qe=0;qe<6;qe++)if(Z.mipmaps&&Z.mipmaps.length>0){Te.__webglFramebuffer[qe]=[];for(let Je=0;Je<Z.mipmaps.length;Je++)Te.__webglFramebuffer[qe][Je]=i.createFramebuffer()}else Te.__webglFramebuffer[qe]=i.createFramebuffer()}else{if(Z.mipmaps&&Z.mipmaps.length>0){Te.__webglFramebuffer=[];for(let qe=0;qe<Z.mipmaps.length;qe++)Te.__webglFramebuffer[qe]=i.createFramebuffer()}else Te.__webglFramebuffer=i.createFramebuffer();if(Tt)for(let qe=0,Je=Ge.length;qe<Je;qe++){let Pt=n.get(Ge[qe]);Pt.__webglTexture===void 0&&(Pt.__webglTexture=i.createTexture(),o.memory.textures++)}if(le.samples>0&&bn(le)===!1){Te.__webglMultisampledFramebuffer=i.createFramebuffer(),Te.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,Te.__webglMultisampledFramebuffer);for(let qe=0;qe<Ge.length;qe++){let Je=Ge[qe];Te.__webglColorRenderbuffer[qe]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,Te.__webglColorRenderbuffer[qe]);let Pt=s.convert(Je.format,Je.colorSpace),rn=s.convert(Je.type),Lt=I(Je.internalFormat,Pt,rn,Je.normalized,Je.colorSpace,le.isXRRenderTarget===!0),Rt=tn(le);i.renderbufferStorageMultisample(i.RENDERBUFFER,Rt,Lt,le.width,le.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+qe,i.RENDERBUFFER,Te.__webglColorRenderbuffer[qe])}i.bindRenderbuffer(i.RENDERBUFFER,null),le.depthBuffer&&(Te.__webglDepthRenderbuffer=i.createRenderbuffer(),dn(Te.__webglDepthRenderbuffer,le,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(vt){t.bindTexture(i.TEXTURE_CUBE_MAP,Pe.__webglTexture),mt(i.TEXTURE_CUBE_MAP,Z);for(let qe=0;qe<6;qe++)if(Z.mipmaps&&Z.mipmaps.length>0)for(let Je=0;Je<Z.mipmaps.length;Je++)It(Te.__webglFramebuffer[qe][Je],le,Z,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+qe,Je);else It(Te.__webglFramebuffer[qe],le,Z,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+qe,0);T(Z)&&R(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Tt){for(let qe=0,Je=Ge.length;qe<Je;qe++){let Pt=Ge[qe],rn=n.get(Pt),Lt=i.TEXTURE_2D;(le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(Lt=le.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(Lt,rn.__webglTexture),mt(Lt,Pt),It(Te.__webglFramebuffer,le,Pt,i.COLOR_ATTACHMENT0+qe,Lt,0),T(Pt)&&R(Lt)}t.unbindTexture()}else{let qe=i.TEXTURE_2D;if((le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(qe=le.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(qe,Pe.__webglTexture),mt(qe,Z),Z.mipmaps&&Z.mipmaps.length>0)for(let Je=0;Je<Z.mipmaps.length;Je++)It(Te.__webglFramebuffer[Je],le,Z,i.COLOR_ATTACHMENT0,qe,Je);else It(Te.__webglFramebuffer,le,Z,i.COLOR_ATTACHMENT0,qe,0);T(Z)&&R(qe),t.unbindTexture()}le.depthBuffer&&$e(le)}function bt(le){let Z=le.textures;for(let Te=0,Pe=Z.length;Te<Pe;Te++){let Ge=Z[Te];if(T(Ge)){let vt=P(le),Tt=n.get(Ge).__webglTexture;t.bindTexture(vt,Tt),R(vt),t.unbindTexture()}}}let yt=[],hn=[];function en(le){if(le.samples>0){if(bn(le)===!1){let Z=le.textures,Te=le.width,Pe=le.height,Ge=i.COLOR_BUFFER_BIT,vt=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Tt=n.get(le),qe=Z.length>1;if(qe)for(let Pt=0;Pt<Z.length;Pt++)t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pt,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pt,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,Tt.__webglMultisampledFramebuffer);let Je=le.texture.mipmaps;Je&&Je.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Tt.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Tt.__webglFramebuffer);for(let Pt=0;Pt<Z.length;Pt++){if(le.resolveDepthBuffer&&(le.depthBuffer&&(Ge|=i.DEPTH_BUFFER_BIT),le.stencilBuffer&&le.resolveStencilBuffer&&(Ge|=i.STENCIL_BUFFER_BIT)),qe){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,Tt.__webglColorRenderbuffer[Pt]);let rn=n.get(Z[Pt]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,rn,0)}i.blitFramebuffer(0,0,Te,Pe,0,0,Te,Pe,Ge,i.NEAREST),l===!0&&(yt.length=0,hn.length=0,yt.push(i.COLOR_ATTACHMENT0+Pt),le.depthBuffer&&le.resolveDepthBuffer===!1&&(yt.push(vt),hn.push(vt),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,hn)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,yt))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),qe)for(let Pt=0;Pt<Z.length;Pt++){t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pt,i.RENDERBUFFER,Tt.__webglColorRenderbuffer[Pt]);let rn=n.get(Z[Pt]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pt,i.TEXTURE_2D,rn,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Tt.__webglMultisampledFramebuffer)}else if(le.depthBuffer&&le.resolveDepthBuffer===!1&&l){let Z=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[Z])}}}function tn(le){return Math.min(r.maxSamples,le.samples)}function bn(le){let Z=n.get(le);return le.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&Z.__useRenderToTexture!==!1}function _e(le){let Z=o.render.frame;u.get(le)!==Z&&(u.set(le,Z),le.update())}function vi(le,Z){let Te=le.colorSpace,Pe=le.format,Ge=le.type;return le.isCompressedTexture===!0||le.isVideoTexture===!0||Te!==n0&&Te!==ha&&(ln.getTransfer(Te)===kt?(Pe!==Ur||Ge!==Ji)&&Xe("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):ze("WebGLTextures: Unsupported texture color space:",Te)),Z}function zn(le){return typeof HTMLImageElement<"u"&&le instanceof HTMLImageElement?(c.width=le.naturalWidth||le.width,c.height=le.naturalHeight||le.height):typeof VideoFrame<"u"&&le instanceof VideoFrame?(c.width=le.displayWidth,c.height=le.displayHeight):(c.width=le.width,c.height=le.height),c}this.allocateTextureUnit=$,this.resetTextureUnits=W,this.getTextureUnits=Y,this.setTextureUnits=H,this.setTexture2D=te,this.setTexture2DArray=ce,this.setTexture3D=he,this.setTextureCube=ve,this.rebindTextures=ot,this.setupRenderTarget=nt,this.updateRenderTargetMipmap=bt,this.updateMultisampleRenderTarget=en,this.setupDepthRenderbuffer=$e,this.setupFrameBufferTexture=It,this.useMultisampledRTT=bn,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function Hxe(i,e){function t(n,r=ha){let s,o=ln.getTransfer(r);if(n===Ji)return i.UNSIGNED_BYTE;if(n===ig)return i.UNSIGNED_SHORT_4_4_4_4;if(n===rg)return i.UNSIGNED_SHORT_5_5_5_1;if(n===sg)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===og)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Vh)return i.BYTE;if(n===Gh)return i.SHORT;if(n===Sl)return i.UNSIGNED_SHORT;if(n===Kr)return i.INT;if(n===xi)return i.UNSIGNED_INT;if(n===cr)return i.FLOAT;if(n===Wi)return i.HALF_FLOAT;if(n===f_)return i.ALPHA;if(n===Od)return i.RGB;if(n===Ur)return i.RGBA;if(n===Gs)return i.DEPTH_COMPONENT;if(n===xo)return i.DEPTH_STENCIL;if(n===Ud)return i.RED;if(n===qh)return i.RED_INTEGER;if(n===js)return i.RG;if(n===Hh)return i.RG_INTEGER;if(n===v0)return i.RGBA_INTEGER;if(n===Wh||n===jh||n===Xh||n===$h)if(o===kt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Wh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===jh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Xh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===$h)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Wh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===jh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Xh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===$h)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===ag||n===lg||n===cg||n===ug)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===ag)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===lg)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===cg)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ug)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===_0||n===x0||n===y0||n===b0||n===w0||n===Yh||n===S0)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===_0||n===x0)return o===kt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===y0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===b0)return s.COMPRESSED_R11_EAC;if(n===w0)return s.COMPRESSED_SIGNED_R11_EAC;if(n===Yh)return s.COMPRESSED_RG11_EAC;if(n===S0)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===T0||n===E0||n===M0||n===C0||n===R0||n===I0||n===P0||n===L0||n===D0||n===N0||n===F0||n===B0||n===O0||n===U0)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===T0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===E0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===M0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===C0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===R0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===I0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===P0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===L0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===D0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===N0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===F0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===B0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===O0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===U0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===k0||n===z0||n===V0)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===k0)return o===kt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===z0)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===V0)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===G0||n===q0||n===Zh||n===H0)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===G0)return s.COMPRESSED_RED_RGTC1_EXT;if(n===q0)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Zh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===H0)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===ua?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var Wxe=`4093+}`,Bxe=[new re(1,0,0),new re(-1,0,0),new re(0,1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1)],Oxe=[new re(0,-1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1),new re(0,-1,0),new re(0,-1,0)],eK=new cn,zb=new re,PF=new re;function Uxe(i,e,t){let n=new zc,r=new Oe,s=new Oe,o=new xn,a=new mM,l=new AM,c={},u=t.maxTextureSize,f={[zo]:mi,[mi]:zo,[vr]:vr},d=new ds({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Oe},radius:{value:4}},vertexShader:Nxe,fragmentShader:Fxe}),A=d.clone();A.defines.HORIZONTAL_PASS=1;let y=new Xn;y.setAttribute("position",new Hi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let w=new Hn(y,d),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=d0;let T=this.type;this.render=function(D,L,C){if(S.enabled===!1||S.autoUpdate===!1&&S.needsUpdate===!1||D.length===0)return;this.type===LM&&(Xe("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=d0);let B=i.getRenderTarget(),k=i.getActiveCubeFace(),z=i.getActiveMipmapLevel(),G=i.state;G.setBlending(ps),G.buffers.depth.getReversed()===!0?G.buffers.color.setClear(0,0,0,0):G.buffers.color.setClear(1,1,1,1),G.buffers.depth.setTest(!0),G.setScissorTest(!1);let W=T!==this.type;W&&L.traverse(function(Y){Y.material&&(Array.isArray(Y.material)?Y.material.forEach(H=>H.needsUpdate=!0):Y.material.needsUpdate=!0)});for(let Y=0,H=D.length;Y<H;Y++){let $=D[Y],J=$.shadow;if(J===void 0){Xe("WebGLShadowMap:",$,"has no shadow.");continue}if(J.autoUpdate===!1&&J.needsUpdate===!1)continue;r.copy(J.mapSize);let te=J.getFrameExtents();r.multiply(te),s.copy(J.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/te.x),r.x=s.x*te.x,J.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/te.y),r.y=s.y*te.y,J.mapSize.y=s.y));let ce=i.state.buffers.depth.getReversed();if(J.camera._reversedDepth=ce,J.map===null||W===!0){if(J.map!==null&&(J.map.depthTexture!==null&&(J.map.depthTexture.dispose(),J.map.depthTexture=null),J.map.dispose()),this.type===Vc){if($.isPointLight){Xe("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}J.map=new Oa(r.x,r.y,{format:Ws,type:Wi,minFilter:Mi,magFilter:Mi,generateMipmaps:!1}),J.map.texture.name=$.name+".shadowMap",J.map.depthTexture=new Es(r.x,r.y,cr),J.map.depthTexture.name=$.name+".shadowMapDepth",J.map.depthTexture.format=Vs,J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=Ti,J.map.depthTexture.magFilter=Ti}else $.isPointLight?(J.map=new HM(r.x),J.map.depthTexture=new e_(r.x,xi)):(J.map=new Oa(r.x,r.y),J.map.depthTexture=new Es(r.x,r.y,xi)),J.map.depthTexture.name=$.name+".shadowMap",J.map.depthTexture.format=Vs,this.type===d0?(J.map.depthTexture.compareFunction=ce?Fu:Xh,J.map.depthTexture.minFilter=Mi,J.map.depthTexture.magFilter=Mi):(J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=Ti,J.map.depthTexture.magFilter=Ti);J.camera.updateProjectionMatrix()}let he=J.map.isWebGLCubeRenderTarget?6:1;for(let ve=0;ve<he;ve++){if(J.map.isWebGLCubeRenderTarget)i.setRenderTarget(J.map,ve),i.clear();else{ve===0&&(i.setRenderTarget(J.map),i.clear());let Re=J.getViewport(ve);o.set(s.x*Re.x,s.y*Re.y,s.x*Re.z,s.y*Re.w),G.viewport(o)}if($.isPointLight){let Re=J.camera,Qe=J.matrix,Fe=$.distance||Re.far;Fe!==Re.far&&(Re.far=Fe,Re.updateProjectionMatrix()),zb.setFromMatrixPosition($.matrixWorld),Re.position.copy(zb),PF.copy(Re.position),PF.add(Bxe[ve]),Re.up.copy(Oxe[ve]),Re.lookAt(PF),Re.updateMatrixWorld(),Qe.makeTranslation(-zb.x,-zb.y,-zb.z),eK.multiplyMatrices(Re.projectionMatrix,Re.matrixWorldInverse),J._frustum.setFromProjectionMatrix(eK,Re.coordinateSystem,Re.reversedDepth)}else J.updateMatrices($);n=J.getFrustum(),P(L,C,J.camera,$,this.type)}J.isPointLightShadow!==!0&&this.type===Vc&&R(J,C),J.needsUpdate=!1}T=this.type,S.needsUpdate=!1,i.setRenderTarget(B,k,z)};function R(D,L){let C=e.update(w);d.defines.VSM_SAMPLES!==D.blurSamples&&(d.defines.VSM_SAMPLES=D.blurSamples,A.defines.VSM_SAMPLES=D.blurSamples,d.needsUpdate=!0,A.needsUpdate=!0),D.mapPass===null&&(D.mapPass=new Oa(r.x,r.y,{format:Ws,type:Wi})),d.uniforms.shadow_pass.value=D.map.depthTexture,d.uniforms.resolution.value=D.mapSize,d.uniforms.radius.value=D.radius,i.setRenderTarget(D.mapPass),i.clear(),i.renderBufferDirect(L,null,C,d,w,null),A.uniforms.shadow_pass.value=D.mapPass.texture,A.uniforms.resolution.value=D.mapSize,A.uniforms.radius.value=D.radius,i.setRenderTarget(D.map),i.clear(),i.renderBufferDirect(L,null,C,A,w,null)}function I(D,L,C,B){let k=null,z=C.isPointLight===!0?D.customDistanceMaterial:D.customDepthMaterial;if(z!==void 0)k=z;else if(k=C.isPointLight===!0?l:a,i.localClippingEnabled&&L.clipShadows===!0&&Array.isArray(L.clippingPlanes)&&L.clippingPlanes.length!==0||L.displacementMap&&L.displacementScale!==0||L.alphaMap&&L.alphaTest>0||L.map&&L.alphaTest>0||L.alphaToCoverage===!0){let G=k.uuid,W=L.uuid,Y=c[G];Y===void 0&&(Y={},c[G]=Y);let H=Y[W];H===void 0&&(H=k.clone(),Y[W]=H,L.addEventListener("dispose",F)),k=H}if(k.visible=L.visible,k.wireframe=L.wireframe,B===Vc?k.side=L.shadowSide!==null?L.shadowSide:L.side:k.side=L.shadowSide!==null?L.shadowSide:f[L.side],k.alphaMap=L.alphaMap,k.alphaTest=L.alphaToCoverage===!0?.5:L.alphaTest,k.map=L.map,k.clipShadows=L.clipShadows,k.clippingPlanes=L.clippingPlanes,k.clipIntersection=L.clipIntersection,k.displacementMap=L.displacementMap,k.displacementScale=L.displacementScale,k.displacementBias=L.displacementBias,k.wireframeLinewidth=L.wireframeLinewidth,k.linewidth=L.linewidth,C.isPointLight===!0&&k.isMeshDistanceMaterial===!0){let G=i.properties.get(k);G.light=C}return k}function P(D,L,C,B,k){if(D.visible===!1)return;if(D.layers.test(L.layers)&&(D.isMesh||D.isLine||D.isPoints)&&(D.castShadow||D.receiveShadow&&k===Vc)&&(!D.frustumCulled||n.intersectsObject(D))){D.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,D.matrixWorld);let W=e.update(D),Y=D.material;if(Array.isArray(Y)){let H=W.groups;for(let $=0,J=H.length;$<J;$++){let te=H[$],ce=Y[te.materialIndex];if(ce&&ce.visible){let he=I(D,ce,B,k);D.onBeforeShadow(i,D,L,C,W,he,te),i.renderBufferDirect(C,null,W,he,D,te),D.onAfterShadow(i,D,L,C,W,he,te)}}}else if(Y.visible){let H=I(D,Y,B,k);D.onBeforeShadow(i,D,L,C,W,H,null),i.renderBufferDirect(C,null,W,H,D,null),D.onAfterShadow(i,D,L,C,W,H,null)}}let G=D.children;for(let W=0,Y=G.length;W<Y;W++)P(G[W],L,C,B,k)}function F(D){D.target.removeEventListener("dispose",F);for(let C in c){let B=c[C],k=D.target.uuid;k in B&&(B[k].dispose(),delete B[k])}}}function kxe(i,e){function t(){let ye=!1,wt=new xn,Ze=null,St=new xn(0,0,0,0);return{setMask:function(Bt){Ze!==Bt&&!ye&&(i.colorMask(Bt,Bt,Bt,Bt),Ze=Bt)},setLocked:function(Bt){ye=Bt},setClear:function(Bt,ut,Ce,Yt,nr){nr===!0&&(Bt*=Yt,ut*=Yt,Ce*=Yt),wt.set(Bt,ut,Ce,Yt),St.equals(wt)===!1&&(i.clearColor(Bt,ut,Ce,Yt),St.copy(wt))},reset:function(){ye=!1,Ze=null,St.set(-1,0,0,0)}}}function n(){let ye=!1,wt=!1,Ze=null,St=null,Bt=null;return{setReversed:function(ut){if(wt!==ut){let Ce=e.get("EXT_clip_control");ut?Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.ZERO_TO_ONE_EXT):Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.NEGATIVE_ONE_TO_ONE_EXT),wt=ut;let Yt=Bt;Bt=null,this.setClear(Yt)}},getReversed:function(){return wt},setTest:function(ut){ut?Ye(i.DEPTH_TEST):Mt(i.DEPTH_TEST)},setMask:function(ut){Ze!==ut&&!ye&&(i.depthMask(ut),Ze=ut)},setFunc:function(ut){if(wt&&(ut=Ob[ut]),St!==ut){switch(ut){case LA:i.depthFunc(i.NEVER);break;case DA:i.depthFunc(i.ALWAYS);break;case NA:i.depthFunc(i.LESS);break;case Ch:i.depthFunc(i.LEQUAL);break;case FA:i.depthFunc(i.EQUAL);break;case BA:i.depthFunc(i.GEQUAL);break;case OA:i.depthFunc(i.GREATER);break;case UA:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}St=ut}},setLocked:function(ut){ye=ut},setClear:function(ut){Bt!==ut&&(Bt=ut,wt&&(ut=1-ut),i.clearDepth(ut))},reset:function(){ye=!1,Ze=null,St=null,Bt=null,wt=!1}}}function r(){let ye=!1,wt=null,Ze=null,St=null,Bt=null,ut=null,Ce=null,Yt=null,nr=null;return{setTest:function(Fn){ye||(Fn?Ye(i.STENCIL_TEST):Mt(i.STENCIL_TEST))},setMask:function(Fn){wt!==Fn&&!ye&&(i.stencilMask(Fn),wt=Fn)},setFunc:function(Fn,rs,Lr){(Ze!==Fn||St!==rs||Bt!==Lr)&&(i.stencilFunc(Fn,rs,Lr),Ze=Fn,St=rs,Bt=Lr)},setOp:function(Fn,rs,Lr){(ut!==Fn||Ce!==rs||Yt!==Lr)&&(i.stencilOp(Fn,rs,Lr),ut=Fn,Ce=rs,Yt=Lr)},setLocked:function(Fn){ye=Fn},setClear:function(Fn){nr!==Fn&&(i.clearStencil(Fn),nr=Fn)},reset:function(){ye=!1,wt=null,Ze=null,St=null,Bt=null,ut=null,Ce=null,Yt=null,nr=null}}}let s=new t,o=new n,a=new r,l=new WeakMap,c=new WeakMap,u={},f={},d={},A=new WeakMap,y=[],w=null,S=!1,T=null,R=null,I=null,P=null,F=null,D=null,L=null,C=new zt(0,0,0),B=0,k=!1,z=null,G=null,W=null,Y=null,H=null,$=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS),J=!1,te=0,ce=i.getParameter(i.VERSION);ce.indexOf("WebGL")!==-1?(te=parseFloat(/^WebGL (\d)/.exec(ce)[1]),J=te>=1):ce.indexOf("OpenGL ES")!==-1&&(te=parseFloat(/^OpenGL ES (\d)/.exec(ce)[1]),J=te>=2);let he=null,ve={},Re=i.getParameter(i.SCISSOR_BOX),Qe=i.getParameter(i.VIEWPORT),Fe=new xn().fromArray(Re),mt=new xn().fromArray(Qe);function Ee(ye,wt,Ze,St){let Bt=new Uint8Array(4),ut=i.createTexture();i.bindTexture(ye,ut),i.texParameteri(ye,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(ye,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Ce=0;Ce<Ze;Ce++)ye===i.TEXTURE_3D||ye===i.TEXTURE_2D_ARRAY?i.texImage3D(wt,0,i.RGBA,1,1,St,0,i.RGBA,i.UNSIGNED_BYTE,Bt):i.texImage2D(wt+Ce,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,Bt);return ut}let Ve={};Ve[i.TEXTURE_2D]=Ee(i.TEXTURE_2D,i.TEXTURE_2D,1),Ve[i.TEXTURE_CUBE_MAP]=Ee(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Ve[i.TEXTURE_2D_ARRAY]=Ee(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Ve[i.TEXTURE_3D]=Ee(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),Ye(i.DEPTH_TEST),o.setFunc(Ch),bt(!1),yt(hb),Ye(i.CULL_FACE),ot(ps);function Ye(ye){u[ye]!==!0&&(i.enable(ye),u[ye]=!0)}function Mt(ye){u[ye]!==!1&&(i.disable(ye),u[ye]=!1)}function Et(ye,wt){return d[ye]!==wt?(i.bindFramebuffer(ye,wt),d[ye]=wt,ye===i.DRAW_FRAMEBUFFER&&(d[i.FRAMEBUFFER]=wt),ye===i.FRAMEBUFFER&&(d[i.DRAW_FRAMEBUFFER]=wt),!0):!1}function Pt(ye,wt){let Ze=y,St=!1;if(ye){Ze=A.get(wt),Ze===void 0&&(Ze=[],A.set(wt,Ze));let Bt=ye.textures;if(Ze.length!==Bt.length||Ze[0]!==i.COLOR_ATTACHMENT0){for(let ut=0,Ce=Bt.length;ut<Ce;ut++)Ze[ut]=i.COLOR_ATTACHMENT0+ut;Ze.length=Bt.length,St=!0}}else Ze[0]!==i.BACK&&(Ze[0]=i.BACK,St=!0);St&&i.drawBuffers(Ze)}function dn(ye){return w!==ye?(i.useProgram(ye),w=ye,!0):!1}let Gt={[oo]:i.FUNC_ADD,[db]:i.FUNC_SUBTRACT,[pb]:i.FUNC_REVERSE_SUBTRACT};Gt[DM]=i.MIN,Gt[NM]=i.MAX;let $e={[Nu]:i.ZERO,[mb]:i.ONE,[Ab]:i.SRC_COLOR,[Jp]:i.SRC_ALPHA,[bb]:i.SRC_ALPHA_SATURATE,[xb]:i.DST_COLOR,[vb]:i.DST_ALPHA,[gb]:i.ONE_MINUS_SRC_COLOR,[e0]:i.ONE_MINUS_SRC_ALPHA,[yb]:i.ONE_MINUS_DST_COLOR,[_b]:i.ONE_MINUS_DST_ALPHA,[_Z]:i.CONSTANT_COLOR,[xZ]:i.ONE_MINUS_CONSTANT_COLOR,[yZ]:i.CONSTANT_ALPHA,[bZ]:i.ONE_MINUS_CONSTANT_ALPHA};function ot(ye,wt,Ze,St,Bt,ut,Ce,Yt,nr,Fn){if(ye===ps){S===!0&&(Mt(i.BLEND),S=!1);return}if(S===!1&&(Ye(i.BLEND),S=!0),ye!==Dd){if(ye!==T||Fn!==k){if((R!==oo||F!==oo)&&(i.blendEquation(i.FUNC_ADD),R=oo,F=oo),Fn)switch(ye){case Ts:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Dh:i.blendFunc(i.ONE,i.ONE);break;case Nh:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Fh:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:ze("WebGLState: Invalid blending: ",ye);break}else switch(ye){case Ts:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Dh:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case Nh:ze("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Fh:ze("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ze("WebGLState: Invalid blending: ",ye);break}I=null,P=null,D=null,L=null,C.set(0,0,0),B=0,T=ye,k=Fn}return}Bt=Bt||wt,ut=ut||Ze,Ce=Ce||St,(wt!==R||Bt!==F)&&(i.blendEquationSeparate(Gt[wt],Gt[Bt]),R=wt,F=Bt),(Ze!==I||St!==P||ut!==D||Ce!==L)&&(i.blendFuncSeparate($e[Ze],$e[St],$e[ut],$e[Ce]),I=Ze,P=St,D=ut,L=Ce),(Yt.equals(C)===!1||nr!==B)&&(i.blendColor(Yt.r,Yt.g,Yt.b,nr),C.copy(Yt),B=nr),T=ye,k=!1}function nt(ye,wt){ye.side===vr?Mt(i.CULL_FACE):Ye(i.CULL_FACE);let Ze=ye.side===mi;wt&&(Ze=!Ze),bt(Ze),ye.blending===Ts&&ye.transparent===!1?ot(ps):ot(ye.blending,ye.blendEquation,ye.blendSrc,ye.blendDst,ye.blendEquationAlpha,ye.blendSrcAlpha,ye.blendDstAlpha,ye.blendColor,ye.blendAlpha,ye.premultipliedAlpha),o.setFunc(ye.depthFunc),o.setTest(ye.depthTest),o.setMask(ye.depthWrite),s.setMask(ye.colorWrite);let St=ye.stencilWrite;a.setTest(St),St&&(a.setMask(ye.stencilWriteMask),a.setFunc(ye.stencilFunc,ye.stencilRef,ye.stencilFuncMask),a.setOp(ye.stencilFail,ye.stencilZFail,ye.stencilZPass)),en(ye.polygonOffset,ye.polygonOffsetFactor,ye.polygonOffsetUnits),ye.alphaToCoverage===!0?Ye(i.SAMPLE_ALPHA_TO_COVERAGE):Mt(i.SAMPLE_ALPHA_TO_COVERAGE)}function bt(ye){z!==ye&&(ye?i.frontFace(i.CW):i.frontFace(i.CCW),z=ye)}function yt(ye){ye!==PM?(Ye(i.CULL_FACE),ye!==G&&(ye===hb?i.cullFace(i.BACK):ye===IM?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Mt(i.CULL_FACE),G=ye}function hn(ye){ye!==W&&(J&&i.lineWidth(ye),W=ye)}function en(ye,wt,Ze){ye?(Ye(i.POLYGON_OFFSET_FILL),(Y!==wt||H!==Ze)&&(Y=wt,H=Ze,o.getReversed()&&(wt=-wt),i.polygonOffset(wt,Ze))):Mt(i.POLYGON_OFFSET_FILL)}function tn(ye){ye?Ye(i.SCISSOR_TEST):Mt(i.SCISSOR_TEST)}function bn(ye){ye===void 0&&(ye=i.TEXTURE0+$-1),he!==ye&&(i.activeTexture(ye),he=ye)}function _e(ye,wt,Ze){Ze===void 0&&(he===null?Ze=i.TEXTURE0+$-1:Ze=he);let St=ve[Ze];St===void 0&&(St={type:void 0,texture:void 0},ve[Ze]=St),(St.type!==ye||St.texture!==wt)&&(he!==Ze&&(i.activeTexture(Ze),he=Ze),i.bindTexture(ye,wt||Ve[ye]),St.type=ye,St.texture=wt)}function vi(){let ye=ve[he];ye!==void 0&&ye.type!==void 0&&(i.bindTexture(ye.type,null),ye.type=void 0,ye.texture=void 0)}function zn(){try{i.compressedTexImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function le(){try{i.compressedTexImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Z(){try{i.texSubImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Te(){try{i.texSubImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Ie(){try{i.compressedTexSubImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Ge(){try{i.compressedTexSubImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function vt(){try{i.texStorage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Tt(){try{i.texStorage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function qe(){try{i.texImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Je(){try{i.texImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function It(ye){return f[ye]!==void 0?f[ye]:i.getParameter(ye)}function rn(ye,wt){f[ye]!==wt&&(i.pixelStorei(ye,wt),f[ye]=wt)}function Lt(ye){Fe.equals(ye)===!1&&(i.scissor(ye.x,ye.y,ye.z,ye.w),Fe.copy(ye))}function Rt(ye){mt.equals(ye)===!1&&(i.viewport(ye.x,ye.y,ye.z,ye.w),mt.copy(ye))}function fn(ye,wt){let Ze=c.get(wt);Ze===void 0&&(Ze=new WeakMap,c.set(wt,Ze));let St=Ze.get(ye);St===void 0&&(St=i.getUniformBlockIndex(wt,ye.name),Ze.set(ye,St))}function wn(ye,wt){let St=c.get(wt).get(ye);l.get(wt)!==St&&(i.uniformBlockBinding(wt,St,ye.__bindingPointIndex),l.set(wt,St))}function Dn(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),o.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),i.pixelStorei(i.PACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.BROWSER_DEFAULT_WEBGL),i.pixelStorei(i.PACK_ROW_LENGTH,0),i.pixelStorei(i.PACK_SKIP_PIXELS,0),i.pixelStorei(i.PACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_ROW_LENGTH,0),i.pixelStorei(i.UNPACK_IMAGE_HEIGHT,0),i.pixelStorei(i.UNPACK_SKIP_PIXELS,0),i.pixelStorei(i.UNPACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_SKIP_IMAGES,0),u={},f={},he=null,ve={},d={},A=new WeakMap,y=[],w=null,S=!1,T=null,R=null,I=null,P=null,F=null,D=null,L=null,C=new zt(0,0,0),B=0,k=!1,z=null,G=null,W=null,Y=null,H=null,Fe.set(0,0,i.canvas.width,i.canvas.height),mt.set(0,0,i.canvas.width,i.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:Ye,disable:Mt,bindFramebuffer:Et,drawBuffers:Pt,useProgram:dn,setBlending:ot,setMaterial:nt,setFlipSided:bt,setCullFace:yt,setLineWidth:hn,setPolygonOffset:en,setScissorTest:tn,activeTexture:bn,bindTexture:_e,unbindTexture:vi,compressedTexImage2D:zn,compressedTexImage3D:le,texImage2D:qe,texImage3D:Je,pixelStorei:rn,getParameter:It,updateUBOMapping:fn,uniformBlockBinding:wn,texStorage2D:vt,texStorage3D:Tt,texSubImage2D:Z,texSubImage3D:Te,compressedTexSubImage2D:Ie,compressedTexSubImage3D:Ge,scissor:Lt,viewport:Rt,reset:Dn}}function zxe(i,e,t,n,r,s,o){let a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Oe,u=new WeakMap,f=new Set,d,A=new WeakMap,y=!1;try{y=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function w(le,Z){return y?new OffscreenCanvas(le,Z):$v("canvas")}function S(le,Z,Te){let Ie=1,Ge=zn(le);if((Ge.width>Te||Ge.height>Te)&&(Ie=Te/Math.max(Ge.width,Ge.height)),Ie<1)if(typeof HTMLImageElement<"u"&&le instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&le instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&le instanceof ImageBitmap||typeof VideoFrame<"u"&&le instanceof VideoFrame){let vt=Math.floor(Ie*Ge.width),Tt=Math.floor(Ie*Ge.height);d===void 0&&(d=w(vt,Tt));let qe=Z?w(vt,Tt):d;return qe.width=vt,qe.height=Tt,qe.getContext("2d").drawImage(le,0,0,vt,Tt),Xe("WebGLRenderer: Texture has been resized from ("+Ge.width+"x"+Ge.height+") to ("+vt+"x"+Tt+")."),qe}else return"data"in le&&Xe("WebGLRenderer: Image in DataTexture is too big ("+Ge.width+"x"+Ge.height+")."),le;return le}function T(le){return le.generateMipmaps}function R(le){i.generateMipmap(le)}function I(le){return le.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:le.isWebGL3DRenderTarget?i.TEXTURE_3D:le.isWebGLArrayRenderTarget||le.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function P(le,Z,Te,Ie,Ge,vt=!1){if(le!==null){if(i[le]!==void 0)return i[le];Xe("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+le+"'")}let Tt;Ie&&(Tt=e.get("EXT_texture_norm16"),Tt||Xe("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let qe=Z;if(Z===i.RED&&(Te===i.FLOAT&&(qe=i.R32F),Te===i.HALF_FLOAT&&(qe=i.R16F),Te===i.UNSIGNED_BYTE&&(qe=i.R8),Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.R16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.R16_SNORM_EXT)),Z===i.RED_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.R8UI),Te===i.UNSIGNED_SHORT&&(qe=i.R16UI),Te===i.UNSIGNED_INT&&(qe=i.R32UI),Te===i.BYTE&&(qe=i.R8I),Te===i.SHORT&&(qe=i.R16I),Te===i.INT&&(qe=i.R32I)),Z===i.RG&&(Te===i.FLOAT&&(qe=i.RG32F),Te===i.HALF_FLOAT&&(qe=i.RG16F),Te===i.UNSIGNED_BYTE&&(qe=i.RG8),Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.RG16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.RG16_SNORM_EXT)),Z===i.RG_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RG8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RG16UI),Te===i.UNSIGNED_INT&&(qe=i.RG32UI),Te===i.BYTE&&(qe=i.RG8I),Te===i.SHORT&&(qe=i.RG16I),Te===i.INT&&(qe=i.RG32I)),Z===i.RGB_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RGB8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RGB16UI),Te===i.UNSIGNED_INT&&(qe=i.RGB32UI),Te===i.BYTE&&(qe=i.RGB8I),Te===i.SHORT&&(qe=i.RGB16I),Te===i.INT&&(qe=i.RGB32I)),Z===i.RGBA_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RGBA8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RGBA16UI),Te===i.UNSIGNED_INT&&(qe=i.RGBA32UI),Te===i.BYTE&&(qe=i.RGBA8I),Te===i.SHORT&&(qe=i.RGBA16I),Te===i.INT&&(qe=i.RGBA32I)),Z===i.RGB&&(Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.RGB16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.RGB16_SNORM_EXT),Te===i.UNSIGNED_INT_5_9_9_9_REV&&(qe=i.RGB9_E5),Te===i.UNSIGNED_INT_10F_11F_11F_REV&&(qe=i.R11F_G11F_B10F)),Z===i.RGBA){let Je=vt?n0:ln.getTransfer(Ge);Te===i.FLOAT&&(qe=i.RGBA32F),Te===i.HALF_FLOAT&&(qe=i.RGBA16F),Te===i.UNSIGNED_BYTE&&(qe=Je===kt?i.SRGB8_ALPHA8:i.RGBA8),Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.RGBA16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.RGBA16_SNORM_EXT),Te===i.UNSIGNED_SHORT_4_4_4_4&&(qe=i.RGBA4),Te===i.UNSIGNED_SHORT_5_5_5_1&&(qe=i.RGB5_A1)}return(qe===i.R16F||qe===i.R32F||qe===i.RG16F||qe===i.RG32F||qe===i.RGBA16F||qe===i.RGBA32F)&&e.get("EXT_color_buffer_float"),qe}function F(le,Z){let Te;return le?Z===null||Z===xi||Z===ua?Te=i.DEPTH24_STENCIL8:Z===cr?Te=i.DEPTH32F_STENCIL8:Z===wl&&(Te=i.DEPTH24_STENCIL8,Xe("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):Z===null||Z===xi||Z===ua?Te=i.DEPTH_COMPONENT24:Z===cr?Te=i.DEPTH_COMPONENT32F:Z===wl&&(Te=i.DEPTH_COMPONENT16),Te}function D(le,Z){return T(le)===!0||le.isFramebufferTexture&&le.minFilter!==Ti&&le.minFilter!==Mi?Math.log2(Math.max(Z.width,Z.height))+1:le.mipmaps!==void 0&&le.mipmaps.length>0?le.mipmaps.length:le.isCompressedTexture&&Array.isArray(le.image)?Z.mipmaps.length:1}function L(le){let Z=le.target;Z.removeEventListener("dispose",L),B(Z),Z.isVideoTexture&&u.delete(Z),Z.isHTMLTexture&&f.delete(Z)}function C(le){let Z=le.target;Z.removeEventListener("dispose",C),z(Z)}function B(le){let Z=n.get(le);if(Z.__webglInit===void 0)return;let Te=le.source,Ie=A.get(Te);if(Ie){let Ge=Ie[Z.__cacheKey];Ge.usedTimes--,Ge.usedTimes===0&&k(le),Object.keys(Ie).length===0&&A.delete(Te)}n.remove(le)}function k(le){let Z=n.get(le);i.deleteTexture(Z.__webglTexture);let Te=le.source,Ie=A.get(Te);delete Ie[Z.__cacheKey],o.memory.textures--}function z(le){let Z=n.get(le);if(le.depthTexture&&(le.depthTexture.dispose(),n.remove(le.depthTexture)),le.isWebGLCubeRenderTarget)for(let Ie=0;Ie<6;Ie++){if(Array.isArray(Z.__webglFramebuffer[Ie]))for(let Ge=0;Ge<Z.__webglFramebuffer[Ie].length;Ge++)i.deleteFramebuffer(Z.__webglFramebuffer[Ie][Ge]);else i.deleteFramebuffer(Z.__webglFramebuffer[Ie]);Z.__webglDepthbuffer&&i.deleteRenderbuffer(Z.__webglDepthbuffer[Ie])}else{if(Array.isArray(Z.__webglFramebuffer))for(let Ie=0;Ie<Z.__webglFramebuffer.length;Ie++)i.deleteFramebuffer(Z.__webglFramebuffer[Ie]);else i.deleteFramebuffer(Z.__webglFramebuffer);if(Z.__webglDepthbuffer&&i.deleteRenderbuffer(Z.__webglDepthbuffer),Z.__webglMultisampledFramebuffer&&i.deleteFramebuffer(Z.__webglMultisampledFramebuffer),Z.__webglColorRenderbuffer)for(let Ie=0;Ie<Z.__webglColorRenderbuffer.length;Ie++)Z.__webglColorRenderbuffer[Ie]&&i.deleteRenderbuffer(Z.__webglColorRenderbuffer[Ie]);Z.__webglDepthRenderbuffer&&i.deleteRenderbuffer(Z.__webglDepthRenderbuffer)}let Te=le.textures;for(let Ie=0,Ge=Te.length;Ie<Ge;Ie++){let vt=n.get(Te[Ie]);vt.__webglTexture&&(i.deleteTexture(vt.__webglTexture),o.memory.textures--),n.remove(Te[Ie])}n.remove(le)}let G=0;function W(){G=0}function Y(){return G}function H(le){G=le}function $(){let le=G;return le>=r.maxTextures&&Xe("WebGLTextures: Trying to use "+le+" texture units while this GPU supports only "+r.maxTextures),G+=1,le}function J(le){let Z=[];return Z.push(le.wrapS),Z.push(le.wrapT),Z.push(le.wrapR||0),Z.push(le.magFilter),Z.push(le.minFilter),Z.push(le.anisotropy),Z.push(le.internalFormat),Z.push(le.format),Z.push(le.type),Z.push(le.generateMipmaps),Z.push(le.premultiplyAlpha),Z.push(le.flipY),Z.push(le.unpackAlignment),Z.push(le.colorSpace),Z.join()}function te(le,Z){let Te=n.get(le);if(le.isVideoTexture&&_e(le),le.isRenderTargetTexture===!1&&le.isExternalTexture!==!0&&le.version>0&&Te.__version!==le.version){let Ie=le.image;if(Ie===null)Xe("WebGLRenderer: Texture marked for update but no image data found.");else if(Ie.complete===!1)Xe("WebGLRenderer: Texture marked for update but image is incomplete");else{Mt(Te,le,Z);return}}else le.isExternalTexture&&(Te.__webglTexture=le.sourceTexture?le.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,Te.__webglTexture,i.TEXTURE0+Z)}function ce(le,Z){let Te=n.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Te.__version!==le.version){Mt(Te,le,Z);return}else le.isExternalTexture&&(Te.__webglTexture=le.sourceTexture?le.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,Te.__webglTexture,i.TEXTURE0+Z)}function he(le,Z){let Te=n.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Te.__version!==le.version){Mt(Te,le,Z);return}t.bindTexture(i.TEXTURE_3D,Te.__webglTexture,i.TEXTURE0+Z)}function ve(le,Z){let Te=n.get(le);if(le.isCubeDepthTexture!==!0&&le.version>0&&Te.__version!==le.version){Et(Te,le,Z);return}t.bindTexture(i.TEXTURE_CUBE_MAP,Te.__webglTexture,i.TEXTURE0+Z)}let Re={[Ed]:i.REPEAT,[la]:i.CLAMP_TO_EDGE,[Md]:i.MIRRORED_REPEAT},Qe={[Ti]:i.NEAREST,[Pb]:i.NEAREST_MIPMAP_NEAREST,[qc]:i.NEAREST_MIPMAP_LINEAR,[Mi]:i.LINEAR,[A0]:i.LINEAR_MIPMAP_NEAREST,[Go]:i.LINEAR_MIPMAP_LINEAR},Fe={[Db]:i.NEVER,[Bb]:i.ALWAYS,[h_]:i.LESS,[Xh]:i.LEQUAL,[Nb]:i.EQUAL,[Fu]:i.GEQUAL,[ug]:i.GREATER,[Fb]:i.NOTEQUAL};function mt(le,Z){if(Z.type===cr&&e.has("OES_texture_float_linear")===!1&&(Z.magFilter===Mi||Z.magFilter===A0||Z.magFilter===qc||Z.magFilter===Go||Z.minFilter===Mi||Z.minFilter===A0||Z.minFilter===qc||Z.minFilter===Go)&&Xe("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(le,i.TEXTURE_WRAP_S,Re[Z.wrapS]),i.texParameteri(le,i.TEXTURE_WRAP_T,Re[Z.wrapT]),(le===i.TEXTURE_3D||le===i.TEXTURE_2D_ARRAY)&&i.texParameteri(le,i.TEXTURE_WRAP_R,Re[Z.wrapR]),i.texParameteri(le,i.TEXTURE_MAG_FILTER,Qe[Z.magFilter]),i.texParameteri(le,i.TEXTURE_MIN_FILTER,Qe[Z.minFilter]),Z.compareFunction&&(i.texParameteri(le,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(le,i.TEXTURE_COMPARE_FUNC,Fe[Z.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(Z.magFilter===Ti||Z.minFilter!==qc&&Z.minFilter!==Go||Z.type===cr&&e.has("OES_texture_float_linear")===!1)return;if(Z.anisotropy>1||n.get(Z).__currentAnisotropy){let Te=e.get("EXT_texture_filter_anisotropic");i.texParameterf(le,Te.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(Z.anisotropy,r.getMaxAnisotropy())),n.get(Z).__currentAnisotropy=Z.anisotropy}}}function Ee(le,Z){let Te=!1;le.__webglInit===void 0&&(le.__webglInit=!0,Z.addEventListener("dispose",L));let Ie=Z.source,Ge=A.get(Ie);Ge===void 0&&(Ge={},A.set(Ie,Ge));let vt=J(Z);if(vt!==le.__cacheKey){Ge[vt]===void 0&&(Ge[vt]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,Te=!0),Ge[vt].usedTimes++;let Tt=Ge[le.__cacheKey];Tt!==void 0&&(Ge[le.__cacheKey].usedTimes--,Tt.usedTimes===0&&k(Z)),le.__cacheKey=vt,le.__webglTexture=Ge[vt].texture}return Te}function Ve(le,Z,Te){return Math.floor(Math.floor(le/Te)/Z)}function Ye(le,Z,Te,Ie){let vt=le.updateRanges;if(vt.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,Z.width,Z.height,Te,Ie,Z.data);else{vt.sort((rn,Lt)=>rn.start-Lt.start);let Tt=0;for(let rn=1;rn<vt.length;rn++){let Lt=vt[Tt],Rt=vt[rn],fn=Lt.start+Lt.count,wn=Ve(Rt.start,Z.width,4),Dn=Ve(Lt.start,Z.width,4);Rt.start<=fn+1&&wn===Dn&&Ve(Rt.start+Rt.count-1,Z.width,4)===wn?Lt.count=Math.max(Lt.count,Rt.start+Rt.count-Lt.start):(++Tt,vt[Tt]=Rt)}vt.length=Tt+1;let qe=t.getParameter(i.UNPACK_ROW_LENGTH),Je=t.getParameter(i.UNPACK_SKIP_PIXELS),It=t.getParameter(i.UNPACK_SKIP_ROWS);t.pixelStorei(i.UNPACK_ROW_LENGTH,Z.width);for(let rn=0,Lt=vt.length;rn<Lt;rn++){let Rt=vt[rn],fn=Math.floor(Rt.start/4),wn=Math.ceil(Rt.count/4),Dn=fn%Z.width,ye=Math.floor(fn/Z.width),wt=wn,Ze=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,Dn),t.pixelStorei(i.UNPACK_SKIP_ROWS,ye),t.texSubImage2D(i.TEXTURE_2D,0,Dn,ye,wt,Ze,Te,Ie,Z.data)}le.clearUpdateRanges(),t.pixelStorei(i.UNPACK_ROW_LENGTH,qe),t.pixelStorei(i.UNPACK_SKIP_PIXELS,Je),t.pixelStorei(i.UNPACK_SKIP_ROWS,It)}}function Mt(le,Z,Te){let Ie=i.TEXTURE_2D;(Z.isDataArrayTexture||Z.isCompressedArrayTexture)&&(Ie=i.TEXTURE_2D_ARRAY),Z.isData3DTexture&&(Ie=i.TEXTURE_3D);let Ge=Ee(le,Z),vt=Z.source;t.bindTexture(Ie,le.__webglTexture,i.TEXTURE0+Te);let Tt=n.get(vt);if(vt.version!==Tt.__version||Ge===!0){if(t.activeTexture(i.TEXTURE0+Te),(typeof ImageBitmap<"u"&&Z.image instanceof ImageBitmap)===!1){let Ze=ln.getPrimaries(ln.workingColorSpace),St=Z.colorSpace===ha?null:ln.getPrimaries(Z.colorSpace),Bt=Z.colorSpace===ha||Ze===St?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,Z.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Z.premultiplyAlpha),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Bt)}t.pixelStorei(i.UNPACK_ALIGNMENT,Z.unpackAlignment);let Je=S(Z.image,!1,r.maxTextureSize);Je=vi(Z,Je);let It=s.convert(Z.format,Z.colorSpace),rn=s.convert(Z.type),Lt=P(Z.internalFormat,It,rn,Z.normalized,Z.colorSpace,Z.isVideoTexture);mt(Ie,Z);let Rt,fn=Z.mipmaps,wn=Z.isVideoTexture!==!0,Dn=Tt.__version===void 0||Ge===!0,ye=vt.dataReady,wt=D(Z,Je);if(Z.isDepthTexture)Lt=F(Z.format===xo,Z.type),Dn&&(wn?t.texStorage2D(i.TEXTURE_2D,1,Lt,Je.width,Je.height):t.texImage2D(i.TEXTURE_2D,0,Lt,Je.width,Je.height,0,It,rn,null));else if(Z.isDataTexture)if(fn.length>0){wn&&Dn&&t.texStorage2D(i.TEXTURE_2D,wt,Lt,fn[0].width,fn[0].height);for(let Ze=0,St=fn.length;Ze<St;Ze++)Rt=fn[Ze],wn?ye&&t.texSubImage2D(i.TEXTURE_2D,Ze,0,0,Rt.width,Rt.height,It,rn,Rt.data):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,It,rn,Rt.data);Z.generateMipmaps=!1}else wn?(Dn&&t.texStorage2D(i.TEXTURE_2D,wt,Lt,Je.width,Je.height),ye&&Ye(Z,Je,It,rn)):t.texImage2D(i.TEXTURE_2D,0,Lt,Je.width,Je.height,0,It,rn,Je.data);else if(Z.isCompressedTexture)if(Z.isCompressedArrayTexture){wn&&Dn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,wt,Lt,fn[0].width,fn[0].height,Je.depth);for(let Ze=0,St=fn.length;Ze<St;Ze++)if(Rt=fn[Ze],Z.format!==Or)if(It!==null)if(wn){if(ye)if(Z.layerUpdates.size>0){let Bt=Ub(Rt.width,Rt.height,Z.format,Z.type);for(let ut of Z.layerUpdates){let Ce=Rt.data.subarray(ut*Bt/Rt.data.BYTES_PER_ELEMENT,(ut+1)*Bt/Rt.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ze,0,0,ut,Rt.width,Rt.height,1,It,Ce)}Z.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ze,0,0,0,Rt.width,Rt.height,Je.depth,It,Rt.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,Ze,Lt,Rt.width,Rt.height,Je.depth,0,Rt.data,0,0);else Xe("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else wn?ye&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,Ze,0,0,0,Rt.width,Rt.height,Je.depth,It,rn,Rt.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Ze,Lt,Rt.width,Rt.height,Je.depth,0,It,rn,Rt.data)}else{wn&&Dn&&t.texStorage2D(i.TEXTURE_2D,wt,Lt,fn[0].width,fn[0].height);for(let Ze=0,St=fn.length;Ze<St;Ze++)Rt=fn[Ze],Z.format!==Or?It!==null?wn?ye&&t.compressedTexSubImage2D(i.TEXTURE_2D,Ze,0,0,Rt.width,Rt.height,It,Rt.data):t.compressedTexImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,Rt.data):Xe("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):wn?ye&&t.texSubImage2D(i.TEXTURE_2D,Ze,0,0,Rt.width,Rt.height,It,rn,Rt.data):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,It,rn,Rt.data)}else if(Z.isDataArrayTexture)if(wn){if(Dn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,wt,Lt,Je.width,Je.height,Je.depth),ye)if(Z.layerUpdates.size>0){let Ze=Ub(Je.width,Je.height,Z.format,Z.type);for(let St of Z.layerUpdates){let Bt=Je.data.subarray(St*Ze/Je.data.BYTES_PER_ELEMENT,(St+1)*Ze/Je.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,St,Je.width,Je.height,1,It,rn,Bt)}Z.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Je.width,Je.height,Je.depth,It,rn,Je.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Lt,Je.width,Je.height,Je.depth,0,It,rn,Je.data);else if(Z.isData3DTexture)wn?(Dn&&t.texStorage3D(i.TEXTURE_3D,wt,Lt,Je.width,Je.height,Je.depth),ye&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Je.width,Je.height,Je.depth,It,rn,Je.data)):t.texImage3D(i.TEXTURE_3D,0,Lt,Je.width,Je.height,Je.depth,0,It,rn,Je.data);else if(Z.isFramebufferTexture){if(Dn)if(wn)t.texStorage2D(i.TEXTURE_2D,wt,Lt,Je.width,Je.height);else{let Ze=Je.width,St=Je.height;for(let Bt=0;Bt<wt;Bt++)t.texImage2D(i.TEXTURE_2D,Bt,Lt,Ze,St,0,It,rn,null),Ze>>=1,St>>=1}}else if(Z.isHTMLTexture){if("texElementImage2D"in i){let Ze=i.canvas;if(Ze.hasAttribute("layoutsubtree")||Ze.setAttribute("layoutsubtree","true"),Je.parentNode!==Ze){Ze.appendChild(Je),f.add(Z),Ze.onpaint=St=>{let Bt=St.changedElements;for(let ut of f)Bt.includes(ut.image)&&(ut.needsUpdate=!0)},Ze.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,Je);else{let Bt=i.RGBA,ut=i.RGBA,Ce=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,Bt,ut,Ce,Je)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(fn.length>0){if(wn&&Dn){let Ze=zn(fn[0]);t.texStorage2D(i.TEXTURE_2D,wt,Lt,Ze.width,Ze.height)}for(let Ze=0,St=fn.length;Ze<St;Ze++)Rt=fn[Ze],wn?ye&&t.texSubImage2D(i.TEXTURE_2D,Ze,0,0,It,rn,Rt):t.texImage2D(i.TEXTURE_2D,Ze,Lt,It,rn,Rt);Z.generateMipmaps=!1}else if(wn){if(Dn){let Ze=zn(Je);t.texStorage2D(i.TEXTURE_2D,wt,Lt,Ze.width,Ze.height)}ye&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,It,rn,Je)}else t.texImage2D(i.TEXTURE_2D,0,Lt,It,rn,Je);T(Z)&&R(Ie),Tt.__version=vt.version,Z.onUpdate&&Z.onUpdate(Z)}le.__version=Z.version}function Et(le,Z,Te){if(Z.image.length!==6)return;let Ie=Ee(le,Z),Ge=Z.source;t.bindTexture(i.TEXTURE_CUBE_MAP,le.__webglTexture,i.TEXTURE0+Te);let vt=n.get(Ge);if(Ge.version!==vt.__version||Ie===!0){t.activeTexture(i.TEXTURE0+Te);let Tt=ln.getPrimaries(ln.workingColorSpace),qe=Z.colorSpace===ha?null:ln.getPrimaries(Z.colorSpace),Je=Z.colorSpace===ha||Tt===qe?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,Z.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Z.premultiplyAlpha),t.pixelStorei(i.UNPACK_ALIGNMENT,Z.unpackAlignment),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Je);let It=Z.isCompressedTexture||Z.image[0].isCompressedTexture,rn=Z.image[0]&&Z.image[0].isDataTexture,Lt=[];for(let ut=0;ut<6;ut++)!It&&!rn?Lt[ut]=S(Z.image[ut],!0,r.maxCubemapSize):Lt[ut]=rn?Z.image[ut].image:Z.image[ut],Lt[ut]=vi(Z,Lt[ut]);let Rt=Lt[0],fn=s.convert(Z.format,Z.colorSpace),wn=s.convert(Z.type),Dn=P(Z.internalFormat,fn,wn,Z.normalized,Z.colorSpace),ye=Z.isVideoTexture!==!0,wt=vt.__version===void 0||Ie===!0,Ze=Ge.dataReady,St=D(Z,Rt);mt(i.TEXTURE_CUBE_MAP,Z);let Bt;if(It){ye&&wt&&t.texStorage2D(i.TEXTURE_CUBE_MAP,St,Dn,Rt.width,Rt.height);for(let ut=0;ut<6;ut++){Bt=Lt[ut].mipmaps;for(let Ce=0;Ce<Bt.length;Ce++){let Yt=Bt[Ce];Z.format!==Or?fn!==null?ye?Ze&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,0,0,Yt.width,Yt.height,fn,Yt.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,Dn,Yt.width,Yt.height,0,Yt.data):Xe("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,0,0,Yt.width,Yt.height,fn,wn,Yt.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,Dn,Yt.width,Yt.height,0,fn,wn,Yt.data)}}}else{if(Bt=Z.mipmaps,ye&&wt){Bt.length>0&&St++;let ut=zn(Lt[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,St,Dn,ut.width,ut.height)}for(let ut=0;ut<6;ut++)if(rn){ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,0,0,Lt[ut].width,Lt[ut].height,fn,wn,Lt[ut].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,Dn,Lt[ut].width,Lt[ut].height,0,fn,wn,Lt[ut].data);for(let Ce=0;Ce<Bt.length;Ce++){let nr=Bt[Ce].image[ut].image;ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,0,0,nr.width,nr.height,fn,wn,nr.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,Dn,nr.width,nr.height,0,fn,wn,nr.data)}}else{ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,0,0,fn,wn,Lt[ut]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,Dn,fn,wn,Lt[ut]);for(let Ce=0;Ce<Bt.length;Ce++){let Yt=Bt[Ce];ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,0,0,fn,wn,Yt.image[ut]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,Dn,fn,wn,Yt.image[ut])}}}T(Z)&&R(i.TEXTURE_CUBE_MAP),vt.__version=Ge.version,Z.onUpdate&&Z.onUpdate(Z)}le.__version=Z.version}function Pt(le,Z,Te,Ie,Ge,vt){let Tt=s.convert(Te.format,Te.colorSpace),qe=s.convert(Te.type),Je=P(Te.internalFormat,Tt,qe,Te.normalized,Te.colorSpace),It=n.get(Z),rn=n.get(Te);if(rn.__renderTarget=Z,!It.__hasExternalTextures){let Lt=Math.max(1,Z.width>>vt),Rt=Math.max(1,Z.height>>vt);Ge===i.TEXTURE_3D||Ge===i.TEXTURE_2D_ARRAY?t.texImage3D(Ge,vt,Je,Lt,Rt,Z.depth,0,Tt,qe,null):t.texImage2D(Ge,vt,Je,Lt,Rt,0,Tt,qe,null)}t.bindFramebuffer(i.FRAMEBUFFER,le),bn(Z)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Ie,Ge,rn.__webglTexture,0,tn(Z)):(Ge===i.TEXTURE_2D||Ge>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&Ge<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Ie,Ge,rn.__webglTexture,vt),t.bindFramebuffer(i.FRAMEBUFFER,null)}function dn(le,Z,Te){if(i.bindRenderbuffer(i.RENDERBUFFER,le),Z.depthBuffer){let Ie=Z.depthTexture,Ge=Ie&&Ie.isDepthTexture?Ie.type:null,vt=F(Z.stencilBuffer,Ge),Tt=Z.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;bn(Z)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,tn(Z),vt,Z.width,Z.height):Te?i.renderbufferStorageMultisample(i.RENDERBUFFER,tn(Z),vt,Z.width,Z.height):i.renderbufferStorage(i.RENDERBUFFER,vt,Z.width,Z.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,Tt,i.RENDERBUFFER,le)}else{let Ie=Z.textures;for(let Ge=0;Ge<Ie.length;Ge++){let vt=Ie[Ge],Tt=s.convert(vt.format,vt.colorSpace),qe=s.convert(vt.type),Je=P(vt.internalFormat,Tt,qe,vt.normalized,vt.colorSpace);bn(Z)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,tn(Z),Je,Z.width,Z.height):Te?i.renderbufferStorageMultisample(i.RENDERBUFFER,tn(Z),Je,Z.width,Z.height):i.renderbufferStorage(i.RENDERBUFFER,Je,Z.width,Z.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Gt(le,Z,Te){let Ie=Z.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,le),!(Z.depthTexture&&Z.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let Ge=n.get(Z.depthTexture);if(Ge.__renderTarget=Z,(!Ge.__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),Ie){if(Ge.__webglInit===void 0&&(Ge.__webglInit=!0,Z.depthTexture.addEventListener("dispose",L)),Ge.__webglTexture===void 0){Ge.__webglTexture=i.createTexture(),t.bindTexture(i.TEXTURE_CUBE_MAP,Ge.__webglTexture),mt(i.TEXTURE_CUBE_MAP,Z.depthTexture);let It=s.convert(Z.depthTexture.format),rn=s.convert(Z.depthTexture.type),Lt;Z.depthTexture.format===Vs?Lt=i.DEPTH_COMPONENT24:Z.depthTexture.format===xo&&(Lt=i.DEPTH24_STENCIL8);for(let Rt=0;Rt<6;Rt++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Rt,0,Lt,Z.width,Z.height,0,It,rn,null)}}else te(Z.depthTexture,0);let vt=Ge.__webglTexture,Tt=tn(Z),qe=Ie?i.TEXTURE_CUBE_MAP_POSITIVE_X+Te:i.TEXTURE_2D,Je=Z.depthTexture.format===xo?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(Z.depthTexture.format===Vs)bn(Z)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Je,qe,vt,0,Tt):i.framebufferTexture2D(i.FRAMEBUFFER,Je,qe,vt,0);else if(Z.depthTexture.format===xo)bn(Z)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Je,qe,vt,0,Tt):i.framebufferTexture2D(i.FRAMEBUFFER,Je,qe,vt,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function $e(le){let Z=n.get(le),Te=le.isWebGLCubeRenderTarget===!0;if(Z.__boundDepthTexture!==le.depthTexture){let Ie=le.depthTexture;if(Z.__depthDisposeCallback&&Z.__depthDisposeCallback(),Ie){let Ge=()=>{delete Z.__boundDepthTexture,delete Z.__depthDisposeCallback,Ie.removeEventListener("dispose",Ge)};Ie.addEventListener("dispose",Ge),Z.__depthDisposeCallback=Ge}Z.__boundDepthTexture=Ie}if(le.depthTexture&&!Z.__autoAllocateDepthBuffer)if(Te)for(let Ie=0;Ie<6;Ie++)Gt(Z.__webglFramebuffer[Ie],le,Ie);else{let Ie=le.texture.mipmaps;Ie&&Ie.length>0?Gt(Z.__webglFramebuffer[0],le,0):Gt(Z.__webglFramebuffer,le,0)}else if(Te){Z.__webglDepthbuffer=[];for(let Ie=0;Ie<6;Ie++)if(t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglFramebuffer[Ie]),Z.__webglDepthbuffer[Ie]===void 0)Z.__webglDepthbuffer[Ie]=i.createRenderbuffer(),dn(Z.__webglDepthbuffer[Ie],le,!1);else{let Ge=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,vt=Z.__webglDepthbuffer[Ie];i.bindRenderbuffer(i.RENDERBUFFER,vt),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ge,i.RENDERBUFFER,vt)}}else{let Ie=le.texture.mipmaps;if(Ie&&Ie.length>0?t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglFramebuffer),Z.__webglDepthbuffer===void 0)Z.__webglDepthbuffer=i.createRenderbuffer(),dn(Z.__webglDepthbuffer,le,!1);else{let Ge=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,vt=Z.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,vt),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ge,i.RENDERBUFFER,vt)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function ot(le,Z,Te){let Ie=n.get(le);Z!==void 0&&Pt(Ie.__webglFramebuffer,le,le.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Te!==void 0&&$e(le)}function nt(le){let Z=le.texture,Te=n.get(le),Ie=n.get(Z);le.addEventListener("dispose",C);let Ge=le.textures,vt=le.isWebGLCubeRenderTarget===!0,Tt=Ge.length>1;if(Tt||(Ie.__webglTexture===void 0&&(Ie.__webglTexture=i.createTexture()),Ie.__version=Z.version,o.memory.textures++),vt){Te.__webglFramebuffer=[];for(let qe=0;qe<6;qe++)if(Z.mipmaps&&Z.mipmaps.length>0){Te.__webglFramebuffer[qe]=[];for(let Je=0;Je<Z.mipmaps.length;Je++)Te.__webglFramebuffer[qe][Je]=i.createFramebuffer()}else Te.__webglFramebuffer[qe]=i.createFramebuffer()}else{if(Z.mipmaps&&Z.mipmaps.length>0){Te.__webglFramebuffer=[];for(let qe=0;qe<Z.mipmaps.length;qe++)Te.__webglFramebuffer[qe]=i.createFramebuffer()}else Te.__webglFramebuffer=i.createFramebuffer();if(Tt)for(let qe=0,Je=Ge.length;qe<Je;qe++){let It=n.get(Ge[qe]);It.__webglTexture===void 0&&(It.__webglTexture=i.createTexture(),o.memory.textures++)}if(le.samples>0&&bn(le)===!1){Te.__webglMultisampledFramebuffer=i.createFramebuffer(),Te.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,Te.__webglMultisampledFramebuffer);for(let qe=0;qe<Ge.length;qe++){let Je=Ge[qe];Te.__webglColorRenderbuffer[qe]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,Te.__webglColorRenderbuffer[qe]);let It=s.convert(Je.format,Je.colorSpace),rn=s.convert(Je.type),Lt=P(Je.internalFormat,It,rn,Je.normalized,Je.colorSpace,le.isXRRenderTarget===!0),Rt=tn(le);i.renderbufferStorageMultisample(i.RENDERBUFFER,Rt,Lt,le.width,le.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+qe,i.RENDERBUFFER,Te.__webglColorRenderbuffer[qe])}i.bindRenderbuffer(i.RENDERBUFFER,null),le.depthBuffer&&(Te.__webglDepthRenderbuffer=i.createRenderbuffer(),dn(Te.__webglDepthRenderbuffer,le,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(vt){t.bindTexture(i.TEXTURE_CUBE_MAP,Ie.__webglTexture),mt(i.TEXTURE_CUBE_MAP,Z);for(let qe=0;qe<6;qe++)if(Z.mipmaps&&Z.mipmaps.length>0)for(let Je=0;Je<Z.mipmaps.length;Je++)Pt(Te.__webglFramebuffer[qe][Je],le,Z,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+qe,Je);else Pt(Te.__webglFramebuffer[qe],le,Z,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+qe,0);T(Z)&&R(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Tt){for(let qe=0,Je=Ge.length;qe<Je;qe++){let It=Ge[qe],rn=n.get(It),Lt=i.TEXTURE_2D;(le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(Lt=le.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(Lt,rn.__webglTexture),mt(Lt,It),Pt(Te.__webglFramebuffer,le,It,i.COLOR_ATTACHMENT0+qe,Lt,0),T(It)&&R(Lt)}t.unbindTexture()}else{let qe=i.TEXTURE_2D;if((le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(qe=le.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(qe,Ie.__webglTexture),mt(qe,Z),Z.mipmaps&&Z.mipmaps.length>0)for(let Je=0;Je<Z.mipmaps.length;Je++)Pt(Te.__webglFramebuffer[Je],le,Z,i.COLOR_ATTACHMENT0,qe,Je);else Pt(Te.__webglFramebuffer,le,Z,i.COLOR_ATTACHMENT0,qe,0);T(Z)&&R(qe),t.unbindTexture()}le.depthBuffer&&$e(le)}function bt(le){let Z=le.textures;for(let Te=0,Ie=Z.length;Te<Ie;Te++){let Ge=Z[Te];if(T(Ge)){let vt=I(le),Tt=n.get(Ge).__webglTexture;t.bindTexture(vt,Tt),R(vt),t.unbindTexture()}}}let yt=[],hn=[];function en(le){if(le.samples>0){if(bn(le)===!1){let Z=le.textures,Te=le.width,Ie=le.height,Ge=i.COLOR_BUFFER_BIT,vt=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Tt=n.get(le),qe=Z.length>1;if(qe)for(let It=0;It<Z.length;It++)t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+It,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+It,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,Tt.__webglMultisampledFramebuffer);let Je=le.texture.mipmaps;Je&&Je.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Tt.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Tt.__webglFramebuffer);for(let It=0;It<Z.length;It++){if(le.resolveDepthBuffer&&(le.depthBuffer&&(Ge|=i.DEPTH_BUFFER_BIT),le.stencilBuffer&&le.resolveStencilBuffer&&(Ge|=i.STENCIL_BUFFER_BIT)),qe){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,Tt.__webglColorRenderbuffer[It]);let rn=n.get(Z[It]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,rn,0)}i.blitFramebuffer(0,0,Te,Ie,0,0,Te,Ie,Ge,i.NEAREST),l===!0&&(yt.length=0,hn.length=0,yt.push(i.COLOR_ATTACHMENT0+It),le.depthBuffer&&le.resolveDepthBuffer===!1&&(yt.push(vt),hn.push(vt),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,hn)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,yt))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),qe)for(let It=0;It<Z.length;It++){t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+It,i.RENDERBUFFER,Tt.__webglColorRenderbuffer[It]);let rn=n.get(Z[It]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+It,i.TEXTURE_2D,rn,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Tt.__webglMultisampledFramebuffer)}else if(le.depthBuffer&&le.resolveDepthBuffer===!1&&l){let Z=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[Z])}}}function tn(le){return Math.min(r.maxSamples,le.samples)}function bn(le){let Z=n.get(le);return le.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&Z.__useRenderToTexture!==!1}function _e(le){let Z=o.render.frame;u.get(le)!==Z&&(u.set(le,Z),le.update())}function vi(le,Z){let Te=le.colorSpace,Ie=le.format,Ge=le.type;return le.isCompressedTexture===!0||le.isVideoTexture===!0||Te!==t0&&Te!==ha&&(ln.getTransfer(Te)===kt?(Ie!==Or||Ge!==Ji)&&Xe("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):ze("WebGLTextures: Unsupported texture color space:",Te)),Z}function zn(le){return typeof HTMLImageElement<"u"&&le instanceof HTMLImageElement?(c.width=le.naturalWidth||le.width,c.height=le.naturalHeight||le.height):typeof VideoFrame<"u"&&le instanceof VideoFrame?(c.width=le.displayWidth,c.height=le.displayHeight):(c.width=le.width,c.height=le.height),c}this.allocateTextureUnit=$,this.resetTextureUnits=W,this.getTextureUnits=Y,this.setTextureUnits=H,this.setTexture2D=te,this.setTexture2DArray=ce,this.setTexture3D=he,this.setTextureCube=ve,this.rebindTextures=ot,this.setupRenderTarget=nt,this.updateRenderTargetMipmap=bt,this.updateMultisampleRenderTarget=en,this.setupDepthRenderbuffer=$e,this.setupFrameBufferTexture=Pt,this.useMultisampledRTT=bn,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function Vxe(i,e){function t(n,r=ha){let s,o=ln.getTransfer(r);if(n===Ji)return i.UNSIGNED_BYTE;if(n===ng)return i.UNSIGNED_SHORT_4_4_4_4;if(n===ig)return i.UNSIGNED_SHORT_5_5_5_1;if(n===rg)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===sg)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Oh)return i.BYTE;if(n===Uh)return i.SHORT;if(n===wl)return i.UNSIGNED_SHORT;if(n===Kr)return i.INT;if(n===xi)return i.UNSIGNED_INT;if(n===cr)return i.FLOAT;if(n===Wi)return i.HALF_FLOAT;if(n===u_)return i.ALPHA;if(n===Nd)return i.RGB;if(n===Or)return i.RGBA;if(n===Vs)return i.DEPTH_COMPONENT;if(n===xo)return i.DEPTH_STENCIL;if(n===Fd)return i.RED;if(n===kh)return i.RED_INTEGER;if(n===Ws)return i.RG;if(n===zh)return i.RG_INTEGER;if(n===g0)return i.RGBA_INTEGER;if(n===Vh||n===Gh||n===qh||n===Hh)if(o===kt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Vh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Gh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===qh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Hh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Vh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Gh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===qh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Hh)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===og||n===ag||n===lg||n===cg)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===og)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ag)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===lg)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===cg)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===v0||n===_0||n===x0||n===y0||n===b0||n===Wh||n===w0)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===v0||n===_0)return o===kt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===x0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===y0)return s.COMPRESSED_R11_EAC;if(n===b0)return s.COMPRESSED_SIGNED_R11_EAC;if(n===Wh)return s.COMPRESSED_RG11_EAC;if(n===w0)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===S0||n===T0||n===E0||n===M0||n===C0||n===R0||n===P0||n===I0||n===L0||n===D0||n===N0||n===F0||n===B0||n===O0)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===S0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===T0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===E0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===M0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===C0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===R0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===P0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===I0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===L0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===D0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===N0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===F0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===B0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===O0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===U0||n===k0||n===z0)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===U0)return o===kt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===k0)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===z0)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===V0||n===G0||n===jh||n===q0)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===V0)return s.COMPRESSED_RED_RGTC1_EXT;if(n===G0)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===jh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===q0)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===ua?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var Gxe=`40944094 void main() {40954095 40964096 gl_Position = vec4( position, 1.0 );40974097 4098-}`,jxe=`4098+}`,qxe=`40994099 uniform sampler2DArray depthColor;41004100 uniform float depthWidth;41014101 uniform float depthHeight;
@@ -4114,23 +4114,23 @@ void main() {
41144114 41154115 }41164116 4117-}`,UF=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new k2(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new ps({vertexShader:Wxe,fragmentShader:jxe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Hn(new ZA(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},kF=class extends ca{constructor(e,t){super();let n=this,r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,d=null,A=null,y=null,w=typeof XRWebGLBinding<"u",S=new UF,T={},R=t.getContextAttributes(),P=null,I=null,F=[],D=[],L=new Oe,C=null,B=new Yr;B.viewport=new xn;let k=new Yr;k.viewport=new xn;let z=[B,k],G=new c_,W=null,Y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new s0,F[Ee]=Ve),Ve.getTargetRaySpace()},this.getControllerGrip=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new s0,F[Ee]=Ve),Ve.getGripSpace()},this.getHand=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new s0,F[Ee]=Ve),Ve.getHandSpace()};function H(Ee){let Ve=D.indexOf(Ee.inputSource);if(Ve===-1)return;let Ye=F[Ve];Ye!==void 0&&(Ye.update(Ee.inputSource,Ee.frame,c||o),Ye.dispatchEvent({type:Ee.type,data:Ee.inputSource}))}function $(){r.removeEventListener("select",H),r.removeEventListener("selectstart",H),r.removeEventListener("selectend",H),r.removeEventListener("squeeze",H),r.removeEventListener("squeezestart",H),r.removeEventListener("squeezeend",H),r.removeEventListener("end",$),r.removeEventListener("inputsourceschange",J);for(let Ee=0;Ee<F.length;Ee++){let Ve=D[Ee];Ve!==null&&(D[Ee]=null,F[Ee].disconnect(Ve))}W=null,Y=null,S.reset();for(let Ee in T)delete T[Ee];e.setRenderTarget(P),A=null,d=null,f=null,r=null,I=null,mt.stop(),n.isPresenting=!1,e.setPixelRatio(C),e.setSize(L.width,L.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Ee){s=Ee,n.isPresenting===!0&&Xe("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Ee){a=Ee,n.isPresenting===!0&&Xe("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(Ee){c=Ee},this.getBaseLayer=function(){return d!==null?d:A},this.getBinding=function(){return f===null&&w&&(f=new XRWebGLBinding(r,t)),f},this.getFrame=function(){return y},this.getSession=function(){return r},this.setSession=async function(Ee){if(r=Ee,r!==null){if(P=e.getRenderTarget(),r.addEventListener("select",H),r.addEventListener("selectstart",H),r.addEventListener("selectend",H),r.addEventListener("squeeze",H),r.addEventListener("squeezestart",H),r.addEventListener("squeezeend",H),r.addEventListener("end",$),r.addEventListener("inputsourceschange",J),R.xrCompatible!==!0&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(L),w&&"createProjectionLayer"in XRWebGLBinding.prototype){let Ye=null,Mt=null,Et=null;R.depth&&(Et=R.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Ye=R.stencil?xo:Gs,Mt=R.stencil?ua:xi);let It={colorFormat:t.RGBA8,depthFormat:Et,scaleFactor:s};f=this.getBinding(),d=f.createProjectionLayer(It),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),I=new Oa(d.textureWidth,d.textureHeight,{format:Ur,type:Ji,depthTexture:new Cs(d.textureWidth,d.textureHeight,Mt,void 0,void 0,void 0,void 0,void 0,void 0,Ye),stencilBuffer:R.stencil,colorSpace:e.outputColorSpace,samples:R.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{let Ye={antialias:R.antialias,alpha:!0,depth:R.depth,stencil:R.stencil,framebufferScaleFactor:s};A=new XRWebGLLayer(r,t,Ye),r.updateRenderState({baseLayer:A}),e.setPixelRatio(1),e.setSize(A.framebufferWidth,A.framebufferHeight,!1),I=new Oa(A.framebufferWidth,A.framebufferHeight,{format:Ur,type:Ji,colorSpace:e.outputColorSpace,stencilBuffer:R.stencil,resolveDepthBuffer:A.ignoreDepthValues===!1,resolveStencilBuffer:A.ignoreDepthValues===!1})}I.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await r.requestReferenceSpace(a),mt.setContext(r),mt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return S.getDepthTexture()};function J(Ee){for(let Ve=0;Ve<Ee.removed.length;Ve++){let Ye=Ee.removed[Ve],Mt=D.indexOf(Ye);Mt>=0&&(D[Mt]=null,F[Mt].disconnect(Ye))}for(let Ve=0;Ve<Ee.added.length;Ve++){let Ye=Ee.added[Ve],Mt=D.indexOf(Ye);if(Mt===-1){for(let It=0;It<F.length;It++)if(It>=D.length){D.push(Ye),Mt=It;break}else if(D[It]===null){D[It]=Ye,Mt=It;break}if(Mt===-1)break}let Et=F[Mt];Et&&Et.connect(Ye)}}let te=new re,ce=new re;function he(Ee,Ve,Ye){te.setFromMatrixPosition(Ve.matrixWorld),ce.setFromMatrixPosition(Ye.matrixWorld);let Mt=te.distanceTo(ce),Et=Ve.projectionMatrix.elements,It=Ye.projectionMatrix.elements,dn=Et[14]/(Et[10]-1),Gt=Et[14]/(Et[10]+1),$e=(Et[9]+1)/Et[5],ot=(Et[9]-1)/Et[5],nt=(Et[8]-1)/Et[0],bt=(It[8]+1)/It[0],yt=dn*nt,hn=dn*bt,en=Mt/(-nt+bt),tn=en*-nt;if(Ve.matrixWorld.decompose(Ee.position,Ee.quaternion,Ee.scale),Ee.translateX(tn),Ee.translateZ(en),Ee.matrixWorld.compose(Ee.position,Ee.quaternion,Ee.scale),Ee.matrixWorldInverse.copy(Ee.matrixWorld).invert(),Et[10]===-1)Ee.projectionMatrix.copy(Ve.projectionMatrix),Ee.projectionMatrixInverse.copy(Ve.projectionMatrixInverse);else{let bn=dn+en,_e=Gt+en,vi=yt-tn,zn=hn+(Mt-tn),le=$e*Gt/_e*bn,Z=ot*Gt/_e*bn;Ee.projectionMatrix.makePerspective(vi,zn,le,Z,bn,_e),Ee.projectionMatrixInverse.copy(Ee.projectionMatrix).invert()}}function ve(Ee,Ve){Ve===null?Ee.matrixWorld.copy(Ee.matrix):Ee.matrixWorld.multiplyMatrices(Ve.matrixWorld,Ee.matrix),Ee.matrixWorldInverse.copy(Ee.matrixWorld).invert()}this.updateCamera=function(Ee){if(r===null)return;let Ve=Ee.near,Ye=Ee.far;S.texture!==null&&(S.depthNear>0&&(Ve=S.depthNear),S.depthFar>0&&(Ye=S.depthFar)),G.near=k.near=B.near=Ve,G.far=k.far=B.far=Ye,(W!==G.near||Y!==G.far)&&(r.updateRenderState({depthNear:G.near,depthFar:G.far}),W=G.near,Y=G.far),G.layers.mask=Ee.layers.mask|6,B.layers.mask=G.layers.mask&-5,k.layers.mask=G.layers.mask&-3;let Mt=Ee.parent,Et=G.cameras;ve(G,Mt);for(let It=0;It<Et.length;It++)ve(Et[It],Mt);Et.length===2?he(G,B,k):G.projectionMatrix.copy(B.projectionMatrix),Re(Ee,G,Mt)};function Re(Ee,Ve,Ye){Ye===null?Ee.matrix.copy(Ve.matrixWorld):(Ee.matrix.copy(Ye.matrixWorld),Ee.matrix.invert(),Ee.matrix.multiply(Ve.matrixWorld)),Ee.matrix.decompose(Ee.position,Ee.quaternion,Ee.scale),Ee.updateMatrixWorld(!0),Ee.projectionMatrix.copy(Ve.projectionMatrix),Ee.projectionMatrixInverse.copy(Ve.projectionMatrixInverse),Ee.isPerspectiveCamera&&(Ee.fov=Pd*2*Math.atan(1/Ee.projectionMatrix.elements[5]),Ee.zoom=1)}this.getCamera=function(){return G},this.getFoveation=function(){if(!(d===null&&A===null))return l},this.setFoveation=function(Ee){l=Ee,d!==null&&(d.fixedFoveation=Ee),A!==null&&A.fixedFoveation!==void 0&&(A.fixedFoveation=Ee)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(G)},this.getCameraTexture=function(Ee){return T[Ee]};let Qe=null;function Fe(Ee,Ve){if(u=Ve.getViewerPose(c||o),y=Ve,u!==null){let Ye=u.views;A!==null&&(e.setRenderTargetFramebuffer(I,A.framebuffer),e.setRenderTarget(I));let Mt=!1;Ye.length!==G.cameras.length&&(G.cameras.length=0,Mt=!0);for(let Gt=0;Gt<Ye.length;Gt++){let $e=Ye[Gt],ot=null;if(A!==null)ot=A.getViewport($e);else{let bt=f.getViewSubImage(d,$e);ot=bt.viewport,Gt===0&&(e.setRenderTargetTextures(I,bt.colorTexture,bt.depthStencilTexture),e.setRenderTarget(I))}let nt=z[Gt];nt===void 0&&(nt=new Yr,nt.layers.enable(Gt),nt.viewport=new xn,z[Gt]=nt),nt.matrix.fromArray($e.transform.matrix),nt.matrix.decompose(nt.position,nt.quaternion,nt.scale),nt.projectionMatrix.fromArray($e.projectionMatrix),nt.projectionMatrixInverse.copy(nt.projectionMatrix).invert(),nt.viewport.set(ot.x,ot.y,ot.width,ot.height),Gt===0&&(G.matrix.copy(nt.matrix),G.matrix.decompose(G.position,G.quaternion,G.scale)),Mt===!0&&G.cameras.push(nt)}let Et=r.enabledFeatures;if(Et&&Et.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&w){f=n.getBinding();let Gt=f.getDepthInformation(Ye[0]);Gt&&Gt.isValid&&Gt.texture&&S.init(Gt,r.renderState)}if(Et&&Et.includes("camera-access")&&w){e.state.unbindTexture(),f=n.getBinding();for(let Gt=0;Gt<Ye.length;Gt++){let $e=Ye[Gt].camera;if($e){let ot=T[$e];ot||(ot=new k2,T[$e]=ot);let nt=f.getCameraImage($e);ot.sourceTexture=nt}}}}for(let Ye=0;Ye<F.length;Ye++){let Mt=D[Ye],Et=F[Ye];Mt!==null&&Et!==void 0&&Et.update(Mt,Ve,c||o)}Qe&&Qe(Ee,Ve),Ve.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Ve}),y=null}let mt=new oK;mt.setAnimationLoop(Fe),this.setAnimationLoop=function(Ee){Qe=Ee},this.dispose=function(){}}},Xxe=new cn,fK=new Mn;fK.set(-1,0,0,0,1,0,0,0,1);function $xe(i,e){function t(S,T){S.matrixAutoUpdate===!0&&S.updateMatrix(),T.value.copy(S.matrix)}function n(S,T){T.color.getRGB(S.fogColor.value,gF(i)),T.isFog?(S.fogNear.value=T.near,S.fogFar.value=T.far):T.isFogExp2&&(S.fogDensity.value=T.density)}function r(S,T,R,P,I){T.isNodeMaterial?T.uniformsNeedUpdate=!1:T.isMeshBasicMaterial?s(S,T):T.isMeshLambertMaterial?(s(S,T),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)):T.isMeshToonMaterial?(s(S,T),f(S,T)):T.isMeshPhongMaterial?(s(S,T),u(S,T),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)):T.isMeshStandardMaterial?(s(S,T),d(S,T),T.isMeshPhysicalMaterial&&A(S,T,I)):T.isMeshMatcapMaterial?(s(S,T),y(S,T)):T.isMeshDepthMaterial?s(S,T):T.isMeshDistanceMaterial?(s(S,T),w(S,T)):T.isMeshNormalMaterial?s(S,T):T.isLineBasicMaterial?(o(S,T),T.isLineDashedMaterial&&a(S,T)):T.isPointsMaterial?l(S,T,R,P):T.isSpriteMaterial?c(S,T):T.isShadowMaterial?(S.color.value.copy(T.color),S.opacity.value=T.opacity):T.isShaderMaterial&&(T.uniformsNeedUpdate=!1)}function s(S,T){S.opacity.value=T.opacity,T.color&&S.diffuse.value.copy(T.color),T.emissive&&S.emissive.value.copy(T.emissive).multiplyScalar(T.emissiveIntensity),T.map&&(S.map.value=T.map,t(T.map,S.mapTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.bumpMap&&(S.bumpMap.value=T.bumpMap,t(T.bumpMap,S.bumpMapTransform),S.bumpScale.value=T.bumpScale,T.side===mi&&(S.bumpScale.value*=-1)),T.normalMap&&(S.normalMap.value=T.normalMap,t(T.normalMap,S.normalMapTransform),S.normalScale.value.copy(T.normalScale),T.side===mi&&S.normalScale.value.negate()),T.displacementMap&&(S.displacementMap.value=T.displacementMap,t(T.displacementMap,S.displacementMapTransform),S.displacementScale.value=T.displacementScale,S.displacementBias.value=T.displacementBias),T.emissiveMap&&(S.emissiveMap.value=T.emissiveMap,t(T.emissiveMap,S.emissiveMapTransform)),T.specularMap&&(S.specularMap.value=T.specularMap,t(T.specularMap,S.specularMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest);let R=e.get(T),P=R.envMap,I=R.envMapRotation;P&&(S.envMap.value=P,S.envMapRotation.value.setFromMatrix4(Xxe.makeRotationFromEuler(I)).transpose(),P.isCubeTexture&&P.isRenderTargetTexture===!1&&S.envMapRotation.value.premultiply(fK),S.reflectivity.value=T.reflectivity,S.ior.value=T.ior,S.refractionRatio.value=T.refractionRatio),T.lightMap&&(S.lightMap.value=T.lightMap,S.lightMapIntensity.value=T.lightMapIntensity,t(T.lightMap,S.lightMapTransform)),T.aoMap&&(S.aoMap.value=T.aoMap,S.aoMapIntensity.value=T.aoMapIntensity,t(T.aoMap,S.aoMapTransform))}function o(S,T){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,T.map&&(S.map.value=T.map,t(T.map,S.mapTransform))}function a(S,T){S.dashSize.value=T.dashSize,S.totalSize.value=T.dashSize+T.gapSize,S.scale.value=T.scale}function l(S,T,R,P){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,S.size.value=T.size*R,S.scale.value=P*.5,T.map&&(S.map.value=T.map,t(T.map,S.uvTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest)}function c(S,T){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,S.rotation.value=T.rotation,T.map&&(S.map.value=T.map,t(T.map,S.mapTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest)}function u(S,T){S.specular.value.copy(T.specular),S.shininess.value=Math.max(T.shininess,1e-4)}function f(S,T){T.gradientMap&&(S.gradientMap.value=T.gradientMap)}function d(S,T){S.metalness.value=T.metalness,T.metalnessMap&&(S.metalnessMap.value=T.metalnessMap,t(T.metalnessMap,S.metalnessMapTransform)),S.roughness.value=T.roughness,T.roughnessMap&&(S.roughnessMap.value=T.roughnessMap,t(T.roughnessMap,S.roughnessMapTransform)),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)}function A(S,T,R){S.ior.value=T.ior,T.sheen>0&&(S.sheenColor.value.copy(T.sheenColor).multiplyScalar(T.sheen),S.sheenRoughness.value=T.sheenRoughness,T.sheenColorMap&&(S.sheenColorMap.value=T.sheenColorMap,t(T.sheenColorMap,S.sheenColorMapTransform)),T.sheenRoughnessMap&&(S.sheenRoughnessMap.value=T.sheenRoughnessMap,t(T.sheenRoughnessMap,S.sheenRoughnessMapTransform))),T.clearcoat>0&&(S.clearcoat.value=T.clearcoat,S.clearcoatRoughness.value=T.clearcoatRoughness,T.clearcoatMap&&(S.clearcoatMap.value=T.clearcoatMap,t(T.clearcoatMap,S.clearcoatMapTransform)),T.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=T.clearcoatRoughnessMap,t(T.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),T.clearcoatNormalMap&&(S.clearcoatNormalMap.value=T.clearcoatNormalMap,t(T.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(T.clearcoatNormalScale),T.side===mi&&S.clearcoatNormalScale.value.negate())),T.dispersion>0&&(S.dispersion.value=T.dispersion),T.iridescence>0&&(S.iridescence.value=T.iridescence,S.iridescenceIOR.value=T.iridescenceIOR,S.iridescenceThicknessMinimum.value=T.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=T.iridescenceThicknessRange[1],T.iridescenceMap&&(S.iridescenceMap.value=T.iridescenceMap,t(T.iridescenceMap,S.iridescenceMapTransform)),T.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=T.iridescenceThicknessMap,t(T.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),T.transmission>0&&(S.transmission.value=T.transmission,S.transmissionSamplerMap.value=R.texture,S.transmissionSamplerSize.value.set(R.width,R.height),T.transmissionMap&&(S.transmissionMap.value=T.transmissionMap,t(T.transmissionMap,S.transmissionMapTransform)),S.thickness.value=T.thickness,T.thicknessMap&&(S.thicknessMap.value=T.thicknessMap,t(T.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=T.attenuationDistance,S.attenuationColor.value.copy(T.attenuationColor)),T.anisotropy>0&&(S.anisotropyVector.value.set(T.anisotropy*Math.cos(T.anisotropyRotation),T.anisotropy*Math.sin(T.anisotropyRotation)),T.anisotropyMap&&(S.anisotropyMap.value=T.anisotropyMap,t(T.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=T.specularIntensity,S.specularColor.value.copy(T.specularColor),T.specularColorMap&&(S.specularColorMap.value=T.specularColorMap,t(T.specularColorMap,S.specularColorMapTransform)),T.specularIntensityMap&&(S.specularIntensityMap.value=T.specularIntensityMap,t(T.specularIntensityMap,S.specularIntensityMapTransform))}function y(S,T){T.matcap&&(S.matcap.value=T.matcap)}function w(S,T){let R=e.get(T).light;S.referencePosition.value.setFromMatrixPosition(R.matrixWorld),S.nearDistance.value=R.shadow.camera.near,S.farDistance.value=R.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Yxe(i,e,t,n){let r={},s={},o=[],a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(I,F){let D=F.program;n.uniformBlockBinding(I,D)}function c(I,F){let D=r[I.id];D===void 0&&(S(I),D=u(I),r[I.id]=D,I.addEventListener("dispose",R));let L=F.program;n.updateUBOMapping(I,L);let C=e.render.frame;s[I.id]!==C&&(d(I),s[I.id]=C)}function u(I){let F=f();I.__bindingPointIndex=F;let D=i.createBuffer(),L=I.__size,C=I.usage;return i.bindBuffer(i.UNIFORM_BUFFER,D),i.bufferData(i.UNIFORM_BUFFER,L,C),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,F,D),D}function f(){for(let I=0;I<a;I++)if(o.indexOf(I)===-1)return o.push(I),I;return ze("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(I){let F=r[I.id],D=I.uniforms,L=I.__cache;i.bindBuffer(i.UNIFORM_BUFFER,F);for(let C=0,B=D.length;C<B;C++){let k=D[C];if(Array.isArray(k))for(let z=0,G=k.length;z<G;z++)A(k[z],C,z,L);else A(k,C,0,L)}i.bindBuffer(i.UNIFORM_BUFFER,null)}function A(I,F,D,L){if(w(I,F,D,L)===!0){let C=I.__offset,B=I.value;if(Array.isArray(B)){let k=0;for(let z=0;z<B.length;z++){let G=B[z],W=T(G);y(G,I.__data,k),typeof G!="number"&&typeof G!="boolean"&&!G.isMatrix3&&!ArrayBuffer.isView(G)&&(k+=W.storage/Float32Array.BYTES_PER_ELEMENT)}}else y(B,I.__data,0);i.bufferSubData(i.UNIFORM_BUFFER,C,I.__data)}}function y(I,F,D){typeof I=="number"||typeof I=="boolean"?F[0]=I:I.isMatrix3?(F[0]=I.elements[0],F[1]=I.elements[1],F[2]=I.elements[2],F[3]=0,F[4]=I.elements[3],F[5]=I.elements[4],F[6]=I.elements[5],F[7]=0,F[8]=I.elements[6],F[9]=I.elements[7],F[10]=I.elements[8],F[11]=0):ArrayBuffer.isView(I)?F.set(new I.constructor(I.buffer,I.byteOffset,F.length)):I.toArray(F,D)}function w(I,F,D,L){let C=I.value,B=F+"_"+D;if(L[B]===void 0)return typeof C=="number"||typeof C=="boolean"?L[B]=C:ArrayBuffer.isView(C)?L[B]=C.slice():L[B]=C.clone(),!0;{let k=L[B];if(typeof C=="number"||typeof C=="boolean"){if(k!==C)return L[B]=C,!0}else{if(ArrayBuffer.isView(C))return!0;if(k.equals(C)===!1)return k.copy(C),!0}}return!1}function S(I){let F=I.uniforms,D=0,L=16;for(let B=0,k=F.length;B<k;B++){let z=Array.isArray(F[B])?F[B]:[F[B]];for(let G=0,W=z.length;G<W;G++){let Y=z[G],H=Array.isArray(Y.value)?Y.value:[Y.value];for(let $=0,J=H.length;$<J;$++){let te=H[$],ce=T(te),he=D%L,ve=he%ce.boundary,Re=he+ve;D+=ve,Re!==0&&L-Re<ce.storage&&(D+=L-Re),Y.__data=new Float32Array(ce.storage/Float32Array.BYTES_PER_ELEMENT),Y.__offset=D,D+=ce.storage}}}let C=D%L;return C>0&&(D+=L-C),I.__size=D,I.__cache={},this}function T(I){let F={boundary:0,storage:0};return typeof I=="number"||typeof I=="boolean"?(F.boundary=4,F.storage=4):I.isVector2?(F.boundary=8,F.storage=8):I.isVector3||I.isColor?(F.boundary=16,F.storage=12):I.isVector4?(F.boundary=16,F.storage=16):I.isMatrix3?(F.boundary=48,F.storage=48):I.isMatrix4?(F.boundary=64,F.storage=64):I.isTexture?Xe("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(I)?(F.boundary=16,F.storage=I.byteLength):Xe("WebGLRenderer: Unsupported uniform value type.",I),F}function R(I){let F=I.target;F.removeEventListener("dispose",R);let D=o.indexOf(F.__bindingPointIndex);o.splice(D,1),i.deleteBuffer(r[F.id]),delete r[F.id],delete s[F.id]}function P(){for(let I in r)i.deleteBuffer(r[I]);o=[],r={},s={}}return{bind:l,update:c,dispose:P}}var Zxe=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Qh=null;function Kxe(){return Qh===null&&(Qh=new WA(Zxe,16,16,js,Wi),Qh.name="DFG_LUT",Qh.minFilter=Mi,Qh.magFilter=Mi,Qh.wrapS=la,Qh.wrapT=la,Qh.generateMipmaps=!1,Qh.needsUpdate=!0),Qh}var ZM=class{constructor(e={}){let{canvas:t=WM(),context:n=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1,reversedDepthBuffer:d=!1,outputBufferType:A=Ji}=e;this.isWebGLRenderer=!0;let y;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");y=n.getContextAttributes().alpha}else y=o;let w=A,S=new Set([v0,Hh,qh]),T=new Set([Ji,xi,Sl,ua,ig,rg]),R=new Uint32Array(4),P=new Int32Array(4),I=new re,F=null,D=null,L=[],C=[],B=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=ao,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let k=this,z=!1,G=null,W=null,Y=null,H=null;this._outputColorSpace=Br;let $=0,J=0,te=null,ce=-1,he=null,ve=new xn,Re=new xn,Qe=null,Fe=new zt(0),mt=0,Ee=t.width,Ve=t.height,Ye=1,Mt=null,Et=null,It=new xn(0,0,Ee,Ve),dn=new xn(0,0,Ee,Ve),Gt=!1,$e=new Hc,ot=!1,nt=!1,bt=new cn,yt=new re,hn=new xn,en={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},tn=!1;function bn(){return te===null?Ye:1}let _e=n;function vi(ne,Se){return t.getContext(ne,Se)}try{let ne={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${"185"}`),t.addEventListener("webglcontextlost",nr,!1),t.addEventListener("webglcontextrestored",Fn,!1),t.addEventListener("webglcontextcreationerror",rs,!1),_e===null){let Se="webgl2";if(_e=vi(Se,ne),_e===null)throw vi(Se)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(ne){throw ze("WebGLRenderer: "+ne.message),ne}let zn,le,Z,Te,Pe,Ge,vt,Tt,qe,Je,Pt,rn,Lt,Rt,fn,wn,Dn,ye,wt,Ze,St,Bt,ut;function Ce(){zn=new r_e(_e),zn.init(),St=new Hxe(_e,zn),le=new Zve(_e,zn,e,St),Z=new Gxe(_e,zn),le.reversedDepthBuffer&&d&&Z.buffers.depth.setReversed(!0),W=_e.createFramebuffer(),Y=_e.createFramebuffer(),H=_e.createFramebuffer(),Te=new a_e(_e),Pe=new Cxe,Ge=new qxe(_e,zn,Z,Pe,le,St,Te),vt=new i_e(k),Tt=new hge(_e),Bt=new $ve(_e,Tt),qe=new s_e(_e,Tt,Te,Bt),Je=new c_e(_e,qe,Tt,Bt,Te),ye=new l_e(_e,le,Ge),fn=new Kve(Pe),Pt=new Mxe(k,vt,zn,le,Bt,fn),rn=new $xe(k,Pe),Lt=new Ixe,Rt=new Bxe(zn),Dn=new Xve(k,vt,Z,Je,y,l),wn=new Vxe(k,Je,le),ut=new Yxe(_e,Te,le,Z),wt=new Yve(_e,zn,Te),Ze=new o_e(_e,zn,Te),Te.programs=Pt.programs,k.capabilities=le,k.extensions=zn,k.properties=Pe,k.renderLists=Lt,k.shadowMap=wn,k.state=Z,k.info=Te}Ce(),w!==Ji&&(B=new h_e(w,t.width,t.height,a,r,s));let Yt=new kF(k,_e);this.xr=Yt,this.getContext=function(){return _e},this.getContextAttributes=function(){return _e.getContextAttributes()},this.forceContextLoss=function(){let ne=zn.get("WEBGL_lose_context");ne&&ne.loseContext()},this.forceContextRestore=function(){let ne=zn.get("WEBGL_lose_context");ne&&ne.restoreContext()},this.getPixelRatio=function(){return Ye},this.setPixelRatio=function(ne){ne!==void 0&&(Ye=ne,this.setSize(Ee,Ve,!1))},this.getSize=function(ne){return ne.set(Ee,Ve)},this.setSize=function(ne,Se,ke=!0){if(Yt.isPresenting){Xe("WebGLRenderer: Can't change size while VR device is presenting.");return}Ee=ne,Ve=Se,t.width=Math.floor(ne*Ye),t.height=Math.floor(Se*Ye),ke===!0&&(t.style.width=ne+"px",t.style.height=Se+"px"),B!==null&&B.setSize(t.width,t.height),this.setViewport(0,0,ne,Se)},this.getDrawingBufferSize=function(ne){return ne.set(Ee*Ye,Ve*Ye).floor()},this.setDrawingBufferSize=function(ne,Se,ke){Ee=ne,Ve=Se,Ye=ke,t.width=Math.floor(ne*ke),t.height=Math.floor(Se*ke),this.setViewport(0,0,ne,Se)},this.setEffects=function(ne){if(w===Ji){ze("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(ne){for(let Se=0;Se<ne.length;Se++)if(ne[Se].isOutputPass===!0){Xe("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}B.setEffects(ne||[])},this.getCurrentViewport=function(ne){return ne.copy(ve)},this.getViewport=function(ne){return ne.copy(It)},this.setViewport=function(ne,Se,ke,De){ne.isVector4?It.set(ne.x,ne.y,ne.z,ne.w):It.set(ne,Se,ke,De),Z.viewport(ve.copy(It).multiplyScalar(Ye).round())},this.getScissor=function(ne){return ne.copy(dn)},this.setScissor=function(ne,Se,ke,De){ne.isVector4?dn.set(ne.x,ne.y,ne.z,ne.w):dn.set(ne,Se,ke,De),Z.scissor(Re.copy(dn).multiplyScalar(Ye).round())},this.getScissorTest=function(){return Gt},this.setScissorTest=function(ne){Z.setScissorTest(Gt=ne)},this.setOpaqueSort=function(ne){Mt=ne},this.setTransparentSort=function(ne){Et=ne},this.getClearColor=function(ne){return ne.copy(Dn.getClearColor())},this.setClearColor=function(){Dn.setClearColor(...arguments)},this.getClearAlpha=function(){return Dn.getClearAlpha()},this.setClearAlpha=function(){Dn.setClearAlpha(...arguments)},this.clear=function(ne=!0,Se=!0,ke=!0){let De=0;if(ne){let Ne=!1;if(te!==null){let qt=te.texture.format;Ne=S.has(qt)}if(Ne){let qt=te.texture.type,Qt=T.has(qt),Vt=Dn.getClearColor(),sn=Dn.getClearAlpha(),pn=Vt.r,Wn=Vt.g,Jn=Vt.b;Qt?(R[0]=pn,R[1]=Wn,R[2]=Jn,R[3]=sn,_e.clearBufferuiv(_e.COLOR,0,R)):(P[0]=pn,P[1]=Wn,P[2]=Jn,P[3]=sn,_e.clearBufferiv(_e.COLOR,0,P))}else De|=_e.COLOR_BUFFER_BIT}Se&&(De|=_e.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),ke&&(De|=_e.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),De!==0&&_e.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.setNodesHandler=function(ne){ne.setRenderer(this),G=ne},this.dispose=function(){t.removeEventListener("webglcontextlost",nr,!1),t.removeEventListener("webglcontextrestored",Fn,!1),t.removeEventListener("webglcontextcreationerror",rs,!1),Dn.dispose(),Lt.dispose(),Rt.dispose(),Pe.dispose(),vt.dispose(),Je.dispose(),Bt.dispose(),ut.dispose(),Pt.dispose(),Yt.dispose(),Yt.removeEventListener("sessionstart",Ks),Yt.removeEventListener("sessionend",Ul),oh.stop()};function nr(ne){ne.preventDefault(),zA("WebGLRenderer: Context Lost."),z=!0}function Fn(){zA("WebGLRenderer: Context Restored."),z=!1;let ne=Te.autoReset,Se=wn.enabled,ke=wn.autoUpdate,De=wn.needsUpdate,Ne=wn.type;Ce(),Te.autoReset=ne,wn.enabled=Se,wn.autoUpdate=ke,wn.needsUpdate=De,wn.type=Ne}function rs(ne){ze("WebGLRenderer: A WebGL context could not be created. Reason: ",ne.statusMessage)}function Dr(ne){let Se=ne.target;Se.removeEventListener("dispose",Dr),Bl(Se)}function Bl(ne){Sa(ne),Pe.remove(ne)}function Sa(ne){let Se=Pe.get(ne).programs;Se!==void 0&&(Se.forEach(function(ke){Pt.releaseProgram(ke)}),ne.isShaderMaterial&&Pt.releaseShaderCache(ne))}this.renderBufferDirect=function(ne,Se,ke,De,Ne,qt){Se===null&&(Se=en);let Qt=Ne.isMesh&&Ne.matrixWorld.determinantAffine()<0,Vt=GG(ne,Se,ke,De,Ne);Z.setMaterial(De,Qt);let sn=ke.index,pn=1;if(De.wireframe===!0){if(sn=qe.getWireframeAttribute(ke),sn===void 0)return;pn=2}let Wn=ke.drawRange,Jn=ke.attributes.position,gn=Wn.start*pn,Yi=(Wn.start+Wn.count)*pn;qt!==null&&(gn=Math.max(gn,qt.start*pn),Yi=Math.min(Yi,(qt.start+qt.count)*pn)),sn!==null?(gn=Math.max(gn,0),Yi=Math.min(Yi,sn.count)):Jn!=null&&(gn=Math.max(gn,0),Yi=Math.min(Yi,Jn.count));let ss=Yi-gn;if(ss<0||ss===1/0)return;Bt.setup(Ne,De,Vt,ke,sn);let Hr,ir=wt;if(sn!==null&&(Hr=Tt.get(sn),ir=Ze,ir.setIndex(Hr)),Ne.isMesh)De.wireframe===!0?(Z.setLineWidth(De.wireframeLinewidth*bn()),ir.setMode(_e.LINES)):ir.setMode(_e.TRIANGLES);else if(Ne.isLine){let Co=De.linewidth;Co===void 0&&(Co=1),Z.setLineWidth(Co*bn()),Ne.isLineSegments?ir.setMode(_e.LINES):Ne.isLineLoop?ir.setMode(_e.LINE_LOOP):ir.setMode(_e.LINE_STRIP)}else Ne.isPoints?ir.setMode(_e.POINTS):Ne.isSprite&&ir.setMode(_e.TRIANGLES);if(Ne.isBatchedMesh)if(zn.get("WEBGL_multi_draw"))ir.renderMultiDraw(Ne._multiDrawStarts,Ne._multiDrawCounts,Ne._multiDrawCount);else{let Co=Ne._multiDrawStarts,Zt=Ne._multiDrawCounts,sl=Ne._multiDrawCount,yi=sn?Tt.get(sn).bytesPerElement:1,kl=Pe.get(De).currentProgram.getUniforms();for(let fu=0;fu<sl;fu++)kl.setValue(_e,"_gl_DrawID",fu),ir.render(Co[fu]/yi,Zt[fu])}else if(Ne.isInstancedMesh)ir.renderInstances(gn,ss,Ne.count);else if(ke.isInstancedBufferGeometry){let Co=ke._maxInstanceCount!==void 0?ke._maxInstanceCount:1/0,Zt=Math.min(ke.instanceCount,Co);ir.renderInstances(gn,ss,Zt)}else ir.render(gn,ss)};function Ol(ne,Se,ke){ne.transparent===!0&&ne.side===vr&&ne.forceSinglePass===!1?(ne.side=mi,ne.needsUpdate=!0,Hx(ne,Se,ke),ne.side=zo,ne.needsUpdate=!0,Hx(ne,Se,ke),ne.side=vr):Hx(ne,Se,ke)}this.compile=function(ne,Se,ke=null){ke===null&&(ke=ne),D=Rt.get(ke),D.init(Se),C.push(D),ke.traverseVisible(function(Ne){Ne.isLight&&Ne.layers.test(Se.layers)&&(D.pushLight(Ne),Ne.castShadow&&D.pushShadow(Ne))}),ne!==ke&&ne.traverseVisible(function(Ne){Ne.isLight&&Ne.layers.test(Se.layers)&&(D.pushLight(Ne),Ne.castShadow&&D.pushShadow(Ne))}),D.setupLights();let De=new Set;return ne.traverse(function(Ne){if(!(Ne.isMesh||Ne.isPoints||Ne.isLine||Ne.isSprite))return;let qt=Ne.material;if(qt)if(Array.isArray(qt))for(let Qt=0;Qt<qt.length;Qt++){let Vt=qt[Qt];Ol(Vt,ke,Ne),De.add(Vt)}else Ol(qt,ke,Ne),De.add(qt)}),D=C.pop(),De},this.compileAsync=function(ne,Se,ke=null){let De=this.compile(ne,Se,ke);return new Promise(Ne=>{function qt(){if(De.forEach(function(Qt){Pe.get(Qt).currentProgram.isReady()&&De.delete(Qt)}),De.size===0){Ne(ne);return}setTimeout(qt,10)}zn.get("KHR_parallel_shader_compile")!==null?qt():setTimeout(qt,10)})};let rl=null;function xr(ne){rl&&rl(ne)}function Ks(){oh.stop()}function Ul(){oh.start()}let oh=new oK;oh.setAnimationLoop(xr),typeof self<"u"&&oh.setContext(self),this.setAnimationLoop=function(ne){rl=ne,Yt.setAnimationLoop(ne),ne===null?oh.stop():oh.start()},Yt.addEventListener("sessionstart",Ks),Yt.addEventListener("sessionend",Ul),this.render=function(ne,Se){if(Se!==void 0&&Se.isCamera!==!0){ze("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;G!==null&&G.renderStart(ne,Se);let ke=Yt.enabled===!0&&Yt.isPresenting===!0,De=B!==null&&(te===null||ke)&&B.begin(k,te);if(ne.matrixWorldAutoUpdate===!0&&ne.updateMatrixWorld(),Se.parent===null&&Se.matrixWorldAutoUpdate===!0&&Se.updateMatrixWorld(),Yt.enabled===!0&&Yt.isPresenting===!0&&(B===null||B.isCompositing()===!1)&&(Yt.cameraAutoUpdate===!0&&Yt.updateCamera(Se),Se=Yt.getCamera()),ne.isScene===!0&&ne.onBeforeRender(k,ne,Se,te),D=Rt.get(ne,C.length),D.init(Se),D.state.textureUnits=Ge.getTextureUnits(),C.push(D),bt.multiplyMatrices(Se.projectionMatrix,Se.matrixWorldInverse),$e.setFromProjectionMatrix(bt,ko,Se.reversedDepth),nt=this.localClippingEnabled,ot=fn.init(this.clippingPlanes,nt),F=Lt.get(ne,L.length),F.init(),L.push(F),Yt.enabled===!0&&Yt.isPresenting===!0){let Qt=k.xr.getDepthSensingMesh();Qt!==null&&rT(Qt,Se,-1/0,k.sortObjects)}rT(ne,Se,0,k.sortObjects),F.finish(),k.sortObjects===!0&&F.sort(Mt,Et,Se.reversedDepth),tn=Yt.enabled===!1||Yt.isPresenting===!1||Yt.hasDepthSensing()===!1,tn&&Dn.addToRenderList(F,ne),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),ot===!0&&fn.beginShadows();let Ne=D.state.shadowsArray;if(wn.render(Ne,ne,Se),ot===!0&&fn.endShadows(),(De&&B.hasRenderPass())===!1){let Qt=F.opaque,Vt=F.transmissive;if(D.setupLights(),Se.isArrayCamera){let sn=Se.cameras;if(Vt.length>0)for(let pn=0,Wn=sn.length;pn<Wn;pn++){let Jn=sn[pn];JP(Qt,Vt,ne,Jn)}tn&&Dn.render(ne);for(let pn=0,Wn=sn.length;pn<Wn;pn++){let Jn=sn[pn];QP(F,ne,Jn,Jn.viewport)}}else Vt.length>0&&JP(Qt,Vt,ne,Se),tn&&Dn.render(ne),QP(F,ne,Se)}te!==null&&J===0&&(Ge.updateMultisampleRenderTarget(te),Ge.updateRenderTargetMipmap(te)),De&&B.end(k),ne.isScene===!0&&ne.onAfterRender(k,ne,Se),Bt.resetDefaultState(),ce=-1,he=null,C.pop(),C.length>0?(D=C[C.length-1],Ge.setTextureUnits(D.state.textureUnits),ot===!0&&fn.setGlobalState(k.clippingPlanes,D.state.camera)):D=null,L.pop(),L.length>0?F=L[L.length-1]:F=null,G!==null&&G.renderEnd()};function rT(ne,Se,ke,De){if(ne.visible===!1)return;if(ne.layers.test(Se.layers)){if(ne.isGroup)ke=ne.renderOrder;else if(ne.isLOD)ne.autoUpdate===!0&&ne.update(Se);else if(ne.isLightProbeGrid)D.pushLightProbeGrid(ne);else if(ne.isLight)D.pushLight(ne),ne.castShadow&&D.pushShadow(ne);else if(ne.isSprite){if(!ne.frustumCulled||$e.intersectsSprite(ne)){De&&hn.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(bt);let Qt=Je.update(ne),Vt=ne.material;Vt.visible&&F.push(ne,Qt,Vt,ke,hn.z,null)}}else if((ne.isMesh||ne.isLine||ne.isPoints)&&(!ne.frustumCulled||$e.intersectsObject(ne))){let Qt=Je.update(ne),Vt=ne.material;if(De&&(ne.boundingSphere!==void 0?(ne.boundingSphere===null&&ne.computeBoundingSphere(),hn.copy(ne.boundingSphere.center)):(Qt.boundingSphere===null&&Qt.computeBoundingSphere(),hn.copy(Qt.boundingSphere.center)),hn.applyMatrix4(ne.matrixWorld).applyMatrix4(bt)),Array.isArray(Vt)){let sn=Qt.groups;for(let pn=0,Wn=sn.length;pn<Wn;pn++){let Jn=sn[pn],gn=Vt[Jn.materialIndex];gn&&gn.visible&&F.push(ne,Qt,gn,ke,hn.z,Jn)}}else Vt.visible&&F.push(ne,Qt,Vt,ke,hn.z,null)}}let qt=ne.children;for(let Qt=0,Vt=qt.length;Qt<Vt;Qt++)rT(qt[Qt],Se,ke,De)}function QP(ne,Se,ke,De){let{opaque:Ne,transmissive:qt,transparent:Qt}=ne;D.setupLightsView(ke),ot===!0&&fn.setGlobalState(k.clippingPlanes,ke),De&&Z.viewport(ve.copy(De)),Ne.length>0&&qx(Ne,Se,ke),qt.length>0&&qx(qt,Se,ke),Qt.length>0&&qx(Qt,Se,ke),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function JP(ne,Se,ke,De){if((ke.isScene===!0?ke.overrideMaterial:null)!==null)return;if(D.state.transmissionRenderTarget[De.id]===void 0){let gn=zn.has("EXT_color_buffer_half_float")||zn.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[De.id]=new Oa(1,1,{generateMipmaps:!0,type:gn?Wi:Ji,minFilter:Go,samples:Math.max(4,le.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ln.workingColorSpace})}let qt=D.state.transmissionRenderTarget[De.id],Qt=De.viewport||ve;qt.setSize(Qt.z*k.transmissionResolutionScale,Qt.w*k.transmissionResolutionScale);let Vt=k.getRenderTarget(),sn=k.getActiveCubeFace(),pn=k.getActiveMipmapLevel();k.setRenderTarget(qt),k.getClearColor(Fe),mt=k.getClearAlpha(),mt<1&&k.setClearColor(16777215,.5),k.clear(),tn&&Dn.render(ke);let Wn=k.toneMapping;k.toneMapping=ao;let Jn=De.viewport;if(De.viewport!==void 0&&(De.viewport=void 0),D.setupLightsView(De),ot===!0&&fn.setGlobalState(k.clippingPlanes,De),qx(ne,ke,De),Ge.updateMultisampleRenderTarget(qt),Ge.updateRenderTargetMipmap(qt),zn.has("WEBGL_multisampled_render_to_texture")===!1){let gn=!1;for(let Yi=0,ss=Se.length;Yi<ss;Yi++){let Hr=Se[Yi],{object:ir,geometry:Co,material:Zt,group:sl}=Hr;if(Zt.side===vr&&ir.layers.test(De.layers)){let yi=Zt.side;Zt.side=mi,Zt.needsUpdate=!0,eL(ir,ke,De,Co,Zt,sl),Zt.side=yi,Zt.needsUpdate=!0,gn=!0}}gn===!0&&(Ge.updateMultisampleRenderTarget(qt),Ge.updateRenderTargetMipmap(qt))}k.setRenderTarget(Vt,sn,pn),k.setClearColor(Fe,mt),Jn!==void 0&&(De.viewport=Jn),k.toneMapping=Wn}function qx(ne,Se,ke){let De=Se.isScene===!0?Se.overrideMaterial:null;for(let Ne=0,qt=ne.length;Ne<qt;Ne++){let Qt=ne[Ne],{object:Vt,geometry:sn,group:pn}=Qt,Wn=Qt.material;Wn.allowOverride===!0&&De!==null&&(Wn=De),Vt.layers.test(ke.layers)&&eL(Vt,Se,ke,sn,Wn,pn)}}function eL(ne,Se,ke,De,Ne,qt){ne.onBeforeRender(k,Se,ke,De,Ne,qt),ne.modelViewMatrix.multiplyMatrices(ke.matrixWorldInverse,ne.matrixWorld),ne.normalMatrix.getNormalMatrix(ne.modelViewMatrix),Ne.onBeforeRender(k,Se,ke,De,ne,qt),Ne.transparent===!0&&Ne.side===vr&&Ne.forceSinglePass===!1?(Ne.side=mi,Ne.needsUpdate=!0,k.renderBufferDirect(ke,Se,De,Ne,ne,qt),Ne.side=zo,Ne.needsUpdate=!0,k.renderBufferDirect(ke,Se,De,Ne,ne,qt),Ne.side=vr):k.renderBufferDirect(ke,Se,De,Ne,ne,qt),ne.onAfterRender(k,Se,ke,De,Ne,qt)}function Hx(ne,Se,ke){Se.isScene!==!0&&(Se=en);let De=Pe.get(ne),Ne=D.state.lights,qt=D.state.shadowsArray,Qt=Ne.state.version,Vt=Pt.getParameters(ne,Ne.state,qt,Se,ke,D.state.lightProbeGridArray),sn=Pt.getProgramCacheKey(Vt),pn=De.programs;De.environment=ne.isMeshStandardMaterial||ne.isMeshLambertMaterial||ne.isMeshPhongMaterial?Se.environment:null,De.fog=Se.fog;let Wn=ne.isMeshStandardMaterial||ne.isMeshLambertMaterial&&!ne.envMap||ne.isMeshPhongMaterial&&!ne.envMap;De.envMap=vt.get(ne.envMap||De.environment,Wn),De.envMapRotation=De.environment!==null&&ne.envMap===null?Se.environmentRotation:ne.envMapRotation,pn===void 0&&(ne.addEventListener("dispose",Dr),pn=new Map,De.programs=pn);let Jn=pn.get(sn);if(Jn!==void 0){if(De.currentProgram===Jn&&De.lightsStateVersion===Qt)return nL(ne,Vt),Jn}else Vt.uniforms=Pt.getUniforms(ne),G!==null&&ne.isNodeMaterial&&G.build(ne,ke,Vt),ne.onBeforeCompile(Vt,k),Jn=Pt.acquireProgram(Vt,sn),pn.set(sn,Jn),De.uniforms=Vt.uniforms;let gn=De.uniforms;return(!ne.isShaderMaterial&&!ne.isRawShaderMaterial||ne.clipping===!0)&&(gn.clippingPlanes=fn.uniform),nL(ne,Vt),De.needsLights=HG(ne),De.lightsStateVersion=Qt,De.needsLights&&(gn.ambientLightColor.value=Ne.state.ambient,gn.lightProbe.value=Ne.state.probe,gn.directionalLights.value=Ne.state.directional,gn.directionalLightShadows.value=Ne.state.directionalShadow,gn.spotLights.value=Ne.state.spot,gn.spotLightShadows.value=Ne.state.spotShadow,gn.rectAreaLights.value=Ne.state.rectArea,gn.ltc_1.value=Ne.state.rectAreaLTC1,gn.ltc_2.value=Ne.state.rectAreaLTC2,gn.pointLights.value=Ne.state.point,gn.pointLightShadows.value=Ne.state.pointShadow,gn.hemisphereLights.value=Ne.state.hemi,gn.directionalShadowMatrix.value=Ne.state.directionalShadowMatrix,gn.spotLightMatrix.value=Ne.state.spotLightMatrix,gn.spotLightMap.value=Ne.state.spotLightMap,gn.pointShadowMatrix.value=Ne.state.pointShadowMatrix),De.lightProbeGrid=D.state.lightProbeGridArray.length>0,De.currentProgram=Jn,De.uniformsList=null,Jn}function tL(ne){if(ne.uniformsList===null){let Se=ne.currentProgram.getUniforms();ne.uniformsList=A_.seqWithValue(Se.seq,ne.uniforms)}return ne.uniformsList}function nL(ne,Se){let ke=Pe.get(ne);ke.outputColorSpace=Se.outputColorSpace,ke.batching=Se.batching,ke.batchingColor=Se.batchingColor,ke.instancing=Se.instancing,ke.instancingColor=Se.instancingColor,ke.instancingMorph=Se.instancingMorph,ke.skinning=Se.skinning,ke.morphTargets=Se.morphTargets,ke.morphNormals=Se.morphNormals,ke.morphColors=Se.morphColors,ke.morphTargetsCount=Se.morphTargetsCount,ke.numClippingPlanes=Se.numClippingPlanes,ke.numIntersection=Se.numClipIntersection,ke.vertexAlphas=Se.vertexAlphas,ke.vertexTangents=Se.vertexTangents,ke.toneMapping=Se.toneMapping}function VG(ne,Se){if(ne.length===0)return null;if(ne.length===1)return ne[0].texture!==null?ne[0]:null;I.setFromMatrixPosition(Se.matrixWorld);for(let ke=0,De=ne.length;ke<De;ke++){let Ne=ne[ke];if(Ne.texture!==null&&Ne.boundingBox.containsPoint(I))return Ne}return null}function GG(ne,Se,ke,De,Ne){Se.isScene!==!0&&(Se=en),Ge.resetTextureUnits();let qt=Se.fog,Qt=De.isMeshStandardMaterial||De.isMeshLambertMaterial||De.isMeshPhongMaterial?Se.environment:null,Vt=te===null?k.outputColorSpace:te.isXRRenderTarget===!0?te.texture.colorSpace:ln.workingColorSpace,sn=De.isMeshStandardMaterial||De.isMeshLambertMaterial&&!De.envMap||De.isMeshPhongMaterial&&!De.envMap,pn=vt.get(De.envMap||Qt,sn),Wn=De.vertexColors===!0&&!!ke.attributes.color&&ke.attributes.color.itemSize===4,Jn=!!ke.attributes.tangent&&(!!De.normalMap||De.anisotropy>0),gn=!!ke.morphAttributes.position,Yi=!!ke.morphAttributes.normal,ss=!!ke.morphAttributes.color,Hr=ao;De.toneMapped&&(te===null||te.isXRRenderTarget===!0)&&(Hr=k.toneMapping);let ir=ke.morphAttributes.position||ke.morphAttributes.normal||ke.morphAttributes.color,Co=ir!==void 0?ir.length:0,Zt=Pe.get(De),sl=D.state.lights;if(ot===!0&&(nt===!0||ne!==he)){let pr=ne===he&&De.id===ce;fn.setState(De,ne,pr)}let yi=!1;De.version===Zt.__version?(Zt.needsLights&&Zt.lightsStateVersion!==sl.state.version||Zt.outputColorSpace!==Vt||Ne.isBatchedMesh&&Zt.batching===!1||!Ne.isBatchedMesh&&Zt.batching===!0||Ne.isBatchedMesh&&Zt.batchingColor===!0&&Ne.colorTexture===null||Ne.isBatchedMesh&&Zt.batchingColor===!1&&Ne.colorTexture!==null||Ne.isInstancedMesh&&Zt.instancing===!1||!Ne.isInstancedMesh&&Zt.instancing===!0||Ne.isSkinnedMesh&&Zt.skinning===!1||!Ne.isSkinnedMesh&&Zt.skinning===!0||Ne.isInstancedMesh&&Zt.instancingColor===!0&&Ne.instanceColor===null||Ne.isInstancedMesh&&Zt.instancingColor===!1&&Ne.instanceColor!==null||Ne.isInstancedMesh&&Zt.instancingMorph===!0&&Ne.morphTexture===null||Ne.isInstancedMesh&&Zt.instancingMorph===!1&&Ne.morphTexture!==null||Zt.envMap!==pn||De.fog===!0&&Zt.fog!==qt||Zt.numClippingPlanes!==void 0&&(Zt.numClippingPlanes!==fn.numPlanes||Zt.numIntersection!==fn.numIntersection)||Zt.vertexAlphas!==Wn||Zt.vertexTangents!==Jn||Zt.morphTargets!==gn||Zt.morphNormals!==Yi||Zt.morphColors!==ss||Zt.toneMapping!==Hr||Zt.morphTargetsCount!==Co||!!Zt.lightProbeGrid!=D.state.lightProbeGridArray.length>0)&&(yi=!0):(yi=!0,Zt.__version=De.version);let kl=Zt.currentProgram;yi===!0&&(kl=Hx(De,Se,Ne),G&&De.isNodeMaterial&&G.onUpdateProgram(De,kl,Zt));let fu=!1,Gf=!1,Om=!1,rr=kl.getUniforms(),os=Zt.uniforms;if(Z.useProgram(kl.program)&&(fu=!0,Gf=!0,Om=!0),De.id!==ce&&(ce=De.id,Gf=!0),Zt.needsLights){let pr=VG(D.state.lightProbeGridArray,Ne);Zt.lightProbeGrid!==pr&&(Zt.lightProbeGrid=pr,Gf=!0)}if(fu||he!==ne){Z.buffers.depth.getReversed()&&ne.reversedDepth!==!0&&(ne._reversedDepth=!0,ne.updateProjectionMatrix()),rr.setValue(_e,"projectionMatrix",ne.projectionMatrix),rr.setValue(_e,"viewMatrix",ne.matrixWorldInverse);let Hf=rr.map.cameraPosition;Hf!==void 0&&Hf.setValue(_e,yt.setFromMatrixPosition(ne.matrixWorld)),le.logarithmicDepthBuffer&&rr.setValue(_e,"logDepthBufFC",2/(Math.log(ne.far+1)/Math.LN2)),(De.isMeshPhongMaterial||De.isMeshToonMaterial||De.isMeshLambertMaterial||De.isMeshBasicMaterial||De.isMeshStandardMaterial||De.isShaderMaterial)&&rr.setValue(_e,"isOrthographic",ne.isOrthographicCamera===!0),he!==ne&&(he=ne,Gf=!0,Om=!0)}if(Zt.needsLights&&(sl.state.directionalShadowMap.length>0&&rr.setValue(_e,"directionalShadowMap",sl.state.directionalShadowMap,Ge),sl.state.spotShadowMap.length>0&&rr.setValue(_e,"spotShadowMap",sl.state.spotShadowMap,Ge),sl.state.pointShadowMap.length>0&&rr.setValue(_e,"pointShadowMap",sl.state.pointShadowMap,Ge)),Ne.isSkinnedMesh){rr.setOptional(_e,Ne,"bindMatrix"),rr.setOptional(_e,Ne,"bindMatrixInverse");let pr=Ne.skeleton;pr&&(pr.boneTexture===null&&pr.computeBoneTexture(),rr.setValue(_e,"boneTexture",pr.boneTexture,Ge))}Ne.isBatchedMesh&&(rr.setOptional(_e,Ne,"batchingTexture"),rr.setValue(_e,"batchingTexture",Ne._matricesTexture,Ge),rr.setOptional(_e,Ne,"batchingIdTexture"),rr.setValue(_e,"batchingIdTexture",Ne._indirectTexture,Ge),rr.setOptional(_e,Ne,"batchingColorTexture"),Ne._colorsTexture!==null&&rr.setValue(_e,"batchingColorTexture",Ne._colorsTexture,Ge));let qf=ke.morphAttributes;if((qf.position!==void 0||qf.normal!==void 0||qf.color!==void 0)&&ye.update(Ne,ke,kl),(Gf||Zt.receiveShadow!==Ne.receiveShadow)&&(Zt.receiveShadow=Ne.receiveShadow,rr.setValue(_e,"receiveShadow",Ne.receiveShadow)),(De.isMeshStandardMaterial||De.isMeshLambertMaterial||De.isMeshPhongMaterial)&&De.envMap===null&&Se.environment!==null&&(os.envMapIntensity.value=Se.environmentIntensity),os.dfgLUT!==void 0&&(os.dfgLUT.value=Kxe()),Gf){if(rr.setValue(_e,"toneMappingExposure",k.toneMappingExposure),Zt.needsLights&&qG(os,Om),qt&&De.fog===!0&&rn.refreshFogUniforms(os,qt),rn.refreshMaterialUniforms(os,De,Ye,Ve,D.state.transmissionRenderTarget[ne.id]),Zt.needsLights&&Zt.lightProbeGrid){let pr=Zt.lightProbeGrid;os.probesSH.value=pr.texture,os.probesMin.value.copy(pr.boundingBox.min),os.probesMax.value.copy(pr.boundingBox.max),os.probesResolution.value.copy(pr.resolution)}A_.upload(_e,tL(Zt),os,Ge)}if(De.isShaderMaterial&&De.uniformsNeedUpdate===!0&&(A_.upload(_e,tL(Zt),os,Ge),De.uniformsNeedUpdate=!1),De.isSpriteMaterial&&rr.setValue(_e,"center",Ne.center),rr.setValue(_e,"modelViewMatrix",Ne.modelViewMatrix),rr.setValue(_e,"normalMatrix",Ne.normalMatrix),rr.setValue(_e,"modelMatrix",Ne.matrixWorld),De.uniformsGroups!==void 0){let pr=De.uniformsGroups;for(let Hf=0,Um=pr.length;Hf<Um;Hf++){let iL=pr[Hf];ut.update(iL,kl),ut.bind(iL,kl)}}return kl}function qG(ne,Se){ne.ambientLightColor.needsUpdate=Se,ne.lightProbe.needsUpdate=Se,ne.directionalLights.needsUpdate=Se,ne.directionalLightShadows.needsUpdate=Se,ne.pointLights.needsUpdate=Se,ne.pointLightShadows.needsUpdate=Se,ne.spotLights.needsUpdate=Se,ne.spotLightShadows.needsUpdate=Se,ne.rectAreaLights.needsUpdate=Se,ne.hemisphereLights.needsUpdate=Se}function HG(ne){return ne.isMeshLambertMaterial||ne.isMeshToonMaterial||ne.isMeshPhongMaterial||ne.isMeshStandardMaterial||ne.isShadowMaterial||ne.isShaderMaterial&&ne.lights===!0}this.getActiveCubeFace=function(){return $},this.getActiveMipmapLevel=function(){return J},this.getRenderTarget=function(){return te},this.setRenderTargetTextures=function(ne,Se,ke){let De=Pe.get(ne);De.__autoAllocateDepthBuffer=ne.resolveDepthBuffer===!1,De.__autoAllocateDepthBuffer===!1&&(De.__useRenderToTexture=!1),Pe.get(ne.texture).__webglTexture=Se,Pe.get(ne.depthTexture).__webglTexture=De.__autoAllocateDepthBuffer?void 0:ke,De.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(ne,Se){let ke=Pe.get(ne);ke.__webglFramebuffer=Se,ke.__useDefaultFramebuffer=Se===void 0},this.setRenderTarget=function(ne,Se=0,ke=0){te=ne,$=Se,J=ke;let De=null,Ne=!1,qt=!1;if(ne){let Vt=Pe.get(ne);if(Vt.__useDefaultFramebuffer!==void 0){Z.bindFramebuffer(_e.FRAMEBUFFER,Vt.__webglFramebuffer),ve.copy(ne.viewport),Re.copy(ne.scissor),Qe=ne.scissorTest,Z.viewport(ve),Z.scissor(Re),Z.setScissorTest(Qe),ce=-1;return}else if(Vt.__webglFramebuffer===void 0)Ge.setupRenderTarget(ne);else if(Vt.__hasExternalTextures)Ge.rebindTextures(ne,Pe.get(ne.texture).__webglTexture,Pe.get(ne.depthTexture).__webglTexture);else if(ne.depthBuffer){let Wn=ne.depthTexture;if(Vt.__boundDepthTexture!==Wn){if(Wn!==null&&Pe.has(Wn)&&(ne.width!==Wn.image.width||ne.height!==Wn.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");Ge.setupDepthRenderbuffer(ne)}}let sn=ne.texture;(sn.isData3DTexture||sn.isDataArrayTexture||sn.isCompressedArrayTexture)&&(qt=!0);let pn=Pe.get(ne).__webglFramebuffer;ne.isWebGLCubeRenderTarget?(Array.isArray(pn[Se])?De=pn[Se][ke]:De=pn[Se],Ne=!0):ne.samples>0&&Ge.useMultisampledRTT(ne)===!1?De=Pe.get(ne).__webglMultisampledFramebuffer:Array.isArray(pn)?De=pn[ke]:De=pn,ve.copy(ne.viewport),Re.copy(ne.scissor),Qe=ne.scissorTest}else ve.copy(It).multiplyScalar(Ye).floor(),Re.copy(dn).multiplyScalar(Ye).floor(),Qe=Gt;if(ke!==0&&(De=W),Z.bindFramebuffer(_e.FRAMEBUFFER,De)&&Z.drawBuffers(ne,De),Z.viewport(ve),Z.scissor(Re),Z.setScissorTest(Qe),Ne){let Vt=Pe.get(ne.texture);_e.framebufferTexture2D(_e.FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Vt.__webglTexture,ke)}else if(qt){let Vt=Se;for(let sn=0;sn<ne.textures.length;sn++){let pn=Pe.get(ne.textures[sn]);_e.framebufferTextureLayer(_e.FRAMEBUFFER,_e.COLOR_ATTACHMENT0+sn,pn.__webglTexture,ke,Vt)}}else if(ne!==null&&ke!==0){let Vt=Pe.get(ne.texture);_e.framebufferTexture2D(_e.FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_2D,Vt.__webglTexture,ke)}ce=-1},this.readRenderTargetPixels=function(ne,Se,ke,De,Ne,qt,Qt,Vt=0){if(!(ne&&ne.isWebGLRenderTarget)){ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let sn=Pe.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&Qt!==void 0&&(sn=sn[Qt]),sn){Z.bindFramebuffer(_e.FRAMEBUFFER,sn);try{let pn=ne.textures[Vt],Wn=pn.format,Jn=pn.type;if(ne.textures.length>1&&_e.readBuffer(_e.COLOR_ATTACHMENT0+Vt),!le.textureFormatReadable(Wn)){ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!le.textureTypeReadable(Jn)){ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Se>=0&&Se<=ne.width-De&&ke>=0&&ke<=ne.height-Ne&&_e.readPixels(Se,ke,De,Ne,St.convert(Wn),St.convert(Jn),qt)}finally{let pn=te!==null?Pe.get(te).__webglFramebuffer:null;Z.bindFramebuffer(_e.FRAMEBUFFER,pn)}}},this.readRenderTargetPixelsAsync=async function(ne,Se,ke,De,Ne,qt,Qt,Vt=0){if(!(ne&&ne.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let sn=Pe.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&Qt!==void 0&&(sn=sn[Qt]),sn)if(Se>=0&&Se<=ne.width-De&&ke>=0&&ke<=ne.height-Ne){Z.bindFramebuffer(_e.FRAMEBUFFER,sn);let pn=ne.textures[Vt],Wn=pn.format,Jn=pn.type;if(ne.textures.length>1&&_e.readBuffer(_e.COLOR_ATTACHMENT0+Vt),!le.textureFormatReadable(Wn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!le.textureTypeReadable(Jn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let gn=_e.createBuffer();_e.bindBuffer(_e.PIXEL_PACK_BUFFER,gn),_e.bufferData(_e.PIXEL_PACK_BUFFER,qt.byteLength,_e.STREAM_READ),_e.readPixels(Se,ke,De,Ne,St.convert(Wn),St.convert(Jn),0);let Yi=te!==null?Pe.get(te).__webglFramebuffer:null;Z.bindFramebuffer(_e.FRAMEBUFFER,Yi);let ss=_e.fenceSync(_e.SYNC_GPU_COMMANDS_COMPLETE,0);return _e.flush(),await RZ(_e,ss,4),_e.bindBuffer(_e.PIXEL_PACK_BUFFER,gn),_e.getBufferSubData(_e.PIXEL_PACK_BUFFER,0,qt),_e.deleteBuffer(gn),_e.deleteSync(ss),qt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(ne,Se=null,ke=0){let De=Math.pow(2,-ke),Ne=Math.floor(ne.image.width*De),qt=Math.floor(ne.image.height*De),Qt=Se!==null?Se.x:0,Vt=Se!==null?Se.y:0;Ge.setTexture2D(ne,0),_e.copyTexSubImage2D(_e.TEXTURE_2D,ke,0,0,Qt,Vt,Ne,qt),Z.unbindTexture()},this.copyTextureToTexture=function(ne,Se,ke=null,De=null,Ne=0,qt=0){let Qt,Vt,sn,pn,Wn,Jn,gn,Yi,ss,Hr=ne.isCompressedTexture?ne.mipmaps[qt]:ne.image;if(ke!==null)Qt=ke.max.x-ke.min.x,Vt=ke.max.y-ke.min.y,sn=ke.isBox3?ke.max.z-ke.min.z:1,pn=ke.min.x,Wn=ke.min.y,Jn=ke.isBox3?ke.min.z:0;else{let os=Math.pow(2,-Ne);Qt=Math.floor(Hr.width*os),Vt=Math.floor(Hr.height*os),ne.isDataArrayTexture?sn=Hr.depth:ne.isData3DTexture?sn=Math.floor(Hr.depth*os):sn=1,pn=0,Wn=0,Jn=0}De!==null?(gn=De.x,Yi=De.y,ss=De.z):(gn=0,Yi=0,ss=0);let ir=St.convert(Se.format),Co=St.convert(Se.type),Zt;Se.isData3DTexture?(Ge.setTexture3D(Se,0),Zt=_e.TEXTURE_3D):Se.isDataArrayTexture||Se.isCompressedArrayTexture?(Ge.setTexture2DArray(Se,0),Zt=_e.TEXTURE_2D_ARRAY):(Ge.setTexture2D(Se,0),Zt=_e.TEXTURE_2D),Z.activeTexture(_e.TEXTURE0),Z.pixelStorei(_e.UNPACK_FLIP_Y_WEBGL,Se.flipY),Z.pixelStorei(_e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Se.premultiplyAlpha),Z.pixelStorei(_e.UNPACK_ALIGNMENT,Se.unpackAlignment);let sl=Z.getParameter(_e.UNPACK_ROW_LENGTH),yi=Z.getParameter(_e.UNPACK_IMAGE_HEIGHT),kl=Z.getParameter(_e.UNPACK_SKIP_PIXELS),fu=Z.getParameter(_e.UNPACK_SKIP_ROWS),Gf=Z.getParameter(_e.UNPACK_SKIP_IMAGES);Z.pixelStorei(_e.UNPACK_ROW_LENGTH,Hr.width),Z.pixelStorei(_e.UNPACK_IMAGE_HEIGHT,Hr.height),Z.pixelStorei(_e.UNPACK_SKIP_PIXELS,pn),Z.pixelStorei(_e.UNPACK_SKIP_ROWS,Wn),Z.pixelStorei(_e.UNPACK_SKIP_IMAGES,Jn);let Om=ne.isDataArrayTexture||ne.isData3DTexture,rr=Se.isDataArrayTexture||Se.isData3DTexture;if(ne.isDepthTexture){let os=Pe.get(ne),qf=Pe.get(Se),pr=Pe.get(os.__renderTarget),Hf=Pe.get(qf.__renderTarget);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,pr.__webglFramebuffer),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,Hf.__webglFramebuffer);for(let Um=0;Um<sn;Um++)Om&&(_e.framebufferTextureLayer(_e.READ_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,Pe.get(ne).__webglTexture,Ne,Jn+Um),_e.framebufferTextureLayer(_e.DRAW_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,Pe.get(Se).__webglTexture,qt,ss+Um)),_e.blitFramebuffer(pn,Wn,Qt,Vt,gn,Yi,Qt,Vt,_e.DEPTH_BUFFER_BIT,_e.NEAREST);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,null),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,null)}else if(Ne!==0||ne.isRenderTargetTexture||Pe.has(ne)){let os=Pe.get(ne),qf=Pe.get(Se);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,Y),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,H);for(let pr=0;pr<sn;pr++)Om?_e.framebufferTextureLayer(_e.READ_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,os.__webglTexture,Ne,Jn+pr):_e.framebufferTexture2D(_e.READ_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_2D,os.__webglTexture,Ne),rr?_e.framebufferTextureLayer(_e.DRAW_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,qf.__webglTexture,qt,ss+pr):_e.framebufferTexture2D(_e.DRAW_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_2D,qf.__webglTexture,qt),Ne!==0?_e.blitFramebuffer(pn,Wn,Qt,Vt,gn,Yi,Qt,Vt,_e.COLOR_BUFFER_BIT,_e.NEAREST):rr?_e.copyTexSubImage3D(Zt,qt,gn,Yi,ss+pr,pn,Wn,Qt,Vt):_e.copyTexSubImage2D(Zt,qt,gn,Yi,pn,Wn,Qt,Vt);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,null),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,null)}else rr?ne.isDataTexture||ne.isData3DTexture?_e.texSubImage3D(Zt,qt,gn,Yi,ss,Qt,Vt,sn,ir,Co,Hr.data):Se.isCompressedArrayTexture?_e.compressedTexSubImage3D(Zt,qt,gn,Yi,ss,Qt,Vt,sn,ir,Hr.data):_e.texSubImage3D(Zt,qt,gn,Yi,ss,Qt,Vt,sn,ir,Co,Hr):ne.isDataTexture?_e.texSubImage2D(_e.TEXTURE_2D,qt,gn,Yi,Qt,Vt,ir,Co,Hr.data):ne.isCompressedTexture?_e.compressedTexSubImage2D(_e.TEXTURE_2D,qt,gn,Yi,Hr.width,Hr.height,ir,Hr.data):_e.texSubImage2D(_e.TEXTURE_2D,qt,gn,Yi,Qt,Vt,ir,Co,Hr);Z.pixelStorei(_e.UNPACK_ROW_LENGTH,sl),Z.pixelStorei(_e.UNPACK_IMAGE_HEIGHT,yi),Z.pixelStorei(_e.UNPACK_SKIP_PIXELS,kl),Z.pixelStorei(_e.UNPACK_SKIP_ROWS,fu),Z.pixelStorei(_e.UNPACK_SKIP_IMAGES,Gf),qt===0&&Se.generateMipmaps&&_e.generateMipmap(Zt),Z.unbindTexture()},this.initRenderTarget=function(ne){Pe.get(ne).__webglFramebuffer===void 0&&Ge.setupRenderTarget(ne)},this.initTexture=function(ne){ne.isCubeTexture?Ge.setTextureCube(ne,0):ne.isData3DTexture?Ge.setTexture3D(ne,0):ne.isDataArrayTexture||ne.isCompressedArrayTexture?Ge.setTexture2DArray(ne,0):Ge.setTexture2D(ne,0),Z.unbindTexture()},this.resetState=function(){$=0,J=0,te=null,Z.reset(),Bt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ko}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=ln._getDrawingBufferColorSpace(e),t.unpackColorSpace=ln._getUnpackColorSpace()}};var JM=class extends lr{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Oe(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element&&t.element instanceof t.element.ownerDocument.defaultView.Element&&t.element.parentNode!==null&&t.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}},v_=new re,dK=new cn,pK=new cn,mK=new re,AK=new re,eC=class{constructor(e={}){let t=this,n,r,s,o,a={objects:new WeakMap},l=e.element!==void 0?e.element:document.createElement("div");l.style.overflow="hidden",this.domElement=l,this.sortObjects=!0,this.getSize=function(){return{width:n,height:r}},this.render=function(y,w){y.matrixWorldAutoUpdate===!0&&y.updateMatrixWorld(),w.parent===null&&w.matrixWorldAutoUpdate===!0&&w.updateMatrixWorld(),dK.copy(w.matrixWorldInverse),pK.multiplyMatrices(w.projectionMatrix,dK),u(y,y,w),this.sortObjects&&A(y)},this.setSize=function(y,w){n=y,r=w,s=n/2,o=r/2,l.style.width=y+"px",l.style.height=w+"px"};function c(y){y.isCSS2DObject&&(y.element.style.display="none");for(let w=0,S=y.children.length;w<S;w++)c(y.children[w])}function u(y,w,S){if(y.visible===!1){c(y);return}if(y.isCSS2DObject){v_.setFromMatrixPosition(y.matrixWorld),v_.applyMatrix4(pK);let T=v_.z>=-1&&v_.z<=1&&y.layers.test(S.layers)===!0,R=y.element;R.style.display=T===!0?"":"none",T===!0&&(y.onBeforeRender(t,w,S),R.style.transform="translate("+-100*y.center.x+"%,"+-100*y.center.y+"%)translate("+(v_.x*s+s)+"px,"+(-v_.y*o+o)+"px)",R.parentNode!==l&&l.appendChild(R),y.onAfterRender(t,w,S));let P={distanceToCameraSquared:f(S,y)};a.objects.set(y,P)}for(let T=0,R=y.children.length;T<R;T++)u(y.children[T],w,S)}function f(y,w){return mK.setFromMatrixPosition(y.matrixWorld),AK.setFromMatrixPosition(w.matrixWorld),mK.distanceToSquared(AK)}function d(y){let w=[];return y.traverseVisible(function(S){S.isCSS2DObject&&w.push(S)}),w}function A(y){let w=d(y).sort(function(T,R){if(T.renderOrder!==R.renderOrder)return R.renderOrder-T.renderOrder;let P=a.objects.get(T).distanceToCameraSquared,I=a.objects.get(R).distanceToCameraSquared;return P-I}),S=w.length;for(let T=0,R=w.length;T<R;T++)w[T].element.style.zIndex=S-T}}};function Qxe(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var Wb=Qxe;var Jxe=typeof global=="object"&&global&&global.Object===Object&&global,gK=Jxe;var eye=typeof self=="object"&&self&&self.Object===Object&&self,tye=gK||eye||Function("return this")(),tC=tye;var nye=function(){return tC.Date.now()},nC=nye;var iye=/\s/;function rye(i){for(var e=i.length;e--&&iye.test(i.charAt(e)););return e}var vK=rye;var sye=/^\s+/;function oye(i){return i&&i.slice(0,vK(i)+1).replace(sye,"")}var _K=oye;var aye=tC.Symbol,__=aye;var xK=Object.prototype,lye=xK.hasOwnProperty,cye=xK.toString,jb=__?__.toStringTag:void 0;function uye(i){var e=lye.call(i,jb),t=i[jb];try{i[jb]=void 0;var n=!0}catch{}var r=cye.call(i);return n&&(e?i[jb]=t:delete i[jb]),r}var yK=uye;var hye=Object.prototype,fye=hye.toString;function dye(i){return fye.call(i)}var bK=dye;var pye="[object Null]",mye="[object Undefined]",wK=__?__.toStringTag:void 0;function Aye(i){return i==null?i===void 0?mye:pye:wK&&wK in Object(i)?yK(i):bK(i)}var SK=Aye;function gye(i){return i!=null&&typeof i=="object"}var TK=gye;var vye="[object Symbol]";function _ye(i){return typeof i=="symbol"||TK(i)&&SK(i)==vye}var EK=_ye;var MK=NaN,xye=/^[-+]0x[0-9a-f]+$/i,yye=/^0b[01]+$/i,bye=/^0o[0-7]+$/i,wye=parseInt;function Sye(i){if(typeof i=="number")return i;if(EK(i))return MK;if(Wb(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=Wb(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=_K(i);var t=yye.test(i);return t||bye.test(i)?wye(i.slice(2),t?2:8):xye.test(i)?MK:+i}var zF=Sye;var Tye="Expected a function",Eye=Math.max,Mye=Math.min;function Cye(i,e,t){var n,r,s,o,a,l,c=0,u=!1,f=!1,d=!0;if(typeof i!="function")throw new TypeError(Tye);e=zF(e)||0,Wb(t)&&(u=!!t.leading,f="maxWait"in t,s=f?Eye(zF(t.maxWait)||0,e):s,d="trailing"in t?!!t.trailing:d);function A(D){var L=n,C=r;return n=r=void 0,c=D,o=i.apply(C,L),o}function y(D){return c=D,a=setTimeout(T,e),u?A(D):o}function w(D){var L=D-l,C=D-c,B=e-L;return f?Mye(B,s-C):B}function S(D){var L=D-l,C=D-c;return l===void 0||L>=e||L<0||f&&C>=s}function T(){var D=nC();if(S(D))return R(D);a=setTimeout(T,w(D))}function R(D){return a=void 0,d&&n?A(D):(n=r=void 0,o)}function P(){a!==void 0&&clearTimeout(a),c=0,n=l=r=a=void 0}function I(){return a===void 0?o:R(nC())}function F(){var D=nC(),L=S(D);if(n=arguments,r=this,l=D,L){if(a===void 0)return y(l);if(f)return clearTimeout(a),a=setTimeout(T,e),A(l)}return a===void 0&&(a=setTimeout(T,e)),o}return F.cancel=P,F.flush=I,F}var CK=Cye;function RK(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function Rye(i){if(Array.isArray(i))return i}function Iye(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Pye(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function Lye(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Dye(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4118-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nye(i,e){return Rye(i)||Lye(i,e)||Fye(i,e)||Dye()}function Fye(i,e){if(i){if(typeof i=="string")return RK(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?RK(i,e):void 0}}var Bye=Pye(function i(e,t){var n=t.default,r=n===void 0?null:n,s=t.triggerUpdate,o=s===void 0?!0:s,a=t.onChange,l=a===void 0?function(c,u){}:a;Iye(this,i),this.name=e,this.defaultVal=r,this.triggerUpdate=o,this.onChange=l});function Qr(i){var e=i.stateInit,t=e===void 0?function(){return{}}:e,n=i.props,r=n===void 0?{}:n,s=i.methods,o=s===void 0?{}:s,a=i.aliases,l=a===void 0?{}:a,c=i.init,u=c===void 0?function(){}:c,f=i.update,d=f===void 0?function(){}:f,A=Object.keys(r).map(function(y){return new Bye(y,r[y])});return function y(){for(var w=arguments.length,S=new Array(w),T=0;T<w;T++)S[T]=arguments[T];var R=!!(this instanceof y&&this.constructor),P=R?S.shift():void 0,I=S[0],F=I===void 0?{}:I,D=Object.assign({},t instanceof Function?t(F):t,{initialised:!1}),L={};function C(z){return B(z,F),k(),C}var B=function(G,W){u.call(C,G,D,W),D.initialised=!0},k=CK(function(){D.initialised&&(d.call(C,D,L),L={})},1);return A.forEach(function(z){C[z.name]=G(z);function G(W){var Y=W.name,H=W.triggerUpdate,$=H===void 0?!1:H,J=W.onChange,te=J===void 0?function(ve,Re){}:J,ce=W.defaultVal,he=ce===void 0?null:ce;return function(ve){var Re=D[Y];if(!arguments.length)return Re;var Qe=ve===void 0?he:ve;return D[Y]=Qe,te.call(C,Qe,D,Re),!L.hasOwnProperty(Y)&&(L[Y]=Re),$&&k(),C}}}),Object.keys(o).forEach(function(z){C[z]=function(){for(var G,W=arguments.length,Y=new Array(W),H=0;H<W;H++)Y[H]=arguments[H];return(G=o[z]).call.apply(G,[C,D].concat(Y))}}),Object.entries(l).forEach(function(z){var G=Nye(z,2),W=G[0],Y=G[1];return C[W]=C[Y]}),C.resetProps=function(){return A.forEach(function(z){C[z.name](z.defaultVal)}),C},C.resetProps(),D._rerender=k,R&&P&&C(P),C}}var Jr=Object.freeze({Linear:Object.freeze({None:function(i){return i},In:function(i){return i},Out:function(i){return i},InOut:function(i){return i}}),Quadratic:Object.freeze({In:function(i){return i*i},Out:function(i){return i*(2-i)},InOut:function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)}}),Cubic:Object.freeze({In:function(i){return i*i*i},Out:function(i){return--i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)}}),Quartic:Object.freeze({In:function(i){return i*i*i*i},Out:function(i){return 1- --i*i*i*i},InOut:function(i){return(i*=2)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2)}}),Quintic:Object.freeze({In:function(i){return i*i*i*i*i},Out:function(i){return--i*i*i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2)}}),Sinusoidal:Object.freeze({In:function(i){return 1-Math.sin((1-i)*Math.PI/2)},Out:function(i){return Math.sin(i*Math.PI/2)},InOut:function(i){return .5*(1-Math.sin(Math.PI*(.5-i)))}}),Exponential:Object.freeze({In:function(i){return i===0?0:Math.pow(1024,i-1)},Out:function(i){return i===1?1:1-Math.pow(2,-10*i)},InOut:function(i){return i===0?0:i===1?1:(i*=2)<1?.5*Math.pow(1024,i-1):.5*(-Math.pow(2,-10*(i-1))+2)}}),Circular:Object.freeze({In:function(i){return 1-Math.sqrt(1-i*i)},Out:function(i){return Math.sqrt(1- --i*i)},InOut:function(i){return(i*=2)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1)}}),Elastic:Object.freeze({In:function(i){return i===0?0:i===1?1:-Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI)},Out:function(i){return i===0?0:i===1?1:Math.pow(2,-10*i)*Math.sin((i-.1)*5*Math.PI)+1},InOut:function(i){return i===0?0:i===1?1:(i*=2,i<1?-.5*Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI):.5*Math.pow(2,-10*(i-1))*Math.sin((i-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(i){var e=1.70158;return i===1?1:i*i*((e+1)*i-e)},Out:function(i){var e=1.70158;return i===0?0:--i*i*((e+1)*i+e)+1},InOut:function(i){var e=2.5949095;return(i*=2)<1?.5*(i*i*((e+1)*i-e)):.5*((i-=2)*i*((e+1)*i+e)+2)}}),Bounce:Object.freeze({In:function(i){return 1-Jr.Bounce.Out(1-i)},Out:function(i){return i<.36363636363636365?7.5625*i*i:i<.7272727272727273?7.5625*(i-=.5454545454545454)*i+.75:i<.9090909090909091?7.5625*(i-=.8181818181818182)*i+.9375:7.5625*(i-=.9545454545454546)*i+.984375},InOut:function(i){return i<.5?Jr.Bounce.In(i*2)*.5:Jr.Bounce.Out(i*2-1)*.5+.5}}),generatePow:function(i){return i===void 0&&(i=4),i=i<Number.EPSILON?Number.EPSILON:i,i=i>1e4?1e4:i,{In:function(e){return Math.pow(e,i)},Out:function(e){return 1-Math.pow(1-e,i)},InOut:function(e){return e<.5?Math.pow(e*2,i)/2:(1-Math.pow(2-e*2,i))/2+.5}}}}),Xb=function(){return performance.now()},gg=(function(){function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,e)}return i.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},i.prototype.removeAll=function(){this._tweens={}},i.prototype.add=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,s=t;r<s.length;r++){var o=s[r];(e=o._group)===null||e===void 0||e.remove(o),o._group=this,this._tweens[o.getId()]=o,this._tweensAddedDuringUpdate[o.getId()]=o}},i.prototype.remove=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=0,r=e;n<r.length;n++){var s=r[n];s._group=void 0,delete this._tweens[s.getId()],delete this._tweensAddedDuringUpdate[s.getId()]}},i.prototype.allStopped=function(){return this.getAll().every(function(e){return!e.isPlaying()})},i.prototype.update=function(e,t){e===void 0&&(e=Xb()),t===void 0&&(t=!0);var n=Object.keys(this._tweens);if(n.length!==0)for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var s=this._tweens[n[r]],o=!t;s&&s.update(e,o)===!1&&!t&&this.remove(s)}n=Object.keys(this._tweensAddedDuringUpdate)}},i})(),x_={Linear:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=x_.Utils.Linear;return e<0?s(i[0],i[1],n):e>1?s(i[t],i[t-1],t-n):s(i[r],i[r+1>t?t:r+1],n-r)},Bezier:function(i,e){for(var t=0,n=i.length-1,r=Math.pow,s=x_.Utils.Bernstein,o=0;o<=n;o++)t+=r(1-e,n-o)*r(e,o)*i[o]*s(n,o);return t},CatmullRom:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=x_.Utils.CatmullRom;return i[0]===i[t]?(e<0&&(r=Math.floor(n=t*(1+e))),s(i[(r-1+t)%t],i[r],i[(r+1)%t],i[(r+2)%t],n-r)):e<0?i[0]-(s(i[0],i[0],i[1],i[1],-n)-i[0]):e>1?i[t]-(s(i[t],i[t],i[t-1],i[t-1],n-t)-i[t]):s(i[r?r-1:0],i[r],i[t<r+1?t:r+1],i[t<r+2?t:r+2],n-r)},Utils:{Linear:function(i,e,t){return(e-i)*t+i},Bernstein:function(i,e){var t=x_.Utils.Factorial;return t(i)/t(e)/t(i-e)},Factorial:(function(){var i=[1];return function(e){var t=1;if(i[e])return i[e];for(var n=e;n>1;n--)t*=n;return i[e]=t,t}})(),CatmullRom:function(i,e,t,n,r){var s=(t-i)*.5,o=(n-e)*.5,a=r*r,l=r*a;return(2*e-2*t+s+o)*l+(-3*e+3*t-2*s-o)*a+s*r+e}}},IK=(function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i})(),VF=new gg,uo=(function(){function i(e,t){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Jr.Linear.None,this._interpolationFunction=x_.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=IK.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=e,typeof t=="object"?(this._group=t,t.add(this)):t===!0&&(this._group=VF,VF.add(this))}return i.prototype.getId=function(){return this._id},i.prototype.isPlaying=function(){return this._isPlaying},i.prototype.isPaused=function(){return this._isPaused},i.prototype.getDuration=function(){return this._duration},i.prototype.to=function(e,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},i.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},i.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},i.prototype.start=function(e,t){if(e===void 0&&(e=Xb()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var s in this._valuesEnd)r[s]=this._valuesEnd[s];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},i.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},i.prototype._setupProperties=function(e,t,n,r,s){for(var o in n){var a=e[o],l=Array.isArray(a),c=l?"array":typeof a,u=!l&&Array.isArray(n[o]);if(!(c==="undefined"||c==="function")){if(u){var f=n[o];if(f.length===0)continue;for(var d=[a],A=0,y=f.length;A<y;A+=1){var w=this._handleRelativeValue(a,f[A]);if(isNaN(w)){u=!1,console.warn("Found invalid interpolation list. Skipping.");break}d.push(w)}u&&(n[o]=d)}if((c==="object"||l)&&a&&!u){t[o]=l?[]:{};var S=a;for(var T in S)t[o][T]=S[T];r[o]=l?[]:{};var f=n[o];if(!this._isDynamic){var R={};for(var T in f)R[T]=f[T];n[o]=f=R}this._setupProperties(S,t[o],f,r[o],s)}else(typeof t[o]>"u"||s)&&(t[o]=a),l||(t[o]*=1),u?r[o]=n[o].slice().reverse():r[o]=t[o]||0}}},i.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},i.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},i.prototype.pause=function(e){return e===void 0&&(e=Xb()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},i.prototype.resume=function(e){return e===void 0&&(e=Xb()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this)},i.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},i.prototype.group=function(e){return e?(e.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},i.prototype.remove=function(){var e;return(e=this._group)===null||e===void 0||e.remove(this),this},i.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},i.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},i.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},i.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},i.prototype.easing=function(e){return e===void 0&&(e=Jr.Linear.None),this._easingFunction=e,this},i.prototype.interpolation=function(e){return e===void 0&&(e=x_.Linear),this._interpolationFunction=e,this},i.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},i.prototype.onStart=function(e){return this._onStartCallback=e,this},i.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},i.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},i.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},i.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},i.prototype.onStop=function(e){return this._onStopCallback=e,this},i.prototype.update=function(e,t){var n=this,r;if(e===void 0&&(e=Xb()),t===void 0&&(t=i.autoStartOnUpdate),this._isPaused)return!0;var s;if(!this._goToEnd&&!this._isPlaying)if(t)this.start(e,!0);else return!1;if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var o=e-this._startTime,a=this._duration+((r=this._repeatDelayTime)!==null&&r!==void 0?r:this._delayTime),l=this._duration+this._repeat*a,c=function(){if(n._duration===0||o>l)return 1;var w=Math.trunc(o/a),S=o-w*a,T=Math.min(S/n._duration,1);return T===0&&o===n._duration?1:T},u=c(),f=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||o>=this._duration)if(this._repeat>0){var d=Math.min(Math.trunc((o-this._duration)/a)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=d);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=a*d,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var A=0,y=this._chainedTweens.length;A<y;A++)this._chainedTweens[A].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},i.prototype._updateProperties=function(e,t,n,r){for(var s in n)if(t[s]!==void 0){var o=t[s]||0,a=n[s],l=Array.isArray(e[s]),c=Array.isArray(a),u=!l&&c;u?e[s]=this._interpolationFunction(a,r):typeof a=="object"&&a?this._updateProperties(e[s],o,a,r):(a=this._handleRelativeValue(o,a),typeof a=="number"&&(e[s]=o+(a-o)*r))}},i.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},i.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];typeof n=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(n):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},i.autoStartOnUpdate=!1,i})();var mJe=IK.nextId,Jh=VF,AJe=Jh.getAll.bind(Jh),gJe=Jh.removeAll.bind(Jh),vJe=Jh.add.bind(Jh),_Je=Jh.remove.bind(Jh),xJe=Jh.update.bind(Jh);function PK(i){let e=+this._x.call(null,i),t=+this._y.call(null,i),n=+this._z.call(null,i);return LK(this.cover(e,t,n),e,t,n,i)}function LK(i,e,t,n,r){if(isNaN(e)||isNaN(t)||isNaN(n))return i;var s,o=i._root,a={data:r},l=i._x0,c=i._y0,u=i._z0,f=i._x1,d=i._y1,A=i._z1,y,w,S,T,R,P,I,F,D,L,C;if(!o)return i._root=a,i;for(;o.length;)if((I=e>=(y=(l+f)/2))?l=y:f=y,(F=t>=(w=(c+d)/2))?c=w:d=w,(D=n>=(S=(u+A)/2))?u=S:A=S,s=o,!(o=o[L=D<<2|F<<1|I]))return s[L]=a,i;if(T=+i._x.call(null,o.data),R=+i._y.call(null,o.data),P=+i._z.call(null,o.data),e===T&&t===R&&n===P)return a.next=o,s?s[L]=a:i._root=a,i;do s=s?s[L]=new Array(8):i._root=new Array(8),(I=e>=(y=(l+f)/2))?l=y:f=y,(F=t>=(w=(c+d)/2))?c=w:d=w,(D=n>=(S=(u+A)/2))?u=S:A=S;while((L=D<<2|F<<1|I)===(C=(P>=S)<<2|(R>=w)<<1|T>=y));return s[C]=o,s[L]=a,i}function DK(i){Array.isArray(i)||(i=Array.from(i));let e=i.length,t=new Float64Array(e),n=new Float64Array(e),r=new Float64Array(e),s=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,u=-1/0;for(let f=0,d,A,y,w;f<e;++f)isNaN(A=+this._x.call(null,d=i[f]))||isNaN(y=+this._y.call(null,d))||isNaN(w=+this._z.call(null,d))||(t[f]=A,n[f]=y,r[f]=w,A<s&&(s=A),A>l&&(l=A),y<o&&(o=y),y>c&&(c=y),w<a&&(a=w),w>u&&(u=w));if(s>l||o>c||a>u)return this;this.cover(s,o,a).cover(l,c,u);for(let f=0;f<e;++f)LK(this,t[f],n[f],r[f],i[f]);return this}function NK(i,e,t){if(isNaN(i=+i)||isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,s=this._z0,o=this._x1,a=this._y1,l=this._z1;if(isNaN(n))o=(n=Math.floor(i))+1,a=(r=Math.floor(e))+1,l=(s=Math.floor(t))+1;else{for(var c=o-n||1,u=this._root,f,d;n>i||i>=o||r>e||e>=a||s>t||t>=l;)switch(d=(t<s)<<2|(e<r)<<1|i<n,f=new Array(8),f[d]=u,u=f,c*=2,d){case 0:o=n+c,a=r+c,l=s+c;break;case 1:n=o-c,a=r+c,l=s+c;break;case 2:o=n+c,r=a-c,l=s+c;break;case 3:n=o-c,r=a-c,l=s+c;break;case 4:o=n+c,a=r+c,s=l-c;break;case 5:n=o-c,a=r+c,s=l-c;break;case 6:o=n+c,r=a-c,s=l-c;break;case 7:n=o-c,r=a-c,s=l-c;break}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=r,this._z0=s,this._x1=o,this._y1=a,this._z1=l,this}function FK(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function BK(i){return arguments.length?this.cover(+i[0][0],+i[0][1],+i[0][2]).cover(+i[1][0],+i[1][1],+i[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function ji(i,e,t,n,r,s,o){this.node=i,this.x0=e,this.y0=t,this.z0=n,this.x1=r,this.y1=s,this.z1=o}function OK(i,e,t,n){var r,s=this._x0,o=this._y0,a=this._z0,l,c,u,f,d,A,y=this._x1,w=this._y1,S=this._z1,T=[],R=this._root,P,I;for(R&&T.push(new ji(R,s,o,a,y,w,S)),n==null?n=1/0:(s=i-n,o=e-n,a=t-n,y=i+n,w=e+n,S=t+n,n*=n);P=T.pop();)if(!(!(R=P.node)||(l=P.x0)>y||(c=P.y0)>w||(u=P.z0)>S||(f=P.x1)<s||(d=P.y1)<o||(A=P.z1)<a))if(R.length){var F=(l+f)/2,D=(c+d)/2,L=(u+A)/2;T.push(new ji(R[7],F,D,L,f,d,A),new ji(R[6],l,D,L,F,d,A),new ji(R[5],F,c,L,f,D,A),new ji(R[4],l,c,L,F,D,A),new ji(R[3],F,D,u,f,d,L),new ji(R[2],l,D,u,F,d,L),new ji(R[1],F,c,u,f,D,L),new ji(R[0],l,c,u,F,D,L)),(I=(t>=L)<<2|(e>=D)<<1|i>=F)&&(P=T[T.length-1],T[T.length-1]=T[T.length-1-I],T[T.length-1-I]=P)}else{var C=i-+this._x.call(null,R.data),B=e-+this._y.call(null,R.data),k=t-+this._z.call(null,R.data),z=C*C+B*B+k*k;if(z<n){var G=Math.sqrt(n=z);s=i-G,o=e-G,a=t-G,y=i+G,w=e+G,S=t+G,r=R.data}}return r}var Oye=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function UK(i,e,t,n){let r=[],s=i-n,o=e-n,a=t-n,l=i+n,c=e+n,u=t+n;return this.visit((f,d,A,y,w,S,T)=>{if(!f.length)do{let R=f.data;Oye(i,e,t,this._x(R),this._y(R),this._z(R))<=n&&r.push(R)}while(f=f.next);return d>l||A>c||y>u||w<s||S<o||T<a}),r}function kK(i){if(isNaN(d=+this._x.call(null,i))||isNaN(A=+this._y.call(null,i))||isNaN(y=+this._z.call(null,i)))return this;var e,t=this._root,n,r,s,o=this._x0,a=this._y0,l=this._z0,c=this._x1,u=this._y1,f=this._z1,d,A,y,w,S,T,R,P,I,F,D;if(!t)return this;if(t.length)for(;;){if((R=d>=(w=(o+c)/2))?o=w:c=w,(P=A>=(S=(a+u)/2))?a=S:u=S,(I=y>=(T=(l+f)/2))?l=T:f=T,e=t,!(t=t[F=I<<2|P<<1|R]))return this;if(!t.length)break;(e[F+1&7]||e[F+2&7]||e[F+3&7]||e[F+4&7]||e[F+5&7]||e[F+6&7]||e[F+7&7])&&(n=e,D=F)}for(;t.data!==i;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[F]=s:delete e[F],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[D]=t:this._root=t),this):(this._root=s,this)}function zK(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function VK(){return this._root}function GK(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function qK(i){var e=[],t,n=this._root,r,s,o,a,l,c,u;for(n&&e.push(new ji(n,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));t=e.pop();)if(!i(n=t.node,s=t.x0,o=t.y0,a=t.z0,l=t.x1,c=t.y1,u=t.z1)&&n.length){var f=(s+l)/2,d=(o+c)/2,A=(a+u)/2;(r=n[7])&&e.push(new ji(r,f,d,A,l,c,u)),(r=n[6])&&e.push(new ji(r,s,d,A,f,c,u)),(r=n[5])&&e.push(new ji(r,f,o,A,l,d,u)),(r=n[4])&&e.push(new ji(r,s,o,A,f,d,u)),(r=n[3])&&e.push(new ji(r,f,d,a,l,c,A)),(r=n[2])&&e.push(new ji(r,s,d,a,f,c,A)),(r=n[1])&&e.push(new ji(r,f,o,a,l,d,A)),(r=n[0])&&e.push(new ji(r,s,o,a,f,d,A))}return this}function HK(i){var e=[],t=[],n;for(this._root&&e.push(new ji(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=e.pop();){var r=n.node;if(r.length){var s,o=n.x0,a=n.y0,l=n.z0,c=n.x1,u=n.y1,f=n.z1,d=(o+c)/2,A=(a+u)/2,y=(l+f)/2;(s=r[0])&&e.push(new ji(s,o,a,l,d,A,y)),(s=r[1])&&e.push(new ji(s,d,a,l,c,A,y)),(s=r[2])&&e.push(new ji(s,o,A,l,d,u,y)),(s=r[3])&&e.push(new ji(s,d,A,l,c,u,y)),(s=r[4])&&e.push(new ji(s,o,a,y,d,A,f)),(s=r[5])&&e.push(new ji(s,d,a,y,c,A,f)),(s=r[6])&&e.push(new ji(s,o,A,y,d,u,f)),(s=r[7])&&e.push(new ji(s,d,A,y,c,u,f))}t.push(n)}for(;n=t.pop();)i(n.node,n.x0,n.y0,n.z0,n.x1,n.y1,n.z1);return this}function WK(i){return i[0]}function jK(i){return arguments.length?(this._x=i,this):this._x}function XK(i){return i[1]}function $K(i){return arguments.length?(this._y=i,this):this._y}function YK(i){return i[2]}function ZK(i){return arguments.length?(this._z=i,this):this._z}function $b(i,e,t,n){var r=new GF(e??WK,t??XK,n??YK,NaN,NaN,NaN,NaN,NaN,NaN);return i==null?r:r.addAll(i)}function GF(i,e,t,n,r,s,o,a,l){this._x=i,this._y=e,this._z=t,this._x0=n,this._y0=r,this._z0=s,this._x1=o,this._y1=a,this._z1=l,this._root=void 0}function KK(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var qo=$b.prototype=GF.prototype;qo.copy=function(){var i=new GF(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),e=this._root,t,n;if(!e)return i;if(!e.length)return i._root=KK(e),i;for(t=[{source:e,target:i._root=new Array(8)}];e=t.pop();)for(var r=0;r<8;++r)(n=e.source[r])&&(n.length?t.push({source:n,target:e.target[r]=new Array(8)}):e.target[r]=KK(n));return i};qo.add=PK;qo.addAll=DK;qo.cover=NK;qo.data=FK;qo.extent=BK;qo.find=OK;qo.findAllWithinRadius=UK;qo.remove=kK;qo.removeAll=zK;qo.root=VK;qo.size=GK;qo.visit=qK;qo.visitAfter=HK;qo.x=jK;qo.y=$K;qo.z=ZK;function vg(i,e){return i==null||e==null?NaN:i<e?-1:i>e?1:i>=e?0:NaN}function qF(i,e){return i==null||e==null?NaN:e<i?-1:e>i?1:e>=i?0:NaN}function iC(i){let e,t,n;i.length!==2?(e=vg,t=(a,l)=>vg(i(a),l),n=(a,l)=>i(a)-l):(e=i===vg||i===qF?i:Uye,t=i,n=i);function r(a,l,c=0,u=a.length){if(c<u){if(e(l,l)!==0)return u;do{let f=c+u>>>1;t(a[f],l)<0?c=f+1:u=f}while(c<u)}return c}function s(a,l,c=0,u=a.length){if(c<u){if(e(l,l)!==0)return u;do{let f=c+u>>>1;t(a[f],l)<=0?c=f+1:u=f}while(c<u)}return c}function o(a,l,c=0,u=a.length){let f=r(a,l,c,u-1);return f>c&&n(a[f-1],l)>-n(a[f],l)?f-1:f}return{left:r,center:o,right:s}}function Uye(){return 0}function HF(i){return i===null?NaN:+i}var QK=iC(vg),JK=QK.right,kye=QK.left,zye=iC(HF).center,Yb=JK;function j0(i,e){let t,n;if(e===void 0)for(let r of i)r!=null&&(t===void 0?r>=r&&(t=n=r):(t>r&&(t=r),n<r&&(n=r)));else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(t===void 0?s>=s&&(t=n=s):(t>s&&(t=s),n<s&&(n=s)))}return[t,n]}var Ho=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){let t=this._partials,n=0;for(let r=0;r<this._n&&r<32;r++){let s=t[r],o=e+s,a=Math.abs(e)<Math.abs(s)?e-(o-s):s-(o-e);a&&(t[n++]=a),e=o}return t[n]=e,this._n=n+1,this}valueOf(){let e=this._partials,t=this._n,n,r,s,o=0;if(t>0){for(o=e[--t];t>0&&(n=o,r=e[--t],o=n+r,s=r-(o-n),!s););t>0&&(s<0&&e[t-1]<0||s>0&&e[t-1]>0)&&(r=s*2,n=o+r,r==n-o&&(o=n))}return o}};var Vye=Math.sqrt(50),Gye=Math.sqrt(10),qye=Math.sqrt(2);function rC(i,e,t){let n=(e-i)/Math.max(0,t),r=Math.floor(Math.log10(n)),s=n/Math.pow(10,r),o=s>=Vye?10:s>=Gye?5:s>=qye?2:1,a,l,c;return r<0?(c=Math.pow(10,-r)/o,a=Math.round(i*c),l=Math.round(e*c),a/c<i&&++a,l/c>e&&--l,c=-c):(c=Math.pow(10,r)*o,a=Math.round(i/c),l=Math.round(e/c),a*c<i&&++a,l*c>e&&--l),l<a&&.5<=t&&t<2?rC(i,e,t*2):[a,l,c]}function sC(i,e,t){if(e=+e,i=+i,t=+t,!(t>0))return[];if(i===e)return[i];let n=e<i,[r,s,o]=n?rC(e,i,t):rC(i,e,t);if(!(s>=r))return[];let a=s-r+1,l=new Array(a);if(n)if(o<0)for(let c=0;c<a;++c)l[c]=(s-c)/-o;else for(let c=0;c<a;++c)l[c]=(s-c)*o;else if(o<0)for(let c=0;c<a;++c)l[c]=(r+c)/-o;else for(let c=0;c<a;++c)l[c]=(r+c)*o;return l}function Zb(i,e,t){return e=+e,i=+i,t=+t,rC(i,e,t)[2]}function WF(i,e,t){e=+e,i=+i,t=+t;let n=e<i,r=n?Zb(e,i,t):Zb(i,e,t);return(n?-1:1)*(r<0?1/-r:r)}function oC(i,e){let t;if(e===void 0)for(let n of i)n!=null&&(t<n||t===void 0&&n>=n)&&(t=n);else{let n=-1;for(let r of i)(r=e(r,++n,i))!=null&&(t<r||t===void 0&&r>=r)&&(t=r)}return t}function aC(i,e){let t=0,n=0;if(e===void 0)for(let r of i)r!=null&&(r=+r)>=r&&(++t,n+=r);else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(s=+s)>=s&&(++t,n+=s)}if(t)return n/t}function*Hye(i){for(let e of i)yield*e}function ef(i){return Array.from(Hye(i))}function zd(i,e,t){i=+i,e=+e,t=(r=arguments.length)<2?(e=i,i=0,1):r<3?1:+t;for(var n=-1,r=Math.max(0,Math.ceil((e-i)/t))|0,s=new Array(r);++n<r;)s[n]=i+n*t;return s}function lC(i,e){let t=0;if(e===void 0)for(let n of i)(n=+n)&&(t+=n);else{let n=-1;for(let r of i)(r=+e(r,++n,i))&&(t+=r)}return t}function cC(i,e){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(e).domain(i);break}return this}function uC(i,e,t){i.prototype=e.prototype=t,t.constructor=i}function jF(i,e){var t=Object.create(i.prototype);for(var n in e)t[n]=e[n];return t}function Jb(){}var Kb=.7,dC=1/Kb,y_="\\s*([+-]?\\d+)\\s*",Qb="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",tf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Wye=/^#([0-9a-f]{3,8})$/,jye=new RegExp(`^rgb\\(${y_},${y_},${y_}\\)$`),Xye=new RegExp(`^rgb\\(${tf},${tf},${tf}\\)$`),$ye=new RegExp(`^rgba\\(${y_},${y_},${y_},${Qb}\\)$`),Yye=new RegExp(`^rgba\\(${tf},${tf},${tf},${Qb}\\)$`),Zye=new RegExp(`^hsl\\(${Qb},${tf},${tf}\\)$`),Kye=new RegExp(`^hsla\\(${Qb},${tf},${tf},${Qb}\\)$`),eQ={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};uC(Jb,Gu,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:tQ,formatHex:tQ,formatHex8:Qye,formatHsl:Jye,formatRgb:nQ,toString:nQ});function tQ(){return this.rgb().formatHex()}function Qye(){return this.rgb().formatHex8()}function Jye(){return lQ(this).formatHsl()}function nQ(){return this.rgb().formatRgb()}function Gu(i){var e,t;return i=(i+"").trim().toLowerCase(),(e=Wye.exec(i))?(t=e[1].length,e=parseInt(e[1],16),t===6?iQ(e):t===3?new Tl(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?hC(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?hC(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=jye.exec(i))?new Tl(e[1],e[2],e[3],1):(e=Xye.exec(i))?new Tl(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=$ye.exec(i))?hC(e[1],e[2],e[3],e[4]):(e=Yye.exec(i))?hC(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Zye.exec(i))?oQ(e[1],e[2]/100,e[3]/100,1):(e=Kye.exec(i))?oQ(e[1],e[2]/100,e[3]/100,e[4]):eQ.hasOwnProperty(i)?iQ(eQ[i]):i==="transparent"?new Tl(NaN,NaN,NaN,0):null}function iQ(i){return new Tl(i>>16&255,i>>8&255,i&255,1)}function hC(i,e,t,n){return n<=0&&(i=e=t=NaN),new Tl(i,e,t,n)}function e2e(i){return i instanceof Jb||(i=Gu(i)),i?(i=i.rgb(),new Tl(i.r,i.g,i.b,i.opacity)):new Tl}function b_(i,e,t,n){return arguments.length===1?e2e(i):new Tl(i,e,t,n??1)}function Tl(i,e,t,n){this.r=+i,this.g=+e,this.b=+t,this.opacity=+n}uC(Tl,b_,jF(Jb,{brighter(i){return i=i==null?dC:Math.pow(dC,i),new Tl(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?Kb:Math.pow(Kb,i),new Tl(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new Tl(xg(this.r),xg(this.g),xg(this.b),pC(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:rQ,formatHex:rQ,formatHex8:t2e,formatRgb:sQ,toString:sQ}));function rQ(){return`#${_g(this.r)}${_g(this.g)}${_g(this.b)}`}function t2e(){return`#${_g(this.r)}${_g(this.g)}${_g(this.b)}${_g((isNaN(this.opacity)?1:this.opacity)*255)}`}function sQ(){let i=pC(this.opacity);return`${i===1?"rgb(":"rgba("}${xg(this.r)}, ${xg(this.g)}, ${xg(this.b)}${i===1?")":`, ${i})`}`}function pC(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function xg(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function _g(i){return i=xg(i),(i<16?"0":"")+i.toString(16)}function oQ(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new Vu(i,e,t,n)}function lQ(i){if(i instanceof Vu)return new Vu(i.h,i.s,i.l,i.opacity);if(i instanceof Jb||(i=Gu(i)),!i)return new Vu;if(i instanceof Vu)return i;i=i.rgb();var e=i.r/255,t=i.g/255,n=i.b/255,r=Math.min(e,t,n),s=Math.max(e,t,n),o=NaN,a=s-r,l=(s+r)/2;return a?(e===s?o=(t-n)/a+(t<n)*6:t===s?o=(n-e)/a+2:o=(e-t)/a+4,a/=l<.5?s+r:2-s-r,o*=60):a=l>0&&l<1?0:o,new Vu(o,a,l,i.opacity)}function cQ(i,e,t,n){return arguments.length===1?lQ(i):new Vu(i,e,t,n??1)}function Vu(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}uC(Vu,cQ,jF(Jb,{brighter(i){return i=i==null?dC:Math.pow(dC,i),new Vu(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?Kb:Math.pow(Kb,i),new Vu(this.h,this.s,this.l*i,this.opacity)},rgb(){var i=this.h%360+(this.h<0)*360,e=isNaN(i)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*e,r=2*t-n;return new Tl(XF(i>=240?i-240:i+120,r,n),XF(i,r,n),XF(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new Vu(aQ(this.h),fC(this.s),fC(this.l),pC(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(){let i=pC(this.opacity);return`${i===1?"hsl(":"hsla("}${aQ(this.h)}, ${fC(this.s)*100}%, ${fC(this.l)*100}%${i===1?")":`, ${i})`}`}}));function aQ(i){return i=(i||0)%360,i<0?i+360:i}function fC(i){return Math.max(0,Math.min(1,i||0))}function XF(i,e,t){return(i<60?e+(t-e)*i/60:i<180?t:i<240?e+(t-e)*(240-i)/60:e)*255}function $F(i,e,t,n,r){var s=i*i,o=s*i;return((1-3*i+3*s-o)*e+(4-6*s+3*o)*t+(1+3*i+3*s-3*o)*n+o*r)/6}function uQ(i){var e=i.length-1;return function(t){var n=t<=0?t=0:t>=1?(t=1,e-1):Math.floor(t*e),r=i[n],s=i[n+1],o=n>0?i[n-1]:2*r-s,a=n<e-1?i[n+2]:2*s-r;return $F((t-n/e)*e,o,r,s,a)}}function hQ(i){var e=i.length;return function(t){var n=Math.floor(((t%=1)<0?++t:t)*e),r=i[(n+e-1)%e],s=i[n%e],o=i[(n+1)%e],a=i[(n+2)%e];return $F((t-n/e)*e,r,s,o,a)}}var ew=i=>()=>i;function n2e(i,e){return function(t){return i+t*e}}function i2e(i,e,t){return i=Math.pow(i,t),e=Math.pow(e,t)-i,t=1/t,function(n){return Math.pow(i+n*e,t)}}function fQ(i){return(i=+i)==1?mC:function(e,t){return t-e?i2e(e,t,i):ew(isNaN(e)?t:e)}}function mC(i,e){var t=e-i;return t?n2e(i,t):ew(isNaN(i)?e:i)}var YF=(function i(e){var t=fQ(e);function n(r,s){var o=t((r=b_(r)).r,(s=b_(s)).r),a=t(r.g,s.g),l=t(r.b,s.b),c=mC(r.opacity,s.opacity);return function(u){return r.r=o(u),r.g=a(u),r.b=l(u),r.opacity=c(u),r+""}}return n.gamma=i,n})(1);function dQ(i){return function(e){var t=e.length,n=new Array(t),r=new Array(t),s=new Array(t),o,a;for(o=0;o<t;++o)a=b_(e[o]),n[o]=a.r||0,r[o]=a.g||0,s[o]=a.b||0;return n=i(n),r=i(r),s=i(s),a.opacity=1,function(l){return a.r=n(l),a.g=r(l),a.b=s(l),a+""}}}var Ket=dQ(uQ),Qet=dQ(hQ);function AC(i,e){e||(e=[]);var t=i?Math.min(e.length,i.length):0,n=e.slice(),r;return function(s){for(r=0;r<t;++r)n[r]=i[r]*(1-s)+e[r]*s;return n}}function gC(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function ZF(i,e){return(gC(e)?AC:KF)(i,e)}function KF(i,e){var t=e?e.length:0,n=i?Math.min(t,i.length):0,r=new Array(n),s=new Array(t),o;for(o=0;o<n;++o)r[o]=yg(i[o],e[o]);for(;o<t;++o)s[o]=e[o];return function(a){for(o=0;o<n;++o)s[o]=r[o](a);return s}}function pQ(i,e){var t=new Date;return i=+i,e=+e,function(n){return t.setTime(i*(1-n)+e*n),t}}function nf(i,e){return i=+i,e=+e,function(t){return i*(1-t)+e*t}}function mQ(i,e){var t={},n={},r;(i===null||typeof i!="object")&&(i={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in i?t[r]=yg(i[r],e[r]):n[r]=e[r];return function(s){for(r in t)n[r]=t[r](s);return n}}var JF=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,QF=new RegExp(JF.source,"g");function r2e(i){return function(){return i}}function s2e(i){return function(e){return i(e)+""}}function AQ(i,e){var t=JF.lastIndex=QF.lastIndex=0,n,r,s,o=-1,a=[],l=[];for(i=i+"",e=e+"";(n=JF.exec(i))&&(r=QF.exec(e));)(s=r.index)>t&&(s=e.slice(t,s),a[o]?a[o]+=s:a[++o]=s),(n=n[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,l.push({i:o,x:nf(n,r)})),t=QF.lastIndex;return t<e.length&&(s=e.slice(t),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?s2e(l[0].x):r2e(e):(e=l.length,function(c){for(var u=0,f;u<e;++u)a[(f=l[u]).i]=f.x(c);return a.join("")})}function yg(i,e){var t=typeof e,n;return e==null||t==="boolean"?ew(e):(t==="number"?nf:t==="string"?(n=Gu(e))?(e=n,YF):AQ:e instanceof Gu?YF:e instanceof Date?pQ:gC(e)?AC:Array.isArray(e)?KF:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?mQ:nf)(i,e)}function eB(i,e){return i=+i,e=+e,function(t){return Math.round(i*(1-t)+e*t)}}function tB(i){return function(){return i}}function nB(i){return+i}var gQ=[0,1];function w_(i){return i}function iB(i,e){return(e-=i=+i)?function(t){return(t-i)/e}:tB(isNaN(e)?NaN:.5)}function o2e(i,e){var t;return i>e&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function a2e(i,e,t){var n=i[0],r=i[1],s=e[0],o=e[1];return r<n?(n=iB(r,n),s=t(o,s)):(n=iB(n,r),s=t(s,o)),function(a){return s(n(a))}}function l2e(i,e,t){var n=Math.min(i.length,e.length)-1,r=new Array(n),s=new Array(n),o=-1;for(i[n]<i[0]&&(i=i.slice().reverse(),e=e.slice().reverse());++o<n;)r[o]=iB(i[o],i[o+1]),s[o]=t(e[o],e[o+1]);return function(a){var l=Yb(i,a,1,n)-1;return s[l](r[l](a))}}function vQ(i,e){return e.domain(i.domain()).range(i.range()).interpolate(i.interpolate()).clamp(i.clamp()).unknown(i.unknown())}function c2e(){var i=gQ,e=gQ,t=yg,n,r,s,o=w_,a,l,c;function u(){var d=Math.min(i.length,e.length);return o!==w_&&(o=o2e(i[0],i[d-1])),a=d>2?l2e:a2e,l=c=null,f}function f(d){return d==null||isNaN(d=+d)?s:(l||(l=a(i.map(n),e,t)))(n(o(d)))}return f.invert=function(d){return o(r((c||(c=a(e,i.map(n),nf)))(d)))},f.domain=function(d){return arguments.length?(i=Array.from(d,nB),u()):i.slice()},f.range=function(d){return arguments.length?(e=Array.from(d),u()):e.slice()},f.rangeRound=function(d){return e=Array.from(d),t=eB,u()},f.clamp=function(d){return arguments.length?(o=d?!0:w_,u()):o!==w_},f.interpolate=function(d){return arguments.length?(t=d,u()):t},f.unknown=function(d){return arguments.length?(s=d,f):s},function(d,A){return n=d,r=A,u()}}function rB(){return c2e()(w_,w_)}function _Q(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function bg(i,e){if(!isFinite(i)||i===0)return null;var t=(i=e?i.toExponential(e-1):i.toExponential()).indexOf("e"),n=i.slice(0,t);return[n.length>1?n[0]+n.slice(2):n,+i.slice(t+1)]}function rf(i){return i=bg(Math.abs(i)),i?i[1]:NaN}function xQ(i,e){return function(t,n){for(var r=t.length,s=[],o=0,a=i[0],l=0;r>0&&a>0&&(l+a+1>n&&(a=Math.max(1,n-l)),s.push(t.substring(r-=a,r+a)),!((l+=a+1)>n));)a=i[o=(o+1)%i.length];return s.reverse().join(e)}}function yQ(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var u2e=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function X0(i){if(!(e=u2e.exec(i)))throw new Error("invalid format: "+i);var e;return new vC({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]})}X0.prototype=vC.prototype;function vC(i){this.fill=i.fill===void 0?" ":i.fill+"",this.align=i.align===void 0?">":i.align+"",this.sign=i.sign===void 0?"-":i.sign+"",this.symbol=i.symbol===void 0?"":i.symbol+"",this.zero=!!i.zero,this.width=i.width===void 0?void 0:+i.width,this.comma=!!i.comma,this.precision=i.precision===void 0?void 0:+i.precision,this.trim=!!i.trim,this.type=i.type===void 0?"":i.type+""}vC.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 bQ(i){e:for(var e=i.length,t=1,n=-1,r;t<e;++t)switch(i[t]){case".":n=r=t;break;case"0":n===0&&(n=t),r=t;break;default:if(!+i[t])break e;n>0&&(n=0);break}return n>0?i.slice(0,n)+i.slice(r+1):i}var tw;function wQ(i,e){var t=bg(i,e);if(!t)return tw=void 0,i.toPrecision(e);var n=t[0],r=t[1],s=r-(tw=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,o=n.length;return s===o?n:s>o?n+new Array(s-o+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+bg(i,Math.max(0,e+s-1))[0]}function sB(i,e){var t=bg(i,e);if(!t)return i+"";var n=t[0],r=t[1];return r<0?"0."+new Array(-r).join("0")+n:n.length>r+1?n.slice(0,r+1)+"."+n.slice(r+1):n+new Array(r-n.length+2).join("0")}var oB={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:_Q,e:(i,e)=>i.toExponential(e),f:(i,e)=>i.toFixed(e),g:(i,e)=>i.toPrecision(e),o:i=>Math.round(i).toString(8),p:(i,e)=>sB(i*100,e),r:sB,s:wQ,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function aB(i){return i}var SQ=Array.prototype.map,TQ=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function EQ(i){var e=i.grouping===void 0||i.thousands===void 0?aB:xQ(SQ.call(i.grouping,Number),i.thousands+""),t=i.currency===void 0?"":i.currency[0]+"",n=i.currency===void 0?"":i.currency[1]+"",r=i.decimal===void 0?".":i.decimal+"",s=i.numerals===void 0?aB:yQ(SQ.call(i.numerals,String)),o=i.percent===void 0?"%":i.percent+"",a=i.minus===void 0?"\u2212":i.minus+"",l=i.nan===void 0?"NaN":i.nan+"";function c(f,d){f=X0(f);var A=f.fill,y=f.align,w=f.sign,S=f.symbol,T=f.zero,R=f.width,P=f.comma,I=f.precision,F=f.trim,D=f.type;D==="n"?(P=!0,D="g"):oB[D]||(I===void 0&&(I=12),F=!0,D="g"),(T||A==="0"&&y==="=")&&(T=!0,A="0",y="=");var L=(d&&d.prefix!==void 0?d.prefix:"")+(S==="$"?t:S==="#"&&/[boxX]/.test(D)?"0"+D.toLowerCase():""),C=(S==="$"?n:/[%p]/.test(D)?o:"")+(d&&d.suffix!==void 0?d.suffix:""),B=oB[D],k=/[defgprs%]/.test(D);I=I===void 0?6:/[gprs]/.test(D)?Math.max(1,Math.min(21,I)):Math.max(0,Math.min(20,I));function z(G){var W=L,Y=C,H,$,J;if(D==="c")Y=B(G)+Y,G="";else{G=+G;var te=G<0||1/G<0;if(G=isNaN(G)?l:B(Math.abs(G),I),F&&(G=bQ(G)),te&&+G==0&&w!=="+"&&(te=!1),W=(te?w==="("?w:a:w==="-"||w==="("?"":w)+W,Y=(D==="s"&&!isNaN(G)&&tw!==void 0?TQ[8+tw/3]:"")+Y+(te&&w==="("?")":""),k){for(H=-1,$=G.length;++H<$;)if(J=G.charCodeAt(H),48>J||J>57){Y=(J===46?r+G.slice(H+1):G.slice(H))+Y,G=G.slice(0,H);break}}}P&&!T&&(G=e(G,1/0));var ce=W.length+G.length+Y.length,he=ce<R?new Array(R-ce+1).join(A):"";switch(P&&T&&(G=e(he+G,he.length?R-Y.length:1/0),he=""),y){case"<":G=W+G+Y+he;break;case"=":G=W+he+G+Y;break;case"^":G=he.slice(0,ce=he.length>>1)+W+G+Y+he.slice(ce);break;default:G=he+W+G+Y;break}return s(G)}return z.toString=function(){return f+""},z}function u(f,d){var A=Math.max(-8,Math.min(8,Math.floor(rf(d)/3)))*3,y=Math.pow(10,-A),w=c((f=X0(f),f.type="f",f),{suffix:TQ[8+A/3]});return function(S){return w(y*S)}}return{format:c,formatPrefix:u}}var _C,xC,yC;lB({thousands:",",grouping:[3],currency:["$",""]});function lB(i){return _C=EQ(i),xC=_C.format,yC=_C.formatPrefix,_C}function cB(i){return Math.max(0,-rf(Math.abs(i)))}function uB(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(rf(e)/3)))*3-rf(Math.abs(i)))}function hB(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,rf(e)-rf(i))+1}function fB(i,e,t,n){var r=WF(i,e,t),s;switch(n=X0(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=uB(r,o))&&(n.precision=s),yC(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=hB(r,Math.max(Math.abs(i),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=cB(r))&&(n.precision=s-(n.type==="%")*2);break}}return xC(n)}function dB(i){var e=i.domain;return i.ticks=function(t){var n=e();return sC(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return fB(r[0],r[r.length-1],t??10,n)},i.nice=function(t){t==null&&(t=10);var n=e(),r=0,s=n.length-1,o=n[r],a=n[s],l,c,u=10;for(a<o&&(c=o,o=a,a=c,c=r,r=s,s=c);u-- >0;){if(c=Zb(o,a,t),c===l)return n[r]=o,n[s]=a,e(n);if(c>0)o=Math.floor(o/c)*c,a=Math.ceil(a/c)*c;else if(c<0)o=Math.ceil(o*c)/c,a=Math.floor(a*c)/c;else break;l=c}return i},i}function El(){var i=rB();return i.copy=function(){return vQ(i,El())},cC.apply(i,arguments),dB(i)}function nw(){var i=0,e=1,t=1,n=[.5],r=[0,1],s;function o(l){return l!=null&&l<=l?r[Yb(n,l,0,t)]:s}function a(){var l=-1;for(n=new Array(t);++l<t;)n[l]=((l+1)*e-(l-t)*i)/(t+1);return o}return o.domain=function(l){return arguments.length?([i,e]=l,i=+i,e=+e,a()):[i,e]},o.range=function(l){return arguments.length?(t=(r=Array.from(l)).length-1,a()):r.slice()},o.invertExtent=function(l){var c=r.indexOf(l);return c<0?[NaN,NaN]:c<1?[i,n[0]]:c>=t?[n[t-1],e]:[n[c-1],n[c]]},o.unknown=function(l){return arguments.length&&(s=l),o},o.thresholds=function(){return n.slice()},o.copy=function(){return nw().domain([i,e]).range(r).unknown(s)},cC.apply(dB(o),arguments)}var Pn=1e-6,wg=1e-12,ri=Math.PI,yo=ri/2,S_=ri/4,bo=ri*2,ur=180/ri,_n=ri/180,si=Math.abs,T_=Math.atan,Rs=Math.atan2,mn=Math.cos,iw=Math.ceil,MQ=Math.exp;var bC=Math.hypot,CQ=Math.log;var un=Math.sin,RQ=Math.sign||function(i){return i>0?1:i<0?-1:0},Wo=Math.sqrt,IQ=Math.tan;function PQ(i){return i>1?0:i<-1?ri:Math.acos(i)}function da(i){return i>1?yo:i<-1?-yo:Math.asin(i)}function pB(i){return(i=un(i/2))*i}function As(){}function wC(i,e){i&&DQ.hasOwnProperty(i.type)&&DQ[i.type](i,e)}var LQ={Feature:function(i,e){wC(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)wC(t[n].geometry,e)}},DQ={Sphere:function(i,e){e.sphere()},Point:function(i,e){i=i.coordinates,e.point(i[0],i[1],i[2])},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)i=t[n],e.point(i[0],i[1],i[2])},LineString:function(i,e){mB(i.coordinates,e,0)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)mB(t[n],e,0)},Polygon:function(i,e){NQ(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)NQ(t[n],e)},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)wC(t[n],e)}};function mB(i,e,t){var n=-1,r=i.length-t,s;for(e.lineStart();++n<r;)s=i[n],e.point(s[0],s[1],s[2]);e.lineEnd()}function NQ(i,e){var t=-1,n=i.length;for(e.polygonStart();++t<n;)mB(i[t],e,1);e.polygonEnd()}function $0(i,e){i&&LQ.hasOwnProperty(i.type)?LQ[i.type](i,e):wC(i,e)}var rw=new Ho,FQ=new Ho,BQ,OQ,AB,gB,vB,sf={point:As,lineStart:As,lineEnd:As,polygonStart:function(){rw=new Ho,sf.lineStart=h2e,sf.lineEnd=f2e},polygonEnd:function(){var i=+rw;FQ.add(i<0?bo+i:i),this.lineStart=this.lineEnd=this.point=As},sphere:function(){FQ.add(bo)}};function h2e(){sf.point=d2e}function f2e(){UQ(BQ,OQ)}function d2e(i,e){sf.point=UQ,BQ=i,OQ=e,i*=_n,e*=_n,AB=i,gB=mn(e=e/2+S_),vB=un(e)}function UQ(i,e){i*=_n,e*=_n,e=e/2+S_;var t=i-AB,n=t>=0?1:-1,r=n*t,s=mn(e),o=un(e),a=vB*o,l=gB*s+a*mn(r),c=a*n*un(r);rw.add(Rs(c,l)),AB=i,gB=s,vB=o}function Sg(i){return[Rs(i[1],i[0]),da(i[2])]}function Yc(i){var e=i[0],t=i[1],n=mn(t);return[n*mn(e),n*un(e),un(t)]}function sw(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Vd(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function SC(i,e){i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}function ow(i,e){return[i[0]*e,i[1]*e,i[2]*e]}function Tg(i){var e=Wo(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);i[0]/=e,i[1]/=e,i[2]/=e}var es,Ml,gs,sc,Eg,GQ,qQ,E_,aw,Y0,qd,Gd={point:_B,lineStart:kQ,lineEnd:zQ,polygonStart:function(){Gd.point=WQ,Gd.lineStart=p2e,Gd.lineEnd=m2e,aw=new Ho,sf.polygonStart()},polygonEnd:function(){sf.polygonEnd(),Gd.point=_B,Gd.lineStart=kQ,Gd.lineEnd=zQ,rw<0?(es=-(gs=180),Ml=-(sc=90)):aw>Pn?sc=90:aw<-Pn&&(Ml=-90),qd[0]=es,qd[1]=gs},sphere:function(){es=-(gs=180),Ml=-(sc=90)}};function _B(i,e){Y0.push(qd=[es=i,gs=i]),e<Ml&&(Ml=e),e>sc&&(sc=e)}function HQ(i,e){var t=Yc([i*_n,e*_n]);if(E_){var n=Vd(E_,t),r=[n[1],-n[0],0],s=Vd(r,n);Tg(s),s=Sg(s);var o=i-Eg,a=o>0?1:-1,l=s[0]*ur*a,c,u=si(o)>180;u^(a*Eg<l&&l<a*i)?(c=s[1]*ur,c>sc&&(sc=c)):(l=(l+360)%360-180,u^(a*Eg<l&&l<a*i)?(c=-s[1]*ur,c<Ml&&(Ml=c)):(e<Ml&&(Ml=e),e>sc&&(sc=e))),u?i<Eg?rc(es,i)>rc(es,gs)&&(gs=i):rc(i,gs)>rc(es,gs)&&(es=i):gs>=es?(i<es&&(es=i),i>gs&&(gs=i)):i>Eg?rc(es,i)>rc(es,gs)&&(gs=i):rc(i,gs)>rc(es,gs)&&(es=i)}else Y0.push(qd=[es=i,gs=i]);e<Ml&&(Ml=e),e>sc&&(sc=e),E_=t,Eg=i}function kQ(){Gd.point=HQ}function zQ(){qd[0]=es,qd[1]=gs,Gd.point=_B,E_=null}function WQ(i,e){if(E_){var t=i-Eg;aw.add(si(t)>180?t+(t>0?360:-360):t)}else GQ=i,qQ=e;sf.point(i,e),HQ(i,e)}function p2e(){sf.lineStart()}function m2e(){WQ(GQ,qQ),sf.lineEnd(),si(aw)>Pn&&(es=-(gs=180)),qd[0]=es,qd[1]=gs,E_=null}function rc(i,e){return(e-=i)<0?e+360:e}function A2e(i,e){return i[0]-e[0]}function VQ(i,e){return i[0]<=i[1]?i[0]<=e&&e<=i[1]:e<i[0]||i[1]<e}function TC(i){var e,t,n,r,s,o,a;if(sc=gs=-(es=Ml=1/0),Y0=[],$0(i,Gd),t=Y0.length){for(Y0.sort(A2e),e=1,n=Y0[0],s=[n];e<t;++e)r=Y0[e],VQ(n,r[0])||VQ(n,r[1])?(rc(n[0],r[1])>rc(n[0],n[1])&&(n[1]=r[1]),rc(r[0],n[1])>rc(n[0],n[1])&&(n[0]=r[0])):s.push(n=r);for(o=-1/0,t=s.length-1,e=0,n=s[t];e<=t;n=r,++e)r=s[e],(a=rc(n[1],r[0]))>o&&(o=a,es=r[0],gs=n[1])}return Y0=qd=null,es===1/0||Ml===1/0?[[NaN,NaN],[NaN,NaN]]:[[es,Ml],[gs,sc]]}var lw,EC,MC,CC,RC,IC,PC,LC,xB,yB,bB,$Q,YQ,Wa,ja,Xa,qu={sphere:As,point:wB,lineStart:jQ,lineEnd:XQ,polygonStart:function(){qu.lineStart=_2e,qu.lineEnd=x2e},polygonEnd:function(){qu.lineStart=jQ,qu.lineEnd=XQ}};function wB(i,e){i*=_n,e*=_n;var t=mn(e);cw(t*mn(i),t*un(i),un(e))}function cw(i,e,t){++lw,MC+=(i-MC)/lw,CC+=(e-CC)/lw,RC+=(t-RC)/lw}function jQ(){qu.point=g2e}function g2e(i,e){i*=_n,e*=_n;var t=mn(e);Wa=t*mn(i),ja=t*un(i),Xa=un(e),qu.point=v2e,cw(Wa,ja,Xa)}function v2e(i,e){i*=_n,e*=_n;var t=mn(e),n=t*mn(i),r=t*un(i),s=un(e),o=Rs(Wo((o=ja*s-Xa*r)*o+(o=Xa*n-Wa*s)*o+(o=Wa*r-ja*n)*o),Wa*n+ja*r+Xa*s);EC+=o,IC+=o*(Wa+(Wa=n)),PC+=o*(ja+(ja=r)),LC+=o*(Xa+(Xa=s)),cw(Wa,ja,Xa)}function XQ(){qu.point=wB}function _2e(){qu.point=y2e}function x2e(){ZQ($Q,YQ),qu.point=wB}function y2e(i,e){$Q=i,YQ=e,i*=_n,e*=_n,qu.point=ZQ;var t=mn(e);Wa=t*mn(i),ja=t*un(i),Xa=un(e),cw(Wa,ja,Xa)}function ZQ(i,e){i*=_n,e*=_n;var t=mn(e),n=t*mn(i),r=t*un(i),s=un(e),o=ja*s-Xa*r,a=Xa*n-Wa*s,l=Wa*r-ja*n,c=bC(o,a,l),u=da(c),f=c&&-u/c;xB.add(f*o),yB.add(f*a),bB.add(f*l),EC+=u,IC+=u*(Wa+(Wa=n)),PC+=u*(ja+(ja=r)),LC+=u*(Xa+(Xa=s)),cw(Wa,ja,Xa)}function DC(i){lw=EC=MC=CC=RC=IC=PC=LC=0,xB=new Ho,yB=new Ho,bB=new Ho,$0(i,qu);var e=+xB,t=+yB,n=+bB,r=bC(e,t,n);return r<wg&&(e=IC,t=PC,n=LC,EC<Pn&&(e=MC,t=CC,n=RC),r=bC(e,t,n),r<wg)?[NaN,NaN]:[Rs(t,e)*ur,da(n/r)*ur]}function uw(i,e){function t(n,r){return n=i(n,r),e(n[0],n[1])}return i.invert&&e.invert&&(t.invert=function(n,r){return n=e.invert(n,r),n&&i.invert(n[0],n[1])}),t}function SB(i,e){return si(i)>ri&&(i-=Math.round(i/bo)*bo),[i,e]}SB.invert=SB;function TB(i,e,t){return(i%=bo)?e||t?uw(QQ(i),JQ(e,t)):QQ(i):e||t?JQ(e,t):SB}function KQ(i){return function(e,t){return e+=i,si(e)>ri&&(e-=Math.round(e/bo)*bo),[e,t]}}function QQ(i){var e=KQ(i);return e.invert=KQ(-i),e}function JQ(i,e){var t=mn(i),n=un(i),r=mn(e),s=un(e);function o(a,l){var c=mn(l),u=mn(a)*c,f=un(a)*c,d=un(l),A=d*t+u*n;return[Rs(f*r-A*s,u*t-d*n),da(A*r+f*s)]}return o.invert=function(a,l){var c=mn(l),u=mn(a)*c,f=un(a)*c,d=un(l),A=d*r-f*s;return[Rs(f*r+d*s,u*t+A*n),da(A*t-u*n)]},o}function EB(i){i=TB(i[0]*_n,i[1]*_n,i.length>2?i[2]*_n:0);function e(t){return t=i(t[0]*_n,t[1]*_n),t[0]*=ur,t[1]*=ur,t}return e.invert=function(t){return t=i.invert(t[0]*_n,t[1]*_n),t[0]*=ur,t[1]*=ur,t},e}function tJ(i,e,t,n,r,s){if(t){var o=mn(e),a=un(e),l=n*t;r==null?(r=e+n*bo,s=e-l/2):(r=eJ(o,r),s=eJ(o,s),(n>0?r<s:r>s)&&(r+=n*bo));for(var c,u=r;n>0?u>s:u<s;u-=l)c=Sg([o,-a*mn(u),-a*un(u)]),i.point(c[0],c[1])}}function eJ(i,e){e=Yc(e),e[0]-=i,Tg(e);var t=PQ(-e[1]);return((-e[2]<0?-t:t)+bo-Pn)%bo}function NC(){var i=[],e;return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){i.push(e=[])},lineEnd:As,rejoin:function(){i.length>1&&i.push(i.pop().concat(i.shift()))},result:function(){var t=i;return i=[],e=null,t}}}function M_(i,e){return si(i[0]-e[0])<Pn&&si(i[1]-e[1])<Pn}function FC(i,e,t,n){this.x=i,this.z=e,this.o=t,this.e=n,this.v=!1,this.n=this.p=null}function BC(i,e,t,n,r){var s=[],o=[],a,l;if(i.forEach(function(y){if(!((w=y.length-1)<=0)){var w,S=y[0],T=y[w],R;if(M_(S,T)){if(!S[2]&&!T[2]){for(r.lineStart(),a=0;a<w;++a)r.point((S=y[a])[0],S[1]);r.lineEnd();return}T[0]+=2*Pn}s.push(R=new FC(S,y,null,!0)),o.push(R.o=new FC(S,null,R,!1)),s.push(R=new FC(T,y,null,!1)),o.push(R.o=new FC(T,null,R,!0))}}),!!s.length){for(o.sort(e),nJ(s),nJ(o),a=0,l=o.length;a<l;++a)o[a].e=t=!t;for(var c=s[0],u,f;;){for(var d=c,A=!0;d.v;)if((d=d.n)===c)return;u=d.z,r.lineStart();do{if(d.v=d.o.v=!0,d.e){if(A)for(a=0,l=u.length;a<l;++a)r.point((f=u[a])[0],f[1]);else n(d.x,d.n.x,1,r);d=d.n}else{if(A)for(u=d.p.z,a=u.length-1;a>=0;--a)r.point((f=u[a])[0],f[1]);else n(d.x,d.p.x,-1,r);d=d.p}d=d.o,u=d.z,A=!A}while(!d.v);r.lineEnd()}}}function nJ(i){if(e=i.length){for(var e,t=0,n=i[0],r;++t<e;)n.n=r=i[t],r.p=n,n=r;n.n=r=i[0],r.p=n}}function MB(i){return si(i[0])<=ri?i[0]:RQ(i[0])*((si(i[0])+ri)%bo-ri)}function OC(i,e){var t=MB(e),n=e[1],r=un(n),s=[un(t),-mn(t),0],o=0,a=0,l=new Ho;r===1?n=yo+Pn:r===-1&&(n=-yo-Pn);for(var c=0,u=i.length;c<u;++c)if(d=(f=i[c]).length)for(var f,d,A=f[d-1],y=MB(A),w=A[1]/2+S_,S=un(w),T=mn(w),R=0;R<d;++R,y=I,S=D,T=L,A=P){var P=f[R],I=MB(P),F=P[1]/2+S_,D=un(F),L=mn(F),C=I-y,B=C>=0?1:-1,k=B*C,z=k>ri,G=S*D;if(l.add(Rs(G*B*un(k),T*L+G*mn(k))),o+=z?C+B*bo:C,z^y>=t^I>=t){var W=Vd(Yc(A),Yc(P));Tg(W);var Y=Vd(s,W);Tg(Y);var H=(z^C>=0?-1:1)*da(Y[2]);(n>H||n===H&&(W[0]||W[1]))&&(a+=z^C>=0?1:-1)}}return(o<-Pn||o<Pn&&l<-wg)^a&1}function UC(i,e,t,n){return function(r){var s=e(r),o=NC(),a=e(o),l=!1,c,u,f,d={point:A,lineStart:w,lineEnd:S,polygonStart:function(){d.point=T,d.lineStart=R,d.lineEnd=P,u=[],c=[]},polygonEnd:function(){d.point=A,d.lineStart=w,d.lineEnd=S,u=ef(u);var I=OC(c,n);u.length?(l||(r.polygonStart(),l=!0),BC(u,w2e,I,t,r)):I&&(l||(r.polygonStart(),l=!0),r.lineStart(),t(null,null,1,r),r.lineEnd()),l&&(r.polygonEnd(),l=!1),u=c=null},sphere:function(){r.polygonStart(),r.lineStart(),t(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function A(I,F){i(I,F)&&r.point(I,F)}function y(I,F){s.point(I,F)}function w(){d.point=y,s.lineStart()}function S(){d.point=A,s.lineEnd()}function T(I,F){f.push([I,F]),a.point(I,F)}function R(){a.lineStart(),f=[]}function P(){T(f[0][0],f[0][1]),a.lineEnd();var I=a.clean(),F=o.result(),D,L=F.length,C,B,k;if(f.pop(),c.push(f),f=null,!!L){if(I&1){if(B=F[0],(C=B.length-1)>0){for(l||(r.polygonStart(),l=!0),r.lineStart(),D=0;D<C;++D)r.point((k=B[D])[0],k[1]);r.lineEnd()}return}L>1&&I&2&&F.push(F.pop().concat(F.shift())),u.push(F.filter(b2e))}}return d}}function b2e(i){return i.length>1}function w2e(i,e){return((i=i.x)[0]<0?i[1]-yo-Pn:yo-i[1])-((e=e.x)[0]<0?e[1]-yo-Pn:yo-e[1])}var CB=UC(function(){return!0},S2e,E2e,[-ri,-yo]);function S2e(i){var e=NaN,t=NaN,n=NaN,r;return{lineStart:function(){i.lineStart(),r=1},point:function(s,o){var a=s>0?ri:-ri,l=si(s-e);si(l-ri)<Pn?(i.point(e,t=(t+o)/2>0?yo:-yo),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),i.point(s,t),r=0):n!==a&&l>=ri&&(si(e-n)<Pn&&(e-=n*Pn),si(s-a)<Pn&&(s-=a*Pn),t=T2e(e,t,s,o),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),r=0),i.point(e=s,t=o),n=a},lineEnd:function(){i.lineEnd(),e=t=NaN},clean:function(){return 2-r}}}function T2e(i,e,t,n){var r,s,o=un(i-t);return si(o)>Pn?T_((un(e)*(s=mn(n))*un(t)-un(n)*(r=mn(e))*un(i))/(r*s*o)):(e+n)/2}function E2e(i,e,t,n){var r;if(i==null)r=t*yo,n.point(-ri,r),n.point(0,r),n.point(ri,r),n.point(ri,0),n.point(ri,-r),n.point(0,-r),n.point(-ri,-r),n.point(-ri,0),n.point(-ri,r);else if(si(i[0]-e[0])>Pn){var s=i[0]<e[0]?ri:-ri;r=t*s/2,n.point(-s,r),n.point(0,r),n.point(s,r)}else n.point(e[0],e[1])}function iJ(i){var e=mn(i),t=2*_n,n=e>0,r=si(e)>Pn;function s(u,f,d,A){tJ(A,i,t,d,u,f)}function o(u,f){return mn(u)*mn(f)>e}function a(u){var f,d,A,y,w;return{lineStart:function(){y=A=!1,w=1},point:function(S,T){var R=[S,T],P,I=o(S,T),F=n?I?0:c(S,T):I?c(S+(S<0?ri:-ri),T):0;if(!f&&(y=A=I)&&u.lineStart(),I!==A&&(P=l(f,R),(!P||M_(f,P)||M_(R,P))&&(R[2]=1)),I!==A)w=0,I?(u.lineStart(),P=l(R,f),u.point(P[0],P[1])):(P=l(f,R),u.point(P[0],P[1],2),u.lineEnd()),f=P;else if(r&&f&&n^I){var D;!(F&d)&&(D=l(R,f,!0))&&(w=0,n?(u.lineStart(),u.point(D[0][0],D[0][1]),u.point(D[1][0],D[1][1]),u.lineEnd()):(u.point(D[1][0],D[1][1]),u.lineEnd(),u.lineStart(),u.point(D[0][0],D[0][1],3)))}I&&(!f||!M_(f,R))&&u.point(R[0],R[1]),f=R,A=I,d=F},lineEnd:function(){A&&u.lineEnd(),f=null},clean:function(){return w|(y&&A)<<1}}}function l(u,f,d){var A=Yc(u),y=Yc(f),w=[1,0,0],S=Vd(A,y),T=sw(S,S),R=S[0],P=T-R*R;if(!P)return!d&&u;var I=e*T/P,F=-e*R/P,D=Vd(w,S),L=ow(w,I),C=ow(S,F);SC(L,C);var B=D,k=sw(L,B),z=sw(B,B),G=k*k-z*(sw(L,L)-1);if(!(G<0)){var W=Wo(G),Y=ow(B,(-k-W)/z);if(SC(Y,L),Y=Sg(Y),!d)return Y;var H=u[0],$=f[0],J=u[1],te=f[1],ce;$<H&&(ce=H,H=$,$=ce);var he=$-H,ve=si(he-ri)<Pn,Re=ve||he<Pn;if(!ve&&te<J&&(ce=J,J=te,te=ce),Re?ve?J+te>0^Y[1]<(si(Y[0]-H)<Pn?J:te):J<=Y[1]&&Y[1]<=te:he>ri^(H<=Y[0]&&Y[0]<=$)){var Qe=ow(B,(-k+W)/z);return SC(Qe,L),[Y,Sg(Qe)]}}}function c(u,f){var d=n?i:ri-i,A=0;return u<-d?A|=1:u>d&&(A|=2),f<-d?A|=4:f>d&&(A|=8),A}return UC(o,a,s,n?[0,-i]:[-ri,i-ri])}function rJ(i,e,t,n,r,s){var o=i[0],a=i[1],l=e[0],c=e[1],u=0,f=1,d=l-o,A=c-a,y;if(y=t-o,!(!d&&y>0)){if(y/=d,d<0){if(y<u)return;y<f&&(f=y)}else if(d>0){if(y>f)return;y>u&&(u=y)}if(y=r-o,!(!d&&y<0)){if(y/=d,d<0){if(y>f)return;y>u&&(u=y)}else if(d>0){if(y<u)return;y<f&&(f=y)}if(y=n-a,!(!A&&y>0)){if(y/=A,A<0){if(y<u)return;y<f&&(f=y)}else if(A>0){if(y>f)return;y>u&&(u=y)}if(y=s-a,!(!A&&y<0)){if(y/=A,A<0){if(y>f)return;y>u&&(u=y)}else if(A>0){if(y<u)return;y<f&&(f=y)}return u>0&&(i[0]=o+u*d,i[1]=a+u*A),f<1&&(e[0]=o+f*d,e[1]=a+f*A),!0}}}}}var hw=1e9,kC=-hw;function RB(i,e,t,n){function r(c,u){return i<=c&&c<=t&&e<=u&&u<=n}function s(c,u,f,d){var A=0,y=0;if(c==null||(A=o(c,f))!==(y=o(u,f))||l(c,u)<0^f>0)do d.point(A===0||A===3?i:t,A>1?n:e);while((A=(A+f+4)%4)!==y);else d.point(u[0],u[1])}function o(c,u){return si(c[0]-i)<Pn?u>0?0:3:si(c[0]-t)<Pn?u>0?2:1:si(c[1]-e)<Pn?u>0?1:0:u>0?3:2}function a(c,u){return l(c.x,u.x)}function l(c,u){var f=o(c,1),d=o(u,1);return f!==d?f-d:f===0?u[1]-c[1]:f===1?c[0]-u[0]:f===2?c[1]-u[1]:u[0]-c[0]}return function(c){var u=c,f=NC(),d,A,y,w,S,T,R,P,I,F,D,L={point:C,lineStart:G,lineEnd:W,polygonStart:k,polygonEnd:z};function C(H,$){r(H,$)&&u.point(H,$)}function B(){for(var H=0,$=0,J=A.length;$<J;++$)for(var te=A[$],ce=1,he=te.length,ve=te[0],Re,Qe,Fe=ve[0],mt=ve[1];ce<he;++ce)Re=Fe,Qe=mt,ve=te[ce],Fe=ve[0],mt=ve[1],Qe<=n?mt>n&&(Fe-Re)*(n-Qe)>(mt-Qe)*(i-Re)&&++H:mt<=n&&(Fe-Re)*(n-Qe)<(mt-Qe)*(i-Re)&&--H;return H}function k(){u=f,d=[],A=[],D=!0}function z(){var H=B(),$=D&&H,J=(d=ef(d)).length;($||J)&&(c.polygonStart(),$&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),J&&BC(d,a,H,s,c),c.polygonEnd()),u=c,d=A=y=null}function G(){L.point=Y,A&&A.push(y=[]),F=!0,I=!1,R=P=NaN}function W(){d&&(Y(w,S),T&&I&&f.rejoin(),d.push(f.result())),L.point=C,I&&u.lineEnd()}function Y(H,$){var J=r(H,$);if(A&&y.push([H,$]),F)w=H,S=$,T=J,F=!1,J&&(u.lineStart(),u.point(H,$));else if(J&&I)u.point(H,$);else{var te=[R=Math.max(kC,Math.min(hw,R)),P=Math.max(kC,Math.min(hw,P))],ce=[H=Math.max(kC,Math.min(hw,H)),$=Math.max(kC,Math.min(hw,$))];rJ(te,ce,i,e,t,n)?(I||(u.lineStart(),u.point(te[0],te[1])),u.point(ce[0],ce[1]),J||u.lineEnd(),D=!1):J&&(u.lineStart(),u.point(H,$),D=!1)}R=H,P=$,I=J}return L}}var IB,PB,zC,VC,C_={sphere:As,point:As,lineStart:M2e,lineEnd:As,polygonStart:As,polygonEnd:As};function M2e(){C_.point=R2e,C_.lineEnd=C2e}function C2e(){C_.point=C_.lineEnd=As}function R2e(i,e){i*=_n,e*=_n,PB=i,zC=un(e),VC=mn(e),C_.point=I2e}function I2e(i,e){i*=_n,e*=_n;var t=un(e),n=mn(e),r=si(i-PB),s=mn(r),o=un(r),a=n*o,l=VC*t-zC*n*s,c=zC*t+VC*n*s;IB.add(Rs(Wo(a*a+l*l),c)),PB=i,zC=t,VC=n}function sJ(i){return IB=new Ho,$0(i,C_),+IB}var LB=[null,null],P2e={type:"LineString",coordinates:LB};function Cl(i,e){return LB[0]=i,LB[1]=e,sJ(P2e)}var oJ={Feature:function(i,e){return GC(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)if(GC(t[n].geometry,e))return!0;return!1}},aJ={Sphere:function(){return!0},Point:function(i,e){return lJ(i.coordinates,e)},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(lJ(t[n],e))return!0;return!1},LineString:function(i,e){return cJ(i.coordinates,e)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(cJ(t[n],e))return!0;return!1},Polygon:function(i,e){return uJ(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(uJ(t[n],e))return!0;return!1},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)if(GC(t[n],e))return!0;return!1}};function GC(i,e){return i&&aJ.hasOwnProperty(i.type)?aJ[i.type](i,e):!1}function lJ(i,e){return Cl(i,e)===0}function cJ(i,e){for(var t,n,r,s=0,o=i.length;s<o;s++){if(n=Cl(i[s],e),n===0||s>0&&(r=Cl(i[s],i[s-1]),r>0&&t<=r&&n<=r&&(t+n-r)*(1-Math.pow((t-n)/r,2))<wg*r))return!0;t=n}return!1}function uJ(i,e){return!!OC(i.map(L2e),hJ(e))}function L2e(i){return i=i.map(hJ),i.pop(),i}function hJ(i){return[i[0]*_n,i[1]*_n]}function DB(i,e){return(i&&oJ.hasOwnProperty(i.type)?oJ[i.type]:GC)(i,e)}function fJ(i,e,t){var n=zd(i,e-Pn,t).concat(e);return function(r){return n.map(function(s){return[r,s]})}}function dJ(i,e,t){var n=zd(i,e-Pn,t).concat(e);return function(r){return n.map(function(s){return[s,r]})}}function NB(){var i,e,t,n,r,s,o,a,l=10,c=l,u=90,f=360,d,A,y,w,S=2.5;function T(){return{type:"MultiLineString",coordinates:R()}}function R(){return zd(iw(n/u)*u,t,u).map(y).concat(zd(iw(a/f)*f,o,f).map(w)).concat(zd(iw(e/l)*l,i,l).filter(function(P){return si(P%u)>Pn}).map(d)).concat(zd(iw(s/c)*c,r,c).filter(function(P){return si(P%f)>Pn}).map(A))}return T.lines=function(){return R().map(function(P){return{type:"LineString",coordinates:P}})},T.outline=function(){return{type:"Polygon",coordinates:[y(n).concat(w(o).slice(1),y(t).reverse().slice(1),w(a).reverse().slice(1))]}},T.extent=function(P){return arguments.length?T.extentMajor(P).extentMinor(P):T.extentMinor()},T.extentMajor=function(P){return arguments.length?(n=+P[0][0],t=+P[1][0],a=+P[0][1],o=+P[1][1],n>t&&(P=n,n=t,t=P),a>o&&(P=a,a=o,o=P),T.precision(S)):[[n,a],[t,o]]},T.extentMinor=function(P){return arguments.length?(e=+P[0][0],i=+P[1][0],s=+P[0][1],r=+P[1][1],e>i&&(P=e,e=i,i=P),s>r&&(P=s,s=r,r=P),T.precision(S)):[[e,s],[i,r]]},T.step=function(P){return arguments.length?T.stepMajor(P).stepMinor(P):T.stepMinor()},T.stepMajor=function(P){return arguments.length?(u=+P[0],f=+P[1],T):[u,f]},T.stepMinor=function(P){return arguments.length?(l=+P[0],c=+P[1],T):[l,c]},T.precision=function(P){return arguments.length?(S=+P,d=fJ(s,r,90),A=dJ(e,i,S),y=fJ(a,o,90),w=dJ(n,t,S),T):S},T.extentMajor([[-180,-90+Pn],[180,90-Pn]]).extentMinor([[-180,-80-Pn],[180,80+Pn]])}function FB(){return NB()()}function Mg(i,e){var t=i[0]*_n,n=i[1]*_n,r=e[0]*_n,s=e[1]*_n,o=mn(n),a=un(n),l=mn(s),c=un(s),u=o*mn(t),f=o*un(t),d=l*mn(r),A=l*un(r),y=2*da(Wo(pB(s-n)+o*l*pB(r-t))),w=un(y),S=y?function(T){var R=un(T*=y)/w,P=un(y-T)/w,I=P*u+R*d,F=P*f+R*A,D=P*a+R*c;return[Rs(F,I)*ur,Rs(D,Wo(I*I+F*F))*ur]}:function(){return[t*ur,n*ur]};return S.distance=y,S}var BB=i=>i;var R_=1/0,qC=R_,fw=-R_,HC=fw,D2e={point:N2e,lineStart:As,lineEnd:As,polygonStart:As,polygonEnd:As,result:function(){var i=[[R_,qC],[fw,HC]];return fw=HC=-(qC=R_=1/0),i}};function N2e(i,e){i<R_&&(R_=i),i>fw&&(fw=i),e<qC&&(qC=e),e>HC&&(HC=e)}var OB=D2e;function dw(i){return function(e){var t=new UB;for(var n in i)t[n]=i[n];return t.stream=e,t}}function UB(){}UB.prototype={constructor:UB,point:function(i,e){this.stream.point(i,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function kB(i,e,t){var n=i.clipExtent&&i.clipExtent();return i.scale(150).translate([0,0]),n!=null&&i.clipExtent(null),$0(t,i.stream(OB)),e(OB.result()),n!=null&&i.clipExtent(n),i}function zB(i,e,t){return kB(i,function(n){var r=e[1][0]-e[0][0],s=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),s/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,l=+e[0][1]+(s-o*(n[1][1]+n[0][1]))/2;i.scale(150*o).translate([a,l])},t)}function pJ(i,e,t){return zB(i,[[0,0],e],t)}function mJ(i,e,t){return kB(i,function(n){var r=+e,s=r/(n[1][0]-n[0][0]),o=(r-s*(n[1][0]+n[0][0]))/2,a=-s*n[0][1];i.scale(150*s).translate([o,a])},t)}function AJ(i,e,t){return kB(i,function(n){var r=+e,s=r/(n[1][1]-n[0][1]),o=-s*n[0][0],a=(r-s*(n[1][1]+n[0][1]))/2;i.scale(150*s).translate([o,a])},t)}var gJ=16,F2e=mn(30*_n);function VB(i,e){return+e?O2e(i,e):B2e(i)}function B2e(i){return dw({point:function(e,t){e=i(e,t),this.stream.point(e[0],e[1])}})}function O2e(i,e){function t(n,r,s,o,a,l,c,u,f,d,A,y,w,S){var T=c-n,R=u-r,P=T*T+R*R;if(P>4*e&&w--){var I=o+d,F=a+A,D=l+y,L=Wo(I*I+F*F+D*D),C=da(D/=L),B=si(si(D)-1)<Pn||si(s-f)<Pn?(s+f)/2:Rs(F,I),k=i(B,C),z=k[0],G=k[1],W=z-n,Y=G-r,H=R*W-T*Y;(H*H/P>e||si((T*W+R*Y)/P-.5)>.3||o*d+a*A+l*y<F2e)&&(t(n,r,s,o,a,l,z,G,B,I/=L,F/=L,D,w,S),S.point(z,G),t(z,G,B,I,F,D,c,u,f,d,A,y,w,S))}}return function(n){var r,s,o,a,l,c,u,f,d,A,y,w,S={point:T,lineStart:R,lineEnd:I,polygonStart:function(){n.polygonStart(),S.lineStart=F},polygonEnd:function(){n.polygonEnd(),S.lineStart=R}};function T(C,B){C=i(C,B),n.point(C[0],C[1])}function R(){f=NaN,S.point=P,n.lineStart()}function P(C,B){var k=Yc([C,B]),z=i(C,B);t(f,d,u,A,y,w,f=z[0],d=z[1],u=C,A=k[0],y=k[1],w=k[2],gJ,n),n.point(f,d)}function I(){S.point=T,n.lineEnd()}function F(){R(),S.point=D,S.lineEnd=L}function D(C,B){P(r=C,B),s=f,o=d,a=A,l=y,c=w,S.point=P}function L(){t(f,d,u,A,y,w,s,o,r,a,l,c,gJ,n),S.lineEnd=I,I()}return S}}var U2e=dw({point:function(i,e){this.stream.point(i*_n,e*_n)}});function k2e(i){return dw({point:function(e,t){var n=i(e,t);return this.stream.point(n[0],n[1])}})}function z2e(i,e,t,n,r){function s(o,a){return o*=n,a*=r,[e+i*o,t-i*a]}return s.invert=function(o,a){return[(o-e)/i*n,(t-a)/i*r]},s}function vJ(i,e,t,n,r,s){if(!s)return z2e(i,e,t,n,r);var o=mn(s),a=un(s),l=o*i,c=a*i,u=o/i,f=a/i,d=(a*t-o*e)/i,A=(a*e+o*t)/i;function y(w,S){return w*=n,S*=r,[l*w-c*S+e,t-c*w-l*S]}return y.invert=function(w,S){return[n*(u*w-f*S+d),r*(A-f*w-u*S)]},y}function GB(i){return V2e(function(){return i})()}function V2e(i){var e,t=150,n=480,r=250,s=0,o=0,a=0,l=0,c=0,u,f=0,d=1,A=1,y=null,w=CB,S=null,T,R,P,I=BB,F=.5,D,L,C,B,k;function z(H){return C(H[0]*_n,H[1]*_n)}function G(H){return H=C.invert(H[0],H[1]),H&&[H[0]*ur,H[1]*ur]}z.stream=function(H){return B&&k===H?B:B=U2e(k2e(u)(w(D(I(k=H)))))},z.preclip=function(H){return arguments.length?(w=H,y=void 0,Y()):w},z.postclip=function(H){return arguments.length?(I=H,S=T=R=P=null,Y()):I},z.clipAngle=function(H){return arguments.length?(w=+H?iJ(y=H*_n):(y=null,CB),Y()):y*ur},z.clipExtent=function(H){return arguments.length?(I=H==null?(S=T=R=P=null,BB):RB(S=+H[0][0],T=+H[0][1],R=+H[1][0],P=+H[1][1]),Y()):S==null?null:[[S,T],[R,P]]},z.scale=function(H){return arguments.length?(t=+H,W()):t},z.translate=function(H){return arguments.length?(n=+H[0],r=+H[1],W()):[n,r]},z.center=function(H){return arguments.length?(s=H[0]%360*_n,o=H[1]%360*_n,W()):[s*ur,o*ur]},z.rotate=function(H){return arguments.length?(a=H[0]%360*_n,l=H[1]%360*_n,c=H.length>2?H[2]%360*_n:0,W()):[a*ur,l*ur,c*ur]},z.angle=function(H){return arguments.length?(f=H%360*_n,W()):f*ur},z.reflectX=function(H){return arguments.length?(d=H?-1:1,W()):d<0},z.reflectY=function(H){return arguments.length?(A=H?-1:1,W()):A<0},z.precision=function(H){return arguments.length?(D=VB(L,F=H*H),Y()):Wo(F)},z.fitExtent=function(H,$){return zB(z,H,$)},z.fitSize=function(H,$){return pJ(z,H,$)},z.fitWidth=function(H,$){return mJ(z,H,$)},z.fitHeight=function(H,$){return AJ(z,H,$)};function W(){var H=vJ(t,0,0,d,A,f).apply(null,e(s,o)),$=vJ(t,n-H[0],r-H[1],d,A,f);return u=TB(a,l,c),L=uw(e,$),C=uw(u,L),D=VB(L,F),Y()}function Y(){return B=k=null,z}return function(){return e=i.apply(this,arguments),z.invert=e.invert&&G,W()}}function _J(i){return function(e,t){var n=Wo(e*e+t*t),r=i(n),s=un(r),o=mn(r);return[Rs(e*s,n*o),da(n&&t*s/n)]}}function pw(i,e){return[i,CQ(IQ((yo+e)/2))]}pw.invert=function(i,e){return[i,2*T_(MQ(e))-yo]};function qB(i,e){var t=mn(e),n=1+mn(i)*t;return[t*un(i)/n,un(e)/n]}qB.invert=_J(function(i){return 2*T_(i)});function HB(){return GB(qB).scale(250).clipAngle(142)}function XB(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function G2e(i){if(Array.isArray(i))return i}function q2e(i){if(Array.isArray(i))return XB(i)}function mw(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function H2e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function W2e(i,e,t){return e=$C(e),tbe(i,SJ()?Reflect.construct(e,[],$C(i).constructor):e.apply(i,t))}function wJ(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function j2e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function oi(i,e){return i.get(mw(i,e))}function Z0(i,e,t){wJ(i,e),e.set(i,t)}function K0(i,e,t){return i.set(mw(i,e),t),t}function X2e(i,e){wJ(i,e),e.add(i)}function $2e(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,EJ(n.key),n)}}function Y2e(i,e,t){return e&&$2e(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function I_(i,e,t){return(e=EJ(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function $C(i){return $C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},$C(i)}function Z2e(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&$B(i,e)}function SJ(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(SJ=function(){return!!i})()}function K2e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Q2e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function J2e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4119-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ebe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4120-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tbe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return H2e(i)}function $B(i,e){return $B=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},$B(i,e)}function XC(i,e){return G2e(i)||Q2e(i,e)||MJ(i,e)||J2e()}function TJ(i){return q2e(i)||K2e(i)||MJ(i)||ebe()}function nbe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function EJ(i){var e=nbe(i,"string");return typeof e=="symbol"?e:e+""}function MJ(i,e){if(i){if(typeof i=="string")return XB(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?XB(i,e):void 0}}var CJ=function(e){e instanceof Array?e.forEach(CJ):(e.map&&e.map.dispose(),e.dispose())},YB=function(e){e.geometry&&e.geometry.dispose(),e.material&&CJ(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(YB)};function RJ(i,e,t){var n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return{x:t*Math.sin(n)*Math.cos(r),y:t*Math.cos(n),z:t*Math.sin(n)*Math.sin(r)}}function ibe(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),o=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-o*180/Math.PI-(o<-Math.PI/2?360:0),r}}function Cg(i){return i*Math.PI/180}var IJ=function(e){return 1-(pw(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},WB=function(e){return Math.max(0,Math.min(1,IJ(e)))},xJ=function(e){return .5-pw.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},rbe=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=El().domain([1,0]).range([t,n]).clamp(!0),s=El().domain([WB(t),WB(n)]).range([1,0]).clamp(!0),o=function(f){return s(WB(r(f)))},a=e.array,l=0,c=a.length;l<c;l+=2)a[l+1]=o(a[l+1]);e.needsUpdate=!0},yJ=function(e,t,n,r){var s=Math.pow(2,e),o=Math.max(0,Math.min(s-1,Math.floor((n+180)*s/360))),a=(90-r)/180;t&&(a=Math.max(0,Math.min(1,IJ(a))));var l=Math.floor(a*s);return[o,l]},ZB=function(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0,a=[],l=Math.pow(2,e),c=360/l,u=180/l,f=s===void 0?l-1:s,d=o===void 0?l-1:o,A=n,y=Math.min(l-1,f);A<=y;A++)for(var w=r,S=Math.min(l-1,d);w<=S;w++){var T=w,R=u;if(t){T=w===0?w:xJ(w/l)*l;var P=w+1===l?w+1:xJ((w+1)/l)*l;R=(P-T)*180/l}var I=-180+(A+.5)*c,F=90-(T*180/l+R/2),D=R;a.push({x:A,y:w,lng:I,lat:F,latLen:D})}return a},sbe=6,obe=7,abe=3,lbe=90,of=new WeakMap,Q0=new WeakMap,jB=new WeakMap,WC=new WeakMap,Zc=new WeakMap,YC=new WeakMap,P_=new WeakMap,Rg=new WeakMap,jC=new WeakSet,PJ=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.tileUrl,o=r.minLevel,a=o===void 0?0:o,l=r.maxLevel,c=l===void 0?17:l,u=r.mercatorProjection,f=u===void 0?!0:u;return j2e(this,e),n=W2e(this,e),X2e(n,jC),Z0(n,of,void 0),Z0(n,Q0,void 0),Z0(n,jB,void 0),Z0(n,WC,void 0),Z0(n,Zc,{}),Z0(n,YC,void 0),Z0(n,P_,void 0),Z0(n,Rg,void 0),I_(n,"minLevel",void 0),I_(n,"maxLevel",void 0),I_(n,"thresholds",TJ(new Array(30)).map(function(d,A){return 8/Math.pow(2,A)})),I_(n,"curvatureResolution",5),I_(n,"tileMargin",0),I_(n,"clearTiles",function(){Object.values(oi(Zc,n)).forEach(function(d){d.forEach(function(A){A.obj&&(n.remove(A.obj),YB(A.obj),delete A.obj)})}),K0(Zc,n,{})}),K0(of,n,t),n.tileUrl=s,K0(Q0,n,f),n.minLevel=a,n.maxLevel=c,n.level=0,n.add(K0(Rg,n,new Hn(new Va(oi(of,n)*.99,180,90),new ds({color:0})))),oi(Rg,n).visible=!1,oi(Rg,n).material.polygonOffset=!0,oi(Rg,n).material.polygonOffsetUnits=3,oi(Rg,n).material.polygonOffsetFactor=1,n}return Z2e(e,i),Y2e(e,[{key:"tileUrl",get:function(){return oi(jB,this)},set:function(n){K0(jB,this,n),this.updatePov(oi(P_,this))}},{key:"level",get:function(){return oi(WC,this)},set:function(n){var r,s=this;oi(Zc,this)[n]||mw(jC,this,cbe).call(this,n);var o=oi(WC,this);if(K0(WC,this,n),!(n===o||o===void 0)){if(oi(Rg,this).visible=n>0,oi(Zc,this)[n].forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!0)}),o<n&&((r=oi(Zc,this)[o])===null||r===void 0||r.forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!1)})),o>n)for(var a=n+1;a<=o;a++)oi(Zc,this)[a]&&oi(Zc,this)[a].forEach(function(l){l.obj&&(s.remove(l.obj),YB(l.obj),delete l.obj)});mw(jC,this,bJ).call(this)}}},{key:"updatePov",value:function(n){var r=this;if(!(!n||!(n instanceof Nd))){K0(P_,this,n);var s;if(K0(YC,this,function(u){if(!u.hullPnts){var f=360/Math.pow(2,r.level),d=u.lng,A=u.lat,y=u.latLen,w=d-f/2,S=d+f/2,T=A-y/2,R=A+y/2;u.hullPnts=[[A,d],[T,w],[R,w],[T,S],[R,S]].map(function(P){var I=XC(P,2),F=I[0],D=I[1];return RJ(F,D,oi(of,r))}).map(function(P){var I=P.x,F=P.y,D=P.z;return new re(I,F,D)})}return s||(s=new Hc,n.updateMatrix(),n.updateMatrixWorld(),s.setFromProjectionMatrix(new cn().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse))),u.hullPnts.some(function(P){return s.containsPoint(P.clone().applyMatrix4(r.matrixWorld))})}),this.tileUrl){var o=n.position.clone(),a=o.distanceTo(this.getWorldPosition(new re)),l=(a-oi(of,this))/oi(of,this),c=this.thresholds.findIndex(function(u){return u&&u<=l});this.level=Math.min(this.maxLevel,Math.max(this.minLevel,c<0?this.thresholds.length:c)),mw(jC,this,bJ).call(this)}}}}])})(Or);function cbe(i){var e=this;if(i>obe){oi(Zc,this)[i]=[];return}var t=oi(Zc,this)[i]=ZB(i,oi(Q0,this));t.forEach(function(n){return n.centroid=RJ(n.lat,n.lng,oi(of,e))}),t.octree=$b().x(function(n){return n.centroid.x}).y(function(n){return n.centroid.y}).z(function(n){return n.centroid.z}).addAll(t)}function bJ(){var i=this;if(!(!this.tileUrl||this.level===void 0||!oi(Zc,this).hasOwnProperty(this.level))&&!(!oi(YC,this)&&this.level>sbe)){var e=oi(Zc,this)[this.level];if(oi(P_,this)){var t=this.worldToLocal(oi(P_,this).position.clone());if(e.octree){var n,r=this.worldToLocal(oi(P_,this).position.clone()),s=(r.length()-oi(of,this))*abe;e=(n=e.octree).findAllWithinRadius.apply(n,TJ(r).concat([s]))}else{var o=ibe(t),a=(o.r/oi(of,this)-1)*lbe,l=a/Math.cos(Cg(o.lat)),c=[o.lng-l,o.lng+l],u=[o.lat+a,o.lat-a],f=yJ(this.level,oi(Q0,this),c[0],u[0]),d=XC(f,2),A=d[0],y=d[1],w=yJ(this.level,oi(Q0,this),c[1],u[1]),S=XC(w,2),T=S[0],R=S[1];!e.record&&(e.record={});var P=e.record;if(!P.hasOwnProperty("".concat(Math.round((A+T)/2),"_").concat(Math.round((y+R)/2))))e=ZB(this.level,oi(Q0,this),A,y,T,R).map(function(C){var B="".concat(C.x,"_").concat(C.y);return P.hasOwnProperty(B)?P[B]:(P[B]=C,e.push(C),C)});else{for(var I=[],F=A;F<=T;F++)for(var D=y;D<=R;D++){var L="".concat(F,"_").concat(D);P.hasOwnProperty(L)||(P[L]=ZB(this.level,oi(Q0,this),F,D,F,D)[0],e.push(P[L])),I.push(P[L])}e=I}}}e.filter(function(C){return!C.obj}).filter(oi(YC,this)||function(){return!0}).forEach(function(C){var B=C.x,k=C.y,z=C.lng,G=C.lat,W=C.latLen,Y=360/Math.pow(2,i.level);if(!C.obj){var H=Y*(1-i.tileMargin),$=W*(1-i.tileMargin),J=Cg(z),te=Cg(-G),ce=new Hn(new Va(oi(of,i),Math.ceil(H/i.curvatureResolution),Math.ceil($/i.curvatureResolution),Cg(90-H/2)+J,Cg(H),Cg(90-$/2)+te,Cg($)),new Ga);if(oi(Q0,i)){var he=[G+W/2,G-W/2].map(function(Fe){return .5-Fe/180}),ve=XC(he,2),Re=ve[0],Qe=ve[1];rbe(ce.geometry.attributes.uv,Re,Qe)}C.obj=ce}C.loading||(C.loading=!0,new wl().load(i.tileUrl(B,k,i.level),function(Fe){var mt=C.obj;mt&&(Fe.colorSpace=Br,mt.material.map=Fe,mt.material.color=null,mt.material.needsUpdate=!0,i.add(mt)),C.loading=!1}))})}}var _w=new Set,KB=!1;function rO(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length;_w.size&&_w.clear();let s=FJ(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a=0,l=0,c=0;if(n&&(s=pbe(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let d=t;d<r;d+=t){let A=i[d],y=i[d+1];A<a&&(a=A),y<l&&(l=y),A>u&&(u=A),y>f&&(f=y)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return QB(s,o,a,l,c),o}function FJ(i,e,t,n,r){let s=null;if(r===Mbe(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=NJ(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=NJ(o/n|0,i[o],i[o+1],s);return s&&xw(s,s.next)&&(bw(s),s=s.next),s}function Pg(i,e=i){let t=e===i,n=i,r;do r=!1,n!==n.next&&(_w.size===0||!_w.has(n))&&(xw(n,n.next)||Xs(n.prev,n,n.next)===0)?((t||n===e)&&(e=n.prev),KB=!0,bw(n),n=n.prev,r=!0):(t||n!==e)&&(n=n.next,r=!t);while(r||n!==e);return e}function QB(i,e,t,n,r){r&&ybe(i,t,n,r);let s=i,o=!1;for(;i.prev!==i.next;){let a=i.prev,l=i.next;if(Xs(a,i,l)<0&&(r?hbe(i,t,n,r):ube(i))){e.push(a.i,i.i,l.i),bw(i),i=l,s=l;continue}if(i=l,i===s){if(KB=!1,i=Pg(i),KB){s=i;continue}if(!o){i=fbe(i,e),s=i,o=!0;continue}dbe(i,e,t,n,r);break}}}function ube(i){let e=i.prev,t=i,n=i.next,r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=Math.min(r,s,o),f=Math.min(a,l,c),d=Math.max(r,s,o),A=Math.max(a,l,c),y=n.next;for(;y!==e;){if(y.x>=u&&y.x<=d&&y.y>=f&&y.y<=A&&!(r===y.x&&a===y.y)&&JC(r,a,s,l,o,c,y.x,y.y)&&Xs(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function hbe(i,e,t,n){let r=i.prev,s=i,o=i.next,a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,d=o.y,A=Math.min(a,l,c),y=Math.min(u,f,d),w=Math.max(a,l,c),S=Math.max(u,f,d),T=nO(A,y,e,t,n),R=nO(w,S,e,t,n),P=i.prevZ;for(;P&&P.z>=T;){if(P.x>=A&&P.x<=w&&P.y>=y&&P.y<=S&&P!==o&&!(a===P.x&&u===P.y)&&JC(a,u,l,f,c,d,P.x,P.y)&&Xs(P.prev,P,P.next)>=0)return!1;P=P.prevZ}let I=i.nextZ;for(;I&&I.z<=R;){if(I.x>=A&&I.x<=w&&I.y>=y&&I.y<=S&&I!==o&&!(a===I.x&&u===I.y)&&JC(a,u,l,f,c,d,I.x,I.y)&&Xs(I.prev,I,I.next)>=0)return!1;I=I.nextZ}return!0}function fbe(i,e){let t=i,n=!1;do{let r=t.prev,s=t.next.next;UJ(r,t,t.next,s,!1)&&yw(r,s)&&yw(s,r)&&(e.push(r.i,t.i,s.i),bw(t),bw(t.next),t=i=s,n=!0),t=t.next}while(t!==i);return n?Pg(t):t}function dbe(i,e,t,n,r){let s=i;do{let o=s.next.next;for(;o!==s.prev;){if(s.i!==o.i&&Sbe(s,o)){let a=kJ(s,o);s=Pg(s,s.next),a=Pg(a,a.next),QB(s,e,t,n,r),QB(a,e,t,n,r);return}o=o.next}s=s.next}while(s!==i)}var JB=!1;function pbe(i,e,t,n){let r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s]*n,l=s<o-1?e[s+1]*n:i.length,c=FJ(i,a,l,n,!1);c===c.next&&_w.add(c),r.push(wbe(c))}r.sort(mbe),gbe(i.length/n,e.length),OJ(t,t),JB=!0;for(let s=0;s<r.length;s++)t=Abe(r[s],t);return JB=!1,Pg(t)}function mbe(i,e){return i.x-e.x||i.y-e.y||(i.next.y-i.y)/(i.next.x-i.x)-(e.next.y-e.y)/(e.next.x-e.x)}function Abe(i,e){let t=_be(i,e);if(!t)return e;let n=kJ(t,i),r=n.next;return OJ(t,r.next),Pg(n,n.next),Pg(t,t.next)}var BJ=16,vs=new Float64Array(0),QC=0,eO=[],tO=[];function gbe(i,e){let t=Math.ceil((i+2*e)/BJ)+e+2;vs.length<t*4&&(vs=new Float64Array(t*4)),QC=0}function OJ(i,e){let t=i;do{let n=QC++;eO[n]=t;let r=1/0,s=1/0,o=-1/0,a=-1/0,l=0;do{let u=t.next;t.z=n,t.x<r&&(r=t.x),t.x>o&&(o=t.x),t.y<s&&(s=t.y),t.y>a&&(a=t.y),u.x<r&&(r=u.x),u.x>o&&(o=u.x),u.y<s&&(s=u.y),u.y>a&&(a=u.y),t=u}while(++l<BJ&&t!==e);tO[n]=t;let c=n*4;vs[c]=r,vs[c+1]=s,vs[c+2]=o,vs[c+3]=a}while(t!==e)}function vbe(i,e){let t=i.z*4;e.x<vs[t]&&(vs[t]=e.x),e.y<vs[t+1]&&(vs[t+1]=e.y),e.x>vs[t+2]&&(vs[t+2]=e.x),e.y>vs[t+3]&&(vs[t+3]=e.y)}function LJ(i){let e=tO[i];for(;e.prev.next!==e;)e=e.next;return tO[i]=e,e}function DJ(i){let e=eO[i];for(;e.prev.next!==e;)e=e.next;return eO[i]=e,e}function _be(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(xw(i,t))return t;for(let d=0,A=0;d<QC;d++,A+=4){if(r<vs[A+1]||r>vs[A+3]||vs[A]>n||vs[A+2]<=s)continue;let y=LJ(d);t=DJ(d);do{if(t.prev.next===t){if(xw(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){let w=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(w<=n&&w>s&&(s=w,o=t.x<t.next.x?t:t.next,w===n))return o}}t=t.next}while(t!==y)}if(!o)return null;let a=o.x,l=o.y,c=Math.min(r,l),u=Math.max(r,l),f=1/0;for(let d=0,A=0;d<QC;d++,A+=4){if(vs[A+2]<a||vs[A]>n||vs[A+3]<c||vs[A+1]>u)continue;let y=LJ(d);t=DJ(d);do{if(t.prev.next===t&&n>=t.x&&t.x>=a&&n!==t.x&&JC(r<l?n:s,r,a,l,r<l?s:n,r,t.x,t.y)){let w=Math.abs(r-t.y)/(n-t.x);(yw(t,i)||t.y===r&&t.next.y===r&&t.next.x>n)&&(w<f||w===f&&(t.x>o.x||t.x===o.x&&xbe(o,t)))&&(o=t,f=w)}t=t.next}while(t!==y)}return o}function xbe(i,e){return Xs(i.prev,i,e.prev)<0&&Xs(e.next,i,i.next)<0}var Kc=[],Aw=[],Ig=new Uint32Array(0),gw=new Uint32Array(0),vw=new Uint32Array(256);function ybe(i,e,t,n){let r=i,s=0;do r.z=nO(r.x,r.y,e,t,n),Kc[s++]=r,r=r.next;while(r!==i);bbe(s);let o=null;for(let a=0;a<s;a++){let l=Kc[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function bbe(i){if(i<=32){for(let e=1;e<i;e++){let t=Kc[e],n=t.z,r=e-1;for(;r>=0&&Kc[r].z>n;)Kc[r+1]=Kc[r],r--;Kc[r+1]=t}return}Ig.length<i&&(Ig=new Uint32Array(i),gw=new Uint32Array(i),Aw=new Array(i));for(let e=0;e<i;e++)Ig[e]=Kc[e].z;ZC(i,Kc,Ig,Aw,gw,0),ZC(i,Aw,gw,Kc,Ig,8),ZC(i,Kc,Ig,Aw,gw,16),ZC(i,Aw,gw,Kc,Ig,24)}function ZC(i,e,t,n,r,s){vw.fill(0);for(let a=0;a<i;a++)vw[t[a]>>>s&255]++;let o=0;for(let a=0;a<256;a++){let l=vw[a];vw[a]=o,o+=l}for(let a=0;a<i;a++){let l=t[a],c=vw[l>>>s&255]++;n[c]=e[a],r[c]=l}}function nO(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function wbe(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function JC(i,e,t,n,r,s,o,a){return(r-o)*(e-a)>=(i-o)*(s-a)&&(i-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(n-a)}function Sbe(i,e){let t=xw(i,e)&&Xs(i.prev,i,i.next)>0&&Xs(e.prev,e,e.next)>0;return i.next.i!==e.i&&(t||yw(i,e)&&yw(e,i)&&(Xs(i.prev,i,e.prev)!==0||Xs(i,e.prev,e)!==0))&&!Tbe(i,e)&&(t||Ebe(i,e))}function Xs(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function xw(i,e){return i.x===e.x&&i.y===e.y}function UJ(i,e,t,n,r=!0){let s=Xs(i,e,t),o=Xs(i,e,n),a=Xs(t,n,i),l=Xs(t,n,e);return(s>0&&o<0||s<0&&o>0)&&(a>0&&l<0||a<0&&l>0)?!0:r?!!(s===0&&KC(i,t,e)||o===0&&KC(i,n,e)||a===0&&KC(t,i,n)||l===0&&KC(t,e,n)):!1}function KC(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function Tbe(i,e){let t=Math.min(i.x,e.x),n=Math.max(i.x,e.x),r=Math.min(i.y,e.y),s=Math.max(i.y,e.y),o=i;do{let a=o.next;if(o.x>n&&a.x>n||o.x<t&&a.x<t||o.y>s&&a.y>s||o.y<r&&a.y<r){o=a;continue}if(o.i!==i.i&&a.i!==i.i&&o.i!==e.i&&a.i!==e.i&&UJ(o,a,i,e))return!0;o=a}while(o!==i);return!1}function yw(i,e){return Xs(i.prev,i,i.next)<0?Xs(i,e,i.next)>=0&&Xs(i,i.prev,e)>=0:Xs(i,e,i.prev)<0||Xs(i,i.next,e)<0}function Ebe(i,e){let t=i,n=!1,r=(i.x+e.x)/2,s=(i.y+e.y)/2;do{let o=t.next;t.y>s!=o.y>s&&r<(o.x-t.x)*(s-t.y)/(o.y-t.y)+t.x&&(n=!n),t=o}while(t!==i);return n}function kJ(i,e){let t=iO(i.i,i.x,i.y),n=iO(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function NJ(i,e,t,n){let r=iO(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function bw(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ),JB&&vbe(i.prev,i.next)}function iO(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function Mbe(i,e,t,n){let r=0;for(let s=e,o=t-n;s<t;s+=n)r+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return r}function L_(i){let e=[],t=[],n=i[0][0].length,r=0,s=0;for(let o of i){for(let a of o)for(let l=0;l<n;l++)e.push(a[l]);s&&(r+=s,t.push(r)),s=o.length}return{vertices:e,holes:t,dimensions:n}}function oO(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function Cbe(i){if(Array.isArray(i))return i}function Rbe(i){if(Array.isArray(i))return oO(i)}function Ibe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Pbe(i,e,t){return e=eR(e),zbe(i,GJ()?Reflect.construct(e,[],eR(i).constructor):e.apply(i,t))}function Lbe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Dbe(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function Nbe(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=cO(i))||e){t&&(i=t);var n=0,r=function(){};return{s:r,n:function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.4121-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,o=!0,a=!1;return{s:function(){t=t.call(i)},n:function(){var l=t.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{o||t.return==null||t.return()}finally{if(a)throw s}}}}function eR(i){return eR=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},eR(i)}function Fbe(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&aO(i,e)}function GJ(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(GJ=function(){return!!i})()}function Bbe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Obe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Ube(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4122-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kbe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4123-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zbe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ibe(i)}function aO(i,e){return aO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},aO(i,e)}function ww(i,e){return Cbe(i)||Obe(i,e)||cO(i,e)||Ube()}function Vbe(i){return Rbe(i)||Bbe(i)||cO(i)||kbe()}function cO(i,e){if(i){if(typeof i=="string")return oO(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?oO(i,e):void 0}}var zJ=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,n=[],r=null;return e.forEach(function(s){if(r){var o=Cl(s,r)*180/Math.PI;if(o>t)for(var a=Mg(r,s),l=r.length>2||s.length>2?nf(r[2]||0,s[2]||0):null,c=l?function(d){return[].concat(Vbe(a(d)),[l(d)])}:a,u=1/Math.ceil(o/t),f=u;f<1;)n.push(c(f)),f+=u}n.push(r=s)}),n},lO=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:Xn,Float32BufferAttribute:Ln},Gbe=new lO.BufferGeometry().setAttribute?"setAttribute":"addAttribute",uO=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:5;Lbe(this,e),n=Pbe(this,e),n.type="GeoJsonGeometry",n.parameters={geoJson:t,radius:r,resolution:s};var o=({Point:u,MultiPoint:f,LineString:d,MultiLineString:A,Polygon:y,MultiPolygon:w}[t.type]||function(){return[]})(t.coordinates,r),a=[],l=[],c=0;o.forEach(function(S){var T=a.length;Sw({indices:a,vertices:l},S),n.addGroup(T,a.length-T,c++)}),a.length&&n.setIndex(a),l.length&&n[Gbe]("position",new lO.Float32BufferAttribute(l,3));function u(S,T){var R=sO(S[1],S[0],T+(S[2]||0)),P=[];return[{vertices:R,indices:P}]}function f(S,T){var R={vertices:[],indices:[]};return S.map(function(P){return u(P,T)}).forEach(function(P){var I=ww(P,1),F=I[0];Sw(R,F)}),[R]}function d(S,T){for(var R=zJ(S,s).map(function(C){var B=ww(C,3),k=B[0],z=B[1],G=B[2],W=G===void 0?0:G;return sO(z,k,T+W)}),P=L_([R]),I=P.vertices,F=Math.round(I.length/3),D=[],L=1;L<F;L++)D.push(L-1,L);return[{vertices:I,indices:D}]}function A(S,T){var R={vertices:[],indices:[]};return S.map(function(P){return d(P,T)}).forEach(function(P){var I=ww(P,1),F=I[0];Sw(R,F)}),[R]}function y(S,T){for(var R=S.map(function(H){return zJ(H,s).map(function($){var J=ww($,3),te=J[0],ce=J[1],he=J[2],ve=he===void 0?0:he;return sO(ce,te,T+ve)})}),P=L_(R),I=P.vertices,F=P.holes,D=F[0]||1/0,L=I.slice(0,D*3),C=I.slice(D*3),B=new Set(F),k=Math.round(I.length/3),z=[],G=[],W=1;W<k;W++)B.has(W)||(W<D?z.push(W-1,W):G.push(W-1-D,W-D));var Y=[{indices:z,vertices:L}];return F.length&&Y.push({indices:G,vertices:C}),Y}function w(S,T){var R={vertices:[],indices:[]},P={vertices:[],indices:[]};S.map(function(F){return y(F,T)}).forEach(function(F){var D=ww(F,2),L=D[0],C=D[1];Sw(R,L),C&&Sw(P,C)});var I=[R];return P.vertices.length&&I.push(P),I}return n}return Fbe(e,i),Dbe(e)})(lO.BufferGeometry);function Sw(i,e){var t=Math.round(i.vertices.length/3);VJ(i.vertices,e.vertices),VJ(i.indices,e.indices.map(function(n){return n+t}))}function VJ(i,e){var t=Nbe(e),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;i.push(r)}}catch(s){t.e(s)}finally{t.f()}}function sO(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}var Tw={};fhe(Tw,{computeMikkTSpaceTangents:()=>qbe,computeMorphedAttributes:()=>Kbe,deepCloneAttribute:()=>Wbe,deinterleaveAttribute:()=>tR,deinterleaveGeometry:()=>Xbe,estimateBytesUsed:()=>$be,interleaveAttributes:()=>jbe,mergeAttributes:()=>hO,mergeGeometries:()=>Hbe,mergeGroups:()=>Qbe,mergeVertices:()=>Ybe,toCreasedNormals:()=>Jbe,toTrianglesDrawMode:()=>Zbe});function qbe(i,e,t=!0){if(!e||!e.isReady)throw new Error("THREE.BufferGeometryUtils: Initialized MikkTSpace library required.");if(!i.hasAttribute("position")||!i.hasAttribute("normal")||!i.hasAttribute("uv"))throw new Error('THREE.BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function n(o){if(o.normalized||o.isInterleavedBufferAttribute){let a=new Float32Array(o.count*o.itemSize);for(let l=0,c=0;l<o.count;l++)a[c++]=o.getX(l),a[c++]=o.getY(l),o.itemSize>2&&(a[c++]=o.getZ(l));return a}return o.array instanceof Float32Array?o.array:new Float32Array(o.array)}let r=i.index?i.toNonIndexed():i,s=e.generateTangents(n(r.attributes.position),n(r.attributes.normal),n(r.attributes.uv));if(t)for(let o=3;o<s.length;o+=4)s[o]*=-1;return r.setAttribute("tangent",new Hi(s,4)),i!==r&&i.copy(r),i}function Hbe(i,e=!1){let t=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),s={},o={},a=i[0].morphTargetsRelative,l=new Xn,c=0;for(let u=0;u<i.length;++u){let f=i[u],d=0;if(t!==(f.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let A in f.attributes){if(!n.has(A))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+A+'" attribute exists among all geometries, or in none of them.'),null;s[A]===void 0&&(s[A]=[]),s[A].push(f.attributes[A]),d++}if(d!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==f.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let A in f.morphAttributes){if(!r.has(A))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[A]===void 0&&(o[A]=[]),o[A].push(f.morphAttributes[A])}if(e){let A;if(t)A=f.index.count;else if(f.attributes.position!==void 0)A=f.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,A,u),c+=A}}if(t){let u=0,f=[];for(let d=0;d<i.length;++d){let A=i[d].index;for(let y=0;y<A.count;++y)f.push(A.getX(y)+u);u+=i[d].attributes.position.count}l.setIndex(f)}for(let u in s){let f=hO(s[u]);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,f)}for(let u in o){let f=o[u][0].length;if(f!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let d=0;d<f;++d){let A=[];for(let w=0;w<o[u].length;++w)A.push(o[u][w][d]);let y=hO(A);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(y)}}}return l}function hO(i){let e,t,n,r=-1,s=0;for(let c=0;c<i.length;++c){let u=i[c];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=u.itemSize),t!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=u.normalized),n!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=u.gpuType),r!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*t}let o=new e(s),a=new Hi(o,t,n),l=0;for(let c=0;c<i.length;++c){let u=i[c];if(u.isInterleavedBufferAttribute){let f=l/t;for(let d=0,A=u.count;d<A;d++)for(let y=0;y<t;y++){let w=u.getComponent(d,y);a.setComponent(d+f,y,w)}}else o.set(u.array,l);l+=u.count*t}return r!==void 0&&(a.gpuType=r),a}function Wbe(i){return i.isInstancedInterleavedBufferAttribute||i.isInterleavedBufferAttribute?tR(i):i.isInstancedBufferAttribute?new ec().copy(i):new Hi().copy(i)}function jbe(i){let e,t=0,n=0;for(let c=0,u=i.length;c<u;++c){let f=i[c];if(e===void 0&&(e=f.array.constructor),e!==f.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;t+=f.array.length,n+=f.itemSize}let r=new Ld(new e(t),n),s=0,o=[],a=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let c=0,u=i.length;c<u;c++){let f=i[c],d=f.itemSize,A=f.count,y=new Vo(r,d,s,f.normalized);o.push(y),s+=d;for(let w=0;w<A;w++)for(let S=0;S<d;S++)y[l[S]](w,f[a[S]](w))}return o}function tR(i){let e=i.data.array.constructor,t=i.count,n=i.itemSize,r=i.normalized,s=new e(t*n),o;i.isInstancedInterleavedBufferAttribute?o=new ec(s,n,r,i.meshPerAttribute):o=new Hi(s,n,r);for(let a=0;a<t;a++)o.setX(a,i.getX(a)),n>=2&&o.setY(a,i.getY(a)),n>=3&&o.setZ(a,i.getZ(a)),n>=4&&o.setW(a,i.getW(a));return o}function Xbe(i){let e=i.attributes,t=i.morphTargets,n=new Map;for(let r in e){let s=e[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,tR(s)),e[r]=n.get(s))}for(let r in t){let s=t[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,tR(s)),t[r]=n.get(s))}}function $be(i){let e=0;for(let n in i.attributes){let r=i.getAttribute(n);e+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}let t=i.getIndex();return e+=t?t.count*t.itemSize*t.array.BYTES_PER_ELEMENT:0,e}function Ybe(i,e=1e-4){e=Math.max(e,Number.EPSILON);let t={},n=i.getIndex(),r=i.getAttribute("position"),s=n?n.count:r.count,o=0,a=Object.keys(i.attributes),l={},c={},u=[],f=["getX","getY","getZ","getW"],d=["setX","setY","setZ","setW"];for(let R=0,P=a.length;R<P;R++){let I=a[R],F=i.attributes[I];l[I]=new F.constructor(new F.array.constructor(F.count*F.itemSize),F.itemSize,F.normalized);let D=i.morphAttributes[I];D&&(c[I]||(c[I]=[]),D.forEach((L,C)=>{let B=new L.array.constructor(L.count*L.itemSize);c[I][C]=new L.constructor(B,L.itemSize,L.normalized)}))}let A=e*.5,y=Math.log10(1/e),w=Math.pow(10,y),S=A*w;for(let R=0;R<s;R++){let P=n?n.getX(R):R,I="";for(let F=0,D=a.length;F<D;F++){let L=a[F],C=i.getAttribute(L),B=C.itemSize;for(let k=0;k<B;k++)I+=`${~~(C[f[k]](P)*w+S)},`}if(I in t)u.push(t[I]);else{for(let F=0,D=a.length;F<D;F++){let L=a[F],C=i.getAttribute(L),B=i.morphAttributes[L],k=C.itemSize,z=l[L],G=c[L];for(let W=0;W<k;W++){let Y=f[W],H=d[W];if(z[H](o,C[Y](P)),B)for(let $=0,J=B.length;$<J;$++)G[$][H](o,B[$][Y](P))}}t[I]=o,u.push(o),o++}}let T=i.clone();for(let R in i.attributes){let P=l[R];if(T.setAttribute(R,new P.constructor(P.array.slice(0,o*P.itemSize),P.itemSize,P.normalized)),R in c)for(let I=0;I<c[R].length;I++){let F=c[R][I];T.morphAttributes[R][I]=new F.constructor(F.array.slice(0,o*F.itemSize),F.itemSize,F.normalized)}}return T.setIndex(u),T}function Zbe(i,e){if(e===Z8)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===GM||e===K8){let t=i.getIndex();if(t===null){let o=[],a=i.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);i.setIndex(o),t=i.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),i}let n=t.count-2,r=[];if(e===GM)for(let o=1;o<=n;o++)r.push(t.getX(0)),r.push(t.getX(o)),r.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2===0?(r.push(t.getX(o)),r.push(t.getX(o+1)),r.push(t.getX(o+2))):(r.push(t.getX(o+2)),r.push(t.getX(o+1)),r.push(t.getX(o)));r.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let s=i.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),i}function Kbe(i){let e=new re,t=new re,n=new re,r=new re,s=new re,o=new re,a=new re,l=new re,c=new re;function u(ce,he,ve,Re,Qe,Fe,mt,Ee){e.fromBufferAttribute(he,Qe),t.fromBufferAttribute(he,Fe),n.fromBufferAttribute(he,mt);let Ve=ce.morphTargetInfluences;if(ve&&Ve){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let Ye=0,Mt=ve.length;Ye<Mt;Ye++){let Et=Ve[Ye],It=ve[Ye];Et!==0&&(r.fromBufferAttribute(It,Qe),s.fromBufferAttribute(It,Fe),o.fromBufferAttribute(It,mt),Re?(a.addScaledVector(r,Et),l.addScaledVector(s,Et),c.addScaledVector(o,Et)):(a.addScaledVector(r.sub(e),Et),l.addScaledVector(s.sub(t),Et),c.addScaledVector(o.sub(n),Et)))}e.add(a),t.add(l),n.add(c)}ce.isSkinnedMesh&&(ce.applyBoneTransform(Qe,e),ce.applyBoneTransform(Fe,t),ce.applyBoneTransform(mt,n)),Ee[Qe*3+0]=e.x,Ee[Qe*3+1]=e.y,Ee[Qe*3+2]=e.z,Ee[Fe*3+0]=t.x,Ee[Fe*3+1]=t.y,Ee[Fe*3+2]=t.z,Ee[mt*3+0]=n.x,Ee[mt*3+1]=n.y,Ee[mt*3+2]=n.z}let f=i.geometry,d=i.material,A,y,w,S=f.index,T=f.attributes.position,R=f.morphAttributes.position,P=f.morphTargetsRelative,I=f.attributes.normal,F=f.morphAttributes.normal,D=f.groups,L=f.drawRange,C,B,k,z,G,W,Y,H=new Float32Array(T.count*T.itemSize),$=new Float32Array(I.count*I.itemSize);if(S!==null)if(Array.isArray(d))for(C=0,k=D.length;C<k;C++)for(G=D[C],W=Math.max(G.start,L.start),Y=Math.min(G.start+G.count,L.start+L.count),B=W,z=Y;B<z;B+=3)A=S.getX(B),y=S.getX(B+1),w=S.getX(B+2),u(i,T,R,P,A,y,w,H),u(i,I,F,P,A,y,w,$);else for(W=Math.max(0,L.start),Y=Math.min(S.count,L.start+L.count),C=W,k=Y;C<k;C+=3)A=S.getX(C),y=S.getX(C+1),w=S.getX(C+2),u(i,T,R,P,A,y,w,H),u(i,I,F,P,A,y,w,$);else if(Array.isArray(d))for(C=0,k=D.length;C<k;C++)for(G=D[C],W=Math.max(G.start,L.start),Y=Math.min(G.start+G.count,L.start+L.count),B=W,z=Y;B<z;B+=3)A=B,y=B+1,w=B+2,u(i,T,R,P,A,y,w,H),u(i,I,F,P,A,y,w,$);else for(W=Math.max(0,L.start),Y=Math.min(T.count,L.start+L.count),C=W,k=Y;C<k;C+=3)A=C,y=C+1,w=C+2,u(i,T,R,P,A,y,w,H),u(i,I,F,P,A,y,w,$);let J=new Ln(H,3),te=new Ln($,3);return{positionAttribute:T,normalAttribute:I,morphedPositionAttribute:J,morphedNormalAttribute:te}}function Qbe(i){if(i.groups.length===0)return console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."),i;let e=i.groups;if(e=e.sort((o,a)=>o.materialIndex!==a.materialIndex?o.materialIndex-a.materialIndex:o.start-a.start),i.getIndex()===null){let o=i.getAttribute("position"),a=[];for(let l=0;l<o.count;l+=3)a.push(l,l+1,l+2);i.setIndex(a)}let t=i.getIndex(),n=[];for(let o=0;o<e.length;o++){let a=e[o],l=a.start,c=l+a.count;for(let u=l;u<c;u++)n.push(t.getX(u))}i.dispose(),i.setIndex(n);let r=0;for(let o=0;o<e.length;o++){let a=e[o];a.start=r,r+=a.count}let s=e[0];i.groups=[s];for(let o=1;o<e.length;o++){let a=e[o];s.materialIndex===a.materialIndex?s.count+=a.count:(s=a,i.groups.push(s))}return i}function Jbe(i,e=Math.PI/3){let t=i.index?i.toNonIndexed():i,n=t.attributes.position,r=n.count,s;if(n.isBufferAttribute===!0&&n.itemSize===3&&n.normalized===!1)s=n.array;else{s=new Float64Array(r*3);for(let I=0;I<r;I++)s[3*I+0]=n.getX(I),s[3*I+1]=n.getY(I),s[3*I+2]=n.getZ(I)}let o=Math.cos(e),a=(1+1e-10)*100,l=r/3,c=new Float64Array(l*3);for(let I=0;I<l;I++){let F=9*I,D=s[F+0],L=s[F+1],C=s[F+2],B=s[F+3],k=s[F+4],z=s[F+5],G=s[F+6],W=s[F+7],Y=s[F+8],H=G-B,$=W-k,J=Y-z,te=D-B,ce=L-k,he=C-z,ve=$*he-J*ce,Re=J*te-H*he,Qe=H*ce-$*te,Fe=1/(Math.sqrt(ve*ve+Re*Re+Qe*Qe)||1);c[3*I+0]=ve*Fe,c[3*I+1]=Re*Fe,c[3*I+2]=Qe*Fe}let u=new Int32Array(r),f=new Int32Array(r*3),d=1;for(;d<r*2;)d<<=1;let A=d-1,y=new Int32Array(d),w=0;for(let I=0;I<r;I++){let F=3*I,D=~~(s[F+0]*a),L=~~(s[F+1]*a),C=~~(s[F+2]*a),B=(Math.imul(D,73856093)^Math.imul(L,19349663)^Math.imul(C,83492791))&A;for(;;){let k=y[B];if(k===0){let G=3*w;f[G+0]=D,f[G+1]=L,f[G+2]=C,y[B]=w+1,u[I]=w++;break}let z=3*(k-1);if(f[z+0]===D&&f[z+1]===L&&f[z+2]===C){u[I]=k-1;break}B=B+1&A}}let S=new Int32Array(w+1);for(let I=0;I<r;I++)S[u[I]+1]++;for(let I=0;I<w;I++)S[I+1]+=S[I];let T=new Int32Array(r),R=S.slice(0,w);for(let I=0;I<l;I++){let F=3*I;T[R[u[F+0]]++]=I,T[R[u[F+1]]++]=I,T[R[u[F+2]]++]=I}let P=new Float32Array(r*3);for(let I=0;I<l;I++){let F=3*I,D=c[F+0],L=c[F+1],C=c[F+2];for(let B=0;B<3;B++){let k=F+B,z=u[k],G=0,W=0,Y=0;for(let $=S[z],J=S[z+1];$<J;$++){let te=3*T[$],ce=c[te+0],he=c[te+1],ve=c[te+2];D*ce+L*he+C*ve>o&&(G+=ce,W+=he,Y+=ve)}let H=1/(Math.sqrt(G*G+W*W+Y*Y)||1);P[3*k+0]=G*H,P[3*k+1]=W*H,P[3*k+2]=Y*H}}return t.setAttribute("normal",new Hi(P,3,!1)),t}var st=(function(i){return typeof i=="function"?i:typeof i=="string"?function(e){return e[i]}:function(e){return i}});function nR(i){"@babel/helpers - typeof";return nR=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},nR(i)}var ewe=/^\s+/,twe=/\s+$/;function An(i,e){if(i=i||"",e=e||{},i instanceof An)return i;if(!(this instanceof An))return new An(i,e);var t=nwe(i);this._originalInput=i,this._r=t.r,this._g=t.g,this._b=t.b,this._a=t.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||t.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=t.ok}An.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t,n,r,s,o,a;return t=e.r/255,n=e.g/255,r=e.b/255,t<=.03928?s=t/12.92:s=Math.pow((t+.055)/1.055,2.4),n<=.03928?o=n/12.92:o=Math.pow((n+.055)/1.055,2.4),r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),.2126*s+.7152*o+.0722*a},setAlpha:function(e){return this._a=YJ(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=HJ(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=HJ(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this._a==1?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=qJ(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=qJ(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this._a==1?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return WJ(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return owe(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(kr(this._r,255)*100)+"%",g:Math.round(kr(this._g,255)*100)+"%",b:Math.round(kr(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(kr(this._r,255)*100)+"%, "+Math.round(kr(this._g,255)*100)+"%, "+Math.round(kr(this._b,255)*100)+"%)":"rgba("+Math.round(kr(this._r,255)*100)+"%, "+Math.round(kr(this._g,255)*100)+"%, "+Math.round(kr(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:vwe[WJ(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+jJ(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=An(e);n="#"+jJ(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,r=this._a<1&&this._a>=0,s=!t&&r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(n=this.toRgbString()),e==="prgb"&&(n=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(n=this.toHexString()),e==="hex3"&&(n=this.toHexString(!0)),e==="hex4"&&(n=this.toHex8String(!0)),e==="hex8"&&(n=this.toHex8String()),e==="name"&&(n=this.toName()),e==="hsl"&&(n=this.toHslString()),e==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return An(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(uwe,arguments)},brighten:function(){return this._applyModification(hwe,arguments)},darken:function(){return this._applyModification(fwe,arguments)},desaturate:function(){return this._applyModification(awe,arguments)},saturate:function(){return this._applyModification(lwe,arguments)},greyscale:function(){return this._applyModification(cwe,arguments)},spin:function(){return this._applyModification(dwe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(Awe,arguments)},complement:function(){return this._applyCombination(pwe,arguments)},monochromatic:function(){return this._applyCombination(gwe,arguments)},splitcomplement:function(){return this._applyCombination(mwe,arguments)},triad:function(){return this._applyCombination(XJ,[3])},tetrad:function(){return this._applyCombination(XJ,[4])}};An.fromRatio=function(i,e){if(nR(i)=="object"){var t={};for(var n in i)i.hasOwnProperty(n)&&(n==="a"?t[n]=i[n]:t[n]=Ew(i[n]));i=t}return An(i,e)};function nwe(i){var e={r:0,g:0,b:0},t=1,n=null,r=null,s=null,o=!1,a=!1;return typeof i=="string"&&(i=bwe(i)),nR(i)=="object"&&(Hd(i.r)&&Hd(i.g)&&Hd(i.b)?(e=iwe(i.r,i.g,i.b),o=!0,a=String(i.r).substr(-1)==="%"?"prgb":"rgb"):Hd(i.h)&&Hd(i.s)&&Hd(i.v)?(n=Ew(i.s),r=Ew(i.v),e=swe(i.h,n,r),o=!0,a="hsv"):Hd(i.h)&&Hd(i.s)&&Hd(i.l)&&(n=Ew(i.s),s=Ew(i.l),e=rwe(i.h,n,s),o=!0,a="hsl"),i.hasOwnProperty("a")&&(t=i.a)),t=YJ(t),{ok:o,format:i.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function iwe(i,e,t){return{r:kr(i,255)*255,g:kr(e,255)*255,b:kr(t,255)*255}}function qJ(i,e,t){i=kr(i,255),e=kr(e,255),t=kr(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,o,a=(n+r)/2;if(n==r)s=o=0;else{var l=n-r;switch(o=a>.5?l/(2-n-r):l/(n+r),n){case i:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-i)/l+2;break;case t:s=(i-e)/l+4;break}s/=6}return{h:s,s:o,l:a}}function rwe(i,e,t){var n,r,s;i=kr(i,360),e=kr(e,100),t=kr(t,100);function o(c,u,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?c+(u-c)*6*f:f<1/2?u:f<2/3?c+(u-c)*(2/3-f)*6:c}if(e===0)n=r=s=t;else{var a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;n=o(l,a,i+1/3),r=o(l,a,i),s=o(l,a,i-1/3)}return{r:n*255,g:r*255,b:s*255}}function HJ(i,e,t){i=kr(i,255),e=kr(e,255),t=kr(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,o,a=n,l=n-r;if(o=n===0?0:l/n,n==r)s=0;else{switch(n){case i:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-i)/l+2;break;case t:s=(i-e)/l+4;break}s/=6}return{h:s,s:o,v:a}}function swe(i,e,t){i=kr(i,360)*6,e=kr(e,100),t=kr(t,100);var n=Math.floor(i),r=i-n,s=t*(1-e),o=t*(1-r*e),a=t*(1-(1-r)*e),l=n%6,c=[t,o,s,s,a,t][l],u=[a,t,t,o,s,s][l],f=[s,s,a,t,t,o][l];return{r:c*255,g:u*255,b:f*255}}function WJ(i,e,t,n){var r=[Wu(Math.round(i).toString(16)),Wu(Math.round(e).toString(16)),Wu(Math.round(t).toString(16))];return n&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function owe(i,e,t,n,r){var s=[Wu(Math.round(i).toString(16)),Wu(Math.round(e).toString(16)),Wu(Math.round(t).toString(16)),Wu(ZJ(n))];return r&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function jJ(i,e,t,n){var r=[Wu(ZJ(n)),Wu(Math.round(i).toString(16)),Wu(Math.round(e).toString(16)),Wu(Math.round(t).toString(16))];return r.join("")}An.equals=function(i,e){return!i||!e?!1:An(i).toRgbString()==An(e).toRgbString()};An.random=function(){return An.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function awe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.s-=e/100,t.s=iR(t.s),An(t)}function lwe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.s+=e/100,t.s=iR(t.s),An(t)}function cwe(i){return An(i).desaturate(100)}function uwe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.l+=e/100,t.l=iR(t.l),An(t)}function hwe(i,e){e=e===0?0:e||10;var t=An(i).toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(255*-(e/100)))),t.g=Math.max(0,Math.min(255,t.g-Math.round(255*-(e/100)))),t.b=Math.max(0,Math.min(255,t.b-Math.round(255*-(e/100)))),An(t)}function fwe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.l-=e/100,t.l=iR(t.l),An(t)}function dwe(i,e){var t=An(i).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,An(t)}function pwe(i){var e=An(i).toHsl();return e.h=(e.h+180)%360,An(e)}function XJ(i,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var t=An(i).toHsl(),n=[An(i)],r=360/e,s=1;s<e;s++)n.push(An({h:(t.h+s*r)%360,s:t.s,l:t.l}));return n}function mwe(i){var e=An(i).toHsl(),t=e.h;return[An(i),An({h:(t+72)%360,s:e.s,l:e.l}),An({h:(t+216)%360,s:e.s,l:e.l})]}function Awe(i,e,t){e=e||6,t=t||30;var n=An(i).toHsl(),r=360/t,s=[An(i)];for(n.h=(n.h-(r*e>>1)+720)%360;--e;)n.h=(n.h+r)%360,s.push(An(n));return s}function gwe(i,e){e=e||6;for(var t=An(i).toHsv(),n=t.h,r=t.s,s=t.v,o=[],a=1/e;e--;)o.push(An({h:n,s:r,v:s})),s=(s+a)%1;return o}An.mix=function(i,e,t){t=t===0?0:t||50;var n=An(i).toRgb(),r=An(e).toRgb(),s=t/100,o={r:(r.r-n.r)*s+n.r,g:(r.g-n.g)*s+n.g,b:(r.b-n.b)*s+n.b,a:(r.a-n.a)*s+n.a};return An(o)};An.readability=function(i,e){var t=An(i),n=An(e);return(Math.max(t.getLuminance(),n.getLuminance())+.05)/(Math.min(t.getLuminance(),n.getLuminance())+.05)};An.isReadable=function(i,e,t){var n=An.readability(i,e),r,s;switch(s=!1,r=wwe(t),r.level+r.size){case"AAsmall":case"AAAlarge":s=n>=4.5;break;case"AAlarge":s=n>=3;break;case"AAAsmall":s=n>=7;break}return s};An.mostReadable=function(i,e,t){var n=null,r=0,s,o,a,l;t=t||{},o=t.includeFallbackColors,a=t.level,l=t.size;for(var c=0;c<e.length;c++)s=An.readability(i,e[c]),s>r&&(r=s,n=An(e[c]));return An.isReadable(i,n,{level:a,size:l})||!o?n:(t.includeFallbackColors=!1,An.mostReadable(i,["#fff","#000"],t))};var fO=An.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},vwe=An.hexNames=_we(fO);function _we(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function YJ(i){return i=parseFloat(i),(isNaN(i)||i<0||i>1)&&(i=1),i}function kr(i,e){xwe(i)&&(i="100%");var t=ywe(i);return i=Math.min(e,Math.max(0,parseFloat(i))),t&&(i=parseInt(i*e,10)/100),Math.abs(i-e)<1e-6?1:i%e/parseFloat(e)}function iR(i){return Math.min(1,Math.max(0,i))}function oc(i){return parseInt(i,16)}function xwe(i){return typeof i=="string"&&i.indexOf(".")!=-1&&parseFloat(i)===1}function ywe(i){return typeof i=="string"&&i.indexOf("%")!=-1}function Wu(i){return i.length==1?"0"+i:""+i}function Ew(i){return i<=1&&(i=i*100+"%"),i}function ZJ(i){return Math.round(parseFloat(i)*255).toString(16)}function $J(i){return oc(i)/255}var Hu=(function(){var i="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+i+")",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+r),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function Hd(i){return!!Hu.CSS_UNIT.exec(i)}function bwe(i){i=i.replace(ewe,"").replace(twe,"").toLowerCase();var e=!1;if(fO[i])i=fO[i],e=!0;else if(i=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Hu.rgb.exec(i))?{r:t[1],g:t[2],b:t[3]}:(t=Hu.rgba.exec(i))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Hu.hsl.exec(i))?{h:t[1],s:t[2],l:t[3]}:(t=Hu.hsla.exec(i))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Hu.hsv.exec(i))?{h:t[1],s:t[2],v:t[3]}:(t=Hu.hsva.exec(i))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Hu.hex8.exec(i))?{r:oc(t[1]),g:oc(t[2]),b:oc(t[3]),a:$J(t[4]),format:e?"name":"hex8"}:(t=Hu.hex6.exec(i))?{r:oc(t[1]),g:oc(t[2]),b:oc(t[3]),format:e?"name":"hex"}:(t=Hu.hex4.exec(i))?{r:oc(t[1]+""+t[1]),g:oc(t[2]+""+t[2]),b:oc(t[3]+""+t[3]),a:$J(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Hu.hex3.exec(i))?{r:oc(t[1]+""+t[1]),g:oc(t[2]+""+t[2]),b:oc(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function wwe(i){var e,t;return i=i||{level:"AA",size:"small"},e=(i.level||"AA").toUpperCase(),t=(i.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}function AO(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function Swe(i){if(Array.isArray(i))return i}function Twe(i){if(Array.isArray(i))return AO(i)}function KJ(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function Ewe(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Mwe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function pa(i,e){return i.get(KJ(i,e))}function D_(i,e,t){Ewe(i,e),e.set(i,t)}function rR(i,e,t){return i.set(KJ(i,e),t),t}function Cwe(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,Owe(n.key),n)}}function Rwe(i,e,t){return e&&Cwe(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Iwe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Pwe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Lwe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4124-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dwe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4125-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nwe(i,e){return Swe(i)||Pwe(i,e)||QJ(i,e)||Lwe()}function Fwe(i){return Twe(i)||Iwe(i)||QJ(i)||Dwe()}function Bwe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function Owe(i){var e=Bwe(i,"string");return typeof e=="symbol"?e:e+""}function QJ(i,e){if(i){if(typeof i=="string")return AO(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?AO(i,e):void 0}}var N_=new WeakMap,Mw=new WeakMap,F_=new WeakMap,dO=new WeakMap,pO=new WeakMap,mO=new WeakMap,JJ=(function(){function i(){Mwe(this,i),D_(this,N_,new Map),D_(this,Mw,new Map),D_(this,F_,function(e){return e}),D_(this,dO,function(){return{}}),D_(this,pO,function(){}),D_(this,mO,function(){})}return Rwe(i,[{key:"getObj",value:function(t){return pa(N_,this).get(pa(F_,this).call(this,t))}},{key:"getData",value:function(t){return pa(Mw,this).get(t)}},{key:"entries",value:function(){return Fwe(pa(Mw,this).entries()).map(function(t){var n=Nwe(t,2),r=n[0],s=n[1];return[s,r]})}},{key:"id",value:function(t){return rR(F_,this,st(t)),this}},{key:"onCreateObj",value:function(t){return rR(dO,this,t),this}},{key:"onUpdateObj",value:function(t){return rR(pO,this,t),this}},{key:"onRemoveObj",value:function(t){return rR(mO,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(s){return!pa(N_,n).has(pa(F_,n).call(n,s))}).forEach(function(s){var o=pa(dO,n).call(n,s);pa(N_,n).set(pa(F_,n).call(n,s),o),pa(Mw,n).set(o,s)});var r=new Map(t.map(function(s){return[pa(F_,n).call(n,s),s]}));return pa(N_,this).forEach(function(s,o){r.has(o)?pa(pO,n).call(n,s,r.get(o)):(pa(mO,n).call(n,s,o),pa(N_,n).delete(o),pa(Mw,n).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})();var A1=Oq(eee(),1);var Ei=11102230246251565e-32,$s=134217729,Rw=(3+8*Ei)*Ei;function Lg(i,e,t,n,r){let s,o,a,l,c=e[0],u=n[0],f=0,d=0;u>c==u>-c?(s=c,c=e[++f]):(s=u,u=n[++d]);let A=0;if(f<i&&d<t)for(u>c==u>-c?(o=c+s,a=s-(o-c),c=e[++f]):(o=u+s,a=s-(o-u),u=n[++d]),s=o,a!==0&&(r[A++]=a);f<i&&d<t;)u>c==u>-c?(o=s+c,l=o-s,a=s-(o-l)+(c-l),c=e[++f]):(o=s+u,l=o-s,a=s-(o-l)+(u-l),u=n[++d]),s=o,a!==0&&(r[A++]=a);for(;f<i;)o=s+c,l=o-s,a=s-(o-l)+(c-l),c=e[++f],s=o,a!==0&&(r[A++]=a);for(;d<t;)o=s+u,l=o-s,a=s-(o-l)+(u-l),u=n[++d],s=o,a!==0&&(r[A++]=a);return(s!==0||A===0)&&(r[A++]=s),A}function Iw(i,e){let t=e[0];for(let n=1;n<i;n++)t+=e[n];return t}function ht(i){return new Float64Array(i)}var Uwe=(3+16*Ei)*Ei,kwe=(2+12*Ei)*Ei,zwe=(9+64*Ei)*Ei*Ei,B_=ht(4),tee=ht(8),nee=ht(12),iee=ht(16),$a=ht(4);function Vwe(i,e,t,n,r,s,o){let a,l,c,u,f,d,A,y,w,S,T,R,P,I,F,D,L,C,B=i-r,k=t-r,z=e-s,G=n-s;I=B*G,d=$s*B,A=d-(d-B),y=B-A,d=$s*G,w=d-(d-G),S=G-w,F=y*S-(I-A*w-y*w-A*S),D=z*k,d=$s*z,A=d-(d-z),y=z-A,d=$s*k,w=d-(d-k),S=k-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,B_[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,B_[1]=P-(T+f)+(f-D),C=R+T,f=C-R,B_[2]=R-(C-f)+(T-f),B_[3]=C;let W=Iw(4,B_),Y=kwe*o;if(W>=Y||-W>=Y||(f=i-B,a=i-(B+f)+(f-r),f=t-k,c=t-(k+f)+(f-r),f=e-z,l=e-(z+f)+(f-s),f=n-G,u=n-(G+f)+(f-s),a===0&&l===0&&c===0&&u===0)||(Y=zwe*o+Rw*Math.abs(W),W+=B*u+G*a-(z*c+k*l),W>=Y||-W>=Y))return W;I=a*G,d=$s*a,A=d-(d-a),y=a-A,d=$s*G,w=d-(d-G),S=G-w,F=y*S-(I-A*w-y*w-A*S),D=l*k,d=$s*l,A=d-(d-l),y=l-A,d=$s*k,w=d-(d-k),S=k-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,$a[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,$a[1]=P-(T+f)+(f-D),C=R+T,f=C-R,$a[2]=R-(C-f)+(T-f),$a[3]=C;let H=Lg(4,B_,4,$a,tee);I=B*u,d=$s*B,A=d-(d-B),y=B-A,d=$s*u,w=d-(d-u),S=u-w,F=y*S-(I-A*w-y*w-A*S),D=z*c,d=$s*z,A=d-(d-z),y=z-A,d=$s*c,w=d-(d-c),S=c-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,$a[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,$a[1]=P-(T+f)+(f-D),C=R+T,f=C-R,$a[2]=R-(C-f)+(T-f),$a[3]=C;let $=Lg(H,tee,4,$a,nee);I=a*u,d=$s*a,A=d-(d-a),y=a-A,d=$s*u,w=d-(d-u),S=u-w,F=y*S-(I-A*w-y*w-A*S),D=l*c,d=$s*l,A=d-(d-l),y=l-A,d=$s*c,w=d-(d-c),S=c-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,$a[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,$a[1]=P-(T+f)+(f-D),C=R+T,f=C-R,$a[2]=R-(C-f)+(T-f),$a[3]=C;let J=Lg($,nee,4,$a,iee);return iee[J-1]}function J0(i,e,t,n,r,s){let o=(e-s)*(t-r),a=(i-r)*(n-s),l=o-a,c=Math.abs(o+a);return Math.abs(l)>=Uwe*c?l:-Vwe(i,e,t,n,r,s,c)}var lst=(7+56*Ei)*Ei,cst=(3+28*Ei)*Ei,ust=(26+288*Ei)*Ei*Ei,hst=ht(4),fst=ht(4),dst=ht(4),pst=ht(4),mst=ht(4),Ast=ht(4),gst=ht(4),vst=ht(4),_st=ht(4),xst=ht(8),yst=ht(8),bst=ht(8),wst=ht(4),Sst=ht(8),Tst=ht(8),Est=ht(16),Mst=ht(12),Cst=ht(192),Rst=ht(192);var Lst=(10+96*Ei)*Ei,Dst=(4+48*Ei)*Ei,Nst=(44+576*Ei)*Ei*Ei,Fst=ht(4),Bst=ht(4),Ost=ht(4),Ust=ht(4),kst=ht(4),zst=ht(4),Vst=ht(4),Gst=ht(4),qst=ht(8),Hst=ht(8),Wst=ht(8),jst=ht(8),Xst=ht(8),$st=ht(8),Yst=ht(8),Zst=ht(8),Kst=ht(8),Qst=ht(4),Jst=ht(4),eot=ht(4),tot=ht(8),not=ht(16),iot=ht(16),rot=ht(16),sot=ht(32),oot=ht(32),aot=ht(48),lot=ht(64),cot=ht(1152),uot=ht(1152);var pot=(16+224*Ei)*Ei,mot=(5+72*Ei)*Ei,Aot=(71+1408*Ei)*Ei*Ei,got=ht(4),vot=ht(4),_ot=ht(4),xot=ht(4),yot=ht(4),bot=ht(4),wot=ht(4),Sot=ht(4),Tot=ht(4),Eot=ht(4),Mot=ht(24),Cot=ht(24),Rot=ht(24),Iot=ht(24),Pot=ht(24),Lot=ht(24),Dot=ht(24),Not=ht(24),Fot=ht(24),Bot=ht(24),Oot=ht(1152),Uot=ht(1152),kot=ht(1152),zot=ht(1152),Vot=ht(1152),Got=ht(2304),qot=ht(2304),Hot=ht(3456),Wot=ht(5760),jot=ht(8),Xot=ht(8),$ot=ht(8),Yot=ht(16),Zot=ht(24),Kot=ht(48),Qot=ht(48),Jot=ht(96),eat=ht(192),tat=ht(384),nat=ht(384),iat=ht(384),rat=ht(768);var sat=ht(96),oat=ht(96),aat=ht(96),lat=ht(1152);var see=Math.pow(2,-52),sR=new Uint32Array(512),em=class i{static from(e,t=Xwe,n=$we){let r=e.length,s=new Float64Array(r*2);for(let o=0;o<r;o++){let a=e[o];s[2*o]=t(a),s[2*o+1]=n(a)}return new i(s)}constructor(e){let t=e.length>>1;if(t>0&&typeof e[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=e;let n=Math.max(2*t-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.trianglesLen=0,this._cx=0,this._cy=0,this._hullStart=0,this.hull=this._triangles,this.triangles=this._triangles,this.halfedges=this._halfedges,this.update()}update(){let{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:s}=this,o=e.length>>1,a=1/0,l=1/0,c=-1/0,u=-1/0;for(let B=0;B<o;B++){let k=e[2*B],z=e[2*B+1];k<a&&(a=k),z<l&&(l=z),k>c&&(c=k),z>u&&(u=z),this._ids[B]=B}let f=(a+c)/2,d=(l+u)/2,A=0,y=0,w=0;for(let B=0,k=1/0;B<o;B++){let z=vO(f,d,e[2*B],e[2*B+1]);z<k&&(A=B,k=z)}let S=e[2*A],T=e[2*A+1];for(let B=0,k=1/0;B<o;B++){if(B===A)continue;let z=vO(S,T,e[2*B],e[2*B+1]);z<k&&z>0&&(y=B,k=z)}let R=e[2*y],P=e[2*y+1],I=1/0;for(let B=0;B<o;B++){if(B===A||B===y)continue;let k=Wwe(S,T,R,P,e[2*B],e[2*B+1]);k<I&&(w=B,I=k)}let F=e[2*w],D=e[2*w+1];if(I===1/0){for(let z=0;z<o;z++)this._dists[z]=e[2*z]-e[0]||e[2*z+1]-e[1];O_(this._ids,this._dists,0,o-1);let B=new Uint32Array(o),k=0;for(let z=0,G=-1/0;z<o;z++){let W=this._ids[z],Y=this._dists[W];Y>G&&(B[k++]=W,G=Y)}this.hull=B.subarray(0,k),this.triangles=new Uint32Array(0),this.halfedges=new Int32Array(0);return}if(J0(S,T,R,P,F,D)<0){let B=y,k=R,z=P;y=w,R=F,P=D,w=B,F=k,D=z}let L=jwe(S,T,R,P,F,D);this._cx=L.x,this._cy=L.y;for(let B=0;B<o;B++)this._dists[B]=vO(e[2*B],e[2*B+1],L.x,L.y);O_(this._ids,this._dists,0,o-1),this._hullStart=A;let C=3;n[A]=t[w]=y,n[y]=t[A]=w,n[w]=t[y]=A,r[A]=0,r[y]=1,r[w]=2,s.fill(-1),s[this._hashKey(S,T)]=A,s[this._hashKey(R,P)]=y,s[this._hashKey(F,D)]=w,this.trianglesLen=0,this._addTriangle(A,y,w,-1,-1,-1);for(let B=0,k=0,z=0;B<this._ids.length;B++){let G=this._ids[B],W=e[2*G],Y=e[2*G+1];if(B>0&&Math.abs(W-k)<=see&&Math.abs(Y-z)<=see||(k=W,z=Y,G===A||G===y||G===w))continue;let H=0;for(let he=0,ve=this._hashKey(W,Y);he<this._hashSize&&(H=s[(ve+he)%this._hashSize],!(H!==-1&&H!==n[H]));he++);H=t[H];let $=H,J;for(;J=n[$],J0(W,Y,e[2*$],e[2*$+1],e[2*J],e[2*J+1])>=0;)if($=J,$===H){$=-1;break}if($===-1)continue;let te=this._addTriangle($,G,n[$],-1,-1,r[$]);r[G]=this._legalize(te+2),r[$]=te,C++;let ce=n[$];for(;J=n[ce],J0(W,Y,e[2*ce],e[2*ce+1],e[2*J],e[2*J+1])<0;)te=this._addTriangle(ce,G,J,r[G],-1,r[ce]),r[G]=this._legalize(te+2),n[ce]=ce,C--,ce=J;if($===H)for(;J=t[$],J0(W,Y,e[2*J],e[2*J+1],e[2*$],e[2*$+1])<0;)te=this._addTriangle(J,G,$,-1,r[$],r[J]),this._legalize(te+2),r[J]=te,n[$]=$,C--,$=J;this._hullStart=t[G]=$,n[$]=t[ce]=G,n[G]=ce,s[this._hashKey(W,Y)]=G,s[this._hashKey(e[2*$],e[2*$+1])]=$}this.hull=new Uint32Array(C);for(let B=0,k=this._hullStart;B<C;B++)this.hull[B]=k,k=n[k];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(qwe(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){let{_triangles:t,_halfedges:n,coords:r}=this,s=0,o=0;for(;;){let a=n[e],l=e-e%3;if(o=l+(e+2)%3,a===-1){if(s===0)break;e=sR[--s];continue}let c=a-a%3,u=l+(e+1)%3,f=c+(a+2)%3,d=t[o],A=t[e],y=t[u],w=t[f];if(Hwe(r[2*d],r[2*d+1],r[2*A],r[2*A+1],r[2*y],r[2*y+1],r[2*w],r[2*w+1])){t[e]=w,t[a]=d;let T=n[f];if(T===-1){let P=this._hullStart;do{if(this._hullTri[P]===f){this._hullTri[P]=e;break}P=this._hullPrev[P]}while(P!==this._hullStart)}this._link(e,T),this._link(a,n[o]),this._link(o,f);let R=c+(a+1)%3;s<sR.length&&(sR[s++]=R)}else{if(s===0)break;e=sR[--s]}}return o}_link(e,t){this._halfedges[e]=t,t!==-1&&(this._halfedges[t]=e)}_addTriangle(e,t,n,r,s,o){let a=this.trianglesLen;return this._triangles[a]=e,this._triangles[a+1]=t,this._triangles[a+2]=n,this._link(a,r),this._link(a+1,s),this._link(a+2,o),this.trianglesLen+=3,a}};function qwe(i,e){let t=i/(Math.abs(i)+Math.abs(e));return(e>0?3-t:1+t)/4}function vO(i,e,t,n){let r=i-t,s=e-n;return r*r+s*s}function Hwe(i,e,t,n,r,s,o,a){let l=i-o,c=e-a,u=t-o,f=n-a,d=r-o,A=s-a,y=l*l+c*c,w=u*u+f*f,S=d*d+A*A;return l*(f*S-w*A)-c*(u*S-w*d)+y*(u*A-f*d)<0}function Wwe(i,e,t,n,r,s){let o=t-i,a=n-e,l=r-i,c=s-e,u=o*o+a*a,f=l*l+c*c,d=.5/(o*c-a*l),A=(c*u-a*f)*d,y=(o*f-l*u)*d;return A*A+y*y}function jwe(i,e,t,n,r,s){let o=t-i,a=n-e,l=r-i,c=s-e,u=o*o+a*a,f=l*l+c*c,d=.5/(o*c-a*l),A=i+(c*u-a*f)*d,y=e+(o*f-l*u)*d;return{x:A,y}}function O_(i,e,t,n){if(n-t<=20)for(let r=t+1;r<=n;r++){let s=i[r],o=e[s],a=r-1;for(;a>=t&&e[i[a]]>o;)i[a+1]=i[a--];i[a+1]=s}else{let r=t+n>>1,s=t+1,o=n;Pw(i,r,s),e[i[t]]>e[i[n]]&&Pw(i,t,n),e[i[s]]>e[i[n]]&&Pw(i,s,n),e[i[t]]>e[i[s]]&&Pw(i,t,s);let a=i[s],l=e[a];for(;;){do s++;while(e[i[s]]<l);do o--;while(e[i[o]]>l);if(o<s)break;Pw(i,s,o)}i[t+1]=i[o],i[o]=a,n-s+1>=o-t?(O_(i,e,s,n),O_(i,e,t,o-1)):(O_(i,e,t,o-1),O_(i,e,s,n))}}function Pw(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function Xwe(i){return i[0]}function $we(i){return i[1]}function oee(i,e){var t,n,r=0,s,o,a,l,c,u,f,d=i[0],A=i[1],y=e.length;for(t=0;t<y;t++){n=0;var w=e[t],S=w.length-1;if(u=w[0],u[0]!==w[S][0]&&u[1]!==w[S][1])throw new Error("First and last coordinates in a ring must be the same");for(o=u[0]-d,a=u[1]-A,n;n<S;n++){if(f=w[n+1],l=f[0]-d,c=f[1]-A,a===0&&c===0){if(l<=0&&o>=0||o<=0&&l>=0)return 0}else if(c>=0&&a<=0||c<=0&&a>=0){if(s=J0(o,l,a,c,0,0),s===0)return 0;(s>0&&c>0&&a<=0||s<0&&c<=0&&a>0)&&r++}u=f,a=c,o=l}}return r%2!==0}function aee(i){if(!i)throw new Error("coord is required");if(!Array.isArray(i)){if(i.type==="Feature"&&i.geometry!==null&&i.geometry.type==="Point")return[...i.geometry.coordinates];if(i.type==="Point")return[...i.coordinates]}if(Array.isArray(i)&&i.length>=2&&!Array.isArray(i[0])&&!Array.isArray(i[1]))return[...i];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function lee(i){return i.type==="Feature"?i.geometry:i}function Ywe(i,e,t={}){if(!i)throw new Error("point is required");if(!e)throw new Error("polygon is required");let n=aee(i),r=lee(e),s=r.type,o=e.bbox,a=r.coordinates;if(o&&Zwe(n,o)===!1)return!1;s==="Polygon"&&(a=[a]);let l=!1;for(var c=0;c<a.length;++c){let u=oee(n,a[c]);if(u===0)return!t.ignoreBoundary;u&&(l=!0)}return l}function Zwe(i,e){return e[0]<=i[0]&&e[1]<=i[1]&&e[2]>=i[0]&&e[3]>=i[1]}var cee=Ywe;var Qc=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){e=+e,t=+t,n=+n;let r=e+n,s=t;if(n<0)throw new Error("negative radius");this._x1===null?this._+=`M${r},${s}`:(Math.abs(this._x1-r)>1e-6||Math.abs(this._y1-s)>1e-6)&&(this._+="L"+r+","+s),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=r},${this._y1=s}`)}rect(e,t,n,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+r}h${-n}Z`}value(){return this._||null}};var tm=class{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}};var Lw=class{constructor(e,[t,n,r,s]=[0,0,960,500]){if(!((r=+r)>=(t=+t))||!((s=+s)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(e.points.length*2),this.vectors=new Float64Array(e.points.length*2),this.xmax=r,this.xmin=t,this.ymax=s,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:e,hull:t,triangles:n},vectors:r}=this,s,o,a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let w=0,S=0,T=n.length,R,P;w<T;w+=3,S+=2){let I=n[w]*2,F=n[w+1]*2,D=n[w+2]*2,L=e[I],C=e[I+1],B=e[F],k=e[F+1],z=e[D],G=e[D+1],W=B-L,Y=k-C,H=z-L,$=G-C,J=(W*$-Y*H)*2;if(Math.abs(J)<1e-9){if(s===void 0){s=o=0;for(let ce of t)s+=e[ce*2],o+=e[ce*2+1];s/=t.length,o/=t.length}let te=1e9*Math.sign((s-L)*$-(o-C)*H);R=(L+z)/2-te*$,P=(C+G)/2+te*H}else{let te=1/J,ce=W*W+Y*Y,he=H*H+$*$;R=L+($*ce-Y*he)*te,P=C+(W*he-H*ce)*te}a[S]=R,a[S+1]=P}let l=t[t.length-1],c,u=l*4,f,d=e[2*l],A,y=e[2*l+1];r.fill(0);for(let w=0;w<t.length;++w)l=t[w],c=u,f=d,A=y,u=l*4,d=e[2*l],y=e[2*l+1],r[c+2]=r[u]=A-y,r[c+3]=r[u+1]=d-f}render(e){let t=e==null?e=new Qc:void 0,{delaunay:{halfedges:n,inedges:r,hull:s},circumcenters:o,vectors:a}=this;if(s.length<=1)return null;for(let u=0,f=n.length;u<f;++u){let d=n[u];if(d<u)continue;let A=Math.floor(u/3)*2,y=Math.floor(d/3)*2,w=o[A],S=o[A+1],T=o[y],R=o[y+1];this._renderSegment(w,S,T,R,e)}let l,c=s[s.length-1];for(let u=0;u<s.length;++u){l=c,c=s[u];let f=Math.floor(r[c]/3)*2,d=o[f],A=o[f+1],y=l*4,w=this._project(d,A,a[y+2],a[y+3]);w&&this._renderSegment(d,A,w[0],w[1],e)}return t&&t.value()}renderBounds(e){let t=e==null?e=new Qc:void 0;return e.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),t&&t.value()}renderCell(e,t){let n=t==null?t=new Qc:void 0,r=this._clip(e);if(r===null||!r.length)return;t.moveTo(r[0],r[1]);let s=r.length;for(;r[0]===r[s-2]&&r[1]===r[s-1]&&s>1;)s-=2;for(let o=2;o<s;o+=2)(r[o]!==r[o-2]||r[o+1]!==r[o-1])&&t.lineTo(r[o],r[o+1]);return t.closePath(),n&&n.value()}*cellPolygons(){let{delaunay:{points:e}}=this;for(let t=0,n=e.length/2;t<n;++t){let r=this.cellPolygon(t);r&&(r.index=t,yield r)}}cellPolygon(e){let t=new tm;return this.renderCell(e,t),t.value()}_renderSegment(e,t,n,r,s){let o,a=this._regioncode(e,t),l=this._regioncode(n,r);a===0&&l===0?(s.moveTo(e,t),s.lineTo(n,r)):(o=this._clipSegment(e,t,n,r,a,l))&&(s.moveTo(o[0],o[1]),s.lineTo(o[2],o[3]))}contains(e,t,n){return t=+t,t!==t||(n=+n,n!==n)?!1:this.delaunay._step(e,t,n)===e}*neighbors(e){let t=this._clip(e);if(t)for(let n of this.delaunay.neighbors(e)){let r=this._clip(n);if(r){e:for(let s=0,o=t.length;s<o;s+=2)for(let a=0,l=r.length;a<l;a+=2)if(t[s]===r[a]&&t[s+1]===r[a+1]&&t[(s+2)%o]===r[(a+l-2)%l]&&t[(s+3)%o]===r[(a+l-1)%l]){yield n;break e}}}}_cell(e){let{circumcenters:t,delaunay:{inedges:n,halfedges:r,triangles:s}}=this,o=n[e];if(o===-1)return null;let a=[],l=o;do{let c=Math.floor(l/3);if(a.push(t[c*2],t[c*2+1]),l=l%3===2?l-2:l+1,s[l]!==e)break;l=r[l]}while(l!==o&&l!==-1);return a}_clip(e){if(e===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let t=this._cell(e);if(t===null)return null;let{vectors:n}=this,r=e*4;return this._simplify(n[r]||n[r+1]?this._clipInfinite(e,t,n[r],n[r+1],n[r+2],n[r+3]):this._clipFinite(e,t))}_clipFinite(e,t){let n=t.length,r=null,s,o,a=t[n-2],l=t[n-1],c,u=this._regioncode(a,l),f,d=0;for(let A=0;A<n;A+=2)if(s=a,o=l,a=t[A],l=t[A+1],c=u,u=this._regioncode(a,l),c===0&&u===0)f=d,d=0,r?r.push(a,l):r=[a,l];else{let y,w,S,T,R;if(c===0){if((y=this._clipSegment(s,o,a,l,c,u))===null)continue;[w,S,T,R]=y}else{if((y=this._clipSegment(a,l,s,o,u,c))===null)continue;[T,R,w,S]=y,f=d,d=this._edgecode(w,S),f&&d&&this._edge(e,f,d,r,r.length),r?r.push(w,S):r=[w,S]}f=d,d=this._edgecode(T,R),f&&d&&this._edge(e,f,d,r,r.length),r?r.push(T,R):r=[T,R]}if(r)f=d,d=this._edgecode(r[0],r[1]),f&&d&&this._edge(e,f,d,r,r.length);else if(this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return r}_clipSegment(e,t,n,r,s,o){let a=s<o;for(a&&([e,t,n,r,s,o]=[n,r,e,t,o,s]);;){if(s===0&&o===0)return a?[n,r,e,t]:[e,t,n,r];if(s&o)return null;let l,c,u=s||o;u&8?(l=e+(n-e)*(this.ymax-t)/(r-t),c=this.ymax):u&4?(l=e+(n-e)*(this.ymin-t)/(r-t),c=this.ymin):u&2?(c=t+(r-t)*(this.xmax-e)/(n-e),l=this.xmax):(c=t+(r-t)*(this.xmin-e)/(n-e),l=this.xmin),s?(e=l,t=c,s=this._regioncode(e,t)):(n=l,r=c,o=this._regioncode(n,r))}}_clipInfinite(e,t,n,r,s,o){let a=Array.from(t),l;if((l=this._project(a[0],a[1],n,r))&&a.unshift(l[0],l[1]),(l=this._project(a[a.length-2],a[a.length-1],s,o))&&a.push(l[0],l[1]),a=this._clipFinite(e,a))for(let c=0,u=a.length,f,d=this._edgecode(a[u-2],a[u-1]);c<u;c+=2)f=d,d=this._edgecode(a[c],a[c+1]),f&&d&&(c=this._edge(e,f,d,a,c),u=a.length);else this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(e,t,n,r,s){for(;t!==n;){let o,a;switch(t){case 5:t=4;continue;case 4:t=6,o=this.xmax,a=this.ymin;break;case 6:t=2;continue;case 2:t=10,o=this.xmax,a=this.ymax;break;case 10:t=8;continue;case 8:t=9,o=this.xmin,a=this.ymax;break;case 9:t=1;continue;case 1:t=5,o=this.xmin,a=this.ymin;break}(r[s]!==o||r[s+1]!==a)&&this.contains(e,o,a)&&(r.splice(s,0,o,a),s+=2)}return s}_project(e,t,n,r){let s=1/0,o,a,l;if(r<0){if(t<=this.ymin)return null;(o=(this.ymin-t)/r)<s&&(l=this.ymin,a=e+(s=o)*n)}else if(r>0){if(t>=this.ymax)return null;(o=(this.ymax-t)/r)<s&&(l=this.ymax,a=e+(s=o)*n)}if(n>0){if(e>=this.xmax)return null;(o=(this.xmax-e)/n)<s&&(a=this.xmax,l=t+(s=o)*r)}else if(n<0){if(e<=this.xmin)return null;(o=(this.xmin-e)/n)<s&&(a=this.xmin,l=t+(s=o)*r)}return[a,l]}_edgecode(e,t){return(e===this.xmin?1:e===this.xmax?2:0)|(t===this.ymin?4:t===this.ymax?8:0)}_regioncode(e,t){return(e<this.xmin?1:e>this.xmax?2:0)|(t<this.ymin?4:t>this.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t<e.length;t+=2){let n=(t+2)%e.length,r=(t+4)%e.length;(e[t]===e[n]&&e[n]===e[r]||e[t+1]===e[n+1]&&e[n+1]===e[r+1])&&(e.splice(n,2),t-=2)}e.length||(e=null)}return e}};var Kwe=2*Math.PI,U_=Math.pow;function Qwe(i){return i[0]}function Jwe(i){return i[1]}function eSe(i){let{triangles:e,coords:t}=i;for(let n=0;n<e.length;n+=3){let r=2*e[n],s=2*e[n+1],o=2*e[n+2];if((t[o]-t[r])*(t[s+1]-t[r+1])-(t[s]-t[r])*(t[o+1]-t[r+1])>1e-10)return!1}return!0}function tSe(i,e,t){return[i+Math.sin(i+e)*t,e+Math.cos(i-e)*t]}var k_=class i{static from(e,t=Qwe,n=Jwe,r){return new i("length"in e?nSe(e,t,n,r):Float64Array.from(iSe(e,t,n,r)))}constructor(e){this._delaunator=new em(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&eSe(e)){this.collinear=Int32Array.from({length:t.length/2},(d,A)=>A).sort((d,A)=>t[2*d]-t[2*A]||t[2*d+1]-t[2*A+1]);let l=this.collinear[0],c=this.collinear[this.collinear.length-1],u=[t[2*l],t[2*l+1],t[2*c],t[2*c+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let d=0,A=t.length/2;d<A;++d){let y=tSe(t[2*d],t[2*d+1],f);t[2*d]=y[0],t[2*d+1]=y[1]}this._delaunator=new em(t)}else delete this.collinear;let n=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,s=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let l=0,c=n.length;l<c;++l){let u=s[l%3===2?l-2:l+1];(n[l]===-1||o[u]===-1)&&(o[u]=l)}for(let l=0,c=r.length;l<c;++l)a[r[l]]=l;r.length<=2&&r.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],o[r[0]]=1,r.length===2&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(e){return new Lw(this,e)}*neighbors(e){let{inedges:t,hull:n,_hullIndex:r,halfedges:s,triangles:o,collinear:a}=this;if(a){let f=a.indexOf(e);f>0&&(yield a[f-1]),f<a.length-1&&(yield a[f+1]);return}let l=t[e];if(l===-1)return;let c=l,u=-1;do{if(yield u=o[c],c=c%3===2?c-2:c+1,o[c]!==e)return;if(c=s[c],c===-1){let f=n[(r[e]+1)%n.length];f!==u&&(yield f);return}}while(c!==l)}find(e,t,n=0){if(e=+e,e!==e||(t=+t,t!==t))return-1;let r=n,s;for(;(s=this._step(n,e,t))>=0&&s!==n&&s!==r;)n=s;return s}_step(e,t,n){let{inedges:r,hull:s,_hullIndex:o,halfedges:a,triangles:l,points:c}=this;if(r[e]===-1||!c.length)return(e+1)%(c.length>>1);let u=e,f=U_(t-c[e*2],2)+U_(n-c[e*2+1],2),d=r[e],A=d;do{let y=l[A],w=U_(t-c[y*2],2)+U_(n-c[y*2+1],2);if(w<f&&(f=w,u=y),A=A%3===2?A-2:A+1,l[A]!==e)break;if(A=a[A],A===-1){if(A=s[(o[e]+1)%s.length],A!==y&&U_(t-c[A*2],2)+U_(n-c[A*2+1],2)<f)return A;break}}while(A!==d);return u}render(e){let t=e==null?e=new Qc:void 0,{points:n,halfedges:r,triangles:s}=this;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l<o)continue;let c=s[o]*2,u=s[l]*2;e.moveTo(n[c],n[c+1]),e.lineTo(n[u],n[u+1])}return this.renderHull(e),t&&t.value()}renderPoints(e,t){t===void 0&&(!e||typeof e.moveTo!="function")&&(t=e,e=null),t=t==null?2:+t;let n=e==null?e=new Qc:void 0,{points:r}=this;for(let s=0,o=r.length;s<o;s+=2){let a=r[s],l=r[s+1];e.moveTo(a+t,l),e.arc(a,l,t,0,Kwe)}return n&&n.value()}renderHull(e){let t=e==null?e=new Qc:void 0,{hull:n,points:r}=this,s=n[0]*2,o=n.length;e.moveTo(r[s],r[s+1]);for(let a=1;a<o;++a){let l=2*n[a];e.lineTo(r[l],r[l+1])}return e.closePath(),t&&t.value()}hullPolygon(){let e=new tm;return this.renderHull(e),e.value()}renderTriangle(e,t){let n=t==null?t=new Qc:void 0,{points:r,triangles:s}=this,o=s[e*=3]*2,a=s[e+1]*2,l=s[e+2]*2;return t.moveTo(r[o],r[o+1]),t.lineTo(r[a],r[a+1]),t.lineTo(r[l],r[l+1]),t.closePath(),n&&n.value()}*trianglePolygons(){let{triangles:e}=this;for(let t=0,n=e.length/3;t<n;++t)yield this.trianglePolygon(t)}trianglePolygon(e){let t=new tm;return this.renderTriangle(e,t),t.value()}};function nSe(i,e,t,n){let r=i.length,s=new Float64Array(r*2);for(let o=0;o<r;++o){let a=i[o];s[o*2]=e.call(n,a,o,i),s[o*2+1]=t.call(n,a,o,i)}return s}function*iSe(i,e,t,n){let r=0;for(let s of i)yield e.call(n,s,r,i),yield t.call(n,s,r,i),++r}var Dw=Math.PI,uee=Dw/2,Gat=Dw/4,qat=Dw*2,_O=180/Dw,xO=Dw/180;var yO=Math.atan2,oR=Math.cos;var hee=Math.max,fee=Math.min;var aR=Math.sin,dee=Math.sign||function(i){return i>0?1:i<0?-1:0},lR=Math.sqrt;function bO(i){return i>1?uee:i<-1?-uee:Math.asin(i)}function wO(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Rl(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function Nw(i,e){return[i[0]+e[0],i[1]+e[1],i[2]+e[2]]}function Fw(i){var e=lR(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);return[i[0]/e,i[1]/e,i[2]/e]}function SO(i){return[yO(i[1],i[0])*_O,bO(hee(-1,fee(1,i[2])))*_O]}function af(i){let e=i[0]*xO,t=i[1]*xO,n=oR(t);return[n*oR(e),n*aR(e),aR(t)]}function cR(i){return i=i.map(e=>af(e)),wO(i[0],Rl(i[2],i[1]))}function mee(i){let e=sSe(i),t=aSe(e),n=oSe(t,i),r=cSe(t,i.length),s=rSe(r,i),o=lSe(t,i),{polygons:a,centers:l}=uSe(o,t,i),c=hSe(a),u=dSe(t,i),f=fSe(n,t);return{delaunay:e,edges:n,triangles:t,centers:l,neighbors:r,polygons:a,mesh:c,hull:u,urquhart:f,find:s}}function rSe(i,e){function t(n,r){let s=n[0]-r[0],o=n[1]-r[1],a=n[2]-r[2];return s*s+o*o+a*a}return function(r,s,o){o===void 0&&(o=0);let a,l,c=o,u=af([r,s]);do a=o,o=null,l=t(u,af(e[a])),i[a].forEach(f=>{let d=t(u,af(e[f]));if(d<l){l=d,o=f,c=f;return}});while(o!==null);return c}}function sSe(i){if(i.length<2)return{};let e=0;for(;isNaN(i[e][0]+i[e][1])&&e++<i.length;);let t=EB(i[e]),n=HB().translate([0,0]).scale(1).rotate(t.invert([180,0]));i=i.map(n);let r=[],s=1;for(let d=0,A=i.length;d<A;d++){let y=i[d][0]**2+i[d][1]**2;!isFinite(y)||y>1e32?r.push(d):y>s&&(s=y)}let o=1e6*lR(s);r.forEach(d=>i[d]=[o,0]),i.push([0,o]),i.push([-o,0]),i.push([0,-o]);let a=k_.from(i);a.projection=n;let{triangles:l,halfedges:c,inedges:u}=a,f=[];for(let d=0,A=c.length;d<A;d++)if(c[d]<0){let y=d%3==2?d-2:d+1,w=d%3==0?d+2:d-1,S=c[y],T=c[w];c[S]=T,c[T]=S,c[y]=c[w]=-1,l[d]=l[y]=l[w]=e,u[l[S]]=S%3==0?S+2:S-1,u[l[T]]=T%3==0?T+2:T-1,f.push(Math.min(d,y,w)),d+=2-d%3}else l[d]>i.length-3-1&&(l[d]=e);return a}function oSe(i,e){let t=new Set;return e.length===2?[[0,1]]:(i.forEach(n=>{if(n[0]!==n[1]&&!(cR(n.map(r=>e[r]))<0))for(let r=0,s;r<3;r++)s=(r+1)%3,t.add(j0([n[r],n[s]]).join("-"))}),Array.from(t,n=>n.split("-").map(Number)))}function aSe(i){let{triangles:e}=i;if(!e)return[];let t=[];for(let n=0,r=e.length/3;n<r;n++){let s=e[3*n],o=e[3*n+1],a=e[3*n+2];s!==o&&o!==a&&t.push([s,a,o])}return t}function lSe(i,e){return i.map(t=>{let n=t.map(s=>e[s]).map(af),r=Nw(Nw(Rl(n[1],n[0]),Rl(n[2],n[1])),Rl(n[0],n[2]));return SO(Fw(r))})}function cSe(i,e){let t=[];return i.forEach(n=>{for(let r=0;r<3;r++){let s=n[r],o=n[(r+1)%3];t[s]=t[s]||[],t[s].push(o)}}),i.length===0&&(e===2?(t[0]=[1],t[1]=[0]):e===1&&(t[0]=[])),t}function uSe(i,e,t){let n=[],r=i.slice();if(e.length===0){if(t.length<2)return{polygons:n,centers:r};if(t.length===2){let a=af(t[0]),l=af(t[1]),c=Fw(Nw(a,l)),u=Fw(Rl(a,l)),f=Rl(c,u),d=[c,Rl(c,f),Rl(Rl(c,f),f),Rl(Rl(Rl(c,f),f),f)].map(SO).map(o);return n.push(d),n.push(d.slice().reverse()),{polygons:n,centers:r}}}e.forEach((a,l)=>{for(let c=0;c<3;c++){let u=a[c],f=a[(c+1)%3],d=a[(c+2)%3];n[u]=n[u]||[],n[u].push([f,d,l,[u,f,d]])}});let s=n.map(a=>{let l=[a[0][2]],c=a[0][1];for(let u=1;u<a.length;u++)for(let f=0;f<a.length;f++)if(a[f][0]==c){c=a[f][1],l.push(a[f][2]);break}if(l.length>2)return l;if(l.length==2){let u=pee(t[a[0][3][0]],t[a[0][3][1]],r[l[0]]),f=pee(t[a[0][3][2]],t[a[0][3][0]],r[l[0]]),d=o(u),A=o(f);return[l[0],A,l[1],d]}});function o(a){let l=-1;return r.slice(e.length,1/0).forEach((c,u)=>{c[0]===a[0]&&c[1]===a[1]&&(l=u+e.length)}),l<0&&(l=r.length,r.push(a)),l}return{polygons:s,centers:r}}function pee(i,e,t){i=af(i),e=af(e),t=af(t);let n=dee(wO(Rl(e,i),t));return SO(Fw(Nw(i,e)).map(r=>n*r))}function hSe(i){let e=[];return i.forEach(t=>{if(!t)return;let n=t[t.length-1];for(let r of t)r>n&&e.push([n,r]),n=r}),e}function fSe(i,e){return function(t){let n=new Map,r=new Map;return i.forEach((s,o)=>{let a=s.join("-");n.set(a,t[o]),r.set(a,!0)}),e.forEach(s=>{let o=0,a=-1;for(let l=0;l<3;l++){let c=j0([s[l],s[(l+1)%3]]).join("-");n.get(c)>o&&(o=n.get(c),a=c)}r.set(a,!1)}),i.map(s=>r.get(s.join("-")))}}function dSe(i,e){let t=new Set,n=[];i.map(a=>{if(!(cR(a.map(l=>e[l>e.length?0:l]))>1e-12))for(let l=0;l<3;l++){let c=[a[l],a[(l+1)%3]],u=`${c[0]}-${c[1]}`;t.has(u)?t.delete(u):t.add(`${c[1]}-${c[0]}`)}});let r=new Map,s;if(t.forEach(a=>{a=a.split("-").map(Number),r.set(a[0],a[1]),s=a[0]}),s===void 0)return n;let o=s;do{n.push(o);let a=r.get(o);r.set(o,-1),o=a}while(o>-1&&o!==s);return n}function TO(i){let e=function(t){if(e.delaunay=null,e._data=t,typeof e._data=="object"&&e._data.type==="FeatureCollection"&&(e._data=e._data.features),typeof e._data=="object"){let n=e._data.map(r=>[e._vx(r),e._vy(r),r]).filter(r=>isFinite(r[0]+r[1]));e.points=n.map(r=>[r[0],r[1]]),e.valid=n.map(r=>r[2]),e.delaunay=mee(e.points)}return e};return e._vx=function(t){if(typeof t=="object"&&"type"in t)return DC(t)[0];if(0 in t)return t[0]},e._vy=function(t){if(typeof t=="object"&&"type"in t)return DC(t)[1];if(1 in t)return t[1]},e.x=function(t){return t?(e._vx=t,e):e._vx},e.y=function(t){return t?(e._vy=t,e):e._vy},e.polygons=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let n={type:"FeatureCollection",features:[]};return e.valid.length===0||(e.delaunay.polygons.forEach((r,s)=>n.features.push({type:"Feature",geometry:r?{type:"Polygon",coordinates:[[...r,r[0]].map(o=>e.delaunay.centers[o])]}:null,properties:{site:e.valid[s],sitecoordinates:e.points[s],neighbours:e.delaunay.neighbors[s]}})),e.valid.length===1&&n.features.push({type:"Feature",geometry:{type:"Sphere"},properties:{site:e.valid[0],sitecoordinates:e.points[0],neighbours:[]}})),n},e.triangles=function(t){return t!==void 0&&e(t),e.delaunay?{type:"FeatureCollection",features:e.delaunay.triangles.map((n,r)=>(n=n.map(s=>e.points[s]),n.center=e.delaunay.centers[r],n)).filter(n=>cR(n)>0).map(n=>({type:"Feature",properties:{circumcenter:n.center},geometry:{type:"Polygon",coordinates:[[...n,n[0]]]}}))}:!1},e.links=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let n=e.delaunay.edges.map(s=>Cl(e.points[s[0]],e.points[s[1]])),r=e.delaunay.urquhart(n);return{type:"FeatureCollection",features:e.delaunay.edges.map((s,o)=>({type:"Feature",properties:{source:e.valid[s[0]],target:e.valid[s[1]],length:n[o],urquhart:!!r[o]},geometry:{type:"LineString",coordinates:[e.points[s[0]],e.points[s[1]]]}}))}},e.mesh=function(t){return t!==void 0&&e(t),e.delaunay?{type:"MultiLineString",coordinates:e.delaunay.edges.map(n=>[e.points[n[0]],e.points[n[1]]])}:!1},e.cellMesh=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let{centers:n,polygons:r}=e.delaunay,s=[];for(let o of r)if(o)for(let a=o.length,l=o[a-1],c=o[0],u=0;u<a;l=c,c=o[++u])c>l&&s.push([n[l],n[c]]);return{type:"MultiLineString",coordinates:s}},e._found=void 0,e.find=function(t,n,r){if(e._found=e.delaunay.find(t,n,e._found),!r||Cl([t,n],e.points[e._found])<r)return e._found},e.hull=function(t){t!==void 0&&e(t);let n=e.delaunay.hull,r=e.points;return n.length===0?null:{type:"Polygon",coordinates:[[...n.map(s=>r[s]),r[n[0]]]]}},i?e(i):e}function MO(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function pSe(i){if(Array.isArray(i))return i}function mSe(i){if(Array.isArray(i))return MO(i)}function ASe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function gSe(i,e,t){return e=hR(e),TSe(i,gee()?Reflect.construct(e,[],hR(i).constructor):e.apply(i,t))}function vSe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function _Se(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function hR(i){return hR=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},hR(i)}function xSe(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&CO(i,e)}function gee(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(gee=function(){return!!i})()}function ySe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function bSe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function wSe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4126-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SSe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4127-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function TSe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ASe(i)}function CO(i,e){return CO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},CO(i,e)}function lf(i,e){return pSe(i)||bSe(i,e)||vee(i,e)||wSe()}function EO(i){return mSe(i)||ySe(i)||vee(i)||SSe()}function vee(i,e){if(i){if(typeof i=="string")return MO(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?MO(i,e):void 0}}function ESe(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=MSe(i,n),s=ef(r),o=CSe(i,n),a=[].concat(EO(s),EO(o)),l={type:"Polygon",coordinates:i},c=TC(l),u=lf(c,2),f=lf(u[0],2),d=f[0],A=f[1],y=lf(u[1],2),w=y[0],S=y[1],T=d>w||S>=89||A<=-89,R=[];if(T){var P=TO(a).triangles(),I=new Map(a.map(function(J,te){var ce=lf(J,2),he=ce[0],ve=ce[1];return["".concat(he,"-").concat(ve),te]}));P.features.forEach(function(J){var te,ce=J.geometry.coordinates[0].slice(0,3).reverse(),he=[];if(ce.forEach(function(Re){var Qe=lf(Re,2),Fe=Qe[0],mt=Qe[1],Ee="".concat(Fe,"-").concat(mt);I.has(Ee)&&he.push(I.get(Ee))}),he.length===3){if(he.some(function(Re){return Re<s.length})){var ve=J.properties.circumcenter;if(!RO(ve,l,T))return}(te=R).push.apply(te,he)}})}else if(o.length)for(var B=em.from(a),k=function(te){var ce,he=[2,1,0].map(function(Qe){return B.triangles[te+Qe]}),ve=he.map(function(Qe){return a[Qe]});if(he.some(function(Qe){return Qe<s.length})){var Re=[0,1].map(function(Qe){return aC(ve,function(Fe){return Fe[Qe]})});if(!RO(Re,l,T))return 1}(ce=R).push.apply(ce,EO(he))},z=0,G=B.triangles.length;z<G;z+=3)k(z);else{var F=L_(r),D=F.vertices,L=F.holes,C=L===void 0?[]:L;R=rO(D,C,2)}var W=El(j0(a,function(J){return J[0]}),[0,1]),Y=El(j0(a,function(J){return J[1]}),[0,1]),H=a.map(function(J){var te=lf(J,2),ce=te[0],he=te[1];return[W(ce),Y(he)]}),$={points:a,indices:R,uvs:H};return{contour:r,triangles:$}}function MSe(i,e){return i.map(function(t){var n=[],r;return t.forEach(function(s){if(r){var o=Cl(s,r)*180/Math.PI;if(o>e)for(var a=Mg(r,s),l=1/Math.ceil(o/e),c=l;c<1;)n.push(a(c)),c+=l}n.push(r=s)}),n})}function CSe(i,e){var t={type:"Polygon",coordinates:i},n=TC(t),r=lf(n,2),s=lf(r[0],2),o=s[0],a=s[1],l=lf(r[1],2),c=l[0],u=l[1];if(Math.min(Math.abs(c-o),Math.abs(u-a))<e)return[];var f=o>c||u>=89||a<=-89;return RSe(e,{minLng:o,maxLng:c,minLat:a,maxLat:u}).filter(function(d){return RO(d,t,f)})}function RSe(i){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.minLng,n=e.maxLng,r=e.minLat,s=e.maxLat,o=Math.round(Math.pow(360/i,2)/Math.PI),a=(1+Math.sqrt(5))/2,l=function(T){return T/a*360%360-180},c=function(T){return Math.acos(2*T/o-1)/Math.PI*180-90},u=function(T){return o*(Math.cos((T+90)*Math.PI/180)+1)/2},f=[s!==void 0?Math.ceil(u(s)):0,r!==void 0?Math.floor(u(r)):o-1],d=t===void 0&&n===void 0?function(){return!0}:t===void 0?function(S){return S<=n}:n===void 0?function(S){return S>=t}:n>=t?function(S){return S>=t&&S<=n}:function(S){return S>=t||S<=n},A=[],y=f[0];y<=f[1];y++){var w=l(y);d(w)&&A.push([w,c(y)])}return A}function RO(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?DB(e,i):cee(i,e)}var uR=window.THREE?window.THREE:{BufferGeometry:Xn,Float32BufferAttribute:Ln},Aee=new uR.BufferGeometry().setAttribute?"setAttribute":"addAttribute",fR=(function(i){function e(t,n,r,s,o,a,l){var c;vSe(this,e),c=gSe(this,e),c.type="ConicPolygonGeometry",c.parameters={polygonGeoJson:t,bottomHeight:n,topHeight:r,closedBottom:s,closedTop:o,includeSides:a,curvatureResolution:l},n=n||0,r=r||1,s=s!==void 0?s:!0,o=o!==void 0?o:!0,a=a!==void 0?a:!0,l=l||5;var u=ESe(t,{resolution:l}),f=u.contour,d=u.triangles,A=ef(d.uvs),y=[],w=[],S=[],T=0,R=function(L){var C=Math.round(y.length/3),B=S.length;y=y.concat(L.vertices),w=w.concat(L.uvs),S=S.concat(C?L.indices.map(function(k){return k+C}):L.indices),c.addGroup(B,S.length-B,T++)};a&&R(I()),s&&R(F(n,!1)),o&&R(F(r,!0)),c.setIndex(S),c[Aee]("position",new uR.Float32BufferAttribute(y,3)),c[Aee]("uv",new uR.Float32BufferAttribute(w,2)),c.computeVertexNormals();function P(D,L){var C=typeof L=="function"?L:function(){return L},B=D.map(function(k){return k.map(function(z){var G=lf(z,2),W=G[0],Y=G[1];return ISe(Y,W,C(W,Y))})});return L_(B)}function I(){for(var D=P(f,n),L=D.vertices,C=D.holes,B=P(f,r),k=B.vertices,z=ef([k,L]),G=Math.round(k.length/3),W=new Set(C),Y=0,H=[],$=0;$<G;$++){var J=$+1;if(J===G)J=Y;else if(W.has(J)){var te=J;J=Y,Y=te}H.push($,$+G,J+G),H.push(J+G,J,$)}for(var ce=[],he=1;he>=0;he--)for(var ve=0;ve<G;ve+=1)ce.push(ve/(G-1),he);return{indices:H,vertices:z,uvs:ce}}function F(D){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return{indices:L?d.indices:d.indices.slice().reverse(),vertices:P([d.points],D).vertices,uvs:A}}return c}return xSe(e,i),_Se(e)})(uR.BufferGeometry);function ISe(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}function IO(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function PSe(i){if(Array.isArray(i))return i}function LSe(i){if(Array.isArray(i))return IO(i)}function DSe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function NSe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function FSe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4128-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BSe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4129-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function OSe(i,e){if(i==null)return{};var t,n,r=USe(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.includes(t)||{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function USe(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.includes(n))continue;t[n]=i[n]}return t}function kSe(i,e){return PSe(i)||NSe(i,e)||_ee(i,e)||FSe()}function zSe(i){return LSe(i)||DSe(i)||_ee(i)||BSe()}function VSe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function GSe(i){var e=VSe(i,"string");return typeof e=="symbol"?e:e+""}function _ee(i,e){if(i){if(typeof i=="string")return IO(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?IO(i,e):void 0}}var xee=(function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=(e instanceof Array?e.length?e:[void 0]:[e]).map(function(a){return{keyAccessor:a,isProp:!(a instanceof Function)}}),s=i.reduce(function(a,l){var c=a,u=l;return r.forEach(function(f,d){var A=f.keyAccessor,y=f.isProp,w;if(y){var S=u,T=S[A],R=OSe(S,[A].map(GSe));w=T,u=R}else w=A(u,d);d+1<r.length?(c.hasOwnProperty(w)||(c[w]={}),c=c[w]):t?(c.hasOwnProperty(w)||(c[w]=[]),c[w].push(u)):c[w]=u}),a},{});t instanceof Function&&(function a(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;c===r.length?Object.keys(l).forEach(function(u){return l[u]=t(l[u])}):Object.values(l).forEach(function(u){return a(u,c+1)})})(s);var o=s;return n&&(o=[],(function a(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];c.length===r.length?o.push({keys:c,vals:l}):Object.entries(l).forEach(function(u){var f=kSe(u,2),d=f[0],A=f[1];return a(A,[].concat(zSe(c),[d]))})})(s),e instanceof Array&&e.length===0&&o.length===1&&(o[0].keys=[])),o});var Ai=(function(i){i=i||{};var e=typeof i<"u"?i:{},t={},n;for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);var r=[],s="";function o(Le){return e.locateFile?e.locateFile(Le,s):s+Le}var a;typeof document<"u"&&document.currentScript&&(s=document.currentScript.src),s.indexOf("blob:")!==0?s=s.substr(0,s.lastIndexOf("/")+1):s="",a=function(it,Dt,He){var h=new XMLHttpRequest;h.open("GET",it,!0),h.responseType="arraybuffer",h.onload=function(){if(h.status==200||h.status==0&&h.response){Dt(h.response);return}var Ii=St(it);if(Ii){Dt(Ii.buffer);return}He()},h.onerror=He,h.send(null)};var l=e.print||console.log.bind(console),c=e.printErr||console.warn.bind(console);for(n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);t=null,e.arguments&&(r=e.arguments);var u=0,f=function(Le){u=Le},d=function(){return u},A=8;function y(Le,it,Dt,He){switch(Dt=Dt||"i8",Dt.charAt(Dt.length-1)==="*"&&(Dt="i32"),Dt){case"i1":Y[Le>>0]=it;break;case"i8":Y[Le>>0]=it;break;case"i16":$[Le>>1]=it;break;case"i32":te[Le>>2]=it;break;case"i64":Ge=[it>>>0,(Pe=it,+bt(Pe)>=1?Pe>0?(en(+hn(Pe/4294967296),4294967295)|0)>>>0:~~+yt((Pe-+(~~Pe>>>0))/4294967296)>>>0:0)],te[Le>>2]=Ge[0],te[Le+4>>2]=Ge[1];break;case"float":he[Le>>2]=it;break;case"double":ve[Le>>3]=it;break;default:km("invalid type for setValue: "+Dt)}}function w(Le,it,Dt){switch(it=it||"i8",it.charAt(it.length-1)==="*"&&(it="i32"),it){case"i1":return Y[Le>>0];case"i8":return Y[Le>>0];case"i16":return $[Le>>1];case"i32":return te[Le>>2];case"i64":return te[Le>>2];case"float":return he[Le>>2];case"double":return ve[Le>>3];default:km("invalid type for getValue: "+it)}return null}var S=!1;function T(Le,it){Le||km("Assertion failed: "+it)}function R(Le){var it=e["_"+Le];return T(it,"Cannot call unknown function "+Le+", make sure it is exported"),it}function P(Le,it,Dt,He,h){var sr={string:function(ii){var zi=0;if(ii!=null&&ii!==0){var oT=(ii.length<<2)+1;zi=WG(oT),B(ii,zi,oT)}return zi},array:function(ii){var zi=WG(ii.length);return z(ii,zi),zi}};function Ii(ii){return it==="string"?L(ii):it==="boolean"?!!ii:ii}var ie=R(Le),or=[],ol=0;if(He)for(var fo=0;fo<He.length;fo++){var Qs=sr[Dt[fo]];Qs?(ol===0&&(ol=bce()),or[fo]=Qs(He[fo])):or[fo]=He[fo]}var ws=ie.apply(null,or);return ws=Ii(ws),ol!==0&&yce(ol),ws}function I(Le,it,Dt,He){Dt=Dt||[];var h=Dt.every(function(Ii){return Ii==="number"}),sr=it!=="string";return sr&&h&&!He?R(Le):function(){return P(Le,it,Dt,arguments,He)}}var F=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function D(Le,it,Dt){for(var He=it+Dt,h=it;Le[h]&&!(h>=He);)++h;if(h-it>16&&Le.subarray&&F)return F.decode(Le.subarray(it,h));for(var sr="";it<h;){var Ii=Le[it++];if(!(Ii&128)){sr+=String.fromCharCode(Ii);continue}var ie=Le[it++]&63;if((Ii&224)==192){sr+=String.fromCharCode((Ii&31)<<6|ie);continue}var or=Le[it++]&63;if((Ii&240)==224?Ii=(Ii&15)<<12|ie<<6|or:Ii=(Ii&7)<<18|ie<<12|or<<6|Le[it++]&63,Ii<65536)sr+=String.fromCharCode(Ii);else{var ol=Ii-65536;sr+=String.fromCharCode(55296|ol>>10,56320|ol&1023)}}return sr}function L(Le,it){return Le?D(H,Le,it):""}function C(Le,it,Dt,He){if(!(He>0))return 0;for(var h=Dt,sr=Dt+He-1,Ii=0;Ii<Le.length;++Ii){var ie=Le.charCodeAt(Ii);if(ie>=55296&&ie<=57343){var or=Le.charCodeAt(++Ii);ie=65536+((ie&1023)<<10)|or&1023}if(ie<=127){if(Dt>=sr)break;it[Dt++]=ie}else if(ie<=2047){if(Dt+1>=sr)break;it[Dt++]=192|ie>>6,it[Dt++]=128|ie&63}else if(ie<=65535){if(Dt+2>=sr)break;it[Dt++]=224|ie>>12,it[Dt++]=128|ie>>6&63,it[Dt++]=128|ie&63}else{if(Dt+3>=sr)break;it[Dt++]=240|ie>>18,it[Dt++]=128|ie>>12&63,it[Dt++]=128|ie>>6&63,it[Dt++]=128|ie&63}}return it[Dt]=0,Dt-h}function B(Le,it,Dt){return C(Le,H,it,Dt)}var k=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function z(Le,it){Y.set(Le,it)}function G(Le,it){return Le%it>0&&(Le+=it-Le%it),Le}var W,Y,H,$,J,te,ce,he,ve;function Re(Le){W=Le,e.HEAP8=Y=new Int8Array(Le),e.HEAP16=$=new Int16Array(Le),e.HEAP32=te=new Int32Array(Le),e.HEAPU8=H=new Uint8Array(Le),e.HEAPU16=J=new Uint16Array(Le),e.HEAPU32=ce=new Uint32Array(Le),e.HEAPF32=he=new Float32Array(Le),e.HEAPF64=ve=new Float64Array(Le)}var Qe=5271296,Fe=28384,mt=e.TOTAL_MEMORY||33554432;e.buffer?W=e.buffer:W=new ArrayBuffer(mt),mt=W.byteLength,Re(W),te[Fe>>2]=Qe;function Ee(Le){for(;Le.length>0;){var it=Le.shift();if(typeof it=="function"){it();continue}var Dt=it.func;typeof Dt=="number"?it.arg===void 0?e.dynCall_v(Dt):e.dynCall_vi(Dt,it.arg):Dt(it.arg===void 0?null:it.arg)}}var Ve=[],Ye=[],Mt=[],Et=[];function It(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)ot(e.preRun.shift());Ee(Ve)}function dn(){Ee(Ye)}function Gt(){Ee(Mt)}function $e(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)nt(e.postRun.shift());Ee(Et)}function ot(Le){Ve.unshift(Le)}function nt(Le){Et.unshift(Le)}var bt=Math.abs,yt=Math.ceil,hn=Math.floor,en=Math.min,tn=0,bn=null,_e=null;function vi(Le){tn++,e.monitorRunDependencies&&e.monitorRunDependencies(tn)}function zn(Le){if(tn--,e.monitorRunDependencies&&e.monitorRunDependencies(tn),tn==0&&(bn!==null&&(clearInterval(bn),bn=null),_e)){var it=_e;_e=null,it()}}e.preloadedImages={},e.preloadedAudios={};var le=null,Z="data:application/octet-stream;base64,";function Te(Le){return String.prototype.startsWith?Le.startsWith(Z):Le.indexOf(Z)===0}var Pe,Ge;le="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAYAAAAAAAAAAwAAAAIAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFAAAABAAAAAAAAAABAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAgAAAAQAAAADAAAACAAAAAEAAAAHAAAABgAAAAkAAAAAAAAAAwAAAAIAAAACAAAABgAAAAoAAAALAAAAAAAAAAEAAAAFAAAAAwAAAA0AAAABAAAABwAAAAQAAAAMAAAAAAAAAAQAAAB/AAAADwAAAAgAAAADAAAAAAAAAAwAAAAFAAAAAgAAABIAAAAKAAAACAAAAAAAAAAQAAAABgAAAA4AAAALAAAAEQAAAAEAAAAJAAAAAgAAAAcAAAAVAAAACQAAABMAAAADAAAADQAAAAEAAAAIAAAABQAAABYAAAAQAAAABAAAAAAAAAAPAAAACQAAABMAAAAOAAAAFAAAAAEAAAAHAAAABgAAAAoAAAALAAAAGAAAABcAAAAFAAAAAgAAABIAAAALAAAAEQAAABcAAAAZAAAAAgAAAAYAAAAKAAAADAAAABwAAAANAAAAGgAAAAQAAAAPAAAAAwAAAA0AAAAaAAAAFQAAAB0AAAADAAAADAAAAAcAAAAOAAAAfwAAABEAAAAbAAAACQAAABQAAAAGAAAADwAAABYAAAAcAAAAHwAAAAQAAAAIAAAADAAAABAAAAASAAAAIQAAAB4AAAAIAAAABQAAABYAAAARAAAACwAAAA4AAAAGAAAAIwAAABkAAAAbAAAAEgAAABgAAAAeAAAAIAAAAAUAAAAKAAAAEAAAABMAAAAiAAAAFAAAACQAAAAHAAAAFQAAAAkAAAAUAAAADgAAABMAAAAJAAAAKAAAABsAAAAkAAAAFQAAACYAAAATAAAAIgAAAA0AAAAdAAAABwAAABYAAAAQAAAAKQAAACEAAAAPAAAACAAAAB8AAAAXAAAAGAAAAAsAAAAKAAAAJwAAACUAAAAZAAAAGAAAAH8AAAAgAAAAJQAAAAoAAAAXAAAAEgAAABkAAAAXAAAAEQAAAAsAAAAtAAAAJwAAACMAAAAaAAAAKgAAAB0AAAArAAAADAAAABwAAAANAAAAGwAAACgAAAAjAAAALgAAAA4AAAAUAAAAEQAAABwAAAAfAAAAKgAAACwAAAAMAAAADwAAABoAAAAdAAAAKwAAACYAAAAvAAAADQAAABoAAAAVAAAAHgAAACAAAAAwAAAAMgAAABAAAAASAAAAIQAAAB8AAAApAAAALAAAADUAAAAPAAAAFgAAABwAAAAgAAAAHgAAABgAAAASAAAANAAAADIAAAAlAAAAIQAAAB4AAAAxAAAAMAAAABYAAAAQAAAAKQAAACIAAAATAAAAJgAAABUAAAA2AAAAJAAAADMAAAAjAAAALgAAAC0AAAA4AAAAEQAAABsAAAAZAAAAJAAAABQAAAAiAAAAEwAAADcAAAAoAAAANgAAACUAAAAnAAAANAAAADkAAAAYAAAAFwAAACAAAAAmAAAAfwAAACIAAAAzAAAAHQAAAC8AAAAVAAAAJwAAACUAAAAZAAAAFwAAADsAAAA5AAAALQAAACgAAAAbAAAAJAAAABQAAAA8AAAALgAAADcAAAApAAAAMQAAADUAAAA9AAAAFgAAACEAAAAfAAAAKgAAADoAAAArAAAAPgAAABwAAAAsAAAAGgAAACsAAAA+AAAALwAAAEAAAAAaAAAAKgAAAB0AAAAsAAAANQAAADoAAABBAAAAHAAAAB8AAAAqAAAALQAAACcAAAAjAAAAGQAAAD8AAAA7AAAAOAAAAC4AAAA8AAAAOAAAAEQAAAAbAAAAKAAAACMAAAAvAAAAJgAAACsAAAAdAAAARQAAADMAAABAAAAAMAAAADEAAAAeAAAAIQAAAEMAAABCAAAAMgAAADEAAAB/AAAAPQAAAEIAAAAhAAAAMAAAACkAAAAyAAAAMAAAACAAAAAeAAAARgAAAEMAAAA0AAAAMwAAAEUAAAA2AAAARwAAACYAAAAvAAAAIgAAADQAAAA5AAAARgAAAEoAAAAgAAAAJQAAADIAAAA1AAAAPQAAAEEAAABLAAAAHwAAACkAAAAsAAAANgAAAEcAAAA3AAAASQAAACIAAAAzAAAAJAAAADcAAAAoAAAANgAAACQAAABIAAAAPAAAAEkAAAA4AAAARAAAAD8AAABNAAAAIwAAAC4AAAAtAAAAOQAAADsAAABKAAAATgAAACUAAAAnAAAANAAAADoAAAB/AAAAPgAAAEwAAAAsAAAAQQAAACoAAAA7AAAAPwAAAE4AAABPAAAAJwAAAC0AAAA5AAAAPAAAAEgAAABEAAAAUAAAACgAAAA3AAAALgAAAD0AAAA1AAAAMQAAACkAAABRAAAASwAAAEIAAAA+AAAAKwAAADoAAAAqAAAAUgAAAEAAAABMAAAAPwAAAH8AAAA4AAAALQAAAE8AAAA7AAAATQAAAEAAAAAvAAAAPgAAACsAAABUAAAARQAAAFIAAABBAAAAOgAAADUAAAAsAAAAVgAAAEwAAABLAAAAQgAAAEMAAABRAAAAVQAAADEAAAAwAAAAPQAAAEMAAABCAAAAMgAAADAAAABXAAAAVQAAAEYAAABEAAAAOAAAADwAAAAuAAAAWgAAAE0AAABQAAAARQAAADMAAABAAAAALwAAAFkAAABHAAAAVAAAAEYAAABDAAAANAAAADIAAABTAAAAVwAAAEoAAABHAAAAWQAAAEkAAABbAAAAMwAAAEUAAAA2AAAASAAAAH8AAABJAAAANwAAAFAAAAA8AAAAWAAAAEkAAABbAAAASAAAAFgAAAA2AAAARwAAADcAAABKAAAATgAAAFMAAABcAAAANAAAADkAAABGAAAASwAAAEEAAAA9AAAANQAAAF4AAABWAAAAUQAAAEwAAABWAAAAUgAAAGAAAAA6AAAAQQAAAD4AAABNAAAAPwAAAEQAAAA4AAAAXQAAAE8AAABaAAAATgAAAEoAAAA7AAAAOQAAAF8AAABcAAAATwAAAE8AAABOAAAAPwAAADsAAABdAAAAXwAAAE0AAABQAAAARAAAAEgAAAA8AAAAYwAAAFoAAABYAAAAUQAAAFUAAABeAAAAZQAAAD0AAABCAAAASwAAAFIAAABgAAAAVAAAAGIAAAA+AAAATAAAAEAAAABTAAAAfwAAAEoAAABGAAAAZAAAAFcAAABcAAAAVAAAAEUAAABSAAAAQAAAAGEAAABZAAAAYgAAAFUAAABXAAAAZQAAAGYAAABCAAAAQwAAAFEAAABWAAAATAAAAEsAAABBAAAAaAAAAGAAAABeAAAAVwAAAFMAAABmAAAAZAAAAEMAAABGAAAAVQAAAFgAAABIAAAAWwAAAEkAAABjAAAAUAAAAGkAAABZAAAAYQAAAFsAAABnAAAARQAAAFQAAABHAAAAWgAAAE0AAABQAAAARAAAAGoAAABdAAAAYwAAAFsAAABJAAAAWQAAAEcAAABpAAAAWAAAAGcAAABcAAAAUwAAAE4AAABKAAAAbAAAAGQAAABfAAAAXQAAAE8AAABaAAAATQAAAG0AAABfAAAAagAAAF4AAABWAAAAUQAAAEsAAABrAAAAaAAAAGUAAABfAAAAXAAAAE8AAABOAAAAbQAAAGwAAABdAAAAYAAAAGgAAABiAAAAbgAAAEwAAABWAAAAUgAAAGEAAAB/AAAAYgAAAFQAAABnAAAAWQAAAG8AAABiAAAAbgAAAGEAAABvAAAAUgAAAGAAAABUAAAAYwAAAFAAAABpAAAAWAAAAGoAAABaAAAAcQAAAGQAAABmAAAAUwAAAFcAAABsAAAAcgAAAFwAAABlAAAAZgAAAGsAAABwAAAAUQAAAFUAAABeAAAAZgAAAGUAAABXAAAAVQAAAHIAAABwAAAAZAAAAGcAAABbAAAAYQAAAFkAAAB0AAAAaQAAAG8AAABoAAAAawAAAG4AAABzAAAAVgAAAF4AAABgAAAAaQAAAFgAAABnAAAAWwAAAHEAAABjAAAAdAAAAGoAAABdAAAAYwAAAFoAAAB1AAAAbQAAAHEAAABrAAAAfwAAAGUAAABeAAAAcwAAAGgAAABwAAAAbAAAAGQAAABfAAAAXAAAAHYAAAByAAAAbQAAAG0AAABsAAAAXQAAAF8AAAB1AAAAdgAAAGoAAABuAAAAYgAAAGgAAABgAAAAdwAAAG8AAABzAAAAbwAAAGEAAABuAAAAYgAAAHQAAABnAAAAdwAAAHAAAABrAAAAZgAAAGUAAAB4AAAAcwAAAHIAAABxAAAAYwAAAHQAAABpAAAAdQAAAGoAAAB5AAAAcgAAAHAAAABkAAAAZgAAAHYAAAB4AAAAbAAAAHMAAABuAAAAawAAAGgAAAB4AAAAdwAAAHAAAAB0AAAAZwAAAHcAAABvAAAAcQAAAGkAAAB5AAAAdQAAAH8AAABtAAAAdgAAAHEAAAB5AAAAagAAAHYAAAB4AAAAbAAAAHIAAAB1AAAAeQAAAG0AAAB3AAAAbwAAAHMAAABuAAAAeQAAAHQAAAB4AAAAeAAAAHMAAAByAAAAcAAAAHkAAAB3AAAAdgAAAHkAAAB0AAAAeAAAAHcAAAB1AAAAcQAAAHYAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAACAAAABQAAAAEAAAAAAAAA/////wEAAAAAAAAAAwAAAAQAAAACAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAUAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABAAAAAUAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAUAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAD//////////wEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAAAAAAAAAAABAAAAAgAAAAYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAFAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAGAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADgAAAAIAAAAAAAAAAAAAAAEAAAAAAAAACQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAAAAAAAAAAAAAEAAAAEAAAACAAAAAoAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAAAAAAAAAAAAQAAAAsAAAAPAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAIAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAAAAAAAAAAAAQAAAAwAAAAQAAAADAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAAAAAAAAAAABAAAACgAAABMAAAAIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAEAAAANAAAAEQAAAA0AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAACAAAAAAAAAAAAAAABAAAADgAAABIAAAAPAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAADwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAAAAAAAAQAAAP//////////EwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAASAAAAAAAAABgAAAAAAAAAIQAAAAAAAAAeAAAAAAAAACAAAAADAAAAMQAAAAEAAAAwAAAAAwAAADIAAAADAAAACAAAAAAAAAAFAAAABQAAAAoAAAAFAAAAFgAAAAAAAAAQAAAAAAAAABIAAAAAAAAAKQAAAAEAAAAhAAAAAAAAAB4AAAAAAAAABAAAAAAAAAAAAAAABQAAAAIAAAAFAAAADwAAAAEAAAAIAAAAAAAAAAUAAAAFAAAAHwAAAAEAAAAWAAAAAAAAABAAAAAAAAAAAgAAAAAAAAAGAAAAAAAAAA4AAAAAAAAACgAAAAAAAAALAAAAAAAAABEAAAADAAAAGAAAAAEAAAAXAAAAAwAAABkAAAADAAAAAAAAAAAAAAABAAAABQAAAAkAAAAFAAAABQAAAAAAAAACAAAAAAAAAAYAAAAAAAAAEgAAAAEAAAAKAAAAAAAAAAsAAAAAAAAABAAAAAEAAAADAAAABQAAAAcAAAAFAAAACAAAAAEAAAAAAAAAAAAAAAEAAAAFAAAAEAAAAAEAAAAFAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAVAAAAAAAAACYAAAAAAAAACQAAAAAAAAATAAAAAAAAACIAAAADAAAADgAAAAEAAAAUAAAAAwAAACQAAAADAAAAAwAAAAAAAAANAAAABQAAAB0AAAAFAAAAAQAAAAAAAAAHAAAAAAAAABUAAAAAAAAABgAAAAEAAAAJAAAAAAAAABMAAAAAAAAABAAAAAIAAAAMAAAABQAAABoAAAAFAAAAAAAAAAEAAAADAAAAAAAAAA0AAAAFAAAAAgAAAAEAAAABAAAAAAAAAAcAAAAAAAAAGgAAAAAAAAAqAAAAAAAAADoAAAAAAAAAHQAAAAAAAAArAAAAAAAAAD4AAAADAAAAJgAAAAEAAAAvAAAAAwAAAEAAAAADAAAADAAAAAAAAAAcAAAABQAAACwAAAAFAAAADQAAAAAAAAAaAAAAAAAAACoAAAAAAAAAFQAAAAEAAAAdAAAAAAAAACsAAAAAAAAABAAAAAMAAAAPAAAABQAAAB8AAAAFAAAAAwAAAAEAAAAMAAAAAAAAABwAAAAFAAAABwAAAAEAAAANAAAAAAAAABoAAAAAAAAAHwAAAAAAAAApAAAAAAAAADEAAAAAAAAALAAAAAAAAAA1AAAAAAAAAD0AAAADAAAAOgAAAAEAAABBAAAAAwAAAEsAAAADAAAADwAAAAAAAAAWAAAABQAAACEAAAAFAAAAHAAAAAAAAAAfAAAAAAAAACkAAAAAAAAAKgAAAAEAAAAsAAAAAAAAADUAAAAAAAAABAAAAAQAAAAIAAAABQAAABAAAAAFAAAADAAAAAEAAAAPAAAAAAAAABYAAAAFAAAAGgAAAAEAAAAcAAAAAAAAAB8AAAAAAAAAMgAAAAAAAAAwAAAAAAAAADEAAAADAAAAIAAAAAAAAAAeAAAAAwAAACEAAAADAAAAGAAAAAMAAAASAAAAAwAAABAAAAADAAAARgAAAAAAAABDAAAAAAAAAEIAAAADAAAANAAAAAMAAAAyAAAAAAAAADAAAAAAAAAAJQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAUwAAAAAAAABXAAAAAwAAAFUAAAADAAAASgAAAAMAAABGAAAAAAAAAEMAAAAAAAAAOQAAAAEAAAA0AAAAAwAAADIAAAAAAAAAGQAAAAAAAAAXAAAAAAAAABgAAAADAAAAEQAAAAAAAAALAAAAAwAAAAoAAAADAAAADgAAAAMAAAAGAAAAAwAAAAIAAAADAAAALQAAAAAAAAAnAAAAAAAAACUAAAADAAAAIwAAAAMAAAAZAAAAAAAAABcAAAAAAAAAGwAAAAMAAAARAAAAAAAAAAsAAAADAAAAPwAAAAAAAAA7AAAAAwAAADkAAAADAAAAOAAAAAMAAAAtAAAAAAAAACcAAAAAAAAALgAAAAMAAAAjAAAAAwAAABkAAAAAAAAAJAAAAAAAAAAUAAAAAAAAAA4AAAADAAAAIgAAAAAAAAATAAAAAwAAAAkAAAADAAAAJgAAAAMAAAAVAAAAAwAAAAcAAAADAAAANwAAAAAAAAAoAAAAAAAAABsAAAADAAAANgAAAAMAAAAkAAAAAAAAABQAAAAAAAAAMwAAAAMAAAAiAAAAAAAAABMAAAADAAAASAAAAAAAAAA8AAAAAwAAAC4AAAADAAAASQAAAAMAAAA3AAAAAAAAACgAAAAAAAAARwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAQAAAAAAAAAAvAAAAAAAAACYAAAADAAAAPgAAAAAAAAArAAAAAwAAAB0AAAADAAAAOgAAAAMAAAAqAAAAAwAAABoAAAADAAAAVAAAAAAAAABFAAAAAAAAADMAAAADAAAAUgAAAAMAAABAAAAAAAAAAC8AAAAAAAAATAAAAAMAAAA+AAAAAAAAACsAAAADAAAAYQAAAAAAAABZAAAAAwAAAEcAAAADAAAAYgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAYAAAAAMAAABSAAAAAwAAAEAAAAAAAAAASwAAAAAAAABBAAAAAAAAADoAAAADAAAAPQAAAAAAAAA1AAAAAwAAACwAAAADAAAAMQAAAAMAAAApAAAAAwAAAB8AAAADAAAAXgAAAAAAAABWAAAAAAAAAEwAAAADAAAAUQAAAAMAAABLAAAAAAAAAEEAAAAAAAAAQgAAAAMAAAA9AAAAAAAAADUAAAADAAAAawAAAAAAAABoAAAAAwAAAGAAAAADAAAAZQAAAAMAAABeAAAAAAAAAFYAAAAAAAAAVQAAAAMAAABRAAAAAwAAAEsAAAAAAAAAOQAAAAAAAAA7AAAAAAAAAD8AAAADAAAASgAAAAAAAABOAAAAAwAAAE8AAAADAAAAUwAAAAMAAABcAAAAAwAAAF8AAAADAAAAJQAAAAAAAAAnAAAAAwAAAC0AAAADAAAANAAAAAAAAAA5AAAAAAAAADsAAAAAAAAARgAAAAMAAABKAAAAAAAAAE4AAAADAAAAGAAAAAAAAAAXAAAAAwAAABkAAAADAAAAIAAAAAMAAAAlAAAAAAAAACcAAAADAAAAMgAAAAMAAAA0AAAAAAAAADkAAAAAAAAALgAAAAAAAAA8AAAAAAAAAEgAAAADAAAAOAAAAAAAAABEAAAAAwAAAFAAAAADAAAAPwAAAAMAAABNAAAAAwAAAFoAAAADAAAAGwAAAAAAAAAoAAAAAwAAADcAAAADAAAAIwAAAAAAAAAuAAAAAAAAADwAAAAAAAAALQAAAAMAAAA4AAAAAAAAAEQAAAADAAAADgAAAAAAAAAUAAAAAwAAACQAAAADAAAAEQAAAAMAAAAbAAAAAAAAACgAAAADAAAAGQAAAAMAAAAjAAAAAAAAAC4AAAAAAAAARwAAAAAAAABZAAAAAAAAAGEAAAADAAAASQAAAAAAAABbAAAAAwAAAGcAAAADAAAASAAAAAMAAABYAAAAAwAAAGkAAAADAAAAMwAAAAAAAABFAAAAAwAAAFQAAAADAAAANgAAAAAAAABHAAAAAAAAAFkAAAAAAAAANwAAAAMAAABJAAAAAAAAAFsAAAADAAAAJgAAAAAAAAAvAAAAAwAAAEAAAAADAAAAIgAAAAMAAAAzAAAAAAAAAEUAAAADAAAAJAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAYAAAAAAAAABoAAAAAAAAAGsAAAADAAAAYgAAAAAAAABuAAAAAwAAAHMAAAADAAAAYQAAAAMAAABvAAAAAwAAAHcAAAADAAAATAAAAAAAAABWAAAAAwAAAF4AAAADAAAAUgAAAAAAAABgAAAAAAAAAGgAAAAAAAAAVAAAAAMAAABiAAAAAAAAAG4AAAADAAAAOgAAAAAAAABBAAAAAwAAAEsAAAADAAAAPgAAAAMAAABMAAAAAAAAAFYAAAADAAAAQAAAAAMAAABSAAAAAAAAAGAAAAAAAAAAVQAAAAAAAABXAAAAAAAAAFMAAAADAAAAZQAAAAAAAABmAAAAAwAAAGQAAAADAAAAawAAAAMAAABwAAAAAwAAAHIAAAADAAAAQgAAAAAAAABDAAAAAwAAAEYAAAADAAAAUQAAAAAAAABVAAAAAAAAAFcAAAAAAAAAXgAAAAMAAABlAAAAAAAAAGYAAAADAAAAMQAAAAAAAAAwAAAAAwAAADIAAAADAAAAPQAAAAMAAABCAAAAAAAAAEMAAAADAAAASwAAAAMAAABRAAAAAAAAAFUAAAAAAAAAXwAAAAAAAABcAAAAAAAAAFMAAAAAAAAATwAAAAAAAABOAAAAAAAAAEoAAAADAAAAPwAAAAEAAAA7AAAAAwAAADkAAAADAAAAbQAAAAAAAABsAAAAAAAAAGQAAAAFAAAAXQAAAAEAAABfAAAAAAAAAFwAAAAAAAAATQAAAAEAAABPAAAAAAAAAE4AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+T8AAAAAAAAAABgtRFT7IQlAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPshCUAAAAAAAAAAABgtRFT7Ifm/GC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgtRFT7Ifm/GC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAABgtRFT7IQnAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPshCcAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAMpi5RexJsw/BlIKPVwR5T95Wyu0/QjnP5PjoT7YYcu/mBhKZ6zrwj8wRYS7NebuP3qW6geh+Ls/SLrixebL3r+pcyymN9XrPwmkNHp7xec/GWNMZVAA17+82s+x2BLiPwn2ytbJ9ek/LgEH1sMS1j8yp/2LhTfeP+SnWwtQBbu/d38gkp5X7z8ytsuHaADGPzUYObdf1+m/7IauECWhwz+cjSACjzniP76Z+wUhN9K/1+GEKzup67+/GYr/04baPw6idWOvsuc/ZedTWsRa5b/EJQOuRzi0v/OncYhHPes/h49PixY53j+i8wWfC03Nvw2idWOvsue/ZedTWsRa5T/EJQOuRzi0P/KncYhHPeu/iY9PixY53r+i8wWfC03NP9anWwtQBbs/d38gkp5X778ytsuHaADGvzUYObdf1+k/74auECWhw7+cjSACjzniv8CZ+wUhN9I/1uGEKzup6z+/GYr/04bavwmkNHp7xee/F2NMZVAA1z+82s+x2BLivwr2ytbJ9em/KwEH1sMS1r8yp/2LhTfev81i5RexJsy/BlIKPVwR5b95Wyu0/Qjnv5DjoT7YYcs/nBhKZ6zrwr8wRYS7Nebuv3OW6geh+Lu/SLrixebL3j+pcyymN9Xrv8rHIFfWehZAMBwUdlo0DECTUc17EOb2PxpVB1SWChdAzjbhb9pTDUDQhmdvECX5P9FlMKCC9+g/IIAzjELgE0DajDngMv8GQFhWDmDPjNs/y1guLh96EkAxPi8k7DIEQJCc4URlhRhA3eLKKLwkEECqpNAyTBD/P6xpjXcDiwVAFtl//cQm4z+Ibt3XKiYTQM7mCLUb3QdAoM1t8yVv7D8aLZv2Nk8UQEAJPV5nQwxAtSsfTCoE9z9TPjXLXIIWQBVanC5W9AtAYM3d7Adm9j++5mQz1FoWQBUThyaVBghAwH5muQsV7T89Q1qv82MUQJoWGOfNuBdAzrkClkmwDkDQjKq77t37Py+g0dtitsE/ZwAMTwVPEUBojepluNwBQGYbtuW+t9w/HNWIJs6MEkDTNuQUSlgEQKxktPP5TcQ/ixbLB8JjEUCwuWjXMQYCQAS/R09FkRdAowpiZjhhDkB7LmlczD/7P01iQmhhsAVAnrtTwDy84z/Z6jfQ2TgTQChOCXMnWwpAhrW3daoz8z/HYJvVPI4VQLT3ik5FcA5Angi7LOZd+z+NNVzDy5gXQBXdvVTFUA1AYNMgOeYe+T8+qHXGCwkXQKQTOKwa5AJA8gFVoEMW0T+FwzJyttIRQAEAAAD/////BwAAAP////8xAAAA/////1cBAAD/////YQkAAP////+nQQAA/////5HLAQD/////95AMAP/////B9lcAAAAAAAAAAAAAAAAAAgAAAP////8OAAAA/////2IAAAD/////rgIAAP/////CEgAA/////06DAAD/////IpcDAP/////uIRkA/////4LtrwAAAAAAAAAAAAAAAAAAAAAAAgAAAP//////////AQAAAAMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////wIAAAD//////////wEAAAAAAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA/////////////////////wEAAAD///////////////8CAAAA////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD///////////////////////////////8CAAAA////////////////AQAAAP////////////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAAAQAAAP//////////AgAAAP//////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAAEAAAD//////////wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAgAAAAAAAAACAAAAAQAAAAEAAAACAAAAAgAAAAAAAAAFAAAABQAAAAAAAAACAAAAAgAAAAMAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAIAAAABAAAAAgAAAAIAAAACAAAAAAAAAAUAAAAGAAAAAAAAAAIAAAACAAAAAwAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAAAAAAAAgAAAAEAAAADAAAAAgAAAAIAAAAAAAAABQAAAAcAAAAAAAAAAgAAAAIAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAgAAAAAAAAACAAAAAQAAAAQAAAACAAAAAgAAAAAAAAAFAAAACAAAAAAAAAACAAAAAgAAAAMAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAACAAAAAAAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAUAAAAJAAAAAAAAAAIAAAACAAAAAwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAIAAAACAAAAAAAAAAMAAAAOAAAAAgAAAAAAAAACAAAAAwAAAAAAAAAAAAAAAgAAAAIAAAADAAAABgAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAgAAAAIAAAAAAAAAAwAAAAoAAAACAAAAAAAAAAIAAAADAAAAAQAAAAAAAAACAAAAAgAAAAMAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAgAAAAAAAAADAAAACwAAAAIAAAAAAAAAAgAAAAMAAAACAAAAAAAAAAIAAAACAAAAAwAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAACAAAAAAAAAAMAAAAMAAAAAgAAAAAAAAACAAAAAwAAAAMAAAAAAAAAAgAAAAIAAAADAAAACQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAgAAAAIAAAAAAAAAAwAAAA0AAAACAAAAAAAAAAIAAAADAAAABAAAAAAAAAACAAAAAgAAAAMAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAgAAAAAAAAADAAAABgAAAAIAAAAAAAAAAgAAAAMAAAAPAAAAAAAAAAIAAAACAAAAAwAAAAsAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAIAAAACAAAAAAAAAAMAAAAHAAAAAgAAAAAAAAACAAAAAwAAABAAAAAAAAAAAgAAAAIAAAADAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAIAAAAAAAAAAwAAAAgAAAACAAAAAAAAAAIAAAADAAAAEQAAAAAAAAACAAAAAgAAAAMAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAACAAAAAgAAAAAAAAADAAAACQAAAAIAAAAAAAAAAgAAAAMAAAASAAAAAAAAAAIAAAACAAAAAwAAAA4AAAAAAAAAAAAAAAAAAAAAAAAACQAAAAIAAAACAAAAAAAAAAMAAAAFAAAAAgAAAAAAAAACAAAAAwAAABMAAAAAAAAAAgAAAAIAAAADAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAgAAAAAAAAACAAAAAQAAABMAAAACAAAAAgAAAAAAAAAFAAAACgAAAAAAAAACAAAAAgAAAAMAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABEAAAACAAAAAAAAAAIAAAABAAAADwAAAAIAAAACAAAAAAAAAAUAAAALAAAAAAAAAAIAAAACAAAAAwAAABEAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAIAAAAAAAAAAgAAAAEAAAAQAAAAAgAAAAIAAAAAAAAABQAAAAwAAAAAAAAAAgAAAAIAAAADAAAAEgAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAACAAAAAQAAABEAAAACAAAAAgAAAAAAAAAFAAAADQAAAAAAAAACAAAAAgAAAAMAAAATAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAACAAAAAAAAAAIAAAABAAAAEgAAAAIAAAACAAAAAAAAAAUAAAAOAAAAAAAAAAIAAAACAAAAAwAAAAIAAAABAAAAAAAAAAEAAAACAAAAAAAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAEAAAAAAAAAAgAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAgAAAAAAAAABAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAFAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAABAAAAAAEAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAEAAAAAAAAAAAAAOgehWlKfUEEz1zLi+JsiQa2og3wcMfVAWCbHorc0yEDi+Yn/Y6mbQJ11/mfsnG9At6bnG4UQQkBvMCQWKqUUQJVmwwswmOc/3hVgVBL3uj//qqOEOdGOPw/WDN4gnGE/H3ANkCUgND+AA8btKgAHPwTXBqJVSdo+XfRQAqsKrj4fc+zLYbSPQklEmCZHv2FCUP+uDso1NEKYtPhwphUHQptxnyFXYdpB7CddZAMmrkGAt1AxSTqBQUibBVdTsFNBSuX3MV+AJkFocv82SLf5QAqmgj7AY81A23VDSEnLoEDGEJVSeDFzQDYrqvBk70VA8U157pcRGUBWfEF+ZKbsP6phvycGBZRAJbod0OgwfkCp+L8jatBmQCjl3pGrPlFAfMWm114SOkButwtqS7UjQHQwbcjXyw1A8jnLuuyA9j9KwjL0VwHhPyotk0lcs8k/Q5PvEs9rsz+SfsOQEVqdPzUAKDojLoY/WJz/kcjCcD8YFu070FRZPyoLC2BdJEM/YOXQAuiMM0HIBz1bw3sdQdV46aaHRwZByatzjDPX8EDb3Jie8HXZQCJxj6ULP8NAUaG6uRAZrUCWdmou5/mVQLb9huRPm4BAhvoCHygZaUCuX/I3SPdSQC9/bC/1qTxAfKxsYQ6pJUCuslH+N14QQMS/cv7SvPg/Ol8maYKx4j8AAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAD/////AAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAA/////wAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAP////8AAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////BQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAUAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAEAAQAAAQEAAAAAAAEAAAABAAAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAKriWFiWZfg/Y2nmTbY/8z8MHSPSqmnjv6hnn18HR3c/quJYWJZl+D/jq5TzDdzyPwwdI9KqaeO/u0kC1eFSBECq4lhYlmX4P69pJmt7c/E/NnkJi6jSBsDESFlzKkr6P33ArMz7sfY/o2q2uqM08D+oZ59fB0d3PzEqCi3qrvK/kmm4ANp49D+4wS2wzhzvP9WJvyAnx+E/upcY75RVx7+95t+9y0T1P9L18g1caO0/k6CkRyVzAEBf99+e/GjxP6QMsuuLQ/U/PlP4Qr8q7j8Mb/GO2GMCwLl2K/DQIghAePiwytEp9D9UHrsuI/nqPzjMedJ+yuy/k6xgf58n/L+XoQtn22DzP2lzCnsYk+s/JhUSDI4P8z+8lFcBhgTcPxOqKRxEX/M/89MEdoPQ6j8OKQaXDob7vzWwNvblgAPAzGkxMcl88j9Nm4okPkbpP0vI89vxSgRAdac2Z6W2/T+6UFOMC3zyP/+2XEF3hug/QqhELwGKCMAwdlQerEoEQFcr/B+VnvE/hB1hfFzT5j8wdsE/Da64P0hIvnF/sOC/KH/hrXUg8T9bI5OQHaLlP+mYzla7td6/CtKG6iOm8b8FW3TV8oXwP8ORhtNuJ+c/q8JrTMz/AcC8PaUl+PUFwAXv9rkMT/A/m+sAswr15D+7hk/O3yvkP6c/yVsOHKI/qqAX9idJ8D/8hNz1KNPiP7xSXh3Ggvg/epbkiKr57T/23/LB1GLvP4GTTeNZi+M/W4TqlTheBcDupZgIdYUIQGwlcW3YZO8/tQvDXQ3H4j8Bt+sf9DkAQMdFie+nNvg/Z5Uh1wDX7j9h5X2d4KjhPxMJ1ZVT4Pa/evqB8xB//7+W183U9QLsPwzNxsC7AOA/af/LqCnK/r/lPceQ0FQDwHoY0nYIW+w/bHNSHrTg4D/DFcMAdabuv2sz5Ojhnve/FvLf01HN6z/tEDL2Hz/gP0bBv0KUhPA/pd7sEnMc4D8EGon4Lo7sP5NVbYtSON8/DAMC50odBkB+Z2J8MGYCQIhlM1gubOo/FssiPwWy4D8OIlGqRnkCQAd1vopp6f4/QS1keLLK6T9rfoBuT7LZP3KQbH5ugwjAjqVPXTmbBUBL/JxcqR3qP3oSeovuktg/Y6pRhJmqy7+0kwuU0Yjmv2wvsfFmQ+g/R98lJFqQ2T/IGb5gjLkCwK3mNff3kQbAqDznPFM86T+iiP0FfsvYP7fzKG6Mls0/h7+at2btzL8tsUTgk+LmP/YEIrTDINU/WmwKoVjA5L9aC02r6FHxvzzFCT/Qg+Y/nx0V97en0j8+1toJOm77P1kZ7h8KjfQ/GBbbqxgk5j9RGXM79G/SP+beHsWmweQ/9REi4eX0xD/V9s+kmMHkP+pb9yNs09A/c5ERjVDTAECqEr3OBCH7P14ILfMECOU/piRx4P8P0j+JYU//bfL0Pw62fw28B+w/l5YW2Ga45D9+CyKRbenOP5cH6fHy1/S/o/egk03++r91nTYRL/bjP3fHN6OJVdA/7xXQh1XLBcAB3g6tBdUIQKW2KnGYjeQ/SqIpagclyz8F9P3YgNL6v9H6NBsZ8QDAW2k5L5Qs4z/0axa1l6zLP1GE65Mu4wNAwfX+BYmWAEBBgJP90M3hP6/03qhPLdA/zqo5bJz2778/ESlPCTn1v7JkhGyvzuE/DM7sj5twwz/6xbXLavYGQH29RFRGkgNA7bOXVSJ54T9fEhTHO/TDP+8t+HMOiwDAxa0SbGTtA8Atii7y0mLgP4cecHFB3sM/uPUpyv+K7j8nktD1/WvhP2cWmi772d8/Fj7uU9kEvD8oKOESLzKmvwSdCqrHdNu/XCluGsvI3T929OW5md+uP9dP6rXcZNq/gXM+ggzL6b+eKjsPgJncP6i1e9aVu7E/2CnPNJyD1D/DnyGgSe+xvy8k7g9bp9s/nYmLvHn1sz9cFOwApH8IwGa6Mjy9cgZAJr95SiSW2z8rCkhOFvqdP3SIKmO/UwPAEy0zkN7bBsCds8Hg/13YP1zv413hVGi/FVtqixSn6L9XAPQGul3yv7SGu2BoCNk/n94bv7Maj79p13T6X9z3P45MPCW3WvI/rU/8/LRj1T9cgR6SXd+ZPymL2DstbPI/8s/pAkIz6z/fmoB+8efYPz2XyfWgYaa/6wys72AW/j8LZImhgrf3P729Zla/n9U/ySB8B3PBqL8O2nhevvbxv17+5A+n6fe/YrGIqEGB1T+wCEGbkhaxv989QHVE5wFAzd12PTu3/T9AHUPZY2DUP3SQDST0zq2/JCxAlIoj5T+Mhe1IJkrQP/cRpl8QhtU/amc4seFts79khiUSVaz3vxYfWtjPwf2/CHscxQqD0j/ctUBQ9my3v0POnFiyXv2/pjjn2Ju/AcDk45DwBhPRP/GjwlCrv7m/aT2ciwolBsAQOzHr/wUJQCzpq5UYvtI/gDCf3SlCwb+4i7S+mukEQBDA1f8mowFA2utnRN3KyT9T+9EYAVG6v9/IVZ0enrE/7NbRtdGfzr/8y8GpRz7LP3U0vTSk18e/JzHEcwiBB0AGm8Q7AJkEQNLciyt4Esk/gLou5zoQxr+RrOfM91oBwEzd36KybgTAgLou5zoQxj/S3IsreBLJv1gCch0OHO8/FD+RxSLN4j91NL00pNfHP/zLwalHPsu/nL7/By4Pyr8tSP5h7CPiv1P70RgBUbo/2utnRN3Kyb/KfllfCpUIwLkP5zj+NwdAgDCf3SlCwT8s6auVGL7Sv2aFPlaC4eC/XrS5UVH77b/xo8JQq7+5P+TjkPAGE9G/Q30/RYbn1z8FF/ISafuLv9y1QFD2bLc/CHscxQqD0r/fi+tPROX0P6vRc+19ie0/amc4seFtsz/3EaZfEIbVv77TYpahl/o/DDsu0CaC9D90kA0k9M6tP0AdQ9ljYNS/CCI0rxjZA8BgfCaLthgHwLAIQZuSFrE/YrGIqEGB1b8kvQ982+rsv4J8EWu7jPS/ySB8B3PBqD+9vWZWv5/VvwrAByWcJgBAxFujmE9a+j89l8n1oGGmP9+agH7x59i/N03cuJUt9L8X9v4GdIz6v1yBHpJd35m/rU/8/LRj1b8mz69sydf/vyu5idMqVQLAn94bv7Majz8AhrtgaAjZv+aCE66WZ/q/lA1Mgz/p/79c7+Nd4VRoP52zweD/Xdi/TJZpMTb4AkDLWZShPOb/PysKSE4W+p2/Jr95SiSW27/PkmbE7zjnP6UAiCDmMNI/nYmLvHn1s78vJO4PW6fbv5MWA2vqSrQ/V5WLwPB51b+otXvWlbuxv54qOw+Amdy/1keqzYeRBsApIEMHgZIIQHb05bmZ366/XCluGsvI3b8W44a9X9UFQEeQtDM4rwJAFj7uU9kEvL9nFpou+9nfv3Co+JcyyQhAcdkCX2KzBUCHHnBxQd7Dvy2KLvLSYuC/o6+5YTt/AcCHCNDW+8YEwF8SFMc79MO/7bOXVSJ54b9E/pfA2S3xPzD9xaBb0uQ/DM7sj5tww7+yZIRsr87hv7c4c0SEXNG/Tr79/9M+5r+v9N6oTy3Qv5uAk/3QzeG/XcI1OVQkAUAQSV9Z7Qr9P/RrFrWXrMu/W2k5L5Qs479Zo2IBM/vkv6FuipzkFvG/SqIpagcly7+ltipxmI3kv0pmis91cfc/gWQecsRh8D93xzejiVXQv3WdNhEv9uO/D7mgYy612j+PyVPNaT2jv34LIpFt6c6/l5YW2Ga45L+LUp+2A2z9P39i5xSpRfc/piRx4P8P0r9eCC3zBAjlv5n4OKmIUf2/jj/kUAwgAsDqW/cjbNPQv9X2z6SYweS/aTdljlWd8L94R8vZ8SL3v1EZczv0b9K/GBbbqxgk5r9XdfyikfEDwPILMvas0gfAnx0V97en0r88xQk/0IPmvxGErZ681fa/9kCaiOy2/b/2BCK0wyDVvy2xROCT4ua/+5EBLOXxA0B7p53+BnkAQKKI/QV+y9i/qDznPFM86b/snWGNkkgHwC+ByugkUwdAR98lJFqQ2b9sL7HxZkPovyJNGM67oek/HzNy6BqA1D96EnqL7pLYv0v8nFypHeq/axL/u1FnB0AkSEHvxn8DQGt+gG5Pstm/QS1keLLK6b/Sk/O6mtGzPxU8pLcPNty/FssiPwWy4L+IZTNYLmzqvw4szKfSouq/G+XJHY1a87+TVW2LUjjfvwQaifgujuy/3VARaoMl2L9NFodfK+/qv+0QMvYfP+C/FvLf01HN67+ETOQysd8AwH71iI/eGgXAbHNSHrTg4L96GNJ2CFvsv6BnExReeAFA5CakvxSl+j8MzcbAuwDgv5bXzdT1Auy/uVq8/8x58z+uvPMNqzTnP2HlfZ3gqOG/Z5Uh1wDX7r8PUbMSo2P7P9VfBrXlxPI/tQvDXQ3H4r9sJXFt2GTvvyDssGgO0PG/WxT/uE4N+r+Bk03jWYvjv/bf8sHUYu+/rUXN8hUe3j9m5HB1yZCzv/yE3PUo0+K/qqAX9idJ8L9mByqLMMH5v4kHC7KQowHAm+sAswr15L8F7/a5DE/wv2JLsGADFwTAKQjVGovZCMDDkYbTbifnvwVbdNXyhfC/malhH7yI7D+oevd0GWDZP1sjk5AdouW/KH/hrXUg8b8KWmrpQ0sFQAzEAF/pTgBAhB1hfFzT5r9XK/wflZ7xv18hRuqKXAjA/5rUd9v1BED/tlxBd4bov7pQU4wLfPK/4pnwn0T/sj/c277XPF3jv02biiQ+Rum/zGkxMcl88r8Yk0HhJVzjv62yUUFRjfS/89MEdoPQ6r8TqikcRF/zvxQxghHovfY/cfM1eFWE5j9pcwp7GJPrv5ehC2fbYPO/KUV2nGg0/795OhmUaqEFwFQeuy4j+eq/ePiwytEp9L8DuqWfW+8BQLytJylXHPY/PlP4Qr8q7r+kDLLri0P1vxT4ShWL+Oo/DMsWg0zlv7/S9fINXGjtv73m373LRPW/+xg/Gaxd8b94MdQEfW0AwLjBLbDOHO+/kmm4ANp49L+cShSMMbAEwKyjUgWirAdAo2q2uqM08L99wKzM+7H2v3RdlNBXFgnA8S9+ewyV/z+vaSZre3Pxv6riWFiWZfi/2J7VSZZ60j+LES81zPn3v+OrlPMN3PK/quJYWJZl+L/OZbufkEcEQLCNB/1lPOO/Y2nmTbY/87+q4lhYlmX4v7CNB/1lPOO/zmW7n5BHBEBwKD1Aa57LP/XsSsw7RbU/PMDPJGsfoD/TqningGKIPzFtCLYmb3I/qYfrJr7eWz9pQmleXRFFP0rWlJkA2i8/pCvcttgTGD9Dt8IWbjMCPyCG4GRlhOs+1JI2GhDN1D7ns8cGvXK/Pi8m8UTJxac+hNTfA2z4kT7GI8kjLyt7Pv//////HwAI//////8zEAj/////fzIgCP////9vMjAI/////2MyQAj///8/YjJQCP///zdiMmAI////M2IycAj//78zYjKACP//qzNiMpAI/3+rM2IyoAj/D6szYjKwCP8DqzNiMsAIvwOrM2Iy0AifA6szYjLgCJkDqzNiMvAI//////8/Dwj//////ysfCP////9/KS8I/////z8pPwj/////OSlPCP///z84KV8I////Dzgpbwj///8OOCl/CP//Hw44KY8I//8PDjgpnwj/fw0OOCmvCP8PDQ44Kb8I/w0NDjgpzwj/DA0OOCnfCMcMDQ44Ke8IxAwNDjgp/wgHAAAABwAAAAEAAAACAAAABAAAAAMAAAAAAAAAAAAAAAcAAAADAAAAAQAAAAIAAAAFAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAgAAAAEAAAADAAAADgAAAAYAAAALAAAAAgAAAAcAAAABAAAAGAAAAAUAAAAKAAAAAQAAAAYAAAAAAAAAJgAAAAcAAAAMAAAAAwAAAAgAAAACAAAAMQAAAAkAAAAOAAAAAAAAAAUAAAAEAAAAOgAAAAgAAAANAAAABAAAAAkAAAADAAAAPwAAAAsAAAAGAAAADwAAAAoAAAAQAAAASAAAAAwAAAAHAAAAEAAAAAsAAAARAAAAUwAAAAoAAAAFAAAAEwAAAA4AAAAPAAAAYQAAAA0AAAAIAAAAEQAAAAwAAAASAAAAawAAAA4AAAAJAAAAEgAAAA0AAAATAAAAdQAAAA8AAAATAAAAEQAAABIAAAAQAAAABgAAAAIAAAADAAAABQAAAAQAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAMAAAABAAAABQAAAAQAAAAAAAAAAAAAAAcAAAAFAAAAAwAAAAQAAAABAAAAAAAAAAIAAAAAAAAAAgAAAAMAAAABAAAABQAAAAQAAAAGAAAAAAAAAAAAAAAYLURU+yH5PxgtRFT7Ifm/GC1EVPshCUAYLURU+yEJwGFsZ29zLmMAaDNOZWlnaGJvclJvdGF0aW9ucwBjZWxsc1RvTXVsdGlQb2x5LmMAY2VsbFRvRWRnZUFyY3MAAAEDAgQABAMFAQJjYW5jZWxBcmNQYWlycwBjcmVhdGVTb3J0YWJsZUxvb3AAZGlyZWN0ZWRFZGdlLmMAZGlyZWN0ZWRFZGdlVG9Cb3VuZGFyeQBhZGphY2VudEZhY2VEaXJbdG1wRmlqay5mYWNlXVtmaWprLmZhY2VdID09IEtJAGZhY2VpamsuYwBfZmFjZUlqa1BlbnRUb0NlbGxCb3VuZGFyeQBhZGphY2VudEZhY2VEaXJbY2VudGVySUpLLmZhY2VdW2ZhY2UyXSA9PSBLSQBfZmFjZUlqa1RvQ2VsbEJvdW5kYXJ5AGgzSW5kZXguYwBjb21wYWN0Q2VsbHMAdmVjM1RvQ2VsbABjZWxsVG9DaGlsZFBvcwB2YWxpZGF0ZUNoaWxkUG9zAHJldkRpciAhPSBJTlZBTElEX0RJR0lUAGxvY2FsaWouYwBjZWxsVG9Mb2NhbElqawBiYXNlQ2VsbCAhPSBvcmlnaW5CYXNlQ2VsbAAhKG9yaWdpbk9uUGVudCAmJiBpbmRleE9uUGVudCkAYmFzZUNlbGwgPT0gb3JpZ2luQmFzZUNlbGwALi4vaW5jbHVkZS9jb29yZGlqay5oAF91cEFwN0NoZWNrZWQAX3VwQXA3ckNoZWNrZWQAYmFzZUNlbGwgIT0gSU5WQUxJRF9CQVNFX0NFTEwAbG9jYWxJamtUb0NlbGwAIV9pc0Jhc2VDZWxsUGVudGFnb24oYmFzZUNlbGwpAGJhc2VDZWxsUm90YXRpb25zID49IDAAZ3JpZFBhdGhDZWxsc0ludGVycG9sYXRlAHBvbHlmaWxsLmMAaXRlclN0ZXBQb2x5Z29uQ29tcGFjdAAwAHZlcnRleC5jAHZlcnRleFJvdGF0aW9ucwBjZWxsVG9WZXJ0ZXg=";var vt=28400;function Tt(Le){return Le}function qe(Le){var it=/\b__Z[\w\d_]+/g;return Le.replace(it,function(Dt){var He=Dt;return Dt===He?Dt:He+" ["+Dt+"]"})}function Je(){var Le=new Error;if(!Le.stack){try{throw new Error(0)}catch(it){Le=it}if(!Le.stack)return"(no stack trace available)"}return Le.stack.toString()}function Pt(){var Le=Je();return e.extraStackTrace&&(Le+=`4130-`+e.extraStackTrace()),qe(Le)}function rn(Le,it,Dt,He){km("Assertion failed: "+L(Le)+", at: "+[it?L(it):"unknown filename",Dt,He?L(He):"unknown function"])}function Lt(){return Y.length}function Rt(Le,it,Dt){H.set(H.subarray(it,it+Dt),Le)}function fn(Le){return e.___errno_location&&(te[e.___errno_location()>>2]=Le),Le}function wn(Le){km("OOM")}function Dn(Le){try{var it=new ArrayBuffer(Le);return it.byteLength!=Le?void 0:(new Int8Array(it).set(Y),sn(it),Re(it),1)}catch{}}function ye(Le){var it=Lt(),Dt=16777216,He=2147483648-Dt;if(Le>He)return!1;for(var h=16777216,sr=Math.max(it,h);sr<Le;)sr<=536870912?sr=G(2*sr,Dt):sr=Math.min(G((3*sr+2147483648)/4,Dt),He);var Ii=Dn(sr);return!!Ii}var wt=typeof atob=="function"?atob:function(Le){var it="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Dt="",He,h,sr,Ii,ie,or,ol,fo=0;Le=Le.replace(/[^A-Za-z0-9\+\/\=]/g,"");do Ii=it.indexOf(Le.charAt(fo++)),ie=it.indexOf(Le.charAt(fo++)),or=it.indexOf(Le.charAt(fo++)),ol=it.indexOf(Le.charAt(fo++)),He=Ii<<2|ie>>4,h=(ie&15)<<4|or>>2,sr=(or&3)<<6|ol,Dt=Dt+String.fromCharCode(He),or!==64&&(Dt=Dt+String.fromCharCode(h)),ol!==64&&(Dt=Dt+String.fromCharCode(sr));while(fo<Le.length);return Dt};function Ze(Le){try{for(var it=wt(Le),Dt=new Uint8Array(it.length),He=0;He<it.length;++He)Dt[He]=it.charCodeAt(He);return Dt}catch{throw new Error("Converting base64 string to bytes failed.")}}function St(Le){if(Te(Le))return Ze(Le.slice(Z.length))}var Bt={Math,Int8Array,Int32Array,Uint8Array,Float32Array,Float64Array},ut={a:km,b:f,c:d,d:rn,e:fn,f:Lt,g:Rt,h:ye,i:wn,j:Tt,k:qe,l:Dn,m:Je,n:Pt,o:vt,p:Fe},Ce=(function(Le,it,Dt){"almost asm";var He=new Le.Int8Array(Dt),h=new Le.Int32Array(Dt),sr=new Le.Uint8Array(Dt),Ii=new Le.Float32Array(Dt),ie=new Le.Float64Array(Dt),or=it.o|0,ol=it.p|0,fo=Le.Math.floor,Qs=Le.Math.abs,ws=Le.Math.sqrt,ii=Le.Math.cos,zi=Le.Math.sin,oT=Le.Math.tan,wce=Le.Math.acos,Wx=Le.Math.asin,YG=Le.Math.atan,Ta=Le.Math.atan2,y1=Le.Math.ceil,al=Le.Math.imul,oL=Le.Math.min,Sce=Le.Math.max,Wf=Le.Math.clz32,Tce=it.a,On=it.b,ee=it.c,di=it.d,ZG=it.e,Ece=it.f,Mce=it.g,Cce=it.h,Rce=it.i,Q=28416;function Ice(p){return He=new Int8Array(p),sr=new Uint8Array(p),h=new Int32Array(p),Ii=new Float32Array(p),ie=new Float64Array(p),Dt=p,!0}function Pce(p){p=p|0;var m=0;return m=Q,Q=Q+p|0,Q=Q+15&-16,m|0}function Lce(){return Q|0}function Dce(p){p=p|0,Q=p}function Nce(p,m){p=p|0,m=m|0,Q=p}function Fce(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;return(p|0)<0?(m=2,m|0):(p|0)>13780509?(m=uT(15,m)|0,m|0):(g=((p|0)<0)<<31>>31,v=wr(p|0,g|0,3,0)|0,_=ee()|0,g=At(p|0,g|0,1,0)|0,g=wr(v|0,_|0,g|0,ee()|0)|0,g=At(g|0,ee()|0,1,0)|0,p=ee()|0,h[m>>2]=g,h[m+4>>2]=p,m=0,m|0)}function KG(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,QG(p,m,g,_,0)|0}function QG(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0;if(M=Q,Q=Q+16|0,b=M,!(JG(p,m,g,_,v)|0))return _=0,Q=M,_|0;do if((g|0)>=0){if((g|0)>13780509){if(x=uT(15,b)|0,x|0)break;E=b,b=h[E>>2]|0,E=h[E+4>>2]|0}else x=((g|0)<0)<<31>>31,N=wr(g|0,x|0,3,0)|0,E=ee()|0,x=At(g|0,x|0,1,0)|0,x=wr(N|0,E|0,x|0,ee()|0)|0,x=At(x|0,ee()|0,1,0)|0,E=ee()|0,h[b>>2]=x,h[b+4>>2]=E,b=x;if(hp(_|0,0,b<<3|0)|0,v|0){hp(v|0,0,b<<2|0)|0,x=ah(p,m,g,_,v,b,E,0)|0;break}x=Ea(b,4)|0,x?(N=ah(p,m,g,_,x,b,E,0)|0,_t(x),x=N):x=13}else x=2;while(!1);return N=x,Q=M,N|0}function JG(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0;if(ae=Q,Q=Q+16|0,X=ae,K=ae+8|0,j=X,h[j>>2]=p,h[j+4>>2]=m,(g|0)<0)return K=2,Q=ae,K|0;if(x=_,h[x>>2]=p,h[x+4>>2]=m,x=(v|0)!=0,x&&(h[v>>2]=0),Zi(p,m)|0)return K=9,Q=ae,K|0;h[K>>2]=0;e:do if((g|0)>=1)if(x)for(U=1,N=0,q=0,j=1,x=p;;){if(!(N|q)){if(x=Js(x,m,4,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,Zi(x,m)|0){x=9;break e}}if(x=Js(x,m,h[26864+(q<<2)>>2]|0,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,p=_+(U<<3)|0,h[p>>2]=x,h[p+4>>2]=m,h[v+(U<<2)>>2]=j,p=N+1|0,b=(p|0)==(j|0),E=q+1|0,M=(E|0)==6,Zi(x,m)|0){x=9;break e}if(j=j+(M&b&1)|0,(j|0)>(g|0)){x=0;break}else U=U+1|0,N=b?0:p,q=b?M?0:E:q}else for(U=1,N=0,q=0,j=1,x=p;;){if(!(N|q)){if(x=Js(x,m,4,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,Zi(x,m)|0){x=9;break e}}if(x=Js(x,m,h[26864+(q<<2)>>2]|0,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,p=_+(U<<3)|0,h[p>>2]=x,h[p+4>>2]=m,p=N+1|0,b=(p|0)==(j|0),E=q+1|0,M=(E|0)==6,Zi(x,m)|0){x=9;break e}if(j=j+(M&b&1)|0,(j|0)>(g|0)){x=0;break}else U=U+1|0,N=b?0:p,q=b?M?0:E:q}else x=0;while(!1);return K=x,Q=ae,K|0}function ah(p,m,g,_,v,x,b,E){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0,E=E|0;var M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0;if(ae=Q,Q=Q+16|0,X=ae+8|0,K=ae,M=jf(p|0,m|0,x|0,b|0)|0,U=ee()|0,q=_+(M<<3)|0,ue=q,xe=h[ue>>2]|0,ue=h[ue+4>>2]|0,N=(xe|0)==(p|0)&(ue|0)==(m|0),!((xe|0)==0&(ue|0)==0|N))do M=At(M|0,U|0,1,0)|0,M=up(M|0,ee()|0,x|0,b|0)|0,U=ee()|0,q=_+(M<<3)|0,xe=q,ue=h[xe>>2]|0,xe=h[xe+4>>2]|0,N=(ue|0)==(p|0)&(xe|0)==(m|0);while(!((ue|0)==0&(xe|0)==0|N));if(M=v+(M<<2)|0,N&&(h[M>>2]|0)<=(E|0)||(xe=q,h[xe>>2]=p,h[xe+4>>2]=m,h[M>>2]=E,(E|0)>=(g|0)))return xe=0,Q=ae,xe|0;switch(N=E+1|0,h[X>>2]=0,M=Js(p,m,2,X,K)|0,M|0){case 9:{j=9;break}case 0:{M=K,M=ah(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M||(j=9);break}default:}e:do if((j|0)==9){switch(h[X>>2]=0,M=Js(p,m,3,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ah(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Js(p,m,1,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ah(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Js(p,m,5,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ah(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Js(p,m,4,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ah(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Js(p,m,6,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ah(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}return xe=0,Q=ae,xe|0}while(!1);return xe=M,Q=ae,xe|0}function Js(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(g>>>0>6)return v=1,v|0;b=(h[_>>2]|0)%6|0,h[_>>2]=b;e:do if((b|0)>0)for(x=0;;){switch(g|0){case 1:{g=5;break}case 5:{g=4;break}case 4:{g=6;break}case 6:{g=2;break}case 2:{g=3;break}case 3:{g=1;break}default:}if(x=x+1|0,(x|0)==(b|0))break e}while(!1);if(q=tt(p|0,m|0,45)|0,ee()|0,U=q&127,U>>>0>121)return v=5,v|0;M=ll(p,m)|0,x=tt(p|0,m|0,52)|0,ee()|0,x=x&15;e:do if(!x)N=15;else{for(;;){if(b=(15-x|0)*3|0,E=tt(p|0,m|0,b|0)|0,ee()|0,E=E&7,(E|0)==7){m=5;break}if(K=(bc(x)|0)==0,x=x+-1|0,j=ft(7,0,b|0)|0,m=m&~(ee()|0),X=ft(h[(K?432:16)+(E*28|0)+(g<<2)>>2]|0,0,b|0)|0,b=ee()|0,g=h[(K?640:224)+(E*28|0)+(g<<2)>>2]|0,p=X|p&~j,m=b|m,!g){g=0;break e}if(!x){N=15;break e}}return m|0}while(!1);(N|0)==15&&(K=h[848+(U*28|0)+(g<<2)>>2]|0,X=ft(K|0,0,45)|0,p=X|p,m=ee()|0|m&-1040385,g=h[4272+(U*28|0)+(g<<2)>>2]|0,(K&127|0)==127&&(K=ft(h[848+(U*28|0)+20>>2]|0,0,45)|0,m=ee()|0|m&-1040385,g=h[4272+(U*28|0)+20>>2]|0,p=zm(K|p,m)|0,m=ee()|0,h[_>>2]=(h[_>>2]|0)+1)),E=tt(p|0,m|0,45)|0,ee()|0,E=E&127;e:do if(yr(E)|0){t:do if((ll(p,m)|0)==1){if((U|0)!=(E|0))if(iq(E,h[7696+(U*28|0)>>2]|0)|0){p=vL(p,m)|0,b=1,m=ee()|0;break}else di(27634,26928,533,26936);switch(M|0){case 3:{p=zm(p,m)|0,m=ee()|0,h[_>>2]=(h[_>>2]|0)+1,b=0;break t}case 5:{p=vL(p,m)|0,m=ee()|0,h[_>>2]=(h[_>>2]|0)+5,b=0;break t}case 0:return K=9,K|0;default:return K=1,K|0}}else b=0;while(!1);if((g|0)>0){x=0;do p=gL(p,m)|0,m=ee()|0,x=x+1|0;while((x|0)!=(g|0))}if((U|0)!=(E|0)){if(!(aL(E)|0)){if((b|0)!=0|(ll(p,m)|0)!=5)break;h[_>>2]=(h[_>>2]|0)+1;break}switch(q&127){case 8:case 118:break e;default:}(ll(p,m)|0)!=3&&(h[_>>2]=(h[_>>2]|0)+1)}}else if((g|0)>0){x=0;do p=zm(p,m)|0,m=ee()|0,x=x+1|0;while((x|0)!=(g|0))}while(!1);return h[_>>2]=((h[_>>2]|0)+g|0)%6|0,K=v,h[K>>2]=p,h[K+4>>2]=m,K=0,K|0}function Bce(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,eq(p,m,g,_)|0?(hp(_|0,0,g*48|0)|0,_=Oce(p,m,g,_)|0,_|0):(_=0,_|0)}function eq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(K=Q,Q=Q+16|0,j=K,X=K+8|0,q=j,h[q>>2]=p,h[q+4>>2]=m,(g|0)<0)return X=2,Q=K,X|0;if(!g)return X=_,h[X>>2]=p,h[X+4>>2]=m,X=0,Q=K,X|0;h[X>>2]=0;e:do if(Zi(p,m)|0)p=9;else{v=0,q=p;do{if(p=Js(q,m,4,X,j)|0,p|0)break e;if(m=j,q=h[m>>2]|0,m=h[m+4>>2]|0,v=v+1|0,Zi(q,m)|0){p=9;break e}}while((v|0)<(g|0));U=_,h[U>>2]=q,h[U+4>>2]=m,U=g+-1|0,N=0,p=1;do{if(v=26864+(N<<2)|0,(N|0)==5)for(b=h[v>>2]|0,x=0,v=p;;){if(p=j,p=Js(h[p>>2]|0,h[p+4>>2]|0,b,X,j)|0,p|0)break e;if((x|0)!=(U|0))if(M=j,E=h[M>>2]|0,M=h[M+4>>2]|0,p=_+(v<<3)|0,h[p>>2]=E,h[p+4>>2]=M,!(Zi(E,M)|0))p=v+1|0;else{p=9;break e}else p=v;if(x=x+1|0,(x|0)>=(g|0))break;v=p}else for(b=j,M=h[v>>2]|0,E=0,v=p,x=h[b>>2]|0,b=h[b+4>>2]|0;;){if(p=Js(x,b,M,X,j)|0,p|0)break e;if(b=j,x=h[b>>2]|0,b=h[b+4>>2]|0,p=_+(v<<3)|0,h[p>>2]=x,h[p+4>>2]=b,p=v+1|0,Zi(x,b)|0){p=9;break e}if(E=E+1|0,(E|0)>=(g|0))break;v=p}N=N+1|0}while(N>>>0<6);p=j,p=(q|0)==(h[p>>2]|0)&&(m|0)==(h[p+4>>2]|0)?0:9}while(!1);return X=p,Q=K,X|0}function Oce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;if(q=Q,Q=Q+16|0,b=q,!g)return h[_>>2]=p,h[_+4>>2]=m,_=0,Q=q,_|0;do if((g|0)>=0){if((g|0)>13780509){if(v=uT(15,b)|0,v|0)break;x=b,v=h[x>>2]|0,x=h[x+4>>2]|0}else v=((g|0)<0)<<31>>31,U=wr(g|0,v|0,3,0)|0,x=ee()|0,v=At(g|0,v|0,1,0)|0,v=wr(U|0,x|0,v|0,ee()|0)|0,v=At(v|0,ee()|0,1,0)|0,x=ee()|0,U=b,h[U>>2]=v,h[U+4>>2]=x;if(N=Ea(v,8)|0,!N)v=13;else{if(U=Ea(v,4)|0,!U){_t(N),v=13;break}if(v=ah(p,m,g,N,U,v,x,0)|0,v|0){_t(N),_t(U);break}if(m=h[b>>2]|0,b=h[b+4>>2]|0,(b|0)>0|(b|0)==0&m>>>0>0){v=0,E=0,M=0;do p=N+(E<<3)|0,x=h[p>>2]|0,p=h[p+4>>2]|0,!((x|0)==0&(p|0)==0)&&(h[U+(E<<2)>>2]|0)==(g|0)&&(j=_+(v<<3)|0,h[j>>2]=x,h[j+4>>2]=p,v=v+1|0),E=At(E|0,M|0,1,0)|0,M=ee()|0;while((M|0)<(b|0)|(M|0)==(b|0)&E>>>0<m>>>0)}_t(N),_t(U),v=0}}else v=2;while(!1);return j=v,Q=q,j|0}function aT(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;for(E=Q,Q=Q+16|0,x=E,b=E+8|0,v=(Zi(p,m)|0)==0,v=v?1:2;;){if(h[b>>2]=0,N=(Js(p,m,v,b,x)|0)==0,M=x,N&((h[M>>2]|0)==(g|0)?(h[M+4>>2]|0)==(_|0):0)){p=4;break}if(v=v+1|0,v>>>0>=7){v=7,p=4;break}}return(p|0)==4?(Q=E,v|0):0}function Uce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;if(E=Q,Q=Q+48|0,v=E+16|0,x=E+8|0,b=E,g=Jx(g)|0,g|0)return b=g,Q=E,b|0;if(N=p,M=h[N+4>>2]|0,g=x,h[g>>2]=h[N>>2],h[g+4>>2]=M,yq(x,v),g=aq(v,m,b)|0,!g){if(m=h[x>>2]|0,x=h[p+8>>2]|0,(x|0)>0){v=h[p+12>>2]|0,g=0;do m=(h[v+(g<<3)>>2]|0)+m|0,g=g+1|0;while((g|0)<(x|0))}g=b,v=h[g>>2]|0,g=h[g+4>>2]|0,x=((m|0)<0)<<31>>31,(g|0)<(x|0)|(g|0)==(x|0)&v>>>0<m>>>0?(g=b,h[g>>2]=m,h[g+4>>2]=x,g=x):m=v,M=At(m|0,g|0,12,0)|0,N=ee()|0,g=b,h[g>>2]=M,h[g+4>>2]=N,g=_,h[g>>2]=M,h[g+4>>2]=N,g=0}return N=g,Q=E,N|0}function tq(p,m,g,_,v,x,b){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0;var E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0,Ma=0;if(bi=Q,Q=Q+64|0,Ut=bi+48|0,lt=bi+32|0,pt=bi+24|0,Be=bi+8|0,Ke=bi,M=h[p>>2]|0,(M|0)<=0)return pi=0,Q=bi,pi|0;for(Me=p+4|0,be=Ut+8|0,gt=lt+8|0,je=Be+8|0,E=0,we=0;;){N=h[Me>>2]|0,se=N+(we<<4)|0,h[Ut>>2]=h[se>>2],h[Ut+4>>2]=h[se+4>>2],h[Ut+8>>2]=h[se+8>>2],h[Ut+12>>2]=h[se+12>>2],(we|0)==(M+-1|0)?(h[lt>>2]=h[N>>2],h[lt+4>>2]=h[N+4>>2],h[lt+8>>2]=h[N+8>>2],h[lt+12>>2]=h[N+12>>2]):(se=N+(we+1<<4)|0,h[lt>>2]=h[se>>2],h[lt+4>>2]=h[se+4>>2],h[lt+8>>2]=h[se+8>>2],h[lt+12>>2]=h[se+12>>2]),M=Jce(Ut,lt,_,pt)|0;e:do if(M)N=0,E=M;else if(M=pt,N=h[M>>2]|0,M=h[M+4>>2]|0,(M|0)>0|(M|0)==0&N>>>0>0){xe=0,se=0;t:for(;;){if(Vn=1/(+(N>>>0)+4294967296*+(M|0)),Ma=+ie[Ut>>3],M=eo(N|0,M|0,xe|0,se|0)|0,wi=+(M>>>0)+4294967296*+(ee()|0),Ro=+(xe>>>0)+4294967296*+(se|0),ie[Be>>3]=Vn*(Ma*wi)+Vn*(+ie[lt>>3]*Ro),ie[je>>3]=Vn*(+ie[be>>3]*wi)+Vn*(+ie[gt>>3]*Ro),M=_L(Be,_,Ke)|0,M|0){E=M;break}ue=Ke,ae=h[ue>>2]|0,ue=h[ue+4>>2]|0,j=jf(ae|0,ue|0,m|0,g|0)|0,U=ee()|0,M=b+(j<<3)|0,q=M,N=h[q>>2]|0,q=h[q+4>>2]|0;n:do if((N|0)==0&(q|0)==0)Ae=M,pi=16;else for(X=0,K=0;;){if((X|0)>(g|0)|(X|0)==(g|0)&K>>>0>m>>>0){E=1;break t}if((N|0)==(ae|0)&(q|0)==(ue|0))break n;if(M=At(j|0,U|0,1,0)|0,j=up(M|0,ee()|0,m|0,g|0)|0,U=ee()|0,K=At(K|0,X|0,1,0)|0,X=ee()|0,M=b+(j<<3)|0,q=M,N=h[q>>2]|0,q=h[q+4>>2]|0,(N|0)==0&(q|0)==0){Ae=M,pi=16;break}}while(!1);if((pi|0)==16&&(pi=0,!((ae|0)==0&(ue|0)==0))&&(K=Ae,h[K>>2]=ae,h[K+4>>2]=ue,K=x+(h[v>>2]<<3)|0,h[K>>2]=ae,h[K+4>>2]=ue,K=v,K=At(h[K>>2]|0,h[K+4>>2]|0,1,0)|0,ae=ee()|0,ue=v,h[ue>>2]=K,h[ue+4>>2]=ae),xe=At(xe|0,se|0,1,0)|0,se=ee()|0,M=pt,N=h[M>>2]|0,M=h[M+4>>2]|0,!((M|0)>(se|0)|(M|0)==(se|0)&N>>>0>xe>>>0)){N=1;break e}}N=0}else N=1;while(!1);if(we=we+1|0,!N){pi=21;break}if(M=h[p>>2]|0,(we|0)>=(M|0)){E=0,pi=21;break}}return(pi|0)==21?(Q=bi,E|0):0}function kce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0;if(wi=Q,Q=Q+112|0,pi=wi+80|0,M=wi+72|0,bi=wi,Ro=wi+56|0,v=Jx(g)|0,v|0)return Vn=v,Q=wi,Vn|0;if(N=p+8|0,Vn=br((h[N>>2]<<5)+32|0)|0,!Vn)return Vn=13,Q=wi,Vn|0;if(EL(p,Vn),v=Jx(g)|0,!v){if(lt=p,pt=h[lt+4>>2]|0,v=M,h[v>>2]=h[lt>>2],h[v+4>>2]=pt,yq(M,pi),v=aq(pi,m,bi)|0,v)lt=0,pt=0;else{if(v=h[M>>2]|0,x=h[N>>2]|0,(x|0)>0){b=h[p+12>>2]|0,g=0;do v=(h[b+(g<<3)>>2]|0)+v|0,g=g+1|0;while((g|0)!=(x|0));g=v}else g=v;v=bi,x=h[v>>2]|0,v=h[v+4>>2]|0,b=((g|0)<0)<<31>>31,(v|0)<(b|0)|(v|0)==(b|0)&x>>>0<g>>>0?(v=bi,h[v>>2]=g,h[v+4>>2]=b,v=b):g=x,lt=At(g|0,v|0,12,0)|0,pt=ee()|0,v=bi,h[v>>2]=lt,h[v+4>>2]=pt,v=0}if(!v){if(g=Ea(lt,8)|0,!g)return _t(Vn),Vn=13,Q=wi,Vn|0;if(E=Ea(lt,8)|0,!E)return _t(Vn),_t(g),Vn=13,Q=wi,Vn|0;je=pi,h[je>>2]=0,h[je+4>>2]=0,je=p,Ut=h[je+4>>2]|0,v=M,h[v>>2]=h[je>>2],h[v+4>>2]=Ut,v=tq(M,lt,pt,m,pi,g,E)|0;e:do if(v)_t(g),_t(E),_t(Vn);else{t:do if((h[N>>2]|0)>0){for(b=p+12|0,x=0;v=tq((h[b>>2]|0)+(x<<3)|0,lt,pt,m,pi,g,E)|0,x=x+1|0,!(v|0);)if((x|0)>=(h[N>>2]|0))break t;_t(g),_t(E),_t(Vn);break e}while(!1);(pt|0)>0|(pt|0)==0&lt>>>0>0&&hp(E|0,0,lt<<3|0)|0,Ut=pi,je=h[Ut+4>>2]|0;t:do if((je|0)>0|(je|0)==0&(h[Ut>>2]|0)>>>0>0){Me=g,be=E,gt=g,je=E,Ut=g,v=g,Ae=g,Be=E,Ke=E,g=E;n:for(;;){for(ue=0,xe=0,se=0,we=0,x=0,b=0;;){E=bi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));if(m=Me+(ue<<3)|0,N=h[m>>2]|0,m=h[m+4>>2]|0,JG(N,m,1,bi,0)|0){E=bi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));E=Ea(7,4)|0,E|0&&(ah(N,m,1,bi,E,7,0,0)|0,_t(E))}for(ae=0;;){K=bi+(ae<<3)|0,X=h[K>>2]|0,K=h[K+4>>2]|0;i:do if((X|0)==0&(K|0)==0)E=x,M=b;else{if(U=jf(X|0,K|0,lt|0,pt|0)|0,N=ee()|0,E=_+(U<<3)|0,m=E,M=h[m>>2]|0,m=h[m+4>>2]|0,!((M|0)==0&(m|0)==0)){q=0,j=0;do{if((q|0)>(pt|0)|(q|0)==(pt|0)&j>>>0>lt>>>0)break n;if((M|0)==(X|0)&(m|0)==(K|0)){E=x,M=b;break i}E=At(U|0,N|0,1,0)|0,U=up(E|0,ee()|0,lt|0,pt|0)|0,N=ee()|0,j=At(j|0,q|0,1,0)|0,q=ee()|0,E=_+(U<<3)|0,m=E,M=h[m>>2]|0,m=h[m+4>>2]|0}while(!((M|0)==0&(m|0)==0))}if((X|0)==0&(K|0)==0){E=x,M=b;break}S1(X,K,Ro)|0,ML(p,Vn,Ro)|0&&(j=At(x|0,b|0,1,0)|0,b=ee()|0,q=E,h[q>>2]=X,h[q+4>>2]=K,x=be+(x<<3)|0,h[x>>2]=X,h[x+4>>2]=K,x=j),E=x,M=b}while(!1);if(ae=ae+1|0,ae>>>0>=7)break;x=E,b=M}if(ue=At(ue|0,xe|0,1,0)|0,xe=ee()|0,se=At(se|0,we|0,1,0)|0,we=ee()|0,b=pi,x=h[b>>2]|0,b=h[b+4>>2]|0,(we|0)<(b|0)|(we|0)==(b|0)&se>>>0<x>>>0)x=E,b=M;else break}if((b|0)>0|(b|0)==0&x>>>0>0){x=0,b=0;do we=Me+(x<<3)|0,h[we>>2]=0,h[we+4>>2]=0,x=At(x|0,b|0,1,0)|0,b=ee()|0,we=pi,se=h[we+4>>2]|0;while((b|0)<(se|0)|((b|0)==(se|0)?x>>>0<(h[we>>2]|0)>>>0:0))}if(we=pi,h[we>>2]=E,h[we+4>>2]=M,(M|0)>0|(M|0)==0&E>>>0>0)ae=g,ue=Ke,xe=Ut,se=Be,we=be,g=Ae,Ke=v,Be=gt,Ae=ae,v=ue,Ut=je,je=xe,gt=se,be=Me,Me=we;else break t}_t(gt),_t(je),_t(Vn),v=1;break e}else v=E;while(!1);_t(Vn),_t(g),_t(v),v=0}while(!1);return Vn=v,Q=wi,Vn|0}}return _t(Vn),Vn=v,Q=wi,Vn|0}function zce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0;if(E=Q,Q=Q+16|0,b=E,p=tue(p,m,((m|0)<0)<<31>>31,b)|0,p|0)return b=p,Q=E,b|0;if(x=Bue(b,g)|0,g=b+4|0,(h[b>>2]|0)>0){m=0;do{if(v=h[g>>2]|0,_=v+(m<<4)+4|0,_t(h[_>>2]|0),h[_>>2]=0,h[v+(m<<4)>>2]=0,_=v+(m<<4)+8|0,v=v+(m<<4)+12|0,(h[_>>2]|0)>0){p=0;do M=h[v>>2]|0,N=M+(p<<3)+4|0,_t(h[N>>2]|0),h[N>>2]=0,h[M+(p<<3)>>2]=0,p=p+1|0;while((p|0)<(h[_>>2]|0))}_t(h[v>>2]|0),h[v>>2]=0,h[_>>2]=0,m=m+1|0}while((m|0)<(h[b>>2]|0))}return _t(h[g>>2]|0),h[g>>2]=0,h[b>>2]=0,N=x,Q=E,N|0}function yc(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;if(b=h[p>>2]|0,(b|0)<=0)return v=0,_=0,b=v<0,_=12.566370614359172-_,_=v+_,v=b?_:v,ie[m>>3]=v,0;if(x=h[p+4>>2]|0,p=(b|0)!=1&1,E=+ie[x>>3]*.5+.7853981633974483,v=+ie[x+(p<<4)>>3]*.5+.7853981633974483,g=+zi(+E)*+zi(+v),_=+ie[x+(p<<4)+8>>3]-+ie[x+8>>3],g=+Ta(+(+zi(+_)*g),+(+ii(+E)*+ii(+v)+ +ii(+_)*g))*-2,_=g+0,g=_-g,(b|0)==1)return E=_,v=g,b=E<0,v=12.566370614359172-v,v=E+v,E=b?v:E,ie[m>>3]=E,0;for(p=1,v=_;U=p,p=p+1|0,q=(p|0)%(b|0)|0,N=+ie[x+(U<<4)>>3]*.5+.7853981633974483,M=+ie[x+(q<<4)>>3]*.5+.7853981633974483,_=+zi(+N)*+zi(+M),E=+ie[x+(q<<4)+8>>3]-+ie[x+(U<<4)+8>>3],g=+Ta(+(+zi(+E)*_),+(+ii(+N)*+ii(+M)+ +ii(+E)*_))*-2-g,_=v+g,g=_-v-g,!((p|0)>=(b|0));)v=_;return q=_<0,N=12.566370614359172-g,N=_+N,N=q?N:_,ie[m>>3]=N,0}function Vce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+192|0,_=b+176|0,v=b,x=b+168|0,p=Vm(p,m,v)|0,p|0?(x=p,Q=b,x|0):(h[x>>2]=h[v>>2],h[x+4>>2]=v+8,h[_>>2]=h[x>>2],h[_+4>>2]=h[x+4>>2],yc(_,g)|0,x=0,Q=b,x|0)}function Gce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+192|0,_=b+176|0,v=b,x=b+168|0,p=Vm(p,m,v)|0,p?(x=p,Q=b,x|0):(h[x>>2]=h[v>>2],h[x+4>>2]=v+8,h[_>>2]=h[x>>2],h[_+4>>2]=h[x+4>>2],yc(_,g)|0,ie[g>>3]=+ie[g>>3]*4058973249931477e-8,x=0,Q=b,x|0)}function qce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+192|0,_=b+176|0,v=b,x=b+168|0,p=Vm(p,m,v)|0,p?(x=p,Q=b,x|0):(h[x>>2]=h[v>>2],h[x+4>>2]=v+8,h[_>>2]=h[x>>2],h[_+4>>2]=h[x+4>>2],yc(_,g)|0,ie[g>>3]=+ie[g>>3]*4058973249931477e-8*1e6,x=0,Q=b,x|0)}function yr(p){return p=p|0,p>>>0>121?(p=0,p|0):(p=h[7696+(p*28|0)+16>>2]|0,p|0)}function aL(p){return p=p|0,(p|0)==4|(p|0)==117|0}function nq(p){return p=p|0,h[11120+((h[p>>2]|0)*216|0)+((h[p+4>>2]|0)*72|0)+((h[p+8>>2]|0)*24|0)+(h[p+12>>2]<<3)>>2]|0}function Hce(p){return p=p|0,h[11120+((h[p>>2]|0)*216|0)+((h[p+4>>2]|0)*72|0)+((h[p+8>>2]|0)*24|0)+(h[p+12>>2]<<3)+4>>2]|0}function Wce(p,m){p=p|0,m=m|0,p=7696+(p*28|0)|0,h[m>>2]=h[p>>2],h[m+4>>2]=h[p+4>>2],h[m+8>>2]=h[p+8>>2],h[m+12>>2]=h[p+12>>2]}function jce(p,m){p=p|0,m=m|0;var g=0,_=0;if(m>>>0>20)return m=-1,m|0;do if((h[11120+(m*216|0)>>2]|0)!=(p|0))if((h[11120+(m*216|0)+8>>2]|0)!=(p|0))if((h[11120+(m*216|0)+16>>2]|0)!=(p|0))if((h[11120+(m*216|0)+24>>2]|0)!=(p|0))if((h[11120+(m*216|0)+32>>2]|0)!=(p|0))if((h[11120+(m*216|0)+40>>2]|0)!=(p|0))if((h[11120+(m*216|0)+48>>2]|0)!=(p|0))if((h[11120+(m*216|0)+56>>2]|0)!=(p|0))if((h[11120+(m*216|0)+64>>2]|0)!=(p|0))if((h[11120+(m*216|0)+72>>2]|0)!=(p|0))if((h[11120+(m*216|0)+80>>2]|0)!=(p|0))if((h[11120+(m*216|0)+88>>2]|0)!=(p|0))if((h[11120+(m*216|0)+96>>2]|0)!=(p|0))if((h[11120+(m*216|0)+104>>2]|0)!=(p|0))if((h[11120+(m*216|0)+112>>2]|0)!=(p|0))if((h[11120+(m*216|0)+120>>2]|0)!=(p|0))if((h[11120+(m*216|0)+128>>2]|0)!=(p|0))if((h[11120+(m*216|0)+136>>2]|0)==(p|0))p=2,g=1,_=2;else{if((h[11120+(m*216|0)+144>>2]|0)==(p|0)){p=0,g=2,_=0;break}if((h[11120+(m*216|0)+152>>2]|0)==(p|0)){p=0,g=2,_=1;break}if((h[11120+(m*216|0)+160>>2]|0)==(p|0)){p=0,g=2,_=2;break}if((h[11120+(m*216|0)+168>>2]|0)==(p|0)){p=1,g=2,_=0;break}if((h[11120+(m*216|0)+176>>2]|0)==(p|0)){p=1,g=2,_=1;break}if((h[11120+(m*216|0)+184>>2]|0)==(p|0)){p=1,g=2,_=2;break}if((h[11120+(m*216|0)+192>>2]|0)==(p|0)){p=2,g=2,_=0;break}if((h[11120+(m*216|0)+200>>2]|0)==(p|0)){p=2,g=2,_=1;break}if((h[11120+(m*216|0)+208>>2]|0)==(p|0)){p=2,g=2,_=2;break}else p=-1;return p|0}else p=2,g=1,_=1;else p=2,g=1,_=0;else p=1,g=1,_=2;else p=1,g=1,_=1;else p=1,g=1,_=0;else p=0,g=1,_=2;else p=0,g=1,_=1;else p=0,g=1,_=0;else p=2,g=0,_=2;else p=2,g=0,_=1;else p=2,g=0,_=0;else p=1,g=0,_=2;else p=1,g=0,_=1;else p=1,g=0,_=0;else p=0,g=0,_=2;else p=0,g=0,_=1;else p=0,g=0,_=0;while(!1);return m=h[11120+(m*216|0)+(g*72|0)+(p*24|0)+(_<<3)+4>>2]|0,m|0}function iq(p,m){return p=p|0,m=m|0,(h[7696+(p*28|0)+20>>2]|0)==(m|0)?(m=1,m|0):(m=(h[7696+(p*28|0)+24>>2]|0)==(m|0),m|0)}function lL(p,m){return p=p|0,m=m|0,h[848+(p*28|0)+(m<<2)>>2]|0}function cL(p,m){return p=p|0,m=m|0,(h[848+(p*28|0)>>2]|0)==(m|0)?(m=0,m|0):(h[848+(p*28|0)+4>>2]|0)==(m|0)?(m=1,m|0):(h[848+(p*28|0)+8>>2]|0)==(m|0)?(m=2,m|0):(h[848+(p*28|0)+12>>2]|0)==(m|0)?(m=3,m|0):(h[848+(p*28|0)+16>>2]|0)==(m|0)?(m=4,m|0):(h[848+(p*28|0)+20>>2]|0)==(m|0)?(m=5,m|0):((h[848+(p*28|0)+24>>2]|0)==(m|0)?6:7)|0}function Xce(){return 122}function $ce(p){p=p|0;var m=0,g=0,_=0;m=0;do ft(m|0,0,45)|0,_=ee()|0|134225919,g=p+(m<<3)|0,h[g>>2]=-1,h[g+4>>2]=_,m=m+1|0;while((m|0)!=122);return 0}function Yce(p){p=p|0;var m=0,g=0,_=0;return _=+ie[p+16>>3],g=+ie[p+24>>3],m=_-g,+(_<g?m+6.283185307179586:m)}function Zce(p){return p=p|0,+ie[p+16>>3]<+ie[p+24>>3]|0}function Kce(p){return p=p|0,+(+ie[p>>3]-+ie[p+8>>3])}function rq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;return g=+ie[m>>3],!(g>=+ie[p+8>>3])||!(g<=+ie[p>>3])?(m=0,m|0):(_=+ie[p+16>>3],g=+ie[p+24>>3],v=+ie[m+8>>3],m=v>=g,p=v<=_&1,_<g?m&&(p=1):m||(p=0),m=(p|0)!=0,m|0)}function uL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;return+ie[p>>3]<+ie[m+8>>3]||+ie[p+8>>3]>+ie[m>>3]?(_=0,_|0):(x=+ie[p+16>>3],g=p+24|0,U=+ie[g>>3],b=x<U,_=m+16|0,N=+ie[_>>3],v=m+24|0,M=+ie[v>>3],E=N<M,m=U-N<M-x,p=b?E|m?1:2:0,m=E?b?1:m?2:1:0,x=+zl(x,p),x<+zl(+ie[v>>3],m)||(U=+zl(+ie[g>>3],p),U>+zl(+ie[_>>3],m))?(E=0,E|0):(E=1,E|0))}function Qce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0;x=+ie[p+16>>3],M=+ie[p+24>>3],p=x<M,E=+ie[m+16>>3],b=+ie[m+24>>3],v=E<b,m=M-E<b-x,h[g>>2]=p?v|m?1:2:0,h[_>>2]=v?p?1:m?2:1:0}function sq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;return+ie[p>>3]<+ie[m>>3]||+ie[p+8>>3]>+ie[m+8>>3]?(_=0,_|0):(_=p+16|0,M=+ie[_>>3],x=+ie[p+24>>3],b=M<x,g=m+16|0,U=+ie[g>>3],v=m+24|0,N=+ie[v>>3],E=U<N,m=x-U<N-M,p=b?E|m?1:2:0,m=E?b?1:m?2:1:0,x=+zl(x,p),x<=+zl(+ie[v>>3],m)?(U=+zl(+ie[_>>3],p),E=U>=+zl(+ie[g>>3],m),E|0):(E=0,E|0))}function oq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0;v=Q,Q=Q+176|0,_=v,h[_>>2]=4,E=+ie[m>>3],ie[_+8>>3]=E,x=+ie[m+16>>3],ie[_+16>>3]=x,ie[_+24>>3]=E,E=+ie[m+24>>3],ie[_+32>>3]=E,b=+ie[m+8>>3],ie[_+40>>3]=b,ie[_+48>>3]=E,ie[_+56>>3]=b,ie[_+64>>3]=x,m=_+72|0,g=m+96|0;do h[m>>2]=0,m=m+4|0;while((m|0)<(g|0));du(p|0,_|0,168)|0,Q=v}function aq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0;K=Q,Q=Q+288|0,U=K+264|0,q=K+96|0,N=K,E=N,M=E+96|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));return m=yL(m,N)|0,m|0?(X=m,Q=K,X|0):(M=N,N=h[M>>2]|0,M=h[M+4>>2]|0,S1(N,M,U)|0,Vm(N,M,q)|0,b=+Zx(U,q+8|0),ie[U>>3]=+ie[p>>3],M=U+8|0,ie[M>>3]=+ie[p+16>>3],ie[q>>3]=+ie[p+8>>3],N=q+8|0,ie[N>>3]=+ie[p+24>>3],v=+Zx(U,q),ue=+ie[M>>3]-+ie[N>>3],x=+Qs(+ue),ae=+ie[U>>3]-+ie[q>>3],_=+Qs(+ae),!(ue==0|ae==0)&&(ue=+Nq(+x,+_),ue=+y1(+(v*v/+gT(+(ue/+gT(+x,+_)),3)/(b*(b*2.59807621135)*.8))),ie[or>>3]=ue,j=~~ue>>>0,X=+Qs(ue)>=1?ue>0?~~+oL(+fo(ue/4294967296),4294967295)>>>0:~~+y1((ue-+(~~ue>>>0))/4294967296)>>>0:0,(h[or+4>>2]&2146435072|0)!=2146435072)?(q=(j|0)==0&(X|0)==0,m=g,h[m>>2]=q?1:j,h[m+4>>2]=q?0:X,m=0):m=1,X=m,Q=K,X|0)}function Jce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0;N=Q,Q=Q+288|0,b=N+264|0,E=N+96|0,M=N,v=M,x=v+96|0;do h[v>>2]=0,v=v+4|0;while((v|0)<(x|0));return g=yL(g,M)|0,g|0?(_=g,Q=N,_|0):(g=M,v=h[g>>2]|0,g=h[g+4>>2]|0,S1(v,g,b)|0,Vm(v,g,E)|0,U=+Zx(b,E+8|0),U=+y1(+(+Zx(p,m)/(U*2))),ie[or>>3]=U,g=~~U>>>0,v=+Qs(U)>=1?U>0?~~+oL(+fo(U/4294967296),4294967295)>>>0:~~+y1((U-+(~~U>>>0))/4294967296)>>>0:0,(h[or+4>>2]&2146435072|0)==2146435072?(_=1,Q=N,_|0):(M=(g|0)==0&(v|0)==0,h[_>>2]=M?1:g,h[_+4>>2]=M?0:v,_=0,Q=N,_|0))}function eue(p,m){p=p|0,m=+m;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;x=p+16|0,b=+ie[x>>3],g=p+24|0,v=+ie[g>>3],_=b-v,_=b<v?_+6.283185307179586:_,N=+ie[p>>3],E=p+8|0,M=+ie[E>>3],U=N-M,_=(_*m-_)*.5,m=(U*m-U)*.5,N=N+m,ie[p>>3]=N>1.5707963267948966?1.5707963267948966:N,m=M-m,ie[E>>3]=m<-1.5707963267948966?-1.5707963267948966:m,m=b+_,m=m>3.141592653589793?m+-6.283185307179586:m,ie[x>>3]=m<-3.141592653589793?m+6.283185307179586:m,m=v-_,m=m>3.141592653589793?m+-6.283185307179586:m,ie[g>>3]=m<-3.141592653589793?m+6.283185307179586:m}function tue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0;if(pt=Q,Q=Q+224|0,gt=pt,Be=pt+48|0,M=(g|0)>0|(g|0)==0&m>>>0>0,M&(g>>>0>0|(g|0)==0&m>>>0>17895697))return lt=14,Q=pt,lt|0;if((g|0)<0)return lt=2,Q=pt,lt|0;if((m|0)==0&(g|0)==0)return h[_>>2]=0,h[_+4>>2]=0,lt=0,Q=pt,lt|0;for(v=p,v=pL(h[v>>2]|0,h[v+4>>2]|0)|0,b=0,E=0;;){if(x=p+(b<<3)|0,lt=x,!(cT(h[lt>>2]|0,h[lt+4>>2]|0)|0)){v=5,je=159;break}if(lt=x,lt=(pL(h[lt>>2]|0,h[lt+4>>2]|0)|0)==(v|0),b=At(b|0,E|0,1,0)|0,E=ee()|0,!lt){v=12,je=159;break}if(!((E|0)<(g|0)|(E|0)==(g|0)&b>>>0<m>>>0)){je=8;break}}if((je|0)==8){do if((g|0)>0|(g|0)==0&m>>>0>1){if(v=m<<3,b=br(v)|0,!b)return lt=13,Q=pt,lt|0;for(du(b|0,p|0,v|0)|0,dT(b,m,8,1),v=1,x=0;Ut=b+(v<<3)|0,lt=b+(v+-1<<3)|0,lt=(h[Ut>>2]|0)==(h[lt>>2]|0)?(h[Ut+4>>2]|0)==(h[lt+4>>2]|0):0,v=At(v|0,x|0,1,0)|0,x=ee()|0,!lt;)if(!((x|0)<(g|0)|(x|0)==(g|0)&v>>>0<m>>>0)){je=14;break}if((je|0)==14){_t(b);break}return _t(b),lt=10,Q=pt,lt|0}while(!1);if(v=wr(m|0,g|0,6,0)|0,x=ee()|0,M){b=0,E=0;do lt=p+(E<<3)|0,lt=((Zi(h[lt>>2]|0,h[lt+4>>2]|0)|0)!=0)<<31>>31,v=At(v|0,x|0,lt|0,((lt|0)<0)<<31>>31|0)|0,x=ee()|0,E=At(E|0,b|0,1,0)|0,b=ee()|0;while((b|0)<(g|0)|(b|0)==(g|0)&E>>>0<m>>>0);Ae=v,we=x}else Ae=v,we=x;if(xe=wr(Ae|0,we|0,10,0)|0,se=ee()|0,Ut=br(Ae<<5)|0,!Ut)return lt=13,Q=pt,lt|0;if(lt=Ea(xe,4)|0,!lt)return _t(Ut),lt=13,Q=pt,lt|0;e:do if(M){for(be=p,hL(h[be>>2]|0,h[be+4>>2]|0,gt)|0,X=Ut,K=0,ae=0,v=0,ue=0;;){M=gt,M=(h[M>>2]|0)==0&(h[M+4>>2]|0)==0,x=M?26990:26995,b=M?5:6,E=0,M=gt+((M&1)<<3)|0,N=At(b|0,E|0,-1,-1)|0,U=ee()|0,q=0,j=0;do Me=M+(q<<3)|0,Ke=h[Me+4>>2]|0,be=X+(q<<5)|0,h[be>>2]=h[Me>>2],h[be+4>>2]=Ke,He[X+(q<<5)+9>>0]=0,He[X+(q<<5)+8>>0]=0,h[X+(q<<5)+20>>2]=X,be=X+(q<<5)+24|0,h[be>>2]=1,h[be+4>>2]=0,be=He[x+q>>0]|0,Ke=At(N|0,U|0,q|0,j|0)|0,Ke=jf(Ke|0,ee()|0,b|0,E|0)|0,ee()|0,Ke=He[x+Ke>>0]|0,q=At(q|0,j|0,1,0)|0,j=ee()|0,Me=He[x+((q|0)==(b|0)&(j|0)==(E|0)?0:q)>>0]|0,be=be&255,h[X+(be<<5)+16>>2]=X+((Ke&255)<<5),h[X+(be<<5)+12>>2]=X+((Me&255)<<5);while(j>>>0<E>>>0|(j|0)==(E|0)&q>>>0<b>>>0);if(K=At(K|0,ae|0,1,0)|0,ae=ee()|0,v=At(b|0,E|0,v|0,ue|0)|0,ue=ee()|0,!((ae|0)<(g|0)|(ae|0)==(g|0)&K>>>0<m>>>0))break e;be=p+(K<<3)|0,hL(h[be>>2]|0,h[be+4>>2]|0,gt)|0||(X=Ut+(v<<5)|0)}di(27634,26956,108,26975)}while(!1);if((we|0)>0|(we|0)==0&Ae>>>0>0){E=0,M=0;do{if(x=Ut+(E<<5)|0,b=h[x>>2]|0,x=h[x+4>>2]|0,v=tt(b|0,x|0,30)|0,x=wr(v^b|0,(ee()|0)^x|0,484763065,-1084733587)|0,b=ee()|0,v=tt(x|0,b|0,27)|0,b=wr(v^x|0,(ee()|0)^b|0,321982955,-1798288965)|0,x=ee()|0,v=tt(b|0,x|0,31)|0,x=jf(v^b|0,(ee()|0)^x|0,xe|0,se|0)|0,b=ee()|0,v=lt+(x<<2)|0,h[v>>2]|0)do v=At(x|0,b|0,1,0)|0,x=up(v|0,ee()|0,xe|0,se|0)|0,b=ee()|0,v=lt+(x<<2)|0;while((h[v>>2]|0)!=0);h[v>>2]=Ut+(E<<5),E=At(E|0,M|0,1,0)|0,M=ee()|0}while((M|0)<(we|0)|(M|0)==(we|0)&E>>>0<Ae>>>0);q=0,j=0;do{if(E=Ut+(q<<5)|0,M=Ut+(q<<5)+9|0,!(He[M>>0]|0)){if(be=E,cq(h[be>>2]|0,h[be+4>>2]|0,gt)|0){je=39;break}U=gt,N=h[U>>2]|0,U=h[U+4>>2]|0,x=tt(N|0,U|0,30)|0,x=wr(x^N|0,(ee()|0)^U|0,484763065,-1084733587)|0,b=ee()|0,v=tt(x|0,b|0,27)|0,b=wr(v^x|0,(ee()|0)^b|0,321982955,-1798288965)|0,x=ee()|0,v=tt(b|0,x|0,31)|0,x=jf(v^b|0,(ee()|0)^x|0,xe|0,se|0)|0,b=ee()|0,v=h[lt+(x<<2)>>2]|0;e:do if(v|0){for(;be=v,!((h[be>>2]|0)==(N|0)&&(h[be+4>>2]|0)==(U|0));)if(v=At(x|0,b|0,1,0)|0,x=up(v|0,ee()|0,xe|0,se|0)|0,b=ee()|0,v=h[lt+(x<<2)>>2]|0,!v)break e;He[M>>0]=1,He[v+9>>0]=1,x=v+16|0,be=Ut+(q<<5)+12|0,h[(h[be>>2]|0)+16>>2]=h[x>>2],g=v+12|0,Me=h[Ut+(q<<5)+16>>2]|0,h[Me+12>>2]=h[g>>2],h[(h[g>>2]|0)+16>>2]=Me,h[(h[x>>2]|0)+12>>2]=h[be>>2],x=lT(E)|0,be=lT(v)|0,v=x+24|0,g=h[v+4>>2]|0,Me=be+24|0,Ke=h[Me+4>>2]|0,Me=(g|0)<(Ke|0)|((g|0)==(Ke|0)?(h[v>>2]|0)>>>0<(h[Me>>2]|0)>>>0:0),v=Me?x:be,x=Me?be:x,(x|0)!=(v|0)&&(Ke=v+24|0,be=x+24|0,Me=be,Ke=At(h[Me>>2]|0,h[Me+4>>2]|0,h[Ke>>2]|0,h[Ke+4>>2]|0)|0,Me=ee()|0,h[be>>2]=Ke,h[be+4>>2]=Me,h[v+20>>2]=x)}while(!1)}q=At(q|0,j|0,1,0)|0,j=ee()|0}while((j|0)<(we|0)|(j|0)==(we|0)&q>>>0<Ae>>>0);(je|0)==39&&di(27634,26956,258,27001),v=0,x=0;do He[Ut+(v<<5)+8>>0]=0,v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(we|0)|(x|0)==(we|0)&v>>>0<Ae>>>0);for(N=0,b=0,M=0,U=0;;){if(v=Ut+(N<<5)|0,(He[Ut+(N<<5)+8>>0]|0)==0&&(He[Ut+(N<<5)+9>>0]|0)==0){E=v,x=h[E>>2]|0,E=h[E+4>>2]|0;do He[v+8>>0]=1,v=h[v+12>>2]|0,be=v;while(!((h[be>>2]|0)==(x|0)&&(h[be+4>>2]|0)==(E|0)));b=At(b|0,M|0,1,0)|0,E=ee()|0}else E=M;if(N=At(N|0,U|0,1,0)|0,U=ee()|0,(U|0)<(we|0)|(U|0)==(we|0)&N>>>0<Ae>>>0)M=E;else break}v=0,x=0;do He[Ut+(v<<5)+8>>0]=0,v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(we|0)|(x|0)==(we|0)&v>>>0<Ae>>>0);Me=b,Ke=E,v=1}else Me=0,Ke=0,v=0;be=br(Me*24|0)|0;e:do if(be|0){t:do if(v){p=0,xe=0,g=0,m=0;n:for(;;){if(v=Ut+(p<<5)|0,(He[Ut+(p<<5)+8>>0]|0)==0&&(He[Ut+(p<<5)+9>>0]|0)==0){ue=v,ae=h[ue>>2]|0,ue=h[ue+4>>2]|0,x=0,b=0;do x=At(x|0,b|0,2,0)|0,b=ee()|0,v=h[v+12>>2]|0,se=v;while(!((h[se>>2]|0)==(ae|0)&&(h[se+4>>2]|0)==(ue|0)));if(K=br(x<<4)|0,!K)break;x=ae,b=ue,X=0,j=0,E=0,M=0;do{if(jx(x,b,Be)|0){je=69;break n}if(se=h[Be>>2]|0,U=se+-1|0,q=((U|0)<0)<<31>>31,(se|0)>1){b=E,N=0,x=M,E=0;do se=K+(b<<4)|0,M=Be+8+(N<<4)|0,h[se>>2]=h[M>>2],h[se+4>>2]=h[M+4>>2],h[se+8>>2]=h[M+8>>2],h[se+12>>2]=h[M+12>>2],b=At(b|0,x|0,1,0)|0,x=ee()|0,N=At(N|0,E|0,1,0)|0,E=ee()|0;while((E|0)<(q|0)|(E|0)==(q|0)&N>>>0<U>>>0);E=b,M=x}X=At(X|0,j|0,U|0,q|0)|0,j=ee()|0,He[v+8>>0]=1,v=h[v+12>>2]|0,b=v,x=h[b>>2]|0,b=h[b+4>>2]|0}while(!((x|0)==(ae|0)&(b|0)==(ue|0)));if(x=nhe(K,X<<4)|0,!x){je=75;break}ue=lT(v)|0,se=h[ue+4>>2]|0,v=be+(g*24|0)|0,h[v>>2]=h[ue>>2],h[v+4>>2]=se,v=be+(g*24|0)+16|0,h[v>>2]=X,h[be+(g*24|0)+20>>2]=x,h[gt>>2]=h[v>>2],h[gt+4>>2]=h[v+4>>2],yc(gt,be+(g*24|0)+8|0)|0,x=At(g|0,xe|0,1,0)|0,v=ee()|0}else x=g,v=xe;if(p=At(p|0,m|0,1,0)|0,m=ee()|0,(m|0)<(we|0)|(m|0)==(we|0)&p>>>0<Ae>>>0)xe=v,g=x;else break t}if((je|0)==69?di(27634,26956,351,27016):(je|0)==75&&_t(K),(xe|0)>0|(xe|0)==0&g>>>0>0)for(E=0,M=0,v=g,b=xe;x=h[be+(E*24|0)+20>>2]|0,x?(_t(x),x=xe,v=g):x=b,E=At(E|0,M|0,1,0)|0,M=ee()|0,(M|0)<(x|0)|(M|0)==(x|0)&E>>>0<v>>>0;)b=x;_t(be);break e}while(!1);dT(be,Me,24,2);t:do if((Me|0)==0&(Ke|0)==0){if(se=br(192)|0,se|0){if(h[se+16>>2]=0,h[se+20>>2]=0,j=se+8|0,h[j>>2]=3,v=br(48)|0,X=se+12|0,h[X>>2]=v,v|0){h[v>>2]=h[3860],h[v+4>>2]=h[3861],h[v+8>>2]=h[3862],h[v+12>>2]=h[3863],q=v+16|0,h[q>>2]=h[3864],h[q+4>>2]=h[3865],h[q+8>>2]=h[3866],h[q+12>>2]=h[3867],q=v+32|0,h[q>>2]=h[3868],h[q+4>>2]=h[3869],h[q+8>>2]=h[3870],h[q+12>>2]=h[3871],h[gt>>2]=h[j>>2],h[gt+4>>2]=h[j+4>>2],yc(gt,se)|0,h[se+40>>2]=0,h[se+44>>2]=0,q=se+32|0,h[q>>2]=3,v=br(48)|0,K=se+36|0,h[K>>2]=v;do if(!v)E=0,M=1;else{if(h[v>>2]=h[3872],h[v+4>>2]=h[3873],h[v+8>>2]=h[3874],h[v+12>>2]=h[3875],U=v+16|0,h[U>>2]=h[3876],h[U+4>>2]=h[3877],h[U+8>>2]=h[3878],h[U+12>>2]=h[3879],U=v+32|0,h[U>>2]=h[3880],h[U+4>>2]=h[3881],h[U+8>>2]=h[3882],h[U+12>>2]=h[3883],h[gt>>2]=h[q>>2],h[gt+4>>2]=h[q+4>>2],yc(gt,se+24|0)|0,h[se+64>>2]=0,h[se+68>>2]=0,U=se+56|0,h[U>>2]=3,v=br(48)|0,ae=se+60|0,h[ae>>2]=v,!v){E=0,M=2;break}if(h[v>>2]=h[3884],h[v+4>>2]=h[3885],h[v+8>>2]=h[3886],h[v+12>>2]=h[3887],N=v+16|0,h[N>>2]=h[3888],h[N+4>>2]=h[3889],h[N+8>>2]=h[3890],h[N+12>>2]=h[3891],N=v+32|0,h[N>>2]=h[3892],h[N+4>>2]=h[3893],h[N+8>>2]=h[3894],h[N+12>>2]=h[3895],h[gt>>2]=h[U>>2],h[gt+4>>2]=h[U+4>>2],yc(gt,se+48|0)|0,h[se+88>>2]=0,h[se+92>>2]=0,N=se+80|0,h[N>>2]=3,v=br(48)|0,ue=se+84|0,h[ue>>2]=v,!v){E=0,M=3;break}if(h[v>>2]=h[3896],h[v+4>>2]=h[3897],h[v+8>>2]=h[3898],h[v+12>>2]=h[3899],M=v+16|0,h[M>>2]=h[3900],h[M+4>>2]=h[3901],h[M+8>>2]=h[3902],h[M+12>>2]=h[3903],M=v+32|0,h[M>>2]=h[3904],h[M+4>>2]=h[3905],h[M+8>>2]=h[3906],h[M+12>>2]=h[3907],h[gt>>2]=h[N>>2],h[gt+4>>2]=h[N+4>>2],yc(gt,se+72|0)|0,h[se+112>>2]=0,h[se+116>>2]=0,M=se+104|0,h[M>>2]=3,v=br(48)|0,p=se+108|0,h[p>>2]=v,!v){E=0,M=4;break}if(h[v>>2]=h[3908],h[v+4>>2]=h[3909],h[v+8>>2]=h[3910],h[v+12>>2]=h[3911],E=v+16|0,h[E>>2]=h[3912],h[E+4>>2]=h[3913],h[E+8>>2]=h[3914],h[E+12>>2]=h[3915],E=v+32|0,h[E>>2]=h[3916],h[E+4>>2]=h[3917],h[E+8>>2]=h[3918],h[E+12>>2]=h[3919],h[gt>>2]=h[M>>2],h[gt+4>>2]=h[M+4>>2],yc(gt,se+96|0)|0,h[se+136>>2]=0,h[se+140>>2]=0,E=se+128|0,h[E>>2]=3,v=br(48)|0,m=se+132|0,h[m>>2]=v,!v){E=0,M=5;break}if(h[v>>2]=h[3920],h[v+4>>2]=h[3921],h[v+8>>2]=h[3922],h[v+12>>2]=h[3923],b=v+16|0,h[b>>2]=h[3924],h[b+4>>2]=h[3925],h[b+8>>2]=h[3926],h[b+12>>2]=h[3927],b=v+32|0,h[b>>2]=h[3928],h[b+4>>2]=h[3929],h[b+8>>2]=h[3930],h[b+12>>2]=h[3931],h[gt>>2]=h[E>>2],h[gt+4>>2]=h[E+4>>2],yc(gt,se+120|0)|0,h[se+160>>2]=0,h[se+164>>2]=0,b=se+152|0,h[b>>2]=3,v=br(48)|0,g=se+156|0,h[g>>2]=v,!v){E=0,M=6;break}if(h[v>>2]=h[3932],h[v+4>>2]=h[3933],h[v+8>>2]=h[3934],h[v+12>>2]=h[3935],x=v+16|0,h[x>>2]=h[3936],h[x+4>>2]=h[3937],h[x+8>>2]=h[3938],h[x+12>>2]=h[3939],x=v+32|0,h[x>>2]=h[3940],h[x+4>>2]=h[3941],h[x+8>>2]=h[3942],h[x+12>>2]=h[3943],h[gt>>2]=h[b>>2],h[gt+4>>2]=h[b+4>>2],yc(gt,se+144|0)|0,h[se+184>>2]=0,h[se+188>>2]=0,x=se+176|0,h[x>>2]=3,v=br(48)|0,xe=se+180|0,h[xe>>2]=v,!v){E=0,M=7;break}if(h[v>>2]=h[3944],h[v+4>>2]=h[3945],h[v+8>>2]=h[3946],h[v+12>>2]=h[3947],Be=v+16|0,h[Be>>2]=h[3948],h[Be+4>>2]=h[3949],h[Be+8>>2]=h[3950],h[Be+12>>2]=h[3951],v=v+32|0,h[v>>2]=h[3952],h[v+4>>2]=h[3953],h[v+8>>2]=h[3954],h[v+12>>2]=h[3955],h[gt>>2]=h[x>>2],h[gt+4>>2]=h[x+4>>2],yc(gt,se+168|0)|0,dT(se,8,24,3),v=br(128)|0,h[_+4>>2]=v,v|0){h[_>>2]=8,h[v>>2]=h[j>>2],h[v+4>>2]=h[j+4>>2],h[v+8>>2]=h[j+8>>2],h[v+12>>2]=h[j+12>>2],je=v+16|0,h[je>>2]=h[q>>2],h[je+4>>2]=h[q+4>>2],h[je+8>>2]=h[q+8>>2],h[je+12>>2]=h[q+12>>2],je=v+32|0,h[je>>2]=h[U>>2],h[je+4>>2]=h[U+4>>2],h[je+8>>2]=h[U+8>>2],h[je+12>>2]=h[U+12>>2],je=v+48|0,h[je>>2]=h[N>>2],h[je+4>>2]=h[N+4>>2],h[je+8>>2]=h[N+8>>2],h[je+12>>2]=h[N+12>>2],je=v+64|0,h[je>>2]=h[M>>2],h[je+4>>2]=h[M+4>>2],h[je+8>>2]=h[M+8>>2],h[je+12>>2]=h[M+12>>2],je=v+80|0,h[je>>2]=h[E>>2],h[je+4>>2]=h[E+4>>2],h[je+8>>2]=h[E+8>>2],h[je+12>>2]=h[E+12>>2],je=v+96|0,h[je>>2]=h[b>>2],h[je+4>>2]=h[b+4>>2],h[je+8>>2]=h[b+8>>2],h[je+12>>2]=h[b+12>>2],je=v+112|0,h[je>>2]=h[x>>2],h[je+4>>2]=h[x+4>>2],h[je+8>>2]=h[x+8>>2],h[je+12>>2]=h[x+12>>2],_t(se),je=158;break t}v=h[X>>2]|0,v|0&&_t(v),v=h[K>>2]|0,v|0&&_t(v),v=h[ae>>2]|0,v|0&&_t(v),v=h[ue>>2]|0,v|0&&_t(v),v=h[p>>2]|0,v|0&&_t(v),v=h[m>>2]|0,v|0&&_t(v),v=h[g>>2]|0,v|0&&_t(v),v=h[xe>>2]|0,v|0&&_t(v),_t(se);break t}while(!1);v=0,b=0;do x=h[se+(v*24|0)+12>>2]|0,x|0&&_t(x),v=At(v|0,b|0,1,0)|0,b=ee()|0;while(b>>>0<E>>>0|(b|0)==(E|0)&v>>>0<M>>>0)}_t(se),je=152}}else{if((Ke|0)>0|(Ke|0)==0&Me>>>0>0){b=0,E=0,M=0,x=0,v=0,N=0;do Be=be+(b*24|0)|0,gt=E,E=h[Be>>2]|0,je=M,M=h[Be+4>>2]|0,x=At(x|0,v|0,((E|0)!=(gt|0)|(M|0)!=(je|0))&1|0,0)|0,v=ee()|0,b=At(b|0,N|0,1,0)|0,N=ee()|0;while((N|0)<(Ke|0)|(N|0)==(Ke|0)&b>>>0<Me>>>0);ue=x,ae=v}else ue=0,ae=0;if(p=br(ue*24|0)|0,p){n:do if((Ke|0)>=0){for(j=0,X=0,x=0,b=0,K=0,E=0;;){if(!((j|0)==(Me|0)&(X|0)==(Ke|0))&&(gt=be+(x*24|0)|0,je=be+(j*24|0)|0,(h[gt>>2]|0)==(h[je>>2]|0)?(h[gt+4>>2]|0)==(h[je+4>>2]|0):0))v=K;else{if(U=be+(x*24|0)|0,je=eo(j|0,X|0,x|0,b|0)|0,gt=ee()|0,q=At(je|0,gt|0,-1,-1)|0,b=ee()|0,(gt|0)>0|(gt|0)==0&je>>>0>1){if(v=br(q<<3)|0,!v)break;M=0,N=0;do je=M,M=At(M|0,N|0,1,0)|0,N=ee()|0,Be=U+(M*24|0)+16|0,gt=h[Be+4>>2]|0,je=v+(je<<3)|0,h[je>>2]=h[Be>>2],h[je+4>>2]=gt;while((N|0)<(b|0)|(N|0)==(b|0)&M>>>0<q>>>0)}else v=0;gt=be+(x*24|0)+16|0,je=h[gt+4>>2]|0,b=p+(E*24|0)+8|0,h[b>>2]=h[gt>>2],h[b+4>>2]=je,h[p+(E*24|0)+16>>2]=q,h[p+(E*24|0)+20>>2]=v,ie[p+(E*24|0)>>3]=+ie[be+(x*24|0)+8>>3],E=At(E|0,K|0,1,0)|0,x=j,b=X,v=ee()|0}if(je=j,j=At(j|0,X|0,1,0)|0,gt=X,X=ee()|0,(gt|0)<(Ke|0)|(gt|0)==(Ke|0)&je>>>0<Me>>>0)K=v;else break n}if((K|0)>0|(K|0)==0&E>>>0>0){v=0,b=0;do x=h[p+(v*24|0)+20>>2]|0,x|0&&_t(x),v=At(v|0,b|0,1,0)|0,b=ee()|0;while((b|0)<(K|0)|(b|0)==(K|0)&v>>>0<E>>>0)}_t(p),je=152;break t}while(!1);if(dT(p,ue,24,3),v=br(ue<<4)|0,b=_+4|0,h[b>>2]=v,v){h[_>>2]=ue;do if((ae|0)>0|(ae|0)==0&ue>>>0>0){if(_=p+8|0,h[v>>2]=h[_>>2],h[v+4>>2]=h[_+4>>2],h[v+8>>2]=h[_+8>>2],h[v+12>>2]=h[_+12>>2],(ue|0)==1&(ae|0)==0||(_=v+16|0,je=p+32|0,h[_>>2]=h[je>>2],h[_+4>>2]=h[je+4>>2],h[_+8>>2]=h[je+8>>2],h[_+12>>2]=h[je+12>>2],!((ae|0)>0|(ae|0)==0&ue>>>0>2)))break;v=2,x=0;do _=(h[b>>2]|0)+(v<<4)|0,je=p+(v*24|0)+8|0,h[_>>2]=h[je>>2],h[_+4>>2]=h[je+4>>2],h[_+8>>2]=h[je+8>>2],h[_+12>>2]=h[je+12>>2],v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(ae|0)|(x|0)==(ae|0)&v>>>0<ue>>>0)}while(!1);_t(p),je=158;break}else{if((ae|0)>0|(ae|0)==0&ue>>>0>0){v=0,b=0;do x=h[p+(v*24|0)+20>>2]|0,x|0&&_t(x),v=At(v|0,b|0,1,0)|0,b=ee()|0;while((b|0)<(ae|0)|(b|0)==(ae|0)&v>>>0<ue>>>0)}_t(p),je=152;break}}else je=152}while(!1);if((je|0)==158)return _t(Ut),_t(lt),_t(be),lt=0,Q=pt,lt|0;if((je|0)==152&&(Ke|0)>0|(Ke|0)==0&Me>>>0>0)for(E=0,M=0,v=Me,b=Ke;x=h[be+(E*24|0)+20>>2]|0,x?(_t(x),x=Ke,v=Me):x=b,E=At(E|0,M|0,1,0)|0,M=ee()|0,(M|0)<(x|0)|(M|0)==(x|0)&E>>>0<v>>>0;)b=x;return _t(be),_t(Ut),_t(lt),lt=13,Q=pt,lt|0}while(!1);return _t(Ut),_t(lt),lt=13,Q=pt,lt|0}else if((je|0)==159)return Q=pt,v|0;return 0}function nue(p,m){p=p|0,m=m|0;var g=0,_=0;return _=p,p=h[_>>2]|0,_=h[_+4>>2]|0,g=m,m=h[g>>2]|0,g=h[g+4>>2]|0,(_>>>0<g>>>0|(_|0)==(g|0)&p>>>0<m>>>0?-1:(_>>>0>g>>>0|(_|0)==(g|0)&p>>>0>m>>>0)&1)|0}function lT(p){p=p|0;var m=0,g=0;return m=p+20|0,g=h[m>>2]|0,(g|0)==(p|0)?p|0:(g=lT(g)|0,h[m>>2]=g,g|0)}function iue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0;return E=p,b=h[E>>2]|0,E=h[E+4>>2]|0,x=m,v=h[x>>2]|0,x=h[x+4>>2]|0,E>>>0<x>>>0|(E|0)==(x|0)&b>>>0<v>>>0?(m=-1,m|0):E>>>0>x>>>0|(E|0)==(x|0)&b>>>0>v>>>0?(m=1,m|0):(_=+ie[p+8>>3],g=+ie[m+8>>3],_<g?(m=-1,m|0):(m=_>g&1,m|0))}function rue(p,m){p=p|0,m=m|0;var g=0,_=0;return _=+ie[p>>3],g=+ie[m>>3],(_>g?-1:_<g&1)|0}function sue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0;if(q=Q,Q=Q+64|0,U=q,E=q+56|0,!(!0&(m&2013265920|0)==134217728&(!0&(_&2013265920|0)==134217728)))return v=5,Q=q,v|0;if((p|0)==(g|0)&(m|0)==(_|0))return h[v>>2]=0,v=0,Q=q,v|0;if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,N=tt(g|0,_|0,52)|0,ee()|0,(b|0)!=(N&15|0))return v=12,Q=q,v|0;if(x=b+-1|0,b>>>0>1){AL(p,m,x,U)|0,AL(g,_,x,E)|0,N=U,M=h[N>>2]|0,N=h[N+4>>2]|0;e:do if((M|0)==(h[E>>2]|0)&&(N|0)==(h[E+4>>2]|0)){b=(b^15)*3|0,x=tt(p|0,m|0,b|0)|0,ee()|0,x=x&7,b=tt(g|0,_|0,b|0)|0,ee()|0,b=b&7;do if((x|0)==0|(b|0)==0)h[v>>2]=1,x=0;else if((x|0)==7)x=5;else{if((x|0)==1|(b|0)==1&&Zi(M,N)|0){x=5;break}if((h[15824+(x<<2)>>2]|0)!=(b|0)&&(h[15856+(x<<2)>>2]|0)!=(b|0))break e;h[v>>2]=1,x=0}while(!1);return v=x,Q=q,v|0}while(!1)}x=U,b=x+56|0;do h[x>>2]=0,x=x+4|0;while((x|0)<(b|0));return KG(p,m,1,U)|0,m=U,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0))&&(m=U+8|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=U+16|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=U+24|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=U+32|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=U+40|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))?(x=U+48|0,x=((h[x>>2]|0)==(g|0)?(h[x+4>>2]|0)==(_|0):0)&1):x=1,h[v>>2]=x,v=0,Q=q,v|0}function oue(p,m,g,_,v){return p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,g=aT(p,m,g,_)|0,(g|0)==7?(v=11,v|0):(_=ft(g|0,0,56)|0,m=m&-2130706433|(ee()|0)|268435456,h[v>>2]=p|_,h[v+4>>2]=m,v=0,v|0)}function aue(p,m,g){return p=p|0,m=m|0,g=g|0,!0&(m&2013265920|0)==268435456?(h[g>>2]=p,h[g+4>>2]=m&-2130706433|134217728,g=0,g|0):(g=6,g|0)}function lue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;return v=Q,Q=Q+16|0,_=v,h[_>>2]=0,!0&(m&2013265920|0)==268435456?(x=tt(p|0,m|0,56)|0,ee()|0,_=Js(p,m&-2130706433|134217728,x&7,_,g)|0,Q=v,_|0):(_=6,Q=v,_|0)}function lq(p,m){p=p|0,m=m|0;var g=0;switch(g=tt(p|0,m|0,56)|0,ee()|0,g&7){case 0:case 7:return g=0,g|0;default:}return g=m&-2130706433|134217728,!(!0&(m&2013265920|0)==268435456)||!0&(m&117440512|0)==16777216&(Zi(p,g)|0)!=0?(g=0,g|0):(g=cT(p,g)|0,g|0)}function cue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return v=Q,Q=Q+16|0,_=v,!0&(m&2013265920|0)==268435456?(x=m&-2130706433|134217728,b=g,h[b>>2]=p,h[b+4>>2]=x,h[_>>2]=0,m=tt(p|0,m|0,56)|0,ee()|0,_=Js(p,x,m&7,_,g+8|0)|0,Q=v,_|0):(_=6,Q=v,_|0)}function hL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0;return v=(Zi(p,m)|0)==0,m=m&-2130706433,_=g,h[_>>2]=v?p:0,h[_+4>>2]=v?m|285212672:0,_=g+8|0,h[_>>2]=p,h[_+4>>2]=m|301989888,_=g+16|0,h[_>>2]=p,h[_+4>>2]=m|318767104,_=g+24|0,h[_>>2]=p,h[_+4>>2]=m|335544320,_=g+32|0,h[_>>2]=p,h[_+4>>2]=m|352321536,g=g+40|0,h[g>>2]=p,h[g+4>>2]=m|369098752,0}function jx(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+16|0,v=b,x=m&-2130706433|134217728,!0&(m&2013265920|0)==268435456?(_=tt(p|0,m|0,56)|0,ee()|0,_=Jue(p,x,_&7)|0,(_|0)==-1?(h[g>>2]=0,x=6,Q=b,x|0):(w1(p,x,v)|0&&di(27634,27035,282,27050),m=tt(p|0,m|0,52)|0,ee()|0,m=m&15,Zi(p,x)|0?fL(v,m,_,2,g):dL(v,m,_,2,g),x=0,Q=b,x|0)):(x=6,Q=b,x|0)}function cq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+16|0,_=b+8|0,v=b,x=m&-2130706433|134217728,!0&(m&2013265920|0)==268435456?(h[_>>2]=0,m=tt(p|0,m|0,56)|0,ee()|0,m=Js(p,x,m&7,_,v)|0,m|0?(g=m,Q=b,g|0):(_=h[v>>2]|0,v=h[v+4>>2]|0,m=aT(_,v,p,x)|0,(m|0)==7?(g=11,Q=b,g|0):(p=ft(m|0,0,56)|0,x=v&-2130706433|(ee()|0)|268435456,h[g>>2]=_|p,h[g+4>>2]=x,g=0,Q=b,g|0))):(g=6,Q=b,g|0)}function uue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0;h[g>>2]=0,N=+ie[p>>3],U=+ie[p+8>>3],M=+ie[p+16>>3],v=0,x=5,_=5,p=0;do ae=+ie[15888+(v*24|0)>>3]-N,K=+ie[15888+(v*24|0)+8>>3]-U,b=+ie[15888+(v*24|0)+16>>3]-M,b=ae*ae+K*K+b*b,b<_&&(h[g>>2]=v,x=b,p=v,_=b),v=v+1|0;while((v|0)!=20);if(x=+wce(+(1-x*.5)),x<1e-16)M=0,b=0;else{if(Ae=+ie[16368+(p*24|0)>>3],se=+ie[15888+(p*24|0)>>3],we=+ie[15888+(p*24|0)+8>>3],xe=+ie[15888+(p*24|0)+16>>3],Be=-(xe+(se*0+we*0)),b=se*Be+0,ae=we*Be+0,Be=xe*Be+1,ue=+ws(+(Be*Be+(b*b+ae*ae))),ue=ue>0?1/ue:0,b=b*ue,ae=ae*ue,ue=Be*ue,Be=-(N*se+U*we+M*xe),K=N+se*Be,_=U+we*Be,N=M+xe*Be,U=+ws(+(N*N+(K*K+_*_))),U=U>0?1/U:0,K=K*U,_=_*U,U=N*U,_=+Yx(Ae-+Yx(+Ta(+(U*(we*b-se*ae)+(K*(xe*ae-we*ue)+_*(se*ue-xe*b))),+(ue*U+(b*K+ae*_))))),bc(m)|0?b=+Yx(_+-.3334731722518321):b=_,_=+oT(+x)*2.618033988749896,(m|0)>0){p=0;do _=_*2.6457513110645907,p=p+1|0;while((p|0)!=(m|0))}M=+ii(+b)*_,b=+zi(+b)*_}m=g+4|0,X=g+12|0,h[X>>2]=0,x=+Qs(+b)*1.1547005383792515,_=+Qs(+M)+x*.5,p=~~_,v=~~x,_=_-+(p|0),x=x-+(v|0);do if(_<.5)if(_<.3333333333333333)if(h[m>>2]=p,x<(_+1)*.5){h[g+8>>2]=v;break}else{v=v+1|0,h[g+8>>2]=v;break}else if(Be=1-_,v=(!(x<Be)&1)+v|0,h[g+8>>2]=v,Be<=x&x<_*2){p=p+1|0,h[m>>2]=p;break}else{h[m>>2]=p;break}else{if(!(_<.6666666666666666))if(p=p+1|0,h[m>>2]=p,x<_*.5){h[g+8>>2]=v;break}else{v=v+1|0,h[g+8>>2]=v;break}if(x<1-_){if(h[g+8>>2]=v,_*2+-1<x){h[m>>2]=p;break}}else v=v+1|0,h[g+8>>2]=v;p=p+1|0,h[m>>2]=p}while(!1);do if(M<0)if(v&1){j=(v+1|0)/2|0,j=eo(p|0,((p|0)<0)<<31>>31|0,j|0,((j|0)<0)<<31>>31|0)|0,p=~~(+(p|0)-((+(j>>>0)+4294967296*+(ee()|0))*2+1)),h[m>>2]=p,j=m;break}else{j=(v|0)/2|0,j=eo(p|0,((p|0)<0)<<31>>31|0,j|0,((j|0)<0)<<31>>31|0)|0,p=~~(+(p|0)-(+(j>>>0)+4294967296*+(ee()|0))*2),h[m>>2]=p,j=m;break}else j=m;while(!1);q=g+8|0,m=0-v|0,b<0?(g=p-((v<<1|1|0)/2|0)|0,h[j>>2]=g,h[q>>2]=m,v=m):g=p,p=v-g|0,m=0-g|0,(g|0)<0?(h[q>>2]=p,h[X>>2]=m,h[j>>2]=0,E=0):(p=v,E=g,m=0),g=E-p|0,v=m-p|0,(p|0)<0?(h[j>>2]=g,h[X>>2]=v,h[q>>2]=0,E=g,p=0):v=m,g=E-v|0,m=p-v|0,(v|0)<0?(h[j>>2]=g,h[q>>2]=m,h[X>>2]=0,v=0):(m=p,g=E),p=(m|0)<(g|0)?m:g,p=(v|0)<(p|0)?v:p,!((p|0)<=0)&&(h[j>>2]=g-p,h[q>>2]=m-p,h[X>>2]=v-p)}function hue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;_=Q,Q=Q+16|0,v=_,b=h[p+12>>2]|0,x=+((h[p+8>>2]|0)-b|0),ie[v>>3]=+((h[p+4>>2]|0)-b|0)-x*.5,ie[v+8>>3]=x*.8660254037844386,Xx(v,h[p>>2]|0,m,0,g),Q=_}function Xx(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0;if(x=+Que(p),x<1e-16){m=15888+(m*24|0)|0,h[v>>2]=h[m>>2],h[v+4>>2]=h[m+4>>2],h[v+8>>2]=h[m+8>>2],h[v+12>>2]=h[m+12>>2],h[v+16>>2]=h[m+16>>2],h[v+20>>2]=h[m+20>>2];return}if(b=+Ta(+ +ie[p+8>>3],+ +ie[p>>3]),(g|0)>0){p=0;do x=x*.37796447300922725,p=p+1|0;while((p|0)!=(g|0))}E=x*.3333333333333333,_?(g=(bc(g)|0)==0,x=+YG(+((g?E:E*.37796447300922725)*.381966011250105))):(x=+YG(+(x*.381966011250105)),bc(g)|0&&(b=+Yx(b+.3334731722518321))),q=+Yx(+ie[16368+(m*24|0)>>3]-b),E=+ie[15888+(m*24|0)>>3],U=+ie[15888+(m*24|0)+8>>3],ae=+ie[15888+(m*24|0)+16>>3],X=-(ae+(E*0+U*0)),N=E*X+0,b=U*X+0,X=ae*X+1,j=+ws(+(X*X+(N*N+b*b))),j=j>0?1/j:0,N=N*j,b=b*j,j=X*j,X=+ii(+q),q=+zi(+q),ue=+ii(+x),K=+zi(+x),M=ue*E+K*(X*N+q*(ae*b-U*j)),x=ue*U+K*(X*b+q*(E*j-ae*N)),b=ue*ae+K*(X*j+q*(U*N-E*b)),E=+ws(+(b*b+(M*M+x*x))),E=E>0?1/E:0,ie[v>>3]=M*E,ie[v+8>>3]=x*E,ie[v+16>>3]=b*E}function fL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0,Ma=0,Bs=0,as=0,Os=0,Ss=0,cl=0,po=0,mo=0,Sc=0,Io=0,Pi=0,Gm=0;if(cl=Q,Q=Q+256|0,x=cl+240|0,pi=cl+224|0,as=cl,Os=cl+208|0,Ss=cl+192|0,bi=cl+168|0,Ro=cl+152|0,Vn=cl+136|0,wi=cl+120|0,Ma=cl+104|0,Bs=cl+80|0,h[x>>2]=m,h[pi>>2]=h[p>>2],h[pi+4>>2]=h[p+4>>2],h[pi+8>>2]=h[p+8>>2],h[pi+12>>2]=h[p+12>>2],uq(pi,x,as),h[v>>2]=0,pi=_+g+((_|0)==5&1)|0,(pi|0)<=(g|0)){Q=cl;return}Ae=h[x>>2]|0,we=Os+4|0,xe=Os+8|0,se=Os+12|0,Be=Ss+8|0,Ke=g+5|0,Me=16848+(Ae<<2)|0,be=bi+8|0,gt=16928+(Ae<<2)|0,je=Ro+8|0,Ut=Vn+8|0,lt=wi+8|0,pt=Ss+8|0,X=bi+8|0,ae=bi+16|0,K=Bs+8|0,ue=Bs+16|0,j=g,_=0,b=0,E=0,M=0;e:for(;;){q=as+(((j|0)%5|0)<<4)|0,h[Os>>2]=h[q>>2],h[Os+4>>2]=h[q+4>>2],h[Os+8>>2]=h[q+8>>2],h[Os+12>>2]=h[q+12>>2];do;while((b1(Os,Ae,0,1)|0)==2);if((j|0)>(g|0)&(bc(m)|0)!=0){if(q=h[Os>>2]|0,p=h[we>>2]|0,N=h[xe>>2]|0,x=h[se>>2]|0,po=+(E-M|0),ie[Ss>>3]=+(b-M|0)-po*.5,ie[Be>>3]=po*.8660254037844386,M=h[17008+(q*80|0)+(_<<2)>>2]|0,U=h[18608+(q*80|0)+(M*20|0)>>2]|0,E=h[18608+(q*80|0)+(M*20|0)+16>>2]|0,(E|0)>0){b=0,_=N;do Io=x+p|0,Pi=(Io|0)<0,N=_+p-(Pi?Io:0)|0,Sc=(N|0)<0,mo=x+_-(Pi?Io:0)-(Sc?N:0)|0,x=(mo|0)<0,p=(Pi?0:Io)-(Sc?N:0)-(x?mo:0)|0,_=(Sc?0:N)-(x?mo:0)|0,mo=x?0:mo,x=(_|0)<(p|0)?_:p,x=(mo|0)<(x|0)?mo:x,N=(x|0)>0,p=p-(N?x:0)|0,_=_-(N?x:0)|0,x=mo-(N?x:0)|0,b=b+1|0;while((b|0)<(E|0))}else _=N;switch(Pi=(h[Me>>2]|0)*3|0,mo=(al(Pi,h[18608+(q*80|0)+(M*20|0)+4>>2]|0)|0)+p|0,N=(al(Pi,h[18608+(q*80|0)+(M*20|0)+8>>2]|0)|0)+_|0,Pi=(al(Pi,h[18608+(q*80|0)+(M*20|0)+12>>2]|0)|0)+x|0,M=(mo|0)<0,N=N-(M?mo:0)|0,Sc=(N|0)<0,Pi=Pi+(M?0-mo|0:0)+(Sc?0-N|0:0)|0,Io=(Pi|0)<0,mo=(M?0:mo)-(Sc?N:0)-(Io?Pi:0)|0,N=(Sc?0:N)-(Io?Pi:0)|0,Pi=Io?0:Pi,Io=(N|0)<(mo|0)?N:mo,Io=(Pi|0)<(Io|0)?Pi:Io,Sc=(Io|0)>0,Pi=Pi-(Sc?Io:0)|0,po=+(N-(Sc?Io:0)-Pi|0),ie[bi>>3]=+(mo-(Sc?Io:0)-Pi|0)-po*.5,ie[be>>3]=po*.8660254037844386,po=+(h[gt>>2]|0),ie[Ro>>3]=po*3,ie[je>>3]=0,Gm=po*-1.5,ie[Vn>>3]=Gm,ie[Ut>>3]=po*2.598076211353316,ie[wi>>3]=Gm,ie[lt>>3]=po*-2.598076211353316,h[17008+(U*80|0)+(q<<2)>>2]|0){case 1:{p=Vn,_=Ro;break}case 3:{p=wi,_=Vn;break}case 2:{p=Ro,_=wi;break}default:{p=12;break e}}Sq(Ss,bi,_,p,Ma),Xx(Ma,U,Ae,1,Bs),Pi=h[v>>2]|0,po=+Wx(+ +ie[ue>>3]),Gm=+Ta(+ +ie[K>>3],+ +ie[Bs>>3]),ie[v+8+(Pi<<4)>>3]=po,ie[v+8+(Pi<<4)+8>>3]=Gm,h[v>>2]=(h[v>>2]|0)+1}if((j|0)<(Ke|0)&&(Pi=h[se>>2]|0,po=+((h[xe>>2]|0)-Pi|0),ie[Ss>>3]=+((h[we>>2]|0)-Pi|0)-po*.5,ie[pt>>3]=po*.8660254037844386,Xx(Ss,h[Os>>2]|0,Ae,1,bi),Pi=h[v>>2]|0,po=+Wx(+ +ie[ae>>3]),Gm=+Ta(+ +ie[X>>3],+ +ie[bi>>3]),ie[v+8+(Pi<<4)>>3]=po,ie[v+8+(Pi<<4)+8>>3]=Gm,h[v>>2]=(h[v>>2]|0)+1),j=j+1|0,(j|0)>=(pi|0)){p=3;break}else _=h[Os>>2]|0,b=h[we>>2]|0,E=h[xe>>2]|0,M=h[se>>2]|0}if((p|0)==3){Q=cl;return}else(p|0)==12&&di(27073,27120,599,27130)}function uq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;K=Q,Q=Q+128|0,_=K+64|0,v=K,x=_,b=20208,E=x+60|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));x=v,b=20272,E=x+60|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));if(U=(bc(h[m>>2]|0)|0)==0,U=U?_:v,X=p+4|0,x=h[X>>2]|0,q=p+8|0,_=h[q>>2]|0,j=p+12|0,v=h[j>>2]|0,b=_+(x<<1)|0,h[X>>2]=b,_=v+(_<<1)|0,h[q>>2]=_,x=(v<<1)+x|0,h[j>>2]=x,v=_-b|0,E=x-b|0,(b|0)<0&&(h[q>>2]=v,h[j>>2]=E,h[X>>2]=0,_=v,b=0,x=E),E=b-_|0,v=x-_|0,(_|0)<0?(h[X>>2]=E,h[j>>2]=v,h[q>>2]=0,_=0):(v=x,E=b),b=E-v|0,x=_-v|0,(v|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(v=v-_|0,x=x-_|0,b=b-_|0,h[X>>2]=b,h[q>>2]=x,h[j>>2]=v),M=(x<<1)+b|0,E=v+(b<<1)|0,h[X>>2]=E,h[q>>2]=M,x=(v<<1)+x|0,h[j>>2]=x,_=M-E|0,v=x-E|0,(E|0)<0?(h[q>>2]=_,h[j>>2]=v,h[X>>2]=0,E=0,x=v):_=M,b=E-_|0,v=x-_|0,(_|0)<0?(h[X>>2]=b,h[j>>2]=v,h[q>>2]=0,E=b,_=0):v=x,b=E-v|0,x=_-v|0,(v|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[X>>2]=b-_,h[q>>2]=x-_,h[j>>2]=v-_),bc(h[m>>2]|0)|0&&(x=h[X>>2]|0,b=h[q>>2]|0,v=h[j>>2]|0,_=(b*3|0)+x|0,x=v+(x*3|0)|0,h[X>>2]=x,h[q>>2]=_,b=(v*3|0)+b|0,h[j>>2]=b,v=_-x|0,E=b-x|0,(x|0)<0?(h[q>>2]=v,h[j>>2]=E,h[X>>2]=0,_=v,M=0):(M=x,E=b),x=M-_|0,v=E-_|0,(_|0)<0?(h[X>>2]=x,h[j>>2]=v,h[q>>2]=0,M=x,b=0):(b=_,v=E),x=M-v|0,_=b-v|0,(v|0)<0?(h[X>>2]=x,h[q>>2]=_,h[j>>2]=0,b=_,v=0):x=M,_=(b|0)<(x|0)?b:x,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[X>>2]=x-_,h[q>>2]=b-_,h[j>>2]=v-_),h[m>>2]=(h[m>>2]|0)+1),h[g>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[U+4>>2]|0,N=h[U+8>>2]|0,b=(h[U>>2]|0)+(h[X>>2]|0)|0,M=g+4|0,h[M>>2]=b,v=m+v|0,m=g+8|0,h[m>>2]=v,_=N+_|0,N=g+12|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+16>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[U+16>>2]|0,N=h[U+20>>2]|0,b=(h[U+12>>2]|0)+(h[X>>2]|0)|0,M=g+20|0,h[M>>2]=b,v=m+v|0,m=g+24|0,h[m>>2]=v,_=N+_|0,N=g+28|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+32>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[U+28>>2]|0,N=h[U+32>>2]|0,b=(h[U+24>>2]|0)+(h[X>>2]|0)|0,M=g+36|0,h[M>>2]=b,v=m+v|0,m=g+40|0,h[m>>2]=v,_=N+_|0,N=g+44|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+48>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[U+40>>2]|0,N=h[U+44>>2]|0,b=(h[U+36>>2]|0)+(h[X>>2]|0)|0,M=g+52|0,h[M>>2]=b,v=m+v|0,m=g+56|0,h[m>>2]=v,_=N+_|0,N=g+60|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+64>>2]=h[p>>2],x=h[q>>2]|0,_=h[j>>2]|0,N=h[U+52>>2]|0,M=h[U+56>>2]|0,b=(h[U+48>>2]|0)+(h[X>>2]|0)|0,m=g+68|0,h[m>>2]=b,x=N+x|0,N=g+72|0,h[N>>2]=x,_=M+_|0,M=g+76|0,h[M>>2]=_,v=x-b|0,(b|0)<0?(_=_-b|0,h[N>>2]=v,h[M>>2]=_,h[m>>2]=0,x=0):(v=x,x=b),(v|0)<0&&(x=x-v|0,h[m>>2]=x,_=_-v|0,h[M>>2]=_,h[N>>2]=0,v=0),E=x-_|0,b=v-_|0,(_|0)<0?(h[m>>2]=E,h[N>>2]=b,h[M>>2]=0,x=E,_=0):b=v,v=(b|0)<(x|0)?b:x,v=(_|0)<(v|0)?_:v,(v|0)<=0){Q=K;return}h[m>>2]=x-v,h[N>>2]=b-v,h[M>>2]=_-v,Q=K}function b1(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0;if(j=h[16928+(m<<2)>>2]|0,q=(_|0)!=0,j=q?j*3|0:j,U=p+4|0,E=h[U>>2]|0,N=p+8|0,x=h[N>>2]|0,q){if(b=p+12|0,_=h[b>>2]|0,v=x+E+_|0,(v|0)==(j|0))return j=1,j|0;M=b}else M=p+12|0,v=h[M>>2]|0,_=v,v=x+E+v|0;if((v|0)<=(j|0))return j=0,j|0;do if((_|0)>0){if(v=h[p>>2]|0,(x|0)>0){v=18608+(v*80|0)+60|0,b=E;break}v=18608+(v*80|0)+40|0,g?(b=E-j|0,g=x+b|0,X=(g|0)<0,x=_+x-(X?g:0)|0,E=(x|0)<0,_=_+b-(X?g:0)-(E?x:0)|0,b=(_|0)<0,g=(X?0:g)-(E?x:0)-(b?_:0)|0,x=(E?0:x)-(b?_:0)|0,_=b?0:_,b=(x|0)<(g|0)?x:g,b=(_|0)<(b|0)?_:b,E=(b|0)>0,x=x-(E?b:0)|0,_=_-(E?b:0)|0,b=g-(E?b:0)+j|0,h[U>>2]=b,h[N>>2]=x,h[M>>2]=_):b=E}else v=18608+((h[p>>2]|0)*80|0)+20|0,b=E;while(!1);if(h[p>>2]=h[v>>2],E=h[v+16>>2]|0,(E|0)>0){g=0;do X=_+b|0,K=(X|0)<0,xe=K?X:0,ae=x+b-xe|0,ue=(ae|0)<0,p=ue?ae:0,b=_+x-xe-p|0,x=(b|0)<0,_=x?0:b,b=x?b:0,x=(ue?0:ae)-b|0,b=(K?0:X)-p-b|0,p=(x|0)<(b|0)?x:b,p=(_|0)<(p|0)?_:p,(p|0)>0&&(b=b-p|0,x=x-p|0,_=_-p|0),g=g+1|0;while((g|0)<(E|0));h[U>>2]=b,h[N>>2]=x,h[M>>2]=_}return ae=h[16848+(m<<2)>>2]|0,ae=q?ae*3|0:ae,ue=al(ae,h[v+8>>2]|0)|0,xe=al(ae,h[v+12>>2]|0)|0,b=(al(ae,h[v+4>>2]|0)|0)+b|0,h[U>>2]=b,x=ue+x|0,h[N>>2]=x,_=xe+_|0,h[M>>2]=_,v=x-b|0,(b|0)<0?(_=_-b|0,h[N>>2]=v,h[M>>2]=_,h[U>>2]=0,x=0):(v=x,x=b),(v|0)<0?(p=x-v|0,h[U>>2]=p,_=_-v|0,h[M>>2]=_,h[N>>2]=0,b=0):(p=x,b=v),x=p-_|0,v=b-_|0,(_|0)<0?(h[U>>2]=x,h[N>>2]=v,h[M>>2]=0,_=0):(v=b,x=p),b=(v|0)<(x|0)?v:x,b=(_|0)<(b|0)?_:b,(b|0)>0&&(x=x-b|0,v=v-b|0,_=_-b|0,h[U>>2]=x,h[N>>2]=v,h[M>>2]=_),q?(xe=(v+x+_|0)==(j|0)?1:2,xe|0):(xe=2,xe|0)}function fue(p,m){p=p|0,m=m|0;var g=0;do g=b1(p,m,0,1)|0;while((g|0)==2);return g|0}function dL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0,Ma=0,Bs=0,as=0,Os=0,Ss=0;if(Bs=Q,Q=Q+272|0,x=Bs+256|0,b=Bs+240|0,Vn=Bs,wi=Bs+224|0,Ma=Bs+208|0,je=Bs+184|0,Ut=Bs+168|0,lt=Bs+152|0,pt=Bs+136|0,pi=Bs+120|0,bi=Bs+96|0,h[x>>2]=m,h[b>>2]=h[p>>2],h[b+4>>2]=h[p+4>>2],h[b+8>>2]=h[p+8>>2],h[b+12>>2]=h[p+12>>2],hq(b,x,Vn),h[v>>2]=0,gt=_+g+((_|0)==6&1)|0,(gt|0)<=(g|0)){Q=Bs;return}xe=h[x>>2]|0,se=g+6|0,we=Ma+8|0,Ae=je+8|0,Be=16928+(xe<<2)|0,Ke=Ut+8|0,Me=lt+8|0,be=pt+8|0,ae=h[b>>2]|0,j=wi+4|0,X=wi+8|0,K=wi+12|0,ue=Ma+8|0,M=je+8|0,U=je+16|0,N=bi+8|0,q=bi+16|0,b=0,E=g,_=-1;e:for(;;){if(x=(E|0)%6|0,p=Vn+(x<<4)|0,h[wi>>2]=h[p>>2],h[wi+4>>2]=h[p+4>>2],h[wi+8>>2]=h[p+8>>2],h[wi+12>>2]=h[p+12>>2],p=b,b=b1(wi,xe,0,1)|0,(E|0)>(g|0)&(bc(m)|0)!=0&&(Ro=h[wi>>2]|0,(p|0)!=1&(Ro|0)!=(_|0))){switch(Ss=(x+5|0)%6|0,p=h[Vn+(Ss<<4)+12>>2]|0,as=+((h[Vn+(Ss<<4)+8>>2]|0)-p|0),ie[Ma>>3]=+((h[Vn+(Ss<<4)+4>>2]|0)-p|0)-as*.5,ie[we>>3]=as*.8660254037844386,p=h[Vn+(x<<4)+12>>2]|0,as=+((h[Vn+(x<<4)+8>>2]|0)-p|0),ie[je>>3]=+((h[Vn+(x<<4)+4>>2]|0)-p|0)-as*.5,ie[Ae>>3]=as*.8660254037844386,as=+(h[Be>>2]|0),ie[Ut>>3]=as*3,ie[Ke>>3]=0,Os=as*-1.5,ie[lt>>3]=Os,ie[Me>>3]=as*2.598076211353316,ie[pt>>3]=Os,ie[be>>3]=as*-2.598076211353316,h[17008+(ae*80|0)+(((_|0)==(ae|0)?Ro:_)<<2)>>2]|0){case 1:{p=lt,_=Ut;break}case 3:{p=pt,_=lt;break}case 2:{p=Ut,_=pt;break}default:{p=8;break e}}Sq(Ma,je,_,p,pi),!(Tq(Ma,pi)|0)&&!(Tq(je,pi)|0)&&(Xx(pi,ae,xe,1,bi),Ss=h[v>>2]|0,as=+Wx(+ +ie[q>>3]),Os=+Ta(+ +ie[N>>3],+ +ie[bi>>3]),ie[v+8+(Ss<<4)>>3]=as,ie[v+8+(Ss<<4)+8>>3]=Os,h[v>>2]=(h[v>>2]|0)+1)}if((E|0)<(se|0)&&(Ss=h[K>>2]|0,as=+((h[X>>2]|0)-Ss|0),ie[Ma>>3]=+((h[j>>2]|0)-Ss|0)-as*.5,ie[ue>>3]=as*.8660254037844386,Xx(Ma,h[wi>>2]|0,xe,1,je),Ss=h[v>>2]|0,as=+Wx(+ +ie[U>>3]),Os=+Ta(+ +ie[M>>3],+ +ie[je>>3]),ie[v+8+(Ss<<4)>>3]=as,ie[v+8+(Ss<<4)+8>>3]=Os,h[v>>2]=(h[v>>2]|0)+1),E=E+1|0,(E|0)>=(gt|0)){p=3;break}else _=h[wi>>2]|0}if((p|0)==3){Q=Bs;return}else(p|0)==8&&di(27157,27120,766,27202)}function hq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0;ae=Q,Q=Q+160|0,_=ae+80|0,v=ae,x=_,b=20336,E=x+72|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));x=v,b=20416,E=x+72|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));q=(bc(h[m>>2]|0)|0)==0,q=q?_:v,K=p+4|0,x=h[K>>2]|0,j=p+8|0,_=h[j>>2]|0,X=p+12|0,v=h[X>>2]|0,b=_+(x<<1)|0,h[K>>2]=b,_=v+(_<<1)|0,h[j>>2]=_,x=(v<<1)+x|0,h[X>>2]=x,v=_-b|0,E=x-b|0,(b|0)<0&&(h[j>>2]=v,h[X>>2]=E,h[K>>2]=0,_=v,b=0,x=E),E=b-_|0,v=x-_|0,(_|0)<0?(h[K>>2]=E,h[X>>2]=v,h[j>>2]=0,_=0):(v=x,E=b),b=E-v|0,x=_-v|0,(v|0)<0?(h[K>>2]=b,h[j>>2]=x,h[X>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(v=v-_|0,x=x-_|0,b=b-_|0,h[K>>2]=b,h[j>>2]=x,h[X>>2]=v),M=(x<<1)+b|0,E=v+(b<<1)|0,h[K>>2]=E,h[j>>2]=M,x=(v<<1)+x|0,h[X>>2]=x,_=M-E|0,v=x-E|0,(E|0)<0?(h[j>>2]=_,h[X>>2]=v,h[K>>2]=0,E=0,x=v):_=M,b=E-_|0,v=x-_|0,(_|0)<0?(h[K>>2]=b,h[X>>2]=v,h[j>>2]=0,E=b,_=0):v=x,b=E-v|0,x=_-v|0,(v|0)<0?(h[K>>2]=b,h[j>>2]=x,h[X>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[K>>2]=b-_,h[j>>2]=x-_,h[X>>2]=v-_),bc(h[m>>2]|0)|0&&(x=h[K>>2]|0,b=h[j>>2]|0,v=h[X>>2]|0,_=(b*3|0)+x|0,x=v+(x*3|0)|0,h[K>>2]=x,h[j>>2]=_,b=(v*3|0)+b|0,h[X>>2]=b,v=_-x|0,E=b-x|0,(x|0)<0?(h[j>>2]=v,h[X>>2]=E,h[K>>2]=0,_=v,M=0):(M=x,E=b),x=M-_|0,v=E-_|0,(_|0)<0?(h[K>>2]=x,h[X>>2]=v,h[j>>2]=0,M=x,b=0):(b=_,v=E),x=M-v|0,_=b-v|0,(v|0)<0?(h[K>>2]=x,h[j>>2]=_,h[X>>2]=0,b=_,v=0):x=M,_=(b|0)<(x|0)?b:x,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[K>>2]=x-_,h[j>>2]=b-_,h[X>>2]=v-_),h[m>>2]=(h[m>>2]|0)+1),M=0;do h[g+(M<<4)>>2]=h[p>>2],v=h[j>>2]|0,_=h[X>>2]|0,N=h[q+(M*12|0)+4>>2]|0,U=h[q+(M*12|0)+8>>2]|0,b=(h[q+(M*12|0)>>2]|0)+(h[K>>2]|0)|0,m=g+(M<<4)+4|0,h[m>>2]=b,v=N+v|0,N=g+(M<<4)+8|0,h[N>>2]=v,_=U+_|0,U=g+(M<<4)+12|0,h[U>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[N>>2]=x,h[U>>2]=_,h[m>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[m>>2]=b,_=_-v|0,h[U>>2]=_,h[N>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[m>>2]=E,h[N>>2]=x,h[U>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[m>>2]=b-v,h[N>>2]=x-v,h[U>>2]=_-v),M=M+1|0;while((M|0)!=6);Q=ae}function pL(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,52)|0,ee()|0,m&15|0}function fq(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,45)|0,ee()|0,m&127|0}function due(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,(g+-1|0)>>>0>14?(_=4,_|0):(g=tt(p|0,m|0,(15-g|0)*3|0)|0,ee()|0,h[_>>2]=g&7,_=0,_|0)}function pue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;if(p>>>0>15)return _=4,_|0;if(m>>>0>121)return _=17,_|0;b=ft(p|0,0,52)|0,v=ee()|0,E=ft(m|0,0,45)|0,v=v|(ee()|0)|134225919;e:do if((p|0)>=1){for(E=1,b=(He[20496+m>>0]|0)!=0,x=-1;;){if(m=h[g+(E+-1<<2)>>2]|0,m>>>0>6){v=18,m=10;break}if(!((m|0)==0|b^1))if((m|0)==1){v=19,m=10;break}else b=0;if(N=(15-E|0)*3|0,M=ft(7,0,N|0)|0,v=v&~(ee()|0),m=ft(m|0,((m|0)<0)<<31>>31|0,N|0)|0,x=m|x&~M,v=ee()|0|v,(E|0)<(p|0))E=E+1|0;else break e}if((m|0)==10)return v|0}else x=-1;while(!1);return N=_,h[N>>2]=x,h[N+4>>2]=v,N=0,N|0}function cT(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;return!(!0&(m&-16777216|0)==134217728)||(_=tt(p|0,m|0,52)|0,ee()|0,_=_&15,g=tt(p|0,m|0,45)|0,ee()|0,g=g&127,g>>>0>121)?(p=0,p|0):(b=(_^15)*3|0,v=tt(p|0,m|0,b|0)|0,b=ft(v|0,ee()|0,b|0)|0,v=ee()|0,x=eo(-1227133514,-1171,b|0,v|0)|0,!((b&613566756&x|0)==0&(v&4681&(ee()|0)|0)==0)||(b=(_*3|0)+19|0,x=ft(~p|0,~m|0,b|0)|0,b=tt(x|0,ee()|0,b|0)|0,!((_|0)==15|(b|0)==0&(ee()|0)==0))?(b=0,b|0):!(He[20496+g>>0]|0)||(m=m&8191,(p|0)==0&(m|0)==0)?(b=1,b|0):(b=IL(p|0,m|0,0)|0,ee()|0,((63-b|0)%3|0|0)!=0|0))}function mue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;return!0&(m&-16777216|0)==134217728&&(_=tt(p|0,m|0,52)|0,ee()|0,_=_&15,g=tt(p|0,m|0,45)|0,ee()|0,g=g&127,g>>>0<=121)&&(b=(_^15)*3|0,v=tt(p|0,m|0,b|0)|0,b=ft(v|0,ee()|0,b|0)|0,v=ee()|0,x=eo(-1227133514,-1171,b|0,v|0)|0,(b&613566756&x|0)==0&(v&4681&(ee()|0)|0)==0)&&(b=(_*3|0)+19|0,x=ft(~p|0,~m|0,b|0)|0,b=tt(x|0,ee()|0,b|0)|0,(_|0)==15|(b|0)==0&(ee()|0)==0)&&(!(He[20496+g>>0]|0)||(g=m&8191,(p|0)==0&(g|0)==0)||(b=IL(p|0,g|0,0)|0,ee()|0,(63-b|0)%3|0|0))||lq(p,m)|0?(b=1,b|0):(b=(Eq(p,m)|0)!=0&1,b|0)}function mL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0;if(v=ft(m|0,0,52)|0,x=ee()|0,g=ft(g|0,0,45)|0,g=x|(ee()|0)|134225919,(m|0)<1){x=-1,_=g,m=p,h[m>>2]=x,p=p+4|0,h[p>>2]=_;return}for(x=1,v=-1;b=(15-x|0)*3|0,E=ft(7,0,b|0)|0,g=g&~(ee()|0),b=ft(_|0,0,b|0)|0,v=v&~E|b,g=g|(ee()|0),(x|0)!=(m|0);)x=x+1|0;E=p,b=E,h[b>>2]=v,E=E+4|0,h[E>>2]=g}function AL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;if(x=tt(p|0,m|0,52)|0,ee()|0,x=x&15,g>>>0>15)return _=4,_|0;if((x|0)<(g|0))return _=12,_|0;if((x|0)==(g|0))return h[_>>2]=p,h[_+4>>2]=m,_=0,_|0;if(v=ft(g|0,0,52)|0,v=v|p,p=ee()|0|m&-15728641,(x|0)>(g|0))do m=ft(7,0,(14-g|0)*3|0)|0,g=g+1|0,v=m|v,p=ee()|0|p;while((g|0)<(x|0));return h[_>>2]=v,h[_+4>>2]=p,_=0,_|0}function $x(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;if(x=tt(p|0,m|0,52)|0,ee()|0,x=x&15,!((g|0)<16&(x|0)<=(g|0)))return _=4,_|0;v=g-x|0,g=tt(p|0,m|0,45)|0,ee()|0;e:do if(!(yr(g&127)|0))g=lp(7,0,v,((v|0)<0)<<31>>31)|0,v=ee()|0;else{t:do if(x|0){for(g=1;b=ft(7,0,(15-g|0)*3|0)|0,!!((b&p|0)==0&((ee()|0)&m|0)==0);)if(g>>>0<x>>>0)g=g+1|0;else break t;g=lp(7,0,v,((v|0)<0)<<31>>31)|0,v=ee()|0;break e}while(!1);g=lp(7,0,v,((v|0)<0)<<31>>31)|0,g=wr(g|0,ee()|0,5,0)|0,g=At(g|0,ee()|0,-5,-1)|0,g=cp(g|0,ee()|0,6,0)|0,g=At(g|0,ee()|0,1,0)|0,v=ee()|0}while(!1);return b=_,h[b>>2]=g,h[b+4>>2]=v,b=0,b|0}function Zi(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;if(v=tt(p|0,m|0,45)|0,ee()|0,!(yr(v&127)|0))return v=0,v|0;v=tt(p|0,m|0,52)|0,ee()|0,v=v&15;e:do if(!v)g=0;else for(_=1;;){if(g=tt(p|0,m|0,(15-_|0)*3|0)|0,ee()|0,g=g&7,g|0)break e;if(_>>>0<v>>>0)_=_+1|0;else{g=0;break}}while(!1);return v=(g|0)==0&1,v|0}function Aue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0;if(b=Q,Q=Q+16|0,x=b,bL(x,p,m,g),m=x,p=h[m>>2]|0,m=h[m+4>>2]|0,(p|0)==0&(m|0)==0)return Q=b,0;v=0,g=0;do E=_+(v<<3)|0,h[E>>2]=p,h[E+4>>2]=m,v=At(v|0,g|0,1,0)|0,g=ee()|0,wL(x),E=x,p=h[E>>2]|0,m=h[E+4>>2]|0;while(!((p|0)==0&(m|0)==0));return Q=b,0}function dq(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,(_|0)<(g|0)?(g=m,_=p,On(g|0),_|0):(g=ft(-1,-1,((_-g|0)*3|0)+3|0)|0,_=ft(~g|0,~(ee()|0)|0,(15-_|0)*3|0)|0,g=~(ee()|0)&m,_=~_&p,On(g|0),_|0)}function pq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0;return v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,(g|0)<16&(v|0)<=(g|0)?((v|0)<(g|0)&&(v=ft(-1,-1,((g+-1-v|0)*3|0)+3|0)|0,v=ft(~v|0,~(ee()|0)|0,(15-g|0)*3|0)|0,m=~(ee()|0)&m,p=~v&p),v=ft(g|0,0,52)|0,g=m&-15728641|(ee()|0),h[_>>2]=p|v,h[_+4>>2]=g,_=0,_|0):(_=4,_|0)}function gue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0;if((g|0)==0&(_|0)==0)return pt=0,pt|0;if(v=p,x=h[v>>2]|0,v=h[v+4>>2]|0,!0&(v&15728640|0)==0){if(!((_|0)>0|(_|0)==0&g>>>0>0)||(pt=m,h[pt>>2]=x,h[pt+4>>2]=v,(g|0)==1&(_|0)==0))return pt=0,pt|0;v=1,x=0;do Ut=p+(v<<3)|0,lt=h[Ut+4>>2]|0,pt=m+(v<<3)|0,h[pt>>2]=h[Ut>>2],h[pt+4>>2]=lt,v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(_|0)|(x|0)==(_|0)&v>>>0<g>>>0);return v=0,v|0}if(je=g<<3,lt=br(je)|0,!lt)return pt=13,pt|0;if(du(lt|0,p|0,je|0)|0,Ut=Ea(g,8)|0,!Ut)return _t(lt),pt=13,pt|0;e:for(;;){v=lt,N=h[v>>2]|0,v=h[v+4>>2]|0,be=tt(N|0,v|0,52)|0,ee()|0,be=be&15,gt=be+-1|0,Me=(be|0)!=0,Ke=(_|0)>0|(_|0)==0&g>>>0>0;t:do if(Me&Ke){if(se=ft(gt|0,0,52)|0,we=ee()|0,gt>>>0>15){if(!((N|0)==0&(v|0)==0)){pt=16;break e}for(x=0,p=0;;){if(x=At(x|0,p|0,1,0)|0,p=ee()|0,!((p|0)<(_|0)|(p|0)==(_|0)&x>>>0<g>>>0))break t;if(b=lt+(x<<3)|0,Be=h[b>>2]|0,b=h[b+4>>2]|0,!((Be|0)==0&(b|0)==0)){v=b,pt=16;break e}}}for(E=N,p=v,x=0,b=0;;){if(!((E|0)==0&(p|0)==0)){if(!(!0&(p&117440512|0)==0)){pt=21;break e}if(U=tt(E|0,p|0,52)|0,ee()|0,U=U&15,(U|0)<(gt|0)){v=12,pt=27;break e}if((U|0)!=(gt|0)&&(E=E|se,p=p&-15728641|we,U>>>0>=be>>>0)){M=gt;do Be=ft(7,0,(14-M|0)*3|0)|0,M=M+1|0,E=Be|E,p=ee()|0|p;while(M>>>0<U>>>0)}if(j=jf(E|0,p|0,g|0,_|0)|0,X=ee()|0,M=Ut+(j<<3)|0,U=M,q=h[U>>2]|0,U=h[U+4>>2]|0,!((q|0)==0&(U|0)==0)){ue=0,xe=0;do{if((ue|0)>(_|0)|(ue|0)==(_|0)&xe>>>0>g>>>0){pt=31;break e}if((q|0)==(E|0)&(U&-117440513|0)==(p|0)){K=tt(q|0,U|0,56)|0,ee()|0,K=K&7,ae=K+1|0,Be=tt(q|0,U|0,45)|0,ee()|0;n:do if(!(yr(Be&127)|0))U=7;else{if(q=tt(q|0,U|0,52)|0,ee()|0,q=q&15,!q){U=6;break}for(U=1;;){if(Be=ft(7,0,(15-U|0)*3|0)|0,!((Be&E|0)==0&((ee()|0)&p|0)==0)){U=7;break n}if(U>>>0<q>>>0)U=U+1|0;else{U=6;break}}}while(!1);if((K+2|0)>>>0>U>>>0){pt=41;break e}Be=ft(ae|0,0,56)|0,p=ee()|0|p&-117440513,Ae=M,h[Ae>>2]=0,h[Ae+4>>2]=0,E=Be|E}else j=At(j|0,X|0,1,0)|0,j=up(j|0,ee()|0,g|0,_|0)|0,X=ee()|0;xe=At(xe|0,ue|0,1,0)|0,ue=ee()|0,M=Ut+(j<<3)|0,U=M,q=h[U>>2]|0,U=h[U+4>>2]|0}while(!((q|0)==0&(U|0)==0))}Be=M,h[Be>>2]=E,h[Be+4>>2]=p}if(x=At(x|0,b|0,1,0)|0,b=ee()|0,!((b|0)<(_|0)|(b|0)==(_|0)&x>>>0<g>>>0))break t;p=lt+(x<<3)|0,E=h[p>>2]|0,p=h[p+4>>2]|0}}while(!1);if(Be=At(g|0,_|0,5,0)|0,Ae=ee()|0,Ae>>>0<0|(Ae|0)==0&Be>>>0<11){pt=85;break}if(Be=cp(g|0,_|0,6,0)|0,ee()|0,Be=Ea(Be,8)|0,!Be){pt=48;break}do if(Ke){for(ae=0,p=0,K=0,ue=0;;){if(U=Ut+(ae<<3)|0,b=U,x=h[b>>2]|0,b=h[b+4>>2]|0,(x|0)==0&(b|0)==0)Ae=K;else{q=tt(x|0,b|0,56)|0,ee()|0,q=q&7,E=q+1|0,j=b&-117440513,Ae=tt(x|0,b|0,45)|0,ee()|0;t:do if(yr(Ae&127)|0){if(X=tt(x|0,b|0,52)|0,ee()|0,X=X&15,X|0)for(M=1;;){if(Ae=ft(7,0,(15-M|0)*3|0)|0,!((x&Ae|0)==0&(j&(ee()|0)|0)==0))break t;if(M>>>0<X>>>0)M=M+1|0;else break}b=ft(E|0,0,56)|0,x=b|x,b=ee()|0|j,E=U,h[E>>2]=x,h[E+4>>2]=b,E=q+2|0}while(!1);(E|0)==7?(Ae=Be+(p<<3)|0,h[Ae>>2]=x,h[Ae+4>>2]=b&-117440513,p=At(p|0,K|0,1,0)|0,Ae=ee()|0):Ae=K}if(ae=At(ae|0,ue|0,1,0)|0,ue=ee()|0,(ue|0)<(_|0)|(ue|0)==(_|0)&ae>>>0<g>>>0)K=Ae;else break}if(Ke){if(xe=gt>>>0>15,se=ft(gt|0,0,52)|0,we=ee()|0,!Me){for(x=0,M=0,E=0,b=0;(N|0)==0&(v|0)==0||(gt=m+(x<<3)|0,h[gt>>2]=N,h[gt+4>>2]=v,x=At(x|0,M|0,1,0)|0,M=ee()|0),E=At(E|0,b|0,1,0)|0,b=ee()|0,!!((b|0)<(_|0)|(b|0)==(_|0)&E>>>0<g>>>0);)v=lt+(E<<3)|0,N=h[v>>2]|0,v=h[v+4>>2]|0;v=Ae;break}for(x=0,M=0,b=0,E=0;;){do if(!((N|0)==0&(v|0)==0)){if(X=tt(N|0,v|0,52)|0,ee()|0,X=X&15,xe|(X|0)<(gt|0)){pt=80;break e}if((X|0)!=(gt|0)){if(U=N|se,q=v&-15728641|we,X>>>0>=be>>>0){j=gt;do Me=ft(7,0,(14-j|0)*3|0)|0,j=j+1|0,U=Me|U,q=ee()|0|q;while(j>>>0<X>>>0)}}else U=N,q=v;K=jf(U|0,q|0,g|0,_|0)|0,j=0,X=0,ue=ee()|0;do{if((j|0)>(_|0)|(j|0)==(_|0)&X>>>0>g>>>0){pt=81;break e}if(Me=Ut+(K<<3)|0,ae=h[Me+4>>2]|0,(ae&-117440513|0)==(q|0)&&(h[Me>>2]|0)==(U|0)){pt=65;break}Me=At(K|0,ue|0,1,0)|0,K=up(Me|0,ee()|0,g|0,_|0)|0,ue=ee()|0,X=At(X|0,j|0,1,0)|0,j=ee()|0,Me=Ut+(K<<3)|0}while(!((h[Me>>2]|0)==(U|0)&&(h[Me+4>>2]|0)==(q|0)));if((pt|0)==65&&(pt=0,!0&(ae&117440512|0)==100663296))break;Me=m+(x<<3)|0,h[Me>>2]=N,h[Me+4>>2]=v,x=At(x|0,M|0,1,0)|0,M=ee()|0}while(!1);if(b=At(b|0,E|0,1,0)|0,E=ee()|0,!((E|0)<(_|0)|(E|0)==(_|0)&b>>>0<g>>>0))break;v=lt+(b<<3)|0,N=h[v>>2]|0,v=h[v+4>>2]|0}v=Ae}else x=0,v=Ae}else x=0,p=0,v=0;while(!1);if(hp(Ut|0,0,je|0)|0,du(lt|0,Be|0,p<<3|0)|0,_t(Be),(p|0)==0&(v|0)==0){pt=89;break}else m=m+(x<<3)|0,_=v,g=p}if((pt|0)==16)!0&(v&117440512|0)==0?(v=4,pt=27):pt=21;else if((pt|0)==31)di(27634,27225,620,27235);else{if((pt|0)==41)return _t(lt),_t(Ut),pt=10,pt|0;if((pt|0)==48)return _t(lt),_t(Ut),pt=13,pt|0;(pt|0)==80?di(27634,27225,711,27235):(pt|0)==81?di(27634,27225,723,27235):(pt|0)==85&&(du(m|0,lt|0,g<<3|0)|0,pt=89)}return(pt|0)==21?(_t(lt),_t(Ut),pt=5,pt|0):(pt|0)==27?(_t(lt),_t(Ut),pt=v,pt|0):(pt|0)==89?(_t(lt),_t(Ut),pt=0,pt|0):0}function vue(p,m,g,_,v,x,b){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0;var E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0;if(ae=Q,Q=Q+16|0,K=ae,!((g|0)>0|(g|0)==0&m>>>0>0))return K=0,Q=ae,K|0;if((b|0)>=16)return K=12,Q=ae,K|0;j=0,X=0,q=0,E=0;e:for(;;){if(N=p+(j<<3)|0,M=h[N>>2]|0,N=h[N+4>>2]|0,U=tt(M|0,N|0,52)|0,ee()|0,(U&15|0)>(b|0)){E=12,M=11;break}if(bL(K,M,N,b),U=K,N=h[U>>2]|0,U=h[U+4>>2]|0,(N|0)==0&(U|0)==0)M=q;else{M=q;do{if(!((E|0)<(x|0)|(E|0)==(x|0)&M>>>0<v>>>0)){M=10;break e}q=_+(M<<3)|0,h[q>>2]=N,h[q+4>>2]=U,M=At(M|0,E|0,1,0)|0,E=ee()|0,wL(K),q=K,N=h[q>>2]|0,U=h[q+4>>2]|0}while(!((N|0)==0&(U|0)==0))}if(j=At(j|0,X|0,1,0)|0,X=ee()|0,(X|0)<(g|0)|(X|0)==(g|0)&j>>>0<m>>>0)q=M;else{E=0,M=11;break}}return(M|0)==10?(K=14,Q=ae,K|0):(M|0)==11?(Q=ae,E|0):0}function _ue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;j=Q,Q=Q+16|0,q=j;e:do if((g|0)>0|(g|0)==0&m>>>0>0){for(N=0,b=0,x=0,U=0;;){if(M=p+(N<<3)|0,E=h[M>>2]|0,M=h[M+4>>2]|0,!((E|0)==0&(M|0)==0)&&(M=($x(E,M,_,q)|0)==0,E=q,b=At(h[E>>2]|0,h[E+4>>2]|0,b|0,x|0)|0,x=ee()|0,!M)){x=12;break}if(N=At(N|0,U|0,1,0)|0,U=ee()|0,!((U|0)<(g|0)|(U|0)==(g|0)&N>>>0<m>>>0))break e}return Q=j,x|0}else b=0,x=0;while(!1);return h[v>>2]=b,h[v+4>>2]=x,v=0,Q=j,v|0}function xue(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,52)|0,ee()|0,m&1|0}function ll(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;if(v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,!v)return v=0,v|0;for(_=1;;){if(g=tt(p|0,m|0,(15-_|0)*3|0)|0,ee()|0,g=g&7,g|0){_=5;break}if(_>>>0<v>>>0)_=_+1|0;else{g=0,_=5;break}}return(_|0)==5?g|0:0}function gL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(U=tt(p|0,m|0,52)|0,ee()|0,U=U&15,!U)return N=m,U=p,On(N|0),U|0;for(N=1,g=0;;){switch(_=(15-N|0)*3|0,E=ft(7,0,_|0)|0,M=ee()|0,x=p&~E,b=m&~M,p=tt(p|0,m|0,_|0)|0,ee()|0,p&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=p&7}_=ft(p|0,0,_|0)|0,v=ee()|0,p=_|x,m=v|b;e:do if(!g)if((_&E|0)==0&(v&M|0)==0)g=0;else if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)g=1;else{g=1;t:for(;;){switch(M=tt(p|0,m|0,(15-g|0)*3|0)|0,ee()|0,M&7){case 1:break t;case 0:break;default:{g=1;break e}}if(g>>>0<b>>>0)g=g+1|0;else{g=1;break e}}for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(p|0,m|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,_=p&~_,m=m&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,p=p|_,m=ee()|0|m,x>>>0<b>>>0)x=x+1|0;else{g=1;break e}}}while(!1);if(N>>>0<U>>>0)N=N+1|0;else break}return On(m|0),p|0}function zm(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)return x=m,b=p,On(x|0),b|0;for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(p|0,m|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,_=p&~_,m=m&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,p=p|_,m=ee()|0|m,x>>>0<b>>>0)x=x+1|0;else break}return On(m|0),p|0}function yue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(U=tt(p|0,m|0,52)|0,ee()|0,U=U&15,!U)return N=m,U=p,On(N|0),U|0;for(N=1,g=0;;){switch(_=(15-N|0)*3|0,E=ft(7,0,_|0)|0,M=ee()|0,x=p&~E,b=m&~M,p=tt(p|0,m|0,_|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}_=ft(p|0,0,_|0)|0,v=ee()|0,p=_|x,m=v|b;e:do if(!g)if((_&E|0)==0&(v&M|0)==0)g=0;else if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)g=1;else{g=1;t:for(;;){switch(M=tt(p|0,m|0,(15-g|0)*3|0)|0,ee()|0,M&7){case 1:break t;case 0:break;default:{g=1;break e}}if(g>>>0<b>>>0)g=g+1|0;else{g=1;break e}}for(x=1;;){switch(g=(15-x|0)*3|0,_=ft(7,0,g|0)|0,_=p&~_,v=m&~(ee()|0),p=tt(p|0,m|0,g|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}if(p=ft(p|0,0,g|0)|0,p=p|_,m=ee()|0|v,x>>>0<b>>>0)x=x+1|0;else{g=1;break e}}}while(!1);if(N>>>0<U>>>0)N=N+1|0;else break}return On(m|0),p|0}function vL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)return x=m,b=p,On(x|0),b|0;for(x=1;;){switch(_=(15-x|0)*3|0,g=ft(7,0,_|0)|0,g=p&~g,v=m&~(ee()|0),p=tt(p|0,m|0,_|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}if(p=ft(p|0,0,_|0)|0,p=p|g,m=ee()|0|v,x>>>0<b>>>0)x=x+1|0;else break}return On(m|0),p|0}function bue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0;if(Ae=Q,Q=Q+16|0,we=Ae,ft(m|0,0,52)|0,g=ee()|0|134225919,!m)return(h[p+4>>2]|0)>2||(h[p+8>>2]|0)>2||(h[p+12>>2]|0)>2?(se=0,we=0,On(se|0),Q=Ae,we|0):(ft(nq(p)|0,0,45)|0,se=ee()|0|g,we=-1,On(se|0),Q=Ae,we|0);h[we>>2]=h[p>>2],h[we+4>>2]=h[p+4>>2],h[we+8>>2]=h[p+8>>2],h[we+12>>2]=h[p+12>>2],se=we+4|0;e:do if((m|0)>0)for(ae=we+8|0,ue=we+12|0,K=m,q=h[ae>>2]|0,j=h[ue>>2]|0,m=-1,U=h[we+4>>2]|0;;){X=K,K=K+-1|0,p=U-j|0,_=q-j|0,X&1?(x=lh(+((p*3|0)-_|0)*.14285714285714285)|0,h[se>>2]=x,p=lh(+((_<<1)+p|0)*.14285714285714285)|0,h[ae>>2]=p,h[ue>>2]=0,_=p-x|0,v=0-x|0,(x|0)<0?(h[ae>>2]=_,h[ue>>2]=v,h[se>>2]=0,p=_,b=0):(b=x,v=0),x=b-p|0,_=v-p|0,(p|0)<0?(h[se>>2]=x,h[ue>>2]=_,h[ae>>2]=0,b=x,x=0):(_=v,x=p),p=b-_|0,v=x-_|0,(_|0)<0?(h[se>>2]=p,h[ae>>2]=v,h[ue>>2]=0,x=0):(v=x,p=b,x=_),_=(v|0)<(p|0)?v:p,_=(x|0)<(_|0)?x:_,(_|0)>0&&(x=x-_|0,v=v-_|0,p=p-_|0,h[se>>2]=p,h[ae>>2]=v,h[ue>>2]=x),Ke=v+(p*3|0)|0,Be=(Ke|0)<0,N=x+(v*3|0)-(Be?Ke:0)|0,M=(N|0)<0,_=(x*3|0)+p-(Be?Ke:0)-(M?N:0)|0,E=(_|0)<0,Me=E?0:_,b=(M?0:N)-(E?_:0)|0,_=(Be?0:Ke)-(M?N:0)-(E?_:0)|0,E=(b|0)<(_|0)?b:_,E=(Me|0)<(E|0)?Me:E,N=(E|0)>0,M=N?E:0,b=b-(N?E:0)|0,E=Me-(N?E:0)|0,N=x):(E=lh(+((p<<1)+_|0)*.14285714285714285)|0,h[se>>2]=E,v=lh(+((_*3|0)-p|0)*.14285714285714285)|0,h[ae>>2]=v,h[ue>>2]=0,_=v-E|0,p=0-E|0,(E|0)<0?(h[ae>>2]=_,h[ue>>2]=p,h[se>>2]=0,v=_,E=0):p=0,b=E-v|0,_=p-v|0,(v|0)<0?(h[se>>2]=b,h[ue>>2]=_,h[ae>>2]=0,x=_,v=0):(x=p,b=E),p=b-x|0,_=v-x|0,(x|0)<0?(h[se>>2]=p,h[ae>>2]=_,h[ue>>2]=0,v=_,x=0):p=b,_=(v|0)<(p|0)?v:p,_=(x|0)<(_|0)?x:_,(_|0)>0&&(x=x-_|0,v=v-_|0,p=p-_|0,h[se>>2]=p,h[ae>>2]=v,h[ue>>2]=x),Ke=x+(p*3|0)|0,Me=(Ke|0)<0,N=(v*3|0)+p-(Me?Ke:0)|0,M=(N|0)<0,_=(x*3|0)+v-(Me?Ke:0)-(M?N:0)|0,E=(_|0)<0,Be=E?0:_,b=(M?0:N)-(E?_:0)|0,_=(Me?0:Ke)-(M?N:0)-(E?_:0)|0,E=(b|0)<(_|0)?b:_,E=(Be|0)<(E|0)?Be:E,N=(E|0)>0,M=N?E:0,b=b-(N?E:0)|0,E=Be-(N?E:0)|0,N=x),_=U+(M-_)|0,x=(_|0)<0,M=q-b-(x?_:0)|0,b=(M|0)<0,j=j-E+(x?0-_|0:0)+(b?0-M|0:0)|0,U=(j|0)<0,E=U?0:j,Me=(b?0:M)-(U?j:0)|0,j=(x?0:_)-(b?M:0)-(U?j:0)|0,U=(Me|0)<(j|0)?Me:j,U=(E|0)<(U|0)?E:U,M=(U|0)>0,j=j-(M?U:0)|0,b=(15-X|0)*3|0,_=ft(7,0,b|0)|0,_=m&~_,x=g&~(ee()|0),q=(j|0)<0,Ke=q?j:0,Me=Me-(M?U:0)-Ke|0,Be=(Me|0)<0,Ke=(Be?0-Me|0:0)+(E-(M?U:0)-Ke)|0,g=(Ke|0)<0,m=g?0:Ke,Ke=g?Ke:0,g=(Be?0:Me)-Ke|0,Ke=(q?0:j)-(Be?Me:0)-Ke|0,Me=(g|0)<(Ke|0)?g:Ke,Me=(m|0)<(Me|0)?m:Me,Me=(Me|0)>0?Me:0,m=m-Me|0,g=g-Me|0;t:do switch(Ke-Me|0){case 0:switch(g|0){case 0:{m=(m|0)==0?0:(m|0)==1?1:7;break t}case 1:{m=(m|0)==0?2:(m|0)==1?3:7;break t}default:{xe=36;break t}}case 1:switch(g|0){case 0:{m=(m|0)==0?4:(m|0)==1?5:7;break t}case 1:if(m){xe=36;break t}else{m=6;break t}default:{xe=36;break t}}default:xe=36}while(!1);if((xe|0)==36&&(xe=0,m=7),m=ft(m|0,0,b|0)|0,m=m|_,g=ee()|0|x,(X|0)<=1)break e;q=v,j=N,U=p}else m=-1,p=h[se>>2]|0;while(!1);e:do if((p|0)<=2&&(h[we+8>>2]|0)<=2&&(h[we+12>>2]|0)<=2){if(_=nq(we)|0,p=ft(_|0,0,45)|0,m=p|m,p=ee()|0|g&-1040385,M=Hce(we)|0,!(yr(_)|0)){if((M|0)<=0)break;for(E=0;;){b=tt(m|0,p|0,52)|0,ee()|0,b=b&15;t:do if(b)for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(m|0,p|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,m=m&~_,_=p&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,m=p|m,p=ee()|0|_,x>>>0<b>>>0)x=x+1|0;else break t}while(!1);if(E=E+1|0,(E|0)==(M|0))break e}}b=tt(m|0,p|0,52)|0,ee()|0,b=b&15;t:do if(b){g=1;n:for(;;){switch(Me=tt(m|0,p|0,(15-g|0)*3|0)|0,ee()|0,Me&7){case 1:break n;case 0:break;default:break t}if(g>>>0<b>>>0)g=g+1|0;else break t}if(iq(_,h[we>>2]|0)|0)for(x=1;;){switch(g=(15-x|0)*3|0,_=ft(7,0,g|0)|0,_=m&~_,v=p&~(ee()|0),p=tt(m|0,p|0,g|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}if(m=ft(p|0,0,g|0)|0,m=m|_,p=ee()|0|v,x>>>0<b>>>0)x=x+1|0;else break t}else for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(m|0,p|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,m=m&~_,_=p&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,m=p|m,p=ee()|0|_,x>>>0<b>>>0)x=x+1|0;else break t}}while(!1);if((M|0)>0){g=0;do m=gL(m,p)|0,p=ee()|0,g=g+1|0;while((g|0)!=(M|0))}}else m=0,p=0;while(!1);return Ke=p,Me=m,On(Ke|0),Q=Ae,Me|0}function bc(p){return p=p|0,(p|0)%2|0|0}function _L(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;if(U=Q,Q=Q+64|0,E=U+24|0,M=U+48|0,N=U,m>>>0>15)return N=4,Q=U,N|0;if(x=+ie[p>>3],ie[or>>3]=x,(h[or+4>>2]&2146435072|0)==2146435072||(_=+ie[p+8>>3],ie[or>>3]=_,(h[or+4>>2]&2146435072|0)==2146435072))return N=3,Q=U,N|0;v=+ii(+x),q=v*+ii(+_),v=v*+zi(+_),_=+zi(+x),ie[N>>3]=q,ie[N+8>>3]=v,ie[N+16>>3]=_,ie[or>>3]=q;do if((h[or+4>>2]&2146435072|0)!=2146435072&&(ie[or>>3]=_,p=h[or+4>>2]|0,ie[or>>3]=v,!((h[or+4>>2]&2146435072|0)==2146435072|!0&(p&2146435072|0)==2146435072)))if(h[E>>2]=h[N>>2],h[E+4>>2]=h[N+4>>2],h[E+8>>2]=h[N+8>>2],h[E+12>>2]=h[N+12>>2],h[E+16>>2]=h[N+16>>2],h[E+20>>2]=h[N+20>>2],uue(E,m,M),M=bue(M,m)|0,N=ee()|0,h[g>>2]=M,h[g+4>>2]=N,(M|0)==0&(N|0)==0)di(27634,27225,1073,27248);else{b=0;break}else b=2;while(!1);return N=b,Q=U,N|0}function xL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(X=g+4|0,K=tt(p|0,m|0,52)|0,ee()|0,K=K&15,j=tt(p|0,m|0,45)|0,ee()|0,_=(K|0)==0,yr(j&127)|0){if(_)return K=1,K|0;_=1}else{if(_)return K=0,K|0;(h[X>>2]|0)==0&&(h[g+8>>2]|0)==0?_=(h[g+12>>2]|0)!=0&1:_=1}for(j=g+8|0,q=g+12|0,U=1,g=h[X>>2]|0,b=h[j>>2]|0,x=h[q>>2]|0;v=g*3|0,E=b*3|0,N=x*3|0,U&1?(M=b+v|0,h[X>>2]=M,x=x+E|0,h[j>>2]=x,v=N+g|0,h[q>>2]=v,g=x-M|0,b=v-M|0,(M|0)<0?(h[j>>2]=g,h[q>>2]=b,h[X>>2]=0,E=0,v=b):(g=x,E=M),b=E-g|0,x=v-g|0,(g|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,E=b,v=0):(x=v,v=g),g=E-x|0,b=v-x|0,(x|0)<0?(h[X>>2]=g,h[j>>2]=b,h[q>>2]=0,x=0):(b=v,g=E),v=(b|0)<(g|0)?b:g,v=(x|0)<(v|0)?x:v,(v|0)>0&&(x=x-v|0,b=b-v|0,g=g-v|0,h[X>>2]=g,h[j>>2]=b,h[q>>2]=x)):(M=E+g|0,E=x+v|0,h[X>>2]=E,h[j>>2]=M,v=N+b|0,h[q>>2]=v,g=M-E|0,x=v-E|0,(E|0)<0?(h[j>>2]=g,h[q>>2]=x,h[X>>2]=0,E=0,v=x):g=M,b=E-g|0,x=v-g|0,(g|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,E=b,v=0):(x=v,v=g),g=E-x|0,b=v-x|0,(x|0)<0?(h[X>>2]=g,h[j>>2]=b,h[q>>2]=0,x=0):(b=v,g=E),v=(b|0)<(g|0)?b:g,v=(x|0)<(v|0)?x:v,(v|0)>0&&(x=x-v|0,b=b-v|0,g=g-v|0,h[X>>2]=g,h[j>>2]=b,h[q>>2]=x)),v=tt(p|0,m|0,(15-U|0)*3|0)|0,ee()|0,v=v&7,(v+-1|0)>>>0<6&&(M=h[22032+(v*12|0)+4>>2]|0,N=h[22032+(v*12|0)+8>>2]|0,E=(h[22032+(v*12|0)>>2]|0)+g|0,h[X>>2]=E,b=M+b|0,h[j>>2]=b,g=N+x|0,h[q>>2]=g,x=b-E|0,v=g-E|0,(E|0)<0&&(h[j>>2]=x,h[q>>2]=v,h[X>>2]=0,E=0,g=v,b=x),v=E-b|0,x=g-b|0,(b|0)<0?(h[X>>2]=v,h[q>>2]=x,h[j>>2]=0,E=v,b=0):x=g,g=E-x|0,v=b-x|0,(x|0)<0?(h[X>>2]=g,h[j>>2]=v,h[q>>2]=0,b=v,x=0):g=E,v=(b|0)<(g|0)?b:g,v=(x|0)<(v|0)?x:v,(v|0)>0&&(x=x-v|0,b=b-v|0,g=g-v|0,h[X>>2]=g,h[j>>2]=b,h[q>>2]=x)),U>>>0<K>>>0;)U=U+1|0;return _|0}function w1(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(K=Q,Q=Q+16|0,q=K,j=tt(p|0,m|0,45)|0,ee()|0,j=j&127,j>>>0>121)return h[g>>2]=0,h[g+4>>2]=0,h[g+8>>2]=0,h[g+12>>2]=0,X=5,Q=K,X|0;e:do if((yr(j)|0)!=0&&(E=tt(p|0,m|0,52)|0,ee()|0,E=E&15,(E|0)!=0)){_=1;t:for(;;){switch(X=tt(p|0,m|0,(15-_|0)*3|0)|0,ee()|0,X&7){case 5:break t;case 0:break;default:{N=m;break e}}if(_>>>0<E>>>0)_=_+1|0;else{N=m;break e}}for(b=1,_=m;;){switch(m=(15-b|0)*3|0,v=ft(7,0,m|0)|0,v=p&~v,x=_&~(ee()|0),_=tt(p|0,_|0,m|0)|0,ee()|0,_&7){case 1:{_=3;break}case 3:{_=2;break}case 2:{_=6;break}case 6:{_=4;break}case 4:{_=5;break}case 5:{_=1;break}default:_=_&7}if(p=ft(_|0,0,m|0)|0,p=p|v,_=ee()|0|x,b>>>0<E>>>0)b=b+1|0;else{N=_;break e}}}else N=m;while(!1);if(X=7696+(j*28|0)|0,h[g>>2]=h[X>>2],h[g+4>>2]=h[X+4>>2],h[g+8>>2]=h[X+8>>2],h[g+12>>2]=h[X+12>>2],!(xL(p,N,g)|0))return X=0,Q=K,X|0;if(X=g+4|0,h[q>>2]=h[X>>2],h[q+4>>2]=h[X+4>>2],h[q+8>>2]=h[X+8>>2],M=tt(p|0,N|0,52)|0,ee()|0,U=M&15,M&1?(x=h[X>>2]|0,E=g+8|0,v=h[E>>2]|0,M=g+12|0,m=h[M>>2]|0,_=(v*3|0)+x|0,x=m+(x*3|0)|0,h[X>>2]=x,h[E>>2]=_,v=(m*3|0)+v|0,h[M>>2]=v,m=_-x|0,b=v-x|0,(x|0)<0&&(h[E>>2]=m,h[M>>2]=b,h[X>>2]=0,_=m,x=0,v=b),b=x-_|0,m=v-_|0,(_|0)<0?(h[X>>2]=b,h[M>>2]=m,h[E>>2]=0,_=0):(m=v,b=x),x=b-m|0,v=_-m|0,(m|0)<0?(h[X>>2]=x,h[E>>2]=v,h[M>>2]=0,m=0):(v=_,x=b),_=(v|0)<(x|0)?v:x,_=(m|0)<(_|0)?m:_,(_|0)>0&&(h[X>>2]=x-_,h[E>>2]=v-_,h[M>>2]=m-_),v=U+1|0):v=U,!(yr(j)|0))_=0;else{e:do if(!U)_=0;else for(m=1;;){if(_=tt(p|0,N|0,(15-m|0)*3|0)|0,ee()|0,_=_&7,_|0)break e;if(m>>>0<U>>>0)m=m+1|0;else{_=0;break}}while(!1);_=(_|0)==4&1}if(!(b1(g,v,_,0)|0))(v|0)!=(U|0)&&(h[X>>2]=h[q>>2],h[X+4>>2]=h[q+4>>2],h[X+8>>2]=h[q+8>>2]);else{if(yr(j)|0)do;while((b1(g,v,0,0)|0)!=0);(v|0)!=(U|0)&&(E=g+12|0,p=h[E>>2]|0,_=(h[X>>2]|0)-p|0,b=g+8|0,p=(h[b>>2]|0)-p|0,m=lh(+((_<<1)+p|0)*.14285714285714285)|0,h[X>>2]=m,_=lh(+((p*3|0)-_|0)*.14285714285714285)|0,h[b>>2]=_,h[E>>2]=0,p=_-m|0,v=0-m|0,(m|0)<0?(h[b>>2]=p,h[E>>2]=v,h[X>>2]=0,_=p,m=0):v=0,x=m-_|0,p=v-_|0,(_|0)<0?(h[X>>2]=x,h[E>>2]=p,h[b>>2]=0,m=x,_=0):p=v,x=m-p|0,v=_-p|0,(p|0)<0?(h[X>>2]=x,h[b>>2]=v,h[E>>2]=0,m=x,p=0):v=_,_=(v|0)<(m|0)?v:m,_=(p|0)<(_|0)?p:_,(_|0)>0&&(h[X>>2]=m-_,h[b>>2]=v-_,h[E>>2]=p-_))}return X=0,Q=K,X|0}function S1(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0;return b=Q,Q=Q+48|0,_=b+24|0,v=b,x=w1(p,m,_)|0,x?(Q=b,x|0):(x=tt(p|0,m|0,52)|0,ee()|0,hue(_,x&15,v),M=+Wx(+ +ie[v+16>>3]),E=+Ta(+ +ie[v+8>>3],+ +ie[v>>3]),ie[g>>3]=M,ie[g+8>>3]=E,x=0,Q=b,x|0)}function Vm(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0;if(b=Q,Q=Q+16|0,x=b,_=w1(p,m,x)|0,_|0)return x=_,Q=b,x|0;_=tt(p|0,m|0,45)|0,ee()|0,_=(yr(_&127)|0)==0,v=tt(p|0,m|0,52)|0,ee()|0,v=v&15;e:do if(!_){if(v|0)for(_=1;;){if(E=ft(7,0,(15-_|0)*3|0)|0,!((E&p|0)==0&((ee()|0)&m|0)==0))break e;if(_>>>0<v>>>0)_=_+1|0;else break}return fL(x,v,0,5,g),E=0,Q=b,E|0}while(!1);return dL(x,v,0,6,g),E=0,Q=b,E|0}function wue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if(v=tt(p|0,m|0,45)|0,ee()|0,!(yr(v&127)|0))return v=2,h[g>>2]=v,0;if(v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,!v)return v=5,h[g>>2]=v,0;for(_=1;;){if(x=ft(7,0,(15-_|0)*3|0)|0,!((x&p|0)==0&((ee()|0)&m|0)==0)){_=2,p=6;break}if(_>>>0<v>>>0)_=_+1|0;else{_=5,p=6;break}}return(p|0)==6&&(h[g>>2]=_),0}function mq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;q=Q,Q=Q+128|0,N=q+112|0,x=q+96|0,U=q,v=tt(p|0,m|0,52)|0,ee()|0,E=v&15,h[N>>2]=E,b=tt(p|0,m|0,45)|0,ee()|0,b=b&127;e:do if(yr(b)|0){if(E|0)for(_=1;;){if(M=ft(7,0,(15-_|0)*3|0)|0,!((M&p|0)==0&((ee()|0)&m|0)==0)){v=0;break e}if(_>>>0<E>>>0)_=_+1|0;else break}if(v&1)v=1;else return M=ft(E+1|0,0,52)|0,U=ee()|0|m&-15728641,N=ft(7,0,(14-E|0)*3|0)|0,U=mq((M|p)&~N,U&~(ee()|0),g)|0,Q=q,U|0}else v=0;while(!1);if(_=w1(p,m,x)|0,!_){v?(uq(x,N,U),M=5):(hq(x,N,U),M=6);e:do if(yr(b)|0)if(!E)p=5;else for(_=1;;){if(b=ft(7,0,(15-_|0)*3|0)|0,!((b&p|0)==0&((ee()|0)&m|0)==0)){p=2;break e}if(_>>>0<E>>>0)_=_+1|0;else{p=5;break}}else p=2;while(!1);hp(g|0,-1,p<<2|0)|0;e:do if(v)for(x=0;;){if(b=U+(x<<4)|0,fue(b,h[N>>2]|0)|0,b=h[b>>2]|0,E=h[g>>2]|0,(E|0)==-1|(E|0)==(b|0))_=g;else{v=0;do{if(v=v+1|0,v>>>0>=p>>>0){_=1;break e}_=g+(v<<2)|0,E=h[_>>2]|0}while(!((E|0)==-1|(E|0)==(b|0)))}if(h[_>>2]=b,x=x+1|0,x>>>0>=M>>>0){_=0;break}}else for(x=0;;){if(b=U+(x<<4)|0,b1(b,h[N>>2]|0,0,1)|0,b=h[b>>2]|0,E=h[g>>2]|0,(E|0)==-1|(E|0)==(b|0))_=g;else{v=0;do{if(v=v+1|0,v>>>0>=p>>>0){_=1;break e}_=g+(v<<2)|0,E=h[_>>2]|0}while(!((E|0)==-1|(E|0)==(b|0)))}if(h[_>>2]=b,x=x+1|0,x>>>0>=M>>>0){_=0;break}}while(!1)}return U=_,Q=q,U|0}function Sue(){return 12}function yL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0;if(p>>>0>15)return E=4,E|0;if(ft(p|0,0,52)|0,E=ee()|0|134225919,!p){g=0,_=0;do yr(_)|0&&(ft(_|0,0,45)|0,b=E|(ee()|0),p=m+(g<<3)|0,h[p>>2]=-1,h[p+4>>2]=b,g=g+1|0),_=_+1|0;while((_|0)!=122);return g=0,g|0}g=0,b=0;do{if(yr(b)|0){for(ft(b|0,0,45)|0,_=1,v=-1,x=E|(ee()|0);M=ft(7,0,(15-_|0)*3|0)|0,v=v&~M,x=x&~(ee()|0),(_|0)!=(p|0);)_=_+1|0;M=m+(g<<3)|0,h[M>>2]=v,h[M+4>>2]=x,g=g+1|0}b=b+1|0}while((b|0)!=122);return g=0,g|0}function Tue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0;if(se=Q,Q=Q+16|0,ue=se,xe=tt(p|0,m|0,52)|0,ee()|0,xe=xe&15,g>>>0>15)return xe=4,Q=se,xe|0;if((xe|0)<(g|0))return xe=12,Q=se,xe|0;if((xe|0)!=(g|0))if(x=ft(g|0,0,52)|0,x=x|p,E=ee()|0|m&-15728641,(xe|0)>(g|0)){M=g;do ae=ft(7,0,(14-M|0)*3|0)|0,M=M+1|0,x=ae|x,E=ee()|0|E;while((M|0)<(xe|0));ae=x}else ae=x;else ae=p,E=m;K=tt(ae|0,E|0,45)|0,ee()|0;e:do if(yr(K&127)|0){if(M=tt(ae|0,E|0,52)|0,ee()|0,M=M&15,M|0)for(x=1;;){if(K=ft(7,0,(15-x|0)*3|0)|0,!((K&ae|0)==0&((ee()|0)&E|0)==0)){N=33;break e}if(x>>>0<M>>>0)x=x+1|0;else break}if(K=_,h[K>>2]=0,h[K+4>>2]=0,(xe|0)>(g|0)){for(K=m&-15728641,X=xe;;){if(j=X,X=X+-1|0,X>>>0>15|(xe|0)<(X|0)){N=19;break}if((xe|0)!=(X|0))if(x=ft(X|0,0,52)|0,x=x|p,M=ee()|0|K,(xe|0)<(j|0))q=x;else{N=X;do q=ft(7,0,(14-N|0)*3|0)|0,N=N+1|0,x=q|x,M=ee()|0|M;while((N|0)<(xe|0));q=x}else q=p,M=m;if(U=tt(q|0,M|0,45)|0,ee()|0,!(yr(U&127)|0))x=0;else{U=tt(q|0,M|0,52)|0,ee()|0,U=U&15;t:do if(!U)x=0;else for(N=1;;){if(x=tt(q|0,M|0,(15-N|0)*3|0)|0,ee()|0,x=x&7,x|0)break t;if(N>>>0<U>>>0)N=N+1|0;else{x=0;break}}while(!1);x=(x|0)==0&1}if(M=tt(p|0,m|0,(15-j|0)*3|0)|0,ee()|0,M=M&7,(M|0)==7){v=5,N=42;break}if(x=(x|0)!=0,(M|0)==1&x){v=5,N=42;break}if(q=M+(((M|0)!=0&x)<<31>>31)|0,q|0&&(N=xe-j|0,N=lp(7,0,N,((N|0)<0)<<31>>31)|0,U=ee()|0,x?(x=wr(N|0,U|0,5,0)|0,x=At(x|0,ee()|0,-5,-1)|0,x=cp(x|0,ee()|0,6,0)|0,x=At(x|0,ee()|0,1,0)|0,M=ee()|0):(x=N,M=U),j=q+-1|0,j=wr(N|0,U|0,j|0,((j|0)<0)<<31>>31|0)|0,j=At(x|0,M|0,j|0,ee()|0)|0,q=ee()|0,U=_,U=At(j|0,q|0,h[U>>2]|0,h[U+4>>2]|0)|0,q=ee()|0,j=_,h[j>>2]=U,h[j+4>>2]=q),(X|0)<=(g|0)){N=37;break}}if((N|0)==19)di(27634,27225,1407,27259);else if((N|0)==37){b=_,v=h[b+4>>2]|0,b=h[b>>2]|0;break}else if((N|0)==42)return Q=se,v|0}else v=0,b=0}else N=33;while(!1);e:do if((N|0)==33)if(K=_,h[K>>2]=0,h[K+4>>2]=0,(xe|0)>(g|0)){for(x=xe;;){if(v=tt(p|0,m|0,(15-x|0)*3|0)|0,ee()|0,v=v&7,(v|0)==7){v=5;break}if(b=xe-x|0,b=lp(7,0,b,((b|0)<0)<<31>>31)|0,v=wr(b|0,ee()|0,v|0,0)|0,b=ee()|0,K=_,b=At(h[K>>2]|0,h[K+4>>2]|0,v|0,b|0)|0,v=ee()|0,K=_,h[K>>2]=b,h[K+4>>2]=v,x=x+-1|0,(x|0)<=(g|0))break e}return Q=se,v|0}else v=0,b=0;while(!1);return $x(ae,E,xe,ue)|0&&di(27634,27225,1367,27274),xe=ue,ue=h[xe+4>>2]|0,((v|0)>-1|(v|0)==-1&b>>>0>4294967295)&((ue|0)>(v|0)|((ue|0)==(v|0)?(h[xe>>2]|0)>>>0>b>>>0:0))?(xe=0,Q=se,xe|0):(di(27634,27225,1447,27259),0)}function Eue(p,m,g,_,v,x){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0;var b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0;if(q=Q,Q=Q+16|0,b=q,v>>>0>15)return x=4,Q=q,x|0;if(E=tt(g|0,_|0,52)|0,ee()|0,E=E&15,(E|0)>(v|0))return x=12,Q=q,x|0;if($x(g,_,v,b)|0&&di(27634,27225,1367,27274),U=b,N=h[U+4>>2]|0,!(((m|0)>-1|(m|0)==-1&p>>>0>4294967295)&((N|0)>(m|0)|((N|0)==(m|0)?(h[U>>2]|0)>>>0>p>>>0:0))))return x=2,Q=q,x|0;U=v-E|0,v=ft(v|0,0,52)|0,M=ee()|0|_&-15728641,N=x,h[N>>2]=v|g,h[N+4>>2]=M,N=tt(g|0,_|0,45)|0,ee()|0;e:do if(yr(N&127)|0){if(E|0)for(b=1;;){if(N=ft(7,0,(15-b|0)*3|0)|0,!((N&g|0)==0&((ee()|0)&_|0)==0))break e;if(b>>>0<E>>>0)b=b+1|0;else break}if((U|0)<1)return x=0,Q=q,x|0;for(N=E^15,_=-1,M=1,b=1;;){E=U-M|0,E=lp(7,0,E,((E|0)<0)<<31>>31)|0,g=ee()|0;do if(b)if(b=wr(E|0,g|0,5,0)|0,b=At(b|0,ee()|0,-5,-1)|0,b=cp(b|0,ee()|0,6,0)|0,v=ee()|0,(m|0)>(v|0)|(m|0)==(v|0)&p>>>0>b>>>0){m=At(p|0,m|0,-1,-1)|0,m=eo(m|0,ee()|0,b|0,v|0)|0,b=ee()|0,j=x,K=h[j>>2]|0,j=h[j+4>>2]|0,ae=(N+_|0)*3|0,X=ft(7,0,ae|0)|0,j=j&~(ee()|0),_=cp(m|0,b|0,E|0,g|0)|0,p=ee()|0,v=At(_|0,p|0,2,0)|0,ae=ft(v|0,ee()|0,ae|0)|0,j=ee()|0|j,v=x,h[v>>2]=ae|K&~X,h[v+4>>2]=j,p=wr(_|0,p|0,E|0,g|0)|0,p=eo(m|0,b|0,p|0,ee()|0)|0,b=0,m=ee()|0;break}else{ae=x,X=h[ae>>2]|0,ae=h[ae+4>>2]|0,K=ft(7,0,(N+_|0)*3|0)|0,ae=ae&~(ee()|0),b=x,h[b>>2]=X&~K,h[b+4>>2]=ae,b=1;break}else X=x,v=h[X>>2]|0,X=h[X+4>>2]|0,_=(N+_|0)*3|0,j=ft(7,0,_|0)|0,X=X&~(ee()|0),ae=cp(p|0,m|0,E|0,g|0)|0,b=ee()|0,_=ft(ae|0,b|0,_|0)|0,X=ee()|0|X,K=x,h[K>>2]=_|v&~j,h[K+4>>2]=X,b=wr(ae|0,b|0,E|0,g|0)|0,p=eo(p|0,m|0,b|0,ee()|0)|0,b=0,m=ee()|0;while(!1);if((U|0)>(M|0))_=~M,M=M+1|0;else{m=0;break}}return Q=q,m|0}while(!1);if((U|0)<1)return ae=0,Q=q,ae|0;for(v=E^15,b=1;;)if(K=U-b|0,K=lp(7,0,K,((K|0)<0)<<31>>31)|0,ae=ee()|0,M=x,g=h[M>>2]|0,M=h[M+4>>2]|0,E=(v-b|0)*3|0,_=ft(7,0,E|0)|0,M=M&~(ee()|0),j=cp(p|0,m|0,K|0,ae|0)|0,X=ee()|0,E=ft(j|0,X|0,E|0)|0,M=ee()|0|M,N=x,h[N>>2]=E|g&~_,h[N+4>>2]=M,ae=wr(j|0,X|0,K|0,ae|0)|0,p=eo(p|0,m|0,ae|0,ee()|0)|0,m=ee()|0,(U|0)<=(b|0)){m=0;break}else b=b+1|0;return Q=q,m|0}function bL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;v=tt(m|0,g|0,52)|0,ee()|0,v=v&15,(m|0)==0&(g|0)==0|((_|0)>15|(v|0)>(_|0))?(x=-1,m=-1,g=0,v=0):(m=dq(m,g,v+1|0,_)|0,b=(ee()|0)&-15728641,g=ft(_|0,0,52)|0,g=m|g,b=b|(ee()|0),m=(Zi(g,b)|0)==0,x=v,m=m?-1:_,v=b),b=p,h[b>>2]=g,h[b+4>>2]=v,h[p+8>>2]=x,h[p+12>>2]=m}function Aq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;if(v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,x=_+8|0,h[x>>2]=v,(p|0)==0&(m|0)==0|((g|0)>15|(v|0)>(g|0))){g=_,h[g>>2]=0,h[g+4>>2]=0,h[x>>2]=-1,h[_+12>>2]=-1;return}if(p=dq(p,m,v+1|0,g)|0,x=(ee()|0)&-15728641,v=ft(g|0,0,52)|0,v=p|v,x=x|(ee()|0),p=_,h[p>>2]=v,h[p+4>>2]=x,p=_+12|0,Zi(v,x)|0){h[p>>2]=g;return}else{h[p>>2]=-1;return}}function wL(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0;if(g=p,m=h[g>>2]|0,g=h[g+4>>2]|0,!((m|0)==0&(g|0)==0)&&(_=tt(m|0,g|0,52)|0,ee()|0,_=_&15,E=ft(1,0,(_^15)*3|0)|0,m=At(E|0,ee()|0,m|0,g|0)|0,g=ee()|0,E=p,h[E>>2]=m,h[E+4>>2]=g,E=p+8|0,b=h[E>>2]|0,!((_|0)<(b|0)))){for(M=p+12|0,x=_;;){if((x|0)==(b|0)){_=5;break}if(N=(x|0)==(h[M>>2]|0),v=(15-x|0)*3|0,_=tt(m|0,g|0,v|0)|0,ee()|0,_=_&7,N&((_|0)==1&!0)){_=7;break}if(!((_|0)==7&!0)){_=10;break}if(N=ft(1,0,v|0)|0,m=At(m|0,g|0,N|0,ee()|0)|0,g=ee()|0,N=p,h[N>>2]=m,h[N+4>>2]=g,(x|0)>(b|0))x=x+-1|0;else{_=10;break}}if((_|0)==5){N=p,h[N>>2]=0,h[N+4>>2]=0,h[E>>2]=-1,h[M>>2]=-1;return}else if((_|0)==7){b=ft(1,0,v|0)|0,b=At(m|0,g|0,b|0,ee()|0)|0,E=ee()|0,N=p,h[N>>2]=b,h[N+4>>2]=E,h[M>>2]=x+-1;return}else if((_|0)==10)return}}function Yx(p){p=+p;var m=0;return m=p<0?p+6.283185307179586:p,+(p>=6.283185307179586?m+-6.283185307179586:m)}function zl(p,m){switch(p=+p,m=m|0,m|0){case 1:{p=p<0?p+6.283185307179586:p;break}case 2:{p=p>0?p+-6.283185307179586:p;break}default:}return+p}function Mue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=+ie[m>>3],_=+ie[p>>3],x=+zi(+((v-_)*.5)),g=+zi(+((+ie[m+8>>3]-+ie[p+8>>3])*.5)),g=x*x+g*(+ii(+v)*+ii(+_)*g),+(+Ta(+ +ws(+g),+ +ws(+(1-g)))*2)}function Zx(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=+ie[m>>3],_=+ie[p>>3],x=+zi(+((v-_)*.5)),g=+zi(+((+ie[m+8>>3]-+ie[p+8>>3])*.5)),g=x*x+g*(+ii(+v)*+ii(+_)*g),+(+Ta(+ +ws(+g),+ +ws(+(1-g)))*2*6371.007180918475)}function Cue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=+ie[m>>3],_=+ie[p>>3],x=+zi(+((v-_)*.5)),g=+zi(+((+ie[m+8>>3]-+ie[p+8>>3])*.5)),g=x*x+g*(+ii(+v)*+ii(+_)*g),+(+Ta(+ +ws(+g),+ +ws(+(1-g)))*2*6371.007180918475*1e3)}function gq(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[20624+(p<<3)>>3],m=0,m|0)}function Rue(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[20752+(p<<3)>>3],m=0,m|0)}function Iue(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[20880+(p<<3)>>3],m=0,m|0)}function Pue(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[21008+(p<<3)>>3],m=0,m|0)}function uT(p,m){p=p|0,m=m|0;var g=0;return p>>>0>15?(m=4,m|0):(g=lp(7,0,p,((p|0)<0)<<31>>31)|0,g=wr(g|0,ee()|0,120,0)|0,p=ee()|0,h[m>>2]=g|2,h[m+4>>2]=p,m=0,m|0)}function Lue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(E=Q,Q=Q+176|0,b=E,p=jx(p,m,b)|0,p|0)return b=p,Q=E,b|0;if(ie[g>>3]=0,p=h[b>>2]|0,(p|0)<=1)return b=0,Q=E,b|0;m=p+-1|0,p=0,_=+ie[b+8>>3],v=+ie[b+16>>3],x=0;do p=p+1|0,N=_,_=+ie[b+8+(p<<4)>>3],U=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=U*U+M*(+ii(+_)*+ii(+N)*M),x=x+ +Ta(+ +ws(+M),+ +ws(+(1-M)))*2;while((p|0)<(m|0));return ie[g>>3]=x,b=0,Q=E,b|0}function Due(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(E=Q,Q=Q+176|0,b=E,p=jx(p,m,b)|0,p|0)return b=p,x=+ie[g>>3],x=x*6371.007180918475,ie[g>>3]=x,Q=E,b|0;if(ie[g>>3]=0,p=h[b>>2]|0,(p|0)<=1)return b=0,x=0,x=x*6371.007180918475,ie[g>>3]=x,Q=E,b|0;m=p+-1|0,p=0,_=+ie[b+8>>3],v=+ie[b+16>>3],x=0;do p=p+1|0,N=_,_=+ie[b+8+(p<<4)>>3],U=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=U*U+M*(+ii(+N)*+ii(+_)*M),x=x+ +Ta(+ +ws(+M),+ +ws(+(1-M)))*2;while((p|0)!=(m|0));return ie[g>>3]=x,b=0,U=x,U=U*6371.007180918475,ie[g>>3]=U,Q=E,b|0}function Nue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(E=Q,Q=Q+176|0,b=E,p=jx(p,m,b)|0,p|0)return b=p,x=+ie[g>>3],x=x*6371.007180918475,x=x*1e3,ie[g>>3]=x,Q=E,b|0;if(ie[g>>3]=0,p=h[b>>2]|0,(p|0)<=1)return b=0,x=0,x=x*6371.007180918475,x=x*1e3,ie[g>>3]=x,Q=E,b|0;m=p+-1|0,p=0,_=+ie[b+8>>3],v=+ie[b+16>>3],x=0;do p=p+1|0,N=_,_=+ie[b+8+(p<<4)>>3],U=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=U*U+M*(+ii(+N)*+ii(+_)*M),x=x+ +Ta(+ +ws(+M),+ +ws(+(1-M)))*2;while((p|0)!=(m|0));return ie[g>>3]=x,b=0,U=x,U=U*6371.007180918475,U=U*1e3,ie[g>>3]=U,Q=E,b|0}function Fue(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0;if(p)for(x=p+4|0,b=p+8|0,_=1,v=p;;){if(m=h[v>>2]|0,m|0)do{if(g=h[m>>2]|0,g|0)do E=g,g=h[g+16>>2]|0,_t(E);while((g|0)!=0);E=m,m=h[m+8>>2]|0,_t(E)}while((m|0)!=0);if(m=v,v=h[v+8>>2]|0,_?(h[p>>2]=0,h[x>>2]=0,h[b>>2]=0):_t(m),v)_=0;else break}}function Bue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0;if(h[m>>2]=0,ue=m+4|0,h[ue>>2]=0,xe=m+8|0,h[xe>>2]=0,ae=h[p>>2]|0,(ae|0)<=0)return m=0,m|0;K=p+4|0,p=m,X=0;e:for(;;){if(X){if(g=Ea(1,12)|0,!g){g=5;break}h[p+8>>2]=g,p=g}if(M=h[K>>2]|0,N=Ea(1,12)|0,!N){p=13,g=37;break}if(j=p+4|0,_=h[j>>2]|0,h[((_|0)==0?p:_+8|0)>>2]=N,h[j>>2]=N,_=h[M+(X<<4)>>2]|0,(_|0)<3){p=1,g=37;break}v=M+(X<<4)+4|0,x=N+4|0,g=0,b=0;do{if(E=b,b=br(24)|0,!b){p=13,g=37;break e}PL(b|0,(h[v>>2]|0)+(g<<4)|0,16)|0,h[b+16>>2]=0,E?h[E+16>>2]=b:h[N>>2]=b,h[x>>2]=b,g=g+1|0}while((g|0)<(_|0));if(q=h[M+(X<<4)+8>>2]|0,(q|0)>0){U=M+(X<<4)+12|0,M=0;do{if(_=h[U>>2]|0,g=N,N=Ea(1,12)|0,!N){p=13,g=37;break e}if(h[g+8>>2]=N,h[j>>2]=N,E=h[_+(M<<3)>>2]|0,(E|0)<3){p=1,g=37;break e}_=_+(M<<3)+4|0,v=N+4|0,g=0,x=0;do{if(b=x,x=br(24)|0,!x){p=13,g=37;break e}PL(x|0,(h[_>>2]|0)+(g<<4)|0,16)|0,h[x+16>>2]=0,b?h[b+16>>2]=x:h[N>>2]=x,h[v>>2]=x,g=g+1|0}while((g|0)<(E|0));M=M+1|0}while((M|0)<(q|0))}if(X=X+1|0,(X|0)>=(ae|0)){p=0,g=50;break}}if((g|0)==5){if(!m)return m=13,m|0;for(_=1,v=m;;){if(p=h[v>>2]|0,p|0)do{if(g=h[p>>2]|0,g|0)do ae=g,g=h[g+16>>2]|0,_t(ae);while((g|0)!=0);ae=p,p=h[p+8>>2]|0,_t(ae)}while((p|0)!=0);if(p=v,v=h[v+8>>2]|0,_?(h[m>>2]=0,h[ue>>2]=0,h[xe>>2]=0):_t(p),v)_=0;else{p=13;break}}return p|0}else if((g|0)==37){if(!m)return m=p,m|0;for(v=1,x=m;;){if(g=h[x>>2]|0,g|0)do{if(_=h[g>>2]|0,_|0)do ae=_,_=h[_+16>>2]|0,_t(ae);while((_|0)!=0);ae=g,g=h[g+8>>2]|0,_t(ae)}while((g|0)!=0);if(g=x,x=h[x+8>>2]|0,v?(h[m>>2]=0,h[ue>>2]=0,h[xe>>2]=0):_t(g),x)v=0;else break}return p|0}else if((g|0)==50)return p|0;return 0}function Kx(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0;if(xe=Q,Q=Q+16|0,ue=xe,U=tt(p|0,m|0,52)|0,ee()|0,U=U&15,X=tt(g|0,_|0,52)|0,ee()|0,(U|0)!=(X&15|0))return ue=12,Q=xe,ue|0;if(M=tt(p|0,m|0,45)|0,ee()|0,M=M&127,N=tt(g|0,_|0,45)|0,ee()|0,N=N&127,M>>>0>121|N>>>0>121)return ue=5,Q=xe,ue|0;if(X=(M|0)!=(N|0),X){if(b=cL(M,N)|0,(b|0)==7)return ue=1,Q=xe,ue|0;E=cL(N,M)|0,(E|0)==7?di(27291,27315,164,27325):(ae=b,x=E)}else ae=0,x=0;q=yr(M)|0,j=yr(N)|0,h[ue>>2]=0,h[ue+4>>2]=0,h[ue+8>>2]=0,h[ue+12>>2]=0;do if(ae){N=h[4272+(M*28|0)+(ae<<2)>>2]|0,b=(N|0)>0;e:do if(j)if(b)for(M=0,E=g,b=_;;){switch(E=yue(E,b)|0,b=ee()|0,x|0){case 5:case 1:{x=3;break}case 3:{x=2;break}case 2:{x=6;break}case 6:{x=4;break}case 4:{x=5;break}default:}if(M=M+1|0,(M|0)==(N|0)){N=x,M=E,E=b;break e}}else N=x,M=g,E=_;else if(b)for(M=0,E=g,b=_;;){switch(E=vL(E,b)|0,b=ee()|0,x|0){case 1:{x=3;break}case 3:{x=2;break}case 2:{x=6;break}case 6:{x=4;break}case 4:{x=5;break}case 5:{x=1;break}default:}if(M=M+1|0,(M|0)==(N|0)){N=x,M=E,E=b;break e}}else N=x,M=g,E=_;while(!1);if(xL(M,E,ue)|0,X||di(27340,27315,194,27325),b=(q|0)!=0,x=(j|0)!=0,b&x&&di(27367,27315,195,27325),b){if(x=ll(p,m)|0,(x|0)==7){x=5;break}if(He[21968+(x*7|0)+ae>>0]|0){x=1;break}j=h[21136+(x*28|0)+(ae<<2)>>2]|0,X=j}else if(x){if(x=ll(M,E)|0,(x|0)==7){x=5;break}if(He[21968+(x*7|0)+N>>0]|0){x=1;break}X=0,j=h[21136+(N*28|0)+(x<<2)>>2]|0}else X=0,j=0;if((X|j|0)>=0){if((j|0)>0){g=ue+4|0,_=ue+8|0,q=ue+12|0,N=0,E=h[g>>2]|0,b=h[_>>2]|0,x=h[q>>2]|0;do K=b+E|0,m=(K|0)<0,se=m?K:0,b=x+b-se|0,p=(b|0)<0,M=p?b:0,E=x+E-se-M|0,se=(E|0)<0,x=se?0:E,E=se?E:0,b=(p?0:b)-E|0,E=(m?0:K)-M-E|0,M=(b|0)<(E|0)?b:E,M=(x|0)<(M|0)?x:M,(M|0)>0&&(E=E-M|0,b=b-M|0,x=x-M|0),N=N+1|0;while((N|0)!=(j|0));h[g>>2]=E,h[_>>2]=b,h[q>>2]=x}if((ae+-1|0)>>>0<6?(x=h[22032+(ae*12|0)>>2]|0,E=h[22032+(ae*12|0)+4>>2]|0,se=h[22032+(ae*12|0)+8>>2]|0,b=(E|0)<(x|0)?E:x,b=(se|0)<(b|0)?se:b,b=(b|0)>0?b:0,x=x-b|0,E=E-b|0,b=se-b|0):(x=0,E=0,b=0),U)for(;;)if(M=x*3|0,N=E*3|0,g=b*3|0,bc(U)|0?(m=M+E|0,p=(m|0)<0,se=N+b-(p?m:0)|0,K=(se|0)<0,E=x+g-(p?m:0)-(K?se:0)|0,b=(E|0)<0,ae=b?0:E,M=(K?0:se)-(b?E:0)|0,E=(p?0:m)-(K?se:0)-(b?E:0)|0,b=(M|0)<(E|0)?M:E,b=(ae|0)<(b|0)?ae:b,se=(b|0)>0,x=se?b:0,M=M-(se?b:0)|0,b=ae-(se?b:0)|0):(K=M+b|0,m=(K|0)<0,se=N+x-(m?K:0)|0,x=(se|0)<0,E=g+E-(m?K:0)-(x?se:0)|0,b=(E|0)<0,ae=b?0:E,M=(x?0:se)-(b?E:0)|0,E=(m?0:K)-(x?se:0)-(b?E:0)|0,b=(M|0)<(E|0)?M:E,b=(ae|0)<(b|0)?ae:b,se=(b|0)>0,x=se?b:0,M=M-(se?b:0)|0,b=ae-(se?b:0)|0),x=E-x|0,(U|0)>1)U=U+-1|0,E=M;else{E=M;break}if((X|0)>0){M=0;do m=x+E|0,p=(m|0)<0,se=E+b-(p?m:0)|0,K=(se|0)<0,ae=x+b-(p?m:0)-(K?se:0)|0,x=(ae|0)<0,b=x?0:ae,E=(K?0:se)-(x?ae:0)|0,ae=(p?0:m)-(K?se:0)-(x?ae:0)|0,x=(E|0)<(ae|0)?E:ae,x=(b|0)<(x|0)?b:x,se=(x|0)>0,b=b-(se?x:0)|0,E=E-(se?x:0)|0,x=ae-(se?x:0)|0,M=M+1|0;while((M|0)!=(X|0))}g=ue+4|0,U=ue+8|0,ae=h[U>>2]|0,_=ue+12|0,se=h[_>>2]|0,M=(h[g>>2]|0)+x|0,h[g>>2]=M,E=ae+E|0,h[U>>2]=E,x=se+b|0,h[_>>2]=x,b=E-M|0,(M|0)<0?(x=x-M|0,h[U>>2]=b,h[_>>2]=x,h[g>>2]=0,E=0):(b=E,E=M),(b|0)<0&&(E=E-b|0,h[g>>2]=E,x=x-b|0,h[_>>2]=x,h[U>>2]=0,b=0),N=E-x|0,M=b-x|0,(x|0)<0?(h[g>>2]=N,h[U>>2]=M,h[_>>2]=0,E=N,x=0):M=b,b=(M|0)<(E|0)?M:E,b=(x|0)<(b|0)?x:b,(b|0)>0&&(h[g>>2]=E-b,h[U>>2]=M-b,h[_>>2]=x-b),K=77}else x=5}else if(xL(g,_,ue)|0,(q|0)!=0&(j|0)!=0)if((N|0)!=(M|0)&&di(27398,27315,264,27325),b=ll(p,m)|0,x=ll(g,_)|0,(b|0)==7|(x|0)==7)x=5;else if(He[21968+(b*7|0)+x>>0]|0)x=1;else if(g=h[21136+(b*28|0)+(x<<2)>>2]|0,(g|0)>0){U=ue+4|0,_=ue+8|0,q=ue+12|0,N=0,E=h[U>>2]|0,b=h[_>>2]|0,x=h[q>>2]|0;do ae=b+E|0,K=(ae|0)<0,p=K?ae:0,b=x+b-p|0,m=(b|0)<0,M=m?b:0,E=x+E-p-M|0,p=(E|0)<0,x=p?0:E,E=p?E:0,b=(m?0:b)-E|0,E=(K?0:ae)-M-E|0,M=(b|0)<(E|0)?b:E,M=(x|0)<(M|0)?x:M,(M|0)>0&&(E=E-M|0,b=b-M|0,x=x-M|0),N=N+1|0;while((N|0)!=(g|0));h[U>>2]=E,h[_>>2]=b,h[q>>2]=x,K=77}else K=77;else K=77;while(!1);return(K|0)==77&&(x=ue+4|0,h[v>>2]=h[x>>2],h[v+4>>2]=h[x+4>>2],h[v+8>>2]=h[x+8>>2],x=0),se=x,Q=xe,se|0}function vq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0;if(x=tt(p|0,m|0,52)|0,ee()|0,x=x&15,Ae=tt(p|0,m|0,45)|0,ee()|0,Ae=Ae&127,Ae>>>0>121)return _=5,_|0;if(ue=yr(Ae)|0,ft(x|0,0,52)|0,E=ee()|0|134225919,b=_,h[b>>2]=-1,h[b+4>>2]=E,b=h[g>>2]|0,E=h[g+4>>2]|0,g=h[g+8>>2]|0,!x){m=(b|0)<0,xe=m?b:0,we=E-xe|0,ue=(we|0)<0,xe=(ue?0-we|0:0)+(g-xe)|0,g=(xe|0)<0,v=g?0:xe,xe=g?xe:0,g=(ue?0:we)-xe|0,xe=(m?0:b)-(ue?we:0)-xe|0,we=(g|0)<(xe|0)?g:xe,we=(v|0)<(we|0)?v:we,we=(we|0)>0?we:0,v=v-we|0,g=g-we|0;e:do switch(xe-we|0){case 0:switch(g|0){case 0:if(v){v=(v|0)==1?1:7,se=11;break e}else{v=0;break e}case 1:if(v){v=(v|0)==1?3:7,se=11;break e}else{v=2;break e}default:return _=1,_|0}case 1:switch(g|0){case 0:if(v){v=(v|0)==1?5:7,se=11;break e}else{v=4;break e}case 1:{if(v)v=1;else{v=6;break e}return v|0}default:return _=1,_|0}default:return _=1,_|0}while(!1);return(se|0)==11&&(v|0)==7||(v=lL(Ae,v)|0,(v|0)==127)?(_=1,_|0):(we=ft(v|0,0,45)|0,Ae=ee()|0,se=_,Ae=h[se+4>>2]&-1040385|Ae,h[_>>2]=h[se>>2]|we,h[_+4>>2]=Ae,_=0,_|0)}for(;;){if(ae=x,x=x+-1|0,K=b-g|0,X=E-g|0,M=K>>>0>715827881|X>>>0>715827881,bc(ae)|0){if(M){if(U=(K|0)>0,q=2147483647-K|0,j=-2147483648-K|0,U?(q|0)<(K|0):(j|0)>(K|0)){v=1,se=107;break}if(be=K<<1,U?(2147483647-be|0)<(K|0):(-2147483648-be|0)>(K|0)){v=1,se=107;break}if((X|0)>0?(2147483647-X|0)<(X|0):(-2147483648-X|0)>(X|0)){v=1,se=107;break}if(M=K*3|0,N=X<<1,(U?(q|0)<(N|0):(j|0)>(N|0))||((K|0)>-1?(M|-2147483648|0)>=(X|0):(M^-2147483648|0)<(X|0))){v=1,se=107;break}}else M=K*3|0,N=X<<1;if(q=lh(+(M-X|0)*.14285714285714285)|0,U=lh(+(N+K|0)*.14285714285714285)|0,N=(U|0)<(q|0),M=N?q:U,N=N?U:q,(N|0)<0){if((N|0)==-2147483648||((M|0)>0?(2147483647-M|0)<(N|0):(-2147483648-M|0)>(N|0))){se=24;break}if((M|0)>-1?(M|-2147483648|0)>=(N|0):(M^-2147483648|0)<(N|0)){se=24;break}}j=(q|0)<0,X=U-(j?q:0)|0,Ke=(X|0)<0,Be=(j?0-q|0:0)-(Ke?X:0)|0,K=(Be|0)<0,j=(j?0:q)-(Ke?X:0)-(K?Be:0)|0,X=(Ke?0:X)-(K?Be:0)|0,Be=K?0:Be,K=(X|0)<(j|0)?X:j,K=(Be|0)<(K|0)?Be:K,Ke=(K|0)>0,j=j-(Ke?K:0)|0,X=X-(Ke?K:0)|0,K=Be-(Ke?K:0)|0,Ke=(j*3|0)+X|0,Be=(Ke|0)<0,be=(X*3|0)+K-(Be?Ke:0)|0,M=(be|0)<0,q=(K*3|0)+j-(Be?Ke:0)-(M?be:0)|0,U=(q|0)<0,Me=U?0:q,N=(M?0:be)-(U?q:0)|0,q=(Be?0:Ke)-(M?be:0)-(U?q:0)|0,U=(N|0)<(q|0)?N:q,U=(Me|0)<(U|0)?Me:U,be=(U|0)>0,M=be?U:0,N=N-(be?U:0)|0,U=Me-(be?U:0)|0}else{if(M){if(N=(K|0)>0,N?(2147483647-K|0)<(K|0):(-2147483648-K|0)>(K|0)){v=1,se=107;break}if(M=K<<1,U=(X|0)>0,U?(2147483647-X|0)<(X|0):(-2147483648-X|0)>(X|0)){v=1,se=107;break}if(j=X<<1,U?(2147483647-j|0)<(X|0):(-2147483648-j|0)>(X|0)){v=1,se=107;break}if(N?(2147483647-M|0)<(X|0):(-2147483648-M|0)>(X|0)){v=1,se=107;break}if(N=X*3|0,(X|0)>-1?(N|-2147483648|0)>=(K|0):(N^-2147483648|0)<(K|0)){v=1,se=107;break}}else M=K<<1,N=X*3|0;if(q=lh(+(M+X|0)*.14285714285714285)|0,U=lh(+(N-K|0)*.14285714285714285)|0,N=(U|0)<(q|0),M=N?q:U,N=N?U:q,(N|0)<0){if((N|0)==-2147483648||((M|0)>0?(2147483647-M|0)<(N|0):(-2147483648-M|0)>(N|0))){se=36;break}if((M|0)>-1?(M|-2147483648|0)>=(N|0):(M^-2147483648|0)<(N|0)){se=36;break}}j=(q|0)<0,X=U-(j?q:0)|0,Me=(X|0)<0,be=(j?0-q|0:0)-(Me?X:0)|0,K=(be|0)<0,j=(j?0:q)-(Me?X:0)-(K?be:0)|0,X=(Me?0:X)-(K?be:0)|0,be=K?0:be,K=(X|0)<(j|0)?X:j,K=(be|0)<(K|0)?be:K,Me=(K|0)>0,j=j-(Me?K:0)|0,X=X-(Me?K:0)|0,K=be-(Me?K:0)|0,Me=(j*3|0)+K|0,be=(Me|0)<0,Be=(X*3|0)+j-(be?Me:0)|0,M=(Be|0)<0,q=(K*3|0)+X-(be?Me:0)-(M?Be:0)|0,U=(q|0)<0,Ke=U?0:q,N=(M?0:Be)-(U?q:0)|0,q=(be?0:Me)-(M?Be:0)-(U?q:0)|0,U=(N|0)<(q|0)?N:q,U=(Ke|0)<(U|0)?Ke:U,Be=(U|0)>0,M=Be?U:0,N=N-(Be?U:0)|0,U=Ke-(Be?U:0)|0}M=b+(M-q)|0,Me=(M|0)<0,N=E-N-(Me?M:0)|0,q=(N|0)<0,Be=g-U+(Me?0-M|0:0)+(q?0-N|0:0)|0,b=(Be|0)<0,U=b?0:Be,be=(q?0:N)-(b?Be:0)|0,Be=(Me?0:M)-(q?N:0)-(b?Be:0)|0,b=(be|0)<(Be|0)?be:Be,b=(U|0)<(b|0)?U:b,g=(b|0)>0,Be=Be-(g?b:0)|0,N=_,q=h[N>>2]|0,N=h[N+4>>2]|0,E=(15-ae|0)*3|0,M=ft(7,0,E|0)|0,M=q&~M,N=N&~(ee()|0),q=(Be|0)<0,Me=q?Be:0,be=be-(g?b:0)-Me|0,Ke=(be|0)<0,Me=(Ke?0-be|0:0)+(U-(g?b:0)-Me)|0,b=(Me|0)<0,g=b?0:Me,Me=b?Me:0,b=(Ke?0:be)-Me|0,Me=(q?0:Be)-(Ke?be:0)-Me|0,be=(b|0)<(Me|0)?b:Me,be=(g|0)<(be|0)?g:be,be=(be|0)>0?be:0,g=g-be|0,b=b-be|0;e:do switch(Me-be|0){case 0:switch(b|0){case 0:{g=(g|0)==0?0:(g|0)==1?1:7;break e}case 1:{g=(g|0)==0?2:(g|0)==1?3:7;break e}default:{se=45;break e}}case 1:switch(b|0){case 0:{g=(g|0)==0?4:(g|0)==1?5:7;break e}case 1:if(g){se=45;break e}else{g=6;break e}default:{se=45;break e}}default:se=45}while(!1);if((se|0)==45&&(se=0,g=7),Ke=ft(g|0,0,E|0)|0,Me=ee()|0|N,be=_,h[be>>2]=Ke|M,h[be+4>>2]=Me,(ae|0)<=1){se=47;break}else b=j,E=X,g=K}if((se|0)==24)di(27634,27425,416,27447);else if((se|0)==36)di(27634,27425,464,27461);else if((se|0)==47){if((j|0)>1|(X|0)>1|(K|0)>1)return be=1,be|0;Be=(j|0)<0,Me=Be?j:0,be=X-Me|0,Ke=(be|0)<0,Me=(Ke?0-be|0:0)+(K-Me)|0,x=(Me|0)<0,g=x?0:Me,Me=x?Me:0,x=(Ke?0:be)-Me|0,Me=(Be?0:j)-(Ke?be:0)-Me|0,be=(x|0)<(Me|0)?x:Me,be=(g|0)<(be|0)?g:be,be=(be|0)>0?be:0,g=g-be|0,x=x-be|0;e:do switch(Me-be|0){case 0:switch(x|0){case 0:{x=(g|0)==0?0:(g|0)==1?1:7;break e}case 1:{x=(g|0)==0?2:(g|0)==1?3:7;break e}default:{se=55;break e}}case 1:switch(x|0){case 0:{x=(g|0)==0?4:(g|0)==1?5:7;break e}case 1:if(g){se=55;break e}else{x=6;break e}default:{se=55;break e}}default:se=55}while(!1);(se|0)==55&&(x=7),E=lL(Ae,x)|0,(E|0)==127?N=0:N=yr(E)|0;e:do if(x){if(ue){if(g=ll(p,m)|0,(g|0)==7)return be=5,be|0;b=h[21344+(g*28|0)+(x<<2)>>2]|0;t:do if((b|0)>0)for(g=x,x=0;;){switch(g|0){case 1:{g=5;break}case 5:{g=4;break}case 4:{g=6;break}case 6:{g=2;break}case 2:{g=3;break}case 3:{g=1;break}default:}if(x=x+1|0,(x|0)==(b|0))break t}else g=x;while(!1);if((g|0)==1)return be=9,be|0;x=lL(Ae,g)|0,(x|0)==127&&di(27476,27315,415,27506),yr(x)|0?di(27521,27315,416,27506):(v=x,we=b,xe=g)}else v=E,we=0,xe=x;if(M=h[4272+(Ae*28|0)+(xe<<2)>>2]|0,(M|0)<=-1&&di(27552,27315,423,27506),!N){if((we|0)<0)return be=5,be|0;if(we|0){b=_,g=0,x=h[b>>2]|0,b=h[b+4>>2]|0;do x=zm(x,b)|0,b=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=b,g=g+1|0;while((g|0)<(we|0))}if((M|0)<=0){se=104;break}for(b=_,g=0,x=h[b>>2]|0,b=h[b+4>>2]|0;;)if(x=zm(x,b)|0,b=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=b,g=g+1|0,(g|0)==(M|0)){se=104;break e}}if(E=cL(v,Ae)|0,(E|0)==7&&di(27291,27315,432,27506),g=_,x=h[g>>2]|0,g=h[g+4>>2]|0,(M|0)>0){b=0;do x=zm(x,g)|0,g=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=g,b=b+1|0;while((b|0)!=(M|0))}if(g=ll(x,g)|0,(g|0)==7&&di(27634,27315,444,27506),x=aL(v)|0,x=h[(x?21760:21552)+(E*28|0)+(g<<2)>>2]|0,(x|0)<0&&di(27634,27315,458,27506),!x)se=104;else{E=_,g=0,b=h[E>>2]|0,E=h[E+4>>2]|0;do b=gL(b,E)|0,E=ee()|0,be=_,h[be>>2]=b,h[be+4>>2]=E,g=g+1|0;while((g|0)<(x|0));se=104}}else if((ue|0)!=0&(N|0)!=0){if(v=ll(p,m)|0,g=_,g=ll(h[g>>2]|0,h[g+4>>2]|0)|0,(v|0)==7|(g|0)==7||(g=h[21344+(v*28|0)+(g<<2)>>2]|0,(g|0)<0))return be=5,be|0;if(!g)v=E,se=105;else{b=_,v=0,x=h[b>>2]|0,b=h[b+4>>2]|0;do x=zm(x,b)|0,b=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=b,v=v+1|0;while((v|0)<(g|0));v=E,se=104}}else v=E,se=104;while(!1);return(se|0)==104&&N&&(se=105),(se|0)==105&&(be=_,(ll(h[be>>2]|0,h[be+4>>2]|0)|0)==1)?(be=9,be|0):(Me=_,Be=h[Me>>2]|0,Me=h[Me+4>>2]&-1040385,Ke=ft(v|0,0,45)|0,Me=Me|(ee()|0),be=_,h[be>>2]=Be|Ke,h[be+4>>2]=Me,be=0,be|0)}else if((se|0)==107)return v|0;return 0}function Oue(p,m,g,_,v,x){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0;var b=0,E=0;return E=Q,Q=Q+16|0,b=E,v|0?(b=15,Q=E,b|0):(p=Kx(p,m,g,_,b)|0,p||(v=h[b+4>>2]|0,p=h[b+8>>2]|0,h[x>>2]=(h[b>>2]|0)-p,h[x+4>>2]=v-p,p=0),b=p,Q=E,b|0)}function Uue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0;return q=Q,Q=Q+16|0,U=q,_|0?(U=15,Q=q,U|0):(E=h[g>>2]|0,b=h[g+4>>2]|0,h[U>>2]=E,M=U+4|0,h[M>>2]=b,N=U+8|0,h[N>>2]=0,g=(b|0)<(E|0),_=g?E:b,g=g?b:E,(g|0)<0?!((g|0)==-2147483648||((_|0)>0?(2147483647-_|0)<(g|0):(-2147483648-_|0)>(g|0)))&&!((_|0)>-1?(_|-2147483648|0)>=(g|0):(_^-2147483648|0)<(g|0))?x=5:_=1:x=5,(x|0)==5&&(_=b-E|0,x=0-E|0,(E|0)<0?(h[M>>2]=_,h[N>>2]=x,h[U>>2]=0,E=0):(_=b,x=0),b=E-_|0,g=x-_|0,(_|0)<0?(h[U>>2]=b,h[N>>2]=g,h[M>>2]=0,E=b,_=0):g=x,b=E-g|0,x=_-g|0,(g|0)<0?(h[U>>2]=b,h[M>>2]=x,h[N>>2]=0,g=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[U>>2]=b-_,h[M>>2]=x-_,h[N>>2]=g-_),_=vq(p,m,U,v)|0),U=_,Q=q,U|0)}function SL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0;return M=Q,Q=Q+32|0,b=M+12|0,E=M,x=Kx(p,m,p,m,b)|0,x|0?(E=x,Q=M,E|0):(p=Kx(p,m,g,_,E)|0,p|0?(E=p,Q=M,E|0):(p=(h[b>>2]|0)-(h[E>>2]|0)|0,N=(p|0)<0,_=N?0-p|0:0,g=_+((h[b+4>>2]|0)-(h[E+4>>2]|0))|0,m=(g|0)<0,_=(h[b+8>>2]|0)-(h[E+8>>2]|0)+_+(m?0-g|0:0)|0,x=(_|0)<0,b=x?0:_,_=x?_:0,x=(m?0:g)-_|0,_=(N?0:p)-(m?g:0)-_|0,E=(x|0)<(_|0)?x:_,E=(b|0)<(E|0)?b:E,E=(E|0)>0?E:0,b=b-E|0,x=x-E|0,E=_-E|0,E=(E|0)>-1?E:0-E|0,x=(x|0)>-1?x:0-x|0,b=(b|0)>-1?b:0-b|0,b=(x|0)>(b|0)?x:b,b=(E|0)>(b|0)?E:b,E=v,h[E>>2]=b,h[E+4>>2]=((b|0)<0)<<31>>31,E=0,Q=M,E|0))}function kue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0;return b=Q,Q=Q+16|0,x=b,p=SL(p,m,g,_,x)|0,p|0?(x=p,Q=b,x|0):(g=x,g=At(h[g>>2]|0,h[g+4>>2]|0,1,0)|0,_=ee()|0,x=v,h[x>>2]=g,h[x+4>>2]=_,x=0,Q=b,x|0)}function zue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0;return M=Q,Q=Q+16|0,x=M,b=SL(p,m,g,_,x)|0,b|0?(v=b,Q=M,v|0):(b=x,x=h[b>>2]|0,b=h[b+4>>2]|0,(x|0)==0&(b|0)==0?(h[v>>2]=p,h[v+4>>2]=m,v=0,Q=M,v|0):(E=_q(p,m,g,_,x,b,v,0,0,1,0)|0,E?(v=(_q(g,_,p,m,x,b,v,x,b,-1,-1)|0)==0,v=v?0:E,Q=M,v|0):(v=0,Q=M,v|0)))}function _q(p,m,g,_,v,x,b,E,M,N,U){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0,E=E|0,M=M|0,N=N|0,U=U|0;var q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0;if(Ut=Q,Q=Q+48|0,q=Ut+24|0,j=Ut+12|0,je=Ut,h[q>>2]=0,h[q+4>>2]=0,h[q+8>>2]=0,h[j>>2]=0,h[j+4>>2]=0,h[j+8>>2]=0,Kx(p,m,p,m,q)|0&&di(27634,27315,696,27575),Kx(p,m,g,_,j)|0&&di(27634,27315,701,27575),ae=q+8|0,_=h[ae>>2]|0,g=_-(h[q>>2]|0)|0,h[q>>2]=g,gt=q+4|0,_=(h[gt>>2]|0)-_|0,h[gt>>2]=_,gt=_+g|0,q=0-gt|0,h[ae>>2]=q,ae=j+8|0,se=h[ae>>2]|0,xe=se-(h[j>>2]|0)|0,h[j>>2]=xe,be=j+4|0,se=(h[be>>2]|0)-se|0,h[be>>2]=se,be=se+xe|0,h[ae>>2]=0-be,Me=1/(+(v>>>0)+4294967296*+(x|0)),Be=Me*+(xe-g|0),Ke=Me*+(se-_|0),Me=Me*+(gt-be|0),h[je>>2]=g,be=je+4|0,h[be>>2]=_,gt=je+8|0,h[gt>>2]=q,(x|0)<0)return N=0,Q=Ut,N|0;for(Ae=+(g|0),we=+(_|0),ue=+(q|0),xe=0,se=0;;){if(K=+(xe>>>0)+4294967296*+(se|0),lt=Be*K+Ae,X=Ke*K+we,K=Me*K+ue,_=~~+vT(+lt),q=~~+vT(+X),g=~~+vT(+K),lt=+Qs(+(+(_|0)-lt)),X=+Qs(+(+(q|0)-X)),K=+Qs(+(+(g|0)-K)),lt>X&lt>K?(j=g+q|0,_=0-j|0):(j=0-_|0,X>K&&(q=j-g|0)),h[be>>2]=q,h[je>>2]=j,h[gt>>2]=0,g=_+q|0,(_|0)>0?(h[be>>2]=g,h[gt>>2]=_,h[je>>2]=0,j=0):(g=q,_=0),(g|0)<0?(q=j-g|0,h[je>>2]=q,_=_-g|0,h[gt>>2]=_,h[be>>2]=0,j=q-_|0,g=0-_|0,(_|0)<0?(h[je>>2]=j,h[be>>2]=g,h[gt>>2]=0,ae=g,_=0):(ae=0,j=q)):ae=g,g=(ae|0)<(j|0)?ae:j,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[je>>2]=j-g,h[be>>2]=ae-g,h[gt>>2]=_-g),g=wr(xe|0,se|0,N|0,U|0)|0,g=At(g|0,ee()|0,E|0,M|0)|0,ee()|0,g=vq(p,m,je,b+(g<<3)|0)|0,g|0){_=20;break}if(ae=xe,xe=At(xe|0,se|0,1,0)|0,j=se,se=ee()|0,!((j|0)<(x|0)|(j|0)==(x|0)&ae>>>0<v>>>0)){g=0,_=20;break}}return(_|0)==20?(Q=Ut,g|0):0}function lp(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;if((g|0)==0&(_|0)==0)return v=0,x=1,On(v|0),x|0;x=p,v=m,p=1,m=0;do b=(g&1|0)==0&!0,p=wr((b?1:x)|0,(b?0:v)|0,p|0,m|0)|0,m=ee()|0,g=Dq(g|0,_|0,1)|0,_=ee()|0,x=wr(x|0,v|0,x|0,v|0)|0,v=ee()|0;while(!((g|0)==0&(_|0)==0));return On(m|0),p|0}function TL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0;E=Q,Q=Q+16|0,x=E,b=tt(p|0,m|0,52)|0,ee()|0,b=b&15;do if(b){if(v=S1(p,m,x)|0,!v){N=+ie[x>>3],M=1/+ii(+N),U=+ie[26032+(b<<3)>>3],ie[g>>3]=N+U,ie[g+8>>3]=N-U,N=+ie[x+8>>3],M=U*M,ie[g+16>>3]=M+N,ie[g+24>>3]=N-M;break}return b=v,Q=E,b|0}else{if(v=tt(p|0,m|0,45)|0,ee()|0,v=v&127,v>>>0>121)return b=5,Q=E,b|0;x=22128+(v<<5)|0,h[g>>2]=h[x>>2],h[g+4>>2]=h[x+4>>2],h[g+8>>2]=h[x+8>>2],h[g+12>>2]=h[x+12>>2],h[g+16>>2]=h[x+16>>2],h[g+20>>2]=h[x+20>>2],h[g+24>>2]=h[x+24>>2],h[g+28>>2]=h[x+28>>2];break}while(!1);return eue(g,_?1.4:1.1),_=26160+(b<<3)|0,(h[_>>2]|0)==(p|0)&&(h[_+4>>2]|0)==(m|0)&&(ie[g>>3]=1.5707963267948966),b=26288+(b<<3)|0,(h[b>>2]|0)==(p|0)&&(h[b+4>>2]|0)==(m|0)&&(ie[g+8>>3]=-1.5707963267948966),+ie[g>>3]!=1.5707963267948966&&+ie[g+8>>3]!=-1.5707963267948966?(b=0,Q=E,b|0):(ie[g+16>>3]=3.141592653589793,ie[g+24>>3]=-3.141592653589793,b=0,Q=E,b|0)}function Vue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0;N=Q,Q=Q+48|0,b=N+32|0,x=N+40|0,E=N,mL(b,0,0,0),M=h[b>>2]|0,b=h[b+4>>2]|0;do if(g>>>0<=15){if(v=Jx(_)|0,v|0){_=E,h[_>>2]=0,h[_+4>>2]=0,h[E+8>>2]=v,h[E+12>>2]=-1,_=E+16|0,M=E+29|0,h[_>>2]=0,h[_+4>>2]=0,h[_+8>>2]=0,He[_+12>>0]=0,He[M>>0]=He[x>>0]|0,He[M+1>>0]=He[x+1>>0]|0,He[M+2>>0]=He[x+2>>0]|0;break}if(v=Ea((h[m+8>>2]|0)+1|0,32)|0,v){EL(m,v),U=E,h[U>>2]=M,h[U+4>>2]=b,h[E+8>>2]=0,h[E+12>>2]=g,h[E+16>>2]=_,h[E+20>>2]=m,h[E+24>>2]=v,He[E+28>>0]=0,M=E+29|0,He[M>>0]=He[x>>0]|0,He[M+1>>0]=He[x+1>>0]|0,He[M+2>>0]=He[x+2>>0]|0;break}else{_=E,h[_>>2]=0,h[_+4>>2]=0,h[E+8>>2]=13,h[E+12>>2]=-1,_=E+16|0,M=E+29|0,h[_>>2]=0,h[_+4>>2]=0,h[_+8>>2]=0,He[_+12>>0]=0,He[M>>0]=He[x>>0]|0,He[M+1>>0]=He[x+1>>0]|0,He[M+2>>0]=He[x+2>>0]|0;break}}else M=E,h[M>>2]=0,h[M+4>>2]=0,h[E+8>>2]=4,h[E+12>>2]=-1,M=E+16|0,U=E+29|0,h[M>>2]=0,h[M+4>>2]=0,h[M+8>>2]=0,He[M+12>>0]=0,He[U>>0]=He[x>>0]|0,He[U+1>>0]=He[x+1>>0]|0,He[U+2>>0]=He[x+2>>0]|0;while(!1);hT(E),h[p>>2]=h[E>>2],h[p+4>>2]=h[E+4>>2],h[p+8>>2]=h[E+8>>2],h[p+12>>2]=h[E+12>>2],h[p+16>>2]=h[E+16>>2],h[p+20>>2]=h[E+20>>2],h[p+24>>2]=h[E+24>>2],h[p+28>>2]=h[E+28>>2],Q=N}function hT(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0;if(Ae=Q,Q=Q+336|0,X=Ae+168|0,K=Ae,_=p,g=h[_>>2]|0,_=h[_+4>>2]|0,(g|0)==0&(_|0)==0){Q=Ae;return}if(m=p+28|0,He[m>>0]|0?(g=xq(g,_)|0,_=ee()|0):He[m>>0]=1,we=p+20|0,!(h[h[we>>2]>>2]|0)){m=p+24|0,g=h[m>>2]|0,g|0&&_t(g),se=p,h[se>>2]=0,h[se+4>>2]=0,h[p+8>>2]=0,h[we>>2]=0,h[p+12>>2]=-1,h[p+16>>2]=0,h[m>>2]=0,Q=Ae;return}se=p+16|0,m=h[se>>2]|0,v=m&15;e:do if((g|0)==0&(_|0)==0)xe=p+24|0;else{ae=p+12|0,q=(v|0)==3,U=m&255,M=(v|1|0)==3,j=p+24|0,N=(v+-1|0)>>>0<3,b=(v|2|0)==3,E=K+8|0;t:for(;;){if(x=tt(g|0,_|0,52)|0,ee()|0,x=x&15,(x|0)==(h[ae>>2]|0)){switch(U&15){case 0:case 2:case 3:{if(v=S1(g,_,X)|0,v|0){ue=15;break t}if(ML(h[we>>2]|0,h[j>>2]|0,X)|0){ue=19;break t}break}default:}if(M&&(v=h[(h[we>>2]|0)+4>>2]|0,h[X>>2]=h[v>>2],h[X+4>>2]=h[v+4>>2],h[X+8>>2]=h[v+8>>2],h[X+12>>2]=h[v+12>>2],rq(26896,X)|0)){if(_L(h[(h[we>>2]|0)+4>>2]|0,x,K)|0){ue=25;break}if(v=K,(h[v>>2]|0)==(g|0)&&(h[v+4>>2]|0)==(_|0)){ue=29;break}}if(N){if(v=Vm(g,_,X)|0,v|0){ue=32;break}if(TL(g,_,K,0)|0){ue=36;break}if(b&&bq(h[we>>2]|0,h[j>>2]|0,X,K)|0){ue=42;break}if(M&&wq(h[we>>2]|0,h[j>>2]|0,X,K)|0){ue=42;break}}if(q){if(m=TL(g,_,X,1)|0,v=h[j>>2]|0,m|0){ue=45;break}if(uL(v,X)|0){if(oq(K,X),sq(X,h[j>>2]|0)|0){ue=53;break}if(ML(h[we>>2]|0,h[j>>2]|0,E)|0){ue=53;break}if(wq(h[we>>2]|0,h[j>>2]|0,K,X)|0){ue=53;break}}}}do if((x|0)<(h[ae>>2]|0)){if(m=TL(g,_,X,1)|0,v=h[j>>2]|0,m|0){ue=58;break t}if(!(uL(v,X)|0)){ue=73;break}if(sq(h[j>>2]|0,X)|0&&(oq(K,X),bq(h[we>>2]|0,h[j>>2]|0,K,X)|0)){ue=65;break t}if(g=pq(g,_,x+1|0,K)|0,g|0){ue=67;break t}_=K,g=h[_>>2]|0,_=h[_+4>>2]|0}else ue=73;while(!1);if((ue|0)==73&&(ue=0,g=xq(g,_)|0,_=ee()|0),(g|0)==0&(_|0)==0){xe=j;break e}}switch(ue|0){case 15:{m=h[j>>2]|0,m|0&&_t(m),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=v,ue=20;break}case 19:{h[p>>2]=g,h[p+4>>2]=_,ue=20;break}case 25:{di(27634,27600,470,27611);break}case 29:{h[p>>2]=g,h[p+4>>2]=_,Q=Ae;return}case 32:{m=h[j>>2]|0,m|0&&_t(m),xe=p,h[xe>>2]=0,h[xe+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=v,Q=Ae;return}case 36:{di(27634,27600,493,27611);break}case 42:{h[p>>2]=g,h[p+4>>2]=_,Q=Ae;return}case 45:{v|0&&_t(v),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=m,ue=55;break}case 53:{h[p>>2]=g,h[p+4>>2]=_,ue=55;break}case 58:{v|0&&_t(v),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=m,ue=71;break}case 65:{h[p>>2]=g,h[p+4>>2]=_,ue=71;break}case 67:{m=h[j>>2]|0,m|0&&_t(m),xe=p,h[xe>>2]=0,h[xe+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=g,Q=Ae;return}}if((ue|0)==20){Q=Ae;return}else if((ue|0)==55){Q=Ae;return}else if((ue|0)==71){Q=Ae;return}}while(!1);m=h[xe>>2]|0,m|0&&_t(m),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[p+8>>2]=0,h[we>>2]=0,h[p+12>>2]=-1,h[se>>2]=0,h[xe>>2]=0,Q=Ae}function xq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;q=Q,Q=Q+16|0,U=q,_=tt(p|0,m|0,52)|0,ee()|0,_=_&15,g=tt(p|0,m|0,45)|0,ee()|0;do if(_){for(;g=ft(_+4095|0,0,52)|0,v=ee()|0|m&-15728641,x=(15-_|0)*3|0,b=ft(7,0,x|0)|0,E=ee()|0,g=g|p|b,v=v|E,M=tt(p|0,m|0,x|0)|0,ee()|0,M=M&7,_=_+-1|0,!(M>>>0<6);)if(_)m=v,p=g;else{N=4;break}if((N|0)==4){g=tt(g|0,v|0,45)|0,ee()|0;break}return U=(M|0)==0&(Zi(g,v)|0)!=0,U=ft((U?2:1)+M|0,0,x|0)|0,N=ee()|0|m&~E,U=U|p&~b,On(N|0),Q=q,U|0}while(!1);return g=g&127,g>>>0>120?(N=0,U=0,On(N|0),Q=q,U|0):(mL(U,0,g+1|0,0),N=h[U+4>>2]|0,U=h[U>>2]|0,On(N|0),Q=q,U|0)}function Gue(p,m,g,_,v,x){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0;var b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0;ue=Q,Q=Q+160|0,q=ue+80|0,E=ue+64|0,j=ue+112|0,ae=ue,Vue(q,p,m,g),N=q,bL(E,h[N>>2]|0,h[N+4>>2]|0,m),N=E,M=h[N>>2]|0,N=h[N+4>>2]|0,b=h[q+8>>2]|0,X=j+4|0,h[X>>2]=h[q>>2],h[X+4>>2]=h[q+4>>2],h[X+8>>2]=h[q+8>>2],h[X+12>>2]=h[q+12>>2],h[X+16>>2]=h[q+16>>2],h[X+20>>2]=h[q+20>>2],h[X+24>>2]=h[q+24>>2],h[X+28>>2]=h[q+28>>2],X=ae,h[X>>2]=M,h[X+4>>2]=N,X=ae+8|0,h[X>>2]=b,p=ae+12|0,m=j,g=p+36|0;do h[p>>2]=h[m>>2],p=p+4|0,m=m+4|0;while((p|0)<(g|0));if(j=ae+48|0,h[j>>2]=h[E>>2],h[j+4>>2]=h[E+4>>2],h[j+8>>2]=h[E+8>>2],h[j+12>>2]=h[E+12>>2],(M|0)==0&(N|0)==0)return ae=b,Q=ue,ae|0;g=ae+16|0,U=ae+24|0,q=ae+28|0,b=0,E=0,m=M,p=N;do{if(!((b|0)<(v|0)|(b|0)==(v|0)&E>>>0<_>>>0)){K=4;break}if(N=E,E=At(E|0,b|0,1,0)|0,b=ee()|0,N=x+(N<<3)|0,h[N>>2]=m,h[N+4>>2]=p,wL(j),p=j,m=h[p>>2]|0,p=h[p+4>>2]|0,(m|0)==0&(p|0)==0){if(hT(g),m=g,p=h[m>>2]|0,m=h[m+4>>2]|0,(p|0)==0&(m|0)==0){K=10;break}Aq(p,m,h[q>>2]|0,j),p=j,m=h[p>>2]|0,p=h[p+4>>2]|0}N=ae,h[N>>2]=m,h[N+4>>2]=p}while(!((m|0)==0&(p|0)==0));return(K|0)==4?(p=ae+40|0,m=h[p>>2]|0,m|0&&_t(m),K=ae+16|0,h[K>>2]=0,h[K+4>>2]=0,h[U>>2]=0,h[ae+36>>2]=0,h[q>>2]=-1,h[ae+32>>2]=0,h[p>>2]=0,Aq(0,0,0,j),h[ae>>2]=0,h[ae+4>>2]=0,h[X>>2]=0,ae=14,Q=ue,ae|0):((K|0)==10&&(h[ae>>2]=0,h[ae+4>>2]=0,h[X>>2]=h[U>>2]),ae=h[X>>2]|0,Q=ue,ae|0)}function que(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0;if(q=Q,Q=Q+48|0,M=q+32|0,E=q+40|0,N=q,!(h[p>>2]|0))return U=_,h[U>>2]=0,h[U+4>>2]=0,U=0,Q=q,U|0;mL(M,0,0,0),b=M,v=h[b>>2]|0,b=h[b+4>>2]|0;do if(m>>>0>15)U=N,h[U>>2]=0,h[U+4>>2]=0,h[N+8>>2]=4,h[N+12>>2]=-1,U=N+16|0,g=N+29|0,h[U>>2]=0,h[U+4>>2]=0,h[U+8>>2]=0,He[U+12>>0]=0,He[g>>0]=He[E>>0]|0,He[g+1>>0]=He[E+1>>0]|0,He[g+2>>0]=He[E+2>>0]|0,g=4,U=9;else{if(g=Jx(g)|0,g|0){M=N,h[M>>2]=0,h[M+4>>2]=0,h[N+8>>2]=g,h[N+12>>2]=-1,M=N+16|0,U=N+29|0,h[M>>2]=0,h[M+4>>2]=0,h[M+8>>2]=0,He[M+12>>0]=0,He[U>>0]=He[E>>0]|0,He[U+1>>0]=He[E+1>>0]|0,He[U+2>>0]=He[E+2>>0]|0,U=9;break}if(g=Ea((h[p+8>>2]|0)+1|0,32)|0,!g){U=N,h[U>>2]=0,h[U+4>>2]=0,h[N+8>>2]=13,h[N+12>>2]=-1,U=N+16|0,g=N+29|0,h[U>>2]=0,h[U+4>>2]=0,h[U+8>>2]=0,He[U+12>>0]=0,He[g>>0]=He[E>>0]|0,He[g+1>>0]=He[E+1>>0]|0,He[g+2>>0]=He[E+2>>0]|0,g=13,U=9;break}EL(p,g),X=N,h[X>>2]=v,h[X+4>>2]=b,b=N+8|0,h[b>>2]=0,h[N+12>>2]=m,h[N+20>>2]=p,h[N+24>>2]=g,He[N+28>>0]=0,v=N+29|0,He[v>>0]=He[E>>0]|0,He[v+1>>0]=He[E+1>>0]|0,He[v+2>>0]=He[E+2>>0]|0,h[N+16>>2]=3,j=+Kce(g),j=j*+Yce(g),x=+Qs(+ +ie[g>>3]),x=j/+ii(+ +gT(+x,+ +Qs(+ +ie[g+8>>3])))*6371.007180918475*6371.007180918475,v=N+12|0,g=h[v>>2]|0;e:do if((g|0)>0)do{if(gq(g+-1|0,M)|0,!(x/+ie[M>>3]>10))break e;X=h[v>>2]|0,g=X+-1|0,h[v>>2]=g}while((X|0)>1);while(!1);if(hT(N),v=_,h[v>>2]=0,h[v+4>>2]=0,v=N,g=h[v>>2]|0,v=h[v+4>>2]|0,!((g|0)==0&(v|0)==0))do $x(g,v,m,M)|0,E=M,p=_,E=At(h[p>>2]|0,h[p+4>>2]|0,h[E>>2]|0,h[E+4>>2]|0)|0,p=ee()|0,X=_,h[X>>2]=E,h[X+4>>2]=p,hT(N),X=N,g=h[X>>2]|0,v=h[X+4>>2]|0;while(!((g|0)==0&(v|0)==0));g=h[b>>2]|0}while(!1);return X=g,Q=q,X|0}function Qx(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;if(!(rq(m,g)|0)||(m=Zce(m)|0,_=+ie[g>>3],v=+ie[g+8>>3],v=m&v<0?v+6.283185307179586:v,j=h[p>>2]|0,(j|0)<=0))return j=0,j|0;if(q=h[p+4>>2]|0,m){m=0,U=v,g=-1,p=0;e:for(;;){for(N=p;b=+ie[q+(N<<4)>>3],v=+ie[q+(N<<4)+8>>3],p=(g+2|0)%(j|0)|0,x=+ie[q+(p<<4)>>3],E=+ie[q+(p<<4)+8>>3],b>x?(M=b,b=E):(M=x,x=b,b=v,v=E),_=_==x|_==M?_+2220446049250313e-31:_,!!(_<x|_>M);)if(g=N+1|0,(g|0)>=(j|0)){g=22;break e}else p=N,N=g,g=p;if(E=b<0?b+6.283185307179586:b,b=v<0?v+6.283185307179586:v,U=E==U|b==U?U+-2220446049250313e-31:U,M=E+(b-E)*((_-x)/(M-x)),(M<0?M+6.283185307179586:M)>U&&(m=m^1),p=N+1|0,(p|0)>=(j|0)){g=22;break}else g=N}if((g|0)==22)return m|0}else{m=0,U=v,g=-1,p=0;e:for(;;){for(N=p;b=+ie[q+(N<<4)>>3],v=+ie[q+(N<<4)+8>>3],p=(g+2|0)%(j|0)|0,x=+ie[q+(p<<4)>>3],E=+ie[q+(p<<4)+8>>3],b>x?(M=b,b=E):(M=x,x=b,b=v,v=E),_=_==x|_==M?_+2220446049250313e-31:_,!!(_<x|_>M);)if(g=N+1|0,(g|0)>=(j|0)){g=22;break e}else p=N,N=g,g=p;if(U=b==U|v==U?U+-2220446049250313e-31:U,b+(v-b)*((_-x)/(M-x))>U&&(m=m^1),p=N+1|0,(p|0)>=(j|0)){g=22;break}else g=N}if((g|0)==22)return m|0}return 0}function yq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0;if(K=h[p>>2]|0,!K){h[m>>2]=0,h[m+4>>2]=0,h[m+8>>2]=0,h[m+12>>2]=0,h[m+16>>2]=0,h[m+20>>2]=0,h[m+24>>2]=0,h[m+28>>2]=0;return}if(ae=m+8|0,ie[ae>>3]=17976931348623157e292,ue=m+24|0,ie[ue>>3]=17976931348623157e292,ie[m>>3]=-17976931348623157e292,xe=m+16|0,ie[xe>>3]=-17976931348623157e292,!((K|0)<=0)){for(j=h[p+4>>2]|0,N=17976931348623157e292,U=-17976931348623157e292,q=0,p=-1,x=17976931348623157e292,b=17976931348623157e292,M=-17976931348623157e292,_=-17976931348623157e292,X=0;g=+ie[j+(X<<4)>>3],E=+ie[j+(X<<4)+8>>3],p=p+2|0,v=+ie[j+(((p|0)==(K|0)?0:p)<<4)+8>>3],g<x&&(ie[ae>>3]=g,x=g),E<b&&(ie[ue>>3]=E,b=E),g>M?ie[m>>3]=g:g=M,E>_&&(ie[xe>>3]=E,_=E),N=E>0&E<N?E:N,U=E<0&E>U?E:U,q=q|+Qs(+(E-v))>3.141592653589793,p=X+1|0,(p|0)!=(K|0);)se=X,M=g,X=p,p=se;q&&(ie[xe>>3]=U,ie[ue>>3]=N)}}function Jx(p){return p=p|0,(p>>>0<4?0:15)|0}function EL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0;if(K=h[p>>2]|0,K){if(ae=m+8|0,ie[ae>>3]=17976931348623157e292,ue=m+24|0,ie[ue>>3]=17976931348623157e292,ie[m>>3]=-17976931348623157e292,xe=m+16|0,ie[xe>>3]=-17976931348623157e292,(K|0)>0){for(v=h[p+4>>2]|0,j=17976931348623157e292,X=-17976931348623157e292,_=0,g=-1,M=17976931348623157e292,N=17976931348623157e292,q=-17976931348623157e292,b=-17976931348623157e292,se=0;x=+ie[v+(se<<4)>>3],U=+ie[v+(se<<4)+8>>3],Ke=g+2|0,E=+ie[v+(((Ke|0)==(K|0)?0:Ke)<<4)+8>>3],x<M&&(ie[ae>>3]=x,M=x),U<N&&(ie[ue>>3]=U,N=U),x>q?ie[m>>3]=x:x=q,U>b&&(ie[xe>>3]=U,b=U),j=U>0&U<j?U:j,X=U<0&U>X?U:X,_=_|+Qs(+(U-E))>3.141592653589793,g=se+1|0,(g|0)!=(K|0);)Ke=se,q=x,se=g,g=Ke;_&&(ie[xe>>3]=X,ie[ue>>3]=j)}}else h[m>>2]=0,h[m+4>>2]=0,h[m+8>>2]=0,h[m+12>>2]=0,h[m+16>>2]=0,h[m+20>>2]=0,h[m+24>>2]=0,h[m+28>>2]=0;if(Ke=p+8|0,g=h[Ke>>2]|0,!((g|0)<=0)){Be=p+12|0,Ae=0;do if(v=h[Be>>2]|0,_=Ae,Ae=Ae+1|0,ue=m+(Ae<<5)|0,xe=h[v+(_<<3)>>2]|0,xe){if(se=m+(Ae<<5)+8|0,ie[se>>3]=17976931348623157e292,p=m+(Ae<<5)+24|0,ie[p>>3]=17976931348623157e292,ie[ue>>3]=-17976931348623157e292,we=m+(Ae<<5)+16|0,ie[we>>3]=-17976931348623157e292,(xe|0)>0){for(K=h[v+(_<<3)+4>>2]|0,j=17976931348623157e292,X=-17976931348623157e292,v=0,_=-1,ae=0,M=17976931348623157e292,N=17976931348623157e292,U=-17976931348623157e292,b=-17976931348623157e292;x=+ie[K+(ae<<4)>>3],q=+ie[K+(ae<<4)+8>>3],_=_+2|0,E=+ie[K+(((_|0)==(xe|0)?0:_)<<4)+8>>3],x<M&&(ie[se>>3]=x,M=x),q<N&&(ie[p>>3]=q,N=q),x>U?ie[ue>>3]=x:x=U,q>b&&(ie[we>>3]=q,b=q),j=q>0&q<j?q:j,X=q<0&q>X?q:X,v=v|+Qs(+(q-E))>3.141592653589793,_=ae+1|0,(_|0)!=(xe|0);)Me=ae,ae=_,U=x,_=Me;v&&(ie[we>>3]=X,ie[p>>3]=j)}}else h[ue>>2]=0,h[ue+4>>2]=0,h[ue+8>>2]=0,h[ue+12>>2]=0,h[ue+16>>2]=0,h[ue+20>>2]=0,h[ue+24>>2]=0,h[ue+28>>2]=0,g=h[Ke>>2]|0;while((Ae|0)<(g|0))}}function ML(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if(!(Qx(p,m,g)|0))return v=0,v|0;if(v=p+8|0,(h[v>>2]|0)<=0)return v=1,v|0;for(_=p+12|0,p=0;;){if(x=p,p=p+1|0,Qx((h[_>>2]|0)+(x<<3)|0,m+(p<<5)|0,g)|0){p=0,_=6;break}if((p|0)>=(h[v>>2]|0)){p=1,_=6;break}}return(_|0)==6?p|0:0}function bq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(N=Q,Q=Q+16|0,E=N,b=g+8|0,!(Qx(p,m,b)|0))return M=0,Q=N,M|0;M=p+8|0;e:do if((h[M>>2]|0)>0){for(x=p+12|0,v=0;;){if(U=v,v=v+1|0,Qx((h[x>>2]|0)+(U<<3)|0,m+(v<<5)|0,b)|0){v=0;break}if((v|0)>=(h[M>>2]|0))break e}return Q=N,v|0}while(!1);if(fT(p,m,g,_)|0)return U=0,Q=N,U|0;h[E>>2]=h[g>>2],h[E+4>>2]=b,v=h[M>>2]|0;e:do if((v|0)>0)for(p=p+12|0,b=0,x=v;;){if(v=h[p>>2]|0,(h[v+(b<<3)>>2]|0)>0){if(Qx(E,_,h[v+(b<<3)+4>>2]|0)|0){v=0;break e}if(v=b+1|0,fT((h[p>>2]|0)+(b<<3)|0,m+(v<<5)|0,g,_)|0){v=0;break e}x=h[M>>2]|0}else v=b+1|0;if((v|0)<(x|0))b=v;else{v=1;break}}else v=1;while(!1);return U=v,Q=N,U|0}function fT(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0;if(Ke=Q,Q=Q+176|0,se=Ke+172|0,v=Ke+168|0,we=Ke,!(uL(m,_)|0))return p=0,Q=Ke,p|0;if(Qce(m,_,se,v),du(we|0,g|0,168)|0,(h[g>>2]|0)>0){m=0;do Me=we+8+(m<<4)+8|0,xe=+zl(+ie[Me>>3],h[v>>2]|0),ie[Me>>3]=xe,m=m+1|0;while((m|0)<(h[g>>2]|0))}ae=+ie[_>>3],ue=+ie[_+8>>3],xe=+zl(+ie[_+16>>3],h[v>>2]|0),X=+zl(+ie[_+24>>3],h[v>>2]|0);e:do if((h[p>>2]|0)>0){if(_=p+4|0,v=h[we>>2]|0,(v|0)<=0){for(m=0;;)if(m=m+1|0,(m|0)>=(h[p>>2]|0)){m=0;break e}}for(g=0;;){if(m=h[_>>2]|0,j=+ie[m+(g<<4)>>3],K=+zl(+ie[m+(g<<4)+8>>3],h[se>>2]|0),m=h[_>>2]|0,g=g+1|0,Me=(g|0)%(h[p>>2]|0)|0,x=+ie[m+(Me<<4)>>3],b=+zl(+ie[m+(Me<<4)+8>>3],h[se>>2]|0),!(j>=ae)|!(x>=ae)&&!(j<=ue)|!(x<=ue)&&!(K<=X)|!(b<=X)&&!(K>=xe)|!(b>=xe)){q=x-j,N=b-K,m=0;do if(be=m,m=m+1|0,Me=(m|0)==(v|0)?0:m,x=+ie[we+8+(be<<4)+8>>3],b=+ie[we+8+(Me<<4)+8>>3]-x,E=+ie[we+8+(be<<4)>>3],M=+ie[we+8+(Me<<4)>>3]-E,U=q*b-N*M,U!=0&&(Ae=K-x,Be=j-E,M=(Ae*M-b*Be)/U,!(M<0|M>1))&&(U=(q*Ae-N*Be)/U,U>=0&U<=1)){m=1;break e}while((m|0)<(v|0))}if((g|0)>=(h[p>>2]|0)){m=0;break}}}else m=0;while(!1);return be=m,Q=Ke,be|0}function wq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;if(fT(p,m,g,_)|0)return x=1,x|0;if(x=p+8|0,(h[x>>2]|0)<=0)return x=0,x|0;for(v=p+12|0,p=0;;){if(b=p,p=p+1|0,fT((h[v>>2]|0)+(b<<3)|0,m+(p<<5)|0,g,_)|0){p=1,v=6;break}if((p|0)>=(h[x>>2]|0)){p=0,v=6;break}}return(v|0)==6?p|0:0}function Hue(){return 8}function Wue(){return 16}function jue(){return 168}function Xue(){return 8}function $ue(){return 16}function Yue(){return 12}function Zue(){return 8}function Kue(p){return p=p|0,+(+((h[p>>2]|0)>>>0)+4294967296*+(h[p+4>>2]|0))}function Que(p){p=p|0;var m=0,g=0;return g=+ie[p>>3],m=+ie[p+8>>3],+ +ws(+(g*g+m*m))}function Sq(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;N=+ie[p>>3],M=+ie[m>>3]-N,E=+ie[p+8>>3],b=+ie[m+8>>3]-E,q=+ie[g>>3],x=+ie[_>>3]-q,j=+ie[g+8>>3],U=+ie[_+8>>3]-j,x=(x*(E-j)-(N-q)*U)/(M*U-b*x),ie[v>>3]=N+M*x,ie[v+8>>3]=E+b*x}function Tq(p,m){return p=p|0,m=m|0,+Qs(+(+ie[p>>3]-+ie[m>>3]))<11920928955078125e-23?(m=+Qs(+(+ie[p+8>>3]-+ie[m+8>>3]))<11920928955078125e-23,m|0):(m=0,m|0)}function Jue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if(x=Q,Q=Q+16|0,v=x,_=Zi(p,m)|0,(g+-1|0)>>>0>5||(_=(_|0)!=0,(g|0)==1&_))return v=-1,Q=x,v|0;do if(ey(p,m,v)|0)_=-1;else if(_){_=((h[26416+(g<<2)>>2]|0)+5-(h[v>>2]|0)|0)%5|0;break}else{_=((h[26448+(g<<2)>>2]|0)+6-(h[v>>2]|0)|0)%6|0;break}while(!1);return v=_,Q=x,v|0}function ey(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(U=Q,Q=Q+32|0,E=U+16|0,M=U,_=w1(p,m,E)|0,_|0)return g=_,Q=U,g|0;x=fq(p,m)|0,N=ll(p,m)|0,Wce(x,M),_=jce(x,h[E>>2]|0)|0;do if(yr(x)|0){do switch(x|0){case 4:{v=0;break}case 14:{v=1;break}case 24:{v=2;break}case 38:{v=3;break}case 49:{v=4;break}case 58:{v=5;break}case 63:{v=6;break}case 72:{v=7;break}case 83:{v=8;break}case 97:{v=9;break}case 107:{v=10;break}case 117:{v=11;break}default:di(27634,27636,75,27645)}while(!1);if(b=h[26480+(v*24|0)+8>>2]|0,m=h[26480+(v*24|0)+16>>2]|0,p=h[E>>2]|0,(p|0)!=(h[M>>2]|0)&&(M=aL(x)|0,p=h[E>>2]|0,M|(p|0)==(m|0)&&(_=(_+1|0)%6|0)),(N|0)==3&(p|0)==(m|0)){_=(_+5|0)%6|0;break}(N|0)==5&(p|0)==(b|0)&&(_=(_+1|0)%6|0)}while(!1);return h[g>>2]=_,g=0,Q=U,g|0}function wc(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0;if(we=Q,Q=Q+32|0,se=we+24|0,ue=we+20|0,K=we+8|0,X=we+16|0,j=we,M=(Zi(p,m)|0)==0,M=M?6:5,U=tt(p|0,m|0,52)|0,ee()|0,U=U&15,M>>>0<=g>>>0)return _=2,Q=we,_|0;q=(U|0)==0,!q&&(ae=ft(7,0,(U^15)*3|0)|0,(ae&p|0)==0&((ee()|0)&m|0)==0)?v=g:x=4;e:do if((x|0)==4){if(v=(Zi(p,m)|0)!=0,((v?4:5)|0)<(g|0)||ey(p,m,se)|0||(x=(h[se>>2]|0)+g|0,v?v=26768+(((x|0)%5|0)<<2)|0:v=26800+(((x|0)%6|0)<<2)|0,ae=h[v>>2]|0,(ae|0)==7))return _=1,Q=we,_|0;h[ue>>2]=0,v=Js(p,m,ae,ue,K)|0;do if(!v){if(E=K,N=h[E>>2]|0,E=h[E+4>>2]|0,b=E>>>0<m>>>0|(E|0)==(m|0)&N>>>0<p>>>0,x=b?N:p,b=b?E:m,!q&&(q=ft(7,0,(U^15)*3|0)|0,(N&q|0)==0&(E&(ee()|0)|0)==0))v=g;else{if(E=(g+-1+M|0)%(M|0)|0,v=Zi(p,m)|0,(E|0)<0&&di(27634,27636,248,27661),M=(v|0)!=0,((M?4:5)|0)<(E|0)&&di(27634,27636,248,27661),ey(p,m,se)|0&&di(27634,27636,248,27661),v=(h[se>>2]|0)+E|0,M?v=26768+(((v|0)%5|0)<<2)|0:v=26800+(((v|0)%6|0)<<2)|0,E=h[v>>2]|0,(E|0)==7&&di(27634,27636,248,27661),h[X>>2]=0,v=Js(p,m,E,X,j)|0,v|0)break;N=j,M=h[N>>2]|0,N=h[N+4>>2]|0;do if(N>>>0<b>>>0|(N|0)==(b|0)&M>>>0<x>>>0){if(Zi(M,N)|0?x=aT(M,N,p,m)|0:x=h[26864+((((h[X>>2]|0)+(h[26832+(E<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,v=Zi(M,N)|0,(x+-1|0)>>>0>5){v=-1,x=M,b=N;break}if(v=(v|0)!=0,(x|0)==1&v){v=-1,x=M,b=N;break}do if(ey(M,N,se)|0)v=-1;else if(v){v=((h[26416+(x<<2)>>2]|0)+5-(h[se>>2]|0)|0)%5|0;break}else{v=((h[26448+(x<<2)>>2]|0)+6-(h[se>>2]|0)|0)%6|0;break}while(!1);x=M,b=N}else v=g;while(!1);E=K,N=h[E>>2]|0,E=h[E+4>>2]|0}if((x|0)==(N|0)&(b|0)==(E|0)){if(M=(Zi(N,E)|0)!=0,M?p=aT(N,E,p,m)|0:p=h[26864+((((h[ue>>2]|0)+(h[26832+(ae<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,v=Zi(N,E)|0,(p+-1|0)>>>0<=5&&(xe=(v|0)!=0,!((p|0)==1&xe)))do if(ey(N,E,se)|0)v=-1;else if(xe){v=((h[26416+(p<<2)>>2]|0)+5-(h[se>>2]|0)|0)%5|0;break}else{v=((h[26448+(p<<2)>>2]|0)+6-(h[se>>2]|0)|0)%6|0;break}while(!1);else v=-1;v=v+1|0,v=(v|0)==6|M&(v|0)==5?0:v}m=b,p=x;break e}while(!1);return _=v,Q=we,_|0}while(!1);return xe=ft(v|0,0,56)|0,se=ee()|0|m&-2130706433|536870912,h[_>>2]=xe|p,h[_+4>>2]=se,_=0,Q=we,_|0}function ehe(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;return x=(Zi(p,m)|0)==0,_=wc(p,m,0,g)|0,v=(_|0)==0,x?!v||(_=wc(p,m,1,g+8|0)|0,_|0)||(_=wc(p,m,2,g+16|0)|0,_|0)||(_=wc(p,m,3,g+24|0)|0,_|0)||(_=wc(p,m,4,g+32|0)|0,_)?(x=_,x|0):wc(p,m,5,g+40|0)|0:!v||(_=wc(p,m,1,g+8|0)|0,_|0)||(_=wc(p,m,2,g+16|0)|0,_|0)||(_=wc(p,m,3,g+24|0)|0,_|0)||(_=wc(p,m,4,g+32|0)|0,_|0)?(x=_,x|0):(x=g+40|0,h[x>>2]=0,h[x+4>>2]=0,x=0,x|0)}function the(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0;return M=Q,Q=Q+192|0,v=M,x=M+168|0,b=tt(p|0,m|0,56)|0,ee()|0,b=b&7,E=m&-2130706433|134217728,_=w1(p,E,x)|0,_|0?(E=_,Q=M,E|0):(m=tt(p|0,m|0,52)|0,ee()|0,m=m&15,Zi(p,E)|0?fL(x,m,b,1,v):dL(x,m,b,1,v),E=v+8|0,h[g>>2]=h[E>>2],h[g+4>>2]=h[E+4>>2],h[g+8>>2]=h[E+8>>2],h[g+12>>2]=h[E+12>>2],E=0,Q=M,E|0)}function Eq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=Q,Q=Q+16|0,g=v,!(!0&(m&2013265920|0)==536870912)||(_=m&-2130706433|134217728,!(cT(p,_)|0))?(_=0,Q=v,_|0):(x=tt(p|0,m|0,56)|0,ee()|0,x=(wc(p,_,x&7,g)|0)==0,_=g,_=x&((h[_>>2]|0)==(p|0)?(h[_+4>>2]|0)==(m|0):0)&1,Q=v,_|0)}function Mq(){return 27680}function dT(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;q=Q,Q=Q+208|0,M=q,N=q+192|0,b=al(g,m)|0,E=N,h[E>>2]=1,h[E+4>>2]=0;e:do if(b|0){for(E=0-g|0,h[M+4>>2]=g,h[M>>2]=g,v=2,m=g,x=g;m=m+g+x|0,h[M+(v<<2)>>2]=m,m>>>0<b>>>0;)j=x,v=v+1|0,x=m,m=j;if(x=p+b+E|0,x>>>0>p>>>0){b=x,v=1,m=1;do{do if((m&3|0)!=3)if(m=v+-1|0,(h[M+(m<<2)>>2]|0)>>>0<(b-p|0)>>>0?CL(p,g,_,v,M):mT(p,g,_,N,v,0,M),(v|0)==1){AT(N,1),v=0;break}else{AT(N,m),v=1;break}else CL(p,g,_,v,M),pT(N,2),v=v+2|0;while(!1);m=h[N>>2]|1,h[N>>2]=m,p=p+g|0}while(p>>>0<x>>>0)}else v=1,m=1;for(mT(p,g,_,N,v,0,M),x=N+4|0;;){if((v|0)==1&(m|0)==1)if(h[x>>2]|0)U=19;else break e;else(v|0)<2?U=19:(AT(N,2),j=v+-2|0,h[N>>2]=h[N>>2]^7,pT(N,1),mT(p+(0-(h[M+(j<<2)>>2]|0))+E|0,g,_,N,v+-1|0,1,M),AT(N,1),m=h[N>>2]|1,h[N>>2]=m,p=p+E|0,mT(p,g,_,N,j,1,M),v=j);(U|0)==19&&(U=0,m=Cq(N)|0,pT(N,m),p=p+E|0,v=m+v|0,m=h[N>>2]|0)}}while(!1);Q=q}function CL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0;q=Q,Q=Q+240|0,U=q,h[U>>2]=p;e:do if((_|0)>1)for(N=0-m|0,E=p,x=_,_=1,b=p;;){if(E=E+N|0,M=x+-2|0,p=E+(0-(h[v+(M<<2)>>2]|0))|0,(dp[g&3](b,p)|0)>-1&&(dp[g&3](b,E)|0)>-1||(b=U+(_<<2)|0,(dp[g&3](p,E)|0)>-1?(h[b>>2]=p,x=x+-1|0):(h[b>>2]=E,p=E,x=M),_=_+1|0,(x|0)<=1))break e;E=p,b=h[U>>2]|0}else _=1;while(!1);Iq(m,U,_),Q=q}function pT(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;v=p+4|0,m>>>0>31?(_=h[v>>2]|0,h[p>>2]=_,h[v>>2]=0,m=m+-32|0,g=0):(g=h[v>>2]|0,_=h[p>>2]|0),h[p>>2]=g<<32-m|_>>>m,h[v>>2]=g>>>m}function mT(p,m,g,_,v,x,b){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0;var E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;X=Q,Q=Q+240|0,q=X+232|0,j=X,K=h[_>>2]|0,h[q>>2]=K,M=h[_+4>>2]|0,N=q+4|0,h[N>>2]=M,h[j>>2]=p;e:do if((K|0)!=1|(M|0)!=0&&(U=0-m|0,E=p+(0-(h[b+(v<<2)>>2]|0))|0,(dp[g&3](E,p)|0)>=1))for(_=1,x=(x|0)==0,M=E;;){if(x&(v|0)>1){if(x=p+U|0,E=h[b+(v+-2<<2)>>2]|0,(dp[g&3](x,M)|0)>-1){E=10;break e}if((dp[g&3](x+(0-E)|0,M)|0)>-1){E=10;break e}}if(x=_+1|0,h[j+(_<<2)>>2]=M,K=Cq(q)|0,pT(q,K),v=K+v|0,!((h[q>>2]|0)!=1|(h[N>>2]|0)!=0)){_=x,p=M,E=10;break e}if(p=M+(0-(h[b+(v<<2)>>2]|0))|0,(dp[g&3](p,h[j>>2]|0)|0)<1){p=M,_=x,x=0,E=9;break}else K=M,_=x,x=1,M=p,p=K}else _=1,E=9;while(!1);(E|0)==9&&(x|0)==0&&(E=10),(E|0)==10&&(Iq(m,j,_),CL(p,m,g,v,b)),Q=X}function AT(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;v=p+4|0,m>>>0>31?(_=h[p>>2]|0,h[v>>2]=_,h[p>>2]=0,m=m+-32|0,g=0):(g=h[p>>2]|0,_=h[v>>2]|0),h[v>>2]=g>>>(32-m|0)|_<<m,h[p>>2]=g<<m}function Cq(p){p=p|0;var m=0;return m=Rq((h[p>>2]|0)+-1|0)|0,m?m|0:(m=Rq(h[p+4>>2]|0)|0,((m|0)==0?0:m+32|0)|0)}function Rq(p){p=p|0;var m=0;if(p)if(p&1)p=0;else for(m=p,p=0;p=p+1|0,!(m&2);)m=m>>>1;else p=32;return p|0}function Iq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0;b=Q,Q=Q+256|0,_=b;e:do if((g|0)>=2&&(x=m+(g<<2)|0,h[x>>2]=_,p|0))for(;;){v=p>>>0<256?p:256,du(_|0,h[m>>2]|0,v|0)|0,_=0;do E=m+(_<<2)|0,_=_+1|0,du(h[E>>2]|0,h[m+(_<<2)>>2]|0,v|0)|0,h[E>>2]=(h[E>>2]|0)+v;while((_|0)!=(g|0));if(p=p-v|0,!p)break e;_=h[x>>2]|0}while(!1);Q=b}function lh(p){return p=+p,~~+Fq(+p)|0}function br(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0;Be=Q,Q=Q+16|0,j=Be;do if(p>>>0<245){if(N=p>>>0<11?16:p+11&-8,p=N>>>3,q=h[6921]|0,g=q>>>p,g&3|0)return m=(g&1^1)+p|0,p=27724+(m<<1<<2)|0,g=p+8|0,_=h[g>>2]|0,v=_+8|0,x=h[v>>2]|0,(x|0)==(p|0)?h[6921]=q&~(1<<m):(h[x+12>>2]=p,h[g>>2]=x),Ae=m<<3,h[_+4>>2]=Ae|3,Ae=_+Ae+4|0,h[Ae>>2]=h[Ae>>2]|1,Ae=v,Q=Be,Ae|0;if(U=h[6923]|0,N>>>0>U>>>0){if(g|0)return m=2<<p,m=g<<p&(m|0-m),m=(m&0-m)+-1|0,E=m>>>12&16,m=m>>>E,g=m>>>5&8,m=m>>>g,x=m>>>2&4,m=m>>>x,p=m>>>1&2,m=m>>>p,_=m>>>1&1,_=(g|E|x|p|_)+(m>>>_)|0,m=27724+(_<<1<<2)|0,p=m+8|0,x=h[p>>2]|0,E=x+8|0,g=h[E>>2]|0,(g|0)==(m|0)?(p=q&~(1<<_),h[6921]=p):(h[g+12>>2]=m,h[p>>2]=g,p=q),Ae=_<<3,b=Ae-N|0,h[x+4>>2]=N|3,v=x+N|0,h[v+4>>2]=b|1,h[x+Ae>>2]=b,U|0&&(_=h[6926]|0,m=U>>>3,g=27724+(m<<1<<2)|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=_,h[m+12>>2]=_,h[_+8>>2]=m,h[_+12>>2]=g),h[6923]=b,h[6926]=v,Ae=E,Q=Be,Ae|0;if(x=h[6922]|0,x){for(g=(x&0-x)+-1|0,v=g>>>12&16,g=g>>>v,_=g>>>5&8,g=g>>>_,b=g>>>2&4,g=g>>>b,E=g>>>1&2,g=g>>>E,M=g>>>1&1,M=h[27988+((_|v|b|E|M)+(g>>>M)<<2)>>2]|0,g=M,E=M,M=(h[M+4>>2]&-8)-N|0;p=h[g+16>>2]|0,!(!p&&(p=h[g+20>>2]|0,!p));)b=(h[p+4>>2]&-8)-N|0,v=b>>>0<M>>>0,g=p,E=v?p:E,M=v?b:M;if(b=E+N|0,b>>>0>E>>>0){v=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(p=E+20|0,m=h[p>>2]|0,!m&&(p=E+16|0,m=h[p>>2]|0,!m)){g=0;break}for(;;)if(_=m+20|0,g=h[_>>2]|0,g)m=g,p=_;else if(_=m+16|0,g=h[_>>2]|0,g)m=g,p=_;else break;h[p>>2]=0,g=m}else g=h[E+8>>2]|0,h[g+12>>2]=m,h[m+8>>2]=g,g=m;while(!1);do if(v|0){if(m=h[E+28>>2]|0,p=27988+(m<<2)|0,(E|0)==(h[p>>2]|0)){if(h[p>>2]=g,!g){h[6922]=x&~(1<<m);break}}else if(Ae=v+16|0,h[((h[Ae>>2]|0)==(E|0)?Ae:v+20|0)>>2]=g,!g)break;h[g+24>>2]=v,m=h[E+16>>2]|0,m|0&&(h[g+16>>2]=m,h[m+24>>2]=g),m=h[E+20>>2]|0,m|0&&(h[g+20>>2]=m,h[m+24>>2]=g)}while(!1);return M>>>0<16?(Ae=M+N|0,h[E+4>>2]=Ae|3,Ae=E+Ae+4|0,h[Ae>>2]=h[Ae>>2]|1):(h[E+4>>2]=N|3,h[b+4>>2]=M|1,h[b+M>>2]=M,U|0&&(_=h[6926]|0,m=U>>>3,g=27724+(m<<1<<2)|0,m=1<<m,m&q?(p=g+8|0,m=h[p>>2]|0):(h[6921]=m|q,m=g,p=g+8|0),h[p>>2]=_,h[m+12>>2]=_,h[_+8>>2]=m,h[_+12>>2]=g),h[6923]=M,h[6926]=b),Ae=E+8|0,Q=Be,Ae|0}else q=N}else q=N}else q=N}else if(p>>>0<=4294967231)if(p=p+11|0,N=p&-8,_=h[6922]|0,_){v=0-N|0,p=p>>>8,p?N>>>0>16777215?M=31:(q=(p+1048320|0)>>>16&8,ae=p<<q,E=(ae+520192|0)>>>16&4,ae=ae<<E,M=(ae+245760|0)>>>16&2,M=14-(E|q|M)+(ae<<M>>>15)|0,M=N>>>(M+7|0)&1|M<<1):M=0,g=h[27988+(M<<2)>>2]|0;e:do if(!g)g=0,p=0,ae=61;else for(p=0,E=N<<((M|0)==31?0:25-(M>>>1)|0),x=0;;){if(b=(h[g+4>>2]&-8)-N|0,b>>>0<v>>>0)if(b)p=g,v=b;else{p=g,v=0,ae=65;break e}if(ae=h[g+20>>2]|0,g=h[g+16+(E>>>31<<2)>>2]|0,x=(ae|0)==0|(ae|0)==(g|0)?x:ae,g)E=E<<1;else{g=x,ae=61;break}}while(!1);if((ae|0)==61){if((g|0)==0&(p|0)==0){if(p=2<<M,p=(p|0-p)&_,!p){q=N;break}q=(p&0-p)+-1|0,b=q>>>12&16,q=q>>>b,x=q>>>5&8,q=q>>>x,E=q>>>2&4,q=q>>>E,M=q>>>1&2,q=q>>>M,g=q>>>1&1,p=0,g=h[27988+((x|b|E|M|g)+(q>>>g)<<2)>>2]|0}g?ae=65:(E=p,b=v)}if((ae|0)==65)for(x=g;;)if(q=(h[x+4>>2]&-8)-N|0,g=q>>>0<v>>>0,v=g?q:v,p=g?x:p,g=h[x+16>>2]|0,g||(g=h[x+20>>2]|0),g)x=g;else{E=p,b=v;break}if((E|0)!=0&&b>>>0<((h[6923]|0)-N|0)>>>0&&(U=E+N|0,U>>>0>E>>>0)){x=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(p=E+20|0,m=h[p>>2]|0,!m&&(p=E+16|0,m=h[p>>2]|0,!m)){m=0;break}for(;;)if(v=m+20|0,g=h[v>>2]|0,g)m=g,p=v;else if(v=m+16|0,g=h[v>>2]|0,g)m=g,p=v;else break;h[p>>2]=0}else Ae=h[E+8>>2]|0,h[Ae+12>>2]=m,h[m+8>>2]=Ae;while(!1);do if(x){if(p=h[E+28>>2]|0,g=27988+(p<<2)|0,(E|0)==(h[g>>2]|0)){if(h[g>>2]=m,!m){_=_&~(1<<p),h[6922]=_;break}}else if(Ae=x+16|0,h[((h[Ae>>2]|0)==(E|0)?Ae:x+20|0)>>2]=m,!m)break;h[m+24>>2]=x,p=h[E+16>>2]|0,p|0&&(h[m+16>>2]=p,h[p+24>>2]=m),p=h[E+20>>2]|0,p&&(h[m+20>>2]=p,h[p+24>>2]=m)}while(!1);e:do if(b>>>0<16)Ae=b+N|0,h[E+4>>2]=Ae|3,Ae=E+Ae+4|0,h[Ae>>2]=h[Ae>>2]|1;else{if(h[E+4>>2]=N|3,h[U+4>>2]=b|1,h[U+b>>2]=b,m=b>>>3,b>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=U,h[m+12>>2]=U,h[U+8>>2]=m,h[U+12>>2]=g;break}if(m=b>>>8,m?b>>>0>16777215?g=31:(we=(m+1048320|0)>>>16&8,Ae=m<<we,se=(Ae+520192|0)>>>16&4,Ae=Ae<<se,g=(Ae+245760|0)>>>16&2,g=14-(se|we|g)+(Ae<<g>>>15)|0,g=b>>>(g+7|0)&1|g<<1):g=0,m=27988+(g<<2)|0,h[U+28>>2]=g,p=U+16|0,h[p+4>>2]=0,h[p>>2]=0,p=1<<g,!(_&p)){h[6922]=_|p,h[m>>2]=U,h[U+24>>2]=m,h[U+12>>2]=U,h[U+8>>2]=U;break}m=h[m>>2]|0;t:do if((h[m+4>>2]&-8|0)!=(b|0)){for(_=b<<((g|0)==31?0:25-(g>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(b|0)){m=p;break t}else _=_<<1,m=p;h[g>>2]=U,h[U+24>>2]=m,h[U+12>>2]=U,h[U+8>>2]=U;break e}while(!1);we=m+8|0,Ae=h[we>>2]|0,h[Ae+12>>2]=U,h[we>>2]=U,h[U+8>>2]=Ae,h[U+12>>2]=m,h[U+24>>2]=0}while(!1);return Ae=E+8|0,Q=Be,Ae|0}else q=N}else q=N;else q=-1;while(!1);if(g=h[6923]|0,g>>>0>=q>>>0)return m=g-q|0,p=h[6926]|0,m>>>0>15?(Ae=p+q|0,h[6926]=Ae,h[6923]=m,h[Ae+4>>2]=m|1,h[p+g>>2]=m,h[p+4>>2]=q|3):(h[6923]=0,h[6926]=0,h[p+4>>2]=g|3,Ae=p+g+4|0,h[Ae>>2]=h[Ae>>2]|1),Ae=p+8|0,Q=Be,Ae|0;if(b=h[6924]|0,b>>>0>q>>>0)return se=b-q|0,h[6924]=se,Ae=h[6927]|0,we=Ae+q|0,h[6927]=we,h[we+4>>2]=se|1,h[Ae+4>>2]=q|3,Ae=Ae+8|0,Q=Be,Ae|0;if(h[7039]|0?p=h[7041]|0:(h[7041]=4096,h[7040]=4096,h[7042]=-1,h[7043]=-1,h[7044]=0,h[7032]=0,h[7039]=j&-16^1431655768,p=4096),E=q+48|0,M=q+47|0,x=p+M|0,v=0-p|0,N=x&v,N>>>0<=q>>>0||(p=h[7031]|0,p|0&&(U=h[7029]|0,j=U+N|0,j>>>0<=U>>>0|j>>>0>p>>>0)))return Ae=0,Q=Be,Ae|0;e:do if(h[7032]&4)m=0,ae=143;else{g=h[6927]|0;t:do if(g){for(_=28132;j=h[_>>2]|0,!(j>>>0<=g>>>0&&(j+(h[_+4>>2]|0)|0)>>>0>g>>>0);)if(p=h[_+8>>2]|0,p)_=p;else{ae=128;break t}if(m=x-b&v,m>>>0<2147483647)if(p=fp(m|0)|0,(p|0)==((h[_>>2]|0)+(h[_+4>>2]|0)|0)){if((p|0)!=-1){b=m,x=p,ae=145;break e}}else _=p,ae=136;else m=0}else ae=128;while(!1);do if((ae|0)==128)if(g=fp(0)|0,(g|0)!=-1&&(m=g,X=h[7040]|0,K=X+-1|0,m=((K&m|0)==0?0:(K+m&0-X)-m|0)+N|0,X=h[7029]|0,K=m+X|0,m>>>0>q>>>0&m>>>0<2147483647)){if(j=h[7031]|0,j|0&&K>>>0<=X>>>0|K>>>0>j>>>0){m=0;break}if(p=fp(m|0)|0,(p|0)==(g|0)){b=m,x=g,ae=145;break e}else _=p,ae=136}else m=0;while(!1);do if((ae|0)==136){if(g=0-m|0,!(E>>>0>m>>>0&(m>>>0<2147483647&(_|0)!=-1)))if((_|0)==-1){m=0;break}else{b=m,x=_,ae=145;break e}if(p=h[7041]|0,p=M-m+p&0-p,p>>>0>=2147483647){b=m,x=_,ae=145;break e}if((fp(p|0)|0)==-1){fp(g|0)|0,m=0;break}else{b=p+m|0,x=_,ae=145;break e}}while(!1);h[7032]=h[7032]|4,ae=143}while(!1);if((ae|0)==143&&N>>>0<2147483647&&(se=fp(N|0)|0,K=fp(0)|0,ue=K-se|0,xe=ue>>>0>(q+40|0)>>>0,!((se|0)==-1|xe^1|se>>>0<K>>>0&((se|0)!=-1&(K|0)!=-1)^1))&&(b=xe?ue:m,x=se,ae=145),(ae|0)==145){m=(h[7029]|0)+b|0,h[7029]=m,m>>>0>(h[7030]|0)>>>0&&(h[7030]=m),M=h[6927]|0;e:do if(M){for(m=28132;;){if(p=h[m>>2]|0,g=h[m+4>>2]|0,(x|0)==(p+g|0)){ae=154;break}if(_=h[m+8>>2]|0,_)m=_;else break}if((ae|0)==154&&(we=m+4|0,(h[m+12>>2]&8|0)==0)&&x>>>0>M>>>0&p>>>0<=M>>>0){h[we>>2]=g+b,Ae=(h[6924]|0)+b|0,se=M+8|0,se=(se&7|0)==0?0:0-se&7,we=M+se|0,se=Ae-se|0,h[6927]=we,h[6924]=se,h[we+4>>2]=se|1,h[M+Ae+4>>2]=40,h[6928]=h[7043];break}for(x>>>0<(h[6925]|0)>>>0&&(h[6925]=x),g=x+b|0,m=28132;;){if((h[m>>2]|0)==(g|0)){ae=162;break}if(p=h[m+8>>2]|0,p)m=p;else break}if((ae|0)==162&&(h[m+12>>2]&8|0)==0){h[m>>2]=x,U=m+4|0,h[U>>2]=(h[U>>2]|0)+b,U=x+8|0,U=x+((U&7|0)==0?0:0-U&7)|0,m=g+8|0,m=g+((m&7|0)==0?0:0-m&7)|0,N=U+q|0,E=m-U-q|0,h[U+4>>2]=q|3;t:do if((M|0)==(m|0))Ae=(h[6924]|0)+E|0,h[6924]=Ae,h[6927]=N,h[N+4>>2]=Ae|1;else{if((h[6926]|0)==(m|0)){Ae=(h[6923]|0)+E|0,h[6923]=Ae,h[6926]=N,h[N+4>>2]=Ae|1,h[N+Ae>>2]=Ae;break}if(p=h[m+4>>2]|0,(p&3|0)==1){b=p&-8,_=p>>>3;n:do if(p>>>0<256)if(p=h[m+8>>2]|0,g=h[m+12>>2]|0,(g|0)==(p|0)){h[6921]=h[6921]&~(1<<_);break}else{h[p+12>>2]=g,h[g+8>>2]=p;break}else{x=h[m+24>>2]|0,p=h[m+12>>2]|0;do if((p|0)==(m|0)){if(g=m+16|0,_=g+4|0,p=h[_>>2]|0,p)g=_;else if(p=h[g>>2]|0,!p){p=0;break}for(;;)if(v=p+20|0,_=h[v>>2]|0,_)p=_,g=v;else if(v=p+16|0,_=h[v>>2]|0,_)p=_,g=v;else break;h[g>>2]=0}else Ae=h[m+8>>2]|0,h[Ae+12>>2]=p,h[p+8>>2]=Ae;while(!1);if(!x)break;g=h[m+28>>2]|0,_=27988+(g<<2)|0;do if((h[_>>2]|0)!=(m|0)){if(Ae=x+16|0,h[((h[Ae>>2]|0)==(m|0)?Ae:x+20|0)>>2]=p,!p)break n}else{if(h[_>>2]=p,p|0)break;h[6922]=h[6922]&~(1<<g);break n}while(!1);if(h[p+24>>2]=x,g=m+16|0,_=h[g>>2]|0,_|0&&(h[p+16>>2]=_,h[_+24>>2]=p),g=h[g+4>>2]|0,!g)break;h[p+20>>2]=g,h[g+24>>2]=p}while(!1);m=m+b|0,v=b+E|0}else v=E;if(m=m+4|0,h[m>>2]=h[m>>2]&-2,h[N+4>>2]=v|1,h[N+v>>2]=v,m=v>>>3,v>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=N,h[m+12>>2]=N,h[N+8>>2]=m,h[N+12>>2]=g;break}m=v>>>8;do if(!m)_=0;else{if(v>>>0>16777215){_=31;break}we=(m+1048320|0)>>>16&8,Ae=m<<we,se=(Ae+520192|0)>>>16&4,Ae=Ae<<se,_=(Ae+245760|0)>>>16&2,_=14-(se|we|_)+(Ae<<_>>>15)|0,_=v>>>(_+7|0)&1|_<<1}while(!1);if(m=27988+(_<<2)|0,h[N+28>>2]=_,p=N+16|0,h[p+4>>2]=0,h[p>>2]=0,p=h[6922]|0,g=1<<_,!(p&g)){h[6922]=p|g,h[m>>2]=N,h[N+24>>2]=m,h[N+12>>2]=N,h[N+8>>2]=N;break}m=h[m>>2]|0;n:do if((h[m+4>>2]&-8|0)!=(v|0)){for(_=v<<((_|0)==31?0:25-(_>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(v|0)){m=p;break n}else _=_<<1,m=p;h[g>>2]=N,h[N+24>>2]=m,h[N+12>>2]=N,h[N+8>>2]=N;break t}while(!1);we=m+8|0,Ae=h[we>>2]|0,h[Ae+12>>2]=N,h[we>>2]=N,h[N+8>>2]=Ae,h[N+12>>2]=m,h[N+24>>2]=0}while(!1);return Ae=U+8|0,Q=Be,Ae|0}for(m=28132;p=h[m>>2]|0,!(p>>>0<=M>>>0&&(Ae=p+(h[m+4>>2]|0)|0,Ae>>>0>M>>>0));)m=h[m+8>>2]|0;v=Ae+-47|0,p=v+8|0,p=v+((p&7|0)==0?0:0-p&7)|0,v=M+16|0,p=p>>>0<v>>>0?M:p,m=p+8|0,g=b+-40|0,se=x+8|0,se=(se&7|0)==0?0:0-se&7,we=x+se|0,se=g-se|0,h[6927]=we,h[6924]=se,h[we+4>>2]=se|1,h[x+g+4>>2]=40,h[6928]=h[7043],g=p+4|0,h[g>>2]=27,h[m>>2]=h[7033],h[m+4>>2]=h[7034],h[m+8>>2]=h[7035],h[m+12>>2]=h[7036],h[7033]=x,h[7034]=b,h[7036]=0,h[7035]=m,m=p+24|0;do we=m,m=m+4|0,h[m>>2]=7;while((we+8|0)>>>0<Ae>>>0);if((p|0)!=(M|0)){if(x=p-M|0,h[g>>2]=h[g>>2]&-2,h[M+4>>2]=x|1,h[p>>2]=x,m=x>>>3,x>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=M,h[m+12>>2]=M,h[M+8>>2]=m,h[M+12>>2]=g;break}if(m=x>>>8,m?x>>>0>16777215?_=31:(we=(m+1048320|0)>>>16&8,Ae=m<<we,se=(Ae+520192|0)>>>16&4,Ae=Ae<<se,_=(Ae+245760|0)>>>16&2,_=14-(se|we|_)+(Ae<<_>>>15)|0,_=x>>>(_+7|0)&1|_<<1):_=0,g=27988+(_<<2)|0,h[M+28>>2]=_,h[M+20>>2]=0,h[v>>2]=0,m=h[6922]|0,p=1<<_,!(m&p)){h[6922]=m|p,h[g>>2]=M,h[M+24>>2]=g,h[M+12>>2]=M,h[M+8>>2]=M;break}m=h[g>>2]|0;t:do if((h[m+4>>2]&-8|0)!=(x|0)){for(_=x<<((_|0)==31?0:25-(_>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(x|0)){m=p;break t}else _=_<<1,m=p;h[g>>2]=M,h[M+24>>2]=m,h[M+12>>2]=M,h[M+8>>2]=M;break e}while(!1);we=m+8|0,Ae=h[we>>2]|0,h[Ae+12>>2]=M,h[we>>2]=M,h[M+8>>2]=Ae,h[M+12>>2]=m,h[M+24>>2]=0}}else Ae=h[6925]|0,(Ae|0)==0|x>>>0<Ae>>>0&&(h[6925]=x),h[7033]=x,h[7034]=b,h[7036]=0,h[6930]=h[7039],h[6929]=-1,h[6934]=27724,h[6933]=27724,h[6936]=27732,h[6935]=27732,h[6938]=27740,h[6937]=27740,h[6940]=27748,h[6939]=27748,h[6942]=27756,h[6941]=27756,h[6944]=27764,h[6943]=27764,h[6946]=27772,h[6945]=27772,h[6948]=27780,h[6947]=27780,h[6950]=27788,h[6949]=27788,h[6952]=27796,h[6951]=27796,h[6954]=27804,h[6953]=27804,h[6956]=27812,h[6955]=27812,h[6958]=27820,h[6957]=27820,h[6960]=27828,h[6959]=27828,h[6962]=27836,h[6961]=27836,h[6964]=27844,h[6963]=27844,h[6966]=27852,h[6965]=27852,h[6968]=27860,h[6967]=27860,h[6970]=27868,h[6969]=27868,h[6972]=27876,h[6971]=27876,h[6974]=27884,h[6973]=27884,h[6976]=27892,h[6975]=27892,h[6978]=27900,h[6977]=27900,h[6980]=27908,h[6979]=27908,h[6982]=27916,h[6981]=27916,h[6984]=27924,h[6983]=27924,h[6986]=27932,h[6985]=27932,h[6988]=27940,h[6987]=27940,h[6990]=27948,h[6989]=27948,h[6992]=27956,h[6991]=27956,h[6994]=27964,h[6993]=27964,h[6996]=27972,h[6995]=27972,Ae=b+-40|0,se=x+8|0,se=(se&7|0)==0?0:0-se&7,we=x+se|0,se=Ae-se|0,h[6927]=we,h[6924]=se,h[we+4>>2]=se|1,h[x+Ae+4>>2]=40,h[6928]=h[7043];while(!1);if(m=h[6924]|0,m>>>0>q>>>0)return se=m-q|0,h[6924]=se,Ae=h[6927]|0,we=Ae+q|0,h[6927]=we,h[we+4>>2]=se|1,h[Ae+4>>2]=q|3,Ae=Ae+8|0,Q=Be,Ae|0}return Ae=Mq()|0,h[Ae>>2]=12,Ae=0,Q=Be,Ae|0}function _t(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0;if(p){g=p+-8|0,v=h[6925]|0,p=h[p+-4>>2]|0,m=p&-8,M=g+m|0;do if(p&1)E=g,b=g;else{if(_=h[g>>2]|0,!(p&3)||(b=g+(0-_)|0,x=_+m|0,b>>>0<v>>>0))return;if((h[6926]|0)==(b|0)){if(p=M+4|0,m=h[p>>2]|0,(m&3|0)!=3){E=b,m=x;break}h[6923]=x,h[p>>2]=m&-2,h[b+4>>2]=x|1,h[b+x>>2]=x;return}if(g=_>>>3,_>>>0<256)if(p=h[b+8>>2]|0,m=h[b+12>>2]|0,(m|0)==(p|0)){h[6921]=h[6921]&~(1<<g),E=b,m=x;break}else{h[p+12>>2]=m,h[m+8>>2]=p,E=b,m=x;break}v=h[b+24>>2]|0,p=h[b+12>>2]|0;do if((p|0)==(b|0)){if(m=b+16|0,g=m+4|0,p=h[g>>2]|0,p)m=g;else if(p=h[m>>2]|0,!p){p=0;break}for(;;)if(_=p+20|0,g=h[_>>2]|0,g)p=g,m=_;else if(_=p+16|0,g=h[_>>2]|0,g)p=g,m=_;else break;h[m>>2]=0}else E=h[b+8>>2]|0,h[E+12>>2]=p,h[p+8>>2]=E;while(!1);if(v){if(m=h[b+28>>2]|0,g=27988+(m<<2)|0,(h[g>>2]|0)==(b|0)){if(h[g>>2]=p,!p){h[6922]=h[6922]&~(1<<m),E=b,m=x;break}}else if(E=v+16|0,h[((h[E>>2]|0)==(b|0)?E:v+20|0)>>2]=p,!p){E=b,m=x;break}h[p+24>>2]=v,m=b+16|0,g=h[m>>2]|0,g|0&&(h[p+16>>2]=g,h[g+24>>2]=p),m=h[m+4>>2]|0,m?(h[p+20>>2]=m,h[m+24>>2]=p,E=b,m=x):(E=b,m=x)}else E=b,m=x}while(!1);if(!(b>>>0>=M>>>0)&&(p=M+4|0,_=h[p>>2]|0,!!(_&1))){if(_&2)h[p>>2]=_&-2,h[E+4>>2]=m|1,h[b+m>>2]=m,v=m;else{if((h[6927]|0)==(M|0)){if(M=(h[6924]|0)+m|0,h[6924]=M,h[6927]=E,h[E+4>>2]=M|1,(E|0)!=(h[6926]|0))return;h[6926]=0,h[6923]=0;return}if((h[6926]|0)==(M|0)){M=(h[6923]|0)+m|0,h[6923]=M,h[6926]=b,h[E+4>>2]=M|1,h[b+M>>2]=M;return}v=(_&-8)+m|0,g=_>>>3;do if(_>>>0<256)if(m=h[M+8>>2]|0,p=h[M+12>>2]|0,(p|0)==(m|0)){h[6921]=h[6921]&~(1<<g);break}else{h[m+12>>2]=p,h[p+8>>2]=m;break}else{x=h[M+24>>2]|0,p=h[M+12>>2]|0;do if((p|0)==(M|0)){if(m=M+16|0,g=m+4|0,p=h[g>>2]|0,p)m=g;else if(p=h[m>>2]|0,!p){g=0;break}for(;;)if(_=p+20|0,g=h[_>>2]|0,g)p=g,m=_;else if(_=p+16|0,g=h[_>>2]|0,g)p=g,m=_;else break;h[m>>2]=0,g=p}else g=h[M+8>>2]|0,h[g+12>>2]=p,h[p+8>>2]=g,g=p;while(!1);if(x|0){if(p=h[M+28>>2]|0,m=27988+(p<<2)|0,(h[m>>2]|0)==(M|0)){if(h[m>>2]=g,!g){h[6922]=h[6922]&~(1<<p);break}}else if(_=x+16|0,h[((h[_>>2]|0)==(M|0)?_:x+20|0)>>2]=g,!g)break;h[g+24>>2]=x,p=M+16|0,m=h[p>>2]|0,m|0&&(h[g+16>>2]=m,h[m+24>>2]=g),p=h[p+4>>2]|0,p|0&&(h[g+20>>2]=p,h[p+24>>2]=g)}}while(!1);if(h[E+4>>2]=v|1,h[b+v>>2]=v,(E|0)==(h[6926]|0)){h[6923]=v;return}}if(p=v>>>3,v>>>0<256){g=27724+(p<<1<<2)|0,m=h[6921]|0,p=1<<p,m&p?(m=g+8|0,p=h[m>>2]|0):(h[6921]=m|p,p=g,m=g+8|0),h[m>>2]=E,h[p+12>>2]=E,h[E+8>>2]=p,h[E+12>>2]=g;return}p=v>>>8,p?v>>>0>16777215?_=31:(b=(p+1048320|0)>>>16&8,M=p<<b,x=(M+520192|0)>>>16&4,M=M<<x,_=(M+245760|0)>>>16&2,_=14-(x|b|_)+(M<<_>>>15)|0,_=v>>>(_+7|0)&1|_<<1):_=0,p=27988+(_<<2)|0,h[E+28>>2]=_,h[E+20>>2]=0,h[E+16>>2]=0,m=h[6922]|0,g=1<<_;e:do if(!(m&g))h[6922]=m|g,h[p>>2]=E,h[E+24>>2]=p,h[E+12>>2]=E,h[E+8>>2]=E;else{p=h[p>>2]|0;t:do if((h[p+4>>2]&-8|0)!=(v|0)){for(_=v<<((_|0)==31?0:25-(_>>>1)|0);g=p+16+(_>>>31<<2)|0,m=h[g>>2]|0,!!m;)if((h[m+4>>2]&-8|0)==(v|0)){p=m;break t}else _=_<<1,p=m;h[g>>2]=E,h[E+24>>2]=p,h[E+12>>2]=E,h[E+8>>2]=E;break e}while(!1);b=p+8|0,M=h[b>>2]|0,h[M+12>>2]=E,h[b>>2]=E,h[E+8>>2]=M,h[E+12>>2]=p,h[E+24>>2]=0}while(!1);if(M=(h[6929]|0)+-1|0,h[6929]=M,!(M|0)){for(p=28140;p=h[p>>2]|0,p;)p=p+8|0;h[6929]=-1}}}}function Ea(p,m){p=p|0,m=m|0;var g=0;return p?(g=al(m,p)|0,(m|p)>>>0>65535&&(g=((g>>>0)/(p>>>0)|0|0)==(m|0)?g:-1)):g=0,p=br(g)|0,!p||!(h[p+-4>>2]&3)||hp(p|0,0,g|0)|0,p|0}function nhe(p,m){p=p|0,m=m|0;var g=0,_=0;return p?m>>>0>4294967231?(m=Mq()|0,h[m>>2]=12,m=0,m|0):(g=ihe(p+-8|0,m>>>0<11?16:m+11&-8)|0,g|0?(m=g+8|0,m|0):(g=br(m)|0,g?(_=h[p+-4>>2]|0,_=(_&-8)-((_&3|0)==0?8:4)|0,du(g|0,p|0,(_>>>0<m>>>0?_:m)|0)|0,_t(p),m=g,m|0):(m=0,m|0))):(m=br(m)|0,m|0)}function ihe(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;if(U=p+4|0,q=h[U>>2]|0,g=q&-8,E=p+g|0,!(q&3))return m>>>0<256?(p=0,p|0):(g>>>0>=(m+4|0)>>>0&&(g-m|0)>>>0<=h[7041]<<1>>>0||(p=0),p|0);if(g>>>0>=m>>>0)return g=g-m|0,g>>>0<=15||(N=p+m|0,h[U>>2]=q&1|m|2,h[N+4>>2]=g|3,q=E+4|0,h[q>>2]=h[q>>2]|1,Pq(N,g)),p|0;if((h[6927]|0)==(E|0))return N=(h[6924]|0)+g|0,g=N-m|0,_=p+m|0,N>>>0<=m>>>0?(p=0,p|0):(h[U>>2]=q&1|m|2,h[_+4>>2]=g|1,h[6927]=_,h[6924]=g,p|0);if((h[6926]|0)==(E|0))return _=(h[6923]|0)+g|0,_>>>0<m>>>0?(p=0,p|0):(g=_-m|0,g>>>0>15?(N=p+m|0,_=p+_|0,h[U>>2]=q&1|m|2,h[N+4>>2]=g|1,h[_>>2]=g,_=_+4|0,h[_>>2]=h[_>>2]&-2,_=N):(h[U>>2]=q&1|_|2,_=p+_+4|0,h[_>>2]=h[_>>2]|1,_=0,g=0),h[6923]=g,h[6926]=_,p|0);if(_=h[E+4>>2]|0,_&2|0||(M=(_&-8)+g|0,M>>>0<m>>>0))return p=0,p|0;N=M-m|0,v=_>>>3;do if(_>>>0<256)if(_=h[E+8>>2]|0,g=h[E+12>>2]|0,(g|0)==(_|0)){h[6921]=h[6921]&~(1<<v);break}else{h[_+12>>2]=g,h[g+8>>2]=_;break}else{b=h[E+24>>2]|0,g=h[E+12>>2]|0;do if((g|0)==(E|0)){if(_=E+16|0,v=_+4|0,g=h[v>>2]|0,g)_=v;else if(g=h[_>>2]|0,!g){v=0;break}for(;;)if(x=g+20|0,v=h[x>>2]|0,v)g=v,_=x;else if(x=g+16|0,v=h[x>>2]|0,v)g=v,_=x;else break;h[_>>2]=0,v=g}else v=h[E+8>>2]|0,h[v+12>>2]=g,h[g+8>>2]=v,v=g;while(!1);if(b|0){if(g=h[E+28>>2]|0,_=27988+(g<<2)|0,(h[_>>2]|0)==(E|0)){if(h[_>>2]=v,!v){h[6922]=h[6922]&~(1<<g);break}}else if(x=b+16|0,h[((h[x>>2]|0)==(E|0)?x:b+20|0)>>2]=v,!v)break;h[v+24>>2]=b,g=E+16|0,_=h[g>>2]|0,_|0&&(h[v+16>>2]=_,h[_+24>>2]=v),g=h[g+4>>2]|0,g|0&&(h[v+20>>2]=g,h[g+24>>2]=v)}}while(!1);return N>>>0<16?(h[U>>2]=q&1|M|2,q=p+M+4|0,h[q>>2]=h[q>>2]|1,p|0):(E=p+m|0,h[U>>2]=q&1|m|2,h[E+4>>2]=N|3,q=p+M+4|0,h[q>>2]=h[q>>2]|1,Pq(E,N),p|0)}function Pq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0;E=p+m|0,g=h[p+4>>2]|0;do if(g&1)b=p;else{if(v=h[p>>2]|0,!(g&3))return;if(b=p+(0-v)|0,m=v+m|0,(h[6926]|0)==(b|0)){if(p=E+4|0,g=h[p>>2]|0,(g&3|0)!=3)break;h[6923]=m,h[p>>2]=g&-2,h[b+4>>2]=m|1,h[E>>2]=m;return}if(_=v>>>3,v>>>0<256)if(p=h[b+8>>2]|0,g=h[b+12>>2]|0,(g|0)==(p|0)){h[6921]=h[6921]&~(1<<_);break}else{h[p+12>>2]=g,h[g+8>>2]=p;break}x=h[b+24>>2]|0,p=h[b+12>>2]|0;do if((p|0)==(b|0)){if(g=b+16|0,_=g+4|0,p=h[_>>2]|0,p)g=_;else if(p=h[g>>2]|0,!p){p=0;break}for(;;)if(v=p+20|0,_=h[v>>2]|0,_)p=_,g=v;else if(v=p+16|0,_=h[v>>2]|0,_)p=_,g=v;else break;h[g>>2]=0}else v=h[b+8>>2]|0,h[v+12>>2]=p,h[p+8>>2]=v;while(!1);if(x){if(g=h[b+28>>2]|0,_=27988+(g<<2)|0,(h[_>>2]|0)==(b|0)){if(h[_>>2]=p,!p){h[6922]=h[6922]&~(1<<g);break}}else if(v=x+16|0,h[((h[v>>2]|0)==(b|0)?v:x+20|0)>>2]=p,!p)break;h[p+24>>2]=x,g=b+16|0,_=h[g>>2]|0,_|0&&(h[p+16>>2]=_,h[_+24>>2]=p),g=h[g+4>>2]|0,g&&(h[p+20>>2]=g,h[g+24>>2]=p)}}while(!1);if(p=E+4|0,_=h[p>>2]|0,_&2)h[p>>2]=_&-2,h[b+4>>2]=m|1,h[b+m>>2]=m,v=m;else{if((h[6927]|0)==(E|0)){if(E=(h[6924]|0)+m|0,h[6924]=E,h[6927]=b,h[b+4>>2]=E|1,(b|0)!=(h[6926]|0))return;h[6926]=0,h[6923]=0;return}if((h[6926]|0)==(E|0)){E=(h[6923]|0)+m|0,h[6923]=E,h[6926]=b,h[b+4>>2]=E|1,h[b+E>>2]=E;return}v=(_&-8)+m|0,g=_>>>3;do if(_>>>0<256)if(p=h[E+8>>2]|0,m=h[E+12>>2]|0,(m|0)==(p|0)){h[6921]=h[6921]&~(1<<g);break}else{h[p+12>>2]=m,h[m+8>>2]=p;break}else{x=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(p=E+16|0,g=p+4|0,m=h[g>>2]|0,m)p=g;else if(m=h[p>>2]|0,!m){g=0;break}for(;;)if(_=m+20|0,g=h[_>>2]|0,g)m=g,p=_;else if(_=m+16|0,g=h[_>>2]|0,g)m=g,p=_;else break;h[p>>2]=0,g=m}else g=h[E+8>>2]|0,h[g+12>>2]=m,h[m+8>>2]=g,g=m;while(!1);if(x|0){if(m=h[E+28>>2]|0,p=27988+(m<<2)|0,(h[p>>2]|0)==(E|0)){if(h[p>>2]=g,!g){h[6922]=h[6922]&~(1<<m);break}}else if(_=x+16|0,h[((h[_>>2]|0)==(E|0)?_:x+20|0)>>2]=g,!g)break;h[g+24>>2]=x,m=E+16|0,p=h[m>>2]|0,p|0&&(h[g+16>>2]=p,h[p+24>>2]=g),m=h[m+4>>2]|0,m|0&&(h[g+20>>2]=m,h[m+24>>2]=g)}}while(!1);if(h[b+4>>2]=v|1,h[b+v>>2]=v,(b|0)==(h[6926]|0)){h[6923]=v;return}}if(m=v>>>3,v>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=b,h[m+12>>2]=b,h[b+8>>2]=m,h[b+12>>2]=g;return}if(m=v>>>8,m?v>>>0>16777215?_=31:(x=(m+1048320|0)>>>16&8,E=m<<x,g=(E+520192|0)>>>16&4,E=E<<g,_=(E+245760|0)>>>16&2,_=14-(g|x|_)+(E<<_>>>15)|0,_=v>>>(_+7|0)&1|_<<1):_=0,m=27988+(_<<2)|0,h[b+28>>2]=_,h[b+20>>2]=0,h[b+16>>2]=0,p=h[6922]|0,g=1<<_,!(p&g)){h[6922]=p|g,h[m>>2]=b,h[b+24>>2]=m,h[b+12>>2]=b,h[b+8>>2]=b;return}m=h[m>>2]|0;e:do if((h[m+4>>2]&-8|0)!=(v|0)){for(_=v<<((_|0)==31?0:25-(_>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(v|0)){m=p;break e}else _=_<<1,m=p;h[g>>2]=b,h[b+24>>2]=m,h[b+12>>2]=b,h[b+8>>2]=b;return}while(!1);x=m+8|0,E=h[x>>2]|0,h[E+12>>2]=b,h[x>>2]=b,h[b+8>>2]=E,h[b+12>>2]=m,h[b+24>>2]=0}function At(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,g=p+g>>>0,On(m+_+(g>>>0<p>>>0|0)>>>0|0),g|0|0}function eo(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,_=m-_-(g>>>0>p>>>0|0)>>>0,On(_|0),p-g>>>0|0|0}function Lq(p){return p=p|0,(p?31-(Wf(p^p-1)|0)|0:32)|0}function RL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(U=p,M=m,N=M,b=g,j=_,E=j,!N)return x=(v|0)!=0,E?x?(h[v>>2]=p|0,h[v+4>>2]=m&0,j=0,v=0,On(j|0),v|0):(j=0,v=0,On(j|0),v|0):(x&&(h[v>>2]=(U>>>0)%(b>>>0),h[v+4>>2]=0),j=0,v=(U>>>0)/(b>>>0)>>>0,On(j|0),v|0);x=(E|0)==0;do if(b){if(!x){if(x=(Wf(E|0)|0)-(Wf(N|0)|0)|0,x>>>0<=31){q=x+1|0,E=31-x|0,m=x-31>>31,b=q,p=U>>>(q>>>0)&m|N<<E,m=N>>>(q>>>0)&m,x=0,E=U<<E;break}return v?(h[v>>2]=p|0,h[v+4>>2]=M|m&0,j=0,v=0,On(j|0),v|0):(j=0,v=0,On(j|0),v|0)}if(x=b-1|0,x&b|0){E=(Wf(b|0)|0)+33-(Wf(N|0)|0)|0,K=64-E|0,q=32-E|0,M=q>>31,X=E-32|0,m=X>>31,b=E,p=q-1>>31&N>>>(X>>>0)|(N<<q|U>>>(E>>>0))&m,m=m&N>>>(E>>>0),x=U<<K&M,E=(N<<K|U>>>(X>>>0))&M|U<<q&E-33>>31;break}return v|0&&(h[v>>2]=x&U,h[v+4>>2]=0),(b|0)==1?(X=M|m&0,K=p|0|0,On(X|0),K|0):(K=Lq(b|0)|0,X=N>>>(K>>>0)|0,K=N<<32-K|U>>>(K>>>0)|0,On(X|0),K|0)}else{if(x)return v|0&&(h[v>>2]=(N>>>0)%(b>>>0),h[v+4>>2]=0),X=0,K=(N>>>0)/(b>>>0)>>>0,On(X|0),K|0;if(!U)return v|0&&(h[v>>2]=0,h[v+4>>2]=(N>>>0)%(E>>>0)),X=0,K=(N>>>0)/(E>>>0)>>>0,On(X|0),K|0;if(x=E-1|0,!(x&E))return v|0&&(h[v>>2]=p|0,h[v+4>>2]=x&N|m&0),X=0,K=N>>>((Lq(E|0)|0)>>>0),On(X|0),K|0;if(x=(Wf(E|0)|0)-(Wf(N|0)|0)|0,x>>>0<=30){m=x+1|0,E=31-x|0,b=m,p=N<<E|U>>>(m>>>0),m=N>>>(m>>>0),x=0,E=U<<E;break}return v?(h[v>>2]=p|0,h[v+4>>2]=M|m&0,X=0,K=0,On(X|0),K|0):(X=0,K=0,On(X|0),K|0)}while(!1);if(!b)N=E,M=0,E=0;else{q=g|0|0,U=j|_&0,N=At(q|0,U|0,-1,-1)|0,g=ee()|0,M=E,E=0;do _=M,M=x>>>31|M<<1,x=E|x<<1,_=p<<1|_>>>31|0,j=p>>>31|m<<1|0,eo(N|0,g|0,_|0,j|0)|0,K=ee()|0,X=K>>31|((K|0)<0?-1:0)<<1,E=X&1,p=eo(_|0,j|0,X&q|0,(((K|0)<0?-1:0)>>31|((K|0)<0?-1:0)<<1)&U|0)|0,m=ee()|0,b=b-1|0;while((b|0)!=0);N=M,M=0}return b=0,v|0&&(h[v>>2]=p,h[v+4>>2]=m),X=(x|0)>>>31|(N|b)<<1|(b<<1|x>>>31)&0|M,K=(x<<1|0)&-2|E,On(X|0),K|0}function cp(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;return N=m>>31|((m|0)<0?-1:0)<<1,M=((m|0)<0?-1:0)>>31|((m|0)<0?-1:0)<<1,x=_>>31|((_|0)<0?-1:0)<<1,v=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,E=eo(N^p|0,M^m|0,N|0,M|0)|0,b=ee()|0,p=x^N,m=v^M,eo((RL(E,b,eo(x^g|0,v^_|0,x|0,v|0)|0,ee()|0,0)|0)^p|0,(ee()|0)^m|0,p|0,m|0)|0}function rhe(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return x=p&65535,v=m&65535,g=al(v,x)|0,_=p>>>16,p=(g>>>16)+(al(v,_)|0)|0,v=m>>>16,m=al(v,x)|0,On((p>>>16)+(al(v,_)|0)+(((p&65535)+m|0)>>>16)|0),p+m<<16|g&65535|0|0}function wr(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;return v=p,x=g,g=rhe(v,x)|0,p=ee()|0,On((al(m,x)|0)+(al(_,v)|0)+p|p&0|0),g|0|0|0}function up(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;return v=Q,Q=Q+16|0,E=v|0,b=m>>31|((m|0)<0?-1:0)<<1,x=((m|0)<0?-1:0)>>31|((m|0)<0?-1:0)<<1,N=_>>31|((_|0)<0?-1:0)<<1,M=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,p=eo(b^p|0,x^m|0,b|0,x|0)|0,m=ee()|0,RL(p,m,eo(N^g|0,M^_|0,N|0,M|0)|0,ee()|0,E)|0,_=eo(h[E>>2]^b|0,h[E+4>>2]^x|0,b|0,x|0)|0,g=ee()|0,Q=v,On(g|0),_|0}function jf(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;return x=Q,Q=Q+16|0,v=x|0,RL(p,m,g,_,v)|0,Q=x,On(h[v+4>>2]|0),h[v>>2]|0|0}function Dq(p,m,g){return p=p|0,m=m|0,g=g|0,(g|0)<32?(On(m>>g|0),p>>>g|(m&(1<<g)-1)<<32-g):(On(((m|0)<0?-1:0)|0),m>>g-32|0)}function tt(p,m,g){return p=p|0,m=m|0,g=g|0,(g|0)<32?(On(m>>>g|0),p>>>g|(m&(1<<g)-1)<<32-g):(On(0),m>>>g-32|0)}function ft(p,m,g){return p=p|0,m=m|0,g=g|0,(g|0)<32?(On(m<<g|(p&(1<<g)-1<<32-g)>>>32-g|0),p<<g):(On(p<<g-32|0),0)}function IL(p,m,g){return p=p|0,m=m|0,g=g|0,m=Wf(m)|0,(m|0)==32&&(m=m+(Wf(p)|0)|0),On(0),m|0}function Nq(p,m){return p=+p,m=+m,p!=p?+m:m!=m?+p:+Sce(+p,+m)}function gT(p,m){return p=+p,m=+m,p!=p?+m:m!=m?+p:+oL(+p,+m)}function vT(p){return p=+p,p>=0?+fo(p+.5):+y1(p-.5)}function du(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if((g|0)>=8192)return Mce(p|0,m|0,g|0)|0,p|0;if(x=p|0,v=p+g|0,(p&3)==(m&3)){for(;p&3;){if(!g)return x|0;He[p>>0]=He[m>>0]|0,p=p+1|0,m=m+1|0,g=g-1|0}for(g=v&-4|0,_=g-64|0;(p|0)<=(_|0);)h[p>>2]=h[m>>2],h[p+4>>2]=h[m+4>>2],h[p+8>>2]=h[m+8>>2],h[p+12>>2]=h[m+12>>2],h[p+16>>2]=h[m+16>>2],h[p+20>>2]=h[m+20>>2],h[p+24>>2]=h[m+24>>2],h[p+28>>2]=h[m+28>>2],h[p+32>>2]=h[m+32>>2],h[p+36>>2]=h[m+36>>2],h[p+40>>2]=h[m+40>>2],h[p+44>>2]=h[m+44>>2],h[p+48>>2]=h[m+48>>2],h[p+52>>2]=h[m+52>>2],h[p+56>>2]=h[m+56>>2],h[p+60>>2]=h[m+60>>2],p=p+64|0,m=m+64|0;for(;(p|0)<(g|0);)h[p>>2]=h[m>>2],p=p+4|0,m=m+4|0}else for(g=v-4|0;(p|0)<(g|0);)He[p>>0]=He[m>>0]|0,He[p+1>>0]=He[m+1>>0]|0,He[p+2>>0]=He[m+2>>0]|0,He[p+3>>0]=He[m+3>>0]|0,p=p+4|0,m=m+4|0;for(;(p|0)<(v|0);)He[p>>0]=He[m>>0]|0,p=p+1|0,m=m+1|0;return x|0}function PL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0;if((m|0)<(p|0)&(p|0)<(m+g|0)){for(_=p,m=m+g|0,p=p+g|0;(g|0)>0;)p=p-1|0,m=m-1|0,g=g-1|0,He[p>>0]=He[m>>0]|0;p=_}else du(p,m,g)|0;return p|0}function hp(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;if(x=p+g|0,m=m&255,(g|0)>=67){for(;p&3;)He[p>>0]=m,p=p+1|0;for(_=x&-4|0,b=m|m<<8|m<<16|m<<24,v=_-64|0;(p|0)<=(v|0);)h[p>>2]=b,h[p+4>>2]=b,h[p+8>>2]=b,h[p+12>>2]=b,h[p+16>>2]=b,h[p+20>>2]=b,h[p+24>>2]=b,h[p+28>>2]=b,h[p+32>>2]=b,h[p+36>>2]=b,h[p+40>>2]=b,h[p+44>>2]=b,h[p+48>>2]=b,h[p+52>>2]=b,h[p+56>>2]=b,h[p+60>>2]=b,p=p+64|0;for(;(p|0)<(_|0);)h[p>>2]=b,p=p+4|0}for(;(p|0)<(x|0);)He[p>>0]=m,p=p+1|0;return x-g|0}function Fq(p){return p=+p,p>=0?+fo(p+.5):+y1(p-.5)}function fp(p){p=p|0;var m=0,g=0,_=0;return _=Ece()|0,g=h[ol>>2]|0,m=g+p|0,(p|0)>0&(m|0)<(g|0)|(m|0)<0?(Rce(m|0)|0,ZG(12),-1):(m|0)>(_|0)&&!(Cce(m|0)|0)?(ZG(12),-1):(h[ol>>2]=m,g|0)}function she(p,m,g){return p=p|0,m=m|0,g=g|0,dp[p&3](m|0,g|0)|0}function ohe(p,m){return p=p|0,m=m|0,Tce(0),0}var dp=[ohe,nue,iue,rue];return{___divdi3:cp,___muldi3:wr,___remdi3:up,___uremdi3:jf,_areNeighborCells:sue,_bitshift64Ashr:Dq,_bitshift64Lshr:tt,_bitshift64Shl:ft,_calloc:Ea,_cellAreaKm2:Gce,_cellAreaM2:qce,_cellAreaRads2:Vce,_cellToBoundary:Vm,_cellToCenterChild:pq,_cellToChildPos:Tue,_cellToChildren:Aue,_cellToChildrenSize:$x,_cellToLatLng:S1,_cellToLocalIj:Oue,_cellToParent:AL,_cellToVertex:wc,_cellToVertexes:ehe,_cellsToDirectedEdge:oue,_cellsToLinkedMultiPolygon:zce,_childPosToCell:Eue,_compactCells:gue,_constructCell:pue,_destroyLinkedMultiPolygon:Fue,_directedEdgeToBoundary:jx,_directedEdgeToCells:cue,_edgeLengthKm:Due,_edgeLengthM:Nue,_edgeLengthRads:Lue,_emscripten_replace_memory:Ice,_free:_t,_getBaseCellNumber:fq,_getDirectedEdgeDestination:lue,_getDirectedEdgeOrigin:aue,_getHexagonAreaAvgKm2:gq,_getHexagonAreaAvgM2:Rue,_getHexagonEdgeLengthAvgKm:Iue,_getHexagonEdgeLengthAvgM:Pue,_getIcosahedronFaces:mq,_getIndexDigit:due,_getNumCells:uT,_getPentagons:yL,_getRes0Cells:$ce,_getResolution:pL,_greatCircleDistanceKm:Zx,_greatCircleDistanceM:Cue,_greatCircleDistanceRads:Mue,_gridDisk:KG,_gridDiskDistances:QG,_gridDistance:SL,_gridPathCells:zue,_gridPathCellsSize:kue,_gridRing:Bce,_gridRingUnsafe:eq,_i64Add:At,_i64Subtract:eo,_isPentagon:Zi,_isResClassIII:xue,_isValidCell:cT,_isValidDirectedEdge:lq,_isValidIndex:mue,_isValidVertex:Eq,_latLngToCell:_L,_llvm_ctlz_i64:IL,_llvm_maxnum_f64:Nq,_llvm_minnum_f64:gT,_llvm_round_f64:vT,_localIjToCell:Uue,_malloc:br,_maxFaceCount:wue,_maxGridDiskSize:Fce,_maxPolygonToCellsSize:Uce,_maxPolygonToCellsSizeExperimental:que,_memcpy:du,_memmove:PL,_memset:hp,_originToDirectedEdges:hL,_pentagonCount:Sue,_polygonToCells:kce,_polygonToCellsExperimental:Gue,_readInt64AsDoubleFromPointer:Kue,_res0CellCount:Xce,_reverseDirectedEdge:cq,_round:Fq,_sbrk:fp,_sizeOfCellBoundary:jue,_sizeOfCoordIJ:Zue,_sizeOfGeoLoop:Xue,_sizeOfGeoPolygon:$ue,_sizeOfH3Index:Hue,_sizeOfLatLng:Wue,_sizeOfLinkedGeoPolygon:Yue,_uncompactCells:vue,_uncompactCellsSize:_ue,_vertexToLatLng:the,dynCall_iii:she,establishStackSpace:Nce,stackAlloc:Pce,stackRestore:Dce,stackSave:Lce}})(Bt,ut,W),Yt=e.___divdi3=Ce.___divdi3,nr=e.___muldi3=Ce.___muldi3,Fn=e.___remdi3=Ce.___remdi3,rs=e.___uremdi3=Ce.___uremdi3,Dr=e._areNeighborCells=Ce._areNeighborCells,Bl=e._bitshift64Ashr=Ce._bitshift64Ashr,Sa=e._bitshift64Lshr=Ce._bitshift64Lshr,Ol=e._bitshift64Shl=Ce._bitshift64Shl,rl=e._calloc=Ce._calloc,xr=e._cellAreaKm2=Ce._cellAreaKm2,Ks=e._cellAreaM2=Ce._cellAreaM2,Ul=e._cellAreaRads2=Ce._cellAreaRads2,oh=e._cellToBoundary=Ce._cellToBoundary,rT=e._cellToCenterChild=Ce._cellToCenterChild,QP=e._cellToChildPos=Ce._cellToChildPos,JP=e._cellToChildren=Ce._cellToChildren,qx=e._cellToChildrenSize=Ce._cellToChildrenSize,eL=e._cellToLatLng=Ce._cellToLatLng,Hx=e._cellToLocalIj=Ce._cellToLocalIj,tL=e._cellToParent=Ce._cellToParent,nL=e._cellToVertex=Ce._cellToVertex,VG=e._cellToVertexes=Ce._cellToVertexes,GG=e._cellsToDirectedEdge=Ce._cellsToDirectedEdge,qG=e._cellsToLinkedMultiPolygon=Ce._cellsToLinkedMultiPolygon,HG=e._childPosToCell=Ce._childPosToCell,ne=e._compactCells=Ce._compactCells,Se=e._constructCell=Ce._constructCell,ke=e._destroyLinkedMultiPolygon=Ce._destroyLinkedMultiPolygon,De=e._directedEdgeToBoundary=Ce._directedEdgeToBoundary,Ne=e._directedEdgeToCells=Ce._directedEdgeToCells,qt=e._edgeLengthKm=Ce._edgeLengthKm,Qt=e._edgeLengthM=Ce._edgeLengthM,Vt=e._edgeLengthRads=Ce._edgeLengthRads,sn=e._emscripten_replace_memory=Ce._emscripten_replace_memory,pn=e._free=Ce._free,Wn=e._getBaseCellNumber=Ce._getBaseCellNumber,Jn=e._getDirectedEdgeDestination=Ce._getDirectedEdgeDestination,gn=e._getDirectedEdgeOrigin=Ce._getDirectedEdgeOrigin,Yi=e._getHexagonAreaAvgKm2=Ce._getHexagonAreaAvgKm2,ss=e._getHexagonAreaAvgM2=Ce._getHexagonAreaAvgM2,Hr=e._getHexagonEdgeLengthAvgKm=Ce._getHexagonEdgeLengthAvgKm,ir=e._getHexagonEdgeLengthAvgM=Ce._getHexagonEdgeLengthAvgM,Co=e._getIcosahedronFaces=Ce._getIcosahedronFaces,Zt=e._getIndexDigit=Ce._getIndexDigit,sl=e._getNumCells=Ce._getNumCells,yi=e._getPentagons=Ce._getPentagons,kl=e._getRes0Cells=Ce._getRes0Cells,fu=e._getResolution=Ce._getResolution,Gf=e._greatCircleDistanceKm=Ce._greatCircleDistanceKm,Om=e._greatCircleDistanceM=Ce._greatCircleDistanceM,rr=e._greatCircleDistanceRads=Ce._greatCircleDistanceRads,os=e._gridDisk=Ce._gridDisk,qf=e._gridDiskDistances=Ce._gridDiskDistances,pr=e._gridDistance=Ce._gridDistance,Hf=e._gridPathCells=Ce._gridPathCells,Um=e._gridPathCellsSize=Ce._gridPathCellsSize,iL=e._gridRing=Ce._gridRing,p8e=e._gridRingUnsafe=Ce._gridRingUnsafe,m8e=e._i64Add=Ce._i64Add,A8e=e._i64Subtract=Ce._i64Subtract,g8e=e._isPentagon=Ce._isPentagon,v8e=e._isResClassIII=Ce._isResClassIII,_8e=e._isValidCell=Ce._isValidCell,x8e=e._isValidDirectedEdge=Ce._isValidDirectedEdge,y8e=e._isValidIndex=Ce._isValidIndex,b8e=e._isValidVertex=Ce._isValidVertex,w8e=e._latLngToCell=Ce._latLngToCell,S8e=e._llvm_ctlz_i64=Ce._llvm_ctlz_i64,T8e=e._llvm_maxnum_f64=Ce._llvm_maxnum_f64,E8e=e._llvm_minnum_f64=Ce._llvm_minnum_f64,M8e=e._llvm_round_f64=Ce._llvm_round_f64,C8e=e._localIjToCell=Ce._localIjToCell,R8e=e._malloc=Ce._malloc,I8e=e._maxFaceCount=Ce._maxFaceCount,P8e=e._maxGridDiskSize=Ce._maxGridDiskSize,L8e=e._maxPolygonToCellsSize=Ce._maxPolygonToCellsSize,D8e=e._maxPolygonToCellsSizeExperimental=Ce._maxPolygonToCellsSizeExperimental,N8e=e._memcpy=Ce._memcpy,F8e=e._memmove=Ce._memmove,B8e=e._memset=Ce._memset,O8e=e._originToDirectedEdges=Ce._originToDirectedEdges,U8e=e._pentagonCount=Ce._pentagonCount,k8e=e._polygonToCells=Ce._polygonToCells,z8e=e._polygonToCellsExperimental=Ce._polygonToCellsExperimental,V8e=e._readInt64AsDoubleFromPointer=Ce._readInt64AsDoubleFromPointer,G8e=e._res0CellCount=Ce._res0CellCount,q8e=e._reverseDirectedEdge=Ce._reverseDirectedEdge,H8e=e._round=Ce._round,W8e=e._sbrk=Ce._sbrk,j8e=e._sizeOfCellBoundary=Ce._sizeOfCellBoundary,X8e=e._sizeOfCoordIJ=Ce._sizeOfCoordIJ,$8e=e._sizeOfGeoLoop=Ce._sizeOfGeoLoop,Y8e=e._sizeOfGeoPolygon=Ce._sizeOfGeoPolygon,Z8e=e._sizeOfH3Index=Ce._sizeOfH3Index,K8e=e._sizeOfLatLng=Ce._sizeOfLatLng,Q8e=e._sizeOfLinkedGeoPolygon=Ce._sizeOfLinkedGeoPolygon,J8e=e._uncompactCells=Ce._uncompactCells,eFe=e._uncompactCellsSize=Ce._uncompactCellsSize,tFe=e._vertexToLatLng=Ce._vertexToLatLng,nFe=e.establishStackSpace=Ce.establishStackSpace,WG=e.stackAlloc=Ce.stackAlloc,yce=e.stackRestore=Ce.stackRestore,bce=e.stackSave=Ce.stackSave,iFe=e.dynCall_iii=Ce.dynCall_iii;if(e.asm=Ce,e.cwrap=I,e.setValue=y,e.getValue=w,le){Te(le)||(le=o(le));{vi("memory initializer");var rL=function(Le){Le.byteLength&&(Le=new Uint8Array(Le)),H.set(Le,A),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,zn("memory initializer")},jG=function(){a(le,rL,function(){throw"could not load memory initializer "+le})},XG=St(le);if(XG)rL(XG.buffer);else if(e.memoryInitializerRequest){var $G=function(){var Le=e.memoryInitializerRequest,it=Le.response;if(Le.status!==200&&Le.status!==0){var Dt=St(e.memoryInitializerRequestURL);if(Dt)it=Dt.buffer;else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+Le.status+", retrying "+le),jG();return}}rL(it)};e.memoryInitializerRequest.response?setTimeout($G,0):e.memoryInitializerRequest.addEventListener("load",$G)}else jG()}}var sT;_e=function Le(){sT||sL(),sT||(_e=Le)};function sL(Le){if(Le=Le||r,tn>0||(It(),tn>0))return;function it(){sT||(sT=!0,!S&&(dn(),Gt(),e.onRuntimeInitialized&&e.onRuntimeInitialized(),$e()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),it()},1)):it()}e.run=sL;function km(Le){throw e.onAbort&&e.onAbort(Le),Le+="",l(Le),c(Le),S=!0,"abort("+Le+"). Build with -s ASSERTIONS=1 for more info."}if(e.abort=km,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return sL(),i})(typeof Ai=="object"?Ai:{}),En="number",Sn=En,z_=En,Cn=En,Rn=En,wo=En,jt=En,qSe=[["sizeOfH3Index",En],["sizeOfLatLng",En],["sizeOfCellBoundary",En],["sizeOfGeoLoop",En],["sizeOfGeoPolygon",En],["sizeOfLinkedGeoPolygon",En],["sizeOfCoordIJ",En],["readInt64AsDoubleFromPointer",En],["isValidCell",z_,[Cn,Rn]],["isValidIndex",z_,[Cn,Rn]],["latLngToCell",Sn,[En,En,wo,jt]],["cellToLatLng",Sn,[Cn,Rn,jt]],["cellToBoundary",Sn,[Cn,Rn,jt]],["maxGridDiskSize",Sn,[En,jt]],["gridDisk",Sn,[Cn,Rn,En,jt]],["gridDiskDistances",Sn,[Cn,Rn,En,jt,jt]],["gridRing",Sn,[Cn,Rn,En,jt]],["gridRingUnsafe",Sn,[Cn,Rn,En,jt]],["maxPolygonToCellsSize",Sn,[jt,wo,En,jt]],["polygonToCells",Sn,[jt,wo,En,jt]],["maxPolygonToCellsSizeExperimental",Sn,[jt,wo,En,jt]],["polygonToCellsExperimental",Sn,[jt,wo,En,En,En,jt]],["cellsToLinkedMultiPolygon",Sn,[jt,En,jt]],["destroyLinkedMultiPolygon",null,[jt]],["compactCells",Sn,[jt,jt,En,En]],["uncompactCells",Sn,[jt,En,En,jt,En,wo]],["uncompactCellsSize",Sn,[jt,En,En,wo,jt]],["isPentagon",z_,[Cn,Rn]],["isResClassIII",z_,[Cn,Rn]],["getBaseCellNumber",En,[Cn,Rn]],["getResolution",En,[Cn,Rn]],["getIndexDigit",En,[Cn,Rn,En]],["constructCell",Sn,[En,En,jt,jt]],["maxFaceCount",Sn,[Cn,Rn,jt]],["getIcosahedronFaces",Sn,[Cn,Rn,jt]],["cellToParent",Sn,[Cn,Rn,wo,jt]],["cellToChildren",Sn,[Cn,Rn,wo,jt]],["cellToCenterChild",Sn,[Cn,Rn,wo,jt]],["cellToChildrenSize",Sn,[Cn,Rn,wo,jt]],["cellToChildPos",Sn,[Cn,Rn,wo,jt]],["childPosToCell",Sn,[En,En,Cn,Rn,wo,jt]],["areNeighborCells",Sn,[Cn,Rn,Cn,Rn,jt]],["cellsToDirectedEdge",Sn,[Cn,Rn,Cn,Rn,jt]],["getDirectedEdgeOrigin",Sn,[Cn,Rn,jt]],["getDirectedEdgeDestination",Sn,[Cn,Rn,jt]],["isValidDirectedEdge",z_,[Cn,Rn]],["directedEdgeToCells",Sn,[Cn,Rn,jt]],["originToDirectedEdges",Sn,[Cn,Rn,jt]],["directedEdgeToBoundary",Sn,[Cn,Rn,jt]],["reverseDirectedEdge",Sn,[Cn,Rn,jt]],["gridDistance",Sn,[Cn,Rn,Cn,Rn,jt]],["gridPathCells",Sn,[Cn,Rn,Cn,Rn,jt]],["gridPathCellsSize",Sn,[Cn,Rn,Cn,Rn,jt]],["cellToLocalIj",Sn,[Cn,Rn,Cn,Rn,En,jt]],["localIjToCell",Sn,[Cn,Rn,jt,En,jt]],["getHexagonAreaAvgM2",Sn,[wo,jt]],["getHexagonAreaAvgKm2",Sn,[wo,jt]],["getHexagonEdgeLengthAvgM",Sn,[wo,jt]],["getHexagonEdgeLengthAvgKm",Sn,[wo,jt]],["greatCircleDistanceM",En,[jt,jt]],["greatCircleDistanceKm",En,[jt,jt]],["greatCircleDistanceRads",En,[jt,jt]],["cellAreaM2",Sn,[Cn,Rn,jt]],["cellAreaKm2",Sn,[Cn,Rn,jt]],["cellAreaRads2",Sn,[Cn,Rn,jt]],["edgeLengthM",Sn,[Cn,Rn,jt]],["edgeLengthKm",Sn,[Cn,Rn,jt]],["edgeLengthRads",Sn,[Cn,Rn,jt]],["getNumCells",Sn,[wo,jt]],["getRes0Cells",Sn,[jt]],["res0CellCount",En],["getPentagons",Sn,[En,jt]],["pentagonCount",En],["cellToVertex",Sn,[Cn,Rn,En,jt]],["cellToVertexes",Sn,[Cn,Rn,jt]],["vertexToLatLng",Sn,[Cn,Rn,jt]],["isValidVertex",z_,[Cn,Rn]]],HSe=0,WSe=1,jSe=2,XSe=3,wee=4,$Se=5,YSe=6,ZSe=7,KSe=8,QSe=9,JSe=10,eTe=11,tTe=12,nTe=13,iTe=14,rTe=15,sTe=16,oTe=17,aTe=18,lTe=19,Is={};Is[HSe]="Success";Is[WSe]="The operation failed but a more specific error is not available";Is[jSe]="Argument was outside of acceptable range";Is[XSe]="Latitude or longitude arguments were outside of acceptable range";Is[wee]="Resolution argument was outside of acceptable range";Is[$Se]="Cell argument was not valid";Is[YSe]="Directed edge argument was not valid";Is[ZSe]="Undirected edge argument was not valid";Is[KSe]="Vertex argument was not valid";Is[QSe]="Pentagon distortion was encountered";Is[JSe]="Duplicate input";Is[eTe]="Cell arguments were not neighbors";Is[tTe]="Cell arguments had incompatible resolutions";Is[nTe]="Memory allocation failed";Is[iTe]="Bounds of provided memory were insufficient";Is[rTe]="Mode or flags argument was not valid";Is[sTe]="Index argument was not valid";Is[oTe]="Base cell number was outside of acceptable range";Is[aTe]="Child indexing digits invalid";Is[lTe]="Child indexing digits refer to a deleted subsequence";var cTe=1e3,See=1001,Tee=1002,mR={};mR[cTe]="Unknown unit";mR[See]="Array length out of bounds";mR[Tee]="Got unexpected null value for H3 index";var uTe="Unknown error";function Eee(i,e,t){var n=t&&"value"in t,r=new Error((i[e]||uTe)+" (code: "+e+(n?", value: "+t.value:"")+")");return r.code=e,r}function Mee(i,e){var t=arguments.length===2?{value:e}:{};return Eee(Is,i,t)}function Cee(i,e){var t=arguments.length===2?{value:e}:{};return Eee(mR,i,t)}function Ow(i){if(i!==0)throw Mee(i)}var Il={};qSe.forEach(function(e){Il[e[0]]=Ai.cwrap.apply(Ai,e)});var V_=16;var Uw=4;var G_=8,hTe=8,dR=Il.sizeOfH3Index(),PO=Il.sizeOfLatLng(),fTe=Il.sizeOfCellBoundary(),dTe=Il.sizeOfGeoPolygon(),Bw=Il.sizeOfGeoLoop(),plt=Il.sizeOfLinkedGeoPolygon(),mlt=Il.sizeOfCoordIJ();function pTe(i){if(typeof i!="number"||i<0||i>15||Math.floor(i)!==i)throw Mee(wee,i);return i}function mTe(i){if(!i)throw Cee(Tee);return i}var ATe=Math.pow(2,32)-1,Alt=Math.pow(2,31)-1;function gTe(i){if(i>ATe)throw Cee(See,i);return i}var vTe=/[^0-9a-fA-F]/;function Ree(i){if(Array.isArray(i)&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1]))return i;if(typeof i!="string"||vTe.test(i))return[0,0];var e=parseInt(i.substring(0,i.length-8),V_),t=parseInt(i.substring(i.length-8),V_);return[t,e]}function yee(i){if(i>=0)return i.toString(V_);i=i&2147483647;var e=Iee(8,i.toString(V_)),t=(parseInt(e[0],V_)+8).toString(V_);return e=t+e.substring(1),e}function _Te(i,e){return yee(e)+Iee(8,yee(i))}function Iee(i,e){for(var t=i-e.length,n="",r=0;r<t;r++)n+="0";return n=n+e,n}var glt=Math.pow(2,32);function bee(i,e,t){for(var n=i.length,r=Ai._calloc(n,PO),s=t?1:0,o=t?0:1,a=0;a<n*2;a+=2)Ai.HEAPF64.set([i[a/2][s],i[a/2][o]].map(Nee),r/G_+a);return Ai.HEAPU32.set([n,r],e/Uw),e}function xTe(i,e){var t=i.length-1,n=Ai._calloc(dTe),r=0,s=r+Bw,o=s+Uw;bee(i[0],n+r,e);var a;if(t>0){a=Ai._calloc(t,Bw);for(var l=0;l<t;l++)bee(i[l+1],a+Bw*l,e)}return Ai.setValue(n+s,t,"i32"),Ai.setValue(n+o,a,"i32"),n}function yTe(i){var e=0,t=e+Bw,n=t+Uw,r=Uw;Ai._free(Ai.getValue(i+e+r,"i8*"));var s=Ai.getValue(i+t,"i32");if(s>0){for(var o=Ai.getValue(i+n,"i32"),a=0;a<s;a++)Ai._free(Ai.getValue(o+Bw*a+r,"i8*"));Ai._free(o)}Ai._free(i)}function Pee(i,e){e===void 0&&(e=0);var t=Ai.getValue(i+dR*e,"i32"),n=Ai.getValue(i+dR*e+Uw,"i32");return n?_Te(t,n):null}function bTe(i){return Il.readInt64AsDoubleFromPointer(i)}function wTe(i,e){for(var t=[],n=0;n<e;n++){var r=Pee(i,n);r!==null&&t.push(r)}return t}function pR(i){return ETe(Ai.getValue(i,"double"))}function Lee(i){return[pR(i),pR(i+G_)]}function STe(i){return[pR(i+G_),pR(i)]}function TTe(i,e,t){for(var n=Ai.getValue(i,"i32"),r=i+G_,s=[],o=e?STe:Lee,a=0;a<n*2;a+=2)s.push(o(r+G_*a));return t&&s.push(s[0]),s}function Dee(i,e,t){var n=Ai._malloc(PO);Ai.HEAPF64.set([i,e].map(Nee),n/G_);var r=Ai._malloc(dR);try{return Ow(Il.latLngToCell(n,t,r)),mTe(Pee(r))}finally{Ai._free(r),Ai._free(n)}}function LO(i){var e=Ai._malloc(PO),t=Ree(i),n=t[0],r=t[1];try{return Ow(Il.cellToLatLng(n,r,e)),Lee(e)}finally{Ai._free(e)}}function DO(i,e){var t=Ai._malloc(fTe),n=Ree(i),r=n[0],s=n[1];try{return Ow(Il.cellToBoundary(r,s,t)),TTe(t,e,e)}finally{Ai._free(t)}}function NO(i,e,t){if(pTe(e),t=!!t,i.length===0||i[0].length===0)return[];var n=typeof i[0][0]=="number"?[i]:i,r=xTe(n,t),s=Ai._malloc(hTe);try{Ow(Il.maxPolygonToCellsSize(r,e,0,s));var o=gTe(bTe(s)),a=Ai._calloc(o,dR);try{return Ow(Il.polygonToCells(r,e,0,a)),wTe(a,o)}finally{Ai._free(a)}}finally{Ai._free(s),yTe(r)}}function Nee(i){return i*Math.PI/180}function ETe(i){return i*180/Math.PI}function FO(i){return i=Math.max(0,Math.min(1,i)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+i*(1172.33-i*(10793.56-i*(33300.12-i*(38394.49-i*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+i*(557.33+i*(1225.33-i*(3574.96-i*(1073.77+i*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+i*(3211.1-i*(15327.97-i*(27814-i*(22569.18-i*6838.66)))))))+")"}var MTe=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","aoMapIntensity","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveIntensity","emissiveMap","envMap","envMapIntensity","envMapRotation","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","lightMapIntensity","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"],Fee=new WeakMap,Bee=new WeakMap,Oee=new WeakMap,xU=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=MTe,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}needsVelocity(e){let t=e.getMRT();return t!==null&&t.has("velocity")}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){let{geometry:n,object:r}=e;if(t={geometryId:n.id,worldMatrix:r.matrixWorld.clone()},r.center&&(t.center=r.center.clone()),r.morphTargetInfluences&&(t.morphTargetInfluences=r.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),e.material.transmission>0){let{width:a,height:l}=e.context;t.bufferWidth=a,t.bufferHeight=l}let{environmentIntensity:s,environmentRotation:o}=e.scene;t.environmentIntensity=s,t.environmentRotation=o.clone(),t.lights=this.getLightsData(e.lightsNode.getLights(),[]),this.renderObjects.set(e,t)}return t}getAttributesData(e){let t={};for(let n in e){let r=e[n];t[n]={id:r.isInterleavedBufferAttribute?r.data.uuid:r.id,version:r.isInterleavedBufferAttribute?r.data.version:r.version}}return t}containsNode(e){let t=e.material;for(let n in t)if(t[n]&&t[n].isNode)return!0;return!!(e.context.modelViewMatrix||e.context.modelNormalViewMatrix||e.context.getAO||e.context.getShadow)}getGeometryData(e){let t=Oee.get(e);return t===void 0&&(t={_renderId:-1,_equal:!1,attributes:this.getAttributesData(e.attributes),indexId:e.index?e.index.id:null,indexVersion:e.index?e.index.version:null,drawRange:{start:e.drawRange.start,count:e.drawRange.count}},Oee.set(e,t)),t}getMaterialData(e){let t=Bee.get(e);if(t===void 0){t={_renderId:-1,_equal:!1};for(let n of this.refreshUniforms){let r=e[n];r!=null&&(typeof r=="object"&&r.clone!==void 0?r.isTexture===!0?t[n]={id:r.id,version:0}:t[n]=r.clone():t[n]=r)}Bee.set(e,t)}return t}equals(e,t,n){let{object:r,material:s,geometry:o}=e,a=this.getRenderObjectData(e);if(a.worldMatrix.equals(r.matrixWorld)!==!0)return a.worldMatrix.copy(r.matrixWorld),!1;let l=this.getMaterialData(e.material);if(l._renderId!==n){l._renderId=n;for(let f in l){let d=l[f],A=s[f];if(f!=="_renderId"&&f!=="_equal"){if(d.equals!==void 0){if(d.equals(A)===!1)return d.copy(A),l._equal=!1,!1}else if(A.isTexture===!0){if(d.id!==A.id||d.version!==A.version)return d.id=A.id,d.version=A.version,l._equal=!1,!1}else if(d!==A)return l[f]=A,l._equal=!1,!1}}if(l.transmission>0){let{width:f,height:d}=e.context;if(a.bufferWidth!==f||a.bufferHeight!==d)return a.bufferWidth=f,a.bufferHeight=d,l._equal=!1,!1}l._equal=!0}else if(l._equal===!1)return!1;if(a.geometryId!==o.id)return a.geometryId=o.id,!1;let c=this.getGeometryData(e.geometry);if(c._renderId!==n){c._renderId=n;let f=o.attributes,d=c.attributes,A=0,y=0;for(let I in f)A++;for(let I in d){y++;let F=d[I],D=f[I];if(D===void 0)return delete d[I],c._equal=!1,!1;let L=D.isInterleavedBufferAttribute?D.data.uuid:D.id,C=D.isInterleavedBufferAttribute?D.data.version:D.version;if(F.id!==L||F.version!==C)return F.id=L,F.version=C,c._equal=!1,!1}if(y!==A)return c.attributes=this.getAttributesData(f),c._equal=!1,!1;let w=o.index,S=c.indexId,T=c.indexVersion,R=w?w.id:null,P=w?w.version:null;if(S!==R||T!==P)return c.indexId=R,c.indexVersion=P,c._equal=!1,!1;if(c.drawRange.start!==o.drawRange.start||c.drawRange.count!==o.drawRange.count)return c.drawRange.start=o.drawRange.start,c.drawRange.count=o.drawRange.count,c._equal=!1,!1;c._equal=!0}else if(c._equal===!1)return!1;if(a.morphTargetInfluences){let f=!1;for(let d=0;d<a.morphTargetInfluences.length;d++)a.morphTargetInfluences[d]!==r.morphTargetInfluences[d]&&(a.morphTargetInfluences[d]=r.morphTargetInfluences[d],f=!0);if(f)return!1}if(a.lights){for(let f=0;f<t.length;f++)if(a.lights[f].map!==t[f].map)return!1}let u=e.scene;return u.environment!==null&&s.envMap===null&&(a.environmentIntensity!==u.environmentIntensity||a.environmentRotation.equals(u.environmentRotation)===!1)?(a.environmentIntensity=u.environmentIntensity,a.environmentRotation.copy(u.environmentRotation),!1):a.center&&a.center.equals(r.center)===!1?(a.center.copy(r.center),!1):(e.bundle!==null&&(a.version=e.bundle.version),!0)}getLightsData(e,t){t.length=0;for(let n of e)n.isSpotLight===!0&&n.map!==null&&t.push({map:n.map.version});return t}getLights(e,t){let n=Fee.get(e);return n===void 0&&(n={renderId:-1,lightsData:[]},Fee.set(e,n)),n.renderId===t||(n.renderId=t,this.getLightsData(e.getLights(),n.lightsData)),n.lightsData}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e)||this.needsVelocity(t.renderer))return!0;let{renderId:n}=t;if(this.renderId!==n)return this.renderId=n,!0;let r=e.object.static===!0,s=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;if(r||s)return!1;let o=this.getLights(e.lightsNode,n);return this.equals(e,o,n)!==!0}},CTe=[/^StackTrace\.js$/,/^TSLCore\.js$/,/^.*Node\.js$/,/^three\.webgpu.*\.js$/];function RTe(i){let e=/(?:at\s+(.+?)\s+\()?(?:(.+?)@)?([^@\s()]+):(\d+):(\d+)/;return i.split(`4131-`).map(t=>{let n=t.match(e);if(!n)return null;let r=n[1]||n[2]||"",s=n[3].split("?")[0],o=parseInt(n[4],10),a=parseInt(n[5],10),l=s.split("/").pop();return{fn:r,file:l,line:o,column:a}}).filter(t=>t&&!CTe.some(n=>n.test(t.file)))}var ts=class{constructor(e=null){this.isStackTrace=!0,this.stack=RTe(e||new Error().stack)}getLocation(){if(this.stack.length===0)return"[Unknown location]";let e=this.stack[0],t=e.fn;return`${t?`"${t}()" at `:""}"${e.file}:${e.line}"`}getError(e){if(this.stack.length===0)return e;let t=this.stack.map(n=>{let r=`${n.file}:${n.line}:${n.column}`;return n.fn?` at ${n.fn} (${r})`:` at ${r}`}).join(`4117+}`,UF=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new B2(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new ds({vertexShader:Gxe,fragmentShader:qxe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Hn(new YA(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},kF=class extends ca{constructor(e,t){super();let n=this,r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,d=null,A=null,y=null,w=typeof XRWebGLBinding<"u",S=new UF,T={},R=t.getContextAttributes(),I=null,P=null,F=[],D=[],L=new Oe,C=null,B=new Yr;B.viewport=new xn;let k=new Yr;k.viewport=new xn;let z=[B,k],G=new a_,W=null,Y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new r0,F[Ee]=Ve),Ve.getTargetRaySpace()},this.getControllerGrip=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new r0,F[Ee]=Ve),Ve.getGripSpace()},this.getHand=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new r0,F[Ee]=Ve),Ve.getHandSpace()};function H(Ee){let Ve=D.indexOf(Ee.inputSource);if(Ve===-1)return;let Ye=F[Ve];Ye!==void 0&&(Ye.update(Ee.inputSource,Ee.frame,c||o),Ye.dispatchEvent({type:Ee.type,data:Ee.inputSource}))}function $(){r.removeEventListener("select",H),r.removeEventListener("selectstart",H),r.removeEventListener("selectend",H),r.removeEventListener("squeeze",H),r.removeEventListener("squeezestart",H),r.removeEventListener("squeezeend",H),r.removeEventListener("end",$),r.removeEventListener("inputsourceschange",J);for(let Ee=0;Ee<F.length;Ee++){let Ve=D[Ee];Ve!==null&&(D[Ee]=null,F[Ee].disconnect(Ve))}W=null,Y=null,S.reset();for(let Ee in T)delete T[Ee];e.setRenderTarget(I),A=null,d=null,f=null,r=null,P=null,mt.stop(),n.isPresenting=!1,e.setPixelRatio(C),e.setSize(L.width,L.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Ee){s=Ee,n.isPresenting===!0&&Xe("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Ee){a=Ee,n.isPresenting===!0&&Xe("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(Ee){c=Ee},this.getBaseLayer=function(){return d!==null?d:A},this.getBinding=function(){return f===null&&w&&(f=new XRWebGLBinding(r,t)),f},this.getFrame=function(){return y},this.getSession=function(){return r},this.setSession=async function(Ee){if(r=Ee,r!==null){if(I=e.getRenderTarget(),r.addEventListener("select",H),r.addEventListener("selectstart",H),r.addEventListener("selectend",H),r.addEventListener("squeeze",H),r.addEventListener("squeezestart",H),r.addEventListener("squeezeend",H),r.addEventListener("end",$),r.addEventListener("inputsourceschange",J),R.xrCompatible!==!0&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(L),w&&"createProjectionLayer"in XRWebGLBinding.prototype){let Ye=null,Mt=null,Et=null;R.depth&&(Et=R.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Ye=R.stencil?xo:Vs,Mt=R.stencil?ua:xi);let Pt={colorFormat:t.RGBA8,depthFormat:Et,scaleFactor:s};f=this.getBinding(),d=f.createProjectionLayer(Pt),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),P=new Oa(d.textureWidth,d.textureHeight,{format:Or,type:Ji,depthTexture:new Es(d.textureWidth,d.textureHeight,Mt,void 0,void 0,void 0,void 0,void 0,void 0,Ye),stencilBuffer:R.stencil,colorSpace:e.outputColorSpace,samples:R.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{let Ye={antialias:R.antialias,alpha:!0,depth:R.depth,stencil:R.stencil,framebufferScaleFactor:s};A=new XRWebGLLayer(r,t,Ye),r.updateRenderState({baseLayer:A}),e.setPixelRatio(1),e.setSize(A.framebufferWidth,A.framebufferHeight,!1),P=new Oa(A.framebufferWidth,A.framebufferHeight,{format:Or,type:Ji,colorSpace:e.outputColorSpace,stencilBuffer:R.stencil,resolveDepthBuffer:A.ignoreDepthValues===!1,resolveStencilBuffer:A.ignoreDepthValues===!1})}P.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await r.requestReferenceSpace(a),mt.setContext(r),mt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return S.getDepthTexture()};function J(Ee){for(let Ve=0;Ve<Ee.removed.length;Ve++){let Ye=Ee.removed[Ve],Mt=D.indexOf(Ye);Mt>=0&&(D[Mt]=null,F[Mt].disconnect(Ye))}for(let Ve=0;Ve<Ee.added.length;Ve++){let Ye=Ee.added[Ve],Mt=D.indexOf(Ye);if(Mt===-1){for(let Pt=0;Pt<F.length;Pt++)if(Pt>=D.length){D.push(Ye),Mt=Pt;break}else if(D[Pt]===null){D[Pt]=Ye,Mt=Pt;break}if(Mt===-1)break}let Et=F[Mt];Et&&Et.connect(Ye)}}let te=new re,ce=new re;function he(Ee,Ve,Ye){te.setFromMatrixPosition(Ve.matrixWorld),ce.setFromMatrixPosition(Ye.matrixWorld);let Mt=te.distanceTo(ce),Et=Ve.projectionMatrix.elements,Pt=Ye.projectionMatrix.elements,dn=Et[14]/(Et[10]-1),Gt=Et[14]/(Et[10]+1),$e=(Et[9]+1)/Et[5],ot=(Et[9]-1)/Et[5],nt=(Et[8]-1)/Et[0],bt=(Pt[8]+1)/Pt[0],yt=dn*nt,hn=dn*bt,en=Mt/(-nt+bt),tn=en*-nt;if(Ve.matrixWorld.decompose(Ee.position,Ee.quaternion,Ee.scale),Ee.translateX(tn),Ee.translateZ(en),Ee.matrixWorld.compose(Ee.position,Ee.quaternion,Ee.scale),Ee.matrixWorldInverse.copy(Ee.matrixWorld).invert(),Et[10]===-1)Ee.projectionMatrix.copy(Ve.projectionMatrix),Ee.projectionMatrixInverse.copy(Ve.projectionMatrixInverse);else{let bn=dn+en,_e=Gt+en,vi=yt-tn,zn=hn+(Mt-tn),le=$e*Gt/_e*bn,Z=ot*Gt/_e*bn;Ee.projectionMatrix.makePerspective(vi,zn,le,Z,bn,_e),Ee.projectionMatrixInverse.copy(Ee.projectionMatrix).invert()}}function ve(Ee,Ve){Ve===null?Ee.matrixWorld.copy(Ee.matrix):Ee.matrixWorld.multiplyMatrices(Ve.matrixWorld,Ee.matrix),Ee.matrixWorldInverse.copy(Ee.matrixWorld).invert()}this.updateCamera=function(Ee){if(r===null)return;let Ve=Ee.near,Ye=Ee.far;S.texture!==null&&(S.depthNear>0&&(Ve=S.depthNear),S.depthFar>0&&(Ye=S.depthFar)),G.near=k.near=B.near=Ve,G.far=k.far=B.far=Ye,(W!==G.near||Y!==G.far)&&(r.updateRenderState({depthNear:G.near,depthFar:G.far}),W=G.near,Y=G.far),G.layers.mask=Ee.layers.mask|6,B.layers.mask=G.layers.mask&-5,k.layers.mask=G.layers.mask&-3;let Mt=Ee.parent,Et=G.cameras;ve(G,Mt);for(let Pt=0;Pt<Et.length;Pt++)ve(Et[Pt],Mt);Et.length===2?he(G,B,k):G.projectionMatrix.copy(B.projectionMatrix),Re(Ee,G,Mt)};function Re(Ee,Ve,Ye){Ye===null?Ee.matrix.copy(Ve.matrixWorld):(Ee.matrix.copy(Ye.matrixWorld),Ee.matrix.invert(),Ee.matrix.multiply(Ve.matrixWorld)),Ee.matrix.decompose(Ee.position,Ee.quaternion,Ee.scale),Ee.updateMatrixWorld(!0),Ee.projectionMatrix.copy(Ve.projectionMatrix),Ee.projectionMatrixInverse.copy(Ve.projectionMatrixInverse),Ee.isPerspectiveCamera&&(Ee.fov=Cd*2*Math.atan(1/Ee.projectionMatrix.elements[5]),Ee.zoom=1)}this.getCamera=function(){return G},this.getFoveation=function(){if(!(d===null&&A===null))return l},this.setFoveation=function(Ee){l=Ee,d!==null&&(d.fixedFoveation=Ee),A!==null&&A.fixedFoveation!==void 0&&(A.fixedFoveation=Ee)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(G)},this.getCameraTexture=function(Ee){return T[Ee]};let Qe=null;function Fe(Ee,Ve){if(u=Ve.getViewerPose(c||o),y=Ve,u!==null){let Ye=u.views;A!==null&&(e.setRenderTargetFramebuffer(P,A.framebuffer),e.setRenderTarget(P));let Mt=!1;Ye.length!==G.cameras.length&&(G.cameras.length=0,Mt=!0);for(let Gt=0;Gt<Ye.length;Gt++){let $e=Ye[Gt],ot=null;if(A!==null)ot=A.getViewport($e);else{let bt=f.getViewSubImage(d,$e);ot=bt.viewport,Gt===0&&(e.setRenderTargetTextures(P,bt.colorTexture,bt.depthStencilTexture),e.setRenderTarget(P))}let nt=z[Gt];nt===void 0&&(nt=new Yr,nt.layers.enable(Gt),nt.viewport=new xn,z[Gt]=nt),nt.matrix.fromArray($e.transform.matrix),nt.matrix.decompose(nt.position,nt.quaternion,nt.scale),nt.projectionMatrix.fromArray($e.projectionMatrix),nt.projectionMatrixInverse.copy(nt.projectionMatrix).invert(),nt.viewport.set(ot.x,ot.y,ot.width,ot.height),Gt===0&&(G.matrix.copy(nt.matrix),G.matrix.decompose(G.position,G.quaternion,G.scale)),Mt===!0&&G.cameras.push(nt)}let Et=r.enabledFeatures;if(Et&&Et.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&w){f=n.getBinding();let Gt=f.getDepthInformation(Ye[0]);Gt&&Gt.isValid&&Gt.texture&&S.init(Gt,r.renderState)}if(Et&&Et.includes("camera-access")&&w){e.state.unbindTexture(),f=n.getBinding();for(let Gt=0;Gt<Ye.length;Gt++){let $e=Ye[Gt].camera;if($e){let ot=T[$e];ot||(ot=new B2,T[$e]=ot);let nt=f.getCameraImage($e);ot.sourceTexture=nt}}}}for(let Ye=0;Ye<F.length;Ye++){let Mt=D[Ye],Et=F[Ye];Mt!==null&&Et!==void 0&&Et.update(Mt,Ve,c||o)}Qe&&Qe(Ee,Ve),Ve.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Ve}),y=null}let mt=new nK;mt.setAnimationLoop(Fe),this.setAnimationLoop=function(Ee){Qe=Ee},this.dispose=function(){}}},Hxe=new cn,lK=new Mn;lK.set(-1,0,0,0,1,0,0,0,1);function Wxe(i,e){function t(S,T){S.matrixAutoUpdate===!0&&S.updateMatrix(),T.value.copy(S.matrix)}function n(S,T){T.color.getRGB(S.fogColor.value,gF(i)),T.isFog?(S.fogNear.value=T.near,S.fogFar.value=T.far):T.isFogExp2&&(S.fogDensity.value=T.density)}function r(S,T,R,I,P){T.isNodeMaterial?T.uniformsNeedUpdate=!1:T.isMeshBasicMaterial?s(S,T):T.isMeshLambertMaterial?(s(S,T),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)):T.isMeshToonMaterial?(s(S,T),f(S,T)):T.isMeshPhongMaterial?(s(S,T),u(S,T),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)):T.isMeshStandardMaterial?(s(S,T),d(S,T),T.isMeshPhysicalMaterial&&A(S,T,P)):T.isMeshMatcapMaterial?(s(S,T),y(S,T)):T.isMeshDepthMaterial?s(S,T):T.isMeshDistanceMaterial?(s(S,T),w(S,T)):T.isMeshNormalMaterial?s(S,T):T.isLineBasicMaterial?(o(S,T),T.isLineDashedMaterial&&a(S,T)):T.isPointsMaterial?l(S,T,R,I):T.isSpriteMaterial?c(S,T):T.isShadowMaterial?(S.color.value.copy(T.color),S.opacity.value=T.opacity):T.isShaderMaterial&&(T.uniformsNeedUpdate=!1)}function s(S,T){S.opacity.value=T.opacity,T.color&&S.diffuse.value.copy(T.color),T.emissive&&S.emissive.value.copy(T.emissive).multiplyScalar(T.emissiveIntensity),T.map&&(S.map.value=T.map,t(T.map,S.mapTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.bumpMap&&(S.bumpMap.value=T.bumpMap,t(T.bumpMap,S.bumpMapTransform),S.bumpScale.value=T.bumpScale,T.side===mi&&(S.bumpScale.value*=-1)),T.normalMap&&(S.normalMap.value=T.normalMap,t(T.normalMap,S.normalMapTransform),S.normalScale.value.copy(T.normalScale),T.side===mi&&S.normalScale.value.negate()),T.displacementMap&&(S.displacementMap.value=T.displacementMap,t(T.displacementMap,S.displacementMapTransform),S.displacementScale.value=T.displacementScale,S.displacementBias.value=T.displacementBias),T.emissiveMap&&(S.emissiveMap.value=T.emissiveMap,t(T.emissiveMap,S.emissiveMapTransform)),T.specularMap&&(S.specularMap.value=T.specularMap,t(T.specularMap,S.specularMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest);let R=e.get(T),I=R.envMap,P=R.envMapRotation;I&&(S.envMap.value=I,S.envMapRotation.value.setFromMatrix4(Hxe.makeRotationFromEuler(P)).transpose(),I.isCubeTexture&&I.isRenderTargetTexture===!1&&S.envMapRotation.value.premultiply(lK),S.reflectivity.value=T.reflectivity,S.ior.value=T.ior,S.refractionRatio.value=T.refractionRatio),T.lightMap&&(S.lightMap.value=T.lightMap,S.lightMapIntensity.value=T.lightMapIntensity,t(T.lightMap,S.lightMapTransform)),T.aoMap&&(S.aoMap.value=T.aoMap,S.aoMapIntensity.value=T.aoMapIntensity,t(T.aoMap,S.aoMapTransform))}function o(S,T){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,T.map&&(S.map.value=T.map,t(T.map,S.mapTransform))}function a(S,T){S.dashSize.value=T.dashSize,S.totalSize.value=T.dashSize+T.gapSize,S.scale.value=T.scale}function l(S,T,R,I){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,S.size.value=T.size*R,S.scale.value=I*.5,T.map&&(S.map.value=T.map,t(T.map,S.uvTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest)}function c(S,T){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,S.rotation.value=T.rotation,T.map&&(S.map.value=T.map,t(T.map,S.mapTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest)}function u(S,T){S.specular.value.copy(T.specular),S.shininess.value=Math.max(T.shininess,1e-4)}function f(S,T){T.gradientMap&&(S.gradientMap.value=T.gradientMap)}function d(S,T){S.metalness.value=T.metalness,T.metalnessMap&&(S.metalnessMap.value=T.metalnessMap,t(T.metalnessMap,S.metalnessMapTransform)),S.roughness.value=T.roughness,T.roughnessMap&&(S.roughnessMap.value=T.roughnessMap,t(T.roughnessMap,S.roughnessMapTransform)),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)}function A(S,T,R){S.ior.value=T.ior,T.sheen>0&&(S.sheenColor.value.copy(T.sheenColor).multiplyScalar(T.sheen),S.sheenRoughness.value=T.sheenRoughness,T.sheenColorMap&&(S.sheenColorMap.value=T.sheenColorMap,t(T.sheenColorMap,S.sheenColorMapTransform)),T.sheenRoughnessMap&&(S.sheenRoughnessMap.value=T.sheenRoughnessMap,t(T.sheenRoughnessMap,S.sheenRoughnessMapTransform))),T.clearcoat>0&&(S.clearcoat.value=T.clearcoat,S.clearcoatRoughness.value=T.clearcoatRoughness,T.clearcoatMap&&(S.clearcoatMap.value=T.clearcoatMap,t(T.clearcoatMap,S.clearcoatMapTransform)),T.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=T.clearcoatRoughnessMap,t(T.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),T.clearcoatNormalMap&&(S.clearcoatNormalMap.value=T.clearcoatNormalMap,t(T.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(T.clearcoatNormalScale),T.side===mi&&S.clearcoatNormalScale.value.negate())),T.dispersion>0&&(S.dispersion.value=T.dispersion),T.iridescence>0&&(S.iridescence.value=T.iridescence,S.iridescenceIOR.value=T.iridescenceIOR,S.iridescenceThicknessMinimum.value=T.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=T.iridescenceThicknessRange[1],T.iridescenceMap&&(S.iridescenceMap.value=T.iridescenceMap,t(T.iridescenceMap,S.iridescenceMapTransform)),T.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=T.iridescenceThicknessMap,t(T.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),T.transmission>0&&(S.transmission.value=T.transmission,S.transmissionSamplerMap.value=R.texture,S.transmissionSamplerSize.value.set(R.width,R.height),T.transmissionMap&&(S.transmissionMap.value=T.transmissionMap,t(T.transmissionMap,S.transmissionMapTransform)),S.thickness.value=T.thickness,T.thicknessMap&&(S.thicknessMap.value=T.thicknessMap,t(T.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=T.attenuationDistance,S.attenuationColor.value.copy(T.attenuationColor)),T.anisotropy>0&&(S.anisotropyVector.value.set(T.anisotropy*Math.cos(T.anisotropyRotation),T.anisotropy*Math.sin(T.anisotropyRotation)),T.anisotropyMap&&(S.anisotropyMap.value=T.anisotropyMap,t(T.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=T.specularIntensity,S.specularColor.value.copy(T.specularColor),T.specularColorMap&&(S.specularColorMap.value=T.specularColorMap,t(T.specularColorMap,S.specularColorMapTransform)),T.specularIntensityMap&&(S.specularIntensityMap.value=T.specularIntensityMap,t(T.specularIntensityMap,S.specularIntensityMapTransform))}function y(S,T){T.matcap&&(S.matcap.value=T.matcap)}function w(S,T){let R=e.get(T).light;S.referencePosition.value.setFromMatrixPosition(R.matrixWorld),S.nearDistance.value=R.shadow.camera.near,S.farDistance.value=R.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function jxe(i,e,t,n){let r={},s={},o=[],a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(P,F){let D=F.program;n.uniformBlockBinding(P,D)}function c(P,F){let D=r[P.id];D===void 0&&(S(P),D=u(P),r[P.id]=D,P.addEventListener("dispose",R));let L=F.program;n.updateUBOMapping(P,L);let C=e.render.frame;s[P.id]!==C&&(d(P),s[P.id]=C)}function u(P){let F=f();P.__bindingPointIndex=F;let D=i.createBuffer(),L=P.__size,C=P.usage;return i.bindBuffer(i.UNIFORM_BUFFER,D),i.bufferData(i.UNIFORM_BUFFER,L,C),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,F,D),D}function f(){for(let P=0;P<a;P++)if(o.indexOf(P)===-1)return o.push(P),P;return ze("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(P){let F=r[P.id],D=P.uniforms,L=P.__cache;i.bindBuffer(i.UNIFORM_BUFFER,F);for(let C=0,B=D.length;C<B;C++){let k=D[C];if(Array.isArray(k))for(let z=0,G=k.length;z<G;z++)A(k[z],C,z,L);else A(k,C,0,L)}i.bindBuffer(i.UNIFORM_BUFFER,null)}function A(P,F,D,L){if(w(P,F,D,L)===!0){let C=P.__offset,B=P.value;if(Array.isArray(B)){let k=0;for(let z=0;z<B.length;z++){let G=B[z],W=T(G);y(G,P.__data,k),typeof G!="number"&&typeof G!="boolean"&&!G.isMatrix3&&!ArrayBuffer.isView(G)&&(k+=W.storage/Float32Array.BYTES_PER_ELEMENT)}}else y(B,P.__data,0);i.bufferSubData(i.UNIFORM_BUFFER,C,P.__data)}}function y(P,F,D){typeof P=="number"||typeof P=="boolean"?F[0]=P:P.isMatrix3?(F[0]=P.elements[0],F[1]=P.elements[1],F[2]=P.elements[2],F[3]=0,F[4]=P.elements[3],F[5]=P.elements[4],F[6]=P.elements[5],F[7]=0,F[8]=P.elements[6],F[9]=P.elements[7],F[10]=P.elements[8],F[11]=0):ArrayBuffer.isView(P)?F.set(new P.constructor(P.buffer,P.byteOffset,F.length)):P.toArray(F,D)}function w(P,F,D,L){let C=P.value,B=F+"_"+D;if(L[B]===void 0)return typeof C=="number"||typeof C=="boolean"?L[B]=C:ArrayBuffer.isView(C)?L[B]=C.slice():L[B]=C.clone(),!0;{let k=L[B];if(typeof C=="number"||typeof C=="boolean"){if(k!==C)return L[B]=C,!0}else{if(ArrayBuffer.isView(C))return!0;if(k.equals(C)===!1)return k.copy(C),!0}}return!1}function S(P){let F=P.uniforms,D=0,L=16;for(let B=0,k=F.length;B<k;B++){let z=Array.isArray(F[B])?F[B]:[F[B]];for(let G=0,W=z.length;G<W;G++){let Y=z[G],H=Array.isArray(Y.value)?Y.value:[Y.value];for(let $=0,J=H.length;$<J;$++){let te=H[$],ce=T(te),he=D%L,ve=he%ce.boundary,Re=he+ve;D+=ve,Re!==0&&L-Re<ce.storage&&(D+=L-Re),Y.__data=new Float32Array(ce.storage/Float32Array.BYTES_PER_ELEMENT),Y.__offset=D,D+=ce.storage}}}let C=D%L;return C>0&&(D+=L-C),P.__size=D,P.__cache={},this}function T(P){let F={boundary:0,storage:0};return typeof P=="number"||typeof P=="boolean"?(F.boundary=4,F.storage=4):P.isVector2?(F.boundary=8,F.storage=8):P.isVector3||P.isColor?(F.boundary=16,F.storage=12):P.isVector4?(F.boundary=16,F.storage=16):P.isMatrix3?(F.boundary=48,F.storage=48):P.isMatrix4?(F.boundary=64,F.storage=64):P.isTexture?Xe("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(P)?(F.boundary=16,F.storage=P.byteLength):Xe("WebGLRenderer: Unsupported uniform value type.",P),F}function R(P){let F=P.target;F.removeEventListener("dispose",R);let D=o.indexOf(F.__bindingPointIndex);o.splice(D,1),i.deleteBuffer(r[F.id]),delete r[F.id],delete s[F.id]}function I(){for(let P in r)i.deleteBuffer(r[P]);o=[],r={},s={}}return{bind:l,update:c,dispose:I}}var Xxe=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),$h=null;function $xe(){return $h===null&&($h=new HA(Xxe,16,16,Ws,Wi),$h.name="DFG_LUT",$h.minFilter=Mi,$h.magFilter=Mi,$h.wrapS=la,$h.wrapT=la,$h.generateMipmaps=!1,$h.needsUpdate=!0),$h}var WM=class{constructor(e={}){let{canvas:t=zM(),context:n=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1,reversedDepthBuffer:d=!1,outputBufferType:A=Ji}=e;this.isWebGLRenderer=!0;let y;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");y=n.getContextAttributes().alpha}else y=o;let w=A,S=new Set([g0,zh,kh]),T=new Set([Ji,xi,wl,ua,ng,ig]),R=new Uint32Array(4),I=new Int32Array(4),P=new re,F=null,D=null,L=[],C=[],B=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=ao,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let k=this,z=!1,G=null,W=null,Y=null,H=null;this._outputColorSpace=Fr;let $=0,J=0,te=null,ce=-1,he=null,ve=new xn,Re=new xn,Qe=null,Fe=new zt(0),mt=0,Ee=t.width,Ve=t.height,Ye=1,Mt=null,Et=null,Pt=new xn(0,0,Ee,Ve),dn=new xn(0,0,Ee,Ve),Gt=!1,$e=new zc,ot=!1,nt=!1,bt=new cn,yt=new re,hn=new xn,en={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},tn=!1;function bn(){return te===null?Ye:1}let _e=n;function vi(ne,Se){return t.getContext(ne,Se)}try{let ne={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${"185"}`),t.addEventListener("webglcontextlost",nr,!1),t.addEventListener("webglcontextrestored",Fn,!1),t.addEventListener("webglcontextcreationerror",rs,!1),_e===null){let Se="webgl2";if(_e=vi(Se,ne),_e===null)throw vi(Se)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(ne){throw ze("WebGLRenderer: "+ne.message),ne}let zn,le,Z,Te,Ie,Ge,vt,Tt,qe,Je,It,rn,Lt,Rt,fn,wn,Dn,ye,wt,Ze,St,Bt,ut;function Ce(){zn=new t_e(_e),zn.init(),St=new Vxe(_e,zn),le=new Xve(_e,zn,e,St),Z=new kxe(_e,zn),le.reversedDepthBuffer&&d&&Z.buffers.depth.setReversed(!0),W=_e.createFramebuffer(),Y=_e.createFramebuffer(),H=_e.createFramebuffer(),Te=new r_e(_e),Ie=new Txe,Ge=new zxe(_e,zn,Z,Ie,le,St,Te),vt=new e_e(k),Tt=new lge(_e),Bt=new Wve(_e,Tt),qe=new n_e(_e,Tt,Te,Bt),Je=new o_e(_e,qe,Tt,Bt,Te),ye=new s_e(_e,le,Ge),fn=new $ve(Ie),It=new Sxe(k,vt,zn,le,Bt,fn),rn=new Wxe(k,Ie),Lt=new Mxe,Rt=new Dxe(zn),Dn=new Hve(k,vt,Z,Je,y,l),wn=new Uxe(k,Je,le),ut=new jxe(_e,Te,le,Z),wt=new jve(_e,zn,Te),Ze=new i_e(_e,zn,Te),Te.programs=It.programs,k.capabilities=le,k.extensions=zn,k.properties=Ie,k.renderLists=Lt,k.shadowMap=wn,k.state=Z,k.info=Te}Ce(),w!==Ji&&(B=new l_e(w,t.width,t.height,a,r,s));let Yt=new kF(k,_e);this.xr=Yt,this.getContext=function(){return _e},this.getContextAttributes=function(){return _e.getContextAttributes()},this.forceContextLoss=function(){let ne=zn.get("WEBGL_lose_context");ne&&ne.loseContext()},this.forceContextRestore=function(){let ne=zn.get("WEBGL_lose_context");ne&&ne.restoreContext()},this.getPixelRatio=function(){return Ye},this.setPixelRatio=function(ne){ne!==void 0&&(Ye=ne,this.setSize(Ee,Ve,!1))},this.getSize=function(ne){return ne.set(Ee,Ve)},this.setSize=function(ne,Se,ke=!0){if(Yt.isPresenting){Xe("WebGLRenderer: Can't change size while VR device is presenting.");return}Ee=ne,Ve=Se,t.width=Math.floor(ne*Ye),t.height=Math.floor(Se*Ye),ke===!0&&(t.style.width=ne+"px",t.style.height=Se+"px"),B!==null&&B.setSize(t.width,t.height),this.setViewport(0,0,ne,Se)},this.getDrawingBufferSize=function(ne){return ne.set(Ee*Ye,Ve*Ye).floor()},this.setDrawingBufferSize=function(ne,Se,ke){Ee=ne,Ve=Se,Ye=ke,t.width=Math.floor(ne*ke),t.height=Math.floor(Se*ke),this.setViewport(0,0,ne,Se)},this.setEffects=function(ne){if(w===Ji){ze("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(ne){for(let Se=0;Se<ne.length;Se++)if(ne[Se].isOutputPass===!0){Xe("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}B.setEffects(ne||[])},this.getCurrentViewport=function(ne){return ne.copy(ve)},this.getViewport=function(ne){return ne.copy(Pt)},this.setViewport=function(ne,Se,ke,De){ne.isVector4?Pt.set(ne.x,ne.y,ne.z,ne.w):Pt.set(ne,Se,ke,De),Z.viewport(ve.copy(Pt).multiplyScalar(Ye).round())},this.getScissor=function(ne){return ne.copy(dn)},this.setScissor=function(ne,Se,ke,De){ne.isVector4?dn.set(ne.x,ne.y,ne.z,ne.w):dn.set(ne,Se,ke,De),Z.scissor(Re.copy(dn).multiplyScalar(Ye).round())},this.getScissorTest=function(){return Gt},this.setScissorTest=function(ne){Z.setScissorTest(Gt=ne)},this.setOpaqueSort=function(ne){Mt=ne},this.setTransparentSort=function(ne){Et=ne},this.getClearColor=function(ne){return ne.copy(Dn.getClearColor())},this.setClearColor=function(){Dn.setClearColor(...arguments)},this.getClearAlpha=function(){return Dn.getClearAlpha()},this.setClearAlpha=function(){Dn.setClearAlpha(...arguments)},this.clear=function(ne=!0,Se=!0,ke=!0){let De=0;if(ne){let Ne=!1;if(te!==null){let qt=te.texture.format;Ne=S.has(qt)}if(Ne){let qt=te.texture.type,Qt=T.has(qt),Vt=Dn.getClearColor(),sn=Dn.getClearAlpha(),pn=Vt.r,Wn=Vt.g,Jn=Vt.b;Qt?(R[0]=pn,R[1]=Wn,R[2]=Jn,R[3]=sn,_e.clearBufferuiv(_e.COLOR,0,R)):(I[0]=pn,I[1]=Wn,I[2]=Jn,I[3]=sn,_e.clearBufferiv(_e.COLOR,0,I))}else De|=_e.COLOR_BUFFER_BIT}Se&&(De|=_e.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),ke&&(De|=_e.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),De!==0&&_e.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.setNodesHandler=function(ne){ne.setRenderer(this),G=ne},this.dispose=function(){t.removeEventListener("webglcontextlost",nr,!1),t.removeEventListener("webglcontextrestored",Fn,!1),t.removeEventListener("webglcontextcreationerror",rs,!1),Dn.dispose(),Lt.dispose(),Rt.dispose(),Ie.dispose(),vt.dispose(),Je.dispose(),Bt.dispose(),ut.dispose(),It.dispose(),Yt.dispose(),Yt.removeEventListener("sessionstart",Zs),Yt.removeEventListener("sessionend",Ol),nh.stop()};function nr(ne){ne.preventDefault(),kA("WebGLRenderer: Context Lost."),z=!0}function Fn(){kA("WebGLRenderer: Context Restored."),z=!1;let ne=Te.autoReset,Se=wn.enabled,ke=wn.autoUpdate,De=wn.needsUpdate,Ne=wn.type;Ce(),Te.autoReset=ne,wn.enabled=Se,wn.autoUpdate=ke,wn.needsUpdate=De,wn.type=Ne}function rs(ne){ze("WebGLRenderer: A WebGL context could not be created. Reason: ",ne.statusMessage)}function Lr(ne){let Se=ne.target;Se.removeEventListener("dispose",Lr),Fl(Se)}function Fl(ne){Sa(ne),Ie.remove(ne)}function Sa(ne){let Se=Ie.get(ne).programs;Se!==void 0&&(Se.forEach(function(ke){It.releaseProgram(ke)}),ne.isShaderMaterial&&It.releaseShaderCache(ne))}this.renderBufferDirect=function(ne,Se,ke,De,Ne,qt){Se===null&&(Se=en);let Qt=Ne.isMesh&&Ne.matrixWorld.determinantAffine()<0,Vt=GG(ne,Se,ke,De,Ne);Z.setMaterial(De,Qt);let sn=ke.index,pn=1;if(De.wireframe===!0){if(sn=qe.getWireframeAttribute(ke),sn===void 0)return;pn=2}let Wn=ke.drawRange,Jn=ke.attributes.position,gn=Wn.start*pn,Yi=(Wn.start+Wn.count)*pn;qt!==null&&(gn=Math.max(gn,qt.start*pn),Yi=Math.min(Yi,(qt.start+qt.count)*pn)),sn!==null?(gn=Math.max(gn,0),Yi=Math.min(Yi,sn.count)):Jn!=null&&(gn=Math.max(gn,0),Yi=Math.min(Yi,Jn.count));let ss=Yi-gn;if(ss<0||ss===1/0)return;Bt.setup(Ne,De,Vt,ke,sn);let qr,ir=wt;if(sn!==null&&(qr=Tt.get(sn),ir=Ze,ir.setIndex(qr)),Ne.isMesh)De.wireframe===!0?(Z.setLineWidth(De.wireframeLinewidth*bn()),ir.setMode(_e.LINES)):ir.setMode(_e.TRIANGLES);else if(Ne.isLine){let Co=De.linewidth;Co===void 0&&(Co=1),Z.setLineWidth(Co*bn()),Ne.isLineSegments?ir.setMode(_e.LINES):Ne.isLineLoop?ir.setMode(_e.LINE_LOOP):ir.setMode(_e.LINE_STRIP)}else Ne.isPoints?ir.setMode(_e.POINTS):Ne.isSprite&&ir.setMode(_e.TRIANGLES);if(Ne.isBatchedMesh)if(zn.get("WEBGL_multi_draw"))ir.renderMultiDraw(Ne._multiDrawStarts,Ne._multiDrawCounts,Ne._multiDrawCount);else{let Co=Ne._multiDrawStarts,Zt=Ne._multiDrawCounts,sl=Ne._multiDrawCount,yi=sn?Tt.get(sn).bytesPerElement:1,Ul=Ie.get(De).currentProgram.getUniforms();for(let lu=0;lu<sl;lu++)Ul.setValue(_e,"_gl_DrawID",lu),ir.render(Co[lu]/yi,Zt[lu])}else if(Ne.isInstancedMesh)ir.renderInstances(gn,ss,Ne.count);else if(ke.isInstancedBufferGeometry){let Co=ke._maxInstanceCount!==void 0?ke._maxInstanceCount:1/0,Zt=Math.min(ke.instanceCount,Co);ir.renderInstances(gn,ss,Zt)}else ir.render(gn,ss)};function Bl(ne,Se,ke){ne.transparent===!0&&ne.side===vr&&ne.forceSinglePass===!1?(ne.side=mi,ne.needsUpdate=!0,Gx(ne,Se,ke),ne.side=zo,ne.needsUpdate=!0,Gx(ne,Se,ke),ne.side=vr):Gx(ne,Se,ke)}this.compile=function(ne,Se,ke=null){ke===null&&(ke=ne),D=Rt.get(ke),D.init(Se),C.push(D),ke.traverseVisible(function(Ne){Ne.isLight&&Ne.layers.test(Se.layers)&&(D.pushLight(Ne),Ne.castShadow&&D.pushShadow(Ne))}),ne!==ke&&ne.traverseVisible(function(Ne){Ne.isLight&&Ne.layers.test(Se.layers)&&(D.pushLight(Ne),Ne.castShadow&&D.pushShadow(Ne))}),D.setupLights();let De=new Set;return ne.traverse(function(Ne){if(!(Ne.isMesh||Ne.isPoints||Ne.isLine||Ne.isSprite))return;let qt=Ne.material;if(qt)if(Array.isArray(qt))for(let Qt=0;Qt<qt.length;Qt++){let Vt=qt[Qt];Bl(Vt,ke,Ne),De.add(Vt)}else Bl(qt,ke,Ne),De.add(qt)}),D=C.pop(),De},this.compileAsync=function(ne,Se,ke=null){let De=this.compile(ne,Se,ke);return new Promise(Ne=>{function qt(){if(De.forEach(function(Qt){Ie.get(Qt).currentProgram.isReady()&&De.delete(Qt)}),De.size===0){Ne(ne);return}setTimeout(qt,10)}zn.get("KHR_parallel_shader_compile")!==null?qt():setTimeout(qt,10)})};let rl=null;function xr(ne){rl&&rl(ne)}function Zs(){nh.stop()}function Ol(){nh.start()}let nh=new nK;nh.setAnimationLoop(xr),typeof self<"u"&&nh.setContext(self),this.setAnimationLoop=function(ne){rl=ne,Yt.setAnimationLoop(ne),ne===null?nh.stop():nh.start()},Yt.addEventListener("sessionstart",Zs),Yt.addEventListener("sessionend",Ol),this.render=function(ne,Se){if(Se!==void 0&&Se.isCamera!==!0){ze("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;G!==null&&G.renderStart(ne,Se);let ke=Yt.enabled===!0&&Yt.isPresenting===!0,De=B!==null&&(te===null||ke)&&B.begin(k,te);if(ne.matrixWorldAutoUpdate===!0&&ne.updateMatrixWorld(),Se.parent===null&&Se.matrixWorldAutoUpdate===!0&&Se.updateMatrixWorld(),Yt.enabled===!0&&Yt.isPresenting===!0&&(B===null||B.isCompositing()===!1)&&(Yt.cameraAutoUpdate===!0&&Yt.updateCamera(Se),Se=Yt.getCamera()),ne.isScene===!0&&ne.onBeforeRender(k,ne,Se,te),D=Rt.get(ne,C.length),D.init(Se),D.state.textureUnits=Ge.getTextureUnits(),C.push(D),bt.multiplyMatrices(Se.projectionMatrix,Se.matrixWorldInverse),$e.setFromProjectionMatrix(bt,ko,Se.reversedDepth),nt=this.localClippingEnabled,ot=fn.init(this.clippingPlanes,nt),F=Lt.get(ne,L.length),F.init(),L.push(F),Yt.enabled===!0&&Yt.isPresenting===!0){let Qt=k.xr.getDepthSensingMesh();Qt!==null&&tT(Qt,Se,-1/0,k.sortObjects)}tT(ne,Se,0,k.sortObjects),F.finish(),k.sortObjects===!0&&F.sort(Mt,Et,Se.reversedDepth),tn=Yt.enabled===!1||Yt.isPresenting===!1||Yt.hasDepthSensing()===!1,tn&&Dn.addToRenderList(F,ne),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),ot===!0&&fn.beginShadows();let Ne=D.state.shadowsArray;if(wn.render(Ne,ne,Se),ot===!0&&fn.endShadows(),(De&&B.hasRenderPass())===!1){let Qt=F.opaque,Vt=F.transmissive;if(D.setupLights(),Se.isArrayCamera){let sn=Se.cameras;if(Vt.length>0)for(let pn=0,Wn=sn.length;pn<Wn;pn++){let Jn=sn[pn];$I(Qt,Vt,ne,Jn)}tn&&Dn.render(ne);for(let pn=0,Wn=sn.length;pn<Wn;pn++){let Jn=sn[pn];XI(F,ne,Jn,Jn.viewport)}}else Vt.length>0&&$I(Qt,Vt,ne,Se),tn&&Dn.render(ne),XI(F,ne,Se)}te!==null&&J===0&&(Ge.updateMultisampleRenderTarget(te),Ge.updateRenderTargetMipmap(te)),De&&B.end(k),ne.isScene===!0&&ne.onAfterRender(k,ne,Se),Bt.resetDefaultState(),ce=-1,he=null,C.pop(),C.length>0?(D=C[C.length-1],Ge.setTextureUnits(D.state.textureUnits),ot===!0&&fn.setGlobalState(k.clippingPlanes,D.state.camera)):D=null,L.pop(),L.length>0?F=L[L.length-1]:F=null,G!==null&&G.renderEnd()};function tT(ne,Se,ke,De){if(ne.visible===!1)return;if(ne.layers.test(Se.layers)){if(ne.isGroup)ke=ne.renderOrder;else if(ne.isLOD)ne.autoUpdate===!0&&ne.update(Se);else if(ne.isLightProbeGrid)D.pushLightProbeGrid(ne);else if(ne.isLight)D.pushLight(ne),ne.castShadow&&D.pushShadow(ne);else if(ne.isSprite){if(!ne.frustumCulled||$e.intersectsSprite(ne)){De&&hn.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(bt);let Qt=Je.update(ne),Vt=ne.material;Vt.visible&&F.push(ne,Qt,Vt,ke,hn.z,null)}}else if((ne.isMesh||ne.isLine||ne.isPoints)&&(!ne.frustumCulled||$e.intersectsObject(ne))){let Qt=Je.update(ne),Vt=ne.material;if(De&&(ne.boundingSphere!==void 0?(ne.boundingSphere===null&&ne.computeBoundingSphere(),hn.copy(ne.boundingSphere.center)):(Qt.boundingSphere===null&&Qt.computeBoundingSphere(),hn.copy(Qt.boundingSphere.center)),hn.applyMatrix4(ne.matrixWorld).applyMatrix4(bt)),Array.isArray(Vt)){let sn=Qt.groups;for(let pn=0,Wn=sn.length;pn<Wn;pn++){let Jn=sn[pn],gn=Vt[Jn.materialIndex];gn&&gn.visible&&F.push(ne,Qt,gn,ke,hn.z,Jn)}}else Vt.visible&&F.push(ne,Qt,Vt,ke,hn.z,null)}}let qt=ne.children;for(let Qt=0,Vt=qt.length;Qt<Vt;Qt++)tT(qt[Qt],Se,ke,De)}function XI(ne,Se,ke,De){let{opaque:Ne,transmissive:qt,transparent:Qt}=ne;D.setupLightsView(ke),ot===!0&&fn.setGlobalState(k.clippingPlanes,ke),De&&Z.viewport(ve.copy(De)),Ne.length>0&&Vx(Ne,Se,ke),qt.length>0&&Vx(qt,Se,ke),Qt.length>0&&Vx(Qt,Se,ke),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function $I(ne,Se,ke,De){if((ke.isScene===!0?ke.overrideMaterial:null)!==null)return;if(D.state.transmissionRenderTarget[De.id]===void 0){let gn=zn.has("EXT_color_buffer_half_float")||zn.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[De.id]=new Oa(1,1,{generateMipmaps:!0,type:gn?Wi:Ji,minFilter:Go,samples:Math.max(4,le.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ln.workingColorSpace})}let qt=D.state.transmissionRenderTarget[De.id],Qt=De.viewport||ve;qt.setSize(Qt.z*k.transmissionResolutionScale,Qt.w*k.transmissionResolutionScale);let Vt=k.getRenderTarget(),sn=k.getActiveCubeFace(),pn=k.getActiveMipmapLevel();k.setRenderTarget(qt),k.getClearColor(Fe),mt=k.getClearAlpha(),mt<1&&k.setClearColor(16777215,.5),k.clear(),tn&&Dn.render(ke);let Wn=k.toneMapping;k.toneMapping=ao;let Jn=De.viewport;if(De.viewport!==void 0&&(De.viewport=void 0),D.setupLightsView(De),ot===!0&&fn.setGlobalState(k.clippingPlanes,De),Vx(ne,ke,De),Ge.updateMultisampleRenderTarget(qt),Ge.updateRenderTargetMipmap(qt),zn.has("WEBGL_multisampled_render_to_texture")===!1){let gn=!1;for(let Yi=0,ss=Se.length;Yi<ss;Yi++){let qr=Se[Yi],{object:ir,geometry:Co,material:Zt,group:sl}=qr;if(Zt.side===vr&&ir.layers.test(De.layers)){let yi=Zt.side;Zt.side=mi,Zt.needsUpdate=!0,YI(ir,ke,De,Co,Zt,sl),Zt.side=yi,Zt.needsUpdate=!0,gn=!0}}gn===!0&&(Ge.updateMultisampleRenderTarget(qt),Ge.updateRenderTargetMipmap(qt))}k.setRenderTarget(Vt,sn,pn),k.setClearColor(Fe,mt),Jn!==void 0&&(De.viewport=Jn),k.toneMapping=Wn}function Vx(ne,Se,ke){let De=Se.isScene===!0?Se.overrideMaterial:null;for(let Ne=0,qt=ne.length;Ne<qt;Ne++){let Qt=ne[Ne],{object:Vt,geometry:sn,group:pn}=Qt,Wn=Qt.material;Wn.allowOverride===!0&&De!==null&&(Wn=De),Vt.layers.test(ke.layers)&&YI(Vt,Se,ke,sn,Wn,pn)}}function YI(ne,Se,ke,De,Ne,qt){ne.onBeforeRender(k,Se,ke,De,Ne,qt),ne.modelViewMatrix.multiplyMatrices(ke.matrixWorldInverse,ne.matrixWorld),ne.normalMatrix.getNormalMatrix(ne.modelViewMatrix),Ne.onBeforeRender(k,Se,ke,De,ne,qt),Ne.transparent===!0&&Ne.side===vr&&Ne.forceSinglePass===!1?(Ne.side=mi,Ne.needsUpdate=!0,k.renderBufferDirect(ke,Se,De,Ne,ne,qt),Ne.side=zo,Ne.needsUpdate=!0,k.renderBufferDirect(ke,Se,De,Ne,ne,qt),Ne.side=vr):k.renderBufferDirect(ke,Se,De,Ne,ne,qt),ne.onAfterRender(k,Se,ke,De,Ne,qt)}function Gx(ne,Se,ke){Se.isScene!==!0&&(Se=en);let De=Ie.get(ne),Ne=D.state.lights,qt=D.state.shadowsArray,Qt=Ne.state.version,Vt=It.getParameters(ne,Ne.state,qt,Se,ke,D.state.lightProbeGridArray),sn=It.getProgramCacheKey(Vt),pn=De.programs;De.environment=ne.isMeshStandardMaterial||ne.isMeshLambertMaterial||ne.isMeshPhongMaterial?Se.environment:null,De.fog=Se.fog;let Wn=ne.isMeshStandardMaterial||ne.isMeshLambertMaterial&&!ne.envMap||ne.isMeshPhongMaterial&&!ne.envMap;De.envMap=vt.get(ne.envMap||De.environment,Wn),De.envMapRotation=De.environment!==null&&ne.envMap===null?Se.environmentRotation:ne.envMapRotation,pn===void 0&&(ne.addEventListener("dispose",Lr),pn=new Map,De.programs=pn);let Jn=pn.get(sn);if(Jn!==void 0){if(De.currentProgram===Jn&&De.lightsStateVersion===Qt)return KI(ne,Vt),Jn}else Vt.uniforms=It.getUniforms(ne),G!==null&&ne.isNodeMaterial&&G.build(ne,ke,Vt),ne.onBeforeCompile(Vt,k),Jn=It.acquireProgram(Vt,sn),pn.set(sn,Jn),De.uniforms=Vt.uniforms;let gn=De.uniforms;return(!ne.isShaderMaterial&&!ne.isRawShaderMaterial||ne.clipping===!0)&&(gn.clippingPlanes=fn.uniform),KI(ne,Vt),De.needsLights=HG(ne),De.lightsStateVersion=Qt,De.needsLights&&(gn.ambientLightColor.value=Ne.state.ambient,gn.lightProbe.value=Ne.state.probe,gn.directionalLights.value=Ne.state.directional,gn.directionalLightShadows.value=Ne.state.directionalShadow,gn.spotLights.value=Ne.state.spot,gn.spotLightShadows.value=Ne.state.spotShadow,gn.rectAreaLights.value=Ne.state.rectArea,gn.ltc_1.value=Ne.state.rectAreaLTC1,gn.ltc_2.value=Ne.state.rectAreaLTC2,gn.pointLights.value=Ne.state.point,gn.pointLightShadows.value=Ne.state.pointShadow,gn.hemisphereLights.value=Ne.state.hemi,gn.directionalShadowMatrix.value=Ne.state.directionalShadowMatrix,gn.spotLightMatrix.value=Ne.state.spotLightMatrix,gn.spotLightMap.value=Ne.state.spotLightMap,gn.pointShadowMatrix.value=Ne.state.pointShadowMatrix),De.lightProbeGrid=D.state.lightProbeGridArray.length>0,De.currentProgram=Jn,De.uniformsList=null,Jn}function ZI(ne){if(ne.uniformsList===null){let Se=ne.currentProgram.getUniforms();ne.uniformsList=p_.seqWithValue(Se.seq,ne.uniforms)}return ne.uniformsList}function KI(ne,Se){let ke=Ie.get(ne);ke.outputColorSpace=Se.outputColorSpace,ke.batching=Se.batching,ke.batchingColor=Se.batchingColor,ke.instancing=Se.instancing,ke.instancingColor=Se.instancingColor,ke.instancingMorph=Se.instancingMorph,ke.skinning=Se.skinning,ke.morphTargets=Se.morphTargets,ke.morphNormals=Se.morphNormals,ke.morphColors=Se.morphColors,ke.morphTargetsCount=Se.morphTargetsCount,ke.numClippingPlanes=Se.numClippingPlanes,ke.numIntersection=Se.numClipIntersection,ke.vertexAlphas=Se.vertexAlphas,ke.vertexTangents=Se.vertexTangents,ke.toneMapping=Se.toneMapping}function VG(ne,Se){if(ne.length===0)return null;if(ne.length===1)return ne[0].texture!==null?ne[0]:null;P.setFromMatrixPosition(Se.matrixWorld);for(let ke=0,De=ne.length;ke<De;ke++){let Ne=ne[ke];if(Ne.texture!==null&&Ne.boundingBox.containsPoint(P))return Ne}return null}function GG(ne,Se,ke,De,Ne){Se.isScene!==!0&&(Se=en),Ge.resetTextureUnits();let qt=Se.fog,Qt=De.isMeshStandardMaterial||De.isMeshLambertMaterial||De.isMeshPhongMaterial?Se.environment:null,Vt=te===null?k.outputColorSpace:te.isXRRenderTarget===!0?te.texture.colorSpace:ln.workingColorSpace,sn=De.isMeshStandardMaterial||De.isMeshLambertMaterial&&!De.envMap||De.isMeshPhongMaterial&&!De.envMap,pn=vt.get(De.envMap||Qt,sn),Wn=De.vertexColors===!0&&!!ke.attributes.color&&ke.attributes.color.itemSize===4,Jn=!!ke.attributes.tangent&&(!!De.normalMap||De.anisotropy>0),gn=!!ke.morphAttributes.position,Yi=!!ke.morphAttributes.normal,ss=!!ke.morphAttributes.color,qr=ao;De.toneMapped&&(te===null||te.isXRRenderTarget===!0)&&(qr=k.toneMapping);let ir=ke.morphAttributes.position||ke.morphAttributes.normal||ke.morphAttributes.color,Co=ir!==void 0?ir.length:0,Zt=Ie.get(De),sl=D.state.lights;if(ot===!0&&(nt===!0||ne!==he)){let pr=ne===he&&De.id===ce;fn.setState(De,ne,pr)}let yi=!1;De.version===Zt.__version?(Zt.needsLights&&Zt.lightsStateVersion!==sl.state.version||Zt.outputColorSpace!==Vt||Ne.isBatchedMesh&&Zt.batching===!1||!Ne.isBatchedMesh&&Zt.batching===!0||Ne.isBatchedMesh&&Zt.batchingColor===!0&&Ne.colorTexture===null||Ne.isBatchedMesh&&Zt.batchingColor===!1&&Ne.colorTexture!==null||Ne.isInstancedMesh&&Zt.instancing===!1||!Ne.isInstancedMesh&&Zt.instancing===!0||Ne.isSkinnedMesh&&Zt.skinning===!1||!Ne.isSkinnedMesh&&Zt.skinning===!0||Ne.isInstancedMesh&&Zt.instancingColor===!0&&Ne.instanceColor===null||Ne.isInstancedMesh&&Zt.instancingColor===!1&&Ne.instanceColor!==null||Ne.isInstancedMesh&&Zt.instancingMorph===!0&&Ne.morphTexture===null||Ne.isInstancedMesh&&Zt.instancingMorph===!1&&Ne.morphTexture!==null||Zt.envMap!==pn||De.fog===!0&&Zt.fog!==qt||Zt.numClippingPlanes!==void 0&&(Zt.numClippingPlanes!==fn.numPlanes||Zt.numIntersection!==fn.numIntersection)||Zt.vertexAlphas!==Wn||Zt.vertexTangents!==Jn||Zt.morphTargets!==gn||Zt.morphNormals!==Yi||Zt.morphColors!==ss||Zt.toneMapping!==qr||Zt.morphTargetsCount!==Co||!!Zt.lightProbeGrid!=D.state.lightProbeGridArray.length>0)&&(yi=!0):(yi=!0,Zt.__version=De.version);let Ul=Zt.currentProgram;yi===!0&&(Ul=Gx(De,Se,Ne),G&&De.isNodeMaterial&&G.onUpdateProgram(De,Ul,Zt));let lu=!1,kf=!1,Bm=!1,rr=Ul.getUniforms(),os=Zt.uniforms;if(Z.useProgram(Ul.program)&&(lu=!0,kf=!0,Bm=!0),De.id!==ce&&(ce=De.id,kf=!0),Zt.needsLights){let pr=VG(D.state.lightProbeGridArray,Ne);Zt.lightProbeGrid!==pr&&(Zt.lightProbeGrid=pr,kf=!0)}if(lu||he!==ne){Z.buffers.depth.getReversed()&&ne.reversedDepth!==!0&&(ne._reversedDepth=!0,ne.updateProjectionMatrix()),rr.setValue(_e,"projectionMatrix",ne.projectionMatrix),rr.setValue(_e,"viewMatrix",ne.matrixWorldInverse);let Vf=rr.map.cameraPosition;Vf!==void 0&&Vf.setValue(_e,yt.setFromMatrixPosition(ne.matrixWorld)),le.logarithmicDepthBuffer&&rr.setValue(_e,"logDepthBufFC",2/(Math.log(ne.far+1)/Math.LN2)),(De.isMeshPhongMaterial||De.isMeshToonMaterial||De.isMeshLambertMaterial||De.isMeshBasicMaterial||De.isMeshStandardMaterial||De.isShaderMaterial)&&rr.setValue(_e,"isOrthographic",ne.isOrthographicCamera===!0),he!==ne&&(he=ne,kf=!0,Bm=!0)}if(Zt.needsLights&&(sl.state.directionalShadowMap.length>0&&rr.setValue(_e,"directionalShadowMap",sl.state.directionalShadowMap,Ge),sl.state.spotShadowMap.length>0&&rr.setValue(_e,"spotShadowMap",sl.state.spotShadowMap,Ge),sl.state.pointShadowMap.length>0&&rr.setValue(_e,"pointShadowMap",sl.state.pointShadowMap,Ge)),Ne.isSkinnedMesh){rr.setOptional(_e,Ne,"bindMatrix"),rr.setOptional(_e,Ne,"bindMatrixInverse");let pr=Ne.skeleton;pr&&(pr.boneTexture===null&&pr.computeBoneTexture(),rr.setValue(_e,"boneTexture",pr.boneTexture,Ge))}Ne.isBatchedMesh&&(rr.setOptional(_e,Ne,"batchingTexture"),rr.setValue(_e,"batchingTexture",Ne._matricesTexture,Ge),rr.setOptional(_e,Ne,"batchingIdTexture"),rr.setValue(_e,"batchingIdTexture",Ne._indirectTexture,Ge),rr.setOptional(_e,Ne,"batchingColorTexture"),Ne._colorsTexture!==null&&rr.setValue(_e,"batchingColorTexture",Ne._colorsTexture,Ge));let zf=ke.morphAttributes;if((zf.position!==void 0||zf.normal!==void 0||zf.color!==void 0)&&ye.update(Ne,ke,Ul),(kf||Zt.receiveShadow!==Ne.receiveShadow)&&(Zt.receiveShadow=Ne.receiveShadow,rr.setValue(_e,"receiveShadow",Ne.receiveShadow)),(De.isMeshStandardMaterial||De.isMeshLambertMaterial||De.isMeshPhongMaterial)&&De.envMap===null&&Se.environment!==null&&(os.envMapIntensity.value=Se.environmentIntensity),os.dfgLUT!==void 0&&(os.dfgLUT.value=$xe()),kf){if(rr.setValue(_e,"toneMappingExposure",k.toneMappingExposure),Zt.needsLights&&qG(os,Bm),qt&&De.fog===!0&&rn.refreshFogUniforms(os,qt),rn.refreshMaterialUniforms(os,De,Ye,Ve,D.state.transmissionRenderTarget[ne.id]),Zt.needsLights&&Zt.lightProbeGrid){let pr=Zt.lightProbeGrid;os.probesSH.value=pr.texture,os.probesMin.value.copy(pr.boundingBox.min),os.probesMax.value.copy(pr.boundingBox.max),os.probesResolution.value.copy(pr.resolution)}p_.upload(_e,ZI(Zt),os,Ge)}if(De.isShaderMaterial&&De.uniformsNeedUpdate===!0&&(p_.upload(_e,ZI(Zt),os,Ge),De.uniformsNeedUpdate=!1),De.isSpriteMaterial&&rr.setValue(_e,"center",Ne.center),rr.setValue(_e,"modelViewMatrix",Ne.modelViewMatrix),rr.setValue(_e,"normalMatrix",Ne.normalMatrix),rr.setValue(_e,"modelMatrix",Ne.matrixWorld),De.uniformsGroups!==void 0){let pr=De.uniformsGroups;for(let Vf=0,Om=pr.length;Vf<Om;Vf++){let QI=pr[Vf];ut.update(QI,Ul),ut.bind(QI,Ul)}}return Ul}function qG(ne,Se){ne.ambientLightColor.needsUpdate=Se,ne.lightProbe.needsUpdate=Se,ne.directionalLights.needsUpdate=Se,ne.directionalLightShadows.needsUpdate=Se,ne.pointLights.needsUpdate=Se,ne.pointLightShadows.needsUpdate=Se,ne.spotLights.needsUpdate=Se,ne.spotLightShadows.needsUpdate=Se,ne.rectAreaLights.needsUpdate=Se,ne.hemisphereLights.needsUpdate=Se}function HG(ne){return ne.isMeshLambertMaterial||ne.isMeshToonMaterial||ne.isMeshPhongMaterial||ne.isMeshStandardMaterial||ne.isShadowMaterial||ne.isShaderMaterial&&ne.lights===!0}this.getActiveCubeFace=function(){return $},this.getActiveMipmapLevel=function(){return J},this.getRenderTarget=function(){return te},this.setRenderTargetTextures=function(ne,Se,ke){let De=Ie.get(ne);De.__autoAllocateDepthBuffer=ne.resolveDepthBuffer===!1,De.__autoAllocateDepthBuffer===!1&&(De.__useRenderToTexture=!1),Ie.get(ne.texture).__webglTexture=Se,Ie.get(ne.depthTexture).__webglTexture=De.__autoAllocateDepthBuffer?void 0:ke,De.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(ne,Se){let ke=Ie.get(ne);ke.__webglFramebuffer=Se,ke.__useDefaultFramebuffer=Se===void 0},this.setRenderTarget=function(ne,Se=0,ke=0){te=ne,$=Se,J=ke;let De=null,Ne=!1,qt=!1;if(ne){let Vt=Ie.get(ne);if(Vt.__useDefaultFramebuffer!==void 0){Z.bindFramebuffer(_e.FRAMEBUFFER,Vt.__webglFramebuffer),ve.copy(ne.viewport),Re.copy(ne.scissor),Qe=ne.scissorTest,Z.viewport(ve),Z.scissor(Re),Z.setScissorTest(Qe),ce=-1;return}else if(Vt.__webglFramebuffer===void 0)Ge.setupRenderTarget(ne);else if(Vt.__hasExternalTextures)Ge.rebindTextures(ne,Ie.get(ne.texture).__webglTexture,Ie.get(ne.depthTexture).__webglTexture);else if(ne.depthBuffer){let Wn=ne.depthTexture;if(Vt.__boundDepthTexture!==Wn){if(Wn!==null&&Ie.has(Wn)&&(ne.width!==Wn.image.width||ne.height!==Wn.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");Ge.setupDepthRenderbuffer(ne)}}let sn=ne.texture;(sn.isData3DTexture||sn.isDataArrayTexture||sn.isCompressedArrayTexture)&&(qt=!0);let pn=Ie.get(ne).__webglFramebuffer;ne.isWebGLCubeRenderTarget?(Array.isArray(pn[Se])?De=pn[Se][ke]:De=pn[Se],Ne=!0):ne.samples>0&&Ge.useMultisampledRTT(ne)===!1?De=Ie.get(ne).__webglMultisampledFramebuffer:Array.isArray(pn)?De=pn[ke]:De=pn,ve.copy(ne.viewport),Re.copy(ne.scissor),Qe=ne.scissorTest}else ve.copy(Pt).multiplyScalar(Ye).floor(),Re.copy(dn).multiplyScalar(Ye).floor(),Qe=Gt;if(ke!==0&&(De=W),Z.bindFramebuffer(_e.FRAMEBUFFER,De)&&Z.drawBuffers(ne,De),Z.viewport(ve),Z.scissor(Re),Z.setScissorTest(Qe),Ne){let Vt=Ie.get(ne.texture);_e.framebufferTexture2D(_e.FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Vt.__webglTexture,ke)}else if(qt){let Vt=Se;for(let sn=0;sn<ne.textures.length;sn++){let pn=Ie.get(ne.textures[sn]);_e.framebufferTextureLayer(_e.FRAMEBUFFER,_e.COLOR_ATTACHMENT0+sn,pn.__webglTexture,ke,Vt)}}else if(ne!==null&&ke!==0){let Vt=Ie.get(ne.texture);_e.framebufferTexture2D(_e.FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_2D,Vt.__webglTexture,ke)}ce=-1},this.readRenderTargetPixels=function(ne,Se,ke,De,Ne,qt,Qt,Vt=0){if(!(ne&&ne.isWebGLRenderTarget)){ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let sn=Ie.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&Qt!==void 0&&(sn=sn[Qt]),sn){Z.bindFramebuffer(_e.FRAMEBUFFER,sn);try{let pn=ne.textures[Vt],Wn=pn.format,Jn=pn.type;if(ne.textures.length>1&&_e.readBuffer(_e.COLOR_ATTACHMENT0+Vt),!le.textureFormatReadable(Wn)){ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!le.textureTypeReadable(Jn)){ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Se>=0&&Se<=ne.width-De&&ke>=0&&ke<=ne.height-Ne&&_e.readPixels(Se,ke,De,Ne,St.convert(Wn),St.convert(Jn),qt)}finally{let pn=te!==null?Ie.get(te).__webglFramebuffer:null;Z.bindFramebuffer(_e.FRAMEBUFFER,pn)}}},this.readRenderTargetPixelsAsync=async function(ne,Se,ke,De,Ne,qt,Qt,Vt=0){if(!(ne&&ne.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let sn=Ie.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&Qt!==void 0&&(sn=sn[Qt]),sn)if(Se>=0&&Se<=ne.width-De&&ke>=0&&ke<=ne.height-Ne){Z.bindFramebuffer(_e.FRAMEBUFFER,sn);let pn=ne.textures[Vt],Wn=pn.format,Jn=pn.type;if(ne.textures.length>1&&_e.readBuffer(_e.COLOR_ATTACHMENT0+Vt),!le.textureFormatReadable(Wn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!le.textureTypeReadable(Jn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let gn=_e.createBuffer();_e.bindBuffer(_e.PIXEL_PACK_BUFFER,gn),_e.bufferData(_e.PIXEL_PACK_BUFFER,qt.byteLength,_e.STREAM_READ),_e.readPixels(Se,ke,De,Ne,St.convert(Wn),St.convert(Jn),0);let Yi=te!==null?Ie.get(te).__webglFramebuffer:null;Z.bindFramebuffer(_e.FRAMEBUFFER,Yi);let ss=_e.fenceSync(_e.SYNC_GPU_COMMANDS_COMPLETE,0);return _e.flush(),await TZ(_e,ss,4),_e.bindBuffer(_e.PIXEL_PACK_BUFFER,gn),_e.getBufferSubData(_e.PIXEL_PACK_BUFFER,0,qt),_e.deleteBuffer(gn),_e.deleteSync(ss),qt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(ne,Se=null,ke=0){let De=Math.pow(2,-ke),Ne=Math.floor(ne.image.width*De),qt=Math.floor(ne.image.height*De),Qt=Se!==null?Se.x:0,Vt=Se!==null?Se.y:0;Ge.setTexture2D(ne,0),_e.copyTexSubImage2D(_e.TEXTURE_2D,ke,0,0,Qt,Vt,Ne,qt),Z.unbindTexture()},this.copyTextureToTexture=function(ne,Se,ke=null,De=null,Ne=0,qt=0){let Qt,Vt,sn,pn,Wn,Jn,gn,Yi,ss,qr=ne.isCompressedTexture?ne.mipmaps[qt]:ne.image;if(ke!==null)Qt=ke.max.x-ke.min.x,Vt=ke.max.y-ke.min.y,sn=ke.isBox3?ke.max.z-ke.min.z:1,pn=ke.min.x,Wn=ke.min.y,Jn=ke.isBox3?ke.min.z:0;else{let os=Math.pow(2,-Ne);Qt=Math.floor(qr.width*os),Vt=Math.floor(qr.height*os),ne.isDataArrayTexture?sn=qr.depth:ne.isData3DTexture?sn=Math.floor(qr.depth*os):sn=1,pn=0,Wn=0,Jn=0}De!==null?(gn=De.x,Yi=De.y,ss=De.z):(gn=0,Yi=0,ss=0);let ir=St.convert(Se.format),Co=St.convert(Se.type),Zt;Se.isData3DTexture?(Ge.setTexture3D(Se,0),Zt=_e.TEXTURE_3D):Se.isDataArrayTexture||Se.isCompressedArrayTexture?(Ge.setTexture2DArray(Se,0),Zt=_e.TEXTURE_2D_ARRAY):(Ge.setTexture2D(Se,0),Zt=_e.TEXTURE_2D),Z.activeTexture(_e.TEXTURE0),Z.pixelStorei(_e.UNPACK_FLIP_Y_WEBGL,Se.flipY),Z.pixelStorei(_e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Se.premultiplyAlpha),Z.pixelStorei(_e.UNPACK_ALIGNMENT,Se.unpackAlignment);let sl=Z.getParameter(_e.UNPACK_ROW_LENGTH),yi=Z.getParameter(_e.UNPACK_IMAGE_HEIGHT),Ul=Z.getParameter(_e.UNPACK_SKIP_PIXELS),lu=Z.getParameter(_e.UNPACK_SKIP_ROWS),kf=Z.getParameter(_e.UNPACK_SKIP_IMAGES);Z.pixelStorei(_e.UNPACK_ROW_LENGTH,qr.width),Z.pixelStorei(_e.UNPACK_IMAGE_HEIGHT,qr.height),Z.pixelStorei(_e.UNPACK_SKIP_PIXELS,pn),Z.pixelStorei(_e.UNPACK_SKIP_ROWS,Wn),Z.pixelStorei(_e.UNPACK_SKIP_IMAGES,Jn);let Bm=ne.isDataArrayTexture||ne.isData3DTexture,rr=Se.isDataArrayTexture||Se.isData3DTexture;if(ne.isDepthTexture){let os=Ie.get(ne),zf=Ie.get(Se),pr=Ie.get(os.__renderTarget),Vf=Ie.get(zf.__renderTarget);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,pr.__webglFramebuffer),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,Vf.__webglFramebuffer);for(let Om=0;Om<sn;Om++)Bm&&(_e.framebufferTextureLayer(_e.READ_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,Ie.get(ne).__webglTexture,Ne,Jn+Om),_e.framebufferTextureLayer(_e.DRAW_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,Ie.get(Se).__webglTexture,qt,ss+Om)),_e.blitFramebuffer(pn,Wn,Qt,Vt,gn,Yi,Qt,Vt,_e.DEPTH_BUFFER_BIT,_e.NEAREST);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,null),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,null)}else if(Ne!==0||ne.isRenderTargetTexture||Ie.has(ne)){let os=Ie.get(ne),zf=Ie.get(Se);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,Y),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,H);for(let pr=0;pr<sn;pr++)Bm?_e.framebufferTextureLayer(_e.READ_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,os.__webglTexture,Ne,Jn+pr):_e.framebufferTexture2D(_e.READ_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_2D,os.__webglTexture,Ne),rr?_e.framebufferTextureLayer(_e.DRAW_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,zf.__webglTexture,qt,ss+pr):_e.framebufferTexture2D(_e.DRAW_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_2D,zf.__webglTexture,qt),Ne!==0?_e.blitFramebuffer(pn,Wn,Qt,Vt,gn,Yi,Qt,Vt,_e.COLOR_BUFFER_BIT,_e.NEAREST):rr?_e.copyTexSubImage3D(Zt,qt,gn,Yi,ss+pr,pn,Wn,Qt,Vt):_e.copyTexSubImage2D(Zt,qt,gn,Yi,pn,Wn,Qt,Vt);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,null),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,null)}else rr?ne.isDataTexture||ne.isData3DTexture?_e.texSubImage3D(Zt,qt,gn,Yi,ss,Qt,Vt,sn,ir,Co,qr.data):Se.isCompressedArrayTexture?_e.compressedTexSubImage3D(Zt,qt,gn,Yi,ss,Qt,Vt,sn,ir,qr.data):_e.texSubImage3D(Zt,qt,gn,Yi,ss,Qt,Vt,sn,ir,Co,qr):ne.isDataTexture?_e.texSubImage2D(_e.TEXTURE_2D,qt,gn,Yi,Qt,Vt,ir,Co,qr.data):ne.isCompressedTexture?_e.compressedTexSubImage2D(_e.TEXTURE_2D,qt,gn,Yi,qr.width,qr.height,ir,qr.data):_e.texSubImage2D(_e.TEXTURE_2D,qt,gn,Yi,Qt,Vt,ir,Co,qr);Z.pixelStorei(_e.UNPACK_ROW_LENGTH,sl),Z.pixelStorei(_e.UNPACK_IMAGE_HEIGHT,yi),Z.pixelStorei(_e.UNPACK_SKIP_PIXELS,Ul),Z.pixelStorei(_e.UNPACK_SKIP_ROWS,lu),Z.pixelStorei(_e.UNPACK_SKIP_IMAGES,kf),qt===0&&Se.generateMipmaps&&_e.generateMipmap(Zt),Z.unbindTexture()},this.initRenderTarget=function(ne){Ie.get(ne).__webglFramebuffer===void 0&&Ge.setupRenderTarget(ne)},this.initTexture=function(ne){ne.isCubeTexture?Ge.setTextureCube(ne,0):ne.isData3DTexture?Ge.setTexture3D(ne,0):ne.isDataArrayTexture||ne.isCompressedArrayTexture?Ge.setTexture2DArray(ne,0):Ge.setTexture2D(ne,0),Z.unbindTexture()},this.resetState=function(){$=0,J=0,te=null,Z.reset(),Bt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ko}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=ln._getDrawingBufferColorSpace(e),t.unpackColorSpace=ln._getUnpackColorSpace()}};var $M=class extends lr{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Oe(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element&&t.element instanceof t.element.ownerDocument.defaultView.Element&&t.element.parentNode!==null&&t.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}},A_=new re,cK=new cn,uK=new cn,hK=new re,fK=new re,YM=class{constructor(e={}){let t=this,n,r,s,o,a={objects:new WeakMap},l=e.element!==void 0?e.element:document.createElement("div");l.style.overflow="hidden",this.domElement=l,this.sortObjects=!0,this.getSize=function(){return{width:n,height:r}},this.render=function(y,w){y.matrixWorldAutoUpdate===!0&&y.updateMatrixWorld(),w.parent===null&&w.matrixWorldAutoUpdate===!0&&w.updateMatrixWorld(),cK.copy(w.matrixWorldInverse),uK.multiplyMatrices(w.projectionMatrix,cK),u(y,y,w),this.sortObjects&&A(y)},this.setSize=function(y,w){n=y,r=w,s=n/2,o=r/2,l.style.width=y+"px",l.style.height=w+"px"};function c(y){y.isCSS2DObject&&(y.element.style.display="none");for(let w=0,S=y.children.length;w<S;w++)c(y.children[w])}function u(y,w,S){if(y.visible===!1){c(y);return}if(y.isCSS2DObject){A_.setFromMatrixPosition(y.matrixWorld),A_.applyMatrix4(uK);let T=A_.z>=-1&&A_.z<=1&&y.layers.test(S.layers)===!0,R=y.element;R.style.display=T===!0?"":"none",T===!0&&(y.onBeforeRender(t,w,S),R.style.transform="translate("+-100*y.center.x+"%,"+-100*y.center.y+"%)translate("+(A_.x*s+s)+"px,"+(-A_.y*o+o)+"px)",R.parentNode!==l&&l.appendChild(R),y.onAfterRender(t,w,S));let I={distanceToCameraSquared:f(S,y)};a.objects.set(y,I)}for(let T=0,R=y.children.length;T<R;T++)u(y.children[T],w,S)}function f(y,w){return hK.setFromMatrixPosition(y.matrixWorld),fK.setFromMatrixPosition(w.matrixWorld),hK.distanceToSquared(fK)}function d(y){let w=[];return y.traverseVisible(function(S){S.isCSS2DObject&&w.push(S)}),w}function A(y){let w=d(y).sort(function(T,R){if(T.renderOrder!==R.renderOrder)return R.renderOrder-T.renderOrder;let I=a.objects.get(T).distanceToCameraSquared,P=a.objects.get(R).distanceToCameraSquared;return I-P}),S=w.length;for(let T=0,R=w.length;T<R;T++)w[T].element.style.zIndex=S-T}}};function Yxe(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var Gb=Yxe;var Zxe=typeof global=="object"&&global&&global.Object===Object&&global,dK=Zxe;var Kxe=typeof self=="object"&&self&&self.Object===Object&&self,Qxe=dK||Kxe||Function("return this")(),ZM=Qxe;var Jxe=function(){return ZM.Date.now()},KM=Jxe;var eye=/\s/;function tye(i){for(var e=i.length;e--&&eye.test(i.charAt(e)););return e}var pK=tye;var nye=/^\s+/;function iye(i){return i&&i.slice(0,pK(i)+1).replace(nye,"")}var mK=iye;var rye=ZM.Symbol,g_=rye;var AK=Object.prototype,sye=AK.hasOwnProperty,oye=AK.toString,qb=g_?g_.toStringTag:void 0;function aye(i){var e=sye.call(i,qb),t=i[qb];try{i[qb]=void 0;var n=!0}catch{}var r=oye.call(i);return n&&(e?i[qb]=t:delete i[qb]),r}var gK=aye;var lye=Object.prototype,cye=lye.toString;function uye(i){return cye.call(i)}var vK=uye;var hye="[object Null]",fye="[object Undefined]",_K=g_?g_.toStringTag:void 0;function dye(i){return i==null?i===void 0?fye:hye:_K&&_K in Object(i)?gK(i):vK(i)}var xK=dye;function pye(i){return i!=null&&typeof i=="object"}var yK=pye;var mye="[object Symbol]";function Aye(i){return typeof i=="symbol"||yK(i)&&xK(i)==mye}var bK=Aye;var wK=NaN,gye=/^[-+]0x[0-9a-f]+$/i,vye=/^0b[01]+$/i,_ye=/^0o[0-7]+$/i,xye=parseInt;function yye(i){if(typeof i=="number")return i;if(bK(i))return wK;if(Gb(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=Gb(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=mK(i);var t=vye.test(i);return t||_ye.test(i)?xye(i.slice(2),t?2:8):gye.test(i)?wK:+i}var zF=yye;var bye="Expected a function",wye=Math.max,Sye=Math.min;function Tye(i,e,t){var n,r,s,o,a,l,c=0,u=!1,f=!1,d=!0;if(typeof i!="function")throw new TypeError(bye);e=zF(e)||0,Gb(t)&&(u=!!t.leading,f="maxWait"in t,s=f?wye(zF(t.maxWait)||0,e):s,d="trailing"in t?!!t.trailing:d);function A(D){var L=n,C=r;return n=r=void 0,c=D,o=i.apply(C,L),o}function y(D){return c=D,a=setTimeout(T,e),u?A(D):o}function w(D){var L=D-l,C=D-c,B=e-L;return f?Sye(B,s-C):B}function S(D){var L=D-l,C=D-c;return l===void 0||L>=e||L<0||f&&C>=s}function T(){var D=KM();if(S(D))return R(D);a=setTimeout(T,w(D))}function R(D){return a=void 0,d&&n?A(D):(n=r=void 0,o)}function I(){a!==void 0&&clearTimeout(a),c=0,n=l=r=a=void 0}function P(){return a===void 0?o:R(KM())}function F(){var D=KM(),L=S(D);if(n=arguments,r=this,l=D,L){if(a===void 0)return y(l);if(f)return clearTimeout(a),a=setTimeout(T,e),A(l)}return a===void 0&&(a=setTimeout(T,e)),o}return F.cancel=I,F.flush=P,F}var SK=Tye;function TK(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function Eye(i){if(Array.isArray(i))return i}function Mye(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Cye(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function Rye(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Pye(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4118+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Iye(i,e){return Eye(i)||Rye(i,e)||Lye(i,e)||Pye()}function Lye(i,e){if(i){if(typeof i=="string")return TK(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?TK(i,e):void 0}}var Dye=Cye(function i(e,t){var n=t.default,r=n===void 0?null:n,s=t.triggerUpdate,o=s===void 0?!0:s,a=t.onChange,l=a===void 0?function(c,u){}:a;Mye(this,i),this.name=e,this.defaultVal=r,this.triggerUpdate=o,this.onChange=l});function Qr(i){var e=i.stateInit,t=e===void 0?function(){return{}}:e,n=i.props,r=n===void 0?{}:n,s=i.methods,o=s===void 0?{}:s,a=i.aliases,l=a===void 0?{}:a,c=i.init,u=c===void 0?function(){}:c,f=i.update,d=f===void 0?function(){}:f,A=Object.keys(r).map(function(y){return new Dye(y,r[y])});return function y(){for(var w=arguments.length,S=new Array(w),T=0;T<w;T++)S[T]=arguments[T];var R=!!(this instanceof y&&this.constructor),I=R?S.shift():void 0,P=S[0],F=P===void 0?{}:P,D=Object.assign({},t instanceof Function?t(F):t,{initialised:!1}),L={};function C(z){return B(z,F),k(),C}var B=function(G,W){u.call(C,G,D,W),D.initialised=!0},k=SK(function(){D.initialised&&(d.call(C,D,L),L={})},1);return A.forEach(function(z){C[z.name]=G(z);function G(W){var Y=W.name,H=W.triggerUpdate,$=H===void 0?!1:H,J=W.onChange,te=J===void 0?function(ve,Re){}:J,ce=W.defaultVal,he=ce===void 0?null:ce;return function(ve){var Re=D[Y];if(!arguments.length)return Re;var Qe=ve===void 0?he:ve;return D[Y]=Qe,te.call(C,Qe,D,Re),!L.hasOwnProperty(Y)&&(L[Y]=Re),$&&k(),C}}}),Object.keys(o).forEach(function(z){C[z]=function(){for(var G,W=arguments.length,Y=new Array(W),H=0;H<W;H++)Y[H]=arguments[H];return(G=o[z]).call.apply(G,[C,D].concat(Y))}}),Object.entries(l).forEach(function(z){var G=Iye(z,2),W=G[0],Y=G[1];return C[W]=C[Y]}),C.resetProps=function(){return A.forEach(function(z){C[z.name](z.defaultVal)}),C},C.resetProps(),D._rerender=k,R&&I&&C(I),C}}var Jr=Object.freeze({Linear:Object.freeze({None:function(i){return i},In:function(i){return i},Out:function(i){return i},InOut:function(i){return i}}),Quadratic:Object.freeze({In:function(i){return i*i},Out:function(i){return i*(2-i)},InOut:function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)}}),Cubic:Object.freeze({In:function(i){return i*i*i},Out:function(i){return--i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)}}),Quartic:Object.freeze({In:function(i){return i*i*i*i},Out:function(i){return 1- --i*i*i*i},InOut:function(i){return(i*=2)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2)}}),Quintic:Object.freeze({In:function(i){return i*i*i*i*i},Out:function(i){return--i*i*i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2)}}),Sinusoidal:Object.freeze({In:function(i){return 1-Math.sin((1-i)*Math.PI/2)},Out:function(i){return Math.sin(i*Math.PI/2)},InOut:function(i){return .5*(1-Math.sin(Math.PI*(.5-i)))}}),Exponential:Object.freeze({In:function(i){return i===0?0:Math.pow(1024,i-1)},Out:function(i){return i===1?1:1-Math.pow(2,-10*i)},InOut:function(i){return i===0?0:i===1?1:(i*=2)<1?.5*Math.pow(1024,i-1):.5*(-Math.pow(2,-10*(i-1))+2)}}),Circular:Object.freeze({In:function(i){return 1-Math.sqrt(1-i*i)},Out:function(i){return Math.sqrt(1- --i*i)},InOut:function(i){return(i*=2)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1)}}),Elastic:Object.freeze({In:function(i){return i===0?0:i===1?1:-Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI)},Out:function(i){return i===0?0:i===1?1:Math.pow(2,-10*i)*Math.sin((i-.1)*5*Math.PI)+1},InOut:function(i){return i===0?0:i===1?1:(i*=2,i<1?-.5*Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI):.5*Math.pow(2,-10*(i-1))*Math.sin((i-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(i){var e=1.70158;return i===1?1:i*i*((e+1)*i-e)},Out:function(i){var e=1.70158;return i===0?0:--i*i*((e+1)*i+e)+1},InOut:function(i){var e=2.5949095;return(i*=2)<1?.5*(i*i*((e+1)*i-e)):.5*((i-=2)*i*((e+1)*i+e)+2)}}),Bounce:Object.freeze({In:function(i){return 1-Jr.Bounce.Out(1-i)},Out:function(i){return i<.36363636363636365?7.5625*i*i:i<.7272727272727273?7.5625*(i-=.5454545454545454)*i+.75:i<.9090909090909091?7.5625*(i-=.8181818181818182)*i+.9375:7.5625*(i-=.9545454545454546)*i+.984375},InOut:function(i){return i<.5?Jr.Bounce.In(i*2)*.5:Jr.Bounce.Out(i*2-1)*.5+.5}}),generatePow:function(i){return i===void 0&&(i=4),i=i<Number.EPSILON?Number.EPSILON:i,i=i>1e4?1e4:i,{In:function(e){return Math.pow(e,i)},Out:function(e){return 1-Math.pow(1-e,i)},InOut:function(e){return e<.5?Math.pow(e*2,i)/2:(1-Math.pow(2-e*2,i))/2+.5}}}}),Hb=function(){return performance.now()},Ag=(function(){function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,e)}return i.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},i.prototype.removeAll=function(){this._tweens={}},i.prototype.add=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,s=t;r<s.length;r++){var o=s[r];(e=o._group)===null||e===void 0||e.remove(o),o._group=this,this._tweens[o.getId()]=o,this._tweensAddedDuringUpdate[o.getId()]=o}},i.prototype.remove=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=0,r=e;n<r.length;n++){var s=r[n];s._group=void 0,delete this._tweens[s.getId()],delete this._tweensAddedDuringUpdate[s.getId()]}},i.prototype.allStopped=function(){return this.getAll().every(function(e){return!e.isPlaying()})},i.prototype.update=function(e,t){e===void 0&&(e=Hb()),t===void 0&&(t=!0);var n=Object.keys(this._tweens);if(n.length!==0)for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var s=this._tweens[n[r]],o=!t;s&&s.update(e,o)===!1&&!t&&this.remove(s)}n=Object.keys(this._tweensAddedDuringUpdate)}},i})(),v_={Linear:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=v_.Utils.Linear;return e<0?s(i[0],i[1],n):e>1?s(i[t],i[t-1],t-n):s(i[r],i[r+1>t?t:r+1],n-r)},Bezier:function(i,e){for(var t=0,n=i.length-1,r=Math.pow,s=v_.Utils.Bernstein,o=0;o<=n;o++)t+=r(1-e,n-o)*r(e,o)*i[o]*s(n,o);return t},CatmullRom:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=v_.Utils.CatmullRom;return i[0]===i[t]?(e<0&&(r=Math.floor(n=t*(1+e))),s(i[(r-1+t)%t],i[r],i[(r+1)%t],i[(r+2)%t],n-r)):e<0?i[0]-(s(i[0],i[0],i[1],i[1],-n)-i[0]):e>1?i[t]-(s(i[t],i[t],i[t-1],i[t-1],n-t)-i[t]):s(i[r?r-1:0],i[r],i[t<r+1?t:r+1],i[t<r+2?t:r+2],n-r)},Utils:{Linear:function(i,e,t){return(e-i)*t+i},Bernstein:function(i,e){var t=v_.Utils.Factorial;return t(i)/t(e)/t(i-e)},Factorial:(function(){var i=[1];return function(e){var t=1;if(i[e])return i[e];for(var n=e;n>1;n--)t*=n;return i[e]=t,t}})(),CatmullRom:function(i,e,t,n,r){var s=(t-i)*.5,o=(n-e)*.5,a=r*r,l=r*a;return(2*e-2*t+s+o)*l+(-3*e+3*t-2*s-o)*a+s*r+e}}},EK=(function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i})(),VF=new Ag,uo=(function(){function i(e,t){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Jr.Linear.None,this._interpolationFunction=v_.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=EK.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=e,typeof t=="object"?(this._group=t,t.add(this)):t===!0&&(this._group=VF,VF.add(this))}return i.prototype.getId=function(){return this._id},i.prototype.isPlaying=function(){return this._isPlaying},i.prototype.isPaused=function(){return this._isPaused},i.prototype.getDuration=function(){return this._duration},i.prototype.to=function(e,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},i.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},i.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},i.prototype.start=function(e,t){if(e===void 0&&(e=Hb()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var s in this._valuesEnd)r[s]=this._valuesEnd[s];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},i.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},i.prototype._setupProperties=function(e,t,n,r,s){for(var o in n){var a=e[o],l=Array.isArray(a),c=l?"array":typeof a,u=!l&&Array.isArray(n[o]);if(!(c==="undefined"||c==="function")){if(u){var f=n[o];if(f.length===0)continue;for(var d=[a],A=0,y=f.length;A<y;A+=1){var w=this._handleRelativeValue(a,f[A]);if(isNaN(w)){u=!1,console.warn("Found invalid interpolation list. Skipping.");break}d.push(w)}u&&(n[o]=d)}if((c==="object"||l)&&a&&!u){t[o]=l?[]:{};var S=a;for(var T in S)t[o][T]=S[T];r[o]=l?[]:{};var f=n[o];if(!this._isDynamic){var R={};for(var T in f)R[T]=f[T];n[o]=f=R}this._setupProperties(S,t[o],f,r[o],s)}else(typeof t[o]>"u"||s)&&(t[o]=a),l||(t[o]*=1),u?r[o]=n[o].slice().reverse():r[o]=t[o]||0}}},i.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},i.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},i.prototype.pause=function(e){return e===void 0&&(e=Hb()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},i.prototype.resume=function(e){return e===void 0&&(e=Hb()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this)},i.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},i.prototype.group=function(e){return e?(e.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},i.prototype.remove=function(){var e;return(e=this._group)===null||e===void 0||e.remove(this),this},i.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},i.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},i.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},i.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},i.prototype.easing=function(e){return e===void 0&&(e=Jr.Linear.None),this._easingFunction=e,this},i.prototype.interpolation=function(e){return e===void 0&&(e=v_.Linear),this._interpolationFunction=e,this},i.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},i.prototype.onStart=function(e){return this._onStartCallback=e,this},i.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},i.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},i.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},i.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},i.prototype.onStop=function(e){return this._onStopCallback=e,this},i.prototype.update=function(e,t){var n=this,r;if(e===void 0&&(e=Hb()),t===void 0&&(t=i.autoStartOnUpdate),this._isPaused)return!0;var s;if(!this._goToEnd&&!this._isPlaying)if(t)this.start(e,!0);else return!1;if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var o=e-this._startTime,a=this._duration+((r=this._repeatDelayTime)!==null&&r!==void 0?r:this._delayTime),l=this._duration+this._repeat*a,c=function(){if(n._duration===0||o>l)return 1;var w=Math.trunc(o/a),S=o-w*a,T=Math.min(S/n._duration,1);return T===0&&o===n._duration?1:T},u=c(),f=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||o>=this._duration)if(this._repeat>0){var d=Math.min(Math.trunc((o-this._duration)/a)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=d);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=a*d,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var A=0,y=this._chainedTweens.length;A<y;A++)this._chainedTweens[A].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},i.prototype._updateProperties=function(e,t,n,r){for(var s in n)if(t[s]!==void 0){var o=t[s]||0,a=n[s],l=Array.isArray(e[s]),c=Array.isArray(a),u=!l&&c;u?e[s]=this._interpolationFunction(a,r):typeof a=="object"&&a?this._updateProperties(e[s],o,a,r):(a=this._handleRelativeValue(o,a),typeof a=="number"&&(e[s]=o+(a-o)*r))}},i.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},i.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];typeof n=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(n):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},i.autoStartOnUpdate=!1,i})();var hJe=EK.nextId,Yh=VF,fJe=Yh.getAll.bind(Yh),dJe=Yh.removeAll.bind(Yh),pJe=Yh.add.bind(Yh),mJe=Yh.remove.bind(Yh),AJe=Yh.update.bind(Yh);function MK(i){let e=+this._x.call(null,i),t=+this._y.call(null,i),n=+this._z.call(null,i);return CK(this.cover(e,t,n),e,t,n,i)}function CK(i,e,t,n,r){if(isNaN(e)||isNaN(t)||isNaN(n))return i;var s,o=i._root,a={data:r},l=i._x0,c=i._y0,u=i._z0,f=i._x1,d=i._y1,A=i._z1,y,w,S,T,R,I,P,F,D,L,C;if(!o)return i._root=a,i;for(;o.length;)if((P=e>=(y=(l+f)/2))?l=y:f=y,(F=t>=(w=(c+d)/2))?c=w:d=w,(D=n>=(S=(u+A)/2))?u=S:A=S,s=o,!(o=o[L=D<<2|F<<1|P]))return s[L]=a,i;if(T=+i._x.call(null,o.data),R=+i._y.call(null,o.data),I=+i._z.call(null,o.data),e===T&&t===R&&n===I)return a.next=o,s?s[L]=a:i._root=a,i;do s=s?s[L]=new Array(8):i._root=new Array(8),(P=e>=(y=(l+f)/2))?l=y:f=y,(F=t>=(w=(c+d)/2))?c=w:d=w,(D=n>=(S=(u+A)/2))?u=S:A=S;while((L=D<<2|F<<1|P)===(C=(I>=S)<<2|(R>=w)<<1|T>=y));return s[C]=o,s[L]=a,i}function RK(i){Array.isArray(i)||(i=Array.from(i));let e=i.length,t=new Float64Array(e),n=new Float64Array(e),r=new Float64Array(e),s=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,u=-1/0;for(let f=0,d,A,y,w;f<e;++f)isNaN(A=+this._x.call(null,d=i[f]))||isNaN(y=+this._y.call(null,d))||isNaN(w=+this._z.call(null,d))||(t[f]=A,n[f]=y,r[f]=w,A<s&&(s=A),A>l&&(l=A),y<o&&(o=y),y>c&&(c=y),w<a&&(a=w),w>u&&(u=w));if(s>l||o>c||a>u)return this;this.cover(s,o,a).cover(l,c,u);for(let f=0;f<e;++f)CK(this,t[f],n[f],r[f],i[f]);return this}function PK(i,e,t){if(isNaN(i=+i)||isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,s=this._z0,o=this._x1,a=this._y1,l=this._z1;if(isNaN(n))o=(n=Math.floor(i))+1,a=(r=Math.floor(e))+1,l=(s=Math.floor(t))+1;else{for(var c=o-n||1,u=this._root,f,d;n>i||i>=o||r>e||e>=a||s>t||t>=l;)switch(d=(t<s)<<2|(e<r)<<1|i<n,f=new Array(8),f[d]=u,u=f,c*=2,d){case 0:o=n+c,a=r+c,l=s+c;break;case 1:n=o-c,a=r+c,l=s+c;break;case 2:o=n+c,r=a-c,l=s+c;break;case 3:n=o-c,r=a-c,l=s+c;break;case 4:o=n+c,a=r+c,s=l-c;break;case 5:n=o-c,a=r+c,s=l-c;break;case 6:o=n+c,r=a-c,s=l-c;break;case 7:n=o-c,r=a-c,s=l-c;break}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=r,this._z0=s,this._x1=o,this._y1=a,this._z1=l,this}function IK(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function LK(i){return arguments.length?this.cover(+i[0][0],+i[0][1],+i[0][2]).cover(+i[1][0],+i[1][1],+i[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function ji(i,e,t,n,r,s,o){this.node=i,this.x0=e,this.y0=t,this.z0=n,this.x1=r,this.y1=s,this.z1=o}function DK(i,e,t,n){var r,s=this._x0,o=this._y0,a=this._z0,l,c,u,f,d,A,y=this._x1,w=this._y1,S=this._z1,T=[],R=this._root,I,P;for(R&&T.push(new ji(R,s,o,a,y,w,S)),n==null?n=1/0:(s=i-n,o=e-n,a=t-n,y=i+n,w=e+n,S=t+n,n*=n);I=T.pop();)if(!(!(R=I.node)||(l=I.x0)>y||(c=I.y0)>w||(u=I.z0)>S||(f=I.x1)<s||(d=I.y1)<o||(A=I.z1)<a))if(R.length){var F=(l+f)/2,D=(c+d)/2,L=(u+A)/2;T.push(new ji(R[7],F,D,L,f,d,A),new ji(R[6],l,D,L,F,d,A),new ji(R[5],F,c,L,f,D,A),new ji(R[4],l,c,L,F,D,A),new ji(R[3],F,D,u,f,d,L),new ji(R[2],l,D,u,F,d,L),new ji(R[1],F,c,u,f,D,L),new ji(R[0],l,c,u,F,D,L)),(P=(t>=L)<<2|(e>=D)<<1|i>=F)&&(I=T[T.length-1],T[T.length-1]=T[T.length-1-P],T[T.length-1-P]=I)}else{var C=i-+this._x.call(null,R.data),B=e-+this._y.call(null,R.data),k=t-+this._z.call(null,R.data),z=C*C+B*B+k*k;if(z<n){var G=Math.sqrt(n=z);s=i-G,o=e-G,a=t-G,y=i+G,w=e+G,S=t+G,r=R.data}}return r}var Nye=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function NK(i,e,t,n){let r=[],s=i-n,o=e-n,a=t-n,l=i+n,c=e+n,u=t+n;return this.visit((f,d,A,y,w,S,T)=>{if(!f.length)do{let R=f.data;Nye(i,e,t,this._x(R),this._y(R),this._z(R))<=n&&r.push(R)}while(f=f.next);return d>l||A>c||y>u||w<s||S<o||T<a}),r}function FK(i){if(isNaN(d=+this._x.call(null,i))||isNaN(A=+this._y.call(null,i))||isNaN(y=+this._z.call(null,i)))return this;var e,t=this._root,n,r,s,o=this._x0,a=this._y0,l=this._z0,c=this._x1,u=this._y1,f=this._z1,d,A,y,w,S,T,R,I,P,F,D;if(!t)return this;if(t.length)for(;;){if((R=d>=(w=(o+c)/2))?o=w:c=w,(I=A>=(S=(a+u)/2))?a=S:u=S,(P=y>=(T=(l+f)/2))?l=T:f=T,e=t,!(t=t[F=P<<2|I<<1|R]))return this;if(!t.length)break;(e[F+1&7]||e[F+2&7]||e[F+3&7]||e[F+4&7]||e[F+5&7]||e[F+6&7]||e[F+7&7])&&(n=e,D=F)}for(;t.data!==i;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[F]=s:delete e[F],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[D]=t:this._root=t),this):(this._root=s,this)}function BK(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function OK(){return this._root}function UK(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function kK(i){var e=[],t,n=this._root,r,s,o,a,l,c,u;for(n&&e.push(new ji(n,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));t=e.pop();)if(!i(n=t.node,s=t.x0,o=t.y0,a=t.z0,l=t.x1,c=t.y1,u=t.z1)&&n.length){var f=(s+l)/2,d=(o+c)/2,A=(a+u)/2;(r=n[7])&&e.push(new ji(r,f,d,A,l,c,u)),(r=n[6])&&e.push(new ji(r,s,d,A,f,c,u)),(r=n[5])&&e.push(new ji(r,f,o,A,l,d,u)),(r=n[4])&&e.push(new ji(r,s,o,A,f,d,u)),(r=n[3])&&e.push(new ji(r,f,d,a,l,c,A)),(r=n[2])&&e.push(new ji(r,s,d,a,f,c,A)),(r=n[1])&&e.push(new ji(r,f,o,a,l,d,A)),(r=n[0])&&e.push(new ji(r,s,o,a,f,d,A))}return this}function zK(i){var e=[],t=[],n;for(this._root&&e.push(new ji(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=e.pop();){var r=n.node;if(r.length){var s,o=n.x0,a=n.y0,l=n.z0,c=n.x1,u=n.y1,f=n.z1,d=(o+c)/2,A=(a+u)/2,y=(l+f)/2;(s=r[0])&&e.push(new ji(s,o,a,l,d,A,y)),(s=r[1])&&e.push(new ji(s,d,a,l,c,A,y)),(s=r[2])&&e.push(new ji(s,o,A,l,d,u,y)),(s=r[3])&&e.push(new ji(s,d,A,l,c,u,y)),(s=r[4])&&e.push(new ji(s,o,a,y,d,A,f)),(s=r[5])&&e.push(new ji(s,d,a,y,c,A,f)),(s=r[6])&&e.push(new ji(s,o,A,y,d,u,f)),(s=r[7])&&e.push(new ji(s,d,A,y,c,u,f))}t.push(n)}for(;n=t.pop();)i(n.node,n.x0,n.y0,n.z0,n.x1,n.y1,n.z1);return this}function VK(i){return i[0]}function GK(i){return arguments.length?(this._x=i,this):this._x}function qK(i){return i[1]}function HK(i){return arguments.length?(this._y=i,this):this._y}function WK(i){return i[2]}function jK(i){return arguments.length?(this._z=i,this):this._z}function Wb(i,e,t,n){var r=new GF(e??VK,t??qK,n??WK,NaN,NaN,NaN,NaN,NaN,NaN);return i==null?r:r.addAll(i)}function GF(i,e,t,n,r,s,o,a,l){this._x=i,this._y=e,this._z=t,this._x0=n,this._y0=r,this._z0=s,this._x1=o,this._y1=a,this._z1=l,this._root=void 0}function XK(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var qo=Wb.prototype=GF.prototype;qo.copy=function(){var i=new GF(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),e=this._root,t,n;if(!e)return i;if(!e.length)return i._root=XK(e),i;for(t=[{source:e,target:i._root=new Array(8)}];e=t.pop();)for(var r=0;r<8;++r)(n=e.source[r])&&(n.length?t.push({source:n,target:e.target[r]=new Array(8)}):e.target[r]=XK(n));return i};qo.add=MK;qo.addAll=RK;qo.cover=PK;qo.data=IK;qo.extent=LK;qo.find=DK;qo.findAllWithinRadius=NK;qo.remove=FK;qo.removeAll=BK;qo.root=OK;qo.size=UK;qo.visit=kK;qo.visitAfter=zK;qo.x=GK;qo.y=HK;qo.z=jK;function gg(i,e){return i==null||e==null?NaN:i<e?-1:i>e?1:i>=e?0:NaN}function qF(i,e){return i==null||e==null?NaN:e<i?-1:e>i?1:e>=i?0:NaN}function QM(i){let e,t,n;i.length!==2?(e=gg,t=(a,l)=>gg(i(a),l),n=(a,l)=>i(a)-l):(e=i===gg||i===qF?i:Fye,t=i,n=i);function r(a,l,c=0,u=a.length){if(c<u){if(e(l,l)!==0)return u;do{let f=c+u>>>1;t(a[f],l)<0?c=f+1:u=f}while(c<u)}return c}function s(a,l,c=0,u=a.length){if(c<u){if(e(l,l)!==0)return u;do{let f=c+u>>>1;t(a[f],l)<=0?c=f+1:u=f}while(c<u)}return c}function o(a,l,c=0,u=a.length){let f=r(a,l,c,u-1);return f>c&&n(a[f-1],l)>-n(a[f],l)?f-1:f}return{left:r,center:o,right:s}}function Fye(){return 0}function HF(i){return i===null?NaN:+i}var $K=QM(gg),YK=$K.right,Bye=$K.left,Oye=QM(HF).center,jb=YK;function W0(i,e){let t,n;if(e===void 0)for(let r of i)r!=null&&(t===void 0?r>=r&&(t=n=r):(t>r&&(t=r),n<r&&(n=r)));else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(t===void 0?s>=s&&(t=n=s):(t>s&&(t=s),n<s&&(n=s)))}return[t,n]}var Ho=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){let t=this._partials,n=0;for(let r=0;r<this._n&&r<32;r++){let s=t[r],o=e+s,a=Math.abs(e)<Math.abs(s)?e-(o-s):s-(o-e);a&&(t[n++]=a),e=o}return t[n]=e,this._n=n+1,this}valueOf(){let e=this._partials,t=this._n,n,r,s,o=0;if(t>0){for(o=e[--t];t>0&&(n=o,r=e[--t],o=n+r,s=r-(o-n),!s););t>0&&(s<0&&e[t-1]<0||s>0&&e[t-1]>0)&&(r=s*2,n=o+r,r==n-o&&(o=n))}return o}};var Uye=Math.sqrt(50),kye=Math.sqrt(10),zye=Math.sqrt(2);function JM(i,e,t){let n=(e-i)/Math.max(0,t),r=Math.floor(Math.log10(n)),s=n/Math.pow(10,r),o=s>=Uye?10:s>=kye?5:s>=zye?2:1,a,l,c;return r<0?(c=Math.pow(10,-r)/o,a=Math.round(i*c),l=Math.round(e*c),a/c<i&&++a,l/c>e&&--l,c=-c):(c=Math.pow(10,r)*o,a=Math.round(i/c),l=Math.round(e/c),a*c<i&&++a,l*c>e&&--l),l<a&&.5<=t&&t<2?JM(i,e,t*2):[a,l,c]}function eC(i,e,t){if(e=+e,i=+i,t=+t,!(t>0))return[];if(i===e)return[i];let n=e<i,[r,s,o]=n?JM(e,i,t):JM(i,e,t);if(!(s>=r))return[];let a=s-r+1,l=new Array(a);if(n)if(o<0)for(let c=0;c<a;++c)l[c]=(s-c)/-o;else for(let c=0;c<a;++c)l[c]=(s-c)*o;else if(o<0)for(let c=0;c<a;++c)l[c]=(r+c)/-o;else for(let c=0;c<a;++c)l[c]=(r+c)*o;return l}function Xb(i,e,t){return e=+e,i=+i,t=+t,JM(i,e,t)[2]}function WF(i,e,t){e=+e,i=+i,t=+t;let n=e<i,r=n?Xb(e,i,t):Xb(i,e,t);return(n?-1:1)*(r<0?1/-r:r)}function tC(i,e){let t;if(e===void 0)for(let n of i)n!=null&&(t<n||t===void 0&&n>=n)&&(t=n);else{let n=-1;for(let r of i)(r=e(r,++n,i))!=null&&(t<r||t===void 0&&r>=r)&&(t=r)}return t}function nC(i,e){let t=0,n=0;if(e===void 0)for(let r of i)r!=null&&(r=+r)>=r&&(++t,n+=r);else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(s=+s)>=s&&(++t,n+=s)}if(t)return n/t}function*Vye(i){for(let e of i)yield*e}function Zh(i){return Array.from(Vye(i))}function Od(i,e,t){i=+i,e=+e,t=(r=arguments.length)<2?(e=i,i=0,1):r<3?1:+t;for(var n=-1,r=Math.max(0,Math.ceil((e-i)/t))|0,s=new Array(r);++n<r;)s[n]=i+n*t;return s}function iC(i,e){let t=0;if(e===void 0)for(let n of i)(n=+n)&&(t+=n);else{let n=-1;for(let r of i)(r=+e(r,++n,i))&&(t+=r)}return t}function rC(i,e){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(e).domain(i);break}return this}function sC(i,e,t){i.prototype=e.prototype=t,t.constructor=i}function jF(i,e){var t=Object.create(i.prototype);for(var n in e)t[n]=e[n];return t}function Zb(){}var $b=.7,lC=1/$b,__="\\s*([+-]?\\d+)\\s*",Yb="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Kh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Gye=/^#([0-9a-f]{3,8})$/,qye=new RegExp(`^rgb\\(${__},${__},${__}\\)$`),Hye=new RegExp(`^rgb\\(${Kh},${Kh},${Kh}\\)$`),Wye=new RegExp(`^rgba\\(${__},${__},${__},${Yb}\\)$`),jye=new RegExp(`^rgba\\(${Kh},${Kh},${Kh},${Yb}\\)$`),Xye=new RegExp(`^hsl\\(${Yb},${Kh},${Kh}\\)$`),$ye=new RegExp(`^hsla\\(${Yb},${Kh},${Kh},${Yb}\\)$`),ZK={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};sC(Zb,Uu,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:KK,formatHex:KK,formatHex8:Yye,formatHsl:Zye,formatRgb:QK,toString:QK});function KK(){return this.rgb().formatHex()}function Yye(){return this.rgb().formatHex8()}function Zye(){return rQ(this).formatHsl()}function QK(){return this.rgb().formatRgb()}function Uu(i){var e,t;return i=(i+"").trim().toLowerCase(),(e=Gye.exec(i))?(t=e[1].length,e=parseInt(e[1],16),t===6?JK(e):t===3?new Sl(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?oC(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?oC(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=qye.exec(i))?new Sl(e[1],e[2],e[3],1):(e=Hye.exec(i))?new Sl(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Wye.exec(i))?oC(e[1],e[2],e[3],e[4]):(e=jye.exec(i))?oC(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Xye.exec(i))?nQ(e[1],e[2]/100,e[3]/100,1):(e=$ye.exec(i))?nQ(e[1],e[2]/100,e[3]/100,e[4]):ZK.hasOwnProperty(i)?JK(ZK[i]):i==="transparent"?new Sl(NaN,NaN,NaN,0):null}function JK(i){return new Sl(i>>16&255,i>>8&255,i&255,1)}function oC(i,e,t,n){return n<=0&&(i=e=t=NaN),new Sl(i,e,t,n)}function Kye(i){return i instanceof Zb||(i=Uu(i)),i?(i=i.rgb(),new Sl(i.r,i.g,i.b,i.opacity)):new Sl}function x_(i,e,t,n){return arguments.length===1?Kye(i):new Sl(i,e,t,n??1)}function Sl(i,e,t,n){this.r=+i,this.g=+e,this.b=+t,this.opacity=+n}sC(Sl,x_,jF(Zb,{brighter(i){return i=i==null?lC:Math.pow(lC,i),new Sl(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?$b:Math.pow($b,i),new Sl(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new Sl(_g(this.r),_g(this.g),_g(this.b),cC(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:eQ,formatHex:eQ,formatHex8:Qye,formatRgb:tQ,toString:tQ}));function eQ(){return`#${vg(this.r)}${vg(this.g)}${vg(this.b)}`}function Qye(){return`#${vg(this.r)}${vg(this.g)}${vg(this.b)}${vg((isNaN(this.opacity)?1:this.opacity)*255)}`}function tQ(){let i=cC(this.opacity);return`${i===1?"rgb(":"rgba("}${_g(this.r)}, ${_g(this.g)}, ${_g(this.b)}${i===1?")":`, ${i})`}`}function cC(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function _g(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function vg(i){return i=_g(i),(i<16?"0":"")+i.toString(16)}function nQ(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new Ou(i,e,t,n)}function rQ(i){if(i instanceof Ou)return new Ou(i.h,i.s,i.l,i.opacity);if(i instanceof Zb||(i=Uu(i)),!i)return new Ou;if(i instanceof Ou)return i;i=i.rgb();var e=i.r/255,t=i.g/255,n=i.b/255,r=Math.min(e,t,n),s=Math.max(e,t,n),o=NaN,a=s-r,l=(s+r)/2;return a?(e===s?o=(t-n)/a+(t<n)*6:t===s?o=(n-e)/a+2:o=(e-t)/a+4,a/=l<.5?s+r:2-s-r,o*=60):a=l>0&&l<1?0:o,new Ou(o,a,l,i.opacity)}function sQ(i,e,t,n){return arguments.length===1?rQ(i):new Ou(i,e,t,n??1)}function Ou(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}sC(Ou,sQ,jF(Zb,{brighter(i){return i=i==null?lC:Math.pow(lC,i),new Ou(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?$b:Math.pow($b,i),new Ou(this.h,this.s,this.l*i,this.opacity)},rgb(){var i=this.h%360+(this.h<0)*360,e=isNaN(i)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*e,r=2*t-n;return new Sl(XF(i>=240?i-240:i+120,r,n),XF(i,r,n),XF(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new Ou(iQ(this.h),aC(this.s),aC(this.l),cC(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(){let i=cC(this.opacity);return`${i===1?"hsl(":"hsla("}${iQ(this.h)}, ${aC(this.s)*100}%, ${aC(this.l)*100}%${i===1?")":`, ${i})`}`}}));function iQ(i){return i=(i||0)%360,i<0?i+360:i}function aC(i){return Math.max(0,Math.min(1,i||0))}function XF(i,e,t){return(i<60?e+(t-e)*i/60:i<180?t:i<240?e+(t-e)*(240-i)/60:e)*255}function $F(i,e,t,n,r){var s=i*i,o=s*i;return((1-3*i+3*s-o)*e+(4-6*s+3*o)*t+(1+3*i+3*s-3*o)*n+o*r)/6}function oQ(i){var e=i.length-1;return function(t){var n=t<=0?t=0:t>=1?(t=1,e-1):Math.floor(t*e),r=i[n],s=i[n+1],o=n>0?i[n-1]:2*r-s,a=n<e-1?i[n+2]:2*s-r;return $F((t-n/e)*e,o,r,s,a)}}function aQ(i){var e=i.length;return function(t){var n=Math.floor(((t%=1)<0?++t:t)*e),r=i[(n+e-1)%e],s=i[n%e],o=i[(n+1)%e],a=i[(n+2)%e];return $F((t-n/e)*e,r,s,o,a)}}var Kb=i=>()=>i;function Jye(i,e){return function(t){return i+t*e}}function e2e(i,e,t){return i=Math.pow(i,t),e=Math.pow(e,t)-i,t=1/t,function(n){return Math.pow(i+n*e,t)}}function lQ(i){return(i=+i)==1?uC:function(e,t){return t-e?e2e(e,t,i):Kb(isNaN(e)?t:e)}}function uC(i,e){var t=e-i;return t?Jye(i,t):Kb(isNaN(i)?e:i)}var YF=(function i(e){var t=lQ(e);function n(r,s){var o=t((r=x_(r)).r,(s=x_(s)).r),a=t(r.g,s.g),l=t(r.b,s.b),c=uC(r.opacity,s.opacity);return function(u){return r.r=o(u),r.g=a(u),r.b=l(u),r.opacity=c(u),r+""}}return n.gamma=i,n})(1);function cQ(i){return function(e){var t=e.length,n=new Array(t),r=new Array(t),s=new Array(t),o,a;for(o=0;o<t;++o)a=x_(e[o]),n[o]=a.r||0,r[o]=a.g||0,s[o]=a.b||0;return n=i(n),r=i(r),s=i(s),a.opacity=1,function(l){return a.r=n(l),a.g=r(l),a.b=s(l),a+""}}}var Xet=cQ(oQ),$et=cQ(aQ);function hC(i,e){e||(e=[]);var t=i?Math.min(e.length,i.length):0,n=e.slice(),r;return function(s){for(r=0;r<t;++r)n[r]=i[r]*(1-s)+e[r]*s;return n}}function fC(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function ZF(i,e){return(fC(e)?hC:KF)(i,e)}function KF(i,e){var t=e?e.length:0,n=i?Math.min(t,i.length):0,r=new Array(n),s=new Array(t),o;for(o=0;o<n;++o)r[o]=xg(i[o],e[o]);for(;o<t;++o)s[o]=e[o];return function(a){for(o=0;o<n;++o)s[o]=r[o](a);return s}}function uQ(i,e){var t=new Date;return i=+i,e=+e,function(n){return t.setTime(i*(1-n)+e*n),t}}function Qh(i,e){return i=+i,e=+e,function(t){return i*(1-t)+e*t}}function hQ(i,e){var t={},n={},r;(i===null||typeof i!="object")&&(i={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in i?t[r]=xg(i[r],e[r]):n[r]=e[r];return function(s){for(r in t)n[r]=t[r](s);return n}}var JF=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,QF=new RegExp(JF.source,"g");function t2e(i){return function(){return i}}function n2e(i){return function(e){return i(e)+""}}function fQ(i,e){var t=JF.lastIndex=QF.lastIndex=0,n,r,s,o=-1,a=[],l=[];for(i=i+"",e=e+"";(n=JF.exec(i))&&(r=QF.exec(e));)(s=r.index)>t&&(s=e.slice(t,s),a[o]?a[o]+=s:a[++o]=s),(n=n[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,l.push({i:o,x:Qh(n,r)})),t=QF.lastIndex;return t<e.length&&(s=e.slice(t),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?n2e(l[0].x):t2e(e):(e=l.length,function(c){for(var u=0,f;u<e;++u)a[(f=l[u]).i]=f.x(c);return a.join("")})}function xg(i,e){var t=typeof e,n;return e==null||t==="boolean"?Kb(e):(t==="number"?Qh:t==="string"?(n=Uu(e))?(e=n,YF):fQ:e instanceof Uu?YF:e instanceof Date?uQ:fC(e)?hC:Array.isArray(e)?KF:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?hQ:Qh)(i,e)}function eB(i,e){return i=+i,e=+e,function(t){return Math.round(i*(1-t)+e*t)}}function tB(i){return function(){return i}}function nB(i){return+i}var dQ=[0,1];function y_(i){return i}function iB(i,e){return(e-=i=+i)?function(t){return(t-i)/e}:tB(isNaN(e)?NaN:.5)}function i2e(i,e){var t;return i>e&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function r2e(i,e,t){var n=i[0],r=i[1],s=e[0],o=e[1];return r<n?(n=iB(r,n),s=t(o,s)):(n=iB(n,r),s=t(s,o)),function(a){return s(n(a))}}function s2e(i,e,t){var n=Math.min(i.length,e.length)-1,r=new Array(n),s=new Array(n),o=-1;for(i[n]<i[0]&&(i=i.slice().reverse(),e=e.slice().reverse());++o<n;)r[o]=iB(i[o],i[o+1]),s[o]=t(e[o],e[o+1]);return function(a){var l=jb(i,a,1,n)-1;return s[l](r[l](a))}}function pQ(i,e){return e.domain(i.domain()).range(i.range()).interpolate(i.interpolate()).clamp(i.clamp()).unknown(i.unknown())}function o2e(){var i=dQ,e=dQ,t=xg,n,r,s,o=y_,a,l,c;function u(){var d=Math.min(i.length,e.length);return o!==y_&&(o=i2e(i[0],i[d-1])),a=d>2?s2e:r2e,l=c=null,f}function f(d){return d==null||isNaN(d=+d)?s:(l||(l=a(i.map(n),e,t)))(n(o(d)))}return f.invert=function(d){return o(r((c||(c=a(e,i.map(n),Qh)))(d)))},f.domain=function(d){return arguments.length?(i=Array.from(d,nB),u()):i.slice()},f.range=function(d){return arguments.length?(e=Array.from(d),u()):e.slice()},f.rangeRound=function(d){return e=Array.from(d),t=eB,u()},f.clamp=function(d){return arguments.length?(o=d?!0:y_,u()):o!==y_},f.interpolate=function(d){return arguments.length?(t=d,u()):t},f.unknown=function(d){return arguments.length?(s=d,f):s},function(d,A){return n=d,r=A,u()}}function rB(){return o2e()(y_,y_)}function mQ(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function yg(i,e){if(!isFinite(i)||i===0)return null;var t=(i=e?i.toExponential(e-1):i.toExponential()).indexOf("e"),n=i.slice(0,t);return[n.length>1?n[0]+n.slice(2):n,+i.slice(t+1)]}function Jh(i){return i=yg(Math.abs(i)),i?i[1]:NaN}function AQ(i,e){return function(t,n){for(var r=t.length,s=[],o=0,a=i[0],l=0;r>0&&a>0&&(l+a+1>n&&(a=Math.max(1,n-l)),s.push(t.substring(r-=a,r+a)),!((l+=a+1)>n));)a=i[o=(o+1)%i.length];return s.reverse().join(e)}}function gQ(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var a2e=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function j0(i){if(!(e=a2e.exec(i)))throw new Error("invalid format: "+i);var e;return new dC({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]})}j0.prototype=dC.prototype;function dC(i){this.fill=i.fill===void 0?" ":i.fill+"",this.align=i.align===void 0?">":i.align+"",this.sign=i.sign===void 0?"-":i.sign+"",this.symbol=i.symbol===void 0?"":i.symbol+"",this.zero=!!i.zero,this.width=i.width===void 0?void 0:+i.width,this.comma=!!i.comma,this.precision=i.precision===void 0?void 0:+i.precision,this.trim=!!i.trim,this.type=i.type===void 0?"":i.type+""}dC.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 vQ(i){e:for(var e=i.length,t=1,n=-1,r;t<e;++t)switch(i[t]){case".":n=r=t;break;case"0":n===0&&(n=t),r=t;break;default:if(!+i[t])break e;n>0&&(n=0);break}return n>0?i.slice(0,n)+i.slice(r+1):i}var Qb;function _Q(i,e){var t=yg(i,e);if(!t)return Qb=void 0,i.toPrecision(e);var n=t[0],r=t[1],s=r-(Qb=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,o=n.length;return s===o?n:s>o?n+new Array(s-o+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+yg(i,Math.max(0,e+s-1))[0]}function sB(i,e){var t=yg(i,e);if(!t)return i+"";var n=t[0],r=t[1];return r<0?"0."+new Array(-r).join("0")+n:n.length>r+1?n.slice(0,r+1)+"."+n.slice(r+1):n+new Array(r-n.length+2).join("0")}var oB={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:mQ,e:(i,e)=>i.toExponential(e),f:(i,e)=>i.toFixed(e),g:(i,e)=>i.toPrecision(e),o:i=>Math.round(i).toString(8),p:(i,e)=>sB(i*100,e),r:sB,s:_Q,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function aB(i){return i}var xQ=Array.prototype.map,yQ=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function bQ(i){var e=i.grouping===void 0||i.thousands===void 0?aB:AQ(xQ.call(i.grouping,Number),i.thousands+""),t=i.currency===void 0?"":i.currency[0]+"",n=i.currency===void 0?"":i.currency[1]+"",r=i.decimal===void 0?".":i.decimal+"",s=i.numerals===void 0?aB:gQ(xQ.call(i.numerals,String)),o=i.percent===void 0?"%":i.percent+"",a=i.minus===void 0?"\u2212":i.minus+"",l=i.nan===void 0?"NaN":i.nan+"";function c(f,d){f=j0(f);var A=f.fill,y=f.align,w=f.sign,S=f.symbol,T=f.zero,R=f.width,I=f.comma,P=f.precision,F=f.trim,D=f.type;D==="n"?(I=!0,D="g"):oB[D]||(P===void 0&&(P=12),F=!0,D="g"),(T||A==="0"&&y==="=")&&(T=!0,A="0",y="=");var L=(d&&d.prefix!==void 0?d.prefix:"")+(S==="$"?t:S==="#"&&/[boxX]/.test(D)?"0"+D.toLowerCase():""),C=(S==="$"?n:/[%p]/.test(D)?o:"")+(d&&d.suffix!==void 0?d.suffix:""),B=oB[D],k=/[defgprs%]/.test(D);P=P===void 0?6:/[gprs]/.test(D)?Math.max(1,Math.min(21,P)):Math.max(0,Math.min(20,P));function z(G){var W=L,Y=C,H,$,J;if(D==="c")Y=B(G)+Y,G="";else{G=+G;var te=G<0||1/G<0;if(G=isNaN(G)?l:B(Math.abs(G),P),F&&(G=vQ(G)),te&&+G==0&&w!=="+"&&(te=!1),W=(te?w==="("?w:a:w==="-"||w==="("?"":w)+W,Y=(D==="s"&&!isNaN(G)&&Qb!==void 0?yQ[8+Qb/3]:"")+Y+(te&&w==="("?")":""),k){for(H=-1,$=G.length;++H<$;)if(J=G.charCodeAt(H),48>J||J>57){Y=(J===46?r+G.slice(H+1):G.slice(H))+Y,G=G.slice(0,H);break}}}I&&!T&&(G=e(G,1/0));var ce=W.length+G.length+Y.length,he=ce<R?new Array(R-ce+1).join(A):"";switch(I&&T&&(G=e(he+G,he.length?R-Y.length:1/0),he=""),y){case"<":G=W+G+Y+he;break;case"=":G=W+he+G+Y;break;case"^":G=he.slice(0,ce=he.length>>1)+W+G+Y+he.slice(ce);break;default:G=he+W+G+Y;break}return s(G)}return z.toString=function(){return f+""},z}function u(f,d){var A=Math.max(-8,Math.min(8,Math.floor(Jh(d)/3)))*3,y=Math.pow(10,-A),w=c((f=j0(f),f.type="f",f),{suffix:yQ[8+A/3]});return function(S){return w(y*S)}}return{format:c,formatPrefix:u}}var pC,mC,AC;lB({thousands:",",grouping:[3],currency:["$",""]});function lB(i){return pC=bQ(i),mC=pC.format,AC=pC.formatPrefix,pC}function cB(i){return Math.max(0,-Jh(Math.abs(i)))}function uB(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Jh(e)/3)))*3-Jh(Math.abs(i)))}function hB(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,Jh(e)-Jh(i))+1}function fB(i,e,t,n){var r=WF(i,e,t),s;switch(n=j0(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=uB(r,o))&&(n.precision=s),AC(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=hB(r,Math.max(Math.abs(i),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=cB(r))&&(n.precision=s-(n.type==="%")*2);break}}return mC(n)}function dB(i){var e=i.domain;return i.ticks=function(t){var n=e();return eC(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return fB(r[0],r[r.length-1],t??10,n)},i.nice=function(t){t==null&&(t=10);var n=e(),r=0,s=n.length-1,o=n[r],a=n[s],l,c,u=10;for(a<o&&(c=o,o=a,a=c,c=r,r=s,s=c);u-- >0;){if(c=Xb(o,a,t),c===l)return n[r]=o,n[s]=a,e(n);if(c>0)o=Math.floor(o/c)*c,a=Math.ceil(a/c)*c;else if(c<0)o=Math.ceil(o*c)/c,a=Math.floor(a*c)/c;else break;l=c}return i},i}function Tl(){var i=rB();return i.copy=function(){return pQ(i,Tl())},rC.apply(i,arguments),dB(i)}function Jb(){var i=0,e=1,t=1,n=[.5],r=[0,1],s;function o(l){return l!=null&&l<=l?r[jb(n,l,0,t)]:s}function a(){var l=-1;for(n=new Array(t);++l<t;)n[l]=((l+1)*e-(l-t)*i)/(t+1);return o}return o.domain=function(l){return arguments.length?([i,e]=l,i=+i,e=+e,a()):[i,e]},o.range=function(l){return arguments.length?(t=(r=Array.from(l)).length-1,a()):r.slice()},o.invertExtent=function(l){var c=r.indexOf(l);return c<0?[NaN,NaN]:c<1?[i,n[0]]:c>=t?[n[t-1],e]:[n[c-1],n[c]]},o.unknown=function(l){return arguments.length&&(s=l),o},o.thresholds=function(){return n.slice()},o.copy=function(){return Jb().domain([i,e]).range(r).unknown(s)},rC.apply(dB(o),arguments)}var In=1e-6,bg=1e-12,ri=Math.PI,yo=ri/2,b_=ri/4,bo=ri*2,ur=180/ri,_n=ri/180,si=Math.abs,w_=Math.atan,Ms=Math.atan2,mn=Math.cos,ew=Math.ceil,wQ=Math.exp;var gC=Math.hypot,SQ=Math.log;var un=Math.sin,TQ=Math.sign||function(i){return i>0?1:i<0?-1:0},Wo=Math.sqrt,EQ=Math.tan;function MQ(i){return i>1?0:i<-1?ri:Math.acos(i)}function da(i){return i>1?yo:i<-1?-yo:Math.asin(i)}function pB(i){return(i=un(i/2))*i}function ms(){}function vC(i,e){i&&RQ.hasOwnProperty(i.type)&&RQ[i.type](i,e)}var CQ={Feature:function(i,e){vC(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)vC(t[n].geometry,e)}},RQ={Sphere:function(i,e){e.sphere()},Point:function(i,e){i=i.coordinates,e.point(i[0],i[1],i[2])},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)i=t[n],e.point(i[0],i[1],i[2])},LineString:function(i,e){mB(i.coordinates,e,0)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)mB(t[n],e,0)},Polygon:function(i,e){PQ(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)PQ(t[n],e)},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)vC(t[n],e)}};function mB(i,e,t){var n=-1,r=i.length-t,s;for(e.lineStart();++n<r;)s=i[n],e.point(s[0],s[1],s[2]);e.lineEnd()}function PQ(i,e){var t=-1,n=i.length;for(e.polygonStart();++t<n;)mB(i[t],e,1);e.polygonEnd()}function X0(i,e){i&&CQ.hasOwnProperty(i.type)?CQ[i.type](i,e):vC(i,e)}var tw=new Ho,IQ=new Ho,LQ,DQ,AB,gB,vB,ef={point:ms,lineStart:ms,lineEnd:ms,polygonStart:function(){tw=new Ho,ef.lineStart=l2e,ef.lineEnd=c2e},polygonEnd:function(){var i=+tw;IQ.add(i<0?bo+i:i),this.lineStart=this.lineEnd=this.point=ms},sphere:function(){IQ.add(bo)}};function l2e(){ef.point=u2e}function c2e(){NQ(LQ,DQ)}function u2e(i,e){ef.point=NQ,LQ=i,DQ=e,i*=_n,e*=_n,AB=i,gB=mn(e=e/2+b_),vB=un(e)}function NQ(i,e){i*=_n,e*=_n,e=e/2+b_;var t=i-AB,n=t>=0?1:-1,r=n*t,s=mn(e),o=un(e),a=vB*o,l=gB*s+a*mn(r),c=a*n*un(r);tw.add(Ms(c,l)),AB=i,gB=s,vB=o}function wg(i){return[Ms(i[1],i[0]),da(i[2])]}function Wc(i){var e=i[0],t=i[1],n=mn(t);return[n*mn(e),n*un(e),un(t)]}function nw(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Ud(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function _C(i,e){i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}function iw(i,e){return[i[0]*e,i[1]*e,i[2]*e]}function Sg(i){var e=Wo(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);i[0]/=e,i[1]/=e,i[2]/=e}var es,El,As,ic,Tg,UQ,kQ,S_,rw,$0,zd,kd={point:_B,lineStart:FQ,lineEnd:BQ,polygonStart:function(){kd.point=VQ,kd.lineStart=h2e,kd.lineEnd=f2e,rw=new Ho,ef.polygonStart()},polygonEnd:function(){ef.polygonEnd(),kd.point=_B,kd.lineStart=FQ,kd.lineEnd=BQ,tw<0?(es=-(As=180),El=-(ic=90)):rw>In?ic=90:rw<-In&&(El=-90),zd[0]=es,zd[1]=As},sphere:function(){es=-(As=180),El=-(ic=90)}};function _B(i,e){$0.push(zd=[es=i,As=i]),e<El&&(El=e),e>ic&&(ic=e)}function zQ(i,e){var t=Wc([i*_n,e*_n]);if(S_){var n=Ud(S_,t),r=[n[1],-n[0],0],s=Ud(r,n);Sg(s),s=wg(s);var o=i-Tg,a=o>0?1:-1,l=s[0]*ur*a,c,u=si(o)>180;u^(a*Tg<l&&l<a*i)?(c=s[1]*ur,c>ic&&(ic=c)):(l=(l+360)%360-180,u^(a*Tg<l&&l<a*i)?(c=-s[1]*ur,c<El&&(El=c)):(e<El&&(El=e),e>ic&&(ic=e))),u?i<Tg?nc(es,i)>nc(es,As)&&(As=i):nc(i,As)>nc(es,As)&&(es=i):As>=es?(i<es&&(es=i),i>As&&(As=i)):i>Tg?nc(es,i)>nc(es,As)&&(As=i):nc(i,As)>nc(es,As)&&(es=i)}else $0.push(zd=[es=i,As=i]);e<El&&(El=e),e>ic&&(ic=e),S_=t,Tg=i}function FQ(){kd.point=zQ}function BQ(){zd[0]=es,zd[1]=As,kd.point=_B,S_=null}function VQ(i,e){if(S_){var t=i-Tg;rw.add(si(t)>180?t+(t>0?360:-360):t)}else UQ=i,kQ=e;ef.point(i,e),zQ(i,e)}function h2e(){ef.lineStart()}function f2e(){VQ(UQ,kQ),ef.lineEnd(),si(rw)>In&&(es=-(As=180)),zd[0]=es,zd[1]=As,S_=null}function nc(i,e){return(e-=i)<0?e+360:e}function d2e(i,e){return i[0]-e[0]}function OQ(i,e){return i[0]<=i[1]?i[0]<=e&&e<=i[1]:e<i[0]||i[1]<e}function xC(i){var e,t,n,r,s,o,a;if(ic=As=-(es=El=1/0),$0=[],X0(i,kd),t=$0.length){for($0.sort(d2e),e=1,n=$0[0],s=[n];e<t;++e)r=$0[e],OQ(n,r[0])||OQ(n,r[1])?(nc(n[0],r[1])>nc(n[0],n[1])&&(n[1]=r[1]),nc(r[0],n[1])>nc(n[0],n[1])&&(n[0]=r[0])):s.push(n=r);for(o=-1/0,t=s.length-1,e=0,n=s[t];e<=t;n=r,++e)r=s[e],(a=nc(n[1],r[0]))>o&&(o=a,es=r[0],As=n[1])}return $0=zd=null,es===1/0||El===1/0?[[NaN,NaN],[NaN,NaN]]:[[es,El],[As,ic]]}var sw,yC,bC,wC,SC,TC,EC,MC,xB,yB,bB,HQ,WQ,Wa,ja,Xa,ku={sphere:ms,point:wB,lineStart:GQ,lineEnd:qQ,polygonStart:function(){ku.lineStart=A2e,ku.lineEnd=g2e},polygonEnd:function(){ku.lineStart=GQ,ku.lineEnd=qQ}};function wB(i,e){i*=_n,e*=_n;var t=mn(e);ow(t*mn(i),t*un(i),un(e))}function ow(i,e,t){++sw,bC+=(i-bC)/sw,wC+=(e-wC)/sw,SC+=(t-SC)/sw}function GQ(){ku.point=p2e}function p2e(i,e){i*=_n,e*=_n;var t=mn(e);Wa=t*mn(i),ja=t*un(i),Xa=un(e),ku.point=m2e,ow(Wa,ja,Xa)}function m2e(i,e){i*=_n,e*=_n;var t=mn(e),n=t*mn(i),r=t*un(i),s=un(e),o=Ms(Wo((o=ja*s-Xa*r)*o+(o=Xa*n-Wa*s)*o+(o=Wa*r-ja*n)*o),Wa*n+ja*r+Xa*s);yC+=o,TC+=o*(Wa+(Wa=n)),EC+=o*(ja+(ja=r)),MC+=o*(Xa+(Xa=s)),ow(Wa,ja,Xa)}function qQ(){ku.point=wB}function A2e(){ku.point=v2e}function g2e(){jQ(HQ,WQ),ku.point=wB}function v2e(i,e){HQ=i,WQ=e,i*=_n,e*=_n,ku.point=jQ;var t=mn(e);Wa=t*mn(i),ja=t*un(i),Xa=un(e),ow(Wa,ja,Xa)}function jQ(i,e){i*=_n,e*=_n;var t=mn(e),n=t*mn(i),r=t*un(i),s=un(e),o=ja*s-Xa*r,a=Xa*n-Wa*s,l=Wa*r-ja*n,c=gC(o,a,l),u=da(c),f=c&&-u/c;xB.add(f*o),yB.add(f*a),bB.add(f*l),yC+=u,TC+=u*(Wa+(Wa=n)),EC+=u*(ja+(ja=r)),MC+=u*(Xa+(Xa=s)),ow(Wa,ja,Xa)}function CC(i){sw=yC=bC=wC=SC=TC=EC=MC=0,xB=new Ho,yB=new Ho,bB=new Ho,X0(i,ku);var e=+xB,t=+yB,n=+bB,r=gC(e,t,n);return r<bg&&(e=TC,t=EC,n=MC,yC<In&&(e=bC,t=wC,n=SC),r=gC(e,t,n),r<bg)?[NaN,NaN]:[Ms(t,e)*ur,da(n/r)*ur]}function aw(i,e){function t(n,r){return n=i(n,r),e(n[0],n[1])}return i.invert&&e.invert&&(t.invert=function(n,r){return n=e.invert(n,r),n&&i.invert(n[0],n[1])}),t}function SB(i,e){return si(i)>ri&&(i-=Math.round(i/bo)*bo),[i,e]}SB.invert=SB;function TB(i,e,t){return(i%=bo)?e||t?aw($Q(i),YQ(e,t)):$Q(i):e||t?YQ(e,t):SB}function XQ(i){return function(e,t){return e+=i,si(e)>ri&&(e-=Math.round(e/bo)*bo),[e,t]}}function $Q(i){var e=XQ(i);return e.invert=XQ(-i),e}function YQ(i,e){var t=mn(i),n=un(i),r=mn(e),s=un(e);function o(a,l){var c=mn(l),u=mn(a)*c,f=un(a)*c,d=un(l),A=d*t+u*n;return[Ms(f*r-A*s,u*t-d*n),da(A*r+f*s)]}return o.invert=function(a,l){var c=mn(l),u=mn(a)*c,f=un(a)*c,d=un(l),A=d*r-f*s;return[Ms(f*r+d*s,u*t+A*n),da(A*t-u*n)]},o}function EB(i){i=TB(i[0]*_n,i[1]*_n,i.length>2?i[2]*_n:0);function e(t){return t=i(t[0]*_n,t[1]*_n),t[0]*=ur,t[1]*=ur,t}return e.invert=function(t){return t=i.invert(t[0]*_n,t[1]*_n),t[0]*=ur,t[1]*=ur,t},e}function KQ(i,e,t,n,r,s){if(t){var o=mn(e),a=un(e),l=n*t;r==null?(r=e+n*bo,s=e-l/2):(r=ZQ(o,r),s=ZQ(o,s),(n>0?r<s:r>s)&&(r+=n*bo));for(var c,u=r;n>0?u>s:u<s;u-=l)c=wg([o,-a*mn(u),-a*un(u)]),i.point(c[0],c[1])}}function ZQ(i,e){e=Wc(e),e[0]-=i,Sg(e);var t=MQ(-e[1]);return((-e[2]<0?-t:t)+bo-In)%bo}function RC(){var i=[],e;return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){i.push(e=[])},lineEnd:ms,rejoin:function(){i.length>1&&i.push(i.pop().concat(i.shift()))},result:function(){var t=i;return i=[],e=null,t}}}function T_(i,e){return si(i[0]-e[0])<In&&si(i[1]-e[1])<In}function PC(i,e,t,n){this.x=i,this.z=e,this.o=t,this.e=n,this.v=!1,this.n=this.p=null}function IC(i,e,t,n,r){var s=[],o=[],a,l;if(i.forEach(function(y){if(!((w=y.length-1)<=0)){var w,S=y[0],T=y[w],R;if(T_(S,T)){if(!S[2]&&!T[2]){for(r.lineStart(),a=0;a<w;++a)r.point((S=y[a])[0],S[1]);r.lineEnd();return}T[0]+=2*In}s.push(R=new PC(S,y,null,!0)),o.push(R.o=new PC(S,null,R,!1)),s.push(R=new PC(T,y,null,!1)),o.push(R.o=new PC(T,null,R,!0))}}),!!s.length){for(o.sort(e),QQ(s),QQ(o),a=0,l=o.length;a<l;++a)o[a].e=t=!t;for(var c=s[0],u,f;;){for(var d=c,A=!0;d.v;)if((d=d.n)===c)return;u=d.z,r.lineStart();do{if(d.v=d.o.v=!0,d.e){if(A)for(a=0,l=u.length;a<l;++a)r.point((f=u[a])[0],f[1]);else n(d.x,d.n.x,1,r);d=d.n}else{if(A)for(u=d.p.z,a=u.length-1;a>=0;--a)r.point((f=u[a])[0],f[1]);else n(d.x,d.p.x,-1,r);d=d.p}d=d.o,u=d.z,A=!A}while(!d.v);r.lineEnd()}}}function QQ(i){if(e=i.length){for(var e,t=0,n=i[0],r;++t<e;)n.n=r=i[t],r.p=n,n=r;n.n=r=i[0],r.p=n}}function MB(i){return si(i[0])<=ri?i[0]:TQ(i[0])*((si(i[0])+ri)%bo-ri)}function LC(i,e){var t=MB(e),n=e[1],r=un(n),s=[un(t),-mn(t),0],o=0,a=0,l=new Ho;r===1?n=yo+In:r===-1&&(n=-yo-In);for(var c=0,u=i.length;c<u;++c)if(d=(f=i[c]).length)for(var f,d,A=f[d-1],y=MB(A),w=A[1]/2+b_,S=un(w),T=mn(w),R=0;R<d;++R,y=P,S=D,T=L,A=I){var I=f[R],P=MB(I),F=I[1]/2+b_,D=un(F),L=mn(F),C=P-y,B=C>=0?1:-1,k=B*C,z=k>ri,G=S*D;if(l.add(Ms(G*B*un(k),T*L+G*mn(k))),o+=z?C+B*bo:C,z^y>=t^P>=t){var W=Ud(Wc(A),Wc(I));Sg(W);var Y=Ud(s,W);Sg(Y);var H=(z^C>=0?-1:1)*da(Y[2]);(n>H||n===H&&(W[0]||W[1]))&&(a+=z^C>=0?1:-1)}}return(o<-In||o<In&&l<-bg)^a&1}function DC(i,e,t,n){return function(r){var s=e(r),o=RC(),a=e(o),l=!1,c,u,f,d={point:A,lineStart:w,lineEnd:S,polygonStart:function(){d.point=T,d.lineStart=R,d.lineEnd=I,u=[],c=[]},polygonEnd:function(){d.point=A,d.lineStart=w,d.lineEnd=S,u=Zh(u);var P=LC(c,n);u.length?(l||(r.polygonStart(),l=!0),IC(u,x2e,P,t,r)):P&&(l||(r.polygonStart(),l=!0),r.lineStart(),t(null,null,1,r),r.lineEnd()),l&&(r.polygonEnd(),l=!1),u=c=null},sphere:function(){r.polygonStart(),r.lineStart(),t(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function A(P,F){i(P,F)&&r.point(P,F)}function y(P,F){s.point(P,F)}function w(){d.point=y,s.lineStart()}function S(){d.point=A,s.lineEnd()}function T(P,F){f.push([P,F]),a.point(P,F)}function R(){a.lineStart(),f=[]}function I(){T(f[0][0],f[0][1]),a.lineEnd();var P=a.clean(),F=o.result(),D,L=F.length,C,B,k;if(f.pop(),c.push(f),f=null,!!L){if(P&1){if(B=F[0],(C=B.length-1)>0){for(l||(r.polygonStart(),l=!0),r.lineStart(),D=0;D<C;++D)r.point((k=B[D])[0],k[1]);r.lineEnd()}return}L>1&&P&2&&F.push(F.pop().concat(F.shift())),u.push(F.filter(_2e))}}return d}}function _2e(i){return i.length>1}function x2e(i,e){return((i=i.x)[0]<0?i[1]-yo-In:yo-i[1])-((e=e.x)[0]<0?e[1]-yo-In:yo-e[1])}var CB=DC(function(){return!0},y2e,w2e,[-ri,-yo]);function y2e(i){var e=NaN,t=NaN,n=NaN,r;return{lineStart:function(){i.lineStart(),r=1},point:function(s,o){var a=s>0?ri:-ri,l=si(s-e);si(l-ri)<In?(i.point(e,t=(t+o)/2>0?yo:-yo),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),i.point(s,t),r=0):n!==a&&l>=ri&&(si(e-n)<In&&(e-=n*In),si(s-a)<In&&(s-=a*In),t=b2e(e,t,s,o),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),r=0),i.point(e=s,t=o),n=a},lineEnd:function(){i.lineEnd(),e=t=NaN},clean:function(){return 2-r}}}function b2e(i,e,t,n){var r,s,o=un(i-t);return si(o)>In?w_((un(e)*(s=mn(n))*un(t)-un(n)*(r=mn(e))*un(i))/(r*s*o)):(e+n)/2}function w2e(i,e,t,n){var r;if(i==null)r=t*yo,n.point(-ri,r),n.point(0,r),n.point(ri,r),n.point(ri,0),n.point(ri,-r),n.point(0,-r),n.point(-ri,-r),n.point(-ri,0),n.point(-ri,r);else if(si(i[0]-e[0])>In){var s=i[0]<e[0]?ri:-ri;r=t*s/2,n.point(-s,r),n.point(0,r),n.point(s,r)}else n.point(e[0],e[1])}function JQ(i){var e=mn(i),t=2*_n,n=e>0,r=si(e)>In;function s(u,f,d,A){KQ(A,i,t,d,u,f)}function o(u,f){return mn(u)*mn(f)>e}function a(u){var f,d,A,y,w;return{lineStart:function(){y=A=!1,w=1},point:function(S,T){var R=[S,T],I,P=o(S,T),F=n?P?0:c(S,T):P?c(S+(S<0?ri:-ri),T):0;if(!f&&(y=A=P)&&u.lineStart(),P!==A&&(I=l(f,R),(!I||T_(f,I)||T_(R,I))&&(R[2]=1)),P!==A)w=0,P?(u.lineStart(),I=l(R,f),u.point(I[0],I[1])):(I=l(f,R),u.point(I[0],I[1],2),u.lineEnd()),f=I;else if(r&&f&&n^P){var D;!(F&d)&&(D=l(R,f,!0))&&(w=0,n?(u.lineStart(),u.point(D[0][0],D[0][1]),u.point(D[1][0],D[1][1]),u.lineEnd()):(u.point(D[1][0],D[1][1]),u.lineEnd(),u.lineStart(),u.point(D[0][0],D[0][1],3)))}P&&(!f||!T_(f,R))&&u.point(R[0],R[1]),f=R,A=P,d=F},lineEnd:function(){A&&u.lineEnd(),f=null},clean:function(){return w|(y&&A)<<1}}}function l(u,f,d){var A=Wc(u),y=Wc(f),w=[1,0,0],S=Ud(A,y),T=nw(S,S),R=S[0],I=T-R*R;if(!I)return!d&&u;var P=e*T/I,F=-e*R/I,D=Ud(w,S),L=iw(w,P),C=iw(S,F);_C(L,C);var B=D,k=nw(L,B),z=nw(B,B),G=k*k-z*(nw(L,L)-1);if(!(G<0)){var W=Wo(G),Y=iw(B,(-k-W)/z);if(_C(Y,L),Y=wg(Y),!d)return Y;var H=u[0],$=f[0],J=u[1],te=f[1],ce;$<H&&(ce=H,H=$,$=ce);var he=$-H,ve=si(he-ri)<In,Re=ve||he<In;if(!ve&&te<J&&(ce=J,J=te,te=ce),Re?ve?J+te>0^Y[1]<(si(Y[0]-H)<In?J:te):J<=Y[1]&&Y[1]<=te:he>ri^(H<=Y[0]&&Y[0]<=$)){var Qe=iw(B,(-k+W)/z);return _C(Qe,L),[Y,wg(Qe)]}}}function c(u,f){var d=n?i:ri-i,A=0;return u<-d?A|=1:u>d&&(A|=2),f<-d?A|=4:f>d&&(A|=8),A}return DC(o,a,s,n?[0,-i]:[-ri,i-ri])}function eJ(i,e,t,n,r,s){var o=i[0],a=i[1],l=e[0],c=e[1],u=0,f=1,d=l-o,A=c-a,y;if(y=t-o,!(!d&&y>0)){if(y/=d,d<0){if(y<u)return;y<f&&(f=y)}else if(d>0){if(y>f)return;y>u&&(u=y)}if(y=r-o,!(!d&&y<0)){if(y/=d,d<0){if(y>f)return;y>u&&(u=y)}else if(d>0){if(y<u)return;y<f&&(f=y)}if(y=n-a,!(!A&&y>0)){if(y/=A,A<0){if(y<u)return;y<f&&(f=y)}else if(A>0){if(y>f)return;y>u&&(u=y)}if(y=s-a,!(!A&&y<0)){if(y/=A,A<0){if(y>f)return;y>u&&(u=y)}else if(A>0){if(y<u)return;y<f&&(f=y)}return u>0&&(i[0]=o+u*d,i[1]=a+u*A),f<1&&(e[0]=o+f*d,e[1]=a+f*A),!0}}}}}var lw=1e9,NC=-lw;function RB(i,e,t,n){function r(c,u){return i<=c&&c<=t&&e<=u&&u<=n}function s(c,u,f,d){var A=0,y=0;if(c==null||(A=o(c,f))!==(y=o(u,f))||l(c,u)<0^f>0)do d.point(A===0||A===3?i:t,A>1?n:e);while((A=(A+f+4)%4)!==y);else d.point(u[0],u[1])}function o(c,u){return si(c[0]-i)<In?u>0?0:3:si(c[0]-t)<In?u>0?2:1:si(c[1]-e)<In?u>0?1:0:u>0?3:2}function a(c,u){return l(c.x,u.x)}function l(c,u){var f=o(c,1),d=o(u,1);return f!==d?f-d:f===0?u[1]-c[1]:f===1?c[0]-u[0]:f===2?c[1]-u[1]:u[0]-c[0]}return function(c){var u=c,f=RC(),d,A,y,w,S,T,R,I,P,F,D,L={point:C,lineStart:G,lineEnd:W,polygonStart:k,polygonEnd:z};function C(H,$){r(H,$)&&u.point(H,$)}function B(){for(var H=0,$=0,J=A.length;$<J;++$)for(var te=A[$],ce=1,he=te.length,ve=te[0],Re,Qe,Fe=ve[0],mt=ve[1];ce<he;++ce)Re=Fe,Qe=mt,ve=te[ce],Fe=ve[0],mt=ve[1],Qe<=n?mt>n&&(Fe-Re)*(n-Qe)>(mt-Qe)*(i-Re)&&++H:mt<=n&&(Fe-Re)*(n-Qe)<(mt-Qe)*(i-Re)&&--H;return H}function k(){u=f,d=[],A=[],D=!0}function z(){var H=B(),$=D&&H,J=(d=Zh(d)).length;($||J)&&(c.polygonStart(),$&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),J&&IC(d,a,H,s,c),c.polygonEnd()),u=c,d=A=y=null}function G(){L.point=Y,A&&A.push(y=[]),F=!0,P=!1,R=I=NaN}function W(){d&&(Y(w,S),T&&P&&f.rejoin(),d.push(f.result())),L.point=C,P&&u.lineEnd()}function Y(H,$){var J=r(H,$);if(A&&y.push([H,$]),F)w=H,S=$,T=J,F=!1,J&&(u.lineStart(),u.point(H,$));else if(J&&P)u.point(H,$);else{var te=[R=Math.max(NC,Math.min(lw,R)),I=Math.max(NC,Math.min(lw,I))],ce=[H=Math.max(NC,Math.min(lw,H)),$=Math.max(NC,Math.min(lw,$))];eJ(te,ce,i,e,t,n)?(P||(u.lineStart(),u.point(te[0],te[1])),u.point(ce[0],ce[1]),J||u.lineEnd(),D=!1):J&&(u.lineStart(),u.point(H,$),D=!1)}R=H,I=$,P=J}return L}}var PB,IB,FC,BC,E_={sphere:ms,point:ms,lineStart:S2e,lineEnd:ms,polygonStart:ms,polygonEnd:ms};function S2e(){E_.point=E2e,E_.lineEnd=T2e}function T2e(){E_.point=E_.lineEnd=ms}function E2e(i,e){i*=_n,e*=_n,IB=i,FC=un(e),BC=mn(e),E_.point=M2e}function M2e(i,e){i*=_n,e*=_n;var t=un(e),n=mn(e),r=si(i-IB),s=mn(r),o=un(r),a=n*o,l=BC*t-FC*n*s,c=FC*t+BC*n*s;PB.add(Ms(Wo(a*a+l*l),c)),IB=i,FC=t,BC=n}function tJ(i){return PB=new Ho,X0(i,E_),+PB}var LB=[null,null],C2e={type:"LineString",coordinates:LB};function Ml(i,e){return LB[0]=i,LB[1]=e,tJ(C2e)}var nJ={Feature:function(i,e){return OC(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)if(OC(t[n].geometry,e))return!0;return!1}},iJ={Sphere:function(){return!0},Point:function(i,e){return rJ(i.coordinates,e)},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(rJ(t[n],e))return!0;return!1},LineString:function(i,e){return sJ(i.coordinates,e)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(sJ(t[n],e))return!0;return!1},Polygon:function(i,e){return oJ(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(oJ(t[n],e))return!0;return!1},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)if(OC(t[n],e))return!0;return!1}};function OC(i,e){return i&&iJ.hasOwnProperty(i.type)?iJ[i.type](i,e):!1}function rJ(i,e){return Ml(i,e)===0}function sJ(i,e){for(var t,n,r,s=0,o=i.length;s<o;s++){if(n=Ml(i[s],e),n===0||s>0&&(r=Ml(i[s],i[s-1]),r>0&&t<=r&&n<=r&&(t+n-r)*(1-Math.pow((t-n)/r,2))<bg*r))return!0;t=n}return!1}function oJ(i,e){return!!LC(i.map(R2e),aJ(e))}function R2e(i){return i=i.map(aJ),i.pop(),i}function aJ(i){return[i[0]*_n,i[1]*_n]}function DB(i,e){return(i&&nJ.hasOwnProperty(i.type)?nJ[i.type]:OC)(i,e)}function lJ(i,e,t){var n=Od(i,e-In,t).concat(e);return function(r){return n.map(function(s){return[r,s]})}}function cJ(i,e,t){var n=Od(i,e-In,t).concat(e);return function(r){return n.map(function(s){return[s,r]})}}function NB(){var i,e,t,n,r,s,o,a,l=10,c=l,u=90,f=360,d,A,y,w,S=2.5;function T(){return{type:"MultiLineString",coordinates:R()}}function R(){return Od(ew(n/u)*u,t,u).map(y).concat(Od(ew(a/f)*f,o,f).map(w)).concat(Od(ew(e/l)*l,i,l).filter(function(I){return si(I%u)>In}).map(d)).concat(Od(ew(s/c)*c,r,c).filter(function(I){return si(I%f)>In}).map(A))}return T.lines=function(){return R().map(function(I){return{type:"LineString",coordinates:I}})},T.outline=function(){return{type:"Polygon",coordinates:[y(n).concat(w(o).slice(1),y(t).reverse().slice(1),w(a).reverse().slice(1))]}},T.extent=function(I){return arguments.length?T.extentMajor(I).extentMinor(I):T.extentMinor()},T.extentMajor=function(I){return arguments.length?(n=+I[0][0],t=+I[1][0],a=+I[0][1],o=+I[1][1],n>t&&(I=n,n=t,t=I),a>o&&(I=a,a=o,o=I),T.precision(S)):[[n,a],[t,o]]},T.extentMinor=function(I){return arguments.length?(e=+I[0][0],i=+I[1][0],s=+I[0][1],r=+I[1][1],e>i&&(I=e,e=i,i=I),s>r&&(I=s,s=r,r=I),T.precision(S)):[[e,s],[i,r]]},T.step=function(I){return arguments.length?T.stepMajor(I).stepMinor(I):T.stepMinor()},T.stepMajor=function(I){return arguments.length?(u=+I[0],f=+I[1],T):[u,f]},T.stepMinor=function(I){return arguments.length?(l=+I[0],c=+I[1],T):[l,c]},T.precision=function(I){return arguments.length?(S=+I,d=lJ(s,r,90),A=cJ(e,i,S),y=lJ(a,o,90),w=cJ(n,t,S),T):S},T.extentMajor([[-180,-90+In],[180,90-In]]).extentMinor([[-180,-80-In],[180,80+In]])}function FB(){return NB()()}function Eg(i,e){var t=i[0]*_n,n=i[1]*_n,r=e[0]*_n,s=e[1]*_n,o=mn(n),a=un(n),l=mn(s),c=un(s),u=o*mn(t),f=o*un(t),d=l*mn(r),A=l*un(r),y=2*da(Wo(pB(s-n)+o*l*pB(r-t))),w=un(y),S=y?function(T){var R=un(T*=y)/w,I=un(y-T)/w,P=I*u+R*d,F=I*f+R*A,D=I*a+R*c;return[Ms(F,P)*ur,Ms(D,Wo(P*P+F*F))*ur]}:function(){return[t*ur,n*ur]};return S.distance=y,S}var BB=i=>i;var M_=1/0,UC=M_,cw=-M_,kC=cw,P2e={point:I2e,lineStart:ms,lineEnd:ms,polygonStart:ms,polygonEnd:ms,result:function(){var i=[[M_,UC],[cw,kC]];return cw=kC=-(UC=M_=1/0),i}};function I2e(i,e){i<M_&&(M_=i),i>cw&&(cw=i),e<UC&&(UC=e),e>kC&&(kC=e)}var OB=P2e;function uw(i){return function(e){var t=new UB;for(var n in i)t[n]=i[n];return t.stream=e,t}}function UB(){}UB.prototype={constructor:UB,point:function(i,e){this.stream.point(i,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function kB(i,e,t){var n=i.clipExtent&&i.clipExtent();return i.scale(150).translate([0,0]),n!=null&&i.clipExtent(null),X0(t,i.stream(OB)),e(OB.result()),n!=null&&i.clipExtent(n),i}function zB(i,e,t){return kB(i,function(n){var r=e[1][0]-e[0][0],s=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),s/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,l=+e[0][1]+(s-o*(n[1][1]+n[0][1]))/2;i.scale(150*o).translate([a,l])},t)}function uJ(i,e,t){return zB(i,[[0,0],e],t)}function hJ(i,e,t){return kB(i,function(n){var r=+e,s=r/(n[1][0]-n[0][0]),o=(r-s*(n[1][0]+n[0][0]))/2,a=-s*n[0][1];i.scale(150*s).translate([o,a])},t)}function fJ(i,e,t){return kB(i,function(n){var r=+e,s=r/(n[1][1]-n[0][1]),o=-s*n[0][0],a=(r-s*(n[1][1]+n[0][1]))/2;i.scale(150*s).translate([o,a])},t)}var dJ=16,L2e=mn(30*_n);function VB(i,e){return+e?N2e(i,e):D2e(i)}function D2e(i){return uw({point:function(e,t){e=i(e,t),this.stream.point(e[0],e[1])}})}function N2e(i,e){function t(n,r,s,o,a,l,c,u,f,d,A,y,w,S){var T=c-n,R=u-r,I=T*T+R*R;if(I>4*e&&w--){var P=o+d,F=a+A,D=l+y,L=Wo(P*P+F*F+D*D),C=da(D/=L),B=si(si(D)-1)<In||si(s-f)<In?(s+f)/2:Ms(F,P),k=i(B,C),z=k[0],G=k[1],W=z-n,Y=G-r,H=R*W-T*Y;(H*H/I>e||si((T*W+R*Y)/I-.5)>.3||o*d+a*A+l*y<L2e)&&(t(n,r,s,o,a,l,z,G,B,P/=L,F/=L,D,w,S),S.point(z,G),t(z,G,B,P,F,D,c,u,f,d,A,y,w,S))}}return function(n){var r,s,o,a,l,c,u,f,d,A,y,w,S={point:T,lineStart:R,lineEnd:P,polygonStart:function(){n.polygonStart(),S.lineStart=F},polygonEnd:function(){n.polygonEnd(),S.lineStart=R}};function T(C,B){C=i(C,B),n.point(C[0],C[1])}function R(){f=NaN,S.point=I,n.lineStart()}function I(C,B){var k=Wc([C,B]),z=i(C,B);t(f,d,u,A,y,w,f=z[0],d=z[1],u=C,A=k[0],y=k[1],w=k[2],dJ,n),n.point(f,d)}function P(){S.point=T,n.lineEnd()}function F(){R(),S.point=D,S.lineEnd=L}function D(C,B){I(r=C,B),s=f,o=d,a=A,l=y,c=w,S.point=I}function L(){t(f,d,u,A,y,w,s,o,r,a,l,c,dJ,n),S.lineEnd=P,P()}return S}}var F2e=uw({point:function(i,e){this.stream.point(i*_n,e*_n)}});function B2e(i){return uw({point:function(e,t){var n=i(e,t);return this.stream.point(n[0],n[1])}})}function O2e(i,e,t,n,r){function s(o,a){return o*=n,a*=r,[e+i*o,t-i*a]}return s.invert=function(o,a){return[(o-e)/i*n,(t-a)/i*r]},s}function pJ(i,e,t,n,r,s){if(!s)return O2e(i,e,t,n,r);var o=mn(s),a=un(s),l=o*i,c=a*i,u=o/i,f=a/i,d=(a*t-o*e)/i,A=(a*e+o*t)/i;function y(w,S){return w*=n,S*=r,[l*w-c*S+e,t-c*w-l*S]}return y.invert=function(w,S){return[n*(u*w-f*S+d),r*(A-f*w-u*S)]},y}function GB(i){return U2e(function(){return i})()}function U2e(i){var e,t=150,n=480,r=250,s=0,o=0,a=0,l=0,c=0,u,f=0,d=1,A=1,y=null,w=CB,S=null,T,R,I,P=BB,F=.5,D,L,C,B,k;function z(H){return C(H[0]*_n,H[1]*_n)}function G(H){return H=C.invert(H[0],H[1]),H&&[H[0]*ur,H[1]*ur]}z.stream=function(H){return B&&k===H?B:B=F2e(B2e(u)(w(D(P(k=H)))))},z.preclip=function(H){return arguments.length?(w=H,y=void 0,Y()):w},z.postclip=function(H){return arguments.length?(P=H,S=T=R=I=null,Y()):P},z.clipAngle=function(H){return arguments.length?(w=+H?JQ(y=H*_n):(y=null,CB),Y()):y*ur},z.clipExtent=function(H){return arguments.length?(P=H==null?(S=T=R=I=null,BB):RB(S=+H[0][0],T=+H[0][1],R=+H[1][0],I=+H[1][1]),Y()):S==null?null:[[S,T],[R,I]]},z.scale=function(H){return arguments.length?(t=+H,W()):t},z.translate=function(H){return arguments.length?(n=+H[0],r=+H[1],W()):[n,r]},z.center=function(H){return arguments.length?(s=H[0]%360*_n,o=H[1]%360*_n,W()):[s*ur,o*ur]},z.rotate=function(H){return arguments.length?(a=H[0]%360*_n,l=H[1]%360*_n,c=H.length>2?H[2]%360*_n:0,W()):[a*ur,l*ur,c*ur]},z.angle=function(H){return arguments.length?(f=H%360*_n,W()):f*ur},z.reflectX=function(H){return arguments.length?(d=H?-1:1,W()):d<0},z.reflectY=function(H){return arguments.length?(A=H?-1:1,W()):A<0},z.precision=function(H){return arguments.length?(D=VB(L,F=H*H),Y()):Wo(F)},z.fitExtent=function(H,$){return zB(z,H,$)},z.fitSize=function(H,$){return uJ(z,H,$)},z.fitWidth=function(H,$){return hJ(z,H,$)},z.fitHeight=function(H,$){return fJ(z,H,$)};function W(){var H=pJ(t,0,0,d,A,f).apply(null,e(s,o)),$=pJ(t,n-H[0],r-H[1],d,A,f);return u=TB(a,l,c),L=aw(e,$),C=aw(u,L),D=VB(L,F),Y()}function Y(){return B=k=null,z}return function(){return e=i.apply(this,arguments),z.invert=e.invert&&G,W()}}function mJ(i){return function(e,t){var n=Wo(e*e+t*t),r=i(n),s=un(r),o=mn(r);return[Ms(e*s,n*o),da(n&&t*s/n)]}}function hw(i,e){return[i,SQ(EQ((yo+e)/2))]}hw.invert=function(i,e){return[i,2*w_(wQ(e))-yo]};function qB(i,e){var t=mn(e),n=1+mn(i)*t;return[t*un(i)/n,un(e)/n]}qB.invert=mJ(function(i){return 2*w_(i)});function HB(){return GB(qB).scale(250).clipAngle(142)}function XB(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function k2e(i){if(Array.isArray(i))return i}function z2e(i){if(Array.isArray(i))return XB(i)}function fw(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function V2e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function G2e(i,e,t){return e=qC(e),Q2e(i,xJ()?Reflect.construct(e,[],qC(i).constructor):e.apply(i,t))}function _J(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function q2e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function oi(i,e){return i.get(fw(i,e))}function Y0(i,e,t){_J(i,e),e.set(i,t)}function Z0(i,e,t){return i.set(fw(i,e),t),t}function H2e(i,e){_J(i,e),e.add(i)}function W2e(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,bJ(n.key),n)}}function j2e(i,e,t){return e&&W2e(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function C_(i,e,t){return(e=bJ(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function qC(i){return qC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},qC(i)}function X2e(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&$B(i,e)}function xJ(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(xJ=function(){return!!i})()}function $2e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Y2e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Z2e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4119+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function K2e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4120+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Q2e(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return V2e(i)}function $B(i,e){return $B=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},$B(i,e)}function GC(i,e){return k2e(i)||Y2e(i,e)||wJ(i,e)||Z2e()}function yJ(i){return z2e(i)||$2e(i)||wJ(i)||K2e()}function J2e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function bJ(i){var e=J2e(i,"string");return typeof e=="symbol"?e:e+""}function wJ(i,e){if(i){if(typeof i=="string")return XB(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?XB(i,e):void 0}}var SJ=function(e){e instanceof Array?e.forEach(SJ):(e.map&&e.map.dispose(),e.dispose())},YB=function(e){e.geometry&&e.geometry.dispose(),e.material&&SJ(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(YB)};function TJ(i,e,t){var n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return{x:t*Math.sin(n)*Math.cos(r),y:t*Math.cos(n),z:t*Math.sin(n)*Math.sin(r)}}function ebe(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),o=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-o*180/Math.PI-(o<-Math.PI/2?360:0),r}}function Mg(i){return i*Math.PI/180}var EJ=function(e){return 1-(hw(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},WB=function(e){return Math.max(0,Math.min(1,EJ(e)))},AJ=function(e){return .5-hw.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},tbe=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=Tl().domain([1,0]).range([t,n]).clamp(!0),s=Tl().domain([WB(t),WB(n)]).range([1,0]).clamp(!0),o=function(f){return s(WB(r(f)))},a=e.array,l=0,c=a.length;l<c;l+=2)a[l+1]=o(a[l+1]);e.needsUpdate=!0},gJ=function(e,t,n,r){var s=Math.pow(2,e),o=Math.max(0,Math.min(s-1,Math.floor((n+180)*s/360))),a=(90-r)/180;t&&(a=Math.max(0,Math.min(1,EJ(a))));var l=Math.floor(a*s);return[o,l]},ZB=function(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0,a=[],l=Math.pow(2,e),c=360/l,u=180/l,f=s===void 0?l-1:s,d=o===void 0?l-1:o,A=n,y=Math.min(l-1,f);A<=y;A++)for(var w=r,S=Math.min(l-1,d);w<=S;w++){var T=w,R=u;if(t){T=w===0?w:AJ(w/l)*l;var I=w+1===l?w+1:AJ((w+1)/l)*l;R=(I-T)*180/l}var P=-180+(A+.5)*c,F=90-(T*180/l+R/2),D=R;a.push({x:A,y:w,lng:P,lat:F,latLen:D})}return a},nbe=6,ibe=7,rbe=3,sbe=90,tf=new WeakMap,K0=new WeakMap,jB=new WeakMap,zC=new WeakMap,jc=new WeakMap,HC=new WeakMap,R_=new WeakMap,Cg=new WeakMap,VC=new WeakSet,MJ=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.tileUrl,o=r.minLevel,a=o===void 0?0:o,l=r.maxLevel,c=l===void 0?17:l,u=r.mercatorProjection,f=u===void 0?!0:u;return q2e(this,e),n=G2e(this,e),H2e(n,VC),Y0(n,tf,void 0),Y0(n,K0,void 0),Y0(n,jB,void 0),Y0(n,zC,void 0),Y0(n,jc,{}),Y0(n,HC,void 0),Y0(n,R_,void 0),Y0(n,Cg,void 0),C_(n,"minLevel",void 0),C_(n,"maxLevel",void 0),C_(n,"thresholds",yJ(new Array(30)).map(function(d,A){return 8/Math.pow(2,A)})),C_(n,"curvatureResolution",5),C_(n,"tileMargin",0),C_(n,"clearTiles",function(){Object.values(oi(jc,n)).forEach(function(d){d.forEach(function(A){A.obj&&(n.remove(A.obj),YB(A.obj),delete A.obj)})}),Z0(jc,n,{})}),Z0(tf,n,t),n.tileUrl=s,Z0(K0,n,f),n.minLevel=a,n.maxLevel=c,n.level=0,n.add(Z0(Cg,n,new Hn(new Va(oi(tf,n)*.99,180,90),new fs({color:0})))),oi(Cg,n).visible=!1,oi(Cg,n).material.polygonOffset=!0,oi(Cg,n).material.polygonOffsetUnits=3,oi(Cg,n).material.polygonOffsetFactor=1,n}return X2e(e,i),j2e(e,[{key:"tileUrl",get:function(){return oi(jB,this)},set:function(n){Z0(jB,this,n),this.updatePov(oi(R_,this))}},{key:"level",get:function(){return oi(zC,this)},set:function(n){var r,s=this;oi(jc,this)[n]||fw(VC,this,obe).call(this,n);var o=oi(zC,this);if(Z0(zC,this,n),!(n===o||o===void 0)){if(oi(Cg,this).visible=n>0,oi(jc,this)[n].forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!0)}),o<n&&((r=oi(jc,this)[o])===null||r===void 0||r.forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!1)})),o>n)for(var a=n+1;a<=o;a++)oi(jc,this)[a]&&oi(jc,this)[a].forEach(function(l){l.obj&&(s.remove(l.obj),YB(l.obj),delete l.obj)});fw(VC,this,vJ).call(this)}}},{key:"updatePov",value:function(n){var r=this;if(!(!n||!(n instanceof Id))){Z0(R_,this,n);var s;if(Z0(HC,this,function(u){if(!u.hullPnts){var f=360/Math.pow(2,r.level),d=u.lng,A=u.lat,y=u.latLen,w=d-f/2,S=d+f/2,T=A-y/2,R=A+y/2;u.hullPnts=[[A,d],[T,w],[R,w],[T,S],[R,S]].map(function(I){var P=GC(I,2),F=P[0],D=P[1];return TJ(F,D,oi(tf,r))}).map(function(I){var P=I.x,F=I.y,D=I.z;return new re(P,F,D)})}return s||(s=new zc,n.updateMatrix(),n.updateMatrixWorld(),s.setFromProjectionMatrix(new cn().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse))),u.hullPnts.some(function(I){return s.containsPoint(I.clone().applyMatrix4(r.matrixWorld))})}),this.tileUrl){var o=n.position.clone(),a=o.distanceTo(this.getWorldPosition(new re)),l=(a-oi(tf,this))/oi(tf,this),c=this.thresholds.findIndex(function(u){return u&&u<=l});this.level=Math.min(this.maxLevel,Math.max(this.minLevel,c<0?this.thresholds.length:c)),fw(VC,this,vJ).call(this)}}}}])})(Br);function obe(i){var e=this;if(i>ibe){oi(jc,this)[i]=[];return}var t=oi(jc,this)[i]=ZB(i,oi(K0,this));t.forEach(function(n){return n.centroid=TJ(n.lat,n.lng,oi(tf,e))}),t.octree=Wb().x(function(n){return n.centroid.x}).y(function(n){return n.centroid.y}).z(function(n){return n.centroid.z}).addAll(t)}function vJ(){var i=this;if(!(!this.tileUrl||this.level===void 0||!oi(jc,this).hasOwnProperty(this.level))&&!(!oi(HC,this)&&this.level>nbe)){var e=oi(jc,this)[this.level];if(oi(R_,this)){var t=this.worldToLocal(oi(R_,this).position.clone());if(e.octree){var n,r=this.worldToLocal(oi(R_,this).position.clone()),s=(r.length()-oi(tf,this))*rbe;e=(n=e.octree).findAllWithinRadius.apply(n,yJ(r).concat([s]))}else{var o=ebe(t),a=(o.r/oi(tf,this)-1)*sbe,l=a/Math.cos(Mg(o.lat)),c=[o.lng-l,o.lng+l],u=[o.lat+a,o.lat-a],f=gJ(this.level,oi(K0,this),c[0],u[0]),d=GC(f,2),A=d[0],y=d[1],w=gJ(this.level,oi(K0,this),c[1],u[1]),S=GC(w,2),T=S[0],R=S[1];!e.record&&(e.record={});var I=e.record;if(!I.hasOwnProperty("".concat(Math.round((A+T)/2),"_").concat(Math.round((y+R)/2))))e=ZB(this.level,oi(K0,this),A,y,T,R).map(function(C){var B="".concat(C.x,"_").concat(C.y);return I.hasOwnProperty(B)?I[B]:(I[B]=C,e.push(C),C)});else{for(var P=[],F=A;F<=T;F++)for(var D=y;D<=R;D++){var L="".concat(F,"_").concat(D);I.hasOwnProperty(L)||(I[L]=ZB(this.level,oi(K0,this),F,D,F,D)[0],e.push(I[L])),P.push(I[L])}e=P}}}e.filter(function(C){return!C.obj}).filter(oi(HC,this)||function(){return!0}).forEach(function(C){var B=C.x,k=C.y,z=C.lng,G=C.lat,W=C.latLen,Y=360/Math.pow(2,i.level);if(!C.obj){var H=Y*(1-i.tileMargin),$=W*(1-i.tileMargin),J=Mg(z),te=Mg(-G),ce=new Hn(new Va(oi(tf,i),Math.ceil(H/i.curvatureResolution),Math.ceil($/i.curvatureResolution),Mg(90-H/2)+J,Mg(H),Mg(90-$/2)+te,Mg($)),new Ga);if(oi(K0,i)){var he=[G+W/2,G-W/2].map(function(Fe){return .5-Fe/180}),ve=GC(he,2),Re=ve[0],Qe=ve[1];tbe(ce.geometry.attributes.uv,Re,Qe)}C.obj=ce}C.loading||(C.loading=!0,new bl().load(i.tileUrl(B,k,i.level),function(Fe){var mt=C.obj;mt&&(Fe.colorSpace=Fr,mt.material.map=Fe,mt.material.color=null,mt.material.needsUpdate=!0,i.add(mt)),C.loading=!1}))})}}var Aw=new Set,KB=!1;function rO(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length;Aw.size&&Aw.clear();let s=IJ(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a=0,l=0,c=0;if(n&&(s=hbe(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let d=t;d<r;d+=t){let A=i[d],y=i[d+1];A<a&&(a=A),y<l&&(l=y),A>u&&(u=A),y>f&&(f=y)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return QB(s,o,a,l,c),o}function IJ(i,e,t,n,r){let s=null;if(r===Sbe(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=PJ(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=PJ(o/n|0,i[o],i[o+1],s);return s&&gw(s,s.next)&&(_w(s),s=s.next),s}function Pg(i,e=i){let t=e===i,n=i,r;do r=!1,n!==n.next&&(Aw.size===0||!Aw.has(n))&&(gw(n,n.next)||js(n.prev,n,n.next)===0)?((t||n===e)&&(e=n.prev),KB=!0,_w(n),n=n.prev,r=!0):(t||n!==e)&&(n=n.next,r=!t);while(r||n!==e);return e}function QB(i,e,t,n,r){r&&vbe(i,t,n,r);let s=i,o=!1;for(;i.prev!==i.next;){let a=i.prev,l=i.next;if(js(a,i,l)<0&&(r?lbe(i,t,n,r):abe(i))){e.push(a.i,i.i,l.i),_w(i),i=l,s=l;continue}if(i=l,i===s){if(KB=!1,i=Pg(i),KB){s=i;continue}if(!o){i=cbe(i,e),s=i,o=!0;continue}ube(i,e,t,n,r);break}}}function abe(i){let e=i.prev,t=i,n=i.next,r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=Math.min(r,s,o),f=Math.min(a,l,c),d=Math.max(r,s,o),A=Math.max(a,l,c),y=n.next;for(;y!==e;){if(y.x>=u&&y.x<=d&&y.y>=f&&y.y<=A&&!(r===y.x&&a===y.y)&&$C(r,a,s,l,o,c,y.x,y.y)&&js(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function lbe(i,e,t,n){let r=i.prev,s=i,o=i.next,a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,d=o.y,A=Math.min(a,l,c),y=Math.min(u,f,d),w=Math.max(a,l,c),S=Math.max(u,f,d),T=nO(A,y,e,t,n),R=nO(w,S,e,t,n),I=i.prevZ;for(;I&&I.z>=T;){if(I.x>=A&&I.x<=w&&I.y>=y&&I.y<=S&&I!==o&&!(a===I.x&&u===I.y)&&$C(a,u,l,f,c,d,I.x,I.y)&&js(I.prev,I,I.next)>=0)return!1;I=I.prevZ}let P=i.nextZ;for(;P&&P.z<=R;){if(P.x>=A&&P.x<=w&&P.y>=y&&P.y<=S&&P!==o&&!(a===P.x&&u===P.y)&&$C(a,u,l,f,c,d,P.x,P.y)&&js(P.prev,P,P.next)>=0)return!1;P=P.nextZ}return!0}function cbe(i,e){let t=i,n=!1;do{let r=t.prev,s=t.next.next;NJ(r,t,t.next,s,!1)&&vw(r,s)&&vw(s,r)&&(e.push(r.i,t.i,s.i),_w(t),_w(t.next),t=i=s,n=!0),t=t.next}while(t!==i);return n?Pg(t):t}function ube(i,e,t,n,r){let s=i;do{let o=s.next.next;for(;o!==s.prev;){if(s.i!==o.i&&ybe(s,o)){let a=FJ(s,o);s=Pg(s,s.next),a=Pg(a,a.next),QB(s,e,t,n,r),QB(a,e,t,n,r);return}o=o.next}s=s.next}while(s!==i)}var JB=!1;function hbe(i,e,t,n){let r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s]*n,l=s<o-1?e[s+1]*n:i.length,c=IJ(i,a,l,n,!1);c===c.next&&Aw.add(c),r.push(xbe(c))}r.sort(fbe),pbe(i.length/n,e.length),DJ(t,t),JB=!0;for(let s=0;s<r.length;s++)t=dbe(r[s],t);return JB=!1,Pg(t)}function fbe(i,e){return i.x-e.x||i.y-e.y||(i.next.y-i.y)/(i.next.x-i.x)-(e.next.y-e.y)/(e.next.x-e.x)}function dbe(i,e){let t=Abe(i,e);if(!t)return e;let n=FJ(t,i),r=n.next;return DJ(t,r.next),Pg(n,n.next),Pg(t,t.next)}var LJ=16,gs=new Float64Array(0),XC=0,eO=[],tO=[];function pbe(i,e){let t=Math.ceil((i+2*e)/LJ)+e+2;gs.length<t*4&&(gs=new Float64Array(t*4)),XC=0}function DJ(i,e){let t=i;do{let n=XC++;eO[n]=t;let r=1/0,s=1/0,o=-1/0,a=-1/0,l=0;do{let u=t.next;t.z=n,t.x<r&&(r=t.x),t.x>o&&(o=t.x),t.y<s&&(s=t.y),t.y>a&&(a=t.y),u.x<r&&(r=u.x),u.x>o&&(o=u.x),u.y<s&&(s=u.y),u.y>a&&(a=u.y),t=u}while(++l<LJ&&t!==e);tO[n]=t;let c=n*4;gs[c]=r,gs[c+1]=s,gs[c+2]=o,gs[c+3]=a}while(t!==e)}function mbe(i,e){let t=i.z*4;e.x<gs[t]&&(gs[t]=e.x),e.y<gs[t+1]&&(gs[t+1]=e.y),e.x>gs[t+2]&&(gs[t+2]=e.x),e.y>gs[t+3]&&(gs[t+3]=e.y)}function CJ(i){let e=tO[i];for(;e.prev.next!==e;)e=e.next;return tO[i]=e,e}function RJ(i){let e=eO[i];for(;e.prev.next!==e;)e=e.next;return eO[i]=e,e}function Abe(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(gw(i,t))return t;for(let d=0,A=0;d<XC;d++,A+=4){if(r<gs[A+1]||r>gs[A+3]||gs[A]>n||gs[A+2]<=s)continue;let y=CJ(d);t=RJ(d);do{if(t.prev.next===t){if(gw(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){let w=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(w<=n&&w>s&&(s=w,o=t.x<t.next.x?t:t.next,w===n))return o}}t=t.next}while(t!==y)}if(!o)return null;let a=o.x,l=o.y,c=Math.min(r,l),u=Math.max(r,l),f=1/0;for(let d=0,A=0;d<XC;d++,A+=4){if(gs[A+2]<a||gs[A]>n||gs[A+3]<c||gs[A+1]>u)continue;let y=CJ(d);t=RJ(d);do{if(t.prev.next===t&&n>=t.x&&t.x>=a&&n!==t.x&&$C(r<l?n:s,r,a,l,r<l?s:n,r,t.x,t.y)){let w=Math.abs(r-t.y)/(n-t.x);(vw(t,i)||t.y===r&&t.next.y===r&&t.next.x>n)&&(w<f||w===f&&(t.x>o.x||t.x===o.x&&gbe(o,t)))&&(o=t,f=w)}t=t.next}while(t!==y)}return o}function gbe(i,e){return js(i.prev,i,e.prev)<0&&js(e.next,i,i.next)<0}var Xc=[],dw=[],Rg=new Uint32Array(0),pw=new Uint32Array(0),mw=new Uint32Array(256);function vbe(i,e,t,n){let r=i,s=0;do r.z=nO(r.x,r.y,e,t,n),Xc[s++]=r,r=r.next;while(r!==i);_be(s);let o=null;for(let a=0;a<s;a++){let l=Xc[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function _be(i){if(i<=32){for(let e=1;e<i;e++){let t=Xc[e],n=t.z,r=e-1;for(;r>=0&&Xc[r].z>n;)Xc[r+1]=Xc[r],r--;Xc[r+1]=t}return}Rg.length<i&&(Rg=new Uint32Array(i),pw=new Uint32Array(i),dw=new Array(i));for(let e=0;e<i;e++)Rg[e]=Xc[e].z;WC(i,Xc,Rg,dw,pw,0),WC(i,dw,pw,Xc,Rg,8),WC(i,Xc,Rg,dw,pw,16),WC(i,dw,pw,Xc,Rg,24)}function WC(i,e,t,n,r,s){mw.fill(0);for(let a=0;a<i;a++)mw[t[a]>>>s&255]++;let o=0;for(let a=0;a<256;a++){let l=mw[a];mw[a]=o,o+=l}for(let a=0;a<i;a++){let l=t[a],c=mw[l>>>s&255]++;n[c]=e[a],r[c]=l}}function nO(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function xbe(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function $C(i,e,t,n,r,s,o,a){return(r-o)*(e-a)>=(i-o)*(s-a)&&(i-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(n-a)}function ybe(i,e){let t=gw(i,e)&&js(i.prev,i,i.next)>0&&js(e.prev,e,e.next)>0;return i.next.i!==e.i&&(t||vw(i,e)&&vw(e,i)&&(js(i.prev,i,e.prev)!==0||js(i,e.prev,e)!==0))&&!bbe(i,e)&&(t||wbe(i,e))}function js(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function gw(i,e){return i.x===e.x&&i.y===e.y}function NJ(i,e,t,n,r=!0){let s=js(i,e,t),o=js(i,e,n),a=js(t,n,i),l=js(t,n,e);return(s>0&&o<0||s<0&&o>0)&&(a>0&&l<0||a<0&&l>0)?!0:r?!!(s===0&&jC(i,t,e)||o===0&&jC(i,n,e)||a===0&&jC(t,i,n)||l===0&&jC(t,e,n)):!1}function jC(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function bbe(i,e){let t=Math.min(i.x,e.x),n=Math.max(i.x,e.x),r=Math.min(i.y,e.y),s=Math.max(i.y,e.y),o=i;do{let a=o.next;if(o.x>n&&a.x>n||o.x<t&&a.x<t||o.y>s&&a.y>s||o.y<r&&a.y<r){o=a;continue}if(o.i!==i.i&&a.i!==i.i&&o.i!==e.i&&a.i!==e.i&&NJ(o,a,i,e))return!0;o=a}while(o!==i);return!1}function vw(i,e){return js(i.prev,i,i.next)<0?js(i,e,i.next)>=0&&js(i,i.prev,e)>=0:js(i,e,i.prev)<0||js(i,i.next,e)<0}function wbe(i,e){let t=i,n=!1,r=(i.x+e.x)/2,s=(i.y+e.y)/2;do{let o=t.next;t.y>s!=o.y>s&&r<(o.x-t.x)*(s-t.y)/(o.y-t.y)+t.x&&(n=!n),t=o}while(t!==i);return n}function FJ(i,e){let t=iO(i.i,i.x,i.y),n=iO(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function PJ(i,e,t,n){let r=iO(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function _w(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ),JB&&mbe(i.prev,i.next)}function iO(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function Sbe(i,e,t,n){let r=0;for(let s=e,o=t-n;s<t;s+=n)r+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return r}function P_(i){let e=[],t=[],n=i[0][0].length,r=0,s=0;for(let o of i){for(let a of o)for(let l=0;l<n;l++)e.push(a[l]);s&&(r+=s,t.push(r)),s=o.length}return{vertices:e,holes:t,dimensions:n}}function oO(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function Tbe(i){if(Array.isArray(i))return i}function Ebe(i){if(Array.isArray(i))return oO(i)}function Mbe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Cbe(i,e,t){return e=YC(e),Obe(i,UJ()?Reflect.construct(e,[],YC(i).constructor):e.apply(i,t))}function Rbe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Pbe(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function Ibe(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=cO(i))||e){t&&(i=t);var n=0,r=function(){};return{s:r,n:function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.4121+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,o=!0,a=!1;return{s:function(){t=t.call(i)},n:function(){var l=t.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{o||t.return==null||t.return()}finally{if(a)throw s}}}}function YC(i){return YC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},YC(i)}function Lbe(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&aO(i,e)}function UJ(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(UJ=function(){return!!i})()}function Dbe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Nbe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Fbe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4122+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bbe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4123+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Obe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Mbe(i)}function aO(i,e){return aO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},aO(i,e)}function xw(i,e){return Tbe(i)||Nbe(i,e)||cO(i,e)||Fbe()}function Ube(i){return Ebe(i)||Dbe(i)||cO(i)||Bbe()}function cO(i,e){if(i){if(typeof i=="string")return oO(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?oO(i,e):void 0}}var BJ=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,n=[],r=null;return e.forEach(function(s){if(r){var o=Ml(s,r)*180/Math.PI;if(o>t)for(var a=Eg(r,s),l=r.length>2||s.length>2?Qh(r[2]||0,s[2]||0):null,c=l?function(d){return[].concat(Ube(a(d)),[l(d)])}:a,u=1/Math.ceil(o/t),f=u;f<1;)n.push(c(f)),f+=u}n.push(r=s)}),n},lO=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:Xn,Float32BufferAttribute:Ln},kbe=new lO.BufferGeometry().setAttribute?"setAttribute":"addAttribute",uO=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:5;Rbe(this,e),n=Cbe(this,e),n.type="GeoJsonGeometry",n.parameters={geoJson:t,radius:r,resolution:s};var o=({Point:u,MultiPoint:f,LineString:d,MultiLineString:A,Polygon:y,MultiPolygon:w}[t.type]||function(){return[]})(t.coordinates,r),a=[],l=[],c=0;o.forEach(function(S){var T=a.length;yw({indices:a,vertices:l},S),n.addGroup(T,a.length-T,c++)}),a.length&&n.setIndex(a),l.length&&n[kbe]("position",new lO.Float32BufferAttribute(l,3));function u(S,T){var R=sO(S[1],S[0],T+(S[2]||0)),I=[];return[{vertices:R,indices:I}]}function f(S,T){var R={vertices:[],indices:[]};return S.map(function(I){return u(I,T)}).forEach(function(I){var P=xw(I,1),F=P[0];yw(R,F)}),[R]}function d(S,T){for(var R=BJ(S,s).map(function(C){var B=xw(C,3),k=B[0],z=B[1],G=B[2],W=G===void 0?0:G;return sO(z,k,T+W)}),I=P_([R]),P=I.vertices,F=Math.round(P.length/3),D=[],L=1;L<F;L++)D.push(L-1,L);return[{vertices:P,indices:D}]}function A(S,T){var R={vertices:[],indices:[]};return S.map(function(I){return d(I,T)}).forEach(function(I){var P=xw(I,1),F=P[0];yw(R,F)}),[R]}function y(S,T){for(var R=S.map(function(H){return BJ(H,s).map(function($){var J=xw($,3),te=J[0],ce=J[1],he=J[2],ve=he===void 0?0:he;return sO(ce,te,T+ve)})}),I=P_(R),P=I.vertices,F=I.holes,D=F[0]||1/0,L=P.slice(0,D*3),C=P.slice(D*3),B=new Set(F),k=Math.round(P.length/3),z=[],G=[],W=1;W<k;W++)B.has(W)||(W<D?z.push(W-1,W):G.push(W-1-D,W-D));var Y=[{indices:z,vertices:L}];return F.length&&Y.push({indices:G,vertices:C}),Y}function w(S,T){var R={vertices:[],indices:[]},I={vertices:[],indices:[]};S.map(function(F){return y(F,T)}).forEach(function(F){var D=xw(F,2),L=D[0],C=D[1];yw(R,L),C&&yw(I,C)});var P=[R];return I.vertices.length&&P.push(I),P}return n}return Lbe(e,i),Pbe(e)})(lO.BufferGeometry);function yw(i,e){var t=Math.round(i.vertices.length/3);OJ(i.vertices,e.vertices),OJ(i.indices,e.indices.map(function(n){return n+t}))}function OJ(i,e){var t=Ibe(e),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;i.push(r)}}catch(s){t.e(s)}finally{t.f()}}function sO(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}var bw={};lhe(bw,{computeMikkTSpaceTangents:()=>zbe,computeMorphedAttributes:()=>$be,deepCloneAttribute:()=>Gbe,deinterleaveAttribute:()=>ZC,deinterleaveGeometry:()=>Hbe,estimateBytesUsed:()=>Wbe,interleaveAttributes:()=>qbe,mergeAttributes:()=>hO,mergeGeometries:()=>Vbe,mergeGroups:()=>Ybe,mergeVertices:()=>jbe,toCreasedNormals:()=>Zbe,toTrianglesDrawMode:()=>Xbe});function zbe(i,e,t=!0){if(!e||!e.isReady)throw new Error("THREE.BufferGeometryUtils: Initialized MikkTSpace library required.");if(!i.hasAttribute("position")||!i.hasAttribute("normal")||!i.hasAttribute("uv"))throw new Error('THREE.BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function n(o){if(o.normalized||o.isInterleavedBufferAttribute){let a=new Float32Array(o.count*o.itemSize);for(let l=0,c=0;l<o.count;l++)a[c++]=o.getX(l),a[c++]=o.getY(l),o.itemSize>2&&(a[c++]=o.getZ(l));return a}return o.array instanceof Float32Array?o.array:new Float32Array(o.array)}let r=i.index?i.toNonIndexed():i,s=e.generateTangents(n(r.attributes.position),n(r.attributes.normal),n(r.attributes.uv));if(t)for(let o=3;o<s.length;o+=4)s[o]*=-1;return r.setAttribute("tangent",new Hi(s,4)),i!==r&&i.copy(r),i}function Vbe(i,e=!1){let t=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),s={},o={},a=i[0].morphTargetsRelative,l=new Xn,c=0;for(let u=0;u<i.length;++u){let f=i[u],d=0;if(t!==(f.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let A in f.attributes){if(!n.has(A))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+A+'" attribute exists among all geometries, or in none of them.'),null;s[A]===void 0&&(s[A]=[]),s[A].push(f.attributes[A]),d++}if(d!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==f.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let A in f.morphAttributes){if(!r.has(A))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[A]===void 0&&(o[A]=[]),o[A].push(f.morphAttributes[A])}if(e){let A;if(t)A=f.index.count;else if(f.attributes.position!==void 0)A=f.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,A,u),c+=A}}if(t){let u=0,f=[];for(let d=0;d<i.length;++d){let A=i[d].index;for(let y=0;y<A.count;++y)f.push(A.getX(y)+u);u+=i[d].attributes.position.count}l.setIndex(f)}for(let u in s){let f=hO(s[u]);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,f)}for(let u in o){let f=o[u][0].length;if(f!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let d=0;d<f;++d){let A=[];for(let w=0;w<o[u].length;++w)A.push(o[u][w][d]);let y=hO(A);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(y)}}}return l}function hO(i){let e,t,n,r=-1,s=0;for(let c=0;c<i.length;++c){let u=i[c];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=u.itemSize),t!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=u.normalized),n!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=u.gpuType),r!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*t}let o=new e(s),a=new Hi(o,t,n),l=0;for(let c=0;c<i.length;++c){let u=i[c];if(u.isInterleavedBufferAttribute){let f=l/t;for(let d=0,A=u.count;d<A;d++)for(let y=0;y<t;y++){let w=u.getComponent(d,y);a.setComponent(d+f,y,w)}}else o.set(u.array,l);l+=u.count*t}return r!==void 0&&(a.gpuType=r),a}function Gbe(i){return i.isInstancedInterleavedBufferAttribute||i.isInterleavedBufferAttribute?ZC(i):i.isInstancedBufferAttribute?new Ql().copy(i):new Hi().copy(i)}function qbe(i){let e,t=0,n=0;for(let c=0,u=i.length;c<u;++c){let f=i[c];if(e===void 0&&(e=f.array.constructor),e!==f.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;t+=f.array.length,n+=f.itemSize}let r=new Rd(new e(t),n),s=0,o=[],a=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let c=0,u=i.length;c<u;c++){let f=i[c],d=f.itemSize,A=f.count,y=new Vo(r,d,s,f.normalized);o.push(y),s+=d;for(let w=0;w<A;w++)for(let S=0;S<d;S++)y[l[S]](w,f[a[S]](w))}return o}function ZC(i){let e=i.data.array.constructor,t=i.count,n=i.itemSize,r=i.normalized,s=new e(t*n),o;i.isInstancedInterleavedBufferAttribute?o=new Ql(s,n,r,i.meshPerAttribute):o=new Hi(s,n,r);for(let a=0;a<t;a++)o.setX(a,i.getX(a)),n>=2&&o.setY(a,i.getY(a)),n>=3&&o.setZ(a,i.getZ(a)),n>=4&&o.setW(a,i.getW(a));return o}function Hbe(i){let e=i.attributes,t=i.morphTargets,n=new Map;for(let r in e){let s=e[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,ZC(s)),e[r]=n.get(s))}for(let r in t){let s=t[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,ZC(s)),t[r]=n.get(s))}}function Wbe(i){let e=0;for(let n in i.attributes){let r=i.getAttribute(n);e+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}let t=i.getIndex();return e+=t?t.count*t.itemSize*t.array.BYTES_PER_ELEMENT:0,e}function jbe(i,e=1e-4){e=Math.max(e,Number.EPSILON);let t={},n=i.getIndex(),r=i.getAttribute("position"),s=n?n.count:r.count,o=0,a=Object.keys(i.attributes),l={},c={},u=[],f=["getX","getY","getZ","getW"],d=["setX","setY","setZ","setW"];for(let R=0,I=a.length;R<I;R++){let P=a[R],F=i.attributes[P];l[P]=new F.constructor(new F.array.constructor(F.count*F.itemSize),F.itemSize,F.normalized);let D=i.morphAttributes[P];D&&(c[P]||(c[P]=[]),D.forEach((L,C)=>{let B=new L.array.constructor(L.count*L.itemSize);c[P][C]=new L.constructor(B,L.itemSize,L.normalized)}))}let A=e*.5,y=Math.log10(1/e),w=Math.pow(10,y),S=A*w;for(let R=0;R<s;R++){let I=n?n.getX(R):R,P="";for(let F=0,D=a.length;F<D;F++){let L=a[F],C=i.getAttribute(L),B=C.itemSize;for(let k=0;k<B;k++)P+=`${~~(C[f[k]](I)*w+S)},`}if(P in t)u.push(t[P]);else{for(let F=0,D=a.length;F<D;F++){let L=a[F],C=i.getAttribute(L),B=i.morphAttributes[L],k=C.itemSize,z=l[L],G=c[L];for(let W=0;W<k;W++){let Y=f[W],H=d[W];if(z[H](o,C[Y](I)),B)for(let $=0,J=B.length;$<J;$++)G[$][H](o,B[$][Y](I))}}t[P]=o,u.push(o),o++}}let T=i.clone();for(let R in i.attributes){let I=l[R];if(T.setAttribute(R,new I.constructor(I.array.slice(0,o*I.itemSize),I.itemSize,I.normalized)),R in c)for(let P=0;P<c[R].length;P++){let F=c[R][P];T.morphAttributes[R][P]=new F.constructor(F.array.slice(0,o*F.itemSize),F.itemSize,F.normalized)}}return T.setIndex(u),T}function Xbe(i,e){if(e===Z8)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===OM||e===K8){let t=i.getIndex();if(t===null){let o=[],a=i.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);i.setIndex(o),t=i.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),i}let n=t.count-2,r=[];if(e===OM)for(let o=1;o<=n;o++)r.push(t.getX(0)),r.push(t.getX(o)),r.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2===0?(r.push(t.getX(o)),r.push(t.getX(o+1)),r.push(t.getX(o+2))):(r.push(t.getX(o+2)),r.push(t.getX(o+1)),r.push(t.getX(o)));r.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let s=i.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),i}function $be(i){let e=new re,t=new re,n=new re,r=new re,s=new re,o=new re,a=new re,l=new re,c=new re;function u(ce,he,ve,Re,Qe,Fe,mt,Ee){e.fromBufferAttribute(he,Qe),t.fromBufferAttribute(he,Fe),n.fromBufferAttribute(he,mt);let Ve=ce.morphTargetInfluences;if(ve&&Ve){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let Ye=0,Mt=ve.length;Ye<Mt;Ye++){let Et=Ve[Ye],Pt=ve[Ye];Et!==0&&(r.fromBufferAttribute(Pt,Qe),s.fromBufferAttribute(Pt,Fe),o.fromBufferAttribute(Pt,mt),Re?(a.addScaledVector(r,Et),l.addScaledVector(s,Et),c.addScaledVector(o,Et)):(a.addScaledVector(r.sub(e),Et),l.addScaledVector(s.sub(t),Et),c.addScaledVector(o.sub(n),Et)))}e.add(a),t.add(l),n.add(c)}ce.isSkinnedMesh&&(ce.applyBoneTransform(Qe,e),ce.applyBoneTransform(Fe,t),ce.applyBoneTransform(mt,n)),Ee[Qe*3+0]=e.x,Ee[Qe*3+1]=e.y,Ee[Qe*3+2]=e.z,Ee[Fe*3+0]=t.x,Ee[Fe*3+1]=t.y,Ee[Fe*3+2]=t.z,Ee[mt*3+0]=n.x,Ee[mt*3+1]=n.y,Ee[mt*3+2]=n.z}let f=i.geometry,d=i.material,A,y,w,S=f.index,T=f.attributes.position,R=f.morphAttributes.position,I=f.morphTargetsRelative,P=f.attributes.normal,F=f.morphAttributes.normal,D=f.groups,L=f.drawRange,C,B,k,z,G,W,Y,H=new Float32Array(T.count*T.itemSize),$=new Float32Array(P.count*P.itemSize);if(S!==null)if(Array.isArray(d))for(C=0,k=D.length;C<k;C++)for(G=D[C],W=Math.max(G.start,L.start),Y=Math.min(G.start+G.count,L.start+L.count),B=W,z=Y;B<z;B+=3)A=S.getX(B),y=S.getX(B+1),w=S.getX(B+2),u(i,T,R,I,A,y,w,H),u(i,P,F,I,A,y,w,$);else for(W=Math.max(0,L.start),Y=Math.min(S.count,L.start+L.count),C=W,k=Y;C<k;C+=3)A=S.getX(C),y=S.getX(C+1),w=S.getX(C+2),u(i,T,R,I,A,y,w,H),u(i,P,F,I,A,y,w,$);else if(Array.isArray(d))for(C=0,k=D.length;C<k;C++)for(G=D[C],W=Math.max(G.start,L.start),Y=Math.min(G.start+G.count,L.start+L.count),B=W,z=Y;B<z;B+=3)A=B,y=B+1,w=B+2,u(i,T,R,I,A,y,w,H),u(i,P,F,I,A,y,w,$);else for(W=Math.max(0,L.start),Y=Math.min(T.count,L.start+L.count),C=W,k=Y;C<k;C+=3)A=C,y=C+1,w=C+2,u(i,T,R,I,A,y,w,H),u(i,P,F,I,A,y,w,$);let J=new Ln(H,3),te=new Ln($,3);return{positionAttribute:T,normalAttribute:P,morphedPositionAttribute:J,morphedNormalAttribute:te}}function Ybe(i){if(i.groups.length===0)return console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."),i;let e=i.groups;if(e=e.sort((o,a)=>o.materialIndex!==a.materialIndex?o.materialIndex-a.materialIndex:o.start-a.start),i.getIndex()===null){let o=i.getAttribute("position"),a=[];for(let l=0;l<o.count;l+=3)a.push(l,l+1,l+2);i.setIndex(a)}let t=i.getIndex(),n=[];for(let o=0;o<e.length;o++){let a=e[o],l=a.start,c=l+a.count;for(let u=l;u<c;u++)n.push(t.getX(u))}i.dispose(),i.setIndex(n);let r=0;for(let o=0;o<e.length;o++){let a=e[o];a.start=r,r+=a.count}let s=e[0];i.groups=[s];for(let o=1;o<e.length;o++){let a=e[o];s.materialIndex===a.materialIndex?s.count+=a.count:(s=a,i.groups.push(s))}return i}function Zbe(i,e=Math.PI/3){let t=i.index?i.toNonIndexed():i,n=t.attributes.position,r=n.count,s;if(n.isBufferAttribute===!0&&n.itemSize===3&&n.normalized===!1)s=n.array;else{s=new Float64Array(r*3);for(let P=0;P<r;P++)s[3*P+0]=n.getX(P),s[3*P+1]=n.getY(P),s[3*P+2]=n.getZ(P)}let o=Math.cos(e),a=(1+1e-10)*100,l=r/3,c=new Float64Array(l*3);for(let P=0;P<l;P++){let F=9*P,D=s[F+0],L=s[F+1],C=s[F+2],B=s[F+3],k=s[F+4],z=s[F+5],G=s[F+6],W=s[F+7],Y=s[F+8],H=G-B,$=W-k,J=Y-z,te=D-B,ce=L-k,he=C-z,ve=$*he-J*ce,Re=J*te-H*he,Qe=H*ce-$*te,Fe=1/(Math.sqrt(ve*ve+Re*Re+Qe*Qe)||1);c[3*P+0]=ve*Fe,c[3*P+1]=Re*Fe,c[3*P+2]=Qe*Fe}let u=new Int32Array(r),f=new Int32Array(r*3),d=1;for(;d<r*2;)d<<=1;let A=d-1,y=new Int32Array(d),w=0;for(let P=0;P<r;P++){let F=3*P,D=~~(s[F+0]*a),L=~~(s[F+1]*a),C=~~(s[F+2]*a),B=(Math.imul(D,73856093)^Math.imul(L,19349663)^Math.imul(C,83492791))&A;for(;;){let k=y[B];if(k===0){let G=3*w;f[G+0]=D,f[G+1]=L,f[G+2]=C,y[B]=w+1,u[P]=w++;break}let z=3*(k-1);if(f[z+0]===D&&f[z+1]===L&&f[z+2]===C){u[P]=k-1;break}B=B+1&A}}let S=new Int32Array(w+1);for(let P=0;P<r;P++)S[u[P]+1]++;for(let P=0;P<w;P++)S[P+1]+=S[P];let T=new Int32Array(r),R=S.slice(0,w);for(let P=0;P<l;P++){let F=3*P;T[R[u[F+0]]++]=P,T[R[u[F+1]]++]=P,T[R[u[F+2]]++]=P}let I=new Float32Array(r*3);for(let P=0;P<l;P++){let F=3*P,D=c[F+0],L=c[F+1],C=c[F+2];for(let B=0;B<3;B++){let k=F+B,z=u[k],G=0,W=0,Y=0;for(let $=S[z],J=S[z+1];$<J;$++){let te=3*T[$],ce=c[te+0],he=c[te+1],ve=c[te+2];D*ce+L*he+C*ve>o&&(G+=ce,W+=he,Y+=ve)}let H=1/(Math.sqrt(G*G+W*W+Y*Y)||1);I[3*k+0]=G*H,I[3*k+1]=W*H,I[3*k+2]=Y*H}}return t.setAttribute("normal",new Hi(I,3,!1)),t}var st=(function(i){return typeof i=="function"?i:typeof i=="string"?function(e){return e[i]}:function(e){return i}});function KC(i){"@babel/helpers - typeof";return KC=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},KC(i)}var Kbe=/^\s+/,Qbe=/\s+$/;function An(i,e){if(i=i||"",e=e||{},i instanceof An)return i;if(!(this instanceof An))return new An(i,e);var t=Jbe(i);this._originalInput=i,this._r=t.r,this._g=t.g,this._b=t.b,this._a=t.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||t.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=t.ok}An.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t,n,r,s,o,a;return t=e.r/255,n=e.g/255,r=e.b/255,t<=.03928?s=t/12.92:s=Math.pow((t+.055)/1.055,2.4),n<=.03928?o=n/12.92:o=Math.pow((n+.055)/1.055,2.4),r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),.2126*s+.7152*o+.0722*a},setAlpha:function(e){return this._a=WJ(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=zJ(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=zJ(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this._a==1?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=kJ(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=kJ(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this._a==1?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return VJ(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return iwe(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Ur(this._r,255)*100)+"%",g:Math.round(Ur(this._g,255)*100)+"%",b:Math.round(Ur(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Ur(this._r,255)*100)+"%, "+Math.round(Ur(this._g,255)*100)+"%, "+Math.round(Ur(this._b,255)*100)+"%)":"rgba("+Math.round(Ur(this._r,255)*100)+"%, "+Math.round(Ur(this._g,255)*100)+"%, "+Math.round(Ur(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:mwe[VJ(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+GJ(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=An(e);n="#"+GJ(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,r=this._a<1&&this._a>=0,s=!t&&r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(n=this.toRgbString()),e==="prgb"&&(n=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(n=this.toHexString()),e==="hex3"&&(n=this.toHexString(!0)),e==="hex4"&&(n=this.toHex8String(!0)),e==="hex8"&&(n=this.toHex8String()),e==="name"&&(n=this.toName()),e==="hsl"&&(n=this.toHslString()),e==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return An(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(awe,arguments)},brighten:function(){return this._applyModification(lwe,arguments)},darken:function(){return this._applyModification(cwe,arguments)},desaturate:function(){return this._applyModification(rwe,arguments)},saturate:function(){return this._applyModification(swe,arguments)},greyscale:function(){return this._applyModification(owe,arguments)},spin:function(){return this._applyModification(uwe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(dwe,arguments)},complement:function(){return this._applyCombination(hwe,arguments)},monochromatic:function(){return this._applyCombination(pwe,arguments)},splitcomplement:function(){return this._applyCombination(fwe,arguments)},triad:function(){return this._applyCombination(qJ,[3])},tetrad:function(){return this._applyCombination(qJ,[4])}};An.fromRatio=function(i,e){if(KC(i)=="object"){var t={};for(var n in i)i.hasOwnProperty(n)&&(n==="a"?t[n]=i[n]:t[n]=ww(i[n]));i=t}return An(i,e)};function Jbe(i){var e={r:0,g:0,b:0},t=1,n=null,r=null,s=null,o=!1,a=!1;return typeof i=="string"&&(i=_we(i)),KC(i)=="object"&&(Vd(i.r)&&Vd(i.g)&&Vd(i.b)?(e=ewe(i.r,i.g,i.b),o=!0,a=String(i.r).substr(-1)==="%"?"prgb":"rgb"):Vd(i.h)&&Vd(i.s)&&Vd(i.v)?(n=ww(i.s),r=ww(i.v),e=nwe(i.h,n,r),o=!0,a="hsv"):Vd(i.h)&&Vd(i.s)&&Vd(i.l)&&(n=ww(i.s),s=ww(i.l),e=twe(i.h,n,s),o=!0,a="hsl"),i.hasOwnProperty("a")&&(t=i.a)),t=WJ(t),{ok:o,format:i.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function ewe(i,e,t){return{r:Ur(i,255)*255,g:Ur(e,255)*255,b:Ur(t,255)*255}}function kJ(i,e,t){i=Ur(i,255),e=Ur(e,255),t=Ur(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,o,a=(n+r)/2;if(n==r)s=o=0;else{var l=n-r;switch(o=a>.5?l/(2-n-r):l/(n+r),n){case i:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-i)/l+2;break;case t:s=(i-e)/l+4;break}s/=6}return{h:s,s:o,l:a}}function twe(i,e,t){var n,r,s;i=Ur(i,360),e=Ur(e,100),t=Ur(t,100);function o(c,u,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?c+(u-c)*6*f:f<1/2?u:f<2/3?c+(u-c)*(2/3-f)*6:c}if(e===0)n=r=s=t;else{var a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;n=o(l,a,i+1/3),r=o(l,a,i),s=o(l,a,i-1/3)}return{r:n*255,g:r*255,b:s*255}}function zJ(i,e,t){i=Ur(i,255),e=Ur(e,255),t=Ur(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,o,a=n,l=n-r;if(o=n===0?0:l/n,n==r)s=0;else{switch(n){case i:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-i)/l+2;break;case t:s=(i-e)/l+4;break}s/=6}return{h:s,s:o,v:a}}function nwe(i,e,t){i=Ur(i,360)*6,e=Ur(e,100),t=Ur(t,100);var n=Math.floor(i),r=i-n,s=t*(1-e),o=t*(1-r*e),a=t*(1-(1-r)*e),l=n%6,c=[t,o,s,s,a,t][l],u=[a,t,t,o,s,s][l],f=[s,s,a,t,t,o][l];return{r:c*255,g:u*255,b:f*255}}function VJ(i,e,t,n){var r=[Vu(Math.round(i).toString(16)),Vu(Math.round(e).toString(16)),Vu(Math.round(t).toString(16))];return n&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function iwe(i,e,t,n,r){var s=[Vu(Math.round(i).toString(16)),Vu(Math.round(e).toString(16)),Vu(Math.round(t).toString(16)),Vu(jJ(n))];return r&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function GJ(i,e,t,n){var r=[Vu(jJ(n)),Vu(Math.round(i).toString(16)),Vu(Math.round(e).toString(16)),Vu(Math.round(t).toString(16))];return r.join("")}An.equals=function(i,e){return!i||!e?!1:An(i).toRgbString()==An(e).toRgbString()};An.random=function(){return An.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function rwe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.s-=e/100,t.s=QC(t.s),An(t)}function swe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.s+=e/100,t.s=QC(t.s),An(t)}function owe(i){return An(i).desaturate(100)}function awe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.l+=e/100,t.l=QC(t.l),An(t)}function lwe(i,e){e=e===0?0:e||10;var t=An(i).toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(255*-(e/100)))),t.g=Math.max(0,Math.min(255,t.g-Math.round(255*-(e/100)))),t.b=Math.max(0,Math.min(255,t.b-Math.round(255*-(e/100)))),An(t)}function cwe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.l-=e/100,t.l=QC(t.l),An(t)}function uwe(i,e){var t=An(i).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,An(t)}function hwe(i){var e=An(i).toHsl();return e.h=(e.h+180)%360,An(e)}function qJ(i,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var t=An(i).toHsl(),n=[An(i)],r=360/e,s=1;s<e;s++)n.push(An({h:(t.h+s*r)%360,s:t.s,l:t.l}));return n}function fwe(i){var e=An(i).toHsl(),t=e.h;return[An(i),An({h:(t+72)%360,s:e.s,l:e.l}),An({h:(t+216)%360,s:e.s,l:e.l})]}function dwe(i,e,t){e=e||6,t=t||30;var n=An(i).toHsl(),r=360/t,s=[An(i)];for(n.h=(n.h-(r*e>>1)+720)%360;--e;)n.h=(n.h+r)%360,s.push(An(n));return s}function pwe(i,e){e=e||6;for(var t=An(i).toHsv(),n=t.h,r=t.s,s=t.v,o=[],a=1/e;e--;)o.push(An({h:n,s:r,v:s})),s=(s+a)%1;return o}An.mix=function(i,e,t){t=t===0?0:t||50;var n=An(i).toRgb(),r=An(e).toRgb(),s=t/100,o={r:(r.r-n.r)*s+n.r,g:(r.g-n.g)*s+n.g,b:(r.b-n.b)*s+n.b,a:(r.a-n.a)*s+n.a};return An(o)};An.readability=function(i,e){var t=An(i),n=An(e);return(Math.max(t.getLuminance(),n.getLuminance())+.05)/(Math.min(t.getLuminance(),n.getLuminance())+.05)};An.isReadable=function(i,e,t){var n=An.readability(i,e),r,s;switch(s=!1,r=xwe(t),r.level+r.size){case"AAsmall":case"AAAlarge":s=n>=4.5;break;case"AAlarge":s=n>=3;break;case"AAAsmall":s=n>=7;break}return s};An.mostReadable=function(i,e,t){var n=null,r=0,s,o,a,l;t=t||{},o=t.includeFallbackColors,a=t.level,l=t.size;for(var c=0;c<e.length;c++)s=An.readability(i,e[c]),s>r&&(r=s,n=An(e[c]));return An.isReadable(i,n,{level:a,size:l})||!o?n:(t.includeFallbackColors=!1,An.mostReadable(i,["#fff","#000"],t))};var fO=An.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},mwe=An.hexNames=Awe(fO);function Awe(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function WJ(i){return i=parseFloat(i),(isNaN(i)||i<0||i>1)&&(i=1),i}function Ur(i,e){gwe(i)&&(i="100%");var t=vwe(i);return i=Math.min(e,Math.max(0,parseFloat(i))),t&&(i=parseInt(i*e,10)/100),Math.abs(i-e)<1e-6?1:i%e/parseFloat(e)}function QC(i){return Math.min(1,Math.max(0,i))}function rc(i){return parseInt(i,16)}function gwe(i){return typeof i=="string"&&i.indexOf(".")!=-1&&parseFloat(i)===1}function vwe(i){return typeof i=="string"&&i.indexOf("%")!=-1}function Vu(i){return i.length==1?"0"+i:""+i}function ww(i){return i<=1&&(i=i*100+"%"),i}function jJ(i){return Math.round(parseFloat(i)*255).toString(16)}function HJ(i){return rc(i)/255}var zu=(function(){var i="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+i+")",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+r),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function Vd(i){return!!zu.CSS_UNIT.exec(i)}function _we(i){i=i.replace(Kbe,"").replace(Qbe,"").toLowerCase();var e=!1;if(fO[i])i=fO[i],e=!0;else if(i=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=zu.rgb.exec(i))?{r:t[1],g:t[2],b:t[3]}:(t=zu.rgba.exec(i))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=zu.hsl.exec(i))?{h:t[1],s:t[2],l:t[3]}:(t=zu.hsla.exec(i))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=zu.hsv.exec(i))?{h:t[1],s:t[2],v:t[3]}:(t=zu.hsva.exec(i))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=zu.hex8.exec(i))?{r:rc(t[1]),g:rc(t[2]),b:rc(t[3]),a:HJ(t[4]),format:e?"name":"hex8"}:(t=zu.hex6.exec(i))?{r:rc(t[1]),g:rc(t[2]),b:rc(t[3]),format:e?"name":"hex"}:(t=zu.hex4.exec(i))?{r:rc(t[1]+""+t[1]),g:rc(t[2]+""+t[2]),b:rc(t[3]+""+t[3]),a:HJ(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=zu.hex3.exec(i))?{r:rc(t[1]+""+t[1]),g:rc(t[2]+""+t[2]),b:rc(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function xwe(i){var e,t;return i=i||{level:"AA",size:"small"},e=(i.level||"AA").toUpperCase(),t=(i.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}function AO(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function ywe(i){if(Array.isArray(i))return i}function bwe(i){if(Array.isArray(i))return AO(i)}function XJ(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function wwe(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Swe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function pa(i,e){return i.get(XJ(i,e))}function I_(i,e,t){wwe(i,e),e.set(i,t)}function JC(i,e,t){return i.set(XJ(i,e),t),t}function Twe(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,Nwe(n.key),n)}}function Ewe(i,e,t){return e&&Twe(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Mwe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Cwe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Rwe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4124+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pwe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4125+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Iwe(i,e){return ywe(i)||Cwe(i,e)||$J(i,e)||Rwe()}function Lwe(i){return bwe(i)||Mwe(i)||$J(i)||Pwe()}function Dwe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function Nwe(i){var e=Dwe(i,"string");return typeof e=="symbol"?e:e+""}function $J(i,e){if(i){if(typeof i=="string")return AO(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?AO(i,e):void 0}}var L_=new WeakMap,Sw=new WeakMap,D_=new WeakMap,dO=new WeakMap,pO=new WeakMap,mO=new WeakMap,YJ=(function(){function i(){Swe(this,i),I_(this,L_,new Map),I_(this,Sw,new Map),I_(this,D_,function(e){return e}),I_(this,dO,function(){return{}}),I_(this,pO,function(){}),I_(this,mO,function(){})}return Ewe(i,[{key:"getObj",value:function(t){return pa(L_,this).get(pa(D_,this).call(this,t))}},{key:"getData",value:function(t){return pa(Sw,this).get(t)}},{key:"entries",value:function(){return Lwe(pa(Sw,this).entries()).map(function(t){var n=Iwe(t,2),r=n[0],s=n[1];return[s,r]})}},{key:"id",value:function(t){return JC(D_,this,st(t)),this}},{key:"onCreateObj",value:function(t){return JC(dO,this,t),this}},{key:"onUpdateObj",value:function(t){return JC(pO,this,t),this}},{key:"onRemoveObj",value:function(t){return JC(mO,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(s){return!pa(L_,n).has(pa(D_,n).call(n,s))}).forEach(function(s){var o=pa(dO,n).call(n,s);pa(L_,n).set(pa(D_,n).call(n,s),o),pa(Sw,n).set(o,s)});var r=new Map(t.map(function(s){return[pa(D_,n).call(n,s),s]}));return pa(L_,this).forEach(function(s,o){r.has(o)?pa(pO,n).call(n,s,r.get(o)):(pa(mO,n).call(n,s,o),pa(L_,n).delete(o),pa(Sw,n).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})();var m1=Oq(ZJ(),1);var Ei=11102230246251565e-32,Xs=134217729,Ew=(3+8*Ei)*Ei;function Ig(i,e,t,n,r){let s,o,a,l,c=e[0],u=n[0],f=0,d=0;u>c==u>-c?(s=c,c=e[++f]):(s=u,u=n[++d]);let A=0;if(f<i&&d<t)for(u>c==u>-c?(o=c+s,a=s-(o-c),c=e[++f]):(o=u+s,a=s-(o-u),u=n[++d]),s=o,a!==0&&(r[A++]=a);f<i&&d<t;)u>c==u>-c?(o=s+c,l=o-s,a=s-(o-l)+(c-l),c=e[++f]):(o=s+u,l=o-s,a=s-(o-l)+(u-l),u=n[++d]),s=o,a!==0&&(r[A++]=a);for(;f<i;)o=s+c,l=o-s,a=s-(o-l)+(c-l),c=e[++f],s=o,a!==0&&(r[A++]=a);for(;d<t;)o=s+u,l=o-s,a=s-(o-l)+(u-l),u=n[++d],s=o,a!==0&&(r[A++]=a);return(s!==0||A===0)&&(r[A++]=s),A}function Mw(i,e){let t=e[0];for(let n=1;n<i;n++)t+=e[n];return t}function ht(i){return new Float64Array(i)}var Fwe=(3+16*Ei)*Ei,Bwe=(2+12*Ei)*Ei,Owe=(9+64*Ei)*Ei*Ei,N_=ht(4),KJ=ht(8),QJ=ht(12),JJ=ht(16),$a=ht(4);function Uwe(i,e,t,n,r,s,o){let a,l,c,u,f,d,A,y,w,S,T,R,I,P,F,D,L,C,B=i-r,k=t-r,z=e-s,G=n-s;P=B*G,d=Xs*B,A=d-(d-B),y=B-A,d=Xs*G,w=d-(d-G),S=G-w,F=y*S-(P-A*w-y*w-A*S),D=z*k,d=Xs*z,A=d-(d-z),y=z-A,d=Xs*k,w=d-(d-k),S=k-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,N_[0]=F-(T+f)+(f-L),R=P+T,f=R-P,I=P-(R-f)+(T-f),T=I-D,f=I-T,N_[1]=I-(T+f)+(f-D),C=R+T,f=C-R,N_[2]=R-(C-f)+(T-f),N_[3]=C;let W=Mw(4,N_),Y=Bwe*o;if(W>=Y||-W>=Y||(f=i-B,a=i-(B+f)+(f-r),f=t-k,c=t-(k+f)+(f-r),f=e-z,l=e-(z+f)+(f-s),f=n-G,u=n-(G+f)+(f-s),a===0&&l===0&&c===0&&u===0)||(Y=Owe*o+Ew*Math.abs(W),W+=B*u+G*a-(z*c+k*l),W>=Y||-W>=Y))return W;P=a*G,d=Xs*a,A=d-(d-a),y=a-A,d=Xs*G,w=d-(d-G),S=G-w,F=y*S-(P-A*w-y*w-A*S),D=l*k,d=Xs*l,A=d-(d-l),y=l-A,d=Xs*k,w=d-(d-k),S=k-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,$a[0]=F-(T+f)+(f-L),R=P+T,f=R-P,I=P-(R-f)+(T-f),T=I-D,f=I-T,$a[1]=I-(T+f)+(f-D),C=R+T,f=C-R,$a[2]=R-(C-f)+(T-f),$a[3]=C;let H=Ig(4,N_,4,$a,KJ);P=B*u,d=Xs*B,A=d-(d-B),y=B-A,d=Xs*u,w=d-(d-u),S=u-w,F=y*S-(P-A*w-y*w-A*S),D=z*c,d=Xs*z,A=d-(d-z),y=z-A,d=Xs*c,w=d-(d-c),S=c-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,$a[0]=F-(T+f)+(f-L),R=P+T,f=R-P,I=P-(R-f)+(T-f),T=I-D,f=I-T,$a[1]=I-(T+f)+(f-D),C=R+T,f=C-R,$a[2]=R-(C-f)+(T-f),$a[3]=C;let $=Ig(H,KJ,4,$a,QJ);P=a*u,d=Xs*a,A=d-(d-a),y=a-A,d=Xs*u,w=d-(d-u),S=u-w,F=y*S-(P-A*w-y*w-A*S),D=l*c,d=Xs*l,A=d-(d-l),y=l-A,d=Xs*c,w=d-(d-c),S=c-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,$a[0]=F-(T+f)+(f-L),R=P+T,f=R-P,I=P-(R-f)+(T-f),T=I-D,f=I-T,$a[1]=I-(T+f)+(f-D),C=R+T,f=C-R,$a[2]=R-(C-f)+(T-f),$a[3]=C;let J=Ig($,QJ,4,$a,JJ);return JJ[J-1]}function Q0(i,e,t,n,r,s){let o=(e-s)*(t-r),a=(i-r)*(n-s),l=o-a,c=Math.abs(o+a);return Math.abs(l)>=Fwe*c?l:-Uwe(i,e,t,n,r,s,c)}var rst=(7+56*Ei)*Ei,sst=(3+28*Ei)*Ei,ost=(26+288*Ei)*Ei*Ei,ast=ht(4),lst=ht(4),cst=ht(4),ust=ht(4),hst=ht(4),fst=ht(4),dst=ht(4),pst=ht(4),mst=ht(4),Ast=ht(8),gst=ht(8),vst=ht(8),_st=ht(4),xst=ht(8),yst=ht(8),bst=ht(16),wst=ht(12),Sst=ht(192),Tst=ht(192);var Cst=(10+96*Ei)*Ei,Rst=(4+48*Ei)*Ei,Pst=(44+576*Ei)*Ei*Ei,Ist=ht(4),Lst=ht(4),Dst=ht(4),Nst=ht(4),Fst=ht(4),Bst=ht(4),Ost=ht(4),Ust=ht(4),kst=ht(8),zst=ht(8),Vst=ht(8),Gst=ht(8),qst=ht(8),Hst=ht(8),Wst=ht(8),jst=ht(8),Xst=ht(8),$st=ht(4),Yst=ht(4),Zst=ht(4),Kst=ht(8),Qst=ht(16),Jst=ht(16),eot=ht(16),tot=ht(32),not=ht(32),iot=ht(48),rot=ht(64),sot=ht(1152),oot=ht(1152);var uot=(16+224*Ei)*Ei,hot=(5+72*Ei)*Ei,fot=(71+1408*Ei)*Ei*Ei,dot=ht(4),pot=ht(4),mot=ht(4),Aot=ht(4),got=ht(4),vot=ht(4),_ot=ht(4),xot=ht(4),yot=ht(4),bot=ht(4),wot=ht(24),Sot=ht(24),Tot=ht(24),Eot=ht(24),Mot=ht(24),Cot=ht(24),Rot=ht(24),Pot=ht(24),Iot=ht(24),Lot=ht(24),Dot=ht(1152),Not=ht(1152),Fot=ht(1152),Bot=ht(1152),Oot=ht(1152),Uot=ht(2304),kot=ht(2304),zot=ht(3456),Vot=ht(5760),Got=ht(8),qot=ht(8),Hot=ht(8),Wot=ht(16),jot=ht(24),Xot=ht(48),$ot=ht(48),Yot=ht(96),Zot=ht(192),Kot=ht(384),Qot=ht(384),Jot=ht(384),eat=ht(768);var tat=ht(96),nat=ht(96),iat=ht(96),rat=ht(1152);var tee=Math.pow(2,-52),eR=new Uint32Array(512),J0=class i{static from(e,t=Hwe,n=Wwe){let r=e.length,s=new Float64Array(r*2);for(let o=0;o<r;o++){let a=e[o];s[2*o]=t(a),s[2*o+1]=n(a)}return new i(s)}constructor(e){let t=e.length>>1;if(t>0&&typeof e[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=e;let n=Math.max(2*t-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.trianglesLen=0,this._cx=0,this._cy=0,this._hullStart=0,this.hull=this._triangles,this.triangles=this._triangles,this.halfedges=this._halfedges,this.update()}update(){let{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:s}=this,o=e.length>>1,a=1/0,l=1/0,c=-1/0,u=-1/0;for(let B=0;B<o;B++){let k=e[2*B],z=e[2*B+1];k<a&&(a=k),z<l&&(l=z),k>c&&(c=k),z>u&&(u=z),this._ids[B]=B}let f=(a+c)/2,d=(l+u)/2,A=0,y=0,w=0;for(let B=0,k=1/0;B<o;B++){let z=vO(f,d,e[2*B],e[2*B+1]);z<k&&(A=B,k=z)}let S=e[2*A],T=e[2*A+1];for(let B=0,k=1/0;B<o;B++){if(B===A)continue;let z=vO(S,T,e[2*B],e[2*B+1]);z<k&&z>0&&(y=B,k=z)}let R=e[2*y],I=e[2*y+1],P=1/0;for(let B=0;B<o;B++){if(B===A||B===y)continue;let k=Gwe(S,T,R,I,e[2*B],e[2*B+1]);k<P&&(w=B,P=k)}let F=e[2*w],D=e[2*w+1];if(P===1/0){for(let z=0;z<o;z++)this._dists[z]=e[2*z]-e[0]||e[2*z+1]-e[1];F_(this._ids,this._dists,0,o-1);let B=new Uint32Array(o),k=0;for(let z=0,G=-1/0;z<o;z++){let W=this._ids[z],Y=this._dists[W];Y>G&&(B[k++]=W,G=Y)}this.hull=B.subarray(0,k),this.triangles=new Uint32Array(0),this.halfedges=new Int32Array(0);return}if(Q0(S,T,R,I,F,D)<0){let B=y,k=R,z=I;y=w,R=F,I=D,w=B,F=k,D=z}let L=qwe(S,T,R,I,F,D);this._cx=L.x,this._cy=L.y;for(let B=0;B<o;B++)this._dists[B]=vO(e[2*B],e[2*B+1],L.x,L.y);F_(this._ids,this._dists,0,o-1),this._hullStart=A;let C=3;n[A]=t[w]=y,n[y]=t[A]=w,n[w]=t[y]=A,r[A]=0,r[y]=1,r[w]=2,s.fill(-1),s[this._hashKey(S,T)]=A,s[this._hashKey(R,I)]=y,s[this._hashKey(F,D)]=w,this.trianglesLen=0,this._addTriangle(A,y,w,-1,-1,-1);for(let B=0,k=0,z=0;B<this._ids.length;B++){let G=this._ids[B],W=e[2*G],Y=e[2*G+1];if(B>0&&Math.abs(W-k)<=tee&&Math.abs(Y-z)<=tee||(k=W,z=Y,G===A||G===y||G===w))continue;let H=0;for(let he=0,ve=this._hashKey(W,Y);he<this._hashSize&&(H=s[(ve+he)%this._hashSize],!(H!==-1&&H!==n[H]));he++);H=t[H];let $=H,J;for(;J=n[$],Q0(W,Y,e[2*$],e[2*$+1],e[2*J],e[2*J+1])>=0;)if($=J,$===H){$=-1;break}if($===-1)continue;let te=this._addTriangle($,G,n[$],-1,-1,r[$]);r[G]=this._legalize(te+2),r[$]=te,C++;let ce=n[$];for(;J=n[ce],Q0(W,Y,e[2*ce],e[2*ce+1],e[2*J],e[2*J+1])<0;)te=this._addTriangle(ce,G,J,r[G],-1,r[ce]),r[G]=this._legalize(te+2),n[ce]=ce,C--,ce=J;if($===H)for(;J=t[$],Q0(W,Y,e[2*J],e[2*J+1],e[2*$],e[2*$+1])<0;)te=this._addTriangle(J,G,$,-1,r[$],r[J]),this._legalize(te+2),r[J]=te,n[$]=$,C--,$=J;this._hullStart=t[G]=$,n[$]=t[ce]=G,n[G]=ce,s[this._hashKey(W,Y)]=G,s[this._hashKey(e[2*$],e[2*$+1])]=$}this.hull=new Uint32Array(C);for(let B=0,k=this._hullStart;B<C;B++)this.hull[B]=k,k=n[k];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(zwe(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){let{_triangles:t,_halfedges:n,coords:r}=this,s=0,o=0;for(;;){let a=n[e],l=e-e%3;if(o=l+(e+2)%3,a===-1){if(s===0)break;e=eR[--s];continue}let c=a-a%3,u=l+(e+1)%3,f=c+(a+2)%3,d=t[o],A=t[e],y=t[u],w=t[f];if(Vwe(r[2*d],r[2*d+1],r[2*A],r[2*A+1],r[2*y],r[2*y+1],r[2*w],r[2*w+1])){t[e]=w,t[a]=d;let T=n[f];if(T===-1){let I=this._hullStart;do{if(this._hullTri[I]===f){this._hullTri[I]=e;break}I=this._hullPrev[I]}while(I!==this._hullStart)}this._link(e,T),this._link(a,n[o]),this._link(o,f);let R=c+(a+1)%3;s<eR.length&&(eR[s++]=R)}else{if(s===0)break;e=eR[--s]}}return o}_link(e,t){this._halfedges[e]=t,t!==-1&&(this._halfedges[t]=e)}_addTriangle(e,t,n,r,s,o){let a=this.trianglesLen;return this._triangles[a]=e,this._triangles[a+1]=t,this._triangles[a+2]=n,this._link(a,r),this._link(a+1,s),this._link(a+2,o),this.trianglesLen+=3,a}};function zwe(i,e){let t=i/(Math.abs(i)+Math.abs(e));return(e>0?3-t:1+t)/4}function vO(i,e,t,n){let r=i-t,s=e-n;return r*r+s*s}function Vwe(i,e,t,n,r,s,o,a){let l=i-o,c=e-a,u=t-o,f=n-a,d=r-o,A=s-a,y=l*l+c*c,w=u*u+f*f,S=d*d+A*A;return l*(f*S-w*A)-c*(u*S-w*d)+y*(u*A-f*d)<0}function Gwe(i,e,t,n,r,s){let o=t-i,a=n-e,l=r-i,c=s-e,u=o*o+a*a,f=l*l+c*c,d=.5/(o*c-a*l),A=(c*u-a*f)*d,y=(o*f-l*u)*d;return A*A+y*y}function qwe(i,e,t,n,r,s){let o=t-i,a=n-e,l=r-i,c=s-e,u=o*o+a*a,f=l*l+c*c,d=.5/(o*c-a*l),A=i+(c*u-a*f)*d,y=e+(o*f-l*u)*d;return{x:A,y}}function F_(i,e,t,n){if(n-t<=20)for(let r=t+1;r<=n;r++){let s=i[r],o=e[s],a=r-1;for(;a>=t&&e[i[a]]>o;)i[a+1]=i[a--];i[a+1]=s}else{let r=t+n>>1,s=t+1,o=n;Cw(i,r,s),e[i[t]]>e[i[n]]&&Cw(i,t,n),e[i[s]]>e[i[n]]&&Cw(i,s,n),e[i[t]]>e[i[s]]&&Cw(i,t,s);let a=i[s],l=e[a];for(;;){do s++;while(e[i[s]]<l);do o--;while(e[i[o]]>l);if(o<s)break;Cw(i,s,o)}i[t+1]=i[o],i[o]=a,n-s+1>=o-t?(F_(i,e,s,n),F_(i,e,t,o-1)):(F_(i,e,t,o-1),F_(i,e,s,n))}}function Cw(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function Hwe(i){return i[0]}function Wwe(i){return i[1]}function nee(i,e){var t,n,r=0,s,o,a,l,c,u,f,d=i[0],A=i[1],y=e.length;for(t=0;t<y;t++){n=0;var w=e[t],S=w.length-1;if(u=w[0],u[0]!==w[S][0]&&u[1]!==w[S][1])throw new Error("First and last coordinates in a ring must be the same");for(o=u[0]-d,a=u[1]-A,n;n<S;n++){if(f=w[n+1],l=f[0]-d,c=f[1]-A,a===0&&c===0){if(l<=0&&o>=0||o<=0&&l>=0)return 0}else if(c>=0&&a<=0||c<=0&&a>=0){if(s=Q0(o,l,a,c,0,0),s===0)return 0;(s>0&&c>0&&a<=0||s<0&&c<=0&&a>0)&&r++}u=f,a=c,o=l}}return r%2!==0}function iee(i){if(!i)throw new Error("coord is required");if(!Array.isArray(i)){if(i.type==="Feature"&&i.geometry!==null&&i.geometry.type==="Point")return[...i.geometry.coordinates];if(i.type==="Point")return[...i.coordinates]}if(Array.isArray(i)&&i.length>=2&&!Array.isArray(i[0])&&!Array.isArray(i[1]))return[...i];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function ree(i){return i.type==="Feature"?i.geometry:i}function jwe(i,e,t={}){if(!i)throw new Error("point is required");if(!e)throw new Error("polygon is required");let n=iee(i),r=ree(e),s=r.type,o=e.bbox,a=r.coordinates;if(o&&Xwe(n,o)===!1)return!1;s==="Polygon"&&(a=[a]);let l=!1;for(var c=0;c<a.length;++c){let u=nee(n,a[c]);if(u===0)return!t.ignoreBoundary;u&&(l=!0)}return l}function Xwe(i,e){return e[0]<=i[0]&&e[1]<=i[1]&&e[2]>=i[0]&&e[3]>=i[1]}var see=jwe;var $c=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){e=+e,t=+t,n=+n;let r=e+n,s=t;if(n<0)throw new Error("negative radius");this._x1===null?this._+=`M${r},${s}`:(Math.abs(this._x1-r)>1e-6||Math.abs(this._y1-s)>1e-6)&&(this._+="L"+r+","+s),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=r},${this._y1=s}`)}rect(e,t,n,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+r}h${-n}Z`}value(){return this._||null}};var em=class{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}};var Rw=class{constructor(e,[t,n,r,s]=[0,0,960,500]){if(!((r=+r)>=(t=+t))||!((s=+s)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(e.points.length*2),this.vectors=new Float64Array(e.points.length*2),this.xmax=r,this.xmin=t,this.ymax=s,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:e,hull:t,triangles:n},vectors:r}=this,s,o,a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let w=0,S=0,T=n.length,R,I;w<T;w+=3,S+=2){let P=n[w]*2,F=n[w+1]*2,D=n[w+2]*2,L=e[P],C=e[P+1],B=e[F],k=e[F+1],z=e[D],G=e[D+1],W=B-L,Y=k-C,H=z-L,$=G-C,J=(W*$-Y*H)*2;if(Math.abs(J)<1e-9){if(s===void 0){s=o=0;for(let ce of t)s+=e[ce*2],o+=e[ce*2+1];s/=t.length,o/=t.length}let te=1e9*Math.sign((s-L)*$-(o-C)*H);R=(L+z)/2-te*$,I=(C+G)/2+te*H}else{let te=1/J,ce=W*W+Y*Y,he=H*H+$*$;R=L+($*ce-Y*he)*te,I=C+(W*he-H*ce)*te}a[S]=R,a[S+1]=I}let l=t[t.length-1],c,u=l*4,f,d=e[2*l],A,y=e[2*l+1];r.fill(0);for(let w=0;w<t.length;++w)l=t[w],c=u,f=d,A=y,u=l*4,d=e[2*l],y=e[2*l+1],r[c+2]=r[u]=A-y,r[c+3]=r[u+1]=d-f}render(e){let t=e==null?e=new $c:void 0,{delaunay:{halfedges:n,inedges:r,hull:s},circumcenters:o,vectors:a}=this;if(s.length<=1)return null;for(let u=0,f=n.length;u<f;++u){let d=n[u];if(d<u)continue;let A=Math.floor(u/3)*2,y=Math.floor(d/3)*2,w=o[A],S=o[A+1],T=o[y],R=o[y+1];this._renderSegment(w,S,T,R,e)}let l,c=s[s.length-1];for(let u=0;u<s.length;++u){l=c,c=s[u];let f=Math.floor(r[c]/3)*2,d=o[f],A=o[f+1],y=l*4,w=this._project(d,A,a[y+2],a[y+3]);w&&this._renderSegment(d,A,w[0],w[1],e)}return t&&t.value()}renderBounds(e){let t=e==null?e=new $c:void 0;return e.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),t&&t.value()}renderCell(e,t){let n=t==null?t=new $c:void 0,r=this._clip(e);if(r===null||!r.length)return;t.moveTo(r[0],r[1]);let s=r.length;for(;r[0]===r[s-2]&&r[1]===r[s-1]&&s>1;)s-=2;for(let o=2;o<s;o+=2)(r[o]!==r[o-2]||r[o+1]!==r[o-1])&&t.lineTo(r[o],r[o+1]);return t.closePath(),n&&n.value()}*cellPolygons(){let{delaunay:{points:e}}=this;for(let t=0,n=e.length/2;t<n;++t){let r=this.cellPolygon(t);r&&(r.index=t,yield r)}}cellPolygon(e){let t=new em;return this.renderCell(e,t),t.value()}_renderSegment(e,t,n,r,s){let o,a=this._regioncode(e,t),l=this._regioncode(n,r);a===0&&l===0?(s.moveTo(e,t),s.lineTo(n,r)):(o=this._clipSegment(e,t,n,r,a,l))&&(s.moveTo(o[0],o[1]),s.lineTo(o[2],o[3]))}contains(e,t,n){return t=+t,t!==t||(n=+n,n!==n)?!1:this.delaunay._step(e,t,n)===e}*neighbors(e){let t=this._clip(e);if(t)for(let n of this.delaunay.neighbors(e)){let r=this._clip(n);if(r){e:for(let s=0,o=t.length;s<o;s+=2)for(let a=0,l=r.length;a<l;a+=2)if(t[s]===r[a]&&t[s+1]===r[a+1]&&t[(s+2)%o]===r[(a+l-2)%l]&&t[(s+3)%o]===r[(a+l-1)%l]){yield n;break e}}}}_cell(e){let{circumcenters:t,delaunay:{inedges:n,halfedges:r,triangles:s}}=this,o=n[e];if(o===-1)return null;let a=[],l=o;do{let c=Math.floor(l/3);if(a.push(t[c*2],t[c*2+1]),l=l%3===2?l-2:l+1,s[l]!==e)break;l=r[l]}while(l!==o&&l!==-1);return a}_clip(e){if(e===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let t=this._cell(e);if(t===null)return null;let{vectors:n}=this,r=e*4;return this._simplify(n[r]||n[r+1]?this._clipInfinite(e,t,n[r],n[r+1],n[r+2],n[r+3]):this._clipFinite(e,t))}_clipFinite(e,t){let n=t.length,r=null,s,o,a=t[n-2],l=t[n-1],c,u=this._regioncode(a,l),f,d=0;for(let A=0;A<n;A+=2)if(s=a,o=l,a=t[A],l=t[A+1],c=u,u=this._regioncode(a,l),c===0&&u===0)f=d,d=0,r?r.push(a,l):r=[a,l];else{let y,w,S,T,R;if(c===0){if((y=this._clipSegment(s,o,a,l,c,u))===null)continue;[w,S,T,R]=y}else{if((y=this._clipSegment(a,l,s,o,u,c))===null)continue;[T,R,w,S]=y,f=d,d=this._edgecode(w,S),f&&d&&this._edge(e,f,d,r,r.length),r?r.push(w,S):r=[w,S]}f=d,d=this._edgecode(T,R),f&&d&&this._edge(e,f,d,r,r.length),r?r.push(T,R):r=[T,R]}if(r)f=d,d=this._edgecode(r[0],r[1]),f&&d&&this._edge(e,f,d,r,r.length);else if(this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return r}_clipSegment(e,t,n,r,s,o){let a=s<o;for(a&&([e,t,n,r,s,o]=[n,r,e,t,o,s]);;){if(s===0&&o===0)return a?[n,r,e,t]:[e,t,n,r];if(s&o)return null;let l,c,u=s||o;u&8?(l=e+(n-e)*(this.ymax-t)/(r-t),c=this.ymax):u&4?(l=e+(n-e)*(this.ymin-t)/(r-t),c=this.ymin):u&2?(c=t+(r-t)*(this.xmax-e)/(n-e),l=this.xmax):(c=t+(r-t)*(this.xmin-e)/(n-e),l=this.xmin),s?(e=l,t=c,s=this._regioncode(e,t)):(n=l,r=c,o=this._regioncode(n,r))}}_clipInfinite(e,t,n,r,s,o){let a=Array.from(t),l;if((l=this._project(a[0],a[1],n,r))&&a.unshift(l[0],l[1]),(l=this._project(a[a.length-2],a[a.length-1],s,o))&&a.push(l[0],l[1]),a=this._clipFinite(e,a))for(let c=0,u=a.length,f,d=this._edgecode(a[u-2],a[u-1]);c<u;c+=2)f=d,d=this._edgecode(a[c],a[c+1]),f&&d&&(c=this._edge(e,f,d,a,c),u=a.length);else this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(e,t,n,r,s){for(;t!==n;){let o,a;switch(t){case 5:t=4;continue;case 4:t=6,o=this.xmax,a=this.ymin;break;case 6:t=2;continue;case 2:t=10,o=this.xmax,a=this.ymax;break;case 10:t=8;continue;case 8:t=9,o=this.xmin,a=this.ymax;break;case 9:t=1;continue;case 1:t=5,o=this.xmin,a=this.ymin;break}(r[s]!==o||r[s+1]!==a)&&this.contains(e,o,a)&&(r.splice(s,0,o,a),s+=2)}return s}_project(e,t,n,r){let s=1/0,o,a,l;if(r<0){if(t<=this.ymin)return null;(o=(this.ymin-t)/r)<s&&(l=this.ymin,a=e+(s=o)*n)}else if(r>0){if(t>=this.ymax)return null;(o=(this.ymax-t)/r)<s&&(l=this.ymax,a=e+(s=o)*n)}if(n>0){if(e>=this.xmax)return null;(o=(this.xmax-e)/n)<s&&(a=this.xmax,l=t+(s=o)*r)}else if(n<0){if(e<=this.xmin)return null;(o=(this.xmin-e)/n)<s&&(a=this.xmin,l=t+(s=o)*r)}return[a,l]}_edgecode(e,t){return(e===this.xmin?1:e===this.xmax?2:0)|(t===this.ymin?4:t===this.ymax?8:0)}_regioncode(e,t){return(e<this.xmin?1:e>this.xmax?2:0)|(t<this.ymin?4:t>this.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t<e.length;t+=2){let n=(t+2)%e.length,r=(t+4)%e.length;(e[t]===e[n]&&e[n]===e[r]||e[t+1]===e[n+1]&&e[n+1]===e[r+1])&&(e.splice(n,2),t-=2)}e.length||(e=null)}return e}};var $we=2*Math.PI,B_=Math.pow;function Ywe(i){return i[0]}function Zwe(i){return i[1]}function Kwe(i){let{triangles:e,coords:t}=i;for(let n=0;n<e.length;n+=3){let r=2*e[n],s=2*e[n+1],o=2*e[n+2];if((t[o]-t[r])*(t[s+1]-t[r+1])-(t[s]-t[r])*(t[o+1]-t[r+1])>1e-10)return!1}return!0}function Qwe(i,e,t){return[i+Math.sin(i+e)*t,e+Math.cos(i-e)*t]}var O_=class i{static from(e,t=Ywe,n=Zwe,r){return new i("length"in e?Jwe(e,t,n,r):Float64Array.from(eSe(e,t,n,r)))}constructor(e){this._delaunator=new J0(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&Kwe(e)){this.collinear=Int32Array.from({length:t.length/2},(d,A)=>A).sort((d,A)=>t[2*d]-t[2*A]||t[2*d+1]-t[2*A+1]);let l=this.collinear[0],c=this.collinear[this.collinear.length-1],u=[t[2*l],t[2*l+1],t[2*c],t[2*c+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let d=0,A=t.length/2;d<A;++d){let y=Qwe(t[2*d],t[2*d+1],f);t[2*d]=y[0],t[2*d+1]=y[1]}this._delaunator=new J0(t)}else delete this.collinear;let n=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,s=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let l=0,c=n.length;l<c;++l){let u=s[l%3===2?l-2:l+1];(n[l]===-1||o[u]===-1)&&(o[u]=l)}for(let l=0,c=r.length;l<c;++l)a[r[l]]=l;r.length<=2&&r.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],o[r[0]]=1,r.length===2&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(e){return new Rw(this,e)}*neighbors(e){let{inedges:t,hull:n,_hullIndex:r,halfedges:s,triangles:o,collinear:a}=this;if(a){let f=a.indexOf(e);f>0&&(yield a[f-1]),f<a.length-1&&(yield a[f+1]);return}let l=t[e];if(l===-1)return;let c=l,u=-1;do{if(yield u=o[c],c=c%3===2?c-2:c+1,o[c]!==e)return;if(c=s[c],c===-1){let f=n[(r[e]+1)%n.length];f!==u&&(yield f);return}}while(c!==l)}find(e,t,n=0){if(e=+e,e!==e||(t=+t,t!==t))return-1;let r=n,s;for(;(s=this._step(n,e,t))>=0&&s!==n&&s!==r;)n=s;return s}_step(e,t,n){let{inedges:r,hull:s,_hullIndex:o,halfedges:a,triangles:l,points:c}=this;if(r[e]===-1||!c.length)return(e+1)%(c.length>>1);let u=e,f=B_(t-c[e*2],2)+B_(n-c[e*2+1],2),d=r[e],A=d;do{let y=l[A],w=B_(t-c[y*2],2)+B_(n-c[y*2+1],2);if(w<f&&(f=w,u=y),A=A%3===2?A-2:A+1,l[A]!==e)break;if(A=a[A],A===-1){if(A=s[(o[e]+1)%s.length],A!==y&&B_(t-c[A*2],2)+B_(n-c[A*2+1],2)<f)return A;break}}while(A!==d);return u}render(e){let t=e==null?e=new $c:void 0,{points:n,halfedges:r,triangles:s}=this;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l<o)continue;let c=s[o]*2,u=s[l]*2;e.moveTo(n[c],n[c+1]),e.lineTo(n[u],n[u+1])}return this.renderHull(e),t&&t.value()}renderPoints(e,t){t===void 0&&(!e||typeof e.moveTo!="function")&&(t=e,e=null),t=t==null?2:+t;let n=e==null?e=new $c:void 0,{points:r}=this;for(let s=0,o=r.length;s<o;s+=2){let a=r[s],l=r[s+1];e.moveTo(a+t,l),e.arc(a,l,t,0,$we)}return n&&n.value()}renderHull(e){let t=e==null?e=new $c:void 0,{hull:n,points:r}=this,s=n[0]*2,o=n.length;e.moveTo(r[s],r[s+1]);for(let a=1;a<o;++a){let l=2*n[a];e.lineTo(r[l],r[l+1])}return e.closePath(),t&&t.value()}hullPolygon(){let e=new em;return this.renderHull(e),e.value()}renderTriangle(e,t){let n=t==null?t=new $c:void 0,{points:r,triangles:s}=this,o=s[e*=3]*2,a=s[e+1]*2,l=s[e+2]*2;return t.moveTo(r[o],r[o+1]),t.lineTo(r[a],r[a+1]),t.lineTo(r[l],r[l+1]),t.closePath(),n&&n.value()}*trianglePolygons(){let{triangles:e}=this;for(let t=0,n=e.length/3;t<n;++t)yield this.trianglePolygon(t)}trianglePolygon(e){let t=new em;return this.renderTriangle(e,t),t.value()}};function Jwe(i,e,t,n){let r=i.length,s=new Float64Array(r*2);for(let o=0;o<r;++o){let a=i[o];s[o*2]=e.call(n,a,o,i),s[o*2+1]=t.call(n,a,o,i)}return s}function*eSe(i,e,t,n){let r=0;for(let s of i)yield e.call(n,s,r,i),yield t.call(n,s,r,i),++r}var Pw=Math.PI,oee=Pw/2,Uat=Pw/4,kat=Pw*2,_O=180/Pw,xO=Pw/180;var yO=Math.atan2,tR=Math.cos;var aee=Math.max,lee=Math.min;var nR=Math.sin,cee=Math.sign||function(i){return i>0?1:i<0?-1:0},iR=Math.sqrt;function bO(i){return i>1?oee:i<-1?-oee:Math.asin(i)}function wO(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Cl(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function Iw(i,e){return[i[0]+e[0],i[1]+e[1],i[2]+e[2]]}function Lw(i){var e=iR(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);return[i[0]/e,i[1]/e,i[2]/e]}function SO(i){return[yO(i[1],i[0])*_O,bO(aee(-1,lee(1,i[2])))*_O]}function nf(i){let e=i[0]*xO,t=i[1]*xO,n=tR(t);return[n*tR(e),n*nR(e),nR(t)]}function rR(i){return i=i.map(e=>nf(e)),wO(i[0],Cl(i[2],i[1]))}function hee(i){let e=nSe(i),t=rSe(e),n=iSe(t,i),r=oSe(t,i.length),s=tSe(r,i),o=sSe(t,i),{polygons:a,centers:l}=aSe(o,t,i),c=lSe(a),u=uSe(t,i),f=cSe(n,t);return{delaunay:e,edges:n,triangles:t,centers:l,neighbors:r,polygons:a,mesh:c,hull:u,urquhart:f,find:s}}function tSe(i,e){function t(n,r){let s=n[0]-r[0],o=n[1]-r[1],a=n[2]-r[2];return s*s+o*o+a*a}return function(r,s,o){o===void 0&&(o=0);let a,l,c=o,u=nf([r,s]);do a=o,o=null,l=t(u,nf(e[a])),i[a].forEach(f=>{let d=t(u,nf(e[f]));if(d<l){l=d,o=f,c=f;return}});while(o!==null);return c}}function nSe(i){if(i.length<2)return{};let e=0;for(;isNaN(i[e][0]+i[e][1])&&e++<i.length;);let t=EB(i[e]),n=HB().translate([0,0]).scale(1).rotate(t.invert([180,0]));i=i.map(n);let r=[],s=1;for(let d=0,A=i.length;d<A;d++){let y=i[d][0]**2+i[d][1]**2;!isFinite(y)||y>1e32?r.push(d):y>s&&(s=y)}let o=1e6*iR(s);r.forEach(d=>i[d]=[o,0]),i.push([0,o]),i.push([-o,0]),i.push([0,-o]);let a=O_.from(i);a.projection=n;let{triangles:l,halfedges:c,inedges:u}=a,f=[];for(let d=0,A=c.length;d<A;d++)if(c[d]<0){let y=d%3==2?d-2:d+1,w=d%3==0?d+2:d-1,S=c[y],T=c[w];c[S]=T,c[T]=S,c[y]=c[w]=-1,l[d]=l[y]=l[w]=e,u[l[S]]=S%3==0?S+2:S-1,u[l[T]]=T%3==0?T+2:T-1,f.push(Math.min(d,y,w)),d+=2-d%3}else l[d]>i.length-3-1&&(l[d]=e);return a}function iSe(i,e){let t=new Set;return e.length===2?[[0,1]]:(i.forEach(n=>{if(n[0]!==n[1]&&!(rR(n.map(r=>e[r]))<0))for(let r=0,s;r<3;r++)s=(r+1)%3,t.add(W0([n[r],n[s]]).join("-"))}),Array.from(t,n=>n.split("-").map(Number)))}function rSe(i){let{triangles:e}=i;if(!e)return[];let t=[];for(let n=0,r=e.length/3;n<r;n++){let s=e[3*n],o=e[3*n+1],a=e[3*n+2];s!==o&&o!==a&&t.push([s,a,o])}return t}function sSe(i,e){return i.map(t=>{let n=t.map(s=>e[s]).map(nf),r=Iw(Iw(Cl(n[1],n[0]),Cl(n[2],n[1])),Cl(n[0],n[2]));return SO(Lw(r))})}function oSe(i,e){let t=[];return i.forEach(n=>{for(let r=0;r<3;r++){let s=n[r],o=n[(r+1)%3];t[s]=t[s]||[],t[s].push(o)}}),i.length===0&&(e===2?(t[0]=[1],t[1]=[0]):e===1&&(t[0]=[])),t}function aSe(i,e,t){let n=[],r=i.slice();if(e.length===0){if(t.length<2)return{polygons:n,centers:r};if(t.length===2){let a=nf(t[0]),l=nf(t[1]),c=Lw(Iw(a,l)),u=Lw(Cl(a,l)),f=Cl(c,u),d=[c,Cl(c,f),Cl(Cl(c,f),f),Cl(Cl(Cl(c,f),f),f)].map(SO).map(o);return n.push(d),n.push(d.slice().reverse()),{polygons:n,centers:r}}}e.forEach((a,l)=>{for(let c=0;c<3;c++){let u=a[c],f=a[(c+1)%3],d=a[(c+2)%3];n[u]=n[u]||[],n[u].push([f,d,l,[u,f,d]])}});let s=n.map(a=>{let l=[a[0][2]],c=a[0][1];for(let u=1;u<a.length;u++)for(let f=0;f<a.length;f++)if(a[f][0]==c){c=a[f][1],l.push(a[f][2]);break}if(l.length>2)return l;if(l.length==2){let u=uee(t[a[0][3][0]],t[a[0][3][1]],r[l[0]]),f=uee(t[a[0][3][2]],t[a[0][3][0]],r[l[0]]),d=o(u),A=o(f);return[l[0],A,l[1],d]}});function o(a){let l=-1;return r.slice(e.length,1/0).forEach((c,u)=>{c[0]===a[0]&&c[1]===a[1]&&(l=u+e.length)}),l<0&&(l=r.length,r.push(a)),l}return{polygons:s,centers:r}}function uee(i,e,t){i=nf(i),e=nf(e),t=nf(t);let n=cee(wO(Cl(e,i),t));return SO(Lw(Iw(i,e)).map(r=>n*r))}function lSe(i){let e=[];return i.forEach(t=>{if(!t)return;let n=t[t.length-1];for(let r of t)r>n&&e.push([n,r]),n=r}),e}function cSe(i,e){return function(t){let n=new Map,r=new Map;return i.forEach((s,o)=>{let a=s.join("-");n.set(a,t[o]),r.set(a,!0)}),e.forEach(s=>{let o=0,a=-1;for(let l=0;l<3;l++){let c=W0([s[l],s[(l+1)%3]]).join("-");n.get(c)>o&&(o=n.get(c),a=c)}r.set(a,!1)}),i.map(s=>r.get(s.join("-")))}}function uSe(i,e){let t=new Set,n=[];i.map(a=>{if(!(rR(a.map(l=>e[l>e.length?0:l]))>1e-12))for(let l=0;l<3;l++){let c=[a[l],a[(l+1)%3]],u=`${c[0]}-${c[1]}`;t.has(u)?t.delete(u):t.add(`${c[1]}-${c[0]}`)}});let r=new Map,s;if(t.forEach(a=>{a=a.split("-").map(Number),r.set(a[0],a[1]),s=a[0]}),s===void 0)return n;let o=s;do{n.push(o);let a=r.get(o);r.set(o,-1),o=a}while(o>-1&&o!==s);return n}function TO(i){let e=function(t){if(e.delaunay=null,e._data=t,typeof e._data=="object"&&e._data.type==="FeatureCollection"&&(e._data=e._data.features),typeof e._data=="object"){let n=e._data.map(r=>[e._vx(r),e._vy(r),r]).filter(r=>isFinite(r[0]+r[1]));e.points=n.map(r=>[r[0],r[1]]),e.valid=n.map(r=>r[2]),e.delaunay=hee(e.points)}return e};return e._vx=function(t){if(typeof t=="object"&&"type"in t)return CC(t)[0];if(0 in t)return t[0]},e._vy=function(t){if(typeof t=="object"&&"type"in t)return CC(t)[1];if(1 in t)return t[1]},e.x=function(t){return t?(e._vx=t,e):e._vx},e.y=function(t){return t?(e._vy=t,e):e._vy},e.polygons=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let n={type:"FeatureCollection",features:[]};return e.valid.length===0||(e.delaunay.polygons.forEach((r,s)=>n.features.push({type:"Feature",geometry:r?{type:"Polygon",coordinates:[[...r,r[0]].map(o=>e.delaunay.centers[o])]}:null,properties:{site:e.valid[s],sitecoordinates:e.points[s],neighbours:e.delaunay.neighbors[s]}})),e.valid.length===1&&n.features.push({type:"Feature",geometry:{type:"Sphere"},properties:{site:e.valid[0],sitecoordinates:e.points[0],neighbours:[]}})),n},e.triangles=function(t){return t!==void 0&&e(t),e.delaunay?{type:"FeatureCollection",features:e.delaunay.triangles.map((n,r)=>(n=n.map(s=>e.points[s]),n.center=e.delaunay.centers[r],n)).filter(n=>rR(n)>0).map(n=>({type:"Feature",properties:{circumcenter:n.center},geometry:{type:"Polygon",coordinates:[[...n,n[0]]]}}))}:!1},e.links=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let n=e.delaunay.edges.map(s=>Ml(e.points[s[0]],e.points[s[1]])),r=e.delaunay.urquhart(n);return{type:"FeatureCollection",features:e.delaunay.edges.map((s,o)=>({type:"Feature",properties:{source:e.valid[s[0]],target:e.valid[s[1]],length:n[o],urquhart:!!r[o]},geometry:{type:"LineString",coordinates:[e.points[s[0]],e.points[s[1]]]}}))}},e.mesh=function(t){return t!==void 0&&e(t),e.delaunay?{type:"MultiLineString",coordinates:e.delaunay.edges.map(n=>[e.points[n[0]],e.points[n[1]]])}:!1},e.cellMesh=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let{centers:n,polygons:r}=e.delaunay,s=[];for(let o of r)if(o)for(let a=o.length,l=o[a-1],c=o[0],u=0;u<a;l=c,c=o[++u])c>l&&s.push([n[l],n[c]]);return{type:"MultiLineString",coordinates:s}},e._found=void 0,e.find=function(t,n,r){if(e._found=e.delaunay.find(t,n,e._found),!r||Ml([t,n],e.points[e._found])<r)return e._found},e.hull=function(t){t!==void 0&&e(t);let n=e.delaunay.hull,r=e.points;return n.length===0?null:{type:"Polygon",coordinates:[[...n.map(s=>r[s]),r[n[0]]]]}},i?e(i):e}function MO(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function hSe(i){if(Array.isArray(i))return i}function fSe(i){if(Array.isArray(i))return MO(i)}function dSe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function pSe(i,e,t){return e=oR(e),bSe(i,dee()?Reflect.construct(e,[],oR(i).constructor):e.apply(i,t))}function mSe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function ASe(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function oR(i){return oR=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},oR(i)}function gSe(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&CO(i,e)}function dee(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(dee=function(){return!!i})()}function vSe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function _Se(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function xSe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4126+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ySe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4127+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bSe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dSe(i)}function CO(i,e){return CO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},CO(i,e)}function rf(i,e){return hSe(i)||_Se(i,e)||pee(i,e)||xSe()}function EO(i){return fSe(i)||vSe(i)||pee(i)||ySe()}function pee(i,e){if(i){if(typeof i=="string")return MO(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?MO(i,e):void 0}}function wSe(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=SSe(i,n),s=Zh(r),o=TSe(i,n),a=[].concat(EO(s),EO(o)),l={type:"Polygon",coordinates:i},c=xC(l),u=rf(c,2),f=rf(u[0],2),d=f[0],A=f[1],y=rf(u[1],2),w=y[0],S=y[1],T=d>w||S>=89||A<=-89,R=[];if(T){var I=TO(a).triangles(),P=new Map(a.map(function(J,te){var ce=rf(J,2),he=ce[0],ve=ce[1];return["".concat(he,"-").concat(ve),te]}));I.features.forEach(function(J){var te,ce=J.geometry.coordinates[0].slice(0,3).reverse(),he=[];if(ce.forEach(function(Re){var Qe=rf(Re,2),Fe=Qe[0],mt=Qe[1],Ee="".concat(Fe,"-").concat(mt);P.has(Ee)&&he.push(P.get(Ee))}),he.length===3){if(he.some(function(Re){return Re<s.length})){var ve=J.properties.circumcenter;if(!RO(ve,l,T))return}(te=R).push.apply(te,he)}})}else if(o.length)for(var B=J0.from(a),k=function(te){var ce,he=[2,1,0].map(function(Qe){return B.triangles[te+Qe]}),ve=he.map(function(Qe){return a[Qe]});if(he.some(function(Qe){return Qe<s.length})){var Re=[0,1].map(function(Qe){return nC(ve,function(Fe){return Fe[Qe]})});if(!RO(Re,l,T))return 1}(ce=R).push.apply(ce,EO(he))},z=0,G=B.triangles.length;z<G;z+=3)k(z);else{var F=P_(r),D=F.vertices,L=F.holes,C=L===void 0?[]:L;R=rO(D,C,2)}var W=Tl(W0(a,function(J){return J[0]}),[0,1]),Y=Tl(W0(a,function(J){return J[1]}),[0,1]),H=a.map(function(J){var te=rf(J,2),ce=te[0],he=te[1];return[W(ce),Y(he)]}),$={points:a,indices:R,uvs:H};return{contour:r,triangles:$}}function SSe(i,e){return i.map(function(t){var n=[],r;return t.forEach(function(s){if(r){var o=Ml(s,r)*180/Math.PI;if(o>e)for(var a=Eg(r,s),l=1/Math.ceil(o/e),c=l;c<1;)n.push(a(c)),c+=l}n.push(r=s)}),n})}function TSe(i,e){var t={type:"Polygon",coordinates:i},n=xC(t),r=rf(n,2),s=rf(r[0],2),o=s[0],a=s[1],l=rf(r[1],2),c=l[0],u=l[1];if(Math.min(Math.abs(c-o),Math.abs(u-a))<e)return[];var f=o>c||u>=89||a<=-89;return ESe(e,{minLng:o,maxLng:c,minLat:a,maxLat:u}).filter(function(d){return RO(d,t,f)})}function ESe(i){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.minLng,n=e.maxLng,r=e.minLat,s=e.maxLat,o=Math.round(Math.pow(360/i,2)/Math.PI),a=(1+Math.sqrt(5))/2,l=function(T){return T/a*360%360-180},c=function(T){return Math.acos(2*T/o-1)/Math.PI*180-90},u=function(T){return o*(Math.cos((T+90)*Math.PI/180)+1)/2},f=[s!==void 0?Math.ceil(u(s)):0,r!==void 0?Math.floor(u(r)):o-1],d=t===void 0&&n===void 0?function(){return!0}:t===void 0?function(S){return S<=n}:n===void 0?function(S){return S>=t}:n>=t?function(S){return S>=t&&S<=n}:function(S){return S>=t||S<=n},A=[],y=f[0];y<=f[1];y++){var w=l(y);d(w)&&A.push([w,c(y)])}return A}function RO(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?DB(e,i):see(i,e)}var sR=window.THREE?window.THREE:{BufferGeometry:Xn,Float32BufferAttribute:Ln},fee=new sR.BufferGeometry().setAttribute?"setAttribute":"addAttribute",aR=(function(i){function e(t,n,r,s,o,a,l){var c;mSe(this,e),c=pSe(this,e),c.type="ConicPolygonGeometry",c.parameters={polygonGeoJson:t,bottomHeight:n,topHeight:r,closedBottom:s,closedTop:o,includeSides:a,curvatureResolution:l},n=n||0,r=r||1,s=s!==void 0?s:!0,o=o!==void 0?o:!0,a=a!==void 0?a:!0,l=l||5;var u=wSe(t,{resolution:l}),f=u.contour,d=u.triangles,A=Zh(d.uvs),y=[],w=[],S=[],T=0,R=function(L){var C=Math.round(y.length/3),B=S.length;y=y.concat(L.vertices),w=w.concat(L.uvs),S=S.concat(C?L.indices.map(function(k){return k+C}):L.indices),c.addGroup(B,S.length-B,T++)};a&&R(P()),s&&R(F(n,!1)),o&&R(F(r,!0)),c.setIndex(S),c[fee]("position",new sR.Float32BufferAttribute(y,3)),c[fee]("uv",new sR.Float32BufferAttribute(w,2)),c.computeVertexNormals();function I(D,L){var C=typeof L=="function"?L:function(){return L},B=D.map(function(k){return k.map(function(z){var G=rf(z,2),W=G[0],Y=G[1];return MSe(Y,W,C(W,Y))})});return P_(B)}function P(){for(var D=I(f,n),L=D.vertices,C=D.holes,B=I(f,r),k=B.vertices,z=Zh([k,L]),G=Math.round(k.length/3),W=new Set(C),Y=0,H=[],$=0;$<G;$++){var J=$+1;if(J===G)J=Y;else if(W.has(J)){var te=J;J=Y,Y=te}H.push($,$+G,J+G),H.push(J+G,J,$)}for(var ce=[],he=1;he>=0;he--)for(var ve=0;ve<G;ve+=1)ce.push(ve/(G-1),he);return{indices:H,vertices:z,uvs:ce}}function F(D){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return{indices:L?d.indices:d.indices.slice().reverse(),vertices:I([d.points],D).vertices,uvs:A}}return c}return gSe(e,i),ASe(e)})(sR.BufferGeometry);function MSe(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}function PO(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function CSe(i){if(Array.isArray(i))return i}function RSe(i){if(Array.isArray(i))return PO(i)}function PSe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function ISe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function LSe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4128+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function DSe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4129+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NSe(i,e){if(i==null)return{};var t,n,r=FSe(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.includes(t)||{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function FSe(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.includes(n))continue;t[n]=i[n]}return t}function BSe(i,e){return CSe(i)||ISe(i,e)||mee(i,e)||LSe()}function OSe(i){return RSe(i)||PSe(i)||mee(i)||DSe()}function USe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function kSe(i){var e=USe(i,"string");return typeof e=="symbol"?e:e+""}function mee(i,e){if(i){if(typeof i=="string")return PO(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?PO(i,e):void 0}}var Aee=(function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=(e instanceof Array?e.length?e:[void 0]:[e]).map(function(a){return{keyAccessor:a,isProp:!(a instanceof Function)}}),s=i.reduce(function(a,l){var c=a,u=l;return r.forEach(function(f,d){var A=f.keyAccessor,y=f.isProp,w;if(y){var S=u,T=S[A],R=NSe(S,[A].map(kSe));w=T,u=R}else w=A(u,d);d+1<r.length?(c.hasOwnProperty(w)||(c[w]={}),c=c[w]):t?(c.hasOwnProperty(w)||(c[w]=[]),c[w].push(u)):c[w]=u}),a},{});t instanceof Function&&(function a(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;c===r.length?Object.keys(l).forEach(function(u){return l[u]=t(l[u])}):Object.values(l).forEach(function(u){return a(u,c+1)})})(s);var o=s;return n&&(o=[],(function a(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];c.length===r.length?o.push({keys:c,vals:l}):Object.entries(l).forEach(function(u){var f=BSe(u,2),d=f[0],A=f[1];return a(A,[].concat(OSe(c),[d]))})})(s),e instanceof Array&&e.length===0&&o.length===1&&(o[0].keys=[])),o});var Ai=(function(i){i=i||{};var e=typeof i<"u"?i:{},t={},n;for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);var r=[],s="";function o(Le){return e.locateFile?e.locateFile(Le,s):s+Le}var a;typeof document<"u"&&document.currentScript&&(s=document.currentScript.src),s.indexOf("blob:")!==0?s=s.substr(0,s.lastIndexOf("/")+1):s="",a=function(it,Dt,He){var h=new XMLHttpRequest;h.open("GET",it,!0),h.responseType="arraybuffer",h.onload=function(){if(h.status==200||h.status==0&&h.response){Dt(h.response);return}var Pi=St(it);if(Pi){Dt(Pi.buffer);return}He()},h.onerror=He,h.send(null)};var l=e.print||console.log.bind(console),c=e.printErr||console.warn.bind(console);for(n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);t=null,e.arguments&&(r=e.arguments);var u=0,f=function(Le){u=Le},d=function(){return u},A=8;function y(Le,it,Dt,He){switch(Dt=Dt||"i8",Dt.charAt(Dt.length-1)==="*"&&(Dt="i32"),Dt){case"i1":Y[Le>>0]=it;break;case"i8":Y[Le>>0]=it;break;case"i16":$[Le>>1]=it;break;case"i32":te[Le>>2]=it;break;case"i64":Ge=[it>>>0,(Ie=it,+bt(Ie)>=1?Ie>0?(en(+hn(Ie/4294967296),4294967295)|0)>>>0:~~+yt((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],te[Le>>2]=Ge[0],te[Le+4>>2]=Ge[1];break;case"float":he[Le>>2]=it;break;case"double":ve[Le>>3]=it;break;default:Um("invalid type for setValue: "+Dt)}}function w(Le,it,Dt){switch(it=it||"i8",it.charAt(it.length-1)==="*"&&(it="i32"),it){case"i1":return Y[Le>>0];case"i8":return Y[Le>>0];case"i16":return $[Le>>1];case"i32":return te[Le>>2];case"i64":return te[Le>>2];case"float":return he[Le>>2];case"double":return ve[Le>>3];default:Um("invalid type for getValue: "+it)}return null}var S=!1;function T(Le,it){Le||Um("Assertion failed: "+it)}function R(Le){var it=e["_"+Le];return T(it,"Cannot call unknown function "+Le+", make sure it is exported"),it}function I(Le,it,Dt,He,h){var sr={string:function(ii){var zi=0;if(ii!=null&&ii!==0){var iT=(ii.length<<2)+1;zi=WG(iT),B(ii,zi,iT)}return zi},array:function(ii){var zi=WG(ii.length);return z(ii,zi),zi}};function Pi(ii){return it==="string"?L(ii):it==="boolean"?!!ii:ii}var ie=R(Le),or=[],ol=0;if(He)for(var fo=0;fo<He.length;fo++){var Ks=sr[Dt[fo]];Ks?(ol===0&&(ol=vce()),or[fo]=Ks(He[fo])):or[fo]=He[fo]}var bs=ie.apply(null,or);return bs=Pi(bs),ol!==0&&gce(ol),bs}function P(Le,it,Dt,He){Dt=Dt||[];var h=Dt.every(function(Pi){return Pi==="number"}),sr=it!=="string";return sr&&h&&!He?R(Le):function(){return I(Le,it,Dt,arguments,He)}}var F=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function D(Le,it,Dt){for(var He=it+Dt,h=it;Le[h]&&!(h>=He);)++h;if(h-it>16&&Le.subarray&&F)return F.decode(Le.subarray(it,h));for(var sr="";it<h;){var Pi=Le[it++];if(!(Pi&128)){sr+=String.fromCharCode(Pi);continue}var ie=Le[it++]&63;if((Pi&224)==192){sr+=String.fromCharCode((Pi&31)<<6|ie);continue}var or=Le[it++]&63;if((Pi&240)==224?Pi=(Pi&15)<<12|ie<<6|or:Pi=(Pi&7)<<18|ie<<12|or<<6|Le[it++]&63,Pi<65536)sr+=String.fromCharCode(Pi);else{var ol=Pi-65536;sr+=String.fromCharCode(55296|ol>>10,56320|ol&1023)}}return sr}function L(Le,it){return Le?D(H,Le,it):""}function C(Le,it,Dt,He){if(!(He>0))return 0;for(var h=Dt,sr=Dt+He-1,Pi=0;Pi<Le.length;++Pi){var ie=Le.charCodeAt(Pi);if(ie>=55296&&ie<=57343){var or=Le.charCodeAt(++Pi);ie=65536+((ie&1023)<<10)|or&1023}if(ie<=127){if(Dt>=sr)break;it[Dt++]=ie}else if(ie<=2047){if(Dt+1>=sr)break;it[Dt++]=192|ie>>6,it[Dt++]=128|ie&63}else if(ie<=65535){if(Dt+2>=sr)break;it[Dt++]=224|ie>>12,it[Dt++]=128|ie>>6&63,it[Dt++]=128|ie&63}else{if(Dt+3>=sr)break;it[Dt++]=240|ie>>18,it[Dt++]=128|ie>>12&63,it[Dt++]=128|ie>>6&63,it[Dt++]=128|ie&63}}return it[Dt]=0,Dt-h}function B(Le,it,Dt){return C(Le,H,it,Dt)}var k=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function z(Le,it){Y.set(Le,it)}function G(Le,it){return Le%it>0&&(Le+=it-Le%it),Le}var W,Y,H,$,J,te,ce,he,ve;function Re(Le){W=Le,e.HEAP8=Y=new Int8Array(Le),e.HEAP16=$=new Int16Array(Le),e.HEAP32=te=new Int32Array(Le),e.HEAPU8=H=new Uint8Array(Le),e.HEAPU16=J=new Uint16Array(Le),e.HEAPU32=ce=new Uint32Array(Le),e.HEAPF32=he=new Float32Array(Le),e.HEAPF64=ve=new Float64Array(Le)}var Qe=5271296,Fe=28384,mt=e.TOTAL_MEMORY||33554432;e.buffer?W=e.buffer:W=new ArrayBuffer(mt),mt=W.byteLength,Re(W),te[Fe>>2]=Qe;function Ee(Le){for(;Le.length>0;){var it=Le.shift();if(typeof it=="function"){it();continue}var Dt=it.func;typeof Dt=="number"?it.arg===void 0?e.dynCall_v(Dt):e.dynCall_vi(Dt,it.arg):Dt(it.arg===void 0?null:it.arg)}}var Ve=[],Ye=[],Mt=[],Et=[];function Pt(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)ot(e.preRun.shift());Ee(Ve)}function dn(){Ee(Ye)}function Gt(){Ee(Mt)}function $e(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)nt(e.postRun.shift());Ee(Et)}function ot(Le){Ve.unshift(Le)}function nt(Le){Et.unshift(Le)}var bt=Math.abs,yt=Math.ceil,hn=Math.floor,en=Math.min,tn=0,bn=null,_e=null;function vi(Le){tn++,e.monitorRunDependencies&&e.monitorRunDependencies(tn)}function zn(Le){if(tn--,e.monitorRunDependencies&&e.monitorRunDependencies(tn),tn==0&&(bn!==null&&(clearInterval(bn),bn=null),_e)){var it=_e;_e=null,it()}}e.preloadedImages={},e.preloadedAudios={};var le=null,Z="data:application/octet-stream;base64,";function Te(Le){return String.prototype.startsWith?Le.startsWith(Z):Le.indexOf(Z)===0}var Ie,Ge;le="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAYAAAAAAAAAAwAAAAIAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFAAAABAAAAAAAAAABAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAgAAAAQAAAADAAAACAAAAAEAAAAHAAAABgAAAAkAAAAAAAAAAwAAAAIAAAACAAAABgAAAAoAAAALAAAAAAAAAAEAAAAFAAAAAwAAAA0AAAABAAAABwAAAAQAAAAMAAAAAAAAAAQAAAB/AAAADwAAAAgAAAADAAAAAAAAAAwAAAAFAAAAAgAAABIAAAAKAAAACAAAAAAAAAAQAAAABgAAAA4AAAALAAAAEQAAAAEAAAAJAAAAAgAAAAcAAAAVAAAACQAAABMAAAADAAAADQAAAAEAAAAIAAAABQAAABYAAAAQAAAABAAAAAAAAAAPAAAACQAAABMAAAAOAAAAFAAAAAEAAAAHAAAABgAAAAoAAAALAAAAGAAAABcAAAAFAAAAAgAAABIAAAALAAAAEQAAABcAAAAZAAAAAgAAAAYAAAAKAAAADAAAABwAAAANAAAAGgAAAAQAAAAPAAAAAwAAAA0AAAAaAAAAFQAAAB0AAAADAAAADAAAAAcAAAAOAAAAfwAAABEAAAAbAAAACQAAABQAAAAGAAAADwAAABYAAAAcAAAAHwAAAAQAAAAIAAAADAAAABAAAAASAAAAIQAAAB4AAAAIAAAABQAAABYAAAARAAAACwAAAA4AAAAGAAAAIwAAABkAAAAbAAAAEgAAABgAAAAeAAAAIAAAAAUAAAAKAAAAEAAAABMAAAAiAAAAFAAAACQAAAAHAAAAFQAAAAkAAAAUAAAADgAAABMAAAAJAAAAKAAAABsAAAAkAAAAFQAAACYAAAATAAAAIgAAAA0AAAAdAAAABwAAABYAAAAQAAAAKQAAACEAAAAPAAAACAAAAB8AAAAXAAAAGAAAAAsAAAAKAAAAJwAAACUAAAAZAAAAGAAAAH8AAAAgAAAAJQAAAAoAAAAXAAAAEgAAABkAAAAXAAAAEQAAAAsAAAAtAAAAJwAAACMAAAAaAAAAKgAAAB0AAAArAAAADAAAABwAAAANAAAAGwAAACgAAAAjAAAALgAAAA4AAAAUAAAAEQAAABwAAAAfAAAAKgAAACwAAAAMAAAADwAAABoAAAAdAAAAKwAAACYAAAAvAAAADQAAABoAAAAVAAAAHgAAACAAAAAwAAAAMgAAABAAAAASAAAAIQAAAB8AAAApAAAALAAAADUAAAAPAAAAFgAAABwAAAAgAAAAHgAAABgAAAASAAAANAAAADIAAAAlAAAAIQAAAB4AAAAxAAAAMAAAABYAAAAQAAAAKQAAACIAAAATAAAAJgAAABUAAAA2AAAAJAAAADMAAAAjAAAALgAAAC0AAAA4AAAAEQAAABsAAAAZAAAAJAAAABQAAAAiAAAAEwAAADcAAAAoAAAANgAAACUAAAAnAAAANAAAADkAAAAYAAAAFwAAACAAAAAmAAAAfwAAACIAAAAzAAAAHQAAAC8AAAAVAAAAJwAAACUAAAAZAAAAFwAAADsAAAA5AAAALQAAACgAAAAbAAAAJAAAABQAAAA8AAAALgAAADcAAAApAAAAMQAAADUAAAA9AAAAFgAAACEAAAAfAAAAKgAAADoAAAArAAAAPgAAABwAAAAsAAAAGgAAACsAAAA+AAAALwAAAEAAAAAaAAAAKgAAAB0AAAAsAAAANQAAADoAAABBAAAAHAAAAB8AAAAqAAAALQAAACcAAAAjAAAAGQAAAD8AAAA7AAAAOAAAAC4AAAA8AAAAOAAAAEQAAAAbAAAAKAAAACMAAAAvAAAAJgAAACsAAAAdAAAARQAAADMAAABAAAAAMAAAADEAAAAeAAAAIQAAAEMAAABCAAAAMgAAADEAAAB/AAAAPQAAAEIAAAAhAAAAMAAAACkAAAAyAAAAMAAAACAAAAAeAAAARgAAAEMAAAA0AAAAMwAAAEUAAAA2AAAARwAAACYAAAAvAAAAIgAAADQAAAA5AAAARgAAAEoAAAAgAAAAJQAAADIAAAA1AAAAPQAAAEEAAABLAAAAHwAAACkAAAAsAAAANgAAAEcAAAA3AAAASQAAACIAAAAzAAAAJAAAADcAAAAoAAAANgAAACQAAABIAAAAPAAAAEkAAAA4AAAARAAAAD8AAABNAAAAIwAAAC4AAAAtAAAAOQAAADsAAABKAAAATgAAACUAAAAnAAAANAAAADoAAAB/AAAAPgAAAEwAAAAsAAAAQQAAACoAAAA7AAAAPwAAAE4AAABPAAAAJwAAAC0AAAA5AAAAPAAAAEgAAABEAAAAUAAAACgAAAA3AAAALgAAAD0AAAA1AAAAMQAAACkAAABRAAAASwAAAEIAAAA+AAAAKwAAADoAAAAqAAAAUgAAAEAAAABMAAAAPwAAAH8AAAA4AAAALQAAAE8AAAA7AAAATQAAAEAAAAAvAAAAPgAAACsAAABUAAAARQAAAFIAAABBAAAAOgAAADUAAAAsAAAAVgAAAEwAAABLAAAAQgAAAEMAAABRAAAAVQAAADEAAAAwAAAAPQAAAEMAAABCAAAAMgAAADAAAABXAAAAVQAAAEYAAABEAAAAOAAAADwAAAAuAAAAWgAAAE0AAABQAAAARQAAADMAAABAAAAALwAAAFkAAABHAAAAVAAAAEYAAABDAAAANAAAADIAAABTAAAAVwAAAEoAAABHAAAAWQAAAEkAAABbAAAAMwAAAEUAAAA2AAAASAAAAH8AAABJAAAANwAAAFAAAAA8AAAAWAAAAEkAAABbAAAASAAAAFgAAAA2AAAARwAAADcAAABKAAAATgAAAFMAAABcAAAANAAAADkAAABGAAAASwAAAEEAAAA9AAAANQAAAF4AAABWAAAAUQAAAEwAAABWAAAAUgAAAGAAAAA6AAAAQQAAAD4AAABNAAAAPwAAAEQAAAA4AAAAXQAAAE8AAABaAAAATgAAAEoAAAA7AAAAOQAAAF8AAABcAAAATwAAAE8AAABOAAAAPwAAADsAAABdAAAAXwAAAE0AAABQAAAARAAAAEgAAAA8AAAAYwAAAFoAAABYAAAAUQAAAFUAAABeAAAAZQAAAD0AAABCAAAASwAAAFIAAABgAAAAVAAAAGIAAAA+AAAATAAAAEAAAABTAAAAfwAAAEoAAABGAAAAZAAAAFcAAABcAAAAVAAAAEUAAABSAAAAQAAAAGEAAABZAAAAYgAAAFUAAABXAAAAZQAAAGYAAABCAAAAQwAAAFEAAABWAAAATAAAAEsAAABBAAAAaAAAAGAAAABeAAAAVwAAAFMAAABmAAAAZAAAAEMAAABGAAAAVQAAAFgAAABIAAAAWwAAAEkAAABjAAAAUAAAAGkAAABZAAAAYQAAAFsAAABnAAAARQAAAFQAAABHAAAAWgAAAE0AAABQAAAARAAAAGoAAABdAAAAYwAAAFsAAABJAAAAWQAAAEcAAABpAAAAWAAAAGcAAABcAAAAUwAAAE4AAABKAAAAbAAAAGQAAABfAAAAXQAAAE8AAABaAAAATQAAAG0AAABfAAAAagAAAF4AAABWAAAAUQAAAEsAAABrAAAAaAAAAGUAAABfAAAAXAAAAE8AAABOAAAAbQAAAGwAAABdAAAAYAAAAGgAAABiAAAAbgAAAEwAAABWAAAAUgAAAGEAAAB/AAAAYgAAAFQAAABnAAAAWQAAAG8AAABiAAAAbgAAAGEAAABvAAAAUgAAAGAAAABUAAAAYwAAAFAAAABpAAAAWAAAAGoAAABaAAAAcQAAAGQAAABmAAAAUwAAAFcAAABsAAAAcgAAAFwAAABlAAAAZgAAAGsAAABwAAAAUQAAAFUAAABeAAAAZgAAAGUAAABXAAAAVQAAAHIAAABwAAAAZAAAAGcAAABbAAAAYQAAAFkAAAB0AAAAaQAAAG8AAABoAAAAawAAAG4AAABzAAAAVgAAAF4AAABgAAAAaQAAAFgAAABnAAAAWwAAAHEAAABjAAAAdAAAAGoAAABdAAAAYwAAAFoAAAB1AAAAbQAAAHEAAABrAAAAfwAAAGUAAABeAAAAcwAAAGgAAABwAAAAbAAAAGQAAABfAAAAXAAAAHYAAAByAAAAbQAAAG0AAABsAAAAXQAAAF8AAAB1AAAAdgAAAGoAAABuAAAAYgAAAGgAAABgAAAAdwAAAG8AAABzAAAAbwAAAGEAAABuAAAAYgAAAHQAAABnAAAAdwAAAHAAAABrAAAAZgAAAGUAAAB4AAAAcwAAAHIAAABxAAAAYwAAAHQAAABpAAAAdQAAAGoAAAB5AAAAcgAAAHAAAABkAAAAZgAAAHYAAAB4AAAAbAAAAHMAAABuAAAAawAAAGgAAAB4AAAAdwAAAHAAAAB0AAAAZwAAAHcAAABvAAAAcQAAAGkAAAB5AAAAdQAAAH8AAABtAAAAdgAAAHEAAAB5AAAAagAAAHYAAAB4AAAAbAAAAHIAAAB1AAAAeQAAAG0AAAB3AAAAbwAAAHMAAABuAAAAeQAAAHQAAAB4AAAAeAAAAHMAAAByAAAAcAAAAHkAAAB3AAAAdgAAAHkAAAB0AAAAeAAAAHcAAAB1AAAAcQAAAHYAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAACAAAABQAAAAEAAAAAAAAA/////wEAAAAAAAAAAwAAAAQAAAACAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAUAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABAAAAAUAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAUAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAD//////////wEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAAAAAAAAAAABAAAAAgAAAAYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAFAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAGAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADgAAAAIAAAAAAAAAAAAAAAEAAAAAAAAACQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAAAAAAAAAAAAAEAAAAEAAAACAAAAAoAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAAAAAAAAAAAAQAAAAsAAAAPAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAIAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAAAAAAAAAAAAQAAAAwAAAAQAAAADAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAAAAAAAAAAABAAAACgAAABMAAAAIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAEAAAANAAAAEQAAAA0AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAACAAAAAAAAAAAAAAABAAAADgAAABIAAAAPAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAADwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAAAAAAAAQAAAP//////////EwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAASAAAAAAAAABgAAAAAAAAAIQAAAAAAAAAeAAAAAAAAACAAAAADAAAAMQAAAAEAAAAwAAAAAwAAADIAAAADAAAACAAAAAAAAAAFAAAABQAAAAoAAAAFAAAAFgAAAAAAAAAQAAAAAAAAABIAAAAAAAAAKQAAAAEAAAAhAAAAAAAAAB4AAAAAAAAABAAAAAAAAAAAAAAABQAAAAIAAAAFAAAADwAAAAEAAAAIAAAAAAAAAAUAAAAFAAAAHwAAAAEAAAAWAAAAAAAAABAAAAAAAAAAAgAAAAAAAAAGAAAAAAAAAA4AAAAAAAAACgAAAAAAAAALAAAAAAAAABEAAAADAAAAGAAAAAEAAAAXAAAAAwAAABkAAAADAAAAAAAAAAAAAAABAAAABQAAAAkAAAAFAAAABQAAAAAAAAACAAAAAAAAAAYAAAAAAAAAEgAAAAEAAAAKAAAAAAAAAAsAAAAAAAAABAAAAAEAAAADAAAABQAAAAcAAAAFAAAACAAAAAEAAAAAAAAAAAAAAAEAAAAFAAAAEAAAAAEAAAAFAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAVAAAAAAAAACYAAAAAAAAACQAAAAAAAAATAAAAAAAAACIAAAADAAAADgAAAAEAAAAUAAAAAwAAACQAAAADAAAAAwAAAAAAAAANAAAABQAAAB0AAAAFAAAAAQAAAAAAAAAHAAAAAAAAABUAAAAAAAAABgAAAAEAAAAJAAAAAAAAABMAAAAAAAAABAAAAAIAAAAMAAAABQAAABoAAAAFAAAAAAAAAAEAAAADAAAAAAAAAA0AAAAFAAAAAgAAAAEAAAABAAAAAAAAAAcAAAAAAAAAGgAAAAAAAAAqAAAAAAAAADoAAAAAAAAAHQAAAAAAAAArAAAAAAAAAD4AAAADAAAAJgAAAAEAAAAvAAAAAwAAAEAAAAADAAAADAAAAAAAAAAcAAAABQAAACwAAAAFAAAADQAAAAAAAAAaAAAAAAAAACoAAAAAAAAAFQAAAAEAAAAdAAAAAAAAACsAAAAAAAAABAAAAAMAAAAPAAAABQAAAB8AAAAFAAAAAwAAAAEAAAAMAAAAAAAAABwAAAAFAAAABwAAAAEAAAANAAAAAAAAABoAAAAAAAAAHwAAAAAAAAApAAAAAAAAADEAAAAAAAAALAAAAAAAAAA1AAAAAAAAAD0AAAADAAAAOgAAAAEAAABBAAAAAwAAAEsAAAADAAAADwAAAAAAAAAWAAAABQAAACEAAAAFAAAAHAAAAAAAAAAfAAAAAAAAACkAAAAAAAAAKgAAAAEAAAAsAAAAAAAAADUAAAAAAAAABAAAAAQAAAAIAAAABQAAABAAAAAFAAAADAAAAAEAAAAPAAAAAAAAABYAAAAFAAAAGgAAAAEAAAAcAAAAAAAAAB8AAAAAAAAAMgAAAAAAAAAwAAAAAAAAADEAAAADAAAAIAAAAAAAAAAeAAAAAwAAACEAAAADAAAAGAAAAAMAAAASAAAAAwAAABAAAAADAAAARgAAAAAAAABDAAAAAAAAAEIAAAADAAAANAAAAAMAAAAyAAAAAAAAADAAAAAAAAAAJQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAUwAAAAAAAABXAAAAAwAAAFUAAAADAAAASgAAAAMAAABGAAAAAAAAAEMAAAAAAAAAOQAAAAEAAAA0AAAAAwAAADIAAAAAAAAAGQAAAAAAAAAXAAAAAAAAABgAAAADAAAAEQAAAAAAAAALAAAAAwAAAAoAAAADAAAADgAAAAMAAAAGAAAAAwAAAAIAAAADAAAALQAAAAAAAAAnAAAAAAAAACUAAAADAAAAIwAAAAMAAAAZAAAAAAAAABcAAAAAAAAAGwAAAAMAAAARAAAAAAAAAAsAAAADAAAAPwAAAAAAAAA7AAAAAwAAADkAAAADAAAAOAAAAAMAAAAtAAAAAAAAACcAAAAAAAAALgAAAAMAAAAjAAAAAwAAABkAAAAAAAAAJAAAAAAAAAAUAAAAAAAAAA4AAAADAAAAIgAAAAAAAAATAAAAAwAAAAkAAAADAAAAJgAAAAMAAAAVAAAAAwAAAAcAAAADAAAANwAAAAAAAAAoAAAAAAAAABsAAAADAAAANgAAAAMAAAAkAAAAAAAAABQAAAAAAAAAMwAAAAMAAAAiAAAAAAAAABMAAAADAAAASAAAAAAAAAA8AAAAAwAAAC4AAAADAAAASQAAAAMAAAA3AAAAAAAAACgAAAAAAAAARwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAQAAAAAAAAAAvAAAAAAAAACYAAAADAAAAPgAAAAAAAAArAAAAAwAAAB0AAAADAAAAOgAAAAMAAAAqAAAAAwAAABoAAAADAAAAVAAAAAAAAABFAAAAAAAAADMAAAADAAAAUgAAAAMAAABAAAAAAAAAAC8AAAAAAAAATAAAAAMAAAA+AAAAAAAAACsAAAADAAAAYQAAAAAAAABZAAAAAwAAAEcAAAADAAAAYgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAYAAAAAMAAABSAAAAAwAAAEAAAAAAAAAASwAAAAAAAABBAAAAAAAAADoAAAADAAAAPQAAAAAAAAA1AAAAAwAAACwAAAADAAAAMQAAAAMAAAApAAAAAwAAAB8AAAADAAAAXgAAAAAAAABWAAAAAAAAAEwAAAADAAAAUQAAAAMAAABLAAAAAAAAAEEAAAAAAAAAQgAAAAMAAAA9AAAAAAAAADUAAAADAAAAawAAAAAAAABoAAAAAwAAAGAAAAADAAAAZQAAAAMAAABeAAAAAAAAAFYAAAAAAAAAVQAAAAMAAABRAAAAAwAAAEsAAAAAAAAAOQAAAAAAAAA7AAAAAAAAAD8AAAADAAAASgAAAAAAAABOAAAAAwAAAE8AAAADAAAAUwAAAAMAAABcAAAAAwAAAF8AAAADAAAAJQAAAAAAAAAnAAAAAwAAAC0AAAADAAAANAAAAAAAAAA5AAAAAAAAADsAAAAAAAAARgAAAAMAAABKAAAAAAAAAE4AAAADAAAAGAAAAAAAAAAXAAAAAwAAABkAAAADAAAAIAAAAAMAAAAlAAAAAAAAACcAAAADAAAAMgAAAAMAAAA0AAAAAAAAADkAAAAAAAAALgAAAAAAAAA8AAAAAAAAAEgAAAADAAAAOAAAAAAAAABEAAAAAwAAAFAAAAADAAAAPwAAAAMAAABNAAAAAwAAAFoAAAADAAAAGwAAAAAAAAAoAAAAAwAAADcAAAADAAAAIwAAAAAAAAAuAAAAAAAAADwAAAAAAAAALQAAAAMAAAA4AAAAAAAAAEQAAAADAAAADgAAAAAAAAAUAAAAAwAAACQAAAADAAAAEQAAAAMAAAAbAAAAAAAAACgAAAADAAAAGQAAAAMAAAAjAAAAAAAAAC4AAAAAAAAARwAAAAAAAABZAAAAAAAAAGEAAAADAAAASQAAAAAAAABbAAAAAwAAAGcAAAADAAAASAAAAAMAAABYAAAAAwAAAGkAAAADAAAAMwAAAAAAAABFAAAAAwAAAFQAAAADAAAANgAAAAAAAABHAAAAAAAAAFkAAAAAAAAANwAAAAMAAABJAAAAAAAAAFsAAAADAAAAJgAAAAAAAAAvAAAAAwAAAEAAAAADAAAAIgAAAAMAAAAzAAAAAAAAAEUAAAADAAAAJAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAYAAAAAAAAABoAAAAAAAAAGsAAAADAAAAYgAAAAAAAABuAAAAAwAAAHMAAAADAAAAYQAAAAMAAABvAAAAAwAAAHcAAAADAAAATAAAAAAAAABWAAAAAwAAAF4AAAADAAAAUgAAAAAAAABgAAAAAAAAAGgAAAAAAAAAVAAAAAMAAABiAAAAAAAAAG4AAAADAAAAOgAAAAAAAABBAAAAAwAAAEsAAAADAAAAPgAAAAMAAABMAAAAAAAAAFYAAAADAAAAQAAAAAMAAABSAAAAAAAAAGAAAAAAAAAAVQAAAAAAAABXAAAAAAAAAFMAAAADAAAAZQAAAAAAAABmAAAAAwAAAGQAAAADAAAAawAAAAMAAABwAAAAAwAAAHIAAAADAAAAQgAAAAAAAABDAAAAAwAAAEYAAAADAAAAUQAAAAAAAABVAAAAAAAAAFcAAAAAAAAAXgAAAAMAAABlAAAAAAAAAGYAAAADAAAAMQAAAAAAAAAwAAAAAwAAADIAAAADAAAAPQAAAAMAAABCAAAAAAAAAEMAAAADAAAASwAAAAMAAABRAAAAAAAAAFUAAAAAAAAAXwAAAAAAAABcAAAAAAAAAFMAAAAAAAAATwAAAAAAAABOAAAAAAAAAEoAAAADAAAAPwAAAAEAAAA7AAAAAwAAADkAAAADAAAAbQAAAAAAAABsAAAAAAAAAGQAAAAFAAAAXQAAAAEAAABfAAAAAAAAAFwAAAAAAAAATQAAAAEAAABPAAAAAAAAAE4AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+T8AAAAAAAAAABgtRFT7IQlAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPshCUAAAAAAAAAAABgtRFT7Ifm/GC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgtRFT7Ifm/GC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAABgtRFT7IQnAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPshCcAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAMpi5RexJsw/BlIKPVwR5T95Wyu0/QjnP5PjoT7YYcu/mBhKZ6zrwj8wRYS7NebuP3qW6geh+Ls/SLrixebL3r+pcyymN9XrPwmkNHp7xec/GWNMZVAA17+82s+x2BLiPwn2ytbJ9ek/LgEH1sMS1j8yp/2LhTfeP+SnWwtQBbu/d38gkp5X7z8ytsuHaADGPzUYObdf1+m/7IauECWhwz+cjSACjzniP76Z+wUhN9K/1+GEKzup67+/GYr/04baPw6idWOvsuc/ZedTWsRa5b/EJQOuRzi0v/OncYhHPes/h49PixY53j+i8wWfC03Nvw2idWOvsue/ZedTWsRa5T/EJQOuRzi0P/KncYhHPeu/iY9PixY53r+i8wWfC03NP9anWwtQBbs/d38gkp5X778ytsuHaADGvzUYObdf1+k/74auECWhw7+cjSACjzniv8CZ+wUhN9I/1uGEKzup6z+/GYr/04bavwmkNHp7xee/F2NMZVAA1z+82s+x2BLivwr2ytbJ9em/KwEH1sMS1r8yp/2LhTfev81i5RexJsy/BlIKPVwR5b95Wyu0/Qjnv5DjoT7YYcs/nBhKZ6zrwr8wRYS7Nebuv3OW6geh+Lu/SLrixebL3j+pcyymN9Xrv8rHIFfWehZAMBwUdlo0DECTUc17EOb2PxpVB1SWChdAzjbhb9pTDUDQhmdvECX5P9FlMKCC9+g/IIAzjELgE0DajDngMv8GQFhWDmDPjNs/y1guLh96EkAxPi8k7DIEQJCc4URlhRhA3eLKKLwkEECqpNAyTBD/P6xpjXcDiwVAFtl//cQm4z+Ibt3XKiYTQM7mCLUb3QdAoM1t8yVv7D8aLZv2Nk8UQEAJPV5nQwxAtSsfTCoE9z9TPjXLXIIWQBVanC5W9AtAYM3d7Adm9j++5mQz1FoWQBUThyaVBghAwH5muQsV7T89Q1qv82MUQJoWGOfNuBdAzrkClkmwDkDQjKq77t37Py+g0dtitsE/ZwAMTwVPEUBojepluNwBQGYbtuW+t9w/HNWIJs6MEkDTNuQUSlgEQKxktPP5TcQ/ixbLB8JjEUCwuWjXMQYCQAS/R09FkRdAowpiZjhhDkB7LmlczD/7P01iQmhhsAVAnrtTwDy84z/Z6jfQ2TgTQChOCXMnWwpAhrW3daoz8z/HYJvVPI4VQLT3ik5FcA5Angi7LOZd+z+NNVzDy5gXQBXdvVTFUA1AYNMgOeYe+T8+qHXGCwkXQKQTOKwa5AJA8gFVoEMW0T+FwzJyttIRQAEAAAD/////BwAAAP////8xAAAA/////1cBAAD/////YQkAAP////+nQQAA/////5HLAQD/////95AMAP/////B9lcAAAAAAAAAAAAAAAAAAgAAAP////8OAAAA/////2IAAAD/////rgIAAP/////CEgAA/////06DAAD/////IpcDAP/////uIRkA/////4LtrwAAAAAAAAAAAAAAAAAAAAAAAgAAAP//////////AQAAAAMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////wIAAAD//////////wEAAAAAAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA/////////////////////wEAAAD///////////////8CAAAA////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD///////////////////////////////8CAAAA////////////////AQAAAP////////////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAAAQAAAP//////////AgAAAP//////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAAEAAAD//////////wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAgAAAAAAAAACAAAAAQAAAAEAAAACAAAAAgAAAAAAAAAFAAAABQAAAAAAAAACAAAAAgAAAAMAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAIAAAABAAAAAgAAAAIAAAACAAAAAAAAAAUAAAAGAAAAAAAAAAIAAAACAAAAAwAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAAAAAAAAgAAAAEAAAADAAAAAgAAAAIAAAAAAAAABQAAAAcAAAAAAAAAAgAAAAIAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAgAAAAAAAAACAAAAAQAAAAQAAAACAAAAAgAAAAAAAAAFAAAACAAAAAAAAAACAAAAAgAAAAMAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAACAAAAAAAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAUAAAAJAAAAAAAAAAIAAAACAAAAAwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAIAAAACAAAAAAAAAAMAAAAOAAAAAgAAAAAAAAACAAAAAwAAAAAAAAAAAAAAAgAAAAIAAAADAAAABgAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAgAAAAIAAAAAAAAAAwAAAAoAAAACAAAAAAAAAAIAAAADAAAAAQAAAAAAAAACAAAAAgAAAAMAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAgAAAAAAAAADAAAACwAAAAIAAAAAAAAAAgAAAAMAAAACAAAAAAAAAAIAAAACAAAAAwAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAACAAAAAAAAAAMAAAAMAAAAAgAAAAAAAAACAAAAAwAAAAMAAAAAAAAAAgAAAAIAAAADAAAACQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAgAAAAIAAAAAAAAAAwAAAA0AAAACAAAAAAAAAAIAAAADAAAABAAAAAAAAAACAAAAAgAAAAMAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAgAAAAAAAAADAAAABgAAAAIAAAAAAAAAAgAAAAMAAAAPAAAAAAAAAAIAAAACAAAAAwAAAAsAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAIAAAACAAAAAAAAAAMAAAAHAAAAAgAAAAAAAAACAAAAAwAAABAAAAAAAAAAAgAAAAIAAAADAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAIAAAAAAAAAAwAAAAgAAAACAAAAAAAAAAIAAAADAAAAEQAAAAAAAAACAAAAAgAAAAMAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAACAAAAAgAAAAAAAAADAAAACQAAAAIAAAAAAAAAAgAAAAMAAAASAAAAAAAAAAIAAAACAAAAAwAAAA4AAAAAAAAAAAAAAAAAAAAAAAAACQAAAAIAAAACAAAAAAAAAAMAAAAFAAAAAgAAAAAAAAACAAAAAwAAABMAAAAAAAAAAgAAAAIAAAADAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAgAAAAAAAAACAAAAAQAAABMAAAACAAAAAgAAAAAAAAAFAAAACgAAAAAAAAACAAAAAgAAAAMAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABEAAAACAAAAAAAAAAIAAAABAAAADwAAAAIAAAACAAAAAAAAAAUAAAALAAAAAAAAAAIAAAACAAAAAwAAABEAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAIAAAAAAAAAAgAAAAEAAAAQAAAAAgAAAAIAAAAAAAAABQAAAAwAAAAAAAAAAgAAAAIAAAADAAAAEgAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAACAAAAAQAAABEAAAACAAAAAgAAAAAAAAAFAAAADQAAAAAAAAACAAAAAgAAAAMAAAATAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAACAAAAAAAAAAIAAAABAAAAEgAAAAIAAAACAAAAAAAAAAUAAAAOAAAAAAAAAAIAAAACAAAAAwAAAAIAAAABAAAAAAAAAAEAAAACAAAAAAAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAEAAAAAAAAAAgAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAgAAAAAAAAABAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAFAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAABAAAAAAEAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAEAAAAAAAAAAAAAOgehWlKfUEEz1zLi+JsiQa2og3wcMfVAWCbHorc0yEDi+Yn/Y6mbQJ11/mfsnG9At6bnG4UQQkBvMCQWKqUUQJVmwwswmOc/3hVgVBL3uj//qqOEOdGOPw/WDN4gnGE/H3ANkCUgND+AA8btKgAHPwTXBqJVSdo+XfRQAqsKrj4fc+zLYbSPQklEmCZHv2FCUP+uDso1NEKYtPhwphUHQptxnyFXYdpB7CddZAMmrkGAt1AxSTqBQUibBVdTsFNBSuX3MV+AJkFocv82SLf5QAqmgj7AY81A23VDSEnLoEDGEJVSeDFzQDYrqvBk70VA8U157pcRGUBWfEF+ZKbsP6phvycGBZRAJbod0OgwfkCp+L8jatBmQCjl3pGrPlFAfMWm114SOkButwtqS7UjQHQwbcjXyw1A8jnLuuyA9j9KwjL0VwHhPyotk0lcs8k/Q5PvEs9rsz+SfsOQEVqdPzUAKDojLoY/WJz/kcjCcD8YFu070FRZPyoLC2BdJEM/YOXQAuiMM0HIBz1bw3sdQdV46aaHRwZByatzjDPX8EDb3Jie8HXZQCJxj6ULP8NAUaG6uRAZrUCWdmou5/mVQLb9huRPm4BAhvoCHygZaUCuX/I3SPdSQC9/bC/1qTxAfKxsYQ6pJUCuslH+N14QQMS/cv7SvPg/Ol8maYKx4j8AAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAD/////AAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAA/////wAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAP////8AAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////BQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAUAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAEAAQAAAQEAAAAAAAEAAAABAAAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAKriWFiWZfg/Y2nmTbY/8z8MHSPSqmnjv6hnn18HR3c/quJYWJZl+D/jq5TzDdzyPwwdI9KqaeO/u0kC1eFSBECq4lhYlmX4P69pJmt7c/E/NnkJi6jSBsDESFlzKkr6P33ArMz7sfY/o2q2uqM08D+oZ59fB0d3PzEqCi3qrvK/kmm4ANp49D+4wS2wzhzvP9WJvyAnx+E/upcY75RVx7+95t+9y0T1P9L18g1caO0/k6CkRyVzAEBf99+e/GjxP6QMsuuLQ/U/PlP4Qr8q7j8Mb/GO2GMCwLl2K/DQIghAePiwytEp9D9UHrsuI/nqPzjMedJ+yuy/k6xgf58n/L+XoQtn22DzP2lzCnsYk+s/JhUSDI4P8z+8lFcBhgTcPxOqKRxEX/M/89MEdoPQ6j8OKQaXDob7vzWwNvblgAPAzGkxMcl88j9Nm4okPkbpP0vI89vxSgRAdac2Z6W2/T+6UFOMC3zyP/+2XEF3hug/QqhELwGKCMAwdlQerEoEQFcr/B+VnvE/hB1hfFzT5j8wdsE/Da64P0hIvnF/sOC/KH/hrXUg8T9bI5OQHaLlP+mYzla7td6/CtKG6iOm8b8FW3TV8oXwP8ORhtNuJ+c/q8JrTMz/AcC8PaUl+PUFwAXv9rkMT/A/m+sAswr15D+7hk/O3yvkP6c/yVsOHKI/qqAX9idJ8D/8hNz1KNPiP7xSXh3Ggvg/epbkiKr57T/23/LB1GLvP4GTTeNZi+M/W4TqlTheBcDupZgIdYUIQGwlcW3YZO8/tQvDXQ3H4j8Bt+sf9DkAQMdFie+nNvg/Z5Uh1wDX7j9h5X2d4KjhPxMJ1ZVT4Pa/evqB8xB//7+W183U9QLsPwzNxsC7AOA/af/LqCnK/r/lPceQ0FQDwHoY0nYIW+w/bHNSHrTg4D/DFcMAdabuv2sz5Ojhnve/FvLf01HN6z/tEDL2Hz/gP0bBv0KUhPA/pd7sEnMc4D8EGon4Lo7sP5NVbYtSON8/DAMC50odBkB+Z2J8MGYCQIhlM1gubOo/FssiPwWy4D8OIlGqRnkCQAd1vopp6f4/QS1keLLK6T9rfoBuT7LZP3KQbH5ugwjAjqVPXTmbBUBL/JxcqR3qP3oSeovuktg/Y6pRhJmqy7+0kwuU0Yjmv2wvsfFmQ+g/R98lJFqQ2T/IGb5gjLkCwK3mNff3kQbAqDznPFM86T+iiP0FfsvYP7fzKG6Mls0/h7+at2btzL8tsUTgk+LmP/YEIrTDINU/WmwKoVjA5L9aC02r6FHxvzzFCT/Qg+Y/nx0V97en0j8+1toJOm77P1kZ7h8KjfQ/GBbbqxgk5j9RGXM79G/SP+beHsWmweQ/9REi4eX0xD/V9s+kmMHkP+pb9yNs09A/c5ERjVDTAECqEr3OBCH7P14ILfMECOU/piRx4P8P0j+JYU//bfL0Pw62fw28B+w/l5YW2Ga45D9+CyKRbenOP5cH6fHy1/S/o/egk03++r91nTYRL/bjP3fHN6OJVdA/7xXQh1XLBcAB3g6tBdUIQKW2KnGYjeQ/SqIpagclyz8F9P3YgNL6v9H6NBsZ8QDAW2k5L5Qs4z/0axa1l6zLP1GE65Mu4wNAwfX+BYmWAEBBgJP90M3hP6/03qhPLdA/zqo5bJz2778/ESlPCTn1v7JkhGyvzuE/DM7sj5twwz/6xbXLavYGQH29RFRGkgNA7bOXVSJ54T9fEhTHO/TDP+8t+HMOiwDAxa0SbGTtA8Atii7y0mLgP4cecHFB3sM/uPUpyv+K7j8nktD1/WvhP2cWmi772d8/Fj7uU9kEvD8oKOESLzKmvwSdCqrHdNu/XCluGsvI3T929OW5md+uP9dP6rXcZNq/gXM+ggzL6b+eKjsPgJncP6i1e9aVu7E/2CnPNJyD1D/DnyGgSe+xvy8k7g9bp9s/nYmLvHn1sz9cFOwApH8IwGa6Mjy9cgZAJr95SiSW2z8rCkhOFvqdP3SIKmO/UwPAEy0zkN7bBsCds8Hg/13YP1zv413hVGi/FVtqixSn6L9XAPQGul3yv7SGu2BoCNk/n94bv7Maj79p13T6X9z3P45MPCW3WvI/rU/8/LRj1T9cgR6SXd+ZPymL2DstbPI/8s/pAkIz6z/fmoB+8efYPz2XyfWgYaa/6wys72AW/j8LZImhgrf3P729Zla/n9U/ySB8B3PBqL8O2nhevvbxv17+5A+n6fe/YrGIqEGB1T+wCEGbkhaxv989QHVE5wFAzd12PTu3/T9AHUPZY2DUP3SQDST0zq2/JCxAlIoj5T+Mhe1IJkrQP/cRpl8QhtU/amc4seFts79khiUSVaz3vxYfWtjPwf2/CHscxQqD0j/ctUBQ9my3v0POnFiyXv2/pjjn2Ju/AcDk45DwBhPRP/GjwlCrv7m/aT2ciwolBsAQOzHr/wUJQCzpq5UYvtI/gDCf3SlCwb+4i7S+mukEQBDA1f8mowFA2utnRN3KyT9T+9EYAVG6v9/IVZ0enrE/7NbRtdGfzr/8y8GpRz7LP3U0vTSk18e/JzHEcwiBB0AGm8Q7AJkEQNLciyt4Esk/gLou5zoQxr+RrOfM91oBwEzd36KybgTAgLou5zoQxj/S3IsreBLJv1gCch0OHO8/FD+RxSLN4j91NL00pNfHP/zLwalHPsu/nL7/By4Pyr8tSP5h7CPiv1P70RgBUbo/2utnRN3Kyb/KfllfCpUIwLkP5zj+NwdAgDCf3SlCwT8s6auVGL7Sv2aFPlaC4eC/XrS5UVH77b/xo8JQq7+5P+TjkPAGE9G/Q30/RYbn1z8FF/ISafuLv9y1QFD2bLc/CHscxQqD0r/fi+tPROX0P6vRc+19ie0/amc4seFtsz/3EaZfEIbVv77TYpahl/o/DDsu0CaC9D90kA0k9M6tP0AdQ9ljYNS/CCI0rxjZA8BgfCaLthgHwLAIQZuSFrE/YrGIqEGB1b8kvQ982+rsv4J8EWu7jPS/ySB8B3PBqD+9vWZWv5/VvwrAByWcJgBAxFujmE9a+j89l8n1oGGmP9+agH7x59i/N03cuJUt9L8X9v4GdIz6v1yBHpJd35m/rU/8/LRj1b8mz69sydf/vyu5idMqVQLAn94bv7Majz8AhrtgaAjZv+aCE66WZ/q/lA1Mgz/p/79c7+Nd4VRoP52zweD/Xdi/TJZpMTb4AkDLWZShPOb/PysKSE4W+p2/Jr95SiSW27/PkmbE7zjnP6UAiCDmMNI/nYmLvHn1s78vJO4PW6fbv5MWA2vqSrQ/V5WLwPB51b+otXvWlbuxv54qOw+Amdy/1keqzYeRBsApIEMHgZIIQHb05bmZ366/XCluGsvI3b8W44a9X9UFQEeQtDM4rwJAFj7uU9kEvL9nFpou+9nfv3Co+JcyyQhAcdkCX2KzBUCHHnBxQd7Dvy2KLvLSYuC/o6+5YTt/AcCHCNDW+8YEwF8SFMc79MO/7bOXVSJ54b9E/pfA2S3xPzD9xaBb0uQ/DM7sj5tww7+yZIRsr87hv7c4c0SEXNG/Tr79/9M+5r+v9N6oTy3Qv5uAk/3QzeG/XcI1OVQkAUAQSV9Z7Qr9P/RrFrWXrMu/W2k5L5Qs479Zo2IBM/vkv6FuipzkFvG/SqIpagcly7+ltipxmI3kv0pmis91cfc/gWQecsRh8D93xzejiVXQv3WdNhEv9uO/D7mgYy612j+PyVPNaT2jv34LIpFt6c6/l5YW2Ga45L+LUp+2A2z9P39i5xSpRfc/piRx4P8P0r9eCC3zBAjlv5n4OKmIUf2/jj/kUAwgAsDqW/cjbNPQv9X2z6SYweS/aTdljlWd8L94R8vZ8SL3v1EZczv0b9K/GBbbqxgk5r9XdfyikfEDwPILMvas0gfAnx0V97en0r88xQk/0IPmvxGErZ681fa/9kCaiOy2/b/2BCK0wyDVvy2xROCT4ua/+5EBLOXxA0B7p53+BnkAQKKI/QV+y9i/qDznPFM86b/snWGNkkgHwC+ByugkUwdAR98lJFqQ2b9sL7HxZkPovyJNGM67oek/HzNy6BqA1D96EnqL7pLYv0v8nFypHeq/axL/u1FnB0AkSEHvxn8DQGt+gG5Pstm/QS1keLLK6b/Sk/O6mtGzPxU8pLcPNty/FssiPwWy4L+IZTNYLmzqvw4szKfSouq/G+XJHY1a87+TVW2LUjjfvwQaifgujuy/3VARaoMl2L9NFodfK+/qv+0QMvYfP+C/FvLf01HN67+ETOQysd8AwH71iI/eGgXAbHNSHrTg4L96GNJ2CFvsv6BnExReeAFA5CakvxSl+j8MzcbAuwDgv5bXzdT1Auy/uVq8/8x58z+uvPMNqzTnP2HlfZ3gqOG/Z5Uh1wDX7r8PUbMSo2P7P9VfBrXlxPI/tQvDXQ3H4r9sJXFt2GTvvyDssGgO0PG/WxT/uE4N+r+Bk03jWYvjv/bf8sHUYu+/rUXN8hUe3j9m5HB1yZCzv/yE3PUo0+K/qqAX9idJ8L9mByqLMMH5v4kHC7KQowHAm+sAswr15L8F7/a5DE/wv2JLsGADFwTAKQjVGovZCMDDkYbTbifnvwVbdNXyhfC/malhH7yI7D+oevd0GWDZP1sjk5AdouW/KH/hrXUg8b8KWmrpQ0sFQAzEAF/pTgBAhB1hfFzT5r9XK/wflZ7xv18hRuqKXAjA/5rUd9v1BED/tlxBd4bov7pQU4wLfPK/4pnwn0T/sj/c277XPF3jv02biiQ+Rum/zGkxMcl88r8Yk0HhJVzjv62yUUFRjfS/89MEdoPQ6r8TqikcRF/zvxQxghHovfY/cfM1eFWE5j9pcwp7GJPrv5ehC2fbYPO/KUV2nGg0/795OhmUaqEFwFQeuy4j+eq/ePiwytEp9L8DuqWfW+8BQLytJylXHPY/PlP4Qr8q7r+kDLLri0P1vxT4ShWL+Oo/DMsWg0zlv7/S9fINXGjtv73m373LRPW/+xg/Gaxd8b94MdQEfW0AwLjBLbDOHO+/kmm4ANp49L+cShSMMbAEwKyjUgWirAdAo2q2uqM08L99wKzM+7H2v3RdlNBXFgnA8S9+ewyV/z+vaSZre3Pxv6riWFiWZfi/2J7VSZZ60j+LES81zPn3v+OrlPMN3PK/quJYWJZl+L/OZbufkEcEQLCNB/1lPOO/Y2nmTbY/87+q4lhYlmX4v7CNB/1lPOO/zmW7n5BHBEBwKD1Aa57LP/XsSsw7RbU/PMDPJGsfoD/TqningGKIPzFtCLYmb3I/qYfrJr7eWz9pQmleXRFFP0rWlJkA2i8/pCvcttgTGD9Dt8IWbjMCPyCG4GRlhOs+1JI2GhDN1D7ns8cGvXK/Pi8m8UTJxac+hNTfA2z4kT7GI8kjLyt7Pv//////HwAI//////8zEAj/////fzIgCP////9vMjAI/////2MyQAj///8/YjJQCP///zdiMmAI////M2IycAj//78zYjKACP//qzNiMpAI/3+rM2IyoAj/D6szYjKwCP8DqzNiMsAIvwOrM2Iy0AifA6szYjLgCJkDqzNiMvAI//////8/Dwj//////ysfCP////9/KS8I/////z8pPwj/////OSlPCP///z84KV8I////Dzgpbwj///8OOCl/CP//Hw44KY8I//8PDjgpnwj/fw0OOCmvCP8PDQ44Kb8I/w0NDjgpzwj/DA0OOCnfCMcMDQ44Ke8IxAwNDjgp/wgHAAAABwAAAAEAAAACAAAABAAAAAMAAAAAAAAAAAAAAAcAAAADAAAAAQAAAAIAAAAFAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAgAAAAEAAAADAAAADgAAAAYAAAALAAAAAgAAAAcAAAABAAAAGAAAAAUAAAAKAAAAAQAAAAYAAAAAAAAAJgAAAAcAAAAMAAAAAwAAAAgAAAACAAAAMQAAAAkAAAAOAAAAAAAAAAUAAAAEAAAAOgAAAAgAAAANAAAABAAAAAkAAAADAAAAPwAAAAsAAAAGAAAADwAAAAoAAAAQAAAASAAAAAwAAAAHAAAAEAAAAAsAAAARAAAAUwAAAAoAAAAFAAAAEwAAAA4AAAAPAAAAYQAAAA0AAAAIAAAAEQAAAAwAAAASAAAAawAAAA4AAAAJAAAAEgAAAA0AAAATAAAAdQAAAA8AAAATAAAAEQAAABIAAAAQAAAABgAAAAIAAAADAAAABQAAAAQAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAMAAAABAAAABQAAAAQAAAAAAAAAAAAAAAcAAAAFAAAAAwAAAAQAAAABAAAAAAAAAAIAAAAAAAAAAgAAAAMAAAABAAAABQAAAAQAAAAGAAAAAAAAAAAAAAAYLURU+yH5PxgtRFT7Ifm/GC1EVPshCUAYLURU+yEJwGFsZ29zLmMAaDNOZWlnaGJvclJvdGF0aW9ucwBjZWxsc1RvTXVsdGlQb2x5LmMAY2VsbFRvRWRnZUFyY3MAAAEDAgQABAMFAQJjYW5jZWxBcmNQYWlycwBjcmVhdGVTb3J0YWJsZUxvb3AAZGlyZWN0ZWRFZGdlLmMAZGlyZWN0ZWRFZGdlVG9Cb3VuZGFyeQBhZGphY2VudEZhY2VEaXJbdG1wRmlqay5mYWNlXVtmaWprLmZhY2VdID09IEtJAGZhY2VpamsuYwBfZmFjZUlqa1BlbnRUb0NlbGxCb3VuZGFyeQBhZGphY2VudEZhY2VEaXJbY2VudGVySUpLLmZhY2VdW2ZhY2UyXSA9PSBLSQBfZmFjZUlqa1RvQ2VsbEJvdW5kYXJ5AGgzSW5kZXguYwBjb21wYWN0Q2VsbHMAdmVjM1RvQ2VsbABjZWxsVG9DaGlsZFBvcwB2YWxpZGF0ZUNoaWxkUG9zAHJldkRpciAhPSBJTlZBTElEX0RJR0lUAGxvY2FsaWouYwBjZWxsVG9Mb2NhbElqawBiYXNlQ2VsbCAhPSBvcmlnaW5CYXNlQ2VsbAAhKG9yaWdpbk9uUGVudCAmJiBpbmRleE9uUGVudCkAYmFzZUNlbGwgPT0gb3JpZ2luQmFzZUNlbGwALi4vaW5jbHVkZS9jb29yZGlqay5oAF91cEFwN0NoZWNrZWQAX3VwQXA3ckNoZWNrZWQAYmFzZUNlbGwgIT0gSU5WQUxJRF9CQVNFX0NFTEwAbG9jYWxJamtUb0NlbGwAIV9pc0Jhc2VDZWxsUGVudGFnb24oYmFzZUNlbGwpAGJhc2VDZWxsUm90YXRpb25zID49IDAAZ3JpZFBhdGhDZWxsc0ludGVycG9sYXRlAHBvbHlmaWxsLmMAaXRlclN0ZXBQb2x5Z29uQ29tcGFjdAAwAHZlcnRleC5jAHZlcnRleFJvdGF0aW9ucwBjZWxsVG9WZXJ0ZXg=";var vt=28400;function Tt(Le){return Le}function qe(Le){var it=/\b__Z[\w\d_]+/g;return Le.replace(it,function(Dt){var He=Dt;return Dt===He?Dt:He+" ["+Dt+"]"})}function Je(){var Le=new Error;if(!Le.stack){try{throw new Error(0)}catch(it){Le=it}if(!Le.stack)return"(no stack trace available)"}return Le.stack.toString()}function It(){var Le=Je();return e.extraStackTrace&&(Le+=`4130+`+e.extraStackTrace()),qe(Le)}function rn(Le,it,Dt,He){Um("Assertion failed: "+L(Le)+", at: "+[it?L(it):"unknown filename",Dt,He?L(He):"unknown function"])}function Lt(){return Y.length}function Rt(Le,it,Dt){H.set(H.subarray(it,it+Dt),Le)}function fn(Le){return e.___errno_location&&(te[e.___errno_location()>>2]=Le),Le}function wn(Le){Um("OOM")}function Dn(Le){try{var it=new ArrayBuffer(Le);return it.byteLength!=Le?void 0:(new Int8Array(it).set(Y),sn(it),Re(it),1)}catch{}}function ye(Le){var it=Lt(),Dt=16777216,He=2147483648-Dt;if(Le>He)return!1;for(var h=16777216,sr=Math.max(it,h);sr<Le;)sr<=536870912?sr=G(2*sr,Dt):sr=Math.min(G((3*sr+2147483648)/4,Dt),He);var Pi=Dn(sr);return!!Pi}var wt=typeof atob=="function"?atob:function(Le){var it="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Dt="",He,h,sr,Pi,ie,or,ol,fo=0;Le=Le.replace(/[^A-Za-z0-9\+\/\=]/g,"");do Pi=it.indexOf(Le.charAt(fo++)),ie=it.indexOf(Le.charAt(fo++)),or=it.indexOf(Le.charAt(fo++)),ol=it.indexOf(Le.charAt(fo++)),He=Pi<<2|ie>>4,h=(ie&15)<<4|or>>2,sr=(or&3)<<6|ol,Dt=Dt+String.fromCharCode(He),or!==64&&(Dt=Dt+String.fromCharCode(h)),ol!==64&&(Dt=Dt+String.fromCharCode(sr));while(fo<Le.length);return Dt};function Ze(Le){try{for(var it=wt(Le),Dt=new Uint8Array(it.length),He=0;He<it.length;++He)Dt[He]=it.charCodeAt(He);return Dt}catch{throw new Error("Converting base64 string to bytes failed.")}}function St(Le){if(Te(Le))return Ze(Le.slice(Z.length))}var Bt={Math,Int8Array,Int32Array,Uint8Array,Float32Array,Float64Array},ut={a:Um,b:f,c:d,d:rn,e:fn,f:Lt,g:Rt,h:ye,i:wn,j:Tt,k:qe,l:Dn,m:Je,n:It,o:vt,p:Fe},Ce=(function(Le,it,Dt){"almost asm";var He=new Le.Int8Array(Dt),h=new Le.Int32Array(Dt),sr=new Le.Uint8Array(Dt),Pi=new Le.Float32Array(Dt),ie=new Le.Float64Array(Dt),or=it.o|0,ol=it.p|0,fo=Le.Math.floor,Ks=Le.Math.abs,bs=Le.Math.sqrt,ii=Le.Math.cos,zi=Le.Math.sin,iT=Le.Math.tan,_ce=Le.Math.acos,qx=Le.Math.asin,YG=Le.Math.atan,Ta=Le.Math.atan2,x1=Le.Math.ceil,al=Le.Math.imul,tL=Le.Math.min,xce=Le.Math.max,Gf=Le.Math.clz32,yce=it.a,On=it.b,ee=it.c,di=it.d,ZG=it.e,bce=it.f,wce=it.g,Sce=it.h,Tce=it.i,Q=28416;function Ece(p){return He=new Int8Array(p),sr=new Uint8Array(p),h=new Int32Array(p),Pi=new Float32Array(p),ie=new Float64Array(p),Dt=p,!0}function Mce(p){p=p|0;var m=0;return m=Q,Q=Q+p|0,Q=Q+15&-16,m|0}function Cce(){return Q|0}function Rce(p){p=p|0,Q=p}function Pce(p,m){p=p|0,m=m|0,Q=p}function Ice(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;return(p|0)<0?(m=2,m|0):(p|0)>13780509?(m=aT(15,m)|0,m|0):(g=((p|0)<0)<<31>>31,v=wr(p|0,g|0,3,0)|0,_=ee()|0,g=At(p|0,g|0,1,0)|0,g=wr(v|0,_|0,g|0,ee()|0)|0,g=At(g|0,ee()|0,1,0)|0,p=ee()|0,h[m>>2]=g,h[m+4>>2]=p,m=0,m|0)}function KG(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,QG(p,m,g,_,0)|0}function QG(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0;if(M=Q,Q=Q+16|0,b=M,!(JG(p,m,g,_,v)|0))return _=0,Q=M,_|0;do if((g|0)>=0){if((g|0)>13780509){if(x=aT(15,b)|0,x|0)break;E=b,b=h[E>>2]|0,E=h[E+4>>2]|0}else x=((g|0)<0)<<31>>31,N=wr(g|0,x|0,3,0)|0,E=ee()|0,x=At(g|0,x|0,1,0)|0,x=wr(N|0,E|0,x|0,ee()|0)|0,x=At(x|0,ee()|0,1,0)|0,E=ee()|0,h[b>>2]=x,h[b+4>>2]=E,b=x;if(lp(_|0,0,b<<3|0)|0,v|0){lp(v|0,0,b<<2|0)|0,x=ih(p,m,g,_,v,b,E,0)|0;break}x=Ea(b,4)|0,x?(N=ih(p,m,g,_,x,b,E,0)|0,_t(x),x=N):x=13}else x=2;while(!1);return N=x,Q=M,N|0}function JG(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0;if(ae=Q,Q=Q+16|0,X=ae,K=ae+8|0,j=X,h[j>>2]=p,h[j+4>>2]=m,(g|0)<0)return K=2,Q=ae,K|0;if(x=_,h[x>>2]=p,h[x+4>>2]=m,x=(v|0)!=0,x&&(h[v>>2]=0),Zi(p,m)|0)return K=9,Q=ae,K|0;h[K>>2]=0;e:do if((g|0)>=1)if(x)for(U=1,N=0,q=0,j=1,x=p;;){if(!(N|q)){if(x=Qs(x,m,4,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,Zi(x,m)|0){x=9;break e}}if(x=Qs(x,m,h[26864+(q<<2)>>2]|0,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,p=_+(U<<3)|0,h[p>>2]=x,h[p+4>>2]=m,h[v+(U<<2)>>2]=j,p=N+1|0,b=(p|0)==(j|0),E=q+1|0,M=(E|0)==6,Zi(x,m)|0){x=9;break e}if(j=j+(M&b&1)|0,(j|0)>(g|0)){x=0;break}else U=U+1|0,N=b?0:p,q=b?M?0:E:q}else for(U=1,N=0,q=0,j=1,x=p;;){if(!(N|q)){if(x=Qs(x,m,4,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,Zi(x,m)|0){x=9;break e}}if(x=Qs(x,m,h[26864+(q<<2)>>2]|0,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,p=_+(U<<3)|0,h[p>>2]=x,h[p+4>>2]=m,p=N+1|0,b=(p|0)==(j|0),E=q+1|0,M=(E|0)==6,Zi(x,m)|0){x=9;break e}if(j=j+(M&b&1)|0,(j|0)>(g|0)){x=0;break}else U=U+1|0,N=b?0:p,q=b?M?0:E:q}else x=0;while(!1);return K=x,Q=ae,K|0}function ih(p,m,g,_,v,x,b,E){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0,E=E|0;var M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0;if(ae=Q,Q=Q+16|0,X=ae+8|0,K=ae,M=qf(p|0,m|0,x|0,b|0)|0,U=ee()|0,q=_+(M<<3)|0,ue=q,xe=h[ue>>2]|0,ue=h[ue+4>>2]|0,N=(xe|0)==(p|0)&(ue|0)==(m|0),!((xe|0)==0&(ue|0)==0|N))do M=At(M|0,U|0,1,0)|0,M=ap(M|0,ee()|0,x|0,b|0)|0,U=ee()|0,q=_+(M<<3)|0,xe=q,ue=h[xe>>2]|0,xe=h[xe+4>>2]|0,N=(ue|0)==(p|0)&(xe|0)==(m|0);while(!((ue|0)==0&(xe|0)==0|N));if(M=v+(M<<2)|0,N&&(h[M>>2]|0)<=(E|0)||(xe=q,h[xe>>2]=p,h[xe+4>>2]=m,h[M>>2]=E,(E|0)>=(g|0)))return xe=0,Q=ae,xe|0;switch(N=E+1|0,h[X>>2]=0,M=Qs(p,m,2,X,K)|0,M|0){case 9:{j=9;break}case 0:{M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M||(j=9);break}default:}e:do if((j|0)==9){switch(h[X>>2]=0,M=Qs(p,m,3,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Qs(p,m,1,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Qs(p,m,5,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Qs(p,m,4,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Qs(p,m,6,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}return xe=0,Q=ae,xe|0}while(!1);return xe=M,Q=ae,xe|0}function Qs(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(g>>>0>6)return v=1,v|0;b=(h[_>>2]|0)%6|0,h[_>>2]=b;e:do if((b|0)>0)for(x=0;;){switch(g|0){case 1:{g=5;break}case 5:{g=4;break}case 4:{g=6;break}case 6:{g=2;break}case 2:{g=3;break}case 3:{g=1;break}default:}if(x=x+1|0,(x|0)==(b|0))break e}while(!1);if(q=tt(p|0,m|0,45)|0,ee()|0,U=q&127,U>>>0>121)return v=5,v|0;M=ll(p,m)|0,x=tt(p|0,m|0,52)|0,ee()|0,x=x&15;e:do if(!x)N=15;else{for(;;){if(b=(15-x|0)*3|0,E=tt(p|0,m|0,b|0)|0,ee()|0,E=E&7,(E|0)==7){m=5;break}if(K=(_c(x)|0)==0,x=x+-1|0,j=ft(7,0,b|0)|0,m=m&~(ee()|0),X=ft(h[(K?432:16)+(E*28|0)+(g<<2)>>2]|0,0,b|0)|0,b=ee()|0,g=h[(K?640:224)+(E*28|0)+(g<<2)>>2]|0,p=X|p&~j,m=b|m,!g){g=0;break e}if(!x){N=15;break e}}return m|0}while(!1);(N|0)==15&&(K=h[848+(U*28|0)+(g<<2)>>2]|0,X=ft(K|0,0,45)|0,p=X|p,m=ee()|0|m&-1040385,g=h[4272+(U*28|0)+(g<<2)>>2]|0,(K&127|0)==127&&(K=ft(h[848+(U*28|0)+20>>2]|0,0,45)|0,m=ee()|0|m&-1040385,g=h[4272+(U*28|0)+20>>2]|0,p=km(K|p,m)|0,m=ee()|0,h[_>>2]=(h[_>>2]|0)+1)),E=tt(p|0,m|0,45)|0,ee()|0,E=E&127;e:do if(yr(E)|0){t:do if((ll(p,m)|0)==1){if((U|0)!=(E|0))if(iq(E,h[7696+(U*28|0)>>2]|0)|0){p=dL(p,m)|0,b=1,m=ee()|0;break}else di(27634,26928,533,26936);switch(M|0){case 3:{p=km(p,m)|0,m=ee()|0,h[_>>2]=(h[_>>2]|0)+1,b=0;break t}case 5:{p=dL(p,m)|0,m=ee()|0,h[_>>2]=(h[_>>2]|0)+5,b=0;break t}case 0:return K=9,K|0;default:return K=1,K|0}}else b=0;while(!1);if((g|0)>0){x=0;do p=fL(p,m)|0,m=ee()|0,x=x+1|0;while((x|0)!=(g|0))}if((U|0)!=(E|0)){if(!(nL(E)|0)){if((b|0)!=0|(ll(p,m)|0)!=5)break;h[_>>2]=(h[_>>2]|0)+1;break}switch(q&127){case 8:case 118:break e;default:}(ll(p,m)|0)!=3&&(h[_>>2]=(h[_>>2]|0)+1)}}else if((g|0)>0){x=0;do p=km(p,m)|0,m=ee()|0,x=x+1|0;while((x|0)!=(g|0))}while(!1);return h[_>>2]=((h[_>>2]|0)+g|0)%6|0,K=v,h[K>>2]=p,h[K+4>>2]=m,K=0,K|0}function Lce(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,eq(p,m,g,_)|0?(lp(_|0,0,g*48|0)|0,_=Dce(p,m,g,_)|0,_|0):(_=0,_|0)}function eq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(K=Q,Q=Q+16|0,j=K,X=K+8|0,q=j,h[q>>2]=p,h[q+4>>2]=m,(g|0)<0)return X=2,Q=K,X|0;if(!g)return X=_,h[X>>2]=p,h[X+4>>2]=m,X=0,Q=K,X|0;h[X>>2]=0;e:do if(Zi(p,m)|0)p=9;else{v=0,q=p;do{if(p=Qs(q,m,4,X,j)|0,p|0)break e;if(m=j,q=h[m>>2]|0,m=h[m+4>>2]|0,v=v+1|0,Zi(q,m)|0){p=9;break e}}while((v|0)<(g|0));U=_,h[U>>2]=q,h[U+4>>2]=m,U=g+-1|0,N=0,p=1;do{if(v=26864+(N<<2)|0,(N|0)==5)for(b=h[v>>2]|0,x=0,v=p;;){if(p=j,p=Qs(h[p>>2]|0,h[p+4>>2]|0,b,X,j)|0,p|0)break e;if((x|0)!=(U|0))if(M=j,E=h[M>>2]|0,M=h[M+4>>2]|0,p=_+(v<<3)|0,h[p>>2]=E,h[p+4>>2]=M,!(Zi(E,M)|0))p=v+1|0;else{p=9;break e}else p=v;if(x=x+1|0,(x|0)>=(g|0))break;v=p}else for(b=j,M=h[v>>2]|0,E=0,v=p,x=h[b>>2]|0,b=h[b+4>>2]|0;;){if(p=Qs(x,b,M,X,j)|0,p|0)break e;if(b=j,x=h[b>>2]|0,b=h[b+4>>2]|0,p=_+(v<<3)|0,h[p>>2]=x,h[p+4>>2]=b,p=v+1|0,Zi(x,b)|0){p=9;break e}if(E=E+1|0,(E|0)>=(g|0))break;v=p}N=N+1|0}while(N>>>0<6);p=j,p=(q|0)==(h[p>>2]|0)&&(m|0)==(h[p+4>>2]|0)?0:9}while(!1);return X=p,Q=K,X|0}function Dce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;if(q=Q,Q=Q+16|0,b=q,!g)return h[_>>2]=p,h[_+4>>2]=m,_=0,Q=q,_|0;do if((g|0)>=0){if((g|0)>13780509){if(v=aT(15,b)|0,v|0)break;x=b,v=h[x>>2]|0,x=h[x+4>>2]|0}else v=((g|0)<0)<<31>>31,U=wr(g|0,v|0,3,0)|0,x=ee()|0,v=At(g|0,v|0,1,0)|0,v=wr(U|0,x|0,v|0,ee()|0)|0,v=At(v|0,ee()|0,1,0)|0,x=ee()|0,U=b,h[U>>2]=v,h[U+4>>2]=x;if(N=Ea(v,8)|0,!N)v=13;else{if(U=Ea(v,4)|0,!U){_t(N),v=13;break}if(v=ih(p,m,g,N,U,v,x,0)|0,v|0){_t(N),_t(U);break}if(m=h[b>>2]|0,b=h[b+4>>2]|0,(b|0)>0|(b|0)==0&m>>>0>0){v=0,E=0,M=0;do p=N+(E<<3)|0,x=h[p>>2]|0,p=h[p+4>>2]|0,!((x|0)==0&(p|0)==0)&&(h[U+(E<<2)>>2]|0)==(g|0)&&(j=_+(v<<3)|0,h[j>>2]=x,h[j+4>>2]=p,v=v+1|0),E=At(E|0,M|0,1,0)|0,M=ee()|0;while((M|0)<(b|0)|(M|0)==(b|0)&E>>>0<m>>>0)}_t(N),_t(U),v=0}}else v=2;while(!1);return j=v,Q=q,j|0}function rT(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;for(E=Q,Q=Q+16|0,x=E,b=E+8|0,v=(Zi(p,m)|0)==0,v=v?1:2;;){if(h[b>>2]=0,N=(Qs(p,m,v,b,x)|0)==0,M=x,N&((h[M>>2]|0)==(g|0)?(h[M+4>>2]|0)==(_|0):0)){p=4;break}if(v=v+1|0,v>>>0>=7){v=7,p=4;break}}return(p|0)==4?(Q=E,v|0):0}function Nce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;if(E=Q,Q=Q+48|0,v=E+16|0,x=E+8|0,b=E,g=Kx(g)|0,g|0)return b=g,Q=E,b|0;if(N=p,M=h[N+4>>2]|0,g=x,h[g>>2]=h[N>>2],h[g+4>>2]=M,yq(x,v),g=aq(v,m,b)|0,!g){if(m=h[x>>2]|0,x=h[p+8>>2]|0,(x|0)>0){v=h[p+12>>2]|0,g=0;do m=(h[v+(g<<3)>>2]|0)+m|0,g=g+1|0;while((g|0)<(x|0))}g=b,v=h[g>>2]|0,g=h[g+4>>2]|0,x=((m|0)<0)<<31>>31,(g|0)<(x|0)|(g|0)==(x|0)&v>>>0<m>>>0?(g=b,h[g>>2]=m,h[g+4>>2]=x,g=x):m=v,M=At(m|0,g|0,12,0)|0,N=ee()|0,g=b,h[g>>2]=M,h[g+4>>2]=N,g=_,h[g>>2]=M,h[g+4>>2]=N,g=0}return N=g,Q=E,N|0}function tq(p,m,g,_,v,x,b){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0;var E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0,Ma=0;if(bi=Q,Q=Q+64|0,Ut=bi+48|0,lt=bi+32|0,pt=bi+24|0,Be=bi+8|0,Ke=bi,M=h[p>>2]|0,(M|0)<=0)return pi=0,Q=bi,pi|0;for(Me=p+4|0,be=Ut+8|0,gt=lt+8|0,je=Be+8|0,E=0,we=0;;){N=h[Me>>2]|0,se=N+(we<<4)|0,h[Ut>>2]=h[se>>2],h[Ut+4>>2]=h[se+4>>2],h[Ut+8>>2]=h[se+8>>2],h[Ut+12>>2]=h[se+12>>2],(we|0)==(M+-1|0)?(h[lt>>2]=h[N>>2],h[lt+4>>2]=h[N+4>>2],h[lt+8>>2]=h[N+8>>2],h[lt+12>>2]=h[N+12>>2]):(se=N+(we+1<<4)|0,h[lt>>2]=h[se>>2],h[lt+4>>2]=h[se+4>>2],h[lt+8>>2]=h[se+8>>2],h[lt+12>>2]=h[se+12>>2]),M=Yce(Ut,lt,_,pt)|0;e:do if(M)N=0,E=M;else if(M=pt,N=h[M>>2]|0,M=h[M+4>>2]|0,(M|0)>0|(M|0)==0&N>>>0>0){xe=0,se=0;t:for(;;){if(Vn=1/(+(N>>>0)+4294967296*+(M|0)),Ma=+ie[Ut>>3],M=Js(N|0,M|0,xe|0,se|0)|0,wi=+(M>>>0)+4294967296*+(ee()|0),Ro=+(xe>>>0)+4294967296*+(se|0),ie[Be>>3]=Vn*(Ma*wi)+Vn*(+ie[lt>>3]*Ro),ie[je>>3]=Vn*(+ie[be>>3]*wi)+Vn*(+ie[gt>>3]*Ro),M=pL(Be,_,Ke)|0,M|0){E=M;break}ue=Ke,ae=h[ue>>2]|0,ue=h[ue+4>>2]|0,j=qf(ae|0,ue|0,m|0,g|0)|0,U=ee()|0,M=b+(j<<3)|0,q=M,N=h[q>>2]|0,q=h[q+4>>2]|0;n:do if((N|0)==0&(q|0)==0)Ae=M,pi=16;else for(X=0,K=0;;){if((X|0)>(g|0)|(X|0)==(g|0)&K>>>0>m>>>0){E=1;break t}if((N|0)==(ae|0)&(q|0)==(ue|0))break n;if(M=At(j|0,U|0,1,0)|0,j=ap(M|0,ee()|0,m|0,g|0)|0,U=ee()|0,K=At(K|0,X|0,1,0)|0,X=ee()|0,M=b+(j<<3)|0,q=M,N=h[q>>2]|0,q=h[q+4>>2]|0,(N|0)==0&(q|0)==0){Ae=M,pi=16;break}}while(!1);if((pi|0)==16&&(pi=0,!((ae|0)==0&(ue|0)==0))&&(K=Ae,h[K>>2]=ae,h[K+4>>2]=ue,K=x+(h[v>>2]<<3)|0,h[K>>2]=ae,h[K+4>>2]=ue,K=v,K=At(h[K>>2]|0,h[K+4>>2]|0,1,0)|0,ae=ee()|0,ue=v,h[ue>>2]=K,h[ue+4>>2]=ae),xe=At(xe|0,se|0,1,0)|0,se=ee()|0,M=pt,N=h[M>>2]|0,M=h[M+4>>2]|0,!((M|0)>(se|0)|(M|0)==(se|0)&N>>>0>xe>>>0)){N=1;break e}}N=0}else N=1;while(!1);if(we=we+1|0,!N){pi=21;break}if(M=h[p>>2]|0,(we|0)>=(M|0)){E=0,pi=21;break}}return(pi|0)==21?(Q=bi,E|0):0}function Fce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0;if(wi=Q,Q=Q+112|0,pi=wi+80|0,M=wi+72|0,bi=wi,Ro=wi+56|0,v=Kx(g)|0,v|0)return Vn=v,Q=wi,Vn|0;if(N=p+8|0,Vn=br((h[N>>2]<<5)+32|0)|0,!Vn)return Vn=13,Q=wi,Vn|0;if(yL(p,Vn),v=Kx(g)|0,!v){if(lt=p,pt=h[lt+4>>2]|0,v=M,h[v>>2]=h[lt>>2],h[v+4>>2]=pt,yq(M,pi),v=aq(pi,m,bi)|0,v)lt=0,pt=0;else{if(v=h[M>>2]|0,x=h[N>>2]|0,(x|0)>0){b=h[p+12>>2]|0,g=0;do v=(h[b+(g<<3)>>2]|0)+v|0,g=g+1|0;while((g|0)!=(x|0));g=v}else g=v;v=bi,x=h[v>>2]|0,v=h[v+4>>2]|0,b=((g|0)<0)<<31>>31,(v|0)<(b|0)|(v|0)==(b|0)&x>>>0<g>>>0?(v=bi,h[v>>2]=g,h[v+4>>2]=b,v=b):g=x,lt=At(g|0,v|0,12,0)|0,pt=ee()|0,v=bi,h[v>>2]=lt,h[v+4>>2]=pt,v=0}if(!v){if(g=Ea(lt,8)|0,!g)return _t(Vn),Vn=13,Q=wi,Vn|0;if(E=Ea(lt,8)|0,!E)return _t(Vn),_t(g),Vn=13,Q=wi,Vn|0;je=pi,h[je>>2]=0,h[je+4>>2]=0,je=p,Ut=h[je+4>>2]|0,v=M,h[v>>2]=h[je>>2],h[v+4>>2]=Ut,v=tq(M,lt,pt,m,pi,g,E)|0;e:do if(v)_t(g),_t(E),_t(Vn);else{t:do if((h[N>>2]|0)>0){for(b=p+12|0,x=0;v=tq((h[b>>2]|0)+(x<<3)|0,lt,pt,m,pi,g,E)|0,x=x+1|0,!(v|0);)if((x|0)>=(h[N>>2]|0))break t;_t(g),_t(E),_t(Vn);break e}while(!1);(pt|0)>0|(pt|0)==0&lt>>>0>0&&lp(E|0,0,lt<<3|0)|0,Ut=pi,je=h[Ut+4>>2]|0;t:do if((je|0)>0|(je|0)==0&(h[Ut>>2]|0)>>>0>0){Me=g,be=E,gt=g,je=E,Ut=g,v=g,Ae=g,Be=E,Ke=E,g=E;n:for(;;){for(ue=0,xe=0,se=0,we=0,x=0,b=0;;){E=bi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));if(m=Me+(ue<<3)|0,N=h[m>>2]|0,m=h[m+4>>2]|0,JG(N,m,1,bi,0)|0){E=bi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));E=Ea(7,4)|0,E|0&&(ih(N,m,1,bi,E,7,0,0)|0,_t(E))}for(ae=0;;){K=bi+(ae<<3)|0,X=h[K>>2]|0,K=h[K+4>>2]|0;i:do if((X|0)==0&(K|0)==0)E=x,M=b;else{if(U=qf(X|0,K|0,lt|0,pt|0)|0,N=ee()|0,E=_+(U<<3)|0,m=E,M=h[m>>2]|0,m=h[m+4>>2]|0,!((M|0)==0&(m|0)==0)){q=0,j=0;do{if((q|0)>(pt|0)|(q|0)==(pt|0)&j>>>0>lt>>>0)break n;if((M|0)==(X|0)&(m|0)==(K|0)){E=x,M=b;break i}E=At(U|0,N|0,1,0)|0,U=ap(E|0,ee()|0,lt|0,pt|0)|0,N=ee()|0,j=At(j|0,q|0,1,0)|0,q=ee()|0,E=_+(U<<3)|0,m=E,M=h[m>>2]|0,m=h[m+4>>2]|0}while(!((M|0)==0&(m|0)==0))}if((X|0)==0&(K|0)==0){E=x,M=b;break}w1(X,K,Ro)|0,bL(p,Vn,Ro)|0&&(j=At(x|0,b|0,1,0)|0,b=ee()|0,q=E,h[q>>2]=X,h[q+4>>2]=K,x=be+(x<<3)|0,h[x>>2]=X,h[x+4>>2]=K,x=j),E=x,M=b}while(!1);if(ae=ae+1|0,ae>>>0>=7)break;x=E,b=M}if(ue=At(ue|0,xe|0,1,0)|0,xe=ee()|0,se=At(se|0,we|0,1,0)|0,we=ee()|0,b=pi,x=h[b>>2]|0,b=h[b+4>>2]|0,(we|0)<(b|0)|(we|0)==(b|0)&se>>>0<x>>>0)x=E,b=M;else break}if((b|0)>0|(b|0)==0&x>>>0>0){x=0,b=0;do we=Me+(x<<3)|0,h[we>>2]=0,h[we+4>>2]=0,x=At(x|0,b|0,1,0)|0,b=ee()|0,we=pi,se=h[we+4>>2]|0;while((b|0)<(se|0)|((b|0)==(se|0)?x>>>0<(h[we>>2]|0)>>>0:0))}if(we=pi,h[we>>2]=E,h[we+4>>2]=M,(M|0)>0|(M|0)==0&E>>>0>0)ae=g,ue=Ke,xe=Ut,se=Be,we=be,g=Ae,Ke=v,Be=gt,Ae=ae,v=ue,Ut=je,je=xe,gt=se,be=Me,Me=we;else break t}_t(gt),_t(je),_t(Vn),v=1;break e}else v=E;while(!1);_t(Vn),_t(g),_t(v),v=0}while(!1);return Vn=v,Q=wi,Vn|0}}return _t(Vn),Vn=v,Q=wi,Vn|0}function Bce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0;if(E=Q,Q=Q+16|0,b=E,p=Kce(p,m,((m|0)<0)<<31>>31,b)|0,p|0)return b=p,Q=E,b|0;if(x=Lue(b,g)|0,g=b+4|0,(h[b>>2]|0)>0){m=0;do{if(v=h[g>>2]|0,_=v+(m<<4)+4|0,_t(h[_>>2]|0),h[_>>2]=0,h[v+(m<<4)>>2]=0,_=v+(m<<4)+8|0,v=v+(m<<4)+12|0,(h[_>>2]|0)>0){p=0;do M=h[v>>2]|0,N=M+(p<<3)+4|0,_t(h[N>>2]|0),h[N>>2]=0,h[M+(p<<3)>>2]=0,p=p+1|0;while((p|0)<(h[_>>2]|0))}_t(h[v>>2]|0),h[v>>2]=0,h[_>>2]=0,m=m+1|0}while((m|0)<(h[b>>2]|0))}return _t(h[g>>2]|0),h[g>>2]=0,h[b>>2]=0,N=x,Q=E,N|0}function vc(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;if(b=h[p>>2]|0,(b|0)<=0)return v=0,_=0,b=v<0,_=12.566370614359172-_,_=v+_,v=b?_:v,ie[m>>3]=v,0;if(x=h[p+4>>2]|0,p=(b|0)!=1&1,E=+ie[x>>3]*.5+.7853981633974483,v=+ie[x+(p<<4)>>3]*.5+.7853981633974483,g=+zi(+E)*+zi(+v),_=+ie[x+(p<<4)+8>>3]-+ie[x+8>>3],g=+Ta(+(+zi(+_)*g),+(+ii(+E)*+ii(+v)+ +ii(+_)*g))*-2,_=g+0,g=_-g,(b|0)==1)return E=_,v=g,b=E<0,v=12.566370614359172-v,v=E+v,E=b?v:E,ie[m>>3]=E,0;for(p=1,v=_;U=p,p=p+1|0,q=(p|0)%(b|0)|0,N=+ie[x+(U<<4)>>3]*.5+.7853981633974483,M=+ie[x+(q<<4)>>3]*.5+.7853981633974483,_=+zi(+N)*+zi(+M),E=+ie[x+(q<<4)+8>>3]-+ie[x+(U<<4)+8>>3],g=+Ta(+(+zi(+E)*_),+(+ii(+N)*+ii(+M)+ +ii(+E)*_))*-2-g,_=v+g,g=_-v-g,!((p|0)>=(b|0));)v=_;return q=_<0,N=12.566370614359172-g,N=_+N,N=q?N:_,ie[m>>3]=N,0}function Oce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+192|0,_=b+176|0,v=b,x=b+168|0,p=zm(p,m,v)|0,p|0?(x=p,Q=b,x|0):(h[x>>2]=h[v>>2],h[x+4>>2]=v+8,h[_>>2]=h[x>>2],h[_+4>>2]=h[x+4>>2],vc(_,g)|0,x=0,Q=b,x|0)}function Uce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+192|0,_=b+176|0,v=b,x=b+168|0,p=zm(p,m,v)|0,p?(x=p,Q=b,x|0):(h[x>>2]=h[v>>2],h[x+4>>2]=v+8,h[_>>2]=h[x>>2],h[_+4>>2]=h[x+4>>2],vc(_,g)|0,ie[g>>3]=+ie[g>>3]*4058973249931477e-8,x=0,Q=b,x|0)}function kce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+192|0,_=b+176|0,v=b,x=b+168|0,p=zm(p,m,v)|0,p?(x=p,Q=b,x|0):(h[x>>2]=h[v>>2],h[x+4>>2]=v+8,h[_>>2]=h[x>>2],h[_+4>>2]=h[x+4>>2],vc(_,g)|0,ie[g>>3]=+ie[g>>3]*4058973249931477e-8*1e6,x=0,Q=b,x|0)}function yr(p){return p=p|0,p>>>0>121?(p=0,p|0):(p=h[7696+(p*28|0)+16>>2]|0,p|0)}function nL(p){return p=p|0,(p|0)==4|(p|0)==117|0}function nq(p){return p=p|0,h[11120+((h[p>>2]|0)*216|0)+((h[p+4>>2]|0)*72|0)+((h[p+8>>2]|0)*24|0)+(h[p+12>>2]<<3)>>2]|0}function zce(p){return p=p|0,h[11120+((h[p>>2]|0)*216|0)+((h[p+4>>2]|0)*72|0)+((h[p+8>>2]|0)*24|0)+(h[p+12>>2]<<3)+4>>2]|0}function Vce(p,m){p=p|0,m=m|0,p=7696+(p*28|0)|0,h[m>>2]=h[p>>2],h[m+4>>2]=h[p+4>>2],h[m+8>>2]=h[p+8>>2],h[m+12>>2]=h[p+12>>2]}function Gce(p,m){p=p|0,m=m|0;var g=0,_=0;if(m>>>0>20)return m=-1,m|0;do if((h[11120+(m*216|0)>>2]|0)!=(p|0))if((h[11120+(m*216|0)+8>>2]|0)!=(p|0))if((h[11120+(m*216|0)+16>>2]|0)!=(p|0))if((h[11120+(m*216|0)+24>>2]|0)!=(p|0))if((h[11120+(m*216|0)+32>>2]|0)!=(p|0))if((h[11120+(m*216|0)+40>>2]|0)!=(p|0))if((h[11120+(m*216|0)+48>>2]|0)!=(p|0))if((h[11120+(m*216|0)+56>>2]|0)!=(p|0))if((h[11120+(m*216|0)+64>>2]|0)!=(p|0))if((h[11120+(m*216|0)+72>>2]|0)!=(p|0))if((h[11120+(m*216|0)+80>>2]|0)!=(p|0))if((h[11120+(m*216|0)+88>>2]|0)!=(p|0))if((h[11120+(m*216|0)+96>>2]|0)!=(p|0))if((h[11120+(m*216|0)+104>>2]|0)!=(p|0))if((h[11120+(m*216|0)+112>>2]|0)!=(p|0))if((h[11120+(m*216|0)+120>>2]|0)!=(p|0))if((h[11120+(m*216|0)+128>>2]|0)!=(p|0))if((h[11120+(m*216|0)+136>>2]|0)==(p|0))p=2,g=1,_=2;else{if((h[11120+(m*216|0)+144>>2]|0)==(p|0)){p=0,g=2,_=0;break}if((h[11120+(m*216|0)+152>>2]|0)==(p|0)){p=0,g=2,_=1;break}if((h[11120+(m*216|0)+160>>2]|0)==(p|0)){p=0,g=2,_=2;break}if((h[11120+(m*216|0)+168>>2]|0)==(p|0)){p=1,g=2,_=0;break}if((h[11120+(m*216|0)+176>>2]|0)==(p|0)){p=1,g=2,_=1;break}if((h[11120+(m*216|0)+184>>2]|0)==(p|0)){p=1,g=2,_=2;break}if((h[11120+(m*216|0)+192>>2]|0)==(p|0)){p=2,g=2,_=0;break}if((h[11120+(m*216|0)+200>>2]|0)==(p|0)){p=2,g=2,_=1;break}if((h[11120+(m*216|0)+208>>2]|0)==(p|0)){p=2,g=2,_=2;break}else p=-1;return p|0}else p=2,g=1,_=1;else p=2,g=1,_=0;else p=1,g=1,_=2;else p=1,g=1,_=1;else p=1,g=1,_=0;else p=0,g=1,_=2;else p=0,g=1,_=1;else p=0,g=1,_=0;else p=2,g=0,_=2;else p=2,g=0,_=1;else p=2,g=0,_=0;else p=1,g=0,_=2;else p=1,g=0,_=1;else p=1,g=0,_=0;else p=0,g=0,_=2;else p=0,g=0,_=1;else p=0,g=0,_=0;while(!1);return m=h[11120+(m*216|0)+(g*72|0)+(p*24|0)+(_<<3)+4>>2]|0,m|0}function iq(p,m){return p=p|0,m=m|0,(h[7696+(p*28|0)+20>>2]|0)==(m|0)?(m=1,m|0):(m=(h[7696+(p*28|0)+24>>2]|0)==(m|0),m|0)}function iL(p,m){return p=p|0,m=m|0,h[848+(p*28|0)+(m<<2)>>2]|0}function rL(p,m){return p=p|0,m=m|0,(h[848+(p*28|0)>>2]|0)==(m|0)?(m=0,m|0):(h[848+(p*28|0)+4>>2]|0)==(m|0)?(m=1,m|0):(h[848+(p*28|0)+8>>2]|0)==(m|0)?(m=2,m|0):(h[848+(p*28|0)+12>>2]|0)==(m|0)?(m=3,m|0):(h[848+(p*28|0)+16>>2]|0)==(m|0)?(m=4,m|0):(h[848+(p*28|0)+20>>2]|0)==(m|0)?(m=5,m|0):((h[848+(p*28|0)+24>>2]|0)==(m|0)?6:7)|0}function qce(){return 122}function Hce(p){p=p|0;var m=0,g=0,_=0;m=0;do ft(m|0,0,45)|0,_=ee()|0|134225919,g=p+(m<<3)|0,h[g>>2]=-1,h[g+4>>2]=_,m=m+1|0;while((m|0)!=122);return 0}function Wce(p){p=p|0;var m=0,g=0,_=0;return _=+ie[p+16>>3],g=+ie[p+24>>3],m=_-g,+(_<g?m+6.283185307179586:m)}function jce(p){return p=p|0,+ie[p+16>>3]<+ie[p+24>>3]|0}function Xce(p){return p=p|0,+(+ie[p>>3]-+ie[p+8>>3])}function rq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;return g=+ie[m>>3],!(g>=+ie[p+8>>3])||!(g<=+ie[p>>3])?(m=0,m|0):(_=+ie[p+16>>3],g=+ie[p+24>>3],v=+ie[m+8>>3],m=v>=g,p=v<=_&1,_<g?m&&(p=1):m||(p=0),m=(p|0)!=0,m|0)}function sL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;return+ie[p>>3]<+ie[m+8>>3]||+ie[p+8>>3]>+ie[m>>3]?(_=0,_|0):(x=+ie[p+16>>3],g=p+24|0,U=+ie[g>>3],b=x<U,_=m+16|0,N=+ie[_>>3],v=m+24|0,M=+ie[v>>3],E=N<M,m=U-N<M-x,p=b?E|m?1:2:0,m=E?b?1:m?2:1:0,x=+kl(x,p),x<+kl(+ie[v>>3],m)||(U=+kl(+ie[g>>3],p),U>+kl(+ie[_>>3],m))?(E=0,E|0):(E=1,E|0))}function $ce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0;x=+ie[p+16>>3],M=+ie[p+24>>3],p=x<M,E=+ie[m+16>>3],b=+ie[m+24>>3],v=E<b,m=M-E<b-x,h[g>>2]=p?v|m?1:2:0,h[_>>2]=v?p?1:m?2:1:0}function sq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;return+ie[p>>3]<+ie[m>>3]||+ie[p+8>>3]>+ie[m+8>>3]?(_=0,_|0):(_=p+16|0,M=+ie[_>>3],x=+ie[p+24>>3],b=M<x,g=m+16|0,U=+ie[g>>3],v=m+24|0,N=+ie[v>>3],E=U<N,m=x-U<N-M,p=b?E|m?1:2:0,m=E?b?1:m?2:1:0,x=+kl(x,p),x<=+kl(+ie[v>>3],m)?(U=+kl(+ie[_>>3],p),E=U>=+kl(+ie[g>>3],m),E|0):(E=0,E|0))}function oq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0;v=Q,Q=Q+176|0,_=v,h[_>>2]=4,E=+ie[m>>3],ie[_+8>>3]=E,x=+ie[m+16>>3],ie[_+16>>3]=x,ie[_+24>>3]=E,E=+ie[m+24>>3],ie[_+32>>3]=E,b=+ie[m+8>>3],ie[_+40>>3]=b,ie[_+48>>3]=E,ie[_+56>>3]=b,ie[_+64>>3]=x,m=_+72|0,g=m+96|0;do h[m>>2]=0,m=m+4|0;while((m|0)<(g|0));cu(p|0,_|0,168)|0,Q=v}function aq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0;K=Q,Q=Q+288|0,U=K+264|0,q=K+96|0,N=K,E=N,M=E+96|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));return m=AL(m,N)|0,m|0?(X=m,Q=K,X|0):(M=N,N=h[M>>2]|0,M=h[M+4>>2]|0,w1(N,M,U)|0,zm(N,M,q)|0,b=+$x(U,q+8|0),ie[U>>3]=+ie[p>>3],M=U+8|0,ie[M>>3]=+ie[p+16>>3],ie[q>>3]=+ie[p+8>>3],N=q+8|0,ie[N>>3]=+ie[p+24>>3],v=+$x(U,q),ue=+ie[M>>3]-+ie[N>>3],x=+Ks(+ue),ae=+ie[U>>3]-+ie[q>>3],_=+Ks(+ae),!(ue==0|ae==0)&&(ue=+Nq(+x,+_),ue=+x1(+(v*v/+pT(+(ue/+pT(+x,+_)),3)/(b*(b*2.59807621135)*.8))),ie[or>>3]=ue,j=~~ue>>>0,X=+Ks(ue)>=1?ue>0?~~+tL(+fo(ue/4294967296),4294967295)>>>0:~~+x1((ue-+(~~ue>>>0))/4294967296)>>>0:0,(h[or+4>>2]&2146435072|0)!=2146435072)?(q=(j|0)==0&(X|0)==0,m=g,h[m>>2]=q?1:j,h[m+4>>2]=q?0:X,m=0):m=1,X=m,Q=K,X|0)}function Yce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0;N=Q,Q=Q+288|0,b=N+264|0,E=N+96|0,M=N,v=M,x=v+96|0;do h[v>>2]=0,v=v+4|0;while((v|0)<(x|0));return g=AL(g,M)|0,g|0?(_=g,Q=N,_|0):(g=M,v=h[g>>2]|0,g=h[g+4>>2]|0,w1(v,g,b)|0,zm(v,g,E)|0,U=+$x(b,E+8|0),U=+x1(+(+$x(p,m)/(U*2))),ie[or>>3]=U,g=~~U>>>0,v=+Ks(U)>=1?U>0?~~+tL(+fo(U/4294967296),4294967295)>>>0:~~+x1((U-+(~~U>>>0))/4294967296)>>>0:0,(h[or+4>>2]&2146435072|0)==2146435072?(_=1,Q=N,_|0):(M=(g|0)==0&(v|0)==0,h[_>>2]=M?1:g,h[_+4>>2]=M?0:v,_=0,Q=N,_|0))}function Zce(p,m){p=p|0,m=+m;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;x=p+16|0,b=+ie[x>>3],g=p+24|0,v=+ie[g>>3],_=b-v,_=b<v?_+6.283185307179586:_,N=+ie[p>>3],E=p+8|0,M=+ie[E>>3],U=N-M,_=(_*m-_)*.5,m=(U*m-U)*.5,N=N+m,ie[p>>3]=N>1.5707963267948966?1.5707963267948966:N,m=M-m,ie[E>>3]=m<-1.5707963267948966?-1.5707963267948966:m,m=b+_,m=m>3.141592653589793?m+-6.283185307179586:m,ie[x>>3]=m<-3.141592653589793?m+6.283185307179586:m,m=v-_,m=m>3.141592653589793?m+-6.283185307179586:m,ie[g>>3]=m<-3.141592653589793?m+6.283185307179586:m}function Kce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0;if(pt=Q,Q=Q+224|0,gt=pt,Be=pt+48|0,M=(g|0)>0|(g|0)==0&m>>>0>0,M&(g>>>0>0|(g|0)==0&m>>>0>17895697))return lt=14,Q=pt,lt|0;if((g|0)<0)return lt=2,Q=pt,lt|0;if((m|0)==0&(g|0)==0)return h[_>>2]=0,h[_+4>>2]=0,lt=0,Q=pt,lt|0;for(v=p,v=cL(h[v>>2]|0,h[v+4>>2]|0)|0,b=0,E=0;;){if(x=p+(b<<3)|0,lt=x,!(oT(h[lt>>2]|0,h[lt+4>>2]|0)|0)){v=5,je=159;break}if(lt=x,lt=(cL(h[lt>>2]|0,h[lt+4>>2]|0)|0)==(v|0),b=At(b|0,E|0,1,0)|0,E=ee()|0,!lt){v=12,je=159;break}if(!((E|0)<(g|0)|(E|0)==(g|0)&b>>>0<m>>>0)){je=8;break}}if((je|0)==8){do if((g|0)>0|(g|0)==0&m>>>0>1){if(v=m<<3,b=br(v)|0,!b)return lt=13,Q=pt,lt|0;for(cu(b|0,p|0,v|0)|0,uT(b,m,8,1),v=1,x=0;Ut=b+(v<<3)|0,lt=b+(v+-1<<3)|0,lt=(h[Ut>>2]|0)==(h[lt>>2]|0)?(h[Ut+4>>2]|0)==(h[lt+4>>2]|0):0,v=At(v|0,x|0,1,0)|0,x=ee()|0,!lt;)if(!((x|0)<(g|0)|(x|0)==(g|0)&v>>>0<m>>>0)){je=14;break}if((je|0)==14){_t(b);break}return _t(b),lt=10,Q=pt,lt|0}while(!1);if(v=wr(m|0,g|0,6,0)|0,x=ee()|0,M){b=0,E=0;do lt=p+(E<<3)|0,lt=((Zi(h[lt>>2]|0,h[lt+4>>2]|0)|0)!=0)<<31>>31,v=At(v|0,x|0,lt|0,((lt|0)<0)<<31>>31|0)|0,x=ee()|0,E=At(E|0,b|0,1,0)|0,b=ee()|0;while((b|0)<(g|0)|(b|0)==(g|0)&E>>>0<m>>>0);Ae=v,we=x}else Ae=v,we=x;if(xe=wr(Ae|0,we|0,10,0)|0,se=ee()|0,Ut=br(Ae<<5)|0,!Ut)return lt=13,Q=pt,lt|0;if(lt=Ea(xe,4)|0,!lt)return _t(Ut),lt=13,Q=pt,lt|0;e:do if(M){for(be=p,oL(h[be>>2]|0,h[be+4>>2]|0,gt)|0,X=Ut,K=0,ae=0,v=0,ue=0;;){M=gt,M=(h[M>>2]|0)==0&(h[M+4>>2]|0)==0,x=M?26990:26995,b=M?5:6,E=0,M=gt+((M&1)<<3)|0,N=At(b|0,E|0,-1,-1)|0,U=ee()|0,q=0,j=0;do Me=M+(q<<3)|0,Ke=h[Me+4>>2]|0,be=X+(q<<5)|0,h[be>>2]=h[Me>>2],h[be+4>>2]=Ke,He[X+(q<<5)+9>>0]=0,He[X+(q<<5)+8>>0]=0,h[X+(q<<5)+20>>2]=X,be=X+(q<<5)+24|0,h[be>>2]=1,h[be+4>>2]=0,be=He[x+q>>0]|0,Ke=At(N|0,U|0,q|0,j|0)|0,Ke=qf(Ke|0,ee()|0,b|0,E|0)|0,ee()|0,Ke=He[x+Ke>>0]|0,q=At(q|0,j|0,1,0)|0,j=ee()|0,Me=He[x+((q|0)==(b|0)&(j|0)==(E|0)?0:q)>>0]|0,be=be&255,h[X+(be<<5)+16>>2]=X+((Ke&255)<<5),h[X+(be<<5)+12>>2]=X+((Me&255)<<5);while(j>>>0<E>>>0|(j|0)==(E|0)&q>>>0<b>>>0);if(K=At(K|0,ae|0,1,0)|0,ae=ee()|0,v=At(b|0,E|0,v|0,ue|0)|0,ue=ee()|0,!((ae|0)<(g|0)|(ae|0)==(g|0)&K>>>0<m>>>0))break e;be=p+(K<<3)|0,oL(h[be>>2]|0,h[be+4>>2]|0,gt)|0||(X=Ut+(v<<5)|0)}di(27634,26956,108,26975)}while(!1);if((we|0)>0|(we|0)==0&Ae>>>0>0){E=0,M=0;do{if(x=Ut+(E<<5)|0,b=h[x>>2]|0,x=h[x+4>>2]|0,v=tt(b|0,x|0,30)|0,x=wr(v^b|0,(ee()|0)^x|0,484763065,-1084733587)|0,b=ee()|0,v=tt(x|0,b|0,27)|0,b=wr(v^x|0,(ee()|0)^b|0,321982955,-1798288965)|0,x=ee()|0,v=tt(b|0,x|0,31)|0,x=qf(v^b|0,(ee()|0)^x|0,xe|0,se|0)|0,b=ee()|0,v=lt+(x<<2)|0,h[v>>2]|0)do v=At(x|0,b|0,1,0)|0,x=ap(v|0,ee()|0,xe|0,se|0)|0,b=ee()|0,v=lt+(x<<2)|0;while((h[v>>2]|0)!=0);h[v>>2]=Ut+(E<<5),E=At(E|0,M|0,1,0)|0,M=ee()|0}while((M|0)<(we|0)|(M|0)==(we|0)&E>>>0<Ae>>>0);q=0,j=0;do{if(E=Ut+(q<<5)|0,M=Ut+(q<<5)+9|0,!(He[M>>0]|0)){if(be=E,cq(h[be>>2]|0,h[be+4>>2]|0,gt)|0){je=39;break}U=gt,N=h[U>>2]|0,U=h[U+4>>2]|0,x=tt(N|0,U|0,30)|0,x=wr(x^N|0,(ee()|0)^U|0,484763065,-1084733587)|0,b=ee()|0,v=tt(x|0,b|0,27)|0,b=wr(v^x|0,(ee()|0)^b|0,321982955,-1798288965)|0,x=ee()|0,v=tt(b|0,x|0,31)|0,x=qf(v^b|0,(ee()|0)^x|0,xe|0,se|0)|0,b=ee()|0,v=h[lt+(x<<2)>>2]|0;e:do if(v|0){for(;be=v,!((h[be>>2]|0)==(N|0)&&(h[be+4>>2]|0)==(U|0));)if(v=At(x|0,b|0,1,0)|0,x=ap(v|0,ee()|0,xe|0,se|0)|0,b=ee()|0,v=h[lt+(x<<2)>>2]|0,!v)break e;He[M>>0]=1,He[v+9>>0]=1,x=v+16|0,be=Ut+(q<<5)+12|0,h[(h[be>>2]|0)+16>>2]=h[x>>2],g=v+12|0,Me=h[Ut+(q<<5)+16>>2]|0,h[Me+12>>2]=h[g>>2],h[(h[g>>2]|0)+16>>2]=Me,h[(h[x>>2]|0)+12>>2]=h[be>>2],x=sT(E)|0,be=sT(v)|0,v=x+24|0,g=h[v+4>>2]|0,Me=be+24|0,Ke=h[Me+4>>2]|0,Me=(g|0)<(Ke|0)|((g|0)==(Ke|0)?(h[v>>2]|0)>>>0<(h[Me>>2]|0)>>>0:0),v=Me?x:be,x=Me?be:x,(x|0)!=(v|0)&&(Ke=v+24|0,be=x+24|0,Me=be,Ke=At(h[Me>>2]|0,h[Me+4>>2]|0,h[Ke>>2]|0,h[Ke+4>>2]|0)|0,Me=ee()|0,h[be>>2]=Ke,h[be+4>>2]=Me,h[v+20>>2]=x)}while(!1)}q=At(q|0,j|0,1,0)|0,j=ee()|0}while((j|0)<(we|0)|(j|0)==(we|0)&q>>>0<Ae>>>0);(je|0)==39&&di(27634,26956,258,27001),v=0,x=0;do He[Ut+(v<<5)+8>>0]=0,v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(we|0)|(x|0)==(we|0)&v>>>0<Ae>>>0);for(N=0,b=0,M=0,U=0;;){if(v=Ut+(N<<5)|0,(He[Ut+(N<<5)+8>>0]|0)==0&&(He[Ut+(N<<5)+9>>0]|0)==0){E=v,x=h[E>>2]|0,E=h[E+4>>2]|0;do He[v+8>>0]=1,v=h[v+12>>2]|0,be=v;while(!((h[be>>2]|0)==(x|0)&&(h[be+4>>2]|0)==(E|0)));b=At(b|0,M|0,1,0)|0,E=ee()|0}else E=M;if(N=At(N|0,U|0,1,0)|0,U=ee()|0,(U|0)<(we|0)|(U|0)==(we|0)&N>>>0<Ae>>>0)M=E;else break}v=0,x=0;do He[Ut+(v<<5)+8>>0]=0,v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(we|0)|(x|0)==(we|0)&v>>>0<Ae>>>0);Me=b,Ke=E,v=1}else Me=0,Ke=0,v=0;be=br(Me*24|0)|0;e:do if(be|0){t:do if(v){p=0,xe=0,g=0,m=0;n:for(;;){if(v=Ut+(p<<5)|0,(He[Ut+(p<<5)+8>>0]|0)==0&&(He[Ut+(p<<5)+9>>0]|0)==0){ue=v,ae=h[ue>>2]|0,ue=h[ue+4>>2]|0,x=0,b=0;do x=At(x|0,b|0,2,0)|0,b=ee()|0,v=h[v+12>>2]|0,se=v;while(!((h[se>>2]|0)==(ae|0)&&(h[se+4>>2]|0)==(ue|0)));if(K=br(x<<4)|0,!K)break;x=ae,b=ue,X=0,j=0,E=0,M=0;do{if(Hx(x,b,Be)|0){je=69;break n}if(se=h[Be>>2]|0,U=se+-1|0,q=((U|0)<0)<<31>>31,(se|0)>1){b=E,N=0,x=M,E=0;do se=K+(b<<4)|0,M=Be+8+(N<<4)|0,h[se>>2]=h[M>>2],h[se+4>>2]=h[M+4>>2],h[se+8>>2]=h[M+8>>2],h[se+12>>2]=h[M+12>>2],b=At(b|0,x|0,1,0)|0,x=ee()|0,N=At(N|0,E|0,1,0)|0,E=ee()|0;while((E|0)<(q|0)|(E|0)==(q|0)&N>>>0<U>>>0);E=b,M=x}X=At(X|0,j|0,U|0,q|0)|0,j=ee()|0,He[v+8>>0]=1,v=h[v+12>>2]|0,b=v,x=h[b>>2]|0,b=h[b+4>>2]|0}while(!((x|0)==(ae|0)&(b|0)==(ue|0)));if(x=Que(K,X<<4)|0,!x){je=75;break}ue=sT(v)|0,se=h[ue+4>>2]|0,v=be+(g*24|0)|0,h[v>>2]=h[ue>>2],h[v+4>>2]=se,v=be+(g*24|0)+16|0,h[v>>2]=X,h[be+(g*24|0)+20>>2]=x,h[gt>>2]=h[v>>2],h[gt+4>>2]=h[v+4>>2],vc(gt,be+(g*24|0)+8|0)|0,x=At(g|0,xe|0,1,0)|0,v=ee()|0}else x=g,v=xe;if(p=At(p|0,m|0,1,0)|0,m=ee()|0,(m|0)<(we|0)|(m|0)==(we|0)&p>>>0<Ae>>>0)xe=v,g=x;else break t}if((je|0)==69?di(27634,26956,351,27016):(je|0)==75&&_t(K),(xe|0)>0|(xe|0)==0&g>>>0>0)for(E=0,M=0,v=g,b=xe;x=h[be+(E*24|0)+20>>2]|0,x?(_t(x),x=xe,v=g):x=b,E=At(E|0,M|0,1,0)|0,M=ee()|0,(M|0)<(x|0)|(M|0)==(x|0)&E>>>0<v>>>0;)b=x;_t(be);break e}while(!1);uT(be,Me,24,2);t:do if((Me|0)==0&(Ke|0)==0){if(se=br(192)|0,se|0){if(h[se+16>>2]=0,h[se+20>>2]=0,j=se+8|0,h[j>>2]=3,v=br(48)|0,X=se+12|0,h[X>>2]=v,v|0){h[v>>2]=h[3860],h[v+4>>2]=h[3861],h[v+8>>2]=h[3862],h[v+12>>2]=h[3863],q=v+16|0,h[q>>2]=h[3864],h[q+4>>2]=h[3865],h[q+8>>2]=h[3866],h[q+12>>2]=h[3867],q=v+32|0,h[q>>2]=h[3868],h[q+4>>2]=h[3869],h[q+8>>2]=h[3870],h[q+12>>2]=h[3871],h[gt>>2]=h[j>>2],h[gt+4>>2]=h[j+4>>2],vc(gt,se)|0,h[se+40>>2]=0,h[se+44>>2]=0,q=se+32|0,h[q>>2]=3,v=br(48)|0,K=se+36|0,h[K>>2]=v;do if(!v)E=0,M=1;else{if(h[v>>2]=h[3872],h[v+4>>2]=h[3873],h[v+8>>2]=h[3874],h[v+12>>2]=h[3875],U=v+16|0,h[U>>2]=h[3876],h[U+4>>2]=h[3877],h[U+8>>2]=h[3878],h[U+12>>2]=h[3879],U=v+32|0,h[U>>2]=h[3880],h[U+4>>2]=h[3881],h[U+8>>2]=h[3882],h[U+12>>2]=h[3883],h[gt>>2]=h[q>>2],h[gt+4>>2]=h[q+4>>2],vc(gt,se+24|0)|0,h[se+64>>2]=0,h[se+68>>2]=0,U=se+56|0,h[U>>2]=3,v=br(48)|0,ae=se+60|0,h[ae>>2]=v,!v){E=0,M=2;break}if(h[v>>2]=h[3884],h[v+4>>2]=h[3885],h[v+8>>2]=h[3886],h[v+12>>2]=h[3887],N=v+16|0,h[N>>2]=h[3888],h[N+4>>2]=h[3889],h[N+8>>2]=h[3890],h[N+12>>2]=h[3891],N=v+32|0,h[N>>2]=h[3892],h[N+4>>2]=h[3893],h[N+8>>2]=h[3894],h[N+12>>2]=h[3895],h[gt>>2]=h[U>>2],h[gt+4>>2]=h[U+4>>2],vc(gt,se+48|0)|0,h[se+88>>2]=0,h[se+92>>2]=0,N=se+80|0,h[N>>2]=3,v=br(48)|0,ue=se+84|0,h[ue>>2]=v,!v){E=0,M=3;break}if(h[v>>2]=h[3896],h[v+4>>2]=h[3897],h[v+8>>2]=h[3898],h[v+12>>2]=h[3899],M=v+16|0,h[M>>2]=h[3900],h[M+4>>2]=h[3901],h[M+8>>2]=h[3902],h[M+12>>2]=h[3903],M=v+32|0,h[M>>2]=h[3904],h[M+4>>2]=h[3905],h[M+8>>2]=h[3906],h[M+12>>2]=h[3907],h[gt>>2]=h[N>>2],h[gt+4>>2]=h[N+4>>2],vc(gt,se+72|0)|0,h[se+112>>2]=0,h[se+116>>2]=0,M=se+104|0,h[M>>2]=3,v=br(48)|0,p=se+108|0,h[p>>2]=v,!v){E=0,M=4;break}if(h[v>>2]=h[3908],h[v+4>>2]=h[3909],h[v+8>>2]=h[3910],h[v+12>>2]=h[3911],E=v+16|0,h[E>>2]=h[3912],h[E+4>>2]=h[3913],h[E+8>>2]=h[3914],h[E+12>>2]=h[3915],E=v+32|0,h[E>>2]=h[3916],h[E+4>>2]=h[3917],h[E+8>>2]=h[3918],h[E+12>>2]=h[3919],h[gt>>2]=h[M>>2],h[gt+4>>2]=h[M+4>>2],vc(gt,se+96|0)|0,h[se+136>>2]=0,h[se+140>>2]=0,E=se+128|0,h[E>>2]=3,v=br(48)|0,m=se+132|0,h[m>>2]=v,!v){E=0,M=5;break}if(h[v>>2]=h[3920],h[v+4>>2]=h[3921],h[v+8>>2]=h[3922],h[v+12>>2]=h[3923],b=v+16|0,h[b>>2]=h[3924],h[b+4>>2]=h[3925],h[b+8>>2]=h[3926],h[b+12>>2]=h[3927],b=v+32|0,h[b>>2]=h[3928],h[b+4>>2]=h[3929],h[b+8>>2]=h[3930],h[b+12>>2]=h[3931],h[gt>>2]=h[E>>2],h[gt+4>>2]=h[E+4>>2],vc(gt,se+120|0)|0,h[se+160>>2]=0,h[se+164>>2]=0,b=se+152|0,h[b>>2]=3,v=br(48)|0,g=se+156|0,h[g>>2]=v,!v){E=0,M=6;break}if(h[v>>2]=h[3932],h[v+4>>2]=h[3933],h[v+8>>2]=h[3934],h[v+12>>2]=h[3935],x=v+16|0,h[x>>2]=h[3936],h[x+4>>2]=h[3937],h[x+8>>2]=h[3938],h[x+12>>2]=h[3939],x=v+32|0,h[x>>2]=h[3940],h[x+4>>2]=h[3941],h[x+8>>2]=h[3942],h[x+12>>2]=h[3943],h[gt>>2]=h[b>>2],h[gt+4>>2]=h[b+4>>2],vc(gt,se+144|0)|0,h[se+184>>2]=0,h[se+188>>2]=0,x=se+176|0,h[x>>2]=3,v=br(48)|0,xe=se+180|0,h[xe>>2]=v,!v){E=0,M=7;break}if(h[v>>2]=h[3944],h[v+4>>2]=h[3945],h[v+8>>2]=h[3946],h[v+12>>2]=h[3947],Be=v+16|0,h[Be>>2]=h[3948],h[Be+4>>2]=h[3949],h[Be+8>>2]=h[3950],h[Be+12>>2]=h[3951],v=v+32|0,h[v>>2]=h[3952],h[v+4>>2]=h[3953],h[v+8>>2]=h[3954],h[v+12>>2]=h[3955],h[gt>>2]=h[x>>2],h[gt+4>>2]=h[x+4>>2],vc(gt,se+168|0)|0,uT(se,8,24,3),v=br(128)|0,h[_+4>>2]=v,v|0){h[_>>2]=8,h[v>>2]=h[j>>2],h[v+4>>2]=h[j+4>>2],h[v+8>>2]=h[j+8>>2],h[v+12>>2]=h[j+12>>2],je=v+16|0,h[je>>2]=h[q>>2],h[je+4>>2]=h[q+4>>2],h[je+8>>2]=h[q+8>>2],h[je+12>>2]=h[q+12>>2],je=v+32|0,h[je>>2]=h[U>>2],h[je+4>>2]=h[U+4>>2],h[je+8>>2]=h[U+8>>2],h[je+12>>2]=h[U+12>>2],je=v+48|0,h[je>>2]=h[N>>2],h[je+4>>2]=h[N+4>>2],h[je+8>>2]=h[N+8>>2],h[je+12>>2]=h[N+12>>2],je=v+64|0,h[je>>2]=h[M>>2],h[je+4>>2]=h[M+4>>2],h[je+8>>2]=h[M+8>>2],h[je+12>>2]=h[M+12>>2],je=v+80|0,h[je>>2]=h[E>>2],h[je+4>>2]=h[E+4>>2],h[je+8>>2]=h[E+8>>2],h[je+12>>2]=h[E+12>>2],je=v+96|0,h[je>>2]=h[b>>2],h[je+4>>2]=h[b+4>>2],h[je+8>>2]=h[b+8>>2],h[je+12>>2]=h[b+12>>2],je=v+112|0,h[je>>2]=h[x>>2],h[je+4>>2]=h[x+4>>2],h[je+8>>2]=h[x+8>>2],h[je+12>>2]=h[x+12>>2],_t(se),je=158;break t}v=h[X>>2]|0,v|0&&_t(v),v=h[K>>2]|0,v|0&&_t(v),v=h[ae>>2]|0,v|0&&_t(v),v=h[ue>>2]|0,v|0&&_t(v),v=h[p>>2]|0,v|0&&_t(v),v=h[m>>2]|0,v|0&&_t(v),v=h[g>>2]|0,v|0&&_t(v),v=h[xe>>2]|0,v|0&&_t(v),_t(se);break t}while(!1);v=0,b=0;do x=h[se+(v*24|0)+12>>2]|0,x|0&&_t(x),v=At(v|0,b|0,1,0)|0,b=ee()|0;while(b>>>0<E>>>0|(b|0)==(E|0)&v>>>0<M>>>0)}_t(se),je=152}}else{if((Ke|0)>0|(Ke|0)==0&Me>>>0>0){b=0,E=0,M=0,x=0,v=0,N=0;do Be=be+(b*24|0)|0,gt=E,E=h[Be>>2]|0,je=M,M=h[Be+4>>2]|0,x=At(x|0,v|0,((E|0)!=(gt|0)|(M|0)!=(je|0))&1|0,0)|0,v=ee()|0,b=At(b|0,N|0,1,0)|0,N=ee()|0;while((N|0)<(Ke|0)|(N|0)==(Ke|0)&b>>>0<Me>>>0);ue=x,ae=v}else ue=0,ae=0;if(p=br(ue*24|0)|0,p){n:do if((Ke|0)>=0){for(j=0,X=0,x=0,b=0,K=0,E=0;;){if(!((j|0)==(Me|0)&(X|0)==(Ke|0))&&(gt=be+(x*24|0)|0,je=be+(j*24|0)|0,(h[gt>>2]|0)==(h[je>>2]|0)?(h[gt+4>>2]|0)==(h[je+4>>2]|0):0))v=K;else{if(U=be+(x*24|0)|0,je=Js(j|0,X|0,x|0,b|0)|0,gt=ee()|0,q=At(je|0,gt|0,-1,-1)|0,b=ee()|0,(gt|0)>0|(gt|0)==0&je>>>0>1){if(v=br(q<<3)|0,!v)break;M=0,N=0;do je=M,M=At(M|0,N|0,1,0)|0,N=ee()|0,Be=U+(M*24|0)+16|0,gt=h[Be+4>>2]|0,je=v+(je<<3)|0,h[je>>2]=h[Be>>2],h[je+4>>2]=gt;while((N|0)<(b|0)|(N|0)==(b|0)&M>>>0<q>>>0)}else v=0;gt=be+(x*24|0)+16|0,je=h[gt+4>>2]|0,b=p+(E*24|0)+8|0,h[b>>2]=h[gt>>2],h[b+4>>2]=je,h[p+(E*24|0)+16>>2]=q,h[p+(E*24|0)+20>>2]=v,ie[p+(E*24|0)>>3]=+ie[be+(x*24|0)+8>>3],E=At(E|0,K|0,1,0)|0,x=j,b=X,v=ee()|0}if(je=j,j=At(j|0,X|0,1,0)|0,gt=X,X=ee()|0,(gt|0)<(Ke|0)|(gt|0)==(Ke|0)&je>>>0<Me>>>0)K=v;else break n}if((K|0)>0|(K|0)==0&E>>>0>0){v=0,b=0;do x=h[p+(v*24|0)+20>>2]|0,x|0&&_t(x),v=At(v|0,b|0,1,0)|0,b=ee()|0;while((b|0)<(K|0)|(b|0)==(K|0)&v>>>0<E>>>0)}_t(p),je=152;break t}while(!1);if(uT(p,ue,24,3),v=br(ue<<4)|0,b=_+4|0,h[b>>2]=v,v){h[_>>2]=ue;do if((ae|0)>0|(ae|0)==0&ue>>>0>0){if(_=p+8|0,h[v>>2]=h[_>>2],h[v+4>>2]=h[_+4>>2],h[v+8>>2]=h[_+8>>2],h[v+12>>2]=h[_+12>>2],(ue|0)==1&(ae|0)==0||(_=v+16|0,je=p+32|0,h[_>>2]=h[je>>2],h[_+4>>2]=h[je+4>>2],h[_+8>>2]=h[je+8>>2],h[_+12>>2]=h[je+12>>2],!((ae|0)>0|(ae|0)==0&ue>>>0>2)))break;v=2,x=0;do _=(h[b>>2]|0)+(v<<4)|0,je=p+(v*24|0)+8|0,h[_>>2]=h[je>>2],h[_+4>>2]=h[je+4>>2],h[_+8>>2]=h[je+8>>2],h[_+12>>2]=h[je+12>>2],v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(ae|0)|(x|0)==(ae|0)&v>>>0<ue>>>0)}while(!1);_t(p),je=158;break}else{if((ae|0)>0|(ae|0)==0&ue>>>0>0){v=0,b=0;do x=h[p+(v*24|0)+20>>2]|0,x|0&&_t(x),v=At(v|0,b|0,1,0)|0,b=ee()|0;while((b|0)<(ae|0)|(b|0)==(ae|0)&v>>>0<ue>>>0)}_t(p),je=152;break}}else je=152}while(!1);if((je|0)==158)return _t(Ut),_t(lt),_t(be),lt=0,Q=pt,lt|0;if((je|0)==152&&(Ke|0)>0|(Ke|0)==0&Me>>>0>0)for(E=0,M=0,v=Me,b=Ke;x=h[be+(E*24|0)+20>>2]|0,x?(_t(x),x=Ke,v=Me):x=b,E=At(E|0,M|0,1,0)|0,M=ee()|0,(M|0)<(x|0)|(M|0)==(x|0)&E>>>0<v>>>0;)b=x;return _t(be),_t(Ut),_t(lt),lt=13,Q=pt,lt|0}while(!1);return _t(Ut),_t(lt),lt=13,Q=pt,lt|0}else if((je|0)==159)return Q=pt,v|0;return 0}function Qce(p,m){p=p|0,m=m|0;var g=0,_=0;return _=p,p=h[_>>2]|0,_=h[_+4>>2]|0,g=m,m=h[g>>2]|0,g=h[g+4>>2]|0,(_>>>0<g>>>0|(_|0)==(g|0)&p>>>0<m>>>0?-1:(_>>>0>g>>>0|(_|0)==(g|0)&p>>>0>m>>>0)&1)|0}function sT(p){p=p|0;var m=0,g=0;return m=p+20|0,g=h[m>>2]|0,(g|0)==(p|0)?p|0:(g=sT(g)|0,h[m>>2]=g,g|0)}function Jce(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0;return E=p,b=h[E>>2]|0,E=h[E+4>>2]|0,x=m,v=h[x>>2]|0,x=h[x+4>>2]|0,E>>>0<x>>>0|(E|0)==(x|0)&b>>>0<v>>>0?(m=-1,m|0):E>>>0>x>>>0|(E|0)==(x|0)&b>>>0>v>>>0?(m=1,m|0):(_=+ie[p+8>>3],g=+ie[m+8>>3],_<g?(m=-1,m|0):(m=_>g&1,m|0))}function eue(p,m){p=p|0,m=m|0;var g=0,_=0;return _=+ie[p>>3],g=+ie[m>>3],(_>g?-1:_<g&1)|0}function tue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0;if(q=Q,Q=Q+64|0,U=q,E=q+56|0,!(!0&(m&2013265920|0)==134217728&(!0&(_&2013265920|0)==134217728)))return v=5,Q=q,v|0;if((p|0)==(g|0)&(m|0)==(_|0))return h[v>>2]=0,v=0,Q=q,v|0;if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,N=tt(g|0,_|0,52)|0,ee()|0,(b|0)!=(N&15|0))return v=12,Q=q,v|0;if(x=b+-1|0,b>>>0>1){hL(p,m,x,U)|0,hL(g,_,x,E)|0,N=U,M=h[N>>2]|0,N=h[N+4>>2]|0;e:do if((M|0)==(h[E>>2]|0)&&(N|0)==(h[E+4>>2]|0)){b=(b^15)*3|0,x=tt(p|0,m|0,b|0)|0,ee()|0,x=x&7,b=tt(g|0,_|0,b|0)|0,ee()|0,b=b&7;do if((x|0)==0|(b|0)==0)h[v>>2]=1,x=0;else if((x|0)==7)x=5;else{if((x|0)==1|(b|0)==1&&Zi(M,N)|0){x=5;break}if((h[15824+(x<<2)>>2]|0)!=(b|0)&&(h[15856+(x<<2)>>2]|0)!=(b|0))break e;h[v>>2]=1,x=0}while(!1);return v=x,Q=q,v|0}while(!1)}x=U,b=x+56|0;do h[x>>2]=0,x=x+4|0;while((x|0)<(b|0));return KG(p,m,1,U)|0,m=U,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0))&&(m=U+8|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=U+16|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=U+24|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=U+32|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=U+40|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))?(x=U+48|0,x=((h[x>>2]|0)==(g|0)?(h[x+4>>2]|0)==(_|0):0)&1):x=1,h[v>>2]=x,v=0,Q=q,v|0}function nue(p,m,g,_,v){return p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,g=rT(p,m,g,_)|0,(g|0)==7?(v=11,v|0):(_=ft(g|0,0,56)|0,m=m&-2130706433|(ee()|0)|268435456,h[v>>2]=p|_,h[v+4>>2]=m,v=0,v|0)}function iue(p,m,g){return p=p|0,m=m|0,g=g|0,!0&(m&2013265920|0)==268435456?(h[g>>2]=p,h[g+4>>2]=m&-2130706433|134217728,g=0,g|0):(g=6,g|0)}function rue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;return v=Q,Q=Q+16|0,_=v,h[_>>2]=0,!0&(m&2013265920|0)==268435456?(x=tt(p|0,m|0,56)|0,ee()|0,_=Qs(p,m&-2130706433|134217728,x&7,_,g)|0,Q=v,_|0):(_=6,Q=v,_|0)}function lq(p,m){p=p|0,m=m|0;var g=0;switch(g=tt(p|0,m|0,56)|0,ee()|0,g&7){case 0:case 7:return g=0,g|0;default:}return g=m&-2130706433|134217728,!(!0&(m&2013265920|0)==268435456)||!0&(m&117440512|0)==16777216&(Zi(p,g)|0)!=0?(g=0,g|0):(g=oT(p,g)|0,g|0)}function sue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return v=Q,Q=Q+16|0,_=v,!0&(m&2013265920|0)==268435456?(x=m&-2130706433|134217728,b=g,h[b>>2]=p,h[b+4>>2]=x,h[_>>2]=0,m=tt(p|0,m|0,56)|0,ee()|0,_=Qs(p,x,m&7,_,g+8|0)|0,Q=v,_|0):(_=6,Q=v,_|0)}function oL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0;return v=(Zi(p,m)|0)==0,m=m&-2130706433,_=g,h[_>>2]=v?p:0,h[_+4>>2]=v?m|285212672:0,_=g+8|0,h[_>>2]=p,h[_+4>>2]=m|301989888,_=g+16|0,h[_>>2]=p,h[_+4>>2]=m|318767104,_=g+24|0,h[_>>2]=p,h[_+4>>2]=m|335544320,_=g+32|0,h[_>>2]=p,h[_+4>>2]=m|352321536,g=g+40|0,h[g>>2]=p,h[g+4>>2]=m|369098752,0}function Hx(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+16|0,v=b,x=m&-2130706433|134217728,!0&(m&2013265920|0)==268435456?(_=tt(p|0,m|0,56)|0,ee()|0,_=Yue(p,x,_&7)|0,(_|0)==-1?(h[g>>2]=0,x=6,Q=b,x|0):(b1(p,x,v)|0&&di(27634,27035,282,27050),m=tt(p|0,m|0,52)|0,ee()|0,m=m&15,Zi(p,x)|0?aL(v,m,_,2,g):lL(v,m,_,2,g),x=0,Q=b,x|0)):(x=6,Q=b,x|0)}function cq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+16|0,_=b+8|0,v=b,x=m&-2130706433|134217728,!0&(m&2013265920|0)==268435456?(h[_>>2]=0,m=tt(p|0,m|0,56)|0,ee()|0,m=Qs(p,x,m&7,_,v)|0,m|0?(g=m,Q=b,g|0):(_=h[v>>2]|0,v=h[v+4>>2]|0,m=rT(_,v,p,x)|0,(m|0)==7?(g=11,Q=b,g|0):(p=ft(m|0,0,56)|0,x=v&-2130706433|(ee()|0)|268435456,h[g>>2]=_|p,h[g+4>>2]=x,g=0,Q=b,g|0))):(g=6,Q=b,g|0)}function oue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0;h[g>>2]=0,N=+ie[p>>3],U=+ie[p+8>>3],M=+ie[p+16>>3],v=0,x=5,_=5,p=0;do ae=+ie[15888+(v*24|0)>>3]-N,K=+ie[15888+(v*24|0)+8>>3]-U,b=+ie[15888+(v*24|0)+16>>3]-M,b=ae*ae+K*K+b*b,b<_&&(h[g>>2]=v,x=b,p=v,_=b),v=v+1|0;while((v|0)!=20);if(x=+_ce(+(1-x*.5)),x<1e-16)M=0,b=0;else{if(Ae=+ie[16368+(p*24|0)>>3],se=+ie[15888+(p*24|0)>>3],we=+ie[15888+(p*24|0)+8>>3],xe=+ie[15888+(p*24|0)+16>>3],Be=-(xe+(se*0+we*0)),b=se*Be+0,ae=we*Be+0,Be=xe*Be+1,ue=+bs(+(Be*Be+(b*b+ae*ae))),ue=ue>0?1/ue:0,b=b*ue,ae=ae*ue,ue=Be*ue,Be=-(N*se+U*we+M*xe),K=N+se*Be,_=U+we*Be,N=M+xe*Be,U=+bs(+(N*N+(K*K+_*_))),U=U>0?1/U:0,K=K*U,_=_*U,U=N*U,_=+Xx(Ae-+Xx(+Ta(+(U*(we*b-se*ae)+(K*(xe*ae-we*ue)+_*(se*ue-xe*b))),+(ue*U+(b*K+ae*_))))),_c(m)|0?b=+Xx(_+-.3334731722518321):b=_,_=+iT(+x)*2.618033988749896,(m|0)>0){p=0;do _=_*2.6457513110645907,p=p+1|0;while((p|0)!=(m|0))}M=+ii(+b)*_,b=+zi(+b)*_}m=g+4|0,X=g+12|0,h[X>>2]=0,x=+Ks(+b)*1.1547005383792515,_=+Ks(+M)+x*.5,p=~~_,v=~~x,_=_-+(p|0),x=x-+(v|0);do if(_<.5)if(_<.3333333333333333)if(h[m>>2]=p,x<(_+1)*.5){h[g+8>>2]=v;break}else{v=v+1|0,h[g+8>>2]=v;break}else if(Be=1-_,v=(!(x<Be)&1)+v|0,h[g+8>>2]=v,Be<=x&x<_*2){p=p+1|0,h[m>>2]=p;break}else{h[m>>2]=p;break}else{if(!(_<.6666666666666666))if(p=p+1|0,h[m>>2]=p,x<_*.5){h[g+8>>2]=v;break}else{v=v+1|0,h[g+8>>2]=v;break}if(x<1-_){if(h[g+8>>2]=v,_*2+-1<x){h[m>>2]=p;break}}else v=v+1|0,h[g+8>>2]=v;p=p+1|0,h[m>>2]=p}while(!1);do if(M<0)if(v&1){j=(v+1|0)/2|0,j=Js(p|0,((p|0)<0)<<31>>31|0,j|0,((j|0)<0)<<31>>31|0)|0,p=~~(+(p|0)-((+(j>>>0)+4294967296*+(ee()|0))*2+1)),h[m>>2]=p,j=m;break}else{j=(v|0)/2|0,j=Js(p|0,((p|0)<0)<<31>>31|0,j|0,((j|0)<0)<<31>>31|0)|0,p=~~(+(p|0)-(+(j>>>0)+4294967296*+(ee()|0))*2),h[m>>2]=p,j=m;break}else j=m;while(!1);q=g+8|0,m=0-v|0,b<0?(g=p-((v<<1|1|0)/2|0)|0,h[j>>2]=g,h[q>>2]=m,v=m):g=p,p=v-g|0,m=0-g|0,(g|0)<0?(h[q>>2]=p,h[X>>2]=m,h[j>>2]=0,E=0):(p=v,E=g,m=0),g=E-p|0,v=m-p|0,(p|0)<0?(h[j>>2]=g,h[X>>2]=v,h[q>>2]=0,E=g,p=0):v=m,g=E-v|0,m=p-v|0,(v|0)<0?(h[j>>2]=g,h[q>>2]=m,h[X>>2]=0,v=0):(m=p,g=E),p=(m|0)<(g|0)?m:g,p=(v|0)<(p|0)?v:p,!((p|0)<=0)&&(h[j>>2]=g-p,h[q>>2]=m-p,h[X>>2]=v-p)}function aue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;_=Q,Q=Q+16|0,v=_,b=h[p+12>>2]|0,x=+((h[p+8>>2]|0)-b|0),ie[v>>3]=+((h[p+4>>2]|0)-b|0)-x*.5,ie[v+8>>3]=x*.8660254037844386,Wx(v,h[p>>2]|0,m,0,g),Q=_}function Wx(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0;if(x=+$ue(p),x<1e-16){m=15888+(m*24|0)|0,h[v>>2]=h[m>>2],h[v+4>>2]=h[m+4>>2],h[v+8>>2]=h[m+8>>2],h[v+12>>2]=h[m+12>>2],h[v+16>>2]=h[m+16>>2],h[v+20>>2]=h[m+20>>2];return}if(b=+Ta(+ +ie[p+8>>3],+ +ie[p>>3]),(g|0)>0){p=0;do x=x*.37796447300922725,p=p+1|0;while((p|0)!=(g|0))}E=x*.3333333333333333,_?(g=(_c(g)|0)==0,x=+YG(+((g?E:E*.37796447300922725)*.381966011250105))):(x=+YG(+(x*.381966011250105)),_c(g)|0&&(b=+Xx(b+.3334731722518321))),q=+Xx(+ie[16368+(m*24|0)>>3]-b),E=+ie[15888+(m*24|0)>>3],U=+ie[15888+(m*24|0)+8>>3],ae=+ie[15888+(m*24|0)+16>>3],X=-(ae+(E*0+U*0)),N=E*X+0,b=U*X+0,X=ae*X+1,j=+bs(+(X*X+(N*N+b*b))),j=j>0?1/j:0,N=N*j,b=b*j,j=X*j,X=+ii(+q),q=+zi(+q),ue=+ii(+x),K=+zi(+x),M=ue*E+K*(X*N+q*(ae*b-U*j)),x=ue*U+K*(X*b+q*(E*j-ae*N)),b=ue*ae+K*(X*j+q*(U*N-E*b)),E=+bs(+(b*b+(M*M+x*x))),E=E>0?1/E:0,ie[v>>3]=M*E,ie[v+8>>3]=x*E,ie[v+16>>3]=b*E}function aL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0,Ma=0,Ns=0,as=0,Fs=0,ws=0,cl=0,po=0,mo=0,yc=0,Po=0,Ii=0,Vm=0;if(cl=Q,Q=Q+256|0,x=cl+240|0,pi=cl+224|0,as=cl,Fs=cl+208|0,ws=cl+192|0,bi=cl+168|0,Ro=cl+152|0,Vn=cl+136|0,wi=cl+120|0,Ma=cl+104|0,Ns=cl+80|0,h[x>>2]=m,h[pi>>2]=h[p>>2],h[pi+4>>2]=h[p+4>>2],h[pi+8>>2]=h[p+8>>2],h[pi+12>>2]=h[p+12>>2],uq(pi,x,as),h[v>>2]=0,pi=_+g+((_|0)==5&1)|0,(pi|0)<=(g|0)){Q=cl;return}Ae=h[x>>2]|0,we=Fs+4|0,xe=Fs+8|0,se=Fs+12|0,Be=ws+8|0,Ke=g+5|0,Me=16848+(Ae<<2)|0,be=bi+8|0,gt=16928+(Ae<<2)|0,je=Ro+8|0,Ut=Vn+8|0,lt=wi+8|0,pt=ws+8|0,X=bi+8|0,ae=bi+16|0,K=Ns+8|0,ue=Ns+16|0,j=g,_=0,b=0,E=0,M=0;e:for(;;){q=as+(((j|0)%5|0)<<4)|0,h[Fs>>2]=h[q>>2],h[Fs+4>>2]=h[q+4>>2],h[Fs+8>>2]=h[q+8>>2],h[Fs+12>>2]=h[q+12>>2];do;while((y1(Fs,Ae,0,1)|0)==2);if((j|0)>(g|0)&(_c(m)|0)!=0){if(q=h[Fs>>2]|0,p=h[we>>2]|0,N=h[xe>>2]|0,x=h[se>>2]|0,po=+(E-M|0),ie[ws>>3]=+(b-M|0)-po*.5,ie[Be>>3]=po*.8660254037844386,M=h[17008+(q*80|0)+(_<<2)>>2]|0,U=h[18608+(q*80|0)+(M*20|0)>>2]|0,E=h[18608+(q*80|0)+(M*20|0)+16>>2]|0,(E|0)>0){b=0,_=N;do Po=x+p|0,Ii=(Po|0)<0,N=_+p-(Ii?Po:0)|0,yc=(N|0)<0,mo=x+_-(Ii?Po:0)-(yc?N:0)|0,x=(mo|0)<0,p=(Ii?0:Po)-(yc?N:0)-(x?mo:0)|0,_=(yc?0:N)-(x?mo:0)|0,mo=x?0:mo,x=(_|0)<(p|0)?_:p,x=(mo|0)<(x|0)?mo:x,N=(x|0)>0,p=p-(N?x:0)|0,_=_-(N?x:0)|0,x=mo-(N?x:0)|0,b=b+1|0;while((b|0)<(E|0))}else _=N;switch(Ii=(h[Me>>2]|0)*3|0,mo=(al(Ii,h[18608+(q*80|0)+(M*20|0)+4>>2]|0)|0)+p|0,N=(al(Ii,h[18608+(q*80|0)+(M*20|0)+8>>2]|0)|0)+_|0,Ii=(al(Ii,h[18608+(q*80|0)+(M*20|0)+12>>2]|0)|0)+x|0,M=(mo|0)<0,N=N-(M?mo:0)|0,yc=(N|0)<0,Ii=Ii+(M?0-mo|0:0)+(yc?0-N|0:0)|0,Po=(Ii|0)<0,mo=(M?0:mo)-(yc?N:0)-(Po?Ii:0)|0,N=(yc?0:N)-(Po?Ii:0)|0,Ii=Po?0:Ii,Po=(N|0)<(mo|0)?N:mo,Po=(Ii|0)<(Po|0)?Ii:Po,yc=(Po|0)>0,Ii=Ii-(yc?Po:0)|0,po=+(N-(yc?Po:0)-Ii|0),ie[bi>>3]=+(mo-(yc?Po:0)-Ii|0)-po*.5,ie[be>>3]=po*.8660254037844386,po=+(h[gt>>2]|0),ie[Ro>>3]=po*3,ie[je>>3]=0,Vm=po*-1.5,ie[Vn>>3]=Vm,ie[Ut>>3]=po*2.598076211353316,ie[wi>>3]=Vm,ie[lt>>3]=po*-2.598076211353316,h[17008+(U*80|0)+(q<<2)>>2]|0){case 1:{p=Vn,_=Ro;break}case 3:{p=wi,_=Vn;break}case 2:{p=Ro,_=wi;break}default:{p=12;break e}}Sq(ws,bi,_,p,Ma),Wx(Ma,U,Ae,1,Ns),Ii=h[v>>2]|0,po=+qx(+ +ie[ue>>3]),Vm=+Ta(+ +ie[K>>3],+ +ie[Ns>>3]),ie[v+8+(Ii<<4)>>3]=po,ie[v+8+(Ii<<4)+8>>3]=Vm,h[v>>2]=(h[v>>2]|0)+1}if((j|0)<(Ke|0)&&(Ii=h[se>>2]|0,po=+((h[xe>>2]|0)-Ii|0),ie[ws>>3]=+((h[we>>2]|0)-Ii|0)-po*.5,ie[pt>>3]=po*.8660254037844386,Wx(ws,h[Fs>>2]|0,Ae,1,bi),Ii=h[v>>2]|0,po=+qx(+ +ie[ae>>3]),Vm=+Ta(+ +ie[X>>3],+ +ie[bi>>3]),ie[v+8+(Ii<<4)>>3]=po,ie[v+8+(Ii<<4)+8>>3]=Vm,h[v>>2]=(h[v>>2]|0)+1),j=j+1|0,(j|0)>=(pi|0)){p=3;break}else _=h[Fs>>2]|0,b=h[we>>2]|0,E=h[xe>>2]|0,M=h[se>>2]|0}if((p|0)==3){Q=cl;return}else(p|0)==12&&di(27073,27120,599,27130)}function uq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;K=Q,Q=Q+128|0,_=K+64|0,v=K,x=_,b=20208,E=x+60|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));x=v,b=20272,E=x+60|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));if(U=(_c(h[m>>2]|0)|0)==0,U=U?_:v,X=p+4|0,x=h[X>>2]|0,q=p+8|0,_=h[q>>2]|0,j=p+12|0,v=h[j>>2]|0,b=_+(x<<1)|0,h[X>>2]=b,_=v+(_<<1)|0,h[q>>2]=_,x=(v<<1)+x|0,h[j>>2]=x,v=_-b|0,E=x-b|0,(b|0)<0&&(h[q>>2]=v,h[j>>2]=E,h[X>>2]=0,_=v,b=0,x=E),E=b-_|0,v=x-_|0,(_|0)<0?(h[X>>2]=E,h[j>>2]=v,h[q>>2]=0,_=0):(v=x,E=b),b=E-v|0,x=_-v|0,(v|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(v=v-_|0,x=x-_|0,b=b-_|0,h[X>>2]=b,h[q>>2]=x,h[j>>2]=v),M=(x<<1)+b|0,E=v+(b<<1)|0,h[X>>2]=E,h[q>>2]=M,x=(v<<1)+x|0,h[j>>2]=x,_=M-E|0,v=x-E|0,(E|0)<0?(h[q>>2]=_,h[j>>2]=v,h[X>>2]=0,E=0,x=v):_=M,b=E-_|0,v=x-_|0,(_|0)<0?(h[X>>2]=b,h[j>>2]=v,h[q>>2]=0,E=b,_=0):v=x,b=E-v|0,x=_-v|0,(v|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[X>>2]=b-_,h[q>>2]=x-_,h[j>>2]=v-_),_c(h[m>>2]|0)|0&&(x=h[X>>2]|0,b=h[q>>2]|0,v=h[j>>2]|0,_=(b*3|0)+x|0,x=v+(x*3|0)|0,h[X>>2]=x,h[q>>2]=_,b=(v*3|0)+b|0,h[j>>2]=b,v=_-x|0,E=b-x|0,(x|0)<0?(h[q>>2]=v,h[j>>2]=E,h[X>>2]=0,_=v,M=0):(M=x,E=b),x=M-_|0,v=E-_|0,(_|0)<0?(h[X>>2]=x,h[j>>2]=v,h[q>>2]=0,M=x,b=0):(b=_,v=E),x=M-v|0,_=b-v|0,(v|0)<0?(h[X>>2]=x,h[q>>2]=_,h[j>>2]=0,b=_,v=0):x=M,_=(b|0)<(x|0)?b:x,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[X>>2]=x-_,h[q>>2]=b-_,h[j>>2]=v-_),h[m>>2]=(h[m>>2]|0)+1),h[g>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[U+4>>2]|0,N=h[U+8>>2]|0,b=(h[U>>2]|0)+(h[X>>2]|0)|0,M=g+4|0,h[M>>2]=b,v=m+v|0,m=g+8|0,h[m>>2]=v,_=N+_|0,N=g+12|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+16>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[U+16>>2]|0,N=h[U+20>>2]|0,b=(h[U+12>>2]|0)+(h[X>>2]|0)|0,M=g+20|0,h[M>>2]=b,v=m+v|0,m=g+24|0,h[m>>2]=v,_=N+_|0,N=g+28|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+32>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[U+28>>2]|0,N=h[U+32>>2]|0,b=(h[U+24>>2]|0)+(h[X>>2]|0)|0,M=g+36|0,h[M>>2]=b,v=m+v|0,m=g+40|0,h[m>>2]=v,_=N+_|0,N=g+44|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+48>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[U+40>>2]|0,N=h[U+44>>2]|0,b=(h[U+36>>2]|0)+(h[X>>2]|0)|0,M=g+52|0,h[M>>2]=b,v=m+v|0,m=g+56|0,h[m>>2]=v,_=N+_|0,N=g+60|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+64>>2]=h[p>>2],x=h[q>>2]|0,_=h[j>>2]|0,N=h[U+52>>2]|0,M=h[U+56>>2]|0,b=(h[U+48>>2]|0)+(h[X>>2]|0)|0,m=g+68|0,h[m>>2]=b,x=N+x|0,N=g+72|0,h[N>>2]=x,_=M+_|0,M=g+76|0,h[M>>2]=_,v=x-b|0,(b|0)<0?(_=_-b|0,h[N>>2]=v,h[M>>2]=_,h[m>>2]=0,x=0):(v=x,x=b),(v|0)<0&&(x=x-v|0,h[m>>2]=x,_=_-v|0,h[M>>2]=_,h[N>>2]=0,v=0),E=x-_|0,b=v-_|0,(_|0)<0?(h[m>>2]=E,h[N>>2]=b,h[M>>2]=0,x=E,_=0):b=v,v=(b|0)<(x|0)?b:x,v=(_|0)<(v|0)?_:v,(v|0)<=0){Q=K;return}h[m>>2]=x-v,h[N>>2]=b-v,h[M>>2]=_-v,Q=K}function y1(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0;if(j=h[16928+(m<<2)>>2]|0,q=(_|0)!=0,j=q?j*3|0:j,U=p+4|0,E=h[U>>2]|0,N=p+8|0,x=h[N>>2]|0,q){if(b=p+12|0,_=h[b>>2]|0,v=x+E+_|0,(v|0)==(j|0))return j=1,j|0;M=b}else M=p+12|0,v=h[M>>2]|0,_=v,v=x+E+v|0;if((v|0)<=(j|0))return j=0,j|0;do if((_|0)>0){if(v=h[p>>2]|0,(x|0)>0){v=18608+(v*80|0)+60|0,b=E;break}v=18608+(v*80|0)+40|0,g?(b=E-j|0,g=x+b|0,X=(g|0)<0,x=_+x-(X?g:0)|0,E=(x|0)<0,_=_+b-(X?g:0)-(E?x:0)|0,b=(_|0)<0,g=(X?0:g)-(E?x:0)-(b?_:0)|0,x=(E?0:x)-(b?_:0)|0,_=b?0:_,b=(x|0)<(g|0)?x:g,b=(_|0)<(b|0)?_:b,E=(b|0)>0,x=x-(E?b:0)|0,_=_-(E?b:0)|0,b=g-(E?b:0)+j|0,h[U>>2]=b,h[N>>2]=x,h[M>>2]=_):b=E}else v=18608+((h[p>>2]|0)*80|0)+20|0,b=E;while(!1);if(h[p>>2]=h[v>>2],E=h[v+16>>2]|0,(E|0)>0){g=0;do X=_+b|0,K=(X|0)<0,xe=K?X:0,ae=x+b-xe|0,ue=(ae|0)<0,p=ue?ae:0,b=_+x-xe-p|0,x=(b|0)<0,_=x?0:b,b=x?b:0,x=(ue?0:ae)-b|0,b=(K?0:X)-p-b|0,p=(x|0)<(b|0)?x:b,p=(_|0)<(p|0)?_:p,(p|0)>0&&(b=b-p|0,x=x-p|0,_=_-p|0),g=g+1|0;while((g|0)<(E|0));h[U>>2]=b,h[N>>2]=x,h[M>>2]=_}return ae=h[16848+(m<<2)>>2]|0,ae=q?ae*3|0:ae,ue=al(ae,h[v+8>>2]|0)|0,xe=al(ae,h[v+12>>2]|0)|0,b=(al(ae,h[v+4>>2]|0)|0)+b|0,h[U>>2]=b,x=ue+x|0,h[N>>2]=x,_=xe+_|0,h[M>>2]=_,v=x-b|0,(b|0)<0?(_=_-b|0,h[N>>2]=v,h[M>>2]=_,h[U>>2]=0,x=0):(v=x,x=b),(v|0)<0?(p=x-v|0,h[U>>2]=p,_=_-v|0,h[M>>2]=_,h[N>>2]=0,b=0):(p=x,b=v),x=p-_|0,v=b-_|0,(_|0)<0?(h[U>>2]=x,h[N>>2]=v,h[M>>2]=0,_=0):(v=b,x=p),b=(v|0)<(x|0)?v:x,b=(_|0)<(b|0)?_:b,(b|0)>0&&(x=x-b|0,v=v-b|0,_=_-b|0,h[U>>2]=x,h[N>>2]=v,h[M>>2]=_),q?(xe=(v+x+_|0)==(j|0)?1:2,xe|0):(xe=2,xe|0)}function lue(p,m){p=p|0,m=m|0;var g=0;do g=y1(p,m,0,1)|0;while((g|0)==2);return g|0}function lL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0,Ma=0,Ns=0,as=0,Fs=0,ws=0;if(Ns=Q,Q=Q+272|0,x=Ns+256|0,b=Ns+240|0,Vn=Ns,wi=Ns+224|0,Ma=Ns+208|0,je=Ns+184|0,Ut=Ns+168|0,lt=Ns+152|0,pt=Ns+136|0,pi=Ns+120|0,bi=Ns+96|0,h[x>>2]=m,h[b>>2]=h[p>>2],h[b+4>>2]=h[p+4>>2],h[b+8>>2]=h[p+8>>2],h[b+12>>2]=h[p+12>>2],hq(b,x,Vn),h[v>>2]=0,gt=_+g+((_|0)==6&1)|0,(gt|0)<=(g|0)){Q=Ns;return}xe=h[x>>2]|0,se=g+6|0,we=Ma+8|0,Ae=je+8|0,Be=16928+(xe<<2)|0,Ke=Ut+8|0,Me=lt+8|0,be=pt+8|0,ae=h[b>>2]|0,j=wi+4|0,X=wi+8|0,K=wi+12|0,ue=Ma+8|0,M=je+8|0,U=je+16|0,N=bi+8|0,q=bi+16|0,b=0,E=g,_=-1;e:for(;;){if(x=(E|0)%6|0,p=Vn+(x<<4)|0,h[wi>>2]=h[p>>2],h[wi+4>>2]=h[p+4>>2],h[wi+8>>2]=h[p+8>>2],h[wi+12>>2]=h[p+12>>2],p=b,b=y1(wi,xe,0,1)|0,(E|0)>(g|0)&(_c(m)|0)!=0&&(Ro=h[wi>>2]|0,(p|0)!=1&(Ro|0)!=(_|0))){switch(ws=(x+5|0)%6|0,p=h[Vn+(ws<<4)+12>>2]|0,as=+((h[Vn+(ws<<4)+8>>2]|0)-p|0),ie[Ma>>3]=+((h[Vn+(ws<<4)+4>>2]|0)-p|0)-as*.5,ie[we>>3]=as*.8660254037844386,p=h[Vn+(x<<4)+12>>2]|0,as=+((h[Vn+(x<<4)+8>>2]|0)-p|0),ie[je>>3]=+((h[Vn+(x<<4)+4>>2]|0)-p|0)-as*.5,ie[Ae>>3]=as*.8660254037844386,as=+(h[Be>>2]|0),ie[Ut>>3]=as*3,ie[Ke>>3]=0,Fs=as*-1.5,ie[lt>>3]=Fs,ie[Me>>3]=as*2.598076211353316,ie[pt>>3]=Fs,ie[be>>3]=as*-2.598076211353316,h[17008+(ae*80|0)+(((_|0)==(ae|0)?Ro:_)<<2)>>2]|0){case 1:{p=lt,_=Ut;break}case 3:{p=pt,_=lt;break}case 2:{p=Ut,_=pt;break}default:{p=8;break e}}Sq(Ma,je,_,p,pi),!(Tq(Ma,pi)|0)&&!(Tq(je,pi)|0)&&(Wx(pi,ae,xe,1,bi),ws=h[v>>2]|0,as=+qx(+ +ie[q>>3]),Fs=+Ta(+ +ie[N>>3],+ +ie[bi>>3]),ie[v+8+(ws<<4)>>3]=as,ie[v+8+(ws<<4)+8>>3]=Fs,h[v>>2]=(h[v>>2]|0)+1)}if((E|0)<(se|0)&&(ws=h[K>>2]|0,as=+((h[X>>2]|0)-ws|0),ie[Ma>>3]=+((h[j>>2]|0)-ws|0)-as*.5,ie[ue>>3]=as*.8660254037844386,Wx(Ma,h[wi>>2]|0,xe,1,je),ws=h[v>>2]|0,as=+qx(+ +ie[U>>3]),Fs=+Ta(+ +ie[M>>3],+ +ie[je>>3]),ie[v+8+(ws<<4)>>3]=as,ie[v+8+(ws<<4)+8>>3]=Fs,h[v>>2]=(h[v>>2]|0)+1),E=E+1|0,(E|0)>=(gt|0)){p=3;break}else _=h[wi>>2]|0}if((p|0)==3){Q=Ns;return}else(p|0)==8&&di(27157,27120,766,27202)}function hq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0;ae=Q,Q=Q+160|0,_=ae+80|0,v=ae,x=_,b=20336,E=x+72|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));x=v,b=20416,E=x+72|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));q=(_c(h[m>>2]|0)|0)==0,q=q?_:v,K=p+4|0,x=h[K>>2]|0,j=p+8|0,_=h[j>>2]|0,X=p+12|0,v=h[X>>2]|0,b=_+(x<<1)|0,h[K>>2]=b,_=v+(_<<1)|0,h[j>>2]=_,x=(v<<1)+x|0,h[X>>2]=x,v=_-b|0,E=x-b|0,(b|0)<0&&(h[j>>2]=v,h[X>>2]=E,h[K>>2]=0,_=v,b=0,x=E),E=b-_|0,v=x-_|0,(_|0)<0?(h[K>>2]=E,h[X>>2]=v,h[j>>2]=0,_=0):(v=x,E=b),b=E-v|0,x=_-v|0,(v|0)<0?(h[K>>2]=b,h[j>>2]=x,h[X>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(v=v-_|0,x=x-_|0,b=b-_|0,h[K>>2]=b,h[j>>2]=x,h[X>>2]=v),M=(x<<1)+b|0,E=v+(b<<1)|0,h[K>>2]=E,h[j>>2]=M,x=(v<<1)+x|0,h[X>>2]=x,_=M-E|0,v=x-E|0,(E|0)<0?(h[j>>2]=_,h[X>>2]=v,h[K>>2]=0,E=0,x=v):_=M,b=E-_|0,v=x-_|0,(_|0)<0?(h[K>>2]=b,h[X>>2]=v,h[j>>2]=0,E=b,_=0):v=x,b=E-v|0,x=_-v|0,(v|0)<0?(h[K>>2]=b,h[j>>2]=x,h[X>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[K>>2]=b-_,h[j>>2]=x-_,h[X>>2]=v-_),_c(h[m>>2]|0)|0&&(x=h[K>>2]|0,b=h[j>>2]|0,v=h[X>>2]|0,_=(b*3|0)+x|0,x=v+(x*3|0)|0,h[K>>2]=x,h[j>>2]=_,b=(v*3|0)+b|0,h[X>>2]=b,v=_-x|0,E=b-x|0,(x|0)<0?(h[j>>2]=v,h[X>>2]=E,h[K>>2]=0,_=v,M=0):(M=x,E=b),x=M-_|0,v=E-_|0,(_|0)<0?(h[K>>2]=x,h[X>>2]=v,h[j>>2]=0,M=x,b=0):(b=_,v=E),x=M-v|0,_=b-v|0,(v|0)<0?(h[K>>2]=x,h[j>>2]=_,h[X>>2]=0,b=_,v=0):x=M,_=(b|0)<(x|0)?b:x,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[K>>2]=x-_,h[j>>2]=b-_,h[X>>2]=v-_),h[m>>2]=(h[m>>2]|0)+1),M=0;do h[g+(M<<4)>>2]=h[p>>2],v=h[j>>2]|0,_=h[X>>2]|0,N=h[q+(M*12|0)+4>>2]|0,U=h[q+(M*12|0)+8>>2]|0,b=(h[q+(M*12|0)>>2]|0)+(h[K>>2]|0)|0,m=g+(M<<4)+4|0,h[m>>2]=b,v=N+v|0,N=g+(M<<4)+8|0,h[N>>2]=v,_=U+_|0,U=g+(M<<4)+12|0,h[U>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[N>>2]=x,h[U>>2]=_,h[m>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[m>>2]=b,_=_-v|0,h[U>>2]=_,h[N>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[m>>2]=E,h[N>>2]=x,h[U>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[m>>2]=b-v,h[N>>2]=x-v,h[U>>2]=_-v),M=M+1|0;while((M|0)!=6);Q=ae}function cL(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,52)|0,ee()|0,m&15|0}function fq(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,45)|0,ee()|0,m&127|0}function cue(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,(g+-1|0)>>>0>14?(_=4,_|0):(g=tt(p|0,m|0,(15-g|0)*3|0)|0,ee()|0,h[_>>2]=g&7,_=0,_|0)}function uue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;if(p>>>0>15)return _=4,_|0;if(m>>>0>121)return _=17,_|0;b=ft(p|0,0,52)|0,v=ee()|0,E=ft(m|0,0,45)|0,v=v|(ee()|0)|134225919;e:do if((p|0)>=1){for(E=1,b=(He[20496+m>>0]|0)!=0,x=-1;;){if(m=h[g+(E+-1<<2)>>2]|0,m>>>0>6){v=18,m=10;break}if(!((m|0)==0|b^1))if((m|0)==1){v=19,m=10;break}else b=0;if(N=(15-E|0)*3|0,M=ft(7,0,N|0)|0,v=v&~(ee()|0),m=ft(m|0,((m|0)<0)<<31>>31|0,N|0)|0,x=m|x&~M,v=ee()|0|v,(E|0)<(p|0))E=E+1|0;else break e}if((m|0)==10)return v|0}else x=-1;while(!1);return N=_,h[N>>2]=x,h[N+4>>2]=v,N=0,N|0}function oT(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;return!(!0&(m&-16777216|0)==134217728)||(_=tt(p|0,m|0,52)|0,ee()|0,_=_&15,g=tt(p|0,m|0,45)|0,ee()|0,g=g&127,g>>>0>121)?(p=0,p|0):(b=(_^15)*3|0,v=tt(p|0,m|0,b|0)|0,b=ft(v|0,ee()|0,b|0)|0,v=ee()|0,x=Js(-1227133514,-1171,b|0,v|0)|0,!((b&613566756&x|0)==0&(v&4681&(ee()|0)|0)==0)||(b=(_*3|0)+19|0,x=ft(~p|0,~m|0,b|0)|0,b=tt(x|0,ee()|0,b|0)|0,!((_|0)==15|(b|0)==0&(ee()|0)==0))?(b=0,b|0):!(He[20496+g>>0]|0)||(m=m&8191,(p|0)==0&(m|0)==0)?(b=1,b|0):(b=TL(p|0,m|0,0)|0,ee()|0,((63-b|0)%3|0|0)!=0|0))}function hue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;return!0&(m&-16777216|0)==134217728&&(_=tt(p|0,m|0,52)|0,ee()|0,_=_&15,g=tt(p|0,m|0,45)|0,ee()|0,g=g&127,g>>>0<=121)&&(b=(_^15)*3|0,v=tt(p|0,m|0,b|0)|0,b=ft(v|0,ee()|0,b|0)|0,v=ee()|0,x=Js(-1227133514,-1171,b|0,v|0)|0,(b&613566756&x|0)==0&(v&4681&(ee()|0)|0)==0)&&(b=(_*3|0)+19|0,x=ft(~p|0,~m|0,b|0)|0,b=tt(x|0,ee()|0,b|0)|0,(_|0)==15|(b|0)==0&(ee()|0)==0)&&(!(He[20496+g>>0]|0)||(g=m&8191,(p|0)==0&(g|0)==0)||(b=TL(p|0,g|0,0)|0,ee()|0,(63-b|0)%3|0|0))||lq(p,m)|0?(b=1,b|0):(b=(Eq(p,m)|0)!=0&1,b|0)}function uL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0;if(v=ft(m|0,0,52)|0,x=ee()|0,g=ft(g|0,0,45)|0,g=x|(ee()|0)|134225919,(m|0)<1){x=-1,_=g,m=p,h[m>>2]=x,p=p+4|0,h[p>>2]=_;return}for(x=1,v=-1;b=(15-x|0)*3|0,E=ft(7,0,b|0)|0,g=g&~(ee()|0),b=ft(_|0,0,b|0)|0,v=v&~E|b,g=g|(ee()|0),(x|0)!=(m|0);)x=x+1|0;E=p,b=E,h[b>>2]=v,E=E+4|0,h[E>>2]=g}function hL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;if(x=tt(p|0,m|0,52)|0,ee()|0,x=x&15,g>>>0>15)return _=4,_|0;if((x|0)<(g|0))return _=12,_|0;if((x|0)==(g|0))return h[_>>2]=p,h[_+4>>2]=m,_=0,_|0;if(v=ft(g|0,0,52)|0,v=v|p,p=ee()|0|m&-15728641,(x|0)>(g|0))do m=ft(7,0,(14-g|0)*3|0)|0,g=g+1|0,v=m|v,p=ee()|0|p;while((g|0)<(x|0));return h[_>>2]=v,h[_+4>>2]=p,_=0,_|0}function jx(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;if(x=tt(p|0,m|0,52)|0,ee()|0,x=x&15,!((g|0)<16&(x|0)<=(g|0)))return _=4,_|0;v=g-x|0,g=tt(p|0,m|0,45)|0,ee()|0;e:do if(!(yr(g&127)|0))g=sp(7,0,v,((v|0)<0)<<31>>31)|0,v=ee()|0;else{t:do if(x|0){for(g=1;b=ft(7,0,(15-g|0)*3|0)|0,!!((b&p|0)==0&((ee()|0)&m|0)==0);)if(g>>>0<x>>>0)g=g+1|0;else break t;g=sp(7,0,v,((v|0)<0)<<31>>31)|0,v=ee()|0;break e}while(!1);g=sp(7,0,v,((v|0)<0)<<31>>31)|0,g=wr(g|0,ee()|0,5,0)|0,g=At(g|0,ee()|0,-5,-1)|0,g=op(g|0,ee()|0,6,0)|0,g=At(g|0,ee()|0,1,0)|0,v=ee()|0}while(!1);return b=_,h[b>>2]=g,h[b+4>>2]=v,b=0,b|0}function Zi(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;if(v=tt(p|0,m|0,45)|0,ee()|0,!(yr(v&127)|0))return v=0,v|0;v=tt(p|0,m|0,52)|0,ee()|0,v=v&15;e:do if(!v)g=0;else for(_=1;;){if(g=tt(p|0,m|0,(15-_|0)*3|0)|0,ee()|0,g=g&7,g|0)break e;if(_>>>0<v>>>0)_=_+1|0;else{g=0;break}}while(!1);return v=(g|0)==0&1,v|0}function fue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0;if(b=Q,Q=Q+16|0,x=b,gL(x,p,m,g),m=x,p=h[m>>2]|0,m=h[m+4>>2]|0,(p|0)==0&(m|0)==0)return Q=b,0;v=0,g=0;do E=_+(v<<3)|0,h[E>>2]=p,h[E+4>>2]=m,v=At(v|0,g|0,1,0)|0,g=ee()|0,vL(x),E=x,p=h[E>>2]|0,m=h[E+4>>2]|0;while(!((p|0)==0&(m|0)==0));return Q=b,0}function dq(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,(_|0)<(g|0)?(g=m,_=p,On(g|0),_|0):(g=ft(-1,-1,((_-g|0)*3|0)+3|0)|0,_=ft(~g|0,~(ee()|0)|0,(15-_|0)*3|0)|0,g=~(ee()|0)&m,_=~_&p,On(g|0),_|0)}function pq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0;return v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,(g|0)<16&(v|0)<=(g|0)?((v|0)<(g|0)&&(v=ft(-1,-1,((g+-1-v|0)*3|0)+3|0)|0,v=ft(~v|0,~(ee()|0)|0,(15-g|0)*3|0)|0,m=~(ee()|0)&m,p=~v&p),v=ft(g|0,0,52)|0,g=m&-15728641|(ee()|0),h[_>>2]=p|v,h[_+4>>2]=g,_=0,_|0):(_=4,_|0)}function due(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0;if((g|0)==0&(_|0)==0)return pt=0,pt|0;if(v=p,x=h[v>>2]|0,v=h[v+4>>2]|0,!0&(v&15728640|0)==0){if(!((_|0)>0|(_|0)==0&g>>>0>0)||(pt=m,h[pt>>2]=x,h[pt+4>>2]=v,(g|0)==1&(_|0)==0))return pt=0,pt|0;v=1,x=0;do Ut=p+(v<<3)|0,lt=h[Ut+4>>2]|0,pt=m+(v<<3)|0,h[pt>>2]=h[Ut>>2],h[pt+4>>2]=lt,v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(_|0)|(x|0)==(_|0)&v>>>0<g>>>0);return v=0,v|0}if(je=g<<3,lt=br(je)|0,!lt)return pt=13,pt|0;if(cu(lt|0,p|0,je|0)|0,Ut=Ea(g,8)|0,!Ut)return _t(lt),pt=13,pt|0;e:for(;;){v=lt,N=h[v>>2]|0,v=h[v+4>>2]|0,be=tt(N|0,v|0,52)|0,ee()|0,be=be&15,gt=be+-1|0,Me=(be|0)!=0,Ke=(_|0)>0|(_|0)==0&g>>>0>0;t:do if(Me&Ke){if(se=ft(gt|0,0,52)|0,we=ee()|0,gt>>>0>15){if(!((N|0)==0&(v|0)==0)){pt=16;break e}for(x=0,p=0;;){if(x=At(x|0,p|0,1,0)|0,p=ee()|0,!((p|0)<(_|0)|(p|0)==(_|0)&x>>>0<g>>>0))break t;if(b=lt+(x<<3)|0,Be=h[b>>2]|0,b=h[b+4>>2]|0,!((Be|0)==0&(b|0)==0)){v=b,pt=16;break e}}}for(E=N,p=v,x=0,b=0;;){if(!((E|0)==0&(p|0)==0)){if(!(!0&(p&117440512|0)==0)){pt=21;break e}if(U=tt(E|0,p|0,52)|0,ee()|0,U=U&15,(U|0)<(gt|0)){v=12,pt=27;break e}if((U|0)!=(gt|0)&&(E=E|se,p=p&-15728641|we,U>>>0>=be>>>0)){M=gt;do Be=ft(7,0,(14-M|0)*3|0)|0,M=M+1|0,E=Be|E,p=ee()|0|p;while(M>>>0<U>>>0)}if(j=qf(E|0,p|0,g|0,_|0)|0,X=ee()|0,M=Ut+(j<<3)|0,U=M,q=h[U>>2]|0,U=h[U+4>>2]|0,!((q|0)==0&(U|0)==0)){ue=0,xe=0;do{if((ue|0)>(_|0)|(ue|0)==(_|0)&xe>>>0>g>>>0){pt=31;break e}if((q|0)==(E|0)&(U&-117440513|0)==(p|0)){K=tt(q|0,U|0,56)|0,ee()|0,K=K&7,ae=K+1|0,Be=tt(q|0,U|0,45)|0,ee()|0;n:do if(!(yr(Be&127)|0))U=7;else{if(q=tt(q|0,U|0,52)|0,ee()|0,q=q&15,!q){U=6;break}for(U=1;;){if(Be=ft(7,0,(15-U|0)*3|0)|0,!((Be&E|0)==0&((ee()|0)&p|0)==0)){U=7;break n}if(U>>>0<q>>>0)U=U+1|0;else{U=6;break}}}while(!1);if((K+2|0)>>>0>U>>>0){pt=41;break e}Be=ft(ae|0,0,56)|0,p=ee()|0|p&-117440513,Ae=M,h[Ae>>2]=0,h[Ae+4>>2]=0,E=Be|E}else j=At(j|0,X|0,1,0)|0,j=ap(j|0,ee()|0,g|0,_|0)|0,X=ee()|0;xe=At(xe|0,ue|0,1,0)|0,ue=ee()|0,M=Ut+(j<<3)|0,U=M,q=h[U>>2]|0,U=h[U+4>>2]|0}while(!((q|0)==0&(U|0)==0))}Be=M,h[Be>>2]=E,h[Be+4>>2]=p}if(x=At(x|0,b|0,1,0)|0,b=ee()|0,!((b|0)<(_|0)|(b|0)==(_|0)&x>>>0<g>>>0))break t;p=lt+(x<<3)|0,E=h[p>>2]|0,p=h[p+4>>2]|0}}while(!1);if(Be=At(g|0,_|0,5,0)|0,Ae=ee()|0,Ae>>>0<0|(Ae|0)==0&Be>>>0<11){pt=85;break}if(Be=op(g|0,_|0,6,0)|0,ee()|0,Be=Ea(Be,8)|0,!Be){pt=48;break}do if(Ke){for(ae=0,p=0,K=0,ue=0;;){if(U=Ut+(ae<<3)|0,b=U,x=h[b>>2]|0,b=h[b+4>>2]|0,(x|0)==0&(b|0)==0)Ae=K;else{q=tt(x|0,b|0,56)|0,ee()|0,q=q&7,E=q+1|0,j=b&-117440513,Ae=tt(x|0,b|0,45)|0,ee()|0;t:do if(yr(Ae&127)|0){if(X=tt(x|0,b|0,52)|0,ee()|0,X=X&15,X|0)for(M=1;;){if(Ae=ft(7,0,(15-M|0)*3|0)|0,!((x&Ae|0)==0&(j&(ee()|0)|0)==0))break t;if(M>>>0<X>>>0)M=M+1|0;else break}b=ft(E|0,0,56)|0,x=b|x,b=ee()|0|j,E=U,h[E>>2]=x,h[E+4>>2]=b,E=q+2|0}while(!1);(E|0)==7?(Ae=Be+(p<<3)|0,h[Ae>>2]=x,h[Ae+4>>2]=b&-117440513,p=At(p|0,K|0,1,0)|0,Ae=ee()|0):Ae=K}if(ae=At(ae|0,ue|0,1,0)|0,ue=ee()|0,(ue|0)<(_|0)|(ue|0)==(_|0)&ae>>>0<g>>>0)K=Ae;else break}if(Ke){if(xe=gt>>>0>15,se=ft(gt|0,0,52)|0,we=ee()|0,!Me){for(x=0,M=0,E=0,b=0;(N|0)==0&(v|0)==0||(gt=m+(x<<3)|0,h[gt>>2]=N,h[gt+4>>2]=v,x=At(x|0,M|0,1,0)|0,M=ee()|0),E=At(E|0,b|0,1,0)|0,b=ee()|0,!!((b|0)<(_|0)|(b|0)==(_|0)&E>>>0<g>>>0);)v=lt+(E<<3)|0,N=h[v>>2]|0,v=h[v+4>>2]|0;v=Ae;break}for(x=0,M=0,b=0,E=0;;){do if(!((N|0)==0&(v|0)==0)){if(X=tt(N|0,v|0,52)|0,ee()|0,X=X&15,xe|(X|0)<(gt|0)){pt=80;break e}if((X|0)!=(gt|0)){if(U=N|se,q=v&-15728641|we,X>>>0>=be>>>0){j=gt;do Me=ft(7,0,(14-j|0)*3|0)|0,j=j+1|0,U=Me|U,q=ee()|0|q;while(j>>>0<X>>>0)}}else U=N,q=v;K=qf(U|0,q|0,g|0,_|0)|0,j=0,X=0,ue=ee()|0;do{if((j|0)>(_|0)|(j|0)==(_|0)&X>>>0>g>>>0){pt=81;break e}if(Me=Ut+(K<<3)|0,ae=h[Me+4>>2]|0,(ae&-117440513|0)==(q|0)&&(h[Me>>2]|0)==(U|0)){pt=65;break}Me=At(K|0,ue|0,1,0)|0,K=ap(Me|0,ee()|0,g|0,_|0)|0,ue=ee()|0,X=At(X|0,j|0,1,0)|0,j=ee()|0,Me=Ut+(K<<3)|0}while(!((h[Me>>2]|0)==(U|0)&&(h[Me+4>>2]|0)==(q|0)));if((pt|0)==65&&(pt=0,!0&(ae&117440512|0)==100663296))break;Me=m+(x<<3)|0,h[Me>>2]=N,h[Me+4>>2]=v,x=At(x|0,M|0,1,0)|0,M=ee()|0}while(!1);if(b=At(b|0,E|0,1,0)|0,E=ee()|0,!((E|0)<(_|0)|(E|0)==(_|0)&b>>>0<g>>>0))break;v=lt+(b<<3)|0,N=h[v>>2]|0,v=h[v+4>>2]|0}v=Ae}else x=0,v=Ae}else x=0,p=0,v=0;while(!1);if(lp(Ut|0,0,je|0)|0,cu(lt|0,Be|0,p<<3|0)|0,_t(Be),(p|0)==0&(v|0)==0){pt=89;break}else m=m+(x<<3)|0,_=v,g=p}if((pt|0)==16)!0&(v&117440512|0)==0?(v=4,pt=27):pt=21;else if((pt|0)==31)di(27634,27225,620,27235);else{if((pt|0)==41)return _t(lt),_t(Ut),pt=10,pt|0;if((pt|0)==48)return _t(lt),_t(Ut),pt=13,pt|0;(pt|0)==80?di(27634,27225,711,27235):(pt|0)==81?di(27634,27225,723,27235):(pt|0)==85&&(cu(m|0,lt|0,g<<3|0)|0,pt=89)}return(pt|0)==21?(_t(lt),_t(Ut),pt=5,pt|0):(pt|0)==27?(_t(lt),_t(Ut),pt=v,pt|0):(pt|0)==89?(_t(lt),_t(Ut),pt=0,pt|0):0}function pue(p,m,g,_,v,x,b){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0;var E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0;if(ae=Q,Q=Q+16|0,K=ae,!((g|0)>0|(g|0)==0&m>>>0>0))return K=0,Q=ae,K|0;if((b|0)>=16)return K=12,Q=ae,K|0;j=0,X=0,q=0,E=0;e:for(;;){if(N=p+(j<<3)|0,M=h[N>>2]|0,N=h[N+4>>2]|0,U=tt(M|0,N|0,52)|0,ee()|0,(U&15|0)>(b|0)){E=12,M=11;break}if(gL(K,M,N,b),U=K,N=h[U>>2]|0,U=h[U+4>>2]|0,(N|0)==0&(U|0)==0)M=q;else{M=q;do{if(!((E|0)<(x|0)|(E|0)==(x|0)&M>>>0<v>>>0)){M=10;break e}q=_+(M<<3)|0,h[q>>2]=N,h[q+4>>2]=U,M=At(M|0,E|0,1,0)|0,E=ee()|0,vL(K),q=K,N=h[q>>2]|0,U=h[q+4>>2]|0}while(!((N|0)==0&(U|0)==0))}if(j=At(j|0,X|0,1,0)|0,X=ee()|0,(X|0)<(g|0)|(X|0)==(g|0)&j>>>0<m>>>0)q=M;else{E=0,M=11;break}}return(M|0)==10?(K=14,Q=ae,K|0):(M|0)==11?(Q=ae,E|0):0}function mue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;j=Q,Q=Q+16|0,q=j;e:do if((g|0)>0|(g|0)==0&m>>>0>0){for(N=0,b=0,x=0,U=0;;){if(M=p+(N<<3)|0,E=h[M>>2]|0,M=h[M+4>>2]|0,!((E|0)==0&(M|0)==0)&&(M=(jx(E,M,_,q)|0)==0,E=q,b=At(h[E>>2]|0,h[E+4>>2]|0,b|0,x|0)|0,x=ee()|0,!M)){x=12;break}if(N=At(N|0,U|0,1,0)|0,U=ee()|0,!((U|0)<(g|0)|(U|0)==(g|0)&N>>>0<m>>>0))break e}return Q=j,x|0}else b=0,x=0;while(!1);return h[v>>2]=b,h[v+4>>2]=x,v=0,Q=j,v|0}function Aue(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,52)|0,ee()|0,m&1|0}function ll(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;if(v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,!v)return v=0,v|0;for(_=1;;){if(g=tt(p|0,m|0,(15-_|0)*3|0)|0,ee()|0,g=g&7,g|0){_=5;break}if(_>>>0<v>>>0)_=_+1|0;else{g=0,_=5;break}}return(_|0)==5?g|0:0}function fL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(U=tt(p|0,m|0,52)|0,ee()|0,U=U&15,!U)return N=m,U=p,On(N|0),U|0;for(N=1,g=0;;){switch(_=(15-N|0)*3|0,E=ft(7,0,_|0)|0,M=ee()|0,x=p&~E,b=m&~M,p=tt(p|0,m|0,_|0)|0,ee()|0,p&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=p&7}_=ft(p|0,0,_|0)|0,v=ee()|0,p=_|x,m=v|b;e:do if(!g)if((_&E|0)==0&(v&M|0)==0)g=0;else if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)g=1;else{g=1;t:for(;;){switch(M=tt(p|0,m|0,(15-g|0)*3|0)|0,ee()|0,M&7){case 1:break t;case 0:break;default:{g=1;break e}}if(g>>>0<b>>>0)g=g+1|0;else{g=1;break e}}for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(p|0,m|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,_=p&~_,m=m&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,p=p|_,m=ee()|0|m,x>>>0<b>>>0)x=x+1|0;else{g=1;break e}}}while(!1);if(N>>>0<U>>>0)N=N+1|0;else break}return On(m|0),p|0}function km(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)return x=m,b=p,On(x|0),b|0;for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(p|0,m|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,_=p&~_,m=m&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,p=p|_,m=ee()|0|m,x>>>0<b>>>0)x=x+1|0;else break}return On(m|0),p|0}function gue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(U=tt(p|0,m|0,52)|0,ee()|0,U=U&15,!U)return N=m,U=p,On(N|0),U|0;for(N=1,g=0;;){switch(_=(15-N|0)*3|0,E=ft(7,0,_|0)|0,M=ee()|0,x=p&~E,b=m&~M,p=tt(p|0,m|0,_|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}_=ft(p|0,0,_|0)|0,v=ee()|0,p=_|x,m=v|b;e:do if(!g)if((_&E|0)==0&(v&M|0)==0)g=0;else if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)g=1;else{g=1;t:for(;;){switch(M=tt(p|0,m|0,(15-g|0)*3|0)|0,ee()|0,M&7){case 1:break t;case 0:break;default:{g=1;break e}}if(g>>>0<b>>>0)g=g+1|0;else{g=1;break e}}for(x=1;;){switch(g=(15-x|0)*3|0,_=ft(7,0,g|0)|0,_=p&~_,v=m&~(ee()|0),p=tt(p|0,m|0,g|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}if(p=ft(p|0,0,g|0)|0,p=p|_,m=ee()|0|v,x>>>0<b>>>0)x=x+1|0;else{g=1;break e}}}while(!1);if(N>>>0<U>>>0)N=N+1|0;else break}return On(m|0),p|0}function dL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)return x=m,b=p,On(x|0),b|0;for(x=1;;){switch(_=(15-x|0)*3|0,g=ft(7,0,_|0)|0,g=p&~g,v=m&~(ee()|0),p=tt(p|0,m|0,_|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}if(p=ft(p|0,0,_|0)|0,p=p|g,m=ee()|0|v,x>>>0<b>>>0)x=x+1|0;else break}return On(m|0),p|0}function vue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0;if(Ae=Q,Q=Q+16|0,we=Ae,ft(m|0,0,52)|0,g=ee()|0|134225919,!m)return(h[p+4>>2]|0)>2||(h[p+8>>2]|0)>2||(h[p+12>>2]|0)>2?(se=0,we=0,On(se|0),Q=Ae,we|0):(ft(nq(p)|0,0,45)|0,se=ee()|0|g,we=-1,On(se|0),Q=Ae,we|0);h[we>>2]=h[p>>2],h[we+4>>2]=h[p+4>>2],h[we+8>>2]=h[p+8>>2],h[we+12>>2]=h[p+12>>2],se=we+4|0;e:do if((m|0)>0)for(ae=we+8|0,ue=we+12|0,K=m,q=h[ae>>2]|0,j=h[ue>>2]|0,m=-1,U=h[we+4>>2]|0;;){X=K,K=K+-1|0,p=U-j|0,_=q-j|0,X&1?(x=rh(+((p*3|0)-_|0)*.14285714285714285)|0,h[se>>2]=x,p=rh(+((_<<1)+p|0)*.14285714285714285)|0,h[ae>>2]=p,h[ue>>2]=0,_=p-x|0,v=0-x|0,(x|0)<0?(h[ae>>2]=_,h[ue>>2]=v,h[se>>2]=0,p=_,b=0):(b=x,v=0),x=b-p|0,_=v-p|0,(p|0)<0?(h[se>>2]=x,h[ue>>2]=_,h[ae>>2]=0,b=x,x=0):(_=v,x=p),p=b-_|0,v=x-_|0,(_|0)<0?(h[se>>2]=p,h[ae>>2]=v,h[ue>>2]=0,x=0):(v=x,p=b,x=_),_=(v|0)<(p|0)?v:p,_=(x|0)<(_|0)?x:_,(_|0)>0&&(x=x-_|0,v=v-_|0,p=p-_|0,h[se>>2]=p,h[ae>>2]=v,h[ue>>2]=x),Ke=v+(p*3|0)|0,Be=(Ke|0)<0,N=x+(v*3|0)-(Be?Ke:0)|0,M=(N|0)<0,_=(x*3|0)+p-(Be?Ke:0)-(M?N:0)|0,E=(_|0)<0,Me=E?0:_,b=(M?0:N)-(E?_:0)|0,_=(Be?0:Ke)-(M?N:0)-(E?_:0)|0,E=(b|0)<(_|0)?b:_,E=(Me|0)<(E|0)?Me:E,N=(E|0)>0,M=N?E:0,b=b-(N?E:0)|0,E=Me-(N?E:0)|0,N=x):(E=rh(+((p<<1)+_|0)*.14285714285714285)|0,h[se>>2]=E,v=rh(+((_*3|0)-p|0)*.14285714285714285)|0,h[ae>>2]=v,h[ue>>2]=0,_=v-E|0,p=0-E|0,(E|0)<0?(h[ae>>2]=_,h[ue>>2]=p,h[se>>2]=0,v=_,E=0):p=0,b=E-v|0,_=p-v|0,(v|0)<0?(h[se>>2]=b,h[ue>>2]=_,h[ae>>2]=0,x=_,v=0):(x=p,b=E),p=b-x|0,_=v-x|0,(x|0)<0?(h[se>>2]=p,h[ae>>2]=_,h[ue>>2]=0,v=_,x=0):p=b,_=(v|0)<(p|0)?v:p,_=(x|0)<(_|0)?x:_,(_|0)>0&&(x=x-_|0,v=v-_|0,p=p-_|0,h[se>>2]=p,h[ae>>2]=v,h[ue>>2]=x),Ke=x+(p*3|0)|0,Me=(Ke|0)<0,N=(v*3|0)+p-(Me?Ke:0)|0,M=(N|0)<0,_=(x*3|0)+v-(Me?Ke:0)-(M?N:0)|0,E=(_|0)<0,Be=E?0:_,b=(M?0:N)-(E?_:0)|0,_=(Me?0:Ke)-(M?N:0)-(E?_:0)|0,E=(b|0)<(_|0)?b:_,E=(Be|0)<(E|0)?Be:E,N=(E|0)>0,M=N?E:0,b=b-(N?E:0)|0,E=Be-(N?E:0)|0,N=x),_=U+(M-_)|0,x=(_|0)<0,M=q-b-(x?_:0)|0,b=(M|0)<0,j=j-E+(x?0-_|0:0)+(b?0-M|0:0)|0,U=(j|0)<0,E=U?0:j,Me=(b?0:M)-(U?j:0)|0,j=(x?0:_)-(b?M:0)-(U?j:0)|0,U=(Me|0)<(j|0)?Me:j,U=(E|0)<(U|0)?E:U,M=(U|0)>0,j=j-(M?U:0)|0,b=(15-X|0)*3|0,_=ft(7,0,b|0)|0,_=m&~_,x=g&~(ee()|0),q=(j|0)<0,Ke=q?j:0,Me=Me-(M?U:0)-Ke|0,Be=(Me|0)<0,Ke=(Be?0-Me|0:0)+(E-(M?U:0)-Ke)|0,g=(Ke|0)<0,m=g?0:Ke,Ke=g?Ke:0,g=(Be?0:Me)-Ke|0,Ke=(q?0:j)-(Be?Me:0)-Ke|0,Me=(g|0)<(Ke|0)?g:Ke,Me=(m|0)<(Me|0)?m:Me,Me=(Me|0)>0?Me:0,m=m-Me|0,g=g-Me|0;t:do switch(Ke-Me|0){case 0:switch(g|0){case 0:{m=(m|0)==0?0:(m|0)==1?1:7;break t}case 1:{m=(m|0)==0?2:(m|0)==1?3:7;break t}default:{xe=36;break t}}case 1:switch(g|0){case 0:{m=(m|0)==0?4:(m|0)==1?5:7;break t}case 1:if(m){xe=36;break t}else{m=6;break t}default:{xe=36;break t}}default:xe=36}while(!1);if((xe|0)==36&&(xe=0,m=7),m=ft(m|0,0,b|0)|0,m=m|_,g=ee()|0|x,(X|0)<=1)break e;q=v,j=N,U=p}else m=-1,p=h[se>>2]|0;while(!1);e:do if((p|0)<=2&&(h[we+8>>2]|0)<=2&&(h[we+12>>2]|0)<=2){if(_=nq(we)|0,p=ft(_|0,0,45)|0,m=p|m,p=ee()|0|g&-1040385,M=zce(we)|0,!(yr(_)|0)){if((M|0)<=0)break;for(E=0;;){b=tt(m|0,p|0,52)|0,ee()|0,b=b&15;t:do if(b)for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(m|0,p|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,m=m&~_,_=p&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,m=p|m,p=ee()|0|_,x>>>0<b>>>0)x=x+1|0;else break t}while(!1);if(E=E+1|0,(E|0)==(M|0))break e}}b=tt(m|0,p|0,52)|0,ee()|0,b=b&15;t:do if(b){g=1;n:for(;;){switch(Me=tt(m|0,p|0,(15-g|0)*3|0)|0,ee()|0,Me&7){case 1:break n;case 0:break;default:break t}if(g>>>0<b>>>0)g=g+1|0;else break t}if(iq(_,h[we>>2]|0)|0)for(x=1;;){switch(g=(15-x|0)*3|0,_=ft(7,0,g|0)|0,_=m&~_,v=p&~(ee()|0),p=tt(m|0,p|0,g|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}if(m=ft(p|0,0,g|0)|0,m=m|_,p=ee()|0|v,x>>>0<b>>>0)x=x+1|0;else break t}else for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(m|0,p|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,m=m&~_,_=p&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,m=p|m,p=ee()|0|_,x>>>0<b>>>0)x=x+1|0;else break t}}while(!1);if((M|0)>0){g=0;do m=fL(m,p)|0,p=ee()|0,g=g+1|0;while((g|0)!=(M|0))}}else m=0,p=0;while(!1);return Ke=p,Me=m,On(Ke|0),Q=Ae,Me|0}function _c(p){return p=p|0,(p|0)%2|0|0}function pL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;if(U=Q,Q=Q+64|0,E=U+24|0,M=U+48|0,N=U,m>>>0>15)return N=4,Q=U,N|0;if(x=+ie[p>>3],ie[or>>3]=x,(h[or+4>>2]&2146435072|0)==2146435072||(_=+ie[p+8>>3],ie[or>>3]=_,(h[or+4>>2]&2146435072|0)==2146435072))return N=3,Q=U,N|0;v=+ii(+x),q=v*+ii(+_),v=v*+zi(+_),_=+zi(+x),ie[N>>3]=q,ie[N+8>>3]=v,ie[N+16>>3]=_,ie[or>>3]=q;do if((h[or+4>>2]&2146435072|0)!=2146435072&&(ie[or>>3]=_,p=h[or+4>>2]|0,ie[or>>3]=v,!((h[or+4>>2]&2146435072|0)==2146435072|!0&(p&2146435072|0)==2146435072)))if(h[E>>2]=h[N>>2],h[E+4>>2]=h[N+4>>2],h[E+8>>2]=h[N+8>>2],h[E+12>>2]=h[N+12>>2],h[E+16>>2]=h[N+16>>2],h[E+20>>2]=h[N+20>>2],oue(E,m,M),M=vue(M,m)|0,N=ee()|0,h[g>>2]=M,h[g+4>>2]=N,(M|0)==0&(N|0)==0)di(27634,27225,1073,27248);else{b=0;break}else b=2;while(!1);return N=b,Q=U,N|0}function mL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(X=g+4|0,K=tt(p|0,m|0,52)|0,ee()|0,K=K&15,j=tt(p|0,m|0,45)|0,ee()|0,_=(K|0)==0,yr(j&127)|0){if(_)return K=1,K|0;_=1}else{if(_)return K=0,K|0;(h[X>>2]|0)==0&&(h[g+8>>2]|0)==0?_=(h[g+12>>2]|0)!=0&1:_=1}for(j=g+8|0,q=g+12|0,U=1,g=h[X>>2]|0,b=h[j>>2]|0,x=h[q>>2]|0;v=g*3|0,E=b*3|0,N=x*3|0,U&1?(M=b+v|0,h[X>>2]=M,x=x+E|0,h[j>>2]=x,v=N+g|0,h[q>>2]=v,g=x-M|0,b=v-M|0,(M|0)<0?(h[j>>2]=g,h[q>>2]=b,h[X>>2]=0,E=0,v=b):(g=x,E=M),b=E-g|0,x=v-g|0,(g|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,E=b,v=0):(x=v,v=g),g=E-x|0,b=v-x|0,(x|0)<0?(h[X>>2]=g,h[j>>2]=b,h[q>>2]=0,x=0):(b=v,g=E),v=(b|0)<(g|0)?b:g,v=(x|0)<(v|0)?x:v,(v|0)>0&&(x=x-v|0,b=b-v|0,g=g-v|0,h[X>>2]=g,h[j>>2]=b,h[q>>2]=x)):(M=E+g|0,E=x+v|0,h[X>>2]=E,h[j>>2]=M,v=N+b|0,h[q>>2]=v,g=M-E|0,x=v-E|0,(E|0)<0?(h[j>>2]=g,h[q>>2]=x,h[X>>2]=0,E=0,v=x):g=M,b=E-g|0,x=v-g|0,(g|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,E=b,v=0):(x=v,v=g),g=E-x|0,b=v-x|0,(x|0)<0?(h[X>>2]=g,h[j>>2]=b,h[q>>2]=0,x=0):(b=v,g=E),v=(b|0)<(g|0)?b:g,v=(x|0)<(v|0)?x:v,(v|0)>0&&(x=x-v|0,b=b-v|0,g=g-v|0,h[X>>2]=g,h[j>>2]=b,h[q>>2]=x)),v=tt(p|0,m|0,(15-U|0)*3|0)|0,ee()|0,v=v&7,(v+-1|0)>>>0<6&&(M=h[22032+(v*12|0)+4>>2]|0,N=h[22032+(v*12|0)+8>>2]|0,E=(h[22032+(v*12|0)>>2]|0)+g|0,h[X>>2]=E,b=M+b|0,h[j>>2]=b,g=N+x|0,h[q>>2]=g,x=b-E|0,v=g-E|0,(E|0)<0&&(h[j>>2]=x,h[q>>2]=v,h[X>>2]=0,E=0,g=v,b=x),v=E-b|0,x=g-b|0,(b|0)<0?(h[X>>2]=v,h[q>>2]=x,h[j>>2]=0,E=v,b=0):x=g,g=E-x|0,v=b-x|0,(x|0)<0?(h[X>>2]=g,h[j>>2]=v,h[q>>2]=0,b=v,x=0):g=E,v=(b|0)<(g|0)?b:g,v=(x|0)<(v|0)?x:v,(v|0)>0&&(x=x-v|0,b=b-v|0,g=g-v|0,h[X>>2]=g,h[j>>2]=b,h[q>>2]=x)),U>>>0<K>>>0;)U=U+1|0;return _|0}function b1(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(K=Q,Q=Q+16|0,q=K,j=tt(p|0,m|0,45)|0,ee()|0,j=j&127,j>>>0>121)return h[g>>2]=0,h[g+4>>2]=0,h[g+8>>2]=0,h[g+12>>2]=0,X=5,Q=K,X|0;e:do if((yr(j)|0)!=0&&(E=tt(p|0,m|0,52)|0,ee()|0,E=E&15,(E|0)!=0)){_=1;t:for(;;){switch(X=tt(p|0,m|0,(15-_|0)*3|0)|0,ee()|0,X&7){case 5:break t;case 0:break;default:{N=m;break e}}if(_>>>0<E>>>0)_=_+1|0;else{N=m;break e}}for(b=1,_=m;;){switch(m=(15-b|0)*3|0,v=ft(7,0,m|0)|0,v=p&~v,x=_&~(ee()|0),_=tt(p|0,_|0,m|0)|0,ee()|0,_&7){case 1:{_=3;break}case 3:{_=2;break}case 2:{_=6;break}case 6:{_=4;break}case 4:{_=5;break}case 5:{_=1;break}default:_=_&7}if(p=ft(_|0,0,m|0)|0,p=p|v,_=ee()|0|x,b>>>0<E>>>0)b=b+1|0;else{N=_;break e}}}else N=m;while(!1);if(X=7696+(j*28|0)|0,h[g>>2]=h[X>>2],h[g+4>>2]=h[X+4>>2],h[g+8>>2]=h[X+8>>2],h[g+12>>2]=h[X+12>>2],!(mL(p,N,g)|0))return X=0,Q=K,X|0;if(X=g+4|0,h[q>>2]=h[X>>2],h[q+4>>2]=h[X+4>>2],h[q+8>>2]=h[X+8>>2],M=tt(p|0,N|0,52)|0,ee()|0,U=M&15,M&1?(x=h[X>>2]|0,E=g+8|0,v=h[E>>2]|0,M=g+12|0,m=h[M>>2]|0,_=(v*3|0)+x|0,x=m+(x*3|0)|0,h[X>>2]=x,h[E>>2]=_,v=(m*3|0)+v|0,h[M>>2]=v,m=_-x|0,b=v-x|0,(x|0)<0&&(h[E>>2]=m,h[M>>2]=b,h[X>>2]=0,_=m,x=0,v=b),b=x-_|0,m=v-_|0,(_|0)<0?(h[X>>2]=b,h[M>>2]=m,h[E>>2]=0,_=0):(m=v,b=x),x=b-m|0,v=_-m|0,(m|0)<0?(h[X>>2]=x,h[E>>2]=v,h[M>>2]=0,m=0):(v=_,x=b),_=(v|0)<(x|0)?v:x,_=(m|0)<(_|0)?m:_,(_|0)>0&&(h[X>>2]=x-_,h[E>>2]=v-_,h[M>>2]=m-_),v=U+1|0):v=U,!(yr(j)|0))_=0;else{e:do if(!U)_=0;else for(m=1;;){if(_=tt(p|0,N|0,(15-m|0)*3|0)|0,ee()|0,_=_&7,_|0)break e;if(m>>>0<U>>>0)m=m+1|0;else{_=0;break}}while(!1);_=(_|0)==4&1}if(!(y1(g,v,_,0)|0))(v|0)!=(U|0)&&(h[X>>2]=h[q>>2],h[X+4>>2]=h[q+4>>2],h[X+8>>2]=h[q+8>>2]);else{if(yr(j)|0)do;while((y1(g,v,0,0)|0)!=0);(v|0)!=(U|0)&&(E=g+12|0,p=h[E>>2]|0,_=(h[X>>2]|0)-p|0,b=g+8|0,p=(h[b>>2]|0)-p|0,m=rh(+((_<<1)+p|0)*.14285714285714285)|0,h[X>>2]=m,_=rh(+((p*3|0)-_|0)*.14285714285714285)|0,h[b>>2]=_,h[E>>2]=0,p=_-m|0,v=0-m|0,(m|0)<0?(h[b>>2]=p,h[E>>2]=v,h[X>>2]=0,_=p,m=0):v=0,x=m-_|0,p=v-_|0,(_|0)<0?(h[X>>2]=x,h[E>>2]=p,h[b>>2]=0,m=x,_=0):p=v,x=m-p|0,v=_-p|0,(p|0)<0?(h[X>>2]=x,h[b>>2]=v,h[E>>2]=0,m=x,p=0):v=_,_=(v|0)<(m|0)?v:m,_=(p|0)<(_|0)?p:_,(_|0)>0&&(h[X>>2]=m-_,h[b>>2]=v-_,h[E>>2]=p-_))}return X=0,Q=K,X|0}function w1(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0;return b=Q,Q=Q+48|0,_=b+24|0,v=b,x=b1(p,m,_)|0,x?(Q=b,x|0):(x=tt(p|0,m|0,52)|0,ee()|0,aue(_,x&15,v),M=+qx(+ +ie[v+16>>3]),E=+Ta(+ +ie[v+8>>3],+ +ie[v>>3]),ie[g>>3]=M,ie[g+8>>3]=E,x=0,Q=b,x|0)}function zm(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0;if(b=Q,Q=Q+16|0,x=b,_=b1(p,m,x)|0,_|0)return x=_,Q=b,x|0;_=tt(p|0,m|0,45)|0,ee()|0,_=(yr(_&127)|0)==0,v=tt(p|0,m|0,52)|0,ee()|0,v=v&15;e:do if(!_){if(v|0)for(_=1;;){if(E=ft(7,0,(15-_|0)*3|0)|0,!((E&p|0)==0&((ee()|0)&m|0)==0))break e;if(_>>>0<v>>>0)_=_+1|0;else break}return aL(x,v,0,5,g),E=0,Q=b,E|0}while(!1);return lL(x,v,0,6,g),E=0,Q=b,E|0}function _ue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if(v=tt(p|0,m|0,45)|0,ee()|0,!(yr(v&127)|0))return v=2,h[g>>2]=v,0;if(v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,!v)return v=5,h[g>>2]=v,0;for(_=1;;){if(x=ft(7,0,(15-_|0)*3|0)|0,!((x&p|0)==0&((ee()|0)&m|0)==0)){_=2,p=6;break}if(_>>>0<v>>>0)_=_+1|0;else{_=5,p=6;break}}return(p|0)==6&&(h[g>>2]=_),0}function mq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;q=Q,Q=Q+128|0,N=q+112|0,x=q+96|0,U=q,v=tt(p|0,m|0,52)|0,ee()|0,E=v&15,h[N>>2]=E,b=tt(p|0,m|0,45)|0,ee()|0,b=b&127;e:do if(yr(b)|0){if(E|0)for(_=1;;){if(M=ft(7,0,(15-_|0)*3|0)|0,!((M&p|0)==0&((ee()|0)&m|0)==0)){v=0;break e}if(_>>>0<E>>>0)_=_+1|0;else break}if(v&1)v=1;else return M=ft(E+1|0,0,52)|0,U=ee()|0|m&-15728641,N=ft(7,0,(14-E|0)*3|0)|0,U=mq((M|p)&~N,U&~(ee()|0),g)|0,Q=q,U|0}else v=0;while(!1);if(_=b1(p,m,x)|0,!_){v?(uq(x,N,U),M=5):(hq(x,N,U),M=6);e:do if(yr(b)|0)if(!E)p=5;else for(_=1;;){if(b=ft(7,0,(15-_|0)*3|0)|0,!((b&p|0)==0&((ee()|0)&m|0)==0)){p=2;break e}if(_>>>0<E>>>0)_=_+1|0;else{p=5;break}}else p=2;while(!1);lp(g|0,-1,p<<2|0)|0;e:do if(v)for(x=0;;){if(b=U+(x<<4)|0,lue(b,h[N>>2]|0)|0,b=h[b>>2]|0,E=h[g>>2]|0,(E|0)==-1|(E|0)==(b|0))_=g;else{v=0;do{if(v=v+1|0,v>>>0>=p>>>0){_=1;break e}_=g+(v<<2)|0,E=h[_>>2]|0}while(!((E|0)==-1|(E|0)==(b|0)))}if(h[_>>2]=b,x=x+1|0,x>>>0>=M>>>0){_=0;break}}else for(x=0;;){if(b=U+(x<<4)|0,y1(b,h[N>>2]|0,0,1)|0,b=h[b>>2]|0,E=h[g>>2]|0,(E|0)==-1|(E|0)==(b|0))_=g;else{v=0;do{if(v=v+1|0,v>>>0>=p>>>0){_=1;break e}_=g+(v<<2)|0,E=h[_>>2]|0}while(!((E|0)==-1|(E|0)==(b|0)))}if(h[_>>2]=b,x=x+1|0,x>>>0>=M>>>0){_=0;break}}while(!1)}return U=_,Q=q,U|0}function xue(){return 12}function AL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0;if(p>>>0>15)return E=4,E|0;if(ft(p|0,0,52)|0,E=ee()|0|134225919,!p){g=0,_=0;do yr(_)|0&&(ft(_|0,0,45)|0,b=E|(ee()|0),p=m+(g<<3)|0,h[p>>2]=-1,h[p+4>>2]=b,g=g+1|0),_=_+1|0;while((_|0)!=122);return g=0,g|0}g=0,b=0;do{if(yr(b)|0){for(ft(b|0,0,45)|0,_=1,v=-1,x=E|(ee()|0);M=ft(7,0,(15-_|0)*3|0)|0,v=v&~M,x=x&~(ee()|0),(_|0)!=(p|0);)_=_+1|0;M=m+(g<<3)|0,h[M>>2]=v,h[M+4>>2]=x,g=g+1|0}b=b+1|0}while((b|0)!=122);return g=0,g|0}function yue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0;if(se=Q,Q=Q+16|0,ue=se,xe=tt(p|0,m|0,52)|0,ee()|0,xe=xe&15,g>>>0>15)return xe=4,Q=se,xe|0;if((xe|0)<(g|0))return xe=12,Q=se,xe|0;if((xe|0)!=(g|0))if(x=ft(g|0,0,52)|0,x=x|p,E=ee()|0|m&-15728641,(xe|0)>(g|0)){M=g;do ae=ft(7,0,(14-M|0)*3|0)|0,M=M+1|0,x=ae|x,E=ee()|0|E;while((M|0)<(xe|0));ae=x}else ae=x;else ae=p,E=m;K=tt(ae|0,E|0,45)|0,ee()|0;e:do if(yr(K&127)|0){if(M=tt(ae|0,E|0,52)|0,ee()|0,M=M&15,M|0)for(x=1;;){if(K=ft(7,0,(15-x|0)*3|0)|0,!((K&ae|0)==0&((ee()|0)&E|0)==0)){N=33;break e}if(x>>>0<M>>>0)x=x+1|0;else break}if(K=_,h[K>>2]=0,h[K+4>>2]=0,(xe|0)>(g|0)){for(K=m&-15728641,X=xe;;){if(j=X,X=X+-1|0,X>>>0>15|(xe|0)<(X|0)){N=19;break}if((xe|0)!=(X|0))if(x=ft(X|0,0,52)|0,x=x|p,M=ee()|0|K,(xe|0)<(j|0))q=x;else{N=X;do q=ft(7,0,(14-N|0)*3|0)|0,N=N+1|0,x=q|x,M=ee()|0|M;while((N|0)<(xe|0));q=x}else q=p,M=m;if(U=tt(q|0,M|0,45)|0,ee()|0,!(yr(U&127)|0))x=0;else{U=tt(q|0,M|0,52)|0,ee()|0,U=U&15;t:do if(!U)x=0;else for(N=1;;){if(x=tt(q|0,M|0,(15-N|0)*3|0)|0,ee()|0,x=x&7,x|0)break t;if(N>>>0<U>>>0)N=N+1|0;else{x=0;break}}while(!1);x=(x|0)==0&1}if(M=tt(p|0,m|0,(15-j|0)*3|0)|0,ee()|0,M=M&7,(M|0)==7){v=5,N=42;break}if(x=(x|0)!=0,(M|0)==1&x){v=5,N=42;break}if(q=M+(((M|0)!=0&x)<<31>>31)|0,q|0&&(N=xe-j|0,N=sp(7,0,N,((N|0)<0)<<31>>31)|0,U=ee()|0,x?(x=wr(N|0,U|0,5,0)|0,x=At(x|0,ee()|0,-5,-1)|0,x=op(x|0,ee()|0,6,0)|0,x=At(x|0,ee()|0,1,0)|0,M=ee()|0):(x=N,M=U),j=q+-1|0,j=wr(N|0,U|0,j|0,((j|0)<0)<<31>>31|0)|0,j=At(x|0,M|0,j|0,ee()|0)|0,q=ee()|0,U=_,U=At(j|0,q|0,h[U>>2]|0,h[U+4>>2]|0)|0,q=ee()|0,j=_,h[j>>2]=U,h[j+4>>2]=q),(X|0)<=(g|0)){N=37;break}}if((N|0)==19)di(27634,27225,1407,27259);else if((N|0)==37){b=_,v=h[b+4>>2]|0,b=h[b>>2]|0;break}else if((N|0)==42)return Q=se,v|0}else v=0,b=0}else N=33;while(!1);e:do if((N|0)==33)if(K=_,h[K>>2]=0,h[K+4>>2]=0,(xe|0)>(g|0)){for(x=xe;;){if(v=tt(p|0,m|0,(15-x|0)*3|0)|0,ee()|0,v=v&7,(v|0)==7){v=5;break}if(b=xe-x|0,b=sp(7,0,b,((b|0)<0)<<31>>31)|0,v=wr(b|0,ee()|0,v|0,0)|0,b=ee()|0,K=_,b=At(h[K>>2]|0,h[K+4>>2]|0,v|0,b|0)|0,v=ee()|0,K=_,h[K>>2]=b,h[K+4>>2]=v,x=x+-1|0,(x|0)<=(g|0))break e}return Q=se,v|0}else v=0,b=0;while(!1);return jx(ae,E,xe,ue)|0&&di(27634,27225,1367,27274),xe=ue,ue=h[xe+4>>2]|0,((v|0)>-1|(v|0)==-1&b>>>0>4294967295)&((ue|0)>(v|0)|((ue|0)==(v|0)?(h[xe>>2]|0)>>>0>b>>>0:0))?(xe=0,Q=se,xe|0):(di(27634,27225,1447,27259),0)}function bue(p,m,g,_,v,x){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0;var b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0;if(q=Q,Q=Q+16|0,b=q,v>>>0>15)return x=4,Q=q,x|0;if(E=tt(g|0,_|0,52)|0,ee()|0,E=E&15,(E|0)>(v|0))return x=12,Q=q,x|0;if(jx(g,_,v,b)|0&&di(27634,27225,1367,27274),U=b,N=h[U+4>>2]|0,!(((m|0)>-1|(m|0)==-1&p>>>0>4294967295)&((N|0)>(m|0)|((N|0)==(m|0)?(h[U>>2]|0)>>>0>p>>>0:0))))return x=2,Q=q,x|0;U=v-E|0,v=ft(v|0,0,52)|0,M=ee()|0|_&-15728641,N=x,h[N>>2]=v|g,h[N+4>>2]=M,N=tt(g|0,_|0,45)|0,ee()|0;e:do if(yr(N&127)|0){if(E|0)for(b=1;;){if(N=ft(7,0,(15-b|0)*3|0)|0,!((N&g|0)==0&((ee()|0)&_|0)==0))break e;if(b>>>0<E>>>0)b=b+1|0;else break}if((U|0)<1)return x=0,Q=q,x|0;for(N=E^15,_=-1,M=1,b=1;;){E=U-M|0,E=sp(7,0,E,((E|0)<0)<<31>>31)|0,g=ee()|0;do if(b)if(b=wr(E|0,g|0,5,0)|0,b=At(b|0,ee()|0,-5,-1)|0,b=op(b|0,ee()|0,6,0)|0,v=ee()|0,(m|0)>(v|0)|(m|0)==(v|0)&p>>>0>b>>>0){m=At(p|0,m|0,-1,-1)|0,m=Js(m|0,ee()|0,b|0,v|0)|0,b=ee()|0,j=x,K=h[j>>2]|0,j=h[j+4>>2]|0,ae=(N+_|0)*3|0,X=ft(7,0,ae|0)|0,j=j&~(ee()|0),_=op(m|0,b|0,E|0,g|0)|0,p=ee()|0,v=At(_|0,p|0,2,0)|0,ae=ft(v|0,ee()|0,ae|0)|0,j=ee()|0|j,v=x,h[v>>2]=ae|K&~X,h[v+4>>2]=j,p=wr(_|0,p|0,E|0,g|0)|0,p=Js(m|0,b|0,p|0,ee()|0)|0,b=0,m=ee()|0;break}else{ae=x,X=h[ae>>2]|0,ae=h[ae+4>>2]|0,K=ft(7,0,(N+_|0)*3|0)|0,ae=ae&~(ee()|0),b=x,h[b>>2]=X&~K,h[b+4>>2]=ae,b=1;break}else X=x,v=h[X>>2]|0,X=h[X+4>>2]|0,_=(N+_|0)*3|0,j=ft(7,0,_|0)|0,X=X&~(ee()|0),ae=op(p|0,m|0,E|0,g|0)|0,b=ee()|0,_=ft(ae|0,b|0,_|0)|0,X=ee()|0|X,K=x,h[K>>2]=_|v&~j,h[K+4>>2]=X,b=wr(ae|0,b|0,E|0,g|0)|0,p=Js(p|0,m|0,b|0,ee()|0)|0,b=0,m=ee()|0;while(!1);if((U|0)>(M|0))_=~M,M=M+1|0;else{m=0;break}}return Q=q,m|0}while(!1);if((U|0)<1)return ae=0,Q=q,ae|0;for(v=E^15,b=1;;)if(K=U-b|0,K=sp(7,0,K,((K|0)<0)<<31>>31)|0,ae=ee()|0,M=x,g=h[M>>2]|0,M=h[M+4>>2]|0,E=(v-b|0)*3|0,_=ft(7,0,E|0)|0,M=M&~(ee()|0),j=op(p|0,m|0,K|0,ae|0)|0,X=ee()|0,E=ft(j|0,X|0,E|0)|0,M=ee()|0|M,N=x,h[N>>2]=E|g&~_,h[N+4>>2]=M,ae=wr(j|0,X|0,K|0,ae|0)|0,p=Js(p|0,m|0,ae|0,ee()|0)|0,m=ee()|0,(U|0)<=(b|0)){m=0;break}else b=b+1|0;return Q=q,m|0}function gL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;v=tt(m|0,g|0,52)|0,ee()|0,v=v&15,(m|0)==0&(g|0)==0|((_|0)>15|(v|0)>(_|0))?(x=-1,m=-1,g=0,v=0):(m=dq(m,g,v+1|0,_)|0,b=(ee()|0)&-15728641,g=ft(_|0,0,52)|0,g=m|g,b=b|(ee()|0),m=(Zi(g,b)|0)==0,x=v,m=m?-1:_,v=b),b=p,h[b>>2]=g,h[b+4>>2]=v,h[p+8>>2]=x,h[p+12>>2]=m}function Aq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;if(v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,x=_+8|0,h[x>>2]=v,(p|0)==0&(m|0)==0|((g|0)>15|(v|0)>(g|0))){g=_,h[g>>2]=0,h[g+4>>2]=0,h[x>>2]=-1,h[_+12>>2]=-1;return}if(p=dq(p,m,v+1|0,g)|0,x=(ee()|0)&-15728641,v=ft(g|0,0,52)|0,v=p|v,x=x|(ee()|0),p=_,h[p>>2]=v,h[p+4>>2]=x,p=_+12|0,Zi(v,x)|0){h[p>>2]=g;return}else{h[p>>2]=-1;return}}function vL(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0;if(g=p,m=h[g>>2]|0,g=h[g+4>>2]|0,!((m|0)==0&(g|0)==0)&&(_=tt(m|0,g|0,52)|0,ee()|0,_=_&15,E=ft(1,0,(_^15)*3|0)|0,m=At(E|0,ee()|0,m|0,g|0)|0,g=ee()|0,E=p,h[E>>2]=m,h[E+4>>2]=g,E=p+8|0,b=h[E>>2]|0,!((_|0)<(b|0)))){for(M=p+12|0,x=_;;){if((x|0)==(b|0)){_=5;break}if(N=(x|0)==(h[M>>2]|0),v=(15-x|0)*3|0,_=tt(m|0,g|0,v|0)|0,ee()|0,_=_&7,N&((_|0)==1&!0)){_=7;break}if(!((_|0)==7&!0)){_=10;break}if(N=ft(1,0,v|0)|0,m=At(m|0,g|0,N|0,ee()|0)|0,g=ee()|0,N=p,h[N>>2]=m,h[N+4>>2]=g,(x|0)>(b|0))x=x+-1|0;else{_=10;break}}if((_|0)==5){N=p,h[N>>2]=0,h[N+4>>2]=0,h[E>>2]=-1,h[M>>2]=-1;return}else if((_|0)==7){b=ft(1,0,v|0)|0,b=At(m|0,g|0,b|0,ee()|0)|0,E=ee()|0,N=p,h[N>>2]=b,h[N+4>>2]=E,h[M>>2]=x+-1;return}else if((_|0)==10)return}}function Xx(p){p=+p;var m=0;return m=p<0?p+6.283185307179586:p,+(p>=6.283185307179586?m+-6.283185307179586:m)}function kl(p,m){switch(p=+p,m=m|0,m|0){case 1:{p=p<0?p+6.283185307179586:p;break}case 2:{p=p>0?p+-6.283185307179586:p;break}default:}return+p}function wue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=+ie[m>>3],_=+ie[p>>3],x=+zi(+((v-_)*.5)),g=+zi(+((+ie[m+8>>3]-+ie[p+8>>3])*.5)),g=x*x+g*(+ii(+v)*+ii(+_)*g),+(+Ta(+ +bs(+g),+ +bs(+(1-g)))*2)}function $x(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=+ie[m>>3],_=+ie[p>>3],x=+zi(+((v-_)*.5)),g=+zi(+((+ie[m+8>>3]-+ie[p+8>>3])*.5)),g=x*x+g*(+ii(+v)*+ii(+_)*g),+(+Ta(+ +bs(+g),+ +bs(+(1-g)))*2*6371.007180918475)}function Sue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=+ie[m>>3],_=+ie[p>>3],x=+zi(+((v-_)*.5)),g=+zi(+((+ie[m+8>>3]-+ie[p+8>>3])*.5)),g=x*x+g*(+ii(+v)*+ii(+_)*g),+(+Ta(+ +bs(+g),+ +bs(+(1-g)))*2*6371.007180918475*1e3)}function gq(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[20624+(p<<3)>>3],m=0,m|0)}function Tue(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[20752+(p<<3)>>3],m=0,m|0)}function Eue(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[20880+(p<<3)>>3],m=0,m|0)}function Mue(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[21008+(p<<3)>>3],m=0,m|0)}function aT(p,m){p=p|0,m=m|0;var g=0;return p>>>0>15?(m=4,m|0):(g=sp(7,0,p,((p|0)<0)<<31>>31)|0,g=wr(g|0,ee()|0,120,0)|0,p=ee()|0,h[m>>2]=g|2,h[m+4>>2]=p,m=0,m|0)}function Cue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(E=Q,Q=Q+176|0,b=E,p=Hx(p,m,b)|0,p|0)return b=p,Q=E,b|0;if(ie[g>>3]=0,p=h[b>>2]|0,(p|0)<=1)return b=0,Q=E,b|0;m=p+-1|0,p=0,_=+ie[b+8>>3],v=+ie[b+16>>3],x=0;do p=p+1|0,N=_,_=+ie[b+8+(p<<4)>>3],U=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=U*U+M*(+ii(+_)*+ii(+N)*M),x=x+ +Ta(+ +bs(+M),+ +bs(+(1-M)))*2;while((p|0)<(m|0));return ie[g>>3]=x,b=0,Q=E,b|0}function Rue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(E=Q,Q=Q+176|0,b=E,p=Hx(p,m,b)|0,p|0)return b=p,x=+ie[g>>3],x=x*6371.007180918475,ie[g>>3]=x,Q=E,b|0;if(ie[g>>3]=0,p=h[b>>2]|0,(p|0)<=1)return b=0,x=0,x=x*6371.007180918475,ie[g>>3]=x,Q=E,b|0;m=p+-1|0,p=0,_=+ie[b+8>>3],v=+ie[b+16>>3],x=0;do p=p+1|0,N=_,_=+ie[b+8+(p<<4)>>3],U=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=U*U+M*(+ii(+N)*+ii(+_)*M),x=x+ +Ta(+ +bs(+M),+ +bs(+(1-M)))*2;while((p|0)!=(m|0));return ie[g>>3]=x,b=0,U=x,U=U*6371.007180918475,ie[g>>3]=U,Q=E,b|0}function Pue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(E=Q,Q=Q+176|0,b=E,p=Hx(p,m,b)|0,p|0)return b=p,x=+ie[g>>3],x=x*6371.007180918475,x=x*1e3,ie[g>>3]=x,Q=E,b|0;if(ie[g>>3]=0,p=h[b>>2]|0,(p|0)<=1)return b=0,x=0,x=x*6371.007180918475,x=x*1e3,ie[g>>3]=x,Q=E,b|0;m=p+-1|0,p=0,_=+ie[b+8>>3],v=+ie[b+16>>3],x=0;do p=p+1|0,N=_,_=+ie[b+8+(p<<4)>>3],U=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=U*U+M*(+ii(+N)*+ii(+_)*M),x=x+ +Ta(+ +bs(+M),+ +bs(+(1-M)))*2;while((p|0)!=(m|0));return ie[g>>3]=x,b=0,U=x,U=U*6371.007180918475,U=U*1e3,ie[g>>3]=U,Q=E,b|0}function Iue(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0;if(p)for(x=p+4|0,b=p+8|0,_=1,v=p;;){if(m=h[v>>2]|0,m|0)do{if(g=h[m>>2]|0,g|0)do E=g,g=h[g+16>>2]|0,_t(E);while((g|0)!=0);E=m,m=h[m+8>>2]|0,_t(E)}while((m|0)!=0);if(m=v,v=h[v+8>>2]|0,_?(h[p>>2]=0,h[x>>2]=0,h[b>>2]=0):_t(m),v)_=0;else break}}function Lue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0;if(h[m>>2]=0,ue=m+4|0,h[ue>>2]=0,xe=m+8|0,h[xe>>2]=0,ae=h[p>>2]|0,(ae|0)<=0)return m=0,m|0;K=p+4|0,p=m,X=0;e:for(;;){if(X){if(g=Ea(1,12)|0,!g){g=5;break}h[p+8>>2]=g,p=g}if(M=h[K>>2]|0,N=Ea(1,12)|0,!N){p=13,g=37;break}if(j=p+4|0,_=h[j>>2]|0,h[((_|0)==0?p:_+8|0)>>2]=N,h[j>>2]=N,_=h[M+(X<<4)>>2]|0,(_|0)<3){p=1,g=37;break}v=M+(X<<4)+4|0,x=N+4|0,g=0,b=0;do{if(E=b,b=br(24)|0,!b){p=13,g=37;break e}EL(b|0,(h[v>>2]|0)+(g<<4)|0,16)|0,h[b+16>>2]=0,E?h[E+16>>2]=b:h[N>>2]=b,h[x>>2]=b,g=g+1|0}while((g|0)<(_|0));if(q=h[M+(X<<4)+8>>2]|0,(q|0)>0){U=M+(X<<4)+12|0,M=0;do{if(_=h[U>>2]|0,g=N,N=Ea(1,12)|0,!N){p=13,g=37;break e}if(h[g+8>>2]=N,h[j>>2]=N,E=h[_+(M<<3)>>2]|0,(E|0)<3){p=1,g=37;break e}_=_+(M<<3)+4|0,v=N+4|0,g=0,x=0;do{if(b=x,x=br(24)|0,!x){p=13,g=37;break e}EL(x|0,(h[_>>2]|0)+(g<<4)|0,16)|0,h[x+16>>2]=0,b?h[b+16>>2]=x:h[N>>2]=x,h[v>>2]=x,g=g+1|0}while((g|0)<(E|0));M=M+1|0}while((M|0)<(q|0))}if(X=X+1|0,(X|0)>=(ae|0)){p=0,g=50;break}}if((g|0)==5){if(!m)return m=13,m|0;for(_=1,v=m;;){if(p=h[v>>2]|0,p|0)do{if(g=h[p>>2]|0,g|0)do ae=g,g=h[g+16>>2]|0,_t(ae);while((g|0)!=0);ae=p,p=h[p+8>>2]|0,_t(ae)}while((p|0)!=0);if(p=v,v=h[v+8>>2]|0,_?(h[m>>2]=0,h[ue>>2]=0,h[xe>>2]=0):_t(p),v)_=0;else{p=13;break}}return p|0}else if((g|0)==37){if(!m)return m=p,m|0;for(v=1,x=m;;){if(g=h[x>>2]|0,g|0)do{if(_=h[g>>2]|0,_|0)do ae=_,_=h[_+16>>2]|0,_t(ae);while((_|0)!=0);ae=g,g=h[g+8>>2]|0,_t(ae)}while((g|0)!=0);if(g=x,x=h[x+8>>2]|0,v?(h[m>>2]=0,h[ue>>2]=0,h[xe>>2]=0):_t(g),x)v=0;else break}return p|0}else if((g|0)==50)return p|0;return 0}function Yx(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0;if(xe=Q,Q=Q+16|0,ue=xe,U=tt(p|0,m|0,52)|0,ee()|0,U=U&15,X=tt(g|0,_|0,52)|0,ee()|0,(U|0)!=(X&15|0))return ue=12,Q=xe,ue|0;if(M=tt(p|0,m|0,45)|0,ee()|0,M=M&127,N=tt(g|0,_|0,45)|0,ee()|0,N=N&127,M>>>0>121|N>>>0>121)return ue=5,Q=xe,ue|0;if(X=(M|0)!=(N|0),X){if(b=rL(M,N)|0,(b|0)==7)return ue=1,Q=xe,ue|0;E=rL(N,M)|0,(E|0)==7?di(27291,27315,164,27325):(ae=b,x=E)}else ae=0,x=0;q=yr(M)|0,j=yr(N)|0,h[ue>>2]=0,h[ue+4>>2]=0,h[ue+8>>2]=0,h[ue+12>>2]=0;do if(ae){N=h[4272+(M*28|0)+(ae<<2)>>2]|0,b=(N|0)>0;e:do if(j)if(b)for(M=0,E=g,b=_;;){switch(E=gue(E,b)|0,b=ee()|0,x|0){case 5:case 1:{x=3;break}case 3:{x=2;break}case 2:{x=6;break}case 6:{x=4;break}case 4:{x=5;break}default:}if(M=M+1|0,(M|0)==(N|0)){N=x,M=E,E=b;break e}}else N=x,M=g,E=_;else if(b)for(M=0,E=g,b=_;;){switch(E=dL(E,b)|0,b=ee()|0,x|0){case 1:{x=3;break}case 3:{x=2;break}case 2:{x=6;break}case 6:{x=4;break}case 4:{x=5;break}case 5:{x=1;break}default:}if(M=M+1|0,(M|0)==(N|0)){N=x,M=E,E=b;break e}}else N=x,M=g,E=_;while(!1);if(mL(M,E,ue)|0,X||di(27340,27315,194,27325),b=(q|0)!=0,x=(j|0)!=0,b&x&&di(27367,27315,195,27325),b){if(x=ll(p,m)|0,(x|0)==7){x=5;break}if(He[21968+(x*7|0)+ae>>0]|0){x=1;break}j=h[21136+(x*28|0)+(ae<<2)>>2]|0,X=j}else if(x){if(x=ll(M,E)|0,(x|0)==7){x=5;break}if(He[21968+(x*7|0)+N>>0]|0){x=1;break}X=0,j=h[21136+(N*28|0)+(x<<2)>>2]|0}else X=0,j=0;if((X|j|0)>=0){if((j|0)>0){g=ue+4|0,_=ue+8|0,q=ue+12|0,N=0,E=h[g>>2]|0,b=h[_>>2]|0,x=h[q>>2]|0;do K=b+E|0,m=(K|0)<0,se=m?K:0,b=x+b-se|0,p=(b|0)<0,M=p?b:0,E=x+E-se-M|0,se=(E|0)<0,x=se?0:E,E=se?E:0,b=(p?0:b)-E|0,E=(m?0:K)-M-E|0,M=(b|0)<(E|0)?b:E,M=(x|0)<(M|0)?x:M,(M|0)>0&&(E=E-M|0,b=b-M|0,x=x-M|0),N=N+1|0;while((N|0)!=(j|0));h[g>>2]=E,h[_>>2]=b,h[q>>2]=x}if((ae+-1|0)>>>0<6?(x=h[22032+(ae*12|0)>>2]|0,E=h[22032+(ae*12|0)+4>>2]|0,se=h[22032+(ae*12|0)+8>>2]|0,b=(E|0)<(x|0)?E:x,b=(se|0)<(b|0)?se:b,b=(b|0)>0?b:0,x=x-b|0,E=E-b|0,b=se-b|0):(x=0,E=0,b=0),U)for(;;)if(M=x*3|0,N=E*3|0,g=b*3|0,_c(U)|0?(m=M+E|0,p=(m|0)<0,se=N+b-(p?m:0)|0,K=(se|0)<0,E=x+g-(p?m:0)-(K?se:0)|0,b=(E|0)<0,ae=b?0:E,M=(K?0:se)-(b?E:0)|0,E=(p?0:m)-(K?se:0)-(b?E:0)|0,b=(M|0)<(E|0)?M:E,b=(ae|0)<(b|0)?ae:b,se=(b|0)>0,x=se?b:0,M=M-(se?b:0)|0,b=ae-(se?b:0)|0):(K=M+b|0,m=(K|0)<0,se=N+x-(m?K:0)|0,x=(se|0)<0,E=g+E-(m?K:0)-(x?se:0)|0,b=(E|0)<0,ae=b?0:E,M=(x?0:se)-(b?E:0)|0,E=(m?0:K)-(x?se:0)-(b?E:0)|0,b=(M|0)<(E|0)?M:E,b=(ae|0)<(b|0)?ae:b,se=(b|0)>0,x=se?b:0,M=M-(se?b:0)|0,b=ae-(se?b:0)|0),x=E-x|0,(U|0)>1)U=U+-1|0,E=M;else{E=M;break}if((X|0)>0){M=0;do m=x+E|0,p=(m|0)<0,se=E+b-(p?m:0)|0,K=(se|0)<0,ae=x+b-(p?m:0)-(K?se:0)|0,x=(ae|0)<0,b=x?0:ae,E=(K?0:se)-(x?ae:0)|0,ae=(p?0:m)-(K?se:0)-(x?ae:0)|0,x=(E|0)<(ae|0)?E:ae,x=(b|0)<(x|0)?b:x,se=(x|0)>0,b=b-(se?x:0)|0,E=E-(se?x:0)|0,x=ae-(se?x:0)|0,M=M+1|0;while((M|0)!=(X|0))}g=ue+4|0,U=ue+8|0,ae=h[U>>2]|0,_=ue+12|0,se=h[_>>2]|0,M=(h[g>>2]|0)+x|0,h[g>>2]=M,E=ae+E|0,h[U>>2]=E,x=se+b|0,h[_>>2]=x,b=E-M|0,(M|0)<0?(x=x-M|0,h[U>>2]=b,h[_>>2]=x,h[g>>2]=0,E=0):(b=E,E=M),(b|0)<0&&(E=E-b|0,h[g>>2]=E,x=x-b|0,h[_>>2]=x,h[U>>2]=0,b=0),N=E-x|0,M=b-x|0,(x|0)<0?(h[g>>2]=N,h[U>>2]=M,h[_>>2]=0,E=N,x=0):M=b,b=(M|0)<(E|0)?M:E,b=(x|0)<(b|0)?x:b,(b|0)>0&&(h[g>>2]=E-b,h[U>>2]=M-b,h[_>>2]=x-b),K=77}else x=5}else if(mL(g,_,ue)|0,(q|0)!=0&(j|0)!=0)if((N|0)!=(M|0)&&di(27398,27315,264,27325),b=ll(p,m)|0,x=ll(g,_)|0,(b|0)==7|(x|0)==7)x=5;else if(He[21968+(b*7|0)+x>>0]|0)x=1;else if(g=h[21136+(b*28|0)+(x<<2)>>2]|0,(g|0)>0){U=ue+4|0,_=ue+8|0,q=ue+12|0,N=0,E=h[U>>2]|0,b=h[_>>2]|0,x=h[q>>2]|0;do ae=b+E|0,K=(ae|0)<0,p=K?ae:0,b=x+b-p|0,m=(b|0)<0,M=m?b:0,E=x+E-p-M|0,p=(E|0)<0,x=p?0:E,E=p?E:0,b=(m?0:b)-E|0,E=(K?0:ae)-M-E|0,M=(b|0)<(E|0)?b:E,M=(x|0)<(M|0)?x:M,(M|0)>0&&(E=E-M|0,b=b-M|0,x=x-M|0),N=N+1|0;while((N|0)!=(g|0));h[U>>2]=E,h[_>>2]=b,h[q>>2]=x,K=77}else K=77;else K=77;while(!1);return(K|0)==77&&(x=ue+4|0,h[v>>2]=h[x>>2],h[v+4>>2]=h[x+4>>2],h[v+8>>2]=h[x+8>>2],x=0),se=x,Q=xe,se|0}function vq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0;if(x=tt(p|0,m|0,52)|0,ee()|0,x=x&15,Ae=tt(p|0,m|0,45)|0,ee()|0,Ae=Ae&127,Ae>>>0>121)return _=5,_|0;if(ue=yr(Ae)|0,ft(x|0,0,52)|0,E=ee()|0|134225919,b=_,h[b>>2]=-1,h[b+4>>2]=E,b=h[g>>2]|0,E=h[g+4>>2]|0,g=h[g+8>>2]|0,!x){m=(b|0)<0,xe=m?b:0,we=E-xe|0,ue=(we|0)<0,xe=(ue?0-we|0:0)+(g-xe)|0,g=(xe|0)<0,v=g?0:xe,xe=g?xe:0,g=(ue?0:we)-xe|0,xe=(m?0:b)-(ue?we:0)-xe|0,we=(g|0)<(xe|0)?g:xe,we=(v|0)<(we|0)?v:we,we=(we|0)>0?we:0,v=v-we|0,g=g-we|0;e:do switch(xe-we|0){case 0:switch(g|0){case 0:if(v){v=(v|0)==1?1:7,se=11;break e}else{v=0;break e}case 1:if(v){v=(v|0)==1?3:7,se=11;break e}else{v=2;break e}default:return _=1,_|0}case 1:switch(g|0){case 0:if(v){v=(v|0)==1?5:7,se=11;break e}else{v=4;break e}case 1:{if(v)v=1;else{v=6;break e}return v|0}default:return _=1,_|0}default:return _=1,_|0}while(!1);return(se|0)==11&&(v|0)==7||(v=iL(Ae,v)|0,(v|0)==127)?(_=1,_|0):(we=ft(v|0,0,45)|0,Ae=ee()|0,se=_,Ae=h[se+4>>2]&-1040385|Ae,h[_>>2]=h[se>>2]|we,h[_+4>>2]=Ae,_=0,_|0)}for(;;){if(ae=x,x=x+-1|0,K=b-g|0,X=E-g|0,M=K>>>0>715827881|X>>>0>715827881,_c(ae)|0){if(M){if(U=(K|0)>0,q=2147483647-K|0,j=-2147483648-K|0,U?(q|0)<(K|0):(j|0)>(K|0)){v=1,se=107;break}if(be=K<<1,U?(2147483647-be|0)<(K|0):(-2147483648-be|0)>(K|0)){v=1,se=107;break}if((X|0)>0?(2147483647-X|0)<(X|0):(-2147483648-X|0)>(X|0)){v=1,se=107;break}if(M=K*3|0,N=X<<1,(U?(q|0)<(N|0):(j|0)>(N|0))||((K|0)>-1?(M|-2147483648|0)>=(X|0):(M^-2147483648|0)<(X|0))){v=1,se=107;break}}else M=K*3|0,N=X<<1;if(q=rh(+(M-X|0)*.14285714285714285)|0,U=rh(+(N+K|0)*.14285714285714285)|0,N=(U|0)<(q|0),M=N?q:U,N=N?U:q,(N|0)<0){if((N|0)==-2147483648||((M|0)>0?(2147483647-M|0)<(N|0):(-2147483648-M|0)>(N|0))){se=24;break}if((M|0)>-1?(M|-2147483648|0)>=(N|0):(M^-2147483648|0)<(N|0)){se=24;break}}j=(q|0)<0,X=U-(j?q:0)|0,Ke=(X|0)<0,Be=(j?0-q|0:0)-(Ke?X:0)|0,K=(Be|0)<0,j=(j?0:q)-(Ke?X:0)-(K?Be:0)|0,X=(Ke?0:X)-(K?Be:0)|0,Be=K?0:Be,K=(X|0)<(j|0)?X:j,K=(Be|0)<(K|0)?Be:K,Ke=(K|0)>0,j=j-(Ke?K:0)|0,X=X-(Ke?K:0)|0,K=Be-(Ke?K:0)|0,Ke=(j*3|0)+X|0,Be=(Ke|0)<0,be=(X*3|0)+K-(Be?Ke:0)|0,M=(be|0)<0,q=(K*3|0)+j-(Be?Ke:0)-(M?be:0)|0,U=(q|0)<0,Me=U?0:q,N=(M?0:be)-(U?q:0)|0,q=(Be?0:Ke)-(M?be:0)-(U?q:0)|0,U=(N|0)<(q|0)?N:q,U=(Me|0)<(U|0)?Me:U,be=(U|0)>0,M=be?U:0,N=N-(be?U:0)|0,U=Me-(be?U:0)|0}else{if(M){if(N=(K|0)>0,N?(2147483647-K|0)<(K|0):(-2147483648-K|0)>(K|0)){v=1,se=107;break}if(M=K<<1,U=(X|0)>0,U?(2147483647-X|0)<(X|0):(-2147483648-X|0)>(X|0)){v=1,se=107;break}if(j=X<<1,U?(2147483647-j|0)<(X|0):(-2147483648-j|0)>(X|0)){v=1,se=107;break}if(N?(2147483647-M|0)<(X|0):(-2147483648-M|0)>(X|0)){v=1,se=107;break}if(N=X*3|0,(X|0)>-1?(N|-2147483648|0)>=(K|0):(N^-2147483648|0)<(K|0)){v=1,se=107;break}}else M=K<<1,N=X*3|0;if(q=rh(+(M+X|0)*.14285714285714285)|0,U=rh(+(N-K|0)*.14285714285714285)|0,N=(U|0)<(q|0),M=N?q:U,N=N?U:q,(N|0)<0){if((N|0)==-2147483648||((M|0)>0?(2147483647-M|0)<(N|0):(-2147483648-M|0)>(N|0))){se=36;break}if((M|0)>-1?(M|-2147483648|0)>=(N|0):(M^-2147483648|0)<(N|0)){se=36;break}}j=(q|0)<0,X=U-(j?q:0)|0,Me=(X|0)<0,be=(j?0-q|0:0)-(Me?X:0)|0,K=(be|0)<0,j=(j?0:q)-(Me?X:0)-(K?be:0)|0,X=(Me?0:X)-(K?be:0)|0,be=K?0:be,K=(X|0)<(j|0)?X:j,K=(be|0)<(K|0)?be:K,Me=(K|0)>0,j=j-(Me?K:0)|0,X=X-(Me?K:0)|0,K=be-(Me?K:0)|0,Me=(j*3|0)+K|0,be=(Me|0)<0,Be=(X*3|0)+j-(be?Me:0)|0,M=(Be|0)<0,q=(K*3|0)+X-(be?Me:0)-(M?Be:0)|0,U=(q|0)<0,Ke=U?0:q,N=(M?0:Be)-(U?q:0)|0,q=(be?0:Me)-(M?Be:0)-(U?q:0)|0,U=(N|0)<(q|0)?N:q,U=(Ke|0)<(U|0)?Ke:U,Be=(U|0)>0,M=Be?U:0,N=N-(Be?U:0)|0,U=Ke-(Be?U:0)|0}M=b+(M-q)|0,Me=(M|0)<0,N=E-N-(Me?M:0)|0,q=(N|0)<0,Be=g-U+(Me?0-M|0:0)+(q?0-N|0:0)|0,b=(Be|0)<0,U=b?0:Be,be=(q?0:N)-(b?Be:0)|0,Be=(Me?0:M)-(q?N:0)-(b?Be:0)|0,b=(be|0)<(Be|0)?be:Be,b=(U|0)<(b|0)?U:b,g=(b|0)>0,Be=Be-(g?b:0)|0,N=_,q=h[N>>2]|0,N=h[N+4>>2]|0,E=(15-ae|0)*3|0,M=ft(7,0,E|0)|0,M=q&~M,N=N&~(ee()|0),q=(Be|0)<0,Me=q?Be:0,be=be-(g?b:0)-Me|0,Ke=(be|0)<0,Me=(Ke?0-be|0:0)+(U-(g?b:0)-Me)|0,b=(Me|0)<0,g=b?0:Me,Me=b?Me:0,b=(Ke?0:be)-Me|0,Me=(q?0:Be)-(Ke?be:0)-Me|0,be=(b|0)<(Me|0)?b:Me,be=(g|0)<(be|0)?g:be,be=(be|0)>0?be:0,g=g-be|0,b=b-be|0;e:do switch(Me-be|0){case 0:switch(b|0){case 0:{g=(g|0)==0?0:(g|0)==1?1:7;break e}case 1:{g=(g|0)==0?2:(g|0)==1?3:7;break e}default:{se=45;break e}}case 1:switch(b|0){case 0:{g=(g|0)==0?4:(g|0)==1?5:7;break e}case 1:if(g){se=45;break e}else{g=6;break e}default:{se=45;break e}}default:se=45}while(!1);if((se|0)==45&&(se=0,g=7),Ke=ft(g|0,0,E|0)|0,Me=ee()|0|N,be=_,h[be>>2]=Ke|M,h[be+4>>2]=Me,(ae|0)<=1){se=47;break}else b=j,E=X,g=K}if((se|0)==24)di(27634,27425,416,27447);else if((se|0)==36)di(27634,27425,464,27461);else if((se|0)==47){if((j|0)>1|(X|0)>1|(K|0)>1)return be=1,be|0;Be=(j|0)<0,Me=Be?j:0,be=X-Me|0,Ke=(be|0)<0,Me=(Ke?0-be|0:0)+(K-Me)|0,x=(Me|0)<0,g=x?0:Me,Me=x?Me:0,x=(Ke?0:be)-Me|0,Me=(Be?0:j)-(Ke?be:0)-Me|0,be=(x|0)<(Me|0)?x:Me,be=(g|0)<(be|0)?g:be,be=(be|0)>0?be:0,g=g-be|0,x=x-be|0;e:do switch(Me-be|0){case 0:switch(x|0){case 0:{x=(g|0)==0?0:(g|0)==1?1:7;break e}case 1:{x=(g|0)==0?2:(g|0)==1?3:7;break e}default:{se=55;break e}}case 1:switch(x|0){case 0:{x=(g|0)==0?4:(g|0)==1?5:7;break e}case 1:if(g){se=55;break e}else{x=6;break e}default:{se=55;break e}}default:se=55}while(!1);(se|0)==55&&(x=7),E=iL(Ae,x)|0,(E|0)==127?N=0:N=yr(E)|0;e:do if(x){if(ue){if(g=ll(p,m)|0,(g|0)==7)return be=5,be|0;b=h[21344+(g*28|0)+(x<<2)>>2]|0;t:do if((b|0)>0)for(g=x,x=0;;){switch(g|0){case 1:{g=5;break}case 5:{g=4;break}case 4:{g=6;break}case 6:{g=2;break}case 2:{g=3;break}case 3:{g=1;break}default:}if(x=x+1|0,(x|0)==(b|0))break t}else g=x;while(!1);if((g|0)==1)return be=9,be|0;x=iL(Ae,g)|0,(x|0)==127&&di(27476,27315,415,27506),yr(x)|0?di(27521,27315,416,27506):(v=x,we=b,xe=g)}else v=E,we=0,xe=x;if(M=h[4272+(Ae*28|0)+(xe<<2)>>2]|0,(M|0)<=-1&&di(27552,27315,423,27506),!N){if((we|0)<0)return be=5,be|0;if(we|0){b=_,g=0,x=h[b>>2]|0,b=h[b+4>>2]|0;do x=km(x,b)|0,b=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=b,g=g+1|0;while((g|0)<(we|0))}if((M|0)<=0){se=104;break}for(b=_,g=0,x=h[b>>2]|0,b=h[b+4>>2]|0;;)if(x=km(x,b)|0,b=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=b,g=g+1|0,(g|0)==(M|0)){se=104;break e}}if(E=rL(v,Ae)|0,(E|0)==7&&di(27291,27315,432,27506),g=_,x=h[g>>2]|0,g=h[g+4>>2]|0,(M|0)>0){b=0;do x=km(x,g)|0,g=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=g,b=b+1|0;while((b|0)!=(M|0))}if(g=ll(x,g)|0,(g|0)==7&&di(27634,27315,444,27506),x=nL(v)|0,x=h[(x?21760:21552)+(E*28|0)+(g<<2)>>2]|0,(x|0)<0&&di(27634,27315,458,27506),!x)se=104;else{E=_,g=0,b=h[E>>2]|0,E=h[E+4>>2]|0;do b=fL(b,E)|0,E=ee()|0,be=_,h[be>>2]=b,h[be+4>>2]=E,g=g+1|0;while((g|0)<(x|0));se=104}}else if((ue|0)!=0&(N|0)!=0){if(v=ll(p,m)|0,g=_,g=ll(h[g>>2]|0,h[g+4>>2]|0)|0,(v|0)==7|(g|0)==7||(g=h[21344+(v*28|0)+(g<<2)>>2]|0,(g|0)<0))return be=5,be|0;if(!g)v=E,se=105;else{b=_,v=0,x=h[b>>2]|0,b=h[b+4>>2]|0;do x=km(x,b)|0,b=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=b,v=v+1|0;while((v|0)<(g|0));v=E,se=104}}else v=E,se=104;while(!1);return(se|0)==104&&N&&(se=105),(se|0)==105&&(be=_,(ll(h[be>>2]|0,h[be+4>>2]|0)|0)==1)?(be=9,be|0):(Me=_,Be=h[Me>>2]|0,Me=h[Me+4>>2]&-1040385,Ke=ft(v|0,0,45)|0,Me=Me|(ee()|0),be=_,h[be>>2]=Be|Ke,h[be+4>>2]=Me,be=0,be|0)}else if((se|0)==107)return v|0;return 0}function Due(p,m,g,_,v,x){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0;var b=0,E=0;return E=Q,Q=Q+16|0,b=E,v|0?(b=15,Q=E,b|0):(p=Yx(p,m,g,_,b)|0,p||(v=h[b+4>>2]|0,p=h[b+8>>2]|0,h[x>>2]=(h[b>>2]|0)-p,h[x+4>>2]=v-p,p=0),b=p,Q=E,b|0)}function Nue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0;return q=Q,Q=Q+16|0,U=q,_|0?(U=15,Q=q,U|0):(E=h[g>>2]|0,b=h[g+4>>2]|0,h[U>>2]=E,M=U+4|0,h[M>>2]=b,N=U+8|0,h[N>>2]=0,g=(b|0)<(E|0),_=g?E:b,g=g?b:E,(g|0)<0?!((g|0)==-2147483648||((_|0)>0?(2147483647-_|0)<(g|0):(-2147483648-_|0)>(g|0)))&&!((_|0)>-1?(_|-2147483648|0)>=(g|0):(_^-2147483648|0)<(g|0))?x=5:_=1:x=5,(x|0)==5&&(_=b-E|0,x=0-E|0,(E|0)<0?(h[M>>2]=_,h[N>>2]=x,h[U>>2]=0,E=0):(_=b,x=0),b=E-_|0,g=x-_|0,(_|0)<0?(h[U>>2]=b,h[N>>2]=g,h[M>>2]=0,E=b,_=0):g=x,b=E-g|0,x=_-g|0,(g|0)<0?(h[U>>2]=b,h[M>>2]=x,h[N>>2]=0,g=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[U>>2]=b-_,h[M>>2]=x-_,h[N>>2]=g-_),_=vq(p,m,U,v)|0),U=_,Q=q,U|0)}function _L(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0;return M=Q,Q=Q+32|0,b=M+12|0,E=M,x=Yx(p,m,p,m,b)|0,x|0?(E=x,Q=M,E|0):(p=Yx(p,m,g,_,E)|0,p|0?(E=p,Q=M,E|0):(p=(h[b>>2]|0)-(h[E>>2]|0)|0,N=(p|0)<0,_=N?0-p|0:0,g=_+((h[b+4>>2]|0)-(h[E+4>>2]|0))|0,m=(g|0)<0,_=(h[b+8>>2]|0)-(h[E+8>>2]|0)+_+(m?0-g|0:0)|0,x=(_|0)<0,b=x?0:_,_=x?_:0,x=(m?0:g)-_|0,_=(N?0:p)-(m?g:0)-_|0,E=(x|0)<(_|0)?x:_,E=(b|0)<(E|0)?b:E,E=(E|0)>0?E:0,b=b-E|0,x=x-E|0,E=_-E|0,E=(E|0)>-1?E:0-E|0,x=(x|0)>-1?x:0-x|0,b=(b|0)>-1?b:0-b|0,b=(x|0)>(b|0)?x:b,b=(E|0)>(b|0)?E:b,E=v,h[E>>2]=b,h[E+4>>2]=((b|0)<0)<<31>>31,E=0,Q=M,E|0))}function Fue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0;return b=Q,Q=Q+16|0,x=b,p=_L(p,m,g,_,x)|0,p|0?(x=p,Q=b,x|0):(g=x,g=At(h[g>>2]|0,h[g+4>>2]|0,1,0)|0,_=ee()|0,x=v,h[x>>2]=g,h[x+4>>2]=_,x=0,Q=b,x|0)}function Bue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0;return M=Q,Q=Q+16|0,x=M,b=_L(p,m,g,_,x)|0,b|0?(v=b,Q=M,v|0):(b=x,x=h[b>>2]|0,b=h[b+4>>2]|0,(x|0)==0&(b|0)==0?(h[v>>2]=p,h[v+4>>2]=m,v=0,Q=M,v|0):(E=_q(p,m,g,_,x,b,v,0,0,1,0)|0,E?(v=(_q(g,_,p,m,x,b,v,x,b,-1,-1)|0)==0,v=v?0:E,Q=M,v|0):(v=0,Q=M,v|0)))}function _q(p,m,g,_,v,x,b,E,M,N,U){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0,E=E|0,M=M|0,N=N|0,U=U|0;var q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0;if(Ut=Q,Q=Q+48|0,q=Ut+24|0,j=Ut+12|0,je=Ut,h[q>>2]=0,h[q+4>>2]=0,h[q+8>>2]=0,h[j>>2]=0,h[j+4>>2]=0,h[j+8>>2]=0,Yx(p,m,p,m,q)|0&&di(27634,27315,696,27575),Yx(p,m,g,_,j)|0&&di(27634,27315,701,27575),ae=q+8|0,_=h[ae>>2]|0,g=_-(h[q>>2]|0)|0,h[q>>2]=g,gt=q+4|0,_=(h[gt>>2]|0)-_|0,h[gt>>2]=_,gt=_+g|0,q=0-gt|0,h[ae>>2]=q,ae=j+8|0,se=h[ae>>2]|0,xe=se-(h[j>>2]|0)|0,h[j>>2]=xe,be=j+4|0,se=(h[be>>2]|0)-se|0,h[be>>2]=se,be=se+xe|0,h[ae>>2]=0-be,Me=1/(+(v>>>0)+4294967296*+(x|0)),Be=Me*+(xe-g|0),Ke=Me*+(se-_|0),Me=Me*+(gt-be|0),h[je>>2]=g,be=je+4|0,h[be>>2]=_,gt=je+8|0,h[gt>>2]=q,(x|0)<0)return N=0,Q=Ut,N|0;for(Ae=+(g|0),we=+(_|0),ue=+(q|0),xe=0,se=0;;){if(K=+(xe>>>0)+4294967296*+(se|0),lt=Be*K+Ae,X=Ke*K+we,K=Me*K+ue,_=~~+mT(+lt),q=~~+mT(+X),g=~~+mT(+K),lt=+Ks(+(+(_|0)-lt)),X=+Ks(+(+(q|0)-X)),K=+Ks(+(+(g|0)-K)),lt>X&lt>K?(j=g+q|0,_=0-j|0):(j=0-_|0,X>K&&(q=j-g|0)),h[be>>2]=q,h[je>>2]=j,h[gt>>2]=0,g=_+q|0,(_|0)>0?(h[be>>2]=g,h[gt>>2]=_,h[je>>2]=0,j=0):(g=q,_=0),(g|0)<0?(q=j-g|0,h[je>>2]=q,_=_-g|0,h[gt>>2]=_,h[be>>2]=0,j=q-_|0,g=0-_|0,(_|0)<0?(h[je>>2]=j,h[be>>2]=g,h[gt>>2]=0,ae=g,_=0):(ae=0,j=q)):ae=g,g=(ae|0)<(j|0)?ae:j,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[je>>2]=j-g,h[be>>2]=ae-g,h[gt>>2]=_-g),g=wr(xe|0,se|0,N|0,U|0)|0,g=At(g|0,ee()|0,E|0,M|0)|0,ee()|0,g=vq(p,m,je,b+(g<<3)|0)|0,g|0){_=20;break}if(ae=xe,xe=At(xe|0,se|0,1,0)|0,j=se,se=ee()|0,!((j|0)<(x|0)|(j|0)==(x|0)&ae>>>0<v>>>0)){g=0,_=20;break}}return(_|0)==20?(Q=Ut,g|0):0}function sp(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;if((g|0)==0&(_|0)==0)return v=0,x=1,On(v|0),x|0;x=p,v=m,p=1,m=0;do b=(g&1|0)==0&!0,p=wr((b?1:x)|0,(b?0:v)|0,p|0,m|0)|0,m=ee()|0,g=Dq(g|0,_|0,1)|0,_=ee()|0,x=wr(x|0,v|0,x|0,v|0)|0,v=ee()|0;while(!((g|0)==0&(_|0)==0));return On(m|0),p|0}function xL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0;E=Q,Q=Q+16|0,x=E,b=tt(p|0,m|0,52)|0,ee()|0,b=b&15;do if(b){if(v=w1(p,m,x)|0,!v){N=+ie[x>>3],M=1/+ii(+N),U=+ie[26032+(b<<3)>>3],ie[g>>3]=N+U,ie[g+8>>3]=N-U,N=+ie[x+8>>3],M=U*M,ie[g+16>>3]=M+N,ie[g+24>>3]=N-M;break}return b=v,Q=E,b|0}else{if(v=tt(p|0,m|0,45)|0,ee()|0,v=v&127,v>>>0>121)return b=5,Q=E,b|0;x=22128+(v<<5)|0,h[g>>2]=h[x>>2],h[g+4>>2]=h[x+4>>2],h[g+8>>2]=h[x+8>>2],h[g+12>>2]=h[x+12>>2],h[g+16>>2]=h[x+16>>2],h[g+20>>2]=h[x+20>>2],h[g+24>>2]=h[x+24>>2],h[g+28>>2]=h[x+28>>2];break}while(!1);return Zce(g,_?1.4:1.1),_=26160+(b<<3)|0,(h[_>>2]|0)==(p|0)&&(h[_+4>>2]|0)==(m|0)&&(ie[g>>3]=1.5707963267948966),b=26288+(b<<3)|0,(h[b>>2]|0)==(p|0)&&(h[b+4>>2]|0)==(m|0)&&(ie[g+8>>3]=-1.5707963267948966),+ie[g>>3]!=1.5707963267948966&&+ie[g+8>>3]!=-1.5707963267948966?(b=0,Q=E,b|0):(ie[g+16>>3]=3.141592653589793,ie[g+24>>3]=-3.141592653589793,b=0,Q=E,b|0)}function Oue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0;N=Q,Q=Q+48|0,b=N+32|0,x=N+40|0,E=N,uL(b,0,0,0),M=h[b>>2]|0,b=h[b+4>>2]|0;do if(g>>>0<=15){if(v=Kx(_)|0,v|0){_=E,h[_>>2]=0,h[_+4>>2]=0,h[E+8>>2]=v,h[E+12>>2]=-1,_=E+16|0,M=E+29|0,h[_>>2]=0,h[_+4>>2]=0,h[_+8>>2]=0,He[_+12>>0]=0,He[M>>0]=He[x>>0]|0,He[M+1>>0]=He[x+1>>0]|0,He[M+2>>0]=He[x+2>>0]|0;break}if(v=Ea((h[m+8>>2]|0)+1|0,32)|0,v){yL(m,v),U=E,h[U>>2]=M,h[U+4>>2]=b,h[E+8>>2]=0,h[E+12>>2]=g,h[E+16>>2]=_,h[E+20>>2]=m,h[E+24>>2]=v,He[E+28>>0]=0,M=E+29|0,He[M>>0]=He[x>>0]|0,He[M+1>>0]=He[x+1>>0]|0,He[M+2>>0]=He[x+2>>0]|0;break}else{_=E,h[_>>2]=0,h[_+4>>2]=0,h[E+8>>2]=13,h[E+12>>2]=-1,_=E+16|0,M=E+29|0,h[_>>2]=0,h[_+4>>2]=0,h[_+8>>2]=0,He[_+12>>0]=0,He[M>>0]=He[x>>0]|0,He[M+1>>0]=He[x+1>>0]|0,He[M+2>>0]=He[x+2>>0]|0;break}}else M=E,h[M>>2]=0,h[M+4>>2]=0,h[E+8>>2]=4,h[E+12>>2]=-1,M=E+16|0,U=E+29|0,h[M>>2]=0,h[M+4>>2]=0,h[M+8>>2]=0,He[M+12>>0]=0,He[U>>0]=He[x>>0]|0,He[U+1>>0]=He[x+1>>0]|0,He[U+2>>0]=He[x+2>>0]|0;while(!1);lT(E),h[p>>2]=h[E>>2],h[p+4>>2]=h[E+4>>2],h[p+8>>2]=h[E+8>>2],h[p+12>>2]=h[E+12>>2],h[p+16>>2]=h[E+16>>2],h[p+20>>2]=h[E+20>>2],h[p+24>>2]=h[E+24>>2],h[p+28>>2]=h[E+28>>2],Q=N}function lT(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0;if(Ae=Q,Q=Q+336|0,X=Ae+168|0,K=Ae,_=p,g=h[_>>2]|0,_=h[_+4>>2]|0,(g|0)==0&(_|0)==0){Q=Ae;return}if(m=p+28|0,He[m>>0]|0?(g=xq(g,_)|0,_=ee()|0):He[m>>0]=1,we=p+20|0,!(h[h[we>>2]>>2]|0)){m=p+24|0,g=h[m>>2]|0,g|0&&_t(g),se=p,h[se>>2]=0,h[se+4>>2]=0,h[p+8>>2]=0,h[we>>2]=0,h[p+12>>2]=-1,h[p+16>>2]=0,h[m>>2]=0,Q=Ae;return}se=p+16|0,m=h[se>>2]|0,v=m&15;e:do if((g|0)==0&(_|0)==0)xe=p+24|0;else{ae=p+12|0,q=(v|0)==3,U=m&255,M=(v|1|0)==3,j=p+24|0,N=(v+-1|0)>>>0<3,b=(v|2|0)==3,E=K+8|0;t:for(;;){if(x=tt(g|0,_|0,52)|0,ee()|0,x=x&15,(x|0)==(h[ae>>2]|0)){switch(U&15){case 0:case 2:case 3:{if(v=w1(g,_,X)|0,v|0){ue=15;break t}if(bL(h[we>>2]|0,h[j>>2]|0,X)|0){ue=19;break t}break}default:}if(M&&(v=h[(h[we>>2]|0)+4>>2]|0,h[X>>2]=h[v>>2],h[X+4>>2]=h[v+4>>2],h[X+8>>2]=h[v+8>>2],h[X+12>>2]=h[v+12>>2],rq(26896,X)|0)){if(pL(h[(h[we>>2]|0)+4>>2]|0,x,K)|0){ue=25;break}if(v=K,(h[v>>2]|0)==(g|0)&&(h[v+4>>2]|0)==(_|0)){ue=29;break}}if(N){if(v=zm(g,_,X)|0,v|0){ue=32;break}if(xL(g,_,K,0)|0){ue=36;break}if(b&&bq(h[we>>2]|0,h[j>>2]|0,X,K)|0){ue=42;break}if(M&&wq(h[we>>2]|0,h[j>>2]|0,X,K)|0){ue=42;break}}if(q){if(m=xL(g,_,X,1)|0,v=h[j>>2]|0,m|0){ue=45;break}if(sL(v,X)|0){if(oq(K,X),sq(X,h[j>>2]|0)|0){ue=53;break}if(bL(h[we>>2]|0,h[j>>2]|0,E)|0){ue=53;break}if(wq(h[we>>2]|0,h[j>>2]|0,K,X)|0){ue=53;break}}}}do if((x|0)<(h[ae>>2]|0)){if(m=xL(g,_,X,1)|0,v=h[j>>2]|0,m|0){ue=58;break t}if(!(sL(v,X)|0)){ue=73;break}if(sq(h[j>>2]|0,X)|0&&(oq(K,X),bq(h[we>>2]|0,h[j>>2]|0,K,X)|0)){ue=65;break t}if(g=pq(g,_,x+1|0,K)|0,g|0){ue=67;break t}_=K,g=h[_>>2]|0,_=h[_+4>>2]|0}else ue=73;while(!1);if((ue|0)==73&&(ue=0,g=xq(g,_)|0,_=ee()|0),(g|0)==0&(_|0)==0){xe=j;break e}}switch(ue|0){case 15:{m=h[j>>2]|0,m|0&&_t(m),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=v,ue=20;break}case 19:{h[p>>2]=g,h[p+4>>2]=_,ue=20;break}case 25:{di(27634,27600,470,27611);break}case 29:{h[p>>2]=g,h[p+4>>2]=_,Q=Ae;return}case 32:{m=h[j>>2]|0,m|0&&_t(m),xe=p,h[xe>>2]=0,h[xe+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=v,Q=Ae;return}case 36:{di(27634,27600,493,27611);break}case 42:{h[p>>2]=g,h[p+4>>2]=_,Q=Ae;return}case 45:{v|0&&_t(v),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=m,ue=55;break}case 53:{h[p>>2]=g,h[p+4>>2]=_,ue=55;break}case 58:{v|0&&_t(v),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=m,ue=71;break}case 65:{h[p>>2]=g,h[p+4>>2]=_,ue=71;break}case 67:{m=h[j>>2]|0,m|0&&_t(m),xe=p,h[xe>>2]=0,h[xe+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=g,Q=Ae;return}}if((ue|0)==20){Q=Ae;return}else if((ue|0)==55){Q=Ae;return}else if((ue|0)==71){Q=Ae;return}}while(!1);m=h[xe>>2]|0,m|0&&_t(m),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[p+8>>2]=0,h[we>>2]=0,h[p+12>>2]=-1,h[se>>2]=0,h[xe>>2]=0,Q=Ae}function xq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;q=Q,Q=Q+16|0,U=q,_=tt(p|0,m|0,52)|0,ee()|0,_=_&15,g=tt(p|0,m|0,45)|0,ee()|0;do if(_){for(;g=ft(_+4095|0,0,52)|0,v=ee()|0|m&-15728641,x=(15-_|0)*3|0,b=ft(7,0,x|0)|0,E=ee()|0,g=g|p|b,v=v|E,M=tt(p|0,m|0,x|0)|0,ee()|0,M=M&7,_=_+-1|0,!(M>>>0<6);)if(_)m=v,p=g;else{N=4;break}if((N|0)==4){g=tt(g|0,v|0,45)|0,ee()|0;break}return U=(M|0)==0&(Zi(g,v)|0)!=0,U=ft((U?2:1)+M|0,0,x|0)|0,N=ee()|0|m&~E,U=U|p&~b,On(N|0),Q=q,U|0}while(!1);return g=g&127,g>>>0>120?(N=0,U=0,On(N|0),Q=q,U|0):(uL(U,0,g+1|0,0),N=h[U+4>>2]|0,U=h[U>>2]|0,On(N|0),Q=q,U|0)}function Uue(p,m,g,_,v,x){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0;var b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0;ue=Q,Q=Q+160|0,q=ue+80|0,E=ue+64|0,j=ue+112|0,ae=ue,Oue(q,p,m,g),N=q,gL(E,h[N>>2]|0,h[N+4>>2]|0,m),N=E,M=h[N>>2]|0,N=h[N+4>>2]|0,b=h[q+8>>2]|0,X=j+4|0,h[X>>2]=h[q>>2],h[X+4>>2]=h[q+4>>2],h[X+8>>2]=h[q+8>>2],h[X+12>>2]=h[q+12>>2],h[X+16>>2]=h[q+16>>2],h[X+20>>2]=h[q+20>>2],h[X+24>>2]=h[q+24>>2],h[X+28>>2]=h[q+28>>2],X=ae,h[X>>2]=M,h[X+4>>2]=N,X=ae+8|0,h[X>>2]=b,p=ae+12|0,m=j,g=p+36|0;do h[p>>2]=h[m>>2],p=p+4|0,m=m+4|0;while((p|0)<(g|0));if(j=ae+48|0,h[j>>2]=h[E>>2],h[j+4>>2]=h[E+4>>2],h[j+8>>2]=h[E+8>>2],h[j+12>>2]=h[E+12>>2],(M|0)==0&(N|0)==0)return ae=b,Q=ue,ae|0;g=ae+16|0,U=ae+24|0,q=ae+28|0,b=0,E=0,m=M,p=N;do{if(!((b|0)<(v|0)|(b|0)==(v|0)&E>>>0<_>>>0)){K=4;break}if(N=E,E=At(E|0,b|0,1,0)|0,b=ee()|0,N=x+(N<<3)|0,h[N>>2]=m,h[N+4>>2]=p,vL(j),p=j,m=h[p>>2]|0,p=h[p+4>>2]|0,(m|0)==0&(p|0)==0){if(lT(g),m=g,p=h[m>>2]|0,m=h[m+4>>2]|0,(p|0)==0&(m|0)==0){K=10;break}Aq(p,m,h[q>>2]|0,j),p=j,m=h[p>>2]|0,p=h[p+4>>2]|0}N=ae,h[N>>2]=m,h[N+4>>2]=p}while(!((m|0)==0&(p|0)==0));return(K|0)==4?(p=ae+40|0,m=h[p>>2]|0,m|0&&_t(m),K=ae+16|0,h[K>>2]=0,h[K+4>>2]=0,h[U>>2]=0,h[ae+36>>2]=0,h[q>>2]=-1,h[ae+32>>2]=0,h[p>>2]=0,Aq(0,0,0,j),h[ae>>2]=0,h[ae+4>>2]=0,h[X>>2]=0,ae=14,Q=ue,ae|0):((K|0)==10&&(h[ae>>2]=0,h[ae+4>>2]=0,h[X>>2]=h[U>>2]),ae=h[X>>2]|0,Q=ue,ae|0)}function kue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0;if(q=Q,Q=Q+48|0,M=q+32|0,E=q+40|0,N=q,!(h[p>>2]|0))return U=_,h[U>>2]=0,h[U+4>>2]=0,U=0,Q=q,U|0;uL(M,0,0,0),b=M,v=h[b>>2]|0,b=h[b+4>>2]|0;do if(m>>>0>15)U=N,h[U>>2]=0,h[U+4>>2]=0,h[N+8>>2]=4,h[N+12>>2]=-1,U=N+16|0,g=N+29|0,h[U>>2]=0,h[U+4>>2]=0,h[U+8>>2]=0,He[U+12>>0]=0,He[g>>0]=He[E>>0]|0,He[g+1>>0]=He[E+1>>0]|0,He[g+2>>0]=He[E+2>>0]|0,g=4,U=9;else{if(g=Kx(g)|0,g|0){M=N,h[M>>2]=0,h[M+4>>2]=0,h[N+8>>2]=g,h[N+12>>2]=-1,M=N+16|0,U=N+29|0,h[M>>2]=0,h[M+4>>2]=0,h[M+8>>2]=0,He[M+12>>0]=0,He[U>>0]=He[E>>0]|0,He[U+1>>0]=He[E+1>>0]|0,He[U+2>>0]=He[E+2>>0]|0,U=9;break}if(g=Ea((h[p+8>>2]|0)+1|0,32)|0,!g){U=N,h[U>>2]=0,h[U+4>>2]=0,h[N+8>>2]=13,h[N+12>>2]=-1,U=N+16|0,g=N+29|0,h[U>>2]=0,h[U+4>>2]=0,h[U+8>>2]=0,He[U+12>>0]=0,He[g>>0]=He[E>>0]|0,He[g+1>>0]=He[E+1>>0]|0,He[g+2>>0]=He[E+2>>0]|0,g=13,U=9;break}yL(p,g),X=N,h[X>>2]=v,h[X+4>>2]=b,b=N+8|0,h[b>>2]=0,h[N+12>>2]=m,h[N+20>>2]=p,h[N+24>>2]=g,He[N+28>>0]=0,v=N+29|0,He[v>>0]=He[E>>0]|0,He[v+1>>0]=He[E+1>>0]|0,He[v+2>>0]=He[E+2>>0]|0,h[N+16>>2]=3,j=+Xce(g),j=j*+Wce(g),x=+Ks(+ +ie[g>>3]),x=j/+ii(+ +pT(+x,+ +Ks(+ +ie[g+8>>3])))*6371.007180918475*6371.007180918475,v=N+12|0,g=h[v>>2]|0;e:do if((g|0)>0)do{if(gq(g+-1|0,M)|0,!(x/+ie[M>>3]>10))break e;X=h[v>>2]|0,g=X+-1|0,h[v>>2]=g}while((X|0)>1);while(!1);if(lT(N),v=_,h[v>>2]=0,h[v+4>>2]=0,v=N,g=h[v>>2]|0,v=h[v+4>>2]|0,!((g|0)==0&(v|0)==0))do jx(g,v,m,M)|0,E=M,p=_,E=At(h[p>>2]|0,h[p+4>>2]|0,h[E>>2]|0,h[E+4>>2]|0)|0,p=ee()|0,X=_,h[X>>2]=E,h[X+4>>2]=p,lT(N),X=N,g=h[X>>2]|0,v=h[X+4>>2]|0;while(!((g|0)==0&(v|0)==0));g=h[b>>2]|0}while(!1);return X=g,Q=q,X|0}function Zx(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;if(!(rq(m,g)|0)||(m=jce(m)|0,_=+ie[g>>3],v=+ie[g+8>>3],v=m&v<0?v+6.283185307179586:v,j=h[p>>2]|0,(j|0)<=0))return j=0,j|0;if(q=h[p+4>>2]|0,m){m=0,U=v,g=-1,p=0;e:for(;;){for(N=p;b=+ie[q+(N<<4)>>3],v=+ie[q+(N<<4)+8>>3],p=(g+2|0)%(j|0)|0,x=+ie[q+(p<<4)>>3],E=+ie[q+(p<<4)+8>>3],b>x?(M=b,b=E):(M=x,x=b,b=v,v=E),_=_==x|_==M?_+2220446049250313e-31:_,!!(_<x|_>M);)if(g=N+1|0,(g|0)>=(j|0)){g=22;break e}else p=N,N=g,g=p;if(E=b<0?b+6.283185307179586:b,b=v<0?v+6.283185307179586:v,U=E==U|b==U?U+-2220446049250313e-31:U,M=E+(b-E)*((_-x)/(M-x)),(M<0?M+6.283185307179586:M)>U&&(m=m^1),p=N+1|0,(p|0)>=(j|0)){g=22;break}else g=N}if((g|0)==22)return m|0}else{m=0,U=v,g=-1,p=0;e:for(;;){for(N=p;b=+ie[q+(N<<4)>>3],v=+ie[q+(N<<4)+8>>3],p=(g+2|0)%(j|0)|0,x=+ie[q+(p<<4)>>3],E=+ie[q+(p<<4)+8>>3],b>x?(M=b,b=E):(M=x,x=b,b=v,v=E),_=_==x|_==M?_+2220446049250313e-31:_,!!(_<x|_>M);)if(g=N+1|0,(g|0)>=(j|0)){g=22;break e}else p=N,N=g,g=p;if(U=b==U|v==U?U+-2220446049250313e-31:U,b+(v-b)*((_-x)/(M-x))>U&&(m=m^1),p=N+1|0,(p|0)>=(j|0)){g=22;break}else g=N}if((g|0)==22)return m|0}return 0}function yq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0;if(K=h[p>>2]|0,!K){h[m>>2]=0,h[m+4>>2]=0,h[m+8>>2]=0,h[m+12>>2]=0,h[m+16>>2]=0,h[m+20>>2]=0,h[m+24>>2]=0,h[m+28>>2]=0;return}if(ae=m+8|0,ie[ae>>3]=17976931348623157e292,ue=m+24|0,ie[ue>>3]=17976931348623157e292,ie[m>>3]=-17976931348623157e292,xe=m+16|0,ie[xe>>3]=-17976931348623157e292,!((K|0)<=0)){for(j=h[p+4>>2]|0,N=17976931348623157e292,U=-17976931348623157e292,q=0,p=-1,x=17976931348623157e292,b=17976931348623157e292,M=-17976931348623157e292,_=-17976931348623157e292,X=0;g=+ie[j+(X<<4)>>3],E=+ie[j+(X<<4)+8>>3],p=p+2|0,v=+ie[j+(((p|0)==(K|0)?0:p)<<4)+8>>3],g<x&&(ie[ae>>3]=g,x=g),E<b&&(ie[ue>>3]=E,b=E),g>M?ie[m>>3]=g:g=M,E>_&&(ie[xe>>3]=E,_=E),N=E>0&E<N?E:N,U=E<0&E>U?E:U,q=q|+Ks(+(E-v))>3.141592653589793,p=X+1|0,(p|0)!=(K|0);)se=X,M=g,X=p,p=se;q&&(ie[xe>>3]=U,ie[ue>>3]=N)}}function Kx(p){return p=p|0,(p>>>0<4?0:15)|0}function yL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0;if(K=h[p>>2]|0,K){if(ae=m+8|0,ie[ae>>3]=17976931348623157e292,ue=m+24|0,ie[ue>>3]=17976931348623157e292,ie[m>>3]=-17976931348623157e292,xe=m+16|0,ie[xe>>3]=-17976931348623157e292,(K|0)>0){for(v=h[p+4>>2]|0,j=17976931348623157e292,X=-17976931348623157e292,_=0,g=-1,M=17976931348623157e292,N=17976931348623157e292,q=-17976931348623157e292,b=-17976931348623157e292,se=0;x=+ie[v+(se<<4)>>3],U=+ie[v+(se<<4)+8>>3],Ke=g+2|0,E=+ie[v+(((Ke|0)==(K|0)?0:Ke)<<4)+8>>3],x<M&&(ie[ae>>3]=x,M=x),U<N&&(ie[ue>>3]=U,N=U),x>q?ie[m>>3]=x:x=q,U>b&&(ie[xe>>3]=U,b=U),j=U>0&U<j?U:j,X=U<0&U>X?U:X,_=_|+Ks(+(U-E))>3.141592653589793,g=se+1|0,(g|0)!=(K|0);)Ke=se,q=x,se=g,g=Ke;_&&(ie[xe>>3]=X,ie[ue>>3]=j)}}else h[m>>2]=0,h[m+4>>2]=0,h[m+8>>2]=0,h[m+12>>2]=0,h[m+16>>2]=0,h[m+20>>2]=0,h[m+24>>2]=0,h[m+28>>2]=0;if(Ke=p+8|0,g=h[Ke>>2]|0,!((g|0)<=0)){Be=p+12|0,Ae=0;do if(v=h[Be>>2]|0,_=Ae,Ae=Ae+1|0,ue=m+(Ae<<5)|0,xe=h[v+(_<<3)>>2]|0,xe){if(se=m+(Ae<<5)+8|0,ie[se>>3]=17976931348623157e292,p=m+(Ae<<5)+24|0,ie[p>>3]=17976931348623157e292,ie[ue>>3]=-17976931348623157e292,we=m+(Ae<<5)+16|0,ie[we>>3]=-17976931348623157e292,(xe|0)>0){for(K=h[v+(_<<3)+4>>2]|0,j=17976931348623157e292,X=-17976931348623157e292,v=0,_=-1,ae=0,M=17976931348623157e292,N=17976931348623157e292,U=-17976931348623157e292,b=-17976931348623157e292;x=+ie[K+(ae<<4)>>3],q=+ie[K+(ae<<4)+8>>3],_=_+2|0,E=+ie[K+(((_|0)==(xe|0)?0:_)<<4)+8>>3],x<M&&(ie[se>>3]=x,M=x),q<N&&(ie[p>>3]=q,N=q),x>U?ie[ue>>3]=x:x=U,q>b&&(ie[we>>3]=q,b=q),j=q>0&q<j?q:j,X=q<0&q>X?q:X,v=v|+Ks(+(q-E))>3.141592653589793,_=ae+1|0,(_|0)!=(xe|0);)Me=ae,ae=_,U=x,_=Me;v&&(ie[we>>3]=X,ie[p>>3]=j)}}else h[ue>>2]=0,h[ue+4>>2]=0,h[ue+8>>2]=0,h[ue+12>>2]=0,h[ue+16>>2]=0,h[ue+20>>2]=0,h[ue+24>>2]=0,h[ue+28>>2]=0,g=h[Ke>>2]|0;while((Ae|0)<(g|0))}}function bL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if(!(Zx(p,m,g)|0))return v=0,v|0;if(v=p+8|0,(h[v>>2]|0)<=0)return v=1,v|0;for(_=p+12|0,p=0;;){if(x=p,p=p+1|0,Zx((h[_>>2]|0)+(x<<3)|0,m+(p<<5)|0,g)|0){p=0,_=6;break}if((p|0)>=(h[v>>2]|0)){p=1,_=6;break}}return(_|0)==6?p|0:0}function bq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(N=Q,Q=Q+16|0,E=N,b=g+8|0,!(Zx(p,m,b)|0))return M=0,Q=N,M|0;M=p+8|0;e:do if((h[M>>2]|0)>0){for(x=p+12|0,v=0;;){if(U=v,v=v+1|0,Zx((h[x>>2]|0)+(U<<3)|0,m+(v<<5)|0,b)|0){v=0;break}if((v|0)>=(h[M>>2]|0))break e}return Q=N,v|0}while(!1);if(cT(p,m,g,_)|0)return U=0,Q=N,U|0;h[E>>2]=h[g>>2],h[E+4>>2]=b,v=h[M>>2]|0;e:do if((v|0)>0)for(p=p+12|0,b=0,x=v;;){if(v=h[p>>2]|0,(h[v+(b<<3)>>2]|0)>0){if(Zx(E,_,h[v+(b<<3)+4>>2]|0)|0){v=0;break e}if(v=b+1|0,cT((h[p>>2]|0)+(b<<3)|0,m+(v<<5)|0,g,_)|0){v=0;break e}x=h[M>>2]|0}else v=b+1|0;if((v|0)<(x|0))b=v;else{v=1;break}}else v=1;while(!1);return U=v,Q=N,U|0}function cT(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0;if(Ke=Q,Q=Q+176|0,se=Ke+172|0,v=Ke+168|0,we=Ke,!(sL(m,_)|0))return p=0,Q=Ke,p|0;if($ce(m,_,se,v),cu(we|0,g|0,168)|0,(h[g>>2]|0)>0){m=0;do Me=we+8+(m<<4)+8|0,xe=+kl(+ie[Me>>3],h[v>>2]|0),ie[Me>>3]=xe,m=m+1|0;while((m|0)<(h[g>>2]|0))}ae=+ie[_>>3],ue=+ie[_+8>>3],xe=+kl(+ie[_+16>>3],h[v>>2]|0),X=+kl(+ie[_+24>>3],h[v>>2]|0);e:do if((h[p>>2]|0)>0){if(_=p+4|0,v=h[we>>2]|0,(v|0)<=0){for(m=0;;)if(m=m+1|0,(m|0)>=(h[p>>2]|0)){m=0;break e}}for(g=0;;){if(m=h[_>>2]|0,j=+ie[m+(g<<4)>>3],K=+kl(+ie[m+(g<<4)+8>>3],h[se>>2]|0),m=h[_>>2]|0,g=g+1|0,Me=(g|0)%(h[p>>2]|0)|0,x=+ie[m+(Me<<4)>>3],b=+kl(+ie[m+(Me<<4)+8>>3],h[se>>2]|0),!(j>=ae)|!(x>=ae)&&!(j<=ue)|!(x<=ue)&&!(K<=X)|!(b<=X)&&!(K>=xe)|!(b>=xe)){q=x-j,N=b-K,m=0;do if(be=m,m=m+1|0,Me=(m|0)==(v|0)?0:m,x=+ie[we+8+(be<<4)+8>>3],b=+ie[we+8+(Me<<4)+8>>3]-x,E=+ie[we+8+(be<<4)>>3],M=+ie[we+8+(Me<<4)>>3]-E,U=q*b-N*M,U!=0&&(Ae=K-x,Be=j-E,M=(Ae*M-b*Be)/U,!(M<0|M>1))&&(U=(q*Ae-N*Be)/U,U>=0&U<=1)){m=1;break e}while((m|0)<(v|0))}if((g|0)>=(h[p>>2]|0)){m=0;break}}}else m=0;while(!1);return be=m,Q=Ke,be|0}function wq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;if(cT(p,m,g,_)|0)return x=1,x|0;if(x=p+8|0,(h[x>>2]|0)<=0)return x=0,x|0;for(v=p+12|0,p=0;;){if(b=p,p=p+1|0,cT((h[v>>2]|0)+(b<<3)|0,m+(p<<5)|0,g,_)|0){p=1,v=6;break}if((p|0)>=(h[x>>2]|0)){p=0,v=6;break}}return(v|0)==6?p|0:0}function zue(){return 8}function Vue(){return 16}function Gue(){return 168}function que(){return 8}function Hue(){return 16}function Wue(){return 12}function jue(){return 8}function Xue(p){return p=p|0,+(+((h[p>>2]|0)>>>0)+4294967296*+(h[p+4>>2]|0))}function $ue(p){p=p|0;var m=0,g=0;return g=+ie[p>>3],m=+ie[p+8>>3],+ +bs(+(g*g+m*m))}function Sq(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;N=+ie[p>>3],M=+ie[m>>3]-N,E=+ie[p+8>>3],b=+ie[m+8>>3]-E,q=+ie[g>>3],x=+ie[_>>3]-q,j=+ie[g+8>>3],U=+ie[_+8>>3]-j,x=(x*(E-j)-(N-q)*U)/(M*U-b*x),ie[v>>3]=N+M*x,ie[v+8>>3]=E+b*x}function Tq(p,m){return p=p|0,m=m|0,+Ks(+(+ie[p>>3]-+ie[m>>3]))<11920928955078125e-23?(m=+Ks(+(+ie[p+8>>3]-+ie[m+8>>3]))<11920928955078125e-23,m|0):(m=0,m|0)}function Yue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if(x=Q,Q=Q+16|0,v=x,_=Zi(p,m)|0,(g+-1|0)>>>0>5||(_=(_|0)!=0,(g|0)==1&_))return v=-1,Q=x,v|0;do if(Qx(p,m,v)|0)_=-1;else if(_){_=((h[26416+(g<<2)>>2]|0)+5-(h[v>>2]|0)|0)%5|0;break}else{_=((h[26448+(g<<2)>>2]|0)+6-(h[v>>2]|0)|0)%6|0;break}while(!1);return v=_,Q=x,v|0}function Qx(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(U=Q,Q=Q+32|0,E=U+16|0,M=U,_=b1(p,m,E)|0,_|0)return g=_,Q=U,g|0;x=fq(p,m)|0,N=ll(p,m)|0,Vce(x,M),_=Gce(x,h[E>>2]|0)|0;do if(yr(x)|0){do switch(x|0){case 4:{v=0;break}case 14:{v=1;break}case 24:{v=2;break}case 38:{v=3;break}case 49:{v=4;break}case 58:{v=5;break}case 63:{v=6;break}case 72:{v=7;break}case 83:{v=8;break}case 97:{v=9;break}case 107:{v=10;break}case 117:{v=11;break}default:di(27634,27636,75,27645)}while(!1);if(b=h[26480+(v*24|0)+8>>2]|0,m=h[26480+(v*24|0)+16>>2]|0,p=h[E>>2]|0,(p|0)!=(h[M>>2]|0)&&(M=nL(x)|0,p=h[E>>2]|0,M|(p|0)==(m|0)&&(_=(_+1|0)%6|0)),(N|0)==3&(p|0)==(m|0)){_=(_+5|0)%6|0;break}(N|0)==5&(p|0)==(b|0)&&(_=(_+1|0)%6|0)}while(!1);return h[g>>2]=_,g=0,Q=U,g|0}function xc(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0;if(we=Q,Q=Q+32|0,se=we+24|0,ue=we+20|0,K=we+8|0,X=we+16|0,j=we,M=(Zi(p,m)|0)==0,M=M?6:5,U=tt(p|0,m|0,52)|0,ee()|0,U=U&15,M>>>0<=g>>>0)return _=2,Q=we,_|0;q=(U|0)==0,!q&&(ae=ft(7,0,(U^15)*3|0)|0,(ae&p|0)==0&((ee()|0)&m|0)==0)?v=g:x=4;e:do if((x|0)==4){if(v=(Zi(p,m)|0)!=0,((v?4:5)|0)<(g|0)||Qx(p,m,se)|0||(x=(h[se>>2]|0)+g|0,v?v=26768+(((x|0)%5|0)<<2)|0:v=26800+(((x|0)%6|0)<<2)|0,ae=h[v>>2]|0,(ae|0)==7))return _=1,Q=we,_|0;h[ue>>2]=0,v=Qs(p,m,ae,ue,K)|0;do if(!v){if(E=K,N=h[E>>2]|0,E=h[E+4>>2]|0,b=E>>>0<m>>>0|(E|0)==(m|0)&N>>>0<p>>>0,x=b?N:p,b=b?E:m,!q&&(q=ft(7,0,(U^15)*3|0)|0,(N&q|0)==0&(E&(ee()|0)|0)==0))v=g;else{if(E=(g+-1+M|0)%(M|0)|0,v=Zi(p,m)|0,(E|0)<0&&di(27634,27636,248,27661),M=(v|0)!=0,((M?4:5)|0)<(E|0)&&di(27634,27636,248,27661),Qx(p,m,se)|0&&di(27634,27636,248,27661),v=(h[se>>2]|0)+E|0,M?v=26768+(((v|0)%5|0)<<2)|0:v=26800+(((v|0)%6|0)<<2)|0,E=h[v>>2]|0,(E|0)==7&&di(27634,27636,248,27661),h[X>>2]=0,v=Qs(p,m,E,X,j)|0,v|0)break;N=j,M=h[N>>2]|0,N=h[N+4>>2]|0;do if(N>>>0<b>>>0|(N|0)==(b|0)&M>>>0<x>>>0){if(Zi(M,N)|0?x=rT(M,N,p,m)|0:x=h[26864+((((h[X>>2]|0)+(h[26832+(E<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,v=Zi(M,N)|0,(x+-1|0)>>>0>5){v=-1,x=M,b=N;break}if(v=(v|0)!=0,(x|0)==1&v){v=-1,x=M,b=N;break}do if(Qx(M,N,se)|0)v=-1;else if(v){v=((h[26416+(x<<2)>>2]|0)+5-(h[se>>2]|0)|0)%5|0;break}else{v=((h[26448+(x<<2)>>2]|0)+6-(h[se>>2]|0)|0)%6|0;break}while(!1);x=M,b=N}else v=g;while(!1);E=K,N=h[E>>2]|0,E=h[E+4>>2]|0}if((x|0)==(N|0)&(b|0)==(E|0)){if(M=(Zi(N,E)|0)!=0,M?p=rT(N,E,p,m)|0:p=h[26864+((((h[ue>>2]|0)+(h[26832+(ae<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,v=Zi(N,E)|0,(p+-1|0)>>>0<=5&&(xe=(v|0)!=0,!((p|0)==1&xe)))do if(Qx(N,E,se)|0)v=-1;else if(xe){v=((h[26416+(p<<2)>>2]|0)+5-(h[se>>2]|0)|0)%5|0;break}else{v=((h[26448+(p<<2)>>2]|0)+6-(h[se>>2]|0)|0)%6|0;break}while(!1);else v=-1;v=v+1|0,v=(v|0)==6|M&(v|0)==5?0:v}m=b,p=x;break e}while(!1);return _=v,Q=we,_|0}while(!1);return xe=ft(v|0,0,56)|0,se=ee()|0|m&-2130706433|536870912,h[_>>2]=xe|p,h[_+4>>2]=se,_=0,Q=we,_|0}function Zue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;return x=(Zi(p,m)|0)==0,_=xc(p,m,0,g)|0,v=(_|0)==0,x?!v||(_=xc(p,m,1,g+8|0)|0,_|0)||(_=xc(p,m,2,g+16|0)|0,_|0)||(_=xc(p,m,3,g+24|0)|0,_|0)||(_=xc(p,m,4,g+32|0)|0,_)?(x=_,x|0):xc(p,m,5,g+40|0)|0:!v||(_=xc(p,m,1,g+8|0)|0,_|0)||(_=xc(p,m,2,g+16|0)|0,_|0)||(_=xc(p,m,3,g+24|0)|0,_|0)||(_=xc(p,m,4,g+32|0)|0,_|0)?(x=_,x|0):(x=g+40|0,h[x>>2]=0,h[x+4>>2]=0,x=0,x|0)}function Kue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0;return M=Q,Q=Q+192|0,v=M,x=M+168|0,b=tt(p|0,m|0,56)|0,ee()|0,b=b&7,E=m&-2130706433|134217728,_=b1(p,E,x)|0,_|0?(E=_,Q=M,E|0):(m=tt(p|0,m|0,52)|0,ee()|0,m=m&15,Zi(p,E)|0?aL(x,m,b,1,v):lL(x,m,b,1,v),E=v+8|0,h[g>>2]=h[E>>2],h[g+4>>2]=h[E+4>>2],h[g+8>>2]=h[E+8>>2],h[g+12>>2]=h[E+12>>2],E=0,Q=M,E|0)}function Eq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=Q,Q=Q+16|0,g=v,!(!0&(m&2013265920|0)==536870912)||(_=m&-2130706433|134217728,!(oT(p,_)|0))?(_=0,Q=v,_|0):(x=tt(p|0,m|0,56)|0,ee()|0,x=(xc(p,_,x&7,g)|0)==0,_=g,_=x&((h[_>>2]|0)==(p|0)?(h[_+4>>2]|0)==(m|0):0)&1,Q=v,_|0)}function Mq(){return 27680}function uT(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;q=Q,Q=Q+208|0,M=q,N=q+192|0,b=al(g,m)|0,E=N,h[E>>2]=1,h[E+4>>2]=0;e:do if(b|0){for(E=0-g|0,h[M+4>>2]=g,h[M>>2]=g,v=2,m=g,x=g;m=m+g+x|0,h[M+(v<<2)>>2]=m,m>>>0<b>>>0;)j=x,v=v+1|0,x=m,m=j;if(x=p+b+E|0,x>>>0>p>>>0){b=x,v=1,m=1;do{do if((m&3|0)!=3)if(m=v+-1|0,(h[M+(m<<2)>>2]|0)>>>0<(b-p|0)>>>0?wL(p,g,_,v,M):fT(p,g,_,N,v,0,M),(v|0)==1){dT(N,1),v=0;break}else{dT(N,m),v=1;break}else wL(p,g,_,v,M),hT(N,2),v=v+2|0;while(!1);m=h[N>>2]|1,h[N>>2]=m,p=p+g|0}while(p>>>0<x>>>0)}else v=1,m=1;for(fT(p,g,_,N,v,0,M),x=N+4|0;;){if((v|0)==1&(m|0)==1)if(h[x>>2]|0)U=19;else break e;else(v|0)<2?U=19:(dT(N,2),j=v+-2|0,h[N>>2]=h[N>>2]^7,hT(N,1),fT(p+(0-(h[M+(j<<2)>>2]|0))+E|0,g,_,N,v+-1|0,1,M),dT(N,1),m=h[N>>2]|1,h[N>>2]=m,p=p+E|0,fT(p,g,_,N,j,1,M),v=j);(U|0)==19&&(U=0,m=Cq(N)|0,hT(N,m),p=p+E|0,v=m+v|0,m=h[N>>2]|0)}}while(!1);Q=q}function wL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0;q=Q,Q=Q+240|0,U=q,h[U>>2]=p;e:do if((_|0)>1)for(N=0-m|0,E=p,x=_,_=1,b=p;;){if(E=E+N|0,M=x+-2|0,p=E+(0-(h[v+(M<<2)>>2]|0))|0,(up[g&3](b,p)|0)>-1&&(up[g&3](b,E)|0)>-1||(b=U+(_<<2)|0,(up[g&3](p,E)|0)>-1?(h[b>>2]=p,x=x+-1|0):(h[b>>2]=E,p=E,x=M),_=_+1|0,(x|0)<=1))break e;E=p,b=h[U>>2]|0}else _=1;while(!1);Pq(m,U,_),Q=q}function hT(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;v=p+4|0,m>>>0>31?(_=h[v>>2]|0,h[p>>2]=_,h[v>>2]=0,m=m+-32|0,g=0):(g=h[v>>2]|0,_=h[p>>2]|0),h[p>>2]=g<<32-m|_>>>m,h[v>>2]=g>>>m}function fT(p,m,g,_,v,x,b){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0;var E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;X=Q,Q=Q+240|0,q=X+232|0,j=X,K=h[_>>2]|0,h[q>>2]=K,M=h[_+4>>2]|0,N=q+4|0,h[N>>2]=M,h[j>>2]=p;e:do if((K|0)!=1|(M|0)!=0&&(U=0-m|0,E=p+(0-(h[b+(v<<2)>>2]|0))|0,(up[g&3](E,p)|0)>=1))for(_=1,x=(x|0)==0,M=E;;){if(x&(v|0)>1){if(x=p+U|0,E=h[b+(v+-2<<2)>>2]|0,(up[g&3](x,M)|0)>-1){E=10;break e}if((up[g&3](x+(0-E)|0,M)|0)>-1){E=10;break e}}if(x=_+1|0,h[j+(_<<2)>>2]=M,K=Cq(q)|0,hT(q,K),v=K+v|0,!((h[q>>2]|0)!=1|(h[N>>2]|0)!=0)){_=x,p=M,E=10;break e}if(p=M+(0-(h[b+(v<<2)>>2]|0))|0,(up[g&3](p,h[j>>2]|0)|0)<1){p=M,_=x,x=0,E=9;break}else K=M,_=x,x=1,M=p,p=K}else _=1,E=9;while(!1);(E|0)==9&&(x|0)==0&&(E=10),(E|0)==10&&(Pq(m,j,_),wL(p,m,g,v,b)),Q=X}function dT(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;v=p+4|0,m>>>0>31?(_=h[p>>2]|0,h[v>>2]=_,h[p>>2]=0,m=m+-32|0,g=0):(g=h[p>>2]|0,_=h[v>>2]|0),h[v>>2]=g>>>(32-m|0)|_<<m,h[p>>2]=g<<m}function Cq(p){p=p|0;var m=0;return m=Rq((h[p>>2]|0)+-1|0)|0,m?m|0:(m=Rq(h[p+4>>2]|0)|0,((m|0)==0?0:m+32|0)|0)}function Rq(p){p=p|0;var m=0;if(p)if(p&1)p=0;else for(m=p,p=0;p=p+1|0,!(m&2);)m=m>>>1;else p=32;return p|0}function Pq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0;b=Q,Q=Q+256|0,_=b;e:do if((g|0)>=2&&(x=m+(g<<2)|0,h[x>>2]=_,p|0))for(;;){v=p>>>0<256?p:256,cu(_|0,h[m>>2]|0,v|0)|0,_=0;do E=m+(_<<2)|0,_=_+1|0,cu(h[E>>2]|0,h[m+(_<<2)>>2]|0,v|0)|0,h[E>>2]=(h[E>>2]|0)+v;while((_|0)!=(g|0));if(p=p-v|0,!p)break e;_=h[x>>2]|0}while(!1);Q=b}function rh(p){return p=+p,~~+Fq(+p)|0}function br(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0;Be=Q,Q=Q+16|0,j=Be;do if(p>>>0<245){if(N=p>>>0<11?16:p+11&-8,p=N>>>3,q=h[6921]|0,g=q>>>p,g&3|0)return m=(g&1^1)+p|0,p=27724+(m<<1<<2)|0,g=p+8|0,_=h[g>>2]|0,v=_+8|0,x=h[v>>2]|0,(x|0)==(p|0)?h[6921]=q&~(1<<m):(h[x+12>>2]=p,h[g>>2]=x),Ae=m<<3,h[_+4>>2]=Ae|3,Ae=_+Ae+4|0,h[Ae>>2]=h[Ae>>2]|1,Ae=v,Q=Be,Ae|0;if(U=h[6923]|0,N>>>0>U>>>0){if(g|0)return m=2<<p,m=g<<p&(m|0-m),m=(m&0-m)+-1|0,E=m>>>12&16,m=m>>>E,g=m>>>5&8,m=m>>>g,x=m>>>2&4,m=m>>>x,p=m>>>1&2,m=m>>>p,_=m>>>1&1,_=(g|E|x|p|_)+(m>>>_)|0,m=27724+(_<<1<<2)|0,p=m+8|0,x=h[p>>2]|0,E=x+8|0,g=h[E>>2]|0,(g|0)==(m|0)?(p=q&~(1<<_),h[6921]=p):(h[g+12>>2]=m,h[p>>2]=g,p=q),Ae=_<<3,b=Ae-N|0,h[x+4>>2]=N|3,v=x+N|0,h[v+4>>2]=b|1,h[x+Ae>>2]=b,U|0&&(_=h[6926]|0,m=U>>>3,g=27724+(m<<1<<2)|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=_,h[m+12>>2]=_,h[_+8>>2]=m,h[_+12>>2]=g),h[6923]=b,h[6926]=v,Ae=E,Q=Be,Ae|0;if(x=h[6922]|0,x){for(g=(x&0-x)+-1|0,v=g>>>12&16,g=g>>>v,_=g>>>5&8,g=g>>>_,b=g>>>2&4,g=g>>>b,E=g>>>1&2,g=g>>>E,M=g>>>1&1,M=h[27988+((_|v|b|E|M)+(g>>>M)<<2)>>2]|0,g=M,E=M,M=(h[M+4>>2]&-8)-N|0;p=h[g+16>>2]|0,!(!p&&(p=h[g+20>>2]|0,!p));)b=(h[p+4>>2]&-8)-N|0,v=b>>>0<M>>>0,g=p,E=v?p:E,M=v?b:M;if(b=E+N|0,b>>>0>E>>>0){v=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(p=E+20|0,m=h[p>>2]|0,!m&&(p=E+16|0,m=h[p>>2]|0,!m)){g=0;break}for(;;)if(_=m+20|0,g=h[_>>2]|0,g)m=g,p=_;else if(_=m+16|0,g=h[_>>2]|0,g)m=g,p=_;else break;h[p>>2]=0,g=m}else g=h[E+8>>2]|0,h[g+12>>2]=m,h[m+8>>2]=g,g=m;while(!1);do if(v|0){if(m=h[E+28>>2]|0,p=27988+(m<<2)|0,(E|0)==(h[p>>2]|0)){if(h[p>>2]=g,!g){h[6922]=x&~(1<<m);break}}else if(Ae=v+16|0,h[((h[Ae>>2]|0)==(E|0)?Ae:v+20|0)>>2]=g,!g)break;h[g+24>>2]=v,m=h[E+16>>2]|0,m|0&&(h[g+16>>2]=m,h[m+24>>2]=g),m=h[E+20>>2]|0,m|0&&(h[g+20>>2]=m,h[m+24>>2]=g)}while(!1);return M>>>0<16?(Ae=M+N|0,h[E+4>>2]=Ae|3,Ae=E+Ae+4|0,h[Ae>>2]=h[Ae>>2]|1):(h[E+4>>2]=N|3,h[b+4>>2]=M|1,h[b+M>>2]=M,U|0&&(_=h[6926]|0,m=U>>>3,g=27724+(m<<1<<2)|0,m=1<<m,m&q?(p=g+8|0,m=h[p>>2]|0):(h[6921]=m|q,m=g,p=g+8|0),h[p>>2]=_,h[m+12>>2]=_,h[_+8>>2]=m,h[_+12>>2]=g),h[6923]=M,h[6926]=b),Ae=E+8|0,Q=Be,Ae|0}else q=N}else q=N}else q=N}else if(p>>>0<=4294967231)if(p=p+11|0,N=p&-8,_=h[6922]|0,_){v=0-N|0,p=p>>>8,p?N>>>0>16777215?M=31:(q=(p+1048320|0)>>>16&8,ae=p<<q,E=(ae+520192|0)>>>16&4,ae=ae<<E,M=(ae+245760|0)>>>16&2,M=14-(E|q|M)+(ae<<M>>>15)|0,M=N>>>(M+7|0)&1|M<<1):M=0,g=h[27988+(M<<2)>>2]|0;e:do if(!g)g=0,p=0,ae=61;else for(p=0,E=N<<((M|0)==31?0:25-(M>>>1)|0),x=0;;){if(b=(h[g+4>>2]&-8)-N|0,b>>>0<v>>>0)if(b)p=g,v=b;else{p=g,v=0,ae=65;break e}if(ae=h[g+20>>2]|0,g=h[g+16+(E>>>31<<2)>>2]|0,x=(ae|0)==0|(ae|0)==(g|0)?x:ae,g)E=E<<1;else{g=x,ae=61;break}}while(!1);if((ae|0)==61){if((g|0)==0&(p|0)==0){if(p=2<<M,p=(p|0-p)&_,!p){q=N;break}q=(p&0-p)+-1|0,b=q>>>12&16,q=q>>>b,x=q>>>5&8,q=q>>>x,E=q>>>2&4,q=q>>>E,M=q>>>1&2,q=q>>>M,g=q>>>1&1,p=0,g=h[27988+((x|b|E|M|g)+(q>>>g)<<2)>>2]|0}g?ae=65:(E=p,b=v)}if((ae|0)==65)for(x=g;;)if(q=(h[x+4>>2]&-8)-N|0,g=q>>>0<v>>>0,v=g?q:v,p=g?x:p,g=h[x+16>>2]|0,g||(g=h[x+20>>2]|0),g)x=g;else{E=p,b=v;break}if((E|0)!=0&&b>>>0<((h[6923]|0)-N|0)>>>0&&(U=E+N|0,U>>>0>E>>>0)){x=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(p=E+20|0,m=h[p>>2]|0,!m&&(p=E+16|0,m=h[p>>2]|0,!m)){m=0;break}for(;;)if(v=m+20|0,g=h[v>>2]|0,g)m=g,p=v;else if(v=m+16|0,g=h[v>>2]|0,g)m=g,p=v;else break;h[p>>2]=0}else Ae=h[E+8>>2]|0,h[Ae+12>>2]=m,h[m+8>>2]=Ae;while(!1);do if(x){if(p=h[E+28>>2]|0,g=27988+(p<<2)|0,(E|0)==(h[g>>2]|0)){if(h[g>>2]=m,!m){_=_&~(1<<p),h[6922]=_;break}}else if(Ae=x+16|0,h[((h[Ae>>2]|0)==(E|0)?Ae:x+20|0)>>2]=m,!m)break;h[m+24>>2]=x,p=h[E+16>>2]|0,p|0&&(h[m+16>>2]=p,h[p+24>>2]=m),p=h[E+20>>2]|0,p&&(h[m+20>>2]=p,h[p+24>>2]=m)}while(!1);e:do if(b>>>0<16)Ae=b+N|0,h[E+4>>2]=Ae|3,Ae=E+Ae+4|0,h[Ae>>2]=h[Ae>>2]|1;else{if(h[E+4>>2]=N|3,h[U+4>>2]=b|1,h[U+b>>2]=b,m=b>>>3,b>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=U,h[m+12>>2]=U,h[U+8>>2]=m,h[U+12>>2]=g;break}if(m=b>>>8,m?b>>>0>16777215?g=31:(we=(m+1048320|0)>>>16&8,Ae=m<<we,se=(Ae+520192|0)>>>16&4,Ae=Ae<<se,g=(Ae+245760|0)>>>16&2,g=14-(se|we|g)+(Ae<<g>>>15)|0,g=b>>>(g+7|0)&1|g<<1):g=0,m=27988+(g<<2)|0,h[U+28>>2]=g,p=U+16|0,h[p+4>>2]=0,h[p>>2]=0,p=1<<g,!(_&p)){h[6922]=_|p,h[m>>2]=U,h[U+24>>2]=m,h[U+12>>2]=U,h[U+8>>2]=U;break}m=h[m>>2]|0;t:do if((h[m+4>>2]&-8|0)!=(b|0)){for(_=b<<((g|0)==31?0:25-(g>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(b|0)){m=p;break t}else _=_<<1,m=p;h[g>>2]=U,h[U+24>>2]=m,h[U+12>>2]=U,h[U+8>>2]=U;break e}while(!1);we=m+8|0,Ae=h[we>>2]|0,h[Ae+12>>2]=U,h[we>>2]=U,h[U+8>>2]=Ae,h[U+12>>2]=m,h[U+24>>2]=0}while(!1);return Ae=E+8|0,Q=Be,Ae|0}else q=N}else q=N;else q=-1;while(!1);if(g=h[6923]|0,g>>>0>=q>>>0)return m=g-q|0,p=h[6926]|0,m>>>0>15?(Ae=p+q|0,h[6926]=Ae,h[6923]=m,h[Ae+4>>2]=m|1,h[p+g>>2]=m,h[p+4>>2]=q|3):(h[6923]=0,h[6926]=0,h[p+4>>2]=g|3,Ae=p+g+4|0,h[Ae>>2]=h[Ae>>2]|1),Ae=p+8|0,Q=Be,Ae|0;if(b=h[6924]|0,b>>>0>q>>>0)return se=b-q|0,h[6924]=se,Ae=h[6927]|0,we=Ae+q|0,h[6927]=we,h[we+4>>2]=se|1,h[Ae+4>>2]=q|3,Ae=Ae+8|0,Q=Be,Ae|0;if(h[7039]|0?p=h[7041]|0:(h[7041]=4096,h[7040]=4096,h[7042]=-1,h[7043]=-1,h[7044]=0,h[7032]=0,h[7039]=j&-16^1431655768,p=4096),E=q+48|0,M=q+47|0,x=p+M|0,v=0-p|0,N=x&v,N>>>0<=q>>>0||(p=h[7031]|0,p|0&&(U=h[7029]|0,j=U+N|0,j>>>0<=U>>>0|j>>>0>p>>>0)))return Ae=0,Q=Be,Ae|0;e:do if(h[7032]&4)m=0,ae=143;else{g=h[6927]|0;t:do if(g){for(_=28132;j=h[_>>2]|0,!(j>>>0<=g>>>0&&(j+(h[_+4>>2]|0)|0)>>>0>g>>>0);)if(p=h[_+8>>2]|0,p)_=p;else{ae=128;break t}if(m=x-b&v,m>>>0<2147483647)if(p=cp(m|0)|0,(p|0)==((h[_>>2]|0)+(h[_+4>>2]|0)|0)){if((p|0)!=-1){b=m,x=p,ae=145;break e}}else _=p,ae=136;else m=0}else ae=128;while(!1);do if((ae|0)==128)if(g=cp(0)|0,(g|0)!=-1&&(m=g,X=h[7040]|0,K=X+-1|0,m=((K&m|0)==0?0:(K+m&0-X)-m|0)+N|0,X=h[7029]|0,K=m+X|0,m>>>0>q>>>0&m>>>0<2147483647)){if(j=h[7031]|0,j|0&&K>>>0<=X>>>0|K>>>0>j>>>0){m=0;break}if(p=cp(m|0)|0,(p|0)==(g|0)){b=m,x=g,ae=145;break e}else _=p,ae=136}else m=0;while(!1);do if((ae|0)==136){if(g=0-m|0,!(E>>>0>m>>>0&(m>>>0<2147483647&(_|0)!=-1)))if((_|0)==-1){m=0;break}else{b=m,x=_,ae=145;break e}if(p=h[7041]|0,p=M-m+p&0-p,p>>>0>=2147483647){b=m,x=_,ae=145;break e}if((cp(p|0)|0)==-1){cp(g|0)|0,m=0;break}else{b=p+m|0,x=_,ae=145;break e}}while(!1);h[7032]=h[7032]|4,ae=143}while(!1);if((ae|0)==143&&N>>>0<2147483647&&(se=cp(N|0)|0,K=cp(0)|0,ue=K-se|0,xe=ue>>>0>(q+40|0)>>>0,!((se|0)==-1|xe^1|se>>>0<K>>>0&((se|0)!=-1&(K|0)!=-1)^1))&&(b=xe?ue:m,x=se,ae=145),(ae|0)==145){m=(h[7029]|0)+b|0,h[7029]=m,m>>>0>(h[7030]|0)>>>0&&(h[7030]=m),M=h[6927]|0;e:do if(M){for(m=28132;;){if(p=h[m>>2]|0,g=h[m+4>>2]|0,(x|0)==(p+g|0)){ae=154;break}if(_=h[m+8>>2]|0,_)m=_;else break}if((ae|0)==154&&(we=m+4|0,(h[m+12>>2]&8|0)==0)&&x>>>0>M>>>0&p>>>0<=M>>>0){h[we>>2]=g+b,Ae=(h[6924]|0)+b|0,se=M+8|0,se=(se&7|0)==0?0:0-se&7,we=M+se|0,se=Ae-se|0,h[6927]=we,h[6924]=se,h[we+4>>2]=se|1,h[M+Ae+4>>2]=40,h[6928]=h[7043];break}for(x>>>0<(h[6925]|0)>>>0&&(h[6925]=x),g=x+b|0,m=28132;;){if((h[m>>2]|0)==(g|0)){ae=162;break}if(p=h[m+8>>2]|0,p)m=p;else break}if((ae|0)==162&&(h[m+12>>2]&8|0)==0){h[m>>2]=x,U=m+4|0,h[U>>2]=(h[U>>2]|0)+b,U=x+8|0,U=x+((U&7|0)==0?0:0-U&7)|0,m=g+8|0,m=g+((m&7|0)==0?0:0-m&7)|0,N=U+q|0,E=m-U-q|0,h[U+4>>2]=q|3;t:do if((M|0)==(m|0))Ae=(h[6924]|0)+E|0,h[6924]=Ae,h[6927]=N,h[N+4>>2]=Ae|1;else{if((h[6926]|0)==(m|0)){Ae=(h[6923]|0)+E|0,h[6923]=Ae,h[6926]=N,h[N+4>>2]=Ae|1,h[N+Ae>>2]=Ae;break}if(p=h[m+4>>2]|0,(p&3|0)==1){b=p&-8,_=p>>>3;n:do if(p>>>0<256)if(p=h[m+8>>2]|0,g=h[m+12>>2]|0,(g|0)==(p|0)){h[6921]=h[6921]&~(1<<_);break}else{h[p+12>>2]=g,h[g+8>>2]=p;break}else{x=h[m+24>>2]|0,p=h[m+12>>2]|0;do if((p|0)==(m|0)){if(g=m+16|0,_=g+4|0,p=h[_>>2]|0,p)g=_;else if(p=h[g>>2]|0,!p){p=0;break}for(;;)if(v=p+20|0,_=h[v>>2]|0,_)p=_,g=v;else if(v=p+16|0,_=h[v>>2]|0,_)p=_,g=v;else break;h[g>>2]=0}else Ae=h[m+8>>2]|0,h[Ae+12>>2]=p,h[p+8>>2]=Ae;while(!1);if(!x)break;g=h[m+28>>2]|0,_=27988+(g<<2)|0;do if((h[_>>2]|0)!=(m|0)){if(Ae=x+16|0,h[((h[Ae>>2]|0)==(m|0)?Ae:x+20|0)>>2]=p,!p)break n}else{if(h[_>>2]=p,p|0)break;h[6922]=h[6922]&~(1<<g);break n}while(!1);if(h[p+24>>2]=x,g=m+16|0,_=h[g>>2]|0,_|0&&(h[p+16>>2]=_,h[_+24>>2]=p),g=h[g+4>>2]|0,!g)break;h[p+20>>2]=g,h[g+24>>2]=p}while(!1);m=m+b|0,v=b+E|0}else v=E;if(m=m+4|0,h[m>>2]=h[m>>2]&-2,h[N+4>>2]=v|1,h[N+v>>2]=v,m=v>>>3,v>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=N,h[m+12>>2]=N,h[N+8>>2]=m,h[N+12>>2]=g;break}m=v>>>8;do if(!m)_=0;else{if(v>>>0>16777215){_=31;break}we=(m+1048320|0)>>>16&8,Ae=m<<we,se=(Ae+520192|0)>>>16&4,Ae=Ae<<se,_=(Ae+245760|0)>>>16&2,_=14-(se|we|_)+(Ae<<_>>>15)|0,_=v>>>(_+7|0)&1|_<<1}while(!1);if(m=27988+(_<<2)|0,h[N+28>>2]=_,p=N+16|0,h[p+4>>2]=0,h[p>>2]=0,p=h[6922]|0,g=1<<_,!(p&g)){h[6922]=p|g,h[m>>2]=N,h[N+24>>2]=m,h[N+12>>2]=N,h[N+8>>2]=N;break}m=h[m>>2]|0;n:do if((h[m+4>>2]&-8|0)!=(v|0)){for(_=v<<((_|0)==31?0:25-(_>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(v|0)){m=p;break n}else _=_<<1,m=p;h[g>>2]=N,h[N+24>>2]=m,h[N+12>>2]=N,h[N+8>>2]=N;break t}while(!1);we=m+8|0,Ae=h[we>>2]|0,h[Ae+12>>2]=N,h[we>>2]=N,h[N+8>>2]=Ae,h[N+12>>2]=m,h[N+24>>2]=0}while(!1);return Ae=U+8|0,Q=Be,Ae|0}for(m=28132;p=h[m>>2]|0,!(p>>>0<=M>>>0&&(Ae=p+(h[m+4>>2]|0)|0,Ae>>>0>M>>>0));)m=h[m+8>>2]|0;v=Ae+-47|0,p=v+8|0,p=v+((p&7|0)==0?0:0-p&7)|0,v=M+16|0,p=p>>>0<v>>>0?M:p,m=p+8|0,g=b+-40|0,se=x+8|0,se=(se&7|0)==0?0:0-se&7,we=x+se|0,se=g-se|0,h[6927]=we,h[6924]=se,h[we+4>>2]=se|1,h[x+g+4>>2]=40,h[6928]=h[7043],g=p+4|0,h[g>>2]=27,h[m>>2]=h[7033],h[m+4>>2]=h[7034],h[m+8>>2]=h[7035],h[m+12>>2]=h[7036],h[7033]=x,h[7034]=b,h[7036]=0,h[7035]=m,m=p+24|0;do we=m,m=m+4|0,h[m>>2]=7;while((we+8|0)>>>0<Ae>>>0);if((p|0)!=(M|0)){if(x=p-M|0,h[g>>2]=h[g>>2]&-2,h[M+4>>2]=x|1,h[p>>2]=x,m=x>>>3,x>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=M,h[m+12>>2]=M,h[M+8>>2]=m,h[M+12>>2]=g;break}if(m=x>>>8,m?x>>>0>16777215?_=31:(we=(m+1048320|0)>>>16&8,Ae=m<<we,se=(Ae+520192|0)>>>16&4,Ae=Ae<<se,_=(Ae+245760|0)>>>16&2,_=14-(se|we|_)+(Ae<<_>>>15)|0,_=x>>>(_+7|0)&1|_<<1):_=0,g=27988+(_<<2)|0,h[M+28>>2]=_,h[M+20>>2]=0,h[v>>2]=0,m=h[6922]|0,p=1<<_,!(m&p)){h[6922]=m|p,h[g>>2]=M,h[M+24>>2]=g,h[M+12>>2]=M,h[M+8>>2]=M;break}m=h[g>>2]|0;t:do if((h[m+4>>2]&-8|0)!=(x|0)){for(_=x<<((_|0)==31?0:25-(_>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(x|0)){m=p;break t}else _=_<<1,m=p;h[g>>2]=M,h[M+24>>2]=m,h[M+12>>2]=M,h[M+8>>2]=M;break e}while(!1);we=m+8|0,Ae=h[we>>2]|0,h[Ae+12>>2]=M,h[we>>2]=M,h[M+8>>2]=Ae,h[M+12>>2]=m,h[M+24>>2]=0}}else Ae=h[6925]|0,(Ae|0)==0|x>>>0<Ae>>>0&&(h[6925]=x),h[7033]=x,h[7034]=b,h[7036]=0,h[6930]=h[7039],h[6929]=-1,h[6934]=27724,h[6933]=27724,h[6936]=27732,h[6935]=27732,h[6938]=27740,h[6937]=27740,h[6940]=27748,h[6939]=27748,h[6942]=27756,h[6941]=27756,h[6944]=27764,h[6943]=27764,h[6946]=27772,h[6945]=27772,h[6948]=27780,h[6947]=27780,h[6950]=27788,h[6949]=27788,h[6952]=27796,h[6951]=27796,h[6954]=27804,h[6953]=27804,h[6956]=27812,h[6955]=27812,h[6958]=27820,h[6957]=27820,h[6960]=27828,h[6959]=27828,h[6962]=27836,h[6961]=27836,h[6964]=27844,h[6963]=27844,h[6966]=27852,h[6965]=27852,h[6968]=27860,h[6967]=27860,h[6970]=27868,h[6969]=27868,h[6972]=27876,h[6971]=27876,h[6974]=27884,h[6973]=27884,h[6976]=27892,h[6975]=27892,h[6978]=27900,h[6977]=27900,h[6980]=27908,h[6979]=27908,h[6982]=27916,h[6981]=27916,h[6984]=27924,h[6983]=27924,h[6986]=27932,h[6985]=27932,h[6988]=27940,h[6987]=27940,h[6990]=27948,h[6989]=27948,h[6992]=27956,h[6991]=27956,h[6994]=27964,h[6993]=27964,h[6996]=27972,h[6995]=27972,Ae=b+-40|0,se=x+8|0,se=(se&7|0)==0?0:0-se&7,we=x+se|0,se=Ae-se|0,h[6927]=we,h[6924]=se,h[we+4>>2]=se|1,h[x+Ae+4>>2]=40,h[6928]=h[7043];while(!1);if(m=h[6924]|0,m>>>0>q>>>0)return se=m-q|0,h[6924]=se,Ae=h[6927]|0,we=Ae+q|0,h[6927]=we,h[we+4>>2]=se|1,h[Ae+4>>2]=q|3,Ae=Ae+8|0,Q=Be,Ae|0}return Ae=Mq()|0,h[Ae>>2]=12,Ae=0,Q=Be,Ae|0}function _t(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0;if(p){g=p+-8|0,v=h[6925]|0,p=h[p+-4>>2]|0,m=p&-8,M=g+m|0;do if(p&1)E=g,b=g;else{if(_=h[g>>2]|0,!(p&3)||(b=g+(0-_)|0,x=_+m|0,b>>>0<v>>>0))return;if((h[6926]|0)==(b|0)){if(p=M+4|0,m=h[p>>2]|0,(m&3|0)!=3){E=b,m=x;break}h[6923]=x,h[p>>2]=m&-2,h[b+4>>2]=x|1,h[b+x>>2]=x;return}if(g=_>>>3,_>>>0<256)if(p=h[b+8>>2]|0,m=h[b+12>>2]|0,(m|0)==(p|0)){h[6921]=h[6921]&~(1<<g),E=b,m=x;break}else{h[p+12>>2]=m,h[m+8>>2]=p,E=b,m=x;break}v=h[b+24>>2]|0,p=h[b+12>>2]|0;do if((p|0)==(b|0)){if(m=b+16|0,g=m+4|0,p=h[g>>2]|0,p)m=g;else if(p=h[m>>2]|0,!p){p=0;break}for(;;)if(_=p+20|0,g=h[_>>2]|0,g)p=g,m=_;else if(_=p+16|0,g=h[_>>2]|0,g)p=g,m=_;else break;h[m>>2]=0}else E=h[b+8>>2]|0,h[E+12>>2]=p,h[p+8>>2]=E;while(!1);if(v){if(m=h[b+28>>2]|0,g=27988+(m<<2)|0,(h[g>>2]|0)==(b|0)){if(h[g>>2]=p,!p){h[6922]=h[6922]&~(1<<m),E=b,m=x;break}}else if(E=v+16|0,h[((h[E>>2]|0)==(b|0)?E:v+20|0)>>2]=p,!p){E=b,m=x;break}h[p+24>>2]=v,m=b+16|0,g=h[m>>2]|0,g|0&&(h[p+16>>2]=g,h[g+24>>2]=p),m=h[m+4>>2]|0,m?(h[p+20>>2]=m,h[m+24>>2]=p,E=b,m=x):(E=b,m=x)}else E=b,m=x}while(!1);if(!(b>>>0>=M>>>0)&&(p=M+4|0,_=h[p>>2]|0,!!(_&1))){if(_&2)h[p>>2]=_&-2,h[E+4>>2]=m|1,h[b+m>>2]=m,v=m;else{if((h[6927]|0)==(M|0)){if(M=(h[6924]|0)+m|0,h[6924]=M,h[6927]=E,h[E+4>>2]=M|1,(E|0)!=(h[6926]|0))return;h[6926]=0,h[6923]=0;return}if((h[6926]|0)==(M|0)){M=(h[6923]|0)+m|0,h[6923]=M,h[6926]=b,h[E+4>>2]=M|1,h[b+M>>2]=M;return}v=(_&-8)+m|0,g=_>>>3;do if(_>>>0<256)if(m=h[M+8>>2]|0,p=h[M+12>>2]|0,(p|0)==(m|0)){h[6921]=h[6921]&~(1<<g);break}else{h[m+12>>2]=p,h[p+8>>2]=m;break}else{x=h[M+24>>2]|0,p=h[M+12>>2]|0;do if((p|0)==(M|0)){if(m=M+16|0,g=m+4|0,p=h[g>>2]|0,p)m=g;else if(p=h[m>>2]|0,!p){g=0;break}for(;;)if(_=p+20|0,g=h[_>>2]|0,g)p=g,m=_;else if(_=p+16|0,g=h[_>>2]|0,g)p=g,m=_;else break;h[m>>2]=0,g=p}else g=h[M+8>>2]|0,h[g+12>>2]=p,h[p+8>>2]=g,g=p;while(!1);if(x|0){if(p=h[M+28>>2]|0,m=27988+(p<<2)|0,(h[m>>2]|0)==(M|0)){if(h[m>>2]=g,!g){h[6922]=h[6922]&~(1<<p);break}}else if(_=x+16|0,h[((h[_>>2]|0)==(M|0)?_:x+20|0)>>2]=g,!g)break;h[g+24>>2]=x,p=M+16|0,m=h[p>>2]|0,m|0&&(h[g+16>>2]=m,h[m+24>>2]=g),p=h[p+4>>2]|0,p|0&&(h[g+20>>2]=p,h[p+24>>2]=g)}}while(!1);if(h[E+4>>2]=v|1,h[b+v>>2]=v,(E|0)==(h[6926]|0)){h[6923]=v;return}}if(p=v>>>3,v>>>0<256){g=27724+(p<<1<<2)|0,m=h[6921]|0,p=1<<p,m&p?(m=g+8|0,p=h[m>>2]|0):(h[6921]=m|p,p=g,m=g+8|0),h[m>>2]=E,h[p+12>>2]=E,h[E+8>>2]=p,h[E+12>>2]=g;return}p=v>>>8,p?v>>>0>16777215?_=31:(b=(p+1048320|0)>>>16&8,M=p<<b,x=(M+520192|0)>>>16&4,M=M<<x,_=(M+245760|0)>>>16&2,_=14-(x|b|_)+(M<<_>>>15)|0,_=v>>>(_+7|0)&1|_<<1):_=0,p=27988+(_<<2)|0,h[E+28>>2]=_,h[E+20>>2]=0,h[E+16>>2]=0,m=h[6922]|0,g=1<<_;e:do if(!(m&g))h[6922]=m|g,h[p>>2]=E,h[E+24>>2]=p,h[E+12>>2]=E,h[E+8>>2]=E;else{p=h[p>>2]|0;t:do if((h[p+4>>2]&-8|0)!=(v|0)){for(_=v<<((_|0)==31?0:25-(_>>>1)|0);g=p+16+(_>>>31<<2)|0,m=h[g>>2]|0,!!m;)if((h[m+4>>2]&-8|0)==(v|0)){p=m;break t}else _=_<<1,p=m;h[g>>2]=E,h[E+24>>2]=p,h[E+12>>2]=E,h[E+8>>2]=E;break e}while(!1);b=p+8|0,M=h[b>>2]|0,h[M+12>>2]=E,h[b>>2]=E,h[E+8>>2]=M,h[E+12>>2]=p,h[E+24>>2]=0}while(!1);if(M=(h[6929]|0)+-1|0,h[6929]=M,!(M|0)){for(p=28140;p=h[p>>2]|0,p;)p=p+8|0;h[6929]=-1}}}}function Ea(p,m){p=p|0,m=m|0;var g=0;return p?(g=al(m,p)|0,(m|p)>>>0>65535&&(g=((g>>>0)/(p>>>0)|0|0)==(m|0)?g:-1)):g=0,p=br(g)|0,!p||!(h[p+-4>>2]&3)||lp(p|0,0,g|0)|0,p|0}function Que(p,m){p=p|0,m=m|0;var g=0,_=0;return p?m>>>0>4294967231?(m=Mq()|0,h[m>>2]=12,m=0,m|0):(g=Jue(p+-8|0,m>>>0<11?16:m+11&-8)|0,g|0?(m=g+8|0,m|0):(g=br(m)|0,g?(_=h[p+-4>>2]|0,_=(_&-8)-((_&3|0)==0?8:4)|0,cu(g|0,p|0,(_>>>0<m>>>0?_:m)|0)|0,_t(p),m=g,m|0):(m=0,m|0))):(m=br(m)|0,m|0)}function Jue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;if(U=p+4|0,q=h[U>>2]|0,g=q&-8,E=p+g|0,!(q&3))return m>>>0<256?(p=0,p|0):(g>>>0>=(m+4|0)>>>0&&(g-m|0)>>>0<=h[7041]<<1>>>0||(p=0),p|0);if(g>>>0>=m>>>0)return g=g-m|0,g>>>0<=15||(N=p+m|0,h[U>>2]=q&1|m|2,h[N+4>>2]=g|3,q=E+4|0,h[q>>2]=h[q>>2]|1,Iq(N,g)),p|0;if((h[6927]|0)==(E|0))return N=(h[6924]|0)+g|0,g=N-m|0,_=p+m|0,N>>>0<=m>>>0?(p=0,p|0):(h[U>>2]=q&1|m|2,h[_+4>>2]=g|1,h[6927]=_,h[6924]=g,p|0);if((h[6926]|0)==(E|0))return _=(h[6923]|0)+g|0,_>>>0<m>>>0?(p=0,p|0):(g=_-m|0,g>>>0>15?(N=p+m|0,_=p+_|0,h[U>>2]=q&1|m|2,h[N+4>>2]=g|1,h[_>>2]=g,_=_+4|0,h[_>>2]=h[_>>2]&-2,_=N):(h[U>>2]=q&1|_|2,_=p+_+4|0,h[_>>2]=h[_>>2]|1,_=0,g=0),h[6923]=g,h[6926]=_,p|0);if(_=h[E+4>>2]|0,_&2|0||(M=(_&-8)+g|0,M>>>0<m>>>0))return p=0,p|0;N=M-m|0,v=_>>>3;do if(_>>>0<256)if(_=h[E+8>>2]|0,g=h[E+12>>2]|0,(g|0)==(_|0)){h[6921]=h[6921]&~(1<<v);break}else{h[_+12>>2]=g,h[g+8>>2]=_;break}else{b=h[E+24>>2]|0,g=h[E+12>>2]|0;do if((g|0)==(E|0)){if(_=E+16|0,v=_+4|0,g=h[v>>2]|0,g)_=v;else if(g=h[_>>2]|0,!g){v=0;break}for(;;)if(x=g+20|0,v=h[x>>2]|0,v)g=v,_=x;else if(x=g+16|0,v=h[x>>2]|0,v)g=v,_=x;else break;h[_>>2]=0,v=g}else v=h[E+8>>2]|0,h[v+12>>2]=g,h[g+8>>2]=v,v=g;while(!1);if(b|0){if(g=h[E+28>>2]|0,_=27988+(g<<2)|0,(h[_>>2]|0)==(E|0)){if(h[_>>2]=v,!v){h[6922]=h[6922]&~(1<<g);break}}else if(x=b+16|0,h[((h[x>>2]|0)==(E|0)?x:b+20|0)>>2]=v,!v)break;h[v+24>>2]=b,g=E+16|0,_=h[g>>2]|0,_|0&&(h[v+16>>2]=_,h[_+24>>2]=v),g=h[g+4>>2]|0,g|0&&(h[v+20>>2]=g,h[g+24>>2]=v)}}while(!1);return N>>>0<16?(h[U>>2]=q&1|M|2,q=p+M+4|0,h[q>>2]=h[q>>2]|1,p|0):(E=p+m|0,h[U>>2]=q&1|m|2,h[E+4>>2]=N|3,q=p+M+4|0,h[q>>2]=h[q>>2]|1,Iq(E,N),p|0)}function Iq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0;E=p+m|0,g=h[p+4>>2]|0;do if(g&1)b=p;else{if(v=h[p>>2]|0,!(g&3))return;if(b=p+(0-v)|0,m=v+m|0,(h[6926]|0)==(b|0)){if(p=E+4|0,g=h[p>>2]|0,(g&3|0)!=3)break;h[6923]=m,h[p>>2]=g&-2,h[b+4>>2]=m|1,h[E>>2]=m;return}if(_=v>>>3,v>>>0<256)if(p=h[b+8>>2]|0,g=h[b+12>>2]|0,(g|0)==(p|0)){h[6921]=h[6921]&~(1<<_);break}else{h[p+12>>2]=g,h[g+8>>2]=p;break}x=h[b+24>>2]|0,p=h[b+12>>2]|0;do if((p|0)==(b|0)){if(g=b+16|0,_=g+4|0,p=h[_>>2]|0,p)g=_;else if(p=h[g>>2]|0,!p){p=0;break}for(;;)if(v=p+20|0,_=h[v>>2]|0,_)p=_,g=v;else if(v=p+16|0,_=h[v>>2]|0,_)p=_,g=v;else break;h[g>>2]=0}else v=h[b+8>>2]|0,h[v+12>>2]=p,h[p+8>>2]=v;while(!1);if(x){if(g=h[b+28>>2]|0,_=27988+(g<<2)|0,(h[_>>2]|0)==(b|0)){if(h[_>>2]=p,!p){h[6922]=h[6922]&~(1<<g);break}}else if(v=x+16|0,h[((h[v>>2]|0)==(b|0)?v:x+20|0)>>2]=p,!p)break;h[p+24>>2]=x,g=b+16|0,_=h[g>>2]|0,_|0&&(h[p+16>>2]=_,h[_+24>>2]=p),g=h[g+4>>2]|0,g&&(h[p+20>>2]=g,h[g+24>>2]=p)}}while(!1);if(p=E+4|0,_=h[p>>2]|0,_&2)h[p>>2]=_&-2,h[b+4>>2]=m|1,h[b+m>>2]=m,v=m;else{if((h[6927]|0)==(E|0)){if(E=(h[6924]|0)+m|0,h[6924]=E,h[6927]=b,h[b+4>>2]=E|1,(b|0)!=(h[6926]|0))return;h[6926]=0,h[6923]=0;return}if((h[6926]|0)==(E|0)){E=(h[6923]|0)+m|0,h[6923]=E,h[6926]=b,h[b+4>>2]=E|1,h[b+E>>2]=E;return}v=(_&-8)+m|0,g=_>>>3;do if(_>>>0<256)if(p=h[E+8>>2]|0,m=h[E+12>>2]|0,(m|0)==(p|0)){h[6921]=h[6921]&~(1<<g);break}else{h[p+12>>2]=m,h[m+8>>2]=p;break}else{x=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(p=E+16|0,g=p+4|0,m=h[g>>2]|0,m)p=g;else if(m=h[p>>2]|0,!m){g=0;break}for(;;)if(_=m+20|0,g=h[_>>2]|0,g)m=g,p=_;else if(_=m+16|0,g=h[_>>2]|0,g)m=g,p=_;else break;h[p>>2]=0,g=m}else g=h[E+8>>2]|0,h[g+12>>2]=m,h[m+8>>2]=g,g=m;while(!1);if(x|0){if(m=h[E+28>>2]|0,p=27988+(m<<2)|0,(h[p>>2]|0)==(E|0)){if(h[p>>2]=g,!g){h[6922]=h[6922]&~(1<<m);break}}else if(_=x+16|0,h[((h[_>>2]|0)==(E|0)?_:x+20|0)>>2]=g,!g)break;h[g+24>>2]=x,m=E+16|0,p=h[m>>2]|0,p|0&&(h[g+16>>2]=p,h[p+24>>2]=g),m=h[m+4>>2]|0,m|0&&(h[g+20>>2]=m,h[m+24>>2]=g)}}while(!1);if(h[b+4>>2]=v|1,h[b+v>>2]=v,(b|0)==(h[6926]|0)){h[6923]=v;return}}if(m=v>>>3,v>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=b,h[m+12>>2]=b,h[b+8>>2]=m,h[b+12>>2]=g;return}if(m=v>>>8,m?v>>>0>16777215?_=31:(x=(m+1048320|0)>>>16&8,E=m<<x,g=(E+520192|0)>>>16&4,E=E<<g,_=(E+245760|0)>>>16&2,_=14-(g|x|_)+(E<<_>>>15)|0,_=v>>>(_+7|0)&1|_<<1):_=0,m=27988+(_<<2)|0,h[b+28>>2]=_,h[b+20>>2]=0,h[b+16>>2]=0,p=h[6922]|0,g=1<<_,!(p&g)){h[6922]=p|g,h[m>>2]=b,h[b+24>>2]=m,h[b+12>>2]=b,h[b+8>>2]=b;return}m=h[m>>2]|0;e:do if((h[m+4>>2]&-8|0)!=(v|0)){for(_=v<<((_|0)==31?0:25-(_>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(v|0)){m=p;break e}else _=_<<1,m=p;h[g>>2]=b,h[b+24>>2]=m,h[b+12>>2]=b,h[b+8>>2]=b;return}while(!1);x=m+8|0,E=h[x>>2]|0,h[E+12>>2]=b,h[x>>2]=b,h[b+8>>2]=E,h[b+12>>2]=m,h[b+24>>2]=0}function At(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,g=p+g>>>0,On(m+_+(g>>>0<p>>>0|0)>>>0|0),g|0|0}function Js(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,_=m-_-(g>>>0>p>>>0|0)>>>0,On(_|0),p-g>>>0|0|0}function Lq(p){return p=p|0,(p?31-(Gf(p^p-1)|0)|0:32)|0}function SL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(U=p,M=m,N=M,b=g,j=_,E=j,!N)return x=(v|0)!=0,E?x?(h[v>>2]=p|0,h[v+4>>2]=m&0,j=0,v=0,On(j|0),v|0):(j=0,v=0,On(j|0),v|0):(x&&(h[v>>2]=(U>>>0)%(b>>>0),h[v+4>>2]=0),j=0,v=(U>>>0)/(b>>>0)>>>0,On(j|0),v|0);x=(E|0)==0;do if(b){if(!x){if(x=(Gf(E|0)|0)-(Gf(N|0)|0)|0,x>>>0<=31){q=x+1|0,E=31-x|0,m=x-31>>31,b=q,p=U>>>(q>>>0)&m|N<<E,m=N>>>(q>>>0)&m,x=0,E=U<<E;break}return v?(h[v>>2]=p|0,h[v+4>>2]=M|m&0,j=0,v=0,On(j|0),v|0):(j=0,v=0,On(j|0),v|0)}if(x=b-1|0,x&b|0){E=(Gf(b|0)|0)+33-(Gf(N|0)|0)|0,K=64-E|0,q=32-E|0,M=q>>31,X=E-32|0,m=X>>31,b=E,p=q-1>>31&N>>>(X>>>0)|(N<<q|U>>>(E>>>0))&m,m=m&N>>>(E>>>0),x=U<<K&M,E=(N<<K|U>>>(X>>>0))&M|U<<q&E-33>>31;break}return v|0&&(h[v>>2]=x&U,h[v+4>>2]=0),(b|0)==1?(X=M|m&0,K=p|0|0,On(X|0),K|0):(K=Lq(b|0)|0,X=N>>>(K>>>0)|0,K=N<<32-K|U>>>(K>>>0)|0,On(X|0),K|0)}else{if(x)return v|0&&(h[v>>2]=(N>>>0)%(b>>>0),h[v+4>>2]=0),X=0,K=(N>>>0)/(b>>>0)>>>0,On(X|0),K|0;if(!U)return v|0&&(h[v>>2]=0,h[v+4>>2]=(N>>>0)%(E>>>0)),X=0,K=(N>>>0)/(E>>>0)>>>0,On(X|0),K|0;if(x=E-1|0,!(x&E))return v|0&&(h[v>>2]=p|0,h[v+4>>2]=x&N|m&0),X=0,K=N>>>((Lq(E|0)|0)>>>0),On(X|0),K|0;if(x=(Gf(E|0)|0)-(Gf(N|0)|0)|0,x>>>0<=30){m=x+1|0,E=31-x|0,b=m,p=N<<E|U>>>(m>>>0),m=N>>>(m>>>0),x=0,E=U<<E;break}return v?(h[v>>2]=p|0,h[v+4>>2]=M|m&0,X=0,K=0,On(X|0),K|0):(X=0,K=0,On(X|0),K|0)}while(!1);if(!b)N=E,M=0,E=0;else{q=g|0|0,U=j|_&0,N=At(q|0,U|0,-1,-1)|0,g=ee()|0,M=E,E=0;do _=M,M=x>>>31|M<<1,x=E|x<<1,_=p<<1|_>>>31|0,j=p>>>31|m<<1|0,Js(N|0,g|0,_|0,j|0)|0,K=ee()|0,X=K>>31|((K|0)<0?-1:0)<<1,E=X&1,p=Js(_|0,j|0,X&q|0,(((K|0)<0?-1:0)>>31|((K|0)<0?-1:0)<<1)&U|0)|0,m=ee()|0,b=b-1|0;while((b|0)!=0);N=M,M=0}return b=0,v|0&&(h[v>>2]=p,h[v+4>>2]=m),X=(x|0)>>>31|(N|b)<<1|(b<<1|x>>>31)&0|M,K=(x<<1|0)&-2|E,On(X|0),K|0}function op(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;return N=m>>31|((m|0)<0?-1:0)<<1,M=((m|0)<0?-1:0)>>31|((m|0)<0?-1:0)<<1,x=_>>31|((_|0)<0?-1:0)<<1,v=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,E=Js(N^p|0,M^m|0,N|0,M|0)|0,b=ee()|0,p=x^N,m=v^M,Js((SL(E,b,Js(x^g|0,v^_|0,x|0,v|0)|0,ee()|0,0)|0)^p|0,(ee()|0)^m|0,p|0,m|0)|0}function ehe(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return x=p&65535,v=m&65535,g=al(v,x)|0,_=p>>>16,p=(g>>>16)+(al(v,_)|0)|0,v=m>>>16,m=al(v,x)|0,On((p>>>16)+(al(v,_)|0)+(((p&65535)+m|0)>>>16)|0),p+m<<16|g&65535|0|0}function wr(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;return v=p,x=g,g=ehe(v,x)|0,p=ee()|0,On((al(m,x)|0)+(al(_,v)|0)+p|p&0|0),g|0|0|0}function ap(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;return v=Q,Q=Q+16|0,E=v|0,b=m>>31|((m|0)<0?-1:0)<<1,x=((m|0)<0?-1:0)>>31|((m|0)<0?-1:0)<<1,N=_>>31|((_|0)<0?-1:0)<<1,M=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,p=Js(b^p|0,x^m|0,b|0,x|0)|0,m=ee()|0,SL(p,m,Js(N^g|0,M^_|0,N|0,M|0)|0,ee()|0,E)|0,_=Js(h[E>>2]^b|0,h[E+4>>2]^x|0,b|0,x|0)|0,g=ee()|0,Q=v,On(g|0),_|0}function qf(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;return x=Q,Q=Q+16|0,v=x|0,SL(p,m,g,_,v)|0,Q=x,On(h[v+4>>2]|0),h[v>>2]|0|0}function Dq(p,m,g){return p=p|0,m=m|0,g=g|0,(g|0)<32?(On(m>>g|0),p>>>g|(m&(1<<g)-1)<<32-g):(On(((m|0)<0?-1:0)|0),m>>g-32|0)}function tt(p,m,g){return p=p|0,m=m|0,g=g|0,(g|0)<32?(On(m>>>g|0),p>>>g|(m&(1<<g)-1)<<32-g):(On(0),m>>>g-32|0)}function ft(p,m,g){return p=p|0,m=m|0,g=g|0,(g|0)<32?(On(m<<g|(p&(1<<g)-1<<32-g)>>>32-g|0),p<<g):(On(p<<g-32|0),0)}function TL(p,m,g){return p=p|0,m=m|0,g=g|0,m=Gf(m)|0,(m|0)==32&&(m=m+(Gf(p)|0)|0),On(0),m|0}function Nq(p,m){return p=+p,m=+m,p!=p?+m:m!=m?+p:+xce(+p,+m)}function pT(p,m){return p=+p,m=+m,p!=p?+m:m!=m?+p:+tL(+p,+m)}function mT(p){return p=+p,p>=0?+fo(p+.5):+x1(p-.5)}function cu(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if((g|0)>=8192)return wce(p|0,m|0,g|0)|0,p|0;if(x=p|0,v=p+g|0,(p&3)==(m&3)){for(;p&3;){if(!g)return x|0;He[p>>0]=He[m>>0]|0,p=p+1|0,m=m+1|0,g=g-1|0}for(g=v&-4|0,_=g-64|0;(p|0)<=(_|0);)h[p>>2]=h[m>>2],h[p+4>>2]=h[m+4>>2],h[p+8>>2]=h[m+8>>2],h[p+12>>2]=h[m+12>>2],h[p+16>>2]=h[m+16>>2],h[p+20>>2]=h[m+20>>2],h[p+24>>2]=h[m+24>>2],h[p+28>>2]=h[m+28>>2],h[p+32>>2]=h[m+32>>2],h[p+36>>2]=h[m+36>>2],h[p+40>>2]=h[m+40>>2],h[p+44>>2]=h[m+44>>2],h[p+48>>2]=h[m+48>>2],h[p+52>>2]=h[m+52>>2],h[p+56>>2]=h[m+56>>2],h[p+60>>2]=h[m+60>>2],p=p+64|0,m=m+64|0;for(;(p|0)<(g|0);)h[p>>2]=h[m>>2],p=p+4|0,m=m+4|0}else for(g=v-4|0;(p|0)<(g|0);)He[p>>0]=He[m>>0]|0,He[p+1>>0]=He[m+1>>0]|0,He[p+2>>0]=He[m+2>>0]|0,He[p+3>>0]=He[m+3>>0]|0,p=p+4|0,m=m+4|0;for(;(p|0)<(v|0);)He[p>>0]=He[m>>0]|0,p=p+1|0,m=m+1|0;return x|0}function EL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0;if((m|0)<(p|0)&(p|0)<(m+g|0)){for(_=p,m=m+g|0,p=p+g|0;(g|0)>0;)p=p-1|0,m=m-1|0,g=g-1|0,He[p>>0]=He[m>>0]|0;p=_}else cu(p,m,g)|0;return p|0}function lp(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;if(x=p+g|0,m=m&255,(g|0)>=67){for(;p&3;)He[p>>0]=m,p=p+1|0;for(_=x&-4|0,b=m|m<<8|m<<16|m<<24,v=_-64|0;(p|0)<=(v|0);)h[p>>2]=b,h[p+4>>2]=b,h[p+8>>2]=b,h[p+12>>2]=b,h[p+16>>2]=b,h[p+20>>2]=b,h[p+24>>2]=b,h[p+28>>2]=b,h[p+32>>2]=b,h[p+36>>2]=b,h[p+40>>2]=b,h[p+44>>2]=b,h[p+48>>2]=b,h[p+52>>2]=b,h[p+56>>2]=b,h[p+60>>2]=b,p=p+64|0;for(;(p|0)<(_|0);)h[p>>2]=b,p=p+4|0}for(;(p|0)<(x|0);)He[p>>0]=m,p=p+1|0;return x-g|0}function Fq(p){return p=+p,p>=0?+fo(p+.5):+x1(p-.5)}function cp(p){p=p|0;var m=0,g=0,_=0;return _=bce()|0,g=h[ol>>2]|0,m=g+p|0,(p|0)>0&(m|0)<(g|0)|(m|0)<0?(Tce(m|0)|0,ZG(12),-1):(m|0)>(_|0)&&!(Sce(m|0)|0)?(ZG(12),-1):(h[ol>>2]=m,g|0)}function the(p,m,g){return p=p|0,m=m|0,g=g|0,up[p&3](m|0,g|0)|0}function nhe(p,m){return p=p|0,m=m|0,yce(0),0}var up=[nhe,Qce,Jce,eue];return{___divdi3:op,___muldi3:wr,___remdi3:ap,___uremdi3:qf,_areNeighborCells:tue,_bitshift64Ashr:Dq,_bitshift64Lshr:tt,_bitshift64Shl:ft,_calloc:Ea,_cellAreaKm2:Uce,_cellAreaM2:kce,_cellAreaRads2:Oce,_cellToBoundary:zm,_cellToCenterChild:pq,_cellToChildPos:yue,_cellToChildren:fue,_cellToChildrenSize:jx,_cellToLatLng:w1,_cellToLocalIj:Due,_cellToParent:hL,_cellToVertex:xc,_cellToVertexes:Zue,_cellsToDirectedEdge:nue,_cellsToLinkedMultiPolygon:Bce,_childPosToCell:bue,_compactCells:due,_constructCell:uue,_destroyLinkedMultiPolygon:Iue,_directedEdgeToBoundary:Hx,_directedEdgeToCells:sue,_edgeLengthKm:Rue,_edgeLengthM:Pue,_edgeLengthRads:Cue,_emscripten_replace_memory:Ece,_free:_t,_getBaseCellNumber:fq,_getDirectedEdgeDestination:rue,_getDirectedEdgeOrigin:iue,_getHexagonAreaAvgKm2:gq,_getHexagonAreaAvgM2:Tue,_getHexagonEdgeLengthAvgKm:Eue,_getHexagonEdgeLengthAvgM:Mue,_getIcosahedronFaces:mq,_getIndexDigit:cue,_getNumCells:aT,_getPentagons:AL,_getRes0Cells:Hce,_getResolution:cL,_greatCircleDistanceKm:$x,_greatCircleDistanceM:Sue,_greatCircleDistanceRads:wue,_gridDisk:KG,_gridDiskDistances:QG,_gridDistance:_L,_gridPathCells:Bue,_gridPathCellsSize:Fue,_gridRing:Lce,_gridRingUnsafe:eq,_i64Add:At,_i64Subtract:Js,_isPentagon:Zi,_isResClassIII:Aue,_isValidCell:oT,_isValidDirectedEdge:lq,_isValidIndex:hue,_isValidVertex:Eq,_latLngToCell:pL,_llvm_ctlz_i64:TL,_llvm_maxnum_f64:Nq,_llvm_minnum_f64:pT,_llvm_round_f64:mT,_localIjToCell:Nue,_malloc:br,_maxFaceCount:_ue,_maxGridDiskSize:Ice,_maxPolygonToCellsSize:Nce,_maxPolygonToCellsSizeExperimental:kue,_memcpy:cu,_memmove:EL,_memset:lp,_originToDirectedEdges:oL,_pentagonCount:xue,_polygonToCells:Fce,_polygonToCellsExperimental:Uue,_readInt64AsDoubleFromPointer:Xue,_res0CellCount:qce,_reverseDirectedEdge:cq,_round:Fq,_sbrk:cp,_sizeOfCellBoundary:Gue,_sizeOfCoordIJ:jue,_sizeOfGeoLoop:que,_sizeOfGeoPolygon:Hue,_sizeOfH3Index:zue,_sizeOfLatLng:Vue,_sizeOfLinkedGeoPolygon:Wue,_uncompactCells:pue,_uncompactCellsSize:mue,_vertexToLatLng:Kue,dynCall_iii:the,establishStackSpace:Pce,stackAlloc:Mce,stackRestore:Rce,stackSave:Cce}})(Bt,ut,W),Yt=e.___divdi3=Ce.___divdi3,nr=e.___muldi3=Ce.___muldi3,Fn=e.___remdi3=Ce.___remdi3,rs=e.___uremdi3=Ce.___uremdi3,Lr=e._areNeighborCells=Ce._areNeighborCells,Fl=e._bitshift64Ashr=Ce._bitshift64Ashr,Sa=e._bitshift64Lshr=Ce._bitshift64Lshr,Bl=e._bitshift64Shl=Ce._bitshift64Shl,rl=e._calloc=Ce._calloc,xr=e._cellAreaKm2=Ce._cellAreaKm2,Zs=e._cellAreaM2=Ce._cellAreaM2,Ol=e._cellAreaRads2=Ce._cellAreaRads2,nh=e._cellToBoundary=Ce._cellToBoundary,tT=e._cellToCenterChild=Ce._cellToCenterChild,XI=e._cellToChildPos=Ce._cellToChildPos,$I=e._cellToChildren=Ce._cellToChildren,Vx=e._cellToChildrenSize=Ce._cellToChildrenSize,YI=e._cellToLatLng=Ce._cellToLatLng,Gx=e._cellToLocalIj=Ce._cellToLocalIj,ZI=e._cellToParent=Ce._cellToParent,KI=e._cellToVertex=Ce._cellToVertex,VG=e._cellToVertexes=Ce._cellToVertexes,GG=e._cellsToDirectedEdge=Ce._cellsToDirectedEdge,qG=e._cellsToLinkedMultiPolygon=Ce._cellsToLinkedMultiPolygon,HG=e._childPosToCell=Ce._childPosToCell,ne=e._compactCells=Ce._compactCells,Se=e._constructCell=Ce._constructCell,ke=e._destroyLinkedMultiPolygon=Ce._destroyLinkedMultiPolygon,De=e._directedEdgeToBoundary=Ce._directedEdgeToBoundary,Ne=e._directedEdgeToCells=Ce._directedEdgeToCells,qt=e._edgeLengthKm=Ce._edgeLengthKm,Qt=e._edgeLengthM=Ce._edgeLengthM,Vt=e._edgeLengthRads=Ce._edgeLengthRads,sn=e._emscripten_replace_memory=Ce._emscripten_replace_memory,pn=e._free=Ce._free,Wn=e._getBaseCellNumber=Ce._getBaseCellNumber,Jn=e._getDirectedEdgeDestination=Ce._getDirectedEdgeDestination,gn=e._getDirectedEdgeOrigin=Ce._getDirectedEdgeOrigin,Yi=e._getHexagonAreaAvgKm2=Ce._getHexagonAreaAvgKm2,ss=e._getHexagonAreaAvgM2=Ce._getHexagonAreaAvgM2,qr=e._getHexagonEdgeLengthAvgKm=Ce._getHexagonEdgeLengthAvgKm,ir=e._getHexagonEdgeLengthAvgM=Ce._getHexagonEdgeLengthAvgM,Co=e._getIcosahedronFaces=Ce._getIcosahedronFaces,Zt=e._getIndexDigit=Ce._getIndexDigit,sl=e._getNumCells=Ce._getNumCells,yi=e._getPentagons=Ce._getPentagons,Ul=e._getRes0Cells=Ce._getRes0Cells,lu=e._getResolution=Ce._getResolution,kf=e._greatCircleDistanceKm=Ce._greatCircleDistanceKm,Bm=e._greatCircleDistanceM=Ce._greatCircleDistanceM,rr=e._greatCircleDistanceRads=Ce._greatCircleDistanceRads,os=e._gridDisk=Ce._gridDisk,zf=e._gridDiskDistances=Ce._gridDiskDistances,pr=e._gridDistance=Ce._gridDistance,Vf=e._gridPathCells=Ce._gridPathCells,Om=e._gridPathCellsSize=Ce._gridPathCellsSize,QI=e._gridRing=Ce._gridRing,h8e=e._gridRingUnsafe=Ce._gridRingUnsafe,f8e=e._i64Add=Ce._i64Add,d8e=e._i64Subtract=Ce._i64Subtract,p8e=e._isPentagon=Ce._isPentagon,m8e=e._isResClassIII=Ce._isResClassIII,A8e=e._isValidCell=Ce._isValidCell,g8e=e._isValidDirectedEdge=Ce._isValidDirectedEdge,v8e=e._isValidIndex=Ce._isValidIndex,_8e=e._isValidVertex=Ce._isValidVertex,x8e=e._latLngToCell=Ce._latLngToCell,y8e=e._llvm_ctlz_i64=Ce._llvm_ctlz_i64,b8e=e._llvm_maxnum_f64=Ce._llvm_maxnum_f64,w8e=e._llvm_minnum_f64=Ce._llvm_minnum_f64,S8e=e._llvm_round_f64=Ce._llvm_round_f64,T8e=e._localIjToCell=Ce._localIjToCell,E8e=e._malloc=Ce._malloc,M8e=e._maxFaceCount=Ce._maxFaceCount,C8e=e._maxGridDiskSize=Ce._maxGridDiskSize,R8e=e._maxPolygonToCellsSize=Ce._maxPolygonToCellsSize,P8e=e._maxPolygonToCellsSizeExperimental=Ce._maxPolygonToCellsSizeExperimental,I8e=e._memcpy=Ce._memcpy,L8e=e._memmove=Ce._memmove,D8e=e._memset=Ce._memset,N8e=e._originToDirectedEdges=Ce._originToDirectedEdges,F8e=e._pentagonCount=Ce._pentagonCount,B8e=e._polygonToCells=Ce._polygonToCells,O8e=e._polygonToCellsExperimental=Ce._polygonToCellsExperimental,U8e=e._readInt64AsDoubleFromPointer=Ce._readInt64AsDoubleFromPointer,k8e=e._res0CellCount=Ce._res0CellCount,z8e=e._reverseDirectedEdge=Ce._reverseDirectedEdge,V8e=e._round=Ce._round,G8e=e._sbrk=Ce._sbrk,q8e=e._sizeOfCellBoundary=Ce._sizeOfCellBoundary,H8e=e._sizeOfCoordIJ=Ce._sizeOfCoordIJ,W8e=e._sizeOfGeoLoop=Ce._sizeOfGeoLoop,j8e=e._sizeOfGeoPolygon=Ce._sizeOfGeoPolygon,X8e=e._sizeOfH3Index=Ce._sizeOfH3Index,$8e=e._sizeOfLatLng=Ce._sizeOfLatLng,Y8e=e._sizeOfLinkedGeoPolygon=Ce._sizeOfLinkedGeoPolygon,Z8e=e._uncompactCells=Ce._uncompactCells,K8e=e._uncompactCellsSize=Ce._uncompactCellsSize,Q8e=e._vertexToLatLng=Ce._vertexToLatLng,J8e=e.establishStackSpace=Ce.establishStackSpace,WG=e.stackAlloc=Ce.stackAlloc,gce=e.stackRestore=Ce.stackRestore,vce=e.stackSave=Ce.stackSave,eFe=e.dynCall_iii=Ce.dynCall_iii;if(e.asm=Ce,e.cwrap=P,e.setValue=y,e.getValue=w,le){Te(le)||(le=o(le));{vi("memory initializer");var JI=function(Le){Le.byteLength&&(Le=new Uint8Array(Le)),H.set(Le,A),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,zn("memory initializer")},jG=function(){a(le,JI,function(){throw"could not load memory initializer "+le})},XG=St(le);if(XG)JI(XG.buffer);else if(e.memoryInitializerRequest){var $G=function(){var Le=e.memoryInitializerRequest,it=Le.response;if(Le.status!==200&&Le.status!==0){var Dt=St(e.memoryInitializerRequestURL);if(Dt)it=Dt.buffer;else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+Le.status+", retrying "+le),jG();return}}JI(it)};e.memoryInitializerRequest.response?setTimeout($G,0):e.memoryInitializerRequest.addEventListener("load",$G)}else jG()}}var nT;_e=function Le(){nT||eL(),nT||(_e=Le)};function eL(Le){if(Le=Le||r,tn>0||(Pt(),tn>0))return;function it(){nT||(nT=!0,!S&&(dn(),Gt(),e.onRuntimeInitialized&&e.onRuntimeInitialized(),$e()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),it()},1)):it()}e.run=eL;function Um(Le){throw e.onAbort&&e.onAbort(Le),Le+="",l(Le),c(Le),S=!0,"abort("+Le+"). Build with -s ASSERTIONS=1 for more info."}if(e.abort=Um,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return eL(),i})(typeof Ai=="object"?Ai:{}),En="number",Sn=En,U_=En,Cn=En,Rn=En,wo=En,jt=En,zSe=[["sizeOfH3Index",En],["sizeOfLatLng",En],["sizeOfCellBoundary",En],["sizeOfGeoLoop",En],["sizeOfGeoPolygon",En],["sizeOfLinkedGeoPolygon",En],["sizeOfCoordIJ",En],["readInt64AsDoubleFromPointer",En],["isValidCell",U_,[Cn,Rn]],["isValidIndex",U_,[Cn,Rn]],["latLngToCell",Sn,[En,En,wo,jt]],["cellToLatLng",Sn,[Cn,Rn,jt]],["cellToBoundary",Sn,[Cn,Rn,jt]],["maxGridDiskSize",Sn,[En,jt]],["gridDisk",Sn,[Cn,Rn,En,jt]],["gridDiskDistances",Sn,[Cn,Rn,En,jt,jt]],["gridRing",Sn,[Cn,Rn,En,jt]],["gridRingUnsafe",Sn,[Cn,Rn,En,jt]],["maxPolygonToCellsSize",Sn,[jt,wo,En,jt]],["polygonToCells",Sn,[jt,wo,En,jt]],["maxPolygonToCellsSizeExperimental",Sn,[jt,wo,En,jt]],["polygonToCellsExperimental",Sn,[jt,wo,En,En,En,jt]],["cellsToLinkedMultiPolygon",Sn,[jt,En,jt]],["destroyLinkedMultiPolygon",null,[jt]],["compactCells",Sn,[jt,jt,En,En]],["uncompactCells",Sn,[jt,En,En,jt,En,wo]],["uncompactCellsSize",Sn,[jt,En,En,wo,jt]],["isPentagon",U_,[Cn,Rn]],["isResClassIII",U_,[Cn,Rn]],["getBaseCellNumber",En,[Cn,Rn]],["getResolution",En,[Cn,Rn]],["getIndexDigit",En,[Cn,Rn,En]],["constructCell",Sn,[En,En,jt,jt]],["maxFaceCount",Sn,[Cn,Rn,jt]],["getIcosahedronFaces",Sn,[Cn,Rn,jt]],["cellToParent",Sn,[Cn,Rn,wo,jt]],["cellToChildren",Sn,[Cn,Rn,wo,jt]],["cellToCenterChild",Sn,[Cn,Rn,wo,jt]],["cellToChildrenSize",Sn,[Cn,Rn,wo,jt]],["cellToChildPos",Sn,[Cn,Rn,wo,jt]],["childPosToCell",Sn,[En,En,Cn,Rn,wo,jt]],["areNeighborCells",Sn,[Cn,Rn,Cn,Rn,jt]],["cellsToDirectedEdge",Sn,[Cn,Rn,Cn,Rn,jt]],["getDirectedEdgeOrigin",Sn,[Cn,Rn,jt]],["getDirectedEdgeDestination",Sn,[Cn,Rn,jt]],["isValidDirectedEdge",U_,[Cn,Rn]],["directedEdgeToCells",Sn,[Cn,Rn,jt]],["originToDirectedEdges",Sn,[Cn,Rn,jt]],["directedEdgeToBoundary",Sn,[Cn,Rn,jt]],["reverseDirectedEdge",Sn,[Cn,Rn,jt]],["gridDistance",Sn,[Cn,Rn,Cn,Rn,jt]],["gridPathCells",Sn,[Cn,Rn,Cn,Rn,jt]],["gridPathCellsSize",Sn,[Cn,Rn,Cn,Rn,jt]],["cellToLocalIj",Sn,[Cn,Rn,Cn,Rn,En,jt]],["localIjToCell",Sn,[Cn,Rn,jt,En,jt]],["getHexagonAreaAvgM2",Sn,[wo,jt]],["getHexagonAreaAvgKm2",Sn,[wo,jt]],["getHexagonEdgeLengthAvgM",Sn,[wo,jt]],["getHexagonEdgeLengthAvgKm",Sn,[wo,jt]],["greatCircleDistanceM",En,[jt,jt]],["greatCircleDistanceKm",En,[jt,jt]],["greatCircleDistanceRads",En,[jt,jt]],["cellAreaM2",Sn,[Cn,Rn,jt]],["cellAreaKm2",Sn,[Cn,Rn,jt]],["cellAreaRads2",Sn,[Cn,Rn,jt]],["edgeLengthM",Sn,[Cn,Rn,jt]],["edgeLengthKm",Sn,[Cn,Rn,jt]],["edgeLengthRads",Sn,[Cn,Rn,jt]],["getNumCells",Sn,[wo,jt]],["getRes0Cells",Sn,[jt]],["res0CellCount",En],["getPentagons",Sn,[En,jt]],["pentagonCount",En],["cellToVertex",Sn,[Cn,Rn,En,jt]],["cellToVertexes",Sn,[Cn,Rn,jt]],["vertexToLatLng",Sn,[Cn,Rn,jt]],["isValidVertex",U_,[Cn,Rn]]],VSe=0,GSe=1,qSe=2,HSe=3,_ee=4,WSe=5,jSe=6,XSe=7,$Se=8,YSe=9,ZSe=10,KSe=11,QSe=12,JSe=13,eTe=14,tTe=15,nTe=16,iTe=17,rTe=18,sTe=19,Cs={};Cs[VSe]="Success";Cs[GSe]="The operation failed but a more specific error is not available";Cs[qSe]="Argument was outside of acceptable range";Cs[HSe]="Latitude or longitude arguments were outside of acceptable range";Cs[_ee]="Resolution argument was outside of acceptable range";Cs[WSe]="Cell argument was not valid";Cs[jSe]="Directed edge argument was not valid";Cs[XSe]="Undirected edge argument was not valid";Cs[$Se]="Vertex argument was not valid";Cs[YSe]="Pentagon distortion was encountered";Cs[ZSe]="Duplicate input";Cs[KSe]="Cell arguments were not neighbors";Cs[QSe]="Cell arguments had incompatible resolutions";Cs[JSe]="Memory allocation failed";Cs[eTe]="Bounds of provided memory were insufficient";Cs[tTe]="Mode or flags argument was not valid";Cs[nTe]="Index argument was not valid";Cs[iTe]="Base cell number was outside of acceptable range";Cs[rTe]="Child indexing digits invalid";Cs[sTe]="Child indexing digits refer to a deleted subsequence";var oTe=1e3,xee=1001,yee=1002,uR={};uR[oTe]="Unknown unit";uR[xee]="Array length out of bounds";uR[yee]="Got unexpected null value for H3 index";var aTe="Unknown error";function bee(i,e,t){var n=t&&"value"in t,r=new Error((i[e]||aTe)+" (code: "+e+(n?", value: "+t.value:"")+")");return r.code=e,r}function wee(i,e){var t=arguments.length===2?{value:e}:{};return bee(Cs,i,t)}function See(i,e){var t=arguments.length===2?{value:e}:{};return bee(uR,i,t)}function Nw(i){if(i!==0)throw wee(i)}var Rl={};zSe.forEach(function(e){Rl[e[0]]=Ai.cwrap.apply(Ai,e)});var k_=16;var Fw=4;var z_=8,lTe=8,lR=Rl.sizeOfH3Index(),IO=Rl.sizeOfLatLng(),cTe=Rl.sizeOfCellBoundary(),uTe=Rl.sizeOfGeoPolygon(),Dw=Rl.sizeOfGeoLoop(),ult=Rl.sizeOfLinkedGeoPolygon(),hlt=Rl.sizeOfCoordIJ();function hTe(i){if(typeof i!="number"||i<0||i>15||Math.floor(i)!==i)throw wee(_ee,i);return i}function fTe(i){if(!i)throw See(yee);return i}var dTe=Math.pow(2,32)-1,flt=Math.pow(2,31)-1;function pTe(i){if(i>dTe)throw See(xee,i);return i}var mTe=/[^0-9a-fA-F]/;function Tee(i){if(Array.isArray(i)&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1]))return i;if(typeof i!="string"||mTe.test(i))return[0,0];var e=parseInt(i.substring(0,i.length-8),k_),t=parseInt(i.substring(i.length-8),k_);return[t,e]}function gee(i){if(i>=0)return i.toString(k_);i=i&2147483647;var e=Eee(8,i.toString(k_)),t=(parseInt(e[0],k_)+8).toString(k_);return e=t+e.substring(1),e}function ATe(i,e){return gee(e)+Eee(8,gee(i))}function Eee(i,e){for(var t=i-e.length,n="",r=0;r<t;r++)n+="0";return n=n+e,n}var dlt=Math.pow(2,32);function vee(i,e,t){for(var n=i.length,r=Ai._calloc(n,IO),s=t?1:0,o=t?0:1,a=0;a<n*2;a+=2)Ai.HEAPF64.set([i[a/2][s],i[a/2][o]].map(Pee),r/z_+a);return Ai.HEAPU32.set([n,r],e/Fw),e}function gTe(i,e){var t=i.length-1,n=Ai._calloc(uTe),r=0,s=r+Dw,o=s+Fw;vee(i[0],n+r,e);var a;if(t>0){a=Ai._calloc(t,Dw);for(var l=0;l<t;l++)vee(i[l+1],a+Dw*l,e)}return Ai.setValue(n+s,t,"i32"),Ai.setValue(n+o,a,"i32"),n}function vTe(i){var e=0,t=e+Dw,n=t+Fw,r=Fw;Ai._free(Ai.getValue(i+e+r,"i8*"));var s=Ai.getValue(i+t,"i32");if(s>0){for(var o=Ai.getValue(i+n,"i32"),a=0;a<s;a++)Ai._free(Ai.getValue(o+Dw*a+r,"i8*"));Ai._free(o)}Ai._free(i)}function Mee(i,e){e===void 0&&(e=0);var t=Ai.getValue(i+lR*e,"i32"),n=Ai.getValue(i+lR*e+Fw,"i32");return n?ATe(t,n):null}function _Te(i){return Rl.readInt64AsDoubleFromPointer(i)}function xTe(i,e){for(var t=[],n=0;n<e;n++){var r=Mee(i,n);r!==null&&t.push(r)}return t}function cR(i){return wTe(Ai.getValue(i,"double"))}function Cee(i){return[cR(i),cR(i+z_)]}function yTe(i){return[cR(i+z_),cR(i)]}function bTe(i,e,t){for(var n=Ai.getValue(i,"i32"),r=i+z_,s=[],o=e?yTe:Cee,a=0;a<n*2;a+=2)s.push(o(r+z_*a));return t&&s.push(s[0]),s}function Ree(i,e,t){var n=Ai._malloc(IO);Ai.HEAPF64.set([i,e].map(Pee),n/z_);var r=Ai._malloc(lR);try{return Nw(Rl.latLngToCell(n,t,r)),fTe(Mee(r))}finally{Ai._free(r),Ai._free(n)}}function LO(i){var e=Ai._malloc(IO),t=Tee(i),n=t[0],r=t[1];try{return Nw(Rl.cellToLatLng(n,r,e)),Cee(e)}finally{Ai._free(e)}}function DO(i,e){var t=Ai._malloc(cTe),n=Tee(i),r=n[0],s=n[1];try{return Nw(Rl.cellToBoundary(r,s,t)),bTe(t,e,e)}finally{Ai._free(t)}}function NO(i,e,t){if(hTe(e),t=!!t,i.length===0||i[0].length===0)return[];var n=typeof i[0][0]=="number"?[i]:i,r=gTe(n,t),s=Ai._malloc(lTe);try{Nw(Rl.maxPolygonToCellsSize(r,e,0,s));var o=pTe(_Te(s)),a=Ai._calloc(o,lR);try{return Nw(Rl.polygonToCells(r,e,0,a)),xTe(a,o)}finally{Ai._free(a)}}finally{Ai._free(s),vTe(r)}}function Pee(i){return i*Math.PI/180}function wTe(i){return i*180/Math.PI}function FO(i){return i=Math.max(0,Math.min(1,i)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+i*(1172.33-i*(10793.56-i*(33300.12-i*(38394.49-i*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+i*(557.33+i*(1225.33-i*(3574.96-i*(1073.77+i*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+i*(3211.1-i*(15327.97-i*(27814-i*(22569.18-i*6838.66)))))))+")"}var STe=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","aoMapIntensity","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveIntensity","emissiveMap","envMap","envMapIntensity","envMapRotation","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","lightMapIntensity","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"],Iee=new WeakMap,Lee=new WeakMap,Dee=new WeakMap,xU=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=STe,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}needsVelocity(e){let t=e.getMRT();return t!==null&&t.has("velocity")}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){let{geometry:n,object:r}=e;if(t={geometryId:n.id,worldMatrix:r.matrixWorld.clone()},r.center&&(t.center=r.center.clone()),r.morphTargetInfluences&&(t.morphTargetInfluences=r.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),e.material.transmission>0){let{width:a,height:l}=e.context;t.bufferWidth=a,t.bufferHeight=l}let{environmentIntensity:s,environmentRotation:o}=e.scene;t.environmentIntensity=s,t.environmentRotation=o.clone(),t.lights=this.getLightsData(e.lightsNode.getLights(),[]),this.renderObjects.set(e,t)}return t}getAttributesData(e){let t={};for(let n in e){let r=e[n];t[n]={id:r.isInterleavedBufferAttribute?r.data.uuid:r.id,version:r.isInterleavedBufferAttribute?r.data.version:r.version}}return t}containsNode(e){let t=e.material;for(let n in t)if(t[n]&&t[n].isNode)return!0;return!!(e.context.modelViewMatrix||e.context.modelNormalViewMatrix||e.context.getAO||e.context.getShadow)}getGeometryData(e){let t=Dee.get(e);return t===void 0&&(t={_renderId:-1,_equal:!1,attributes:this.getAttributesData(e.attributes),indexId:e.index?e.index.id:null,indexVersion:e.index?e.index.version:null,drawRange:{start:e.drawRange.start,count:e.drawRange.count}},Dee.set(e,t)),t}getMaterialData(e){let t=Lee.get(e);if(t===void 0){t={_renderId:-1,_equal:!1};for(let n of this.refreshUniforms){let r=e[n];r!=null&&(typeof r=="object"&&r.clone!==void 0?r.isTexture===!0?t[n]={id:r.id,version:0}:t[n]=r.clone():t[n]=r)}Lee.set(e,t)}return t}equals(e,t,n){let{object:r,material:s,geometry:o}=e,a=this.getRenderObjectData(e);if(a.worldMatrix.equals(r.matrixWorld)!==!0)return a.worldMatrix.copy(r.matrixWorld),!1;let l=this.getMaterialData(e.material);if(l._renderId!==n){l._renderId=n;for(let f in l){let d=l[f],A=s[f];if(f!=="_renderId"&&f!=="_equal"){if(d.equals!==void 0){if(d.equals(A)===!1)return d.copy(A),l._equal=!1,!1}else if(A.isTexture===!0){if(d.id!==A.id||d.version!==A.version)return d.id=A.id,d.version=A.version,l._equal=!1,!1}else if(d!==A)return l[f]=A,l._equal=!1,!1}}if(l.transmission>0){let{width:f,height:d}=e.context;if(a.bufferWidth!==f||a.bufferHeight!==d)return a.bufferWidth=f,a.bufferHeight=d,l._equal=!1,!1}l._equal=!0}else if(l._equal===!1)return!1;if(a.geometryId!==o.id)return a.geometryId=o.id,!1;let c=this.getGeometryData(e.geometry);if(c._renderId!==n){c._renderId=n;let f=o.attributes,d=c.attributes,A=0,y=0;for(let P in f)A++;for(let P in d){y++;let F=d[P],D=f[P];if(D===void 0)return delete d[P],c._equal=!1,!1;let L=D.isInterleavedBufferAttribute?D.data.uuid:D.id,C=D.isInterleavedBufferAttribute?D.data.version:D.version;if(F.id!==L||F.version!==C)return F.id=L,F.version=C,c._equal=!1,!1}if(y!==A)return c.attributes=this.getAttributesData(f),c._equal=!1,!1;let w=o.index,S=c.indexId,T=c.indexVersion,R=w?w.id:null,I=w?w.version:null;if(S!==R||T!==I)return c.indexId=R,c.indexVersion=I,c._equal=!1,!1;if(c.drawRange.start!==o.drawRange.start||c.drawRange.count!==o.drawRange.count)return c.drawRange.start=o.drawRange.start,c.drawRange.count=o.drawRange.count,c._equal=!1,!1;c._equal=!0}else if(c._equal===!1)return!1;if(a.morphTargetInfluences){let f=!1;for(let d=0;d<a.morphTargetInfluences.length;d++)a.morphTargetInfluences[d]!==r.morphTargetInfluences[d]&&(a.morphTargetInfluences[d]=r.morphTargetInfluences[d],f=!0);if(f)return!1}if(a.lights){for(let f=0;f<t.length;f++)if(a.lights[f].map!==t[f].map)return!1}let u=e.scene;return u.environment!==null&&s.envMap===null&&(a.environmentIntensity!==u.environmentIntensity||a.environmentRotation.equals(u.environmentRotation)===!1)?(a.environmentIntensity=u.environmentIntensity,a.environmentRotation.copy(u.environmentRotation),!1):a.center&&a.center.equals(r.center)===!1?(a.center.copy(r.center),!1):(e.bundle!==null&&(a.version=e.bundle.version),!0)}getLightsData(e,t){t.length=0;for(let n of e)n.isSpotLight===!0&&n.map!==null&&t.push({map:n.map.version});return t}getLights(e,t){let n=Iee.get(e);return n===void 0&&(n={renderId:-1,lightsData:[]},Iee.set(e,n)),n.renderId===t||(n.renderId=t,this.getLightsData(e.getLights(),n.lightsData)),n.lightsData}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e)||this.needsVelocity(t.renderer))return!0;let{renderId:n}=t;if(this.renderId!==n)return this.renderId=n,!0;let r=e.object.static===!0,s=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;if(r||s)return!1;let o=this.getLights(e.lightsNode,n);return this.equals(e,o,n)!==!0}},TTe=[/^StackTrace\.js$/,/^TSLCore\.js$/,/^.*Node\.js$/,/^three\.webgpu.*\.js$/];function ETe(i){let e=/(?:at\s+(.+?)\s+\()?(?:(.+?)@)?([^@\s()]+):(\d+):(\d+)/;return i.split(`4131+`).map(t=>{let n=t.match(e);if(!n)return null;let r=n[1]||n[2]||"",s=n[3].split("?")[0],o=parseInt(n[4],10),a=parseInt(n[5],10),l=s.split("/").pop();return{fn:r,file:l,line:o,column:a}}).filter(t=>t&&!TTe.some(n=>n.test(t.file)))}var ts=class{constructor(e=null){this.isStackTrace=!0,this.stack=ETe(e||new Error().stack)}getLocation(){if(this.stack.length===0)return"[Unknown location]";let e=this.stack[0],t=e.fn;return`${t?`"${t}()" at `:""}"${e.file}:${e.line}"`}getError(e){if(this.stack.length===0)return e;let t=this.stack.map(n=>{let r=`${n.file}:${n.line}:${n.column}`;return n.fn?` at ${n.fn} (${r})`:` at ${r}`}).join(`41324132 `);return`${e}4133-${t}`}};function oz(i,e=0){let t=3735928559^e,n=1103547991^e;if(Array.isArray(i))for(let r=0,s;r<i.length;r++)s=i[r],t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677);else for(let r=0,s;r<i.length;r++)s=i.charCodeAt(r),t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&n)+(t>>>0)}var wx=i=>oz(i),FS=i=>oz(i),sS=(...i)=>oz(i),ITe=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),Uee=new WeakMap;function one(i){return ITe.get(i)}function s4(i){if(/[iu]?vec\d/.test(i))return i.startsWith("ivec")?Int32Array:i.startsWith("uvec")?Uint32Array:Float32Array;if(/mat\d/.test(i)||/float/.test(i))return Float32Array;if(/uint/.test(i))return Uint32Array;if(/int/.test(i))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${i}`)}function ane(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i)||/mat2/.test(i))return 4;if(/mat3/.test(i))return 9;if(/mat4/.test(i))return 16;ze(`TSL: Unsupported type: ${i}`,new ts)}function PTe(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i)||/mat2/.test(i))return 4;if(/mat3/.test(i))return 12;if(/mat4/.test(i))return 16;ze(`TSL: Unsupported type: ${i}`,new ts)}function LTe(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i)||/vec4/.test(i))return 4;if(/mat2/.test(i))return 2;if(/mat3/.test(i)||/mat4/.test(i))return 4;ze(`TSL: Unsupported type: ${i}`,new ts)}function dm(i){if(i==null)return null;let e=typeof i;return i.isNode===!0?"node":e==="number"?"float":e==="boolean"?"bool":e==="string"?"string":e==="function"?"shader":i.isVector2===!0?"vec2":i.isVector3===!0?"vec3":i.isVector4===!0?"vec4":i.isMatrix2===!0?"mat2":i.isMatrix3===!0?"mat3":i.isMatrix4===!0?"mat4":i.isColor===!0?"color":i instanceof ArrayBuffer?"ArrayBuffer":null}function az(i,...e){let t=i?i.slice(-4):void 0;return e.length===1&&(t==="vec2"?e=[e[0],e[0]]:t==="vec3"?e=[e[0],e[0],e[0]]:t==="vec4"&&(e=[e[0],e[0],e[0],e[0]])),i==="color"?new zt(...e):t==="vec2"?new Oe(...e):t==="vec3"?new re(...e):t==="vec4"?new xn(...e):t==="mat2"?new h_(...e):t==="mat3"?new Mn(...e):t==="mat4"?new cn(...e):i==="bool"?e[0]||!1:i==="float"||i==="int"||i==="uint"?e[0]||0:i==="string"?e[0]||"":i==="ArrayBuffer"?NTe(e[0]):null}function lne(i){let e=Uee.get(i);return e===void 0&&(e={},Uee.set(i,e)),e}function DTe(i){let e="",t=new Uint8Array(i);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function NTe(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0)).buffer}var nx={VERTEX:"vertex",FRAGMENT:"fragment"},yn={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},FTe={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},Yo={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},cne=["fragment","vertex"],JR=["setup","analyze","generate"],e4=[...cne,"compute"],l1=["x","y","z","w"],BTe={analyze:"setup",generate:"analyze"},OTe=0,Kt=class i extends ca{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=yn.NONE,this.updateBeforeType=yn.NONE,this.updateAfterType=yn.NONE,this.version=0,this.name="",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._uuid=null,this._cacheKeyVersion=0,this.id=OTe++,this.stackTrace=null,i.captureStackTrace===!0&&(this.stackTrace=new ts)}set needsUpdate(e){e===!0&&this.version++}get uuid(){return this._uuid===null&&(this._uuid=zu.generateUUID()),this._uuid}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this),this}onFrameUpdate(e){return this.onUpdate(e,yn.FRAME)}onRenderUpdate(e){return this.onUpdate(e,yn.RENDER)}onObjectUpdate(e){return this.onUpdate(e,yn.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(let{childNode:e}of this._getChildren())yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(let t of this.getChildren())t.traverse(e)}_getChildren(e=new Set){let t=[];e.add(this);for(let n of Object.getOwnPropertyNames(this)){let r=this[n];if(!(n.startsWith("_")===!0||e.has(r))){if(Array.isArray(r)===!0)for(let s=0;s<r.length;s++){let o=r[s];o&&o.isNode===!0&&t.push({property:n,index:s,childNode:o})}else if(r&&r.isNode===!0)t.push({property:n,childNode:r});else if(r&&Object.getPrototypeOf(r)===Object.prototype)for(let s in r){if(s.startsWith("_")===!0)continue;let o=r[s];o&&o.isNode===!0&&t.push({property:n,index:s,childNode:o})}}}return t}getCacheKey(e=!1,t=null){if(e=e||this.version!==this._cacheKeyVersion,e===!0||this._cacheKey===null){t===null&&(t=new Set);let n=[];for(let{property:r,childNode:s}of this._getChildren(t))n.push(wx(r.slice(0,-4)),s.getCacheKey(e,t));this._cacheKey=sS(FS(n),this.customCacheKey()),this._cacheKeyVersion=this.version}return this._cacheKey}customCacheKey(){return this.id}getScope(){return this}getHash(){return String(this.id)}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){let t=this.getNodeType(e);return e.getElementType(t)}getMemberType(){return"void"}getNodeType(e,t=null){let n=e.getDataFromNode(this),r;return t!==null?(n.typeFromOutput=n.typeFromOutput||{},r=n.typeFromOutput[t],r===void 0&&(r=this.generateNodeType(e,t),n.typeFromOutput[t]=r)):(r=n.type,r===void 0&&(r=this.generateNodeType(e),n.type=r)),r}generateNodeType(e,t=null){let n=e.getNodeProperties(this);return n.outputNode?n.outputNode.getNodeType(e,t):this.nodeType}getShared(e){let t=this.getHash(e),n=e.getNodeFromHash(t),r=null;if(n&&n!==this)r=n;else if(e.context.overrideNodes){let s=e.context.overrideNodes.get(this);if(s){let o=e.getDataFromNode(this);o.isOverwritten!==!0?(o.isOverwritten=!0,r=s(e).overrideNode(this,null),o.sharedNode=r):r=o.sharedNode}}return r||this}getArrayCount(){return null}setup(e){let t=e.getNodeProperties(this),n=0;for(let r of this.getChildren())t["node"+n++]=r;return t.outputNode||null}analyze(e,t=null){let n=e.increaseUsage(this);if(this.parents===!0){let r=e.getDataFromNode(this,"any");r.stages=r.stages||{},r.stages[e.shaderStage]=r.stages[e.shaderStage]||[],r.stages[e.shaderStage].push(t)}if(n===1){let r=e.getNodeProperties(this);for(let s of Object.values(r))s&&s.isNode===!0&&s.build(e,this)}}generate(e,t){let{outputNode:n}=e.getNodeProperties(this);if(n&&n.isNode===!0)return n.build(e,t)}updateBefore(){Xe("Abstract function.")}updateAfter(){Xe("Abstract function.")}update(){Xe("Abstract function.")}before(e){return this._beforeNodes===null&&(this._beforeNodes=[]),this._beforeNodes.push(e),this}build(e,t=null){let n=this.getShared(e);if(this!==n)return n.build(e,t);if(this._beforeNodes!==null){let l=this._beforeNodes;this._beforeNodes=null;for(let c of l)c.build(e,t);this._beforeNodes=l}let r=e.getDataFromNode(this);r.buildStages=r.buildStages||{},r.buildStages[e.buildStage]=!0;let s=BTe[e.buildStage];if(s&&r.buildStages[s]!==!0){let l=e.getBuildStage();e.setBuildStage(s),this.build(e),e.setBuildStage(l)}e.addChain(this);let o=null,a=e.getBuildStage();if(a==="setup"){e.addNode(this),this.updateReference(e);let l=e.getNodeProperties(this);if(l.initialized!==!0){l.initialized=!0,l.outputNode=this.setup(e)||l.outputNode||null;for(let c of Object.values(l))if(c&&c.isNode===!0){if(c.parents===!0){let u=e.getNodeProperties(c);u.parents=u.parents||[],u.parents.push(this)}c.build(e)}e.addSequentialNode(this)}o=l.outputNode}else if(a==="analyze")this.analyze(e,t);else if(a==="generate"){if(this.generate.length<2){let c=this.getNodeType(e),u=e.getDataFromNode(this);o=u.snippet,o===void 0?u.generated===void 0?(u.generated=!0,o=this.generate(e)||"",u.snippet=o):(Xe("Node: Recursion detected.",this),o="/* Recursion detected. */"):u.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),o=e.format(o,c,t)}else o=this.generate(e,t)||"";o===""&&t!==null&&t!=="void"&&t!=="OutputType"&&(ze(`TSL: Invalid generated code, expected a "${t}".`),o=e.generateConst(t))}return e.removeChain(this),o}getSerializeChildren(){return this._getChildren()}serialize(e){let t=this.getSerializeChildren(),n={};for(let{property:r,index:s,childNode:o}of t)s!==void 0?(n[r]===void 0&&(n[r]=Number.isInteger(s)?[]:{}),n[r][s]=o.toJSON(e.meta).uuid):n[r]=o.toJSON(e.meta).uuid;Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(e.inputNodes!==void 0){let t=e.meta.nodes;for(let n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){let r=[];for(let s of e.inputNodes[n])r.push(t[s]);this[n]=r}else if(typeof e.inputNodes[n]=="object"){let r={};for(let s in e.inputNodes[n]){let o=e.inputNodes[n][s];r[s]=t[o]}this[n]=r}else{let r=e.inputNodes[n];this[n]=t[r]}}}toJSON(e){let{uuid:t,type:n}=this,r=e===void 0||typeof e=="string";r&&(e={textures:{},images:{},nodes:{}});let s=e.nodes[t];s===void 0&&(s={uuid:t,type:n,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},r!==!0&&(e.nodes[s.uuid]=s),this.serialize(s),delete s.meta);function o(a){let l=[];for(let c in a){let u=a[c];delete u.metadata,l.push(u)}return l}if(r){let a=o(e.textures),l=o(e.images),c=o(e.nodes);a.length>0&&(s.textures=a),l.length>0&&(s.images=l),c.length>0&&(s.nodes=c)}return s}};Kt.captureStackTrace=!1;var Jd=class extends Kt{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}generateNodeType(e){return this.node.getElementType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){let t=this.indexNode.getNodeType(e),n=this.node.build(e),r=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint");return`${n}[ ${r} ]`}},o4=class extends Kt{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}generateNodeType(e){let t=this.node.getNodeType(e),n=null;for(let r of this.convertTo.split("|"))(n===null||e.getTypeLength(t)===e.getTypeLength(r))&&(n=r);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){let n=this.node,r=this.getNodeType(e),s=n.build(e,r);return e.format(s,r,t)}},Ir=class extends Kt{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){let r=e.getVectorType(this.getNodeType(e,t)),s=e.getDataFromNode(this);if(s.propertyName!==void 0)return e.format(s.propertyName,r,t);if(r!=="void"&&t!=="void"&&this.hasDependencies(e)){let o=super.build(e,r),a=e.getVarFromNode(this,null,r),l=e.getPropertyName(a);return e.addLineFlowCode(`${l} = ${o}`,this),s.snippet=o,s.propertyName=l,e.format(s.propertyName,r,t)}}return super.build(e,t)}},yU=class extends Ir{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}generateNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0))}generate(e,t){let n=this.getNodeType(e),r=e.getTypeLength(n),s=this.nodes,o=e.getComponentType(n),a=[],l=0;for(let u of s){if(l>=r){ze(`TSL: Length of parameters exceeds maximum length of function '${n}()' type.`,this.stackTrace);break}let f=u.getNodeType(e),d=e.getTypeLength(f),A;if(l+d>r&&(ze(`TSL: Length of '${n}()' data exceeds maximum length of output type.`,this.stackTrace),d=r-l,f=e.getTypeFromLength(d)),l+=d,A=u.build(e,f),e.getComponentType(f)!==o){let w=e.getTypeFromLength(d,o);A=e.format(A,f,w)}a.push(A)}let c=`${e.getType(n)}( ${a.join(", ")} )`;return e.format(c,n,t)}},UTe=l1.join(""),a4=class extends Kt{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(let t of this.components)e=Math.max(l1.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}generateNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){let n=this.node,r=e.getTypeLength(n.getNodeType(e)),s=null;if(r>1){let o=null;this.getVectorLength()>=r&&(o=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));let l=n.build(e,o);this.components.length===r&&this.components===UTe.slice(0,this.components.length)?s=e.format(l,o,t):s=e.format(`${l}.${this.components}`,this.getNodeType(e),t)}else s=n.build(e,t);return s}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}},bU=class extends Ir{static get type(){return"SetNode"}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{sourceNode:t,components:n,targetNode:r}=this,s=this.getNodeType(e),o=e.getComponentType(r.getNodeType(e)),a=e.getTypeFromLength(n.length,o),l=r.build(e,a),c=t.build(e,s),u=e.getTypeLength(s),f=[];for(let d=0;d<u;d++){let A=l1[d];A===n[0]?(f.push(l),d+=n.length-1):f.push(c+"."+A)}return`${e.getType(s)}( ${f.join(", ")} )`}},wU=class extends Ir{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{components:t,sourceNode:n}=this,r=this.getNodeType(e),s=n.build(e),o=e.getVarFromNode(this),a=e.getPropertyName(o);e.addLineFlowCode(a+" = "+s,this);let l=e.getTypeLength(r),c=[],u=0;for(let f=0;f<l;f++){let d=l1[f];d===t[u]?(c.push("1.0 - "+(a+"."+d)),u++):c.push(a+"."+d)}return`${e.getType(r)}( ${c.join(", ")} )`}},pS=class extends Kt{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}generateNodeType(){return this.nodeType===null?dm(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=dm(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=DTe(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?az(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){Xe("Abstract function.")}},kee=/float|u?int/,au=class extends pS{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){let n=this.getNodeType(e);return kee.test(n)&&kee.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}},SU=class extends Kt{static get type(){return"MemberNode"}constructor(e,t){super(),this.structNode=e,this.property=t,this.isMemberNode=!0}hasMember(e){return this.structNode.isMemberNode&&this.structNode.hasMember(e)===!1?!1:this.structNode.getMemberType(e,this.property)!=="void"}generateNodeType(e){return this.hasMember(e)===!1?"float":this.structNode.getMemberType(e,this.property)}getMemberType(e,t){if(this.hasMember(e)===!1)return"float";let n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}generate(e){if(this.hasMember(e)===!1){Xe(`TSL: Member "${this.property}" does not exist in struct.`,this.stackTrace);let n=this.getNodeType(e);return e.generateConst(n)}return this.structNode.build(e)+"."+this.property}},gm=null,TU=new Map;function Ue(i,e){if(TU.has(i)){Xe(`TSL: Redefinition of method chaining '${i}'.`);return}if(typeof e!="function")throw new Error(`THREE.TSL: Node element ${i} is not a function`);TU.set(i,e),i!=="assign"&&(Kt.prototype[i]=function(...t){return this.isStackNode?this.addToStack(e(...t)):e(this,...t)},Kt.prototype[i+"Assign"]=function(...t){return this.isStackNode?this.assign(t[0],e(...t)):this.assign(e(this,...t))})}var kTe=i=>i.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),zee=i=>kTe(i).split("").sort().join("");Kt.prototype.assign=function(...i){if(this.isStackNode!==!0)return gm!==null?gm.assign(this,...i):ze("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new ts),this;{let e=TU.get("assign");return this.addToStack(e(...i))}};Kt.prototype.toVarIntent=function(){return this};Kt.prototype.get=function(i){return new SU(this,i)};var oS={};function AR(i,e,t){oS[i]=oS[e]=oS[t]={get(){this._cache=this._cache||{};let o=this._cache[i];return o===void 0&&(o=new a4(this,i),this._cache[i]=o),o},set(o){this[i].assign(Ht(o))}};let n=i.toUpperCase(),r=e.toUpperCase(),s=t.toUpperCase();Kt.prototype["set"+n]=Kt.prototype["set"+r]=Kt.prototype["set"+s]=function(o){let a=zee(i);return new bU(this,a,Ht(o))},Kt.prototype["flip"+n]=Kt.prototype["flip"+r]=Kt.prototype["flip"+s]=function(){let o=zee(i);return new wU(this,o)}}var cf=["x","y","z","w"],uf=["r","g","b","a"],hf=["s","t","p","q"];for(let i=0;i<4;i++){let e=cf[i],t=uf[i],n=hf[i];AR(e,t,n);for(let r=0;r<4;r++){e=cf[i]+cf[r],t=uf[i]+uf[r],n=hf[i]+hf[r],AR(e,t,n);for(let s=0;s<4;s++){e=cf[i]+cf[r]+cf[s],t=uf[i]+uf[r]+uf[s],n=hf[i]+hf[r]+hf[s],AR(e,t,n);for(let o=0;o<4;o++)e=cf[i]+cf[r]+cf[s]+cf[o],t=uf[i]+uf[r]+uf[s]+uf[o],n=hf[i]+hf[r]+hf[s]+hf[o],AR(e,t,n)}}}for(let i=0;i<32;i++)oS[i]={get(){this._cache=this._cache||{};let e=this._cache[i];return e===void 0&&(e=new Jd(this,new au(i,"uint")),this._cache[i]=e),e},set(e){this[i].assign(Ht(e))}};Object.defineProperties(Kt.prototype,oS);var zTe=function(i,e=null){let t=dm(i);return t==="node"?i:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?Ht(CU(i,e)):t==="shader"?i.isFn?i:me(i):i},VTe=function(i,e=null){for(let t in i)i[t]=Ht(i[t],e);return i},GTe=function(i,e=null){let t=i.length;for(let n=0;n<t;n++)i[n]=Ht(i[n],e);return i},une=function(i,e=null,t=null,n=null){function r(u){return n!==null?(u=Ht(Object.assign(u,n)),n.intent===!0&&(u=u.toVarIntent())):u=Ht(u),u}let s,o=e,a,l;function c(u){let f;return o?f=/[a-z]/i.test(o)?o+"()":o:f=i.type,a!==void 0&&u.length<a?(ze(`TSL: "${f}" parameter length is less than minimum required.`,new ts),u.concat(new Array(a-u.length).fill(0))):l!==void 0&&u.length>l?(ze(`TSL: "${f}" parameter length exceeds limit.`,new ts),u.slice(0,l)):u}return e===null?s=(...u)=>r(new i(...jg(c(u)))):t!==null?(t=Ht(t),s=(...u)=>r(new i(e,...jg(c(u)),t))):s=(...u)=>r(new i(e,...jg(c(u)))),s.setParameterLength=(...u)=>(u.length===1?a=l=u[0]:u.length===2&&([a,l]=u),s),s.setName=u=>(o=u,s),s},qTe=function(i,...e){return new i(...jg(e))},EU=class extends Kt{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}generateNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){let{shaderNode:t,rawInputs:n}=this,r=e.getNodeProperties(t),s=e.getClosestSubBuild(t.subBuilds)||"",o=s||"default";if(r[o])return r[o];let a=e.subBuildFn,l=e.fnCall;e.subBuildFn=s,e.fnCall=this;let c=null;if(t.layout){if(n){let d=t.layout.inputs;if(hne(n)){let A=n;for(let y=0;y<d.length;y++){let w=A[y];w&&w.isNode&&w.build(e)}}else{let A=n[0];for(let y of d){let w=A[y.name];w&&w.isNode&&w.build(e)}}}let u=e.buildFunctionNode(t);e.addInclude(u);let f=n?HTe(n):null;c=u.call(f)}else{let u=new Proxy(e,{get:(w,S,T)=>{let R;return Symbol.iterator===S?R=function*(){yield void 0}:R=Reflect.get(w,S,T),R}}),f=n?WTe(n):null,d=Array.isArray(n)?n.length>0:n!==null,A=t.jsFunc,y=d||A.length>1?A(f,u):A(u);c=Ht(y)}return e.subBuildFn=a,e.fnCall=l,t.once&&(r[o]=c),c}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){let t=e.getNodeProperties(this),n=e.getSubBuildOutput(this);return t[n]=t[n]||this.setupOutput(e),t[n].subBuild=e.getClosestSubBuild(this),t[n]}build(e,t=null){let n=null,r=e.getBuildStage(),s=e.getNodeProperties(this),o=e.getSubBuildOutput(this),a=this.getOutputNode(e),l=e.fnCall;if(e.fnCall=this,r==="setup"){let c=e.getSubBuildProperty("initialized",this);if(s[c]!==!0&&(s[c]=!0,s[o]=this.getOutputNode(e),s[o].build(e),this.shaderNode.subBuilds))for(let u of e.chaining){let f=e.getDataFromNode(u,"any");f.subBuilds=f.subBuilds||new Set;for(let d of this.shaderNode.subBuilds)f.subBuilds.add(d)}n=s[o]}else r==="analyze"?a.build(e,t):r==="generate"&&(n=a.build(e,t)||"");return e.fnCall=l,n}};function hne(i){return i[0]&&(i[0].isNode||Object.getPrototypeOf(i[0])!==Object.prototype)}function HTe(i){let e;return xI(i),hne(i)?e=[...i]:e=i[0],e}function WTe(i){let e=0;return xI(i),new Proxy(i,{get:(t,n,r)=>{let s;if(n==="length")return s=i.length,s;if(Symbol.iterator===n)s=function*(){for(let o of i)yield Ht(o)};else{if(i.length>0)if(Object.getPrototypeOf(i[0])===Object.prototype){let o=i[0];o[n]===void 0?s=o[e++]:s=Reflect.get(o,n,r)}else i[0]instanceof Kt&&(i[n]===void 0?s=i[e++]:s=Reflect.get(i,n,r));else s=Reflect.get(t,n,r);s=Ht(s)}return s}})}var MU=class extends Kt{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new EU(this,e)}setup(){return this.call()}},jTe=[!1,!0],XTe=[0,1,2,3],$Te=[-1,-2],fne=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],lz=new Map;for(let i of jTe)lz.set(i,new au(i));var cz=new Map;for(let i of XTe)cz.set(i,new au(i,"uint"));var uz=new Map([...cz].map(i=>new au(i.value,"int")));for(let i of $Te)uz.set(i,new au(i,"int"));var vI=new Map([...uz].map(i=>new au(i.value)));for(let i of fne)vI.set(i,new au(i));for(let i of fne)vI.set(-i,new au(-i));var _I={bool:lz,uint:cz,ints:uz,float:vI},Vee=new Map([...lz,...vI]),CU=(i,e)=>Vee.has(i)?Vee.get(i):i.isNode===!0?i:new au(i,e),Zs=function(i,e=null){return(...t)=>{for(let r of t)if(r===void 0)return ze(`TSL: Invalid parameter for the type "${i}".`,new ts),new au(0,i);if((t.length===0||!["bool","float","int","uint"].includes(i)&&t.every(r=>{let s=typeof r;return s!=="object"&&s!=="function"}))&&(t=[az(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return iS(e.get(t[0]));if(t.length===1){let r=CU(t[0],i);return r.nodeType===i?iS(r):iS(new o4(r,i))}let n=t.map(r=>CU(r));return iS(new yU(n,i))}};function dx(i){return i&&i.isNode&&i.traverse(e=>{e.isConstNode&&(i=e.value)}),!!i}var dne=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function sx(i,e){return new MU(i,e)}var Ht=(i,e=null)=>zTe(i,e),iS=(i,e=null)=>Ht(i,e).toVarIntent(),xI=(i,e=null)=>new VTe(i,e),jg=(i,e=null)=>new GTe(i,e),$n=(i,e=null,t=null,n=null)=>new une(i,e,t,n),xt=(i,...e)=>new qTe(i,...e),ct=(i,e=null,t=null,n={})=>new une(i,e,t,{...n,intent:!0}),hz=(i,e)=>new Proxy(i,{get(t,n,r){return Reflect.get(e,n,r)},set(t,n,r){return Reflect.set(e,n,r)}}),YTe=0,RU=class extends Kt{constructor(e,t=null){super();let n=null;t!==null&&(typeof t=="object"?n=t.return:(typeof t=="string"?n=t:ze("TSL: Invalid layout type.",new ts),t=null)),this.shaderNode=new sx(e,n),t!==null&&this.setLayout(t),this.isFn=!0}setLayout(e){let t=this.shaderNode.nodeType;if(typeof e.inputs!="object"){let n={name:"fn"+YTe++,type:t,inputs:[]};for(let r in e)r!=="return"&&n.inputs.push({name:r,type:e[r]});e=n}return this.shaderNode.setLayout(e),this}generateNodeType(e){return this.shaderNode.getNodeType(e)||"float"}call(...e){let t=this.shaderNode.call(e);return this.shaderNode.nodeType==="void"&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){let t=this.getNodeType(e);return ze('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".',this.stackTrace),e.generateConst(t)}};function me(i,e=null){let t=new RU(i,e);return new Proxy(()=>{},{apply(n,r,s){return t.call(...s)},get(n,r,s){return Reflect.get(t,r,s)},set(n,r,s,o){return Reflect.set(t,r,s,o)}})}var mS=i=>{gm=i},fz=()=>gm,$t=(...i)=>gm.If(...i),ZTe=(...i)=>gm.Switch(...i);function yI(i){return gm&&gm.addToStack(i),i}Ue("toStack",yI);var pne=new Zs("color"),oe=new Zs("float",_I.float),de=new Zs("int",_I.ints),rt=new Zs("uint",_I.uint),mc=new Zs("bool",_I.bool),dt=new Zs("vec2"),zr=new Zs("ivec2"),dz=new Zs("uvec2"),mne=new Zs("bvec2"),pe=new Zs("vec3"),pz=new Zs("ivec3"),c1=new Zs("uvec3"),mz=new Zs("bvec3"),Ft=new Zs("vec4"),Az=new Zs("ivec4"),gz=new Zs("uvec4"),Ane=new Zs("bvec4"),bI=new Zs("mat2"),To=new Zs("mat3"),mm=new Zs("mat4");Ue("toColor",pne);Ue("toFloat",oe);Ue("toInt",de);Ue("toUint",rt);Ue("toBool",mc);Ue("toVec2",dt);Ue("toIVec2",zr);Ue("toUVec2",dz);Ue("toBVec2",mne);Ue("toVec3",pe);Ue("toIVec3",pz);Ue("toUVec3",c1);Ue("toBVec3",mz);Ue("toVec4",Ft);Ue("toIVec4",Az);Ue("toUVec4",gz);Ue("toBVec4",Ane);Ue("toMat2",bI);Ue("toMat3",To);Ue("toMat4",mm);var gne=$n(Jd).setParameterLength(2),vne=(i,e)=>new o4(Ht(i),e),KTe=(i,e)=>new a4(Ht(i),e);Ue("element",gne);Ue("convert",vne);var QTe=i=>(Xe("TSL: append() has been renamed to Stack().",new ts),yI(i));Ue("append",i=>(Xe("TSL: .append() has been renamed to .toStack().",new ts),yI(i)));var gi=class extends Kt{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1,r=null){super(e),this.name=t,this.varying=n,this.placeholderNode=Ht(r),this.isPropertyNode=!0,this.global=!0}getNodeType(e){let t=super.getNodeType(e);return t==="output"?e.getOutputType():t}customCacheKey(){return wx(this.type+":"+(this.name||"")+":"+(this.varying?"1":"0"))}getHash(e){return this.name||super.getHash(e)}generate(e){let t;if(this.varying===!0)t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0;else if(t=e.getVarFromNode(this,this.name),this.placeholderNode!==null&&e.hasWriteUsage(this)===!1){let n=this.placeholderNode.build(e,this.getNodeType(e));e.addLineFlowCode(`${e.getPropertyName(t)} = ${n}`,this)}return e.getPropertyName(t)}},np=(i,e,t=null)=>new gi(i,e,!1,t),u1=(i,e,t=null)=>new gi(i,e,!0,t),Bi=xt(gi,"vec4","DiffuseColor"),zg=xt(gi,"vec3","DiffuseContribution"),IU=xt(gi,"vec3","EmissiveColor"),vf=xt(gi,"float","Roughness"),Qd=xt(gi,"float","Metalness"),l4=xt(gi,"float","Clearcoat"),ax=xt(gi,"float","ClearcoatRoughness"),hc=xt(gi,"vec3","Sheen"),lm=xt(gi,"float","SheenRoughness"),wI=xt(gi,"float","Iridescence"),c4=xt(gi,"float","IridescenceIOR"),u4=xt(gi,"float","IridescenceThickness"),h4=xt(gi,"float","AlphaT"),am=xt(gi,"float","Anisotropy"),aS=xt(gi,"vec3","AnisotropyT"),Xg=xt(gi,"vec3","AnisotropyB"),vm=xt(gi,"color","SpecularColor"),Gg=xt(gi,"color","SpecularColorBlended"),qg=xt(gi,"float","SpecularF90"),f4=xt(gi,"float","Shininess"),lx=xt(gi,"output","Output"),$g=xt(gi,"float","dashSize"),AS=xt(gi,"float","gapSize"),JTe=xt(gi,"float","pointWidth"),lS=xt(gi,"float","IOR"),d4=xt(gi,"float","Transmission"),vz=xt(gi,"float","Thickness"),_z=xt(gi,"float","AttenuationDistance"),xz=xt(gi,"color","AttenuationColor"),yz=xt(gi,"float","Dispersion"),PU=xt(gi,"float","AmbientOcclusion",!1,1),p4=class extends Kt{static get type(){return"UniformGroupNode"}constructor(e,t=!1,n=1,r=null){super("string"),this.name=e,this.shared=t,this.order=n,this.updateType=r,this.isUniformGroup=!0}update(){this.needsUpdate=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}},_ne=(i,e=1,t=null)=>new p4(i,!1,e,t),SI=(i,e=0,t=null)=>new p4(i,!0,e,t),eEe=SI("frame",0,yn.FRAME),Jt=SI("render",0,yn.RENDER),xne=_ne("object",1,yn.OBJECT),Jg=class extends pS{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=xne}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.',new ts),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){return e=e.bind(this),super.onUpdate(n=>{let r=e(n,this);r!==void 0&&(this.value=r)},t)}getInputType(e){let t=super.getInputType(e);return t==="bool"&&(t="uint"),t}generate(e,t){let n=this.getNodeType(e),r=this.getUniformHash(e),s=e.getNodeFromHash(r);s===void 0&&(e.setHashNode(this,r),s=this);let o=s.getInputType(e),a=e.getUniformFromNode(s,o,e.shaderStage,this.name||e.context.nodeName),l=e.getPropertyName(a);e.context.nodeName!==void 0&&delete e.context.nodeName;let c=l;if(n==="bool"){let u=e.getDataFromNode(this),f=u.propertyName;if(f===void 0){let d=e.getVarFromNode(this,null,"bool");f=e.getPropertyName(d),u.propertyName=f,c=e.format(l,o,n),e.addLineFlowCode(`${f} = ${c}`,this)}c=f}return e.format(c,n,t)}},Xt=(i,e)=>{let t=dne(e||i);if(t===i&&(i=az(t)),i&&i.isNode===!0){let n=i.value;i.traverse(r=>{r.isConstNode===!0&&(n=r.value)}),i=n}return new Jg(i,t)},m4=class extends Ir{static get type(){return"ArrayNode"}constructor(e,t,n=null){super(e),this.count=t,this.values=n,this.isArrayNode=!0}getArrayCount(){return this.count}generateNodeType(e){return this.nodeType===null?this.values[0].getNodeType(e):this.nodeType}getElementType(e){return this.getNodeType(e)}getMemberType(e,t){return this.nodeType===null?this.values[0].getMemberType(e,t):super.getMemberType(e,t)}generate(e){let t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}},yne=(...i)=>{let e;if(i.length===1){let t=i[0];e=new m4(null,t.length,t)}else{let t=i[0],n=i[1];e=new m4(t,n)}return Ht(e)};Ue("toArray",(i,e)=>yne(Array(e).fill(i)));var LU=class extends Ir{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}generateNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){let{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){let n=e.getTypeLength(t.node.getNodeType(e));return l1.join("").slice(0,n)!==t.components}return!1}setup(e){let{targetNode:t,sourceNode:n}=this,r=t.getScope(),s=e.getDataFromNode(r);s.assign=!0;let o=e.getNodeProperties(this);o.sourceNode=n,o.targetNode=t.context({assign:!0})}generate(e,t){let{targetNode:n,sourceNode:r}=e.getNodeProperties(this),s=this.needsSplitAssign(e),o=n.build(e),a=n.getNodeType(e),l=r.build(e,a),c=r.getNodeType(e),u=e.getDataFromNode(this),f;if(u.initialized===!0)t!=="void"&&(f=o);else if(s){let d=e.getVarFromNode(this,null,a),A=e.getPropertyName(d);e.addLineFlowCode(`${A} = ${l}`,this);let y=n.node,S=y.node.context({assign:!0}).build(e);for(let T=0;T<y.components.length;T++){let R=y.components[T];e.addLineFlowCode(`${S}.${R} = ${A}[ ${T} ]`,this)}t!=="void"&&(f=o)}else f=`${o} = ${l}`,(t==="void"||c==="void")&&(e.addLineFlowCode(f,this),t!=="void"&&(f=o));return u.initialized=!0,e.format(f,a,t)}},bne=$n(LU).setParameterLength(2);Ue("assign",bne);var DU=class extends Ir{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}generateNodeType(e){return this.functionNode.getNodeType(e)}getMemberType(e,t){return this.functionNode.getMemberType(e,t)}generate(e){let t=[],n=this.functionNode,r=n.getInputs(e),s=this.parameters,o=(l,c)=>{let u=c.type,f=u==="pointer",d;return f?d="&"+l.build(e):d=l.build(e,u),d};if(Array.isArray(s)){if(s.length>r.length)ze("TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),s.length=r.length;else if(s.length<r.length)for(ze("TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.");s.length<r.length;)s.push(oe(0));for(let l=0;l<s.length;l++)t.push(o(s[l],r[l]))}else for(let l of r){let c=s[l.name];c!==void 0?t.push(o(c,l)):(ze(`TSL: Input '${l.name}' not found in 'Fn()'.`),t.push(o(oe(0),l)))}return`${n.build(e,"property")}( ${t.join(", ")} )`}},wne=(i,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?jg(e):xI(e[0]),new DU(Ht(i),e));Ue("call",wne);var tEe={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"},ns=class i extends Ir{static get type(){return"OperatorNode"}constructor(e,t,n,...r){if(super(),r.length>0){let s=new i(e,t,n);for(let o=0;o<r.length-1;o++)s=new i(e,s,r[o]);t=s,n=r[r.length-1]}this.op=e,this.aNode=t,this.bNode=n,this.isOperatorNode=!0}getOperatorMethod(e,t){return e.getMethod(tEe[this.op],t)}generateNodeType(e,t=null){let n=this.op,r=this.aNode,s=this.bNode,o=r.getNodeType(e),a=s?s.getNodeType(e):null;if(o==="void"||a==="void")return t||"void";if(n==="%")return o;if(n==="~"||n==="&"||n==="|"||n==="^"||n===">>"||n==="<<")return e.getIntegerType(o);if(n==="&&"||n==="||"||n==="^^")return"bool";if(n==="!"){let l=e.getTypeLength(o);return l>1?`bvec${l}`:"bool"}else if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">="){let l=Math.max(e.getTypeLength(o),e.getTypeLength(a));return l>1?`bvec${l}`:"bool"}else{if(e.isMatrix(o)){if(a==="float")return o;if(e.isVector(a))return e.getVectorFromMatrix(o);if(e.isMatrix(a))return o}else if(e.isMatrix(a)){if(o==="float")return a;if(e.isVector(o))return e.getVectorFromMatrix(a)}return e.getTypeLength(a)>e.getTypeLength(o)?a:o}}generate(e,t){let n=this.op,{aNode:r,bNode:s}=this,o=this.getNodeType(e,t),a=null,l=null;o!=="void"?(a=r.getNodeType(e),l=s?s.getNodeType(e):null,n==="<"||n===">"||n==="<="||n===">="||n==="=="||n==="!="?e.isVector(a)?l=a:e.isVector(l)?a=l:a!==l&&(a=l="float"):n===">>"||n==="<<"?(a=o,l=e.changeComponentType(l,"uint")):n==="%"?(a=o,l=e.isInteger(a)&&e.isInteger(l)?l:a):e.isMatrix(a)?l==="float"?l="float":e.isVector(l)?l=e.getVectorFromMatrix(a):e.isMatrix(l)||(a=l=o):e.isMatrix(l)?a==="float"?a="float":e.isVector(a)?a=e.getVectorFromMatrix(l):a=l=o:a=l=o):a=l=o;let c=r.build(e,a),u=s?s.build(e,l):null,f=e.getFunctionOperator(n);if(t!=="void"){let d=e.renderer.coordinateSystem===ko;if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">=")return d?e.isVector(a)?e.format(`${this.getOperatorMethod(e,t)}( ${c}, ${u} )`,o,t):e.format(`( ${c} ${n} ${u} )`,o,t):e.format(`( ${c} ${n} ${u} )`,o,t);if(n==="%")return e.isInteger(l)?e.format(`( ${c} % ${u} )`,o,t):e.format(`${this.getOperatorMethod(e,o)}( ${c}, ${u} )`,o,t);if(n==="!")return d&&e.isVector(a)?e.format(`not( ${c} )`,t):e.format(`( ${n} ${c} )`,a,t);if(n==="~")return e.format(`( ${n} ${c} )`,a,t);if(f)return e.format(`${f}( ${c}, ${u} )`,o,t);if(e.isMatrix(a)&&l==="float")return e.format(`( ${u} ${n} ${c} )`,o,t);if(a==="float"&&e.isMatrix(l))return e.format(`${c} ${n} ${u}`,o,t);{let A=`( ${c} ${n} ${u} )`;return!d&&o==="bool"&&e.isVector(a)&&e.isVector(l)&&(A=`all${A}`),e.format(A,o,t)}}else if(a!=="void")return f?e.format(`${f}( ${c}, ${u} )`,o,t):e.isMatrix(a)&&l==="float"?e.format(`${u} ${n} ${c}`,o,t):e.format(`${c} ${n} ${u}`,o,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}},Ls=ct(ns,"+").setParameterLength(2,1/0).setName("add"),ai=ct(ns,"-").setParameterLength(2,1/0).setName("sub"),Tn=ct(ns,"*").setParameterLength(2,1/0).setName("mul"),Ac=ct(ns,"/").setParameterLength(2,1/0).setName("div"),TI=ct(ns,"%").setParameterLength(2).setName("mod"),Sne=ct(ns,"==").setParameterLength(2).setName("equal"),Tne=ct(ns,"!=").setParameterLength(2).setName("notEqual"),Ene=ct(ns,"<").setParameterLength(2).setName("lessThan"),bz=ct(ns,">").setParameterLength(2).setName("greaterThan"),Mne=ct(ns,"<=").setParameterLength(2).setName("lessThanEqual"),Cne=ct(ns,">=").setParameterLength(2).setName("greaterThanEqual"),Rne=ct(ns,"&&").setParameterLength(2,1/0).setName("and"),Ine=ct(ns,"||").setParameterLength(2,1/0).setName("or"),Pne=ct(ns,"!").setParameterLength(1).setName("not"),Lne=ct(ns,"^^").setParameterLength(2).setName("xor"),Dne=ct(ns,"&").setParameterLength(2).setName("bitAnd"),Nne=ct(ns,"~").setParameterLength(1).setName("bitNot"),Fne=ct(ns,"|").setParameterLength(2).setName("bitOr"),Bne=ct(ns,"^").setParameterLength(2).setName("bitXor"),One=ct(ns,"<<").setParameterLength(2).setName("shiftLeft"),Une=ct(ns,">>").setParameterLength(2).setName("shiftRight"),kne=me(([i])=>(i.addAssign(1),i)),zne=me(([i])=>(i.subAssign(1),i)),Vne=me(([i])=>{let e=de(i).toConst();return i.addAssign(1),e}),Gne=me(([i])=>{let e=de(i).toConst();return i.subAssign(1),e});Ue("add",Ls);Ue("sub",ai);Ue("mul",Tn);Ue("div",Ac);Ue("mod",TI);Ue("equal",Sne);Ue("notEqual",Tne);Ue("lessThan",Ene);Ue("greaterThan",bz);Ue("lessThanEqual",Mne);Ue("greaterThanEqual",Cne);Ue("and",Rne);Ue("or",Ine);Ue("not",Pne);Ue("xor",Lne);Ue("bitAnd",Dne);Ue("bitNot",Nne);Ue("bitOr",Fne);Ue("bitXor",Bne);Ue("shiftLeft",One);Ue("shiftRight",Une);Ue("incrementBefore",kne);Ue("decrementBefore",zne);Ue("increment",Vne);Ue("decrement",Gne);var Ie=class i extends Ir{static get type(){return"MathNode"}constructor(e,t,n=null,r=null){if(super(),(e===i.MAX||e===i.MIN)&&arguments.length>3){let s=new i(e,t,n);for(let o=3;o<arguments.length-1;o++)s=new i(e,s,arguments[o]);t=s,n=arguments[arguments.length-1],r=null}this.method=e,this.aNode=t,this.bNode=n,this.cNode=r,this.isMathNode=!0}getInputType(e){let t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,r=this.cNode?this.cNode.getNodeType(e):null,s=e.isMatrix(t)?0:e.getTypeLength(t),o=e.isMatrix(n)?0:e.getTypeLength(n),a=e.isMatrix(r)?0:e.getTypeLength(r);return s>o&&s>a?t:o>a?n:a>s?r:t}generateNodeType(e){let t=this.method;return t===i.LENGTH||t===i.DISTANCE||t===i.DOT?"float":t===i.CROSS?"vec3":t===i.ALL||t===i.ANY?"bool":t===i.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):this.getInputType(e)}setup(e){let{aNode:t,bNode:n,method:r}=this,s=null;if(r===i.ONE_MINUS)s=ai(1,t);else if(r===i.RECIPROCAL)s=Ac(1,t);else if(r===i.DIFFERENCE)s=fr(ai(t,n));else if(r===i.TRANSFORM_DIRECTION){let o,a;e.isMatrix(t.getNodeType(e))?(o=t,a=n):(o=n,a=t),s=ya(Tn(o,Ft(pe(a),0)).xyz)}return s!==null?s:super.setup(e)}generate(e,t){if(e.getNodeProperties(this).outputNode)return super.generate(e,t);let r=this.method,s=this.getNodeType(e),o=this.getInputType(e),a=this.aNode,l=this.bNode,c=this.cNode,u=e.renderer.coordinateSystem;if(r===i.NEGATE)return e.format("( - "+a.build(e,o)+" )",s,t);{let f=[];return r===i.CROSS?f.push(a.build(e,s),l.build(e,s)):u===ko&&r===i.STEP?f.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":o),l.build(e,o)):u===ko&&(r===i.MIN||r===i.MAX)?f.push(a.build(e,o),l.build(e,e.getTypeLength(l.getNodeType(e))===1?"float":o)):r===i.REFRACT?f.push(a.build(e,o),l.build(e,o),c.build(e,"float")):r===i.MIX?f.push(a.build(e,o),l.build(e,o),c.build(e,e.getTypeLength(c.getNodeType(e))===1?"float":o)):(u===yl&&r===i.ATAN&&l!==null&&(r="atan2"),e.shaderStage!=="fragment"&&(r===i.DFDX||r===i.DFDY)&&(Xe(`TSL: '${r}' is not supported in the ${e.shaderStage} stage.`,this.stackTrace),r="/*"+r+"*/"),f.push(a.build(e,o)),l!==null&&f.push(l.build(e,o)),c!==null&&f.push(c.build(e,o))),e.format(`${e.getMethod(r,s)}( ${f.join(", ")} )`,s,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};Ie.ALL="all";Ie.ANY="any";Ie.RADIANS="radians";Ie.DEGREES="degrees";Ie.EXP="exp";Ie.EXP2="exp2";Ie.LOG="log";Ie.LOG2="log2";Ie.SQRT="sqrt";Ie.INVERSE_SQRT="inversesqrt";Ie.FLOOR="floor";Ie.CEIL="ceil";Ie.NORMALIZE="normalize";Ie.FRACT="fract";Ie.SIN="sin";Ie.SINH="sinh";Ie.COS="cos";Ie.COSH="cosh";Ie.TAN="tan";Ie.TANH="tanh";Ie.ASIN="asin";Ie.ASINH="asinh";Ie.ACOS="acos";Ie.ACOSH="acosh";Ie.ATAN="atan";Ie.ATANH="atanh";Ie.ABS="abs";Ie.SIGN="sign";Ie.LENGTH="length";Ie.NEGATE="negate";Ie.ONE_MINUS="oneMinus";Ie.DFDX="dFdx";Ie.DFDY="dFdy";Ie.ROUND="round";Ie.RECIPROCAL="reciprocal";Ie.TRUNC="trunc";Ie.FWIDTH="fwidth";Ie.TRANSPOSE="transpose";Ie.DETERMINANT="determinant";Ie.INVERSE="inverse";Ie.EQUALS="equals";Ie.MIN="min";Ie.MAX="max";Ie.STEP="step";Ie.REFLECT="reflect";Ie.DISTANCE="distance";Ie.DIFFERENCE="difference";Ie.DOT="dot";Ie.CROSS="cross";Ie.POW="pow";Ie.TRANSFORM_DIRECTION="transformDirection";Ie.MIX="mix";Ie.CLAMP="clamp";Ie.REFRACT="refract";Ie.SMOOTHSTEP="smoothstep";Ie.FACEFORWARD="faceforward";var EI=oe(1e-6),nEe=oe(1e6),A4=oe(Math.PI),iEe=oe(Math.PI*2),rEe=oe(Math.PI*2),sEe=oe(Math.PI*.5),qne=ct(Ie,Ie.ALL).setParameterLength(1),Hne=ct(Ie,Ie.ANY).setParameterLength(1),Wne=ct(Ie,Ie.RADIANS).setParameterLength(1),jne=ct(Ie,Ie.DEGREES).setParameterLength(1),wz=ct(Ie,Ie.EXP).setParameterLength(1),px=ct(Ie,Ie.EXP2).setParameterLength(1),MI=ct(Ie,Ie.LOG).setParameterLength(1),xf=ct(Ie,Ie.LOG2).setParameterLength(1),el=ct(Ie,Ie.SQRT).setParameterLength(1),Sz=ct(Ie,Ie.INVERSE_SQRT).setParameterLength(1),yf=ct(Ie,Ie.FLOOR).setParameterLength(1),CI=ct(Ie,Ie.CEIL).setParameterLength(1),ya=ct(Ie,Ie.NORMALIZE).setParameterLength(1),Qu=ct(Ie,Ie.FRACT).setParameterLength(1),Ka=ct(Ie,Ie.SIN).setParameterLength(1),Xne=ct(Ie,Ie.SINH).setParameterLength(1),$u=ct(Ie,Ie.COS).setParameterLength(1),$ne=ct(Ie,Ie.COSH).setParameterLength(1),Yne=ct(Ie,Ie.TAN).setParameterLength(1),Zne=ct(Ie,Ie.TANH).setParameterLength(1),Kne=ct(Ie,Ie.ASIN).setParameterLength(1),Qne=ct(Ie,Ie.ASINH).setParameterLength(1),Tz=ct(Ie,Ie.ACOS).setParameterLength(1),Jne=ct(Ie,Ie.ACOSH).setParameterLength(1),Ez=ct(Ie,Ie.ATAN).setParameterLength(1,2),eie=ct(Ie,Ie.ATANH).setParameterLength(1),fr=ct(Ie,Ie.ABS).setParameterLength(1),Mz=ct(Ie,Ie.SIGN).setParameterLength(1),bf=ct(Ie,Ie.LENGTH).setParameterLength(1),Cz=ct(Ie,Ie.NEGATE).setParameterLength(1),tie=ct(Ie,Ie.ONE_MINUS).setParameterLength(1),Rz=ct(Ie,Ie.DFDX).setParameterLength(1),Iz=ct(Ie,Ie.DFDY).setParameterLength(1),nie=ct(Ie,Ie.ROUND).setParameterLength(1),iie=ct(Ie,Ie.RECIPROCAL).setParameterLength(1),Pz=ct(Ie,Ie.TRUNC).setParameterLength(1),Lz=ct(Ie,Ie.FWIDTH).setParameterLength(1),rie=ct(Ie,Ie.TRANSPOSE).setParameterLength(1),sie=ct(Ie,Ie.DETERMINANT).setParameterLength(1),oie=ct(Ie,Ie.INVERSE).setParameterLength(1),Pl=ct(Ie,Ie.MIN).setParameterLength(2,1/0),Vr=ct(Ie,Ie.MAX).setParameterLength(2,1/0),e1=ct(Ie,Ie.STEP).setParameterLength(2),aie=ct(Ie,Ie.REFLECT).setParameterLength(2),lie=ct(Ie,Ie.DISTANCE).setParameterLength(2),cie=ct(Ie,Ie.DIFFERENCE).setParameterLength(2),lu=ct(Ie,Ie.DOT).setParameterLength(2),ep=ct(Ie,Ie.CROSS).setParameterLength(2),ru=ct(Ie,Ie.POW).setParameterLength(2),Dz=i=>Tn(i,i),uie=i=>Tn(i,i,i),Nz=i=>Tn(i,i,i,i),hie=ct(Ie,Ie.TRANSFORM_DIRECTION).setParameterLength(2),fie=(i,e)=>ya(Tn(e,Ft(pe(i),0)).xyz),die=(i,e)=>ya(Ft(pe(i),0).mul(e).xyz),pie=i=>Tn(Mz(i),ru(fr(i),1/3)),Fz=i=>lu(i,i),Qn=ct(Ie,Ie.MIX).setParameterLength(3),Ju=(i,e=0,t=1)=>new Ie(Ie.CLAMP,Ht(i),Ht(e),Ht(t)),RI=i=>Ju(i),Bz=ct(Ie,Ie.REFRACT).setParameterLength(3),gc=ct(Ie,Ie.SMOOTHSTEP).setParameterLength(3),Oz=ct(Ie,Ie.FACEFORWARD).setParameterLength(3),mie=me(([i])=>{let n=43758.5453,r=lu(i.xy,dt(12.9898,78.233)),s=TI(r,A4);return Qu(Ka(s).mul(n))}),Aie=(i,e,t)=>Qn(e,t,i),gie=(i,e,t)=>gc(e,t,i),vie=(i,e)=>e1(e,i),oEe=Oz,aEe=Sz;Ue("all",qne);Ue("any",Hne);Ue("radians",Wne);Ue("degrees",jne);Ue("exp",wz);Ue("exp2",px);Ue("log",MI);Ue("log2",xf);Ue("sqrt",el);Ue("inverseSqrt",Sz);Ue("floor",yf);Ue("ceil",CI);Ue("normalize",ya);Ue("fract",Qu);Ue("sin",Ka);Ue("sinh",Xne);Ue("cos",$u);Ue("cosh",$ne);Ue("tan",Yne);Ue("tanh",Zne);Ue("asin",Kne);Ue("asinh",Qne);Ue("acos",Tz);Ue("acosh",Jne);Ue("atan",Ez);Ue("atanh",eie);Ue("abs",fr);Ue("sign",Mz);Ue("length",bf);Ue("lengthSq",Fz);Ue("negate",Cz);Ue("oneMinus",tie);Ue("dFdx",Rz);Ue("dFdy",Iz);Ue("round",nie);Ue("reciprocal",iie);Ue("trunc",Pz);Ue("fwidth",Lz);Ue("min",Pl);Ue("max",Vr);Ue("step",vie);Ue("reflect",aie);Ue("distance",lie);Ue("dot",lu);Ue("cross",ep);Ue("pow",ru);Ue("pow2",Dz);Ue("pow3",uie);Ue("pow4",Nz);Ue("transformDirection",hie);Ue("transformNormalByViewMatrix",fie);Ue("transformNormalByInverseViewMatrix",die);Ue("mix",Aie);Ue("clamp",Ju);Ue("refract",Bz);Ue("smoothstep",gie);Ue("faceForward",Oz);Ue("difference",cie);Ue("saturate",RI);Ue("cbrt",pie);Ue("transpose",rie);Ue("determinant",sie);Ue("inverse",oie);Ue("rand",mie);var NU=class extends Kt{static get type(){return"ConditionalNode"}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}generateNodeType(e){let{ifNode:t,elseNode:n}=e.getNodeProperties(this);if(t===void 0)return e.flowBuildStage(this,"setup"),this.getNodeType(e);let r=t.getNodeType(e);if(n!==null){let s=n.getNodeType(e);if(e.getTypeLength(s)>e.getTypeLength(r))return s}return r}setup(e){let t=this.condNode,n=this.ifNode.isolate(),r=this.elseNode?this.elseNode.isolate():null,s=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=s,r!==null&&(e.getDataFromNode(r).parentNodeBlock=s);let o=e.context.uniformFlow,a=e.getNodeProperties(this);a.condNode=t,a.ifNode=o?n:n.context({nodeBlock:n}),a.elseNode=r?o?r:r.context({nodeBlock:r}):null}generate(e,t){let n=this.getNodeType(e),r=e.getDataFromNode(this);if(r.nodeProperty!==void 0)return r.nodeProperty;let{condNode:s,ifNode:o,elseNode:a}=e.getNodeProperties(this),l=e.currentFunctionNode,c=t!=="void",u=c?np(n).build(e):"";r.nodeProperty=u;let f=s.build(e,"bool");if(e.context.uniformFlow&&a!==null){let y=o.build(e,n),w=a.build(e,n),S=e.getTernary(f,y,w);return e.format(S,n,t)}e.addFlowCode(`4133+${t}`}};function oz(i,e=0){let t=3735928559^e,n=1103547991^e;if(Array.isArray(i))for(let r=0,s;r<i.length;r++)s=i[r],t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677);else for(let r=0,s;r<i.length;r++)s=i.charCodeAt(r),t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&n)+(t>>>0)}var yx=i=>oz(i),LS=i=>oz(i),nS=(...i)=>oz(i),MTe=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),Nee=new WeakMap;function nne(i){return MTe.get(i)}function e4(i){if(/[iu]?vec\d/.test(i))return i.startsWith("ivec")?Int32Array:i.startsWith("uvec")?Uint32Array:Float32Array;if(/mat\d/.test(i)||/float/.test(i))return Float32Array;if(/uint/.test(i))return Uint32Array;if(/int/.test(i))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${i}`)}function ine(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i)||/mat2/.test(i))return 4;if(/mat3/.test(i))return 9;if(/mat4/.test(i))return 16;ze(`TSL: Unsupported type: ${i}`,new ts)}function CTe(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i)||/mat2/.test(i))return 4;if(/mat3/.test(i))return 12;if(/mat4/.test(i))return 16;ze(`TSL: Unsupported type: ${i}`,new ts)}function RTe(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i)||/vec4/.test(i))return 4;if(/mat2/.test(i))return 2;if(/mat3/.test(i)||/mat4/.test(i))return 4;ze(`TSL: Unsupported type: ${i}`,new ts)}function fm(i){if(i==null)return null;let e=typeof i;return i.isNode===!0?"node":e==="number"?"float":e==="boolean"?"bool":e==="string"?"string":e==="function"?"shader":i.isVector2===!0?"vec2":i.isVector3===!0?"vec3":i.isVector4===!0?"vec4":i.isMatrix2===!0?"mat2":i.isMatrix3===!0?"mat3":i.isMatrix4===!0?"mat4":i.isColor===!0?"color":i instanceof ArrayBuffer?"ArrayBuffer":null}function az(i,...e){let t=i?i.slice(-4):void 0;return e.length===1&&(t==="vec2"?e=[e[0],e[0]]:t==="vec3"?e=[e[0],e[0],e[0]]:t==="vec4"&&(e=[e[0],e[0],e[0],e[0]])),i==="color"?new zt(...e):t==="vec2"?new Oe(...e):t==="vec3"?new re(...e):t==="vec4"?new xn(...e):t==="mat2"?new c_(...e):t==="mat3"?new Mn(...e):t==="mat4"?new cn(...e):i==="bool"?e[0]||!1:i==="float"||i==="int"||i==="uint"?e[0]||0:i==="string"?e[0]||"":i==="ArrayBuffer"?ITe(e[0]):null}function rne(i){let e=Nee.get(i);return e===void 0&&(e={},Nee.set(i,e)),e}function PTe(i){let e="",t=new Uint8Array(i);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function ITe(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0)).buffer}var ex={VERTEX:"vertex",FRAGMENT:"fragment"},yn={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},LTe={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},Yo={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},sne=["fragment","vertex"],$R=["setup","analyze","generate"],YR=[...sne,"compute"],a1=["x","y","z","w"],DTe={analyze:"setup",generate:"analyze"},NTe=0,Kt=class i extends ca{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=yn.NONE,this.updateBeforeType=yn.NONE,this.updateAfterType=yn.NONE,this.version=0,this.name="",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._uuid=null,this._cacheKeyVersion=0,this.id=NTe++,this.stackTrace=null,i.captureStackTrace===!0&&(this.stackTrace=new ts)}set needsUpdate(e){e===!0&&this.version++}get uuid(){return this._uuid===null&&(this._uuid=Bu.generateUUID()),this._uuid}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this),this}onFrameUpdate(e){return this.onUpdate(e,yn.FRAME)}onRenderUpdate(e){return this.onUpdate(e,yn.RENDER)}onObjectUpdate(e){return this.onUpdate(e,yn.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(let{childNode:e}of this._getChildren())yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(let t of this.getChildren())t.traverse(e)}_getChildren(e=new Set){let t=[];e.add(this);for(let n of Object.getOwnPropertyNames(this)){let r=this[n];if(!(n.startsWith("_")===!0||e.has(r))){if(Array.isArray(r)===!0)for(let s=0;s<r.length;s++){let o=r[s];o&&o.isNode===!0&&t.push({property:n,index:s,childNode:o})}else if(r&&r.isNode===!0)t.push({property:n,childNode:r});else if(r&&Object.getPrototypeOf(r)===Object.prototype)for(let s in r){if(s.startsWith("_")===!0)continue;let o=r[s];o&&o.isNode===!0&&t.push({property:n,index:s,childNode:o})}}}return t}getCacheKey(e=!1,t=null){if(e=e||this.version!==this._cacheKeyVersion,e===!0||this._cacheKey===null){t===null&&(t=new Set);let n=[];for(let{property:r,childNode:s}of this._getChildren(t))n.push(yx(r.slice(0,-4)),s.getCacheKey(e,t));this._cacheKey=nS(LS(n),this.customCacheKey()),this._cacheKeyVersion=this.version}return this._cacheKey}customCacheKey(){return this.id}getScope(){return this}getHash(){return String(this.id)}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){let t=this.getNodeType(e);return e.getElementType(t)}getMemberType(){return"void"}getNodeType(e,t=null){let n=e.getDataFromNode(this),r;return t!==null?(n.typeFromOutput=n.typeFromOutput||{},r=n.typeFromOutput[t],r===void 0&&(r=this.generateNodeType(e,t),n.typeFromOutput[t]=r)):(r=n.type,r===void 0&&(r=this.generateNodeType(e),n.type=r)),r}generateNodeType(e,t=null){let n=e.getNodeProperties(this);return n.outputNode?n.outputNode.getNodeType(e,t):this.nodeType}getShared(e){let t=this.getHash(e),n=e.getNodeFromHash(t),r=null;if(n&&n!==this)r=n;else if(e.context.overrideNodes){let s=e.context.overrideNodes.get(this);if(s){let o=e.getDataFromNode(this);o.isOverwritten!==!0?(o.isOverwritten=!0,r=s(e).overrideNode(this,null),o.sharedNode=r):r=o.sharedNode}}return r||this}getArrayCount(){return null}setup(e){let t=e.getNodeProperties(this),n=0;for(let r of this.getChildren())t["node"+n++]=r;return t.outputNode||null}analyze(e,t=null){let n=e.increaseUsage(this);if(this.parents===!0){let r=e.getDataFromNode(this,"any");r.stages=r.stages||{},r.stages[e.shaderStage]=r.stages[e.shaderStage]||[],r.stages[e.shaderStage].push(t)}if(n===1){let r=e.getNodeProperties(this);for(let s of Object.values(r))s&&s.isNode===!0&&s.build(e,this)}}generate(e,t){let{outputNode:n}=e.getNodeProperties(this);if(n&&n.isNode===!0)return n.build(e,t)}updateBefore(){Xe("Abstract function.")}updateAfter(){Xe("Abstract function.")}update(){Xe("Abstract function.")}before(e){return this._beforeNodes===null&&(this._beforeNodes=[]),this._beforeNodes.push(e),this}build(e,t=null){let n=this.getShared(e);if(this!==n)return n.build(e,t);if(this._beforeNodes!==null){let l=this._beforeNodes;this._beforeNodes=null;for(let c of l)c.build(e,t);this._beforeNodes=l}let r=e.getDataFromNode(this);r.buildStages=r.buildStages||{},r.buildStages[e.buildStage]=!0;let s=DTe[e.buildStage];if(s&&r.buildStages[s]!==!0){let l=e.getBuildStage();e.setBuildStage(s),this.build(e),e.setBuildStage(l)}e.addChain(this);let o=null,a=e.getBuildStage();if(a==="setup"){e.addNode(this),this.updateReference(e);let l=e.getNodeProperties(this);if(l.initialized!==!0){l.initialized=!0,l.outputNode=this.setup(e)||l.outputNode||null;for(let c of Object.values(l))if(c&&c.isNode===!0){if(c.parents===!0){let u=e.getNodeProperties(c);u.parents=u.parents||[],u.parents.push(this)}c.build(e)}e.addSequentialNode(this)}o=l.outputNode}else if(a==="analyze")this.analyze(e,t);else if(a==="generate"){if(this.generate.length<2){let c=this.getNodeType(e),u=e.getDataFromNode(this);o=u.snippet,o===void 0?u.generated===void 0?(u.generated=!0,o=this.generate(e)||"",u.snippet=o):(Xe("Node: Recursion detected.",this),o="/* Recursion detected. */"):u.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),o=e.format(o,c,t)}else o=this.generate(e,t)||"";o===""&&t!==null&&t!=="void"&&t!=="OutputType"&&(ze(`TSL: Invalid generated code, expected a "${t}".`),o=e.generateConst(t))}return e.removeChain(this),o}getSerializeChildren(){return this._getChildren()}serialize(e){let t=this.getSerializeChildren(),n={};for(let{property:r,index:s,childNode:o}of t)s!==void 0?(n[r]===void 0&&(n[r]=Number.isInteger(s)?[]:{}),n[r][s]=o.toJSON(e.meta).uuid):n[r]=o.toJSON(e.meta).uuid;Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(e.inputNodes!==void 0){let t=e.meta.nodes;for(let n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){let r=[];for(let s of e.inputNodes[n])r.push(t[s]);this[n]=r}else if(typeof e.inputNodes[n]=="object"){let r={};for(let s in e.inputNodes[n]){let o=e.inputNodes[n][s];r[s]=t[o]}this[n]=r}else{let r=e.inputNodes[n];this[n]=t[r]}}}toJSON(e){let{uuid:t,type:n}=this,r=e===void 0||typeof e=="string";r&&(e={textures:{},images:{},nodes:{}});let s=e.nodes[t];s===void 0&&(s={uuid:t,type:n,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},r!==!0&&(e.nodes[s.uuid]=s),this.serialize(s),delete s.meta);function o(a){let l=[];for(let c in a){let u=a[c];delete u.metadata,l.push(u)}return l}if(r){let a=o(e.textures),l=o(e.images),c=o(e.nodes);a.length>0&&(s.textures=a),l.length>0&&(s.images=l),c.length>0&&(s.nodes=c)}return s}};Kt.captureStackTrace=!1;var Zd=class extends Kt{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}generateNodeType(e){return this.node.getElementType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){let t=this.indexNode.getNodeType(e),n=this.node.build(e),r=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint");return`${n}[ ${r} ]`}},t4=class extends Kt{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}generateNodeType(e){let t=this.node.getNodeType(e),n=null;for(let r of this.convertTo.split("|"))(n===null||e.getTypeLength(t)===e.getTypeLength(r))&&(n=r);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){let n=this.node,r=this.getNodeType(e),s=n.build(e,r);return e.format(s,r,t)}},Rr=class extends Kt{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){let r=e.getVectorType(this.getNodeType(e,t)),s=e.getDataFromNode(this);if(s.propertyName!==void 0)return e.format(s.propertyName,r,t);if(r!=="void"&&t!=="void"&&this.hasDependencies(e)){let o=super.build(e,r),a=e.getVarFromNode(this,null,r),l=e.getPropertyName(a);return e.addLineFlowCode(`${l} = ${o}`,this),s.snippet=o,s.propertyName=l,e.format(s.propertyName,r,t)}}return super.build(e,t)}},yU=class extends Rr{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}generateNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0))}generate(e,t){let n=this.getNodeType(e),r=e.getTypeLength(n),s=this.nodes,o=e.getComponentType(n),a=[],l=0;for(let u of s){if(l>=r){ze(`TSL: Length of parameters exceeds maximum length of function '${n}()' type.`,this.stackTrace);break}let f=u.getNodeType(e),d=e.getTypeLength(f),A;if(l+d>r&&(ze(`TSL: Length of '${n}()' data exceeds maximum length of output type.`,this.stackTrace),d=r-l,f=e.getTypeFromLength(d)),l+=d,A=u.build(e,f),e.getComponentType(f)!==o){let w=e.getTypeFromLength(d,o);A=e.format(A,f,w)}a.push(A)}let c=`${e.getType(n)}( ${a.join(", ")} )`;return e.format(c,n,t)}},FTe=a1.join(""),n4=class extends Kt{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(let t of this.components)e=Math.max(a1.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}generateNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){let n=this.node,r=e.getTypeLength(n.getNodeType(e)),s=null;if(r>1){let o=null;this.getVectorLength()>=r&&(o=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));let l=n.build(e,o);this.components.length===r&&this.components===FTe.slice(0,this.components.length)?s=e.format(l,o,t):s=e.format(`${l}.${this.components}`,this.getNodeType(e),t)}else s=n.build(e,t);return s}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}},bU=class extends Rr{static get type(){return"SetNode"}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{sourceNode:t,components:n,targetNode:r}=this,s=this.getNodeType(e),o=e.getComponentType(r.getNodeType(e)),a=e.getTypeFromLength(n.length,o),l=r.build(e,a),c=t.build(e,s),u=e.getTypeLength(s),f=[];for(let d=0;d<u;d++){let A=a1[d];A===n[0]?(f.push(l),d+=n.length-1):f.push(c+"."+A)}return`${e.getType(s)}( ${f.join(", ")} )`}},wU=class extends Rr{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{components:t,sourceNode:n}=this,r=this.getNodeType(e),s=n.build(e),o=e.getVarFromNode(this),a=e.getPropertyName(o);e.addLineFlowCode(a+" = "+s,this);let l=e.getTypeLength(r),c=[],u=0;for(let f=0;f<l;f++){let d=a1[f];d===t[u]?(c.push("1.0 - "+(a+"."+d)),u++):c.push(a+"."+d)}return`${e.getType(r)}( ${c.join(", ")} )`}},hS=class extends Kt{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}generateNodeType(){return this.nodeType===null?fm(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=fm(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=PTe(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?az(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){Xe("Abstract function.")}},Fee=/float|u?int/,iu=class extends hS{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){let n=this.getNodeType(e);return Fee.test(n)&&Fee.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}},SU=class extends Kt{static get type(){return"MemberNode"}constructor(e,t){super(),this.structNode=e,this.property=t,this.isMemberNode=!0}hasMember(e){return this.structNode.isMemberNode&&this.structNode.hasMember(e)===!1?!1:this.structNode.getMemberType(e,this.property)!=="void"}generateNodeType(e){return this.hasMember(e)===!1?"float":this.structNode.getMemberType(e,this.property)}getMemberType(e,t){if(this.hasMember(e)===!1)return"float";let n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}generate(e){if(this.hasMember(e)===!1){Xe(`TSL: Member "${this.property}" does not exist in struct.`,this.stackTrace);let n=this.getNodeType(e);return e.generateConst(n)}return this.structNode.build(e)+"."+this.property}},Am=null,TU=new Map;function Ue(i,e){if(TU.has(i)){Xe(`TSL: Redefinition of method chaining '${i}'.`);return}if(typeof e!="function")throw new Error(`THREE.TSL: Node element ${i} is not a function`);TU.set(i,e),i!=="assign"&&(Kt.prototype[i]=function(...t){return this.isStackNode?this.addToStack(e(...t)):e(this,...t)},Kt.prototype[i+"Assign"]=function(...t){return this.isStackNode?this.assign(t[0],e(...t)):this.assign(e(this,...t))})}var BTe=i=>i.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),Bee=i=>BTe(i).split("").sort().join("");Kt.prototype.assign=function(...i){if(this.isStackNode!==!0)return Am!==null?Am.assign(this,...i):ze("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new ts),this;{let e=TU.get("assign");return this.addToStack(e(...i))}};Kt.prototype.toVarIntent=function(){return this};Kt.prototype.get=function(i){return new SU(this,i)};var iS={};function hR(i,e,t){iS[i]=iS[e]=iS[t]={get(){this._cache=this._cache||{};let o=this._cache[i];return o===void 0&&(o=new n4(this,i),this._cache[i]=o),o},set(o){this[i].assign(Ht(o))}};let n=i.toUpperCase(),r=e.toUpperCase(),s=t.toUpperCase();Kt.prototype["set"+n]=Kt.prototype["set"+r]=Kt.prototype["set"+s]=function(o){let a=Bee(i);return new bU(this,a,Ht(o))},Kt.prototype["flip"+n]=Kt.prototype["flip"+r]=Kt.prototype["flip"+s]=function(){let o=Bee(i);return new wU(this,o)}}var sf=["x","y","z","w"],of=["r","g","b","a"],af=["s","t","p","q"];for(let i=0;i<4;i++){let e=sf[i],t=of[i],n=af[i];hR(e,t,n);for(let r=0;r<4;r++){e=sf[i]+sf[r],t=of[i]+of[r],n=af[i]+af[r],hR(e,t,n);for(let s=0;s<4;s++){e=sf[i]+sf[r]+sf[s],t=of[i]+of[r]+of[s],n=af[i]+af[r]+af[s],hR(e,t,n);for(let o=0;o<4;o++)e=sf[i]+sf[r]+sf[s]+sf[o],t=of[i]+of[r]+of[s]+of[o],n=af[i]+af[r]+af[s]+af[o],hR(e,t,n)}}}for(let i=0;i<32;i++)iS[i]={get(){this._cache=this._cache||{};let e=this._cache[i];return e===void 0&&(e=new Zd(this,new iu(i,"uint")),this._cache[i]=e),e},set(e){this[i].assign(Ht(e))}};Object.defineProperties(Kt.prototype,iS);var OTe=function(i,e=null){let t=fm(i);return t==="node"?i:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?Ht(CU(i,e)):t==="shader"?i.isFn?i:me(i):i},UTe=function(i,e=null){for(let t in i)i[t]=Ht(i[t],e);return i},kTe=function(i,e=null){let t=i.length;for(let n=0;n<t;n++)i[n]=Ht(i[n],e);return i},one=function(i,e=null,t=null,n=null){function r(u){return n!==null?(u=Ht(Object.assign(u,n)),n.intent===!0&&(u=u.toVarIntent())):u=Ht(u),u}let s,o=e,a,l;function c(u){let f;return o?f=/[a-z]/i.test(o)?o+"()":o:f=i.type,a!==void 0&&u.length<a?(ze(`TSL: "${f}" parameter length is less than minimum required.`,new ts),u.concat(new Array(a-u.length).fill(0))):l!==void 0&&u.length>l?(ze(`TSL: "${f}" parameter length exceeds limit.`,new ts),u.slice(0,l)):u}return e===null?s=(...u)=>r(new i(...Wg(c(u)))):t!==null?(t=Ht(t),s=(...u)=>r(new i(e,...Wg(c(u)),t))):s=(...u)=>r(new i(e,...Wg(c(u)))),s.setParameterLength=(...u)=>(u.length===1?a=l=u[0]:u.length===2&&([a,l]=u),s),s.setName=u=>(o=u,s),s},zTe=function(i,...e){return new i(...Wg(e))},EU=class extends Kt{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}generateNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){let{shaderNode:t,rawInputs:n}=this,r=e.getNodeProperties(t),s=e.getClosestSubBuild(t.subBuilds)||"",o=s||"default";if(r[o])return r[o];let a=e.subBuildFn,l=e.fnCall;e.subBuildFn=s,e.fnCall=this;let c=null;if(t.layout){if(n){let d=t.layout.inputs;if(ane(n)){let A=n;for(let y=0;y<d.length;y++){let w=A[y];w&&w.isNode&&w.build(e)}}else{let A=n[0];for(let y of d){let w=A[y.name];w&&w.isNode&&w.build(e)}}}let u=e.buildFunctionNode(t);e.addInclude(u);let f=n?VTe(n):null;c=u.call(f)}else{let u=new Proxy(e,{get:(w,S,T)=>{let R;return Symbol.iterator===S?R=function*(){yield void 0}:R=Reflect.get(w,S,T),R}}),f=n?GTe(n):null,d=Array.isArray(n)?n.length>0:n!==null,A=t.jsFunc,y=d||A.length>1?A(f,u):A(u);c=Ht(y)}return e.subBuildFn=a,e.fnCall=l,t.once&&(r[o]=c),c}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){let t=e.getNodeProperties(this),n=e.getSubBuildOutput(this);return t[n]=t[n]||this.setupOutput(e),t[n].subBuild=e.getClosestSubBuild(this),t[n]}build(e,t=null){let n=null,r=e.getBuildStage(),s=e.getNodeProperties(this),o=e.getSubBuildOutput(this),a=this.getOutputNode(e),l=e.fnCall;if(e.fnCall=this,r==="setup"){let c=e.getSubBuildProperty("initialized",this);if(s[c]!==!0&&(s[c]=!0,s[o]=this.getOutputNode(e),s[o].build(e),this.shaderNode.subBuilds))for(let u of e.chaining){let f=e.getDataFromNode(u,"any");f.subBuilds=f.subBuilds||new Set;for(let d of this.shaderNode.subBuilds)f.subBuilds.add(d)}n=s[o]}else r==="analyze"?a.build(e,t):r==="generate"&&(n=a.build(e,t)||"");return e.fnCall=l,n}};function ane(i){return i[0]&&(i[0].isNode||Object.getPrototypeOf(i[0])!==Object.prototype)}function VTe(i){let e;return mP(i),ane(i)?e=[...i]:e=i[0],e}function GTe(i){let e=0;return mP(i),new Proxy(i,{get:(t,n,r)=>{let s;if(n==="length")return s=i.length,s;if(Symbol.iterator===n)s=function*(){for(let o of i)yield Ht(o)};else{if(i.length>0)if(Object.getPrototypeOf(i[0])===Object.prototype){let o=i[0];o[n]===void 0?s=o[e++]:s=Reflect.get(o,n,r)}else i[0]instanceof Kt&&(i[n]===void 0?s=i[e++]:s=Reflect.get(i,n,r));else s=Reflect.get(t,n,r);s=Ht(s)}return s}})}var MU=class extends Kt{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new EU(this,e)}setup(){return this.call()}},qTe=[!1,!0],HTe=[0,1,2,3],WTe=[-1,-2],lne=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],lz=new Map;for(let i of qTe)lz.set(i,new iu(i));var cz=new Map;for(let i of HTe)cz.set(i,new iu(i,"uint"));var uz=new Map([...cz].map(i=>new iu(i.value,"int")));for(let i of WTe)uz.set(i,new iu(i,"int"));var dP=new Map([...uz].map(i=>new iu(i.value)));for(let i of lne)dP.set(i,new iu(i));for(let i of lne)dP.set(-i,new iu(-i));var pP={bool:lz,uint:cz,ints:uz,float:dP},Oee=new Map([...lz,...dP]),CU=(i,e)=>Oee.has(i)?Oee.get(i):i.isNode===!0?i:new iu(i,e),Ys=function(i,e=null){return(...t)=>{for(let r of t)if(r===void 0)return ze(`TSL: Invalid parameter for the type "${i}".`,new ts),new iu(0,i);if((t.length===0||!["bool","float","int","uint"].includes(i)&&t.every(r=>{let s=typeof r;return s!=="object"&&s!=="function"}))&&(t=[az(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return eS(e.get(t[0]));if(t.length===1){let r=CU(t[0],i);return r.nodeType===i?eS(r):eS(new t4(r,i))}let n=t.map(r=>CU(r));return eS(new yU(n,i))}};function hx(i){return i&&i.isNode&&i.traverse(e=>{e.isConstNode&&(i=e.value)}),!!i}var cne=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function ix(i,e){return new MU(i,e)}var Ht=(i,e=null)=>OTe(i,e),eS=(i,e=null)=>Ht(i,e).toVarIntent(),mP=(i,e=null)=>new UTe(i,e),Wg=(i,e=null)=>new kTe(i,e),$n=(i,e=null,t=null,n=null)=>new one(i,e,t,n),xt=(i,...e)=>new zTe(i,...e),ct=(i,e=null,t=null,n={})=>new one(i,e,t,{...n,intent:!0}),hz=(i,e)=>new Proxy(i,{get(t,n,r){return Reflect.get(e,n,r)},set(t,n,r){return Reflect.set(e,n,r)}}),jTe=0,RU=class extends Kt{constructor(e,t=null){super();let n=null;t!==null&&(typeof t=="object"?n=t.return:(typeof t=="string"?n=t:ze("TSL: Invalid layout type.",new ts),t=null)),this.shaderNode=new ix(e,n),t!==null&&this.setLayout(t),this.isFn=!0}setLayout(e){let t=this.shaderNode.nodeType;if(typeof e.inputs!="object"){let n={name:"fn"+jTe++,type:t,inputs:[]};for(let r in e)r!=="return"&&n.inputs.push({name:r,type:e[r]});e=n}return this.shaderNode.setLayout(e),this}generateNodeType(e){return this.shaderNode.getNodeType(e)||"float"}call(...e){let t=this.shaderNode.call(e);return this.shaderNode.nodeType==="void"&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){let t=this.getNodeType(e);return ze('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".',this.stackTrace),e.generateConst(t)}};function me(i,e=null){let t=new RU(i,e);return new Proxy(()=>{},{apply(n,r,s){return t.call(...s)},get(n,r,s){return Reflect.get(t,r,s)},set(n,r,s,o){return Reflect.set(t,r,s,o)}})}var fS=i=>{Am=i},fz=()=>Am,$t=(...i)=>Am.If(...i),XTe=(...i)=>Am.Switch(...i);function AP(i){return Am&&Am.addToStack(i),i}Ue("toStack",AP);var une=new Ys("color"),oe=new Ys("float",pP.float),de=new Ys("int",pP.ints),rt=new Ys("uint",pP.uint),dc=new Ys("bool",pP.bool),dt=new Ys("vec2"),kr=new Ys("ivec2"),dz=new Ys("uvec2"),hne=new Ys("bvec2"),pe=new Ys("vec3"),pz=new Ys("ivec3"),l1=new Ys("uvec3"),mz=new Ys("bvec3"),Ft=new Ys("vec4"),Az=new Ys("ivec4"),gz=new Ys("uvec4"),fne=new Ys("bvec4"),gP=new Ys("mat2"),To=new Ys("mat3"),pm=new Ys("mat4");Ue("toColor",une);Ue("toFloat",oe);Ue("toInt",de);Ue("toUint",rt);Ue("toBool",dc);Ue("toVec2",dt);Ue("toIVec2",kr);Ue("toUVec2",dz);Ue("toBVec2",hne);Ue("toVec3",pe);Ue("toIVec3",pz);Ue("toUVec3",l1);Ue("toBVec3",mz);Ue("toVec4",Ft);Ue("toIVec4",Az);Ue("toUVec4",gz);Ue("toBVec4",fne);Ue("toMat2",gP);Ue("toMat3",To);Ue("toMat4",pm);var dne=$n(Zd).setParameterLength(2),pne=(i,e)=>new t4(Ht(i),e),$Te=(i,e)=>new n4(Ht(i),e);Ue("element",dne);Ue("convert",pne);var YTe=i=>(Xe("TSL: append() has been renamed to Stack().",new ts),AP(i));Ue("append",i=>(Xe("TSL: .append() has been renamed to .toStack().",new ts),AP(i)));var gi=class extends Kt{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1,r=null){super(e),this.name=t,this.varying=n,this.placeholderNode=Ht(r),this.isPropertyNode=!0,this.global=!0}getNodeType(e){let t=super.getNodeType(e);return t==="output"?e.getOutputType():t}customCacheKey(){return yx(this.type+":"+(this.name||"")+":"+(this.varying?"1":"0"))}getHash(e){return this.name||super.getHash(e)}generate(e){let t;if(this.varying===!0)t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0;else if(t=e.getVarFromNode(this,this.name),this.placeholderNode!==null&&e.hasWriteUsage(this)===!1){let n=this.placeholderNode.build(e,this.getNodeType(e));e.addLineFlowCode(`${e.getPropertyName(t)} = ${n}`,this)}return e.getPropertyName(t)}},Jd=(i,e,t=null)=>new gi(i,e,!1,t),c1=(i,e,t=null)=>new gi(i,e,!0,t),Bi=xt(gi,"vec4","DiffuseColor"),kg=xt(gi,"vec3","DiffuseContribution"),PU=xt(gi,"vec3","EmissiveColor"),pf=xt(gi,"float","Roughness"),Yd=xt(gi,"float","Metalness"),i4=xt(gi,"float","Clearcoat"),sx=xt(gi,"float","ClearcoatRoughness"),cc=xt(gi,"vec3","Sheen"),am=xt(gi,"float","SheenRoughness"),vP=xt(gi,"float","Iridescence"),r4=xt(gi,"float","IridescenceIOR"),s4=xt(gi,"float","IridescenceThickness"),o4=xt(gi,"float","AlphaT"),om=xt(gi,"float","Anisotropy"),rS=xt(gi,"vec3","AnisotropyT"),jg=xt(gi,"vec3","AnisotropyB"),gm=xt(gi,"color","SpecularColor"),Vg=xt(gi,"color","SpecularColorBlended"),Gg=xt(gi,"float","SpecularF90"),a4=xt(gi,"float","Shininess"),ox=xt(gi,"output","Output"),Xg=xt(gi,"float","dashSize"),dS=xt(gi,"float","gapSize"),ZTe=xt(gi,"float","pointWidth"),sS=xt(gi,"float","IOR"),l4=xt(gi,"float","Transmission"),vz=xt(gi,"float","Thickness"),_z=xt(gi,"float","AttenuationDistance"),xz=xt(gi,"color","AttenuationColor"),yz=xt(gi,"float","Dispersion"),IU=xt(gi,"float","AmbientOcclusion",!1,1),c4=class extends Kt{static get type(){return"UniformGroupNode"}constructor(e,t=!1,n=1,r=null){super("string"),this.name=e,this.shared=t,this.order=n,this.updateType=r,this.isUniformGroup=!0}update(){this.needsUpdate=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}},mne=(i,e=1,t=null)=>new c4(i,!1,e,t),_P=(i,e=0,t=null)=>new c4(i,!0,e,t),KTe=_P("frame",0,yn.FRAME),Jt=_P("render",0,yn.RENDER),Ane=mne("object",1,yn.OBJECT),Qg=class extends hS{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=Ane}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.',new ts),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){return e=e.bind(this),super.onUpdate(n=>{let r=e(n,this);r!==void 0&&(this.value=r)},t)}getInputType(e){let t=super.getInputType(e);return t==="bool"&&(t="uint"),t}generate(e,t){let n=this.getNodeType(e),r=this.getUniformHash(e),s=e.getNodeFromHash(r);s===void 0&&(e.setHashNode(this,r),s=this);let o=s.getInputType(e),a=e.getUniformFromNode(s,o,e.shaderStage,this.name||e.context.nodeName),l=e.getPropertyName(a);e.context.nodeName!==void 0&&delete e.context.nodeName;let c=l;if(n==="bool"){let u=e.getDataFromNode(this),f=u.propertyName;if(f===void 0){let d=e.getVarFromNode(this,null,"bool");f=e.getPropertyName(d),u.propertyName=f,c=e.format(l,o,n),e.addLineFlowCode(`${f} = ${c}`,this)}c=f}return e.format(c,n,t)}},Xt=(i,e)=>{let t=cne(e||i);if(t===i&&(i=az(t)),i&&i.isNode===!0){let n=i.value;i.traverse(r=>{r.isConstNode===!0&&(n=r.value)}),i=n}return new Qg(i,t)},u4=class extends Rr{static get type(){return"ArrayNode"}constructor(e,t,n=null){super(e),this.count=t,this.values=n,this.isArrayNode=!0}getArrayCount(){return this.count}generateNodeType(e){return this.nodeType===null?this.values[0].getNodeType(e):this.nodeType}getElementType(e){return this.getNodeType(e)}getMemberType(e,t){return this.nodeType===null?this.values[0].getMemberType(e,t):super.getMemberType(e,t)}generate(e){let t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}},gne=(...i)=>{let e;if(i.length===1){let t=i[0];e=new u4(null,t.length,t)}else{let t=i[0],n=i[1];e=new u4(t,n)}return Ht(e)};Ue("toArray",(i,e)=>gne(Array(e).fill(i)));var LU=class extends Rr{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}generateNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){let{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){let n=e.getTypeLength(t.node.getNodeType(e));return a1.join("").slice(0,n)!==t.components}return!1}setup(e){let{targetNode:t,sourceNode:n}=this,r=t.getScope(),s=e.getDataFromNode(r);s.assign=!0;let o=e.getNodeProperties(this);o.sourceNode=n,o.targetNode=t.context({assign:!0})}generate(e,t){let{targetNode:n,sourceNode:r}=e.getNodeProperties(this),s=this.needsSplitAssign(e),o=n.build(e),a=n.getNodeType(e),l=r.build(e,a),c=r.getNodeType(e),u=e.getDataFromNode(this),f;if(u.initialized===!0)t!=="void"&&(f=o);else if(s){let d=e.getVarFromNode(this,null,a),A=e.getPropertyName(d);e.addLineFlowCode(`${A} = ${l}`,this);let y=n.node,S=y.node.context({assign:!0}).build(e);for(let T=0;T<y.components.length;T++){let R=y.components[T];e.addLineFlowCode(`${S}.${R} = ${A}[ ${T} ]`,this)}t!=="void"&&(f=o)}else f=`${o} = ${l}`,(t==="void"||c==="void")&&(e.addLineFlowCode(f,this),t!=="void"&&(f=o));return u.initialized=!0,e.format(f,a,t)}},vne=$n(LU).setParameterLength(2);Ue("assign",vne);var DU=class extends Rr{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}generateNodeType(e){return this.functionNode.getNodeType(e)}getMemberType(e,t){return this.functionNode.getMemberType(e,t)}generate(e){let t=[],n=this.functionNode,r=n.getInputs(e),s=this.parameters,o=(l,c)=>{let u=c.type,f=u==="pointer",d;return f?d="&"+l.build(e):d=l.build(e,u),d};if(Array.isArray(s)){if(s.length>r.length)ze("TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),s.length=r.length;else if(s.length<r.length)for(ze("TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.");s.length<r.length;)s.push(oe(0));for(let l=0;l<s.length;l++)t.push(o(s[l],r[l]))}else for(let l of r){let c=s[l.name];c!==void 0?t.push(o(c,l)):(ze(`TSL: Input '${l.name}' not found in 'Fn()'.`),t.push(o(oe(0),l)))}return`${n.build(e,"property")}( ${t.join(", ")} )`}},_ne=(i,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?Wg(e):mP(e[0]),new DU(Ht(i),e));Ue("call",_ne);var QTe={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"},ns=class i extends Rr{static get type(){return"OperatorNode"}constructor(e,t,n,...r){if(super(),r.length>0){let s=new i(e,t,n);for(let o=0;o<r.length-1;o++)s=new i(e,s,r[o]);t=s,n=r[r.length-1]}this.op=e,this.aNode=t,this.bNode=n,this.isOperatorNode=!0}getOperatorMethod(e,t){return e.getMethod(QTe[this.op],t)}generateNodeType(e,t=null){let n=this.op,r=this.aNode,s=this.bNode,o=r.getNodeType(e),a=s?s.getNodeType(e):null;if(o==="void"||a==="void")return t||"void";if(n==="%")return o;if(n==="~"||n==="&"||n==="|"||n==="^"||n===">>"||n==="<<")return e.getIntegerType(o);if(n==="&&"||n==="||"||n==="^^")return"bool";if(n==="!"){let l=e.getTypeLength(o);return l>1?`bvec${l}`:"bool"}else if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">="){let l=Math.max(e.getTypeLength(o),e.getTypeLength(a));return l>1?`bvec${l}`:"bool"}else{if(e.isMatrix(o)){if(a==="float")return o;if(e.isVector(a))return e.getVectorFromMatrix(o);if(e.isMatrix(a))return o}else if(e.isMatrix(a)){if(o==="float")return a;if(e.isVector(o))return e.getVectorFromMatrix(a)}return e.getTypeLength(a)>e.getTypeLength(o)?a:o}}generate(e,t){let n=this.op,{aNode:r,bNode:s}=this,o=this.getNodeType(e,t),a=null,l=null;o!=="void"?(a=r.getNodeType(e),l=s?s.getNodeType(e):null,n==="<"||n===">"||n==="<="||n===">="||n==="=="||n==="!="?e.isVector(a)?l=a:e.isVector(l)?a=l:a!==l&&(a=l="float"):n===">>"||n==="<<"?(a=o,l=e.changeComponentType(l,"uint")):n==="%"?(a=o,l=e.isInteger(a)&&e.isInteger(l)?l:a):e.isMatrix(a)?l==="float"?l="float":e.isVector(l)?l=e.getVectorFromMatrix(a):e.isMatrix(l)||(a=l=o):e.isMatrix(l)?a==="float"?a="float":e.isVector(a)?a=e.getVectorFromMatrix(l):a=l=o:a=l=o):a=l=o;let c=r.build(e,a),u=s?s.build(e,l):null,f=e.getFunctionOperator(n);if(t!=="void"){let d=e.renderer.coordinateSystem===ko;if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">=")return d?e.isVector(a)?e.format(`${this.getOperatorMethod(e,t)}( ${c}, ${u} )`,o,t):e.format(`( ${c} ${n} ${u} )`,o,t):e.format(`( ${c} ${n} ${u} )`,o,t);if(n==="%")return e.isInteger(l)?e.format(`( ${c} % ${u} )`,o,t):e.format(`${this.getOperatorMethod(e,o)}( ${c}, ${u} )`,o,t);if(n==="!")return d&&e.isVector(a)?e.format(`not( ${c} )`,t):e.format(`( ${n} ${c} )`,a,t);if(n==="~")return e.format(`( ${n} ${c} )`,a,t);if(f)return e.format(`${f}( ${c}, ${u} )`,o,t);if(e.isMatrix(a)&&l==="float")return e.format(`( ${u} ${n} ${c} )`,o,t);if(a==="float"&&e.isMatrix(l))return e.format(`${c} ${n} ${u}`,o,t);{let A=`( ${c} ${n} ${u} )`;return!d&&o==="bool"&&e.isVector(a)&&e.isVector(l)&&(A=`all${A}`),e.format(A,o,t)}}else if(a!=="void")return f?e.format(`${f}( ${c}, ${u} )`,o,t):e.isMatrix(a)&&l==="float"?e.format(`${u} ${n} ${c}`,o,t):e.format(`${c} ${n} ${u}`,o,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}},Ps=ct(ns,"+").setParameterLength(2,1/0).setName("add"),ai=ct(ns,"-").setParameterLength(2,1/0).setName("sub"),Tn=ct(ns,"*").setParameterLength(2,1/0).setName("mul"),pc=ct(ns,"/").setParameterLength(2,1/0).setName("div"),xP=ct(ns,"%").setParameterLength(2).setName("mod"),xne=ct(ns,"==").setParameterLength(2).setName("equal"),yne=ct(ns,"!=").setParameterLength(2).setName("notEqual"),bne=ct(ns,"<").setParameterLength(2).setName("lessThan"),bz=ct(ns,">").setParameterLength(2).setName("greaterThan"),wne=ct(ns,"<=").setParameterLength(2).setName("lessThanEqual"),Sne=ct(ns,">=").setParameterLength(2).setName("greaterThanEqual"),Tne=ct(ns,"&&").setParameterLength(2,1/0).setName("and"),Ene=ct(ns,"||").setParameterLength(2,1/0).setName("or"),Mne=ct(ns,"!").setParameterLength(1).setName("not"),Cne=ct(ns,"^^").setParameterLength(2).setName("xor"),Rne=ct(ns,"&").setParameterLength(2).setName("bitAnd"),Pne=ct(ns,"~").setParameterLength(1).setName("bitNot"),Ine=ct(ns,"|").setParameterLength(2).setName("bitOr"),Lne=ct(ns,"^").setParameterLength(2).setName("bitXor"),Dne=ct(ns,"<<").setParameterLength(2).setName("shiftLeft"),Nne=ct(ns,">>").setParameterLength(2).setName("shiftRight"),Fne=me(([i])=>(i.addAssign(1),i)),Bne=me(([i])=>(i.subAssign(1),i)),One=me(([i])=>{let e=de(i).toConst();return i.addAssign(1),e}),Une=me(([i])=>{let e=de(i).toConst();return i.subAssign(1),e});Ue("add",Ps);Ue("sub",ai);Ue("mul",Tn);Ue("div",pc);Ue("mod",xP);Ue("equal",xne);Ue("notEqual",yne);Ue("lessThan",bne);Ue("greaterThan",bz);Ue("lessThanEqual",wne);Ue("greaterThanEqual",Sne);Ue("and",Tne);Ue("or",Ene);Ue("not",Mne);Ue("xor",Cne);Ue("bitAnd",Rne);Ue("bitNot",Pne);Ue("bitOr",Ine);Ue("bitXor",Lne);Ue("shiftLeft",Dne);Ue("shiftRight",Nne);Ue("incrementBefore",Fne);Ue("decrementBefore",Bne);Ue("increment",One);Ue("decrement",Une);var Pe=class i extends Rr{static get type(){return"MathNode"}constructor(e,t,n=null,r=null){if(super(),(e===i.MAX||e===i.MIN)&&arguments.length>3){let s=new i(e,t,n);for(let o=3;o<arguments.length-1;o++)s=new i(e,s,arguments[o]);t=s,n=arguments[arguments.length-1],r=null}this.method=e,this.aNode=t,this.bNode=n,this.cNode=r,this.isMathNode=!0}getInputType(e){let t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,r=this.cNode?this.cNode.getNodeType(e):null,s=e.isMatrix(t)?0:e.getTypeLength(t),o=e.isMatrix(n)?0:e.getTypeLength(n),a=e.isMatrix(r)?0:e.getTypeLength(r);return s>o&&s>a?t:o>a?n:a>s?r:t}generateNodeType(e){let t=this.method;return t===i.LENGTH||t===i.DISTANCE||t===i.DOT?"float":t===i.CROSS?"vec3":t===i.ALL||t===i.ANY?"bool":t===i.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):this.getInputType(e)}setup(e){let{aNode:t,bNode:n,method:r}=this,s=null;if(r===i.ONE_MINUS)s=ai(1,t);else if(r===i.RECIPROCAL)s=pc(1,t);else if(r===i.DIFFERENCE)s=fr(ai(t,n));else if(r===i.TRANSFORM_DIRECTION){let o,a;e.isMatrix(t.getNodeType(e))?(o=t,a=n):(o=n,a=t),s=ya(Tn(o,Ft(pe(a),0)).xyz)}return s!==null?s:super.setup(e)}generate(e,t){if(e.getNodeProperties(this).outputNode)return super.generate(e,t);let r=this.method,s=this.getNodeType(e),o=this.getInputType(e),a=this.aNode,l=this.bNode,c=this.cNode,u=e.renderer.coordinateSystem;if(r===i.NEGATE)return e.format("( - "+a.build(e,o)+" )",s,t);{let f=[];return r===i.CROSS?f.push(a.build(e,s),l.build(e,s)):u===ko&&r===i.STEP?f.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":o),l.build(e,o)):u===ko&&(r===i.MIN||r===i.MAX)?f.push(a.build(e,o),l.build(e,e.getTypeLength(l.getNodeType(e))===1?"float":o)):r===i.REFRACT?f.push(a.build(e,o),l.build(e,o),c.build(e,"float")):r===i.MIX?f.push(a.build(e,o),l.build(e,o),c.build(e,e.getTypeLength(c.getNodeType(e))===1?"float":o)):(u===xl&&r===i.ATAN&&l!==null&&(r="atan2"),e.shaderStage!=="fragment"&&(r===i.DFDX||r===i.DFDY)&&(Xe(`TSL: '${r}' is not supported in the ${e.shaderStage} stage.`,this.stackTrace),r="/*"+r+"*/"),f.push(a.build(e,o)),l!==null&&f.push(l.build(e,o)),c!==null&&f.push(c.build(e,o))),e.format(`${e.getMethod(r,s)}( ${f.join(", ")} )`,s,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};Pe.ALL="all";Pe.ANY="any";Pe.RADIANS="radians";Pe.DEGREES="degrees";Pe.EXP="exp";Pe.EXP2="exp2";Pe.LOG="log";Pe.LOG2="log2";Pe.SQRT="sqrt";Pe.INVERSE_SQRT="inversesqrt";Pe.FLOOR="floor";Pe.CEIL="ceil";Pe.NORMALIZE="normalize";Pe.FRACT="fract";Pe.SIN="sin";Pe.SINH="sinh";Pe.COS="cos";Pe.COSH="cosh";Pe.TAN="tan";Pe.TANH="tanh";Pe.ASIN="asin";Pe.ASINH="asinh";Pe.ACOS="acos";Pe.ACOSH="acosh";Pe.ATAN="atan";Pe.ATANH="atanh";Pe.ABS="abs";Pe.SIGN="sign";Pe.LENGTH="length";Pe.NEGATE="negate";Pe.ONE_MINUS="oneMinus";Pe.DFDX="dFdx";Pe.DFDY="dFdy";Pe.ROUND="round";Pe.RECIPROCAL="reciprocal";Pe.TRUNC="trunc";Pe.FWIDTH="fwidth";Pe.TRANSPOSE="transpose";Pe.DETERMINANT="determinant";Pe.INVERSE="inverse";Pe.EQUALS="equals";Pe.MIN="min";Pe.MAX="max";Pe.STEP="step";Pe.REFLECT="reflect";Pe.DISTANCE="distance";Pe.DIFFERENCE="difference";Pe.DOT="dot";Pe.CROSS="cross";Pe.POW="pow";Pe.TRANSFORM_DIRECTION="transformDirection";Pe.MIX="mix";Pe.CLAMP="clamp";Pe.REFRACT="refract";Pe.SMOOTHSTEP="smoothstep";Pe.FACEFORWARD="faceforward";var yP=oe(1e-6),JTe=oe(1e6),h4=oe(Math.PI),eEe=oe(Math.PI*2),tEe=oe(Math.PI*2),nEe=oe(Math.PI*.5),kne=ct(Pe,Pe.ALL).setParameterLength(1),zne=ct(Pe,Pe.ANY).setParameterLength(1),Vne=ct(Pe,Pe.RADIANS).setParameterLength(1),Gne=ct(Pe,Pe.DEGREES).setParameterLength(1),wz=ct(Pe,Pe.EXP).setParameterLength(1),fx=ct(Pe,Pe.EXP2).setParameterLength(1),bP=ct(Pe,Pe.LOG).setParameterLength(1),Af=ct(Pe,Pe.LOG2).setParameterLength(1),el=ct(Pe,Pe.SQRT).setParameterLength(1),Sz=ct(Pe,Pe.INVERSE_SQRT).setParameterLength(1),gf=ct(Pe,Pe.FLOOR).setParameterLength(1),wP=ct(Pe,Pe.CEIL).setParameterLength(1),ya=ct(Pe,Pe.NORMALIZE).setParameterLength(1),$u=ct(Pe,Pe.FRACT).setParameterLength(1),Ka=ct(Pe,Pe.SIN).setParameterLength(1),qne=ct(Pe,Pe.SINH).setParameterLength(1),Hu=ct(Pe,Pe.COS).setParameterLength(1),Hne=ct(Pe,Pe.COSH).setParameterLength(1),Wne=ct(Pe,Pe.TAN).setParameterLength(1),jne=ct(Pe,Pe.TANH).setParameterLength(1),Xne=ct(Pe,Pe.ASIN).setParameterLength(1),$ne=ct(Pe,Pe.ASINH).setParameterLength(1),Tz=ct(Pe,Pe.ACOS).setParameterLength(1),Yne=ct(Pe,Pe.ACOSH).setParameterLength(1),Ez=ct(Pe,Pe.ATAN).setParameterLength(1,2),Zne=ct(Pe,Pe.ATANH).setParameterLength(1),fr=ct(Pe,Pe.ABS).setParameterLength(1),Mz=ct(Pe,Pe.SIGN).setParameterLength(1),vf=ct(Pe,Pe.LENGTH).setParameterLength(1),Cz=ct(Pe,Pe.NEGATE).setParameterLength(1),Kne=ct(Pe,Pe.ONE_MINUS).setParameterLength(1),Rz=ct(Pe,Pe.DFDX).setParameterLength(1),Pz=ct(Pe,Pe.DFDY).setParameterLength(1),Qne=ct(Pe,Pe.ROUND).setParameterLength(1),Jne=ct(Pe,Pe.RECIPROCAL).setParameterLength(1),Iz=ct(Pe,Pe.TRUNC).setParameterLength(1),Lz=ct(Pe,Pe.FWIDTH).setParameterLength(1),eie=ct(Pe,Pe.TRANSPOSE).setParameterLength(1),tie=ct(Pe,Pe.DETERMINANT).setParameterLength(1),nie=ct(Pe,Pe.INVERSE).setParameterLength(1),Pl=ct(Pe,Pe.MIN).setParameterLength(2,1/0),zr=ct(Pe,Pe.MAX).setParameterLength(2,1/0),Jg=ct(Pe,Pe.STEP).setParameterLength(2),iie=ct(Pe,Pe.REFLECT).setParameterLength(2),rie=ct(Pe,Pe.DISTANCE).setParameterLength(2),sie=ct(Pe,Pe.DIFFERENCE).setParameterLength(2),ru=ct(Pe,Pe.DOT).setParameterLength(2),Kd=ct(Pe,Pe.CROSS).setParameterLength(2),eu=ct(Pe,Pe.POW).setParameterLength(2),Dz=i=>Tn(i,i),oie=i=>Tn(i,i,i),Nz=i=>Tn(i,i,i,i),aie=ct(Pe,Pe.TRANSFORM_DIRECTION).setParameterLength(2),lie=(i,e)=>ya(Tn(e,Ft(pe(i),0)).xyz),cie=(i,e)=>ya(Ft(pe(i),0).mul(e).xyz),uie=i=>Tn(Mz(i),eu(fr(i),1/3)),Fz=i=>ru(i,i),Qn=ct(Pe,Pe.MIX).setParameterLength(3),Yu=(i,e=0,t=1)=>new Pe(Pe.CLAMP,Ht(i),Ht(e),Ht(t)),SP=i=>Yu(i),Bz=ct(Pe,Pe.REFRACT).setParameterLength(3),mc=ct(Pe,Pe.SMOOTHSTEP).setParameterLength(3),Oz=ct(Pe,Pe.FACEFORWARD).setParameterLength(3),hie=me(([i])=>{let n=43758.5453,r=ru(i.xy,dt(12.9898,78.233)),s=xP(r,h4);return $u(Ka(s).mul(n))}),fie=(i,e,t)=>Qn(e,t,i),die=(i,e,t)=>mc(e,t,i),pie=(i,e)=>Jg(e,i),iEe=Oz,rEe=Sz;Ue("all",kne);Ue("any",zne);Ue("radians",Vne);Ue("degrees",Gne);Ue("exp",wz);Ue("exp2",fx);Ue("log",bP);Ue("log2",Af);Ue("sqrt",el);Ue("inverseSqrt",Sz);Ue("floor",gf);Ue("ceil",wP);Ue("normalize",ya);Ue("fract",$u);Ue("sin",Ka);Ue("sinh",qne);Ue("cos",Hu);Ue("cosh",Hne);Ue("tan",Wne);Ue("tanh",jne);Ue("asin",Xne);Ue("asinh",$ne);Ue("acos",Tz);Ue("acosh",Yne);Ue("atan",Ez);Ue("atanh",Zne);Ue("abs",fr);Ue("sign",Mz);Ue("length",vf);Ue("lengthSq",Fz);Ue("negate",Cz);Ue("oneMinus",Kne);Ue("dFdx",Rz);Ue("dFdy",Pz);Ue("round",Qne);Ue("reciprocal",Jne);Ue("trunc",Iz);Ue("fwidth",Lz);Ue("min",Pl);Ue("max",zr);Ue("step",pie);Ue("reflect",iie);Ue("distance",rie);Ue("dot",ru);Ue("cross",Kd);Ue("pow",eu);Ue("pow2",Dz);Ue("pow3",oie);Ue("pow4",Nz);Ue("transformDirection",aie);Ue("transformNormalByViewMatrix",lie);Ue("transformNormalByInverseViewMatrix",cie);Ue("mix",fie);Ue("clamp",Yu);Ue("refract",Bz);Ue("smoothstep",die);Ue("faceForward",Oz);Ue("difference",sie);Ue("saturate",SP);Ue("cbrt",uie);Ue("transpose",eie);Ue("determinant",tie);Ue("inverse",nie);Ue("rand",hie);var NU=class extends Kt{static get type(){return"ConditionalNode"}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}generateNodeType(e){let{ifNode:t,elseNode:n}=e.getNodeProperties(this);if(t===void 0)return e.flowBuildStage(this,"setup"),this.getNodeType(e);let r=t.getNodeType(e);if(n!==null){let s=n.getNodeType(e);if(e.getTypeLength(s)>e.getTypeLength(r))return s}return r}setup(e){let t=this.condNode,n=this.ifNode.isolate(),r=this.elseNode?this.elseNode.isolate():null,s=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=s,r!==null&&(e.getDataFromNode(r).parentNodeBlock=s);let o=e.context.uniformFlow,a=e.getNodeProperties(this);a.condNode=t,a.ifNode=o?n:n.context({nodeBlock:n}),a.elseNode=r?o?r:r.context({nodeBlock:r}):null}generate(e,t){let n=this.getNodeType(e),r=e.getDataFromNode(this);if(r.nodeProperty!==void 0)return r.nodeProperty;let{condNode:s,ifNode:o,elseNode:a}=e.getNodeProperties(this),l=e.currentFunctionNode,c=t!=="void",u=c?Jd(n).build(e):"";r.nodeProperty=u;let f=s.build(e,"bool");if(e.context.uniformFlow&&a!==null){let y=o.build(e,n),w=a.build(e,n),S=e.getTernary(f,y,w);return e.format(S,n,t)}e.addFlowCode(`41344134 ${e.tab}if ( ${f} ) {41354135 41364136 `).addFlowTab();let A=o.build(e,n);if(A&&(c?A=u+" = "+A+";":(A="return "+A+";",l===null&&(Xe("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.",this.stackTrace),A="// "+A))),e.removeFlowTab().addFlowCode(e.tab+" "+A+`
@@ -4143,30 +4143,30 @@ ${e.tab}if ( ${f} ) {
41434143 41444144 `)}else e.addFlowCode(`41454145 4146-`);return e.format(u,n,t)}},xa=$n(NU).setParameterLength(2,3);Ue("select",xa);var gS=class extends Kt{static get type(){return"ContextNode"}constructor(e=null,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}generateNodeType(e){return this.node.getNodeType(e)}getFlowContextData(){let e=[];return this.traverse(t=>{t.isContextNode===!0&&e.push(t.value)}),Object.assign({},...e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}setup(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}generate(e,t){let n=e.addContext(this.value),r=this.node.build(e,t);return e.setContext(n),r}},ip=(i=null,e={})=>{let t=i;return(t===null||t.isNode!==!0)&&(e=t||e,t=null),new gS(t,e)},_ie=i=>ip(i,{uniformFlow:!0}),Uz=(i,e)=>ip(i,{nodeName:e});function xie(i,e,t=null){return ip(t,{getShadow:({light:n,shadowColorNode:r})=>e===n?r.mul(i):r})}function yie(i,e=null){return ip(e,{getAO:(t,{material:n})=>n.transparent===!0?t:t!==null?t.mul(i):i})}function bie(i,e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.'),Uz(i,e)}Ue("context",ip);Ue("label",bie);Ue("uniformFlow",_ie);Ue("setName",Uz);Ue("builtinShadowContext",(i,e,t)=>xie(e,t,i));Ue("builtinAOContext",(i,e)=>yie(e,i));var cx=class extends Kt{static get type(){return"VarNode"}constructor(e,t=null,n=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=n,this.parents=!0,this.intent=!1}setIntent(e){return this.intent=e,this}isIntent(e){return e.getDataFromNode(this).forceDeclaration===!0?!1:this.intent}getIntent(){return this.intent}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}generateNodeType(e){return this.node.getNodeType(e)}getArrayCount(e){return this.node.getArrayCount(e)}isAssign(e){return e.getDataFromNode(this).assign}build(...e){let t=e[0],n=this.getShared(t);if(this!==n)return n.build(...e);if(this._hasStack(t)===!1&&t.buildStage==="setup"&&(t.context.nodeLoop||t.context.nodeBlock)){let r=!1;if(this.node.isShaderCallNodeInternal&&this.node.shaderNode.getLayout()===null&&t.fnCall&&t.fnCall.shaderNode&&t.getDataFromNode(this.node.shaderNode).hasLoop){let a=t.getDataFromNode(this);a.forceDeclaration=!0,r=!0}let s=t.getBaseStack();r?s.addToStackBefore(this):s.addToStack(this)}return this.isIntent(t)&&this.isAssign(t)!==!0?this.node.build(...e):super.build(...e)}generate(e){let{node:t,name:n,readOnly:r}=this,{renderer:s}=e,o=s.backend.isWebGPUBackend===!0,a=!1,l=!1;r&&(a=e.isDeterministic(t),l=o?r:a);let c=this.getNodeType(e);if(c=="void")return this.isIntent(e)!==!0&&ze('TSL: ".toVar()" can not be used with void type.',this.stackTrace),t.build(e);let u=e.getVectorType(c),f=t.build(e,u),d=e.getVarFromNode(this,n,u,void 0,l),A=e.getPropertyName(d),y=A;if(l)if(o)y=a?`const ${A}`:`let ${A}`;else{let w=t.getArrayCount(e);y=`const ${e.getVar(d.type,A,w)}`}return e.addLineFlowCode(`${y} = ${f}`,this),A}_hasStack(e){return e.getDataFromNode(this).stack!==void 0}},kz=$n(cx),wie=(i,e=null)=>kz(i,e).toStack(),Sie=(i,e=null)=>kz(i,e,!0).toStack(),Tie=i=>kz(i).setIntent(!0).toStack();Ue("toVar",wie);Ue("toConst",Sie);Ue("toVarIntent",Tie);var FU=class extends Kt{static get type(){return"SubBuild"}constructor(e,t,n=null){super(n),this.node=e,this.name=t,this.isSubBuildNode=!0}generateNodeType(e){if(this.nodeType!==null)return this.nodeType;e.addSubBuild(this.name);let t=this.node.getNodeType(e);return e.removeSubBuild(),t}build(e,...t){e.addSubBuild(this.name);let n=this.node.build(e,...t);return e.removeSubBuild(),n}},Yg=(i,e,t=null)=>new FU(Ht(i),e,t),BU=class extends Kt{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=Yg(e,"VERTEX"),this.name=t,this.isVaryingNode=!0,this.interpolationType=null,this.interpolationSampling=null,this.global=!0}setInterpolation(e,t=null){return this.interpolationType=e,this.interpolationSampling=t,this}getHash(e){return this.name||super.getHash(e)}generateNodeType(e){return this.node.getNodeType(e)}setupVarying(e){let t=e.getNodeProperties(this),n=t.varying;if(n===void 0){let r=this.name,s=this.getNodeType(e),o=this.interpolationType,a=this.interpolationSampling;t.varying=n=e.getVaryingFromNode(this,r,s,o,a),t.node=Yg(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(nx.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(nx.VERTEX,this.node)}generate(e){let t=e.getSubBuildProperty("property",e.currentStack),n=e.getNodeProperties(this),r=this.setupVarying(e);if(n[t]===void 0){let s=this.getNodeType(e),o=e.getPropertyName(r,nx.VERTEX);if(e.shaderStage===nx.VERTEX){let a=n.node.build(e,s);e.addLineFlowCode(`${o} = ${a}`,this)}else e.flowNodeFromShaderStage(nx.VERTEX,n.node,s,o);n[t]=o}return e.getPropertyName(r)}},bm=$n(BU).setParameterLength(1,2),Eie=i=>bm(i);Ue("toVarying",bm);Ue("toVertexStage",Eie);var Mie=me(([i])=>{let e=i.mul(.9478672986).add(.0521327014).pow(2.4),t=i.mul(.0773993808),n=i.lessThanEqual(.04045);return Qn(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Cie=me(([i])=>{let e=i.pow(.41666).mul(1.055).sub(.055),t=i.mul(12.92),n=i.lessThanEqual(.0031308);return Qn(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),zz="WorkingColorSpace",lEe="OutputColorSpace",vS=class extends Ir{static get type(){return"ColorSpaceNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this.source=t,this.target=n}resolveColorSpace(e,t){return t===zz?ln.workingColorSpace:t===lEe?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){let{colorNode:t}=this,n=this.resolveColorSpace(e,this.source),r=this.resolveColorSpace(e,this.target),s=t;return ln.enabled===!1||n===r||!n||!r||(ln.getTransfer(n)===kt&&(s=Ft(Mie(s.rgb),s.a)),ln.getPrimaries(n)!==ln.getPrimaries(r)&&(s=Ft(To(ln._getMatrix(new Mn,n,r)).mul(s.rgb),s.a)),ln.getTransfer(r)===kt&&(s=Ft(Cie(s.rgb),s.a))),s}},Rie=(i,e)=>new vS(Ht(i),zz,e),II=(i,e)=>new vS(Ht(i),e,zz),cEe=(i,e,t)=>new vS(Ht(i),e,t);Ue("workingToColorSpace",Rie);Ue("colorSpaceToWorking",II);var uEe=class extends Jd{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),n=this.referenceNode.getNodeType(),r=this.getNodeType();return e.format(t,n,r)}},g4=class extends Kt{static get type(){return"ReferenceBaseNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.updateType=yn.OBJECT}setGroup(e){return this.group=e,this}element(e){return new uEe(this,Ht(e))}setNodeType(e){let t=Xt(null,e);this.group!==null&&t.setGroup(this.group),this.node=t}generateNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,n=e[t[0]];for(let r=1;r<t.length;r++)n=n[t[r]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}},hEe=(i,e,t)=>new g4(i,e,t),OU=class extends g4{static get type(){return"RendererReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.renderer=n,this.setGroup(Jt)}updateReference(e){return this.reference=this.renderer!==null?this.renderer:e.renderer,this.reference}},Iie=(i,e,t=null)=>new OU(i,e,t),UU=class extends Ir{static get type(){return"ToneMappingNode"}constructor(e,t=Lie,n=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return sS(this._toneMapping)}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup(e){let t=this.colorNode||e.context.color,n=this._toneMapping;if(n===ao)return t;let r=null,s=e.renderer.library.getToneMappingFunction(n);return s!==null?r=Ft(s(t.rgb,this.exposureNode),t.a):(ze("ToneMappingNode: Unsupported Tone Mapping configuration.",n),r=t),r}},Pie=(i,e,t)=>new UU(i,Ht(e),Ht(t)),Lie=Iie("toneMappingExposure","float");Ue("toneMapping",(i,e,t)=>Pie(e,t,i));var Gee=new WeakMap;function qee(i,e){let t=Gee.get(i);return t===void 0&&(t=new Ld(i,e),Gee.set(i,t)),t}var gf=class extends pS{static get type(){return"BufferAttributeNode"}constructor(e,t=null,n=0,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=n,this.bufferOffset=r,this.usage=r0,this.instanced=!1,this.attribute=null,this.global=!0,e&&e.isBufferAttribute===!0&&e.itemSize<=4&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){let t;if(this.bufferStride===0&&this.bufferOffset===0){let n=e.globalCache.getData(this.value);n===void 0&&(n={node:this},e.globalCache.setData(this.value,n)),t=n.node.id}else t=this.id;return String(t)}generateNodeType(e){return this.bufferType===null&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(this.attribute!==null)return;let t=this.getNodeType(e),n=e.getTypeLength(t),r=this.value,s=this.bufferStride||n,o=this.bufferOffset,a;r.isInterleavedBuffer===!0?a=r:r.isBufferAttribute===!0?a=qee(r.array,s):a=qee(r,s);let l=new Vo(a,n,o);a.setUsage(this.usage),this.attribute=l,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){let t=this.getNodeType(e),n=e.context.nodeName;n!==void 0&&delete e.context.nodeName;let r=e.getBufferAttributeFromNode(this,t,n),s=e.getPropertyName(r),o=null;if(e.shaderStage==="vertex"||e.shaderStage==="compute")this.name=s,o=s;else{let a;n&&(a=n+"Varying"),o=bm(this,a).build(e,t)}return o}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&this.attribute.isBufferAttribute===!0&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}};function PI(i,e=null,t=0,n=0,r=r0,s=!1){return e==="mat3"||e===null&&i.itemSize===9?To(new gf(i,"vec3",9,0).setUsage(r).setInstanced(s),new gf(i,"vec3",9,3).setUsage(r).setInstanced(s),new gf(i,"vec3",9,6).setUsage(r).setInstanced(s)):e==="mat4"||e===null&&i.itemSize===16?mm(new gf(i,"vec4",16,0).setUsage(r).setInstanced(s),new gf(i,"vec4",16,4).setUsage(r).setInstanced(s),new gf(i,"vec4",16,8).setUsage(r).setInstanced(s),new gf(i,"vec4",16,12).setUsage(r).setInstanced(s)):new gf(i,e,t,n).setUsage(r)}var Vz=(i,e=null,t=0,n=0)=>PI(i,e,t,n),fEe=(i,e=null,t=0,n=0)=>PI(i,e,t,n,fg),LI=(i,e=null,t=0,n=0)=>PI(i,e,t,n,r0,!0),Gz=(i,e=null,t=0,n=0)=>PI(i,e,t,n,fg,!0);Ue("toAttribute",i=>Vz(i.value));var Ys=class i extends Kt{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){let t=this.getNodeType(e),n=this.scope,r;if(n===i.VERTEX)r=e.getVertexIndex();else if(n===i.INSTANCE)r=e.getInstanceIndex();else if(n===i.DRAW)r=e.getDrawIndex();else if(n===i.INVOCATION_LOCAL)r=e.getInvocationLocalIndex();else if(n===i.INVOCATION_SUBGROUP)r=e.getInvocationSubgroupIndex();else if(n===i.SUBGROUP)r=e.getSubgroupIndex();else throw new Error("THREE.IndexNode: Unknown scope: "+n);let s;return e.shaderStage==="vertex"||e.shaderStage==="compute"?s=r:s=bm(this).build(e,t),s}};Ys.VERTEX="vertex";Ys.INSTANCE="instance";Ys.SUBGROUP="subgroup";Ys.INVOCATION_LOCAL="invocationLocal";Ys.INVOCATION_SUBGROUP="invocationSubgroup";Ys.DRAW="draw";var Die=xt(Ys,Ys.VERTEX),Ku=xt(Ys,Ys.INSTANCE),dEe=xt(Ys,Ys.SUBGROUP),pEe=xt(Ys,Ys.INVOCATION_SUBGROUP),mEe=xt(Ys,Ys.INVOCATION_LOCAL),Nie=xt(Ys,Ys.DRAW),kU=class extends Kt{static get type(){return"ComputeNode"}constructor(e,t){super("void"),this.isComputeNode=!0,this.computeNode=e,this.workgroupSize=t,this.count=null,this.dispatchSize=null,this.version=1,this.name="",this.updateBeforeType=yn.OBJECT,this.onInitFunction=null,this.countNode=null}dispose(){this.dispatchEvent({type:"dispose"})}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.',new ts),this.setName(e)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}setup(e){this.count!==null&&this.countNode===null&&(this.countNode=Xt(this.count,"uint").onObjectUpdate(()=>this.count));let t=this.computeNode.build(e);if(t){let n=e.getNodeProperties(this);n.outputComputeNode=t.outputNode,t.outputNode=null}return t}generate(e,t){let{shaderStage:n}=e;if(n==="compute"){let r=this.computeNode.build(e,"void");if(r!==""&&e.addLineFlowCode(r,this),this.count!==null&&e.allowEarlyReturns===!0){let s=this.countNode.build(e,"uint"),o=Ku.build(e,"uint");e.flow.code=`${e.tab}if ( ${o} >= ${s} ) { return; }4146+`);return e.format(u,n,t)}},xa=$n(NU).setParameterLength(2,3);Ue("select",xa);var pS=class extends Kt{static get type(){return"ContextNode"}constructor(e=null,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}generateNodeType(e){return this.node.getNodeType(e)}getFlowContextData(){let e=[];return this.traverse(t=>{t.isContextNode===!0&&e.push(t.value)}),Object.assign({},...e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}setup(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}generate(e,t){let n=e.addContext(this.value),r=this.node.build(e,t);return e.setContext(n),r}},ep=(i=null,e={})=>{let t=i;return(t===null||t.isNode!==!0)&&(e=t||e,t=null),new pS(t,e)},mie=i=>ep(i,{uniformFlow:!0}),Uz=(i,e)=>ep(i,{nodeName:e});function Aie(i,e,t=null){return ep(t,{getShadow:({light:n,shadowColorNode:r})=>e===n?r.mul(i):r})}function gie(i,e=null){return ep(e,{getAO:(t,{material:n})=>n.transparent===!0?t:t!==null?t.mul(i):i})}function vie(i,e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.'),Uz(i,e)}Ue("context",ep);Ue("label",vie);Ue("uniformFlow",mie);Ue("setName",Uz);Ue("builtinShadowContext",(i,e,t)=>Aie(e,t,i));Ue("builtinAOContext",(i,e)=>gie(e,i));var ax=class extends Kt{static get type(){return"VarNode"}constructor(e,t=null,n=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=n,this.parents=!0,this.intent=!1}setIntent(e){return this.intent=e,this}isIntent(e){return e.getDataFromNode(this).forceDeclaration===!0?!1:this.intent}getIntent(){return this.intent}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}generateNodeType(e){return this.node.getNodeType(e)}getArrayCount(e){return this.node.getArrayCount(e)}isAssign(e){return e.getDataFromNode(this).assign}build(...e){let t=e[0],n=this.getShared(t);if(this!==n)return n.build(...e);if(this._hasStack(t)===!1&&t.buildStage==="setup"&&(t.context.nodeLoop||t.context.nodeBlock)){let r=!1;if(this.node.isShaderCallNodeInternal&&this.node.shaderNode.getLayout()===null&&t.fnCall&&t.fnCall.shaderNode&&t.getDataFromNode(this.node.shaderNode).hasLoop){let a=t.getDataFromNode(this);a.forceDeclaration=!0,r=!0}let s=t.getBaseStack();r?s.addToStackBefore(this):s.addToStack(this)}return this.isIntent(t)&&this.isAssign(t)!==!0?this.node.build(...e):super.build(...e)}generate(e){let{node:t,name:n,readOnly:r}=this,{renderer:s}=e,o=s.backend.isWebGPUBackend===!0,a=!1,l=!1;r&&(a=e.isDeterministic(t),l=o?r:a);let c=this.getNodeType(e);if(c=="void")return this.isIntent(e)!==!0&&ze('TSL: ".toVar()" can not be used with void type.',this.stackTrace),t.build(e);let u=e.getVectorType(c),f=t.build(e,u),d=e.getVarFromNode(this,n,u,void 0,l),A=e.getPropertyName(d),y=A;if(l)if(o)y=a?`const ${A}`:`let ${A}`;else{let w=t.getArrayCount(e);y=`const ${e.getVar(d.type,A,w)}`}return e.addLineFlowCode(`${y} = ${f}`,this),A}_hasStack(e){return e.getDataFromNode(this).stack!==void 0}},kz=$n(ax),_ie=(i,e=null)=>kz(i,e).toStack(),xie=(i,e=null)=>kz(i,e,!0).toStack(),yie=i=>kz(i).setIntent(!0).toStack();Ue("toVar",_ie);Ue("toConst",xie);Ue("toVarIntent",yie);var FU=class extends Kt{static get type(){return"SubBuild"}constructor(e,t,n=null){super(n),this.node=e,this.name=t,this.isSubBuildNode=!0}generateNodeType(e){if(this.nodeType!==null)return this.nodeType;e.addSubBuild(this.name);let t=this.node.getNodeType(e);return e.removeSubBuild(),t}build(e,...t){e.addSubBuild(this.name);let n=this.node.build(e,...t);return e.removeSubBuild(),n}},$g=(i,e,t=null)=>new FU(Ht(i),e,t),BU=class extends Kt{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=$g(e,"VERTEX"),this.name=t,this.isVaryingNode=!0,this.interpolationType=null,this.interpolationSampling=null,this.global=!0}setInterpolation(e,t=null){return this.interpolationType=e,this.interpolationSampling=t,this}getHash(e){return this.name||super.getHash(e)}generateNodeType(e){return this.node.getNodeType(e)}setupVarying(e){let t=e.getNodeProperties(this),n=t.varying;if(n===void 0){let r=this.name,s=this.getNodeType(e),o=this.interpolationType,a=this.interpolationSampling;t.varying=n=e.getVaryingFromNode(this,r,s,o,a),t.node=$g(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(ex.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(ex.VERTEX,this.node)}generate(e){let t=e.getSubBuildProperty("property",e.currentStack),n=e.getNodeProperties(this),r=this.setupVarying(e);if(n[t]===void 0){let s=this.getNodeType(e),o=e.getPropertyName(r,ex.VERTEX);if(e.shaderStage===ex.VERTEX){let a=n.node.build(e,s);e.addLineFlowCode(`${o} = ${a}`,this)}else e.flowNodeFromShaderStage(ex.VERTEX,n.node,s,o);n[t]=o}return e.getPropertyName(r)}},ym=$n(BU).setParameterLength(1,2),bie=i=>ym(i);Ue("toVarying",ym);Ue("toVertexStage",bie);var wie=me(([i])=>{let e=i.mul(.9478672986).add(.0521327014).pow(2.4),t=i.mul(.0773993808),n=i.lessThanEqual(.04045);return Qn(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Sie=me(([i])=>{let e=i.pow(.41666).mul(1.055).sub(.055),t=i.mul(12.92),n=i.lessThanEqual(.0031308);return Qn(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),zz="WorkingColorSpace",sEe="OutputColorSpace",mS=class extends Rr{static get type(){return"ColorSpaceNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this.source=t,this.target=n}resolveColorSpace(e,t){return t===zz?ln.workingColorSpace:t===sEe?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){let{colorNode:t}=this,n=this.resolveColorSpace(e,this.source),r=this.resolveColorSpace(e,this.target),s=t;return ln.enabled===!1||n===r||!n||!r||(ln.getTransfer(n)===kt&&(s=Ft(wie(s.rgb),s.a)),ln.getPrimaries(n)!==ln.getPrimaries(r)&&(s=Ft(To(ln._getMatrix(new Mn,n,r)).mul(s.rgb),s.a)),ln.getTransfer(r)===kt&&(s=Ft(Sie(s.rgb),s.a))),s}},Tie=(i,e)=>new mS(Ht(i),zz,e),TP=(i,e)=>new mS(Ht(i),e,zz),oEe=(i,e,t)=>new mS(Ht(i),e,t);Ue("workingToColorSpace",Tie);Ue("colorSpaceToWorking",TP);var aEe=class extends Zd{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),n=this.referenceNode.getNodeType(),r=this.getNodeType();return e.format(t,n,r)}},f4=class extends Kt{static get type(){return"ReferenceBaseNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.updateType=yn.OBJECT}setGroup(e){return this.group=e,this}element(e){return new aEe(this,Ht(e))}setNodeType(e){let t=Xt(null,e);this.group!==null&&t.setGroup(this.group),this.node=t}generateNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,n=e[t[0]];for(let r=1;r<t.length;r++)n=n[t[r]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}},lEe=(i,e,t)=>new f4(i,e,t),OU=class extends f4{static get type(){return"RendererReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.renderer=n,this.setGroup(Jt)}updateReference(e){return this.reference=this.renderer!==null?this.renderer:e.renderer,this.reference}},Eie=(i,e,t=null)=>new OU(i,e,t),UU=class extends Rr{static get type(){return"ToneMappingNode"}constructor(e,t=Cie,n=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return nS(this._toneMapping)}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup(e){let t=this.colorNode||e.context.color,n=this._toneMapping;if(n===ao)return t;let r=null,s=e.renderer.library.getToneMappingFunction(n);return s!==null?r=Ft(s(t.rgb,this.exposureNode),t.a):(ze("ToneMappingNode: Unsupported Tone Mapping configuration.",n),r=t),r}},Mie=(i,e,t)=>new UU(i,Ht(e),Ht(t)),Cie=Eie("toneMappingExposure","float");Ue("toneMapping",(i,e,t)=>Mie(e,t,i));var Uee=new WeakMap;function kee(i,e){let t=Uee.get(i);return t===void 0&&(t=new Rd(i,e),Uee.set(i,t)),t}var df=class extends hS{static get type(){return"BufferAttributeNode"}constructor(e,t=null,n=0,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=n,this.bufferOffset=r,this.usage=i0,this.instanced=!1,this.attribute=null,this.global=!0,e&&e.isBufferAttribute===!0&&e.itemSize<=4&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){let t;if(this.bufferStride===0&&this.bufferOffset===0){let n=e.globalCache.getData(this.value);n===void 0&&(n={node:this},e.globalCache.setData(this.value,n)),t=n.node.id}else t=this.id;return String(t)}generateNodeType(e){return this.bufferType===null&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(this.attribute!==null)return;let t=this.getNodeType(e),n=e.getTypeLength(t),r=this.value,s=this.bufferStride||n,o=this.bufferOffset,a;r.isInterleavedBuffer===!0?a=r:r.isBufferAttribute===!0?a=kee(r.array,s):a=kee(r,s);let l=new Vo(a,n,o);a.setUsage(this.usage),this.attribute=l,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){let t=this.getNodeType(e),n=e.context.nodeName;n!==void 0&&delete e.context.nodeName;let r=e.getBufferAttributeFromNode(this,t,n),s=e.getPropertyName(r),o=null;if(e.shaderStage==="vertex"||e.shaderStage==="compute")this.name=s,o=s;else{let a;n&&(a=n+"Varying"),o=ym(this,a).build(e,t)}return o}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&this.attribute.isBufferAttribute===!0&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}};function EP(i,e=null,t=0,n=0,r=i0,s=!1){return e==="mat3"||e===null&&i.itemSize===9?To(new df(i,"vec3",9,0).setUsage(r).setInstanced(s),new df(i,"vec3",9,3).setUsage(r).setInstanced(s),new df(i,"vec3",9,6).setUsage(r).setInstanced(s)):e==="mat4"||e===null&&i.itemSize===16?pm(new df(i,"vec4",16,0).setUsage(r).setInstanced(s),new df(i,"vec4",16,4).setUsage(r).setInstanced(s),new df(i,"vec4",16,8).setUsage(r).setInstanced(s),new df(i,"vec4",16,12).setUsage(r).setInstanced(s)):new df(i,e,t,n).setUsage(r)}var Vz=(i,e=null,t=0,n=0)=>EP(i,e,t,n),cEe=(i,e=null,t=0,n=0)=>EP(i,e,t,n,hg),MP=(i,e=null,t=0,n=0)=>EP(i,e,t,n,i0,!0),Gz=(i,e=null,t=0,n=0)=>EP(i,e,t,n,hg,!0);Ue("toAttribute",i=>Vz(i.value));var $s=class i extends Kt{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){let t=this.getNodeType(e),n=this.scope,r;if(n===i.VERTEX)r=e.getVertexIndex();else if(n===i.INSTANCE)r=e.getInstanceIndex();else if(n===i.DRAW)r=e.getDrawIndex();else if(n===i.INVOCATION_LOCAL)r=e.getInvocationLocalIndex();else if(n===i.INVOCATION_SUBGROUP)r=e.getInvocationSubgroupIndex();else if(n===i.SUBGROUP)r=e.getSubgroupIndex();else throw new Error("THREE.IndexNode: Unknown scope: "+n);let s;return e.shaderStage==="vertex"||e.shaderStage==="compute"?s=r:s=ym(this).build(e,t),s}};$s.VERTEX="vertex";$s.INSTANCE="instance";$s.SUBGROUP="subgroup";$s.INVOCATION_LOCAL="invocationLocal";$s.INVOCATION_SUBGROUP="invocationSubgroup";$s.DRAW="draw";var Rie=xt($s,$s.VERTEX),Xu=xt($s,$s.INSTANCE),uEe=xt($s,$s.SUBGROUP),hEe=xt($s,$s.INVOCATION_SUBGROUP),fEe=xt($s,$s.INVOCATION_LOCAL),Pie=xt($s,$s.DRAW),kU=class extends Kt{static get type(){return"ComputeNode"}constructor(e,t){super("void"),this.isComputeNode=!0,this.computeNode=e,this.workgroupSize=t,this.count=null,this.dispatchSize=null,this.version=1,this.name="",this.updateBeforeType=yn.OBJECT,this.onInitFunction=null,this.countNode=null}dispose(){this.dispatchEvent({type:"dispose"})}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.',new ts),this.setName(e)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}setup(e){this.count!==null&&this.countNode===null&&(this.countNode=Xt(this.count,"uint").onObjectUpdate(()=>this.count));let t=this.computeNode.build(e);if(t){let n=e.getNodeProperties(this);n.outputComputeNode=t.outputNode,t.outputNode=null}return t}generate(e,t){let{shaderStage:n}=e;if(n==="compute"){let r=this.computeNode.build(e,"void");if(r!==""&&e.addLineFlowCode(r,this),this.count!==null&&e.allowEarlyReturns===!0){let s=this.countNode.build(e,"uint"),o=Xu.build(e,"uint");e.flow.code=`${e.tab}if ( ${o} >= ${s} ) { return; }41474147 4148-${e.flow.code}`}}else{let s=e.getNodeProperties(this).outputComputeNode;if(s)return s.build(e,t)}}},qz=(i,e=[64])=>{(e.length===0||e.length>3)&&ze("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new ts);for(let t=0;t<e.length;t++){let n=e[t];(typeof n!="number"||n<=0||!Number.isInteger(n))&&ze(`TSL: compute() workgroupSize element at index [ ${t} ] must be a positive integer`,new ts)}for(;e.length<3;)e.push(1);return new kU(Ht(i),e)},Fie=(i,e,t)=>{let n=qz(i,t);return typeof e=="number"?n.count=e:n.dispatchSize=e,n};Ue("compute",Fie);Ue("computeKernel",qz);var zU=class extends Kt{static get type(){return"IsolateNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isIsolateNode=!0}generateNodeType(e){let t=e.getCache(),n=e.getCacheFromNode(this,this.parent);e.setCache(n);let r=this.node.getNodeType(e);return e.setCache(t),r}build(e,...t){let n=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);let s=this.node.build(e,...t);return e.setCache(n),s}setParent(e){return this.parent=e,this}getParent(){return this.parent}},ux=i=>new zU(Ht(i));function Bie(i,e=!0){return Xe('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),ux(i).setParent(e)}Ue("cache",Bie);Ue("isolate",ux);var VU=class extends Kt{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}generateNodeType(e){return this.outputNode.getNodeType(e)}generate(e){let t=this.callNode.build(e,"void");return t!==""&&e.addLineFlowCode(t,this),this.outputNode.build(e)}},Oie=$n(VU).setParameterLength(2);Ue("bypass",Oie);var Hz=me(([i,e,t,n=oe(0),r=oe(1),s=mc(!1)])=>{let o=i.sub(e).div(t.sub(e));return dx(s)&&(o=o.clamp()),o.mul(r.sub(n)).add(n)});function Uie(i,e,t,n=oe(0),r=oe(1)){return Hz(i,e,t,n,r,!0)}Ue("remap",Hz);Ue("remapClamp",Uie);var hx=class extends Kt{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){let n=this.getNodeType(e),r=this.snippet;if(n==="void")e.addLineFlowCode(r,this);else return e.format(r,n,t)}},dc=$n(hx).setParameterLength(1,2),kie=i=>(i?xa(i,dc("discard")):dc("discard")).toStack(),AEe=()=>dc("return").toStack();Ue("discard",kie);var Wz=me(([i])=>Ft(i.rgb.mul(i.a),i.a),{color:"vec4",return:"vec4"}),zie=me(([i])=>i.a.equal(0).select(Ft(0),Ft(i.rgb.div(i.a),i.a)),{color:"vec4",return:"vec4"}),GU=class extends Ir{static get type(){return"RenderOutputNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this._toneMapping=t,this.outputColorSpace=n,this.isRenderOutputNode=!0}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup({context:e}){let t=this.colorNode||e.color;t=Ft(t.rgb,t.a.clamp(0,1)),t=zie(t);let n=(this._toneMapping!==null?this._toneMapping:e.toneMapping)||ao,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||ha;return n!==ao&&(t=t.toneMapping(n)),r!==ha&&r!==ln.workingColorSpace&&(t=t.workingToColorSpace(r)),t=Wz(t),t}},jz=(i,e=null,t=null)=>new GU(Ht(i),e,t);Ue("renderOutput",jz);var qU=class extends Ir{static get type(){return"DebugNode"}constructor(e,t=null){super(),this.node=e,this.callback=t}generateNodeType(e){return this.node.getNodeType(e)}setup(e){return this.node.build(e)}analyze(e){return this.node.build(e)}generate(e){let t=this.callback,n=this.node.build(e);if(t!==null)t(e,n);else{let r="--- TSL debug - "+e.shaderStage+" shader ---",s="-".repeat(r.length),o="";o+="// #"+r+`#4148+${e.flow.code}`}}else{let s=e.getNodeProperties(this).outputComputeNode;if(s)return s.build(e,t)}}},qz=(i,e=[64])=>{(e.length===0||e.length>3)&&ze("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new ts);for(let t=0;t<e.length;t++){let n=e[t];(typeof n!="number"||n<=0||!Number.isInteger(n))&&ze(`TSL: compute() workgroupSize element at index [ ${t} ] must be a positive integer`,new ts)}for(;e.length<3;)e.push(1);return new kU(Ht(i),e)},Iie=(i,e,t)=>{let n=qz(i,t);return typeof e=="number"?n.count=e:n.dispatchSize=e,n};Ue("compute",Iie);Ue("computeKernel",qz);var zU=class extends Kt{static get type(){return"IsolateNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isIsolateNode=!0}generateNodeType(e){let t=e.getCache(),n=e.getCacheFromNode(this,this.parent);e.setCache(n);let r=this.node.getNodeType(e);return e.setCache(t),r}build(e,...t){let n=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);let s=this.node.build(e,...t);return e.setCache(n),s}setParent(e){return this.parent=e,this}getParent(){return this.parent}},lx=i=>new zU(Ht(i));function Lie(i,e=!0){return Xe('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),lx(i).setParent(e)}Ue("cache",Lie);Ue("isolate",lx);var VU=class extends Kt{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}generateNodeType(e){return this.outputNode.getNodeType(e)}generate(e){let t=this.callNode.build(e,"void");return t!==""&&e.addLineFlowCode(t,this),this.outputNode.build(e)}},Die=$n(VU).setParameterLength(2);Ue("bypass",Die);var Hz=me(([i,e,t,n=oe(0),r=oe(1),s=dc(!1)])=>{let o=i.sub(e).div(t.sub(e));return hx(s)&&(o=o.clamp()),o.mul(r.sub(n)).add(n)});function Nie(i,e,t,n=oe(0),r=oe(1)){return Hz(i,e,t,n,r,!0)}Ue("remap",Hz);Ue("remapClamp",Nie);var cx=class extends Kt{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){let n=this.getNodeType(e),r=this.snippet;if(n==="void")e.addLineFlowCode(r,this);else return e.format(r,n,t)}},hc=$n(cx).setParameterLength(1,2),Fie=i=>(i?xa(i,hc("discard")):hc("discard")).toStack(),dEe=()=>hc("return").toStack();Ue("discard",Fie);var Wz=me(([i])=>Ft(i.rgb.mul(i.a),i.a),{color:"vec4",return:"vec4"}),Bie=me(([i])=>i.a.equal(0).select(Ft(0),Ft(i.rgb.div(i.a),i.a)),{color:"vec4",return:"vec4"}),GU=class extends Rr{static get type(){return"RenderOutputNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this._toneMapping=t,this.outputColorSpace=n,this.isRenderOutputNode=!0}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup({context:e}){let t=this.colorNode||e.color;t=Ft(t.rgb,t.a.clamp(0,1)),t=Bie(t);let n=(this._toneMapping!==null?this._toneMapping:e.toneMapping)||ao,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||ha;return n!==ao&&(t=t.toneMapping(n)),r!==ha&&r!==ln.workingColorSpace&&(t=t.workingToColorSpace(r)),t=Wz(t),t}},jz=(i,e=null,t=null)=>new GU(Ht(i),e,t);Ue("renderOutput",jz);var qU=class extends Rr{static get type(){return"DebugNode"}constructor(e,t=null){super(),this.node=e,this.callback=t}generateNodeType(e){return this.node.getNodeType(e)}setup(e){return this.node.build(e)}analyze(e){return this.node.build(e)}generate(e){let t=this.callback,n=this.node.build(e);if(t!==null)t(e,n);else{let r="--- TSL debug - "+e.shaderStage+" shader ---",s="-".repeat(r.length),o="";o+="// #"+r+`#41494149 `,o+=e.flow.code.replace(/^\t/mg,"")+`41504150 `,o+="/* ... */ "+n+` /* ... */41514151 `,o+="// #"+s+`#4152-`,zA(o)}return n}},Vie=(i,e=null)=>new qU(Ht(i),e).toStack();Ue("debug",Vie);var v4=class extends ca{constructor(){super(),this._renderer=null,this.currentFrame=null}get nodeFrame(){return this._renderer._nodes.nodeFrame}setRenderer(e){return this._renderer=e,this}getRenderer(){return this._renderer}init(){}begin(){}finish(){}inspect(){}computeAsync(){}beginCompute(){}finishCompute(){}beginRender(){}finishRender(){}copyTextureToTexture(){}copyFramebufferToTexture(){}},HU=class extends Kt{static get type(){return"InspectorNode"}constructor(e,t="",n=null){super(),this.node=e,this.name=t,this.callback=n,this.updateType=yn.FRAME,this.isInspectorNode=!0}getName(){return this.name||this.node.name}update(e){e.renderer.inspector.inspect(this)}generateNodeType(e){return this.node.getNodeType(e)}setup(e){let t=this.node;return e.context.inspector===!0&&this.callback!==null&&(t=this.callback(t)),e.renderer.backend.isWebGPUBackend!==!0&&e.renderer.inspector.constructor!==v4&&ni('TSL: ".toInspector()" is only available with WebGPU.'),t}};function Gie(i,e="",t=null){return i=Ht(i),i.before(new HU(i,e,t))}Ue("toInspector",Gie);function gEe(i){Xe("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",i)}var _4=class extends Kt{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}generateNodeType(e){let t=this.nodeType;if(t===null){let n=this.getAttributeName(e);if(e.hasGeometryAttribute(n)){let r=e.geometry.getAttribute(n);t=e.getTypeFromAttribute(r)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){let t=this.getAttributeName(e),n=this.getNodeType(e);if(e.hasGeometryAttribute(t)===!0){let s=e.geometry.getAttribute(t),o=e.getTypeFromAttribute(s),a=e.getAttribute(t,o);return e.shaderStage==="vertex"?e.format(a.name,o,n):bm(this).build(e,n)}else return Xe(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(n)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}},pc=(i,e=null)=>new _4(i,e),Ui=(i=0)=>pc("uv"+(i>0?i:""),"vec2"),WU=class extends Kt{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){let n=this.textureNode.build(e,"property"),r=this.levelNode===null?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${n}, ${r} )`,this.getNodeType(e),t)}},t1=$n(WU).setParameterLength(1,2),jU=class extends Jg{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=yn.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){let e=this.texture,t=e.images,n=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(n&&n.width!==void 0){let{width:r,height:s}=n;this.value=Math.log2(Math.max(r,s))}}},Xz=$n(jU).setParameterLength(1),x4=class extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}},$z=new Hs,cu=class extends Jg{static get type(){return"TextureNode"}constructor(e=$z,t=null,n=null,r=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=n,this.biasNode=r,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.gatherNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=yn.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this._flipYUniform=null,this.setUpdateMatrix(t===null)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}generateNodeType(){return this.value.isDepthTexture===!0?this.gatherNode===null?"float":"vec4":this.value.type===xi?"uvec4":this.value.type===Kr?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return Ui(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=Xt(this.value.matrix)),this._matrixUniform.mul(pe(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this}setupUV(e,t){return e.isFlipY()&&(this._flipYUniform===null&&(this._flipYUniform=Xt(!1)),t=t.toVar(),this.sampler?t=this._flipYUniform.select(t.flipY(),t):t=this._flipYUniform.select(t.setY(de(t1(this,this.levelNode).y).sub(t.y).sub(1)),t)),t}setup(e){let t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;let n=this.value;if(!n||n.isTexture!==!0)throw new x4("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().",this.stackTrace);let r=me(()=>{let l=this.uvNode;return(l===null||e.context.forceUVContext===!0)&&e.context.getUV&&(l=e.context.getUV(this,e)),l||(l=this.getDefaultUV()),this.updateMatrix===!0&&(l=this.getTransformedUV(l)),l=this.setupUV(e,l),this.updateType=this._matrixUniform!==null||this._flipYUniform!==null?yn.OBJECT:yn.NONE,l})(),s=this.levelNode;s===null&&e.context.getTextureLevel&&(s=e.context.getTextureLevel(this));let o=null,a=null;if(this.compareNode!==null)if(e.renderer.hasCompatibility(kd.TEXTURE_COMPARE))o=this.compareNode;else{let l=n.compareFunction;l===null||l===d_||l===Kh||l===hg||l===ku?a=this.compareNode:(o=this.compareNode,ni('TSL: Only "LessCompare", "LessEqualCompare", "GreaterCompare" and "GreaterEqualCompare" are supported for depth texture comparison fallback.'))}t.uvNode=r,t.levelNode=s,t.biasNode=this.biasNode,t.compareNode=o,t.compareStepNode=a,t.gradNode=this.gradNode,t.gatherNode=this.gatherNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,this.sampler===!0?"vec2":"ivec2")}generateOffset(e,t){return t.build(e,"ivec2")}generateSnippet(e,t,n,r,s,o,a,l,c,u,f){let d=this.value,A;return s?A=e.generateTextureBias(d,t,n,s,o,u):l?A=e.generateTextureGrad(d,t,n,l,o,u):c?a?A=e.generateTextureGatherCompare(d,t,n,a,o,u,f):A=e.generateTextureGather(d,t,n,c,o,u,f):a?A=e.generateTextureCompare(d,t,n,a,o,u):this.sampler===!1?A=e.generateTextureLoad(d,t,n,r,o,u):r?A=e.generateTextureLevel(d,t,n,r,o,u):A=e.generateTexture(d,t,n,o,u),A}generate(e,t){let n=this.value,r=e.getNodeProperties(this),s=super.generate(e,"property");if(/^sampler/.test(t))return s+"_sampler";if(e.isReference(t))return s;{let o=e.getDataFromNode(this),a=this.getNodeType(e),l=o.propertyName;if(l===void 0){let{uvNode:u,levelNode:f,biasNode:d,compareNode:A,compareStepNode:y,depthNode:w,gradNode:S,gatherNode:T,offsetNode:R}=r,P=this.generateUV(e,u),I=f?f.build(e,"float"):null,F=d?d.build(e,"float"):null,D=w?w.build(e,"int"):null,L=A?A.build(e,"float"):null,C=y?y.build(e,"float"):null,B=S?[S[0].build(e,"vec2"),S[1].build(e,"vec2")]:null,k=T?T.build(e,"int"):null,z=R?this.generateOffset(e,R):null,G=this._flipYUniform?this._flipYUniform.build(e,"bool"):null;k&&(a="vec4");let W=D;W===null&&n.isArrayTexture&&this.isTexture3DNode!==!0&&(W="0");let Y=e.getVarFromNode(this);l=e.getPropertyName(Y);let H=this.generateSnippet(e,s,P,I,F,W,L,B,k,z,G);if(C!==null){let $=n.compareFunction;$===hg||$===ku?H=e1(dc(H,a),dc(C,"float")).build(e,a):H=e1(dc(C,"float"),dc(H,a)).build(e,a)}e.addLineFlowCode(`${l} = ${H}`,this),o.snippet=H,o.propertyName=l}let c=l;return e.needsToWorkingColorSpace(n)&&(c=II(dc(c,a),n.colorSpace).setup(e).build(e,a)),e.format(c,a,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}sample(e){let t=this.clone();return t.uvNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){let t=this.clone();t.biasNode=Ht(e).mul(Xz(t)),t.referenceNode=this.getBase();let n=t.value;return t.generateMipmaps===!1&&(n&&n.generateMipmaps===!1||n.minFilter===Ti||n.magFilter===Ti)&&(Xe("TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture."),t.biasNode=null),Ht(t)}level(e){let t=this.clone();return t.levelNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}size(e){return t1(this,e)}bias(e){let t=this.clone();return t.biasNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){let t=this.clone();return t.compareNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}grad(e,t){let n=this.clone();return n.gradNode=[Ht(e),Ht(t)],n.referenceNode=this.getBase(),Ht(n)}gather(e=0){let t=this.clone();return t.gatherNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}depth(e){let t=this.clone();return t.depthNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}offset(e){let t=this.clone();return t.offsetNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){let e=this.value,t=this._matrixUniform;t!==null&&(t.value=e.matrix),e.matrixAutoUpdate===!0&&e.updateMatrix();let n=this._flipYUniform;n!==null&&(n.value=e.image instanceof ImageBitmap&&e.flipY===!0||e.isRenderTargetTexture===!0||e.isFramebufferTexture===!0||e.isDepthTexture===!0)}clone(){let e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e}},vEe=$n(cu).setParameterLength(1,4).setName("texture"),fi=(i=$z,e=null,t=null,n=null)=>{let r;return i&&i.isTextureNode===!0?(r=Ht(i.clone()),r.referenceNode=i.getBase(),e!==null&&(r.uvNode=Ht(e)),t!==null&&(r.levelNode=Ht(t)),n!==null&&(r.biasNode=Ht(n))):r=vEe(i,e,t,n),r},_Ee=(i=$z)=>fi(i),xs=(...i)=>fi(...i).setSampler(!1),xEe=(i,e,t)=>fi(i,e).level(t),yEe=i=>(i.isNode===!0?i:fi(i)).convert("sampler"),bEe=i=>(i.isNode===!0?i:fi(i)).convert("samplerComparison"),_S=class extends Jg{static get type(){return"BufferNode"}constructor(e,t,n=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=n,this.updateRanges=[]}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}},Sx=(i,e,t)=>new _S(i,e,t),XU=class extends Jd{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){let t=super.generate(e),n=this.getNodeType(e),r=this.node.getPaddedType();return e.format(t,r,n)}},$U=class extends _S{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?dm(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=yn.RENDER,this.isArrayBufferNode=!0}generateNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){let e=this.elementType,t="vec4";return e==="mat2"?t="mat2":/mat/.test(e)===!0?t="mat4":e.charAt(0)==="i"?t="ivec4":e.charAt(0)==="u"&&(t="uvec4"),t}update(){let{array:e,value:t}=this,n=this.elementType;if(n==="float"||n==="int"||n==="uint")for(let r=0;r<e.length;r++){let s=r*4;t[s]=e[r]}else if(n==="color")for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.r,t[s+1]=o.g,t[s+2]=o.b||0}else if(n==="mat2")for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.elements[0],t[s+1]=o.elements[1],t[s+2]=o.elements[2],t[s+3]=o.elements[3]}else if(n==="mat3")for(let r=0;r<e.length;r++){let s=r*16,o=e[r];t[s]=o.elements[0],t[s+1]=o.elements[1],t[s+2]=o.elements[2],t[s+4]=o.elements[3],t[s+5]=o.elements[4],t[s+6]=o.elements[5],t[s+8]=o.elements[6],t[s+9]=o.elements[7],t[s+10]=o.elements[8],t[s+15]=1}else if(n==="mat4")for(let r=0;r<e.length;r++){let s=r*16,o=e[r];for(let a=0;a<o.elements.length;a++)t[s+a]=o.elements[a]}else for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.x,t[s+1]=o.y,t[s+2]=o.z||0,t[s+3]=o.w||0}}setup(e){let t=this.array.length,n=this.elementType,r=Float32Array,s=this.paddedType,o=e.getTypeLength(s);return n.charAt(0)==="i"&&(r=Int32Array),n.charAt(0)==="u"&&(r=Uint32Array),this.value=new r(t*o),this.bufferCount=t,this.bufferType=s,this.update(),super.setup(e)}element(e){return new XU(this,Ht(e))}},$o=(i,e)=>new $U(i,e),YU=class extends Kt{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}},rp=$n(YU).setParameterLength(1),kw,zw,Zo=class i extends Kt{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this._output=null,this.isViewportNode=!0}generateNodeType(){return this.scope===i.DPR?"float":this.scope===i.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=yn.NONE;return(this.scope===i.SIZE||this.scope===i.VIEWPORT||this.scope===i.DPR)&&(e=yn.RENDER),this.updateType=e,e}update({renderer:e}){let t=e.getRenderTarget();this.scope===i.VIEWPORT?t!==null?zw.copy(t.viewport):(e.getViewport(zw),zw.multiplyScalar(e.getPixelRatio())):this.scope===i.DPR?this._output.value=e.getPixelRatio():t!==null?(kw.width=t.width,kw.height=t.height):e.getDrawingBufferSize(kw)}setup(){let e=this.scope,t=null;return e===i.SIZE?t=Xt(kw||(kw=new Oe)):e===i.VIEWPORT?t=Xt(zw||(zw=new xn)):e===i.DPR?t=Xt(1):t=dt(h1.div(n1)),this._output=t,t}generate(e){if(this.scope===i.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){let n=e.getNodeProperties(n1).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}};Zo.COORDINATE="coordinate";Zo.VIEWPORT="viewport";Zo.SIZE="size";Zo.UV="uv";Zo.DPR="dpr";var Yz=xt(Zo,Zo.DPR),Zu=xt(Zo,Zo.UV),n1=xt(Zo,Zo.SIZE),h1=xt(Zo,Zo.COORDINATE),fx=xt(Zo,Zo.VIEWPORT),Zz=fx.zw,qie=h1.sub(fx.xy),wEe=qie.div(Zz),SEe=me(()=>(Xe('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new ts),n1),"vec2").once()(),BO=null,gR=null,OO=null,vR=null,UO=null,_R=null,kO=null,xR=null,zO=null,yR=null,VO=null,bR=null,GO=null,wR=null,wm=Xt(0,"uint").setName("u_cameraIndex").setGroup(SI("cameraIndex")).toVarying("v_cameraIndex"),cm=Xt("float").setName("cameraNear").setGroup(Jt).onRenderUpdate(({camera:i})=>i.near),um=Xt("float").setName("cameraFar").setGroup(Jt).onRenderUpdate(({camera:i})=>i.far),Ja=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrix);gR===null?gR=$o(t).setGroup(Jt).setName("cameraProjectionMatrices"):gR.array=t,e=gR.element(i.isMultiViewCamera?rp("gl_ViewID_OVR"):wm)}else BO===null&&(BO=Xt(i.projectionMatrix).setName("cameraProjectionMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.projectionMatrix)),e=BO;return e}).once()(),Hie=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrixInverse);vR===null?vR=$o(t).setGroup(Jt).setName("cameraProjectionMatricesInverse"):vR.array=t,e=vR.element(i.isMultiViewCamera?rp("gl_ViewID_OVR"):wm)}else OO===null&&(OO=Xt(i.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(Jt).onRenderUpdate(({camera:t})=>t.projectionMatrixInverse)),e=OO;return e}).once()(),Sm=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorldInverse);_R===null?_R=$o(t).setGroup(Jt).setName("cameraViewMatrices"):_R.array=t,e=_R.element(i.isMultiViewCamera?rp("gl_ViewID_OVR"):wm)}else UO===null&&(UO=Xt(i.matrixWorldInverse).setName("cameraViewMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.matrixWorldInverse)),e=UO;return e}).once()(),BS=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorld);xR===null?xR=$o(t).setGroup(Jt).setName("cameraWorldMatrices"):xR.array=t,e=xR.element(i.isMultiViewCamera?rp("gl_ViewID_OVR"):wm)}else kO===null&&(kO=Xt(i.matrixWorld).setName("cameraWorldMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.matrixWorld)),e=kO;return e}).once()(),TEe=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.normalMatrix);yR===null?yR=$o(t).setGroup(Jt).setName("cameraNormalMatrices"):yR.array=t,e=yR.element(i.isMultiViewCamera?rp("gl_ViewID_OVR"):wm)}else zO===null&&(zO=Xt(i.normalMatrix).setName("cameraNormalMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.normalMatrix)),e=zO;return e}).once()(),Wie=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n=0,r=i.cameras.length;n<r;n++)t.push(new re);bR===null?bR=$o(t).setGroup(Jt).setName("cameraPositions").onRenderUpdate(({camera:n},r)=>{let s=n.cameras,o=r.array;for(let a=0,l=s.length;a<l;a++)o[a].setFromMatrixPosition(s[a].matrixWorld)}):bR.array=t,e=bR.element(i.isMultiViewCamera?rp("gl_ViewID_OVR"):wm)}else VO===null&&(VO=Xt(new re).setName("cameraPosition").setGroup(Jt).onRenderUpdate(({camera:t},n)=>n.value.setFromMatrixPosition(t.matrixWorld))),e=VO;return e}).once()(),EEe=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.viewport);wR===null?wR=$o(t,"vec4").setGroup(Jt).setName("cameraViewports"):wR.array=t,e=wR.element(wm)}else GO===null&&(GO=Ft(0,0,n1.x,n1.y).toConst("cameraViewport")),e=GO;return e}).once()(),Hee=new bl,Ds=class i extends Kt{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=yn.OBJECT,this.uniformNode=new Jg(null)}generateNodeType(){let e=this.scope;if(e===i.WORLD_MATRIX)return"mat4";if(e===i.POSITION||e===i.VIEW_POSITION||e===i.DIRECTION||e===i.SCALE)return"vec3";if(e===i.RADIUS)return"float"}update(e){let t=this.object3d,n=this.uniformNode,r=this.scope;if(r===i.WORLD_MATRIX)n.value=t.matrixWorld;else if(r===i.POSITION)n.value=n.value||new re,n.value.setFromMatrixPosition(t.matrixWorld);else if(r===i.SCALE)n.value=n.value||new re,n.value.setFromMatrixScale(t.matrixWorld);else if(r===i.DIRECTION)n.value=n.value||new re,t.getWorldDirection(n.value);else if(r===i.VIEW_POSITION){let s=e.camera;n.value=n.value||new re,n.value.setFromMatrixPosition(t.matrixWorld),n.value.applyMatrix4(s.matrixWorldInverse)}else if(r===i.RADIUS){let s=e.object.geometry;s.boundingSphere===null&&s.computeBoundingSphere(),Hee.copy(s.boundingSphere).applyMatrix4(t.matrixWorld),n.value=Hee.radius}}generate(e){let t=this.scope;return t===i.WORLD_MATRIX?this.uniformNode.nodeType="mat4":t===i.POSITION||t===i.VIEW_POSITION||t===i.DIRECTION||t===i.SCALE?this.uniformNode.nodeType="vec3":t===i.RADIUS&&(this.uniformNode.nodeType="float"),this.uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}};Ds.WORLD_MATRIX="worldMatrix";Ds.POSITION="position";Ds.SCALE="scale";Ds.VIEW_POSITION="viewPosition";Ds.DIRECTION="direction";Ds.RADIUS="radius";var MEe=$n(Ds,Ds.DIRECTION).setParameterLength(1),CEe=$n(Ds,Ds.WORLD_MATRIX).setParameterLength(1),REe=$n(Ds,Ds.POSITION).setParameterLength(1),IEe=$n(Ds,Ds.SCALE).setParameterLength(1),PEe=$n(Ds,Ds.VIEW_POSITION).setParameterLength(1),LEe=$n(Ds,Ds.RADIUS).setParameterLength(1),Ll=class extends Ds{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}},DEe=xt(Ll,Ll.DIRECTION),su=xt(Ll,Ll.WORLD_MATRIX),NEe=xt(Ll,Ll.POSITION),FEe=xt(Ll,Ll.SCALE),BEe=xt(Ll,Ll.VIEW_POSITION),OEe=xt(Ll,Ll.RADIUS),jie=Xt(new Mn).onObjectUpdate(({object:i},e)=>e.value.getNormalMatrix(i.matrixWorld)),UEe=Xt(new cn).onObjectUpdate(({object:i},e)=>e.value.copy(i.matrixWorld).invert()),Ef=me(i=>i.context.modelViewMatrix||Xie).once()().toVar("modelViewMatrix"),Xie=Sm.mul(su),ZU=me(i=>(i.context.isHighPrecisionModelViewMatrix=!0,Xt("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),KU=me(i=>{let e=i.context.isHighPrecisionModelViewMatrix;return Xt("mat3").onObjectUpdate(({object:t,camera:n})=>(e!==!0&&t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),$ie=me(i=>i.shaderStage!=="fragment"?(ni("TSL: `clipSpace` is only available in fragment stage."),Ft()):i.context.clipSpace.toVarying("v_clipSpace")).once()(),va=pc("position","vec3"),Cr=va.toVarying("positionLocal"),i1=va.toVarying("positionPrevious"),wf=me(i=>su.mul(Cr).xyz.toVarying(i.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),Kz=me(()=>Cr.transformDirection(su).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),ys=me(i=>{if(i.shaderStage==="fragment"&&i.material.vertexNode){let e=Hie.mul($ie);return e.xyz.div(e.w).toVar("positionView")}return i.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),er=me(i=>{let e;return i.camera.isOrthographicCamera?e=pe(0,0,1):e=ys.negate().toVarying("v_positionViewDirection").normalize(),e.toVar("positionViewDirection")},"vec3").once(["POSITION"])(),QU=class extends Kt{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){if(e.shaderStage!=="fragment")return"true";let{material:t}=e;return t.side===mi?"false":e.getFrontFacing()}},Yie=xt(QU),Qz=oe(Yie).mul(2).sub(1),f1=me(([i],{material:e})=>{let t=e.side;return t===mi?i=i.mul(-1):t===vr&&(i=i.mul(Qz)),i}),kEe=i=>(ni('TSL: "directionToFaceDirection()" has been renamed to "negateOnBackSide()".'),f1(i)),DI=pc("normal","vec3"),wa=me(i=>i.geometry.hasAttribute("normal")===!1?(Xe('TSL: Vertex attribute "normal" not found on geometry.'),pe(0,1,0)):DI,"vec3").once()().toVar("normalLocal"),Zie=ys.dFdx().cross(ys.dFdy()).normalize().toVar("normalFlat"),mx=me(i=>{let e;return i.isFlatShading()?e=Zie:e=eV(wa).toVarying("v_normalViewGeometry").normalize(),e},"vec3").once()().toVar("normalViewGeometry"),Kie=me(i=>{let e=mx.transformNormalByInverseViewMatrix(Sm);return i.isFlatShading()!==!0&&(e=e.toVarying("v_normalWorldGeometry")),e.normalize().toVar("normalWorldGeometry")},"vec3").once()(),hi=me(i=>{let e;return i.subBuildFn==="NORMAL"||i.subBuildFn==="VERTEX"?(e=mx,i.isFlatShading()!==!0&&(e=f1(e))):e=i.context.setupNormal().context({getUV:null,getTextureLevel:null}),e},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),Tm=hi.transformNormalByInverseViewMatrix(Sm).toVar("normalWorld"),hm=me(({subBuildFn:i,context:e})=>{let t;return i==="NORMAL"||i==="VERTEX"?t=hi:t=e.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),Jz=me(([i,e=su])=>To(e).inverse().transpose().mul(i).normalize());Ue("transformNormal",Jz);var eV=me(([i],e)=>{let t=e.context.modelNormalViewMatrix;return t?i.transformNormalByViewMatrix(t):jie.mul(i).transformNormalByViewMatrix(Sm)}),zEe=me(()=>(Xe('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),hi)).once(["NORMAL","VERTEX"])(),VEe=me(()=>(Xe('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),Tm)).once(["NORMAL","VERTEX"])(),GEe=me(()=>(Xe('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),hm)).once(["NORMAL","VERTEX"])(),qO=new cn,Qie=Xt(0).onReference(({material:i})=>i).onObjectUpdate(({material:i})=>i.refractionRatio),t4=Xt(1).onReference(({material:i})=>i).onObjectUpdate(function({material:i,scene:e}){return i.envMap?i.envMapIntensity:e.environmentIntensity}),y4=Xt(new cn).onReference(function(i){return i.material}).onObjectUpdate(function({material:i,scene:e}){let n=(e.environment!==null||e.environmentNode&&e.environmentNode.isNode)&&i.envMap===null?e.environmentRotation:i.envMapRotation;return n?qO.makeRotationFromEuler(n).transpose():qO.identity(),qO}),Jie=er.negate().reflect(hi),ere=er.negate().refract(hi,Qie),tre=Jie.transformDirection(BS).toVar("reflectVector"),nre=ere.transformDirection(BS).toVar("refractVector"),ire=new Nh,JU=class extends cu{static get type(){return"CubeTextureNode"}constructor(e,t=null,n=null,r=null){super(e,t,n,r),this.isCubeTextureNode=!0}getInputType(){return this.value.isDepthTexture===!0?"cubeDepthTexture":"cubeTexture"}getDefaultUV(){let e=this.value;return e.mapping===nc?tre:e.mapping===jc?nre:(ze('CubeTextureNode: Mapping "%s" not supported.',e.mapping),pe(0,0,0))}setUpdateMatrix(){}setupUV(e,t){let n=this.value;return n.isDepthTexture===!0?e.renderer.coordinateSystem===yl?pe(t.x,t.y.negate(),t.z):t:(t=y4.mul(t),(e.renderer.coordinateSystem===yl||!n.isRenderTargetTexture)&&(t=pe(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}},tV=$n(JU).setParameterLength(1,4).setName("cubeTexture"),Qa=(i=ire,e=null,t=null,n=null)=>{let r;return i&&i.isCubeTextureNode===!0?(r=Ht(i.clone()),r.referenceNode=i,e!==null&&(r.uvNode=Ht(e)),t!==null&&(r.levelNode=Ht(t)),n!==null&&(r.biasNode=Ht(n))):r=tV(i,e,t,n),r},qEe=(i=ire)=>tV(i),e7=class extends Jd{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),n=this.referenceNode.getNodeType(e),r=this.getNodeType(e);return e.format(t,n,r)}},Ax=class extends Kt{static get type(){return"ReferenceNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.name=null,this.updateType=yn.OBJECT}element(e){return new e7(this,Ht(e))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setNodeType(e){let t=null;this.count!==null?t=Sx(null,e,this.count):Array.isArray(this.getValueFromReference())?(t=$o(null,e),t.updateType=yn.OBJECT):e==="texture"?t=fi(null):e==="cubeTexture"?t=Qa(null):t=Xt(null,e),this.group!==null&&t.setGroup(this.group),this.name!==null&&t.setName(this.name),this.node=t}generateNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,n=e[t[0]];for(let r=1;r<t.length;r++)n=n[t[r]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}},mr=(i,e,t)=>new Ax(i,e,t),rre=(i,e,t,n)=>new Ax(i,e,n,t),t7=class extends Ax{static get type(){return"MaterialReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.material=n,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=this.material!==null?this.material:e.material,this.reference}},Zd=(i,e,t=null)=>new t7(i,e,t),sre=Ui(),HEe=ys.dFdx(),WEe=ys.dFdy(),ore=sre.dFdx(),are=sre.dFdy(),lre=hi,cre=WEe.cross(lre),ure=lre.cross(HEe),n7=cre.mul(ore.x).add(ure.mul(are.x)),i7=cre.mul(ore.y).add(ure.mul(are.y)),Wee=n7.dot(n7).max(i7.dot(i7)),hre=Wee.equal(0).select(0,Wee.inverseSqrt()),jEe=n7.mul(hre).toVar("tangentViewFrame"),XEe=i7.mul(hre).toVar("bitangentViewFrame"),NI=pc("tangent","vec4"),_m=NI.xyz.toVar("tangentLocal"),FI=me(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=Ef.mul(Ft(_m,0)).xyz.toVarying("v_tangentView").normalize():e=jEe,i.isFlatShading()!==!0&&(e=f1(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),fre=FI.transformDirection(BS).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),BI=me(([i,e],t)=>{let n=i.mul(NI.w).xyz;return t.subBuildFn==="NORMAL"&&t.isFlatShading()!==!0&&(n=n.toVarying(e)),n}).once(["NORMAL"]),$Ee=BI(DI.cross(NI),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),YEe=BI(wa.cross(_m),"v_bitangentLocal").normalize().toVar("bitangentLocal"),dre=me(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=BI(hi.cross(FI),"v_bitangentView").normalize():e=XEe,i.isFlatShading()!==!0&&(e=f1(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),ZEe=BI(Tm.cross(fre),"v_bitangentWorld").normalize().toVar("bitangentWorld"),Hg=To(FI,dre,hi).toVar("TBNViewMatrix"),pre=er.mul(Hg),KEe=(i,e)=>i.sub(pre.mul(e)),mre=me(()=>{let i=Xg.cross(er);return i=i.cross(Xg).normalize(),i=Qn(i,hi,am.mul(vf.oneMinus()).oneMinus().pow2().pow2()).normalize(),i}).once()(),nV=i=>Ht(i).mul(.5).add(.5),Are=i=>Ht(i).mul(2).sub(1),r7=i=>pe(i,el(RI(oe(1).sub(lu(i,i))))),QEe=i=>(ni('TSL: "directionToColor()" has been renamed to "packNormalToRGB()".'),nV(i)),JEe=i=>(ni('TSL: "colorToDirection()" has been renamed to "unpackRGBToNormal()".'),Are(i)),s7=class extends Ir{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=ic,this.unpackNormalMode=Fb}setup(e){let{normalMapType:t,scaleNode:n,unpackNormalMode:r}=this,s=this.node.mul(2).sub(1);if(t===ic?r===HM?s=r7(s.xy):r===Q8?s=r7(s.yw):r!==Fb&&ze(`THREE.NodeMaterial: Unexpected unpack normal mode: ${r}`):r!==Fb&&ze(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${r}'`),n!==null){let a=n;e.isFlatShading()===!0&&(a=f1(a)),s=pe(s.xy.mul(a),s.z)}let o=null;return t===qM?o=eV(s):t===ic?o=Hg.mul(s).normalize():(ze(`NodeMaterial: Unsupported normal map type: ${t}`),o=hi),o}},o7=$n(s7).setParameterLength(1,2),e3e=me(({textureNode:i,bumpScale:e})=>{let t=r=>i.isolate().context({getUV:s=>r(s.uvNode||Ui()),forceUVContext:!0}),n=oe(t(r=>r));return dt(oe(t(r=>r.add(r.dFdx()))).sub(n),oe(t(r=>r.add(r.dFdy()))).sub(n)).mul(e)}),t3e=me(i=>{let{surf_pos:e,surf_norm:t,dHdxy:n}=i,r=e.dFdx().normalize(),s=e.dFdy().normalize(),o=t,a=s.cross(o),l=o.cross(r),c=r.dot(a).mul(Qz),u=c.sign().mul(n.x.mul(a).add(n.y.mul(l)));return c.abs().mul(t).sub(u).normalize()}),a7=class extends Ir{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(e){if(e.material.wireframe===!0)return hi;let t=this.scaleNode!==null?this.scaleNode:1,n=e3e({textureNode:this.textureNode,bumpScale:t});return t3e({surf_pos:ys,surf_norm:hi,dHdxy:n})}},iV=$n(a7).setParameterLength(1,2),jee=new Map,at=class i extends Kt{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=jee.get(e);return n===void 0&&(n=Zd(e,t),jee.set(e,n)),n}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache(e==="map"?"map":e+"Map","texture")}setup(e){let t=e.context.material,n=this.scope,r=null;if(n===i.COLOR){let s=t.color!==void 0?this.getColor(n):pe();t.map&&t.map.isTexture===!0?r=s.mul(this.getTexture("map")):r=s}else if(n===i.OPACITY){let s=this.getFloat(n);t.alphaMap&&t.alphaMap.isTexture===!0?r=s.mul(this.getTexture("alpha")):r=s}else if(n===i.SPECULAR_STRENGTH)t.specularMap&&t.specularMap.isTexture===!0?r=this.getTexture("specular").r:r=oe(1);else if(n===i.SPECULAR_INTENSITY){let s=this.getFloat(n);t.specularIntensityMap&&t.specularIntensityMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s}else if(n===i.SPECULAR_COLOR){let s=this.getColor(n);t.specularColorMap&&t.specularColorMap.isTexture===!0?r=s.mul(this.getTexture(n).rgb):r=s}else if(n===i.ROUGHNESS){let s=this.getFloat(n);t.roughnessMap&&t.roughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).g):r=s}else if(n===i.METALNESS){let s=this.getFloat(n);t.metalnessMap&&t.metalnessMap.isTexture===!0?r=s.mul(this.getTexture(n).b):r=s}else if(n===i.EMISSIVE){let s=this.getFloat("emissiveIntensity"),o=this.getColor(n).mul(s);t.emissiveMap&&t.emissiveMap.isTexture===!0?r=o.mul(this.getTexture(n)):r=o}else if(n===i.NORMAL)t.normalMap?(r=o7(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType,(t.normalMap.format==js||t.normalMap.format==Zh||t.normalMap.format==Yh)&&(r.unpackNormalMode=HM)):t.bumpMap?r=iV(this.getTexture("bump").r,this.getFloat("bumpScale")):r=hi;else if(n===i.CLEARCOAT){let s=this.getFloat(n);t.clearcoatMap&&t.clearcoatMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.CLEARCOAT_ROUGHNESS){let s=this.getFloat(n);t.clearcoatRoughnessMap&&t.clearcoatRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.CLEARCOAT_NORMAL)t.clearcoatNormalMap?r=o7(this.getTexture(n),this.getCache(n+"Scale","vec2")):r=hi;else if(n===i.SHEEN){let s=this.getColor("sheenColor").mul(this.getFloat("sheen"));t.sheenColorMap&&t.sheenColorMap.isTexture===!0?r=s.mul(this.getTexture("sheenColor").rgb):r=s}else if(n===i.SHEEN_ROUGHNESS){let s=this.getFloat(n);t.sheenRoughnessMap&&t.sheenRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s,r=r.clamp(1e-4,1)}else if(n===i.ANISOTROPY)if(t.anisotropyMap&&t.anisotropyMap.isTexture===!0){let s=this.getTexture(n);r=bI(ix.x,ix.y,ix.y.negate(),ix.x).mul(s.rg.mul(2).sub(dt(1)).normalize().mul(s.b))}else r=ix;else if(n===i.IRIDESCENCE_THICKNESS){let s=mr("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){let o=mr("0","float",t.iridescenceThicknessRange);r=s.sub(o).mul(this.getTexture(n).g).add(o)}else r=s}else if(n===i.TRANSMISSION){let s=this.getFloat(n);t.transmissionMap?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.THICKNESS){let s=this.getFloat(n);t.thicknessMap?r=s.mul(this.getTexture(n).g):r=s}else if(n===i.IOR)r=this.getFloat(n);else if(n===i.LIGHT_MAP)t.lightMap?r=this.getTexture(n).rgb.mul(this.getFloat("lightMapIntensity")):r=pe(0);else if(n===i.AO)t.aoMap?r=this.getTexture(n).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1):r=oe(1);else if(n===i.LINE_DASH_OFFSET)r=t.dashOffset?this.getFloat(n):oe(0);else{let s=this.getNodeType(e);r=this.getCache(n,s)}return r}};at.ALPHA_TEST="alphaTest";at.COLOR="color";at.OPACITY="opacity";at.SHININESS="shininess";at.SPECULAR="specular";at.SPECULAR_STRENGTH="specularStrength";at.SPECULAR_INTENSITY="specularIntensity";at.SPECULAR_COLOR="specularColor";at.REFLECTIVITY="reflectivity";at.ROUGHNESS="roughness";at.METALNESS="metalness";at.NORMAL="normal";at.CLEARCOAT="clearcoat";at.CLEARCOAT_ROUGHNESS="clearcoatRoughness";at.CLEARCOAT_NORMAL="clearcoatNormal";at.EMISSIVE="emissive";at.ROTATION="rotation";at.SHEEN="sheen";at.SHEEN_ROUGHNESS="sheenRoughness";at.ANISOTROPY="anisotropy";at.IRIDESCENCE="iridescence";at.IRIDESCENCE_IOR="iridescenceIOR";at.IRIDESCENCE_THICKNESS="iridescenceThickness";at.IOR="ior";at.TRANSMISSION="transmission";at.THICKNESS="thickness";at.ATTENUATION_DISTANCE="attenuationDistance";at.ATTENUATION_COLOR="attenuationColor";at.LINE_SCALE="scale";at.LINE_DASH_SIZE="dashSize";at.LINE_GAP_SIZE="gapSize";at.LINE_WIDTH="linewidth";at.LINE_DASH_OFFSET="dashOffset";at.POINT_SIZE="size";at.DISPERSION="dispersion";at.LIGHT_MAP="light";at.AO="ao";var gre=xt(at,at.ALPHA_TEST),vre=xt(at,at.COLOR),_re=xt(at,at.SHININESS),xre=xt(at,at.EMISSIVE),rV=xt(at,at.OPACITY),yre=xt(at,at.SPECULAR),l7=xt(at,at.SPECULAR_INTENSITY),bre=xt(at,at.SPECULAR_COLOR),cS=xt(at,at.SPECULAR_STRENGTH),n4=xt(at,at.REFLECTIVITY),wre=xt(at,at.ROUGHNESS),Sre=xt(at,at.METALNESS),Tre=xt(at,at.NORMAL),Ere=xt(at,at.CLEARCOAT),Mre=xt(at,at.CLEARCOAT_ROUGHNESS),Cre=xt(at,at.CLEARCOAT_NORMAL),Rre=xt(at,at.ROTATION),Ire=xt(at,at.SHEEN),Pre=xt(at,at.SHEEN_ROUGHNESS),Lre=xt(at,at.ANISOTROPY),Dre=xt(at,at.IRIDESCENCE),Nre=xt(at,at.IRIDESCENCE_IOR),Fre=xt(at,at.IRIDESCENCE_THICKNESS),Bre=xt(at,at.TRANSMISSION),Ore=xt(at,at.THICKNESS),Ure=xt(at,at.IOR),kre=xt(at,at.ATTENUATION_DISTANCE),zre=xt(at,at.ATTENUATION_COLOR),sV=xt(at,at.LINE_SCALE),oV=xt(at,at.LINE_DASH_SIZE),aV=xt(at,at.LINE_GAP_SIZE),b4=xt(at,at.LINE_WIDTH),lV=xt(at,at.LINE_DASH_OFFSET),Vre=xt(at,at.POINT_SIZE),Gre=xt(at,at.DISPERSION),cV=xt(at,at.LIGHT_MAP),qre=xt(at,at.AO),ix=Xt(new Oe).onReference(function(i){return i.material}).onRenderUpdate(function({material:i}){this.value.set(i.anisotropy*Math.cos(i.anisotropyRotation),i.anisotropy*Math.sin(i.anisotropyRotation))}),Hre=me(i=>i.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection"),tl=class i extends Kt{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===i.OBJECT?this.updateType=yn.OBJECT:e===i.MATERIAL?this.updateType=yn.RENDER:e===i.FRAME?this.updateType=yn.FRAME:e===i.BEFORE_OBJECT?this.updateBeforeType=yn.OBJECT:e===i.BEFORE_MATERIAL?this.updateBeforeType=yn.RENDER:e===i.BEFORE_FRAME&&(this.updateBeforeType=yn.FRAME)}update(e){this.callback(e)}updateBefore(e){this.callback(e)}};tl.OBJECT="object";tl.MATERIAL="material";tl.FRAME="frame";tl.BEFORE_OBJECT="beforeObject";tl.BEFORE_MATERIAL="beforeMaterial";tl.BEFORE_FRAME="beforeFrame";var Tx=(i,e)=>new tl(i,e).toStack(),OS=i=>Tx(tl.OBJECT,i),n3e=i=>Tx(tl.MATERIAL,i),Wre=i=>Tx(tl.FRAME,i),i3e=i=>Tx(tl.BEFORE_OBJECT,i),r3e=i=>Tx(tl.BEFORE_MATERIAL,i),s3e=i=>Tx(tl.BEFORE_FRAME,i),c7=class extends Jd{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}getMemberType(e,t){let n=this.storageBufferNode.structTypeNode;return n?n.getMemberType(e,t):"void"}setup(e){return e.isAvailable("storageBuffer")===!1&&this.node.isPBO===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let n,r=e.isContextAssign();if(e.isAvailable("storageBuffer")===!1?this.node.isPBO===!0&&r!==!0&&(this.node.value.isInstancedBufferAttribute||e.shaderStage!=="compute")?n=e.generatePBO(this):n=this.node.build(e):n=super.generate(e),r!==!0){let s=this.getNodeType(e);n=e.format(n,s,t)}return n}},o3e=$n(c7).setParameterLength(2),u7=class extends _S{static get type(){return"StorageBufferNode"}constructor(e,t=null,n=0){let r,s=null;t&&t.isStructTypeNode?(r="struct",s=t,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(n=e.count)):t===null&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(r=one(e.itemSize),n=e.count):r=t,super(e,r,n),this.isStorageBufferNode=!0,this.structTypeNode=s,this.access=Yo.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,e.isStorageBufferAttribute!==!0&&e.isStorageInstancedBufferAttribute!==!0&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){let t;if(this.bufferCount===0){let n=e.globalCache.getData(this.value);n===void 0&&(n={node:this},e.globalCache.setData(this.value,n)),t=n.node.id}else t=this.id;return String(t)}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return o3e(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(Yo.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=Vz(this.value),this._varying=bm(this._attribute)),{attribute:this._attribute,varying:this._varying}}generateNodeType(e){if(this.structTypeNode!==null)return this.structTypeNode.getNodeType(e);if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generateNodeType(e);let{attribute:t}=this.getAttributeData();return t.getNodeType(e)}getMemberType(e,t){return this.structTypeNode!==null?this.structTypeNode.getMemberType(e,t):"void"}generate(e){if(this.structTypeNode!==null&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);let{attribute:t,varying:n}=this.getAttributeData(),r=n.build(e);return e.registerTransform(r,t),r}},Am=(i,e=null,t=0)=>new u7(i,e,t),h7=new WeakMap,Xee=new WeakMap,f7=new WeakMap;function jre(i,e){let t,n=Math.max(e.count,1);if(e.isStorageInstancedBufferAttribute===!0)t=Am(e,"mat4",n).element(Ku);else if(n*16*4<=i.getUniformBufferLimit())t=Sx(e.array,"mat4",n).element(Ku);else{let o=h7.get(e);o||(o=new Bh(e.array,16,1),h7.set(e,o));let a=e.usage===fg?Gz:LI,l=[a(o,"vec4",16,0),a(o,"vec4",16,4),a(o,"vec4",16,8),a(o,"vec4",16,12)];t=mm(...l)}return t}function a3e(i,e,t){let n=f7.get(i);if(n===void 0){let r=e.clone();n={previousInstanceMatrix:r,node:jre(t,r)},f7.set(i,n)}return n.node}var uV=u1("vec3","vInstanceColor"),Xre=me(([i,e=null],t)=>{let n=i.isStorageInstancedBufferAttribute===!0,r=e&&e.isStorageInstancedBufferAttribute===!0,s=jre(t,i),o=null;n||Math.max(i.count,1)*16*4>t.getUniformBufferLimit()&&(o=h7.get(i));let a=null,l=null;if(e)if(r)a=Am(e,"vec3",Math.max(e.count,1)).element(Ku);else{let u=Xee.get(e);u||(u=new ec(e.array,3),Xee.set(e,u)),l=u;let f=e.usage===fg?Gz:LI;a=pe(f(u,"vec3",3,0))}(o!==null||l!==null)&&Wre(()=>{o!==null&&(o.clearUpdateRanges(),o.updateRanges.push(...i.updateRanges),i.version!==o.version&&(o.version=i.version)),e&&l!==null&&(l.clearUpdateRanges(),l.updateRanges.push(...e.updateRanges),e.version!==l.version&&(l.version=e.version))});let c=s.mul(Cr).xyz;if(Cr.assign(c),t.needsPreviousData()){let u=t.object;OS(({object:d})=>{f7.get(d).previousInstanceMatrix.array.set(i.array)});let f=a3e(u,i,t);i1.assign(f.mul(i1).xyz)}if(t.hasGeometryAttribute("normal")){let u=Jz(wa,s);wa.assign(u)}a!==null&&uV.assign(a)},"void"),$re=me(([i])=>{let{instanceMatrix:e,instanceColor:t}=i;Xre(e,t)},"void"),l3e=me(([i,e])=>{let t=de(t1(xs(i),0).x).toConst(),n=de(e),r=n.mod(t).toConst(),s=n.div(t).toConst();return xs(i,zr(r,s))}),c3e=me(([i,e])=>{let t=de(t1(xs(i),0).x).toConst(),n=de(e).mod(t).toConst(),r=de(e).div(t).toConst();return xs(i,zr(n,r)).x}),hV=u1("vec4","vBatchColor"),Yre=me(([i],e)=>{let t=e.getDrawIndex()===null?Ku:Nie,n=c3e(i._indirectTexture,de(t)),r=i._matricesTexture,s=de(t1(xs(r),0).x).toConst(),o=oe(n).mul(4).toInt().toConst(),a=o.mod(s).toConst(),l=o.div(s).toConst(),c=mm(xs(r,zr(a,l)),xs(r,zr(a.add(1),l)),xs(r,zr(a.add(2),l)),xs(r,zr(a.add(3),l))),u=i._colorsTexture;if(u!==null){let y=l3e(u,n);hV.assign(y)}let f=To(c);Cr.assign(c.mul(Cr));let d=wa.div(pe(f[0].dot(f[0]),f[1].dot(f[1]),f[2].dot(f[2]))),A=f.mul(d).xyz;wa.assign(A),e.hasGeometryAttribute("tangent")&&_m.mulAssign(f)},"void"),w4=new WeakMap,S4=new WeakMap;function fV(i,e,t,n,r,s){let o=i.element(r.x),a=i.element(r.y),l=i.element(r.z),c=i.element(r.w),u=t.mul(e),f=Ls(o.mul(s.x).mul(u),a.mul(s.y).mul(u),l.mul(s.z).mul(u),c.mul(s.w).mul(u));return n.mul(f).xyz}function Zre(i,e,t,n,r,s,o){let a=i.element(s.x),l=i.element(s.y),c=i.element(s.z),u=i.element(s.w),f=Ls(o.x.mul(a),o.y.mul(l),o.z.mul(c),o.w.mul(u));f=r.mul(f).mul(n);let d=f.transformDirection(e).xyz,A=f.transformDirection(t).xyz;return{skinNormal:d,skinTangent:A}}function Kre(i,e,t,n,r){let s=i.skeleton,o=S4.get(s);if(o===void 0){s.update();let a=new Float32Array(s.boneMatrices);o={previousBoneMatrices:a,node:Sx(a,"mat4",s.bones.length)},S4.set(s,o)}return fV(o.node,i1,e,t,n,r)}var Qre=me(([i],e)=>{let t=pc("skinIndex","uvec4"),n=pc("skinWeight","vec4"),r=mr("bindMatrix","mat4"),s=mr("bindMatrixInverse","mat4"),o=rre("skeleton.boneMatrices","mat4",i.skeleton.bones.length);if(OS(({object:l,frameId:c})=>{let u=l.skeleton;if(w4.get(u)!==c){w4.set(u,c);let f=S4.get(u);f!==void 0&&f.previousBoneMatrices.set(u.boneMatrices),u.update()}}),e.needsPreviousData()){let l=Kre(i,r,s,t,n);i1.assign(l)}let a=fV(o,Cr,r,s,t,n);if(Cr.assign(a),e.hasGeometryAttribute("normal")){let{skinNormal:l,skinTangent:c}=Zre(o,wa,_m,r,s,t,n);wa.assign(l),e.hasGeometryAttribute("tangent")&&_m.assign(c)}},"void"),u3e=me(([i,e=null],t)=>{let n=Am(new ec(i.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(Ku).toVar(),r=Am(new ec(new Uint32Array(i.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(Ku).toVar(),s=Am(new ec(i.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(Ku).toVar(),o=Xt(i.bindMatrix,"mat4"),a=Xt(i.bindMatrixInverse,"mat4"),l=Sx(i.skeleton.boneMatrices,"mat4",i.skeleton.bones.length),c=i.skeleton;if(OS(({frameId:f})=>{if(w4.get(c)!==f){w4.set(c,f);let d=S4.get(c);d!==void 0&&d.previousBoneMatrices.set(c.boneMatrices),c.update()}}),t.needsPreviousData()){let f=Kre(i,o,a,r,s);i1.assign(f)}let u=fV(l,n,o,a,r,s);if(e!==null&&e.assign(u),t.hasGeometryAttribute("normal")){let{skinNormal:f,skinTangent:d}=Zre(l,wa,_m,o,a,r,s);wa.assign(f),t.hasGeometryAttribute("tangent")&&_m.assign(d)}return u}),d7=class extends Kt{static get type(){return"LoopNode"}constructor(e=[]){super("void"),this.params=e}getVarName(e){return String.fromCharCode(105+e)}getProperties(e){let t=e.getNodeProperties(this);if(t.stackNode!==void 0)return t;let n={};for(let a=0,l=this.params.length-1;a<l;a++){let c=this.params[a],u=c.isNode!==!0&&c.name||this.getVarName(a),f=c.isNode!==!0&&c.type||"int";n[u]=dc(u,f)}let r=e.addStack(),s=this.params[this.params.length-1](n);t.returnsNode=s.context({nodeLoop:s}),t.stackNode=r;let o=this.params[0];if(o.isNode!==!0&&typeof o.update=="function"){let a=me(this.params[0].update)(n);t.updateNode=a.context({nodeLoop:a})}return e.removeStack(),t}setup(e){if(this.getProperties(e),e.fnCall){let t=e.getDataFromNode(e.fnCall.shaderNode);t.hasLoop=!0}}generate(e){let t=this.getProperties(e),n=this.params,r=t.stackNode;for(let o=0,a=n.length-1;o<a;o++){let l=n[o],c=!1,u=null,f=null,d=null,A=null,y=null,w=null;l.isNode?l.getNodeType(e)==="bool"?(c=!0,A="bool",f=l.build(e,A)):(A="int",d=this.getVarName(o),u="0",f=l.build(e,A),y="<"):(A=l.type||"int",d=l.name||this.getVarName(o),u=l.start,f=l.end,y=l.condition,w=l.update,typeof u=="number"?u=e.generateConst(A,u):u&&u.isNode&&(u=u.build(e,A)),typeof f=="number"?f=e.generateConst(A,f):f&&f.isNode&&(f=f.build(e,A)),u!==void 0&&f===void 0?(u=u+" - 1",f="0",y=">="):f!==void 0&&u===void 0&&(u="0",y="<"),y===void 0&&(Number(u)>Number(f)?y=">=":y="<"));let S;if(c)S=`while ( ${f} )`;else{let T={start:u,end:f},R=T.start,P=T.end,I,F=()=>y.includes("<")?"+=":"-=";if(w!=null)switch(typeof w){case"function":I=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;case"number":I=d+" "+F()+" "+e.generateConst(A,w);break;case"string":I=d+" "+w;break;default:w.isNode?I=d+" "+F()+" "+w.build(e):(ze("TSL: 'Loop( { update: ... } )' is not a function, string or number.",this.stackTrace),I="break /* invalid update */")}else A==="int"||A==="uint"?w=y.includes("<")?"++":"--":w=F()+" 1.",I=d+" "+w;let D=e.getVar(A,d)+" = "+R,L=d+" "+y+" "+P;S=`for ( ${D}; ${L}; ${I} )`}e.addFlowCode((o===0?`4152+`,kA(o)}return n}},Oie=(i,e=null)=>new qU(Ht(i),e).toStack();Ue("debug",Oie);var d4=class extends ca{constructor(){super(),this._renderer=null,this.currentFrame=null}get nodeFrame(){return this._renderer._nodes.nodeFrame}setRenderer(e){return this._renderer=e,this}getRenderer(){return this._renderer}init(){}begin(){}finish(){}inspect(){}computeAsync(){}beginCompute(){}finishCompute(){}beginRender(){}finishRender(){}copyTextureToTexture(){}copyFramebufferToTexture(){}},HU=class extends Kt{static get type(){return"InspectorNode"}constructor(e,t="",n=null){super(),this.node=e,this.name=t,this.callback=n,this.updateType=yn.FRAME,this.isInspectorNode=!0}getName(){return this.name||this.node.name}update(e){e.renderer.inspector.inspect(this)}generateNodeType(e){return this.node.getNodeType(e)}setup(e){let t=this.node;return e.context.inspector===!0&&this.callback!==null&&(t=this.callback(t)),e.renderer.backend.isWebGPUBackend!==!0&&e.renderer.inspector.constructor!==d4&&ni('TSL: ".toInspector()" is only available with WebGPU.'),t}};function Uie(i,e="",t=null){return i=Ht(i),i.before(new HU(i,e,t))}Ue("toInspector",Uie);function pEe(i){Xe("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",i)}var p4=class extends Kt{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}generateNodeType(e){let t=this.nodeType;if(t===null){let n=this.getAttributeName(e);if(e.hasGeometryAttribute(n)){let r=e.geometry.getAttribute(n);t=e.getTypeFromAttribute(r)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){let t=this.getAttributeName(e),n=this.getNodeType(e);if(e.hasGeometryAttribute(t)===!0){let s=e.geometry.getAttribute(t),o=e.getTypeFromAttribute(s),a=e.getAttribute(t,o);return e.shaderStage==="vertex"?e.format(a.name,o,n):ym(this).build(e,n)}else return Xe(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(n)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}},fc=(i,e=null)=>new p4(i,e),Ui=(i=0)=>fc("uv"+(i>0?i:""),"vec2"),WU=class extends Kt{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){let n=this.textureNode.build(e,"property"),r=this.levelNode===null?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${n}, ${r} )`,this.getNodeType(e),t)}},e1=$n(WU).setParameterLength(1,2),jU=class extends Qg{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=yn.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){let e=this.texture,t=e.images,n=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(n&&n.width!==void 0){let{width:r,height:s}=n;this.value=Math.log2(Math.max(r,s))}}},Xz=$n(jU).setParameterLength(1),m4=class extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}},$z=new qs,su=class extends Qg{static get type(){return"TextureNode"}constructor(e=$z,t=null,n=null,r=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=n,this.biasNode=r,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.gatherNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=yn.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this._flipYUniform=null,this.setUpdateMatrix(t===null)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}generateNodeType(){return this.value.isDepthTexture===!0?this.gatherNode===null?"float":"vec4":this.value.type===xi?"uvec4":this.value.type===Kr?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return Ui(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=Xt(this.value.matrix)),this._matrixUniform.mul(pe(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this}setupUV(e,t){return e.isFlipY()&&(this._flipYUniform===null&&(this._flipYUniform=Xt(!1)),t=t.toVar(),this.sampler?t=this._flipYUniform.select(t.flipY(),t):t=this._flipYUniform.select(t.setY(de(e1(this,this.levelNode).y).sub(t.y).sub(1)),t)),t}setup(e){let t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;let n=this.value;if(!n||n.isTexture!==!0)throw new m4("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().",this.stackTrace);let r=me(()=>{let l=this.uvNode;return(l===null||e.context.forceUVContext===!0)&&e.context.getUV&&(l=e.context.getUV(this,e)),l||(l=this.getDefaultUV()),this.updateMatrix===!0&&(l=this.getTransformedUV(l)),l=this.setupUV(e,l),this.updateType=this._matrixUniform!==null||this._flipYUniform!==null?yn.OBJECT:yn.NONE,l})(),s=this.levelNode;s===null&&e.context.getTextureLevel&&(s=e.context.getTextureLevel(this));let o=null,a=null;if(this.compareNode!==null)if(e.renderer.hasCompatibility(Bd.TEXTURE_COMPARE))o=this.compareNode;else{let l=n.compareFunction;l===null||l===h_||l===Xh||l===ug||l===Fu?a=this.compareNode:(o=this.compareNode,ni('TSL: Only "LessCompare", "LessEqualCompare", "GreaterCompare" and "GreaterEqualCompare" are supported for depth texture comparison fallback.'))}t.uvNode=r,t.levelNode=s,t.biasNode=this.biasNode,t.compareNode=o,t.compareStepNode=a,t.gradNode=this.gradNode,t.gatherNode=this.gatherNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,this.sampler===!0?"vec2":"ivec2")}generateOffset(e,t){return t.build(e,"ivec2")}generateSnippet(e,t,n,r,s,o,a,l,c,u,f){let d=this.value,A;return s?A=e.generateTextureBias(d,t,n,s,o,u):l?A=e.generateTextureGrad(d,t,n,l,o,u):c?a?A=e.generateTextureGatherCompare(d,t,n,a,o,u,f):A=e.generateTextureGather(d,t,n,c,o,u,f):a?A=e.generateTextureCompare(d,t,n,a,o,u):this.sampler===!1?A=e.generateTextureLoad(d,t,n,r,o,u):r?A=e.generateTextureLevel(d,t,n,r,o,u):A=e.generateTexture(d,t,n,o,u),A}generate(e,t){let n=this.value,r=e.getNodeProperties(this),s=super.generate(e,"property");if(/^sampler/.test(t))return s+"_sampler";if(e.isReference(t))return s;{let o=e.getDataFromNode(this),a=this.getNodeType(e),l=o.propertyName;if(l===void 0){let{uvNode:u,levelNode:f,biasNode:d,compareNode:A,compareStepNode:y,depthNode:w,gradNode:S,gatherNode:T,offsetNode:R}=r,I=this.generateUV(e,u),P=f?f.build(e,"float"):null,F=d?d.build(e,"float"):null,D=w?w.build(e,"int"):null,L=A?A.build(e,"float"):null,C=y?y.build(e,"float"):null,B=S?[S[0].build(e,"vec2"),S[1].build(e,"vec2")]:null,k=T?T.build(e,"int"):null,z=R?this.generateOffset(e,R):null,G=this._flipYUniform?this._flipYUniform.build(e,"bool"):null;k&&(a="vec4");let W=D;W===null&&n.isArrayTexture&&this.isTexture3DNode!==!0&&(W="0");let Y=e.getVarFromNode(this);l=e.getPropertyName(Y);let H=this.generateSnippet(e,s,I,P,F,W,L,B,k,z,G);if(C!==null){let $=n.compareFunction;$===ug||$===Fu?H=Jg(hc(H,a),hc(C,"float")).build(e,a):H=Jg(hc(C,"float"),hc(H,a)).build(e,a)}e.addLineFlowCode(`${l} = ${H}`,this),o.snippet=H,o.propertyName=l}let c=l;return e.needsToWorkingColorSpace(n)&&(c=TP(hc(c,a),n.colorSpace).setup(e).build(e,a)),e.format(c,a,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}sample(e){let t=this.clone();return t.uvNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){let t=this.clone();t.biasNode=Ht(e).mul(Xz(t)),t.referenceNode=this.getBase();let n=t.value;return t.generateMipmaps===!1&&(n&&n.generateMipmaps===!1||n.minFilter===Ti||n.magFilter===Ti)&&(Xe("TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture."),t.biasNode=null),Ht(t)}level(e){let t=this.clone();return t.levelNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}size(e){return e1(this,e)}bias(e){let t=this.clone();return t.biasNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){let t=this.clone();return t.compareNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}grad(e,t){let n=this.clone();return n.gradNode=[Ht(e),Ht(t)],n.referenceNode=this.getBase(),Ht(n)}gather(e=0){let t=this.clone();return t.gatherNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}depth(e){let t=this.clone();return t.depthNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}offset(e){let t=this.clone();return t.offsetNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){let e=this.value,t=this._matrixUniform;t!==null&&(t.value=e.matrix),e.matrixAutoUpdate===!0&&e.updateMatrix();let n=this._flipYUniform;n!==null&&(n.value=e.image instanceof ImageBitmap&&e.flipY===!0||e.isRenderTargetTexture===!0||e.isFramebufferTexture===!0||e.isDepthTexture===!0)}clone(){let e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e}},mEe=$n(su).setParameterLength(1,4).setName("texture"),fi=(i=$z,e=null,t=null,n=null)=>{let r;return i&&i.isTextureNode===!0?(r=Ht(i.clone()),r.referenceNode=i.getBase(),e!==null&&(r.uvNode=Ht(e)),t!==null&&(r.levelNode=Ht(t)),n!==null&&(r.biasNode=Ht(n))):r=mEe(i,e,t,n),r},AEe=(i=$z)=>fi(i),_s=(...i)=>fi(...i).setSampler(!1),gEe=(i,e,t)=>fi(i,e).level(t),vEe=i=>(i.isNode===!0?i:fi(i)).convert("sampler"),_Ee=i=>(i.isNode===!0?i:fi(i)).convert("samplerComparison"),AS=class extends Qg{static get type(){return"BufferNode"}constructor(e,t,n=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=n,this.updateRanges=[]}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}},bx=(i,e,t)=>new AS(i,e,t),XU=class extends Zd{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){let t=super.generate(e),n=this.getNodeType(e),r=this.node.getPaddedType();return e.format(t,r,n)}},$U=class extends AS{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?fm(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=yn.RENDER,this.isArrayBufferNode=!0}generateNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){let e=this.elementType,t="vec4";return e==="mat2"?t="mat2":/mat/.test(e)===!0?t="mat4":e.charAt(0)==="i"?t="ivec4":e.charAt(0)==="u"&&(t="uvec4"),t}update(){let{array:e,value:t}=this,n=this.elementType;if(n==="float"||n==="int"||n==="uint")for(let r=0;r<e.length;r++){let s=r*4;t[s]=e[r]}else if(n==="color")for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.r,t[s+1]=o.g,t[s+2]=o.b||0}else if(n==="mat2")for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.elements[0],t[s+1]=o.elements[1],t[s+2]=o.elements[2],t[s+3]=o.elements[3]}else if(n==="mat3")for(let r=0;r<e.length;r++){let s=r*16,o=e[r];t[s]=o.elements[0],t[s+1]=o.elements[1],t[s+2]=o.elements[2],t[s+4]=o.elements[3],t[s+5]=o.elements[4],t[s+6]=o.elements[5],t[s+8]=o.elements[6],t[s+9]=o.elements[7],t[s+10]=o.elements[8],t[s+15]=1}else if(n==="mat4")for(let r=0;r<e.length;r++){let s=r*16,o=e[r];for(let a=0;a<o.elements.length;a++)t[s+a]=o.elements[a]}else for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.x,t[s+1]=o.y,t[s+2]=o.z||0,t[s+3]=o.w||0}}setup(e){let t=this.array.length,n=this.elementType,r=Float32Array,s=this.paddedType,o=e.getTypeLength(s);return n.charAt(0)==="i"&&(r=Int32Array),n.charAt(0)==="u"&&(r=Uint32Array),this.value=new r(t*o),this.bufferCount=t,this.bufferType=s,this.update(),super.setup(e)}element(e){return new XU(this,Ht(e))}},$o=(i,e)=>new $U(i,e),YU=class extends Kt{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}},tp=$n(YU).setParameterLength(1),Bw,Ow,Zo=class i extends Kt{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this._output=null,this.isViewportNode=!0}generateNodeType(){return this.scope===i.DPR?"float":this.scope===i.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=yn.NONE;return(this.scope===i.SIZE||this.scope===i.VIEWPORT||this.scope===i.DPR)&&(e=yn.RENDER),this.updateType=e,e}update({renderer:e}){let t=e.getRenderTarget();this.scope===i.VIEWPORT?t!==null?Ow.copy(t.viewport):(e.getViewport(Ow),Ow.multiplyScalar(e.getPixelRatio())):this.scope===i.DPR?this._output.value=e.getPixelRatio():t!==null?(Bw.width=t.width,Bw.height=t.height):e.getDrawingBufferSize(Bw)}setup(){let e=this.scope,t=null;return e===i.SIZE?t=Xt(Bw||(Bw=new Oe)):e===i.VIEWPORT?t=Xt(Ow||(Ow=new xn)):e===i.DPR?t=Xt(1):t=dt(u1.div(t1)),this._output=t,t}generate(e){if(this.scope===i.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){let n=e.getNodeProperties(t1).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}};Zo.COORDINATE="coordinate";Zo.VIEWPORT="viewport";Zo.SIZE="size";Zo.UV="uv";Zo.DPR="dpr";var Yz=xt(Zo,Zo.DPR),ju=xt(Zo,Zo.UV),t1=xt(Zo,Zo.SIZE),u1=xt(Zo,Zo.COORDINATE),ux=xt(Zo,Zo.VIEWPORT),Zz=ux.zw,kie=u1.sub(ux.xy),xEe=kie.div(Zz),yEe=me(()=>(Xe('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new ts),t1),"vec2").once()(),BO=null,fR=null,OO=null,dR=null,UO=null,pR=null,kO=null,mR=null,zO=null,AR=null,VO=null,gR=null,GO=null,vR=null,bm=Xt(0,"uint").setName("u_cameraIndex").setGroup(_P("cameraIndex")).toVarying("v_cameraIndex"),lm=Xt("float").setName("cameraNear").setGroup(Jt).onRenderUpdate(({camera:i})=>i.near),cm=Xt("float").setName("cameraFar").setGroup(Jt).onRenderUpdate(({camera:i})=>i.far),Ja=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrix);fR===null?fR=$o(t).setGroup(Jt).setName("cameraProjectionMatrices"):fR.array=t,e=fR.element(i.isMultiViewCamera?tp("gl_ViewID_OVR"):bm)}else BO===null&&(BO=Xt(i.projectionMatrix).setName("cameraProjectionMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.projectionMatrix)),e=BO;return e}).once()(),zie=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrixInverse);dR===null?dR=$o(t).setGroup(Jt).setName("cameraProjectionMatricesInverse"):dR.array=t,e=dR.element(i.isMultiViewCamera?tp("gl_ViewID_OVR"):bm)}else OO===null&&(OO=Xt(i.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(Jt).onRenderUpdate(({camera:t})=>t.projectionMatrixInverse)),e=OO;return e}).once()(),wm=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorldInverse);pR===null?pR=$o(t).setGroup(Jt).setName("cameraViewMatrices"):pR.array=t,e=pR.element(i.isMultiViewCamera?tp("gl_ViewID_OVR"):bm)}else UO===null&&(UO=Xt(i.matrixWorldInverse).setName("cameraViewMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.matrixWorldInverse)),e=UO;return e}).once()(),DS=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorld);mR===null?mR=$o(t).setGroup(Jt).setName("cameraWorldMatrices"):mR.array=t,e=mR.element(i.isMultiViewCamera?tp("gl_ViewID_OVR"):bm)}else kO===null&&(kO=Xt(i.matrixWorld).setName("cameraWorldMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.matrixWorld)),e=kO;return e}).once()(),bEe=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.normalMatrix);AR===null?AR=$o(t).setGroup(Jt).setName("cameraNormalMatrices"):AR.array=t,e=AR.element(i.isMultiViewCamera?tp("gl_ViewID_OVR"):bm)}else zO===null&&(zO=Xt(i.normalMatrix).setName("cameraNormalMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.normalMatrix)),e=zO;return e}).once()(),Vie=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n=0,r=i.cameras.length;n<r;n++)t.push(new re);gR===null?gR=$o(t).setGroup(Jt).setName("cameraPositions").onRenderUpdate(({camera:n},r)=>{let s=n.cameras,o=r.array;for(let a=0,l=s.length;a<l;a++)o[a].setFromMatrixPosition(s[a].matrixWorld)}):gR.array=t,e=gR.element(i.isMultiViewCamera?tp("gl_ViewID_OVR"):bm)}else VO===null&&(VO=Xt(new re).setName("cameraPosition").setGroup(Jt).onRenderUpdate(({camera:t},n)=>n.value.setFromMatrixPosition(t.matrixWorld))),e=VO;return e}).once()(),wEe=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.viewport);vR===null?vR=$o(t,"vec4").setGroup(Jt).setName("cameraViewports"):vR.array=t,e=vR.element(bm)}else GO===null&&(GO=Ft(0,0,t1.x,t1.y).toConst("cameraViewport")),e=GO;return e}).once()(),zee=new yl,Is=class i extends Kt{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=yn.OBJECT,this.uniformNode=new Qg(null)}generateNodeType(){let e=this.scope;if(e===i.WORLD_MATRIX)return"mat4";if(e===i.POSITION||e===i.VIEW_POSITION||e===i.DIRECTION||e===i.SCALE)return"vec3";if(e===i.RADIUS)return"float"}update(e){let t=this.object3d,n=this.uniformNode,r=this.scope;if(r===i.WORLD_MATRIX)n.value=t.matrixWorld;else if(r===i.POSITION)n.value=n.value||new re,n.value.setFromMatrixPosition(t.matrixWorld);else if(r===i.SCALE)n.value=n.value||new re,n.value.setFromMatrixScale(t.matrixWorld);else if(r===i.DIRECTION)n.value=n.value||new re,t.getWorldDirection(n.value);else if(r===i.VIEW_POSITION){let s=e.camera;n.value=n.value||new re,n.value.setFromMatrixPosition(t.matrixWorld),n.value.applyMatrix4(s.matrixWorldInverse)}else if(r===i.RADIUS){let s=e.object.geometry;s.boundingSphere===null&&s.computeBoundingSphere(),zee.copy(s.boundingSphere).applyMatrix4(t.matrixWorld),n.value=zee.radius}}generate(e){let t=this.scope;return t===i.WORLD_MATRIX?this.uniformNode.nodeType="mat4":t===i.POSITION||t===i.VIEW_POSITION||t===i.DIRECTION||t===i.SCALE?this.uniformNode.nodeType="vec3":t===i.RADIUS&&(this.uniformNode.nodeType="float"),this.uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}};Is.WORLD_MATRIX="worldMatrix";Is.POSITION="position";Is.SCALE="scale";Is.VIEW_POSITION="viewPosition";Is.DIRECTION="direction";Is.RADIUS="radius";var SEe=$n(Is,Is.DIRECTION).setParameterLength(1),TEe=$n(Is,Is.WORLD_MATRIX).setParameterLength(1),EEe=$n(Is,Is.POSITION).setParameterLength(1),MEe=$n(Is,Is.SCALE).setParameterLength(1),CEe=$n(Is,Is.VIEW_POSITION).setParameterLength(1),REe=$n(Is,Is.RADIUS).setParameterLength(1),Il=class extends Is{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}},PEe=xt(Il,Il.DIRECTION),tu=xt(Il,Il.WORLD_MATRIX),IEe=xt(Il,Il.POSITION),LEe=xt(Il,Il.SCALE),DEe=xt(Il,Il.VIEW_POSITION),NEe=xt(Il,Il.RADIUS),Gie=Xt(new Mn).onObjectUpdate(({object:i},e)=>e.value.getNormalMatrix(i.matrixWorld)),FEe=Xt(new cn).onObjectUpdate(({object:i},e)=>e.value.copy(i.matrixWorld).invert()),bf=me(i=>i.context.modelViewMatrix||qie).once()().toVar("modelViewMatrix"),qie=wm.mul(tu),ZU=me(i=>(i.context.isHighPrecisionModelViewMatrix=!0,Xt("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),KU=me(i=>{let e=i.context.isHighPrecisionModelViewMatrix;return Xt("mat3").onObjectUpdate(({object:t,camera:n})=>(e!==!0&&t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),Hie=me(i=>i.shaderStage!=="fragment"?(ni("TSL: `clipSpace` is only available in fragment stage."),Ft()):i.context.clipSpace.toVarying("v_clipSpace")).once()(),va=fc("position","vec3"),Mr=va.toVarying("positionLocal"),n1=va.toVarying("positionPrevious"),_f=me(i=>tu.mul(Mr).xyz.toVarying(i.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),Kz=me(()=>Mr.transformDirection(tu).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),xs=me(i=>{if(i.shaderStage==="fragment"&&i.material.vertexNode){let e=zie.mul(Hie);return e.xyz.div(e.w).toVar("positionView")}return i.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),er=me(i=>{let e;return i.camera.isOrthographicCamera?e=pe(0,0,1):e=xs.negate().toVarying("v_positionViewDirection").normalize(),e.toVar("positionViewDirection")},"vec3").once(["POSITION"])(),QU=class extends Kt{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){if(e.shaderStage!=="fragment")return"true";let{material:t}=e;return t.side===mi?"false":e.getFrontFacing()}},Wie=xt(QU),Qz=oe(Wie).mul(2).sub(1),h1=me(([i],{material:e})=>{let t=e.side;return t===mi?i=i.mul(-1):t===vr&&(i=i.mul(Qz)),i}),BEe=i=>(ni('TSL: "directionToFaceDirection()" has been renamed to "negateOnBackSide()".'),h1(i)),CP=fc("normal","vec3"),wa=me(i=>i.geometry.hasAttribute("normal")===!1?(Xe('TSL: Vertex attribute "normal" not found on geometry.'),pe(0,1,0)):CP,"vec3").once()().toVar("normalLocal"),jie=xs.dFdx().cross(xs.dFdy()).normalize().toVar("normalFlat"),dx=me(i=>{let e;return i.isFlatShading()?e=jie:e=eV(wa).toVarying("v_normalViewGeometry").normalize(),e},"vec3").once()().toVar("normalViewGeometry"),Xie=me(i=>{let e=dx.transformNormalByInverseViewMatrix(wm);return i.isFlatShading()!==!0&&(e=e.toVarying("v_normalWorldGeometry")),e.normalize().toVar("normalWorldGeometry")},"vec3").once()(),hi=me(i=>{let e;return i.subBuildFn==="NORMAL"||i.subBuildFn==="VERTEX"?(e=dx,i.isFlatShading()!==!0&&(e=h1(e))):e=i.context.setupNormal().context({getUV:null,getTextureLevel:null}),e},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),Sm=hi.transformNormalByInverseViewMatrix(wm).toVar("normalWorld"),um=me(({subBuildFn:i,context:e})=>{let t;return i==="NORMAL"||i==="VERTEX"?t=hi:t=e.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),Jz=me(([i,e=tu])=>To(e).inverse().transpose().mul(i).normalize());Ue("transformNormal",Jz);var eV=me(([i],e)=>{let t=e.context.modelNormalViewMatrix;return t?i.transformNormalByViewMatrix(t):Gie.mul(i).transformNormalByViewMatrix(wm)}),OEe=me(()=>(Xe('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),hi)).once(["NORMAL","VERTEX"])(),UEe=me(()=>(Xe('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),Sm)).once(["NORMAL","VERTEX"])(),kEe=me(()=>(Xe('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),um)).once(["NORMAL","VERTEX"])(),qO=new cn,$ie=Xt(0).onReference(({material:i})=>i).onObjectUpdate(({material:i})=>i.refractionRatio),ZR=Xt(1).onReference(({material:i})=>i).onObjectUpdate(function({material:i,scene:e}){return i.envMap?i.envMapIntensity:e.environmentIntensity}),A4=Xt(new cn).onReference(function(i){return i.material}).onObjectUpdate(function({material:i,scene:e}){let n=(e.environment!==null||e.environmentNode&&e.environmentNode.isNode)&&i.envMap===null?e.environmentRotation:i.envMapRotation;return n?qO.makeRotationFromEuler(n).transpose():qO.identity(),qO}),Yie=er.negate().reflect(hi),Zie=er.negate().refract(hi,$ie),Kie=Yie.transformDirection(DS).toVar("reflectVector"),Qie=Zie.transformDirection(DS).toVar("refractVector"),Jie=new Ph,JU=class extends su{static get type(){return"CubeTextureNode"}constructor(e,t=null,n=null,r=null){super(e,t,n,r),this.isCubeTextureNode=!0}getInputType(){return this.value.isDepthTexture===!0?"cubeDepthTexture":"cubeTexture"}getDefaultUV(){let e=this.value;return e.mapping===ec?Kie:e.mapping===Gc?Qie:(ze('CubeTextureNode: Mapping "%s" not supported.',e.mapping),pe(0,0,0))}setUpdateMatrix(){}setupUV(e,t){let n=this.value;return n.isDepthTexture===!0?e.renderer.coordinateSystem===xl?pe(t.x,t.y.negate(),t.z):t:(t=A4.mul(t),(e.renderer.coordinateSystem===xl||!n.isRenderTargetTexture)&&(t=pe(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}},tV=$n(JU).setParameterLength(1,4).setName("cubeTexture"),Qa=(i=Jie,e=null,t=null,n=null)=>{let r;return i&&i.isCubeTextureNode===!0?(r=Ht(i.clone()),r.referenceNode=i,e!==null&&(r.uvNode=Ht(e)),t!==null&&(r.levelNode=Ht(t)),n!==null&&(r.biasNode=Ht(n))):r=tV(i,e,t,n),r},zEe=(i=Jie)=>tV(i),e7=class extends Zd{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),n=this.referenceNode.getNodeType(e),r=this.getNodeType(e);return e.format(t,n,r)}},px=class extends Kt{static get type(){return"ReferenceNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.name=null,this.updateType=yn.OBJECT}element(e){return new e7(this,Ht(e))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setNodeType(e){let t=null;this.count!==null?t=bx(null,e,this.count):Array.isArray(this.getValueFromReference())?(t=$o(null,e),t.updateType=yn.OBJECT):e==="texture"?t=fi(null):e==="cubeTexture"?t=Qa(null):t=Xt(null,e),this.group!==null&&t.setGroup(this.group),this.name!==null&&t.setName(this.name),this.node=t}generateNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,n=e[t[0]];for(let r=1;r<t.length;r++)n=n[t[r]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}},mr=(i,e,t)=>new px(i,e,t),ere=(i,e,t,n)=>new px(i,e,n,t),t7=class extends px{static get type(){return"MaterialReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.material=n,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=this.material!==null?this.material:e.material,this.reference}},Xd=(i,e,t=null)=>new t7(i,e,t),tre=Ui(),VEe=xs.dFdx(),GEe=xs.dFdy(),nre=tre.dFdx(),ire=tre.dFdy(),rre=hi,sre=GEe.cross(rre),ore=rre.cross(VEe),n7=sre.mul(nre.x).add(ore.mul(ire.x)),i7=sre.mul(nre.y).add(ore.mul(ire.y)),Vee=n7.dot(n7).max(i7.dot(i7)),are=Vee.equal(0).select(0,Vee.inverseSqrt()),qEe=n7.mul(are).toVar("tangentViewFrame"),HEe=i7.mul(are).toVar("bitangentViewFrame"),RP=fc("tangent","vec4"),vm=RP.xyz.toVar("tangentLocal"),PP=me(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=bf.mul(Ft(vm,0)).xyz.toVarying("v_tangentView").normalize():e=qEe,i.isFlatShading()!==!0&&(e=h1(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),lre=PP.transformDirection(DS).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),IP=me(([i,e],t)=>{let n=i.mul(RP.w).xyz;return t.subBuildFn==="NORMAL"&&t.isFlatShading()!==!0&&(n=n.toVarying(e)),n}).once(["NORMAL"]),WEe=IP(CP.cross(RP),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),jEe=IP(wa.cross(vm),"v_bitangentLocal").normalize().toVar("bitangentLocal"),cre=me(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=IP(hi.cross(PP),"v_bitangentView").normalize():e=HEe,i.isFlatShading()!==!0&&(e=h1(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),XEe=IP(Sm.cross(lre),"v_bitangentWorld").normalize().toVar("bitangentWorld"),qg=To(PP,cre,hi).toVar("TBNViewMatrix"),ure=er.mul(qg),$Ee=(i,e)=>i.sub(ure.mul(e)),hre=me(()=>{let i=jg.cross(er);return i=i.cross(jg).normalize(),i=Qn(i,hi,om.mul(pf.oneMinus()).oneMinus().pow2().pow2()).normalize(),i}).once()(),nV=i=>Ht(i).mul(.5).add(.5),fre=i=>Ht(i).mul(2).sub(1),r7=i=>pe(i,el(SP(oe(1).sub(ru(i,i))))),YEe=i=>(ni('TSL: "directionToColor()" has been renamed to "packNormalToRGB()".'),nV(i)),ZEe=i=>(ni('TSL: "colorToDirection()" has been renamed to "unpackRGBToNormal()".'),fre(i)),s7=class extends Rr{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=tc,this.unpackNormalMode=Lb}setup(e){let{normalMapType:t,scaleNode:n,unpackNormalMode:r}=this,s=this.node.mul(2).sub(1);if(t===tc?r===kM?s=r7(s.xy):r===Q8?s=r7(s.yw):r!==Lb&&ze(`THREE.NodeMaterial: Unexpected unpack normal mode: ${r}`):r!==Lb&&ze(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${r}'`),n!==null){let a=n;e.isFlatShading()===!0&&(a=h1(a)),s=pe(s.xy.mul(a),s.z)}let o=null;return t===UM?o=eV(s):t===tc?o=qg.mul(s).normalize():(ze(`NodeMaterial: Unsupported normal map type: ${t}`),o=hi),o}},o7=$n(s7).setParameterLength(1,2),KEe=me(({textureNode:i,bumpScale:e})=>{let t=r=>i.isolate().context({getUV:s=>r(s.uvNode||Ui()),forceUVContext:!0}),n=oe(t(r=>r));return dt(oe(t(r=>r.add(r.dFdx()))).sub(n),oe(t(r=>r.add(r.dFdy()))).sub(n)).mul(e)}),QEe=me(i=>{let{surf_pos:e,surf_norm:t,dHdxy:n}=i,r=e.dFdx().normalize(),s=e.dFdy().normalize(),o=t,a=s.cross(o),l=o.cross(r),c=r.dot(a).mul(Qz),u=c.sign().mul(n.x.mul(a).add(n.y.mul(l)));return c.abs().mul(t).sub(u).normalize()}),a7=class extends Rr{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(e){if(e.material.wireframe===!0)return hi;let t=this.scaleNode!==null?this.scaleNode:1,n=KEe({textureNode:this.textureNode,bumpScale:t});return QEe({surf_pos:xs,surf_norm:hi,dHdxy:n})}},iV=$n(a7).setParameterLength(1,2),Gee=new Map,at=class i extends Kt{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=Gee.get(e);return n===void 0&&(n=Xd(e,t),Gee.set(e,n)),n}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache(e==="map"?"map":e+"Map","texture")}setup(e){let t=e.context.material,n=this.scope,r=null;if(n===i.COLOR){let s=t.color!==void 0?this.getColor(n):pe();t.map&&t.map.isTexture===!0?r=s.mul(this.getTexture("map")):r=s}else if(n===i.OPACITY){let s=this.getFloat(n);t.alphaMap&&t.alphaMap.isTexture===!0?r=s.mul(this.getTexture("alpha")):r=s}else if(n===i.SPECULAR_STRENGTH)t.specularMap&&t.specularMap.isTexture===!0?r=this.getTexture("specular").r:r=oe(1);else if(n===i.SPECULAR_INTENSITY){let s=this.getFloat(n);t.specularIntensityMap&&t.specularIntensityMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s}else if(n===i.SPECULAR_COLOR){let s=this.getColor(n);t.specularColorMap&&t.specularColorMap.isTexture===!0?r=s.mul(this.getTexture(n).rgb):r=s}else if(n===i.ROUGHNESS){let s=this.getFloat(n);t.roughnessMap&&t.roughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).g):r=s}else if(n===i.METALNESS){let s=this.getFloat(n);t.metalnessMap&&t.metalnessMap.isTexture===!0?r=s.mul(this.getTexture(n).b):r=s}else if(n===i.EMISSIVE){let s=this.getFloat("emissiveIntensity"),o=this.getColor(n).mul(s);t.emissiveMap&&t.emissiveMap.isTexture===!0?r=o.mul(this.getTexture(n)):r=o}else if(n===i.NORMAL)t.normalMap?(r=o7(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType,(t.normalMap.format==Ws||t.normalMap.format==jh||t.normalMap.format==Wh)&&(r.unpackNormalMode=kM)):t.bumpMap?r=iV(this.getTexture("bump").r,this.getFloat("bumpScale")):r=hi;else if(n===i.CLEARCOAT){let s=this.getFloat(n);t.clearcoatMap&&t.clearcoatMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.CLEARCOAT_ROUGHNESS){let s=this.getFloat(n);t.clearcoatRoughnessMap&&t.clearcoatRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.CLEARCOAT_NORMAL)t.clearcoatNormalMap?r=o7(this.getTexture(n),this.getCache(n+"Scale","vec2")):r=hi;else if(n===i.SHEEN){let s=this.getColor("sheenColor").mul(this.getFloat("sheen"));t.sheenColorMap&&t.sheenColorMap.isTexture===!0?r=s.mul(this.getTexture("sheenColor").rgb):r=s}else if(n===i.SHEEN_ROUGHNESS){let s=this.getFloat(n);t.sheenRoughnessMap&&t.sheenRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s,r=r.clamp(1e-4,1)}else if(n===i.ANISOTROPY)if(t.anisotropyMap&&t.anisotropyMap.isTexture===!0){let s=this.getTexture(n);r=gP(tx.x,tx.y,tx.y.negate(),tx.x).mul(s.rg.mul(2).sub(dt(1)).normalize().mul(s.b))}else r=tx;else if(n===i.IRIDESCENCE_THICKNESS){let s=mr("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){let o=mr("0","float",t.iridescenceThicknessRange);r=s.sub(o).mul(this.getTexture(n).g).add(o)}else r=s}else if(n===i.TRANSMISSION){let s=this.getFloat(n);t.transmissionMap?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.THICKNESS){let s=this.getFloat(n);t.thicknessMap?r=s.mul(this.getTexture(n).g):r=s}else if(n===i.IOR)r=this.getFloat(n);else if(n===i.LIGHT_MAP)t.lightMap?r=this.getTexture(n).rgb.mul(this.getFloat("lightMapIntensity")):r=pe(0);else if(n===i.AO)t.aoMap?r=this.getTexture(n).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1):r=oe(1);else if(n===i.LINE_DASH_OFFSET)r=t.dashOffset?this.getFloat(n):oe(0);else{let s=this.getNodeType(e);r=this.getCache(n,s)}return r}};at.ALPHA_TEST="alphaTest";at.COLOR="color";at.OPACITY="opacity";at.SHININESS="shininess";at.SPECULAR="specular";at.SPECULAR_STRENGTH="specularStrength";at.SPECULAR_INTENSITY="specularIntensity";at.SPECULAR_COLOR="specularColor";at.REFLECTIVITY="reflectivity";at.ROUGHNESS="roughness";at.METALNESS="metalness";at.NORMAL="normal";at.CLEARCOAT="clearcoat";at.CLEARCOAT_ROUGHNESS="clearcoatRoughness";at.CLEARCOAT_NORMAL="clearcoatNormal";at.EMISSIVE="emissive";at.ROTATION="rotation";at.SHEEN="sheen";at.SHEEN_ROUGHNESS="sheenRoughness";at.ANISOTROPY="anisotropy";at.IRIDESCENCE="iridescence";at.IRIDESCENCE_IOR="iridescenceIOR";at.IRIDESCENCE_THICKNESS="iridescenceThickness";at.IOR="ior";at.TRANSMISSION="transmission";at.THICKNESS="thickness";at.ATTENUATION_DISTANCE="attenuationDistance";at.ATTENUATION_COLOR="attenuationColor";at.LINE_SCALE="scale";at.LINE_DASH_SIZE="dashSize";at.LINE_GAP_SIZE="gapSize";at.LINE_WIDTH="linewidth";at.LINE_DASH_OFFSET="dashOffset";at.POINT_SIZE="size";at.DISPERSION="dispersion";at.LIGHT_MAP="light";at.AO="ao";var dre=xt(at,at.ALPHA_TEST),pre=xt(at,at.COLOR),mre=xt(at,at.SHININESS),Are=xt(at,at.EMISSIVE),rV=xt(at,at.OPACITY),gre=xt(at,at.SPECULAR),l7=xt(at,at.SPECULAR_INTENSITY),vre=xt(at,at.SPECULAR_COLOR),oS=xt(at,at.SPECULAR_STRENGTH),KR=xt(at,at.REFLECTIVITY),_re=xt(at,at.ROUGHNESS),xre=xt(at,at.METALNESS),yre=xt(at,at.NORMAL),bre=xt(at,at.CLEARCOAT),wre=xt(at,at.CLEARCOAT_ROUGHNESS),Sre=xt(at,at.CLEARCOAT_NORMAL),Tre=xt(at,at.ROTATION),Ere=xt(at,at.SHEEN),Mre=xt(at,at.SHEEN_ROUGHNESS),Cre=xt(at,at.ANISOTROPY),Rre=xt(at,at.IRIDESCENCE),Pre=xt(at,at.IRIDESCENCE_IOR),Ire=xt(at,at.IRIDESCENCE_THICKNESS),Lre=xt(at,at.TRANSMISSION),Dre=xt(at,at.THICKNESS),Nre=xt(at,at.IOR),Fre=xt(at,at.ATTENUATION_DISTANCE),Bre=xt(at,at.ATTENUATION_COLOR),sV=xt(at,at.LINE_SCALE),oV=xt(at,at.LINE_DASH_SIZE),aV=xt(at,at.LINE_GAP_SIZE),g4=xt(at,at.LINE_WIDTH),lV=xt(at,at.LINE_DASH_OFFSET),Ore=xt(at,at.POINT_SIZE),Ure=xt(at,at.DISPERSION),cV=xt(at,at.LIGHT_MAP),kre=xt(at,at.AO),tx=Xt(new Oe).onReference(function(i){return i.material}).onRenderUpdate(function({material:i}){this.value.set(i.anisotropy*Math.cos(i.anisotropyRotation),i.anisotropy*Math.sin(i.anisotropyRotation))}),zre=me(i=>i.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection"),tl=class i extends Kt{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===i.OBJECT?this.updateType=yn.OBJECT:e===i.MATERIAL?this.updateType=yn.RENDER:e===i.FRAME?this.updateType=yn.FRAME:e===i.BEFORE_OBJECT?this.updateBeforeType=yn.OBJECT:e===i.BEFORE_MATERIAL?this.updateBeforeType=yn.RENDER:e===i.BEFORE_FRAME&&(this.updateBeforeType=yn.FRAME)}update(e){this.callback(e)}updateBefore(e){this.callback(e)}};tl.OBJECT="object";tl.MATERIAL="material";tl.FRAME="frame";tl.BEFORE_OBJECT="beforeObject";tl.BEFORE_MATERIAL="beforeMaterial";tl.BEFORE_FRAME="beforeFrame";var wx=(i,e)=>new tl(i,e).toStack(),NS=i=>wx(tl.OBJECT,i),JEe=i=>wx(tl.MATERIAL,i),Vre=i=>wx(tl.FRAME,i),e3e=i=>wx(tl.BEFORE_OBJECT,i),t3e=i=>wx(tl.BEFORE_MATERIAL,i),n3e=i=>wx(tl.BEFORE_FRAME,i),c7=class extends Zd{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}getMemberType(e,t){let n=this.storageBufferNode.structTypeNode;return n?n.getMemberType(e,t):"void"}setup(e){return e.isAvailable("storageBuffer")===!1&&this.node.isPBO===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let n,r=e.isContextAssign();if(e.isAvailable("storageBuffer")===!1?this.node.isPBO===!0&&r!==!0&&(this.node.value.isInstancedBufferAttribute||e.shaderStage!=="compute")?n=e.generatePBO(this):n=this.node.build(e):n=super.generate(e),r!==!0){let s=this.getNodeType(e);n=e.format(n,s,t)}return n}},i3e=$n(c7).setParameterLength(2),u7=class extends AS{static get type(){return"StorageBufferNode"}constructor(e,t=null,n=0){let r,s=null;t&&t.isStructTypeNode?(r="struct",s=t,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(n=e.count)):t===null&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(r=nne(e.itemSize),n=e.count):r=t,super(e,r,n),this.isStorageBufferNode=!0,this.structTypeNode=s,this.access=Yo.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,e.isStorageBufferAttribute!==!0&&e.isStorageInstancedBufferAttribute!==!0&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){let t;if(this.bufferCount===0){let n=e.globalCache.getData(this.value);n===void 0&&(n={node:this},e.globalCache.setData(this.value,n)),t=n.node.id}else t=this.id;return String(t)}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return i3e(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(Yo.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=Vz(this.value),this._varying=ym(this._attribute)),{attribute:this._attribute,varying:this._varying}}generateNodeType(e){if(this.structTypeNode!==null)return this.structTypeNode.getNodeType(e);if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generateNodeType(e);let{attribute:t}=this.getAttributeData();return t.getNodeType(e)}getMemberType(e,t){return this.structTypeNode!==null?this.structTypeNode.getMemberType(e,t):"void"}generate(e){if(this.structTypeNode!==null&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);let{attribute:t,varying:n}=this.getAttributeData(),r=n.build(e);return e.registerTransform(r,t),r}},mm=(i,e=null,t=0)=>new u7(i,e,t),h7=new WeakMap,qee=new WeakMap,f7=new WeakMap;function Gre(i,e){let t,n=Math.max(e.count,1);if(e.isStorageInstancedBufferAttribute===!0)t=mm(e,"mat4",n).element(Xu);else if(n*16*4<=i.getUniformBufferLimit())t=bx(e.array,"mat4",n).element(Xu);else{let o=h7.get(e);o||(o=new Lh(e.array,16,1),h7.set(e,o));let a=e.usage===hg?Gz:MP,l=[a(o,"vec4",16,0),a(o,"vec4",16,4),a(o,"vec4",16,8),a(o,"vec4",16,12)];t=pm(...l)}return t}function r3e(i,e,t){let n=f7.get(i);if(n===void 0){let r=e.clone();n={previousInstanceMatrix:r,node:Gre(t,r)},f7.set(i,n)}return n.node}var uV=c1("vec3","vInstanceColor"),qre=me(([i,e=null],t)=>{let n=i.isStorageInstancedBufferAttribute===!0,r=e&&e.isStorageInstancedBufferAttribute===!0,s=Gre(t,i),o=null;n||Math.max(i.count,1)*16*4>t.getUniformBufferLimit()&&(o=h7.get(i));let a=null,l=null;if(e)if(r)a=mm(e,"vec3",Math.max(e.count,1)).element(Xu);else{let u=qee.get(e);u||(u=new Ql(e.array,3),qee.set(e,u)),l=u;let f=e.usage===hg?Gz:MP;a=pe(f(u,"vec3",3,0))}(o!==null||l!==null)&&Vre(()=>{o!==null&&(o.clearUpdateRanges(),o.updateRanges.push(...i.updateRanges),i.version!==o.version&&(o.version=i.version)),e&&l!==null&&(l.clearUpdateRanges(),l.updateRanges.push(...e.updateRanges),e.version!==l.version&&(l.version=e.version))});let c=s.mul(Mr).xyz;if(Mr.assign(c),t.needsPreviousData()){let u=t.object;NS(({object:d})=>{f7.get(d).previousInstanceMatrix.array.set(i.array)});let f=r3e(u,i,t);n1.assign(f.mul(n1).xyz)}if(t.hasGeometryAttribute("normal")){let u=Jz(wa,s);wa.assign(u)}a!==null&&uV.assign(a)},"void"),Hre=me(([i])=>{let{instanceMatrix:e,instanceColor:t}=i;qre(e,t)},"void"),s3e=me(([i,e])=>{let t=de(e1(_s(i),0).x).toConst(),n=de(e),r=n.mod(t).toConst(),s=n.div(t).toConst();return _s(i,kr(r,s))}),o3e=me(([i,e])=>{let t=de(e1(_s(i),0).x).toConst(),n=de(e).mod(t).toConst(),r=de(e).div(t).toConst();return _s(i,kr(n,r)).x}),hV=c1("vec4","vBatchColor"),Wre=me(([i],e)=>{let t=e.getDrawIndex()===null?Xu:Pie,n=o3e(i._indirectTexture,de(t)),r=i._matricesTexture,s=de(e1(_s(r),0).x).toConst(),o=oe(n).mul(4).toInt().toConst(),a=o.mod(s).toConst(),l=o.div(s).toConst(),c=pm(_s(r,kr(a,l)),_s(r,kr(a.add(1),l)),_s(r,kr(a.add(2),l)),_s(r,kr(a.add(3),l))),u=i._colorsTexture;if(u!==null){let y=s3e(u,n);hV.assign(y)}let f=To(c);Mr.assign(c.mul(Mr));let d=wa.div(pe(f[0].dot(f[0]),f[1].dot(f[1]),f[2].dot(f[2]))),A=f.mul(d).xyz;wa.assign(A),e.hasGeometryAttribute("tangent")&&vm.mulAssign(f)},"void"),v4=new WeakMap,_4=new WeakMap;function fV(i,e,t,n,r,s){let o=i.element(r.x),a=i.element(r.y),l=i.element(r.z),c=i.element(r.w),u=t.mul(e),f=Ps(o.mul(s.x).mul(u),a.mul(s.y).mul(u),l.mul(s.z).mul(u),c.mul(s.w).mul(u));return n.mul(f).xyz}function jre(i,e,t,n,r,s,o){let a=i.element(s.x),l=i.element(s.y),c=i.element(s.z),u=i.element(s.w),f=Ps(o.x.mul(a),o.y.mul(l),o.z.mul(c),o.w.mul(u));f=r.mul(f).mul(n);let d=f.transformDirection(e).xyz,A=f.transformDirection(t).xyz;return{skinNormal:d,skinTangent:A}}function Xre(i,e,t,n,r){let s=i.skeleton,o=_4.get(s);if(o===void 0){s.update();let a=new Float32Array(s.boneMatrices);o={previousBoneMatrices:a,node:bx(a,"mat4",s.bones.length)},_4.set(s,o)}return fV(o.node,n1,e,t,n,r)}var $re=me(([i],e)=>{let t=fc("skinIndex","uvec4"),n=fc("skinWeight","vec4"),r=mr("bindMatrix","mat4"),s=mr("bindMatrixInverse","mat4"),o=ere("skeleton.boneMatrices","mat4",i.skeleton.bones.length);if(NS(({object:l,frameId:c})=>{let u=l.skeleton;if(v4.get(u)!==c){v4.set(u,c);let f=_4.get(u);f!==void 0&&f.previousBoneMatrices.set(u.boneMatrices),u.update()}}),e.needsPreviousData()){let l=Xre(i,r,s,t,n);n1.assign(l)}let a=fV(o,Mr,r,s,t,n);if(Mr.assign(a),e.hasGeometryAttribute("normal")){let{skinNormal:l,skinTangent:c}=jre(o,wa,vm,r,s,t,n);wa.assign(l),e.hasGeometryAttribute("tangent")&&vm.assign(c)}},"void"),a3e=me(([i,e=null],t)=>{let n=mm(new Ql(i.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(Xu).toVar(),r=mm(new Ql(new Uint32Array(i.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(Xu).toVar(),s=mm(new Ql(i.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(Xu).toVar(),o=Xt(i.bindMatrix,"mat4"),a=Xt(i.bindMatrixInverse,"mat4"),l=bx(i.skeleton.boneMatrices,"mat4",i.skeleton.bones.length),c=i.skeleton;if(NS(({frameId:f})=>{if(v4.get(c)!==f){v4.set(c,f);let d=_4.get(c);d!==void 0&&d.previousBoneMatrices.set(c.boneMatrices),c.update()}}),t.needsPreviousData()){let f=Xre(i,o,a,r,s);n1.assign(f)}let u=fV(l,n,o,a,r,s);if(e!==null&&e.assign(u),t.hasGeometryAttribute("normal")){let{skinNormal:f,skinTangent:d}=jre(l,wa,vm,o,a,r,s);wa.assign(f),t.hasGeometryAttribute("tangent")&&vm.assign(d)}return u}),d7=class extends Kt{static get type(){return"LoopNode"}constructor(e=[]){super("void"),this.params=e}getVarName(e){return String.fromCharCode(105+e)}getProperties(e){let t=e.getNodeProperties(this);if(t.stackNode!==void 0)return t;let n={};for(let a=0,l=this.params.length-1;a<l;a++){let c=this.params[a],u=c.isNode!==!0&&c.name||this.getVarName(a),f=c.isNode!==!0&&c.type||"int";n[u]=hc(u,f)}let r=e.addStack(),s=this.params[this.params.length-1](n);t.returnsNode=s.context({nodeLoop:s}),t.stackNode=r;let o=this.params[0];if(o.isNode!==!0&&typeof o.update=="function"){let a=me(this.params[0].update)(n);t.updateNode=a.context({nodeLoop:a})}return e.removeStack(),t}setup(e){if(this.getProperties(e),e.fnCall){let t=e.getDataFromNode(e.fnCall.shaderNode);t.hasLoop=!0}}generate(e){let t=this.getProperties(e),n=this.params,r=t.stackNode;for(let o=0,a=n.length-1;o<a;o++){let l=n[o],c=!1,u=null,f=null,d=null,A=null,y=null,w=null;l.isNode?l.getNodeType(e)==="bool"?(c=!0,A="bool",f=l.build(e,A)):(A="int",d=this.getVarName(o),u="0",f=l.build(e,A),y="<"):(A=l.type||"int",d=l.name||this.getVarName(o),u=l.start,f=l.end,y=l.condition,w=l.update,typeof u=="number"?u=e.generateConst(A,u):u&&u.isNode&&(u=u.build(e,A)),typeof f=="number"?f=e.generateConst(A,f):f&&f.isNode&&(f=f.build(e,A)),u!==void 0&&f===void 0?(u=u+" - 1",f="0",y=">="):f!==void 0&&u===void 0&&(u="0",y="<"),y===void 0&&(Number(u)>Number(f)?y=">=":y="<"));let S;if(c)S=`while ( ${f} )`;else{let T={start:u,end:f},R=T.start,I=T.end,P,F=()=>y.includes("<")?"+=":"-=";if(w!=null)switch(typeof w){case"function":P=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;case"number":P=d+" "+F()+" "+e.generateConst(A,w);break;case"string":P=d+" "+w;break;default:w.isNode?P=d+" "+F()+" "+w.build(e):(ze("TSL: 'Loop( { update: ... } )' is not a function, string or number.",this.stackTrace),P="break /* invalid update */")}else A==="int"||A==="uint"?w=y.includes("<")?"++":"--":w=F()+" 1.",P=d+" "+w;let D=e.getVar(A,d)+" = "+R,L=d+" "+y+" "+I;S=`for ( ${D}; ${L}; ${P} )`}e.addFlowCode((o===0?`41534153 `:"")+e.tab+S+` {41544154 41554155 `).addFlowTab()}let s=r.build(e,"void");t.returnsNode.build(e,"void"),e.removeFlowTab().addFlowCode(`41564156 `+e.tab+s);for(let o=0,a=this.params.length-1;o<a;o++)e.addFlowCode((o===0?"":e.tab)+`}41574157 4158-`).removeFlowTab();e.addFlowTab()}},Oi=(...i)=>new d7(jg(i,"int")).toStack(),h3e=()=>dc("continue").toStack(),Jre=()=>dc("break").toStack(),HO=new WeakMap,ac=new xn,$ee=new WeakMap,Yee=me(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{let o=de(Die).mul(t).add(s),a=o.div(n),l=o.sub(a.mul(n));return xs(i,zr(l,a)).depth(r).xyz.mul(e)});function f3e(i){let e=i.morphAttributes.position!==void 0,t=i.morphAttributes.normal!==void 0,n=i.morphAttributes.color!==void 0,r=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,s=r!==void 0?r.length:0,o=HO.get(i);if(o===void 0||o.count!==s){let T=function(){w.dispose(),HO.delete(i),i.removeEventListener("dispose",T)};o!==void 0&&o.texture.dispose();let a=i.morphAttributes.position||[],l=i.morphAttributes.normal||[],c=i.morphAttributes.color||[],u=0;e===!0&&(u=1),t===!0&&(u=2),n===!0&&(u=3);let f=i.attributes.position.count*u,d=1,A=4096;f>A&&(d=Math.ceil(f/A),f=A);let y=new Float32Array(f*d*4*s),w=new VA(y,f,d,s);w.type=cr,w.needsUpdate=!0;let S=u*4;for(let R=0;R<s;R++){let P=a[R],I=l[R],F=c[R],D=f*d*4*R;for(let L=0;L<P.count;L++){let C=L*S;e===!0&&(ac.fromBufferAttribute(P,L),y[D+C+0]=ac.x,y[D+C+1]=ac.y,y[D+C+2]=ac.z,y[D+C+3]=0),t===!0&&(ac.fromBufferAttribute(I,L),y[D+C+4]=ac.x,y[D+C+5]=ac.y,y[D+C+6]=ac.z,y[D+C+7]=0),n===!0&&(ac.fromBufferAttribute(F,L),y[D+C+8]=ac.x,y[D+C+9]=ac.y,y[D+C+10]=ac.z,y[D+C+11]=F.itemSize===4?ac.w:1)}}o={count:s,texture:w,stride:u,size:new Oe(f,d)},HO.set(i,o),i.addEventListener("dispose",T)}return o}var ese=me(([i])=>{let{geometry:e}=i,t=e.morphAttributes.position!==void 0,n=e.hasAttribute("normal")&&e.morphAttributes.normal!==void 0,r=e.morphAttributes.position||e.morphAttributes.normal||e.morphAttributes.color,s=r!==void 0?r.length:0;if(s===0)return;let o=$ee.get(i);(o===void 0||o.count!==s)&&(o={base:Xt(1),influences:i.morphTargetInfluences?$o(i.morphTargetInfluences,"float"):null,count:s},$ee.set(i,o));let{base:a,influences:l}=o,{texture:c,stride:u,size:f}=f3e(e);t===!0&&Cr.mulAssign(a),n===!0&&wa.mulAssign(a);let d=de(f.width);Oi(s,({i:A})=>{let y=oe(0).toVar();i.count>1&&i.morphTexture!==null&&i.morphTexture!==void 0?y.assign(xs(i.morphTexture,zr(de(A).add(1),de(Ku))).r):y.assign(l.element(A).toVar()),$t(y.notEqual(0),()=>{t===!0&&Cr.addAssign(Yee({bufferMap:c,influence:y,stride:u,width:d,depth:A,offset:de(0)})),n===!0&&wa.addAssign(Yee({bufferMap:c,influence:y,stride:u,width:d,depth:A,offset:de(1)}))})}),OS(({object:A})=>{let{base:y,influences:w}=o;A.geometry.morphTargetsRelative?y.value=1:y.value=1-A.morphTargetInfluences.reduce((S,T)=>S+T,0),w&&(w.array=A.morphTargetInfluences,w.update())})},"void"),xm=class extends Kt{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}},p7=class extends xm{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}},m7=class extends gS{static get type(){return"LightingContextNode"}constructor(e,t=null,n=[],r=null,s=null){super(e),this.lightingModel=t,this.materialLightings=n,this.backdropNode=r,this.backdropAlphaNode=s,this._value=null}getContext(){let{materialLightings:e,backdropNode:t,backdropAlphaNode:n}=this,r=pe().toVar("directDiffuse"),s=pe().toVar("directSpecular"),o=pe().toVar("indirectDiffuse"),a=pe().toVar("indirectSpecular"),l={directDiffuse:r,directSpecular:s,indirectDiffuse:o,indirectSpecular:a};return{radiance:pe().toVar("radiance"),irradiance:pe().toVar("irradiance"),iblIrradiance:pe().toVar("iblIrradiance"),ambientOcclusion:oe(1).toVar("ambientOcclusion"),reflectedLight:l,materialLightings:e,backdrop:t,backdropAlpha:n}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}},tse=$n(m7),A7=class extends xm{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}},Dg=new Oe,gx=class extends cu{static get type(){return"ViewportTextureNode"}constructor(e=Zu,t=null,n=null){let r=null;n===null?(r=new jA,r.minFilter=Go,n=r):r=n,super(n,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=r,this.isOutputTextureNode=!0,this.updateBeforeType=yn.RENDER,this._cacheTextures=new WeakMap}getTextureForReference(e=null){let t,n;if(this.referenceNode?(t=this.referenceNode.defaultFramebuffer,n=this.referenceNode._cacheTextures):(t=this.defaultFramebuffer,n=this._cacheTextures),e===null)return t;if(n.has(e)===!1){let r=t.clone();n.set(e,r)}return n.get(e)}updateReference(e){let t=e.renderer,n=t.getRenderTarget(),r=t.getCanvasTarget(),s=n||r;return this.value=this.getTextureForReference(s),this.value}updateBefore(e){let t=e.renderer,n=t.getRenderTarget(),r=t.getCanvasTarget(),s=n||r;s===null?t.getDrawingBufferSize(Dg):s.getDrawingBufferSize?s.getDrawingBufferSize(Dg):Dg.set(s.width,s.height);let o=this.getTextureForReference(s);(o.image.width!==Dg.width||o.image.height!==Dg.height)&&(o.image.width=Dg.width,o.image.height=Dg.height,o.needsUpdate=!0);let a=o.generateMipmaps;o.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(o),o.generateMipmaps=a}clone(){let e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}},d3e=$n(gx).setParameterLength(0,3),dV=$n(gx,null,null,{generateMipmaps:!0}).setParameterLength(0,3),p3e=dV(),nse=(i=Zu,e=null)=>p3e.sample(i,e),WO=null,g7=class extends gx{static get type(){return"ViewportDepthTextureNode"}constructor(e=Zu,t=null,n=null){n===null&&(WO===null&&(WO=new Cs),n=WO),super(e,t,n)}},pV=$n(g7).setParameterLength(0,3),eh=class i extends Kt{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){let{scope:t}=this;return t===i.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){let{scope:t}=this,n=this.valueNode,r=null;if(t===i.DEPTH_BASE)n!==null&&(r=sse().assign(n));else if(t===i.DEPTH)e.isPerspectiveCamera?r=mV(ys.z,cm,um):r=Zg(ys.z,cm,um);else if(t===i.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){let s=OI(n,cm,um);r=Zg(s,cm,um)}else r=n;else r=Zg(ys.z,cm,um);return r}};eh.DEPTH_BASE="depthBase";eh.DEPTH="depth";eh.LINEAR_DEPTH="linearDepth";var Zg=(i,e,t)=>i.add(e).div(e.sub(t)),m3e=(i,e,t)=>i.add(t).div(t.sub(e)),ise=me(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?t.sub(e).mul(i).sub(t):e.sub(t).mul(i).sub(e)),mV=(i,e,t)=>e.add(i).mul(t).div(t.sub(e).mul(i)),rse=(i,e,t)=>e.mul(i.add(t)).div(i.mul(e.sub(t))),OI=me(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?e.mul(t).div(e.sub(t).mul(i).sub(e)):e.mul(t).div(t.sub(e).mul(i).sub(t))),UI=(i,e,t)=>{e=e.max(1e-6).toVar();let n=xf(i.negate().div(e)),r=xf(t.div(e));return n.div(r)},A3e=(i,e,t)=>{let n=i.mul(MI(t.div(e)));return oe(Math.E).pow(n).mul(e).negate()},sse=$n(eh,eh.DEPTH_BASE),AV=xt(eh,eh.DEPTH),T4=$n(eh,eh.LINEAR_DEPTH).setParameterLength(0,1),g3e=T4(pV());AV.assign=i=>sse(i);var Mf=class i extends Kt{static get type(){return"ClippingNode"}constructor(e=i.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);let t=e.clippingContext,{intersectionPlanes:n,unionPlanes:r}=t;return this.hardwareClipping=e.hardwareClipping,this.scope===i.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(n,r):this.scope===i.HARDWARE?this.setupHardwareClipping(r,e):this.setupDefault(n,r)}setupAlphaToCoverage(e,t){return me(()=>{let n=oe().toVar("distanceToPlane"),r=oe().toVar("distanceToGradient"),s=oe(1).toVar("clipOpacity"),o=t.length;if(this.hardwareClipping===!1&&o>0){let l=$o(t).setGroup(Jt);Oi(o,({i:c})=>{let u=l.element(c);n.assign(ys.dot(u.xyz).negate().add(u.w)),r.assign(n.fwidth().div(2)),s.mulAssign(gc(r.negate(),r,n))})}let a=e.length;if(a>0){let l=$o(e).setGroup(Jt),c=oe(1).toVar("intersectionClipOpacity");Oi(a,({i:u})=>{let f=l.element(u);n.assign(ys.dot(f.xyz).negate().add(f.w)),r.assign(n.fwidth().div(2)),c.mulAssign(gc(r.negate(),r,n).oneMinus())}),s.mulAssign(c.oneMinus())}Bi.a.mulAssign(s),Bi.a.equal(0).discard()})()}setupDefault(e,t){return me(()=>{let n=t.length;if(this.hardwareClipping===!1&&n>0){let s=$o(t).setGroup(Jt);Oi(n,({i:o})=>{let a=s.element(o);ys.dot(a.xyz).greaterThan(a.w).discard()})}let r=e.length;if(r>0){let s=$o(e).setGroup(Jt),o=mc(!0).toVar("clipped");Oi(r,({i:a})=>{let l=s.element(a);o.assign(ys.dot(l.xyz).greaterThan(l.w).and(o))}),o.discard()}})()}setupHardwareClipping(e,t){let n=e.length;return t.enableHardwareClipping(n),me(()=>{let r=$o(e).setGroup(Jt),s=rp(t.getClipDistance());Oi(n,({i:o})=>{let a=r.element(o),l=ys.dot(a.xyz).sub(a.w).negate();s.element(o).assign(l)})})()}};Mf.ALPHA_TO_COVERAGE="alphaToCoverage";Mf.DEFAULT="default";Mf.HARDWARE="hardware";var v3e=()=>new Mf,_3e=()=>new Mf(Mf.ALPHA_TO_COVERAGE),x3e=()=>new Mf(Mf.HARDWARE),y3e=.05,Zee=me(([i])=>Qu(Tn(1e4,Ka(Tn(17,i.x).add(Tn(.1,i.y)))).mul(Ls(.1,fr(Ka(Tn(13,i.y).add(i.x))))))),Kee=me(([i])=>Zee(dt(Zee(i.xy),i.z))),b3e=me(([i])=>{let e=Vr(bf(Rz(i.xyz)),bf(Iz(i.xyz))),t=oe(1).div(oe(y3e).mul(e)).toVar("pixScale"),n=dt(px(yf(xf(t))),px(CI(xf(t)))),r=dt(Kee(yf(n.x.mul(i.xyz))),Kee(yf(n.y.mul(i.xyz)))),s=Qu(xf(t)),o=Ls(Tn(s.oneMinus(),r.x),Tn(s,r.y)),a=Pl(s,s.oneMinus()),l=pe(o.mul(o).div(Tn(2,a).mul(ai(1,a))),o.sub(Tn(.5,a)).div(ai(1,a)),ai(1,ai(1,o).mul(ai(1,o)).div(Tn(2,a).mul(ai(1,a))))),c=o.lessThan(a.oneMinus()).select(o.lessThan(a).select(l.x,l.y),l.z);return Ju(c,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]}),v7=class extends _4{static get type(){return"VertexColorNode"}constructor(e){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){let e=this.index;return"color"+(e>0?e:"")}generate(e){let t=this.getAttributeName(e),n=e.hasGeometryAttribute(t),r;return n===!0?r=super.generate(e):r=e.generateConst(this.nodeType,new xn(1,1,1,1)),r}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}},ose=(i=0)=>new v7(i),Pr=class extends Ws{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.maskNode=null,this.maskShadowNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,this.contextNode=null}_getNodeChildren(){let e=[];for(let t of Object.getOwnPropertyNames(this)){if(t.startsWith("_")===!0)continue;let n=this[t];n&&n.isNode===!0&&e.push({property:t,childNode:n})}return e}customProgramCacheKey(){let e=[];for(let{property:t,childNode:n}of this._getNodeChildren())e.push(wx(t.slice(0,-4)),n.getCacheKey());return this.type+FS(e)}build(e){this.setup(e)}setupObserver(e){return new xU(e)}setup(e){e.context.setupNormal=()=>Yg(this.setupNormal(e),"NORMAL","vec3"),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);let t=e.renderer,n=t.getRenderTarget();e.addStack();let r=this.setupVertex(e),s=Yg(this.vertexNode||r,"VERTEX");e.context.clipSpace=s,e.stack.outputNode=s,this.setupHardwareClipping(e),this.geometryNode!==null&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();let o,a=this.setupClipping(e);if((this.depthWrite===!0||this.depthTest===!0)&&(n!==null?n.depthBuffer===!0&&this.setupDepth(e):t.depth===!0&&this.setupDepth(e)),this.fragmentNode===null){this.setupDiffuseColor(e),this.setupAmbientOcclusion(e),this.setupVariants(e);let l=this.setupLighting(e);a!==null&&e.stack.addToStack(a);let c=Ft(l,Bi.a).max(0);o=this.setupOutput(e,c),lx.assign(o);let u=this.outputNode!==null;if(u&&(o=this.outputNode),e.context.getOutput&&(o=e.context.getOutput(o,e)),n!==null){let f=t.getMRT(),d=this.mrtNode;f!==null?(u&&lx.assign(o),o=f,d!==null&&(o=f.merge(d))):d!==null&&(o=d)}}else{let l=this.fragmentNode;l.isOutputStructNode!==!0&&(l=l.convert(e.getOutputType())),o=this.setupOutput(e,l)}e.stack.outputNode=o,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;let{unionPlanes:t,intersectionPlanes:n}=e.clippingContext,r=null;if(t.length>0||n.length>0){let s=e.renderer.currentSamples;this.alphaToCoverage&&s>1?r=_3e():e.stack.addToStack(v3e())}return r}setupHardwareClipping(e){if(e.hardwareClipping=!1,e.clippingContext===null)return;let t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.addToStack(x3e()),e.hardwareClipping=!0)}setupDepth(e){let{renderer:t,camera:n}=e,r=this.depthNode;if(r===null){let s=t.getMRT();s&&s.has("depth")?r=s.get("depth"):t.logarithmicDepthBuffer===!0&&(n.isPerspectiveCamera?r=UI(ys.z,cm,um):r=Zg(ys.z,cm,um))}r!==null&&AV.assign(r).toStack()}setupPositionView(){return Ef.mul(Cr).xyz}setupModelViewProjection(){return Ja.mul(ys)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),Hre}setupPosition(e){let{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&ese(t),t.isSkinnedMesh===!0&&Qre(t),this.displacementMap){let r=Zd("displacementMap","texture"),s=Zd("displacementScale","float"),o=Zd("displacementBias","float");Cr.addAssign(wa.normalize().mul(r.x.mul(s).add(o)))}return t.isBatchedMesh&&Yre(t),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&$re(t),this.positionNode!==null&&Cr.assign(Yg(this.positionNode,"POSITION","vec3")),Cr}setupDiffuseColor(e){let{object:t,geometry:n}=e;this.maskNode!==null&&mc(this.maskNode).not().discard();let r=this.colorNode?Ft(this.colorNode):vre;this.vertexColors===!0&&n.hasAttribute("color")&&(r=r.mul(ose())),t.instanceColor&&(r=uV.mul(r)),t.isBatchedMesh&&t._colorsTexture&&(r=hV.mul(r)),Bi.assign(r);let s=this.opacityNode?oe(this.opacityNode):rV;Bi.a.assign(Bi.a.mul(s));let o=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(o=this.alphaTestNode!==null?oe(this.alphaTestNode):gre,this.alphaToCoverage===!0?(Bi.a=gc(o,o.add(Lz(Bi.a)),Bi.a),Bi.a.lessThanEqual(0).discard()):Bi.a.lessThanEqual(o).discard()),this.alphaHash===!0&&Bi.a.lessThan(b3e(Cr)).discard(),e.isOpaque()&&Bi.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?pe(0):Bi.rgb}setupNormal(){return this.normalNode?pe(this.normalNode):Tre}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Zd("envMap","cubeTexture"):Zd("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new A7(cV)),t}setupMaterialLightings(e){let t=[];if(e.renderer.lighting.enabled===!1)return t;let n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);let r=this.setupLightMap(e);return r&&r.isLightingNode&&t.push(r),e.context.ambientOcclusion&&t.push(new p7(e.context.ambientOcclusion)),t}setupAmbientOcclusion(e){let t=this.aoNode;t===null&&e.material.aoMap&&(t=qre),e.context.getAO&&(t=e.context.getAO(t,e)),t!==null&&(PU.assign(t),e.context.ambientOcclusion=PU)}setupLightingModel(){}setupLighting(e){let{material:t}=e,{backdropNode:n,backdropAlphaNode:r,emissiveNode:s}=this,o=this.lights===!0||this.lightsNode!==null,a=this.lights===!0?this.setupMaterialLightings(e):[],l=o?this.lightsNode||e.lightsNode:null,c=this.setupOutgoingLight(e);if(l&&(a.length>0||l.getScope().hasLights)){let u=this.setupLightingModel(e)||null;c=tse(l,u,a,n,r)}else n!==null&&(c=pe(r!==null?Qn(c,n,r):n));return(s&&s.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(IU.assign(pe(s||xre)),c=c.add(IU)),c}setupFog(e,t){let n=e.fogNode;return n&&(lx.assign(t),t=Ft(n.toVar())),t}setupPremultipliedAlpha(e,t){return Wz(t)}setupOutput(e,t){return this.fog===!0&&(t=this.setupFog(e,t)),this.premultipliedAlpha===!0&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(let n in e){let r=e[n];this[n]===void 0&&(this[n]=r,r&&r.clone&&(this[n]=r.clone()))}let t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(let n in t)Object.getOwnPropertyDescriptor(this.constructor.prototype,n)===void 0&&t[n].get!==void 0&&Object.defineProperty(this.constructor.prototype,n,t[n])}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{},nodes:{}});let n=Ws.prototype.toJSON.call(this,e);n.inputNodes={};for(let{property:s,childNode:o}of this._getNodeChildren())n.inputNodes[s]=o.toJSON(e).uuid;function r(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=r(e.textures),o=r(e.images),a=r(e.nodes);s.length>0&&(n.textures=s),o.length>0&&(n.images=o),a.length>0&&(n.nodes=a)}return n}copy(e){let t=Object.getOwnPropertyDescriptors(this.constructor.prototype);for(let n in t)if(t[n].set!==void 0&&e[n]!==void 0){let r=e[n];this[n]&&this[n].copy!==void 0?this[n].copy(r):this[n]=r}for(let n in this)if(!/^(?:is[A-Z]|_)|^(?:id|uuid|version|type|userData|clippingPlanes)$/.test(n)&&this[n]!==void 0&&e[n]!==void 0){let r=e[n];this[n]&&this[n].copy!==void 0?this[n].copy(r):this[n]=r}return this.clippingPlanes=e.clippingPlanes?e.clippingPlanes.map(n=>n.clone()):null,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},w3e=new Fu,_7=class extends Pr{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(w3e),this.setValues(e)}},S3e=new ib,x7=class extends Pr{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(S3e),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){let e=this.offsetNode?oe(this.offsetNode):lV,t=this.dashScaleNode?oe(this.dashScaleNode):sV,n=this.dashSizeNode?oe(this.dashSizeNode):oV,r=this.gapSizeNode?oe(this.gapSizeNode):aV;$g.assign(n),AS.assign(r);let s=bm(pc("lineDistance").mul(t));(e?s.add(e):s).mod($g.add(AS)).greaterThan($g).discard()}};var i4=u1("vec3","worldStart"),y7=u1("vec3","worldEnd"),ase=u1("float","lineDistance"),kg=u1("vec4","worldPos"),Qee=me(({start:i,end:e})=>{let t=Ja.element(2).element(2),n=Ja.element(3).element(2);return t.greaterThan(0).select(n.negate().div(t.add(1)),n.mul(-.5).div(t)).sub(i.z).div(e.z.sub(i.z))},{start:"vec4",end:"vec4",return:"float"}),T3e=me(({p1:i,p2:e,p3:t,p4:n})=>{let r=i.sub(t),s=n.sub(t),o=e.sub(i),a=r.dot(s),l=s.dot(o),c=r.dot(o),u=s.dot(s),d=o.dot(o).mul(u).sub(l.mul(l)),y=a.mul(l).sub(c.mul(u)).div(d).clamp(),w=a.add(l.mul(y)).div(u).clamp();return dt(y,w)},{p1:"vec3",p2:"vec3",p3:"vec3",p4:"vec3",return:"vec2"}),Slt=me(({material:i})=>{let e=i._useDash,t=i._useWorldUnits,n=pc("instanceStart"),r=pc("instanceEnd"),s=Ft(Ef.mul(Ft(n,1))).toVar("start"),o=Ft(Ef.mul(Ft(r,1))).toVar("end"),a,l;e&&(a=oe(pc("instanceDistanceStart")).toVar("distanceStart"),l=oe(pc("instanceDistanceEnd")).toVar("distanceEnd")),t&&(i4.assign(s.xyz),y7.assign(o.xyz));let c=fx.z.div(fx.w),u=Ja.element(2).element(3).equal(-1);if($t(u,()=>{$t(s.z.lessThan(0).and(o.z.greaterThan(0)),()=>{let T=Qee({start:s,end:o});o.assign(Ft(Qn(s.xyz,o.xyz,T),o.w)),e&&l.assign(Qn(a,l,T))}).ElseIf(o.z.lessThan(0).and(s.z.greaterThanEqual(0)),()=>{let T=Qee({start:o,end:s});s.assign(Ft(Qn(o.xyz,s.xyz,T),s.w)),e&&a.assign(Qn(l,a,T))})}),e){let T=i.dashScaleNode?oe(i.dashScaleNode):sV,R=i.offsetNode?oe(i.offsetNode):lV,P=va.y.lessThan(.5).select(T.mul(a),T.mul(l));P=P.add(R),ase.assign(P)}let f=Ja.mul(s),d=Ja.mul(o),A=f.xyz.div(f.w),y=d.xyz.div(d.w),w=y.xy.sub(A.xy).toVar();w.x.assign(w.x.mul(c)),w.assign(w.normalize());let S=Ft().toVar();if(t){let T=o.xyz.sub(s.xyz).normalize(),R=Qn(s.xyz,o.xyz,.5).normalize(),P=T.cross(R).normalize(),I=T.cross(P);kg.assign(va.y.lessThan(.5).select(s,o));let F=b4.mul(.5);kg.addAssign(Ft(va.x.lessThan(0).select(P.mul(F),P.mul(F).negate()),0)),e||(kg.addAssign(Ft(va.y.lessThan(.5).select(T.mul(F).negate(),T.mul(F)),0)),kg.addAssign(Ft(I.mul(F),0)),$t(va.y.greaterThan(1).or(va.y.lessThan(0)),()=>{kg.subAssign(Ft(I.mul(2).mul(F),0))})),S.assign(Ja.mul(kg));let D=pe().toVar();D.assign(va.y.lessThan(.5).select(A,y)),S.z.assign(D.z.mul(S.w))}else{let T=dt(w.y,w.x.negate()).toVar("offset");w.x.assign(w.x.div(c)),T.x.assign(T.x.div(c)),T.assign(va.x.lessThan(0).select(T.negate(),T)),$t(va.y.lessThan(0),()=>{T.assign(T.sub(w))}).ElseIf(va.y.greaterThan(1),()=>{T.assign(T.add(w))}),T.assign(T.mul(b4)),T.assign(T.div(fx.w.div(Yz))),S.assign(va.y.lessThan(.5).select(f,d)),T.assign(T.mul(S.w)),S.assign(S.add(Ft(T,0,0)))}return S})(),Tlt=me(({material:i,renderer:e})=>{let t=i._useAlphaToCoverage,n=i._useDash,r=i._useWorldUnits,s=Ui();if(n){let a=i.dashSizeNode?oe(i.dashSizeNode):oV,l=i.gapSizeNode?oe(i.gapSizeNode):aV;$g.assign(a),AS.assign(l),s.y.lessThan(-1).or(s.y.greaterThan(1)).discard(),ase.mod($g.add(AS)).greaterThan($g).discard()}let o=oe(1).toVar("alpha");if(r){let a=kg.xyz.normalize().mul(1e5),l=y7.sub(i4),c=T3e({p1:i4,p2:y7,p3:pe(0,0,0),p4:a}),u=i4.add(l.mul(c.x)),f=a.mul(c.y),y=u.sub(f).length().div(b4);if(!n)if(t&&e.currentSamples>0){let w=y.fwidth();o.assign(gc(w.negate().add(.5),w.add(.5),y).oneMinus())}else y.greaterThan(.5).discard()}else if(t&&e.currentSamples>0){let a=s.x,l=s.y.greaterThan(0).select(s.y.sub(1),s.y.add(1)),c=a.mul(a).add(l.mul(l)),u=oe(c.fwidth()).toVar("dlen");$t(s.y.abs().greaterThan(1),()=>{o.assign(gc(u.oneMinus(),u.add(1),c).oneMinus())})}else $t(s.y.abs().greaterThan(1),()=>{let a=s.x,l=s.y.greaterThan(0).select(s.y.sub(1),s.y.add(1));a.mul(a).add(l.mul(l)).greaterThan(1).discard()});return o})();var E3e=new tb,b7=class extends Pr{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(E3e),this.setValues(e)}setupDiffuseColor(){let e=this.opacityNode?oe(this.opacityNode):rV;Bi.assign(II(Ft(nV(hi),e),Br))}},gV=me(([i=Kz])=>{let e=i.z.atan(i.x).mul(1/(Math.PI*2)).add(.5),t=i.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return dt(e,t)}),w7=me(([i=Ui()])=>{let e=i.x.sub(.5).mul(Math.PI*2),t=i.y.sub(.5).mul(Math.PI),n=t.cos(),r=n.mul(e.cos()),s=t.sin(),o=n.mul(e.sin());return pe(r,s,o)}),E4=class extends Ba{constructor(e=1,t={}){super(e,e,t),this.isCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Nh(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){let n=t.minFilter,r=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let s=new Bu(5,5,5),o=gV(Kz),a=new Pr;a.colorNode=fi(t,o,0),a.side=mi,a.blending=ms;let l=new Hn(s,a),c=new o0;c.add(l),t.minFilter===Go&&(t.minFilter=Mi);let u=new l_(1,10,this),f=e.getMRT();return e.setMRT(null),u.update(e,c),e.setMRT(f),t.minFilter=n,t.generateMipmaps=r,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}},uS=new WeakMap,S7=class extends Ir{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=Qa(null);let t=new Nh;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=yn.RENDER}updateBefore(e){let{renderer:t,material:n}=e,r=this.envNode;if(r.isTextureNode||r.isMaterialReferenceNode){let s=r.isTextureNode?r.value:n[r.property];if(s&&s.isTexture){let o=s.mapping;if(o===m0||o===A0){if(uS.has(s)){let a=uS.get(s);Jee(a,s.mapping),this._cubeTexture=a}else{let a=s.image;if(M3e(a)){let l=new E4(a.height);l.fromEquirectangularTexture(t,s),Jee(l.texture,s.mapping),this._cubeTexture=l.texture,uS.set(s,l.texture),s.addEventListener("dispose",lse)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}};function M3e(i){return i==null?!1:i.height>0}function lse(i){let e=i.target;e.removeEventListener("dispose",lse);let t=uS.get(e);t!==void 0&&(uS.delete(e),t.dispose())}function Jee(i,e){e===m0?i.mapping=nc:e===A0&&(i.mapping=jc)}var cse=$n(S7).setParameterLength(1),xS=class extends xm{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=cse(this.envNode)}},T7=class extends xm{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){let t=oe(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}},vx=class{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}},M4=class extends vx{constructor(){super()}indirect({context:e}){let t=e.ambientOcclusion,n=e.reflectedLight,r=e.irradianceLightMap;n.indirectDiffuse.assign(Ft(0)),r?n.indirectDiffuse.addAssign(r):n.indirectDiffuse.addAssign(Ft(1,1,1,0)),n.indirectDiffuse.mulAssign(t),n.indirectDiffuse.mulAssign(Bi.rgb)}finish(e){let{material:t,context:n}=e,r=n.outgoingLight,s=e.context.environment;if(s)switch(t.combine){case ng:r.rgb.assign(Qn(r.rgb,r.rgb.mul(s.rgb),cS.mul(n4)));break;case zM:r.rgb.assign(Qn(r.rgb,s.rgb,cS.mul(n4)));break;case VM:r.rgb.addAssign(s.rgb.mul(cS.mul(n4)));break;default:Xe("BasicLightingModel: Unsupported .combine value:",t.combine);break}}},C3e=new ds,E7=class extends Pr{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(C3e),this.setValues(e)}setupNormal(){return f1(mx)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new xS(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new T7(cV)),t}setupOutgoingLight(){return Bi.rgb}setupLightingModel(){return new M4}},_x=me(({f0:i,f90:e,dotVH:t})=>{let n=t.mul(-5.55473).sub(6.98316).mul(t).exp2();return i.mul(n.oneMinus()).add(e.mul(n))}),r1=me(i=>i.diffuseColor.mul(1/Math.PI)),R3e=()=>oe(.25),I3e=me(({dotNH:i})=>f4.mul(oe(.5)).add(1).mul(oe(1/Math.PI)).mul(i.pow(f4))),P3e=me(({lightDirection:i})=>{let e=i.add(er).normalize(),t=hi.dot(e).clamp(),n=er.dot(e).clamp(),r=_x({f0:vm,f90:1,dotVH:n}),s=R3e(),o=I3e({dotNH:t});return r.mul(s).mul(o)}),C4=class extends M4{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=hi.dot(e).clamp().mul(t);n.directDiffuse.addAssign(s.mul(r1({diffuseColor:Bi.rgb}))),this.specular===!0&&n.directSpecular.addAssign(s.mul(P3e({lightDirection:e})).mul(cS))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(r1({diffuseColor:Bi}))),r.indirectDiffuse.mulAssign(t)}},L3e=new Ga,M7=class extends Pr{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(L3e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new xS(t):null}setupLightingModel(){return new C4(!1)}},D3e=new KA,C7=class extends Pr{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(D3e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new xS(t):null}setupLightingModel(){return new C4}setupVariants(){let e=(this.shininessNode?oe(this.shininessNode):_re).max(1e-4);f4.assign(e);let t=this.specularNode||yre;vm.assign(t)}},use=me(i=>{if(i.geometry.hasAttribute("normal")===!1)return oe(0);let e=mx.dFdx().abs().max(mx.dFdy().abs());return e.x.max(e.y).max(e.z)}),vV=me(i=>{let{roughness:e}=i,t=use(),n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),hse=me(({alpha:i,dotNL:e,dotNV:t})=>{let n=i.pow2(),r=e.mul(n.add(n.oneMinus().mul(t.pow2())).sqrt()),s=t.mul(n.add(n.oneMinus().mul(e.pow2())).sqrt());return Ac(.5,r.add(s).max(EI))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),N3e=me(({alphaT:i,alphaB:e,dotTV:t,dotBV:n,dotTL:r,dotBL:s,dotNV:o,dotNL:a})=>{let l=a.mul(pe(i.mul(t),e.mul(n),o).length()),c=o.mul(pe(i.mul(r),e.mul(s),a).length());return Ac(.5,l.add(c).max(EI))}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),fse=me(({alpha:i,dotNH:e})=>{let t=i.pow2(),n=e.pow2().mul(t.oneMinus()).oneMinus();return t.div(n.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),F3e=oe(1/Math.PI),B3e=me(({alphaT:i,alphaB:e,dotNH:t,dotTH:n,dotBH:r})=>{let s=i.mul(e),o=pe(e.mul(n),i.mul(r),s.mul(t)),a=o.dot(o),l=s.div(a);return F3e.mul(s.mul(l.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),_V=me(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,normalView:s=hi,USE_IRIDESCENCE:o,USE_ANISOTROPY:a})=>{let l=n.pow2(),c=i.add(er).normalize(),u=s.dot(i).clamp(),f=s.dot(er).clamp(),d=s.dot(c).clamp(),A=er.dot(c).clamp(),y=_x({f0:e,f90:t,dotVH:A}),w,S;if(dx(o)&&(y=wI.mix(y,r)),dx(a)){let T=aS.dot(i),R=aS.dot(er),P=aS.dot(c),I=Xg.dot(i),F=Xg.dot(er),D=Xg.dot(c);w=N3e({alphaT:h4,alphaB:l,dotTV:R,dotBV:F,dotTL:T,dotBL:I,dotNV:f,dotNL:u}),S=B3e({alphaT:h4,alphaB:l,dotNH:d,dotTH:P,dotBH:D})}else w=hse({alpha:l,dotNL:u,dotNV:f}),S=fse({alpha:l,dotNH:d});return y.mul(w).mul(S)}),O3e=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),ff=null,yS=me(({roughness:i,dotNV:e})=>{ff===null&&(ff=new WA(O3e,16,16,js,Wi),ff.name="DFG_LUT",ff.minFilter=Mi,ff.magFilter=Mi,ff.wrapS=la,ff.wrapT=la,ff.generateMipmaps=!1,ff.needsUpdate=!0);let t=dt(i,e);return fi(ff,t).rg}),U3e=me(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o})=>{let a=_V({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o}),l=hi.dot(i).clamp(),c=hi.dot(er).clamp(),u=yS({roughness:n,dotNV:c}),f=yS({roughness:n,dotNV:l}),d=e.mul(u.x).add(t.mul(u.y)),A=e.mul(f.x).add(t.mul(f.y)),y=u.x.add(u.y),w=f.x.add(f.y),S=oe(1).sub(y),T=oe(1).sub(w),R=e.add(e.oneMinus().mul(.047619)),P=d.mul(A).mul(R).div(oe(1).sub(S.mul(T).mul(R).mul(R)).add(EI)),I=S.mul(T),F=P.mul(I);return a.add(F)}),dse=me(i=>{let{dotNV:e,specularColor:t,specularF90:n,roughness:r}=i,s=yS({dotNV:e,roughness:r});return t.mul(s.x).add(n.mul(s.y))}),R7=me(({f:i,f90:e,dotVH:t})=>{let n=t.oneMinus().saturate(),r=n.mul(n),s=n.mul(r,r).clamp(0,.9999);return i.sub(pe(e).mul(s)).div(s.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),k3e=me(({roughness:i,dotNH:e})=>{let t=i.pow2(),n=oe(1).div(t),s=e.pow2().oneMinus().max(.0078125);return oe(2).add(n).mul(s.pow(n.mul(.5))).div(2*Math.PI)}).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),z3e=me(({dotNV:i,dotNL:e})=>oe(1).div(oe(4).mul(e.add(i).sub(e.mul(i))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),V3e=me(({lightDirection:i})=>{let e=i.add(er).normalize(),t=hi.dot(i).clamp(),n=hi.dot(er).clamp(),r=hi.dot(e).clamp(),s=k3e({roughness:lm,dotNH:r}),o=z3e({dotNV:n,dotNL:t});return hc.mul(s).mul(o)}),ete=me(({N:i,V:e,roughness:t})=>{let s=.0078125,o=i.dot(e).saturate(),a=dt(t,o.oneMinus().sqrt());return a.assign(a.mul(.984375).add(s)),a}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),G3e=me(({f:i})=>{let e=i.length();return Vr(e.mul(e).add(i.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),SR=me(({v1:i,v2:e})=>{let t=i.dot(e),n=t.abs().toVar(),r=n.mul(.0145206).add(.4965155).mul(n).add(.8543985).toVar(),s=n.add(4.1616724).mul(n).add(3.417594).toVar(),o=r.div(s),a=t.greaterThan(0).select(o,Vr(t.mul(t).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(o));return i.cross(e).mul(a)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),jO=me(({N:i,V:e,P:t,mInv:n,p0:r,p1:s,p2:o,p3:a})=>{let l=s.sub(r).toVar(),c=a.sub(r).toVar(),u=l.cross(c),f=pe().toVar();return $t(u.dot(t.sub(r)).greaterThanEqual(0),()=>{let d=e.sub(i.mul(e.dot(i))).normalize(),A=i.cross(d).negate(),y=n.mul(To(d,A,i).transpose()).toVar(),w=y.mul(r.sub(t)).normalize().toVar(),S=y.mul(s.sub(t)).normalize().toVar(),T=y.mul(o.sub(t)).normalize().toVar(),R=y.mul(a.sub(t)).normalize().toVar(),P=pe(0).toVar();P.addAssign(SR({v1:w,v2:S})),P.addAssign(SR({v1:S,v2:T})),P.addAssign(SR({v1:T,v2:R})),P.addAssign(SR({v1:R,v2:w})),f.assign(pe(G3e({f:P})))}),f}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]});var kI=1/6,pse=i=>Tn(kI,Tn(i,Tn(i,i.negate().add(3)).sub(3)).add(1)),I7=i=>Tn(kI,Tn(i,Tn(i,Tn(3,i).sub(6))).add(4)),mse=i=>Tn(kI,Tn(i,Tn(i,Tn(-3,i).add(3)).add(3)).add(1)),P7=i=>Tn(kI,ru(i,3)),tte=i=>pse(i).add(I7(i)),nte=i=>mse(i).add(P7(i)),ite=i=>Ls(-1,I7(i).div(pse(i).add(I7(i)))),rte=i=>Ls(1,P7(i).div(mse(i).add(P7(i)))),ste=(i,e,t)=>{let n=i.uvNode,r=Tn(n,e.zw).add(.5),s=yf(r),o=Qu(r),a=tte(o.x),l=nte(o.x),c=ite(o.x),u=rte(o.x),f=ite(o.y),d=rte(o.y),A=dt(s.x.add(c),s.y.add(f)).sub(.5).mul(e.xy),y=dt(s.x.add(u),s.y.add(f)).sub(.5).mul(e.xy),w=dt(s.x.add(c),s.y.add(d)).sub(.5).mul(e.xy),S=dt(s.x.add(u),s.y.add(d)).sub(.5).mul(e.xy),T=tte(o.y).mul(Ls(a.mul(i.sample(A).level(t)),l.mul(i.sample(y).level(t)))),R=nte(o.y).mul(Ls(a.mul(i.sample(w).level(t)),l.mul(i.sample(S).level(t))));return T.add(R)},xV=me(([i,e])=>{let t=dt(i.size(de(e))),n=dt(i.size(de(e.add(1)))),r=Ac(1,t),s=Ac(1,n),o=ste(i,Ft(r,t),yf(e)),a=ste(i,Ft(s,n),CI(e));return Qu(e).mix(o,a)}),q3e=me(([i,e])=>{let t=e.mul(Xz(i));return xV(i,t)}),ote=me(([i,e,t,n,r])=>{let s=pe(Bz(e.negate(),ya(i),Ac(1,n))),o=pe(bf(r[0].xyz),bf(r[1].xyz),bf(r[2].xyz));return ya(s).mul(t.mul(o))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),H3e=me(([i,e])=>i.mul(Ju(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),W3e=dV(),j3e=nse(),ate=me(([i,e,t],{material:n})=>{let s=(n.side===mi?W3e:j3e).sample(i),o=xf(n1.x).mul(H3e(e,t));return xV(s,o)}),lte=me(([i,e,t])=>($t(t.notEqual(0),()=>{let n=MI(e).negate().div(t);return wz(n.negate().mul(i))}),pe(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),X3e=me(([i,e,t,n,r,s,o,a,l,c,u,f,d,A,y])=>{let w,S;if(y){w=Ft().toVar(),S=pe().toVar();let F=u.sub(1).mul(y.mul(.025)),D=pe(u.sub(F),u,u.add(F));Oi({start:0,end:3},({i:L})=>{let C=D.element(L),B=ote(i,e,f,C,a),k=o.add(B),z=c.mul(l.mul(Ft(k,1))),G=dt(z.xy.div(z.w)).toVar();G.addAssign(1),G.divAssign(2),G.assign(dt(G.x,G.y.oneMinus()));let W=ate(G,t,C);w.element(L).assign(W.element(L)),w.a.addAssign(W.a),S.element(L).assign(n.element(L).mul(lte(bf(B),d,A).element(L)))}),w.a.divAssign(3)}else{let F=ote(i,e,f,u,a),D=o.add(F),L=c.mul(l.mul(Ft(D,1))),C=dt(L.xy.div(L.w)).toVar();C.addAssign(1),C.divAssign(2),C.assign(dt(C.x,C.y.oneMinus())),w=ate(C,t,u),S=n.mul(lte(bf(F),d,A))}let T=S.rgb.mul(w.rgb),R=i.dot(e).clamp(),P=pe(dse({dotNV:R,specularColor:r,specularF90:s,roughness:t})),I=S.r.add(S.g,S.b).div(3);return Ft(P.oneMinus().mul(T),w.a.oneMinus().mul(I).oneMinus())}),$3e=To(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),Y3e=i=>{let e=i.sqrt();return pe(1).add(e).div(pe(1).sub(e))},cte=(i,e)=>i.sub(e).div(i.add(e)).pow2(),Z3e=(i,e)=>{let t=i.mul(2*Math.PI*1e-9),n=pe(54856e-17,44201e-17,52481e-17),r=pe(1681e3,1795300,2208400),s=pe(43278e5,93046e5,66121e5),o=oe(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(t.mul(2239900).add(e.x).cos()).mul(t.pow2().mul(-45282e5).exp()),a=n.mul(s.mul(2*Math.PI).sqrt()).mul(r.mul(t).add(e).cos()).mul(t.pow2().negate().mul(s).exp());return a=pe(a.x.add(o),a.y,a.z).div(10685e-11),$3e.mul(a)},ute=me(({outsideIOR:i,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:r})=>{let s=Qn(i,e,gc(0,.03,n)),a=i.div(s).pow2().mul(t.pow2().oneMinus()).oneMinus();$t(a.lessThan(0),()=>pe(1));let l=a.sqrt(),c=cte(s,i),u=_x({f0:c,f90:1,dotVH:t}),f=u.oneMinus(),d=s.lessThan(i).select(Math.PI,0),A=oe(Math.PI).sub(d),y=Y3e(r.clamp(0,.9999)),w=cte(y,s.toVec3()),S=_x({f0:w,f90:1,dotVH:l}),T=pe(y.x.lessThan(s).select(Math.PI,0),y.y.lessThan(s).select(Math.PI,0),y.z.lessThan(s).select(Math.PI,0)),R=s.mul(n,l,2),P=pe(A).add(T),I=u.mul(S).clamp(1e-5,.9999),F=I.sqrt(),D=f.pow2().mul(S).div(pe(1).sub(I)),C=u.add(D).toVar(),B=D.sub(f).toVar();return Oi({start:1,end:2,condition:"<=",name:"m"},({m:k})=>{B.mulAssign(F);let z=Z3e(oe(k).mul(R),oe(k).mul(P)).mul(2);C.addAssign(B.mul(z))}),C.max(pe(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),Vw=me(({normal:i,viewDir:e,roughness:t})=>{let n=i.dot(e).saturate(),r=t.mul(t),s=t.add(.1).reciprocal(),o=oe(-1.9362).add(t.mul(1.0678)).add(r.mul(.4573)).sub(s.mul(.8469)),a=oe(-.6014).add(t.mul(.5538)).sub(r.mul(.467)).sub(s.mul(.1255));return o.mul(n).add(a).exp().saturate()}),Gw=pe(.04),TR=oe(1),R4=class extends vx{constructor(e=!1,t=!1,n=!1,r=!1,s=!1,o=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=n,this.anisotropy=r,this.transmission=s,this.dispersion=o,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null,this.iridescenceF0Dielectric=null,this.iridescenceF0Metallic=null}start(e){if(this.clearcoat===!0&&(this.clearcoatRadiance=pe().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=pe().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=pe().toVar("clearcoatSpecularIndirect")),this.sheen===!0&&(this.sheenSpecularDirect=pe().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=pe().toVar("sheenSpecularIndirect")),this.iridescence===!0){let t=hi.dot(er).clamp(),n=ute({outsideIOR:oe(1),eta2:c4,cosTheta1:t,thinFilmThickness:u4,baseF0:vm}),r=ute({outsideIOR:oe(1),eta2:c4,cosTheta1:t,thinFilmThickness:u4,baseF0:Bi.rgb});this.iridescenceFresnel=Qn(n,r,Qd),this.iridescenceF0Dielectric=R7({f:n,f90:1,dotVH:t}),this.iridescenceF0Metallic=R7({f:r,f90:1,dotVH:t}),this.iridescenceF0=Qn(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,Qd)}if(this.transmission===!0){let t=wf,n=Wie.sub(wf).normalize(),r=Tm,s=e.context;s.backdrop=X3e(r,n,vf,zg,Gg,qg,t,su,Sm,Ja,lS,vz,xz,_z,this.dispersion?yz:null),s.backdropAlpha=d4,Bi.a.mulAssign(Qn(1,s.backdrop.a,d4))}super.start(e)}computeMultiscattering(e,t,n,r,s=null){let o=hi.dot(er).clamp(),a=yS({roughness:vf,dotNV:o}),l=s?wI.mix(r,s):r,c=l.mul(a.x).add(n.mul(a.y)),f=a.x.add(a.y).oneMinus(),d=l.add(l.oneMinus().mul(.047619)),A=c.mul(d).div(f.mul(d).oneMinus());e.addAssign(c),t.addAssign(A.mul(f))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=hi.dot(e).clamp().mul(t).toVar();if(this.sheen===!0){this.sheenSpecularDirect.addAssign(s.mul(V3e({lightDirection:e})));let o=Vw({normal:hi,viewDir:er,roughness:lm}),a=Vw({normal:hi,viewDir:e,roughness:lm}),l=hc.r.max(hc.g).max(hc.b).mul(o.max(a)).oneMinus();s.mulAssign(l)}if(this.clearcoat===!0){let a=hm.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(a.mul(_V({lightDirection:e,f0:Gw,f90:TR,roughness:ax,normalView:hm})))}n.directDiffuse.addAssign(s.mul(r1({diffuseColor:zg}))),n.directSpecular.addAssign(s.mul(U3e({lightDirection:e,f0:Gg,f90:1,roughness:vf,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:n,halfHeight:r,reflectedLight:s,ltc_1:o,ltc_2:a}){let l=t.add(n).sub(r),c=t.sub(n).sub(r),u=t.sub(n).add(r),f=t.add(n).add(r),d=hi,A=er,y=ys.toVar(),w=ete({N:d,V:A,roughness:vf}),S=o.sample(w).toVar(),T=a.sample(w).toVar(),R=To(pe(S.x,0,S.y),pe(0,1,0),pe(S.z,0,S.w)).toVar(),P=Gg.mul(T.x).add(qg.sub(Gg).mul(T.y)).toVar();if(s.directSpecular.addAssign(e.mul(P).mul(jO({N:d,V:A,P:y,mInv:R,p0:l,p1:c,p2:u,p3:f}))),s.directDiffuse.addAssign(e.mul(zg).mul(jO({N:d,V:A,P:y,mInv:To(1,0,0,0,1,0,0,0,1),p0:l,p1:c,p2:u,p3:f}))),this.clearcoat===!0){let I=hm,F=ete({N:I,V:A,roughness:ax}),D=o.sample(F),L=a.sample(F),C=To(pe(D.x,0,D.y),pe(0,1,0),pe(D.z,0,D.w)),B=Gw.mul(L.x).add(TR.sub(Gw).mul(L.y));this.clearcoatSpecularDirect.addAssign(e.mul(B).mul(jO({N:I,V:A,P:y,mInv:C,p0:l,p1:c,p2:u,p3:f})))}}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e),this.ambientOcclusion(e)}indirectDiffuse(e){let{irradiance:t,reflectedLight:n}=e.context,r=t.mul(r1({diffuseColor:zg})).toVar();if(this.sheen===!0){let s=Vw({normal:hi,viewDir:er,roughness:lm}),o=hc.r.max(hc.g).max(hc.b).mul(s).oneMinus();r.mulAssign(o)}n.indirectDiffuse.addAssign(r)}indirectSpecular(e){let{radiance:t,iblIrradiance:n,reflectedLight:r}=e.context;if(this.sheen===!0&&this.sheenSpecularIndirect.addAssign(n.mul(hc,Vw({normal:hi,viewDir:er,roughness:lm}))),this.clearcoat===!0){let S=hm.dot(er).clamp(),T=dse({dotNV:S,specularColor:Gw,specularF90:TR,roughness:ax});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(T))}let s=pe().toVar("singleScatteringDielectric"),o=pe().toVar("multiScatteringDielectric"),a=pe().toVar("singleScatteringMetallic"),l=pe().toVar("multiScatteringMetallic");this.computeMultiscattering(s,o,qg,vm,this.iridescenceF0Dielectric),this.computeMultiscattering(a,l,qg,Bi.rgb,this.iridescenceF0Metallic);let c=Qn(s,a,Qd),u=Qn(o,l,Qd),f=s.add(o),d=zg.mul(f.oneMinus()),A=n.mul(1/Math.PI),y=t.mul(c).add(u.mul(A)).toVar(),w=d.mul(A).toVar();if(this.sheen===!0){let S=Vw({normal:hi,viewDir:er,roughness:lm}),T=hc.r.max(hc.g).max(hc.b).mul(S).oneMinus();y.mulAssign(T),w.mulAssign(T)}r.indirectSpecular.addAssign(y),r.indirectDiffuse.addAssign(w)}ambientOcclusion(e){let{ambientOcclusion:t,reflectedLight:n}=e.context,s=hi.dot(er).clamp().add(t),o=vf.mul(-16).oneMinus().negate().exp2(),a=t.sub(s.pow(o).oneMinus()).clamp();this.clearcoat===!0&&this.clearcoatSpecularIndirect.mulAssign(t),this.sheen===!0&&this.sheenSpecularIndirect.mulAssign(t),n.indirectDiffuse.mulAssign(t),n.indirectSpecular.mulAssign(a)}finish({context:e}){let{outgoingLight:t}=e;if(this.clearcoat===!0){let n=hm.dot(er).clamp(),r=_x({dotVH:n,f0:Gw,f90:TR}),s=t.mul(l4.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(l4));t.assign(s)}if(this.sheen===!0){let n=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(n)}}},hte=oe(1),L7=oe(-2),ER=oe(.8),XO=oe(-1),MR=oe(.4),$O=oe(2),CR=oe(.305),YO=oe(3),fte=oe(.21),K3e=oe(4),dte=oe(4),Q3e=oe(16),J3e=me(([i])=>{let e=pe(fr(i)).toVar(),t=oe(-1).toVar();return $t(e.x.greaterThan(e.z),()=>{$t(e.x.greaterThan(e.y),()=>{t.assign(xa(i.x.greaterThan(0),0,3))}).Else(()=>{t.assign(xa(i.y.greaterThan(0),1,4))})}).Else(()=>{$t(e.z.greaterThan(e.y),()=>{t.assign(xa(i.z.greaterThan(0),2,5))}).Else(()=>{t.assign(xa(i.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),eMe=me(([i,e])=>{let t=dt().toVar();return $t(e.equal(0),()=>{t.assign(dt(i.z,i.y).div(fr(i.x)))}).ElseIf(e.equal(1),()=>{t.assign(dt(i.x.negate(),i.z.negate()).div(fr(i.y)))}).ElseIf(e.equal(2),()=>{t.assign(dt(i.x.negate(),i.y).div(fr(i.z)))}).ElseIf(e.equal(3),()=>{t.assign(dt(i.z.negate(),i.y).div(fr(i.x)))}).ElseIf(e.equal(4),()=>{t.assign(dt(i.x.negate(),i.z).div(fr(i.y)))}).Else(()=>{t.assign(dt(i.x,i.y).div(fr(i.z)))}),Tn(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),tMe=me(([i])=>{let e=oe(0).toVar();return $t(i.greaterThanEqual(ER),()=>{e.assign(hte.sub(i).mul(XO.sub(L7)).div(hte.sub(ER)).add(L7))}).ElseIf(i.greaterThanEqual(MR),()=>{e.assign(ER.sub(i).mul($O.sub(XO)).div(ER.sub(MR)).add(XO))}).ElseIf(i.greaterThanEqual(CR),()=>{e.assign(MR.sub(i).mul(YO.sub($O)).div(MR.sub(CR)).add($O))}).ElseIf(i.greaterThanEqual(fte),()=>{e.assign(CR.sub(i).mul(K3e.sub(YO)).div(CR.sub(fte)).add(YO))}).Else(()=>{e.assign(oe(-2).mul(xf(Tn(1.16,i))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),Ase=me(([i,e])=>{let t=i.toVar();t.assign(Tn(2,t).sub(1));let n=pe(t,1).toVar();return $t(e.equal(0),()=>{n.assign(n.zyx)}).ElseIf(e.equal(1),()=>{n.assign(n.xzy),n.xz.mulAssign(-1)}).ElseIf(e.equal(2),()=>{n.x.mulAssign(-1)}).ElseIf(e.equal(3),()=>{n.assign(n.zyx),n.xz.mulAssign(-1)}).ElseIf(e.equal(4),()=>{n.assign(n.xzy),n.xy.mulAssign(-1)}).ElseIf(e.equal(5),()=>{n.z.mulAssign(-1)}),n}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),gse=me(([i,e,t,n,r,s])=>{let o=oe(t),a=pe(e),l=Ju(tMe(o),L7,s),c=Qu(l),u=yf(l),f=pe(bS(i,a,u,n,r,s)).toVar();return $t(c.notEqual(0),()=>{let d=pe(bS(i,a,u.add(1),n,r,s)).toVar();f.assign(Qn(f,d,c))}),f}),bS=me(([i,e,t,n,r,s])=>{let o=oe(t).toVar(),a=pe(e),l=oe(J3e(a)).toVar(),c=oe(Vr(dte.sub(o),0)).toVar();o.assign(Vr(o,dte));let u=oe(px(o)).toVar(),f=dt(eMe(a,l).mul(u.sub(2)).add(1)).toVar();return $t(l.greaterThan(2),()=>{f.y.addAssign(u),l.subAssign(3)}),f.x.addAssign(l.mul(u)),f.x.addAssign(c.mul(Tn(3,Q3e))),f.y.addAssign(Tn(4,px(s).sub(u))),f.x.mulAssign(n),f.y.mulAssign(r),i.sample(f).grad(dt(),dt())}),ZO=me(({envMap:i,mipInt:e,outputDirection:t,theta:n,axis:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{let l=$u(n),c=t.mul(l).add(r.cross(t).mul(Ka(n))).add(r.mul(r.dot(t).mul(l.oneMinus())));return bS(i,c,e,s,o,a)}),vse=me(({n:i,latitudinal:e,poleAxis:t,outputDirection:n,weights:r,samples:s,dTheta:o,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f})=>{let d=pe(xa(e,t,ep(t,n))).toVar();$t(d.equal(pe(0)),()=>{d.assign(pe(n.z,0,n.x.negate()))}),d.assign(ya(d));let A=pe().toVar();return A.addAssign(r.element(0).mul(ZO({theta:0,axis:d,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),Oi({start:de(1),end:i},({i:y})=>{$t(y.greaterThanEqual(s),()=>{Jre()});let w=oe(o.mul(oe(y))).toVar();A.addAssign(r.element(y).mul(ZO({theta:w.mul(-1),axis:d,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),A.addAssign(r.element(y).mul(ZO({theta:w,axis:d,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f})))}),Ft(A,1)}),nMe=me(([i])=>{let e=rt(i).toVar();return e.assign(e.shiftLeft(rt(16)).bitOr(e.shiftRight(rt(16)))),e.assign(e.bitAnd(rt(1431655765)).shiftLeft(rt(1)).bitOr(e.bitAnd(rt(2863311530)).shiftRight(rt(1)))),e.assign(e.bitAnd(rt(858993459)).shiftLeft(rt(2)).bitOr(e.bitAnd(rt(3435973836)).shiftRight(rt(2)))),e.assign(e.bitAnd(rt(252645135)).shiftLeft(rt(4)).bitOr(e.bitAnd(rt(4042322160)).shiftRight(rt(4)))),e.assign(e.bitAnd(rt(16711935)).shiftLeft(rt(8)).bitOr(e.bitAnd(rt(4278255360)).shiftRight(rt(8)))),oe(e).mul(23283064365386963e-26)}),iMe=me(([i,e])=>dt(oe(i).div(oe(e)),nMe(i))),rMe=me(([i,e,t])=>{let n=t.mul(t).toConst(),r=pe(1,0,0).toConst(),s=ep(e,r).toConst(),o=el(i.x).toConst(),a=Tn(2,3.14159265359).mul(i.y).toConst(),l=o.mul($u(a)).toConst(),c=o.mul(Ka(a)).toVar(),u=Tn(.5,e.z.add(1)).toConst();c.assign(u.oneMinus().mul(el(l.mul(l).oneMinus())).add(u.mul(c)));let f=r.mul(l).add(s.mul(c)).add(e.mul(el(Vr(0,l.mul(l).add(c.mul(c)).oneMinus()))));return ya(pe(n.mul(f.x),n.mul(f.y),Vr(0,f.z)))}),_se=me(({roughness:i,mipInt:e,envMap:t,N_immutable:n,GGX_SAMPLES:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{let l=pe(n).toVar(),c=pe(0).toVar(),u=oe(0).toVar();return $t(i.lessThan(.001),()=>{c.assign(bS(t,l,e,s,o,a))}).Else(()=>{let f=xa(fr(l.z).lessThan(.999),pe(0,0,1),pe(1,0,0)),d=ya(ep(f,l)).toVar(),A=ep(l,d).toVar();Oi({start:rt(0),end:r},({i:y})=>{let w=iMe(y,r),S=rMe(w,pe(0,0,1),i),T=ya(d.mul(S.x).add(A.mul(S.y)).add(l.mul(S.z))),R=ya(T.mul(lu(l,T).mul(2)).sub(l)),P=Vr(lu(l,R),0);$t(P.greaterThan(0),()=>{let I=bS(t,R,e,s,o,a);c.addAssign(I.mul(P)),u.addAssign(P)})}),$t(u.greaterThan(0),()=>{c.assign(c.div(u))})}),Ft(c,1)}),pm=4,pte=[.125,.215,.35,.446,.526,.582],Vg=20,sMe=512,qw=new Ou(-1,1,1,-1,0,1),oMe=new Yr(90,1),mte=new zt,KO=null,QO=0,JO=0,aMe=new re,I4=new WeakMap,lMe=[3,1,5,0,4,2],eU=Ase(Ui(),pc("faceIndex")).normalize(),zI=pe(eU.x,eU.y,eU.z),D7=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._ggxMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,n=.1,r=100,s={}){let{size:o=256,position:a=aMe,renderTarget:l=null}=s;if(this._setSize(o),this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromScene() called before the backend is initialized. Use "await renderer.init();" before using this method.');KO=this._renderer.getRenderTarget(),QO=this._renderer.getActiveCubeFace(),JO=this._renderer.getActiveMipmapLevel();let c=l||this._allocateTarget(!0);return this._init(c),this._sceneToCubeUV(e,n,r,c,a),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}async fromSceneAsync(e,t=0,n=.1,r=100,s={}){return ni('PMREMGenerator: ".fromSceneAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this.fromScene(e,t,n,r,s)}fromEquirectangular(e,t=null){if(this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return ni('PMREMGenerator: ".fromEquirectangularAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromCubemap() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return ni('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=gte(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=vte(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===nc||e.mapping===jc?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(KO,QO,JO),e.scissorTest=!1,this._setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),KO=this._renderer.getRenderTarget(),QO=this._renderer.getActiveCubeFace(),JO=this._renderer.getActiveMipmapLevel();let n=t||this._allocateTarget(!1);return this._init(n),this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTarget(e){let t=3*Math.max(this._cubeSize,112),n=4*this._cubeSize;return Ate(t,n,e)}_init(e){if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e.width||this._pingPongRenderTarget.height!==e.height){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Ate(e.width,e.height);let{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=cMe(t)),this._blurMaterial=uMe(t,e.width,e.height),this._ggxMaterial=hMe(t,e.width,e.height)}}async _compileMaterial(e){let t=new Hn(new Xn,e);await this._renderer.compile(t,qw)}_sceneToCubeUV(e,t,n,r,s){let o=oMe;o.near=t,o.far=n;let a=[1,1,1,1,-1,1],l=[1,-1,1,-1,1,-1],c=this._renderer,u=c.autoClear;c.getClearColor(mte),c.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new Hn(new Bu,new ds({name:"PMREM.Background",side:mi,depthWrite:!1,depthTest:!1})));let f=this._backgroundBox,d=f.material,A=!1,y=e.background;y?y.isColor&&(d.color.copy(y),e.background=null,A=!0):(d.color.copy(mte),A=!0),c.setRenderTarget(r),c.clear(),A&&c.render(f,o);for(let w=0;w<6;w++){let S=w%3;S===0?(o.up.set(0,a[w],0),o.position.set(s.x,s.y,s.z),o.lookAt(s.x+l[w],s.y,s.z)):S===1?(o.up.set(0,0,a[w]),o.position.set(s.x,s.y,s.z),o.lookAt(s.x,s.y+l[w],s.z)):(o.up.set(0,a[w],0),o.position.set(s.x,s.y,s.z),o.lookAt(s.x,s.y,s.z+l[w]));let T=this._cubeSize;this._setViewport(r,S*T,w>2?T:0,T,T),c.render(e,o)}c.autoClear=u,e.background=y}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===nc||e.mapping===jc;r?this._cubemapMaterial===null&&(this._cubemapMaterial=gte(e)):this._equirectMaterial===null&&(this._equirectMaterial=vte(e));let s=r?this._cubemapMaterial:this._equirectMaterial;s.fragmentNode.value=e;let o=this._lodMeshes[0];o.material=s;let a=this._cubeSize;this._setViewport(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(o,qw)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;let l=I4.get(o),c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-u*u),d=0+c*1.25,A=f*d,{_lodMax:y}=this,w=this._sizeLods[n],S=3*w*(n>y-pm?n-y+pm:0),T=4*(this._cubeSize-w);e.texture.frame=(e.texture.frame||0)+1,l.envMap.value=e.texture,l.roughness.value=A,l.mipInt.value=y-t,this._setViewport(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,qw),s.texture.frame=(s.texture.frame||0)+1,l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=y-n,this._setViewport(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,qw)}_blur(e,t,n,r,s){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,o,a){let l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&ze("blur direction must be either latitudinal or longitudinal!");let u=3,f=this._lodMeshes[r];f.material=c;let d=I4.get(c),A=this._sizeLods[n]-1,y=isFinite(s)?Math.PI/(2*A):2*Math.PI/(2*Vg-1),w=s/y,S=isFinite(s)?1+Math.floor(u*w):Vg;S>Vg&&Xe(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${Vg}`);let T=[],R=0;for(let L=0;L<Vg;++L){let C=L/w,B=Math.exp(-C*C/2);T.push(B),L===0?R+=B:L<S&&(R+=2*B)}for(let L=0;L<T.length;L++)T[L]=T[L]/R;e.texture.frame=(e.texture.frame||0)+1,d.envMap.value=e.texture,d.samples.value=S,d.weights.array=T,d.latitudinal.value=o==="latitudinal"?1:0,a&&(d.poleAxis.value=a);let{_lodMax:P}=this;d.dTheta.value=y,d.mipInt.value=P-n;let I=this._sizeLods[r],F=3*I*(r>P-pm?r-P+pm:0),D=4*(this._cubeSize-I);this._setViewport(t,F,D,3*I,2*I),l.setRenderTarget(t),l.render(f,qw)}_setViewport(e,t,n,r,s){this._renderer.isWebGLRenderer?(e.viewport.set(t,e.height-s-n,r,s),e.scissor.set(t,e.height-s-n,r,s)):(e.viewport.set(t,n,r,s),e.scissor.set(t,n,r,s))}};function cMe(i){let e=[],t=[],n=[],r=i,s=i-pm+1+pte.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-pm?l=pte[o-i+pm-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),u=-c,f=1+c,d=[u,u,f,u,f,f,u,u,f,f,u,f],A=6,y=6,w=3,S=2,T=1,R=new Float32Array(w*y*A),P=new Float32Array(S*y*A),I=new Float32Array(T*y*A);for(let D=0;D<A;D++){let L=D%3*2/3-1,C=D>2?0:-1,B=[L,C,0,L+2/3,C,0,L+2/3,C+1,0,L,C,0,L+2/3,C+1,0,L,C+1,0],k=lMe[D];R.set(B,w*y*k),P.set(d,S*y*k);let z=[k,k,k,k,k,k];I.set(z,T*y*k)}let F=new Xn;F.setAttribute("position",new Hi(R,w)),F.setAttribute("uv",new Hi(P,S)),F.setAttribute("faceIndex",new Hi(I,T)),n.push(new Hn(F,null)),r>pm&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function Ate(i,e,t){let n={magFilter:Mi,minFilter:Mi,generateMipmaps:!1,type:Wi,format:Ur,colorSpace:n0,depthBuffer:t},r=new Ba(i,e,n);return r.texture.mapping=zh,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function VI(i){let e=new Pr;return e.depthTest=!1,e.depthWrite=!1,e.blending=ms,e.name=`PMREM_${i}`,e}function uMe(i,e,t){let n=$o(new Array(Vg).fill(0)),r=Xt(new re(0,1,0)),s=Xt(0),o=oe(Vg),a=Xt(0),l=Xt(1),c=fi(),u=Xt(0),f=oe(1/e),d=oe(1/t),A=oe(i),y={n:o,latitudinal:a,weights:n,poleAxis:r,outputDirection:zI,dTheta:s,samples:l,envMap:c,mipInt:u,CUBEUV_TEXEL_WIDTH:f,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:A},w=VI("blur");return w.fragmentNode=vse({...y,latitudinal:a.equal(1)}),I4.set(w,y),w}function hMe(i,e,t){let n=fi(),r=Xt(0),s=Xt(0),o=oe(1/e),a=oe(1/t),l=oe(i),c={envMap:n,roughness:r,mipInt:s,CUBEUV_TEXEL_WIDTH:o,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:l},u=VI("ggx");return u.fragmentNode=_se({...c,N_immutable:zI,GGX_SAMPLES:rt(sMe)}),I4.set(u,c),u}function gte(i){let e=VI("cubemap");return e.fragmentNode=Qa(i,zI),e}function vte(i){let e=VI("equirect");return e.fragmentNode=fi(i,gV(zI),0),e}var _te=new WeakMap;function fMe(i){let e=Math.log2(i)-2,t=1/i;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:t,maxMip:e}}function dMe(i,e,t){let n=pMe(e),r=n.get(i);if((r!==void 0?r.pmremVersion:-1)!==i.pmremVersion){let o=i.image;if(i.isCubeTexture)if(mMe(o))r=t.fromCubemap(i,r);else return null;else if(AMe(o))r=t.fromEquirectangular(i,r);else return null;if(r.pmremVersion=i.pmremVersion,n.has(i)===!1){let a=()=>{i.removeEventListener("dispose",a);let l=n.get(i);l!==void 0&&(l.dispose(),n.delete(i))};i.addEventListener("dispose",a)}n.set(i,r)}return r.texture}function pMe(i){let e=_te.get(i);return e===void 0&&(e=new WeakMap,_te.set(i,e)),e}var N7=class extends Ir{static get type(){return"PMREMNode"}constructor(e,t=null,n=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=n,this._generator=null;let r=new Hs;r.isRenderTargetTexture=!0,this._texture=fi(r),this._width=Xt(0),this._height=Xt(0),this._maxMip=Xt(0),this.updateBeforeType=yn.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){let t=fMe(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(e){let t=this._pmrem,n=t?t.pmremVersion:-1,r=this._value;n!==r.pmremVersion&&(r.isPMREMTexture===!0||r.mapping===zh?t=r:t=dMe(r,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new D7(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=this._pmrem.isRenderTargetTexture?y4.mul(pe(t.x,t.y.negate(),t.z)):y4.mul(t);let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),gse(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}};function mMe(i){if(i==null)return!1;let e=0,t=6;for(let n=0;n<t;n++)i[n]!==void 0&&e++;return e===t}function AMe(i){return i==null?!1:i.height>0}var yV=$n(N7).setParameterLength(1,3),xte=new WeakMap,F7=class extends xm{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){let{material:t}=e,n=this.envNode;if(n.isTextureNode||n.isMaterialReferenceNode){let f=n.isTextureNode?n.value:t[n.property],d=this._getPMREMNodeCache(e.renderer),A=d.get(f);A===void 0&&(A=yV(f),d.set(f,A)),n=A}let s=t.useAnisotropy===!0||t.anisotropy>0?mre:hi,o=n.context(yte(vf,s)).mul(t4),a=n.context(gMe(Tm)).mul(Math.PI).mul(t4),l=ux(o),c=ux(a);e.context.radiance.addAssign(l),e.context.iblIrradiance.addAssign(c);let u=e.context.lightingModel.clearcoatRadiance;if(u){let f=n.context(yte(ax,hm)).mul(t4),d=ux(f);u.addAssign(d)}}_getPMREMNodeCache(e){let t=xte.get(e);return t===void 0&&(t=new WeakMap,xte.set(e,t)),t}},yte=(i,e)=>{let t=null;return{getUV:()=>(t===null&&(t=er.negate().reflect(e),t=Nz(i).mix(t,e).normalize(),t=t.transformDirection(BS)),t),getTextureLevel:()=>i}},gMe=i=>({getUV:()=>i,getTextureLevel:()=>oe(1)}),vMe=new a_,P4=class extends Pr{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(vMe),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new F7(t):null}setupLightingModel(){return new R4}setupSpecular(){let e=Qn(pe(.04),Bi.rgb,Qd);vm.assign(pe(.04)),Gg.assign(e),qg.assign(1)}setupVariants(){let e=this.metalnessNode?oe(this.metalnessNode):Sre;Qd.assign(e);let t=this.roughnessNode?oe(this.roughnessNode):wre;t=vV({roughness:t}),vf.assign(t),this.setupSpecular(),zg.assign(Bi.rgb.mul(e.oneMinus()))}},_Me=new J2,B7=class extends P4{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(_Me),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||this.clearcoatNode!==null}get useIridescence(){return this.iridescence>0||this.iridescenceNode!==null}get useSheen(){return this.sheen>0||this.sheenNode!==null}get useAnisotropy(){return this.anisotropy>0||this.anisotropyNode!==null}get useTransmission(){return this.transmission>0||this.transmissionNode!==null}get useDispersion(){return this.dispersion>0||this.dispersionNode!==null}setupSpecular(){let e=this.iorNode?oe(this.iorNode):Ure;lS.assign(e),vm.assign(Pl(Dz(lS.sub(1).div(lS.add(1))).mul(bre),pe(1)).mul(l7)),Gg.assign(Qn(vm,Bi.rgb,Qd)),qg.assign(Qn(l7,1,Qd))}setupLightingModel(){return new R4(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){let t=this.clearcoatNode?oe(this.clearcoatNode):Ere,n=this.clearcoatRoughnessNode?oe(this.clearcoatRoughnessNode):Mre;l4.assign(t),ax.assign(vV({roughness:n}))}if(this.useSheen){let t=this.sheenNode?pe(this.sheenNode):Ire,n=this.sheenRoughnessNode?oe(this.sheenRoughnessNode):Pre;hc.assign(t),lm.assign(n)}if(this.useIridescence){let t=this.iridescenceNode?oe(this.iridescenceNode):Dre,n=this.iridescenceIORNode?oe(this.iridescenceIORNode):Nre,r=this.iridescenceThicknessNode?oe(this.iridescenceThicknessNode):Fre;wI.assign(t),c4.assign(n),u4.assign(r)}if(this.useAnisotropy){let t=(this.anisotropyNode?dt(this.anisotropyNode):Lre).toVar();am.assign(t.length()),$t(am.equal(0),()=>{t.assign(dt(1,0))}).Else(()=>{t.divAssign(dt(am)),am.assign(am.saturate())}),h4.assign(am.pow2().mix(vf.pow2(),1)),aS.assign(Hg[0].mul(t.x).add(Hg[1].mul(t.y))),Xg.assign(Hg[1].mul(t.x).sub(Hg[0].mul(t.y)))}if(this.useTransmission){let t=this.transmissionNode?oe(this.transmissionNode):Bre,n=this.thicknessNode?oe(this.thicknessNode):Ore,r=this.attenuationDistanceNode?oe(this.attenuationDistanceNode):kre,s=this.attenuationColorNode?pe(this.attenuationColorNode):zre;if(d4.assign(t),vz.assign(n),_z.assign(r),xz.assign(s),this.useDispersion){let o=this.dispersionNode?oe(this.dispersionNode):Gre;yz.assign(o)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?pe(this.clearcoatNormalNode):Cre}setup(e){e.context.setupClearcoatNormal=()=>Yg(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}};var xMe=me(({normal:i,lightDirection:e,builder:t})=>{let n=i.dot(e),r=dt(n.mul(.5).add(.5),0);if(t.material.gradientMap){let s=Zd("gradientMap","texture").context({getUV:()=>r});return pe(s.r)}else{let s=r.fwidth().mul(.5);return Qn(pe(.7),pe(1),gc(oe(.7).sub(s.x),oe(.7).add(s.x),r.x))}}),O7=class extends vx{direct({lightDirection:e,lightColor:t,reflectedLight:n},r){let s=xMe({normal:DI,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(s.mul(r1({diffuseColor:Bi.rgb})))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(r1({diffuseColor:Bi}))),r.indirectDiffuse.mulAssign(t)}},yMe=new eb,U7=class extends Pr{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(yMe),this.setValues(e)}setupLightingModel(){return new O7}},xse=me(()=>{let i=pe(er.z,0,er.x.negate()).normalize(),e=er.cross(i);return dt(i.dot(hi),e.dot(hi)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),bMe=new nb,k7=class extends Pr{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(bMe),this.setValues(e)}setupVariants(e){let t=xse,n;e.material.matcap?n=Zd("matcap","texture").context({getUV:()=>t}):n=pe(Qn(.2,.8,t.y)),Bi.rgb.mulAssign(n.rgb)}},z7=class extends Ir{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}generateNodeType(e){return this.positionNode.getNodeType(e)}setup(e){let{rotationNode:t,positionNode:n}=this;if(this.getNodeType(e)==="vec2"){let s=t.cos(),o=t.sin();return bI(s,o,o.negate(),s).mul(n)}else{let s=t,o=mm(Ft(1,0,0,0),Ft(0,$u(s.x),Ka(s.x).negate(),0),Ft(0,Ka(s.x),$u(s.x),0),Ft(0,0,0,1)),a=mm(Ft($u(s.y),0,Ka(s.y),0),Ft(0,1,0,0),Ft(Ka(s.y).negate(),0,$u(s.y),0),Ft(0,0,0,1)),l=mm(Ft($u(s.z),Ka(s.z).negate(),0,0),Ft(Ka(s.z),$u(s.z),0,0),Ft(0,0,1,0),Ft(0,0,0,1));return o.mul(a).mul(l).mul(Ft(n,1)).xyz}}},US=$n(z7).setParameterLength(2),wMe=new Dh,L4=class extends Pr{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.transparent=!0,this.setDefaultValues(wMe),this.setValues(e)}setupPositionView(e){let{object:t,camera:n}=e,{positionNode:r,rotationNode:s,scaleNode:o,sizeAttenuation:a}=this,l=Ef.mul(pe(r||0)),c=dt(su[0].xyz.length(),su[1].xyz.length());o!==null&&(c=c.mul(dt(o))),n.isPerspectiveCamera&&a===!1&&(c=c.mul(l.z.negate()));let u=va.xy;if(t.center&&t.center.isVector2===!0){let A=hEe("center","vec2",t);u=u.sub(A.sub(.5))}u=u.mul(c);let f=oe(s||Rre),d=US(u,f);return Ft(l.xy.add(d),l.zw)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}},SMe=new l0,TMe=new Oe,V7=class extends L4{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(SMe),this.setValues(e)}setupPositionView(){let{positionNode:e}=this;return Ef.mul(pe(e||Cr)).xyz}setupVertexSprite(e){let{material:t,camera:n}=e,{rotationNode:r,scaleNode:s,sizeNode:o,sizeAttenuation:a}=this,l=super.setupVertex(e);if(t.isNodeMaterial!==!0)return l;let c=o!==null?dt(o):Vre;c=c.mul(Yz),n.isPerspectiveCamera&&a===!0&&(c=c.mul(EMe.div(ys.z.negate()))),s&&s.isNode&&(c=c.mul(dt(s)));let u=va.xy;if(r&&r.isNode){let f=oe(r);u=US(u,f)}return u=u.mul(c),u=u.div(Zz.div(2)),u=u.mul(l.w),l=l.add(Ft(u,0,0)),l}setupVertex(e){return e.object.isPoints?super.setupVertex(e):this.setupVertexSprite(e)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}},EMe=Xt(1).onFrameUpdate(function({renderer:i}){let e=i.getSize(TMe);this.value=.5*e.y}),G7=class extends vx{constructor(){super(),this.shadowNode=oe(1).toVar("shadowMask")}direct({lightNode:e}){e.shadowNode!==null&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Bi.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Bi.rgb)}},MMe=new Q2,q7=class extends Pr{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(MMe),this.setValues(e)}setupLightingModel(){return new G7}},Elt=np("vec3"),Mlt=np("vec3"),Clt=np("vec3");var H7=class{constructor(e,t,n){this.renderer=e,this.nodes=t,this.info=n,this._context=typeof self<"u"?self:null,this._animationLoop=null,this._requestId=null}start(){let e=(t,n)=>{this._requestId=this._context.requestAnimationFrame(e),this.info.autoReset===!0&&this.info.reset(),this.nodes.nodeFrame.update(),this.info.frame=this.nodes.nodeFrame.frameId,this.renderer._inspector.begin(),this._animationLoop!==null&&this._animationLoop(t,n),this.renderer._inspector.finish()};e()}stop(){this._context!==null&&this._context.cancelAnimationFrame(this._requestId),this._requestId=null}getAnimationLoop(){return this._animationLoop}setAnimationLoop(e){this._animationLoop=e}getContext(){return this._context}setContext(e){this._context=e}dispose(){this.stop()}},Cf=class{constructor(){this.weakMaps={}}_getWeakMap(e){let t=e.length,n=this.weakMaps[t];return n===void 0&&(n=new WeakMap,this.weakMaps[t]=n),n}get(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return;return t.get(e[e.length-1])}set(e,t){let n=this._getWeakMap(e);for(let r=0;r<e.length-1;r++){let s=e[r];n.has(s)===!1&&n.set(s,new WeakMap),n=n.get(s)}return n.set(e[e.length-1],t),this}delete(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return!1;return t.delete(e[e.length-1])}},CMe=0,bte=new WeakMap;function RMe(i){let e=Object.keys(i),t=bte.get(i.constructor);if(t===void 0){t=[];let n=Object.getPrototypeOf(i);for(;n;){let r=Object.getOwnPropertyDescriptors(n);for(let s in r){let o=r[s];o&&typeof o.get=="function"&&t.push(s)}n=Object.getPrototypeOf(n)}bte.set(i.constructor,t)}for(let n=0;n<t.length;n++)e.push(t[n]);return e}var W7=class{constructor(e,t,n,r,s,o,a,l,c,u){this.id=CMe++,this._nodes=e,this._geometries=t,this.renderer=n,this.object=r,this.material=s,this.scene=o,this.camera=a,this.lightsNode=l,this.context=c,this.geometry=r.geometry,this.version=s.version,this.drawRange=null,this.attributes=null,this.attributesId=null,this.pipeline=null,this.group=null,this.vertexBuffers=null,this.drawParams=null,this.bundle=null,this.clippingContext=u,this.clippingContextCacheKey=u!==null?u.cacheKey:"",this.initialNodesCacheKey=this.getDynamicCacheKey(),this.initialCacheKey=this.getCacheKey(),this._nodeBuilderState=null,this._bindings=null,this._monitor=null,this._sourceMaterial=n._currentSourceMaterial,this.onDispose=null,this.isRenderObject=!0,this.onMaterialDispose=()=>{this.dispose()},this.onGeometryDispose=()=>{this.attributes=null,this.attributesId=null},this.material.addEventListener("dispose",this.onMaterialDispose),this.geometry.addEventListener("dispose",this.onGeometryDispose),this._sourceMaterial!==null&&this._sourceMaterial.addEventListener("dispose",this.onMaterialDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return this.clippingContext===null||this.clippingContext.cacheKey===this.clippingContextCacheKey?!1:(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return this.getNodeBuilderState().hardwareClipping===!0?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().observer)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getBindingGroup(e){for(let t of this.getBindings())if(t.name===e)return t}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getIndirectOffset(){return this._geometries.getIndirectOffset(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null,this.attributesId=null}getAttributes(){if(this.attributes!==null)return this.attributes;let e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,n=[],r=new Set,s={};for(let o of e){let a;if(o.node&&o.node.attribute?a=o.node.attribute:(a=t.getAttribute(o.name),a!==void 0&&(a.isInterleavedBufferAttribute?s[o.name]=a.data.uuid:s[o.name]=a.id)),a===void 0)continue;n.push(a);let l=a.isInterleavedBufferAttribute?a.data:a;r.add(l)}return this.attributes=n,this.attributesId=s,this.vertexBuffers=Array.from(r.values()),n}getVertexBuffers(){return this.vertexBuffers===null&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){let{object:e,material:t,geometry:n,group:r,drawRange:s}=this,o=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),a=this.getIndex(),l=a!==null,c=1;if(n.isInstancedBufferGeometry===!0?c=n.instanceCount:e.count!==void 0&&(c=Math.max(0,e.count)),c===0)return null;if(o.instanceCount=c,e.isBatchedMesh===!0)return o;let u=1;t.wireframe===!0&&!e.isPoints&&!e.isLineSegments&&!e.isLine&&!e.isLineLoop&&(u=2);let f=s.start*u,d=(s.start+s.count)*u;r!==null&&(f=Math.max(f,r.start*u),d=Math.min(d,(r.start+r.count)*u));let A=n.attributes.position,y=1/0;l?y=a.count:A!=null&&(y=A.count),f=Math.max(f,0),d=Math.min(d,y);let w=d-f;return w<0||w===1/0?null:(o.vertexCount=w,o.firstVertex=f,o)}getGeometryCacheKey(){let{geometry:e}=this,t="";for(let n of Object.keys(e.attributes).sort()){let r=e.attributes[n];t+=n+",",r.data&&(t+=r.data.stride+","),r.offset&&(t+=r.offset+","),r.itemSize&&(t+=r.itemSize+","),r.normalized&&(t+="n,")}for(let n of Object.keys(e.morphAttributes).sort()){let r=e.morphAttributes[n];t+="morph-"+n+",";for(let s=0,o=r.length;s<o;s++){let a=r[s];t+=a.id+","}}return e.index&&(t+="index,"),t}getMaterialCacheKey(){let{object:e,material:t,renderer:n}=this,r=t.customProgramCacheKey();for(let s of RMe(t)){if(/^(is[A-Z]|_)|^(visible|version|uuid|name|opacity|userData)$/.test(s))continue;let o=t[s],a;if(o!==null){let l=typeof o;l==="number"?s==="side"?a=String(o):a=o!==0?"1":"0":l==="object"?(a="{",o.isTexture&&(a+=o.mapping,n.backend.isWebGPUBackend===!0&&(a+=o.magFilter,a+=o.minFilter,a+=o.wrapS,a+=o.wrapT,a+=o.wrapR)),a+="}"):a=String(o)}else a=String(o);r+=a+","}return r+=this.clippingContextCacheKey+",",e.geometry&&(r+=this.getGeometryCacheKey()),e.skeleton&&(r+=e.skeleton.bones.length+","),e.isBatchedMesh&&(r+=e._matricesTexture.uuid+",",e._colorsTexture!==null&&(r+=e._colorsTexture.uuid+",")),(e.isInstancedMesh||e.count>1)&&(r+=e.uuid+","),r+=this.context.id+",",r+=e.receiveShadow+",",wx(r)}get needsGeometryUpdate(){if(this.geometry.id!==this.object.geometry.id)return!0;if(this.attributes!==null){let e=this.attributesId;for(let t in e){let n=this.geometry.getAttribute(t);if(n===void 0)return!0;let r=n.isInterleavedBufferAttribute?n.data.uuid:n.id;if(e[t]!==r)return!0}}return!1}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=0;return this.material.isShadowPassMaterial!==!0&&(e=this._nodes.getCacheKey(this.scene,this.lightsNode)),this.camera.isArrayCamera&&(e=sS(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=sS(e,1)),e=sS(e,this.renderer.contextNode.id,this.renderer.contextNode.version),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.geometry.removeEventListener("dispose",this.onGeometryDispose),this._sourceMaterial!==null&&this._sourceMaterial.removeEventListener("dispose",this.onMaterialDispose),this.onDispose()}},df=[],j7=class{constructor(e,t,n,r,s,o){this.renderer=e,this.nodes=t,this.geometries=n,this.pipelines=r,this.bindings=s,this.info=o,this.chainMaps={}}get(e,t,n,r,s,o,a,l){let c=this.getChainMap(l);df[0]=e,df[1]=t,df[2]=o,df[3]=s;let u=c.get(df);return u===void 0?(u=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,s,o,a,l),c.set(df,u)):(u.camera=r,u.updateClipping(a),u.needsGeometryUpdate&&u.setGeometry(e.geometry),(u.version!==t.version||u.needsUpdate)&&(u.initialCacheKey!==u.getCacheKey()?(u.dispose(),u=this.get(e,t,n,r,s,o,a,l)):u.version=t.version)),df[0]=null,df[1]=null,df[2]=null,df[3]=null,u}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Cf)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,s,o,a,l,c,u,f){let d=this.getChainMap(f),A=new W7(e,t,n,r,s,o,a,l,c,u);return A.onDispose=()=>{this.pipelines.delete(A),this.bindings.deleteForRender(A),this.nodes.delete(A),d.delete(A.getChainArray())},A}},Rf=class{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}},ou={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},fm=16,IMe=211,PMe=212,X7=class extends Rf{constructor(e,t){super(),this.backend=e,this.info=t}delete(e){let t=super.delete(e);return t!==null&&(this.backend.destroyAttribute(e),this.info.destroyAttribute(e)),t}update(e,t){let n=this.get(e);if(n.version===void 0)t===ou.VERTEX?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===ou.INDEX?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===ou.STORAGE?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===ou.INDIRECT&&(this.backend.createIndirectStorageAttribute(e),this.info.createIndirectStorageAttribute(e)),n.version=this._getBufferAttribute(e).version;else{let r=this._getBufferAttribute(e);(n.version<r.version||r.usage===fg)&&(this.backend.updateAttribute(e),n.version=r.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}};function yse(i){return i.index!==null?i.index.version:i.attributes.position.version}function bse(i){return i.index!==null?i.index.id:i.attributes.position.id}function wte(i){let e=[],t=i.index,n=i.attributes.position;if(t!==null){let s=t.array;for(let o=0,a=s.length;o<a;o+=3){let l=s[o+0],c=s[o+1],u=s[o+2];e.push(l,c,c,u,u,l)}}else{let s=n.array;for(let o=0,a=s.length/3-1;o<a;o+=3){let l=o+0,c=o+1,u=o+2;e.push(l,c,c,u,u,l)}}let r=new(n.count>=65535?qA:GA)(e,1);return r.version=yse(i),r.__id=bse(i),r}var $7=class extends Rf{constructor(e,t){super(),this.attributes=e,this.info=t,this.wireframes=new WeakMap,this.attributeCall=new WeakMap,this._geometryDisposeListeners=new Map}has(e){let t=e.geometry;return super.has(t)&&this.get(t).initialized===!0}updateForRender(e){this.has(e)===!1&&this.initGeometry(e),this.updateAttributes(e)}initGeometry(e){let t=e.geometry,n=this.get(t);n.initialized=!0,this.info.memory.geometries++;let r=()=>{this.info.memory.geometries--;let s=t.index,o=e.getAttributes();s!==null&&this.attributes.delete(s);for(let l of o)this.attributes.delete(l);let a=this.wireframes.get(t);a!==void 0&&this.attributes.delete(a),t.removeEventListener("dispose",r),this._geometryDisposeListeners.delete(t)};t.addEventListener("dispose",r),this._geometryDisposeListeners.set(t,r)}updateAttributes(e){let t=e.getAttributes();for(let s of t)s.isStorageBufferAttribute||s.isStorageInstancedBufferAttribute?this.updateAttribute(s,ou.STORAGE):this.updateAttribute(s,ou.VERTEX);let n=this.getIndex(e);n!==null&&this.updateAttribute(n,ou.INDEX);let r=e.geometry.indirect;r!==null&&this.updateAttribute(r,ou.INDIRECT)}updateAttribute(e,t){let n=this.info.render.calls;e.isInterleavedBufferAttribute?this.attributeCall.get(e)===void 0?(this.attributes.update(e,t),this.attributeCall.set(e,n)):this.attributeCall.get(e.data)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e.data,n),this.attributeCall.set(e,n)):this.attributeCall.get(e)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e,n))}getIndirect(e){return e.geometry.indirect}getIndirectOffset(e){return e.geometry.indirectOffset}getIndex(e){let{geometry:t,material:n}=e,r=t.index;if(n.wireframe===!0){let s=this.wireframes,o=s.get(t);o===void 0?(o=wte(t),s.set(t,o)):(o.version!==yse(t)||o.__id!==bse(t))&&(this.attributes.delete(o),o=wte(t),s.set(t,o)),r=o}return r}dispose(){for(let[e,t]of this._geometryDisposeListeners.entries())e.removeEventListener("dispose",t);this._geometryDisposeListeners.clear()}},Y7=class{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0},this.compute={calls:0,frameCalls:0,timestamp:0},this.memory={attributes:0,attributesSize:0,geometries:0,indexAttributes:0,indexAttributesSize:0,indirectStorageAttributes:0,indirectStorageAttributesSize:0,programs:0,programsSize:0,readbackBuffers:0,readbackBuffersSize:0,renderTargets:0,storageAttributes:0,storageAttributesSize:0,textures:0,texturesSize:0,uniformBuffers:0,uniformBuffersSize:0,total:0},this.memoryMap=new Map}update(e,t,n){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=n*(t/3):e.isPoints?this.render.points+=n*t:e.isLineSegments?this.render.lines+=n*(t/2):e.isLine?this.render.lines+=n*(t-1):ze("WebGPUInfo: Unknown object type.")}reset(){this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0;for(let e in this.memory)this.memory[e]=0;this.memoryMap.clear()}createTexture(e){let t=this._getTextureMemorySize(e);this.memoryMap.set(e,t),this.memory.textures++,this.memory.total+=t,this.memory.texturesSize+=t}destroyTexture(e){let t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.textures--,this.memory.total-=t,this.memory.texturesSize-=t}_createAttribute(e,t){let n=this._getAttributeMemorySize(e);this.memoryMap.set(e,{size:n,type:t}),this.memory[t]++,this.memory.total+=n,this.memory[t+"Size"]+=n}createAttribute(e){this._createAttribute(e,"attributes")}createIndexAttribute(e){this._createAttribute(e,"indexAttributes")}createStorageAttribute(e){this._createAttribute(e,"storageAttributes")}createIndirectStorageAttribute(e){this._createAttribute(e,"indirectStorageAttributes")}destroyAttribute(e){let t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory[t.type]--,this.memory.total-=t.size,this.memory[t.type+"Size"]-=t.size)}createReadbackBuffer(e){let t=e.maxByteLength;this.memoryMap.set(e,{size:t,type:"readbackBuffers"}),this.memory.readbackBuffers++,this.memory.total+=t,this.memory.readbackBuffersSize+=t}destroyReadbackBuffer(e){let{size:t}=this.memoryMap.get(e);this.memoryMap.delete(e),this.memory.readbackBuffers--,this.memory.total-=t,this.memory.readbackBuffersSize-=t}createUniformBuffer(e){let t=e.byteLength;this.memoryMap.set(e,{size:t,type:"uniformBuffers"}),this.memory.uniformBuffers++,this.memory.total+=t,this.memory.uniformBuffersSize+=t}destroyUniformBuffer(e){let t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory.uniformBuffers--,this.memory.total-=t.size,this.memory.uniformBuffersSize-=t.size)}createProgram(e){let t=e.code.length;this.memoryMap.set(e,t),this.memory.programs++,this.memory.total+=t,this.memory.programsSize+=t}destroyProgram(e){let t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.programs--,this.memory.total-=t,this.memory.programsSize-=t}_getTextureMemorySize(e){if(e.isCompressedTexture)return 1;let t=1;e.type===Vh||e.type===Ji?t=1:e.type===Gh||e.type===Sl||e.type===Wi?t=2:(e.type===Kr||e.type===xi||e.type===cr)&&(t=4);let n=4;e.format===f_||e.format===Ud||e.format===qh||e.format===Gs||e.format===xo?n=1:e.format===js||e.format===Hh?n=2:(e.format===Od||e.format===Nb)&&(n=3);let r=t*n;e.type===ig||e.type===rg?r=2:(e.type===ua||e.type===sg||e.type===og)&&(r=4);let s=e.width||1,o=e.height||1,a=e.isCubeTexture?6:e.depth||1,l=s*o*a*r,c=e.mipmaps;if(c&&c.length>0){let u=0;for(let f=0;f<c.length;f++){let d=c[f];if(d.data)u+=d.data.byteLength;else{let A=d.width||Math.max(1,s>>f),y=d.height||Math.max(1,o>>f);u+=A*y*a*r}}l+=u}else e.generateMipmaps&&(l=l*1.333);return Math.round(l)}_getAttributeMemorySize(e){return e.isInterleavedBufferAttribute&&(e=e.data),e.array?e.array.byteLength:e.count&&e.itemSize?e.count*e.itemSize*4:0}},D4=class{constructor(e){this.cacheKey=e,this.usedTimes=0}},Z7=class extends D4{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}},K7=class extends D4{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}},LMe=0,hS=class{constructor(e,t,n,r=null,s=null){this.id=LMe++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=s,this.usedTimes=0}},Q7=class extends Rf{constructor(e,t,n){super(),this.backend=e,this.nodes=t,this.info=n,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){let{backend:n}=this,r=this.get(e);if(this._needsComputeUpdate(e)){let s=r.pipeline;s&&(s.usedTimes--,s.computeProgram.usedTimes--);let o=this.nodes.getForCompute(e),a=this.programs.compute.get(o.computeShader);a===void 0&&(s&&s.computeProgram.usedTimes===0&&this._releaseProgram(s.computeProgram),a=new hS(o.computeShader,"compute",e.name,o.transforms,o.nodeAttributes),this.programs.compute.set(o.computeShader,a),n.createProgram(a),this.info.createProgram(a));let l=this._getComputeCacheKey(e,a),c=this.caches.get(l);c===void 0&&(s&&s.usedTimes===0&&this._releasePipeline(s),c=this._getComputePipeline(e,a,l,t)),c.usedTimes++,a.usedTimes++,r.version=e.version,r.pipeline=c}return r.pipeline}getForRender(e,t=null){let{backend:n}=this,r=this.get(e);if(this._needsRenderUpdate(e)){let s=r.pipeline;s&&(s.usedTimes--,s.vertexProgram.usedTimes--,s.fragmentProgram.usedTimes--);let o=e.getNodeBuilderState(),a=e.material?e.material.name:"",l=this.programs.vertex.get(o.vertexShader);l===void 0&&(s&&s.vertexProgram.usedTimes===0&&this._releaseProgram(s.vertexProgram),l=new hS(o.vertexShader,"vertex",a),this.programs.vertex.set(o.vertexShader,l),n.createProgram(l),this.info.createProgram(l));let c=this.programs.fragment.get(o.fragmentShader);c===void 0&&(s&&s.fragmentProgram.usedTimes===0&&this._releaseProgram(s.fragmentProgram),c=new hS(o.fragmentShader,"fragment",a),this.programs.fragment.set(o.fragmentShader,c),n.createProgram(c),this.info.createProgram(c));let u=this._getRenderCacheKey(e,l,c),f=this.caches.get(u);f===void 0?(s&&s.usedTimes===0&&this._releasePipeline(s),f=this._getRenderPipeline(e,l,c,u,t)):e.pipeline=f,f.usedTimes++,l.usedTimes++,c.usedTimes++,r.pipeline=f}return r.pipeline}isReady(e){let n=this.get(e).pipeline;if(n===void 0)return!1;let r=this.backend.get(n);return r.pipeline!==void 0&&r.pipeline!==null}delete(e){let t=this.get(e).pipeline;return t&&(t.usedTimes--,t.usedTimes===0&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,t.computeProgram.usedTimes===0&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,t.vertexProgram.usedTimes===0&&this._releaseProgram(t.vertexProgram),t.fragmentProgram.usedTimes===0&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,n,r){n=n||this._getComputeCacheKey(e,t);let s=this.caches.get(n);return s===void 0&&(s=new K7(n,t),this.caches.set(n,s),this.backend.createComputePipeline(s,r)),s}_getRenderPipeline(e,t,n,r,s){r=r||this._getRenderCacheKey(e,t,n);let o=this.caches.get(r);return o===void 0&&(o=new Z7(r,t,n),this.caches.set(r,o),e.pipeline=o,this.backend.createRenderPipeline(e,s)),o}_getComputeCacheKey(e,t){return e.id+","+t.id}_getRenderCacheKey(e,t,n){return t.id+","+n.id+","+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){let t=e.code,n=e.stage;this.programs[n].delete(t),this.info.destroyProgram(e)}_needsComputeUpdate(e){let t=this.get(e);return t.pipeline===void 0||t.version!==e.version}_needsRenderUpdate(e){return this.get(e).pipeline===void 0||this.backend.needsRenderUpdate(e)}},J7=class extends Rf{constructor(e,t,n,r,s,o){super(),this.backend=e,this.textures=n,this.pipelines=s,this.attributes=r,this.nodes=t,this.info=o,this.pipelines.bindings=this}getForRender(e){let t=e.getBindings(),n=this.get(e);return n.initialized!==!0&&(this._createBindings(t),n.initialized=!0),t}getForCompute(e){let t=this.nodes.getForCompute(e).bindings,n=this.get(e);return(n.initialized!==!0||n.bindings!==t)&&(n.bindings!==void 0&&this._destroyBindings(n.bindings),this._createBindings(t),n.initialized=!0,n.bindings=t),t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}deleteForCompute(e){let n=this.get(e).bindings||this.nodes.getForCompute(e).bindings;this._destroyBindings(n),this.delete(e)}deleteForRender(e){let t=e.getBindings();this._destroyBindings(t),this.delete(e)}_createBindings(e){for(let t of e){let n=this.get(t);if(n.bindGroup===void 0){for(let r of t.bindings)if(r.isUniformBuffer)this.backend.createUniformBuffer(r),this.info.createUniformBuffer(r);else if(r.isSampledTexture)this.textures.updateTexture(r.texture);else if(r.isSampler)this.textures.updateSampler(r);else if(r.isStorageBuffer){let s=r.attribute,o=s.isIndirectStorageBufferAttribute?ou.INDIRECT:ou.STORAGE;this.attributes.update(s,o)}this.backend.createBindings(t,e,0),n.bindGroup=t,n.usedTimes=1}else n.usedTimes++}}_destroyBindings(e){for(let t of e){let n=this.get(t);if(n.usedTimes--,n.usedTimes===0){for(let r of t.bindings)r.isUniformBuffer?(this.backend.destroyUniformBuffer(r),this.info.destroyUniformBuffer(r),r.release()):r.isSampler&&(r.isSampledTexture!==!0&&this.backend.destroySampler(r),r.release());this.backend.deleteBindGroupData(t),this.delete(t)}}}_updateBindings(e){for(let t of e)this._update(t,e)}_update(e,t){let{backend:n}=this,r=!1,s=!0,o=0,a=0;for(let l of e.bindings)if(this.nodes.updateGroup(l)!==!1){if(l.isStorageBuffer){let u=l.attribute,f=u.isIndirectStorageBufferAttribute?ou.INDIRECT:ou.STORAGE,d=n.get(l);this.attributes.update(u,f),d.attribute!==u&&(d.attribute=u,r=!0)}if(l.isUniformBuffer)l.update()&&n.updateBinding(l);else if(l.isSampledTexture){let u=l.update(),f=l.texture,d=this.textures.get(f);if(u&&(this.textures.updateTexture(f),l.generation!==d.generation&&(l.generation=d.generation,r=!0),d.bindGroups.add(e)),n.get(f).externalTexture!==void 0||d.isDefaultTexture?s=!1:(o=o*10+f.id,a+=f.version),f.isStorageTexture===!0&&f.mipmapsAutoUpdate===!0){let y=this.get(f);l.store===!0?y.needsMipmap=!0:this.textures.needsMipmaps(f)&&y.needsMipmap===!0&&(this.backend.generateMipmaps(f),y.needsMipmap=!1)}}else if(l.isSampler&&l.update()){let f=this.textures.updateSampler(l);l.samplerKey!==f&&(l.samplerKey=f,r=!0)}l.isBuffer&&l.updateRanges.length>0&&l.clearUpdateRanges()}r===!0&&this.backend.updateBindings(e,t,s?o:0,a)}},DMe=Object.freeze([]);function NMe(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?i.z-e.z:i.id-e.id}function Ste(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function Tte(i){return(i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode)&&i.side===vr&&i.forceSinglePass===!1}var ek=class{constructor(e,t,n){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lighting=e,this.lightsNode=e.getNode(t),this.lightsArray=[],this.scene=t,this.camera=n,this.occlusionQueryCount=0,this._lastOcclusionObject=null}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,n,r,s,o,a){let l=this.renderItems[this.renderItemsIndex];return l===void 0?(l={id:e.id,object:e,geometry:t,material:n,groupOrder:r,renderOrder:e.renderOrder,z:s,group:o,clippingContext:a},this.renderItems[this.renderItemsIndex]=l):(l.id=e.id,l.object=e,l.geometry=t,l.material=n,l.groupOrder=r,l.renderOrder=e.renderOrder,l.z=s,l.group=o,l.clippingContext=a),this.renderItemsIndex++,l}push(e,t,n,r,s,o,a){let l=this.getNextRenderItem(e,t,n,r,s,o,a);e.occlusionTest===!0&&this._lastOcclusionObject!==e&&(this.occlusionQueryCount++,this._lastOcclusionObject=e),n.transparent===!0||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(Tte(n)&&this.transparentDoublePass.push(l),this.transparent.push(l)):this.opaque.push(l)}unshift(e,t,n,r,s,o,a){let l=this.getNextRenderItem(e,t,n,r,s,o,a);n.transparent===!0||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(Tte(n)&&this.transparentDoublePass.unshift(l),this.transparent.unshift(l)):this.opaque.unshift(l)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t,n){this.opaque.length>1&&this.opaque.sort(e||NMe),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||Ste),this.transparent.length>1&&this.transparent.sort(t||Ste),n&&(this.opaque.reverse(),this.transparentDoublePass.reverse(),this.transparent.reverse())}finish(){this.lightsNode.setLights(this.lighting.enabled?this.lightsArray:DMe);for(let e=this.renderItemsIndex,t=this.renderItems.length;e<t;e++){let n=this.renderItems[e];if(n.id===null)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.groupOrder=null,n.renderOrder=null,n.z=null,n.group=null,n.clippingContext=null}this._lastOcclusionObject=null}},q_=[],tk=class{constructor(e){this.lighting=e,this.lists=new Cf}get(e,t){let n=this.lists;q_[0]=e,q_[1]=t;let r=n.get(q_);return r===void 0&&(r=new ek(this.lighting,e,t),n.set(q_,r)),q_[0]=null,q_[1]=null,r}dispose(){this.lists=new Cf}},FMe=0,nk=class{constructor(){this.id=FMe++,this.mrt=null,this.color=!0,this.clearColor=!0,this.clearColorValue={r:0,g:0,b:0,a:1},this.depth=!0,this.clearDepth=!0,this.clearDepthValue=1,this.stencil=!1,this.clearStencil=!0,this.clearStencilValue=1,this.viewport=!1,this.viewportValue=new xn,this.scissor=!1,this.scissorValue=new xn,this.renderTarget=null,this.textures=null,this.depthTexture=null,this.activeCubeFace=0,this.activeMipmapLevel=0,this.sampleCount=1,this.width=0,this.height=0,this.occlusionQueryCount=0,this.clippingContext=null,this.camera=null,this.isRenderContext=!0}getCacheKey(){return wse(this)}};function wse(i){let{textures:e,activeCubeFace:t,activeMipmapLevel:n}=i,r=[t,n];for(let s of e)r.push(s.id);return FS(r)}var ik=class{constructor(e){this.renderer=e,this._renderContexts={}}get(e=null,t=null,n=0){let r;if(e===null)r="default";else{let l=e.texture.format,c=e.texture.type;r=`${e.textures.length}:${l}:${c}:${e.samples}:${e.depthBuffer}:${e.stencilBuffer}`}let s=t!==null?t.id:"default",o=r+"-"+s+"-"+n,a=this._renderContexts[o];return a===void 0&&(a=new nk,a.mrt=t,this._renderContexts[o]=a),e!==null&&(a.sampleCount=e.samples===0?1:e.samples),a.clearDepthValue=this.renderer.getClearDepth(),a.clearStencilValue=this.renderer.getClearStencil(),a}dispose(){this._renderContexts={}}},BMe=new re,rk=class extends Rf{constructor(e,t,n){super(),this.renderer=e,this.backend=t,this.info=n,this._htmlTextures=new Set}updateRenderTarget(e,t=0){let n=this.get(e),r=e.samples===0?1:e.samples,s=n.depthTextureMips||(n.depthTextureMips={}),o=e.textures,a=this.getSize(o[0]),l=a.width>>t,c=a.height>>t,u=e.depthTexture||s[t],f=e.depthBuffer===!0||e.stencilBuffer===!0,d=!1,A=u!==void 0&&u.image!==void 0&&u.image.depth>1,y=a.depth>1&&(e.useArrayDepthTexture||e.multiview||A);u===void 0&&f&&(u=new Cs,u.format=e.stencilBuffer?xo:Gs,u.type=e.stencilBuffer?ua:xi,u.image.width=l,u.image.height=c,u.image.depth=a.depth,u.renderTarget=e,s[t]=u),u&&(u.isArrayTexture=y),(n.width!==a.width||a.height!==n.height)&&(d=!0,u&&(u.needsUpdate=!0,u.image.width=l,u.image.height=c,u.image.depth=y?a.depth:1)),n.width=a.width,n.height=a.height,n.textures=o,n.depthTexture=u||null,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,n.renderTarget=e,n.sampleCount!==r&&(d=!0,u&&(u.needsUpdate=!0),n.sampleCount=r);let w={sampleCount:r};if(e.isXRRenderTarget!==!0){for(let S=0;S<o.length;S++){let T=o[S];d&&(T.needsUpdate=!0),this.updateTexture(T,w)}u&&this.updateTexture(u,w)}n.initialized!==!0&&(n.initialized=!0,this.info.memory.renderTargets++,n.onDispose=()=>{this._destroyRenderTarget(e)},e.addEventListener("dispose",n.onDispose))}updateTexture(e,t={}){let n=this.get(e);if(n.initialized===!0&&n.version===e.version)return;let r=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,s=this.backend;if(r&&n.initialized===!0&&s.destroyTexture(e),e.isFramebufferTexture){let c=this.renderer.getRenderTarget();c?e.type=c.texture.type:e.type=Ji}if(e.isHTMLTexture&&e.image){let c=this.renderer.domElement;if("requestPaint"in c){if(c.hasAttribute("layoutsubtree")||c.setAttribute("layoutsubtree","true"),e.image.parentNode!==c&&c.appendChild(e.image),this._htmlTextures.size===0){let u=this._htmlTextures;c.onpaint=f=>{let d=f&&f.changedElements;for(let A of u)(!d||d.includes(A.image))&&(A.needsUpdate=!0)}}this._htmlTextures.add(e)}}let{width:o,height:a,depth:l}=this.getSize(e);if(t.width=o,t.height=a,t.depth=l,t.needsMipmaps=this.needsMipmaps(e),t.levels=t.needsMipmaps?this.getMipLevels(e,o,a):1,e.isCubeTexture&&e.mipmaps.length>0&&t.levels++,r||e.isStorageTexture===!0||e.isExternalTexture===!0)s.createTexture(e,t),n.generation=e.version;else if(e.version>0){let c=e.image;if(c===void 0)Xe("Renderer: Texture marked for update but image is undefined.");else if(c.complete===!1)Xe("Renderer: Texture marked for update but image is incomplete.");else{if(e.images){let f=[];for(let d of e.images)f.push(d);t.images=f}else t.image=c;(n.isDefaultTexture===void 0||n.isDefaultTexture===!0)&&(s.createTexture(e,t),n.isDefaultTexture=!1,n.generation=e.version),e.source.dataReady===!0&&s.updateTexture(e,t);let u=e.isStorageTexture===!0&&e.mipmapsAutoUpdate===!1;t.needsMipmaps&&e.mipmaps.length===0&&!u&&s.generateMipmaps(e),e.onUpdate&&e.onUpdate(e)}}else s.createDefaultTexture(e),n.isDefaultTexture=!0,n.generation=e.version;n.initialized!==!0&&(n.initialized=!0,n.generation=e.version,n.bindGroups=new Set,this.info.createTexture(e),e.isVideoTexture&&ln.enabled===!0&&ln.getTransfer(e.colorSpace)!==kt&&Xe("WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace."),n.onDispose=()=>{this._destroyTexture(e)},e.addEventListener("dispose",n.onDispose)),n.version=e.version}updateSampler(e){return this.backend.updateSampler(e)}getSize(e,t=BMe){let n=e.images?e.images[0]:e.image;return n?(n.image!==void 0&&(n=n.image),e.isHTMLTexture?(t.width=n.offsetWidth||1,t.height=n.offsetHeight||1,t.depth=1):typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?(t.width=n.videoWidth||1,t.height=n.videoHeight||1,t.depth=1):typeof VideoFrame<"u"&&n instanceof VideoFrame?(t.width=n.displayWidth||1,t.height=n.displayHeight||1,t.depth=1):(t.width=n.width||1,t.height=n.height||1,t.depth=e.isCubeTexture?6:n.depth||1)):t.width=t.height=t.depth=1,t}getMipLevels(e,t,n){let r;return e.mipmaps.length>0?r=e.mipmaps.length:e.isCompressedTexture===!0?r=1:r=Math.floor(Math.log2(Math.max(t,n)))+1,r}needsMipmaps(e){return e.generateMipmaps===!0||e.mipmaps.length>0}_destroyRenderTarget(e){if(this.has(e)===!0){let t=this.get(e),n=t.textures,r=t.depthTexture;e.removeEventListener("dispose",t.onDispose);for(let s=0;s<n.length;s++)this._destroyTexture(n[s]);r&&this._destroyTexture(r),this.delete(e),this.backend.delete(e),this.info.memory.renderTargets--}}_destroyTexture(e){if(this.has(e)===!0){let t=this.get(e);e.removeEventListener("dispose",t.onDispose);let n=t.isDefaultTexture;if(this.backend.destroyTexture(e,n),t.bindGroups)for(let r of t.bindGroups){let s=this.backend.get(r);s.groups=void 0,s.versions=void 0;for(let o of r.bindings)o.isSampler&&o.texture===e&&(o.isSampledTexture!==!0&&this.backend.destroySampler(o),o.reset(),o.release())}this._htmlTextures.delete(e),this.delete(e),this.info.destroyTexture(e)}}},wS=class extends zt{constructor(e,t,n,r=1){super(e,t,n),this.a=r}set(e,t,n,r=1){return this.a=r,super.set(e,t,n)}copy(e){return e.a!==void 0&&(this.a=e.a),super.copy(e)}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}},N4=class extends gS{static get type(){return"OverrideContextNode"}constructor(e,t=null){super(t,{overrideNodes:e}),this.isOverrideContextNode=!0}getFlowContextData(){let e=[];this.traverse(r=>{r.isOverrideContextNode===!0&&e.push(r.value.overrideNodes)});let t=new Map(e.flatMap(r=>Array.from(r.entries()))),n=super.getFlowContextData();return n.overrideNodes=t,n}};function Sse(i,e=null,t=null){if(e&&e.isNode){let n=e;e=()=>n}return new N4(new Map([[i,e]]),t)}Ue("overrideNode",(i,e,t)=>Sse(e,t,i));function Tse(i,e=null){let t=new Map;for(let[n,r]of i){let s=r!==null?typeof r=="function"?r:()=>r:null;t.set(n,s)}return new N4(t,e)}Ue("overrideNodes",(i,e)=>Tse(e,i));var F4=class extends gi{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getMemberType(e,t){let n=this.getNodeType(e),r=e.getStructTypeNode(n),s;return r!==null?s=r.getMemberType(e,t):(ze(`TSL: Member "${t}" not found in struct "${n}".`,new ts),s="float"),s}getHash(){return String(this.id)}generate(){return this.name}},OMe=(i,e)=>new F4(i,e),sk=class extends Kt{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this._expressionNode=null,this._currentNode=null,this._nodeDataLibrary=new Map,this.isStackNode=!0}getElementType(e){return this.outputNode?this.outputNode.getElementType(e):"void"}generateNodeType(e){return this.outputNode?this.outputNode.getNodeType(e):"void"}getMemberType(e,t){return this.outputNode?this.outputNode.getMemberType(e,t):"void"}addToStack(e,t=-1){if(e.isNode!==!0)return ze("TSL: Invalid node added to stack.",new ts),this;if(t===-1)if(this._currentNode){let n=this._nodeDataLibrary.get(this._currentNode);n===void 0&&(n={delta:0},this._nodeDataLibrary.set(this._currentNode,n)),n.delta++,t=this.nodes.indexOf(this._currentNode)+n.delta}else t=this.nodes.length;return this.nodes.splice(t,0,e),this}addToStackBefore(e){let t=this._currentNode?this.nodes.indexOf(this._currentNode):0;return this.addToStack(e,t)}If(e,t){let n=new sx(t);return this._currentCond=xa(e,n),this.addToStack(this._currentCond)}ElseIf(e,t){let n=new sx(t),r=xa(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new sx(e),this}Switch(e){return this._expressionNode=Ht(e),this}Case(...e){let t=[];if(e.length>=2)for(let a=0;a<e.length-1;a++)t.push(this._expressionNode.equal(Ht(e[a])));else ze("TSL: Invalid parameter length. Case() requires at least two parameters.",new ts);let n=e[e.length-1],r=new sx(n),s=t[0];for(let a=1;a<t.length;a++)s=s.or(t[a]);let o=xa(s,r);return this._currentCond===null?(this._currentCond=o,this.addToStack(this._currentCond)):(this._currentCond.elseNode=o,this._currentCond=o,this)}Default(e){return this.Else(e),this}setup(e){let t=e.getNodeProperties(this),n=0;for(let r of this.getChildren())r.isVarNode&&r.isIntent(e)&&r.isAssign(e)!==!0||(t["node"+n++]=r);return t.outputNode||null}build(e,...t){let n=fz(),r=e.buildStage;mS(this),e.setActiveStack(this);for(let o=0;o<this.nodes.length;o++){let a=this.nodes[o],l=this._currentNode;if(this._currentNode=a,!(a.isVarNode&&a.isIntent(e)&&a.isAssign(e)!==!0)){if(r==="setup")a.build(e);else if(r==="analyze")a.build(e,this);else if(r==="generate"){let c=e.getDataFromNode(a,"any").stages,u=c&&c[e.shaderStage];if(a.isVarNode&&u&&u.length===1&&u[0]&&u[0].isStackNode)continue;a.build(e,"void")}this._currentNode=l}}let s;if(this.outputNode){let o=this.outputNode.build(e,...t);(e.buildStage!=="generate"||this.outputNode.getNodeType(e)!=="void")&&(s=o)}else s=super.build(e,...t);return mS(n),e.removeActiveStack(this),s}},r4=$n(sk).setParameterLength(0,1);function UMe(i){return Object.entries(i).map(([e,t])=>typeof t=="string"?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})}var ok=class extends Kt{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=UMe(e),this.name=t,this.isStructTypeNode=!0}getLength(){let e=1,t=0;for(let n of this.membersLayout){let r=n.type,s=PTe(r),o=LTe(r);e=Math.max(e,o);let l=t%e%o;l!==0&&(t+=o-l),t+=s}return Math.ceil(t/e)*e}getMemberType(e,t){let n=this.membersLayout.find(r=>r.name===t);return n?n.type:"void"}generateNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}setup(e){e.getStructTypeFromNode(this,this.membersLayout,this.name),e.addInclude(this)}generate(e){return this.getNodeType(e)}},ak=class extends Kt{static get type(){return"StructNode"}constructor(e,t){super("vec3"),this.structTypeNode=e,this.values=t,this.isStructNode=!0}generateNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}_getChildren(){let e=super._getChildren(),t=e.find(n=>n.childNode===this.structTypeNode);return e.splice(e.indexOf(t),1),e.push(t),e}generate(e){let t=e.getVarFromNode(this),n=t.type,r=e.getPropertyName(t);return e.addLineFlowCode(`${r} = ${e.generateStruct(n,this.structTypeNode.membersLayout,this.values)}`,this),t.name}},kMe=(i,e=null)=>{let t=new ok(i,e);return hz((...r)=>{let s=null;if(r.length>0)if(r[0].isNode){s={};let o=Object.keys(i);for(let a=0;a<r.length;a++)s[o[a]]=r[a]}else s=r[0];return new ak(t,s)},t)},B4=class extends Kt{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}generateNodeType(){return"OutputType"}generate(e){let t=e.getDataFromNode(this);if(t.membersLayout===void 0){let o=this.members,a=[];for(let l=0;l<o.length;l++){let c="m"+l,u=o[l].getNodeType(e);a.push({name:c,type:u,index:l})}t.membersLayout=a,t.structType=e.getOutputStructTypeFromNode(this,t.membersLayout)}let n=e.getOutputStructName(),r=this.members,s=n!==""?n+".":"";for(let o=0;o<r.length;o++){let a=r[o].build(e,t.membersLayout[o].type);e.addLineFlowCode(`${s}m${o} = ${a}`,this)}return n}},zMe=$n(B4),O4=class{constructor(e=Ms){this.blending=e,this.blendSrc=e0,this.blendDst=t0,this.blendEquation=oo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.premultiplyAlpha=!1}copy(e){return this.blending=e.blending,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.premultiplyAlpha=e.premultiplyAlpha,this}clone(){return new this.constructor().copy(this)}},VMe=new O4(ms),GMe=new O4(mb);function Ese(i,e){for(let t=0;t<i.length;t++)if(i[t].name===e)return t;return-1}var lk=class extends B4{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.blendModes={output:GMe},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||VMe}has(e){return this.outputNodes[e]!==void 0}get(e){return this.outputNodes[e]}merge(e){let t={...this.outputNodes,...e.outputNodes},n={...this.blendModes,...e.blendModes},r=Mse(t);return r.blendings=n,r}setup(e){let t=this.outputNodes,n=e.renderer.getRenderTarget(),r=[],s=n.textures;for(let o in t){let a=Ese(s,o);if(a===-1)continue;let l=e.getOutputType(a);r[a]=t[o].convert(l)}return this.members=r,super.setup(e)}},Mse=$n(lk),s1=class extends Ir{static get type(){return"BitcastNode"}constructor(e,t,n=null){super(),this.valueNode=e,this.conversionType=t,this.inputType=n,this.isBitcastNode=!0}generateNodeType(e){if(this.inputType!==null){let t=this.valueNode.getNodeType(e),n=e.getTypeLength(t);return e.getTypeFromLength(n,this.conversionType)}return this.conversionType}generate(e){let t=this.getNodeType(e),n="";if(this.inputType!==null){let r=this.valueNode.getNodeType(e);n=e.getTypeLength(r)===1?this.inputType:e.changeComponentType(r,this.inputType)}else n=this.valueNode.getNodeType(e);return`${e.getBitcastMethod(t,n)}( ${this.valueNode.build(e,n)} )`}},Cse=ct(s1).setParameterLength(2),qMe=i=>new s1(i,"int","float"),Rse=i=>new s1(i,"uint","float"),HMe=i=>new s1(i,"float","int"),WMe=i=>new s1(i,"float","uint"),RR={},th=class i extends Ie{static get type(){return"BitcountNode"}constructor(e,t){super(e,t),this.isBitcountNode=!0}_resolveElementType(e,t,n){n==="int"?t.assign(Cse(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return rt;case"int":return de;case"uvec2":return dz;case"uvec3":return c1;case"uvec4":return gz;case"ivec2":return zr;case"ivec3":return pz;case"ivec4":return Az}}_createTrailingZerosBaseLayout(e,t){let n=this._returnDataNode(t);return me(([s])=>{let o=rt(0);this._resolveElementType(s,o,t);let a=oe(o.bitAnd(Cz(o))),c=Rse(a).shiftRight(23).sub(127);return n(c)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createLeadingZerosBaseLayout(e,t){let n=this._returnDataNode(t);return me(([s])=>{$t(s.equal(rt(0)),()=>rt(32));let o=rt(0),a=rt(0);return this._resolveElementType(s,o,t),$t(o.shiftRight(16).equal(0),()=>{a.addAssign(16),o.shiftLeftAssign(16)}),$t(o.shiftRight(24).equal(0),()=>{a.addAssign(8),o.shiftLeftAssign(8)}),$t(o.shiftRight(28).equal(0),()=>{a.addAssign(4),o.shiftLeftAssign(4)}),$t(o.shiftRight(30).equal(0),()=>{a.addAssign(2),o.shiftLeftAssign(2)}),$t(o.shiftRight(31).equal(0),()=>{a.addAssign(1)}),n(a)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createOneBitsBaseLayout(e,t){let n=this._returnDataNode(t);return me(([s])=>{let o=rt(0);this._resolveElementType(s,o,t),o.assign(o.sub(o.shiftRight(rt(1)).bitAnd(rt(1431655765)))),o.assign(o.bitAnd(rt(858993459)).add(o.shiftRight(rt(2)).bitAnd(rt(858993459))));let a=o.add(o.shiftRight(rt(4))).bitAnd(rt(252645135)).mul(rt(16843009)).shiftRight(rt(24));return n(a)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createMainLayout(e,t,n,r){let s=this._returnDataNode(t);return me(([a])=>{if(n===1)return s(r(a));{let l=s(0),c=["x","y","z","w"];for(let u=0;u<n;u++){let f=c[u];l[f].assign(r(a[f]))}return l}}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}setup(e){let{method:t,aNode:n}=this,{renderer:r}=e;if(r.backend.isWebGPUBackend)return super.setup(e);let s=this.getInputType(e),o=e.getElementType(s),a=e.getTypeLength(s),l=`${t}_base_${o}`,c=`${t}_${s}`,u=RR[l];if(u===void 0){switch(t){case i.COUNT_LEADING_ZEROS:{u=this._createLeadingZerosBaseLayout(l,o);break}case i.COUNT_TRAILING_ZEROS:{u=this._createTrailingZerosBaseLayout(l,o);break}case i.COUNT_ONE_BITS:{u=this._createOneBitsBaseLayout(l,o);break}}RR[l]=u}let f=RR[c];return f===void 0&&(f=this._createMainLayout(c,s,a,u),RR[c]=f),me(()=>f(n))()}};th.COUNT_TRAILING_ZEROS="countTrailingZeros";th.COUNT_LEADING_ZEROS="countLeadingZeros";th.COUNT_ONE_BITS="countOneBits";var jMe=ct(th,th.COUNT_TRAILING_ZEROS).setParameterLength(1),XMe=ct(th,th.COUNT_LEADING_ZEROS).setParameterLength(1),$Me=ct(th,th.COUNT_ONE_BITS).setParameterLength(1),YMe=me(([i])=>{let e=i.toUint().mul(747796405).add(2891336453),t=e.shiftRight(e.shiftRight(28).add(4)).bitXor(e).mul(277803737);return t.shiftRight(22).bitXor(t).toFloat().mul(1/2**32)}),ck=(i,e)=>ru(Tn(4,i.mul(ai(1,i))),e),ZMe=(i,e)=>i.lessThan(.5)?ck(i.mul(2),e).div(2):ai(1,ck(Tn(ai(1,i),2),e).div(2)),KMe=(i,e,t)=>ru(Ac(ru(i,e),Ls(ru(i,e),ru(ai(1,i),t))),1/e),QMe=(i,e)=>Ka(A4.mul(e.mul(i).sub(1))).div(A4.mul(e.mul(i).sub(1))),SS=class extends Ir{static get type(){return"PackFloatNode"}constructor(e,t){super(),this.vectorNode=t,this.encoding=e,this.isPackFloatNode=!0}generateNodeType(){return"uint"}generate(e){let t=this.vectorNode.getNodeType(e);return`${e.getFloatPackingMethod(this.encoding)}(${this.vectorNode.build(e,t)})`}},JMe=ct(SS,"snorm").setParameterLength(1),eCe=ct(SS,"unorm").setParameterLength(1),tCe=ct(SS,"float16").setParameterLength(1),TS=class extends Ir{static get type(){return"UnpackFloatNode"}constructor(e,t){super(),this.uintNode=t,this.encoding=e,this.isUnpackFloatNode=!0}generateNodeType(){return"vec2"}generate(e){let t=this.uintNode.getNodeType(e);return`${e.getFloatUnpackingMethod(this.encoding)}(${this.uintNode.build(e,t)})`}},nCe=ct(TS,"snorm").setParameterLength(1),iCe=ct(TS,"unorm").setParameterLength(1),rCe=ct(TS,"float16").setParameterLength(1),Yd=me(([i])=>i.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),sCe=me(([i])=>pe(Yd(i.z.add(Yd(i.y.mul(1)))),Yd(i.z.add(Yd(i.x.mul(1)))),Yd(i.y.add(Yd(i.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),oCe=me(([i,e,t])=>{let n=pe(i).toVar(),r=oe(1.4).toVar(),s=oe(0).toVar(),o=pe(n).toVar();return Oi({start:oe(0),end:oe(3),type:"float",condition:"<="},()=>{let a=pe(sCe(o.mul(2))).toVar();n.addAssign(a.add(t.mul(oe(.1).mul(e)))),o.mulAssign(1.8),r.mulAssign(1.5),n.mulAssign(1.2);let l=oe(Yd(n.z.add(Yd(n.x.add(Yd(n.y)))))).toVar();s.addAssign(l.div(r)),o.addAssign(.14)}),s}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]}),uk=class extends Kt{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFn=null,this.global=!0}generateNodeType(e){return this.getCandidateFn(e).shaderNode.layout.type}getCandidateFn(e){let t=this.parametersNodes,n=this._candidateFn;if(n===null){let r=null,s=-1;for(let o of this.functionNodes){let l=o.shaderNode.layout;if(l===null)throw new Error("THREE.FunctionOverloadingNode: FunctionNode must be a layout.");let c=l.inputs;if(t.length===c.length){let u=0;for(let f=0;f<t.length;f++){let d=t[f],A=c[f];d.getNodeType(e)===A.type&&u++}u>s&&(r=o,s=u)}}this._candidateFn=n=r}return n}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}},aCe=$n(uk),Ko=i=>(...e)=>aCe(i,...e),Ex=Xt(0).setGroup(Jt).onRenderUpdate(i=>i.time),lCe=Xt(0).setGroup(Jt).onRenderUpdate(i=>i.deltaTime),Ise=Xt(0,"uint").setGroup(Jt).onRenderUpdate(i=>i.frameId),cCe=(i=Ex)=>i.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),uCe=(i=Ex)=>i.fract().round(),hCe=(i=Ex)=>i.add(.5).fract().mul(2).sub(1).abs(),fCe=(i=Ex)=>i.fract();function dCe(i,e=null){return ip(e,{getUV:typeof i=="function"?i:()=>i})}var pCe=me(([i,e,t=dt(.5)])=>US(i.sub(t),e).add(t)),mCe=me(([i,e,t=dt(.5)])=>{let n=i.sub(t),r=n.dot(n),o=r.mul(r).mul(e);return i.add(n.mul(o))}),ACe=me(({position:i=null,horizontal:e=!0,vertical:t=!1})=>{let n;i!==null?(n=su.toVar(),n[3][0]=i.x,n[3][1]=i.y,n[3][2]=i.z):n=su;let r=Sm.mul(n);return dx(e)&&(r[0][0]=su[0].length(),r[0][1]=0,r[0][2]=0),dx(t)&&(r[1][0]=0,r[1][1]=su[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,Ja.mul(r).mul(Cr)}),gCe=me(([i=null])=>{let e=T4();return T4(pV(i)).sub(e).lessThan(0).select(Zu,i)}),vCe=me(([i,e=Ui(),t=oe(0)])=>{let n=i.x,r=i.y,s=t.mod(n.mul(r)).floor(),o=s.mod(n),a=r.sub(s.add(1).div(n).ceil()),l=i.reciprocal(),c=dt(o,a);return e.add(c).mul(l)}),Pse=me(([i,e=null,t=null,n=oe(1),r=Cr,s=wa])=>{let o=s.abs().normalize();o=o.div(o.dot(pe(1)));let a=r.yz.mul(n),l=r.zx.mul(n),c=r.xy.mul(n),u=i.value,f=e!==null?e.value:u,d=t!==null?t.value:u,A=fi(u,a).mul(o.x),y=fi(f,l).mul(o.y),w=fi(d,c).mul(o.z);return Ls(A,y,w)}),_Ce=(...i)=>Pse(...i),H_=new Na,Ng=new re,W_=new re,tU=new re,Hw=new cn,IR=new re(0,0,-1),pf=new xn,Ww=new re,PR=new re,jw=new xn,LR=new Oe,U4=new Ba,xCe=Zu.flipX();U4.depthTexture=new Cs(1,1);var DR=!1,hk=class i extends cu{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||U4.texture,xCe),this._reflectorBaseNode=e.reflector||new fk(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(this._depthNode===null){if(this._reflectorBaseNode.depth!==!0)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=new i({defaultTexture:U4.depthTexture,reflector:this._reflectorBaseNode})}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){let e=new this.constructor(this.reflectorNode);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e._reflectorBaseNode=this._reflectorBaseNode,e}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}},fk=class extends Kt{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();let{target:n=new lr,resolutionScale:r=1,generateMipmaps:s=!1,bounces:o=!0,depth:a=!1,samples:l=0}=t;this.textureNode=e,this.target=n,this.resolutionScale=r,t.resolution!==void 0&&(ni('ReflectorNode: The "resolution" parameter has been renamed to "resolutionScale".'),this.resolutionScale=t.resolution),this.generateMipmaps=s,this.bounces=o,this.depth=a,this.samples=l,this.updateBeforeType=o?yn.RENDER:yn.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){let n=this.resolutionScale;t.getDrawingBufferSize(LR),e.setSize(Math.round(LR.width*n),Math.round(LR.height*n))}setup(e){return this._updateResolution(U4,e.renderer),super.setup(e)}dispose(){super.dispose();for(let e of this.renderTargets.values())e.dispose()}getVirtualCamera(e){let t=this.virtualCameras.get(e);return t===void 0&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return t===void 0&&(t=new Ba(0,0,{type:Wi,samples:this.samples}),this.generateMipmaps===!0&&(t.texture.minFilter=Y8,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new Cs),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&DR)return!1;DR=!0;let{scene:t,camera:n,renderer:r,material:s}=e,{target:o}=this,a=this.getVirtualCamera(n),l=this.getRenderTarget(a);r.getDrawingBufferSize(LR),this._updateResolution(l,r),W_.setFromMatrixPosition(o.matrixWorld),tU.setFromMatrixPosition(n.matrixWorld),Hw.extractRotation(o.matrixWorld),Ng.set(0,0,1),Ng.applyMatrix4(Hw),Ww.subVectors(W_,tU);let c=Ww.dot(Ng)>0,u=!1;if(c===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){DR=!1;return}u=!0}Ww.reflect(Ng).negate(),Ww.add(W_),Hw.extractRotation(n.matrixWorld),IR.set(0,0,-1),IR.applyMatrix4(Hw),IR.add(tU),PR.subVectors(W_,IR),PR.reflect(Ng).negate(),PR.add(W_),a.coordinateSystem=n.coordinateSystem,a.position.copy(Ww),a.up.set(0,1,0),a.up.applyMatrix4(Hw),a.up.reflect(Ng),a.lookAt(PR),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),H_.setFromNormalAndCoplanarPoint(Ng,W_),H_.applyMatrix4(a.matrixWorldInverse),pf.set(H_.normal.x,H_.normal.y,H_.normal.z,H_.constant);let f=a.projectionMatrix;jw.x=(Math.sign(pf.x)+f.elements[8])/f.elements[0],jw.y=(Math.sign(pf.y)+f.elements[9])/f.elements[5],jw.z=-1,jw.w=(1+f.elements[10])/f.elements[14],pf.multiplyScalar(1/pf.dot(jw));let d=0;f.elements[2]=pf.x,f.elements[6]=pf.y,f.elements[10]=r.coordinateSystem===yl?pf.z-d:pf.z+1-d,f.elements[14]=pf.w,this.textureNode.value=l.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=l.depthTexture),s.visible=!1;let A=r.getRenderTarget(),y=r.getMRT(),w=r.autoClear;r.setMRT(null),r.setRenderTarget(l),r.autoClear=!0;let S=t.name;t.name=(t.name||"Scene")+" [ Reflector ]",u?(r.clear(),this.hasOutput=!1):(r.render(t,a),this.hasOutput=!0),t.name=S,r.setMRT(y),r.setRenderTarget(A),r.autoClear=w,s.visible=!0,DR=!1,this.forceUpdate=!1}get resolution(){return ni('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){ni('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}},yCe=i=>new hk(i),nU=new Ou(-1,1,1,-1,0,1),dk=class extends Xn{constructor(e=!1){super();let t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new Ln([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Ln(t,2))}},bCe=new dk,ES=class extends Hn{constructor(e=null){super(bCe,e),this.camera=nU,this.isQuadMesh=!0}async renderAsync(e){ni('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await e.init(),e.render(this,nU)}render(e){e.render(this,nU)}},wCe=new Oe,pk=class extends cu{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:Wi}){let s=new Ba(t,n,r);super(s.texture,Ui()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=n,this.renderTarget=s,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._resolutionScale=1,this._rttNode=null,this._quadMesh=new ES(new Pr),this.updateBeforeType=yn.RENDER}get autoResize(){return this.width===null}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){let n=Math.floor(e*this._resolutionScale),r=Math.floor(t*this._resolutionScale);this.renderTarget.setSize(n,r),this.textureNeedsUpdate=!0}setResolutionScale(e){return this._resolutionScale=e,this.autoResize===!1&&this.setSize(this.width,this.height),this}getResolutionScale(){return this._resolutionScale}updateBefore({renderer:e}){if(this.textureNeedsUpdate===!1&&this.autoUpdate===!1)return;this.textureNeedsUpdate=!1;let t=e.getRenderTarget();if(this.autoResize===!0){let r=e.getDrawingBufferSize(wCe),s=Math.floor(r.width*this._resolutionScale),o=Math.floor(r.height*this._resolutionScale);(s!==this.renderTarget.width||o!==this.renderTarget.height)&&(this.renderTarget.setSize(s,o),this.textureNeedsUpdate=!0)}let n="RTT";this.node.name&&(n=this.node.name+" [ "+n+" ]"),this._quadMesh.material.fragmentNode=this._rttNode,this._quadMesh.name=n,e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(t)}clone(){let e=new cu(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}},Lse=(i,...e)=>new pk(Ht(i),...e),SCe=(i,...e)=>i.isSampleNode||i.isTextureNode?i:i.isPassNode?i.getTextureNode():Lse(i,...e),rx=me(([i,e,t],n)=>{let r;n.renderer.coordinateSystem===yl?(i=dt(i.x,i.y.oneMinus()).mul(2).sub(1),r=Ft(pe(i,e),1)):r=Ft(pe(i.x,i.y.oneMinus(),e).mul(2).sub(1),1);let s=Ft(t.mul(r));return s.xyz.div(s.w)}),TCe=me(([i,e])=>{let t=e.mul(Ft(i,1)),n=t.xy.div(t.w).mul(.5).add(.5).toVar();return dt(n.x,n.y.oneMinus())}),ECe=me(([i,e,t])=>{let n=t1(xs(e)),r=zr(i.mul(n)).toVar(),s=xs(e,r).toVar(),o=xs(e,r.sub(zr(2,0))).toVar(),a=xs(e,r.sub(zr(1,0))).toVar(),l=xs(e,r.add(zr(1,0))).toVar(),c=xs(e,r.add(zr(2,0))).toVar(),u=xs(e,r.add(zr(0,2))).toVar(),f=xs(e,r.add(zr(0,1))).toVar(),d=xs(e,r.sub(zr(0,1))).toVar(),A=xs(e,r.sub(zr(0,2))).toVar(),y=fr(ai(oe(2).mul(a).sub(o),s)).toVar(),w=fr(ai(oe(2).mul(l).sub(c),s)).toVar(),S=fr(ai(oe(2).mul(f).sub(u),s)).toVar(),T=fr(ai(oe(2).mul(d).sub(A),s)).toVar(),R=rx(i,s,t).toVar(),P=y.lessThan(w).select(R.sub(rx(i.sub(dt(oe(1).div(n.x),0)),a,t)),R.negate().add(rx(i.add(dt(oe(1).div(n.x),0)),l,t))),I=S.lessThan(T).select(R.sub(rx(i.add(dt(0,oe(1).div(n.y))),f,t)),R.negate().add(rx(i.sub(dt(0,oe(1).div(n.y))),d,t)));return ya(ep(P,I))}),bV=me(([i])=>Qu(oe(52.9829189).mul(Qu(lu(i,dt(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),Yu=me(([i,e,t])=>{let n=oe(2.399963229728653),r=el(oe(i).add(.5).div(oe(e))),s=oe(i).mul(n).add(t);return dt($u(s),Ka(s)).mul(r)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]}),mk=class extends Kt{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(Ui())}sample(e){return this.callback(e)}},MCe=(i,e=null)=>new mk(i,Ht(e)),o1=class extends ec{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}},Ak=class extends Hi{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}},CCe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=s4("float")):(t=ane(e),n=s4(e));let r=new Ak(i,t,n);return Am(r,e,i)},RCe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=s4("float")):(t=ane(e),n=s4(e));let r=new o1(i,t,n);return Am(r,e,r.count)},gk=class extends Kt{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}},ICe=xt(gk),iU=new cn,Dse=Xt(0).setGroup(Jt).onRenderUpdate(({scene:i})=>i.backgroundBlurriness),vk=Xt(1).setGroup(Jt).onRenderUpdate(({scene:i})=>i.backgroundIntensity),Nse=Xt(new cn).setGroup(Jt).onRenderUpdate(({scene:i})=>{let e=i.background;return e!==null&&e.isTexture&&e.mapping!==Lb||i.backgroundNode&&i.backgroundNode.isNode?iU.makeRotationFromEuler(i.backgroundRotation).transpose():iU.identity(),iU}),k4=class extends cu{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=Yo.WRITE_ONLY}getInputType(){return"storageTexture"}getTransformedUV(e){return e}setup(e){super.setup(e);let t=e.getNodeProperties(this);return t.storeNode=this.storeNode,t}setAccess(e){return this.access=e,this}setMipLevel(e){return this.mipLevel=e,this}generate(e,t){return this.storeNode!==null?(this.generateStore(e),""):super.generate(e,t)}generateSnippet(e,t,n,r,s,o,a,l,c){let u=this.value;return e.generateStorageTextureLoad(u,t,n,r,o,c)}toReadWrite(){return this.setAccess(Yo.READ_WRITE)}toReadOnly(){return this.setAccess(Yo.READ_ONLY)}toWriteOnly(){return this.setAccess(Yo.WRITE_ONLY)}store(e,t){let n=this.clone();return n.referenceNode=this.getBase(),n.uvNode=e,n.storeNode=t,t!==null&&n.toStack(),n}generateStore(e){let t=e.getNodeProperties(this),{uvNode:n,storeNode:r,depthNode:s}=t,o=super.generate(e,"property"),a=n.build(e,this.value.is3DTexture===!0?"uvec3":"uvec2"),l=r.build(e,"vec4"),c=s?s.build(e,"int"):null,u=e.generateTextureStore(this.value,o,a,c,l);e.addLineFlowCode(u,this)}clone(){let e=super.clone();return e.storeNode=this.storeNode,e.mipLevel=this.mipLevel,e.access=this.access,e}},Fse=$n(k4).setParameterLength(1,3),PCe=(i,e,t)=>{let n;return i.isStorageTextureNode===!0?n=i.store(e,t):(n=Fse(i,e,t),t!==null&&n.toStack()),n},_k=class extends k4{static get type(){return"StorageTexture3DNode"}constructor(e,t,n=null){super(e,t,n),this.isStorageTexture3DNode=!0}getDefaultUV(){return pe(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}},LCe=$n(_k).setParameterLength(1,3),DCe=me(({texture:i,uv:e})=>{let n=pe().toVar();return $t(e.x.lessThan(1e-4),()=>{n.assign(pe(1,0,0))}).ElseIf(e.y.lessThan(1e-4),()=>{n.assign(pe(0,1,0))}).ElseIf(e.z.lessThan(1e-4),()=>{n.assign(pe(0,0,1))}).ElseIf(e.x.greaterThan(1-1e-4),()=>{n.assign(pe(-1,0,0))}).ElseIf(e.y.greaterThan(1-1e-4),()=>{n.assign(pe(0,-1,0))}).ElseIf(e.z.greaterThan(1-1e-4),()=>{n.assign(pe(0,0,-1))}).Else(()=>{let s=i.sample(e.add(pe(-.01,0,0))).r.sub(i.sample(e.add(pe(.01,0,0))).r),o=i.sample(e.add(pe(0,-.01,0))).r.sub(i.sample(e.add(pe(0,.01,0))).r),a=i.sample(e.add(pe(0,0,-.01))).r.sub(i.sample(e.add(pe(0,0,.01))).r);n.assign(pe(s,o,a))}),n.normalize()}),xk=class extends cu{static get type(){return"Texture3DNode"}constructor(e,t=null,n=null){super(e,t,n),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return pe(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}normal(e){return DCe({texture:this,uv:e})}},wV=$n(xk).setParameterLength(1,3),NCe=(...i)=>wV(...i).setSampler(!1),FCe=(i,e,t)=>wV(i,e).level(t),yk=class extends Ax{static get type(){return"UserDataNode"}constructor(e,t,n=null){super(e,t,n),this.userData=n}updateReference(e){return this.reference=this.userData!==null?this.userData:e.object.userData,this.reference}},BCe=(i,e,t)=>new yk(i,e,t),Ete=new WeakMap,bk=class extends Ir{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=yn.OBJECT,this.updateAfterType=yn.OBJECT,this.previousModelWorldMatrix=Xt(new cn),this.previousProjectionMatrix=Xt(new cn).setGroup(Jt),this.previousCameraViewMatrix=Xt(new cn)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:n}){let r=Mte(n);this.previousModelWorldMatrix.value.copy(r);let s=Bse(t);s.frameId!==e&&(s.frameId=e,s.previousProjectionMatrix===void 0?(s.previousProjectionMatrix=new cn,s.previousCameraViewMatrix=new cn,s.currentProjectionMatrix=new cn,s.currentCameraViewMatrix=new cn,s.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(s.previousProjectionMatrix.copy(s.currentProjectionMatrix),s.previousCameraViewMatrix.copy(s.currentCameraViewMatrix)),s.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(s.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(s.previousCameraViewMatrix))}updateAfter({object:e}){Mte(e).copy(e.matrixWorld)}setup(){let e=this.projectionMatrix===null?Ja:Xt(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(Ef).mul(Cr),r=this.previousProjectionMatrix.mul(t).mul(i1),s=n.xy.div(n.w),o=r.xy.div(r.w);return ai(s,o)}};function Bse(i){let e=Ete.get(i);return e===void 0&&(e={},Ete.set(i,e)),e}function Mte(i,e=0){let t=Bse(i),n=t[e];return n===void 0&&(t[e]=n=new cn,t[e].copy(i.matrixWorld)),n}var OCe=xt(bk),UCe=me(([i,e])=>Pl(1,i.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),kCe=me(([i,e])=>Pl(i.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),zCe=me(([i,e])=>i.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),VCe=me(([i,e])=>Qn(i.mul(2).mul(e),i.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),e1(.5,i))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),GCe=me(([i,e])=>{let t=e.a.add(i.a.mul(e.a.oneMinus()));return Ft(e.rgb.mul(e.a).add(i.rgb.mul(i.a).mul(e.a.oneMinus())).div(t),t)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),qCe=me(([i])=>SV(i.rgb)),HCe=me(([i,e=oe(1)])=>e.mix(SV(i.rgb),i.rgb).max(0)),WCe=me(([i,e=oe(0)])=>{let t=Ls(i.r,i.g,i.b).div(3),n=i.r.max(i.g.max(i.b)),r=n.sub(t).mul(e).mul(-3);return Qn(i.rgb,n,r).max(0)}),jCe=me(([i,e=oe(1)])=>{let t=pe(.57735,.57735,.57735),n=e.cos();return pe(i.rgb.mul(n).add(t.cross(i.rgb).mul(e.sin()).add(t.mul(lu(t,i.rgb).mul(n.oneMinus()))))).max(0)}),SV=(i,e=pe(ln.getLuminanceCoefficients(new re)))=>lu(i,e),XCe=me(([i,e=pe(1),t=pe(0),n=pe(1),r=oe(1),s=pe(ln.getLuminanceCoefficients(new re,n0))])=>{let o=i.rgb.dot(pe(s)),a=Vr(i.rgb.mul(e).add(t),0),l=a.pow(n);return $t(a.r.greaterThan(0),()=>{a.r.assign(l.r)}),$t(a.g.greaterThan(0),()=>{a.g.assign(l.g)}),$t(a.b.greaterThan(0),()=>{a.b.assign(l.b)}),a.assign(o.add(a.sub(o).mul(r)).max(0)),Ft(a.rgb,i.a)}),$Ce=me(([i,e])=>i.mul(e).floor().div(e)),NR=null,wk=class extends gx{static get type(){return"ViewportSharedTextureNode"}constructor(e=Zu,t=null){NR===null&&(NR=new jA),super(e,t,NR)}getTextureForReference(){return NR}updateReference(){return this}},YCe=$n(wk).setParameterLength(0,2),FR=new Oe,z4=class extends cu{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.isPassTextureNode=!0,this.setUpdateMatrix(!1)}setup(e){let t=e.getNodeProperties(this);return t.passNode=this.passNode,super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}},V4=class extends z4{static get type(){return"PassMultipleTextureNode"}constructor(e,t,n=!1){super(e,null),this.textureName=t,this.previousTexture=n,this.isPassMultipleTextureNode=!0}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){let e=new this.constructor(this.passNode,this.textureName,this.previousTexture);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e}},If=class i extends Ir{static get type(){return"PassNode"}constructor(e,t,n,r={}){super("vec4"),this.scope=e,this.scene=t,this.camera=n,this.options=r,this._width=1,this._height=1;let s=new Ba(this._width,this._height,{type:Wi,...r});s.texture.name="output";let o=null;(this.scope===i.DEPTH||r.depthBuffer!==!1)&&(o=new Cs,o.isRenderTargetTexture=!0,o.name="depth",s.depthTexture=o),this.renderTarget=s,this.overrideMaterial=null,this.transparent=!0,this.opaque=!0,this.contextNode=null,this._contextNodeCache=null,this._textures={output:s.texture},o!==null&&(this._textures.depth=o),this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=Xt(0),this._cameraFar=Xt(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=yn.FRAME,this.global=!0}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setResolution(e){return Xe("PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead."),this.setResolutionScale(e)}getResolution(){return Xe("PassNode: .getResolution() is deprecated. Use .getResolutionScale() instead."),this.getResolutionScale()}setLayers(e){return this._layers=e,this}getLayers(){return this._layers}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getTexture(e){let t=this._textures[e];if(t===void 0){if(e==="depth")throw new Error("THREE.PassNode: Depth texture is not available for this pass.");t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)}return t}getPreviousTexture(e){let t=this._previousTextures[e];return t===void 0&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){let t=this._previousTextures[e];if(t!==void 0){let n=this._textures[e],r=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[r]=t,this._textures[e]=t,this._previousTextures[e]=n,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return t===void 0&&(t=new V4(this,e),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return t===void 0&&(this._textureNodes[e]===void 0&&this.getTextureNode(e),t=new V4(this,e,!0),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(t===void 0){let n=this._cameraNear,r=this._cameraFar;this._viewZNodes[e]=t=OI(this.getTextureNode(e),n,r)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(t===void 0){let n=this._cameraNear,r=this._cameraFar,s=this.getViewZNode(e);this._linearDepthNodes[e]=t=Zg(s,n,r)}return t}async compileAsync(e){let t=e.getRenderTarget(),n=e.getMRT();e.setRenderTarget(this.renderTarget),e.setMRT(this._mrt),await e.compileAsync(this.scene,this.camera),e.setRenderTarget(t),e.setMRT(n)}setup({renderer:e}){return this.renderTarget.samples=this.options.samples===void 0?e.samples:this.options.samples,this.renderTarget.texture.type=e.getOutputBufferType(),e.reversedDepthBuffer===!0&&this.renderTarget.depthTexture!==null&&(this.renderTarget.depthTexture.type=cr),this.scope===i.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){let{renderer:t}=e,{scene:n}=this,r,s=t.getOutputRenderTarget();s&&s.isXRRenderTarget===!0?(r=t.xr.getCamera(),t.xr.updateCamera(r),FR.set(s.width,s.height)):(r=this.camera,t.getDrawingBufferSize(FR)),this.setSize(FR.width,FR.height);let o=t.getRenderTarget(),a=t.getMRT(),l=t.autoClear,c=t.transparent,u=t.opaque,f=r.layers.mask,d=t.contextNode,A=n.overrideMaterial;this._cameraNear.value=r.near,this._cameraFar.value=r.far,this._layers!==null&&(r.layers.mask=this._layers.mask);for(let w in this._previousTextures)this.toggleTexture(w);this.overrideMaterial!==null&&(n.overrideMaterial=this.overrideMaterial),t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.autoClear=!0,t.transparent=this.transparent,t.opaque=this.opaque,this.contextNode!==null&&((this._contextNodeCache===null||this._contextNodeCache.version!==this.version)&&(this._contextNodeCache={version:this.version,context:ip({...t.contextNode.getFlowContextData(),...this.contextNode.getFlowContextData()})}),t.contextNode=this._contextNodeCache.context);let y=n.name;n.name=this.name?this.name:n.name,t.render(n,r),n.name=y,n.overrideMaterial=A,t.setRenderTarget(o),t.setMRT(a),t.autoClear=l,t.transparent=c,t.opaque=u,t.contextNode=d,r.layers.mask=f}setSize(e,t){this._width=e,this._height=t;let n=Math.floor(this._width*this._resolutionScale),r=Math.floor(this._height*this._resolutionScale);this.renderTarget.setSize(n,r),this._scissor!==null?(this.renderTarget.scissor.copy(this._scissor).multiplyScalar(this._resolutionScale).floor(),this.renderTarget.scissorTest=!0):this.renderTarget.scissorTest=!1,this._viewport!==null&&this.renderTarget.viewport.copy(this._viewport).multiplyScalar(this._resolutionScale).floor()}setScissor(e,t,n,r){e===null?this._scissor=null:(this._scissor===null&&(this._scissor=new xn),e.isVector4?this._scissor.copy(e):this._scissor.set(e,t,n,r))}setViewport(e,t,n,r){e===null?this._viewport=null:(this._viewport===null&&(this._viewport=new xn),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,n,r))}dispose(){this.renderTarget.dispose()}};If.COLOR="color";If.DEPTH="depth";var ZCe=(i,e,t)=>new If(If.COLOR,i,e,t),KCe=(i,e)=>new z4(i,e),QCe=(i,e,t)=>new If(If.DEPTH,i,e,t),Sk=class extends If{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,s){super(If.COLOR,e,t),this.colorNode=n,this.thicknessNode=r,this.alphaNode=s,this._materialCache=new WeakMap,this.name="Outline Pass"}updateBefore(e){let{renderer:t}=e,n=t.getRenderObjectFunction();t.setRenderObjectFunction((r,s,o,a,l,c,u,f)=>{if((l.isMeshToonMaterial||l.isMeshToonNodeMaterial)&&l.wireframe===!1){let d=this._getOutlineMaterial(l);t.renderObject(r,s,o,a,d,c,u,f)}t.renderObject(r,s,o,a,l,c,u,f)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){let e=new Pr;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=mi;let t=wa.negate(),n=Ja.mul(Ef),r=oe(1),s=n.mul(Ft(Cr,1)),o=n.mul(Ft(Cr.add(t),1)),a=ya(s.sub(o));return e.vertexNode=s.add(a.mul(this.thicknessNode).mul(s.w).mul(r)),e.colorNode=Ft(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return t===void 0&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}},JCe=(i,e,t=new zt(0,0,0),n=.003,r=1)=>new Sk(i,e,Ht(t),Ht(n),Ht(r)),Ose=me(([i,e])=>i.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Use=me(([i,e])=>(i=i.mul(e),i.div(i.add(1)).clamp())).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),kse=me(([i,e])=>{i=i.mul(e),i=i.sub(.004).max(0);let t=i.mul(i.mul(6.2).add(.5)),n=i.mul(i.mul(6.2).add(1.7)).add(.06);return t.div(n).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),eRe=me(([i])=>{let e=i.mul(i.add(.0245786)).sub(90537e-9),t=i.mul(i.add(.432951).mul(.983729)).add(.238081);return e.div(t)}),zse=me(([i,e])=>{let t=To(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=To(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return i=i.mul(e).div(.6),i=t.mul(i),i=eRe(i),i=n.mul(i),i.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),tRe=To(pe(1.6605,-.1246,-.0182),pe(-.5876,1.1329,-.1006),pe(-.0728,-.0083,1.1187)),nRe=To(pe(.6274,.0691,.0164),pe(.3293,.9195,.088),pe(.0433,.0113,.8956)),iRe=me(([i])=>{let e=pe(i).toVar(),t=pe(e.mul(e)).toVar(),n=pe(t.mul(t)).toVar();return oe(15.5).mul(n.mul(t)).sub(Tn(40.14,n.mul(e))).add(Tn(31.96,n).sub(Tn(6.868,t.mul(e))).add(Tn(.4298,t).add(Tn(.1191,e).sub(.00232))))}),Vse=me(([i,e])=>{let t=pe(i).toVar(),n=To(pe(.856627153315983,.137318972929847,.11189821299995),pe(.0951212405381588,.761241990602591,.0767994186031903),pe(.0482516061458583,.101439036467562,.811302368396859)),r=To(pe(1.1271005818144368,-.1413297634984383,-.14132976349843826),pe(-.11060664309660323,1.157823702216272,-.11060664309660294),pe(-.016493938717834573,-.016493938717834257,1.2519364065950405)),s=oe(-12.47393),o=oe(4.026069);return t.mulAssign(e),t.assign(nRe.mul(t)),t.assign(n.mul(t)),t.assign(Vr(t,1e-10)),t.assign(xf(t)),t.assign(t.sub(s).div(o.sub(s))),t.assign(Ju(t,0,1)),t.assign(iRe(t)),t.assign(r.mul(t)),t.assign(ru(Vr(pe(0),t),pe(2.2))),t.assign(tRe.mul(t)),t.assign(Ju(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Gse=me(([i,e])=>{let t=oe(.76),n=oe(.15);i=i.mul(e);let r=Pl(i.r,Pl(i.g,i.b)),s=xa(r.lessThan(.08),r.sub(Tn(6.25,r.mul(r))),.04);i.subAssign(s);let o=Vr(i.r,Vr(i.g,i.b));$t(o.lessThan(t),()=>i);let a=ai(1,t),l=ai(1,a.mul(a).div(o.add(a.sub(t))));i.mulAssign(l.div(o));let c=ai(1,Ac(1,n.mul(o.sub(l)).add(1)));return Qn(i,pe(l),c)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),hr=class extends Kt{static get type(){return"CodeNode"}constructor(e="",t=[],n=""){super("code"),this.isCodeNode=!0,this.global=!0,this.code=e,this.includes=t,this.language=n}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){let t=this.getIncludes(e);for(let r of t)r.build(e);let n=e.getCodeFromNode(this,this.getNodeType(e));return n.code=this.code,n.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}},GI=$n(hr).setParameterLength(1,3),rRe=(i,e)=>GI(i,e,"js"),sRe=(i,e)=>GI(i,e,"wgsl"),oRe=(i,e)=>GI(i,e,"glsl"),G4=class extends hr{static get type(){return"FunctionNode"}constructor(e="",t=[],n=""){super(e,t,n)}generateNodeType(e){return this.getNodeFunction(e).type}getMemberType(e,t){let n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){let t=e.getDataFromNode(this),n=t.nodeFunction;return n===void 0&&(n=e.parser.parseFunction(this.code),t.nodeFunction=n),n}generate(e,t){super.generate(e);let n=this.getNodeFunction(e),r=n.name,s=n.type,o=e.getCodeFromNode(this,s);r!==""&&(o.name=r);let a=e.getPropertyName(o),l=this.getNodeFunction(e).getCode(a);return o.code=l+`4159-`,t==="property"?a:e.format(`${a}()`,s,t)}},qse=(i,e=[],t="")=>{let n=new G4(i,e,t);return hz((...s)=>n.call(...s),n)},aRe=(i,e)=>qse(i,e,"glsl"),lRe=(i,e)=>qse(i,e,"wgsl");function TV(i){let e,t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||ys.z).negate()}var Hse=me(([i,e],t)=>{let n=TV(t);return gc(i,e,n)}),Wse=me(([i],e)=>{let t=TV(e);return i.mul(i,t,t).negate().exp().oneMinus()}),cRe=me(([i,e],t)=>{let n=TV(t),s=e.sub(wf.y).max(0).toConst().mul(n).toConst();return i.mul(i,s,s).negate().exp().oneMinus()}),Tk=me(([i,e])=>Ft(e.toFloat().mix(lx.rgb,i.toVec3()),lx.a)),Fg=null,Bg=null,Ek=class extends Kt{static get type(){return"RangeNode"}constructor(e=oe(),t=oe()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){let t=this.getConstNode(this.minNode),n=this.getConstNode(this.maxNode),r=e.getTypeLength(dm(t.value)),s=e.getTypeLength(dm(n.value));return r>s?r:s}generateNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}getConstNode(e){let t=null;if(e.traverse(n=>{n.isConstNode===!0&&(t=n)}),t===null)throw new x4('THREE.TSL: No "ConstNode" found in node graph.',this.stackTrace);return t}setup(e){let t=e.object,n=null;if(t.count>1){let r=this.getConstNode(this.minNode),s=this.getConstNode(this.maxNode),o=r.value,a=s.value,l=e.getTypeLength(dm(o)),c=e.getTypeLength(dm(a));Fg=Fg||new xn,Bg=Bg||new xn,Fg.setScalar(0),Bg.setScalar(0),l===1?Fg.setScalar(o):o.isColor?Fg.set(o.r,o.g,o.b,1):Fg.set(o.x,o.y,o.z||0,o.w||0),c===1?Bg.setScalar(a):a.isColor?Bg.set(a.r,a.g,a.b,1):Bg.set(a.x,a.y,a.z||0,a.w||0);let u=4,f=u*t.count,d=new Float32Array(f);for(let w=0;w<f;w++){let S=w%u,T=Fg.getComponent(S),R=Bg.getComponent(S);d[w]=zu.lerp(T,R,Math.random())}let A=this.getNodeType(e);if(t.count*4*4<=e.getUniformBufferLimit())n=Sx(d,"vec4",t.count).element(Ku).convert(A);else{let w=new ec(d,4);e.geometry.setAttribute("__range"+this.id,w),n=LI(w).convert(A)}}else n=oe(0);return n}},uRe=$n(Ek).setParameterLength(2),Mk=class extends Kt{static get type(){return"ComputeBuiltinNode"}constructor(e,t){super(t),this._builtinName=e}getHash(e){return this.getBuiltinName(e)}generateNodeType(){return this.nodeType}setBuiltinName(e){return this._builtinName=e,this}getBuiltinName(){return this._builtinName}hasBuiltin(e){return e.hasBuiltin(this._builtinName)}generate(e,t){let n=this.getBuiltinName(e),r=this.getNodeType(e);return e.shaderStage==="compute"?e.format(n,r,t):(Xe(`ComputeBuiltinNode: Compute built-in value ${n} can not be accessed in the ${e.shaderStage} stage`),e.generateConst(r))}serialize(e){super.serialize(e),e.global=this.global,e._builtinName=this._builtinName}deserialize(e){super.deserialize(e),this.global=e.global,this._builtinName=e._builtinName}},kS=(i,e)=>new Mk(i,e),hRe=kS("numWorkgroups","uvec3"),fRe=kS("workgroupId","uvec3"),dRe=kS("globalId","uvec3"),pRe=kS("localId","uvec3"),mRe=kS("subgroupSize","uint"),Ck=class extends Kt{constructor(e){super(),this.scope=e,this.isBarrierNode=!0}setup(e){e.allowEarlyReturns=!1,e.allowGlobalVariables=!1}generate(e){let{scope:t}=this,{renderer:n}=e;n.backend.isWebGLBackend===!0?e.addFlowCode(` // ${t}Barrier 4160-`):e.addLineFlowCode(`${t}Barrier()`,this)}},EV=$n(Ck),ARe=()=>EV("workgroup").toStack(),gRe=()=>EV("storage").toStack(),vRe=()=>EV("texture").toStack(),Rk=class extends Jd{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n,r=e.isContextAssign();if(n=super.generate(e),r!==!0){let s=this.getNodeType(e);n=e.format(n,s,t)}return n}},Ik=class extends Kt{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e,this.name=""}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.',new ts),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new Rk(this,e)}generate(e){let t=this.name!==""?this.name:`${this.scope}Array_${this.id}`;return e.getScopedArray(t,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}},_Re=(i,e)=>new Ik("Workgroup",i,e),Ns=class extends Kt{static get type(){return"AtomicFunctionNode"}constructor(e,t,n){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.parents=!0}getInputType(e){return this.pointerNode.getNodeType(e)}generateNodeType(e){return this.getInputType(e)}generate(e){let t=e.getNodeProperties(this),n=t.parents,r=this.method,s=this.getNodeType(e),o=this.getInputType(e),a=this.pointerNode,l=this.valueNode,c=[];c.push(`&${a.build(e,o)}`),l!==null&&c.push(l.build(e,o));let u=`${e.getMethod(r,s)}( ${c.join(", ")} )`;if(n?n.length===1&&n[0].isStackNode===!0:!1)e.addLineFlowCode(u,this);else return t.constNode===void 0&&(t.constNode=dc(u,s).toConst()),t.constNode.build(e)}};Ns.ATOMIC_LOAD="atomicLoad";Ns.ATOMIC_STORE="atomicStore";Ns.ATOMIC_ADD="atomicAdd";Ns.ATOMIC_SUB="atomicSub";Ns.ATOMIC_MAX="atomicMax";Ns.ATOMIC_MIN="atomicMin";Ns.ATOMIC_AND="atomicAnd";Ns.ATOMIC_OR="atomicOr";Ns.ATOMIC_XOR="atomicXor";var xRe=$n(Ns),Lf=(i,e,t)=>xRe(i,e,t).toStack(),yRe=i=>Lf(Ns.ATOMIC_LOAD,i,null),bRe=(i,e)=>Lf(Ns.ATOMIC_STORE,i,e),wRe=(i,e)=>Lf(Ns.ATOMIC_ADD,i,e),SRe=(i,e)=>Lf(Ns.ATOMIC_SUB,i,e),TRe=(i,e)=>Lf(Ns.ATOMIC_MAX,i,e),ERe=(i,e)=>Lf(Ns.ATOMIC_MIN,i,e),MRe=(i,e)=>Lf(Ns.ATOMIC_AND,i,e),CRe=(i,e)=>Lf(Ns.ATOMIC_OR,i,e),RRe=(i,e)=>Lf(Ns.ATOMIC_XOR,i,e),Ot=class i extends Ir{static get type(){return"SubgroupFunctionNode"}constructor(e,t=null,n=null){super(),this.method=e,this.aNode=t,this.bNode=n}getInputType(e){let t=this.aNode?this.aNode.getNodeType(e):null,n=this.bNode?this.bNode.getNodeType(e):null,r=e.isMatrix(t)?0:e.getTypeLength(t),s=e.isMatrix(n)?0:e.getTypeLength(n);return r>s?t:n}generateNodeType(e){let t=this.method;return t===i.SUBGROUP_ELECT?"bool":t===i.SUBGROUP_BALLOT?"uvec4":this.getInputType(e)}generate(e,t){let n=this.method,r=this.getNodeType(e),s=this.getInputType(e),o=this.aNode,a=this.bNode,l=[];if(n===i.SUBGROUP_BROADCAST||n===i.SUBGROUP_SHUFFLE||n===i.QUAD_BROADCAST){let u=a.getNodeType(e);l.push(o.build(e,r),a.build(e,u==="float"?"int":r))}else n===i.SUBGROUP_SHUFFLE_XOR||n===i.SUBGROUP_SHUFFLE_DOWN||n===i.SUBGROUP_SHUFFLE_UP?l.push(o.build(e,r),a.build(e,"uint")):(o!==null&&l.push(o.build(e,s)),a!==null&&l.push(a.build(e,s)));let c=l.length===0?"()":`( ${l.join(", ")} )`;return e.format(`${e.getMethod(n,r)}${c}`,r,t)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};Ot.SUBGROUP_ELECT="subgroupElect";Ot.SUBGROUP_BALLOT="subgroupBallot";Ot.SUBGROUP_ADD="subgroupAdd";Ot.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd";Ot.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd";Ot.SUBGROUP_MUL="subgroupMul";Ot.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul";Ot.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul";Ot.SUBGROUP_AND="subgroupAnd";Ot.SUBGROUP_OR="subgroupOr";Ot.SUBGROUP_XOR="subgroupXor";Ot.SUBGROUP_MIN="subgroupMin";Ot.SUBGROUP_MAX="subgroupMax";Ot.SUBGROUP_ALL="subgroupAll";Ot.SUBGROUP_ANY="subgroupAny";Ot.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst";Ot.QUAD_SWAP_X="quadSwapX";Ot.QUAD_SWAP_Y="quadSwapY";Ot.QUAD_SWAP_DIAGONAL="quadSwapDiagonal";Ot.SUBGROUP_BROADCAST="subgroupBroadcast";Ot.SUBGROUP_SHUFFLE="subgroupShuffle";Ot.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor";Ot.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp";Ot.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown";Ot.QUAD_BROADCAST="quadBroadcast";var IRe=ct(Ot,Ot.SUBGROUP_ELECT).setParameterLength(0),PRe=ct(Ot,Ot.SUBGROUP_BALLOT).setParameterLength(1),LRe=ct(Ot,Ot.SUBGROUP_ADD).setParameterLength(1),DRe=ct(Ot,Ot.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),NRe=ct(Ot,Ot.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),FRe=ct(Ot,Ot.SUBGROUP_MUL).setParameterLength(1),BRe=ct(Ot,Ot.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),ORe=ct(Ot,Ot.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),URe=ct(Ot,Ot.SUBGROUP_AND).setParameterLength(1),kRe=ct(Ot,Ot.SUBGROUP_OR).setParameterLength(1),zRe=ct(Ot,Ot.SUBGROUP_XOR).setParameterLength(1),VRe=ct(Ot,Ot.SUBGROUP_MIN).setParameterLength(1),GRe=ct(Ot,Ot.SUBGROUP_MAX).setParameterLength(1),qRe=ct(Ot,Ot.SUBGROUP_ALL).setParameterLength(0),HRe=ct(Ot,Ot.SUBGROUP_ANY).setParameterLength(0),WRe=ct(Ot,Ot.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),jRe=ct(Ot,Ot.QUAD_SWAP_X).setParameterLength(1),XRe=ct(Ot,Ot.QUAD_SWAP_Y).setParameterLength(1),$Re=ct(Ot,Ot.QUAD_SWAP_DIAGONAL).setParameterLength(1),YRe=ct(Ot,Ot.SUBGROUP_BROADCAST).setParameterLength(2),ZRe=ct(Ot,Ot.SUBGROUP_SHUFFLE).setParameterLength(2),KRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),QRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_UP).setParameterLength(2),JRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),e4e=ct(Ot,Ot.QUAD_BROADCAST).setParameterLength(1),BR;function qI(i){BR=BR||new WeakMap;let e=BR.get(i);return e===void 0&&BR.set(i,e={}),e}function HI(i){let e=qI(i);return e.shadowMatrix||(e.shadowMatrix=Xt("mat4").setGroup(Jt).onRenderUpdate(t=>((i.castShadow!==!0||t.renderer.shadowMap.enabled===!1)&&(i.shadow.camera.coordinateSystem!==t.camera.coordinateSystem&&(i.shadow.camera.coordinateSystem=t.camera.coordinateSystem,i.shadow.camera.updateProjectionMatrix()),i.shadow.updateMatrices(i)),i.shadow.matrix)))}function jse(i,e=wf){let t=HI(i).mul(e);return t.xyz.div(t.w)}function MV(i){let e=qI(i);return e.position||(e.position=Xt(new re).setGroup(Jt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function Xse(i){let e=qI(i);return e.targetPosition||(e.targetPosition=Xt(new re).setGroup(Jt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function CV(i){let e=qI(i);return e.viewPosition||(e.viewPosition=Xt(new re).setGroup(Jt).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new re,n.value.setFromMatrixPosition(i.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}var RV=i=>Sm.transformDirection(MV(i).sub(Xse(i))),t4e=np("vec3","totalDiffuse"),n4e=np("vec3","totalSpecular"),i4e=np("vec3","outgoingLight"),r4e=i=>i.sort((e,t)=>e.id-t.id),s4e=(i,e)=>{for(let t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},rU=new WeakMap,Xw=[],MS=class extends Kt{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=t4e,this.totalSpecularNode=n4e,this.outgoingLightNode=i4e,this._lights=[],this.global=!0}customCacheKey(){let e=this._lights;for(let n=0;n<e.length;n++){let r=e[n];if(Xw.push(r.id),Xw.push(r.castShadow?1:0),r.isSpotLight===!0){let s=r.map!==null?r.map.id:-1,o=r.colorNode?r.colorNode.getCacheKey():-1;Xw.push(s,o)}}let t=FS(Xw);return Xw.length=0,t}getHash(e){let t=e.getDataFromNode(this);if(t.lightNodesHash===void 0){let n=this.setupLightsNode(e);t.lightNodes=n;let r=[];for(let s of n)r.push(s.getHash());t.lightNodesHash="lights-"+r.join(",")}return t.lightNodesHash}analyze(e){let t=e.getNodeProperties(this);for(let n of t.nodes)n.build(e);t.outputNode.build(e)}setupLightsNode(e){let t=e.getDataFromNode(this),n=[],r=t.lightNodes||null,s=e.context.materialLightings,o=r4e([...s,...this._lights]),a=e.renderer.library;for(let l of o)if(l.isNode)n.push(l);else{let c=null;if(r!==null&&(c=s4e(l.id,r)),c===null){let u=a.getLightNodeClass(l.constructor);if(u===null){Xe(`LightsNode.setupNodeLights: Light node not found for ${l.constructor.name}`);continue}rU.has(l)===!1&&rU.set(l,new u(l)),c=rU.get(l)}n.push(c)}return n}setupDirectLight(e,t,n){let{lightingModel:r,reflectedLight:s}=e.context;r.direct({...n,lightNode:t,reflectedLight:s},e)}setupDirectRectAreaLight(e,t,n){let{lightingModel:r,reflectedLight:s}=e.context;r.directRectArea({...n,lightNode:t,reflectedLight:s},e)}setupLights(e,t){for(let n of t)n.build(e)}getLightNodes(e){let t=e.getDataFromNode(this);return t.lightNodes===void 0&&(t.lightNodes=this.setupLightsNode(e)),t.lightNodes}setup(e){let t=e.lightsNode;e.lightsNode=this;let n=this.outgoingLightNode,r=e.context,s=r.lightingModel,o=e.getNodeProperties(this);if(s){let{totalDiffuseNode:a,totalSpecularNode:l}=this;r.outgoingLight=n;let c=e.addStack();o.nodes=c.nodes,s.start(e);let{backdrop:u,backdropAlpha:f}=r,{directDiffuse:d,directSpecular:A,indirectDiffuse:y,indirectSpecular:w}=r.reflectedLight,S=d.add(y);u!==null&&(f!==null?S=pe(f.mix(S,u)):S=pe(u)),a.assign(S),l.assign(A.add(w)),n.assign(a.add(l)),s.finish(e),n=n.bypass(e.removeStack())}else o.nodes=[];return e.lightsNode=t,n}setLights(e){return this._lights=e,this}getLights(){return this._lights}get hasLights(){return this._lights.length>0}},o4e=(i=[])=>new MS().setLights(i),Pk=class extends Kt{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=yn.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){IV.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||wf)}},IV=np("vec3","shadowPositionWorld");function a4e(i,e={}){return e.toneMapping=i.toneMapping,e.toneMappingExposure=i.toneMappingExposure,e.outputColorSpace=i.outputColorSpace,e.renderTarget=i.getRenderTarget(),e.activeCubeFace=i.getActiveCubeFace(),e.activeMipmapLevel=i.getActiveMipmapLevel(),e.renderObjectFunction=i.getRenderObjectFunction(),e.pixelRatio=i.getPixelRatio(),e.mrt=i.getMRT(),e.clearColor=i.getClearColor(e.clearColor||new zt),e.clearAlpha=i.getClearAlpha(),e.autoClear=i.autoClear,e.scissorTest=i.getScissorTest(),e}function l4e(i,e){return e=a4e(i,e),i.setMRT(null),i.setRenderObjectFunction(null),i.setClearColor(0,1),i.autoClear=!0,e}function c4e(i,e){i.toneMapping=e.toneMapping,i.toneMappingExposure=e.toneMappingExposure,i.outputColorSpace=e.outputColorSpace,i.setRenderTarget(e.renderTarget,e.activeCubeFace,e.activeMipmapLevel),i.setRenderObjectFunction(e.renderObjectFunction),i.setPixelRatio(e.pixelRatio),i.setMRT(e.mrt),i.setClearColor(e.clearColor,e.clearAlpha),i.autoClear=e.autoClear,i.setScissorTest(e.scissorTest)}function u4e(i,e={}){return e.background=i.background,e.backgroundNode=i.backgroundNode,e.overrideMaterial=i.overrideMaterial,e}function h4e(i,e){return e=u4e(i,e),i.background=null,i.backgroundNode=null,i.overrideMaterial=null,e}function f4e(i,e){i.background=e.background,i.backgroundNode=e.backgroundNode,i.overrideMaterial=e.overrideMaterial}function d4e(i,e,t){return t=l4e(i,t),t=h4e(e,t),t}function p4e(i,e,t){c4e(i,t),f4e(e,t)}var q4=new WeakMap,$se=me(({depthTexture:i,shadowCoord:e,depthLayer:t})=>{let n=fi(i,e.xy).setName("t_basic");return i.isArrayTexture&&(n=n.depth(t)),n.compare(e.z)}),Yse=me(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=(u,f)=>{let d=fi(i,u);return i.isArrayTexture&&(d=d.depth(n)),d.compare(f)},s=mr("mapSize","vec2",t).setGroup(Jt),o=mr("radius","float",t).setGroup(Jt),a=dt(1).div(s),l=o.mul(a.x),c=bV(h1.xy).mul(6.28318530718);return Ls(r(e.xy.add(Yu(0,5,c).mul(l)),e.z),r(e.xy.add(Yu(1,5,c).mul(l)),e.z),r(e.xy.add(Yu(2,5,c).mul(l)),e.z),r(e.xy.add(Yu(3,5,c).mul(l)),e.z),r(e.xy.add(Yu(4,5,c).mul(l)),e.z)).mul(1/5)}),Zse=me(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=mr("mapSize","vec2",t).setGroup(Jt),s=dt(1).div(r),o=e.xy,a=Qu(o.mul(r).add(.5)).toConst();o.subAssign(a.sub(.5).mul(s));let l=A=>{let y=fi(i,o).offset(A).gather();return i.isArrayTexture&&(y=y.depth(n)),y.compare(e.z)},c=l(zr(-1,1)).toConst(),u=l(zr(1,1)).toConst(),f=l(zr(-1,-1)).toConst(),d=l(zr(1,-1)).toConst();return Ls(Qn(c.x,u.y,a.x).add(c.y).add(u.x).mul(a.y),Qn(c.w,u.z,a.x).add(c.z).add(u.w),Qn(f.x,d.y,a.x).add(f.y).add(d.x),Qn(f.w,d.z,a.x).add(f.z).add(d.w).mul(a.y.oneMinus())).mul(1/9)}),Kse=me(({depthTexture:i,shadowCoord:e,depthLayer:t},n)=>{let r=fi(i).sample(e.xy);i.isArrayTexture&&(r=r.depth(t)),r=r.rg;let s=r.x,o=Vr(1e-7,r.y.mul(r.y)),a=n.renderer.reversedDepthBuffer?e1(s,e.z):e1(e.z,s),l=oe(1).toVar();return $t(a.notEqual(1),()=>{let c=e.z.sub(s),u=o.div(o.add(c.mul(c)));u=Ju(ai(u,.3).div(.65)),l.assign(Vr(a,u))}),l}),Qse=i=>{let e=q4.get(i);return e===void 0&&(e=new Pr,e.colorNode=Ft(0,0,0,1),e.isShadowPassMaterial=!0,e.name="ShadowMaterial",e.blending=ms,e.fog=!1,q4.set(i,e)),e},Jse=i=>{let e=q4.get(i);e!==void 0&&(e.dispose(),q4.delete(i))},Cte=new Cf,j_=[],eoe=(i,e,t,n)=>{j_[0]=i,j_[1]=e;let r=Cte.get(j_);return(r===void 0||r.shadowType!==t||r.useVelocity!==n)&&(r=(s,o,a,l,c,u,f,d,A)=>{(s.castShadow===!0||s.receiveShadow&&t===Wc)&&(n&&(lne(s).useVelocity=!0),s.onBeforeShadow(i,s,a,e.camera,l,o.overrideMaterial,u),i.renderObject(s,o,a,l,c,u,f,d,A),s.onAfterShadow(i,s,a,e.camera,l,o.overrideMaterial,u))},r.shadowType=t,r.useVelocity=n,Cte.set(j_,r)),j_[0]=null,j_[1]=null,r},m4e=me(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{let s=oe(0).toVar("meanVertical"),o=oe(0).toVar("squareMeanVertical"),a=i.lessThanEqual(oe(1)).select(oe(0),oe(2).div(i.sub(1))),l=i.lessThanEqual(oe(1)).select(oe(0),oe(-1));Oi({start:de(0),end:de(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(oe(u).mul(a)),d=n.sample(Ls(h1.xy,dt(0,f).mul(e)).div(t));n.value.isArrayTexture&&(d=d.depth(r)),d=d.x,s.addAssign(d),o.addAssign(d.mul(d))}),s.divAssign(i),o.divAssign(i);let c=el(o.sub(s.mul(s)).max(0));return dt(s,c)}),A4e=me(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{let s=oe(0).toVar("meanHorizontal"),o=oe(0).toVar("squareMeanHorizontal"),a=i.lessThanEqual(oe(1)).select(oe(0),oe(2).div(i.sub(1))),l=i.lessThanEqual(oe(1)).select(oe(0),oe(-1));Oi({start:de(0),end:de(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(oe(u).mul(a)),d=n.sample(Ls(h1.xy,dt(f,0).mul(e)).div(t));n.value.isArrayTexture&&(d=d.depth(r)),s.addAssign(d.x),o.addAssign(Ls(d.y.mul(d.y),d.x.mul(d.x)))}),s.divAssign(i),o.divAssign(i);let c=el(o.sub(s.mul(s)).max(0));return dt(s,c)}),g4e=[$se,Yse,Zse,Kse],sU,OR=new ES,H4=class extends Pk{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this._currentShadowType=null,this._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s,depthLayer:o}){let a=r.x.greaterThanEqual(0).and(r.x.lessThanEqual(1)).and(r.y.greaterThanEqual(0)).and(r.y.lessThanEqual(1)).and(r.z.lessThanEqual(1)),l=t({depthTexture:n,shadowCoord:r,shadow:s,depthLayer:o});return a.select(l,oe(1))}setupShadowCoord(e,t){let{shadow:n}=this,{renderer:r}=e,s=n.biasNode||mr("bias","float",n).setGroup(Jt),o=t,a;if(n.camera.isOrthographicCamera||r.logarithmicDepthBuffer!==!0)o=o.xyz.div(o.w),a=o.z;else{let l=o.w;o=o.xy.div(l);let c=mr("near","float",n.camera).setGroup(Jt),u=mr("far","float",n.camera).setGroup(Jt);a=UI(l.negate(),c,u)}return o=pe(o.x,o.y.oneMinus(),r.reversedDepthBuffer?a.sub(s):a.add(s)),o}getShadowFilterFn(e){return g4e[e]}setupRenderTarget(e,t){let n=new Cs(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?ku:Kh;let r=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return r.texture.name="ShadowMap",r.texture.type=e.mapType,r.depthTexture=n,{shadowMap:r,depthTexture:n}}setupShadow(e){let{renderer:t,camera:n}=e,{light:r,shadow:s}=this,{depthTexture:o,shadowMap:a}=this.setupRenderTarget(s,e),l=t.shadowMap.type,c=t.hasCompatibility(kd.TEXTURE_COMPARE);if((l===p0||l===OM)&&c?(o.minFilter=Mi,o.magFilter=Mi):(o.minFilter=Ti,o.magFilter=Ti),s.camera.coordinateSystem=n.coordinateSystem,s.camera.updateProjectionMatrix(),l===Wc&&s.isPointLightShadow!==!0){o.compareFunction=null,a.depth>1?(a._vsmShadowMapVertical||(a._vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:js,type:Wi,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapVertical.texture.name="VSMVertical"),this.vsmShadowMapVertical=a._vsmShadowMapVertical,a._vsmShadowMapHorizontal||(a._vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:js,type:Wi,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapHorizontal.texture.name="VSMHorizontal"),this.vsmShadowMapHorizontal=a._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:js,type:Wi,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:js,type:Wi,depthBuffer:!1}));let D=fi(o);o.isArrayTexture&&(D=D.depth(this.depthLayer));let L=fi(this.vsmShadowMapVertical.texture);o.isArrayTexture&&(L=L.depth(this.depthLayer));let C=mr("blurSamples","float",s).setGroup(Jt),B=mr("radius","float",s).setGroup(Jt),k=mr("mapSize","vec2",s).setGroup(Jt),z=this.vsmMaterialVertical||(this.vsmMaterialVertical=new Pr);z.fragmentNode=m4e({samples:C,radius:B,size:k,shadowPass:D,depthLayer:this.depthLayer}).context(e.getSharedContext()),z.name="VSMVertical",z=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new Pr),z.fragmentNode=A4e({samples:C,radius:B,size:k,shadowPass:L,depthLayer:this.depthLayer}).context(e.getSharedContext()),z.name="VSMHorizontal"}let u=mr("intensity","float",s).setGroup(Jt),f=mr("normalBias","float",s).setGroup(Jt),d=HI(r),A=Tm.mul(f),y;!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld?y=d.mul(IV.add(A)):y=Xt("mat4").onObjectUpdate(({object:L},C)=>C.value.multiplyMatrices(d.value,L.matrixWorld)).mul(Cr).add(d.mul(Ft(A,0)));let w=this.setupShadowCoord(e,y),S=s.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(S===null)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");let T=l===Wc&&s.isPointLightShadow!==!0?this.vsmShadowMapHorizontal.texture:o,R=this.setupShadowFilter(e,{filterFn:S,shadowTexture:a.texture,depthTexture:T,shadowCoord:w,shadow:s,depthLayer:this.depthLayer}),P;t.shadowMap.transmitted===!0&&(a.texture.isCubeTexture?P=Qa(a.texture,w.xyz):(P=fi(a.texture,w),o.isArrayTexture&&(P=P.depth(this.depthLayer))));let I;P?I=Qn(1,R.rgb.mix(P,1),u.mul(P.a)).toVar():I=Qn(1,R,u).toVar(),this.shadowMap=a,this.shadow.map=a;let F=`${this.light.type} Shadow [ ${this.light.name||"ID: "+this.light.id} ]`;return P&&I.toInspector(`${F} / Color`,()=>this.shadowMap.texture.isCubeTexture?Qa(this.shadowMap.texture,w7()):fi(this.shadowMap.texture)),I.toInspector(`${F} / Depth`,()=>{let D=mr("near","float",this.shadow.camera),L=mr("far","float",this.shadow.camera),C;this.shadowMap.texture.isCubeTexture?C=Qa(this.shadowMap.depthTexture,w7()).r:C=fi(this.shadowMap.depthTexture).r;let B;return this.shadow.camera.isPerspectiveCamera?B=OI(C,D,L):B=ise(C,D,L),B=Zg(B,D,L),B.oneMinus()})}setup(e){if(e.renderer.shadowMap.enabled!==!1)return me(()=>{let t=e.renderer.shadowMap.type;this._currentShadowType!==t&&(this._reset(),this._node=null);let n=this._node;return this.setupShadowPosition(e),n===null&&(this._node=n=this.setupShadow(e),this._currentShadowType=t),e.material.receivedShadowNode&&(n=e.material.receivedShadowNode(n)),n})()}renderShadow(e){let{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:o}=e;t.updateMatrices(r),n.setSize(t.mapSize.width,t.mapSize.height,n.depth);let a=o.name;o.name=`Shadow Map [ ${r.name||"ID: "+r.id} ]`,s.render(o,t.camera),o.name=a}updateShadow(e){let{shadowMap:t,light:n,shadow:r}=this,{renderer:s,scene:o,camera:a}=e,l=s.shadowMap.type,c=t.depthTexture.version;this._depthVersionCached=c;let u=r.camera.layers.mask;(r.camera.layers.mask&4294967294)===0&&(r.camera.layers.mask=a.layers.mask);let f=s.getRenderObjectFunction(),d=s.getMRT(),A=d?d.has("velocity"):!1;sU=d4e(s,o,sU),o.overrideMaterial=Qse(n),s.setRenderObjectFunction(eoe(s,r,l,A)),s.setClearColor(0,0),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(f),l===Wc&&r.isPointLightShadow!==!0&&this.vsmPass(s),r.camera.layers.mask=u,p4e(s,o,sU)}vsmPass(e){let{shadow:t}=this,n=this.shadowMap.depth;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height,n),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height,n),e.setRenderTarget(this.vsmShadowMapVertical),OR.material=this.vsmMaterialVertical,OR.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),OR.material=this.vsmMaterialHorizontal,OR.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,Jse(this.light),this.shadowMap&&(this.shadowMap.dispose(),this.shadowMap=null),this.vsmShadowMapVertical!==null&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),this.vsmShadowMapHorizontal!==null&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null)}updateBefore(e){let{shadow:t}=this,n=t.needsUpdate||t.autoUpdate;n&&(this._cameraFrameId[e.camera]===e.frameId&&(n=!1),this._cameraFrameId[e.camera]=e.frameId),n&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}},toe=(i,e)=>new H4(i,e),v4e=new zt,Rte=new cn,$w=new re,oU=new re,_4e=[new re(1,0,0),new re(-1,0,0),new re(0,-1,0),new re(0,1,0),new re(0,0,1),new re(0,0,-1)],x4e=[new re(0,-1,0),new re(0,-1,0),new re(0,0,-1),new re(0,0,1),new re(0,-1,0),new re(0,-1,0)],y4e=[new re(1,0,0),new re(-1,0,0),new re(0,1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1)],b4e=[new re(0,-1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1),new re(0,-1,0),new re(0,-1,0)],noe=me(({depthTexture:i,bd3D:e,dp:t})=>Qa(i,e).compare(t)),ioe=me(({depthTexture:i,bd3D:e,dp:t,shadow:n})=>{let r=mr("radius","float",n).setGroup(Jt),s=mr("mapSize","vec2",n).setGroup(Jt),o=r.div(s.x),a=fr(e),l=ya(ep(e,a.x.greaterThan(a.z).select(pe(0,1,0),pe(1,0,0)))),c=ep(e,l),u=bV(h1.xy).mul(6.28318530718),f=Yu(0,5,u),d=Yu(1,5,u),A=Yu(2,5,u),y=Yu(3,5,u),w=Yu(4,5,u);return Qa(i,e.add(l.mul(f.x).add(c.mul(f.y)).mul(o))).compare(t).add(Qa(i,e.add(l.mul(d.x).add(c.mul(d.y)).mul(o))).compare(t)).add(Qa(i,e.add(l.mul(A.x).add(c.mul(A.y)).mul(o))).compare(t)).add(Qa(i,e.add(l.mul(y.x).add(c.mul(y.y)).mul(o))).compare(t)).add(Qa(i,e.add(l.mul(w.x).add(c.mul(w.y)).mul(o))).compare(t)).mul(1/5)}),w4e=me(({filterFn:i,depthTexture:e,shadowCoord:t,shadow:n},r)=>{let s=t.xyz.toConst(),o=s.abs().toConst(),a=o.x.max(o.y).max(o.z),l=Xt("float").setGroup(Jt).onRenderUpdate(()=>n.camera.near),c=Xt("float").setGroup(Jt).onRenderUpdate(()=>n.camera.far),u=mr("bias","float",n).setGroup(Jt),f=oe(1).toVar();return $t(a.sub(c).lessThanEqual(0).and(a.sub(l).greaterThanEqual(0)),()=>{let d;r.renderer.reversedDepthBuffer?(d=rse(a.negate(),l,c),d.subAssign(u)):r.renderer.logarithmicDepthBuffer?(d=UI(a.negate(),l,c),d.addAssign(u)):(d=mV(a.negate(),l,c),d.addAssign(u));let A=s.normalize();f.assign(i({depthTexture:e,bd3D:A,dp:d,shadow:n}))}),f}),Lk=class extends H4{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===X8?noe:ioe}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s}){return w4e({filterFn:t,depthTexture:n,shadowCoord:r,shadow:s})}setupRenderTarget(e,t){let n=new n_(e.mapSize.width);n.name="PointShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?ku:Kh;let r=t.createCubeRenderTarget(e.mapSize.width);return r.texture.name="PointShadowMap",r.depthTexture=n,{shadowMap:r,depthTexture:n}}renderShadow(e){let{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:o}=e,a=t.camera,l=t.matrix,c=s.coordinateSystem===yl,u=c?_4e:y4e,f=c?x4e:b4e;n.setSize(t.mapSize.width,t.mapSize.width);let d=s.autoClear,A=s.getClearColor(v4e),y=s.getClearAlpha();s.autoClear=!1,s.setClearColor(t.clearColor,t.clearAlpha);for(let w=0;w<6;w++){s.setRenderTarget(n,w),s.clear();let S=r.distance||a.far;S!==a.far&&(a.far=S,a.updateProjectionMatrix()),$w.setFromMatrixPosition(r.matrixWorld),a.position.copy($w),oU.copy(a.position),oU.add(u[w]),a.up.copy(f[w]),a.lookAt(oU),a.updateMatrixWorld(),l.makeTranslation(-$w.x,-$w.y,-$w.z),Rte.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix(Rte,a.coordinateSystem,a.reversedDepth);let T=o.name;o.name=`Point Light Shadow [ ${r.name||"ID: "+r.id} ] - Face ${w+1}`,s.render(o,a),o.name=T}s.autoClear=d,s.setClearColor(A,y)}},roe=(i,e)=>new Lk(i,e),tp=class extends xm{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new zt,this.colorNode=e&&e.colorNode||Xt(this.color).setGroup(Jt),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=yn.FRAME,e&&e.shadow&&(this._shadowDisposeListener=()=>{this.disposeShadow()},e.addEventListener("dispose",this._shadowDisposeListener))}dispose(){this._shadowDisposeListener&&this.light.removeEventListener("dispose",this._shadowDisposeListener),super.dispose()}disposeShadow(){this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null),this.shadowColorNode=null,this.baseColorNode!==null&&(this.colorNode=this.baseColorNode,this.baseColorNode=null)}getHash(){return this.light.uuid}getLightVector(e){return CV(this.light).sub(e.context.positionView||ys)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return toe(this.light)}setupShadow(e){let{renderer:t}=e;if(t.shadowMap.enabled===!1)return;let n=this.shadowColorNode;if(n===null){let r=this.light.shadow.shadowNode,s;r!==void 0?s=Ht(r):s=this.setupShadowNode(),this.shadowNode=s,this.shadowColorNode=n=this.colorNode.mul(s),this.baseColorNode=this.colorNode}e.context.getShadow&&(n=e.context.getShadow(this,e)),this.colorNode=n}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null,this.shadowColorNode=null);let t=this.setupDirect(e),n=this.setupDirectRectArea(e);t&&e.lightsNode.setupDirectLight(e,this,t),n&&e.lightsNode.setupDirectRectAreaLight(e,this,n)}update(){let{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}},PV=me(({lightDistance:i,cutoffDistance:e,decayExponent:t})=>{let n=i.pow(t).max(.01).reciprocal();return e.greaterThan(0).select(n.mul(i.div(e).pow4().oneMinus().clamp().pow2()),n)}),soe=({color:i,lightVector:e,cutoffDistance:t,decayExponent:n})=>{let r=e.normalize(),s=e.length(),o=PV({lightDistance:s,cutoffDistance:t,decayExponent:n}),a=i.mul(o);return{lightDirection:r,lightColor:a}},Dk=class extends tp{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=Xt(0).setGroup(Jt),this.decayExponentNode=Xt(2).setGroup(Jt)}update(e){let{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return roe(this.light)}setupDirect(e){return soe({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}},S4e=me(([i=Ui()])=>{let e=i.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),T4e=me(([i=Ui()],{renderer:e,material:t})=>{let n=Fz(i.mul(2).sub(1)),r;if(t.alphaToCoverage&&e.currentSamples>0){let s=oe(n.fwidth()).toVar();r=gc(s.oneMinus(),s.add(1),n).oneMinus()}else r=xa(n.greaterThan(1),0,1);return r}),fS=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=mc(i).toVar();return xa(s,r,n).uniformFlow()}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),W4=me(([i,e])=>{let t=mc(e).toVar(),n=oe(i).toVar();return xa(t,n.negate(),n).uniformFlow()}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),Ps=me(([i])=>{let e=oe(i).toVar();return de(yf(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),Rr=me(([i,e])=>{let t=oe(i).toVar();return e.assign(Ps(t)),t.sub(oe(e))}),E4e=me(([i,e,t,n,r,s])=>{let o=oe(s).toVar(),a=oe(r).toVar(),l=oe(n).toVar(),c=oe(t).toVar(),u=oe(e).toVar(),f=oe(i).toVar(),d=oe(ai(1,a)).toVar();return ai(1,o).mul(f.mul(d).add(u.mul(a))).add(o.mul(c.mul(d).add(l.mul(a))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),M4e=me(([i,e,t,n,r,s])=>{let o=oe(s).toVar(),a=oe(r).toVar(),l=pe(n).toVar(),c=pe(t).toVar(),u=pe(e).toVar(),f=pe(i).toVar(),d=oe(ai(1,a)).toVar();return ai(1,o).mul(f.mul(d).add(u.mul(a))).add(o.mul(c.mul(d).add(l.mul(a))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),ooe=Ko([E4e,M4e]),C4e=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=oe(u).toVar(),d=oe(c).toVar(),A=oe(l).toVar(),y=oe(a).toVar(),w=oe(o).toVar(),S=oe(s).toVar(),T=oe(r).toVar(),R=oe(n).toVar(),P=oe(t).toVar(),I=oe(e).toVar(),F=oe(i).toVar(),D=oe(ai(1,A)).toVar(),L=oe(ai(1,d)).toVar();return oe(ai(1,f)).toVar().mul(L.mul(F.mul(D).add(I.mul(A))).add(d.mul(P.mul(D).add(R.mul(A))))).add(f.mul(L.mul(T.mul(D).add(S.mul(A))).add(d.mul(w.mul(D).add(y.mul(A))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),R4e=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=oe(u).toVar(),d=oe(c).toVar(),A=oe(l).toVar(),y=pe(a).toVar(),w=pe(o).toVar(),S=pe(s).toVar(),T=pe(r).toVar(),R=pe(n).toVar(),P=pe(t).toVar(),I=pe(e).toVar(),F=pe(i).toVar(),D=oe(ai(1,A)).toVar(),L=oe(ai(1,d)).toVar();return oe(ai(1,f)).toVar().mul(L.mul(F.mul(D).add(I.mul(A))).add(d.mul(P.mul(D).add(R.mul(A))))).add(f.mul(L.mul(T.mul(D).add(S.mul(A))).add(d.mul(w.mul(D).add(y.mul(A))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),aoe=Ko([C4e,R4e]),I4e=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=rt(i).toVar(),o=rt(s.bitAnd(rt(7))).toVar(),a=oe(fS(o.lessThan(rt(4)),r,n)).toVar(),l=oe(Tn(2,fS(o.lessThan(rt(4)),n,r))).toVar();return W4(a,mc(o.bitAnd(rt(1)))).add(W4(l,mc(o.bitAnd(rt(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),P4e=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=oe(e).toVar(),a=rt(i).toVar(),l=rt(a.bitAnd(rt(15))).toVar(),c=oe(fS(l.lessThan(rt(8)),o,s)).toVar(),u=oe(fS(l.lessThan(rt(4)),s,fS(l.equal(rt(12)).or(l.equal(rt(14))),o,r))).toVar();return W4(c,mc(l.bitAnd(rt(1)))).add(W4(u,mc(l.bitAnd(rt(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),So=Ko([I4e,P4e]),L4e=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=c1(i).toVar();return pe(So(s.x,r,n),So(s.y,r,n),So(s.z,r,n))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),D4e=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=oe(e).toVar(),a=c1(i).toVar();return pe(So(a.x,o,s,r),So(a.y,o,s,r),So(a.z,o,s,r))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),nu=Ko([L4e,D4e]),N4e=me(([i])=>{let e=oe(i).toVar();return Tn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),F4e=me(([i])=>{let e=oe(i).toVar();return Tn(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),B4e=me(([i])=>{let e=pe(i).toVar();return Tn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),loe=Ko([N4e,B4e]),O4e=me(([i])=>{let e=pe(i).toVar();return Tn(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),coe=Ko([F4e,O4e]),fc=me(([i,e])=>{let t=de(e).toVar(),n=rt(i).toVar();return n.shiftLeft(t).bitOr(n.shiftRight(de(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),uoe=me(([i,e,t])=>{i.subAssign(t),i.bitXorAssign(fc(t,de(4))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(fc(i,de(6))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(fc(e,de(8))),e.addAssign(i),i.subAssign(t),i.bitXorAssign(fc(t,de(16))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(fc(i,de(19))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(fc(e,de(4))),e.addAssign(i)}),zS=me(([i,e,t])=>{let n=rt(t).toVar(),r=rt(e).toVar(),s=rt(i).toVar();return n.bitXorAssign(r),n.subAssign(fc(r,de(14))),s.bitXorAssign(n),s.subAssign(fc(n,de(11))),r.bitXorAssign(s),r.subAssign(fc(s,de(25))),n.bitXorAssign(r),n.subAssign(fc(r,de(16))),s.bitXorAssign(n),s.subAssign(fc(n,de(4))),r.bitXorAssign(s),r.subAssign(fc(s,de(14))),n.bitXorAssign(r),n.subAssign(fc(r,de(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),ba=me(([i])=>{let e=rt(i).toVar();return oe(e).div(oe(rt(de(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),Sf=me(([i])=>{let e=oe(i).toVar();return e.mul(e).mul(e).mul(e.mul(e.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),U4e=me(([i])=>{let e=de(i).toVar(),t=rt(rt(1)).toVar(),n=rt(rt(de(3735928559)).add(t.shiftLeft(rt(2))).add(rt(13))).toVar();return zS(n.add(rt(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),k4e=me(([i,e])=>{let t=de(e).toVar(),n=de(i).toVar(),r=rt(rt(2)).toVar(),s=rt().toVar(),o=rt().toVar(),a=rt().toVar();return s.assign(o.assign(a.assign(rt(de(3735928559)).add(r.shiftLeft(rt(2))).add(rt(13))))),s.addAssign(rt(n)),o.addAssign(rt(t)),zS(s,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),z4e=me(([i,e,t])=>{let n=de(t).toVar(),r=de(e).toVar(),s=de(i).toVar(),o=rt(rt(3)).toVar(),a=rt().toVar(),l=rt().toVar(),c=rt().toVar();return a.assign(l.assign(c.assign(rt(de(3735928559)).add(o.shiftLeft(rt(2))).add(rt(13))))),a.addAssign(rt(s)),l.addAssign(rt(r)),c.addAssign(rt(n)),zS(a,l,c)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),V4e=me(([i,e,t,n])=>{let r=de(n).toVar(),s=de(t).toVar(),o=de(e).toVar(),a=de(i).toVar(),l=rt(rt(4)).toVar(),c=rt().toVar(),u=rt().toVar(),f=rt().toVar();return c.assign(u.assign(f.assign(rt(de(3735928559)).add(l.shiftLeft(rt(2))).add(rt(13))))),c.addAssign(rt(a)),u.addAssign(rt(o)),f.addAssign(rt(s)),uoe(c,u,f),c.addAssign(rt(r)),zS(c,u,f)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),G4e=me(([i,e,t,n,r])=>{let s=de(r).toVar(),o=de(n).toVar(),a=de(t).toVar(),l=de(e).toVar(),c=de(i).toVar(),u=rt(rt(5)).toVar(),f=rt().toVar(),d=rt().toVar(),A=rt().toVar();return f.assign(d.assign(A.assign(rt(de(3735928559)).add(u.shiftLeft(rt(2))).add(rt(13))))),f.addAssign(rt(c)),d.addAssign(rt(l)),A.addAssign(rt(a)),uoe(f,d,A),f.addAssign(rt(o)),d.addAssign(rt(s)),zS(f,d,A)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),Xi=Ko([U4e,k4e,z4e,V4e,G4e]),q4e=me(([i,e])=>{let t=de(e).toVar(),n=de(i).toVar(),r=rt(Xi(n,t)).toVar(),s=c1().toVar();return s.x.assign(r.bitAnd(de(255))),s.y.assign(r.shiftRight(de(8)).bitAnd(de(255))),s.z.assign(r.shiftRight(de(16)).bitAnd(de(255))),s}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),H4e=me(([i,e,t])=>{let n=de(t).toVar(),r=de(e).toVar(),s=de(i).toVar(),o=rt(Xi(s,r,n)).toVar(),a=c1().toVar();return a.x.assign(o.bitAnd(de(255))),a.y.assign(o.shiftRight(de(8)).bitAnd(de(255))),a.z.assign(o.shiftRight(de(16)).bitAnd(de(255))),a}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),iu=Ko([q4e,H4e]),W4e=me(([i])=>{let e=dt(i).toVar(),t=de().toVar(),n=de().toVar(),r=oe(Rr(e.x,t)).toVar(),s=oe(Rr(e.y,n)).toVar(),o=oe(Sf(r)).toVar(),a=oe(Sf(s)).toVar(),l=oe(ooe(So(Xi(t,n),r,s),So(Xi(t.add(de(1)),n),r.sub(1),s),So(Xi(t,n.add(de(1))),r,s.sub(1)),So(Xi(t.add(de(1)),n.add(de(1))),r.sub(1),s.sub(1)),o,a)).toVar();return loe(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),j4e=me(([i])=>{let e=pe(i).toVar(),t=de().toVar(),n=de().toVar(),r=de().toVar(),s=oe(Rr(e.x,t)).toVar(),o=oe(Rr(e.y,n)).toVar(),a=oe(Rr(e.z,r)).toVar(),l=oe(Sf(s)).toVar(),c=oe(Sf(o)).toVar(),u=oe(Sf(a)).toVar(),f=oe(aoe(So(Xi(t,n,r),s,o,a),So(Xi(t.add(de(1)),n,r),s.sub(1),o,a),So(Xi(t,n.add(de(1)),r),s,o.sub(1),a),So(Xi(t.add(de(1)),n.add(de(1)),r),s.sub(1),o.sub(1),a),So(Xi(t,n,r.add(de(1))),s,o,a.sub(1)),So(Xi(t.add(de(1)),n,r.add(de(1))),s.sub(1),o,a.sub(1)),So(Xi(t,n.add(de(1)),r.add(de(1))),s,o.sub(1),a.sub(1)),So(Xi(t.add(de(1)),n.add(de(1)),r.add(de(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return coe(f)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),LV=Ko([W4e,j4e]),X4e=me(([i])=>{let e=dt(i).toVar(),t=de().toVar(),n=de().toVar(),r=oe(Rr(e.x,t)).toVar(),s=oe(Rr(e.y,n)).toVar(),o=oe(Sf(r)).toVar(),a=oe(Sf(s)).toVar(),l=pe(ooe(nu(iu(t,n),r,s),nu(iu(t.add(de(1)),n),r.sub(1),s),nu(iu(t,n.add(de(1))),r,s.sub(1)),nu(iu(t.add(de(1)),n.add(de(1))),r.sub(1),s.sub(1)),o,a)).toVar();return loe(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),$4e=me(([i])=>{let e=pe(i).toVar(),t=de().toVar(),n=de().toVar(),r=de().toVar(),s=oe(Rr(e.x,t)).toVar(),o=oe(Rr(e.y,n)).toVar(),a=oe(Rr(e.z,r)).toVar(),l=oe(Sf(s)).toVar(),c=oe(Sf(o)).toVar(),u=oe(Sf(a)).toVar(),f=pe(aoe(nu(iu(t,n,r),s,o,a),nu(iu(t.add(de(1)),n,r),s.sub(1),o,a),nu(iu(t,n.add(de(1)),r),s,o.sub(1),a),nu(iu(t.add(de(1)),n.add(de(1)),r),s.sub(1),o.sub(1),a),nu(iu(t,n,r.add(de(1))),s,o,a.sub(1)),nu(iu(t.add(de(1)),n,r.add(de(1))),s.sub(1),o,a.sub(1)),nu(iu(t,n.add(de(1)),r.add(de(1))),s,o.sub(1),a.sub(1)),nu(iu(t.add(de(1)),n.add(de(1)),r.add(de(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return coe(f)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),VS=Ko([X4e,$4e]),Y4e=me(([i])=>{let e=oe(i).toVar(),t=de(Ps(e)).toVar();return ba(Xi(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),Z4e=me(([i])=>{let e=dt(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar();return ba(Xi(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),K4e=me(([i])=>{let e=pe(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar(),r=de(Ps(e.z)).toVar();return ba(Xi(t,n,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),Q4e=me(([i])=>{let e=Ft(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar(),r=de(Ps(e.z)).toVar(),s=de(Ps(e.w)).toVar();return ba(Xi(t,n,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),J4e=Ko([Y4e,Z4e,K4e,Q4e]),eIe=me(([i])=>{let e=oe(i).toVar(),t=de(Ps(e)).toVar();return pe(ba(Xi(t,de(0))),ba(Xi(t,de(1))),ba(Xi(t,de(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),tIe=me(([i])=>{let e=dt(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar();return pe(ba(Xi(t,n,de(0))),ba(Xi(t,n,de(1))),ba(Xi(t,n,de(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),nIe=me(([i])=>{let e=pe(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar(),r=de(Ps(e.z)).toVar();return pe(ba(Xi(t,n,r,de(0))),ba(Xi(t,n,r,de(1))),ba(Xi(t,n,r,de(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),iIe=me(([i])=>{let e=Ft(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar(),r=de(Ps(e.z)).toVar(),s=de(Ps(e.w)).toVar();return pe(ba(Xi(t,n,r,s,de(0))),ba(Xi(t,n,r,s,de(1))),ba(Xi(t,n,r,s,de(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),WI=Ko([eIe,tIe,nIe,iIe]),j4=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar(),l=oe(0).toVar(),c=oe(1).toVar();return Oi(o,()=>{l.addAssign(c.mul(LV(a))),c.mulAssign(r),a.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),jI=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar(),l=pe(0).toVar(),c=oe(1).toVar();return Oi(o,()=>{l.addAssign(c.mul(VS(a))),c.mulAssign(r),a.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),rIe=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar();return dt(j4(a,o,s,r),j4(a.add(pe(de(19),de(193),de(17))),o,s,r))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),sIe=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar(),l=pe(jI(a,o,s,r)).toVar(),c=oe(j4(a.add(pe(de(19),de(193),de(17))),o,s,r)).toVar();return Ft(l,c)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),oIe=me(([i,e,t,n,r,s,o])=>{let a=de(o).toVar(),l=oe(s).toVar(),c=de(r).toVar(),u=de(n).toVar(),f=de(t).toVar(),d=de(e).toVar(),A=dt(i).toVar(),y=pe(WI(dt(d.add(u),f.add(c)))).toVar(),w=dt(y.x,y.y).toVar();w.subAssign(.5),w.mulAssign(l),w.addAssign(.5);let S=dt(dt(oe(d),oe(f)).add(w)).toVar(),T=dt(S.sub(A)).toVar();return $t(a.equal(de(2)),()=>fr(T.x).add(fr(T.y))),$t(a.equal(de(3)),()=>Vr(fr(T.x),fr(T.y))),lu(T,T)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),aIe=me(([i,e,t,n,r,s,o,a,l])=>{let c=de(l).toVar(),u=oe(a).toVar(),f=de(o).toVar(),d=de(s).toVar(),A=de(r).toVar(),y=de(n).toVar(),w=de(t).toVar(),S=de(e).toVar(),T=pe(i).toVar(),R=pe(WI(pe(S.add(A),w.add(d),y.add(f)))).toVar();R.subAssign(.5),R.mulAssign(u),R.addAssign(.5);let P=pe(pe(oe(S),oe(w),oe(y)).add(R)).toVar(),I=pe(P.sub(T)).toVar();return $t(c.equal(de(2)),()=>fr(I.x).add(fr(I.y)).add(fr(I.z))),$t(c.equal(de(3)),()=>Vr(fr(I.x),fr(I.y),fr(I.z))),lu(I,I)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Mx=Ko([oIe,aIe]),lIe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=dt(i).toVar(),o=de().toVar(),a=de().toVar(),l=dt(Rr(s.x,o),Rr(s.y,a)).toVar(),c=oe(1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:f})=>{let d=oe(Mx(l,u,f,o,a,r,n)).toVar();c.assign(Pl(c,d))})}),$t(n.equal(de(0)),()=>{c.assign(el(c))}),c}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),cIe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=dt(i).toVar(),o=de().toVar(),a=de().toVar(),l=dt(Rr(s.x,o),Rr(s.y,a)).toVar(),c=dt(1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:f})=>{let d=oe(Mx(l,u,f,o,a,r,n)).toVar();$t(d.lessThan(c.x),()=>{c.y.assign(c.x),c.x.assign(d)}).ElseIf(d.lessThan(c.y),()=>{c.y.assign(d)})})}),$t(n.equal(de(0)),()=>{c.assign(el(c))}),c}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),uIe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=dt(i).toVar(),o=de().toVar(),a=de().toVar(),l=dt(Rr(s.x,o),Rr(s.y,a)).toVar(),c=pe(1e6,1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:f})=>{let d=oe(Mx(l,u,f,o,a,r,n)).toVar();$t(d.lessThan(c.x),()=>{c.z.assign(c.y),c.y.assign(c.x),c.x.assign(d)}).ElseIf(d.lessThan(c.y),()=>{c.z.assign(c.y),c.y.assign(d)}).ElseIf(d.lessThan(c.z),()=>{c.z.assign(d)})})}),$t(n.equal(de(0)),()=>{c.assign(el(c))}),c}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),hIe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=pe(i).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=pe(Rr(s.x,o),Rr(s.y,a),Rr(s.z,l)).toVar(),u=oe(1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:f})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{Oi({start:-1,end:de(1),name:"z",condition:"<="},({z:A})=>{let y=oe(Mx(c,f,d,A,o,a,l,r,n)).toVar();u.assign(Pl(u,y))})})}),$t(n.equal(de(0)),()=>{u.assign(el(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),fIe=Ko([lIe,hIe]),dIe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=pe(i).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=pe(Rr(s.x,o),Rr(s.y,a),Rr(s.z,l)).toVar(),u=dt(1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:f})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{Oi({start:-1,end:de(1),name:"z",condition:"<="},({z:A})=>{let y=oe(Mx(c,f,d,A,o,a,l,r,n)).toVar();$t(y.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(y)}).ElseIf(y.lessThan(u.y),()=>{u.y.assign(y)})})})}),$t(n.equal(de(0)),()=>{u.assign(el(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),pIe=Ko([cIe,dIe]),mIe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=pe(i).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=pe(Rr(s.x,o),Rr(s.y,a),Rr(s.z,l)).toVar(),u=pe(1e6,1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:f})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{Oi({start:-1,end:de(1),name:"z",condition:"<="},({z:A})=>{let y=oe(Mx(c,f,d,A,o,a,l,r,n)).toVar();$t(y.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(y)}).ElseIf(y.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(y)}).ElseIf(y.lessThan(u.z),()=>{u.z.assign(y)})})})}),$t(n.equal(de(0)),()=>{u.assign(el(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),DV=Ko([uIe,mIe]),AIe=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=de(i).toVar(),d=dt(e).toVar(),A=dt(t).toVar(),y=dt(n).toVar(),w=oe(r).toVar(),S=oe(s).toVar(),T=oe(o).toVar(),R=mc(a).toVar(),P=de(l).toVar(),I=oe(c).toVar(),F=oe(u).toVar(),D=d.mul(A).add(y),L=oe(0).toVar();return $t(f.equal(de(0)),()=>{L.assign(VS(D))}),$t(f.equal(de(1)),()=>{L.assign(WI(D))}),$t(f.equal(de(2)),()=>{L.assign(DV(D,w,de(0)))}),$t(f.equal(de(3)),()=>{L.assign(jI(pe(D,0),P,I,F))}),L.assign(L.mul(T.sub(S)).add(S)),$t(R,()=>{L.assign(Ju(L,S,T))}),L}).setLayout({name:"mx_unifiednoise2d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"texcoord",type:"vec2"},{name:"freq",type:"vec2"},{name:"offset",type:"vec2"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),gIe=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=de(i).toVar(),d=pe(e).toVar(),A=pe(t).toVar(),y=pe(n).toVar(),w=oe(r).toVar(),S=oe(s).toVar(),T=oe(o).toVar(),R=mc(a).toVar(),P=de(l).toVar(),I=oe(c).toVar(),F=oe(u).toVar(),D=d.mul(A).add(y),L=oe(0).toVar();return $t(f.equal(de(0)),()=>{L.assign(VS(D))}),$t(f.equal(de(1)),()=>{L.assign(WI(D))}),$t(f.equal(de(2)),()=>{L.assign(DV(D,w,de(0)))}),$t(f.equal(de(3)),()=>{L.assign(jI(D,P,I,F))}),L.assign(L.mul(T.sub(S)).add(S)),$t(R,()=>{L.assign(Ju(L,S,T))}),L}).setLayout({name:"mx_unifiednoise3d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"position",type:"vec3"},{name:"freq",type:"vec3"},{name:"offset",type:"vec3"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),vIe=me(([i])=>{let e=i.y,t=i.z,n=pe().toVar();return $t(e.lessThan(1e-4),()=>{n.assign(pe(t,t,t))}).Else(()=>{let r=i.x;r=r.sub(yf(r)).mul(6).toVar();let s=de(Pz(r)),o=r.sub(oe(s)),a=t.mul(e.oneMinus()),l=t.mul(e.mul(o).oneMinus()),c=t.mul(e.mul(o.oneMinus()).oneMinus());$t(s.equal(de(0)),()=>{n.assign(pe(t,c,a))}).ElseIf(s.equal(de(1)),()=>{n.assign(pe(l,t,a))}).ElseIf(s.equal(de(2)),()=>{n.assign(pe(a,t,c))}).ElseIf(s.equal(de(3)),()=>{n.assign(pe(a,l,t))}).ElseIf(s.equal(de(4)),()=>{n.assign(pe(c,a,t))}).Else(()=>{n.assign(pe(t,a,l))})}),n}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),_Ie=me(([i])=>{let e=pe(i).toVar(),t=oe(e.x).toVar(),n=oe(e.y).toVar(),r=oe(e.z).toVar(),s=oe(Pl(t,Pl(n,r))).toVar(),o=oe(Vr(t,Vr(n,r))).toVar(),a=oe(o.sub(s)).toVar(),l=oe().toVar(),c=oe().toVar(),u=oe().toVar();return u.assign(o),$t(o.greaterThan(0),()=>{c.assign(a.div(o))}).Else(()=>{c.assign(0)}),$t(c.lessThanEqual(0),()=>{l.assign(0)}).Else(()=>{$t(t.greaterThanEqual(o),()=>{l.assign(n.sub(r).div(a))}).ElseIf(n.greaterThanEqual(o),()=>{l.assign(Ls(2,r.sub(t).div(a)))}).Else(()=>{l.assign(Ls(4,t.sub(n).div(a)))}),l.mulAssign(1/6),$t(l.lessThan(0),()=>{l.addAssign(1)})}),pe(l,c,u)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),xIe=me(([i])=>{let e=pe(i).toVar(),t=mz(bz(e,pe(.04045))).toVar(),n=pe(e.div(12.92)).toVar(),r=pe(ru(Vr(e.add(pe(.055)),pe(0)).div(1.055),pe(2.4))).toVar();return Qn(n,r,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),hoe=(i,e)=>{i=oe(i),e=oe(e);let t=dt(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return gc(i.sub(t),i.add(t),e)},foe=(i,e,t,n)=>Qn(i,e,t[n].clamp()),yIe=(i,e,t=Ui())=>foe(i,e,t,"x"),bIe=(i,e,t=Ui())=>foe(i,e,t,"y"),wIe=(i,e,t,n,r=Ui())=>{let s=r.x.clamp(),o=r.y.clamp(),a=Qn(i,e,s),l=Qn(t,n,s);return Qn(a,l,o)},doe=(i,e,t,n,r)=>Qn(i,e,hoe(t,n[r])),SIe=(i,e,t,n=Ui())=>doe(i,e,t,n,"x"),TIe=(i,e,t,n=Ui())=>doe(i,e,t,n,"y"),EIe=(i=1,e=0,t=Ui())=>t.mul(i).add(e),MIe=(i,e=1)=>(i=oe(i),i.abs().pow(e).mul(i.sign())),CIe=(i,e=1,t=.5)=>oe(i).sub(t).mul(e).add(t),RIe=(i=Ui(),e=1,t=0)=>LV(i.convert("vec2|vec3")).mul(e).add(t),IIe=(i=Ui(),e=1,t=0)=>VS(i.convert("vec2|vec3")).mul(e).add(t),PIe=(i=Ui(),e=1,t=0)=>(i=i.convert("vec2|vec3"),Ft(VS(i),LV(i.add(dt(19,73)))).mul(e).add(t)),LIe=(i,e=Ui(),t=dt(1,1),n=dt(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>AIe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),DIe=(i,e=Ui(),t=dt(1,1),n=dt(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>gIe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),NIe=(i=Ui(),e=1)=>fIe(i.convert("vec2|vec3"),e,de(1)),FIe=(i=Ui(),e=1)=>pIe(i.convert("vec2|vec3"),e,de(1)),BIe=(i=Ui(),e=1)=>DV(i.convert("vec2|vec3"),e,de(1)),OIe=(i=Ui())=>J4e(i.convert("vec2|vec3")),UIe=(i=Ui(),e=3,t=2,n=.5,r=1)=>j4(i,de(e),t,n).mul(r),kIe=(i=Ui(),e=3,t=2,n=.5,r=1)=>rIe(i,de(e),t,n).mul(r),zIe=(i=Ui(),e=3,t=2,n=.5,r=1)=>jI(i,de(e),t,n).mul(r),VIe=(i=Ui(),e=3,t=2,n=.5,r=1)=>sIe(i,de(e),t,n).mul(r),GIe=(i,e=oe(0))=>Ls(i,e),qIe=(i,e=oe(0))=>ai(i,e),HIe=(i,e=oe(1))=>Tn(i,e),WIe=(i,e=oe(1))=>Ac(i,e),jIe=(i,e=oe(1))=>TI(i,e),XIe=(i,e=oe(1))=>ru(i,e),$Ie=(i=oe(0),e=oe(1))=>Ez(i,e),YIe=()=>Ex,ZIe=()=>Ise,KIe=(i,e=oe(1))=>ai(e,i),QIe=(i,e,t,n)=>i.greaterThan(e).mix(t,n),JIe=(i,e,t,n)=>i.greaterThanEqual(e).mix(t,n),ePe=(i,e,t,n)=>i.equal(e).mix(t,n),tPe=(i,e=null)=>{if(typeof e=="string"){let t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},n=e.replace(/^out/,"").toLowerCase();if(t[n]!==void 0)return i.element(t[n])}if(typeof e=="number")return i.element(e);if(typeof e=="string"&&e.length===1){let t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(t[e]!==void 0)return i.element(t[e])}return i},nPe=(i,e=dt(.5,.5),t=dt(1,1),n=oe(0),r=dt(0,0))=>{let s=i;if(e&&(s=s.sub(e)),t&&(s=s.mul(t)),n){let o=n.mul(Math.PI/180),a=o.cos(),l=o.sin();s=dt(s.x.mul(a).sub(s.y.mul(l)),s.x.mul(l).add(s.y.mul(a)))}return e&&(s=s.add(e)),r&&(s=s.add(r)),s},iPe=(i,e)=>{i=dt(i),e=oe(e);let t=e.mul(Math.PI/180);return US(i,t)},rPe=(i,e,t)=>{i=pe(i),e=oe(e),t=pe(t);let n=e.mul(Math.PI/180),r=t.normalize(),s=n.cos(),o=n.sin(),a=oe(1).sub(s);return i.mul(s).add(r.cross(i).mul(o)).add(r.mul(r.dot(i)).mul(a))},sPe=(i,e)=>(i=pe(i),e=oe(e),iV(i,e)),oPe=me(([i,e,t])=>{let n=ya(i).toVar(),r=ai(oe(.5).mul(e.sub(t)),wf).div(n).toVar(),s=ai(oe(-.5).mul(e.sub(t)),wf).div(n).toVar(),o=pe().toVar();o.x=n.x.greaterThan(oe(0)).select(r.x,s.x),o.y=n.y.greaterThan(oe(0)).select(r.y,s.y),o.z=n.z.greaterThan(oe(0)).select(r.z,s.z);let a=Pl(o.x,o.y,o.z).toVar();return wf.add(n.mul(a)).toVar().sub(t)}),poe=me(([i,e])=>{let t=i.x,n=i.y,r=i.z,s=e.element(0).mul(.886227);return s=s.add(e.element(1).mul(2*.511664).mul(n)),s=s.add(e.element(2).mul(2*.511664).mul(r)),s=s.add(e.element(3).mul(2*.511664).mul(t)),s=s.add(e.element(4).mul(2*.429043).mul(t).mul(n)),s=s.add(e.element(5).mul(2*.429043).mul(n).mul(r)),s=s.add(e.element(6).mul(r.mul(r).mul(.743125).sub(.247708))),s=s.add(e.element(7).mul(2*.429043).mul(t).mul(r)),s=s.add(e.element(8).mul(.429043).mul(Tn(t,t).sub(Tn(n,n)))),s}),V=Object.freeze({__proto__:null,BRDF_GGX:_V,BRDF_Lambert:r1,BasicPointShadowFilter:noe,BasicShadowFilter:$se,Break:Jre,Const:Sie,Continue:h3e,DFGLUT:yS,D_GGX:fse,Discard:kie,EPSILON:EI,F_Schlick:_x,Fn:me,HALF_PI:sEe,INFINITY:nEe,If:$t,Loop:Oi,NodeAccess:Yo,NodeShaderStage:nx,NodeType:FTe,NodeUpdateType:yn,OnBeforeFrameUpdate:s3e,OnBeforeMaterialUpdate:r3e,OnBeforeObjectUpdate:i3e,OnFrameUpdate:Wre,OnMaterialUpdate:n3e,OnObjectUpdate:OS,PCFShadowFilter:Yse,PCFSoftShadowFilter:Zse,PI:A4,PI2:iEe,PointShadowFilter:ioe,Return:AEe,Schlick_to_F0:R7,ShaderNode:sx,Stack:yI,Switch:ZTe,TBNViewMatrix:Hg,TWO_PI:rEe,VSMShadowFilter:Kse,V_GGX_SmithCorrelated:hse,Var:wie,VarIntent:Tie,abs:fr,acesFilmicToneMapping:zse,acos:Tz,acosh:Jne,add:Ls,addMethodChaining:Ue,addNodeElement:gEe,agxToneMapping:Vse,all:qne,alphaT:h4,ambientOcclusion:PU,and:Rne,anisotropy:am,anisotropyB:Xg,anisotropyT:aS,any:Hne,append:QTe,array:yne,asin:Kne,asinh:Qne,assign:bne,atan:Ez,atanh:eie,atomicAdd:wRe,atomicAnd:MRe,atomicFunc:Lf,atomicLoad:yRe,atomicMax:TRe,atomicMin:ERe,atomicOr:CRe,atomicStore:bRe,atomicSub:SRe,atomicXor:RRe,attenuationColor:xz,attenuationDistance:_z,attribute:pc,attributeArray:CCe,backgroundBlurriness:Dse,backgroundIntensity:vk,backgroundRotation:Nse,batch:Yre,batchColor:hV,bentNormalView:mre,billboarding:ACe,bitAnd:Dne,bitNot:Nne,bitOr:Fne,bitXor:Bne,bitangentGeometry:$Ee,bitangentLocal:YEe,bitangentView:dre,bitangentWorld:ZEe,bitcast:Cse,blendBurn:UCe,blendColor:GCe,blendDodge:kCe,blendOverlay:VCe,blendScreen:zCe,blur:vse,bool:mc,buffer:Sx,bufferAttribute:Vz,builtin:rp,builtinAOContext:yie,builtinShadowContext:xie,bumpMap:iV,bvec2:mne,bvec3:mz,bvec4:Ane,bypass:Oie,cache:Bie,call:wne,cameraFar:um,cameraIndex:wm,cameraNear:cm,cameraNormalMatrix:TEe,cameraPosition:Wie,cameraProjectionMatrix:Ja,cameraProjectionMatrixInverse:Hie,cameraViewMatrix:Sm,cameraViewport:EEe,cameraWorldMatrix:BS,cbrt:pie,cdl:XCe,ceil:CI,checker:S4e,cineonToneMapping:kse,clamp:Ju,clearcoat:l4,clearcoatNormalView:hm,clearcoatRoughness:ax,clipSpace:$ie,code:GI,color:pne,colorSpaceToWorking:II,colorToDirection:JEe,compute:Fie,computeKernel:qz,computeSkinning:u3e,context:ip,convert:vne,convertColorSpace:cEe,convertToTexture:SCe,cos:$u,cosh:$ne,countLeadingZeros:XMe,countOneBits:$Me,countTrailingZeros:jMe,cross:ep,cubeTexture:Qa,cubeTextureBase:tV,dFdx:Rz,dFdy:Iz,dashSize:$g,debug:Vie,decrement:Gne,decrementBefore:zne,defaultBuildStages:JR,defaultShaderStages:cne,defined:dx,degrees:jne,deltaTime:lCe,densityFogFactor:Wse,depth:AV,depthPass:QCe,determinant:sie,difference:cie,diffuseColor:Bi,diffuseContribution:zg,directPointLight:soe,directionToColor:QEe,directionToFaceDirection:kEe,dispersion:yz,disposeShadowMaterial:Jse,distance:lie,div:Ac,dot:lu,drawIndex:Nie,dynamicBufferAttribute:fEe,element:gne,emissive:IU,equal:Sne,equirectDirection:w7,equirectUV:gV,exp:wz,exp2:px,exponentialHeightFogFactor:cRe,expression:dc,faceDirection:Qz,faceForward:Oz,faceforward:oEe,float:oe,floatBitsToInt:qMe,floatBitsToUint:Rse,floor:yf,fog:Tk,fract:Qu,frameGroup:eEe,frameId:Ise,frontFacing:Yie,fwidth:Lz,gain:ZMe,gapSize:AS,getConstNodeType:dne,getCurrentStack:fz,getDirection:Ase,getDistanceAttenuation:PV,getGeometryRoughness:use,getNormalFromDepth:ECe,getParallaxCorrectNormal:oPe,getRoughness:vV,getScreenPosition:TCe,getShIrradianceAt:poe,getShadowMaterial:Qse,getShadowRenderObjectFunction:eoe,getTextureIndex:Ese,getViewPosition:rx,ggxConvolution:_se,globalId:dRe,glsl:oRe,glslFn:aRe,grayscale:qCe,greaterThan:bz,greaterThanEqual:Cne,hash:YMe,highpModelNormalViewMatrix:KU,highpModelViewMatrix:ZU,hue:jCe,increment:Vne,incrementBefore:kne,inspector:Gie,instance:Xre,instanceColor:uV,instanceIndex:Ku,instancedArray:RCe,instancedBufferAttribute:LI,instancedDynamicBufferAttribute:Gz,instancedMesh:$re,int:de,intBitsToFloat:HMe,interleavedGradientNoise:bV,inverse:oie,inverseSqrt:Sz,inversesqrt:aEe,invocationLocalIndex:mEe,invocationSubgroupIndex:pEe,ior:lS,iridescence:wI,iridescenceIOR:c4,iridescenceThickness:u4,isolate:ux,ivec2:zr,ivec3:pz,ivec4:Az,js:rRe,label:bie,length:bf,lengthSq:Fz,lessThan:Ene,lessThanEqual:Mne,lightPosition:MV,lightProjectionUV:jse,lightShadowMatrix:HI,lightTargetDirection:RV,lightTargetPosition:Xse,lightViewPosition:CV,lightingContext:tse,lights:o4e,linearDepth:T4,linearToneMapping:Ose,localId:pRe,log:MI,log2:xf,logarithmicDepthToViewZ:A3e,luminance:SV,mat2:bI,mat3:To,mat4:mm,matcapUV:xse,materialAO:qre,materialAlphaTest:gre,materialAnisotropy:Lre,materialAnisotropyVector:ix,materialAttenuationColor:zre,materialAttenuationDistance:kre,materialClearcoat:Ere,materialClearcoatNormal:Cre,materialClearcoatRoughness:Mre,materialColor:vre,materialDispersion:Gre,materialEmissive:xre,materialEnvIntensity:t4,materialEnvRotation:y4,materialIOR:Ure,materialIridescence:Dre,materialIridescenceIOR:Nre,materialIridescenceThickness:Fre,materialLightMap:cV,materialLineDashOffset:lV,materialLineDashSize:oV,materialLineGapSize:aV,materialLineScale:sV,materialLineWidth:b4,materialMetalness:Sre,materialNormal:Tre,materialOpacity:rV,materialPointSize:Vre,materialReference:Zd,materialReflectivity:n4,materialRefractionRatio:Qie,materialRotation:Rre,materialRoughness:wre,materialSheen:Ire,materialSheenRoughness:Pre,materialShininess:_re,materialSpecular:yre,materialSpecularColor:bre,materialSpecularIntensity:l7,materialSpecularStrength:cS,materialThickness:Ore,materialTransmission:Bre,max:Vr,maxMipLevel:Xz,mediumpModelViewMatrix:Xie,metalness:Qd,min:Pl,mix:Qn,mixElement:Aie,mod:TI,modelDirection:DEe,modelNormalMatrix:jie,modelPosition:NEe,modelRadius:OEe,modelScale:FEe,modelViewMatrix:Ef,modelViewPosition:BEe,modelViewProjection:Hre,modelWorldMatrix:su,modelWorldMatrixInverse:UEe,morphReference:ese,mrt:Mse,mul:Tn,mx_aastep:hoe,mx_add:GIe,mx_atan2:$Ie,mx_cell_noise_float:OIe,mx_contrast:CIe,mx_divide:WIe,mx_fractal_noise_float:UIe,mx_fractal_noise_vec2:kIe,mx_fractal_noise_vec3:zIe,mx_fractal_noise_vec4:VIe,mx_frame:ZIe,mx_heighttonormal:sPe,mx_hsvtorgb:vIe,mx_ifequal:ePe,mx_ifgreater:QIe,mx_ifgreatereq:JIe,mx_invert:KIe,mx_modulo:jIe,mx_multiply:HIe,mx_noise_float:RIe,mx_noise_vec3:IIe,mx_noise_vec4:PIe,mx_place2d:nPe,mx_power:XIe,mx_ramp4:wIe,mx_ramplr:yIe,mx_ramptb:bIe,mx_rgbtohsv:_Ie,mx_rotate2d:iPe,mx_rotate3d:rPe,mx_safepower:MIe,mx_separate:tPe,mx_splitlr:SIe,mx_splittb:TIe,mx_srgb_texture_to_lin_rec709:xIe,mx_subtract:qIe,mx_timer:YIe,mx_transform_uv:EIe,mx_unifiednoise2d:LIe,mx_unifiednoise3d:DIe,mx_worley_noise_float:NIe,mx_worley_noise_vec2:FIe,mx_worley_noise_vec3:BIe,negate:Cz,negateOnBackSide:f1,neutralToneMapping:Gse,nodeArray:jg,nodeImmutable:xt,nodeObject:Ht,nodeObjectIntent:iS,nodeObjects:xI,nodeProxy:$n,nodeProxyConstructor:hz,nodeProxyIntent:ct,normalFlat:Zie,normalGeometry:DI,normalLocal:wa,normalMap:o7,normalView:hi,normalViewGeometry:mx,normalWorld:Tm,normalWorldGeometry:Kie,normalize:ya,not:Pne,notEqual:Tne,numWorkgroups:hRe,objectDirection:MEe,objectGroup:xne,objectPosition:REe,objectRadius:LEe,objectScale:IEe,objectViewPosition:PEe,objectWorldMatrix:CEe,oneMinus:tie,or:Ine,orthographicDepthToViewZ:ise,oscSawtooth:fCe,oscSine:cCe,oscSquare:uCe,oscTriangle:hCe,output:lx,outputStruct:zMe,overloadingFn:Ko,overrideNode:Sse,overrideNodes:Tse,packHalf2x16:tCe,packNormalToRGB:nV,packSnorm2x16:JMe,packUnorm2x16:eCe,parabola:ck,parallaxDirection:pre,parallaxUV:KEe,parameter:OMe,pass:ZCe,passTexture:KCe,pcurve:KMe,perspectiveDepthToViewZ:OI,pmremTexture:yV,pointShadow:roe,pointUV:ICe,pointWidth:JTe,positionGeometry:va,positionLocal:Cr,positionPrevious:i1,positionView:ys,positionViewDirection:er,positionWorld:wf,positionWorldDirection:Kz,posterize:$Ce,pow:ru,pow2:Dz,pow3:uie,pow4:Nz,premultiplyAlpha:Wz,property:np,quadBroadcast:e4e,quadSwapDiagonal:$Re,quadSwapX:jRe,quadSwapY:XRe,radians:Wne,rand:mie,range:uRe,rangeFogFactor:Hse,reciprocal:iie,reference:mr,referenceBuffer:rre,reflect:aie,reflectVector:tre,reflectView:Jie,reflector:yCe,refract:Bz,refractVector:nre,refractView:ere,reinhardToneMapping:Use,remap:Hz,remapClamp:Uie,renderGroup:Jt,renderOutput:jz,rendererReference:Iie,replaceDefaultUV:dCe,rotate:US,rotateUV:pCe,roughness:vf,round:nie,rtt:Lse,sRGBTransferEOTF:Mie,sRGBTransferOETF:Cie,sample:MCe,sampler:yEe,samplerComparison:bEe,saturate:RI,saturation:HCe,screenCoordinate:h1,screenDPR:Yz,screenSize:n1,screenUV:Zu,select:xa,setCurrentStack:mS,setName:Uz,shaderStages:e4,shadow:toe,shadowPositionWorld:IV,shapeCircle:T4e,sharedUniformGroup:SI,sheen:hc,sheenRoughness:lm,shiftLeft:One,shiftRight:Une,shininess:f4,sign:Mz,sin:Ka,sinc:QMe,sinh:Xne,skinning:Qre,smoothstep:gc,smoothstepElement:gie,specularColor:vm,specularColorBlended:Gg,specularF90:qg,spherizeUV:mCe,split:KTe,spritesheetUV:vCe,sqrt:el,stack:r4,step:e1,stepElement:vie,storage:Am,storageBarrier:gRe,storageTexture:Fse,storageTexture3D:LCe,struct:kMe,sub:ai,subBuild:Yg,subgroupAdd:LRe,subgroupAll:qRe,subgroupAnd:URe,subgroupAny:HRe,subgroupBallot:PRe,subgroupBroadcast:YRe,subgroupBroadcastFirst:WRe,subgroupElect:IRe,subgroupExclusiveAdd:NRe,subgroupExclusiveMul:ORe,subgroupInclusiveAdd:DRe,subgroupInclusiveMul:BRe,subgroupIndex:dEe,subgroupMax:GRe,subgroupMin:VRe,subgroupMul:FRe,subgroupOr:kRe,subgroupShuffle:ZRe,subgroupShuffleDown:JRe,subgroupShuffleUp:QRe,subgroupShuffleXor:KRe,subgroupSize:mRe,subgroupXor:zRe,tan:Yne,tangentGeometry:NI,tangentLocal:_m,tangentView:FI,tangentWorld:fre,tanh:Zne,texture:fi,texture3D:wV,texture3DLevel:FCe,texture3DLoad:NCe,textureBarrier:vRe,textureBicubic:q3e,textureBicubicLevel:xV,textureCubeUV:gse,textureLevel:xEe,textureLoad:xs,textureSize:t1,textureStore:PCe,thickness:vz,time:Ex,toneMapping:Pie,toneMappingExposure:Lie,toonOutlinePass:JCe,transformDirection:hie,transformNormal:Jz,transformNormalByInverseViewMatrix:die,transformNormalByViewMatrix:fie,transformNormalToView:eV,transformedClearcoatNormalView:GEe,transformedNormalView:zEe,transformedNormalWorld:VEe,transmission:d4,transpose:rie,triNoise3D:oCe,triplanarTexture:_Ce,triplanarTextures:Pse,trunc:Pz,uint:rt,uintBitsToFloat:WMe,uniform:Xt,uniformArray:$o,uniformCubeTexture:qEe,uniformFlow:_ie,uniformGroup:_ne,uniformTexture:_Ee,unpackHalf2x16:rCe,unpackNormal:r7,unpackRGBToNormal:Are,unpackSnorm2x16:nCe,unpackUnorm2x16:iCe,unpremultiplyAlpha:zie,userData:BCe,uv:Ui,uvec2:dz,uvec3:c1,uvec4:gz,varying:bm,varyingProperty:u1,vec2:dt,vec3:pe,vec4:Ft,vectorComponents:l1,velocity:OCe,vertexColor:ose,vertexIndex:Die,vertexStage:Eie,vibrance:WCe,viewZToLogarithmicDepth:UI,viewZToOrthographicDepth:Zg,viewZToPerspectiveDepth:mV,viewZToReversedOrthographicDepth:m3e,viewZToReversedPerspectiveDepth:rse,viewport:fx,viewportCoordinate:qie,viewportDepthTexture:pV,viewportLinearDepth:g3e,viewportMipTexture:dV,viewportOpaqueMipTexture:nse,viewportResolution:SEe,viewportSafeUV:gCe,viewportSharedTexture:YCe,viewportSize:Zz,viewportTexture:d3e,viewportUV:wEe,vogelDiskSample:Yu,wgsl:sRe,wgslFn:lRe,workgroupArray:_Re,workgroupBarrier:ARe,workgroupId:fRe,workingToColorSpace:Rie,xor:Lne}),ju=new wS,Nk=class extends Rf{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,n){let r=this.renderer,s=this.nodes.getBackgroundNode(e)||e.background,o=!1;if(s===null)r._clearColor.getRGB(ju),ju.a=r._clearColor.a;else if(s.isColor===!0)s.getRGB(ju),ju.a=1,o=!0;else if(s.isNode===!0){let l=this.get(e),c=s;ju.copy(r._clearColor);let u=l.backgroundMesh;if(u===void 0){let P=function(){s.removeEventListener("dispose",P),u.material.dispose(),u.geometry.dispose()},d=Ft(c).mul(vk).context({getUV:()=>Nse.mul(Kie),getTextureLevel:()=>Dse}),A=Ja.element(3).element(3).equal(1),y=Ac(1,Ja.element(1).element(1)).mul(3),w=A.select(Cr.mul(y),Cr),S=Ef.mul(Ft(w,0)),T=Ja.mul(Ft(S.xyz,1));T=T.setZ(T.w);let R=new Pr;R.name="Background.material",R.side=mi,R.depthTest=!1,R.depthWrite=!1,R.allowOverride=!1,R.fog=!1,R.lights=!1,R.vertexNode=T,R.colorNode=d,l.backgroundMeshNode=d,l.backgroundMesh=u=new Hn(new Va(1,32,32),R),u.frustumCulled=!1,u.name="Background.mesh",s.addEventListener("dispose",P)}let f=c.getCacheKey();l.backgroundCacheKey!==f&&(l.backgroundMeshNode.node=Ft(c).mul(vk),l.backgroundMeshNode.needsUpdate=!0,u.material.needsUpdate=!0,l.backgroundCacheKey=f),t.unshift(u,u.geometry,u.material,0,0,null,null)}else ze("Renderer: Unsupported background configuration.",s);let a=r.xr.getEnvironmentBlendMode();if(a==="additive"?ju.set(0,0,0,1):a==="alpha-blend"&&ju.set(0,0,0,0),r.autoClear===!0||o===!0){let l=n.clearColorValue;l.r=ju.r,l.g=ju.g,l.b=ju.b,l.a=ju.a,(r.backend.isWebGLBackend===!0||r.alpha===!0)&&(l.r*=l.a,l.g*=l.a,l.b*=l.a),n.depthClearValue=r.getClearDepth(),n.stencilClearValue=r.getClearStencil(),n.clearColor=r.autoClearColor===!0,n.clearDepth=r.autoClearDepth===!0,n.clearStencil=r.autoClearStencil===!0}else n.clearColor=!1,n.clearDepth=!1,n.clearStencil=!1}},aPe=0,CS=class{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=aPe++}},Fk=class{constructor(e,t,n,r,s,o,a,l,c,u,f=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=n,this.transforms=f,this.nodeAttributes=r,this.bindings=s,this.updateNodes=o,this.updateBeforeNodes=a,this.updateAfterNodes=l,this.observer=c,this.hardwareClipping=u,this.usedTimes=0}createBindings(){let e=[];for(let t of this.bindings)if(t.bindings[0].groupNode.shared!==!0){let r=new CS(t.name,[]);e.push(r);for(let s of t.bindings)r.bindings.push(s.clone())}else e.push(t);return e}},X4=class{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}},Bk=class{constructor(e,t,n){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=n}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}},$4=class{constructor(e,t,n=!1,r=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=r}},Ok=class extends $4{constructor(e,t,n=null,r=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=n,this.interpolationSampling=r}},Uk=class{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}},lPe=0,dS=class{constructor(e=null){this.id=lPe++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return t===void 0&&this.parent!==null&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}},kk=class{constructor(e,t){this.name=e,this.members=t,this.output=!1}},Pf=class{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0,this.index=-1}setValue(e){this.value=e}getValue(){return this.value}},zk=class extends Pf{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}},Vk=class extends Pf{constructor(e,t=new Oe){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}},Gk=class extends Pf{constructor(e,t=new re){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}},qk=class extends Pf{constructor(e,t=new xn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}},Hk=class extends Pf{constructor(e,t=new zt){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}},Wk=class extends Pf{constructor(e,t=new h_){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}},jk=class extends Pf{constructor(e,t=new Mn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}},Xk=class extends Pf{constructor(e,t=new cn){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}},$k=class extends zk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Yk=class extends Vk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Zk=class extends Gk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Kk=class extends qk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Qk=class extends Hk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Jk=class extends Wk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},e9=class extends jk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},t9=class extends Xk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},cPe=0,Ite=new WeakMap,Pte=new WeakMap,uPe=new WeakMap,hPe=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),UR=i=>/e/g.test(i)?String(i).replace(/\+/g,""):(i=Number(i),i+(i%1?"":".0")),moe=i=>{if(i.writeUsageCount>0)return!0;if(i.subBuildsCache!==void 0){for(let e in i.subBuildsCache)if(moe(i.subBuildsCache[e]))return!0}return!1},Y4=class{constructor(e,t,n){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=n,this.scene=null,this.camera=null,this.nodes=new Set,this.sequentialNodes=new Set,this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.observer=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.hardwareClipping=!1,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.types={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.declarations={},this.flow={code:""},this.chaining=[],this.stack=r4(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new dS,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.subBuildLayers=[],this.activeStacks=[],this.subBuildFn=null,this.fnCall=null,Object.defineProperty(this,"id",{value:cPe++})}isFlatShading(){return this.material.flatShading===!0||this.geometry.hasAttribute("normal")===!1}isOpaque(){let e=this.material;return e.transparent===!1&&e.blending===Ms&&e.alphaToCoverage===!1}createRenderTarget(e,t,n){return new Ba(e,t,n)}createCubeRenderTarget(e,t){return new E4(e,t)}includes(e){return this.nodes.has(e)}getOutputType(e=0){let t="vec4",n=this.renderer.getRenderTarget();if(n!==null){let r=n.textures[e].type,s=n.textures[e].format,o="vec";r===Kr?o="ivec":r===xi&&(o="uvec"),s===Ud||s===qh?r===Kr?t="int":r===xi?t="uint":t="float":s===js||s===Hh?t=`${o}2`:s===Od||s===Nb?t=`${o}3`:t=`${o}4`}return t}getOutputStructName(){}_getBindGroup(e,t){let n=t[0].groupNode,r=n.shared;if(r)for(let o=1;o<t.length;o++)n!==t[o].groupNode&&(r=!1);let s;if(r){let o="";for(let u of t)if(u.isNodeUniformsGroup){u.uniforms.sort((f,d)=>f.nodeUniform.node.id-d.nodeUniform.node.id);for(let f of u.uniforms)o+=f.nodeUniform.node.id}else o+=u.nodeUniform.id;let a=this.renderer._currentRenderContext||this.renderer,l=Ite.get(a);l===void 0&&(l=new Map,Ite.set(a,l));let c=wx(o);s=l.get(c),s===void 0&&(s=new CS(e,t),l.set(c,s))}else s=new CS(e,t);return s}getBindGroupArray(e,t){let n=this.bindings[t],r=n[e];return r===void 0&&(this.bindingsIndexes[e]===void 0&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),n[e]=r=[]),r}getBindings(){let e=this.bindGroups;if(e===null){let t={},n=this.bindings;for(let r of e4)for(let s in n[r]){let o=n[r][s],a=t[s]||(t[s]=[]);for(let l of o)a.includes(l)===!1&&a.push(l)}e=[];for(let r in t){let s=t[r],o=this._getBindGroup(r,s);e.push(o)}this.bindGroups=e}return e}sortBindingGroups(){let e=this.getBindings();e.sort((t,n)=>t.bindings[0].groupNode.order-n.bindings[0].groupNode.order);for(let t=0;t<e.length;t++){let n=e[t];this.bindingsIndexes[n.name].group=t}}setHashNode(e,t){this.hashNodes[t]=e}addNode(e){this.nodes.has(e)===!1&&(this.nodes.add(e),this.setHashNode(e,e.getHash(this)))}addSequentialNode(e){let t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();(t!==yn.NONE||n!==yn.NONE)&&this.sequentialNodes.add(e)}buildUpdateNodes(){for(let e of this.nodes)e.getUpdateType()!==yn.NONE&&this.updateNodes.push(e);for(let e of this.sequentialNodes){let t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();t!==yn.NONE&&this.updateBeforeNodes.push(e),n!==yn.NONE&&this.updateAfterNodes.push(e)}}get currentNode(){return this.chaining[this.chaining.length-1]}isFilteredTexture(e){return e.magFilter===Mi||e.magFilter===g0||e.magFilter===Xc||e.magFilter===Go||e.minFilter===Mi||e.minFilter===g0||e.minFilter===Xc||e.minFilter===Go}getUniformBufferLimit(){return this.renderer.backend.capabilities.getUniformBufferLimit()}addChain(e){this.chaining.push(e)}removeChain(e){if(this.chaining.pop()!==e)throw new Error("THREE.NodeBuilder: Invalid node chaining!")}getMethod(e){return e}getTernary(){return null}getNodeFromHash(e){return this.hashNodes[e]}addFlow(e,t){return this.flowNodes[e].push(t),t}setContext(e){this.context=e}getContext(){return this.context}addContext(e){let t=this.getContext();return this.setContext({...this.context,...e}),t}getSharedContext(){let e={...this.context};return delete e.material,delete e.getUV,delete e.getOutput,delete e.getTextureLevel,delete e.getAO,delete e.getShadow,e}setCache(e){this.cache=e}getCache(){return this.cache}getCacheFromNode(e,t=!0){let n=this.getDataFromNode(e);return n.cache===void 0&&(n.cache=new dS(t?this.getCache():null)),n.cache}isAvailable(){return!1}getVertexIndex(){Xe("Abstract function.")}getInstanceIndex(){Xe("Abstract function.")}getDrawIndex(){Xe("Abstract function.")}getFrontFacing(){Xe("Abstract function.")}getFragCoord(){Xe("Abstract function.")}isFlipY(){return!1}isContextAssign(){return this.context.assign===!0}increaseUsage(e){let t=this.getDataFromNode(e);return t.usageCount=t.usageCount===void 0?1:t.usageCount+1,this.isContextAssign()?t.writeUsageCount=t.writeUsageCount===void 0?1:t.writeUsageCount+1:t.readUsageCount=t.readUsageCount===void 0?1:t.readUsageCount+1,t.usageCount}hasWriteUsage(e){let t=e.getShared(this),r=(t.isGlobal(this)?this.globalCache:this.cache).getData(t);if(r!==void 0){for(let s in r)if(moe(r[s]))return!0}return!1}generateTexture(){Xe("Abstract function.")}generateTextureLod(){Xe("Abstract function.")}generateArrayDeclaration(e,t){return this.getType(e)+"[ "+t+" ]"}generateArray(e,t,n=null){let r=this.generateArrayDeclaration(e,t)+"( ";for(let s=0;s<t;s++){let o=n?n[s]:null;o!==null?r+=o.build(this,e):r+=this.generateConst(e),s<t-1&&(r+=", ")}return r+=" )",r}generateStruct(e,t,n=null){let r=[];for(let s of t){let{name:o,type:a}=s;n&&n[o]&&n[o].isNode?r.push(n[o].build(this,a)):r.push(this.generateConst(a))}return e+"( "+r.join(", ")+" )"}generateConst(e,t=null){if(t===null&&(e==="float"||e==="int"||e==="uint"?t=0:e==="bool"?t=!1:e==="color"?t=new zt:e==="vec2"||e==="uvec2"||e==="ivec2"?t=new Oe:e==="vec3"||e==="uvec3"||e==="ivec3"?t=new re:(e==="vec4"||e==="uvec4"||e==="ivec4")&&(t=new xn)),e==="float")return UR(t);if(e==="int")return`${Math.round(t)}`;if(e==="uint")return t>=0?`${Math.round(t)}u`:"0u";if(e==="bool")return t?"true":"false";if(e==="color")return`${this.getType("vec3")}( ${UR(t.r)}, ${UR(t.g)}, ${UR(t.b)} )`;let n=this.getTypeLength(e),r=this.getComponentType(e),s=o=>this.generateConst(r,o);if(n===2)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)} )`;if(n===3)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)} )`;if(n===4&&e!=="mat2")return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)}, ${s(t.w)} )`;if(n>=4&&t&&(t.isMatrix2||t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(s).join(", ")} )`;if(n>4)return`${this.getType(e)}()`;throw new Error(`THREE.NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return e==="color"?"vec3":e}hasGeometryAttribute(e){return this.geometry&&this.geometry.getAttribute(e)!==void 0}getAttribute(e,t){let n=this.attributes;for(let s of n)if(s.name===e)return s;let r=new X4(e,t);return this.registerDeclaration(r),n.push(r),r}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return e==="void"||e==="property"||e==="sampler"||e==="samplerComparison"||e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="depthTexture"||e==="texture3D"}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){let t=e.type;return e.isDepthTexture===!0?"float":t===Kr?"int":t===xi?"uint":"float"}getElementType(e){return e==="mat2"?"vec2":e==="mat3"?"vec3":e==="mat4"?"vec4":this.getComponentType(e)}getComponentType(e){if(e=this.getVectorType(e),e==="float"||e==="bool"||e==="int"||e==="uint")return e;let t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return t===null?null:t[1]==="b"?"bool":t[1]==="i"?"int":t[1]==="u"?"uint":"float"}getVectorType(e){return e==="color"?"vec3":e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="texture3D"?"vec4":e}getTypeFromLength(e,t="float"){if(e===1)return t;let n=one(e),r=t==="float"?"":t[0];return/mat2/.test(t)===!0&&(n=n.replace("vec","mat")),r+n}getTypeFromArray(e){return hPe.get(e.constructor)}isInteger(e){return/int|uint|(i|u)vec/.test(e)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);let n=t.array,r=e.itemSize,s=e.normalized,o;return!(e instanceof e_)&&s!==!0&&(o=this.getTypeFromArray(n)),this.getTypeFromLength(r,o)}getTypeLength(e){let t=this.getVectorType(e),n=/vec([2-4])/.exec(t);return n!==null?Number(n[1]):t==="float"||t==="bool"||t==="int"||t==="uint"?1:/mat2/.test(e)===!0?4:/mat3/.test(e)===!0?9:/mat4/.test(e)===!0?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){let t=this.getComponentType(e);return t==="int"||t==="uint"?e:this.changeComponentType(e,"int")}setActiveStack(e){this.activeStacks.push(e)}removeActiveStack(e){if(this.activeStacks[this.activeStacks.length-1]===e)this.activeStacks.pop();else throw new Error("THREE.NodeBuilder: Invalid active stack removal.")}getActiveStack(){return this.activeStacks[this.activeStacks.length-1]}getBaseStack(){return this.activeStacks[0]}addStack(){this.stack=r4(this.stack);let e=fz();return this.stacks.push(e),mS(this.stack),this.stack}removeStack(){let e=this.stack;for(let t of e.nodes){let n=this.getDataFromNode(t);n.stack=e}return this.stack=e.parent,mS(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,n=null){n=n===null?e.isGlobal(this)?this.globalCache:this.cache:n;let r=n.getData(e);r===void 0&&(r={},n.setData(e,r)),r[t]===void 0&&(r[t]={});let s=r[t];if(this.subBuildLayers.length===0)return s;let o=r.any?r.any.subBuilds:null,a=this.getClosestSubBuild(o);return a&&(s.subBuildsCache===void 0&&(s.subBuildsCache={}),s=s.subBuildsCache[a]||(s.subBuildsCache[a]={}),s.subBuilds=o),s}getNodeProperties(e,t="any"){let n=this.getDataFromNode(e,t);return n.properties||(n.properties={outputNode:null})}getBufferAttributeFromNode(e,t,n=null){let r=this.getDataFromNode(e,"vertex"),s=r.bufferAttribute;if(s===void 0){let o=this.uniforms.index++;n===null&&(n="nodeAttribute"+o),s=new X4(n,t,e),this.bufferAttributes.push(s),r.bufferAttribute=s}return s}getStructTypeNode(e,t=this.shaderStage){return this.types[t][e]||null}getStructTypeFromNode(e,t,n=null,r=this.shaderStage){let s=this.getDataFromNode(e,r,this.globalCache),o=s.structType;if(o===void 0){let a=this.structs.index++;n===null&&(n="StructType"+a),o=new kk(n,t),this.structs[r].push(o),this.types[r][n]=e,s.structType=o}return o}getOutputStructTypeFromNode(e,t){let n=this.getStructTypeFromNode(e,t,"OutputType","fragment");return n.output=!0,n}getUniformFromNode(e,t,n=this.shaderStage,r=null){let s=this.getDataFromNode(e,n,this.globalCache),o=s.uniform;if(o===void 0){let a=this.uniforms.index++;o=new Bk(r||"nodeUniform"+a,t,e),this.uniforms[n].push(o),this.registerDeclaration(o),s.uniform=o}return o}getVarFromNode(e,t=null,n=e.getNodeType(this),r=this.shaderStage,s=!1){let o=this.getDataFromNode(e,r),a=this.getSubBuildProperty("variable",o.subBuilds),l=o[a];if(l===void 0){let c=s?"_const":"_var",u=this.vars[r]||(this.vars[r]=[]),f=this.vars[c]||(this.vars[c]=0);t===null&&(t=(s?"nodeConst":"nodeVar")+f,this.vars[c]++),a!=="variable"&&(t=this.getSubBuildProperty(t,o.subBuilds));let d=e.getArrayCount(this);l=new $4(t,n,s,d),s||u.push(l),this.registerDeclaration(l),o[a]=l}return l}isDeterministic(e){if(e.isMathNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0)&&(e.cNode?this.isDeterministic(e.cNode):!0);if(e.isOperatorNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0);if(e.isArrayNode){if(e.values!==null){for(let t of e.values)if(!this.isDeterministic(t))return!1}return!0}else if(e.isConstNode)return!0;return!1}getVaryingFromNode(e,t=null,n=e.getNodeType(this),r=null,s=null){let o=this.getDataFromNode(e,"any"),a=this.getSubBuildProperty("varying",o.subBuilds),l=o[a];if(l===void 0){let c=this.varyings,u=c.length;t===null&&(t="nodeVarying"+u),a!=="varying"&&(t=this.getSubBuildProperty(t,o.subBuilds)),l=new Ok(t,n,r,s),c.push(l),this.registerDeclaration(l),o[a]=l}return l}registerDeclaration(e){let t=this.shaderStage,n=this.declarations[t]||(this.declarations[t]={}),r=e.name,s=r,o=this.getPropertyName(e),a=1;for(;n[o]!==void 0;)s=r+"_"+a++,e.name=s,o=this.getPropertyName(e);s!==r&&Xe(`TSL: Declaration name '${r}' of '${e.type}' already in use. Renamed to '${s}'.`),n[o]=e}getCodeFromNode(e,t,n=this.shaderStage){let r=this.getDataFromNode(e),s=r.code;if(s===void 0){let o=this.codes[n]||(this.codes[n]=[]),a=o.length;s=new Uk("nodeCode"+a,t),o.push(s),r.code=s}return s}addFlowCodeHierarchy(e,t){let{flowCodes:n,flowCodeBlock:r}=this.getDataFromNode(e),s=!0,o=t;for(;o;){if(r.get(o)===!0){s=!1;break}o=this.getDataFromNode(o).parentNodeBlock}if(s)for(let a of n)this.addLineFlowCode(a)}addLineFlowCodeBlock(e,t,n){let r=this.getDataFromNode(e),s=r.flowCodes||(r.flowCodes=[]),o=r.flowCodeBlock||(r.flowCodeBlock=new WeakMap);s.push(t),o.set(n,!0)}addLineFlowCode(e,t=null){return e===""?this:(t!==null&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e=e+`;4161-`),this.flow.code+=e,this)}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+=" ",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){let t=e.getNodeType(this),n=this.flowChildNode(e,t);return this.flowsData.set(e,n),n}addInclude(e){this.currentFunctionNode!==null&&this.currentFunctionNode.includes.push(e)}buildFunctionNode(e){let t=this.renderer.backend,n=Pte.get(t);n===void 0&&(n=new WeakMap,Pte.set(t,n));let r=n.get(e);if(r===void 0){r=new G4;let s=this.currentFunctionNode;this.currentFunctionNode=r,r.code=this.buildFunctionCode(e),this.currentFunctionNode=s,n.set(e,r)}return r}flowShaderNode(e){let t=e.layout,n={[Symbol.iterator](){let o=0,a=Object.values(this);return{next:()=>({value:a[o],done:o++>=a.length})}}};for(let o of t.inputs)n[o.name]=new F4(o.type,o.name);e.layout=null;let r=e.call(n),s=this.flowStagesNode(r,t.type);return e.layout=t,s}flowBuildStage(e,t,n=null){let r=this.getBuildStage();this.setBuildStage(t);let s=e.build(this,n);return this.setBuildStage(r),s}flowStagesNode(e,t=null){let n=this.flow,r=this.vars,s=this.declarations,o=this.cache,a=this.buildStage,l=this.stack,c={code:""};this.flow=c,this.vars={},this.declarations={},this.cache=new dS,this.stack=r4();for(let u of JR)this.setBuildStage(u),c.result=e.build(this,t);return c.vars=this.getVars(this.shaderStage),this.flow=n,this.vars=r,this.declarations=s,this.cache=o,this.stack=l,this.setBuildStage(a),c}getFunctionOperator(){return null}buildFunctionCode(){Xe("Abstract function.")}flowChildNode(e,t=null){let n=this.flow,r={code:""};return this.flow=r,r.result=e.build(this,t),this.flow=n,r}flowNodeFromShaderStage(e,t,n=null,r=null){let s=this.tab,o=this.cache,a=this.shaderStage,l=this.context;this.setShaderStage(e);let c={...this.context};delete c.nodeBlock,this.cache=this.globalCache,this.tab=" ",this.context=c;let u=null;if(this.buildStage==="generate"){let f=this.flowChildNode(t,n);r!==null&&(f.code+=`${this.tab+r} = ${f.result};4158+`).removeFlowTab();e.addFlowTab()}},Oi=(...i)=>new d7(Wg(i,"int")).toStack(),l3e=()=>hc("continue").toStack(),Yre=()=>hc("break").toStack(),HO=new WeakMap,sc=new xn,Hee=new WeakMap,Wee=me(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{let o=de(Rie).mul(t).add(s),a=o.div(n),l=o.sub(a.mul(n));return _s(i,kr(l,a)).depth(r).xyz.mul(e)});function c3e(i){let e=i.morphAttributes.position!==void 0,t=i.morphAttributes.normal!==void 0,n=i.morphAttributes.color!==void 0,r=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,s=r!==void 0?r.length:0,o=HO.get(i);if(o===void 0||o.count!==s){let T=function(){w.dispose(),HO.delete(i),i.removeEventListener("dispose",T)};o!==void 0&&o.texture.dispose();let a=i.morphAttributes.position||[],l=i.morphAttributes.normal||[],c=i.morphAttributes.color||[],u=0;e===!0&&(u=1),t===!0&&(u=2),n===!0&&(u=3);let f=i.attributes.position.count*u,d=1,A=4096;f>A&&(d=Math.ceil(f/A),f=A);let y=new Float32Array(f*d*4*s),w=new zA(y,f,d,s);w.type=cr,w.needsUpdate=!0;let S=u*4;for(let R=0;R<s;R++){let I=a[R],P=l[R],F=c[R],D=f*d*4*R;for(let L=0;L<I.count;L++){let C=L*S;e===!0&&(sc.fromBufferAttribute(I,L),y[D+C+0]=sc.x,y[D+C+1]=sc.y,y[D+C+2]=sc.z,y[D+C+3]=0),t===!0&&(sc.fromBufferAttribute(P,L),y[D+C+4]=sc.x,y[D+C+5]=sc.y,y[D+C+6]=sc.z,y[D+C+7]=0),n===!0&&(sc.fromBufferAttribute(F,L),y[D+C+8]=sc.x,y[D+C+9]=sc.y,y[D+C+10]=sc.z,y[D+C+11]=F.itemSize===4?sc.w:1)}}o={count:s,texture:w,stride:u,size:new Oe(f,d)},HO.set(i,o),i.addEventListener("dispose",T)}return o}var Zre=me(([i])=>{let{geometry:e}=i,t=e.morphAttributes.position!==void 0,n=e.hasAttribute("normal")&&e.morphAttributes.normal!==void 0,r=e.morphAttributes.position||e.morphAttributes.normal||e.morphAttributes.color,s=r!==void 0?r.length:0;if(s===0)return;let o=Hee.get(i);(o===void 0||o.count!==s)&&(o={base:Xt(1),influences:i.morphTargetInfluences?$o(i.morphTargetInfluences,"float"):null,count:s},Hee.set(i,o));let{base:a,influences:l}=o,{texture:c,stride:u,size:f}=c3e(e);t===!0&&Mr.mulAssign(a),n===!0&&wa.mulAssign(a);let d=de(f.width);Oi(s,({i:A})=>{let y=oe(0).toVar();i.count>1&&i.morphTexture!==null&&i.morphTexture!==void 0?y.assign(_s(i.morphTexture,kr(de(A).add(1),de(Xu))).r):y.assign(l.element(A).toVar()),$t(y.notEqual(0),()=>{t===!0&&Mr.addAssign(Wee({bufferMap:c,influence:y,stride:u,width:d,depth:A,offset:de(0)})),n===!0&&wa.addAssign(Wee({bufferMap:c,influence:y,stride:u,width:d,depth:A,offset:de(1)}))})}),NS(({object:A})=>{let{base:y,influences:w}=o;A.geometry.morphTargetsRelative?y.value=1:y.value=1-A.morphTargetInfluences.reduce((S,T)=>S+T,0),w&&(w.array=A.morphTargetInfluences,w.update())})},"void"),_m=class extends Kt{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}},p7=class extends _m{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}},m7=class extends pS{static get type(){return"LightingContextNode"}constructor(e,t=null,n=[],r=null,s=null){super(e),this.lightingModel=t,this.materialLightings=n,this.backdropNode=r,this.backdropAlphaNode=s,this._value=null}getContext(){let{materialLightings:e,backdropNode:t,backdropAlphaNode:n}=this,r=pe().toVar("directDiffuse"),s=pe().toVar("directSpecular"),o=pe().toVar("indirectDiffuse"),a=pe().toVar("indirectSpecular"),l={directDiffuse:r,directSpecular:s,indirectDiffuse:o,indirectSpecular:a};return{radiance:pe().toVar("radiance"),irradiance:pe().toVar("irradiance"),iblIrradiance:pe().toVar("iblIrradiance"),ambientOcclusion:oe(1).toVar("ambientOcclusion"),reflectedLight:l,materialLightings:e,backdrop:t,backdropAlpha:n}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}},Kre=$n(m7),A7=class extends _m{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}},Lg=new Oe,mx=class extends su{static get type(){return"ViewportTextureNode"}constructor(e=ju,t=null,n=null){let r=null;n===null?(r=new WA,r.minFilter=Go,n=r):r=n,super(n,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=r,this.isOutputTextureNode=!0,this.updateBeforeType=yn.RENDER,this._cacheTextures=new WeakMap}getTextureForReference(e=null){let t,n;if(this.referenceNode?(t=this.referenceNode.defaultFramebuffer,n=this.referenceNode._cacheTextures):(t=this.defaultFramebuffer,n=this._cacheTextures),e===null)return t;if(n.has(e)===!1){let r=t.clone();n.set(e,r)}return n.get(e)}updateReference(e){let t=e.renderer,n=t.getRenderTarget(),r=t.getCanvasTarget(),s=n||r;return this.value=this.getTextureForReference(s),this.value}updateBefore(e){let t=e.renderer,n=t.getRenderTarget(),r=t.getCanvasTarget(),s=n||r;s===null?t.getDrawingBufferSize(Lg):s.getDrawingBufferSize?s.getDrawingBufferSize(Lg):Lg.set(s.width,s.height);let o=this.getTextureForReference(s);(o.image.width!==Lg.width||o.image.height!==Lg.height)&&(o.image.width=Lg.width,o.image.height=Lg.height,o.needsUpdate=!0);let a=o.generateMipmaps;o.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(o),o.generateMipmaps=a}clone(){let e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}},u3e=$n(mx).setParameterLength(0,3),dV=$n(mx,null,null,{generateMipmaps:!0}).setParameterLength(0,3),h3e=dV(),Qre=(i=ju,e=null)=>h3e.sample(i,e),WO=null,g7=class extends mx{static get type(){return"ViewportDepthTextureNode"}constructor(e=ju,t=null,n=null){n===null&&(WO===null&&(WO=new Es),n=WO),super(e,t,n)}},pV=$n(g7).setParameterLength(0,3),Zu=class i extends Kt{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){let{scope:t}=this;return t===i.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){let{scope:t}=this,n=this.valueNode,r=null;if(t===i.DEPTH_BASE)n!==null&&(r=tse().assign(n));else if(t===i.DEPTH)e.isPerspectiveCamera?r=mV(xs.z,lm,cm):r=Yg(xs.z,lm,cm);else if(t===i.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){let s=LP(n,lm,cm);r=Yg(s,lm,cm)}else r=n;else r=Yg(xs.z,lm,cm);return r}};Zu.DEPTH_BASE="depthBase";Zu.DEPTH="depth";Zu.LINEAR_DEPTH="linearDepth";var Yg=(i,e,t)=>i.add(e).div(e.sub(t)),f3e=(i,e,t)=>i.add(t).div(t.sub(e)),Jre=me(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?t.sub(e).mul(i).sub(t):e.sub(t).mul(i).sub(e)),mV=(i,e,t)=>e.add(i).mul(t).div(t.sub(e).mul(i)),ese=(i,e,t)=>e.mul(i.add(t)).div(i.mul(e.sub(t))),LP=me(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?e.mul(t).div(e.sub(t).mul(i).sub(e)):e.mul(t).div(t.sub(e).mul(i).sub(t))),DP=(i,e,t)=>{e=e.max(1e-6).toVar();let n=Af(i.negate().div(e)),r=Af(t.div(e));return n.div(r)},d3e=(i,e,t)=>{let n=i.mul(bP(t.div(e)));return oe(Math.E).pow(n).mul(e).negate()},tse=$n(Zu,Zu.DEPTH_BASE),AV=xt(Zu,Zu.DEPTH),x4=$n(Zu,Zu.LINEAR_DEPTH).setParameterLength(0,1),p3e=x4(pV());AV.assign=i=>tse(i);var wf=class i extends Kt{static get type(){return"ClippingNode"}constructor(e=i.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);let t=e.clippingContext,{intersectionPlanes:n,unionPlanes:r}=t;return this.hardwareClipping=e.hardwareClipping,this.scope===i.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(n,r):this.scope===i.HARDWARE?this.setupHardwareClipping(r,e):this.setupDefault(n,r)}setupAlphaToCoverage(e,t){return me(()=>{let n=oe().toVar("distanceToPlane"),r=oe().toVar("distanceToGradient"),s=oe(1).toVar("clipOpacity"),o=t.length;if(this.hardwareClipping===!1&&o>0){let l=$o(t).setGroup(Jt);Oi(o,({i:c})=>{let u=l.element(c);n.assign(xs.dot(u.xyz).negate().add(u.w)),r.assign(n.fwidth().div(2)),s.mulAssign(mc(r.negate(),r,n))})}let a=e.length;if(a>0){let l=$o(e).setGroup(Jt),c=oe(1).toVar("intersectionClipOpacity");Oi(a,({i:u})=>{let f=l.element(u);n.assign(xs.dot(f.xyz).negate().add(f.w)),r.assign(n.fwidth().div(2)),c.mulAssign(mc(r.negate(),r,n).oneMinus())}),s.mulAssign(c.oneMinus())}Bi.a.mulAssign(s),Bi.a.equal(0).discard()})()}setupDefault(e,t){return me(()=>{let n=t.length;if(this.hardwareClipping===!1&&n>0){let s=$o(t).setGroup(Jt);Oi(n,({i:o})=>{let a=s.element(o);xs.dot(a.xyz).greaterThan(a.w).discard()})}let r=e.length;if(r>0){let s=$o(e).setGroup(Jt),o=dc(!0).toVar("clipped");Oi(r,({i:a})=>{let l=s.element(a);o.assign(xs.dot(l.xyz).greaterThan(l.w).and(o))}),o.discard()}})()}setupHardwareClipping(e,t){let n=e.length;return t.enableHardwareClipping(n),me(()=>{let r=$o(e).setGroup(Jt),s=tp(t.getClipDistance());Oi(n,({i:o})=>{let a=r.element(o),l=xs.dot(a.xyz).sub(a.w).negate();s.element(o).assign(l)})})()}};wf.ALPHA_TO_COVERAGE="alphaToCoverage";wf.DEFAULT="default";wf.HARDWARE="hardware";var m3e=()=>new wf,A3e=()=>new wf(wf.ALPHA_TO_COVERAGE),g3e=()=>new wf(wf.HARDWARE),v3e=.05,jee=me(([i])=>$u(Tn(1e4,Ka(Tn(17,i.x).add(Tn(.1,i.y)))).mul(Ps(.1,fr(Ka(Tn(13,i.y).add(i.x))))))),Xee=me(([i])=>jee(dt(jee(i.xy),i.z))),_3e=me(([i])=>{let e=zr(vf(Rz(i.xyz)),vf(Pz(i.xyz))),t=oe(1).div(oe(v3e).mul(e)).toVar("pixScale"),n=dt(fx(gf(Af(t))),fx(wP(Af(t)))),r=dt(Xee(gf(n.x.mul(i.xyz))),Xee(gf(n.y.mul(i.xyz)))),s=$u(Af(t)),o=Ps(Tn(s.oneMinus(),r.x),Tn(s,r.y)),a=Pl(s,s.oneMinus()),l=pe(o.mul(o).div(Tn(2,a).mul(ai(1,a))),o.sub(Tn(.5,a)).div(ai(1,a)),ai(1,ai(1,o).mul(ai(1,o)).div(Tn(2,a).mul(ai(1,a))))),c=o.lessThan(a.oneMinus()).select(o.lessThan(a).select(l.x,l.y),l.z);return Yu(c,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]}),v7=class extends p4{static get type(){return"VertexColorNode"}constructor(e){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){let e=this.index;return"color"+(e>0?e:"")}generate(e){let t=this.getAttributeName(e),n=e.hasGeometryAttribute(t),r;return n===!0?r=super.generate(e):r=e.generateConst(this.nodeType,new xn(1,1,1,1)),r}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}},nse=(i=0)=>new v7(i),Pr=class extends Hs{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.maskNode=null,this.maskShadowNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,this.contextNode=null}_getNodeChildren(){let e=[];for(let t of Object.getOwnPropertyNames(this)){if(t.startsWith("_")===!0)continue;let n=this[t];n&&n.isNode===!0&&e.push({property:t,childNode:n})}return e}customProgramCacheKey(){let e=[];for(let{property:t,childNode:n}of this._getNodeChildren())e.push(yx(t.slice(0,-4)),n.getCacheKey());return this.type+LS(e)}build(e){this.setup(e)}setupObserver(e){return new xU(e)}setup(e){e.context.setupNormal=()=>$g(this.setupNormal(e),"NORMAL","vec3"),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);let t=e.renderer,n=t.getRenderTarget();e.addStack();let r=this.setupVertex(e),s=$g(this.vertexNode||r,"VERTEX");e.context.clipSpace=s,e.stack.outputNode=s,this.setupHardwareClipping(e),this.geometryNode!==null&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();let o,a=this.setupClipping(e);if((this.depthWrite===!0||this.depthTest===!0)&&(n!==null?n.depthBuffer===!0&&this.setupDepth(e):t.depth===!0&&this.setupDepth(e)),this.fragmentNode===null){this.setupDiffuseColor(e),this.setupAmbientOcclusion(e),this.setupVariants(e);let l=this.setupLighting(e);a!==null&&e.stack.addToStack(a);let c=Ft(l,Bi.a).max(0);o=this.setupOutput(e,c),ox.assign(o);let u=this.outputNode!==null;if(u&&(o=this.outputNode),e.context.getOutput&&(o=e.context.getOutput(o,e)),n!==null){let f=t.getMRT(),d=this.mrtNode;f!==null?(u&&ox.assign(o),o=f,d!==null&&(o=f.merge(d))):d!==null&&(o=d)}}else{let l=this.fragmentNode;l.isOutputStructNode!==!0&&(l=l.convert(e.getOutputType())),o=this.setupOutput(e,l)}e.stack.outputNode=o,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;let{unionPlanes:t,intersectionPlanes:n}=e.clippingContext,r=null;if(t.length>0||n.length>0){let s=e.renderer.currentSamples;this.alphaToCoverage&&s>1?r=A3e():e.stack.addToStack(m3e())}return r}setupHardwareClipping(e){if(e.hardwareClipping=!1,e.clippingContext===null)return;let t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.addToStack(g3e()),e.hardwareClipping=!0)}setupDepth(e){let{renderer:t,camera:n}=e,r=this.depthNode;if(r===null){let s=t.getMRT();s&&s.has("depth")?r=s.get("depth"):t.logarithmicDepthBuffer===!0&&(n.isPerspectiveCamera?r=DP(xs.z,lm,cm):r=Yg(xs.z,lm,cm))}r!==null&&AV.assign(r).toStack()}setupPositionView(){return bf.mul(Mr).xyz}setupModelViewProjection(){return Ja.mul(xs)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),zre}setupPosition(e){let{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&Zre(t),t.isSkinnedMesh===!0&&$re(t),this.displacementMap){let r=Xd("displacementMap","texture"),s=Xd("displacementScale","float"),o=Xd("displacementBias","float");Mr.addAssign(wa.normalize().mul(r.x.mul(s).add(o)))}return t.isBatchedMesh&&Wre(t),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&Hre(t),this.positionNode!==null&&Mr.assign($g(this.positionNode,"POSITION","vec3")),Mr}setupDiffuseColor(e){let{object:t,geometry:n}=e;this.maskNode!==null&&dc(this.maskNode).not().discard();let r=this.colorNode?Ft(this.colorNode):pre;this.vertexColors===!0&&n.hasAttribute("color")&&(r=r.mul(nse())),t.instanceColor&&(r=uV.mul(r)),t.isBatchedMesh&&t._colorsTexture&&(r=hV.mul(r)),Bi.assign(r);let s=this.opacityNode?oe(this.opacityNode):rV;Bi.a.assign(Bi.a.mul(s));let o=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(o=this.alphaTestNode!==null?oe(this.alphaTestNode):dre,this.alphaToCoverage===!0?(Bi.a=mc(o,o.add(Lz(Bi.a)),Bi.a),Bi.a.lessThanEqual(0).discard()):Bi.a.lessThanEqual(o).discard()),this.alphaHash===!0&&Bi.a.lessThan(_3e(Mr)).discard(),e.isOpaque()&&Bi.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?pe(0):Bi.rgb}setupNormal(){return this.normalNode?pe(this.normalNode):yre}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Xd("envMap","cubeTexture"):Xd("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new A7(cV)),t}setupMaterialLightings(e){let t=[];if(e.renderer.lighting.enabled===!1)return t;let n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);let r=this.setupLightMap(e);return r&&r.isLightingNode&&t.push(r),e.context.ambientOcclusion&&t.push(new p7(e.context.ambientOcclusion)),t}setupAmbientOcclusion(e){let t=this.aoNode;t===null&&e.material.aoMap&&(t=kre),e.context.getAO&&(t=e.context.getAO(t,e)),t!==null&&(IU.assign(t),e.context.ambientOcclusion=IU)}setupLightingModel(){}setupLighting(e){let{material:t}=e,{backdropNode:n,backdropAlphaNode:r,emissiveNode:s}=this,o=this.lights===!0||this.lightsNode!==null,a=this.lights===!0?this.setupMaterialLightings(e):[],l=o?this.lightsNode||e.lightsNode:null,c=this.setupOutgoingLight(e);if(l&&(a.length>0||l.getScope().hasLights)){let u=this.setupLightingModel(e)||null;c=Kre(l,u,a,n,r)}else n!==null&&(c=pe(r!==null?Qn(c,n,r):n));return(s&&s.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(PU.assign(pe(s||Are)),c=c.add(PU)),c}setupFog(e,t){let n=e.fogNode;return n&&(ox.assign(t),t=Ft(n.toVar())),t}setupPremultipliedAlpha(e,t){return Wz(t)}setupOutput(e,t){return this.fog===!0&&(t=this.setupFog(e,t)),this.premultipliedAlpha===!0&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(let n in e){let r=e[n];this[n]===void 0&&(this[n]=r,r&&r.clone&&(this[n]=r.clone()))}let t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(let n in t)Object.getOwnPropertyDescriptor(this.constructor.prototype,n)===void 0&&t[n].get!==void 0&&Object.defineProperty(this.constructor.prototype,n,t[n])}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{},nodes:{}});let n=Hs.prototype.toJSON.call(this,e);n.inputNodes={};for(let{property:s,childNode:o}of this._getNodeChildren())n.inputNodes[s]=o.toJSON(e).uuid;function r(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=r(e.textures),o=r(e.images),a=r(e.nodes);s.length>0&&(n.textures=s),o.length>0&&(n.images=o),a.length>0&&(n.nodes=a)}return n}copy(e){let t=Object.getOwnPropertyDescriptors(this.constructor.prototype);for(let n in t)if(t[n].set!==void 0&&e[n]!==void 0){let r=e[n];this[n]&&this[n].copy!==void 0?this[n].copy(r):this[n]=r}for(let n in this)if(!/^(?:is[A-Z]|_)|^(?:id|uuid|version|type|userData|clippingPlanes)$/.test(n)&&this[n]!==void 0&&e[n]!==void 0){let r=e[n];this[n]&&this[n].copy!==void 0?this[n].copy(r):this[n]=r}return this.clippingPlanes=e.clippingPlanes?e.clippingPlanes.map(n=>n.clone()):null,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},x3e=new Iu,_7=class extends Pr{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(x3e),this.setValues(e)}},y3e=new eb,x7=class extends Pr{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(y3e),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){let e=this.offsetNode?oe(this.offsetNode):lV,t=this.dashScaleNode?oe(this.dashScaleNode):sV,n=this.dashSizeNode?oe(this.dashSizeNode):oV,r=this.gapSizeNode?oe(this.gapSizeNode):aV;Xg.assign(n),dS.assign(r);let s=ym(fc("lineDistance").mul(t));(e?s.add(e):s).mod(Xg.add(dS)).greaterThan(Xg).discard()}};var QR=c1("vec3","worldStart"),y7=c1("vec3","worldEnd"),ise=c1("float","lineDistance"),Ug=c1("vec4","worldPos"),$ee=me(({start:i,end:e})=>{let t=Ja.element(2).element(2),n=Ja.element(3).element(2);return t.greaterThan(0).select(n.negate().div(t.add(1)),n.mul(-.5).div(t)).sub(i.z).div(e.z.sub(i.z))},{start:"vec4",end:"vec4",return:"float"}),b3e=me(({p1:i,p2:e,p3:t,p4:n})=>{let r=i.sub(t),s=n.sub(t),o=e.sub(i),a=r.dot(s),l=s.dot(o),c=r.dot(o),u=s.dot(s),d=o.dot(o).mul(u).sub(l.mul(l)),y=a.mul(l).sub(c.mul(u)).div(d).clamp(),w=a.add(l.mul(y)).div(u).clamp();return dt(y,w)},{p1:"vec3",p2:"vec3",p3:"vec3",p4:"vec3",return:"vec2"}),xlt=me(({material:i})=>{let e=i._useDash,t=i._useWorldUnits,n=fc("instanceStart"),r=fc("instanceEnd"),s=Ft(bf.mul(Ft(n,1))).toVar("start"),o=Ft(bf.mul(Ft(r,1))).toVar("end"),a,l;e&&(a=oe(fc("instanceDistanceStart")).toVar("distanceStart"),l=oe(fc("instanceDistanceEnd")).toVar("distanceEnd")),t&&(QR.assign(s.xyz),y7.assign(o.xyz));let c=ux.z.div(ux.w),u=Ja.element(2).element(3).equal(-1);if($t(u,()=>{$t(s.z.lessThan(0).and(o.z.greaterThan(0)),()=>{let T=$ee({start:s,end:o});o.assign(Ft(Qn(s.xyz,o.xyz,T),o.w)),e&&l.assign(Qn(a,l,T))}).ElseIf(o.z.lessThan(0).and(s.z.greaterThanEqual(0)),()=>{let T=$ee({start:o,end:s});s.assign(Ft(Qn(o.xyz,s.xyz,T),s.w)),e&&a.assign(Qn(l,a,T))})}),e){let T=i.dashScaleNode?oe(i.dashScaleNode):sV,R=i.offsetNode?oe(i.offsetNode):lV,I=va.y.lessThan(.5).select(T.mul(a),T.mul(l));I=I.add(R),ise.assign(I)}let f=Ja.mul(s),d=Ja.mul(o),A=f.xyz.div(f.w),y=d.xyz.div(d.w),w=y.xy.sub(A.xy).toVar();w.x.assign(w.x.mul(c)),w.assign(w.normalize());let S=Ft().toVar();if(t){let T=o.xyz.sub(s.xyz).normalize(),R=Qn(s.xyz,o.xyz,.5).normalize(),I=T.cross(R).normalize(),P=T.cross(I);Ug.assign(va.y.lessThan(.5).select(s,o));let F=g4.mul(.5);Ug.addAssign(Ft(va.x.lessThan(0).select(I.mul(F),I.mul(F).negate()),0)),e||(Ug.addAssign(Ft(va.y.lessThan(.5).select(T.mul(F).negate(),T.mul(F)),0)),Ug.addAssign(Ft(P.mul(F),0)),$t(va.y.greaterThan(1).or(va.y.lessThan(0)),()=>{Ug.subAssign(Ft(P.mul(2).mul(F),0))})),S.assign(Ja.mul(Ug));let D=pe().toVar();D.assign(va.y.lessThan(.5).select(A,y)),S.z.assign(D.z.mul(S.w))}else{let T=dt(w.y,w.x.negate()).toVar("offset");w.x.assign(w.x.div(c)),T.x.assign(T.x.div(c)),T.assign(va.x.lessThan(0).select(T.negate(),T)),$t(va.y.lessThan(0),()=>{T.assign(T.sub(w))}).ElseIf(va.y.greaterThan(1),()=>{T.assign(T.add(w))}),T.assign(T.mul(g4)),T.assign(T.div(ux.w.div(Yz))),S.assign(va.y.lessThan(.5).select(f,d)),T.assign(T.mul(S.w)),S.assign(S.add(Ft(T,0,0)))}return S})(),ylt=me(({material:i,renderer:e})=>{let t=i._useAlphaToCoverage,n=i._useDash,r=i._useWorldUnits,s=Ui();if(n){let a=i.dashSizeNode?oe(i.dashSizeNode):oV,l=i.gapSizeNode?oe(i.gapSizeNode):aV;Xg.assign(a),dS.assign(l),s.y.lessThan(-1).or(s.y.greaterThan(1)).discard(),ise.mod(Xg.add(dS)).greaterThan(Xg).discard()}let o=oe(1).toVar("alpha");if(r){let a=Ug.xyz.normalize().mul(1e5),l=y7.sub(QR),c=b3e({p1:QR,p2:y7,p3:pe(0,0,0),p4:a}),u=QR.add(l.mul(c.x)),f=a.mul(c.y),y=u.sub(f).length().div(g4);if(!n)if(t&&e.currentSamples>0){let w=y.fwidth();o.assign(mc(w.negate().add(.5),w.add(.5),y).oneMinus())}else y.greaterThan(.5).discard()}else if(t&&e.currentSamples>0){let a=s.x,l=s.y.greaterThan(0).select(s.y.sub(1),s.y.add(1)),c=a.mul(a).add(l.mul(l)),u=oe(c.fwidth()).toVar("dlen");$t(s.y.abs().greaterThan(1),()=>{o.assign(mc(u.oneMinus(),u.add(1),c).oneMinus())})}else $t(s.y.abs().greaterThan(1),()=>{let a=s.x,l=s.y.greaterThan(0).select(s.y.sub(1),s.y.add(1));a.mul(a).add(l.mul(l)).greaterThan(1).discard()});return o})();var w3e=new Q2,b7=class extends Pr{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(w3e),this.setValues(e)}setupDiffuseColor(){let e=this.opacityNode?oe(this.opacityNode):rV;Bi.assign(TP(Ft(nV(hi),e),Fr))}},gV=me(([i=Kz])=>{let e=i.z.atan(i.x).mul(1/(Math.PI*2)).add(.5),t=i.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return dt(e,t)}),w7=me(([i=Ui()])=>{let e=i.x.sub(.5).mul(Math.PI*2),t=i.y.sub(.5).mul(Math.PI),n=t.cos(),r=n.mul(e.cos()),s=t.sin(),o=n.mul(e.sin());return pe(r,s,o)}),y4=class extends Ba{constructor(e=1,t={}){super(e,e,t),this.isCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Ph(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){let n=t.minFilter,r=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let s=new Lu(5,5,5),o=gV(Kz),a=new Pr;a.colorNode=fi(t,o,0),a.side=mi,a.blending=ps;let l=new Hn(s,a),c=new s0;c.add(l),t.minFilter===Go&&(t.minFilter=Mi);let u=new o_(1,10,this),f=e.getMRT();return e.setMRT(null),u.update(e,c),e.setMRT(f),t.minFilter=n,t.generateMipmaps=r,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}},aS=new WeakMap,S7=class extends Rr{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=Qa(null);let t=new Ph;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=yn.RENDER}updateBefore(e){let{renderer:t,material:n}=e,r=this.envNode;if(r.isTextureNode||r.isMaterialReferenceNode){let s=r.isTextureNode?r.value:n[r.property];if(s&&s.isTexture){let o=s.mapping;if(o===p0||o===m0){if(aS.has(s)){let a=aS.get(s);Yee(a,s.mapping),this._cubeTexture=a}else{let a=s.image;if(S3e(a)){let l=new y4(a.height);l.fromEquirectangularTexture(t,s),Yee(l.texture,s.mapping),this._cubeTexture=l.texture,aS.set(s,l.texture),s.addEventListener("dispose",rse)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}};function S3e(i){return i==null?!1:i.height>0}function rse(i){let e=i.target;e.removeEventListener("dispose",rse);let t=aS.get(e);t!==void 0&&(aS.delete(e),t.dispose())}function Yee(i,e){e===p0?i.mapping=ec:e===m0&&(i.mapping=Gc)}var sse=$n(S7).setParameterLength(1),gS=class extends _m{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=sse(this.envNode)}},T7=class extends _m{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){let t=oe(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}},Ax=class{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}},b4=class extends Ax{constructor(){super()}indirect({context:e}){let t=e.ambientOcclusion,n=e.reflectedLight,r=e.irradianceLightMap;n.indirectDiffuse.assign(Ft(0)),r?n.indirectDiffuse.addAssign(r):n.indirectDiffuse.addAssign(Ft(1,1,1,0)),n.indirectDiffuse.mulAssign(t),n.indirectDiffuse.mulAssign(Bi.rgb)}finish(e){let{material:t,context:n}=e,r=n.outgoingLight,s=e.context.environment;if(s)switch(t.combine){case tg:r.rgb.assign(Qn(r.rgb,r.rgb.mul(s.rgb),oS.mul(KR)));break;case FM:r.rgb.assign(Qn(r.rgb,s.rgb,oS.mul(KR)));break;case BM:r.rgb.addAssign(s.rgb.mul(oS.mul(KR)));break;default:Xe("BasicLightingModel: Unsupported .combine value:",t.combine);break}}},T3e=new fs,E7=class extends Pr{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(T3e),this.setValues(e)}setupNormal(){return h1(dx)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new gS(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new T7(cV)),t}setupOutgoingLight(){return Bi.rgb}setupLightingModel(){return new b4}},gx=me(({f0:i,f90:e,dotVH:t})=>{let n=t.mul(-5.55473).sub(6.98316).mul(t).exp2();return i.mul(n.oneMinus()).add(e.mul(n))}),i1=me(i=>i.diffuseColor.mul(1/Math.PI)),E3e=()=>oe(.25),M3e=me(({dotNH:i})=>a4.mul(oe(.5)).add(1).mul(oe(1/Math.PI)).mul(i.pow(a4))),C3e=me(({lightDirection:i})=>{let e=i.add(er).normalize(),t=hi.dot(e).clamp(),n=er.dot(e).clamp(),r=gx({f0:gm,f90:1,dotVH:n}),s=E3e(),o=M3e({dotNH:t});return r.mul(s).mul(o)}),w4=class extends b4{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=hi.dot(e).clamp().mul(t);n.directDiffuse.addAssign(s.mul(i1({diffuseColor:Bi.rgb}))),this.specular===!0&&n.directSpecular.addAssign(s.mul(C3e({lightDirection:e})).mul(oS))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(i1({diffuseColor:Bi}))),r.indirectDiffuse.mulAssign(t)}},R3e=new Ga,M7=class extends Pr{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(R3e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new gS(t):null}setupLightingModel(){return new w4(!1)}},P3e=new ZA,C7=class extends Pr{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(P3e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new gS(t):null}setupLightingModel(){return new w4}setupVariants(){let e=(this.shininessNode?oe(this.shininessNode):mre).max(1e-4);a4.assign(e);let t=this.specularNode||gre;gm.assign(t)}},ose=me(i=>{if(i.geometry.hasAttribute("normal")===!1)return oe(0);let e=dx.dFdx().abs().max(dx.dFdy().abs());return e.x.max(e.y).max(e.z)}),vV=me(i=>{let{roughness:e}=i,t=ose(),n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),ase=me(({alpha:i,dotNL:e,dotNV:t})=>{let n=i.pow2(),r=e.mul(n.add(n.oneMinus().mul(t.pow2())).sqrt()),s=t.mul(n.add(n.oneMinus().mul(e.pow2())).sqrt());return pc(.5,r.add(s).max(yP))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),I3e=me(({alphaT:i,alphaB:e,dotTV:t,dotBV:n,dotTL:r,dotBL:s,dotNV:o,dotNL:a})=>{let l=a.mul(pe(i.mul(t),e.mul(n),o).length()),c=o.mul(pe(i.mul(r),e.mul(s),a).length());return pc(.5,l.add(c).max(yP))}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),lse=me(({alpha:i,dotNH:e})=>{let t=i.pow2(),n=e.pow2().mul(t.oneMinus()).oneMinus();return t.div(n.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),L3e=oe(1/Math.PI),D3e=me(({alphaT:i,alphaB:e,dotNH:t,dotTH:n,dotBH:r})=>{let s=i.mul(e),o=pe(e.mul(n),i.mul(r),s.mul(t)),a=o.dot(o),l=s.div(a);return L3e.mul(s.mul(l.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),_V=me(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,normalView:s=hi,USE_IRIDESCENCE:o,USE_ANISOTROPY:a})=>{let l=n.pow2(),c=i.add(er).normalize(),u=s.dot(i).clamp(),f=s.dot(er).clamp(),d=s.dot(c).clamp(),A=er.dot(c).clamp(),y=gx({f0:e,f90:t,dotVH:A}),w,S;if(hx(o)&&(y=vP.mix(y,r)),hx(a)){let T=rS.dot(i),R=rS.dot(er),I=rS.dot(c),P=jg.dot(i),F=jg.dot(er),D=jg.dot(c);w=I3e({alphaT:o4,alphaB:l,dotTV:R,dotBV:F,dotTL:T,dotBL:P,dotNV:f,dotNL:u}),S=D3e({alphaT:o4,alphaB:l,dotNH:d,dotTH:I,dotBH:D})}else w=ase({alpha:l,dotNL:u,dotNV:f}),S=lse({alpha:l,dotNH:d});return y.mul(w).mul(S)}),N3e=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),lf=null,vS=me(({roughness:i,dotNV:e})=>{lf===null&&(lf=new HA(N3e,16,16,Ws,Wi),lf.name="DFG_LUT",lf.minFilter=Mi,lf.magFilter=Mi,lf.wrapS=la,lf.wrapT=la,lf.generateMipmaps=!1,lf.needsUpdate=!0);let t=dt(i,e);return fi(lf,t).rg}),F3e=me(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o})=>{let a=_V({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o}),l=hi.dot(i).clamp(),c=hi.dot(er).clamp(),u=vS({roughness:n,dotNV:c}),f=vS({roughness:n,dotNV:l}),d=e.mul(u.x).add(t.mul(u.y)),A=e.mul(f.x).add(t.mul(f.y)),y=u.x.add(u.y),w=f.x.add(f.y),S=oe(1).sub(y),T=oe(1).sub(w),R=e.add(e.oneMinus().mul(.047619)),I=d.mul(A).mul(R).div(oe(1).sub(S.mul(T).mul(R).mul(R)).add(yP)),P=S.mul(T),F=I.mul(P);return a.add(F)}),cse=me(i=>{let{dotNV:e,specularColor:t,specularF90:n,roughness:r}=i,s=vS({dotNV:e,roughness:r});return t.mul(s.x).add(n.mul(s.y))}),R7=me(({f:i,f90:e,dotVH:t})=>{let n=t.oneMinus().saturate(),r=n.mul(n),s=n.mul(r,r).clamp(0,.9999);return i.sub(pe(e).mul(s)).div(s.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),B3e=me(({roughness:i,dotNH:e})=>{let t=i.pow2(),n=oe(1).div(t),s=e.pow2().oneMinus().max(.0078125);return oe(2).add(n).mul(s.pow(n.mul(.5))).div(2*Math.PI)}).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),O3e=me(({dotNV:i,dotNL:e})=>oe(1).div(oe(4).mul(e.add(i).sub(e.mul(i))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),U3e=me(({lightDirection:i})=>{let e=i.add(er).normalize(),t=hi.dot(i).clamp(),n=hi.dot(er).clamp(),r=hi.dot(e).clamp(),s=B3e({roughness:am,dotNH:r}),o=O3e({dotNV:n,dotNL:t});return cc.mul(s).mul(o)}),Zee=me(({N:i,V:e,roughness:t})=>{let s=.0078125,o=i.dot(e).saturate(),a=dt(t,o.oneMinus().sqrt());return a.assign(a.mul(.984375).add(s)),a}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),k3e=me(({f:i})=>{let e=i.length();return zr(e.mul(e).add(i.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),_R=me(({v1:i,v2:e})=>{let t=i.dot(e),n=t.abs().toVar(),r=n.mul(.0145206).add(.4965155).mul(n).add(.8543985).toVar(),s=n.add(4.1616724).mul(n).add(3.417594).toVar(),o=r.div(s),a=t.greaterThan(0).select(o,zr(t.mul(t).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(o));return i.cross(e).mul(a)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),jO=me(({N:i,V:e,P:t,mInv:n,p0:r,p1:s,p2:o,p3:a})=>{let l=s.sub(r).toVar(),c=a.sub(r).toVar(),u=l.cross(c),f=pe().toVar();return $t(u.dot(t.sub(r)).greaterThanEqual(0),()=>{let d=e.sub(i.mul(e.dot(i))).normalize(),A=i.cross(d).negate(),y=n.mul(To(d,A,i).transpose()).toVar(),w=y.mul(r.sub(t)).normalize().toVar(),S=y.mul(s.sub(t)).normalize().toVar(),T=y.mul(o.sub(t)).normalize().toVar(),R=y.mul(a.sub(t)).normalize().toVar(),I=pe(0).toVar();I.addAssign(_R({v1:w,v2:S})),I.addAssign(_R({v1:S,v2:T})),I.addAssign(_R({v1:T,v2:R})),I.addAssign(_R({v1:R,v2:w})),f.assign(pe(k3e({f:I})))}),f}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]});var NP=1/6,use=i=>Tn(NP,Tn(i,Tn(i,i.negate().add(3)).sub(3)).add(1)),P7=i=>Tn(NP,Tn(i,Tn(i,Tn(3,i).sub(6))).add(4)),hse=i=>Tn(NP,Tn(i,Tn(i,Tn(-3,i).add(3)).add(3)).add(1)),I7=i=>Tn(NP,eu(i,3)),Kee=i=>use(i).add(P7(i)),Qee=i=>hse(i).add(I7(i)),Jee=i=>Ps(-1,P7(i).div(use(i).add(P7(i)))),ete=i=>Ps(1,I7(i).div(hse(i).add(I7(i)))),tte=(i,e,t)=>{let n=i.uvNode,r=Tn(n,e.zw).add(.5),s=gf(r),o=$u(r),a=Kee(o.x),l=Qee(o.x),c=Jee(o.x),u=ete(o.x),f=Jee(o.y),d=ete(o.y),A=dt(s.x.add(c),s.y.add(f)).sub(.5).mul(e.xy),y=dt(s.x.add(u),s.y.add(f)).sub(.5).mul(e.xy),w=dt(s.x.add(c),s.y.add(d)).sub(.5).mul(e.xy),S=dt(s.x.add(u),s.y.add(d)).sub(.5).mul(e.xy),T=Kee(o.y).mul(Ps(a.mul(i.sample(A).level(t)),l.mul(i.sample(y).level(t)))),R=Qee(o.y).mul(Ps(a.mul(i.sample(w).level(t)),l.mul(i.sample(S).level(t))));return T.add(R)},xV=me(([i,e])=>{let t=dt(i.size(de(e))),n=dt(i.size(de(e.add(1)))),r=pc(1,t),s=pc(1,n),o=tte(i,Ft(r,t),gf(e)),a=tte(i,Ft(s,n),wP(e));return $u(e).mix(o,a)}),z3e=me(([i,e])=>{let t=e.mul(Xz(i));return xV(i,t)}),nte=me(([i,e,t,n,r])=>{let s=pe(Bz(e.negate(),ya(i),pc(1,n))),o=pe(vf(r[0].xyz),vf(r[1].xyz),vf(r[2].xyz));return ya(s).mul(t.mul(o))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),V3e=me(([i,e])=>i.mul(Yu(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),G3e=dV(),q3e=Qre(),ite=me(([i,e,t],{material:n})=>{let s=(n.side===mi?G3e:q3e).sample(i),o=Af(t1.x).mul(V3e(e,t));return xV(s,o)}),rte=me(([i,e,t])=>($t(t.notEqual(0),()=>{let n=bP(e).negate().div(t);return wz(n.negate().mul(i))}),pe(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),H3e=me(([i,e,t,n,r,s,o,a,l,c,u,f,d,A,y])=>{let w,S;if(y){w=Ft().toVar(),S=pe().toVar();let F=u.sub(1).mul(y.mul(.025)),D=pe(u.sub(F),u,u.add(F));Oi({start:0,end:3},({i:L})=>{let C=D.element(L),B=nte(i,e,f,C,a),k=o.add(B),z=c.mul(l.mul(Ft(k,1))),G=dt(z.xy.div(z.w)).toVar();G.addAssign(1),G.divAssign(2),G.assign(dt(G.x,G.y.oneMinus()));let W=ite(G,t,C);w.element(L).assign(W.element(L)),w.a.addAssign(W.a),S.element(L).assign(n.element(L).mul(rte(vf(B),d,A).element(L)))}),w.a.divAssign(3)}else{let F=nte(i,e,f,u,a),D=o.add(F),L=c.mul(l.mul(Ft(D,1))),C=dt(L.xy.div(L.w)).toVar();C.addAssign(1),C.divAssign(2),C.assign(dt(C.x,C.y.oneMinus())),w=ite(C,t,u),S=n.mul(rte(vf(F),d,A))}let T=S.rgb.mul(w.rgb),R=i.dot(e).clamp(),I=pe(cse({dotNV:R,specularColor:r,specularF90:s,roughness:t})),P=S.r.add(S.g,S.b).div(3);return Ft(I.oneMinus().mul(T),w.a.oneMinus().mul(P).oneMinus())}),W3e=To(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),j3e=i=>{let e=i.sqrt();return pe(1).add(e).div(pe(1).sub(e))},ste=(i,e)=>i.sub(e).div(i.add(e)).pow2(),X3e=(i,e)=>{let t=i.mul(2*Math.PI*1e-9),n=pe(54856e-17,44201e-17,52481e-17),r=pe(1681e3,1795300,2208400),s=pe(43278e5,93046e5,66121e5),o=oe(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(t.mul(2239900).add(e.x).cos()).mul(t.pow2().mul(-45282e5).exp()),a=n.mul(s.mul(2*Math.PI).sqrt()).mul(r.mul(t).add(e).cos()).mul(t.pow2().negate().mul(s).exp());return a=pe(a.x.add(o),a.y,a.z).div(10685e-11),W3e.mul(a)},ote=me(({outsideIOR:i,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:r})=>{let s=Qn(i,e,mc(0,.03,n)),a=i.div(s).pow2().mul(t.pow2().oneMinus()).oneMinus();$t(a.lessThan(0),()=>pe(1));let l=a.sqrt(),c=ste(s,i),u=gx({f0:c,f90:1,dotVH:t}),f=u.oneMinus(),d=s.lessThan(i).select(Math.PI,0),A=oe(Math.PI).sub(d),y=j3e(r.clamp(0,.9999)),w=ste(y,s.toVec3()),S=gx({f0:w,f90:1,dotVH:l}),T=pe(y.x.lessThan(s).select(Math.PI,0),y.y.lessThan(s).select(Math.PI,0),y.z.lessThan(s).select(Math.PI,0)),R=s.mul(n,l,2),I=pe(A).add(T),P=u.mul(S).clamp(1e-5,.9999),F=P.sqrt(),D=f.pow2().mul(S).div(pe(1).sub(P)),C=u.add(D).toVar(),B=D.sub(f).toVar();return Oi({start:1,end:2,condition:"<=",name:"m"},({m:k})=>{B.mulAssign(F);let z=X3e(oe(k).mul(R),oe(k).mul(I)).mul(2);C.addAssign(B.mul(z))}),C.max(pe(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),Uw=me(({normal:i,viewDir:e,roughness:t})=>{let n=i.dot(e).saturate(),r=t.mul(t),s=t.add(.1).reciprocal(),o=oe(-1.9362).add(t.mul(1.0678)).add(r.mul(.4573)).sub(s.mul(.8469)),a=oe(-.6014).add(t.mul(.5538)).sub(r.mul(.467)).sub(s.mul(.1255));return o.mul(n).add(a).exp().saturate()}),kw=pe(.04),xR=oe(1),S4=class extends Ax{constructor(e=!1,t=!1,n=!1,r=!1,s=!1,o=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=n,this.anisotropy=r,this.transmission=s,this.dispersion=o,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null,this.iridescenceF0Dielectric=null,this.iridescenceF0Metallic=null}start(e){if(this.clearcoat===!0&&(this.clearcoatRadiance=pe().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=pe().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=pe().toVar("clearcoatSpecularIndirect")),this.sheen===!0&&(this.sheenSpecularDirect=pe().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=pe().toVar("sheenSpecularIndirect")),this.iridescence===!0){let t=hi.dot(er).clamp(),n=ote({outsideIOR:oe(1),eta2:r4,cosTheta1:t,thinFilmThickness:s4,baseF0:gm}),r=ote({outsideIOR:oe(1),eta2:r4,cosTheta1:t,thinFilmThickness:s4,baseF0:Bi.rgb});this.iridescenceFresnel=Qn(n,r,Yd),this.iridescenceF0Dielectric=R7({f:n,f90:1,dotVH:t}),this.iridescenceF0Metallic=R7({f:r,f90:1,dotVH:t}),this.iridescenceF0=Qn(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,Yd)}if(this.transmission===!0){let t=_f,n=Vie.sub(_f).normalize(),r=Sm,s=e.context;s.backdrop=H3e(r,n,pf,kg,Vg,Gg,t,tu,wm,Ja,sS,vz,xz,_z,this.dispersion?yz:null),s.backdropAlpha=l4,Bi.a.mulAssign(Qn(1,s.backdrop.a,l4))}super.start(e)}computeMultiscattering(e,t,n,r,s=null){let o=hi.dot(er).clamp(),a=vS({roughness:pf,dotNV:o}),l=s?vP.mix(r,s):r,c=l.mul(a.x).add(n.mul(a.y)),f=a.x.add(a.y).oneMinus(),d=l.add(l.oneMinus().mul(.047619)),A=c.mul(d).div(f.mul(d).oneMinus());e.addAssign(c),t.addAssign(A.mul(f))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=hi.dot(e).clamp().mul(t).toVar();if(this.sheen===!0){this.sheenSpecularDirect.addAssign(s.mul(U3e({lightDirection:e})));let o=Uw({normal:hi,viewDir:er,roughness:am}),a=Uw({normal:hi,viewDir:e,roughness:am}),l=cc.r.max(cc.g).max(cc.b).mul(o.max(a)).oneMinus();s.mulAssign(l)}if(this.clearcoat===!0){let a=um.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(a.mul(_V({lightDirection:e,f0:kw,f90:xR,roughness:sx,normalView:um})))}n.directDiffuse.addAssign(s.mul(i1({diffuseColor:kg}))),n.directSpecular.addAssign(s.mul(F3e({lightDirection:e,f0:Vg,f90:1,roughness:pf,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:n,halfHeight:r,reflectedLight:s,ltc_1:o,ltc_2:a}){let l=t.add(n).sub(r),c=t.sub(n).sub(r),u=t.sub(n).add(r),f=t.add(n).add(r),d=hi,A=er,y=xs.toVar(),w=Zee({N:d,V:A,roughness:pf}),S=o.sample(w).toVar(),T=a.sample(w).toVar(),R=To(pe(S.x,0,S.y),pe(0,1,0),pe(S.z,0,S.w)).toVar(),I=Vg.mul(T.x).add(Gg.sub(Vg).mul(T.y)).toVar();if(s.directSpecular.addAssign(e.mul(I).mul(jO({N:d,V:A,P:y,mInv:R,p0:l,p1:c,p2:u,p3:f}))),s.directDiffuse.addAssign(e.mul(kg).mul(jO({N:d,V:A,P:y,mInv:To(1,0,0,0,1,0,0,0,1),p0:l,p1:c,p2:u,p3:f}))),this.clearcoat===!0){let P=um,F=Zee({N:P,V:A,roughness:sx}),D=o.sample(F),L=a.sample(F),C=To(pe(D.x,0,D.y),pe(0,1,0),pe(D.z,0,D.w)),B=kw.mul(L.x).add(xR.sub(kw).mul(L.y));this.clearcoatSpecularDirect.addAssign(e.mul(B).mul(jO({N:P,V:A,P:y,mInv:C,p0:l,p1:c,p2:u,p3:f})))}}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e),this.ambientOcclusion(e)}indirectDiffuse(e){let{irradiance:t,reflectedLight:n}=e.context,r=t.mul(i1({diffuseColor:kg})).toVar();if(this.sheen===!0){let s=Uw({normal:hi,viewDir:er,roughness:am}),o=cc.r.max(cc.g).max(cc.b).mul(s).oneMinus();r.mulAssign(o)}n.indirectDiffuse.addAssign(r)}indirectSpecular(e){let{radiance:t,iblIrradiance:n,reflectedLight:r}=e.context;if(this.sheen===!0&&this.sheenSpecularIndirect.addAssign(n.mul(cc,Uw({normal:hi,viewDir:er,roughness:am}))),this.clearcoat===!0){let S=um.dot(er).clamp(),T=cse({dotNV:S,specularColor:kw,specularF90:xR,roughness:sx});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(T))}let s=pe().toVar("singleScatteringDielectric"),o=pe().toVar("multiScatteringDielectric"),a=pe().toVar("singleScatteringMetallic"),l=pe().toVar("multiScatteringMetallic");this.computeMultiscattering(s,o,Gg,gm,this.iridescenceF0Dielectric),this.computeMultiscattering(a,l,Gg,Bi.rgb,this.iridescenceF0Metallic);let c=Qn(s,a,Yd),u=Qn(o,l,Yd),f=s.add(o),d=kg.mul(f.oneMinus()),A=n.mul(1/Math.PI),y=t.mul(c).add(u.mul(A)).toVar(),w=d.mul(A).toVar();if(this.sheen===!0){let S=Uw({normal:hi,viewDir:er,roughness:am}),T=cc.r.max(cc.g).max(cc.b).mul(S).oneMinus();y.mulAssign(T),w.mulAssign(T)}r.indirectSpecular.addAssign(y),r.indirectDiffuse.addAssign(w)}ambientOcclusion(e){let{ambientOcclusion:t,reflectedLight:n}=e.context,s=hi.dot(er).clamp().add(t),o=pf.mul(-16).oneMinus().negate().exp2(),a=t.sub(s.pow(o).oneMinus()).clamp();this.clearcoat===!0&&this.clearcoatSpecularIndirect.mulAssign(t),this.sheen===!0&&this.sheenSpecularIndirect.mulAssign(t),n.indirectDiffuse.mulAssign(t),n.indirectSpecular.mulAssign(a)}finish({context:e}){let{outgoingLight:t}=e;if(this.clearcoat===!0){let n=um.dot(er).clamp(),r=gx({dotVH:n,f0:kw,f90:xR}),s=t.mul(i4.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(i4));t.assign(s)}if(this.sheen===!0){let n=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(n)}}},ate=oe(1),L7=oe(-2),yR=oe(.8),XO=oe(-1),bR=oe(.4),$O=oe(2),wR=oe(.305),YO=oe(3),lte=oe(.21),$3e=oe(4),cte=oe(4),Y3e=oe(16),Z3e=me(([i])=>{let e=pe(fr(i)).toVar(),t=oe(-1).toVar();return $t(e.x.greaterThan(e.z),()=>{$t(e.x.greaterThan(e.y),()=>{t.assign(xa(i.x.greaterThan(0),0,3))}).Else(()=>{t.assign(xa(i.y.greaterThan(0),1,4))})}).Else(()=>{$t(e.z.greaterThan(e.y),()=>{t.assign(xa(i.z.greaterThan(0),2,5))}).Else(()=>{t.assign(xa(i.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),K3e=me(([i,e])=>{let t=dt().toVar();return $t(e.equal(0),()=>{t.assign(dt(i.z,i.y).div(fr(i.x)))}).ElseIf(e.equal(1),()=>{t.assign(dt(i.x.negate(),i.z.negate()).div(fr(i.y)))}).ElseIf(e.equal(2),()=>{t.assign(dt(i.x.negate(),i.y).div(fr(i.z)))}).ElseIf(e.equal(3),()=>{t.assign(dt(i.z.negate(),i.y).div(fr(i.x)))}).ElseIf(e.equal(4),()=>{t.assign(dt(i.x.negate(),i.z).div(fr(i.y)))}).Else(()=>{t.assign(dt(i.x,i.y).div(fr(i.z)))}),Tn(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),Q3e=me(([i])=>{let e=oe(0).toVar();return $t(i.greaterThanEqual(yR),()=>{e.assign(ate.sub(i).mul(XO.sub(L7)).div(ate.sub(yR)).add(L7))}).ElseIf(i.greaterThanEqual(bR),()=>{e.assign(yR.sub(i).mul($O.sub(XO)).div(yR.sub(bR)).add(XO))}).ElseIf(i.greaterThanEqual(wR),()=>{e.assign(bR.sub(i).mul(YO.sub($O)).div(bR.sub(wR)).add($O))}).ElseIf(i.greaterThanEqual(lte),()=>{e.assign(wR.sub(i).mul($3e.sub(YO)).div(wR.sub(lte)).add(YO))}).Else(()=>{e.assign(oe(-2).mul(Af(Tn(1.16,i))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),fse=me(([i,e])=>{let t=i.toVar();t.assign(Tn(2,t).sub(1));let n=pe(t,1).toVar();return $t(e.equal(0),()=>{n.assign(n.zyx)}).ElseIf(e.equal(1),()=>{n.assign(n.xzy),n.xz.mulAssign(-1)}).ElseIf(e.equal(2),()=>{n.x.mulAssign(-1)}).ElseIf(e.equal(3),()=>{n.assign(n.zyx),n.xz.mulAssign(-1)}).ElseIf(e.equal(4),()=>{n.assign(n.xzy),n.xy.mulAssign(-1)}).ElseIf(e.equal(5),()=>{n.z.mulAssign(-1)}),n}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),dse=me(([i,e,t,n,r,s])=>{let o=oe(t),a=pe(e),l=Yu(Q3e(o),L7,s),c=$u(l),u=gf(l),f=pe(_S(i,a,u,n,r,s)).toVar();return $t(c.notEqual(0),()=>{let d=pe(_S(i,a,u.add(1),n,r,s)).toVar();f.assign(Qn(f,d,c))}),f}),_S=me(([i,e,t,n,r,s])=>{let o=oe(t).toVar(),a=pe(e),l=oe(Z3e(a)).toVar(),c=oe(zr(cte.sub(o),0)).toVar();o.assign(zr(o,cte));let u=oe(fx(o)).toVar(),f=dt(K3e(a,l).mul(u.sub(2)).add(1)).toVar();return $t(l.greaterThan(2),()=>{f.y.addAssign(u),l.subAssign(3)}),f.x.addAssign(l.mul(u)),f.x.addAssign(c.mul(Tn(3,Y3e))),f.y.addAssign(Tn(4,fx(s).sub(u))),f.x.mulAssign(n),f.y.mulAssign(r),i.sample(f).grad(dt(),dt())}),ZO=me(({envMap:i,mipInt:e,outputDirection:t,theta:n,axis:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{let l=Hu(n),c=t.mul(l).add(r.cross(t).mul(Ka(n))).add(r.mul(r.dot(t).mul(l.oneMinus())));return _S(i,c,e,s,o,a)}),pse=me(({n:i,latitudinal:e,poleAxis:t,outputDirection:n,weights:r,samples:s,dTheta:o,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f})=>{let d=pe(xa(e,t,Kd(t,n))).toVar();$t(d.equal(pe(0)),()=>{d.assign(pe(n.z,0,n.x.negate()))}),d.assign(ya(d));let A=pe().toVar();return A.addAssign(r.element(0).mul(ZO({theta:0,axis:d,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),Oi({start:de(1),end:i},({i:y})=>{$t(y.greaterThanEqual(s),()=>{Yre()});let w=oe(o.mul(oe(y))).toVar();A.addAssign(r.element(y).mul(ZO({theta:w.mul(-1),axis:d,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),A.addAssign(r.element(y).mul(ZO({theta:w,axis:d,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f})))}),Ft(A,1)}),J3e=me(([i])=>{let e=rt(i).toVar();return e.assign(e.shiftLeft(rt(16)).bitOr(e.shiftRight(rt(16)))),e.assign(e.bitAnd(rt(1431655765)).shiftLeft(rt(1)).bitOr(e.bitAnd(rt(2863311530)).shiftRight(rt(1)))),e.assign(e.bitAnd(rt(858993459)).shiftLeft(rt(2)).bitOr(e.bitAnd(rt(3435973836)).shiftRight(rt(2)))),e.assign(e.bitAnd(rt(252645135)).shiftLeft(rt(4)).bitOr(e.bitAnd(rt(4042322160)).shiftRight(rt(4)))),e.assign(e.bitAnd(rt(16711935)).shiftLeft(rt(8)).bitOr(e.bitAnd(rt(4278255360)).shiftRight(rt(8)))),oe(e).mul(23283064365386963e-26)}),eMe=me(([i,e])=>dt(oe(i).div(oe(e)),J3e(i))),tMe=me(([i,e,t])=>{let n=t.mul(t).toConst(),r=pe(1,0,0).toConst(),s=Kd(e,r).toConst(),o=el(i.x).toConst(),a=Tn(2,3.14159265359).mul(i.y).toConst(),l=o.mul(Hu(a)).toConst(),c=o.mul(Ka(a)).toVar(),u=Tn(.5,e.z.add(1)).toConst();c.assign(u.oneMinus().mul(el(l.mul(l).oneMinus())).add(u.mul(c)));let f=r.mul(l).add(s.mul(c)).add(e.mul(el(zr(0,l.mul(l).add(c.mul(c)).oneMinus()))));return ya(pe(n.mul(f.x),n.mul(f.y),zr(0,f.z)))}),mse=me(({roughness:i,mipInt:e,envMap:t,N_immutable:n,GGX_SAMPLES:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{let l=pe(n).toVar(),c=pe(0).toVar(),u=oe(0).toVar();return $t(i.lessThan(.001),()=>{c.assign(_S(t,l,e,s,o,a))}).Else(()=>{let f=xa(fr(l.z).lessThan(.999),pe(0,0,1),pe(1,0,0)),d=ya(Kd(f,l)).toVar(),A=Kd(l,d).toVar();Oi({start:rt(0),end:r},({i:y})=>{let w=eMe(y,r),S=tMe(w,pe(0,0,1),i),T=ya(d.mul(S.x).add(A.mul(S.y)).add(l.mul(S.z))),R=ya(T.mul(ru(l,T).mul(2)).sub(l)),I=zr(ru(l,R),0);$t(I.greaterThan(0),()=>{let P=_S(t,R,e,s,o,a);c.addAssign(P.mul(I)),u.addAssign(I)})}),$t(u.greaterThan(0),()=>{c.assign(c.div(u))})}),Ft(c,1)}),dm=4,ute=[.125,.215,.35,.446,.526,.582],zg=20,nMe=512,zw=new Du(-1,1,1,-1,0,1),iMe=new Yr(90,1),hte=new zt,KO=null,QO=0,JO=0,rMe=new re,T4=new WeakMap,sMe=[3,1,5,0,4,2],eU=fse(Ui(),fc("faceIndex")).normalize(),FP=pe(eU.x,eU.y,eU.z),D7=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._ggxMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,n=.1,r=100,s={}){let{size:o=256,position:a=rMe,renderTarget:l=null}=s;if(this._setSize(o),this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromScene() called before the backend is initialized. Use "await renderer.init();" before using this method.');KO=this._renderer.getRenderTarget(),QO=this._renderer.getActiveCubeFace(),JO=this._renderer.getActiveMipmapLevel();let c=l||this._allocateTarget(!0);return this._init(c),this._sceneToCubeUV(e,n,r,c,a),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}async fromSceneAsync(e,t=0,n=.1,r=100,s={}){return ni('PMREMGenerator: ".fromSceneAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this.fromScene(e,t,n,r,s)}fromEquirectangular(e,t=null){if(this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return ni('PMREMGenerator: ".fromEquirectangularAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromCubemap() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return ni('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=dte(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=pte(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===ec||e.mapping===Gc?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(KO,QO,JO),e.scissorTest=!1,this._setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),KO=this._renderer.getRenderTarget(),QO=this._renderer.getActiveCubeFace(),JO=this._renderer.getActiveMipmapLevel();let n=t||this._allocateTarget(!1);return this._init(n),this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTarget(e){let t=3*Math.max(this._cubeSize,112),n=4*this._cubeSize;return fte(t,n,e)}_init(e){if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e.width||this._pingPongRenderTarget.height!==e.height){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=fte(e.width,e.height);let{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=oMe(t)),this._blurMaterial=aMe(t,e.width,e.height),this._ggxMaterial=lMe(t,e.width,e.height)}}async _compileMaterial(e){let t=new Hn(new Xn,e);await this._renderer.compile(t,zw)}_sceneToCubeUV(e,t,n,r,s){let o=iMe;o.near=t,o.far=n;let a=[1,1,1,1,-1,1],l=[1,-1,1,-1,1,-1],c=this._renderer,u=c.autoClear;c.getClearColor(hte),c.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new Hn(new Lu,new fs({name:"PMREM.Background",side:mi,depthWrite:!1,depthTest:!1})));let f=this._backgroundBox,d=f.material,A=!1,y=e.background;y?y.isColor&&(d.color.copy(y),e.background=null,A=!0):(d.color.copy(hte),A=!0),c.setRenderTarget(r),c.clear(),A&&c.render(f,o);for(let w=0;w<6;w++){let S=w%3;S===0?(o.up.set(0,a[w],0),o.position.set(s.x,s.y,s.z),o.lookAt(s.x+l[w],s.y,s.z)):S===1?(o.up.set(0,0,a[w]),o.position.set(s.x,s.y,s.z),o.lookAt(s.x,s.y+l[w],s.z)):(o.up.set(0,a[w],0),o.position.set(s.x,s.y,s.z),o.lookAt(s.x,s.y,s.z+l[w]));let T=this._cubeSize;this._setViewport(r,S*T,w>2?T:0,T,T),c.render(e,o)}c.autoClear=u,e.background=y}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===ec||e.mapping===Gc;r?this._cubemapMaterial===null&&(this._cubemapMaterial=dte(e)):this._equirectMaterial===null&&(this._equirectMaterial=pte(e));let s=r?this._cubemapMaterial:this._equirectMaterial;s.fragmentNode.value=e;let o=this._lodMeshes[0];o.material=s;let a=this._cubeSize;this._setViewport(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(o,zw)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;let l=T4.get(o),c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-u*u),d=0+c*1.25,A=f*d,{_lodMax:y}=this,w=this._sizeLods[n],S=3*w*(n>y-dm?n-y+dm:0),T=4*(this._cubeSize-w);e.texture.frame=(e.texture.frame||0)+1,l.envMap.value=e.texture,l.roughness.value=A,l.mipInt.value=y-t,this._setViewport(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,zw),s.texture.frame=(s.texture.frame||0)+1,l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=y-n,this._setViewport(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,zw)}_blur(e,t,n,r,s){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,o,a){let l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&ze("blur direction must be either latitudinal or longitudinal!");let u=3,f=this._lodMeshes[r];f.material=c;let d=T4.get(c),A=this._sizeLods[n]-1,y=isFinite(s)?Math.PI/(2*A):2*Math.PI/(2*zg-1),w=s/y,S=isFinite(s)?1+Math.floor(u*w):zg;S>zg&&Xe(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${zg}`);let T=[],R=0;for(let L=0;L<zg;++L){let C=L/w,B=Math.exp(-C*C/2);T.push(B),L===0?R+=B:L<S&&(R+=2*B)}for(let L=0;L<T.length;L++)T[L]=T[L]/R;e.texture.frame=(e.texture.frame||0)+1,d.envMap.value=e.texture,d.samples.value=S,d.weights.array=T,d.latitudinal.value=o==="latitudinal"?1:0,a&&(d.poleAxis.value=a);let{_lodMax:I}=this;d.dTheta.value=y,d.mipInt.value=I-n;let P=this._sizeLods[r],F=3*P*(r>I-dm?r-I+dm:0),D=4*(this._cubeSize-P);this._setViewport(t,F,D,3*P,2*P),l.setRenderTarget(t),l.render(f,zw)}_setViewport(e,t,n,r,s){this._renderer.isWebGLRenderer?(e.viewport.set(t,e.height-s-n,r,s),e.scissor.set(t,e.height-s-n,r,s)):(e.viewport.set(t,n,r,s),e.scissor.set(t,n,r,s))}};function oMe(i){let e=[],t=[],n=[],r=i,s=i-dm+1+ute.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-dm?l=ute[o-i+dm-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),u=-c,f=1+c,d=[u,u,f,u,f,f,u,u,f,f,u,f],A=6,y=6,w=3,S=2,T=1,R=new Float32Array(w*y*A),I=new Float32Array(S*y*A),P=new Float32Array(T*y*A);for(let D=0;D<A;D++){let L=D%3*2/3-1,C=D>2?0:-1,B=[L,C,0,L+2/3,C,0,L+2/3,C+1,0,L,C,0,L+2/3,C+1,0,L,C+1,0],k=sMe[D];R.set(B,w*y*k),I.set(d,S*y*k);let z=[k,k,k,k,k,k];P.set(z,T*y*k)}let F=new Xn;F.setAttribute("position",new Hi(R,w)),F.setAttribute("uv",new Hi(I,S)),F.setAttribute("faceIndex",new Hi(P,T)),n.push(new Hn(F,null)),r>dm&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function fte(i,e,t){let n={magFilter:Mi,minFilter:Mi,generateMipmaps:!1,type:Wi,format:Or,colorSpace:t0,depthBuffer:t},r=new Ba(i,e,n);return r.texture.mapping=Bh,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function BP(i){let e=new Pr;return e.depthTest=!1,e.depthWrite=!1,e.blending=ps,e.name=`PMREM_${i}`,e}function aMe(i,e,t){let n=$o(new Array(zg).fill(0)),r=Xt(new re(0,1,0)),s=Xt(0),o=oe(zg),a=Xt(0),l=Xt(1),c=fi(),u=Xt(0),f=oe(1/e),d=oe(1/t),A=oe(i),y={n:o,latitudinal:a,weights:n,poleAxis:r,outputDirection:FP,dTheta:s,samples:l,envMap:c,mipInt:u,CUBEUV_TEXEL_WIDTH:f,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:A},w=BP("blur");return w.fragmentNode=pse({...y,latitudinal:a.equal(1)}),T4.set(w,y),w}function lMe(i,e,t){let n=fi(),r=Xt(0),s=Xt(0),o=oe(1/e),a=oe(1/t),l=oe(i),c={envMap:n,roughness:r,mipInt:s,CUBEUV_TEXEL_WIDTH:o,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:l},u=BP("ggx");return u.fragmentNode=mse({...c,N_immutable:FP,GGX_SAMPLES:rt(nMe)}),T4.set(u,c),u}function dte(i){let e=BP("cubemap");return e.fragmentNode=Qa(i,FP),e}function pte(i){let e=BP("equirect");return e.fragmentNode=fi(i,gV(FP),0),e}var mte=new WeakMap;function cMe(i){let e=Math.log2(i)-2,t=1/i;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:t,maxMip:e}}function uMe(i,e,t){let n=hMe(e),r=n.get(i);if((r!==void 0?r.pmremVersion:-1)!==i.pmremVersion){let o=i.image;if(i.isCubeTexture)if(fMe(o))r=t.fromCubemap(i,r);else return null;else if(dMe(o))r=t.fromEquirectangular(i,r);else return null;if(r.pmremVersion=i.pmremVersion,n.has(i)===!1){let a=()=>{i.removeEventListener("dispose",a);let l=n.get(i);l!==void 0&&(l.dispose(),n.delete(i))};i.addEventListener("dispose",a)}n.set(i,r)}return r.texture}function hMe(i){let e=mte.get(i);return e===void 0&&(e=new WeakMap,mte.set(i,e)),e}var N7=class extends Rr{static get type(){return"PMREMNode"}constructor(e,t=null,n=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=n,this._generator=null;let r=new qs;r.isRenderTargetTexture=!0,this._texture=fi(r),this._width=Xt(0),this._height=Xt(0),this._maxMip=Xt(0),this.updateBeforeType=yn.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){let t=cMe(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(e){let t=this._pmrem,n=t?t.pmremVersion:-1,r=this._value;n!==r.pmremVersion&&(r.isPMREMTexture===!0||r.mapping===Bh?t=r:t=uMe(r,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new D7(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=this._pmrem.isRenderTargetTexture?A4.mul(pe(t.x,t.y.negate(),t.z)):A4.mul(t);let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),dse(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}};function fMe(i){if(i==null)return!1;let e=0,t=6;for(let n=0;n<t;n++)i[n]!==void 0&&e++;return e===t}function dMe(i){return i==null?!1:i.height>0}var yV=$n(N7).setParameterLength(1,3),Ate=new WeakMap,F7=class extends _m{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){let{material:t}=e,n=this.envNode;if(n.isTextureNode||n.isMaterialReferenceNode){let f=n.isTextureNode?n.value:t[n.property],d=this._getPMREMNodeCache(e.renderer),A=d.get(f);A===void 0&&(A=yV(f),d.set(f,A)),n=A}let s=t.useAnisotropy===!0||t.anisotropy>0?hre:hi,o=n.context(gte(pf,s)).mul(ZR),a=n.context(pMe(Sm)).mul(Math.PI).mul(ZR),l=lx(o),c=lx(a);e.context.radiance.addAssign(l),e.context.iblIrradiance.addAssign(c);let u=e.context.lightingModel.clearcoatRadiance;if(u){let f=n.context(gte(sx,um)).mul(ZR),d=lx(f);u.addAssign(d)}}_getPMREMNodeCache(e){let t=Ate.get(e);return t===void 0&&(t=new WeakMap,Ate.set(e,t)),t}},gte=(i,e)=>{let t=null;return{getUV:()=>(t===null&&(t=er.negate().reflect(e),t=Nz(i).mix(t,e).normalize(),t=t.transformDirection(DS)),t),getTextureLevel:()=>i}},pMe=i=>({getUV:()=>i,getTextureLevel:()=>oe(1)}),mMe=new s_,E4=class extends Pr{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(mMe),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new F7(t):null}setupLightingModel(){return new S4}setupSpecular(){let e=Qn(pe(.04),Bi.rgb,Yd);gm.assign(pe(.04)),Vg.assign(e),Gg.assign(1)}setupVariants(){let e=this.metalnessNode?oe(this.metalnessNode):xre;Yd.assign(e);let t=this.roughnessNode?oe(this.roughnessNode):_re;t=vV({roughness:t}),pf.assign(t),this.setupSpecular(),kg.assign(Bi.rgb.mul(e.oneMinus()))}},AMe=new Z2,B7=class extends E4{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(AMe),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||this.clearcoatNode!==null}get useIridescence(){return this.iridescence>0||this.iridescenceNode!==null}get useSheen(){return this.sheen>0||this.sheenNode!==null}get useAnisotropy(){return this.anisotropy>0||this.anisotropyNode!==null}get useTransmission(){return this.transmission>0||this.transmissionNode!==null}get useDispersion(){return this.dispersion>0||this.dispersionNode!==null}setupSpecular(){let e=this.iorNode?oe(this.iorNode):Nre;sS.assign(e),gm.assign(Pl(Dz(sS.sub(1).div(sS.add(1))).mul(vre),pe(1)).mul(l7)),Vg.assign(Qn(gm,Bi.rgb,Yd)),Gg.assign(Qn(l7,1,Yd))}setupLightingModel(){return new S4(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){let t=this.clearcoatNode?oe(this.clearcoatNode):bre,n=this.clearcoatRoughnessNode?oe(this.clearcoatRoughnessNode):wre;i4.assign(t),sx.assign(vV({roughness:n}))}if(this.useSheen){let t=this.sheenNode?pe(this.sheenNode):Ere,n=this.sheenRoughnessNode?oe(this.sheenRoughnessNode):Mre;cc.assign(t),am.assign(n)}if(this.useIridescence){let t=this.iridescenceNode?oe(this.iridescenceNode):Rre,n=this.iridescenceIORNode?oe(this.iridescenceIORNode):Pre,r=this.iridescenceThicknessNode?oe(this.iridescenceThicknessNode):Ire;vP.assign(t),r4.assign(n),s4.assign(r)}if(this.useAnisotropy){let t=(this.anisotropyNode?dt(this.anisotropyNode):Cre).toVar();om.assign(t.length()),$t(om.equal(0),()=>{t.assign(dt(1,0))}).Else(()=>{t.divAssign(dt(om)),om.assign(om.saturate())}),o4.assign(om.pow2().mix(pf.pow2(),1)),rS.assign(qg[0].mul(t.x).add(qg[1].mul(t.y))),jg.assign(qg[1].mul(t.x).sub(qg[0].mul(t.y)))}if(this.useTransmission){let t=this.transmissionNode?oe(this.transmissionNode):Lre,n=this.thicknessNode?oe(this.thicknessNode):Dre,r=this.attenuationDistanceNode?oe(this.attenuationDistanceNode):Fre,s=this.attenuationColorNode?pe(this.attenuationColorNode):Bre;if(l4.assign(t),vz.assign(n),_z.assign(r),xz.assign(s),this.useDispersion){let o=this.dispersionNode?oe(this.dispersionNode):Ure;yz.assign(o)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?pe(this.clearcoatNormalNode):Sre}setup(e){e.context.setupClearcoatNormal=()=>$g(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}};var gMe=me(({normal:i,lightDirection:e,builder:t})=>{let n=i.dot(e),r=dt(n.mul(.5).add(.5),0);if(t.material.gradientMap){let s=Xd("gradientMap","texture").context({getUV:()=>r});return pe(s.r)}else{let s=r.fwidth().mul(.5);return Qn(pe(.7),pe(1),mc(oe(.7).sub(s.x),oe(.7).add(s.x),r.x))}}),O7=class extends Ax{direct({lightDirection:e,lightColor:t,reflectedLight:n},r){let s=gMe({normal:CP,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(s.mul(i1({diffuseColor:Bi.rgb})))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(i1({diffuseColor:Bi}))),r.indirectDiffuse.mulAssign(t)}},vMe=new K2,U7=class extends Pr{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(vMe),this.setValues(e)}setupLightingModel(){return new O7}},Ase=me(()=>{let i=pe(er.z,0,er.x.negate()).normalize(),e=er.cross(i);return dt(i.dot(hi),e.dot(hi)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),_Me=new J2,k7=class extends Pr{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(_Me),this.setValues(e)}setupVariants(e){let t=Ase,n;e.material.matcap?n=Xd("matcap","texture").context({getUV:()=>t}):n=pe(Qn(.2,.8,t.y)),Bi.rgb.mulAssign(n.rgb)}},z7=class extends Rr{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}generateNodeType(e){return this.positionNode.getNodeType(e)}setup(e){let{rotationNode:t,positionNode:n}=this;if(this.getNodeType(e)==="vec2"){let s=t.cos(),o=t.sin();return gP(s,o,o.negate(),s).mul(n)}else{let s=t,o=pm(Ft(1,0,0,0),Ft(0,Hu(s.x),Ka(s.x).negate(),0),Ft(0,Ka(s.x),Hu(s.x),0),Ft(0,0,0,1)),a=pm(Ft(Hu(s.y),0,Ka(s.y),0),Ft(0,1,0,0),Ft(Ka(s.y).negate(),0,Hu(s.y),0),Ft(0,0,0,1)),l=pm(Ft(Hu(s.z),Ka(s.z).negate(),0,0),Ft(Ka(s.z),Hu(s.z),0,0),Ft(0,0,1,0),Ft(0,0,0,1));return o.mul(a).mul(l).mul(Ft(n,1)).xyz}}},FS=$n(z7).setParameterLength(2),xMe=new Rh,M4=class extends Pr{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.transparent=!0,this.setDefaultValues(xMe),this.setValues(e)}setupPositionView(e){let{object:t,camera:n}=e,{positionNode:r,rotationNode:s,scaleNode:o,sizeAttenuation:a}=this,l=bf.mul(pe(r||0)),c=dt(tu[0].xyz.length(),tu[1].xyz.length());o!==null&&(c=c.mul(dt(o))),n.isPerspectiveCamera&&a===!1&&(c=c.mul(l.z.negate()));let u=va.xy;if(t.center&&t.center.isVector2===!0){let A=lEe("center","vec2",t);u=u.sub(A.sub(.5))}u=u.mul(c);let f=oe(s||Tre),d=FS(u,f);return Ft(l.xy.add(d),l.zw)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}},yMe=new a0,bMe=new Oe,V7=class extends M4{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(yMe),this.setValues(e)}setupPositionView(){let{positionNode:e}=this;return bf.mul(pe(e||Mr)).xyz}setupVertexSprite(e){let{material:t,camera:n}=e,{rotationNode:r,scaleNode:s,sizeNode:o,sizeAttenuation:a}=this,l=super.setupVertex(e);if(t.isNodeMaterial!==!0)return l;let c=o!==null?dt(o):Ore;c=c.mul(Yz),n.isPerspectiveCamera&&a===!0&&(c=c.mul(wMe.div(xs.z.negate()))),s&&s.isNode&&(c=c.mul(dt(s)));let u=va.xy;if(r&&r.isNode){let f=oe(r);u=FS(u,f)}return u=u.mul(c),u=u.div(Zz.div(2)),u=u.mul(l.w),l=l.add(Ft(u,0,0)),l}setupVertex(e){return e.object.isPoints?super.setupVertex(e):this.setupVertexSprite(e)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}},wMe=Xt(1).onFrameUpdate(function({renderer:i}){let e=i.getSize(bMe);this.value=.5*e.y}),G7=class extends Ax{constructor(){super(),this.shadowNode=oe(1).toVar("shadowMask")}direct({lightNode:e}){e.shadowNode!==null&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Bi.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Bi.rgb)}},SMe=new Y2,q7=class extends Pr{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(SMe),this.setValues(e)}setupLightingModel(){return new G7}},blt=Jd("vec3"),wlt=Jd("vec3"),Slt=Jd("vec3");var H7=class{constructor(e,t,n){this.renderer=e,this.nodes=t,this.info=n,this._context=typeof self<"u"?self:null,this._animationLoop=null,this._requestId=null}start(){let e=(t,n)=>{this._requestId=this._context.requestAnimationFrame(e),this.info.autoReset===!0&&this.info.reset(),this.nodes.nodeFrame.update(),this.info.frame=this.nodes.nodeFrame.frameId,this.renderer._inspector.begin(),this._animationLoop!==null&&this._animationLoop(t,n),this.renderer._inspector.finish()};e()}stop(){this._context!==null&&this._context.cancelAnimationFrame(this._requestId),this._requestId=null}getAnimationLoop(){return this._animationLoop}setAnimationLoop(e){this._animationLoop=e}getContext(){return this._context}setContext(e){this._context=e}dispose(){this.stop()}},Sf=class{constructor(){this.weakMaps={}}_getWeakMap(e){let t=e.length,n=this.weakMaps[t];return n===void 0&&(n=new WeakMap,this.weakMaps[t]=n),n}get(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return;return t.get(e[e.length-1])}set(e,t){let n=this._getWeakMap(e);for(let r=0;r<e.length-1;r++){let s=e[r];n.has(s)===!1&&n.set(s,new WeakMap),n=n.get(s)}return n.set(e[e.length-1],t),this}delete(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return!1;return t.delete(e[e.length-1])}},TMe=0,vte=new WeakMap;function EMe(i){let e=Object.keys(i),t=vte.get(i.constructor);if(t===void 0){t=[];let n=Object.getPrototypeOf(i);for(;n;){let r=Object.getOwnPropertyDescriptors(n);for(let s in r){let o=r[s];o&&typeof o.get=="function"&&t.push(s)}n=Object.getPrototypeOf(n)}vte.set(i.constructor,t)}for(let n=0;n<t.length;n++)e.push(t[n]);return e}var W7=class{constructor(e,t,n,r,s,o,a,l,c,u){this.id=TMe++,this._nodes=e,this._geometries=t,this.renderer=n,this.object=r,this.material=s,this.scene=o,this.camera=a,this.lightsNode=l,this.context=c,this.geometry=r.geometry,this.version=s.version,this.drawRange=null,this.attributes=null,this.attributesId=null,this.pipeline=null,this.group=null,this.vertexBuffers=null,this.drawParams=null,this.bundle=null,this.clippingContext=u,this.clippingContextCacheKey=u!==null?u.cacheKey:"",this.initialNodesCacheKey=this.getDynamicCacheKey(),this.initialCacheKey=this.getCacheKey(),this._nodeBuilderState=null,this._bindings=null,this._monitor=null,this._sourceMaterial=n._currentSourceMaterial,this.onDispose=null,this.isRenderObject=!0,this.onMaterialDispose=()=>{this.dispose()},this.onGeometryDispose=()=>{this.attributes=null,this.attributesId=null},this.material.addEventListener("dispose",this.onMaterialDispose),this.geometry.addEventListener("dispose",this.onGeometryDispose),this._sourceMaterial!==null&&this._sourceMaterial.addEventListener("dispose",this.onMaterialDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return this.clippingContext===null||this.clippingContext.cacheKey===this.clippingContextCacheKey?!1:(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return this.getNodeBuilderState().hardwareClipping===!0?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().observer)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getBindingGroup(e){for(let t of this.getBindings())if(t.name===e)return t}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getIndirectOffset(){return this._geometries.getIndirectOffset(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null,this.attributesId=null}getAttributes(){if(this.attributes!==null)return this.attributes;let e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,n=[],r=new Set,s={};for(let o of e){let a;if(o.node&&o.node.attribute?a=o.node.attribute:(a=t.getAttribute(o.name),a!==void 0&&(a.isInterleavedBufferAttribute?s[o.name]=a.data.uuid:s[o.name]=a.id)),a===void 0)continue;n.push(a);let l=a.isInterleavedBufferAttribute?a.data:a;r.add(l)}return this.attributes=n,this.attributesId=s,this.vertexBuffers=Array.from(r.values()),n}getVertexBuffers(){return this.vertexBuffers===null&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){let{object:e,material:t,geometry:n,group:r,drawRange:s}=this,o=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),a=this.getIndex(),l=a!==null,c=1;if(n.isInstancedBufferGeometry===!0?c=n.instanceCount:e.count!==void 0&&(c=Math.max(0,e.count)),c===0)return null;if(o.instanceCount=c,e.isBatchedMesh===!0)return o;let u=1;t.wireframe===!0&&!e.isPoints&&!e.isLineSegments&&!e.isLine&&!e.isLineLoop&&(u=2);let f=s.start*u,d=(s.start+s.count)*u;r!==null&&(f=Math.max(f,r.start*u),d=Math.min(d,(r.start+r.count)*u));let A=n.attributes.position,y=1/0;l?y=a.count:A!=null&&(y=A.count),f=Math.max(f,0),d=Math.min(d,y);let w=d-f;return w<0||w===1/0?null:(o.vertexCount=w,o.firstVertex=f,o)}getGeometryCacheKey(){let{geometry:e}=this,t="";for(let n of Object.keys(e.attributes).sort()){let r=e.attributes[n];t+=n+",",r.data&&(t+=r.data.stride+","),r.offset&&(t+=r.offset+","),r.itemSize&&(t+=r.itemSize+","),r.normalized&&(t+="n,")}for(let n of Object.keys(e.morphAttributes).sort()){let r=e.morphAttributes[n];t+="morph-"+n+",";for(let s=0,o=r.length;s<o;s++){let a=r[s];t+=a.id+","}}return e.index&&(t+="index,"),t}getMaterialCacheKey(){let{object:e,material:t,renderer:n}=this,r=t.customProgramCacheKey();for(let s of EMe(t)){if(/^(is[A-Z]|_)|^(visible|version|uuid|name|opacity|userData)$/.test(s))continue;let o=t[s],a;if(o!==null){let l=typeof o;l==="number"?s==="side"?a=String(o):a=o!==0?"1":"0":l==="object"?(a="{",o.isTexture&&(a+=o.mapping,n.backend.isWebGPUBackend===!0&&(a+=o.magFilter,a+=o.minFilter,a+=o.wrapS,a+=o.wrapT,a+=o.wrapR)),a+="}"):a=String(o)}else a=String(o);r+=a+","}return r+=this.clippingContextCacheKey+",",e.geometry&&(r+=this.getGeometryCacheKey()),e.skeleton&&(r+=e.skeleton.bones.length+","),e.isBatchedMesh&&(r+=e._matricesTexture.uuid+",",e._colorsTexture!==null&&(r+=e._colorsTexture.uuid+",")),(e.isInstancedMesh||e.count>1)&&(r+=e.uuid+","),r+=this.context.id+",",r+=e.receiveShadow+",",yx(r)}get needsGeometryUpdate(){if(this.geometry.id!==this.object.geometry.id)return!0;if(this.attributes!==null){let e=this.attributesId;for(let t in e){let n=this.geometry.getAttribute(t);if(n===void 0)return!0;let r=n.isInterleavedBufferAttribute?n.data.uuid:n.id;if(e[t]!==r)return!0}}return!1}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=0;return this.material.isShadowPassMaterial!==!0&&(e=this._nodes.getCacheKey(this.scene,this.lightsNode)),this.camera.isArrayCamera&&(e=nS(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=nS(e,1)),e=nS(e,this.renderer.contextNode.id,this.renderer.contextNode.version),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.geometry.removeEventListener("dispose",this.onGeometryDispose),this._sourceMaterial!==null&&this._sourceMaterial.removeEventListener("dispose",this.onMaterialDispose),this.onDispose()}},cf=[],j7=class{constructor(e,t,n,r,s,o){this.renderer=e,this.nodes=t,this.geometries=n,this.pipelines=r,this.bindings=s,this.info=o,this.chainMaps={}}get(e,t,n,r,s,o,a,l){let c=this.getChainMap(l);cf[0]=e,cf[1]=t,cf[2]=o,cf[3]=s;let u=c.get(cf);return u===void 0?(u=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,s,o,a,l),c.set(cf,u)):(u.camera=r,u.updateClipping(a),u.needsGeometryUpdate&&u.setGeometry(e.geometry),(u.version!==t.version||u.needsUpdate)&&(u.initialCacheKey!==u.getCacheKey()?(u.dispose(),u=this.get(e,t,n,r,s,o,a,l)):u.version=t.version)),cf[0]=null,cf[1]=null,cf[2]=null,cf[3]=null,u}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Sf)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,s,o,a,l,c,u,f){let d=this.getChainMap(f),A=new W7(e,t,n,r,s,o,a,l,c,u);return A.onDispose=()=>{this.pipelines.delete(A),this.bindings.deleteForRender(A),this.nodes.delete(A),d.delete(A.getChainArray())},A}},Tf=class{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}},nu={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},hm=16,MMe=211,CMe=212,X7=class extends Tf{constructor(e,t){super(),this.backend=e,this.info=t}delete(e){let t=super.delete(e);return t!==null&&(this.backend.destroyAttribute(e),this.info.destroyAttribute(e)),t}update(e,t){let n=this.get(e);if(n.version===void 0)t===nu.VERTEX?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===nu.INDEX?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===nu.STORAGE?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===nu.INDIRECT&&(this.backend.createIndirectStorageAttribute(e),this.info.createIndirectStorageAttribute(e)),n.version=this._getBufferAttribute(e).version;else{let r=this._getBufferAttribute(e);(n.version<r.version||r.usage===hg)&&(this.backend.updateAttribute(e),n.version=r.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}};function gse(i){return i.index!==null?i.index.version:i.attributes.position.version}function vse(i){return i.index!==null?i.index.id:i.attributes.position.id}function _te(i){let e=[],t=i.index,n=i.attributes.position;if(t!==null){let s=t.array;for(let o=0,a=s.length;o<a;o+=3){let l=s[o+0],c=s[o+1],u=s[o+2];e.push(l,c,c,u,u,l)}}else{let s=n.array;for(let o=0,a=s.length/3-1;o<a;o+=3){let l=o+0,c=o+1,u=o+2;e.push(l,c,c,u,u,l)}}let r=new(n.count>=65535?GA:VA)(e,1);return r.version=gse(i),r.__id=vse(i),r}var $7=class extends Tf{constructor(e,t){super(),this.attributes=e,this.info=t,this.wireframes=new WeakMap,this.attributeCall=new WeakMap,this._geometryDisposeListeners=new Map}has(e){let t=e.geometry;return super.has(t)&&this.get(t).initialized===!0}updateForRender(e){this.has(e)===!1&&this.initGeometry(e),this.updateAttributes(e)}initGeometry(e){let t=e.geometry,n=this.get(t);n.initialized=!0,this.info.memory.geometries++;let r=()=>{this.info.memory.geometries--;let s=t.index,o=e.getAttributes();s!==null&&this.attributes.delete(s);for(let l of o)this.attributes.delete(l);let a=this.wireframes.get(t);a!==void 0&&this.attributes.delete(a),t.removeEventListener("dispose",r),this._geometryDisposeListeners.delete(t)};t.addEventListener("dispose",r),this._geometryDisposeListeners.set(t,r)}updateAttributes(e){let t=e.getAttributes();for(let s of t)s.isStorageBufferAttribute||s.isStorageInstancedBufferAttribute?this.updateAttribute(s,nu.STORAGE):this.updateAttribute(s,nu.VERTEX);let n=this.getIndex(e);n!==null&&this.updateAttribute(n,nu.INDEX);let r=e.geometry.indirect;r!==null&&this.updateAttribute(r,nu.INDIRECT)}updateAttribute(e,t){let n=this.info.render.calls;e.isInterleavedBufferAttribute?this.attributeCall.get(e)===void 0?(this.attributes.update(e,t),this.attributeCall.set(e,n)):this.attributeCall.get(e.data)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e.data,n),this.attributeCall.set(e,n)):this.attributeCall.get(e)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e,n))}getIndirect(e){return e.geometry.indirect}getIndirectOffset(e){return e.geometry.indirectOffset}getIndex(e){let{geometry:t,material:n}=e,r=t.index;if(n.wireframe===!0){let s=this.wireframes,o=s.get(t);o===void 0?(o=_te(t),s.set(t,o)):(o.version!==gse(t)||o.__id!==vse(t))&&(this.attributes.delete(o),o=_te(t),s.set(t,o)),r=o}return r}dispose(){for(let[e,t]of this._geometryDisposeListeners.entries())e.removeEventListener("dispose",t);this._geometryDisposeListeners.clear()}},Y7=class{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0},this.compute={calls:0,frameCalls:0,timestamp:0},this.memory={attributes:0,attributesSize:0,geometries:0,indexAttributes:0,indexAttributesSize:0,indirectStorageAttributes:0,indirectStorageAttributesSize:0,programs:0,programsSize:0,readbackBuffers:0,readbackBuffersSize:0,renderTargets:0,storageAttributes:0,storageAttributesSize:0,textures:0,texturesSize:0,uniformBuffers:0,uniformBuffersSize:0,total:0},this.memoryMap=new Map}update(e,t,n){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=n*(t/3):e.isPoints?this.render.points+=n*t:e.isLineSegments?this.render.lines+=n*(t/2):e.isLine?this.render.lines+=n*(t-1):ze("WebGPUInfo: Unknown object type.")}reset(){this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0;for(let e in this.memory)this.memory[e]=0;this.memoryMap.clear()}createTexture(e){let t=this._getTextureMemorySize(e);this.memoryMap.set(e,t),this.memory.textures++,this.memory.total+=t,this.memory.texturesSize+=t}destroyTexture(e){let t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.textures--,this.memory.total-=t,this.memory.texturesSize-=t}_createAttribute(e,t){let n=this._getAttributeMemorySize(e);this.memoryMap.set(e,{size:n,type:t}),this.memory[t]++,this.memory.total+=n,this.memory[t+"Size"]+=n}createAttribute(e){this._createAttribute(e,"attributes")}createIndexAttribute(e){this._createAttribute(e,"indexAttributes")}createStorageAttribute(e){this._createAttribute(e,"storageAttributes")}createIndirectStorageAttribute(e){this._createAttribute(e,"indirectStorageAttributes")}destroyAttribute(e){let t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory[t.type]--,this.memory.total-=t.size,this.memory[t.type+"Size"]-=t.size)}createReadbackBuffer(e){let t=e.maxByteLength;this.memoryMap.set(e,{size:t,type:"readbackBuffers"}),this.memory.readbackBuffers++,this.memory.total+=t,this.memory.readbackBuffersSize+=t}destroyReadbackBuffer(e){let{size:t}=this.memoryMap.get(e);this.memoryMap.delete(e),this.memory.readbackBuffers--,this.memory.total-=t,this.memory.readbackBuffersSize-=t}createUniformBuffer(e){let t=e.byteLength;this.memoryMap.set(e,{size:t,type:"uniformBuffers"}),this.memory.uniformBuffers++,this.memory.total+=t,this.memory.uniformBuffersSize+=t}destroyUniformBuffer(e){let t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory.uniformBuffers--,this.memory.total-=t.size,this.memory.uniformBuffersSize-=t.size)}createProgram(e){let t=e.code.length;this.memoryMap.set(e,t),this.memory.programs++,this.memory.total+=t,this.memory.programsSize+=t}destroyProgram(e){let t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.programs--,this.memory.total-=t,this.memory.programsSize-=t}_getTextureMemorySize(e){if(e.isCompressedTexture)return 1;let t=1;e.type===Oh||e.type===Ji?t=1:e.type===Uh||e.type===wl||e.type===Wi?t=2:(e.type===Kr||e.type===xi||e.type===cr)&&(t=4);let n=4;e.format===u_||e.format===Fd||e.format===kh||e.format===Vs||e.format===xo?n=1:e.format===Ws||e.format===zh?n=2:(e.format===Nd||e.format===Ib)&&(n=3);let r=t*n;e.type===ng||e.type===ig?r=2:(e.type===ua||e.type===rg||e.type===sg)&&(r=4);let s=e.width||1,o=e.height||1,a=e.isCubeTexture?6:e.depth||1,l=s*o*a*r,c=e.mipmaps;if(c&&c.length>0){let u=0;for(let f=0;f<c.length;f++){let d=c[f];if(d.data)u+=d.data.byteLength;else{let A=d.width||Math.max(1,s>>f),y=d.height||Math.max(1,o>>f);u+=A*y*a*r}}l+=u}else e.generateMipmaps&&(l=l*1.333);return Math.round(l)}_getAttributeMemorySize(e){return e.isInterleavedBufferAttribute&&(e=e.data),e.array?e.array.byteLength:e.count&&e.itemSize?e.count*e.itemSize*4:0}},C4=class{constructor(e){this.cacheKey=e,this.usedTimes=0}},Z7=class extends C4{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}},K7=class extends C4{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}},RMe=0,lS=class{constructor(e,t,n,r=null,s=null){this.id=RMe++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=s,this.usedTimes=0}},Q7=class extends Tf{constructor(e,t,n){super(),this.backend=e,this.nodes=t,this.info=n,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){let{backend:n}=this,r=this.get(e);if(this._needsComputeUpdate(e)){let s=r.pipeline;s&&(s.usedTimes--,s.computeProgram.usedTimes--);let o=this.nodes.getForCompute(e),a=this.programs.compute.get(o.computeShader);a===void 0&&(s&&s.computeProgram.usedTimes===0&&this._releaseProgram(s.computeProgram),a=new lS(o.computeShader,"compute",e.name,o.transforms,o.nodeAttributes),this.programs.compute.set(o.computeShader,a),n.createProgram(a),this.info.createProgram(a));let l=this._getComputeCacheKey(e,a),c=this.caches.get(l);c===void 0&&(s&&s.usedTimes===0&&this._releasePipeline(s),c=this._getComputePipeline(e,a,l,t)),c.usedTimes++,a.usedTimes++,r.version=e.version,r.pipeline=c}return r.pipeline}getForRender(e,t=null){let{backend:n}=this,r=this.get(e);if(this._needsRenderUpdate(e)){let s=r.pipeline;s&&(s.usedTimes--,s.vertexProgram.usedTimes--,s.fragmentProgram.usedTimes--);let o=e.getNodeBuilderState(),a=e.material?e.material.name:"",l=this.programs.vertex.get(o.vertexShader);l===void 0&&(s&&s.vertexProgram.usedTimes===0&&this._releaseProgram(s.vertexProgram),l=new lS(o.vertexShader,"vertex",a),this.programs.vertex.set(o.vertexShader,l),n.createProgram(l),this.info.createProgram(l));let c=this.programs.fragment.get(o.fragmentShader);c===void 0&&(s&&s.fragmentProgram.usedTimes===0&&this._releaseProgram(s.fragmentProgram),c=new lS(o.fragmentShader,"fragment",a),this.programs.fragment.set(o.fragmentShader,c),n.createProgram(c),this.info.createProgram(c));let u=this._getRenderCacheKey(e,l,c),f=this.caches.get(u);f===void 0?(s&&s.usedTimes===0&&this._releasePipeline(s),f=this._getRenderPipeline(e,l,c,u,t)):e.pipeline=f,f.usedTimes++,l.usedTimes++,c.usedTimes++,r.pipeline=f}return r.pipeline}isReady(e){let n=this.get(e).pipeline;if(n===void 0)return!1;let r=this.backend.get(n);return r.pipeline!==void 0&&r.pipeline!==null}delete(e){let t=this.get(e).pipeline;return t&&(t.usedTimes--,t.usedTimes===0&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,t.computeProgram.usedTimes===0&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,t.vertexProgram.usedTimes===0&&this._releaseProgram(t.vertexProgram),t.fragmentProgram.usedTimes===0&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,n,r){n=n||this._getComputeCacheKey(e,t);let s=this.caches.get(n);return s===void 0&&(s=new K7(n,t),this.caches.set(n,s),this.backend.createComputePipeline(s,r)),s}_getRenderPipeline(e,t,n,r,s){r=r||this._getRenderCacheKey(e,t,n);let o=this.caches.get(r);return o===void 0&&(o=new Z7(r,t,n),this.caches.set(r,o),e.pipeline=o,this.backend.createRenderPipeline(e,s)),o}_getComputeCacheKey(e,t){return e.id+","+t.id}_getRenderCacheKey(e,t,n){return t.id+","+n.id+","+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){let t=e.code,n=e.stage;this.programs[n].delete(t),this.info.destroyProgram(e)}_needsComputeUpdate(e){let t=this.get(e);return t.pipeline===void 0||t.version!==e.version}_needsRenderUpdate(e){return this.get(e).pipeline===void 0||this.backend.needsRenderUpdate(e)}},J7=class extends Tf{constructor(e,t,n,r,s,o){super(),this.backend=e,this.textures=n,this.pipelines=s,this.attributes=r,this.nodes=t,this.info=o,this.pipelines.bindings=this}getForRender(e){let t=e.getBindings(),n=this.get(e);return n.initialized!==!0&&(this._createBindings(t),n.initialized=!0),t}getForCompute(e){let t=this.nodes.getForCompute(e).bindings,n=this.get(e);return(n.initialized!==!0||n.bindings!==t)&&(n.bindings!==void 0&&this._destroyBindings(n.bindings),this._createBindings(t),n.initialized=!0,n.bindings=t),t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}deleteForCompute(e){let n=this.get(e).bindings||this.nodes.getForCompute(e).bindings;this._destroyBindings(n),this.delete(e)}deleteForRender(e){let t=e.getBindings();this._destroyBindings(t),this.delete(e)}_createBindings(e){for(let t of e){let n=this.get(t);if(n.bindGroup===void 0){for(let r of t.bindings)if(r.isUniformBuffer)this.backend.createUniformBuffer(r),this.info.createUniformBuffer(r);else if(r.isSampledTexture)this.textures.updateTexture(r.texture);else if(r.isSampler)this.textures.updateSampler(r);else if(r.isStorageBuffer){let s=r.attribute,o=s.isIndirectStorageBufferAttribute?nu.INDIRECT:nu.STORAGE;this.attributes.update(s,o)}this.backend.createBindings(t,e,0),n.bindGroup=t,n.usedTimes=1}else n.usedTimes++}}_destroyBindings(e){for(let t of e){let n=this.get(t);if(n.usedTimes--,n.usedTimes===0){for(let r of t.bindings)r.isUniformBuffer?(this.backend.destroyUniformBuffer(r),this.info.destroyUniformBuffer(r),r.release()):r.isSampler&&(r.isSampledTexture!==!0&&this.backend.destroySampler(r),r.release());this.backend.deleteBindGroupData(t),this.delete(t)}}}_updateBindings(e){for(let t of e)this._update(t,e)}_update(e,t){let{backend:n}=this,r=!1,s=!0,o=0,a=0;for(let l of e.bindings)if(this.nodes.updateGroup(l)!==!1){if(l.isStorageBuffer){let u=l.attribute,f=u.isIndirectStorageBufferAttribute?nu.INDIRECT:nu.STORAGE,d=n.get(l);this.attributes.update(u,f),d.attribute!==u&&(d.attribute=u,r=!0)}if(l.isUniformBuffer)l.update()&&n.updateBinding(l);else if(l.isSampledTexture){let u=l.update(),f=l.texture,d=this.textures.get(f);if(u&&(this.textures.updateTexture(f),l.generation!==d.generation&&(l.generation=d.generation,r=!0),d.bindGroups.add(e)),n.get(f).externalTexture!==void 0||d.isDefaultTexture?s=!1:(o=o*10+f.id,a+=f.version),f.isStorageTexture===!0&&f.mipmapsAutoUpdate===!0){let y=this.get(f);l.store===!0?y.needsMipmap=!0:this.textures.needsMipmaps(f)&&y.needsMipmap===!0&&(this.backend.generateMipmaps(f),y.needsMipmap=!1)}}else if(l.isSampler&&l.update()){let f=this.textures.updateSampler(l);l.samplerKey!==f&&(l.samplerKey=f,r=!0)}l.isBuffer&&l.updateRanges.length>0&&l.clearUpdateRanges()}r===!0&&this.backend.updateBindings(e,t,s?o:0,a)}},PMe=Object.freeze([]);function IMe(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?i.z-e.z:i.id-e.id}function xte(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function yte(i){return(i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode)&&i.side===vr&&i.forceSinglePass===!1}var ek=class{constructor(e,t,n){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lighting=e,this.lightsNode=e.getNode(t),this.lightsArray=[],this.scene=t,this.camera=n,this.occlusionQueryCount=0,this._lastOcclusionObject=null}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,n,r,s,o,a){let l=this.renderItems[this.renderItemsIndex];return l===void 0?(l={id:e.id,object:e,geometry:t,material:n,groupOrder:r,renderOrder:e.renderOrder,z:s,group:o,clippingContext:a},this.renderItems[this.renderItemsIndex]=l):(l.id=e.id,l.object=e,l.geometry=t,l.material=n,l.groupOrder=r,l.renderOrder=e.renderOrder,l.z=s,l.group=o,l.clippingContext=a),this.renderItemsIndex++,l}push(e,t,n,r,s,o,a){let l=this.getNextRenderItem(e,t,n,r,s,o,a);e.occlusionTest===!0&&this._lastOcclusionObject!==e&&(this.occlusionQueryCount++,this._lastOcclusionObject=e),n.transparent===!0||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(yte(n)&&this.transparentDoublePass.push(l),this.transparent.push(l)):this.opaque.push(l)}unshift(e,t,n,r,s,o,a){let l=this.getNextRenderItem(e,t,n,r,s,o,a);n.transparent===!0||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(yte(n)&&this.transparentDoublePass.unshift(l),this.transparent.unshift(l)):this.opaque.unshift(l)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t,n){this.opaque.length>1&&this.opaque.sort(e||IMe),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||xte),this.transparent.length>1&&this.transparent.sort(t||xte),n&&(this.opaque.reverse(),this.transparentDoublePass.reverse(),this.transparent.reverse())}finish(){this.lightsNode.setLights(this.lighting.enabled?this.lightsArray:PMe);for(let e=this.renderItemsIndex,t=this.renderItems.length;e<t;e++){let n=this.renderItems[e];if(n.id===null)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.groupOrder=null,n.renderOrder=null,n.z=null,n.group=null,n.clippingContext=null}this._lastOcclusionObject=null}},V_=[],tk=class{constructor(e){this.lighting=e,this.lists=new Sf}get(e,t){let n=this.lists;V_[0]=e,V_[1]=t;let r=n.get(V_);return r===void 0&&(r=new ek(this.lighting,e,t),n.set(V_,r)),V_[0]=null,V_[1]=null,r}dispose(){this.lists=new Sf}},LMe=0,nk=class{constructor(){this.id=LMe++,this.mrt=null,this.color=!0,this.clearColor=!0,this.clearColorValue={r:0,g:0,b:0,a:1},this.depth=!0,this.clearDepth=!0,this.clearDepthValue=1,this.stencil=!1,this.clearStencil=!0,this.clearStencilValue=1,this.viewport=!1,this.viewportValue=new xn,this.scissor=!1,this.scissorValue=new xn,this.renderTarget=null,this.textures=null,this.depthTexture=null,this.activeCubeFace=0,this.activeMipmapLevel=0,this.sampleCount=1,this.width=0,this.height=0,this.occlusionQueryCount=0,this.clippingContext=null,this.camera=null,this.isRenderContext=!0}getCacheKey(){return _se(this)}};function _se(i){let{textures:e,activeCubeFace:t,activeMipmapLevel:n}=i,r=[t,n];for(let s of e)r.push(s.id);return LS(r)}var ik=class{constructor(e){this.renderer=e,this._renderContexts={}}get(e=null,t=null,n=0){let r;if(e===null)r="default";else{let l=e.texture.format,c=e.texture.type;r=`${e.textures.length}:${l}:${c}:${e.samples}:${e.depthBuffer}:${e.stencilBuffer}`}let s=t!==null?t.id:"default",o=r+"-"+s+"-"+n,a=this._renderContexts[o];return a===void 0&&(a=new nk,a.mrt=t,this._renderContexts[o]=a),e!==null&&(a.sampleCount=e.samples===0?1:e.samples),a.clearDepthValue=this.renderer.getClearDepth(),a.clearStencilValue=this.renderer.getClearStencil(),a}dispose(){this._renderContexts={}}},DMe=new re,rk=class extends Tf{constructor(e,t,n){super(),this.renderer=e,this.backend=t,this.info=n,this._htmlTextures=new Set}updateRenderTarget(e,t=0){let n=this.get(e),r=e.samples===0?1:e.samples,s=n.depthTextureMips||(n.depthTextureMips={}),o=e.textures,a=this.getSize(o[0]),l=a.width>>t,c=a.height>>t,u=e.depthTexture||s[t],f=e.depthBuffer===!0||e.stencilBuffer===!0,d=!1,A=u!==void 0&&u.image!==void 0&&u.image.depth>1,y=a.depth>1&&(e.useArrayDepthTexture||e.multiview||A);u===void 0&&f&&(u=new Es,u.format=e.stencilBuffer?xo:Vs,u.type=e.stencilBuffer?ua:xi,u.image.width=l,u.image.height=c,u.image.depth=a.depth,u.renderTarget=e,s[t]=u),u&&(u.isArrayTexture=y),(n.width!==a.width||a.height!==n.height)&&(d=!0,u&&(u.needsUpdate=!0,u.image.width=l,u.image.height=c,u.image.depth=y?a.depth:1)),n.width=a.width,n.height=a.height,n.textures=o,n.depthTexture=u||null,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,n.renderTarget=e,n.sampleCount!==r&&(d=!0,u&&(u.needsUpdate=!0),n.sampleCount=r);let w={sampleCount:r};if(e.isXRRenderTarget!==!0){for(let S=0;S<o.length;S++){let T=o[S];d&&(T.needsUpdate=!0),this.updateTexture(T,w)}u&&this.updateTexture(u,w)}n.initialized!==!0&&(n.initialized=!0,this.info.memory.renderTargets++,n.onDispose=()=>{this._destroyRenderTarget(e)},e.addEventListener("dispose",n.onDispose))}updateTexture(e,t={}){let n=this.get(e);if(n.initialized===!0&&n.version===e.version)return;let r=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,s=this.backend;if(r&&n.initialized===!0&&s.destroyTexture(e),e.isFramebufferTexture){let c=this.renderer.getRenderTarget();c?e.type=c.texture.type:e.type=Ji}if(e.isHTMLTexture&&e.image){let c=this.renderer.domElement;if("requestPaint"in c){if(c.hasAttribute("layoutsubtree")||c.setAttribute("layoutsubtree","true"),e.image.parentNode!==c&&c.appendChild(e.image),this._htmlTextures.size===0){let u=this._htmlTextures;c.onpaint=f=>{let d=f&&f.changedElements;for(let A of u)(!d||d.includes(A.image))&&(A.needsUpdate=!0)}}this._htmlTextures.add(e)}}let{width:o,height:a,depth:l}=this.getSize(e);if(t.width=o,t.height=a,t.depth=l,t.needsMipmaps=this.needsMipmaps(e),t.levels=t.needsMipmaps?this.getMipLevels(e,o,a):1,e.isCubeTexture&&e.mipmaps.length>0&&t.levels++,r||e.isStorageTexture===!0||e.isExternalTexture===!0)s.createTexture(e,t),n.generation=e.version;else if(e.version>0){let c=e.image;if(c===void 0)Xe("Renderer: Texture marked for update but image is undefined.");else if(c.complete===!1)Xe("Renderer: Texture marked for update but image is incomplete.");else{if(e.images){let f=[];for(let d of e.images)f.push(d);t.images=f}else t.image=c;(n.isDefaultTexture===void 0||n.isDefaultTexture===!0)&&(s.createTexture(e,t),n.isDefaultTexture=!1,n.generation=e.version),e.source.dataReady===!0&&s.updateTexture(e,t);let u=e.isStorageTexture===!0&&e.mipmapsAutoUpdate===!1;t.needsMipmaps&&e.mipmaps.length===0&&!u&&s.generateMipmaps(e),e.onUpdate&&e.onUpdate(e)}}else s.createDefaultTexture(e),n.isDefaultTexture=!0,n.generation=e.version;n.initialized!==!0&&(n.initialized=!0,n.generation=e.version,n.bindGroups=new Set,this.info.createTexture(e),e.isVideoTexture&&ln.enabled===!0&&ln.getTransfer(e.colorSpace)!==kt&&Xe("WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace."),n.onDispose=()=>{this._destroyTexture(e)},e.addEventListener("dispose",n.onDispose)),n.version=e.version}updateSampler(e){return this.backend.updateSampler(e)}getSize(e,t=DMe){let n=e.images?e.images[0]:e.image;return n?(n.image!==void 0&&(n=n.image),e.isHTMLTexture?(t.width=n.offsetWidth||1,t.height=n.offsetHeight||1,t.depth=1):typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?(t.width=n.videoWidth||1,t.height=n.videoHeight||1,t.depth=1):typeof VideoFrame<"u"&&n instanceof VideoFrame?(t.width=n.displayWidth||1,t.height=n.displayHeight||1,t.depth=1):(t.width=n.width||1,t.height=n.height||1,t.depth=e.isCubeTexture?6:n.depth||1)):t.width=t.height=t.depth=1,t}getMipLevels(e,t,n){let r;return e.mipmaps.length>0?r=e.mipmaps.length:e.isCompressedTexture===!0?r=1:r=Math.floor(Math.log2(Math.max(t,n)))+1,r}needsMipmaps(e){return e.generateMipmaps===!0||e.mipmaps.length>0}_destroyRenderTarget(e){if(this.has(e)===!0){let t=this.get(e),n=t.textures,r=t.depthTexture;e.removeEventListener("dispose",t.onDispose);for(let s=0;s<n.length;s++)this._destroyTexture(n[s]);r&&this._destroyTexture(r),this.delete(e),this.backend.delete(e),this.info.memory.renderTargets--}}_destroyTexture(e){if(this.has(e)===!0){let t=this.get(e);e.removeEventListener("dispose",t.onDispose);let n=t.isDefaultTexture;if(this.backend.destroyTexture(e,n),t.bindGroups)for(let r of t.bindGroups){let s=this.backend.get(r);s.groups=void 0,s.versions=void 0;for(let o of r.bindings)o.isSampler&&o.texture===e&&(o.isSampledTexture!==!0&&this.backend.destroySampler(o),o.reset(),o.release())}this._htmlTextures.delete(e),this.delete(e),this.info.destroyTexture(e)}}},xS=class extends zt{constructor(e,t,n,r=1){super(e,t,n),this.a=r}set(e,t,n,r=1){return this.a=r,super.set(e,t,n)}copy(e){return e.a!==void 0&&(this.a=e.a),super.copy(e)}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}},R4=class extends pS{static get type(){return"OverrideContextNode"}constructor(e,t=null){super(t,{overrideNodes:e}),this.isOverrideContextNode=!0}getFlowContextData(){let e=[];this.traverse(r=>{r.isOverrideContextNode===!0&&e.push(r.value.overrideNodes)});let t=new Map(e.flatMap(r=>Array.from(r.entries()))),n=super.getFlowContextData();return n.overrideNodes=t,n}};function xse(i,e=null,t=null){if(e&&e.isNode){let n=e;e=()=>n}return new R4(new Map([[i,e]]),t)}Ue("overrideNode",(i,e,t)=>xse(e,t,i));function yse(i,e=null){let t=new Map;for(let[n,r]of i){let s=r!==null?typeof r=="function"?r:()=>r:null;t.set(n,s)}return new R4(t,e)}Ue("overrideNodes",(i,e)=>yse(e,i));var P4=class extends gi{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getMemberType(e,t){let n=this.getNodeType(e),r=e.getStructTypeNode(n),s;return r!==null?s=r.getMemberType(e,t):(ze(`TSL: Member "${t}" not found in struct "${n}".`,new ts),s="float"),s}getHash(){return String(this.id)}generate(){return this.name}},NMe=(i,e)=>new P4(i,e),sk=class extends Kt{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this._expressionNode=null,this._currentNode=null,this._nodeDataLibrary=new Map,this.isStackNode=!0}getElementType(e){return this.outputNode?this.outputNode.getElementType(e):"void"}generateNodeType(e){return this.outputNode?this.outputNode.getNodeType(e):"void"}getMemberType(e,t){return this.outputNode?this.outputNode.getMemberType(e,t):"void"}addToStack(e,t=-1){if(e.isNode!==!0)return ze("TSL: Invalid node added to stack.",new ts),this;if(t===-1)if(this._currentNode){let n=this._nodeDataLibrary.get(this._currentNode);n===void 0&&(n={delta:0},this._nodeDataLibrary.set(this._currentNode,n)),n.delta++,t=this.nodes.indexOf(this._currentNode)+n.delta}else t=this.nodes.length;return this.nodes.splice(t,0,e),this}addToStackBefore(e){let t=this._currentNode?this.nodes.indexOf(this._currentNode):0;return this.addToStack(e,t)}If(e,t){let n=new ix(t);return this._currentCond=xa(e,n),this.addToStack(this._currentCond)}ElseIf(e,t){let n=new ix(t),r=xa(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new ix(e),this}Switch(e){return this._expressionNode=Ht(e),this}Case(...e){let t=[];if(e.length>=2)for(let a=0;a<e.length-1;a++)t.push(this._expressionNode.equal(Ht(e[a])));else ze("TSL: Invalid parameter length. Case() requires at least two parameters.",new ts);let n=e[e.length-1],r=new ix(n),s=t[0];for(let a=1;a<t.length;a++)s=s.or(t[a]);let o=xa(s,r);return this._currentCond===null?(this._currentCond=o,this.addToStack(this._currentCond)):(this._currentCond.elseNode=o,this._currentCond=o,this)}Default(e){return this.Else(e),this}setup(e){let t=e.getNodeProperties(this),n=0;for(let r of this.getChildren())r.isVarNode&&r.isIntent(e)&&r.isAssign(e)!==!0||(t["node"+n++]=r);return t.outputNode||null}build(e,...t){let n=fz(),r=e.buildStage;fS(this),e.setActiveStack(this);for(let o=0;o<this.nodes.length;o++){let a=this.nodes[o],l=this._currentNode;if(this._currentNode=a,!(a.isVarNode&&a.isIntent(e)&&a.isAssign(e)!==!0)){if(r==="setup")a.build(e);else if(r==="analyze")a.build(e,this);else if(r==="generate"){let c=e.getDataFromNode(a,"any").stages,u=c&&c[e.shaderStage];if(a.isVarNode&&u&&u.length===1&&u[0]&&u[0].isStackNode)continue;a.build(e,"void")}this._currentNode=l}}let s;if(this.outputNode){let o=this.outputNode.build(e,...t);(e.buildStage!=="generate"||this.outputNode.getNodeType(e)!=="void")&&(s=o)}else s=super.build(e,...t);return fS(n),e.removeActiveStack(this),s}},JR=$n(sk).setParameterLength(0,1);function FMe(i){return Object.entries(i).map(([e,t])=>typeof t=="string"?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})}var ok=class extends Kt{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=FMe(e),this.name=t,this.isStructTypeNode=!0}getLength(){let e=1,t=0;for(let n of this.membersLayout){let r=n.type,s=CTe(r),o=RTe(r);e=Math.max(e,o);let l=t%e%o;l!==0&&(t+=o-l),t+=s}return Math.ceil(t/e)*e}getMemberType(e,t){let n=this.membersLayout.find(r=>r.name===t);return n?n.type:"void"}generateNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}setup(e){e.getStructTypeFromNode(this,this.membersLayout,this.name),e.addInclude(this)}generate(e){return this.getNodeType(e)}},ak=class extends Kt{static get type(){return"StructNode"}constructor(e,t){super("vec3"),this.structTypeNode=e,this.values=t,this.isStructNode=!0}generateNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}_getChildren(){let e=super._getChildren(),t=e.find(n=>n.childNode===this.structTypeNode);return e.splice(e.indexOf(t),1),e.push(t),e}generate(e){let t=e.getVarFromNode(this),n=t.type,r=e.getPropertyName(t);return e.addLineFlowCode(`${r} = ${e.generateStruct(n,this.structTypeNode.membersLayout,this.values)}`,this),t.name}},BMe=(i,e=null)=>{let t=new ok(i,e);return hz((...r)=>{let s=null;if(r.length>0)if(r[0].isNode){s={};let o=Object.keys(i);for(let a=0;a<r.length;a++)s[o[a]]=r[a]}else s=r[0];return new ak(t,s)},t)},I4=class extends Kt{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}generateNodeType(){return"OutputType"}generate(e){let t=e.getDataFromNode(this);if(t.membersLayout===void 0){let o=this.members,a=[];for(let l=0;l<o.length;l++){let c="m"+l,u=o[l].getNodeType(e);a.push({name:c,type:u,index:l})}t.membersLayout=a,t.structType=e.getOutputStructTypeFromNode(this,t.membersLayout)}let n=e.getOutputStructName(),r=this.members,s=n!==""?n+".":"";for(let o=0;o<r.length;o++){let a=r[o].build(e,t.membersLayout[o].type);e.addLineFlowCode(`${s}m${o} = ${a}`,this)}return n}},OMe=$n(I4),L4=class{constructor(e=Ts){this.blending=e,this.blendSrc=Jp,this.blendDst=e0,this.blendEquation=oo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.premultiplyAlpha=!1}copy(e){return this.blending=e.blending,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.premultiplyAlpha=e.premultiplyAlpha,this}clone(){return new this.constructor().copy(this)}},UMe=new L4(ps),kMe=new L4(fb);function bse(i,e){for(let t=0;t<i.length;t++)if(i[t].name===e)return t;return-1}var lk=class extends I4{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.blendModes={output:kMe},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||UMe}has(e){return this.outputNodes[e]!==void 0}get(e){return this.outputNodes[e]}merge(e){let t={...this.outputNodes,...e.outputNodes},n={...this.blendModes,...e.blendModes},r=wse(t);return r.blendings=n,r}setup(e){let t=this.outputNodes,n=e.renderer.getRenderTarget(),r=[],s=n.textures;for(let o in t){let a=bse(s,o);if(a===-1)continue;let l=e.getOutputType(a);r[a]=t[o].convert(l)}return this.members=r,super.setup(e)}},wse=$n(lk),r1=class extends Rr{static get type(){return"BitcastNode"}constructor(e,t,n=null){super(),this.valueNode=e,this.conversionType=t,this.inputType=n,this.isBitcastNode=!0}generateNodeType(e){if(this.inputType!==null){let t=this.valueNode.getNodeType(e),n=e.getTypeLength(t);return e.getTypeFromLength(n,this.conversionType)}return this.conversionType}generate(e){let t=this.getNodeType(e),n="";if(this.inputType!==null){let r=this.valueNode.getNodeType(e);n=e.getTypeLength(r)===1?this.inputType:e.changeComponentType(r,this.inputType)}else n=this.valueNode.getNodeType(e);return`${e.getBitcastMethod(t,n)}( ${this.valueNode.build(e,n)} )`}},Sse=ct(r1).setParameterLength(2),zMe=i=>new r1(i,"int","float"),Tse=i=>new r1(i,"uint","float"),VMe=i=>new r1(i,"float","int"),GMe=i=>new r1(i,"float","uint"),SR={},Ku=class i extends Pe{static get type(){return"BitcountNode"}constructor(e,t){super(e,t),this.isBitcountNode=!0}_resolveElementType(e,t,n){n==="int"?t.assign(Sse(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return rt;case"int":return de;case"uvec2":return dz;case"uvec3":return l1;case"uvec4":return gz;case"ivec2":return kr;case"ivec3":return pz;case"ivec4":return Az}}_createTrailingZerosBaseLayout(e,t){let n=this._returnDataNode(t);return me(([s])=>{let o=rt(0);this._resolveElementType(s,o,t);let a=oe(o.bitAnd(Cz(o))),c=Tse(a).shiftRight(23).sub(127);return n(c)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createLeadingZerosBaseLayout(e,t){let n=this._returnDataNode(t);return me(([s])=>{$t(s.equal(rt(0)),()=>rt(32));let o=rt(0),a=rt(0);return this._resolveElementType(s,o,t),$t(o.shiftRight(16).equal(0),()=>{a.addAssign(16),o.shiftLeftAssign(16)}),$t(o.shiftRight(24).equal(0),()=>{a.addAssign(8),o.shiftLeftAssign(8)}),$t(o.shiftRight(28).equal(0),()=>{a.addAssign(4),o.shiftLeftAssign(4)}),$t(o.shiftRight(30).equal(0),()=>{a.addAssign(2),o.shiftLeftAssign(2)}),$t(o.shiftRight(31).equal(0),()=>{a.addAssign(1)}),n(a)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createOneBitsBaseLayout(e,t){let n=this._returnDataNode(t);return me(([s])=>{let o=rt(0);this._resolveElementType(s,o,t),o.assign(o.sub(o.shiftRight(rt(1)).bitAnd(rt(1431655765)))),o.assign(o.bitAnd(rt(858993459)).add(o.shiftRight(rt(2)).bitAnd(rt(858993459))));let a=o.add(o.shiftRight(rt(4))).bitAnd(rt(252645135)).mul(rt(16843009)).shiftRight(rt(24));return n(a)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createMainLayout(e,t,n,r){let s=this._returnDataNode(t);return me(([a])=>{if(n===1)return s(r(a));{let l=s(0),c=["x","y","z","w"];for(let u=0;u<n;u++){let f=c[u];l[f].assign(r(a[f]))}return l}}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}setup(e){let{method:t,aNode:n}=this,{renderer:r}=e;if(r.backend.isWebGPUBackend)return super.setup(e);let s=this.getInputType(e),o=e.getElementType(s),a=e.getTypeLength(s),l=`${t}_base_${o}`,c=`${t}_${s}`,u=SR[l];if(u===void 0){switch(t){case i.COUNT_LEADING_ZEROS:{u=this._createLeadingZerosBaseLayout(l,o);break}case i.COUNT_TRAILING_ZEROS:{u=this._createTrailingZerosBaseLayout(l,o);break}case i.COUNT_ONE_BITS:{u=this._createOneBitsBaseLayout(l,o);break}}SR[l]=u}let f=SR[c];return f===void 0&&(f=this._createMainLayout(c,s,a,u),SR[c]=f),me(()=>f(n))()}};Ku.COUNT_TRAILING_ZEROS="countTrailingZeros";Ku.COUNT_LEADING_ZEROS="countLeadingZeros";Ku.COUNT_ONE_BITS="countOneBits";var qMe=ct(Ku,Ku.COUNT_TRAILING_ZEROS).setParameterLength(1),HMe=ct(Ku,Ku.COUNT_LEADING_ZEROS).setParameterLength(1),WMe=ct(Ku,Ku.COUNT_ONE_BITS).setParameterLength(1),jMe=me(([i])=>{let e=i.toUint().mul(747796405).add(2891336453),t=e.shiftRight(e.shiftRight(28).add(4)).bitXor(e).mul(277803737);return t.shiftRight(22).bitXor(t).toFloat().mul(1/2**32)}),ck=(i,e)=>eu(Tn(4,i.mul(ai(1,i))),e),XMe=(i,e)=>i.lessThan(.5)?ck(i.mul(2),e).div(2):ai(1,ck(Tn(ai(1,i),2),e).div(2)),$Me=(i,e,t)=>eu(pc(eu(i,e),Ps(eu(i,e),eu(ai(1,i),t))),1/e),YMe=(i,e)=>Ka(h4.mul(e.mul(i).sub(1))).div(h4.mul(e.mul(i).sub(1))),yS=class extends Rr{static get type(){return"PackFloatNode"}constructor(e,t){super(),this.vectorNode=t,this.encoding=e,this.isPackFloatNode=!0}generateNodeType(){return"uint"}generate(e){let t=this.vectorNode.getNodeType(e);return`${e.getFloatPackingMethod(this.encoding)}(${this.vectorNode.build(e,t)})`}},ZMe=ct(yS,"snorm").setParameterLength(1),KMe=ct(yS,"unorm").setParameterLength(1),QMe=ct(yS,"float16").setParameterLength(1),bS=class extends Rr{static get type(){return"UnpackFloatNode"}constructor(e,t){super(),this.uintNode=t,this.encoding=e,this.isUnpackFloatNode=!0}generateNodeType(){return"vec2"}generate(e){let t=this.uintNode.getNodeType(e);return`${e.getFloatUnpackingMethod(this.encoding)}(${this.uintNode.build(e,t)})`}},JMe=ct(bS,"snorm").setParameterLength(1),eCe=ct(bS,"unorm").setParameterLength(1),tCe=ct(bS,"float16").setParameterLength(1),jd=me(([i])=>i.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),nCe=me(([i])=>pe(jd(i.z.add(jd(i.y.mul(1)))),jd(i.z.add(jd(i.x.mul(1)))),jd(i.y.add(jd(i.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),iCe=me(([i,e,t])=>{let n=pe(i).toVar(),r=oe(1.4).toVar(),s=oe(0).toVar(),o=pe(n).toVar();return Oi({start:oe(0),end:oe(3),type:"float",condition:"<="},()=>{let a=pe(nCe(o.mul(2))).toVar();n.addAssign(a.add(t.mul(oe(.1).mul(e)))),o.mulAssign(1.8),r.mulAssign(1.5),n.mulAssign(1.2);let l=oe(jd(n.z.add(jd(n.x.add(jd(n.y)))))).toVar();s.addAssign(l.div(r)),o.addAssign(.14)}),s}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]}),uk=class extends Kt{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFn=null,this.global=!0}generateNodeType(e){return this.getCandidateFn(e).shaderNode.layout.type}getCandidateFn(e){let t=this.parametersNodes,n=this._candidateFn;if(n===null){let r=null,s=-1;for(let o of this.functionNodes){let l=o.shaderNode.layout;if(l===null)throw new Error("THREE.FunctionOverloadingNode: FunctionNode must be a layout.");let c=l.inputs;if(t.length===c.length){let u=0;for(let f=0;f<t.length;f++){let d=t[f],A=c[f];d.getNodeType(e)===A.type&&u++}u>s&&(r=o,s=u)}}this._candidateFn=n=r}return n}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}},rCe=$n(uk),Ko=i=>(...e)=>rCe(i,...e),Sx=Xt(0).setGroup(Jt).onRenderUpdate(i=>i.time),sCe=Xt(0).setGroup(Jt).onRenderUpdate(i=>i.deltaTime),Ese=Xt(0,"uint").setGroup(Jt).onRenderUpdate(i=>i.frameId),oCe=(i=Sx)=>i.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),aCe=(i=Sx)=>i.fract().round(),lCe=(i=Sx)=>i.add(.5).fract().mul(2).sub(1).abs(),cCe=(i=Sx)=>i.fract();function uCe(i,e=null){return ep(e,{getUV:typeof i=="function"?i:()=>i})}var hCe=me(([i,e,t=dt(.5)])=>FS(i.sub(t),e).add(t)),fCe=me(([i,e,t=dt(.5)])=>{let n=i.sub(t),r=n.dot(n),o=r.mul(r).mul(e);return i.add(n.mul(o))}),dCe=me(({position:i=null,horizontal:e=!0,vertical:t=!1})=>{let n;i!==null?(n=tu.toVar(),n[3][0]=i.x,n[3][1]=i.y,n[3][2]=i.z):n=tu;let r=wm.mul(n);return hx(e)&&(r[0][0]=tu[0].length(),r[0][1]=0,r[0][2]=0),hx(t)&&(r[1][0]=0,r[1][1]=tu[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,Ja.mul(r).mul(Mr)}),pCe=me(([i=null])=>{let e=x4();return x4(pV(i)).sub(e).lessThan(0).select(ju,i)}),mCe=me(([i,e=Ui(),t=oe(0)])=>{let n=i.x,r=i.y,s=t.mod(n.mul(r)).floor(),o=s.mod(n),a=r.sub(s.add(1).div(n).ceil()),l=i.reciprocal(),c=dt(o,a);return e.add(c).mul(l)}),Mse=me(([i,e=null,t=null,n=oe(1),r=Mr,s=wa])=>{let o=s.abs().normalize();o=o.div(o.dot(pe(1)));let a=r.yz.mul(n),l=r.zx.mul(n),c=r.xy.mul(n),u=i.value,f=e!==null?e.value:u,d=t!==null?t.value:u,A=fi(u,a).mul(o.x),y=fi(f,l).mul(o.y),w=fi(d,c).mul(o.z);return Ps(A,y,w)}),ACe=(...i)=>Mse(...i),G_=new Na,Dg=new re,q_=new re,tU=new re,Vw=new cn,TR=new re(0,0,-1),uf=new xn,Gw=new re,ER=new re,qw=new xn,MR=new Oe,D4=new Ba,gCe=ju.flipX();D4.depthTexture=new Es(1,1);var CR=!1,hk=class i extends su{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||D4.texture,gCe),this._reflectorBaseNode=e.reflector||new fk(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(this._depthNode===null){if(this._reflectorBaseNode.depth!==!0)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=new i({defaultTexture:D4.depthTexture,reflector:this._reflectorBaseNode})}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){let e=new this.constructor(this.reflectorNode);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e._reflectorBaseNode=this._reflectorBaseNode,e}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}},fk=class extends Kt{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();let{target:n=new lr,resolutionScale:r=1,generateMipmaps:s=!1,bounces:o=!0,depth:a=!1,samples:l=0}=t;this.textureNode=e,this.target=n,this.resolutionScale=r,t.resolution!==void 0&&(ni('ReflectorNode: The "resolution" parameter has been renamed to "resolutionScale".'),this.resolutionScale=t.resolution),this.generateMipmaps=s,this.bounces=o,this.depth=a,this.samples=l,this.updateBeforeType=o?yn.RENDER:yn.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){let n=this.resolutionScale;t.getDrawingBufferSize(MR),e.setSize(Math.round(MR.width*n),Math.round(MR.height*n))}setup(e){return this._updateResolution(D4,e.renderer),super.setup(e)}dispose(){super.dispose();for(let e of this.renderTargets.values())e.dispose()}getVirtualCamera(e){let t=this.virtualCameras.get(e);return t===void 0&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return t===void 0&&(t=new Ba(0,0,{type:Wi,samples:this.samples}),this.generateMipmaps===!0&&(t.texture.minFilter=Y8,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new Es),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&CR)return!1;CR=!0;let{scene:t,camera:n,renderer:r,material:s}=e,{target:o}=this,a=this.getVirtualCamera(n),l=this.getRenderTarget(a);r.getDrawingBufferSize(MR),this._updateResolution(l,r),q_.setFromMatrixPosition(o.matrixWorld),tU.setFromMatrixPosition(n.matrixWorld),Vw.extractRotation(o.matrixWorld),Dg.set(0,0,1),Dg.applyMatrix4(Vw),Gw.subVectors(q_,tU);let c=Gw.dot(Dg)>0,u=!1;if(c===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){CR=!1;return}u=!0}Gw.reflect(Dg).negate(),Gw.add(q_),Vw.extractRotation(n.matrixWorld),TR.set(0,0,-1),TR.applyMatrix4(Vw),TR.add(tU),ER.subVectors(q_,TR),ER.reflect(Dg).negate(),ER.add(q_),a.coordinateSystem=n.coordinateSystem,a.position.copy(Gw),a.up.set(0,1,0),a.up.applyMatrix4(Vw),a.up.reflect(Dg),a.lookAt(ER),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),G_.setFromNormalAndCoplanarPoint(Dg,q_),G_.applyMatrix4(a.matrixWorldInverse),uf.set(G_.normal.x,G_.normal.y,G_.normal.z,G_.constant);let f=a.projectionMatrix;qw.x=(Math.sign(uf.x)+f.elements[8])/f.elements[0],qw.y=(Math.sign(uf.y)+f.elements[9])/f.elements[5],qw.z=-1,qw.w=(1+f.elements[10])/f.elements[14],uf.multiplyScalar(1/uf.dot(qw));let d=0;f.elements[2]=uf.x,f.elements[6]=uf.y,f.elements[10]=r.coordinateSystem===xl?uf.z-d:uf.z+1-d,f.elements[14]=uf.w,this.textureNode.value=l.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=l.depthTexture),s.visible=!1;let A=r.getRenderTarget(),y=r.getMRT(),w=r.autoClear;r.setMRT(null),r.setRenderTarget(l),r.autoClear=!0;let S=t.name;t.name=(t.name||"Scene")+" [ Reflector ]",u?(r.clear(),this.hasOutput=!1):(r.render(t,a),this.hasOutput=!0),t.name=S,r.setMRT(y),r.setRenderTarget(A),r.autoClear=w,s.visible=!0,CR=!1,this.forceUpdate=!1}get resolution(){return ni('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){ni('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}},vCe=i=>new hk(i),nU=new Du(-1,1,1,-1,0,1),dk=class extends Xn{constructor(e=!1){super();let t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new Ln([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Ln(t,2))}},_Ce=new dk,wS=class extends Hn{constructor(e=null){super(_Ce,e),this.camera=nU,this.isQuadMesh=!0}async renderAsync(e){ni('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await e.init(),e.render(this,nU)}render(e){e.render(this,nU)}},xCe=new Oe,pk=class extends su{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:Wi}){let s=new Ba(t,n,r);super(s.texture,Ui()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=n,this.renderTarget=s,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._resolutionScale=1,this._rttNode=null,this._quadMesh=new wS(new Pr),this.updateBeforeType=yn.RENDER}get autoResize(){return this.width===null}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){let n=Math.floor(e*this._resolutionScale),r=Math.floor(t*this._resolutionScale);this.renderTarget.setSize(n,r),this.textureNeedsUpdate=!0}setResolutionScale(e){return this._resolutionScale=e,this.autoResize===!1&&this.setSize(this.width,this.height),this}getResolutionScale(){return this._resolutionScale}updateBefore({renderer:e}){if(this.textureNeedsUpdate===!1&&this.autoUpdate===!1)return;this.textureNeedsUpdate=!1;let t=e.getRenderTarget();if(this.autoResize===!0){let r=e.getDrawingBufferSize(xCe),s=Math.floor(r.width*this._resolutionScale),o=Math.floor(r.height*this._resolutionScale);(s!==this.renderTarget.width||o!==this.renderTarget.height)&&(this.renderTarget.setSize(s,o),this.textureNeedsUpdate=!0)}let n="RTT";this.node.name&&(n=this.node.name+" [ "+n+" ]"),this._quadMesh.material.fragmentNode=this._rttNode,this._quadMesh.name=n,e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(t)}clone(){let e=new su(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}},Cse=(i,...e)=>new pk(Ht(i),...e),yCe=(i,...e)=>i.isSampleNode||i.isTextureNode?i:i.isPassNode?i.getTextureNode():Cse(i,...e),nx=me(([i,e,t],n)=>{let r;n.renderer.coordinateSystem===xl?(i=dt(i.x,i.y.oneMinus()).mul(2).sub(1),r=Ft(pe(i,e),1)):r=Ft(pe(i.x,i.y.oneMinus(),e).mul(2).sub(1),1);let s=Ft(t.mul(r));return s.xyz.div(s.w)}),bCe=me(([i,e])=>{let t=e.mul(Ft(i,1)),n=t.xy.div(t.w).mul(.5).add(.5).toVar();return dt(n.x,n.y.oneMinus())}),wCe=me(([i,e,t])=>{let n=e1(_s(e)),r=kr(i.mul(n)).toVar(),s=_s(e,r).toVar(),o=_s(e,r.sub(kr(2,0))).toVar(),a=_s(e,r.sub(kr(1,0))).toVar(),l=_s(e,r.add(kr(1,0))).toVar(),c=_s(e,r.add(kr(2,0))).toVar(),u=_s(e,r.add(kr(0,2))).toVar(),f=_s(e,r.add(kr(0,1))).toVar(),d=_s(e,r.sub(kr(0,1))).toVar(),A=_s(e,r.sub(kr(0,2))).toVar(),y=fr(ai(oe(2).mul(a).sub(o),s)).toVar(),w=fr(ai(oe(2).mul(l).sub(c),s)).toVar(),S=fr(ai(oe(2).mul(f).sub(u),s)).toVar(),T=fr(ai(oe(2).mul(d).sub(A),s)).toVar(),R=nx(i,s,t).toVar(),I=y.lessThan(w).select(R.sub(nx(i.sub(dt(oe(1).div(n.x),0)),a,t)),R.negate().add(nx(i.add(dt(oe(1).div(n.x),0)),l,t))),P=S.lessThan(T).select(R.sub(nx(i.add(dt(0,oe(1).div(n.y))),f,t)),R.negate().add(nx(i.sub(dt(0,oe(1).div(n.y))),d,t)));return ya(Kd(I,P))}),bV=me(([i])=>$u(oe(52.9829189).mul($u(ru(i,dt(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),Wu=me(([i,e,t])=>{let n=oe(2.399963229728653),r=el(oe(i).add(.5).div(oe(e))),s=oe(i).mul(n).add(t);return dt(Hu(s),Ka(s)).mul(r)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]}),mk=class extends Kt{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(Ui())}sample(e){return this.callback(e)}},SCe=(i,e=null)=>new mk(i,Ht(e)),s1=class extends Ql{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}},Ak=class extends Hi{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}},TCe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=e4("float")):(t=ine(e),n=e4(e));let r=new Ak(i,t,n);return mm(r,e,i)},ECe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=e4("float")):(t=ine(e),n=e4(e));let r=new s1(i,t,n);return mm(r,e,r.count)},gk=class extends Kt{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}},MCe=xt(gk),iU=new cn,Rse=Xt(0).setGroup(Jt).onRenderUpdate(({scene:i})=>i.backgroundBlurriness),vk=Xt(1).setGroup(Jt).onRenderUpdate(({scene:i})=>i.backgroundIntensity),Pse=Xt(new cn).setGroup(Jt).onRenderUpdate(({scene:i})=>{let e=i.background;return e!==null&&e.isTexture&&e.mapping!==Rb||i.backgroundNode&&i.backgroundNode.isNode?iU.makeRotationFromEuler(i.backgroundRotation).transpose():iU.identity(),iU}),N4=class extends su{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=Yo.WRITE_ONLY}getInputType(){return"storageTexture"}getTransformedUV(e){return e}setup(e){super.setup(e);let t=e.getNodeProperties(this);return t.storeNode=this.storeNode,t}setAccess(e){return this.access=e,this}setMipLevel(e){return this.mipLevel=e,this}generate(e,t){return this.storeNode!==null?(this.generateStore(e),""):super.generate(e,t)}generateSnippet(e,t,n,r,s,o,a,l,c){let u=this.value;return e.generateStorageTextureLoad(u,t,n,r,o,c)}toReadWrite(){return this.setAccess(Yo.READ_WRITE)}toReadOnly(){return this.setAccess(Yo.READ_ONLY)}toWriteOnly(){return this.setAccess(Yo.WRITE_ONLY)}store(e,t){let n=this.clone();return n.referenceNode=this.getBase(),n.uvNode=e,n.storeNode=t,t!==null&&n.toStack(),n}generateStore(e){let t=e.getNodeProperties(this),{uvNode:n,storeNode:r,depthNode:s}=t,o=super.generate(e,"property"),a=n.build(e,this.value.is3DTexture===!0?"uvec3":"uvec2"),l=r.build(e,"vec4"),c=s?s.build(e,"int"):null,u=e.generateTextureStore(this.value,o,a,c,l);e.addLineFlowCode(u,this)}clone(){let e=super.clone();return e.storeNode=this.storeNode,e.mipLevel=this.mipLevel,e.access=this.access,e}},Ise=$n(N4).setParameterLength(1,3),CCe=(i,e,t)=>{let n;return i.isStorageTextureNode===!0?n=i.store(e,t):(n=Ise(i,e,t),t!==null&&n.toStack()),n},_k=class extends N4{static get type(){return"StorageTexture3DNode"}constructor(e,t,n=null){super(e,t,n),this.isStorageTexture3DNode=!0}getDefaultUV(){return pe(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}},RCe=$n(_k).setParameterLength(1,3),PCe=me(({texture:i,uv:e})=>{let n=pe().toVar();return $t(e.x.lessThan(1e-4),()=>{n.assign(pe(1,0,0))}).ElseIf(e.y.lessThan(1e-4),()=>{n.assign(pe(0,1,0))}).ElseIf(e.z.lessThan(1e-4),()=>{n.assign(pe(0,0,1))}).ElseIf(e.x.greaterThan(1-1e-4),()=>{n.assign(pe(-1,0,0))}).ElseIf(e.y.greaterThan(1-1e-4),()=>{n.assign(pe(0,-1,0))}).ElseIf(e.z.greaterThan(1-1e-4),()=>{n.assign(pe(0,0,-1))}).Else(()=>{let s=i.sample(e.add(pe(-.01,0,0))).r.sub(i.sample(e.add(pe(.01,0,0))).r),o=i.sample(e.add(pe(0,-.01,0))).r.sub(i.sample(e.add(pe(0,.01,0))).r),a=i.sample(e.add(pe(0,0,-.01))).r.sub(i.sample(e.add(pe(0,0,.01))).r);n.assign(pe(s,o,a))}),n.normalize()}),xk=class extends su{static get type(){return"Texture3DNode"}constructor(e,t=null,n=null){super(e,t,n),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return pe(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}normal(e){return PCe({texture:this,uv:e})}},wV=$n(xk).setParameterLength(1,3),ICe=(...i)=>wV(...i).setSampler(!1),LCe=(i,e,t)=>wV(i,e).level(t),yk=class extends px{static get type(){return"UserDataNode"}constructor(e,t,n=null){super(e,t,n),this.userData=n}updateReference(e){return this.reference=this.userData!==null?this.userData:e.object.userData,this.reference}},DCe=(i,e,t)=>new yk(i,e,t),bte=new WeakMap,bk=class extends Rr{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=yn.OBJECT,this.updateAfterType=yn.OBJECT,this.previousModelWorldMatrix=Xt(new cn),this.previousProjectionMatrix=Xt(new cn).setGroup(Jt),this.previousCameraViewMatrix=Xt(new cn)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:n}){let r=wte(n);this.previousModelWorldMatrix.value.copy(r);let s=Lse(t);s.frameId!==e&&(s.frameId=e,s.previousProjectionMatrix===void 0?(s.previousProjectionMatrix=new cn,s.previousCameraViewMatrix=new cn,s.currentProjectionMatrix=new cn,s.currentCameraViewMatrix=new cn,s.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(s.previousProjectionMatrix.copy(s.currentProjectionMatrix),s.previousCameraViewMatrix.copy(s.currentCameraViewMatrix)),s.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(s.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(s.previousCameraViewMatrix))}updateAfter({object:e}){wte(e).copy(e.matrixWorld)}setup(){let e=this.projectionMatrix===null?Ja:Xt(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(bf).mul(Mr),r=this.previousProjectionMatrix.mul(t).mul(n1),s=n.xy.div(n.w),o=r.xy.div(r.w);return ai(s,o)}};function Lse(i){let e=bte.get(i);return e===void 0&&(e={},bte.set(i,e)),e}function wte(i,e=0){let t=Lse(i),n=t[e];return n===void 0&&(t[e]=n=new cn,t[e].copy(i.matrixWorld)),n}var NCe=xt(bk),FCe=me(([i,e])=>Pl(1,i.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),BCe=me(([i,e])=>Pl(i.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),OCe=me(([i,e])=>i.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),UCe=me(([i,e])=>Qn(i.mul(2).mul(e),i.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),Jg(.5,i))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),kCe=me(([i,e])=>{let t=e.a.add(i.a.mul(e.a.oneMinus()));return Ft(e.rgb.mul(e.a).add(i.rgb.mul(i.a).mul(e.a.oneMinus())).div(t),t)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),zCe=me(([i])=>SV(i.rgb)),VCe=me(([i,e=oe(1)])=>e.mix(SV(i.rgb),i.rgb).max(0)),GCe=me(([i,e=oe(0)])=>{let t=Ps(i.r,i.g,i.b).div(3),n=i.r.max(i.g.max(i.b)),r=n.sub(t).mul(e).mul(-3);return Qn(i.rgb,n,r).max(0)}),qCe=me(([i,e=oe(1)])=>{let t=pe(.57735,.57735,.57735),n=e.cos();return pe(i.rgb.mul(n).add(t.cross(i.rgb).mul(e.sin()).add(t.mul(ru(t,i.rgb).mul(n.oneMinus()))))).max(0)}),SV=(i,e=pe(ln.getLuminanceCoefficients(new re)))=>ru(i,e),HCe=me(([i,e=pe(1),t=pe(0),n=pe(1),r=oe(1),s=pe(ln.getLuminanceCoefficients(new re,t0))])=>{let o=i.rgb.dot(pe(s)),a=zr(i.rgb.mul(e).add(t),0),l=a.pow(n);return $t(a.r.greaterThan(0),()=>{a.r.assign(l.r)}),$t(a.g.greaterThan(0),()=>{a.g.assign(l.g)}),$t(a.b.greaterThan(0),()=>{a.b.assign(l.b)}),a.assign(o.add(a.sub(o).mul(r)).max(0)),Ft(a.rgb,i.a)}),WCe=me(([i,e])=>i.mul(e).floor().div(e)),RR=null,wk=class extends mx{static get type(){return"ViewportSharedTextureNode"}constructor(e=ju,t=null){RR===null&&(RR=new WA),super(e,t,RR)}getTextureForReference(){return RR}updateReference(){return this}},jCe=$n(wk).setParameterLength(0,2),PR=new Oe,F4=class extends su{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.isPassTextureNode=!0,this.setUpdateMatrix(!1)}setup(e){let t=e.getNodeProperties(this);return t.passNode=this.passNode,super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}},B4=class extends F4{static get type(){return"PassMultipleTextureNode"}constructor(e,t,n=!1){super(e,null),this.textureName=t,this.previousTexture=n,this.isPassMultipleTextureNode=!0}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){let e=new this.constructor(this.passNode,this.textureName,this.previousTexture);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e}},Ef=class i extends Rr{static get type(){return"PassNode"}constructor(e,t,n,r={}){super("vec4"),this.scope=e,this.scene=t,this.camera=n,this.options=r,this._width=1,this._height=1;let s=new Ba(this._width,this._height,{type:Wi,...r});s.texture.name="output";let o=null;(this.scope===i.DEPTH||r.depthBuffer!==!1)&&(o=new Es,o.isRenderTargetTexture=!0,o.name="depth",s.depthTexture=o),this.renderTarget=s,this.overrideMaterial=null,this.transparent=!0,this.opaque=!0,this.contextNode=null,this._contextNodeCache=null,this._textures={output:s.texture},o!==null&&(this._textures.depth=o),this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=Xt(0),this._cameraFar=Xt(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=yn.FRAME,this.global=!0}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setResolution(e){return Xe("PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead."),this.setResolutionScale(e)}getResolution(){return Xe("PassNode: .getResolution() is deprecated. Use .getResolutionScale() instead."),this.getResolutionScale()}setLayers(e){return this._layers=e,this}getLayers(){return this._layers}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getTexture(e){let t=this._textures[e];if(t===void 0){if(e==="depth")throw new Error("THREE.PassNode: Depth texture is not available for this pass.");t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)}return t}getPreviousTexture(e){let t=this._previousTextures[e];return t===void 0&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){let t=this._previousTextures[e];if(t!==void 0){let n=this._textures[e],r=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[r]=t,this._textures[e]=t,this._previousTextures[e]=n,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return t===void 0&&(t=new B4(this,e),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return t===void 0&&(this._textureNodes[e]===void 0&&this.getTextureNode(e),t=new B4(this,e,!0),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(t===void 0){let n=this._cameraNear,r=this._cameraFar;this._viewZNodes[e]=t=LP(this.getTextureNode(e),n,r)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(t===void 0){let n=this._cameraNear,r=this._cameraFar,s=this.getViewZNode(e);this._linearDepthNodes[e]=t=Yg(s,n,r)}return t}async compileAsync(e){let t=e.getRenderTarget(),n=e.getMRT();e.setRenderTarget(this.renderTarget),e.setMRT(this._mrt),await e.compileAsync(this.scene,this.camera),e.setRenderTarget(t),e.setMRT(n)}setup({renderer:e}){return this.renderTarget.samples=this.options.samples===void 0?e.samples:this.options.samples,this.renderTarget.texture.type=e.getOutputBufferType(),e.reversedDepthBuffer===!0&&this.renderTarget.depthTexture!==null&&(this.renderTarget.depthTexture.type=cr),this.scope===i.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){let{renderer:t}=e,{scene:n}=this,r,s=t.getOutputRenderTarget();s&&s.isXRRenderTarget===!0?(r=t.xr.getCamera(),t.xr.updateCamera(r),PR.set(s.width,s.height)):(r=this.camera,t.getDrawingBufferSize(PR)),this.setSize(PR.width,PR.height);let o=t.getRenderTarget(),a=t.getMRT(),l=t.autoClear,c=t.transparent,u=t.opaque,f=r.layers.mask,d=t.contextNode,A=n.overrideMaterial;this._cameraNear.value=r.near,this._cameraFar.value=r.far,this._layers!==null&&(r.layers.mask=this._layers.mask);for(let w in this._previousTextures)this.toggleTexture(w);this.overrideMaterial!==null&&(n.overrideMaterial=this.overrideMaterial),t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.autoClear=!0,t.transparent=this.transparent,t.opaque=this.opaque,this.contextNode!==null&&((this._contextNodeCache===null||this._contextNodeCache.version!==this.version)&&(this._contextNodeCache={version:this.version,context:ep({...t.contextNode.getFlowContextData(),...this.contextNode.getFlowContextData()})}),t.contextNode=this._contextNodeCache.context);let y=n.name;n.name=this.name?this.name:n.name,t.render(n,r),n.name=y,n.overrideMaterial=A,t.setRenderTarget(o),t.setMRT(a),t.autoClear=l,t.transparent=c,t.opaque=u,t.contextNode=d,r.layers.mask=f}setSize(e,t){this._width=e,this._height=t;let n=Math.floor(this._width*this._resolutionScale),r=Math.floor(this._height*this._resolutionScale);this.renderTarget.setSize(n,r),this._scissor!==null?(this.renderTarget.scissor.copy(this._scissor).multiplyScalar(this._resolutionScale).floor(),this.renderTarget.scissorTest=!0):this.renderTarget.scissorTest=!1,this._viewport!==null&&this.renderTarget.viewport.copy(this._viewport).multiplyScalar(this._resolutionScale).floor()}setScissor(e,t,n,r){e===null?this._scissor=null:(this._scissor===null&&(this._scissor=new xn),e.isVector4?this._scissor.copy(e):this._scissor.set(e,t,n,r))}setViewport(e,t,n,r){e===null?this._viewport=null:(this._viewport===null&&(this._viewport=new xn),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,n,r))}dispose(){this.renderTarget.dispose()}};Ef.COLOR="color";Ef.DEPTH="depth";var XCe=(i,e,t)=>new Ef(Ef.COLOR,i,e,t),$Ce=(i,e)=>new F4(i,e),YCe=(i,e,t)=>new Ef(Ef.DEPTH,i,e,t),Sk=class extends Ef{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,s){super(Ef.COLOR,e,t),this.colorNode=n,this.thicknessNode=r,this.alphaNode=s,this._materialCache=new WeakMap,this.name="Outline Pass"}updateBefore(e){let{renderer:t}=e,n=t.getRenderObjectFunction();t.setRenderObjectFunction((r,s,o,a,l,c,u,f)=>{if((l.isMeshToonMaterial||l.isMeshToonNodeMaterial)&&l.wireframe===!1){let d=this._getOutlineMaterial(l);t.renderObject(r,s,o,a,d,c,u,f)}t.renderObject(r,s,o,a,l,c,u,f)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){let e=new Pr;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=mi;let t=wa.negate(),n=Ja.mul(bf),r=oe(1),s=n.mul(Ft(Mr,1)),o=n.mul(Ft(Mr.add(t),1)),a=ya(s.sub(o));return e.vertexNode=s.add(a.mul(this.thicknessNode).mul(s.w).mul(r)),e.colorNode=Ft(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return t===void 0&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}},ZCe=(i,e,t=new zt(0,0,0),n=.003,r=1)=>new Sk(i,e,Ht(t),Ht(n),Ht(r)),Dse=me(([i,e])=>i.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Nse=me(([i,e])=>(i=i.mul(e),i.div(i.add(1)).clamp())).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Fse=me(([i,e])=>{i=i.mul(e),i=i.sub(.004).max(0);let t=i.mul(i.mul(6.2).add(.5)),n=i.mul(i.mul(6.2).add(1.7)).add(.06);return t.div(n).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),KCe=me(([i])=>{let e=i.mul(i.add(.0245786)).sub(90537e-9),t=i.mul(i.add(.432951).mul(.983729)).add(.238081);return e.div(t)}),Bse=me(([i,e])=>{let t=To(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=To(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return i=i.mul(e).div(.6),i=t.mul(i),i=KCe(i),i=n.mul(i),i.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),QCe=To(pe(1.6605,-.1246,-.0182),pe(-.5876,1.1329,-.1006),pe(-.0728,-.0083,1.1187)),JCe=To(pe(.6274,.0691,.0164),pe(.3293,.9195,.088),pe(.0433,.0113,.8956)),eRe=me(([i])=>{let e=pe(i).toVar(),t=pe(e.mul(e)).toVar(),n=pe(t.mul(t)).toVar();return oe(15.5).mul(n.mul(t)).sub(Tn(40.14,n.mul(e))).add(Tn(31.96,n).sub(Tn(6.868,t.mul(e))).add(Tn(.4298,t).add(Tn(.1191,e).sub(.00232))))}),Ose=me(([i,e])=>{let t=pe(i).toVar(),n=To(pe(.856627153315983,.137318972929847,.11189821299995),pe(.0951212405381588,.761241990602591,.0767994186031903),pe(.0482516061458583,.101439036467562,.811302368396859)),r=To(pe(1.1271005818144368,-.1413297634984383,-.14132976349843826),pe(-.11060664309660323,1.157823702216272,-.11060664309660294),pe(-.016493938717834573,-.016493938717834257,1.2519364065950405)),s=oe(-12.47393),o=oe(4.026069);return t.mulAssign(e),t.assign(JCe.mul(t)),t.assign(n.mul(t)),t.assign(zr(t,1e-10)),t.assign(Af(t)),t.assign(t.sub(s).div(o.sub(s))),t.assign(Yu(t,0,1)),t.assign(eRe(t)),t.assign(r.mul(t)),t.assign(eu(zr(pe(0),t),pe(2.2))),t.assign(QCe.mul(t)),t.assign(Yu(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Use=me(([i,e])=>{let t=oe(.76),n=oe(.15);i=i.mul(e);let r=Pl(i.r,Pl(i.g,i.b)),s=xa(r.lessThan(.08),r.sub(Tn(6.25,r.mul(r))),.04);i.subAssign(s);let o=zr(i.r,zr(i.g,i.b));$t(o.lessThan(t),()=>i);let a=ai(1,t),l=ai(1,a.mul(a).div(o.add(a.sub(t))));i.mulAssign(l.div(o));let c=ai(1,pc(1,n.mul(o.sub(l)).add(1)));return Qn(i,pe(l),c)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),hr=class extends Kt{static get type(){return"CodeNode"}constructor(e="",t=[],n=""){super("code"),this.isCodeNode=!0,this.global=!0,this.code=e,this.includes=t,this.language=n}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){let t=this.getIncludes(e);for(let r of t)r.build(e);let n=e.getCodeFromNode(this,this.getNodeType(e));return n.code=this.code,n.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}},OP=$n(hr).setParameterLength(1,3),tRe=(i,e)=>OP(i,e,"js"),nRe=(i,e)=>OP(i,e,"wgsl"),iRe=(i,e)=>OP(i,e,"glsl"),O4=class extends hr{static get type(){return"FunctionNode"}constructor(e="",t=[],n=""){super(e,t,n)}generateNodeType(e){return this.getNodeFunction(e).type}getMemberType(e,t){let n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){let t=e.getDataFromNode(this),n=t.nodeFunction;return n===void 0&&(n=e.parser.parseFunction(this.code),t.nodeFunction=n),n}generate(e,t){super.generate(e);let n=this.getNodeFunction(e),r=n.name,s=n.type,o=e.getCodeFromNode(this,s);r!==""&&(o.name=r);let a=e.getPropertyName(o),l=this.getNodeFunction(e).getCode(a);return o.code=l+`4159+`,t==="property"?a:e.format(`${a}()`,s,t)}},kse=(i,e=[],t="")=>{let n=new O4(i,e,t);return hz((...s)=>n.call(...s),n)},rRe=(i,e)=>kse(i,e,"glsl"),sRe=(i,e)=>kse(i,e,"wgsl");function TV(i){let e,t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||xs.z).negate()}var zse=me(([i,e],t)=>{let n=TV(t);return mc(i,e,n)}),Vse=me(([i],e)=>{let t=TV(e);return i.mul(i,t,t).negate().exp().oneMinus()}),oRe=me(([i,e],t)=>{let n=TV(t),s=e.sub(_f.y).max(0).toConst().mul(n).toConst();return i.mul(i,s,s).negate().exp().oneMinus()}),Tk=me(([i,e])=>Ft(e.toFloat().mix(ox.rgb,i.toVec3()),ox.a)),Ng=null,Fg=null,Ek=class extends Kt{static get type(){return"RangeNode"}constructor(e=oe(),t=oe()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){let t=this.getConstNode(this.minNode),n=this.getConstNode(this.maxNode),r=e.getTypeLength(fm(t.value)),s=e.getTypeLength(fm(n.value));return r>s?r:s}generateNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}getConstNode(e){let t=null;if(e.traverse(n=>{n.isConstNode===!0&&(t=n)}),t===null)throw new m4('THREE.TSL: No "ConstNode" found in node graph.',this.stackTrace);return t}setup(e){let t=e.object,n=null;if(t.count>1){let r=this.getConstNode(this.minNode),s=this.getConstNode(this.maxNode),o=r.value,a=s.value,l=e.getTypeLength(fm(o)),c=e.getTypeLength(fm(a));Ng=Ng||new xn,Fg=Fg||new xn,Ng.setScalar(0),Fg.setScalar(0),l===1?Ng.setScalar(o):o.isColor?Ng.set(o.r,o.g,o.b,1):Ng.set(o.x,o.y,o.z||0,o.w||0),c===1?Fg.setScalar(a):a.isColor?Fg.set(a.r,a.g,a.b,1):Fg.set(a.x,a.y,a.z||0,a.w||0);let u=4,f=u*t.count,d=new Float32Array(f);for(let w=0;w<f;w++){let S=w%u,T=Ng.getComponent(S),R=Fg.getComponent(S);d[w]=Bu.lerp(T,R,Math.random())}let A=this.getNodeType(e);if(t.count*4*4<=e.getUniformBufferLimit())n=bx(d,"vec4",t.count).element(Xu).convert(A);else{let w=new Ql(d,4);e.geometry.setAttribute("__range"+this.id,w),n=MP(w).convert(A)}}else n=oe(0);return n}},aRe=$n(Ek).setParameterLength(2),Mk=class extends Kt{static get type(){return"ComputeBuiltinNode"}constructor(e,t){super(t),this._builtinName=e}getHash(e){return this.getBuiltinName(e)}generateNodeType(){return this.nodeType}setBuiltinName(e){return this._builtinName=e,this}getBuiltinName(){return this._builtinName}hasBuiltin(e){return e.hasBuiltin(this._builtinName)}generate(e,t){let n=this.getBuiltinName(e),r=this.getNodeType(e);return e.shaderStage==="compute"?e.format(n,r,t):(Xe(`ComputeBuiltinNode: Compute built-in value ${n} can not be accessed in the ${e.shaderStage} stage`),e.generateConst(r))}serialize(e){super.serialize(e),e.global=this.global,e._builtinName=this._builtinName}deserialize(e){super.deserialize(e),this.global=e.global,this._builtinName=e._builtinName}},BS=(i,e)=>new Mk(i,e),lRe=BS("numWorkgroups","uvec3"),cRe=BS("workgroupId","uvec3"),uRe=BS("globalId","uvec3"),hRe=BS("localId","uvec3"),fRe=BS("subgroupSize","uint"),Ck=class extends Kt{constructor(e){super(),this.scope=e,this.isBarrierNode=!0}setup(e){e.allowEarlyReturns=!1,e.allowGlobalVariables=!1}generate(e){let{scope:t}=this,{renderer:n}=e;n.backend.isWebGLBackend===!0?e.addFlowCode(` // ${t}Barrier 4160+`):e.addLineFlowCode(`${t}Barrier()`,this)}},EV=$n(Ck),dRe=()=>EV("workgroup").toStack(),pRe=()=>EV("storage").toStack(),mRe=()=>EV("texture").toStack(),Rk=class extends Zd{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n,r=e.isContextAssign();if(n=super.generate(e),r!==!0){let s=this.getNodeType(e);n=e.format(n,s,t)}return n}},Pk=class extends Kt{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e,this.name=""}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.',new ts),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new Rk(this,e)}generate(e){let t=this.name!==""?this.name:`${this.scope}Array_${this.id}`;return e.getScopedArray(t,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}},ARe=(i,e)=>new Pk("Workgroup",i,e),Ls=class extends Kt{static get type(){return"AtomicFunctionNode"}constructor(e,t,n){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.parents=!0}getInputType(e){return this.pointerNode.getNodeType(e)}generateNodeType(e){return this.getInputType(e)}generate(e){let t=e.getNodeProperties(this),n=t.parents,r=this.method,s=this.getNodeType(e),o=this.getInputType(e),a=this.pointerNode,l=this.valueNode,c=[];c.push(`&${a.build(e,o)}`),l!==null&&c.push(l.build(e,o));let u=`${e.getMethod(r,s)}( ${c.join(", ")} )`;if(n?n.length===1&&n[0].isStackNode===!0:!1)e.addLineFlowCode(u,this);else return t.constNode===void 0&&(t.constNode=hc(u,s).toConst()),t.constNode.build(e)}};Ls.ATOMIC_LOAD="atomicLoad";Ls.ATOMIC_STORE="atomicStore";Ls.ATOMIC_ADD="atomicAdd";Ls.ATOMIC_SUB="atomicSub";Ls.ATOMIC_MAX="atomicMax";Ls.ATOMIC_MIN="atomicMin";Ls.ATOMIC_AND="atomicAnd";Ls.ATOMIC_OR="atomicOr";Ls.ATOMIC_XOR="atomicXor";var gRe=$n(Ls),Cf=(i,e,t)=>gRe(i,e,t).toStack(),vRe=i=>Cf(Ls.ATOMIC_LOAD,i,null),_Re=(i,e)=>Cf(Ls.ATOMIC_STORE,i,e),xRe=(i,e)=>Cf(Ls.ATOMIC_ADD,i,e),yRe=(i,e)=>Cf(Ls.ATOMIC_SUB,i,e),bRe=(i,e)=>Cf(Ls.ATOMIC_MAX,i,e),wRe=(i,e)=>Cf(Ls.ATOMIC_MIN,i,e),SRe=(i,e)=>Cf(Ls.ATOMIC_AND,i,e),TRe=(i,e)=>Cf(Ls.ATOMIC_OR,i,e),ERe=(i,e)=>Cf(Ls.ATOMIC_XOR,i,e),Ot=class i extends Rr{static get type(){return"SubgroupFunctionNode"}constructor(e,t=null,n=null){super(),this.method=e,this.aNode=t,this.bNode=n}getInputType(e){let t=this.aNode?this.aNode.getNodeType(e):null,n=this.bNode?this.bNode.getNodeType(e):null,r=e.isMatrix(t)?0:e.getTypeLength(t),s=e.isMatrix(n)?0:e.getTypeLength(n);return r>s?t:n}generateNodeType(e){let t=this.method;return t===i.SUBGROUP_ELECT?"bool":t===i.SUBGROUP_BALLOT?"uvec4":this.getInputType(e)}generate(e,t){let n=this.method,r=this.getNodeType(e),s=this.getInputType(e),o=this.aNode,a=this.bNode,l=[];if(n===i.SUBGROUP_BROADCAST||n===i.SUBGROUP_SHUFFLE||n===i.QUAD_BROADCAST){let u=a.getNodeType(e);l.push(o.build(e,r),a.build(e,u==="float"?"int":r))}else n===i.SUBGROUP_SHUFFLE_XOR||n===i.SUBGROUP_SHUFFLE_DOWN||n===i.SUBGROUP_SHUFFLE_UP?l.push(o.build(e,r),a.build(e,"uint")):(o!==null&&l.push(o.build(e,s)),a!==null&&l.push(a.build(e,s)));let c=l.length===0?"()":`( ${l.join(", ")} )`;return e.format(`${e.getMethod(n,r)}${c}`,r,t)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};Ot.SUBGROUP_ELECT="subgroupElect";Ot.SUBGROUP_BALLOT="subgroupBallot";Ot.SUBGROUP_ADD="subgroupAdd";Ot.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd";Ot.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd";Ot.SUBGROUP_MUL="subgroupMul";Ot.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul";Ot.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul";Ot.SUBGROUP_AND="subgroupAnd";Ot.SUBGROUP_OR="subgroupOr";Ot.SUBGROUP_XOR="subgroupXor";Ot.SUBGROUP_MIN="subgroupMin";Ot.SUBGROUP_MAX="subgroupMax";Ot.SUBGROUP_ALL="subgroupAll";Ot.SUBGROUP_ANY="subgroupAny";Ot.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst";Ot.QUAD_SWAP_X="quadSwapX";Ot.QUAD_SWAP_Y="quadSwapY";Ot.QUAD_SWAP_DIAGONAL="quadSwapDiagonal";Ot.SUBGROUP_BROADCAST="subgroupBroadcast";Ot.SUBGROUP_SHUFFLE="subgroupShuffle";Ot.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor";Ot.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp";Ot.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown";Ot.QUAD_BROADCAST="quadBroadcast";var MRe=ct(Ot,Ot.SUBGROUP_ELECT).setParameterLength(0),CRe=ct(Ot,Ot.SUBGROUP_BALLOT).setParameterLength(1),RRe=ct(Ot,Ot.SUBGROUP_ADD).setParameterLength(1),PRe=ct(Ot,Ot.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),IRe=ct(Ot,Ot.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),LRe=ct(Ot,Ot.SUBGROUP_MUL).setParameterLength(1),DRe=ct(Ot,Ot.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),NRe=ct(Ot,Ot.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),FRe=ct(Ot,Ot.SUBGROUP_AND).setParameterLength(1),BRe=ct(Ot,Ot.SUBGROUP_OR).setParameterLength(1),ORe=ct(Ot,Ot.SUBGROUP_XOR).setParameterLength(1),URe=ct(Ot,Ot.SUBGROUP_MIN).setParameterLength(1),kRe=ct(Ot,Ot.SUBGROUP_MAX).setParameterLength(1),zRe=ct(Ot,Ot.SUBGROUP_ALL).setParameterLength(0),VRe=ct(Ot,Ot.SUBGROUP_ANY).setParameterLength(0),GRe=ct(Ot,Ot.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),qRe=ct(Ot,Ot.QUAD_SWAP_X).setParameterLength(1),HRe=ct(Ot,Ot.QUAD_SWAP_Y).setParameterLength(1),WRe=ct(Ot,Ot.QUAD_SWAP_DIAGONAL).setParameterLength(1),jRe=ct(Ot,Ot.SUBGROUP_BROADCAST).setParameterLength(2),XRe=ct(Ot,Ot.SUBGROUP_SHUFFLE).setParameterLength(2),$Re=ct(Ot,Ot.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),YRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_UP).setParameterLength(2),ZRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),KRe=ct(Ot,Ot.QUAD_BROADCAST).setParameterLength(1),IR;function UP(i){IR=IR||new WeakMap;let e=IR.get(i);return e===void 0&&IR.set(i,e={}),e}function kP(i){let e=UP(i);return e.shadowMatrix||(e.shadowMatrix=Xt("mat4").setGroup(Jt).onRenderUpdate(t=>((i.castShadow!==!0||t.renderer.shadowMap.enabled===!1)&&(i.shadow.camera.coordinateSystem!==t.camera.coordinateSystem&&(i.shadow.camera.coordinateSystem=t.camera.coordinateSystem,i.shadow.camera.updateProjectionMatrix()),i.shadow.updateMatrices(i)),i.shadow.matrix)))}function Gse(i,e=_f){let t=kP(i).mul(e);return t.xyz.div(t.w)}function MV(i){let e=UP(i);return e.position||(e.position=Xt(new re).setGroup(Jt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function qse(i){let e=UP(i);return e.targetPosition||(e.targetPosition=Xt(new re).setGroup(Jt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function CV(i){let e=UP(i);return e.viewPosition||(e.viewPosition=Xt(new re).setGroup(Jt).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new re,n.value.setFromMatrixPosition(i.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}var RV=i=>wm.transformDirection(MV(i).sub(qse(i))),QRe=Jd("vec3","totalDiffuse"),JRe=Jd("vec3","totalSpecular"),e4e=Jd("vec3","outgoingLight"),t4e=i=>i.sort((e,t)=>e.id-t.id),n4e=(i,e)=>{for(let t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},rU=new WeakMap,Hw=[],SS=class extends Kt{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=QRe,this.totalSpecularNode=JRe,this.outgoingLightNode=e4e,this._lights=[],this.global=!0}customCacheKey(){let e=this._lights;for(let n=0;n<e.length;n++){let r=e[n];if(Hw.push(r.id),Hw.push(r.castShadow?1:0),r.isSpotLight===!0){let s=r.map!==null?r.map.id:-1,o=r.colorNode?r.colorNode.getCacheKey():-1;Hw.push(s,o)}}let t=LS(Hw);return Hw.length=0,t}getHash(e){let t=e.getDataFromNode(this);if(t.lightNodesHash===void 0){let n=this.setupLightsNode(e);t.lightNodes=n;let r=[];for(let s of n)r.push(s.getHash());t.lightNodesHash="lights-"+r.join(",")}return t.lightNodesHash}analyze(e){let t=e.getNodeProperties(this);for(let n of t.nodes)n.build(e);t.outputNode.build(e)}setupLightsNode(e){let t=e.getDataFromNode(this),n=[],r=t.lightNodes||null,s=e.context.materialLightings,o=t4e([...s,...this._lights]),a=e.renderer.library;for(let l of o)if(l.isNode)n.push(l);else{let c=null;if(r!==null&&(c=n4e(l.id,r)),c===null){let u=a.getLightNodeClass(l.constructor);if(u===null){Xe(`LightsNode.setupNodeLights: Light node not found for ${l.constructor.name}`);continue}rU.has(l)===!1&&rU.set(l,new u(l)),c=rU.get(l)}n.push(c)}return n}setupDirectLight(e,t,n){let{lightingModel:r,reflectedLight:s}=e.context;r.direct({...n,lightNode:t,reflectedLight:s},e)}setupDirectRectAreaLight(e,t,n){let{lightingModel:r,reflectedLight:s}=e.context;r.directRectArea({...n,lightNode:t,reflectedLight:s},e)}setupLights(e,t){for(let n of t)n.build(e)}getLightNodes(e){let t=e.getDataFromNode(this);return t.lightNodes===void 0&&(t.lightNodes=this.setupLightsNode(e)),t.lightNodes}setup(e){let t=e.lightsNode;e.lightsNode=this;let n=this.outgoingLightNode,r=e.context,s=r.lightingModel,o=e.getNodeProperties(this);if(s){let{totalDiffuseNode:a,totalSpecularNode:l}=this;r.outgoingLight=n;let c=e.addStack();o.nodes=c.nodes,s.start(e);let{backdrop:u,backdropAlpha:f}=r,{directDiffuse:d,directSpecular:A,indirectDiffuse:y,indirectSpecular:w}=r.reflectedLight,S=d.add(y);u!==null&&(f!==null?S=pe(f.mix(S,u)):S=pe(u)),a.assign(S),l.assign(A.add(w)),n.assign(a.add(l)),s.finish(e),n=n.bypass(e.removeStack())}else o.nodes=[];return e.lightsNode=t,n}setLights(e){return this._lights=e,this}getLights(){return this._lights}get hasLights(){return this._lights.length>0}},i4e=(i=[])=>new SS().setLights(i),Ik=class extends Kt{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=yn.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){PV.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||_f)}},PV=Jd("vec3","shadowPositionWorld");function r4e(i,e={}){return e.toneMapping=i.toneMapping,e.toneMappingExposure=i.toneMappingExposure,e.outputColorSpace=i.outputColorSpace,e.renderTarget=i.getRenderTarget(),e.activeCubeFace=i.getActiveCubeFace(),e.activeMipmapLevel=i.getActiveMipmapLevel(),e.renderObjectFunction=i.getRenderObjectFunction(),e.pixelRatio=i.getPixelRatio(),e.mrt=i.getMRT(),e.clearColor=i.getClearColor(e.clearColor||new zt),e.clearAlpha=i.getClearAlpha(),e.autoClear=i.autoClear,e.scissorTest=i.getScissorTest(),e}function s4e(i,e){return e=r4e(i,e),i.setMRT(null),i.setRenderObjectFunction(null),i.setClearColor(0,1),i.autoClear=!0,e}function o4e(i,e){i.toneMapping=e.toneMapping,i.toneMappingExposure=e.toneMappingExposure,i.outputColorSpace=e.outputColorSpace,i.setRenderTarget(e.renderTarget,e.activeCubeFace,e.activeMipmapLevel),i.setRenderObjectFunction(e.renderObjectFunction),i.setPixelRatio(e.pixelRatio),i.setMRT(e.mrt),i.setClearColor(e.clearColor,e.clearAlpha),i.autoClear=e.autoClear,i.setScissorTest(e.scissorTest)}function a4e(i,e={}){return e.background=i.background,e.backgroundNode=i.backgroundNode,e.overrideMaterial=i.overrideMaterial,e}function l4e(i,e){return e=a4e(i,e),i.background=null,i.backgroundNode=null,i.overrideMaterial=null,e}function c4e(i,e){i.background=e.background,i.backgroundNode=e.backgroundNode,i.overrideMaterial=e.overrideMaterial}function u4e(i,e,t){return t=s4e(i,t),t=l4e(e,t),t}function h4e(i,e,t){o4e(i,t),c4e(e,t)}var U4=new WeakMap,Hse=me(({depthTexture:i,shadowCoord:e,depthLayer:t})=>{let n=fi(i,e.xy).setName("t_basic");return i.isArrayTexture&&(n=n.depth(t)),n.compare(e.z)}),Wse=me(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=(u,f)=>{let d=fi(i,u);return i.isArrayTexture&&(d=d.depth(n)),d.compare(f)},s=mr("mapSize","vec2",t).setGroup(Jt),o=mr("radius","float",t).setGroup(Jt),a=dt(1).div(s),l=o.mul(a.x),c=bV(u1.xy).mul(6.28318530718);return Ps(r(e.xy.add(Wu(0,5,c).mul(l)),e.z),r(e.xy.add(Wu(1,5,c).mul(l)),e.z),r(e.xy.add(Wu(2,5,c).mul(l)),e.z),r(e.xy.add(Wu(3,5,c).mul(l)),e.z),r(e.xy.add(Wu(4,5,c).mul(l)),e.z)).mul(1/5)}),jse=me(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=mr("mapSize","vec2",t).setGroup(Jt),s=dt(1).div(r),o=e.xy,a=$u(o.mul(r).add(.5)).toConst();o.subAssign(a.sub(.5).mul(s));let l=A=>{let y=fi(i,o).offset(A).gather();return i.isArrayTexture&&(y=y.depth(n)),y.compare(e.z)},c=l(kr(-1,1)).toConst(),u=l(kr(1,1)).toConst(),f=l(kr(-1,-1)).toConst(),d=l(kr(1,-1)).toConst();return Ps(Qn(c.x,u.y,a.x).add(c.y).add(u.x).mul(a.y),Qn(c.w,u.z,a.x).add(c.z).add(u.w),Qn(f.x,d.y,a.x).add(f.y).add(d.x),Qn(f.w,d.z,a.x).add(f.z).add(d.w).mul(a.y.oneMinus())).mul(1/9)}),Xse=me(({depthTexture:i,shadowCoord:e,depthLayer:t},n)=>{let r=fi(i).sample(e.xy);i.isArrayTexture&&(r=r.depth(t)),r=r.rg;let s=r.x,o=zr(1e-7,r.y.mul(r.y)),a=n.renderer.reversedDepthBuffer?Jg(s,e.z):Jg(e.z,s),l=oe(1).toVar();return $t(a.notEqual(1),()=>{let c=e.z.sub(s),u=o.div(o.add(c.mul(c)));u=Yu(ai(u,.3).div(.65)),l.assign(zr(a,u))}),l}),$se=i=>{let e=U4.get(i);return e===void 0&&(e=new Pr,e.colorNode=Ft(0,0,0,1),e.isShadowPassMaterial=!0,e.name="ShadowMaterial",e.blending=ps,e.fog=!1,U4.set(i,e)),e},Yse=i=>{let e=U4.get(i);e!==void 0&&(e.dispose(),U4.delete(i))},Ste=new Sf,H_=[],Zse=(i,e,t,n)=>{H_[0]=i,H_[1]=e;let r=Ste.get(H_);return(r===void 0||r.shadowType!==t||r.useVelocity!==n)&&(r=(s,o,a,l,c,u,f,d,A)=>{(s.castShadow===!0||s.receiveShadow&&t===Vc)&&(n&&(rne(s).useVelocity=!0),s.onBeforeShadow(i,s,a,e.camera,l,o.overrideMaterial,u),i.renderObject(s,o,a,l,c,u,f,d,A),s.onAfterShadow(i,s,a,e.camera,l,o.overrideMaterial,u))},r.shadowType=t,r.useVelocity=n,Ste.set(H_,r)),H_[0]=null,H_[1]=null,r},f4e=me(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{let s=oe(0).toVar("meanVertical"),o=oe(0).toVar("squareMeanVertical"),a=i.lessThanEqual(oe(1)).select(oe(0),oe(2).div(i.sub(1))),l=i.lessThanEqual(oe(1)).select(oe(0),oe(-1));Oi({start:de(0),end:de(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(oe(u).mul(a)),d=n.sample(Ps(u1.xy,dt(0,f).mul(e)).div(t));n.value.isArrayTexture&&(d=d.depth(r)),d=d.x,s.addAssign(d),o.addAssign(d.mul(d))}),s.divAssign(i),o.divAssign(i);let c=el(o.sub(s.mul(s)).max(0));return dt(s,c)}),d4e=me(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{let s=oe(0).toVar("meanHorizontal"),o=oe(0).toVar("squareMeanHorizontal"),a=i.lessThanEqual(oe(1)).select(oe(0),oe(2).div(i.sub(1))),l=i.lessThanEqual(oe(1)).select(oe(0),oe(-1));Oi({start:de(0),end:de(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(oe(u).mul(a)),d=n.sample(Ps(u1.xy,dt(f,0).mul(e)).div(t));n.value.isArrayTexture&&(d=d.depth(r)),s.addAssign(d.x),o.addAssign(Ps(d.y.mul(d.y),d.x.mul(d.x)))}),s.divAssign(i),o.divAssign(i);let c=el(o.sub(s.mul(s)).max(0));return dt(s,c)}),p4e=[Hse,Wse,jse,Xse],sU,LR=new wS,k4=class extends Ik{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this._currentShadowType=null,this._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s,depthLayer:o}){let a=r.x.greaterThanEqual(0).and(r.x.lessThanEqual(1)).and(r.y.greaterThanEqual(0)).and(r.y.lessThanEqual(1)).and(r.z.lessThanEqual(1)),l=t({depthTexture:n,shadowCoord:r,shadow:s,depthLayer:o});return a.select(l,oe(1))}setupShadowCoord(e,t){let{shadow:n}=this,{renderer:r}=e,s=n.biasNode||mr("bias","float",n).setGroup(Jt),o=t,a;if(n.camera.isOrthographicCamera||r.logarithmicDepthBuffer!==!0)o=o.xyz.div(o.w),a=o.z;else{let l=o.w;o=o.xy.div(l);let c=mr("near","float",n.camera).setGroup(Jt),u=mr("far","float",n.camera).setGroup(Jt);a=DP(l.negate(),c,u)}return o=pe(o.x,o.y.oneMinus(),r.reversedDepthBuffer?a.sub(s):a.add(s)),o}getShadowFilterFn(e){return p4e[e]}setupRenderTarget(e,t){let n=new Es(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Fu:Xh;let r=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return r.texture.name="ShadowMap",r.texture.type=e.mapType,r.depthTexture=n,{shadowMap:r,depthTexture:n}}setupShadow(e){let{renderer:t,camera:n}=e,{light:r,shadow:s}=this,{depthTexture:o,shadowMap:a}=this.setupRenderTarget(s,e),l=t.shadowMap.type,c=t.hasCompatibility(Bd.TEXTURE_COMPARE);if((l===d0||l===LM)&&c?(o.minFilter=Mi,o.magFilter=Mi):(o.minFilter=Ti,o.magFilter=Ti),s.camera.coordinateSystem=n.coordinateSystem,s.camera.updateProjectionMatrix(),l===Vc&&s.isPointLightShadow!==!0){o.compareFunction=null,a.depth>1?(a._vsmShadowMapVertical||(a._vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Ws,type:Wi,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapVertical.texture.name="VSMVertical"),this.vsmShadowMapVertical=a._vsmShadowMapVertical,a._vsmShadowMapHorizontal||(a._vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Ws,type:Wi,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapHorizontal.texture.name="VSMHorizontal"),this.vsmShadowMapHorizontal=a._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Ws,type:Wi,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Ws,type:Wi,depthBuffer:!1}));let D=fi(o);o.isArrayTexture&&(D=D.depth(this.depthLayer));let L=fi(this.vsmShadowMapVertical.texture);o.isArrayTexture&&(L=L.depth(this.depthLayer));let C=mr("blurSamples","float",s).setGroup(Jt),B=mr("radius","float",s).setGroup(Jt),k=mr("mapSize","vec2",s).setGroup(Jt),z=this.vsmMaterialVertical||(this.vsmMaterialVertical=new Pr);z.fragmentNode=f4e({samples:C,radius:B,size:k,shadowPass:D,depthLayer:this.depthLayer}).context(e.getSharedContext()),z.name="VSMVertical",z=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new Pr),z.fragmentNode=d4e({samples:C,radius:B,size:k,shadowPass:L,depthLayer:this.depthLayer}).context(e.getSharedContext()),z.name="VSMHorizontal"}let u=mr("intensity","float",s).setGroup(Jt),f=mr("normalBias","float",s).setGroup(Jt),d=kP(r),A=Sm.mul(f),y;!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld?y=d.mul(PV.add(A)):y=Xt("mat4").onObjectUpdate(({object:L},C)=>C.value.multiplyMatrices(d.value,L.matrixWorld)).mul(Mr).add(d.mul(Ft(A,0)));let w=this.setupShadowCoord(e,y),S=s.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(S===null)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");let T=l===Vc&&s.isPointLightShadow!==!0?this.vsmShadowMapHorizontal.texture:o,R=this.setupShadowFilter(e,{filterFn:S,shadowTexture:a.texture,depthTexture:T,shadowCoord:w,shadow:s,depthLayer:this.depthLayer}),I;t.shadowMap.transmitted===!0&&(a.texture.isCubeTexture?I=Qa(a.texture,w.xyz):(I=fi(a.texture,w),o.isArrayTexture&&(I=I.depth(this.depthLayer))));let P;I?P=Qn(1,R.rgb.mix(I,1),u.mul(I.a)).toVar():P=Qn(1,R,u).toVar(),this.shadowMap=a,this.shadow.map=a;let F=`${this.light.type} Shadow [ ${this.light.name||"ID: "+this.light.id} ]`;return I&&P.toInspector(`${F} / Color`,()=>this.shadowMap.texture.isCubeTexture?Qa(this.shadowMap.texture,w7()):fi(this.shadowMap.texture)),P.toInspector(`${F} / Depth`,()=>{let D=mr("near","float",this.shadow.camera),L=mr("far","float",this.shadow.camera),C;this.shadowMap.texture.isCubeTexture?C=Qa(this.shadowMap.depthTexture,w7()).r:C=fi(this.shadowMap.depthTexture).r;let B;return this.shadow.camera.isPerspectiveCamera?B=LP(C,D,L):B=Jre(C,D,L),B=Yg(B,D,L),B.oneMinus()})}setup(e){if(e.renderer.shadowMap.enabled!==!1)return me(()=>{let t=e.renderer.shadowMap.type;this._currentShadowType!==t&&(this._reset(),this._node=null);let n=this._node;return this.setupShadowPosition(e),n===null&&(this._node=n=this.setupShadow(e),this._currentShadowType=t),e.material.receivedShadowNode&&(n=e.material.receivedShadowNode(n)),n})()}renderShadow(e){let{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:o}=e;t.updateMatrices(r),n.setSize(t.mapSize.width,t.mapSize.height,n.depth);let a=o.name;o.name=`Shadow Map [ ${r.name||"ID: "+r.id} ]`,s.render(o,t.camera),o.name=a}updateShadow(e){let{shadowMap:t,light:n,shadow:r}=this,{renderer:s,scene:o,camera:a}=e,l=s.shadowMap.type,c=t.depthTexture.version;this._depthVersionCached=c;let u=r.camera.layers.mask;(r.camera.layers.mask&4294967294)===0&&(r.camera.layers.mask=a.layers.mask);let f=s.getRenderObjectFunction(),d=s.getMRT(),A=d?d.has("velocity"):!1;sU=u4e(s,o,sU),o.overrideMaterial=$se(n),s.setRenderObjectFunction(Zse(s,r,l,A)),s.setClearColor(0,0),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(f),l===Vc&&r.isPointLightShadow!==!0&&this.vsmPass(s),r.camera.layers.mask=u,h4e(s,o,sU)}vsmPass(e){let{shadow:t}=this,n=this.shadowMap.depth;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height,n),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height,n),e.setRenderTarget(this.vsmShadowMapVertical),LR.material=this.vsmMaterialVertical,LR.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),LR.material=this.vsmMaterialHorizontal,LR.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,Yse(this.light),this.shadowMap&&(this.shadowMap.dispose(),this.shadowMap=null),this.vsmShadowMapVertical!==null&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),this.vsmShadowMapHorizontal!==null&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null)}updateBefore(e){let{shadow:t}=this,n=t.needsUpdate||t.autoUpdate;n&&(this._cameraFrameId[e.camera]===e.frameId&&(n=!1),this._cameraFrameId[e.camera]=e.frameId),n&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}},Kse=(i,e)=>new k4(i,e),m4e=new zt,Tte=new cn,Ww=new re,oU=new re,A4e=[new re(1,0,0),new re(-1,0,0),new re(0,-1,0),new re(0,1,0),new re(0,0,1),new re(0,0,-1)],g4e=[new re(0,-1,0),new re(0,-1,0),new re(0,0,-1),new re(0,0,1),new re(0,-1,0),new re(0,-1,0)],v4e=[new re(1,0,0),new re(-1,0,0),new re(0,1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1)],_4e=[new re(0,-1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1),new re(0,-1,0),new re(0,-1,0)],Qse=me(({depthTexture:i,bd3D:e,dp:t})=>Qa(i,e).compare(t)),Jse=me(({depthTexture:i,bd3D:e,dp:t,shadow:n})=>{let r=mr("radius","float",n).setGroup(Jt),s=mr("mapSize","vec2",n).setGroup(Jt),o=r.div(s.x),a=fr(e),l=ya(Kd(e,a.x.greaterThan(a.z).select(pe(0,1,0),pe(1,0,0)))),c=Kd(e,l),u=bV(u1.xy).mul(6.28318530718),f=Wu(0,5,u),d=Wu(1,5,u),A=Wu(2,5,u),y=Wu(3,5,u),w=Wu(4,5,u);return Qa(i,e.add(l.mul(f.x).add(c.mul(f.y)).mul(o))).compare(t).add(Qa(i,e.add(l.mul(d.x).add(c.mul(d.y)).mul(o))).compare(t)).add(Qa(i,e.add(l.mul(A.x).add(c.mul(A.y)).mul(o))).compare(t)).add(Qa(i,e.add(l.mul(y.x).add(c.mul(y.y)).mul(o))).compare(t)).add(Qa(i,e.add(l.mul(w.x).add(c.mul(w.y)).mul(o))).compare(t)).mul(1/5)}),x4e=me(({filterFn:i,depthTexture:e,shadowCoord:t,shadow:n},r)=>{let s=t.xyz.toConst(),o=s.abs().toConst(),a=o.x.max(o.y).max(o.z),l=Xt("float").setGroup(Jt).onRenderUpdate(()=>n.camera.near),c=Xt("float").setGroup(Jt).onRenderUpdate(()=>n.camera.far),u=mr("bias","float",n).setGroup(Jt),f=oe(1).toVar();return $t(a.sub(c).lessThanEqual(0).and(a.sub(l).greaterThanEqual(0)),()=>{let d;r.renderer.reversedDepthBuffer?(d=ese(a.negate(),l,c),d.subAssign(u)):r.renderer.logarithmicDepthBuffer?(d=DP(a.negate(),l,c),d.addAssign(u)):(d=mV(a.negate(),l,c),d.addAssign(u));let A=s.normalize();f.assign(i({depthTexture:e,bd3D:A,dp:d,shadow:n}))}),f}),Lk=class extends k4{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===X8?Qse:Jse}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s}){return x4e({filterFn:t,depthTexture:n,shadowCoord:r,shadow:s})}setupRenderTarget(e,t){let n=new e_(e.mapSize.width);n.name="PointShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Fu:Xh;let r=t.createCubeRenderTarget(e.mapSize.width);return r.texture.name="PointShadowMap",r.depthTexture=n,{shadowMap:r,depthTexture:n}}renderShadow(e){let{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:o}=e,a=t.camera,l=t.matrix,c=s.coordinateSystem===xl,u=c?A4e:v4e,f=c?g4e:_4e;n.setSize(t.mapSize.width,t.mapSize.width);let d=s.autoClear,A=s.getClearColor(m4e),y=s.getClearAlpha();s.autoClear=!1,s.setClearColor(t.clearColor,t.clearAlpha);for(let w=0;w<6;w++){s.setRenderTarget(n,w),s.clear();let S=r.distance||a.far;S!==a.far&&(a.far=S,a.updateProjectionMatrix()),Ww.setFromMatrixPosition(r.matrixWorld),a.position.copy(Ww),oU.copy(a.position),oU.add(u[w]),a.up.copy(f[w]),a.lookAt(oU),a.updateMatrixWorld(),l.makeTranslation(-Ww.x,-Ww.y,-Ww.z),Tte.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix(Tte,a.coordinateSystem,a.reversedDepth);let T=o.name;o.name=`Point Light Shadow [ ${r.name||"ID: "+r.id} ] - Face ${w+1}`,s.render(o,a),o.name=T}s.autoClear=d,s.setClearColor(A,y)}},eoe=(i,e)=>new Lk(i,e),Qd=class extends _m{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new zt,this.colorNode=e&&e.colorNode||Xt(this.color).setGroup(Jt),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=yn.FRAME,e&&e.shadow&&(this._shadowDisposeListener=()=>{this.disposeShadow()},e.addEventListener("dispose",this._shadowDisposeListener))}dispose(){this._shadowDisposeListener&&this.light.removeEventListener("dispose",this._shadowDisposeListener),super.dispose()}disposeShadow(){this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null),this.shadowColorNode=null,this.baseColorNode!==null&&(this.colorNode=this.baseColorNode,this.baseColorNode=null)}getHash(){return this.light.uuid}getLightVector(e){return CV(this.light).sub(e.context.positionView||xs)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return Kse(this.light)}setupShadow(e){let{renderer:t}=e;if(t.shadowMap.enabled===!1)return;let n=this.shadowColorNode;if(n===null){let r=this.light.shadow.shadowNode,s;r!==void 0?s=Ht(r):s=this.setupShadowNode(),this.shadowNode=s,this.shadowColorNode=n=this.colorNode.mul(s),this.baseColorNode=this.colorNode}e.context.getShadow&&(n=e.context.getShadow(this,e)),this.colorNode=n}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null,this.shadowColorNode=null);let t=this.setupDirect(e),n=this.setupDirectRectArea(e);t&&e.lightsNode.setupDirectLight(e,this,t),n&&e.lightsNode.setupDirectRectAreaLight(e,this,n)}update(){let{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}},IV=me(({lightDistance:i,cutoffDistance:e,decayExponent:t})=>{let n=i.pow(t).max(.01).reciprocal();return e.greaterThan(0).select(n.mul(i.div(e).pow4().oneMinus().clamp().pow2()),n)}),toe=({color:i,lightVector:e,cutoffDistance:t,decayExponent:n})=>{let r=e.normalize(),s=e.length(),o=IV({lightDistance:s,cutoffDistance:t,decayExponent:n}),a=i.mul(o);return{lightDirection:r,lightColor:a}},Dk=class extends Qd{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=Xt(0).setGroup(Jt),this.decayExponentNode=Xt(2).setGroup(Jt)}update(e){let{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return eoe(this.light)}setupDirect(e){return toe({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}},y4e=me(([i=Ui()])=>{let e=i.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),b4e=me(([i=Ui()],{renderer:e,material:t})=>{let n=Fz(i.mul(2).sub(1)),r;if(t.alphaToCoverage&&e.currentSamples>0){let s=oe(n.fwidth()).toVar();r=mc(s.oneMinus(),s.add(1),n).oneMinus()}else r=xa(n.greaterThan(1),0,1);return r}),cS=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=dc(i).toVar();return xa(s,r,n).uniformFlow()}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),z4=me(([i,e])=>{let t=dc(e).toVar(),n=oe(i).toVar();return xa(t,n.negate(),n).uniformFlow()}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),Rs=me(([i])=>{let e=oe(i).toVar();return de(gf(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),Cr=me(([i,e])=>{let t=oe(i).toVar();return e.assign(Rs(t)),t.sub(oe(e))}),w4e=me(([i,e,t,n,r,s])=>{let o=oe(s).toVar(),a=oe(r).toVar(),l=oe(n).toVar(),c=oe(t).toVar(),u=oe(e).toVar(),f=oe(i).toVar(),d=oe(ai(1,a)).toVar();return ai(1,o).mul(f.mul(d).add(u.mul(a))).add(o.mul(c.mul(d).add(l.mul(a))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),S4e=me(([i,e,t,n,r,s])=>{let o=oe(s).toVar(),a=oe(r).toVar(),l=pe(n).toVar(),c=pe(t).toVar(),u=pe(e).toVar(),f=pe(i).toVar(),d=oe(ai(1,a)).toVar();return ai(1,o).mul(f.mul(d).add(u.mul(a))).add(o.mul(c.mul(d).add(l.mul(a))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),noe=Ko([w4e,S4e]),T4e=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=oe(u).toVar(),d=oe(c).toVar(),A=oe(l).toVar(),y=oe(a).toVar(),w=oe(o).toVar(),S=oe(s).toVar(),T=oe(r).toVar(),R=oe(n).toVar(),I=oe(t).toVar(),P=oe(e).toVar(),F=oe(i).toVar(),D=oe(ai(1,A)).toVar(),L=oe(ai(1,d)).toVar();return oe(ai(1,f)).toVar().mul(L.mul(F.mul(D).add(P.mul(A))).add(d.mul(I.mul(D).add(R.mul(A))))).add(f.mul(L.mul(T.mul(D).add(S.mul(A))).add(d.mul(w.mul(D).add(y.mul(A))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),E4e=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=oe(u).toVar(),d=oe(c).toVar(),A=oe(l).toVar(),y=pe(a).toVar(),w=pe(o).toVar(),S=pe(s).toVar(),T=pe(r).toVar(),R=pe(n).toVar(),I=pe(t).toVar(),P=pe(e).toVar(),F=pe(i).toVar(),D=oe(ai(1,A)).toVar(),L=oe(ai(1,d)).toVar();return oe(ai(1,f)).toVar().mul(L.mul(F.mul(D).add(P.mul(A))).add(d.mul(I.mul(D).add(R.mul(A))))).add(f.mul(L.mul(T.mul(D).add(S.mul(A))).add(d.mul(w.mul(D).add(y.mul(A))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),ioe=Ko([T4e,E4e]),M4e=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=rt(i).toVar(),o=rt(s.bitAnd(rt(7))).toVar(),a=oe(cS(o.lessThan(rt(4)),r,n)).toVar(),l=oe(Tn(2,cS(o.lessThan(rt(4)),n,r))).toVar();return z4(a,dc(o.bitAnd(rt(1)))).add(z4(l,dc(o.bitAnd(rt(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),C4e=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=oe(e).toVar(),a=rt(i).toVar(),l=rt(a.bitAnd(rt(15))).toVar(),c=oe(cS(l.lessThan(rt(8)),o,s)).toVar(),u=oe(cS(l.lessThan(rt(4)),s,cS(l.equal(rt(12)).or(l.equal(rt(14))),o,r))).toVar();return z4(c,dc(l.bitAnd(rt(1)))).add(z4(u,dc(l.bitAnd(rt(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),So=Ko([M4e,C4e]),R4e=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=l1(i).toVar();return pe(So(s.x,r,n),So(s.y,r,n),So(s.z,r,n))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),P4e=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=oe(e).toVar(),a=l1(i).toVar();return pe(So(a.x,o,s,r),So(a.y,o,s,r),So(a.z,o,s,r))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),Qc=Ko([R4e,P4e]),I4e=me(([i])=>{let e=oe(i).toVar();return Tn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),L4e=me(([i])=>{let e=oe(i).toVar();return Tn(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),D4e=me(([i])=>{let e=pe(i).toVar();return Tn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),roe=Ko([I4e,D4e]),N4e=me(([i])=>{let e=pe(i).toVar();return Tn(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),soe=Ko([L4e,N4e]),uc=me(([i,e])=>{let t=de(e).toVar(),n=rt(i).toVar();return n.shiftLeft(t).bitOr(n.shiftRight(de(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),ooe=me(([i,e,t])=>{i.subAssign(t),i.bitXorAssign(uc(t,de(4))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(uc(i,de(6))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(uc(e,de(8))),e.addAssign(i),i.subAssign(t),i.bitXorAssign(uc(t,de(16))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(uc(i,de(19))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(uc(e,de(4))),e.addAssign(i)}),OS=me(([i,e,t])=>{let n=rt(t).toVar(),r=rt(e).toVar(),s=rt(i).toVar();return n.bitXorAssign(r),n.subAssign(uc(r,de(14))),s.bitXorAssign(n),s.subAssign(uc(n,de(11))),r.bitXorAssign(s),r.subAssign(uc(s,de(25))),n.bitXorAssign(r),n.subAssign(uc(r,de(16))),s.bitXorAssign(n),s.subAssign(uc(n,de(4))),r.bitXorAssign(s),r.subAssign(uc(s,de(14))),n.bitXorAssign(r),n.subAssign(uc(r,de(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),ba=me(([i])=>{let e=rt(i).toVar();return oe(e).div(oe(rt(de(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),xf=me(([i])=>{let e=oe(i).toVar();return e.mul(e).mul(e).mul(e.mul(e.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),F4e=me(([i])=>{let e=de(i).toVar(),t=rt(rt(1)).toVar(),n=rt(rt(de(3735928559)).add(t.shiftLeft(rt(2))).add(rt(13))).toVar();return OS(n.add(rt(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),B4e=me(([i,e])=>{let t=de(e).toVar(),n=de(i).toVar(),r=rt(rt(2)).toVar(),s=rt().toVar(),o=rt().toVar(),a=rt().toVar();return s.assign(o.assign(a.assign(rt(de(3735928559)).add(r.shiftLeft(rt(2))).add(rt(13))))),s.addAssign(rt(n)),o.addAssign(rt(t)),OS(s,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),O4e=me(([i,e,t])=>{let n=de(t).toVar(),r=de(e).toVar(),s=de(i).toVar(),o=rt(rt(3)).toVar(),a=rt().toVar(),l=rt().toVar(),c=rt().toVar();return a.assign(l.assign(c.assign(rt(de(3735928559)).add(o.shiftLeft(rt(2))).add(rt(13))))),a.addAssign(rt(s)),l.addAssign(rt(r)),c.addAssign(rt(n)),OS(a,l,c)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),U4e=me(([i,e,t,n])=>{let r=de(n).toVar(),s=de(t).toVar(),o=de(e).toVar(),a=de(i).toVar(),l=rt(rt(4)).toVar(),c=rt().toVar(),u=rt().toVar(),f=rt().toVar();return c.assign(u.assign(f.assign(rt(de(3735928559)).add(l.shiftLeft(rt(2))).add(rt(13))))),c.addAssign(rt(a)),u.addAssign(rt(o)),f.addAssign(rt(s)),ooe(c,u,f),c.addAssign(rt(r)),OS(c,u,f)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),k4e=me(([i,e,t,n,r])=>{let s=de(r).toVar(),o=de(n).toVar(),a=de(t).toVar(),l=de(e).toVar(),c=de(i).toVar(),u=rt(rt(5)).toVar(),f=rt().toVar(),d=rt().toVar(),A=rt().toVar();return f.assign(d.assign(A.assign(rt(de(3735928559)).add(u.shiftLeft(rt(2))).add(rt(13))))),f.addAssign(rt(c)),d.addAssign(rt(l)),A.addAssign(rt(a)),ooe(f,d,A),f.addAssign(rt(o)),d.addAssign(rt(s)),OS(f,d,A)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),Xi=Ko([F4e,B4e,O4e,U4e,k4e]),z4e=me(([i,e])=>{let t=de(e).toVar(),n=de(i).toVar(),r=rt(Xi(n,t)).toVar(),s=l1().toVar();return s.x.assign(r.bitAnd(de(255))),s.y.assign(r.shiftRight(de(8)).bitAnd(de(255))),s.z.assign(r.shiftRight(de(16)).bitAnd(de(255))),s}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),V4e=me(([i,e,t])=>{let n=de(t).toVar(),r=de(e).toVar(),s=de(i).toVar(),o=rt(Xi(s,r,n)).toVar(),a=l1().toVar();return a.x.assign(o.bitAnd(de(255))),a.y.assign(o.shiftRight(de(8)).bitAnd(de(255))),a.z.assign(o.shiftRight(de(16)).bitAnd(de(255))),a}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),Jc=Ko([z4e,V4e]),G4e=me(([i])=>{let e=dt(i).toVar(),t=de().toVar(),n=de().toVar(),r=oe(Cr(e.x,t)).toVar(),s=oe(Cr(e.y,n)).toVar(),o=oe(xf(r)).toVar(),a=oe(xf(s)).toVar(),l=oe(noe(So(Xi(t,n),r,s),So(Xi(t.add(de(1)),n),r.sub(1),s),So(Xi(t,n.add(de(1))),r,s.sub(1)),So(Xi(t.add(de(1)),n.add(de(1))),r.sub(1),s.sub(1)),o,a)).toVar();return roe(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),q4e=me(([i])=>{let e=pe(i).toVar(),t=de().toVar(),n=de().toVar(),r=de().toVar(),s=oe(Cr(e.x,t)).toVar(),o=oe(Cr(e.y,n)).toVar(),a=oe(Cr(e.z,r)).toVar(),l=oe(xf(s)).toVar(),c=oe(xf(o)).toVar(),u=oe(xf(a)).toVar(),f=oe(ioe(So(Xi(t,n,r),s,o,a),So(Xi(t.add(de(1)),n,r),s.sub(1),o,a),So(Xi(t,n.add(de(1)),r),s,o.sub(1),a),So(Xi(t.add(de(1)),n.add(de(1)),r),s.sub(1),o.sub(1),a),So(Xi(t,n,r.add(de(1))),s,o,a.sub(1)),So(Xi(t.add(de(1)),n,r.add(de(1))),s.sub(1),o,a.sub(1)),So(Xi(t,n.add(de(1)),r.add(de(1))),s,o.sub(1),a.sub(1)),So(Xi(t.add(de(1)),n.add(de(1)),r.add(de(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return soe(f)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),LV=Ko([G4e,q4e]),H4e=me(([i])=>{let e=dt(i).toVar(),t=de().toVar(),n=de().toVar(),r=oe(Cr(e.x,t)).toVar(),s=oe(Cr(e.y,n)).toVar(),o=oe(xf(r)).toVar(),a=oe(xf(s)).toVar(),l=pe(noe(Qc(Jc(t,n),r,s),Qc(Jc(t.add(de(1)),n),r.sub(1),s),Qc(Jc(t,n.add(de(1))),r,s.sub(1)),Qc(Jc(t.add(de(1)),n.add(de(1))),r.sub(1),s.sub(1)),o,a)).toVar();return roe(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),W4e=me(([i])=>{let e=pe(i).toVar(),t=de().toVar(),n=de().toVar(),r=de().toVar(),s=oe(Cr(e.x,t)).toVar(),o=oe(Cr(e.y,n)).toVar(),a=oe(Cr(e.z,r)).toVar(),l=oe(xf(s)).toVar(),c=oe(xf(o)).toVar(),u=oe(xf(a)).toVar(),f=pe(ioe(Qc(Jc(t,n,r),s,o,a),Qc(Jc(t.add(de(1)),n,r),s.sub(1),o,a),Qc(Jc(t,n.add(de(1)),r),s,o.sub(1),a),Qc(Jc(t.add(de(1)),n.add(de(1)),r),s.sub(1),o.sub(1),a),Qc(Jc(t,n,r.add(de(1))),s,o,a.sub(1)),Qc(Jc(t.add(de(1)),n,r.add(de(1))),s.sub(1),o,a.sub(1)),Qc(Jc(t,n.add(de(1)),r.add(de(1))),s,o.sub(1),a.sub(1)),Qc(Jc(t.add(de(1)),n.add(de(1)),r.add(de(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return soe(f)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),US=Ko([H4e,W4e]),j4e=me(([i])=>{let e=oe(i).toVar(),t=de(Rs(e)).toVar();return ba(Xi(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),X4e=me(([i])=>{let e=dt(i).toVar(),t=de(Rs(e.x)).toVar(),n=de(Rs(e.y)).toVar();return ba(Xi(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),$4e=me(([i])=>{let e=pe(i).toVar(),t=de(Rs(e.x)).toVar(),n=de(Rs(e.y)).toVar(),r=de(Rs(e.z)).toVar();return ba(Xi(t,n,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),Y4e=me(([i])=>{let e=Ft(i).toVar(),t=de(Rs(e.x)).toVar(),n=de(Rs(e.y)).toVar(),r=de(Rs(e.z)).toVar(),s=de(Rs(e.w)).toVar();return ba(Xi(t,n,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),Z4e=Ko([j4e,X4e,$4e,Y4e]),K4e=me(([i])=>{let e=oe(i).toVar(),t=de(Rs(e)).toVar();return pe(ba(Xi(t,de(0))),ba(Xi(t,de(1))),ba(Xi(t,de(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),Q4e=me(([i])=>{let e=dt(i).toVar(),t=de(Rs(e.x)).toVar(),n=de(Rs(e.y)).toVar();return pe(ba(Xi(t,n,de(0))),ba(Xi(t,n,de(1))),ba(Xi(t,n,de(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),J4e=me(([i])=>{let e=pe(i).toVar(),t=de(Rs(e.x)).toVar(),n=de(Rs(e.y)).toVar(),r=de(Rs(e.z)).toVar();return pe(ba(Xi(t,n,r,de(0))),ba(Xi(t,n,r,de(1))),ba(Xi(t,n,r,de(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),ePe=me(([i])=>{let e=Ft(i).toVar(),t=de(Rs(e.x)).toVar(),n=de(Rs(e.y)).toVar(),r=de(Rs(e.z)).toVar(),s=de(Rs(e.w)).toVar();return pe(ba(Xi(t,n,r,s,de(0))),ba(Xi(t,n,r,s,de(1))),ba(Xi(t,n,r,s,de(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),zP=Ko([K4e,Q4e,J4e,ePe]),V4=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar(),l=oe(0).toVar(),c=oe(1).toVar();return Oi(o,()=>{l.addAssign(c.mul(LV(a))),c.mulAssign(r),a.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),VP=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar(),l=pe(0).toVar(),c=oe(1).toVar();return Oi(o,()=>{l.addAssign(c.mul(US(a))),c.mulAssign(r),a.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),tPe=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar();return dt(V4(a,o,s,r),V4(a.add(pe(de(19),de(193),de(17))),o,s,r))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),nPe=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar(),l=pe(VP(a,o,s,r)).toVar(),c=oe(V4(a.add(pe(de(19),de(193),de(17))),o,s,r)).toVar();return Ft(l,c)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),iPe=me(([i,e,t,n,r,s,o])=>{let a=de(o).toVar(),l=oe(s).toVar(),c=de(r).toVar(),u=de(n).toVar(),f=de(t).toVar(),d=de(e).toVar(),A=dt(i).toVar(),y=pe(zP(dt(d.add(u),f.add(c)))).toVar(),w=dt(y.x,y.y).toVar();w.subAssign(.5),w.mulAssign(l),w.addAssign(.5);let S=dt(dt(oe(d),oe(f)).add(w)).toVar(),T=dt(S.sub(A)).toVar();return $t(a.equal(de(2)),()=>fr(T.x).add(fr(T.y))),$t(a.equal(de(3)),()=>zr(fr(T.x),fr(T.y))),ru(T,T)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),rPe=me(([i,e,t,n,r,s,o,a,l])=>{let c=de(l).toVar(),u=oe(a).toVar(),f=de(o).toVar(),d=de(s).toVar(),A=de(r).toVar(),y=de(n).toVar(),w=de(t).toVar(),S=de(e).toVar(),T=pe(i).toVar(),R=pe(zP(pe(S.add(A),w.add(d),y.add(f)))).toVar();R.subAssign(.5),R.mulAssign(u),R.addAssign(.5);let I=pe(pe(oe(S),oe(w),oe(y)).add(R)).toVar(),P=pe(I.sub(T)).toVar();return $t(c.equal(de(2)),()=>fr(P.x).add(fr(P.y)).add(fr(P.z))),$t(c.equal(de(3)),()=>zr(fr(P.x),fr(P.y),fr(P.z))),ru(P,P)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Tx=Ko([iPe,rPe]),sPe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=dt(i).toVar(),o=de().toVar(),a=de().toVar(),l=dt(Cr(s.x,o),Cr(s.y,a)).toVar(),c=oe(1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:f})=>{let d=oe(Tx(l,u,f,o,a,r,n)).toVar();c.assign(Pl(c,d))})}),$t(n.equal(de(0)),()=>{c.assign(el(c))}),c}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),oPe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=dt(i).toVar(),o=de().toVar(),a=de().toVar(),l=dt(Cr(s.x,o),Cr(s.y,a)).toVar(),c=dt(1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:f})=>{let d=oe(Tx(l,u,f,o,a,r,n)).toVar();$t(d.lessThan(c.x),()=>{c.y.assign(c.x),c.x.assign(d)}).ElseIf(d.lessThan(c.y),()=>{c.y.assign(d)})})}),$t(n.equal(de(0)),()=>{c.assign(el(c))}),c}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),aPe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=dt(i).toVar(),o=de().toVar(),a=de().toVar(),l=dt(Cr(s.x,o),Cr(s.y,a)).toVar(),c=pe(1e6,1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:f})=>{let d=oe(Tx(l,u,f,o,a,r,n)).toVar();$t(d.lessThan(c.x),()=>{c.z.assign(c.y),c.y.assign(c.x),c.x.assign(d)}).ElseIf(d.lessThan(c.y),()=>{c.z.assign(c.y),c.y.assign(d)}).ElseIf(d.lessThan(c.z),()=>{c.z.assign(d)})})}),$t(n.equal(de(0)),()=>{c.assign(el(c))}),c}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),lPe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=pe(i).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=pe(Cr(s.x,o),Cr(s.y,a),Cr(s.z,l)).toVar(),u=oe(1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:f})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{Oi({start:-1,end:de(1),name:"z",condition:"<="},({z:A})=>{let y=oe(Tx(c,f,d,A,o,a,l,r,n)).toVar();u.assign(Pl(u,y))})})}),$t(n.equal(de(0)),()=>{u.assign(el(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),cPe=Ko([sPe,lPe]),uPe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=pe(i).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=pe(Cr(s.x,o),Cr(s.y,a),Cr(s.z,l)).toVar(),u=dt(1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:f})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{Oi({start:-1,end:de(1),name:"z",condition:"<="},({z:A})=>{let y=oe(Tx(c,f,d,A,o,a,l,r,n)).toVar();$t(y.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(y)}).ElseIf(y.lessThan(u.y),()=>{u.y.assign(y)})})})}),$t(n.equal(de(0)),()=>{u.assign(el(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),hPe=Ko([oPe,uPe]),fPe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=pe(i).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=pe(Cr(s.x,o),Cr(s.y,a),Cr(s.z,l)).toVar(),u=pe(1e6,1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:f})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{Oi({start:-1,end:de(1),name:"z",condition:"<="},({z:A})=>{let y=oe(Tx(c,f,d,A,o,a,l,r,n)).toVar();$t(y.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(y)}).ElseIf(y.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(y)}).ElseIf(y.lessThan(u.z),()=>{u.z.assign(y)})})})}),$t(n.equal(de(0)),()=>{u.assign(el(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),DV=Ko([aPe,fPe]),dPe=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=de(i).toVar(),d=dt(e).toVar(),A=dt(t).toVar(),y=dt(n).toVar(),w=oe(r).toVar(),S=oe(s).toVar(),T=oe(o).toVar(),R=dc(a).toVar(),I=de(l).toVar(),P=oe(c).toVar(),F=oe(u).toVar(),D=d.mul(A).add(y),L=oe(0).toVar();return $t(f.equal(de(0)),()=>{L.assign(US(D))}),$t(f.equal(de(1)),()=>{L.assign(zP(D))}),$t(f.equal(de(2)),()=>{L.assign(DV(D,w,de(0)))}),$t(f.equal(de(3)),()=>{L.assign(VP(pe(D,0),I,P,F))}),L.assign(L.mul(T.sub(S)).add(S)),$t(R,()=>{L.assign(Yu(L,S,T))}),L}).setLayout({name:"mx_unifiednoise2d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"texcoord",type:"vec2"},{name:"freq",type:"vec2"},{name:"offset",type:"vec2"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),pPe=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=de(i).toVar(),d=pe(e).toVar(),A=pe(t).toVar(),y=pe(n).toVar(),w=oe(r).toVar(),S=oe(s).toVar(),T=oe(o).toVar(),R=dc(a).toVar(),I=de(l).toVar(),P=oe(c).toVar(),F=oe(u).toVar(),D=d.mul(A).add(y),L=oe(0).toVar();return $t(f.equal(de(0)),()=>{L.assign(US(D))}),$t(f.equal(de(1)),()=>{L.assign(zP(D))}),$t(f.equal(de(2)),()=>{L.assign(DV(D,w,de(0)))}),$t(f.equal(de(3)),()=>{L.assign(VP(D,I,P,F))}),L.assign(L.mul(T.sub(S)).add(S)),$t(R,()=>{L.assign(Yu(L,S,T))}),L}).setLayout({name:"mx_unifiednoise3d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"position",type:"vec3"},{name:"freq",type:"vec3"},{name:"offset",type:"vec3"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),mPe=me(([i])=>{let e=i.y,t=i.z,n=pe().toVar();return $t(e.lessThan(1e-4),()=>{n.assign(pe(t,t,t))}).Else(()=>{let r=i.x;r=r.sub(gf(r)).mul(6).toVar();let s=de(Iz(r)),o=r.sub(oe(s)),a=t.mul(e.oneMinus()),l=t.mul(e.mul(o).oneMinus()),c=t.mul(e.mul(o.oneMinus()).oneMinus());$t(s.equal(de(0)),()=>{n.assign(pe(t,c,a))}).ElseIf(s.equal(de(1)),()=>{n.assign(pe(l,t,a))}).ElseIf(s.equal(de(2)),()=>{n.assign(pe(a,t,c))}).ElseIf(s.equal(de(3)),()=>{n.assign(pe(a,l,t))}).ElseIf(s.equal(de(4)),()=>{n.assign(pe(c,a,t))}).Else(()=>{n.assign(pe(t,a,l))})}),n}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),APe=me(([i])=>{let e=pe(i).toVar(),t=oe(e.x).toVar(),n=oe(e.y).toVar(),r=oe(e.z).toVar(),s=oe(Pl(t,Pl(n,r))).toVar(),o=oe(zr(t,zr(n,r))).toVar(),a=oe(o.sub(s)).toVar(),l=oe().toVar(),c=oe().toVar(),u=oe().toVar();return u.assign(o),$t(o.greaterThan(0),()=>{c.assign(a.div(o))}).Else(()=>{c.assign(0)}),$t(c.lessThanEqual(0),()=>{l.assign(0)}).Else(()=>{$t(t.greaterThanEqual(o),()=>{l.assign(n.sub(r).div(a))}).ElseIf(n.greaterThanEqual(o),()=>{l.assign(Ps(2,r.sub(t).div(a)))}).Else(()=>{l.assign(Ps(4,t.sub(n).div(a)))}),l.mulAssign(1/6),$t(l.lessThan(0),()=>{l.addAssign(1)})}),pe(l,c,u)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),gPe=me(([i])=>{let e=pe(i).toVar(),t=mz(bz(e,pe(.04045))).toVar(),n=pe(e.div(12.92)).toVar(),r=pe(eu(zr(e.add(pe(.055)),pe(0)).div(1.055),pe(2.4))).toVar();return Qn(n,r,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),aoe=(i,e)=>{i=oe(i),e=oe(e);let t=dt(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return mc(i.sub(t),i.add(t),e)},loe=(i,e,t,n)=>Qn(i,e,t[n].clamp()),vPe=(i,e,t=Ui())=>loe(i,e,t,"x"),_Pe=(i,e,t=Ui())=>loe(i,e,t,"y"),xPe=(i,e,t,n,r=Ui())=>{let s=r.x.clamp(),o=r.y.clamp(),a=Qn(i,e,s),l=Qn(t,n,s);return Qn(a,l,o)},coe=(i,e,t,n,r)=>Qn(i,e,aoe(t,n[r])),yPe=(i,e,t,n=Ui())=>coe(i,e,t,n,"x"),bPe=(i,e,t,n=Ui())=>coe(i,e,t,n,"y"),wPe=(i=1,e=0,t=Ui())=>t.mul(i).add(e),SPe=(i,e=1)=>(i=oe(i),i.abs().pow(e).mul(i.sign())),TPe=(i,e=1,t=.5)=>oe(i).sub(t).mul(e).add(t),EPe=(i=Ui(),e=1,t=0)=>LV(i.convert("vec2|vec3")).mul(e).add(t),MPe=(i=Ui(),e=1,t=0)=>US(i.convert("vec2|vec3")).mul(e).add(t),CPe=(i=Ui(),e=1,t=0)=>(i=i.convert("vec2|vec3"),Ft(US(i),LV(i.add(dt(19,73)))).mul(e).add(t)),RPe=(i,e=Ui(),t=dt(1,1),n=dt(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>dPe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),PPe=(i,e=Ui(),t=dt(1,1),n=dt(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>pPe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),IPe=(i=Ui(),e=1)=>cPe(i.convert("vec2|vec3"),e,de(1)),LPe=(i=Ui(),e=1)=>hPe(i.convert("vec2|vec3"),e,de(1)),DPe=(i=Ui(),e=1)=>DV(i.convert("vec2|vec3"),e,de(1)),NPe=(i=Ui())=>Z4e(i.convert("vec2|vec3")),FPe=(i=Ui(),e=3,t=2,n=.5,r=1)=>V4(i,de(e),t,n).mul(r),BPe=(i=Ui(),e=3,t=2,n=.5,r=1)=>tPe(i,de(e),t,n).mul(r),OPe=(i=Ui(),e=3,t=2,n=.5,r=1)=>VP(i,de(e),t,n).mul(r),UPe=(i=Ui(),e=3,t=2,n=.5,r=1)=>nPe(i,de(e),t,n).mul(r),kPe=(i,e=oe(0))=>Ps(i,e),zPe=(i,e=oe(0))=>ai(i,e),VPe=(i,e=oe(1))=>Tn(i,e),GPe=(i,e=oe(1))=>pc(i,e),qPe=(i,e=oe(1))=>xP(i,e),HPe=(i,e=oe(1))=>eu(i,e),WPe=(i=oe(0),e=oe(1))=>Ez(i,e),jPe=()=>Sx,XPe=()=>Ese,$Pe=(i,e=oe(1))=>ai(e,i),YPe=(i,e,t,n)=>i.greaterThan(e).mix(t,n),ZPe=(i,e,t,n)=>i.greaterThanEqual(e).mix(t,n),KPe=(i,e,t,n)=>i.equal(e).mix(t,n),QPe=(i,e=null)=>{if(typeof e=="string"){let t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},n=e.replace(/^out/,"").toLowerCase();if(t[n]!==void 0)return i.element(t[n])}if(typeof e=="number")return i.element(e);if(typeof e=="string"&&e.length===1){let t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(t[e]!==void 0)return i.element(t[e])}return i},JPe=(i,e=dt(.5,.5),t=dt(1,1),n=oe(0),r=dt(0,0))=>{let s=i;if(e&&(s=s.sub(e)),t&&(s=s.mul(t)),n){let o=n.mul(Math.PI/180),a=o.cos(),l=o.sin();s=dt(s.x.mul(a).sub(s.y.mul(l)),s.x.mul(l).add(s.y.mul(a)))}return e&&(s=s.add(e)),r&&(s=s.add(r)),s},eIe=(i,e)=>{i=dt(i),e=oe(e);let t=e.mul(Math.PI/180);return FS(i,t)},tIe=(i,e,t)=>{i=pe(i),e=oe(e),t=pe(t);let n=e.mul(Math.PI/180),r=t.normalize(),s=n.cos(),o=n.sin(),a=oe(1).sub(s);return i.mul(s).add(r.cross(i).mul(o)).add(r.mul(r.dot(i)).mul(a))},nIe=(i,e)=>(i=pe(i),e=oe(e),iV(i,e)),iIe=me(([i,e,t])=>{let n=ya(i).toVar(),r=ai(oe(.5).mul(e.sub(t)),_f).div(n).toVar(),s=ai(oe(-.5).mul(e.sub(t)),_f).div(n).toVar(),o=pe().toVar();o.x=n.x.greaterThan(oe(0)).select(r.x,s.x),o.y=n.y.greaterThan(oe(0)).select(r.y,s.y),o.z=n.z.greaterThan(oe(0)).select(r.z,s.z);let a=Pl(o.x,o.y,o.z).toVar();return _f.add(n.mul(a)).toVar().sub(t)}),uoe=me(([i,e])=>{let t=i.x,n=i.y,r=i.z,s=e.element(0).mul(.886227);return s=s.add(e.element(1).mul(2*.511664).mul(n)),s=s.add(e.element(2).mul(2*.511664).mul(r)),s=s.add(e.element(3).mul(2*.511664).mul(t)),s=s.add(e.element(4).mul(2*.429043).mul(t).mul(n)),s=s.add(e.element(5).mul(2*.429043).mul(n).mul(r)),s=s.add(e.element(6).mul(r.mul(r).mul(.743125).sub(.247708))),s=s.add(e.element(7).mul(2*.429043).mul(t).mul(r)),s=s.add(e.element(8).mul(.429043).mul(Tn(t,t).sub(Tn(n,n)))),s}),V=Object.freeze({__proto__:null,BRDF_GGX:_V,BRDF_Lambert:i1,BasicPointShadowFilter:Qse,BasicShadowFilter:Hse,Break:Yre,Const:xie,Continue:l3e,DFGLUT:vS,D_GGX:lse,Discard:Fie,EPSILON:yP,F_Schlick:gx,Fn:me,HALF_PI:nEe,INFINITY:JTe,If:$t,Loop:Oi,NodeAccess:Yo,NodeShaderStage:ex,NodeType:LTe,NodeUpdateType:yn,OnBeforeFrameUpdate:n3e,OnBeforeMaterialUpdate:t3e,OnBeforeObjectUpdate:e3e,OnFrameUpdate:Vre,OnMaterialUpdate:JEe,OnObjectUpdate:NS,PCFShadowFilter:Wse,PCFSoftShadowFilter:jse,PI:h4,PI2:eEe,PointShadowFilter:Jse,Return:dEe,Schlick_to_F0:R7,ShaderNode:ix,Stack:AP,Switch:XTe,TBNViewMatrix:qg,TWO_PI:tEe,VSMShadowFilter:Xse,V_GGX_SmithCorrelated:ase,Var:_ie,VarIntent:yie,abs:fr,acesFilmicToneMapping:Bse,acos:Tz,acosh:Yne,add:Ps,addMethodChaining:Ue,addNodeElement:pEe,agxToneMapping:Ose,all:kne,alphaT:o4,ambientOcclusion:IU,and:Tne,anisotropy:om,anisotropyB:jg,anisotropyT:rS,any:zne,append:YTe,array:gne,asin:Xne,asinh:$ne,assign:vne,atan:Ez,atanh:Zne,atomicAdd:xRe,atomicAnd:SRe,atomicFunc:Cf,atomicLoad:vRe,atomicMax:bRe,atomicMin:wRe,atomicOr:TRe,atomicStore:_Re,atomicSub:yRe,atomicXor:ERe,attenuationColor:xz,attenuationDistance:_z,attribute:fc,attributeArray:TCe,backgroundBlurriness:Rse,backgroundIntensity:vk,backgroundRotation:Pse,batch:Wre,batchColor:hV,bentNormalView:hre,billboarding:dCe,bitAnd:Rne,bitNot:Pne,bitOr:Ine,bitXor:Lne,bitangentGeometry:WEe,bitangentLocal:jEe,bitangentView:cre,bitangentWorld:XEe,bitcast:Sse,blendBurn:FCe,blendColor:kCe,blendDodge:BCe,blendOverlay:UCe,blendScreen:OCe,blur:pse,bool:dc,buffer:bx,bufferAttribute:Vz,builtin:tp,builtinAOContext:gie,builtinShadowContext:Aie,bumpMap:iV,bvec2:hne,bvec3:mz,bvec4:fne,bypass:Die,cache:Lie,call:_ne,cameraFar:cm,cameraIndex:bm,cameraNear:lm,cameraNormalMatrix:bEe,cameraPosition:Vie,cameraProjectionMatrix:Ja,cameraProjectionMatrixInverse:zie,cameraViewMatrix:wm,cameraViewport:wEe,cameraWorldMatrix:DS,cbrt:uie,cdl:HCe,ceil:wP,checker:y4e,cineonToneMapping:Fse,clamp:Yu,clearcoat:i4,clearcoatNormalView:um,clearcoatRoughness:sx,clipSpace:Hie,code:OP,color:une,colorSpaceToWorking:TP,colorToDirection:ZEe,compute:Iie,computeKernel:qz,computeSkinning:a3e,context:ep,convert:pne,convertColorSpace:oEe,convertToTexture:yCe,cos:Hu,cosh:Hne,countLeadingZeros:HMe,countOneBits:WMe,countTrailingZeros:qMe,cross:Kd,cubeTexture:Qa,cubeTextureBase:tV,dFdx:Rz,dFdy:Pz,dashSize:Xg,debug:Oie,decrement:Une,decrementBefore:Bne,defaultBuildStages:$R,defaultShaderStages:sne,defined:hx,degrees:Gne,deltaTime:sCe,densityFogFactor:Vse,depth:AV,depthPass:YCe,determinant:tie,difference:sie,diffuseColor:Bi,diffuseContribution:kg,directPointLight:toe,directionToColor:YEe,directionToFaceDirection:BEe,dispersion:yz,disposeShadowMaterial:Yse,distance:rie,div:pc,dot:ru,drawIndex:Pie,dynamicBufferAttribute:cEe,element:dne,emissive:PU,equal:xne,equirectDirection:w7,equirectUV:gV,exp:wz,exp2:fx,exponentialHeightFogFactor:oRe,expression:hc,faceDirection:Qz,faceForward:Oz,faceforward:iEe,float:oe,floatBitsToInt:zMe,floatBitsToUint:Tse,floor:gf,fog:Tk,fract:$u,frameGroup:KTe,frameId:Ese,frontFacing:Wie,fwidth:Lz,gain:XMe,gapSize:dS,getConstNodeType:cne,getCurrentStack:fz,getDirection:fse,getDistanceAttenuation:IV,getGeometryRoughness:ose,getNormalFromDepth:wCe,getParallaxCorrectNormal:iIe,getRoughness:vV,getScreenPosition:bCe,getShIrradianceAt:uoe,getShadowMaterial:$se,getShadowRenderObjectFunction:Zse,getTextureIndex:bse,getViewPosition:nx,ggxConvolution:mse,globalId:uRe,glsl:iRe,glslFn:rRe,grayscale:zCe,greaterThan:bz,greaterThanEqual:Sne,hash:jMe,highpModelNormalViewMatrix:KU,highpModelViewMatrix:ZU,hue:qCe,increment:One,incrementBefore:Fne,inspector:Uie,instance:qre,instanceColor:uV,instanceIndex:Xu,instancedArray:ECe,instancedBufferAttribute:MP,instancedDynamicBufferAttribute:Gz,instancedMesh:Hre,int:de,intBitsToFloat:VMe,interleavedGradientNoise:bV,inverse:nie,inverseSqrt:Sz,inversesqrt:rEe,invocationLocalIndex:fEe,invocationSubgroupIndex:hEe,ior:sS,iridescence:vP,iridescenceIOR:r4,iridescenceThickness:s4,isolate:lx,ivec2:kr,ivec3:pz,ivec4:Az,js:tRe,label:vie,length:vf,lengthSq:Fz,lessThan:bne,lessThanEqual:wne,lightPosition:MV,lightProjectionUV:Gse,lightShadowMatrix:kP,lightTargetDirection:RV,lightTargetPosition:qse,lightViewPosition:CV,lightingContext:Kre,lights:i4e,linearDepth:x4,linearToneMapping:Dse,localId:hRe,log:bP,log2:Af,logarithmicDepthToViewZ:d3e,luminance:SV,mat2:gP,mat3:To,mat4:pm,matcapUV:Ase,materialAO:kre,materialAlphaTest:dre,materialAnisotropy:Cre,materialAnisotropyVector:tx,materialAttenuationColor:Bre,materialAttenuationDistance:Fre,materialClearcoat:bre,materialClearcoatNormal:Sre,materialClearcoatRoughness:wre,materialColor:pre,materialDispersion:Ure,materialEmissive:Are,materialEnvIntensity:ZR,materialEnvRotation:A4,materialIOR:Nre,materialIridescence:Rre,materialIridescenceIOR:Pre,materialIridescenceThickness:Ire,materialLightMap:cV,materialLineDashOffset:lV,materialLineDashSize:oV,materialLineGapSize:aV,materialLineScale:sV,materialLineWidth:g4,materialMetalness:xre,materialNormal:yre,materialOpacity:rV,materialPointSize:Ore,materialReference:Xd,materialReflectivity:KR,materialRefractionRatio:$ie,materialRotation:Tre,materialRoughness:_re,materialSheen:Ere,materialSheenRoughness:Mre,materialShininess:mre,materialSpecular:gre,materialSpecularColor:vre,materialSpecularIntensity:l7,materialSpecularStrength:oS,materialThickness:Dre,materialTransmission:Lre,max:zr,maxMipLevel:Xz,mediumpModelViewMatrix:qie,metalness:Yd,min:Pl,mix:Qn,mixElement:fie,mod:xP,modelDirection:PEe,modelNormalMatrix:Gie,modelPosition:IEe,modelRadius:NEe,modelScale:LEe,modelViewMatrix:bf,modelViewPosition:DEe,modelViewProjection:zre,modelWorldMatrix:tu,modelWorldMatrixInverse:FEe,morphReference:Zre,mrt:wse,mul:Tn,mx_aastep:aoe,mx_add:kPe,mx_atan2:WPe,mx_cell_noise_float:NPe,mx_contrast:TPe,mx_divide:GPe,mx_fractal_noise_float:FPe,mx_fractal_noise_vec2:BPe,mx_fractal_noise_vec3:OPe,mx_fractal_noise_vec4:UPe,mx_frame:XPe,mx_heighttonormal:nIe,mx_hsvtorgb:mPe,mx_ifequal:KPe,mx_ifgreater:YPe,mx_ifgreatereq:ZPe,mx_invert:$Pe,mx_modulo:qPe,mx_multiply:VPe,mx_noise_float:EPe,mx_noise_vec3:MPe,mx_noise_vec4:CPe,mx_place2d:JPe,mx_power:HPe,mx_ramp4:xPe,mx_ramplr:vPe,mx_ramptb:_Pe,mx_rgbtohsv:APe,mx_rotate2d:eIe,mx_rotate3d:tIe,mx_safepower:SPe,mx_separate:QPe,mx_splitlr:yPe,mx_splittb:bPe,mx_srgb_texture_to_lin_rec709:gPe,mx_subtract:zPe,mx_timer:jPe,mx_transform_uv:wPe,mx_unifiednoise2d:RPe,mx_unifiednoise3d:PPe,mx_worley_noise_float:IPe,mx_worley_noise_vec2:LPe,mx_worley_noise_vec3:DPe,negate:Cz,negateOnBackSide:h1,neutralToneMapping:Use,nodeArray:Wg,nodeImmutable:xt,nodeObject:Ht,nodeObjectIntent:eS,nodeObjects:mP,nodeProxy:$n,nodeProxyConstructor:hz,nodeProxyIntent:ct,normalFlat:jie,normalGeometry:CP,normalLocal:wa,normalMap:o7,normalView:hi,normalViewGeometry:dx,normalWorld:Sm,normalWorldGeometry:Xie,normalize:ya,not:Mne,notEqual:yne,numWorkgroups:lRe,objectDirection:SEe,objectGroup:Ane,objectPosition:EEe,objectRadius:REe,objectScale:MEe,objectViewPosition:CEe,objectWorldMatrix:TEe,oneMinus:Kne,or:Ene,orthographicDepthToViewZ:Jre,oscSawtooth:cCe,oscSine:oCe,oscSquare:aCe,oscTriangle:lCe,output:ox,outputStruct:OMe,overloadingFn:Ko,overrideNode:xse,overrideNodes:yse,packHalf2x16:QMe,packNormalToRGB:nV,packSnorm2x16:ZMe,packUnorm2x16:KMe,parabola:ck,parallaxDirection:ure,parallaxUV:$Ee,parameter:NMe,pass:XCe,passTexture:$Ce,pcurve:$Me,perspectiveDepthToViewZ:LP,pmremTexture:yV,pointShadow:eoe,pointUV:MCe,pointWidth:ZTe,positionGeometry:va,positionLocal:Mr,positionPrevious:n1,positionView:xs,positionViewDirection:er,positionWorld:_f,positionWorldDirection:Kz,posterize:WCe,pow:eu,pow2:Dz,pow3:oie,pow4:Nz,premultiplyAlpha:Wz,property:Jd,quadBroadcast:KRe,quadSwapDiagonal:WRe,quadSwapX:qRe,quadSwapY:HRe,radians:Vne,rand:hie,range:aRe,rangeFogFactor:zse,reciprocal:Jne,reference:mr,referenceBuffer:ere,reflect:iie,reflectVector:Kie,reflectView:Yie,reflector:vCe,refract:Bz,refractVector:Qie,refractView:Zie,reinhardToneMapping:Nse,remap:Hz,remapClamp:Nie,renderGroup:Jt,renderOutput:jz,rendererReference:Eie,replaceDefaultUV:uCe,rotate:FS,rotateUV:hCe,roughness:pf,round:Qne,rtt:Cse,sRGBTransferEOTF:wie,sRGBTransferOETF:Sie,sample:SCe,sampler:vEe,samplerComparison:_Ee,saturate:SP,saturation:VCe,screenCoordinate:u1,screenDPR:Yz,screenSize:t1,screenUV:ju,select:xa,setCurrentStack:fS,setName:Uz,shaderStages:YR,shadow:Kse,shadowPositionWorld:PV,shapeCircle:b4e,sharedUniformGroup:_P,sheen:cc,sheenRoughness:am,shiftLeft:Dne,shiftRight:Nne,shininess:a4,sign:Mz,sin:Ka,sinc:YMe,sinh:qne,skinning:$re,smoothstep:mc,smoothstepElement:die,specularColor:gm,specularColorBlended:Vg,specularF90:Gg,spherizeUV:fCe,split:$Te,spritesheetUV:mCe,sqrt:el,stack:JR,step:Jg,stepElement:pie,storage:mm,storageBarrier:pRe,storageTexture:Ise,storageTexture3D:RCe,struct:BMe,sub:ai,subBuild:$g,subgroupAdd:RRe,subgroupAll:zRe,subgroupAnd:FRe,subgroupAny:VRe,subgroupBallot:CRe,subgroupBroadcast:jRe,subgroupBroadcastFirst:GRe,subgroupElect:MRe,subgroupExclusiveAdd:IRe,subgroupExclusiveMul:NRe,subgroupInclusiveAdd:PRe,subgroupInclusiveMul:DRe,subgroupIndex:uEe,subgroupMax:kRe,subgroupMin:URe,subgroupMul:LRe,subgroupOr:BRe,subgroupShuffle:XRe,subgroupShuffleDown:ZRe,subgroupShuffleUp:YRe,subgroupShuffleXor:$Re,subgroupSize:fRe,subgroupXor:ORe,tan:Wne,tangentGeometry:RP,tangentLocal:vm,tangentView:PP,tangentWorld:lre,tanh:jne,texture:fi,texture3D:wV,texture3DLevel:LCe,texture3DLoad:ICe,textureBarrier:mRe,textureBicubic:z3e,textureBicubicLevel:xV,textureCubeUV:dse,textureLevel:gEe,textureLoad:_s,textureSize:e1,textureStore:CCe,thickness:vz,time:Sx,toneMapping:Mie,toneMappingExposure:Cie,toonOutlinePass:ZCe,transformDirection:aie,transformNormal:Jz,transformNormalByInverseViewMatrix:cie,transformNormalByViewMatrix:lie,transformNormalToView:eV,transformedClearcoatNormalView:kEe,transformedNormalView:OEe,transformedNormalWorld:UEe,transmission:l4,transpose:eie,triNoise3D:iCe,triplanarTexture:ACe,triplanarTextures:Mse,trunc:Iz,uint:rt,uintBitsToFloat:GMe,uniform:Xt,uniformArray:$o,uniformCubeTexture:zEe,uniformFlow:mie,uniformGroup:mne,uniformTexture:AEe,unpackHalf2x16:tCe,unpackNormal:r7,unpackRGBToNormal:fre,unpackSnorm2x16:JMe,unpackUnorm2x16:eCe,unpremultiplyAlpha:Bie,userData:DCe,uv:Ui,uvec2:dz,uvec3:l1,uvec4:gz,varying:ym,varyingProperty:c1,vec2:dt,vec3:pe,vec4:Ft,vectorComponents:a1,velocity:NCe,vertexColor:nse,vertexIndex:Rie,vertexStage:bie,vibrance:GCe,viewZToLogarithmicDepth:DP,viewZToOrthographicDepth:Yg,viewZToPerspectiveDepth:mV,viewZToReversedOrthographicDepth:f3e,viewZToReversedPerspectiveDepth:ese,viewport:ux,viewportCoordinate:kie,viewportDepthTexture:pV,viewportLinearDepth:p3e,viewportMipTexture:dV,viewportOpaqueMipTexture:Qre,viewportResolution:yEe,viewportSafeUV:pCe,viewportSharedTexture:jCe,viewportSize:Zz,viewportTexture:u3e,viewportUV:xEe,vogelDiskSample:Wu,wgsl:nRe,wgslFn:sRe,workgroupArray:ARe,workgroupBarrier:dRe,workgroupId:cRe,workingToColorSpace:Tie,xor:Cne}),Gu=new xS,Nk=class extends Tf{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,n){let r=this.renderer,s=this.nodes.getBackgroundNode(e)||e.background,o=!1;if(s===null)r._clearColor.getRGB(Gu),Gu.a=r._clearColor.a;else if(s.isColor===!0)s.getRGB(Gu),Gu.a=1,o=!0;else if(s.isNode===!0){let l=this.get(e),c=s;Gu.copy(r._clearColor);let u=l.backgroundMesh;if(u===void 0){let I=function(){s.removeEventListener("dispose",I),u.material.dispose(),u.geometry.dispose()},d=Ft(c).mul(vk).context({getUV:()=>Pse.mul(Xie),getTextureLevel:()=>Rse}),A=Ja.element(3).element(3).equal(1),y=pc(1,Ja.element(1).element(1)).mul(3),w=A.select(Mr.mul(y),Mr),S=bf.mul(Ft(w,0)),T=Ja.mul(Ft(S.xyz,1));T=T.setZ(T.w);let R=new Pr;R.name="Background.material",R.side=mi,R.depthTest=!1,R.depthWrite=!1,R.allowOverride=!1,R.fog=!1,R.lights=!1,R.vertexNode=T,R.colorNode=d,l.backgroundMeshNode=d,l.backgroundMesh=u=new Hn(new Va(1,32,32),R),u.frustumCulled=!1,u.name="Background.mesh",s.addEventListener("dispose",I)}let f=c.getCacheKey();l.backgroundCacheKey!==f&&(l.backgroundMeshNode.node=Ft(c).mul(vk),l.backgroundMeshNode.needsUpdate=!0,u.material.needsUpdate=!0,l.backgroundCacheKey=f),t.unshift(u,u.geometry,u.material,0,0,null,null)}else ze("Renderer: Unsupported background configuration.",s);let a=r.xr.getEnvironmentBlendMode();if(a==="additive"?Gu.set(0,0,0,1):a==="alpha-blend"&&Gu.set(0,0,0,0),r.autoClear===!0||o===!0){let l=n.clearColorValue;l.r=Gu.r,l.g=Gu.g,l.b=Gu.b,l.a=Gu.a,(r.backend.isWebGLBackend===!0||r.alpha===!0)&&(l.r*=l.a,l.g*=l.a,l.b*=l.a),n.depthClearValue=r.getClearDepth(),n.stencilClearValue=r.getClearStencil(),n.clearColor=r.autoClearColor===!0,n.clearDepth=r.autoClearDepth===!0,n.clearStencil=r.autoClearStencil===!0}else n.clearColor=!1,n.clearDepth=!1,n.clearStencil=!1}},rIe=0,TS=class{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=rIe++}},Fk=class{constructor(e,t,n,r,s,o,a,l,c,u,f=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=n,this.transforms=f,this.nodeAttributes=r,this.bindings=s,this.updateNodes=o,this.updateBeforeNodes=a,this.updateAfterNodes=l,this.observer=c,this.hardwareClipping=u,this.usedTimes=0}createBindings(){let e=[];for(let t of this.bindings)if(t.bindings[0].groupNode.shared!==!0){let r=new TS(t.name,[]);e.push(r);for(let s of t.bindings)r.bindings.push(s.clone())}else e.push(t);return e}},G4=class{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}},Bk=class{constructor(e,t,n){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=n}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}},q4=class{constructor(e,t,n=!1,r=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=r}},Ok=class extends q4{constructor(e,t,n=null,r=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=n,this.interpolationSampling=r}},Uk=class{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}},sIe=0,uS=class{constructor(e=null){this.id=sIe++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return t===void 0&&this.parent!==null&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}},kk=class{constructor(e,t){this.name=e,this.members=t,this.output=!1}},Mf=class{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0,this.index=-1}setValue(e){this.value=e}getValue(){return this.value}},zk=class extends Mf{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}},Vk=class extends Mf{constructor(e,t=new Oe){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}},Gk=class extends Mf{constructor(e,t=new re){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}},qk=class extends Mf{constructor(e,t=new xn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}},Hk=class extends Mf{constructor(e,t=new zt){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}},Wk=class extends Mf{constructor(e,t=new c_){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}},jk=class extends Mf{constructor(e,t=new Mn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}},Xk=class extends Mf{constructor(e,t=new cn){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}},$k=class extends zk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Yk=class extends Vk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Zk=class extends Gk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Kk=class extends qk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Qk=class extends Hk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Jk=class extends Wk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},e9=class extends jk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},t9=class extends Xk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},oIe=0,Ete=new WeakMap,Mte=new WeakMap,aIe=new WeakMap,lIe=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),DR=i=>/e/g.test(i)?String(i).replace(/\+/g,""):(i=Number(i),i+(i%1?"":".0")),hoe=i=>{if(i.writeUsageCount>0)return!0;if(i.subBuildsCache!==void 0){for(let e in i.subBuildsCache)if(hoe(i.subBuildsCache[e]))return!0}return!1},H4=class{constructor(e,t,n){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=n,this.scene=null,this.camera=null,this.nodes=new Set,this.sequentialNodes=new Set,this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.observer=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.hardwareClipping=!1,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.types={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.declarations={},this.flow={code:""},this.chaining=[],this.stack=JR(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new uS,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.subBuildLayers=[],this.activeStacks=[],this.subBuildFn=null,this.fnCall=null,Object.defineProperty(this,"id",{value:oIe++})}isFlatShading(){return this.material.flatShading===!0||this.geometry.hasAttribute("normal")===!1}isOpaque(){let e=this.material;return e.transparent===!1&&e.blending===Ts&&e.alphaToCoverage===!1}createRenderTarget(e,t,n){return new Ba(e,t,n)}createCubeRenderTarget(e,t){return new y4(e,t)}includes(e){return this.nodes.has(e)}getOutputType(e=0){let t="vec4",n=this.renderer.getRenderTarget();if(n!==null){let r=n.textures[e].type,s=n.textures[e].format,o="vec";r===Kr?o="ivec":r===xi&&(o="uvec"),s===Fd||s===kh?r===Kr?t="int":r===xi?t="uint":t="float":s===Ws||s===zh?t=`${o}2`:s===Nd||s===Ib?t=`${o}3`:t=`${o}4`}return t}getOutputStructName(){}_getBindGroup(e,t){let n=t[0].groupNode,r=n.shared;if(r)for(let o=1;o<t.length;o++)n!==t[o].groupNode&&(r=!1);let s;if(r){let o="";for(let u of t)if(u.isNodeUniformsGroup){u.uniforms.sort((f,d)=>f.nodeUniform.node.id-d.nodeUniform.node.id);for(let f of u.uniforms)o+=f.nodeUniform.node.id}else o+=u.nodeUniform.id;let a=this.renderer._currentRenderContext||this.renderer,l=Ete.get(a);l===void 0&&(l=new Map,Ete.set(a,l));let c=yx(o);s=l.get(c),s===void 0&&(s=new TS(e,t),l.set(c,s))}else s=new TS(e,t);return s}getBindGroupArray(e,t){let n=this.bindings[t],r=n[e];return r===void 0&&(this.bindingsIndexes[e]===void 0&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),n[e]=r=[]),r}getBindings(){let e=this.bindGroups;if(e===null){let t={},n=this.bindings;for(let r of YR)for(let s in n[r]){let o=n[r][s],a=t[s]||(t[s]=[]);for(let l of o)a.includes(l)===!1&&a.push(l)}e=[];for(let r in t){let s=t[r],o=this._getBindGroup(r,s);e.push(o)}this.bindGroups=e}return e}sortBindingGroups(){let e=this.getBindings();e.sort((t,n)=>t.bindings[0].groupNode.order-n.bindings[0].groupNode.order);for(let t=0;t<e.length;t++){let n=e[t];this.bindingsIndexes[n.name].group=t}}setHashNode(e,t){this.hashNodes[t]=e}addNode(e){this.nodes.has(e)===!1&&(this.nodes.add(e),this.setHashNode(e,e.getHash(this)))}addSequentialNode(e){let t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();(t!==yn.NONE||n!==yn.NONE)&&this.sequentialNodes.add(e)}buildUpdateNodes(){for(let e of this.nodes)e.getUpdateType()!==yn.NONE&&this.updateNodes.push(e);for(let e of this.sequentialNodes){let t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();t!==yn.NONE&&this.updateBeforeNodes.push(e),n!==yn.NONE&&this.updateAfterNodes.push(e)}}get currentNode(){return this.chaining[this.chaining.length-1]}isFilteredTexture(e){return e.magFilter===Mi||e.magFilter===A0||e.magFilter===qc||e.magFilter===Go||e.minFilter===Mi||e.minFilter===A0||e.minFilter===qc||e.minFilter===Go}getUniformBufferLimit(){return this.renderer.backend.capabilities.getUniformBufferLimit()}addChain(e){this.chaining.push(e)}removeChain(e){if(this.chaining.pop()!==e)throw new Error("THREE.NodeBuilder: Invalid node chaining!")}getMethod(e){return e}getTernary(){return null}getNodeFromHash(e){return this.hashNodes[e]}addFlow(e,t){return this.flowNodes[e].push(t),t}setContext(e){this.context=e}getContext(){return this.context}addContext(e){let t=this.getContext();return this.setContext({...this.context,...e}),t}getSharedContext(){let e={...this.context};return delete e.material,delete e.getUV,delete e.getOutput,delete e.getTextureLevel,delete e.getAO,delete e.getShadow,e}setCache(e){this.cache=e}getCache(){return this.cache}getCacheFromNode(e,t=!0){let n=this.getDataFromNode(e);return n.cache===void 0&&(n.cache=new uS(t?this.getCache():null)),n.cache}isAvailable(){return!1}getVertexIndex(){Xe("Abstract function.")}getInstanceIndex(){Xe("Abstract function.")}getDrawIndex(){Xe("Abstract function.")}getFrontFacing(){Xe("Abstract function.")}getFragCoord(){Xe("Abstract function.")}isFlipY(){return!1}isContextAssign(){return this.context.assign===!0}increaseUsage(e){let t=this.getDataFromNode(e);return t.usageCount=t.usageCount===void 0?1:t.usageCount+1,this.isContextAssign()?t.writeUsageCount=t.writeUsageCount===void 0?1:t.writeUsageCount+1:t.readUsageCount=t.readUsageCount===void 0?1:t.readUsageCount+1,t.usageCount}hasWriteUsage(e){let t=e.getShared(this),r=(t.isGlobal(this)?this.globalCache:this.cache).getData(t);if(r!==void 0){for(let s in r)if(hoe(r[s]))return!0}return!1}generateTexture(){Xe("Abstract function.")}generateTextureLod(){Xe("Abstract function.")}generateArrayDeclaration(e,t){return this.getType(e)+"[ "+t+" ]"}generateArray(e,t,n=null){let r=this.generateArrayDeclaration(e,t)+"( ";for(let s=0;s<t;s++){let o=n?n[s]:null;o!==null?r+=o.build(this,e):r+=this.generateConst(e),s<t-1&&(r+=", ")}return r+=" )",r}generateStruct(e,t,n=null){let r=[];for(let s of t){let{name:o,type:a}=s;n&&n[o]&&n[o].isNode?r.push(n[o].build(this,a)):r.push(this.generateConst(a))}return e+"( "+r.join(", ")+" )"}generateConst(e,t=null){if(t===null&&(e==="float"||e==="int"||e==="uint"?t=0:e==="bool"?t=!1:e==="color"?t=new zt:e==="vec2"||e==="uvec2"||e==="ivec2"?t=new Oe:e==="vec3"||e==="uvec3"||e==="ivec3"?t=new re:(e==="vec4"||e==="uvec4"||e==="ivec4")&&(t=new xn)),e==="float")return DR(t);if(e==="int")return`${Math.round(t)}`;if(e==="uint")return t>=0?`${Math.round(t)}u`:"0u";if(e==="bool")return t?"true":"false";if(e==="color")return`${this.getType("vec3")}( ${DR(t.r)}, ${DR(t.g)}, ${DR(t.b)} )`;let n=this.getTypeLength(e),r=this.getComponentType(e),s=o=>this.generateConst(r,o);if(n===2)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)} )`;if(n===3)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)} )`;if(n===4&&e!=="mat2")return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)}, ${s(t.w)} )`;if(n>=4&&t&&(t.isMatrix2||t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(s).join(", ")} )`;if(n>4)return`${this.getType(e)}()`;throw new Error(`THREE.NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return e==="color"?"vec3":e}hasGeometryAttribute(e){return this.geometry&&this.geometry.getAttribute(e)!==void 0}getAttribute(e,t){let n=this.attributes;for(let s of n)if(s.name===e)return s;let r=new G4(e,t);return this.registerDeclaration(r),n.push(r),r}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return e==="void"||e==="property"||e==="sampler"||e==="samplerComparison"||e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="depthTexture"||e==="texture3D"}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){let t=e.type;return e.isDepthTexture===!0?"float":t===Kr?"int":t===xi?"uint":"float"}getElementType(e){return e==="mat2"?"vec2":e==="mat3"?"vec3":e==="mat4"?"vec4":this.getComponentType(e)}getComponentType(e){if(e=this.getVectorType(e),e==="float"||e==="bool"||e==="int"||e==="uint")return e;let t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return t===null?null:t[1]==="b"?"bool":t[1]==="i"?"int":t[1]==="u"?"uint":"float"}getVectorType(e){return e==="color"?"vec3":e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="texture3D"?"vec4":e}getTypeFromLength(e,t="float"){if(e===1)return t;let n=nne(e),r=t==="float"?"":t[0];return/mat2/.test(t)===!0&&(n=n.replace("vec","mat")),r+n}getTypeFromArray(e){return lIe.get(e.constructor)}isInteger(e){return/int|uint|(i|u)vec/.test(e)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);let n=t.array,r=e.itemSize,s=e.normalized,o;return!(e instanceof Qv)&&s!==!0&&(o=this.getTypeFromArray(n)),this.getTypeFromLength(r,o)}getTypeLength(e){let t=this.getVectorType(e),n=/vec([2-4])/.exec(t);return n!==null?Number(n[1]):t==="float"||t==="bool"||t==="int"||t==="uint"?1:/mat2/.test(e)===!0?4:/mat3/.test(e)===!0?9:/mat4/.test(e)===!0?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){let t=this.getComponentType(e);return t==="int"||t==="uint"?e:this.changeComponentType(e,"int")}setActiveStack(e){this.activeStacks.push(e)}removeActiveStack(e){if(this.activeStacks[this.activeStacks.length-1]===e)this.activeStacks.pop();else throw new Error("THREE.NodeBuilder: Invalid active stack removal.")}getActiveStack(){return this.activeStacks[this.activeStacks.length-1]}getBaseStack(){return this.activeStacks[0]}addStack(){this.stack=JR(this.stack);let e=fz();return this.stacks.push(e),fS(this.stack),this.stack}removeStack(){let e=this.stack;for(let t of e.nodes){let n=this.getDataFromNode(t);n.stack=e}return this.stack=e.parent,fS(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,n=null){n=n===null?e.isGlobal(this)?this.globalCache:this.cache:n;let r=n.getData(e);r===void 0&&(r={},n.setData(e,r)),r[t]===void 0&&(r[t]={});let s=r[t];if(this.subBuildLayers.length===0)return s;let o=r.any?r.any.subBuilds:null,a=this.getClosestSubBuild(o);return a&&(s.subBuildsCache===void 0&&(s.subBuildsCache={}),s=s.subBuildsCache[a]||(s.subBuildsCache[a]={}),s.subBuilds=o),s}getNodeProperties(e,t="any"){let n=this.getDataFromNode(e,t);return n.properties||(n.properties={outputNode:null})}getBufferAttributeFromNode(e,t,n=null){let r=this.getDataFromNode(e,"vertex"),s=r.bufferAttribute;if(s===void 0){let o=this.uniforms.index++;n===null&&(n="nodeAttribute"+o),s=new G4(n,t,e),this.bufferAttributes.push(s),r.bufferAttribute=s}return s}getStructTypeNode(e,t=this.shaderStage){return this.types[t][e]||null}getStructTypeFromNode(e,t,n=null,r=this.shaderStage){let s=this.getDataFromNode(e,r,this.globalCache),o=s.structType;if(o===void 0){let a=this.structs.index++;n===null&&(n="StructType"+a),o=new kk(n,t),this.structs[r].push(o),this.types[r][n]=e,s.structType=o}return o}getOutputStructTypeFromNode(e,t){let n=this.getStructTypeFromNode(e,t,"OutputType","fragment");return n.output=!0,n}getUniformFromNode(e,t,n=this.shaderStage,r=null){let s=this.getDataFromNode(e,n,this.globalCache),o=s.uniform;if(o===void 0){let a=this.uniforms.index++;o=new Bk(r||"nodeUniform"+a,t,e),this.uniforms[n].push(o),this.registerDeclaration(o),s.uniform=o}return o}getVarFromNode(e,t=null,n=e.getNodeType(this),r=this.shaderStage,s=!1){let o=this.getDataFromNode(e,r),a=this.getSubBuildProperty("variable",o.subBuilds),l=o[a];if(l===void 0){let c=s?"_const":"_var",u=this.vars[r]||(this.vars[r]=[]),f=this.vars[c]||(this.vars[c]=0);t===null&&(t=(s?"nodeConst":"nodeVar")+f,this.vars[c]++),a!=="variable"&&(t=this.getSubBuildProperty(t,o.subBuilds));let d=e.getArrayCount(this);l=new q4(t,n,s,d),s||u.push(l),this.registerDeclaration(l),o[a]=l}return l}isDeterministic(e){if(e.isMathNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0)&&(e.cNode?this.isDeterministic(e.cNode):!0);if(e.isOperatorNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0);if(e.isArrayNode){if(e.values!==null){for(let t of e.values)if(!this.isDeterministic(t))return!1}return!0}else if(e.isConstNode)return!0;return!1}getVaryingFromNode(e,t=null,n=e.getNodeType(this),r=null,s=null){let o=this.getDataFromNode(e,"any"),a=this.getSubBuildProperty("varying",o.subBuilds),l=o[a];if(l===void 0){let c=this.varyings,u=c.length;t===null&&(t="nodeVarying"+u),a!=="varying"&&(t=this.getSubBuildProperty(t,o.subBuilds)),l=new Ok(t,n,r,s),c.push(l),this.registerDeclaration(l),o[a]=l}return l}registerDeclaration(e){let t=this.shaderStage,n=this.declarations[t]||(this.declarations[t]={}),r=e.name,s=r,o=this.getPropertyName(e),a=1;for(;n[o]!==void 0;)s=r+"_"+a++,e.name=s,o=this.getPropertyName(e);s!==r&&Xe(`TSL: Declaration name '${r}' of '${e.type}' already in use. Renamed to '${s}'.`),n[o]=e}getCodeFromNode(e,t,n=this.shaderStage){let r=this.getDataFromNode(e),s=r.code;if(s===void 0){let o=this.codes[n]||(this.codes[n]=[]),a=o.length;s=new Uk("nodeCode"+a,t),o.push(s),r.code=s}return s}addFlowCodeHierarchy(e,t){let{flowCodes:n,flowCodeBlock:r}=this.getDataFromNode(e),s=!0,o=t;for(;o;){if(r.get(o)===!0){s=!1;break}o=this.getDataFromNode(o).parentNodeBlock}if(s)for(let a of n)this.addLineFlowCode(a)}addLineFlowCodeBlock(e,t,n){let r=this.getDataFromNode(e),s=r.flowCodes||(r.flowCodes=[]),o=r.flowCodeBlock||(r.flowCodeBlock=new WeakMap);s.push(t),o.set(n,!0)}addLineFlowCode(e,t=null){return e===""?this:(t!==null&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e=e+`;4161+`),this.flow.code+=e,this)}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+=" ",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){let t=e.getNodeType(this),n=this.flowChildNode(e,t);return this.flowsData.set(e,n),n}addInclude(e){this.currentFunctionNode!==null&&this.currentFunctionNode.includes.push(e)}buildFunctionNode(e){let t=this.renderer.backend,n=Mte.get(t);n===void 0&&(n=new WeakMap,Mte.set(t,n));let r=n.get(e);if(r===void 0){r=new O4;let s=this.currentFunctionNode;this.currentFunctionNode=r,r.code=this.buildFunctionCode(e),this.currentFunctionNode=s,n.set(e,r)}return r}flowShaderNode(e){let t=e.layout,n={[Symbol.iterator](){let o=0,a=Object.values(this);return{next:()=>({value:a[o],done:o++>=a.length})}}};for(let o of t.inputs)n[o.name]=new P4(o.type,o.name);e.layout=null;let r=e.call(n),s=this.flowStagesNode(r,t.type);return e.layout=t,s}flowBuildStage(e,t,n=null){let r=this.getBuildStage();this.setBuildStage(t);let s=e.build(this,n);return this.setBuildStage(r),s}flowStagesNode(e,t=null){let n=this.flow,r=this.vars,s=this.declarations,o=this.cache,a=this.buildStage,l=this.stack,c={code:""};this.flow=c,this.vars={},this.declarations={},this.cache=new uS,this.stack=JR();for(let u of $R)this.setBuildStage(u),c.result=e.build(this,t);return c.vars=this.getVars(this.shaderStage),this.flow=n,this.vars=r,this.declarations=s,this.cache=o,this.stack=l,this.setBuildStage(a),c}getFunctionOperator(){return null}buildFunctionCode(){Xe("Abstract function.")}flowChildNode(e,t=null){let n=this.flow,r={code:""};return this.flow=r,r.result=e.build(this,t),this.flow=n,r}flowNodeFromShaderStage(e,t,n=null,r=null){let s=this.tab,o=this.cache,a=this.shaderStage,l=this.context;this.setShaderStage(e);let c={...this.context};delete c.nodeBlock,this.cache=this.globalCache,this.tab=" ",this.context=c;let u=null;if(this.buildStage==="generate"){let f=this.flowChildNode(t,n);r!==null&&(f.code+=`${this.tab+r} = ${f.result};41624162 `),this.flowCode[e]=this.flowCode[e]+f.code,u=f}else u=t.build(this);return this.setShaderStage(a),this.cache=o,this.tab=s,this.context=l,u}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){Xe("Abstract function.")}getVaryings(){Xe("Abstract function.")}getVar(e,t,n=null){return`${n!==null?this.generateArrayDeclaration(e,n):this.getType(e)} ${t}`}getVars(e,t=!1){let n=[],r=this.vars[e];if(r!==void 0)for(let s of r)n.push(`${this.getVar(s.type,s.name,s.count)};`);return n.join(t?`41634163 `:`41644164 `)}getUniforms(){Xe("Abstract function.")}getCodes(e){let t=this.codes[e],n="";if(t!==void 0)for(let r of t)n+=r.code+`4165-`;return n}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){Xe("Abstract function.")}get subBuild(){return this.subBuildLayers[this.subBuildLayers.length-1]||null}addSubBuild(e){this.subBuildLayers.push(e)}removeSubBuild(){return this.subBuildLayers.pop()}getClosestSubBuild(e){let t;if(e&&e.isNode?e.isShaderCallNodeInternal?t=e.shaderNode.subBuilds:e.isStackNode?t=[e.subBuild]:t=this.getDataFromNode(e,"any").subBuilds:e instanceof Set?t=[...e]:t=e,!t)return null;let n=this.subBuildLayers;for(let r=t.length-1;r>=0;r--){let s=t[r];if(n.includes(s))return s}return null}getSubBuildOutput(e){return this.getSubBuildProperty("outputNode",e)}getSubBuildProperty(e="",t=null){let n;t!==null?n=this.getClosestSubBuild(t):n=this.subBuildFn;let r;return n?r=e?n+"_"+e:n:r=e,r}prebuild(){let{object:e,renderer:t,material:n}=this;if(t.contextNode.isContextNode===!0?this.context={...this.context,...t.contextNode.getFlowContextData()}:ze('NodeBuilder: "renderer.contextNode" must be an instance of `context()`.'),n&&n.contextNode&&(n.contextNode.isContextNode===!0?this.context={...this.context,...n.contextNode.getFlowContextData()}:ze('NodeBuilder: "material.contextNode" must be an instance of `context()`.')),n!==null){let r=t.library.fromMaterial(n);r===null&&(ze(`NodeBuilder: Material "${n.type}" is not compatible.`),r=new Pr),r.build(this)}else this.addFlow("compute",e)}build(){this.prebuild();for(let e of JR){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of e4){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}async buildAsync(){this.prebuild();for(let e of JR){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of e4){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this);await pF()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=uPe.get(e);return t===void 0&&(t={}),t}getNodeUniform(e,t){let n=this.getSharedDataFromNode(e),r=n.cache;if(r===void 0){if(t==="float"||t==="int"||t==="uint")r=new $k(e);else if(t==="vec2"||t==="ivec2"||t==="uvec2")r=new Yk(e);else if(t==="vec3"||t==="ivec3"||t==="uvec3")r=new Zk(e);else if(t==="vec4"||t==="ivec4"||t==="uvec4")r=new Kk(e);else if(t==="color")r=new Qk(e);else if(t==="mat2")r=new Jk(e);else if(t==="mat3")r=new e9(e);else if(t==="mat4")r=new t9(e);else throw new Error(`THREE.NodeBuilder: Uniform "${t}" not implemented.`);n.cache=r}return r}format(e,t,n){if(t=this.getVectorType(t),n=this.getVectorType(n),t===n||n===null||this.isReference(n))return e;let r=this.getTypeLength(t),s=this.getTypeLength(n);return r===16&&s===9?`${this.getType(n)}( ${e}[ 0 ].xyz, ${e}[ 1 ].xyz, ${e}[ 2 ].xyz )`:r===9&&s===4?`${this.getType(n)}( ${e}[ 0 ].xy, ${e}[ 1 ].xy )`:r>4||s>4||s===0?e:r===s?`${this.getType(n)}( ${e} )`:r>s?(e=n==="bool"?`all( ${e} )`:`${e}.${"xyz".slice(0,s)}`,this.format(e,this.getTypeFromLength(s,this.getComponentType(t)),n)):s===4&&r>1?`${this.getType(n)}( ${this.format(e,t,"vec3")}, 1.0 )`:r===2?`${this.getType(n)}( ${this.format(e,t,"vec2")}, 0.0 )`:(r===1&&s>1&&t!==this.getComponentType(n)&&(e=`${this.getType(this.getComponentType(n))}( ${e} )`),`${this.getType(n)}( ${e} )`)}getSignature(){return`// Three.js r${"185"} - Node System4166-`}needsPreviousData(){let e=this.renderer.getMRT();return e&&e.has("velocity")||lne(this.object).useVelocity===!0}},Z4=class{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let n=e.get(t);return n===void 0&&(n={renderId:0,frameId:0},e.set(t,n)),n}updateBeforeNode(e){let t=e.getUpdateBeforeType(),n=e.updateReference(this);if(t===yn.FRAME){let r=this._getMaps(this.updateBeforeMap,n);if(r.frameId!==this.frameId){let s=r.frameId;r.frameId=this.frameId,e.updateBefore(this)===!1&&(r.frameId=s)}}else if(t===yn.RENDER){let r=this._getMaps(this.updateBeforeMap,n);if(r.renderId!==this.renderId){let s=r.renderId;r.renderId=this.renderId,e.updateBefore(this)===!1&&(r.renderId=s)}}else t===yn.OBJECT&&e.updateBefore(this)}updateAfterNode(e){let t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===yn.FRAME){let r=this._getMaps(this.updateAfterMap,n);r.frameId!==this.frameId&&e.updateAfter(this)!==!1&&(r.frameId=this.frameId)}else if(t===yn.RENDER){let r=this._getMaps(this.updateAfterMap,n);r.renderId!==this.renderId&&e.updateAfter(this)!==!1&&(r.renderId=this.renderId)}else t===yn.OBJECT&&e.updateAfter(this)}updateNode(e){let t=e.getUpdateType(),n=e.updateReference(this);if(t===yn.FRAME){let r=this._getMaps(this.updateMap,n);r.frameId!==this.frameId&&e.update(this)!==!1&&(r.frameId=this.frameId)}else if(t===yn.RENDER){let r=this._getMaps(this.updateMap,n);r.renderId!==this.renderId&&e.update(this)!==!1&&(r.renderId=this.renderId)}else t===yn.OBJECT&&e.update(this)}update(){this.frameId++,this.lastTime===void 0&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}},RS=class{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}};RS.isNodeFunctionInput=!0;var n9=class extends tp{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}},i9=class extends tp{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){let e=this.colorNode;return{lightDirection:RV(this.light),lightColor:e}}},r9=class extends tp{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=MV(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=Xt(new zt).setGroup(Jt)}update(e){let{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){let{colorNode:t,groundColorNode:n,lightDirectionNode:r}=this,o=Tm.dot(r).mul(.5).add(.5),a=Qn(n,t,o);e.context.irradiance.addAssign(a)}},IS=class extends tp{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=Xt(0).setGroup(Jt),this.penumbraCosNode=Xt(0).setGroup(Jt),this.cutoffDistanceNode=Xt(0).setGroup(Jt),this.decayExponentNode=Xt(0).setGroup(Jt),this.colorNode=Xt(this.color).setGroup(Jt)}update(e){super.update(e);let{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e,t){let{coneCosNode:n,penumbraCosNode:r}=this;return gc(n,r,t)}getLightCoord(e){let t=e.getNodeProperties(this),n=t.projectionUV;return n===void 0&&(n=jse(this.light,e.context.positionWorld),t.projectionUV=n),n}setupDirect(e){let{colorNode:t,cutoffDistanceNode:n,decayExponentNode:r,light:s}=this,o=this.getLightVector(e),a=o.normalize(),l=a.dot(RV(s)),c=this.getSpotAttenuation(e,l),u=o.length(),f=PV({lightDistance:u,cutoffDistance:n,decayExponent:r}),d=t.mul(c).mul(f),A,y;return s.colorNode?(y=this.getLightCoord(e),A=s.colorNode(y)):s.map&&(y=this.getLightCoord(e),A=fi(s.map,y.xy).onRenderUpdate(()=>s.map)),A&&(d=y.mul(2).sub(1).abs().lessThan(1).all().select(d.mul(A),d)),{lightColor:d,lightDirection:a}}},s9=class extends IS{static get type(){return"IESSpotLightNode"}constructor(e=null){super(e),this._iesTextureNode=null}getSpotAttenuation(e,t){let n=this.light.iesMap,r=null;if(n&&n.isTexture===!0){let s=t.acos().mul(1/Math.PI);this._iesTextureNode=fi(n,dt(s,0),0),r=this._iesTextureNode.r}else r=super.getSpotAttenuation(e,t);return r}update(e){super.update(e),this._iesTextureNode!==null&&this.light.iesMap&&(this._iesTextureNode.value=this.light.iesMap)}},o9=class extends tp{static get type(){return"LightProbeNode"}constructor(e=null){super(e);let t=[];for(let n=0;n<9;n++)t.push(new re);this.lightProbe=$o(t)}update(e){let{light:t}=this;super.update(e);for(let n=0;n<9;n++)this.lightProbe.array[n].copy(t.sh.coefficients[n]).multiplyScalar(t.intensity)}setup(e){let t=poe(Tm,this.lightProbe);e.context.irradiance.addAssign(t)}},fPe=me(([i,e])=>{let t=i.abs().sub(e);return bf(Vr(t,0)).add(Pl(Vr(t.x,t.y),0))}),a9=class extends IS{static get type(){return"ProjectorLightNode"}update(e){super.update(e);let t=this.light;if(this.penumbraCosNode.value=Math.min(Math.cos(t.angle*(1-t.penumbra)),.99999),t.aspect===null){let n=1;t.map!==null&&(n=t.map.width/t.map.height),t.shadow.aspect=n}else t.shadow.aspect=t.aspect}getSpotAttenuation(e){let t=oe(0),n=this.penumbraCosNode,r=HI(this.light).mul(e.context.positionWorld||wf);return $t(r.w.greaterThan(0),()=>{let s=r.xyz.div(r.w),o=fPe(s.xy.sub(dt(.5)),dt(.5)),a=Ac(-1,ai(1,Tz(n)).sub(1));t.assign(RI(o.mul(-2).mul(a)))}),t}},aU=new cn,kR=new cn,Yw=null,l9=class extends tp{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=Xt(new re).setGroup(Jt),this.halfWidth=Xt(new re).setGroup(Jt),this.updateType=yn.RENDER}update(e){super.update(e);let{light:t}=this,n=e.camera.matrixWorldInverse;kR.identity(),aU.copy(t.matrixWorld),aU.premultiply(n),kR.extractRotation(aU),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(kR),this.halfHeight.value.applyMatrix4(kR)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=fi(Yw.LTC_FLOAT_1),n=fi(Yw.LTC_FLOAT_2)):(t=fi(Yw.LTC_HALF_1),n=fi(Yw.LTC_HALF_2));let{colorNode:r,light:s}=this,o=CV(s);return{lightColor:r,lightPosition:o,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){Yw=e}},K4=class{parseFunction(){Xe("Abstract function.")}},PS=class{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){Xe("Abstract function.")}};PS.isNodeFunction=!0;var dPe=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,pPe=/[a-z_0-9]+/ig,Lte="#pragma main",mPe=i=>{i=i.trim();let e=i.indexOf(Lte),t=e!==-1?i.slice(e+Lte.length):i,n=t.match(dPe);if(n!==null&&n.length===5){let r=n[4],s=[],o=null;for(;(o=pPe.exec(r))!==null;)s.push(o);let a=[],l=0;for(;l<s.length;){let y=s[l][0]==="const";y===!0&&l++;let w=s[l][0];w==="in"||w==="out"||w==="inout"?l++:w="";let S=s[l++][0],T=Number.parseInt(s[l][0]);Number.isNaN(T)===!1?l++:T=null;let R=s[l++][0];a.push(new RS(S,R,T,w,y))}let c=t.substring(n[0].length),u=n[3]!==void 0?n[3]:"",f=n[2],d=n[1]!==void 0?n[1]:"",A=e!==-1?i.slice(0,e):"";return{type:f,inputs:a,name:u,precision:d,inputsCode:r,blockCode:c,headerCode:A}}else throw new Error("THREE.FunctionNode: Function is not a GLSL code.")},c9=class extends PS{constructor(e){let{type:t,inputs:n,name:r,precision:s,inputsCode:o,blockCode:a,headerCode:l}=mPe(e);super(t,n,r,s),this.inputsCode=o,this.blockCode=a,this.headerCode=l}getCode(e=this.name){let t,n=this.blockCode;if(n!==""){let{type:r,inputsCode:s,headerCode:o,precision:a}=this,l=`${r} ${e} ( ${s.trim()} )`;a!==""&&(l=`${a} ${l}`),t=o+l+n}else t="";return t}},u9=class extends K4{parseFunction(e){return new c9(e)}},Jc=[],Wd=[],Dte=Xt(0,"int").setGroup(Jt),h9=class extends Rf{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new Z4,this.nodeBuilderCache=new Map,this.callHashCache=new Cf,this.groupsData=new Cf,this._buildQueue=[],this._buildInProgress=!1,this.cacheLib={}}updateGroup(e){let t=e.groupNode;if(t.updateType===yn.OBJECT)return!0;Jc[0]=t,Jc[1]=e;let n=this.groupsData.get(Jc);return n===void 0&&this.groupsData.set(Jc,n={}),Jc[0]=null,Jc[1]=null,n.version!==t.version?(n.version=t.version,!0):!1}getForRenderCacheKey(e){return e.initialCacheKey}_createNodeBuilder(e,t){let n=this.backend.createNodeBuilder(e.object,this.renderer);return n.scene=e.scene,n.material=t,n.camera=e.camera,n.context.material=t,n.lightsNode=e.lightsNode,n.environmentNode=this.getEnvironmentNode(e.scene),n.fogNode=this.getFogNode(e.scene),n.clippingContext=e.clippingContext,this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview&&n.enableMultiview(),n}getForRender(e,t=!1){let n=this.get(e),r=n.nodeBuilderState;if(r===void 0){let{nodeBuilderCache:s}=this,o=this.getForRenderCacheKey(e);if(r=s.get(o),r===void 0){let a=async()=>{let l=this._createNodeBuilder(e,e.material);try{t?await l.buildAsync():l.build()}catch(c){l=this._createNodeBuilder(e,new Pr),t?await l.buildAsync():l.build(),ze("TSL: "+c)}return l};if(t)return a().then(l=>(r=this._createNodeBuilderState(l),s.set(o,r),r.usedTimes++,n.nodeBuilderState=r,r));{let l=this._createNodeBuilder(e,e.material);try{l.build()}catch(c){l=this._createNodeBuilder(e,new Pr),l.build();let u=c.stackTrace;!u&&c.stack&&(u=new ts(c.stack)),ze("TSL: "+c,u)}r=this._createNodeBuilderState(l),s.set(o,r)}}r.usedTimes++,n.nodeBuilderState=r}return r}getForRenderAsync(e){let t=this.getForRender(e,!0);return t.then?t:Promise.resolve(t)}getForRenderDeferred(e){let t=this.get(e);if(t.nodeBuilderState!==void 0)return t.nodeBuilderState;let n=this.getForRenderCacheKey(e),r=this.nodeBuilderCache.get(n);return r!==void 0?(r.usedTimes++,t.nodeBuilderState=r,r):(t.pendingBuild!==!0&&(t.pendingBuild=!0,this._buildQueue.push(()=>this.getForRenderAsync(e).then(()=>{t.pendingBuild=!1})),this._processBuildQueue()),null)}_processBuildQueue(){if(this._buildInProgress||this._buildQueue.length===0)return;this._buildInProgress=!0,this._buildQueue.shift()().then(()=>{this._buildInProgress=!1,this._processBuildQueue()})}delete(e){if(e.isRenderObject){let t=this.get(e).nodeBuilderState;t!==void 0&&(t.usedTimes--,t.usedTimes===0&&this.nodeBuilderCache.delete(this.getForRenderCacheKey(e)))}return super.delete(e)}getForCompute(e){let t=this.get(e),n=t.nodeBuilderState;if(n===void 0||t.version!==e.version){let r=this.backend.createNodeBuilder(e,this.renderer);r.build(),n=this._createNodeBuilderState(r),t.nodeBuilderState=n,t.version=e.version}return n}_createNodeBuilderState(e){return new Fk(e.vertexShader,e.fragmentShader,e.computeShader,e.getAttributesArray(),e.getBindings(),e.updateNodes,e.updateBeforeNodes,e.updateAfterNodes,e.observer,e.hardwareClipping,e.transforms)}getEnvironmentNode(e){if(this.renderer.lighting.enabled===!1)return null;this.updateEnvironment(e);let t=null;if(e.environmentNode&&e.environmentNode.isNode)t=e.environmentNode;else{let n=this.get(e);n.environmentNode&&(t=n.environmentNode)}return t}getBackgroundNode(e){this.updateBackground(e);let t=null;if(e.backgroundNode&&e.backgroundNode.isNode)t=e.backgroundNode;else{let n=this.get(e);n.backgroundNode&&(t=n.backgroundNode)}return t}getFogNode(e){return this.updateFog(e),e.fogNode||this.get(e).fogNode||null}getCacheKey(e,t){Jc[0]=e,Jc[1]=t;let n=this.renderer.info.calls,r=this.callHashCache.get(Jc)||{};if(r.callId!==n){if(Wd.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),Wd.push(this.renderer.lighting.enabled?1:0),this.renderer.lighting.enabled){Wd.push(t.getCacheKey(!0)),Wd.push(this.renderer.shadowMap.enabled?1:0),Wd.push(this.renderer.shadowMap.type);let o=this.getEnvironmentNode(e);o&&Wd.push(o.getCacheKey())}let s=this.getFogNode(e);s&&Wd.push(s.getCacheKey()),r.callId=n,r.cacheKey=FS(Wd),this.callHashCache.set(Jc,r),Wd.length=0}return Jc[0]=null,Jc[1]=null,r.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}updateBackground(e){let t=this.get(e),n=e.background;if(n){let r=e.backgroundBlurriness===0&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&t.backgroundBlurriness===0;if(t.background!==n||r){let s=this.getCacheNode("background",n,()=>{if(n.isCubeTexture===!0||n.mapping===m0||n.mapping===A0||n.mapping===zh){if(e.backgroundBlurriness>0||n.mapping===zh)return yV(n);{let o;return n.isCubeTexture===!0?o=Qa(n):o=fi(n),cse(o)}}else{if(n.isTexture===!0)return fi(n,Zu.flipY()).setUpdateMatrix(!0);n.isColor!==!0&&ze("WebGPUNodes: Unsupported background configuration.",n)}},r);t.backgroundNode=s,t.background=n,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,n,r=!1){let s=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap),o=s.get(t);return(o===void 0||r)&&(o=n(),s.set(t,o)),o}updateFog(e){let t=this.get(e),n=e.fog;if(n){if(t.fog!==n){let r=this.getCacheNode("fog",n,()=>{if(n.isFogExp2){let s=mr("color","color",n).setGroup(Jt),o=mr("density","float",n).setGroup(Jt);return Tk(s,Wse(o))}else if(n.isFog){let s=mr("color","color",n).setGroup(Jt),o=mr("near","float",n).setGroup(Jt),a=mr("far","float",n).setGroup(Jt);return Tk(s,Hse(o,a))}else ze("Renderer: Unsupported fog configuration.",n)});t.fogNode=r,t.fog=n}}else delete t.fogNode,delete t.fog}updateEnvironment(e){let t=this.get(e),n=e.environment;if(n){if(t.environment!==n){let r=this.getCacheNode("environment",n,()=>{if(n.isCubeTexture===!0)return Qa(n);if(n.isTexture===!0)return fi(n);ze("Nodes: Unsupported environment configuration.",n)});t.environmentNode=r,t.environment=n}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,n=null,r=null,s=null){let o=this.nodeFrame;return o.renderer=e,o.scene=t,o.object=n,o.camera=r,o.material=s,o}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){let e=this.renderer;return e.toneMapping+","+e.currentColorSpace+","+e.xr.isPresenting}getOutputNode(e){let t=this.renderer,n;return e.isArrayTexture?this.backend.isWebGLBackend?n=fi(e,Zu).depth(rp("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):n=fi(e,Zu).depth(Dte).renderOutput(t.toneMapping,t.currentColorSpace):n=fi(e,Zu).renderOutput(t.toneMapping,t.currentColorSpace),n}setOutputLayerIndex(e){Dte.value=e}updateBefore(e){let t=e.getNodeBuilderState();for(let n of t.updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(n)}updateAfter(e){let t=e.getNodeBuilderState();for(let n of t.updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(n)}updateForCompute(e){let t=this.getNodeFrame(),n=this.getForCompute(e);for(let r of n.updateNodes)t.updateNode(r)}updateForRender(e){let t=this.getNodeFrameForRender(e),n=e.getNodeBuilderState();for(let r of n.updateNodes)t.updateNode(r)}needsRefresh(e){let t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new Z4,this.nodeBuilderCache=new Map,this.cacheLib={}}},lU=new Na,Q4=class i{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewMatrix=new cn,this.viewNormalMatrix=new Mn,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,e!==null&&(this.viewMatrix=e.viewMatrix,this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass)}projectPlanes(e,t,n){let r=e.length;for(let s=0;s<r;s++){lU.copy(e[s]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);let o=t[n+s],a=lU.normal;o.x=-a.x,o.y=-a.y,o.z=-a.z,o.w=lU.constant}}updateGlobal(e,t){this.shadowPass=e.overrideMaterial!==null&&e.overrideMaterial.isShadowPassMaterial,this.viewMatrix.copy(t.matrixWorldInverse),this.viewNormalMatrix.getNormalMatrix(this.viewMatrix)}update(e,t){let n=!1;e.version!==this.parentVersion&&(this.intersectionPlanes=Array.from(e.intersectionPlanes),this.unionPlanes=Array.from(e.unionPlanes),this.parentVersion=e.version),this.clipIntersection!==t.clipIntersection&&(this.clipIntersection=t.clipIntersection,this.clipIntersection?this.unionPlanes.length=e.unionPlanes.length:this.intersectionPlanes.length=e.intersectionPlanes.length);let r=t.clippingPlanes,s=r.length,o,a;if(this.clipIntersection?(o=this.intersectionPlanes,a=e.intersectionPlanes.length):(o=this.unionPlanes,a=e.unionPlanes.length),o.length!==a+s){o.length=a+s;for(let l=0;l<s;l++)o[a+l]=new xn;n=!0}this.projectPlanes(r,o,a),n&&(this.version++,this.cacheKey=`${this.intersectionPlanes.length}:${this.unionPlanes.length}`)}getGroupContext(e){if(this.shadowPass&&!e.clipShadows)return this;let t=this.clippingGroupContexts.get(e);return t===void 0&&(t=new i(this),this.clippingGroupContexts.set(e,t)),t.update(this,e),t}get unionClippingCount(){return this.unionPlanes.length}},f9=class{constructor(e,t,n){this.bundleGroup=e,this.camera=t,this.renderContext=n}},nm=[],d9=class{constructor(){this.bundles=new Cf}get(e,t,n){let r=this.bundles;nm[0]=e,nm[1]=t,nm[2]=n;let s=r.get(nm);return s===void 0&&(s=new f9(e,t,n),r.set(nm,s)),nm[0]=null,nm[1]=null,nm[2]=null,s}dispose(){this.bundles=new Cf}},J4=class{constructor(){this.lightNodes=new WeakMap,this.materialNodes=new Map,this.toneMappingNodes=new Map}fromMaterial(e){if(e.isNodeMaterial)return e;let t=null,n=this.getMaterialNodeClass(e.type);if(n!==null){t=new n;for(let r in e)t[r]=e[r]}return t}addToneMapping(e,t){this.addType(e,t,this.toneMappingNodes)}getToneMappingFunction(e){return this.toneMappingNodes.get(e)||null}getMaterialNodeClass(e){return this.materialNodes.get(e)||null}addMaterial(e,t){this.addType(e,t,this.materialNodes)}getLightNodeClass(e){return this.lightNodes.get(e)||null}addLight(e,t){this.addClass(e,t,this.lightNodes)}addType(e,t,n){if(n.has(t)){Xe(`Redefinition of node ${t}`);return}if(typeof e!="function")throw new Error(`THREE.NodeLibrary: Node class ${e.name} is not a class.`);if(typeof t=="function"||typeof t=="object")throw new Error(`THREE.NodeLibrary: Base class ${t} is not a class.`);n.set(t,e)}addClass(e,t,n){if(n.has(t)){Xe(`Redefinition of node ${t.name}`);return}if(typeof e!="function")throw new Error(`THREE.NodeLibrary: Node class ${e.name} is not a class.`);if(typeof t!="function")throw new Error(`THREE.NodeLibrary: Base class ${t.name} is not a class.`);n.set(t,e)}},APe=new MS,Nte=new WeakMap,p9=class{constructor(){this.enabled=!0,this._cache=[]}createNode(e=[]){return new MS().setLights(e)}getNode(e){if(e.isScene!==!0&&e.isGroup!==!0)return APe;let t=Nte.get(e);return t===void 0&&(t=this.createNode(),Nte.set(e,t)),t}beginRender(e){this._cache.push(this.getNode(e).getLights())}finishRender(e){this.getNode(e).setLights(this._cache.pop())}},Wg=class extends Ba{constructor(e=1,t=1,n={}){super(e,t,n),this.isXRRenderTarget=!0,this._hasExternalTextures=!1,this._autoAllocateDepthBuffer=!0,this._isOpaqueFramebuffer=!1}copy(e){return super.copy(e),this._hasExternalTextures=e._hasExternalTextures,this._autoAllocateDepthBuffer=e._autoAllocateDepthBuffer,this._isOpaqueFramebuffer=e._isOpaqueFramebuffer,this}},Fte=new re,Bte=new re,Ote=new WeakMap,m9=class extends ca{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new Yr,this._cameraL.viewport=new xn,this._cameraL.matrixWorldAutoUpdate=!1,this._cameraR=new Yr,this._cameraR.viewport=new xn,this._cameraR.matrixWorldAutoUpdate=!1,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new c_,this._currentDepthNear=null,this._currentDepthFar=null,this._controllers=[],this._controllerInputSources=[],this._xrRenderTarget=null,this._layers=[],this._sessionUsesLayers=!1,this._supportsGlBinding=typeof XRWebGLBinding<"u",this._supportsWebGPUBinding=typeof globalThis.XRGPUBinding<"u",this._createXRLayer=bPe.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSamples=null,this._currentSize=new Oe,this._onSessionEvent=_Pe.bind(this),this._onSessionEnd=xPe.bind(this),this._onInputSourcesChange=yPe.bind(this),this._onAnimationFrame=wPe.bind(this),this._referenceSpace=null,this._referenceSpaceType="local-floor",this._customReferenceSpace=null,this._framebufferScaleFactor=1,this._foveation=1,this._session=null,this._glBaseLayer=null,this._glBinding=null,this._webgpuBinding=null,this._glProjLayer=null,this._xrFrame=null,this._supportsLayers=this._supportsGlBinding&&"createProjectionLayer"in XRWebGLBinding.prototype,this._useMultiviewIfPossible=t,this._useMultiview=!1}getController(e){return this._getController(e).getTargetRaySpace()}getControllerGrip(e){return this._getController(e).getGripSpace()}getHand(e){return this._getController(e).getHandSpace()}getFoveation(){return this._foveation}setFoveation(e){this._foveation=e,this._glProjLayer!==null&&(this._glProjLayer.fixedFoveation=e),this._glBaseLayer!==null&&this._glBaseLayer.fixedFoveation!==void 0&&(this._glBaseLayer.fixedFoveation=e)}getFramebufferScaleFactor(){return this._framebufferScaleFactor}setFramebufferScaleFactor(e){this._framebufferScaleFactor=e,this.isPresenting===!0&&Xe("XRManager: Cannot change framebuffer scale while presenting.")}getReferenceSpaceType(){return this._referenceSpaceType}setReferenceSpaceType(e){this._referenceSpaceType=e,this.isPresenting===!0&&Xe("XRManager: Cannot change reference space type while presenting.")}getReferenceSpace(){return this._customReferenceSpace||this._referenceSpace}setReferenceSpace(e){this._customReferenceSpace=e}getCamera(){return this._cameraXR}getEnvironmentBlendMode(){if(this._session!==null)return this._session.environmentBlendMode}getBaseLayer(){return this._glProjLayer!==null?this._glProjLayer:this._glBaseLayer}getBinding(){return this._glBinding===null&&this._supportsGlBinding&&(this._glBinding=new XRWebGLBinding(this._session,this._gl)),this._glBinding}foveateBoundTexture(e){if(e.isPostProcessingRenderTarget!==!0||this.isPresenting!==!0||this._glProjLayer===null)return;let t=this._renderer.backend;if(t===void 0||t.isWebGLBackend!==!0||t.state===null)return;let n=this._renderer.getOutputRenderTarget();if(n===null||n.isXRRenderTarget!==!0)return;let r=this.getBinding();if(r===null||typeof r.foveateBoundTexture!="function")return;this._renderer._textures.updateRenderTarget(e);let{textureGPU:s,glTextureType:o}=t.get(e.texture);if(!(s===void 0||o===void 0)&&e._xrFoveationTextureGPU!==s){e._xrFoveationTextureGPU=s,t.state.bindTexture(o,s);try{r.foveateBoundTexture(o,this.getFoveation())}catch(a){ni(`XRManager: Unable to foveate bound XR post-processing texture. ${a.name}: ${a.message}`)}finally{t.state.unbindTexture()}}}getWebGPUBinding(){return this._webgpuBinding===null&&this._supportsWebGPUBinding&&(this._webgpuBinding=new globalThis.XRGPUBinding(this._session,this._renderer.backend.device)),this._webgpuBinding}_isWebGPUSession(){return this._renderer.backend.isWebGPUBackend===!0&&this._session!==null&&this._session.enabledFeatures.includes("webgpu")}_validateWebGPUSession(){let e=this._renderer;if(e.backend.isWebGPUBackend===!0){if(this._session.enabledFeatures.includes("webgpu")===!1)throw new Error('THREE.XRManager: WebGPU XR sessions require the "webgpu" session feature. Use VRButtonGPU/XRButton with "webgpu" enabled or use a WebGL backend.');e.samples>0&&(ni("THREE.XRManager: WebGPU XR does not support MSAA yet. Disabling MSAA for this XR session."),this._currentSamples===null&&(this._currentSamples=e.samples),e._samples=0)}}async _initWebGPUSession(e){let t=this.getWebGPUBinding(),n=t.createProjectionLayer({colorFormat:t.getPreferredColorFormat(),depthStencilFormat:"depth24plus"});this._glProjLayer=n,e.updateRenderState({layers:[n]}),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._xrRenderTarget=new Ba(n.textureWidth,n.textureHeight,{depth:2,minFilter:Mi,magFilter:Mi,depthBuffer:!0,multiview:!1,useArrayDepthTexture:!0,samples:0}),this._xrRenderTarget.texture.isArrayTexture=!0,this._useMultiviewIfPossible===!0&&ni("THREE.XRManager: WebGPU XR does not support multiview yet. Disabling multiview for this XR session."),this._useMultiview=!1}_disposeWebGPUSession(){let e=this._renderer,t=this._xrRenderTarget;if(t===null||e.backend.isWebGPUBackend!==!0)return;let n=e.backend,r=e._textures,s=n.get?n.get(t):null;s&&(s.descriptors=void 0);let o=a=>{a!=null&&(n.delete&&n.delete(a),r.delete&&r.delete(a))};for(let a=0;a<t.textures.length;a++)o(t.textures[a]);o(t.depthTexture),o(t),e._renderContexts&&e._renderContexts.dispose&&e._renderContexts.dispose(),t.dispose()}_getWebGPUViewData(e){let t=this.getWebGPUBinding(),n={colorTexture:null,viewDescriptors:[],viewports:[]};for(let r=0;r<e.length;r++){let s=t.getViewSubImage(this._glProjLayer,e[r]);n.colorTexture===null&&(n.colorTexture=s.colorTexture),n.viewports.push(s.viewport),s.getViewDescriptor&&n.viewDescriptors.push(s.getViewDescriptor())}return n}getFrame(){return this._xrFrame}useMultiview(){return this._useMultiview}createQuadLayer(e,t,n,r,s,o,a,l={}){let c=new ZA(e,t),u=new Wg(s,o,{format:Ur,type:Ji,depthTexture:new Cs(s,o,l.stencil?ua:xi,void 0,void 0,void 0,void 0,void 0,void 0,l.stencil?xo:Gs),stencilBuffer:l.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});u._autoAllocateDepthBuffer=!0;let f=new ds({color:16777215,side:zo});f.map=u.texture,f.map.offset.y=1,f.map.repeat.y=-1;let d=new Hn(c,f);d.position.copy(n),d.quaternion.copy(r);let A={type:"quad",width:e,height:t,translation:n,quaternion:r,pixelwidth:s,pixelheight:o,plane:d,material:f,rendercall:a,renderTarget:u};if(this._layers.push(A),this._session!==null){A.plane.material=new ds({color:16777215,side:zo}),A.plane.material.blending=Bd,A.plane.material.blendEquation=oo,A.plane.material.blendSrc=Uu,A.plane.material.blendDst=Uu,A.xrlayer=this._createXRLayer(A);let y=this._session.renderState.layers;y.unshift(A.xrlayer),this._session.updateRenderState({layers:y})}else u.isXRRenderTarget=!1;return d}createCylinderLayer(e,t,n,r,s,o,a,l,c={}){let u=new XA(e,e,e*t/n,64,64,!0,Math.PI-t/2,t),f=new Wg(o,a,{format:Ur,type:Ji,depthTexture:new Cs(o,a,c.stencil?ua:xi,void 0,void 0,void 0,void 0,void 0,void 0,c.stencil?xo:Gs),stencilBuffer:c.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});f._autoAllocateDepthBuffer=!0;let d=new ds({color:16777215,side:mi});d.map=f.texture,d.map.offset.y=1,d.map.repeat.y=-1;let A=new Hn(u,d);A.position.copy(r),A.quaternion.copy(s);let y={type:"cylinder",radius:e,centralAngle:t,aspectratio:n,translation:r,quaternion:s,pixelwidth:o,pixelheight:a,plane:A,material:d,rendercall:l,renderTarget:f};if(this._layers.push(y),this._session!==null){y.plane.material=new ds({color:16777215,side:mi}),y.plane.material.blending=Bd,y.plane.material.blendEquation=oo,y.plane.material.blendSrc=Uu,y.plane.material.blendDst=Uu,y.xrlayer=this._createXRLayer(y);let w=this._session.renderState.layers;w.unshift(y.xrlayer),this._session.updateRenderState({layers:w})}else f.isXRRenderTarget=!1;return A}renderLayers(){let e=new re,t=new qs,n=this._renderer,r=this.isPresenting;this.isPresenting=!1;let s=new Oe;n.getSize(s);let o=n.getRenderTarget();for(let a of this._layers){a.renderTarget.isXRRenderTarget=this._session!==null,a.renderTarget._hasExternalTextures=a.renderTarget.isXRRenderTarget;let l=n.contextNode,c;if(a.renderTarget.isXRRenderTarget&&this._sessionUsesLayers){a.xrlayer.transform=new XRRigidTransform(a.plane.getWorldPosition(e),a.plane.getWorldQuaternion(t));let u=this._glBinding.getSubImage(a.xrlayer,this._xrFrame);n.backend.setXRRenderTargetTextures(a.renderTarget,u.colorTexture,void 0),n._setXRLayerSize(a.renderTarget.width,a.renderTarget.height),c=Ote.get(l),c===void 0&&(c=l.context({getOutput:f=>jz(f,n.toneMapping,n.outputColorSpace)}),Ote.set(l,c))}else c=l;n.contextNode=c,n.setRenderTarget(a.renderTarget),a.rendercall(),n.contextNode=l}n.setRenderTarget(o),n._setXRLayerSize(s.x,s.y),this.isPresenting=r}getSession(){return this._session}async setSession(e){let t=this._renderer;t.initialized===!1&&await t.init(),this._gl=t.getContext();let n=this._gl;if(this._session=e,e!==null){if(e.addEventListener("select",this._onSessionEvent),e.addEventListener("selectstart",this._onSessionEvent),e.addEventListener("selectend",this._onSessionEvent),e.addEventListener("squeeze",this._onSessionEvent),e.addEventListener("squeezestart",this._onSessionEvent),e.addEventListener("squeezeend",this._onSessionEvent),e.addEventListener("end",this._onSessionEnd),e.addEventListener("inputsourceschange",this._onInputSourcesChange),this._validateWebGPUSession(),this._currentPixelRatio=t.getPixelRatio(),t.getSize(this._currentSize),this._currentAnimationContext=t._animation.getContext(),this._currentAnimationLoop=t._animation.getAnimationLoop(),t._animation.stop(),this._isWebGPUSession())await this._initWebGPUSession(e);else if(this._supportsLayers===!0){let r=null,s=null,o=null,a=n.getContextAttributes();await t.backend.makeXRCompatible(),this.setFoveation(this.getFoveation()),t.depth&&(o=t.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,r=t.stencil?xo:Gs,s=t.stencil?ua:xi);let l={colorFormat:n.RGBA8,depthFormat:o,scaleFactor:this._framebufferScaleFactor,clearOnAccess:!1};this._useMultiviewIfPossible&&t.hasFeature("OVR_multiview2")&&(l.textureType="texture-array",this._useMultiview=!0),this._glBinding=this.getBinding();let c=this._glBinding.createProjectionLayer(l),u=[c];this._glProjLayer=c,t.setPixelRatio(1),t._setXRLayerSize(c.textureWidth,c.textureHeight);let f=this._useMultiview?2:1,d=new Cs(c.textureWidth,c.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,r,f);if(this._xrRenderTarget=new Wg(c.textureWidth,c.textureHeight,{format:Ur,type:Ji,colorSpace:t.outputColorSpace,depthTexture:d,stencilBuffer:t.stencil,samples:a.antialias?4:0,resolveDepthBuffer:c.ignoreDepthValues===!1,resolveStencilBuffer:c.ignoreDepthValues===!1,depth:this._useMultiview?2:1,multiview:this._useMultiview}),this._xrRenderTarget._hasExternalTextures=!0,this._xrRenderTarget.depth=this._useMultiview?2:1,this._sessionUsesLayers=e.enabledFeatures.includes("layers"),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._sessionUsesLayers)for(let A of this._layers)A.plane.material=new ds({color:16777215,side:A.type==="cylinder"?mi:zo}),A.plane.material.blending=Bd,A.plane.material.blendEquation=oo,A.plane.material.blendSrc=Uu,A.plane.material.blendDst=Uu,A.xrlayer=this._createXRLayer(A),u.unshift(A.xrlayer);e.updateRenderState({layers:u})}else{await t.backend.makeXRCompatible(),this.setFoveation(this.getFoveation());let r={antialias:t.currentSamples>0,alpha:!0,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:this.getFramebufferScaleFactor()},s=new XRWebGLLayer(e,n,r);this._glBaseLayer=s,e.updateRenderState({baseLayer:s}),t.setPixelRatio(1),t._setXRLayerSize(s.framebufferWidth,s.framebufferHeight),this._xrRenderTarget=new Wg(s.framebufferWidth,s.framebufferHeight,{format:Ur,type:Ji,colorSpace:t.outputColorSpace,stencilBuffer:t.stencil,resolveDepthBuffer:s.ignoreDepthValues===!1,resolveStencilBuffer:s.ignoreDepthValues===!1}),this._xrRenderTarget._isOpaqueFramebuffer=!0,this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType())}t._animation.setAnimationLoop(this._onAnimationFrame),t._animation.setContext(e),t._animation.start(),this.isPresenting=!0,this.dispatchEvent({type:"sessionstart"})}}updateCamera(e){let t=this._session;if(t===null)return;let n=e.near,r=e.far,s=this._cameraXR,o=this._cameraL,a=this._cameraR;s.near=a.near=o.near=n,s.far=a.far=o.far=r,s.isMultiViewCamera=this._useMultiview,(this._currentDepthNear!==s.near||this._currentDepthFar!==s.far)&&(t.updateRenderState({depthNear:s.near,depthFar:s.far}),this._currentDepthNear=s.near,this._currentDepthFar=s.far),s.layers.mask=e.layers.mask|6,o.layers.mask=s.layers.mask&-5,a.layers.mask=s.layers.mask&-3;let l=e.parent,c=s.cameras;Ute(s,l);for(let u=0;u<c.length;u++)Ute(c[u],l);c.length===2?gPe(s,o,a):s.projectionMatrix.copy(o.projectionMatrix),vPe(e,s,l)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new s0,this._controllers[e]=t),t}};function gPe(i,e,t){Fte.setFromMatrixPosition(e.matrixWorld),Bte.setFromMatrixPosition(t.matrixWorld);let n=Fte.distanceTo(Bte),r=e.projectionMatrix.elements,s=t.projectionMatrix.elements,o=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],u=(r[8]-1)/r[0],f=(s[8]+1)/s[0],d=o*u,A=o*f,y=n/(-u+f),w=y*-u;if(e.matrixWorld.decompose(i.position,i.quaternion,i.scale),i.translateX(w),i.translateZ(y),i.matrixWorld.compose(i.position,i.quaternion,i.scale),i.matrixWorldInverse.copy(i.matrixWorld).invert(),r[10]===-1)i.projectionMatrix.copy(e.projectionMatrix),i.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{let S=o+y,T=a+y,R=d-w,P=A+(n-w),I=l*a/T*S,F=c*a/T*S;i.projectionMatrix.makePerspective(R,P,I,F,S,T),i.projectionMatrixInverse.copy(i.projectionMatrix).invert()}}function Ute(i,e){e===null?i.matrixWorld.copy(i.matrix):i.matrixWorld.multiplyMatrices(e.matrixWorld,i.matrix),i.matrixWorldInverse.copy(i.matrixWorld).invert()}function vPe(i,e,t){t===null?i.matrix.copy(e.matrixWorld):(i.matrix.copy(t.matrixWorld),i.matrix.invert(),i.matrix.multiply(e.matrixWorld)),i.matrix.decompose(i.position,i.quaternion,i.scale),i.updateMatrixWorld(!0),i.projectionMatrix.copy(e.projectionMatrix),i.projectionMatrixInverse.copy(e.projectionMatrixInverse),i.isPerspectiveCamera&&(i.fov=Pd*2*Math.atan(1/i.projectionMatrix.elements[5]),i.zoom=1)}function _Pe(i){let e=this._controllerInputSources.indexOf(i.inputSource);if(e===-1)return;let t=this._controllers[e];if(t!==void 0){let n=this.getReferenceSpace();t.update(i.inputSource,i.frame,n),t.dispatchEvent({type:i.type,data:i.inputSource})}}function xPe(){let i=this._session,e=this._renderer;i.removeEventListener("select",this._onSessionEvent),i.removeEventListener("selectstart",this._onSessionEvent),i.removeEventListener("selectend",this._onSessionEvent),i.removeEventListener("squeeze",this._onSessionEvent),i.removeEventListener("squeezestart",this._onSessionEvent),i.removeEventListener("squeezeend",this._onSessionEvent),i.removeEventListener("end",this._onSessionEnd),i.removeEventListener("inputsourceschange",this._onInputSourcesChange);for(let t=0;t<this._controllers.length;t++){let n=this._controllerInputSources[t];n!==null&&(this._controllerInputSources[t]=null,this._controllers[t].disconnect(n))}if(this._currentDepthNear=null,this._currentDepthFar=null,this._currentSamples!==null&&(e._samples=this._currentSamples,this._currentSamples=null),e._resetXRState(),this._disposeWebGPUSession(),this._session=null,this._xrRenderTarget=null,this._glBinding=null,this._webgpuBinding=null,this._glBaseLayer=null,this._glProjLayer=null,this._sessionUsesLayers===!0)for(let t of this._layers)t.renderTarget=new Wg(t.pixelwidth,t.pixelheight,{format:Ur,type:Ji,depthTexture:new Cs(t.pixelwidth,t.pixelheight,t.stencilBuffer?ua:xi,void 0,void 0,void 0,void 0,void 0,void 0,t.stencilBuffer?xo:Gs),stencilBuffer:t.stencilBuffer,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),t.renderTarget.isXRRenderTarget=!1,t.plane.material=t.material,t.material.map=t.renderTarget.texture,t.material.map.offset.y=1,t.material.map.repeat.y=-1,delete t.xrlayer;this.isPresenting=!1,this._useMultiview=!1,e._animation.stop(),e._animation.setAnimationLoop(this._currentAnimationLoop),e._animation.setContext(this._currentAnimationContext),e._animation.start(),e.setPixelRatio(this._currentPixelRatio),e.setSize(this._currentSize.width,this._currentSize.height,!1),this.dispatchEvent({type:"sessionend"})}function yPe(i){let e=this._controllers,t=this._controllerInputSources;for(let n=0;n<i.removed.length;n++){let r=i.removed[n],s=t.indexOf(r);s>=0&&(t[s]=null,e[s].disconnect(r))}for(let n=0;n<i.added.length;n++){let r=i.added[n],s=t.indexOf(r);if(s===-1){for(let a=0;a<e.length;a++)if(a>=t.length){t.push(r),s=a;break}else if(t[a]===null){t[a]=r,s=a;break}if(s===-1)break}let o=e[s];o&&o.connect(r)}}function bPe(i){return i.type==="quad"?this._glBinding.createQuadLayer({transform:new XRRigidTransform(i.translation,i.quaternion),width:i.width/2,height:i.height/2,space:this._referenceSpace,viewPixelWidth:i.pixelwidth,viewPixelHeight:i.pixelheight,clearOnAccess:!1}):this._glBinding.createCylinderLayer({transform:new XRRigidTransform(i.translation,i.quaternion),radius:i.radius,centralAngle:i.centralAngle,aspectRatio:i.aspectRatio,space:this._referenceSpace,viewPixelWidth:i.pixelwidth,viewPixelHeight:i.pixelheight,clearOnAccess:!1})}function wPe(i,e){if(e===void 0)return;let t=this._cameraXR,n=this._renderer,r=n.backend,s=this._glBaseLayer,o=this.getReferenceSpace(),a=e.getViewerPose(o);if(this._xrFrame=e,a!==null){let l=a.views,c=this._isWebGPUSession()?this._getWebGPUViewData(l):null;this._glBaseLayer!==null&&c===null&&r.setXRTarget(s.framebuffer);let u=!1;l.length!==t.cameras.length&&(t.cameras.length=0,u=!0);for(let d=0;d<l.length;d++){let A=l[d],y;if(c!==null)y=c.viewports[d];else if(this._supportsLayers===!0){let S=this._glBinding.getViewSubImage(this._glProjLayer,A);y=S.viewport,d===0&&r.setXRRenderTargetTextures(this._xrRenderTarget,S.colorTexture,this._glProjLayer.ignoreDepthValues&&!this._useMultiview?void 0:S.depthStencilTexture)}else y=s.getViewport(A);let w=this._cameras[d];w===void 0&&(w=new Yr,w.layers.enable(d),w.viewport=new xn,w.matrixWorldAutoUpdate=!1,this._cameras[d]=w),w.matrix.fromArray(A.transform.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale),w.projectionMatrix.fromArray(A.projectionMatrix),w.projectionMatrixInverse.copy(w.projectionMatrix).invert(),w.viewport.set(y.x,y.y,y.width,y.height),d===0&&(t.matrix.copy(w.matrix),t.matrix.decompose(t.position,t.quaternion,t.scale)),u===!0&&t.cameras.push(w)}c!==null&&c.colorTexture!==null&&r.setXRRenderTargetTextures(this._xrRenderTarget,c.colorTexture,c.viewDescriptors),n.setOutputRenderTarget(this._xrRenderTarget);let f=n._getFrameBufferTarget();n.xr.foveateBoundTexture(f)}for(let l=0;l<this._controllers.length;l++){let c=this._controllerInputSources[l],u=this._controllers[l];c!==null&&u!==void 0&&u.update(c,e,o)}this._currentAnimationLoop&&this._currentAnimationLoop(i,e),e.detectedPlanes&&this.dispatchEvent({type:"planesdetected",data:e}),this._xrFrame=null}var A9=class extends ca{constructor(e){super(),this.domElement=e,this._pixelRatio=1,this._width=this.domElement.width,this._height=this.domElement.height,this._viewport=new xn(0,0,this._width,this._height),this._scissor=new xn(0,0,this._width,this._height),this._scissorTest=!1,this.colorTexture=new jA,this.depthTexture=new Cs}getPixelRatio(){return this._pixelRatio}getDrawingBufferSize(e){return e.set(this._width*this._pixelRatio,this._height*this._pixelRatio).floor()}getSize(e){return e.set(this._width,this._height)}setPixelRatio(e=1){this._pixelRatio!==e&&(this._pixelRatio=e,this.setSize(this._width,this._height,!1))}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this._pixelRatio=n,this.domElement.width=Math.floor(e*n),this.domElement.height=Math.floor(t*n),this.setViewport(0,0,e,t),this._dispatchResize())}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this.domElement.width=Math.floor(e*this._pixelRatio),this.domElement.height=Math.floor(t*this._pixelRatio),n===!0&&(this.domElement.style.width=e+"px",this.domElement.style.height=t+"px"),this.setViewport(0,0,e,t),this._dispatchResize())}getScissor(e){let t=this._scissor;return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e}setScissor(e,t,n,r){let s=this._scissor;e.isVector4?s.copy(e):s.set(e,t,n,r)}getScissorTest(){return this._scissorTest}setScissorTest(e){this._scissorTest=e}getViewport(e){return e.copy(this._viewport)}setViewport(e,t,n,r,s=0,o=1){let a=this._viewport;e.isVector4?a.copy(e):a.set(e,t,n,r),a.minDepth=s,a.maxDepth=o}_dispatchResize(){this.dispatchEvent({type:"resize"})}dispose(){this.dispatchEvent({type:"dispose"})}},kte=new o0,X_=new Oe,cU=new xn,zR=new Hc,VR=new O2,$_=new cn,jd=new xn,SPe={[zo]:mi,[mi]:zo,[vr]:vr},g9=class{constructor(e,t={}){this.isRenderer=!0;let{logarithmicDepthBuffer:n=!1,reversedDepthBuffer:r=!1,alpha:s=!0,depth:o=!0,stencil:a=!1,antialias:l=!1,samples:c=0,getFallback:u=null,outputBufferType:f=Wi,multiview:d=!1}=t;this.backend=e,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.alpha=s,this.logarithmicDepthBuffer=n,this.reversedDepthBuffer=r,this.outputColorSpace=Br,this.toneMapping=ao,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=o,this.stencil=a,this.info=new Y7,this.contextNode=ip(),this.library=new J4,this.lighting=new p9,this._samples=c||l===!0?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new A9(e.getDomElement()),this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new v4,this._inspector.setRenderer(this),this._getFallback=u,this._attributes=null,this._geometries=null,this._nodes=null,this._animation=null,this._bindings=null,this._objects=null,this._pipelines=null,this._bundles=null,this._renderLists=null,this._renderContexts=null,this._textures=null,this._background=null,this._quadCache=new Map,this._currentRenderContext=null,this._opaqueSort=null,this._transparentSort=null,this._frameBufferTargets=new Map;let A=this.alpha===!0?0:1;this._clearColor=new wS(0,0,0,A),this._clearDepth=1,this._clearStencil=0,this._renderTarget=null,this._activeCubeFace=0,this._activeMipmapLevel=0,this._outputRenderTarget=null,this._mrt=null,this._renderObjectFunction=null,this._currentRenderObjectFunction=null,this._currentRenderBundle=null,this._handleObjectFunction=this._renderObjectDirect,this._isDeviceLost=!1,this.onDeviceLost=this._onDeviceLost,this.onError=this._onError,this._outputBufferType=f,this._cacheShadowNodes=new WeakMap,this._initialized=!1,this._callDepth=-1,this._initPromise=null,this._compilationPromises=null,this._currentSourceMaterial=null,this.transparent=!0,this.opaque=!0,this.shadowMap={enabled:!1,transmitted:!1,type:p0},this.xr=new m9(this,d),this.debug={checkShaderErrors:!0,onShaderError:null,getShaderAsync:async(y,w,S)=>{await this.compileAsync(S,w,y);let R=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,P=this._renderLists.get(y,w),I=this._renderContexts.get(R,this._mrt),F=y.overrideMaterial||S.material,D=this._objects.get(S,F,y,w,P.lightsNode,I,I.clippingContext),{fragmentShader:L,vertexShader:C}=D.getNodeBuilderState();return{fragmentShader:L,vertexShader:C}}}}async init(){return this._initPromise!==null?this._initPromise:(this._initPromise=new Promise(async(e,t)=>{let n=this.backend;try{await n.init(this)}catch(r){if(this._getFallback!==null)try{this.backend=n=this._getFallback(r),await n.init(this)}catch(s){t(s);return}else{t(r);return}}this._nodes=new h9(this,n),this._animation=new H7(this,this._nodes,this.info),this._attributes=new X7(n,this.info),this._background=new Nk(this,this._nodes),this._geometries=new $7(this._attributes,this.info),this._textures=new rk(this,n,this.info),this._pipelines=new Q7(n,this._nodes,this.info),this._bindings=new J7(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new j7(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new tk(this.lighting),this._bundles=new d9,this._renderContexts=new ik(this),this._animation.start(),this._initialized=!0,this._inspector.init(),e(this)}),this._initPromise)}get domElement(){return this._canvasTarget.domElement}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,n=null){if(this._isDeviceLost===!0)return;this._initialized===!1&&await this.init();let r=this._nodes.nodeFrame,s=r.renderId,o=this._currentRenderContext,a=this._currentRenderObjectFunction,l=this._handleObjectFunction,c=this._compilationPromises;n===null&&(n=e);let u=e.isScene===!0?e:n.isScene===!0?n:kte,d=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,A=this._renderContexts.get(d,this._mrt),y=this._activeMipmapLevel,w=[];this._currentRenderContext=A,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=w,r.renderId++,r.update(),A.depth=this.depth,A.stencil=this.stencil,A.clippingContext||(A.clippingContext=new Q4),A.clippingContext.updateGlobal(u,t),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t),u.onBeforeRender(this,e,t,d);let S=t.isArrayCamera?VR:zR;t.isArrayCamera?S.setFromArrayCamera(t):($_.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),S.setFromProjectionMatrix($_,t.coordinateSystem,t.reversedDepth));let T=this._renderLists.get(u,t);if(T.begin(),this._projectObject(e,t,0,T,A.clippingContext),n!==e&&n.traverseVisible(function(D){D.isLight&&D.layers.test(t.layers)&&T.pushLight(D)}),T.finish(),d!==null){this._textures.updateRenderTarget(d,y);let D=this._textures.get(d);A.textures=D.textures,A.depthTexture=D.depthTexture}else A.textures=null,A.depthTexture=null;n!==e?this._background.update(n,T,A):this._background.update(u,T,A);let R=T.opaque,P=T.transparent,I=T.transparentDoublePass,F=T.lightsNode;this.opaque===!0&&R.length>0&&this._renderObjects(R,t,u,F),this.transparent===!0&&P.length>0&&this._renderTransparents(P,I,t,u,F),r.renderId=s,this._currentRenderContext=o,this._currentRenderObjectFunction=a,this._handleObjectFunction=l,this._compilationPromises=c;for(let D of w){let L=this._objects.get(D.object,D.material,D.scene,D.camera,D.lightsNode,D.renderContext,D.clippingContext,D.passId);L.drawRange=D.object.geometry.drawRange,L.group=D.group,await this._nodes.getForRenderAsync(L),this._nodes.updateBefore(L),this._geometries.updateForRender(L),this._nodes.updateForRender(L),this._bindings.updateForRender(L);let C=[];this._pipelines.getForRender(L,C),C.length>0&&await Promise.all(C),this._nodes.updateAfter(L),await pF()}}async renderAsync(e,t){ni('Renderer: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.render(e,t)}async waitForGPU(){ze("Renderer: waitForGPU() has been removed. Read https://github.com/mrdoob/three.js/issues/32012 for more information.")}set inspector(e){this._inspector!==null&&this._inspector.setRenderer(null),this._inspector=e,this._inspector.setRenderer(this)}get inspector(){return this._inspector}set highPrecision(e){let t=this.contextNode.value;e===!0?(t.modelViewMatrix=ZU,t.modelNormalViewMatrix=KU):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){let e=this.contextNode.value;return e.modelViewMatrix===ZU&&e.modelNormalViewMatrix===KU}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return ni('Renderer: ".getColorBufferType()" has been renamed to ".getOutputBufferType()".'),this.getOutputBufferType()}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost:4165+`;return n}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){Xe("Abstract function.")}get subBuild(){return this.subBuildLayers[this.subBuildLayers.length-1]||null}addSubBuild(e){this.subBuildLayers.push(e)}removeSubBuild(){return this.subBuildLayers.pop()}getClosestSubBuild(e){let t;if(e&&e.isNode?e.isShaderCallNodeInternal?t=e.shaderNode.subBuilds:e.isStackNode?t=[e.subBuild]:t=this.getDataFromNode(e,"any").subBuilds:e instanceof Set?t=[...e]:t=e,!t)return null;let n=this.subBuildLayers;for(let r=t.length-1;r>=0;r--){let s=t[r];if(n.includes(s))return s}return null}getSubBuildOutput(e){return this.getSubBuildProperty("outputNode",e)}getSubBuildProperty(e="",t=null){let n;t!==null?n=this.getClosestSubBuild(t):n=this.subBuildFn;let r;return n?r=e?n+"_"+e:n:r=e,r}prebuild(){let{object:e,renderer:t,material:n}=this;if(t.contextNode.isContextNode===!0?this.context={...this.context,...t.contextNode.getFlowContextData()}:ze('NodeBuilder: "renderer.contextNode" must be an instance of `context()`.'),n&&n.contextNode&&(n.contextNode.isContextNode===!0?this.context={...this.context,...n.contextNode.getFlowContextData()}:ze('NodeBuilder: "material.contextNode" must be an instance of `context()`.')),n!==null){let r=t.library.fromMaterial(n);r===null&&(ze(`NodeBuilder: Material "${n.type}" is not compatible.`),r=new Pr),r.build(this)}else this.addFlow("compute",e)}build(){this.prebuild();for(let e of $R){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of YR){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}async buildAsync(){this.prebuild();for(let e of $R){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of YR){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this);await pF()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=aIe.get(e);return t===void 0&&(t={}),t}getNodeUniform(e,t){let n=this.getSharedDataFromNode(e),r=n.cache;if(r===void 0){if(t==="float"||t==="int"||t==="uint")r=new $k(e);else if(t==="vec2"||t==="ivec2"||t==="uvec2")r=new Yk(e);else if(t==="vec3"||t==="ivec3"||t==="uvec3")r=new Zk(e);else if(t==="vec4"||t==="ivec4"||t==="uvec4")r=new Kk(e);else if(t==="color")r=new Qk(e);else if(t==="mat2")r=new Jk(e);else if(t==="mat3")r=new e9(e);else if(t==="mat4")r=new t9(e);else throw new Error(`THREE.NodeBuilder: Uniform "${t}" not implemented.`);n.cache=r}return r}format(e,t,n){if(t=this.getVectorType(t),n=this.getVectorType(n),t===n||n===null||this.isReference(n))return e;let r=this.getTypeLength(t),s=this.getTypeLength(n);return r===16&&s===9?`${this.getType(n)}( ${e}[ 0 ].xyz, ${e}[ 1 ].xyz, ${e}[ 2 ].xyz )`:r===9&&s===4?`${this.getType(n)}( ${e}[ 0 ].xy, ${e}[ 1 ].xy )`:r>4||s>4||s===0?e:r===s?`${this.getType(n)}( ${e} )`:r>s?(e=n==="bool"?`all( ${e} )`:`${e}.${"xyz".slice(0,s)}`,this.format(e,this.getTypeFromLength(s,this.getComponentType(t)),n)):s===4&&r>1?`${this.getType(n)}( ${this.format(e,t,"vec3")}, 1.0 )`:r===2?`${this.getType(n)}( ${this.format(e,t,"vec2")}, 0.0 )`:(r===1&&s>1&&t!==this.getComponentType(n)&&(e=`${this.getType(this.getComponentType(n))}( ${e} )`),`${this.getType(n)}( ${e} )`)}getSignature(){return`// Three.js r${"185"} - Node System4166+`}needsPreviousData(){let e=this.renderer.getMRT();return e&&e.has("velocity")||rne(this.object).useVelocity===!0}},W4=class{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let n=e.get(t);return n===void 0&&(n={renderId:0,frameId:0},e.set(t,n)),n}updateBeforeNode(e){let t=e.getUpdateBeforeType(),n=e.updateReference(this);if(t===yn.FRAME){let r=this._getMaps(this.updateBeforeMap,n);if(r.frameId!==this.frameId){let s=r.frameId;r.frameId=this.frameId,e.updateBefore(this)===!1&&(r.frameId=s)}}else if(t===yn.RENDER){let r=this._getMaps(this.updateBeforeMap,n);if(r.renderId!==this.renderId){let s=r.renderId;r.renderId=this.renderId,e.updateBefore(this)===!1&&(r.renderId=s)}}else t===yn.OBJECT&&e.updateBefore(this)}updateAfterNode(e){let t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===yn.FRAME){let r=this._getMaps(this.updateAfterMap,n);r.frameId!==this.frameId&&e.updateAfter(this)!==!1&&(r.frameId=this.frameId)}else if(t===yn.RENDER){let r=this._getMaps(this.updateAfterMap,n);r.renderId!==this.renderId&&e.updateAfter(this)!==!1&&(r.renderId=this.renderId)}else t===yn.OBJECT&&e.updateAfter(this)}updateNode(e){let t=e.getUpdateType(),n=e.updateReference(this);if(t===yn.FRAME){let r=this._getMaps(this.updateMap,n);r.frameId!==this.frameId&&e.update(this)!==!1&&(r.frameId=this.frameId)}else if(t===yn.RENDER){let r=this._getMaps(this.updateMap,n);r.renderId!==this.renderId&&e.update(this)!==!1&&(r.renderId=this.renderId)}else t===yn.OBJECT&&e.update(this)}update(){this.frameId++,this.lastTime===void 0&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}},ES=class{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}};ES.isNodeFunctionInput=!0;var n9=class extends Qd{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}},i9=class extends Qd{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){let e=this.colorNode;return{lightDirection:RV(this.light),lightColor:e}}},r9=class extends Qd{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=MV(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=Xt(new zt).setGroup(Jt)}update(e){let{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){let{colorNode:t,groundColorNode:n,lightDirectionNode:r}=this,o=Sm.dot(r).mul(.5).add(.5),a=Qn(n,t,o);e.context.irradiance.addAssign(a)}},MS=class extends Qd{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=Xt(0).setGroup(Jt),this.penumbraCosNode=Xt(0).setGroup(Jt),this.cutoffDistanceNode=Xt(0).setGroup(Jt),this.decayExponentNode=Xt(0).setGroup(Jt),this.colorNode=Xt(this.color).setGroup(Jt)}update(e){super.update(e);let{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e,t){let{coneCosNode:n,penumbraCosNode:r}=this;return mc(n,r,t)}getLightCoord(e){let t=e.getNodeProperties(this),n=t.projectionUV;return n===void 0&&(n=Gse(this.light,e.context.positionWorld),t.projectionUV=n),n}setupDirect(e){let{colorNode:t,cutoffDistanceNode:n,decayExponentNode:r,light:s}=this,o=this.getLightVector(e),a=o.normalize(),l=a.dot(RV(s)),c=this.getSpotAttenuation(e,l),u=o.length(),f=IV({lightDistance:u,cutoffDistance:n,decayExponent:r}),d=t.mul(c).mul(f),A,y;return s.colorNode?(y=this.getLightCoord(e),A=s.colorNode(y)):s.map&&(y=this.getLightCoord(e),A=fi(s.map,y.xy).onRenderUpdate(()=>s.map)),A&&(d=y.mul(2).sub(1).abs().lessThan(1).all().select(d.mul(A),d)),{lightColor:d,lightDirection:a}}},s9=class extends MS{static get type(){return"IESSpotLightNode"}constructor(e=null){super(e),this._iesTextureNode=null}getSpotAttenuation(e,t){let n=this.light.iesMap,r=null;if(n&&n.isTexture===!0){let s=t.acos().mul(1/Math.PI);this._iesTextureNode=fi(n,dt(s,0),0),r=this._iesTextureNode.r}else r=super.getSpotAttenuation(e,t);return r}update(e){super.update(e),this._iesTextureNode!==null&&this.light.iesMap&&(this._iesTextureNode.value=this.light.iesMap)}},o9=class extends Qd{static get type(){return"LightProbeNode"}constructor(e=null){super(e);let t=[];for(let n=0;n<9;n++)t.push(new re);this.lightProbe=$o(t)}update(e){let{light:t}=this;super.update(e);for(let n=0;n<9;n++)this.lightProbe.array[n].copy(t.sh.coefficients[n]).multiplyScalar(t.intensity)}setup(e){let t=uoe(Sm,this.lightProbe);e.context.irradiance.addAssign(t)}},cIe=me(([i,e])=>{let t=i.abs().sub(e);return vf(zr(t,0)).add(Pl(zr(t.x,t.y),0))}),a9=class extends MS{static get type(){return"ProjectorLightNode"}update(e){super.update(e);let t=this.light;if(this.penumbraCosNode.value=Math.min(Math.cos(t.angle*(1-t.penumbra)),.99999),t.aspect===null){let n=1;t.map!==null&&(n=t.map.width/t.map.height),t.shadow.aspect=n}else t.shadow.aspect=t.aspect}getSpotAttenuation(e){let t=oe(0),n=this.penumbraCosNode,r=kP(this.light).mul(e.context.positionWorld||_f);return $t(r.w.greaterThan(0),()=>{let s=r.xyz.div(r.w),o=cIe(s.xy.sub(dt(.5)),dt(.5)),a=pc(-1,ai(1,Tz(n)).sub(1));t.assign(SP(o.mul(-2).mul(a)))}),t}},aU=new cn,NR=new cn,jw=null,l9=class extends Qd{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=Xt(new re).setGroup(Jt),this.halfWidth=Xt(new re).setGroup(Jt),this.updateType=yn.RENDER}update(e){super.update(e);let{light:t}=this,n=e.camera.matrixWorldInverse;NR.identity(),aU.copy(t.matrixWorld),aU.premultiply(n),NR.extractRotation(aU),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(NR),this.halfHeight.value.applyMatrix4(NR)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=fi(jw.LTC_FLOAT_1),n=fi(jw.LTC_FLOAT_2)):(t=fi(jw.LTC_HALF_1),n=fi(jw.LTC_HALF_2));let{colorNode:r,light:s}=this,o=CV(s);return{lightColor:r,lightPosition:o,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){jw=e}},j4=class{parseFunction(){Xe("Abstract function.")}},CS=class{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){Xe("Abstract function.")}};CS.isNodeFunction=!0;var uIe=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,hIe=/[a-z_0-9]+/ig,Cte="#pragma main",fIe=i=>{i=i.trim();let e=i.indexOf(Cte),t=e!==-1?i.slice(e+Cte.length):i,n=t.match(uIe);if(n!==null&&n.length===5){let r=n[4],s=[],o=null;for(;(o=hIe.exec(r))!==null;)s.push(o);let a=[],l=0;for(;l<s.length;){let y=s[l][0]==="const";y===!0&&l++;let w=s[l][0];w==="in"||w==="out"||w==="inout"?l++:w="";let S=s[l++][0],T=Number.parseInt(s[l][0]);Number.isNaN(T)===!1?l++:T=null;let R=s[l++][0];a.push(new ES(S,R,T,w,y))}let c=t.substring(n[0].length),u=n[3]!==void 0?n[3]:"",f=n[2],d=n[1]!==void 0?n[1]:"",A=e!==-1?i.slice(0,e):"";return{type:f,inputs:a,name:u,precision:d,inputsCode:r,blockCode:c,headerCode:A}}else throw new Error("THREE.FunctionNode: Function is not a GLSL code.")},c9=class extends CS{constructor(e){let{type:t,inputs:n,name:r,precision:s,inputsCode:o,blockCode:a,headerCode:l}=fIe(e);super(t,n,r,s),this.inputsCode=o,this.blockCode=a,this.headerCode=l}getCode(e=this.name){let t,n=this.blockCode;if(n!==""){let{type:r,inputsCode:s,headerCode:o,precision:a}=this,l=`${r} ${e} ( ${s.trim()} )`;a!==""&&(l=`${a} ${l}`),t=o+l+n}else t="";return t}},u9=class extends j4{parseFunction(e){return new c9(e)}},Yc=[],Gd=[],Rte=Xt(0,"int").setGroup(Jt),h9=class extends Tf{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new W4,this.nodeBuilderCache=new Map,this.callHashCache=new Sf,this.groupsData=new Sf,this._buildQueue=[],this._buildInProgress=!1,this.cacheLib={}}updateGroup(e){let t=e.groupNode;if(t.updateType===yn.OBJECT)return!0;Yc[0]=t,Yc[1]=e;let n=this.groupsData.get(Yc);return n===void 0&&this.groupsData.set(Yc,n={}),Yc[0]=null,Yc[1]=null,n.version!==t.version?(n.version=t.version,!0):!1}getForRenderCacheKey(e){return e.initialCacheKey}_createNodeBuilder(e,t){let n=this.backend.createNodeBuilder(e.object,this.renderer);return n.scene=e.scene,n.material=t,n.camera=e.camera,n.context.material=t,n.lightsNode=e.lightsNode,n.environmentNode=this.getEnvironmentNode(e.scene),n.fogNode=this.getFogNode(e.scene),n.clippingContext=e.clippingContext,this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview&&n.enableMultiview(),n}getForRender(e,t=!1){let n=this.get(e),r=n.nodeBuilderState;if(r===void 0){let{nodeBuilderCache:s}=this,o=this.getForRenderCacheKey(e);if(r=s.get(o),r===void 0){let a=async()=>{let l=this._createNodeBuilder(e,e.material);try{t?await l.buildAsync():l.build()}catch(c){l=this._createNodeBuilder(e,new Pr),t?await l.buildAsync():l.build(),ze("TSL: "+c)}return l};if(t)return a().then(l=>(r=this._createNodeBuilderState(l),s.set(o,r),r.usedTimes++,n.nodeBuilderState=r,r));{let l=this._createNodeBuilder(e,e.material);try{l.build()}catch(c){l=this._createNodeBuilder(e,new Pr),l.build();let u=c.stackTrace;!u&&c.stack&&(u=new ts(c.stack)),ze("TSL: "+c,u)}r=this._createNodeBuilderState(l),s.set(o,r)}}r.usedTimes++,n.nodeBuilderState=r}return r}getForRenderAsync(e){let t=this.getForRender(e,!0);return t.then?t:Promise.resolve(t)}getForRenderDeferred(e){let t=this.get(e);if(t.nodeBuilderState!==void 0)return t.nodeBuilderState;let n=this.getForRenderCacheKey(e),r=this.nodeBuilderCache.get(n);return r!==void 0?(r.usedTimes++,t.nodeBuilderState=r,r):(t.pendingBuild!==!0&&(t.pendingBuild=!0,this._buildQueue.push(()=>this.getForRenderAsync(e).then(()=>{t.pendingBuild=!1})),this._processBuildQueue()),null)}_processBuildQueue(){if(this._buildInProgress||this._buildQueue.length===0)return;this._buildInProgress=!0,this._buildQueue.shift()().then(()=>{this._buildInProgress=!1,this._processBuildQueue()})}delete(e){if(e.isRenderObject){let t=this.get(e).nodeBuilderState;t!==void 0&&(t.usedTimes--,t.usedTimes===0&&this.nodeBuilderCache.delete(this.getForRenderCacheKey(e)))}return super.delete(e)}getForCompute(e){let t=this.get(e),n=t.nodeBuilderState;if(n===void 0||t.version!==e.version){let r=this.backend.createNodeBuilder(e,this.renderer);r.build(),n=this._createNodeBuilderState(r),t.nodeBuilderState=n,t.version=e.version}return n}_createNodeBuilderState(e){return new Fk(e.vertexShader,e.fragmentShader,e.computeShader,e.getAttributesArray(),e.getBindings(),e.updateNodes,e.updateBeforeNodes,e.updateAfterNodes,e.observer,e.hardwareClipping,e.transforms)}getEnvironmentNode(e){if(this.renderer.lighting.enabled===!1)return null;this.updateEnvironment(e);let t=null;if(e.environmentNode&&e.environmentNode.isNode)t=e.environmentNode;else{let n=this.get(e);n.environmentNode&&(t=n.environmentNode)}return t}getBackgroundNode(e){this.updateBackground(e);let t=null;if(e.backgroundNode&&e.backgroundNode.isNode)t=e.backgroundNode;else{let n=this.get(e);n.backgroundNode&&(t=n.backgroundNode)}return t}getFogNode(e){return this.updateFog(e),e.fogNode||this.get(e).fogNode||null}getCacheKey(e,t){Yc[0]=e,Yc[1]=t;let n=this.renderer.info.calls,r=this.callHashCache.get(Yc)||{};if(r.callId!==n){if(Gd.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),Gd.push(this.renderer.lighting.enabled?1:0),this.renderer.lighting.enabled){Gd.push(t.getCacheKey(!0)),Gd.push(this.renderer.shadowMap.enabled?1:0),Gd.push(this.renderer.shadowMap.type);let o=this.getEnvironmentNode(e);o&&Gd.push(o.getCacheKey())}let s=this.getFogNode(e);s&&Gd.push(s.getCacheKey()),r.callId=n,r.cacheKey=LS(Gd),this.callHashCache.set(Yc,r),Gd.length=0}return Yc[0]=null,Yc[1]=null,r.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}updateBackground(e){let t=this.get(e),n=e.background;if(n){let r=e.backgroundBlurriness===0&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&t.backgroundBlurriness===0;if(t.background!==n||r){let s=this.getCacheNode("background",n,()=>{if(n.isCubeTexture===!0||n.mapping===p0||n.mapping===m0||n.mapping===Bh){if(e.backgroundBlurriness>0||n.mapping===Bh)return yV(n);{let o;return n.isCubeTexture===!0?o=Qa(n):o=fi(n),sse(o)}}else{if(n.isTexture===!0)return fi(n,ju.flipY()).setUpdateMatrix(!0);n.isColor!==!0&&ze("WebGPUNodes: Unsupported background configuration.",n)}},r);t.backgroundNode=s,t.background=n,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,n,r=!1){let s=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap),o=s.get(t);return(o===void 0||r)&&(o=n(),s.set(t,o)),o}updateFog(e){let t=this.get(e),n=e.fog;if(n){if(t.fog!==n){let r=this.getCacheNode("fog",n,()=>{if(n.isFogExp2){let s=mr("color","color",n).setGroup(Jt),o=mr("density","float",n).setGroup(Jt);return Tk(s,Vse(o))}else if(n.isFog){let s=mr("color","color",n).setGroup(Jt),o=mr("near","float",n).setGroup(Jt),a=mr("far","float",n).setGroup(Jt);return Tk(s,zse(o,a))}else ze("Renderer: Unsupported fog configuration.",n)});t.fogNode=r,t.fog=n}}else delete t.fogNode,delete t.fog}updateEnvironment(e){let t=this.get(e),n=e.environment;if(n){if(t.environment!==n){let r=this.getCacheNode("environment",n,()=>{if(n.isCubeTexture===!0)return Qa(n);if(n.isTexture===!0)return fi(n);ze("Nodes: Unsupported environment configuration.",n)});t.environmentNode=r,t.environment=n}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,n=null,r=null,s=null){let o=this.nodeFrame;return o.renderer=e,o.scene=t,o.object=n,o.camera=r,o.material=s,o}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){let e=this.renderer;return e.toneMapping+","+e.currentColorSpace+","+e.xr.isPresenting}getOutputNode(e){let t=this.renderer,n;return e.isArrayTexture?this.backend.isWebGLBackend?n=fi(e,ju).depth(tp("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):n=fi(e,ju).depth(Rte).renderOutput(t.toneMapping,t.currentColorSpace):n=fi(e,ju).renderOutput(t.toneMapping,t.currentColorSpace),n}setOutputLayerIndex(e){Rte.value=e}updateBefore(e){let t=e.getNodeBuilderState();for(let n of t.updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(n)}updateAfter(e){let t=e.getNodeBuilderState();for(let n of t.updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(n)}updateForCompute(e){let t=this.getNodeFrame(),n=this.getForCompute(e);for(let r of n.updateNodes)t.updateNode(r)}updateForRender(e){let t=this.getNodeFrameForRender(e),n=e.getNodeBuilderState();for(let r of n.updateNodes)t.updateNode(r)}needsRefresh(e){let t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new W4,this.nodeBuilderCache=new Map,this.cacheLib={}}},lU=new Na,X4=class i{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewMatrix=new cn,this.viewNormalMatrix=new Mn,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,e!==null&&(this.viewMatrix=e.viewMatrix,this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass)}projectPlanes(e,t,n){let r=e.length;for(let s=0;s<r;s++){lU.copy(e[s]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);let o=t[n+s],a=lU.normal;o.x=-a.x,o.y=-a.y,o.z=-a.z,o.w=lU.constant}}updateGlobal(e,t){this.shadowPass=e.overrideMaterial!==null&&e.overrideMaterial.isShadowPassMaterial,this.viewMatrix.copy(t.matrixWorldInverse),this.viewNormalMatrix.getNormalMatrix(this.viewMatrix)}update(e,t){let n=!1;e.version!==this.parentVersion&&(this.intersectionPlanes=Array.from(e.intersectionPlanes),this.unionPlanes=Array.from(e.unionPlanes),this.parentVersion=e.version),this.clipIntersection!==t.clipIntersection&&(this.clipIntersection=t.clipIntersection,this.clipIntersection?this.unionPlanes.length=e.unionPlanes.length:this.intersectionPlanes.length=e.intersectionPlanes.length);let r=t.clippingPlanes,s=r.length,o,a;if(this.clipIntersection?(o=this.intersectionPlanes,a=e.intersectionPlanes.length):(o=this.unionPlanes,a=e.unionPlanes.length),o.length!==a+s){o.length=a+s;for(let l=0;l<s;l++)o[a+l]=new xn;n=!0}this.projectPlanes(r,o,a),n&&(this.version++,this.cacheKey=`${this.intersectionPlanes.length}:${this.unionPlanes.length}`)}getGroupContext(e){if(this.shadowPass&&!e.clipShadows)return this;let t=this.clippingGroupContexts.get(e);return t===void 0&&(t=new i(this),this.clippingGroupContexts.set(e,t)),t.update(this,e),t}get unionClippingCount(){return this.unionPlanes.length}},f9=class{constructor(e,t,n){this.bundleGroup=e,this.camera=t,this.renderContext=n}},tm=[],d9=class{constructor(){this.bundles=new Sf}get(e,t,n){let r=this.bundles;tm[0]=e,tm[1]=t,tm[2]=n;let s=r.get(tm);return s===void 0&&(s=new f9(e,t,n),r.set(tm,s)),tm[0]=null,tm[1]=null,tm[2]=null,s}dispose(){this.bundles=new Sf}},$4=class{constructor(){this.lightNodes=new WeakMap,this.materialNodes=new Map,this.toneMappingNodes=new Map}fromMaterial(e){if(e.isNodeMaterial)return e;let t=null,n=this.getMaterialNodeClass(e.type);if(n!==null){t=new n;for(let r in e)t[r]=e[r]}return t}addToneMapping(e,t){this.addType(e,t,this.toneMappingNodes)}getToneMappingFunction(e){return this.toneMappingNodes.get(e)||null}getMaterialNodeClass(e){return this.materialNodes.get(e)||null}addMaterial(e,t){this.addType(e,t,this.materialNodes)}getLightNodeClass(e){return this.lightNodes.get(e)||null}addLight(e,t){this.addClass(e,t,this.lightNodes)}addType(e,t,n){if(n.has(t)){Xe(`Redefinition of node ${t}`);return}if(typeof e!="function")throw new Error(`THREE.NodeLibrary: Node class ${e.name} is not a class.`);if(typeof t=="function"||typeof t=="object")throw new Error(`THREE.NodeLibrary: Base class ${t} is not a class.`);n.set(t,e)}addClass(e,t,n){if(n.has(t)){Xe(`Redefinition of node ${t.name}`);return}if(typeof e!="function")throw new Error(`THREE.NodeLibrary: Node class ${e.name} is not a class.`);if(typeof t!="function")throw new Error(`THREE.NodeLibrary: Base class ${t.name} is not a class.`);n.set(t,e)}},dIe=new SS,Pte=new WeakMap,p9=class{constructor(){this.enabled=!0,this._cache=[]}createNode(e=[]){return new SS().setLights(e)}getNode(e){if(e.isScene!==!0&&e.isGroup!==!0)return dIe;let t=Pte.get(e);return t===void 0&&(t=this.createNode(),Pte.set(e,t)),t}beginRender(e){this._cache.push(this.getNode(e).getLights())}finishRender(e){this.getNode(e).setLights(this._cache.pop())}},Hg=class extends Ba{constructor(e=1,t=1,n={}){super(e,t,n),this.isXRRenderTarget=!0,this._hasExternalTextures=!1,this._autoAllocateDepthBuffer=!0,this._isOpaqueFramebuffer=!1}copy(e){return super.copy(e),this._hasExternalTextures=e._hasExternalTextures,this._autoAllocateDepthBuffer=e._autoAllocateDepthBuffer,this._isOpaqueFramebuffer=e._isOpaqueFramebuffer,this}},Ite=new re,Lte=new re,Dte=new WeakMap,m9=class extends ca{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new Yr,this._cameraL.viewport=new xn,this._cameraL.matrixWorldAutoUpdate=!1,this._cameraR=new Yr,this._cameraR.viewport=new xn,this._cameraR.matrixWorldAutoUpdate=!1,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new a_,this._currentDepthNear=null,this._currentDepthFar=null,this._controllers=[],this._controllerInputSources=[],this._xrRenderTarget=null,this._layers=[],this._sessionUsesLayers=!1,this._supportsGlBinding=typeof XRWebGLBinding<"u",this._supportsWebGPUBinding=typeof globalThis.XRGPUBinding<"u",this._createXRLayer=_Ie.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSamples=null,this._currentSize=new Oe,this._onSessionEvent=AIe.bind(this),this._onSessionEnd=gIe.bind(this),this._onInputSourcesChange=vIe.bind(this),this._onAnimationFrame=xIe.bind(this),this._referenceSpace=null,this._referenceSpaceType="local-floor",this._customReferenceSpace=null,this._framebufferScaleFactor=1,this._foveation=1,this._session=null,this._glBaseLayer=null,this._glBinding=null,this._webgpuBinding=null,this._glProjLayer=null,this._xrFrame=null,this._supportsLayers=this._supportsGlBinding&&"createProjectionLayer"in XRWebGLBinding.prototype,this._useMultiviewIfPossible=t,this._useMultiview=!1}getController(e){return this._getController(e).getTargetRaySpace()}getControllerGrip(e){return this._getController(e).getGripSpace()}getHand(e){return this._getController(e).getHandSpace()}getFoveation(){return this._foveation}setFoveation(e){this._foveation=e,this._glProjLayer!==null&&(this._glProjLayer.fixedFoveation=e),this._glBaseLayer!==null&&this._glBaseLayer.fixedFoveation!==void 0&&(this._glBaseLayer.fixedFoveation=e)}getFramebufferScaleFactor(){return this._framebufferScaleFactor}setFramebufferScaleFactor(e){this._framebufferScaleFactor=e,this.isPresenting===!0&&Xe("XRManager: Cannot change framebuffer scale while presenting.")}getReferenceSpaceType(){return this._referenceSpaceType}setReferenceSpaceType(e){this._referenceSpaceType=e,this.isPresenting===!0&&Xe("XRManager: Cannot change reference space type while presenting.")}getReferenceSpace(){return this._customReferenceSpace||this._referenceSpace}setReferenceSpace(e){this._customReferenceSpace=e}getCamera(){return this._cameraXR}getEnvironmentBlendMode(){if(this._session!==null)return this._session.environmentBlendMode}getBaseLayer(){return this._glProjLayer!==null?this._glProjLayer:this._glBaseLayer}getBinding(){return this._glBinding===null&&this._supportsGlBinding&&(this._glBinding=new XRWebGLBinding(this._session,this._gl)),this._glBinding}foveateBoundTexture(e){if(e.isPostProcessingRenderTarget!==!0||this.isPresenting!==!0||this._glProjLayer===null)return;let t=this._renderer.backend;if(t===void 0||t.isWebGLBackend!==!0||t.state===null)return;let n=this._renderer.getOutputRenderTarget();if(n===null||n.isXRRenderTarget!==!0)return;let r=this.getBinding();if(r===null||typeof r.foveateBoundTexture!="function")return;this._renderer._textures.updateRenderTarget(e);let{textureGPU:s,glTextureType:o}=t.get(e.texture);if(!(s===void 0||o===void 0)&&e._xrFoveationTextureGPU!==s){e._xrFoveationTextureGPU=s,t.state.bindTexture(o,s);try{r.foveateBoundTexture(o,this.getFoveation())}catch(a){ni(`XRManager: Unable to foveate bound XR post-processing texture. ${a.name}: ${a.message}`)}finally{t.state.unbindTexture()}}}getWebGPUBinding(){return this._webgpuBinding===null&&this._supportsWebGPUBinding&&(this._webgpuBinding=new globalThis.XRGPUBinding(this._session,this._renderer.backend.device)),this._webgpuBinding}_isWebGPUSession(){return this._renderer.backend.isWebGPUBackend===!0&&this._session!==null&&this._session.enabledFeatures.includes("webgpu")}_validateWebGPUSession(){let e=this._renderer;if(e.backend.isWebGPUBackend===!0){if(this._session.enabledFeatures.includes("webgpu")===!1)throw new Error('THREE.XRManager: WebGPU XR sessions require the "webgpu" session feature. Use VRButtonGPU/XRButton with "webgpu" enabled or use a WebGL backend.');e.samples>0&&(ni("THREE.XRManager: WebGPU XR does not support MSAA yet. Disabling MSAA for this XR session."),this._currentSamples===null&&(this._currentSamples=e.samples),e._samples=0)}}async _initWebGPUSession(e){let t=this.getWebGPUBinding(),n=t.createProjectionLayer({colorFormat:t.getPreferredColorFormat(),depthStencilFormat:"depth24plus"});this._glProjLayer=n,e.updateRenderState({layers:[n]}),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._xrRenderTarget=new Ba(n.textureWidth,n.textureHeight,{depth:2,minFilter:Mi,magFilter:Mi,depthBuffer:!0,multiview:!1,useArrayDepthTexture:!0,samples:0}),this._xrRenderTarget.texture.isArrayTexture=!0,this._useMultiviewIfPossible===!0&&ni("THREE.XRManager: WebGPU XR does not support multiview yet. Disabling multiview for this XR session."),this._useMultiview=!1}_disposeWebGPUSession(){let e=this._renderer,t=this._xrRenderTarget;if(t===null||e.backend.isWebGPUBackend!==!0)return;let n=e.backend,r=e._textures,s=n.get?n.get(t):null;s&&(s.descriptors=void 0);let o=a=>{a!=null&&(n.delete&&n.delete(a),r.delete&&r.delete(a))};for(let a=0;a<t.textures.length;a++)o(t.textures[a]);o(t.depthTexture),o(t),e._renderContexts&&e._renderContexts.dispose&&e._renderContexts.dispose(),t.dispose()}_getWebGPUViewData(e){let t=this.getWebGPUBinding(),n={colorTexture:null,viewDescriptors:[],viewports:[]};for(let r=0;r<e.length;r++){let s=t.getViewSubImage(this._glProjLayer,e[r]);n.colorTexture===null&&(n.colorTexture=s.colorTexture),n.viewports.push(s.viewport),s.getViewDescriptor&&n.viewDescriptors.push(s.getViewDescriptor())}return n}getFrame(){return this._xrFrame}useMultiview(){return this._useMultiview}createQuadLayer(e,t,n,r,s,o,a,l={}){let c=new YA(e,t),u=new Hg(s,o,{format:Or,type:Ji,depthTexture:new Es(s,o,l.stencil?ua:xi,void 0,void 0,void 0,void 0,void 0,void 0,l.stencil?xo:Vs),stencilBuffer:l.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});u._autoAllocateDepthBuffer=!0;let f=new fs({color:16777215,side:zo});f.map=u.texture,f.map.offset.y=1,f.map.repeat.y=-1;let d=new Hn(c,f);d.position.copy(n),d.quaternion.copy(r);let A={type:"quad",width:e,height:t,translation:n,quaternion:r,pixelwidth:s,pixelheight:o,plane:d,material:f,rendercall:a,renderTarget:u};if(this._layers.push(A),this._session!==null){A.plane.material=new fs({color:16777215,side:zo}),A.plane.material.blending=Dd,A.plane.material.blendEquation=oo,A.plane.material.blendSrc=Nu,A.plane.material.blendDst=Nu,A.xrlayer=this._createXRLayer(A);let y=this._session.renderState.layers;y.unshift(A.xrlayer),this._session.updateRenderState({layers:y})}else u.isXRRenderTarget=!1;return d}createCylinderLayer(e,t,n,r,s,o,a,l,c={}){let u=new jA(e,e,e*t/n,64,64,!0,Math.PI-t/2,t),f=new Hg(o,a,{format:Or,type:Ji,depthTexture:new Es(o,a,c.stencil?ua:xi,void 0,void 0,void 0,void 0,void 0,void 0,c.stencil?xo:Vs),stencilBuffer:c.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});f._autoAllocateDepthBuffer=!0;let d=new fs({color:16777215,side:mi});d.map=f.texture,d.map.offset.y=1,d.map.repeat.y=-1;let A=new Hn(u,d);A.position.copy(r),A.quaternion.copy(s);let y={type:"cylinder",radius:e,centralAngle:t,aspectratio:n,translation:r,quaternion:s,pixelwidth:o,pixelheight:a,plane:A,material:d,rendercall:l,renderTarget:f};if(this._layers.push(y),this._session!==null){y.plane.material=new fs({color:16777215,side:mi}),y.plane.material.blending=Dd,y.plane.material.blendEquation=oo,y.plane.material.blendSrc=Nu,y.plane.material.blendDst=Nu,y.xrlayer=this._createXRLayer(y);let w=this._session.renderState.layers;w.unshift(y.xrlayer),this._session.updateRenderState({layers:w})}else f.isXRRenderTarget=!1;return A}renderLayers(){let e=new re,t=new Gs,n=this._renderer,r=this.isPresenting;this.isPresenting=!1;let s=new Oe;n.getSize(s);let o=n.getRenderTarget();for(let a of this._layers){a.renderTarget.isXRRenderTarget=this._session!==null,a.renderTarget._hasExternalTextures=a.renderTarget.isXRRenderTarget;let l=n.contextNode,c;if(a.renderTarget.isXRRenderTarget&&this._sessionUsesLayers){a.xrlayer.transform=new XRRigidTransform(a.plane.getWorldPosition(e),a.plane.getWorldQuaternion(t));let u=this._glBinding.getSubImage(a.xrlayer,this._xrFrame);n.backend.setXRRenderTargetTextures(a.renderTarget,u.colorTexture,void 0),n._setXRLayerSize(a.renderTarget.width,a.renderTarget.height),c=Dte.get(l),c===void 0&&(c=l.context({getOutput:f=>jz(f,n.toneMapping,n.outputColorSpace)}),Dte.set(l,c))}else c=l;n.contextNode=c,n.setRenderTarget(a.renderTarget),a.rendercall(),n.contextNode=l}n.setRenderTarget(o),n._setXRLayerSize(s.x,s.y),this.isPresenting=r}getSession(){return this._session}async setSession(e){let t=this._renderer;t.initialized===!1&&await t.init(),this._gl=t.getContext();let n=this._gl;if(this._session=e,e!==null){if(e.addEventListener("select",this._onSessionEvent),e.addEventListener("selectstart",this._onSessionEvent),e.addEventListener("selectend",this._onSessionEvent),e.addEventListener("squeeze",this._onSessionEvent),e.addEventListener("squeezestart",this._onSessionEvent),e.addEventListener("squeezeend",this._onSessionEvent),e.addEventListener("end",this._onSessionEnd),e.addEventListener("inputsourceschange",this._onInputSourcesChange),this._validateWebGPUSession(),this._currentPixelRatio=t.getPixelRatio(),t.getSize(this._currentSize),this._currentAnimationContext=t._animation.getContext(),this._currentAnimationLoop=t._animation.getAnimationLoop(),t._animation.stop(),this._isWebGPUSession())await this._initWebGPUSession(e);else if(this._supportsLayers===!0){let r=null,s=null,o=null,a=n.getContextAttributes();await t.backend.makeXRCompatible(),this.setFoveation(this.getFoveation()),t.depth&&(o=t.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,r=t.stencil?xo:Vs,s=t.stencil?ua:xi);let l={colorFormat:n.RGBA8,depthFormat:o,scaleFactor:this._framebufferScaleFactor,clearOnAccess:!1};this._useMultiviewIfPossible&&t.hasFeature("OVR_multiview2")&&(l.textureType="texture-array",this._useMultiview=!0),this._glBinding=this.getBinding();let c=this._glBinding.createProjectionLayer(l),u=[c];this._glProjLayer=c,t.setPixelRatio(1),t._setXRLayerSize(c.textureWidth,c.textureHeight);let f=this._useMultiview?2:1,d=new Es(c.textureWidth,c.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,r,f);if(this._xrRenderTarget=new Hg(c.textureWidth,c.textureHeight,{format:Or,type:Ji,colorSpace:t.outputColorSpace,depthTexture:d,stencilBuffer:t.stencil,samples:a.antialias?4:0,resolveDepthBuffer:c.ignoreDepthValues===!1,resolveStencilBuffer:c.ignoreDepthValues===!1,depth:this._useMultiview?2:1,multiview:this._useMultiview}),this._xrRenderTarget._hasExternalTextures=!0,this._xrRenderTarget.depth=this._useMultiview?2:1,this._sessionUsesLayers=e.enabledFeatures.includes("layers"),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._sessionUsesLayers)for(let A of this._layers)A.plane.material=new fs({color:16777215,side:A.type==="cylinder"?mi:zo}),A.plane.material.blending=Dd,A.plane.material.blendEquation=oo,A.plane.material.blendSrc=Nu,A.plane.material.blendDst=Nu,A.xrlayer=this._createXRLayer(A),u.unshift(A.xrlayer);e.updateRenderState({layers:u})}else{await t.backend.makeXRCompatible(),this.setFoveation(this.getFoveation());let r={antialias:t.currentSamples>0,alpha:!0,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:this.getFramebufferScaleFactor()},s=new XRWebGLLayer(e,n,r);this._glBaseLayer=s,e.updateRenderState({baseLayer:s}),t.setPixelRatio(1),t._setXRLayerSize(s.framebufferWidth,s.framebufferHeight),this._xrRenderTarget=new Hg(s.framebufferWidth,s.framebufferHeight,{format:Or,type:Ji,colorSpace:t.outputColorSpace,stencilBuffer:t.stencil,resolveDepthBuffer:s.ignoreDepthValues===!1,resolveStencilBuffer:s.ignoreDepthValues===!1}),this._xrRenderTarget._isOpaqueFramebuffer=!0,this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType())}t._animation.setAnimationLoop(this._onAnimationFrame),t._animation.setContext(e),t._animation.start(),this.isPresenting=!0,this.dispatchEvent({type:"sessionstart"})}}updateCamera(e){let t=this._session;if(t===null)return;let n=e.near,r=e.far,s=this._cameraXR,o=this._cameraL,a=this._cameraR;s.near=a.near=o.near=n,s.far=a.far=o.far=r,s.isMultiViewCamera=this._useMultiview,(this._currentDepthNear!==s.near||this._currentDepthFar!==s.far)&&(t.updateRenderState({depthNear:s.near,depthFar:s.far}),this._currentDepthNear=s.near,this._currentDepthFar=s.far),s.layers.mask=e.layers.mask|6,o.layers.mask=s.layers.mask&-5,a.layers.mask=s.layers.mask&-3;let l=e.parent,c=s.cameras;Nte(s,l);for(let u=0;u<c.length;u++)Nte(c[u],l);c.length===2?pIe(s,o,a):s.projectionMatrix.copy(o.projectionMatrix),mIe(e,s,l)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new r0,this._controllers[e]=t),t}};function pIe(i,e,t){Ite.setFromMatrixPosition(e.matrixWorld),Lte.setFromMatrixPosition(t.matrixWorld);let n=Ite.distanceTo(Lte),r=e.projectionMatrix.elements,s=t.projectionMatrix.elements,o=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],u=(r[8]-1)/r[0],f=(s[8]+1)/s[0],d=o*u,A=o*f,y=n/(-u+f),w=y*-u;if(e.matrixWorld.decompose(i.position,i.quaternion,i.scale),i.translateX(w),i.translateZ(y),i.matrixWorld.compose(i.position,i.quaternion,i.scale),i.matrixWorldInverse.copy(i.matrixWorld).invert(),r[10]===-1)i.projectionMatrix.copy(e.projectionMatrix),i.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{let S=o+y,T=a+y,R=d-w,I=A+(n-w),P=l*a/T*S,F=c*a/T*S;i.projectionMatrix.makePerspective(R,I,P,F,S,T),i.projectionMatrixInverse.copy(i.projectionMatrix).invert()}}function Nte(i,e){e===null?i.matrixWorld.copy(i.matrix):i.matrixWorld.multiplyMatrices(e.matrixWorld,i.matrix),i.matrixWorldInverse.copy(i.matrixWorld).invert()}function mIe(i,e,t){t===null?i.matrix.copy(e.matrixWorld):(i.matrix.copy(t.matrixWorld),i.matrix.invert(),i.matrix.multiply(e.matrixWorld)),i.matrix.decompose(i.position,i.quaternion,i.scale),i.updateMatrixWorld(!0),i.projectionMatrix.copy(e.projectionMatrix),i.projectionMatrixInverse.copy(e.projectionMatrixInverse),i.isPerspectiveCamera&&(i.fov=Cd*2*Math.atan(1/i.projectionMatrix.elements[5]),i.zoom=1)}function AIe(i){let e=this._controllerInputSources.indexOf(i.inputSource);if(e===-1)return;let t=this._controllers[e];if(t!==void 0){let n=this.getReferenceSpace();t.update(i.inputSource,i.frame,n),t.dispatchEvent({type:i.type,data:i.inputSource})}}function gIe(){let i=this._session,e=this._renderer;i.removeEventListener("select",this._onSessionEvent),i.removeEventListener("selectstart",this._onSessionEvent),i.removeEventListener("selectend",this._onSessionEvent),i.removeEventListener("squeeze",this._onSessionEvent),i.removeEventListener("squeezestart",this._onSessionEvent),i.removeEventListener("squeezeend",this._onSessionEvent),i.removeEventListener("end",this._onSessionEnd),i.removeEventListener("inputsourceschange",this._onInputSourcesChange);for(let t=0;t<this._controllers.length;t++){let n=this._controllerInputSources[t];n!==null&&(this._controllerInputSources[t]=null,this._controllers[t].disconnect(n))}if(this._currentDepthNear=null,this._currentDepthFar=null,this._currentSamples!==null&&(e._samples=this._currentSamples,this._currentSamples=null),e._resetXRState(),this._disposeWebGPUSession(),this._session=null,this._xrRenderTarget=null,this._glBinding=null,this._webgpuBinding=null,this._glBaseLayer=null,this._glProjLayer=null,this._sessionUsesLayers===!0)for(let t of this._layers)t.renderTarget=new Hg(t.pixelwidth,t.pixelheight,{format:Or,type:Ji,depthTexture:new Es(t.pixelwidth,t.pixelheight,t.stencilBuffer?ua:xi,void 0,void 0,void 0,void 0,void 0,void 0,t.stencilBuffer?xo:Vs),stencilBuffer:t.stencilBuffer,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),t.renderTarget.isXRRenderTarget=!1,t.plane.material=t.material,t.material.map=t.renderTarget.texture,t.material.map.offset.y=1,t.material.map.repeat.y=-1,delete t.xrlayer;this.isPresenting=!1,this._useMultiview=!1,e._animation.stop(),e._animation.setAnimationLoop(this._currentAnimationLoop),e._animation.setContext(this._currentAnimationContext),e._animation.start(),e.setPixelRatio(this._currentPixelRatio),e.setSize(this._currentSize.width,this._currentSize.height,!1),this.dispatchEvent({type:"sessionend"})}function vIe(i){let e=this._controllers,t=this._controllerInputSources;for(let n=0;n<i.removed.length;n++){let r=i.removed[n],s=t.indexOf(r);s>=0&&(t[s]=null,e[s].disconnect(r))}for(let n=0;n<i.added.length;n++){let r=i.added[n],s=t.indexOf(r);if(s===-1){for(let a=0;a<e.length;a++)if(a>=t.length){t.push(r),s=a;break}else if(t[a]===null){t[a]=r,s=a;break}if(s===-1)break}let o=e[s];o&&o.connect(r)}}function _Ie(i){return i.type==="quad"?this._glBinding.createQuadLayer({transform:new XRRigidTransform(i.translation,i.quaternion),width:i.width/2,height:i.height/2,space:this._referenceSpace,viewPixelWidth:i.pixelwidth,viewPixelHeight:i.pixelheight,clearOnAccess:!1}):this._glBinding.createCylinderLayer({transform:new XRRigidTransform(i.translation,i.quaternion),radius:i.radius,centralAngle:i.centralAngle,aspectRatio:i.aspectRatio,space:this._referenceSpace,viewPixelWidth:i.pixelwidth,viewPixelHeight:i.pixelheight,clearOnAccess:!1})}function xIe(i,e){if(e===void 0)return;let t=this._cameraXR,n=this._renderer,r=n.backend,s=this._glBaseLayer,o=this.getReferenceSpace(),a=e.getViewerPose(o);if(this._xrFrame=e,a!==null){let l=a.views,c=this._isWebGPUSession()?this._getWebGPUViewData(l):null;this._glBaseLayer!==null&&c===null&&r.setXRTarget(s.framebuffer);let u=!1;l.length!==t.cameras.length&&(t.cameras.length=0,u=!0);for(let d=0;d<l.length;d++){let A=l[d],y;if(c!==null)y=c.viewports[d];else if(this._supportsLayers===!0){let S=this._glBinding.getViewSubImage(this._glProjLayer,A);y=S.viewport,d===0&&r.setXRRenderTargetTextures(this._xrRenderTarget,S.colorTexture,this._glProjLayer.ignoreDepthValues&&!this._useMultiview?void 0:S.depthStencilTexture)}else y=s.getViewport(A);let w=this._cameras[d];w===void 0&&(w=new Yr,w.layers.enable(d),w.viewport=new xn,w.matrixWorldAutoUpdate=!1,this._cameras[d]=w),w.matrix.fromArray(A.transform.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale),w.projectionMatrix.fromArray(A.projectionMatrix),w.projectionMatrixInverse.copy(w.projectionMatrix).invert(),w.viewport.set(y.x,y.y,y.width,y.height),d===0&&(t.matrix.copy(w.matrix),t.matrix.decompose(t.position,t.quaternion,t.scale)),u===!0&&t.cameras.push(w)}c!==null&&c.colorTexture!==null&&r.setXRRenderTargetTextures(this._xrRenderTarget,c.colorTexture,c.viewDescriptors),n.setOutputRenderTarget(this._xrRenderTarget);let f=n._getFrameBufferTarget();n.xr.foveateBoundTexture(f)}for(let l=0;l<this._controllers.length;l++){let c=this._controllerInputSources[l],u=this._controllers[l];c!==null&&u!==void 0&&u.update(c,e,o)}this._currentAnimationLoop&&this._currentAnimationLoop(i,e),e.detectedPlanes&&this.dispatchEvent({type:"planesdetected",data:e}),this._xrFrame=null}var A9=class extends ca{constructor(e){super(),this.domElement=e,this._pixelRatio=1,this._width=this.domElement.width,this._height=this.domElement.height,this._viewport=new xn(0,0,this._width,this._height),this._scissor=new xn(0,0,this._width,this._height),this._scissorTest=!1,this.colorTexture=new WA,this.depthTexture=new Es}getPixelRatio(){return this._pixelRatio}getDrawingBufferSize(e){return e.set(this._width*this._pixelRatio,this._height*this._pixelRatio).floor()}getSize(e){return e.set(this._width,this._height)}setPixelRatio(e=1){this._pixelRatio!==e&&(this._pixelRatio=e,this.setSize(this._width,this._height,!1))}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this._pixelRatio=n,this.domElement.width=Math.floor(e*n),this.domElement.height=Math.floor(t*n),this.setViewport(0,0,e,t),this._dispatchResize())}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this.domElement.width=Math.floor(e*this._pixelRatio),this.domElement.height=Math.floor(t*this._pixelRatio),n===!0&&(this.domElement.style.width=e+"px",this.domElement.style.height=t+"px"),this.setViewport(0,0,e,t),this._dispatchResize())}getScissor(e){let t=this._scissor;return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e}setScissor(e,t,n,r){let s=this._scissor;e.isVector4?s.copy(e):s.set(e,t,n,r)}getScissorTest(){return this._scissorTest}setScissorTest(e){this._scissorTest=e}getViewport(e){return e.copy(this._viewport)}setViewport(e,t,n,r,s=0,o=1){let a=this._viewport;e.isVector4?a.copy(e):a.set(e,t,n,r),a.minDepth=s,a.maxDepth=o}_dispatchResize(){this.dispatchEvent({type:"resize"})}dispose(){this.dispatchEvent({type:"dispose"})}},Fte=new s0,W_=new Oe,cU=new xn,FR=new zc,BR=new N2,j_=new cn,qd=new xn,yIe={[zo]:mi,[mi]:zo,[vr]:vr},g9=class{constructor(e,t={}){this.isRenderer=!0;let{logarithmicDepthBuffer:n=!1,reversedDepthBuffer:r=!1,alpha:s=!0,depth:o=!0,stencil:a=!1,antialias:l=!1,samples:c=0,getFallback:u=null,outputBufferType:f=Wi,multiview:d=!1}=t;this.backend=e,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.alpha=s,this.logarithmicDepthBuffer=n,this.reversedDepthBuffer=r,this.outputColorSpace=Fr,this.toneMapping=ao,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=o,this.stencil=a,this.info=new Y7,this.contextNode=ep(),this.library=new $4,this.lighting=new p9,this._samples=c||l===!0?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new A9(e.getDomElement()),this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new d4,this._inspector.setRenderer(this),this._getFallback=u,this._attributes=null,this._geometries=null,this._nodes=null,this._animation=null,this._bindings=null,this._objects=null,this._pipelines=null,this._bundles=null,this._renderLists=null,this._renderContexts=null,this._textures=null,this._background=null,this._quadCache=new Map,this._currentRenderContext=null,this._opaqueSort=null,this._transparentSort=null,this._frameBufferTargets=new Map;let A=this.alpha===!0?0:1;this._clearColor=new xS(0,0,0,A),this._clearDepth=1,this._clearStencil=0,this._renderTarget=null,this._activeCubeFace=0,this._activeMipmapLevel=0,this._outputRenderTarget=null,this._mrt=null,this._renderObjectFunction=null,this._currentRenderObjectFunction=null,this._currentRenderBundle=null,this._handleObjectFunction=this._renderObjectDirect,this._isDeviceLost=!1,this.onDeviceLost=this._onDeviceLost,this.onError=this._onError,this._outputBufferType=f,this._cacheShadowNodes=new WeakMap,this._initialized=!1,this._callDepth=-1,this._initPromise=null,this._compilationPromises=null,this._currentSourceMaterial=null,this.transparent=!0,this.opaque=!0,this.shadowMap={enabled:!1,transmitted:!1,type:d0},this.xr=new m9(this,d),this.debug={checkShaderErrors:!0,onShaderError:null,getShaderAsync:async(y,w,S)=>{await this.compileAsync(S,w,y);let R=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,I=this._renderLists.get(y,w),P=this._renderContexts.get(R,this._mrt),F=y.overrideMaterial||S.material,D=this._objects.get(S,F,y,w,I.lightsNode,P,P.clippingContext),{fragmentShader:L,vertexShader:C}=D.getNodeBuilderState();return{fragmentShader:L,vertexShader:C}}}}async init(){return this._initPromise!==null?this._initPromise:(this._initPromise=new Promise(async(e,t)=>{let n=this.backend;try{await n.init(this)}catch(r){if(this._getFallback!==null)try{this.backend=n=this._getFallback(r),await n.init(this)}catch(s){t(s);return}else{t(r);return}}this._nodes=new h9(this,n),this._animation=new H7(this,this._nodes,this.info),this._attributes=new X7(n,this.info),this._background=new Nk(this,this._nodes),this._geometries=new $7(this._attributes,this.info),this._textures=new rk(this,n,this.info),this._pipelines=new Q7(n,this._nodes,this.info),this._bindings=new J7(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new j7(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new tk(this.lighting),this._bundles=new d9,this._renderContexts=new ik(this),this._animation.start(),this._initialized=!0,this._inspector.init(),e(this)}),this._initPromise)}get domElement(){return this._canvasTarget.domElement}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,n=null){if(this._isDeviceLost===!0)return;this._initialized===!1&&await this.init();let r=this._nodes.nodeFrame,s=r.renderId,o=this._currentRenderContext,a=this._currentRenderObjectFunction,l=this._handleObjectFunction,c=this._compilationPromises;n===null&&(n=e);let u=e.isScene===!0?e:n.isScene===!0?n:Fte,d=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,A=this._renderContexts.get(d,this._mrt),y=this._activeMipmapLevel,w=[];this._currentRenderContext=A,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=w,r.renderId++,r.update(),A.depth=this.depth,A.stencil=this.stencil,A.clippingContext||(A.clippingContext=new X4),A.clippingContext.updateGlobal(u,t),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t),u.onBeforeRender(this,e,t,d);let S=t.isArrayCamera?BR:FR;t.isArrayCamera?S.setFromArrayCamera(t):(j_.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),S.setFromProjectionMatrix(j_,t.coordinateSystem,t.reversedDepth));let T=this._renderLists.get(u,t);if(T.begin(),this._projectObject(e,t,0,T,A.clippingContext),n!==e&&n.traverseVisible(function(D){D.isLight&&D.layers.test(t.layers)&&T.pushLight(D)}),T.finish(),d!==null){this._textures.updateRenderTarget(d,y);let D=this._textures.get(d);A.textures=D.textures,A.depthTexture=D.depthTexture}else A.textures=null,A.depthTexture=null;n!==e?this._background.update(n,T,A):this._background.update(u,T,A);let R=T.opaque,I=T.transparent,P=T.transparentDoublePass,F=T.lightsNode;this.opaque===!0&&R.length>0&&this._renderObjects(R,t,u,F),this.transparent===!0&&I.length>0&&this._renderTransparents(I,P,t,u,F),r.renderId=s,this._currentRenderContext=o,this._currentRenderObjectFunction=a,this._handleObjectFunction=l,this._compilationPromises=c;for(let D of w){let L=this._objects.get(D.object,D.material,D.scene,D.camera,D.lightsNode,D.renderContext,D.clippingContext,D.passId);L.drawRange=D.object.geometry.drawRange,L.group=D.group,await this._nodes.getForRenderAsync(L),this._nodes.updateBefore(L),this._geometries.updateForRender(L),this._nodes.updateForRender(L),this._bindings.updateForRender(L);let C=[];this._pipelines.getForRender(L,C),C.length>0&&await Promise.all(C),this._nodes.updateAfter(L),await pF()}}async renderAsync(e,t){ni('Renderer: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.render(e,t)}async waitForGPU(){ze("Renderer: waitForGPU() has been removed. Read https://github.com/mrdoob/three.js/issues/32012 for more information.")}set inspector(e){this._inspector!==null&&this._inspector.setRenderer(null),this._inspector=e,this._inspector.setRenderer(this)}get inspector(){return this._inspector}set highPrecision(e){let t=this.contextNode.value;e===!0?(t.modelViewMatrix=ZU,t.modelNormalViewMatrix=KU):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){let e=this.contextNode.value;return e.modelViewMatrix===ZU&&e.modelNormalViewMatrix===KU}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return ni('Renderer: ".getColorBufferType()" has been renamed to ".getOutputBufferType()".'),this.getOutputBufferType()}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost:41674167 41684168 Message: ${e.message}`;e.reason&&(t+=`4169-Reason: ${e.reason}`),ze(t),this._isDeviceLost=!0}_onError(e){let t=`WebGPURenderer: Uncaptured ${e.api} ${e.type}`;e.message&&(t+=`: ${e.message}`),ze(t)}_bundleNeedsUpdate(e,t){return t.bundleGPU===void 0||e.version!==t.version}_renderBundle(e,t,n){let{bundleGroup:r,camera:s,renderList:o}=e,a=this._currentRenderContext,l=this._bundles.get(r,s,a),c=this.backend.get(l);if(this._bundleNeedsUpdate(r,c)){this.backend.beginBundle(a),this._currentRenderBundle=l;let{transparentDoublePass:f,transparent:d,opaque:A}=o;this.opaque===!0&&A.length>0&&this._renderObjects(A,s,t,n),this.transparent===!0&&d.length>0&&this._renderTransparents(d,f,s,t,n),this._currentRenderBundle=null,this.backend.finishBundle(a,l),c.version=r.version}else{let{renderObjects:f}=c;for(let d=0,A=f.length;d<A;d++){let y=f[d];this._nodes.needsRefresh(y)&&(this._nodes.updateBefore(y),this._geometries.updateForRender(y),this._nodes.updateForRender(y),this._bindings.updateForRender(y),this._nodes.updateAfter(y))}}this.backend.addBundle(a,l)}render(e,t){if(this._initialized===!1)throw new Error('THREE.Renderer: .render() called before the backend is initialized. Use "await renderer.init();" before rendering.');this._renderScene(e,t)}get initialized(){return this._initialized}_renderOutputLayers(e,t){if(t.texture.isArrayTexture!==!0||t.texture.image.depth<=1){this._renderScene(e,e.camera,!1);return}let n=this._activeCubeFace;try{for(let r=0;r<t.texture.image.depth;r++)this._nodes.setOutputLayerIndex(r),this._activeCubeFace=r,this._renderScene(e,e.camera,!1)}finally{this._nodes.setOutputLayerIndex(0),this._activeCubeFace=n}}_getFrameBufferTarget(){let{currentToneMapping:e,currentColorSpace:t}=this,n=e!==ao,r=t!==ln.workingColorSpace;if(n===!1&&r===!1)return null;let{width:s,height:o}=this.getDrawingBufferSize(X_),{depth:a,stencil:l}=this,c=this._outputRenderTarget||this._canvasTarget,u=this._frameBufferTargets.get(c);if(u===void 0){u=new Ba(s,o,{depthBuffer:a,stencilBuffer:l,type:this._outputBufferType,format:Ur,colorSpace:ln.workingColorSpace,generateMipmaps:!1,minFilter:Mi,magFilter:Mi,samples:this.samples}),u.isPostProcessingRenderTarget=!0;let S=()=>{c.removeEventListener("dispose",S),u.dispose(),this._frameBufferTargets.delete(c)};c.addEventListener("dispose",S),this._frameBufferTargets.set(c,u)}let f=this.getOutputRenderTarget();u.depthBuffer=a,u.stencilBuffer=l,f!==null?u.setSize(f.width,f.height,f.depth):u.setSize(s,o,1);let d=this._outputRenderTarget?this._outputRenderTarget.viewport:c._viewport,A=this._outputRenderTarget?this._outputRenderTarget.scissor:c._scissor,y=this._outputRenderTarget?1:c._pixelRatio,w=this._outputRenderTarget?this._outputRenderTarget.scissorTest:c._scissorTest;return u.viewport.copy(d),u.scissor.copy(A),u.viewport.multiplyScalar(y),u.scissor.multiplyScalar(y),u.scissorTest=w,u.multiview=f!==null?f.multiview:!1,u.useArrayDepthTexture=f!==null?f.useArrayDepthTexture:!1,u.resolveDepthBuffer=f!==null?f.resolveDepthBuffer:!0,u._autoAllocateDepthBuffer=f!==null?f._autoAllocateDepthBuffer:!1,u}_renderScene(e,t,n=!0){if(this._isDeviceLost===!0)return;let r=n?this._getFrameBufferTarget():null,s=this._nodes.nodeFrame,o=s.renderId,a=this._currentRenderContext,l=this._currentRenderObjectFunction,c=this._handleObjectFunction;this.lighting.beginRender(e),this._callDepth++;let u=e.isScene===!0?e:kte,f=this._renderTarget||this._outputRenderTarget,d=this._activeCubeFace,A=this._activeMipmapLevel,y;if(r!==null?(y=r,this.setRenderTarget(y)):y=f,y!==null&&y.depthBuffer===!0){let W=this._textures.get(y);W.depthInitialized!==!0&&((this.autoClear===!1||this.autoClear===!0&&this.autoClearDepth===!1)&&this.clearDepth(),W.depthInitialized=!0)}let w=this._renderContexts.get(y,this._mrt,this._callDepth);this._currentRenderContext=w,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this._handleObjectFunction=this._renderObjectDirect,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,s.renderId=this.info.calls,this.backend.updateTimeStampUID(w),this.inspector.beginRender(this.backend.getTimestampUID(w),e,t,y),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t);let S=this._canvasTarget,T=S._viewport,R=S._scissor,P=S._pixelRatio;y!==null&&(T=y.viewport,R=y.scissor,P=1),this.getDrawingBufferSize(X_),cU.set(0,0,X_.width,X_.height);let I=T.minDepth===void 0?0:T.minDepth,F=T.maxDepth===void 0?1:T.maxDepth;w.viewportValue.copy(T).multiplyScalar(P).floor(),w.viewportValue.width>>=A,w.viewportValue.height>>=A,w.viewportValue.minDepth=I,w.viewportValue.maxDepth=F,w.viewport=w.viewportValue.equals(cU)===!1,w.scissorValue.copy(R).multiplyScalar(P).floor(),w.scissor=S._scissorTest&&w.scissorValue.equals(cU)===!1,w.scissorValue.width>>=A,w.scissorValue.height>>=A,w.clippingContext||(w.clippingContext=new Q4),w.clippingContext.updateGlobal(u,t),u.onBeforeRender(this,e,t,y);let D=t.isArrayCamera?VR:zR;t.isArrayCamera?D.setFromArrayCamera(t):($_.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),D.setFromProjectionMatrix($_,t.coordinateSystem,t.reversedDepth));let L=this._renderLists.get(e,t);if(L.begin(),this._projectObject(e,t,0,L,w.clippingContext),L.finish(),this.sortObjects===!0&&L.sort(this._opaqueSort,this._transparentSort,t.reversedDepth),y!==null){this._textures.updateRenderTarget(y,A);let W=this._textures.get(y);w.textures=W.textures,w.depthTexture=W.depthTexture,w.width=W.width,w.height=W.height,w.renderTarget=y,w.depth=y.depthBuffer,w.stencil=y.stencilBuffer}else w.textures=null,w.depthTexture=null,w.width=X_.width,w.height=X_.height,w.depth=this.depth,w.stencil=this.stencil;w.width>>=A,w.height>>=A,w.activeCubeFace=d,w.activeMipmapLevel=A,w.occlusionQueryCount=L.occlusionQueryCount,w.scissorValue.max(jd.set(0,0,0,0)),w.scissorValue.x+w.scissorValue.width>w.width&&(w.scissorValue.width=Math.max(w.width-w.scissorValue.x,0)),w.scissorValue.y+w.scissorValue.height>w.height&&(w.scissorValue.height=Math.max(w.height-w.scissorValue.y,0)),this._background.update(u,L,w),w.camera=t,this.backend.beginRender(w);let{bundles:C,lightsNode:B,transparentDoublePass:k,transparent:z,opaque:G}=L;return C.length>0&&this._renderBundles(C,u,B),this.opaque===!0&&G.length>0&&this._renderObjects(G,t,u,B),this.transparent===!0&&z.length>0&&this._renderTransparents(z,k,t,u,B),this.backend.finishRender(w),s.renderId=o,this._currentRenderContext=a,this._currentRenderObjectFunction=l,this._handleObjectFunction=c,this.lighting.finishRender(e),this._callDepth--,r!==null&&(this.setRenderTarget(f,d,A),this._renderOutput(y)),u.onAfterRender(this,e,t,y),this.inspector.finishRender(this.backend.getTimestampUID(w)),w}_setXRLayerSize(e,t){this._canvasTarget._width=e,this._canvasTarget._height=t,this.setViewport(0,0,e,t)}_renderOutput(e){let t=this._nodes.getOutputCacheKey(),n=this._quadCache.get(e.texture),r;if(n===void 0){r=new ES(new Pr),r.name="Output Color Transform",r.material.name="outputColorTransform",r.material.fragmentNode=this._nodes.getOutputNode(e.texture),n={quad:r,cacheKey:t},this._quadCache.set(e.texture,n);let a=()=>{r.material.dispose(),this._quadCache.delete(e.texture),e.texture.removeEventListener("dispose",a)};e.texture.addEventListener("dispose",a)}else r=n.quad,n.cacheKey!==t&&(r.material.fragmentNode=this._nodes.getOutputNode(e.texture),r.material.needsUpdate=!0,n.cacheKey=t);let s=this.autoClear,o=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderOutputLayers(r,e),this.autoClear=s,this.xr.enabled=o}getMaxAnisotropy(){return this.backend.capabilities.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){this._initialized===!1&&await this.init(),this._animation.setAnimationLoop(e)}getAnimationLoop(){return this._animation.getAnimationLoop()}async getArrayBufferAsync(e,t=null,n=0,r=-1){if(t!==null&&t.isReadbackBuffer&&this.info.memoryMap.has(t)===!1){this.info.createReadbackBuffer(t);let s=()=>{t.removeEventListener("dispose",s),this.info.destroyReadbackBuffer(t)};t.addEventListener("dispose",s)}if(n%4!==0||r>0&&r%4!==0)throw new Error('THREE.Renderer: "getArrayBufferAsync()" offset and count must be a multiple of 4.');return await this.backend.getArrayBufferAsync(e,t,n,r)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._canvasTarget.getPixelRatio()}getDrawingBufferSize(e){return this._canvasTarget.getDrawingBufferSize(e)}getSize(e){return this._canvasTarget.getSize(e)}setPixelRatio(e=1){this._canvasTarget.setPixelRatio(e)}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||this._canvasTarget.setDrawingBufferSize(e,t,n)}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||this._canvasTarget.setSize(e,t,n)}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){return this._canvasTarget.getScissor(e)}setScissor(e,t,n,r){this._canvasTarget.setScissor(e,t,n,r)}getScissorTest(){return this._canvasTarget.getScissorTest()}setScissorTest(e){this._canvasTarget.setScissorTest(e),this.backend.setScissorTest(e)}getViewport(e){return this._canvasTarget.getViewport(e)}setViewport(e,t,n,r,s=0,o=1){this._canvasTarget.setViewport(e,t,n,r,s,o)}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return this.reversedDepthBuffer===!0?1-this._clearDepth:this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){let t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,n=!0){if(this._initialized===!1)throw new Error('THREE.Renderer: .clear() called before the backend is initialized. Use "await renderer.init();" before using this method.');let r=this._renderTarget||this._getFrameBufferTarget(),s=null;if(r!==null){this._textures.updateRenderTarget(r);let o=this._textures.get(r);s=this._renderContexts.get(r,null,-1),s.textures=o.textures,s.depthTexture=o.depthTexture,s.width=o.width,s.height=o.height,s.renderTarget=r,s.depth=r.depthBuffer,s.stencil=r.stencilBuffer;let a=this.backend.getClearColor();s.clearColorValue.r=a.r,s.clearColorValue.g=a.g,s.clearColorValue.b=a.b,s.clearColorValue.a=a.a,s.clearDepthValue=this.getClearDepth(),s.clearStencilValue=this.getClearStencil(),s.activeCubeFace=this.getActiveCubeFace(),s.activeMipmapLevel=this.getActiveMipmapLevel(),r.depthBuffer===!0&&(o.depthInitialized=!0)}this.backend.clear(e,t,n,s),r!==null&&this._renderTarget===null&&this._renderOutput(r)}clearColor(){this.clear(!0,!1,!1)}clearDepth(){this.clear(!1,!0,!1)}clearStencil(){this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,n=!0){ni('Renderer: "clearAsync()" has been deprecated. Use "clear()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.clear(e,t,n)}async clearColorAsync(){ni('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){ni('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){ni('Renderer: "clearStencilAsync()" has been deprecated. Use "clearStencil()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!1,!0)}get needsFrameBufferTarget(){let e=this.currentToneMapping!==ao,t=this.currentColorSpace!==ln.workingColorSpace;return e||t}get samples(){return this._samples}get currentSamples(){let e=this._samples;return this._renderTarget!==null?e=this._renderTarget.samples:this.needsFrameBufferTarget&&(e=0),e}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:ao}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:ln.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||this._renderTarget===null}dispose(){if(this._initialized===!0){this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._geometries.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose();for(let e of this._frameBufferTargets.keys())e.dispose();Object.values(this.backend.timestampQueryPool).forEach(e=>{e!==null&&e.dispose()})}this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,n=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=n}getRenderTarget(){return this._renderTarget}setOutputRenderTarget(e){this._outputRenderTarget=e}getOutputRenderTarget(){return this._outputRenderTarget}setCanvasTarget(e){this._canvasTarget.removeEventListener("resize",this._onCanvasTargetResize),this._canvasTarget=e,this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize)}getCanvasTarget(){return this._canvasTarget}_resetXRState(){this.backend.setXRTarget(null),this.setOutputRenderTarget(null),this.setRenderTarget(null);for(let e of this._frameBufferTargets.keys())e.dispose()}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e,t=null){if(this._isDeviceLost===!0)return;if(this._initialized===!1)return Xe("Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e,t);let n=this._nodes.nodeFrame,r=n.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,n.renderId=this.info.calls,this.backend.updateTimeStampUID(e),this.inspector.beginCompute(this.backend.getTimestampUID(e),e);let s=this.backend,o=this._pipelines,a=this._bindings,l=this._nodes,c=Array.isArray(e)?e:[e];if(c[0]===void 0||c[0].isComputeNode!==!0)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");s.beginCompute(e);for(let u of c){if(o.has(u)===!1){let A=()=>{u.removeEventListener("dispose",A),o.delete(u),a.deleteForCompute(u),l.delete(u)};u.addEventListener("dispose",A);let y=u.onInitFunction;y!==null&&y.call(u,{renderer:this})}l.updateForCompute(u),a.updateForCompute(u);let f=a.getForCompute(u),d=o.getForCompute(u,f);s.compute(e,u,f,d,t)}s.finishCompute(e),n.renderId=r,this.inspector.finishCompute(this.backend.getTimestampUID(e))}async computeAsync(e,t=null){this._initialized===!1&&await this.init(),this.compute(e,t)}async hasFeatureAsync(e){return ni('Renderer: "hasFeatureAsync()" has been deprecated. Use "hasFeature()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.hasFeature(e)}async resolveTimestampsAsync(e="render"){return this._initialized===!1&&await this.init(),this.backend.resolveTimestampsAsync(e)}hasFeature(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasFeature() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){ni('Renderer: "initTextureAsync()" has been deprecated. Use "initTexture()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.initTexture(e)}initTexture(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initTexture() called before the backend is initialized. Use "await renderer.init();" before using this method.');this._textures.updateTexture(e)}initRenderTarget(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initRenderTarget() called before the backend is initialized. Use "await renderer.init();" before using this method.');this._textures.updateRenderTarget(e);let t=this._textures.get(e),n=this._renderContexts.get(e);n.textures=t.textures,n.depthTexture=t.depthTexture,n.width=t.width,n.height=t.height,n.renderTarget=e,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,this.backend.initRenderTarget(n)}copyFramebufferToTexture(e,t=null){if(t!==null)if(t.isVector2)t=jd.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=jd.copy(t).floor();else{ze("Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=jd.set(0,0,e.image.width,e.image.height);let n=this._currentRenderContext,r;n!==null?r=n.renderTarget:(r=this._renderTarget||this._getFrameBufferTarget(),r!==null&&(this._textures.updateRenderTarget(r),n=this._textures.get(r))),this._textures.updateTexture(e,{renderTarget:r}),this.backend.copyFramebufferToTexture(e,n,t),this._inspector.copyFramebufferToTexture(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,n,r,s,o),this._inspector.copyTextureToTexture(e,t)}async readRenderTargetPixelsAsync(e,t,n,r,s,o=0,a=0){return this.backend.copyTextureToBuffer(e.textures[o],t,n,r,s,a)}_projectObject(e,t,n,r,s){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder,e.isClippingGroup&&e.enabled&&(s=s.getGroupContext(e));else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)r.pushLight(e);else if(e.isSprite){let l=t.isArrayCamera?VR:zR;if(!e.frustumCulled||l.intersectsSprite(e)){this.sortObjects===!0&&jd.setFromMatrixPosition(e.matrixWorld).applyMatrix4($_);let{geometry:c,material:u}=e;u.visible&&r.push(e,c,u,n,jd.z,null,s)}}else if(e.isLineLoop)ze("Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if(e.isMesh||e.isLine||e.isPoints){let l=t.isArrayCamera?VR:zR;if(!e.frustumCulled||l.intersectsObject(e)){let{geometry:c,material:u}=e;if(this.sortObjects===!0&&(c.boundingSphere===null&&c.computeBoundingSphere(),jd.copy(c.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4($_)),Array.isArray(u)){let f=c.groups;for(let d=0,A=f.length;d<A;d++){let y=f[d],w=u[y.materialIndex];w&&w.visible&&r.push(e,c,w,n,jd.z,y,s)}}else u.visible&&r.push(e,c,u,n,jd.z,null,s)}}}if(e.isBundleGroup===!0&&this.backend.beginBundle!==void 0){let l=r;r=this._renderLists.get(e,t);let c=this._bundles.get(e,t,this._currentRenderContext),u=this.backend.get(c);if(this._bundleNeedsUpdate(e,u)){r.begin(),u.renderObjects===void 0?u.renderObjects=[]:u.renderObjects.length=0;let d=e.children;for(let A=0,y=d.length;A<y;A++)this._projectObject(d[A],t,n,r,s);r.finish()}l.pushBundle({bundleGroup:e,camera:t,renderList:r});return}let a=e.children;for(let l=0,c=a.length;l<c;l++)this._projectObject(a[l],t,n,r,s)}_renderBundles(e,t,n){for(let r of e)this._renderBundle(r,t,n)}_renderTransparents(e,t,n,r,s){if(t.length>0){for(let{material:o}of t)o.side=mi;this._renderObjects(t,n,r,s,"backSide");for(let{material:o}of t)o.side=zo;this._renderObjects(e,n,r,s);for(let{material:o}of t)o.side=vr}else this._renderObjects(e,n,r,s)}_renderObjects(e,t,n,r,s=null){for(let o=0,a=e.length;o<a;o++){let{object:l,geometry:c,material:u,group:f,clippingContext:d}=e[o];this._currentRenderObjectFunction(l,n,t,c,u,f,r,d,s)}}_getShadowNodes(e){let t=e.version,n=this._cacheShadowNodes.get(e);if(n===void 0||n.version!==t){let r=e.map&&e.map.isTexture,s=e.colorNode&&e.colorNode.isNode,o=e.castShadowNode&&e.castShadowNode.isNode,a=e.maskShadowNode&&e.maskShadowNode.isNode||e.maskNode&&e.maskNode.isNode,l=null,c=null,u=null;if(r||s||o||a){let f,d;if(o?(f=e.castShadowNode.rgb,d=e.castShadowNode.a,this.shadowMap.transmitted!==!0&&ni("Renderer: `shadowMap.transmitted` needs to be set to `true` when using `material.castShadowNode`.")):(f=pe(0),d=oe(1)),r&&(d=d.mul(mr("map","texture",e).a)),s&&(d=d.mul(e.colorNode.a)),c=Ft(f,d),a){let A=e.maskShadowNode||e.maskNode;c=me(([y])=>(A.not().discard(),y))(c)}}e.depthNode&&e.depthNode.isNode&&(u=e.depthNode),e.castShadowPositionNode&&e.castShadowPositionNode.isNode?l=e.castShadowPositionNode:e.positionNode&&e.positionNode.isNode&&(l=e.positionNode),n={version:t,colorNode:c,depthNode:u,positionNode:l},this._cacheShadowNodes.set(e,n)}return n}_updateCamera(e){let t=this.xr;if(t.isPresenting===!1){let n=!1;if(this.reversedDepthBuffer===!0&&e.reversedDepth!==!0){if(e._reversedDepth=!0,e.isArrayCamera)for(let s of e.cameras)s._reversedDepth=!0;n=!0}let r=this.coordinateSystem;if(e.coordinateSystem!==r){if(e.coordinateSystem=r,e.isArrayCamera)for(let s of e.cameras)s.coordinateSystem=r;n=!0}if(n===!0&&(e.updateProjectionMatrix(),e.isArrayCamera))for(let s of e.cameras)s.updateProjectionMatrix()}return e.parent===null&&e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.enabled===!0&&t.isPresenting===!0&&(t.cameraAutoUpdate===!0&&t.updateCamera(e),e=t.getCamera()),e}renderObject(e,t,n,r,s,o,a,l=null,c=null){let u=!1,f,d,A,y,w,S,T,R=this._currentSourceMaterial;if(e.onBeforeRender(this,t,n,r,s,o),s.allowOverride===!0&&t.overrideMaterial!==null){this._currentSourceMaterial=s;let P=t.overrideMaterial;if(u=!0,f=P.isNodeMaterial?P.colorNode:null,d=P.isNodeMaterial?P.depthNode:null,A=P.isNodeMaterial?P.positionNode:null,y=t.overrideMaterial.side,w=P.displacementMap,S=P.displacementScale,T=P.displacementBias,s.positionNode&&s.positionNode.isNode&&(P.positionNode=s.positionNode),P.alphaTest=s.alphaTest,P.alphaMap=s.alphaMap,P.displacementMap=s.displacementMap,P.displacementScale=s.displacementScale,P.displacementBias=s.displacementBias,P.transparent=s.transparent||s.transmission>0||s.transmissionNode&&s.transmissionNode.isNode||s.backdropNode&&s.backdropNode.isNode,P.isShadowPassMaterial){let{colorNode:I,depthNode:F,positionNode:D}=this._getShadowNodes(s);this.shadowMap.type===Wc?P.side=s.shadowSide!==null?s.shadowSide:s.side:P.side=s.shadowSide!==null?s.shadowSide:SPe[s.side],I!==null&&(P.colorNode=I),F!==null&&(P.depthNode=F),D!==null&&(P.positionNode=D)}s=P}s.transparent===!0&&s.side===vr&&s.forceSinglePass===!1?(s.side=mi,this._handleObjectFunction(e,s,t,n,a,o,l,"backSide"),s.side=zo,this._handleObjectFunction(e,s,t,n,a,o,l,c),s.side=vr):this._handleObjectFunction(e,s,t,n,a,o,l,c),u&&(t.overrideMaterial.colorNode=f,t.overrideMaterial.depthNode=d,t.overrideMaterial.positionNode=A,t.overrideMaterial.side=y,t.overrideMaterial.displacementMap=w,t.overrideMaterial.displacementScale=S,t.overrideMaterial.displacementBias=T),this._currentSourceMaterial=R,e.onAfterRender(this,t,n,r,s,o)}hasCompatibility(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasCompatibility() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasCompatibility(e)}_renderObjectDirect(e,t,n,r,s,o,a,l){let c=this._objects.get(e,t,n,r,s,this._currentRenderContext,a,l);c.drawRange=e.geometry.drawRange,c.group=o,this._currentRenderBundle!==null&&(this.backend.get(this._currentRenderBundle).renderObjects.push(c),c.bundle=this._currentRenderBundle.bundleGroup);let u=this._nodes.needsRefresh(c);u&&(this._nodes.updateBefore(c),this._geometries.updateForRender(c),this._nodes.updateForRender(c),this._bindings.updateForRender(c)),this._pipelines.updateForRender(c),this._pipelines.isReady(c)&&(this.backend.draw(c,this.info),u&&this._nodes.updateAfter(c))}_createObjectPipeline(e,t,n,r,s,o,a,l){if(this._compilationPromises!==null){this._compilationPromises.push({object:e,material:t,scene:n,camera:r,lightsNode:s,group:o,clippingContext:a,passId:l,renderContext:this._currentRenderContext});return}let c=this._objects.get(e,t,n,r,s,this._currentRenderContext,a,l);c.drawRange=e.geometry.drawRange,c.group=o,this._nodes.updateBefore(c),this._geometries.updateForRender(c),this._nodes.updateForRender(c),this._bindings.updateForRender(c),this._pipelines.getForRender(c,this._compilationPromises),this._nodes.updateAfter(c)}_onCanvasTargetResize(){this._initialized&&this.backend.updateSize()}get compile(){return this.compileAsync}},eI=class{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}getVisibility(){return this.visibility}clone(){return Object.assign(new this.constructor,this)}};function Aoe(i){return i+(fm-i%fm)%fm}var tI=class extends eI{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t,this._updateRanges=[]}get updateRanges(){return this._updateRanges}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}get byteLength(){return Aoe(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}release(){this._buffer=null}},nI=class extends tI{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}},TPe=0,iI=class extends nI{constructor(e,t){super("UniformBuffer_"+TPe++,e?e.value:null),this.nodeUniform=e,this.groupNode=t,this.isNodeUniformBuffer=!0}set updateRanges(e){this.nodeUniform.updateRanges=e}get updateRanges(){return this.nodeUniform.updateRanges}addUpdateRange(e,t){this.nodeUniform.addUpdateRange(e,t)}clearUpdateRanges(){this.nodeUniform.clearUpdateRanges()}get byteLength(){return Aoe(this.buffer.byteLength)}get buffer(){return this.nodeUniform.value}},v9=class extends nI{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[],this._updateRangeCache=new Map,this._addedIndices=new Set}addUniformUpdateRange(e){let t=e.index;if(this._addedIndices.has(t))return;let n=this._updateRangeCache.get(t);n===void 0&&(n={start:0,count:0},this._updateRangeCache.set(t,n)),n.start=e.offset,n.count=e.itemSize,this._addedIndices.add(t),this.updateRanges.push(n)}clearUpdateRanges(){this._addedIndices.clear(),super.clearUpdateRanges()}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){let t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}get values(){return this._values===null&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(e===null){let t=this.byteLength;e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){let e=this.bytesPerElement,t=0;for(let n=0,r=this.uniforms.length;n<r;n++){let s=this.uniforms[n],o=s.boundary,a=s.itemSize*e,l=t%fm,c=l%o,u=l+c;t+=c,u!==0&&fm-u<a&&(t+=fm-u),s.offset=t/e,s.index=n,t+=a}return Math.ceil(t/fm)*fm}update(){let e=!1;for(let t of this.uniforms)this.updateByType(t)===!0&&(e=!0);return e}release(){super.release(),this._values=null}updateByType(e){if(e.isNumberUniform)return this.updateNumber(e);if(e.isVector2Uniform)return this.updateVector2(e);if(e.isVector3Uniform)return this.updateVector3(e);if(e.isVector4Uniform)return this.updateVector4(e);if(e.isColorUniform)return this.updateColor(e);if(e.isMatrix3Uniform)return this.updateMatrix3(e);if(e.isMatrix4Uniform)return this.updateMatrix4(e);ze("WebGPUUniformsGroup: Unsupported uniform type.",e)}updateNumber(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s]!==r){let a=this._getBufferForType(o);a[s]=n[s]=r,t=!0,this.addUniformUpdateRange(e)}return t}updateVector2(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,t=!0,this.addUniformUpdateRange(e)}return t}updateVector3(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y||n[s+2]!==r.z){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,a[s+2]=n[s+2]=r.z,t=!0,this.addUniformUpdateRange(e)}return t}updateVector4(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y||n[s+2]!==r.z||n[s+3]!==r.w){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,a[s+2]=n[s+2]=r.z,a[s+3]=n[s+3]=r.w,t=!0,this.addUniformUpdateRange(e)}return t}updateColor(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset;if(n[s+0]!==r.r||n[s+1]!==r.g||n[s+2]!==r.b){let o=this.buffer;o[s+0]=n[s+0]=r.r,o[s+1]=n[s+1]=r.g,o[s+2]=n[s+2]=r.b,t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix3(e){let t=!1,n=this.values,r=e.getValue().elements,s=e.offset;if(n[s+0]!==r[0]||n[s+1]!==r[1]||n[s+2]!==r[2]||n[s+4]!==r[3]||n[s+5]!==r[4]||n[s+6]!==r[5]||n[s+8]!==r[6]||n[s+9]!==r[7]||n[s+10]!==r[8]){let o=this.buffer;o[s+0]=n[s+0]=r[0],o[s+1]=n[s+1]=r[1],o[s+2]=n[s+2]=r[2],o[s+4]=n[s+4]=r[3],o[s+5]=n[s+5]=r[4],o[s+6]=n[s+6]=r[5],o[s+8]=n[s+8]=r[6],o[s+9]=n[s+9]=r[7],o[s+10]=n[s+10]=r[8],t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix4(e){let t=!1,n=this.values,r=e.getValue().elements,s=e.offset;return MPe(n,r,s)===!1&&(this.buffer.set(r,s),EPe(n,r,s),t=!0,this.addUniformUpdateRange(e)),t}_getBufferForType(e){return e==="int"||e==="ivec2"||e==="ivec3"||e==="ivec4"?new Int32Array(this.buffer.buffer):e==="uint"||e==="uvec2"||e==="uvec3"||e==="uvec4"?new Uint32Array(this.buffer.buffer):this.buffer}};function EPe(i,e,t){for(let n=0,r=e.length;n<r;n++)i[t+n]=e[n]}function MPe(i,e,t){for(let n=0,r=e.length;n<r;n++)if(i[t+n]!==e[n])return!1;return!0}var CPe=0,rI=class extends v9{constructor(e,t){super(e),this.id=CPe++,this.groupNode=t,this.isNodeUniformsGroup=!0}},sI=class extends eI{constructor(e,t){super(e),this._texture=t,this.version=-1,this.generation=null,this.samplerKey="",this.isSampler=!0}set texture(e){this._texture!==e&&(this._texture=e,this.reset())}get texture(){return this._texture}update(){let{texture:e,version:t}=this;return t!==e.version?(this.version=e.version,!0):!1}reset(){this.generation=null,this.version=-1}release(){this._texture=null}},RPe=0,_9=class extends sI{constructor(e,t){super(e,t),this.id=RPe++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}},xx=class extends _9{constructor(e,t,n,r=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n,this.access=r}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}},oI=class extends xx{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledCubeTexture=!0}},LS=class extends xx{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledTexture3D=!0}},zte={bitcast_int_uint:new hr("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new hr("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }"),textureGather:new hr(`4169+Reason: ${e.reason}`),ze(t),this._isDeviceLost=!0}_onError(e){let t=`WebGPURenderer: Uncaptured ${e.api} ${e.type}`;e.message&&(t+=`: ${e.message}`),ze(t)}_bundleNeedsUpdate(e,t){return t.bundleGPU===void 0||e.version!==t.version}_renderBundle(e,t,n){let{bundleGroup:r,camera:s,renderList:o}=e,a=this._currentRenderContext,l=this._bundles.get(r,s,a),c=this.backend.get(l);if(this._bundleNeedsUpdate(r,c)){this.backend.beginBundle(a),this._currentRenderBundle=l;let{transparentDoublePass:f,transparent:d,opaque:A}=o;this.opaque===!0&&A.length>0&&this._renderObjects(A,s,t,n),this.transparent===!0&&d.length>0&&this._renderTransparents(d,f,s,t,n),this._currentRenderBundle=null,this.backend.finishBundle(a,l),c.version=r.version}else{let{renderObjects:f}=c;for(let d=0,A=f.length;d<A;d++){let y=f[d];this._nodes.needsRefresh(y)&&(this._nodes.updateBefore(y),this._geometries.updateForRender(y),this._nodes.updateForRender(y),this._bindings.updateForRender(y),this._nodes.updateAfter(y))}}this.backend.addBundle(a,l)}render(e,t){if(this._initialized===!1)throw new Error('THREE.Renderer: .render() called before the backend is initialized. Use "await renderer.init();" before rendering.');this._renderScene(e,t)}get initialized(){return this._initialized}_renderOutputLayers(e,t){if(t.texture.isArrayTexture!==!0||t.texture.image.depth<=1){this._renderScene(e,e.camera,!1);return}let n=this._activeCubeFace;try{for(let r=0;r<t.texture.image.depth;r++)this._nodes.setOutputLayerIndex(r),this._activeCubeFace=r,this._renderScene(e,e.camera,!1)}finally{this._nodes.setOutputLayerIndex(0),this._activeCubeFace=n}}_getFrameBufferTarget(){let{currentToneMapping:e,currentColorSpace:t}=this,n=e!==ao,r=t!==ln.workingColorSpace;if(n===!1&&r===!1)return null;let{width:s,height:o}=this.getDrawingBufferSize(W_),{depth:a,stencil:l}=this,c=this._outputRenderTarget||this._canvasTarget,u=this._frameBufferTargets.get(c);if(u===void 0){u=new Ba(s,o,{depthBuffer:a,stencilBuffer:l,type:this._outputBufferType,format:Or,colorSpace:ln.workingColorSpace,generateMipmaps:!1,minFilter:Mi,magFilter:Mi,samples:this.samples}),u.isPostProcessingRenderTarget=!0;let S=()=>{c.removeEventListener("dispose",S),u.dispose(),this._frameBufferTargets.delete(c)};c.addEventListener("dispose",S),this._frameBufferTargets.set(c,u)}let f=this.getOutputRenderTarget();u.depthBuffer=a,u.stencilBuffer=l,f!==null?u.setSize(f.width,f.height,f.depth):u.setSize(s,o,1);let d=this._outputRenderTarget?this._outputRenderTarget.viewport:c._viewport,A=this._outputRenderTarget?this._outputRenderTarget.scissor:c._scissor,y=this._outputRenderTarget?1:c._pixelRatio,w=this._outputRenderTarget?this._outputRenderTarget.scissorTest:c._scissorTest;return u.viewport.copy(d),u.scissor.copy(A),u.viewport.multiplyScalar(y),u.scissor.multiplyScalar(y),u.scissorTest=w,u.multiview=f!==null?f.multiview:!1,u.useArrayDepthTexture=f!==null?f.useArrayDepthTexture:!1,u.resolveDepthBuffer=f!==null?f.resolveDepthBuffer:!0,u._autoAllocateDepthBuffer=f!==null?f._autoAllocateDepthBuffer:!1,u}_renderScene(e,t,n=!0){if(this._isDeviceLost===!0)return;let r=n?this._getFrameBufferTarget():null,s=this._nodes.nodeFrame,o=s.renderId,a=this._currentRenderContext,l=this._currentRenderObjectFunction,c=this._handleObjectFunction;this.lighting.beginRender(e),this._callDepth++;let u=e.isScene===!0?e:Fte,f=this._renderTarget||this._outputRenderTarget,d=this._activeCubeFace,A=this._activeMipmapLevel,y;if(r!==null?(y=r,this.setRenderTarget(y)):y=f,y!==null&&y.depthBuffer===!0){let W=this._textures.get(y);W.depthInitialized!==!0&&((this.autoClear===!1||this.autoClear===!0&&this.autoClearDepth===!1)&&this.clearDepth(),W.depthInitialized=!0)}let w=this._renderContexts.get(y,this._mrt,this._callDepth);this._currentRenderContext=w,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this._handleObjectFunction=this._renderObjectDirect,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,s.renderId=this.info.calls,this.backend.updateTimeStampUID(w),this.inspector.beginRender(this.backend.getTimestampUID(w),e,t,y),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t);let S=this._canvasTarget,T=S._viewport,R=S._scissor,I=S._pixelRatio;y!==null&&(T=y.viewport,R=y.scissor,I=1),this.getDrawingBufferSize(W_),cU.set(0,0,W_.width,W_.height);let P=T.minDepth===void 0?0:T.minDepth,F=T.maxDepth===void 0?1:T.maxDepth;w.viewportValue.copy(T).multiplyScalar(I).floor(),w.viewportValue.width>>=A,w.viewportValue.height>>=A,w.viewportValue.minDepth=P,w.viewportValue.maxDepth=F,w.viewport=w.viewportValue.equals(cU)===!1,w.scissorValue.copy(R).multiplyScalar(I).floor(),w.scissor=S._scissorTest&&w.scissorValue.equals(cU)===!1,w.scissorValue.width>>=A,w.scissorValue.height>>=A,w.clippingContext||(w.clippingContext=new X4),w.clippingContext.updateGlobal(u,t),u.onBeforeRender(this,e,t,y);let D=t.isArrayCamera?BR:FR;t.isArrayCamera?D.setFromArrayCamera(t):(j_.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),D.setFromProjectionMatrix(j_,t.coordinateSystem,t.reversedDepth));let L=this._renderLists.get(e,t);if(L.begin(),this._projectObject(e,t,0,L,w.clippingContext),L.finish(),this.sortObjects===!0&&L.sort(this._opaqueSort,this._transparentSort,t.reversedDepth),y!==null){this._textures.updateRenderTarget(y,A);let W=this._textures.get(y);w.textures=W.textures,w.depthTexture=W.depthTexture,w.width=W.width,w.height=W.height,w.renderTarget=y,w.depth=y.depthBuffer,w.stencil=y.stencilBuffer}else w.textures=null,w.depthTexture=null,w.width=W_.width,w.height=W_.height,w.depth=this.depth,w.stencil=this.stencil;w.width>>=A,w.height>>=A,w.activeCubeFace=d,w.activeMipmapLevel=A,w.occlusionQueryCount=L.occlusionQueryCount,w.scissorValue.max(qd.set(0,0,0,0)),w.scissorValue.x+w.scissorValue.width>w.width&&(w.scissorValue.width=Math.max(w.width-w.scissorValue.x,0)),w.scissorValue.y+w.scissorValue.height>w.height&&(w.scissorValue.height=Math.max(w.height-w.scissorValue.y,0)),this._background.update(u,L,w),w.camera=t,this.backend.beginRender(w);let{bundles:C,lightsNode:B,transparentDoublePass:k,transparent:z,opaque:G}=L;return C.length>0&&this._renderBundles(C,u,B),this.opaque===!0&&G.length>0&&this._renderObjects(G,t,u,B),this.transparent===!0&&z.length>0&&this._renderTransparents(z,k,t,u,B),this.backend.finishRender(w),s.renderId=o,this._currentRenderContext=a,this._currentRenderObjectFunction=l,this._handleObjectFunction=c,this.lighting.finishRender(e),this._callDepth--,r!==null&&(this.setRenderTarget(f,d,A),this._renderOutput(y)),u.onAfterRender(this,e,t,y),this.inspector.finishRender(this.backend.getTimestampUID(w)),w}_setXRLayerSize(e,t){this._canvasTarget._width=e,this._canvasTarget._height=t,this.setViewport(0,0,e,t)}_renderOutput(e){let t=this._nodes.getOutputCacheKey(),n=this._quadCache.get(e.texture),r;if(n===void 0){r=new wS(new Pr),r.name="Output Color Transform",r.material.name="outputColorTransform",r.material.fragmentNode=this._nodes.getOutputNode(e.texture),n={quad:r,cacheKey:t},this._quadCache.set(e.texture,n);let a=()=>{r.material.dispose(),this._quadCache.delete(e.texture),e.texture.removeEventListener("dispose",a)};e.texture.addEventListener("dispose",a)}else r=n.quad,n.cacheKey!==t&&(r.material.fragmentNode=this._nodes.getOutputNode(e.texture),r.material.needsUpdate=!0,n.cacheKey=t);let s=this.autoClear,o=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderOutputLayers(r,e),this.autoClear=s,this.xr.enabled=o}getMaxAnisotropy(){return this.backend.capabilities.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){this._initialized===!1&&await this.init(),this._animation.setAnimationLoop(e)}getAnimationLoop(){return this._animation.getAnimationLoop()}async getArrayBufferAsync(e,t=null,n=0,r=-1){if(t!==null&&t.isReadbackBuffer&&this.info.memoryMap.has(t)===!1){this.info.createReadbackBuffer(t);let s=()=>{t.removeEventListener("dispose",s),this.info.destroyReadbackBuffer(t)};t.addEventListener("dispose",s)}if(n%4!==0||r>0&&r%4!==0)throw new Error('THREE.Renderer: "getArrayBufferAsync()" offset and count must be a multiple of 4.');return await this.backend.getArrayBufferAsync(e,t,n,r)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._canvasTarget.getPixelRatio()}getDrawingBufferSize(e){return this._canvasTarget.getDrawingBufferSize(e)}getSize(e){return this._canvasTarget.getSize(e)}setPixelRatio(e=1){this._canvasTarget.setPixelRatio(e)}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||this._canvasTarget.setDrawingBufferSize(e,t,n)}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||this._canvasTarget.setSize(e,t,n)}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){return this._canvasTarget.getScissor(e)}setScissor(e,t,n,r){this._canvasTarget.setScissor(e,t,n,r)}getScissorTest(){return this._canvasTarget.getScissorTest()}setScissorTest(e){this._canvasTarget.setScissorTest(e),this.backend.setScissorTest(e)}getViewport(e){return this._canvasTarget.getViewport(e)}setViewport(e,t,n,r,s=0,o=1){this._canvasTarget.setViewport(e,t,n,r,s,o)}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return this.reversedDepthBuffer===!0?1-this._clearDepth:this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){let t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,n=!0){if(this._initialized===!1)throw new Error('THREE.Renderer: .clear() called before the backend is initialized. Use "await renderer.init();" before using this method.');let r=this._renderTarget||this._getFrameBufferTarget(),s=null;if(r!==null){this._textures.updateRenderTarget(r);let o=this._textures.get(r);s=this._renderContexts.get(r,null,-1),s.textures=o.textures,s.depthTexture=o.depthTexture,s.width=o.width,s.height=o.height,s.renderTarget=r,s.depth=r.depthBuffer,s.stencil=r.stencilBuffer;let a=this.backend.getClearColor();s.clearColorValue.r=a.r,s.clearColorValue.g=a.g,s.clearColorValue.b=a.b,s.clearColorValue.a=a.a,s.clearDepthValue=this.getClearDepth(),s.clearStencilValue=this.getClearStencil(),s.activeCubeFace=this.getActiveCubeFace(),s.activeMipmapLevel=this.getActiveMipmapLevel(),r.depthBuffer===!0&&(o.depthInitialized=!0)}this.backend.clear(e,t,n,s),r!==null&&this._renderTarget===null&&this._renderOutput(r)}clearColor(){this.clear(!0,!1,!1)}clearDepth(){this.clear(!1,!0,!1)}clearStencil(){this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,n=!0){ni('Renderer: "clearAsync()" has been deprecated. Use "clear()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.clear(e,t,n)}async clearColorAsync(){ni('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){ni('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){ni('Renderer: "clearStencilAsync()" has been deprecated. Use "clearStencil()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!1,!0)}get needsFrameBufferTarget(){let e=this.currentToneMapping!==ao,t=this.currentColorSpace!==ln.workingColorSpace;return e||t}get samples(){return this._samples}get currentSamples(){let e=this._samples;return this._renderTarget!==null?e=this._renderTarget.samples:this.needsFrameBufferTarget&&(e=0),e}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:ao}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:ln.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||this._renderTarget===null}dispose(){if(this._initialized===!0){this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._geometries.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose();for(let e of this._frameBufferTargets.keys())e.dispose();Object.values(this.backend.timestampQueryPool).forEach(e=>{e!==null&&e.dispose()})}this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,n=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=n}getRenderTarget(){return this._renderTarget}setOutputRenderTarget(e){this._outputRenderTarget=e}getOutputRenderTarget(){return this._outputRenderTarget}setCanvasTarget(e){this._canvasTarget.removeEventListener("resize",this._onCanvasTargetResize),this._canvasTarget=e,this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize)}getCanvasTarget(){return this._canvasTarget}_resetXRState(){this.backend.setXRTarget(null),this.setOutputRenderTarget(null),this.setRenderTarget(null);for(let e of this._frameBufferTargets.keys())e.dispose()}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e,t=null){if(this._isDeviceLost===!0)return;if(this._initialized===!1)return Xe("Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e,t);let n=this._nodes.nodeFrame,r=n.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,n.renderId=this.info.calls,this.backend.updateTimeStampUID(e),this.inspector.beginCompute(this.backend.getTimestampUID(e),e);let s=this.backend,o=this._pipelines,a=this._bindings,l=this._nodes,c=Array.isArray(e)?e:[e];if(c[0]===void 0||c[0].isComputeNode!==!0)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");s.beginCompute(e);for(let u of c){if(o.has(u)===!1){let A=()=>{u.removeEventListener("dispose",A),o.delete(u),a.deleteForCompute(u),l.delete(u)};u.addEventListener("dispose",A);let y=u.onInitFunction;y!==null&&y.call(u,{renderer:this})}l.updateForCompute(u),a.updateForCompute(u);let f=a.getForCompute(u),d=o.getForCompute(u,f);s.compute(e,u,f,d,t)}s.finishCompute(e),n.renderId=r,this.inspector.finishCompute(this.backend.getTimestampUID(e))}async computeAsync(e,t=null){this._initialized===!1&&await this.init(),this.compute(e,t)}async hasFeatureAsync(e){return ni('Renderer: "hasFeatureAsync()" has been deprecated. Use "hasFeature()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.hasFeature(e)}async resolveTimestampsAsync(e="render"){return this._initialized===!1&&await this.init(),this.backend.resolveTimestampsAsync(e)}hasFeature(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasFeature() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){ni('Renderer: "initTextureAsync()" has been deprecated. Use "initTexture()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.initTexture(e)}initTexture(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initTexture() called before the backend is initialized. Use "await renderer.init();" before using this method.');this._textures.updateTexture(e)}initRenderTarget(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initRenderTarget() called before the backend is initialized. Use "await renderer.init();" before using this method.');this._textures.updateRenderTarget(e);let t=this._textures.get(e),n=this._renderContexts.get(e);n.textures=t.textures,n.depthTexture=t.depthTexture,n.width=t.width,n.height=t.height,n.renderTarget=e,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,this.backend.initRenderTarget(n)}copyFramebufferToTexture(e,t=null){if(t!==null)if(t.isVector2)t=qd.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=qd.copy(t).floor();else{ze("Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=qd.set(0,0,e.image.width,e.image.height);let n=this._currentRenderContext,r;n!==null?r=n.renderTarget:(r=this._renderTarget||this._getFrameBufferTarget(),r!==null&&(this._textures.updateRenderTarget(r),n=this._textures.get(r))),this._textures.updateTexture(e,{renderTarget:r}),this.backend.copyFramebufferToTexture(e,n,t),this._inspector.copyFramebufferToTexture(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,n,r,s,o),this._inspector.copyTextureToTexture(e,t)}async readRenderTargetPixelsAsync(e,t,n,r,s,o=0,a=0){return this.backend.copyTextureToBuffer(e.textures[o],t,n,r,s,a)}_projectObject(e,t,n,r,s){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder,e.isClippingGroup&&e.enabled&&(s=s.getGroupContext(e));else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)r.pushLight(e);else if(e.isSprite){let l=t.isArrayCamera?BR:FR;if(!e.frustumCulled||l.intersectsSprite(e)){this.sortObjects===!0&&qd.setFromMatrixPosition(e.matrixWorld).applyMatrix4(j_);let{geometry:c,material:u}=e;u.visible&&r.push(e,c,u,n,qd.z,null,s)}}else if(e.isLineLoop)ze("Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if(e.isMesh||e.isLine||e.isPoints){let l=t.isArrayCamera?BR:FR;if(!e.frustumCulled||l.intersectsObject(e)){let{geometry:c,material:u}=e;if(this.sortObjects===!0&&(c.boundingSphere===null&&c.computeBoundingSphere(),qd.copy(c.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(j_)),Array.isArray(u)){let f=c.groups;for(let d=0,A=f.length;d<A;d++){let y=f[d],w=u[y.materialIndex];w&&w.visible&&r.push(e,c,w,n,qd.z,y,s)}}else u.visible&&r.push(e,c,u,n,qd.z,null,s)}}}if(e.isBundleGroup===!0&&this.backend.beginBundle!==void 0){let l=r;r=this._renderLists.get(e,t);let c=this._bundles.get(e,t,this._currentRenderContext),u=this.backend.get(c);if(this._bundleNeedsUpdate(e,u)){r.begin(),u.renderObjects===void 0?u.renderObjects=[]:u.renderObjects.length=0;let d=e.children;for(let A=0,y=d.length;A<y;A++)this._projectObject(d[A],t,n,r,s);r.finish()}l.pushBundle({bundleGroup:e,camera:t,renderList:r});return}let a=e.children;for(let l=0,c=a.length;l<c;l++)this._projectObject(a[l],t,n,r,s)}_renderBundles(e,t,n){for(let r of e)this._renderBundle(r,t,n)}_renderTransparents(e,t,n,r,s){if(t.length>0){for(let{material:o}of t)o.side=mi;this._renderObjects(t,n,r,s,"backSide");for(let{material:o}of t)o.side=zo;this._renderObjects(e,n,r,s);for(let{material:o}of t)o.side=vr}else this._renderObjects(e,n,r,s)}_renderObjects(e,t,n,r,s=null){for(let o=0,a=e.length;o<a;o++){let{object:l,geometry:c,material:u,group:f,clippingContext:d}=e[o];this._currentRenderObjectFunction(l,n,t,c,u,f,r,d,s)}}_getShadowNodes(e){let t=e.version,n=this._cacheShadowNodes.get(e);if(n===void 0||n.version!==t){let r=e.map&&e.map.isTexture,s=e.colorNode&&e.colorNode.isNode,o=e.castShadowNode&&e.castShadowNode.isNode,a=e.maskShadowNode&&e.maskShadowNode.isNode||e.maskNode&&e.maskNode.isNode,l=null,c=null,u=null;if(r||s||o||a){let f,d;if(o?(f=e.castShadowNode.rgb,d=e.castShadowNode.a,this.shadowMap.transmitted!==!0&&ni("Renderer: `shadowMap.transmitted` needs to be set to `true` when using `material.castShadowNode`.")):(f=pe(0),d=oe(1)),r&&(d=d.mul(mr("map","texture",e).a)),s&&(d=d.mul(e.colorNode.a)),c=Ft(f,d),a){let A=e.maskShadowNode||e.maskNode;c=me(([y])=>(A.not().discard(),y))(c)}}e.depthNode&&e.depthNode.isNode&&(u=e.depthNode),e.castShadowPositionNode&&e.castShadowPositionNode.isNode?l=e.castShadowPositionNode:e.positionNode&&e.positionNode.isNode&&(l=e.positionNode),n={version:t,colorNode:c,depthNode:u,positionNode:l},this._cacheShadowNodes.set(e,n)}return n}_updateCamera(e){let t=this.xr;if(t.isPresenting===!1){let n=!1;if(this.reversedDepthBuffer===!0&&e.reversedDepth!==!0){if(e._reversedDepth=!0,e.isArrayCamera)for(let s of e.cameras)s._reversedDepth=!0;n=!0}let r=this.coordinateSystem;if(e.coordinateSystem!==r){if(e.coordinateSystem=r,e.isArrayCamera)for(let s of e.cameras)s.coordinateSystem=r;n=!0}if(n===!0&&(e.updateProjectionMatrix(),e.isArrayCamera))for(let s of e.cameras)s.updateProjectionMatrix()}return e.parent===null&&e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.enabled===!0&&t.isPresenting===!0&&(t.cameraAutoUpdate===!0&&t.updateCamera(e),e=t.getCamera()),e}renderObject(e,t,n,r,s,o,a,l=null,c=null){let u=!1,f,d,A,y,w,S,T,R=this._currentSourceMaterial;if(e.onBeforeRender(this,t,n,r,s,o),s.allowOverride===!0&&t.overrideMaterial!==null){this._currentSourceMaterial=s;let I=t.overrideMaterial;if(u=!0,f=I.isNodeMaterial?I.colorNode:null,d=I.isNodeMaterial?I.depthNode:null,A=I.isNodeMaterial?I.positionNode:null,y=t.overrideMaterial.side,w=I.displacementMap,S=I.displacementScale,T=I.displacementBias,s.positionNode&&s.positionNode.isNode&&(I.positionNode=s.positionNode),I.alphaTest=s.alphaTest,I.alphaMap=s.alphaMap,I.displacementMap=s.displacementMap,I.displacementScale=s.displacementScale,I.displacementBias=s.displacementBias,I.transparent=s.transparent||s.transmission>0||s.transmissionNode&&s.transmissionNode.isNode||s.backdropNode&&s.backdropNode.isNode,I.isShadowPassMaterial){let{colorNode:P,depthNode:F,positionNode:D}=this._getShadowNodes(s);this.shadowMap.type===Vc?I.side=s.shadowSide!==null?s.shadowSide:s.side:I.side=s.shadowSide!==null?s.shadowSide:yIe[s.side],P!==null&&(I.colorNode=P),F!==null&&(I.depthNode=F),D!==null&&(I.positionNode=D)}s=I}s.transparent===!0&&s.side===vr&&s.forceSinglePass===!1?(s.side=mi,this._handleObjectFunction(e,s,t,n,a,o,l,"backSide"),s.side=zo,this._handleObjectFunction(e,s,t,n,a,o,l,c),s.side=vr):this._handleObjectFunction(e,s,t,n,a,o,l,c),u&&(t.overrideMaterial.colorNode=f,t.overrideMaterial.depthNode=d,t.overrideMaterial.positionNode=A,t.overrideMaterial.side=y,t.overrideMaterial.displacementMap=w,t.overrideMaterial.displacementScale=S,t.overrideMaterial.displacementBias=T),this._currentSourceMaterial=R,e.onAfterRender(this,t,n,r,s,o)}hasCompatibility(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasCompatibility() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasCompatibility(e)}_renderObjectDirect(e,t,n,r,s,o,a,l){let c=this._objects.get(e,t,n,r,s,this._currentRenderContext,a,l);c.drawRange=e.geometry.drawRange,c.group=o,this._currentRenderBundle!==null&&(this.backend.get(this._currentRenderBundle).renderObjects.push(c),c.bundle=this._currentRenderBundle.bundleGroup);let u=this._nodes.needsRefresh(c);u&&(this._nodes.updateBefore(c),this._geometries.updateForRender(c),this._nodes.updateForRender(c),this._bindings.updateForRender(c)),this._pipelines.updateForRender(c),this._pipelines.isReady(c)&&(this.backend.draw(c,this.info),u&&this._nodes.updateAfter(c))}_createObjectPipeline(e,t,n,r,s,o,a,l){if(this._compilationPromises!==null){this._compilationPromises.push({object:e,material:t,scene:n,camera:r,lightsNode:s,group:o,clippingContext:a,passId:l,renderContext:this._currentRenderContext});return}let c=this._objects.get(e,t,n,r,s,this._currentRenderContext,a,l);c.drawRange=e.geometry.drawRange,c.group=o,this._nodes.updateBefore(c),this._geometries.updateForRender(c),this._nodes.updateForRender(c),this._bindings.updateForRender(c),this._pipelines.getForRender(c,this._compilationPromises),this._nodes.updateAfter(c)}_onCanvasTargetResize(){this._initialized&&this.backend.updateSize()}get compile(){return this.compileAsync}},Y4=class{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}getVisibility(){return this.visibility}clone(){return Object.assign(new this.constructor,this)}};function foe(i){return i+(hm-i%hm)%hm}var Z4=class extends Y4{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t,this._updateRanges=[]}get updateRanges(){return this._updateRanges}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}get byteLength(){return foe(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}release(){this._buffer=null}},K4=class extends Z4{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}},bIe=0,Q4=class extends K4{constructor(e,t){super("UniformBuffer_"+bIe++,e?e.value:null),this.nodeUniform=e,this.groupNode=t,this.isNodeUniformBuffer=!0}set updateRanges(e){this.nodeUniform.updateRanges=e}get updateRanges(){return this.nodeUniform.updateRanges}addUpdateRange(e,t){this.nodeUniform.addUpdateRange(e,t)}clearUpdateRanges(){this.nodeUniform.clearUpdateRanges()}get byteLength(){return foe(this.buffer.byteLength)}get buffer(){return this.nodeUniform.value}},v9=class extends K4{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[],this._updateRangeCache=new Map,this._addedIndices=new Set}addUniformUpdateRange(e){let t=e.index;if(this._addedIndices.has(t))return;let n=this._updateRangeCache.get(t);n===void 0&&(n={start:0,count:0},this._updateRangeCache.set(t,n)),n.start=e.offset,n.count=e.itemSize,this._addedIndices.add(t),this.updateRanges.push(n)}clearUpdateRanges(){this._addedIndices.clear(),super.clearUpdateRanges()}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){let t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}get values(){return this._values===null&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(e===null){let t=this.byteLength;e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){let e=this.bytesPerElement,t=0;for(let n=0,r=this.uniforms.length;n<r;n++){let s=this.uniforms[n],o=s.boundary,a=s.itemSize*e,l=t%hm,c=l%o,u=l+c;t+=c,u!==0&&hm-u<a&&(t+=hm-u),s.offset=t/e,s.index=n,t+=a}return Math.ceil(t/hm)*hm}update(){let e=!1;for(let t of this.uniforms)this.updateByType(t)===!0&&(e=!0);return e}release(){super.release(),this._values=null}updateByType(e){if(e.isNumberUniform)return this.updateNumber(e);if(e.isVector2Uniform)return this.updateVector2(e);if(e.isVector3Uniform)return this.updateVector3(e);if(e.isVector4Uniform)return this.updateVector4(e);if(e.isColorUniform)return this.updateColor(e);if(e.isMatrix3Uniform)return this.updateMatrix3(e);if(e.isMatrix4Uniform)return this.updateMatrix4(e);ze("WebGPUUniformsGroup: Unsupported uniform type.",e)}updateNumber(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s]!==r){let a=this._getBufferForType(o);a[s]=n[s]=r,t=!0,this.addUniformUpdateRange(e)}return t}updateVector2(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,t=!0,this.addUniformUpdateRange(e)}return t}updateVector3(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y||n[s+2]!==r.z){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,a[s+2]=n[s+2]=r.z,t=!0,this.addUniformUpdateRange(e)}return t}updateVector4(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y||n[s+2]!==r.z||n[s+3]!==r.w){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,a[s+2]=n[s+2]=r.z,a[s+3]=n[s+3]=r.w,t=!0,this.addUniformUpdateRange(e)}return t}updateColor(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset;if(n[s+0]!==r.r||n[s+1]!==r.g||n[s+2]!==r.b){let o=this.buffer;o[s+0]=n[s+0]=r.r,o[s+1]=n[s+1]=r.g,o[s+2]=n[s+2]=r.b,t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix3(e){let t=!1,n=this.values,r=e.getValue().elements,s=e.offset;if(n[s+0]!==r[0]||n[s+1]!==r[1]||n[s+2]!==r[2]||n[s+4]!==r[3]||n[s+5]!==r[4]||n[s+6]!==r[5]||n[s+8]!==r[6]||n[s+9]!==r[7]||n[s+10]!==r[8]){let o=this.buffer;o[s+0]=n[s+0]=r[0],o[s+1]=n[s+1]=r[1],o[s+2]=n[s+2]=r[2],o[s+4]=n[s+4]=r[3],o[s+5]=n[s+5]=r[4],o[s+6]=n[s+6]=r[5],o[s+8]=n[s+8]=r[6],o[s+9]=n[s+9]=r[7],o[s+10]=n[s+10]=r[8],t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix4(e){let t=!1,n=this.values,r=e.getValue().elements,s=e.offset;return SIe(n,r,s)===!1&&(this.buffer.set(r,s),wIe(n,r,s),t=!0,this.addUniformUpdateRange(e)),t}_getBufferForType(e){return e==="int"||e==="ivec2"||e==="ivec3"||e==="ivec4"?new Int32Array(this.buffer.buffer):e==="uint"||e==="uvec2"||e==="uvec3"||e==="uvec4"?new Uint32Array(this.buffer.buffer):this.buffer}};function wIe(i,e,t){for(let n=0,r=e.length;n<r;n++)i[t+n]=e[n]}function SIe(i,e,t){for(let n=0,r=e.length;n<r;n++)if(i[t+n]!==e[n])return!1;return!0}var TIe=0,J4=class extends v9{constructor(e,t){super(e),this.id=TIe++,this.groupNode=t,this.isNodeUniformsGroup=!0}},eP=class extends Y4{constructor(e,t){super(e),this._texture=t,this.version=-1,this.generation=null,this.samplerKey="",this.isSampler=!0}set texture(e){this._texture!==e&&(this._texture=e,this.reset())}get texture(){return this._texture}update(){let{texture:e,version:t}=this;return t!==e.version?(this.version=e.version,!0):!1}reset(){this.generation=null,this.version=-1}release(){this._texture=null}},EIe=0,_9=class extends eP{constructor(e,t){super(e,t),this.id=EIe++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}},vx=class extends _9{constructor(e,t,n,r=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n,this.access=r}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}},tP=class extends vx{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledCubeTexture=!0}},RS=class extends vx{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledTexture3D=!0}},Bte={bitcast_int_uint:new hr("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new hr("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }"),textureGather:new hr(`41704170 vec4 tsl_textureGather( const int comp, sampler2D map, vec2 coord, ivec2 offset, bool flipY ) {41714171 if ( flipY ) offset.y = - offset.y;41724172 vec2 size = vec2( textureSize( map, 0 ) );
@@ -4222,7 +4222,7 @@ vec4 tsl_textureGatherCompare_array( sampler2DArrayShadow map, vec3 coord, ivec2
42224222 );42234223 return flipY ? ret.wzyx : ret;42244224 }4225-`)},IPe={textureDimensions:"textureSize",equals:"equal",bitcast_float_int:"floatBitsToInt",bitcast_int_float:"intBitsToFloat",bitcast_uint_float:"uintBitsToFloat",bitcast_float_uint:"floatBitsToUint",bitcast_uint_int:"tsl_bitcast_uint_to_int",bitcast_int_uint:"tsl_bitcast_int_to_uint",floatpack_snorm_2x16:"packSnorm2x16",floatpack_unorm_2x16:"packUnorm2x16",floatpack_float16_2x16:"packHalf2x16",floatunpack_snorm_2x16:"unpackSnorm2x16",floatunpack_unorm_2x16:"unpackUnorm2x16",floatunpack_float16_2x16:"unpackHalf2x16"},Vte={low:"lowp",medium:"mediump",high:"highp"},Gte={swizzleAssign:!0,storageBuffer:!1},qte={perspective:"smooth",linear:"noperspective"},Hte={centroid:"centroid"},Wte=`4225+`)},MIe={textureDimensions:"textureSize",equals:"equal",bitcast_float_int:"floatBitsToInt",bitcast_int_float:"intBitsToFloat",bitcast_uint_float:"uintBitsToFloat",bitcast_float_uint:"floatBitsToUint",bitcast_uint_int:"tsl_bitcast_uint_to_int",bitcast_int_uint:"tsl_bitcast_int_to_uint",floatpack_snorm_2x16:"packSnorm2x16",floatpack_unorm_2x16:"packUnorm2x16",floatpack_float16_2x16:"packHalf2x16",floatunpack_snorm_2x16:"unpackSnorm2x16",floatunpack_unorm_2x16:"unpackUnorm2x16",floatunpack_float16_2x16:"unpackHalf2x16"},Ote={low:"lowp",medium:"mediump",high:"highp"},Ute={swizzleAssign:!0,storageBuffer:!1},kte={perspective:"smooth",linear:"noperspective"},zte={centroid:"centroid"},Vte=`42264226 precision highp float;42274227 precision highp int;42284228 precision highp sampler2D;
@@ -4243,17 +4243,17 @@ precision highp isampler2DArray;
42434243 precision highp sampler2DShadow;42444244 precision highp sampler2DArrayShadow;42454245 precision highp samplerCubeShadow;4246-`,x9=class extends Y4{constructor(e,t){super(e,t,new u9),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==ha}_include(e){let t=zte[e];return t.build(this),this.addInclude(t),t}getMethod(e){return zte[e]!==void 0&&this._include(e),IPe[e]||e}getBitcastMethod(e,t){return this.getMethod(`bitcast_${t}_${e}`)}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,n){return`${e} ? ${t} : ${n}`}getOutputStructName(){return""}buildFunctionCode(e){let t=e.layout,n=this.flowShaderNode(e),r=[];for(let o of t.inputs)r.push(this.getType(o.type)+" "+o.name);return`${this.getType(t.type)} ${t.name}( ${r.join(", ")} ) {4246+`,x9=class extends H4{constructor(e,t){super(e,t,new u9),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==ha}_include(e){let t=Bte[e];return t.build(this),this.addInclude(t),t}getMethod(e){return Bte[e]!==void 0&&this._include(e),MIe[e]||e}getBitcastMethod(e,t){return this.getMethod(`bitcast_${t}_${e}`)}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,n){return`${e} ? ${t} : ${n}`}getOutputStructName(){return""}buildFunctionCode(e){let t=e.layout,n=this.flowShaderNode(e),r=[];for(let o of t.inputs)r.push(this.getType(o.type)+" "+o.name);return`${this.getType(t.type)} ${t.name}( ${r.join(", ")} ) {42474247 42484248 ${n.vars}42494249 42504250 ${n.code}42514251 return ${n.result};42524252 4253-}`}setupPBO(e){let t=e.value;if(t.pbo===void 0){let n=t.array,r=t.count*t.itemSize,{itemSize:s}=t,o=t.array.constructor.name.toLowerCase().includes("int"),a=o?qh:Ud;s===2?a=o?Hh:js:s===3?a=o?Nb:Od:s===4&&(a=o?v0:Ur);let l={Float32Array:cr,Uint8Array:Ji,Uint16Array:Sl,Uint32Array:xi,Int8Array:Vh,Int16Array:Gh,Int32Array:Kr,Uint8ClampedArray:Ji},c=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(r/s)))),u=Math.ceil(r/s/c);c*u*s<r&&u++;let f=c*u*s,d=new n.constructor(f);d.set(n,0),t.array=d;let A=new WA(t.array,c,u,a,l[t.array.constructor.name]||cr);A.needsUpdate=!0,A.isPBOTexture=!0;let y=new cu(A,null,null);y.setPrecision("high"),t.pboNode=y,t.pbo=y.value,this.getUniformFromNode(t.pboNode,"texture",this.shaderStage,this.context.nodeName)}}getPropertyName(e,t=this.shaderStage){return e.isNodeUniform&&e.node.isTextureNode!==!0&&e.node.isBufferNode!==!0?e.name:super.getPropertyName(e,t)}generatePBO(e){let{node:t,indexNode:n}=e,r=t.value;if(this.renderer.backend.has(r)){let u=this.renderer.backend.get(r);u.pbo=r.pbo}let s=this.getUniformFromNode(r.pboNode,"texture",this.shaderStage,this.context.nodeName),o=this.getPropertyName(s);this.increaseUsage(n);let a=n.build(this,"uint"),l=this.getDataFromNode(e),c=l.propertyName;if(c===void 0){let u=this.getVarFromNode(e);c=this.getPropertyName(u);let f=this.getDataFromNode(t),d=f.propertySizeName;d===void 0&&(d=c+"Size",this.getVarFromNode(t,d,"uint"),this.addLineFlowCode(`${d} = uint( textureSize( ${o}, 0 ).x )`,e),f.propertySizeName=d);let{itemSize:A}=r,y="."+l1.join("").slice(0,A),w=`ivec2(${a} % ${d}, ${a} / ${d})`,S=this.generateTextureLoad(null,o,w,"0",null,null),T="vec4";r.pbo.type===xi?T="uvec4":r.pbo.type===Kr&&(T="ivec4"),this.addLineFlowCode(`${c} = ${T}(${S})${y}`,e),l.propertyName=c}return c}generateTextureLoad(e,t,n,r,s,o){r===null&&(r="0");let a;return s?o?a=`texelFetchOffset( ${t}, ivec3( ${n}, ${s} ), int( ${r} ), ${o} )`:a=`texelFetch( ${t}, ivec3( ${n}, ${s} ), int( ${r} ) )`:o?a=`texelFetchOffset( ${t}, ${n}, int( ${r} ), ${o} )`:a=`texelFetch( ${t}, ${n}, int( ${r} ) )`,e!==null&&e.isDepthTexture&&(a+=".x"),a}generateTexture(e,t,n,r,s){return r&&(n=`vec3( ${n}, ${r} )`),e.isDepthTexture?s?`textureOffset( ${t}, ${n}, ${s} ).x`:`texture( ${t}, ${n} ).x`:s?`textureOffset( ${t}, ${n}, ${s} )`:`texture( ${t}, ${n} )`}generateTextureLevel(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureLodOffset( ${t}, ${n}, ${r}, ${o} )`:`textureLod( ${t}, ${n}, ${r} )`}generateTextureBias(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureOffset( ${t}, ${n}, ${o}, ${r} )`:`texture( ${t}, ${n}, ${r} )`}generateTextureGrad(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureGradOffset( ${t}, ${n}, ${r[0]}, ${r[1]}, ${o} )`:`textureGrad( ${t}, ${n}, ${r[0]}, ${r[1]} )`}generateTextureCompare(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return e.isCubeTexture?`texture( ${t}, vec4( ${n}, ${r} ) )`:s?o?`textureOffset( ${t}, vec4( ${n}, ${s}, ${r} ), ${o} )`:`texture( ${t}, vec4( ${n}, ${s}, ${r} ) )`:o?`textureOffset( ${t}, vec3( ${n}, ${r} ), ${o} )`:`texture( ${t}, vec3( ${n}, ${r} ) )`;ze(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureGather(e,t,n,r,s,o,a){return e.isDepthTexture&&(r="0"),o===null&&(o="ivec2( 0 )"),a===null&&(a="false"),s?(this._include("textureGatherArray"),`tsl_textureGather_array( ${r}, ${t}, vec3( ${n}, ${s} ), ${o}, ${a} )`):(this._include("textureGather"),`tsl_textureGather( ${r}, ${t}, ${n}, ${o}, ${a} )`)}generateTextureGatherCompare(e,t,n,r,s,o,a){return o===null&&(o="ivec2( 0 )"),a===null&&(a="false"),s?(this._include("textureGatherCompareArray"),`tsl_textureGatherCompare_array( ${t}, vec3( ${n}, ${s} ), ${o}, ${r}, ${a} )`):(this._include("textureGatherCompare"),`tsl_textureGatherCompare( ${t}, ${n}, ${o}, ${r}, ${a} )`)}getUniforms(e){let t=this.uniforms[e],n=[],r={};for(let o of t){let a=null,l=!1;if(o.type==="texture"||o.type==="texture3D"){let c=o.node,u=c.value,f="";(u.isDataTexture===!0||u.isData3DTexture===!0)&&(u.type===xi?f="u":u.type===Kr&&(f="i")),o.type==="texture3D"&&u.isArrayTexture===!1?a=`${f}sampler3D ${o.name};`:u.compareFunction&&c.compareNode!==null?u.isArrayTexture===!0?a=`sampler2DArrayShadow ${o.name};`:a=`sampler2DShadow ${o.name};`:u.isArrayTexture===!0||u.isDataArrayTexture===!0||u.isCompressedArrayTexture===!0?a=`${f}sampler2DArray ${o.name};`:a=`${f}sampler2D ${o.name};`}else if(o.type==="cubeTexture")a=`samplerCube ${o.name};`;else if(o.type==="cubeDepthTexture")o.node.value.compareFunction?a=`samplerCubeShadow ${o.name};`:a=`samplerCube ${o.name};`;else if(o.type==="buffer"){let c=o.node,u=this.getType(c.bufferType),f=c.bufferCount,d=f>0?f:"";a=`${c.name} {4253+}`}setupPBO(e){let t=e.value;if(t.pbo===void 0){let n=t.array,r=t.count*t.itemSize,{itemSize:s}=t,o=t.array.constructor.name.toLowerCase().includes("int"),a=o?kh:Fd;s===2?a=o?zh:Ws:s===3?a=o?Ib:Nd:s===4&&(a=o?g0:Or);let l={Float32Array:cr,Uint8Array:Ji,Uint16Array:wl,Uint32Array:xi,Int8Array:Oh,Int16Array:Uh,Int32Array:Kr,Uint8ClampedArray:Ji},c=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(r/s)))),u=Math.ceil(r/s/c);c*u*s<r&&u++;let f=c*u*s,d=new n.constructor(f);d.set(n,0),t.array=d;let A=new HA(t.array,c,u,a,l[t.array.constructor.name]||cr);A.needsUpdate=!0,A.isPBOTexture=!0;let y=new su(A,null,null);y.setPrecision("high"),t.pboNode=y,t.pbo=y.value,this.getUniformFromNode(t.pboNode,"texture",this.shaderStage,this.context.nodeName)}}getPropertyName(e,t=this.shaderStage){return e.isNodeUniform&&e.node.isTextureNode!==!0&&e.node.isBufferNode!==!0?e.name:super.getPropertyName(e,t)}generatePBO(e){let{node:t,indexNode:n}=e,r=t.value;if(this.renderer.backend.has(r)){let u=this.renderer.backend.get(r);u.pbo=r.pbo}let s=this.getUniformFromNode(r.pboNode,"texture",this.shaderStage,this.context.nodeName),o=this.getPropertyName(s);this.increaseUsage(n);let a=n.build(this,"uint"),l=this.getDataFromNode(e),c=l.propertyName;if(c===void 0){let u=this.getVarFromNode(e);c=this.getPropertyName(u);let f=this.getDataFromNode(t),d=f.propertySizeName;d===void 0&&(d=c+"Size",this.getVarFromNode(t,d,"uint"),this.addLineFlowCode(`${d} = uint( textureSize( ${o}, 0 ).x )`,e),f.propertySizeName=d);let{itemSize:A}=r,y="."+a1.join("").slice(0,A),w=`ivec2(${a} % ${d}, ${a} / ${d})`,S=this.generateTextureLoad(null,o,w,"0",null,null),T="vec4";r.pbo.type===xi?T="uvec4":r.pbo.type===Kr&&(T="ivec4"),this.addLineFlowCode(`${c} = ${T}(${S})${y}`,e),l.propertyName=c}return c}generateTextureLoad(e,t,n,r,s,o){r===null&&(r="0");let a;return s?o?a=`texelFetchOffset( ${t}, ivec3( ${n}, ${s} ), int( ${r} ), ${o} )`:a=`texelFetch( ${t}, ivec3( ${n}, ${s} ), int( ${r} ) )`:o?a=`texelFetchOffset( ${t}, ${n}, int( ${r} ), ${o} )`:a=`texelFetch( ${t}, ${n}, int( ${r} ) )`,e!==null&&e.isDepthTexture&&(a+=".x"),a}generateTexture(e,t,n,r,s){return r&&(n=`vec3( ${n}, ${r} )`),e.isDepthTexture?s?`textureOffset( ${t}, ${n}, ${s} ).x`:`texture( ${t}, ${n} ).x`:s?`textureOffset( ${t}, ${n}, ${s} )`:`texture( ${t}, ${n} )`}generateTextureLevel(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureLodOffset( ${t}, ${n}, ${r}, ${o} )`:`textureLod( ${t}, ${n}, ${r} )`}generateTextureBias(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureOffset( ${t}, ${n}, ${o}, ${r} )`:`texture( ${t}, ${n}, ${r} )`}generateTextureGrad(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureGradOffset( ${t}, ${n}, ${r[0]}, ${r[1]}, ${o} )`:`textureGrad( ${t}, ${n}, ${r[0]}, ${r[1]} )`}generateTextureCompare(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return e.isCubeTexture?`texture( ${t}, vec4( ${n}, ${r} ) )`:s?o?`textureOffset( ${t}, vec4( ${n}, ${s}, ${r} ), ${o} )`:`texture( ${t}, vec4( ${n}, ${s}, ${r} ) )`:o?`textureOffset( ${t}, vec3( ${n}, ${r} ), ${o} )`:`texture( ${t}, vec3( ${n}, ${r} ) )`;ze(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureGather(e,t,n,r,s,o,a){return e.isDepthTexture&&(r="0"),o===null&&(o="ivec2( 0 )"),a===null&&(a="false"),s?(this._include("textureGatherArray"),`tsl_textureGather_array( ${r}, ${t}, vec3( ${n}, ${s} ), ${o}, ${a} )`):(this._include("textureGather"),`tsl_textureGather( ${r}, ${t}, ${n}, ${o}, ${a} )`)}generateTextureGatherCompare(e,t,n,r,s,o,a){return o===null&&(o="ivec2( 0 )"),a===null&&(a="false"),s?(this._include("textureGatherCompareArray"),`tsl_textureGatherCompare_array( ${t}, vec3( ${n}, ${s} ), ${o}, ${r}, ${a} )`):(this._include("textureGatherCompare"),`tsl_textureGatherCompare( ${t}, ${n}, ${o}, ${r}, ${a} )`)}getUniforms(e){let t=this.uniforms[e],n=[],r={};for(let o of t){let a=null,l=!1;if(o.type==="texture"||o.type==="texture3D"){let c=o.node,u=c.value,f="";(u.isDataTexture===!0||u.isData3DTexture===!0)&&(u.type===xi?f="u":u.type===Kr&&(f="i")),o.type==="texture3D"&&u.isArrayTexture===!1?a=`${f}sampler3D ${o.name};`:u.compareFunction&&c.compareNode!==null?u.isArrayTexture===!0?a=`sampler2DArrayShadow ${o.name};`:a=`sampler2DShadow ${o.name};`:u.isArrayTexture===!0||u.isDataArrayTexture===!0||u.isCompressedArrayTexture===!0?a=`${f}sampler2DArray ${o.name};`:a=`${f}sampler2D ${o.name};`}else if(o.type==="cubeTexture")a=`samplerCube ${o.name};`;else if(o.type==="cubeDepthTexture")o.node.value.compareFunction?a=`samplerCubeShadow ${o.name};`:a=`samplerCube ${o.name};`;else if(o.type==="buffer"){let c=o.node,u=this.getType(c.bufferType),f=c.bufferCount,d=f>0?f:"";a=`${c.name} {42544254 ${u} ${o.name}[${d}];42554255 };4256-`}else{let c=o.groupNode.name;if(r[c]===void 0){let u=this.uniformGroups[c];if(u!==void 0){let f=[];for(let d of u.uniforms){let A=d.getType(),y=this.getVectorType(A),w=d.nodeUniform.node.precision,S=`${y} ${d.name};`;w!==null&&(S=Vte[w]+" "+S),f.push(" "+S)}r[c]=f}}l=!0}if(!l){let c=o.node.precision;c!==null&&(a=Vte[c]+" "+a),a="uniform "+a,n.push(a)}}let s="";for(let o in r){let a=r[o];s+=this._getGLSLUniformStruct(o,a.join(`4256+`}else{let c=o.groupNode.name;if(r[c]===void 0){let u=this.uniformGroups[c];if(u!==void 0){let f=[];for(let d of u.uniforms){let A=d.getType(),y=this.getVectorType(A),w=d.nodeUniform.node.precision,S=`${y} ${d.name};`;w!==null&&(S=Ote[w]+" "+S),f.push(" "+S)}r[c]=f}}l=!0}if(!l){let c=o.node.precision;c!==null&&(a=Ote[c]+" "+a),a="uniform "+a,n.push(a)}}let s="";for(let o in r){let a=r[o];s+=this._getGLSLUniformStruct(o,a.join(`42574257 `))+`42584258 `}return s+=n.join(`42594259 `),s}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==Kr){let n=e;e.isInterleavedBufferAttribute&&(n=e.data);let r=n.array;r instanceof Uint32Array||r instanceof Int32Array||(t=t.slice(1))}return t}getAttributes(e){let t="";if(e==="vertex"||e==="compute"){let n=this.getAttributesArray(),r=0;for(let s of n)t+=`layout( location = ${r++} ) in ${s.type} ${s.name};
@@ -4266,14 +4266,14 @@ ${n.code}
42664266 `)+`42674267 42684268 `+t.join(`4269-`)}getVaryings(e){let t="",n=this.varyings;if(e==="vertex"||e==="compute")for(let r of n){e==="compute"&&(r.needsInterpolation=!0);let s=this.getType(r.type);if(r.needsInterpolation)if(r.interpolationType){let o=qte[r.interpolationType]||r.interpolationType,a=Hte[r.interpolationSampling]||"";t+=`${o} ${a} out ${s} ${r.name};4269+`)}getVaryings(e){let t="",n=this.varyings;if(e==="vertex"||e==="compute")for(let r of n){e==="compute"&&(r.needsInterpolation=!0);let s=this.getType(r.type);if(r.needsInterpolation)if(r.interpolationType){let o=kte[r.interpolationType]||r.interpolationType,a=zte[r.interpolationSampling]||"";t+=`${o} ${a} out ${s} ${r.name};42704270 `}else{let o=s.includes("int")||s.includes("uv")||s.includes("iv")?"flat ":"";t+=`${o}out ${s} ${r.name};42714271 `}else t+=`${s} ${r.name};4272-`}else if(e==="fragment"){for(let r of n)if(r.needsInterpolation){let s=this.getType(r.type);if(r.interpolationType){let o=qte[r.interpolationType]||r.interpolationType,a=Hte[r.interpolationSampling]||"";t+=`${o} ${a} in ${s} ${r.name};4272+`}else if(e==="fragment"){for(let r of n)if(r.needsInterpolation){let s=this.getType(r.type);if(r.interpolationType){let o=kte[r.interpolationType]||r.interpolationType,a=zte[r.interpolationSampling]||"";t+=`${o} ${a} in ${s} ${r.name};42734273 `}else{let o=s.includes("int")||s.includes("uv")||s.includes("iv")?"flat ":"";t+=`${o}in ${s} ${r.name};42744274 `}}}for(let r of this.builtins[e])t+=`${r};42754275 `;return t}getVertexIndex(){return"uint( gl_VertexID )"}getInstanceIndex(){return"uint( gl_InstanceID )"}getInvocationLocalIndex(){return`uint( gl_InstanceID ) % ${this.object.workgroupSize.reduce((n,r)=>n*r,1)}u`}getSubgroupSize(){ze("GLSLNodeBuilder: WebGLBackend does not support the subgroupSize node")}getInvocationSubgroupIndex(){ze("GLSLNodeBuilder: WebGLBackend does not support the invocationSubgroupIndex node")}getSubgroupIndex(){ze("GLSLNodeBuilder: WebGLBackend does not support the subgroupIndex node")}getDrawIndex(){return this.renderer.backend.extensions.has("WEBGL_multi_draw")?"uint( gl_DrawID )":"nodeUniformDrawId"}getFrontFacing(){return"gl_FrontFacing"}getFragCoord(){return"gl_FragCoord.xy"}getFragDepth(){return"gl_FragDepth"}enableExtension(e,t,n=this.shaderStage){let r=this.extensions[n]||(this.extensions[n]=new Map);r.has(e)===!1&&r.set(e,{name:e,behavior:t})}getExtensions(e){let t=[];if(e==="vertex"){let r=this.renderer.backend.extensions;this.object.isBatchedMesh&&r.has("WEBGL_multi_draw")&&this.enableExtension("GL_ANGLE_multi_draw","require",e)}let n=this.extensions[e];if(n!==void 0)for(let{name:r,behavior:s}of n.values())t.push(`#extension ${r} : ${s}`);return t.join(`4276-`)}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=Gte[e];if(t===void 0){let n;switch(t=!1,e){case"float32Filterable":n="OES_texture_float_linear";break;case"clipDistance":n="WEBGL_clip_cull_distance";break}if(n!==void 0){let r=this.renderer.backend.extensions;r.has(n)&&(r.get(n),t=!0)}Gte[e]=t}return t}isFlipY(){return!0}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}enableMultiview(){this.enableExtension("GL_OVR_multiview2","require","fragment"),this.enableExtension("GL_OVR_multiview2","require","vertex"),this.builtins.vertex.push("layout(num_views = 2) in")}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){let e=this.transforms,t="";for(let n=0;n<e.length;n++){let r=e[n],s=this.getPropertyName(r.attributeNode);s&&(t+=`${r.varyingName} = ${s};4276+`)}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=Ute[e];if(t===void 0){let n;switch(t=!1,e){case"float32Filterable":n="OES_texture_float_linear";break;case"clipDistance":n="WEBGL_clip_cull_distance";break}if(n!==void 0){let r=this.renderer.backend.extensions;r.has(n)&&(r.get(n),t=!0)}Ute[e]=t}return t}isFlipY(){return!0}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}enableMultiview(){this.enableExtension("GL_OVR_multiview2","require","fragment"),this.enableExtension("GL_OVR_multiview2","require","vertex"),this.builtins.vertex.push("layout(num_views = 2) in")}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){let e=this.transforms,t="";for(let n=0;n<e.length;n++){let r=e[n],s=this.getPropertyName(r.attributeNode);s&&(t+=`${r.varyingName} = ${s};42774277 `)}return t}_getGLSLUniformStruct(e,t){return`42784278 layout( std140 ) uniform ${e} {42794279 ${t}
@@ -4285,7 +4285,7 @@ ${this.getSignature()}
42854285 ${e.extensions}42864286 42874287 // precision4288-${Wte}4288+${Vte}42894289 42904290 // structs42914291 ${e.structs}
@@ -4324,7 +4324,7 @@ ${this.getSignature()}
43244324 ${e.extensions}43254325 43264326 // precision4327-${Wte}4327+${Vte}43284328 43294329 // structs43304330 ${e.structs}
@@ -4355,7 +4355,7 @@ void main() {
43554355 `,a===s&&t!=="compute"&&(n+=`// result43564356 `,t==="vertex"?(n+="gl_Position = ",n+=`${this.format(l.result,s.getNodeType(this),"vec4")};`):t==="fragment"&&(a.outputNode.isOutputStructNode||(n+="fragColor = ",n+=`${this.format(l.result,s.getNodeType(this),this.getOutputType())};`)))}let o=e[t];if(o.extensions=this.getExtensions(t),o.uniforms=this.getUniforms(t),o.attributes=this.getAttributes(t),o.varyings=this.getVaryings(t),o.vars=this.getVars(t,!0),o.structs=this.getStructs(t),o.codes=this.getCodes(t),o.transforms=this.getTransforms(t),o.flow=n,t==="vertex"){let a=this.renderer.backend.extensions;this.object.isBatchedMesh&&a.has("WEBGL_multi_draw")===!1&&(o.uniforms+=`43574357 uniform uint nodeUniformDrawId;4358-`)}}this.material!==null?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,n,r=null){let s=super.getUniformFromNode(e,t,n,r),o=this.getDataFromNode(e,n,this.globalCache),a=o.uniformGPU;if(a===void 0){let l=e.groupNode,c=l.name,u=this.getBindGroupArray(c,n);if(t==="texture")a=new xx(s.name,s.node,l),u.push(a);else if(t==="cubeTexture"||t==="cubeDepthTexture")a=new oI(s.name,s.node,l),u.push(a);else if(t==="texture3D")a=new LS(s.name,s.node,l),u.push(a);else if(t==="buffer"){s.name=`buffer${e.id}`;let f=this.getSharedDataFromNode(e),d=f.buffer;d===void 0&&(e.name=`NodeBuffer_${e.id}`,d=new iI(e,l),d.name=e.name,f.buffer=d),u.push(d),a=d}else{let f=this.uniformGroups[c];f===void 0?(f=new rI(c,l),this.uniformGroups[c]=f,u.push(f)):u.indexOf(f)===-1&&u.push(f),a=this.getNodeUniform(s,t);let d=a.name;f.uniforms.some(y=>y.name===d)||f.addUniform(a)}o.uniformGPU=a}return s}},uU=null,Y_=null,aI=class{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[$c.RENDER]:null,[$c.COMPUTE]:null},this.trackTimestamp=e.trackTimestamp===!0}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}setXRTarget(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}updateSampler(){}destroySampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}async copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}createUniformBuffer(){}destroyUniformBuffer(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}updateTimeStampUID(e){let t=this.get(e),n=this.renderer.info.frame,r;e.isComputeNode===!0?r="c:"+this.renderer.info.compute.frameCalls:r="r:"+this.renderer.info.render.frameCalls,t.timestampUID=r+":"+e.id+":f"+n}getTimestampUID(e){return this.get(e).timestampUID}getTimestampFrames(e){let t=this.timestampQueryPool[e];return t?t.getTimestampFrames():[]}_getQueryPool(e){let t=e.startsWith("c:")?$c.COMPUTE:$c.RENDER;return this.timestampQueryPool[t]}getTimestamp(e){return this._getQueryPool(e).getTimestamp(e)}get hasTimestamp(){return!1}hasTimestampQuery(e){return this._getQueryPool(e).hasTimestampQuery(e)}isOccluded(){}async resolveTimestampsAsync(e="render"){if(!this.trackTimestamp){ni("WebGPURenderer: Timestamp tracking is disabled.");return}let t=this.timestampQueryPool[e];if(!t)return;let n=await t.resolveQueriesAsync();return this.renderer.info[e].timestamp=n,n}async getArrayBufferAsync(){}async hasFeatureAsync(){}hasFeature(){}getDrawingBufferSize(){return uU=uU||new Oe,this.renderer.getDrawingBufferSize(uU)}setScissorTest(){}getClearColor(){let e=this.renderer;return Y_=Y_||new wS,e.getClearColor(Y_),Y_.getRGB(Y_),Y_}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:WM(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${"185"} webgpu`),this.domElement=e),e}hasCompatibility(){return!1}initRenderTarget(){}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}deleteBindGroupData(){}dispose(){}},PPe=0,y9=class{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[this.activeBufferIndex^1]}switchBuffers(){this.activeBufferIndex^=1}},b9=class{constructor(e){this.backend=e}createAttribute(e,t){let n=this.backend,{gl:r}=n,s=e.array,o=e.usage||r.STATIC_DRAW,a=e.isInterleavedBufferAttribute?e.data:e,l=n.get(a),c=l.bufferGPU;c===void 0&&(c=this._createBuffer(r,t,s,o),l.bufferGPU=c,l.bufferType=t,l.version=a.version);let u;if(s instanceof Float32Array)u=r.FLOAT;else if(typeof Float16Array<"u"&&s instanceof Float16Array)u=r.HALF_FLOAT;else if(s instanceof Uint16Array)e.isFloat16BufferAttribute?u=r.HALF_FLOAT:u=r.UNSIGNED_SHORT;else if(s instanceof Int16Array)u=r.SHORT;else if(s instanceof Uint32Array)u=r.UNSIGNED_INT;else if(s instanceof Int32Array)u=r.INT;else if(s instanceof Int8Array)u=r.BYTE;else if(s instanceof Uint8Array)u=r.UNSIGNED_BYTE;else if(s instanceof Uint8ClampedArray)u=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+s);let f={bufferGPU:c,bufferType:t,type:u,byteLength:s.byteLength,bytesPerElement:s.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:u===r.INT||u===r.UNSIGNED_INT||e.gpuType===Kr,id:PPe++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){let d=this._createBuffer(r,t,s,o);f=new y9(f,d)}n.set(e,f)}updateAttribute(e){let t=this.backend,{gl:n}=t,r=e.array,s=e.isInterleavedBufferAttribute?e.data:e,o=t.get(s),a=o.bufferType,l=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(n.bindBuffer(a,o.bufferGPU),l.length===0)n.bufferSubData(a,0,r);else{for(let c=0,u=l.length;c<u;c++){let f=l[c];n.bufferSubData(a,f.start*r.BYTES_PER_ELEMENT,r,f.start,f.count)}s.clearUpdateRanges()}n.bindBuffer(a,null),o.version=s.version}destroyAttribute(e){let t=this.backend,{gl:n}=t;e.isInterleavedBufferAttribute&&t.delete(e.data);let r=t.get(e);n.deleteBuffer(r.bufferGPU),t.delete(e)}async getArrayBufferAsync(e,t=null,n=0,r=-1){let s=this.backend,{gl:o}=s,a=e.isInterleavedBufferAttribute?e.data:e,l=s.get(a),{bufferGPU:c}=l,u=r===-1?l.byteLength-n:r,f;if(t===null)f=new Uint8Array(new ArrayBuffer(u));else if(t.isReadbackBuffer){if(t._mapped===!0)throw new Error("THREE.WebGPURenderer: ReadbackBuffer must be released before being used again.");let d=()=>{t.buffer=null,t._mapped=!1,t.removeEventListener("release",d),t.removeEventListener("dispose",d)};t.addEventListener("release",d),t.addEventListener("dispose",d),f=new Uint8Array(new ArrayBuffer(u)),t.buffer=f.buffer}else f=new Uint8Array(t);return o.bindBuffer(o.COPY_READ_BUFFER,c),o.getBufferSubData(o.COPY_READ_BUFFER,n,f),o.bindBuffer(o.COPY_READ_BUFFER,null),o.bindBuffer(o.COPY_WRITE_BUFFER,null),t&&t.isReadbackBuffer?t:f.buffer}_createBuffer(e,t,n,r){let s=e.createBuffer();return e.bindBuffer(t,s),e.bufferData(t,n,r),e.bindBuffer(t,null),s}},Zw,Xd,w9=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.enabled={},this.parameters={},this.currentFlipSided=null,this.currentCullFace=null,this.currentProgram=null,this.currentBlendingEnabled=!1,this.currentBlending=null,this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentPremultipledAlpha=null,this.currentPolygonOffsetFactor=null,this.currentPolygonOffsetUnits=null,this.currentColorMask=null,this.currentDepthReversed=!1,this.currentDepthFunc=null,this.currentDepthMask=null,this.currentStencilFunc=null,this.currentStencilRef=null,this.currentStencilFuncMask=null,this.currentStencilFail=null,this.currentStencilZFail=null,this.currentStencilZPass=null,this.currentStencilMask=null,this.currentLineWidth=null,this.currentClippingPlanes=0,this.currentVAO=null,this.currentIndex=null,this.currentBoundFramebuffers={},this.currentDrawbuffers=new WeakMap,this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this.currentTextureSlot=null,this.currentBoundTextures={},this.currentBoundBufferBases={},this._init()}_init(){let e=this.gl;Zw={[oo]:e.FUNC_ADD,[Ab]:e.FUNC_SUBTRACT,[gb]:e.FUNC_REVERSE_SUBTRACT},Xd={[Uu]:e.ZERO,[vb]:e.ONE,[_b]:e.SRC_COLOR,[e0]:e.SRC_ALPHA,[Tb]:e.SRC_ALPHA_SATURATE,[wb]:e.DST_COLOR,[yb]:e.DST_ALPHA,[xb]:e.ONE_MINUS_SRC_COLOR,[t0]:e.ONE_MINUS_SRC_ALPHA,[Sb]:e.ONE_MINUS_DST_COLOR,[bb]:e.ONE_MINUS_DST_ALPHA};let t=e.getParameter(e.SCISSOR_BOX),n=e.getParameter(e.VIEWPORT);this.currentScissor=new xn().fromArray(t),this.currentViewport=new xn().fromArray(n),this._tempVec4=new xn}enable(e){let{enabled:t}=this;t[e]!==!0&&(this.gl.enable(e),t[e]=!0)}disable(e){let{enabled:t}=this;t[e]!==!1&&(this.gl.disable(e),t[e]=!1)}setFlipSided(e){if(this.currentFlipSided!==e){let{gl:t}=this;e?t.frontFace(t.CW):t.frontFace(t.CCW),this.currentFlipSided=e}}setCullFace(e){let{gl:t}=this;e!==FM?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===pb?t.cullFace(t.BACK):e===BM?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):this.disable(t.CULL_FACE),this.currentCullFace=e}setLineWidth(e){let{currentLineWidth:t,gl:n}=this;e!==t&&(n.lineWidth(e),this.currentLineWidth=e)}setMRTBlending(e,t,n){let r=this.gl,s=this.backend.drawBuffersIndexedExt;if(!s){ni("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets.");return}for(let o=0;o<e.length;o++){let a=e[o],l=null;if(t!==null){let c=t.getBlendMode(a.name);c.blending===mb?l=n:c.blending!==ms&&(l=c)}else l=n;l!==null?this._setMRTBlendingIndex(o,l):s.blendFuncSeparateiOES(o,r.ONE,r.ZERO,r.ONE,r.ZERO)}}_setMRTBlendingIndex(e,t){let{gl:n}=this,r=this.backend.drawBuffersIndexedExt,s=t.blending,o=t.blendSrc,a=t.blendDst,l=t.blendEquation,c=t.premultipliedAlpha;if(s===Bd){let u=t.blendSrcAlpha!==null?t.blendSrcAlpha:o,f=t.blendDstAlpha!==null?t.blendDstAlpha:a,d=t.blendEquationAlpha!==null?t.blendEquationAlpha:l;r.blendEquationSeparateiOES(e,Zw[l],Zw[d]),r.blendFuncSeparateiOES(e,Xd[o],Xd[a],Xd[u],Xd[f])}else if(r.blendEquationSeparateiOES(e,n.FUNC_ADD,n.FUNC_ADD),c)switch(s){case Ms:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Oh:r.blendFuncSeparateiOES(e,n.ONE,n.ONE,n.ONE,n.ONE);break;case Uh:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case kh:r.blendFuncSeparateiOES(e,n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break}else switch(s){case Ms:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Oh:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case Uh:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case kh:r.blendFuncSeparateiOES(e,n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break}}setBlending(e,t,n,r,s,o,a,l){let{gl:c}=this;if(e===ms){this.currentBlendingEnabled===!0&&(this.disable(c.BLEND),this.currentBlendingEnabled=!1);return}if(this.currentBlendingEnabled===!1&&(this.enable(c.BLEND),this.currentBlendingEnabled=!0),e!==Bd){if(e!==this.currentBlending||l!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==oo||this.currentBlendEquationAlpha!==oo)&&(c.blendEquation(c.FUNC_ADD),this.currentBlendEquation=oo,this.currentBlendEquationAlpha=oo),l)switch(e){case Ms:c.blendFuncSeparate(c.ONE,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case Oh:c.blendFunc(c.ONE,c.ONE);break;case Uh:c.blendFuncSeparate(c.ZERO,c.ONE_MINUS_SRC_COLOR,c.ZERO,c.ONE);break;case kh:c.blendFuncSeparate(c.DST_COLOR,c.ONE_MINUS_SRC_ALPHA,c.ZERO,c.ONE);break;default:ze("WebGLState: Invalid blending: ",e);break}else switch(e){case Ms:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case Oh:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE,c.ONE,c.ONE);break;case Uh:ze("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case kh:ze("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ze("WebGLState: Invalid blending: ",e);break}this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentBlending=e,this.currentPremultipledAlpha=l}return}s=s||t,o=o||n,a=a||r,(t!==this.currentBlendEquation||s!==this.currentBlendEquationAlpha)&&(c.blendEquationSeparate(Zw[t],Zw[s]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=s),(n!==this.currentBlendSrc||r!==this.currentBlendDst||o!==this.currentBlendSrcAlpha||a!==this.currentBlendDstAlpha)&&(c.blendFuncSeparate(Xd[n],Xd[r],Xd[o],Xd[a]),this.currentBlendSrc=n,this.currentBlendDst=r,this.currentBlendSrcAlpha=o,this.currentBlendDstAlpha=a),this.currentBlending=e,this.currentPremultipledAlpha=!1}setColorMask(e){this.currentColorMask!==e&&(this.gl.colorMask(e,e,e,e),this.currentColorMask=e)}setDepthTest(e){let{gl:t}=this;e?this.enable(t.DEPTH_TEST):this.disable(t.DEPTH_TEST)}setReversedDepth(e){if(this.currentDepthReversed!==e){let t=this.backend.extensions.get("EXT_clip_control");e?t.clipControlEXT(t.LOWER_LEFT_EXT,t.ZERO_TO_ONE_EXT):t.clipControlEXT(t.LOWER_LEFT_EXT,t.NEGATIVE_ONE_TO_ONE_EXT),this.currentDepthReversed=e}}setDepthMask(e){this.currentDepthMask!==e&&(this.gl.depthMask(e),this.currentDepthMask=e)}setDepthFunc(e){if(this.currentDepthReversed&&(e=zb[e]),this.currentDepthFunc!==e){let{gl:t}=this;switch(e){case DA:t.depthFunc(t.NEVER);break;case NA:t.depthFunc(t.ALWAYS);break;case FA:t.depthFunc(t.LESS);break;case Lh:t.depthFunc(t.LEQUAL);break;case BA:t.depthFunc(t.EQUAL);break;case OA:t.depthFunc(t.GEQUAL);break;case UA:t.depthFunc(t.GREATER);break;case kA:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}this.currentDepthFunc=e}}scissor(e,t,n,r){let s=this._tempVec4.set(e,t,n,r);if(this.currentScissor.equals(s)===!1){let{gl:o}=this;o.scissor(s.x,s.y,s.z,s.w),this.currentScissor.copy(s)}}viewport(e,t,n,r){let s=this._tempVec4.set(e,t,n,r);if(this.currentViewport.equals(s)===!1){let{gl:o}=this;o.viewport(s.x,s.y,s.z,s.w),this.currentViewport.copy(s)}}setScissorTest(e){let t=this.gl;e?this.enable(t.SCISSOR_TEST):this.disable(t.SCISSOR_TEST)}setStencilTest(e){let{gl:t}=this;e?this.enable(t.STENCIL_TEST):this.disable(t.STENCIL_TEST)}setStencilMask(e){this.currentStencilMask!==e&&(this.gl.stencilMask(e),this.currentStencilMask=e)}setStencilFunc(e,t,n){(this.currentStencilFunc!==e||this.currentStencilRef!==t||this.currentStencilFuncMask!==n)&&(this.gl.stencilFunc(e,t,n),this.currentStencilFunc=e,this.currentStencilRef=t,this.currentStencilFuncMask=n)}setStencilOp(e,t,n){(this.currentStencilFail!==e||this.currentStencilZFail!==t||this.currentStencilZPass!==n)&&(this.gl.stencilOp(e,t,n),this.currentStencilFail=e,this.currentStencilZFail=t,this.currentStencilZPass=n)}setMaterial(e,t,n){let{gl:r}=this;e.side===vr?this.disable(r.CULL_FACE):this.enable(r.CULL_FACE);let s=e.side===mi;t&&(s=!s),this.setFlipSided(s),e.blending===Ms&&e.transparent===!1?this.setBlending(ms):this.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),this.setDepthFunc(e.depthFunc),this.setDepthTest(e.depthTest),this.setDepthMask(e.depthWrite),this.setColorMask(e.colorWrite);let o=e.stencilWrite;if(this.setStencilTest(o),o&&(this.setStencilMask(e.stencilWriteMask),this.setStencilFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),this.setStencilOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),this.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),e.alphaToCoverage===!0&&this.backend.renderer.currentSamples>0?this.enable(r.SAMPLE_ALPHA_TO_COVERAGE):this.disable(r.SAMPLE_ALPHA_TO_COVERAGE),n>0&&this.currentClippingPlanes!==n)for(let l=0;l<8;l++)l<n?this.enable(12288+l):this.disable(12288+l)}setPolygonOffset(e,t,n){let{gl:r}=this;e?(this.enable(r.POLYGON_OFFSET_FILL),(this.currentPolygonOffsetFactor!==t||this.currentPolygonOffsetUnits!==n)&&(r.polygonOffset(t,n),this.currentPolygonOffsetFactor=t,this.currentPolygonOffsetUnits=n)):this.disable(r.POLYGON_OFFSET_FILL)}useProgram(e){return this.currentProgram!==e?(this.gl.useProgram(e),this.currentProgram=e,!0):!1}setVertexState(e,t=null){let n=this.gl;return this.currentVAO!==e||this.currentIndex!==t?(n.bindVertexArray(e),t!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.currentVAO=e,this.currentIndex=t,!0):!1}resetVertexState(){let e=this.gl;e.bindVertexArray(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),this.currentVAO=null,this.currentIndex=null}bindFramebuffer(e,t){let{gl:n,currentBoundFramebuffers:r}=this;return r[e]!==t?(n.bindFramebuffer(e,t),r[e]=t,e===n.DRAW_FRAMEBUFFER&&(r[n.FRAMEBUFFER]=t),e===n.FRAMEBUFFER&&(r[n.DRAW_FRAMEBUFFER]=t),!0):!1}drawBuffers(e,t){let{gl:n}=this,r=[],s=!1;if(e.textures!==null){r=this.currentDrawbuffers.get(t),r===void 0&&(r=[],this.currentDrawbuffers.set(t,r));let o=e.textures;if(r.length!==o.length||r[0]!==n.COLOR_ATTACHMENT0){for(let a=0,l=o.length;a<l;a++)r[a]=n.COLOR_ATTACHMENT0+a;r.length=o.length,s=!0}}else r[0]!==n.BACK&&(r[0]=n.BACK,s=!0);s&&n.drawBuffers(r)}activeTexture(e){let{gl:t,currentTextureSlot:n,maxTextures:r}=this;e===void 0&&(e=t.TEXTURE0+r-1),n!==e&&(t.activeTexture(e),this.currentTextureSlot=e)}bindTexture(e,t,n){let{gl:r,currentTextureSlot:s,currentBoundTextures:o,maxTextures:a}=this;n===void 0&&(s===null?n=r.TEXTURE0+a-1:n=s);let l=o[n];l===void 0&&(l={type:void 0,texture:void 0},o[n]=l),(l.type!==e||l.texture!==t)&&(s!==n&&(r.activeTexture(n),this.currentTextureSlot=n),r.bindTexture(e,t),l.type=e,l.texture=t)}bindBufferBase(e,t,n){let{gl:r}=this,s=`${e}-${t}`;return this.currentBoundBufferBases[s]!==n?(r.bindBufferBase(e,t,n),this.currentBoundBufferBases[s]=n,!0):!1}unbindTexture(){let{gl:e,currentTextureSlot:t,currentBoundTextures:n}=this,r=n[t];r!==void 0&&r.type!==void 0&&(e.bindTexture(r.type,null),r.type=void 0,r.texture=void 0)}getParameter(e){let{gl:t,parameters:n}=this;return n[e]!==void 0?n[e]:t.getParameter(e)}pixelStorei(e,t){let{gl:n,parameters:r}=this;r[e]!==t&&(n.pixelStorei(e,t),r[e]=t)}},S9=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=ha){let{gl:n,extensions:r}=this,s,o=ln.getTransfer(t);if(e===Ji)return n.UNSIGNED_BYTE;if(e===ig)return n.UNSIGNED_SHORT_4_4_4_4;if(e===rg)return n.UNSIGNED_SHORT_5_5_5_1;if(e===sg)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===og)return n.UNSIGNED_INT_10F_11F_11F_REV;if(e===Vh)return n.BYTE;if(e===Gh)return n.SHORT;if(e===Sl)return n.UNSIGNED_SHORT;if(e===Kr)return n.INT;if(e===xi)return n.UNSIGNED_INT;if(e===cr)return n.FLOAT;if(e===Wi)return n.HALF_FLOAT;if(e===f_)return n.ALPHA;if(e===Od)return n.RGB;if(e===Ur)return n.RGBA;if(e===Gs)return n.DEPTH_COMPONENT;if(e===xo)return n.DEPTH_STENCIL;if(e===Ud)return n.RED;if(e===qh)return n.RED_INTEGER;if(e===js)return n.RG;if(e===Hh)return n.RG_INTEGER;if(e===v0)return n.RGBA_INTEGER;if(e===Wh||e===jh||e===Xh||e===$h)if(o===kt)if(s=r.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(e===Wh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===jh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===Xh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===$h)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=r.get("WEBGL_compressed_texture_s3tc"),s!==null){if(e===Wh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===jh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Xh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===$h)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===ag||e===lg||e===cg||e===ug)if(s=r.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(e===ag)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===lg)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===cg)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===ug)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===_0||e===x0||e===y0||e===b0||e===w0||e===Yh||e===S0)if(s=r.get("WEBGL_compressed_texture_etc"),s!==null){if(e===_0||e===x0)return o===kt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(e===y0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(e===b0)return s.COMPRESSED_R11_EAC;if(e===w0)return s.COMPRESSED_SIGNED_R11_EAC;if(e===Yh)return s.COMPRESSED_RG11_EAC;if(e===S0)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(e===T0||e===E0||e===M0||e===C0||e===R0||e===I0||e===P0||e===L0||e===D0||e===N0||e===F0||e===B0||e===O0||e===U0)if(s=r.get("WEBGL_compressed_texture_astc"),s!==null){if(e===T0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===E0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===M0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===C0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===R0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===I0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===P0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===L0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===D0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===N0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===F0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===B0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===O0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===U0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===k0||e===z0||e===V0)if(s=r.get("EXT_texture_compression_bptc"),s!==null){if(e===k0)return o===kt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(e===z0)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(e===V0)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(e===G0||e===q0||e===Zh||e===H0)if(s=r.get("EXT_texture_compression_rgtc"),s!==null){if(e===G0)return s.COMPRESSED_RED_RGTC1_EXT;if(e===q0)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===Zh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===H0)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===ua?n.UNSIGNED_INT_24_8:n[e]!==void 0?n[e]:null}_clientWaitAsync(){let{gl:e}=this,t=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);return e.flush(),new Promise((n,r)=>{function s(){let o=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(o===e.WAIT_FAILED){e.deleteSync(t),r();return}if(o===e.TIMEOUT_EXPIRED){requestAnimationFrame(s);return}e.deleteSync(t),n()}s()})}},jte=!1,GR,hU,Xte,T9=class{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,jte===!1&&(this._init(),jte=!0)}_init(){let e=this.gl;GR={[Rd]:e.REPEAT,[la]:e.CLAMP_TO_EDGE,[Id]:e.MIRRORED_REPEAT},hU={[Ti]:e.NEAREST,[Db]:e.NEAREST_MIPMAP_NEAREST,[Xc]:e.NEAREST_MIPMAP_LINEAR,[Mi]:e.LINEAR,[g0]:e.LINEAR_MIPMAP_NEAREST,[Go]:e.LINEAR_MIPMAP_LINEAR},Xte={[Bb]:e.NEVER,[kb]:e.ALWAYS,[d_]:e.LESS,[Kh]:e.LEQUAL,[Ob]:e.EQUAL,[ku]:e.GEQUAL,[hg]:e.GREATER,[Ub]:e.NOTEQUAL}}getGLTextureType(e){let{gl:t}=this,n;return e.isCubeTexture===!0?n=t.TEXTURE_CUBE_MAP:e.isArrayTexture===!0||e.isDataArrayTexture===!0||e.isCompressedArrayTexture===!0?n=t.TEXTURE_2D_ARRAY:e.isData3DTexture===!0?n=t.TEXTURE_3D:n=t.TEXTURE_2D,n}getInternalFormat(e,t,n,r,s,o=!1){let{gl:a,extensions:l}=this;if(e!==null){if(a[e]!==void 0)return a[e];Xe("WebGLBackend: Attempt to use non-existing WebGL internal format '"+e+"'")}let c=null;r&&(c=l.get("EXT_texture_norm16"),c||Xe("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let u=t;if(t===a.RED&&(n===a.FLOAT&&(u=a.R32F),n===a.HALF_FLOAT&&(u=a.R16F),n===a.UNSIGNED_BYTE&&(u=a.R8),n===a.BYTE&&(u=a.R8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.R16_EXT),n===a.SHORT&&c&&(u=c.R16_SNORM_EXT)),t===a.RED_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.R8UI),n===a.UNSIGNED_SHORT&&(u=a.R16UI),n===a.UNSIGNED_INT&&(u=a.R32UI),n===a.BYTE&&(u=a.R8I),n===a.SHORT&&(u=a.R16I),n===a.INT&&(u=a.R32I)),t===a.RG&&(n===a.FLOAT&&(u=a.RG32F),n===a.HALF_FLOAT&&(u=a.RG16F),n===a.UNSIGNED_BYTE&&(u=a.RG8),n===a.BYTE&&(u=a.RG8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RG16_EXT),n===a.SHORT&&c&&(u=c.RG16_SNORM_EXT)),t===a.RG_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RG8UI),n===a.UNSIGNED_SHORT&&(u=a.RG16UI),n===a.UNSIGNED_INT&&(u=a.RG32UI),n===a.BYTE&&(u=a.RG8I),n===a.SHORT&&(u=a.RG16I),n===a.INT&&(u=a.RG32I)),t===a.RGB){let f=o?i0:ln.getTransfer(s);n===a.FLOAT&&(u=a.RGB32F),n===a.HALF_FLOAT&&(u=a.RGB16F),n===a.UNSIGNED_BYTE&&(u=f===kt?a.SRGB8:a.RGB8),n===a.BYTE&&(u=a.RGB8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RGB16_EXT),n===a.SHORT&&c&&(u=c.RGB16_SNORM_EXT),n===a.UNSIGNED_SHORT_5_6_5&&(u=a.RGB565),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGB4),n===a.UNSIGNED_INT_5_9_9_9_REV&&(u=a.RGB9_E5),n===a.UNSIGNED_INT_10F_11F_11F_REV&&(u=a.R11F_G11F_B10F)}if(t===a.RGB_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGB8UI),n===a.UNSIGNED_SHORT&&(u=a.RGB16UI),n===a.UNSIGNED_INT&&(u=a.RGB32UI),n===a.BYTE&&(u=a.RGB8I),n===a.SHORT&&(u=a.RGB16I),n===a.INT&&(u=a.RGB32I)),t===a.RGBA){let f=o?i0:ln.getTransfer(s);n===a.FLOAT&&(u=a.RGBA32F),n===a.HALF_FLOAT&&(u=a.RGBA16F),n===a.UNSIGNED_BYTE&&(u=f===kt?a.SRGB8_ALPHA8:a.RGBA8),n===a.BYTE&&(u=a.RGBA8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RGBA16_EXT),n===a.SHORT&&c&&(u=c.RGBA16_SNORM_EXT),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGBA4),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1)}return t===a.RGBA_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGBA8UI),n===a.UNSIGNED_SHORT&&(u=a.RGBA16UI),n===a.UNSIGNED_INT&&(u=a.RGBA32UI),n===a.BYTE&&(u=a.RGBA8I),n===a.SHORT&&(u=a.RGBA16I),n===a.INT&&(u=a.RGBA32I)),t===a.DEPTH_COMPONENT&&(n===a.UNSIGNED_SHORT&&(u=a.DEPTH_COMPONENT16),n===a.UNSIGNED_INT&&(u=a.DEPTH_COMPONENT24),n===a.FLOAT&&(u=a.DEPTH_COMPONENT32F)),t===a.DEPTH_STENCIL&&n===a.UNSIGNED_INT_24_8&&(u=a.DEPTH24_STENCIL8),(u===a.R16F||u===a.R32F||u===a.RG16F||u===a.RG32F||u===a.RGBA16F||u===a.RGBA32F)&&l.get("EXT_color_buffer_float"),u}setTextureParameters(e,t){let{gl:n,extensions:r,backend:s}=this,{state:o}=this.backend,a=ln.getPrimaries(ln.workingColorSpace),l=t.colorSpace===ha?null:ln.getPrimaries(t.colorSpace),c=t.colorSpace===ha||a===l?n.NONE:n.BROWSER_DEFAULT_WEBGL;o.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t.flipY),o.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),o.pixelStorei(n.UNPACK_ALIGNMENT,t.unpackAlignment),o.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,c),n.texParameteri(e,n.TEXTURE_WRAP_S,GR[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,GR[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,GR[t.wrapR])),n.texParameteri(e,n.TEXTURE_MAG_FILTER,hU[t.magFilter]);let u=t.mipmaps!==void 0&&t.mipmaps.length>0,f=t.minFilter===Mi&&u?Go:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,hU[f]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,Xte[t.compareFunction])),r.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===Ti||t.minFilter!==Xc&&t.minFilter!==Go||t.type===cr&&r.has("OES_texture_float_linear")===!1)return;if(t.anisotropy>1){let d=r.get("EXT_texture_filter_anisotropic");n.texParameterf(e,d.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,s.capabilities.getMaxAnisotropy()))}}}createDefaultTexture(e){let{gl:t,backend:n,defaultTextures:r}=this,s=this.getGLTextureType(e),o=r[s];o===void 0&&(o=t.createTexture(),n.state.bindTexture(s,o),t.texParameteri(s,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(s,t.TEXTURE_MAG_FILTER,t.NEAREST),r[s]=o),n.set(e,{textureGPU:o,glTextureType:s})}createTexture(e,t){let{gl:n,backend:r}=this,s,o,a,l,c;if(e.isExternalTexture===!0)s=e.sourceTexture,o=this.getGLTextureType(e);else{let{levels:u,width:f,height:d,depth:A}=t;a=r.utils.convert(e.format,e.colorSpace),l=r.utils.convert(e.type),c=this.getInternalFormat(e.internalFormat,a,l,e.normalized,e.colorSpace,e.isVideoTexture),s=n.createTexture(),o=this.getGLTextureType(e),r.state.bindTexture(o,s),this.setTextureParameters(o,e),e.isArrayTexture||e.isDataArrayTexture||e.isCompressedArrayTexture?n.texStorage3D(n.TEXTURE_2D_ARRAY,u,c,f,d,A):e.isData3DTexture?n.texStorage3D(n.TEXTURE_3D,u,c,f,d,A):e.isVideoTexture||n.texStorage2D(o,u,c,f,d)}r.set(e,{textureGPU:s,glTextureType:o,glFormat:a,glType:l,glInternalFormat:c})}copyBufferToTexture(e,t){let{gl:n,backend:r}=this,{state:s}=r,{textureGPU:o,glTextureType:a,glFormat:l,glType:c}=r.get(t),{width:u,height:f}=t.source.data;n.bindBuffer(n.PIXEL_UNPACK_BUFFER,e),r.state.bindTexture(a,o),s.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),s.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.texSubImage2D(a,0,0,0,u,f,l,c,0),n.bindBuffer(n.PIXEL_UNPACK_BUFFER,null),r.state.unbindTexture()}updateTexture(e,t){let{gl:n}=this,{width:r,height:s}=t,{textureGPU:o,glTextureType:a,glFormat:l,glType:c,glInternalFormat:u}=this.backend.get(e);if(!(e.isRenderTargetTexture||o===void 0))if(this.backend.state.bindTexture(a,o),this.setTextureParameters(a,e),e.isCompressedTexture){let f=e.mipmaps,d=t.image;for(let A=0;A<f.length;A++){let y=f[A];e.isCompressedArrayTexture?e.format!==n.RGBA?l!==null?n.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,A,0,0,0,y.width,y.height,d.depth,l,y.data):Xe("WebGLBackend: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texSubImage3D(n.TEXTURE_2D_ARRAY,A,0,0,0,y.width,y.height,d.depth,l,c,y.data):l!==null?n.compressedTexSubImage2D(n.TEXTURE_2D,A,0,0,y.width,y.height,l,y.data):Xe("WebGLBackend: Unsupported compressed texture format")}}else if(e.isCubeTexture){let f=t.images,d=e.mipmaps;for(let A=0;A<6;A++){let y=qR(f[A]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+A,0,0,0,r,s,l,c,y);for(let w=0;w<d.length;w++){let S=d[w],T=qR(S.images[A]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+A,w+1,0,0,T.width,T.height,l,c,T)}}}else if(e.isDataArrayTexture||e.isArrayTexture){let f=t.image;if(e.layerUpdates.size>0){let d=Vb(f.width,f.height,e.format,e.type);for(let A of e.layerUpdates){let y=f.data.subarray(A*d/f.data.BYTES_PER_ELEMENT,(A+1)*d/f.data.BYTES_PER_ELEMENT);n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,A,f.width,f.height,1,l,c,y)}e.clearLayerUpdates()}else n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,f.width,f.height,f.depth,l,c,f.data)}else if(e.isData3DTexture){let f=t.image;n.texSubImage3D(n.TEXTURE_3D,0,0,0,0,f.width,f.height,f.depth,l,c,f.data)}else if(e.isVideoTexture)e.update(),n.texImage2D(a,0,u,l,c,t.image);else if(e.isHTMLTexture)typeof n.texElementImage2D=="function"&&(n.texElementImage2D.length===3?n.texElementImage2D(n.TEXTURE_2D,n.RGBA8,t.image):n.texElementImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t.image));else{let f=e.mipmaps;if(f.length>0)for(let d=0,A=f.length;d<A;d++){let y=f[d],w=qR(y);n.texSubImage2D(a,d,0,0,y.width,y.height,l,c,w)}else{let d=qR(t.image);n.texSubImage2D(a,0,0,0,r,s,l,c,d)}}}generateMipmaps(e){let{gl:t,backend:n}=this,{textureGPU:r,glTextureType:s}=n.get(e);n.state.bindTexture(s,r),t.generateMipmap(s)}deallocateRenderBuffers(e){let{gl:t,backend:n}=this;if(e){let r=n.get(e);if(r.renderBufferStorageSetup=void 0,r.framebuffers){for(let s in r.framebuffers)t.deleteFramebuffer(r.framebuffers[s]);delete r.framebuffers}if(r.depthRenderbuffer&&(t.deleteRenderbuffer(r.depthRenderbuffer),delete r.depthRenderbuffer),r.stencilRenderbuffer&&(t.deleteRenderbuffer(r.stencilRenderbuffer),delete r.stencilRenderbuffer),r.msaaFrameBuffer&&(t.deleteFramebuffer(r.msaaFrameBuffer),delete r.msaaFrameBuffer),r.msaaRenderbuffers){for(let s=0;s<r.msaaRenderbuffers.length;s++)t.deleteRenderbuffer(r.msaaRenderbuffers[s]);delete r.msaaRenderbuffers}}}destroyTexture(e,t=!1){let{gl:n,backend:r}=this,{textureGPU:s,renderTarget:o}=r.get(e);this.deallocateRenderBuffers(o),t===!1&&e.isExternalTexture!==!0&&n.deleteTexture(s),r.delete(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){let{gl:a,backend:l}=this,{state:c}=this.backend,{textureGPU:u,glTextureType:f,glType:d,glFormat:A}=l.get(t);c.bindTexture(f,u);let y,w,S,T,R,P,I,F,D,L=e.isCompressedTexture?e.mipmaps[o]:e.image;if(n!==null)y=n.max.x-n.min.x,w=n.max.y-n.min.y,S=n.isBox3?n.max.z-n.min.z:1,T=n.min.x,R=n.min.y,P=n.isBox3?n.min.z:0;else{let H=Math.pow(2,-s);y=Math.floor(L.width*H),w=Math.floor(L.height*H),e.isDataArrayTexture||e.isArrayTexture?S=L.depth:e.isData3DTexture?S=Math.floor(L.depth*H):S=1,T=0,R=0,P=0}r!==null?(I=r.x,F=r.y,D=r.z):(I=0,F=0,D=0),c.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,t.flipY),c.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),c.pixelStorei(a.UNPACK_ALIGNMENT,t.unpackAlignment);let C=c.getParameter(a.UNPACK_ROW_LENGTH),B=c.getParameter(a.UNPACK_IMAGE_HEIGHT),k=c.getParameter(a.UNPACK_SKIP_PIXELS),z=c.getParameter(a.UNPACK_SKIP_ROWS),G=c.getParameter(a.UNPACK_SKIP_IMAGES);c.pixelStorei(a.UNPACK_ROW_LENGTH,L.width),c.pixelStorei(a.UNPACK_IMAGE_HEIGHT,L.height),c.pixelStorei(a.UNPACK_SKIP_PIXELS,T),c.pixelStorei(a.UNPACK_SKIP_ROWS,R),c.pixelStorei(a.UNPACK_SKIP_IMAGES,P);let W=e.isDataArrayTexture||e.isData3DTexture||t.isArrayTexture,Y=t.isDataArrayTexture||t.isData3DTexture||t.isArrayTexture;if(e.isDepthTexture){let H=l.get(e),$=l.get(t),J=l.get(H.renderTarget),te=l.get($.renderTarget),ce=J.framebuffers[H.cacheKey],he=te.framebuffers[$.cacheKey],ve=c.currentBoundFramebuffers[a.READ_FRAMEBUFFER]??null,Re=c.currentBoundFramebuffers[a.DRAW_FRAMEBUFFER]??null;c.bindFramebuffer(a.READ_FRAMEBUFFER,ce),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,he);for(let Qe=0;Qe<S;Qe++)W&&(a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,H.textureGPU,s,P+Qe),a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+Qe)),a.blitFramebuffer(T,R,y,w,I,F,y,w,a.DEPTH_BUFFER_BIT,a.NEAREST);c.bindFramebuffer(a.READ_FRAMEBUFFER,ve),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,Re)}else if(s!==0||e.isRenderTargetTexture||l.has(e)){let H=l.get(e);this._srcFramebuffer===null&&(this._srcFramebuffer=a.createFramebuffer()),this._dstFramebuffer===null&&(this._dstFramebuffer=a.createFramebuffer());let $=c.currentBoundFramebuffers[a.READ_FRAMEBUFFER]??null,J=c.currentBoundFramebuffers[a.DRAW_FRAMEBUFFER]??null;c.bindFramebuffer(a.READ_FRAMEBUFFER,this._srcFramebuffer),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,this._dstFramebuffer);for(let te=0;te<S;te++)W?a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,H.textureGPU,s,P+te):a.framebufferTexture2D(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,H.textureGPU,s),Y?a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+te):a.framebufferTexture2D(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,u,o),s!==0?a.blitFramebuffer(T,R,y,w,I,F,y,w,a.COLOR_BUFFER_BIT,a.NEAREST):Y?a.copyTexSubImage3D(f,o,I,F,D+te,T,R,y,w):a.copyTexSubImage2D(f,o,I,F,T,R,y,w);c.bindFramebuffer(a.READ_FRAMEBUFFER,$),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,J)}else Y?e.isDataTexture||e.isData3DTexture?a.texSubImage3D(f,o,I,F,D,y,w,S,A,d,L.data):t.isCompressedArrayTexture?a.compressedTexSubImage3D(f,o,I,F,D,y,w,S,A,L.data):a.texSubImage3D(f,o,I,F,D,y,w,S,A,d,L):e.isDataTexture?a.texSubImage2D(a.TEXTURE_2D,o,I,F,y,w,A,d,L.data):e.isCompressedTexture?a.compressedTexSubImage2D(a.TEXTURE_2D,o,I,F,L.width,L.height,A,L.data):a.texSubImage2D(a.TEXTURE_2D,o,I,F,y,w,A,d,L);c.pixelStorei(a.UNPACK_ROW_LENGTH,C),c.pixelStorei(a.UNPACK_IMAGE_HEIGHT,B),c.pixelStorei(a.UNPACK_SKIP_PIXELS,k),c.pixelStorei(a.UNPACK_SKIP_ROWS,z),c.pixelStorei(a.UNPACK_SKIP_IMAGES,G),o===0&&t.generateMipmaps&&a.generateMipmap(f),c.unbindTexture()}copyFramebufferToTexture(e,t,n){let{gl:r}=this,{state:s}=this.backend,{textureGPU:o}=this.backend.get(e),{x:a,y:l,z:c,w:u}=n,f=e.isDepthTexture===!0||t.renderTarget&&t.renderTarget.samples>0,d=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(f){let A=a!==0||l!==0,y,w;if(e.isDepthTexture===!0?(y=r.DEPTH_BUFFER_BIT,w=r.DEPTH_ATTACHMENT,t.stencil&&(y|=r.STENCIL_BUFFER_BIT)):(y=r.COLOR_BUFFER_BIT,w=r.COLOR_ATTACHMENT0),A){let S=this.backend.get(t.renderTarget),T=S.framebuffers[t.getCacheKey()],R=S.msaaFrameBuffer;s.bindFramebuffer(r.DRAW_FRAMEBUFFER,T),s.bindFramebuffer(r.READ_FRAMEBUFFER,R);let P=d-l-u;r.blitFramebuffer(a,P,a+c,P+u,a,P,a+c,P+u,y,r.NEAREST),s.bindFramebuffer(r.READ_FRAMEBUFFER,T),s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,P,c,u),s.unbindTexture()}else{let S=r.createFramebuffer();s.bindFramebuffer(r.DRAW_FRAMEBUFFER,S),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,w,r.TEXTURE_2D,o,0),r.blitFramebuffer(0,0,c,u,0,0,c,u,y,r.NEAREST),r.deleteFramebuffer(S)}}else s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,d-u-l,c,u),s.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t,n,r=!1){let{gl:s}=this,o=t.renderTarget,{depthTexture:a,depthBuffer:l,stencilBuffer:c,width:u,height:f}=o;if(s.bindRenderbuffer(s.RENDERBUFFER,e),l&&!c){let d=s.DEPTH_COMPONENT24;r===!0?this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(s.RENDERBUFFER,o.samples,d,u,f):n>0?(a&&a.isDepthTexture&&a.type===s.FLOAT&&(d=s.DEPTH_COMPONENT32F),s.renderbufferStorageMultisample(s.RENDERBUFFER,n,d,u,f)):s.renderbufferStorage(s.RENDERBUFFER,d,u,f),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,e)}else l&&c&&(n>0?s.renderbufferStorageMultisample(s.RENDERBUFFER,n,s.DEPTH24_STENCIL8,u,f):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,u,f),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,e));s.bindRenderbuffer(s.RENDERBUFFER,null)}async copyTextureToBuffer(e,t,n,r,s,o){let{backend:a,gl:l}=this,{textureGPU:c,glFormat:u,glType:f}=this.backend.get(e),d=l.createFramebuffer();a.state.bindFramebuffer(l.READ_FRAMEBUFFER,d);let A=e.isCubeTexture?l.TEXTURE_CUBE_MAP_POSITIVE_X+o:l.TEXTURE_2D;l.framebufferTexture2D(l.READ_FRAMEBUFFER,l.COLOR_ATTACHMENT0,A,c,0);let y=this._getTypedArrayType(f),w=this._getBytesPerTexel(f,u),T=r*s*w,R=l.createBuffer();l.bindBuffer(l.PIXEL_PACK_BUFFER,R),l.bufferData(l.PIXEL_PACK_BUFFER,T,l.STREAM_READ),l.readPixels(t,n,r,s,u,f,0),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),await a.utils._clientWaitAsync();let P=new y(T/y.BYTES_PER_ELEMENT);return l.bindBuffer(l.PIXEL_PACK_BUFFER,R),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,P),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),a.state.bindFramebuffer(l.READ_FRAMEBUFFER,null),l.deleteFramebuffer(d),P}_getTypedArrayType(e){let{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;if(e===t.UNSIGNED_SHORT_4_4_4_4||e===t.UNSIGNED_SHORT_5_5_5_1||e===t.UNSIGNED_SHORT_5_6_5||e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw new Error(`THREE.WebGLTextureUtils: Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){let{gl:n}=this,r=0;if(e===n.UNSIGNED_BYTE&&(r=1),(e===n.UNSIGNED_SHORT_4_4_4_4||e===n.UNSIGNED_SHORT_5_5_5_1||e===n.UNSIGNED_SHORT_5_6_5||e===n.UNSIGNED_SHORT||e===n.HALF_FLOAT)&&(r=2),(e===n.UNSIGNED_INT||e===n.FLOAT)&&(r=4),t===n.RGBA)return r*4;if(t===n.RGB)return r*3;if(t===n.ALPHA)return r}dispose(){let{gl:e}=this;this._srcFramebuffer!==null&&e.deleteFramebuffer(this._srcFramebuffer),this._dstFramebuffer!==null&&e.deleteFramebuffer(this._dstFramebuffer)}};function qR(i){return i.isDataTexture?i.image.data:typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?i:i.data}var E9=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return t===void 0&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}},M9=class{constructor(e){this.backend=e,this.maxAnisotropy=null,this.maxUniformBlockSize=null}getMaxAnisotropy(){if(this.maxAnisotropy!==null)return this.maxAnisotropy;let e=this.backend.gl,t=this.backend.extensions;if(t.has("EXT_texture_filter_anisotropic")===!0){let n=t.get("EXT_texture_filter_anisotropic");this.maxAnisotropy=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}getUniformBufferLimit(){if(this.maxUniformBlockSize!==null)return this.maxUniformBlockSize;let e=this.backend.gl;return this.maxUniformBlockSize=e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE),this.maxUniformBlockSize}},$te={WEBGL_multi_draw:"WEBGL_multi_draw",WEBGL_compressed_texture_astc:"texture-compression-astc",WEBGL_compressed_texture_etc:"texture-compression-etc2",WEBGL_compressed_texture_etc1:"texture-compression-etc1",WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-s3tc",EXT_texture_compression_bptc:"texture-compression-bc",EXT_disjoint_timer_query_webgl2:"timestamp-query",OVR_multiview2:"OVR_multiview2"},C9=class{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){let{gl:n,mode:r,object:s,type:o,info:a,index:l}=this;l!==0?n.drawElements(r,t,o,e):n.drawArrays(r,e,t),a.update(s,t,1)}renderInstances(e,t,n){let{gl:r,mode:s,type:o,index:a,object:l,info:c}=this;n!==0&&(a!==0?r.drawElementsInstanced(s,t,o,e,n):r.drawArraysInstanced(s,e,t,n),c.update(l,t,n))}renderMultiDraw(e,t,n){let{extensions:r,mode:s,object:o,info:a}=this;if(n===0)return;let l=r.get("WEBGL_multi_draw");if(l===null)for(let c=0;c<n;c++)this.render(e[c],t[c]);else{this.index!==0?l.multiDrawElementsWEBGL(s,t,0,this.type,e,0,n):l.multiDrawArraysWEBGL(s,e,0,t,0,n);let c=0;for(let u=0;u<n;u++)c+=t[u];a.update(o,c,1)}}},lI=class{constructor(e=256){this.trackTimestamp=!0,this.maxQueries=e,this.currentQueryIndex=0,this.queryOffsets=new Map,this.isDisposed=!1,this.lastValue=0,this.frames=[],this.pendingResolve=!1,this.timestamps=new Map}getTimestampFrames(){return this.frames}getTimestamp(e){let t=this.timestamps.get(e);return t===void 0&&(Xe(`TimestampQueryPool: No timestamp available for uid ${e}.`),t=0),t}hasTimestampQuery(e){return this.timestamps.has(e)}allocateQueriesForContext(){}async resolveQueriesAsync(){}dispose(){}},R9=class extends lI{constructor(e,t,n=2048){if(super(n),this.gl=e,this.type=t,this.ext=e.getExtension("EXT_disjoint_timer_query_webgl2")||e.getExtension("EXT_disjoint_timer_query"),!this.ext){Xe("EXT_disjoint_timer_query not supported; timestamps will be disabled."),this.trackTimestamp=!1;return}this.queries=[];for(let r=0;r<this.maxQueries;r++)this.queries.push(e.createQuery());this.activeQuery=null,this.queryStates=new Map}allocateQueriesForContext(e){if(!this.trackTimestamp)return null;if(this.currentQueryIndex+2>this.maxQueries)return ni(`WebGLTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;let t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryStates.set(t,"inactive"),this.queryOffsets.set(e,t),t}beginQuery(e){if(!this.trackTimestamp||this.isDisposed)return;let t=this.queryOffsets.get(e);if(t==null||this.activeQuery!==null)return;let n=this.queries[t];if(n)try{this.queryStates.get(t)==="inactive"&&(this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,n),this.activeQuery=t,this.queryStates.set(t,"started"))}catch(r){ze("Error in beginQuery:",r),this.activeQuery=null,this.queryStates.set(t,"inactive")}}endQuery(e){if(!this.trackTimestamp||this.isDisposed)return;let t=this.queryOffsets.get(e);if(t!=null&&this.activeQuery===t)try{this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.queryStates.set(t,"ended"),this.activeQuery=null}catch(n){ze("Error in endQuery:",n),this.queryStates.set(t,"inactive"),this.activeQuery=null}}async resolveQueriesAsync(){if(!this.trackTimestamp||this.pendingResolve)return this.lastValue;this.pendingResolve=!0;try{let e=new Map;for(let[s,o]of this.queryOffsets)if(this.queryStates.get(o)==="ended"){let l=this.queries[o];e.set(s,this.resolveQuery(l))}if(e.size===0)return this.lastValue;let t={},n=[];for(let[s,o]of e){let a=s.match(/^(.*):f(\d+)$/),l=parseInt(a[2]);n.includes(l)===!1&&n.push(l),t[l]===void 0&&(t[l]=0);let c=await o;this.timestamps.set(s,c),t[l]+=c}let r=t[n[n.length-1]];return this.lastValue=r,this.frames=n,this.currentQueryIndex=0,this.queryOffsets.clear(),this.queryStates.clear(),this.activeQuery=null,r}catch(e){return ze("Error resolving queries:",e),this.lastValue}finally{this.pendingResolve=!1}}async resolveQuery(e){return new Promise(t=>{if(this.isDisposed){t(this.lastValue);return}let n,r=!1,s=()=>{n&&(clearTimeout(n),n=null)},o=l=>{r||(r=!0,s(),t(l))},a=()=>{if(this.isDisposed){o(this.lastValue);return}try{if(this.gl.getParameter(this.ext.GPU_DISJOINT_EXT)){o(this.lastValue);return}if(!this.gl.getQueryParameter(e,this.gl.QUERY_RESULT_AVAILABLE)){n=setTimeout(a,1);return}let u=this.gl.getQueryParameter(e,this.gl.QUERY_RESULT);t(Number(u)/1e6)}catch(l){ze("Error checking query:",l),t(this.lastValue)}};a()})}dispose(){if(!this.isDisposed&&(this.isDisposed=!0,!!this.trackTimestamp)){for(let e of this.queries)this.gl.deleteQuery(e);this.queries=[],this.queryStates.clear(),this.queryOffsets.clear(),this.lastValue=0,this.activeQuery=null}}},cI=class extends aI{constructor(e={}){super(e),this.isWebGLBackend=!0,this.attributeUtils=null,this.extensions=null,this.capabilities=null,this.textureUtils=null,this.bufferRenderer=null,this.gl=null,this.state=null,this.utils=null,this.vaoCache={},this.transformFeedbackCache={},this.discard=!1,this.disjoint=null,this.parallel=null,this._currentContext=null,this._knownBindings=new WeakSet,this._supportsInvalidateFramebuffer=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),this._xrFramebuffer=null}init(e){super.init(e);let t=this.parameters,n={antialias:e.currentSamples>0,alpha:!0,depth:e.depth,stencil:e.stencil},r=t.context!==void 0?t.context:e.domElement.getContext("webgl2",n);function s(o){o.preventDefault();let a={api:"WebGL",message:o.statusMessage||"Unknown reason",reason:null,originalEvent:o};e.onDeviceLost(a)}this._onContextLost=s,e.domElement.addEventListener("webglcontextlost",s,!1),this.gl=r,this.extensions=new E9(this),this.capabilities=new M9(this),this.attributeUtils=new b9(this),this.textureUtils=new T9(this),this.bufferRenderer=new C9(this),this.state=new w9(this),this.utils=new S9(this),this.extensions.get("EXT_color_buffer_float"),this.extensions.get("WEBGL_clip_cull_distance"),this.extensions.get("OES_texture_float_linear"),this.extensions.get("EXT_color_buffer_half_float"),this.extensions.get("WEBGL_multisampled_render_to_texture"),this.extensions.get("WEBGL_render_shared_exponent"),this.extensions.get("WEBGL_multi_draw"),this.extensions.get("OVR_multiview2"),this.extensions.get("EXT_clip_control"),this.disjoint=this.extensions.get("EXT_disjoint_timer_query_webgl2"),this.parallel=this.extensions.get("KHR_parallel_shader_compile"),this.drawBuffersIndexedExt=this.extensions.get("OES_draw_buffers_indexed"),t.reversedDepthBuffer&&(this.extensions.has("EXT_clip_control")?e.reversedDepthBuffer=!0:(Xe("WebGPURenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer."),e.reversedDepthBuffer=!1)),e.reversedDepthBuffer&&this.state.setReversedDepth(!0)}get coordinateSystem(){return ko}get hasTimestamp(){return this.disjoint!==null}async getArrayBufferAsync(e,t=null,n=0,r=-1){return await this.attributeUtils.getArrayBufferAsync(e,t,n,r)}async makeXRCompatible(){this.gl.getContextAttributes().xrCompatible!==!0&&await this.gl.makeXRCompatible()}setXRTarget(e){this._xrFramebuffer=e}setXRRenderTargetTextures(e,t,n=null){let r=this.gl;if(this.set(e.texture,{textureGPU:t,glInternalFormat:r.RGBA8}),n!==null){let s=e.stencilBuffer?r.DEPTH24_STENCIL8:r.DEPTH_COMPONENT24;this.set(e.depthTexture,{textureGPU:n,glInternalFormat:s}),this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer===!0&&e.multiview===!1&&Xe("WebGLBackend: Render-to-texture extension was disabled because an external texture was provided"),e._autoAllocateDepthBuffer=!1}}initTimestampQuery(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new R9(this.gl,e,2048));let n=this.timestampQueryPool[e];n.allocateQueriesForContext(t)!==null&&n.beginQuery(t)}prepareTimestampBuffer(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e].endQuery(t)}getContext(){return this.gl}beginRender(e){let{state:t}=this,n=this.get(e);if(e.viewport)this.updateViewport(e);else{let{width:s,height:o}=this.getDrawingBufferSize();t.viewport(0,0,s,o)}if(e.scissor)this.updateScissor(e);else{let{width:s,height:o}=this.getDrawingBufferSize();t.scissor(0,0,s,o)}this.initTimestampQuery($c.RENDER,this.getTimestampUID(e)),n.previousContext=this._currentContext,this._currentContext=e,this._setFramebuffer(e),this.clear(e.clearColor,e.clearDepth,e.clearStencil,e,!1);let r=e.occlusionQueryCount;r>0&&(n.currentOcclusionQueries=n.occlusionQueries,n.currentOcclusionQueryObjects=n.occlusionQueryObjects,n.lastOcclusionObject=null,n.occlusionQueries=new Array(r),n.occlusionQueryObjects=new Array(r),n.occlusionQueryIndex=0)}finishRender(e){let{gl:t,state:n}=this,r=this.get(e),s=r.previousContext;n.resetVertexState();let o=e.occlusionQueryCount;o>0&&(o>r.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));let a=e.textures;if(a!==null)for(let l=0;l<a.length;l++){let c=a[l];c.generateMipmaps&&this.generateMipmaps(c)}if(this._currentContext=s,this._resolveRenderTarget(e),s!==null){if(this._setFramebuffer(s),s.viewport)this.updateViewport(s);else{let{width:l,height:c}=this.getDrawingBufferSize();n.viewport(0,0,l,c)}if(s.scissor)this.updateScissor(s);else{let{width:l,height:c}=this.getDrawingBufferSize();n.scissor(0,0,l,c)}}this.prepareTimestampBuffer($c.RENDER,this.getTimestampUID(e))}resolveOccludedAsync(e){let t=this.get(e),{currentOcclusionQueries:n,currentOcclusionQueryObjects:r}=t;if(n&&r){let s=new WeakSet,{gl:o}=this;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueries=null;let a=()=>{let l=0;for(let c=0;c<n.length;c++){let u=n[c];u!==null&&o.getQueryParameter(u,o.QUERY_RESULT_AVAILABLE)&&(o.getQueryParameter(u,o.QUERY_RESULT)===0&&s.add(r[c]),n[c]=null,o.deleteQuery(u),l++)}l<n.length?requestAnimationFrame(a):t.occluded=s};a()}}isOccluded(e,t){let n=this.get(e);return n.occluded&&n.occluded.has(t)}updateViewport(e){let{state:t}=this,{x:n,y:r,width:s,height:o}=e.viewportValue;t.viewport(n,e.height-o-r,s,o)}updateScissor(e){let{state:t}=this,{x:n,y:r,width:s,height:o}=e.scissorValue;t.scissor(n,e.height-o-r,s,o)}setScissorTest(e){this.state.setScissorTest(e)}getClearColor(){let e=super.getClearColor();return e.r*=e.a,e.g*=e.a,e.b*=e.a,e}clear(e,t,n,r=null,s=!0,o=!0){let{gl:a,renderer:l}=this;r===null&&(r={textures:null,clearColorValue:this.getClearColor()});let c=0;if(e&&(c|=a.COLOR_BUFFER_BIT),t&&(c|=a.DEPTH_BUFFER_BIT),n&&(c|=a.STENCIL_BUFFER_BIT),c!==0){let u;r.clearColorValue?u=r.clearColorValue:u=this.getClearColor();let f=l.getClearDepth(),d=l.getClearStencil();if(t&&this.state.setDepthMask(!0),r.textures===null)a.clearColor(u.r,u.g,u.b,u.a),a.clear(c);else{if(s&&this._setFramebuffer(r),e)for(let A=0;A<r.textures.length;A++)A===0?a.clearBufferfv(a.COLOR,A,[u.r,u.g,u.b,u.a]):a.clearBufferfv(a.COLOR,A,[0,0,0,1]);t&&n?a.clearBufferfi(a.DEPTH_STENCIL,0,f,d):t?a.clearBufferfv(a.DEPTH,0,[f]):n&&a.clearBufferiv(a.STENCIL,0,[d]),s&&o&&this._resolveRenderTarget(r),s&&this._currentContext!==null&&this._currentContext!==r&&this._setFramebuffer(this._currentContext)}}}beginCompute(e){let{state:t,gl:n}=this;t.bindFramebuffer(n.FRAMEBUFFER,null),this.initTimestampQuery($c.COMPUTE,this.getTimestampUID(e))}compute(e,t,n,r,s=null){let{state:o,gl:a}=this;this.discard===!1&&(o.enable(a.RASTERIZER_DISCARD),this.discard=!0);let{programGPU:l,transformBuffers:c,attributes:u}=this.get(r),f=this._getVaoKey(u),d=this.vaoCache[f];d===void 0?this.vaoCache[f]=this._createVao(u):o.setVertexState(d),o.useProgram(l),this._bindUniforms(n);let A=this._getTransformFeedback(c);a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,A),a.beginTransformFeedback(a.POINTS),s=s!==null?s:t.count,Array.isArray(s)?(ni("WebGLBackend.compute(): The count parameter must be a single number, not an array."),s=s[0]):s&&typeof s=="object"&&s.isIndirectStorageBufferAttribute&&(ni("WebGLBackend.compute(): The count parameter must be a single number, not IndirectStorageBufferAttribute"),s=t.count),u[0].isStorageInstancedBufferAttribute?a.drawArraysInstanced(a.POINTS,0,1,s):a.drawArrays(a.POINTS,0,s),a.endTransformFeedback(),a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,null);for(let y=0;y<c.length;y++){let w=c[y];w.pbo&&this.has(w.pbo)&&this.textureUtils.copyBufferToTexture(w.transformBuffer,w.pbo),w.switchBuffers()}}finishCompute(e){let{state:t,gl:n}=this;this.discard=!1,t.disable(n.RASTERIZER_DISCARD),this.prepareTimestampBuffer($c.COMPUTE,this.getTimestampUID(e)),this._currentContext&&this._setFramebuffer(this._currentContext)}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.isArrayTexture&&e.camera.isArrayCamera}_draw(e,t,n,r,s,o){if(e.isBatchedMesh)if(this.hasFeature("WEBGL_multi_draw")===!1){let{gl:a}=this,l=a.getUniformLocation(o,"nodeUniformDrawId"),c=e._multiDrawStarts,u=e._multiDrawCounts,f=e._multiDrawCount;for(let d=0;d<f;d++)a.uniform1ui(l,d),t.render(c[d],u[d])}else t.renderMultiDraw(e._multiDrawStarts,e._multiDrawCounts,e._multiDrawCount);else s>1?t.renderInstances(n,r,s):t.render(n,r)}draw(e){let{object:t,pipeline:n,material:r,context:s,hardwareClippingPlanes:o}=e,{programGPU:a}=this.get(n),{gl:l,state:c}=this,u=this.get(s),f=e.getDrawParameters();if(f===null)return;this._bindUniforms(e.getBindings());let d=t.isMesh&&t.matrixWorld.determinantAffine()<0;c.setMaterial(r,d,o),s.mrt!==null&&s.textures!==null&&c.setMRTBlending(s.textures,s.mrt,r),c.useProgram(a);let A=e.getAttributes(),y=this.get(A),w=y.vaoGPU;if(w===void 0){let L=this._getVaoKey(A);w=this.vaoCache[L],w===void 0&&(w=this._createVao(A),this.vaoCache[L]=w,y.vaoGPU=w)}let S=e.getIndex(),T=S!==null?this.get(S).bufferGPU:null;c.setVertexState(w,T);let R=u.lastOcclusionObject;if(R!==t&&R!==void 0){if(R!==null&&R.occlusionTest===!0&&(l.endQuery(l.ANY_SAMPLES_PASSED),u.occlusionQueryIndex++),t.occlusionTest===!0){let L=l.createQuery();l.beginQuery(l.ANY_SAMPLES_PASSED,L),u.occlusionQueries[u.occlusionQueryIndex]=L,u.occlusionQueryObjects[u.occlusionQueryIndex]=t}u.lastOcclusionObject=t}let P=this.bufferRenderer;t.isPoints?P.mode=l.POINTS:t.isLineSegments?P.mode=l.LINES:t.isLine?P.mode=l.LINE_STRIP:t.isLineLoop?P.mode=l.LINE_LOOP:r.wireframe===!0?(c.setLineWidth(r.wireframeLinewidth*this.renderer.getPixelRatio()),P.mode=l.LINES):P.mode=l.TRIANGLES;let{vertexCount:I,instanceCount:F}=f,{firstVertex:D}=f;if(P.object=t,S!==null){D*=S.array.BYTES_PER_ELEMENT;let L=this.get(S);P.index=S.count,P.type=L.type}else P.index=0;if(e.camera.isArrayCamera===!0&&e.camera.cameras.length>0&&e.camera.isMultiViewCamera===!1){let L=this.get(e.camera),C=e.camera.cameras,B=e.getBindingGroup("cameraIndex").bindings[0];if(L.indexesGPU===void 0||L.indexesGPU.length!==C.length){let H=new Uint32Array([0,0,0,0]),$=[];for(let J=0,te=C.length;J<te;J++){let ce=l.createBuffer();H[0]=J,l.bindBuffer(l.UNIFORM_BUFFER,ce),l.bufferData(l.UNIFORM_BUFFER,H,l.STATIC_DRAW),$.push(ce)}L.indexesGPU=$}let k=0;e:for(let H of e.getBindings())for(let $ of H.bindings){if($===B)break e;($.isUniformsGroup||$.isUniformBuffer)&&k++}let z=this.renderer.getPixelRatio(),G=this._currentContext.renderTarget,W=this._isRenderCameraDepthArray(this._currentContext),Y=this._currentContext.activeCubeFace;if(W){let H=this.get(G.depthTexture);if(H.clearedRenderId!==this.renderer._nodes.nodeFrame.renderId){H.clearedRenderId=this.renderer._nodes.nodeFrame.renderId;let{stencilBuffer:$}=G;for(let J=0,te=C.length;J<te;J++)this.renderer._activeCubeFace=J,this._currentContext.activeCubeFace=J,this._setFramebuffer(this._currentContext),this.clear(!1,!0,$,this._currentContext,!1,!1);this.renderer._activeCubeFace=Y,this._currentContext.activeCubeFace=Y}}for(let H=0,$=C.length;H<$;H++){let J=C[H];if(t.layers.test(J.layers)){W&&(this.renderer._activeCubeFace=H,this._currentContext.activeCubeFace=H,this._setFramebuffer(this._currentContext));let te=J.viewport;if(te!==void 0){let ce=te.x*z,he=te.y*z,ve=te.width*z,Re=te.height*z;c.viewport(Math.floor(ce),Math.floor(e.context.height-Re-he),Math.floor(ve),Math.floor(Re))}c.bindBufferBase(l.UNIFORM_BUFFER,k,L.indexesGPU[H]),this._draw(t,P,D,I,F,a)}this._currentContext.activeCubeFace=Y,this.renderer._activeCubeFace=Y}}else this._draw(t,P,D,I,F,a)}needsRenderUpdate(){return!1}getRenderCacheKey(){return""}createDefaultTexture(e){this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,n,r,s,o){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,o)}updateSampler(){return""}createNodeBuilder(e,t){return new x9(e,t)}createProgram(e){let t=this.gl,{stage:n,code:r}=e,s=n==="fragment"?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER);t.shaderSource(s,r),t.compileShader(s),this.set(e,{shaderGPU:s})}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){let n=this.gl,r=e.pipeline,{fragmentProgram:s,vertexProgram:o}=r,a=n.createProgram(),l=this.get(s).shaderGPU,c=this.get(o).shaderGPU;if(n.attachShader(a,l),n.attachShader(a,c),n.linkProgram(a),this.set(r,{programGPU:a,fragmentShader:l,vertexShader:c}),t!==null&&this.parallel){let u=new Promise(f=>{let d=this.parallel,A=()=>{n.getProgramParameter(a,d.COMPLETION_STATUS_KHR)?(this._completeCompile(e,r),f()):requestAnimationFrame(A)};A()});t.push(u);return}this._completeCompile(e,r)}_handleSource(e,t){let n=e.split(`4358+`)}}this.material!==null?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,n,r=null){let s=super.getUniformFromNode(e,t,n,r),o=this.getDataFromNode(e,n,this.globalCache),a=o.uniformGPU;if(a===void 0){let l=e.groupNode,c=l.name,u=this.getBindGroupArray(c,n);if(t==="texture")a=new vx(s.name,s.node,l),u.push(a);else if(t==="cubeTexture"||t==="cubeDepthTexture")a=new tP(s.name,s.node,l),u.push(a);else if(t==="texture3D")a=new RS(s.name,s.node,l),u.push(a);else if(t==="buffer"){s.name=`buffer${e.id}`;let f=this.getSharedDataFromNode(e),d=f.buffer;d===void 0&&(e.name=`NodeBuffer_${e.id}`,d=new Q4(e,l),d.name=e.name,f.buffer=d),u.push(d),a=d}else{let f=this.uniformGroups[c];f===void 0?(f=new J4(c,l),this.uniformGroups[c]=f,u.push(f)):u.indexOf(f)===-1&&u.push(f),a=this.getNodeUniform(s,t);let d=a.name;f.uniforms.some(y=>y.name===d)||f.addUniform(a)}o.uniformGPU=a}return s}},uU=null,X_=null,nP=class{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[Hc.RENDER]:null,[Hc.COMPUTE]:null},this.trackTimestamp=e.trackTimestamp===!0}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}setXRTarget(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}updateSampler(){}destroySampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}async copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}createUniformBuffer(){}destroyUniformBuffer(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}updateTimeStampUID(e){let t=this.get(e),n=this.renderer.info.frame,r;e.isComputeNode===!0?r="c:"+this.renderer.info.compute.frameCalls:r="r:"+this.renderer.info.render.frameCalls,t.timestampUID=r+":"+e.id+":f"+n}getTimestampUID(e){return this.get(e).timestampUID}getTimestampFrames(e){let t=this.timestampQueryPool[e];return t?t.getTimestampFrames():[]}_getQueryPool(e){let t=e.startsWith("c:")?Hc.COMPUTE:Hc.RENDER;return this.timestampQueryPool[t]}getTimestamp(e){return this._getQueryPool(e).getTimestamp(e)}get hasTimestamp(){return!1}hasTimestampQuery(e){return this._getQueryPool(e).hasTimestampQuery(e)}isOccluded(){}async resolveTimestampsAsync(e="render"){if(!this.trackTimestamp){ni("WebGPURenderer: Timestamp tracking is disabled.");return}let t=this.timestampQueryPool[e];if(!t)return;let n=await t.resolveQueriesAsync();return this.renderer.info[e].timestamp=n,n}async getArrayBufferAsync(){}async hasFeatureAsync(){}hasFeature(){}getDrawingBufferSize(){return uU=uU||new Oe,this.renderer.getDrawingBufferSize(uU)}setScissorTest(){}getClearColor(){let e=this.renderer;return X_=X_||new xS,e.getClearColor(X_),X_.getRGB(X_),X_}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:zM(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${"185"} webgpu`),this.domElement=e),e}hasCompatibility(){return!1}initRenderTarget(){}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}deleteBindGroupData(){}dispose(){}},CIe=0,y9=class{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[this.activeBufferIndex^1]}switchBuffers(){this.activeBufferIndex^=1}},b9=class{constructor(e){this.backend=e}createAttribute(e,t){let n=this.backend,{gl:r}=n,s=e.array,o=e.usage||r.STATIC_DRAW,a=e.isInterleavedBufferAttribute?e.data:e,l=n.get(a),c=l.bufferGPU;c===void 0&&(c=this._createBuffer(r,t,s,o),l.bufferGPU=c,l.bufferType=t,l.version=a.version);let u;if(s instanceof Float32Array)u=r.FLOAT;else if(typeof Float16Array<"u"&&s instanceof Float16Array)u=r.HALF_FLOAT;else if(s instanceof Uint16Array)e.isFloat16BufferAttribute?u=r.HALF_FLOAT:u=r.UNSIGNED_SHORT;else if(s instanceof Int16Array)u=r.SHORT;else if(s instanceof Uint32Array)u=r.UNSIGNED_INT;else if(s instanceof Int32Array)u=r.INT;else if(s instanceof Int8Array)u=r.BYTE;else if(s instanceof Uint8Array)u=r.UNSIGNED_BYTE;else if(s instanceof Uint8ClampedArray)u=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+s);let f={bufferGPU:c,bufferType:t,type:u,byteLength:s.byteLength,bytesPerElement:s.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:u===r.INT||u===r.UNSIGNED_INT||e.gpuType===Kr,id:CIe++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){let d=this._createBuffer(r,t,s,o);f=new y9(f,d)}n.set(e,f)}updateAttribute(e){let t=this.backend,{gl:n}=t,r=e.array,s=e.isInterleavedBufferAttribute?e.data:e,o=t.get(s),a=o.bufferType,l=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(n.bindBuffer(a,o.bufferGPU),l.length===0)n.bufferSubData(a,0,r);else{for(let c=0,u=l.length;c<u;c++){let f=l[c];n.bufferSubData(a,f.start*r.BYTES_PER_ELEMENT,r,f.start,f.count)}s.clearUpdateRanges()}n.bindBuffer(a,null),o.version=s.version}destroyAttribute(e){let t=this.backend,{gl:n}=t;e.isInterleavedBufferAttribute&&t.delete(e.data);let r=t.get(e);n.deleteBuffer(r.bufferGPU),t.delete(e)}async getArrayBufferAsync(e,t=null,n=0,r=-1){let s=this.backend,{gl:o}=s,a=e.isInterleavedBufferAttribute?e.data:e,l=s.get(a),{bufferGPU:c}=l,u=r===-1?l.byteLength-n:r,f;if(t===null)f=new Uint8Array(new ArrayBuffer(u));else if(t.isReadbackBuffer){if(t._mapped===!0)throw new Error("THREE.WebGPURenderer: ReadbackBuffer must be released before being used again.");let d=()=>{t.buffer=null,t._mapped=!1,t.removeEventListener("release",d),t.removeEventListener("dispose",d)};t.addEventListener("release",d),t.addEventListener("dispose",d),f=new Uint8Array(new ArrayBuffer(u)),t.buffer=f.buffer}else f=new Uint8Array(t);return o.bindBuffer(o.COPY_READ_BUFFER,c),o.getBufferSubData(o.COPY_READ_BUFFER,n,f),o.bindBuffer(o.COPY_READ_BUFFER,null),o.bindBuffer(o.COPY_WRITE_BUFFER,null),t&&t.isReadbackBuffer?t:f.buffer}_createBuffer(e,t,n,r){let s=e.createBuffer();return e.bindBuffer(t,s),e.bufferData(t,n,r),e.bindBuffer(t,null),s}},Xw,Hd,w9=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.enabled={},this.parameters={},this.currentFlipSided=null,this.currentCullFace=null,this.currentProgram=null,this.currentBlendingEnabled=!1,this.currentBlending=null,this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentPremultipledAlpha=null,this.currentPolygonOffsetFactor=null,this.currentPolygonOffsetUnits=null,this.currentColorMask=null,this.currentDepthReversed=!1,this.currentDepthFunc=null,this.currentDepthMask=null,this.currentStencilFunc=null,this.currentStencilRef=null,this.currentStencilFuncMask=null,this.currentStencilFail=null,this.currentStencilZFail=null,this.currentStencilZPass=null,this.currentStencilMask=null,this.currentLineWidth=null,this.currentClippingPlanes=0,this.currentVAO=null,this.currentIndex=null,this.currentBoundFramebuffers={},this.currentDrawbuffers=new WeakMap,this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this.currentTextureSlot=null,this.currentBoundTextures={},this.currentBoundBufferBases={},this._init()}_init(){let e=this.gl;Xw={[oo]:e.FUNC_ADD,[db]:e.FUNC_SUBTRACT,[pb]:e.FUNC_REVERSE_SUBTRACT},Hd={[Nu]:e.ZERO,[mb]:e.ONE,[Ab]:e.SRC_COLOR,[Jp]:e.SRC_ALPHA,[bb]:e.SRC_ALPHA_SATURATE,[xb]:e.DST_COLOR,[vb]:e.DST_ALPHA,[gb]:e.ONE_MINUS_SRC_COLOR,[e0]:e.ONE_MINUS_SRC_ALPHA,[yb]:e.ONE_MINUS_DST_COLOR,[_b]:e.ONE_MINUS_DST_ALPHA};let t=e.getParameter(e.SCISSOR_BOX),n=e.getParameter(e.VIEWPORT);this.currentScissor=new xn().fromArray(t),this.currentViewport=new xn().fromArray(n),this._tempVec4=new xn}enable(e){let{enabled:t}=this;t[e]!==!0&&(this.gl.enable(e),t[e]=!0)}disable(e){let{enabled:t}=this;t[e]!==!1&&(this.gl.disable(e),t[e]=!1)}setFlipSided(e){if(this.currentFlipSided!==e){let{gl:t}=this;e?t.frontFace(t.CW):t.frontFace(t.CCW),this.currentFlipSided=e}}setCullFace(e){let{gl:t}=this;e!==PM?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===hb?t.cullFace(t.BACK):e===IM?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):this.disable(t.CULL_FACE),this.currentCullFace=e}setLineWidth(e){let{currentLineWidth:t,gl:n}=this;e!==t&&(n.lineWidth(e),this.currentLineWidth=e)}setMRTBlending(e,t,n){let r=this.gl,s=this.backend.drawBuffersIndexedExt;if(!s){ni("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets.");return}for(let o=0;o<e.length;o++){let a=e[o],l=null;if(t!==null){let c=t.getBlendMode(a.name);c.blending===fb?l=n:c.blending!==ps&&(l=c)}else l=n;l!==null?this._setMRTBlendingIndex(o,l):s.blendFuncSeparateiOES(o,r.ONE,r.ZERO,r.ONE,r.ZERO)}}_setMRTBlendingIndex(e,t){let{gl:n}=this,r=this.backend.drawBuffersIndexedExt,s=t.blending,o=t.blendSrc,a=t.blendDst,l=t.blendEquation,c=t.premultipliedAlpha;if(s===Dd){let u=t.blendSrcAlpha!==null?t.blendSrcAlpha:o,f=t.blendDstAlpha!==null?t.blendDstAlpha:a,d=t.blendEquationAlpha!==null?t.blendEquationAlpha:l;r.blendEquationSeparateiOES(e,Xw[l],Xw[d]),r.blendFuncSeparateiOES(e,Hd[o],Hd[a],Hd[u],Hd[f])}else if(r.blendEquationSeparateiOES(e,n.FUNC_ADD,n.FUNC_ADD),c)switch(s){case Ts:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Dh:r.blendFuncSeparateiOES(e,n.ONE,n.ONE,n.ONE,n.ONE);break;case Nh:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Fh:r.blendFuncSeparateiOES(e,n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break}else switch(s){case Ts:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Dh:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case Nh:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Fh:r.blendFuncSeparateiOES(e,n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break}}setBlending(e,t,n,r,s,o,a,l){let{gl:c}=this;if(e===ps){this.currentBlendingEnabled===!0&&(this.disable(c.BLEND),this.currentBlendingEnabled=!1);return}if(this.currentBlendingEnabled===!1&&(this.enable(c.BLEND),this.currentBlendingEnabled=!0),e!==Dd){if(e!==this.currentBlending||l!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==oo||this.currentBlendEquationAlpha!==oo)&&(c.blendEquation(c.FUNC_ADD),this.currentBlendEquation=oo,this.currentBlendEquationAlpha=oo),l)switch(e){case Ts:c.blendFuncSeparate(c.ONE,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case Dh:c.blendFunc(c.ONE,c.ONE);break;case Nh:c.blendFuncSeparate(c.ZERO,c.ONE_MINUS_SRC_COLOR,c.ZERO,c.ONE);break;case Fh:c.blendFuncSeparate(c.DST_COLOR,c.ONE_MINUS_SRC_ALPHA,c.ZERO,c.ONE);break;default:ze("WebGLState: Invalid blending: ",e);break}else switch(e){case Ts:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case Dh:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE,c.ONE,c.ONE);break;case Nh:ze("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Fh:ze("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ze("WebGLState: Invalid blending: ",e);break}this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentBlending=e,this.currentPremultipledAlpha=l}return}s=s||t,o=o||n,a=a||r,(t!==this.currentBlendEquation||s!==this.currentBlendEquationAlpha)&&(c.blendEquationSeparate(Xw[t],Xw[s]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=s),(n!==this.currentBlendSrc||r!==this.currentBlendDst||o!==this.currentBlendSrcAlpha||a!==this.currentBlendDstAlpha)&&(c.blendFuncSeparate(Hd[n],Hd[r],Hd[o],Hd[a]),this.currentBlendSrc=n,this.currentBlendDst=r,this.currentBlendSrcAlpha=o,this.currentBlendDstAlpha=a),this.currentBlending=e,this.currentPremultipledAlpha=!1}setColorMask(e){this.currentColorMask!==e&&(this.gl.colorMask(e,e,e,e),this.currentColorMask=e)}setDepthTest(e){let{gl:t}=this;e?this.enable(t.DEPTH_TEST):this.disable(t.DEPTH_TEST)}setReversedDepth(e){if(this.currentDepthReversed!==e){let t=this.backend.extensions.get("EXT_clip_control");e?t.clipControlEXT(t.LOWER_LEFT_EXT,t.ZERO_TO_ONE_EXT):t.clipControlEXT(t.LOWER_LEFT_EXT,t.NEGATIVE_ONE_TO_ONE_EXT),this.currentDepthReversed=e}}setDepthMask(e){this.currentDepthMask!==e&&(this.gl.depthMask(e),this.currentDepthMask=e)}setDepthFunc(e){if(this.currentDepthReversed&&(e=Ob[e]),this.currentDepthFunc!==e){let{gl:t}=this;switch(e){case LA:t.depthFunc(t.NEVER);break;case DA:t.depthFunc(t.ALWAYS);break;case NA:t.depthFunc(t.LESS);break;case Ch:t.depthFunc(t.LEQUAL);break;case FA:t.depthFunc(t.EQUAL);break;case BA:t.depthFunc(t.GEQUAL);break;case OA:t.depthFunc(t.GREATER);break;case UA:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}this.currentDepthFunc=e}}scissor(e,t,n,r){let s=this._tempVec4.set(e,t,n,r);if(this.currentScissor.equals(s)===!1){let{gl:o}=this;o.scissor(s.x,s.y,s.z,s.w),this.currentScissor.copy(s)}}viewport(e,t,n,r){let s=this._tempVec4.set(e,t,n,r);if(this.currentViewport.equals(s)===!1){let{gl:o}=this;o.viewport(s.x,s.y,s.z,s.w),this.currentViewport.copy(s)}}setScissorTest(e){let t=this.gl;e?this.enable(t.SCISSOR_TEST):this.disable(t.SCISSOR_TEST)}setStencilTest(e){let{gl:t}=this;e?this.enable(t.STENCIL_TEST):this.disable(t.STENCIL_TEST)}setStencilMask(e){this.currentStencilMask!==e&&(this.gl.stencilMask(e),this.currentStencilMask=e)}setStencilFunc(e,t,n){(this.currentStencilFunc!==e||this.currentStencilRef!==t||this.currentStencilFuncMask!==n)&&(this.gl.stencilFunc(e,t,n),this.currentStencilFunc=e,this.currentStencilRef=t,this.currentStencilFuncMask=n)}setStencilOp(e,t,n){(this.currentStencilFail!==e||this.currentStencilZFail!==t||this.currentStencilZPass!==n)&&(this.gl.stencilOp(e,t,n),this.currentStencilFail=e,this.currentStencilZFail=t,this.currentStencilZPass=n)}setMaterial(e,t,n){let{gl:r}=this;e.side===vr?this.disable(r.CULL_FACE):this.enable(r.CULL_FACE);let s=e.side===mi;t&&(s=!s),this.setFlipSided(s),e.blending===Ts&&e.transparent===!1?this.setBlending(ps):this.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),this.setDepthFunc(e.depthFunc),this.setDepthTest(e.depthTest),this.setDepthMask(e.depthWrite),this.setColorMask(e.colorWrite);let o=e.stencilWrite;if(this.setStencilTest(o),o&&(this.setStencilMask(e.stencilWriteMask),this.setStencilFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),this.setStencilOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),this.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),e.alphaToCoverage===!0&&this.backend.renderer.currentSamples>0?this.enable(r.SAMPLE_ALPHA_TO_COVERAGE):this.disable(r.SAMPLE_ALPHA_TO_COVERAGE),n>0&&this.currentClippingPlanes!==n)for(let l=0;l<8;l++)l<n?this.enable(12288+l):this.disable(12288+l)}setPolygonOffset(e,t,n){let{gl:r}=this;e?(this.enable(r.POLYGON_OFFSET_FILL),(this.currentPolygonOffsetFactor!==t||this.currentPolygonOffsetUnits!==n)&&(r.polygonOffset(t,n),this.currentPolygonOffsetFactor=t,this.currentPolygonOffsetUnits=n)):this.disable(r.POLYGON_OFFSET_FILL)}useProgram(e){return this.currentProgram!==e?(this.gl.useProgram(e),this.currentProgram=e,!0):!1}setVertexState(e,t=null){let n=this.gl;return this.currentVAO!==e||this.currentIndex!==t?(n.bindVertexArray(e),t!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.currentVAO=e,this.currentIndex=t,!0):!1}resetVertexState(){let e=this.gl;e.bindVertexArray(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),this.currentVAO=null,this.currentIndex=null}bindFramebuffer(e,t){let{gl:n,currentBoundFramebuffers:r}=this;return r[e]!==t?(n.bindFramebuffer(e,t),r[e]=t,e===n.DRAW_FRAMEBUFFER&&(r[n.FRAMEBUFFER]=t),e===n.FRAMEBUFFER&&(r[n.DRAW_FRAMEBUFFER]=t),!0):!1}drawBuffers(e,t){let{gl:n}=this,r=[],s=!1;if(e.textures!==null){r=this.currentDrawbuffers.get(t),r===void 0&&(r=[],this.currentDrawbuffers.set(t,r));let o=e.textures;if(r.length!==o.length||r[0]!==n.COLOR_ATTACHMENT0){for(let a=0,l=o.length;a<l;a++)r[a]=n.COLOR_ATTACHMENT0+a;r.length=o.length,s=!0}}else r[0]!==n.BACK&&(r[0]=n.BACK,s=!0);s&&n.drawBuffers(r)}activeTexture(e){let{gl:t,currentTextureSlot:n,maxTextures:r}=this;e===void 0&&(e=t.TEXTURE0+r-1),n!==e&&(t.activeTexture(e),this.currentTextureSlot=e)}bindTexture(e,t,n){let{gl:r,currentTextureSlot:s,currentBoundTextures:o,maxTextures:a}=this;n===void 0&&(s===null?n=r.TEXTURE0+a-1:n=s);let l=o[n];l===void 0&&(l={type:void 0,texture:void 0},o[n]=l),(l.type!==e||l.texture!==t)&&(s!==n&&(r.activeTexture(n),this.currentTextureSlot=n),r.bindTexture(e,t),l.type=e,l.texture=t)}bindBufferBase(e,t,n){let{gl:r}=this,s=`${e}-${t}`;return this.currentBoundBufferBases[s]!==n?(r.bindBufferBase(e,t,n),this.currentBoundBufferBases[s]=n,!0):!1}unbindTexture(){let{gl:e,currentTextureSlot:t,currentBoundTextures:n}=this,r=n[t];r!==void 0&&r.type!==void 0&&(e.bindTexture(r.type,null),r.type=void 0,r.texture=void 0)}getParameter(e){let{gl:t,parameters:n}=this;return n[e]!==void 0?n[e]:t.getParameter(e)}pixelStorei(e,t){let{gl:n,parameters:r}=this;r[e]!==t&&(n.pixelStorei(e,t),r[e]=t)}},S9=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=ha){let{gl:n,extensions:r}=this,s,o=ln.getTransfer(t);if(e===Ji)return n.UNSIGNED_BYTE;if(e===ng)return n.UNSIGNED_SHORT_4_4_4_4;if(e===ig)return n.UNSIGNED_SHORT_5_5_5_1;if(e===rg)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===sg)return n.UNSIGNED_INT_10F_11F_11F_REV;if(e===Oh)return n.BYTE;if(e===Uh)return n.SHORT;if(e===wl)return n.UNSIGNED_SHORT;if(e===Kr)return n.INT;if(e===xi)return n.UNSIGNED_INT;if(e===cr)return n.FLOAT;if(e===Wi)return n.HALF_FLOAT;if(e===u_)return n.ALPHA;if(e===Nd)return n.RGB;if(e===Or)return n.RGBA;if(e===Vs)return n.DEPTH_COMPONENT;if(e===xo)return n.DEPTH_STENCIL;if(e===Fd)return n.RED;if(e===kh)return n.RED_INTEGER;if(e===Ws)return n.RG;if(e===zh)return n.RG_INTEGER;if(e===g0)return n.RGBA_INTEGER;if(e===Vh||e===Gh||e===qh||e===Hh)if(o===kt)if(s=r.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(e===Vh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===Gh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===qh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===Hh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=r.get("WEBGL_compressed_texture_s3tc"),s!==null){if(e===Vh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Gh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===qh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===Hh)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===og||e===ag||e===lg||e===cg)if(s=r.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(e===og)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===ag)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===lg)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===cg)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===v0||e===_0||e===x0||e===y0||e===b0||e===Wh||e===w0)if(s=r.get("WEBGL_compressed_texture_etc"),s!==null){if(e===v0||e===_0)return o===kt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(e===x0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(e===y0)return s.COMPRESSED_R11_EAC;if(e===b0)return s.COMPRESSED_SIGNED_R11_EAC;if(e===Wh)return s.COMPRESSED_RG11_EAC;if(e===w0)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(e===S0||e===T0||e===E0||e===M0||e===C0||e===R0||e===P0||e===I0||e===L0||e===D0||e===N0||e===F0||e===B0||e===O0)if(s=r.get("WEBGL_compressed_texture_astc"),s!==null){if(e===S0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===T0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===E0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===M0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===C0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===R0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===P0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===I0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===L0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===D0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===N0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===F0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===B0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===O0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===U0||e===k0||e===z0)if(s=r.get("EXT_texture_compression_bptc"),s!==null){if(e===U0)return o===kt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(e===k0)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(e===z0)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(e===V0||e===G0||e===jh||e===q0)if(s=r.get("EXT_texture_compression_rgtc"),s!==null){if(e===V0)return s.COMPRESSED_RED_RGTC1_EXT;if(e===G0)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===jh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===q0)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===ua?n.UNSIGNED_INT_24_8:n[e]!==void 0?n[e]:null}_clientWaitAsync(){let{gl:e}=this,t=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);return e.flush(),new Promise((n,r)=>{function s(){let o=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(o===e.WAIT_FAILED){e.deleteSync(t),r();return}if(o===e.TIMEOUT_EXPIRED){requestAnimationFrame(s);return}e.deleteSync(t),n()}s()})}},Gte=!1,OR,hU,qte,T9=class{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,Gte===!1&&(this._init(),Gte=!0)}_init(){let e=this.gl;OR={[Ed]:e.REPEAT,[la]:e.CLAMP_TO_EDGE,[Md]:e.MIRRORED_REPEAT},hU={[Ti]:e.NEAREST,[Pb]:e.NEAREST_MIPMAP_NEAREST,[qc]:e.NEAREST_MIPMAP_LINEAR,[Mi]:e.LINEAR,[A0]:e.LINEAR_MIPMAP_NEAREST,[Go]:e.LINEAR_MIPMAP_LINEAR},qte={[Db]:e.NEVER,[Bb]:e.ALWAYS,[h_]:e.LESS,[Xh]:e.LEQUAL,[Nb]:e.EQUAL,[Fu]:e.GEQUAL,[ug]:e.GREATER,[Fb]:e.NOTEQUAL}}getGLTextureType(e){let{gl:t}=this,n;return e.isCubeTexture===!0?n=t.TEXTURE_CUBE_MAP:e.isArrayTexture===!0||e.isDataArrayTexture===!0||e.isCompressedArrayTexture===!0?n=t.TEXTURE_2D_ARRAY:e.isData3DTexture===!0?n=t.TEXTURE_3D:n=t.TEXTURE_2D,n}getInternalFormat(e,t,n,r,s,o=!1){let{gl:a,extensions:l}=this;if(e!==null){if(a[e]!==void 0)return a[e];Xe("WebGLBackend: Attempt to use non-existing WebGL internal format '"+e+"'")}let c=null;r&&(c=l.get("EXT_texture_norm16"),c||Xe("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let u=t;if(t===a.RED&&(n===a.FLOAT&&(u=a.R32F),n===a.HALF_FLOAT&&(u=a.R16F),n===a.UNSIGNED_BYTE&&(u=a.R8),n===a.BYTE&&(u=a.R8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.R16_EXT),n===a.SHORT&&c&&(u=c.R16_SNORM_EXT)),t===a.RED_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.R8UI),n===a.UNSIGNED_SHORT&&(u=a.R16UI),n===a.UNSIGNED_INT&&(u=a.R32UI),n===a.BYTE&&(u=a.R8I),n===a.SHORT&&(u=a.R16I),n===a.INT&&(u=a.R32I)),t===a.RG&&(n===a.FLOAT&&(u=a.RG32F),n===a.HALF_FLOAT&&(u=a.RG16F),n===a.UNSIGNED_BYTE&&(u=a.RG8),n===a.BYTE&&(u=a.RG8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RG16_EXT),n===a.SHORT&&c&&(u=c.RG16_SNORM_EXT)),t===a.RG_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RG8UI),n===a.UNSIGNED_SHORT&&(u=a.RG16UI),n===a.UNSIGNED_INT&&(u=a.RG32UI),n===a.BYTE&&(u=a.RG8I),n===a.SHORT&&(u=a.RG16I),n===a.INT&&(u=a.RG32I)),t===a.RGB){let f=o?n0:ln.getTransfer(s);n===a.FLOAT&&(u=a.RGB32F),n===a.HALF_FLOAT&&(u=a.RGB16F),n===a.UNSIGNED_BYTE&&(u=f===kt?a.SRGB8:a.RGB8),n===a.BYTE&&(u=a.RGB8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RGB16_EXT),n===a.SHORT&&c&&(u=c.RGB16_SNORM_EXT),n===a.UNSIGNED_SHORT_5_6_5&&(u=a.RGB565),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGB4),n===a.UNSIGNED_INT_5_9_9_9_REV&&(u=a.RGB9_E5),n===a.UNSIGNED_INT_10F_11F_11F_REV&&(u=a.R11F_G11F_B10F)}if(t===a.RGB_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGB8UI),n===a.UNSIGNED_SHORT&&(u=a.RGB16UI),n===a.UNSIGNED_INT&&(u=a.RGB32UI),n===a.BYTE&&(u=a.RGB8I),n===a.SHORT&&(u=a.RGB16I),n===a.INT&&(u=a.RGB32I)),t===a.RGBA){let f=o?n0:ln.getTransfer(s);n===a.FLOAT&&(u=a.RGBA32F),n===a.HALF_FLOAT&&(u=a.RGBA16F),n===a.UNSIGNED_BYTE&&(u=f===kt?a.SRGB8_ALPHA8:a.RGBA8),n===a.BYTE&&(u=a.RGBA8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RGBA16_EXT),n===a.SHORT&&c&&(u=c.RGBA16_SNORM_EXT),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGBA4),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1)}return t===a.RGBA_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGBA8UI),n===a.UNSIGNED_SHORT&&(u=a.RGBA16UI),n===a.UNSIGNED_INT&&(u=a.RGBA32UI),n===a.BYTE&&(u=a.RGBA8I),n===a.SHORT&&(u=a.RGBA16I),n===a.INT&&(u=a.RGBA32I)),t===a.DEPTH_COMPONENT&&(n===a.UNSIGNED_SHORT&&(u=a.DEPTH_COMPONENT16),n===a.UNSIGNED_INT&&(u=a.DEPTH_COMPONENT24),n===a.FLOAT&&(u=a.DEPTH_COMPONENT32F)),t===a.DEPTH_STENCIL&&n===a.UNSIGNED_INT_24_8&&(u=a.DEPTH24_STENCIL8),(u===a.R16F||u===a.R32F||u===a.RG16F||u===a.RG32F||u===a.RGBA16F||u===a.RGBA32F)&&l.get("EXT_color_buffer_float"),u}setTextureParameters(e,t){let{gl:n,extensions:r,backend:s}=this,{state:o}=this.backend,a=ln.getPrimaries(ln.workingColorSpace),l=t.colorSpace===ha?null:ln.getPrimaries(t.colorSpace),c=t.colorSpace===ha||a===l?n.NONE:n.BROWSER_DEFAULT_WEBGL;o.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t.flipY),o.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),o.pixelStorei(n.UNPACK_ALIGNMENT,t.unpackAlignment),o.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,c),n.texParameteri(e,n.TEXTURE_WRAP_S,OR[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,OR[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,OR[t.wrapR])),n.texParameteri(e,n.TEXTURE_MAG_FILTER,hU[t.magFilter]);let u=t.mipmaps!==void 0&&t.mipmaps.length>0,f=t.minFilter===Mi&&u?Go:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,hU[f]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,qte[t.compareFunction])),r.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===Ti||t.minFilter!==qc&&t.minFilter!==Go||t.type===cr&&r.has("OES_texture_float_linear")===!1)return;if(t.anisotropy>1){let d=r.get("EXT_texture_filter_anisotropic");n.texParameterf(e,d.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,s.capabilities.getMaxAnisotropy()))}}}createDefaultTexture(e){let{gl:t,backend:n,defaultTextures:r}=this,s=this.getGLTextureType(e),o=r[s];o===void 0&&(o=t.createTexture(),n.state.bindTexture(s,o),t.texParameteri(s,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(s,t.TEXTURE_MAG_FILTER,t.NEAREST),r[s]=o),n.set(e,{textureGPU:o,glTextureType:s})}createTexture(e,t){let{gl:n,backend:r}=this,s,o,a,l,c;if(e.isExternalTexture===!0)s=e.sourceTexture,o=this.getGLTextureType(e);else{let{levels:u,width:f,height:d,depth:A}=t;a=r.utils.convert(e.format,e.colorSpace),l=r.utils.convert(e.type),c=this.getInternalFormat(e.internalFormat,a,l,e.normalized,e.colorSpace,e.isVideoTexture),s=n.createTexture(),o=this.getGLTextureType(e),r.state.bindTexture(o,s),this.setTextureParameters(o,e),e.isArrayTexture||e.isDataArrayTexture||e.isCompressedArrayTexture?n.texStorage3D(n.TEXTURE_2D_ARRAY,u,c,f,d,A):e.isData3DTexture?n.texStorage3D(n.TEXTURE_3D,u,c,f,d,A):e.isVideoTexture||n.texStorage2D(o,u,c,f,d)}r.set(e,{textureGPU:s,glTextureType:o,glFormat:a,glType:l,glInternalFormat:c})}copyBufferToTexture(e,t){let{gl:n,backend:r}=this,{state:s}=r,{textureGPU:o,glTextureType:a,glFormat:l,glType:c}=r.get(t),{width:u,height:f}=t.source.data;n.bindBuffer(n.PIXEL_UNPACK_BUFFER,e),r.state.bindTexture(a,o),s.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),s.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.texSubImage2D(a,0,0,0,u,f,l,c,0),n.bindBuffer(n.PIXEL_UNPACK_BUFFER,null),r.state.unbindTexture()}updateTexture(e,t){let{gl:n}=this,{width:r,height:s}=t,{textureGPU:o,glTextureType:a,glFormat:l,glType:c,glInternalFormat:u}=this.backend.get(e);if(!(e.isRenderTargetTexture||o===void 0))if(this.backend.state.bindTexture(a,o),this.setTextureParameters(a,e),e.isCompressedTexture){let f=e.mipmaps,d=t.image;for(let A=0;A<f.length;A++){let y=f[A];e.isCompressedArrayTexture?e.format!==n.RGBA?l!==null?n.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,A,0,0,0,y.width,y.height,d.depth,l,y.data):Xe("WebGLBackend: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texSubImage3D(n.TEXTURE_2D_ARRAY,A,0,0,0,y.width,y.height,d.depth,l,c,y.data):l!==null?n.compressedTexSubImage2D(n.TEXTURE_2D,A,0,0,y.width,y.height,l,y.data):Xe("WebGLBackend: Unsupported compressed texture format")}}else if(e.isCubeTexture){let f=t.images,d=e.mipmaps;for(let A=0;A<6;A++){let y=UR(f[A]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+A,0,0,0,r,s,l,c,y);for(let w=0;w<d.length;w++){let S=d[w],T=UR(S.images[A]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+A,w+1,0,0,T.width,T.height,l,c,T)}}}else if(e.isDataArrayTexture||e.isArrayTexture){let f=t.image;if(e.layerUpdates.size>0){let d=Ub(f.width,f.height,e.format,e.type);for(let A of e.layerUpdates){let y=f.data.subarray(A*d/f.data.BYTES_PER_ELEMENT,(A+1)*d/f.data.BYTES_PER_ELEMENT);n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,A,f.width,f.height,1,l,c,y)}e.clearLayerUpdates()}else n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,f.width,f.height,f.depth,l,c,f.data)}else if(e.isData3DTexture){let f=t.image;n.texSubImage3D(n.TEXTURE_3D,0,0,0,0,f.width,f.height,f.depth,l,c,f.data)}else if(e.isVideoTexture)e.update(),n.texImage2D(a,0,u,l,c,t.image);else if(e.isHTMLTexture)typeof n.texElementImage2D=="function"&&(n.texElementImage2D.length===3?n.texElementImage2D(n.TEXTURE_2D,n.RGBA8,t.image):n.texElementImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t.image));else{let f=e.mipmaps;if(f.length>0)for(let d=0,A=f.length;d<A;d++){let y=f[d],w=UR(y);n.texSubImage2D(a,d,0,0,y.width,y.height,l,c,w)}else{let d=UR(t.image);n.texSubImage2D(a,0,0,0,r,s,l,c,d)}}}generateMipmaps(e){let{gl:t,backend:n}=this,{textureGPU:r,glTextureType:s}=n.get(e);n.state.bindTexture(s,r),t.generateMipmap(s)}deallocateRenderBuffers(e){let{gl:t,backend:n}=this;if(e){let r=n.get(e);if(r.renderBufferStorageSetup=void 0,r.framebuffers){for(let s in r.framebuffers)t.deleteFramebuffer(r.framebuffers[s]);delete r.framebuffers}if(r.depthRenderbuffer&&(t.deleteRenderbuffer(r.depthRenderbuffer),delete r.depthRenderbuffer),r.stencilRenderbuffer&&(t.deleteRenderbuffer(r.stencilRenderbuffer),delete r.stencilRenderbuffer),r.msaaFrameBuffer&&(t.deleteFramebuffer(r.msaaFrameBuffer),delete r.msaaFrameBuffer),r.msaaRenderbuffers){for(let s=0;s<r.msaaRenderbuffers.length;s++)t.deleteRenderbuffer(r.msaaRenderbuffers[s]);delete r.msaaRenderbuffers}}}destroyTexture(e,t=!1){let{gl:n,backend:r}=this,{textureGPU:s,renderTarget:o}=r.get(e);this.deallocateRenderBuffers(o),t===!1&&e.isExternalTexture!==!0&&n.deleteTexture(s),r.delete(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){let{gl:a,backend:l}=this,{state:c}=this.backend,{textureGPU:u,glTextureType:f,glType:d,glFormat:A}=l.get(t);c.bindTexture(f,u);let y,w,S,T,R,I,P,F,D,L=e.isCompressedTexture?e.mipmaps[o]:e.image;if(n!==null)y=n.max.x-n.min.x,w=n.max.y-n.min.y,S=n.isBox3?n.max.z-n.min.z:1,T=n.min.x,R=n.min.y,I=n.isBox3?n.min.z:0;else{let H=Math.pow(2,-s);y=Math.floor(L.width*H),w=Math.floor(L.height*H),e.isDataArrayTexture||e.isArrayTexture?S=L.depth:e.isData3DTexture?S=Math.floor(L.depth*H):S=1,T=0,R=0,I=0}r!==null?(P=r.x,F=r.y,D=r.z):(P=0,F=0,D=0),c.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,t.flipY),c.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),c.pixelStorei(a.UNPACK_ALIGNMENT,t.unpackAlignment);let C=c.getParameter(a.UNPACK_ROW_LENGTH),B=c.getParameter(a.UNPACK_IMAGE_HEIGHT),k=c.getParameter(a.UNPACK_SKIP_PIXELS),z=c.getParameter(a.UNPACK_SKIP_ROWS),G=c.getParameter(a.UNPACK_SKIP_IMAGES);c.pixelStorei(a.UNPACK_ROW_LENGTH,L.width),c.pixelStorei(a.UNPACK_IMAGE_HEIGHT,L.height),c.pixelStorei(a.UNPACK_SKIP_PIXELS,T),c.pixelStorei(a.UNPACK_SKIP_ROWS,R),c.pixelStorei(a.UNPACK_SKIP_IMAGES,I);let W=e.isDataArrayTexture||e.isData3DTexture||t.isArrayTexture,Y=t.isDataArrayTexture||t.isData3DTexture||t.isArrayTexture;if(e.isDepthTexture){let H=l.get(e),$=l.get(t),J=l.get(H.renderTarget),te=l.get($.renderTarget),ce=J.framebuffers[H.cacheKey],he=te.framebuffers[$.cacheKey],ve=c.currentBoundFramebuffers[a.READ_FRAMEBUFFER]??null,Re=c.currentBoundFramebuffers[a.DRAW_FRAMEBUFFER]??null;c.bindFramebuffer(a.READ_FRAMEBUFFER,ce),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,he);for(let Qe=0;Qe<S;Qe++)W&&(a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,H.textureGPU,s,I+Qe),a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+Qe)),a.blitFramebuffer(T,R,y,w,P,F,y,w,a.DEPTH_BUFFER_BIT,a.NEAREST);c.bindFramebuffer(a.READ_FRAMEBUFFER,ve),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,Re)}else if(s!==0||e.isRenderTargetTexture||l.has(e)){let H=l.get(e);this._srcFramebuffer===null&&(this._srcFramebuffer=a.createFramebuffer()),this._dstFramebuffer===null&&(this._dstFramebuffer=a.createFramebuffer());let $=c.currentBoundFramebuffers[a.READ_FRAMEBUFFER]??null,J=c.currentBoundFramebuffers[a.DRAW_FRAMEBUFFER]??null;c.bindFramebuffer(a.READ_FRAMEBUFFER,this._srcFramebuffer),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,this._dstFramebuffer);for(let te=0;te<S;te++)W?a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,H.textureGPU,s,I+te):a.framebufferTexture2D(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,H.textureGPU,s),Y?a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+te):a.framebufferTexture2D(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,u,o),s!==0?a.blitFramebuffer(T,R,y,w,P,F,y,w,a.COLOR_BUFFER_BIT,a.NEAREST):Y?a.copyTexSubImage3D(f,o,P,F,D+te,T,R,y,w):a.copyTexSubImage2D(f,o,P,F,T,R,y,w);c.bindFramebuffer(a.READ_FRAMEBUFFER,$),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,J)}else Y?e.isDataTexture||e.isData3DTexture?a.texSubImage3D(f,o,P,F,D,y,w,S,A,d,L.data):t.isCompressedArrayTexture?a.compressedTexSubImage3D(f,o,P,F,D,y,w,S,A,L.data):a.texSubImage3D(f,o,P,F,D,y,w,S,A,d,L):e.isDataTexture?a.texSubImage2D(a.TEXTURE_2D,o,P,F,y,w,A,d,L.data):e.isCompressedTexture?a.compressedTexSubImage2D(a.TEXTURE_2D,o,P,F,L.width,L.height,A,L.data):a.texSubImage2D(a.TEXTURE_2D,o,P,F,y,w,A,d,L);c.pixelStorei(a.UNPACK_ROW_LENGTH,C),c.pixelStorei(a.UNPACK_IMAGE_HEIGHT,B),c.pixelStorei(a.UNPACK_SKIP_PIXELS,k),c.pixelStorei(a.UNPACK_SKIP_ROWS,z),c.pixelStorei(a.UNPACK_SKIP_IMAGES,G),o===0&&t.generateMipmaps&&a.generateMipmap(f),c.unbindTexture()}copyFramebufferToTexture(e,t,n){let{gl:r}=this,{state:s}=this.backend,{textureGPU:o}=this.backend.get(e),{x:a,y:l,z:c,w:u}=n,f=e.isDepthTexture===!0||t.renderTarget&&t.renderTarget.samples>0,d=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(f){let A=a!==0||l!==0,y,w;if(e.isDepthTexture===!0?(y=r.DEPTH_BUFFER_BIT,w=r.DEPTH_ATTACHMENT,t.stencil&&(y|=r.STENCIL_BUFFER_BIT)):(y=r.COLOR_BUFFER_BIT,w=r.COLOR_ATTACHMENT0),A){let S=this.backend.get(t.renderTarget),T=S.framebuffers[t.getCacheKey()],R=S.msaaFrameBuffer;s.bindFramebuffer(r.DRAW_FRAMEBUFFER,T),s.bindFramebuffer(r.READ_FRAMEBUFFER,R);let I=d-l-u;r.blitFramebuffer(a,I,a+c,I+u,a,I,a+c,I+u,y,r.NEAREST),s.bindFramebuffer(r.READ_FRAMEBUFFER,T),s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,I,c,u),s.unbindTexture()}else{let S=r.createFramebuffer();s.bindFramebuffer(r.DRAW_FRAMEBUFFER,S),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,w,r.TEXTURE_2D,o,0),r.blitFramebuffer(0,0,c,u,0,0,c,u,y,r.NEAREST),r.deleteFramebuffer(S)}}else s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,d-u-l,c,u),s.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t,n,r=!1){let{gl:s}=this,o=t.renderTarget,{depthTexture:a,depthBuffer:l,stencilBuffer:c,width:u,height:f}=o;if(s.bindRenderbuffer(s.RENDERBUFFER,e),l&&!c){let d=s.DEPTH_COMPONENT24;r===!0?this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(s.RENDERBUFFER,o.samples,d,u,f):n>0?(a&&a.isDepthTexture&&a.type===s.FLOAT&&(d=s.DEPTH_COMPONENT32F),s.renderbufferStorageMultisample(s.RENDERBUFFER,n,d,u,f)):s.renderbufferStorage(s.RENDERBUFFER,d,u,f),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,e)}else l&&c&&(n>0?s.renderbufferStorageMultisample(s.RENDERBUFFER,n,s.DEPTH24_STENCIL8,u,f):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,u,f),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,e));s.bindRenderbuffer(s.RENDERBUFFER,null)}async copyTextureToBuffer(e,t,n,r,s,o){let{backend:a,gl:l}=this,{textureGPU:c,glFormat:u,glType:f}=this.backend.get(e),d=l.createFramebuffer();a.state.bindFramebuffer(l.READ_FRAMEBUFFER,d);let A=e.isCubeTexture?l.TEXTURE_CUBE_MAP_POSITIVE_X+o:l.TEXTURE_2D;l.framebufferTexture2D(l.READ_FRAMEBUFFER,l.COLOR_ATTACHMENT0,A,c,0);let y=this._getTypedArrayType(f),w=this._getBytesPerTexel(f,u),T=r*s*w,R=l.createBuffer();l.bindBuffer(l.PIXEL_PACK_BUFFER,R),l.bufferData(l.PIXEL_PACK_BUFFER,T,l.STREAM_READ),l.readPixels(t,n,r,s,u,f,0),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),await a.utils._clientWaitAsync();let I=new y(T/y.BYTES_PER_ELEMENT);return l.bindBuffer(l.PIXEL_PACK_BUFFER,R),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,I),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),a.state.bindFramebuffer(l.READ_FRAMEBUFFER,null),l.deleteFramebuffer(d),I}_getTypedArrayType(e){let{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;if(e===t.UNSIGNED_SHORT_4_4_4_4||e===t.UNSIGNED_SHORT_5_5_5_1||e===t.UNSIGNED_SHORT_5_6_5||e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw new Error(`THREE.WebGLTextureUtils: Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){let{gl:n}=this,r=0;if(e===n.UNSIGNED_BYTE&&(r=1),(e===n.UNSIGNED_SHORT_4_4_4_4||e===n.UNSIGNED_SHORT_5_5_5_1||e===n.UNSIGNED_SHORT_5_6_5||e===n.UNSIGNED_SHORT||e===n.HALF_FLOAT)&&(r=2),(e===n.UNSIGNED_INT||e===n.FLOAT)&&(r=4),t===n.RGBA)return r*4;if(t===n.RGB)return r*3;if(t===n.ALPHA)return r}dispose(){let{gl:e}=this;this._srcFramebuffer!==null&&e.deleteFramebuffer(this._srcFramebuffer),this._dstFramebuffer!==null&&e.deleteFramebuffer(this._dstFramebuffer)}};function UR(i){return i.isDataTexture?i.image.data:typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?i:i.data}var E9=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return t===void 0&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}},M9=class{constructor(e){this.backend=e,this.maxAnisotropy=null,this.maxUniformBlockSize=null}getMaxAnisotropy(){if(this.maxAnisotropy!==null)return this.maxAnisotropy;let e=this.backend.gl,t=this.backend.extensions;if(t.has("EXT_texture_filter_anisotropic")===!0){let n=t.get("EXT_texture_filter_anisotropic");this.maxAnisotropy=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}getUniformBufferLimit(){if(this.maxUniformBlockSize!==null)return this.maxUniformBlockSize;let e=this.backend.gl;return this.maxUniformBlockSize=e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE),this.maxUniformBlockSize}},Hte={WEBGL_multi_draw:"WEBGL_multi_draw",WEBGL_compressed_texture_astc:"texture-compression-astc",WEBGL_compressed_texture_etc:"texture-compression-etc2",WEBGL_compressed_texture_etc1:"texture-compression-etc1",WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-s3tc",EXT_texture_compression_bptc:"texture-compression-bc",EXT_disjoint_timer_query_webgl2:"timestamp-query",OVR_multiview2:"OVR_multiview2"},C9=class{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){let{gl:n,mode:r,object:s,type:o,info:a,index:l}=this;l!==0?n.drawElements(r,t,o,e):n.drawArrays(r,e,t),a.update(s,t,1)}renderInstances(e,t,n){let{gl:r,mode:s,type:o,index:a,object:l,info:c}=this;n!==0&&(a!==0?r.drawElementsInstanced(s,t,o,e,n):r.drawArraysInstanced(s,e,t,n),c.update(l,t,n))}renderMultiDraw(e,t,n){let{extensions:r,mode:s,object:o,info:a}=this;if(n===0)return;let l=r.get("WEBGL_multi_draw");if(l===null)for(let c=0;c<n;c++)this.render(e[c],t[c]);else{this.index!==0?l.multiDrawElementsWEBGL(s,t,0,this.type,e,0,n):l.multiDrawArraysWEBGL(s,e,0,t,0,n);let c=0;for(let u=0;u<n;u++)c+=t[u];a.update(o,c,1)}}},iP=class{constructor(e=256){this.trackTimestamp=!0,this.maxQueries=e,this.currentQueryIndex=0,this.queryOffsets=new Map,this.isDisposed=!1,this.lastValue=0,this.frames=[],this.pendingResolve=!1,this.timestamps=new Map}getTimestampFrames(){return this.frames}getTimestamp(e){let t=this.timestamps.get(e);return t===void 0&&(Xe(`TimestampQueryPool: No timestamp available for uid ${e}.`),t=0),t}hasTimestampQuery(e){return this.timestamps.has(e)}allocateQueriesForContext(){}async resolveQueriesAsync(){}dispose(){}},R9=class extends iP{constructor(e,t,n=2048){if(super(n),this.gl=e,this.type=t,this.ext=e.getExtension("EXT_disjoint_timer_query_webgl2")||e.getExtension("EXT_disjoint_timer_query"),!this.ext){Xe("EXT_disjoint_timer_query not supported; timestamps will be disabled."),this.trackTimestamp=!1;return}this.queries=[];for(let r=0;r<this.maxQueries;r++)this.queries.push(e.createQuery());this.activeQuery=null,this.queryStates=new Map}allocateQueriesForContext(e){if(!this.trackTimestamp)return null;if(this.currentQueryIndex+2>this.maxQueries)return ni(`WebGLTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;let t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryStates.set(t,"inactive"),this.queryOffsets.set(e,t),t}beginQuery(e){if(!this.trackTimestamp||this.isDisposed)return;let t=this.queryOffsets.get(e);if(t==null||this.activeQuery!==null)return;let n=this.queries[t];if(n)try{this.queryStates.get(t)==="inactive"&&(this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,n),this.activeQuery=t,this.queryStates.set(t,"started"))}catch(r){ze("Error in beginQuery:",r),this.activeQuery=null,this.queryStates.set(t,"inactive")}}endQuery(e){if(!this.trackTimestamp||this.isDisposed)return;let t=this.queryOffsets.get(e);if(t!=null&&this.activeQuery===t)try{this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.queryStates.set(t,"ended"),this.activeQuery=null}catch(n){ze("Error in endQuery:",n),this.queryStates.set(t,"inactive"),this.activeQuery=null}}async resolveQueriesAsync(){if(!this.trackTimestamp||this.pendingResolve)return this.lastValue;this.pendingResolve=!0;try{let e=new Map;for(let[s,o]of this.queryOffsets)if(this.queryStates.get(o)==="ended"){let l=this.queries[o];e.set(s,this.resolveQuery(l))}if(e.size===0)return this.lastValue;let t={},n=[];for(let[s,o]of e){let a=s.match(/^(.*):f(\d+)$/),l=parseInt(a[2]);n.includes(l)===!1&&n.push(l),t[l]===void 0&&(t[l]=0);let c=await o;this.timestamps.set(s,c),t[l]+=c}let r=t[n[n.length-1]];return this.lastValue=r,this.frames=n,this.currentQueryIndex=0,this.queryOffsets.clear(),this.queryStates.clear(),this.activeQuery=null,r}catch(e){return ze("Error resolving queries:",e),this.lastValue}finally{this.pendingResolve=!1}}async resolveQuery(e){return new Promise(t=>{if(this.isDisposed){t(this.lastValue);return}let n,r=!1,s=()=>{n&&(clearTimeout(n),n=null)},o=l=>{r||(r=!0,s(),t(l))},a=()=>{if(this.isDisposed){o(this.lastValue);return}try{if(this.gl.getParameter(this.ext.GPU_DISJOINT_EXT)){o(this.lastValue);return}if(!this.gl.getQueryParameter(e,this.gl.QUERY_RESULT_AVAILABLE)){n=setTimeout(a,1);return}let u=this.gl.getQueryParameter(e,this.gl.QUERY_RESULT);t(Number(u)/1e6)}catch(l){ze("Error checking query:",l),t(this.lastValue)}};a()})}dispose(){if(!this.isDisposed&&(this.isDisposed=!0,!!this.trackTimestamp)){for(let e of this.queries)this.gl.deleteQuery(e);this.queries=[],this.queryStates.clear(),this.queryOffsets.clear(),this.lastValue=0,this.activeQuery=null}}},rP=class extends nP{constructor(e={}){super(e),this.isWebGLBackend=!0,this.attributeUtils=null,this.extensions=null,this.capabilities=null,this.textureUtils=null,this.bufferRenderer=null,this.gl=null,this.state=null,this.utils=null,this.vaoCache={},this.transformFeedbackCache={},this.discard=!1,this.disjoint=null,this.parallel=null,this._currentContext=null,this._knownBindings=new WeakSet,this._supportsInvalidateFramebuffer=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),this._xrFramebuffer=null}init(e){super.init(e);let t=this.parameters,n={antialias:e.currentSamples>0,alpha:!0,depth:e.depth,stencil:e.stencil},r=t.context!==void 0?t.context:e.domElement.getContext("webgl2",n);function s(o){o.preventDefault();let a={api:"WebGL",message:o.statusMessage||"Unknown reason",reason:null,originalEvent:o};e.onDeviceLost(a)}this._onContextLost=s,e.domElement.addEventListener("webglcontextlost",s,!1),this.gl=r,this.extensions=new E9(this),this.capabilities=new M9(this),this.attributeUtils=new b9(this),this.textureUtils=new T9(this),this.bufferRenderer=new C9(this),this.state=new w9(this),this.utils=new S9(this),this.extensions.get("EXT_color_buffer_float"),this.extensions.get("WEBGL_clip_cull_distance"),this.extensions.get("OES_texture_float_linear"),this.extensions.get("EXT_color_buffer_half_float"),this.extensions.get("WEBGL_multisampled_render_to_texture"),this.extensions.get("WEBGL_render_shared_exponent"),this.extensions.get("WEBGL_multi_draw"),this.extensions.get("OVR_multiview2"),this.extensions.get("EXT_clip_control"),this.disjoint=this.extensions.get("EXT_disjoint_timer_query_webgl2"),this.parallel=this.extensions.get("KHR_parallel_shader_compile"),this.drawBuffersIndexedExt=this.extensions.get("OES_draw_buffers_indexed"),t.reversedDepthBuffer&&(this.extensions.has("EXT_clip_control")?e.reversedDepthBuffer=!0:(Xe("WebGPURenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer."),e.reversedDepthBuffer=!1)),e.reversedDepthBuffer&&this.state.setReversedDepth(!0)}get coordinateSystem(){return ko}get hasTimestamp(){return this.disjoint!==null}async getArrayBufferAsync(e,t=null,n=0,r=-1){return await this.attributeUtils.getArrayBufferAsync(e,t,n,r)}async makeXRCompatible(){this.gl.getContextAttributes().xrCompatible!==!0&&await this.gl.makeXRCompatible()}setXRTarget(e){this._xrFramebuffer=e}setXRRenderTargetTextures(e,t,n=null){let r=this.gl;if(this.set(e.texture,{textureGPU:t,glInternalFormat:r.RGBA8}),n!==null){let s=e.stencilBuffer?r.DEPTH24_STENCIL8:r.DEPTH_COMPONENT24;this.set(e.depthTexture,{textureGPU:n,glInternalFormat:s}),this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer===!0&&e.multiview===!1&&Xe("WebGLBackend: Render-to-texture extension was disabled because an external texture was provided"),e._autoAllocateDepthBuffer=!1}}initTimestampQuery(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new R9(this.gl,e,2048));let n=this.timestampQueryPool[e];n.allocateQueriesForContext(t)!==null&&n.beginQuery(t)}prepareTimestampBuffer(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e].endQuery(t)}getContext(){return this.gl}beginRender(e){let{state:t}=this,n=this.get(e);if(e.viewport)this.updateViewport(e);else{let{width:s,height:o}=this.getDrawingBufferSize();t.viewport(0,0,s,o)}if(e.scissor)this.updateScissor(e);else{let{width:s,height:o}=this.getDrawingBufferSize();t.scissor(0,0,s,o)}this.initTimestampQuery(Hc.RENDER,this.getTimestampUID(e)),n.previousContext=this._currentContext,this._currentContext=e,this._setFramebuffer(e),this.clear(e.clearColor,e.clearDepth,e.clearStencil,e,!1);let r=e.occlusionQueryCount;r>0&&(n.currentOcclusionQueries=n.occlusionQueries,n.currentOcclusionQueryObjects=n.occlusionQueryObjects,n.lastOcclusionObject=null,n.occlusionQueries=new Array(r),n.occlusionQueryObjects=new Array(r),n.occlusionQueryIndex=0)}finishRender(e){let{gl:t,state:n}=this,r=this.get(e),s=r.previousContext;n.resetVertexState();let o=e.occlusionQueryCount;o>0&&(o>r.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));let a=e.textures;if(a!==null)for(let l=0;l<a.length;l++){let c=a[l];c.generateMipmaps&&this.generateMipmaps(c)}if(this._currentContext=s,this._resolveRenderTarget(e),s!==null){if(this._setFramebuffer(s),s.viewport)this.updateViewport(s);else{let{width:l,height:c}=this.getDrawingBufferSize();n.viewport(0,0,l,c)}if(s.scissor)this.updateScissor(s);else{let{width:l,height:c}=this.getDrawingBufferSize();n.scissor(0,0,l,c)}}this.prepareTimestampBuffer(Hc.RENDER,this.getTimestampUID(e))}resolveOccludedAsync(e){let t=this.get(e),{currentOcclusionQueries:n,currentOcclusionQueryObjects:r}=t;if(n&&r){let s=new WeakSet,{gl:o}=this;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueries=null;let a=()=>{let l=0;for(let c=0;c<n.length;c++){let u=n[c];u!==null&&o.getQueryParameter(u,o.QUERY_RESULT_AVAILABLE)&&(o.getQueryParameter(u,o.QUERY_RESULT)===0&&s.add(r[c]),n[c]=null,o.deleteQuery(u),l++)}l<n.length?requestAnimationFrame(a):t.occluded=s};a()}}isOccluded(e,t){let n=this.get(e);return n.occluded&&n.occluded.has(t)}updateViewport(e){let{state:t}=this,{x:n,y:r,width:s,height:o}=e.viewportValue;t.viewport(n,e.height-o-r,s,o)}updateScissor(e){let{state:t}=this,{x:n,y:r,width:s,height:o}=e.scissorValue;t.scissor(n,e.height-o-r,s,o)}setScissorTest(e){this.state.setScissorTest(e)}getClearColor(){let e=super.getClearColor();return e.r*=e.a,e.g*=e.a,e.b*=e.a,e}clear(e,t,n,r=null,s=!0,o=!0){let{gl:a,renderer:l}=this;r===null&&(r={textures:null,clearColorValue:this.getClearColor()});let c=0;if(e&&(c|=a.COLOR_BUFFER_BIT),t&&(c|=a.DEPTH_BUFFER_BIT),n&&(c|=a.STENCIL_BUFFER_BIT),c!==0){let u;r.clearColorValue?u=r.clearColorValue:u=this.getClearColor();let f=l.getClearDepth(),d=l.getClearStencil();if(t&&this.state.setDepthMask(!0),r.textures===null)a.clearColor(u.r,u.g,u.b,u.a),a.clear(c);else{if(s&&this._setFramebuffer(r),e)for(let A=0;A<r.textures.length;A++)A===0?a.clearBufferfv(a.COLOR,A,[u.r,u.g,u.b,u.a]):a.clearBufferfv(a.COLOR,A,[0,0,0,1]);t&&n?a.clearBufferfi(a.DEPTH_STENCIL,0,f,d):t?a.clearBufferfv(a.DEPTH,0,[f]):n&&a.clearBufferiv(a.STENCIL,0,[d]),s&&o&&this._resolveRenderTarget(r),s&&this._currentContext!==null&&this._currentContext!==r&&this._setFramebuffer(this._currentContext)}}}beginCompute(e){let{state:t,gl:n}=this;t.bindFramebuffer(n.FRAMEBUFFER,null),this.initTimestampQuery(Hc.COMPUTE,this.getTimestampUID(e))}compute(e,t,n,r,s=null){let{state:o,gl:a}=this;this.discard===!1&&(o.enable(a.RASTERIZER_DISCARD),this.discard=!0);let{programGPU:l,transformBuffers:c,attributes:u}=this.get(r),f=this._getVaoKey(u),d=this.vaoCache[f];d===void 0?this.vaoCache[f]=this._createVao(u):o.setVertexState(d),o.useProgram(l),this._bindUniforms(n);let A=this._getTransformFeedback(c);a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,A),a.beginTransformFeedback(a.POINTS),s=s!==null?s:t.count,Array.isArray(s)?(ni("WebGLBackend.compute(): The count parameter must be a single number, not an array."),s=s[0]):s&&typeof s=="object"&&s.isIndirectStorageBufferAttribute&&(ni("WebGLBackend.compute(): The count parameter must be a single number, not IndirectStorageBufferAttribute"),s=t.count),u[0].isStorageInstancedBufferAttribute?a.drawArraysInstanced(a.POINTS,0,1,s):a.drawArrays(a.POINTS,0,s),a.endTransformFeedback(),a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,null);for(let y=0;y<c.length;y++){let w=c[y];w.pbo&&this.has(w.pbo)&&this.textureUtils.copyBufferToTexture(w.transformBuffer,w.pbo),w.switchBuffers()}}finishCompute(e){let{state:t,gl:n}=this;this.discard=!1,t.disable(n.RASTERIZER_DISCARD),this.prepareTimestampBuffer(Hc.COMPUTE,this.getTimestampUID(e)),this._currentContext&&this._setFramebuffer(this._currentContext)}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.isArrayTexture&&e.camera.isArrayCamera}_draw(e,t,n,r,s,o){if(e.isBatchedMesh)if(this.hasFeature("WEBGL_multi_draw")===!1){let{gl:a}=this,l=a.getUniformLocation(o,"nodeUniformDrawId"),c=e._multiDrawStarts,u=e._multiDrawCounts,f=e._multiDrawCount;for(let d=0;d<f;d++)a.uniform1ui(l,d),t.render(c[d],u[d])}else t.renderMultiDraw(e._multiDrawStarts,e._multiDrawCounts,e._multiDrawCount);else s>1?t.renderInstances(n,r,s):t.render(n,r)}draw(e){let{object:t,pipeline:n,material:r,context:s,hardwareClippingPlanes:o}=e,{programGPU:a}=this.get(n),{gl:l,state:c}=this,u=this.get(s),f=e.getDrawParameters();if(f===null)return;this._bindUniforms(e.getBindings());let d=t.isMesh&&t.matrixWorld.determinantAffine()<0;c.setMaterial(r,d,o),s.mrt!==null&&s.textures!==null&&c.setMRTBlending(s.textures,s.mrt,r),c.useProgram(a);let A=e.getAttributes(),y=this.get(A),w=y.vaoGPU;if(w===void 0){let L=this._getVaoKey(A);w=this.vaoCache[L],w===void 0&&(w=this._createVao(A),this.vaoCache[L]=w,y.vaoGPU=w)}let S=e.getIndex(),T=S!==null?this.get(S).bufferGPU:null;c.setVertexState(w,T);let R=u.lastOcclusionObject;if(R!==t&&R!==void 0){if(R!==null&&R.occlusionTest===!0&&(l.endQuery(l.ANY_SAMPLES_PASSED),u.occlusionQueryIndex++),t.occlusionTest===!0){let L=l.createQuery();l.beginQuery(l.ANY_SAMPLES_PASSED,L),u.occlusionQueries[u.occlusionQueryIndex]=L,u.occlusionQueryObjects[u.occlusionQueryIndex]=t}u.lastOcclusionObject=t}let I=this.bufferRenderer;t.isPoints?I.mode=l.POINTS:t.isLineSegments?I.mode=l.LINES:t.isLine?I.mode=l.LINE_STRIP:t.isLineLoop?I.mode=l.LINE_LOOP:r.wireframe===!0?(c.setLineWidth(r.wireframeLinewidth*this.renderer.getPixelRatio()),I.mode=l.LINES):I.mode=l.TRIANGLES;let{vertexCount:P,instanceCount:F}=f,{firstVertex:D}=f;if(I.object=t,S!==null){D*=S.array.BYTES_PER_ELEMENT;let L=this.get(S);I.index=S.count,I.type=L.type}else I.index=0;if(e.camera.isArrayCamera===!0&&e.camera.cameras.length>0&&e.camera.isMultiViewCamera===!1){let L=this.get(e.camera),C=e.camera.cameras,B=e.getBindingGroup("cameraIndex").bindings[0];if(L.indexesGPU===void 0||L.indexesGPU.length!==C.length){let H=new Uint32Array([0,0,0,0]),$=[];for(let J=0,te=C.length;J<te;J++){let ce=l.createBuffer();H[0]=J,l.bindBuffer(l.UNIFORM_BUFFER,ce),l.bufferData(l.UNIFORM_BUFFER,H,l.STATIC_DRAW),$.push(ce)}L.indexesGPU=$}let k=0;e:for(let H of e.getBindings())for(let $ of H.bindings){if($===B)break e;($.isUniformsGroup||$.isUniformBuffer)&&k++}let z=this.renderer.getPixelRatio(),G=this._currentContext.renderTarget,W=this._isRenderCameraDepthArray(this._currentContext),Y=this._currentContext.activeCubeFace;if(W){let H=this.get(G.depthTexture);if(H.clearedRenderId!==this.renderer._nodes.nodeFrame.renderId){H.clearedRenderId=this.renderer._nodes.nodeFrame.renderId;let{stencilBuffer:$}=G;for(let J=0,te=C.length;J<te;J++)this.renderer._activeCubeFace=J,this._currentContext.activeCubeFace=J,this._setFramebuffer(this._currentContext),this.clear(!1,!0,$,this._currentContext,!1,!1);this.renderer._activeCubeFace=Y,this._currentContext.activeCubeFace=Y}}for(let H=0,$=C.length;H<$;H++){let J=C[H];if(t.layers.test(J.layers)){W&&(this.renderer._activeCubeFace=H,this._currentContext.activeCubeFace=H,this._setFramebuffer(this._currentContext));let te=J.viewport;if(te!==void 0){let ce=te.x*z,he=te.y*z,ve=te.width*z,Re=te.height*z;c.viewport(Math.floor(ce),Math.floor(e.context.height-Re-he),Math.floor(ve),Math.floor(Re))}c.bindBufferBase(l.UNIFORM_BUFFER,k,L.indexesGPU[H]),this._draw(t,I,D,P,F,a)}this._currentContext.activeCubeFace=Y,this.renderer._activeCubeFace=Y}}else this._draw(t,I,D,P,F,a)}needsRenderUpdate(){return!1}getRenderCacheKey(){return""}createDefaultTexture(e){this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,n,r,s,o){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,o)}updateSampler(){return""}createNodeBuilder(e,t){return new x9(e,t)}createProgram(e){let t=this.gl,{stage:n,code:r}=e,s=n==="fragment"?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER);t.shaderSource(s,r),t.compileShader(s),this.set(e,{shaderGPU:s})}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){let n=this.gl,r=e.pipeline,{fragmentProgram:s,vertexProgram:o}=r,a=n.createProgram(),l=this.get(s).shaderGPU,c=this.get(o).shaderGPU;if(n.attachShader(a,l),n.attachShader(a,c),n.linkProgram(a),this.set(r,{programGPU:a,fragmentShader:l,vertexShader:c}),t!==null&&this.parallel){let u=new Promise(f=>{let d=this.parallel,A=()=>{n.getProgramParameter(a,d.COMPLETION_STATUS_KHR)?(this._completeCompile(e,r),f()):requestAnimationFrame(A)};A()});t.push(u);return}this._completeCompile(e,r)}_handleSource(e,t){let n=e.split(`43594359 `),r=[],s=Math.max(t-6,0),o=Math.min(t+6,n.length);for(let a=s;a<o;a++){let l=a+1;r.push(`${l===t?">":" "} ${l}: ${n[a]}`)}return r.join(`43604360 `)}_getShaderErrors(e,t,n){let r=e.getShaderParameter(t,e.COMPILE_STATUS),o=(e.getShaderInfoLog(t)||"").trim();if(r&&o==="")return"";let a=/ERROR: 0:(\d+)/.exec(o);if(a){let l=parseInt(a[1]);return n.toUpperCase()+`43614361
@@ -4367,7 +4367,7 @@ Program Info Log: `+o+`
43674367 `+a+`43684368 `+l)}else o!==""&&Xe("WebGLProgram: Program Info Log:",o)}}_completeCompile(e,t){let{state:n,gl:r}=this,s=this.get(t),{programGPU:o,fragmentShader:a,vertexShader:l}=s;r.getProgramParameter(o,r.LINK_STATUS)===!1&&this._logProgramError(o,a,l),n.useProgram(o);let c=e.getBindings();this._setupBindings(c,o),this.set(t,{programGPU:o,pipeline:o})}createComputePipeline(e,t){let{state:n,gl:r}=this,s={stage:"fragment",code:`#version 300 es43694369 precision highp float;4370-void main() {}`};this.createProgram(s);let{computeProgram:o}=e,a=r.createProgram(),l=this.get(s).shaderGPU,c=this.get(o).shaderGPU,u=o.transforms,f=[],d=[];for(let S=0;S<u.length;S++){let T=u[S];f.push(T.varyingName),d.push(T.attributeNode)}r.attachShader(a,l),r.attachShader(a,c),r.transformFeedbackVaryings(a,f,r.SEPARATE_ATTRIBS),r.linkProgram(a),r.getProgramParameter(a,r.LINK_STATUS)===!1&&this._logProgramError(a,l,c),n.useProgram(a),this._setupBindings(t,a);let A=o.attributes,y=[],w=[];for(let S=0;S<A.length;S++){let T=A[S].node.attribute;y.push(T),this.has(T)||this.attributeUtils.createAttribute(T,r.ARRAY_BUFFER)}for(let S=0;S<d.length;S++){let T=d[S].attribute;this.has(T)||this.attributeUtils.createAttribute(T,r.ARRAY_BUFFER);let R=this.get(T);w.push(R)}this.set(e,{programGPU:a,transformBuffers:w,attributes:y})}createBindings(e,t){if(this._knownBindings.has(t)===!1){this._knownBindings.add(t);let n=0,r=0;for(let s of t){this.set(s,{textures:r,uniformBuffers:n});for(let o of s.bindings)o.isUniformBuffer&&n++,o.isSampledTexture&&r++}}this.updateBindings(e,t)}updateBindings(e){let{gl:t}=this;for(let n of e.bindings){let r=this.get(n);if(n.isUniformsGroup||n.isUniformBuffer){let s=n.buffer,o=r.bufferGPU;t.bindBuffer(t.UNIFORM_BUFFER,o);let a=n.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,o),a.length===0)t.bufferData(t.UNIFORM_BUFFER,s,t.DYNAMIC_DRAW);else{let l=p_(s),c=l?1:s.BYTES_PER_ELEMENT;for(let u=0,f=a.length;u<f;u++){let d=a[u],A=d.start*c,y=d.count*c,w=A*(l?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,w,s,A,y)}}this.set(n,r)}else if(n.isSampledTexture){let{textureGPU:s,glTextureType:o}=this.get(n.texture);r.textureGPU=s,r.glTextureType=o,this.set(n,r)}}}updateBinding(e){let t=this.gl;if(e.isUniformsGroup||e.isUniformBuffer){let r=this.get(e).bufferGPU,s=e.buffer,o=e.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,r),o.length===0)t.bufferData(t.UNIFORM_BUFFER,s,t.DYNAMIC_DRAW);else{let a=p_(s),l=a?1:s.BYTES_PER_ELEMENT,c=o[0].start;for(let u=0,f=o.length;u<f;u++){let d=o[u],A=o[u+1],y=d.start+d.count;if(A!==void 0&&A.start===y)continue;let w=c*l,S=(y-c)*l,T=w*(a?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,T,s,w,S),A!==void 0&&(c=A.start)}}}}createUniformBuffer(e){let t=this.get(e);if(t.bufferGPU===void 0){let n=this.gl,r=e.buffer;t.bufferGPU=n.createBuffer(),n.bindBuffer(n.UNIFORM_BUFFER,t.bufferGPU),n.bufferData(n.UNIFORM_BUFFER,r.byteLength,n.DYNAMIC_DRAW)}}destroyUniformBuffer(e){let t=this.get(e);this.gl.deleteBuffer(t.bufferGPU),this.delete(e)}createIndexAttribute(e){let t=this.gl;this.attributeUtils.createAttribute(e,t.ELEMENT_ARRAY_BUFFER)}createAttribute(e){if(this.has(e))return;let t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}createStorageAttribute(e){if(this.has(e))return;let t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}hasFeature(e){let t=Object.keys($te).filter(r=>$te[r]===e),n=this.extensions;for(let r=0;r<t.length;r++)if(n.has(t[r]))return!0;return!1}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){this.textureUtils.copyTextureToTexture(e,t,n,r,s,o)}copyFramebufferToTexture(e,t,n){this.textureUtils.copyFramebufferToTexture(e,t,n)}hasCompatibility(e){return e===kd.TEXTURE_COMPARE?!0:super.hasCompatibility(e)}initRenderTarget(e){let{gl:t,state:n}=this;this._setFramebuffer(e),n.bindFramebuffer(t.FRAMEBUFFER,null)}_setFramebuffer(e){let{gl:t,state:n}=this,r=null;if(e.textures!==null){let s=e.renderTarget,o=this.get(s),{samples:a,depthBuffer:l,stencilBuffer:c}=s,u=s.isCubeRenderTarget===!0,f=s.isRenderTarget3D===!0,d=s.depth>1,A=s.isXRRenderTarget===!0,y=A===!0&&s._hasExternalTextures===!0,w=o.msaaFrameBuffer,S=o.depthRenderbuffer,T=this.extensions.get("WEBGL_multisampled_render_to_texture"),R=this.extensions.get("OVR_multiview2"),P=this._useMultisampledExtension(s),I=wse(e),F;if(u?(o.cubeFramebuffers||(o.cubeFramebuffers={}),F=o.cubeFramebuffers[I]):A&&y===!1?F=this._xrFramebuffer:(o.framebuffers||(o.framebuffers={}),F=o.framebuffers[I]),F===void 0){F=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,F);let D=e.textures,L=[];if(u){o.cubeFramebuffers[I]=F;let{textureGPU:B}=this.get(D[0]),k=this.renderer._activeCubeFace,z=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+k,B,z)}else{o.framebuffers[I]=F;for(let B=0;B<D.length;B++){let k=D[B],z=this.get(k);z.renderTarget=e.renderTarget,z.cacheKey=I;let G=t.COLOR_ATTACHMENT0+B;if(s.multiview)R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,G,z.textureGPU,0,a,0,2);else if(f||d){let W=this.renderer._activeCubeFace,Y=this.renderer._activeMipmapLevel;t.framebufferTextureLayer(t.FRAMEBUFFER,G,z.textureGPU,Y,W)}else if(P)T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,G,t.TEXTURE_2D,z.textureGPU,0,a);else{let W=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,G,t.TEXTURE_2D,z.textureGPU,W)}}}let C=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){let B=t.createRenderbuffer();this.textureUtils.setupRenderBufferStorage(B,e,0,P),o.xrDepthRenderbuffer=B,L.push(c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT),t.bindRenderbuffer(t.RENDERBUFFER,B),t.framebufferRenderbuffer(t.FRAMEBUFFER,C,t.RENDERBUFFER,B)}else if(e.depthTexture!==null){L.push(c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT);let B=this.get(e.depthTexture);if(B.renderTarget=e.renderTarget,B.cacheKey=I,s.multiview)R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,C,B.textureGPU,0,a,0,2);else if(y&&P)T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0,a);else if(e.depthTexture.isArrayTexture){let k=this.renderer._activeCubeFace;t.framebufferTextureLayer(t.FRAMEBUFFER,C,B.textureGPU,0,k)}else if(e.depthTexture.isCubeTexture){let k=this.renderer._activeCubeFace;t.framebufferTexture2D(t.FRAMEBUFFER,C,t.TEXTURE_CUBE_MAP_POSITIVE_X+k,B.textureGPU,0)}else t.framebufferTexture2D(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0)}o.depthInvalidationArray=L}else{if(this._isRenderCameraDepthArray(e)){n.bindFramebuffer(t.FRAMEBUFFER,F);let L=this.renderer._activeCubeFace,C=this.get(e.depthTexture),B=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.framebufferTextureLayer(t.FRAMEBUFFER,B,C.textureGPU,0,L)}if((A||P||s.multiview)&&s._isOpaqueFramebuffer!==!0){n.bindFramebuffer(t.FRAMEBUFFER,F);let L=this.get(e.textures[0]);s.multiview?R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,L.textureGPU,0,a,0,2):P?T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,L.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,L.textureGPU,0);let C=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){let B=o.xrDepthRenderbuffer;t.bindRenderbuffer(t.RENDERBUFFER,B),t.framebufferRenderbuffer(t.FRAMEBUFFER,C,t.RENDERBUFFER,B)}else{let B=this.get(e.depthTexture);s.multiview?R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,C,B.textureGPU,0,a,0,2):P?T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0)}}}if(a>0&&P===!1&&!s.multiview){if(w===void 0){let D=[];w=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,w);let L=[],C=e.textures;for(let B=0;B<C.length;B++){L[B]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,L[B]),D.push(t.COLOR_ATTACHMENT0+B);let k=e.textures[B],z=this.get(k);t.renderbufferStorageMultisample(t.RENDERBUFFER,a,z.glInternalFormat,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+B,t.RENDERBUFFER,L[B])}if(t.bindRenderbuffer(t.RENDERBUFFER,null),o.msaaFrameBuffer=w,o.msaaRenderbuffers=L,l&&S===void 0){S=t.createRenderbuffer(),this.textureUtils.setupRenderBufferStorage(S,e,a),o.depthRenderbuffer=S;let B=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;D.push(B)}o.invalidationArray=D}r=o.msaaFrameBuffer}else r=F;n.drawBuffers(e,F)}n.bindFramebuffer(t.FRAMEBUFFER,r)}_getVaoKey(e){let t="";for(let n=0;n<e.length;n++){let r=this.get(e[n]);t+=":"+r.id}return t}_createVao(e){let{gl:t}=this,n=t.createVertexArray();t.bindVertexArray(n);for(let r=0;r<e.length;r++){let s=e[r],o=this.get(s);t.bindBuffer(t.ARRAY_BUFFER,o.bufferGPU),t.enableVertexAttribArray(r);let a,l;s.isInterleavedBufferAttribute===!0?(a=s.data.stride*o.bytesPerElement,l=s.offset*o.bytesPerElement):(a=0,l=0),o.isInteger?t.vertexAttribIPointer(r,s.itemSize,o.type,a,l):t.vertexAttribPointer(r,s.itemSize,o.type,s.normalized,a,l),s.isInstancedBufferAttribute&&!s.isInterleavedBufferAttribute?t.vertexAttribDivisor(r,s.meshPerAttribute):s.isInterleavedBufferAttribute&&s.data.isInstancedInterleavedBuffer&&t.vertexAttribDivisor(r,s.data.meshPerAttribute)}return t.bindBuffer(t.ARRAY_BUFFER,null),n}_getTransformFeedback(e){let t="";for(let s=0;s<e.length;s++)t+=":"+e[s].id;let n=this.transformFeedbackCache[t];if(n!==void 0)return n;let{gl:r}=this;n=r.createTransformFeedback(),r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,n);for(let s=0;s<e.length;s++){let o=e[s];r.bindBufferBase(r.TRANSFORM_FEEDBACK_BUFFER,s,o.transformBuffer)}return r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,null),this.transformFeedbackCache[t]=n,n}_setupBindings(e,t){let n=this.gl,r=0,s=0;for(let o of e)for(let a of o.bindings)if(a.isUniformsGroup||a.isUniformBuffer){let l=r++,c=n.getUniformBlockIndex(t,a.name);n.uniformBlockBinding(t,c,l)}else if(a.isSampledTexture){let l=s++,c=n.getUniformLocation(t,a.name);n.uniform1i(c,l)}}_bindUniforms(e){let{gl:t,state:n}=this,r=0,s=0;for(let o of e)for(let a of o.bindings){let l=this.get(a);if(a.isUniformsGroup||a.isUniformBuffer){let c=r++;n.bindBufferBase(t.UNIFORM_BUFFER,c,l.bufferGPU)}else if(a.isSampledTexture){let c=s++;n.bindTexture(l.glTextureType,l.textureGPU,t.TEXTURE0+c)}}}_resolveRenderTarget(e){let{gl:t,state:n}=this,r=e.renderTarget;if(e.textures!==null&&r){let s=this.get(r);if(r.samples>0&&this._useMultisampledExtension(r)===!1){let o=s.framebuffers[e.getCacheKey()],a=t.COLOR_BUFFER_BIT;r.resolveDepthBuffer&&(r.depthBuffer&&(a|=t.DEPTH_BUFFER_BIT),r.stencilBuffer&&r.resolveStencilBuffer&&(a|=t.STENCIL_BUFFER_BIT));let l=s.msaaFrameBuffer,c=s.msaaRenderbuffers,u=e.textures,f=u.length>1;if(n.bindFramebuffer(t.READ_FRAMEBUFFER,l),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,o),f)for(let d=0;d<u.length;d++)t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.RENDERBUFFER,null),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.TEXTURE_2D,null,0);for(let d=0;d<u.length;d++){if(f){let{textureGPU:A}=this.get(u[d]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,c[d]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,A,0)}if(e.scissor){let{x:A,y,width:w,height:S}=e.scissorValue,T=e.height-S-y;t.blitFramebuffer(A,T,A+w,T+S,A,T,A+w,T+S,a,t.NEAREST)}else t.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,a,t.NEAREST)}if(f)for(let d=0;d<u.length;d++){let{textureGPU:A}=this.get(u[d]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.RENDERBUFFER,c[d]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.TEXTURE_2D,A,0)}this._supportsInvalidateFramebuffer===!0&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,s.invalidationArray)}else if(r.resolveDepthBuffer===!1&&s.framebuffers){let o=s.framebuffers[e.getCacheKey()];n.bindFramebuffer(t.DRAW_FRAMEBUFFER,o),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,s.depthInvalidationArray)}}}_useMultisampledExtension(e){return e.multiview===!0?!0:e.samples>0&&this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer!==!1}dispose(){this.textureUtils!==null&&this.textureUtils.dispose();let e=this.extensions.get("WEBGL_lose_context");e&&e.loseContext(),this.renderer.domElement.removeEventListener("webglcontextlost",this._onContextLost)}},rS={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list"},Tf=typeof self<"u"&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},jo={Never:"never",Less:"less",Equal:"equal",LessEqual:"less-equal",Greater:"greater",NotEqual:"not-equal",GreaterEqual:"greater-equal",Always:"always"},Za={Store:"store"},Fi={Load:"load",Clear:"clear"},Yte={CCW:"ccw",CW:"cw"},Zte={None:"none",Back:"back"},uI={Uint16:"uint16",Uint32:"uint32"},fe={R8Unorm:"r8unorm",R8Snorm:"r8snorm",R8Uint:"r8uint",R8Sint:"r8sint",R16Uint:"r16uint",R16Sint:"r16sint",R16Float:"r16float",RG8Unorm:"rg8unorm",RG8Snorm:"rg8snorm",RG8Uint:"rg8uint",RG8Sint:"rg8sint",R16Unorm:"r16unorm",R16Snorm:"r16snorm",R32Uint:"r32uint",R32Sint:"r32sint",R32Float:"r32float",RG16Uint:"rg16uint",RG16Sint:"rg16sint",RG16Float:"rg16float",RGBA8Unorm:"rgba8unorm",RGBA8UnormSRGB:"rgba8unorm-srgb",RGBA8Snorm:"rgba8snorm",RGBA8Uint:"rgba8uint",RGBA8Sint:"rgba8sint",BGRA8Unorm:"bgra8unorm",BGRA8UnormSRGB:"bgra8unorm-srgb",RG16Unorm:"rg16unorm",RG16Snorm:"rg16snorm",RGB9E5UFloat:"rgb9e5ufloat",RGB10A2Unorm:"rgb10a2unorm",RG11B10UFloat:"rg11b10ufloat",RG32Uint:"rg32uint",RG32Sint:"rg32sint",RG32Float:"rg32float",RGBA16Uint:"rgba16uint",RGBA16Sint:"rgba16sint",RGBA16Float:"rgba16float",RGBA16Unorm:"rgba16unorm",RGBA16Snorm:"rgba16snorm",RGBA32Uint:"rgba32uint",RGBA32Sint:"rgba32sint",RGBA32Float:"rgba32float",Depth16Unorm:"depth16unorm",Depth24Plus:"depth24plus",Depth24PlusStencil8:"depth24plus-stencil8",Depth32Float:"depth32float",Depth32FloatStencil8:"depth32float-stencil8",BC1RGBAUnorm:"bc1-rgba-unorm",BC1RGBAUnormSRGB:"bc1-rgba-unorm-srgb",BC2RGBAUnorm:"bc2-rgba-unorm",BC2RGBAUnormSRGB:"bc2-rgba-unorm-srgb",BC3RGBAUnorm:"bc3-rgba-unorm",BC3RGBAUnormSRGB:"bc3-rgba-unorm-srgb",BC4RUnorm:"bc4-r-unorm",BC4RSnorm:"bc4-r-snorm",BC5RGUnorm:"bc5-rg-unorm",BC5RGSnorm:"bc5-rg-snorm",BC6HRGBUFloat:"bc6h-rgb-ufloat",BC6HRGBFloat:"bc6h-rgb-float",BC7RGBAUnorm:"bc7-rgba-unorm",BC7RGBAUnormSRGB:"bc7-rgba-unorm-srgb",ETC2RGB8Unorm:"etc2-rgb8unorm",ETC2RGB8UnormSRGB:"etc2-rgb8unorm-srgb",ETC2RGB8A1Unorm:"etc2-rgb8a1unorm",ETC2RGB8A1UnormSRGB:"etc2-rgb8a1unorm-srgb",ETC2RGBA8Unorm:"etc2-rgba8unorm",ETC2RGBA8UnormSRGB:"etc2-rgba8unorm-srgb",EACR11Unorm:"eac-r11unorm",EACR11Snorm:"eac-r11snorm",EACRG11Unorm:"eac-rg11unorm",EACRG11Snorm:"eac-rg11snorm",ASTC4x4Unorm:"astc-4x4-unorm",ASTC4x4UnormSRGB:"astc-4x4-unorm-srgb",ASTC5x4Unorm:"astc-5x4-unorm",ASTC5x4UnormSRGB:"astc-5x4-unorm-srgb",ASTC5x5Unorm:"astc-5x5-unorm",ASTC5x5UnormSRGB:"astc-5x5-unorm-srgb",ASTC6x5Unorm:"astc-6x5-unorm",ASTC6x5UnormSRGB:"astc-6x5-unorm-srgb",ASTC6x6Unorm:"astc-6x6-unorm",ASTC6x6UnormSRGB:"astc-6x6-unorm-srgb",ASTC8x5Unorm:"astc-8x5-unorm",ASTC8x5UnormSRGB:"astc-8x5-unorm-srgb",ASTC8x6Unorm:"astc-8x6-unorm",ASTC8x6UnormSRGB:"astc-8x6-unorm-srgb",ASTC8x8Unorm:"astc-8x8-unorm",ASTC8x8UnormSRGB:"astc-8x8-unorm-srgb",ASTC10x5Unorm:"astc-10x5-unorm",ASTC10x5UnormSRGB:"astc-10x5-unorm-srgb",ASTC10x6Unorm:"astc-10x6-unorm",ASTC10x6UnormSRGB:"astc-10x6-unorm-srgb",ASTC10x8Unorm:"astc-10x8-unorm",ASTC10x8UnormSRGB:"astc-10x8-unorm-srgb",ASTC10x10Unorm:"astc-10x10-unorm",ASTC10x10UnormSRGB:"astc-10x10-unorm-srgb",ASTC12x10Unorm:"astc-12x10-unorm",ASTC12x10UnormSRGB:"astc-12x10-unorm-srgb",ASTC12x12Unorm:"astc-12x12-unorm",ASTC12x12UnormSRGB:"astc-12x12-unorm-srgb"},fU={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},tu={Linear:"linear",Nearest:"nearest"},ui={Zero:"zero",One:"one",Src:"src",OneMinusSrc:"one-minus-src",SrcAlpha:"src-alpha",OneMinusSrcAlpha:"one-minus-src-alpha",Dst:"dst",OneMinusDst:"one-minus-dst",DstAlpha:"dst-alpha",OneMinusDstAlpha:"one-minus-dst-alpha",SrcAlphaSaturated:"src-alpha-saturated",Constant:"constant",OneMinusConstant:"one-minus-constant"},Og={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},Kte={None:0,All:15},im={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},dU={Storage:"storage",ReadOnlyStorage:"read-only-storage"},pU={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},Qte={NonFiltering:"non-filtering",Comparison:"comparison"},Ug={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},Jte={TwoD:"2d",ThreeD:"3d"},Xo={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},LPe={All:"all"},HR={Vertex:"vertex",Instance:"instance"},hI={CoreFeaturesAndLimits:"core-features-and-limits",DepthClipControl:"depth-clip-control",Depth32FloatStencil8:"depth32float-stencil8",TextureCompressionBC:"texture-compression-bc",TextureCompressionBCSliced3D:"texture-compression-bc-sliced-3d",TextureCompressionETC2:"texture-compression-etc2",TextureCompressionASTC:"texture-compression-astc",TextureCompressionASTCSliced3D:"texture-compression-astc-sliced-3d",TimestampQuery:"timestamp-query",IndirectFirstInstance:"indirect-first-instance",ShaderF16:"shader-f16",RG11B10UFloat:"rg11b10ufloat-renderable",BGRA8UNormStorage:"bgra8unorm-storage",Float32Filterable:"float32-filterable",Float32Blendable:"float32-blendable",ClipDistances:"clip-distances",DualSourceBlending:"dual-source-blending",Subgroups:"subgroups",TextureFormatsTier1:"texture-formats-tier1",TextureFormatsTier2:"texture-formats-tier2"},ene={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"},I9=class extends sI{constructor(e,t,n){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}},P9=class extends tI{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}},DPe=0,L9=class extends P9{constructor(e,t){super("StorageBuffer_"+DPe++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:Yo.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}},mU=[null],D9=class{constructor(e){this.backend=e,this._preferredCanvasFormat=null}getCurrentDepthStencilFormat(e){let t;return e.depth&&(e.depthTexture!==null?t=this.getTextureFormatGPU(e.depthTexture):e.stencil?this.backend.renderer.reversedDepthBuffer===!0?t=fe.Depth32FloatStencil8:t=fe.Depth24PlusStencil8:this.backend.renderer.reversedDepthBuffer===!0?t=fe.Depth32Float:t=fe.Depth24Plus),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){let s=this.backend.renderer,o=s.getRenderTarget();t=o?o.samples:s.currentSamples}else e.renderTarget&&(t=e.renderTarget.samples);t=this.getSampleCount(t||1);let n=t>1&&e.renderTarget!==null&&e.isDepthTexture!==!0&&e.isFramebufferTexture!==!0;return{samples:t,primarySamples:n?1:t,isMSAA:n}}getCurrentColorFormat(e){let t;return e.textures!==null?t=this.getTextureFormatGPU(e.textures[0]):t=this.getPreferredCanvasFormat(),t}getCurrentColorFormats(e){return e.textures!==null?e.textures.map(t=>this.getTextureFormatGPU(t)):[this.getPreferredCanvasFormat()]}getCurrentColorSpace(e){return e.textures!==null?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){if(e.isPoints)return rS.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return rS.LineList;if(e.isLine)return rS.LineStrip;if(e.isMesh)return rS.TriangleList}getSampleCount(e){return e>=4?4:1}getSampleCountRenderContext(e){return e.textures!==null?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.currentSamples)}getPreferredCanvasFormat(){let t=this.backend.parameters.outputType;if(t===void 0)return this._preferredCanvasFormat===null&&(this._preferredCanvasFormat=navigator.gpu.getPreferredCanvasFormat()),this._preferredCanvasFormat;if(t===Ji)return fe.BGRA8Unorm;if(t===Wi)return fe.RGBA16Float;throw new Error("THREE.WebGPUUtils: Unsupported output buffer type.")}};function _f(i,e){mU[0]=e,i.queue.submit(mU),mU[0]=null}var fI=class{constructor(){this.label="",this.layout=null,this.entries=[]}reset(){this.label="",this.layout=null,this.entries.length=0}},ym=class{constructor(){this.label="",this.size=0,this.usage=0,this.mappedAtCreation=!1}reset(){this.label="",this.size=0,this.usage=0,this.mappedAtCreation=!1}},a1=class{constructor(){this.label=""}reset(){this.label=""}},dI=class{constructor(){this.label="",this.colorFormats=null,this.depthStencilFormat=void 0,this.sampleCount=1,this.depthReadOnly=!1,this.stencilReadOnly=!1}reset(){this.label="",this.colorFormats=null,this.depthStencilFormat=void 0,this.sampleCount=1,this.depthReadOnly=!1,this.stencilReadOnly=!1}},Kg=class{constructor(){this.view=null,this.depthSlice=void 0,this.resolveTarget=void 0,this.clearValue=void 0,this.loadOp=void 0,this.storeOp=void 0}reset(){this.view=null,this.depthSlice=void 0,this.resolveTarget=void 0,this.clearValue=void 0,this.loadOp=void 0,this.storeOp=void 0}},Qg=class{constructor(){this.label="",this.colorAttachments=[],this.depthStencilAttachment=void 0,this.occlusionQuerySet=void 0,this.timestampWrites=void 0,this.maxDrawCount=5e7}reset(){this.label="",this.colorAttachments.length=0,this.depthStencilAttachment=void 0,this.occlusionQuerySet=void 0,this.timestampWrites=void 0,this.maxDrawCount=5e7}},pI=class{constructor(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample=new N9,this.fragment=null}reset(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample.reset(),this.fragment=null}},N9=class{constructor(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}reset(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}},mI=class{constructor(){this.label="",this.code="",this.compilationHints=[]}reset(){this.label="",this.code="",this.compilationHints.length=0}},DS=class{constructor(){this.label="",this.size={width:0,height:1,depthOrArrayLayers:1},this.mipLevelCount=1,this.sampleCount=1,this.dimension="2d",this.format=void 0,this.usage=void 0,this.viewFormats=[],this.textureBindingViewDimension=void 0}reset(){this.label="",this.size.width=0,this.size.height=1,this.size.depthOrArrayLayers=1,this.mipLevelCount=1,this.sampleCount=1,this.dimension="2d",this.format=void 0,this.usage=void 0,this.viewFormats.length=0,this.textureBindingViewDimension=void 0}},NS=class{constructor(){this.label="",this.format=void 0,this.dimension=void 0,this.usage=0,this.aspect="all",this.baseMipLevel=0,this.mipLevelCount=void 0,this.baseArrayLayer=0,this.arrayLayerCount=void 0,this.swizzle="rgba"}reset(){this.label="",this.format=void 0,this.dimension=void 0,this.usage=0,this.aspect="all",this.baseMipLevel=0,this.mipLevelCount=void 0,this.baseArrayLayer=0,this.arrayLayerCount=void 0,this.swizzle="rgba"}},rm=new fI,sm=new ym,WR=new a1,AU=new dI,gU=new Qg,Z_=new pI,Kw=new Kg,jR=new mI,K_=new DS,_s=new NS,F9=class extends Rf{constructor(e){super(),this.device=e;let t=`4370+void main() {}`};this.createProgram(s);let{computeProgram:o}=e,a=r.createProgram(),l=this.get(s).shaderGPU,c=this.get(o).shaderGPU,u=o.transforms,f=[],d=[];for(let S=0;S<u.length;S++){let T=u[S];f.push(T.varyingName),d.push(T.attributeNode)}r.attachShader(a,l),r.attachShader(a,c),r.transformFeedbackVaryings(a,f,r.SEPARATE_ATTRIBS),r.linkProgram(a),r.getProgramParameter(a,r.LINK_STATUS)===!1&&this._logProgramError(a,l,c),n.useProgram(a),this._setupBindings(t,a);let A=o.attributes,y=[],w=[];for(let S=0;S<A.length;S++){let T=A[S].node.attribute;y.push(T),this.has(T)||this.attributeUtils.createAttribute(T,r.ARRAY_BUFFER)}for(let S=0;S<d.length;S++){let T=d[S].attribute;this.has(T)||this.attributeUtils.createAttribute(T,r.ARRAY_BUFFER);let R=this.get(T);w.push(R)}this.set(e,{programGPU:a,transformBuffers:w,attributes:y})}createBindings(e,t){if(this._knownBindings.has(t)===!1){this._knownBindings.add(t);let n=0,r=0;for(let s of t){this.set(s,{textures:r,uniformBuffers:n});for(let o of s.bindings)o.isUniformBuffer&&n++,o.isSampledTexture&&r++}}this.updateBindings(e,t)}updateBindings(e){let{gl:t}=this;for(let n of e.bindings){let r=this.get(n);if(n.isUniformsGroup||n.isUniformBuffer){let s=n.buffer,o=r.bufferGPU;t.bindBuffer(t.UNIFORM_BUFFER,o);let a=n.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,o),a.length===0)t.bufferData(t.UNIFORM_BUFFER,s,t.DYNAMIC_DRAW);else{let l=f_(s),c=l?1:s.BYTES_PER_ELEMENT;for(let u=0,f=a.length;u<f;u++){let d=a[u],A=d.start*c,y=d.count*c,w=A*(l?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,w,s,A,y)}}this.set(n,r)}else if(n.isSampledTexture){let{textureGPU:s,glTextureType:o}=this.get(n.texture);r.textureGPU=s,r.glTextureType=o,this.set(n,r)}}}updateBinding(e){let t=this.gl;if(e.isUniformsGroup||e.isUniformBuffer){let r=this.get(e).bufferGPU,s=e.buffer,o=e.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,r),o.length===0)t.bufferData(t.UNIFORM_BUFFER,s,t.DYNAMIC_DRAW);else{let a=f_(s),l=a?1:s.BYTES_PER_ELEMENT,c=o[0].start;for(let u=0,f=o.length;u<f;u++){let d=o[u],A=o[u+1],y=d.start+d.count;if(A!==void 0&&A.start===y)continue;let w=c*l,S=(y-c)*l,T=w*(a?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,T,s,w,S),A!==void 0&&(c=A.start)}}}}createUniformBuffer(e){let t=this.get(e);if(t.bufferGPU===void 0){let n=this.gl,r=e.buffer;t.bufferGPU=n.createBuffer(),n.bindBuffer(n.UNIFORM_BUFFER,t.bufferGPU),n.bufferData(n.UNIFORM_BUFFER,r.byteLength,n.DYNAMIC_DRAW)}}destroyUniformBuffer(e){let t=this.get(e);this.gl.deleteBuffer(t.bufferGPU),this.delete(e)}createIndexAttribute(e){let t=this.gl;this.attributeUtils.createAttribute(e,t.ELEMENT_ARRAY_BUFFER)}createAttribute(e){if(this.has(e))return;let t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}createStorageAttribute(e){if(this.has(e))return;let t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}hasFeature(e){let t=Object.keys(Hte).filter(r=>Hte[r]===e),n=this.extensions;for(let r=0;r<t.length;r++)if(n.has(t[r]))return!0;return!1}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){this.textureUtils.copyTextureToTexture(e,t,n,r,s,o)}copyFramebufferToTexture(e,t,n){this.textureUtils.copyFramebufferToTexture(e,t,n)}hasCompatibility(e){return e===Bd.TEXTURE_COMPARE?!0:super.hasCompatibility(e)}initRenderTarget(e){let{gl:t,state:n}=this;this._setFramebuffer(e),n.bindFramebuffer(t.FRAMEBUFFER,null)}_setFramebuffer(e){let{gl:t,state:n}=this,r=null;if(e.textures!==null){let s=e.renderTarget,o=this.get(s),{samples:a,depthBuffer:l,stencilBuffer:c}=s,u=s.isCubeRenderTarget===!0,f=s.isRenderTarget3D===!0,d=s.depth>1,A=s.isXRRenderTarget===!0,y=A===!0&&s._hasExternalTextures===!0,w=o.msaaFrameBuffer,S=o.depthRenderbuffer,T=this.extensions.get("WEBGL_multisampled_render_to_texture"),R=this.extensions.get("OVR_multiview2"),I=this._useMultisampledExtension(s),P=_se(e),F;if(u?(o.cubeFramebuffers||(o.cubeFramebuffers={}),F=o.cubeFramebuffers[P]):A&&y===!1?F=this._xrFramebuffer:(o.framebuffers||(o.framebuffers={}),F=o.framebuffers[P]),F===void 0){F=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,F);let D=e.textures,L=[];if(u){o.cubeFramebuffers[P]=F;let{textureGPU:B}=this.get(D[0]),k=this.renderer._activeCubeFace,z=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+k,B,z)}else{o.framebuffers[P]=F;for(let B=0;B<D.length;B++){let k=D[B],z=this.get(k);z.renderTarget=e.renderTarget,z.cacheKey=P;let G=t.COLOR_ATTACHMENT0+B;if(s.multiview)R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,G,z.textureGPU,0,a,0,2);else if(f||d){let W=this.renderer._activeCubeFace,Y=this.renderer._activeMipmapLevel;t.framebufferTextureLayer(t.FRAMEBUFFER,G,z.textureGPU,Y,W)}else if(I)T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,G,t.TEXTURE_2D,z.textureGPU,0,a);else{let W=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,G,t.TEXTURE_2D,z.textureGPU,W)}}}let C=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){let B=t.createRenderbuffer();this.textureUtils.setupRenderBufferStorage(B,e,0,I),o.xrDepthRenderbuffer=B,L.push(c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT),t.bindRenderbuffer(t.RENDERBUFFER,B),t.framebufferRenderbuffer(t.FRAMEBUFFER,C,t.RENDERBUFFER,B)}else if(e.depthTexture!==null){L.push(c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT);let B=this.get(e.depthTexture);if(B.renderTarget=e.renderTarget,B.cacheKey=P,s.multiview)R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,C,B.textureGPU,0,a,0,2);else if(y&&I)T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0,a);else if(e.depthTexture.isArrayTexture){let k=this.renderer._activeCubeFace;t.framebufferTextureLayer(t.FRAMEBUFFER,C,B.textureGPU,0,k)}else if(e.depthTexture.isCubeTexture){let k=this.renderer._activeCubeFace;t.framebufferTexture2D(t.FRAMEBUFFER,C,t.TEXTURE_CUBE_MAP_POSITIVE_X+k,B.textureGPU,0)}else t.framebufferTexture2D(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0)}o.depthInvalidationArray=L}else{if(this._isRenderCameraDepthArray(e)){n.bindFramebuffer(t.FRAMEBUFFER,F);let L=this.renderer._activeCubeFace,C=this.get(e.depthTexture),B=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.framebufferTextureLayer(t.FRAMEBUFFER,B,C.textureGPU,0,L)}if((A||I||s.multiview)&&s._isOpaqueFramebuffer!==!0){n.bindFramebuffer(t.FRAMEBUFFER,F);let L=this.get(e.textures[0]);s.multiview?R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,L.textureGPU,0,a,0,2):I?T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,L.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,L.textureGPU,0);let C=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){let B=o.xrDepthRenderbuffer;t.bindRenderbuffer(t.RENDERBUFFER,B),t.framebufferRenderbuffer(t.FRAMEBUFFER,C,t.RENDERBUFFER,B)}else{let B=this.get(e.depthTexture);s.multiview?R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,C,B.textureGPU,0,a,0,2):I?T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0)}}}if(a>0&&I===!1&&!s.multiview){if(w===void 0){let D=[];w=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,w);let L=[],C=e.textures;for(let B=0;B<C.length;B++){L[B]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,L[B]),D.push(t.COLOR_ATTACHMENT0+B);let k=e.textures[B],z=this.get(k);t.renderbufferStorageMultisample(t.RENDERBUFFER,a,z.glInternalFormat,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+B,t.RENDERBUFFER,L[B])}if(t.bindRenderbuffer(t.RENDERBUFFER,null),o.msaaFrameBuffer=w,o.msaaRenderbuffers=L,l&&S===void 0){S=t.createRenderbuffer(),this.textureUtils.setupRenderBufferStorage(S,e,a),o.depthRenderbuffer=S;let B=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;D.push(B)}o.invalidationArray=D}r=o.msaaFrameBuffer}else r=F;n.drawBuffers(e,F)}n.bindFramebuffer(t.FRAMEBUFFER,r)}_getVaoKey(e){let t="";for(let n=0;n<e.length;n++){let r=this.get(e[n]);t+=":"+r.id}return t}_createVao(e){let{gl:t}=this,n=t.createVertexArray();t.bindVertexArray(n);for(let r=0;r<e.length;r++){let s=e[r],o=this.get(s);t.bindBuffer(t.ARRAY_BUFFER,o.bufferGPU),t.enableVertexAttribArray(r);let a,l;s.isInterleavedBufferAttribute===!0?(a=s.data.stride*o.bytesPerElement,l=s.offset*o.bytesPerElement):(a=0,l=0),o.isInteger?t.vertexAttribIPointer(r,s.itemSize,o.type,a,l):t.vertexAttribPointer(r,s.itemSize,o.type,s.normalized,a,l),s.isInstancedBufferAttribute&&!s.isInterleavedBufferAttribute?t.vertexAttribDivisor(r,s.meshPerAttribute):s.isInterleavedBufferAttribute&&s.data.isInstancedInterleavedBuffer&&t.vertexAttribDivisor(r,s.data.meshPerAttribute)}return t.bindBuffer(t.ARRAY_BUFFER,null),n}_getTransformFeedback(e){let t="";for(let s=0;s<e.length;s++)t+=":"+e[s].id;let n=this.transformFeedbackCache[t];if(n!==void 0)return n;let{gl:r}=this;n=r.createTransformFeedback(),r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,n);for(let s=0;s<e.length;s++){let o=e[s];r.bindBufferBase(r.TRANSFORM_FEEDBACK_BUFFER,s,o.transformBuffer)}return r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,null),this.transformFeedbackCache[t]=n,n}_setupBindings(e,t){let n=this.gl,r=0,s=0;for(let o of e)for(let a of o.bindings)if(a.isUniformsGroup||a.isUniformBuffer){let l=r++,c=n.getUniformBlockIndex(t,a.name);n.uniformBlockBinding(t,c,l)}else if(a.isSampledTexture){let l=s++,c=n.getUniformLocation(t,a.name);n.uniform1i(c,l)}}_bindUniforms(e){let{gl:t,state:n}=this,r=0,s=0;for(let o of e)for(let a of o.bindings){let l=this.get(a);if(a.isUniformsGroup||a.isUniformBuffer){let c=r++;n.bindBufferBase(t.UNIFORM_BUFFER,c,l.bufferGPU)}else if(a.isSampledTexture){let c=s++;n.bindTexture(l.glTextureType,l.textureGPU,t.TEXTURE0+c)}}}_resolveRenderTarget(e){let{gl:t,state:n}=this,r=e.renderTarget;if(e.textures!==null&&r){let s=this.get(r);if(r.samples>0&&this._useMultisampledExtension(r)===!1){let o=s.framebuffers[e.getCacheKey()],a=t.COLOR_BUFFER_BIT;r.resolveDepthBuffer&&(r.depthBuffer&&(a|=t.DEPTH_BUFFER_BIT),r.stencilBuffer&&r.resolveStencilBuffer&&(a|=t.STENCIL_BUFFER_BIT));let l=s.msaaFrameBuffer,c=s.msaaRenderbuffers,u=e.textures,f=u.length>1;if(n.bindFramebuffer(t.READ_FRAMEBUFFER,l),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,o),f)for(let d=0;d<u.length;d++)t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.RENDERBUFFER,null),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.TEXTURE_2D,null,0);for(let d=0;d<u.length;d++){if(f){let{textureGPU:A}=this.get(u[d]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,c[d]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,A,0)}if(e.scissor){let{x:A,y,width:w,height:S}=e.scissorValue,T=e.height-S-y;t.blitFramebuffer(A,T,A+w,T+S,A,T,A+w,T+S,a,t.NEAREST)}else t.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,a,t.NEAREST)}if(f)for(let d=0;d<u.length;d++){let{textureGPU:A}=this.get(u[d]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.RENDERBUFFER,c[d]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.TEXTURE_2D,A,0)}this._supportsInvalidateFramebuffer===!0&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,s.invalidationArray)}else if(r.resolveDepthBuffer===!1&&s.framebuffers){let o=s.framebuffers[e.getCacheKey()];n.bindFramebuffer(t.DRAW_FRAMEBUFFER,o),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,s.depthInvalidationArray)}}}_useMultisampledExtension(e){return e.multiview===!0?!0:e.samples>0&&this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer!==!1}dispose(){this.textureUtils!==null&&this.textureUtils.dispose();let e=this.extensions.get("WEBGL_lose_context");e&&e.loseContext(),this.renderer.domElement.removeEventListener("webglcontextlost",this._onContextLost)}},tS={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list"},yf=typeof self<"u"&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},jo={Never:"never",Less:"less",Equal:"equal",LessEqual:"less-equal",Greater:"greater",NotEqual:"not-equal",GreaterEqual:"greater-equal",Always:"always"},Za={Store:"store"},Fi={Load:"load",Clear:"clear"},Wte={CCW:"ccw",CW:"cw"},jte={None:"none",Back:"back"},sP={Uint16:"uint16",Uint32:"uint32"},fe={R8Unorm:"r8unorm",R8Snorm:"r8snorm",R8Uint:"r8uint",R8Sint:"r8sint",R16Uint:"r16uint",R16Sint:"r16sint",R16Float:"r16float",RG8Unorm:"rg8unorm",RG8Snorm:"rg8snorm",RG8Uint:"rg8uint",RG8Sint:"rg8sint",R16Unorm:"r16unorm",R16Snorm:"r16snorm",R32Uint:"r32uint",R32Sint:"r32sint",R32Float:"r32float",RG16Uint:"rg16uint",RG16Sint:"rg16sint",RG16Float:"rg16float",RGBA8Unorm:"rgba8unorm",RGBA8UnormSRGB:"rgba8unorm-srgb",RGBA8Snorm:"rgba8snorm",RGBA8Uint:"rgba8uint",RGBA8Sint:"rgba8sint",BGRA8Unorm:"bgra8unorm",BGRA8UnormSRGB:"bgra8unorm-srgb",RG16Unorm:"rg16unorm",RG16Snorm:"rg16snorm",RGB9E5UFloat:"rgb9e5ufloat",RGB10A2Unorm:"rgb10a2unorm",RG11B10UFloat:"rg11b10ufloat",RG32Uint:"rg32uint",RG32Sint:"rg32sint",RG32Float:"rg32float",RGBA16Uint:"rgba16uint",RGBA16Sint:"rgba16sint",RGBA16Float:"rgba16float",RGBA16Unorm:"rgba16unorm",RGBA16Snorm:"rgba16snorm",RGBA32Uint:"rgba32uint",RGBA32Sint:"rgba32sint",RGBA32Float:"rgba32float",Depth16Unorm:"depth16unorm",Depth24Plus:"depth24plus",Depth24PlusStencil8:"depth24plus-stencil8",Depth32Float:"depth32float",Depth32FloatStencil8:"depth32float-stencil8",BC1RGBAUnorm:"bc1-rgba-unorm",BC1RGBAUnormSRGB:"bc1-rgba-unorm-srgb",BC2RGBAUnorm:"bc2-rgba-unorm",BC2RGBAUnormSRGB:"bc2-rgba-unorm-srgb",BC3RGBAUnorm:"bc3-rgba-unorm",BC3RGBAUnormSRGB:"bc3-rgba-unorm-srgb",BC4RUnorm:"bc4-r-unorm",BC4RSnorm:"bc4-r-snorm",BC5RGUnorm:"bc5-rg-unorm",BC5RGSnorm:"bc5-rg-snorm",BC6HRGBUFloat:"bc6h-rgb-ufloat",BC6HRGBFloat:"bc6h-rgb-float",BC7RGBAUnorm:"bc7-rgba-unorm",BC7RGBAUnormSRGB:"bc7-rgba-unorm-srgb",ETC2RGB8Unorm:"etc2-rgb8unorm",ETC2RGB8UnormSRGB:"etc2-rgb8unorm-srgb",ETC2RGB8A1Unorm:"etc2-rgb8a1unorm",ETC2RGB8A1UnormSRGB:"etc2-rgb8a1unorm-srgb",ETC2RGBA8Unorm:"etc2-rgba8unorm",ETC2RGBA8UnormSRGB:"etc2-rgba8unorm-srgb",EACR11Unorm:"eac-r11unorm",EACR11Snorm:"eac-r11snorm",EACRG11Unorm:"eac-rg11unorm",EACRG11Snorm:"eac-rg11snorm",ASTC4x4Unorm:"astc-4x4-unorm",ASTC4x4UnormSRGB:"astc-4x4-unorm-srgb",ASTC5x4Unorm:"astc-5x4-unorm",ASTC5x4UnormSRGB:"astc-5x4-unorm-srgb",ASTC5x5Unorm:"astc-5x5-unorm",ASTC5x5UnormSRGB:"astc-5x5-unorm-srgb",ASTC6x5Unorm:"astc-6x5-unorm",ASTC6x5UnormSRGB:"astc-6x5-unorm-srgb",ASTC6x6Unorm:"astc-6x6-unorm",ASTC6x6UnormSRGB:"astc-6x6-unorm-srgb",ASTC8x5Unorm:"astc-8x5-unorm",ASTC8x5UnormSRGB:"astc-8x5-unorm-srgb",ASTC8x6Unorm:"astc-8x6-unorm",ASTC8x6UnormSRGB:"astc-8x6-unorm-srgb",ASTC8x8Unorm:"astc-8x8-unorm",ASTC8x8UnormSRGB:"astc-8x8-unorm-srgb",ASTC10x5Unorm:"astc-10x5-unorm",ASTC10x5UnormSRGB:"astc-10x5-unorm-srgb",ASTC10x6Unorm:"astc-10x6-unorm",ASTC10x6UnormSRGB:"astc-10x6-unorm-srgb",ASTC10x8Unorm:"astc-10x8-unorm",ASTC10x8UnormSRGB:"astc-10x8-unorm-srgb",ASTC10x10Unorm:"astc-10x10-unorm",ASTC10x10UnormSRGB:"astc-10x10-unorm-srgb",ASTC12x10Unorm:"astc-12x10-unorm",ASTC12x10UnormSRGB:"astc-12x10-unorm-srgb",ASTC12x12Unorm:"astc-12x12-unorm",ASTC12x12UnormSRGB:"astc-12x12-unorm-srgb"},fU={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},Kc={Linear:"linear",Nearest:"nearest"},ui={Zero:"zero",One:"one",Src:"src",OneMinusSrc:"one-minus-src",SrcAlpha:"src-alpha",OneMinusSrcAlpha:"one-minus-src-alpha",Dst:"dst",OneMinusDst:"one-minus-dst",DstAlpha:"dst-alpha",OneMinusDstAlpha:"one-minus-dst-alpha",SrcAlphaSaturated:"src-alpha-saturated",Constant:"constant",OneMinusConstant:"one-minus-constant"},Bg={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},Xte={None:0,All:15},nm={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},dU={Storage:"storage",ReadOnlyStorage:"read-only-storage"},pU={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},$te={NonFiltering:"non-filtering",Comparison:"comparison"},Og={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},Yte={TwoD:"2d",ThreeD:"3d"},Xo={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},RIe={All:"all"},kR={Vertex:"vertex",Instance:"instance"},oP={CoreFeaturesAndLimits:"core-features-and-limits",DepthClipControl:"depth-clip-control",Depth32FloatStencil8:"depth32float-stencil8",TextureCompressionBC:"texture-compression-bc",TextureCompressionBCSliced3D:"texture-compression-bc-sliced-3d",TextureCompressionETC2:"texture-compression-etc2",TextureCompressionASTC:"texture-compression-astc",TextureCompressionASTCSliced3D:"texture-compression-astc-sliced-3d",TimestampQuery:"timestamp-query",IndirectFirstInstance:"indirect-first-instance",ShaderF16:"shader-f16",RG11B10UFloat:"rg11b10ufloat-renderable",BGRA8UNormStorage:"bgra8unorm-storage",Float32Filterable:"float32-filterable",Float32Blendable:"float32-blendable",ClipDistances:"clip-distances",DualSourceBlending:"dual-source-blending",Subgroups:"subgroups",TextureFormatsTier1:"texture-formats-tier1",TextureFormatsTier2:"texture-formats-tier2"},Zte={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"},P9=class extends eP{constructor(e,t,n){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}},I9=class extends Z4{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}},PIe=0,L9=class extends I9{constructor(e,t){super("StorageBuffer_"+PIe++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:Yo.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}},mU=[null],D9=class{constructor(e){this.backend=e,this._preferredCanvasFormat=null}getCurrentDepthStencilFormat(e){let t;return e.depth&&(e.depthTexture!==null?t=this.getTextureFormatGPU(e.depthTexture):e.stencil?this.backend.renderer.reversedDepthBuffer===!0?t=fe.Depth32FloatStencil8:t=fe.Depth24PlusStencil8:this.backend.renderer.reversedDepthBuffer===!0?t=fe.Depth32Float:t=fe.Depth24Plus),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){let s=this.backend.renderer,o=s.getRenderTarget();t=o?o.samples:s.currentSamples}else e.renderTarget&&(t=e.renderTarget.samples);t=this.getSampleCount(t||1);let n=t>1&&e.renderTarget!==null&&e.isDepthTexture!==!0&&e.isFramebufferTexture!==!0;return{samples:t,primarySamples:n?1:t,isMSAA:n}}getCurrentColorFormat(e){let t;return e.textures!==null?t=this.getTextureFormatGPU(e.textures[0]):t=this.getPreferredCanvasFormat(),t}getCurrentColorFormats(e){return e.textures!==null?e.textures.map(t=>this.getTextureFormatGPU(t)):[this.getPreferredCanvasFormat()]}getCurrentColorSpace(e){return e.textures!==null?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){if(e.isPoints)return tS.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return tS.LineList;if(e.isLine)return tS.LineStrip;if(e.isMesh)return tS.TriangleList}getSampleCount(e){return e>=4?4:1}getSampleCountRenderContext(e){return e.textures!==null?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.currentSamples)}getPreferredCanvasFormat(){let t=this.backend.parameters.outputType;if(t===void 0)return this._preferredCanvasFormat===null&&(this._preferredCanvasFormat=navigator.gpu.getPreferredCanvasFormat()),this._preferredCanvasFormat;if(t===Ji)return fe.BGRA8Unorm;if(t===Wi)return fe.RGBA16Float;throw new Error("THREE.WebGPUUtils: Unsupported output buffer type.")}};function mf(i,e){mU[0]=e,i.queue.submit(mU),mU[0]=null}var aP=class{constructor(){this.label="",this.layout=null,this.entries=[]}reset(){this.label="",this.layout=null,this.entries.length=0}},xm=class{constructor(){this.label="",this.size=0,this.usage=0,this.mappedAtCreation=!1}reset(){this.label="",this.size=0,this.usage=0,this.mappedAtCreation=!1}},o1=class{constructor(){this.label=""}reset(){this.label=""}},lP=class{constructor(){this.label="",this.colorFormats=null,this.depthStencilFormat=void 0,this.sampleCount=1,this.depthReadOnly=!1,this.stencilReadOnly=!1}reset(){this.label="",this.colorFormats=null,this.depthStencilFormat=void 0,this.sampleCount=1,this.depthReadOnly=!1,this.stencilReadOnly=!1}},Zg=class{constructor(){this.view=null,this.depthSlice=void 0,this.resolveTarget=void 0,this.clearValue=void 0,this.loadOp=void 0,this.storeOp=void 0}reset(){this.view=null,this.depthSlice=void 0,this.resolveTarget=void 0,this.clearValue=void 0,this.loadOp=void 0,this.storeOp=void 0}},Kg=class{constructor(){this.label="",this.colorAttachments=[],this.depthStencilAttachment=void 0,this.occlusionQuerySet=void 0,this.timestampWrites=void 0,this.maxDrawCount=5e7}reset(){this.label="",this.colorAttachments.length=0,this.depthStencilAttachment=void 0,this.occlusionQuerySet=void 0,this.timestampWrites=void 0,this.maxDrawCount=5e7}},cP=class{constructor(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample=new N9,this.fragment=null}reset(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample.reset(),this.fragment=null}},N9=class{constructor(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}reset(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}},uP=class{constructor(){this.label="",this.code="",this.compilationHints=[]}reset(){this.label="",this.code="",this.compilationHints.length=0}},PS=class{constructor(){this.label="",this.size={width:0,height:1,depthOrArrayLayers:1},this.mipLevelCount=1,this.sampleCount=1,this.dimension="2d",this.format=void 0,this.usage=void 0,this.viewFormats=[],this.textureBindingViewDimension=void 0}reset(){this.label="",this.size.width=0,this.size.height=1,this.size.depthOrArrayLayers=1,this.mipLevelCount=1,this.sampleCount=1,this.dimension="2d",this.format=void 0,this.usage=void 0,this.viewFormats.length=0,this.textureBindingViewDimension=void 0}},IS=class{constructor(){this.label="",this.format=void 0,this.dimension=void 0,this.usage=0,this.aspect="all",this.baseMipLevel=0,this.mipLevelCount=void 0,this.baseArrayLayer=0,this.arrayLayerCount=void 0,this.swizzle="rgba"}reset(){this.label="",this.format=void 0,this.dimension=void 0,this.usage=0,this.aspect="all",this.baseMipLevel=0,this.mipLevelCount=void 0,this.baseArrayLayer=0,this.arrayLayerCount=void 0,this.swizzle="rgba"}},im=new aP,rm=new xm,zR=new o1,AU=new lP,gU=new Kg,$_=new cP,$w=new Zg,VR=new uP,Y_=new PS,vs=new IS,F9=class extends Tf{constructor(e){super(),this.device=e;let t=`43714371 struct VarysStruct {43724372 @builtin( position ) Position: vec4f,43734373 @location( 0 ) vTex : vec2f,
@@ -4441,7 +4441,7 @@ fn main_cube( Varys: VarysStruct ) -> @location( 0 ) vec4<f32> {
44414441 return textureSample( imgCube, imgSampler, faceMat[ Varys.vBaseArrayLayer ] * vec3f( fract( Varys.vTex ), 1 ) );44424442 44434443 }4444-`;this.mipmapSampler=e.createSampler({minFilter:tu.Linear}),this.flipYSampler=e.createSampler({minFilter:tu.Nearest}),sm.size=4,sm.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,this.flipUniformBuffer=e.createBuffer(sm),sm.reset(),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),sm.size=4,sm.usage=GPUBufferUsage.UNIFORM,this.noFlipUniformBuffer=e.createBuffer(sm),sm.reset(),this.transferPipelines={},jR.label="mipmap",jR.code=t,this.mipmapShaderModule=e.createShaderModule(jR),jR.reset()}getTransferPipeline(e,t){t=t||"2d-array";let n=`${e}-${t}`,r=this.transferPipelines[n];return r===void 0&&(Z_.label=`mipmap-${e}-${t}`,Z_.vertex={module:this.mipmapShaderModule},Z_.fragment={module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},Z_.layout="auto",r=this.device.createRenderPipeline(Z_),Z_.reset(),this.transferPipelines[n]=r),r}flipY(e,t,n=0){let r=t.format,{width:s,height:o}=t.size;K_.size.width=s,K_.size.height=o,K_.format=r,K_.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING;let a=this.device.createTexture(K_);K_.reset();let l=this.getTransferPipeline(r,e.textureBindingViewDimension),c=this.getTransferPipeline(r,a.textureBindingViewDimension),u=this.device.createCommandEncoder(WR),f=(d,A,y,w,S,T)=>{let R=d.getBindGroupLayout(0);_s.dimension=A.textureBindingViewDimension||"2d-array",_s.mipLevelCount=1;let P=A.createView(_s);_s.reset(),rm.layout=R,rm.entries.push({binding:0,resource:this.flipYSampler},{binding:1,resource:P},{binding:2,resource:{buffer:T?this.flipUniformBuffer:this.noFlipUniformBuffer}});let I=this.device.createBindGroup(rm);rm.reset(),_s.dimension="2d",_s.mipLevelCount=1,_s.baseArrayLayer=S,_s.arrayLayerCount=1;let F=w.createView(_s);_s.reset(),Kw.view=F,Kw.loadOp=Fi.Clear,Kw.storeOp=Za.Store,gU.colorAttachments.push(Kw);let D=u.beginRenderPass(gU);gU.reset(),Kw.reset(),D.setPipeline(d),D.setBindGroup(0,I),D.draw(3,1,0,y),D.end()};f(l,e,n,a,0,!1),f(c,a,0,e,n,!0),_f(this.device,u.finish()),a.destroy()}generateMipmaps(e,t=null){let n=this.get(e),r=n.layers||this._mipmapCreateBundles(e),s=t;s===null&&(WR.label="mipmapEncoder",s=this.device.createCommandEncoder(WR),WR.reset()),this._mipmapRunBundles(s,r),t===null&&_f(this.device,s.finish()),n.layers=r}_mipmapCreateBundles(e){let t=e.textureBindingViewDimension||"2d-array",n=this.getTransferPipeline(e.format,t),r=n.getBindGroupLayout(0),s=[];for(let o=1;o<e.mipLevelCount;o++)for(let a=0;a<e.depthOrArrayLayers;a++){_s.dimension=t,_s.baseMipLevel=o-1,_s.mipLevelCount=1;let l=e.createView(_s);_s.reset(),rm.layout=r,rm.entries.push({binding:0,resource:this.mipmapSampler},{binding:1,resource:l},{binding:2,resource:{buffer:this.noFlipUniformBuffer}});let c=this.device.createBindGroup(rm);rm.reset(),_s.dimension="2d",_s.baseMipLevel=o,_s.mipLevelCount=1,_s.baseArrayLayer=a,_s.arrayLayerCount=1;let u=e.createView(_s);_s.reset();let f=new Kg;f.view=u,f.loadOp=Fi.Clear,f.storeOp=Za.Store;let d=new Qg;d.colorAttachments.push(f),AU.colorFormats=[e.format];let A=this.device.createRenderBundleEncoder(AU);AU.reset(),A.setPipeline(n),A.setBindGroup(0,c),A.draw(3,1,0,a),s.push({renderBundles:[A.finish()],passDescriptor:d})}return s}_mipmapRunBundles(e,t){let n=t.length;for(let r=0;r<n;r++){let s=t[r],o=e.beginRenderPass(s.passDescriptor);o.executeBundles(s.renderBundles),o.end()}}},B9=class{constructor(){this.label="",this.addressModeU="clamp-to-edge",this.addressModeV="clamp-to-edge",this.addressModeW="clamp-to-edge",this.magFilter="nearest",this.minFilter="nearest",this.mipmapFilter="nearest",this.lodMinClamp=0,this.lodMaxClamp=32,this.compare=void 0,this.maxAnisotropy=1}reset(){this.label="",this.addressModeU="clamp-to-edge",this.addressModeV="clamp-to-edge",this.addressModeW="clamp-to-edge",this.magFilter="nearest",this.minFilter="nearest",this.mipmapFilter="nearest",this.lodMinClamp=0,this.lodMaxClamp=32,this.compare=void 0,this.maxAnisotropy=1}},yx=class{constructor(){this.texture=null,this.mipLevel=0,this.origin={x:0,y:0,z:0},this.aspect="all"}reset(){this.texture=null,this.mipLevel=0,this.origin.x=0,this.origin.y=0,this.origin.z=0,this.aspect="all"}},O9=class{constructor(){this.buffer=null,this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}reset(){this.buffer=null,this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}},U9=class{constructor(){this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}reset(){this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}},k9=class{constructor(){this.source=null,this.origin={x:0,y:0},this.flipY=!1}reset(){this.source=null,this.origin.x=0,this.origin.y=0,this.flipY=!1}},z9=class extends yx{constructor(){super(),this.colorSpace="srgb",this.premultipliedAlpha=!1}reset(){super.reset(),this.colorSpace="srgb",this.premultipliedAlpha=!1}},AI=class{constructor(){this.width=0,this.height=1,this.depthOrArrayLayers=1}reset(){this.width=0,this.height=1,this.depthOrArrayLayers=1}},XR=new ym,NPe=new a1,ma=new B9,_a=new yx,$R=new O9,Kd=new U9,YR=new k9,Q_=new z9,om=new DS,ga=new AI,FPe={[Bb]:"never",[d_]:"less",[Ob]:"equal",[Kh]:"less-equal",[hg]:"greater",[ku]:"greater-equal",[kb]:"always",[Ub]:"not-equal"},BPe=[0,1,3,2,4,5];function tne(i,e,t,n,r,s,o,a,l,c){_a.texture=e,_a.mipLevel=t,_a.origin.z=n,Kd.offset=n*s,Kd.bytesPerRow=o,Kd.rowsPerImage=a,ga.width=l,ga.height=c,i.queue.writeTexture(_a,r.data,Kd,ga),_a.reset(),Kd.reset(),ga.reset()}var V9=class{constructor(e){this.backend=e,this._passUtils=null,this.defaultTexture={},this.defaultCubeTexture={},this.defaultVideoFrame=null,this._samplerCache=new Map}updateSampler(e){let t=this.backend,n=e.texture,r=e.textureNode,s=n.minFilter+"-"+n.magFilter+"-"+n.wrapS+"-"+n.wrapT+"-"+(n.wrapR||"0")+"-"+n.anisotropy+"-"+(n.isDepthTexture===!0?1:0)+"-"+(n.compareFunction!==null&&r.compareNode!==null?n.compareFunction:0),o=this._samplerCache.get(s);if(o===void 0){ma.addressModeU=this._convertAddressMode(n.wrapS),ma.addressModeV=this._convertAddressMode(n.wrapT),ma.addressModeW=this._convertAddressMode(n.wrapR),ma.magFilter=this._convertFilterMode(n.magFilter),ma.minFilter=this._convertFilterMode(n.minFilter),ma.mipmapFilter=this._convertMipmapFilterMode(n.minFilter),n.isDepthTexture&&(n.compareFunction===null||r.compareNode===null)&&(ma.magFilter=tu.Nearest,ma.minFilter=tu.Nearest,ma.mipmapFilter=tu.Nearest),ma.magFilter===tu.Linear&&ma.minFilter===tu.Linear&&ma.mipmapFilter===tu.Linear&&(ma.maxAnisotropy=n.anisotropy),n.isDepthTexture&&n.compareFunction!==null&&r.compareNode!==null&&t.hasCompatibility(kd.TEXTURE_COMPARE)&&(ma.compare=FPe[n.compareFunction]);let l=t.device.createSampler(ma);ma.reset(),o={sampler:l,usedTimes:0},this._samplerCache.set(s,o)}let a=t.get(e);return a.sampler!==o.sampler&&(this._releaseSampler(a),a.samplerKey=s,a.sampler=o.sampler,o.usedTimes++),s}destroySampler(e){this._releaseSampler(this.backend.get(e))}_releaseSampler(e){if(e.sampler!==void 0){let t=this._samplerCache.get(e.samplerKey);t.usedTimes--,t.usedTimes===0&&this._samplerCache.delete(e.samplerKey),e.sampler=void 0,e.samplerKey=void 0}}createDefaultTexture(e){let t,n=G9(e,this.backend.device);e.isCubeTexture?t=this._getDefaultCubeTextureGPU(n):t=this._getDefaultTextureGPU(n),this.backend.get(e).texture=t}createTexture(e,t={}){let n=this.backend,r=n.get(e);if(r.initialized){if(r.externalTexture===!0)return;throw new Error("THREE.WebGPUTextureUtils: Texture already initialized.")}if(e.isExternalTexture){r.texture=e.sourceTexture,r.initialized=!0;return}t.needsMipmaps===void 0&&(t.needsMipmaps=!1),t.levels===void 0&&(t.levels=1),t.depth===void 0&&(t.depth=1);let{width:s,height:o,depth:a,levels:l}=t;e.isFramebufferTexture&&(t.renderTarget?t.format=this.backend.utils.getCurrentColorFormat(t.renderTarget):t.format=this.backend.utils.getPreferredCanvasFormat());let c=this._getDimension(e),u=e.internalFormat||t.format||G9(e,n.device);r.format=u;let{samples:f,primarySamples:d,isMSAA:A}=n.utils.getTextureSampleData(e),y=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;e.isStorageTexture===!0&&(y|=GPUTextureUsage.STORAGE_BINDING),e.isCompressedTexture!==!0&&e.isCompressedArrayTexture!==!0&&u!==fe.RGB9E5UFloat&&(y|=GPUTextureUsage.RENDER_ATTACHMENT);let w=new DS;if(w.label=e.name,w.size.width=s,w.size.height=o,w.size.depthOrArrayLayers=a,w.mipLevelCount=l,w.sampleCount=d,w.dimension=c,w.format=u,w.usage=y,u===void 0){Xe("WebGPURenderer: Texture format not supported."),this.createDefaultTexture(e);return}e.isCubeTexture&&(w.textureBindingViewDimension=Xo.Cube);try{r.texture=n.device.createTexture(w)}catch{Xe("WebGPURenderer: Failed to create texture with descriptor:",w),this.createDefaultTexture(e);return}if(A){let S=Object.assign({},w);S.label=S.label+"-msaa",S.sampleCount=f,S.mipLevelCount=1,r.msaaTexture=n.device.createTexture(S)}r.initialized=!0,r.textureDescriptorGPU=w}destroyTexture(e,t=!1){let n=this.backend,r=n.get(e);r.texture!==void 0&&t===!1&&e.isExternalTexture!==!0&&r.texture.destroy(),r.msaaTexture!==void 0&&r.msaaTexture.destroy(),n.delete(e)}generateMipmaps(e,t=null){let n=this.backend.get(e);this._generateMipmaps(n.texture,t)}getColorBuffer(){let e=this.backend,t=e.renderer.getCanvasTarget(),{width:n,height:r}=e.getDrawingBufferSize(),s=e.renderer.currentSamples,o=t.colorTexture,a=e.get(o);if(o.width===n&&o.height===r&&o.samples===s)return a.texture;let l=a.texture;return l&&l.destroy(),om.label="colorBuffer",om.size.width=n,om.size.height=r,om.sampleCount=e.utils.getSampleCount(e.renderer.currentSamples),om.format=e.utils.getPreferredCanvasFormat(),om.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,l=e.device.createTexture(om),om.reset(),o.source.width=n,o.source.height=r,o.samples=s,a.texture=l,l}getDepthBuffer(e=!0,t=!1){let n=this.backend,r=n.renderer.getCanvasTarget(),{width:s,height:o}=n.getDrawingBufferSize(),a=n.renderer.currentSamples,l=r.depthTexture;if(l.width===s&&l.height===o&&l.samples===a&&l.depth===e&&l.stencil===t)return n.get(l).texture;let c=n.get(l).texture,u,f;if(t?(u=xo,f=n.renderer.reversedDepthBuffer===!0?cr:ua):e&&(u=Gs,f=n.renderer.reversedDepthBuffer===!0?cr:xi),c!==void 0){if(l.image.width===s&&l.image.height===o&&l.format===u&&l.type===f&&l.samples===a)return c;this.destroyTexture(l)}return l.name="depthBuffer",l.format=u,l.type=f,l.image.width=s,l.image.height=o,l.samples=a,this.createTexture(l,{width:s,height:o}),n.get(l).texture}updateTexture(e,t){let n=this.backend.get(e),r=e.mipmaps,{textureDescriptorGPU:s}=n;if(!(e.isRenderTargetTexture||s===void 0)){if(e.isDataTexture)if(r.length>0)for(let o=0,a=r.length;o<a;o++){let l=r[o];this._copyBufferToTexture(l,n.texture,s,0,e.flipY,0,o)}else this._copyBufferToTexture(t.image,n.texture,s,0,e.flipY);else if(e.isArrayTexture||e.isDataArrayTexture||e.isData3DTexture)if(e.layerUpdates&&e.layerUpdates.size>0){for(let o of e.layerUpdates)this._copyBufferToTexture(t.image,n.texture,s,o,e.flipY,o);e.clearLayerUpdates()}else for(let o=0;o<t.image.depth;o++)this._copyBufferToTexture(t.image,n.texture,s,o,e.flipY,o);else if(e.isCompressedTexture||e.isCompressedArrayTexture)e.isCompressedArrayTexture&&e.layerUpdates.size>0?(this._copyCompressedBufferToTexture(e.mipmaps,n.texture,s,e.layerUpdates),e.clearLayerUpdates()):this._copyCompressedBufferToTexture(e.mipmaps,n.texture,s);else if(e.isCubeTexture)this._copyCubeMapToTexture(e,n.texture,s);else if(e.isHTMLTexture){let o=this.backend.device,a=this.backend.renderer.domElement,l=e.image;if(typeof o.queue.copyElementImageToTexture!="function")return;if(!n.hasPaintCallback){n.hasPaintCallback=!0,a.requestPaint();return}let c=s.size.width,u=s.size.height;o.queue.copyElementImageToTexture.length===2?o.queue.copyElementImageToTexture({source:l},{destination:{texture:n.texture},width:c,height:u}):o.queue.copyElementImageToTexture(l,c,u,{texture:n.texture}),e.flipY&&this._flipY(n.texture,s)}else if(r.length>0)for(let o=0,a=r.length;o<a;o++){let l=r[o];this._copyImageToTexture(l,n.texture,s,0,e.flipY,e.premultiplyAlpha,o)}else this._copyImageToTexture(t.image,n.texture,s,0,e.flipY,e.premultiplyAlpha);n.version=e.version}}async copyTextureToBuffer(e,t,n,r,s,o){let a=this.backend.device,l=this.backend.get(e),c=l.texture,u=l.textureDescriptorGPU.format,f=this._getBytesPerTexel(u),d=r*f;d=Math.ceil(d/256)*256,XR.size=(s-1)*d+r*f,XR.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let A=a.createBuffer(XR);XR.reset();let y=a.createCommandEncoder(NPe);_a.texture=c,_a.origin.x=t,_a.origin.y=n,_a.origin.z=o,$R.buffer=A,$R.bytesPerRow=d,ga.width=r,ga.height=s,y.copyTextureToBuffer(_a,$R,ga),_a.reset(),$R.reset(),ga.reset();let w=this._getTypedArrayType(u);_f(a,y.finish()),await A.mapAsync(GPUMapMode.READ);let S=A.getMappedRange().slice();return A.destroy(),new w(S)}dispose(){this._samplerCache.clear()}_getDefaultTextureGPU(e){let t=this.defaultTexture[e];if(t===void 0){let n=new Hs;n.minFilter=Ti,n.magFilter=Ti,this.createTexture(n,{width:1,height:1,format:e}),this.defaultTexture[e]=t=n}return this.backend.get(t).texture}_getDefaultCubeTextureGPU(e){let t=this.defaultCubeTexture[e];if(t===void 0){let n=new Nh;n.minFilter=Ti,n.magFilter=Ti,this.createTexture(n,{width:1,height:1,depth:6}),this.defaultCubeTexture[e]=t=n}return this.backend.get(t).texture}_copyCubeMapToTexture(e,t,n){let r=e.images,s=e.mipmaps;for(let o=0;o<6;o++){let a=r[o],l=e.flipY===!0?BPe[o]:o;a.isDataTexture?this._copyBufferToTexture(a.image,t,n,l,e.flipY):this._copyImageToTexture(a,t,n,l,e.flipY,e.premultiplyAlpha);for(let c=0;c<s.length;c++){let f=s[c].images[o];f.isDataTexture?this._copyBufferToTexture(f.image,t,n,l,e.flipY,0,c+1):this._copyImageToTexture(f,t,n,l,e.flipY,e.premultiplyAlpha,c+1)}}}_copyImageToTexture(e,t,n,r,s,o,a=0){let l=this.backend.device,c=a>0?e.width:n.size.width,u=a>0?e.height:n.size.height;YR.source=e,YR.flipY=s,Q_.texture=t,Q_.mipLevel=a,Q_.origin.z=r,Q_.premultipliedAlpha=o,ga.width=c,ga.height=u;try{l.queue.copyExternalImageToTexture(YR,Q_,ga)}catch{}finally{YR.reset(),Q_.reset(),ga.reset()}}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new F9(this.backend.device)),e}_generateMipmaps(e,t=null){this._getPassUtils().generateMipmaps(e,t)}_flipY(e,t,n=0){this._getPassUtils().flipY(e,t,n)}_copyBufferToTexture(e,t,n,r,s,o=0,a=0){let l=this.backend.device,c=e.data,u=this._getBytesPerTexel(n.format),f=e.width*u;_a.texture=t,_a.mipLevel=a,_a.origin.z=r,Kd.offset=e.width*e.height*u*o,Kd.bytesPerRow=f,ga.width=e.width,ga.height=e.height,l.queue.writeTexture(_a,c,Kd,ga),_a.reset(),Kd.reset(),ga.reset(),s===!0&&this._flipY(t,n,r)}_copyCompressedBufferToTexture(e,t,n,r=null){let s=this.backend.device,o=this._getBlockData(n.format),a=n.size.depthOrArrayLayers>1,l=r&&r.size>0?r:null;for(let c=0;c<e.length;c++){let u=e[c],f=u.width,d=u.height,A=a?n.size.depthOrArrayLayers:1,y=Math.ceil(f/o.width)*o.byteLength,w=Math.ceil(d/o.height),S=y*w,T=Math.ceil(f/o.width)*o.width,R=w*o.height;if(l!==null)for(let P of l)tne(s,t,c,P,u,S,y,w,T,R);else for(let P=0;P<A;P++)tne(s,t,c,P,u,S,y,w,T,R)}}_getBlockData(e){if(e===fe.BC1RGBAUnorm||e===fe.BC1RGBAUnormSRGB)return{byteLength:8,width:4,height:4};if(e===fe.BC2RGBAUnorm||e===fe.BC2RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.BC3RGBAUnorm||e===fe.BC3RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.BC4RUnorm||e===fe.BC4RSnorm)return{byteLength:8,width:4,height:4};if(e===fe.BC5RGUnorm||e===fe.BC5RGSnorm)return{byteLength:16,width:4,height:4};if(e===fe.BC6HRGBUFloat||e===fe.BC6HRGBFloat)return{byteLength:16,width:4,height:4};if(e===fe.BC7RGBAUnorm||e===fe.BC7RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.ETC2RGB8Unorm||e===fe.ETC2RGB8UnormSRGB)return{byteLength:8,width:4,height:4};if(e===fe.ETC2RGB8A1Unorm||e===fe.ETC2RGB8A1UnormSRGB)return{byteLength:8,width:4,height:4};if(e===fe.ETC2RGBA8Unorm||e===fe.ETC2RGBA8UnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.EACR11Unorm)return{byteLength:8,width:4,height:4};if(e===fe.EACR11Snorm)return{byteLength:8,width:4,height:4};if(e===fe.EACRG11Unorm)return{byteLength:16,width:4,height:4};if(e===fe.EACRG11Snorm)return{byteLength:16,width:4,height:4};if(e===fe.ASTC4x4Unorm||e===fe.ASTC4x4UnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.ASTC5x4Unorm||e===fe.ASTC5x4UnormSRGB)return{byteLength:16,width:5,height:4};if(e===fe.ASTC5x5Unorm||e===fe.ASTC5x5UnormSRGB)return{byteLength:16,width:5,height:5};if(e===fe.ASTC6x5Unorm||e===fe.ASTC6x5UnormSRGB)return{byteLength:16,width:6,height:5};if(e===fe.ASTC6x6Unorm||e===fe.ASTC6x6UnormSRGB)return{byteLength:16,width:6,height:6};if(e===fe.ASTC8x5Unorm||e===fe.ASTC8x5UnormSRGB)return{byteLength:16,width:8,height:5};if(e===fe.ASTC8x6Unorm||e===fe.ASTC8x6UnormSRGB)return{byteLength:16,width:8,height:6};if(e===fe.ASTC8x8Unorm||e===fe.ASTC8x8UnormSRGB)return{byteLength:16,width:8,height:8};if(e===fe.ASTC10x5Unorm||e===fe.ASTC10x5UnormSRGB)return{byteLength:16,width:10,height:5};if(e===fe.ASTC10x6Unorm||e===fe.ASTC10x6UnormSRGB)return{byteLength:16,width:10,height:6};if(e===fe.ASTC10x8Unorm||e===fe.ASTC10x8UnormSRGB)return{byteLength:16,width:10,height:8};if(e===fe.ASTC10x10Unorm||e===fe.ASTC10x10UnormSRGB)return{byteLength:16,width:10,height:10};if(e===fe.ASTC12x10Unorm||e===fe.ASTC12x10UnormSRGB)return{byteLength:16,width:12,height:10};if(e===fe.ASTC12x12Unorm||e===fe.ASTC12x12UnormSRGB)return{byteLength:16,width:12,height:12}}_convertAddressMode(e){let t=fU.ClampToEdge;return e===Rd?t=fU.Repeat:e===Id&&(t=fU.MirrorRepeat),t}_convertFilterMode(e){let t=tu.Linear;return(e===Ti||e===Db||e===Xc)&&(t=tu.Nearest),t}_convertMipmapFilterMode(e){return e===Xc||e===Go?tu.Linear:tu.Nearest}_getBytesPerTexel(e){if(e===fe.R8Unorm||e===fe.R8Snorm||e===fe.R8Uint||e===fe.R8Sint)return 1;if(e===fe.R16Uint||e===fe.R16Sint||e===fe.R16Float||e===fe.RG8Unorm||e===fe.RG8Snorm||e===fe.RG8Uint||e===fe.RG8Sint||e===fe.R16Unorm||e===fe.R16Snorm)return 2;if(e===fe.R32Uint||e===fe.R32Sint||e===fe.R32Float||e===fe.RG16Uint||e===fe.RG16Sint||e===fe.RG16Float||e===fe.RGBA8Unorm||e===fe.RGBA8UnormSRGB||e===fe.RGBA8Snorm||e===fe.RGBA8Uint||e===fe.RGBA8Sint||e===fe.BGRA8Unorm||e===fe.BGRA8UnormSRGB||e===fe.RG16Unorm||e===fe.RG16Snorm||e===fe.RGB9E5UFloat||e===fe.RGB10A2Unorm||e===fe.RG11B10UFloat||e===fe.Depth32Float||e===fe.Depth24Plus||e===fe.Depth24PlusStencil8||e===fe.Depth32FloatStencil8)return 4;if(e===fe.RG32Uint||e===fe.RG32Sint||e===fe.RG32Float||e===fe.RGBA16Uint||e===fe.RGBA16Sint||e===fe.RGBA16Float||e===fe.RGBA16Unorm||e===fe.RGBA16Snorm)return 8;if(e===fe.RGBA32Uint||e===fe.RGBA32Sint||e===fe.RGBA32Float)return 16}_getTypedArrayType(e){if(e===fe.R8Uint)return Uint8Array;if(e===fe.R8Sint)return Int8Array;if(e===fe.R8Unorm)return Uint8Array;if(e===fe.R8Snorm)return Int8Array;if(e===fe.RG8Uint)return Uint8Array;if(e===fe.RG8Sint)return Int8Array;if(e===fe.RG8Unorm)return Uint8Array;if(e===fe.RG8Snorm)return Int8Array;if(e===fe.RGBA8Uint)return Uint8Array;if(e===fe.RGBA8Sint)return Int8Array;if(e===fe.RGBA8Unorm||e===fe.RGBA8UnormSRGB)return Uint8Array;if(e===fe.RGBA8Snorm)return Int8Array;if(e===fe.R16Uint)return Uint16Array;if(e===fe.R16Sint)return Int16Array;if(e===fe.RG16Uint)return Uint16Array;if(e===fe.RG16Sint)return Int16Array;if(e===fe.RGBA16Uint)return Uint16Array;if(e===fe.RGBA16Sint)return Int16Array;if(e===fe.R16Float||e===fe.RG16Float||e===fe.RGBA16Float||e===fe.R16Unorm)return Uint16Array;if(e===fe.R16Snorm)return Int16Array;if(e===fe.RG16Unorm)return Uint16Array;if(e===fe.RG16Snorm)return Int16Array;if(e===fe.RGBA16Unorm)return Uint16Array;if(e===fe.RGBA16Snorm)return Int16Array;if(e===fe.R32Uint)return Uint32Array;if(e===fe.R32Sint)return Int32Array;if(e===fe.R32Float)return Float32Array;if(e===fe.RG32Uint)return Uint32Array;if(e===fe.RG32Sint)return Int32Array;if(e===fe.RG32Float)return Float32Array;if(e===fe.RGBA32Uint)return Uint32Array;if(e===fe.RGBA32Sint)return Int32Array;if(e===fe.RGBA32Float)return Float32Array;if(e===fe.BGRA8Unorm||e===fe.BGRA8UnormSRGB)return Uint8Array;if(e===fe.RGB10A2Unorm||e===fe.RGB9E5UFloat||e===fe.RG11B10UFloat)return Uint32Array;if(e===fe.Depth32Float)return Float32Array;if(e===fe.Depth24Plus||e===fe.Depth24PlusStencil8)return Uint32Array;if(e===fe.Depth32FloatStencil8)return Float32Array}_getDimension(e){let t;return e.is3DTexture||e.isData3DTexture?t=Jte.ThreeD:t=Jte.TwoD,t}};function G9(i,e){let t=i.format,n=i.type,r=i.normalized,s=i.colorSpace,o=ln.getTransfer(s),a,l=!1;if(r&&(l=e.features.has(hI.TextureFormatsTier1),l===!1&&Xe("WebGPURenderer: Unable to use normalized textures without texture-formats-tier1 feature.")),i.isCompressedTexture===!0||i.isCompressedArrayTexture===!0)switch(t){case Wh:case jh:a=o===kt?fe.BC1RGBAUnormSRGB:fe.BC1RGBAUnorm;break;case Xh:a=o===kt?fe.BC2RGBAUnormSRGB:fe.BC2RGBAUnorm;break;case $h:a=o===kt?fe.BC3RGBAUnormSRGB:fe.BC3RGBAUnorm;break;case G0:a=fe.BC4RUnorm;break;case q0:a=fe.BC4RSnorm;break;case Zh:a=fe.BC5RGUnorm;break;case H0:a=fe.BC5RGSnorm;break;case k0:a=o===kt?fe.BC7RGBAUnormSRGB:fe.BC7RGBAUnorm;break;case z0:a=fe.BC6HRGBFloat;break;case V0:a=fe.BC6HRGBUFloat;break;case x0:case _0:a=o===kt?fe.ETC2RGB8UnormSRGB:fe.ETC2RGB8Unorm;break;case y0:a=o===kt?fe.ETC2RGBA8UnormSRGB:fe.ETC2RGBA8Unorm;break;case b0:a=fe.EACR11Unorm;break;case w0:a=fe.EACR11Snorm;break;case Yh:a=fe.EACRG11Unorm;break;case S0:a=fe.EACRG11Snorm;break;case T0:a=o===kt?fe.ASTC4x4UnormSRGB:fe.ASTC4x4Unorm;break;case E0:a=o===kt?fe.ASTC5x4UnormSRGB:fe.ASTC5x4Unorm;break;case M0:a=o===kt?fe.ASTC5x5UnormSRGB:fe.ASTC5x5Unorm;break;case C0:a=o===kt?fe.ASTC6x5UnormSRGB:fe.ASTC6x5Unorm;break;case R0:a=o===kt?fe.ASTC6x6UnormSRGB:fe.ASTC6x6Unorm;break;case I0:a=o===kt?fe.ASTC8x5UnormSRGB:fe.ASTC8x5Unorm;break;case P0:a=o===kt?fe.ASTC8x6UnormSRGB:fe.ASTC8x6Unorm;break;case L0:a=o===kt?fe.ASTC8x8UnormSRGB:fe.ASTC8x8Unorm;break;case D0:a=o===kt?fe.ASTC10x5UnormSRGB:fe.ASTC10x5Unorm;break;case N0:a=o===kt?fe.ASTC10x6UnormSRGB:fe.ASTC10x6Unorm;break;case F0:a=o===kt?fe.ASTC10x8UnormSRGB:fe.ASTC10x8Unorm;break;case B0:a=o===kt?fe.ASTC10x10UnormSRGB:fe.ASTC10x10Unorm;break;case O0:a=o===kt?fe.ASTC12x10UnormSRGB:fe.ASTC12x10Unorm;break;case U0:a=o===kt?fe.ASTC12x12UnormSRGB:fe.ASTC12x12Unorm;break;case Ur:a=o===kt?fe.RGBA8UnormSRGB:fe.RGBA8Unorm;break;default:ze("WebGPURenderer: Unsupported texture format.",t)}else switch(t){case Ur:switch(n){case Vh:a=fe.RGBA8Snorm;break;case Gh:a=l?fe.RGBA16Snorm:fe.RGBA16Sint;break;case Sl:a=l?fe.RGBA16Unorm:fe.RGBA16Uint;break;case xi:a=fe.RGBA32Uint;break;case Kr:a=fe.RGBA32Sint;break;case Ji:a=o===kt?fe.RGBA8UnormSRGB:fe.RGBA8Unorm;break;case Wi:a=fe.RGBA16Float;break;case cr:a=fe.RGBA32Float;break;default:ze("WebGPURenderer: Unsupported texture type with RGBAFormat.",n)}break;case Od:switch(n){case sg:a=fe.RGB9E5UFloat;break;case og:a=fe.RG11B10UFloat;break;default:ze("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case Ud:switch(n){case Vh:a=fe.R8Snorm;break;case Gh:a=l?fe.R16Snorm:fe.R16Sint;break;case Sl:a=l?fe.R16Unorm:fe.R16Uint;break;case xi:a=fe.R32Uint;break;case Kr:a=fe.R32Sint;break;case Ji:a=fe.R8Unorm;break;case Wi:a=fe.R16Float;break;case cr:a=fe.R32Float;break;default:ze("WebGPURenderer: Unsupported texture type with RedFormat.",n)}break;case js:switch(n){case Vh:a=fe.RG8Snorm;break;case Gh:a=l?fe.RG16Snorm:fe.RG16Sint;break;case Sl:a=l?fe.RG16Unorm:fe.RG16Uint;break;case xi:a=fe.RG32Uint;break;case Kr:a=fe.RG32Sint;break;case Ji:a=fe.RG8Unorm;break;case Wi:a=fe.RG16Float;break;case cr:a=fe.RG32Float;break;default:ze("WebGPURenderer: Unsupported texture type with RGFormat.",n)}break;case Gs:switch(n){case Sl:a=fe.Depth16Unorm;break;case xi:a=fe.Depth24Plus;break;case cr:a=fe.Depth32Float;break;default:ze("WebGPURenderer: Unsupported texture type with DepthFormat.",n)}break;case xo:switch(n){case ua:a=fe.Depth24PlusStencil8;break;case cr:e&&e.features.has(hI.Depth32FloatStencil8)===!1&&ze('WebGPURenderer: Depth textures with DepthStencilFormat + FloatType can only be used with the "depth32float-stencil8" GPU feature.'),a=fe.Depth32FloatStencil8;break;default:ze("WebGPURenderer: Unsupported texture type with DepthStencilFormat.",n)}break;case qh:switch(n){case Kr:a=fe.R32Sint;break;case xi:a=fe.R32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case Hh:switch(n){case Kr:a=fe.RG32Sint;break;case xi:a=fe.RG32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n)}break;case v0:switch(n){case Kr:a=fe.RGBA32Sint;break;case xi:a=fe.RGBA32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RGBAIntegerFormat.",n)}break;default:ze("WebGPURenderer: Unsupported texture format.",t)}return a}var OPe=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,UPe=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,nne={f32:"float",i32:"int",u32:"uint",bool:"bool","vec2<f32>":"vec2","vec2<i32>":"ivec2","vec2<u32>":"uvec2","vec2<bool>":"bvec2",vec2f:"vec2",vec2i:"ivec2",vec2u:"uvec2",vec2b:"bvec2","vec3<f32>":"vec3","vec3<i32>":"ivec3","vec3<u32>":"uvec3","vec3<bool>":"bvec3",vec3f:"vec3",vec3i:"ivec3",vec3u:"uvec3",vec3b:"bvec3","vec4<f32>":"vec4","vec4<i32>":"ivec4","vec4<u32>":"uvec4","vec4<bool>":"bvec4",vec4f:"vec4",vec4i:"ivec4",vec4u:"uvec4",vec4b:"bvec4","mat2x2<f32>":"mat2",mat2x2f:"mat2","mat3x3<f32>":"mat3",mat3x3f:"mat3","mat4x4<f32>":"mat4",mat4x4f:"mat4",sampler:"sampler",texture_1d:"texture",texture_2d:"texture",texture_2d_array:"texture",texture_multisampled_2d:"cubeTexture",texture_depth_2d:"depthTexture",texture_depth_2d_array:"depthTexture",texture_depth_multisampled_2d:"depthTexture",texture_depth_cube:"depthTexture",texture_depth_cube_array:"depthTexture",texture_3d:"texture3D",texture_cube:"cubeTexture",texture_cube_array:"cubeTexture",texture_storage_1d:"storageTexture",texture_storage_2d:"storageTexture",texture_storage_2d_array:"storageTexture",texture_storage_3d:"storageTexture"},kPe=i=>{i=i.trim();let e=i.match(OPe);if(e!==null&&e.length===4){let t=e[2],n=[],r=null;for(;(r=UPe.exec(t))!==null;)n.push({name:r[1],type:r[2]});let s=[];for(let u=0;u<n.length;u++){let{name:f,type:d}=n[u],A=d;A.startsWith("ptr")?A="pointer":(A.startsWith("texture")&&(A=d.split("<")[0]),A=nne[A]),s.push(new RS(A,f))}let o=i.substring(e[0].length),a=e[3]||"void",l=e[1]!==void 0?e[1]:"";return{type:nne[a]||a,inputs:s,name:l,inputsCode:t,blockCode:o,outputType:a}}else throw new Error("THREE.WGSLNodeFunction: Function is not a WGSL code.")},q9=class extends PS{constructor(e){let{type:t,inputs:n,name:r,inputsCode:s,blockCode:o,outputType:a}=kPe(e);super(t,n,r),this.inputsCode=s,this.blockCode=o,this.outputType=a}getCode(e=this.name){let t=this.outputType!=="void"?"-> "+this.outputType:"";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}},H9=class extends K4{parseFunction(e){return new q9(e)}},zPe={[Yo.READ_ONLY]:"read",[Yo.WRITE_ONLY]:"write",[Yo.READ_WRITE]:"read_write"},ine={[Rd]:"repeat",[la]:"clamp",[Id]:"mirror"},vU={vertex:Tf.VERTEX,fragment:Tf.FRAGMENT,compute:Tf.COMPUTE},rne={instance:!0,swizzleAssign:!1,storageBuffer:!0},VPe={"^^":"tsl_xor"},GPe={float:"f32",int:"i32",uint:"u32",bool:"bool",color:"vec3<f32>",vec2:"vec2<f32>",ivec2:"vec2<i32>",uvec2:"vec2<u32>",bvec2:"vec2<bool>",vec3:"vec3<f32>",ivec3:"vec3<i32>",uvec3:"vec3<u32>",bvec3:"vec3<bool>",vec4:"vec4<f32>",ivec4:"vec4<i32>",uvec4:"vec4<u32>",bvec4:"vec4<bool>",mat2:"mat2x2<f32>",mat3:"mat3x3<f32>",mat4:"mat4x4<f32>"},sne={},Qw={tsl_xor:new hr("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new hr("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new hr("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new hr("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new hr("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new hr("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new hr("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new hr("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3<bool> { return vec3<bool>( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new hr("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4<bool> { return vec4<bool>( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new hr("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new hr("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new hr("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),inverse_mat2:new hr(`4444+`;this.mipmapSampler=e.createSampler({minFilter:Kc.Linear}),this.flipYSampler=e.createSampler({minFilter:Kc.Nearest}),rm.size=4,rm.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,this.flipUniformBuffer=e.createBuffer(rm),rm.reset(),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),rm.size=4,rm.usage=GPUBufferUsage.UNIFORM,this.noFlipUniformBuffer=e.createBuffer(rm),rm.reset(),this.transferPipelines={},VR.label="mipmap",VR.code=t,this.mipmapShaderModule=e.createShaderModule(VR),VR.reset()}getTransferPipeline(e,t){t=t||"2d-array";let n=`${e}-${t}`,r=this.transferPipelines[n];return r===void 0&&($_.label=`mipmap-${e}-${t}`,$_.vertex={module:this.mipmapShaderModule},$_.fragment={module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},$_.layout="auto",r=this.device.createRenderPipeline($_),$_.reset(),this.transferPipelines[n]=r),r}flipY(e,t,n=0){let r=t.format,{width:s,height:o}=t.size;Y_.size.width=s,Y_.size.height=o,Y_.format=r,Y_.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING;let a=this.device.createTexture(Y_);Y_.reset();let l=this.getTransferPipeline(r,e.textureBindingViewDimension),c=this.getTransferPipeline(r,a.textureBindingViewDimension),u=this.device.createCommandEncoder(zR),f=(d,A,y,w,S,T)=>{let R=d.getBindGroupLayout(0);vs.dimension=A.textureBindingViewDimension||"2d-array",vs.mipLevelCount=1;let I=A.createView(vs);vs.reset(),im.layout=R,im.entries.push({binding:0,resource:this.flipYSampler},{binding:1,resource:I},{binding:2,resource:{buffer:T?this.flipUniformBuffer:this.noFlipUniformBuffer}});let P=this.device.createBindGroup(im);im.reset(),vs.dimension="2d",vs.mipLevelCount=1,vs.baseArrayLayer=S,vs.arrayLayerCount=1;let F=w.createView(vs);vs.reset(),$w.view=F,$w.loadOp=Fi.Clear,$w.storeOp=Za.Store,gU.colorAttachments.push($w);let D=u.beginRenderPass(gU);gU.reset(),$w.reset(),D.setPipeline(d),D.setBindGroup(0,P),D.draw(3,1,0,y),D.end()};f(l,e,n,a,0,!1),f(c,a,0,e,n,!0),mf(this.device,u.finish()),a.destroy()}generateMipmaps(e,t=null){let n=this.get(e),r=n.layers||this._mipmapCreateBundles(e),s=t;s===null&&(zR.label="mipmapEncoder",s=this.device.createCommandEncoder(zR),zR.reset()),this._mipmapRunBundles(s,r),t===null&&mf(this.device,s.finish()),n.layers=r}_mipmapCreateBundles(e){let t=e.textureBindingViewDimension||"2d-array",n=this.getTransferPipeline(e.format,t),r=n.getBindGroupLayout(0),s=[];for(let o=1;o<e.mipLevelCount;o++)for(let a=0;a<e.depthOrArrayLayers;a++){vs.dimension=t,vs.baseMipLevel=o-1,vs.mipLevelCount=1;let l=e.createView(vs);vs.reset(),im.layout=r,im.entries.push({binding:0,resource:this.mipmapSampler},{binding:1,resource:l},{binding:2,resource:{buffer:this.noFlipUniformBuffer}});let c=this.device.createBindGroup(im);im.reset(),vs.dimension="2d",vs.baseMipLevel=o,vs.mipLevelCount=1,vs.baseArrayLayer=a,vs.arrayLayerCount=1;let u=e.createView(vs);vs.reset();let f=new Zg;f.view=u,f.loadOp=Fi.Clear,f.storeOp=Za.Store;let d=new Kg;d.colorAttachments.push(f),AU.colorFormats=[e.format];let A=this.device.createRenderBundleEncoder(AU);AU.reset(),A.setPipeline(n),A.setBindGroup(0,c),A.draw(3,1,0,a),s.push({renderBundles:[A.finish()],passDescriptor:d})}return s}_mipmapRunBundles(e,t){let n=t.length;for(let r=0;r<n;r++){let s=t[r],o=e.beginRenderPass(s.passDescriptor);o.executeBundles(s.renderBundles),o.end()}}},B9=class{constructor(){this.label="",this.addressModeU="clamp-to-edge",this.addressModeV="clamp-to-edge",this.addressModeW="clamp-to-edge",this.magFilter="nearest",this.minFilter="nearest",this.mipmapFilter="nearest",this.lodMinClamp=0,this.lodMaxClamp=32,this.compare=void 0,this.maxAnisotropy=1}reset(){this.label="",this.addressModeU="clamp-to-edge",this.addressModeV="clamp-to-edge",this.addressModeW="clamp-to-edge",this.magFilter="nearest",this.minFilter="nearest",this.mipmapFilter="nearest",this.lodMinClamp=0,this.lodMaxClamp=32,this.compare=void 0,this.maxAnisotropy=1}},_x=class{constructor(){this.texture=null,this.mipLevel=0,this.origin={x:0,y:0,z:0},this.aspect="all"}reset(){this.texture=null,this.mipLevel=0,this.origin.x=0,this.origin.y=0,this.origin.z=0,this.aspect="all"}},O9=class{constructor(){this.buffer=null,this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}reset(){this.buffer=null,this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}},U9=class{constructor(){this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}reset(){this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}},k9=class{constructor(){this.source=null,this.origin={x:0,y:0},this.flipY=!1}reset(){this.source=null,this.origin.x=0,this.origin.y=0,this.flipY=!1}},z9=class extends _x{constructor(){super(),this.colorSpace="srgb",this.premultipliedAlpha=!1}reset(){super.reset(),this.colorSpace="srgb",this.premultipliedAlpha=!1}},hP=class{constructor(){this.width=0,this.height=1,this.depthOrArrayLayers=1}reset(){this.width=0,this.height=1,this.depthOrArrayLayers=1}},GR=new xm,IIe=new o1,ma=new B9,_a=new _x,qR=new O9,$d=new U9,HR=new k9,Z_=new z9,sm=new PS,ga=new hP,LIe={[Db]:"never",[h_]:"less",[Nb]:"equal",[Xh]:"less-equal",[ug]:"greater",[Fu]:"greater-equal",[Bb]:"always",[Fb]:"not-equal"},DIe=[0,1,3,2,4,5];function Kte(i,e,t,n,r,s,o,a,l,c){_a.texture=e,_a.mipLevel=t,_a.origin.z=n,$d.offset=n*s,$d.bytesPerRow=o,$d.rowsPerImage=a,ga.width=l,ga.height=c,i.queue.writeTexture(_a,r.data,$d,ga),_a.reset(),$d.reset(),ga.reset()}var V9=class{constructor(e){this.backend=e,this._passUtils=null,this.defaultTexture={},this.defaultCubeTexture={},this.defaultVideoFrame=null,this._samplerCache=new Map}updateSampler(e){let t=this.backend,n=e.texture,r=e.textureNode,s=n.minFilter+"-"+n.magFilter+"-"+n.wrapS+"-"+n.wrapT+"-"+(n.wrapR||"0")+"-"+n.anisotropy+"-"+(n.isDepthTexture===!0?1:0)+"-"+(n.compareFunction!==null&&r.compareNode!==null?n.compareFunction:0),o=this._samplerCache.get(s);if(o===void 0){ma.addressModeU=this._convertAddressMode(n.wrapS),ma.addressModeV=this._convertAddressMode(n.wrapT),ma.addressModeW=this._convertAddressMode(n.wrapR),ma.magFilter=this._convertFilterMode(n.magFilter),ma.minFilter=this._convertFilterMode(n.minFilter),ma.mipmapFilter=this._convertMipmapFilterMode(n.minFilter),n.isDepthTexture&&(n.compareFunction===null||r.compareNode===null)&&(ma.magFilter=Kc.Nearest,ma.minFilter=Kc.Nearest,ma.mipmapFilter=Kc.Nearest),ma.magFilter===Kc.Linear&&ma.minFilter===Kc.Linear&&ma.mipmapFilter===Kc.Linear&&(ma.maxAnisotropy=n.anisotropy),n.isDepthTexture&&n.compareFunction!==null&&r.compareNode!==null&&t.hasCompatibility(Bd.TEXTURE_COMPARE)&&(ma.compare=LIe[n.compareFunction]);let l=t.device.createSampler(ma);ma.reset(),o={sampler:l,usedTimes:0},this._samplerCache.set(s,o)}let a=t.get(e);return a.sampler!==o.sampler&&(this._releaseSampler(a),a.samplerKey=s,a.sampler=o.sampler,o.usedTimes++),s}destroySampler(e){this._releaseSampler(this.backend.get(e))}_releaseSampler(e){if(e.sampler!==void 0){let t=this._samplerCache.get(e.samplerKey);t.usedTimes--,t.usedTimes===0&&this._samplerCache.delete(e.samplerKey),e.sampler=void 0,e.samplerKey=void 0}}createDefaultTexture(e){let t,n=G9(e,this.backend.device);e.isCubeTexture?t=this._getDefaultCubeTextureGPU(n):t=this._getDefaultTextureGPU(n),this.backend.get(e).texture=t}createTexture(e,t={}){let n=this.backend,r=n.get(e);if(r.initialized){if(r.externalTexture===!0)return;throw new Error("THREE.WebGPUTextureUtils: Texture already initialized.")}if(e.isExternalTexture){r.texture=e.sourceTexture,r.initialized=!0;return}t.needsMipmaps===void 0&&(t.needsMipmaps=!1),t.levels===void 0&&(t.levels=1),t.depth===void 0&&(t.depth=1);let{width:s,height:o,depth:a,levels:l}=t;e.isFramebufferTexture&&(t.renderTarget?t.format=this.backend.utils.getCurrentColorFormat(t.renderTarget):t.format=this.backend.utils.getPreferredCanvasFormat());let c=this._getDimension(e),u=e.internalFormat||t.format||G9(e,n.device);r.format=u;let{samples:f,primarySamples:d,isMSAA:A}=n.utils.getTextureSampleData(e),y=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;e.isStorageTexture===!0&&(y|=GPUTextureUsage.STORAGE_BINDING),e.isCompressedTexture!==!0&&e.isCompressedArrayTexture!==!0&&u!==fe.RGB9E5UFloat&&(y|=GPUTextureUsage.RENDER_ATTACHMENT);let w=new PS;if(w.label=e.name,w.size.width=s,w.size.height=o,w.size.depthOrArrayLayers=a,w.mipLevelCount=l,w.sampleCount=d,w.dimension=c,w.format=u,w.usage=y,u===void 0){Xe("WebGPURenderer: Texture format not supported."),this.createDefaultTexture(e);return}e.isCubeTexture&&(w.textureBindingViewDimension=Xo.Cube);try{r.texture=n.device.createTexture(w)}catch{Xe("WebGPURenderer: Failed to create texture with descriptor:",w),this.createDefaultTexture(e);return}if(A){let S=Object.assign({},w);S.label=S.label+"-msaa",S.sampleCount=f,S.mipLevelCount=1,r.msaaTexture=n.device.createTexture(S)}r.initialized=!0,r.textureDescriptorGPU=w}destroyTexture(e,t=!1){let n=this.backend,r=n.get(e);r.texture!==void 0&&t===!1&&e.isExternalTexture!==!0&&r.texture.destroy(),r.msaaTexture!==void 0&&r.msaaTexture.destroy(),n.delete(e)}generateMipmaps(e,t=null){let n=this.backend.get(e);this._generateMipmaps(n.texture,t)}getColorBuffer(){let e=this.backend,t=e.renderer.getCanvasTarget(),{width:n,height:r}=e.getDrawingBufferSize(),s=e.renderer.currentSamples,o=t.colorTexture,a=e.get(o);if(o.width===n&&o.height===r&&o.samples===s)return a.texture;let l=a.texture;return l&&l.destroy(),sm.label="colorBuffer",sm.size.width=n,sm.size.height=r,sm.sampleCount=e.utils.getSampleCount(e.renderer.currentSamples),sm.format=e.utils.getPreferredCanvasFormat(),sm.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,l=e.device.createTexture(sm),sm.reset(),o.source.width=n,o.source.height=r,o.samples=s,a.texture=l,l}getDepthBuffer(e=!0,t=!1){let n=this.backend,r=n.renderer.getCanvasTarget(),{width:s,height:o}=n.getDrawingBufferSize(),a=n.renderer.currentSamples,l=r.depthTexture;if(l.width===s&&l.height===o&&l.samples===a&&l.depth===e&&l.stencil===t)return n.get(l).texture;let c=n.get(l).texture,u,f;if(t?(u=xo,f=n.renderer.reversedDepthBuffer===!0?cr:ua):e&&(u=Vs,f=n.renderer.reversedDepthBuffer===!0?cr:xi),c!==void 0){if(l.image.width===s&&l.image.height===o&&l.format===u&&l.type===f&&l.samples===a)return c;this.destroyTexture(l)}return l.name="depthBuffer",l.format=u,l.type=f,l.image.width=s,l.image.height=o,l.samples=a,this.createTexture(l,{width:s,height:o}),n.get(l).texture}updateTexture(e,t){let n=this.backend.get(e),r=e.mipmaps,{textureDescriptorGPU:s}=n;if(!(e.isRenderTargetTexture||s===void 0)){if(e.isDataTexture)if(r.length>0)for(let o=0,a=r.length;o<a;o++){let l=r[o];this._copyBufferToTexture(l,n.texture,s,0,e.flipY,0,o)}else this._copyBufferToTexture(t.image,n.texture,s,0,e.flipY);else if(e.isArrayTexture||e.isDataArrayTexture||e.isData3DTexture)if(e.layerUpdates&&e.layerUpdates.size>0){for(let o of e.layerUpdates)this._copyBufferToTexture(t.image,n.texture,s,o,e.flipY,o);e.clearLayerUpdates()}else for(let o=0;o<t.image.depth;o++)this._copyBufferToTexture(t.image,n.texture,s,o,e.flipY,o);else if(e.isCompressedTexture||e.isCompressedArrayTexture)e.isCompressedArrayTexture&&e.layerUpdates.size>0?(this._copyCompressedBufferToTexture(e.mipmaps,n.texture,s,e.layerUpdates),e.clearLayerUpdates()):this._copyCompressedBufferToTexture(e.mipmaps,n.texture,s);else if(e.isCubeTexture)this._copyCubeMapToTexture(e,n.texture,s);else if(e.isHTMLTexture){let o=this.backend.device,a=this.backend.renderer.domElement,l=e.image;if(typeof o.queue.copyElementImageToTexture!="function")return;if(!n.hasPaintCallback){n.hasPaintCallback=!0,a.requestPaint();return}let c=s.size.width,u=s.size.height;o.queue.copyElementImageToTexture.length===2?o.queue.copyElementImageToTexture({source:l},{destination:{texture:n.texture},width:c,height:u}):o.queue.copyElementImageToTexture(l,c,u,{texture:n.texture}),e.flipY&&this._flipY(n.texture,s)}else if(r.length>0)for(let o=0,a=r.length;o<a;o++){let l=r[o];this._copyImageToTexture(l,n.texture,s,0,e.flipY,e.premultiplyAlpha,o)}else this._copyImageToTexture(t.image,n.texture,s,0,e.flipY,e.premultiplyAlpha);n.version=e.version}}async copyTextureToBuffer(e,t,n,r,s,o){let a=this.backend.device,l=this.backend.get(e),c=l.texture,u=l.textureDescriptorGPU.format,f=this._getBytesPerTexel(u),d=r*f;d=Math.ceil(d/256)*256,GR.size=(s-1)*d+r*f,GR.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let A=a.createBuffer(GR);GR.reset();let y=a.createCommandEncoder(IIe);_a.texture=c,_a.origin.x=t,_a.origin.y=n,_a.origin.z=o,qR.buffer=A,qR.bytesPerRow=d,ga.width=r,ga.height=s,y.copyTextureToBuffer(_a,qR,ga),_a.reset(),qR.reset(),ga.reset();let w=this._getTypedArrayType(u);mf(a,y.finish()),await A.mapAsync(GPUMapMode.READ);let S=A.getMappedRange().slice();return A.destroy(),new w(S)}dispose(){this._samplerCache.clear()}_getDefaultTextureGPU(e){let t=this.defaultTexture[e];if(t===void 0){let n=new qs;n.minFilter=Ti,n.magFilter=Ti,this.createTexture(n,{width:1,height:1,format:e}),this.defaultTexture[e]=t=n}return this.backend.get(t).texture}_getDefaultCubeTextureGPU(e){let t=this.defaultCubeTexture[e];if(t===void 0){let n=new Ph;n.minFilter=Ti,n.magFilter=Ti,this.createTexture(n,{width:1,height:1,depth:6}),this.defaultCubeTexture[e]=t=n}return this.backend.get(t).texture}_copyCubeMapToTexture(e,t,n){let r=e.images,s=e.mipmaps;for(let o=0;o<6;o++){let a=r[o],l=e.flipY===!0?DIe[o]:o;a.isDataTexture?this._copyBufferToTexture(a.image,t,n,l,e.flipY):this._copyImageToTexture(a,t,n,l,e.flipY,e.premultiplyAlpha);for(let c=0;c<s.length;c++){let f=s[c].images[o];f.isDataTexture?this._copyBufferToTexture(f.image,t,n,l,e.flipY,0,c+1):this._copyImageToTexture(f,t,n,l,e.flipY,e.premultiplyAlpha,c+1)}}}_copyImageToTexture(e,t,n,r,s,o,a=0){let l=this.backend.device,c=a>0?e.width:n.size.width,u=a>0?e.height:n.size.height;HR.source=e,HR.flipY=s,Z_.texture=t,Z_.mipLevel=a,Z_.origin.z=r,Z_.premultipliedAlpha=o,ga.width=c,ga.height=u;try{l.queue.copyExternalImageToTexture(HR,Z_,ga)}catch{}finally{HR.reset(),Z_.reset(),ga.reset()}}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new F9(this.backend.device)),e}_generateMipmaps(e,t=null){this._getPassUtils().generateMipmaps(e,t)}_flipY(e,t,n=0){this._getPassUtils().flipY(e,t,n)}_copyBufferToTexture(e,t,n,r,s,o=0,a=0){let l=this.backend.device,c=e.data,u=this._getBytesPerTexel(n.format),f=e.width*u;_a.texture=t,_a.mipLevel=a,_a.origin.z=r,$d.offset=e.width*e.height*u*o,$d.bytesPerRow=f,ga.width=e.width,ga.height=e.height,l.queue.writeTexture(_a,c,$d,ga),_a.reset(),$d.reset(),ga.reset(),s===!0&&this._flipY(t,n,r)}_copyCompressedBufferToTexture(e,t,n,r=null){let s=this.backend.device,o=this._getBlockData(n.format),a=n.size.depthOrArrayLayers>1,l=r&&r.size>0?r:null;for(let c=0;c<e.length;c++){let u=e[c],f=u.width,d=u.height,A=a?n.size.depthOrArrayLayers:1,y=Math.ceil(f/o.width)*o.byteLength,w=Math.ceil(d/o.height),S=y*w,T=Math.ceil(f/o.width)*o.width,R=w*o.height;if(l!==null)for(let I of l)Kte(s,t,c,I,u,S,y,w,T,R);else for(let I=0;I<A;I++)Kte(s,t,c,I,u,S,y,w,T,R)}}_getBlockData(e){if(e===fe.BC1RGBAUnorm||e===fe.BC1RGBAUnormSRGB)return{byteLength:8,width:4,height:4};if(e===fe.BC2RGBAUnorm||e===fe.BC2RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.BC3RGBAUnorm||e===fe.BC3RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.BC4RUnorm||e===fe.BC4RSnorm)return{byteLength:8,width:4,height:4};if(e===fe.BC5RGUnorm||e===fe.BC5RGSnorm)return{byteLength:16,width:4,height:4};if(e===fe.BC6HRGBUFloat||e===fe.BC6HRGBFloat)return{byteLength:16,width:4,height:4};if(e===fe.BC7RGBAUnorm||e===fe.BC7RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.ETC2RGB8Unorm||e===fe.ETC2RGB8UnormSRGB)return{byteLength:8,width:4,height:4};if(e===fe.ETC2RGB8A1Unorm||e===fe.ETC2RGB8A1UnormSRGB)return{byteLength:8,width:4,height:4};if(e===fe.ETC2RGBA8Unorm||e===fe.ETC2RGBA8UnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.EACR11Unorm)return{byteLength:8,width:4,height:4};if(e===fe.EACR11Snorm)return{byteLength:8,width:4,height:4};if(e===fe.EACRG11Unorm)return{byteLength:16,width:4,height:4};if(e===fe.EACRG11Snorm)return{byteLength:16,width:4,height:4};if(e===fe.ASTC4x4Unorm||e===fe.ASTC4x4UnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.ASTC5x4Unorm||e===fe.ASTC5x4UnormSRGB)return{byteLength:16,width:5,height:4};if(e===fe.ASTC5x5Unorm||e===fe.ASTC5x5UnormSRGB)return{byteLength:16,width:5,height:5};if(e===fe.ASTC6x5Unorm||e===fe.ASTC6x5UnormSRGB)return{byteLength:16,width:6,height:5};if(e===fe.ASTC6x6Unorm||e===fe.ASTC6x6UnormSRGB)return{byteLength:16,width:6,height:6};if(e===fe.ASTC8x5Unorm||e===fe.ASTC8x5UnormSRGB)return{byteLength:16,width:8,height:5};if(e===fe.ASTC8x6Unorm||e===fe.ASTC8x6UnormSRGB)return{byteLength:16,width:8,height:6};if(e===fe.ASTC8x8Unorm||e===fe.ASTC8x8UnormSRGB)return{byteLength:16,width:8,height:8};if(e===fe.ASTC10x5Unorm||e===fe.ASTC10x5UnormSRGB)return{byteLength:16,width:10,height:5};if(e===fe.ASTC10x6Unorm||e===fe.ASTC10x6UnormSRGB)return{byteLength:16,width:10,height:6};if(e===fe.ASTC10x8Unorm||e===fe.ASTC10x8UnormSRGB)return{byteLength:16,width:10,height:8};if(e===fe.ASTC10x10Unorm||e===fe.ASTC10x10UnormSRGB)return{byteLength:16,width:10,height:10};if(e===fe.ASTC12x10Unorm||e===fe.ASTC12x10UnormSRGB)return{byteLength:16,width:12,height:10};if(e===fe.ASTC12x12Unorm||e===fe.ASTC12x12UnormSRGB)return{byteLength:16,width:12,height:12}}_convertAddressMode(e){let t=fU.ClampToEdge;return e===Ed?t=fU.Repeat:e===Md&&(t=fU.MirrorRepeat),t}_convertFilterMode(e){let t=Kc.Linear;return(e===Ti||e===Pb||e===qc)&&(t=Kc.Nearest),t}_convertMipmapFilterMode(e){return e===qc||e===Go?Kc.Linear:Kc.Nearest}_getBytesPerTexel(e){if(e===fe.R8Unorm||e===fe.R8Snorm||e===fe.R8Uint||e===fe.R8Sint)return 1;if(e===fe.R16Uint||e===fe.R16Sint||e===fe.R16Float||e===fe.RG8Unorm||e===fe.RG8Snorm||e===fe.RG8Uint||e===fe.RG8Sint||e===fe.R16Unorm||e===fe.R16Snorm)return 2;if(e===fe.R32Uint||e===fe.R32Sint||e===fe.R32Float||e===fe.RG16Uint||e===fe.RG16Sint||e===fe.RG16Float||e===fe.RGBA8Unorm||e===fe.RGBA8UnormSRGB||e===fe.RGBA8Snorm||e===fe.RGBA8Uint||e===fe.RGBA8Sint||e===fe.BGRA8Unorm||e===fe.BGRA8UnormSRGB||e===fe.RG16Unorm||e===fe.RG16Snorm||e===fe.RGB9E5UFloat||e===fe.RGB10A2Unorm||e===fe.RG11B10UFloat||e===fe.Depth32Float||e===fe.Depth24Plus||e===fe.Depth24PlusStencil8||e===fe.Depth32FloatStencil8)return 4;if(e===fe.RG32Uint||e===fe.RG32Sint||e===fe.RG32Float||e===fe.RGBA16Uint||e===fe.RGBA16Sint||e===fe.RGBA16Float||e===fe.RGBA16Unorm||e===fe.RGBA16Snorm)return 8;if(e===fe.RGBA32Uint||e===fe.RGBA32Sint||e===fe.RGBA32Float)return 16}_getTypedArrayType(e){if(e===fe.R8Uint)return Uint8Array;if(e===fe.R8Sint)return Int8Array;if(e===fe.R8Unorm)return Uint8Array;if(e===fe.R8Snorm)return Int8Array;if(e===fe.RG8Uint)return Uint8Array;if(e===fe.RG8Sint)return Int8Array;if(e===fe.RG8Unorm)return Uint8Array;if(e===fe.RG8Snorm)return Int8Array;if(e===fe.RGBA8Uint)return Uint8Array;if(e===fe.RGBA8Sint)return Int8Array;if(e===fe.RGBA8Unorm||e===fe.RGBA8UnormSRGB)return Uint8Array;if(e===fe.RGBA8Snorm)return Int8Array;if(e===fe.R16Uint)return Uint16Array;if(e===fe.R16Sint)return Int16Array;if(e===fe.RG16Uint)return Uint16Array;if(e===fe.RG16Sint)return Int16Array;if(e===fe.RGBA16Uint)return Uint16Array;if(e===fe.RGBA16Sint)return Int16Array;if(e===fe.R16Float||e===fe.RG16Float||e===fe.RGBA16Float||e===fe.R16Unorm)return Uint16Array;if(e===fe.R16Snorm)return Int16Array;if(e===fe.RG16Unorm)return Uint16Array;if(e===fe.RG16Snorm)return Int16Array;if(e===fe.RGBA16Unorm)return Uint16Array;if(e===fe.RGBA16Snorm)return Int16Array;if(e===fe.R32Uint)return Uint32Array;if(e===fe.R32Sint)return Int32Array;if(e===fe.R32Float)return Float32Array;if(e===fe.RG32Uint)return Uint32Array;if(e===fe.RG32Sint)return Int32Array;if(e===fe.RG32Float)return Float32Array;if(e===fe.RGBA32Uint)return Uint32Array;if(e===fe.RGBA32Sint)return Int32Array;if(e===fe.RGBA32Float)return Float32Array;if(e===fe.BGRA8Unorm||e===fe.BGRA8UnormSRGB)return Uint8Array;if(e===fe.RGB10A2Unorm||e===fe.RGB9E5UFloat||e===fe.RG11B10UFloat)return Uint32Array;if(e===fe.Depth32Float)return Float32Array;if(e===fe.Depth24Plus||e===fe.Depth24PlusStencil8)return Uint32Array;if(e===fe.Depth32FloatStencil8)return Float32Array}_getDimension(e){let t;return e.is3DTexture||e.isData3DTexture?t=Yte.ThreeD:t=Yte.TwoD,t}};function G9(i,e){let t=i.format,n=i.type,r=i.normalized,s=i.colorSpace,o=ln.getTransfer(s),a,l=!1;if(r&&(l=e.features.has(oP.TextureFormatsTier1),l===!1&&Xe("WebGPURenderer: Unable to use normalized textures without texture-formats-tier1 feature.")),i.isCompressedTexture===!0||i.isCompressedArrayTexture===!0)switch(t){case Vh:case Gh:a=o===kt?fe.BC1RGBAUnormSRGB:fe.BC1RGBAUnorm;break;case qh:a=o===kt?fe.BC2RGBAUnormSRGB:fe.BC2RGBAUnorm;break;case Hh:a=o===kt?fe.BC3RGBAUnormSRGB:fe.BC3RGBAUnorm;break;case V0:a=fe.BC4RUnorm;break;case G0:a=fe.BC4RSnorm;break;case jh:a=fe.BC5RGUnorm;break;case q0:a=fe.BC5RGSnorm;break;case U0:a=o===kt?fe.BC7RGBAUnormSRGB:fe.BC7RGBAUnorm;break;case k0:a=fe.BC6HRGBFloat;break;case z0:a=fe.BC6HRGBUFloat;break;case _0:case v0:a=o===kt?fe.ETC2RGB8UnormSRGB:fe.ETC2RGB8Unorm;break;case x0:a=o===kt?fe.ETC2RGBA8UnormSRGB:fe.ETC2RGBA8Unorm;break;case y0:a=fe.EACR11Unorm;break;case b0:a=fe.EACR11Snorm;break;case Wh:a=fe.EACRG11Unorm;break;case w0:a=fe.EACRG11Snorm;break;case S0:a=o===kt?fe.ASTC4x4UnormSRGB:fe.ASTC4x4Unorm;break;case T0:a=o===kt?fe.ASTC5x4UnormSRGB:fe.ASTC5x4Unorm;break;case E0:a=o===kt?fe.ASTC5x5UnormSRGB:fe.ASTC5x5Unorm;break;case M0:a=o===kt?fe.ASTC6x5UnormSRGB:fe.ASTC6x5Unorm;break;case C0:a=o===kt?fe.ASTC6x6UnormSRGB:fe.ASTC6x6Unorm;break;case R0:a=o===kt?fe.ASTC8x5UnormSRGB:fe.ASTC8x5Unorm;break;case P0:a=o===kt?fe.ASTC8x6UnormSRGB:fe.ASTC8x6Unorm;break;case I0:a=o===kt?fe.ASTC8x8UnormSRGB:fe.ASTC8x8Unorm;break;case L0:a=o===kt?fe.ASTC10x5UnormSRGB:fe.ASTC10x5Unorm;break;case D0:a=o===kt?fe.ASTC10x6UnormSRGB:fe.ASTC10x6Unorm;break;case N0:a=o===kt?fe.ASTC10x8UnormSRGB:fe.ASTC10x8Unorm;break;case F0:a=o===kt?fe.ASTC10x10UnormSRGB:fe.ASTC10x10Unorm;break;case B0:a=o===kt?fe.ASTC12x10UnormSRGB:fe.ASTC12x10Unorm;break;case O0:a=o===kt?fe.ASTC12x12UnormSRGB:fe.ASTC12x12Unorm;break;case Or:a=o===kt?fe.RGBA8UnormSRGB:fe.RGBA8Unorm;break;default:ze("WebGPURenderer: Unsupported texture format.",t)}else switch(t){case Or:switch(n){case Oh:a=fe.RGBA8Snorm;break;case Uh:a=l?fe.RGBA16Snorm:fe.RGBA16Sint;break;case wl:a=l?fe.RGBA16Unorm:fe.RGBA16Uint;break;case xi:a=fe.RGBA32Uint;break;case Kr:a=fe.RGBA32Sint;break;case Ji:a=o===kt?fe.RGBA8UnormSRGB:fe.RGBA8Unorm;break;case Wi:a=fe.RGBA16Float;break;case cr:a=fe.RGBA32Float;break;default:ze("WebGPURenderer: Unsupported texture type with RGBAFormat.",n)}break;case Nd:switch(n){case rg:a=fe.RGB9E5UFloat;break;case sg:a=fe.RG11B10UFloat;break;default:ze("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case Fd:switch(n){case Oh:a=fe.R8Snorm;break;case Uh:a=l?fe.R16Snorm:fe.R16Sint;break;case wl:a=l?fe.R16Unorm:fe.R16Uint;break;case xi:a=fe.R32Uint;break;case Kr:a=fe.R32Sint;break;case Ji:a=fe.R8Unorm;break;case Wi:a=fe.R16Float;break;case cr:a=fe.R32Float;break;default:ze("WebGPURenderer: Unsupported texture type with RedFormat.",n)}break;case Ws:switch(n){case Oh:a=fe.RG8Snorm;break;case Uh:a=l?fe.RG16Snorm:fe.RG16Sint;break;case wl:a=l?fe.RG16Unorm:fe.RG16Uint;break;case xi:a=fe.RG32Uint;break;case Kr:a=fe.RG32Sint;break;case Ji:a=fe.RG8Unorm;break;case Wi:a=fe.RG16Float;break;case cr:a=fe.RG32Float;break;default:ze("WebGPURenderer: Unsupported texture type with RGFormat.",n)}break;case Vs:switch(n){case wl:a=fe.Depth16Unorm;break;case xi:a=fe.Depth24Plus;break;case cr:a=fe.Depth32Float;break;default:ze("WebGPURenderer: Unsupported texture type with DepthFormat.",n)}break;case xo:switch(n){case ua:a=fe.Depth24PlusStencil8;break;case cr:e&&e.features.has(oP.Depth32FloatStencil8)===!1&&ze('WebGPURenderer: Depth textures with DepthStencilFormat + FloatType can only be used with the "depth32float-stencil8" GPU feature.'),a=fe.Depth32FloatStencil8;break;default:ze("WebGPURenderer: Unsupported texture type with DepthStencilFormat.",n)}break;case kh:switch(n){case Kr:a=fe.R32Sint;break;case xi:a=fe.R32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case zh:switch(n){case Kr:a=fe.RG32Sint;break;case xi:a=fe.RG32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n)}break;case g0:switch(n){case Kr:a=fe.RGBA32Sint;break;case xi:a=fe.RGBA32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RGBAIntegerFormat.",n)}break;default:ze("WebGPURenderer: Unsupported texture format.",t)}return a}var NIe=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,FIe=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,Qte={f32:"float",i32:"int",u32:"uint",bool:"bool","vec2<f32>":"vec2","vec2<i32>":"ivec2","vec2<u32>":"uvec2","vec2<bool>":"bvec2",vec2f:"vec2",vec2i:"ivec2",vec2u:"uvec2",vec2b:"bvec2","vec3<f32>":"vec3","vec3<i32>":"ivec3","vec3<u32>":"uvec3","vec3<bool>":"bvec3",vec3f:"vec3",vec3i:"ivec3",vec3u:"uvec3",vec3b:"bvec3","vec4<f32>":"vec4","vec4<i32>":"ivec4","vec4<u32>":"uvec4","vec4<bool>":"bvec4",vec4f:"vec4",vec4i:"ivec4",vec4u:"uvec4",vec4b:"bvec4","mat2x2<f32>":"mat2",mat2x2f:"mat2","mat3x3<f32>":"mat3",mat3x3f:"mat3","mat4x4<f32>":"mat4",mat4x4f:"mat4",sampler:"sampler",texture_1d:"texture",texture_2d:"texture",texture_2d_array:"texture",texture_multisampled_2d:"cubeTexture",texture_depth_2d:"depthTexture",texture_depth_2d_array:"depthTexture",texture_depth_multisampled_2d:"depthTexture",texture_depth_cube:"depthTexture",texture_depth_cube_array:"depthTexture",texture_3d:"texture3D",texture_cube:"cubeTexture",texture_cube_array:"cubeTexture",texture_storage_1d:"storageTexture",texture_storage_2d:"storageTexture",texture_storage_2d_array:"storageTexture",texture_storage_3d:"storageTexture"},BIe=i=>{i=i.trim();let e=i.match(NIe);if(e!==null&&e.length===4){let t=e[2],n=[],r=null;for(;(r=FIe.exec(t))!==null;)n.push({name:r[1],type:r[2]});let s=[];for(let u=0;u<n.length;u++){let{name:f,type:d}=n[u],A=d;A.startsWith("ptr")?A="pointer":(A.startsWith("texture")&&(A=d.split("<")[0]),A=Qte[A]),s.push(new ES(A,f))}let o=i.substring(e[0].length),a=e[3]||"void",l=e[1]!==void 0?e[1]:"";return{type:Qte[a]||a,inputs:s,name:l,inputsCode:t,blockCode:o,outputType:a}}else throw new Error("THREE.WGSLNodeFunction: Function is not a WGSL code.")},q9=class extends CS{constructor(e){let{type:t,inputs:n,name:r,inputsCode:s,blockCode:o,outputType:a}=BIe(e);super(t,n,r),this.inputsCode=s,this.blockCode=o,this.outputType=a}getCode(e=this.name){let t=this.outputType!=="void"?"-> "+this.outputType:"";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}},H9=class extends j4{parseFunction(e){return new q9(e)}},OIe={[Yo.READ_ONLY]:"read",[Yo.WRITE_ONLY]:"write",[Yo.READ_WRITE]:"read_write"},Jte={[Ed]:"repeat",[la]:"clamp",[Md]:"mirror"},vU={vertex:yf.VERTEX,fragment:yf.FRAGMENT,compute:yf.COMPUTE},ene={instance:!0,swizzleAssign:!1,storageBuffer:!0},UIe={"^^":"tsl_xor"},kIe={float:"f32",int:"i32",uint:"u32",bool:"bool",color:"vec3<f32>",vec2:"vec2<f32>",ivec2:"vec2<i32>",uvec2:"vec2<u32>",bvec2:"vec2<bool>",vec3:"vec3<f32>",ivec3:"vec3<i32>",uvec3:"vec3<u32>",bvec3:"vec3<bool>",vec4:"vec4<f32>",ivec4:"vec4<i32>",uvec4:"vec4<u32>",bvec4:"vec4<bool>",mat2:"mat2x2<f32>",mat3:"mat3x3<f32>",mat4:"mat4x4<f32>"},tne={},Yw={tsl_xor:new hr("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new hr("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new hr("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new hr("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new hr("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new hr("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new hr("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new hr("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3<bool> { return vec3<bool>( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new hr("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4<bool> { return vec4<bool>( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new hr("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new hr("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new hr("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),inverse_mat2:new hr(`44454445 fn tsl_inverse_mat2( m : mat2x2<f32> ) -> mat2x2<f32> {44464446 44474447 let det = m[ 0 ][ 0 ] * m[ 1 ][ 1 ] - m[ 0 ][ 1 ] * m[ 1 ][ 0 ];
@@ -4559,17 +4559,17 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
45594559 return mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );45604560 45614561 }4562-`)},qPe={dFdx:"dpdx",dFdy:"- dpdy",mod_float:"tsl_mod_float",mod_vec2:"tsl_mod_vec2",mod_vec3:"tsl_mod_vec3",mod_vec4:"tsl_mod_vec4",equals_bool:"tsl_equals_bool",equals_bvec2:"tsl_equals_bvec2",equals_bvec3:"tsl_equals_bvec3",equals_bvec4:"tsl_equals_bvec4",inverse_mat2:"tsl_inverse_mat2",inverse_mat3:"tsl_inverse_mat3",inverse_mat4:"tsl_inverse_mat4",inversesqrt:"inverseSqrt",bitcast:"bitcast<f32>",floatpack_snorm_2x16:"pack2x16snorm",floatpack_unorm_2x16:"pack2x16unorm",floatpack_float16_2x16:"pack2x16float",floatunpack_snorm_2x16:"unpack2x16snorm",floatunpack_unorm_2x16:"unpack2x16unorm",floatunpack_float16_2x16:"unpack2x16float"},goe="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(goe+=`diagnostic( off, derivative_uniformity );4563-`);var W9=class extends Y4{constructor(e,t){super(e,t,new H9),this.uniformGroups={},this.uniformGroupsBindings={},this.builtins={},this.directives={},this.scopedArrays=new Map,this.allowEarlyReturns=!0,this.allowGlobalVariables=!0}_generateTextureSample(e,t,n,r,s,o=this.shaderStage){return o==="fragment"?r?s?`textureSample( ${t}, ${t}_sampler, ${n}, ${r}, ${s} )`:`textureSample( ${t}, ${t}_sampler, ${n}, ${r} )`:s?`textureSample( ${t}, ${t}_sampler, ${n}, ${s} )`:`textureSample( ${t}, ${t}_sampler, ${n} )`:this.generateTextureSampleLevel(e,t,n,"0",r)}generateTextureSampleLevel(e,t,n,r,s,o){return this.isUnfilterable(e)===!1?s?o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,o,r,s):this.generateTextureLod(e,t,n,s,o,r)}generateWrapFunction(e){let t=`tsl_coord_${ine[e.wrapS]}S_${ine[e.wrapT]}T_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}`,n=sne[t];if(n===void 0){let r=[],s=e.is3DTexture||e.isData3DTexture?"vec3f":"vec2f",o=`fn ${t}( coord : ${s} ) -> ${s} {4562+`)},zIe={dFdx:"dpdx",dFdy:"- dpdy",mod_float:"tsl_mod_float",mod_vec2:"tsl_mod_vec2",mod_vec3:"tsl_mod_vec3",mod_vec4:"tsl_mod_vec4",equals_bool:"tsl_equals_bool",equals_bvec2:"tsl_equals_bvec2",equals_bvec3:"tsl_equals_bvec3",equals_bvec4:"tsl_equals_bvec4",inverse_mat2:"tsl_inverse_mat2",inverse_mat3:"tsl_inverse_mat3",inverse_mat4:"tsl_inverse_mat4",inversesqrt:"inverseSqrt",bitcast:"bitcast<f32>",floatpack_snorm_2x16:"pack2x16snorm",floatpack_unorm_2x16:"pack2x16unorm",floatpack_float16_2x16:"pack2x16float",floatunpack_snorm_2x16:"unpack2x16snorm",floatunpack_unorm_2x16:"unpack2x16unorm",floatunpack_float16_2x16:"unpack2x16float"},doe="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(doe+=`diagnostic( off, derivative_uniformity );4563+`);var W9=class extends H4{constructor(e,t){super(e,t,new H9),this.uniformGroups={},this.uniformGroupsBindings={},this.builtins={},this.directives={},this.scopedArrays=new Map,this.allowEarlyReturns=!0,this.allowGlobalVariables=!0}_generateTextureSample(e,t,n,r,s,o=this.shaderStage){return o==="fragment"?r?s?`textureSample( ${t}, ${t}_sampler, ${n}, ${r}, ${s} )`:`textureSample( ${t}, ${t}_sampler, ${n}, ${r} )`:s?`textureSample( ${t}, ${t}_sampler, ${n}, ${s} )`:`textureSample( ${t}, ${t}_sampler, ${n} )`:this.generateTextureSampleLevel(e,t,n,"0",r)}generateTextureSampleLevel(e,t,n,r,s,o){return this.isUnfilterable(e)===!1?s?o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,o,r,s):this.generateTextureLod(e,t,n,s,o,r)}generateWrapFunction(e){let t=`tsl_coord_${Jte[e.wrapS]}S_${Jte[e.wrapT]}T_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}`,n=tne[t];if(n===void 0){let r=[],s=e.is3DTexture||e.isData3DTexture?"vec3f":"vec2f",o=`fn ${t}( coord : ${s} ) -> ${s} {45644564 45654565 return ${s}(4566-`,a=(l,c)=>{l===Rd?(r.push(Qw.repeatWrapping_float),o+=` tsl_repeatWrapping_float( coord.${c} )`):l===la?(r.push(Qw.clampWrapping_float),o+=` tsl_clampWrapping_float( coord.${c} )`):l===Id?(r.push(Qw.mirrorWrapping_float),o+=` tsl_mirrorWrapping_float( coord.${c} )`):(o+=` coord.${c}`,Xe(`WebGPURenderer: Unsupported texture wrap type "${l}" for vertex shader.`))};a(e.wrapS,"x"),o+=`,4566+`,a=(l,c)=>{l===Ed?(r.push(Yw.repeatWrapping_float),o+=` tsl_repeatWrapping_float( coord.${c} )`):l===la?(r.push(Yw.clampWrapping_float),o+=` tsl_clampWrapping_float( coord.${c} )`):l===Md?(r.push(Yw.mirrorWrapping_float),o+=` tsl_mirrorWrapping_float( coord.${c} )`):(o+=` coord.${c}`,Xe(`WebGPURenderer: Unsupported texture wrap type "${l}" for vertex shader.`))};a(e.wrapS,"x"),o+=`,45674567 `,a(e.wrapT,"y"),(e.is3DTexture||e.isData3DTexture)&&(o+=`,45684568 `,a(e.wrapR,"z")),o+=`45694569 );45704570 45714571 }4572-`,sne[t]=n=new hr(o,r)}return n.build(this),t}generateArrayDeclaration(e,t){return`array< ${this.getType(e)}, ${t} >`}generateTextureDimension(e,t,n){let r=this.getDataFromNode(e,this.shaderStage,this.cache);r.dimensionsSnippet===void 0&&(r.dimensionsSnippet={});let s=r.dimensionsSnippet[n];if(r.dimensionsSnippet[n]===void 0){let o,a,{primarySamples:l}=this.renderer.backend.utils.getTextureSampleData(e),c=l>1;e.is3DTexture||e.isData3DTexture?a="vec3<u32>":a="vec2<u32>",c||e.isStorageTexture?o=t:o=`${t}${n?`, u32( ${n} )`:""}`,s=new cx(new hx(`textureDimensions( ${o} )`,a)),r.dimensionsSnippet[n]=s,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(r.arrayLayerCount=new cx(new hx(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new cx(new hx("6u","u32")))}return s.build(this)}generateFilteredTexture(e,t,n,r,s="0u",o){let a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,s);return r&&(n=`${n} + vec2<f32>(${r}) / ${l}`),o?(this._include("biquadraticTextureArray"),`tsl_biquadraticTexture_array( ${t}, ${a}( ${n} ), ${l}, u32( ${o} ), u32( ${s} ) )`):(this._include("biquadraticTexture"),`tsl_biquadraticTexture( ${t}, ${a}( ${n} ), ${l}, u32( ${s} ) )`)}generateTextureLod(e,t,n,r,s,o="0u"){if(e.isCubeTexture===!0){s&&(n=`${n} + vec3<f32>(${s})`);let A=e.isDepthTexture?"u32":"f32";return`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${A}( ${o} ) )`}let a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,o),c=e.is3DTexture||e.isData3DTexture?"vec3":"vec2",u=c==="vec3"?"vec3<u32>( 1, 1, 1 )":"vec2<u32>( 1, 1 )";s&&(n=`${n} + ${c}<f32>(${s}) / ${c}<f32>( ${l} )`);let f=`${c}<f32>( 0 )`,d=`${c}<f32>( ${l} - ${u} )`;return n=`${c}<u32>( clamp( floor( ${a}( ${n} ) * ${c}<f32>( ${l} ) ), ${f}, ${d} ) )`,this.generateTextureLoad(e,t,n,o,r,null)}generateStorageTextureLoad(e,t,n,r,s,o){o&&(n=`${n} + ${o}`);let a;return s?a=`textureLoad( ${t}, ${n}, ${s} )`:a=`textureLoad( ${t}, ${n} )`,a}generateTextureLoad(e,t,n,r,s,o){r===null&&(r="0u"),o&&(n=`${n} + ${o}`);let a;return s?a=`textureLoad( ${t}, ${n}, ${s}, u32( ${r} ) )`:(a=`textureLoad( ${t}, ${n}, u32( ${r} ) )`,this.renderer.backend.compatibilityMode&&e.isDepthTexture&&(a+=".x")),a}generateTextureStore(e,t,n,r,s){let o;return r?o=`textureStore( ${t}, ${n}, ${r}, ${s} )`:o=`textureStore( ${t}, ${n}, ${s} )`,o}isSampleCompare(e){return e.isDepthTexture===!0&&e.compareFunction!==null&&this.renderer.hasCompatibility(kd.TEXTURE_COMPARE)}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.type===cr||this.isSampleCompare(e)===!1&&e.minFilter===Ti&&e.magFilter===Ti||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,n,r,s,o=this.shaderStage){let a=null;return this.isUnfilterable(e)?a=this.generateTextureLod(e,t,n,r,s,"0",o):a=this._generateTextureSample(e,t,n,r,s,o),a}generateTextureGrad(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return s?o?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${s}, ${r[0]}, ${r[1]}, ${o} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${s}, ${r[0]}, ${r[1]} )`:o?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${r[0]}, ${r[1]}, ${o} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${r[0]}, ${r[1]} )`;ze(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${a} shader.`)}generateTextureCompare(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return e.isDepthTexture===!0&&e.isArrayTexture===!0?o?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r} )`;ze(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureGather(e,t,n,r,s,o){let a=e.isDepthTexture===!0?"":`${r}, `;return s?o?`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${s}, ${o} )`:`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${s} )`:o?`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${o} )`:`textureGather( ${a}${t}, ${t}_sampler, ${n})`}generateTextureGatherCompare(e,t,n,r,s,o){return s?o?`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r})`:o?`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${r})`}generateTextureLevel(e,t,n,r,s,o){return this.isUnfilterable(e)===!1?s?o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,o,r,s):this.generateTextureLod(e,t,n,s,o,r)}generateTextureBias(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return s?o?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r} )`;ze(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${a} shader.`)}getPropertyName(e,t=this.shaderStage){if(e.isNodeVarying===!0&&e.needsInterpolation===!0){if(t==="vertex")return`varyings.${e.name}`}else if(e.isNodeUniform===!0){let n=e.name,r=e.type;return r==="texture"||r==="cubeTexture"||r==="cubeDepthTexture"||r==="storageTexture"||r==="texture3D"?n:r==="buffer"||r==="storageBuffer"||r==="indirectStorageBuffer"?this.isCustomStruct(e)?n:n+".value":e.groupNode.name+"."+n}return super.getPropertyName(e)}getOutputStructName(){return"output"}getFunctionOperator(e){let t=VPe[e];return t!==void 0?(this._include(t),t):null}getNodeAccess(e,t){return t!=="compute"?e.isAtomic===!0?(Xe("WebGPURenderer: Atomic operations are only supported in compute shaders."),Yo.READ_WRITE):Yo.READ_ONLY:e.access}getStorageAccess(e,t){return zPe[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,n,r=null){let s=super.getUniformFromNode(e,t,n,r),o=this.getDataFromNode(e,n,this.globalCache);if(o.uniformGPU===void 0){let a,l=e.groupNode,c=l.name,u=this.getBindGroupArray(c,n);if(t==="texture"||t==="cubeTexture"||t==="cubeDepthTexture"||t==="storageTexture"||t==="texture3D"){let f=null,d=this.getNodeAccess(e,n);if(t==="texture"||t==="storageTexture"?e.value.is3DTexture===!0?f=new LS(s.name,s.node,l,d):f=new xx(s.name,s.node,l,d):t==="cubeTexture"||t==="cubeDepthTexture"?f=new oI(s.name,s.node,l,d):t==="texture3D"&&(f=new LS(s.name,s.node,l,d)),f.store=e.isStorageTextureNode===!0,f.mipLevel=f.store?e.mipLevel:0,f.setVisibility(vU[n]),e.value.isCubeTexture===!0||this.isUnfilterable(e.value)===!1&&f.store===!1||e.gatherNode!==null){let y=new I9(`${s.name}_sampler`,s.node,l);y.setVisibility(vU[n]),u.push(y,f),a=[y,f]}else u.push(f),a=[f]}else if(t==="buffer"||t==="storageBuffer"||t==="indirectStorageBuffer"){let f=this.getSharedDataFromNode(e),d=f.buffer;if(d===void 0){let A=t==="buffer"?iI:L9;d=new A(e,l),f.buffer=d}d.setVisibility(d.getVisibility()|vU[n]),u.push(d),a=d,s.name=r||"NodeBuffer_"+s.id}else{let f=this.uniformGroups[c];f===void 0&&(f=new rI(c,l),f.setVisibility(Tf.VERTEX|Tf.FRAGMENT|Tf.COMPUTE),this.uniformGroups[c]=f),u.indexOf(f)===-1&&u.push(f),a=this.getNodeUniform(s,t);let d=a.name;f.uniforms.some(y=>y.name===d)||f.addUniform(a)}o.uniformGPU=a}return s}getBuiltin(e,t,n,r=this.shaderStage){let s=this.builtins[r]||(this.builtins[r]=new Map);return s.has(e)===!1&&s.set(e,{name:e,property:t,type:n}),t}hasBuiltin(e,t=this.shaderStage){return this.builtins[t]!==void 0&&this.builtins[t].has(e)}getVertexIndex(){return this.shaderStage==="vertex"?this.getBuiltin("vertex_index","vertexIndex","u32","attribute"):"vertexIndex"}buildFunctionCode(e){let t=e.layout,n=this.flowShaderNode(e),r=[];for(let o of t.inputs)r.push(o.name+" : "+this.getType(o.type));let s=`fn ${t.name}( ${r.join(", ")} ) -> ${this.getType(t.type)} {4572+`,tne[t]=n=new hr(o,r)}return n.build(this),t}generateArrayDeclaration(e,t){return`array< ${this.getType(e)}, ${t} >`}generateTextureDimension(e,t,n){let r=this.getDataFromNode(e,this.shaderStage,this.cache);r.dimensionsSnippet===void 0&&(r.dimensionsSnippet={});let s=r.dimensionsSnippet[n];if(r.dimensionsSnippet[n]===void 0){let o,a,{primarySamples:l}=this.renderer.backend.utils.getTextureSampleData(e),c=l>1;e.is3DTexture||e.isData3DTexture?a="vec3<u32>":a="vec2<u32>",c||e.isStorageTexture?o=t:o=`${t}${n?`, u32( ${n} )`:""}`,s=new ax(new cx(`textureDimensions( ${o} )`,a)),r.dimensionsSnippet[n]=s,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(r.arrayLayerCount=new ax(new cx(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new ax(new cx("6u","u32")))}return s.build(this)}generateFilteredTexture(e,t,n,r,s="0u",o){let a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,s);return r&&(n=`${n} + vec2<f32>(${r}) / ${l}`),o?(this._include("biquadraticTextureArray"),`tsl_biquadraticTexture_array( ${t}, ${a}( ${n} ), ${l}, u32( ${o} ), u32( ${s} ) )`):(this._include("biquadraticTexture"),`tsl_biquadraticTexture( ${t}, ${a}( ${n} ), ${l}, u32( ${s} ) )`)}generateTextureLod(e,t,n,r,s,o="0u"){if(e.isCubeTexture===!0){s&&(n=`${n} + vec3<f32>(${s})`);let A=e.isDepthTexture?"u32":"f32";return`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${A}( ${o} ) )`}let a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,o),c=e.is3DTexture||e.isData3DTexture?"vec3":"vec2",u=c==="vec3"?"vec3<u32>( 1, 1, 1 )":"vec2<u32>( 1, 1 )";s&&(n=`${n} + ${c}<f32>(${s}) / ${c}<f32>( ${l} )`);let f=`${c}<f32>( 0 )`,d=`${c}<f32>( ${l} - ${u} )`;return n=`${c}<u32>( clamp( floor( ${a}( ${n} ) * ${c}<f32>( ${l} ) ), ${f}, ${d} ) )`,this.generateTextureLoad(e,t,n,o,r,null)}generateStorageTextureLoad(e,t,n,r,s,o){o&&(n=`${n} + ${o}`);let a;return s?a=`textureLoad( ${t}, ${n}, ${s} )`:a=`textureLoad( ${t}, ${n} )`,a}generateTextureLoad(e,t,n,r,s,o){r===null&&(r="0u"),o&&(n=`${n} + ${o}`);let a;return s?a=`textureLoad( ${t}, ${n}, ${s}, u32( ${r} ) )`:(a=`textureLoad( ${t}, ${n}, u32( ${r} ) )`,this.renderer.backend.compatibilityMode&&e.isDepthTexture&&(a+=".x")),a}generateTextureStore(e,t,n,r,s){let o;return r?o=`textureStore( ${t}, ${n}, ${r}, ${s} )`:o=`textureStore( ${t}, ${n}, ${s} )`,o}isSampleCompare(e){return e.isDepthTexture===!0&&e.compareFunction!==null&&this.renderer.hasCompatibility(Bd.TEXTURE_COMPARE)}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.type===cr||this.isSampleCompare(e)===!1&&e.minFilter===Ti&&e.magFilter===Ti||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,n,r,s,o=this.shaderStage){let a=null;return this.isUnfilterable(e)?a=this.generateTextureLod(e,t,n,r,s,"0",o):a=this._generateTextureSample(e,t,n,r,s,o),a}generateTextureGrad(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return s?o?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${s}, ${r[0]}, ${r[1]}, ${o} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${s}, ${r[0]}, ${r[1]} )`:o?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${r[0]}, ${r[1]}, ${o} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${r[0]}, ${r[1]} )`;ze(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${a} shader.`)}generateTextureCompare(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return e.isDepthTexture===!0&&e.isArrayTexture===!0?o?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r} )`;ze(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureGather(e,t,n,r,s,o){let a=e.isDepthTexture===!0?"":`${r}, `;return s?o?`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${s}, ${o} )`:`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${s} )`:o?`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${o} )`:`textureGather( ${a}${t}, ${t}_sampler, ${n})`}generateTextureGatherCompare(e,t,n,r,s,o){return s?o?`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r})`:o?`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${r})`}generateTextureLevel(e,t,n,r,s,o){return this.isUnfilterable(e)===!1?s?o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,o,r,s):this.generateTextureLod(e,t,n,s,o,r)}generateTextureBias(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return s?o?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r} )`;ze(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${a} shader.`)}getPropertyName(e,t=this.shaderStage){if(e.isNodeVarying===!0&&e.needsInterpolation===!0){if(t==="vertex")return`varyings.${e.name}`}else if(e.isNodeUniform===!0){let n=e.name,r=e.type;return r==="texture"||r==="cubeTexture"||r==="cubeDepthTexture"||r==="storageTexture"||r==="texture3D"?n:r==="buffer"||r==="storageBuffer"||r==="indirectStorageBuffer"?this.isCustomStruct(e)?n:n+".value":e.groupNode.name+"."+n}return super.getPropertyName(e)}getOutputStructName(){return"output"}getFunctionOperator(e){let t=UIe[e];return t!==void 0?(this._include(t),t):null}getNodeAccess(e,t){return t!=="compute"?e.isAtomic===!0?(Xe("WebGPURenderer: Atomic operations are only supported in compute shaders."),Yo.READ_WRITE):Yo.READ_ONLY:e.access}getStorageAccess(e,t){return OIe[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,n,r=null){let s=super.getUniformFromNode(e,t,n,r),o=this.getDataFromNode(e,n,this.globalCache);if(o.uniformGPU===void 0){let a,l=e.groupNode,c=l.name,u=this.getBindGroupArray(c,n);if(t==="texture"||t==="cubeTexture"||t==="cubeDepthTexture"||t==="storageTexture"||t==="texture3D"){let f=null,d=this.getNodeAccess(e,n);if(t==="texture"||t==="storageTexture"?e.value.is3DTexture===!0?f=new RS(s.name,s.node,l,d):f=new vx(s.name,s.node,l,d):t==="cubeTexture"||t==="cubeDepthTexture"?f=new tP(s.name,s.node,l,d):t==="texture3D"&&(f=new RS(s.name,s.node,l,d)),f.store=e.isStorageTextureNode===!0,f.mipLevel=f.store?e.mipLevel:0,f.setVisibility(vU[n]),e.value.isCubeTexture===!0||this.isUnfilterable(e.value)===!1&&f.store===!1||e.gatherNode!==null){let y=new P9(`${s.name}_sampler`,s.node,l);y.setVisibility(vU[n]),u.push(y,f),a=[y,f]}else u.push(f),a=[f]}else if(t==="buffer"||t==="storageBuffer"||t==="indirectStorageBuffer"){let f=this.getSharedDataFromNode(e),d=f.buffer;if(d===void 0){let A=t==="buffer"?Q4:L9;d=new A(e,l),f.buffer=d}d.setVisibility(d.getVisibility()|vU[n]),u.push(d),a=d,s.name=r||"NodeBuffer_"+s.id}else{let f=this.uniformGroups[c];f===void 0&&(f=new J4(c,l),f.setVisibility(yf.VERTEX|yf.FRAGMENT|yf.COMPUTE),this.uniformGroups[c]=f),u.indexOf(f)===-1&&u.push(f),a=this.getNodeUniform(s,t);let d=a.name;f.uniforms.some(y=>y.name===d)||f.addUniform(a)}o.uniformGPU=a}return s}getBuiltin(e,t,n,r=this.shaderStage){let s=this.builtins[r]||(this.builtins[r]=new Map);return s.has(e)===!1&&s.set(e,{name:e,property:t,type:n}),t}hasBuiltin(e,t=this.shaderStage){return this.builtins[t]!==void 0&&this.builtins[t].has(e)}getVertexIndex(){return this.shaderStage==="vertex"?this.getBuiltin("vertex_index","vertexIndex","u32","attribute"):"vertexIndex"}buildFunctionCode(e){let t=e.layout,n=this.flowShaderNode(e),r=[];for(let o of t.inputs)r.push(o.name+" : "+this.getType(o.type));let s=`fn ${t.name}( ${r.join(", ")} ) -> ${this.getType(t.type)} {45734573 ${n.vars}45744574 ${n.code}45754575 `;return n.result&&(s+=` return ${n.result};
@@ -4591,7 +4591,7 @@ ${n.code}
45914591 ${r.join(`45924592 `)}45934593 `}getVaryings(e){let t=[];if(e==="vertex"&&this.getBuiltin("position","builtinClipSpace","vec4<f32>","vertex"),e==="vertex"||e==="fragment"){let s=this.varyings,o=this.vars[e],a=0;for(let l=0;l<s.length;l++){let c=s[l];if(c.needsInterpolation){let u=`@location( ${a++} )`;if(c.interpolationType){let f=c.interpolationSampling!==null?`, ${c.interpolationSampling} )`:" )";u+=` @interpolate( ${c.interpolationType}${f}`}else/^(int|uint|ivec|uvec)/.test(c.type)&&(u+=" @interpolate(flat, either)");t.push(`${u} ${c.name} : ${this.getType(c.type)}`)}else e==="vertex"&&o.includes(c)===!1&&o.push(c)}}let n=this.getBuiltins(e);n&&t.push(n);let r=t.join(`,4594- `);return e==="vertex"?this._getWGSLStruct("VaryingsStruct"," "+r):r}isCustomStruct(e){let t=e.value,n=e.node,r=(t.isBufferAttribute||t.isInstancedBufferAttribute)&&n.structTypeNode!==null,s=n.value&&n.value.array&&typeof n.value.itemSize=="number"&&n.value.array.length>n.value.itemSize;return r&&!s}getUniforms(e){let t=this.renderer.backend,n=this.uniforms[e],r=[],s=[],o=[],a={};for(let c of n){let u=c.groupNode.name,f=this.bindingsIndexes[u];if(c.type==="texture"||c.type==="cubeTexture"||c.type==="cubeDepthTexture"||c.type==="storageTexture"||c.type==="texture3D"){let d=c.node,A=d.value;(A.isCubeTexture===!0||this.isUnfilterable(A)===!1&&d.isStorageTextureNode!==!0||d.gatherNode!==null)&&(this.isSampleCompare(A)&&d.compareNode!==null?r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name}_sampler : sampler_comparison;`):r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name}_sampler : sampler;`));let w,S="",{primarySamples:T}=t.utils.getTextureSampleData(A);if(T>1&&(S="_multisampled"),A.isCubeTexture===!0&&A.isDepthTexture===!0)w="texture_depth_cube";else if(A.isCubeTexture===!0)w="texture_cube<f32>";else if(A.isDepthTexture===!0)t.compatibilityMode&&A.compareFunction===null?w=`texture${S}_2d<f32>`:w=`texture_depth${S}_2d${A.isArrayTexture===!0?"_array":""}`;else if(c.node.isStorageTextureNode===!0){let R=G9(A,t.device),P=this.getStorageAccess(c.node,e),I=c.node.value.is3DTexture,F=c.node.value.isArrayTexture;w=`texture_storage_${I?"3d":`2d${F?"_array":""}`}<${R}, ${P}>`}else if(A.isArrayTexture===!0||A.isDataArrayTexture===!0||A.isCompressedArrayTexture===!0)w="texture_2d_array<f32>";else if(A.is3DTexture===!0||A.isData3DTexture===!0)w="texture_3d<f32>";else{let R=this.getComponentTypeFromTexture(A).charAt(0);w=`texture${S}_2d<${R}32>`}r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name} : ${w};`)}else if(c.type==="buffer"||c.type==="storageBuffer"||c.type==="indirectStorageBuffer"){let d=c.node,A=this.getType(d.getNodeType(this)),y=d.bufferCount,w=y>0&&c.type==="buffer"?", "+y:"",S=d.isStorageBufferNode?`storage, ${this.getStorageAccess(d,e)}`:"uniform";if(this.isCustomStruct(c))s.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var<${S}> ${c.name} : ${A};`);else{let R=` value : array< ${d.isAtomic?`atomic<${A}>`:`${A}`}${w} >`;s.push(this._getWGSLStructBinding(c.name,R,S,f.binding++,f.group))}}else{let d=c.groupNode.name;if(a[d]===void 0){let A=this.uniformGroups[d];if(A!==void 0){let y=[];for(let S of A.uniforms){let T=S.getType(),R=this.getType(this.getVectorType(T));y.push(` ${S.name} : ${R}`)}let w=this.uniformGroupsBindings[d];w===void 0&&(w={index:f.binding++,id:f.group},this.uniformGroupsBindings[d]=w),a[d]={index:w.index,id:w.id,snippets:y}}}}}for(let c in a){let u=a[c];o.push(this._getWGSLStructBinding(c,u.snippets.join(`,4594+ `);return e==="vertex"?this._getWGSLStruct("VaryingsStruct"," "+r):r}isCustomStruct(e){let t=e.value,n=e.node,r=(t.isBufferAttribute||t.isInstancedBufferAttribute)&&n.structTypeNode!==null,s=n.value&&n.value.array&&typeof n.value.itemSize=="number"&&n.value.array.length>n.value.itemSize;return r&&!s}getUniforms(e){let t=this.renderer.backend,n=this.uniforms[e],r=[],s=[],o=[],a={};for(let c of n){let u=c.groupNode.name,f=this.bindingsIndexes[u];if(c.type==="texture"||c.type==="cubeTexture"||c.type==="cubeDepthTexture"||c.type==="storageTexture"||c.type==="texture3D"){let d=c.node,A=d.value;(A.isCubeTexture===!0||this.isUnfilterable(A)===!1&&d.isStorageTextureNode!==!0||d.gatherNode!==null)&&(this.isSampleCompare(A)&&d.compareNode!==null?r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name}_sampler : sampler_comparison;`):r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name}_sampler : sampler;`));let w,S="",{primarySamples:T}=t.utils.getTextureSampleData(A);if(T>1&&(S="_multisampled"),A.isCubeTexture===!0&&A.isDepthTexture===!0)w="texture_depth_cube";else if(A.isCubeTexture===!0)w="texture_cube<f32>";else if(A.isDepthTexture===!0)t.compatibilityMode&&A.compareFunction===null?w=`texture${S}_2d<f32>`:w=`texture_depth${S}_2d${A.isArrayTexture===!0?"_array":""}`;else if(c.node.isStorageTextureNode===!0){let R=G9(A,t.device),I=this.getStorageAccess(c.node,e),P=c.node.value.is3DTexture,F=c.node.value.isArrayTexture;w=`texture_storage_${P?"3d":`2d${F?"_array":""}`}<${R}, ${I}>`}else if(A.isArrayTexture===!0||A.isDataArrayTexture===!0||A.isCompressedArrayTexture===!0)w="texture_2d_array<f32>";else if(A.is3DTexture===!0||A.isData3DTexture===!0)w="texture_3d<f32>";else{let R=this.getComponentTypeFromTexture(A).charAt(0);w=`texture${S}_2d<${R}32>`}r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name} : ${w};`)}else if(c.type==="buffer"||c.type==="storageBuffer"||c.type==="indirectStorageBuffer"){let d=c.node,A=this.getType(d.getNodeType(this)),y=d.bufferCount,w=y>0&&c.type==="buffer"?", "+y:"",S=d.isStorageBufferNode?`storage, ${this.getStorageAccess(d,e)}`:"uniform";if(this.isCustomStruct(c))s.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var<${S}> ${c.name} : ${A};`);else{let R=` value : array< ${d.isAtomic?`atomic<${A}>`:`${A}`}${w} >`;s.push(this._getWGSLStructBinding(c.name,R,S,f.binding++,f.group))}}else{let d=c.groupNode.name;if(a[d]===void 0){let A=this.uniformGroups[d];if(A!==void 0){let y=[];for(let S of A.uniforms){let T=S.getType(),R=this.getType(this.getVectorType(T));y.push(` ${S.name} : ${R}`)}let w=this.uniformGroupsBindings[d];w===void 0&&(w={index:f.binding++,id:f.group},this.uniformGroupsBindings[d]=w),a[d]={index:w.index,id:w.id,snippets:y}}}}}for(let c in a){let u=a[c];o.push(this._getWGSLStructBinding(c,u.snippets.join(`,45954595 `),"uniform",u.index,u.id))}return[...r,...s,...o].join(`45964596 `)}buildCode(){let e=this.material!==null?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(let t in e){this.shaderStage=t;let n=this.allowGlobalVariables,r=e[t];r.uniforms=this.getUniforms(t),r.attributes=this.getAttributes(t),r.varyings=this.getVaryings(t),r.structs=this.getStructs(t),r.vars=this.getVars(t,n),r.codes=this.getCodes(t),r.directives=this.getDirectives(t),r.scopedArrays=this.getScopedArrays(t);let s=`// code45974597
@@ -4604,7 +4604,7 @@ ${n.code}
46044604 `+y),r.returnType="OutputStruct",r.structs+=this._getWGSLStruct("OutputStruct",A),r.structs+=`46054605 var<private> output : OutputStruct;`,s+=`output.color = ${this.format(f.result,a.getNodeType(this),this.getOutputType())};46064606 4607- return output;`}}}r.flow=s}if(this.shaderStage=null,this.material!==null)this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment);else{let t=this.object.workgroupSize;this.computeShader=this._getWGSLComputeCode(e.compute,t)}}getMethod(e,t=null){let n;return t!==null&&(n=this._getWGSLMethod(e+"_"+t)),n===void 0&&(n=this._getWGSLMethod(e)),n||e}getBitcastMethod(e){return`bitcast<${this.getType(e)}>`}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,n){return`select( ${n}, ${t}, ${e} )`}getType(e){return GPe[e]||e}isAvailable(e){let t=rne[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),rne[e]=t),t}_getWGSLMethod(e){return Qw[e]!==void 0&&this._include(e),qPe[e]}_include(e){let t=Qw[e];return t.build(this),this.addInclude(t),t}_getWGSLVertexCode(e){return`${this.getSignature()}4607+ return output;`}}}r.flow=s}if(this.shaderStage=null,this.material!==null)this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment);else{let t=this.object.workgroupSize;this.computeShader=this._getWGSLComputeCode(e.compute,t)}}getMethod(e,t=null){let n;return t!==null&&(n=this._getWGSLMethod(e+"_"+t)),n===void 0&&(n=this._getWGSLMethod(e)),n||e}getBitcastMethod(e){return`bitcast<${this.getType(e)}>`}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,n){return`select( ${n}, ${t}, ${e} )`}getType(e){return kIe[e]||e}isAvailable(e){let t=ene[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),ene[e]=t),t}_getWGSLMethod(e){return Yw[e]!==void 0&&this._include(e),zIe[e]}_include(e){let t=Yw[e];return t.build(this),this.addInclude(t),t}_getWGSLVertexCode(e){return`${this.getSignature()}46084608 // directives46094609 ${e.directives}46104610
@@ -4635,7 +4635,7 @@ fn main( ${e.attributes} ) -> VaryingsStruct {
46354635 }46364636 `}_getWGSLFragmentCode(e){return`${this.getSignature()}46374637 // global4638-${goe}4638+${doe}46394639 46404640 // structs46414641 ${e.structs}
@@ -4698,10 +4698,10 @@ struct ${e} {
46984698 ${t}46994699 };`}_getWGSLStructBinding(e,t,n,r=0,s=0){let o=e+"Struct";return`${this._getWGSLStruct(o,t)}47004700 @binding( ${r} ) @group( ${s} )4701-var<${n}> ${e} : ${o};`}},Aa=new ym,_U=new a1,voe=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]);typeof Float16Array<"u"&&voe.set(Float16Array,["float16"]);var HPe=new Map([[e_,["float16"]]]),WPe=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]),j9=class{constructor(e){this.backend=e}createAttribute(e,t){let n=this._getBufferAttribute(e),r=this.backend,s=r.get(n),o=s.buffer;if(o===void 0){let a=r.device,l=n.array;if(e.normalized===!1){if(l.constructor===Int16Array||l.constructor===Int8Array)l=new Int32Array(l);else if((l.constructor===Uint16Array||l.constructor===Uint8Array)&&(l=new Uint32Array(l),t&GPUBufferUsage.INDEX))for(let d=0;d<l.length;d++)l[d]===65535&&(l[d]=4294967295)}n.array=l;let c;if((n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&n.itemSize===3)c=4;else if(n.itemSize>1&&n.itemSize*l.BYTES_PER_ELEMENT%4!==0){let d=n.itemSize*l.BYTES_PER_ELEMENT;c=Math.floor((d+3)/4)*4/l.BYTES_PER_ELEMENT}if(c!==void 0){let d=n.itemSize,A=new l.constructor(n.count*c);for(let y=0;y<n.count;y++)A.set(l.subarray(y*d,y*d+d),y*c);(n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&(n.itemSize=c,n.array=A),l=A,s._itemSize=d,s._paddedItemSize=c}let u=l.byteLength,f=u+(4-u%4)%4;Aa.label=n.name,Aa.size=f,Aa.usage=t,Aa.mappedAtCreation=!0,o=a.createBuffer(Aa),Aa.reset(),new l.constructor(o.getMappedRange()).set(l),o.unmap(),s.buffer=o}}updateAttribute(e){let t=this._getBufferAttribute(e),n=this.backend,r=n.device,s=n.get(t),o=n.get(t).buffer,a=t.array,l=s._itemSize,c=s._paddedItemSize;if(c!==void 0){a=new a.constructor(t.count*c);for(let f=0;f<t.count;f++)a.set(t.array.subarray(f*l,f*l+l),f*c);(t.isStorageBufferAttribute||t.isStorageInstancedBufferAttribute)&&(t.array=a)}let u=t.updateRanges;if(u.length===0)r.queue.writeBuffer(o,0,a,0);else{let f=p_(a),d=f?1:a.BYTES_PER_ELEMENT;for(let A=0,y=u.length;A<y;A++){let w=u[A],S,T;if(c!==void 0){let P=Math.floor(w.start/l),I=Math.ceil((w.start+w.count)/l)-P;S=P*c*d,T=I*c*d}else S=w.start*d,T=w.count*d;let R=S*(f?a.BYTES_PER_ELEMENT:1);r.queue.writeBuffer(o,R,a,S,T)}t.clearUpdateRanges()}}createShaderVertexBuffers(e){let t=e.getAttributes(),n=new Map;for(let r=0;r<t.length;r++){let s=t[r],o=s.array.BYTES_PER_ELEMENT,a=this._getBufferAttribute(s),l=n.get(a);if(l===void 0){let f,d;s.isInterleavedBufferAttribute===!0?(f=s.data.stride*o,d=s.data.isInstancedInterleavedBuffer?HR.Instance:HR.Vertex):(f=s.itemSize*o,d=s.isInstancedBufferAttribute?HR.Instance:HR.Vertex,s.itemSize>1&&f%4!==0&&(f=Math.floor((f+3)/4)*4)),s.normalized===!1&&(s.array.constructor===Int16Array||s.array.constructor===Uint16Array)&&(f=4),l={arrayStride:f,attributes:[],stepMode:d},n.set(a,l)}let c=this._getVertexFormat(s),u=s.isInterleavedBufferAttribute===!0?s.offset*o:0;l.attributes.push({shaderLocation:r,offset:u,format:c})}return Array.from(n.values())}destroyAttribute(e){let t=this.backend;t.get(this._getBufferAttribute(e)).buffer.destroy(),t.delete(e)}async getArrayBufferAsync(e,t=null,n=0,r=-1){let s=this.backend,o=s.device,l=s.get(this._getBufferAttribute(e)).buffer,c=r===-1?l.size-n:r,u;if(t!==null&&t.isReadbackBuffer){let A=s.get(t);if(t._mapped===!0)throw new Error("THREE.WebGPUAttributeUtils: ReadbackBuffer must be released before being used again.");if(t._mapped=!0,A.readBufferGPU===void 0){Aa.label=`${t.name}_readback`,Aa.size=t.maxByteLength,Aa.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(Aa),Aa.reset();let y=()=>{t.buffer=null,t._mapped=!1,u.unmap()},w=()=>{t.buffer=null,t._mapped=!1,u.destroy(),s.delete(t),t.removeEventListener("release",y),t.removeEventListener("dispose",w)};t.addEventListener("release",y),t.addEventListener("dispose",w),A.readBufferGPU=u}else u=A.readBufferGPU}else Aa.label=`${e.name}_readback`,Aa.size=c,Aa.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(Aa),Aa.reset();_U.label=`readback_encoder_${e.name}`;let f=o.createCommandEncoder(_U);_U.reset(),f.copyBufferToBuffer(l,n,u,0,c);let d=f.finish();if(_f(o,d),await u.mapAsync(GPUMapMode.READ,0,c),t===null){let y=u.getMappedRange(0,c).slice();return u.destroy(),y}else{if(t.isReadbackBuffer)return t.buffer=u.getMappedRange(0,c),t;{let A=u.getMappedRange(0,c);return new Uint8Array(t).set(new Uint8Array(A)),u.destroy(),t}}}_getVertexFormat(e){let{itemSize:t,normalized:n}=e,r=e.array.constructor,s=e.constructor,o;if(t===1)o=WPe.get(r);else{let l=(HPe.get(s)||voe.get(r))[n?1:0];if(l){let c=r.BYTES_PER_ELEMENT*t,f=Math.floor((c+3)/4)*4/r.BYTES_PER_ELEMENT;if(f%1)throw new Error("THREE.WebGPUAttributeUtils: Bad vertex format item size.");o=`${l}x${f}`}}return o||ze("WebGPUAttributeUtils: Vertex format not supported yet."),o}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}},lc=new fI,Jw=new ym,J_=new NS,X9=class{constructor(e){this.layoutGPU=e,this.usedTimes=0}},$9=class{constructor(e){this.backend=e,this._bindGroupLayoutCache=new Map}createBindingsLayout(e){let t=this.backend,n=t.device,r=t.get(e);if(r.layout)return r.layout.layoutGPU;let s=this._createLayoutEntries(e),o=wx(JSON.stringify(s)),a=this._bindGroupLayoutCache.get(o);return a===void 0&&(a=new X9(n.createBindGroupLayout({entries:s})),this._bindGroupLayoutCache.set(o,a)),a.usedTimes++,r.layout=a,r.layoutKey=o,a.layoutGPU}createBindings(e,t,n,r=0){let{backend:s}=this,o=s.get(e),a=this.createBindingsLayout(e),l;n>0&&(o.groups===void 0&&(o.groups=[],o.versions=[]),o.versions[n]===r&&(l=o.groups[n])),l===void 0&&(l=this.createBindGroup(e,a),n>0&&(o.groups[n]=l,o.versions[n]=r)),o.group=l}updateBinding(e){let t=this.backend,n=t.device,r=e.buffer,s=t.get(e).buffer,o=e.updateRanges;if(o.length===0)n.queue.writeBuffer(s,0,r,0);else{let a=p_(r),l=a?1:r.BYTES_PER_ELEMENT,c=o[0].start;for(let u=0,f=o.length;u<f;u++){let d=o[u],A=o[u+1],y=d.start+d.count;if(A!==void 0&&A.start===y)continue;let w=c*l,S=(y-c)*l,T=w*(a?r.BYTES_PER_ELEMENT:1);n.queue.writeBuffer(s,T,r,w,S),A!==void 0&&(c=A.start)}}}createBindGroupIndex(e,t){let r=this.backend.device,s=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,o=e[0];Jw.label="bindingCameraIndex_"+o,Jw.size=16,Jw.usage=s;let a=r.createBuffer(Jw);Jw.reset(),r.queue.writeBuffer(a,0,e,0),lc.label="bindGroupCameraIndex_"+o,lc.layout=t,lc.entries.push({binding:0,resource:{buffer:a}});let l=r.createBindGroup(lc);return lc.reset(),l}createBindGroup(e,t){let n=this.backend,r=n.device,s=0;lc.label="bindGroup_"+e.name,lc.layout=t;for(let a of e.bindings){if(a.isUniformBuffer){let l=n.get(a);lc.entries.push({binding:s,resource:{buffer:l.buffer}})}else if(a.isStorageBuffer){let l=n.get(a.attribute).buffer;lc.entries.push({binding:s,resource:{buffer:l}})}else if(a.isSampledTexture){let l=n.get(a.texture),c;if(l.externalTexture!==void 0)c=r.importExternalTexture({source:l.externalTexture});else{let u=a.store?1:l.texture.mipLevelCount,f=a.store?a.mipLevel:0,d=`view-${l.texture.width}-${l.texture.height}`;if(l.texture.depthOrArrayLayers>1&&(d+=`-${l.texture.depthOrArrayLayers}`),d+=`-${u}-${f}`,c=l[d],c===void 0){let A=LPe.All,y;a.isSampledCubeTexture?y=Xo.Cube:a.texture.isArrayTexture||a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?y=Xo.TwoDArray:a.isSampledTexture3D?y=Xo.ThreeD:y=Xo.TwoD,J_.aspect=A,J_.dimension=y,J_.mipLevelCount=u,J_.baseMipLevel=f,c=l[d]=l.texture.createView(J_),J_.reset()}}lc.entries.push({binding:s,resource:c})}else if(a.isSampler){let l=n.get(a);lc.entries.push({binding:s,resource:l.sampler})}s++}let o=r.createBindGroup(lc);return lc.reset(),o}_createLayoutEntries(e){let t=[],n=0;for(let r of e.bindings){let s=this.backend,o={binding:n,visibility:r.visibility};if(r.isUniformBuffer||r.isStorageBuffer){let a={};r.isStorageBuffer&&(r.visibility&Tf.COMPUTE&&(r.access===Yo.READ_WRITE||r.access===Yo.WRITE_ONLY)?a.type=dU.Storage:a.type=dU.ReadOnlyStorage),o.buffer=a}else if(r.isSampledTexture&&r.store){let a={};a.format=this.backend.get(r.texture).texture.format;let l=r.access;l===Yo.READ_WRITE?a.access=pU.ReadWrite:l===Yo.WRITE_ONLY?a.access=pU.WriteOnly:a.access=pU.ReadOnly,r.texture.isArrayTexture?a.viewDimension=Xo.TwoDArray:r.texture.is3DTexture&&(a.viewDimension=Xo.ThreeD),o.storageTexture=a}else if(r.isSampledTexture){let a={},{primarySamples:l}=s.utils.getTextureSampleData(r.texture);if(l>1&&(a.multisampled=!0,r.texture.isDepthTexture||(a.sampleType=Ug.UnfilterableFloat)),r.texture.isDepthTexture)s.compatibilityMode&&r.texture.compareFunction===null?a.sampleType=Ug.UnfilterableFloat:a.sampleType=Ug.Depth;else{let c=r.texture.type;c===Kr?a.sampleType=Ug.SInt:c===xi?a.sampleType=Ug.UInt:c===cr&&(this.backend.hasFeature("float32-filterable")?a.sampleType=Ug.Float:a.sampleType=Ug.UnfilterableFloat)}r.isSampledCubeTexture?a.viewDimension=Xo.Cube:r.texture.isArrayTexture||r.texture.isDataArrayTexture||r.texture.isCompressedArrayTexture?a.viewDimension=Xo.TwoDArray:r.isSampledTexture3D&&(a.viewDimension=Xo.ThreeD),o.texture=a}else if(r.isSampler){let a={};r.texture.isDepthTexture&&(r.texture.compareFunction!==null&&r.textureNode.compareNode!==null&&s.hasCompatibility(kd.TEXTURE_COMPARE)?a.type=Qte.Comparison:a.type=Qte.NonFiltering),o.sampler=a}else ze(`WebGPUBindingUtils: Unsupported binding "${r}".`);t.push(o),n++}return t}deleteBindGroupData(e){let{backend:t}=this,n=t.get(e);n.layout&&(n.layout.usedTimes--,n.layout.usedTimes===0&&this._bindGroupLayoutCache.delete(n.layoutKey),n.layout=void 0,n.layoutKey=void 0)}dispose(){this._bindGroupLayoutCache.clear()}},Y9=class{constructor(e){this.backend=e}getMaxAnisotropy(){return 16}getUniformBufferLimit(){return this.backend.device.limits.maxUniformBufferBindingSize}},Z9=class{constructor(){this.label="",this.layout=null,this.compute=null}reset(){this.label="",this.layout=null,this.compute=null}},K9=class{constructor(){this.label="",this.bindGroupLayouts=null}reset(){this.label="",this.bindGroupLayouts=null}},eS=new Z9,ex=new K9,tx=new dI,cc=new pI,Q9=class{constructor(e){this.backend=e}_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){let{object:n,material:r,geometry:s,pipeline:o}=e,{vertexProgram:a,fragmentProgram:l}=o,c=this.backend,u=c.device,f=c.utils,d=c.get(o),A=[];for(let H of e.getBindings()){let $=c.get(H),{layoutGPU:J}=$.layout;A.push(J)}let y=c.attributeUtils.createShaderVertexBuffers(e),w;r.blending!==ms&&(r.blending!==Ms||r.transparent!==!1)&&(w=this._getBlending(r));let S={};r.stencilWrite===!0&&(S={compare:this._getStencilCompare(r),failOp:this._getStencilOperation(r.stencilFail),depthFailOp:this._getStencilOperation(r.stencilZFail),passOp:this._getStencilOperation(r.stencilZPass)});let T=this._getColorWriteMask(r),R=[];if(e.context.textures!==null){let H=e.context.textures,$=e.context.mrt;for(let J=0;J<H.length;J++){let te=H[J],ce=f.getTextureFormatGPU(te),he;if($!==null)if(this.backend.compatibilityMode!==!0){let ve=$.getBlendMode(te.name);ve.blending===mb?he=w:ve.blending!==ms&&(he=this._getBlending(ve))}else ni("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets."),he=w;else he=w;R.push({format:ce,blend:he,writeMask:T})}}else{let H=f.getCurrentColorFormat(e.context);R.push({format:H,blend:w,writeMask:T})}let P=c.get(a).module,I=c.get(l).module,F=this._getPrimitiveState(n,s,r),D=this._getDepthCompare(r),L=f.getCurrentDepthStencilFormat(e.context),C=this._getSampleCount(e.context);ex.bindGroupLayouts=A;let B=u.createPipelineLayout(ex);ex.reset(),cc.label=`renderPipeline_${r.name||r.type}_${r.id}`,cc.vertex=Object.assign({},P,{buffers:y}),cc.fragment=Object.assign({},I,{targets:R}),cc.primitive=F,cc.multisample.count=C,cc.multisample.alphaToCoverageEnabled=r.alphaToCoverage&&C>1,cc.layout=B;let k={},z=e.context.depth,G=e.context.stencil;(z===!0||G===!0)&&(z===!0&&(k.format=L,k.depthWriteEnabled=r.depthWrite,k.depthCompare=D),G===!0&&(k.stencilFront=S,k.stencilBack=S,k.stencilReadMask=r.stencilFuncMask,k.stencilWriteMask=r.stencilWriteMask),r.polygonOffset===!0&&F.topology===rS.TriangleList&&(k.depthBias=r.polygonOffsetUnits,k.depthBiasSlopeScale=r.polygonOffsetFactor,k.depthBiasClamp=0),cc.depthStencil=k),u.pushErrorScope("validation");let W=[{program:a,module:P.module},{program:l,module:I.module}],Y=cc.label;if(t===null)d.pipeline=u.createRenderPipeline(cc),cc.reset(),u.popErrorScope().then(H=>{H!==null&&(d.error=!0,ze(`WebGPURenderer: Render pipeline creation failed (${Y}): ${H.message}`),this._reportShaderDiagnostics(W,Y))});else{let H=new Promise(async $=>{try{let J=null,te=null;try{te=u.createRenderPipelineAsync(cc)}catch(he){J=he}if(cc.reset(),te!==null)try{d.pipeline=await te}catch(he){J=he}let ce=await u.popErrorScope();if(ce!==null||J!==null){d.error=!0;let he=ce&&ce.message||J&&J.message||"unknown";ze(`WebGPURenderer: Async render pipeline creation failed (${Y}): ${he}`),await this._reportShaderDiagnostics(W,Y)}}finally{$()}});t.push(H)}}createBundleEncoder(e,t="renderBundleEncoder"){let n=this.backend,{utils:r,device:s}=n,o=r.getCurrentDepthStencilFormat(e),a=r.getCurrentColorFormats(e),l=this._getSampleCount(e);tx.label=t,tx.colorFormats=a,tx.depthStencilFormat=o,tx.sampleCount=l;let c=s.createRenderBundleEncoder(tx);return tx.reset(),c}createComputePipeline(e,t){let n=this.backend,r=n.device,s=n.get(e.computeProgram).module,o=n.get(e),a=[];for(let f of t){let d=n.get(f),{layoutGPU:A}=d.layout;a.push(A)}let l=e.computeProgram,c=`computePipeline_${l.stage}${l.name?`_${l.name}`:""}`;r.pushErrorScope("validation"),ex.bindGroupLayouts=a;let u=r.createPipelineLayout(ex);ex.reset(),eS.label=c,eS.compute=s,eS.layout=u,o.pipeline=r.createComputePipeline(eS),eS.reset(),r.popErrorScope().then(f=>{f!==null&&(o.error=!0,ze(`WebGPURenderer: Compute pipeline creation failed (${c}): ${f.message}`),this._reportShaderDiagnostics([{program:l,module:s.module}],c))})}async _reportShaderDiagnostics(e,t){for(let{program:n,module:r}of e){let s=await r.getCompilationInfo();if(s.messages.length===0)continue;let o=n.code.split(`4701+var<${n}> ${e} : ${o};`}},Aa=new xm,_U=new o1,poe=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]);typeof Float16Array<"u"&&poe.set(Float16Array,["float16"]);var VIe=new Map([[Qv,["float16"]]]),GIe=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]),j9=class{constructor(e){this.backend=e}createAttribute(e,t){let n=this._getBufferAttribute(e),r=this.backend,s=r.get(n),o=s.buffer;if(o===void 0){let a=r.device,l=n.array;if(e.normalized===!1){if(l.constructor===Int16Array||l.constructor===Int8Array)l=new Int32Array(l);else if((l.constructor===Uint16Array||l.constructor===Uint8Array)&&(l=new Uint32Array(l),t&GPUBufferUsage.INDEX))for(let d=0;d<l.length;d++)l[d]===65535&&(l[d]=4294967295)}n.array=l;let c;if((n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&n.itemSize===3)c=4;else if(n.itemSize>1&&n.itemSize*l.BYTES_PER_ELEMENT%4!==0){let d=n.itemSize*l.BYTES_PER_ELEMENT;c=Math.floor((d+3)/4)*4/l.BYTES_PER_ELEMENT}if(c!==void 0){let d=n.itemSize,A=new l.constructor(n.count*c);for(let y=0;y<n.count;y++)A.set(l.subarray(y*d,y*d+d),y*c);(n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&(n.itemSize=c,n.array=A),l=A,s._itemSize=d,s._paddedItemSize=c}let u=l.byteLength,f=u+(4-u%4)%4;Aa.label=n.name,Aa.size=f,Aa.usage=t,Aa.mappedAtCreation=!0,o=a.createBuffer(Aa),Aa.reset(),new l.constructor(o.getMappedRange()).set(l),o.unmap(),s.buffer=o}}updateAttribute(e){let t=this._getBufferAttribute(e),n=this.backend,r=n.device,s=n.get(t),o=n.get(t).buffer,a=t.array,l=s._itemSize,c=s._paddedItemSize;if(c!==void 0){a=new a.constructor(t.count*c);for(let f=0;f<t.count;f++)a.set(t.array.subarray(f*l,f*l+l),f*c);(t.isStorageBufferAttribute||t.isStorageInstancedBufferAttribute)&&(t.array=a)}let u=t.updateRanges;if(u.length===0)r.queue.writeBuffer(o,0,a,0);else{let f=f_(a),d=f?1:a.BYTES_PER_ELEMENT;for(let A=0,y=u.length;A<y;A++){let w=u[A],S,T;if(c!==void 0){let I=Math.floor(w.start/l),P=Math.ceil((w.start+w.count)/l)-I;S=I*c*d,T=P*c*d}else S=w.start*d,T=w.count*d;let R=S*(f?a.BYTES_PER_ELEMENT:1);r.queue.writeBuffer(o,R,a,S,T)}t.clearUpdateRanges()}}createShaderVertexBuffers(e){let t=e.getAttributes(),n=new Map;for(let r=0;r<t.length;r++){let s=t[r],o=s.array.BYTES_PER_ELEMENT,a=this._getBufferAttribute(s),l=n.get(a);if(l===void 0){let f,d;s.isInterleavedBufferAttribute===!0?(f=s.data.stride*o,d=s.data.isInstancedInterleavedBuffer?kR.Instance:kR.Vertex):(f=s.itemSize*o,d=s.isInstancedBufferAttribute?kR.Instance:kR.Vertex,s.itemSize>1&&f%4!==0&&(f=Math.floor((f+3)/4)*4)),s.normalized===!1&&(s.array.constructor===Int16Array||s.array.constructor===Uint16Array)&&(f=4),l={arrayStride:f,attributes:[],stepMode:d},n.set(a,l)}let c=this._getVertexFormat(s),u=s.isInterleavedBufferAttribute===!0?s.offset*o:0;l.attributes.push({shaderLocation:r,offset:u,format:c})}return Array.from(n.values())}destroyAttribute(e){let t=this.backend;t.get(this._getBufferAttribute(e)).buffer.destroy(),t.delete(e)}async getArrayBufferAsync(e,t=null,n=0,r=-1){let s=this.backend,o=s.device,l=s.get(this._getBufferAttribute(e)).buffer,c=r===-1?l.size-n:r,u;if(t!==null&&t.isReadbackBuffer){let A=s.get(t);if(t._mapped===!0)throw new Error("THREE.WebGPUAttributeUtils: ReadbackBuffer must be released before being used again.");if(t._mapped=!0,A.readBufferGPU===void 0){Aa.label=`${t.name}_readback`,Aa.size=t.maxByteLength,Aa.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(Aa),Aa.reset();let y=()=>{t.buffer=null,t._mapped=!1,u.unmap()},w=()=>{t.buffer=null,t._mapped=!1,u.destroy(),s.delete(t),t.removeEventListener("release",y),t.removeEventListener("dispose",w)};t.addEventListener("release",y),t.addEventListener("dispose",w),A.readBufferGPU=u}else u=A.readBufferGPU}else Aa.label=`${e.name}_readback`,Aa.size=c,Aa.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(Aa),Aa.reset();_U.label=`readback_encoder_${e.name}`;let f=o.createCommandEncoder(_U);_U.reset(),f.copyBufferToBuffer(l,n,u,0,c);let d=f.finish();if(mf(o,d),await u.mapAsync(GPUMapMode.READ,0,c),t===null){let y=u.getMappedRange(0,c).slice();return u.destroy(),y}else{if(t.isReadbackBuffer)return t.buffer=u.getMappedRange(0,c),t;{let A=u.getMappedRange(0,c);return new Uint8Array(t).set(new Uint8Array(A)),u.destroy(),t}}}_getVertexFormat(e){let{itemSize:t,normalized:n}=e,r=e.array.constructor,s=e.constructor,o;if(t===1)o=GIe.get(r);else{let l=(VIe.get(s)||poe.get(r))[n?1:0];if(l){let c=r.BYTES_PER_ELEMENT*t,f=Math.floor((c+3)/4)*4/r.BYTES_PER_ELEMENT;if(f%1)throw new Error("THREE.WebGPUAttributeUtils: Bad vertex format item size.");o=`${l}x${f}`}}return o||ze("WebGPUAttributeUtils: Vertex format not supported yet."),o}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}},oc=new aP,Zw=new xm,K_=new IS,X9=class{constructor(e){this.layoutGPU=e,this.usedTimes=0}},$9=class{constructor(e){this.backend=e,this._bindGroupLayoutCache=new Map}createBindingsLayout(e){let t=this.backend,n=t.device,r=t.get(e);if(r.layout)return r.layout.layoutGPU;let s=this._createLayoutEntries(e),o=yx(JSON.stringify(s)),a=this._bindGroupLayoutCache.get(o);return a===void 0&&(a=new X9(n.createBindGroupLayout({entries:s})),this._bindGroupLayoutCache.set(o,a)),a.usedTimes++,r.layout=a,r.layoutKey=o,a.layoutGPU}createBindings(e,t,n,r=0){let{backend:s}=this,o=s.get(e),a=this.createBindingsLayout(e),l;n>0&&(o.groups===void 0&&(o.groups=[],o.versions=[]),o.versions[n]===r&&(l=o.groups[n])),l===void 0&&(l=this.createBindGroup(e,a),n>0&&(o.groups[n]=l,o.versions[n]=r)),o.group=l}updateBinding(e){let t=this.backend,n=t.device,r=e.buffer,s=t.get(e).buffer,o=e.updateRanges;if(o.length===0)n.queue.writeBuffer(s,0,r,0);else{let a=f_(r),l=a?1:r.BYTES_PER_ELEMENT,c=o[0].start;for(let u=0,f=o.length;u<f;u++){let d=o[u],A=o[u+1],y=d.start+d.count;if(A!==void 0&&A.start===y)continue;let w=c*l,S=(y-c)*l,T=w*(a?r.BYTES_PER_ELEMENT:1);n.queue.writeBuffer(s,T,r,w,S),A!==void 0&&(c=A.start)}}}createBindGroupIndex(e,t){let r=this.backend.device,s=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,o=e[0];Zw.label="bindingCameraIndex_"+o,Zw.size=16,Zw.usage=s;let a=r.createBuffer(Zw);Zw.reset(),r.queue.writeBuffer(a,0,e,0),oc.label="bindGroupCameraIndex_"+o,oc.layout=t,oc.entries.push({binding:0,resource:{buffer:a}});let l=r.createBindGroup(oc);return oc.reset(),l}createBindGroup(e,t){let n=this.backend,r=n.device,s=0;oc.label="bindGroup_"+e.name,oc.layout=t;for(let a of e.bindings){if(a.isUniformBuffer){let l=n.get(a);oc.entries.push({binding:s,resource:{buffer:l.buffer}})}else if(a.isStorageBuffer){let l=n.get(a.attribute).buffer;oc.entries.push({binding:s,resource:{buffer:l}})}else if(a.isSampledTexture){let l=n.get(a.texture),c;if(l.externalTexture!==void 0)c=r.importExternalTexture({source:l.externalTexture});else{let u=a.store?1:l.texture.mipLevelCount,f=a.store?a.mipLevel:0,d=`view-${l.texture.width}-${l.texture.height}`;if(l.texture.depthOrArrayLayers>1&&(d+=`-${l.texture.depthOrArrayLayers}`),d+=`-${u}-${f}`,c=l[d],c===void 0){let A=RIe.All,y;a.isSampledCubeTexture?y=Xo.Cube:a.texture.isArrayTexture||a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?y=Xo.TwoDArray:a.isSampledTexture3D?y=Xo.ThreeD:y=Xo.TwoD,K_.aspect=A,K_.dimension=y,K_.mipLevelCount=u,K_.baseMipLevel=f,c=l[d]=l.texture.createView(K_),K_.reset()}}oc.entries.push({binding:s,resource:c})}else if(a.isSampler){let l=n.get(a);oc.entries.push({binding:s,resource:l.sampler})}s++}let o=r.createBindGroup(oc);return oc.reset(),o}_createLayoutEntries(e){let t=[],n=0;for(let r of e.bindings){let s=this.backend,o={binding:n,visibility:r.visibility};if(r.isUniformBuffer||r.isStorageBuffer){let a={};r.isStorageBuffer&&(r.visibility&yf.COMPUTE&&(r.access===Yo.READ_WRITE||r.access===Yo.WRITE_ONLY)?a.type=dU.Storage:a.type=dU.ReadOnlyStorage),o.buffer=a}else if(r.isSampledTexture&&r.store){let a={};a.format=this.backend.get(r.texture).texture.format;let l=r.access;l===Yo.READ_WRITE?a.access=pU.ReadWrite:l===Yo.WRITE_ONLY?a.access=pU.WriteOnly:a.access=pU.ReadOnly,r.texture.isArrayTexture?a.viewDimension=Xo.TwoDArray:r.texture.is3DTexture&&(a.viewDimension=Xo.ThreeD),o.storageTexture=a}else if(r.isSampledTexture){let a={},{primarySamples:l}=s.utils.getTextureSampleData(r.texture);if(l>1&&(a.multisampled=!0,r.texture.isDepthTexture||(a.sampleType=Og.UnfilterableFloat)),r.texture.isDepthTexture)s.compatibilityMode&&r.texture.compareFunction===null?a.sampleType=Og.UnfilterableFloat:a.sampleType=Og.Depth;else{let c=r.texture.type;c===Kr?a.sampleType=Og.SInt:c===xi?a.sampleType=Og.UInt:c===cr&&(this.backend.hasFeature("float32-filterable")?a.sampleType=Og.Float:a.sampleType=Og.UnfilterableFloat)}r.isSampledCubeTexture?a.viewDimension=Xo.Cube:r.texture.isArrayTexture||r.texture.isDataArrayTexture||r.texture.isCompressedArrayTexture?a.viewDimension=Xo.TwoDArray:r.isSampledTexture3D&&(a.viewDimension=Xo.ThreeD),o.texture=a}else if(r.isSampler){let a={};r.texture.isDepthTexture&&(r.texture.compareFunction!==null&&r.textureNode.compareNode!==null&&s.hasCompatibility(Bd.TEXTURE_COMPARE)?a.type=$te.Comparison:a.type=$te.NonFiltering),o.sampler=a}else ze(`WebGPUBindingUtils: Unsupported binding "${r}".`);t.push(o),n++}return t}deleteBindGroupData(e){let{backend:t}=this,n=t.get(e);n.layout&&(n.layout.usedTimes--,n.layout.usedTimes===0&&this._bindGroupLayoutCache.delete(n.layoutKey),n.layout=void 0,n.layoutKey=void 0)}dispose(){this._bindGroupLayoutCache.clear()}},Y9=class{constructor(e){this.backend=e}getMaxAnisotropy(){return 16}getUniformBufferLimit(){return this.backend.device.limits.maxUniformBufferBindingSize}},Z9=class{constructor(){this.label="",this.layout=null,this.compute=null}reset(){this.label="",this.layout=null,this.compute=null}},K9=class{constructor(){this.label="",this.bindGroupLayouts=null}reset(){this.label="",this.bindGroupLayouts=null}},Kw=new Z9,Q_=new K9,J_=new lP,ac=new cP,Q9=class{constructor(e){this.backend=e}_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){let{object:n,material:r,geometry:s,pipeline:o}=e,{vertexProgram:a,fragmentProgram:l}=o,c=this.backend,u=c.device,f=c.utils,d=c.get(o),A=[];for(let H of e.getBindings()){let $=c.get(H),{layoutGPU:J}=$.layout;A.push(J)}let y=c.attributeUtils.createShaderVertexBuffers(e),w;r.blending!==ps&&(r.blending!==Ts||r.transparent!==!1)&&(w=this._getBlending(r));let S={};r.stencilWrite===!0&&(S={compare:this._getStencilCompare(r),failOp:this._getStencilOperation(r.stencilFail),depthFailOp:this._getStencilOperation(r.stencilZFail),passOp:this._getStencilOperation(r.stencilZPass)});let T=this._getColorWriteMask(r),R=[];if(e.context.textures!==null){let H=e.context.textures,$=e.context.mrt;for(let J=0;J<H.length;J++){let te=H[J],ce=f.getTextureFormatGPU(te),he;if($!==null)if(this.backend.compatibilityMode!==!0){let ve=$.getBlendMode(te.name);ve.blending===fb?he=w:ve.blending!==ps&&(he=this._getBlending(ve))}else ni("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets."),he=w;else he=w;R.push({format:ce,blend:he,writeMask:T})}}else{let H=f.getCurrentColorFormat(e.context);R.push({format:H,blend:w,writeMask:T})}let I=c.get(a).module,P=c.get(l).module,F=this._getPrimitiveState(n,s,r),D=this._getDepthCompare(r),L=f.getCurrentDepthStencilFormat(e.context),C=this._getSampleCount(e.context);Q_.bindGroupLayouts=A;let B=u.createPipelineLayout(Q_);Q_.reset(),ac.label=`renderPipeline_${r.name||r.type}_${r.id}`,ac.vertex=Object.assign({},I,{buffers:y}),ac.fragment=Object.assign({},P,{targets:R}),ac.primitive=F,ac.multisample.count=C,ac.multisample.alphaToCoverageEnabled=r.alphaToCoverage&&C>1,ac.layout=B;let k={},z=e.context.depth,G=e.context.stencil;(z===!0||G===!0)&&(z===!0&&(k.format=L,k.depthWriteEnabled=r.depthWrite,k.depthCompare=D),G===!0&&(k.stencilFront=S,k.stencilBack=S,k.stencilReadMask=r.stencilFuncMask,k.stencilWriteMask=r.stencilWriteMask),r.polygonOffset===!0&&F.topology===tS.TriangleList&&(k.depthBias=r.polygonOffsetUnits,k.depthBiasSlopeScale=r.polygonOffsetFactor,k.depthBiasClamp=0),ac.depthStencil=k),u.pushErrorScope("validation");let W=[{program:a,module:I.module},{program:l,module:P.module}],Y=ac.label;if(t===null)d.pipeline=u.createRenderPipeline(ac),ac.reset(),u.popErrorScope().then(H=>{H!==null&&(d.error=!0,ze(`WebGPURenderer: Render pipeline creation failed (${Y}): ${H.message}`),this._reportShaderDiagnostics(W,Y))});else{let H=new Promise(async $=>{try{let J=null,te=null;try{te=u.createRenderPipelineAsync(ac)}catch(he){J=he}if(ac.reset(),te!==null)try{d.pipeline=await te}catch(he){J=he}let ce=await u.popErrorScope();if(ce!==null||J!==null){d.error=!0;let he=ce&&ce.message||J&&J.message||"unknown";ze(`WebGPURenderer: Async render pipeline creation failed (${Y}): ${he}`),await this._reportShaderDiagnostics(W,Y)}}finally{$()}});t.push(H)}}createBundleEncoder(e,t="renderBundleEncoder"){let n=this.backend,{utils:r,device:s}=n,o=r.getCurrentDepthStencilFormat(e),a=r.getCurrentColorFormats(e),l=this._getSampleCount(e);J_.label=t,J_.colorFormats=a,J_.depthStencilFormat=o,J_.sampleCount=l;let c=s.createRenderBundleEncoder(J_);return J_.reset(),c}createComputePipeline(e,t){let n=this.backend,r=n.device,s=n.get(e.computeProgram).module,o=n.get(e),a=[];for(let f of t){let d=n.get(f),{layoutGPU:A}=d.layout;a.push(A)}let l=e.computeProgram,c=`computePipeline_${l.stage}${l.name?`_${l.name}`:""}`;r.pushErrorScope("validation"),Q_.bindGroupLayouts=a;let u=r.createPipelineLayout(Q_);Q_.reset(),Kw.label=c,Kw.compute=s,Kw.layout=u,o.pipeline=r.createComputePipeline(Kw),Kw.reset(),r.popErrorScope().then(f=>{f!==null&&(o.error=!0,ze(`WebGPURenderer: Compute pipeline creation failed (${c}): ${f.message}`),this._reportShaderDiagnostics([{program:l,module:s.module}],c))})}async _reportShaderDiagnostics(e,t){for(let{program:n,module:r}of e){let s=await r.getCompilationInfo();if(s.messages.length===0)continue;let o=n.code.split(`47024702 `);for(let a of s.messages){let l=a.lineNum>0?` at line ${a.lineNum}${a.linePos>0?`:${a.linePos}`:""}`:"",c=`WebGPURenderer [${t} / ${n.stage} ${a.type}]${l}: ${a.message}`,u="";a.lineNum>0&&a.lineNum<=o.length&&(u=`47034703 ${o[a.lineNum-1]}`,a.linePos>0&&(u+=`4704- ${" ".repeat(a.linePos-1)}^`)),(a.type==="error"?ze:Xe)(c+u)}}}_getBlending(e){let t,n,r=e.blending,s=e.blendSrc,o=e.blendDst,a=e.blendEquation;if(r===Bd){let l=e.blendSrcAlpha!==null?e.blendSrcAlpha:s,c=e.blendDstAlpha!==null?e.blendDstAlpha:o,u=e.blendEquationAlpha!==null?e.blendEquationAlpha:a;t={srcFactor:this._getBlendFactor(s),dstFactor:this._getBlendFactor(o),operation:this._getBlendOperation(a)},n={srcFactor:this._getBlendFactor(l),dstFactor:this._getBlendFactor(c),operation:this._getBlendOperation(u)}}else{let l=e.premultipliedAlpha,c=(u,f,d,A)=>{t={srcFactor:u,dstFactor:f,operation:Og.Add},n={srcFactor:d,dstFactor:A,operation:Og.Add}};if(l)switch(r){case Ms:c(ui.One,ui.OneMinusSrcAlpha,ui.One,ui.OneMinusSrcAlpha);break;case Oh:c(ui.One,ui.One,ui.One,ui.One);break;case Uh:c(ui.Zero,ui.OneMinusSrc,ui.Zero,ui.One);break;case kh:c(ui.Dst,ui.OneMinusSrcAlpha,ui.Zero,ui.One);break}else switch(r){case Ms:c(ui.SrcAlpha,ui.OneMinusSrcAlpha,ui.One,ui.OneMinusSrcAlpha);break;case Oh:c(ui.SrcAlpha,ui.One,ui.One,ui.One);break;case Uh:ze(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case kh:ze(`WebGPURenderer: "MultiplyBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break}}if(t!==void 0&&n!==void 0)return{color:t,alpha:n};ze("WebGPURenderer: Invalid blending: ",r)}_getBlendFactor(e){let t;switch(e){case Uu:t=ui.Zero;break;case vb:t=ui.One;break;case _b:t=ui.Src;break;case xb:t=ui.OneMinusSrc;break;case e0:t=ui.SrcAlpha;break;case t0:t=ui.OneMinusSrcAlpha;break;case wb:t=ui.Dst;break;case Sb:t=ui.OneMinusDst;break;case yb:t=ui.DstAlpha;break;case bb:t=ui.OneMinusDstAlpha;break;case Tb:t=ui.SrcAlphaSaturated;break;case IMe:t=ui.Constant;break;case PMe:t=ui.OneMinusConstant;break;default:ze("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t,n=e.stencilFunc;switch(n){case oF:t=jo.Never;break;case B2:t=jo.Always;break;case aF:t=jo.Less;break;case cF:t=jo.LessEqual;break;case lF:t=jo.Equal;break;case fF:t=jo.GreaterEqual;break;case uF:t=jo.Greater;break;case hF:t=jo.NotEqual;break;default:ze("WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case Td:t=im.Keep;break;case J8:t=im.Zero;break;case eF:t=im.Replace;break;case sF:t=im.Invert;break;case tF:t=im.IncrementClamp;break;case nF:t=im.DecrementClamp;break;case iF:t=im.IncrementWrap;break;case rF:t=im.DecrementWrap;break;default:ze("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case oo:t=Og.Add;break;case Ab:t=Og.Subtract;break;case gb:t=Og.ReverseSubtract;break;case UM:t=Og.Min;break;case kM:t=Og.Max;break;default:ze("WebGPUPipelineUtils: Blend equation not supported.",e)}return t}_getPrimitiveState(e,t,n){let r={},s=this.backend.utils;r.topology=s.getPrimitiveTopology(e,n),t.index!==null&&e.isLine===!0&&e.isLineSegments!==!0&&(r.stripIndexFormat=t.index.array instanceof Uint16Array?uI.Uint16:uI.Uint32);let o=n.side===mi;return e.isMesh&&e.matrixWorld.determinantAffine()<0&&(o=!o),r.frontFace=o===!0?Yte.CW:Yte.CCW,r.cullMode=n.side===vr?Zte.None:Zte.Back,r}_getColorWriteMask(e){return e.colorWrite===!0?Kte.All:Kte.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=jo.Always;else{let n=this.backend.parameters.reversedDepthBuffer?zb[e.depthFunc]:e.depthFunc;switch(n){case DA:t=jo.Never;break;case NA:t=jo.Always;break;case FA:t=jo.Less;break;case Lh:t=jo.LessEqual;break;case BA:t=jo.Equal;break;case OA:t=jo.GreaterEqual;break;case UA:t=jo.Greater;break;case kA:t=jo.NotEqual;break;default:ze("WebGPUPipelineUtils: Invalid depth function.",n)}}return t}},gI=class{constructor(){this.label="",this.type=void 0,this.count=0}reset(){this.label="",this.type=void 0,this.count=0}},mf=new ym,jPe=new a1,tS=new gI,J9=class extends lI{constructor(e,t,n=2048){super(n),this.device=e,this.type=t,tS.label=`queryset_global_timestamp_${t}`,tS.type="timestamp",tS.count=this.maxQueries,this.querySet=this.device.createQuerySet(tS),tS.reset();let r=this.maxQueries*8;mf.label=`buffer_timestamp_resolve_${t}`,mf.size=r,mf.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,this.resolveBuffer=this.device.createBuffer(mf),mf.reset(),mf.label=`buffer_timestamp_result_${t}`,mf.size=r,mf.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,this.resultBuffer=this.device.createBuffer(mf),mf.reset()}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return ni(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;let t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryOffsets.set(e,t),t}async resolveQueriesAsync(){if(!this.trackTimestamp||this.currentQueryIndex===0||this.isDisposed)return this.lastValue;if(this.pendingResolve)return this.pendingResolve;this.pendingResolve=this._resolveQueries();try{return await this.pendingResolve}finally{this.pendingResolve=null}}async _resolveQueries(){if(this.isDisposed)return this.lastValue;try{if(this.resultBuffer.mapState!=="unmapped")return this.lastValue;let e=new Map(this.queryOffsets),t=this.currentQueryIndex,n=t*8;this.currentQueryIndex=0,this.queryOffsets.clear();let r=this.device.createCommandEncoder(jPe);r.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),r.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);let s=r.finish();if(_f(this.device,s),this.resultBuffer.mapState!=="unmapped")return this.lastValue;if(await this.resultBuffer.mapAsync(GPUMapMode.READ,0,n),this.isDisposed)return this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue;let o=new BigUint64Array(this.resultBuffer.getMappedRange(0,n)),a={},l=[];for(let[u,f]of e){let d=u.match(/^(.*):f(\d+)$/),A=parseInt(d[2]);l.includes(A)===!1&&l.push(A),a[A]===void 0&&(a[A]=0);let y=o[f],w=o[f+1],S=Number(w-y)/1e6;this.timestamps.set(u,S),a[A]+=S}let c=a[l[l.length-1]];return this.resultBuffer.unmap(),this.lastValue=c,this.frames=l,c}catch(e){return ze("Error resolving queries:",e),this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue}}async dispose(){if(!this.isDisposed){if(this.isDisposed=!0,this.pendingResolve)try{await this.pendingResolve}catch(e){ze("Error waiting for pending resolve:",e)}if(this.resultBuffer&&this.resultBuffer.mapState==="mapped")try{this.resultBuffer.unmap()}catch(e){ze("Error unmapping buffer:",e)}this.querySet&&(this.querySet.destroy(),this.querySet=null),this.resolveBuffer&&(this.resolveBuffer.destroy(),this.resolveBuffer=null),this.resultBuffer&&(this.resultBuffer.destroy(),this.resultBuffer=null),this.queryOffsets.clear(),this.pendingResolve=null}}},ez=class{constructor(){this.label="",this.timestampWrites=void 0}reset(){this.label="",this.timestampWrites=void 0}},ox=class{constructor(){this.view=null,this.depthLoadOp=void 0,this.depthStoreOp=void 0,this.depthClearValue=void 0,this.depthReadOnly=!1,this.stencilLoadOp=void 0,this.stencilStoreOp=void 0,this.stencilClearValue=0,this.stencilReadOnly=!1}reset(){this.view=null,this.depthLoadOp=void 0,this.depthStoreOp=void 0,this.depthClearValue=void 0,this.depthReadOnly=!1,this.stencilLoadOp=void 0,this.stencilStoreOp=void 0,this.stencilClearValue=0,this.stencilReadOnly=!1}},tz=class{constructor(){this.querySet=null,this.beginningOfPassWriteIndex=void 0,this.endOfPassWriteIndex=void 0}reset(){this.querySet=null,this.beginningOfPassWriteIndex=void 0,this.endOfPassWriteIndex=void 0}},Xu={r:0,g:0,b:0,a:1},uc=new ym,Ya=new a1,ZR=new ez,nS=new gI,KR=new mI,QR=new tz,eu=new yx,Af=new yx,Mr=new NS,$d=new AI,nz=class extends aI{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=e.alpha===void 0?!0:e.alpha,this.parameters.requiredLimits=e.requiredLimits===void 0?{}:e.requiredLimits,this.compatibilityMode=null,this.device=null,this.defaultRenderPassdescriptor=null,this.utils=new D9(this),this.attributeUtils=new j9(this),this.bindingUtils=new $9(this),this.capabilities=new Y9(this),this.pipelineUtils=new Q9(this),this.textureUtils=new V9(this),this.occludedResolveCache=new Map;let t=typeof navigator>"u"?!0:/Android/.test(navigator.userAgent)===!1;this._compatibility={[kd.TEXTURE_COMPARE]:t}}async init(e){await super.init(e);let t=this.parameters,n;if(t.device===void 0){let r={powerPreference:t.powerPreference,featureLevel:"compatibility",xrCompatible:e.xr.enabled},s=typeof navigator<"u"?await navigator.gpu.requestAdapter(r):null;if(s===null)throw new Error("THREE.WebGPUBackend: Unable to create WebGPU adapter.");let o=Object.values(hI),a=[];for(let c of o)s.features.has(c)&&a.push(c);let l={requiredFeatures:a,requiredLimits:t.requiredLimits};n=await s.requestDevice(l)}else n=t.device;this.compatibilityMode=!n.features.has("core-features-and-limits"),this.compatibilityMode&&(e._samples=0),n.lost.then(r=>{if(r.reason==="destroyed")return;let s={api:"WebGPU",message:r.message||"Unknown reason",reason:r.reason||null,originalEvent:r};e.onDeviceLost(s)}),n.onuncapturederror=r=>{let s=r.error,o=s&&s.constructor?s.constructor.name:"GPUError",a=s&&s.message||"Unknown uncaptured GPU error";e.onError({api:"WebGPU",type:o,message:a,originalEvent:r})},this.device=n,this.trackTimestamp=this.trackTimestamp&&this.hasFeature(hI.TimestampQuery),this.updateSize()}setXRRenderTargetTextures(e,t,n=null){this.set(e.texture,{texture:t,format:t.format,externalTexture:!0,xrViewDescriptors:n,initialized:!0})}get context(){let e=this.renderer.getCanvasTarget(),t=this.get(e),n=t.context;if(n===void 0){let r=this.parameters;e.isDefaultCanvasTarget===!0&&r.context!==void 0?n=r.context:n=e.domElement.getContext("webgpu"),"setAttribute"in e.domElement&&e.domElement.setAttribute("data-engine",`three.js r${"185"} webgpu`);let s=r.alpha?"premultiplied":"opaque",o=r.outputType===Wi?"extended":"standard";n.configure({device:this.device,format:this.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:s,toneMapping:{mode:o}}),t.context=n}return n}get coordinateSystem(){return yl}get hasTimestamp(){return!0}async getArrayBufferAsync(e,t=null,n=0,r=-1){return await this.attributeUtils.getArrayBufferAsync(e,t,n,r)}getContext(){return this.context}_getDefaultRenderPassDescriptor(){let e=this.renderer,t=e.getCanvasTarget(),n=this.get(t),r=e.currentSamples,s=n.descriptor;if(s===void 0||n.samples!==r){if(s=new Qg,s.colorAttachments.push(new Kg),e.depth===!0||e.stencil===!0){let l=new ox;l.view=this.textureUtils.getDepthBuffer(e.depth,e.stencil).createView(),s.depthStencilAttachment=l}let a=s.colorAttachments[0];r>0?a.view=this.textureUtils.getColorBuffer().createView():a.resolveTarget=void 0,n.descriptor=s,n.samples=r}let o=s.colorAttachments[0];return r>0?o.resolveTarget=this.context.getCurrentTexture().createView():o.view=this.context.getCurrentTexture().createView(),s}_isRenderCameraDepthArray(e){let t=e.camera;return e.depthTexture&&e.depthTexture.isArrayTexture===!0&&t!==null&&t.isArrayCamera===!0}_hasExternalTexture(e){let t=e.textures;if(t===null)return!1;for(let n=0;n<t.length;n++)if(this.get(t[n]).externalTexture===!0)return!0;return!1}_createExternalTextureViews(e,t){let n=[],r=e.camera;if(t.xrViewDescriptors&&r!==null&&r.isArrayCamera===!0)for(let s=0;s<t.xrViewDescriptors.length;s++)n.push({view:t.texture.createView(t.xrViewDescriptors[s]),resolveTarget:void 0,depthSlice:void 0});else n.push({view:t.texture.createView({dimension:Xo.TwoD,baseArrayLayer:e.activeCubeFace,arrayLayerCount:1}),resolveTarget:void 0,depthSlice:void 0});return n}_getRenderPassDescriptor(e,t={}){let n=e.renderTarget,r=this.get(n),s=this._hasExternalTexture(e),o=r.descriptors;(o===void 0||r.width!==n.width||r.height!==n.height||r.samples!==n.samples||s)&&(o={},r.descriptors=o);let a=e.getCacheKey(),l=o[a];if(l===void 0||s){let u=e.textures,f=[],d,A=this._isRenderCameraDepthArray(e);for(let w=0;w<u.length;w++){let S=this.get(u[w]);if(S.externalTexture===!0){f.push(...this._createExternalTextureViews(e,S));continue}if(Mr.label=`colorAttachment_${w}`,Mr.baseMipLevel=e.activeMipmapLevel,Mr.mipLevelCount=1,Mr.baseArrayLayer=e.activeCubeFace,Mr.arrayLayerCount=1,Mr.dimension=Xo.TwoD,n.isRenderTarget3D)d=e.activeCubeFace,Mr.baseArrayLayer=0,Mr.dimension=Xo.ThreeD;else if(n.isRenderTarget&&u[w].image.depth>1)if(A===!0){let T=e.camera.cameras;for(let R=0;R<T.length;R++){Mr.baseArrayLayer=R,Mr.arrayLayerCount=1,Mr.dimension=Xo.TwoD;let P=S.texture.createView(Mr);f.push({view:P,resolveTarget:void 0,depthSlice:void 0})}}else Mr.dimension=Xo.TwoDArray;if(A!==!0){let T=S.texture.createView(Mr),R,P;S.msaaTexture!==void 0?(R=S.msaaTexture.createView(),P=T):(R=T,P=void 0),f.push({view:R,resolveTarget:P,depthSlice:d})}Mr.reset()}let y=[];for(let w=0;w<f.length;w++){let S=f[w],T=new Kg;T.view=S.view,T.depthSlice=S.depthSlice,T.resolveTarget=S.resolveTarget,y.push(T)}if(l={textureViews:f,colorAttachments:y,descriptor:new Qg},e.depth){let w=this.get(e.depthTexture);(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(Mr.dimension=Xo.TwoD,Mr.arrayLayerCount=1,Mr.baseArrayLayer=e.activeCubeFace);let S=new ox;S.view=w.texture.createView(Mr),l.depthStencilAttachment=S,Mr.reset()}o[a]=l,r.width=n.width,r.height=n.height,r.samples=n.samples,r.activeMipmapLevel=e.activeMipmapLevel,r.activeCubeFace=e.activeCubeFace}let c=l.descriptor;c.reset();for(let u=0;u<l.colorAttachments.length;u++){let f=l.colorAttachments[u],d={r:0,g:0,b:0,a:1};u===0&&t.clearValue&&(d=t.clearValue),f.loadOp=t.loadOp||Fi.Load,f.storeOp=t.storeOp||Za.Store,f.clearValue=d,c.colorAttachments.push(f)}return l.depthStencilAttachment&&(c.depthStencilAttachment=l.depthStencilAttachment),c}beginRender(e){let t=this.get(e),n=this.device,r=e.occlusionQueryCount,s;r>0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,nS.label=`occlusionQuerySet_${e.id}`,nS.type="occlusion",nS.count=r,s=n.createQuerySet(nS),nS.reset(),t.occlusionQuerySet=s,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(r),t.lastOcclusionObject=null);let o;e.textures===null?o=this._getDefaultRenderPassDescriptor():o=this._getRenderPassDescriptor(e,{loadOp:Fi.Load}),this.initTimestampQuery($c.RENDER,this.getTimestampUID(e),o),o.occlusionQuerySet=s;let a=o.depthStencilAttachment;if(e.textures!==null){let c=o.colorAttachments;for(let u=0;u<c.length;u++){let f=c[u];e.clearColor?(u===0?f.clearValue=e.clearColorValue:(Xu.r=0,Xu.g=0,Xu.b=0,Xu.a=1,f.clearValue=Xu),f.loadOp=Fi.Clear):f.loadOp=Fi.Load,f.storeOp=Za.Store}}else{let c=o.colorAttachments[0];e.clearColor?(c.clearValue=e.clearColorValue,c.loadOp=Fi.Clear):c.loadOp=Fi.Load,c.storeOp=Za.Store}e.depth&&(e.clearDepth?(a.depthClearValue=e.clearDepthValue,a.depthLoadOp=Fi.Clear):a.depthLoadOp=Fi.Load,a.depthStoreOp=Za.Store),e.stencil&&(e.clearStencil?(a.stencilClearValue=e.clearStencilValue,a.stencilLoadOp=Fi.Clear):a.stencilLoadOp=Fi.Load,a.stencilStoreOp=Za.Store),Ya.label="renderContext_"+e.id;let l=n.createCommandEncoder(Ya);if(Ya.reset(),this._isRenderCameraDepthArray(e)===!0){let c=e.camera.cameras;!t.layerDescriptors||t.layerDescriptors.length!==c.length?this._createArrayCameraLayerDescriptors(e,t,o,c):this._updateArrayCameraLayerDescriptors(e,t,c),t.bundleEncoders=[],t.bundleSets=[];for(let u=0;u<c.length;u++){let f=this.pipelineUtils.createBundleEncoder(e,"renderBundleArrayCamera_"+u),d={attributes:{},bindingGroups:[],pipeline:null,index:null};t.bundleEncoders.push(f),t.bundleSets.push(d)}t.currentPass=null}else{let c=l.beginRenderPass(o);t.currentPass=c,e.viewport&&this.updateViewport(e),e.scissor&&this.updateScissor(e)}t.descriptor=o,t.encoder=l,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.renderBundles=[]}_createArrayCameraLayerDescriptors(e,t,n,r){let s=n.depthStencilAttachment;t.layerDescriptors=[];let o=this.get(e.depthTexture);o.viewCache||(o.viewCache=[]);for(let a=0;a<r.length;a++){let l=n.colorAttachments[0],c=new Kg;c.view=n.colorAttachments[a].view,c.depthSlice=l.depthSlice,c.resolveTarget=l.resolveTarget,c.loadOp=l.loadOp,c.storeOp=l.storeOp,c.clearValue=l.clearValue;let u=new Qg;if(u.label=n.label,u.occlusionQuerySet=n.occlusionQuerySet,u.timestampWrites=n.timestampWrites,u.colorAttachments.push(c),n.depthStencilAttachment){let f=a;o.viewCache[f]||(Mr.dimension=Xo.TwoD,Mr.baseArrayLayer=a,Mr.arrayLayerCount=1,o.viewCache[f]=o.texture.createView(Mr),Mr.reset());let d=new ox;d.view=o.viewCache[f],d.depthLoadOp=s.depthLoadOp||Fi.Clear,d.depthStoreOp=s.depthStoreOp||Za.Store,d.depthClearValue=s.depthClearValue||1,e.stencil&&(d.stencilLoadOp=s.stencilLoadOp,d.stencilStoreOp=s.stencilStoreOp,d.stencilClearValue=s.stencilClearValue),u.depthStencilAttachment=d}else{let f=new ox;f.view=s.view,f.depthLoadOp=s.depthLoadOp,f.depthStoreOp=s.depthStoreOp,f.depthClearValue=s.depthClearValue,f.depthReadOnly=s.depthReadOnly,f.stencilLoadOp=s.stencilLoadOp,f.stencilStoreOp=s.stencilStoreOp,f.stencilClearValue=s.stencilClearValue,f.stencilReadOnly=s.stencilReadOnly,u.depthStencilAttachment=f}t.layerDescriptors.push(u)}}_updateArrayCameraLayerDescriptors(e,t,n){for(let r=0;r<n.length;r++){let s=t.layerDescriptors[r];if(s.depthStencilAttachment){let o=s.depthStencilAttachment;e.depth&&(e.clearDepth?(o.depthClearValue=e.clearDepthValue,o.depthLoadOp=Fi.Clear):o.depthLoadOp=Fi.Load),e.stencil&&(e.clearStencil?(o.stencilClearValue=e.clearStencilValue,o.stencilLoadOp=Fi.Clear):o.stencilLoadOp=Fi.Load)}}}finishRender(e){let t=this.get(e),n=e.occlusionQueryCount;t.renderBundles.length>0&&t.currentPass.executeBundles(t.renderBundles),n>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery();let r=t.encoder;if(this._isRenderCameraDepthArray(e)===!0){let s=[];for(let o=0;o<t.bundleEncoders.length;o++){let a=t.bundleEncoders[o];s.push(a.finish())}for(let o=0;o<t.layerDescriptors.length;o++)if(o<s.length){let a=t.layerDescriptors[o],l=r.beginRenderPass(a);if(e.viewport){let{x:c,y:u,width:f,height:d,minDepth:A,maxDepth:y}=e.viewportValue;l.setViewport(c,u,f,d,A,y)}if(e.scissor){let{x:c,y:u,width:f,height:d}=e.scissorValue;l.setScissorRect(c,u,f,d)}l.executeBundles([s[o]]),l.end()}}else t.currentPass&&t.currentPass.end();if(n>0){let s=n*8,o=this.occludedResolveCache.get(s);o===void 0&&(uc.size=s,uc.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,o=this.device.createBuffer(uc),uc.reset(),this.occludedResolveCache.set(s,o)),uc.size=s,uc.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let a=this.device.createBuffer(uc);uc.reset(),t.encoder.resolveQuerySet(t.occlusionQuerySet,0,n,o,0),t.encoder.copyBufferToBuffer(o,0,a,0,s),t.occlusionQueryBuffer=a,this.resolveOccludedAsync(e)}if(_f(this.device,t.encoder.finish()),e.textures!==null){let s=e.textures;for(let o=0;o<s.length;o++){let a=s[o];a.generateMipmaps===!0&&this.textureUtils.generateMipmaps(a)}}}isOccluded(e,t){let n=this.get(e);return n.occluded&&n.occluded.has(t)}async resolveOccludedAsync(e){let t=this.get(e),{currentOcclusionQueryBuffer:n,currentOcclusionQueryObjects:r}=t;if(n&&r){let s=new WeakSet;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueryBuffer=null,await n.mapAsync(GPUMapMode.READ);let o=n.getMappedRange(),a=new BigUint64Array(o);for(let l=0;l<r.length;l++)a[l]===BigInt(0)&&s.add(r[l]);n.destroy(),t.occluded=s}}updateViewport(e){let{currentPass:t}=this.get(e),{x:n,y:r,width:s,height:o,minDepth:a,maxDepth:l}=e.viewportValue;t.setViewport(n,r,s,o,a,l)}updateScissor(e){let{currentPass:t}=this.get(e),{x:n,y:r,width:s,height:o}=e.scissorValue;t.setScissorRect(n,r,s,o)}getClearColor(){let e=super.getClearColor();return this.renderer.alpha===!0&&(e.r*=e.a,e.g*=e.a,e.b*=e.a),e}clear(e,t,n,r=null){let s=this.device,o=this.renderer,a=[],l,c,u;if(e){let A=this.getClearColor();Xu.r=A.r,Xu.g=A.g,Xu.b=A.b,Xu.a=A.a}if(r===null){c=o.depth,u=o.stencil;let A=this._getDefaultRenderPassDescriptor();if(e){a=A.colorAttachments;let y=a[0];y.clearValue=Xu,y.loadOp=Fi.Clear,y.storeOp=Za.Store}(c||u)&&(l=A.depthStencilAttachment)}else{c=r.depth,u=r.stencil;let A={loadOp:e?Fi.Clear:Fi.Load,clearValue:e?Xu:void 0};c&&(A.depthLoadOp=t?Fi.Clear:Fi.Load,A.depthClearValue=t?o.getClearDepth():void 0,A.depthStoreOp=Za.Store),u&&(A.stencilLoadOp=n?Fi.Clear:Fi.Load,A.stencilClearValue=n?o.getClearStencil():void 0,A.stencilStoreOp=Za.Store);let y=this._getRenderPassDescriptor(r,A);a=y.colorAttachments,l=y.depthStencilAttachment}c&&l&&(t?(l.depthLoadOp=Fi.Clear,l.depthClearValue=o.getClearDepth(),l.depthStoreOp=Za.Store):(l.depthLoadOp=Fi.Load,l.depthStoreOp=Za.Store)),u&&l&&(n?(l.stencilLoadOp=Fi.Clear,l.stencilClearValue=o.getClearStencil(),l.stencilStoreOp=Za.Store):(l.stencilLoadOp=Fi.Load,l.stencilStoreOp=Za.Store)),Ya.label="clear";let f=s.createCommandEncoder(Ya);Ya.reset(),f.beginRenderPass({colorAttachments:a,depthStencilAttachment:l}).end(),_f(s,f.finish())}beginCompute(e){let t=this.get(e),n="computeGroup_"+e.id;ZR.label=n,Ya.label=n,this.initTimestampQuery($c.COMPUTE,this.getTimestampUID(e),ZR),t.cmdEncoderGPU=this.device.createCommandEncoder(Ya),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(ZR),t.currentPipeline=null,Ya.reset(),ZR.reset()}compute(e,t,n,r,s=null){let o=this.get(t),a=this.get(e),{passEncoderGPU:l}=a,c=this.get(r).pipeline;a.currentPipeline!==c&&(l.setPipeline(c),a.currentPipeline=c);for(let u=0,f=n.length;u<f;u++){let d=n[u],A=this.get(d);l.setBindGroup(u,A.group)}if(s===null&&(s=t.dispatchSize||t.count),s&&s.isIndirectStorageBufferAttribute){let u=this.get(s).buffer;l.dispatchWorkgroupsIndirect(u,0);return}if(typeof s=="number"){let u=s;if(o.dispatchSize===void 0||o.count!==u){o.dispatchSize=[0,1,1],o.count=u;let f=t.workgroupSize,d=f[0];for(let w=1;w<f.length;w++)d*=f[w];let A=Math.ceil(u/d),y=this.device.limits.maxComputeWorkgroupsPerDimension;s=[A,1,1],A>y&&(s[0]=Math.min(A,y),s[1]=Math.ceil(A/y)),o.dispatchSize=s}s=o.dispatchSize}l.dispatchWorkgroups(s[0],s[1]||1,s[2]||1)}finishCompute(e){let t=this.get(e);t.passEncoderGPU.end(),_f(this.device,t.cmdEncoderGPU.finish())}_draw(e,t,n,r,s,o,a,l,c){let{object:u,material:f,context:d}=e,A=e.getIndex(),y=A!==null;c.pipeline!==r&&(l.setPipeline(r),c.pipeline=r);let w=c.bindingGroups;for(let S=0,T=s.length;S<T;S++){let R=s[S];if(w[S]!==R.id){let P=this.get(R);l.setBindGroup(S,P.group),w[S]=R.id}}if(y===!0&&c.index!==A){let S=this.get(A).buffer,T=A.array instanceof Uint16Array?uI.Uint16:uI.Uint32;l.setIndexBuffer(S,T),c.index=A}for(let S=0,T=o.length;S<T;S++){let R=o[S];if(c.attributes[S]!==R){let P=this.get(R).buffer;l.setVertexBuffer(S,P),c.attributes[S]=R}}if(d.stencil===!0&&f.stencilWrite===!0&&n.currentStencilRef!==f.stencilRef&&(l.setStencilReference(f.stencilRef),n.currentStencilRef=f.stencilRef),u.isBatchedMesh===!0){let S=u._multiDrawStarts,T=u._multiDrawCounts,R=u._multiDrawCount,P=y===!0?A.array.BYTES_PER_ELEMENT:1;f.wireframe&&(P=u.geometry.attributes.position.count>65535?4:2);for(let I=0;I<R;I++)y===!0?l.drawIndexed(T[I],1,S[I]/P,0,I):l.draw(T[I],1,S[I],I),t.update(u,T[I],1)}else if(y===!0){let{vertexCount:S,instanceCount:T,firstVertex:R}=a,P=e.getIndirect();if(P!==null){let I=this.get(P).buffer,F=e.getIndirectOffset(),D=Array.isArray(F)?F:[F];for(let L=0;L<D.length;L++)l.drawIndexedIndirect(I,D[L])}else l.drawIndexed(S,T,R,0,0);t.update(u,S,T)}else{let{vertexCount:S,instanceCount:T,firstVertex:R}=a,P=e.getIndirect();if(P!==null){let I=this.get(P).buffer,F=e.getIndirectOffset(),D=Array.isArray(F)?F:[F];for(let L=0;L<D.length;L++)l.drawIndirect(I,D[L])}else l.draw(S,T,R,0);t.update(u,S,T)}}draw(e,t){let{object:n,context:r,pipeline:s}=e,o=this.get(r),a=this.get(s),l=a.pipeline;if(a.error===!0)return;let c=e.getDrawParameters();if(c===null)return;let u=e.getBindings(),f=e.getVertexBuffers();if(e.camera.isArrayCamera&&e.camera.cameras.length>0){let d=this.get(e.camera),A=e.camera.cameras,y=e.getBindingGroup("cameraIndex");if(d.indexesGPU===void 0||d.indexesGPU.length!==A.length){let S=this.get(y),T=[],R=new Uint32Array([0,0,0,0]);for(let P=0,I=A.length;P<I;P++){R[0]=P;let{layoutGPU:F}=S.layout,D=this.bindingUtils.createBindGroupIndex(R,F);T.push(D)}d.indexesGPU=T}let w=this.renderer.getPixelRatio();for(let S=0,T=A.length;S<T;S++){let R=A[S];if(n.layers.test(R.layers)){let P=R.viewport,I=o.currentPass,F=o.currentSets,D=o.bundleEncoders!==void 0;if(D){let L=o.bundleEncoders[S],C=o.bundleSets[S];I=L,F=C}if(P&&!D&&I.setViewport(Math.floor(P.x*w),Math.floor(P.y*w),Math.floor(P.width*w),Math.floor(P.height*w),r.viewportValue.minDepth,r.viewportValue.maxDepth),y&&d.indexesGPU){let L=u.indexOf(y);I.setBindGroup(L,d.indexesGPU[S]),F.bindingGroups[L]=y.id}this._draw(e,t,o,l,u,f,c,I,F)}}}else if(o.currentPass){if(o.occlusionQuerySet!==void 0){let d=o.lastOcclusionObject;d!==n&&(d!==null&&d.occlusionTest===!0&&(o.currentPass.endOcclusionQuery(),o.occlusionQueryIndex++),n.occlusionTest===!0&&(o.currentPass.beginOcclusionQuery(o.occlusionQueryIndex),o.occlusionQueryObjects[o.occlusionQueryIndex]=n),o.lastOcclusionObject=n)}this._draw(e,t,o,l,u,f,c,o.currentPass,o.currentSets)}}needsRenderUpdate(e){let t=this.get(e),{object:n,material:r}=e,s=this.utils,o=s.getSampleCountRenderContext(e.context),a=s.getCurrentColorSpace(e.context),l=s.getCurrentColorFormat(e.context),c=s.getCurrentDepthStencilFormat(e.context),u=s.getPrimitiveTopology(n,r),f=n.isMesh&&n.matrixWorld.determinantAffine()<0,d=!1;return(t.material!==r||t.materialVersion!==r.version||t.transparent!==r.transparent||t.blending!==r.blending||t.premultipliedAlpha!==r.premultipliedAlpha||t.blendSrc!==r.blendSrc||t.blendDst!==r.blendDst||t.blendEquation!==r.blendEquation||t.blendSrcAlpha!==r.blendSrcAlpha||t.blendDstAlpha!==r.blendDstAlpha||t.blendEquationAlpha!==r.blendEquationAlpha||t.colorWrite!==r.colorWrite||t.depthWrite!==r.depthWrite||t.depthTest!==r.depthTest||t.depthFunc!==r.depthFunc||t.stencilWrite!==r.stencilWrite||t.stencilFunc!==r.stencilFunc||t.stencilFail!==r.stencilFail||t.stencilZFail!==r.stencilZFail||t.stencilZPass!==r.stencilZPass||t.stencilFuncMask!==r.stencilFuncMask||t.stencilWriteMask!==r.stencilWriteMask||t.side!==r.side||t.alphaToCoverage!==r.alphaToCoverage||t.sampleCount!==o||t.colorSpace!==a||t.colorFormat!==l||t.depthStencilFormat!==c||t.primitiveTopology!==u||t.frontFaceCW!==f||t.clippingContextCacheKey!==e.clippingContextCacheKey)&&(t.material=r,t.materialVersion=r.version,t.transparent=r.transparent,t.blending=r.blending,t.premultipliedAlpha=r.premultipliedAlpha,t.blendSrc=r.blendSrc,t.blendDst=r.blendDst,t.blendEquation=r.blendEquation,t.blendSrcAlpha=r.blendSrcAlpha,t.blendDstAlpha=r.blendDstAlpha,t.blendEquationAlpha=r.blendEquationAlpha,t.colorWrite=r.colorWrite,t.depthWrite=r.depthWrite,t.depthTest=r.depthTest,t.depthFunc=r.depthFunc,t.stencilWrite=r.stencilWrite,t.stencilFunc=r.stencilFunc,t.stencilFail=r.stencilFail,t.stencilZFail=r.stencilZFail,t.stencilZPass=r.stencilZPass,t.stencilFuncMask=r.stencilFuncMask,t.stencilWriteMask=r.stencilWriteMask,t.side=r.side,t.alphaToCoverage=r.alphaToCoverage,t.sampleCount=o,t.colorSpace=a,t.colorFormat=l,t.depthStencilFormat=c,t.primitiveTopology=u,t.frontFaceCW=f,t.clippingContextCacheKey=e.clippingContextCacheKey,d=!0),d}getRenderCacheKey(e){let{object:t,material:n}=e,r=this.utils,s=e.context,o=t.isMesh&&t.matrixWorld.determinantAffine()<0;return[n.transparent,n.blending,n.premultipliedAlpha,n.blendSrc,n.blendDst,n.blendEquation,n.blendSrcAlpha,n.blendDstAlpha,n.blendEquationAlpha,n.colorWrite,n.depthWrite,n.depthTest,n.depthFunc,n.stencilWrite,n.stencilFunc,n.stencilFail,n.stencilZFail,n.stencilZPass,n.stencilFuncMask,n.stencilWriteMask,n.side,o,r.getSampleCountRenderContext(s),r.getCurrentColorSpace(s),r.getCurrentColorFormat(s),r.getCurrentDepthStencilFormat(s),r.getPrimitiveTopology(t,n),e.getGeometryCacheKey(),e.clippingContextCacheKey].join()}updateSampler(e){return this.textureUtils.updateSampler(e)}destroySampler(e){this.textureUtils.destroySampler(e)}createDefaultTexture(e){return this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,n,r,s,o){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,o)}initTimestampQuery(e,t,n){if(!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new J9(this.device,e,2048));let r=this.timestampQueryPool[e],s=r.allocateQueriesForContext(t);QR.querySet=r.querySet,QR.beginningOfPassWriteIndex=s,QR.endOfPassWriteIndex=s+1,n.timestampWrites=QR}createNodeBuilder(e,t){return new W9(e,t)}createProgram(e){let t=this.get(e);KR.label=e.stage+(e.name!==""?`_${e.name}`:""),KR.code=e.code,t.module={module:this.device.createShaderModule(KR),entryPoint:"main"},KR.reset()}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){this.pipelineUtils.createRenderPipeline(e,t)}createComputePipeline(e,t){this.pipelineUtils.createComputePipeline(e,t)}beginBundle(e){let t=this.get(e);t._currentPass=t.currentPass,t._currentSets=t.currentSets,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.currentPass=this.pipelineUtils.createBundleEncoder(e)}finishBundle(e,t){let n=this.get(e),s=n.currentPass.finish();this.get(t).bundleGPU=s,n.currentSets=n._currentSets,n.currentPass=n._currentPass}addBundle(e,t){this.get(e).renderBundles.push(this.get(t).bundleGPU)}createUniformBuffer(e){let t=this.get(e);if(t.buffer===void 0){let n=e.byteLength,r=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,s=[];e.visibility&Tf.VERTEX&&s.push("vertex"),e.visibility&Tf.FRAGMENT&&s.push("fragment"),e.visibility&Tf.COMPUTE&&s.push("compute");let o=`(${s.join(",")})`;uc.label=`bindingBuffer${e.id}_${e.name}_${o}`,uc.size=n,uc.usage=r;let a=this.device.createBuffer(uc);uc.reset(),t.buffer=a}}destroyUniformBuffer(e){this.get(e).buffer.destroy(),this.delete(e)}createBindings(e,t,n,r){this.bindingUtils.createBindings(e,t,n,r)}updateBindings(e,t,n,r){this.bindingUtils.createBindings(e,t,n,r)}updateBinding(e){this.bindingUtils.updateBinding(e)}deleteBindGroupData(e){this.bindingUtils.deleteBindGroupData(e)}createIndexAttribute(e){let t=GPUBufferUsage.INDEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST;(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(t|=GPUBufferUsage.STORAGE),this.attributeUtils.createAttribute(e,t)}createAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createIndirectStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.INDIRECT|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}updateSize(){this.delete(this.renderer.getCanvasTarget())}hasFeature(e){return ene[e]!==void 0&&(e=ene[e]),this.device.features.has(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){let a=0,l=0,c=0,u=0,f=0,d=0,A=e.image.width,y=e.image.height,w=1;n!==null&&(n.isBox3===!0?(u=n.min.x,f=n.min.y,d=n.min.z,A=n.max.x-n.min.x,y=n.max.y-n.min.y,w=n.max.z-n.min.z):(u=n.min.x,f=n.min.y,A=n.max.x-n.min.x,y=n.max.y-n.min.y,w=1)),r!==null&&(a=r.x,l=r.y,c=r.z||0),Ya.label="copyTextureToTexture_"+e.id+"_"+t.id;let S=this.device.createCommandEncoder(Ya);Ya.reset();let T=this.get(e).texture,R=this.get(t).texture;eu.texture=T,eu.mipLevel=s,eu.origin.x=u,eu.origin.y=f,eu.origin.z=d,Af.texture=R,Af.mipLevel=o,Af.origin.x=a,Af.origin.y=l,Af.origin.z=c,$d.width=A,$d.height=y,$d.depthOrArrayLayers=w,S.copyTextureToTexture(eu,Af,$d),eu.reset(),Af.reset(),$d.reset(),_f(this.device,S.finish()),o===0&&t.generateMipmaps&&this.textureUtils.generateMipmaps(t)}copyFramebufferToTexture(e,t,n){let r=this.get(t),s=null;t.renderTarget?e.isDepthTexture?s=this.get(t.depthTexture).texture:s=this.get(t.textures[0]).texture:e.isDepthTexture?s=this.textureUtils.getDepthBuffer(t.depth,t.stencil):s=this.context.getCurrentTexture();let o=this.get(e).texture;if(s.format!==o.format){ze("WebGPUBackend: copyFramebufferToTexture: Source and destination formats do not match.",s.format,o.format);return}let a;if(r.currentPass?(r.currentPass.end(),a=r.encoder):(Ya.label="copyFramebufferToTexture_"+e.id,a=this.device.createCommandEncoder(Ya),Ya.reset()),eu.texture=s,eu.origin.x=n.x,eu.origin.y=n.y,Af.texture=o,$d.width=n.z,$d.height=n.w,a.copyTextureToTexture(eu,Af,$d),eu.reset(),Af.reset(),$d.reset(),e.generateMipmaps&&this.textureUtils.generateMipmaps(e,a),r.currentPass){let{descriptor:l}=r;for(let c=0;c<l.colorAttachments.length;c++)l.colorAttachments[c].loadOp=Fi.Load;t.depth&&(l.depthStencilAttachment.depthLoadOp=Fi.Load),t.stencil&&(l.depthStencilAttachment.stencilLoadOp=Fi.Load),r.currentPass=a.beginRenderPass(l),r.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.viewport&&this.updateViewport(t),t.scissor&&this.updateScissor(t)}else _f(this.device,a.finish())}hasCompatibility(e){return this._compatibility[e]!==void 0?this._compatibility[e]:super.hasCompatibility(e)}dispose(){if(this.bindingUtils.dispose(),this.textureUtils.dispose(),this.occludedResolveCache){for(let e of this.occludedResolveCache.values())e.destroy();this.occludedResolveCache.clear()}if(this.timestampQueryPool)for(let e of Object.values(this.timestampQueryPool))e!==null&&e.dispose();this.parameters.device===void 0&&this.device!==null&&this.device.destroy()}},iz=class extends QA{constructor(e,t,n,r,s,o){super(e,t,n,r,s,o),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}},rz=class extends QA{constructor(e,t,n,r,s,o){super(e,t,n,r,s,o),this.aspect=null}copy(e,t){return super.copy(e,t),this.aspect=e.aspect,this}},sz=class extends J4{constructor(){super(),this.addMaterial(C7,"MeshPhongMaterial"),this.addMaterial(P4,"MeshStandardMaterial"),this.addMaterial(B7,"MeshPhysicalMaterial"),this.addMaterial(U7,"MeshToonMaterial"),this.addMaterial(E7,"MeshBasicMaterial"),this.addMaterial(M7,"MeshLambertMaterial"),this.addMaterial(b7,"MeshNormalMaterial"),this.addMaterial(k7,"MeshMatcapMaterial"),this.addMaterial(_7,"LineBasicMaterial"),this.addMaterial(x7,"LineDashedMaterial"),this.addMaterial(V7,"PointsMaterial"),this.addMaterial(L4,"SpriteMaterial"),this.addMaterial(q7,"ShadowMaterial"),this.addLight(Dk,ab),this.addLight(i9,JA),this.addLight(l9,lb),this.addLight(IS,QA),this.addLight(n9,eg),this.addLight(r9,sb),this.addLight(o9,cb),this.addLight(s9,iz),this.addLight(a9,rz),this.addToneMapping(Ose,Eb),this.addToneMapping(Use,Mb),this.addToneMapping(kse,Cb),this.addToneMapping(zse,Rb),this.addToneMapping(Vse,Ib),this.addToneMapping(Gse,Pb)}},bx=class extends g9{constructor(e={}){let t;e.forceWebGL?t=cI:(t=nz,e.getFallback=()=>(Xe("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new cI(e)));let n=new t(e);super(n,e),this.library=new sz,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}};var Plt=V.BRDF_GGX,Llt=V.BRDF_Lambert,Dlt=V.BasicPointShadowFilter,Nlt=V.BasicShadowFilter,Flt=V.Break,Blt=V.Const,Olt=V.Continue,Ult=V.DFGLUT,klt=V.D_GGX,zlt=V.Discard,Vlt=V.EPSILON,Glt=V.F_Schlick,_oe=V.Fn,qlt=V.INFINITY,xoe=V.If,yoe=V.Loop,Hlt=V.NodeAccess,Wlt=V.NodeShaderStage,jlt=V.NodeType,Xlt=V.NodeUpdateType,$lt=V.PCFShadowFilter,Ylt=V.PCFSoftShadowFilter,Zlt=V.PI,Klt=V.PI2,Qlt=V.TWO_PI,Jlt=V.HALF_PI,ect=V.PointShadowFilter,tct=V.Return,nct=V.Schlick_to_F0,ict=V.ShaderNode,rct=V.Stack,sct=V.Switch,oct=V.TBNViewMatrix,act=V.VSMShadowFilter,lct=V.V_GGX_SmithCorrelated,cct=V.Var,uct=V.VarIntent,hct=V.abs,fct=V.acesFilmicToneMapping,dct=V.acos,pct=V.acosh,mct=V.add,Act=V.addMethodChaining,gct=V.addNodeElement,vct=V.agxToneMapping,_ct=V.all,xct=V.alphaT,yct=V.ambientOcclusion,bct=V.and,wct=V.anisotropy,Sct=V.anisotropyB,Tct=V.anisotropyT,Ect=V.any,Mct=V.append,Cct=V.array,boe=V.asin,Rct=V.asinh,Ict=V.assign,Pct=V.atan,Lct=V.atanh,Dct=V.atomicAdd,Nct=V.atomicAnd,Fct=V.atomicFunc,Bct=V.atomicLoad,Oct=V.atomicMax,Uct=V.atomicMin,kct=V.atomicOr,zct=V.atomicStore,Vct=V.atomicSub,Gct=V.atomicXor,qct=V.attenuationColor,Hct=V.attenuationDistance,Wct=V.attribute,jct=V.attributeArray,Xct=V.backgroundBlurriness,$ct=V.backgroundIntensity,Yct=V.backgroundRotation,Zct=V.batch,Kct=V.bentNormalView,Qct=V.billboarding,Jct=V.bitAnd,eut=V.bitNot,tut=V.bitOr,nut=V.bitXor,iut=V.bitangentGeometry,rut=V.bitangentLocal,sut=V.bitangentView,out=V.bitangentWorld,aut=V.bitcast,lut=V.blendBurn,cut=V.blendColor,uut=V.blendDodge,hut=V.blendOverlay,fut=V.blendScreen,dut=V.blur,put=V.bool,mut=V.buffer,Aut=V.bufferAttribute,gut=V.bumpMap,vut=V.builtin,_ut=V.builtinAOContext,xut=V.builtinShadowContext,yut=V.bvec2,but=V.bvec3,wut=V.bvec4,Sut=V.bypass,Tut=V.cache,Eut=V.call,Mut=V.cameraFar,Cut=V.cameraIndex,Rut=V.cameraNear,Iut=V.cameraNormalMatrix,Put=V.cameraPosition,Lut=V.cameraProjectionMatrix,Dut=V.cameraProjectionMatrixInverse,Nut=V.cameraViewMatrix,Fut=V.cameraViewport,But=V.cameraWorldMatrix,Out=V.cbrt,Uut=V.cdl,kut=V.ceil,zut=V.checker,Vut=V.cineonToneMapping,Gut=V.clamp,qut=V.clearcoat,Hut=V.clearcoatNormalView,Wut=V.clearcoatRoughness,jut=V.clipSpace,Xut=V.code,$ut=V.color,Yut=V.colorSpaceToWorking,Zut=V.colorToDirection,Kut=V.compute,Qut=V.computeKernel,Jut=V.computeSkinning,eht=V.context,tht=V.convert,nht=V.convertColorSpace,iht=V.convertToTexture,rht=V.countLeadingZeros,sht=V.countOneBits,oht=V.countTrailingZeros,woe=V.cos,aht=V.cosh,lht=V.cross,cht=V.cubeTexture,uht=V.cubeTextureBase,hht=V.dFdx,fht=V.dFdy,dht=V.dashSize,pht=V.debug,mht=V.decrement,Aht=V.decrementBefore,ght=V.defaultBuildStages,vht=V.defaultShaderStages,_ht=V.defined,xht=V.degrees,yht=V.deltaTime,bht=V.densityFog,wht=V.densityFogFactor,Sht=V.depth,Tht=V.depthPass,Eht=V.determinant,Mht=V.difference,Cht=V.diffuseColor,Rht=V.directPointLight,Iht=V.directionToColor,Pht=V.directionToFaceDirection,Lht=V.dispersion,Dht=V.distance,Nht=V.div,Fht=V.dot,Bht=V.drawIndex,Oht=V.dynamicBufferAttribute,Uht=V.element,kht=V.emissive,zht=V.equal,Vht=V.equirectDirection,Ght=V.equirectUV,Soe=V.exp,qht=V.exp2,Hht=V.exponentialHeightFogFactor,Wht=V.expression,jht=V.faceDirection,Xht=V.faceForward,$ht=V.faceforward,Toe=V.float,Yht=V.floatBitsToInt,Zht=V.floatBitsToUint,Kht=V.floor,Qht=V.fog,Jht=V.fract,eft=V.frameGroup,tft=V.frameId,nft=V.frontFacing,ift=V.fwidth,rft=V.gain,sft=V.gapSize,oft=V.getConstNodeType,aft=V.getCurrentStack,lft=V.getDirection,cft=V.getDistanceAttenuation,uft=V.getGeometryRoughness,hft=V.getNormalFromDepth,fft=V.interleavedGradientNoise,dft=V.vogelDiskSample,pft=V.getParallaxCorrectNormal,mft=V.getRoughness,Aft=V.getScreenPosition,gft=V.getShIrradianceAt,vft=V.getShadowMaterial,_ft=V.getShadowRenderObjectFunction,xft=V.getTextureIndex,yft=V.getViewPosition,bft=V.globalId,wft=V.glsl,Sft=V.glslFn,Tft=V.grayscale,Eft=V.greaterThan,Mft=V.greaterThanEqual,Cft=V.hash,Rft=V.highpModelNormalViewMatrix,Ift=V.highpModelViewMatrix,Pft=V.hue,Lft=V.increment,Dft=V.incrementBefore,Nft=V.instance,Eoe=V.instanceIndex,Fft=V.instancedArray,Bft=V.instancedBufferAttribute,Oft=V.instancedDynamicBufferAttribute,Uft=V.instancedMesh,kft=V.int,zft=V.intBitsToFloat,Vft=V.inverse,Gft=V.inverseSqrt,qft=V.inversesqrt,Hft=V.invocationLocalIndex,Wft=V.invocationSubgroupIndex,jft=V.ior,Xft=V.iridescence,$ft=V.iridescenceIOR,Yft=V.iridescenceThickness,Zft=V.ivec2,Kft=V.ivec3,Qft=V.ivec4,Jft=V.js,edt=V.label,tdt=V.length,ndt=V.lengthSq,idt=V.lessThan,rdt=V.lessThanEqual,sdt=V.lightPosition,odt=V.lightProjectionUV,adt=V.lightShadowMatrix,ldt=V.lightTargetDirection,cdt=V.lightTargetPosition,udt=V.lightViewPosition,hdt=V.lightingContext,fdt=V.lights,ddt=V.linearDepth,pdt=V.linearToneMapping,mdt=V.localId,Adt=V.log,gdt=V.log2,vdt=V.logarithmicDepthToViewZ,_dt=V.luminance,xdt=V.mat2,ydt=V.mat3,bdt=V.mat4,wdt=V.matcapUV,Sdt=V.materialAO,Tdt=V.materialAlphaTest,Edt=V.materialAnisotropy,Mdt=V.materialAnisotropyVector,Cdt=V.materialAttenuationColor,Rdt=V.materialAttenuationDistance,Idt=V.materialClearcoat,Pdt=V.materialClearcoatNormal,Ldt=V.materialClearcoatRoughness,Ddt=V.materialColor,Ndt=V.materialDispersion,Fdt=V.materialEmissive,Bdt=V.materialEnvIntensity,Odt=V.materialEnvRotation,Udt=V.materialIOR,kdt=V.materialIridescence,zdt=V.materialIridescenceIOR,Vdt=V.materialIridescenceThickness,Gdt=V.materialLightMap,qdt=V.materialLineDashOffset,Hdt=V.materialLineDashSize,Wdt=V.materialLineGapSize,jdt=V.materialLineScale,Xdt=V.materialLineWidth,$dt=V.materialMetalness,Ydt=V.materialNormal,Zdt=V.materialOpacity,Kdt=V.materialPointSize,Qdt=V.materialReference,Jdt=V.materialReflectivity,ept=V.materialRefractionRatio,tpt=V.materialRotation,npt=V.materialRoughness,ipt=V.materialSheen,rpt=V.materialSheenRoughness,spt=V.materialShininess,opt=V.materialSpecular,apt=V.materialSpecularColor,lpt=V.materialSpecularIntensity,cpt=V.materialSpecularStrength,upt=V.materialThickness,hpt=V.materialTransmission,fpt=V.max,dpt=V.maxMipLevel,ppt=V.mediumpModelViewMatrix,mpt=V.metalness,Apt=V.min,gpt=V.mix,vpt=V.mixElement,_pt=V.mod,xpt=V.modelDirection,ypt=V.modelNormalMatrix,bpt=V.modelPosition,wpt=V.modelRadius,Spt=V.modelScale,Tpt=V.modelViewMatrix,Ept=V.modelViewPosition,Mpt=V.modelViewProjection,Cpt=V.modelWorldMatrix,Rpt=V.modelWorldMatrixInverse,Ipt=V.morphReference,Ppt=V.mrt,Lpt=V.mul,Dpt=V.mx_aastep,Npt=V.mx_add,Fpt=V.mx_atan2,Bpt=V.mx_cell_noise_float,Opt=V.mx_contrast,Upt=V.mx_divide,kpt=V.mx_fractal_noise_float,zpt=V.mx_fractal_noise_vec2,Vpt=V.mx_fractal_noise_vec3,Gpt=V.mx_fractal_noise_vec4,qpt=V.mx_frame,Hpt=V.mx_heighttonormal,Wpt=V.mx_hsvtorgb,jpt=V.mx_ifequal,Xpt=V.mx_ifgreater,$pt=V.mx_ifgreatereq,Ypt=V.mx_invert,Zpt=V.mx_modulo,Kpt=V.mx_multiply,Qpt=V.mx_noise_float,Jpt=V.mx_noise_vec3,e0t=V.mx_noise_vec4,t0t=V.mx_place2d,n0t=V.mx_power,i0t=V.mx_ramp4,r0t=V.mx_ramplr,s0t=V.mx_ramptb,o0t=V.mx_rgbtohsv,a0t=V.mx_rotate2d,l0t=V.mx_rotate3d,c0t=V.mx_safepower,u0t=V.mx_separate,h0t=V.mx_splitlr,f0t=V.mx_splittb,d0t=V.mx_srgb_texture_to_lin_rec709,p0t=V.mx_subtract,m0t=V.mx_timer,A0t=V.mx_transform_uv,g0t=V.mx_unifiednoise2d,v0t=V.mx_unifiednoise3d,_0t=V.mx_worley_noise_float,x0t=V.mx_worley_noise_vec2,y0t=V.mx_worley_noise_vec3,Moe=V.negate,b0t=V.negateOnBackSide,w0t=V.neutralToneMapping,S0t=V.nodeArray,T0t=V.nodeImmutable,E0t=V.nodeObject,M0t=V.nodeObjectIntent,C0t=V.nodeObjects,R0t=V.nodeProxy,I0t=V.nodeProxyIntent,P0t=V.normalFlat,L0t=V.normalGeometry,D0t=V.normalLocal,N0t=V.normalMap,F0t=V.normalView,B0t=V.normalViewGeometry,O0t=V.normalWorld,U0t=V.normalWorldGeometry,k0t=V.normalize,z0t=V.not,V0t=V.notEqual,G0t=V.numWorkgroups,q0t=V.objectDirection,H0t=V.objectGroup,W0t=V.objectPosition,j0t=V.objectRadius,X0t=V.objectScale,$0t=V.objectViewPosition,Y0t=V.objectWorldMatrix,Z0t=V.OnBeforeObjectUpdate,K0t=V.OnBeforeMaterialUpdate,Q0t=V.OnObjectUpdate,J0t=V.OnMaterialUpdate,emt=V.oneMinus,tmt=V.or,nmt=V.orthographicDepthToViewZ,imt=V.oscSawtooth,rmt=V.oscSine,smt=V.oscSquare,omt=V.oscTriangle,amt=V.output,lmt=V.outputStruct,cmt=V.overloadingFn,umt=V.overrideNode,hmt=V.overrideNodes,fmt=V.packHalf2x16,dmt=V.packSnorm2x16,pmt=V.packUnorm2x16,mmt=V.packNormalToRGB,Amt=V.parabola,gmt=V.parallaxDirection,vmt=V.parallaxUV,_mt=V.parameter,xmt=V.pass,ymt=V.passTexture,bmt=V.pcurve,wmt=V.perspectiveDepthToViewZ,Smt=V.pmremTexture,Tmt=V.pointShadow,Emt=V.pointUV,Mmt=V.pointWidth,Cmt=V.positionGeometry,Rmt=V.positionLocal,Imt=V.positionPrevious,Pmt=V.positionView,Lmt=V.positionViewDirection,Dmt=V.positionWorld,Nmt=V.positionWorldDirection,Fmt=V.posterize,Bmt=V.pow,Omt=V.pow2,Umt=V.pow3,kmt=V.pow4,zmt=V.premultiplyAlpha,Vmt=V.property,Gmt=V.radians,qmt=V.rand,Hmt=V.range,Wmt=V.rangeFog,jmt=V.rangeFogFactor,Xmt=V.reciprocal,$mt=V.reference,Ymt=V.referenceBuffer,Zmt=V.reflect,Kmt=V.reflectVector,Qmt=V.reflectView,Jmt=V.reflector,eAt=V.refract,tAt=V.refractVector,nAt=V.refractView,iAt=V.reinhardToneMapping,rAt=V.remap,sAt=V.remapClamp,oAt=V.renderGroup,aAt=V.renderOutput,lAt=V.rendererReference,cAt=V.replaceDefaultUV,uAt=V.rotate,hAt=V.rotateUV,fAt=V.roughness,dAt=V.round,pAt=V.rtt,mAt=V.sRGBTransferEOTF,AAt=V.sRGBTransferOETF,gAt=V.sample,vAt=V.sampler,_At=V.samplerComparison,xAt=V.saturate,yAt=V.saturation,bAt=V.screen,wAt=V.screenCoordinate,SAt=V.screenDPR,TAt=V.screenSize,EAt=V.screenUV,MAt=V.select,CAt=V.setCurrentStack,RAt=V.setName,IAt=V.shaderStages,PAt=V.shadow,LAt=V.shadowPositionWorld,DAt=V.shapeCircle,NAt=V.sharedUniformGroup,FAt=V.sheen,BAt=V.sheenRoughness,OAt=V.shiftLeft,UAt=V.shiftRight,kAt=V.shininess,zAt=V.sign,Coe=V.sin,VAt=V.sinh,GAt=V.sinc,qAt=V.skinning,HAt=V.smoothstep,WAt=V.smoothstepElement,jAt=V.specularColor,XAt=V.specularF90,$At=V.spherizeUV,YAt=V.split,ZAt=V.spritesheetUV,Roe=V.sqrt,KAt=V.stack,QAt=V.step,JAt=V.stepElement,Ioe=V.storage,egt=V.storageBarrier,tgt=V.storageTexture,ngt=V.storageTexture3D,igt=V.struct,rgt=V.sub,sgt=V.subgroupAdd,ogt=V.subgroupAll,agt=V.subgroupAnd,lgt=V.subgroupAny,cgt=V.subgroupBallot,ugt=V.subgroupBroadcast,hgt=V.subgroupBroadcastFirst,fgt=V.subBuild,dgt=V.subgroupElect,pgt=V.subgroupExclusiveAdd,mgt=V.subgroupExclusiveMul,Agt=V.subgroupInclusiveAdd,ggt=V.subgroupInclusiveMul,vgt=V.subgroupIndex,_gt=V.subgroupMax,xgt=V.subgroupMin,ygt=V.subgroupMul,bgt=V.subgroupOr,wgt=V.subgroupShuffle,Sgt=V.subgroupShuffleDown,Tgt=V.subgroupShuffleUp,Egt=V.subgroupShuffleXor,Mgt=V.subgroupSize,Cgt=V.subgroupXor,Rgt=V.tan,Igt=V.tanh,Pgt=V.tangentGeometry,Lgt=V.tangentLocal,Dgt=V.tangentView,Ngt=V.tangentWorld,Fgt=V.texture,Bgt=V.texture3D,Ogt=V.textureBarrier,Ugt=V.textureBicubic,kgt=V.textureBicubicLevel,zgt=V.textureCubeUV,Vgt=V.textureLoad,Ggt=V.textureSize,qgt=V.textureLevel,Hgt=V.textureStore,Wgt=V.thickness,jgt=V.time,Xgt=V.toneMapping,$gt=V.toneMappingExposure,Ygt=V.toonOutlinePass,Zgt=V.transformDirection,Kgt=V.transformNormal,Qgt=V.transformNormalByInverseViewMatrix,Jgt=V.transformNormalByViewMatrix,e1t=V.transformNormalToView,t1t=V.transformedClearcoatNormalView,n1t=V.transformedNormalView,i1t=V.transformedNormalWorld,r1t=V.transmission,s1t=V.transpose,o1t=V.triNoise3D,a1t=V.triplanarTexture,l1t=V.triplanarTextures,c1t=V.trunc,u1t=V.uint,h1t=V.uintBitsToFloat,Poe=V.uniform,f1t=V.uniformArray,d1t=V.uniformCubeTexture,p1t=V.uniformGroup,m1t=V.uniformFlow,A1t=V.uniformTexture,g1t=V.unpackHalf2x16,v1t=V.unpackSnorm2x16,_1t=V.unpackUnorm2x16,x1t=V.unpackRGBToNormal,y1t=V.unpremultiplyAlpha,b1t=V.userData,w1t=V.uv,S1t=V.uvec2,T1t=V.uvec3,E1t=V.uvec4,M1t=V.varying,C1t=V.varyingProperty,R1t=V.vec2,I1t=V.vec3,P1t=V.vec4,L1t=V.vectorComponents,D1t=V.velocity,N1t=V.vertexColor,F1t=V.vertexIndex,B1t=V.vertexStage,O1t=V.vibrance,U1t=V.viewZToLogarithmicDepth,k1t=V.viewZToOrthographicDepth,z1t=V.viewZToPerspectiveDepth,V1t=V.viewZToReversedOrthographicDepth,G1t=V.viewZToReversedPerspectiveDepth,q1t=V.viewport,H1t=V.viewportCoordinate,W1t=V.viewportDepthTexture,j1t=V.viewportLinearDepth,X1t=V.viewportMipTexture,$1t=V.viewportOpaqueMipTexture,Y1t=V.viewportResolution,Z1t=V.viewportSafeUV,K1t=V.viewportSharedTexture,Q1t=V.viewportSize,J1t=V.viewportTexture,evt=V.viewportUV,tvt=V.wgsl,nvt=V.wgslFn,ivt=V.workgroupArray,rvt=V.workgroupBarrier,svt=V.workgroupId,ovt=V.workingToColorSpace,avt=V.xor;var Loe=new ka,XI=new re,Cx=class extends ub{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";let e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new Ln(e,3)),this.setAttribute("uv",new Ln(t,2))}applyMatrix4(e){let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let n=new Bh(t,6,1);return this.setAttribute("instanceStart",new Vo(n,3,0)),this.setAttribute("instanceEnd",new Vo(n,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let n=new Bh(t,6,1);return this.setAttribute("instanceColorStart",new Vo(n,3,0)),this.setAttribute("instanceColorEnd",new Vo(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new K2(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ka);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Loe.setFromBufferAttribute(t),this.boundingBox.union(Loe))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new bl),this.boundingBox===null&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)XI.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(XI)),XI.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(XI));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}};Nt.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Oe},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};Ha.line={uniforms:pg.merge([Nt.common,Nt.fog,Nt.line]),vertexShader:`4704+ ${" ".repeat(a.linePos-1)}^`)),(a.type==="error"?ze:Xe)(c+u)}}}_getBlending(e){let t,n,r=e.blending,s=e.blendSrc,o=e.blendDst,a=e.blendEquation;if(r===Dd){let l=e.blendSrcAlpha!==null?e.blendSrcAlpha:s,c=e.blendDstAlpha!==null?e.blendDstAlpha:o,u=e.blendEquationAlpha!==null?e.blendEquationAlpha:a;t={srcFactor:this._getBlendFactor(s),dstFactor:this._getBlendFactor(o),operation:this._getBlendOperation(a)},n={srcFactor:this._getBlendFactor(l),dstFactor:this._getBlendFactor(c),operation:this._getBlendOperation(u)}}else{let l=e.premultipliedAlpha,c=(u,f,d,A)=>{t={srcFactor:u,dstFactor:f,operation:Bg.Add},n={srcFactor:d,dstFactor:A,operation:Bg.Add}};if(l)switch(r){case Ts:c(ui.One,ui.OneMinusSrcAlpha,ui.One,ui.OneMinusSrcAlpha);break;case Dh:c(ui.One,ui.One,ui.One,ui.One);break;case Nh:c(ui.Zero,ui.OneMinusSrc,ui.Zero,ui.One);break;case Fh:c(ui.Dst,ui.OneMinusSrcAlpha,ui.Zero,ui.One);break}else switch(r){case Ts:c(ui.SrcAlpha,ui.OneMinusSrcAlpha,ui.One,ui.OneMinusSrcAlpha);break;case Dh:c(ui.SrcAlpha,ui.One,ui.One,ui.One);break;case Nh:ze(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case Fh:ze(`WebGPURenderer: "MultiplyBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break}}if(t!==void 0&&n!==void 0)return{color:t,alpha:n};ze("WebGPURenderer: Invalid blending: ",r)}_getBlendFactor(e){let t;switch(e){case Nu:t=ui.Zero;break;case mb:t=ui.One;break;case Ab:t=ui.Src;break;case gb:t=ui.OneMinusSrc;break;case Jp:t=ui.SrcAlpha;break;case e0:t=ui.OneMinusSrcAlpha;break;case xb:t=ui.Dst;break;case yb:t=ui.OneMinusDst;break;case vb:t=ui.DstAlpha;break;case _b:t=ui.OneMinusDstAlpha;break;case bb:t=ui.SrcAlphaSaturated;break;case MMe:t=ui.Constant;break;case CMe:t=ui.OneMinusConstant;break;default:ze("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t,n=e.stencilFunc;switch(n){case oF:t=jo.Never;break;case D2:t=jo.Always;break;case aF:t=jo.Less;break;case cF:t=jo.LessEqual;break;case lF:t=jo.Equal;break;case fF:t=jo.GreaterEqual;break;case uF:t=jo.Greater;break;case hF:t=jo.NotEqual;break;default:ze("WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case bd:t=nm.Keep;break;case J8:t=nm.Zero;break;case eF:t=nm.Replace;break;case sF:t=nm.Invert;break;case tF:t=nm.IncrementClamp;break;case nF:t=nm.DecrementClamp;break;case iF:t=nm.IncrementWrap;break;case rF:t=nm.DecrementWrap;break;default:ze("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case oo:t=Bg.Add;break;case db:t=Bg.Subtract;break;case pb:t=Bg.ReverseSubtract;break;case DM:t=Bg.Min;break;case NM:t=Bg.Max;break;default:ze("WebGPUPipelineUtils: Blend equation not supported.",e)}return t}_getPrimitiveState(e,t,n){let r={},s=this.backend.utils;r.topology=s.getPrimitiveTopology(e,n),t.index!==null&&e.isLine===!0&&e.isLineSegments!==!0&&(r.stripIndexFormat=t.index.array instanceof Uint16Array?sP.Uint16:sP.Uint32);let o=n.side===mi;return e.isMesh&&e.matrixWorld.determinantAffine()<0&&(o=!o),r.frontFace=o===!0?Wte.CW:Wte.CCW,r.cullMode=n.side===vr?jte.None:jte.Back,r}_getColorWriteMask(e){return e.colorWrite===!0?Xte.All:Xte.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=jo.Always;else{let n=this.backend.parameters.reversedDepthBuffer?Ob[e.depthFunc]:e.depthFunc;switch(n){case LA:t=jo.Never;break;case DA:t=jo.Always;break;case NA:t=jo.Less;break;case Ch:t=jo.LessEqual;break;case FA:t=jo.Equal;break;case BA:t=jo.GreaterEqual;break;case OA:t=jo.Greater;break;case UA:t=jo.NotEqual;break;default:ze("WebGPUPipelineUtils: Invalid depth function.",n)}}return t}},fP=class{constructor(){this.label="",this.type=void 0,this.count=0}reset(){this.label="",this.type=void 0,this.count=0}},hf=new xm,qIe=new o1,Qw=new fP,J9=class extends iP{constructor(e,t,n=2048){super(n),this.device=e,this.type=t,Qw.label=`queryset_global_timestamp_${t}`,Qw.type="timestamp",Qw.count=this.maxQueries,this.querySet=this.device.createQuerySet(Qw),Qw.reset();let r=this.maxQueries*8;hf.label=`buffer_timestamp_resolve_${t}`,hf.size=r,hf.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,this.resolveBuffer=this.device.createBuffer(hf),hf.reset(),hf.label=`buffer_timestamp_result_${t}`,hf.size=r,hf.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,this.resultBuffer=this.device.createBuffer(hf),hf.reset()}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return ni(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;let t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryOffsets.set(e,t),t}async resolveQueriesAsync(){if(!this.trackTimestamp||this.currentQueryIndex===0||this.isDisposed)return this.lastValue;if(this.pendingResolve)return this.pendingResolve;this.pendingResolve=this._resolveQueries();try{return await this.pendingResolve}finally{this.pendingResolve=null}}async _resolveQueries(){if(this.isDisposed)return this.lastValue;try{if(this.resultBuffer.mapState!=="unmapped")return this.lastValue;let e=new Map(this.queryOffsets),t=this.currentQueryIndex,n=t*8;this.currentQueryIndex=0,this.queryOffsets.clear();let r=this.device.createCommandEncoder(qIe);r.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),r.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);let s=r.finish();if(mf(this.device,s),this.resultBuffer.mapState!=="unmapped")return this.lastValue;if(await this.resultBuffer.mapAsync(GPUMapMode.READ,0,n),this.isDisposed)return this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue;let o=new BigUint64Array(this.resultBuffer.getMappedRange(0,n)),a={},l=[];for(let[u,f]of e){let d=u.match(/^(.*):f(\d+)$/),A=parseInt(d[2]);l.includes(A)===!1&&l.push(A),a[A]===void 0&&(a[A]=0);let y=o[f],w=o[f+1],S=Number(w-y)/1e6;this.timestamps.set(u,S),a[A]+=S}let c=a[l[l.length-1]];return this.resultBuffer.unmap(),this.lastValue=c,this.frames=l,c}catch(e){return ze("Error resolving queries:",e),this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue}}async dispose(){if(!this.isDisposed){if(this.isDisposed=!0,this.pendingResolve)try{await this.pendingResolve}catch(e){ze("Error waiting for pending resolve:",e)}if(this.resultBuffer&&this.resultBuffer.mapState==="mapped")try{this.resultBuffer.unmap()}catch(e){ze("Error unmapping buffer:",e)}this.querySet&&(this.querySet.destroy(),this.querySet=null),this.resolveBuffer&&(this.resolveBuffer.destroy(),this.resolveBuffer=null),this.resultBuffer&&(this.resultBuffer.destroy(),this.resultBuffer=null),this.queryOffsets.clear(),this.pendingResolve=null}}},ez=class{constructor(){this.label="",this.timestampWrites=void 0}reset(){this.label="",this.timestampWrites=void 0}},rx=class{constructor(){this.view=null,this.depthLoadOp=void 0,this.depthStoreOp=void 0,this.depthClearValue=void 0,this.depthReadOnly=!1,this.stencilLoadOp=void 0,this.stencilStoreOp=void 0,this.stencilClearValue=0,this.stencilReadOnly=!1}reset(){this.view=null,this.depthLoadOp=void 0,this.depthStoreOp=void 0,this.depthClearValue=void 0,this.depthReadOnly=!1,this.stencilLoadOp=void 0,this.stencilStoreOp=void 0,this.stencilClearValue=0,this.stencilReadOnly=!1}},tz=class{constructor(){this.querySet=null,this.beginningOfPassWriteIndex=void 0,this.endOfPassWriteIndex=void 0}reset(){this.querySet=null,this.beginningOfPassWriteIndex=void 0,this.endOfPassWriteIndex=void 0}},qu={r:0,g:0,b:0,a:1},lc=new xm,Ya=new o1,WR=new ez,Jw=new fP,jR=new uP,XR=new tz,Zc=new _x,ff=new _x,Er=new IS,Wd=new hP,nz=class extends nP{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=e.alpha===void 0?!0:e.alpha,this.parameters.requiredLimits=e.requiredLimits===void 0?{}:e.requiredLimits,this.compatibilityMode=null,this.device=null,this.defaultRenderPassdescriptor=null,this.utils=new D9(this),this.attributeUtils=new j9(this),this.bindingUtils=new $9(this),this.capabilities=new Y9(this),this.pipelineUtils=new Q9(this),this.textureUtils=new V9(this),this.occludedResolveCache=new Map;let t=typeof navigator>"u"?!0:/Android/.test(navigator.userAgent)===!1;this._compatibility={[Bd.TEXTURE_COMPARE]:t}}async init(e){await super.init(e);let t=this.parameters,n;if(t.device===void 0){let r={powerPreference:t.powerPreference,featureLevel:"compatibility",xrCompatible:e.xr.enabled},s=typeof navigator<"u"?await navigator.gpu.requestAdapter(r):null;if(s===null)throw new Error("THREE.WebGPUBackend: Unable to create WebGPU adapter.");let o=Object.values(oP),a=[];for(let c of o)s.features.has(c)&&a.push(c);let l={requiredFeatures:a,requiredLimits:t.requiredLimits};n=await s.requestDevice(l)}else n=t.device;this.compatibilityMode=!n.features.has("core-features-and-limits"),this.compatibilityMode&&(e._samples=0),n.lost.then(r=>{if(r.reason==="destroyed")return;let s={api:"WebGPU",message:r.message||"Unknown reason",reason:r.reason||null,originalEvent:r};e.onDeviceLost(s)}),n.onuncapturederror=r=>{let s=r.error,o=s&&s.constructor?s.constructor.name:"GPUError",a=s&&s.message||"Unknown uncaptured GPU error";e.onError({api:"WebGPU",type:o,message:a,originalEvent:r})},this.device=n,this.trackTimestamp=this.trackTimestamp&&this.hasFeature(oP.TimestampQuery),this.updateSize()}setXRRenderTargetTextures(e,t,n=null){this.set(e.texture,{texture:t,format:t.format,externalTexture:!0,xrViewDescriptors:n,initialized:!0})}get context(){let e=this.renderer.getCanvasTarget(),t=this.get(e),n=t.context;if(n===void 0){let r=this.parameters;e.isDefaultCanvasTarget===!0&&r.context!==void 0?n=r.context:n=e.domElement.getContext("webgpu"),"setAttribute"in e.domElement&&e.domElement.setAttribute("data-engine",`three.js r${"185"} webgpu`);let s=r.alpha?"premultiplied":"opaque",o=r.outputType===Wi?"extended":"standard";n.configure({device:this.device,format:this.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:s,toneMapping:{mode:o}}),t.context=n}return n}get coordinateSystem(){return xl}get hasTimestamp(){return!0}async getArrayBufferAsync(e,t=null,n=0,r=-1){return await this.attributeUtils.getArrayBufferAsync(e,t,n,r)}getContext(){return this.context}_getDefaultRenderPassDescriptor(){let e=this.renderer,t=e.getCanvasTarget(),n=this.get(t),r=e.currentSamples,s=n.descriptor;if(s===void 0||n.samples!==r){if(s=new Kg,s.colorAttachments.push(new Zg),e.depth===!0||e.stencil===!0){let l=new rx;l.view=this.textureUtils.getDepthBuffer(e.depth,e.stencil).createView(),s.depthStencilAttachment=l}let a=s.colorAttachments[0];r>0?a.view=this.textureUtils.getColorBuffer().createView():a.resolveTarget=void 0,n.descriptor=s,n.samples=r}let o=s.colorAttachments[0];return r>0?o.resolveTarget=this.context.getCurrentTexture().createView():o.view=this.context.getCurrentTexture().createView(),s}_isRenderCameraDepthArray(e){let t=e.camera;return e.depthTexture&&e.depthTexture.isArrayTexture===!0&&t!==null&&t.isArrayCamera===!0}_hasExternalTexture(e){let t=e.textures;if(t===null)return!1;for(let n=0;n<t.length;n++)if(this.get(t[n]).externalTexture===!0)return!0;return!1}_createExternalTextureViews(e,t){let n=[],r=e.camera;if(t.xrViewDescriptors&&r!==null&&r.isArrayCamera===!0)for(let s=0;s<t.xrViewDescriptors.length;s++)n.push({view:t.texture.createView(t.xrViewDescriptors[s]),resolveTarget:void 0,depthSlice:void 0});else n.push({view:t.texture.createView({dimension:Xo.TwoD,baseArrayLayer:e.activeCubeFace,arrayLayerCount:1}),resolveTarget:void 0,depthSlice:void 0});return n}_getRenderPassDescriptor(e,t={}){let n=e.renderTarget,r=this.get(n),s=this._hasExternalTexture(e),o=r.descriptors;(o===void 0||r.width!==n.width||r.height!==n.height||r.samples!==n.samples||s)&&(o={},r.descriptors=o);let a=e.getCacheKey(),l=o[a];if(l===void 0||s){let u=e.textures,f=[],d,A=this._isRenderCameraDepthArray(e);for(let w=0;w<u.length;w++){let S=this.get(u[w]);if(S.externalTexture===!0){f.push(...this._createExternalTextureViews(e,S));continue}if(Er.label=`colorAttachment_${w}`,Er.baseMipLevel=e.activeMipmapLevel,Er.mipLevelCount=1,Er.baseArrayLayer=e.activeCubeFace,Er.arrayLayerCount=1,Er.dimension=Xo.TwoD,n.isRenderTarget3D)d=e.activeCubeFace,Er.baseArrayLayer=0,Er.dimension=Xo.ThreeD;else if(n.isRenderTarget&&u[w].image.depth>1)if(A===!0){let T=e.camera.cameras;for(let R=0;R<T.length;R++){Er.baseArrayLayer=R,Er.arrayLayerCount=1,Er.dimension=Xo.TwoD;let I=S.texture.createView(Er);f.push({view:I,resolveTarget:void 0,depthSlice:void 0})}}else Er.dimension=Xo.TwoDArray;if(A!==!0){let T=S.texture.createView(Er),R,I;S.msaaTexture!==void 0?(R=S.msaaTexture.createView(),I=T):(R=T,I=void 0),f.push({view:R,resolveTarget:I,depthSlice:d})}Er.reset()}let y=[];for(let w=0;w<f.length;w++){let S=f[w],T=new Zg;T.view=S.view,T.depthSlice=S.depthSlice,T.resolveTarget=S.resolveTarget,y.push(T)}if(l={textureViews:f,colorAttachments:y,descriptor:new Kg},e.depth){let w=this.get(e.depthTexture);(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(Er.dimension=Xo.TwoD,Er.arrayLayerCount=1,Er.baseArrayLayer=e.activeCubeFace);let S=new rx;S.view=w.texture.createView(Er),l.depthStencilAttachment=S,Er.reset()}o[a]=l,r.width=n.width,r.height=n.height,r.samples=n.samples,r.activeMipmapLevel=e.activeMipmapLevel,r.activeCubeFace=e.activeCubeFace}let c=l.descriptor;c.reset();for(let u=0;u<l.colorAttachments.length;u++){let f=l.colorAttachments[u],d={r:0,g:0,b:0,a:1};u===0&&t.clearValue&&(d=t.clearValue),f.loadOp=t.loadOp||Fi.Load,f.storeOp=t.storeOp||Za.Store,f.clearValue=d,c.colorAttachments.push(f)}return l.depthStencilAttachment&&(c.depthStencilAttachment=l.depthStencilAttachment),c}beginRender(e){let t=this.get(e),n=this.device,r=e.occlusionQueryCount,s;r>0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,Jw.label=`occlusionQuerySet_${e.id}`,Jw.type="occlusion",Jw.count=r,s=n.createQuerySet(Jw),Jw.reset(),t.occlusionQuerySet=s,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(r),t.lastOcclusionObject=null);let o;e.textures===null?o=this._getDefaultRenderPassDescriptor():o=this._getRenderPassDescriptor(e,{loadOp:Fi.Load}),this.initTimestampQuery(Hc.RENDER,this.getTimestampUID(e),o),o.occlusionQuerySet=s;let a=o.depthStencilAttachment;if(e.textures!==null){let c=o.colorAttachments;for(let u=0;u<c.length;u++){let f=c[u];e.clearColor?(u===0?f.clearValue=e.clearColorValue:(qu.r=0,qu.g=0,qu.b=0,qu.a=1,f.clearValue=qu),f.loadOp=Fi.Clear):f.loadOp=Fi.Load,f.storeOp=Za.Store}}else{let c=o.colorAttachments[0];e.clearColor?(c.clearValue=e.clearColorValue,c.loadOp=Fi.Clear):c.loadOp=Fi.Load,c.storeOp=Za.Store}e.depth&&(e.clearDepth?(a.depthClearValue=e.clearDepthValue,a.depthLoadOp=Fi.Clear):a.depthLoadOp=Fi.Load,a.depthStoreOp=Za.Store),e.stencil&&(e.clearStencil?(a.stencilClearValue=e.clearStencilValue,a.stencilLoadOp=Fi.Clear):a.stencilLoadOp=Fi.Load,a.stencilStoreOp=Za.Store),Ya.label="renderContext_"+e.id;let l=n.createCommandEncoder(Ya);if(Ya.reset(),this._isRenderCameraDepthArray(e)===!0){let c=e.camera.cameras;!t.layerDescriptors||t.layerDescriptors.length!==c.length?this._createArrayCameraLayerDescriptors(e,t,o,c):this._updateArrayCameraLayerDescriptors(e,t,c),t.bundleEncoders=[],t.bundleSets=[];for(let u=0;u<c.length;u++){let f=this.pipelineUtils.createBundleEncoder(e,"renderBundleArrayCamera_"+u),d={attributes:{},bindingGroups:[],pipeline:null,index:null};t.bundleEncoders.push(f),t.bundleSets.push(d)}t.currentPass=null}else{let c=l.beginRenderPass(o);t.currentPass=c,e.viewport&&this.updateViewport(e),e.scissor&&this.updateScissor(e)}t.descriptor=o,t.encoder=l,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.renderBundles=[]}_createArrayCameraLayerDescriptors(e,t,n,r){let s=n.depthStencilAttachment;t.layerDescriptors=[];let o=this.get(e.depthTexture);o.viewCache||(o.viewCache=[]);for(let a=0;a<r.length;a++){let l=n.colorAttachments[0],c=new Zg;c.view=n.colorAttachments[a].view,c.depthSlice=l.depthSlice,c.resolveTarget=l.resolveTarget,c.loadOp=l.loadOp,c.storeOp=l.storeOp,c.clearValue=l.clearValue;let u=new Kg;if(u.label=n.label,u.occlusionQuerySet=n.occlusionQuerySet,u.timestampWrites=n.timestampWrites,u.colorAttachments.push(c),n.depthStencilAttachment){let f=a;o.viewCache[f]||(Er.dimension=Xo.TwoD,Er.baseArrayLayer=a,Er.arrayLayerCount=1,o.viewCache[f]=o.texture.createView(Er),Er.reset());let d=new rx;d.view=o.viewCache[f],d.depthLoadOp=s.depthLoadOp||Fi.Clear,d.depthStoreOp=s.depthStoreOp||Za.Store,d.depthClearValue=s.depthClearValue||1,e.stencil&&(d.stencilLoadOp=s.stencilLoadOp,d.stencilStoreOp=s.stencilStoreOp,d.stencilClearValue=s.stencilClearValue),u.depthStencilAttachment=d}else{let f=new rx;f.view=s.view,f.depthLoadOp=s.depthLoadOp,f.depthStoreOp=s.depthStoreOp,f.depthClearValue=s.depthClearValue,f.depthReadOnly=s.depthReadOnly,f.stencilLoadOp=s.stencilLoadOp,f.stencilStoreOp=s.stencilStoreOp,f.stencilClearValue=s.stencilClearValue,f.stencilReadOnly=s.stencilReadOnly,u.depthStencilAttachment=f}t.layerDescriptors.push(u)}}_updateArrayCameraLayerDescriptors(e,t,n){for(let r=0;r<n.length;r++){let s=t.layerDescriptors[r];if(s.depthStencilAttachment){let o=s.depthStencilAttachment;e.depth&&(e.clearDepth?(o.depthClearValue=e.clearDepthValue,o.depthLoadOp=Fi.Clear):o.depthLoadOp=Fi.Load),e.stencil&&(e.clearStencil?(o.stencilClearValue=e.clearStencilValue,o.stencilLoadOp=Fi.Clear):o.stencilLoadOp=Fi.Load)}}}finishRender(e){let t=this.get(e),n=e.occlusionQueryCount;t.renderBundles.length>0&&t.currentPass.executeBundles(t.renderBundles),n>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery();let r=t.encoder;if(this._isRenderCameraDepthArray(e)===!0){let s=[];for(let o=0;o<t.bundleEncoders.length;o++){let a=t.bundleEncoders[o];s.push(a.finish())}for(let o=0;o<t.layerDescriptors.length;o++)if(o<s.length){let a=t.layerDescriptors[o],l=r.beginRenderPass(a);if(e.viewport){let{x:c,y:u,width:f,height:d,minDepth:A,maxDepth:y}=e.viewportValue;l.setViewport(c,u,f,d,A,y)}if(e.scissor){let{x:c,y:u,width:f,height:d}=e.scissorValue;l.setScissorRect(c,u,f,d)}l.executeBundles([s[o]]),l.end()}}else t.currentPass&&t.currentPass.end();if(n>0){let s=n*8,o=this.occludedResolveCache.get(s);o===void 0&&(lc.size=s,lc.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,o=this.device.createBuffer(lc),lc.reset(),this.occludedResolveCache.set(s,o)),lc.size=s,lc.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let a=this.device.createBuffer(lc);lc.reset(),t.encoder.resolveQuerySet(t.occlusionQuerySet,0,n,o,0),t.encoder.copyBufferToBuffer(o,0,a,0,s),t.occlusionQueryBuffer=a,this.resolveOccludedAsync(e)}if(mf(this.device,t.encoder.finish()),e.textures!==null){let s=e.textures;for(let o=0;o<s.length;o++){let a=s[o];a.generateMipmaps===!0&&this.textureUtils.generateMipmaps(a)}}}isOccluded(e,t){let n=this.get(e);return n.occluded&&n.occluded.has(t)}async resolveOccludedAsync(e){let t=this.get(e),{currentOcclusionQueryBuffer:n,currentOcclusionQueryObjects:r}=t;if(n&&r){let s=new WeakSet;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueryBuffer=null,await n.mapAsync(GPUMapMode.READ);let o=n.getMappedRange(),a=new BigUint64Array(o);for(let l=0;l<r.length;l++)a[l]===BigInt(0)&&s.add(r[l]);n.destroy(),t.occluded=s}}updateViewport(e){let{currentPass:t}=this.get(e),{x:n,y:r,width:s,height:o,minDepth:a,maxDepth:l}=e.viewportValue;t.setViewport(n,r,s,o,a,l)}updateScissor(e){let{currentPass:t}=this.get(e),{x:n,y:r,width:s,height:o}=e.scissorValue;t.setScissorRect(n,r,s,o)}getClearColor(){let e=super.getClearColor();return this.renderer.alpha===!0&&(e.r*=e.a,e.g*=e.a,e.b*=e.a),e}clear(e,t,n,r=null){let s=this.device,o=this.renderer,a=[],l,c,u;if(e){let A=this.getClearColor();qu.r=A.r,qu.g=A.g,qu.b=A.b,qu.a=A.a}if(r===null){c=o.depth,u=o.stencil;let A=this._getDefaultRenderPassDescriptor();if(e){a=A.colorAttachments;let y=a[0];y.clearValue=qu,y.loadOp=Fi.Clear,y.storeOp=Za.Store}(c||u)&&(l=A.depthStencilAttachment)}else{c=r.depth,u=r.stencil;let A={loadOp:e?Fi.Clear:Fi.Load,clearValue:e?qu:void 0};c&&(A.depthLoadOp=t?Fi.Clear:Fi.Load,A.depthClearValue=t?o.getClearDepth():void 0,A.depthStoreOp=Za.Store),u&&(A.stencilLoadOp=n?Fi.Clear:Fi.Load,A.stencilClearValue=n?o.getClearStencil():void 0,A.stencilStoreOp=Za.Store);let y=this._getRenderPassDescriptor(r,A);a=y.colorAttachments,l=y.depthStencilAttachment}c&&l&&(t?(l.depthLoadOp=Fi.Clear,l.depthClearValue=o.getClearDepth(),l.depthStoreOp=Za.Store):(l.depthLoadOp=Fi.Load,l.depthStoreOp=Za.Store)),u&&l&&(n?(l.stencilLoadOp=Fi.Clear,l.stencilClearValue=o.getClearStencil(),l.stencilStoreOp=Za.Store):(l.stencilLoadOp=Fi.Load,l.stencilStoreOp=Za.Store)),Ya.label="clear";let f=s.createCommandEncoder(Ya);Ya.reset(),f.beginRenderPass({colorAttachments:a,depthStencilAttachment:l}).end(),mf(s,f.finish())}beginCompute(e){let t=this.get(e),n="computeGroup_"+e.id;WR.label=n,Ya.label=n,this.initTimestampQuery(Hc.COMPUTE,this.getTimestampUID(e),WR),t.cmdEncoderGPU=this.device.createCommandEncoder(Ya),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(WR),t.currentPipeline=null,Ya.reset(),WR.reset()}compute(e,t,n,r,s=null){let o=this.get(t),a=this.get(e),{passEncoderGPU:l}=a,c=this.get(r).pipeline;a.currentPipeline!==c&&(l.setPipeline(c),a.currentPipeline=c);for(let u=0,f=n.length;u<f;u++){let d=n[u],A=this.get(d);l.setBindGroup(u,A.group)}if(s===null&&(s=t.dispatchSize||t.count),s&&s.isIndirectStorageBufferAttribute){let u=this.get(s).buffer;l.dispatchWorkgroupsIndirect(u,0);return}if(typeof s=="number"){let u=s;if(o.dispatchSize===void 0||o.count!==u){o.dispatchSize=[0,1,1],o.count=u;let f=t.workgroupSize,d=f[0];for(let w=1;w<f.length;w++)d*=f[w];let A=Math.ceil(u/d),y=this.device.limits.maxComputeWorkgroupsPerDimension;s=[A,1,1],A>y&&(s[0]=Math.min(A,y),s[1]=Math.ceil(A/y)),o.dispatchSize=s}s=o.dispatchSize}l.dispatchWorkgroups(s[0],s[1]||1,s[2]||1)}finishCompute(e){let t=this.get(e);t.passEncoderGPU.end(),mf(this.device,t.cmdEncoderGPU.finish())}_draw(e,t,n,r,s,o,a,l,c){let{object:u,material:f,context:d}=e,A=e.getIndex(),y=A!==null;c.pipeline!==r&&(l.setPipeline(r),c.pipeline=r);let w=c.bindingGroups;for(let S=0,T=s.length;S<T;S++){let R=s[S];if(w[S]!==R.id){let I=this.get(R);l.setBindGroup(S,I.group),w[S]=R.id}}if(y===!0&&c.index!==A){let S=this.get(A).buffer,T=A.array instanceof Uint16Array?sP.Uint16:sP.Uint32;l.setIndexBuffer(S,T),c.index=A}for(let S=0,T=o.length;S<T;S++){let R=o[S];if(c.attributes[S]!==R){let I=this.get(R).buffer;l.setVertexBuffer(S,I),c.attributes[S]=R}}if(d.stencil===!0&&f.stencilWrite===!0&&n.currentStencilRef!==f.stencilRef&&(l.setStencilReference(f.stencilRef),n.currentStencilRef=f.stencilRef),u.isBatchedMesh===!0){let S=u._multiDrawStarts,T=u._multiDrawCounts,R=u._multiDrawCount,I=y===!0?A.array.BYTES_PER_ELEMENT:1;f.wireframe&&(I=u.geometry.attributes.position.count>65535?4:2);for(let P=0;P<R;P++)y===!0?l.drawIndexed(T[P],1,S[P]/I,0,P):l.draw(T[P],1,S[P],P),t.update(u,T[P],1)}else if(y===!0){let{vertexCount:S,instanceCount:T,firstVertex:R}=a,I=e.getIndirect();if(I!==null){let P=this.get(I).buffer,F=e.getIndirectOffset(),D=Array.isArray(F)?F:[F];for(let L=0;L<D.length;L++)l.drawIndexedIndirect(P,D[L])}else l.drawIndexed(S,T,R,0,0);t.update(u,S,T)}else{let{vertexCount:S,instanceCount:T,firstVertex:R}=a,I=e.getIndirect();if(I!==null){let P=this.get(I).buffer,F=e.getIndirectOffset(),D=Array.isArray(F)?F:[F];for(let L=0;L<D.length;L++)l.drawIndirect(P,D[L])}else l.draw(S,T,R,0);t.update(u,S,T)}}draw(e,t){let{object:n,context:r,pipeline:s}=e,o=this.get(r),a=this.get(s),l=a.pipeline;if(a.error===!0)return;let c=e.getDrawParameters();if(c===null)return;let u=e.getBindings(),f=e.getVertexBuffers();if(e.camera.isArrayCamera&&e.camera.cameras.length>0){let d=this.get(e.camera),A=e.camera.cameras,y=e.getBindingGroup("cameraIndex");if(d.indexesGPU===void 0||d.indexesGPU.length!==A.length){let S=this.get(y),T=[],R=new Uint32Array([0,0,0,0]);for(let I=0,P=A.length;I<P;I++){R[0]=I;let{layoutGPU:F}=S.layout,D=this.bindingUtils.createBindGroupIndex(R,F);T.push(D)}d.indexesGPU=T}let w=this.renderer.getPixelRatio();for(let S=0,T=A.length;S<T;S++){let R=A[S];if(n.layers.test(R.layers)){let I=R.viewport,P=o.currentPass,F=o.currentSets,D=o.bundleEncoders!==void 0;if(D){let L=o.bundleEncoders[S],C=o.bundleSets[S];P=L,F=C}if(I&&!D&&P.setViewport(Math.floor(I.x*w),Math.floor(I.y*w),Math.floor(I.width*w),Math.floor(I.height*w),r.viewportValue.minDepth,r.viewportValue.maxDepth),y&&d.indexesGPU){let L=u.indexOf(y);P.setBindGroup(L,d.indexesGPU[S]),F.bindingGroups[L]=y.id}this._draw(e,t,o,l,u,f,c,P,F)}}}else if(o.currentPass){if(o.occlusionQuerySet!==void 0){let d=o.lastOcclusionObject;d!==n&&(d!==null&&d.occlusionTest===!0&&(o.currentPass.endOcclusionQuery(),o.occlusionQueryIndex++),n.occlusionTest===!0&&(o.currentPass.beginOcclusionQuery(o.occlusionQueryIndex),o.occlusionQueryObjects[o.occlusionQueryIndex]=n),o.lastOcclusionObject=n)}this._draw(e,t,o,l,u,f,c,o.currentPass,o.currentSets)}}needsRenderUpdate(e){let t=this.get(e),{object:n,material:r}=e,s=this.utils,o=s.getSampleCountRenderContext(e.context),a=s.getCurrentColorSpace(e.context),l=s.getCurrentColorFormat(e.context),c=s.getCurrentDepthStencilFormat(e.context),u=s.getPrimitiveTopology(n,r),f=n.isMesh&&n.matrixWorld.determinantAffine()<0,d=!1;return(t.material!==r||t.materialVersion!==r.version||t.transparent!==r.transparent||t.blending!==r.blending||t.premultipliedAlpha!==r.premultipliedAlpha||t.blendSrc!==r.blendSrc||t.blendDst!==r.blendDst||t.blendEquation!==r.blendEquation||t.blendSrcAlpha!==r.blendSrcAlpha||t.blendDstAlpha!==r.blendDstAlpha||t.blendEquationAlpha!==r.blendEquationAlpha||t.colorWrite!==r.colorWrite||t.depthWrite!==r.depthWrite||t.depthTest!==r.depthTest||t.depthFunc!==r.depthFunc||t.stencilWrite!==r.stencilWrite||t.stencilFunc!==r.stencilFunc||t.stencilFail!==r.stencilFail||t.stencilZFail!==r.stencilZFail||t.stencilZPass!==r.stencilZPass||t.stencilFuncMask!==r.stencilFuncMask||t.stencilWriteMask!==r.stencilWriteMask||t.side!==r.side||t.alphaToCoverage!==r.alphaToCoverage||t.sampleCount!==o||t.colorSpace!==a||t.colorFormat!==l||t.depthStencilFormat!==c||t.primitiveTopology!==u||t.frontFaceCW!==f||t.clippingContextCacheKey!==e.clippingContextCacheKey)&&(t.material=r,t.materialVersion=r.version,t.transparent=r.transparent,t.blending=r.blending,t.premultipliedAlpha=r.premultipliedAlpha,t.blendSrc=r.blendSrc,t.blendDst=r.blendDst,t.blendEquation=r.blendEquation,t.blendSrcAlpha=r.blendSrcAlpha,t.blendDstAlpha=r.blendDstAlpha,t.blendEquationAlpha=r.blendEquationAlpha,t.colorWrite=r.colorWrite,t.depthWrite=r.depthWrite,t.depthTest=r.depthTest,t.depthFunc=r.depthFunc,t.stencilWrite=r.stencilWrite,t.stencilFunc=r.stencilFunc,t.stencilFail=r.stencilFail,t.stencilZFail=r.stencilZFail,t.stencilZPass=r.stencilZPass,t.stencilFuncMask=r.stencilFuncMask,t.stencilWriteMask=r.stencilWriteMask,t.side=r.side,t.alphaToCoverage=r.alphaToCoverage,t.sampleCount=o,t.colorSpace=a,t.colorFormat=l,t.depthStencilFormat=c,t.primitiveTopology=u,t.frontFaceCW=f,t.clippingContextCacheKey=e.clippingContextCacheKey,d=!0),d}getRenderCacheKey(e){let{object:t,material:n}=e,r=this.utils,s=e.context,o=t.isMesh&&t.matrixWorld.determinantAffine()<0;return[n.transparent,n.blending,n.premultipliedAlpha,n.blendSrc,n.blendDst,n.blendEquation,n.blendSrcAlpha,n.blendDstAlpha,n.blendEquationAlpha,n.colorWrite,n.depthWrite,n.depthTest,n.depthFunc,n.stencilWrite,n.stencilFunc,n.stencilFail,n.stencilZFail,n.stencilZPass,n.stencilFuncMask,n.stencilWriteMask,n.side,o,r.getSampleCountRenderContext(s),r.getCurrentColorSpace(s),r.getCurrentColorFormat(s),r.getCurrentDepthStencilFormat(s),r.getPrimitiveTopology(t,n),e.getGeometryCacheKey(),e.clippingContextCacheKey].join()}updateSampler(e){return this.textureUtils.updateSampler(e)}destroySampler(e){this.textureUtils.destroySampler(e)}createDefaultTexture(e){return this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,n,r,s,o){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,o)}initTimestampQuery(e,t,n){if(!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new J9(this.device,e,2048));let r=this.timestampQueryPool[e],s=r.allocateQueriesForContext(t);XR.querySet=r.querySet,XR.beginningOfPassWriteIndex=s,XR.endOfPassWriteIndex=s+1,n.timestampWrites=XR}createNodeBuilder(e,t){return new W9(e,t)}createProgram(e){let t=this.get(e);jR.label=e.stage+(e.name!==""?`_${e.name}`:""),jR.code=e.code,t.module={module:this.device.createShaderModule(jR),entryPoint:"main"},jR.reset()}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){this.pipelineUtils.createRenderPipeline(e,t)}createComputePipeline(e,t){this.pipelineUtils.createComputePipeline(e,t)}beginBundle(e){let t=this.get(e);t._currentPass=t.currentPass,t._currentSets=t.currentSets,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.currentPass=this.pipelineUtils.createBundleEncoder(e)}finishBundle(e,t){let n=this.get(e),s=n.currentPass.finish();this.get(t).bundleGPU=s,n.currentSets=n._currentSets,n.currentPass=n._currentPass}addBundle(e,t){this.get(e).renderBundles.push(this.get(t).bundleGPU)}createUniformBuffer(e){let t=this.get(e);if(t.buffer===void 0){let n=e.byteLength,r=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,s=[];e.visibility&yf.VERTEX&&s.push("vertex"),e.visibility&yf.FRAGMENT&&s.push("fragment"),e.visibility&yf.COMPUTE&&s.push("compute");let o=`(${s.join(",")})`;lc.label=`bindingBuffer${e.id}_${e.name}_${o}`,lc.size=n,lc.usage=r;let a=this.device.createBuffer(lc);lc.reset(),t.buffer=a}}destroyUniformBuffer(e){this.get(e).buffer.destroy(),this.delete(e)}createBindings(e,t,n,r){this.bindingUtils.createBindings(e,t,n,r)}updateBindings(e,t,n,r){this.bindingUtils.createBindings(e,t,n,r)}updateBinding(e){this.bindingUtils.updateBinding(e)}deleteBindGroupData(e){this.bindingUtils.deleteBindGroupData(e)}createIndexAttribute(e){let t=GPUBufferUsage.INDEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST;(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(t|=GPUBufferUsage.STORAGE),this.attributeUtils.createAttribute(e,t)}createAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createIndirectStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.INDIRECT|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}updateSize(){this.delete(this.renderer.getCanvasTarget())}hasFeature(e){return Zte[e]!==void 0&&(e=Zte[e]),this.device.features.has(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){let a=0,l=0,c=0,u=0,f=0,d=0,A=e.image.width,y=e.image.height,w=1;n!==null&&(n.isBox3===!0?(u=n.min.x,f=n.min.y,d=n.min.z,A=n.max.x-n.min.x,y=n.max.y-n.min.y,w=n.max.z-n.min.z):(u=n.min.x,f=n.min.y,A=n.max.x-n.min.x,y=n.max.y-n.min.y,w=1)),r!==null&&(a=r.x,l=r.y,c=r.z||0),Ya.label="copyTextureToTexture_"+e.id+"_"+t.id;let S=this.device.createCommandEncoder(Ya);Ya.reset();let T=this.get(e).texture,R=this.get(t).texture;Zc.texture=T,Zc.mipLevel=s,Zc.origin.x=u,Zc.origin.y=f,Zc.origin.z=d,ff.texture=R,ff.mipLevel=o,ff.origin.x=a,ff.origin.y=l,ff.origin.z=c,Wd.width=A,Wd.height=y,Wd.depthOrArrayLayers=w,S.copyTextureToTexture(Zc,ff,Wd),Zc.reset(),ff.reset(),Wd.reset(),mf(this.device,S.finish()),o===0&&t.generateMipmaps&&this.textureUtils.generateMipmaps(t)}copyFramebufferToTexture(e,t,n){let r=this.get(t),s=null;t.renderTarget?e.isDepthTexture?s=this.get(t.depthTexture).texture:s=this.get(t.textures[0]).texture:e.isDepthTexture?s=this.textureUtils.getDepthBuffer(t.depth,t.stencil):s=this.context.getCurrentTexture();let o=this.get(e).texture;if(s.format!==o.format){ze("WebGPUBackend: copyFramebufferToTexture: Source and destination formats do not match.",s.format,o.format);return}let a;if(r.currentPass?(r.currentPass.end(),a=r.encoder):(Ya.label="copyFramebufferToTexture_"+e.id,a=this.device.createCommandEncoder(Ya),Ya.reset()),Zc.texture=s,Zc.origin.x=n.x,Zc.origin.y=n.y,ff.texture=o,Wd.width=n.z,Wd.height=n.w,a.copyTextureToTexture(Zc,ff,Wd),Zc.reset(),ff.reset(),Wd.reset(),e.generateMipmaps&&this.textureUtils.generateMipmaps(e,a),r.currentPass){let{descriptor:l}=r;for(let c=0;c<l.colorAttachments.length;c++)l.colorAttachments[c].loadOp=Fi.Load;t.depth&&(l.depthStencilAttachment.depthLoadOp=Fi.Load),t.stencil&&(l.depthStencilAttachment.stencilLoadOp=Fi.Load),r.currentPass=a.beginRenderPass(l),r.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.viewport&&this.updateViewport(t),t.scissor&&this.updateScissor(t)}else mf(this.device,a.finish())}hasCompatibility(e){return this._compatibility[e]!==void 0?this._compatibility[e]:super.hasCompatibility(e)}dispose(){if(this.bindingUtils.dispose(),this.textureUtils.dispose(),this.occludedResolveCache){for(let e of this.occludedResolveCache.values())e.destroy();this.occludedResolveCache.clear()}if(this.timestampQueryPool)for(let e of Object.values(this.timestampQueryPool))e!==null&&e.dispose();this.parameters.device===void 0&&this.device!==null&&this.device.destroy()}},iz=class extends KA{constructor(e,t,n,r,s,o){super(e,t,n,r,s,o),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}},rz=class extends KA{constructor(e,t,n,r,s,o){super(e,t,n,r,s,o),this.aspect=null}copy(e,t){return super.copy(e,t),this.aspect=e.aspect,this}},sz=class extends $4{constructor(){super(),this.addMaterial(C7,"MeshPhongMaterial"),this.addMaterial(E4,"MeshStandardMaterial"),this.addMaterial(B7,"MeshPhysicalMaterial"),this.addMaterial(U7,"MeshToonMaterial"),this.addMaterial(E7,"MeshBasicMaterial"),this.addMaterial(M7,"MeshLambertMaterial"),this.addMaterial(b7,"MeshNormalMaterial"),this.addMaterial(k7,"MeshMatcapMaterial"),this.addMaterial(_7,"LineBasicMaterial"),this.addMaterial(x7,"LineDashedMaterial"),this.addMaterial(V7,"PointsMaterial"),this.addMaterial(M4,"SpriteMaterial"),this.addMaterial(q7,"ShadowMaterial"),this.addLight(Dk,rb),this.addLight(i9,QA),this.addLight(l9,sb),this.addLight(MS,KA),this.addLight(n9,JA),this.addLight(r9,nb),this.addLight(o9,ob),this.addLight(s9,iz),this.addLight(a9,rz),this.addToneMapping(Dse,wb),this.addToneMapping(Nse,Sb),this.addToneMapping(Fse,Tb),this.addToneMapping(Bse,Eb),this.addToneMapping(Ose,Mb),this.addToneMapping(Use,Cb)}},xx=class extends g9{constructor(e={}){let t;e.forceWebGL?t=rP:(t=nz,e.getFallback=()=>(Xe("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new rP(e)));let n=new t(e);super(n,e),this.library=new sz,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}};var Mlt=V.BRDF_GGX,Clt=V.BRDF_Lambert,Rlt=V.BasicPointShadowFilter,Plt=V.BasicShadowFilter,Ilt=V.Break,Llt=V.Const,Dlt=V.Continue,Nlt=V.DFGLUT,Flt=V.D_GGX,Blt=V.Discard,Olt=V.EPSILON,Ult=V.F_Schlick,moe=V.Fn,klt=V.INFINITY,Aoe=V.If,goe=V.Loop,zlt=V.NodeAccess,Vlt=V.NodeShaderStage,Glt=V.NodeType,qlt=V.NodeUpdateType,Hlt=V.PCFShadowFilter,Wlt=V.PCFSoftShadowFilter,jlt=V.PI,Xlt=V.PI2,$lt=V.TWO_PI,Ylt=V.HALF_PI,Zlt=V.PointShadowFilter,Klt=V.Return,Qlt=V.Schlick_to_F0,Jlt=V.ShaderNode,ect=V.Stack,tct=V.Switch,nct=V.TBNViewMatrix,ict=V.VSMShadowFilter,rct=V.V_GGX_SmithCorrelated,sct=V.Var,oct=V.VarIntent,act=V.abs,lct=V.acesFilmicToneMapping,cct=V.acos,uct=V.acosh,hct=V.add,fct=V.addMethodChaining,dct=V.addNodeElement,pct=V.agxToneMapping,mct=V.all,Act=V.alphaT,gct=V.ambientOcclusion,vct=V.and,_ct=V.anisotropy,xct=V.anisotropyB,yct=V.anisotropyT,bct=V.any,wct=V.append,Sct=V.array,voe=V.asin,Tct=V.asinh,Ect=V.assign,Mct=V.atan,Cct=V.atanh,Rct=V.atomicAdd,Pct=V.atomicAnd,Ict=V.atomicFunc,Lct=V.atomicLoad,Dct=V.atomicMax,Nct=V.atomicMin,Fct=V.atomicOr,Bct=V.atomicStore,Oct=V.atomicSub,Uct=V.atomicXor,kct=V.attenuationColor,zct=V.attenuationDistance,Vct=V.attribute,Gct=V.attributeArray,qct=V.backgroundBlurriness,Hct=V.backgroundIntensity,Wct=V.backgroundRotation,jct=V.batch,Xct=V.bentNormalView,$ct=V.billboarding,Yct=V.bitAnd,Zct=V.bitNot,Kct=V.bitOr,Qct=V.bitXor,Jct=V.bitangentGeometry,eut=V.bitangentLocal,tut=V.bitangentView,nut=V.bitangentWorld,iut=V.bitcast,rut=V.blendBurn,sut=V.blendColor,out=V.blendDodge,aut=V.blendOverlay,lut=V.blendScreen,cut=V.blur,uut=V.bool,hut=V.buffer,fut=V.bufferAttribute,dut=V.bumpMap,put=V.builtin,mut=V.builtinAOContext,Aut=V.builtinShadowContext,gut=V.bvec2,vut=V.bvec3,_ut=V.bvec4,xut=V.bypass,yut=V.cache,but=V.call,wut=V.cameraFar,Sut=V.cameraIndex,Tut=V.cameraNear,Eut=V.cameraNormalMatrix,Mut=V.cameraPosition,Cut=V.cameraProjectionMatrix,Rut=V.cameraProjectionMatrixInverse,Put=V.cameraViewMatrix,Iut=V.cameraViewport,Lut=V.cameraWorldMatrix,Dut=V.cbrt,Nut=V.cdl,Fut=V.ceil,But=V.checker,Out=V.cineonToneMapping,Uut=V.clamp,kut=V.clearcoat,zut=V.clearcoatNormalView,Vut=V.clearcoatRoughness,Gut=V.clipSpace,qut=V.code,Hut=V.color,Wut=V.colorSpaceToWorking,jut=V.colorToDirection,Xut=V.compute,$ut=V.computeKernel,Yut=V.computeSkinning,Zut=V.context,Kut=V.convert,Qut=V.convertColorSpace,Jut=V.convertToTexture,eht=V.countLeadingZeros,tht=V.countOneBits,nht=V.countTrailingZeros,_oe=V.cos,iht=V.cosh,rht=V.cross,sht=V.cubeTexture,oht=V.cubeTextureBase,aht=V.dFdx,lht=V.dFdy,cht=V.dashSize,uht=V.debug,hht=V.decrement,fht=V.decrementBefore,dht=V.defaultBuildStages,pht=V.defaultShaderStages,mht=V.defined,Aht=V.degrees,ght=V.deltaTime,vht=V.densityFog,_ht=V.densityFogFactor,xht=V.depth,yht=V.depthPass,bht=V.determinant,wht=V.difference,Sht=V.diffuseColor,Tht=V.directPointLight,Eht=V.directionToColor,Mht=V.directionToFaceDirection,Cht=V.dispersion,Rht=V.distance,Pht=V.div,Iht=V.dot,Lht=V.drawIndex,Dht=V.dynamicBufferAttribute,Nht=V.element,Fht=V.emissive,Bht=V.equal,Oht=V.equirectDirection,Uht=V.equirectUV,xoe=V.exp,kht=V.exp2,zht=V.exponentialHeightFogFactor,Vht=V.expression,Ght=V.faceDirection,qht=V.faceForward,Hht=V.faceforward,yoe=V.float,Wht=V.floatBitsToInt,jht=V.floatBitsToUint,Xht=V.floor,$ht=V.fog,Yht=V.fract,Zht=V.frameGroup,Kht=V.frameId,Qht=V.frontFacing,Jht=V.fwidth,eft=V.gain,tft=V.gapSize,nft=V.getConstNodeType,ift=V.getCurrentStack,rft=V.getDirection,sft=V.getDistanceAttenuation,oft=V.getGeometryRoughness,aft=V.getNormalFromDepth,lft=V.interleavedGradientNoise,cft=V.vogelDiskSample,uft=V.getParallaxCorrectNormal,hft=V.getRoughness,fft=V.getScreenPosition,dft=V.getShIrradianceAt,pft=V.getShadowMaterial,mft=V.getShadowRenderObjectFunction,Aft=V.getTextureIndex,gft=V.getViewPosition,vft=V.globalId,_ft=V.glsl,xft=V.glslFn,yft=V.grayscale,bft=V.greaterThan,wft=V.greaterThanEqual,Sft=V.hash,Tft=V.highpModelNormalViewMatrix,Eft=V.highpModelViewMatrix,Mft=V.hue,Cft=V.increment,Rft=V.incrementBefore,Pft=V.instance,boe=V.instanceIndex,Ift=V.instancedArray,Lft=V.instancedBufferAttribute,Dft=V.instancedDynamicBufferAttribute,Nft=V.instancedMesh,Fft=V.int,Bft=V.intBitsToFloat,Oft=V.inverse,Uft=V.inverseSqrt,kft=V.inversesqrt,zft=V.invocationLocalIndex,Vft=V.invocationSubgroupIndex,Gft=V.ior,qft=V.iridescence,Hft=V.iridescenceIOR,Wft=V.iridescenceThickness,jft=V.ivec2,Xft=V.ivec3,$ft=V.ivec4,Yft=V.js,Zft=V.label,Kft=V.length,Qft=V.lengthSq,Jft=V.lessThan,edt=V.lessThanEqual,tdt=V.lightPosition,ndt=V.lightProjectionUV,idt=V.lightShadowMatrix,rdt=V.lightTargetDirection,sdt=V.lightTargetPosition,odt=V.lightViewPosition,adt=V.lightingContext,ldt=V.lights,cdt=V.linearDepth,udt=V.linearToneMapping,hdt=V.localId,fdt=V.log,ddt=V.log2,pdt=V.logarithmicDepthToViewZ,mdt=V.luminance,Adt=V.mat2,gdt=V.mat3,vdt=V.mat4,_dt=V.matcapUV,xdt=V.materialAO,ydt=V.materialAlphaTest,bdt=V.materialAnisotropy,wdt=V.materialAnisotropyVector,Sdt=V.materialAttenuationColor,Tdt=V.materialAttenuationDistance,Edt=V.materialClearcoat,Mdt=V.materialClearcoatNormal,Cdt=V.materialClearcoatRoughness,Rdt=V.materialColor,Pdt=V.materialDispersion,Idt=V.materialEmissive,Ldt=V.materialEnvIntensity,Ddt=V.materialEnvRotation,Ndt=V.materialIOR,Fdt=V.materialIridescence,Bdt=V.materialIridescenceIOR,Odt=V.materialIridescenceThickness,Udt=V.materialLightMap,kdt=V.materialLineDashOffset,zdt=V.materialLineDashSize,Vdt=V.materialLineGapSize,Gdt=V.materialLineScale,qdt=V.materialLineWidth,Hdt=V.materialMetalness,Wdt=V.materialNormal,jdt=V.materialOpacity,Xdt=V.materialPointSize,$dt=V.materialReference,Ydt=V.materialReflectivity,Zdt=V.materialRefractionRatio,Kdt=V.materialRotation,Qdt=V.materialRoughness,Jdt=V.materialSheen,ept=V.materialSheenRoughness,tpt=V.materialShininess,npt=V.materialSpecular,ipt=V.materialSpecularColor,rpt=V.materialSpecularIntensity,spt=V.materialSpecularStrength,opt=V.materialThickness,apt=V.materialTransmission,lpt=V.max,cpt=V.maxMipLevel,upt=V.mediumpModelViewMatrix,hpt=V.metalness,fpt=V.min,dpt=V.mix,ppt=V.mixElement,mpt=V.mod,Apt=V.modelDirection,gpt=V.modelNormalMatrix,vpt=V.modelPosition,_pt=V.modelRadius,xpt=V.modelScale,ypt=V.modelViewMatrix,bpt=V.modelViewPosition,wpt=V.modelViewProjection,Spt=V.modelWorldMatrix,Tpt=V.modelWorldMatrixInverse,Ept=V.morphReference,Mpt=V.mrt,Cpt=V.mul,Rpt=V.mx_aastep,Ppt=V.mx_add,Ipt=V.mx_atan2,Lpt=V.mx_cell_noise_float,Dpt=V.mx_contrast,Npt=V.mx_divide,Fpt=V.mx_fractal_noise_float,Bpt=V.mx_fractal_noise_vec2,Opt=V.mx_fractal_noise_vec3,Upt=V.mx_fractal_noise_vec4,kpt=V.mx_frame,zpt=V.mx_heighttonormal,Vpt=V.mx_hsvtorgb,Gpt=V.mx_ifequal,qpt=V.mx_ifgreater,Hpt=V.mx_ifgreatereq,Wpt=V.mx_invert,jpt=V.mx_modulo,Xpt=V.mx_multiply,$pt=V.mx_noise_float,Ypt=V.mx_noise_vec3,Zpt=V.mx_noise_vec4,Kpt=V.mx_place2d,Qpt=V.mx_power,Jpt=V.mx_ramp4,e0t=V.mx_ramplr,t0t=V.mx_ramptb,n0t=V.mx_rgbtohsv,i0t=V.mx_rotate2d,r0t=V.mx_rotate3d,s0t=V.mx_safepower,o0t=V.mx_separate,a0t=V.mx_splitlr,l0t=V.mx_splittb,c0t=V.mx_srgb_texture_to_lin_rec709,u0t=V.mx_subtract,h0t=V.mx_timer,f0t=V.mx_transform_uv,d0t=V.mx_unifiednoise2d,p0t=V.mx_unifiednoise3d,m0t=V.mx_worley_noise_float,A0t=V.mx_worley_noise_vec2,g0t=V.mx_worley_noise_vec3,woe=V.negate,v0t=V.negateOnBackSide,_0t=V.neutralToneMapping,x0t=V.nodeArray,y0t=V.nodeImmutable,b0t=V.nodeObject,w0t=V.nodeObjectIntent,S0t=V.nodeObjects,T0t=V.nodeProxy,E0t=V.nodeProxyIntent,M0t=V.normalFlat,C0t=V.normalGeometry,R0t=V.normalLocal,P0t=V.normalMap,I0t=V.normalView,L0t=V.normalViewGeometry,D0t=V.normalWorld,N0t=V.normalWorldGeometry,F0t=V.normalize,B0t=V.not,O0t=V.notEqual,U0t=V.numWorkgroups,k0t=V.objectDirection,z0t=V.objectGroup,V0t=V.objectPosition,G0t=V.objectRadius,q0t=V.objectScale,H0t=V.objectViewPosition,W0t=V.objectWorldMatrix,j0t=V.OnBeforeObjectUpdate,X0t=V.OnBeforeMaterialUpdate,$0t=V.OnObjectUpdate,Y0t=V.OnMaterialUpdate,Z0t=V.oneMinus,K0t=V.or,Q0t=V.orthographicDepthToViewZ,J0t=V.oscSawtooth,emt=V.oscSine,tmt=V.oscSquare,nmt=V.oscTriangle,imt=V.output,rmt=V.outputStruct,smt=V.overloadingFn,omt=V.overrideNode,amt=V.overrideNodes,lmt=V.packHalf2x16,cmt=V.packSnorm2x16,umt=V.packUnorm2x16,hmt=V.packNormalToRGB,fmt=V.parabola,dmt=V.parallaxDirection,pmt=V.parallaxUV,mmt=V.parameter,Amt=V.pass,gmt=V.passTexture,vmt=V.pcurve,_mt=V.perspectiveDepthToViewZ,xmt=V.pmremTexture,ymt=V.pointShadow,bmt=V.pointUV,wmt=V.pointWidth,Smt=V.positionGeometry,Tmt=V.positionLocal,Emt=V.positionPrevious,Mmt=V.positionView,Cmt=V.positionViewDirection,Rmt=V.positionWorld,Pmt=V.positionWorldDirection,Imt=V.posterize,Lmt=V.pow,Dmt=V.pow2,Nmt=V.pow3,Fmt=V.pow4,Bmt=V.premultiplyAlpha,Omt=V.property,Umt=V.radians,kmt=V.rand,zmt=V.range,Vmt=V.rangeFog,Gmt=V.rangeFogFactor,qmt=V.reciprocal,Hmt=V.reference,Wmt=V.referenceBuffer,jmt=V.reflect,Xmt=V.reflectVector,$mt=V.reflectView,Ymt=V.reflector,Zmt=V.refract,Kmt=V.refractVector,Qmt=V.refractView,Jmt=V.reinhardToneMapping,eAt=V.remap,tAt=V.remapClamp,nAt=V.renderGroup,iAt=V.renderOutput,rAt=V.rendererReference,sAt=V.replaceDefaultUV,oAt=V.rotate,aAt=V.rotateUV,lAt=V.roughness,cAt=V.round,uAt=V.rtt,hAt=V.sRGBTransferEOTF,fAt=V.sRGBTransferOETF,dAt=V.sample,pAt=V.sampler,mAt=V.samplerComparison,AAt=V.saturate,gAt=V.saturation,vAt=V.screen,_At=V.screenCoordinate,xAt=V.screenDPR,yAt=V.screenSize,bAt=V.screenUV,wAt=V.select,SAt=V.setCurrentStack,TAt=V.setName,EAt=V.shaderStages,MAt=V.shadow,CAt=V.shadowPositionWorld,RAt=V.shapeCircle,PAt=V.sharedUniformGroup,IAt=V.sheen,LAt=V.sheenRoughness,DAt=V.shiftLeft,NAt=V.shiftRight,FAt=V.shininess,BAt=V.sign,Soe=V.sin,OAt=V.sinh,UAt=V.sinc,kAt=V.skinning,zAt=V.smoothstep,VAt=V.smoothstepElement,GAt=V.specularColor,qAt=V.specularF90,HAt=V.spherizeUV,WAt=V.split,jAt=V.spritesheetUV,Toe=V.sqrt,XAt=V.stack,$At=V.step,YAt=V.stepElement,Eoe=V.storage,ZAt=V.storageBarrier,KAt=V.storageTexture,QAt=V.storageTexture3D,JAt=V.struct,egt=V.sub,tgt=V.subgroupAdd,ngt=V.subgroupAll,igt=V.subgroupAnd,rgt=V.subgroupAny,sgt=V.subgroupBallot,ogt=V.subgroupBroadcast,agt=V.subgroupBroadcastFirst,lgt=V.subBuild,cgt=V.subgroupElect,ugt=V.subgroupExclusiveAdd,hgt=V.subgroupExclusiveMul,fgt=V.subgroupInclusiveAdd,dgt=V.subgroupInclusiveMul,pgt=V.subgroupIndex,mgt=V.subgroupMax,Agt=V.subgroupMin,ggt=V.subgroupMul,vgt=V.subgroupOr,_gt=V.subgroupShuffle,xgt=V.subgroupShuffleDown,ygt=V.subgroupShuffleUp,bgt=V.subgroupShuffleXor,wgt=V.subgroupSize,Sgt=V.subgroupXor,Tgt=V.tan,Egt=V.tanh,Mgt=V.tangentGeometry,Cgt=V.tangentLocal,Rgt=V.tangentView,Pgt=V.tangentWorld,Igt=V.texture,Lgt=V.texture3D,Dgt=V.textureBarrier,Ngt=V.textureBicubic,Fgt=V.textureBicubicLevel,Bgt=V.textureCubeUV,Ogt=V.textureLoad,Ugt=V.textureSize,kgt=V.textureLevel,zgt=V.textureStore,Vgt=V.thickness,Ggt=V.time,qgt=V.toneMapping,Hgt=V.toneMappingExposure,Wgt=V.toonOutlinePass,jgt=V.transformDirection,Xgt=V.transformNormal,$gt=V.transformNormalByInverseViewMatrix,Ygt=V.transformNormalByViewMatrix,Zgt=V.transformNormalToView,Kgt=V.transformedClearcoatNormalView,Qgt=V.transformedNormalView,Jgt=V.transformedNormalWorld,e1t=V.transmission,t1t=V.transpose,n1t=V.triNoise3D,i1t=V.triplanarTexture,r1t=V.triplanarTextures,s1t=V.trunc,o1t=V.uint,a1t=V.uintBitsToFloat,Moe=V.uniform,l1t=V.uniformArray,c1t=V.uniformCubeTexture,u1t=V.uniformGroup,h1t=V.uniformFlow,f1t=V.uniformTexture,d1t=V.unpackHalf2x16,p1t=V.unpackSnorm2x16,m1t=V.unpackUnorm2x16,A1t=V.unpackRGBToNormal,g1t=V.unpremultiplyAlpha,v1t=V.userData,_1t=V.uv,x1t=V.uvec2,y1t=V.uvec3,b1t=V.uvec4,w1t=V.varying,S1t=V.varyingProperty,T1t=V.vec2,E1t=V.vec3,M1t=V.vec4,C1t=V.vectorComponents,R1t=V.velocity,P1t=V.vertexColor,I1t=V.vertexIndex,L1t=V.vertexStage,D1t=V.vibrance,N1t=V.viewZToLogarithmicDepth,F1t=V.viewZToOrthographicDepth,B1t=V.viewZToPerspectiveDepth,O1t=V.viewZToReversedOrthographicDepth,U1t=V.viewZToReversedPerspectiveDepth,k1t=V.viewport,z1t=V.viewportCoordinate,V1t=V.viewportDepthTexture,G1t=V.viewportLinearDepth,q1t=V.viewportMipTexture,H1t=V.viewportOpaqueMipTexture,W1t=V.viewportResolution,j1t=V.viewportSafeUV,X1t=V.viewportSharedTexture,$1t=V.viewportSize,Y1t=V.viewportTexture,Z1t=V.viewportUV,K1t=V.wgsl,Q1t=V.wgslFn,J1t=V.workgroupArray,evt=V.workgroupBarrier,tvt=V.workgroupId,nvt=V.workingToColorSpace,ivt=V.xor;var Coe=new ka,GP=new re,Ex=class extends ab{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";let e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new Ln(e,3)),this.setAttribute("uv",new Ln(t,2))}applyMatrix4(e){let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let n=new Lh(t,6,1);return this.setAttribute("instanceStart",new Vo(n,3,0)),this.setAttribute("instanceEnd",new Vo(n,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let n=new Lh(t,6,1);return this.setAttribute("instanceColorStart",new Vo(n,3,0)),this.setAttribute("instanceColorEnd",new Vo(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new $2(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ka);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Coe.setFromBufferAttribute(t),this.boundingBox.union(Coe))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new yl),this.boundingBox===null&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)GP.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(GP)),GP.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(GP));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}};Nt.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Oe},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};Ha.line={uniforms:dg.merge([Nt.common,Nt.fog,Nt.line]),vertexShader:`47054705 #include <common>47064706 #include <color_pars_vertex>47074707 #include <fog_pars_vertex>
@@ -5093,10 +5093,10 @@ var<${n}> ${e} : ${o};`}},Aa=new ym,_U=new a1,voe=new Map([[Int8Array,["sint8","
50935093 #include <premultiplied_alpha_fragment>50945094 50955095 }5096- `};var Df=class extends ps{constructor(e){super({type:"LineMaterial",uniforms:pg.clone(Ha.line.uniforms),vertexShader:Ha.line.vertexShader,fragmentShader:Ha.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0!==this.worldUnits&&(this.needsUpdate=!0),e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}};var NV=new xn,Doe=new re,Noe=new re,Qo=new xn,Jo=new xn,Nf=new xn,FV=new re,BV=new cn,ea=new fb,Foe=new re,$I=new ka,YI=new bl,Ff=new xn,Bf,d1;function Boe(i,e,t){return Ff.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),Ff.multiplyScalar(1/Ff.w),Ff.x=d1/t.width,Ff.y=d1/t.height,Ff.applyMatrix4(i.projectionMatrixInverse),Ff.multiplyScalar(1/Ff.w),Math.abs(Math.max(Ff.x,Ff.y))}function $Pe(i,e){let t=i.matrixWorld,n=i.geometry,r=n.attributes.instanceStart,s=n.attributes.instanceEnd,o=Math.min(n.instanceCount,r.count);for(let a=0,l=o;a<l;a++){ea.start.fromBufferAttribute(r,a),ea.end.fromBufferAttribute(s,a),ea.applyMatrix4(t);let c=new re,u=new re;Bf.distanceSqToSegment(ea.start,ea.end,u,c),u.distanceTo(c)<d1*.5&&e.push({point:u,pointOnLine:c,distance:Bf.origin.distanceTo(u),object:i,face:null,faceIndex:a,uv:null,uv1:null})}}function YPe(i,e,t){let n=e.projectionMatrix,s=i.material.resolution,o=i.matrixWorld,a=i.geometry,l=a.attributes.instanceStart,c=a.attributes.instanceEnd,u=Math.min(a.instanceCount,l.count),f=-e.near;Bf.at(1,Nf),Nf.w=1,Nf.applyMatrix4(e.matrixWorldInverse),Nf.applyMatrix4(n),Nf.multiplyScalar(1/Nf.w),Nf.x*=s.x/2,Nf.y*=s.y/2,Nf.z=0,FV.copy(Nf),BV.multiplyMatrices(e.matrixWorldInverse,o);for(let d=0,A=u;d<A;d++){if(Qo.fromBufferAttribute(l,d),Jo.fromBufferAttribute(c,d),Qo.w=1,Jo.w=1,Qo.applyMatrix4(BV),Jo.applyMatrix4(BV),Qo.z>f&&Jo.z>f)continue;if(Qo.z>f){let P=Qo.z-Jo.z,I=(Qo.z-f)/P;Qo.lerp(Jo,I)}else if(Jo.z>f){let P=Jo.z-Qo.z,I=(Jo.z-f)/P;Jo.lerp(Qo,I)}Qo.applyMatrix4(n),Jo.applyMatrix4(n),Qo.multiplyScalar(1/Qo.w),Jo.multiplyScalar(1/Jo.w),Qo.x*=s.x/2,Qo.y*=s.y/2,Jo.x*=s.x/2,Jo.y*=s.y/2,ea.start.copy(Qo),ea.start.z=0,ea.end.copy(Jo),ea.end.z=0;let w=ea.closestPointToPointParameter(FV,!0);ea.at(w,Foe);let S=zu.lerp(Qo.z,Jo.z,w),T=S>=-1&&S<=1,R=FV.distanceTo(Foe)<d1*.5;if(T&&R){ea.start.fromBufferAttribute(l,d),ea.end.fromBufferAttribute(c,d),ea.start.applyMatrix4(o),ea.end.applyMatrix4(o);let P=new re,I=new re;Bf.distanceSqToSegment(ea.start,ea.end,I,P),t.push({point:I,pointOnLine:P,distance:Bf.origin.distanceTo(I),object:i,face:null,faceIndex:d,uv:null,uv1:null})}}}var ZI=class extends Hn{constructor(e=new Cx,t=new Df({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let o=0,a=0,l=t.count;o<l;o++,a+=2)Doe.fromBufferAttribute(t,o),Noe.fromBufferAttribute(n,o),r[a]=a===0?0:r[a-1],r[a+1]=r[a]+Doe.distanceTo(Noe);let s=new Bh(r,2,1);return e.setAttribute("instanceDistanceStart",new Vo(s,1,0)),e.setAttribute("instanceDistanceEnd",new Vo(s,1,1)),this}raycast(e,t){let n=this.material.worldUnits,r=e.camera;if(r===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),n===!1&&(this.material.resolution.x===0||this.material.resolution.y===0))return;let s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Bf=e.ray;let o=this.matrixWorld,a=this.geometry,l=this.material;d1=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),YI.copy(a.boundingSphere).applyMatrix4(o);let c;if(n)c=d1*.5;else{let f=Math.max(r.near,YI.distanceToPoint(Bf.origin));c=Boe(r,f,l.resolution)}if(YI.radius+=c,Bf.intersectsSphere(YI)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),$I.copy(a.boundingBox).applyMatrix4(o);let u;if(n)u=d1*.5;else{let f=Math.max(r.near,$I.distanceToPoint(Bf.origin));u=Boe(r,f,l.resolution)}$I.expandByScalar(u),Bf.intersectsBox($I)!==!1&&(n?$Pe(this,t):YPe(this,r,t))}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(NV),this.material.uniforms.resolution.value.set(NV.z,NV.w))}};var Em=class extends Cx{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setColors(n),this}setFromPoints(e){let t=e.length-1,n=new Float32Array(6*t);for(let r=0;r<t;r++)n[6*r]=e[r].x,n[6*r+1]=e[r].y,n[6*r+2]=e[r].z||0,n[6*r+3]=e[r+1].x,n[6*r+4]=e[r+1].y,n[6*r+5]=e[r+1].z||0;return super.setPositions(n),this}fromLine(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}};var Rx=class extends ZI{constructor(e=new Em,t=new Df({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}};var Ix=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,n="ltr"){let r=[],s=ZPe(e,t,this.data,n);for(let o=0,a=s.length;o<a;o++)r.push(...s[o].toShapes());return r}};function ZPe(i,e,t,n){let r=Array.from(i),s=e/t.resolution,o=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*s,a=[],l=0,c=0;(n=="rtl"||n=="tb")&&r.reverse();for(let u=0;u<r.length;u++){let f=r[u];if(f===`5097-`)l=0,c-=o;else{let d=KPe(f,s,l,c,t);n=="tb"?(l=0,c+=t.ascender*s):l+=d.offsetX,a.push(d.path)}}return a}function KPe(i,e,t,n,r){let s=r.glyphs[i]||r.glyphs["?"];if(!s){console.error('THREE.Font: character "'+i+'" does not exists in font family '+r.familyName+".");return}let o=new db,a,l,c,u,f,d,A,y;if(s.o){let w=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let S=0,T=w.length;S<T;)switch(w[S++]){case"m":a=w[S++]*e+t,l=w[S++]*e+n,o.moveTo(a,l);break;case"l":a=w[S++]*e+t,l=w[S++]*e+n,o.lineTo(a,l);break;case"q":c=w[S++]*e+t,u=w[S++]*e+n,f=w[S++]*e+t,d=w[S++]*e+n,o.quadraticCurveTo(f,d,c,u);break;case"b":c=w[S++]*e+t,u=w[S++]*e+n,f=w[S++]*e+t,d=w[S++]*e+n,A=w[S++]*e+t,y=w[S++]*e+n,o.bezierCurveTo(f,d,A,y,c,u);break}}return{offsetX:s.ha*e,path:o}}var GS=class i extends Y2{constructor(e,t={}){let n=t.font;if(n===void 0)super();else{let r=n.generateShapes(e,t.size,t.direction);t.depth===void 0&&(t.depth=50),t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),super(r,t)}this.type="TextGeometry"}toJSON(){return super.toJSON()}static fromJSON(e){let t=e.options;return t.font=new Ix(t.font.data),new i(t.text,t)}};function VV(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function QPe(i){if(Array.isArray(i))return i}function JPe(i){if(Array.isArray(i))return VV(i)}function $oe(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function eLe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Ooe(i,e,t,n,r,s,o){try{var a=i[s](o),l=a.value}catch(c){return void t(c)}a.done?e(l):Promise.resolve(l).then(n,r)}function tLe(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){Ooe(s,n,r,o,a,"next",l)}function a(l){Ooe(s,n,r,o,a,"throw",l)}o(void 0)})}}function iP(i,e,t){return e=Nx(e),uLe(i,XV()?Reflect.construct(e,t||[],Nx(i).constructor):e.apply(i,t))}function nLe(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function rP(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function qS(i,e){return i.get($oe(i,e))}function OV(i,e,t){nLe(i,e),e.set(i,t)}function UV(i,e,t){return i.set($oe(i,e),t),t}function jV(i,e,t){if(XV())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return r}function iLe(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,Yoe(n.key),n)}}function sP(i,e,t){return e&&iLe(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Eo(i,e,t){return(e=Yoe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function GV(){return GV=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,t){var n=hLe(i,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?i:t):r.value}},GV.apply(null,arguments)}function Nx(i){return Nx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Nx(i)}function oP(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&HV(i,e)}function XV(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(XV=function(){return!!i})()}function rLe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function sLe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function oLe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5098-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aLe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5099-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Uoe(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function $i(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Uoe(Object(t),!0).forEach(function(n){Eo(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Uoe(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function lLe(i,e){if(i==null)return{};var t,n,r=cLe(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function cLe(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function uLe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return eLe(i)}function qV(){var i,e,t=typeof Symbol=="function"?Symbol:{},n=t.iterator||"@@iterator",r=t.toStringTag||"@@toStringTag";function s(A,y,w,S){var T=y&&y.prototype instanceof a?y:a,R=Object.create(T.prototype);return vc(R,"_invoke",(function(P,I,F){var D,L,C,B=0,k=F||[],z=!1,G={p:0,n:0,v:i,a:W,f:W.bind(i,4),d:function(Y,H){return D=Y,L=0,C=i,G.n=H,o}};function W(Y,H){for(L=Y,C=H,e=0;!z&&B&&!$&&e<k.length;e++){var $,J=k[e],te=G.p,ce=J[2];Y>3?($=ce===H)&&(C=J[(L=J[4])?5:(L=3,3)],J[4]=J[5]=i):J[0]<=te&&(($=Y<2&&te<J[1])?(L=0,G.v=H,G.n=J[1]):te<ce&&($=Y<3||J[0]>H||H>ce)&&(J[4]=Y,J[5]=H,G.n=ce,L=0))}if($||Y>1)return o;throw z=!0,H}return function(Y,H,$){if(B>1)throw TypeError("Generator is already running");for(z&&H===1&&W(H,$),L=H,C=$;(e=L<2?i:C)||!z;){D||(L?L<3?(L>1&&(G.n=-1),W(L,C)):G.n=C:G.v=C);try{if(B=2,D){if(L||(Y="next"),e=D[Y]){if(!(e=e.call(D,C)))throw TypeError("iterator result is not an object");if(!e.done)return e;C=e.value,L<2&&(L=0)}else L===1&&(e=D.return)&&e.call(D),L<2&&(C=TypeError("The iterator does not provide a '"+Y+"' method"),L=1);D=i}else if((e=(z=G.n<0)?C:P.call(I,G))!==o)break}catch(J){D=i,L=1,C=J}finally{B=1}}return{value:e,done:z}}})(A,w,S),!0),R}var o={};function a(){}function l(){}function c(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(vc(e={},n,function(){return this}),e),f=c.prototype=a.prototype=Object.create(u);function d(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,c):(A.__proto__=c,vc(A,r,"GeneratorFunction")),A.prototype=Object.create(f),A}return l.prototype=c,vc(f,"constructor",c),vc(c,"constructor",l),l.displayName="GeneratorFunction",vc(c,r,"GeneratorFunction"),vc(f),vc(f,r,"Generator"),vc(f,n,function(){return this}),vc(f,"toString",function(){return"[object Generator]"}),(qV=function(){return{w:s,m:d}})()}function vc(i,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}vc=function(s,o,a,l){function c(u,f){vc(s,u,function(d){return this._invoke(u,f,d)})}o?r?r(s,o,{value:a,enumerable:!l,configurable:!l,writable:!l}):s[o]=a:(c("next",0),c("throw",1),c("return",2))},vc(i,e,t,n)}function HV(i,e){return HV=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},HV(i,e)}function Lr(i,e){return QPe(i)||sLe(i,e)||Zoe(i,e)||oLe()}function hLe(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=Nx(i))!==null;);return i}function kV(i,e,t,n){var r=GV(Nx(i.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function tr(i){return JPe(i)||rLe(i)||Zoe(i)||aLe()}function fLe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Yoe(i){var e=fLe(i,"string");return typeof e=="symbol"?e:e+""}function Zoe(i,e){if(i){if(typeof i=="string")return VV(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?VV(i,e):void 0}}var Koe=function(e){e instanceof Array?e.forEach(Koe):(e.map&&e.map.dispose(),e.dispose())},Rm=function(e){e.geometry&&e.geometry.dispose(),e.material&&Koe(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(Rm)},is=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),Rm(t)}};function nl(i,e){var t=new e;return{linkProp:function(r){return{default:t[r](),onChange:function(o,a){a[i][r](o)},triggerUpdate:!1}},linkMethod:function(r){return function(s){for(var o=s[i],a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];var u=o[r].apply(o,l);return u===o?this:u}}}}var _r=100;function koe(){return _r}function uu(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180,s=_r*(1+t),o=Math.sin(n);return{x:s*o*Math.cos(r),y:s*Math.cos(n),z:s*o*Math.sin(r)}}function Qoe(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),o=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-o*180/Math.PI-(o<-Math.PI/2?360:0),altitude:r/_r-1}}function m1(i){return i*Math.PI/180}var WS=window.THREE?window.THREE:{BackSide:mi,BufferAttribute:Hi,Color:zt,Mesh:Hn,ShaderMaterial:ps},dLe=`5096+ `};var Rf=class extends ds{constructor(e){super({type:"LineMaterial",uniforms:dg.clone(Ha.line.uniforms),vertexShader:Ha.line.vertexShader,fragmentShader:Ha.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0!==this.worldUnits&&(this.needsUpdate=!0),e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}};var NV=new xn,Roe=new re,Poe=new re,Qo=new xn,Jo=new xn,Pf=new xn,FV=new re,BV=new cn,ea=new cb,Ioe=new re,qP=new ka,HP=new yl,If=new xn,Lf,f1;function Loe(i,e,t){return If.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),If.multiplyScalar(1/If.w),If.x=f1/t.width,If.y=f1/t.height,If.applyMatrix4(i.projectionMatrixInverse),If.multiplyScalar(1/If.w),Math.abs(Math.max(If.x,If.y))}function WIe(i,e){let t=i.matrixWorld,n=i.geometry,r=n.attributes.instanceStart,s=n.attributes.instanceEnd,o=Math.min(n.instanceCount,r.count);for(let a=0,l=o;a<l;a++){ea.start.fromBufferAttribute(r,a),ea.end.fromBufferAttribute(s,a),ea.applyMatrix4(t);let c=new re,u=new re;Lf.distanceSqToSegment(ea.start,ea.end,u,c),u.distanceTo(c)<f1*.5&&e.push({point:u,pointOnLine:c,distance:Lf.origin.distanceTo(u),object:i,face:null,faceIndex:a,uv:null,uv1:null})}}function jIe(i,e,t){let n=e.projectionMatrix,s=i.material.resolution,o=i.matrixWorld,a=i.geometry,l=a.attributes.instanceStart,c=a.attributes.instanceEnd,u=Math.min(a.instanceCount,l.count),f=-e.near;Lf.at(1,Pf),Pf.w=1,Pf.applyMatrix4(e.matrixWorldInverse),Pf.applyMatrix4(n),Pf.multiplyScalar(1/Pf.w),Pf.x*=s.x/2,Pf.y*=s.y/2,Pf.z=0,FV.copy(Pf),BV.multiplyMatrices(e.matrixWorldInverse,o);for(let d=0,A=u;d<A;d++){if(Qo.fromBufferAttribute(l,d),Jo.fromBufferAttribute(c,d),Qo.w=1,Jo.w=1,Qo.applyMatrix4(BV),Jo.applyMatrix4(BV),Qo.z>f&&Jo.z>f)continue;if(Qo.z>f){let I=Qo.z-Jo.z,P=(Qo.z-f)/I;Qo.lerp(Jo,P)}else if(Jo.z>f){let I=Jo.z-Qo.z,P=(Jo.z-f)/I;Jo.lerp(Qo,P)}Qo.applyMatrix4(n),Jo.applyMatrix4(n),Qo.multiplyScalar(1/Qo.w),Jo.multiplyScalar(1/Jo.w),Qo.x*=s.x/2,Qo.y*=s.y/2,Jo.x*=s.x/2,Jo.y*=s.y/2,ea.start.copy(Qo),ea.start.z=0,ea.end.copy(Jo),ea.end.z=0;let w=ea.closestPointToPointParameter(FV,!0);ea.at(w,Ioe);let S=Bu.lerp(Qo.z,Jo.z,w),T=S>=-1&&S<=1,R=FV.distanceTo(Ioe)<f1*.5;if(T&&R){ea.start.fromBufferAttribute(l,d),ea.end.fromBufferAttribute(c,d),ea.start.applyMatrix4(o),ea.end.applyMatrix4(o);let I=new re,P=new re;Lf.distanceSqToSegment(ea.start,ea.end,P,I),t.push({point:P,pointOnLine:I,distance:Lf.origin.distanceTo(P),object:i,face:null,faceIndex:d,uv:null,uv1:null})}}}var WP=class extends Hn{constructor(e=new Ex,t=new Rf({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let o=0,a=0,l=t.count;o<l;o++,a+=2)Roe.fromBufferAttribute(t,o),Poe.fromBufferAttribute(n,o),r[a]=a===0?0:r[a-1],r[a+1]=r[a]+Roe.distanceTo(Poe);let s=new Lh(r,2,1);return e.setAttribute("instanceDistanceStart",new Vo(s,1,0)),e.setAttribute("instanceDistanceEnd",new Vo(s,1,1)),this}raycast(e,t){let n=this.material.worldUnits,r=e.camera;if(r===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),n===!1&&(this.material.resolution.x===0||this.material.resolution.y===0))return;let s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Lf=e.ray;let o=this.matrixWorld,a=this.geometry,l=this.material;f1=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),HP.copy(a.boundingSphere).applyMatrix4(o);let c;if(n)c=f1*.5;else{let f=Math.max(r.near,HP.distanceToPoint(Lf.origin));c=Loe(r,f,l.resolution)}if(HP.radius+=c,Lf.intersectsSphere(HP)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),qP.copy(a.boundingBox).applyMatrix4(o);let u;if(n)u=f1*.5;else{let f=Math.max(r.near,qP.distanceToPoint(Lf.origin));u=Loe(r,f,l.resolution)}qP.expandByScalar(u),Lf.intersectsBox(qP)!==!1&&(n?WIe(this,t):jIe(this,r,t))}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(NV),this.material.uniforms.resolution.value.set(NV.z,NV.w))}};var Tm=class extends Ex{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setColors(n),this}setFromPoints(e){let t=e.length-1,n=new Float32Array(6*t);for(let r=0;r<t;r++)n[6*r]=e[r].x,n[6*r+1]=e[r].y,n[6*r+2]=e[r].z||0,n[6*r+3]=e[r+1].x,n[6*r+4]=e[r+1].y,n[6*r+5]=e[r+1].z||0;return super.setPositions(n),this}fromLine(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}};var Mx=class extends WP{constructor(e=new Tm,t=new Rf({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}};var Cx=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,n="ltr"){let r=[],s=XIe(e,t,this.data,n);for(let o=0,a=s.length;o<a;o++)r.push(...s[o].toShapes());return r}};function XIe(i,e,t,n){let r=Array.from(i),s=e/t.resolution,o=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*s,a=[],l=0,c=0;(n=="rtl"||n=="tb")&&r.reverse();for(let u=0;u<r.length;u++){let f=r[u];if(f===`5097+`)l=0,c-=o;else{let d=$Ie(f,s,l,c,t);n=="tb"?(l=0,c+=t.ascender*s):l+=d.offsetX,a.push(d.path)}}return a}function $Ie(i,e,t,n,r){let s=r.glyphs[i]||r.glyphs["?"];if(!s){console.error('THREE.Font: character "'+i+'" does not exists in font family '+r.familyName+".");return}let o=new ub,a,l,c,u,f,d,A,y;if(s.o){let w=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let S=0,T=w.length;S<T;)switch(w[S++]){case"m":a=w[S++]*e+t,l=w[S++]*e+n,o.moveTo(a,l);break;case"l":a=w[S++]*e+t,l=w[S++]*e+n,o.lineTo(a,l);break;case"q":c=w[S++]*e+t,u=w[S++]*e+n,f=w[S++]*e+t,d=w[S++]*e+n,o.quadraticCurveTo(f,d,c,u);break;case"b":c=w[S++]*e+t,u=w[S++]*e+n,f=w[S++]*e+t,d=w[S++]*e+n,A=w[S++]*e+t,y=w[S++]*e+n,o.bezierCurveTo(f,d,A,y,c,u);break}}return{offsetX:s.ha*e,path:o}}var kS=class i extends j2{constructor(e,t={}){let n=t.font;if(n===void 0)super();else{let r=n.generateShapes(e,t.size,t.direction);t.depth===void 0&&(t.depth=50),t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),super(r,t)}this.type="TextGeometry"}toJSON(){return super.toJSON()}static fromJSON(e){let t=e.options;return t.font=new Cx(t.font.data),new i(t.text,t)}};function VV(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function YIe(i){if(Array.isArray(i))return i}function ZIe(i){if(Array.isArray(i))return VV(i)}function Hoe(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function KIe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Doe(i,e,t,n,r,s,o){try{var a=i[s](o),l=a.value}catch(c){return void t(c)}a.done?e(l):Promise.resolve(l).then(n,r)}function QIe(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){Doe(s,n,r,o,a,"next",l)}function a(l){Doe(s,n,r,o,a,"throw",l)}o(void 0)})}}function QP(i,e,t){return e=Lx(e),aLe(i,XV()?Reflect.construct(e,t||[],Lx(i).constructor):e.apply(i,t))}function JIe(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function JP(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function zS(i,e){return i.get(Hoe(i,e))}function OV(i,e,t){JIe(i,e),e.set(i,t)}function UV(i,e,t){return i.set(Hoe(i,e),t),t}function jV(i,e,t){if(XV())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return r}function eLe(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,Woe(n.key),n)}}function eI(i,e,t){return e&&eLe(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Eo(i,e,t){return(e=Woe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function GV(){return GV=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,t){var n=lLe(i,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?i:t):r.value}},GV.apply(null,arguments)}function Lx(i){return Lx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Lx(i)}function tI(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&HV(i,e)}function XV(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(XV=function(){return!!i})()}function tLe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function nLe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function iLe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5098+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rLe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5099+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Noe(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function $i(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Noe(Object(t),!0).forEach(function(n){Eo(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Noe(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function sLe(i,e){if(i==null)return{};var t,n,r=oLe(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function oLe(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function aLe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return KIe(i)}function qV(){var i,e,t=typeof Symbol=="function"?Symbol:{},n=t.iterator||"@@iterator",r=t.toStringTag||"@@toStringTag";function s(A,y,w,S){var T=y&&y.prototype instanceof a?y:a,R=Object.create(T.prototype);return Ac(R,"_invoke",(function(I,P,F){var D,L,C,B=0,k=F||[],z=!1,G={p:0,n:0,v:i,a:W,f:W.bind(i,4),d:function(Y,H){return D=Y,L=0,C=i,G.n=H,o}};function W(Y,H){for(L=Y,C=H,e=0;!z&&B&&!$&&e<k.length;e++){var $,J=k[e],te=G.p,ce=J[2];Y>3?($=ce===H)&&(C=J[(L=J[4])?5:(L=3,3)],J[4]=J[5]=i):J[0]<=te&&(($=Y<2&&te<J[1])?(L=0,G.v=H,G.n=J[1]):te<ce&&($=Y<3||J[0]>H||H>ce)&&(J[4]=Y,J[5]=H,G.n=ce,L=0))}if($||Y>1)return o;throw z=!0,H}return function(Y,H,$){if(B>1)throw TypeError("Generator is already running");for(z&&H===1&&W(H,$),L=H,C=$;(e=L<2?i:C)||!z;){D||(L?L<3?(L>1&&(G.n=-1),W(L,C)):G.n=C:G.v=C);try{if(B=2,D){if(L||(Y="next"),e=D[Y]){if(!(e=e.call(D,C)))throw TypeError("iterator result is not an object");if(!e.done)return e;C=e.value,L<2&&(L=0)}else L===1&&(e=D.return)&&e.call(D),L<2&&(C=TypeError("The iterator does not provide a '"+Y+"' method"),L=1);D=i}else if((e=(z=G.n<0)?C:I.call(P,G))!==o)break}catch(J){D=i,L=1,C=J}finally{B=1}}return{value:e,done:z}}})(A,w,S),!0),R}var o={};function a(){}function l(){}function c(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(Ac(e={},n,function(){return this}),e),f=c.prototype=a.prototype=Object.create(u);function d(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,c):(A.__proto__=c,Ac(A,r,"GeneratorFunction")),A.prototype=Object.create(f),A}return l.prototype=c,Ac(f,"constructor",c),Ac(c,"constructor",l),l.displayName="GeneratorFunction",Ac(c,r,"GeneratorFunction"),Ac(f),Ac(f,r,"Generator"),Ac(f,n,function(){return this}),Ac(f,"toString",function(){return"[object Generator]"}),(qV=function(){return{w:s,m:d}})()}function Ac(i,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}Ac=function(s,o,a,l){function c(u,f){Ac(s,u,function(d){return this._invoke(u,f,d)})}o?r?r(s,o,{value:a,enumerable:!l,configurable:!l,writable:!l}):s[o]=a:(c("next",0),c("throw",1),c("return",2))},Ac(i,e,t,n)}function HV(i,e){return HV=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},HV(i,e)}function Ir(i,e){return YIe(i)||nLe(i,e)||joe(i,e)||iLe()}function lLe(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=Lx(i))!==null;);return i}function kV(i,e,t,n){var r=GV(Lx(i.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function tr(i){return ZIe(i)||tLe(i)||joe(i)||rLe()}function cLe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Woe(i){var e=cLe(i,"string");return typeof e=="symbol"?e:e+""}function joe(i,e){if(i){if(typeof i=="string")return VV(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?VV(i,e):void 0}}var Xoe=function(e){e instanceof Array?e.forEach(Xoe):(e.map&&e.map.dispose(),e.dispose())},Cm=function(e){e.geometry&&e.geometry.dispose(),e.material&&Xoe(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(Cm)},is=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),Cm(t)}};function nl(i,e){var t=new e;return{linkProp:function(r){return{default:t[r](),onChange:function(o,a){a[i][r](o)},triggerUpdate:!1}},linkMethod:function(r){return function(s){for(var o=s[i],a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];var u=o[r].apply(o,l);return u===o?this:u}}}}var _r=100;function Foe(){return _r}function ou(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180,s=_r*(1+t),o=Math.sin(n);return{x:s*o*Math.cos(r),y:s*Math.cos(n),z:s*o*Math.sin(r)}}function $oe(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),o=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-o*180/Math.PI-(o<-Math.PI/2?360:0),altitude:r/_r-1}}function p1(i){return i*Math.PI/180}var GS=window.THREE?window.THREE:{BackSide:mi,BufferAttribute:Hi,Color:zt,Mesh:Hn,ShaderMaterial:ds},uLe=`51005100 uniform float hollowRadius;51015101 51025102 varying vec3 vVertexWorldPosition;
@@ -5116,7 +5116,7 @@ void main() {
51165116 vVertexAngularDistanceToHollowRadius = vertexAngle - edgeAngle;51175117 51185118 gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);5119-}`,pLe=`5119+}`,hLe=`51205120 uniform vec3 color;51215121 uniform float coefficient;51225122 uniform float power;
@@ -5139,7 +5139,7 @@ void main() {
51395139 power51405140 );51415141 gl_FragColor = vec4(color, intensity);5142-}`;function mLe(i,e,t,n){return new WS.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:dLe,fragmentShader:pLe,uniforms:{coefficient:{value:i},color:{value:new WS.Color(e)},power:{value:t},hollowRadius:{value:n}}})}function ALe(i,e){for(var t=i.clone(),n=new Float32Array(i.attributes.position.count*3),r=0,s=n.length;r<s;r++){var o=i.attributes.normal.array[r],a=i.attributes.position.array[r];n[r]=a+o*e}return t.setAttribute("position",new WS.BufferAttribute(n,3)),t}var gLe=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.color,o=s===void 0?"gold":s,a=r.size,l=a===void 0?2:a,c=r.coefficient,u=c===void 0?.5:c,f=r.power,d=f===void 0?1:f,A=r.hollowRadius,y=A===void 0?0:A,w=r.backside,S=w===void 0?!0:w;rP(this,e),n=iP(this,e);var T=ALe(t,l),R=mLe(u,o,d,y);return S&&(R.side=WS.BackSide),n.geometry=T,n.material=R,n}return oP(e,i),sP(e)})(WS.Mesh),Of=window.THREE?window.THREE:{Color:zt,Group:Or,LineBasicMaterial:Fu,LineSegments:t_,Mesh:Hn,MeshPhongMaterial:KA,SphereGeometry:Va,SRGBColorSpace:Br,TextureLoader:wl},Joe=Qr({props:{globeImageUrl:{},bumpImageUrl:{},showGlobe:{default:!0,onChange:function(e,t){t.globeGroup.visible=!!e},triggerUpdate:!1},showGraticules:{default:!1,onChange:function(e,t){t.graticulesObj.visible=!!e},triggerUpdate:!1},showAtmosphere:{default:!0,onChange:function(e,t){t.atmosphereObj&&(t.atmosphereObj.visible=!!e)},triggerUpdate:!1},atmosphereColor:{default:"lightskyblue"},atmosphereAltitude:{default:.15},globeCurvatureResolution:{default:4},globeTileEngineUrl:{onChange:function(e,t){t.tileEngine.tileUrl=e}},globeTileEngineMaxLevel:{default:17,onChange:function(e,t){t.tileEngine.maxLevel=e},triggerUpdate:!1},updatePov:{onChange:function(e,t){t.tileEngine.updatePov(e)},triggerUpdate:!1},onReady:{default:function(){},triggerUpdate:!1}},methods:{globeMaterial:function(e,t){return t!==void 0?(e.globeObj.material=t||e.defaultGlobeMaterial,this):e.globeObj.material},globeTileEngineClearCache:function(e){e.tileEngine.clearTiles()},_destructor:function(e){Rm(e.globeObj),Rm(e.tileEngine),Rm(e.graticulesObj)}},stateInit:function(){var e=new Of.MeshPhongMaterial({color:0}),t=new Of.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new PJ(_r),r=new Of.Group;r.__globeObjType="globe",r.add(t),r.add(n);var s=new Of.LineSegments(new uO(FB(),_r,2),new Of.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1}));return{globeGroup:r,globeObj:t,graticulesObj:s,defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){is(e),t.scene=e,t.scene.add(t.globeGroup),t.scene.add(t.graticulesObj),t.ready=!1},update:function(e,t){var n=e.globeObj.material;if(e.tileEngine.visible=!(e.globeObj.visible=!e.globeTileEngineUrl),t.hasOwnProperty("globeCurvatureResolution")){var r;(r=e.globeObj.geometry)===null||r===void 0||r.dispose();var s=Math.max(4,Math.round(360/e.globeCurvatureResolution));e.globeObj.geometry=new Of.SphereGeometry(_r,s,s/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?new Of.TextureLoader().load(e.globeImageUrl,function(a){var l;a.colorSpace=Of.SRGBColorSpace,(l=n.map)===null||l===void 0||l.dispose(),n.map=a,n.color=null,n.needsUpdate=!0,!e.ready&&(e.ready=!0)&&setTimeout(e.onReady)}):!n.color&&(n.color=new Of.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&new Of.TextureLoader().load(e.bumpImageUrl,function(a){var l;(l=n.bumpMap)===null||l===void 0||l.dispose(),n.bumpMap=a,n.needsUpdate=!0}):(n.bumpMap=null,n.needsUpdate=!0)),(t.hasOwnProperty("atmosphereColor")||t.hasOwnProperty("atmosphereAltitude"))&&(e.atmosphereObj&&(e.scene.remove(e.atmosphereObj),Rm(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var o=e.atmosphereObj=new gLe(e.globeObj.geometry,{color:e.atmosphereColor,size:_r*e.atmosphereAltitude,hollowRadius:_r,coefficient:.1,power:3.5});o.visible=!!e.showAtmosphere,o.__globeObjType="atmosphere",e.scene.add(o)}!e.ready&&(!e.globeImageUrl||e.globeTileEngineUrl)&&(e.ready=!0,e.onReady())}}),Uf=function(e){return isNaN(e)?parseInt(An(e).toHex(),16):e},sh=function(e){return e&&isNaN(e)?Gu(e).opacity:1},Im=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r,s=1,o=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.eE+-]+)\s*\)$/.exec(e.trim().toLowerCase());if(o){var a=o.slice(1),l=Lr(a,4),c=l[0],u=l[1],f=l[2],d=l[3];r=new zt("rgb(".concat(+c,",").concat(+u,",").concat(+f,")")),s=Math.min(+d,1)}else r=new zt(e);n&&r.convertLinearToSRGB();var A=r.toArray();return t?[].concat(tr(A),[s]):A};function vLe(i,e,t){return i.opacity=e,i.transparent=e<1,i.depthWrite=e>=1,i}var zoe=window.THREE?window.THREE:{BufferAttribute:Hi};function kf(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float32Array;if(e===1)return new zoe.BufferAttribute(new t(i),e);for(var n=new zoe.BufferAttribute(new t(i.length*e),e),r=0,s=i.length;r<s;r++)n.set(i[r],r*e);return n}function _Le(i){for(var e=i.itemSize,t=[],n=0;n<i.count;n++)t.push(i.array.slice(n*e,(n+1)*e));return t}var zV=new WeakMap,KI=new WeakMap,QI=new WeakMap,Dl=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.dataBindAttr,o=s===void 0?"__data":s,a=r.objBindAttr,l=a===void 0?"__threeObj":a,c=r.removeDelay,u=c===void 0?0:c;return rP(this,e),n=iP(this,e),Eo(n,"scene",void 0),OV(n,zV,void 0),OV(n,KI,void 0),OV(n,QI,void 0),n.scene=t,UV(zV,n,o),UV(KI,n,l),UV(QI,n,u),n.onRemoveObj(function(){}),n}return oP(e,i),sP(e,[{key:"onCreateObj",value:function(n){var r=this;return kV(e,"onCreateObj",this)([function(s){var o=n(s);return s[qS(KI,r)]=o,o[qS(zV,r)]=s,r.scene.add(o),o}]),this}},{key:"onRemoveObj",value:function(n){var r=this;return kV(e,"onRemoveObj",this)([function(s,o){var a=kV(e,"getData",r)([s]);n(s,o);var l=function(){r.scene.remove(s),Rm(s),delete a[qS(KI,r)]};qS(QI,r)?setTimeout(l,qS(QI,r)):l()}]),this}}])})(JJ),nh=window.THREE?window.THREE:{BufferGeometry:Xn,CylinderGeometry:XA,Matrix4:cn,Mesh:Hn,MeshLambertMaterial:Ga,Object3D:lr,Vector3:re},Voe=Object.assign({},Tw),Goe=Voe.BufferGeometryUtils||Voe,eae=Qr({props:{pointsData:{default:[]},pointLat:{default:"lat"},pointLng:{default:"lng"},pointColor:{default:function(){return"#ffffaa"}},pointAltitude:{default:.1},pointRadius:{default:.25},pointResolution:{default:12,triggerUpdate:!1},pointsMerge:{default:!1},pointsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Dl(e,{objBindAttr:"__threeObjPoint"})},update:function(e,t){var n=st(e.pointLat),r=st(e.pointLng),s=st(e.pointAltitude),o=st(e.pointRadius),a=st(e.pointColor),l=new nh.CylinderGeometry(1,1,1,e.pointResolution);l.applyMatrix4(new nh.Matrix4().makeRotationX(Math.PI/2)),l.applyMatrix4(new nh.Matrix4().makeTranslation(0,0,-.5));var c=2*Math.PI*_r/360,u={};if(!e.pointsMerge&&t.hasOwnProperty("pointsMerge")&&is(e.scene),e.dataMapper.scene=e.pointsMerge?new nh.Object3D:e.scene,e.dataMapper.onCreateObj(A).onUpdateObj(y).digest(e.pointsData),e.pointsMerge){var f=e.pointsData.length?(Goe.mergeGeometries||Goe.mergeBufferGeometries)(e.pointsData.map(function(w){var S=e.dataMapper.getObj(w),T=S.geometry.clone();S.updateMatrix(),T.applyMatrix4(S.matrix);var R=Im(a(w));return T.setAttribute("color",kf(Array(T.getAttribute("position").count).fill(R),4)),T})):new nh.BufferGeometry,d=new nh.Mesh(f,new nh.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0}));d.__globeObjType="points",d.__data=e.pointsData,e.dataMapper.clear(),is(e.scene),e.scene.add(d)}function A(){var w=new nh.Mesh(l);return w.__globeObjType="point",w}function y(w,S){var T=function(C){var B=w.__currentTargetD=C,k=B.r,z=B.alt,G=B.lat,W=B.lng;Object.assign(w.position,uu(G,W));var Y=e.pointsMerge?new nh.Vector3(0,0,0):e.scene.localToWorld(new nh.Vector3(0,0,0));w.lookAt(Y),w.scale.x=w.scale.y=Math.min(30,k)*c,w.scale.z=Math.max(z*_r,.1)},R={alt:+s(S),r:+o(S),lat:+n(S),lng:+r(S)},P=w.__currentTargetD||Object.assign({},R,{alt:-.001});if(Object.keys(R).some(function(L){return P[L]!==R[L]})&&(e.pointsMerge||!e.pointsTransitionDuration||e.pointsTransitionDuration<0?T(R):e.tweenGroup.add(new uo(P).to(R,e.pointsTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(T).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.pointsMerge){var I=a(S),F=I?sh(I):0,D=!!F;w.visible=D,D&&(u.hasOwnProperty(I)||(u[I]=new nh.MeshLambertMaterial({color:Uf(I),transparent:F<1,opacity:F})),w.material=u[I])}}}}),tae=function(){return{uniforms:{dashOffset:{value:0},dashSize:{value:1},gapSize:{value:0},dashTranslate:{value:0}},vertexShader:`5142+}`;function fLe(i,e,t,n){return new GS.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:uLe,fragmentShader:hLe,uniforms:{coefficient:{value:i},color:{value:new GS.Color(e)},power:{value:t},hollowRadius:{value:n}}})}function dLe(i,e){for(var t=i.clone(),n=new Float32Array(i.attributes.position.count*3),r=0,s=n.length;r<s;r++){var o=i.attributes.normal.array[r],a=i.attributes.position.array[r];n[r]=a+o*e}return t.setAttribute("position",new GS.BufferAttribute(n,3)),t}var pLe=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.color,o=s===void 0?"gold":s,a=r.size,l=a===void 0?2:a,c=r.coefficient,u=c===void 0?.5:c,f=r.power,d=f===void 0?1:f,A=r.hollowRadius,y=A===void 0?0:A,w=r.backside,S=w===void 0?!0:w;JP(this,e),n=QP(this,e);var T=dLe(t,l),R=fLe(u,o,d,y);return S&&(R.side=GS.BackSide),n.geometry=T,n.material=R,n}return tI(e,i),eI(e)})(GS.Mesh),Df=window.THREE?window.THREE:{Color:zt,Group:Br,LineBasicMaterial:Iu,LineSegments:Jv,Mesh:Hn,MeshPhongMaterial:ZA,SphereGeometry:Va,SRGBColorSpace:Fr,TextureLoader:bl},Yoe=Qr({props:{globeImageUrl:{},bumpImageUrl:{},showGlobe:{default:!0,onChange:function(e,t){t.globeGroup.visible=!!e},triggerUpdate:!1},showGraticules:{default:!1,onChange:function(e,t){t.graticulesObj.visible=!!e},triggerUpdate:!1},showAtmosphere:{default:!0,onChange:function(e,t){t.atmosphereObj&&(t.atmosphereObj.visible=!!e)},triggerUpdate:!1},atmosphereColor:{default:"lightskyblue"},atmosphereAltitude:{default:.15},globeCurvatureResolution:{default:4},globeTileEngineUrl:{onChange:function(e,t){t.tileEngine.tileUrl=e}},globeTileEngineMaxLevel:{default:17,onChange:function(e,t){t.tileEngine.maxLevel=e},triggerUpdate:!1},updatePov:{onChange:function(e,t){t.tileEngine.updatePov(e)},triggerUpdate:!1},onReady:{default:function(){},triggerUpdate:!1}},methods:{globeMaterial:function(e,t){return t!==void 0?(e.globeObj.material=t||e.defaultGlobeMaterial,this):e.globeObj.material},globeTileEngineClearCache:function(e){e.tileEngine.clearTiles()},_destructor:function(e){Cm(e.globeObj),Cm(e.tileEngine),Cm(e.graticulesObj)}},stateInit:function(){var e=new Df.MeshPhongMaterial({color:0}),t=new Df.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new MJ(_r),r=new Df.Group;r.__globeObjType="globe",r.add(t),r.add(n);var s=new Df.LineSegments(new uO(FB(),_r,2),new Df.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1}));return{globeGroup:r,globeObj:t,graticulesObj:s,defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){is(e),t.scene=e,t.scene.add(t.globeGroup),t.scene.add(t.graticulesObj),t.ready=!1},update:function(e,t){var n=e.globeObj.material;if(e.tileEngine.visible=!(e.globeObj.visible=!e.globeTileEngineUrl),t.hasOwnProperty("globeCurvatureResolution")){var r;(r=e.globeObj.geometry)===null||r===void 0||r.dispose();var s=Math.max(4,Math.round(360/e.globeCurvatureResolution));e.globeObj.geometry=new Df.SphereGeometry(_r,s,s/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?new Df.TextureLoader().load(e.globeImageUrl,function(a){var l;a.colorSpace=Df.SRGBColorSpace,(l=n.map)===null||l===void 0||l.dispose(),n.map=a,n.color=null,n.needsUpdate=!0,!e.ready&&(e.ready=!0)&&setTimeout(e.onReady)}):!n.color&&(n.color=new Df.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&new Df.TextureLoader().load(e.bumpImageUrl,function(a){var l;(l=n.bumpMap)===null||l===void 0||l.dispose(),n.bumpMap=a,n.needsUpdate=!0}):(n.bumpMap=null,n.needsUpdate=!0)),(t.hasOwnProperty("atmosphereColor")||t.hasOwnProperty("atmosphereAltitude"))&&(e.atmosphereObj&&(e.scene.remove(e.atmosphereObj),Cm(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var o=e.atmosphereObj=new pLe(e.globeObj.geometry,{color:e.atmosphereColor,size:_r*e.atmosphereAltitude,hollowRadius:_r,coefficient:.1,power:3.5});o.visible=!!e.showAtmosphere,o.__globeObjType="atmosphere",e.scene.add(o)}!e.ready&&(!e.globeImageUrl||e.globeTileEngineUrl)&&(e.ready=!0,e.onReady())}}),Nf=function(e){return isNaN(e)?parseInt(An(e).toHex(),16):e},th=function(e){return e&&isNaN(e)?Uu(e).opacity:1},Rm=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r,s=1,o=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.eE+-]+)\s*\)$/.exec(e.trim().toLowerCase());if(o){var a=o.slice(1),l=Ir(a,4),c=l[0],u=l[1],f=l[2],d=l[3];r=new zt("rgb(".concat(+c,",").concat(+u,",").concat(+f,")")),s=Math.min(+d,1)}else r=new zt(e);n&&r.convertLinearToSRGB();var A=r.toArray();return t?[].concat(tr(A),[s]):A};function mLe(i,e,t){return i.opacity=e,i.transparent=e<1,i.depthWrite=e>=1,i}var Boe=window.THREE?window.THREE:{BufferAttribute:Hi};function Ff(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float32Array;if(e===1)return new Boe.BufferAttribute(new t(i),e);for(var n=new Boe.BufferAttribute(new t(i.length*e),e),r=0,s=i.length;r<s;r++)n.set(i[r],r*e);return n}function ALe(i){for(var e=i.itemSize,t=[],n=0;n<i.count;n++)t.push(i.array.slice(n*e,(n+1)*e));return t}var zV=new WeakMap,jP=new WeakMap,XP=new WeakMap,Ll=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.dataBindAttr,o=s===void 0?"__data":s,a=r.objBindAttr,l=a===void 0?"__threeObj":a,c=r.removeDelay,u=c===void 0?0:c;return JP(this,e),n=QP(this,e),Eo(n,"scene",void 0),OV(n,zV,void 0),OV(n,jP,void 0),OV(n,XP,void 0),n.scene=t,UV(zV,n,o),UV(jP,n,l),UV(XP,n,u),n.onRemoveObj(function(){}),n}return tI(e,i),eI(e,[{key:"onCreateObj",value:function(n){var r=this;return kV(e,"onCreateObj",this)([function(s){var o=n(s);return s[zS(jP,r)]=o,o[zS(zV,r)]=s,r.scene.add(o),o}]),this}},{key:"onRemoveObj",value:function(n){var r=this;return kV(e,"onRemoveObj",this)([function(s,o){var a=kV(e,"getData",r)([s]);n(s,o);var l=function(){r.scene.remove(s),Cm(s),delete a[zS(jP,r)]};zS(XP,r)?setTimeout(l,zS(XP,r)):l()}]),this}}])})(YJ),Qu=window.THREE?window.THREE:{BufferGeometry:Xn,CylinderGeometry:jA,Matrix4:cn,Mesh:Hn,MeshLambertMaterial:Ga,Object3D:lr,Vector3:re},Ooe=Object.assign({},bw),Uoe=Ooe.BufferGeometryUtils||Ooe,Zoe=Qr({props:{pointsData:{default:[]},pointLat:{default:"lat"},pointLng:{default:"lng"},pointColor:{default:function(){return"#ffffaa"}},pointAltitude:{default:.1},pointRadius:{default:.25},pointResolution:{default:12,triggerUpdate:!1},pointsMerge:{default:!1},pointsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjPoint"})},update:function(e,t){var n=st(e.pointLat),r=st(e.pointLng),s=st(e.pointAltitude),o=st(e.pointRadius),a=st(e.pointColor),l=new Qu.CylinderGeometry(1,1,1,e.pointResolution);l.applyMatrix4(new Qu.Matrix4().makeRotationX(Math.PI/2)),l.applyMatrix4(new Qu.Matrix4().makeTranslation(0,0,-.5));var c=2*Math.PI*_r/360,u={};if(!e.pointsMerge&&t.hasOwnProperty("pointsMerge")&&is(e.scene),e.dataMapper.scene=e.pointsMerge?new Qu.Object3D:e.scene,e.dataMapper.onCreateObj(A).onUpdateObj(y).digest(e.pointsData),e.pointsMerge){var f=e.pointsData.length?(Uoe.mergeGeometries||Uoe.mergeBufferGeometries)(e.pointsData.map(function(w){var S=e.dataMapper.getObj(w),T=S.geometry.clone();S.updateMatrix(),T.applyMatrix4(S.matrix);var R=Rm(a(w));return T.setAttribute("color",Ff(Array(T.getAttribute("position").count).fill(R),4)),T})):new Qu.BufferGeometry,d=new Qu.Mesh(f,new Qu.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0}));d.__globeObjType="points",d.__data=e.pointsData,e.dataMapper.clear(),is(e.scene),e.scene.add(d)}function A(){var w=new Qu.Mesh(l);return w.__globeObjType="point",w}function y(w,S){var T=function(C){var B=w.__currentTargetD=C,k=B.r,z=B.alt,G=B.lat,W=B.lng;Object.assign(w.position,ou(G,W));var Y=e.pointsMerge?new Qu.Vector3(0,0,0):e.scene.localToWorld(new Qu.Vector3(0,0,0));w.lookAt(Y),w.scale.x=w.scale.y=Math.min(30,k)*c,w.scale.z=Math.max(z*_r,.1)},R={alt:+s(S),r:+o(S),lat:+n(S),lng:+r(S)},I=w.__currentTargetD||Object.assign({},R,{alt:-.001});if(Object.keys(R).some(function(L){return I[L]!==R[L]})&&(e.pointsMerge||!e.pointsTransitionDuration||e.pointsTransitionDuration<0?T(R):e.tweenGroup.add(new uo(I).to(R,e.pointsTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(T).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.pointsMerge){var P=a(S),F=P?th(P):0,D=!!F;w.visible=D,D&&(u.hasOwnProperty(P)||(u[P]=new Qu.MeshLambertMaterial({color:Nf(P),transparent:F<1,opacity:F})),w.material=u[P])}}}}),Koe=function(){return{uniforms:{dashOffset:{value:0},dashSize:{value:1},gapSize:{value:0},dashTranslate:{value:0}},vertexShader:`51435143 `.concat(kn.common,`51445144 `).concat(kn.logdepthbuf_pars_vertex,`51455145
@@ -5187,7 +5187,7 @@ varying vec3 vPos;
51875187 varying float vSurfaceRadius;51885188 varying vec3 vPos;51895189 `+e.fragmentShader).replace("void main() {",["void main() {","if (length(vPos) < max(uSurfaceRadius, vSurfaceRadius)) discard;"].join(`5190-`)),e},xLe=function(e){return e.vertexShader=`5190+`)),e},gLe=function(e){return e.vertexShader=`51915191 attribute float r;51925192 51935193 const float PI = 3.1415926535897932384626433832795;
@@ -5220,7 +5220,7 @@ varying vec3 vPos;
52205220 gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);52215221 }52225222 `),`5223- `),e},$V=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},yLe=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(r){return r};if(e.userData.shader)t(e.userData.shader.uniforms);else{var n=e.onBeforeCompile;e.onBeforeCompile=function(r){n(r),t(r.uniforms)}}},bLe=["stroke"],ih=window.THREE?window.THREE:{BufferGeometry:Xn,CubicBezierCurve3:s_,Curve:za,Group:Or,Line:a0,Mesh:Hn,NormalBlending:Ms,ShaderMaterial:ps,TubeGeometry:Z2,Vector3:re},wLe=A1.default.default||A1.default,nae=Qr({props:{arcsData:{default:[]},arcStartLat:{default:"startLat"},arcStartLng:{default:"startLng"},arcStartAltitude:{default:0},arcEndLat:{default:"endLat"},arcEndLng:{default:"endLng"},arcEndAltitude:{default:0},arcColor:{default:function(){return"#ffffaa"}},arcAltitude:{},arcAltitudeAutoScale:{default:.5},arcStroke:{},arcCurveResolution:{default:64,triggerUpdate:!1},arcCircularResolution:{default:6,triggerUpdate:!1},arcDashLength:{default:1},arcDashGap:{default:0},arcDashInitialGap:{default:0},arcDashAnimateTime:{default:0},arcsTransitionDuration:{default:1e3,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;e.sharedMaterial.dispose(),(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new wLe,sharedMaterial:new ih.ShaderMaterial($i($i({},tae()),{},{transparent:!0,blending:ih.NormalBlending}))}},init:function(e,t){is(e),t.scene=e,t.dataMapper=new Dl(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new ih.Group;return n.__globeObjType="arc",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=Lr(s,2),a=o[1];return a}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var o=s.children[0],a=o.__dashAnimateStep*r,l=o.material.uniforms.dashTranslate.value%1e9;o.material.uniforms.dashTranslate.value=l+a})})},update:function(e){var t=st(e.arcStartLat),n=st(e.arcStartLng),r=st(e.arcStartAltitude),s=st(e.arcEndLat),o=st(e.arcEndLng),a=st(e.arcEndAltitude),l=st(e.arcAltitude),c=st(e.arcAltitudeAutoScale),u=st(e.arcStroke),f=st(e.arcColor),d=st(e.arcDashLength),A=st(e.arcDashGap),y=st(e.arcDashInitialGap),w=st(e.arcDashAnimateTime);e.dataMapper.onUpdateObj(function(P,I){var F=u(I),D=F!=null;if(!P.children.length||D!==(P.children[0].type==="Mesh")){is(P);var L=D?new ih.Mesh:new ih.Line(new ih.BufferGeometry);L.material=e.sharedMaterial.clone(),P.add(L)}var C=P.children[0];Object.assign(C.material.uniforms,{dashSize:{value:d(I)},gapSize:{value:A(I)},dashOffset:{value:y(I)}});var B=w(I);C.__dashAnimateStep=B>0?1e3/B:0;var k=T(f(I),e.arcCurveResolution,D?e.arcCircularResolution+1:1),z=R(e.arcCurveResolution,D?e.arcCircularResolution+1:1,!0);C.geometry.setAttribute("color",k),C.geometry.setAttribute("relDistance",z);var G=function($){var J=P.__currentTargetD=$,te=J.stroke,ce=lLe(J,bLe),he=S(ce);D?(C.geometry&&C.geometry.dispose(),C.geometry=new ih.TubeGeometry(he,e.arcCurveResolution,te/2,e.arcCircularResolution),C.geometry.setAttribute("color",k),C.geometry.setAttribute("relDistance",z)):C.geometry.setFromPoints(he.getPoints(e.arcCurveResolution))},W={stroke:F,alt:l(I),altAutoScale:+c(I),startLat:+t(I),startLng:+n(I),startAlt:+r(I),endLat:+s(I),endLng:+o(I),endAlt:+a(I)},Y=P.__currentTargetD||Object.assign({},W,{altAutoScale:-.001});Object.keys(W).some(function(H){return Y[H]!==W[H]})&&(!e.arcsTransitionDuration||e.arcsTransitionDuration<0?G(W):e.tweenGroup.add(new uo(Y).to(W,e.arcsTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(G).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.arcsData);function S(P){var I=P.alt,F=P.altAutoScale,D=P.startLat,L=P.startLng,C=P.startAlt,B=P.endLat,k=P.endLng,z=P.endAlt,G=function(Ee){var Ve=Lr(Ee,3),Ye=Ve[0],Mt=Ve[1],Et=Ve[2],It=uu(Mt,Ye,Et),dn=It.x,Gt=It.y,$e=It.z;return new ih.Vector3(dn,Gt,$e)},W=[L,D],Y=[k,B],H=I;if(H==null&&(H=Cl(W,Y)/2*F+Math.max(C,z)),H||C||z){var $=Mg(W,Y),J=function(Ee,Ve){return Ve+(Ve-Ee)*(Ee<Ve?.5:.25)},te=[.25,.75].map(function(mt){return[].concat(tr($(mt)),[J(mt<.5?C:z,H)])}),ce=Lr(te,2),he=ce[0],ve=ce[1],Re=jV(ih.CubicBezierCurve3,tr([[].concat(W,[C]),he,ve,[].concat(Y,[z])].map(G)));return Re}else{var Qe=.001;return Fe.apply(void 0,tr([[].concat(W,[Qe]),[].concat(Y,[Qe])].map(G)))}function Fe(mt,Ee){var Ve=mt.angleTo(Ee),Ye=Ve===0?function(){return mt.clone()}:function(Et){return new ih.Vector3().addVectors(mt.clone().multiplyScalar(Math.sin((1-Et)*Ve)),Ee.clone().multiplyScalar(Math.sin(Et*Ve))).divideScalar(Math.sin(Ve))},Mt=new ih.Curve;return Mt.getPoint=Ye,Mt}}function T(P,I){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,D=I+1,L;if(P instanceof Array||P instanceof Function){var C=P instanceof Array?El().domain(P.map(function(H,$){return $/(P.length-1)})).range(P):P;L=function($){return Im(C($),!0,!0)}}else{var B=Im(P,!0,!0);L=function(){return B}}for(var k=[],z=0,G=D;z<G;z++)for(var W=L(z/(G-1)),Y=0;Y<F;Y++)k.push(W);return kf(k,4)}function R(P){for(var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,D=P+1,L=[],C=0,B=D;C<B;C++)for(var k=C/(B-1),z=0;z<I;z++)L.push(k);return F&&L.reverse(),kf(L,1)}}}),Mm=window.THREE?window.THREE:{BufferGeometry:Xn,DoubleSide:vr,Mesh:Hn,MeshLambertMaterial:Ga,Object3D:lr},qoe=Object.assign({},Tw),Hoe=qoe.BufferGeometryUtils||qoe,iae=Qr({props:{hexBinPointsData:{default:[]},hexBinPointLat:{default:"lat"},hexBinPointLng:{default:"lng"},hexBinPointWeight:{default:1},hexBinResolution:{default:4},hexMargin:{default:.2},hexTopCurvatureResolution:{default:5},hexTopColor:{default:function(){return"#ffffaa"}},hexSideColor:{default:function(){return"#ffffaa"}},hexAltitude:{default:function(e){var t=e.sumWeight;return t*.01}},hexBinMerge:{default:!1},hexTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Dl(e,{objBindAttr:"__threeObjHexbin"})},update:function(e,t){var n=st(e.hexBinPointLat),r=st(e.hexBinPointLng),s=st(e.hexBinPointWeight),o=st(e.hexAltitude),a=st(e.hexTopColor),l=st(e.hexSideColor),c=st(e.hexMargin),u=xee(e.hexBinPointsData.map(function(R){return $i($i({},R),{},{h3Idx:Dee(n(R),r(R),e.hexBinResolution)})}),"h3Idx"),f=Object.entries(u).map(function(R){var P=Lr(R,2),I=P[0],F=P[1];return{h3Idx:I,points:F,sumWeight:F.reduce(function(D,L){return D+ +s(L)},0)}}),d={};if(!e.hexBinMerge&&t.hasOwnProperty("hexBinMerge")&&is(e.scene),e.dataMapper.scene=e.hexBinMerge?new Mm.Object3D:e.scene,e.dataMapper.id(function(R){return R.h3Idx}).onCreateObj(S).onUpdateObj(T).digest(f),e.hexBinMerge){var A=f.length?(Hoe.mergeGeometries||Hoe.mergeBufferGeometries)(f.map(function(R){var P=e.dataMapper.getObj(R),I=P.geometry.toNonIndexed();P.updateMatrix(),I.applyMatrix4(P.matrix);var F=Im(a(R)),D=Im(l(R)),L=I.getAttribute("position").count,C=I.groups[0].count;return I.setAttribute("color",kf(tr(new Array(L)).map(function(B,k){return k>=C?F:D}),4)),I})):new Mm.BufferGeometry,y=new Mm.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:Mm.DoubleSide});y.onBeforeCompile=function(R){y.userData.shader=WV(R)};var w=new Mm.Mesh(A,y);w.__globeObjType="hexBinPoints",w.__data=f,e.dataMapper.clear(),is(e.scene),e.scene.add(w)}function S(R){var P=new Mm.Mesh;P.__hexCenter=LO(R.h3Idx),P.__hexGeoJson=DO(R.h3Idx,!0).reverse();var I=P.__hexCenter[1];return P.__hexGeoJson.forEach(function(F){var D=F[0];Math.abs(I-D)>170&&(F[0]+=I>D?360:-360)}),P.__globeObjType="hexbin",P}function T(R,P){var I=function(J,te,ce){return J-(J-te)*ce},F=Math.max(0,Math.min(1,+c(P))),D=Lr(R.__hexCenter,2),L=D[0],C=D[1],B=F===0?R.__hexGeoJson:R.__hexGeoJson.map(function($){var J=Lr($,2),te=J[0],ce=J[1];return[[te,C],[ce,L]].map(function(he){var ve=Lr(he,2),Re=ve[0],Qe=ve[1];return I(Re,Qe,F)})}),k=e.hexTopCurvatureResolution;R.geometry&&R.geometry.dispose(),R.geometry=new fR([B],0,_r,!1,!0,!0,k);var z={alt:+o(P)},G=function(J){var te=R.__currentTargetD=J,ce=te.alt;R.scale.x=R.scale.y=R.scale.z=1+ce;var he=_r/(ce+1);R.geometry.setAttribute("surfaceRadius",kf(Array(R.geometry.getAttribute("position").count).fill(he),1))},W=R.__currentTargetD||Object.assign({},z,{alt:-.001});if(Object.keys(z).some(function($){return W[$]!==z[$]})&&(e.hexBinMerge||!e.hexTransitionDuration||e.hexTransitionDuration<0?G(z):e.tweenGroup.add(new uo(W).to(z,e.hexTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(G).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.hexBinMerge){var Y=l(P),H=a(P);[Y,H].forEach(function($){if(!d.hasOwnProperty($)){var J=sh($);d[$]=$V(new Mm.MeshLambertMaterial({color:Uf($),transparent:J<1,opacity:J,side:Mm.DoubleSide}),WV)}}),R.material=[Y,H].map(function($){return d[$]})}}}}),rae=function(e){return e*e},sp=function(e){return e*Math.PI/180};function SLe(i,e){var t=Math.sqrt,n=Math.cos,r=function(u){return rae(Math.sin(u/2))},s=sp(i[1]),o=sp(e[1]),a=sp(i[0]),l=sp(e[0]);return 2*Math.asin(t(r(o-s)+n(s)*n(o)*r(l-a)))}var TLe=Math.sqrt(2*Math.PI);function ELe(i,e){return Math.exp(-rae(i/e)/2)/(e*TLe)}var MLe=function(e){var t=Lr(e,2),n=t[0],r=t[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=o.lngAccessor,l=a===void 0?function(S){return S[0]}:a,c=o.latAccessor,u=c===void 0?function(S){return S[1]}:c,f=o.weightAccessor,d=f===void 0?function(){return 1}:f,A=o.bandwidth,y=[n,r],w=A*Math.PI/180;return lC(s.map(function(S){var T=d(S);if(!T)return 0;var R=SLe(y,[l(S),u(S)]);return ELe(R,w)*T}))},CLe=(function(){var i=tLe(qV().m(function e(t){var n,r,s,o,a,l,c,u,f,d,A,y,w,S,T,R,P,I,F,D,L,C,B,k,z,G,W,Y,H,$,J,te,ce,he,ve,Re,Qe,Fe,mt,Ee,Ve=arguments,Ye,Mt,Et;return qV().w(function(It){for(;;)switch(It.n){case 0:if(r=Ve.length>1&&Ve[1]!==void 0?Ve[1]:[],s=Ve.length>2&&Ve[2]!==void 0?Ve[2]:{},o=s.lngAccessor,a=o===void 0?function(dn){return dn[0]}:o,l=s.latAccessor,c=l===void 0?function(dn){return dn[1]}:l,u=s.weightAccessor,f=u===void 0?function(){return 1}:u,d=s.bandwidth,(n=navigator)!==null&&n!==void 0&&n.gpu){It.n=1;break}return console.warn("WebGPU not enabled in browser. Please consider enabling it to improve performance."),It.a(2,t.map(function(dn){return MLe(dn,r,{lngAccessor:a,latAccessor:c,weightAccessor:f,bandwidth:d})}));case 1:return A=4,y=_oe,w=xoe,S=Poe,T=Ioe,R=Toe,P=Eoe,I=yoe,F=Roe,D=Coe,L=woe,C=boe,B=Soe,k=Moe,z=T(new o1(new Float32Array(t.flat().map(sp)),2),"vec2",t.length),G=T(new o1(new Float32Array(r.map(function(dn){return[sp(a(dn)),sp(c(dn)),f(dn)]}).flat()),3),"vec3",r.length),W=new o1(t.length,1),Y=T(W,"float",t.length),H=R(Math.PI),$=F(H.mul(2)),J=function(Gt){return Gt.mul(Gt)},te=function(Gt){return J(D(Gt.div(2)))},ce=function(Gt,$e){var ot=R(Gt[1]),nt=R($e[1]),bt=R(Gt[0]),yt=R($e[0]);return R(2).mul(C(F(te(nt.sub(ot)).add(L(ot).mul(L(nt)).mul(te(yt.sub(bt)))))))},he=function(Gt,$e){return B(k(J(Gt.div($e)).div(2))).div($e.mul($))},ve=S(sp(d)),Re=S(sp(d*A)),Qe=S(r.length),Fe=y(function(){var dn=z.element(P),Gt=Y.element(P);Gt.assign(0),I(Qe,function($e){var ot=$e.i,nt=G.element(ot),bt=nt.z;w(bt,function(){var yt=ce(nt.xy,dn.xy);w(yt&&yt.lessThan(Re),function(){Gt.addAssign(he(yt,ve).mul(bt))})})})}),mt=Fe().compute(t.length),Ee=new bx,It.n=2,Ee.computeAsync(mt);case 2:return Ye=Array,Mt=Float32Array,It.n=3,Ee.getArrayBufferAsync(W);case 3:return Et=It.v,It.a(2,Ye.from.call(Ye,new Mt(Et)))}},e)}));return function(t){return i.apply(this,arguments)}})(),JI=window.THREE?window.THREE:{Mesh:Hn,MeshLambertMaterial:Ga,SphereGeometry:Va},RLe=3.5,ILe=.1,Woe=100,PLe=function(e){var t=Gu(FO(e));return t.opacity=Math.cbrt(e),t.formatRgb()},sae=Qr({props:{heatmapsData:{default:[]},heatmapPoints:{default:function(e){return e}},heatmapPointLat:{default:function(e){return e[0]}},heatmapPointLng:{default:function(e){return e[1]}},heatmapPointWeight:{default:1},heatmapBandwidth:{default:2.5},heatmapColorFn:{default:function(){return PLe}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Dl(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var s=new JI.Mesh(new JI.SphereGeometry(_r),$V(new JI.MeshLambertMaterial({vertexColors:!0,transparent:!0}),xLe));return s.__globeObjType="heatmap",s})},update:function(e){var t=st(e.heatmapPoints),n=st(e.heatmapPointLat),r=st(e.heatmapPointLng),s=st(e.heatmapPointWeight),o=st(e.heatmapBandwidth),a=st(e.heatmapColorFn),l=st(e.heatmapColorSaturation),c=st(e.heatmapBaseAltitude),u=st(e.heatmapTopAltitude);e.dataMapper.onUpdateObj(function(f,d){var A=o(d),y=a(d),w=l(d),S=c(d),T=u(d),R=t(d).map(function(L){var C=n(L),B=r(L),k=uu(C,B),z=k.x,G=k.y,W=k.z;return{x:z,y:G,z:W,lat:C,lng:B,weight:s(L)}}),P=Math.max(ILe,A/RLe),I=Math.ceil(360/(P||-1));f.geometry.parameters.widthSegments!==I&&(f.geometry.dispose(),f.geometry=new JI.SphereGeometry(_r,I,I/2));var F=_Le(f.geometry.getAttribute("position")),D=F.map(function(L){var C=Lr(L,3),B=C[0],k=C[1],z=C[2],G=Qoe({x:B,y:k,z}),W=G.lng,Y=G.lat;return[W,Y]});CLe(D,R,{latAccessor:function(C){return C.lat},lngAccessor:function(C){return C.lng},weightAccessor:function(C){return C.weight},bandwidth:A}).then(function(L){var C=tr(new Array(Woe)).map(function(G,W){return Im(y(W/(Woe-1)))}),B=function(W){var Y=f.__currentTargetD=W,H=Y.kdeVals,$=Y.topAlt,J=Y.saturation,te=oC(H.map(Math.abs))||1e-15,ce=nw([0,te/J],C);f.geometry.setAttribute("color",kf(H.map(function(ve){return ce(Math.abs(ve))}),4));var he=El([0,te],[_r*(1+S),_r*(1+($||S))]);f.geometry.setAttribute("r",kf(H.map(he)))},k={kdeVals:L,topAlt:T,saturation:w},z=f.__currentTargetD||Object.assign({},k,{kdeVals:L.map(function(){return 0}),topAlt:T&&S,saturation:.5});z.kdeVals.length!==L.length&&(z.kdeVals=L.slice()),Object.keys(k).some(function(G){return z[G]!==k[G]})&&(!e.heatmapsTransitionDuration||e.heatmapsTransitionDuration<0?B(k):e.tweenGroup.add(new uo(z).to(k,e.heatmapsTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(B).onComplete(function(){e.tweenGroup.remove(this)}).start()))})}).digest(e.heatmapsData)}}),Cm=window.THREE?window.THREE:{DoubleSide:vr,Group:Or,LineBasicMaterial:Fu,LineSegments:t_,Mesh:Hn,MeshBasicMaterial:ds},oae=Qr({props:{polygonsData:{default:[]},polygonGeoJsonGeometry:{default:"geometry"},polygonSideColor:{default:function(){return"#ffffaa"}},polygonSideMaterial:{},polygonCapColor:{default:function(){return"#ffffaa"}},polygonCapMaterial:{},polygonStrokeColor:{},polygonAltitude:{default:.01},polygonCapCurvatureResolution:{default:5},polygonsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Dl(e,{objBindAttr:"__threeObjPolygon"}).id(function(s){return s.id}).onCreateObj(function(){var s=new Cm.Group;return s.__defaultSideMaterial=$V(new Cm.MeshBasicMaterial({side:Cm.DoubleSide,depthWrite:!0}),WV),s.__defaultCapMaterial=new Cm.MeshBasicMaterial({side:Cm.DoubleSide,depthWrite:!0}),s.add(new Cm.Mesh(void 0,[s.__defaultSideMaterial,s.__defaultCapMaterial])),s.add(new Cm.LineSegments(void 0,new Cm.LineBasicMaterial)),s.__globeObjType="polygon",s})},update:function(e){var t=st(e.polygonGeoJsonGeometry),n=st(e.polygonAltitude),r=st(e.polygonCapCurvatureResolution),s=st(e.polygonCapColor),o=st(e.polygonCapMaterial),a=st(e.polygonSideColor),l=st(e.polygonSideMaterial),c=st(e.polygonStrokeColor),u=[];e.polygonsData.forEach(function(f){var d={data:f,capColor:s(f),capMaterial:o(f),sideColor:a(f),sideMaterial:l(f),strokeColor:c(f),altitude:+n(f),capCurvatureResolution:+r(f)},A=t(f),y=f.__id||"".concat(Math.round(Math.random()*1e9));f.__id=y,A.type==="Polygon"?u.push($i({id:"".concat(y,"_0"),coords:A.coordinates},d)):A.type==="MultiPolygon"?u.push.apply(u,tr(A.coordinates.map(function(w,S){return $i({id:"".concat(y,"_").concat(S),coords:w},d)}))):console.warn("Unsupported GeoJson geometry type: ".concat(A.type,". Skipping geometry..."))}),e.dataMapper.onUpdateObj(function(f,d){var A=d.coords,y=d.capColor,w=d.capMaterial,S=d.sideColor,T=d.sideMaterial,R=d.strokeColor,P=d.altitude,I=d.capCurvatureResolution,F=Lr(f.children,2),D=F[0],L=F[1],C=!!R;L.visible=C;var B=!!(y||w),k=!!(S||T);LLe(D.geometry.parameters||{},{polygonGeoJson:A,curvatureResolution:I,closedTop:B,includeSides:k})||(D.geometry&&D.geometry.dispose(),D.geometry=new fR(A,0,_r,!1,B,k,I)),C&&(!L.geometry.parameters||L.geometry.parameters.geoJson.coordinates!==A||L.geometry.parameters.resolution!==I)&&(L.geometry&&L.geometry.dispose(),L.geometry=new uO({type:"Polygon",coordinates:A},_r,I));var z=k?0:-1,G=B?k?1:0:-1;if(z>=0&&(D.material[z]=T||f.__defaultSideMaterial),G>=0&&(D.material[G]=w||f.__defaultCapMaterial),[[!T&&S,z],[!w&&y,G]].forEach(function(te){var ce=Lr(te,2),he=ce[0],ve=ce[1];if(!(!he||ve<0)){var Re=D.material[ve],Qe=sh(he);Re.color.set(Uf(he)),Re.transparent=Qe<1,Re.opacity=Qe}}),C){var W=L.material,Y=sh(R);W.color.set(Uf(R)),W.transparent=Y<1,W.opacity=Y}var H={alt:P},$=function(ce){var he=f.__currentTargetD=ce,ve=he.alt;D.scale.x=D.scale.y=D.scale.z=1+ve,C&&(L.scale.x=L.scale.y=L.scale.z=1+ve+1e-4),yLe(f.__defaultSideMaterial,function(Re){return Re.uSurfaceRadius.value=_r/(ve+1)})},J=f.__currentTargetD||Object.assign({},H,{alt:-.001});Object.keys(H).some(function(te){return J[te]!==H[te]})&&(!e.polygonsTransitionDuration||e.polygonsTransitionDuration<0||J.alt===H.alt?$(H):e.tweenGroup.add(new uo(J).to(H,e.polygonsTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate($).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(u)}});function LLe(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return function(n,r){return n===r}};return Object.entries(e).every(function(n){var r=Lr(n,2),s=r[0],o=r[1];return i.hasOwnProperty(s)&&t(s)(i[s],o)})}var Px=window.THREE?window.THREE:{BufferGeometry:Xn,DoubleSide:vr,Mesh:Hn,MeshLambertMaterial:Ga,Vector3:re},joe=Object.assign({},Tw),Xoe=joe.BufferGeometryUtils||joe,aae=Qr({props:{hexPolygonsData:{default:[]},hexPolygonGeoJsonGeometry:{default:"geometry"},hexPolygonColor:{default:function(){return"#ffffaa"}},hexPolygonAltitude:{default:.001},hexPolygonResolution:{default:3},hexPolygonMargin:{default:.2},hexPolygonUseDots:{default:!1},hexPolygonCurvatureResolution:{default:5},hexPolygonDotResolution:{default:12},hexPolygonsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Dl(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var s=new Px.Mesh(void 0,new Px.MeshLambertMaterial({side:Px.DoubleSide}));return s.__globeObjType="hexPolygon",s})},update:function(e){var t=st(e.hexPolygonGeoJsonGeometry),n=st(e.hexPolygonColor),r=st(e.hexPolygonAltitude),s=st(e.hexPolygonResolution),o=st(e.hexPolygonMargin),a=st(e.hexPolygonUseDots),l=st(e.hexPolygonCurvatureResolution),c=st(e.hexPolygonDotResolution);e.dataMapper.onUpdateObj(function(u,f){var d=t(f),A=s(f),y=r(f),w=Math.max(0,Math.min(1,+o(f))),S=a(f),T=l(f),R=c(f),P=n(f),I=sh(P);u.material.color.set(Uf(P)),u.material.transparent=I<1,u.material.opacity=I;var F={alt:y,margin:w,curvatureResolution:T},D={geoJson:d,h3Res:A},L=u.__currentTargetD||Object.assign({},F,{alt:-.001}),C=u.__currentMemD||D;if(Object.keys(F).some(function(G){return L[G]!==F[G]})||Object.keys(D).some(function(G){return C[G]!==D[G]})){u.__currentMemD=D;var B=[];d.type==="Polygon"?NO(d.coordinates,A,!0).forEach(function(G){return B.push(G)}):d.type==="MultiPolygon"?d.coordinates.forEach(function(G){return NO(G,A,!0).forEach(function(W){return B.push(W)})}):console.warn("Unsupported GeoJson geometry type: ".concat(d.type,". Skipping geometry..."));var k=B.map(function(G){var W=LO(G),Y=DO(G,!0).reverse(),H=W[1];return Y.forEach(function($){var J=$[0];Math.abs(H-J)>170&&($[0]+=H>J?360:-360)}),{h3Idx:G,hexCenter:W,hexGeoJson:Y}}),z=function(W){var Y=u.__currentTargetD=W,H=Y.alt,$=Y.margin,J=Y.curvatureResolution;u.geometry&&u.geometry.dispose(),u.geometry=k.length?(Xoe.mergeGeometries||Xoe.mergeBufferGeometries)(k.map(function(te){var ce=Lr(te.hexCenter,2),he=ce[0],ve=ce[1];if(S){var Re=uu(he,ve,H),Qe=uu(te.hexGeoJson[0][1],te.hexGeoJson[0][0],H),Fe=.85*(1-$)*new Px.Vector3(Re.x,Re.y,Re.z).distanceTo(new Px.Vector3(Qe.x,Qe.y,Qe.z)),mt=new i_(Fe,R);return mt.rotateX(m1(-he)),mt.rotateY(m1(ve)),mt.translate(Re.x,Re.y,Re.z),mt}else{var Ee=function(Mt,Et,It){return Mt-(Mt-Et)*It},Ve=$===0?te.hexGeoJson:te.hexGeoJson.map(function(Ye){var Mt=Lr(Ye,2),Et=Mt[0],It=Mt[1];return[[Et,ve],[It,he]].map(function(dn){var Gt=Lr(dn,2),$e=Gt[0],ot=Gt[1];return Ee($e,ot,$)})});return new fR([Ve],_r,_r*(1+H),!1,!0,!1,J)}})):new Px.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?z(F):e.tweenGroup.add(new uo(L).to(F,e.hexPolygonsTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(z).onComplete(function(){e.tweenGroup.remove(this)}).start())}}).digest(e.hexPolygonsData)}}),DLe=window.THREE?window.THREE:{Vector3:re};function NLe(i,e){var t=function(o,a){var l=o[o.length-1];return[].concat(tr(o),tr(Array(a-o.length).fill(l)))},n=Math.max(i.length,e.length),r=ZF.apply(void 0,tr([i,e].map(function(s){return s.map(function(o){var a=o.x,l=o.y,c=o.z;return[a,l,c]})}).map(function(s){return t(s,n)})));return function(s){return s===0?i:s===1?e:r(s).map(function(o){var a=Lr(o,3),l=a[0],c=a[1],u=a[2];return new DLe.Vector3(l,c,u)})}}var p1=window.THREE?window.THREE:{BufferGeometry:Xn,Color:zt,Group:Or,Line:a0,NormalBlending:Ms,ShaderMaterial:ps,Vector3:re},FLe=A1.default.default||A1.default,lae=Qr({props:{pathsData:{default:[]},pathPoints:{default:function(e){return e}},pathPointLat:{default:function(e){return e[0]}},pathPointLng:{default:function(e){return e[1]}},pathPointAlt:{default:.001},pathResolution:{default:2},pathColor:{default:function(){return"#ffffaa"}},pathStroke:{},pathDashLength:{default:1},pathDashGap:{default:0},pathDashInitialGap:{default:0},pathDashAnimateTime:{default:0},pathTransitionDuration:{default:1e3,triggerUpdate:!1},rendererSize:{}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new FLe,sharedMaterial:new p1.ShaderMaterial($i($i({},tae()),{},{transparent:!0,blending:p1.NormalBlending}))}},init:function(e,t){is(e),t.scene=e,t.dataMapper=new Dl(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var n=new p1.Group;return n.__globeObjType="path",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=Lr(s,2),a=o[1];return a}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var o=s.children[0],a=o.__dashAnimateStep*r;if(o.type==="Line"){var l=o.material.uniforms.dashTranslate.value%1e9;o.material.uniforms.dashTranslate.value=l+a}else if(o.type==="Line2"){for(var c=o.material.dashOffset-a,u=o.material.dashSize+o.material.gapSize;c<=-u;)c+=u;o.material.dashOffset=c}})})},update:function(e){var t=st(e.pathPoints),n=st(e.pathPointLat),r=st(e.pathPointLng),s=st(e.pathPointAlt),o=st(e.pathStroke),a=st(e.pathColor),l=st(e.pathDashLength),c=st(e.pathDashGap),u=st(e.pathDashInitialGap),f=st(e.pathDashAnimateTime);e.dataMapper.onUpdateObj(function(S,T){var R=o(T),P=R!=null;if(!S.children.length||P===(S.children[0].type==="Line")){is(S);var I=P?new Rx(new Em,new Df):new p1.Line(new p1.BufferGeometry,e.sharedMaterial.clone());S.add(I)}var F=S.children[0],D=A(t(T),n,r,s,e.pathResolution),L=f(T);if(F.__dashAnimateStep=L>0?1e3/L:0,P){F.material.resolution=e.rendererSize;{var k=l(T),z=c(T),G=u(T);F.material.dashed=z>0,F.material.dashed?F.material.defines.USE_DASH="":delete F.material.defines.USE_DASH,F.material.dashed&&(F.material.dashScale=1/d(D),F.material.dashSize=k,F.material.gapSize=z,F.material.dashOffset=-G)}{var W=a(T);if(W instanceof Array){var Y=y(a(T),D.length-1,1,!1);F.geometry.setColors(Y.array),F.material.vertexColors=!0}else{var H=W,$=sh(H);F.material.color=new p1.Color(Uf(H)),F.material.transparent=$<1,F.material.opacity=$,F.material.vertexColors=!1}}F.material.needsUpdate=!0}else{Object.assign(F.material.uniforms,{dashSize:{value:l(T)},gapSize:{value:c(T)},dashOffset:{value:u(T)}});var C=y(a(T),D.length),B=w(D.length,1,!0);F.geometry.setAttribute("color",C),F.geometry.setAttribute("relDistance",B)}var J=NLe(S.__currentTargetD&&S.__currentTargetD.points||[D[0]],D),te=function(Re){var Qe=S.__currentTargetD=Re,Fe=Qe.stroke,mt=Qe.interpolK,Ee=S.__currentTargetD.points=J(mt);if(P){var Ve;F.geometry.setPositions((Ve=[]).concat.apply(Ve,tr(Ee.map(function(Ye){var Mt=Ye.x,Et=Ye.y,It=Ye.z;return[Mt,Et,It]})))),F.material.linewidth=Fe,F.material.dashed&&F.computeLineDistances()}else F.geometry.setFromPoints(Ee),F.geometry.computeBoundingSphere()},ce={stroke:R,interpolK:1},he=Object.assign({},S.__currentTargetD||ce,{interpolK:0});Object.keys(ce).some(function(ve){return he[ve]!==ce[ve]})&&(!e.pathTransitionDuration||e.pathTransitionDuration<0?te(ce):e.tweenGroup.add(new uo(he).to(ce,e.pathTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(te).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.pathsData);function d(S){var T=0,R;return S.forEach(function(P){R&&(T+=R.distanceTo(P)),R=P}),T}function A(S,T,R,P,I){var F=function(B,k,z){for(var G=[],W=1;W<=z;W++)G.push(B+(k-B)*W/(z+1));return G},D=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,z=[],G=null;return B.forEach(function(W){if(G){for(;Math.abs(G[1]-W[1])>180;)G[1]+=360*(G[1]<W[1]?1:-1);var Y=Math.sqrt(Math.pow(W[0]-G[0],2)+Math.pow(W[1]-G[1],2));if(Y>k)for(var H=Math.floor(Y/k),$=F(G[0],W[0],H),J=F(G[1],W[1],H),te=F(G[2],W[2],H),ce=0,he=$.length;ce<he;ce++)z.push([$[ce],J[ce],te[ce]])}z.push(G=W)}),z},L=function(B){var k=Lr(B,3),z=k[0],G=k[1],W=k[2],Y=uu(z,G,W),H=Y.x,$=Y.y,J=Y.z;return new p1.Vector3(H,$,J)};return D(S.map(function(C){return[T(C),R(C),P(C)]}),I).map(L)}function y(S,T){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,P=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,I=T+1,F;if(S instanceof Array||S instanceof Function){var D=S instanceof Array?El().domain(S.map(function(W,Y){return Y/(S.length-1)})).range(S):S;F=function(Y){return Im(D(Y),P,!0)}}else{var L=Im(S,P,!0);F=function(){return L}}for(var C=[],B=0,k=I;B<k;B++)for(var z=F(B/(k-1)),G=0;G<R;G++)C.push(z);return kf(C,P?4:3)}function w(S){for(var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,P=S+1,I=[],F=0,D=P;F<D;F++)for(var L=F/(D-1),C=0;C<T;C++)I.push(L);return R&&I.reverse(),kf(I,1)}}}),eP=window.THREE?window.THREE:{Euler:Ua,Mesh:Hn,MeshLambertMaterial:Ga,SphereGeometry:Va},cae=Qr({props:{tilesData:{default:[]},tileLat:{default:"lat"},tileLng:{default:"lng"},tileAltitude:{default:.01},tileWidth:{default:1},tileHeight:{default:1},tileUseGlobeProjection:{default:!0},tileMaterial:{default:function(){return new eP.MeshLambertMaterial({color:"#ffbb88",opacity:.4,transparent:!0})}},tileCurvatureResolution:{default:5},tilesTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Dl(e,{objBindAttr:"__threeObjTile"}).onCreateObj(function(){var s=new eP.Mesh;return s.__globeObjType="tile",s})},update:function(e){var t=st(e.tileLat),n=st(e.tileLng),r=st(e.tileAltitude),s=st(e.tileWidth),o=st(e.tileHeight),a=st(e.tileUseGlobeProjection),l=st(e.tileMaterial),c=st(e.tileCurvatureResolution);e.dataMapper.onUpdateObj(function(u,f){u.material=l(f);var d=a(f),A=c(f),y=function(R){var P=u.__currentTargetD=R,I=P.lat,F=P.lng,D=P.alt,L=P.width,C=P.height,B=Lx(F),k=Lx(-I);u.geometry&&u.geometry.dispose(),u.geometry=new eP.SphereGeometry(_r*(1+D),Math.ceil(L/(A||-1)),Math.ceil(C/(A||-1)),Lx(90-L/2)+(d?B:0),Lx(L),Lx(90-C/2)+(d?k:0),Lx(C)),d||u.setRotationFromEuler(new eP.Euler(k,B,0,"YXZ"))},w={lat:+t(f),lng:+n(f),alt:+r(f),width:+s(f),height:+o(f)},S=u.__currentTargetD||Object.assign({},w,{width:0,height:0});Object.keys(w).some(function(T){return S[T]!==w[T]})&&(!e.tilesTransitionDuration||e.tilesTransitionDuration<0?y(w):e.tweenGroup.add(new uo(S).to(w,e.tilesTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(y).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.tilesData)}}),Lx=function(e){return e*Math.PI/180},HS=window.THREE?window.THREE:{BufferGeometry:Xn,Color:zt,Points:U2,PointsMaterial:l0},uae=Qr({props:{particlesData:{default:[]},particlesList:{default:function(e){return e}},particleLat:{default:"lat"},particleLng:{default:"lng"},particleAltitude:{default:.01},particlesSize:{default:.5},particlesSizeAttenuation:{default:!0},particlesColor:{default:function(){return"white"}},particlesTexture:{}},init:function(e,t){is(e),t.scene=e,t.dataMapper=new Dl(e,{objBindAttr:"__threeObjParticles"}).onCreateObj(function(){var n=new HS.Points(new HS.BufferGeometry,new HS.PointsMaterial);return n.__globeObjType="particles",n}).onUpdateObj(function(n,r){var s=st(t.particlesList),o=st(t.particleLat),a=st(t.particleLng),l=st(t.particleAltitude);n.geometry.setAttribute("position",kf(s(r).map(function(c){return Object.values(uu(o(c),a(c),l(c)))}),3))})},update:function(e,t){["particlesData","particlesList","particleLat","particleLng","particleAltitude"].some(function(a){return t.hasOwnProperty(a)})&&e.dataMapper.digest(e.particlesData);var n=st(e.particlesColor),r=st(e.particlesSize),s=st(e.particlesSizeAttenuation),o=st(e.particlesTexture);e.dataMapper.entries().forEach(function(a){var l=Lr(a,2),c=l[0],u=l[1];if(u.material.size=r(c),u.material.sizeAttenuation=s(c),e.particlesTexture)u.material.color=new HS.Color(16777215),u.material.transparent=!1,u.material.alphaTest=.5,u.material.map=o(c);else{var f=n(c),d=sh(f);u.material.color=new HS.Color(Uf(f)),u.material.transparent=d<1,u.material.opacity=d,u.material.alphaTest=0}})}}),BLe=window.THREE?window.THREE:{BufferGeometry:Xn},OLe=(function(i){function e(){var t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:32;rP(this,e),t=iP(this,e),t.type="CircleLineGeometry",t.parameters={radius:n,segmentCount:r};for(var s=[],o=0;o<=r;o++){var a=(o/r-.25)*Math.PI*2;s.push({x:Math.cos(a)*n,y:Math.sin(a)*n,z:0})}return t.setFromPoints(s),t}return oP(e,i),sP(e)})(BLe.BufferGeometry),Dx=window.THREE?window.THREE:{Color:zt,Group:Or,Line:a0,LineBasicMaterial:Fu,Vector3:re},ULe=A1.default.default||A1.default,hae=Qr({props:{ringsData:{default:[]},ringLat:{default:"lat"},ringLng:{default:"lng"},ringAltitude:{default:.0015},ringColor:{default:function(){return"#ffffaa"},triggerUpdate:!1},ringResolution:{default:64,triggerUpdate:!1},ringMaxRadius:{default:2,triggerUpdate:!1},ringPropagationSpeed:{default:1,triggerUpdate:!1},ringRepeatPeriod:{default:700,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Dl(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var s=new Dx.Group;return s.__globeObjType="ring",s}),t.ticker=new ULe,t.ticker.onTick.add(function(s){if(t.ringsData.length){var o=st(t.ringColor),a=st(t.ringAltitude),l=st(t.ringMaxRadius),c=st(t.ringPropagationSpeed),u=st(t.ringRepeatPeriod);t.dataMapper.entries().filter(function(f){var d=Lr(f,2),A=d[1];return A}).forEach(function(f){var d=Lr(f,2),A=d[0],y=d[1];if((y.__nextRingTime||0)<=s){var w=u(A)/1e3;y.__nextRingTime=s+(w<=0?1/0:w);var S=new Dx.Line(new OLe(1,t.ringResolution),new Dx.LineBasicMaterial),T=o(A),R=T instanceof Array||T instanceof Function,P;R?T instanceof Array?(P=El().domain(T.map(function(z,G){return G/(T.length-1)})).range(T),S.material.transparent=T.some(function(z){return sh(z)<1})):(P=T,S.material.transparent=!0):(S.material.color=new Dx.Color(Uf(T)),vLe(S.material,sh(T)));var I=_r*(1+a(A)),F=l(A),D=F*Math.PI/180,L=c(A),C=L<=0,B=function(G){var W=G.t,Y=(C?1-W:W)*D;if(S.scale.x=S.scale.y=I*Math.sin(Y),S.position.z=I*(1-Math.cos(Y)),R){var H=P(W);S.material.color=new Dx.Color(Uf(H)),S.material.transparent&&(S.material.opacity=sh(H))}};if(L===0)B({t:0}),y.add(S);else{var k=Math.abs(F/L)*1e3;t.tweenGroup.add(new uo({t:0}).to({t:1},k).onUpdate(B).onStart(function(){return y.add(S)}).onComplete(function(){t.tweenGroup.remove(this),y.remove(S),Rm(S)}).start())}}})}})},update:function(e){var t=st(e.ringLat),n=st(e.ringLng),r=st(e.ringAltitude),s=e.scene.localToWorld(new Dx.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(o,a){var l=t(a),c=n(a),u=r(a);Object.assign(o.position,uu(l,c,u)),o.lookAt(s)}).digest(e.ringsData)}}),kLe={0:{x_min:73,x_max:715,ha:792,o:"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},1:{x_min:215.671875,x_max:574,ha:792,o:"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},2:{x_min:59,x_max:731,ha:792,o:"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},3:{x_min:54,x_max:737,ha:792,o:"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},4:{x_min:48,x_max:742.453125,ha:792,o:"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},5:{x_min:54.171875,x_max:738,ha:792,o:"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},6:{x_min:53,x_max:739,ha:792,o:"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},7:{x_min:58.71875,x_max:730.953125,ha:792,o:"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},8:{x_min:55,x_max:736,ha:792,o:"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},9:{x_min:53,x_max:739,ha:792,o:"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},\u03BF:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 96 88 192 -25 q 0 368 0 201 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 "},S:{x_min:0,x_max:788,ha:890,o:"m 788 291 q 662 54 788 144 q 397 -26 550 -26 q 116 68 226 -26 q 0 337 0 168 l 131 337 q 200 152 131 220 q 384 85 269 85 q 557 129 479 85 q 650 270 650 183 q 490 429 650 379 q 194 513 341 470 q 33 739 33 584 q 142 964 33 881 q 388 1041 242 1041 q 644 957 543 1041 q 756 716 756 867 l 625 716 q 561 874 625 816 q 395 933 497 933 q 243 891 309 933 q 164 759 164 841 q 325 609 164 656 q 625 526 475 568 q 788 291 788 454 "},"\xA6":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},"/":{x_min:183.25,x_max:608.328125,ha:792,o:"m 608 1041 l 266 -129 l 183 -129 l 520 1041 l 608 1041 "},\u03A4:{x_min:-.4375,x_max:777.453125,ha:839,o:"m 777 893 l 458 893 l 458 0 l 319 0 l 319 892 l 0 892 l 0 1013 l 777 1013 l 777 893 "},y:{x_min:0,x_max:684.78125,ha:771,o:"m 684 738 l 388 -83 q 311 -216 356 -167 q 173 -279 252 -279 q 97 -266 133 -279 l 97 -149 q 132 -155 109 -151 q 168 -160 155 -160 q 240 -114 213 -160 q 274 -26 248 -98 l 0 738 l 137 737 l 341 139 l 548 737 l 684 738 "},\u03A0:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 803 1012 l 803 0 "},\u0390:{x_min:-111,x_max:339,ha:361,o:"m 339 800 l 229 800 l 229 925 l 339 925 l 339 800 m -1 800 l -111 800 l -111 925 l -1 925 l -1 800 m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 m 302 1040 l 113 819 l 30 819 l 165 1040 l 302 1040 "},g:{x_min:0,x_max:686,ha:838,o:"m 686 34 q 586 -213 686 -121 q 331 -306 487 -306 q 131 -252 216 -306 q 31 -84 31 -190 l 155 -84 q 228 -174 166 -138 q 345 -207 284 -207 q 514 -109 454 -207 q 564 89 564 -27 q 461 6 521 36 q 335 -23 401 -23 q 88 100 184 -23 q 0 370 0 215 q 87 634 0 522 q 330 758 183 758 q 457 728 398 758 q 564 644 515 699 l 564 737 l 686 737 l 686 34 m 582 367 q 529 560 582 481 q 358 652 468 652 q 189 561 250 652 q 135 369 135 482 q 189 176 135 255 q 361 85 251 85 q 529 176 468 85 q 582 367 582 255 "},"\xB2":{x_min:0,x_max:442,ha:539,o:"m 442 383 l 0 383 q 91 566 0 492 q 260 668 176 617 q 354 798 354 727 q 315 875 354 845 q 227 905 277 905 q 136 869 173 905 q 99 761 99 833 l 14 761 q 82 922 14 864 q 232 974 141 974 q 379 926 316 974 q 442 797 442 878 q 351 635 442 704 q 183 539 321 611 q 92 455 92 491 l 442 455 l 442 383 "},"\u2013":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},\u039A:{x_min:0,x_max:819.5625,ha:893,o:"m 819 0 l 650 0 l 294 509 l 139 356 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},\u0192:{x_min:-46.265625,x_max:392,ha:513,o:"m 392 651 l 259 651 l 79 -279 l -46 -278 l 134 651 l 14 651 l 14 751 l 135 751 q 151 948 135 900 q 304 1041 185 1041 q 334 1040 319 1041 q 392 1034 348 1039 l 392 922 q 337 931 360 931 q 271 883 287 931 q 260 793 260 853 l 260 751 l 392 751 l 392 651 "},e:{x_min:0,x_max:714,ha:813,o:"m 714 326 l 140 326 q 200 157 140 227 q 359 87 260 87 q 488 130 431 87 q 561 245 545 174 l 697 245 q 577 48 670 123 q 358 -26 484 -26 q 97 85 195 -26 q 0 363 0 197 q 94 642 0 529 q 358 765 195 765 q 626 627 529 765 q 714 326 714 503 m 576 429 q 507 583 564 522 q 355 650 445 650 q 206 583 266 650 q 140 429 152 522 l 576 429 "},\u03CC:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 94 91 194 -25 q 0 368 0 202 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 m 576 1040 l 387 819 l 303 819 l 438 1040 l 576 1040 "},J:{x_min:0,x_max:588,ha:699,o:"m 588 279 q 287 -26 588 -26 q 58 73 126 -26 q 0 327 0 158 l 133 327 q 160 172 133 227 q 288 96 198 96 q 426 171 391 96 q 449 336 449 219 l 449 1013 l 588 1013 l 588 279 "},"\xBB":{x_min:-1,x_max:503,ha:601,o:"m 503 302 l 280 136 l 281 256 l 429 373 l 281 486 l 280 608 l 503 440 l 503 302 m 221 302 l 0 136 l 0 255 l 145 372 l 0 486 l -1 608 l 221 440 l 221 302 "},"\xA9":{x_min:-3,x_max:1008,ha:1106,o:"m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 741 394 q 661 246 731 302 q 496 190 591 190 q 294 285 369 190 q 228 497 228 370 q 295 714 228 625 q 499 813 370 813 q 656 762 588 813 q 733 625 724 711 l 634 625 q 589 704 629 673 q 498 735 550 735 q 377 666 421 735 q 334 504 334 597 q 374 340 334 408 q 490 272 415 272 q 589 304 549 272 q 638 394 628 337 l 741 394 "},\u03CE:{x_min:0,x_max:922,ha:1030,o:"m 687 1040 l 498 819 l 415 819 l 549 1040 l 687 1040 m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 338 0 202 q 45 551 0 444 q 161 737 84 643 l 302 737 q 175 552 219 647 q 124 336 124 446 q 155 179 124 248 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 341 797 257 q 745 555 797 450 q 619 737 705 637 l 760 737 q 874 551 835 640 q 922 339 922 444 "},"^":{x_min:193.0625,x_max:598.609375,ha:792,o:"m 598 772 l 515 772 l 395 931 l 277 772 l 193 772 l 326 1013 l 462 1013 l 598 772 "},"\xAB":{x_min:0,x_max:507.203125,ha:604,o:"m 506 136 l 284 302 l 284 440 l 506 608 l 507 485 l 360 371 l 506 255 l 506 136 m 222 136 l 0 302 l 0 440 l 222 608 l 221 486 l 73 373 l 222 256 l 222 136 "},D:{x_min:0,x_max:828,ha:935,o:"m 389 1013 q 714 867 593 1013 q 828 521 828 729 q 712 161 828 309 q 382 0 587 0 l 0 0 l 0 1013 l 389 1013 m 376 124 q 607 247 523 124 q 681 510 681 355 q 607 771 681 662 q 376 896 522 896 l 139 896 l 139 124 l 376 124 "},"\u2219":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},\u00FF:{x_min:0,x_max:47,ha:125,o:"m 47 3 q 37 -7 47 -7 q 28 0 30 -7 q 39 -4 32 -4 q 45 3 45 -1 l 37 0 q 28 9 28 0 q 39 19 28 19 l 47 16 l 47 19 l 47 3 m 37 1 q 44 8 44 1 q 37 16 44 16 q 30 8 30 16 q 37 1 30 1 m 26 1 l 23 22 l 14 0 l 3 22 l 3 3 l 0 25 l 13 1 l 22 25 l 26 1 "},w:{x_min:0,x_max:1009.71875,ha:1100,o:"m 1009 738 l 783 0 l 658 0 l 501 567 l 345 0 l 222 0 l 0 738 l 130 738 l 284 174 l 432 737 l 576 738 l 721 173 l 881 737 l 1009 738 "},$:{x_min:0,x_max:700,ha:793,o:"m 664 717 l 542 717 q 490 825 531 785 q 381 872 450 865 l 381 551 q 620 446 540 522 q 700 241 700 370 q 618 45 700 116 q 381 -25 536 -25 l 381 -152 l 307 -152 l 307 -25 q 81 62 162 -25 q 0 297 0 149 l 124 297 q 169 146 124 204 q 307 81 215 89 l 307 441 q 80 536 148 469 q 13 725 13 603 q 96 910 13 839 q 307 982 180 982 l 307 1077 l 381 1077 l 381 982 q 574 917 494 982 q 664 717 664 845 m 307 565 l 307 872 q 187 831 233 872 q 142 724 142 791 q 180 618 142 656 q 307 565 218 580 m 381 76 q 562 237 562 96 q 517 361 562 313 q 381 423 472 409 l 381 76 "},"\\":{x_min:-.015625,x_max:425.0625,ha:522,o:"m 425 -129 l 337 -129 l 0 1041 l 83 1041 l 425 -129 "},\u00B5:{x_min:0,x_max:697.21875,ha:747,o:"m 697 -4 q 629 -14 658 -14 q 498 97 513 -14 q 422 9 470 41 q 313 -23 374 -23 q 207 4 258 -23 q 119 81 156 32 l 119 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 173 124 246 q 308 83 216 83 q 452 178 402 83 q 493 359 493 255 l 493 738 l 617 738 l 617 214 q 623 136 617 160 q 673 92 637 92 q 697 96 684 92 l 697 -4 "},\u0399:{x_min:42,x_max:181,ha:297,o:"m 181 0 l 42 0 l 42 1013 l 181 1013 l 181 0 "},\u038E:{x_min:0,x_max:1144.5,ha:1214,o:"m 1144 1012 l 807 416 l 807 0 l 667 0 l 667 416 l 325 1012 l 465 1012 l 736 533 l 1004 1012 l 1144 1012 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"\u2019":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},\u039D:{x_min:0,x_max:801,ha:915,o:"m 801 0 l 651 0 l 131 822 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 191 l 670 1013 l 801 1013 l 801 0 "},"-":{x_min:8.71875,x_max:350.390625,ha:478,o:"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},Q:{x_min:0,x_max:968,ha:1072,o:"m 954 5 l 887 -79 l 744 35 q 622 -11 687 2 q 483 -26 556 -26 q 127 130 262 -26 q 0 504 0 279 q 127 880 0 728 q 484 1041 262 1041 q 841 884 708 1041 q 968 507 968 735 q 933 293 968 398 q 832 104 899 188 l 954 5 m 723 191 q 802 330 777 248 q 828 499 828 412 q 744 790 828 673 q 483 922 650 922 q 228 791 322 922 q 142 505 142 673 q 227 221 142 337 q 487 91 323 91 q 632 123 566 91 l 520 215 l 587 301 l 723 191 "},\u03C2:{x_min:1,x_max:676.28125,ha:740,o:"m 676 460 l 551 460 q 498 595 542 546 q 365 651 448 651 q 199 578 263 651 q 136 401 136 505 q 266 178 136 241 q 508 106 387 142 q 640 -50 640 62 q 625 -158 640 -105 q 583 -278 611 -211 l 465 -278 q 498 -182 490 -211 q 515 -80 515 -126 q 381 12 515 -15 q 134 91 197 51 q 1 388 1 179 q 100 651 1 542 q 354 761 199 761 q 587 680 498 761 q 676 460 676 599 "},M:{x_min:0,x_max:954,ha:1067,o:"m 954 0 l 819 0 l 819 869 l 537 0 l 405 0 l 128 866 l 128 0 l 0 0 l 0 1013 l 200 1013 l 472 160 l 757 1013 l 954 1013 l 954 0 "},\u03A8:{x_min:0,x_max:1006,ha:1094,o:"m 1006 678 q 914 319 1006 429 q 571 200 814 200 l 571 0 l 433 0 l 433 200 q 92 319 194 200 q 0 678 0 429 l 0 1013 l 139 1013 l 139 679 q 191 417 139 492 q 433 326 255 326 l 433 1013 l 571 1013 l 571 326 l 580 326 q 813 423 747 326 q 868 679 868 502 l 868 1013 l 1006 1013 l 1006 678 "},C:{x_min:0,x_max:886,ha:944,o:"m 886 379 q 760 87 886 201 q 455 -26 634 -26 q 112 136 236 -26 q 0 509 0 283 q 118 882 0 737 q 469 1041 245 1041 q 748 955 630 1041 q 879 708 879 859 l 745 708 q 649 862 724 805 q 473 920 573 920 q 219 791 312 920 q 136 509 136 675 q 217 229 136 344 q 470 99 311 99 q 672 179 591 99 q 753 379 753 259 l 886 379 "},"!":{x_min:0,x_max:138,ha:236,o:"m 138 684 q 116 409 138 629 q 105 244 105 299 l 33 244 q 16 465 33 313 q 0 684 0 616 l 0 1013 l 138 1013 l 138 684 m 138 0 l 0 0 l 0 151 l 138 151 l 138 0 "},"{":{x_min:0,x_max:480.5625,ha:578,o:"m 480 -286 q 237 -213 303 -286 q 187 -45 187 -159 q 194 48 187 -15 q 201 141 201 112 q 164 264 201 225 q 0 314 118 314 l 0 417 q 164 471 119 417 q 201 605 201 514 q 199 665 201 644 q 193 772 193 769 q 241 941 193 887 q 480 1015 308 1015 l 480 915 q 336 866 375 915 q 306 742 306 828 q 310 662 306 717 q 314 577 314 606 q 288 452 314 500 q 176 365 256 391 q 289 275 257 337 q 314 143 314 226 q 313 84 314 107 q 310 -11 310 -5 q 339 -131 310 -94 q 480 -182 377 -182 l 480 -286 "},X:{x_min:-.015625,x_max:854.15625,ha:940,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},"#":{x_min:0,x_max:963.890625,ha:1061,o:"m 963 690 l 927 590 l 719 590 l 655 410 l 876 410 l 840 310 l 618 310 l 508 -3 l 393 -2 l 506 309 l 329 310 l 215 -2 l 102 -3 l 212 310 l 0 310 l 36 410 l 248 409 l 312 590 l 86 590 l 120 690 l 347 690 l 459 1006 l 573 1006 l 462 690 l 640 690 l 751 1006 l 865 1006 l 754 690 l 963 690 m 606 590 l 425 590 l 362 410 l 543 410 l 606 590 "},\u03B9:{x_min:42,x_max:284,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 738 l 167 738 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 "},\u0386:{x_min:0,x_max:906.953125,ha:982,o:"m 283 1040 l 88 799 l 5 799 l 145 1040 l 283 1040 m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1012 l 529 1012 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},")":{x_min:0,x_max:318,ha:415,o:"m 318 365 q 257 25 318 191 q 87 -290 197 -141 l 0 -290 q 140 21 93 -128 q 193 360 193 189 q 141 704 193 537 q 0 1024 97 850 l 87 1024 q 257 706 197 871 q 318 365 318 542 "},\u03B5:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 314 0 265 q 128 390 67 353 q 56 460 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 "},\u0394:{x_min:0,x_max:952.78125,ha:1028,o:"m 952 0 l 0 0 l 400 1013 l 551 1013 l 952 0 m 762 124 l 476 867 l 187 124 l 762 124 "},"}":{x_min:0,x_max:481,ha:578,o:"m 481 314 q 318 262 364 314 q 282 136 282 222 q 284 65 282 97 q 293 -58 293 -48 q 241 -217 293 -166 q 0 -286 174 -286 l 0 -182 q 143 -130 105 -182 q 171 -2 171 -93 q 168 81 171 22 q 165 144 165 140 q 188 275 165 229 q 306 365 220 339 q 191 455 224 391 q 165 588 165 505 q 168 681 165 624 q 171 742 171 737 q 141 865 171 827 q 0 915 102 915 l 0 1015 q 243 942 176 1015 q 293 773 293 888 q 287 675 293 741 q 282 590 282 608 q 318 466 282 505 q 481 417 364 417 l 481 314 "},"\u2030":{x_min:-3,x_max:1672,ha:1821,o:"m 846 0 q 664 76 732 0 q 603 244 603 145 q 662 412 603 344 q 846 489 729 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 846 0 962 0 m 845 103 q 945 143 910 103 q 981 243 981 184 q 947 340 981 301 q 845 385 910 385 q 745 342 782 385 q 709 243 709 300 q 742 147 709 186 q 845 103 781 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 m 1428 0 q 1246 76 1314 0 q 1185 244 1185 145 q 1244 412 1185 344 q 1428 489 1311 489 q 1610 412 1542 489 q 1672 244 1672 343 q 1612 76 1672 144 q 1428 0 1545 0 m 1427 103 q 1528 143 1492 103 q 1564 243 1564 184 q 1530 340 1564 301 q 1427 385 1492 385 q 1327 342 1364 385 q 1291 243 1291 300 q 1324 147 1291 186 q 1427 103 1363 103 "},a:{x_min:0,x_max:698.609375,ha:794,o:"m 698 0 q 661 -12 679 -7 q 615 -17 643 -17 q 536 12 564 -17 q 500 96 508 41 q 384 6 456 37 q 236 -25 312 -25 q 65 31 130 -25 q 0 194 0 88 q 118 390 0 334 q 328 435 180 420 q 488 483 476 451 q 495 523 495 504 q 442 619 495 584 q 325 654 389 654 q 209 617 257 654 q 152 513 161 580 l 33 513 q 123 705 33 633 q 332 772 207 772 q 528 712 448 772 q 617 531 617 645 l 617 163 q 624 108 617 126 q 664 90 632 90 l 698 94 l 698 0 m 491 262 l 491 372 q 272 329 350 347 q 128 201 128 294 q 166 113 128 144 q 264 83 205 83 q 414 130 346 83 q 491 262 491 183 "},"\u2014":{x_min:0,x_max:941.671875,ha:1039,o:"m 941 334 l 0 334 l 0 410 l 941 410 l 941 334 "},"=":{x_min:8.71875,x_max:780.953125,ha:792,o:"m 780 510 l 8 510 l 8 606 l 780 606 l 780 510 m 780 235 l 8 235 l 8 332 l 780 332 l 780 235 "},N:{x_min:0,x_max:801,ha:914,o:"m 801 0 l 651 0 l 131 823 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 193 l 670 1013 l 801 1013 l 801 0 "},\u03C1:{x_min:0,x_max:712,ha:797,o:"m 712 369 q 620 94 712 207 q 362 -26 521 -26 q 230 2 292 -26 q 119 83 167 30 l 119 -278 l 0 -278 l 0 362 q 91 643 0 531 q 355 764 190 764 q 617 647 517 764 q 712 369 712 536 m 583 366 q 530 559 583 480 q 359 651 469 651 q 190 562 252 651 q 135 370 135 483 q 189 176 135 257 q 359 85 250 85 q 528 175 466 85 q 583 366 583 254 "},"\xAF":{x_min:0,x_max:941.671875,ha:938,o:"m 941 1033 l 0 1033 l 0 1109 l 941 1109 l 941 1033 "},Z:{x_min:0,x_max:779,ha:849,o:"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},u:{x_min:0,x_max:617,ha:729,o:"m 617 0 l 499 0 l 499 110 q 391 10 460 45 q 246 -25 322 -25 q 61 58 127 -25 q 0 258 0 136 l 0 738 l 125 738 l 125 284 q 156 148 125 202 q 273 82 197 82 q 433 165 369 82 q 493 340 493 243 l 493 738 l 617 738 l 617 0 "},k:{x_min:0,x_max:612.484375,ha:697,o:"m 612 738 l 338 465 l 608 0 l 469 0 l 251 382 l 121 251 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 402 l 456 738 l 612 738 "},\u0397:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},\u0391:{x_min:0,x_max:906.953125,ha:985,o:"m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},s:{x_min:0,x_max:604,ha:697,o:"m 604 217 q 501 36 604 104 q 292 -23 411 -23 q 86 43 166 -23 q 0 238 0 114 l 121 237 q 175 122 121 164 q 300 85 223 85 q 415 112 363 85 q 479 207 479 147 q 361 309 479 276 q 140 372 141 370 q 21 544 21 426 q 111 708 21 647 q 298 761 190 761 q 492 705 413 761 q 583 531 583 643 l 462 531 q 412 625 462 594 q 298 657 363 657 q 199 636 242 657 q 143 558 143 608 q 262 454 143 486 q 484 394 479 397 q 604 217 604 341 "},B:{x_min:0,x_max:778,ha:876,o:"m 580 546 q 724 469 670 535 q 778 311 778 403 q 673 83 778 171 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 892 q 691 633 732 693 q 580 546 650 572 m 393 899 l 139 899 l 139 588 l 379 588 q 521 624 462 588 q 592 744 592 667 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 303 635 219 q 559 436 635 389 q 402 477 494 477 l 139 477 l 139 124 l 419 124 "},"\u2026":{x_min:0,x_max:614,ha:708,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 m 378 0 l 236 0 l 236 151 l 378 151 l 378 0 m 614 0 l 472 0 l 472 151 l 614 151 l 614 0 "},"?":{x_min:0,x_max:607,ha:704,o:"m 607 777 q 543 599 607 674 q 422 474 482 537 q 357 272 357 391 l 236 272 q 297 487 236 395 q 411 619 298 490 q 474 762 474 691 q 422 885 474 838 q 301 933 371 933 q 179 880 228 933 q 124 706 124 819 l 0 706 q 94 963 0 872 q 302 1044 177 1044 q 511 973 423 1044 q 607 777 607 895 m 370 0 l 230 0 l 230 151 l 370 151 l 370 0 "},H:{x_min:0,x_max:803,ha:915,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},\u03BD:{x_min:0,x_max:675,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 738 l 340 147 l 541 738 l 675 738 "},c:{x_min:1,x_max:701.390625,ha:775,o:"m 701 264 q 584 53 681 133 q 353 -26 487 -26 q 91 91 188 -26 q 1 370 1 201 q 92 645 1 537 q 353 761 190 761 q 572 688 479 761 q 690 493 666 615 l 556 493 q 487 606 545 562 q 356 650 428 650 q 186 563 246 650 q 134 372 134 487 q 188 179 134 258 q 359 88 250 88 q 492 136 437 88 q 566 264 548 185 l 701 264 "},"\xB6":{x_min:0,x_max:566.671875,ha:678,o:"m 21 892 l 52 892 l 98 761 l 145 892 l 176 892 l 178 741 l 157 741 l 157 867 l 108 741 l 88 741 l 40 871 l 40 741 l 21 741 l 21 892 m 308 854 l 308 731 q 252 691 308 691 q 227 691 240 691 q 207 696 213 695 l 207 712 l 253 706 q 288 733 288 706 l 288 763 q 244 741 279 741 q 193 797 193 741 q 261 860 193 860 q 287 860 273 860 q 308 854 302 855 m 288 842 l 263 843 q 213 796 213 843 q 248 756 213 756 q 288 796 288 756 l 288 842 m 566 988 l 502 988 l 502 -1 l 439 -1 l 439 988 l 317 988 l 317 -1 l 252 -1 l 252 602 q 81 653 155 602 q 0 805 0 711 q 101 989 0 918 q 309 1053 194 1053 l 566 1053 l 566 988 "},\u03B2:{x_min:0,x_max:660,ha:745,o:"m 471 550 q 610 450 561 522 q 660 280 660 378 q 578 64 660 151 q 367 -22 497 -22 q 239 5 299 -22 q 126 82 178 32 l 126 -278 l 0 -278 l 0 593 q 54 903 0 801 q 318 1042 127 1042 q 519 964 436 1042 q 603 771 603 887 q 567 644 603 701 q 471 550 532 586 m 337 79 q 476 138 418 79 q 535 279 535 198 q 427 437 535 386 q 226 477 344 477 l 226 583 q 398 620 329 583 q 486 762 486 668 q 435 884 486 833 q 312 935 384 935 q 169 861 219 935 q 126 698 126 797 l 126 362 q 170 169 126 242 q 337 79 224 79 "},\u039C:{x_min:0,x_max:954,ha:1068,o:"m 954 0 l 819 0 l 819 868 l 537 0 l 405 0 l 128 865 l 128 0 l 0 0 l 0 1013 l 199 1013 l 472 158 l 758 1013 l 954 1013 l 954 0 "},\u038C:{x_min:.109375,x_max:1120,ha:1217,o:"m 1120 505 q 994 132 1120 282 q 642 -29 861 -29 q 290 130 422 -29 q 167 505 167 280 q 294 883 167 730 q 650 1046 430 1046 q 999 882 868 1046 q 1120 505 1120 730 m 977 504 q 896 784 977 669 q 644 915 804 915 q 391 785 484 915 q 307 504 307 669 q 391 224 307 339 q 644 95 486 95 q 894 224 803 95 q 977 504 977 339 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},\u0389:{x_min:0,x_max:1158,ha:1275,o:"m 1158 0 l 1022 0 l 1022 475 l 496 475 l 496 0 l 356 0 l 356 1012 l 496 1012 l 496 599 l 1022 599 l 1022 1012 l 1158 1012 l 1158 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"\u2022":{x_min:0,x_max:663.890625,ha:775,o:"m 663 529 q 566 293 663 391 q 331 196 469 196 q 97 294 194 196 q 0 529 0 393 q 96 763 0 665 q 331 861 193 861 q 566 763 469 861 q 663 529 663 665 "},"\xA5":{x_min:.1875,x_max:819.546875,ha:886,o:"m 563 561 l 697 561 l 696 487 l 520 487 l 482 416 l 482 380 l 697 380 l 695 308 l 482 308 l 482 0 l 342 0 l 342 308 l 125 308 l 125 380 l 342 380 l 342 417 l 303 487 l 125 487 l 125 561 l 258 561 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 l 563 561 "},"(":{x_min:0,x_max:318.0625,ha:415,o:"m 318 -290 l 230 -290 q 61 23 122 -142 q 0 365 0 190 q 62 712 0 540 q 230 1024 119 869 l 318 1024 q 175 705 219 853 q 125 360 125 542 q 176 22 125 187 q 318 -290 223 -127 "},U:{x_min:0,x_max:796,ha:904,o:"m 796 393 q 681 93 796 212 q 386 -25 566 -25 q 101 95 208 -25 q 0 393 0 211 l 0 1013 l 138 1013 l 138 391 q 204 191 138 270 q 394 107 276 107 q 586 191 512 107 q 656 391 656 270 l 656 1013 l 796 1013 l 796 393 "},\u03B3:{x_min:.5,x_max:744.953125,ha:822,o:"m 744 737 l 463 54 l 463 -278 l 338 -278 l 338 54 l 154 495 q 104 597 124 569 q 13 651 67 651 l 0 651 l 0 751 l 39 753 q 168 711 121 753 q 242 594 207 676 l 403 208 l 617 737 l 744 737 "},\u03B1:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 728 407 760 q 563 637 524 696 l 563 739 l 685 739 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 96 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 "},F:{x_min:0,x_max:683.328125,ha:717,o:"m 683 888 l 140 888 l 140 583 l 613 583 l 613 458 l 140 458 l 140 0 l 0 0 l 0 1013 l 683 1013 l 683 888 "},"\xAD":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},":":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},\u03A7:{x_min:0,x_max:854.171875,ha:935,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 427 637 l 675 1013 l 836 1013 l 504 521 l 854 0 "},"*":{x_min:116,x_max:674,ha:792,o:"m 674 768 l 475 713 l 610 544 l 517 477 l 394 652 l 272 478 l 178 544 l 314 713 l 116 766 l 153 876 l 341 812 l 342 1013 l 446 1013 l 446 811 l 635 874 l 674 768 "},"\u2020":{x_min:0,x_max:777,ha:835,o:"m 458 804 l 777 804 l 777 683 l 458 683 l 458 0 l 319 0 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 "},"\xB0":{x_min:0,x_max:347,ha:444,o:"m 173 802 q 43 856 91 802 q 0 977 0 905 q 45 1101 0 1049 q 173 1153 90 1153 q 303 1098 255 1153 q 347 977 347 1049 q 303 856 347 905 q 173 802 256 802 m 173 884 q 238 910 214 884 q 262 973 262 937 q 239 1038 262 1012 q 173 1064 217 1064 q 108 1037 132 1064 q 85 973 85 1010 q 108 910 85 937 q 173 884 132 884 "},V:{x_min:0,x_max:862.71875,ha:940,o:"m 862 1013 l 505 0 l 361 0 l 0 1013 l 143 1013 l 434 165 l 718 1012 l 862 1013 "},\u039E:{x_min:0,x_max:734.71875,ha:763,o:"m 723 889 l 9 889 l 9 1013 l 723 1013 l 723 889 m 673 463 l 61 463 l 61 589 l 673 589 l 673 463 m 734 0 l 0 0 l 0 124 l 734 124 l 734 0 "},"\xA0":{x_min:0,x_max:0,ha:853},\u03AB:{x_min:.328125,x_max:819.515625,ha:889,o:"m 588 1046 l 460 1046 l 460 1189 l 588 1189 l 588 1046 m 360 1046 l 232 1046 l 232 1189 l 360 1189 l 360 1046 m 819 1012 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1012 l 140 1012 l 411 533 l 679 1012 l 819 1012 "},"\u201D":{x_min:0,x_max:347,ha:454,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 m 347 851 q 310 737 347 784 q 208 669 273 690 l 208 734 q 267 787 250 741 q 280 873 280 821 l 208 873 l 208 1013 l 347 1013 l 347 851 "},"@":{x_min:0,x_max:1260,ha:1357,o:"m 1098 -45 q 877 -160 1001 -117 q 633 -203 752 -203 q 155 -29 327 -203 q 0 360 0 127 q 176 802 0 616 q 687 1008 372 1008 q 1123 854 969 1008 q 1260 517 1260 718 q 1155 216 1260 341 q 868 82 1044 82 q 772 106 801 82 q 737 202 737 135 q 647 113 700 144 q 527 82 594 82 q 367 147 420 82 q 314 312 314 212 q 401 565 314 452 q 639 690 498 690 q 810 588 760 690 l 849 668 l 938 668 q 877 441 900 532 q 833 226 833 268 q 853 182 833 198 q 902 167 873 167 q 1088 272 1012 167 q 1159 512 1159 372 q 1051 793 1159 681 q 687 925 925 925 q 248 747 415 925 q 97 361 97 586 q 226 26 97 159 q 627 -122 370 -122 q 856 -87 737 -122 q 1061 8 976 -53 l 1098 -45 m 786 488 q 738 580 777 545 q 643 615 700 615 q 483 517 548 615 q 425 322 425 430 q 457 203 425 250 q 552 156 490 156 q 722 273 665 156 q 786 488 738 309 "},\u038A:{x_min:0,x_max:499,ha:613,o:"m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 m 499 0 l 360 0 l 360 1012 l 499 1012 l 499 0 "},i:{x_min:14,x_max:136,ha:275,o:"m 136 873 l 14 873 l 14 1013 l 136 1013 l 136 873 m 136 0 l 14 0 l 14 737 l 136 737 l 136 0 "},\u0392:{x_min:0,x_max:778,ha:877,o:"m 580 545 q 724 468 671 534 q 778 310 778 402 q 673 83 778 170 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 891 q 691 632 732 692 q 580 545 650 571 m 393 899 l 139 899 l 139 587 l 379 587 q 521 623 462 587 q 592 744 592 666 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 302 635 219 q 559 435 635 388 q 402 476 494 476 l 139 476 l 139 124 l 419 124 "},\u03C5:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 94 617 199 q 308 -24 455 -24 q 76 94 161 -24 q 0 352 0 199 l 0 739 l 126 739 l 126 355 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 355 492 257 l 492 739 l 617 739 l 617 352 "},"]":{x_min:0,x_max:275,ha:372,o:"m 275 -281 l 0 -281 l 0 -187 l 151 -187 l 151 920 l 0 920 l 0 1013 l 275 1013 l 275 -281 "},m:{x_min:0,x_max:1019,ha:1128,o:"m 1019 0 l 897 0 l 897 454 q 860 591 897 536 q 739 660 816 660 q 613 586 659 660 q 573 436 573 522 l 573 0 l 447 0 l 447 455 q 412 591 447 535 q 294 657 372 657 q 165 586 213 657 q 122 437 122 521 l 122 0 l 0 0 l 0 738 l 117 738 l 117 640 q 202 730 150 697 q 316 763 254 763 q 437 730 381 763 q 525 642 494 697 q 621 731 559 700 q 753 763 682 763 q 943 694 867 763 q 1019 512 1019 625 l 1019 0 "},\u03C7:{x_min:8.328125,x_max:780.5625,ha:815,o:"m 780 -278 q 715 -294 747 -294 q 616 -257 663 -294 q 548 -175 576 -227 l 379 133 l 143 -277 l 9 -277 l 313 254 l 163 522 q 127 586 131 580 q 36 640 91 640 q 8 637 27 640 l 8 752 l 52 757 q 162 719 113 757 q 236 627 200 690 l 383 372 l 594 737 l 726 737 l 448 250 l 625 -69 q 670 -153 647 -110 q 743 -188 695 -188 q 780 -184 759 -188 l 780 -278 "},\u03AF:{x_min:42,x_max:326.71875,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 102 239 101 q 284 112 257 104 l 284 3 m 326 1040 l 137 819 l 54 819 l 189 1040 l 326 1040 "},\u0396:{x_min:0,x_max:779.171875,ha:850,o:"m 779 0 l 0 0 l 0 113 l 620 896 l 40 896 l 40 1013 l 779 1013 l 779 887 l 170 124 l 779 124 l 779 0 "},R:{x_min:0,x_max:781.953125,ha:907,o:"m 781 0 l 623 0 q 587 242 590 52 q 407 433 585 433 l 138 433 l 138 0 l 0 0 l 0 1013 l 396 1013 q 636 946 539 1013 q 749 731 749 868 q 711 597 749 659 q 608 502 674 534 q 718 370 696 474 q 729 207 722 352 q 781 26 736 62 l 781 0 m 373 551 q 533 594 465 551 q 614 731 614 645 q 532 859 614 815 q 373 896 465 896 l 138 896 l 138 551 l 373 551 "},o:{x_min:0,x_max:713,ha:821,o:"m 357 -25 q 94 91 194 -25 q 0 368 0 202 q 93 642 0 533 q 357 761 193 761 q 618 644 518 761 q 713 368 713 533 q 619 91 713 201 q 357 -25 521 -25 m 357 85 q 528 175 465 85 q 584 369 584 255 q 529 562 584 484 q 357 651 467 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 357 85 250 85 "},K:{x_min:0,x_max:819.46875,ha:906,o:"m 819 0 l 649 0 l 294 509 l 139 355 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},",":{x_min:0,x_max:142,ha:239,o:"m 142 -12 q 105 -132 142 -82 q 0 -205 68 -182 l 0 -138 q 57 -82 40 -124 q 70 0 70 -51 l 0 0 l 0 151 l 142 151 l 142 -12 "},d:{x_min:0,x_max:683,ha:796,o:"m 683 0 l 564 0 l 564 93 q 456 6 516 38 q 327 -25 395 -25 q 87 100 181 -25 q 0 365 0 215 q 90 639 0 525 q 343 763 187 763 q 564 647 486 763 l 564 1013 l 683 1013 l 683 0 m 582 373 q 529 562 582 484 q 361 653 468 653 q 190 561 253 653 q 135 365 135 479 q 189 175 135 254 q 358 85 251 85 q 529 178 468 85 q 582 373 582 258 "},"\xA8":{x_min:-109,x_max:247,ha:232,o:"m 247 1046 l 119 1046 l 119 1189 l 247 1189 l 247 1046 m 19 1046 l -109 1046 l -109 1189 l 19 1189 l 19 1046 "},E:{x_min:0,x_max:736.109375,ha:789,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},Y:{x_min:0,x_max:820,ha:886,o:"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},'"':{x_min:0,x_max:299,ha:396,o:"m 299 606 l 203 606 l 203 988 l 299 988 l 299 606 m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"\u2039":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"\u201E":{x_min:0,x_max:364,ha:467,o:"m 141 -12 q 104 -132 141 -82 q 0 -205 67 -182 l 0 -138 q 56 -82 40 -124 q 69 0 69 -51 l 0 0 l 0 151 l 141 151 l 141 -12 m 364 -12 q 327 -132 364 -82 q 222 -205 290 -182 l 222 -138 q 279 -82 262 -124 q 292 0 292 -51 l 222 0 l 222 151 l 364 151 l 364 -12 "},\u03B4:{x_min:1,x_max:710,ha:810,o:"m 710 360 q 616 87 710 196 q 356 -28 518 -28 q 99 82 197 -28 q 1 356 1 192 q 100 606 1 509 q 355 703 199 703 q 180 829 288 754 q 70 903 124 866 l 70 1012 l 643 1012 l 643 901 l 258 901 q 462 763 422 794 q 636 592 577 677 q 710 360 710 485 m 584 365 q 552 501 584 447 q 451 602 521 555 q 372 611 411 611 q 197 541 258 611 q 136 355 136 472 q 190 171 136 245 q 358 85 252 85 q 528 173 465 85 q 584 365 584 252 "},\u03AD:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 313 0 265 q 128 390 67 352 q 56 459 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 m 520 1040 l 331 819 l 248 819 l 383 1040 l 520 1040 "},\u03C9:{x_min:0,x_max:922,ha:1031,o:"m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 339 0 203 q 45 551 0 444 q 161 738 84 643 l 302 738 q 175 553 219 647 q 124 336 124 446 q 155 179 124 249 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 342 797 257 q 745 556 797 450 q 619 738 705 638 l 760 738 q 874 551 835 640 q 922 339 922 444 "},"\xB4":{x_min:0,x_max:96,ha:251,o:"m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"\xB1":{x_min:11,x_max:781,ha:792,o:"m 781 490 l 446 490 l 446 255 l 349 255 l 349 490 l 11 490 l 11 586 l 349 586 l 349 819 l 446 819 l 446 586 l 781 586 l 781 490 m 781 21 l 11 21 l 11 115 l 781 115 l 781 21 "},"|":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},\u03CB:{x_min:0,x_max:617,ha:725,o:"m 482 800 l 372 800 l 372 925 l 482 925 l 482 800 m 239 800 l 129 800 l 129 925 l 239 925 l 239 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 "},"\xA7":{x_min:0,x_max:593,ha:690,o:"m 593 425 q 554 312 593 369 q 467 233 516 254 q 537 83 537 172 q 459 -74 537 -12 q 288 -133 387 -133 q 115 -69 184 -133 q 47 96 47 -6 l 166 96 q 199 7 166 40 q 288 -26 232 -26 q 371 -5 332 -26 q 420 60 420 21 q 311 201 420 139 q 108 309 210 255 q 0 490 0 383 q 33 602 0 551 q 124 687 66 654 q 75 743 93 712 q 58 812 58 773 q 133 984 58 920 q 300 1043 201 1043 q 458 987 394 1043 q 529 814 529 925 l 411 814 q 370 908 404 877 q 289 939 336 939 q 213 911 246 939 q 180 841 180 883 q 286 720 180 779 q 484 612 480 615 q 593 425 593 534 m 467 409 q 355 544 467 473 q 196 630 228 612 q 146 587 162 609 q 124 525 124 558 q 239 387 124 462 q 398 298 369 315 q 448 345 429 316 q 467 409 467 375 "},b:{x_min:0,x_max:685,ha:783,o:"m 685 372 q 597 99 685 213 q 347 -25 501 -25 q 219 5 277 -25 q 121 93 161 36 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 634 q 214 723 157 692 q 341 754 272 754 q 591 637 493 754 q 685 372 685 526 m 554 356 q 499 550 554 470 q 328 644 437 644 q 162 556 223 644 q 108 369 108 478 q 160 176 108 256 q 330 83 221 83 q 498 169 435 83 q 554 356 554 245 "},q:{x_min:0,x_max:683,ha:876,o:"m 683 -278 l 564 -278 l 564 97 q 474 8 533 39 q 345 -23 415 -23 q 91 93 188 -23 q 0 364 0 203 q 87 635 0 522 q 337 760 184 760 q 466 727 408 760 q 564 637 523 695 l 564 737 l 683 737 l 683 -278 m 582 375 q 527 564 582 488 q 358 652 466 652 q 190 565 253 652 q 135 377 135 488 q 189 179 135 261 q 361 84 251 84 q 530 179 469 84 q 582 375 582 260 "},\u03A9:{x_min:-.171875,x_max:969.5625,ha:1068,o:"m 969 0 l 555 0 l 555 123 q 744 308 675 194 q 814 558 814 423 q 726 812 814 709 q 484 922 633 922 q 244 820 334 922 q 154 567 154 719 q 223 316 154 433 q 412 123 292 199 l 412 0 l 0 0 l 0 124 l 217 124 q 68 327 122 210 q 15 572 15 444 q 144 911 15 781 q 484 1041 274 1041 q 822 909 691 1041 q 953 569 953 777 q 899 326 953 443 q 750 124 846 210 l 969 124 l 969 0 "},\u03CD:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 535 1040 l 346 819 l 262 819 l 397 1040 l 535 1040 "},z:{x_min:-.015625,x_max:613.890625,ha:697,o:"m 613 0 l 0 0 l 0 100 l 433 630 l 20 630 l 20 738 l 594 738 l 593 636 l 163 110 l 613 110 l 613 0 "},"\u2122":{x_min:0,x_max:894,ha:1e3,o:"m 389 951 l 229 951 l 229 503 l 160 503 l 160 951 l 0 951 l 0 1011 l 389 1011 l 389 951 m 894 503 l 827 503 l 827 939 l 685 503 l 620 503 l 481 937 l 481 503 l 417 503 l 417 1011 l 517 1011 l 653 580 l 796 1010 l 894 1011 l 894 503 "},\u03AE:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 721 124 755 q 200 630 193 687 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 m 479 1040 l 290 819 l 207 819 l 341 1040 l 479 1040 "},\u0398:{x_min:0,x_max:960,ha:1056,o:"m 960 507 q 833 129 960 280 q 476 -32 698 -32 q 123 129 255 -32 q 0 507 0 280 q 123 883 0 732 q 476 1045 255 1045 q 832 883 696 1045 q 960 507 960 732 m 817 500 q 733 789 817 669 q 476 924 639 924 q 223 792 317 924 q 142 507 142 675 q 222 222 142 339 q 476 89 315 89 q 730 218 636 89 q 817 500 817 334 m 716 449 l 243 449 l 243 571 l 716 571 l 716 449 "},"\xAE":{x_min:-3,x_max:1008,ha:1106,o:"m 503 532 q 614 562 566 532 q 672 658 672 598 q 614 747 672 716 q 503 772 569 772 l 338 772 l 338 532 l 503 532 m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 788 146 l 678 146 q 653 316 655 183 q 527 449 652 449 l 338 449 l 338 146 l 241 146 l 241 854 l 518 854 q 688 808 621 854 q 766 658 766 755 q 739 563 766 607 q 668 497 713 519 q 751 331 747 472 q 788 164 756 190 l 788 146 "},"~":{x_min:0,x_max:833,ha:931,o:"m 833 958 q 778 753 833 831 q 594 665 716 665 q 402 761 502 665 q 240 857 302 857 q 131 795 166 857 q 104 665 104 745 l 0 665 q 54 867 0 789 q 237 958 116 958 q 429 861 331 958 q 594 765 527 765 q 704 827 670 765 q 729 958 729 874 l 833 958 "},\u0395:{x_min:0,x_max:736.21875,ha:778,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},"\xB3":{x_min:0,x_max:450,ha:547,o:"m 450 552 q 379 413 450 464 q 220 366 313 366 q 69 414 130 366 q 0 567 0 470 l 85 567 q 126 470 85 504 q 225 437 168 437 q 320 467 280 437 q 360 552 360 498 q 318 632 360 608 q 213 657 276 657 q 195 657 203 657 q 176 657 181 657 l 176 722 q 279 733 249 722 q 334 815 334 752 q 300 881 334 856 q 220 907 267 907 q 133 875 169 907 q 97 781 97 844 l 15 781 q 78 926 15 875 q 220 972 135 972 q 364 930 303 972 q 426 817 426 888 q 344 697 426 733 q 421 642 392 681 q 450 552 450 603 "},"[":{x_min:0,x_max:273.609375,ha:371,o:"m 273 -281 l 0 -281 l 0 1013 l 273 1013 l 273 920 l 124 920 l 124 -187 l 273 -187 l 273 -281 "},L:{x_min:0,x_max:645.828125,ha:696,o:"m 645 0 l 0 0 l 0 1013 l 140 1013 l 140 126 l 645 126 l 645 0 "},\u03C3:{x_min:0,x_max:803.390625,ha:894,o:"m 803 628 l 633 628 q 713 368 713 512 q 618 93 713 204 q 357 -25 518 -25 q 94 91 194 -25 q 0 368 0 201 q 94 644 0 533 q 356 761 194 761 q 481 750 398 761 q 608 739 564 739 l 803 739 l 803 628 m 360 85 q 529 180 467 85 q 584 374 584 262 q 527 566 584 490 q 352 651 463 651 q 187 559 247 651 q 135 368 135 478 q 189 175 135 254 q 360 85 251 85 "},\u03B6:{x_min:0,x_max:573,ha:642,o:"m 573 -40 q 553 -162 573 -97 q 510 -278 543 -193 l 400 -278 q 441 -187 428 -219 q 462 -90 462 -132 q 378 -14 462 -14 q 108 45 197 -14 q 0 290 0 117 q 108 631 0 462 q 353 901 194 767 l 55 901 l 55 1012 l 561 1012 l 561 924 q 261 669 382 831 q 128 301 128 489 q 243 117 128 149 q 458 98 350 108 q 573 -40 573 80 "},\u03B8:{x_min:0,x_max:674,ha:778,o:"m 674 496 q 601 160 674 304 q 336 -26 508 -26 q 73 153 165 -26 q 0 485 0 296 q 72 840 0 683 q 343 1045 166 1045 q 605 844 516 1045 q 674 496 674 692 m 546 579 q 498 798 546 691 q 336 935 437 935 q 178 798 237 935 q 126 579 137 701 l 546 579 m 546 475 l 126 475 q 170 233 126 348 q 338 80 230 80 q 504 233 447 80 q 546 475 546 346 "},\u039F:{x_min:0,x_max:958,ha:1054,o:"m 485 1042 q 834 883 703 1042 q 958 511 958 735 q 834 136 958 287 q 481 -26 701 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 729 q 485 1042 263 1042 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 670 q 480 913 640 913 q 226 785 321 913 q 142 504 142 671 q 226 224 142 339 q 480 98 319 98 "},\u0393:{x_min:0,x_max:705.28125,ha:749,o:"m 705 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 705 1012 l 705 886 "}," ":{x_min:0,x_max:0,ha:375},"%":{x_min:-3,x_max:1089,ha:1186,o:"m 845 0 q 663 76 731 0 q 602 244 602 145 q 661 412 602 344 q 845 489 728 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 845 0 962 0 m 844 103 q 945 143 909 103 q 981 243 981 184 q 947 340 981 301 q 844 385 909 385 q 744 342 781 385 q 708 243 708 300 q 741 147 708 186 q 844 103 780 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 "},P:{x_min:0,x_max:726,ha:806,o:"m 424 1013 q 640 931 555 1013 q 726 719 726 850 q 637 506 726 587 q 413 426 548 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 379 889 l 140 889 l 140 548 l 372 548 q 522 589 459 548 q 593 720 593 637 q 528 845 593 801 q 379 889 463 889 "},\u0388:{x_min:0,x_max:1078.21875,ha:1118,o:"m 1078 0 l 342 0 l 342 1013 l 1067 1013 l 1067 889 l 481 889 l 481 585 l 1019 585 l 1019 467 l 481 467 l 481 125 l 1078 125 l 1078 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},\u038F:{x_min:.125,x_max:1136.546875,ha:1235,o:"m 1136 0 l 722 0 l 722 123 q 911 309 842 194 q 981 558 981 423 q 893 813 981 710 q 651 923 800 923 q 411 821 501 923 q 321 568 321 720 q 390 316 321 433 q 579 123 459 200 l 579 0 l 166 0 l 166 124 l 384 124 q 235 327 289 210 q 182 572 182 444 q 311 912 182 782 q 651 1042 441 1042 q 989 910 858 1042 q 1120 569 1120 778 q 1066 326 1120 443 q 917 124 1013 210 l 1136 124 l 1136 0 m 277 1040 l 83 800 l 0 800 l 140 1041 l 277 1040 "},_:{x_min:0,x_max:705.5625,ha:803,o:"m 705 -334 l 0 -334 l 0 -234 l 705 -234 l 705 -334 "},\u03AA:{x_min:-110,x_max:246,ha:275,o:"m 246 1046 l 118 1046 l 118 1189 l 246 1189 l 246 1046 m 18 1046 l -110 1046 l -110 1189 l 18 1189 l 18 1046 m 136 0 l 0 0 l 0 1012 l 136 1012 l 136 0 "},"+":{x_min:23,x_max:768,ha:792,o:"m 768 372 l 444 372 l 444 0 l 347 0 l 347 372 l 23 372 l 23 468 l 347 468 l 347 840 l 444 840 l 444 468 l 768 468 l 768 372 "},"\xBD":{x_min:0,x_max:1050,ha:1149,o:"m 1050 0 l 625 0 q 712 178 625 108 q 878 277 722 187 q 967 385 967 328 q 932 456 967 429 q 850 484 897 484 q 759 450 798 484 q 721 352 721 416 l 640 352 q 706 502 640 448 q 851 551 766 551 q 987 509 931 551 q 1050 385 1050 462 q 976 251 1050 301 q 829 179 902 215 q 717 68 740 133 l 1050 68 l 1050 0 m 834 985 l 215 -28 l 130 -28 l 750 984 l 834 985 m 224 422 l 142 422 l 142 811 l 0 811 l 0 867 q 104 889 62 867 q 164 973 157 916 l 224 973 l 224 422 "},\u03A1:{x_min:0,x_max:720,ha:783,o:"m 424 1013 q 637 933 554 1013 q 720 723 720 853 q 633 508 720 591 q 413 426 546 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 378 889 l 140 889 l 140 548 l 371 548 q 521 589 458 548 q 592 720 592 637 q 527 845 592 801 q 378 889 463 889 "},"'":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},\u00AA:{x_min:0,x_max:350,ha:397,o:"m 350 625 q 307 616 328 616 q 266 631 281 616 q 247 673 251 645 q 190 628 225 644 q 116 613 156 613 q 32 641 64 613 q 0 722 0 669 q 72 826 0 800 q 247 866 159 846 l 247 887 q 220 934 247 916 q 162 953 194 953 q 104 934 129 953 q 76 882 80 915 l 16 882 q 60 976 16 941 q 166 1011 104 1011 q 266 979 224 1011 q 308 891 308 948 l 308 706 q 311 679 308 688 q 331 670 315 670 l 350 672 l 350 625 m 247 757 l 247 811 q 136 790 175 798 q 64 726 64 773 q 83 682 64 697 q 132 667 103 667 q 207 690 174 667 q 247 757 247 718 "},"\u0385":{x_min:0,x_max:450,ha:553,o:"m 450 800 l 340 800 l 340 925 l 450 925 l 450 800 m 406 1040 l 212 800 l 129 800 l 269 1040 l 406 1040 m 110 800 l 0 800 l 0 925 l 110 925 l 110 800 "},T:{x_min:0,x_max:777,ha:835,o:"m 777 894 l 458 894 l 458 0 l 319 0 l 319 894 l 0 894 l 0 1013 l 777 1013 l 777 894 "},\u03A6:{x_min:0,x_max:915,ha:997,o:"m 527 0 l 389 0 l 389 122 q 110 231 220 122 q 0 509 0 340 q 110 785 0 677 q 389 893 220 893 l 389 1013 l 527 1013 l 527 893 q 804 786 693 893 q 915 509 915 679 q 805 231 915 341 q 527 122 696 122 l 527 0 m 527 226 q 712 310 641 226 q 779 507 779 389 q 712 705 779 627 q 527 787 641 787 l 527 226 m 389 226 l 389 787 q 205 698 275 775 q 136 505 136 620 q 206 308 136 391 q 389 226 276 226 "},"\u204B":{x_min:0,x_max:0,ha:694},j:{x_min:-77.78125,x_max:167,ha:349,o:"m 167 871 l 42 871 l 42 1013 l 167 1013 l 167 871 m 167 -80 q 121 -231 167 -184 q -26 -278 76 -278 l -77 -278 l -77 -164 l -41 -164 q 26 -143 11 -164 q 42 -65 42 -122 l 42 737 l 167 737 l 167 -80 "},\u03A3:{x_min:0,x_max:756.953125,ha:819,o:"m 756 0 l 0 0 l 0 107 l 395 523 l 22 904 l 22 1013 l 745 1013 l 745 889 l 209 889 l 566 523 l 187 125 l 756 125 l 756 0 "},"\u203A":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"<":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"\xA3":{x_min:0,x_max:704.484375,ha:801,o:"m 704 41 q 623 -10 664 5 q 543 -26 583 -26 q 359 15 501 -26 q 243 36 288 36 q 158 23 197 36 q 73 -21 119 10 l 6 76 q 125 195 90 150 q 175 331 175 262 q 147 443 175 383 l 0 443 l 0 512 l 108 512 q 43 734 43 623 q 120 929 43 854 q 358 1010 204 1010 q 579 936 487 1010 q 678 729 678 857 l 678 684 l 552 684 q 504 838 552 780 q 362 896 457 896 q 216 852 263 896 q 176 747 176 815 q 199 627 176 697 q 248 512 217 574 l 468 512 l 468 443 l 279 443 q 297 356 297 398 q 230 194 297 279 q 153 107 211 170 q 227 133 190 125 q 293 142 264 142 q 410 119 339 142 q 516 96 482 96 q 579 105 550 96 q 648 142 608 115 l 704 41 "},t:{x_min:0,x_max:367,ha:458,o:"m 367 0 q 312 -5 339 -2 q 262 -8 284 -8 q 145 28 183 -8 q 108 143 108 64 l 108 638 l 0 638 l 0 738 l 108 738 l 108 944 l 232 944 l 232 738 l 367 738 l 367 638 l 232 638 l 232 185 q 248 121 232 140 q 307 102 264 102 q 345 104 330 102 q 367 107 360 107 l 367 0 "},"\xAC":{x_min:0,x_max:706,ha:803,o:"m 706 411 l 706 158 l 630 158 l 630 335 l 0 335 l 0 411 l 706 411 "},\u03BB:{x_min:0,x_max:750,ha:803,o:"m 750 -7 q 679 -15 716 -15 q 538 59 591 -15 q 466 214 512 97 l 336 551 l 126 0 l 0 0 l 270 705 q 223 837 247 770 q 116 899 190 899 q 90 898 100 899 l 90 1004 q 152 1011 125 1011 q 298 938 244 1011 q 373 783 326 901 l 605 192 q 649 115 629 136 q 716 95 669 95 l 736 95 q 750 97 745 97 l 750 -7 "},W:{x_min:0,x_max:1263.890625,ha:1351,o:"m 1263 1013 l 995 0 l 859 0 l 627 837 l 405 0 l 265 0 l 0 1013 l 136 1013 l 342 202 l 556 1013 l 701 1013 l 921 207 l 1133 1012 l 1263 1013 "},">":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},v:{x_min:0,x_max:675.15625,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 737 l 340 147 l 541 737 l 675 738 "},\u03C4:{x_min:.28125,x_max:644.5,ha:703,o:"m 644 628 l 382 628 l 382 179 q 388 120 382 137 q 436 91 401 91 q 474 94 447 91 q 504 97 501 97 l 504 0 q 454 -9 482 -5 q 401 -14 426 -14 q 278 67 308 -14 q 260 233 260 118 l 260 628 l 0 628 l 0 739 l 644 739 l 644 628 "},\u03BE:{x_min:0,x_max:624.9375,ha:699,o:"m 624 -37 q 608 -153 624 -96 q 563 -278 593 -211 l 454 -278 q 491 -183 486 -200 q 511 -83 511 -126 q 484 -23 511 -44 q 370 1 452 1 q 323 0 354 1 q 283 -1 293 -1 q 84 76 169 -1 q 0 266 0 154 q 56 431 0 358 q 197 538 108 498 q 94 613 134 562 q 54 730 54 665 q 77 823 54 780 q 143 901 101 867 l 27 901 l 27 1012 l 576 1012 l 576 901 l 380 901 q 244 863 303 901 q 178 745 178 820 q 312 600 178 636 q 532 582 380 582 l 532 479 q 276 455 361 479 q 118 281 118 410 q 165 173 118 217 q 274 120 208 133 q 494 101 384 110 q 624 -37 624 76 "},"&":{x_min:-3,x_max:894.25,ha:992,o:"m 894 0 l 725 0 l 624 123 q 471 0 553 40 q 306 -41 390 -41 q 168 -7 231 -41 q 62 92 105 26 q 14 187 31 139 q -3 276 -3 235 q 55 433 -3 358 q 248 581 114 508 q 170 689 196 640 q 137 817 137 751 q 214 985 137 922 q 384 1041 284 1041 q 548 988 483 1041 q 622 824 622 928 q 563 666 622 739 q 431 556 516 608 l 621 326 q 649 407 639 361 q 663 493 653 426 l 781 493 q 703 229 781 352 l 894 0 m 504 818 q 468 908 504 877 q 384 940 433 940 q 293 907 331 940 q 255 818 255 875 q 289 714 255 767 q 363 628 313 678 q 477 729 446 682 q 504 818 504 771 m 556 209 l 314 499 q 179 395 223 449 q 135 283 135 341 q 146 222 135 253 q 183 158 158 192 q 333 80 241 80 q 556 209 448 80 "},\u039B:{x_min:0,x_max:862.5,ha:942,o:"m 862 0 l 719 0 l 426 847 l 143 0 l 0 0 l 356 1013 l 501 1013 l 862 0 "},I:{x_min:41,x_max:180,ha:293,o:"m 180 0 l 41 0 l 41 1013 l 180 1013 l 180 0 "},G:{x_min:0,x_max:921,ha:1011,o:"m 921 0 l 832 0 l 801 136 q 655 15 741 58 q 470 -28 568 -28 q 126 133 259 -28 q 0 499 0 284 q 125 881 0 731 q 486 1043 259 1043 q 763 957 647 1043 q 905 709 890 864 l 772 709 q 668 866 747 807 q 486 926 589 926 q 228 795 322 926 q 142 507 142 677 q 228 224 142 342 q 483 94 323 94 q 712 195 625 94 q 796 435 796 291 l 477 435 l 477 549 l 921 549 l 921 0 "},\u03B0:{x_min:0,x_max:617,ha:725,o:"m 524 800 l 414 800 l 414 925 l 524 925 l 524 800 m 183 800 l 73 800 l 73 925 l 183 925 l 183 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 489 1040 l 300 819 l 216 819 l 351 1040 l 489 1040 "},"`":{x_min:0,x_max:138.890625,ha:236,o:"m 138 699 l 0 699 l 0 861 q 36 974 0 929 q 138 1041 72 1020 l 138 977 q 82 931 95 969 q 69 839 69 893 l 138 839 l 138 699 "},"\xB7":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},\u03A5:{x_min:.328125,x_max:819.515625,ha:889,o:"m 819 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 "},r:{x_min:0,x_max:355.5625,ha:432,o:"m 355 621 l 343 621 q 179 569 236 621 q 122 411 122 518 l 122 0 l 0 0 l 0 737 l 117 737 l 117 604 q 204 719 146 686 q 355 753 262 753 l 355 621 "},x:{x_min:0,x_max:675,ha:764,o:"m 675 0 l 525 0 l 331 286 l 144 0 l 0 0 l 256 379 l 12 738 l 157 737 l 336 473 l 516 738 l 661 738 l 412 380 l 675 0 "},\u03BC:{x_min:0,x_max:696.609375,ha:747,o:"m 696 -4 q 628 -14 657 -14 q 498 97 513 -14 q 422 8 470 41 q 313 -24 374 -24 q 207 3 258 -24 q 120 80 157 31 l 120 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 172 124 246 q 308 82 216 82 q 451 177 402 82 q 492 358 492 254 l 492 738 l 616 738 l 616 214 q 623 136 616 160 q 673 92 636 92 q 696 95 684 92 l 696 -4 "},h:{x_min:0,x_max:615,ha:724,o:"m 615 472 l 615 0 l 490 0 l 490 454 q 456 590 490 535 q 338 654 416 654 q 186 588 251 654 q 122 436 122 522 l 122 0 l 0 0 l 0 1013 l 122 1013 l 122 633 q 218 727 149 694 q 362 760 287 760 q 552 676 484 760 q 615 472 615 600 "},".":{x_min:0,x_max:142,ha:239,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},\u03C6:{x_min:-2,x_max:878,ha:974,o:"m 496 -279 l 378 -279 l 378 -17 q 101 88 204 -17 q -2 367 -2 194 q 68 626 -2 510 q 283 758 151 758 l 283 646 q 167 537 209 626 q 133 373 133 462 q 192 177 133 254 q 378 93 259 93 l 378 758 q 445 764 426 763 q 476 765 464 765 q 765 659 653 765 q 878 377 878 553 q 771 96 878 209 q 496 -17 665 -17 l 496 -279 m 496 93 l 514 93 q 687 183 623 93 q 746 380 746 265 q 691 569 746 491 q 522 658 629 658 l 496 656 l 496 93 "},";":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 -12 q 105 -132 142 -82 q 0 -206 68 -182 l 0 -138 q 58 -82 43 -123 q 68 0 68 -56 l 0 0 l 0 151 l 142 151 l 142 -12 "},f:{x_min:0,x_max:378,ha:472,o:"m 378 638 l 246 638 l 246 0 l 121 0 l 121 638 l 0 638 l 0 738 l 121 738 q 137 935 121 887 q 290 1028 171 1028 q 320 1027 305 1028 q 378 1021 334 1026 l 378 908 q 323 918 346 918 q 257 870 273 918 q 246 780 246 840 l 246 738 l 378 738 l 378 638 "},"\u201C":{x_min:1,x_max:348.21875,ha:454,o:"m 140 670 l 1 670 l 1 830 q 37 943 1 897 q 140 1011 74 990 l 140 947 q 82 900 97 940 q 68 810 68 861 l 140 810 l 140 670 m 348 670 l 209 670 l 209 830 q 245 943 209 897 q 348 1011 282 990 l 348 947 q 290 900 305 940 q 276 810 276 861 l 348 810 l 348 670 "},A:{x_min:.03125,x_max:906.953125,ha:1008,o:"m 906 0 l 756 0 l 648 303 l 251 303 l 142 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 610 421 l 452 867 l 293 421 l 610 421 "},"\u2018":{x_min:1,x_max:139.890625,ha:236,o:"m 139 670 l 1 670 l 1 830 q 37 943 1 897 q 139 1011 74 990 l 139 947 q 82 900 97 940 q 68 810 68 861 l 139 810 l 139 670 "},\u03CA:{x_min:-70,x_max:283,ha:361,o:"m 283 800 l 173 800 l 173 925 l 283 925 l 283 800 m 40 800 l -70 800 l -70 925 l 40 925 l 40 800 m 283 3 q 232 -10 257 -5 q 181 -15 206 -15 q 84 26 118 -15 q 41 200 41 79 l 41 737 l 166 737 l 167 215 q 171 141 167 157 q 225 101 182 101 q 247 103 238 101 q 283 112 256 104 l 283 3 "},\u03C0:{x_min:-.21875,x_max:773.21875,ha:857,o:"m 773 -7 l 707 -11 q 575 40 607 -11 q 552 174 552 77 l 552 226 l 552 626 l 222 626 l 222 0 l 97 0 l 97 626 l 0 626 l 0 737 l 773 737 l 773 626 l 676 626 l 676 171 q 695 103 676 117 q 773 90 714 90 l 773 -7 "},\u03AC:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 727 407 760 q 563 637 524 695 l 563 738 l 685 738 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 95 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 m 604 1040 l 415 819 l 332 819 l 466 1040 l 604 1040 "},O:{x_min:0,x_max:958,ha:1057,o:"m 485 1041 q 834 882 702 1041 q 958 512 958 734 q 834 136 958 287 q 481 -26 702 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 728 q 485 1041 263 1041 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 669 q 480 912 640 912 q 226 784 321 912 q 142 504 142 670 q 226 224 142 339 q 480 98 319 98 "},n:{x_min:0,x_max:615,ha:724,o:"m 615 463 l 615 0 l 490 0 l 490 454 q 453 592 490 537 q 331 656 410 656 q 178 585 240 656 q 117 421 117 514 l 117 0 l 0 0 l 0 738 l 117 738 l 117 630 q 218 728 150 693 q 359 764 286 764 q 552 675 484 764 q 615 463 615 593 "},l:{x_min:41,x_max:166,ha:279,o:"m 166 0 l 41 0 l 41 1013 l 166 1013 l 166 0 "},"\xA4":{x_min:40.09375,x_max:728.796875,ha:825,o:"m 728 304 l 649 224 l 512 363 q 383 331 458 331 q 256 363 310 331 l 119 224 l 40 304 l 177 441 q 150 553 150 493 q 184 673 150 621 l 40 818 l 119 898 l 267 749 q 321 766 291 759 q 384 773 351 773 q 447 766 417 773 q 501 749 477 759 l 649 898 l 728 818 l 585 675 q 612 618 604 648 q 621 553 621 587 q 591 441 621 491 l 728 304 m 384 682 q 280 643 318 682 q 243 551 243 604 q 279 461 243 499 q 383 423 316 423 q 487 461 449 423 q 525 553 525 500 q 490 641 525 605 q 384 682 451 682 "},\u03BA:{x_min:0,x_max:632.328125,ha:679,o:"m 632 0 l 482 0 l 225 384 l 124 288 l 124 0 l 0 0 l 0 738 l 124 738 l 124 446 l 433 738 l 596 738 l 312 466 l 632 0 "},p:{x_min:0,x_max:685,ha:786,o:"m 685 364 q 598 96 685 205 q 350 -23 504 -23 q 121 89 205 -23 l 121 -278 l 0 -278 l 0 738 l 121 738 l 121 633 q 220 726 159 691 q 351 761 280 761 q 598 636 504 761 q 685 364 685 522 m 557 371 q 501 560 557 481 q 330 651 437 651 q 162 559 223 651 q 108 366 108 479 q 162 177 108 254 q 333 87 224 87 q 502 178 441 87 q 557 371 557 258 "},"\u2021":{x_min:0,x_max:777,ha:835,o:"m 458 238 l 458 0 l 319 0 l 319 238 l 0 238 l 0 360 l 319 360 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 l 777 804 l 777 683 l 458 683 l 458 360 l 777 360 l 777 238 l 458 238 "},\u03C8:{x_min:0,x_max:808,ha:907,o:"m 465 -278 l 341 -278 l 341 -15 q 87 102 180 -15 q 0 378 0 210 l 0 739 l 133 739 l 133 379 q 182 195 133 275 q 341 98 242 98 l 341 922 l 465 922 l 465 98 q 623 195 563 98 q 675 382 675 278 l 675 742 l 808 742 l 808 381 q 720 104 808 213 q 466 -13 627 -13 l 465 -278 "},\u03B7:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 720 124 755 q 200 630 193 686 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 "}},zLe="normal",VLe=1189,GLe=-100,qLe="normal",HLe={yMin:-334,xMin:-111,yMax:1189,xMax:1672},WLe=1e3,jLe={postscript_name:"Helvetiker-Regular",version_string:"Version 1.00 2004 initial release",vendor_url:"http://www.magenta.gr/",full_font_name:"Helvetiker",font_family_name:"Helvetiker",copyright:"Copyright (c) \u039Cagenta ltd, 2004",description:"",trademark:"",designer:"",designer_url:"",unique_font_identifier:"\u039Cagenta ltd:Helvetiker:22-10-104",license_url:"http://www.ellak.gr/fonts/MgOpen/license.html",license_description:`Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r5223+ `),e},$V=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},vLe=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(r){return r};if(e.userData.shader)t(e.userData.shader.uniforms);else{var n=e.onBeforeCompile;e.onBeforeCompile=function(r){n(r),t(r.uniforms)}}},_Le=["stroke"],Ju=window.THREE?window.THREE:{BufferGeometry:Xn,CubicBezierCurve3:i_,Curve:za,Group:Br,Line:o0,Mesh:Hn,NormalBlending:Ts,ShaderMaterial:ds,TubeGeometry:X2,Vector3:re},xLe=m1.default.default||m1.default,Qoe=Qr({props:{arcsData:{default:[]},arcStartLat:{default:"startLat"},arcStartLng:{default:"startLng"},arcStartAltitude:{default:0},arcEndLat:{default:"endLat"},arcEndLng:{default:"endLng"},arcEndAltitude:{default:0},arcColor:{default:function(){return"#ffffaa"}},arcAltitude:{},arcAltitudeAutoScale:{default:.5},arcStroke:{},arcCurveResolution:{default:64,triggerUpdate:!1},arcCircularResolution:{default:6,triggerUpdate:!1},arcDashLength:{default:1},arcDashGap:{default:0},arcDashInitialGap:{default:0},arcDashAnimateTime:{default:0},arcsTransitionDuration:{default:1e3,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;e.sharedMaterial.dispose(),(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new xLe,sharedMaterial:new Ju.ShaderMaterial($i($i({},Koe()),{},{transparent:!0,blending:Ju.NormalBlending}))}},init:function(e,t){is(e),t.scene=e,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new Ju.Group;return n.__globeObjType="arc",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=Ir(s,2),a=o[1];return a}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var o=s.children[0],a=o.__dashAnimateStep*r,l=o.material.uniforms.dashTranslate.value%1e9;o.material.uniforms.dashTranslate.value=l+a})})},update:function(e){var t=st(e.arcStartLat),n=st(e.arcStartLng),r=st(e.arcStartAltitude),s=st(e.arcEndLat),o=st(e.arcEndLng),a=st(e.arcEndAltitude),l=st(e.arcAltitude),c=st(e.arcAltitudeAutoScale),u=st(e.arcStroke),f=st(e.arcColor),d=st(e.arcDashLength),A=st(e.arcDashGap),y=st(e.arcDashInitialGap),w=st(e.arcDashAnimateTime);e.dataMapper.onUpdateObj(function(I,P){var F=u(P),D=F!=null;if(!I.children.length||D!==(I.children[0].type==="Mesh")){is(I);var L=D?new Ju.Mesh:new Ju.Line(new Ju.BufferGeometry);L.material=e.sharedMaterial.clone(),I.add(L)}var C=I.children[0];Object.assign(C.material.uniforms,{dashSize:{value:d(P)},gapSize:{value:A(P)},dashOffset:{value:y(P)}});var B=w(P);C.__dashAnimateStep=B>0?1e3/B:0;var k=T(f(P),e.arcCurveResolution,D?e.arcCircularResolution+1:1),z=R(e.arcCurveResolution,D?e.arcCircularResolution+1:1,!0);C.geometry.setAttribute("color",k),C.geometry.setAttribute("relDistance",z);var G=function($){var J=I.__currentTargetD=$,te=J.stroke,ce=sLe(J,_Le),he=S(ce);D?(C.geometry&&C.geometry.dispose(),C.geometry=new Ju.TubeGeometry(he,e.arcCurveResolution,te/2,e.arcCircularResolution),C.geometry.setAttribute("color",k),C.geometry.setAttribute("relDistance",z)):C.geometry.setFromPoints(he.getPoints(e.arcCurveResolution))},W={stroke:F,alt:l(P),altAutoScale:+c(P),startLat:+t(P),startLng:+n(P),startAlt:+r(P),endLat:+s(P),endLng:+o(P),endAlt:+a(P)},Y=I.__currentTargetD||Object.assign({},W,{altAutoScale:-.001});Object.keys(W).some(function(H){return Y[H]!==W[H]})&&(!e.arcsTransitionDuration||e.arcsTransitionDuration<0?G(W):e.tweenGroup.add(new uo(Y).to(W,e.arcsTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(G).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.arcsData);function S(I){var P=I.alt,F=I.altAutoScale,D=I.startLat,L=I.startLng,C=I.startAlt,B=I.endLat,k=I.endLng,z=I.endAlt,G=function(Ee){var Ve=Ir(Ee,3),Ye=Ve[0],Mt=Ve[1],Et=Ve[2],Pt=ou(Mt,Ye,Et),dn=Pt.x,Gt=Pt.y,$e=Pt.z;return new Ju.Vector3(dn,Gt,$e)},W=[L,D],Y=[k,B],H=P;if(H==null&&(H=Ml(W,Y)/2*F+Math.max(C,z)),H||C||z){var $=Eg(W,Y),J=function(Ee,Ve){return Ve+(Ve-Ee)*(Ee<Ve?.5:.25)},te=[.25,.75].map(function(mt){return[].concat(tr($(mt)),[J(mt<.5?C:z,H)])}),ce=Ir(te,2),he=ce[0],ve=ce[1],Re=jV(Ju.CubicBezierCurve3,tr([[].concat(W,[C]),he,ve,[].concat(Y,[z])].map(G)));return Re}else{var Qe=.001;return Fe.apply(void 0,tr([[].concat(W,[Qe]),[].concat(Y,[Qe])].map(G)))}function Fe(mt,Ee){var Ve=mt.angleTo(Ee),Ye=Ve===0?function(){return mt.clone()}:function(Et){return new Ju.Vector3().addVectors(mt.clone().multiplyScalar(Math.sin((1-Et)*Ve)),Ee.clone().multiplyScalar(Math.sin(Et*Ve))).divideScalar(Math.sin(Ve))},Mt=new Ju.Curve;return Mt.getPoint=Ye,Mt}}function T(I,P){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,D=P+1,L;if(I instanceof Array||I instanceof Function){var C=I instanceof Array?Tl().domain(I.map(function(H,$){return $/(I.length-1)})).range(I):I;L=function($){return Rm(C($),!0,!0)}}else{var B=Rm(I,!0,!0);L=function(){return B}}for(var k=[],z=0,G=D;z<G;z++)for(var W=L(z/(G-1)),Y=0;Y<F;Y++)k.push(W);return Ff(k,4)}function R(I){for(var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,D=I+1,L=[],C=0,B=D;C<B;C++)for(var k=C/(B-1),z=0;z<P;z++)L.push(k);return F&&L.reverse(),Ff(L,1)}}}),Em=window.THREE?window.THREE:{BufferGeometry:Xn,DoubleSide:vr,Mesh:Hn,MeshLambertMaterial:Ga,Object3D:lr},koe=Object.assign({},bw),zoe=koe.BufferGeometryUtils||koe,Joe=Qr({props:{hexBinPointsData:{default:[]},hexBinPointLat:{default:"lat"},hexBinPointLng:{default:"lng"},hexBinPointWeight:{default:1},hexBinResolution:{default:4},hexMargin:{default:.2},hexTopCurvatureResolution:{default:5},hexTopColor:{default:function(){return"#ffffaa"}},hexSideColor:{default:function(){return"#ffffaa"}},hexAltitude:{default:function(e){var t=e.sumWeight;return t*.01}},hexBinMerge:{default:!1},hexTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjHexbin"})},update:function(e,t){var n=st(e.hexBinPointLat),r=st(e.hexBinPointLng),s=st(e.hexBinPointWeight),o=st(e.hexAltitude),a=st(e.hexTopColor),l=st(e.hexSideColor),c=st(e.hexMargin),u=Aee(e.hexBinPointsData.map(function(R){return $i($i({},R),{},{h3Idx:Ree(n(R),r(R),e.hexBinResolution)})}),"h3Idx"),f=Object.entries(u).map(function(R){var I=Ir(R,2),P=I[0],F=I[1];return{h3Idx:P,points:F,sumWeight:F.reduce(function(D,L){return D+ +s(L)},0)}}),d={};if(!e.hexBinMerge&&t.hasOwnProperty("hexBinMerge")&&is(e.scene),e.dataMapper.scene=e.hexBinMerge?new Em.Object3D:e.scene,e.dataMapper.id(function(R){return R.h3Idx}).onCreateObj(S).onUpdateObj(T).digest(f),e.hexBinMerge){var A=f.length?(zoe.mergeGeometries||zoe.mergeBufferGeometries)(f.map(function(R){var I=e.dataMapper.getObj(R),P=I.geometry.toNonIndexed();I.updateMatrix(),P.applyMatrix4(I.matrix);var F=Rm(a(R)),D=Rm(l(R)),L=P.getAttribute("position").count,C=P.groups[0].count;return P.setAttribute("color",Ff(tr(new Array(L)).map(function(B,k){return k>=C?F:D}),4)),P})):new Em.BufferGeometry,y=new Em.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:Em.DoubleSide});y.onBeforeCompile=function(R){y.userData.shader=WV(R)};var w=new Em.Mesh(A,y);w.__globeObjType="hexBinPoints",w.__data=f,e.dataMapper.clear(),is(e.scene),e.scene.add(w)}function S(R){var I=new Em.Mesh;I.__hexCenter=LO(R.h3Idx),I.__hexGeoJson=DO(R.h3Idx,!0).reverse();var P=I.__hexCenter[1];return I.__hexGeoJson.forEach(function(F){var D=F[0];Math.abs(P-D)>170&&(F[0]+=P>D?360:-360)}),I.__globeObjType="hexbin",I}function T(R,I){var P=function(J,te,ce){return J-(J-te)*ce},F=Math.max(0,Math.min(1,+c(I))),D=Ir(R.__hexCenter,2),L=D[0],C=D[1],B=F===0?R.__hexGeoJson:R.__hexGeoJson.map(function($){var J=Ir($,2),te=J[0],ce=J[1];return[[te,C],[ce,L]].map(function(he){var ve=Ir(he,2),Re=ve[0],Qe=ve[1];return P(Re,Qe,F)})}),k=e.hexTopCurvatureResolution;R.geometry&&R.geometry.dispose(),R.geometry=new aR([B],0,_r,!1,!0,!0,k);var z={alt:+o(I)},G=function(J){var te=R.__currentTargetD=J,ce=te.alt;R.scale.x=R.scale.y=R.scale.z=1+ce;var he=_r/(ce+1);R.geometry.setAttribute("surfaceRadius",Ff(Array(R.geometry.getAttribute("position").count).fill(he),1))},W=R.__currentTargetD||Object.assign({},z,{alt:-.001});if(Object.keys(z).some(function($){return W[$]!==z[$]})&&(e.hexBinMerge||!e.hexTransitionDuration||e.hexTransitionDuration<0?G(z):e.tweenGroup.add(new uo(W).to(z,e.hexTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(G).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.hexBinMerge){var Y=l(I),H=a(I);[Y,H].forEach(function($){if(!d.hasOwnProperty($)){var J=th($);d[$]=$V(new Em.MeshLambertMaterial({color:Nf($),transparent:J<1,opacity:J,side:Em.DoubleSide}),WV)}}),R.material=[Y,H].map(function($){return d[$]})}}}}),eae=function(e){return e*e},np=function(e){return e*Math.PI/180};function yLe(i,e){var t=Math.sqrt,n=Math.cos,r=function(u){return eae(Math.sin(u/2))},s=np(i[1]),o=np(e[1]),a=np(i[0]),l=np(e[0]);return 2*Math.asin(t(r(o-s)+n(s)*n(o)*r(l-a)))}var bLe=Math.sqrt(2*Math.PI);function wLe(i,e){return Math.exp(-eae(i/e)/2)/(e*bLe)}var SLe=function(e){var t=Ir(e,2),n=t[0],r=t[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=o.lngAccessor,l=a===void 0?function(S){return S[0]}:a,c=o.latAccessor,u=c===void 0?function(S){return S[1]}:c,f=o.weightAccessor,d=f===void 0?function(){return 1}:f,A=o.bandwidth,y=[n,r],w=A*Math.PI/180;return iC(s.map(function(S){var T=d(S);if(!T)return 0;var R=yLe(y,[l(S),u(S)]);return wLe(R,w)*T}))},TLe=(function(){var i=QIe(qV().m(function e(t){var n,r,s,o,a,l,c,u,f,d,A,y,w,S,T,R,I,P,F,D,L,C,B,k,z,G,W,Y,H,$,J,te,ce,he,ve,Re,Qe,Fe,mt,Ee,Ve=arguments,Ye,Mt,Et;return qV().w(function(Pt){for(;;)switch(Pt.n){case 0:if(r=Ve.length>1&&Ve[1]!==void 0?Ve[1]:[],s=Ve.length>2&&Ve[2]!==void 0?Ve[2]:{},o=s.lngAccessor,a=o===void 0?function(dn){return dn[0]}:o,l=s.latAccessor,c=l===void 0?function(dn){return dn[1]}:l,u=s.weightAccessor,f=u===void 0?function(){return 1}:u,d=s.bandwidth,(n=navigator)!==null&&n!==void 0&&n.gpu){Pt.n=1;break}return console.warn("WebGPU not enabled in browser. Please consider enabling it to improve performance."),Pt.a(2,t.map(function(dn){return SLe(dn,r,{lngAccessor:a,latAccessor:c,weightAccessor:f,bandwidth:d})}));case 1:return A=4,y=moe,w=Aoe,S=Moe,T=Eoe,R=yoe,I=boe,P=goe,F=Toe,D=Soe,L=_oe,C=voe,B=xoe,k=woe,z=T(new s1(new Float32Array(t.flat().map(np)),2),"vec2",t.length),G=T(new s1(new Float32Array(r.map(function(dn){return[np(a(dn)),np(c(dn)),f(dn)]}).flat()),3),"vec3",r.length),W=new s1(t.length,1),Y=T(W,"float",t.length),H=R(Math.PI),$=F(H.mul(2)),J=function(Gt){return Gt.mul(Gt)},te=function(Gt){return J(D(Gt.div(2)))},ce=function(Gt,$e){var ot=R(Gt[1]),nt=R($e[1]),bt=R(Gt[0]),yt=R($e[0]);return R(2).mul(C(F(te(nt.sub(ot)).add(L(ot).mul(L(nt)).mul(te(yt.sub(bt)))))))},he=function(Gt,$e){return B(k(J(Gt.div($e)).div(2))).div($e.mul($))},ve=S(np(d)),Re=S(np(d*A)),Qe=S(r.length),Fe=y(function(){var dn=z.element(I),Gt=Y.element(I);Gt.assign(0),P(Qe,function($e){var ot=$e.i,nt=G.element(ot),bt=nt.z;w(bt,function(){var yt=ce(nt.xy,dn.xy);w(yt&&yt.lessThan(Re),function(){Gt.addAssign(he(yt,ve).mul(bt))})})})}),mt=Fe().compute(t.length),Ee=new xx,Pt.n=2,Ee.computeAsync(mt);case 2:return Ye=Array,Mt=Float32Array,Pt.n=3,Ee.getArrayBufferAsync(W);case 3:return Et=Pt.v,Pt.a(2,Ye.from.call(Ye,new Mt(Et)))}},e)}));return function(t){return i.apply(this,arguments)}})(),$P=window.THREE?window.THREE:{Mesh:Hn,MeshLambertMaterial:Ga,SphereGeometry:Va},ELe=3.5,MLe=.1,Voe=100,CLe=function(e){var t=Uu(FO(e));return t.opacity=Math.cbrt(e),t.formatRgb()},tae=Qr({props:{heatmapsData:{default:[]},heatmapPoints:{default:function(e){return e}},heatmapPointLat:{default:function(e){return e[0]}},heatmapPointLng:{default:function(e){return e[1]}},heatmapPointWeight:{default:1},heatmapBandwidth:{default:2.5},heatmapColorFn:{default:function(){return CLe}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var s=new $P.Mesh(new $P.SphereGeometry(_r),$V(new $P.MeshLambertMaterial({vertexColors:!0,transparent:!0}),gLe));return s.__globeObjType="heatmap",s})},update:function(e){var t=st(e.heatmapPoints),n=st(e.heatmapPointLat),r=st(e.heatmapPointLng),s=st(e.heatmapPointWeight),o=st(e.heatmapBandwidth),a=st(e.heatmapColorFn),l=st(e.heatmapColorSaturation),c=st(e.heatmapBaseAltitude),u=st(e.heatmapTopAltitude);e.dataMapper.onUpdateObj(function(f,d){var A=o(d),y=a(d),w=l(d),S=c(d),T=u(d),R=t(d).map(function(L){var C=n(L),B=r(L),k=ou(C,B),z=k.x,G=k.y,W=k.z;return{x:z,y:G,z:W,lat:C,lng:B,weight:s(L)}}),I=Math.max(MLe,A/ELe),P=Math.ceil(360/(I||-1));f.geometry.parameters.widthSegments!==P&&(f.geometry.dispose(),f.geometry=new $P.SphereGeometry(_r,P,P/2));var F=ALe(f.geometry.getAttribute("position")),D=F.map(function(L){var C=Ir(L,3),B=C[0],k=C[1],z=C[2],G=$oe({x:B,y:k,z}),W=G.lng,Y=G.lat;return[W,Y]});TLe(D,R,{latAccessor:function(C){return C.lat},lngAccessor:function(C){return C.lng},weightAccessor:function(C){return C.weight},bandwidth:A}).then(function(L){var C=tr(new Array(Voe)).map(function(G,W){return Rm(y(W/(Voe-1)))}),B=function(W){var Y=f.__currentTargetD=W,H=Y.kdeVals,$=Y.topAlt,J=Y.saturation,te=tC(H.map(Math.abs))||1e-15,ce=Jb([0,te/J],C);f.geometry.setAttribute("color",Ff(H.map(function(ve){return ce(Math.abs(ve))}),4));var he=Tl([0,te],[_r*(1+S),_r*(1+($||S))]);f.geometry.setAttribute("r",Ff(H.map(he)))},k={kdeVals:L,topAlt:T,saturation:w},z=f.__currentTargetD||Object.assign({},k,{kdeVals:L.map(function(){return 0}),topAlt:T&&S,saturation:.5});z.kdeVals.length!==L.length&&(z.kdeVals=L.slice()),Object.keys(k).some(function(G){return z[G]!==k[G]})&&(!e.heatmapsTransitionDuration||e.heatmapsTransitionDuration<0?B(k):e.tweenGroup.add(new uo(z).to(k,e.heatmapsTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(B).onComplete(function(){e.tweenGroup.remove(this)}).start()))})}).digest(e.heatmapsData)}}),Mm=window.THREE?window.THREE:{DoubleSide:vr,Group:Br,LineBasicMaterial:Iu,LineSegments:Jv,Mesh:Hn,MeshBasicMaterial:fs},nae=Qr({props:{polygonsData:{default:[]},polygonGeoJsonGeometry:{default:"geometry"},polygonSideColor:{default:function(){return"#ffffaa"}},polygonSideMaterial:{},polygonCapColor:{default:function(){return"#ffffaa"}},polygonCapMaterial:{},polygonStrokeColor:{},polygonAltitude:{default:.01},polygonCapCurvatureResolution:{default:5},polygonsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjPolygon"}).id(function(s){return s.id}).onCreateObj(function(){var s=new Mm.Group;return s.__defaultSideMaterial=$V(new Mm.MeshBasicMaterial({side:Mm.DoubleSide,depthWrite:!0}),WV),s.__defaultCapMaterial=new Mm.MeshBasicMaterial({side:Mm.DoubleSide,depthWrite:!0}),s.add(new Mm.Mesh(void 0,[s.__defaultSideMaterial,s.__defaultCapMaterial])),s.add(new Mm.LineSegments(void 0,new Mm.LineBasicMaterial)),s.__globeObjType="polygon",s})},update:function(e){var t=st(e.polygonGeoJsonGeometry),n=st(e.polygonAltitude),r=st(e.polygonCapCurvatureResolution),s=st(e.polygonCapColor),o=st(e.polygonCapMaterial),a=st(e.polygonSideColor),l=st(e.polygonSideMaterial),c=st(e.polygonStrokeColor),u=[];e.polygonsData.forEach(function(f){var d={data:f,capColor:s(f),capMaterial:o(f),sideColor:a(f),sideMaterial:l(f),strokeColor:c(f),altitude:+n(f),capCurvatureResolution:+r(f)},A=t(f),y=f.__id||"".concat(Math.round(Math.random()*1e9));f.__id=y,A.type==="Polygon"?u.push($i({id:"".concat(y,"_0"),coords:A.coordinates},d)):A.type==="MultiPolygon"?u.push.apply(u,tr(A.coordinates.map(function(w,S){return $i({id:"".concat(y,"_").concat(S),coords:w},d)}))):console.warn("Unsupported GeoJson geometry type: ".concat(A.type,". Skipping geometry..."))}),e.dataMapper.onUpdateObj(function(f,d){var A=d.coords,y=d.capColor,w=d.capMaterial,S=d.sideColor,T=d.sideMaterial,R=d.strokeColor,I=d.altitude,P=d.capCurvatureResolution,F=Ir(f.children,2),D=F[0],L=F[1],C=!!R;L.visible=C;var B=!!(y||w),k=!!(S||T);RLe(D.geometry.parameters||{},{polygonGeoJson:A,curvatureResolution:P,closedTop:B,includeSides:k})||(D.geometry&&D.geometry.dispose(),D.geometry=new aR(A,0,_r,!1,B,k,P)),C&&(!L.geometry.parameters||L.geometry.parameters.geoJson.coordinates!==A||L.geometry.parameters.resolution!==P)&&(L.geometry&&L.geometry.dispose(),L.geometry=new uO({type:"Polygon",coordinates:A},_r,P));var z=k?0:-1,G=B?k?1:0:-1;if(z>=0&&(D.material[z]=T||f.__defaultSideMaterial),G>=0&&(D.material[G]=w||f.__defaultCapMaterial),[[!T&&S,z],[!w&&y,G]].forEach(function(te){var ce=Ir(te,2),he=ce[0],ve=ce[1];if(!(!he||ve<0)){var Re=D.material[ve],Qe=th(he);Re.color.set(Nf(he)),Re.transparent=Qe<1,Re.opacity=Qe}}),C){var W=L.material,Y=th(R);W.color.set(Nf(R)),W.transparent=Y<1,W.opacity=Y}var H={alt:I},$=function(ce){var he=f.__currentTargetD=ce,ve=he.alt;D.scale.x=D.scale.y=D.scale.z=1+ve,C&&(L.scale.x=L.scale.y=L.scale.z=1+ve+1e-4),vLe(f.__defaultSideMaterial,function(Re){return Re.uSurfaceRadius.value=_r/(ve+1)})},J=f.__currentTargetD||Object.assign({},H,{alt:-.001});Object.keys(H).some(function(te){return J[te]!==H[te]})&&(!e.polygonsTransitionDuration||e.polygonsTransitionDuration<0||J.alt===H.alt?$(H):e.tweenGroup.add(new uo(J).to(H,e.polygonsTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate($).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(u)}});function RLe(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return function(n,r){return n===r}};return Object.entries(e).every(function(n){var r=Ir(n,2),s=r[0],o=r[1];return i.hasOwnProperty(s)&&t(s)(i[s],o)})}var Rx=window.THREE?window.THREE:{BufferGeometry:Xn,DoubleSide:vr,Mesh:Hn,MeshLambertMaterial:Ga,Vector3:re},Goe=Object.assign({},bw),qoe=Goe.BufferGeometryUtils||Goe,iae=Qr({props:{hexPolygonsData:{default:[]},hexPolygonGeoJsonGeometry:{default:"geometry"},hexPolygonColor:{default:function(){return"#ffffaa"}},hexPolygonAltitude:{default:.001},hexPolygonResolution:{default:3},hexPolygonMargin:{default:.2},hexPolygonUseDots:{default:!1},hexPolygonCurvatureResolution:{default:5},hexPolygonDotResolution:{default:12},hexPolygonsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var s=new Rx.Mesh(void 0,new Rx.MeshLambertMaterial({side:Rx.DoubleSide}));return s.__globeObjType="hexPolygon",s})},update:function(e){var t=st(e.hexPolygonGeoJsonGeometry),n=st(e.hexPolygonColor),r=st(e.hexPolygonAltitude),s=st(e.hexPolygonResolution),o=st(e.hexPolygonMargin),a=st(e.hexPolygonUseDots),l=st(e.hexPolygonCurvatureResolution),c=st(e.hexPolygonDotResolution);e.dataMapper.onUpdateObj(function(u,f){var d=t(f),A=s(f),y=r(f),w=Math.max(0,Math.min(1,+o(f))),S=a(f),T=l(f),R=c(f),I=n(f),P=th(I);u.material.color.set(Nf(I)),u.material.transparent=P<1,u.material.opacity=P;var F={alt:y,margin:w,curvatureResolution:T},D={geoJson:d,h3Res:A},L=u.__currentTargetD||Object.assign({},F,{alt:-.001}),C=u.__currentMemD||D;if(Object.keys(F).some(function(G){return L[G]!==F[G]})||Object.keys(D).some(function(G){return C[G]!==D[G]})){u.__currentMemD=D;var B=[];d.type==="Polygon"?NO(d.coordinates,A,!0).forEach(function(G){return B.push(G)}):d.type==="MultiPolygon"?d.coordinates.forEach(function(G){return NO(G,A,!0).forEach(function(W){return B.push(W)})}):console.warn("Unsupported GeoJson geometry type: ".concat(d.type,". Skipping geometry..."));var k=B.map(function(G){var W=LO(G),Y=DO(G,!0).reverse(),H=W[1];return Y.forEach(function($){var J=$[0];Math.abs(H-J)>170&&($[0]+=H>J?360:-360)}),{h3Idx:G,hexCenter:W,hexGeoJson:Y}}),z=function(W){var Y=u.__currentTargetD=W,H=Y.alt,$=Y.margin,J=Y.curvatureResolution;u.geometry&&u.geometry.dispose(),u.geometry=k.length?(qoe.mergeGeometries||qoe.mergeBufferGeometries)(k.map(function(te){var ce=Ir(te.hexCenter,2),he=ce[0],ve=ce[1];if(S){var Re=ou(he,ve,H),Qe=ou(te.hexGeoJson[0][1],te.hexGeoJson[0][0],H),Fe=.85*(1-$)*new Rx.Vector3(Re.x,Re.y,Re.z).distanceTo(new Rx.Vector3(Qe.x,Qe.y,Qe.z)),mt=new t_(Fe,R);return mt.rotateX(p1(-he)),mt.rotateY(p1(ve)),mt.translate(Re.x,Re.y,Re.z),mt}else{var Ee=function(Mt,Et,Pt){return Mt-(Mt-Et)*Pt},Ve=$===0?te.hexGeoJson:te.hexGeoJson.map(function(Ye){var Mt=Ir(Ye,2),Et=Mt[0],Pt=Mt[1];return[[Et,ve],[Pt,he]].map(function(dn){var Gt=Ir(dn,2),$e=Gt[0],ot=Gt[1];return Ee($e,ot,$)})});return new aR([Ve],_r,_r*(1+H),!1,!0,!1,J)}})):new Rx.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?z(F):e.tweenGroup.add(new uo(L).to(F,e.hexPolygonsTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(z).onComplete(function(){e.tweenGroup.remove(this)}).start())}}).digest(e.hexPolygonsData)}}),PLe=window.THREE?window.THREE:{Vector3:re};function ILe(i,e){var t=function(o,a){var l=o[o.length-1];return[].concat(tr(o),tr(Array(a-o.length).fill(l)))},n=Math.max(i.length,e.length),r=ZF.apply(void 0,tr([i,e].map(function(s){return s.map(function(o){var a=o.x,l=o.y,c=o.z;return[a,l,c]})}).map(function(s){return t(s,n)})));return function(s){return s===0?i:s===1?e:r(s).map(function(o){var a=Ir(o,3),l=a[0],c=a[1],u=a[2];return new PLe.Vector3(l,c,u)})}}var d1=window.THREE?window.THREE:{BufferGeometry:Xn,Color:zt,Group:Br,Line:o0,NormalBlending:Ts,ShaderMaterial:ds,Vector3:re},LLe=m1.default.default||m1.default,rae=Qr({props:{pathsData:{default:[]},pathPoints:{default:function(e){return e}},pathPointLat:{default:function(e){return e[0]}},pathPointLng:{default:function(e){return e[1]}},pathPointAlt:{default:.001},pathResolution:{default:2},pathColor:{default:function(){return"#ffffaa"}},pathStroke:{},pathDashLength:{default:1},pathDashGap:{default:0},pathDashInitialGap:{default:0},pathDashAnimateTime:{default:0},pathTransitionDuration:{default:1e3,triggerUpdate:!1},rendererSize:{}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new LLe,sharedMaterial:new d1.ShaderMaterial($i($i({},Koe()),{},{transparent:!0,blending:d1.NormalBlending}))}},init:function(e,t){is(e),t.scene=e,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var n=new d1.Group;return n.__globeObjType="path",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=Ir(s,2),a=o[1];return a}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var o=s.children[0],a=o.__dashAnimateStep*r;if(o.type==="Line"){var l=o.material.uniforms.dashTranslate.value%1e9;o.material.uniforms.dashTranslate.value=l+a}else if(o.type==="Line2"){for(var c=o.material.dashOffset-a,u=o.material.dashSize+o.material.gapSize;c<=-u;)c+=u;o.material.dashOffset=c}})})},update:function(e){var t=st(e.pathPoints),n=st(e.pathPointLat),r=st(e.pathPointLng),s=st(e.pathPointAlt),o=st(e.pathStroke),a=st(e.pathColor),l=st(e.pathDashLength),c=st(e.pathDashGap),u=st(e.pathDashInitialGap),f=st(e.pathDashAnimateTime);e.dataMapper.onUpdateObj(function(S,T){var R=o(T),I=R!=null;if(!S.children.length||I===(S.children[0].type==="Line")){is(S);var P=I?new Mx(new Tm,new Rf):new d1.Line(new d1.BufferGeometry,e.sharedMaterial.clone());S.add(P)}var F=S.children[0],D=A(t(T),n,r,s,e.pathResolution),L=f(T);if(F.__dashAnimateStep=L>0?1e3/L:0,I){F.material.resolution=e.rendererSize;{var k=l(T),z=c(T),G=u(T);F.material.dashed=z>0,F.material.dashed?F.material.defines.USE_DASH="":delete F.material.defines.USE_DASH,F.material.dashed&&(F.material.dashScale=1/d(D),F.material.dashSize=k,F.material.gapSize=z,F.material.dashOffset=-G)}{var W=a(T);if(W instanceof Array){var Y=y(a(T),D.length-1,1,!1);F.geometry.setColors(Y.array),F.material.vertexColors=!0}else{var H=W,$=th(H);F.material.color=new d1.Color(Nf(H)),F.material.transparent=$<1,F.material.opacity=$,F.material.vertexColors=!1}}F.material.needsUpdate=!0}else{Object.assign(F.material.uniforms,{dashSize:{value:l(T)},gapSize:{value:c(T)},dashOffset:{value:u(T)}});var C=y(a(T),D.length),B=w(D.length,1,!0);F.geometry.setAttribute("color",C),F.geometry.setAttribute("relDistance",B)}var J=ILe(S.__currentTargetD&&S.__currentTargetD.points||[D[0]],D),te=function(Re){var Qe=S.__currentTargetD=Re,Fe=Qe.stroke,mt=Qe.interpolK,Ee=S.__currentTargetD.points=J(mt);if(I){var Ve;F.geometry.setPositions((Ve=[]).concat.apply(Ve,tr(Ee.map(function(Ye){var Mt=Ye.x,Et=Ye.y,Pt=Ye.z;return[Mt,Et,Pt]})))),F.material.linewidth=Fe,F.material.dashed&&F.computeLineDistances()}else F.geometry.setFromPoints(Ee),F.geometry.computeBoundingSphere()},ce={stroke:R,interpolK:1},he=Object.assign({},S.__currentTargetD||ce,{interpolK:0});Object.keys(ce).some(function(ve){return he[ve]!==ce[ve]})&&(!e.pathTransitionDuration||e.pathTransitionDuration<0?te(ce):e.tweenGroup.add(new uo(he).to(ce,e.pathTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(te).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.pathsData);function d(S){var T=0,R;return S.forEach(function(I){R&&(T+=R.distanceTo(I)),R=I}),T}function A(S,T,R,I,P){var F=function(B,k,z){for(var G=[],W=1;W<=z;W++)G.push(B+(k-B)*W/(z+1));return G},D=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,z=[],G=null;return B.forEach(function(W){if(G){for(;Math.abs(G[1]-W[1])>180;)G[1]+=360*(G[1]<W[1]?1:-1);var Y=Math.sqrt(Math.pow(W[0]-G[0],2)+Math.pow(W[1]-G[1],2));if(Y>k)for(var H=Math.floor(Y/k),$=F(G[0],W[0],H),J=F(G[1],W[1],H),te=F(G[2],W[2],H),ce=0,he=$.length;ce<he;ce++)z.push([$[ce],J[ce],te[ce]])}z.push(G=W)}),z},L=function(B){var k=Ir(B,3),z=k[0],G=k[1],W=k[2],Y=ou(z,G,W),H=Y.x,$=Y.y,J=Y.z;return new d1.Vector3(H,$,J)};return D(S.map(function(C){return[T(C),R(C),I(C)]}),P).map(L)}function y(S,T){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,I=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,P=T+1,F;if(S instanceof Array||S instanceof Function){var D=S instanceof Array?Tl().domain(S.map(function(W,Y){return Y/(S.length-1)})).range(S):S;F=function(Y){return Rm(D(Y),I,!0)}}else{var L=Rm(S,I,!0);F=function(){return L}}for(var C=[],B=0,k=P;B<k;B++)for(var z=F(B/(k-1)),G=0;G<R;G++)C.push(z);return Ff(C,I?4:3)}function w(S){for(var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,I=S+1,P=[],F=0,D=I;F<D;F++)for(var L=F/(D-1),C=0;C<T;C++)P.push(L);return R&&P.reverse(),Ff(P,1)}}}),YP=window.THREE?window.THREE:{Euler:Ua,Mesh:Hn,MeshLambertMaterial:Ga,SphereGeometry:Va},sae=Qr({props:{tilesData:{default:[]},tileLat:{default:"lat"},tileLng:{default:"lng"},tileAltitude:{default:.01},tileWidth:{default:1},tileHeight:{default:1},tileUseGlobeProjection:{default:!0},tileMaterial:{default:function(){return new YP.MeshLambertMaterial({color:"#ffbb88",opacity:.4,transparent:!0})}},tileCurvatureResolution:{default:5},tilesTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjTile"}).onCreateObj(function(){var s=new YP.Mesh;return s.__globeObjType="tile",s})},update:function(e){var t=st(e.tileLat),n=st(e.tileLng),r=st(e.tileAltitude),s=st(e.tileWidth),o=st(e.tileHeight),a=st(e.tileUseGlobeProjection),l=st(e.tileMaterial),c=st(e.tileCurvatureResolution);e.dataMapper.onUpdateObj(function(u,f){u.material=l(f);var d=a(f),A=c(f),y=function(R){var I=u.__currentTargetD=R,P=I.lat,F=I.lng,D=I.alt,L=I.width,C=I.height,B=Px(F),k=Px(-P);u.geometry&&u.geometry.dispose(),u.geometry=new YP.SphereGeometry(_r*(1+D),Math.ceil(L/(A||-1)),Math.ceil(C/(A||-1)),Px(90-L/2)+(d?B:0),Px(L),Px(90-C/2)+(d?k:0),Px(C)),d||u.setRotationFromEuler(new YP.Euler(k,B,0,"YXZ"))},w={lat:+t(f),lng:+n(f),alt:+r(f),width:+s(f),height:+o(f)},S=u.__currentTargetD||Object.assign({},w,{width:0,height:0});Object.keys(w).some(function(T){return S[T]!==w[T]})&&(!e.tilesTransitionDuration||e.tilesTransitionDuration<0?y(w):e.tweenGroup.add(new uo(S).to(w,e.tilesTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(y).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.tilesData)}}),Px=function(e){return e*Math.PI/180},VS=window.THREE?window.THREE:{BufferGeometry:Xn,Color:zt,Points:F2,PointsMaterial:a0},oae=Qr({props:{particlesData:{default:[]},particlesList:{default:function(e){return e}},particleLat:{default:"lat"},particleLng:{default:"lng"},particleAltitude:{default:.01},particlesSize:{default:.5},particlesSizeAttenuation:{default:!0},particlesColor:{default:function(){return"white"}},particlesTexture:{}},init:function(e,t){is(e),t.scene=e,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjParticles"}).onCreateObj(function(){var n=new VS.Points(new VS.BufferGeometry,new VS.PointsMaterial);return n.__globeObjType="particles",n}).onUpdateObj(function(n,r){var s=st(t.particlesList),o=st(t.particleLat),a=st(t.particleLng),l=st(t.particleAltitude);n.geometry.setAttribute("position",Ff(s(r).map(function(c){return Object.values(ou(o(c),a(c),l(c)))}),3))})},update:function(e,t){["particlesData","particlesList","particleLat","particleLng","particleAltitude"].some(function(a){return t.hasOwnProperty(a)})&&e.dataMapper.digest(e.particlesData);var n=st(e.particlesColor),r=st(e.particlesSize),s=st(e.particlesSizeAttenuation),o=st(e.particlesTexture);e.dataMapper.entries().forEach(function(a){var l=Ir(a,2),c=l[0],u=l[1];if(u.material.size=r(c),u.material.sizeAttenuation=s(c),e.particlesTexture)u.material.color=new VS.Color(16777215),u.material.transparent=!1,u.material.alphaTest=.5,u.material.map=o(c);else{var f=n(c),d=th(f);u.material.color=new VS.Color(Nf(f)),u.material.transparent=d<1,u.material.opacity=d,u.material.alphaTest=0}})}}),DLe=window.THREE?window.THREE:{BufferGeometry:Xn},NLe=(function(i){function e(){var t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:32;JP(this,e),t=QP(this,e),t.type="CircleLineGeometry",t.parameters={radius:n,segmentCount:r};for(var s=[],o=0;o<=r;o++){var a=(o/r-.25)*Math.PI*2;s.push({x:Math.cos(a)*n,y:Math.sin(a)*n,z:0})}return t.setFromPoints(s),t}return tI(e,i),eI(e)})(DLe.BufferGeometry),Ix=window.THREE?window.THREE:{Color:zt,Group:Br,Line:o0,LineBasicMaterial:Iu,Vector3:re},FLe=m1.default.default||m1.default,aae=Qr({props:{ringsData:{default:[]},ringLat:{default:"lat"},ringLng:{default:"lng"},ringAltitude:{default:.0015},ringColor:{default:function(){return"#ffffaa"},triggerUpdate:!1},ringResolution:{default:64,triggerUpdate:!1},ringMaxRadius:{default:2,triggerUpdate:!1},ringPropagationSpeed:{default:1,triggerUpdate:!1},ringRepeatPeriod:{default:700,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var s=new Ix.Group;return s.__globeObjType="ring",s}),t.ticker=new FLe,t.ticker.onTick.add(function(s){if(t.ringsData.length){var o=st(t.ringColor),a=st(t.ringAltitude),l=st(t.ringMaxRadius),c=st(t.ringPropagationSpeed),u=st(t.ringRepeatPeriod);t.dataMapper.entries().filter(function(f){var d=Ir(f,2),A=d[1];return A}).forEach(function(f){var d=Ir(f,2),A=d[0],y=d[1];if((y.__nextRingTime||0)<=s){var w=u(A)/1e3;y.__nextRingTime=s+(w<=0?1/0:w);var S=new Ix.Line(new NLe(1,t.ringResolution),new Ix.LineBasicMaterial),T=o(A),R=T instanceof Array||T instanceof Function,I;R?T instanceof Array?(I=Tl().domain(T.map(function(z,G){return G/(T.length-1)})).range(T),S.material.transparent=T.some(function(z){return th(z)<1})):(I=T,S.material.transparent=!0):(S.material.color=new Ix.Color(Nf(T)),mLe(S.material,th(T)));var P=_r*(1+a(A)),F=l(A),D=F*Math.PI/180,L=c(A),C=L<=0,B=function(G){var W=G.t,Y=(C?1-W:W)*D;if(S.scale.x=S.scale.y=P*Math.sin(Y),S.position.z=P*(1-Math.cos(Y)),R){var H=I(W);S.material.color=new Ix.Color(Nf(H)),S.material.transparent&&(S.material.opacity=th(H))}};if(L===0)B({t:0}),y.add(S);else{var k=Math.abs(F/L)*1e3;t.tweenGroup.add(new uo({t:0}).to({t:1},k).onUpdate(B).onStart(function(){return y.add(S)}).onComplete(function(){t.tweenGroup.remove(this),y.remove(S),Cm(S)}).start())}}})}})},update:function(e){var t=st(e.ringLat),n=st(e.ringLng),r=st(e.ringAltitude),s=e.scene.localToWorld(new Ix.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(o,a){var l=t(a),c=n(a),u=r(a);Object.assign(o.position,ou(l,c,u)),o.lookAt(s)}).digest(e.ringsData)}}),BLe={0:{x_min:73,x_max:715,ha:792,o:"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},1:{x_min:215.671875,x_max:574,ha:792,o:"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},2:{x_min:59,x_max:731,ha:792,o:"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},3:{x_min:54,x_max:737,ha:792,o:"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},4:{x_min:48,x_max:742.453125,ha:792,o:"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},5:{x_min:54.171875,x_max:738,ha:792,o:"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},6:{x_min:53,x_max:739,ha:792,o:"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},7:{x_min:58.71875,x_max:730.953125,ha:792,o:"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},8:{x_min:55,x_max:736,ha:792,o:"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},9:{x_min:53,x_max:739,ha:792,o:"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},\u03BF:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 96 88 192 -25 q 0 368 0 201 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 "},S:{x_min:0,x_max:788,ha:890,o:"m 788 291 q 662 54 788 144 q 397 -26 550 -26 q 116 68 226 -26 q 0 337 0 168 l 131 337 q 200 152 131 220 q 384 85 269 85 q 557 129 479 85 q 650 270 650 183 q 490 429 650 379 q 194 513 341 470 q 33 739 33 584 q 142 964 33 881 q 388 1041 242 1041 q 644 957 543 1041 q 756 716 756 867 l 625 716 q 561 874 625 816 q 395 933 497 933 q 243 891 309 933 q 164 759 164 841 q 325 609 164 656 q 625 526 475 568 q 788 291 788 454 "},"\xA6":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},"/":{x_min:183.25,x_max:608.328125,ha:792,o:"m 608 1041 l 266 -129 l 183 -129 l 520 1041 l 608 1041 "},\u03A4:{x_min:-.4375,x_max:777.453125,ha:839,o:"m 777 893 l 458 893 l 458 0 l 319 0 l 319 892 l 0 892 l 0 1013 l 777 1013 l 777 893 "},y:{x_min:0,x_max:684.78125,ha:771,o:"m 684 738 l 388 -83 q 311 -216 356 -167 q 173 -279 252 -279 q 97 -266 133 -279 l 97 -149 q 132 -155 109 -151 q 168 -160 155 -160 q 240 -114 213 -160 q 274 -26 248 -98 l 0 738 l 137 737 l 341 139 l 548 737 l 684 738 "},\u03A0:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 803 1012 l 803 0 "},\u0390:{x_min:-111,x_max:339,ha:361,o:"m 339 800 l 229 800 l 229 925 l 339 925 l 339 800 m -1 800 l -111 800 l -111 925 l -1 925 l -1 800 m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 m 302 1040 l 113 819 l 30 819 l 165 1040 l 302 1040 "},g:{x_min:0,x_max:686,ha:838,o:"m 686 34 q 586 -213 686 -121 q 331 -306 487 -306 q 131 -252 216 -306 q 31 -84 31 -190 l 155 -84 q 228 -174 166 -138 q 345 -207 284 -207 q 514 -109 454 -207 q 564 89 564 -27 q 461 6 521 36 q 335 -23 401 -23 q 88 100 184 -23 q 0 370 0 215 q 87 634 0 522 q 330 758 183 758 q 457 728 398 758 q 564 644 515 699 l 564 737 l 686 737 l 686 34 m 582 367 q 529 560 582 481 q 358 652 468 652 q 189 561 250 652 q 135 369 135 482 q 189 176 135 255 q 361 85 251 85 q 529 176 468 85 q 582 367 582 255 "},"\xB2":{x_min:0,x_max:442,ha:539,o:"m 442 383 l 0 383 q 91 566 0 492 q 260 668 176 617 q 354 798 354 727 q 315 875 354 845 q 227 905 277 905 q 136 869 173 905 q 99 761 99 833 l 14 761 q 82 922 14 864 q 232 974 141 974 q 379 926 316 974 q 442 797 442 878 q 351 635 442 704 q 183 539 321 611 q 92 455 92 491 l 442 455 l 442 383 "},"\u2013":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},\u039A:{x_min:0,x_max:819.5625,ha:893,o:"m 819 0 l 650 0 l 294 509 l 139 356 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},\u0192:{x_min:-46.265625,x_max:392,ha:513,o:"m 392 651 l 259 651 l 79 -279 l -46 -278 l 134 651 l 14 651 l 14 751 l 135 751 q 151 948 135 900 q 304 1041 185 1041 q 334 1040 319 1041 q 392 1034 348 1039 l 392 922 q 337 931 360 931 q 271 883 287 931 q 260 793 260 853 l 260 751 l 392 751 l 392 651 "},e:{x_min:0,x_max:714,ha:813,o:"m 714 326 l 140 326 q 200 157 140 227 q 359 87 260 87 q 488 130 431 87 q 561 245 545 174 l 697 245 q 577 48 670 123 q 358 -26 484 -26 q 97 85 195 -26 q 0 363 0 197 q 94 642 0 529 q 358 765 195 765 q 626 627 529 765 q 714 326 714 503 m 576 429 q 507 583 564 522 q 355 650 445 650 q 206 583 266 650 q 140 429 152 522 l 576 429 "},\u03CC:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 94 91 194 -25 q 0 368 0 202 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 m 576 1040 l 387 819 l 303 819 l 438 1040 l 576 1040 "},J:{x_min:0,x_max:588,ha:699,o:"m 588 279 q 287 -26 588 -26 q 58 73 126 -26 q 0 327 0 158 l 133 327 q 160 172 133 227 q 288 96 198 96 q 426 171 391 96 q 449 336 449 219 l 449 1013 l 588 1013 l 588 279 "},"\xBB":{x_min:-1,x_max:503,ha:601,o:"m 503 302 l 280 136 l 281 256 l 429 373 l 281 486 l 280 608 l 503 440 l 503 302 m 221 302 l 0 136 l 0 255 l 145 372 l 0 486 l -1 608 l 221 440 l 221 302 "},"\xA9":{x_min:-3,x_max:1008,ha:1106,o:"m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 741 394 q 661 246 731 302 q 496 190 591 190 q 294 285 369 190 q 228 497 228 370 q 295 714 228 625 q 499 813 370 813 q 656 762 588 813 q 733 625 724 711 l 634 625 q 589 704 629 673 q 498 735 550 735 q 377 666 421 735 q 334 504 334 597 q 374 340 334 408 q 490 272 415 272 q 589 304 549 272 q 638 394 628 337 l 741 394 "},\u03CE:{x_min:0,x_max:922,ha:1030,o:"m 687 1040 l 498 819 l 415 819 l 549 1040 l 687 1040 m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 338 0 202 q 45 551 0 444 q 161 737 84 643 l 302 737 q 175 552 219 647 q 124 336 124 446 q 155 179 124 248 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 341 797 257 q 745 555 797 450 q 619 737 705 637 l 760 737 q 874 551 835 640 q 922 339 922 444 "},"^":{x_min:193.0625,x_max:598.609375,ha:792,o:"m 598 772 l 515 772 l 395 931 l 277 772 l 193 772 l 326 1013 l 462 1013 l 598 772 "},"\xAB":{x_min:0,x_max:507.203125,ha:604,o:"m 506 136 l 284 302 l 284 440 l 506 608 l 507 485 l 360 371 l 506 255 l 506 136 m 222 136 l 0 302 l 0 440 l 222 608 l 221 486 l 73 373 l 222 256 l 222 136 "},D:{x_min:0,x_max:828,ha:935,o:"m 389 1013 q 714 867 593 1013 q 828 521 828 729 q 712 161 828 309 q 382 0 587 0 l 0 0 l 0 1013 l 389 1013 m 376 124 q 607 247 523 124 q 681 510 681 355 q 607 771 681 662 q 376 896 522 896 l 139 896 l 139 124 l 376 124 "},"\u2219":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},\u00FF:{x_min:0,x_max:47,ha:125,o:"m 47 3 q 37 -7 47 -7 q 28 0 30 -7 q 39 -4 32 -4 q 45 3 45 -1 l 37 0 q 28 9 28 0 q 39 19 28 19 l 47 16 l 47 19 l 47 3 m 37 1 q 44 8 44 1 q 37 16 44 16 q 30 8 30 16 q 37 1 30 1 m 26 1 l 23 22 l 14 0 l 3 22 l 3 3 l 0 25 l 13 1 l 22 25 l 26 1 "},w:{x_min:0,x_max:1009.71875,ha:1100,o:"m 1009 738 l 783 0 l 658 0 l 501 567 l 345 0 l 222 0 l 0 738 l 130 738 l 284 174 l 432 737 l 576 738 l 721 173 l 881 737 l 1009 738 "},$:{x_min:0,x_max:700,ha:793,o:"m 664 717 l 542 717 q 490 825 531 785 q 381 872 450 865 l 381 551 q 620 446 540 522 q 700 241 700 370 q 618 45 700 116 q 381 -25 536 -25 l 381 -152 l 307 -152 l 307 -25 q 81 62 162 -25 q 0 297 0 149 l 124 297 q 169 146 124 204 q 307 81 215 89 l 307 441 q 80 536 148 469 q 13 725 13 603 q 96 910 13 839 q 307 982 180 982 l 307 1077 l 381 1077 l 381 982 q 574 917 494 982 q 664 717 664 845 m 307 565 l 307 872 q 187 831 233 872 q 142 724 142 791 q 180 618 142 656 q 307 565 218 580 m 381 76 q 562 237 562 96 q 517 361 562 313 q 381 423 472 409 l 381 76 "},"\\":{x_min:-.015625,x_max:425.0625,ha:522,o:"m 425 -129 l 337 -129 l 0 1041 l 83 1041 l 425 -129 "},\u00B5:{x_min:0,x_max:697.21875,ha:747,o:"m 697 -4 q 629 -14 658 -14 q 498 97 513 -14 q 422 9 470 41 q 313 -23 374 -23 q 207 4 258 -23 q 119 81 156 32 l 119 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 173 124 246 q 308 83 216 83 q 452 178 402 83 q 493 359 493 255 l 493 738 l 617 738 l 617 214 q 623 136 617 160 q 673 92 637 92 q 697 96 684 92 l 697 -4 "},\u0399:{x_min:42,x_max:181,ha:297,o:"m 181 0 l 42 0 l 42 1013 l 181 1013 l 181 0 "},\u038E:{x_min:0,x_max:1144.5,ha:1214,o:"m 1144 1012 l 807 416 l 807 0 l 667 0 l 667 416 l 325 1012 l 465 1012 l 736 533 l 1004 1012 l 1144 1012 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"\u2019":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},\u039D:{x_min:0,x_max:801,ha:915,o:"m 801 0 l 651 0 l 131 822 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 191 l 670 1013 l 801 1013 l 801 0 "},"-":{x_min:8.71875,x_max:350.390625,ha:478,o:"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},Q:{x_min:0,x_max:968,ha:1072,o:"m 954 5 l 887 -79 l 744 35 q 622 -11 687 2 q 483 -26 556 -26 q 127 130 262 -26 q 0 504 0 279 q 127 880 0 728 q 484 1041 262 1041 q 841 884 708 1041 q 968 507 968 735 q 933 293 968 398 q 832 104 899 188 l 954 5 m 723 191 q 802 330 777 248 q 828 499 828 412 q 744 790 828 673 q 483 922 650 922 q 228 791 322 922 q 142 505 142 673 q 227 221 142 337 q 487 91 323 91 q 632 123 566 91 l 520 215 l 587 301 l 723 191 "},\u03C2:{x_min:1,x_max:676.28125,ha:740,o:"m 676 460 l 551 460 q 498 595 542 546 q 365 651 448 651 q 199 578 263 651 q 136 401 136 505 q 266 178 136 241 q 508 106 387 142 q 640 -50 640 62 q 625 -158 640 -105 q 583 -278 611 -211 l 465 -278 q 498 -182 490 -211 q 515 -80 515 -126 q 381 12 515 -15 q 134 91 197 51 q 1 388 1 179 q 100 651 1 542 q 354 761 199 761 q 587 680 498 761 q 676 460 676 599 "},M:{x_min:0,x_max:954,ha:1067,o:"m 954 0 l 819 0 l 819 869 l 537 0 l 405 0 l 128 866 l 128 0 l 0 0 l 0 1013 l 200 1013 l 472 160 l 757 1013 l 954 1013 l 954 0 "},\u03A8:{x_min:0,x_max:1006,ha:1094,o:"m 1006 678 q 914 319 1006 429 q 571 200 814 200 l 571 0 l 433 0 l 433 200 q 92 319 194 200 q 0 678 0 429 l 0 1013 l 139 1013 l 139 679 q 191 417 139 492 q 433 326 255 326 l 433 1013 l 571 1013 l 571 326 l 580 326 q 813 423 747 326 q 868 679 868 502 l 868 1013 l 1006 1013 l 1006 678 "},C:{x_min:0,x_max:886,ha:944,o:"m 886 379 q 760 87 886 201 q 455 -26 634 -26 q 112 136 236 -26 q 0 509 0 283 q 118 882 0 737 q 469 1041 245 1041 q 748 955 630 1041 q 879 708 879 859 l 745 708 q 649 862 724 805 q 473 920 573 920 q 219 791 312 920 q 136 509 136 675 q 217 229 136 344 q 470 99 311 99 q 672 179 591 99 q 753 379 753 259 l 886 379 "},"!":{x_min:0,x_max:138,ha:236,o:"m 138 684 q 116 409 138 629 q 105 244 105 299 l 33 244 q 16 465 33 313 q 0 684 0 616 l 0 1013 l 138 1013 l 138 684 m 138 0 l 0 0 l 0 151 l 138 151 l 138 0 "},"{":{x_min:0,x_max:480.5625,ha:578,o:"m 480 -286 q 237 -213 303 -286 q 187 -45 187 -159 q 194 48 187 -15 q 201 141 201 112 q 164 264 201 225 q 0 314 118 314 l 0 417 q 164 471 119 417 q 201 605 201 514 q 199 665 201 644 q 193 772 193 769 q 241 941 193 887 q 480 1015 308 1015 l 480 915 q 336 866 375 915 q 306 742 306 828 q 310 662 306 717 q 314 577 314 606 q 288 452 314 500 q 176 365 256 391 q 289 275 257 337 q 314 143 314 226 q 313 84 314 107 q 310 -11 310 -5 q 339 -131 310 -94 q 480 -182 377 -182 l 480 -286 "},X:{x_min:-.015625,x_max:854.15625,ha:940,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},"#":{x_min:0,x_max:963.890625,ha:1061,o:"m 963 690 l 927 590 l 719 590 l 655 410 l 876 410 l 840 310 l 618 310 l 508 -3 l 393 -2 l 506 309 l 329 310 l 215 -2 l 102 -3 l 212 310 l 0 310 l 36 410 l 248 409 l 312 590 l 86 590 l 120 690 l 347 690 l 459 1006 l 573 1006 l 462 690 l 640 690 l 751 1006 l 865 1006 l 754 690 l 963 690 m 606 590 l 425 590 l 362 410 l 543 410 l 606 590 "},\u03B9:{x_min:42,x_max:284,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 738 l 167 738 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 "},\u0386:{x_min:0,x_max:906.953125,ha:982,o:"m 283 1040 l 88 799 l 5 799 l 145 1040 l 283 1040 m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1012 l 529 1012 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},")":{x_min:0,x_max:318,ha:415,o:"m 318 365 q 257 25 318 191 q 87 -290 197 -141 l 0 -290 q 140 21 93 -128 q 193 360 193 189 q 141 704 193 537 q 0 1024 97 850 l 87 1024 q 257 706 197 871 q 318 365 318 542 "},\u03B5:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 314 0 265 q 128 390 67 353 q 56 460 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 "},\u0394:{x_min:0,x_max:952.78125,ha:1028,o:"m 952 0 l 0 0 l 400 1013 l 551 1013 l 952 0 m 762 124 l 476 867 l 187 124 l 762 124 "},"}":{x_min:0,x_max:481,ha:578,o:"m 481 314 q 318 262 364 314 q 282 136 282 222 q 284 65 282 97 q 293 -58 293 -48 q 241 -217 293 -166 q 0 -286 174 -286 l 0 -182 q 143 -130 105 -182 q 171 -2 171 -93 q 168 81 171 22 q 165 144 165 140 q 188 275 165 229 q 306 365 220 339 q 191 455 224 391 q 165 588 165 505 q 168 681 165 624 q 171 742 171 737 q 141 865 171 827 q 0 915 102 915 l 0 1015 q 243 942 176 1015 q 293 773 293 888 q 287 675 293 741 q 282 590 282 608 q 318 466 282 505 q 481 417 364 417 l 481 314 "},"\u2030":{x_min:-3,x_max:1672,ha:1821,o:"m 846 0 q 664 76 732 0 q 603 244 603 145 q 662 412 603 344 q 846 489 729 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 846 0 962 0 m 845 103 q 945 143 910 103 q 981 243 981 184 q 947 340 981 301 q 845 385 910 385 q 745 342 782 385 q 709 243 709 300 q 742 147 709 186 q 845 103 781 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 m 1428 0 q 1246 76 1314 0 q 1185 244 1185 145 q 1244 412 1185 344 q 1428 489 1311 489 q 1610 412 1542 489 q 1672 244 1672 343 q 1612 76 1672 144 q 1428 0 1545 0 m 1427 103 q 1528 143 1492 103 q 1564 243 1564 184 q 1530 340 1564 301 q 1427 385 1492 385 q 1327 342 1364 385 q 1291 243 1291 300 q 1324 147 1291 186 q 1427 103 1363 103 "},a:{x_min:0,x_max:698.609375,ha:794,o:"m 698 0 q 661 -12 679 -7 q 615 -17 643 -17 q 536 12 564 -17 q 500 96 508 41 q 384 6 456 37 q 236 -25 312 -25 q 65 31 130 -25 q 0 194 0 88 q 118 390 0 334 q 328 435 180 420 q 488 483 476 451 q 495 523 495 504 q 442 619 495 584 q 325 654 389 654 q 209 617 257 654 q 152 513 161 580 l 33 513 q 123 705 33 633 q 332 772 207 772 q 528 712 448 772 q 617 531 617 645 l 617 163 q 624 108 617 126 q 664 90 632 90 l 698 94 l 698 0 m 491 262 l 491 372 q 272 329 350 347 q 128 201 128 294 q 166 113 128 144 q 264 83 205 83 q 414 130 346 83 q 491 262 491 183 "},"\u2014":{x_min:0,x_max:941.671875,ha:1039,o:"m 941 334 l 0 334 l 0 410 l 941 410 l 941 334 "},"=":{x_min:8.71875,x_max:780.953125,ha:792,o:"m 780 510 l 8 510 l 8 606 l 780 606 l 780 510 m 780 235 l 8 235 l 8 332 l 780 332 l 780 235 "},N:{x_min:0,x_max:801,ha:914,o:"m 801 0 l 651 0 l 131 823 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 193 l 670 1013 l 801 1013 l 801 0 "},\u03C1:{x_min:0,x_max:712,ha:797,o:"m 712 369 q 620 94 712 207 q 362 -26 521 -26 q 230 2 292 -26 q 119 83 167 30 l 119 -278 l 0 -278 l 0 362 q 91 643 0 531 q 355 764 190 764 q 617 647 517 764 q 712 369 712 536 m 583 366 q 530 559 583 480 q 359 651 469 651 q 190 562 252 651 q 135 370 135 483 q 189 176 135 257 q 359 85 250 85 q 528 175 466 85 q 583 366 583 254 "},"\xAF":{x_min:0,x_max:941.671875,ha:938,o:"m 941 1033 l 0 1033 l 0 1109 l 941 1109 l 941 1033 "},Z:{x_min:0,x_max:779,ha:849,o:"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},u:{x_min:0,x_max:617,ha:729,o:"m 617 0 l 499 0 l 499 110 q 391 10 460 45 q 246 -25 322 -25 q 61 58 127 -25 q 0 258 0 136 l 0 738 l 125 738 l 125 284 q 156 148 125 202 q 273 82 197 82 q 433 165 369 82 q 493 340 493 243 l 493 738 l 617 738 l 617 0 "},k:{x_min:0,x_max:612.484375,ha:697,o:"m 612 738 l 338 465 l 608 0 l 469 0 l 251 382 l 121 251 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 402 l 456 738 l 612 738 "},\u0397:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},\u0391:{x_min:0,x_max:906.953125,ha:985,o:"m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},s:{x_min:0,x_max:604,ha:697,o:"m 604 217 q 501 36 604 104 q 292 -23 411 -23 q 86 43 166 -23 q 0 238 0 114 l 121 237 q 175 122 121 164 q 300 85 223 85 q 415 112 363 85 q 479 207 479 147 q 361 309 479 276 q 140 372 141 370 q 21 544 21 426 q 111 708 21 647 q 298 761 190 761 q 492 705 413 761 q 583 531 583 643 l 462 531 q 412 625 462 594 q 298 657 363 657 q 199 636 242 657 q 143 558 143 608 q 262 454 143 486 q 484 394 479 397 q 604 217 604 341 "},B:{x_min:0,x_max:778,ha:876,o:"m 580 546 q 724 469 670 535 q 778 311 778 403 q 673 83 778 171 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 892 q 691 633 732 693 q 580 546 650 572 m 393 899 l 139 899 l 139 588 l 379 588 q 521 624 462 588 q 592 744 592 667 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 303 635 219 q 559 436 635 389 q 402 477 494 477 l 139 477 l 139 124 l 419 124 "},"\u2026":{x_min:0,x_max:614,ha:708,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 m 378 0 l 236 0 l 236 151 l 378 151 l 378 0 m 614 0 l 472 0 l 472 151 l 614 151 l 614 0 "},"?":{x_min:0,x_max:607,ha:704,o:"m 607 777 q 543 599 607 674 q 422 474 482 537 q 357 272 357 391 l 236 272 q 297 487 236 395 q 411 619 298 490 q 474 762 474 691 q 422 885 474 838 q 301 933 371 933 q 179 880 228 933 q 124 706 124 819 l 0 706 q 94 963 0 872 q 302 1044 177 1044 q 511 973 423 1044 q 607 777 607 895 m 370 0 l 230 0 l 230 151 l 370 151 l 370 0 "},H:{x_min:0,x_max:803,ha:915,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},\u03BD:{x_min:0,x_max:675,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 738 l 340 147 l 541 738 l 675 738 "},c:{x_min:1,x_max:701.390625,ha:775,o:"m 701 264 q 584 53 681 133 q 353 -26 487 -26 q 91 91 188 -26 q 1 370 1 201 q 92 645 1 537 q 353 761 190 761 q 572 688 479 761 q 690 493 666 615 l 556 493 q 487 606 545 562 q 356 650 428 650 q 186 563 246 650 q 134 372 134 487 q 188 179 134 258 q 359 88 250 88 q 492 136 437 88 q 566 264 548 185 l 701 264 "},"\xB6":{x_min:0,x_max:566.671875,ha:678,o:"m 21 892 l 52 892 l 98 761 l 145 892 l 176 892 l 178 741 l 157 741 l 157 867 l 108 741 l 88 741 l 40 871 l 40 741 l 21 741 l 21 892 m 308 854 l 308 731 q 252 691 308 691 q 227 691 240 691 q 207 696 213 695 l 207 712 l 253 706 q 288 733 288 706 l 288 763 q 244 741 279 741 q 193 797 193 741 q 261 860 193 860 q 287 860 273 860 q 308 854 302 855 m 288 842 l 263 843 q 213 796 213 843 q 248 756 213 756 q 288 796 288 756 l 288 842 m 566 988 l 502 988 l 502 -1 l 439 -1 l 439 988 l 317 988 l 317 -1 l 252 -1 l 252 602 q 81 653 155 602 q 0 805 0 711 q 101 989 0 918 q 309 1053 194 1053 l 566 1053 l 566 988 "},\u03B2:{x_min:0,x_max:660,ha:745,o:"m 471 550 q 610 450 561 522 q 660 280 660 378 q 578 64 660 151 q 367 -22 497 -22 q 239 5 299 -22 q 126 82 178 32 l 126 -278 l 0 -278 l 0 593 q 54 903 0 801 q 318 1042 127 1042 q 519 964 436 1042 q 603 771 603 887 q 567 644 603 701 q 471 550 532 586 m 337 79 q 476 138 418 79 q 535 279 535 198 q 427 437 535 386 q 226 477 344 477 l 226 583 q 398 620 329 583 q 486 762 486 668 q 435 884 486 833 q 312 935 384 935 q 169 861 219 935 q 126 698 126 797 l 126 362 q 170 169 126 242 q 337 79 224 79 "},\u039C:{x_min:0,x_max:954,ha:1068,o:"m 954 0 l 819 0 l 819 868 l 537 0 l 405 0 l 128 865 l 128 0 l 0 0 l 0 1013 l 199 1013 l 472 158 l 758 1013 l 954 1013 l 954 0 "},\u038C:{x_min:.109375,x_max:1120,ha:1217,o:"m 1120 505 q 994 132 1120 282 q 642 -29 861 -29 q 290 130 422 -29 q 167 505 167 280 q 294 883 167 730 q 650 1046 430 1046 q 999 882 868 1046 q 1120 505 1120 730 m 977 504 q 896 784 977 669 q 644 915 804 915 q 391 785 484 915 q 307 504 307 669 q 391 224 307 339 q 644 95 486 95 q 894 224 803 95 q 977 504 977 339 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},\u0389:{x_min:0,x_max:1158,ha:1275,o:"m 1158 0 l 1022 0 l 1022 475 l 496 475 l 496 0 l 356 0 l 356 1012 l 496 1012 l 496 599 l 1022 599 l 1022 1012 l 1158 1012 l 1158 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"\u2022":{x_min:0,x_max:663.890625,ha:775,o:"m 663 529 q 566 293 663 391 q 331 196 469 196 q 97 294 194 196 q 0 529 0 393 q 96 763 0 665 q 331 861 193 861 q 566 763 469 861 q 663 529 663 665 "},"\xA5":{x_min:.1875,x_max:819.546875,ha:886,o:"m 563 561 l 697 561 l 696 487 l 520 487 l 482 416 l 482 380 l 697 380 l 695 308 l 482 308 l 482 0 l 342 0 l 342 308 l 125 308 l 125 380 l 342 380 l 342 417 l 303 487 l 125 487 l 125 561 l 258 561 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 l 563 561 "},"(":{x_min:0,x_max:318.0625,ha:415,o:"m 318 -290 l 230 -290 q 61 23 122 -142 q 0 365 0 190 q 62 712 0 540 q 230 1024 119 869 l 318 1024 q 175 705 219 853 q 125 360 125 542 q 176 22 125 187 q 318 -290 223 -127 "},U:{x_min:0,x_max:796,ha:904,o:"m 796 393 q 681 93 796 212 q 386 -25 566 -25 q 101 95 208 -25 q 0 393 0 211 l 0 1013 l 138 1013 l 138 391 q 204 191 138 270 q 394 107 276 107 q 586 191 512 107 q 656 391 656 270 l 656 1013 l 796 1013 l 796 393 "},\u03B3:{x_min:.5,x_max:744.953125,ha:822,o:"m 744 737 l 463 54 l 463 -278 l 338 -278 l 338 54 l 154 495 q 104 597 124 569 q 13 651 67 651 l 0 651 l 0 751 l 39 753 q 168 711 121 753 q 242 594 207 676 l 403 208 l 617 737 l 744 737 "},\u03B1:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 728 407 760 q 563 637 524 696 l 563 739 l 685 739 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 96 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 "},F:{x_min:0,x_max:683.328125,ha:717,o:"m 683 888 l 140 888 l 140 583 l 613 583 l 613 458 l 140 458 l 140 0 l 0 0 l 0 1013 l 683 1013 l 683 888 "},"\xAD":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},":":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},\u03A7:{x_min:0,x_max:854.171875,ha:935,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 427 637 l 675 1013 l 836 1013 l 504 521 l 854 0 "},"*":{x_min:116,x_max:674,ha:792,o:"m 674 768 l 475 713 l 610 544 l 517 477 l 394 652 l 272 478 l 178 544 l 314 713 l 116 766 l 153 876 l 341 812 l 342 1013 l 446 1013 l 446 811 l 635 874 l 674 768 "},"\u2020":{x_min:0,x_max:777,ha:835,o:"m 458 804 l 777 804 l 777 683 l 458 683 l 458 0 l 319 0 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 "},"\xB0":{x_min:0,x_max:347,ha:444,o:"m 173 802 q 43 856 91 802 q 0 977 0 905 q 45 1101 0 1049 q 173 1153 90 1153 q 303 1098 255 1153 q 347 977 347 1049 q 303 856 347 905 q 173 802 256 802 m 173 884 q 238 910 214 884 q 262 973 262 937 q 239 1038 262 1012 q 173 1064 217 1064 q 108 1037 132 1064 q 85 973 85 1010 q 108 910 85 937 q 173 884 132 884 "},V:{x_min:0,x_max:862.71875,ha:940,o:"m 862 1013 l 505 0 l 361 0 l 0 1013 l 143 1013 l 434 165 l 718 1012 l 862 1013 "},\u039E:{x_min:0,x_max:734.71875,ha:763,o:"m 723 889 l 9 889 l 9 1013 l 723 1013 l 723 889 m 673 463 l 61 463 l 61 589 l 673 589 l 673 463 m 734 0 l 0 0 l 0 124 l 734 124 l 734 0 "},"\xA0":{x_min:0,x_max:0,ha:853},\u03AB:{x_min:.328125,x_max:819.515625,ha:889,o:"m 588 1046 l 460 1046 l 460 1189 l 588 1189 l 588 1046 m 360 1046 l 232 1046 l 232 1189 l 360 1189 l 360 1046 m 819 1012 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1012 l 140 1012 l 411 533 l 679 1012 l 819 1012 "},"\u201D":{x_min:0,x_max:347,ha:454,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 m 347 851 q 310 737 347 784 q 208 669 273 690 l 208 734 q 267 787 250 741 q 280 873 280 821 l 208 873 l 208 1013 l 347 1013 l 347 851 "},"@":{x_min:0,x_max:1260,ha:1357,o:"m 1098 -45 q 877 -160 1001 -117 q 633 -203 752 -203 q 155 -29 327 -203 q 0 360 0 127 q 176 802 0 616 q 687 1008 372 1008 q 1123 854 969 1008 q 1260 517 1260 718 q 1155 216 1260 341 q 868 82 1044 82 q 772 106 801 82 q 737 202 737 135 q 647 113 700 144 q 527 82 594 82 q 367 147 420 82 q 314 312 314 212 q 401 565 314 452 q 639 690 498 690 q 810 588 760 690 l 849 668 l 938 668 q 877 441 900 532 q 833 226 833 268 q 853 182 833 198 q 902 167 873 167 q 1088 272 1012 167 q 1159 512 1159 372 q 1051 793 1159 681 q 687 925 925 925 q 248 747 415 925 q 97 361 97 586 q 226 26 97 159 q 627 -122 370 -122 q 856 -87 737 -122 q 1061 8 976 -53 l 1098 -45 m 786 488 q 738 580 777 545 q 643 615 700 615 q 483 517 548 615 q 425 322 425 430 q 457 203 425 250 q 552 156 490 156 q 722 273 665 156 q 786 488 738 309 "},\u038A:{x_min:0,x_max:499,ha:613,o:"m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 m 499 0 l 360 0 l 360 1012 l 499 1012 l 499 0 "},i:{x_min:14,x_max:136,ha:275,o:"m 136 873 l 14 873 l 14 1013 l 136 1013 l 136 873 m 136 0 l 14 0 l 14 737 l 136 737 l 136 0 "},\u0392:{x_min:0,x_max:778,ha:877,o:"m 580 545 q 724 468 671 534 q 778 310 778 402 q 673 83 778 170 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 891 q 691 632 732 692 q 580 545 650 571 m 393 899 l 139 899 l 139 587 l 379 587 q 521 623 462 587 q 592 744 592 666 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 302 635 219 q 559 435 635 388 q 402 476 494 476 l 139 476 l 139 124 l 419 124 "},\u03C5:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 94 617 199 q 308 -24 455 -24 q 76 94 161 -24 q 0 352 0 199 l 0 739 l 126 739 l 126 355 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 355 492 257 l 492 739 l 617 739 l 617 352 "},"]":{x_min:0,x_max:275,ha:372,o:"m 275 -281 l 0 -281 l 0 -187 l 151 -187 l 151 920 l 0 920 l 0 1013 l 275 1013 l 275 -281 "},m:{x_min:0,x_max:1019,ha:1128,o:"m 1019 0 l 897 0 l 897 454 q 860 591 897 536 q 739 660 816 660 q 613 586 659 660 q 573 436 573 522 l 573 0 l 447 0 l 447 455 q 412 591 447 535 q 294 657 372 657 q 165 586 213 657 q 122 437 122 521 l 122 0 l 0 0 l 0 738 l 117 738 l 117 640 q 202 730 150 697 q 316 763 254 763 q 437 730 381 763 q 525 642 494 697 q 621 731 559 700 q 753 763 682 763 q 943 694 867 763 q 1019 512 1019 625 l 1019 0 "},\u03C7:{x_min:8.328125,x_max:780.5625,ha:815,o:"m 780 -278 q 715 -294 747 -294 q 616 -257 663 -294 q 548 -175 576 -227 l 379 133 l 143 -277 l 9 -277 l 313 254 l 163 522 q 127 586 131 580 q 36 640 91 640 q 8 637 27 640 l 8 752 l 52 757 q 162 719 113 757 q 236 627 200 690 l 383 372 l 594 737 l 726 737 l 448 250 l 625 -69 q 670 -153 647 -110 q 743 -188 695 -188 q 780 -184 759 -188 l 780 -278 "},\u03AF:{x_min:42,x_max:326.71875,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 102 239 101 q 284 112 257 104 l 284 3 m 326 1040 l 137 819 l 54 819 l 189 1040 l 326 1040 "},\u0396:{x_min:0,x_max:779.171875,ha:850,o:"m 779 0 l 0 0 l 0 113 l 620 896 l 40 896 l 40 1013 l 779 1013 l 779 887 l 170 124 l 779 124 l 779 0 "},R:{x_min:0,x_max:781.953125,ha:907,o:"m 781 0 l 623 0 q 587 242 590 52 q 407 433 585 433 l 138 433 l 138 0 l 0 0 l 0 1013 l 396 1013 q 636 946 539 1013 q 749 731 749 868 q 711 597 749 659 q 608 502 674 534 q 718 370 696 474 q 729 207 722 352 q 781 26 736 62 l 781 0 m 373 551 q 533 594 465 551 q 614 731 614 645 q 532 859 614 815 q 373 896 465 896 l 138 896 l 138 551 l 373 551 "},o:{x_min:0,x_max:713,ha:821,o:"m 357 -25 q 94 91 194 -25 q 0 368 0 202 q 93 642 0 533 q 357 761 193 761 q 618 644 518 761 q 713 368 713 533 q 619 91 713 201 q 357 -25 521 -25 m 357 85 q 528 175 465 85 q 584 369 584 255 q 529 562 584 484 q 357 651 467 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 357 85 250 85 "},K:{x_min:0,x_max:819.46875,ha:906,o:"m 819 0 l 649 0 l 294 509 l 139 355 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},",":{x_min:0,x_max:142,ha:239,o:"m 142 -12 q 105 -132 142 -82 q 0 -205 68 -182 l 0 -138 q 57 -82 40 -124 q 70 0 70 -51 l 0 0 l 0 151 l 142 151 l 142 -12 "},d:{x_min:0,x_max:683,ha:796,o:"m 683 0 l 564 0 l 564 93 q 456 6 516 38 q 327 -25 395 -25 q 87 100 181 -25 q 0 365 0 215 q 90 639 0 525 q 343 763 187 763 q 564 647 486 763 l 564 1013 l 683 1013 l 683 0 m 582 373 q 529 562 582 484 q 361 653 468 653 q 190 561 253 653 q 135 365 135 479 q 189 175 135 254 q 358 85 251 85 q 529 178 468 85 q 582 373 582 258 "},"\xA8":{x_min:-109,x_max:247,ha:232,o:"m 247 1046 l 119 1046 l 119 1189 l 247 1189 l 247 1046 m 19 1046 l -109 1046 l -109 1189 l 19 1189 l 19 1046 "},E:{x_min:0,x_max:736.109375,ha:789,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},Y:{x_min:0,x_max:820,ha:886,o:"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},'"':{x_min:0,x_max:299,ha:396,o:"m 299 606 l 203 606 l 203 988 l 299 988 l 299 606 m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"\u2039":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"\u201E":{x_min:0,x_max:364,ha:467,o:"m 141 -12 q 104 -132 141 -82 q 0 -205 67 -182 l 0 -138 q 56 -82 40 -124 q 69 0 69 -51 l 0 0 l 0 151 l 141 151 l 141 -12 m 364 -12 q 327 -132 364 -82 q 222 -205 290 -182 l 222 -138 q 279 -82 262 -124 q 292 0 292 -51 l 222 0 l 222 151 l 364 151 l 364 -12 "},\u03B4:{x_min:1,x_max:710,ha:810,o:"m 710 360 q 616 87 710 196 q 356 -28 518 -28 q 99 82 197 -28 q 1 356 1 192 q 100 606 1 509 q 355 703 199 703 q 180 829 288 754 q 70 903 124 866 l 70 1012 l 643 1012 l 643 901 l 258 901 q 462 763 422 794 q 636 592 577 677 q 710 360 710 485 m 584 365 q 552 501 584 447 q 451 602 521 555 q 372 611 411 611 q 197 541 258 611 q 136 355 136 472 q 190 171 136 245 q 358 85 252 85 q 528 173 465 85 q 584 365 584 252 "},\u03AD:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 313 0 265 q 128 390 67 352 q 56 459 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 m 520 1040 l 331 819 l 248 819 l 383 1040 l 520 1040 "},\u03C9:{x_min:0,x_max:922,ha:1031,o:"m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 339 0 203 q 45 551 0 444 q 161 738 84 643 l 302 738 q 175 553 219 647 q 124 336 124 446 q 155 179 124 249 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 342 797 257 q 745 556 797 450 q 619 738 705 638 l 760 738 q 874 551 835 640 q 922 339 922 444 "},"\xB4":{x_min:0,x_max:96,ha:251,o:"m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"\xB1":{x_min:11,x_max:781,ha:792,o:"m 781 490 l 446 490 l 446 255 l 349 255 l 349 490 l 11 490 l 11 586 l 349 586 l 349 819 l 446 819 l 446 586 l 781 586 l 781 490 m 781 21 l 11 21 l 11 115 l 781 115 l 781 21 "},"|":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},\u03CB:{x_min:0,x_max:617,ha:725,o:"m 482 800 l 372 800 l 372 925 l 482 925 l 482 800 m 239 800 l 129 800 l 129 925 l 239 925 l 239 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 "},"\xA7":{x_min:0,x_max:593,ha:690,o:"m 593 425 q 554 312 593 369 q 467 233 516 254 q 537 83 537 172 q 459 -74 537 -12 q 288 -133 387 -133 q 115 -69 184 -133 q 47 96 47 -6 l 166 96 q 199 7 166 40 q 288 -26 232 -26 q 371 -5 332 -26 q 420 60 420 21 q 311 201 420 139 q 108 309 210 255 q 0 490 0 383 q 33 602 0 551 q 124 687 66 654 q 75 743 93 712 q 58 812 58 773 q 133 984 58 920 q 300 1043 201 1043 q 458 987 394 1043 q 529 814 529 925 l 411 814 q 370 908 404 877 q 289 939 336 939 q 213 911 246 939 q 180 841 180 883 q 286 720 180 779 q 484 612 480 615 q 593 425 593 534 m 467 409 q 355 544 467 473 q 196 630 228 612 q 146 587 162 609 q 124 525 124 558 q 239 387 124 462 q 398 298 369 315 q 448 345 429 316 q 467 409 467 375 "},b:{x_min:0,x_max:685,ha:783,o:"m 685 372 q 597 99 685 213 q 347 -25 501 -25 q 219 5 277 -25 q 121 93 161 36 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 634 q 214 723 157 692 q 341 754 272 754 q 591 637 493 754 q 685 372 685 526 m 554 356 q 499 550 554 470 q 328 644 437 644 q 162 556 223 644 q 108 369 108 478 q 160 176 108 256 q 330 83 221 83 q 498 169 435 83 q 554 356 554 245 "},q:{x_min:0,x_max:683,ha:876,o:"m 683 -278 l 564 -278 l 564 97 q 474 8 533 39 q 345 -23 415 -23 q 91 93 188 -23 q 0 364 0 203 q 87 635 0 522 q 337 760 184 760 q 466 727 408 760 q 564 637 523 695 l 564 737 l 683 737 l 683 -278 m 582 375 q 527 564 582 488 q 358 652 466 652 q 190 565 253 652 q 135 377 135 488 q 189 179 135 261 q 361 84 251 84 q 530 179 469 84 q 582 375 582 260 "},\u03A9:{x_min:-.171875,x_max:969.5625,ha:1068,o:"m 969 0 l 555 0 l 555 123 q 744 308 675 194 q 814 558 814 423 q 726 812 814 709 q 484 922 633 922 q 244 820 334 922 q 154 567 154 719 q 223 316 154 433 q 412 123 292 199 l 412 0 l 0 0 l 0 124 l 217 124 q 68 327 122 210 q 15 572 15 444 q 144 911 15 781 q 484 1041 274 1041 q 822 909 691 1041 q 953 569 953 777 q 899 326 953 443 q 750 124 846 210 l 969 124 l 969 0 "},\u03CD:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 535 1040 l 346 819 l 262 819 l 397 1040 l 535 1040 "},z:{x_min:-.015625,x_max:613.890625,ha:697,o:"m 613 0 l 0 0 l 0 100 l 433 630 l 20 630 l 20 738 l 594 738 l 593 636 l 163 110 l 613 110 l 613 0 "},"\u2122":{x_min:0,x_max:894,ha:1e3,o:"m 389 951 l 229 951 l 229 503 l 160 503 l 160 951 l 0 951 l 0 1011 l 389 1011 l 389 951 m 894 503 l 827 503 l 827 939 l 685 503 l 620 503 l 481 937 l 481 503 l 417 503 l 417 1011 l 517 1011 l 653 580 l 796 1010 l 894 1011 l 894 503 "},\u03AE:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 721 124 755 q 200 630 193 687 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 m 479 1040 l 290 819 l 207 819 l 341 1040 l 479 1040 "},\u0398:{x_min:0,x_max:960,ha:1056,o:"m 960 507 q 833 129 960 280 q 476 -32 698 -32 q 123 129 255 -32 q 0 507 0 280 q 123 883 0 732 q 476 1045 255 1045 q 832 883 696 1045 q 960 507 960 732 m 817 500 q 733 789 817 669 q 476 924 639 924 q 223 792 317 924 q 142 507 142 675 q 222 222 142 339 q 476 89 315 89 q 730 218 636 89 q 817 500 817 334 m 716 449 l 243 449 l 243 571 l 716 571 l 716 449 "},"\xAE":{x_min:-3,x_max:1008,ha:1106,o:"m 503 532 q 614 562 566 532 q 672 658 672 598 q 614 747 672 716 q 503 772 569 772 l 338 772 l 338 532 l 503 532 m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 788 146 l 678 146 q 653 316 655 183 q 527 449 652 449 l 338 449 l 338 146 l 241 146 l 241 854 l 518 854 q 688 808 621 854 q 766 658 766 755 q 739 563 766 607 q 668 497 713 519 q 751 331 747 472 q 788 164 756 190 l 788 146 "},"~":{x_min:0,x_max:833,ha:931,o:"m 833 958 q 778 753 833 831 q 594 665 716 665 q 402 761 502 665 q 240 857 302 857 q 131 795 166 857 q 104 665 104 745 l 0 665 q 54 867 0 789 q 237 958 116 958 q 429 861 331 958 q 594 765 527 765 q 704 827 670 765 q 729 958 729 874 l 833 958 "},\u0395:{x_min:0,x_max:736.21875,ha:778,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},"\xB3":{x_min:0,x_max:450,ha:547,o:"m 450 552 q 379 413 450 464 q 220 366 313 366 q 69 414 130 366 q 0 567 0 470 l 85 567 q 126 470 85 504 q 225 437 168 437 q 320 467 280 437 q 360 552 360 498 q 318 632 360 608 q 213 657 276 657 q 195 657 203 657 q 176 657 181 657 l 176 722 q 279 733 249 722 q 334 815 334 752 q 300 881 334 856 q 220 907 267 907 q 133 875 169 907 q 97 781 97 844 l 15 781 q 78 926 15 875 q 220 972 135 972 q 364 930 303 972 q 426 817 426 888 q 344 697 426 733 q 421 642 392 681 q 450 552 450 603 "},"[":{x_min:0,x_max:273.609375,ha:371,o:"m 273 -281 l 0 -281 l 0 1013 l 273 1013 l 273 920 l 124 920 l 124 -187 l 273 -187 l 273 -281 "},L:{x_min:0,x_max:645.828125,ha:696,o:"m 645 0 l 0 0 l 0 1013 l 140 1013 l 140 126 l 645 126 l 645 0 "},\u03C3:{x_min:0,x_max:803.390625,ha:894,o:"m 803 628 l 633 628 q 713 368 713 512 q 618 93 713 204 q 357 -25 518 -25 q 94 91 194 -25 q 0 368 0 201 q 94 644 0 533 q 356 761 194 761 q 481 750 398 761 q 608 739 564 739 l 803 739 l 803 628 m 360 85 q 529 180 467 85 q 584 374 584 262 q 527 566 584 490 q 352 651 463 651 q 187 559 247 651 q 135 368 135 478 q 189 175 135 254 q 360 85 251 85 "},\u03B6:{x_min:0,x_max:573,ha:642,o:"m 573 -40 q 553 -162 573 -97 q 510 -278 543 -193 l 400 -278 q 441 -187 428 -219 q 462 -90 462 -132 q 378 -14 462 -14 q 108 45 197 -14 q 0 290 0 117 q 108 631 0 462 q 353 901 194 767 l 55 901 l 55 1012 l 561 1012 l 561 924 q 261 669 382 831 q 128 301 128 489 q 243 117 128 149 q 458 98 350 108 q 573 -40 573 80 "},\u03B8:{x_min:0,x_max:674,ha:778,o:"m 674 496 q 601 160 674 304 q 336 -26 508 -26 q 73 153 165 -26 q 0 485 0 296 q 72 840 0 683 q 343 1045 166 1045 q 605 844 516 1045 q 674 496 674 692 m 546 579 q 498 798 546 691 q 336 935 437 935 q 178 798 237 935 q 126 579 137 701 l 546 579 m 546 475 l 126 475 q 170 233 126 348 q 338 80 230 80 q 504 233 447 80 q 546 475 546 346 "},\u039F:{x_min:0,x_max:958,ha:1054,o:"m 485 1042 q 834 883 703 1042 q 958 511 958 735 q 834 136 958 287 q 481 -26 701 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 729 q 485 1042 263 1042 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 670 q 480 913 640 913 q 226 785 321 913 q 142 504 142 671 q 226 224 142 339 q 480 98 319 98 "},\u0393:{x_min:0,x_max:705.28125,ha:749,o:"m 705 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 705 1012 l 705 886 "}," ":{x_min:0,x_max:0,ha:375},"%":{x_min:-3,x_max:1089,ha:1186,o:"m 845 0 q 663 76 731 0 q 602 244 602 145 q 661 412 602 344 q 845 489 728 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 845 0 962 0 m 844 103 q 945 143 909 103 q 981 243 981 184 q 947 340 981 301 q 844 385 909 385 q 744 342 781 385 q 708 243 708 300 q 741 147 708 186 q 844 103 780 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 "},P:{x_min:0,x_max:726,ha:806,o:"m 424 1013 q 640 931 555 1013 q 726 719 726 850 q 637 506 726 587 q 413 426 548 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 379 889 l 140 889 l 140 548 l 372 548 q 522 589 459 548 q 593 720 593 637 q 528 845 593 801 q 379 889 463 889 "},\u0388:{x_min:0,x_max:1078.21875,ha:1118,o:"m 1078 0 l 342 0 l 342 1013 l 1067 1013 l 1067 889 l 481 889 l 481 585 l 1019 585 l 1019 467 l 481 467 l 481 125 l 1078 125 l 1078 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},\u038F:{x_min:.125,x_max:1136.546875,ha:1235,o:"m 1136 0 l 722 0 l 722 123 q 911 309 842 194 q 981 558 981 423 q 893 813 981 710 q 651 923 800 923 q 411 821 501 923 q 321 568 321 720 q 390 316 321 433 q 579 123 459 200 l 579 0 l 166 0 l 166 124 l 384 124 q 235 327 289 210 q 182 572 182 444 q 311 912 182 782 q 651 1042 441 1042 q 989 910 858 1042 q 1120 569 1120 778 q 1066 326 1120 443 q 917 124 1013 210 l 1136 124 l 1136 0 m 277 1040 l 83 800 l 0 800 l 140 1041 l 277 1040 "},_:{x_min:0,x_max:705.5625,ha:803,o:"m 705 -334 l 0 -334 l 0 -234 l 705 -234 l 705 -334 "},\u03AA:{x_min:-110,x_max:246,ha:275,o:"m 246 1046 l 118 1046 l 118 1189 l 246 1189 l 246 1046 m 18 1046 l -110 1046 l -110 1189 l 18 1189 l 18 1046 m 136 0 l 0 0 l 0 1012 l 136 1012 l 136 0 "},"+":{x_min:23,x_max:768,ha:792,o:"m 768 372 l 444 372 l 444 0 l 347 0 l 347 372 l 23 372 l 23 468 l 347 468 l 347 840 l 444 840 l 444 468 l 768 468 l 768 372 "},"\xBD":{x_min:0,x_max:1050,ha:1149,o:"m 1050 0 l 625 0 q 712 178 625 108 q 878 277 722 187 q 967 385 967 328 q 932 456 967 429 q 850 484 897 484 q 759 450 798 484 q 721 352 721 416 l 640 352 q 706 502 640 448 q 851 551 766 551 q 987 509 931 551 q 1050 385 1050 462 q 976 251 1050 301 q 829 179 902 215 q 717 68 740 133 l 1050 68 l 1050 0 m 834 985 l 215 -28 l 130 -28 l 750 984 l 834 985 m 224 422 l 142 422 l 142 811 l 0 811 l 0 867 q 104 889 62 867 q 164 973 157 916 l 224 973 l 224 422 "},\u03A1:{x_min:0,x_max:720,ha:783,o:"m 424 1013 q 637 933 554 1013 q 720 723 720 853 q 633 508 720 591 q 413 426 546 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 378 889 l 140 889 l 140 548 l 371 548 q 521 589 458 548 q 592 720 592 637 q 527 845 592 801 q 378 889 463 889 "},"'":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},\u00AA:{x_min:0,x_max:350,ha:397,o:"m 350 625 q 307 616 328 616 q 266 631 281 616 q 247 673 251 645 q 190 628 225 644 q 116 613 156 613 q 32 641 64 613 q 0 722 0 669 q 72 826 0 800 q 247 866 159 846 l 247 887 q 220 934 247 916 q 162 953 194 953 q 104 934 129 953 q 76 882 80 915 l 16 882 q 60 976 16 941 q 166 1011 104 1011 q 266 979 224 1011 q 308 891 308 948 l 308 706 q 311 679 308 688 q 331 670 315 670 l 350 672 l 350 625 m 247 757 l 247 811 q 136 790 175 798 q 64 726 64 773 q 83 682 64 697 q 132 667 103 667 q 207 690 174 667 q 247 757 247 718 "},"\u0385":{x_min:0,x_max:450,ha:553,o:"m 450 800 l 340 800 l 340 925 l 450 925 l 450 800 m 406 1040 l 212 800 l 129 800 l 269 1040 l 406 1040 m 110 800 l 0 800 l 0 925 l 110 925 l 110 800 "},T:{x_min:0,x_max:777,ha:835,o:"m 777 894 l 458 894 l 458 0 l 319 0 l 319 894 l 0 894 l 0 1013 l 777 1013 l 777 894 "},\u03A6:{x_min:0,x_max:915,ha:997,o:"m 527 0 l 389 0 l 389 122 q 110 231 220 122 q 0 509 0 340 q 110 785 0 677 q 389 893 220 893 l 389 1013 l 527 1013 l 527 893 q 804 786 693 893 q 915 509 915 679 q 805 231 915 341 q 527 122 696 122 l 527 0 m 527 226 q 712 310 641 226 q 779 507 779 389 q 712 705 779 627 q 527 787 641 787 l 527 226 m 389 226 l 389 787 q 205 698 275 775 q 136 505 136 620 q 206 308 136 391 q 389 226 276 226 "},"\u204B":{x_min:0,x_max:0,ha:694},j:{x_min:-77.78125,x_max:167,ha:349,o:"m 167 871 l 42 871 l 42 1013 l 167 1013 l 167 871 m 167 -80 q 121 -231 167 -184 q -26 -278 76 -278 l -77 -278 l -77 -164 l -41 -164 q 26 -143 11 -164 q 42 -65 42 -122 l 42 737 l 167 737 l 167 -80 "},\u03A3:{x_min:0,x_max:756.953125,ha:819,o:"m 756 0 l 0 0 l 0 107 l 395 523 l 22 904 l 22 1013 l 745 1013 l 745 889 l 209 889 l 566 523 l 187 125 l 756 125 l 756 0 "},"\u203A":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"<":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"\xA3":{x_min:0,x_max:704.484375,ha:801,o:"m 704 41 q 623 -10 664 5 q 543 -26 583 -26 q 359 15 501 -26 q 243 36 288 36 q 158 23 197 36 q 73 -21 119 10 l 6 76 q 125 195 90 150 q 175 331 175 262 q 147 443 175 383 l 0 443 l 0 512 l 108 512 q 43 734 43 623 q 120 929 43 854 q 358 1010 204 1010 q 579 936 487 1010 q 678 729 678 857 l 678 684 l 552 684 q 504 838 552 780 q 362 896 457 896 q 216 852 263 896 q 176 747 176 815 q 199 627 176 697 q 248 512 217 574 l 468 512 l 468 443 l 279 443 q 297 356 297 398 q 230 194 297 279 q 153 107 211 170 q 227 133 190 125 q 293 142 264 142 q 410 119 339 142 q 516 96 482 96 q 579 105 550 96 q 648 142 608 115 l 704 41 "},t:{x_min:0,x_max:367,ha:458,o:"m 367 0 q 312 -5 339 -2 q 262 -8 284 -8 q 145 28 183 -8 q 108 143 108 64 l 108 638 l 0 638 l 0 738 l 108 738 l 108 944 l 232 944 l 232 738 l 367 738 l 367 638 l 232 638 l 232 185 q 248 121 232 140 q 307 102 264 102 q 345 104 330 102 q 367 107 360 107 l 367 0 "},"\xAC":{x_min:0,x_max:706,ha:803,o:"m 706 411 l 706 158 l 630 158 l 630 335 l 0 335 l 0 411 l 706 411 "},\u03BB:{x_min:0,x_max:750,ha:803,o:"m 750 -7 q 679 -15 716 -15 q 538 59 591 -15 q 466 214 512 97 l 336 551 l 126 0 l 0 0 l 270 705 q 223 837 247 770 q 116 899 190 899 q 90 898 100 899 l 90 1004 q 152 1011 125 1011 q 298 938 244 1011 q 373 783 326 901 l 605 192 q 649 115 629 136 q 716 95 669 95 l 736 95 q 750 97 745 97 l 750 -7 "},W:{x_min:0,x_max:1263.890625,ha:1351,o:"m 1263 1013 l 995 0 l 859 0 l 627 837 l 405 0 l 265 0 l 0 1013 l 136 1013 l 342 202 l 556 1013 l 701 1013 l 921 207 l 1133 1012 l 1263 1013 "},">":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},v:{x_min:0,x_max:675.15625,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 737 l 340 147 l 541 737 l 675 738 "},\u03C4:{x_min:.28125,x_max:644.5,ha:703,o:"m 644 628 l 382 628 l 382 179 q 388 120 382 137 q 436 91 401 91 q 474 94 447 91 q 504 97 501 97 l 504 0 q 454 -9 482 -5 q 401 -14 426 -14 q 278 67 308 -14 q 260 233 260 118 l 260 628 l 0 628 l 0 739 l 644 739 l 644 628 "},\u03BE:{x_min:0,x_max:624.9375,ha:699,o:"m 624 -37 q 608 -153 624 -96 q 563 -278 593 -211 l 454 -278 q 491 -183 486 -200 q 511 -83 511 -126 q 484 -23 511 -44 q 370 1 452 1 q 323 0 354 1 q 283 -1 293 -1 q 84 76 169 -1 q 0 266 0 154 q 56 431 0 358 q 197 538 108 498 q 94 613 134 562 q 54 730 54 665 q 77 823 54 780 q 143 901 101 867 l 27 901 l 27 1012 l 576 1012 l 576 901 l 380 901 q 244 863 303 901 q 178 745 178 820 q 312 600 178 636 q 532 582 380 582 l 532 479 q 276 455 361 479 q 118 281 118 410 q 165 173 118 217 q 274 120 208 133 q 494 101 384 110 q 624 -37 624 76 "},"&":{x_min:-3,x_max:894.25,ha:992,o:"m 894 0 l 725 0 l 624 123 q 471 0 553 40 q 306 -41 390 -41 q 168 -7 231 -41 q 62 92 105 26 q 14 187 31 139 q -3 276 -3 235 q 55 433 -3 358 q 248 581 114 508 q 170 689 196 640 q 137 817 137 751 q 214 985 137 922 q 384 1041 284 1041 q 548 988 483 1041 q 622 824 622 928 q 563 666 622 739 q 431 556 516 608 l 621 326 q 649 407 639 361 q 663 493 653 426 l 781 493 q 703 229 781 352 l 894 0 m 504 818 q 468 908 504 877 q 384 940 433 940 q 293 907 331 940 q 255 818 255 875 q 289 714 255 767 q 363 628 313 678 q 477 729 446 682 q 504 818 504 771 m 556 209 l 314 499 q 179 395 223 449 q 135 283 135 341 q 146 222 135 253 q 183 158 158 192 q 333 80 241 80 q 556 209 448 80 "},\u039B:{x_min:0,x_max:862.5,ha:942,o:"m 862 0 l 719 0 l 426 847 l 143 0 l 0 0 l 356 1013 l 501 1013 l 862 0 "},I:{x_min:41,x_max:180,ha:293,o:"m 180 0 l 41 0 l 41 1013 l 180 1013 l 180 0 "},G:{x_min:0,x_max:921,ha:1011,o:"m 921 0 l 832 0 l 801 136 q 655 15 741 58 q 470 -28 568 -28 q 126 133 259 -28 q 0 499 0 284 q 125 881 0 731 q 486 1043 259 1043 q 763 957 647 1043 q 905 709 890 864 l 772 709 q 668 866 747 807 q 486 926 589 926 q 228 795 322 926 q 142 507 142 677 q 228 224 142 342 q 483 94 323 94 q 712 195 625 94 q 796 435 796 291 l 477 435 l 477 549 l 921 549 l 921 0 "},\u03B0:{x_min:0,x_max:617,ha:725,o:"m 524 800 l 414 800 l 414 925 l 524 925 l 524 800 m 183 800 l 73 800 l 73 925 l 183 925 l 183 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 489 1040 l 300 819 l 216 819 l 351 1040 l 489 1040 "},"`":{x_min:0,x_max:138.890625,ha:236,o:"m 138 699 l 0 699 l 0 861 q 36 974 0 929 q 138 1041 72 1020 l 138 977 q 82 931 95 969 q 69 839 69 893 l 138 839 l 138 699 "},"\xB7":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},\u03A5:{x_min:.328125,x_max:819.515625,ha:889,o:"m 819 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 "},r:{x_min:0,x_max:355.5625,ha:432,o:"m 355 621 l 343 621 q 179 569 236 621 q 122 411 122 518 l 122 0 l 0 0 l 0 737 l 117 737 l 117 604 q 204 719 146 686 q 355 753 262 753 l 355 621 "},x:{x_min:0,x_max:675,ha:764,o:"m 675 0 l 525 0 l 331 286 l 144 0 l 0 0 l 256 379 l 12 738 l 157 737 l 336 473 l 516 738 l 661 738 l 412 380 l 675 0 "},\u03BC:{x_min:0,x_max:696.609375,ha:747,o:"m 696 -4 q 628 -14 657 -14 q 498 97 513 -14 q 422 8 470 41 q 313 -24 374 -24 q 207 3 258 -24 q 120 80 157 31 l 120 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 172 124 246 q 308 82 216 82 q 451 177 402 82 q 492 358 492 254 l 492 738 l 616 738 l 616 214 q 623 136 616 160 q 673 92 636 92 q 696 95 684 92 l 696 -4 "},h:{x_min:0,x_max:615,ha:724,o:"m 615 472 l 615 0 l 490 0 l 490 454 q 456 590 490 535 q 338 654 416 654 q 186 588 251 654 q 122 436 122 522 l 122 0 l 0 0 l 0 1013 l 122 1013 l 122 633 q 218 727 149 694 q 362 760 287 760 q 552 676 484 760 q 615 472 615 600 "},".":{x_min:0,x_max:142,ha:239,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},\u03C6:{x_min:-2,x_max:878,ha:974,o:"m 496 -279 l 378 -279 l 378 -17 q 101 88 204 -17 q -2 367 -2 194 q 68 626 -2 510 q 283 758 151 758 l 283 646 q 167 537 209 626 q 133 373 133 462 q 192 177 133 254 q 378 93 259 93 l 378 758 q 445 764 426 763 q 476 765 464 765 q 765 659 653 765 q 878 377 878 553 q 771 96 878 209 q 496 -17 665 -17 l 496 -279 m 496 93 l 514 93 q 687 183 623 93 q 746 380 746 265 q 691 569 746 491 q 522 658 629 658 l 496 656 l 496 93 "},";":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 -12 q 105 -132 142 -82 q 0 -206 68 -182 l 0 -138 q 58 -82 43 -123 q 68 0 68 -56 l 0 0 l 0 151 l 142 151 l 142 -12 "},f:{x_min:0,x_max:378,ha:472,o:"m 378 638 l 246 638 l 246 0 l 121 0 l 121 638 l 0 638 l 0 738 l 121 738 q 137 935 121 887 q 290 1028 171 1028 q 320 1027 305 1028 q 378 1021 334 1026 l 378 908 q 323 918 346 918 q 257 870 273 918 q 246 780 246 840 l 246 738 l 378 738 l 378 638 "},"\u201C":{x_min:1,x_max:348.21875,ha:454,o:"m 140 670 l 1 670 l 1 830 q 37 943 1 897 q 140 1011 74 990 l 140 947 q 82 900 97 940 q 68 810 68 861 l 140 810 l 140 670 m 348 670 l 209 670 l 209 830 q 245 943 209 897 q 348 1011 282 990 l 348 947 q 290 900 305 940 q 276 810 276 861 l 348 810 l 348 670 "},A:{x_min:.03125,x_max:906.953125,ha:1008,o:"m 906 0 l 756 0 l 648 303 l 251 303 l 142 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 610 421 l 452 867 l 293 421 l 610 421 "},"\u2018":{x_min:1,x_max:139.890625,ha:236,o:"m 139 670 l 1 670 l 1 830 q 37 943 1 897 q 139 1011 74 990 l 139 947 q 82 900 97 940 q 68 810 68 861 l 139 810 l 139 670 "},\u03CA:{x_min:-70,x_max:283,ha:361,o:"m 283 800 l 173 800 l 173 925 l 283 925 l 283 800 m 40 800 l -70 800 l -70 925 l 40 925 l 40 800 m 283 3 q 232 -10 257 -5 q 181 -15 206 -15 q 84 26 118 -15 q 41 200 41 79 l 41 737 l 166 737 l 167 215 q 171 141 167 157 q 225 101 182 101 q 247 103 238 101 q 283 112 256 104 l 283 3 "},\u03C0:{x_min:-.21875,x_max:773.21875,ha:857,o:"m 773 -7 l 707 -11 q 575 40 607 -11 q 552 174 552 77 l 552 226 l 552 626 l 222 626 l 222 0 l 97 0 l 97 626 l 0 626 l 0 737 l 773 737 l 773 626 l 676 626 l 676 171 q 695 103 676 117 q 773 90 714 90 l 773 -7 "},\u03AC:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 727 407 760 q 563 637 524 695 l 563 738 l 685 738 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 95 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 m 604 1040 l 415 819 l 332 819 l 466 1040 l 604 1040 "},O:{x_min:0,x_max:958,ha:1057,o:"m 485 1041 q 834 882 702 1041 q 958 512 958 734 q 834 136 958 287 q 481 -26 702 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 728 q 485 1041 263 1041 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 669 q 480 912 640 912 q 226 784 321 912 q 142 504 142 670 q 226 224 142 339 q 480 98 319 98 "},n:{x_min:0,x_max:615,ha:724,o:"m 615 463 l 615 0 l 490 0 l 490 454 q 453 592 490 537 q 331 656 410 656 q 178 585 240 656 q 117 421 117 514 l 117 0 l 0 0 l 0 738 l 117 738 l 117 630 q 218 728 150 693 q 359 764 286 764 q 552 675 484 764 q 615 463 615 593 "},l:{x_min:41,x_max:166,ha:279,o:"m 166 0 l 41 0 l 41 1013 l 166 1013 l 166 0 "},"\xA4":{x_min:40.09375,x_max:728.796875,ha:825,o:"m 728 304 l 649 224 l 512 363 q 383 331 458 331 q 256 363 310 331 l 119 224 l 40 304 l 177 441 q 150 553 150 493 q 184 673 150 621 l 40 818 l 119 898 l 267 749 q 321 766 291 759 q 384 773 351 773 q 447 766 417 773 q 501 749 477 759 l 649 898 l 728 818 l 585 675 q 612 618 604 648 q 621 553 621 587 q 591 441 621 491 l 728 304 m 384 682 q 280 643 318 682 q 243 551 243 604 q 279 461 243 499 q 383 423 316 423 q 487 461 449 423 q 525 553 525 500 q 490 641 525 605 q 384 682 451 682 "},\u03BA:{x_min:0,x_max:632.328125,ha:679,o:"m 632 0 l 482 0 l 225 384 l 124 288 l 124 0 l 0 0 l 0 738 l 124 738 l 124 446 l 433 738 l 596 738 l 312 466 l 632 0 "},p:{x_min:0,x_max:685,ha:786,o:"m 685 364 q 598 96 685 205 q 350 -23 504 -23 q 121 89 205 -23 l 121 -278 l 0 -278 l 0 738 l 121 738 l 121 633 q 220 726 159 691 q 351 761 280 761 q 598 636 504 761 q 685 364 685 522 m 557 371 q 501 560 557 481 q 330 651 437 651 q 162 559 223 651 q 108 366 108 479 q 162 177 108 254 q 333 87 224 87 q 502 178 441 87 q 557 371 557 258 "},"\u2021":{x_min:0,x_max:777,ha:835,o:"m 458 238 l 458 0 l 319 0 l 319 238 l 0 238 l 0 360 l 319 360 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 l 777 804 l 777 683 l 458 683 l 458 360 l 777 360 l 777 238 l 458 238 "},\u03C8:{x_min:0,x_max:808,ha:907,o:"m 465 -278 l 341 -278 l 341 -15 q 87 102 180 -15 q 0 378 0 210 l 0 739 l 133 739 l 133 379 q 182 195 133 275 q 341 98 242 98 l 341 922 l 465 922 l 465 98 q 623 195 563 98 q 675 382 675 278 l 675 742 l 808 742 l 808 381 q 720 104 808 213 q 466 -13 627 -13 l 465 -278 "},\u03B7:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 720 124 755 q 200 630 193 686 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 "}},OLe="normal",ULe=1189,kLe=-100,zLe="normal",VLe={yMin:-334,xMin:-111,yMax:1189,xMax:1672},GLe=1e3,qLe={postscript_name:"Helvetiker-Regular",version_string:"Version 1.00 2004 initial release",vendor_url:"http://www.magenta.gr/",full_font_name:"Helvetiker",font_family_name:"Helvetiker",copyright:"Copyright (c) \u039Cagenta ltd, 2004",description:"",trademark:"",designer:"",designer_url:"",unique_font_identifier:"\u039Cagenta ltd:Helvetiker:22-10-104",license_url:"http://www.ellak.gr/fonts/MgOpen/license.html",license_description:`Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r52245224 \r52255225 Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions: \r52265226 \r
@@ -5232,7 +5232,7 @@ This License becomes null and void to the extent applicable to Fonts or Font Sof
52325232 \r52335233 The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. \r52345234 \r5235-THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.`,manufacturer_name:"\u039Cagenta ltd",font_sub_family_name:"Regular"},XLe=-334,$Le="Helvetiker",YLe=1522,ZLe=50,KLe={glyphs:kLe,cssFontWeight:zLe,ascender:VLe,underlinePosition:GLe,cssFontStyle:qLe,boundingBox:HLe,resolution:WLe,original_font_information:jLe,descender:XLe,familyName:$Le,lineHeight:YLe,underlineThickness:ZLe},rh=$i($i({},window.THREE?window.THREE:{BoxGeometry:Bu,CircleGeometry:i_,DoubleSide:vr,Group:Or,Mesh:Hn,MeshLambertMaterial:Ga,TextGeometry:GS,Vector3:re}),{},{Font:Ix,TextGeometry:GS}),fae=Qr({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:KLe,onChange:function(e,t){t.font=new rh.Font(e)}},labelColor:{default:function(){return"lightgrey"}},labelRotation:{default:0},labelResolution:{default:3},labelIncludeDot:{default:!0},labelDotRadius:{default:.1},labelDotOrientation:{default:function(){return"bottom"}},labelsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r;var s=new rh.CircleGeometry(1,32);t.dataMapper=new Dl(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var o=new rh.MeshLambertMaterial;o.side=vr;var a=new rh.Group;a.add(new rh.Mesh(s,o));var l=new rh.Mesh(void 0,o);a.add(l);var c=new rh.Mesh;return c.visible=!1,l.add(c),a.__globeObjType="label",a})},update:function(e){var t=st(e.labelLat),n=st(e.labelLng),r=st(e.labelAltitude),s=st(e.labelText),o=st(e.labelSize),a=st(e.labelRotation),l=st(e.labelColor),c=st(e.labelIncludeDot),u=st(e.labelDotRadius),f=st(e.labelDotOrientation),d=new Set(["right","top","bottom"]),A=2*Math.PI*_r/360;e.dataMapper.onUpdateObj(function(y,w){var S=Lr(y.children,2),T=S[0],R=S[1],P=Lr(R.children,1),I=P[0],F=l(w),D=sh(F);R.material.color.set(Uf(F)),R.material.transparent=D<1,R.material.opacity=D;var L=c(w),C=f(w);!L||!d.has(C)&&(C="bottom");var B=L?+u(w)*A:1e-12;T.scale.x=T.scale.y=B;var k=+o(w)*A;if(R.geometry&&R.geometry.dispose(),R.geometry=new rh.TextGeometry(s(w),{font:e.font,size:k,depth:0,bevelEnabled:!0,bevelThickness:0,bevelSize:0,curveSegments:e.labelResolution}),I.geometry&&I.geometry.dispose(),R.geometry.computeBoundingBox(),I.geometry=jV(rh.BoxGeometry,tr(new rh.Vector3().subVectors(R.geometry.boundingBox.max,R.geometry.boundingBox.min).clampScalar(0,1/0).toArray())),C!=="right"&&R.geometry.center(),L){var z=B+k/2;C==="right"&&(R.position.x=z),R.position.y={right:-k/2,top:z+k/2,bottom:-z-k/2}[C]}var G=function($){var J=y.__currentTargetD=$,te=J.lat,ce=J.lng,he=J.alt,ve=J.rot,Re=J.scale;Object.assign(y.position,uu(te,ce,he)),y.lookAt(e.scene.localToWorld(new rh.Vector3(0,0,0))),y.rotateY(Math.PI),y.rotateZ(-ve*Math.PI/180),y.scale.x=y.scale.y=y.scale.z=Re},W={lat:+t(w),lng:+n(w),alt:+r(w),rot:+a(w),scale:1},Y=y.__currentTargetD||Object.assign({},W,{scale:1e-12});Object.keys(W).some(function(H){return Y[H]!==W[H]})&&(!e.labelsTransitionDuration||e.labelsTransitionDuration<0?G(W):e.tweenGroup.add(new uo(Y).to(W,e.labelsTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(G).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.labelsData)}}),QLe=$i($i({},window.THREE?window.THREE:{}),{},{CSS2DObject:JM}),dae=Qr({props:{htmlElementsData:{default:[]},htmlLat:{default:"lat"},htmlLng:{default:"lng"},htmlAltitude:{default:0},htmlElement:{},htmlElementVisibilityModifier:{triggerUpdate:!1},htmlTransitionDuration:{default:1e3,triggerUpdate:!1},isBehindGlobe:{onChange:function(){this.updateObjVisibility()},triggerUpdate:!1}},methods:{updateObjVisibility:function(e,t){if(e.dataMapper){var n=t?[t]:e.dataMapper.entries().map(function(r){var s=Lr(r,2),o=s[1];return o}).filter(function(r){return r});n.forEach(function(r){var s=!e.isBehindGlobe||!e.isBehindGlobe(r.position);e.htmlElementVisibilityModifier?(r.visible=!0,e.htmlElementVisibilityModifier(r.element,s)):r.visible=s})}}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Dl(e,{objBindAttr:"__threeObjHtml"}).onCreateObj(function(s){var o=st(t.htmlElement)(s),a=new QLe.CSS2DObject(o);return a.__globeObjType="html",a})},update:function(e,t){var n=this,r=st(e.htmlLat),s=st(e.htmlLng),o=st(e.htmlAltitude);t.hasOwnProperty("htmlElement")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(a,l){var c=function(d){var A=a.__currentTargetD=d,y=A.alt,w=A.lat,S=A.lng;Object.assign(a.position,uu(w,S,y)),n.updateObjVisibility(a)},u={lat:+r(l),lng:+s(l),alt:+o(l)};!e.htmlTransitionDuration||e.htmlTransitionDuration<0||!a.__currentTargetD?c(u):e.tweenGroup.add(new uo(a.__currentTargetD).to(u,e.htmlTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(c).onComplete(function(){e.tweenGroup.remove(this)}).start())}).digest(e.htmlElementsData)}}),tP=window.THREE?window.THREE:{Group:Or,Mesh:Hn,MeshLambertMaterial:Ga,SphereGeometry:Va},pae=Qr({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new tP.Mesh(new tP.SphereGeometry(1,16,8),new tP.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){is(e),t.scene=e,t.dataMapper=new Dl(e,{objBindAttr:"__threeObjObject"}).onCreateObj(function(n){var r=st(t.objectThreeObject)(n);t.objectThreeObject===r&&(r=r.clone());var s=new tP.Group;return s.add(r),s.__globeObjType="object",s})},update:function(e,t){var n=st(e.objectLat),r=st(e.objectLng),s=st(e.objectAltitude),o=st(e.objectFacesSurface),a=st(e.objectRotation);t.hasOwnProperty("objectThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(l,c){var u=+n(c),f=+r(c),d=+s(c);Object.assign(l.position,uu(u,f,d)),o(c)?l.setRotationFromEuler(new Ua(m1(-u),m1(f),0,"YXZ")):l.rotation.set(0,0,0);var A=l.children[0],y=a(c);y&&A.setRotationFromEuler(new Ua(m1(y.x||0),m1(y.y||0),m1(y.z||0)))}).digest(e.objectsData)}}),mae=Qr({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){is(e),t.scene=e,t.dataMapper=new Dl(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(n){var r=st(t.customThreeObject)(n,_r);return r&&(t.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r})},update:function(e,t){e.customThreeObjectUpdate||is(e.scene);var n=st(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(r,s){return n(r,s,_r)}).digest(e.customLayerData)}}),nP=window.THREE?window.THREE:{Camera:Nd,Group:Or,Vector2:Oe,Vector3:re},JLe=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],Aae=nl("globeLayer",Joe),eDe=Object.assign.apply(Object,tr(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(i){return Eo({},i,Aae.linkProp(i))}))),tDe=Object.assign.apply(Object,tr(["globeMaterial","globeTileEngineClearCache"].map(function(i){return Eo({},i,Aae.linkMethod(i))}))),nDe=nl("pointsLayer",eae),iDe=Object.assign.apply(Object,tr(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(i){return Eo({},i,nDe.linkProp(i))}))),rDe=nl("arcsLayer",nae),sDe=Object.assign.apply(Object,tr(["arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration"].map(function(i){return Eo({},i,rDe.linkProp(i))}))),oDe=nl("hexBinLayer",iae),aDe=Object.assign.apply(Object,tr(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(i){return Eo({},i,oDe.linkProp(i))}))),lDe=nl("heatmapsLayer",sae),cDe=Object.assign.apply(Object,tr(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(i){return Eo({},i,lDe.linkProp(i))}))),uDe=nl("hexedPolygonsLayer",aae),hDe=Object.assign.apply(Object,tr(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(i){return Eo({},i,uDe.linkProp(i))}))),fDe=nl("polygonsLayer",oae),dDe=Object.assign.apply(Object,tr(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(i){return Eo({},i,fDe.linkProp(i))}))),pDe=nl("pathsLayer",lae),mDe=Object.assign.apply(Object,tr(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(i){return Eo({},i,pDe.linkProp(i))}))),ADe=nl("tilesLayer",cae),gDe=Object.assign.apply(Object,tr(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(i){return Eo({},i,ADe.linkProp(i))}))),vDe=nl("particlesLayer",uae),_De=Object.assign.apply(Object,tr(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(i){return Eo({},i,vDe.linkProp(i))}))),xDe=nl("ringsLayer",hae),yDe=Object.assign.apply(Object,tr(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(i){return Eo({},i,xDe.linkProp(i))}))),bDe=nl("labelsLayer",fae),wDe=Object.assign.apply(Object,tr(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(i){return Eo({},i,bDe.linkProp(i))}))),SDe=nl("htmlElementsLayer",dae),TDe=Object.assign.apply(Object,tr(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(i){return Eo({},i,SDe.linkProp(i))}))),EDe=nl("objectsLayer",pae),MDe=Object.assign.apply(Object,tr(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(i){return Eo({},i,EDe.linkProp(i))}))),CDe=nl("customLayer",mae),RDe=Object.assign.apply(Object,tr(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return Eo({},i,CDe.linkProp(i))}))),IDe=Qr({props:$i($i($i($i($i($i($i($i($i($i($i($i($i($i($i({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new nP.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},eDe),iDe),sDe),aDe),cDe),dDe),hDe),mDe),gDe),_De),yDe),wDe),TDe),MDe),RDe),methods:$i({getGlobeRadius:koe,getCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return uu.apply(void 0,n)},toGeoCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Qoe.apply(void 0,n)},setPointOfView:function(e,t){var n=t instanceof nP.Camera?t.position:t,r=koe(),s=void 0;if(e.scene&&n){var o,a,l,c;s=function(f){o===void 0&&(o=n.clone().applyMatrix4(e.scene.matrixWorld.clone().invert())),a===void 0&&(a=o.length()),l===void 0&&(l=Math.sqrt(Math.pow(a,2)-Math.pow(r,2))),c===void 0&&(c=Math.acos(l/a));var d=o.distanceTo(f);if(d<l)return!1;var A=f.length(),y=Math.acos((Math.pow(a,2)+Math.pow(d,2)-Math.pow(A,2))/(2*a*d));return y<c}}e.layersThatNeedUpdatePov.forEach(function(u){return u.updatePov(t)}),e.layersThatNeedBehindGlobeChecker.forEach(function(u){return u.isBehindGlobe(s)})},pauseAnimation:function(e){return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),e.pausableLayers.forEach(function(t){var n;return(n=t.pauseAnimation)===null||n===void 0?void 0:n.call(t)}),this},resumeAnimation:function(e){return e.animationFrameRequestId===null&&this._animationCycle(),e.pausableLayers.forEach(function(t){var n;return(n=t.resumeAnimation)===null||n===void 0?void 0:n.call(t)}),this},_animationCycle:function(e){e.animationFrameRequestId=requestAnimationFrame(this._animationCycle),e.tweenGroup.update()},_destructor:function(e){this.pauseAnimation(),e.destructableLayers.forEach(function(t){return t._destructor()})}},tDe),stateInit:function(){var e=new gg,t={tweenGroup:e},n={globeLayer:Joe(t),pointsLayer:eae(t),arcsLayer:nae(t),hexBinLayer:iae(t),heatmapsLayer:sae(t),polygonsLayer:oae(t),hexedPolygonsLayer:aae(t),pathsLayer:lae(t),tilesLayer:cae(t),particlesLayer:uae(t),ringsLayer:hae(t),labelsLayer:fae(t),htmlElementsLayer:dae(t),objectsLayer:pae(t),customLayer:mae(t)};return $i($i({tweenGroup:e},n),{},{layersThatNeedUpdatePov:Object.values(n).filter(function(r){return r.hasOwnProperty("updatePov")}),layersThatNeedBehindGlobeChecker:Object.values(n).filter(function(r){return r.hasOwnProperty("isBehindGlobe")}),destructableLayers:Object.values(n).filter(function(r){return r.hasOwnProperty("_destructor")}),pausableLayers:Object.values(n).filter(function(r){return r.hasOwnProperty("pauseAnimation")})})},init:function(e,t,n){var r=n.animateIn,s=r===void 0?!0:r,o=n.waitForGlobeReady,a=o===void 0?!0:o;is(e),t.scene=e,t.scene.visible=!1,JLe.forEach(function(c){var u=new nP.Group;t.scene.add(u),t[c](u)});var l=function(){if(s){t.scene.scale.set(1e-6,1e-6,1e-6),t.tweenGroup.add(new uo({k:1e-6}).to({k:1},600).easing(Jr.Quadratic.Out).onUpdate(function(f){var d=f.k;return t.scene.scale.set(d,d,d)}).onComplete(function(){t.tweenGroup.remove(this)}).start());var u=new nP.Vector3(0,1,0);t.tweenGroup.add(new uo({rot:Math.PI*2}).to({rot:0},1200).easing(Jr.Quintic.Out).onUpdate(function(f){var d=f.rot;return t.scene.setRotationFromAxisAngle(u,d)}).onComplete(function(){t.tweenGroup.remove(this)}).start())}t.scene.visible=!0,t.onGlobeReady&&t.onGlobeReady()};a?t.globeLayer.onReady(l):l(),this._animationCycle()},update:function(e){}});function PDe(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=(function(r){function s(){var o;rP(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=iP(this,s,[].concat(l)),o.__kapsuleInstance=jV(i,[].concat(tr(t?[o]:[]),l)),o}return oP(s,r),sP(s)})(e);return Object.keys(i()).forEach(function(r){return n.prototype[r]=function(){var s,o=(s=this.__kapsuleInstance)[r].apply(s,arguments);return o===this.__kapsuleInstance?this:o}}),n}var LDe=window.THREE?window.THREE:{Group:Or},YV=PDe(IDe,LDe.Group,!0);var ZV={type:"change"},JV={type:"start"},eG={type:"end"},gae=1e-6,ki={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},aP=new Oe,Pm=new Oe,DDe=new re,lP=new re,KV=new re,Fx=new qs,vae=new re,cP=new re,QV=new re,uP=new re,hP=class extends Fd{constructor(e,t=null){super(e,t),this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.keys=["KeyA","KeyS","KeyD"],this.mouseButtons={LEFT:qa.ROTATE,MIDDLE:qa.DOLLY,RIGHT:qa.PAN},this.target=new re,this.state=ki.NONE,this.keyState=ki.NONE,this._lastPosition=new re,this._lastZoom=1,this._touchZoomDistanceStart=0,this._touchZoomDistanceEnd=0,this._lastAngle=0,this._eye=new re,this._movePrev=new Oe,this._moveCurr=new Oe,this._lastAxis=new re,this._zoomStart=new Oe,this._zoomEnd=new Oe,this._panStart=new Oe,this._panEnd=new Oe,this._pointers=[],this._pointerPositions={},this._onPointerMove=FDe.bind(this),this._onPointerDown=NDe.bind(this),this._onPointerUp=BDe.bind(this),this._onPointerCancel=ODe.bind(this),this._onContextMenu=HDe.bind(this),this._onMouseWheel=qDe.bind(this),this._onKeyDown=kDe.bind(this),this._onKeyUp=UDe.bind(this),this._onTouchStart=WDe.bind(this),this._onTouchMove=jDe.bind(this),this._onTouchEnd=XDe.bind(this),this._onMouseDown=zDe.bind(this),this._onMouseMove=VDe.bind(this),this._onMouseUp=GDe.bind(this),this._target0=this.target.clone(),this._position0=this.object.position.clone(),this._up0=this.object.up.clone(),this._zoom0=this.object.zoom,t!==null&&(this.connect(t),this.handleResize()),this.update()}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction=""}dispose(){this.disconnect()}handleResize(){let e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}update(){this._eye.subVectors(this.object.position,this.target),this.noRotate||this._rotateCamera(),this.noZoom||this._zoomCamera(),this.noPan||this._panCamera(),this.object.position.addVectors(this.target,this._eye),this.object.isPerspectiveCamera?(this._checkDistances(),this.object.lookAt(this.target),this._lastPosition.distanceToSquared(this.object.position)>gae&&(this.dispatchEvent(ZV),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>gae||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(ZV),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=ki.NONE,this.keyState=ki.NONE,this.target.copy(this._target0),this.object.position.copy(this._position0),this.object.up.copy(this._up0),this.object.zoom=this._zoom0,this.object.updateProjectionMatrix(),this._eye.subVectors(this.object.position,this.target),this.object.lookAt(this.target),this.dispatchEvent(ZV),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(Pm.copy(this._panEnd).sub(this._panStart),Pm.lengthSq()){if(this.object.isOrthographicCamera){let e=(this.object.right-this.object.left)/this.object.zoom/this.domElement.clientWidth,t=(this.object.top-this.object.bottom)/this.object.zoom/this.domElement.clientWidth;Pm.x*=e,Pm.y*=t}Pm.multiplyScalar(this._eye.length()*this.panSpeed),lP.copy(this._eye).cross(this.object.up).setLength(Pm.x),lP.add(DDe.copy(this.object.up).setLength(Pm.y)),this.object.position.add(lP),this.target.add(lP),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(Pm.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){uP.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=uP.length();e?(this._eye.copy(this.object.position).sub(this.target),vae.copy(this._eye).normalize(),cP.copy(this.object.up).normalize(),QV.crossVectors(cP,vae).normalize(),cP.setLength(this._moveCurr.y-this._movePrev.y),QV.setLength(this._moveCurr.x-this._movePrev.x),uP.copy(cP.add(QV)),KV.crossVectors(uP,this._eye).normalize(),e*=this.rotateSpeed,Fx.setFromAxisAngle(KV,e),this._eye.applyQuaternion(Fx),this.object.up.applyQuaternion(Fx),this._lastAxis.copy(KV),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),Fx.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(Fx),this.object.up.applyQuaternion(Fx)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===ki.TOUCH_ZOOM_PAN?(e=this._touchZoomDistanceStart/this._touchZoomDistanceEnd,this._touchZoomDistanceStart=this._touchZoomDistanceEnd,this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=zu.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")):(e=1+(this._zoomEnd.y-this._zoomStart.y)*this.zoomSpeed,e!==1&&e>0&&(this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=zu.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")),this.staticMoving?this._zoomStart.copy(this._zoomEnd):this._zoomStart.y+=(this._zoomEnd.y-this._zoomStart.y)*this.dynamicDampingFactor)}_getMouseOnScreen(e,t){return aP.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),aP}_getMouseOnCircle(e,t){return aP.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),aP}_addPointer(e){this._pointers.push(e)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t].pointerId==e.pointerId){this._pointers.splice(t,1);return}}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Oe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0].pointerId?this._pointers[1]:this._pointers[0];return this._pointerPositions[t.pointerId]}_checkDistances(){(!this.noZoom||!this.noPan)&&(this._eye.lengthSq()>this.maxDistance*this.maxDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.maxDistance)),this._zoomStart.copy(this._zoomEnd)),this._eye.lengthSq()<this.minDistance*this.minDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.minDistance)),this._zoomStart.copy(this._zoomEnd)))}};function NDe(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i))}function FDe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function BDe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchEnd(i):this._onMouseUp(),this._removePointer(i),this._pointers.length===0&&(this.domElement.releasePointerCapture(i.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp)))}function ODe(i){this._removePointer(i)}function UDe(){this.enabled!==!1&&(this.keyState=ki.NONE,window.addEventListener("keydown",this._onKeyDown))}function kDe(i){this.enabled!==!1&&(window.removeEventListener("keydown",this._onKeyDown),this.keyState===ki.NONE&&(i.code===this.keys[ki.ROTATE]&&!this.noRotate?this.keyState=ki.ROTATE:i.code===this.keys[ki.ZOOM]&&!this.noZoom?this.keyState=ki.ZOOM:i.code===this.keys[ki.PAN]&&!this.noPan&&(this.keyState=ki.PAN)))}function zDe(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case qa.DOLLY:this.state=ki.ZOOM;break;case qa.ROTATE:this.state=ki.ROTATE;break;case qa.PAN:this.state=ki.PAN;break;default:this.state=ki.NONE}let t=this.keyState!==ki.NONE?this.keyState:this.state;t===ki.ROTATE&&!this.noRotate?(this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr)):t===ki.ZOOM&&!this.noZoom?(this._zoomStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._zoomEnd.copy(this._zoomStart)):t===ki.PAN&&!this.noPan&&(this._panStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._panEnd.copy(this._panStart)),this.dispatchEvent(JV)}function VDe(i){let e=this.keyState!==ki.NONE?this.keyState:this.state;e===ki.ROTATE&&!this.noRotate?(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY))):e===ki.ZOOM&&!this.noZoom?this._zoomEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY)):e===ki.PAN&&!this.noPan&&this._panEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY))}function GDe(){this.state=ki.NONE,this.dispatchEvent(eG)}function qDe(i){if(this.enabled!==!1&&this.noZoom!==!0){switch(i.preventDefault(),i.deltaMode){case 2:this._zoomStart.y-=i.deltaY*.025;break;case 1:this._zoomStart.y-=i.deltaY*.01;break;default:this._zoomStart.y-=i.deltaY*25e-5;break}this.dispatchEvent(JV),this.dispatchEvent(eG)}}function HDe(i){this.enabled!==!1&&i.preventDefault()}function WDe(i){if(this._trackPointer(i),this._pointers.length===1)this.state=ki.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX,this._pointers[0].pageY)),this._movePrev.copy(this._moveCurr);else{this.state=ki.TOUCH_ZOOM_PAN;let e=this._pointers[0].pageX-this._pointers[1].pageX,t=this._pointers[0].pageY-this._pointers[1].pageY;this._touchZoomDistanceEnd=this._touchZoomDistanceStart=Math.sqrt(e*e+t*t);let n=(this._pointers[0].pageX+this._pointers[1].pageX)/2,r=(this._pointers[0].pageY+this._pointers[1].pageY)/2;this._panStart.copy(this._getMouseOnScreen(n,r)),this._panEnd.copy(this._panStart)}this.dispatchEvent(JV)}function jDe(i){if(this._trackPointer(i),this._pointers.length===1)this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY));else{let e=this._getSecondPointerPosition(i),t=i.pageX-e.x,n=i.pageY-e.y;this._touchZoomDistanceEnd=Math.sqrt(t*t+n*n);let r=(i.pageX+e.x)/2,s=(i.pageY+e.y)/2;this._panEnd.copy(this._getMouseOnScreen(r,s))}}function XDe(i){switch(this._pointers.length){case 0:this.state=ki.NONE;break;case 1:this.state=ki.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr);break;case 2:this.state=ki.TOUCH_ZOOM_PAN;for(let e=0;e<this._pointers.length;e++)if(this._pointers[e].pointerId!==i.pointerId){let t=this._pointerPositions[this._pointers[e].pointerId];this._moveCurr.copy(this._getMouseOnCircle(t.x,t.y)),this._movePrev.copy(this._moveCurr);break}break}this.dispatchEvent(eG)}var _ae={type:"change"},nG={type:"start"},yae={type:"end"},fP=new Dd,xae=new Na,$De=Math.cos(70*zu.DEG2RAD),ho=new re,Nl=2*Math.PI,dr={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},tG=1e-6,dP=class extends Fd{constructor(e,t=null){super(e,t),this.state=dr.NONE,this.target=new re,this.cursor=new re,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:qa.ROTATE,MIDDLE:qa.DOLLY,RIGHT:qa.PAN},this.touches={ONE:d0.ROTATE,TWO:d0.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new re,this._lastQuaternion=new qs,this._lastTargetPosition=new re,this._quat=new qs().setFromUnitVectors(e.up,new re(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new u_,this._sphericalDelta=new u_,this._scale=1,this._panOffset=new re,this._rotateStart=new Oe,this._rotateEnd=new Oe,this._rotateDelta=new Oe,this._panStart=new Oe,this._panEnd=new Oe,this._panDelta=new Oe,this._dollyStart=new Oe,this._dollyEnd=new Oe,this._dollyDelta=new Oe,this._dollyDirection=new re,this._mouse=new Oe,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=ZDe.bind(this),this._onPointerDown=YDe.bind(this),this._onPointerUp=KDe.bind(this),this._onContextMenu=rNe.bind(this),this._onMouseWheel=eNe.bind(this),this._onKeyDown=tNe.bind(this),this._onTouchStart=nNe.bind(this),this._onTouchMove=iNe.bind(this),this._onMouseDown=QDe.bind(this),this._onMouseMove=JDe.bind(this),this._interceptControlDown=sNe.bind(this),this._interceptControlUp=oNe.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(_ae),this.update(),this.state=dr.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){let t=this.object.position;ho.copy(t).sub(this.target),ho.applyQuaternion(this._quat),this._spherical.setFromVector3(ho),this.autoRotate&&this.state===dr.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(n)&&isFinite(r)&&(n<-Math.PI?n+=Nl:n>Math.PI&&(n-=Nl),r<-Math.PI?r+=Nl:r>Math.PI&&(r-=Nl),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(ho.setFromSpherical(this._spherical),ho.applyQuaternion(this._quatInverse),t.copy(this.target).add(ho),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){let a=ho.length();o=this._clampDistance(a*this._scale);let l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){let a=new re(this._mouse.x,this._mouse.y,0);a.unproject(this.object);let l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;let c=new re(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=ho.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(fP.origin.copy(this.object.position),fP.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(fP.direction))<$De?this.object.lookAt(this.target):(xae.setFromNormalAndCoplanarPoint(this.object.up,this.target),fP.intersectPlane(xae,this.target))))}else if(this.object.isOrthographicCamera){let o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>tG||8*(1-this._lastQuaternion.dot(this.object.quaternion))>tG||this._lastTargetPosition.distanceToSquared(this.target)>tG?(this.dispatchEvent(_ae),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Nl/60*this.autoRotateSpeed*e:Nl/60/60*this.autoRotateSpeed}_getZoomScale(e){let t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){ho.setFromMatrixColumn(t,0),ho.multiplyScalar(-e),this._panOffset.add(ho)}_panUp(e,t){this.screenSpacePanning===!0?ho.setFromMatrixColumn(t,1):(ho.setFromMatrixColumn(t,0),ho.crossVectors(this.object.up,ho)),ho.multiplyScalar(e),this._panOffset.add(ho)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;ho.copy(r).sub(this.target);let s=ho.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),r=e-n.left,s=t-n.top,o=n.width,a=n.height;this._mouse.x=r/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Nl*this._rotateDelta.x/t.clientHeight),this._rotateUp(Nl*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Nl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Nl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Nl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Nl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Nl*this._rotateDelta.x/t.clientHeight),this._rotateUp(Nl*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Oe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){let t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}};function YDe(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function ZDe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function KDe(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(yae),this.state=dr.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:let e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function QDe(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case qa.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=dr.DOLLY;break;case qa.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=dr.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=dr.ROTATE}break;case qa.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=dr.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=dr.PAN}break;default:this.state=dr.NONE}this.state!==dr.NONE&&this.dispatchEvent(nG)}function JDe(i){switch(this.state){case dr.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case dr.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case dr.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function eNe(i){this.enabled===!1||this.enableZoom===!1||this.state!==dr.NONE||(i.preventDefault(),this.dispatchEvent(nG),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(yae))}function tNe(i){this.enabled!==!1&&this._handleKeyDown(i)}function nNe(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case d0.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=dr.TOUCH_ROTATE;break;case d0.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=dr.TOUCH_PAN;break;default:this.state=dr.NONE}break;case 2:switch(this.touches.TWO){case d0.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=dr.TOUCH_DOLLY_PAN;break;case d0.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=dr.TOUCH_DOLLY_ROTATE;break;default:this.state=dr.NONE}break;default:this.state=dr.NONE}this.state!==dr.NONE&&this.dispatchEvent(nG)}function iNe(i){switch(this._trackPointer(i),this.state){case dr.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case dr.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case dr.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case dr.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=dr.NONE}}function rNe(i){this.enabled!==!1&&i.preventDefault()}function sNe(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function oNe(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var aNe={type:"change"},bae=1e-6,wae=new qs,pP=class extends Fd{constructor(e,t=null){super(e,t),this.movementSpeed=1,this.rollSpeed=.005,this.dragToLook=!1,this.autoForward=!1,this._moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0},this._moveVector=new re(0,0,0),this._rotationVector=new re(0,0,0),this._lastQuaternion=new qs,this._lastPosition=new re,this._status=0,this._onKeyDown=lNe.bind(this),this._onKeyUp=cNe.bind(this),this._onPointerMove=hNe.bind(this),this._onPointerDown=uNe.bind(this),this._onPointerUp=fNe.bind(this),this._onPointerCancel=dNe.bind(this),this._onContextMenu=pNe.bind(this),t!==null&&this.connect(t)}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction=""}dispose(){this.disconnect()}update(e){if(this.enabled===!1)return;let t=this.object,n=e*this.movementSpeed,r=e*this.rollSpeed;t.translateX(this._moveVector.x*n),t.translateY(this._moveVector.y*n),t.translateZ(this._moveVector.z*n),wae.set(this._rotationVector.x*r,this._rotationVector.y*r,this._rotationVector.z*r,1).normalize(),t.quaternion.multiply(wae),(this._lastPosition.distanceToSquared(t.position)>bae||8*(1-this._lastQuaternion.dot(t.quaternion))>bae)&&(this.dispatchEvent(aNe),this._lastQuaternion.copy(t.quaternion),this._lastPosition.copy(t.position))}_updateMovementVector(){let e=this._moveState.forward||this.autoForward&&!this._moveState.back?1:0;this._moveVector.x=-this._moveState.left+this._moveState.right,this._moveVector.y=-this._moveState.down+this._moveState.up,this._moveVector.z=-e+this._moveState.back}_updateRotationVector(){this._rotationVector.x=-this._moveState.pitchDown+this._moveState.pitchUp,this._rotationVector.y=-this._moveState.yawRight+this._moveState.yawLeft,this._rotationVector.z=-this._moveState.rollRight+this._moveState.rollLeft}_getContainerDimensions(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}}};function lNe(i){if(!(i.altKey||this.enabled===!1)){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=.1;break;case"KeyW":this._moveState.forward=1;break;case"KeyS":this._moveState.back=1;break;case"KeyA":this._moveState.left=1;break;case"KeyD":this._moveState.right=1;break;case"KeyR":this._moveState.up=1;break;case"KeyF":this._moveState.down=1;break;case"ArrowUp":this._moveState.pitchUp=1;break;case"ArrowDown":this._moveState.pitchDown=1;break;case"ArrowLeft":this._moveState.yawLeft=1;break;case"ArrowRight":this._moveState.yawRight=1;break;case"KeyQ":this._moveState.rollLeft=1;break;case"KeyE":this._moveState.rollRight=1;break}this._updateMovementVector(),this._updateRotationVector()}}function cNe(i){if(this.enabled!==!1){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=1;break;case"KeyW":this._moveState.forward=0;break;case"KeyS":this._moveState.back=0;break;case"KeyA":this._moveState.left=0;break;case"KeyD":this._moveState.right=0;break;case"KeyR":this._moveState.up=0;break;case"KeyF":this._moveState.down=0;break;case"ArrowUp":this._moveState.pitchUp=0;break;case"ArrowDown":this._moveState.pitchDown=0;break;case"ArrowLeft":this._moveState.yawLeft=0;break;case"ArrowRight":this._moveState.yawRight=0;break;case"KeyQ":this._moveState.rollLeft=0;break;case"KeyE":this._moveState.rollRight=0;break}this._updateMovementVector(),this._updateRotationVector()}}function uNe(i){if(this.enabled!==!1)if(this.dragToLook)this._status++;else{switch(i.button){case 0:this._moveState.forward=1;break;case 2:this._moveState.back=1;break}this._updateMovementVector()}}function hNe(i){if(this.enabled!==!1&&(!this.dragToLook||this._status>0)){let e=this._getContainerDimensions(),t=e.size[0]/2,n=e.size[1]/2;this._moveState.yawLeft=-(i.pageX-e.offset[0]-t)/t,this._moveState.pitchDown=(i.pageY-e.offset[1]-n)/n,this._updateRotationVector()}}function fNe(i){if(this.enabled!==!1){if(this.dragToLook)this._status--,this._moveState.yawLeft=this._moveState.pitchDown=0;else{switch(i.button){case 0:this._moveState.forward=0;break;case 2:this._moveState.back=0;break}this._updateMovementVector()}this._updateRotationVector()}}function dNe(){this.enabled!==!1&&(this.dragToLook?(this._status=0,this._moveState.yawLeft=this._moveState.pitchDown=0):(this._moveState.forward=0,this._moveState.back=0,this._updateMovementVector()),this._updateRotationVector())}function pNe(i){this.enabled!==!1&&i.preventDefault()}var Sae={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`5235+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.`,manufacturer_name:"\u039Cagenta ltd",font_sub_family_name:"Regular"},HLe=-334,WLe="Helvetiker",jLe=1522,XLe=50,$Le={glyphs:BLe,cssFontWeight:OLe,ascender:ULe,underlinePosition:kLe,cssFontStyle:zLe,boundingBox:VLe,resolution:GLe,original_font_information:qLe,descender:HLe,familyName:WLe,lineHeight:jLe,underlineThickness:XLe},eh=$i($i({},window.THREE?window.THREE:{BoxGeometry:Lu,CircleGeometry:t_,DoubleSide:vr,Group:Br,Mesh:Hn,MeshLambertMaterial:Ga,TextGeometry:kS,Vector3:re}),{},{Font:Cx,TextGeometry:kS}),lae=Qr({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:$Le,onChange:function(e,t){t.font=new eh.Font(e)}},labelColor:{default:function(){return"lightgrey"}},labelRotation:{default:0},labelResolution:{default:3},labelIncludeDot:{default:!0},labelDotRadius:{default:.1},labelDotOrientation:{default:function(){return"bottom"}},labelsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r;var s=new eh.CircleGeometry(1,32);t.dataMapper=new Ll(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var o=new eh.MeshLambertMaterial;o.side=vr;var a=new eh.Group;a.add(new eh.Mesh(s,o));var l=new eh.Mesh(void 0,o);a.add(l);var c=new eh.Mesh;return c.visible=!1,l.add(c),a.__globeObjType="label",a})},update:function(e){var t=st(e.labelLat),n=st(e.labelLng),r=st(e.labelAltitude),s=st(e.labelText),o=st(e.labelSize),a=st(e.labelRotation),l=st(e.labelColor),c=st(e.labelIncludeDot),u=st(e.labelDotRadius),f=st(e.labelDotOrientation),d=new Set(["right","top","bottom"]),A=2*Math.PI*_r/360;e.dataMapper.onUpdateObj(function(y,w){var S=Ir(y.children,2),T=S[0],R=S[1],I=Ir(R.children,1),P=I[0],F=l(w),D=th(F);R.material.color.set(Nf(F)),R.material.transparent=D<1,R.material.opacity=D;var L=c(w),C=f(w);!L||!d.has(C)&&(C="bottom");var B=L?+u(w)*A:1e-12;T.scale.x=T.scale.y=B;var k=+o(w)*A;if(R.geometry&&R.geometry.dispose(),R.geometry=new eh.TextGeometry(s(w),{font:e.font,size:k,depth:0,bevelEnabled:!0,bevelThickness:0,bevelSize:0,curveSegments:e.labelResolution}),P.geometry&&P.geometry.dispose(),R.geometry.computeBoundingBox(),P.geometry=jV(eh.BoxGeometry,tr(new eh.Vector3().subVectors(R.geometry.boundingBox.max,R.geometry.boundingBox.min).clampScalar(0,1/0).toArray())),C!=="right"&&R.geometry.center(),L){var z=B+k/2;C==="right"&&(R.position.x=z),R.position.y={right:-k/2,top:z+k/2,bottom:-z-k/2}[C]}var G=function($){var J=y.__currentTargetD=$,te=J.lat,ce=J.lng,he=J.alt,ve=J.rot,Re=J.scale;Object.assign(y.position,ou(te,ce,he)),y.lookAt(e.scene.localToWorld(new eh.Vector3(0,0,0))),y.rotateY(Math.PI),y.rotateZ(-ve*Math.PI/180),y.scale.x=y.scale.y=y.scale.z=Re},W={lat:+t(w),lng:+n(w),alt:+r(w),rot:+a(w),scale:1},Y=y.__currentTargetD||Object.assign({},W,{scale:1e-12});Object.keys(W).some(function(H){return Y[H]!==W[H]})&&(!e.labelsTransitionDuration||e.labelsTransitionDuration<0?G(W):e.tweenGroup.add(new uo(Y).to(W,e.labelsTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(G).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.labelsData)}}),YLe=$i($i({},window.THREE?window.THREE:{}),{},{CSS2DObject:$M}),cae=Qr({props:{htmlElementsData:{default:[]},htmlLat:{default:"lat"},htmlLng:{default:"lng"},htmlAltitude:{default:0},htmlElement:{},htmlElementVisibilityModifier:{triggerUpdate:!1},htmlTransitionDuration:{default:1e3,triggerUpdate:!1},isBehindGlobe:{onChange:function(){this.updateObjVisibility()},triggerUpdate:!1}},methods:{updateObjVisibility:function(e,t){if(e.dataMapper){var n=t?[t]:e.dataMapper.entries().map(function(r){var s=Ir(r,2),o=s[1];return o}).filter(function(r){return r});n.forEach(function(r){var s=!e.isBehindGlobe||!e.isBehindGlobe(r.position);e.htmlElementVisibilityModifier?(r.visible=!0,e.htmlElementVisibilityModifier(r.element,s)):r.visible=s})}}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjHtml"}).onCreateObj(function(s){var o=st(t.htmlElement)(s),a=new YLe.CSS2DObject(o);return a.__globeObjType="html",a})},update:function(e,t){var n=this,r=st(e.htmlLat),s=st(e.htmlLng),o=st(e.htmlAltitude);t.hasOwnProperty("htmlElement")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(a,l){var c=function(d){var A=a.__currentTargetD=d,y=A.alt,w=A.lat,S=A.lng;Object.assign(a.position,ou(w,S,y)),n.updateObjVisibility(a)},u={lat:+r(l),lng:+s(l),alt:+o(l)};!e.htmlTransitionDuration||e.htmlTransitionDuration<0||!a.__currentTargetD?c(u):e.tweenGroup.add(new uo(a.__currentTargetD).to(u,e.htmlTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(c).onComplete(function(){e.tweenGroup.remove(this)}).start())}).digest(e.htmlElementsData)}}),ZP=window.THREE?window.THREE:{Group:Br,Mesh:Hn,MeshLambertMaterial:Ga,SphereGeometry:Va},uae=Qr({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new ZP.Mesh(new ZP.SphereGeometry(1,16,8),new ZP.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){is(e),t.scene=e,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjObject"}).onCreateObj(function(n){var r=st(t.objectThreeObject)(n);t.objectThreeObject===r&&(r=r.clone());var s=new ZP.Group;return s.add(r),s.__globeObjType="object",s})},update:function(e,t){var n=st(e.objectLat),r=st(e.objectLng),s=st(e.objectAltitude),o=st(e.objectFacesSurface),a=st(e.objectRotation);t.hasOwnProperty("objectThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(l,c){var u=+n(c),f=+r(c),d=+s(c);Object.assign(l.position,ou(u,f,d)),o(c)?l.setRotationFromEuler(new Ua(p1(-u),p1(f),0,"YXZ")):l.rotation.set(0,0,0);var A=l.children[0],y=a(c);y&&A.setRotationFromEuler(new Ua(p1(y.x||0),p1(y.y||0),p1(y.z||0)))}).digest(e.objectsData)}}),hae=Qr({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){is(e),t.scene=e,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(n){var r=st(t.customThreeObject)(n,_r);return r&&(t.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r})},update:function(e,t){e.customThreeObjectUpdate||is(e.scene);var n=st(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(r,s){return n(r,s,_r)}).digest(e.customLayerData)}}),KP=window.THREE?window.THREE:{Camera:Id,Group:Br,Vector2:Oe,Vector3:re},ZLe=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],fae=nl("globeLayer",Yoe),KLe=Object.assign.apply(Object,tr(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(i){return Eo({},i,fae.linkProp(i))}))),QLe=Object.assign.apply(Object,tr(["globeMaterial","globeTileEngineClearCache"].map(function(i){return Eo({},i,fae.linkMethod(i))}))),JLe=nl("pointsLayer",Zoe),eDe=Object.assign.apply(Object,tr(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(i){return Eo({},i,JLe.linkProp(i))}))),tDe=nl("arcsLayer",Qoe),nDe=Object.assign.apply(Object,tr(["arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration"].map(function(i){return Eo({},i,tDe.linkProp(i))}))),iDe=nl("hexBinLayer",Joe),rDe=Object.assign.apply(Object,tr(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(i){return Eo({},i,iDe.linkProp(i))}))),sDe=nl("heatmapsLayer",tae),oDe=Object.assign.apply(Object,tr(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(i){return Eo({},i,sDe.linkProp(i))}))),aDe=nl("hexedPolygonsLayer",iae),lDe=Object.assign.apply(Object,tr(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(i){return Eo({},i,aDe.linkProp(i))}))),cDe=nl("polygonsLayer",nae),uDe=Object.assign.apply(Object,tr(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(i){return Eo({},i,cDe.linkProp(i))}))),hDe=nl("pathsLayer",rae),fDe=Object.assign.apply(Object,tr(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(i){return Eo({},i,hDe.linkProp(i))}))),dDe=nl("tilesLayer",sae),pDe=Object.assign.apply(Object,tr(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(i){return Eo({},i,dDe.linkProp(i))}))),mDe=nl("particlesLayer",oae),ADe=Object.assign.apply(Object,tr(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(i){return Eo({},i,mDe.linkProp(i))}))),gDe=nl("ringsLayer",aae),vDe=Object.assign.apply(Object,tr(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(i){return Eo({},i,gDe.linkProp(i))}))),_De=nl("labelsLayer",lae),xDe=Object.assign.apply(Object,tr(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(i){return Eo({},i,_De.linkProp(i))}))),yDe=nl("htmlElementsLayer",cae),bDe=Object.assign.apply(Object,tr(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(i){return Eo({},i,yDe.linkProp(i))}))),wDe=nl("objectsLayer",uae),SDe=Object.assign.apply(Object,tr(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(i){return Eo({},i,wDe.linkProp(i))}))),TDe=nl("customLayer",hae),EDe=Object.assign.apply(Object,tr(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return Eo({},i,TDe.linkProp(i))}))),MDe=Qr({props:$i($i($i($i($i($i($i($i($i($i($i($i($i($i($i({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new KP.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},KLe),eDe),nDe),rDe),oDe),uDe),lDe),fDe),pDe),ADe),vDe),xDe),bDe),SDe),EDe),methods:$i({getGlobeRadius:Foe,getCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return ou.apply(void 0,n)},toGeoCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return $oe.apply(void 0,n)},setPointOfView:function(e,t){var n=t instanceof KP.Camera?t.position:t,r=Foe(),s=void 0;if(e.scene&&n){var o,a,l,c;s=function(f){o===void 0&&(o=n.clone().applyMatrix4(e.scene.matrixWorld.clone().invert())),a===void 0&&(a=o.length()),l===void 0&&(l=Math.sqrt(Math.pow(a,2)-Math.pow(r,2))),c===void 0&&(c=Math.acos(l/a));var d=o.distanceTo(f);if(d<l)return!1;var A=f.length(),y=Math.acos((Math.pow(a,2)+Math.pow(d,2)-Math.pow(A,2))/(2*a*d));return y<c}}e.layersThatNeedUpdatePov.forEach(function(u){return u.updatePov(t)}),e.layersThatNeedBehindGlobeChecker.forEach(function(u){return u.isBehindGlobe(s)})},pauseAnimation:function(e){return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),e.pausableLayers.forEach(function(t){var n;return(n=t.pauseAnimation)===null||n===void 0?void 0:n.call(t)}),this},resumeAnimation:function(e){return e.animationFrameRequestId===null&&this._animationCycle(),e.pausableLayers.forEach(function(t){var n;return(n=t.resumeAnimation)===null||n===void 0?void 0:n.call(t)}),this},_animationCycle:function(e){e.animationFrameRequestId=requestAnimationFrame(this._animationCycle),e.tweenGroup.update()},_destructor:function(e){this.pauseAnimation(),e.destructableLayers.forEach(function(t){return t._destructor()})}},QLe),stateInit:function(){var e=new Ag,t={tweenGroup:e},n={globeLayer:Yoe(t),pointsLayer:Zoe(t),arcsLayer:Qoe(t),hexBinLayer:Joe(t),heatmapsLayer:tae(t),polygonsLayer:nae(t),hexedPolygonsLayer:iae(t),pathsLayer:rae(t),tilesLayer:sae(t),particlesLayer:oae(t),ringsLayer:aae(t),labelsLayer:lae(t),htmlElementsLayer:cae(t),objectsLayer:uae(t),customLayer:hae(t)};return $i($i({tweenGroup:e},n),{},{layersThatNeedUpdatePov:Object.values(n).filter(function(r){return r.hasOwnProperty("updatePov")}),layersThatNeedBehindGlobeChecker:Object.values(n).filter(function(r){return r.hasOwnProperty("isBehindGlobe")}),destructableLayers:Object.values(n).filter(function(r){return r.hasOwnProperty("_destructor")}),pausableLayers:Object.values(n).filter(function(r){return r.hasOwnProperty("pauseAnimation")})})},init:function(e,t,n){var r=n.animateIn,s=r===void 0?!0:r,o=n.waitForGlobeReady,a=o===void 0?!0:o;is(e),t.scene=e,t.scene.visible=!1,ZLe.forEach(function(c){var u=new KP.Group;t.scene.add(u),t[c](u)});var l=function(){if(s){t.scene.scale.set(1e-6,1e-6,1e-6),t.tweenGroup.add(new uo({k:1e-6}).to({k:1},600).easing(Jr.Quadratic.Out).onUpdate(function(f){var d=f.k;return t.scene.scale.set(d,d,d)}).onComplete(function(){t.tweenGroup.remove(this)}).start());var u=new KP.Vector3(0,1,0);t.tweenGroup.add(new uo({rot:Math.PI*2}).to({rot:0},1200).easing(Jr.Quintic.Out).onUpdate(function(f){var d=f.rot;return t.scene.setRotationFromAxisAngle(u,d)}).onComplete(function(){t.tweenGroup.remove(this)}).start())}t.scene.visible=!0,t.onGlobeReady&&t.onGlobeReady()};a?t.globeLayer.onReady(l):l(),this._animationCycle()},update:function(e){}});function CDe(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=(function(r){function s(){var o;JP(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=QP(this,s,[].concat(l)),o.__kapsuleInstance=jV(i,[].concat(tr(t?[o]:[]),l)),o}return tI(s,r),eI(s)})(e);return Object.keys(i()).forEach(function(r){return n.prototype[r]=function(){var s,o=(s=this.__kapsuleInstance)[r].apply(s,arguments);return o===this.__kapsuleInstance?this:o}}),n}var RDe=window.THREE?window.THREE:{Group:Br},YV=CDe(MDe,RDe.Group,!0);var ZV={type:"change"},JV={type:"start"},eG={type:"end"},dae=1e-6,ki={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},nI=new Oe,Pm=new Oe,PDe=new re,iI=new re,KV=new re,Dx=new Gs,pae=new re,rI=new re,QV=new re,sI=new re,oI=class extends Ld{constructor(e,t=null){super(e,t),this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.keys=["KeyA","KeyS","KeyD"],this.mouseButtons={LEFT:qa.ROTATE,MIDDLE:qa.DOLLY,RIGHT:qa.PAN},this.target=new re,this.state=ki.NONE,this.keyState=ki.NONE,this._lastPosition=new re,this._lastZoom=1,this._touchZoomDistanceStart=0,this._touchZoomDistanceEnd=0,this._lastAngle=0,this._eye=new re,this._movePrev=new Oe,this._moveCurr=new Oe,this._lastAxis=new re,this._zoomStart=new Oe,this._zoomEnd=new Oe,this._panStart=new Oe,this._panEnd=new Oe,this._pointers=[],this._pointerPositions={},this._onPointerMove=LDe.bind(this),this._onPointerDown=IDe.bind(this),this._onPointerUp=DDe.bind(this),this._onPointerCancel=NDe.bind(this),this._onContextMenu=VDe.bind(this),this._onMouseWheel=zDe.bind(this),this._onKeyDown=BDe.bind(this),this._onKeyUp=FDe.bind(this),this._onTouchStart=GDe.bind(this),this._onTouchMove=qDe.bind(this),this._onTouchEnd=HDe.bind(this),this._onMouseDown=ODe.bind(this),this._onMouseMove=UDe.bind(this),this._onMouseUp=kDe.bind(this),this._target0=this.target.clone(),this._position0=this.object.position.clone(),this._up0=this.object.up.clone(),this._zoom0=this.object.zoom,t!==null&&(this.connect(t),this.handleResize()),this.update()}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction=""}dispose(){this.disconnect()}handleResize(){let e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}update(){this._eye.subVectors(this.object.position,this.target),this.noRotate||this._rotateCamera(),this.noZoom||this._zoomCamera(),this.noPan||this._panCamera(),this.object.position.addVectors(this.target,this._eye),this.object.isPerspectiveCamera?(this._checkDistances(),this.object.lookAt(this.target),this._lastPosition.distanceToSquared(this.object.position)>dae&&(this.dispatchEvent(ZV),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>dae||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(ZV),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=ki.NONE,this.keyState=ki.NONE,this.target.copy(this._target0),this.object.position.copy(this._position0),this.object.up.copy(this._up0),this.object.zoom=this._zoom0,this.object.updateProjectionMatrix(),this._eye.subVectors(this.object.position,this.target),this.object.lookAt(this.target),this.dispatchEvent(ZV),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(Pm.copy(this._panEnd).sub(this._panStart),Pm.lengthSq()){if(this.object.isOrthographicCamera){let e=(this.object.right-this.object.left)/this.object.zoom/this.domElement.clientWidth,t=(this.object.top-this.object.bottom)/this.object.zoom/this.domElement.clientWidth;Pm.x*=e,Pm.y*=t}Pm.multiplyScalar(this._eye.length()*this.panSpeed),iI.copy(this._eye).cross(this.object.up).setLength(Pm.x),iI.add(PDe.copy(this.object.up).setLength(Pm.y)),this.object.position.add(iI),this.target.add(iI),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(Pm.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){sI.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=sI.length();e?(this._eye.copy(this.object.position).sub(this.target),pae.copy(this._eye).normalize(),rI.copy(this.object.up).normalize(),QV.crossVectors(rI,pae).normalize(),rI.setLength(this._moveCurr.y-this._movePrev.y),QV.setLength(this._moveCurr.x-this._movePrev.x),sI.copy(rI.add(QV)),KV.crossVectors(sI,this._eye).normalize(),e*=this.rotateSpeed,Dx.setFromAxisAngle(KV,e),this._eye.applyQuaternion(Dx),this.object.up.applyQuaternion(Dx),this._lastAxis.copy(KV),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),Dx.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(Dx),this.object.up.applyQuaternion(Dx)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===ki.TOUCH_ZOOM_PAN?(e=this._touchZoomDistanceStart/this._touchZoomDistanceEnd,this._touchZoomDistanceStart=this._touchZoomDistanceEnd,this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=Bu.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")):(e=1+(this._zoomEnd.y-this._zoomStart.y)*this.zoomSpeed,e!==1&&e>0&&(this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=Bu.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")),this.staticMoving?this._zoomStart.copy(this._zoomEnd):this._zoomStart.y+=(this._zoomEnd.y-this._zoomStart.y)*this.dynamicDampingFactor)}_getMouseOnScreen(e,t){return nI.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),nI}_getMouseOnCircle(e,t){return nI.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),nI}_addPointer(e){this._pointers.push(e)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t].pointerId==e.pointerId){this._pointers.splice(t,1);return}}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Oe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0].pointerId?this._pointers[1]:this._pointers[0];return this._pointerPositions[t.pointerId]}_checkDistances(){(!this.noZoom||!this.noPan)&&(this._eye.lengthSq()>this.maxDistance*this.maxDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.maxDistance)),this._zoomStart.copy(this._zoomEnd)),this._eye.lengthSq()<this.minDistance*this.minDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.minDistance)),this._zoomStart.copy(this._zoomEnd)))}};function IDe(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i))}function LDe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function DDe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchEnd(i):this._onMouseUp(),this._removePointer(i),this._pointers.length===0&&(this.domElement.releasePointerCapture(i.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp)))}function NDe(i){this._removePointer(i)}function FDe(){this.enabled!==!1&&(this.keyState=ki.NONE,window.addEventListener("keydown",this._onKeyDown))}function BDe(i){this.enabled!==!1&&(window.removeEventListener("keydown",this._onKeyDown),this.keyState===ki.NONE&&(i.code===this.keys[ki.ROTATE]&&!this.noRotate?this.keyState=ki.ROTATE:i.code===this.keys[ki.ZOOM]&&!this.noZoom?this.keyState=ki.ZOOM:i.code===this.keys[ki.PAN]&&!this.noPan&&(this.keyState=ki.PAN)))}function ODe(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case qa.DOLLY:this.state=ki.ZOOM;break;case qa.ROTATE:this.state=ki.ROTATE;break;case qa.PAN:this.state=ki.PAN;break;default:this.state=ki.NONE}let t=this.keyState!==ki.NONE?this.keyState:this.state;t===ki.ROTATE&&!this.noRotate?(this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr)):t===ki.ZOOM&&!this.noZoom?(this._zoomStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._zoomEnd.copy(this._zoomStart)):t===ki.PAN&&!this.noPan&&(this._panStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._panEnd.copy(this._panStart)),this.dispatchEvent(JV)}function UDe(i){let e=this.keyState!==ki.NONE?this.keyState:this.state;e===ki.ROTATE&&!this.noRotate?(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY))):e===ki.ZOOM&&!this.noZoom?this._zoomEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY)):e===ki.PAN&&!this.noPan&&this._panEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY))}function kDe(){this.state=ki.NONE,this.dispatchEvent(eG)}function zDe(i){if(this.enabled!==!1&&this.noZoom!==!0){switch(i.preventDefault(),i.deltaMode){case 2:this._zoomStart.y-=i.deltaY*.025;break;case 1:this._zoomStart.y-=i.deltaY*.01;break;default:this._zoomStart.y-=i.deltaY*25e-5;break}this.dispatchEvent(JV),this.dispatchEvent(eG)}}function VDe(i){this.enabled!==!1&&i.preventDefault()}function GDe(i){if(this._trackPointer(i),this._pointers.length===1)this.state=ki.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX,this._pointers[0].pageY)),this._movePrev.copy(this._moveCurr);else{this.state=ki.TOUCH_ZOOM_PAN;let e=this._pointers[0].pageX-this._pointers[1].pageX,t=this._pointers[0].pageY-this._pointers[1].pageY;this._touchZoomDistanceEnd=this._touchZoomDistanceStart=Math.sqrt(e*e+t*t);let n=(this._pointers[0].pageX+this._pointers[1].pageX)/2,r=(this._pointers[0].pageY+this._pointers[1].pageY)/2;this._panStart.copy(this._getMouseOnScreen(n,r)),this._panEnd.copy(this._panStart)}this.dispatchEvent(JV)}function qDe(i){if(this._trackPointer(i),this._pointers.length===1)this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY));else{let e=this._getSecondPointerPosition(i),t=i.pageX-e.x,n=i.pageY-e.y;this._touchZoomDistanceEnd=Math.sqrt(t*t+n*n);let r=(i.pageX+e.x)/2,s=(i.pageY+e.y)/2;this._panEnd.copy(this._getMouseOnScreen(r,s))}}function HDe(i){switch(this._pointers.length){case 0:this.state=ki.NONE;break;case 1:this.state=ki.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr);break;case 2:this.state=ki.TOUCH_ZOOM_PAN;for(let e=0;e<this._pointers.length;e++)if(this._pointers[e].pointerId!==i.pointerId){let t=this._pointerPositions[this._pointers[e].pointerId];this._moveCurr.copy(this._getMouseOnCircle(t.x,t.y)),this._movePrev.copy(this._moveCurr);break}break}this.dispatchEvent(eG)}var mae={type:"change"},nG={type:"start"},gae={type:"end"},aI=new Pd,Aae=new Na,WDe=Math.cos(70*Bu.DEG2RAD),ho=new re,Dl=2*Math.PI,dr={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},tG=1e-6,lI=class extends Ld{constructor(e,t=null){super(e,t),this.state=dr.NONE,this.target=new re,this.cursor=new re,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:qa.ROTATE,MIDDLE:qa.DOLLY,RIGHT:qa.PAN},this.touches={ONE:f0.ROTATE,TWO:f0.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new re,this._lastQuaternion=new Gs,this._lastTargetPosition=new re,this._quat=new Gs().setFromUnitVectors(e.up,new re(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new l_,this._sphericalDelta=new l_,this._scale=1,this._panOffset=new re,this._rotateStart=new Oe,this._rotateEnd=new Oe,this._rotateDelta=new Oe,this._panStart=new Oe,this._panEnd=new Oe,this._panDelta=new Oe,this._dollyStart=new Oe,this._dollyEnd=new Oe,this._dollyDelta=new Oe,this._dollyDirection=new re,this._mouse=new Oe,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=XDe.bind(this),this._onPointerDown=jDe.bind(this),this._onPointerUp=$De.bind(this),this._onContextMenu=tNe.bind(this),this._onMouseWheel=KDe.bind(this),this._onKeyDown=QDe.bind(this),this._onTouchStart=JDe.bind(this),this._onTouchMove=eNe.bind(this),this._onMouseDown=YDe.bind(this),this._onMouseMove=ZDe.bind(this),this._interceptControlDown=nNe.bind(this),this._interceptControlUp=iNe.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(mae),this.update(),this.state=dr.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){let t=this.object.position;ho.copy(t).sub(this.target),ho.applyQuaternion(this._quat),this._spherical.setFromVector3(ho),this.autoRotate&&this.state===dr.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(n)&&isFinite(r)&&(n<-Math.PI?n+=Dl:n>Math.PI&&(n-=Dl),r<-Math.PI?r+=Dl:r>Math.PI&&(r-=Dl),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(ho.setFromSpherical(this._spherical),ho.applyQuaternion(this._quatInverse),t.copy(this.target).add(ho),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){let a=ho.length();o=this._clampDistance(a*this._scale);let l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){let a=new re(this._mouse.x,this._mouse.y,0);a.unproject(this.object);let l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;let c=new re(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=ho.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(aI.origin.copy(this.object.position),aI.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(aI.direction))<WDe?this.object.lookAt(this.target):(Aae.setFromNormalAndCoplanarPoint(this.object.up,this.target),aI.intersectPlane(Aae,this.target))))}else if(this.object.isOrthographicCamera){let o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>tG||8*(1-this._lastQuaternion.dot(this.object.quaternion))>tG||this._lastTargetPosition.distanceToSquared(this.target)>tG?(this.dispatchEvent(mae),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Dl/60*this.autoRotateSpeed*e:Dl/60/60*this.autoRotateSpeed}_getZoomScale(e){let t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){ho.setFromMatrixColumn(t,0),ho.multiplyScalar(-e),this._panOffset.add(ho)}_panUp(e,t){this.screenSpacePanning===!0?ho.setFromMatrixColumn(t,1):(ho.setFromMatrixColumn(t,0),ho.crossVectors(this.object.up,ho)),ho.multiplyScalar(e),this._panOffset.add(ho)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;ho.copy(r).sub(this.target);let s=ho.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),r=e-n.left,s=t-n.top,o=n.width,a=n.height;this._mouse.x=r/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Dl*this._rotateDelta.x/t.clientHeight),this._rotateUp(Dl*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Dl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Dl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Dl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Dl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Dl*this._rotateDelta.x/t.clientHeight),this._rotateUp(Dl*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Oe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){let t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}};function jDe(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function XDe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function $De(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(gae),this.state=dr.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:let e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function YDe(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case qa.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=dr.DOLLY;break;case qa.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=dr.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=dr.ROTATE}break;case qa.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=dr.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=dr.PAN}break;default:this.state=dr.NONE}this.state!==dr.NONE&&this.dispatchEvent(nG)}function ZDe(i){switch(this.state){case dr.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case dr.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case dr.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function KDe(i){this.enabled===!1||this.enableZoom===!1||this.state!==dr.NONE||(i.preventDefault(),this.dispatchEvent(nG),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(gae))}function QDe(i){this.enabled!==!1&&this._handleKeyDown(i)}function JDe(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case f0.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=dr.TOUCH_ROTATE;break;case f0.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=dr.TOUCH_PAN;break;default:this.state=dr.NONE}break;case 2:switch(this.touches.TWO){case f0.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=dr.TOUCH_DOLLY_PAN;break;case f0.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=dr.TOUCH_DOLLY_ROTATE;break;default:this.state=dr.NONE}break;default:this.state=dr.NONE}this.state!==dr.NONE&&this.dispatchEvent(nG)}function eNe(i){switch(this._trackPointer(i),this.state){case dr.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case dr.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case dr.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case dr.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=dr.NONE}}function tNe(i){this.enabled!==!1&&i.preventDefault()}function nNe(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function iNe(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var rNe={type:"change"},vae=1e-6,_ae=new Gs,cI=class extends Ld{constructor(e,t=null){super(e,t),this.movementSpeed=1,this.rollSpeed=.005,this.dragToLook=!1,this.autoForward=!1,this._moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0},this._moveVector=new re(0,0,0),this._rotationVector=new re(0,0,0),this._lastQuaternion=new Gs,this._lastPosition=new re,this._status=0,this._onKeyDown=sNe.bind(this),this._onKeyUp=oNe.bind(this),this._onPointerMove=lNe.bind(this),this._onPointerDown=aNe.bind(this),this._onPointerUp=cNe.bind(this),this._onPointerCancel=uNe.bind(this),this._onContextMenu=hNe.bind(this),t!==null&&this.connect(t)}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction=""}dispose(){this.disconnect()}update(e){if(this.enabled===!1)return;let t=this.object,n=e*this.movementSpeed,r=e*this.rollSpeed;t.translateX(this._moveVector.x*n),t.translateY(this._moveVector.y*n),t.translateZ(this._moveVector.z*n),_ae.set(this._rotationVector.x*r,this._rotationVector.y*r,this._rotationVector.z*r,1).normalize(),t.quaternion.multiply(_ae),(this._lastPosition.distanceToSquared(t.position)>vae||8*(1-this._lastQuaternion.dot(t.quaternion))>vae)&&(this.dispatchEvent(rNe),this._lastQuaternion.copy(t.quaternion),this._lastPosition.copy(t.position))}_updateMovementVector(){let e=this._moveState.forward||this.autoForward&&!this._moveState.back?1:0;this._moveVector.x=-this._moveState.left+this._moveState.right,this._moveVector.y=-this._moveState.down+this._moveState.up,this._moveVector.z=-e+this._moveState.back}_updateRotationVector(){this._rotationVector.x=-this._moveState.pitchDown+this._moveState.pitchUp,this._rotationVector.y=-this._moveState.yawRight+this._moveState.yawLeft,this._rotationVector.z=-this._moveState.rollRight+this._moveState.rollLeft}_getContainerDimensions(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}}};function sNe(i){if(!(i.altKey||this.enabled===!1)){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=.1;break;case"KeyW":this._moveState.forward=1;break;case"KeyS":this._moveState.back=1;break;case"KeyA":this._moveState.left=1;break;case"KeyD":this._moveState.right=1;break;case"KeyR":this._moveState.up=1;break;case"KeyF":this._moveState.down=1;break;case"ArrowUp":this._moveState.pitchUp=1;break;case"ArrowDown":this._moveState.pitchDown=1;break;case"ArrowLeft":this._moveState.yawLeft=1;break;case"ArrowRight":this._moveState.yawRight=1;break;case"KeyQ":this._moveState.rollLeft=1;break;case"KeyE":this._moveState.rollRight=1;break}this._updateMovementVector(),this._updateRotationVector()}}function oNe(i){if(this.enabled!==!1){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=1;break;case"KeyW":this._moveState.forward=0;break;case"KeyS":this._moveState.back=0;break;case"KeyA":this._moveState.left=0;break;case"KeyD":this._moveState.right=0;break;case"KeyR":this._moveState.up=0;break;case"KeyF":this._moveState.down=0;break;case"ArrowUp":this._moveState.pitchUp=0;break;case"ArrowDown":this._moveState.pitchDown=0;break;case"ArrowLeft":this._moveState.yawLeft=0;break;case"ArrowRight":this._moveState.yawRight=0;break;case"KeyQ":this._moveState.rollLeft=0;break;case"KeyE":this._moveState.rollRight=0;break}this._updateMovementVector(),this._updateRotationVector()}}function aNe(i){if(this.enabled!==!1)if(this.dragToLook)this._status++;else{switch(i.button){case 0:this._moveState.forward=1;break;case 2:this._moveState.back=1;break}this._updateMovementVector()}}function lNe(i){if(this.enabled!==!1&&(!this.dragToLook||this._status>0)){let e=this._getContainerDimensions(),t=e.size[0]/2,n=e.size[1]/2;this._moveState.yawLeft=-(i.pageX-e.offset[0]-t)/t,this._moveState.pitchDown=(i.pageY-e.offset[1]-n)/n,this._updateRotationVector()}}function cNe(i){if(this.enabled!==!1){if(this.dragToLook)this._status--,this._moveState.yawLeft=this._moveState.pitchDown=0;else{switch(i.button){case 0:this._moveState.forward=0;break;case 2:this._moveState.back=0;break}this._updateMovementVector()}this._updateRotationVector()}}function uNe(){this.enabled!==!1&&(this.dragToLook?(this._status=0,this._moveState.yawLeft=this._moveState.pitchDown=0):(this._moveState.forward=0,this._moveState.back=0,this._updateMovementVector()),this._updateRotationVector())}function hNe(i){this.enabled!==!1&&i.preventDefault()}var xae={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`52365236 52375237 varying vec2 vUv;52385238
@@ -5255,8 +5255,8 @@ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
52555255 gl_FragColor = opacity * texel;52565256 52575257 5258- }`};var op=class{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}},mNe=new Ou(-1,1,1,-1,0,1),iG=class extends Xn{constructor(){super(),this.setAttribute("position",new Ln([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Ln([0,2,0,0,2,0],2))}},ANe=new iG,mP=class{constructor(e){this._mesh=new Hn(ANe,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,mNe)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}};var AP=class extends op{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof ps?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=pg.clone(e.uniforms),this.material=new ps({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this._fsQuad=new mP(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this._fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}};var jS=class extends op{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){let r=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let o,a;this.inverse?(o=0,a=1):(o=1,a=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),s.buffers.stencil.setFunc(r.ALWAYS,o,4294967295),s.buffers.stencil.setClear(a),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(r.EQUAL,1,4294967295),s.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),s.buffers.stencil.setLocked(!0)}},gP=class extends op{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}};var vP=class{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){let n=e.getSize(new Oe);this._width=n.width,this._height=n.height,t=new Oa(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Wi}),t.texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new AP(Sae),this.copyPass.material.blending=ms,this.timer=new tg}swapBuffers(){let e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){let t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){this.timer.update(),e===void 0&&(e=this.timer.getDelta());let t=this.renderer.getRenderTarget(),n=!1;for(let r=0,s=this.passes.length;r<s;r++){let o=this.passes[r];if(o.enabled!==!1){if(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(r),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),o.needsSwap){if(n){let a=this.renderer.getContext(),l=this.renderer.state.buffers.stencil;l.setFunc(a.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),l.setFunc(a.EQUAL,1,4294967295)}this.swapBuffers()}jS!==void 0&&(o instanceof jS?n=!0:o instanceof gP&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){let t=this.renderer.getSize(new Oe);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;let n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(let s=0;s<this.passes.length;s++)this.passes[s].setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}};var _P=class extends op{constructor(e,t,n=null,r=null,s=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=s,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.isRenderPass=!0,this._oldClearColor=new zt}render(e,t,n){let r=e.autoClear;e.autoClear=!1;let s,o;this.overrideMaterial!==null&&(o=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),this.clearAlpha!==null&&(s=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),this.clearDepth==!0&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear===!0&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor!==null&&e.setClearColor(this._oldClearColor),this.clearAlpha!==null&&e.setClearAlpha(s),this.overrideMaterial!==null&&(this.scene.overrideMaterial=o),e.autoClear=r}};function il(){return il=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},il.apply(null,arguments)}function Tae(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Lm(i,e){return Lm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Lm(i,e)}function Eae(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,Lm(i,e)}function xP(i){return xP=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},xP(i)}function Mae(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function rG(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rG=function(){return!!i})()}function Cae(i,e,t){if(rG())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&Lm(r,t.prototype),r}function yP(i){var e=typeof Map=="function"?new Map:void 0;return yP=function(n){if(n===null||!Mae(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(n))return e.get(n);e.set(n,r)}function r(){return Cae(n,arguments,xP(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Lm(r,n)},yP(i)}var Fl=(function(i){Eae(e,i);function e(t){var n;if(1)n=i.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+t+" for more information.")||this;else for(var r,s,o;o<r;o++);return Tae(n)}return e})(yP(Error));function Rae(i,e){return i.substr(-e.length)===e}var gNe=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;function Iae(i){if(typeof i!="string")return i;var e=i.match(gNe);return e?parseFloat(i):i}var vNe=function(e){return function(t,n){n===void 0&&(n="16px");var r=t,s=n;if(typeof t=="string"){if(!Rae(t,"px"))throw new Fl(69,e,t);r=Iae(t)}if(typeof n=="string"){if(!Rae(n,"px"))throw new Fl(70,e,n);s=Iae(n)}if(typeof r=="string")throw new Fl(71,t,e);if(typeof s=="string")throw new Fl(72,n,e);return""+r/s+e}},Lae=vNe,q_t=Lae("em");var H_t=Lae("rem");function sG(i){return Math.round(i*255)}function _Ne(i,e,t){return sG(i)+","+sG(e)+","+sG(t)}function XS(i,e,t,n){if(n===void 0&&(n=_Ne),e===0)return n(t,t,t);var r=(i%360+360)%360/60,s=(1-Math.abs(2*t-1))*e,o=s*(1-Math.abs(r%2-1)),a=0,l=0,c=0;r>=0&&r<1?(a=s,l=o):r>=1&&r<2?(a=o,l=s):r>=2&&r<3?(l=s,c=o):r>=3&&r<4?(l=o,c=s):r>=4&&r<5?(a=o,c=s):r>=5&&r<6&&(a=s,c=o);var u=t-s/2,f=a+u,d=l+u,A=c+u;return n(f,d,A)}var Pae={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};function xNe(i){if(typeof i!="string")return i;var e=i.toLowerCase();return Pae[e]?"#"+Pae[e]:i}var yNe=/^#[a-fA-F0-9]{6}$/,bNe=/^#[a-fA-F0-9]{8}$/,wNe=/^#[a-fA-F0-9]{3}$/,SNe=/^#[a-fA-F0-9]{4}$/,oG=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,TNe=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,ENe=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,MNe=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function Dm(i){if(typeof i!="string")throw new Fl(3);var e=xNe(i);if(e.match(yNe))return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16)};if(e.match(bNe)){var t=parseFloat((parseInt(""+e[7]+e[8],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16),alpha:t}}if(e.match(wNe))return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16)};if(e.match(SNe)){var n=parseFloat((parseInt(""+e[4]+e[4],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16),alpha:n}}var r=oG.exec(e);if(r)return{red:parseInt(""+r[1],10),green:parseInt(""+r[2],10),blue:parseInt(""+r[3],10)};var s=TNe.exec(e.substring(0,50));if(s)return{red:parseInt(""+s[1],10),green:parseInt(""+s[2],10),blue:parseInt(""+s[3],10),alpha:parseFloat(""+s[4])>1?parseFloat(""+s[4])/100:parseFloat(""+s[4])};var o=ENe.exec(e);if(o){var a=parseInt(""+o[1],10),l=parseInt(""+o[2],10)/100,c=parseInt(""+o[3],10)/100,u="rgb("+XS(a,l,c)+")",f=oG.exec(u);if(!f)throw new Fl(4,e,u);return{red:parseInt(""+f[1],10),green:parseInt(""+f[2],10),blue:parseInt(""+f[3],10)}}var d=MNe.exec(e.substring(0,50));if(d){var A=parseInt(""+d[1],10),y=parseInt(""+d[2],10)/100,w=parseInt(""+d[3],10)/100,S="rgb("+XS(A,y,w)+")",T=oG.exec(S);if(!T)throw new Fl(4,e,S);return{red:parseInt(""+T[1],10),green:parseInt(""+T[2],10),blue:parseInt(""+T[3],10),alpha:parseFloat(""+d[4])>1?parseFloat(""+d[4])/100:parseFloat(""+d[4])}}throw new Fl(5)}function CNe(i){var e=i.red/255,t=i.green/255,n=i.blue/255,r=Math.max(e,t,n),s=Math.min(e,t,n),o=(r+s)/2;if(r===s)return i.alpha!==void 0?{hue:0,saturation:0,lightness:o,alpha:i.alpha}:{hue:0,saturation:0,lightness:o};var a,l=r-s,c=o>.5?l/(2-r-s):l/(r+s);switch(r){case e:a=(t-n)/l+(t<n?6:0);break;case t:a=(n-e)/l+2;break;default:a=(e-t)/l+4;break}return a*=60,i.alpha!==void 0?{hue:a,saturation:c,lightness:o,alpha:i.alpha}:{hue:a,saturation:c,lightness:o}}function Nm(i){return CNe(Dm(i))}var RNe=function(e){return e.length===7&&e[1]===e[2]&&e[3]===e[4]&&e[5]===e[6]?"#"+e[1]+e[3]+e[5]:e},lG=RNe;function g1(i){var e=i.toString(16);return e.length===1?"0"+e:e}function aG(i){return g1(Math.round(i*255))}function INe(i,e,t){return lG("#"+aG(i)+aG(e)+aG(t))}function bP(i,e,t){return XS(i,e,t,INe)}function PNe(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return bP(i,e,t);if(typeof i=="object"&&e===void 0&&t===void 0)return bP(i.hue,i.saturation,i.lightness);throw new Fl(1)}function LNe(i,e,t,n){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?bP(i,e,t):"rgba("+XS(i,e,t)+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?bP(i.hue,i.saturation,i.lightness):"rgba("+XS(i.hue,i.saturation,i.lightness)+","+i.alpha+")";throw new Fl(2)}function cG(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return lG("#"+g1(i)+g1(e)+g1(t));if(typeof i=="object"&&e===void 0&&t===void 0)return lG("#"+g1(i.red)+g1(i.green)+g1(i.blue));throw new Fl(6)}function wP(i,e,t,n){if(typeof i=="string"&&typeof e=="number"){var r=Dm(i);return"rgba("+r.red+","+r.green+","+r.blue+","+e+")"}else{if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?cG(i,e,t):"rgba("+i+","+e+","+t+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?cG(i.red,i.green,i.blue):"rgba("+i.red+","+i.green+","+i.blue+","+i.alpha+")"}throw new Fl(7)}var DNe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},NNe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&typeof e.alpha=="number"},FNe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},BNe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&typeof e.alpha=="number"};function Fm(i){if(typeof i!="object")throw new Fl(8);if(NNe(i))return wP(i);if(DNe(i))return cG(i);if(BNe(i))return LNe(i);if(FNe(i))return PNe(i);throw new Fl(8)}function Dae(i,e,t){return function(){var r=t.concat(Array.prototype.slice.call(arguments));return r.length>=e?i.apply(this,r):Dae(i,e,r)}}function _c(i){return Dae(i,i.length,[])}function ONe(i,e){if(e==="transparent")return e;var t=Nm(e);return Fm(il({},t,{hue:t.hue+parseFloat(i)}))}var W_t=_c(ONe);function Bx(i,e,t){return Math.max(i,Math.min(e,t))}function UNe(i,e){if(e==="transparent")return e;var t=Nm(e);return Fm(il({},t,{lightness:Bx(0,1,t.lightness-parseFloat(i))}))}var j_t=_c(UNe);function kNe(i,e){if(e==="transparent")return e;var t=Nm(e);return Fm(il({},t,{saturation:Bx(0,1,t.saturation-parseFloat(i))}))}var X_t=_c(kNe);function zNe(i,e){if(e==="transparent")return e;var t=Nm(e);return Fm(il({},t,{lightness:Bx(0,1,t.lightness+parseFloat(i))}))}var $_t=_c(zNe);function VNe(i,e,t){if(e==="transparent")return t;if(t==="transparent")return e;if(i===0)return t;var n=Dm(e),r=il({},n,{alpha:typeof n.alpha=="number"?n.alpha:1}),s=Dm(t),o=il({},s,{alpha:typeof s.alpha=="number"?s.alpha:1}),a=r.alpha-o.alpha,l=parseFloat(i)*2-1,c=l*a===-1?l:l+a,u=1+l*a,f=(c/u+1)/2,d=1-f,A={red:Math.floor(r.red*f+o.red*d),green:Math.floor(r.green*f+o.green*d),blue:Math.floor(r.blue*f+o.blue*d),alpha:r.alpha*parseFloat(i)+o.alpha*(1-parseFloat(i))};return wP(A)}var GNe=_c(VNe),Nae=GNe;function qNe(i,e){if(e==="transparent")return e;var t=Dm(e),n=typeof t.alpha=="number"?t.alpha:1,r=il({},t,{alpha:Bx(0,1,(n*100+parseFloat(i)*100)/100)});return wP(r)}var HNe=_c(qNe),Fae=HNe;function WNe(i,e){if(e==="transparent")return e;var t=Nm(e);return Fm(il({},t,{saturation:Bx(0,1,t.saturation+parseFloat(i))}))}var Y_t=_c(WNe);function jNe(i,e){return e==="transparent"?e:Fm(il({},Nm(e),{hue:parseFloat(i)}))}var Z_t=_c(jNe);function XNe(i,e){return e==="transparent"?e:Fm(il({},Nm(e),{lightness:parseFloat(i)}))}var K_t=_c(XNe);function $Ne(i,e){return e==="transparent"?e:Fm(il({},Nm(e),{saturation:parseFloat(i)}))}var Q_t=_c($Ne);function YNe(i,e){return e==="transparent"?e:Nae(parseFloat(i),"rgb(0, 0, 0)",e)}var J_t=_c(YNe);function ZNe(i,e){return e==="transparent"?e:Nae(parseFloat(i),"rgb(255, 255, 255)",e)}var ext=_c(ZNe);function KNe(i,e){if(e==="transparent")return e;var t=Dm(e),n=typeof t.alpha=="number"?t.alpha:1,r=il({},t,{alpha:Bx(0,1,+(n*100-parseFloat(i)*100).toFixed(2)/100)});return wP(r)}var txt=_c(KNe);var SP="http://www.w3.org/1999/xhtml",uG={svg:"http://www.w3.org/2000/svg",xhtml:SP,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function TP(i){var e=i+="",t=e.indexOf(":");return t>=0&&(e=i.slice(0,t))!=="xmlns"&&(i=i.slice(t+1)),uG.hasOwnProperty(e)?{space:uG[e],local:i}:i}function QNe(i){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===SP&&e.documentElement.namespaceURI===SP?e.createElement(i):e.createElementNS(t,i)}}function JNe(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function EP(i){var e=TP(i);return(e.local?JNe:QNe)(e)}function e5e(){}function MP(i){return i==null?e5e:function(){return this.querySelector(i)}}function Bae(i){typeof i!="function"&&(i=MP(i));for(var e=this._groups,t=e.length,n=new Array(t),r=0;r<t;++r)for(var s=e[r],o=s.length,a=n[r]=new Array(o),l,c,u=0;u<o;++u)(l=s[u])&&(c=i.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new bs(n,this._parents)}function hG(i){return i==null?[]:Array.isArray(i)?i:Array.from(i)}function t5e(){return[]}function Oae(i){return i==null?t5e:function(){return this.querySelectorAll(i)}}function n5e(i){return function(){return hG(i.apply(this,arguments))}}function Uae(i){typeof i=="function"?i=n5e(i):i=Oae(i);for(var e=this._groups,t=e.length,n=[],r=[],s=0;s<t;++s)for(var o=e[s],a=o.length,l,c=0;c<a;++c)(l=o[c])&&(n.push(i.call(l,l.__data__,c,o)),r.push(l));return new bs(n,r)}function kae(i){return function(){return this.matches(i)}}function CP(i){return function(e){return e.matches(i)}}var i5e=Array.prototype.find;function r5e(i){return function(){return i5e.call(this.children,i)}}function s5e(){return this.firstElementChild}function zae(i){return this.select(i==null?s5e:r5e(typeof i=="function"?i:CP(i)))}var o5e=Array.prototype.filter;function a5e(){return Array.from(this.children)}function l5e(i){return function(){return o5e.call(this.children,i)}}function Vae(i){return this.selectAll(i==null?a5e:l5e(typeof i=="function"?i:CP(i)))}function Gae(i){typeof i!="function"&&(i=kae(i));for(var e=this._groups,t=e.length,n=new Array(t),r=0;r<t;++r)for(var s=e[r],o=s.length,a=n[r]=[],l,c=0;c<o;++c)(l=s[c])&&i.call(l,l.__data__,c,s)&&a.push(l);return new bs(n,this._parents)}function RP(i){return new Array(i.length)}function qae(){return new bs(this._enter||this._groups.map(RP),this._parents)}function $S(i,e){this.ownerDocument=i.ownerDocument,this.namespaceURI=i.namespaceURI,this._next=null,this._parent=i,this.__data__=e}$S.prototype={constructor:$S,appendChild:function(i){return this._parent.insertBefore(i,this._next)},insertBefore:function(i,e){return this._parent.insertBefore(i,e)},querySelector:function(i){return this._parent.querySelector(i)},querySelectorAll:function(i){return this._parent.querySelectorAll(i)}};function Hae(i){return function(){return i}}function c5e(i,e,t,n,r,s){for(var o=0,a,l=e.length,c=s.length;o<c;++o)(a=e[o])?(a.__data__=s[o],n[o]=a):t[o]=new $S(i,s[o]);for(;o<l;++o)(a=e[o])&&(r[o]=a)}function u5e(i,e,t,n,r,s,o){var a,l,c=new Map,u=e.length,f=s.length,d=new Array(u),A;for(a=0;a<u;++a)(l=e[a])&&(d[a]=A=o.call(l,l.__data__,a,e)+"",c.has(A)?r[a]=l:c.set(A,l));for(a=0;a<f;++a)A=o.call(i,s[a],a,s)+"",(l=c.get(A))?(n[a]=l,l.__data__=s[a],c.delete(A)):t[a]=new $S(i,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(d[a])===l&&(r[a]=l)}function h5e(i){return i.__data__}function Wae(i,e){if(!arguments.length)return Array.from(this,h5e);var t=e?u5e:c5e,n=this._parents,r=this._groups;typeof i!="function"&&(i=Hae(i));for(var s=r.length,o=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=n[c],f=r[c],d=f.length,A=f5e(i.call(u,u&&u.__data__,c,n)),y=A.length,w=a[c]=new Array(y),S=o[c]=new Array(y),T=l[c]=new Array(d);t(u,f,w,S,T,A,e);for(var R=0,P=0,I,F;R<y;++R)if(I=w[R]){for(R>=P&&(P=R+1);!(F=S[P])&&++P<y;);I._next=F||null}}return o=new bs(o,n),o._enter=a,o._exit=l,o}function f5e(i){return typeof i=="object"&&"length"in i?i:Array.from(i)}function jae(){return new bs(this._exit||this._groups.map(RP),this._parents)}function Xae(i,e,t){var n=this.enter(),r=this,s=this.exit();return typeof i=="function"?(n=i(n),n&&(n=n.selection())):n=n.append(i+""),e!=null&&(r=e(r),r&&(r=r.selection())),t==null?s.remove():t(s),n&&r?n.merge(r).order():r}function $ae(i){for(var e=i.selection?i.selection():i,t=this._groups,n=e._groups,r=t.length,s=n.length,o=Math.min(r,s),a=new Array(r),l=0;l<o;++l)for(var c=t[l],u=n[l],f=c.length,d=a[l]=new Array(f),A,y=0;y<f;++y)(A=c[y]||u[y])&&(d[y]=A);for(;l<r;++l)a[l]=t[l];return new bs(a,this._parents)}function Yae(){for(var i=this._groups,e=-1,t=i.length;++e<t;)for(var n=i[e],r=n.length-1,s=n[r],o;--r>=0;)(o=n[r])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function Zae(i){i||(i=d5e);function e(f,d){return f&&d?i(f.__data__,d.__data__):!f-!d}for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s){for(var o=t[s],a=o.length,l=r[s]=new Array(a),c,u=0;u<a;++u)(c=o[u])&&(l[u]=c);l.sort(e)}return new bs(r,this._parents).order()}function d5e(i,e){return i<e?-1:i>e?1:i>=e?0:NaN}function Kae(){var i=arguments[0];return arguments[0]=this,i.apply(null,arguments),this}function Qae(){return Array.from(this)}function Jae(){for(var i=this._groups,e=0,t=i.length;e<t;++e)for(var n=i[e],r=0,s=n.length;r<s;++r){var o=n[r];if(o)return o}return null}function ele(){let i=0;for(let e of this)++i;return i}function tle(){return!this.node()}function nle(i){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,o=r.length,a;s<o;++s)(a=r[s])&&i.call(a,a.__data__,s,r);return this}function p5e(i){return function(){this.removeAttribute(i)}}function m5e(i){return function(){this.removeAttributeNS(i.space,i.local)}}function A5e(i,e){return function(){this.setAttribute(i,e)}}function g5e(i,e){return function(){this.setAttributeNS(i.space,i.local,e)}}function v5e(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttribute(i):this.setAttribute(i,t)}}function _5e(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttributeNS(i.space,i.local):this.setAttributeNS(i.space,i.local,t)}}function ile(i,e){var t=TP(i);if(arguments.length<2){var n=this.node();return t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}return this.each((e==null?t.local?m5e:p5e:typeof e=="function"?t.local?_5e:v5e:t.local?g5e:A5e)(t,e))}function IP(i){return i.ownerDocument&&i.ownerDocument.defaultView||i.document&&i||i.defaultView}function x5e(i){return function(){this.style.removeProperty(i)}}function y5e(i,e,t){return function(){this.style.setProperty(i,e,t)}}function b5e(i,e,t){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(i):this.style.setProperty(i,n,t)}}function rle(i,e,t){return arguments.length>1?this.each((e==null?x5e:typeof e=="function"?b5e:y5e)(i,e,t??"")):w5e(this.node(),i)}function w5e(i,e){return i.style.getPropertyValue(e)||IP(i).getComputedStyle(i,null).getPropertyValue(e)}function S5e(i){return function(){delete this[i]}}function T5e(i,e){return function(){this[i]=e}}function E5e(i,e){return function(){var t=e.apply(this,arguments);t==null?delete this[i]:this[i]=t}}function sle(i,e){return arguments.length>1?this.each((e==null?S5e:typeof e=="function"?E5e:T5e)(i,e)):this.node()[i]}function ole(i){return i.trim().split(/^|\s+/)}function fG(i){return i.classList||new ale(i)}function ale(i){this._node=i,this._names=ole(i.getAttribute("class")||"")}ale.prototype={add:function(i){var e=this._names.indexOf(i);e<0&&(this._names.push(i),this._node.setAttribute("class",this._names.join(" ")))},remove:function(i){var e=this._names.indexOf(i);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(i){return this._names.indexOf(i)>=0}};function lle(i,e){for(var t=fG(i),n=-1,r=e.length;++n<r;)t.add(e[n])}function cle(i,e){for(var t=fG(i),n=-1,r=e.length;++n<r;)t.remove(e[n])}function M5e(i){return function(){lle(this,i)}}function C5e(i){return function(){cle(this,i)}}function R5e(i,e){return function(){(e.apply(this,arguments)?lle:cle)(this,i)}}function ule(i,e){var t=ole(i+"");if(arguments.length<2){for(var n=fG(this.node()),r=-1,s=t.length;++r<s;)if(!n.contains(t[r]))return!1;return!0}return this.each((typeof e=="function"?R5e:e?M5e:C5e)(t,e))}function I5e(){this.textContent=""}function P5e(i){return function(){this.textContent=i}}function L5e(i){return function(){var e=i.apply(this,arguments);this.textContent=e??""}}function hle(i){return arguments.length?this.each(i==null?I5e:(typeof i=="function"?L5e:P5e)(i)):this.node().textContent}function D5e(){this.innerHTML=""}function N5e(i){return function(){this.innerHTML=i}}function F5e(i){return function(){var e=i.apply(this,arguments);this.innerHTML=e??""}}function fle(i){return arguments.length?this.each(i==null?D5e:(typeof i=="function"?F5e:N5e)(i)):this.node().innerHTML}function B5e(){this.nextSibling&&this.parentNode.appendChild(this)}function dle(){return this.each(B5e)}function O5e(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ple(){return this.each(O5e)}function mle(i){var e=typeof i=="function"?i:EP(i);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function U5e(){return null}function Ale(i,e){var t=typeof i=="function"?i:EP(i),n=e==null?U5e:typeof e=="function"?e:MP(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)})}function k5e(){var i=this.parentNode;i&&i.removeChild(this)}function gle(){return this.each(k5e)}function z5e(){var i=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function V5e(){var i=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function vle(i){return this.select(i?V5e:z5e)}function _le(i){return arguments.length?this.property("__data__",i):this.node().__data__}function G5e(i){return function(e){i.call(this,e,this.__data__)}}function q5e(i){return i.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function H5e(i){return function(){var e=this.__on;if(e){for(var t=0,n=-1,r=e.length,s;t<r;++t)s=e[t],(!i.type||s.type===i.type)&&s.name===i.name?this.removeEventListener(s.type,s.listener,s.options):e[++n]=s;++n?e.length=n:delete this.__on}}}function W5e(i,e,t){return function(){var n=this.__on,r,s=G5e(e);if(n){for(var o=0,a=n.length;o<a;++o)if((r=n[o]).type===i.type&&r.name===i.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=t),r.value=e;return}}this.addEventListener(i.type,s,t),r={type:i.type,name:i.name,value:e,listener:s,options:t},n?n.push(r):this.__on=[r]}}function xle(i,e,t){var n=q5e(i+""),r,s=n.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<s;++r)if((o=n[r]).type===u.type&&o.name===u.name)return u.value}return}for(a=e?W5e:H5e,r=0;r<s;++r)this.each(a(n[r],e,t));return this}function yle(i,e,t){var n=IP(i),r=n.CustomEvent;typeof r=="function"?r=new r(e,t):(r=n.document.createEvent("Event"),t?(r.initEvent(e,t.bubbles,t.cancelable),r.detail=t.detail):r.initEvent(e,!1,!1)),i.dispatchEvent(r)}function j5e(i,e){return function(){return yle(this,i,e)}}function X5e(i,e){return function(){return yle(this,i,e.apply(this,arguments))}}function ble(i,e){return this.each((typeof e=="function"?X5e:j5e)(i,e))}function*wle(){for(var i=this._groups,e=0,t=i.length;e<t;++e)for(var n=i[e],r=0,s=n.length,o;r<s;++r)(o=n[r])&&(yield o)}var dG=[null];function bs(i,e){this._groups=i,this._parents=e}function $5e(){return new bs([[document.documentElement]],dG)}function Y5e(){return this}bs.prototype=$5e.prototype={constructor:bs,select:Bae,selectAll:Uae,selectChild:zae,selectChildren:Vae,filter:Gae,data:Wae,enter:qae,exit:jae,join:Xae,merge:$ae,selection:Y5e,order:Yae,sort:Zae,call:Kae,nodes:Qae,node:Jae,size:ele,empty:tle,each:nle,attr:ile,style:rle,property:sle,classed:ule,text:hle,html:fle,raise:dle,lower:ple,append:mle,insert:Ale,remove:gle,clone:vle,datum:_le,on:xle,dispatch:ble,[Symbol.iterator]:wle};function pG(i){return typeof i=="string"?new bs([[document.querySelector(i)]],[document.documentElement]):new bs([[i]],dG)}function Sle(i){let e;for(;e=i.sourceEvent;)i=e;return i}function mG(i,e){if(i=Sle(i),e===void 0&&(e=i.currentTarget),e){var t=e.ownerSVGElement||e;if(t.createSVGPoint){var n=t.createSVGPoint();return n.x=i.clientX,n.y=i.clientY,n=n.matrixTransform(e.getScreenCTM().inverse()),[n.x,n.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[i.clientX-r.left-e.clientLeft,i.clientY-r.top-e.clientTop]}}return[i.pageX,i.pageY]}var KS,Gr,Rle,_G,Bm,Tle,Ile,Ple,AG,LP,YS,Lle,xG,gG,vG,Z5e,NP={},FP=[],K5e=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,OP=Array.isArray;function zf(i,e){for(var t in e)i[t]=e[t];return i}function yG(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function Q5e(i,e,t){var n,r,s,o={};for(s in e)s=="key"?n=e[s]:s=="ref"?r=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?KS.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(s in i.defaultProps)o[s]===void 0&&(o[s]=i.defaultProps[s]);return ZS(i,o,n,r,null)}function ZS(i,e,t,n,r){var s={type:i,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Rle,__i:-1,__u:0};return r==null&&Gr.vnode!=null&&Gr.vnode(s),s}function UP(i){return i.children}function DP(i,e){this.props=i,this.context=e}function v1(i,e){if(e==null)return i.__?v1(i.__,i.__i+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?v1(i):null}function J5e(i){if(i.__P&&i.__d){var e=i.__v,t=e.__e,n=[],r=[],s=zf({},e);s.__v=e.__v+1,Gr.vnode&&Gr.vnode(s),bG(i.__P,s,e,i.__n,i.__P.namespaceURI,32&e.__u?[t]:null,n,t??v1(e),!!(32&e.__u),r),s.__v=e.__v,s.__.__k[s.__i]=s,Ole(n,s,r),e.__e=e.__=null,s.__e!=t&&Dle(s)}}function Dle(i){if((i=i.__)!=null&&i.__c!=null)return i.__e=i.__c.base=null,i.__k.some(function(e){if(e!=null&&e.__e!=null)return i.__e=i.__c.base=e.__e}),Dle(i)}function Ele(i){(!i.__d&&(i.__d=!0)&&Bm.push(i)&&!BP.__r++||Tle!=Gr.debounceRendering)&&((Tle=Gr.debounceRendering)||Ile)(BP)}function BP(){try{for(var i,e=1;Bm.length;)Bm.length>e&&Bm.sort(Ple),i=Bm.shift(),e=Bm.length,J5e(i)}finally{Bm.length=BP.__r=0}}function Nle(i,e,t,n,r,s,o,a,l,c,u){var f,d,A,y,w,S,T=n&&n.__k||FP,R=e.length;for(l=e6e(t,e,T,l,R),f=0;f<R;f++)(A=t.__k[f])!=null&&(d=A.__i!=-1&&T[A.__i]||NP,A.__i=f,S=bG(i,A,d,r,s,o,a,l,c,u),y=A.__e,A.ref&&d.ref!=A.ref&&(d.ref&&wG(d.ref,null,A),u.push(A.ref,A.__c||y,A)),w==null&&y!=null&&(w=y),4&A.__u?(l=Fle(A,l,i),d.__e&&(d.__e=null)):typeof A.type=="function"&&S!==void 0?l=S:y&&(l=y.nextSibling),A.__u&=-7);return t.__e=w,l}function e6e(i,e,t,n,r){var s,o,a,l,c,u=t.length,f=u,d=0;for(i.__k=new Array(r),s=0;s<r;s++)(o=e[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=i.__k[s]=ZS(null,o,null,null,null):OP(o)?o=i.__k[s]=ZS(UP,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[s]=ZS(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):i.__k[s]=o,l=s+d,o.__=i,o.__b=i.__b+1,a=null,(c=o.__i=t6e(o,t,l,f))!=-1&&(f--,(a=t[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(r>u?d--:r<u&&d++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?d--:c==l+1?d++:(c>l?d--:d++,o.__u|=4))):i.__k[s]=null;if(f)for(s=0;s<u;s++)(a=t[s])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=v1(a)),kle(a,a));return n}function Fle(i,e,t){var n,r;if(typeof i.type=="function"){for(n=i.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=i,e=Fle(n[r],e,t));return e}i.__e!=e&&(e&&i.type&&!e.parentNode&&(e=v1(i)),e=t.insertBefore(i.__e,e||null));do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function t6e(i,e,t,n){var r,s,o,a=i.key,l=i.type,c=e[t],u=c!=null&&(2&c.__u)==0;if(c===null&&a==null||u&&a==c.key&&l==c.type)return t;if(n>(u?1:0)){for(r=t-1,s=t+1;r>=0||s<e.length;)if((c=e[o=r>=0?r--:s++])!=null&&(2&c.__u)==0&&a==c.key&&l==c.type)return o}return-1}function Mle(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||K5e.test(e)?t:t+"px"}function PP(i,e,t,n,r){var s,o;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof n=="string"&&(i.style.cssText=n=""),n)for(e in n)t&&e in t||Mle(i.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||Mle(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(Lle,"$1")),o=e.toLowerCase(),e=o in i||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+s]=t,t?n?t[YS]=n[YS]:(t[YS]=xG,i.addEventListener(e,s?vG:gG,s)):i.removeEventListener(e,s?vG:gG,s);else{if(r=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function Cle(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e[LP]==null)e[LP]=xG++;else if(e[LP]<t[YS])return;return t(Gr.event?Gr.event(e):e)}}}function bG(i,e,t,n,r,s,o,a,l,c){var u,f,d,A,y,w,S,T,R,P,I,F,D,L,C,B,k=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(l=!!(32&t.__u),s=[a=e.__e=t.__e]),(u=Gr.__b)&&u(e);e:if(typeof k=="function"){f=o.length;try{if(R=e.props,P=k.prototype&&k.prototype.render,I=(u=k.contextType)&&n[u.__c],F=u?I?I.props.value:u.__:n,t.__c?T=(d=e.__c=t.__c).__=d.__E:(P?e.__c=d=new k(R,F):(e.__c=d=new DP(R,F),d.constructor=k,d.render=i6e),I&&I.sub(d),d.state||(d.state={}),d.__n=n,A=d.__d=!0,d.__h=[],d._sb=[]),P&&d.__s==null&&(d.__s=d.state),P&&k.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=zf({},d.__s)),zf(d.__s,k.getDerivedStateFromProps(R,d.__s))),y=d.props,w=d.state,d.__v=e,A)P&&k.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),P&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(P&&k.getDerivedStateFromProps==null&&R!==y&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(R,F),e.__v==t.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(R,d.__s,F)===!1){e.__v!=t.__v&&(d.props=R,d.state=d.__s,d.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(z){z&&(z.__=e)}),FP.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d),a=v1(t);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(R,d.__s,F),P&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(y,w,S)})}if(d.context=F,d.props=R,d.__P=i,d.__e=!1,D=Gr.__r,L=0,P)d.state=d.__s,d.__d=!1,D&&D(e),u=d.render(d.props,d.state,d.context),FP.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,D&&D(e),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++L<25);d.state=d.__s,d.getChildContext!=null&&(n=zf(zf({},n),d.getChildContext())),P&&!A&&d.getSnapshotBeforeUpdate!=null&&(S=d.getSnapshotBeforeUpdate(y,w)),C=u!=null&&u.type===UP&&u.key==null?Ule(u.props.children):u,a=Nle(i,OP(C)?C:[C],e,t,n,r,s,o,a,l,c),d.base=e.__e,e.__u&=-161,d.__h.length&&o.push(d),T&&(d.__E=d.__=null)}catch(z){if(o.length=f,e.__v=null,l||s!=null){if(z.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;s!=null&&(s[s.indexOf(a)]=null),e.__e=a}else if(s!=null)for(B=s.length;B--;)yG(s[B])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),z.then||Ble(e),Gr.__e(z,e,t)}}else s==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=n6e(t.__e,e,t,n,r,s,o,l,c);return(u=Gr.diffed)&&u(e),128&e.__u?void 0:a}function Ble(i){i&&(i.__c&&(i.__c.__e=!0),i.__k&&i.__k.some(Ble))}function Ole(i,e,t){for(var n=0;n<t.length;n++)wG(t[n],t[++n],t[++n]);Gr.__c&&Gr.__c(e,i),i.some(function(r){try{i=r.__h,r.__h=[],i.some(function(s){s.call(r)})}catch(s){Gr.__e(s,r.__v)}})}function Ule(i){return typeof i!="object"||i==null||i.__b>0?i:OP(i)?i.map(Ule):i.constructor!==void 0?null:zf({},i)}function n6e(i,e,t,n,r,s,o,a,l){var c,u,f,d,A,y,w,S=t.props||NP,T=e.props,R=e.type;if(R=="svg"?r="http://www.w3.org/2000/svg":R=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),s!=null){for(c=0;c<s.length;c++)if((A=s[c])&&"setAttribute"in A==!!R&&(R?A.localName==R:A.nodeType==3)){i=A,s[c]=null;break}}if(i==null){if(R==null)return document.createTextNode(T);i=document.createElementNS(r,R,T.is&&T),a&&(Gr.__m&&Gr.__m(e,s),a=!1),s=null}if(R==null)S===T||a&&i.data==T||(i.data=T);else{if(s=R=="textarea"&&T.defaultValue!=null?null:s&&KS.call(i.childNodes),!a&&s!=null)for(S={},c=0;c<i.attributes.length;c++)S[(A=i.attributes[c]).name]=A.value;for(c in S)A=S[c],c=="dangerouslySetInnerHTML"?f=A:c=="children"||c in T||c=="value"&&"defaultValue"in T||c=="checked"&&"defaultChecked"in T||PP(i,c,null,A,r);for(c in T)A=T[c],c=="children"?d=A:c=="dangerouslySetInnerHTML"?u=A:c=="value"?y=A:c=="checked"?w=A:a&&typeof A!="function"||S[c]===A||PP(i,c,A,S[c],r);if(u)a||f&&(u.__html==f.__html||u.__html==i.innerHTML)||(i.innerHTML=u.__html),e.__k=[];else if(f&&(i.innerHTML=""),Nle(e.type=="template"?i.content:i,OP(d)?d:[d],e,t,n,R=="foreignObject"?"http://www.w3.org/1999/xhtml":r,s,o,s?s[0]:t.__k&&v1(t,0),a,l),s!=null)for(c=s.length;c--;)yG(s[c]);a&&R!="textarea"||(c="value",R=="progress"&&y==null?i.removeAttribute("value"):y!=null&&(y!==i[c]||R=="progress"&&!y||R=="option"&&y!=S[c])&&PP(i,c,y,S[c],r),c="checked",w!=null&&w!=i[c]&&PP(i,c,w,S[c],r))}return i}function wG(i,e,t){try{if(typeof i=="function"){var n=typeof i.__u=="function";n&&i.__u(),n&&e==null||(i.__u=i(e))}else i.current=e}catch(r){Gr.__e(r,t)}}function kle(i,e,t){var n,r;if(Gr.unmount&&Gr.unmount(i),(n=i.ref)&&(n.current&&n.current!=i.__e||wG(n,null,e)),(n=i.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){Gr.__e(s,e)}n.base=n.__P=n.__n=null}if(n=i.__k)for(r=0;r<n.length;r++)n[r]&&kle(n[r],e,t||typeof i.type!="function");t||yG(i.__e),i.__c=i.__=i.__e=void 0}function i6e(i,e,t){return this.constructor(i,t)}function zle(i,e,t){var n,r,s,o;e==document&&(e=document.documentElement),Gr.__&&Gr.__(i,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,s=[],o=[],bG(e,i=(!n&&t||e).__k=Q5e(UP,null,[i]),r||NP,NP,e.namespaceURI,!n&&t?[t]:r?null:e.firstChild?KS.call(e.childNodes):null,s,!n&&t?t:r?r.__e:e.firstChild,n,o),Ole(s,i,o),i.props.children=null}function SG(i,e,t){var n,r,s,o,a=zf({},i.props);for(s in i.type&&i.type.defaultProps&&(o=i.type.defaultProps),e)s=="key"?n=e[s]:s=="ref"?r=e[s]:a[s]=e[s]===void 0&&o!=null?o[s]:e[s];return arguments.length>2&&(a.children=arguments.length>3?KS.call(arguments,2):t),ZS(i.type,a,n||i.key,r||i.ref,null)}KS=FP.slice,Gr={__e:function(i,e,t,n){for(var r,s,o;e=e.__;)if((r=e.__c)&&!r.__)try{if((s=r.constructor)&&s.getDerivedStateFromError!=null&&(r.setState(s.getDerivedStateFromError(i)),o=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(i,n||{}),o=r.__d),o)return r.__E=r}catch(a){i=a}throw i}},Rle=0,_G=function(i){return i!=null&&i.constructor===void 0},DP.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=zf({},this.state),typeof i=="function"&&(i=i(zf({},t),this.props)),i&&zf(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),Ele(this))},DP.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),Ele(this))},DP.prototype.render=UP,Bm=[],Ile=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ple=function(i,e){return i.__v.__b-e.__v.__b},BP.__r=0,AG=Math.random().toString(8),LP="__d"+AG,YS="__a"+AG,Lle=/(PointerCapture)$|Capture$/i,xG=0,gG=Cle(!1),vG=Cle(!0),Z5e=0;function Vle(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function r6e(i){if(Array.isArray(i))return i}function s6e(i,e,t){return(e=h6e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function o6e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function a6e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5259-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gle(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function l6e(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Gle(Object(t),!0).forEach(function(n){s6e(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Gle(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function c6e(i,e){return r6e(i)||o6e(i,e)||f6e(i,e)||a6e()}function u6e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function h6e(i){var e=u6e(i,"string");return typeof e=="symbol"?e:e+""}function kP(i){"@babel/helpers - typeof";return kP=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},kP(i)}function f6e(i,e){if(i){if(typeof i=="string")return Vle(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Vle(i,e):void 0}}var TG=function(e){if(kP(e)!=="object")return e;var t=SG(e);if(t.props){var n;t.props=l6e({},t.props),t!=null&&(n=t.props)!==null&&n!==void 0&&n.children&&(t.props.children=Array.isArray(t.props.children)?t.props.children.map(TG):TG(t.props.children))}return t},d6e=function(e){return _G(SG(e))},p6e=function(e,t){delete t.__k,zle(TG(e),t)};function m6e(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var A6e=`.float-tooltip-kap {5258+ }`};var ip=class{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}},fNe=new Du(-1,1,1,-1,0,1),iG=class extends Xn{constructor(){super(),this.setAttribute("position",new Ln([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Ln([0,2,0,0,2,0],2))}},dNe=new iG,uI=class{constructor(e){this._mesh=new Hn(dNe,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,fNe)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}};var hI=class extends ip{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof ds?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=dg.clone(e.uniforms),this.material=new ds({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this._fsQuad=new uI(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this._fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}};var qS=class extends ip{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){let r=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let o,a;this.inverse?(o=0,a=1):(o=1,a=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),s.buffers.stencil.setFunc(r.ALWAYS,o,4294967295),s.buffers.stencil.setClear(a),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(r.EQUAL,1,4294967295),s.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),s.buffers.stencil.setLocked(!0)}},fI=class extends ip{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}};var dI=class{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){let n=e.getSize(new Oe);this._width=n.width,this._height=n.height,t=new Oa(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Wi}),t.texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new hI(xae),this.copyPass.material.blending=ps,this.timer=new eg}swapBuffers(){let e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){let t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){this.timer.update(),e===void 0&&(e=this.timer.getDelta());let t=this.renderer.getRenderTarget(),n=!1;for(let r=0,s=this.passes.length;r<s;r++){let o=this.passes[r];if(o.enabled!==!1){if(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(r),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),o.needsSwap){if(n){let a=this.renderer.getContext(),l=this.renderer.state.buffers.stencil;l.setFunc(a.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),l.setFunc(a.EQUAL,1,4294967295)}this.swapBuffers()}qS!==void 0&&(o instanceof qS?n=!0:o instanceof fI&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){let t=this.renderer.getSize(new Oe);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;let n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(let s=0;s<this.passes.length;s++)this.passes[s].setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}};var pI=class extends ip{constructor(e,t,n=null,r=null,s=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=s,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.isRenderPass=!0,this._oldClearColor=new zt}render(e,t,n){let r=e.autoClear;e.autoClear=!1;let s,o;this.overrideMaterial!==null&&(o=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),this.clearAlpha!==null&&(s=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),this.clearDepth==!0&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear===!0&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor!==null&&e.setClearColor(this._oldClearColor),this.clearAlpha!==null&&e.setClearAlpha(s),this.overrideMaterial!==null&&(this.scene.overrideMaterial=o),e.autoClear=r}};function il(){return il=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},il.apply(null,arguments)}function yae(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Im(i,e){return Im=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Im(i,e)}function bae(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,Im(i,e)}function mI(i){return mI=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},mI(i)}function wae(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function rG(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rG=function(){return!!i})()}function Sae(i,e,t){if(rG())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&Im(r,t.prototype),r}function AI(i){var e=typeof Map=="function"?new Map:void 0;return AI=function(n){if(n===null||!wae(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(n))return e.get(n);e.set(n,r)}function r(){return Sae(n,arguments,mI(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Im(r,n)},AI(i)}var Nl=(function(i){bae(e,i);function e(t){var n;if(1)n=i.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+t+" for more information.")||this;else for(var r,s,o;o<r;o++);return yae(n)}return e})(AI(Error));function Tae(i,e){return i.substr(-e.length)===e}var pNe=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;function Eae(i){if(typeof i!="string")return i;var e=i.match(pNe);return e?parseFloat(i):i}var mNe=function(e){return function(t,n){n===void 0&&(n="16px");var r=t,s=n;if(typeof t=="string"){if(!Tae(t,"px"))throw new Nl(69,e,t);r=Eae(t)}if(typeof n=="string"){if(!Tae(n,"px"))throw new Nl(70,e,n);s=Eae(n)}if(typeof r=="string")throw new Nl(71,t,e);if(typeof s=="string")throw new Nl(72,n,e);return""+r/s+e}},Cae=mNe,k_t=Cae("em");var z_t=Cae("rem");function sG(i){return Math.round(i*255)}function ANe(i,e,t){return sG(i)+","+sG(e)+","+sG(t)}function HS(i,e,t,n){if(n===void 0&&(n=ANe),e===0)return n(t,t,t);var r=(i%360+360)%360/60,s=(1-Math.abs(2*t-1))*e,o=s*(1-Math.abs(r%2-1)),a=0,l=0,c=0;r>=0&&r<1?(a=s,l=o):r>=1&&r<2?(a=o,l=s):r>=2&&r<3?(l=s,c=o):r>=3&&r<4?(l=o,c=s):r>=4&&r<5?(a=o,c=s):r>=5&&r<6&&(a=s,c=o);var u=t-s/2,f=a+u,d=l+u,A=c+u;return n(f,d,A)}var Mae={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};function gNe(i){if(typeof i!="string")return i;var e=i.toLowerCase();return Mae[e]?"#"+Mae[e]:i}var vNe=/^#[a-fA-F0-9]{6}$/,_Ne=/^#[a-fA-F0-9]{8}$/,xNe=/^#[a-fA-F0-9]{3}$/,yNe=/^#[a-fA-F0-9]{4}$/,oG=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,bNe=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,wNe=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,SNe=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function Lm(i){if(typeof i!="string")throw new Nl(3);var e=gNe(i);if(e.match(vNe))return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16)};if(e.match(_Ne)){var t=parseFloat((parseInt(""+e[7]+e[8],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16),alpha:t}}if(e.match(xNe))return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16)};if(e.match(yNe)){var n=parseFloat((parseInt(""+e[4]+e[4],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16),alpha:n}}var r=oG.exec(e);if(r)return{red:parseInt(""+r[1],10),green:parseInt(""+r[2],10),blue:parseInt(""+r[3],10)};var s=bNe.exec(e.substring(0,50));if(s)return{red:parseInt(""+s[1],10),green:parseInt(""+s[2],10),blue:parseInt(""+s[3],10),alpha:parseFloat(""+s[4])>1?parseFloat(""+s[4])/100:parseFloat(""+s[4])};var o=wNe.exec(e);if(o){var a=parseInt(""+o[1],10),l=parseInt(""+o[2],10)/100,c=parseInt(""+o[3],10)/100,u="rgb("+HS(a,l,c)+")",f=oG.exec(u);if(!f)throw new Nl(4,e,u);return{red:parseInt(""+f[1],10),green:parseInt(""+f[2],10),blue:parseInt(""+f[3],10)}}var d=SNe.exec(e.substring(0,50));if(d){var A=parseInt(""+d[1],10),y=parseInt(""+d[2],10)/100,w=parseInt(""+d[3],10)/100,S="rgb("+HS(A,y,w)+")",T=oG.exec(S);if(!T)throw new Nl(4,e,S);return{red:parseInt(""+T[1],10),green:parseInt(""+T[2],10),blue:parseInt(""+T[3],10),alpha:parseFloat(""+d[4])>1?parseFloat(""+d[4])/100:parseFloat(""+d[4])}}throw new Nl(5)}function TNe(i){var e=i.red/255,t=i.green/255,n=i.blue/255,r=Math.max(e,t,n),s=Math.min(e,t,n),o=(r+s)/2;if(r===s)return i.alpha!==void 0?{hue:0,saturation:0,lightness:o,alpha:i.alpha}:{hue:0,saturation:0,lightness:o};var a,l=r-s,c=o>.5?l/(2-r-s):l/(r+s);switch(r){case e:a=(t-n)/l+(t<n?6:0);break;case t:a=(n-e)/l+2;break;default:a=(e-t)/l+4;break}return a*=60,i.alpha!==void 0?{hue:a,saturation:c,lightness:o,alpha:i.alpha}:{hue:a,saturation:c,lightness:o}}function Dm(i){return TNe(Lm(i))}var ENe=function(e){return e.length===7&&e[1]===e[2]&&e[3]===e[4]&&e[5]===e[6]?"#"+e[1]+e[3]+e[5]:e},lG=ENe;function A1(i){var e=i.toString(16);return e.length===1?"0"+e:e}function aG(i){return A1(Math.round(i*255))}function MNe(i,e,t){return lG("#"+aG(i)+aG(e)+aG(t))}function gI(i,e,t){return HS(i,e,t,MNe)}function CNe(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return gI(i,e,t);if(typeof i=="object"&&e===void 0&&t===void 0)return gI(i.hue,i.saturation,i.lightness);throw new Nl(1)}function RNe(i,e,t,n){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?gI(i,e,t):"rgba("+HS(i,e,t)+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?gI(i.hue,i.saturation,i.lightness):"rgba("+HS(i.hue,i.saturation,i.lightness)+","+i.alpha+")";throw new Nl(2)}function cG(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return lG("#"+A1(i)+A1(e)+A1(t));if(typeof i=="object"&&e===void 0&&t===void 0)return lG("#"+A1(i.red)+A1(i.green)+A1(i.blue));throw new Nl(6)}function vI(i,e,t,n){if(typeof i=="string"&&typeof e=="number"){var r=Lm(i);return"rgba("+r.red+","+r.green+","+r.blue+","+e+")"}else{if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?cG(i,e,t):"rgba("+i+","+e+","+t+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?cG(i.red,i.green,i.blue):"rgba("+i.red+","+i.green+","+i.blue+","+i.alpha+")"}throw new Nl(7)}var PNe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},INe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&typeof e.alpha=="number"},LNe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},DNe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&typeof e.alpha=="number"};function Nm(i){if(typeof i!="object")throw new Nl(8);if(INe(i))return vI(i);if(PNe(i))return cG(i);if(DNe(i))return RNe(i);if(LNe(i))return CNe(i);throw new Nl(8)}function Rae(i,e,t){return function(){var r=t.concat(Array.prototype.slice.call(arguments));return r.length>=e?i.apply(this,r):Rae(i,e,r)}}function gc(i){return Rae(i,i.length,[])}function NNe(i,e){if(e==="transparent")return e;var t=Dm(e);return Nm(il({},t,{hue:t.hue+parseFloat(i)}))}var V_t=gc(NNe);function Nx(i,e,t){return Math.max(i,Math.min(e,t))}function FNe(i,e){if(e==="transparent")return e;var t=Dm(e);return Nm(il({},t,{lightness:Nx(0,1,t.lightness-parseFloat(i))}))}var G_t=gc(FNe);function BNe(i,e){if(e==="transparent")return e;var t=Dm(e);return Nm(il({},t,{saturation:Nx(0,1,t.saturation-parseFloat(i))}))}var q_t=gc(BNe);function ONe(i,e){if(e==="transparent")return e;var t=Dm(e);return Nm(il({},t,{lightness:Nx(0,1,t.lightness+parseFloat(i))}))}var H_t=gc(ONe);function UNe(i,e,t){if(e==="transparent")return t;if(t==="transparent")return e;if(i===0)return t;var n=Lm(e),r=il({},n,{alpha:typeof n.alpha=="number"?n.alpha:1}),s=Lm(t),o=il({},s,{alpha:typeof s.alpha=="number"?s.alpha:1}),a=r.alpha-o.alpha,l=parseFloat(i)*2-1,c=l*a===-1?l:l+a,u=1+l*a,f=(c/u+1)/2,d=1-f,A={red:Math.floor(r.red*f+o.red*d),green:Math.floor(r.green*f+o.green*d),blue:Math.floor(r.blue*f+o.blue*d),alpha:r.alpha*parseFloat(i)+o.alpha*(1-parseFloat(i))};return vI(A)}var kNe=gc(UNe),Pae=kNe;function zNe(i,e){if(e==="transparent")return e;var t=Lm(e),n=typeof t.alpha=="number"?t.alpha:1,r=il({},t,{alpha:Nx(0,1,(n*100+parseFloat(i)*100)/100)});return vI(r)}var VNe=gc(zNe),Iae=VNe;function GNe(i,e){if(e==="transparent")return e;var t=Dm(e);return Nm(il({},t,{saturation:Nx(0,1,t.saturation+parseFloat(i))}))}var W_t=gc(GNe);function qNe(i,e){return e==="transparent"?e:Nm(il({},Dm(e),{hue:parseFloat(i)}))}var j_t=gc(qNe);function HNe(i,e){return e==="transparent"?e:Nm(il({},Dm(e),{lightness:parseFloat(i)}))}var X_t=gc(HNe);function WNe(i,e){return e==="transparent"?e:Nm(il({},Dm(e),{saturation:parseFloat(i)}))}var $_t=gc(WNe);function jNe(i,e){return e==="transparent"?e:Pae(parseFloat(i),"rgb(0, 0, 0)",e)}var Y_t=gc(jNe);function XNe(i,e){return e==="transparent"?e:Pae(parseFloat(i),"rgb(255, 255, 255)",e)}var Z_t=gc(XNe);function $Ne(i,e){if(e==="transparent")return e;var t=Lm(e),n=typeof t.alpha=="number"?t.alpha:1,r=il({},t,{alpha:Nx(0,1,+(n*100-parseFloat(i)*100).toFixed(2)/100)});return vI(r)}var K_t=gc($Ne);var _I="http://www.w3.org/1999/xhtml",uG={svg:"http://www.w3.org/2000/svg",xhtml:_I,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function xI(i){var e=i+="",t=e.indexOf(":");return t>=0&&(e=i.slice(0,t))!=="xmlns"&&(i=i.slice(t+1)),uG.hasOwnProperty(e)?{space:uG[e],local:i}:i}function YNe(i){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===_I&&e.documentElement.namespaceURI===_I?e.createElement(i):e.createElementNS(t,i)}}function ZNe(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function yI(i){var e=xI(i);return(e.local?ZNe:YNe)(e)}function KNe(){}function bI(i){return i==null?KNe:function(){return this.querySelector(i)}}function Lae(i){typeof i!="function"&&(i=bI(i));for(var e=this._groups,t=e.length,n=new Array(t),r=0;r<t;++r)for(var s=e[r],o=s.length,a=n[r]=new Array(o),l,c,u=0;u<o;++u)(l=s[u])&&(c=i.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new ys(n,this._parents)}function hG(i){return i==null?[]:Array.isArray(i)?i:Array.from(i)}function QNe(){return[]}function Dae(i){return i==null?QNe:function(){return this.querySelectorAll(i)}}function JNe(i){return function(){return hG(i.apply(this,arguments))}}function Nae(i){typeof i=="function"?i=JNe(i):i=Dae(i);for(var e=this._groups,t=e.length,n=[],r=[],s=0;s<t;++s)for(var o=e[s],a=o.length,l,c=0;c<a;++c)(l=o[c])&&(n.push(i.call(l,l.__data__,c,o)),r.push(l));return new ys(n,r)}function Fae(i){return function(){return this.matches(i)}}function wI(i){return function(e){return e.matches(i)}}var e5e=Array.prototype.find;function t5e(i){return function(){return e5e.call(this.children,i)}}function n5e(){return this.firstElementChild}function Bae(i){return this.select(i==null?n5e:t5e(typeof i=="function"?i:wI(i)))}var i5e=Array.prototype.filter;function r5e(){return Array.from(this.children)}function s5e(i){return function(){return i5e.call(this.children,i)}}function Oae(i){return this.selectAll(i==null?r5e:s5e(typeof i=="function"?i:wI(i)))}function Uae(i){typeof i!="function"&&(i=Fae(i));for(var e=this._groups,t=e.length,n=new Array(t),r=0;r<t;++r)for(var s=e[r],o=s.length,a=n[r]=[],l,c=0;c<o;++c)(l=s[c])&&i.call(l,l.__data__,c,s)&&a.push(l);return new ys(n,this._parents)}function SI(i){return new Array(i.length)}function kae(){return new ys(this._enter||this._groups.map(SI),this._parents)}function WS(i,e){this.ownerDocument=i.ownerDocument,this.namespaceURI=i.namespaceURI,this._next=null,this._parent=i,this.__data__=e}WS.prototype={constructor:WS,appendChild:function(i){return this._parent.insertBefore(i,this._next)},insertBefore:function(i,e){return this._parent.insertBefore(i,e)},querySelector:function(i){return this._parent.querySelector(i)},querySelectorAll:function(i){return this._parent.querySelectorAll(i)}};function zae(i){return function(){return i}}function o5e(i,e,t,n,r,s){for(var o=0,a,l=e.length,c=s.length;o<c;++o)(a=e[o])?(a.__data__=s[o],n[o]=a):t[o]=new WS(i,s[o]);for(;o<l;++o)(a=e[o])&&(r[o]=a)}function a5e(i,e,t,n,r,s,o){var a,l,c=new Map,u=e.length,f=s.length,d=new Array(u),A;for(a=0;a<u;++a)(l=e[a])&&(d[a]=A=o.call(l,l.__data__,a,e)+"",c.has(A)?r[a]=l:c.set(A,l));for(a=0;a<f;++a)A=o.call(i,s[a],a,s)+"",(l=c.get(A))?(n[a]=l,l.__data__=s[a],c.delete(A)):t[a]=new WS(i,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(d[a])===l&&(r[a]=l)}function l5e(i){return i.__data__}function Vae(i,e){if(!arguments.length)return Array.from(this,l5e);var t=e?a5e:o5e,n=this._parents,r=this._groups;typeof i!="function"&&(i=zae(i));for(var s=r.length,o=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=n[c],f=r[c],d=f.length,A=c5e(i.call(u,u&&u.__data__,c,n)),y=A.length,w=a[c]=new Array(y),S=o[c]=new Array(y),T=l[c]=new Array(d);t(u,f,w,S,T,A,e);for(var R=0,I=0,P,F;R<y;++R)if(P=w[R]){for(R>=I&&(I=R+1);!(F=S[I])&&++I<y;);P._next=F||null}}return o=new ys(o,n),o._enter=a,o._exit=l,o}function c5e(i){return typeof i=="object"&&"length"in i?i:Array.from(i)}function Gae(){return new ys(this._exit||this._groups.map(SI),this._parents)}function qae(i,e,t){var n=this.enter(),r=this,s=this.exit();return typeof i=="function"?(n=i(n),n&&(n=n.selection())):n=n.append(i+""),e!=null&&(r=e(r),r&&(r=r.selection())),t==null?s.remove():t(s),n&&r?n.merge(r).order():r}function Hae(i){for(var e=i.selection?i.selection():i,t=this._groups,n=e._groups,r=t.length,s=n.length,o=Math.min(r,s),a=new Array(r),l=0;l<o;++l)for(var c=t[l],u=n[l],f=c.length,d=a[l]=new Array(f),A,y=0;y<f;++y)(A=c[y]||u[y])&&(d[y]=A);for(;l<r;++l)a[l]=t[l];return new ys(a,this._parents)}function Wae(){for(var i=this._groups,e=-1,t=i.length;++e<t;)for(var n=i[e],r=n.length-1,s=n[r],o;--r>=0;)(o=n[r])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function jae(i){i||(i=u5e);function e(f,d){return f&&d?i(f.__data__,d.__data__):!f-!d}for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s){for(var o=t[s],a=o.length,l=r[s]=new Array(a),c,u=0;u<a;++u)(c=o[u])&&(l[u]=c);l.sort(e)}return new ys(r,this._parents).order()}function u5e(i,e){return i<e?-1:i>e?1:i>=e?0:NaN}function Xae(){var i=arguments[0];return arguments[0]=this,i.apply(null,arguments),this}function $ae(){return Array.from(this)}function Yae(){for(var i=this._groups,e=0,t=i.length;e<t;++e)for(var n=i[e],r=0,s=n.length;r<s;++r){var o=n[r];if(o)return o}return null}function Zae(){let i=0;for(let e of this)++i;return i}function Kae(){return!this.node()}function Qae(i){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,o=r.length,a;s<o;++s)(a=r[s])&&i.call(a,a.__data__,s,r);return this}function h5e(i){return function(){this.removeAttribute(i)}}function f5e(i){return function(){this.removeAttributeNS(i.space,i.local)}}function d5e(i,e){return function(){this.setAttribute(i,e)}}function p5e(i,e){return function(){this.setAttributeNS(i.space,i.local,e)}}function m5e(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttribute(i):this.setAttribute(i,t)}}function A5e(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttributeNS(i.space,i.local):this.setAttributeNS(i.space,i.local,t)}}function Jae(i,e){var t=xI(i);if(arguments.length<2){var n=this.node();return t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}return this.each((e==null?t.local?f5e:h5e:typeof e=="function"?t.local?A5e:m5e:t.local?p5e:d5e)(t,e))}function TI(i){return i.ownerDocument&&i.ownerDocument.defaultView||i.document&&i||i.defaultView}function g5e(i){return function(){this.style.removeProperty(i)}}function v5e(i,e,t){return function(){this.style.setProperty(i,e,t)}}function _5e(i,e,t){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(i):this.style.setProperty(i,n,t)}}function ele(i,e,t){return arguments.length>1?this.each((e==null?g5e:typeof e=="function"?_5e:v5e)(i,e,t??"")):x5e(this.node(),i)}function x5e(i,e){return i.style.getPropertyValue(e)||TI(i).getComputedStyle(i,null).getPropertyValue(e)}function y5e(i){return function(){delete this[i]}}function b5e(i,e){return function(){this[i]=e}}function w5e(i,e){return function(){var t=e.apply(this,arguments);t==null?delete this[i]:this[i]=t}}function tle(i,e){return arguments.length>1?this.each((e==null?y5e:typeof e=="function"?w5e:b5e)(i,e)):this.node()[i]}function nle(i){return i.trim().split(/^|\s+/)}function fG(i){return i.classList||new ile(i)}function ile(i){this._node=i,this._names=nle(i.getAttribute("class")||"")}ile.prototype={add:function(i){var e=this._names.indexOf(i);e<0&&(this._names.push(i),this._node.setAttribute("class",this._names.join(" ")))},remove:function(i){var e=this._names.indexOf(i);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(i){return this._names.indexOf(i)>=0}};function rle(i,e){for(var t=fG(i),n=-1,r=e.length;++n<r;)t.add(e[n])}function sle(i,e){for(var t=fG(i),n=-1,r=e.length;++n<r;)t.remove(e[n])}function S5e(i){return function(){rle(this,i)}}function T5e(i){return function(){sle(this,i)}}function E5e(i,e){return function(){(e.apply(this,arguments)?rle:sle)(this,i)}}function ole(i,e){var t=nle(i+"");if(arguments.length<2){for(var n=fG(this.node()),r=-1,s=t.length;++r<s;)if(!n.contains(t[r]))return!1;return!0}return this.each((typeof e=="function"?E5e:e?S5e:T5e)(t,e))}function M5e(){this.textContent=""}function C5e(i){return function(){this.textContent=i}}function R5e(i){return function(){var e=i.apply(this,arguments);this.textContent=e??""}}function ale(i){return arguments.length?this.each(i==null?M5e:(typeof i=="function"?R5e:C5e)(i)):this.node().textContent}function P5e(){this.innerHTML=""}function I5e(i){return function(){this.innerHTML=i}}function L5e(i){return function(){var e=i.apply(this,arguments);this.innerHTML=e??""}}function lle(i){return arguments.length?this.each(i==null?P5e:(typeof i=="function"?L5e:I5e)(i)):this.node().innerHTML}function D5e(){this.nextSibling&&this.parentNode.appendChild(this)}function cle(){return this.each(D5e)}function N5e(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ule(){return this.each(N5e)}function hle(i){var e=typeof i=="function"?i:yI(i);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function F5e(){return null}function fle(i,e){var t=typeof i=="function"?i:yI(i),n=e==null?F5e:typeof e=="function"?e:bI(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)})}function B5e(){var i=this.parentNode;i&&i.removeChild(this)}function dle(){return this.each(B5e)}function O5e(){var i=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function U5e(){var i=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function ple(i){return this.select(i?U5e:O5e)}function mle(i){return arguments.length?this.property("__data__",i):this.node().__data__}function k5e(i){return function(e){i.call(this,e,this.__data__)}}function z5e(i){return i.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function V5e(i){return function(){var e=this.__on;if(e){for(var t=0,n=-1,r=e.length,s;t<r;++t)s=e[t],(!i.type||s.type===i.type)&&s.name===i.name?this.removeEventListener(s.type,s.listener,s.options):e[++n]=s;++n?e.length=n:delete this.__on}}}function G5e(i,e,t){return function(){var n=this.__on,r,s=k5e(e);if(n){for(var o=0,a=n.length;o<a;++o)if((r=n[o]).type===i.type&&r.name===i.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=t),r.value=e;return}}this.addEventListener(i.type,s,t),r={type:i.type,name:i.name,value:e,listener:s,options:t},n?n.push(r):this.__on=[r]}}function Ale(i,e,t){var n=z5e(i+""),r,s=n.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<s;++r)if((o=n[r]).type===u.type&&o.name===u.name)return u.value}return}for(a=e?G5e:V5e,r=0;r<s;++r)this.each(a(n[r],e,t));return this}function gle(i,e,t){var n=TI(i),r=n.CustomEvent;typeof r=="function"?r=new r(e,t):(r=n.document.createEvent("Event"),t?(r.initEvent(e,t.bubbles,t.cancelable),r.detail=t.detail):r.initEvent(e,!1,!1)),i.dispatchEvent(r)}function q5e(i,e){return function(){return gle(this,i,e)}}function H5e(i,e){return function(){return gle(this,i,e.apply(this,arguments))}}function vle(i,e){return this.each((typeof e=="function"?H5e:q5e)(i,e))}function*_le(){for(var i=this._groups,e=0,t=i.length;e<t;++e)for(var n=i[e],r=0,s=n.length,o;r<s;++r)(o=n[r])&&(yield o)}var dG=[null];function ys(i,e){this._groups=i,this._parents=e}function W5e(){return new ys([[document.documentElement]],dG)}function j5e(){return this}ys.prototype=W5e.prototype={constructor:ys,select:Lae,selectAll:Nae,selectChild:Bae,selectChildren:Oae,filter:Uae,data:Vae,enter:kae,exit:Gae,join:qae,merge:Hae,selection:j5e,order:Wae,sort:jae,call:Xae,nodes:$ae,node:Yae,size:Zae,empty:Kae,each:Qae,attr:Jae,style:ele,property:tle,classed:ole,text:ale,html:lle,raise:cle,lower:ule,append:hle,insert:fle,remove:dle,clone:ple,datum:mle,on:Ale,dispatch:vle,[Symbol.iterator]:_le};function pG(i){return typeof i=="string"?new ys([[document.querySelector(i)]],[document.documentElement]):new ys([[i]],dG)}function xle(i){let e;for(;e=i.sourceEvent;)i=e;return i}function mG(i,e){if(i=xle(i),e===void 0&&(e=i.currentTarget),e){var t=e.ownerSVGElement||e;if(t.createSVGPoint){var n=t.createSVGPoint();return n.x=i.clientX,n.y=i.clientY,n=n.matrixTransform(e.getScreenCTM().inverse()),[n.x,n.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[i.clientX-r.left-e.clientLeft,i.clientY-r.top-e.clientTop]}}return[i.pageX,i.pageY]}var $S,Vr,Tle,_G,Fm,yle,Ele,Mle,AG,MI,jS,Cle,xG,gG,vG,X5e,RI={},PI=[],$5e=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,LI=Array.isArray;function Bf(i,e){for(var t in e)i[t]=e[t];return i}function yG(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function Y5e(i,e,t){var n,r,s,o={};for(s in e)s=="key"?n=e[s]:s=="ref"?r=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?$S.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(s in i.defaultProps)o[s]===void 0&&(o[s]=i.defaultProps[s]);return XS(i,o,n,r,null)}function XS(i,e,t,n,r){var s={type:i,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Tle,__i:-1,__u:0};return r==null&&Vr.vnode!=null&&Vr.vnode(s),s}function DI(i){return i.children}function CI(i,e){this.props=i,this.context=e}function g1(i,e){if(e==null)return i.__?g1(i.__,i.__i+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?g1(i):null}function Z5e(i){if(i.__P&&i.__d){var e=i.__v,t=e.__e,n=[],r=[],s=Bf({},e);s.__v=e.__v+1,Vr.vnode&&Vr.vnode(s),bG(i.__P,s,e,i.__n,i.__P.namespaceURI,32&e.__u?[t]:null,n,t??g1(e),!!(32&e.__u),r),s.__v=e.__v,s.__.__k[s.__i]=s,Dle(n,s,r),e.__e=e.__=null,s.__e!=t&&Rle(s)}}function Rle(i){if((i=i.__)!=null&&i.__c!=null)return i.__e=i.__c.base=null,i.__k.some(function(e){if(e!=null&&e.__e!=null)return i.__e=i.__c.base=e.__e}),Rle(i)}function ble(i){(!i.__d&&(i.__d=!0)&&Fm.push(i)&&!II.__r++||yle!=Vr.debounceRendering)&&((yle=Vr.debounceRendering)||Ele)(II)}function II(){try{for(var i,e=1;Fm.length;)Fm.length>e&&Fm.sort(Mle),i=Fm.shift(),e=Fm.length,Z5e(i)}finally{Fm.length=II.__r=0}}function Ple(i,e,t,n,r,s,o,a,l,c,u){var f,d,A,y,w,S,T=n&&n.__k||PI,R=e.length;for(l=K5e(t,e,T,l,R),f=0;f<R;f++)(A=t.__k[f])!=null&&(d=A.__i!=-1&&T[A.__i]||RI,A.__i=f,S=bG(i,A,d,r,s,o,a,l,c,u),y=A.__e,A.ref&&d.ref!=A.ref&&(d.ref&&wG(d.ref,null,A),u.push(A.ref,A.__c||y,A)),w==null&&y!=null&&(w=y),4&A.__u?(l=Ile(A,l,i),d.__e&&(d.__e=null)):typeof A.type=="function"&&S!==void 0?l=S:y&&(l=y.nextSibling),A.__u&=-7);return t.__e=w,l}function K5e(i,e,t,n,r){var s,o,a,l,c,u=t.length,f=u,d=0;for(i.__k=new Array(r),s=0;s<r;s++)(o=e[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=i.__k[s]=XS(null,o,null,null,null):LI(o)?o=i.__k[s]=XS(DI,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[s]=XS(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):i.__k[s]=o,l=s+d,o.__=i,o.__b=i.__b+1,a=null,(c=o.__i=Q5e(o,t,l,f))!=-1&&(f--,(a=t[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(r>u?d--:r<u&&d++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?d--:c==l+1?d++:(c>l?d--:d++,o.__u|=4))):i.__k[s]=null;if(f)for(s=0;s<u;s++)(a=t[s])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=g1(a)),Fle(a,a));return n}function Ile(i,e,t){var n,r;if(typeof i.type=="function"){for(n=i.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=i,e=Ile(n[r],e,t));return e}i.__e!=e&&(e&&i.type&&!e.parentNode&&(e=g1(i)),e=t.insertBefore(i.__e,e||null));do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function Q5e(i,e,t,n){var r,s,o,a=i.key,l=i.type,c=e[t],u=c!=null&&(2&c.__u)==0;if(c===null&&a==null||u&&a==c.key&&l==c.type)return t;if(n>(u?1:0)){for(r=t-1,s=t+1;r>=0||s<e.length;)if((c=e[o=r>=0?r--:s++])!=null&&(2&c.__u)==0&&a==c.key&&l==c.type)return o}return-1}function wle(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||$5e.test(e)?t:t+"px"}function EI(i,e,t,n,r){var s,o;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof n=="string"&&(i.style.cssText=n=""),n)for(e in n)t&&e in t||wle(i.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||wle(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(Cle,"$1")),o=e.toLowerCase(),e=o in i||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+s]=t,t?n?t[jS]=n[jS]:(t[jS]=xG,i.addEventListener(e,s?vG:gG,s)):i.removeEventListener(e,s?vG:gG,s);else{if(r=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function Sle(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e[MI]==null)e[MI]=xG++;else if(e[MI]<t[jS])return;return t(Vr.event?Vr.event(e):e)}}}function bG(i,e,t,n,r,s,o,a,l,c){var u,f,d,A,y,w,S,T,R,I,P,F,D,L,C,B,k=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(l=!!(32&t.__u),s=[a=e.__e=t.__e]),(u=Vr.__b)&&u(e);e:if(typeof k=="function"){f=o.length;try{if(R=e.props,I=k.prototype&&k.prototype.render,P=(u=k.contextType)&&n[u.__c],F=u?P?P.props.value:u.__:n,t.__c?T=(d=e.__c=t.__c).__=d.__E:(I?e.__c=d=new k(R,F):(e.__c=d=new CI(R,F),d.constructor=k,d.render=e6e),P&&P.sub(d),d.state||(d.state={}),d.__n=n,A=d.__d=!0,d.__h=[],d._sb=[]),I&&d.__s==null&&(d.__s=d.state),I&&k.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Bf({},d.__s)),Bf(d.__s,k.getDerivedStateFromProps(R,d.__s))),y=d.props,w=d.state,d.__v=e,A)I&&k.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),I&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(I&&k.getDerivedStateFromProps==null&&R!==y&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(R,F),e.__v==t.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(R,d.__s,F)===!1){e.__v!=t.__v&&(d.props=R,d.state=d.__s,d.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(z){z&&(z.__=e)}),PI.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d),a=g1(t);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(R,d.__s,F),I&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(y,w,S)})}if(d.context=F,d.props=R,d.__P=i,d.__e=!1,D=Vr.__r,L=0,I)d.state=d.__s,d.__d=!1,D&&D(e),u=d.render(d.props,d.state,d.context),PI.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,D&&D(e),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++L<25);d.state=d.__s,d.getChildContext!=null&&(n=Bf(Bf({},n),d.getChildContext())),I&&!A&&d.getSnapshotBeforeUpdate!=null&&(S=d.getSnapshotBeforeUpdate(y,w)),C=u!=null&&u.type===DI&&u.key==null?Nle(u.props.children):u,a=Ple(i,LI(C)?C:[C],e,t,n,r,s,o,a,l,c),d.base=e.__e,e.__u&=-161,d.__h.length&&o.push(d),T&&(d.__E=d.__=null)}catch(z){if(o.length=f,e.__v=null,l||s!=null){if(z.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;s!=null&&(s[s.indexOf(a)]=null),e.__e=a}else if(s!=null)for(B=s.length;B--;)yG(s[B])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),z.then||Lle(e),Vr.__e(z,e,t)}}else s==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=J5e(t.__e,e,t,n,r,s,o,l,c);return(u=Vr.diffed)&&u(e),128&e.__u?void 0:a}function Lle(i){i&&(i.__c&&(i.__c.__e=!0),i.__k&&i.__k.some(Lle))}function Dle(i,e,t){for(var n=0;n<t.length;n++)wG(t[n],t[++n],t[++n]);Vr.__c&&Vr.__c(e,i),i.some(function(r){try{i=r.__h,r.__h=[],i.some(function(s){s.call(r)})}catch(s){Vr.__e(s,r.__v)}})}function Nle(i){return typeof i!="object"||i==null||i.__b>0?i:LI(i)?i.map(Nle):i.constructor!==void 0?null:Bf({},i)}function J5e(i,e,t,n,r,s,o,a,l){var c,u,f,d,A,y,w,S=t.props||RI,T=e.props,R=e.type;if(R=="svg"?r="http://www.w3.org/2000/svg":R=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),s!=null){for(c=0;c<s.length;c++)if((A=s[c])&&"setAttribute"in A==!!R&&(R?A.localName==R:A.nodeType==3)){i=A,s[c]=null;break}}if(i==null){if(R==null)return document.createTextNode(T);i=document.createElementNS(r,R,T.is&&T),a&&(Vr.__m&&Vr.__m(e,s),a=!1),s=null}if(R==null)S===T||a&&i.data==T||(i.data=T);else{if(s=R=="textarea"&&T.defaultValue!=null?null:s&&$S.call(i.childNodes),!a&&s!=null)for(S={},c=0;c<i.attributes.length;c++)S[(A=i.attributes[c]).name]=A.value;for(c in S)A=S[c],c=="dangerouslySetInnerHTML"?f=A:c=="children"||c in T||c=="value"&&"defaultValue"in T||c=="checked"&&"defaultChecked"in T||EI(i,c,null,A,r);for(c in T)A=T[c],c=="children"?d=A:c=="dangerouslySetInnerHTML"?u=A:c=="value"?y=A:c=="checked"?w=A:a&&typeof A!="function"||S[c]===A||EI(i,c,A,S[c],r);if(u)a||f&&(u.__html==f.__html||u.__html==i.innerHTML)||(i.innerHTML=u.__html),e.__k=[];else if(f&&(i.innerHTML=""),Ple(e.type=="template"?i.content:i,LI(d)?d:[d],e,t,n,R=="foreignObject"?"http://www.w3.org/1999/xhtml":r,s,o,s?s[0]:t.__k&&g1(t,0),a,l),s!=null)for(c=s.length;c--;)yG(s[c]);a&&R!="textarea"||(c="value",R=="progress"&&y==null?i.removeAttribute("value"):y!=null&&(y!==i[c]||R=="progress"&&!y||R=="option"&&y!=S[c])&&EI(i,c,y,S[c],r),c="checked",w!=null&&w!=i[c]&&EI(i,c,w,S[c],r))}return i}function wG(i,e,t){try{if(typeof i=="function"){var n=typeof i.__u=="function";n&&i.__u(),n&&e==null||(i.__u=i(e))}else i.current=e}catch(r){Vr.__e(r,t)}}function Fle(i,e,t){var n,r;if(Vr.unmount&&Vr.unmount(i),(n=i.ref)&&(n.current&&n.current!=i.__e||wG(n,null,e)),(n=i.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){Vr.__e(s,e)}n.base=n.__P=n.__n=null}if(n=i.__k)for(r=0;r<n.length;r++)n[r]&&Fle(n[r],e,t||typeof i.type!="function");t||yG(i.__e),i.__c=i.__=i.__e=void 0}function e6e(i,e,t){return this.constructor(i,t)}function Ble(i,e,t){var n,r,s,o;e==document&&(e=document.documentElement),Vr.__&&Vr.__(i,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,s=[],o=[],bG(e,i=(!n&&t||e).__k=Y5e(DI,null,[i]),r||RI,RI,e.namespaceURI,!n&&t?[t]:r?null:e.firstChild?$S.call(e.childNodes):null,s,!n&&t?t:r?r.__e:e.firstChild,n,o),Dle(s,i,o),i.props.children=null}function SG(i,e,t){var n,r,s,o,a=Bf({},i.props);for(s in i.type&&i.type.defaultProps&&(o=i.type.defaultProps),e)s=="key"?n=e[s]:s=="ref"?r=e[s]:a[s]=e[s]===void 0&&o!=null?o[s]:e[s];return arguments.length>2&&(a.children=arguments.length>3?$S.call(arguments,2):t),XS(i.type,a,n||i.key,r||i.ref,null)}$S=PI.slice,Vr={__e:function(i,e,t,n){for(var r,s,o;e=e.__;)if((r=e.__c)&&!r.__)try{if((s=r.constructor)&&s.getDerivedStateFromError!=null&&(r.setState(s.getDerivedStateFromError(i)),o=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(i,n||{}),o=r.__d),o)return r.__E=r}catch(a){i=a}throw i}},Tle=0,_G=function(i){return i!=null&&i.constructor===void 0},CI.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Bf({},this.state),typeof i=="function"&&(i=i(Bf({},t),this.props)),i&&Bf(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),ble(this))},CI.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),ble(this))},CI.prototype.render=DI,Fm=[],Ele=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Mle=function(i,e){return i.__v.__b-e.__v.__b},II.__r=0,AG=Math.random().toString(8),MI="__d"+AG,jS="__a"+AG,Cle=/(PointerCapture)$|Capture$/i,xG=0,gG=Sle(!1),vG=Sle(!0),X5e=0;function Ole(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function t6e(i){if(Array.isArray(i))return i}function n6e(i,e,t){return(e=l6e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function i6e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function r6e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5259+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ule(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function s6e(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ule(Object(t),!0).forEach(function(n){n6e(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Ule(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function o6e(i,e){return t6e(i)||i6e(i,e)||c6e(i,e)||r6e()}function a6e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function l6e(i){var e=a6e(i,"string");return typeof e=="symbol"?e:e+""}function NI(i){"@babel/helpers - typeof";return NI=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},NI(i)}function c6e(i,e){if(i){if(typeof i=="string")return Ole(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ole(i,e):void 0}}var TG=function(e){if(NI(e)!=="object")return e;var t=SG(e);if(t.props){var n;t.props=s6e({},t.props),t!=null&&(n=t.props)!==null&&n!==void 0&&n.children&&(t.props.children=Array.isArray(t.props.children)?t.props.children.map(TG):TG(t.props.children))}return t},u6e=function(e){return _G(SG(e))},h6e=function(e,t){delete t.__k,Ble(TG(e),t)};function f6e(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var d6e=`.float-tooltip-kap {52605260 position: absolute;52615261 width: max-content; /* prevent shrinking near right edge */52625262 max-width: max(50%, 150px);
@@ -5267,7 +5267,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
52675267 background: rgba(0,0,0,0.6);52685268 pointer-events: none;52695269 }5270-`;m6e(A6e);var qle=Qr({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.style,s=r===void 0?{}:r,o=!!e&&kP(e)==="object"&&!!e.node&&typeof e.node=="function",a=pG(o?e.node():e);a.style("position")==="static"&&a.style("position","relative"),t.tooltipEl=a.append("div").attr("class","float-tooltip-kap"),Object.entries(s).forEach(function(c){var u=c6e(c,2),f=u[0],d=u[1];return t.tooltipEl.style(f,d)}),t.tooltipEl.style("left","-10000px").style("display","none");var l="tooltip-".concat(Math.round(Math.random()*1e12));t.mouseInside=!1,a.on("mousemove.".concat(l),function(c){t.mouseInside=!0;var u=mG(c),f=a.node(),d=f.offsetWidth,A=f.offsetHeight,y=[t.offsetX===null||t.offsetX===void 0?"-".concat(u[0]/d*100,"%"):typeof t.offsetX=="number"?"calc(-50% + ".concat(t.offsetX,"px)"):t.offsetX,t.offsetY===null||t.offsetY===void 0?A>130&&A-u[1]<100?"calc(-100% - 6px)":"21px":typeof t.offsetY=="number"?t.offsetY<0?"calc(-100% - ".concat(Math.abs(t.offsetY),"px)"):"".concat(t.offsetY,"px"):t.offsetY];t.tooltipEl.style("left",u[0]+"px").style("top",u[1]+"px").style("transform","translate(".concat(y.join(","),")")),t.content&&t.tooltipEl.style("display","inline")}),a.on("mouseover.".concat(l),function(){t.mouseInside=!0,t.content&&t.tooltipEl.style("display","inline")}),a.on("mouseout.".concat(l),function(){t.mouseInside=!1,t.tooltipEl.style("display","none")})},update:function(e){e.tooltipEl.style("display",e.content&&e.mouseInside?"inline":"none"),e.content?e.content instanceof HTMLElement?(e.tooltipEl.text(""),e.tooltipEl.append(function(){return e.content})):typeof e.content=="string"?e.tooltipEl.html(e.content):d6e(e.content)?(e.tooltipEl.text(""),p6e(e.content,e.tooltipEl.node())):(e.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",e.content,e.content.toString())):e.tooltipEl.text("")}});function g6e(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var v6e=`.scene-nav-info {5270+`;f6e(d6e);var kle=Qr({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.style,s=r===void 0?{}:r,o=!!e&&NI(e)==="object"&&!!e.node&&typeof e.node=="function",a=pG(o?e.node():e);a.style("position")==="static"&&a.style("position","relative"),t.tooltipEl=a.append("div").attr("class","float-tooltip-kap"),Object.entries(s).forEach(function(c){var u=o6e(c,2),f=u[0],d=u[1];return t.tooltipEl.style(f,d)}),t.tooltipEl.style("left","-10000px").style("display","none");var l="tooltip-".concat(Math.round(Math.random()*1e12));t.mouseInside=!1,a.on("mousemove.".concat(l),function(c){t.mouseInside=!0;var u=mG(c),f=a.node(),d=f.offsetWidth,A=f.offsetHeight,y=[t.offsetX===null||t.offsetX===void 0?"-".concat(u[0]/d*100,"%"):typeof t.offsetX=="number"?"calc(-50% + ".concat(t.offsetX,"px)"):t.offsetX,t.offsetY===null||t.offsetY===void 0?A>130&&A-u[1]<100?"calc(-100% - 6px)":"21px":typeof t.offsetY=="number"?t.offsetY<0?"calc(-100% - ".concat(Math.abs(t.offsetY),"px)"):"".concat(t.offsetY,"px"):t.offsetY];t.tooltipEl.style("left",u[0]+"px").style("top",u[1]+"px").style("transform","translate(".concat(y.join(","),")")),t.content&&t.tooltipEl.style("display","inline")}),a.on("mouseover.".concat(l),function(){t.mouseInside=!0,t.content&&t.tooltipEl.style("display","inline")}),a.on("mouseout.".concat(l),function(){t.mouseInside=!1,t.tooltipEl.style("display","none")})},update:function(e){e.tooltipEl.style("display",e.content&&e.mouseInside?"inline":"none"),e.content?e.content instanceof HTMLElement?(e.tooltipEl.text(""),e.tooltipEl.append(function(){return e.content})):typeof e.content=="string"?e.tooltipEl.html(e.content):u6e(e.content)?(e.tooltipEl.text(""),h6e(e.content,e.tooltipEl.node())):(e.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",e.content,e.content.toString())):e.tooltipEl.text("")}});function p6e(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var m6e=`.scene-nav-info {52715271 position: absolute;52725272 bottom: 5px;52735273 width: 100%;
@@ -5282,9 +5282,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
52825282 52835283 .scene-container canvas:focus {52845284 outline: none;5285-}`;g6e(v6e);function EG(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function _6e(i){if(Array.isArray(i))return i}function x6e(i){if(Array.isArray(i))return EG(i)}function y6e(i,e,t){return(e=C6e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function b6e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function w6e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function S6e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5286-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function T6e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5287-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E6e(i,e){return _6e(i)||w6e(i,e)||Hle(i,e)||S6e()}function _1(i){return x6e(i)||b6e(i)||Hle(i)||T6e()}function M6e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function C6e(i){var e=M6e(i,"string");return typeof e=="symbol"?e:e+""}function Hle(i,e){if(i){if(typeof i=="string")return EG(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?EG(i,e):void 0}}var Wle=function(e){e instanceof Array?e.forEach(Wle):(e.map&&e.map.dispose(),e.dispose())},jle=function(e){e.geometry&&e.geometry.dispose(),e.material&&Wle(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(jle)},R6e=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),jle(t)}},qr=window.THREE?window.THREE:{WebGLRenderer:ZM,Scene:o0,PerspectiveCamera:Yr,Raycaster:hb,SRGBColorSpace:Br,TextureLoader:wl,Vector2:Oe,Vector3:re,Box3:ka,Color:zt,Mesh:Hn,SphereGeometry:Va,MeshBasicMaterial:ds,BackSide:mi,Timer:tg},MG=Qr({props:{width:{default:window.innerWidth,onChange:function(e,t,n){isNaN(e)&&(t.width=n)}},height:{default:window.innerHeight,onChange:function(e,t,n){isNaN(e)&&(t.height=n)}},viewOffset:{default:[0,0]},backgroundColor:{default:"#000011"},backgroundImageUrl:{},onBackgroundImageLoaded:{},showNavInfo:{default:!0},skyRadius:{default:5e4},objects:{default:[]},lights:{default:[]},enablePointerInteraction:{default:!0,onChange:function(e,t){t.hoverObj=null,t.tooltip&&t.tooltip.content(null)},triggerUpdate:!1},pointerRaycasterThrottleMs:{default:50,triggerUpdate:!1},lineHoverPrecision:{default:1,triggerUpdate:!1},pointsHoverPrecision:{default:1,triggerUpdate:!1},hoverOrderComparator:{triggerUpdate:!1},hoverFilter:{default:function(){return!0},triggerUpdate:!1},tooltipContent:{triggerUpdate:!1},hoverDuringDrag:{default:!1,triggerUpdate:!1},clickAfterDrag:{default:!1,triggerUpdate:!1},onHover:{default:function(){},triggerUpdate:!1},onClick:{default:function(){},triggerUpdate:!1},onRightClick:{triggerUpdate:!1}},methods:{tick:function(e){if(e.initialised){e.controls.enabled&&e.controls.update&&e.controls.update(Math.min(1,e.timer.update().getDelta())),e.postProcessingComposer?e.postProcessingComposer.render():e.renderer.render(e.scene,e.camera),e.extraRenderers.forEach(function(o){return o.render(e.scene,e.camera)});var t=+new Date;if(e.enablePointerInteraction&&t-e.lastRaycasterCheck>=e.pointerRaycasterThrottleMs){e.lastRaycasterCheck=t;var n=null;if(e.hoverDuringDrag||!e.isPointerDragging){var r=this.intersectingObjects(e.pointerPos.x,e.pointerPos.y);e.hoverOrderComparator&&r.sort(function(o,a){return e.hoverOrderComparator(o.object,a.object)});var s=r.find(function(o){return e.hoverFilter(o.object)})||null;n=s?s.object:null,e.intersection=s||null}n!==e.hoverObj&&(e.onHover(n,e.hoverObj,e.intersection),e.tooltip.content(n&&st(e.tooltipContent)(n,e.intersection)||null),e.hoverObj=n)}e.tweenGroup.update()}return this},getPointerPos:function(e){var t=e.pointerPos,n=t.x,r=t.y;return{x:n,y:r}},cameraPosition:function(e,t,n,r){var s=e.camera;if(t&&e.initialised){var o,a,l=t,c=n||{x:0,y:0,z:0};if((o=e.povPosTween)===null||o===void 0||o.end(),(a=e.povTgtTween)===null||a===void 0||a.end(),!r)d(l),A(c);else{var u=Object.assign({},s.position),f=y();e.tweenGroup.add(e.povPosTween=new uo(u).to(l,r).easing(Jr.Quadratic.Out).onUpdate(d).onComplete(function(){e.povPosTween=void 0,e.tweenGroup.remove(this)}).start()),e.tweenGroup.add(e.povTgtTween=new uo(f).to(c,r/3).easing(Jr.Quadratic.Out).onUpdate(A).onComplete(function(){e.povTgtTween=void 0,e.tweenGroup.remove(this)}).start())}return this}return Object.assign({},s.position,{lookAt:y()});function d(w){var S=w.x,T=w.y,R=w.z;S!==void 0&&(s.position.x=S),T!==void 0&&(s.position.y=T),R!==void 0&&(s.position.z=R)}function A(w){var S=new qr.Vector3(w.x,w.y,w.z);e.controls.enabled&&e.controls.target?e.controls.target=S:s.lookAt(S)}function y(){return Object.assign(new qr.Vector3(0,0,-1e3).applyQuaternion(s.quaternion).add(s.position))}},zoomToFit:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,r=arguments.length,s=new Array(r>3?r-3:0),o=3;o<r;o++)s[o-3]=arguments[o];return this.fitToBbox(this.getBbox.apply(this,s),t,n)},fitToBbox:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:10,s=e.camera;if(t){var o=new qr.Vector3(0,0,0),a=Math.max.apply(Math,_1(Object.entries(t).map(function(A){var y=E6e(A,2),w=y[0],S=y[1];return Math.max.apply(Math,_1(S.map(function(T){return Math.abs(o[w]-T)})))})))*2,l=(1-r*2/e.height)*s.fov,c=a/Math.atan(l*Math.PI/180),u=c/s.aspect,f=Math.max(c,u);if(f>0){var d=o.clone().sub(s.position).normalize().multiplyScalar(-f);this.cameraPosition(d,o,n)}}return this},getBbox:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},n=new qr.Box3(new qr.Vector3(0,0,0),new qr.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(s){return n.expandByObject(s)}),Object.assign.apply(Object,_1(["x","y","z"].map(function(s){return y6e({},s,[n.min[s],n.max[s]])})))):null},getScreenCoords:function(e,t,n,r){var s=new qr.Vector3(t,n,r);return s.project(this.camera()),{x:(s.x+1)*e.width/2,y:-(s.y-1)*e.height/2}},getSceneCoords:function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=new qr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),o=new qr.Raycaster;return o.setFromCamera(s,e.camera),Object.assign({},o.ray.at(r,new qr.Vector3))},intersectingObjects:function(e,t,n){var r=new qr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),s=new qr.Raycaster;return s.params.Line.threshold=e.lineHoverPrecision,s.params.Points.threshold=e.pointsHoverPrecision,s.setFromCamera(r,e.camera),s.intersectObjects(e.objects,!0)},renderer:function(e){return e.renderer},scene:function(e){return e.scene},camera:function(e){return e.camera},postProcessingComposer:function(e){return e.postProcessingComposer},controls:function(e){return e.controls},tbControls:function(e){return e.controls},_destructor:function(e){var t,n,r;R6e(e.scene),(t=e.controls)===null||t===void 0||t.dispose(),(n=e.renderer)===null||n===void 0||n.dispose(),(r=e.postProcessingComposer)===null||r===void 0||r.dispose()}},stateInit:function(){return{scene:new qr.Scene,camera:new qr.PerspectiveCamera,timer:new qr.Timer,tweenGroup:new gg,lastRaycasterCheck:0}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.controlType,s=r===void 0?"trackball":r,o=n.useWebGPU,a=o===void 0?!1:o,l=n.rendererConfig,c=l===void 0?{}:l,u=n.extraRenderers,f=u===void 0?[]:u,d=n.waitForLoadComplete,A=d===void 0?!0:d;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.className="scene-container",t.container.style.position="relative",t.container.appendChild(t.navInfo=document.createElement("div")),t.navInfo.className="scene-nav-info",t.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[s]||"",t.navInfo.style.display=t.showNavInfo?null:"none",t.tooltip=new qle(t.container),t.pointerPos=new qr.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(y){return t.container.addEventListener(y,function(w){if(y==="pointerdown"&&(t.isPointerPressed=!0),!t.isPointerDragging&&w.type==="pointermove"&&(w.pressure>0||t.isPointerPressed)&&(w.pointerType==="mouse"||w.movementX===void 0||[w.movementX,w.movementY].some(function(R){return Math.abs(R)>1}))&&(t.isPointerDragging=!0),t.enablePointerInteraction){var S=T(t.container);t.pointerPos.x=w.pageX-S.left,t.pointerPos.y=w.pageY-S.top}function T(R){var P=R.getBoundingClientRect(),I=window.pageXOffset||document.documentElement.scrollLeft,F=window.pageYOffset||document.documentElement.scrollTop;return{top:P.top+F,left:P.left+I}}},{passive:!0})}),t.container.addEventListener("pointerup",function(y){t.isPointerPressed&&(t.isPointerPressed=!1,!(t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag))&&requestAnimationFrame(function(){y.button===0&&t.onClick(t.hoverObj||null,y,t.intersection),y.button===2&&t.onRightClick&&t.onRightClick(t.hoverObj||null,y,t.intersection)}))},{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",function(y){t.onRightClick&&y.preventDefault()}),t.renderer=new(a?bx:qr.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},c)),t.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),t.container.appendChild(t.renderer.domElement),t.extraRenderers=f,t.extraRenderers.forEach(function(y){y.domElement.style.position="absolute",y.domElement.style.top="0px",y.domElement.style.pointerEvents="none",t.container.appendChild(y.domElement)}),t.postProcessingComposer=new vP(t.renderer),t.postProcessingComposer.addPass(new _P(t.scene,t.camera)),t.controls=new{trackball:hP,orbit:dP,fly:pP}[s](t.camera,t.renderer.domElement),s==="fly"&&(t.controls.movementSpeed=300,t.controls.rollSpeed=Math.PI/6,t.controls.dragToLook=!0),(s==="trackball"||s==="orbit")&&(t.controls.minDistance=.1,t.controls.maxDistance=t.skyRadius,t.controls.addEventListener("start",function(){t.controlsEngaged=!0}),t.controls.addEventListener("change",function(){t.controlsEngaged&&(t.controlsDragging=!0)}),t.controls.addEventListener("end",function(){t.controlsEngaged=!1,t.controlsDragging=!1})),[t.renderer,t.postProcessingComposer].concat(_1(t.extraRenderers)).forEach(function(y){return y.setSize(t.width,t.height)}),t.camera.aspect=t.width/t.height,t.camera.updateProjectionMatrix(),t.camera.position.z=1e3,t.scene.add(t.skysphere=new qr.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!A,window.scene=t.scene},update:function(e,t){if(e.width&&e.height&&(t.hasOwnProperty("width")||t.hasOwnProperty("height"))){var n,r=e.width,s=e.height;e.container.style.width="".concat(r,"px"),e.container.style.height="".concat(s,"px"),[e.renderer,e.postProcessingComposer].concat(_1(e.extraRenderers)).forEach(function(A){return A.setSize(r,s)}),e.camera.aspect=r/s;var o=e.viewOffset.slice(0,2);o.some(function(A){return A})&&(n=e.camera).setViewOffset.apply(n,[r,s].concat(_1(o),[r,s])),e.camera.updateProjectionMatrix()}if(t.hasOwnProperty("viewOffset")){var a,l=e.width,c=e.height,u=e.viewOffset.slice(0,2);u.some(function(A){return A})?(a=e.camera).setViewOffset.apply(a,[l,c].concat(_1(u),[l,c])):e.camera.clearViewOffset()}if(t.hasOwnProperty("skyRadius")&&e.skyRadius&&(e.controls.hasOwnProperty("maxDistance")&&t.skyRadius&&(e.controls.maxDistance=Math.min(e.controls.maxDistance,e.skyRadius)),e.camera.far=e.skyRadius*2.5,e.camera.updateProjectionMatrix(),e.skysphere.geometry=new qr.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var f=Dm(e.backgroundColor).alpha;f===void 0&&(f=1),e.renderer.setClearColor(new qr.Color(Fae(1,e.backgroundColor)),f)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new qr.TextureLoader().load(e.backgroundImageUrl,function(A){A.colorSpace=qr.SRGBColorSpace,e.skysphere.material=new qr.MeshBasicMaterial({map:A,side:qr.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&d()}):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&d())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("lights")&&((t.lights||[]).forEach(function(A){return e.scene.remove(A)}),e.lights.forEach(function(A){return e.scene.add(A)})),t.hasOwnProperty("objects")&&((t.objects||[]).forEach(function(A){return e.scene.remove(A)}),e.objects.forEach(function(A){return e.scene.add(A)}));function d(){e.loadComplete=e.scene.visible=!0}}});function I6e(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var P6e=`.scene-container .clickable {5285+}`;p6e(m6e);function EG(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function A6e(i){if(Array.isArray(i))return i}function g6e(i){if(Array.isArray(i))return EG(i)}function v6e(i,e,t){return(e=T6e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function _6e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function x6e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function y6e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5286+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b6e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5287+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w6e(i,e){return A6e(i)||x6e(i,e)||zle(i,e)||y6e()}function v1(i){return g6e(i)||_6e(i)||zle(i)||b6e()}function S6e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function T6e(i){var e=S6e(i,"string");return typeof e=="symbol"?e:e+""}function zle(i,e){if(i){if(typeof i=="string")return EG(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?EG(i,e):void 0}}var Vle=function(e){e instanceof Array?e.forEach(Vle):(e.map&&e.map.dispose(),e.dispose())},Gle=function(e){e.geometry&&e.geometry.dispose(),e.material&&Vle(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(Gle)},E6e=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),Gle(t)}},Gr=window.THREE?window.THREE:{WebGLRenderer:WM,Scene:s0,PerspectiveCamera:Yr,Raycaster:lb,SRGBColorSpace:Fr,TextureLoader:bl,Vector2:Oe,Vector3:re,Box3:ka,Color:zt,Mesh:Hn,SphereGeometry:Va,MeshBasicMaterial:fs,BackSide:mi,Timer:eg},MG=Qr({props:{width:{default:window.innerWidth,onChange:function(e,t,n){isNaN(e)&&(t.width=n)}},height:{default:window.innerHeight,onChange:function(e,t,n){isNaN(e)&&(t.height=n)}},viewOffset:{default:[0,0]},backgroundColor:{default:"#000011"},backgroundImageUrl:{},onBackgroundImageLoaded:{},showNavInfo:{default:!0},skyRadius:{default:5e4},objects:{default:[]},lights:{default:[]},enablePointerInteraction:{default:!0,onChange:function(e,t){t.hoverObj=null,t.tooltip&&t.tooltip.content(null)},triggerUpdate:!1},pointerRaycasterThrottleMs:{default:50,triggerUpdate:!1},lineHoverPrecision:{default:1,triggerUpdate:!1},pointsHoverPrecision:{default:1,triggerUpdate:!1},hoverOrderComparator:{triggerUpdate:!1},hoverFilter:{default:function(){return!0},triggerUpdate:!1},tooltipContent:{triggerUpdate:!1},hoverDuringDrag:{default:!1,triggerUpdate:!1},clickAfterDrag:{default:!1,triggerUpdate:!1},onHover:{default:function(){},triggerUpdate:!1},onClick:{default:function(){},triggerUpdate:!1},onRightClick:{triggerUpdate:!1}},methods:{tick:function(e){if(e.initialised){e.controls.enabled&&e.controls.update&&e.controls.update(Math.min(1,e.timer.update().getDelta())),e.postProcessingComposer?e.postProcessingComposer.render():e.renderer.render(e.scene,e.camera),e.extraRenderers.forEach(function(o){return o.render(e.scene,e.camera)});var t=+new Date;if(e.enablePointerInteraction&&t-e.lastRaycasterCheck>=e.pointerRaycasterThrottleMs){e.lastRaycasterCheck=t;var n=null;if(e.hoverDuringDrag||!e.isPointerDragging){var r=this.intersectingObjects(e.pointerPos.x,e.pointerPos.y);e.hoverOrderComparator&&r.sort(function(o,a){return e.hoverOrderComparator(o.object,a.object)});var s=r.find(function(o){return e.hoverFilter(o.object)})||null;n=s?s.object:null,e.intersection=s||null}n!==e.hoverObj&&(e.onHover(n,e.hoverObj,e.intersection),e.tooltip.content(n&&st(e.tooltipContent)(n,e.intersection)||null),e.hoverObj=n)}e.tweenGroup.update()}return this},getPointerPos:function(e){var t=e.pointerPos,n=t.x,r=t.y;return{x:n,y:r}},cameraPosition:function(e,t,n,r){var s=e.camera;if(t&&e.initialised){var o,a,l=t,c=n||{x:0,y:0,z:0};if((o=e.povPosTween)===null||o===void 0||o.end(),(a=e.povTgtTween)===null||a===void 0||a.end(),!r)d(l),A(c);else{var u=Object.assign({},s.position),f=y();e.tweenGroup.add(e.povPosTween=new uo(u).to(l,r).easing(Jr.Quadratic.Out).onUpdate(d).onComplete(function(){e.povPosTween=void 0,e.tweenGroup.remove(this)}).start()),e.tweenGroup.add(e.povTgtTween=new uo(f).to(c,r/3).easing(Jr.Quadratic.Out).onUpdate(A).onComplete(function(){e.povTgtTween=void 0,e.tweenGroup.remove(this)}).start())}return this}return Object.assign({},s.position,{lookAt:y()});function d(w){var S=w.x,T=w.y,R=w.z;S!==void 0&&(s.position.x=S),T!==void 0&&(s.position.y=T),R!==void 0&&(s.position.z=R)}function A(w){var S=new Gr.Vector3(w.x,w.y,w.z);e.controls.enabled&&e.controls.target?e.controls.target=S:s.lookAt(S)}function y(){return Object.assign(new Gr.Vector3(0,0,-1e3).applyQuaternion(s.quaternion).add(s.position))}},zoomToFit:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,r=arguments.length,s=new Array(r>3?r-3:0),o=3;o<r;o++)s[o-3]=arguments[o];return this.fitToBbox(this.getBbox.apply(this,s),t,n)},fitToBbox:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:10,s=e.camera;if(t){var o=new Gr.Vector3(0,0,0),a=Math.max.apply(Math,v1(Object.entries(t).map(function(A){var y=w6e(A,2),w=y[0],S=y[1];return Math.max.apply(Math,v1(S.map(function(T){return Math.abs(o[w]-T)})))})))*2,l=(1-r*2/e.height)*s.fov,c=a/Math.atan(l*Math.PI/180),u=c/s.aspect,f=Math.max(c,u);if(f>0){var d=o.clone().sub(s.position).normalize().multiplyScalar(-f);this.cameraPosition(d,o,n)}}return this},getBbox:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},n=new Gr.Box3(new Gr.Vector3(0,0,0),new Gr.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(s){return n.expandByObject(s)}),Object.assign.apply(Object,v1(["x","y","z"].map(function(s){return v6e({},s,[n.min[s],n.max[s]])})))):null},getScreenCoords:function(e,t,n,r){var s=new Gr.Vector3(t,n,r);return s.project(this.camera()),{x:(s.x+1)*e.width/2,y:-(s.y-1)*e.height/2}},getSceneCoords:function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=new Gr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),o=new Gr.Raycaster;return o.setFromCamera(s,e.camera),Object.assign({},o.ray.at(r,new Gr.Vector3))},intersectingObjects:function(e,t,n){var r=new Gr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),s=new Gr.Raycaster;return s.params.Line.threshold=e.lineHoverPrecision,s.params.Points.threshold=e.pointsHoverPrecision,s.setFromCamera(r,e.camera),s.intersectObjects(e.objects,!0)},renderer:function(e){return e.renderer},scene:function(e){return e.scene},camera:function(e){return e.camera},postProcessingComposer:function(e){return e.postProcessingComposer},controls:function(e){return e.controls},tbControls:function(e){return e.controls},_destructor:function(e){var t,n,r;E6e(e.scene),(t=e.controls)===null||t===void 0||t.dispose(),(n=e.renderer)===null||n===void 0||n.dispose(),(r=e.postProcessingComposer)===null||r===void 0||r.dispose()}},stateInit:function(){return{scene:new Gr.Scene,camera:new Gr.PerspectiveCamera,timer:new Gr.Timer,tweenGroup:new Ag,lastRaycasterCheck:0}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.controlType,s=r===void 0?"trackball":r,o=n.useWebGPU,a=o===void 0?!1:o,l=n.rendererConfig,c=l===void 0?{}:l,u=n.extraRenderers,f=u===void 0?[]:u,d=n.waitForLoadComplete,A=d===void 0?!0:d;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.className="scene-container",t.container.style.position="relative",t.container.appendChild(t.navInfo=document.createElement("div")),t.navInfo.className="scene-nav-info",t.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[s]||"",t.navInfo.style.display=t.showNavInfo?null:"none",t.tooltip=new kle(t.container),t.pointerPos=new Gr.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(y){return t.container.addEventListener(y,function(w){if(y==="pointerdown"&&(t.isPointerPressed=!0),!t.isPointerDragging&&w.type==="pointermove"&&(w.pressure>0||t.isPointerPressed)&&(w.pointerType==="mouse"||w.movementX===void 0||[w.movementX,w.movementY].some(function(R){return Math.abs(R)>1}))&&(t.isPointerDragging=!0),t.enablePointerInteraction){var S=T(t.container);t.pointerPos.x=w.pageX-S.left,t.pointerPos.y=w.pageY-S.top}function T(R){var I=R.getBoundingClientRect(),P=window.pageXOffset||document.documentElement.scrollLeft,F=window.pageYOffset||document.documentElement.scrollTop;return{top:I.top+F,left:I.left+P}}},{passive:!0})}),t.container.addEventListener("pointerup",function(y){t.isPointerPressed&&(t.isPointerPressed=!1,!(t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag))&&requestAnimationFrame(function(){y.button===0&&t.onClick(t.hoverObj||null,y,t.intersection),y.button===2&&t.onRightClick&&t.onRightClick(t.hoverObj||null,y,t.intersection)}))},{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",function(y){t.onRightClick&&y.preventDefault()}),t.renderer=new(a?xx:Gr.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},c)),t.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),t.container.appendChild(t.renderer.domElement),t.extraRenderers=f,t.extraRenderers.forEach(function(y){y.domElement.style.position="absolute",y.domElement.style.top="0px",y.domElement.style.pointerEvents="none",t.container.appendChild(y.domElement)}),t.postProcessingComposer=new dI(t.renderer),t.postProcessingComposer.addPass(new pI(t.scene,t.camera)),t.controls=new{trackball:oI,orbit:lI,fly:cI}[s](t.camera,t.renderer.domElement),s==="fly"&&(t.controls.movementSpeed=300,t.controls.rollSpeed=Math.PI/6,t.controls.dragToLook=!0),(s==="trackball"||s==="orbit")&&(t.controls.minDistance=.1,t.controls.maxDistance=t.skyRadius,t.controls.addEventListener("start",function(){t.controlsEngaged=!0}),t.controls.addEventListener("change",function(){t.controlsEngaged&&(t.controlsDragging=!0)}),t.controls.addEventListener("end",function(){t.controlsEngaged=!1,t.controlsDragging=!1})),[t.renderer,t.postProcessingComposer].concat(v1(t.extraRenderers)).forEach(function(y){return y.setSize(t.width,t.height)}),t.camera.aspect=t.width/t.height,t.camera.updateProjectionMatrix(),t.camera.position.z=1e3,t.scene.add(t.skysphere=new Gr.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!A,window.scene=t.scene},update:function(e,t){if(e.width&&e.height&&(t.hasOwnProperty("width")||t.hasOwnProperty("height"))){var n,r=e.width,s=e.height;e.container.style.width="".concat(r,"px"),e.container.style.height="".concat(s,"px"),[e.renderer,e.postProcessingComposer].concat(v1(e.extraRenderers)).forEach(function(A){return A.setSize(r,s)}),e.camera.aspect=r/s;var o=e.viewOffset.slice(0,2);o.some(function(A){return A})&&(n=e.camera).setViewOffset.apply(n,[r,s].concat(v1(o),[r,s])),e.camera.updateProjectionMatrix()}if(t.hasOwnProperty("viewOffset")){var a,l=e.width,c=e.height,u=e.viewOffset.slice(0,2);u.some(function(A){return A})?(a=e.camera).setViewOffset.apply(a,[l,c].concat(v1(u),[l,c])):e.camera.clearViewOffset()}if(t.hasOwnProperty("skyRadius")&&e.skyRadius&&(e.controls.hasOwnProperty("maxDistance")&&t.skyRadius&&(e.controls.maxDistance=Math.min(e.controls.maxDistance,e.skyRadius)),e.camera.far=e.skyRadius*2.5,e.camera.updateProjectionMatrix(),e.skysphere.geometry=new Gr.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var f=Lm(e.backgroundColor).alpha;f===void 0&&(f=1),e.renderer.setClearColor(new Gr.Color(Iae(1,e.backgroundColor)),f)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new Gr.TextureLoader().load(e.backgroundImageUrl,function(A){A.colorSpace=Gr.SRGBColorSpace,e.skysphere.material=new Gr.MeshBasicMaterial({map:A,side:Gr.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&d()}):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&d())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("lights")&&((t.lights||[]).forEach(function(A){return e.scene.remove(A)}),e.lights.forEach(function(A){return e.scene.add(A)})),t.hasOwnProperty("objects")&&((t.objects||[]).forEach(function(A){return e.scene.remove(A)}),e.objects.forEach(function(A){return e.scene.add(A)}));function d(){e.loadComplete=e.scene.visible=!0}}});function M6e(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var C6e=`.scene-container .clickable {52885288 cursor: pointer;5289-}`;I6e(P6e);function CG(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function L6e(i){if(Array.isArray(i))return CG(i)}function JS(i,e,t){return(e=U6e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function D6e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function N6e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5290-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xle(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function x1(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Xle(Object(t),!0).forEach(function(n){JS(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Xle(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function F6e(i,e){if(i==null)return{};var t,n,r=B6e(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function B6e(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function zP(i){return L6e(i)||D6e(i)||k6e(i)||N6e()}function O6e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function U6e(i){var e=O6e(i,"string");return typeof e=="symbol"?e:e+""}function k6e(i,e){if(i){if(typeof i=="string")return CG(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?CG(i,e):void 0}}function $le(i,e){var t=new e;return t._destructor&&t._destructor(),{linkProp:function(r){return{default:t[r](),onChange:function(o,a){a[i][r](o)},triggerUpdate:!1}},linkMethod:function(r){return function(s){for(var o=s[i],a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];var u=o[r].apply(o,l);return u===o?this:u}}}}var z6e=["rendererConfig","waitForGlobeReady"],QS=x1(x1({},window.THREE?window.THREE:{AmbientLight:eg,DirectionalLight:JA,Vector2:Oe,REVISION:"185"}),{},{CSS2DRenderer:eC}),Yle=$le("globe",YV),V6e=Object.assign.apply(Object,zP(["globeImageUrl","bumpImageUrl","globeTileEngineUrl","globeTileEngineMaxLevel","globeCurvatureResolution","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude","onGlobeReady","pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration","arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration","polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration","pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration","heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration","hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration","hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration","tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration","particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture","ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod","labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration","htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration","objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject","customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return JS({},i,Yle.linkProp(i))}))),G6e=Object.assign.apply(Object,zP(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return JS({},i,Yle.linkMethod(i))}))),Zle=$le("renderObjs",MG),q6e=Object.assign.apply(Object,zP(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return JS({},i,Zle.linkProp(i))}))),H6e=Object.assign.apply(Object,zP(["lights","postProcessingComposer"].map(function(i){return JS({},i,Zle.linkMethod(i))}))),Kle=Qr({props:x1(x1({onZoom:{triggerUpdate:!1},onGlobeClick:{triggerUpdate:!1},onGlobeRightClick:{triggerUpdate:!1},pointLabel:{default:"name",triggerUpdate:!1},onPointClick:{triggerUpdate:!1},onPointRightClick:{triggerUpdate:!1},onPointHover:{triggerUpdate:!1},arcLabel:{default:"name",triggerUpdate:!1},onArcClick:{triggerUpdate:!1},onArcRightClick:{triggerUpdate:!1},onArcHover:{triggerUpdate:!1},polygonLabel:{default:"name",triggerUpdate:!1},onPolygonClick:{triggerUpdate:!1},onPolygonRightClick:{triggerUpdate:!1},onPolygonHover:{triggerUpdate:!1},pathLabel:{default:"name",triggerUpdate:!1},onPathClick:{triggerUpdate:!1},onPathRightClick:{triggerUpdate:!1},onPathHover:{triggerUpdate:!1},onHeatmapClick:{triggerUpdate:!1},onHeatmapRightClick:{triggerUpdate:!1},onHeatmapHover:{triggerUpdate:!1},hexLabel:{triggerUpdate:!1},onHexClick:{triggerUpdate:!1},onHexRightClick:{triggerUpdate:!1},onHexHover:{triggerUpdate:!1},hexPolygonLabel:{triggerUpdate:!1},onHexPolygonClick:{triggerUpdate:!1},onHexPolygonRightClick:{triggerUpdate:!1},onHexPolygonHover:{triggerUpdate:!1},tileLabel:{default:"name",triggerUpdate:!1},onTileClick:{triggerUpdate:!1},onTileRightClick:{triggerUpdate:!1},onTileHover:{triggerUpdate:!1},particleLabel:{default:"name",triggerUpdate:!1},onParticleClick:{triggerUpdate:!1},onParticleRightClick:{triggerUpdate:!1},onParticleHover:{triggerUpdate:!1},labelLabel:{triggerUpdate:!1},onLabelClick:{triggerUpdate:!1},onLabelRightClick:{triggerUpdate:!1},onLabelHover:{triggerUpdate:!1},objectLabel:{default:"name",triggerUpdate:!1},onObjectClick:{triggerUpdate:!1},onObjectRightClick:{triggerUpdate:!1},onObjectHover:{triggerUpdate:!1},customLayerLabel:{default:"name",triggerUpdate:!1},onCustomLayerClick:{triggerUpdate:!1},onCustomLayerRightClick:{triggerUpdate:!1},onCustomLayerHover:{triggerUpdate:!1},pointerEventsFilter:{default:function(){return!0},triggerUpdate:!1},lineHoverPrecision:{default:.2,triggerUpdate:!1,onChange:function(e,t){t.renderObjs.lineHoverPrecision(e),t.renderObjs.pointsHoverPrecision(e)}},showPointerCursor:{default:!0,triggerUpdate:!1},globeOffset:{default:[0,0],triggerUpdate:!1,onChange:function(e,t){return Array.isArray(e)&&e.length===2&&t.renderObjs.viewOffset(e.map(function(n){return-n}))}}},V6e),q6e),methods:x1(x1({pauseAnimation:function(e){var t;return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),(t=e.globe)===null||t===void 0||t.pauseAnimation(),this},resumeAnimation:function(e){var t;return e.animationFrameRequestId===null&&this._animationCycle(),(t=e.globe)===null||t===void 0||t.resumeAnimation(),this},_animationCycle:function(e){e.renderObjs.tick(),e.tweenGroup.update(),e.animationFrameRequestId=requestAnimationFrame(this._animationCycle)},pointOfView:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=a();if(t.lat===void 0&&t.lng===void 0&&t.altitude===void 0)return r;var s,o=Object.assign({},r,t);if(["lat","lng","altitude"].forEach(function(c){return o[c]=+o[c]}),(s=e.povTween)===null||s===void 0||s.end(),!n)l(o);else{for(;r.lng-o.lng>180;)r.lng-=360;for(;r.lng-o.lng<-180;)r.lng+=360;e.tweenGroup.add(e.povTween=new uo(r).to(o,n).easing(Jr.Cubic.InOut).onUpdate(l).onComplete(function(){e.povTween=void 0,e.tweenGroup.remove(this)}).start())}return this;function a(){return e.globe.toGeoCoords(e.renderObjs.cameraPosition())}function l(c){var u=c.lat,f=c.lng,d=c.altitude;e.renderObjs.cameraPosition(e.globe.getCoords(u,f,d)),e.globe.setPointOfView(e.renderObjs.camera())}},getScreenCoords:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];var o=(t=e.globe).getCoords.apply(t,r);return e.renderObjs.getScreenCoords(o.x,o.y,o.z)},toGlobeCoords:function(e,t,n){var r=e.renderObjs.intersectingObjects(t,n).find(function(l){return(l.object.__globeObjType||l.object.parent.__globeObjType)==="globe"});if(!r)return null;var s=e.globe.toGeoCoords(r.point),o=s.lat,a=s.lng;return{lat:o,lng:a}},scene:function(e){return e.renderObjs.scene()},camera:function(e){return e.renderObjs.camera()},renderer:function(e){return e.renderObjs.renderer()},controls:function(e){return e.renderObjs.controls()},_destructor:function(e){this.pauseAnimation(),this.pointsData([]),this.arcsData([]),this.polygonsData([]),this.pathsData([]),this.heatmapsData([]),this.hexBinPointsData([]),this.hexPolygonsData([]),this.tilesData([]),this.particlesData([]),this.labelsData([]),this.htmlElementsData([]),this.objectsData([]),this.customLayerData([]),e.globe._destructor(),e.renderObjs._destructor()}},G6e),H6e),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=F6e(e,z6e),o=new YV(x1({waitForGlobeReady:r},s));return{globe:o,renderObjs:MG({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new QS.CSS2DRenderer]}).skyRadius(o.getGlobeRadius()*500).showNavInfo(!1).objects([o]).lights([new QS.AmbientLight(13421772,Math.PI),new QS.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new gg}},init:function(e,t){var n=this;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.style.position="relative";var r=document.createElement("div");t.container.appendChild(r),t.renderObjs(r),t.globe.rendererSize(t.renderObjs.renderer().getSize(new QS.Vector2)),this.pointOfView({altitude:2.5});var s=t.globe.getGlobeRadius(),o=t.renderObjs.controls();t.renderObjs.camera().near=.05,o.minDistance=s+Math.max(.001,t.renderObjs.camera().near*1.1),o.maxDistance=s*100,o.enablePan=!1,o.enableDamping=!0,o.dampingFactor=.1,o.rotateSpeed=.3,o.zoomSpeed=.3,o.zoomToCursor=!0,o.addEventListener("change",function(){o.target.setScalar(0);var c=n.pointOfView();o.rotateSpeed=c.altitude*.3,o.zoomSpeed=Math.sqrt(c.altitude)*.5,t.globe.setPointOfView(t.renderObjs.camera()),t.onZoom&&t.onZoom(c)});var a=function(u){for(var f=u;f&&!f.hasOwnProperty("__globeObjType");)f=f.parent;return f},l={point:function(u){return u},arc:function(u){return u},polygon:function(u){return u.data},path:function(u){return u},heatmap:function(u){return u},hexbin:function(u){return u},hexPolygon:function(u){return u},tile:function(u){return u},particles:function(u,f){return!f||!f.hasOwnProperty("index")||u.length<=f.index?u:u[f.index]},label:function(u){return u},object:function(u){return u},custom:function(u){return u}};QS.REVISION<155&&(t.renderObjs.renderer().useLegacyLights=!1),t.renderObjs.hoverFilter(function(c){var u=a(c);if(!u)return!1;var f=u.__globeObjType;if(f!=="globe"&&!l.hasOwnProperty(f))return!1;var d=l.hasOwnProperty(f)&&u.__data?l[f](u.__data):null;return["points","hexBinPoints"].some(function(A){return A===f})&&Array.isArray(d)?!1:t.pointerEventsFilter(u,d)}).tooltipContent(function(c,u){var f={point:t.pointLabel,arc:t.arcLabel,polygon:t.polygonLabel,path:t.pathLabel,hexbin:t.hexLabel,hexPolygon:t.hexPolygonLabel,tile:t.tileLabel,particles:t.particleLabel,label:t.labelLabel,object:t.objectLabel,custom:t.customLayerLabel},d=a(c),A=d&&d.__globeObjType;return d&&A&&f.hasOwnProperty(A)&&l.hasOwnProperty(A)&&st(f[A])(l[A](d.__data,u))||""}).onHover(function(c,u,f){var d={point:t.onPointHover,arc:t.onArcHover,polygon:t.onPolygonHover,path:t.onPathHover,heatmap:t.onHeatmapHover,hexbin:t.onHexHover,hexPolygon:t.onHexPolygonHover,tile:t.onTileHover,particles:t.onParticleHover,label:t.onLabelHover,object:t.onObjectHover,custom:t.onCustomLayerHover},A={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},y=a(c);if(y&&!d.hasOwnProperty(y.__globeObjType)&&(y=null),y!==t.hoverObj){var w,S=t.hoverObj?t.hoverObj.__globeObjType:null,T=t.hoverData,R=y?y.__globeObjType:null,P=(w=y)!==null&&w!==void 0&&w.__data?l[R](y.__data,f):null;S&&S!==R&&d[S]&&d[S](null,T||null),R&&d[R]&&d[R](P,S===R?T:null),t.renderObjs.renderer().domElement.classList[R&&A[R]&&st(t.showPointerCursor)(R,P)?"add":"remove"]("clickable"),t.hoverObj=y,t.hoverData=P}}).onClick(function(c,u,f){if(c){var d={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},A=a(c),y=A.__globeObjType;if(A&&d.hasOwnProperty(y)&&d[y]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(y==="globe"){var T=n.toGeoCoords(S),R=T.lat,P=T.lng;w.unshift({lat:R,lng:P})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(y)&&w.unshift(l[y](A.__data,f)),d[y].apply(d,w)}}}).onRightClick(function(c,u,f){if(c){var d={globe:t.onGlobeRightClick,point:t.onPointRightClick,arc:t.onArcRightClick,polygon:t.onPolygonRightClick,path:t.onPathRightClick,heatmap:t.onHeatmapRightClick,hexbin:t.onHexRightClick,hexPolygon:t.onHexPolygonRightClick,tile:t.onTileRightClick,particles:t.onParticleRightClick,label:t.onLabelRightClick,object:t.onObjectRightClick,custom:t.onCustomLayerRightClick},A=a(c),y=A.__globeObjType;if(A&&d.hasOwnProperty(y)&&d[y]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(y==="globe"){var T=n.toGeoCoords(S),R=T.lat,P=T.lng;w.unshift({lat:R,lng:P})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(y)&&w.unshift(l[y](A.__data,f)),d[y].apply(d,w)}}}),this._animationCycle()}});var ece=4,Ox=100,nT=Ox+.2,ap=8,W6e=96,tce=.045,nce=.08;function Ux(i,e,t){let n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}var Yn=null,GP="",Fs={group:null,tiles:new Map,key:"",lens:""},Mo={group:null,cell:null,fitKey:""},hu={group:null,key:""},j6e=180,IG=null,kx=new Map,WP=new Map,Qle=new Map;function ice(){let i=VT(O.world)==="sphere"&&fh(O.world)!==null;ge.globeToggle.hidden=!i,rce(),!i&&Yn&&(eT(),Fs.group=null,Mo.group=null,Mo.cell=null,hu.group=null,hu.key="",Yn._destructor(),Yn=null,GP="",IG=null,ge.globe.replaceChildren())}function jP(){O.globeActive?rce():ace()}var tT=2.5,qP=2,zx=.08,XP=4;function X6e(i){let e=Number.isFinite(i)?i:qP;return us(tT/2**(e-qP),zx,XP)}function LG(i){let e=Number.isFinite(i)?Math.max(i,zx/2):tT,t=(O.lens?.maxZoom??qP)+2;return us(qP+Math.log2(tT/e),0,t)}function DG(i){if(!Yn||!O.globeActive)return;let e=Yn.pointOfView(),t=us((Number.isFinite(e.altitude)?e.altitude:tT)/2**i,zx,XP);Yn.pointOfView({altitude:t},180)}function rce(){let i=fh(O.world),e=O.engine?.getView();if(Yn&&O.globeActive&&i&&e){let t=Yn.pointOfView(),[n,r]=i.toWorld(t.lat,t.lng);Number.isFinite(n)&&Number.isFinite(r)&&(e.cancelAnimations(),e.setCenter([n,-r]),e.setZoom(LG(t.altitude)))}O.globeActive=!1,ge.globe.hidden=!0,ge.globeToggle.setAttribute("aria-pressed","false"),ge.viewport.hidden=!1,eT(),O.overviewKey="",document.dispatchEvent(new Event("atlas:globe-camera"))}function sce(){if(!Yn||!O.globeActive)return null;let i=Yn.pointOfView();return{lat:i.lat,lng:i.lng}}function oce(i,e,t){if(!Yn)return;let n=Yn.pointOfView().altitude;Yn.pointOfView({lat:i,lng:e,altitude:n},t?180:0)}async function ace(){let i=fh(O.world);if(!i)return;if(O.globeActive=!0,ge.viewport.hidden=!0,ge.globe.hidden=!1,ge.globeToggle.setAttribute("aria-pressed","true"),O.overviewKey="",!Yn){Yn=Kle({animateIn:!1})(ge.globe).backgroundColor("#0b0e12").showAtmosphere(!0).atmosphereColor("#8a6f5b").atmosphereAltitude(.12).objectLat(o=>o.lat).objectLng(o=>o.lng).objectAltitude(o=>o.pin===O.selectedPin?.03:.014).objectThreeObject(o=>s8e(o.pin)).objectLabel(o=>o.pin.location.title).onObjectClick(o=>By(o.pin)).onObjectHover(o=>{ge.globe.style.cursor=o?"pointer":""}).onZoom(()=>{document.dispatchEvent(new Event("atlas:globe-camera")),Jle(),VP(),o8e(),FG()}),document.addEventListener("atlas:selection",r8e),document.addEventListener("atlas:filters",RG),document.addEventListener("atlas:grid",()=>{HP(),RG(),VP()}),document.addEventListener("atlas:labels",VP),Yn.onGlobeClick(({lat:o,lng:a})=>{if(!O.gridEnabled)return;let l=fh(O.world);if(!l)return;let[c,u]=l.toWorld(o,a),f=Ts().descendTarget(O.gridCell,[c,-u]);f&&AA(f)});let s=Yn.controls();s.minDistance=Ox*(1+zx),s.maxDistance=Ox*(1+XP),Fs.group=new Or,Yn.scene().add(Fs.group),Mo.group=new Or,Yn.scene().add(Mo.group),hu.group=new Or,Yn.scene().add(hu.group),window.__atlasGlobe={detail:Fs,grid:Mo,labels:hu,sprites:kx}}BG();let e=O.engine?.getView(),t=e?.getCenter();if(t&&Number.isFinite(t[0])&&Number.isFinite(t[1])){let[s,o]=i.toLatLng(t[0],-t[1]);Yn.pointOfView({lat:s,lng:o,altitude:X6e(e.getZoom())})}else Yn.pointOfView({lat:10,lng:0,altitude:tT});let n=O.lens||O.world.lenses[0],r=`${O.volume.stamp}:${O.world.slug}:${n.tiles}`;if(GP!==r){GP=r;let s=await l8e(n);s&&GP===r&&Yn.globeImageUrl(s)}IG!==O.features&&(IG=O.features,kx.clear(),WP.clear(),Yn.objectsData(a8e(i))),RG(),hce(),Jle(),HP(),VP(),document.dispatchEvent(new Event("atlas:globe-camera"))}function HP(){if(!Yn||!Mo.group)return;for(let t of[...Mo.group.children])Mo.group.remove(t),t.geometry?.dispose(),t.material?.map?.dispose(),t.material?.dispose();let i=O.globeActive?fh(O.world):null;if(!i||!O.gridEnabled){Mo.cell=null;return}let e=Ts();for(let t of FE()){let n=lce(t.ring,i),r=NG(n),s=NE(t,{subgridVisible:O.subgridVisible,labelled:Z6e(t,r)});if(s){if(s.fill){let o=cce(e.center(t.hash),i);Mo.group.add(K6e(n,o,s.fill))}Mo.group.add(e8e(n,s.line)),s.label&&Mo.group.add(t8e(s.label,r))}}Mo.cell!==null&&Mo.cell!==O.gridCell&&n8e(i),Mo.cell=O.gridCell,FG()}function lce(i,e){return i.map(([t,n])=>e.toLatLng(t,-n))}function cce(i,e){return e.toLatLng(i[0],-i[1])}function $6e(i){let e=[];for(let t=0;t<i.length-1;t++){let[n,r]=i[t],[s,o]=i[t+1],a=Math.max(Math.abs(s-n),Math.abs(o-r)),l=us(Math.ceil(a/2),1,48);for(let c=0;c<l;c++){let u=c/l;e.push([n+(s-n)*u,r+(o-r)*u])}}return e}function NG(i){let e=-1/0,t=1/0,n=1/0,r=-1/0;for(let[s,o]of i)e=Math.max(e,s),t=Math.min(t,s),n=Math.min(n,o),r=Math.max(r,o);return{north:e,south:t,west:n,east:r}}function Y6e(i){let e=Yn.pointOfView(),t=Math.max(e.altitude,zx/2),n=50*Math.PI/180,r=2*t*Ox*Math.tan(n/2)/Math.max(1,ge.globe.clientHeight||1),s=Ox*Math.PI/180/r;return{width:Math.abs(i.east-i.west)*s,height:Math.abs(i.north-i.south)*s}}function Z6e(i,e){let n=i.role==="neighbor"?Vi.neighborLabelSizePx:Vi.labelSizePx,r=`900 ${n}px ${Vi.labelFont}`,s=Y6e(e);return h5(i.hash,r)+9<=s.width&&n+6<=s.height}function K6e(i,e,t){let n=nT+.12,r=$6e(i),s=NG(i),o=Math.max(s.east-s.west,s.north-s.south),a=us(Math.ceil(o/6),2,24),l=Ux(e[0],e[1],n),c=r.map(([T,R])=>Ux(T,R,n)),u=[...l],f=[];for(let T=1;T<=a;T++){let R=T/a;for(let P of c){let I=l[0]+(P[0]-l[0])*R,F=l[1]+(P[1]-l[1])*R,D=l[2]+(P[2]-l[2])*R,L=n/(Math.hypot(I,F,D)||1);u.push(I*L,F*L,D*L)}}let d=r.length,A=(T,R)=>1+(T-1)*d+R%d;for(let T=0;T<d;T++)f.push(0,A(1,T),A(1,T+1));for(let T=1;T<a;T++)for(let R=0;R<d;R++)f.push(A(T,R),A(T+1,R),A(T,R+1)),f.push(A(T,R+1),A(T+1,R),A(T+1,R+1));let y=new Xn;y.setAttribute("position",new Ln(u,3)),y.setIndex(f);let w=new ds({color:t.color,transparent:!0,opacity:t.opacity,depthWrite:!1,side:2}),S=new Hn(y,w);return S.renderOrder=1,S}function VP(){if(!Yn||!hu.group)return;let i=O.globeActive&&O.labelsHeld,e=i?Yn.pointOfView():null,t=i?`${Math.round(e.lat)}:${Math.round(e.lng)}:${e.altitude.toFixed(2)}:${O.gridSystem}:${O.gridCell}`:"";if(t===hu.key)return;hu.key=t;for(let r of[...hu.group.children])hu.group.remove(r),r.material?.map?.dispose(),r.material?.dispose();if(!i)return;let n=[];for(let[r,s]of kx){if(!s.visible)continue;let o=WP.get(r);if(!o)continue;let a=Q6e(e,o);a>85||n.push({pin:r,stood:o,distance:a})}n.sort((r,s)=>r.distance-s.distance);for(let{pin:r,stood:s}of n.slice(0,j6e))hu.group.add(J6e(r,s));FG()}function FG(){if(!Yn)return;let i=Yn.camera().position,e=i.length()||1,t=Ox/e;for(let n of[Mo.group,hu.group])if(n)for(let r of n.children){if(!r.isSprite)continue;let s=r.position,o=s.length()||1,a=(s.x*i.x+s.y*i.y+s.z*i.z)/(o*e);r.visible=a>t}}function Q6e(i,e){let t=Math.PI/180,n=Math.sin(i.lat*t)*Math.sin(e.lat*t)+Math.cos(i.lat*t)*Math.cos(e.lat*t)*Math.cos((i.lng-e.lng)*t);return Math.acos(us(n,-1,1))*180/Math.PI}function J6e(i,e){let t=i.location.title,n=document.createElement("canvas"),r=n.getContext("2d"),s="600 26px Inter, system-ui, sans-serif";r.font=s;let o=Math.ceil(r.measureText(t).width)+24;n.width=o,n.height=40,r.font=s,r.textAlign="center",r.textBaseline="middle",r.fillStyle="rgba(10, 13, 17, 0.78)",r.fillRect(0,0,o,40),r.fillStyle="#e6ebf0",r.fillText(t,o/2,21);let a=new Dh({depthTest:!1,depthWrite:!1,sizeAttenuation:!1,transparent:!0});new wl().load(n.toDataURL("image/png"),u=>{a.map=u,a.needsUpdate=!0});let l=new HA(a);l.position.set(...Ux(e.lat,e.lng,nT+.4)),l.renderOrder=4;let c=.028;return l.scale.set(c*o/40,c,1),l.center.set(.5,0),l}function e8e(i,e){let t=[];for(let o=0;o<i.length-1;o++){let[a,l]=i[o],[c,u]=i[o+1],f=Math.max(Math.abs(c-a),Math.abs(u-l)),d=us(Math.ceil(f/2),4,48);for(let A=0;A<d;A++){let y=A/d;t.push(...Ux(a+(c-a)*y,l+(u-l)*y,nT+.25))}}t.push(...t.slice(0,3));let n=new Em;n.setPositions(t);let r=new Df({color:e.color,transparent:!0,opacity:e.opacity,linewidth:e.widthPx,depthWrite:!1});r.resolution.set(ge.globe.clientWidth||1,ge.globe.clientHeight||1);let s=new Rx(n,r);return s.computeLineDistances(),s.renderOrder=2,s}function t8e(i,e){let n=i.sizePx*2,r=`500 ${n}px ${Vi.labelFont}`,s=`900 ${n}px ${Vi.labelFont}`,o=document.createElement("canvas"),a=o.getContext("2d");a.font=r;let l=i.prefix?a.measureText(i.prefix).width:0;a.font=s;let c=a.measureText(i.final).width,u=10;o.width=Math.ceil(l+c+u*2),o.height=n+u*1.4,a.fillStyle=i.chip,a.fillRect(0,0,o.width,o.height),a.textBaseline="middle";let f=o.height/2+2;i.prefix&&(a.font=r,a.fillStyle=i.color,a.globalAlpha=Vi.prefixAlpha*i.textAlpha,a.fillText(i.prefix,u,f)),a.font=s,a.globalAlpha=i.textAlpha,a.fillStyle=i.color,a.fillText(i.final,u+l,f),a.globalAlpha=1;let d=new Dh({depthTest:!1,depthWrite:!1,transparent:!0,sizeAttenuation:!1});new wl().load(o.toDataURL("image/png"),R=>{d.map=R,d.needsUpdate=!0});let A=new HA(d),y=Math.abs(e.north-e.south)*.02,w=Math.abs(e.east-e.west)*.02;A.position.set(...Ux(e.south+y,e.east-w,nT+.35));let S=Math.max(1,ge.globe.clientHeight||1),T=o.height/2/S;return A.scale.set(T*o.width/o.height,T,1),A.center.set(1,0),A.renderOrder=3,A}function n8e(i){let t=FE().find(l=>l.role==="scope"||l.role==="leaf");if(!t)return;let[n,r]=cce(Ts().center(t.hash),i),s=NG(lce(t.ring,i)),o=Math.max(s.east-s.west,s.north-s.south),a=us(o/45,zx,XP);Yn.pointOfView({lat:n,lng:r,altitude:a},400)}function Jle(){if(!Yn||!Fs.group)return;let i=O.globeActive?O.lens||O.world.lenses[0]:null;if(!i){eT();return}Fs.lens!==i.tiles&&(eT(),Fs.lens=i.tiles);let e=Yn.pointOfView(),t=Math.min(Math.round(LG(e.altitude))+1,i.maxZoom);if(t<=ece||!i.formats[t]){eT(),Fs.key="";return}let n=2**t,r=n/2,s=360/n,o=Math.acos(1/(1+e.altitude))*180/Math.PI+s,a=Math.floor(((e.lng+180)%360+360)%360/s),l=Math.floor((90-e.lat)/s),c=Math.ceil(o/s);for(;(2*c+1)**2>W6e&&c>1;)c--;let u=new Set;for(let d=-c;d<=c;d++){let A=l+d;if(!(A<0||A>=r))for(let y=-c;y<=c;y++){let w=((a+y)%n+n)%n;u.add(`${t}/${w}/${A}`)}}let f=`${i.tiles}:${[...u].sort().join(",")}`;if(f!==Fs.key){Fs.key=f;for(let[d,A]of Fs.tiles)u.has(d)||(Fs.group.remove(A),uce(A),Fs.tiles.delete(d));for(let d of u){if(Fs.tiles.has(d))continue;let[A,y,w]=d.split("/").map(Number),S=i8e(i,A,y,w);Fs.tiles.set(d,S),Fs.group.add(S)}}}function i8e(i,e,t,n){let r=360/2**e,s=-180+t*r,o=90-n*r,a=[],l=[],c=[];for(let w=0;w<=ap;w++){let S=o-w/ap*r;for(let T=0;T<=ap;T++){let R=s+T/ap*r;a.push(...Ux(S,R,nT)),l.push(T/ap,1-w/ap)}}let u=ap+1;for(let w=0;w<ap;w++)for(let S=0;S<ap;S++){let T=w*u+S;c.push(T,T+u,T+1),c.push(T+1,T+u,T+u+1)}let f=new Xn;f.setAttribute("position",new Ln(a,3)),f.setAttribute("uv",new Ln(l,2)),f.setIndex(c);let d=new ds,A=new Hn(f,d);A.visible=!1;let y=`${O.volume.base}/tiles/${i.tiles}/${e}/${t}/${n}.${i.formats[e]}`;return new wl().load(y,w=>{w.colorSpace=Br,d.map=w,d.needsUpdate=!0,A.visible=!0}),A}function eT(){if(Fs.group){for(let i of Fs.tiles.values())Fs.group.remove(i),uce(i);Fs.tiles.clear(),Fs.key=""}}function uce(i){i.geometry.dispose(),i.material.map?.dispose(),i.material.dispose()}function hce(){if(Yn){for(let[i,e]of kx){let t=i===O.selectedPin;e.material=dce(i.category,t);let n=t?nce:tce;e.scale.set(n,n,1)}Yn.objectAltitude(i=>i.pin===O.selectedPin?.03:.014)}}function r8e(){if(!Yn||!O.globeActive)return;hce();let i=WP.get(O.selectedPin);if(i){let e=Yn.pointOfView().altitude;Yn.pointOfView({lat:i.lat,lng:i.lng,altitude:e},600)}}function fce(i){return!(i.filteredHidden||Po(i.category.id)||O.gridEnabled&&O.gridCell&&!Fp(i))}function RG(){if(!(!Yn||!O.globeActive))for(let[i,e]of kx)e.visible=fce(i)}function s8e(i){let e=new HA(dce(i.category,i===O.selectedPin)),t=i===O.selectedPin?nce:tce;return e.scale.set(t,t,1),e.visible=fce(i),kx.set(i,e),e}function dce(i,e){let t=`${t2(i)}:${e?"ringed":"plain"}`,n=Qle.get(t);if(n)return n;n=new Dh({depthWrite:!1,sizeAttenuation:!1}),Qle.set(t,n);let r=O.markerIcons.get(t2(i)),s=o=>{let a=document.createElement("canvas");a.width=80,a.height=80;let l=a.getContext("2d");o?l.drawImage(o,8,8,64,64):(l.font="900 26px Inter, system-ui, sans-serif",l.textAlign="center",l.textBaseline="middle",l.lineWidth=6,l.strokeStyle=fA(),l.strokeText(Mu(i.title),40,41),l.fillStyle=dA(i),l.fillText(Mu(i.title),40,41)),e&&(l.beginPath(),l.arc(40,40,36,0,Math.PI*2),l.lineWidth=5,l.strokeStyle="#ffffff",l.stroke()),new wl().load(a.toDataURL("image/png"),c=>{n.map=c,n.needsUpdate=!0})};if(r){let o=new Image;o.onload=()=>s(o),o.onerror=()=>s(null),o.src=r}else s(null);return n}function pce(){O.globeActive&&ace()}function BG(){!Yn||ge.globe.hidden||(Yn.width(ge.globe.clientWidth).height(ge.globe.clientHeight),HP())}function o8e(){if(!Yn||!O.globeActive||!O.gridEnabled)return;let i=Yn.pointOfView(),e=`${O.gridSystem}:${O.gridCell}:${Math.round(LG(i.altitude)*2)}`;e!==Mo.fitKey&&(Mo.fitKey=e,HP())}function a8e(i){let e=[];for(let t of O.features){let[n,r]=Av(t.location.lat,t.location.lng),[s,o]=i.toLatLng(n,-r);e.push({lat:s,lng:o,pin:t}),WP.set(t,{lat:s,lng:o})}return e}async function l8e(i){let e=Math.min(ece,i.maxZoom),t=i.formats[e];if(!t)return null;let n=2**e,r=n/2,s=document.createElement("canvas");s.width=n*256,s.height=r*256;let o=s.getContext("2d"),a=[];for(let l=0;l<r;l++)for(let c=0;c<n;c++){let u=`${O.volume.base}/tiles/${i.tiles}/${e}/${c}/${l}.${t}`;a.push(c8e(u).then(f=>{f&&o.drawImage(f,c*256,l*256,256,256)}))}return await Promise.all(a),s.toDataURL("image/jpeg",.92)}function c8e(i){return new Promise(e=>{let t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=i})}function mce(){let i=O.lens,e=ge.overviewCanvas,t=e.getContext("2d"),n=Vf(),r=O.volume.tileGrid.size,s=O.volume.tileGrid.tileSize,o=n[2]-n[0],a=n[3]-n[1],l=0;for(;l<i.fullZoom&&Math.max(o,a)/r*s*2**l<168;)l++;let c=s*2**l/r;e.width=Math.max(1,Math.round(o*c)),e.height=Math.max(1,Math.round(a*c)),t.clearRect(0,0,e.width,e.height),i.background&&(t.fillStyle=i.background,t.fillRect(0,0,e.width,e.height));let u=++O.overviewRun,f=i.formats[l],d=Math.floor(n[0]/r*2**l),A=Math.ceil(n[2]/r*2**l),y=Math.floor(-n[3]/r*2**l),w=Math.ceil(-n[1]/r*2**l);for(let S=y;S<w;S++)for(let T=d;T<A;T++){if(!f||!YP(i,l,T,S))continue;let R=new Image;R.onload=()=>{O.overviewRun===u&&t.drawImage(R,T*s-n[0]*c,S*s+n[3]*c,s,s)},R.src=`${O.volume.base}/tiles/${encodeURIComponent(i.tiles)}/${l}/${T}/${S}.${f}`}Vx()}function Vx(){let i=sce();if(i){let w=fh(O.world);if(!w||!O.lens)return;let S=Vf(),[T,R]=w.toWorld(i.lat,i.lng),P=ge.overviewCanvas,I=us((T-S[0])/(S[2]-S[0]),0,1),F=us((R+S[3])/(S[3]-S[1]),0,1);O.overviewKey="",ge.overviewShelf.hidden=!1;let D=ge.overviewViewport.style,L=22;D.left=`${I*P.width-L/2}px`,D.top=`${F*P.height-L/2}px`,D.width=`${L}px`,D.height=`${L}px`;return}let e=O.engine?.getView();if(!e||!O.lens)return;let t=Vf(),n=e.calculateExtent(O.engine.getSize()),r=t[2]-t[0],s=t[3]-t[1],o=(e.getResolution()||0)*4,a=n[0]<=t[0]+o&&n[1]<=t[1]+o&&n[2]>=t[2]-o&&n[3]>=t[3]-o,l=a?"hidden":n.map(Math.round).join(",");if(l===O.overviewKey||(O.overviewKey=l,ge.overviewShelf.hidden=a,a))return;let c=ge.overviewCanvas,u=us((n[0]-t[0])/r,0,1),f=us((n[2]-t[0])/r,0,1),d=us((t[3]-n[3])/s,0,1),A=us((t[3]-n[1])/s,0,1),y=ge.overviewViewport.style;y.left=`${u*c.width}px`,y.top=`${d*c.height}px`,y.width=`${Math.max(8,(f-u)*c.width)}px`,y.height=`${Math.max(8,(A-d)*c.height)}px`}function $P(i,e=!0){O.overviewDocked=i,i&&O.overviewPointer!==null&&(O.overviewPointer=null,Gx()),ge.overviewShelf.classList.toggle("is-docked",i),ge.overviewDock.setAttribute("aria-expanded",String(!i));let t=i?"Bring the overview back":"Put the overview away";ge.overviewDock.setAttribute("aria-label",t),ge.overviewDock.title=t,e&&ml()}function OG(i,e){let t=ge.overviewCanvas.getBoundingClientRect(),n=Vf(),r=(a,l,c)=>us((a-l)/(c-l),0,1);if(O.globeActive){let a=fh(O.world);if(!a)return;let l=n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),c=-n[3]+r(i.clientY,t.top,t.bottom)*(n[3]-n[1]),[u,f]=a.toLatLng(l,c);oce(u,f,e);return}let s=O.engine?.getView();if(!s||!O.lens)return;let o=[n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),n[3]-r(i.clientY,t.top,t.bottom)*(n[3]-n[1])];if(e){s.animate({center:o,duration:180});return}s.cancelAnimations(),s.setCenter(o)}function xc(i){return new LY({updateWhileAnimating:!0,...i})}function Ace(){let i=O.volume.tileGrid.size,e=[0,-i,i,0];O.projection=new Tp({code:"ATLAS:PIXELS",units:"pixels",extent:e}),O.sources={grid:new _d({wrapX:!1}),gridContext:new _d({wrapX:!1}),zoneScrim:new _d({wrapX:!1}),zones:new _d({wrapX:!1}),zoneTitles:new _d({wrapX:!1}),text:new _d({wrapX:!1}),pins:new _d({wrapX:!1}),priority:new _d({wrapX:!1})},O.layers={raster:new L6({zIndex:0}),rasterDetail:new L6({zIndex:1}),grid:xc({source:O.sources.grid,style:u5,renderOrder:zc,renderBuffer:40,zIndex:5}),zoneScrim:xc({source:O.sources.zoneScrim,style:kX,zIndex:6}),zones:xc({source:O.sources.zones,style:zX,renderBuffer:32,zIndex:10}),zoneTitles:xc({source:O.sources.zoneTitles,style:VX,renderOrder:zc,renderBuffer:160,zIndex:20}),zoneTitleDetail:xc({source:O.sources.zoneTitles,style:GX,renderOrder:zc,renderBuffer:160,zIndex:44}),text:xc({source:O.sources.text,style:DX,renderOrder:zc,renderBuffer:220,zIndex:30}),textDetail:xc({source:O.sources.text,style:NX,renderOrder:zc,renderBuffer:220,zIndex:45}),zoneText:xc({source:O.sources.text,style:FX,renderOrder:zc,renderBuffer:220,zIndex:41}),pins:xc({source:O.sources.pins,style:IX,renderOrder:zc,renderBuffer:48,zIndex:40}),zonePins:xc({source:O.sources.pins,style:PX,renderOrder:zc,renderBuffer:48,zIndex:42}),pinLabels:xc({source:O.sources.pins,style:LX,renderOrder:zc,renderBuffer:180,zIndex:45}),gridContext:xc({source:O.sources.gridContext,style:u5,renderOrder:zc,renderBuffer:40,zIndex:48}),priority:xc({source:O.sources.priority,style:BX,renderOrder:zc,renderBuffer:220,zIndex:50})},O.engine=new sY({target:ge.viewport,layers:Object.values(O.layers),controls:t3({attribution:!1,rotate:!1,zoom:!1}),interactions:a3({onFocusOnly:!1}),view:KP(5)}),O.engine.on("movestart",()=>{O.engine.getViewport().classList.add("is-dragging")}),O.engine.on("moveend",()=>{O.engine.getViewport().classList.remove("is-dragging"),O.overviewPointer===null&&Gx()}),O.engine.on("postrender",Vx),ge.viewport.addEventListener("wheel",()=>{document.activeElement!==ge.viewport&&ge.viewport.focus({preventScroll:!0})},{capture:!0,passive:!0}),O.engine.on("singleclick",t=>{if(O.gridEnabled){let s=O.engine.forEachFeatureAtPixel(t.pixel,o=>{let a=o.get("gridCell");return a&&a.role!=="leaf"&&a.role!=="scope"?a:null},{hitTolerance:1,layerFilter:o=>o===O.layers.grid||o===O.layers.gridContext});if(s){AA(s.hash);return}}let n=O.engine.forEachFeatureAtPixel(t.pixel,(s,o)=>ZP(o)&&s.get("pin")||null,{hitTolerance:5,layerFilter:ZP});if(n){By(n);return}let r=O.engine.forEachFeatureAtPixel(t.pixel,s=>{let o=s.get("zone");return o&&!Po(Au(o))?o:null},{layerFilter:s=>s===O.layers.zones});r&&EE(r)}),O.engine.on("pointermove",t=>{if(t.dragging){gv(null);return}let n=O.engine.forEachFeatureAtPixel(t.pixel,(o,a)=>ZP(a)&&o.get("pin")||null,{hitTolerance:4,layerFilter:ZP}),r=n&&gu(n.category)==="text"?null:n;gv(r||null);let s=O.gridEnabled&&O.engine.hasFeatureAtPixel(t.pixel,{layerFilter:o=>o===O.layers.grid||o===O.layers.gridContext});O.engine.getTargetElement().style.cursor=n||s?"pointer":""}),O.engine.getViewport().addEventListener("pointerleave",()=>gv(null))}function ZP(i){return i===O.layers.pins||i===O.layers.zonePins||i===O.layers.pinLabels||i===O.layers.priority||i===O.layers.text||i===O.layers.textDetail||i===O.layers.zoneText}function KP(i,e=null){let t=O.volume.tileGrid.size,n=e||[0,-t,t,0];return new Yl({projection:O.projection,center:[(n[0]+n[2])/2,(n[1]+n[3])/2],resolutions:UG(i),minZoom:0,maxZoom:i,extent:n,constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function UG(i){let e=O.volume.tileGrid.size/O.volume.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function hd(i,e){O.volume=O.catalog.volumes.find(r=>r.slug===i)||O.catalog.volumes[0],O.engine||Ace(),!e&&!O.restore&&(O.restore=lv(O.volume.slug)),ge.volume.value=O.volume.slug,Hm(ge.world,O.volume.worlds,"title"),ge.world.disabled=O.volume.worlds.length===1,ge.world.title=ge.world.disabled?"This volume has one world":"Choose a world";let t=O.restore?.volume===O.volume.slug?O.restore:null,n=e&&O.volume.worlds.find(r=>r.slug===e)||t&&O.volume.worlds.find(r=>r.slug===t.world);await kG((n||O.volume.worlds[0]).slug)}async function kG(i){let e=O.volume.worlds.find(s=>s.slug===i)||O.volume.worlds[0],t=++O.worldRun;ge.loading.hidden=!1;let n;try{n=await l$(e)}catch(s){console.error(`world ${e.slug} failed to load`,s),O.worldRun===t&&(ge.loading.hidden=!0,bA());return}if(O.worldRun!==t)return;O.settling=!0,O.world=n,document.documentElement.style.setProperty("--icon-outset-color",fA()),ge.world.value=O.world.slug,Hm(ge.lens,O.world.lenses,"name"),ge.lensField.hidden=O.world.lenses.length<2,O.styleCache.clear(),gv(null),O.gridCell="",O.gridSystem="geohash",O.hiddenCollections.clear(),O.labelOverrides.clear(),O.renderOverrides.clear(),O.collapsedSections.clear(),O.collapsedSections.add("zones"),O.expandedCollections.clear();for(let s of O.world.collections)s.kind!=="point"&&!s.group&&O.expandedCollections.add(s.id),s.visible||O.hiddenCollections.add(s.id);let r=O.restore?.world===O.world.slug?O.restore:null;r&&(O.hiddenCollections=new Set(r.hidden),O.collapsedSections=new Set(r.collapsed),O.expandedCollections=new Set(r.expanded||[]),O.labelOverrides=new Map(r.labels||[]),O.renderOverrides=new Map(r.render||[])),$P(!!O.restore?.overviewDocked,!1),TE(O.restore?!!O.restore.dockFolded:!0,!1),O.dockDismissed=!!O.restore?.dockDismissed,O.search="",ge.search.value="",ge.dock.hidden=!1,od(),JX(),m5(),YE(),zG(r?us(r.lens,0,O.world.lenses.length-1):0,!0),ice(),O.restore=null,ge.sidebar.classList.remove("is-open"),ge.mobileLegend.setAttribute("aria-expanded","false"),Vj(),O.settling=!1,ml()}function zG(i,e=!1){let t=O.lens;O.lens=O.world.lenses[i]||O.world.lenses[0];let n=O.lens,r=e?null:f8e(t,n),s=_h(n);if(ge.lens.value=String(O.world.lenses.indexOf(O.lens)),e)O.engine.setView(KP(s,Vf()));else{let w=O.engine.getView(),S=KP(s,Vf());S.setCenter(w.getCenter()),S.setZoom(w.getZoom()||0),O.engine.setView(S)}let o=++O.tileRun,a=0;O.tileStats={requested:0,loaded:0,errors:0,peakPending:0},ge.loading.hidden=!1;let l=w=>{w.on("tileloadstart",()=>{O.tileRun===o&&(a++,O.tileStats.requested++,O.tileStats.peakPending=Math.max(O.tileStats.peakPending,a))});let S=T=>{O.tileRun===o&&(a=Math.max(0,a-1),T?O.tileStats.errors++:O.tileStats.loaded++,a===0&&O.tileStats.loaded>0&&(ge.loading.hidden=!0))};return w.on("tileloadend",()=>S(!1)),w.on("tileloaderror",()=>S(!0)),w},c=(w,S)=>l(new kj({projection:O.projection,tileGrid:new Ly({extent:[0,-O.volume.tileGrid.size,O.volume.tileGrid.size,0],origin:[0,0],resolutions:UG(w),tileSize:O.volume.tileGrid.tileSize}),cacheSize:64,interpolate:n.interpolate,transition:0,wrapX:!1,tileUrlFunction:([T,R,P])=>{let I=n.formats[T];if(!(!I||R<0||P<0||!S(T,R,P)))return`${O.volume.base}/tiles/${encodeURIComponent(n.tiles)}/${T}/${R}/${P}.${I}`}})),u=n.fullZoom??n.maxZoom,f=c(u,(w,S,T)=>YP(n,w,S,T)),d=O.layers.raster.getSource();O.layers.raster.setSource(f),O.layers.raster.setExtent(Vf()),O.layers.raster.setBackground(n.background||void 0),d?.clear();let A=O.layers.rasterDetail.getSource();n.maxZoom>u?(O.layers.rasterDetail.setSource(c(n.maxZoom,(w,S,T)=>w>u&&YP(n,w,S,T))),O.layers.rasterDetail.setExtent(Vf()),O.layers.rasterDetail.setVisible(!0)):O.layers.rasterDetail.setVisible(!1),A?.clear(),jy(),O.gridEnabled&&(Oc(),O.layers.pins.changed(),O.layers.text.changed(),O.layers.priority.changed()),O.overviewKey="",mce();let y=e&&O.restore?.world===O.world.slug?O.restore:null;if(O.renderedShard!==(n.shard||0)&&(m5(),Xl()),y?.center&&Number.isFinite(y.zoom)){let w=O.engine.getView();w.setCenter(y.center),w.setZoom(y.zoom),O.fitZoom=y.zoom,yA()}else e?requestAnimationFrame(d8e):(r&&O.engine.getView().animate({center:r,duration:200}),yA());ml()}function YP(i,e,t,n){let r=i.coverage?.[e];if(!r)return!0;let s=t-r.x,o=n-r.y;if(s<0||o<0||s>=r.w||o>=r.h)return!1;let a=h8e(i,e,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function h8e(i,e,t){if(!t.decoded){let n=atob(t.bits),r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);t.decoded=r}return t.decoded}function _h(i){return i.maxZoom+2}function Gx(){yA(),ml()}function f8e(i,e){if(!i||!e||!i.shard||!e.shard||i.shard===e.shard||!i.bounds||!e.bounds)return null;let n=O.engine?.getView()?.getCenter();if(!n)return null;let r=(n[0]-i.bounds.x)/i.bounds.width,s=(-n[1]-i.bounds.y)/i.bounds.height;return[e.bounds.x+us(r,0,1)*e.bounds.width,-(e.bounds.y+us(s,0,1)*e.bounds.height)]}function gce(){let e=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");ge.mobileLegend.setAttribute("aria-expanded",String(!e)),requestAnimationFrame(()=>O.engine?.updateSize())}function Vf(){let i=O.volume.tileGrid.size,e=O.lens?.bounds||{x:0,y:0,width:i,height:i};return[e.x,-(e.y+e.height),e.x+e.width,-e.y]}function d8e(){if(!O.engine||!O.lens)return;let i=O.engine.getView();i.fit(Vf(),{size:O.engine.getSize(),padding:[36,36,36,36],maxZoom:O.lens.maxZoom,duration:0}),O.fitZoom=i.getZoom()||0,yA()}function iT(i){let e=O.engine.getView(),t=e.getZoom()||0;e.animate({zoom:us(t+i,O.lens.minZoom,_h(O.lens)),duration:140})}function yA(){let i=O.engine?.getView().getZoom();if(ge.viewport.dataset.zoom=Number.isFinite(i)?i.toFixed(3):"",!O.engine||!O.world){ge.visibleCount.textContent="0 features enabled";return}let e=O.engine.getView().calculateExtent(O.engine.getSize()),t=O.eligibleLocations,n=0;for(let r of O.features){if(Vc(r))continue;let[s,o]=r.coordinate;s>=e[0]&&s<=e[2]&&o>=e[1]&&o<=e[3]&&n++}for(let r of O.zoneRecords.values())Po(r.zone.collectionId)||(t++,Ar(r.extent,e)&&n++);ge.visibleCount.textContent=`${jl(t)} features enabled \xB7 ${jl(n)} in view`}function vce(){ge.volume.addEventListener("change",()=>{hd(ge.volume.value)}),ge.world.addEventListener("change",()=>{kG(ge.world.value)}),ge.addBundles.addEventListener("click",()=>{w5()}),ge.emptyOpen.addEventListener("click",()=>{w5()}),ge.lens.addEventListener("change",()=>{zG(Number(ge.lens.value)),pce()}),ge.globeToggle.addEventListener("click",()=>jP()),ge.legend.addEventListener("change",n=>{let r=n.target;if(r.dataset.sectionToggle){o$(r.dataset.sectionToggle);return}if(!r.dataset.collection)return;let s=$l(r.dataset.collection);r.checked?O.hiddenCollections.delete(s):O.hiddenCollections.add(s),kp(),Xl(),vh()});let i=null,e=()=>{for(let s of ge.layers.querySelectorAll(".is-hovered"))s.classList.remove("is-hovered");if(!i)return;let r=document.elementFromPoint(i.x,i.y)?.closest(".category-row, .layer-header");r&&ge.layers.contains(r)&&r.classList.add("is-hovered")};ge.layers.addEventListener("pointermove",n=>{i={x:n.clientX,y:n.clientY},e()},{passive:!0}),ge.layers.addEventListener("pointerleave",()=>{i=null,e()}),ge.layers.addEventListener("scroll",e,{passive:!0}),ge.layers.addEventListener("click",n=>{let r=n.target.closest("[data-only-collection], [data-only-section]");if(r){n.preventDefault(),n.stopPropagation(),a$(r.dataset.onlyCollection?{collection:$l(r.dataset.onlyCollection)}:{section:r.dataset.onlySection});return}let s=n.target.closest("[data-expand-collection]");if(s){n.preventDefault(),n.stopPropagation(),t$($l(s.dataset.expandCollection));return}let o=n.target.closest("[data-label-toggle]");if(o){n.preventDefault(),n.stopPropagation(),i$($l(o.dataset.labelToggle));return}let a=n.target.closest("[data-render-toggle]");if(a){n.preventDefault(),n.stopPropagation(),s$($l(a.dataset.renderToggle));return}let l=n.target.closest("[data-zone]");if(l){v5(Number(l.dataset.zone));return}let c=n.target.closest("[data-section]");if(!c)return;let u=c.dataset.section;O.collapsedSections.has(u)?O.collapsedSections.delete(u):O.collapsedSections.add(u),QE()}),ge.layers.addEventListener("contextmenu",n=>{let r=n.target.closest("[data-zone]");r&&(n.preventDefault(),YX(Number(r.dataset.zone)))}),ge.soloChip.addEventListener("click",()=>i2(!0)),on("#expand-all").addEventListener("click",()=>y5(!1)),on("#collapse-all").addEventListener("click",()=>y5(!0)),on("#show-all").addEventListener("click",()=>i2(!0)),on("#hide-all").addEventListener("click",()=>i2(!1)),ge.search.addEventListener("input",()=>{O.search=ge.search.value.trim().toLocaleLowerCase(),Xl(),O.search&&Fy()}),ge.dockFold.addEventListener("click",()=>{bN(!O.dockFolded)}),ge.searchResults.addEventListener("click",n=>{let r=n.target.closest("[data-location], [data-zone]");if(!r)return;if(r.dataset.zone){v5(Number(r.dataset.zone));return}let s=O.featureByID.get(Number(r.dataset.location));s&&TN(s)}),ge.detailLinks.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=O.featureByID.get(Number(r.dataset.location));s&&TN(s)}),on("#close-detail").addEventListener("click",od),on("#zoom-in").addEventListener("click",()=>O.globeActive?DG(1):iT(1)),on("#zoom-out").addEventListener("click",()=>O.globeActive?DG(-1):iT(-1)),ge.gridBack.addEventListener("click",UN),ge.gridSystem.addEventListener("click",kN),ge.gridInput.addEventListener("input",()=>{let n=Ts(),r=n.normalizeInput(ge.gridInput.value);ge.gridInput.value=r,n.parseInput(r)!==null&&AA(r)}),ge.subgridToggle.addEventListener("click",()=>{Wy(!O.subgridVisible),ge.viewport.focus({preventScroll:!0})}),ge.gridInput.addEventListener("keydown",n=>{if(n.key===" "){n.preventDefault(),Wy(!O.subgridVisible);return}if(n.key==="`"){n.preventDefault(),ge.globeToggle.hidden||jP();return}n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),ge.viewport.focus({preventScroll:!0}))}),ge.viewport.addEventListener("keydown",n=>{if(!SE(n.target)){if(n.key==="+"||n.key==="=")iT(1);else if(n.key==="-")iT(-1);else if(n.key==="Escape")od();else return;n.preventDefault()}}),window.addEventListener("contextmenu",n=>{SE(n.target)||n.preventDefault()}),window.addEventListener("keydown",n=>{if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="r"){n.preventDefault(),location.reload();return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="g"){n.preventDefault(),kN();return}if(!SE(n.target)){if(n.key==="`"&&!n.metaKey&&!n.ctrlKey&&!n.altKey){ge.globeToggle.hidden||(n.preventDefault(),jP());return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="k"){n.preventDefault(),ge.search.focus(),ge.search.select();return}if((n.metaKey||n.ctrlKey)&&n.altKey&&n.code==="KeyB"){n.preventDefault(),ge.dock.hidden||bN(!O.dockFolded);return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="b"){n.preventDefault(),gce();return}lX(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),n.repeat||ZE(!0))}}),window.addEventListener("keyup",n=>{n.key.toLocaleLowerCase()==="z"&&ZE(!1)}),window.addEventListener("blur",()=>ZE(!1)),window.addEventListener("hashchange",()=>{let n=cv();n.volume===O.volume?.slug&&n.world===O.world?.slug||(O.restore=null,hd(n.volume||O.catalog.volumes[0].slug,n.world))}),window.addEventListener("resize",()=>{O.engine?.updateSize(),Vx(),BG()}),document.addEventListener("atlas:globe-camera",()=>Vx()),ge.overview.addEventListener("pointerdown",n=>{O.overviewDocked||n.pointerType==="mouse"&&n.button!==0||(n.preventDefault(),ge.overview.setPointerCapture(n.pointerId),O.overviewPointer=n.pointerId,OG(n,!0))}),ge.overview.addEventListener("pointermove",n=>{O.overviewPointer===n.pointerId&&(n.preventDefault(),OG(n,!1))});let t=n=>{O.overviewPointer===n.pointerId&&(O.overviewPointer=null,Gx())};ge.overview.addEventListener("pointerup",t),ge.overview.addEventListener("pointercancel",t),ge.overviewDock.addEventListener("click",()=>{$P(!O.overviewDocked),ge.viewport.focus({preventScroll:!0})}),ge.mobileLegend.addEventListener("click",()=>{let n=ge.sidebar.classList.toggle("is-open");ge.mobileLegend.setAttribute("aria-expanded",String(n))})}function _ce(){let i=()=>({volume:O.volume?.title,world:O.world?.title,lens:O.lens?.name,zoom:O.engine?.getView().getZoom(),center:O.engine?.getView().getCenter(),resolution:O.engine?.getView().getResolution(),nativeMaxZoom:O.lens?.maxZoom,maxZoom:O.lens?_h(O.lens):null,interpolate:O.lens?.interpolate,tileStats:{...O.tileStats},pins:O.features.length,eligibleLocations:O.eligibleLocations,domNodes:document.querySelectorAll("*").length,canvases:document.querySelectorAll("canvas").length,rasterCacheSize:64,labelsHeld:O.labelsHeld,hoveredPin:O.hoveredPin?.location.title||null,selectedPin:O.selectedPin?.location.title||null,fitZoom:O.fitZoom,filters:{hiddenCategories:[...O.hiddenCollections].sort(),collapsedSections:[...O.collapsedSections].sort()},ui:{sidebarCollapsed:document.querySelector(".app-shell")?.classList.contains("sidebar-collapsed")??!1,detailOpen:!ge.detail.hidden,detailTitle:ge.detail.hidden?null:ge.detailTitle.textContent||null,searchQuery:O.search,searchResultsVisible:!ge.searchResults.hidden,soloChip:ge.soloChip.hidden?null:ge.soloChip.textContent,visibleCountText:ge.visibleCount.textContent,overviewDocked:O.overviewDocked,dockFolded:O.dockFolded,dockDismissed:O.dockDismissed,subgridVisible:O.subgridVisible},zones:{visible:G1(),count:O.zoneRecords.size,focused:O.zoneRecords.get(O.focusedZoneID)?.zone.title||null,highlighted:[...O.highlightedZones].map(e=>O.zoneRecords.get(e)?.zone.title).filter(Boolean),focusedPins:O.features.filter(e=>!e.filteredHidden&&e.passesZoneFilters).length},grid:{enabled:O.gridEnabled,system:O.gridSystem,prefix:O.gridCell,maximumDepth:hX(),extent:O.gridEnabled?zN():null,cells:[...O.sources.grid.getFeatures(),...O.sources.gridContext.getFeatures()].map(e=>e.get("gridCell")),priorityPins:O.gridCell?O.features.filter(e=>!e.filteredHidden&&Fp(e)).length:0}});window.__atlasDebug={snapshot:i,setLayerVisible:(e,t)=>O.layers[e]?.setVisible(t),refreshCatalog:bA},window.render_game_to_text=()=>JSON.stringify({coordinateSystem:"ATLAS:PIXELS; origin top-left; x increases right; y decreases downward",...i()}),window.advanceTime=()=>O.engine?.renderSync()}async function xce(){vce();try{let i=await fetch("/data/catalog.json");if(!i.ok)throw new Error(`catalog request returned ${i.status}`);if(O.catalog=await i.json(),Hm(ge.volume,O.catalog.volumes,"title"),b5(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{bA()}),O.catalog.volumes.length){let e=cv(),t=lv(),n=t&&(!e.volume||e.volume===t.volume&&e.world===t.world);O.restore=n?t:null,await hd(e.volume||t?.volume||O.catalog.volumes[0].slug,e.world||t?.world),O.restore=null}else ge.loading.hidden=!0;_ce(),requestAnimationFrame(()=>ge.viewport.focus({preventScroll:!0}))}catch(i){ge.loading.hidden=!0,ge.fatalMessage.textContent=i instanceof Error?i.message:String(i),ge.fatal.hidden=!1}}xce();})();5289+}`;M6e(C6e);function CG(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function R6e(i){if(Array.isArray(i))return CG(i)}function ZS(i,e,t){return(e=F6e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function P6e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function I6e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5290+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qle(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function _1(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qle(Object(t),!0).forEach(function(n){ZS(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):qle(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function L6e(i,e){if(i==null)return{};var t,n,r=D6e(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function D6e(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function FI(i){return R6e(i)||P6e(i)||B6e(i)||I6e()}function N6e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function F6e(i){var e=N6e(i,"string");return typeof e=="symbol"?e:e+""}function B6e(i,e){if(i){if(typeof i=="string")return CG(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?CG(i,e):void 0}}function Hle(i,e){var t=new e;return t._destructor&&t._destructor(),{linkProp:function(r){return{default:t[r](),onChange:function(o,a){a[i][r](o)},triggerUpdate:!1}},linkMethod:function(r){return function(s){for(var o=s[i],a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];var u=o[r].apply(o,l);return u===o?this:u}}}}var O6e=["rendererConfig","waitForGlobeReady"],YS=_1(_1({},window.THREE?window.THREE:{AmbientLight:JA,DirectionalLight:QA,Vector2:Oe,REVISION:"185"}),{},{CSS2DRenderer:YM}),Wle=Hle("globe",YV),U6e=Object.assign.apply(Object,FI(["globeImageUrl","bumpImageUrl","globeTileEngineUrl","globeTileEngineMaxLevel","globeCurvatureResolution","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude","onGlobeReady","pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration","arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration","polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration","pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration","heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration","hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration","hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration","tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration","particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture","ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod","labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration","htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration","objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject","customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return ZS({},i,Wle.linkProp(i))}))),k6e=Object.assign.apply(Object,FI(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return ZS({},i,Wle.linkMethod(i))}))),jle=Hle("renderObjs",MG),z6e=Object.assign.apply(Object,FI(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return ZS({},i,jle.linkProp(i))}))),V6e=Object.assign.apply(Object,FI(["lights","postProcessingComposer"].map(function(i){return ZS({},i,jle.linkMethod(i))}))),Xle=Qr({props:_1(_1({onZoom:{triggerUpdate:!1},onGlobeClick:{triggerUpdate:!1},onGlobeRightClick:{triggerUpdate:!1},pointLabel:{default:"name",triggerUpdate:!1},onPointClick:{triggerUpdate:!1},onPointRightClick:{triggerUpdate:!1},onPointHover:{triggerUpdate:!1},arcLabel:{default:"name",triggerUpdate:!1},onArcClick:{triggerUpdate:!1},onArcRightClick:{triggerUpdate:!1},onArcHover:{triggerUpdate:!1},polygonLabel:{default:"name",triggerUpdate:!1},onPolygonClick:{triggerUpdate:!1},onPolygonRightClick:{triggerUpdate:!1},onPolygonHover:{triggerUpdate:!1},pathLabel:{default:"name",triggerUpdate:!1},onPathClick:{triggerUpdate:!1},onPathRightClick:{triggerUpdate:!1},onPathHover:{triggerUpdate:!1},onHeatmapClick:{triggerUpdate:!1},onHeatmapRightClick:{triggerUpdate:!1},onHeatmapHover:{triggerUpdate:!1},hexLabel:{triggerUpdate:!1},onHexClick:{triggerUpdate:!1},onHexRightClick:{triggerUpdate:!1},onHexHover:{triggerUpdate:!1},hexPolygonLabel:{triggerUpdate:!1},onHexPolygonClick:{triggerUpdate:!1},onHexPolygonRightClick:{triggerUpdate:!1},onHexPolygonHover:{triggerUpdate:!1},tileLabel:{default:"name",triggerUpdate:!1},onTileClick:{triggerUpdate:!1},onTileRightClick:{triggerUpdate:!1},onTileHover:{triggerUpdate:!1},particleLabel:{default:"name",triggerUpdate:!1},onParticleClick:{triggerUpdate:!1},onParticleRightClick:{triggerUpdate:!1},onParticleHover:{triggerUpdate:!1},labelLabel:{triggerUpdate:!1},onLabelClick:{triggerUpdate:!1},onLabelRightClick:{triggerUpdate:!1},onLabelHover:{triggerUpdate:!1},objectLabel:{default:"name",triggerUpdate:!1},onObjectClick:{triggerUpdate:!1},onObjectRightClick:{triggerUpdate:!1},onObjectHover:{triggerUpdate:!1},customLayerLabel:{default:"name",triggerUpdate:!1},onCustomLayerClick:{triggerUpdate:!1},onCustomLayerRightClick:{triggerUpdate:!1},onCustomLayerHover:{triggerUpdate:!1},pointerEventsFilter:{default:function(){return!0},triggerUpdate:!1},lineHoverPrecision:{default:.2,triggerUpdate:!1,onChange:function(e,t){t.renderObjs.lineHoverPrecision(e),t.renderObjs.pointsHoverPrecision(e)}},showPointerCursor:{default:!0,triggerUpdate:!1},globeOffset:{default:[0,0],triggerUpdate:!1,onChange:function(e,t){return Array.isArray(e)&&e.length===2&&t.renderObjs.viewOffset(e.map(function(n){return-n}))}}},U6e),z6e),methods:_1(_1({pauseAnimation:function(e){var t;return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),(t=e.globe)===null||t===void 0||t.pauseAnimation(),this},resumeAnimation:function(e){var t;return e.animationFrameRequestId===null&&this._animationCycle(),(t=e.globe)===null||t===void 0||t.resumeAnimation(),this},_animationCycle:function(e){e.renderObjs.tick(),e.tweenGroup.update(),e.animationFrameRequestId=requestAnimationFrame(this._animationCycle)},pointOfView:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=a();if(t.lat===void 0&&t.lng===void 0&&t.altitude===void 0)return r;var s,o=Object.assign({},r,t);if(["lat","lng","altitude"].forEach(function(c){return o[c]=+o[c]}),(s=e.povTween)===null||s===void 0||s.end(),!n)l(o);else{for(;r.lng-o.lng>180;)r.lng-=360;for(;r.lng-o.lng<-180;)r.lng+=360;e.tweenGroup.add(e.povTween=new uo(r).to(o,n).easing(Jr.Cubic.InOut).onUpdate(l).onComplete(function(){e.povTween=void 0,e.tweenGroup.remove(this)}).start())}return this;function a(){return e.globe.toGeoCoords(e.renderObjs.cameraPosition())}function l(c){var u=c.lat,f=c.lng,d=c.altitude;e.renderObjs.cameraPosition(e.globe.getCoords(u,f,d)),e.globe.setPointOfView(e.renderObjs.camera())}},getScreenCoords:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];var o=(t=e.globe).getCoords.apply(t,r);return e.renderObjs.getScreenCoords(o.x,o.y,o.z)},toGlobeCoords:function(e,t,n){var r=e.renderObjs.intersectingObjects(t,n).find(function(l){return(l.object.__globeObjType||l.object.parent.__globeObjType)==="globe"});if(!r)return null;var s=e.globe.toGeoCoords(r.point),o=s.lat,a=s.lng;return{lat:o,lng:a}},scene:function(e){return e.renderObjs.scene()},camera:function(e){return e.renderObjs.camera()},renderer:function(e){return e.renderObjs.renderer()},controls:function(e){return e.renderObjs.controls()},_destructor:function(e){this.pauseAnimation(),this.pointsData([]),this.arcsData([]),this.polygonsData([]),this.pathsData([]),this.heatmapsData([]),this.hexBinPointsData([]),this.hexPolygonsData([]),this.tilesData([]),this.particlesData([]),this.labelsData([]),this.htmlElementsData([]),this.objectsData([]),this.customLayerData([]),e.globe._destructor(),e.renderObjs._destructor()}},k6e),V6e),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=L6e(e,O6e),o=new YV(_1({waitForGlobeReady:r},s));return{globe:o,renderObjs:MG({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new YS.CSS2DRenderer]}).skyRadius(o.getGlobeRadius()*500).showNavInfo(!1).objects([o]).lights([new YS.AmbientLight(13421772,Math.PI),new YS.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new Ag}},init:function(e,t){var n=this;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.style.position="relative";var r=document.createElement("div");t.container.appendChild(r),t.renderObjs(r),t.globe.rendererSize(t.renderObjs.renderer().getSize(new YS.Vector2)),this.pointOfView({altitude:2.5});var s=t.globe.getGlobeRadius(),o=t.renderObjs.controls();t.renderObjs.camera().near=.05,o.minDistance=s+Math.max(.001,t.renderObjs.camera().near*1.1),o.maxDistance=s*100,o.enablePan=!1,o.enableDamping=!0,o.dampingFactor=.1,o.rotateSpeed=.3,o.zoomSpeed=.3,o.zoomToCursor=!0,o.addEventListener("change",function(){o.target.setScalar(0);var c=n.pointOfView();o.rotateSpeed=c.altitude*.3,o.zoomSpeed=Math.sqrt(c.altitude)*.5,t.globe.setPointOfView(t.renderObjs.camera()),t.onZoom&&t.onZoom(c)});var a=function(u){for(var f=u;f&&!f.hasOwnProperty("__globeObjType");)f=f.parent;return f},l={point:function(u){return u},arc:function(u){return u},polygon:function(u){return u.data},path:function(u){return u},heatmap:function(u){return u},hexbin:function(u){return u},hexPolygon:function(u){return u},tile:function(u){return u},particles:function(u,f){return!f||!f.hasOwnProperty("index")||u.length<=f.index?u:u[f.index]},label:function(u){return u},object:function(u){return u},custom:function(u){return u}};YS.REVISION<155&&(t.renderObjs.renderer().useLegacyLights=!1),t.renderObjs.hoverFilter(function(c){var u=a(c);if(!u)return!1;var f=u.__globeObjType;if(f!=="globe"&&!l.hasOwnProperty(f))return!1;var d=l.hasOwnProperty(f)&&u.__data?l[f](u.__data):null;return["points","hexBinPoints"].some(function(A){return A===f})&&Array.isArray(d)?!1:t.pointerEventsFilter(u,d)}).tooltipContent(function(c,u){var f={point:t.pointLabel,arc:t.arcLabel,polygon:t.polygonLabel,path:t.pathLabel,hexbin:t.hexLabel,hexPolygon:t.hexPolygonLabel,tile:t.tileLabel,particles:t.particleLabel,label:t.labelLabel,object:t.objectLabel,custom:t.customLayerLabel},d=a(c),A=d&&d.__globeObjType;return d&&A&&f.hasOwnProperty(A)&&l.hasOwnProperty(A)&&st(f[A])(l[A](d.__data,u))||""}).onHover(function(c,u,f){var d={point:t.onPointHover,arc:t.onArcHover,polygon:t.onPolygonHover,path:t.onPathHover,heatmap:t.onHeatmapHover,hexbin:t.onHexHover,hexPolygon:t.onHexPolygonHover,tile:t.onTileHover,particles:t.onParticleHover,label:t.onLabelHover,object:t.onObjectHover,custom:t.onCustomLayerHover},A={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},y=a(c);if(y&&!d.hasOwnProperty(y.__globeObjType)&&(y=null),y!==t.hoverObj){var w,S=t.hoverObj?t.hoverObj.__globeObjType:null,T=t.hoverData,R=y?y.__globeObjType:null,I=(w=y)!==null&&w!==void 0&&w.__data?l[R](y.__data,f):null;S&&S!==R&&d[S]&&d[S](null,T||null),R&&d[R]&&d[R](I,S===R?T:null),t.renderObjs.renderer().domElement.classList[R&&A[R]&&st(t.showPointerCursor)(R,I)?"add":"remove"]("clickable"),t.hoverObj=y,t.hoverData=I}}).onClick(function(c,u,f){if(c){var d={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},A=a(c),y=A.__globeObjType;if(A&&d.hasOwnProperty(y)&&d[y]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(y==="globe"){var T=n.toGeoCoords(S),R=T.lat,I=T.lng;w.unshift({lat:R,lng:I})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(y)&&w.unshift(l[y](A.__data,f)),d[y].apply(d,w)}}}).onRightClick(function(c,u,f){if(c){var d={globe:t.onGlobeRightClick,point:t.onPointRightClick,arc:t.onArcRightClick,polygon:t.onPolygonRightClick,path:t.onPathRightClick,heatmap:t.onHeatmapRightClick,hexbin:t.onHexRightClick,hexPolygon:t.onHexPolygonRightClick,tile:t.onTileRightClick,particles:t.onParticleRightClick,label:t.onLabelRightClick,object:t.onObjectRightClick,custom:t.onCustomLayerRightClick},A=a(c),y=A.__globeObjType;if(A&&d.hasOwnProperty(y)&&d[y]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(y==="globe"){var T=n.toGeoCoords(S),R=T.lat,I=T.lng;w.unshift({lat:R,lng:I})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(y)&&w.unshift(l[y](A.__data,f)),d[y].apply(d,w)}}}),this._animationCycle()}});var Zle=4,Fx=100,JS=Fx+.2,rp=8,G6e=96,Kle=.045,Qle=.08;function Bx(i,e,t){let n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}var Yn=null,OI="",Ds={group:null,tiles:new Map,key:"",lens:""},Mo={group:null,cell:null,fitKey:""},au={group:null,key:""},q6e=180,PG=null,Ox=new Map,zI=new Map,$le=new Map;function Jle(){let i=UT(O.world)==="sphere"&&lh(O.world)!==null;ge.globeToggle.hidden=!i,ece(),!i&&Yn&&(KS(),Ds.group=null,Mo.group=null,Mo.cell=null,au.group=null,au.key="",Yn._destructor(),Yn=null,OI="",PG=null,ge.globe.replaceChildren())}function VI(){O.globeActive?ece():ice()}var QS=2.5,UI=2,Ux=.08,GI=4;function H6e(i){let e=Number.isFinite(i)?i:UI;return us(QS/2**(e-UI),Ux,GI)}function LG(i){let e=Number.isFinite(i)?Math.max(i,Ux/2):QS,t=(O.lens?.maxZoom??UI)+2;return us(UI+Math.log2(QS/e),0,t)}function DG(i){if(!Yn||!O.globeActive)return;let e=Yn.pointOfView(),t=us((Number.isFinite(e.altitude)?e.altitude:QS)/2**i,Ux,GI);Yn.pointOfView({altitude:t},180)}function ece(){let i=lh(O.world),e=O.engine?.getView();if(Yn&&O.globeActive&&i&&e){let t=Yn.pointOfView(),[n,r]=i.toWorld(t.lat,t.lng);Number.isFinite(n)&&Number.isFinite(r)&&(e.cancelAnimations(),e.setCenter([n,-r]),e.setZoom(LG(t.altitude)))}O.globeActive=!1,ge.globe.hidden=!0,ge.globeToggle.setAttribute("aria-pressed","false"),ge.viewport.hidden=!1,KS(),O.overviewKey="",document.dispatchEvent(new Event("atlas:globe-camera"))}function tce(){if(!Yn||!O.globeActive)return null;let i=Yn.pointOfView();return{lat:i.lat,lng:i.lng}}function nce(i,e,t){if(!Yn)return;let n=Yn.pointOfView().altitude;Yn.pointOfView({lat:i,lng:e,altitude:n},t?180:0)}async function ice(){let i=lh(O.world);if(!i)return;if(O.globeActive=!0,ge.viewport.hidden=!0,ge.globe.hidden=!1,ge.globeToggle.setAttribute("aria-pressed","true"),O.overviewKey="",!Yn){Yn=Xle({animateIn:!1})(ge.globe).backgroundColor("#0b0e12").showAtmosphere(!0).atmosphereColor("#8a6f5b").atmosphereAltitude(.12).objectLat(o=>o.lat).objectLng(o=>o.lng).objectAltitude(o=>o.pin===O.selectedPin?.03:.014).objectThreeObject(o=>n8e(o.pin)).objectLabel(o=>o.pin.location.title).onObjectClick(o=>Fy(o.pin)).onObjectHover(o=>{ge.globe.style.cursor=o?"pointer":""}).onZoom(()=>{document.dispatchEvent(new Event("atlas:globe-camera")),Yle(),BI(),i8e(),FG()}),document.addEventListener("atlas:selection",t8e),document.addEventListener("atlas:filters",RG),document.addEventListener("atlas:grid",()=>{kI(),RG(),BI()}),document.addEventListener("atlas:labels",BI),Yn.onGlobeClick(({lat:o,lng:a})=>{if(!O.gridEnabled)return;let l=lh(O.world);if(!l)return;let[c,u]=l.toWorld(o,a),f=Ss().descendTarget(O.gridCell,[c,-u]);f&&mA(f)});let s=Yn.controls();s.minDistance=Fx*(1+Ux),s.maxDistance=Fx*(1+GI),Ds.group=new Br,Yn.scene().add(Ds.group),Mo.group=new Br,Yn.scene().add(Mo.group),au.group=new Br,Yn.scene().add(au.group),window.__atlasGlobe={detail:Ds,grid:Mo,labels:au,sprites:Ox}}BG();let e=O.engine?.getView(),t=e?.getCenter();if(t&&Number.isFinite(t[0])&&Number.isFinite(t[1])){let[s,o]=i.toLatLng(t[0],-t[1]);Yn.pointOfView({lat:s,lng:o,altitude:H6e(e.getZoom())})}else Yn.pointOfView({lat:10,lng:0,altitude:QS});let n=O.lens||O.world.lenses[0],r=`${O.volume.stamp}:${O.world.slug}:${n.tiles}`;if(OI!==r){OI=r;let s=await s8e(n);s&&OI===r&&Yn.globeImageUrl(s)}PG!==O.features&&(PG=O.features,Ox.clear(),zI.clear(),Yn.objectsData(r8e(i))),RG(),ace(),Yle(),kI(),BI(),document.dispatchEvent(new Event("atlas:globe-camera"))}function kI(){if(!Yn||!Mo.group)return;for(let t of[...Mo.group.children])Mo.group.remove(t),t.geometry?.dispose(),t.material?.map?.dispose(),t.material?.dispose();let i=O.globeActive?lh(O.world):null;if(!i||!O.gridEnabled){Mo.cell=null;return}let e=Ss();for(let t of LE()){let n=rce(t.ring,i),r=NG(n),s=IE(t,{subgridVisible:O.subgridVisible,labelled:X6e(t,r)});if(s){if(s.fill){let o=sce(e.center(t.hash),i);Mo.group.add($6e(n,o,s.fill))}Mo.group.add(K6e(n,s.line)),s.label&&Mo.group.add(Q6e(s.label,r))}}Mo.cell!==null&&Mo.cell!==O.gridCell&&J6e(i),Mo.cell=O.gridCell,FG()}function rce(i,e){return i.map(([t,n])=>e.toLatLng(t,-n))}function sce(i,e){return e.toLatLng(i[0],-i[1])}function W6e(i){let e=[];for(let t=0;t<i.length-1;t++){let[n,r]=i[t],[s,o]=i[t+1],a=Math.max(Math.abs(s-n),Math.abs(o-r)),l=us(Math.ceil(a/2),1,48);for(let c=0;c<l;c++){let u=c/l;e.push([n+(s-n)*u,r+(o-r)*u])}}return e}function NG(i){let e=-1/0,t=1/0,n=1/0,r=-1/0;for(let[s,o]of i)e=Math.max(e,s),t=Math.min(t,s),n=Math.min(n,o),r=Math.max(r,o);return{north:e,south:t,west:n,east:r}}function j6e(i){let e=Yn.pointOfView(),t=Math.max(e.altitude,Ux/2),n=50*Math.PI/180,r=2*t*Fx*Math.tan(n/2)/Math.max(1,ge.globe.clientHeight||1),s=Fx*Math.PI/180/r;return{width:Math.abs(i.east-i.west)*s,height:Math.abs(i.north-i.south)*s}}function X6e(i,e){let n=i.role==="neighbor"?Vi.neighborLabelSizePx:Vi.labelSizePx,r=`900 ${n}px ${Vi.labelFont}`,s=j6e(e);return l5(i.hash,r)+9<=s.width&&n+6<=s.height}function $6e(i,e,t){let n=JS+.12,r=W6e(i),s=NG(i),o=Math.max(s.east-s.west,s.north-s.south),a=us(Math.ceil(o/6),2,24),l=Bx(e[0],e[1],n),c=r.map(([T,R])=>Bx(T,R,n)),u=[...l],f=[];for(let T=1;T<=a;T++){let R=T/a;for(let I of c){let P=l[0]+(I[0]-l[0])*R,F=l[1]+(I[1]-l[1])*R,D=l[2]+(I[2]-l[2])*R,L=n/(Math.hypot(P,F,D)||1);u.push(P*L,F*L,D*L)}}let d=r.length,A=(T,R)=>1+(T-1)*d+R%d;for(let T=0;T<d;T++)f.push(0,A(1,T),A(1,T+1));for(let T=1;T<a;T++)for(let R=0;R<d;R++)f.push(A(T,R),A(T+1,R),A(T,R+1)),f.push(A(T,R+1),A(T+1,R),A(T+1,R+1));let y=new Xn;y.setAttribute("position",new Ln(u,3)),y.setIndex(f);let w=new fs({color:t.color,transparent:!0,opacity:t.opacity,depthWrite:!1,side:2}),S=new Hn(y,w);return S.renderOrder=1,S}function BI(){if(!Yn||!au.group)return;let i=O.globeActive&&O.labelsHeld,e=i?Yn.pointOfView():null,t=i?`${Math.round(e.lat)}:${Math.round(e.lng)}:${e.altitude.toFixed(2)}:${O.gridSystem}:${O.gridCell}`:"";if(t===au.key)return;au.key=t;for(let r of[...au.group.children])au.group.remove(r),r.material?.map?.dispose(),r.material?.dispose();if(!i)return;let n=[];for(let[r,s]of Ox){if(!s.visible)continue;let o=zI.get(r);if(!o)continue;let a=Y6e(e,o);a>85||n.push({pin:r,stood:o,distance:a})}n.sort((r,s)=>r.distance-s.distance);for(let{pin:r,stood:s}of n.slice(0,q6e))au.group.add(Z6e(r,s));FG()}function FG(){if(!Yn)return;let i=Yn.camera().position,e=i.length()||1,t=Fx/e;for(let n of[Mo.group,au.group])if(n)for(let r of n.children){if(!r.isSprite)continue;let s=r.position,o=s.length()||1,a=(s.x*i.x+s.y*i.y+s.z*i.z)/(o*e);r.visible=a>t}}function Y6e(i,e){let t=Math.PI/180,n=Math.sin(i.lat*t)*Math.sin(e.lat*t)+Math.cos(i.lat*t)*Math.cos(e.lat*t)*Math.cos((i.lng-e.lng)*t);return Math.acos(us(n,-1,1))*180/Math.PI}function Z6e(i,e){let t=i.location.title,n=document.createElement("canvas"),r=n.getContext("2d"),s="600 26px Inter, system-ui, sans-serif";r.font=s;let o=Math.ceil(r.measureText(t).width)+24;n.width=o,n.height=40,r.font=s,r.textAlign="center",r.textBaseline="middle",r.fillStyle="rgba(10, 13, 17, 0.78)",r.fillRect(0,0,o,40),r.fillStyle="#e6ebf0",r.fillText(t,o/2,21);let a=new Rh({depthTest:!1,depthWrite:!1,sizeAttenuation:!1,transparent:!0});new bl().load(n.toDataURL("image/png"),u=>{a.map=u,a.needsUpdate=!0});let l=new qA(a);l.position.set(...Bx(e.lat,e.lng,JS+.4)),l.renderOrder=4;let c=.028;return l.scale.set(c*o/40,c,1),l.center.set(.5,0),l}function K6e(i,e){let t=[];for(let o=0;o<i.length-1;o++){let[a,l]=i[o],[c,u]=i[o+1],f=Math.max(Math.abs(c-a),Math.abs(u-l)),d=us(Math.ceil(f/2),4,48);for(let A=0;A<d;A++){let y=A/d;t.push(...Bx(a+(c-a)*y,l+(u-l)*y,JS+.25))}}t.push(...t.slice(0,3));let n=new Tm;n.setPositions(t);let r=new Rf({color:e.color,transparent:!0,opacity:e.opacity,linewidth:e.widthPx,depthWrite:!1});r.resolution.set(ge.globe.clientWidth||1,ge.globe.clientHeight||1);let s=new Mx(n,r);return s.computeLineDistances(),s.renderOrder=2,s}function Q6e(i,e){let n=i.sizePx*2,r=`500 ${n}px ${Vi.labelFont}`,s=`900 ${n}px ${Vi.labelFont}`,o=document.createElement("canvas"),a=o.getContext("2d");a.font=r;let l=i.prefix?a.measureText(i.prefix).width:0;a.font=s;let c=a.measureText(i.final).width,u=10;o.width=Math.ceil(l+c+u*2),o.height=n+u*1.4,a.fillStyle=i.chip,a.fillRect(0,0,o.width,o.height),a.textBaseline="middle";let f=o.height/2+2;i.prefix&&(a.font=r,a.fillStyle=i.color,a.globalAlpha=Vi.prefixAlpha*i.textAlpha,a.fillText(i.prefix,u,f)),a.font=s,a.globalAlpha=i.textAlpha,a.fillStyle=i.color,a.fillText(i.final,u+l,f),a.globalAlpha=1;let d=new Rh({depthTest:!1,depthWrite:!1,transparent:!0,sizeAttenuation:!1});new bl().load(o.toDataURL("image/png"),R=>{d.map=R,d.needsUpdate=!0});let A=new qA(d),y=Math.abs(e.north-e.south)*.02,w=Math.abs(e.east-e.west)*.02;A.position.set(...Bx(e.south+y,e.east-w,JS+.35));let S=Math.max(1,ge.globe.clientHeight||1),T=o.height/2/S;return A.scale.set(T*o.width/o.height,T,1),A.center.set(1,0),A.renderOrder=3,A}function J6e(i){let t=LE().find(l=>l.role==="scope"||l.role==="leaf");if(!t)return;let[n,r]=sce(Ss().center(t.hash),i),s=NG(rce(t.ring,i)),o=Math.max(s.east-s.west,s.north-s.south),a=us(o/45,Ux,GI);Yn.pointOfView({lat:n,lng:r,altitude:a},400)}function Yle(){if(!Yn||!Ds.group)return;let i=O.globeActive?O.lens||O.world.lenses[0]:null;if(!i){KS();return}Ds.lens!==i.tiles&&(KS(),Ds.lens=i.tiles);let e=Yn.pointOfView(),t=Math.min(Math.round(LG(e.altitude))+1,i.maxZoom);if(t<=Zle||!i.formats[t]){KS(),Ds.key="";return}let n=2**t,r=n/2,s=360/n,o=Math.acos(1/(1+e.altitude))*180/Math.PI+s,a=Math.floor(((e.lng+180)%360+360)%360/s),l=Math.floor((90-e.lat)/s),c=Math.ceil(o/s);for(;(2*c+1)**2>G6e&&c>1;)c--;let u=new Set;for(let d=-c;d<=c;d++){let A=l+d;if(!(A<0||A>=r))for(let y=-c;y<=c;y++){let w=((a+y)%n+n)%n;u.add(`${t}/${w}/${A}`)}}let f=`${i.tiles}:${[...u].sort().join(",")}`;if(f!==Ds.key){Ds.key=f;for(let[d,A]of Ds.tiles)u.has(d)||(Ds.group.remove(A),oce(A),Ds.tiles.delete(d));for(let d of u){if(Ds.tiles.has(d))continue;let[A,y,w]=d.split("/").map(Number),S=e8e(i,A,y,w);Ds.tiles.set(d,S),Ds.group.add(S)}}}function e8e(i,e,t,n){let r=360/2**e,s=-180+t*r,o=90-n*r,a=[],l=[],c=[];for(let w=0;w<=rp;w++){let S=o-w/rp*r;for(let T=0;T<=rp;T++){let R=s+T/rp*r;a.push(...Bx(S,R,JS)),l.push(T/rp,1-w/rp)}}let u=rp+1;for(let w=0;w<rp;w++)for(let S=0;S<rp;S++){let T=w*u+S;c.push(T,T+u,T+1),c.push(T+1,T+u,T+u+1)}let f=new Xn;f.setAttribute("position",new Ln(a,3)),f.setAttribute("uv",new Ln(l,2)),f.setIndex(c);let d=new fs,A=new Hn(f,d);A.visible=!1;let y=`${O.volume.base}/tiles/${i.tiles}/${e}/${t}/${n}.${i.formats[e]}`;return new bl().load(y,w=>{w.colorSpace=Fr,d.map=w,d.needsUpdate=!0,A.visible=!0}),A}function KS(){if(Ds.group){for(let i of Ds.tiles.values())Ds.group.remove(i),oce(i);Ds.tiles.clear(),Ds.key=""}}function oce(i){i.geometry.dispose(),i.material.map?.dispose(),i.material.dispose()}function ace(){if(Yn){for(let[i,e]of Ox){let t=i===O.selectedPin;e.material=cce(i.category,t);let n=t?Qle:Kle;e.scale.set(n,n,1)}Yn.objectAltitude(i=>i.pin===O.selectedPin?.03:.014)}}function t8e(){if(!Yn||!O.globeActive)return;ace();let i=zI.get(O.selectedPin);if(i){let e=Yn.pointOfView().altitude;Yn.pointOfView({lat:i.lat,lng:i.lng,altitude:e},600)}}function lce(i){return!(i.filteredHidden||Io(i.category.id)||O.gridEnabled&&O.gridCell&&!Lp(i))}function RG(){if(!(!Yn||!O.globeActive))for(let[i,e]of Ox)e.visible=lce(i)}function n8e(i){let e=new qA(cce(i.category,i===O.selectedPin)),t=i===O.selectedPin?Qle:Kle;return e.scale.set(t,t,1),e.visible=lce(i),Ox.set(i,e),e}function cce(i,e){let t=`${Jy(i)}:${e?"ringed":"plain"}`,n=$le.get(t);if(n)return n;n=new Rh({depthWrite:!1,sizeAttenuation:!1}),$le.set(t,n);let r=O.markerIcons.get(Jy(i)),s=o=>{let a=document.createElement("canvas");a.width=80,a.height=80;let l=a.getContext("2d");o?l.drawImage(o,8,8,64,64):(l.font="900 26px Inter, system-ui, sans-serif",l.textAlign="center",l.textBaseline="middle",l.lineWidth=6,l.strokeStyle=hA(),l.strokeText(bu(i.title),40,41),l.fillStyle=fA(i),l.fillText(bu(i.title),40,41)),e&&(l.beginPath(),l.arc(40,40,36,0,Math.PI*2),l.lineWidth=5,l.strokeStyle="#ffffff",l.stroke()),new bl().load(a.toDataURL("image/png"),c=>{n.map=c,n.needsUpdate=!0})};if(r){let o=new Image;o.onload=()=>s(o),o.onerror=()=>s(null),o.src=r}else s(null);return n}function uce(){O.globeActive&&ice()}function BG(){!Yn||ge.globe.hidden||(Yn.width(ge.globe.clientWidth).height(ge.globe.clientHeight),kI())}function i8e(){if(!Yn||!O.globeActive||!O.gridEnabled)return;let i=Yn.pointOfView(),e=`${O.gridSystem}:${O.gridCell}:${Math.round(LG(i.altitude)*2)}`;e!==Mo.fitKey&&(Mo.fitKey=e,kI())}function r8e(i){let e=[];for(let t of O.features){let[n,r]=pv(t.location.lat,t.location.lng),[s,o]=i.toLatLng(n,-r);e.push({lat:s,lng:o,pin:t}),zI.set(t,{lat:s,lng:o})}return e}async function s8e(i){let e=Math.min(Zle,i.maxZoom),t=i.formats[e];if(!t)return null;let n=2**e,r=n/2,s=document.createElement("canvas");s.width=n*256,s.height=r*256;let o=s.getContext("2d"),a=[];for(let l=0;l<r;l++)for(let c=0;c<n;c++){let u=`${O.volume.base}/tiles/${i.tiles}/${e}/${c}/${l}.${t}`;a.push(o8e(u).then(f=>{f&&o.drawImage(f,c*256,l*256,256,256)}))}return await Promise.all(a),s.toDataURL("image/jpeg",.92)}function o8e(i){return new Promise(e=>{let t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=i})}function hce(){let i=O.lens,e=ge.overviewCanvas,t=e.getContext("2d"),n=Of(),r=O.volume.tileGrid.size,s=O.volume.tileGrid.tileSize,o=n[2]-n[0],a=n[3]-n[1],l=0;for(;l<i.fullZoom&&Math.max(o,a)/r*s*2**l<168;)l++;let c=s*2**l/r;e.width=Math.max(1,Math.round(o*c)),e.height=Math.max(1,Math.round(a*c)),t.clearRect(0,0,e.width,e.height),i.background&&(t.fillStyle=i.background,t.fillRect(0,0,e.width,e.height));let u=++O.overviewRun,f=i.formats[l],d=Math.floor(n[0]/r*2**l),A=Math.ceil(n[2]/r*2**l),y=Math.floor(-n[3]/r*2**l),w=Math.ceil(-n[1]/r*2**l);for(let S=y;S<w;S++)for(let T=d;T<A;T++){if(!f||!HI(i,l,T,S))continue;let R=new Image;R.onload=()=>{O.overviewRun===u&&t.drawImage(R,T*s-n[0]*c,S*s+n[3]*c,s,s)},R.src=`${O.volume.base}/tiles/${encodeURIComponent(i.tiles)}/${l}/${T}/${S}.${f}`}kx()}function kx(){let i=tce();if(i){let w=lh(O.world);if(!w||!O.lens)return;let S=Of(),[T,R]=w.toWorld(i.lat,i.lng),I=ge.overviewCanvas,P=us((T-S[0])/(S[2]-S[0]),0,1),F=us((R+S[3])/(S[3]-S[1]),0,1);O.overviewKey="",ge.overviewShelf.hidden=!1;let D=ge.overviewViewport.style,L=22;D.left=`${P*I.width-L/2}px`,D.top=`${F*I.height-L/2}px`,D.width=`${L}px`,D.height=`${L}px`;return}let e=O.engine?.getView();if(!e||!O.lens)return;let t=Of(),n=e.calculateExtent(O.engine.getSize()),r=t[2]-t[0],s=t[3]-t[1],o=(e.getResolution()||0)*4,a=n[0]<=t[0]+o&&n[1]<=t[1]+o&&n[2]>=t[2]-o&&n[3]>=t[3]-o,l=a?"hidden":n.map(Math.round).join(",");if(l===O.overviewKey||(O.overviewKey=l,ge.overviewShelf.hidden=a,a))return;let c=ge.overviewCanvas,u=us((n[0]-t[0])/r,0,1),f=us((n[2]-t[0])/r,0,1),d=us((t[3]-n[3])/s,0,1),A=us((t[3]-n[1])/s,0,1),y=ge.overviewViewport.style;y.left=`${u*c.width}px`,y.top=`${d*c.height}px`,y.width=`${Math.max(8,(f-u)*c.width)}px`,y.height=`${Math.max(8,(A-d)*c.height)}px`}function qI(i,e=!0){O.overviewDocked=i,i&&O.overviewPointer!==null&&(O.overviewPointer=null,zx()),ge.overviewShelf.classList.toggle("is-docked",i),ge.overviewDock.setAttribute("aria-expanded",String(!i));let t=i?"Bring the overview back":"Put the overview away";ge.overviewDock.setAttribute("aria-label",t),ge.overviewDock.title=t,e&&Wl()}function OG(i,e){let t=ge.overviewCanvas.getBoundingClientRect(),n=Of(),r=(a,l,c)=>us((a-l)/(c-l),0,1);if(O.globeActive){let a=lh(O.world);if(!a)return;let l=n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),c=-n[3]+r(i.clientY,t.top,t.bottom)*(n[3]-n[1]),[u,f]=a.toLatLng(l,c);nce(u,f,e);return}let s=O.engine?.getView();if(!s||!O.lens)return;let o=[n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),n[3]-r(i.clientY,t.top,t.bottom)*(n[3]-n[1])];if(e){s.animate({center:o,duration:180});return}s.cancelAnimations(),s.setCenter(o)}function Uf(i){return new CY({updateWhileAnimating:!0,...i})}function fce(){let i=O.volume.tileGrid.size,e=[0,-i,i,0];O.projection=new bp({code:"ATLAS:PIXELS",units:"pixels",extent:e}),O.sources={grid:new Wp({wrapX:!1}),gridContext:new Wp({wrapX:!1}),zoneScrim:new Wp({wrapX:!1}),zones:new Wp({wrapX:!1}),zoneTitles:new Wp({wrapX:!1}),pins:new Wp({wrapX:!1}),priority:new Wp({wrapX:!1})},O.layers={raster:new L6({zIndex:0}),rasterDetail:new L6({zIndex:1}),grid:Uf({source:O.sources.grid,style:a5,renderOrder:ad,renderBuffer:40,zIndex:5}),zoneScrim:Uf({source:O.sources.zoneScrim,style:BX,zIndex:6}),zones:Uf({source:O.sources.zones,style:OX,renderBuffer:32,zIndex:10}),zoneTitles:Uf({source:O.sources.zoneTitles,style:UX,renderOrder:ad,renderBuffer:160,zIndex:20}),zoneTitleDetail:Uf({source:O.sources.zoneTitles,style:kX,renderOrder:ad,renderBuffer:160,zIndex:44}),pins:Uf({source:O.sources.pins,style:PX,renderOrder:ad,renderBuffer:48,zIndex:40}),zonePins:Uf({source:O.sources.pins,style:IX,renderOrder:ad,renderBuffer:48,zIndex:42}),pinLabels:Uf({source:O.sources.pins,style:LX,renderOrder:ad,renderBuffer:180,zIndex:45}),gridContext:Uf({source:O.sources.gridContext,style:a5,renderOrder:ad,renderBuffer:40,zIndex:48}),priority:Uf({source:O.sources.priority,style:DX,renderOrder:ad,renderBuffer:220,zIndex:50})},O.engine=new tY({target:ge.viewport,layers:Object.values(O.layers),controls:ZE({attribution:!1,rotate:!1,zoom:!1}),interactions:n3({onFocusOnly:!1}),view:jI(5)}),O.engine.on("movestart",()=>{O.engine.getViewport().classList.add("is-dragging")}),O.engine.on("moveend",()=>{O.engine.getViewport().classList.remove("is-dragging"),O.overviewPointer===null&&zx()}),O.engine.on("postrender",kx),ge.viewport.addEventListener("wheel",()=>{document.activeElement!==ge.viewport&&ge.viewport.focus({preventScroll:!0})},{capture:!0,passive:!0}),O.engine.on("singleclick",t=>{if(O.gridEnabled){let s=O.engine.forEachFeatureAtPixel(t.pixel,o=>{let a=o.get("gridCell");return a&&a.role!=="leaf"&&a.role!=="scope"?a:null},{hitTolerance:1,layerFilter:o=>o===O.layers.grid||o===O.layers.gridContext});if(s){mA(s.hash);return}}let n=O.engine.forEachFeatureAtPixel(t.pixel,(s,o)=>WI(o)&&s.get("pin")||null,{hitTolerance:5,layerFilter:WI});if(n){Fy(n);return}let r=O.engine.forEachFeatureAtPixel(t.pixel,s=>{let o=s.get("zone");return o&&!Io(fu(o))?o:null},{layerFilter:s=>s===O.layers.zones});r&&wE(r)}),O.engine.on("pointermove",t=>{if(t.dragging){mv(null);return}let n=O.engine.forEachFeatureAtPixel(t.pixel,(s,o)=>WI(o)&&s.get("pin")||null,{hitTolerance:4,layerFilter:WI});mv(n||null);let r=O.gridEnabled&&O.engine.hasFeatureAtPixel(t.pixel,{layerFilter:s=>s===O.layers.grid||s===O.layers.gridContext});O.engine.getTargetElement().style.cursor=n||r?"pointer":""}),O.engine.getViewport().addEventListener("pointerleave",()=>mv(null))}function WI(i){return i===O.layers.pins||i===O.layers.zonePins||i===O.layers.pinLabels||i===O.layers.priority}function jI(i,e=null){let t=O.volume.tileGrid.size,n=e||[0,-t,t,0];return new Xl({projection:O.projection,center:[(n[0]+n[2])/2,(n[1]+n[3])/2],resolutions:UG(i),minZoom:0,maxZoom:i,extent:n,constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function UG(i){let e=O.volume.tileGrid.size/O.volume.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function cd(i,e){O.volume=O.catalog.volumes.find(r=>r.slug===i)||O.catalog.volumes[0],O.engine||fce(),!e&&!O.restore&&(O.restore=av(O.volume.slug)),ge.volume.value=O.volume.slug,qm(ge.world,O.volume.worlds,"title"),ge.world.disabled=O.volume.worlds.length===1,ge.world.title=ge.world.disabled?"This volume has one world":"Choose a world";let t=O.restore?.volume===O.volume.slug?O.restore:null,n=e&&O.volume.worlds.find(r=>r.slug===e)||t&&O.volume.worlds.find(r=>r.slug===t.world);await kG((n||O.volume.worlds[0]).slug)}async function kG(i){let e=O.volume.worlds.find(s=>s.slug===i)||O.volume.worlds[0],t=++O.worldRun;ge.loading.hidden=!1;let n;try{n=await r$(e)}catch(s){console.error(`world ${e.slug} failed to load`,s),O.worldRun===t&&(ge.loading.hidden=!0,yA());return}if(O.worldRun!==t)return;O.settling=!0,O.world=n,document.documentElement.style.setProperty("--icon-outset-color",hA()),ge.world.value=O.world.slug,qm(ge.lens,O.world.lenses,"name"),ge.lensField.hidden=O.world.lenses.length<2,O.styleCache.clear(),mv(null),O.gridCell="",O.gridSystem="geohash",O.hiddenCollections.clear(),O.labelOverrides.clear(),O.collapsedSections.clear(),O.collapsedSections.add("zones"),O.expandedCollections.clear();for(let s of O.world.collections)s.kind!=="point"&&!s.group&&O.expandedCollections.add(s.id),s.visible||O.hiddenCollections.add(s.id);let r=O.restore?.world===O.world.slug?O.restore:null;r&&(O.hiddenCollections=new Set(r.hidden),O.collapsedSections=new Set(r.collapsed),O.expandedCollections=new Set(r.expanded||[]),O.labelOverrides=new Map(r.labels||[])),qI(!!O.restore?.overviewDocked,!1),bE(O.restore?!!O.restore.dockFolded:!0,!1),O.dockDismissed=!!O.restore?.dockDismissed,O.search="",ge.search.value="",ge.dock.hidden=!1,id(),KX(),p5(),jX(),zG(r?us(r.lens,0,O.world.lenses.length-1):0,!0),Jle(),O.restore=null,ge.sidebar.classList.remove("is-open"),ge.mobileLegend.setAttribute("aria-expanded","false"),Vj(),O.settling=!1,Wl()}function zG(i,e=!1){let t=O.lens;O.lens=O.world.lenses[i]||O.world.lenses[0];let n=O.lens,r=e?null:c8e(t,n),s=mh(n);if(ge.lens.value=String(O.world.lenses.indexOf(O.lens)),e)O.engine.setView(jI(s,Of()));else{let w=O.engine.getView(),S=jI(s,Of());S.setCenter(w.getCenter()),S.setZoom(w.getZoom()||0),O.engine.setView(S)}let o=++O.tileRun,a=0;O.tileStats={requested:0,loaded:0,errors:0,peakPending:0},ge.loading.hidden=!1;let l=w=>{w.on("tileloadstart",()=>{O.tileRun===o&&(a++,O.tileStats.requested++,O.tileStats.peakPending=Math.max(O.tileStats.peakPending,a))});let S=T=>{O.tileRun===o&&(a=Math.max(0,a-1),T?O.tileStats.errors++:O.tileStats.loaded++,a===0&&O.tileStats.loaded>0&&(ge.loading.hidden=!0))};return w.on("tileloadend",()=>S(!1)),w.on("tileloaderror",()=>S(!0)),w},c=(w,S)=>l(new kj({projection:O.projection,tileGrid:new Iy({extent:[0,-O.volume.tileGrid.size,O.volume.tileGrid.size,0],origin:[0,0],resolutions:UG(w),tileSize:O.volume.tileGrid.tileSize}),cacheSize:64,interpolate:n.interpolate,transition:0,wrapX:!1,tileUrlFunction:([T,R,I])=>{let P=n.formats[T];if(!(!P||R<0||I<0||!S(T,R,I)))return`${O.volume.base}/tiles/${encodeURIComponent(n.tiles)}/${T}/${R}/${I}.${P}`}})),u=n.fullZoom??n.maxZoom,f=c(u,(w,S,T)=>HI(n,w,S,T)),d=O.layers.raster.getSource();O.layers.raster.setSource(f),O.layers.raster.setExtent(Of()),O.layers.raster.setBackground(n.background||void 0),d?.clear();let A=O.layers.rasterDetail.getSource();n.maxZoom>u?(O.layers.rasterDetail.setSource(c(n.maxZoom,(w,S,T)=>w>u&&HI(n,w,S,T))),O.layers.rasterDetail.setExtent(Of()),O.layers.rasterDetail.setVisible(!0)):O.layers.rasterDetail.setVisible(!1),A?.clear(),Wy(),O.gridEnabled&&(Fc(),O.layers.pins.changed(),O.layers.priority.changed()),O.overviewKey="",hce();let y=e&&O.restore?.world===O.world.slug?O.restore:null;if(O.renderedShard!==(n.shard||0)&&(p5(),Nc()),y?.center&&Number.isFinite(y.zoom)){let w=O.engine.getView();w.setCenter(y.center),w.setZoom(y.zoom),O.fitZoom=y.zoom,xA()}else e?requestAnimationFrame(u8e):(r&&O.engine.getView().animate({center:r,duration:200}),xA());Wl()}function HI(i,e,t,n){let r=i.coverage?.[e];if(!r)return!0;let s=t-r.x,o=n-r.y;if(s<0||o<0||s>=r.w||o>=r.h)return!1;let a=l8e(i,e,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function l8e(i,e,t){if(!t.decoded){let n=atob(t.bits),r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);t.decoded=r}return t.decoded}function mh(i){return i.maxZoom+2}function zx(){xA(),Wl()}function c8e(i,e){if(!i||!e||!i.shard||!e.shard||i.shard===e.shard||!i.bounds||!e.bounds)return null;let n=O.engine?.getView()?.getCenter();if(!n)return null;let r=(n[0]-i.bounds.x)/i.bounds.width,s=(-n[1]-i.bounds.y)/i.bounds.height;return[e.bounds.x+us(r,0,1)*e.bounds.width,-(e.bounds.y+us(s,0,1)*e.bounds.height)]}function dce(){let e=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");ge.mobileLegend.setAttribute("aria-expanded",String(!e)),requestAnimationFrame(()=>O.engine?.updateSize())}function Of(){let i=O.volume.tileGrid.size,e=O.lens?.bounds||{x:0,y:0,width:i,height:i};return[e.x,-(e.y+e.height),e.x+e.width,-e.y]}function u8e(){if(!O.engine||!O.lens)return;let i=O.engine.getView();i.fit(Of(),{size:O.engine.getSize(),padding:[36,36,36,36],maxZoom:O.lens.maxZoom,duration:0}),O.fitZoom=i.getZoom()||0,xA()}function eT(i){let e=O.engine.getView(),t=e.getZoom()||0;e.animate({zoom:us(t+i,O.lens.minZoom,mh(O.lens)),duration:140})}function xA(){let i=O.engine?.getView().getZoom();if(ge.viewport.dataset.zoom=Number.isFinite(i)?i.toFixed(3):"",!O.engine||!O.world){ge.visibleCount.textContent="0 features enabled";return}let e=O.engine.getView().calculateExtent(O.engine.getSize()),t=O.eligibleLocations,n=0;for(let r of O.features){if(ld(r))continue;let[s,o]=r.coordinate;s>=e[0]&&s<=e[2]&&o>=e[1]&&o<=e[3]&&n++}for(let r of O.zoneRecords.values())Io(r.zone.collectionId)||(t++,Ar(r.extent,e)&&n++);ge.visibleCount.textContent=`${jl(t)} features enabled \xB7 ${jl(n)} in view`}function pce(){ge.volume.addEventListener("change",()=>{cd(ge.volume.value)}),ge.world.addEventListener("change",()=>{kG(ge.world.value)}),ge.addBundles.addEventListener("click",()=>{w5()}),ge.emptyOpen.addEventListener("click",()=>{w5()}),ge.lens.addEventListener("change",()=>{zG(Number(ge.lens.value)),uce()}),ge.globeToggle.addEventListener("click",()=>VI()),ge.legend.addEventListener("change",n=>{let r=n.target;if(r.dataset.sectionToggle){n$(r.dataset.sectionToggle);return}if(!r.dataset.collection)return;let s=wu(r.dataset.collection);r.checked?O.hiddenCollections.delete(s):O.hiddenCollections.add(s),Op(),Nc(),ph()});let i=null,e=()=>{for(let s of ge.layers.querySelectorAll(".is-hovered"))s.classList.remove("is-hovered");if(!i)return;let r=document.elementFromPoint(i.x,i.y)?.closest(".category-row, .layer-header");r&&ge.layers.contains(r)&&r.classList.add("is-hovered")};ge.layers.addEventListener("pointermove",n=>{i={x:n.clientX,y:n.clientY},e()},{passive:!0}),ge.layers.addEventListener("pointerleave",()=>{i=null,e()}),ge.layers.addEventListener("scroll",e,{passive:!0}),ge.layers.addEventListener("click",n=>{let r=n.target.closest("[data-only-collection], [data-only-section]");if(r){n.preventDefault(),n.stopPropagation(),i$(r.dataset.onlyCollection?{collection:wu(r.dataset.onlyCollection)}:{section:r.dataset.onlySection});return}let s=n.target.closest("[data-expand-collection]");if(s){n.preventDefault(),n.stopPropagation(),JX(wu(s.dataset.expandCollection));return}let o=n.target.closest("[data-label-toggle]");if(o){n.preventDefault(),n.stopPropagation(),t$(wu(o.dataset.labelToggle));return}let a=n.target.closest("[data-zone]");if(a){g5(Number(a.dataset.zone));return}let l=n.target.closest("[data-section]");if(!l)return;let c=l.dataset.section;O.collapsedSections.has(c)?O.collapsedSections.delete(c):O.collapsedSections.add(c),XE()}),ge.layers.addEventListener("contextmenu",n=>{let r=n.target.closest("[data-zone]");r&&(n.preventDefault(),WX(Number(r.dataset.zone)))}),ge.soloChip.addEventListener("click",()=>e2(!0)),on("#expand-all").addEventListener("click",()=>y5(!1)),on("#collapse-all").addEventListener("click",()=>y5(!0)),on("#show-all").addEventListener("click",()=>e2(!0)),on("#hide-all").addEventListener("click",()=>e2(!1)),ge.search.addEventListener("input",()=>{O.search=ge.search.value.trim().toLocaleLowerCase(),Nc(),O.search&&Ny()}),ge.dockFold.addEventListener("click",()=>{_N(!O.dockFolded)}),ge.searchResults.addEventListener("click",n=>{let r=n.target.closest("[data-location], [data-zone]");if(!r)return;if(r.dataset.zone){g5(Number(r.dataset.zone));return}let s=O.featureByID.get(Number(r.dataset.location));s&&bN(s)}),ge.detailLinks.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=O.featureByID.get(Number(r.dataset.location));s&&bN(s)}),on("#close-detail").addEventListener("click",id),on("#zoom-in").addEventListener("click",()=>O.globeActive?DG(1):eT(1)),on("#zoom-out").addEventListener("click",()=>O.globeActive?DG(-1):eT(-1)),ge.gridBack.addEventListener("click",FN),ge.gridSystem.addEventListener("click",BN),ge.gridInput.addEventListener("input",()=>{let n=Ss(),r=n.normalizeInput(ge.gridInput.value);ge.gridInput.value=r,n.parseInput(r)!==null&&mA(r)}),ge.subgridToggle.addEventListener("click",()=>{Hy(!O.subgridVisible),ge.viewport.focus({preventScroll:!0})}),ge.gridInput.addEventListener("keydown",n=>{if(n.key===" "){n.preventDefault(),Hy(!O.subgridVisible);return}if(n.key==="`"){n.preventDefault(),ge.globeToggle.hidden||VI();return}n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),ge.viewport.focus({preventScroll:!0}))}),ge.viewport.addEventListener("keydown",n=>{if(!yE(n.target)){if(n.key==="+"||n.key==="=")eT(1);else if(n.key==="-")eT(-1);else if(n.key==="Escape")id();else return;n.preventDefault()}}),window.addEventListener("contextmenu",n=>{yE(n.target)||n.preventDefault()}),window.addEventListener("keydown",n=>{if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="r"){n.preventDefault(),location.reload();return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="g"){n.preventDefault(),BN();return}if(!yE(n.target)){if(n.key==="`"&&!n.metaKey&&!n.ctrlKey&&!n.altKey){ge.globeToggle.hidden||(n.preventDefault(),VI());return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="k"){n.preventDefault(),ge.search.focus(),ge.search.select();return}if((n.metaKey||n.ctrlKey)&&n.altKey&&n.code==="KeyB"){n.preventDefault(),ge.dock.hidden||_N(!O.dockFolded);return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="b"){n.preventDefault(),dce();return}lX(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),n.repeat||jE(!0))}}),window.addEventListener("keyup",n=>{n.key.toLocaleLowerCase()==="z"&&jE(!1)}),window.addEventListener("blur",()=>jE(!1)),window.addEventListener("hashchange",()=>{let n=lv();n.volume===O.volume?.slug&&n.world===O.world?.slug||(O.restore=null,cd(n.volume||O.catalog.volumes[0].slug,n.world))}),window.addEventListener("resize",()=>{O.engine?.updateSize(),kx(),BG()}),document.addEventListener("atlas:globe-camera",()=>kx()),ge.overview.addEventListener("pointerdown",n=>{O.overviewDocked||n.pointerType==="mouse"&&n.button!==0||(n.preventDefault(),ge.overview.setPointerCapture(n.pointerId),O.overviewPointer=n.pointerId,OG(n,!0))}),ge.overview.addEventListener("pointermove",n=>{O.overviewPointer===n.pointerId&&(n.preventDefault(),OG(n,!1))});let t=n=>{O.overviewPointer===n.pointerId&&(O.overviewPointer=null,zx())};ge.overview.addEventListener("pointerup",t),ge.overview.addEventListener("pointercancel",t),ge.overviewDock.addEventListener("click",()=>{qI(!O.overviewDocked),ge.viewport.focus({preventScroll:!0})}),ge.mobileLegend.addEventListener("click",()=>{let n=ge.sidebar.classList.toggle("is-open");ge.mobileLegend.setAttribute("aria-expanded",String(n))})}function mce(){let i=()=>({volume:O.volume?.title,world:O.world?.title,lens:O.lens?.name,zoom:O.engine?.getView().getZoom(),center:O.engine?.getView().getCenter(),resolution:O.engine?.getView().getResolution(),nativeMaxZoom:O.lens?.maxZoom,maxZoom:O.lens?mh(O.lens):null,interpolate:O.lens?.interpolate,tileStats:{...O.tileStats},pins:O.features.length,eligibleLocations:O.eligibleLocations,domNodes:document.querySelectorAll("*").length,canvases:document.querySelectorAll("canvas").length,rasterCacheSize:64,labelsHeld:O.labelsHeld,hoveredPin:O.hoveredPin?.location.title||null,selectedPin:O.selectedPin?.location.title||null,fitZoom:O.fitZoom,filters:{hiddenCategories:[...O.hiddenCollections].sort(),collapsedSections:[...O.collapsedSections].sort()},ui:{sidebarCollapsed:document.querySelector(".app-shell")?.classList.contains("sidebar-collapsed")??!1,detailOpen:!ge.detail.hidden,detailTitle:ge.detail.hidden?null:ge.detailTitle.textContent||null,searchQuery:O.search,searchResultsVisible:!ge.searchResults.hidden,soloChip:ge.soloChip.hidden?null:ge.soloChip.textContent,visibleCountText:ge.visibleCount.textContent,overviewDocked:O.overviewDocked,dockFolded:O.dockFolded,dockDismissed:O.dockDismissed,subgridVisible:O.subgridVisible},zones:{visible:V1(),count:O.zoneRecords.size,focused:O.zoneRecords.get(O.focusedZoneID)?.zone.title||null,highlighted:[...O.highlightedZones].map(e=>O.zoneRecords.get(e)?.zone.title).filter(Boolean),focusedPins:O.features.filter(e=>!e.filteredHidden&&e.passesZoneFilters).length},grid:{enabled:O.gridEnabled,system:O.gridSystem,prefix:O.gridCell,maximumDepth:hX(),extent:O.gridEnabled?ON():null,cells:[...O.sources.grid.getFeatures(),...O.sources.gridContext.getFeatures()].map(e=>e.get("gridCell")),priorityPins:O.gridCell?O.features.filter(e=>!e.filteredHidden&&Lp(e)).length:0}});window.__atlasDebug={snapshot:i,setLayerVisible:(e,t)=>O.layers[e]?.setVisible(t),refreshCatalog:yA},window.render_game_to_text=()=>JSON.stringify({coordinateSystem:"ATLAS:PIXELS; origin top-left; x increases right; y decreases downward",...i()}),window.advanceTime=()=>O.engine?.renderSync()}async function Ace(){pce();try{let i=await fetch("/data/catalog.json");if(!i.ok)throw new Error(`catalog request returned ${i.status}`);if(O.catalog=await i.json(),qm(ge.volume,O.catalog.volumes,"title"),b5(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{yA()}),O.catalog.volumes.length){let e=lv(),t=av(),n=t&&(!e.volume||e.volume===t.volume&&e.world===t.world);O.restore=n?t:null,await cd(e.volume||t?.volume||O.catalog.volumes[0].slug,e.world||t?.world),O.restore=null}else ge.loading.hidden=!0;mce(),requestAnimationFrame(()=>ge.viewport.focus({preventScroll:!0}))}catch(i){ge.loading.hidden=!0,ge.fatalMessage.textContent=i instanceof Error?i.message:String(i),ge.fatal.hidden=!1}}Ace();})();
M frontend/parity/tour.js +11 -6
M frontend/src/detail.js +0 -4
M frontend/src/engine.js +2 -31
@@ -9,7 +9,6 @@ import VectorSource from "ol/source/Vector.js";
99 1010 import { collectionOf, isCollectionHidden } from "./collections.js";1111 import { elements } from "./dom.js";12-import { renderAs } from "./semconv.js";1312 import { state } from "./state.js";1413 import {1514 featureOrder,
@@ -17,12 +16,9 @@ import {
1716 pinFeatureStyle,1817 pinLabelFeatureStyle,1918 priorityFeatureStyle,20- textDetailFeatureStyle,21- textFeatureStyle,2219 zonePinFeatureStyle,2320 zoneScrimStyle,2421 zoneStyle,25- zoneTextFeatureStyle,2622 zoneTitleDetailStyle,2723 zoneTitleStyle,2824 } from "./styles.js";
@@ -54,7 +50,6 @@ export function initializeMap() {
5450 zoneScrim: new VectorSource({ wrapX: false }),5551 zones: new VectorSource({ wrapX: false }),5652 zoneTitles: new VectorSource({ wrapX: false }),57- text: new VectorSource({ wrapX: false }),5853 pins: new VectorSource({ wrapX: false }),5954 priority: new VectorSource({ wrapX: false }),6055 };
@@ -98,27 +93,6 @@ export function initializeMap() {
9893 renderBuffer: 160,9994 zIndex: 44,10095 }),101- text: eagerVector({102- source: state.sources.text,103- style: textFeatureStyle,104- renderOrder: featureOrder,105- renderBuffer: 220,106- zIndex: 30,107- }),108- textDetail: eagerVector({109- source: state.sources.text,110- style: textDetailFeatureStyle,111- renderOrder: featureOrder,112- renderBuffer: 220,113- zIndex: 45,114- }),115- zoneText: eagerVector({116- source: state.sources.text,117- style: zoneTextFeatureStyle,118- renderOrder: featureOrder,119- renderBuffer: 220,120- zIndex: 41,121- }),12296 // Nothing is decluttered. Dropping whatever overlaps makes a crowded area12397 // quietly show less than it holds, for text labels as much as for markers;12498 // zooming in to separate them is the reader's job.
@@ -250,8 +224,7 @@ export function initializeMap() {
250224 (feature, layer) => (isAnnotationLayer(layer) && feature.get("pin")) || null,251225 { hitTolerance: 4, layerFilter: isAnnotationLayer },252226 );253- const hovered = hit && renderAs(hit.category) === "text" ? null : hit;254- setHoveredPin(hovered || null);227+ setHoveredPin(hit || null);255228 const gridHit = state.gridEnabled && state.engine.hasFeatureAtPixel(event.pixel, {256229 layerFilter: (layer) =>257230 layer === state.layers.grid || layer === state.layers.gridContext,
@@ -266,9 +239,7 @@ export function initializeMap() {
266239 // the only ones still on screen -- answering neither the pointer nor a click.267240 export function isAnnotationLayer(layer) {268241 return layer === state.layers.pins || layer === state.layers.zonePins ||269- layer === state.layers.pinLabels || layer === state.layers.priority ||270- layer === state.layers.text || layer === state.layers.textDetail ||271- layer === state.layers.zoneText;242+ layer === state.layers.pinLabels || layer === state.layers.priority;272243 }273244 274245 // createView holds the camera to the map rather than to the world square
M frontend/src/events.js +0 -8
M frontend/src/features.js +2 -15
@@ -6,7 +6,6 @@ import { closeDetail } from "./detail.js";
66 import { elements } from "./dom.js";77 import { pinInGridCell } from "./grid.js";88 import { renderSearchResults } from "./search.js";9-import { renderAs } from "./semconv.js";109 import { updateVisibleCount } from "./navigation.js";1110 import { state } from "./state.js";1211 import { prepareMarkerIcon } from "./styles.js";
@@ -19,13 +18,12 @@ import { project } from "./areas.js";
1918 // arrive inline with their collections and never pass through here.2019 export function buildFeatures() {2120 state.sources.pins.clear();22- state.sources.text.clear();2321 state.sources.priority.clear();2422 state.features = [];2523 state.featureByID.clear();2624 for (const category of state.world.collections) {2725 if (category.kind !== "point") continue;28- if (renderAs(category) !== "text") prepareMarkerIcon(category);26+ prepareMarkerIcon(category);2927 for (const location of category.locations) {3028 const pin = {3129 location,
@@ -42,8 +40,7 @@ export function buildFeatures() {
4240 });4341 state.features.push(pin);4442 state.featureByID.set(location.id, pin);45- if (renderAs(category) === "text") state.sources.text.addFeature(pin.feature);46- else state.sources.pins.addFeature(pin.feature);43+ state.sources.pins.addFeature(pin.feature);4744 }4845 }4946 applyPinFilters();
@@ -88,9 +85,6 @@ export function refreshPinRendering() {
8885 state.layers.pins.changed();8986 state.layers.zonePins.changed();9087 state.layers.pinLabels.changed();91- state.layers.text.changed();92- state.layers.zoneText.changed();93- state.layers.textDetail.changed();9488 state.layers.priority.changed();9589 updateVisibleCount();9690 }
@@ -125,7 +119,6 @@ export function setLabelsHeld(held) {
125119 state.labelsHeld = held;126120 elements.labelsHint.textContent = held ? "Z · labels shown" : "Z · hold for labels";127121 state.layers.pinLabels.changed();128- state.layers.text.changed();129122 // Quiet zone names answer the same key, so the title layers must hear it130123 // the moment the pin labels do.131124 state.layers.zoneTitles.changed();
@@ -175,12 +168,6 @@ export function pinPriority(category, location) {
175168 return rarity + (stableRank(location.id) % 1000);176169 }177170 178-export function textDetailRatio(category) {179- if (category.locations.length > 200) return 4;180- if (category.locations.length > 75) return 2.5;181- return 1;182-}183-184171 export function atMaximumNativeZoom() {185172 const zoom = state.engine?.getView().getZoom() || 0;186173 return zoom >= (state.lens?.maxZoom || 0) - 0.05;
M frontend/src/grid.js +0 -3
M frontend/src/legend.js +30 -41
@@ -1,9 +1,9 @@
11 import { elements } from "./dom.js";22 import { state } from "./state.js";33 import { saveSession } from "./session.js";4-import { applyPinFilters, buildFeatures } from "./features.js";4+import { applyPinFilters } from "./features.js";55 import { renderSearchResults } from "./search.js";6-import { labelPolicy, renderAs } from "./semconv.js";6+import { curatedLabelPolicy, labelPolicy } from "./semconv.js";77 import { recountZoneTitles, syncZoneLayers } from "./areas.js";88 import { applyCategoryVisual, applyCategoryGlyph, initials } from "./theme.js";99 import { formatNumber } from "./util.js";
@@ -196,20 +196,16 @@ export function collectionRow(collection) {
196196 labels.type = "button";197197 labels.className = "label-toggle";198198 labels.dataset.labelToggle = String(collection.id);199- labels.dataset.label = `Label ${collection.title} on the map`;200- labels.setAttribute("aria-label", `Label ${collection.title} on the map`);201- labels.setAttribute("aria-pressed", String(labelPolicy(null, collection) === "always"));202199 labels.innerHTML =203200 '<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 3.5h9M8 3.5v9"/></svg>';201+ syncLabelToggle(labels, collection);204202 } else if (kind === "point") {205203 labels = document.createElement("button");206204 labels.type = "button";207205 labels.className = "label-toggle render-toggle";208- labels.dataset.renderToggle = String(collection.id);209- labels.dataset.label = `Draw ${collection.title} as text`;210- labels.setAttribute("aria-label", `Draw ${collection.title} as text`);211- labels.setAttribute("aria-pressed", String(renderAs(collection) === "text"));206+ labels.dataset.labelToggle = String(collection.id);212207 labels.textContent = "Tt";208+ syncLabelToggle(labels, collection);213209 } else {214210 labels = document.createElement("span");215211 labels.className = "label-toggle-spacer";
@@ -269,49 +265,42 @@ export function toggleLabelPolicy(id) {
269265 const collection = findCollection(id);270266 if (!collection) return;271267 const flipped = labelPolicy(null, collection) === "always" ? "quiet" : "always";272- const curated = collection.attrs?.["atlas.label.policy"] ?? "always";273- if (flipped === curated) state.labelOverrides.delete(collection.id);268+ if (flipped === curatedLabelPolicy(collection)) state.labelOverrides.delete(collection.id);274269 else state.labelOverrides.set(collection.id, flipped);275270 syncLabelToggles();276- // The crowd-thinning threshold counts spoken names only, and the toggle277- // just changed which names speak.278- recountZoneTitles();279- // The names are drawn by the title layers, at either zoom depth.280- state.layers.zoneTitles.changed();281- state.layers.zoneTitleDetail.changed();271+ if (collection.kind === "point") {272+ // A point collection's names ride the pin-label layer.273+ state.layers.pinLabels.changed();274+ } else {275+ // The crowd-thinning threshold counts spoken names only, and the toggle276+ // just changed which names speak; ground names are drawn by the title277+ // layers, at either zoom depth.278+ recountZoneTitles();279+ state.layers.zoneTitles.changed();280+ state.layers.zoneTitleDetail.changed();281+ }282282 saveSession();283283 }284284 285+// One toggle, one language: the button says what pressing it would do,286+// "Hide X labels" while the names are speaking and "Display X labels" while287+// they wait, whatever the kind of collection behind it.288+function syncLabelToggle(button, collection) {289+ const speaking = labelPolicy(null, collection) === "always";290+ const help = `${speaking ? "Hide" : "Display"} ${collection.title} labels`;291+ button.dataset.label = help;292+ button.setAttribute("aria-label", help);293+ button.title = help;294+ button.setAttribute("aria-pressed", String(speaking));295+}296+285297 export function syncLabelToggles() {286298 for (const button of elements.legend.querySelectorAll("[data-label-toggle]")) {287299 const collection = findCollection(collectionID(button.dataset.labelToggle));288- if (!collection) continue;289- button.setAttribute("aria-pressed", String(labelPolicy(null, collection) === "always"));290- }291- for (const button of elements.legend.querySelectorAll("[data-render-toggle]")) {292- const collection = findCollection(collectionID(button.dataset.renderToggle));293- if (!collection) continue;294- button.setAttribute("aria-pressed", String(renderAs(collection) === "text"));300+ if (collection) syncLabelToggle(button, collection);295301 }296302 }297303 298-// The render toggle is the same two-state affair the label toggle is, around299-// how a point collection draws: press it and the markers become floating300-// names, or the names markers; an override that only restates the curation301-// is dropped rather than stored. Routing changed, so the features rebuild.302-export function toggleRenderAs(id) {303- const collection = findCollection(id);304- if (!collection) return;305- const flipped = renderAs(collection) === "text" ? "pin" : "text";306- const curated = collection.attrs?.["atlas.render.as"] || "pin";307- if (flipped === curated) state.renderOverrides.delete(collection.id);308- else state.renderOverrides.set(collection.id, flipped);309- buildFeatures();310- applyPinFilters();311- syncLabelToggles();312- saveSession();313-}314-315304 export function setAllCollections(visible) {316305 state.hiddenCollections.clear();317306 if (!visible) {
M frontend/src/navigation.js +0 -3
M frontend/src/semconv.js +30 -14
@@ -12,28 +12,44 @@ import { state } from "./state.js";
1212 export const geometryKinds = Object.freeze({ point: "point", path: "path", area: "area" });1313 export const labelPolicies = Object.freeze({ always: "always", quiet: "quiet" });1414 15-// labelPolicy answers whether a zone's name draws on its own or waits to be16-// asked: "always" or "quiet". The reader's per-collection override wins,17-// then the collection's declared word, then the kind's own default -- areas18-// speak unasked, which is what every map before the key already did, and19-// paths wait.15+// labelPolicy answers whether a collection's names draw on their own or wait16+// to be asked: "always" or "quiet". The reader's per-collection override17+// wins, then the collection's declared word, then the kind's own default --18+// areas speak unasked, which is what every map before the key already did;19+// paths wait; and a point collection speaks when its curation asked for20+// text, because floating names are labels a producer pinned on, not a21+// different kind of thing.2022 export function labelPolicy(zone, collection) {2123 const declared = collection ?? collectionFor(zone);2224 const override = state.labelOverrides.get(declared?.id);2325 if (override) return override;24- const curated = declared?.attrs?.["atlas.label.policy"];26+ return curatedLabelPolicy(declared);27+}28+29+// curatedLabelPolicy is the producer's word alone -- what the toggle returns30+// to when the reader's override is dropped.31+export function curatedLabelPolicy(collection) {32+ const curated = collection?.attrs?.["atlas.label.policy"];2533 if (curated) return curated;26- return declared?.kind === geometryKinds.path ? labelPolicies.quiet : labelPolicies.always;34+ if ((collection?.kind ?? geometryKinds.point) === geometryKinds.point) {35+ return renderAs(collection) === "text" ? labelPolicies.always : labelPolicies.quiet;36+ }37+ return collection?.kind === geometryKinds.path ? labelPolicies.quiet : labelPolicies.always;38+}39+40+// labelSilenced says whether the reader themselves quieted a collection's41+// names. Z reveals what is merely optional, never what was silenced: the42+// choice was the reader's, and the key is not an override.43+export function labelSilenced(collection) {44+ return state.labelOverrides.get(collection?.id) === labelPolicies.quiet;2745 }2846 29-// renderAs answers how a point collection draws: "pin" or "text". This is30-// the one display rule the viewer holds, spelled once; a collection saying31-// nothing is markers, and since the v3 wire every producer says. Text is a32-// capability of an ordinary point collection, not a kind of its own, so the33-// reader's override outranks the curation the same way label policy does.47+// renderAs is the curation's word on a point collection: "pin" or "text".48+// Since text became a label policy rather than a way of drawing, this is49+// read only as the curated default the policy ladder falls back to --50+// markers draw either way.3451 export function renderAs(collection) {35- return state.renderOverrides.get(collection?.id) ??36- (collection.attrs?.["atlas.render.as"] || "pin");52+ return collection?.attrs?.["atlas.render.as"] || "pin";3753 }3854 3955 // The labels the detail card gives a feature's own attributes. Anything in
M frontend/src/session.js +0 -1
M frontend/src/state.js +0 -1
M frontend/src/styles.js +9 -58
@@ -10,13 +10,12 @@ import {
1010 import { anyShapeCollectionVisible, collectionFor, collectionOf, isCollectionHidden } from "./collections.js";1111 import { gridTheme } from "./constants.js";1212 import { gridCellVisual } from "./grid.js";13-import { labelPolicy, renderAs } from "./semconv.js";13+import { labelPolicy, labelSilenced } from "./semconv.js";1414 import { state } from "./state.js";1515 import {1616 atMaximumNativeZoom,1717 isPriorityPin,1818 pinIsHidden,19- textDetailRatio,2019 } from "./features.js";2120 import {2221 categoryColor,
@@ -45,50 +44,23 @@ export function zonePinFeatureStyle(feature) {
4544 return markerStyles(pin, false);4645 }4746 48-// Held, so the zoom has no say in it. What the reader asked for is every name49-// on the map at once, and a rule that waited for the deepest zoom answered it50-// with the names of the few places already on screen.47+// A pin's label draws when its collection's names are spoken -- curated48+// always, or the reader's toggle -- or while Z is held. The key reveals what49+// is merely optional, never what the reader silenced by hand, and the zoom50+// has no say either way: what was asked for is every name at once.5151 export function pinLabelFeatureStyle(feature) {5252 const pin = feature.get("pin");53- if (!pin || pinIsHidden(pin) || !state.labelsHeld) return null;54- return markerLabelStyle(pin);55-}56-57-export function textFeatureStyle(feature) {58- const pin = feature.get("pin");59- if (!pin || pinIsHidden(pin) || pin.passesZoneFilters || isPriorityPin(pin)) return null;60- if (atMaximumNativeZoom()) return null;61- // A text pin is its own label, so the key that shows every name shows these62- // too -- otherwise the crowded categories, the ones held back the longest,63- // would be the ones it never reached.64- if (state.labelsHeld) return textStyles(pin, false);65- const minimumZoom = state.fitZoom + Math.log2(textDetailRatio(pin.category));66- if ((state.engine.getView().getZoom() || 0) < minimumZoom) return null;67- return textStyles(pin, false);68-}69-70-export function textDetailFeatureStyle(feature) {71- const pin = feature.get("pin");72- if (!pin || pinIsHidden(pin) || pin.passesZoneFilters ||73- isPriorityPin(pin) || !atMaximumNativeZoom()) {74- return null;75- }76- return textStyles(pin, false);77-}78-79-export function zoneTextFeatureStyle(feature) {80- const pin = feature.get("pin");81- if (!pin || !state.highlightedZones.size || !pin.passesZoneFilters ||82- pinIsHidden(pin) || isPriorityPin(pin)) {53+ if (!pin || pinIsHidden(pin)) return null;54+ if (labelPolicy(null, pin.category) !== "always" &&55+ !(state.labelsHeld && !labelSilenced(pin.category))) {8356 return null;8457 }85- return textStyles(pin, false);58+ return markerLabelStyle(pin);8659 }8760 8861 export function priorityFeatureStyle(feature) {8962 const pin = feature.get("pin");9063 if (!pin || pinIsHidden(pin)) return null;91- if (renderAs(pin.category) === "text") return textStyles(pin, pin === state.selectedPin);9264 const marker = markerStyles(pin, pin === state.selectedPin);9365 if (pin === state.hoveredPin || pin === state.selectedPin) {9466 return [marker, markerLabelStyle(pin)];
@@ -215,27 +187,6 @@ export function markerIconKey(category) {
215187 return `${category.iconAsset || ""}:${categoryColor(category)}:${state.world?.iconOutset || "light"}`;216188 }217189 218-export function textStyles(pin, selected) {219- const key = `text:${pin.location.id}:${selected ? 1 : 0}`;220- if (state.styleCache.has(key)) return state.styleCache.get(key);221- const style = new Style({222- text: new Text({223- text: pin.location.title,224- font: `${selected ? "900" : "800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,225- fill: new Fill({ color: selected ? "#7fd0ea" : "#f2ece0" }),226- stroke: new Stroke({ color: "rgba(0,0,0,0.95)", width: 4 }),227- backgroundFill: new Fill({ color: selected ? "rgba(13,16,23,0.9)" : "rgba(10,12,17,0.58)" }),228- backgroundStroke: selected ? new Stroke({ color: "#3aa5c9", width: 1 }) : undefined,229- padding: [3, 6, 3, 6],230- overflow: true,231- }),232- zIndex: selected ? 20_000_000 : pin.priority + 3_000_000,233- });234- const styles = [style];235- state.styleCache.set(key, styles);236- return styles;237-}238-239190 // gridLabelFont spells one chunk of a cell label. Monospace, as the field240191 // these are typed into already is: every hash at a level is the same length,241192 // so in a fixed pitch a level keeps or drops its labels as one.
M frontend/test/semconv.test.mjs +16 -1
@@ -5,7 +5,7 @@
55 import assert from "node:assert/strict";66 import test from "node:test";77 8-import { featureAttributeRows, labelPolicy, renderAs } from "../src/semconv.js";8+import { featureAttributeRows, labelPolicy, labelSilenced, renderAs } from "../src/semconv.js";99 import { state } from "../src/state.js";1010 1111 test("labelPolicy climbs override, collection, kind default", () => {
@@ -23,6 +23,21 @@ test("labelPolicy climbs override, collection, kind default", () => {
2323 state.labelOverrides.clear();2424 });2525 26+test("a point collection's labels wait unless its curation asked for text", () => {27+ state.labelOverrides.clear();28+ const garages = { id: 51, kind: "point", attrs: { "atlas.render.as": "pin" } };29+ const cities = { id: 52, kind: "point", attrs: { "atlas.render.as": "text" } };30+31+ assert.equal(labelPolicy(null, garages), "quiet", "markers wait for Z");32+ assert.equal(labelPolicy(null, cities), "always", "curated text means names speak");33+34+ state.labelOverrides.set(52, "quiet");35+ assert.equal(labelPolicy(null, cities), "quiet", "the reader can quiet the names");36+ assert.ok(labelSilenced(cities), "and that silence is theirs, so Z respects it");37+ assert.ok(!labelSilenced(garages), "curated quiet is merely optional, so Z reveals it");38+ state.labelOverrides.clear();39+});40+2641 test("a zone answers through the collection the wire stamped it with", () => {2742 state.labelOverrides.clear();2843 const hydro = { id: 42, kind: "area", attrs: { "atlas.label.policy": "quiet" } };