Two leftovers from the pole-cell closure. The chart's pole closure dropped the ring's closing point -- the very segment that spans the walk's final tessellation step now that the loop closes a world over -- leaving a sliver of ground one step wide that no dim ever covered, at each pole face's own starting longitude. The polygon now takes the whole loop before turning down to the pole's edge. And the label sprites -- cell chips and the held-Z name cards -- tested depth against a planet that curves up in front of their anchors, losing their lower halves at any glancing angle. They test nothing now; the horizon is enforced by hand instead, a card going invisible the moment its anchor slips past the silhouette, so nothing shines through the far side while the camera pans between rebuilds.
- commit
- 6194ef7bb58f5ec5ef58ef3d4e14877f949dbbc9
- parent
- a8ae310e6ed908f5086887b261a847e55f5a30cb
- author
- Dami <dami.etoile@gmail.com>
| M | assets/ | 480 | +++++++++++++++--------------- |
| M | frontend/ | 36 | ++ |
| M | frontend/ | 13 | +- |
@@ -1,19 +1,19 @@
1-(()=>{var Eue=Object.create;var uL=Object.defineProperty;var Mue=Object.getOwnPropertyDescriptor;var Cue=Object.getOwnPropertyNames;var Rue=Object.getPrototypeOf,Iue=Object.prototype.hasOwnProperty;var aq=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},Pue=(i,e)=>{for(var t in e)uL(i,t,{get:e[t],enumerable:!0})},Lue=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Cue(e))!Iue.call(i,r)&&r!==t&&uL(i,r,{get:()=>e[r],enumerable:!(n=Mue(e,r))||n.enumerable});return i};var lq=(i,e,t)=>(t=i!=null?Eue(Rue(i)):{},Lue(e||!i||!i.__esModule?uL(t,"default",{value:i,enumerable:!0}):t,i));var pq=aq((tT,dq)=>{(function(i,e){typeof tT=="object"&&typeof dq<"u"?e(tT):typeof define=="function"&&define.amd?define(["exports"],e):e(i.bigfloat={})})(tT,(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,ge=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;)ge-=Y[ce],Re=ge>>>0,ge=-(ge<0),G[ce++]=Re;z+=H,z>$&&(z=$),he=ce}for(C.fractionLen=k;he<z;)ge+=W[te++]-Y[ce++],Re=ge>>>0,ge=-(ge<0),G[he++]=Re;for(;he<J;)ge+=W[te++],Re=ge>>>0,ge=-(ge<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,ge,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;)ge=mt(),Qe=Ee,Ee+=ge,Re=Ee-Qe,Fe=Qe-(Ee-Re)+(ge-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 _J=aq((lw,qB)=>{(function(i,e){typeof lw=="object"&&typeof qB=="object"?qB.exports=e():typeof define=="function"&&define.amd?define("FrameTicker",[],e):typeof lw=="object"?lw.FrameTicker=e():i.FrameTicker=e()})(lw,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 cq=i=>new Promise(e=>setTimeout(e,i)),ws=i=>document.querySelector(i);async function Due(){for(let i=0;i<300&&!(window.__atlasDebug&&!ws("#map-loading")?.checkVisibility?.());i+=1)await cq(100)}async function Nue(){let i="";for(let e=0;e<100;e+=1){await cq(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 op(i,e={}){window.dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0,...e}))}function Fue(i,e={}){window.dispatchEvent(new KeyboardEvent("keyup",{key:i,bubbles:!0,cancelable:!0,...e}))}function Bue(i){ws("#map").dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0}))}function Om(i,e){i.value=e,i.dispatchEvent(new Event("change",{bubbles:!0}))}function hL(i,e){let t=ws(i);t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function fL(i,e=!1){let t=ws("#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 Oue(){let i=[],e=async d=>{await Nue(),i.push({name:d,snapshot:JSON.parse(window.render_game_to_text())})};await Due(),localStorage.clear();let t=ws("#game-select"),n=t.options[0].value;Om(t,n),await e("initial"),hL("#pin-search","a"),await e("search-a");let r=ws(".search-result");r&&(r.click(),await e("search-select-first"),ws("#close-detail").click(),await e("detail-closed")),hL("#pin-search",""),await e("search-cleared");let s=ws(".category-row input");s&&(s.click(),await e("category-hidden"),s.click(),await e("category-restored"));let o=ws(".only-button");if(o){o.click(),await e("solo-first");let d=ws("#solo-chip");d&&!d.hidden&&d.click(),await e("solo-cleared")}let a=ws("#legend .layer-title");a&&(a.click(),await e("section-folded"),ws("#expand-all").click(),await e("sections-unfolded")),ws("#hide-all").click(),await e("all-hidden"),ws("#show-all").click(),await e("all-shown");let l=ws(".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")),op("g"),await e("grid-open"),hL("#grid-input","m"),await e("grid-descended"),op(" "),await e("subgrid-hidden"),op(" "),op("Escape"),await e("grid-ascended"),op("Escape"),await e("grid-closed"),op("z"),await e("labels-on"),Fue("z"),await e("labels-off"),op("b",{metaKey:!0}),await e("sidebar-collapsed"),op("b",{metaKey:!0}),await e("sidebar-restored"),ws("#zoom-in").click(),await e("zoomed-in");let c=ws("#overview-dock");c&&!ws("#overview-shelf").hidden&&(c.click(),await e("overview-docked"),c.click(),await e("overview-undocked")),ws("#zoom-out").click(),await e("zoomed-out"),Bue("Escape"),await e("viewport-escape");let u=ws("#variant-select");u.options.length>1&&(Om(u,u.options[1].value),await e("variant-second"),Om(u,u.options[0].value),await e("variant-first"));let f=ws("#map-select");return f.options.length>1&&(Om(f,f.options[1].value),await e("map-second"),Om(f,f.options[0].value),await e("map-first")),t.options.length>1&&(Om(t,t.options[1].value),await e("game-second"),Om(t,n),await e("game-first")),localStorage.clear(),{viewport:[window.innerWidth,window.innerHeight],steps:i}}var dL=!1;async function uq(){if(!dL){dL=!0,fL("parity tour running\u2026");try{let i=await Oue(),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}`);fL(`parity tour complete \u2713 ${i.steps.length} steps`),console.log("parity tour saved to",t)}catch(i){fL(`parity tour failed: ${i}`,!0),console.error("parity tour failed",i)}finally{dL=!1}}}window.__atlasTour=uq;window.addEventListener("keydown",i=>{i.key==="F9"&&uq()});var nn=i=>document.querySelector(i),_e={game:nn("#game-select"),map:nn("#map-select"),variant:nn("#variant-select"),variantField:nn("#variant-field"),legend:nn("#legend"),search:nn("#pin-search"),searchResults:nn("#dock-results"),dock:nn("#dock"),dockCount:nn("#dock-count"),dockFlag:nn("#dock-flag"),dockFold:nn("#dock-fold"),dockRailName:nn("#dock-rail-name"),visibleCount:nn("#visible-count"),viewport:nn("#map"),globe:nn("#globe"),globeToggle:nn("#globe-toggle"),layers:nn("#layers"),zoneToggle:nn("#zone-toggle"),zoneCount:nn("#zone-count"),zoneIndex:nn("#zone-index"),zoneList:nn("#zone-list"),loading:nn("#map-loading"),labelsHint:nn("#labels-hint"),gridHint:nn("#grid-hint"),soloChip:nn("#solo-chip"),overview:nn("#overview"),overviewShelf:nn("#overview-shelf"),overviewDock:nn("#overview-dock"),overviewCanvas:nn("#overview-canvas"),overviewViewport:nn("#overview-viewport"),gridNavigator:nn("#grid-navigator"),gridSystem:nn("#grid-system"),gridSystemName:nn("#grid-system-name"),gridInput:nn("#grid-input"),gridBack:nn("#grid-back"),subgridToggle:nn("#subgrid-toggle"),detail:nn("#pin-detail"),detailTitle:nn("#detail-title"),detailCategory:nn("#detail-category"),detailDescription:nn("#detail-description"),detailID:nn("#detail-id"),detailCoordinates:nn("#detail-coordinates"),detailCell:nn("#detail-cell"),detailCellField:nn("#detail-cell-field"),detailSource:nn("#detail-source"),detailSourceField:nn("#detail-source-field"),detailLinks:nn("#detail-links"),detailDot:nn("#detail-dot"),sidebar:nn("#sidebar"),mobileLegend:nn("#mobile-legend"),fatal:nn("#fatal-error"),fatalMessage:nn("#fatal-message"),emptyState:nn("#empty-state"),emptyPath:nn("#empty-path"),emptyOpen:nn("#empty-open"),addBundles:nn("#add-bundles")};function Um(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 U={catalog:null,game:null,map:null,variant:null,engine:null,projection:null,layers:null,sources:null,hiddenCategories:new Set,collapsedSections:new Set,pins:[],pinByID:new Map,selectedPin:null,hoveredPin:null,labelsHeld:!1,gridEnabled:!1,gridSystem:"geohash",globeActive:!1,subgridVisible:!0,gridCell:"",zonesVisible:!0,zoneRecords:new Map,highlightedZones:new Set,focusedZoneID:null,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,mapRun:0,textByMap:new Map,restore:null,settling:!1,styleCache:new Map,markerIcons:new Map};var Gf=["#4fb3d5","#c9924b","#82b56a","#c96a6a","#9581cc","#4bc9a9","#d4b04a","#6a92c9","#b08a5a","#8fb3a2"],km="0123456789bcdefghjkmnpqrstuvwxyz";var pL="atlas.session";var hq={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 eT(i){let e=[...qf()],t=!0;for(let n of i){let r=km.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 AL(i,e){let t=[...qf()],[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+=km[l]}return o}var mL={key:null,extent:null};function Uue(i){let t=`${qf().join(",")}|${i}`;return mL.key!==t&&(mL={key:t,extent:eT(i)}),mL.extent}var gL={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[...km].map(e=>i+e)},childIndex(i){return Math.max(0,km.indexOf(i[i.length-1]))},contains(i,e){let t=Uue(i),[n,r]=e;return n>=t[0]&&n<=t[2]&&r>=t[1]&&r<=t[3]},descendTarget(i,e){return AL(e,i.length+1)},bbox:eT,center(i){let e=eT(i);return[(e[0]+e[2])/2,(e[1]+e[3])/2]},ring(i){let[e,t,n,r]=eT(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,km.indexOf(i[i.length-1]))%Gf.length},normalizeInput(i){return[...i.toLocaleLowerCase()].filter(e=>km.includes(e)).slice(0,3).join("")},parseInput(i){return i},locate(i){let e=AL(i,3);return e?{label:"Geohash",value:e}:null}};function fq(i,e=3){return AL(i,e)}var m1=lq(pq());function mq(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 jx(i,e,t){if(jq())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&Xx(r,t.prototype),r}function Aq(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,Gue(n.key),n)}}function kue(i,e,t){return e&&Aq(i.prototype,e),t&&Aq(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=que(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 ML(i){return ML=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ML(i)}function Qx(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,Xx(i,e)}function zue(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function jq(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(jq=function(){return!!i})()}function Xx(i,e){return Xx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Xx(i,e)}function Vue(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 Gue(i){var e=Vue(i,"string");return typeof e=="symbol"?e:e+""}function que(i,e){if(i){if(typeof i=="string")return mq(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)?mq(i,e):void 0}}function y1(i){var e=typeof Map=="function"?new Map:void 0;return y1=function(t){if(t===null||!zue(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 jx(t,arguments,ML(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Xx(n,t)},y1(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})(),qr=(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 vL=(function(){function i(t,n,r){this.x=t,this.y=n,this.z=r}i.fromVector=function(n){return new i(new m1.BigFloat32(n.x),new m1.BigFloat32(n.y),new m1.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 m1.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 m1.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 CL=Math.PI/180,ap=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},Xq=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)},Hue=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},$q=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},RL=function(e,t){return e*Math.pow(2,t)},gq=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},vc=function(e){return e},Yq=function(e){return e/CL||0};var Wue=function(){return 1/0},jue=function(e){return e==1/0};var vq=function(e){return Yq(e).toFixed(7)},_q=function(e,t,n){return n===void 0&&(n=1e-15),Math.abs(e-t)<=n};var oT=-1,b1=2,xc=4,jL=4,zm=1e-15,Wx=2220446049e-25,iT=function(e){if(e<0)return oT;if(jue(e))return Sc();var t=2*Math.sin(.5*Math.min(Math.PI,vc(e)));return t*t},IL=function(e){return e>jL?xc:e},AT=function(e,t){return Xue(e)?e:Math.max(0,Math.min(jL,e+t))},aT=function(e){return e<0?-1:Zq(e)?Wue():2*Math.asin(.5*Math.sqrt(e))},Sc=function(){return 1/0},Zq=function(e){return e==1/0},Xue=function(e){return e<0||Zq(e)};var w1=function(e){return e>=jL?Sc():e<0?0:Xq(e,10)};var XL=function(e){return 4.5*Wx*e+16*Wx*Wx};var Vx=function(e,t){return iT(aT(e)+aT(t))},$ue=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))},Yue=function(e){return Math.sqrt(Kq(e))||0},Kq=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*Wx>=2*Math.PI)return i.fullInterval()}else{if(this.isFull())return this;if(this.length()+2*n-2*Wx<=0)return i.emptyInterval()}var r=i.fromEndpoints(ap(this.lo-n,2*Math.PI),ap(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*zm:n.isEmpty()?this.length()<=2*zm:this.isFull()?n.length()>=2*(Math.PI-zm):n.isFull()?this.length()>=2*(Math.PI-zm):Math.abs(ap(n.lo-this.lo,2*Math.PI))<=zm&&Math.abs(ap(n.hi-this.hi,2*Math.PI))<=zm&&Math.abs(this.length()-n.length())<=2*zm},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 ll=4,wc=1,Wf=2,Zue=[[0,1,3,2],[0,3,1,2],[2,3,1,0],[2,1,3,0]],$L=[[0,1,3,2],[0,2,3,1],[3,2,0,1],[3,1,0,2]],g1=[wc,0,0,Wf|wc],Qq=[],Jq=[];lp(0,0,0,0,0,0);lp(0,0,0,wc,0,wc);lp(0,0,0,Wf,0,Wf);lp(0,0,0,wc|Wf,0,wc|Wf);function lp(i,e,t,n,r,s){if(i==ll){var o=(e<<ll)+t;Jq[(o<<2)+n]=(r<<2)+s,Qq[(r<<2)+n]=(o<<2)+s;return}i++,e<<=1,t<<=1,r<<=2;var a=$L[s];lp(i,e+(a[0]>>1),t+(a[0]&1),n,r,s^g1[0]),lp(i,e+(a[1]>>1),t+(a[1]&1),n,r+1,s^g1[1]),lp(i,e+(a[2]>>1),t+(a[2]&1),n,r+2,s^g1[2]),lp(i,e+(a[3]>>1),t+(a[3]&1),n,r+3,s^g1[3])}var Kue=3,eH=6,_i=30,Jx=2*_i+1,cl=Number(1n<<BigInt(_i)),hp=BigInt(eH)<<BigInt(Jx),xq=Number(BigInt(cl)<<1n),cp=function(e){return e>xq?1:e/xq},yc=function(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))},nh=function(e){return e>=0?.5*Math.sqrt(1+3*e):1-.5*Math.sqrt(1-3*e)},$x=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},qm=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]}},lT=function(e){var t=$x(e),n=qm(t,e),r=n[0],s=n[1];return[t,r,s]},ih=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)}},Que=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=qm(e,t),r=n[0],s=n[1];return[r,s,!0]},fp=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)}},rT=function(e,t,n){return ih(e,yc(cp(t)),yc(cp(n)))},yq=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)}},bq=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)}},Jue=[[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)]],ehe=[[[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]]],tH=function(e,t){return Jue[e][t]},cT=function(e,t,n){return ehe[e][t][n]},the=function(e){return tH(e,0)},nhe=function(e){return tH(e,1)},PL=Math.PI/2,wq=-PL,ar=(function(){function i(t,n){this.lat=t,this.lng=n}i.fromDegrees=function(n,r){return new i(n*CL,r*CL)},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>PL?n=PL:n<wq&&(n=wq);var r=ap(this.lng,2*Math.PI);return new i(n,r)},e.toString=function(){return"["+vq(this.lat)+", "+vq(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 _q(this.lat,n.lat)&&_q(this.lng,n.lng)},i})(),ihe=function(e,t){return new We(e[0][t],e[1][t],e[2][t])},_L=function(e,t,n){return e[0][t]=n.x,e[1][t]=n.y,e[2][t]=n.z,e},nH=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)},rhe=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]]]},YL=function(e){var t=[[0,0,0],[0,0,0],[0,0,0]];return _L(t,2,e),_L(t,1,We.ortho(e)),_L(t,0,We.fromVector(ihe(t,1).vector.cross(e.vector))),t},she=function(e,t){return nH(rhe(e),t)},ohe=function(e,t){return nH(e,t)},uT=-1,Hf=0,M1=1,iH=1e-15,Ki=2220446049250313e-31,Sq=1.8274*Ki,ahe=3.2321*Ki,LL=function(e,t,n){return n.vector.cross(e.vector).dot(t.vector)>0},Vm=function(e,t,n){var r=DL(e,t,n);return r===Hf&&(r=NL(e,t,n)),r},lhe=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=ahe*Math.sqrt(u.norm2()*f.norm2());return A>y?M1:A<-y?uT:Hf},DL=function(e,t,n){var r=e.vector.cross(t.vector).dot(n.vector);return r>Sq?M1:r<-Sq?uT:Hf},NL=function(e,t,n){if(e.equals(t)||t.equals(n)||n.equals(e))return Hf;var r=lhe(e,t,n);return r!==Hf?r:che(e,t,n,!0)},che=function(e,t,n,r){var s=M1,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=vL.fromVector(o.vector),A=vL.fromVector(a.vector),y=vL.fromVector(l.vector),w=A.cross(y),S=d.dot(w),T=S.getSign();return T===Hf&&r&&(T=uhe(d,A,y,w)),s*T},uhe=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:M1},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 Vm(r,o,n)!==uT&&a++,Vm(s,o,r)!==uT&&a++,Vm(n,o,s)===M1&&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=iH),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(YL(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(ohe(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[R1(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)})},kue(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}}])})(),hT=function(e,t,n){return e<t?t:e>n?n:e},hhe=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},fhe=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},dhe=function(e){return e<0n?-e:e},FL=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 hhe.apply(void 0,[e].concat(n))},xL=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 fhe.apply(void 0,[e].concat(n))},BL=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},ul=(1n<<64n)-1n,iu=function(e){return Number(e>>BigInt(Jx))},phe=function(e){return e&ul>>BigInt(Kue)},to=function(e){return _i-(Hue(e)>>>1)},wr=function(e,t){var n=Hm(t);return e&-n|n},ZL=function(e){var t=os(e)<<2n;return e&-t|t},ey=function(e){return(e&Hm(0)-1n)===0n},Yx=function(e){return typeof e!="bigint"||BigInt.asUintN(64,e)!=e?!1:iu(e)<=eH&&(os(e)&0x1555555555555555n)!=0n},KL=function(e){return(e&1n)!=0n},rH=function(e,t){return Number(e>>2n*BigInt(_i-t)+1n)&3},os=function(e){return e&-e},Hm=function(e){return 1n<<BigInt(2*(_i-e))},C1=function(e){var t=[e,e,e,e],n=os(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},sH=function(e,t){var n=[],r=gp(e),s=r.f,o=r.i,a=r.j,l=Ma(to(e));o&=-l,a&=-l;for(var c=Ma(t),u=-c;;u+=c){var f=void 0;if(u<0?f=a+u>=0:u>=l?f=a+u<cl:(f=!0,n.push(wr(up(s,o+u,a-c,a-l>=0),t)),n.push(wr(up(s,o+u,a+l,a+l<cl),t))),n.push(wr(up(s,o-c,a+u,f&&o-l>=0),t)),n.push(wr(up(s,o+l,a+u,f&&o+l<cl),t)),u>=l)break}return n},qi=function(e){return e-(os(e)-1n)},Gi=function(e){return e+(os(e)-1n)},Gm=function(e,t){return qi(e)<=t&&t<=Gi(e)},oH=function(e,t){return qi(t)<=Gi(e)&&Gi(t)>=qi(e)},mhe=function(e){var t=e.toString(16).padStart(16,"0").replace(/0+$/,"");return t.length===0?"X":t},Ahe=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},ghe=function(e){if(!Yx(e))return"Invalid: "+e.toString(16);for(var t=iu(e)+"/",n=1;n<=to(e);n++)t+=rH(e,n);return t},vhe=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=pp(n),s=2;s<e.length;s++){var o=parseInt(e[s],10);if(isNaN(o)||o<0||o>3)return 0n;r=C1(r)[o]}return r},_he=function(e,t,n){return wr((BigInt(e)<<BigInt(Jx))+(t||1n),n)},pp=function(e){return(BigInt(e)<<BigInt(Jx))+Hm(0)},R1=function(e){var t=lT(e.vector),n=t[0],r=t[1],s=t[2],o=Ol(nh(r)),a=Ol(nh(s));return ty(n,o,a)},aH=function(e){return R1(We.fromLatLng(e))},Ol=function(e){return hT(Math.floor(cl*e),0,cl-1)},Ma=function(e){return 1<<hT(_i-e,0,_i)},lH=function(e){return v1(Ma(e))},v1=function(e){return e/cl},cH=function(e){var t=QL(e),n=t.si,r=t.ti;return new Ci(yc(cp(n)),yc(cp(r)))},xhe=function(e){var t=gp(e),n=t.i,r=t.j;return gT(n,r,to(e))},ty=function(e,t,n){for(var r=BigInt(e)<<BigInt(Jx-1),s=e&wc,o=7;o>=0;o--){var a=(1<<ll)-1;s+=(t>>o*ll&a)<<ll+2,s+=(n>>o*ll&a)<<2,s=Jq[s],r|=BigInt(s>>2)<<BigInt(o*2*ll),s&=wc|Wf}return r*2n+1n},_1=function(e,t,n){t=hT(t,-1,cl),n=hT(n,-1,cl);var r=1/cl,s=Xq(1,2),o=Math.max(-s,Math.min(s,r*(Number(BigInt(t)<<1n)+1-cl))),a=Math.max(-s,Math.min(s,r*(Number(BigInt(n)<<1n)+1-cl))),l=lT(ih(e,o,a));return e=l[0],o=l[1],a=l[2],ty(e,Ol(.5*(o+1)),Ol(.5*(a+1)))},up=function(e,t,n,r){return r?ty(e,t,n):_1(e,t,n)},gp=function(e){for(var t=iu(e),n=t&wc,r=_i-7*ll,s=0,o=0,a=7;a>=0;a--)n+=Number((e>>BigInt(a*2*ll+1)&(1n<<BigInt(2*r))-1n)<<2n),n=Qq[n],s+=n>>ll+2<<a*ll,o+=(n>>2&(1<<ll)-1)<<a*ll,n&=wc|Wf,r=ll;return(os(e)&BigInt("0x1111111111111110"))!=0n&&(n^=wc),{f:t,i:s,j:o,orientation:n}},QL=function(e){var t=gp(e),n=t.f,r=t.i,s=t.j,o=0;return KL(e)?o=1:((BigInt(r)^e>>2n)&1n)!=0n&&(o=2),{face:n,si:2*r+o,ti:2*s+o}},gT=function(e,t,n){var r=Ma(n),s=e&-r,o=t&-r;return new qr(new Li(yc(v1(s)),yc(v1(s+r))),new Li(yc(v1(o)),yc(v1(o+r))))},yhe=function(e){return e>>2n*BigInt(_i-to(e))+1n},ny=function(e){var t=QL(e),n=t.face,r=t.si,s=t.ti;return rT(n,r,s)},JL=function(e){return We.fromVector(ny(e).normalize())},bhe=function(e){return ar.fromPoint(We.fromVector(ny(e)))},whe=function(e){var t=to(e),n=Ma(t),r=gp(e),s=r.f,o=r.i,a=r.j;return[wr(_1(s,o,a-n),t),wr(_1(s,o+n,a),t),wr(_1(s,o,a+n),t),wr(_1(s,o-n,a),t)]},uH=function(e,t){var n=Ma(t+1),r=n<<1,s=gp(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<cl):(f=-r,c=a-r>=0),(l&n)!=0?(d=r,u=l+r<cl):(d=-r,u=l-r>=0);var A=[wr(e,t),wr(up(o,a+f,l,c),t),wr(up(o,a,l+d,u),t)];return(c||u)&&A.push(wr(up(o,a+f,l+d,c&&u),t)),A},eD=function(e){var t=os(e);return e-t+(t>>2n)},iy=function(e,t){return e-os(e)+Hm(t)},hH=function(e){var t=os(e);return e+t+(t>>2n)},vT=function(e,t){return e+os(e)+Hm(t)},Ra=function(e){return e+(os(e)<<1n)&ul},fH=function(e){return e-(os(e)<<1n)&ul},She=function(e){var t=Ra(e);return t<hp?t:t-hp&ul},The=function(e){var t=fH(e);return t<hp?t:t+hp&ul},Ehe=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=hp>>n;t%=s,t<r&&(t+=s)}}else{var o=hp-e>>n;if(t>o){var a=hp>>n;t%=a,t>o&&(t-=a)}}return e+(t<<dhe(n))},Zx=function(e,t){var n=e^t;n<os(e)&&(n=os(e)),n<os(t)&&(n=os(t));var r=$q(n);return r>60?[0,!1]:[60-r>>1,!0]},OL=function(e,t){var n=qi(e);if(n>=qi(t))return t;if(Gi(e)>=t){for(;e=C1(e)[0],!(Gi(e)<t););return e}for(;!ey(e);){var r=ZL(e);if(qi(r)!==n||Gi(r)>=t)break;e=r}return e},Mhe=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=hp+os(e)-e>>n;t>s&&(t=s)}return e+(t<<n)},UL=function(e,t){return e<t?-1:e>t?1:0},Che=function(e,t){return e>t?-1:e<t?1:0},Rhe={__proto__:null,SentinelCellID:ul,face:iu,pos:phe,level:to,parent:wr,immediateParent:ZL,isFace:ey,valid:Yx,isLeaf:KL,childPosition:rH,lsb:os,lsbForLevel:Hm,children:C1,allNeighbors:sH,rangeMin:qi,rangeMax:Gi,contains:Gm,intersects:oH,toToken:mhe,fromToken:Ahe,toString:ghe,fromString:vhe,fromFacePosLevel:_he,fromFace:pp,fromPoint:R1,fromLatLng:aH,stToIJ:Ol,sizeIJ:Ma,sizeST:lH,ijToSTMin:v1,centerUV:cH,boundUV:xhe,fromFaceIJ:ty,fromFaceIJWrap:_1,fromFaceIJSame:up,faceIJOrientation:gp,faceSiTi:QL,ijLevelToBoundUV:gT,distanceFromBegin:yhe,rawPoint:ny,point:JL,latLng:bhe,edgeNeighbors:whe,vertexNeighbors:uH,childBegin:eD,childBeginAtLevel:iy,childEnd:hH,childEndAtLevel:vT,next:Ra,prev:fH,nextWrap:She,prevWrap:The,advanceWrap:Ehe,commonAncestorLevel:Zx,maxTile:OL,advance:Mhe,ascending:UL,descending:Che},kl=(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=bc}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=-DL(this.a,this.b,this.c)},e.chainCrossingSign=function(n){var r=DL(this.a,this.b,n);return this.acb===-r&&r!==Hf?(this.c=n,this.acb=-r,Ul):this._crossingSign(n,r)},e.edgeOrVertexChainCrossing=function(n){var r=We.fromVector(this.c.vector);switch(this.chainCrossingSign(n)){case Ul:return!1;case bc:return!0}return pH(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,Ul;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,fT;if(this.a.equals(this.b)||this.c.equals(n))return this.c=n,this.acb=-r,Ul;if(this.acb===Hf&&(this.acb=-NL(this.a,this.b,this.c)),r===Hf&&(r=NL(this.a,this.b,n)),r!==this.acb)return this.c=n,this.acb=-r,Ul;var o=-Vm(this.c,n,this.b);if(o!==this.acb)return this.c=n,this.acb=-r,Ul;var a=Vm(this.c,n,this.a);return a!==this.acb?(this.c=n,this.acb=-r,Ul):(this.c=n,this.acb=-r,bc)},i})(),bc=0,fT=1,Ul=2,dH=function(e,t,n,r){var s=kl.newChainEdgeCrosser(e,t,n);return s.chainCrossingSign(r)},pH=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},Ihe=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(vc(n.lat),vc(n.lat)),new eo(vc(n.lng),vc(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(vc(n.lat)),this.lng.addPoint(vc(n.lng))):this},e.expanded=function(n){var r=this.lat.expanded(vc(n.lat)),s=this.lng.expanded(vc(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 dp.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=dp.fromCenterAngle(new We(0,0,n),r);if(ap(this.lng.hi-this.lng.lo,2*Math.PI)>=0&&this.lng.hi-this.lng.lo<2*Math.PI){var o=dp.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(vc(n.lat))&&this.lng.contains(vc(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(ny(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)&&Eq(f,d,this.lat,this.lng.lo)||u.contains(this.lng.hi)&&Eq(f,d,this.lat,this.lng.hi)||Tq(f,d,this.lat.lo,this.lng)||Tq(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 Tq=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(vc(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},Eq=function(e,t,n,r){return dH(e,t,We.fromLatLng(new ar(n.lo,r)),We.fromLatLng(new ar(n.hi,r)))===bc},tD=(function(){function i(t,n){this.dim=t,this.deriv=n}var e=i.prototype;return e.value=function(n){return RL(this.deriv,-this.dim*n)},e.minLevel=function(n){if(n<=0)return _i;var r=-(gq(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=gq(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})(),kL=new tD(1,2*Math.SQRT2/3),Phe=new tD(1,1.4592137463861061),zL=new tD(2,4*Math.PI/6),Lhe=function(e,t,n){return aT(nD(e,t,n,0,!0).dist)},ru=function(e,t,n,r){return nD(e,t,n,r,!1)},Mq=function(e,t,n,r){var s=FL(We.chordAngleBetweenPoints(e,t),We.chordAngleBetweenPoints(e,n));if(s>b1){var o=nD(We.fromVector(e.vector.mul(-1)),t,n,s,!0);s=o.dist,s=xc-s}return r<s?{dist:s,less:!0}:{dist:r,less:!1}},mH=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 LL(r,t,We.fromVector(s))&&LL(We.fromVector(s),n,r)?We.fromVector(s.normalize()):e.vector.sub(t.vector).norm2()<=e.vector.sub(n.vector).norm2()?t:n},AH=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())},Dhe=function(e){return Math.max(Nhe(e),XL(e))},Nhe=function(e){if(e>=b1)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},nD=function(e,t,n,r,s){var o=Fhe(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}},Fhe=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}},Cq=We.fromCoords(1,0,0),dp=(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,iT(r))},i.fromCenterChordAngle=function(n,r){return new i(n,r)},i.fromCenterHeight=function(n,r){return i.fromCenterChordAngle(n,IL(2*r))},i.fromCenterArea=function(n,r){return i.fromCenterChordAngle(n,IL(r/Math.PI))},i.fromCap=function(n){return new i(We.fromVector(n.center.vector),n.rad)},i.emptyCap=function(){return i.fromCenterChordAngle(Cq,oT)},i.fullCap=function(){return i.fromCenterChordAngle(Cq,xc)};var e=i.prototype;return e.isValid=function(){return this.center.vector.isUnit()&&this.rad<=xc},e.isEmpty=function(){return this.rad<0},e.isFull=function(){return this.rad==xc},e.centerPoint=function(){return this.center},e.height=function(){return .5*this.rad},e.radius=function(){return aT(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>=Vx(We.chordAngleBetweenPoints(this.center,n.center),n.rad)},e.intersects=function(n){return this.isEmpty()||n.isEmpty()?!1:Vx(this.rad,n.rad)>=We.chordAngleBetweenPoints(this.center,n.center)},e.interiorIntersects=function(n){return this.rad<=0||n.isEmpty()?!1:Vx(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>=b1||this.isEmpty())return!1;if(n.containsPoint(this.center))return!0;for(var s=Kq(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)),$ue(xc,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=Yue(this.rad),l=Math.cos(ar.latitude(this.center));if(a<=l){var c=Math.asin(a/l);o.lo=ap(ar.longitude(this.center)-c,Math.PI*2),o.hi=ap(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=Vx(We.chordAngleBetweenPoints(this.center,n.center),n.rad),s=AT(r,Ki*r);return s>this.rad&&(this.rad=s),this},e.expanded=function(n){return this.isEmpty()?i.emptyCap():i.fromCenterChordAngle(this.center,Vx(this.rad,iT(n)))},e.toString=function(){return"[Center="+this.center.vector+", Radius="+Yq(this.radius())+"]"},i.radiusToHeight=function(n){return n<0?oT:n>=Math.PI?b1:.5*iT(n)},e.cellUnionBound=function(){var n=kL.maxLevel(this.radius())-1;if(n<0){for(var r=[],s=0;s<6;s++)r[s]=pp(s);return r}return uH(R1(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=AH(.5*(l-o+a),r.center,n.center);return i.fromCenterAngle(u,c)},i})(),VL=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=Bhe(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)))))},Bhe=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},Ohe=function(e,t,n){return Vm(e,t,n)*VL(e,t,n)},Rq=function(e,t,n){var r=e.pointCross(t).vector.angle(t.pointCross(n).vector);return Vm(e,t,n)===M1?r:-r},Iq=Math.asin(Math.sqrt(1/3))-.5*Ki,Ca=(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=gp(n),s=r.f,o=r.i,a=r.j,l=r.orientation,c=to(n);return new i(s,c,l,n,gT(o,a,c))},i.fromPoint=function(n){return i.fromCellID(R1(n))},i.fromLatLng=function(n){return i.fromCellID(aH(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 Ma(this.level)},e.sizeST=function(){return lH(this.level)},e.vertex=function(n){var r=this.uv.vertices()[n];return We.fromVector(ih(this.face,r.x,r.y).normalize())},e.edge=function(n){switch(n){case 0:return We.fromVector(bq(this.face,this.uv.y.lo).normalize());case 1:return We.fromVector(yq(this.face,this.uv.x.hi).normalize());case 2:return We.fromVector(bq(this.face,this.uv.y.hi).mul(-1).normalize());default:return We.fromVector(yq(this.face,this.uv.x.lo).mul(-1).normalize())}},e.boundUV=function(){return this.uv},e.center=function(){return We.fromVector(ny(this.id).normalize())},e.children=function(){var n=[];if(KL(this.id))return n;for(var r=cH(this.id),s=eD(this.id),o=0;o<4;o++){var a=new i(this.face,this.level+1,this.orientation^g1[o],s,qr.empty()),l=$L[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=Ra(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 VL(n,r,s)+VL(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 zL.value(this.level)},e.intersectsCell=function(n){return oH(this.id,n.id)},e.containsCell=function(n){return Gm(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(ih(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(ih(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;the(this.face).z===0?s=n<0?1:0:s=n>0?1:0,nhe(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(Iq,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,-Iq),eo.fullInterval())}return c.expanded(new ar(Ki,0))},e.capBound=function(){for(var n=dp.fromPoint(We.fromVector(ih(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=Que(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 IL(s+o*o)},e.distanceInternal=function(n,r){var s=We.fromVector(fp(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:xL(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)):xL(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(fp(this.face,n.vector)),s=FL(this.vertexChordDist2(r,!1,!1),this.vertexChordDist2(r,!0,!1),this.vertexChordDist2(r,!1,!0),this.vertexChordDist2(r,!0,!0));return s<=b1?s:xc-this.distance(We.fromVector(n.vector.mul(-1)))},e.boundaryDistance=function(n){return this.distanceInternal(n,!1)},e.distanceToEdge=function(n,r){var s=xL(this.distance(n),this.distance(r));if(s===0)return s;for(var o=kl.newChainEdgeCrosser(n,r,this.vertex(3)),a=0;a<4;a++)if(o.chainCrossingSign(this.vertex(a))!==Ul)return 0;for(var l=0;l<4;l++)s=ru(this.vertex(l),n,r,s).dist;return s},e.maxDistanceToEdge=function(n,r){var s=FL(this.maxDistance(n),this.maxDistance(r));return s<=b1?s:xc-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=Sc(),l=0;l<4;l++)for(var c=0;c<4;c++)a=ru(r[l],s[c],s[c+1&3],a).dist,a=ru(s[l],r[c],r[c+1&3],a).dist;return a},e.maxDistanceToCell=function(n){var r=new qr(n.uv.y,n.uv.x);if(this.face===i.oppositeFace(n.face)&&this.uv.intersects(r))return xc;for(var s=[],o=[],a=0;a<4;a++)s.push(this.vertex(a)),o.push(n.vertex(a));for(var l=oT,c=0;c<4;c++)for(var u=0;u<4;u++)l=Mq(s[c],o[u],o[u+1&3],l).dist,l=Mq(o[c],s[u],s[u+1&3],l).dist;return l},i})(),A1=-1,gH=(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===A1},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})(),vH=(function(){function i(t){this.cellTree=t.cellTree,this.prevStartID=0n,this.nodeCutoff=-1,this.nextNodeCutoff=-1,this.node={cellID:0n,label:A1,parent:-1}}var e=i.prototype;return e.clear=function(){this.prevStartID=0n,this.nodeCutoff=-1,this.nextNodeCutoff=-1,this.node.label=A1},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=A1):this.node=sT({},this.cellTree[this.node.parent])},e.done=function(){return this.node.label===A1},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=A1:this.node=sT({},this.cellTree[r]),this.nextNodeCutoff=r},i})(),Uhe=(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:Ra(Gi(o.cellID)),cellID:ul,label:-1})}n.push({startID:iy(pp(0),_i),cellID:0n,label:-1}),n.push({startID:vT(pp(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===ul&&(a=this.cellTree[a].parent),l++;this.rangeNodes.push({startID:c,contents:a})}},i})(),S1=(function(i){function e(){return i.apply(this,arguments)||this}Qx(e,i),e.fromRange=function(r,s){for(var o=new e,a=OL(r,s);a!==s;a=OL(Ra(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=jx(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(!Yx(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(!Yx(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(UL);for(var r=[],s=Ct(this),o;!(o=s()).done;){var a=o.value;if(!(r.length>0&&Gm(r[r.length-1],a))){for(var l=r.length-1;l>=0&&Gm(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=ZL(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=vT(c,f),A=iy(c,f);A!==d;A=Ra(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(Ca.fromCellID(a).rectBound())}return r},t.capBound=function(){if(this.length===0)return dp.emptyCap();for(var r=new We(0,0,0),s=Ct(this),o;!(o=s()).done;){var a=o.value,l=zL.value(to(a));r=We.fromVector(r.vector.add(JL(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=dp.fromPoint(r),u=Ct(this),f;!(f=u()).done;){var d=f.value;c=c.addCap(Ca.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(Ca.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=os(a)<<1n;l=~(l+(l<<1n));var c=a&l;return(r&l)===c&&(s&l)===c&&(o&l)===c&&!ey(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(C1(r)),a;!(a=o()).done;){var l=a.value;this.cellUnionDifferenceInternal(l,s)}},t.expandAtLevel=function(r){for(var s=new e,o=Hm(r),a=this.length-1;a>=0;a--){var l=this[a];if(os(l)<o)for(l=wr(l,r);a>0&&Gm(l,this[a-1]);)a--;s.push(l),s.push.apply(s,sH(l,r))}s.sort(UL),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=kL.maxLevel(r);u===0&&r>kL.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 zL.value(_i)*Number(this.leafCellsCovered())},t.approxArea=function(){for(var r=0,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=Ca.fromCellID(a).approxArea()}return r},t.exactArea=function(){for(var r=0,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=Ca.fromCellID(a).exactArea()}return r},e})(y1(Array)),rh=(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})(),x1=function(e,t){this.start=e,this.length=t},_T=function(e,t){this.chainID=e,this.offset=t},khe=function(e,t){this.point=e,this.contained=t},xT=function(e){return new khe(We.originPoint(),e)},_H=0,zhe=1,Vhe=2,Ghe=function(e){return e.numEdges()===0&&(e.dimension()!==2||e.numChains()===0)},qhe=function(e){return e.numEdges()===0&&e.dimension()===2&&e.numChains()>0},qx=(function(){function i(){}var e=i.prototype;return e.numEdges=function(){return 0},e.edge=function(n){return new rh(We.originPoint(),We.originPoint())},e.referencePoint=function(){return xT(!1)},e.numChains=function(){return 0},e.chain=function(n){return new x1(0,0)},e.chainEdge=function(n,r){return new rh(We.originPoint(),We.originPoint())},e.chainPosition=function(n){return new _T(0,0)},e.dimension=function(){return-1},e.isEmpty=function(){return!0},e.isFull=function(){return!1},e.typeTag=function(){return _H},e.privateInterface=function(){},i})(),Pq=(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})(),xH=(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})(),Hhe=(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 xH},i})(),yL=(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 xH},i})(),GL=0,yH=0,bL=(function(){function i(t,n){if(this.index=t,this.position=0,this.id=ul,this.cell=new yL,n!==void 0)switch(n){case GL:this.begin();break;case yH: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 JL(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===ul},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 yL):(this.id=ul,this.cell=new yL)},e.seek=function(n){var r=this;this.position=BL(this.index.cells.length,function(s){return r.index.cells[s]>=n}),this.refresh()},e.locatePoint=function(n){var r=R1(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 Ap;if(this.cellID()<=Gi(n))return sy}return this.prev()&&Gi(this.cellID())>=n?Ap:yT},i})(),Whe=(function(){function i(){this.isActive=!1,this.a=this.b=i.trackerOrigin(),this.nextCellID=iy(pp(0),_i),this.crosser=null,this.shapeIDs=[],this.savedIDs=[],this.drawTo(We.fromVector(ih(0,-1,-1).normalize()))}i.trackerOrigin=function(){return We.fromVector(ih(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 kl(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})(),jf=1,Lq=2,mp=(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!==Lq)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 kl(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!==Ul){if(R===fT){if(this.model!==jf&&(T.v0.equals(s)||T.v1.equals(s)))return this.model===Lq;pH(A.a,A.b,T.v0,T.v1)?R=bc:R=Ul}o=o!==(R===bc)}}return o},e.shapeContains=function(n,r){if(!n||n instanceof qx||!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})(),jhe=(function(){function i(t,n){n===void 0&&(n=new mp(t,jf)),this.index=t,this.containsQuery=n,this.iter=t.iterator()}var e=i.prototype;return e.capBound=function(){var n=jx(S1,this.cellUnionBound());return n.capBound()},e.rectBound=function(){var n=jx(S1,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=Zx(this.iter.cellID(),r),o=s[0];o===void 0&&(o=-1),o++;for(var a=wr(r,o),l=wr(this.iter.cellID(),o);l!=a;l=Ra(l))if(!(Gi(l)<this.iter.cellID())){var c=this.iter.cellID();this.iter.seek(Ra(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=Zx(n,r),a=o[0],l=o[1];return l||s.concat([0n]),s.concat([wr(n,a)])},i})(),Xhe=2.25*Ki,$he=3*Ki,ry=9*(1/Math.SQRT2)*Ki,bH=3*Math.SQRT2*Ki,Yhe=function(e,t,n){return Kx(e,t,n,0)},Kx=function(e,t,n,r){if($x(e.vector)===n&&$x(t.vector)===n){var s=qm(n,e.vector),o=s[0],a=s[1],l=qm(n,t.vector),c=l[0],u=l[1];return[new Ci(o,a),new Ci(c,u),!0]}var f=new _c(fp(n,e.pointCross(t).vector)),d=new _c(fp(n,e.vector)),A=new _c(fp(n,t.vector)),y=1+r,w=new _c(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)))<RL(1,-511)&&(f=new _c(We.fromVector(f.vector.mul(RL(1,563)))));var S=new _c(We.fromVector(f.vector.normalize())),T=new _c(We.fromVector(S.vector.cross(d.vector))),R=new _c(We.fromVector(A.vector.cross(S.vector))),P=Dq(A,d,new _c(We.fromVector(w.vector.mul(-1))),R,T,y),I=P[0],F=P[1],D=Dq(d,A,w,T,R,y),L=D[0],C=D[1];return[I,L,F+C<3]},Zhe=function(e,t,n){return e+t===n&&e===n-t&&t===n-e},wL=0,qL=1,_c=(function(i){function e(n){return i.call(this,n.x,n.y,n.z)||this}Qx(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)?qL: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?qL: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),Dq=function(e,t,n,r,s,o){var a=1-ry;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 _c(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]},Nq=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])},Fq=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=Nq(o,a,T1(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=Nq(o,!a,T1(l.hi,e,t,r,s));if(o=f[0],c=f[1],!c)return[n,o,!1]}return[n,o,!0]},wH=function(e,t,n){if(!n.intersects(qr.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},Khe=function(e,t,n){var r=qr.fromPoints(e,t),s=Qhe(e,t,n,r),o=s[0],a=s[1];return a?o:qr.empty()},Qhe=function(e,t,n,r){var s=e.x>t.x!=e.y>t.y,o=Fq(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=Fq(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 qr(d,f),!0]:[new qr(a,l),!1]},T1=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)},Jhe=(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})(),efe=function(e,t){var n=new Jhe(0,new Ci(0,0),new Ci(0,0)),r=lT(e.vector),s=r[0],o=r[1],a=r[2],l=lT(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=Bq(s,e,d,n.a),y=A[0],w=A[1],S=Bq(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=fp(F,d.vector),L=new _c(D),C=L.exitAxis();n.b=L.exitPoint(C),P.push(n.clone());var B=ih(F,n.b.x,n.b.y);F=tfe(F,n.b,C,L,T);var k=fp(F,B);n.face=F,n.a=new Ci(k.x,k.y)}return n.b=I,P.push(n),P},Bq=function(e,t,n,r){var s=1-ry;if(Math.max(Math.abs(r.x),Math.abs(r.y))<=s)return[e,r];var o=fp(e,n.vector),a=new _c(o);if(a.intersectsFace()){var l=a.exitPoint(a.exitAxis()),c=ih(e,l.x,l.y),u=n.vector.normalize().cross(t.vector);if(c.sub(t.vector).dot(u)>=-$he)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=qm(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]},tfe=function(e,t,n,r,s){var o=t.x,a=t.y;n==qL&&(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&&Zhe(t.x*r.x,t.y*r.y,-r.z)?s:cT(e,n,l)},nT=1,Oq=(function(){function i(t){this.rangeMin=ul,this.rangeMax=ul,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(Ra(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})(),nfe=function(e,t){if(e.dimension()!==2)return!1;var n=e.referencePoint();if(n.point===t)return n.contained;for(var r=new kl(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},Ea=(function(){function i(){this.id=0n,this.padding=0,this.boundRect=qr.empty(),this.middleRect=qr.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=qr.empty(),ey(n)){var o=r+1;return s.boundRect=new qr(new Li(-o,o),new Li(-o,o)),s.middleRect=new qr(new Li(-r,r),new Li(-r,r)),s.orientation=iu(n)&1,s}var a=gp(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=gT(l,c,s.level).expandedByMargin(r);var f=Ma(s.level);return s.iLo&=-f,s.jLo&=-f,s},i.fromParentIJ=function(n,r,s){var o=Zue[n.orientation][2*r+s],a=new i;a.id=C1(n.id)[o],a.padding=n.padding,a.boundRect=qr.fromRect(n.boundRect),a.orientation=n.orientation^g1[o],a.level=n.level+1,a.middleRect=qr.empty();var l=Ma(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=Ma(this.level),r=2*this.iLo+n,s=2*this.jLo+n;return We.fromVector(rT(iu(this.id),r,s).normalize())},e.middle=function(){if(this.middleRect.isEmpty()){var n=Ma(this.level),r=yc(cp(2*this.iLo+n)),s=yc(cp(2*this.jLo+n));this.middleRect=new qr(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=$L[this.orientation][n];return[r>>1,r&1]},e.entryVertex=function(){var n=this.iLo,r=this.jLo;if(this.orientation&Wf){var s=Ma(this.level);n+=s,r+=s}return We.fromVector(rT(iu(this.id),2*n,2*r).normalize())},e.exitVertex=function(){var n=this.iLo,r=this.jLo,s=Ma(this.level);return this.orientation===0||this.orientation===wc+Wf?n+=s:r+=s,We.fromVector(rT(iu(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=Ma(this.level);if(n.x.contains(yc(cp(2*this.iLo+r)))||n.y.contains(yc(cp(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<Ol(nh(s.x.lo))&&(o=Ol(nh(s.x.lo))),this.iLo+r-1<=Ol(nh(s.x.hi))?l=o^this.iLo+r-1:l=o^Ol(nh(s.x.hi)),a<Ol(nh(s.y.lo))&&(a=Ol(nh(s.y.lo))),this.jLo+r-1<=Ol(nh(s.y.hi))?c=a^this.jLo+r-1:c=a^Ol(nh(s.y.hi));var u=BigInt((l|c)<<1)+1n,f=_i-$q(u);return f<=this.level?this.id:wr(ty(iu(this.id),o,a),f)},i})(),Ap=0,sy=1,yT=2,Uq=0,Gx=2,p1=2*(ry+Xhe),ife=1,kq=(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 rh(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 rh(We.fromVector(this.edge.v0.vector),We.fromVector(this.edge.v1.vector)))},i})(),SL=function(e,t){this.faceEdge=e,this.bound=t},dT=(function(){function i(){var t=this;this.iterator=function(){return t.maybeApplyUpdates(),new bL(t,GL)},this.begin=function(){return t.maybeApplyUpdates(),new bL(t,GL)},this.end=function(){return t.maybeApplyUpdates(),new bL(t,yH)},this.region=function(){return new jhe(t,new mp(t,jf))},this.len=function(){return t.shapes.size},this.reset=function(){t.shapes.clear(),t.nextID=0,t.cellMap.clear(),t.cells=[],t.status=Gx},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 qx)&&(r+=o.numEdges(),r>=n))break}return r},this.shape=function(n){return t.shapes.get(n)||new qx},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=Uq,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 rfe(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=Uq}},this.build=function(){return t.maybeApplyUpdates()},this.isFresh=function(){return t.status===Gx},this.isFirstUpdate=function(){return t.pendingAdditionsPos===0},this.isShapeBeingRemoved=function(n){return n<t.pendingAdditionsPos},this.maybeApplyUpdates=function(){t.status!==Gx&&(t.applyUpdatesInternal(),t.status=Gx)},this.applyUpdatesInternal=function(){for(var n=new Whe,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 qx;if(!(o instanceof qx)){var a=new kq(n,void 0,void 0,o.dimension()===2);a.hasInterior&&s.addShape(n,nfe(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=zq(u),t.addFaceEdge(a,r)}}},this.addFaceEdge=function(n,r){var s=n.copy(),o=$x(s.edge.v0.vector);if(o===$x(s.edge.v1.vector)){var a=qm(o,s.edge.v0.vector),l=a[0],c=a[1];s.a=new Ci(l,c);var u=qm(o,s.edge.v1.vector);l=u[0],c=u[1],s.b=new Ci(l,c);var f=1-p1;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=Kx(s.edge.v0,s.edge.v1,d,p1),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=qr.empty(),c=0;c<o;c++){var u=new SL(r[c],qr.fromPoints(r[c].a,r[c].b));a[c]=u,l=l.addRect(u.bound)}var f=pp(n),d=Ea.fromCellID(f,p1),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=Ea.fromCellID(y,p1),t.updateEdges(d,a,s,A),t.skipCellRange(Ra(Gi(y)),Ra(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)===Ap&&(s=o.cellID())}return s},this.skipCellRange=function(n,r,s,o){if(s.shapeIDs.length!==0)for(var a=S1.fromRange(n,r),l=Ct(a),c;!(c=l()).done;){var u=c.value,f=[];t.updateEdges(Ea.fromCellID(u,p1),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===yT?o=!0:c===Ap&&(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(Ea.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 Hhe(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 Pq(R,0),S.containsCenter=!0,y++;else{for(;A<r.length&&r[A].faceEdge.shapeID===T;)A++;S=new Pq(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(Ra(n.id))),!0},this.updateBound=function(n,r,s,o,a){var l=new SL(n.faceEdge,new qr);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(T1(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(T1(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(Ra(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 kq(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=zq(I.edge),I.hasInterior&&o.testEdge(T,I.edge);var L=Kx(I.edge.v0,I.edge.v1,iu(n.id),p1),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 SL(H,Khe(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=Gx,this.pendingAdditionsPos=0,this.pendingRemovals=[]}var e=i.prototype;return e.removeShapeInternal=function(n,r,s){},i})(),zq=function(e){var t=e.v0.vector.sub(e.v1.vector).norm()*ife;return Phe.minLevel(t)},rfe=function(e,t,n,r){this.shapeID=e,this.hasInterior=t,this.containsTrackerOrigin=n,this.edges=r};function sfe(){return{distance:Sc(),shapeID:-1,edgeID:-1}}function TL(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 SH=(function(){function i(){this.maxResults=1/0,this.maxDistance=Sc(),this.maxError=0,this.includeInteriors=!0,this.useBruteForce=!1}var e=i.prototype;return e.setInclusiveMaxDistance=function(n){this.maxDistance=w1(n)},e.setConservativeMaxDistance=function(n){this.maxDistance=w1(AT(n,Dhe(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})(),ofe=(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=ru(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 mp(n,jf);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})(),afe=(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 EH(this.a,this.b,n,r,s)},e.updateMinDistanceToPoint=function(n,r){var s=ru(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 mp(n,jf),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})(),lfe=(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 mp(n,jf),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})(),TH=(function(){function i(t){this._includeInteriors=!0,this.index=t,this.query=new mp(t,jf)}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=EH(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=ru(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 mp(n,jf),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 EH(i,e,t,n,r){if(r===0)return{distance:0,updated:!1};if(dH(i,e,t,n)===bc)return{distance:0,updated:!0};var s=!1,o=ru(i,t,n,r);return o.less&&(r=o.dist,s=!0),o=ru(e,t,n,r),o.less&&(r=o.dist,s=!0),o=ru(t,i,e,r),o.less&&(r=o.dist,s=!0),o=ru(n,i,e,r),o.less&&(r=o.dist,s=!0),{distance:r,updated:s}}var cfe=(function(){function i(t,n){n===void 0&&(n=new SH),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?sfe():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=xc;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=xc;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=xc;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 mH(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(TL);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(TL),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=Ca.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=C1(y.id),S=Ct(w),T;!(T=S()).done;){var R=T.value,P=this.iter.locateCellID(R);if(P===Ap){var I=Ca.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===sy){var D=Ca.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(TL),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 ufe(){return{distance:Sc(),cellID:0n,label:-1}}function hfe(i){return i.label<0}var MH=(function(){function i(){this.maxResults=1/0,this.maxDistance=Sc(),this.maxError=0}var e=i.prototype;return e.setInclusiveMaxDistance=function(n){this.maxDistance=w1(n)},e.setConservativeMaxDistance=function(n){this.maxDistance=w1(AT(n,this.computeMaxDistanceError(n)))},e.computeMaxDistanceError=function(n){return XL(n)},i})(),ffe=(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})(),dfe=(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 ru(n,this.a,this.b,Sc()).dist},i})(),pfe=(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})(),mfe=(function(){function i(t){this.cellUnion=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){for(var r=Sc(),s=Ct(this.cellUnion),o;!(o=s()).done;){var a=o.value,l=Ca.fromCellID(a),c=l.distanceToCell(n);if(c<r&&(r=c),r===0)break}return r},e.distanceToPoint=function(n){for(var r=Sc(),s=Ct(this.cellUnion),o;!(o=s()).done;){var a=o.value,l=Ca.fromCellID(a),c=l.distance(n);if(c<r&&(r=c),r===0)break}return r},i})(),Afe=(function(){function i(t){this.index=t,this.edgeTarget=new TH(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,Sc());return r.distance},e.distanceToPoint=function(n){var r=this.edgeTarget.updateMinDistanceToPoint(n,Sc());return r.distance},i})(),gfe=(function(){function i(t,n){n===void 0&&(n=new MH),this.index=t,this.options=n}var e=i.prototype;return e.findClosestCells=function(n){var r=new gH(this.index,!0),s=new vH(this.index),o=[];for(r.begin();!r.done();r.next())for(s.startUnion(r);!s.done();){var a=s.cellID(),l=s.label(),c=Ca.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?ufe():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,!hfe(a)},e.isDistanceLessOrEqual=function(n,r){return this.isDistanceLess(n,w1(r))},e.isConservativeDistanceLessOrEqual=function(n,r){return this.isDistanceLess(n,w1(AT(r,XL(r))))},i})(),E1=(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})();E1.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 CH=function(e,t,n,r,s){return We.orderedCCW(n,s,r,t)&&We.orderedCCW(r,e,n,t)},vfe=function(e,t,n,r,s){return!(We.orderedCCW(e,s,r,t)&&We.orderedCCW(r,n,e,t))},_fe=(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 kl(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===nT&&(A===fT||A===bc)||o!==nT&&A===bc)&&(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 kl(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===nT&&(y===fT||y===bc)||s!==nT&&y===bc)&&(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 xfe;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=Yhe(n,r,iu(s.id)),a=o[0],l=o[1],c=o[2];if(c){this.a=a,this.b=l;var u=qr.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=efe(n,r),o=Ct(s),a;!(a=o()).done;){var l=a.value;this.a=l.a,this.b=l.b;var c=qr.fromPoints(this.a,this.b),u=Ea.fromCellID(pp(l.face),0),f=u.shrinkToFit(c),d=this.iter.locateCellID(f);d===Ap?this.cells.push(this.iter.indexCell()):d===sy&&(ey(f)||(u=Ea.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(Ea.fromParentIJ(n,0,0),o[0]),this.computeCellsIntersected(Ea.fromParentIJ(n,1,0),o[1])):r.y.lo>=s.y?(this.computeCellsIntersected(Ea.fromParentIJ(n,0,1),o[0]),this.computeCellsIntersected(Ea.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(Ea.fromParentIJ(o,s,0),n);else if(n.y.lo>=r)this.computeCellsIntersected(Ea.fromParentIJ(o,s,1),n);else{var a=this.splitVBound(n,r);this.computeCellsIntersected(Ea.fromParentIJ(o,s,0),a[0]),this.computeCellsIntersected(Ea.fromParentIJ(o,s,1),a[1])}},e.splitUBound=function(n,r){var s=n.y.clampPoint(T1(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(T1(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=[qr.fromRect(n),qr.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})(),xfe=(function(i){function e(){return i.apply(this,arguments)||this}return Qx(e,i),e})(y1(Map)),yfe=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))},Vq=new We(0,0,1),Gq=new We(0,0,-1),HL=(function(){function i(t){this.originInside=!1,this.depth=0,this.bound=Ri.emptyRect(),this.subregionBound=Ri.emptyRect(),this.vertices=t,this.index=new dT,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([Vq])},i.fullLoop=function(){return new i([Gq])};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]&&Ihe(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 E1,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=E1.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 bfe;return EL(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 wfe;return EL(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 Sfe(n.isHole());return EL(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 xT(this.originInside)},e.numEdges=function(){return this.isEmptyOrFull()?0:this.vertices.length},e.edge=function(n){return new rh(this.vertex(n),this.vertex(n+1))},e.numChains=function(){return this.isEmpty()?0:1},e.chain=function(n){return new x1(0,this.numEdges())},e.chainEdge=function(n,r){return new rh(this.vertex(r),this.vertex(r+1))},e.chainPosition=function(n){return new _T(0,n)},e.dimension=function(){return 2},e.typeTag=function(){return _H},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=kl.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!==Ap||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===yT?!1:s===sy||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=ry+bH,a=r.boundUV().expandedByMargin(o),l=Ct(s.edges),c;!(c=l()).done;){var u=c.value,f=Kx(this.vertex(u),this.vertex(u+1),r.face,o),d=f[0],A=f[1],y=f[2];if(y&&wH(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 kl(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(YL(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=Rq(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=Rq(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()?Vq:Gq;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?CH(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(Ohe),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(yfe)},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?IH(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===RH||e.containsCenter&&t===mT},EL=function(e,t,n){for(var r=new Oq(e.index),s=new Oq(t.index),o=new Hq(e,t,n,!1),a=new Hq(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=os(r.it.cellID())-os(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},qq=0,RH=1,mT=2,bfe=(function(){function i(){this.foundSharedVertex=!1}var e=i.prototype;return e.aCrossingTarget=function(){return RH},e.bCrossingTarget=function(){return mT},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,!CH(n,r,s,o,a)},i})(),wfe=(function(){function i(){this.foundSharedVertex=!1}var e=i.prototype;return e.aCrossingTarget=function(){return mT},e.bCrossingTarget=function(){return mT},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,vfe(n,r,s,o,a)},i})(),Sfe=(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 qq},e.bCrossingTarget=function(){return qq},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,IH(n,r,s,a,this.reverse)?this.containsEdge=!0:this.excludesEdge=!0,this.containsEdge&&this.excludesEdge},i})(),IH=function(e,t,n,r,s){return r.equals(e)||r.equals(n)?r.equals(e)===s:We.orderedCCW(e,n,r,t)},Hq=(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 _fe(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 kl(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!==Ul){if(c===bc)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=Ea.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})(),Tfe=(function(){function i(t){var n=this;if(t===void 0&&(t=[]),this.loops=[],this.index=new dT,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([HL.fromCell(n)])},e.initNested=function(){if(this.loops.length===1){this.initOneLoop();return}var n=new Efe;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=E1.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=E1.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 dT,this.index.add(this)}},i.fullPolygon=function(){var n=HL.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 mp(this.index,jf).contains(n)},e.containsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s!==Ap||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===yT?!1:s===sy||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=ry+bH,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=Kx(f.v0,f.v1,r.face,o),A=d[0],y=d[1],w=d[2];if(w&&wH(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 kl(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 rh(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 xT(n)},e.numChains=function(){return this.numLoops()},e.chain=function(n){if(this.cumulativeEdges.length>0)return new x1(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 x1(r,o):new x1(r,0)},e.chainEdge=function(n,r){return new rh(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 _T(r,n)},e.dimension=function(){return 2},e.typeTag=function(){return zhe},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})(),Efe=(function(i){function e(){return i.apply(this,arguments)||this}Qx(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})(y1(Map)),Mfe=(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=iH),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 E1,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=kl.newChainEdgeCrosser(a[l],a[l+1&3],this.points[0]),u=1;u<this.points.length;u++)if(c.chainCrossingSign(this.points[u])!==Ul)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 rh(this.points[n],this.points[n+1])},e.referencePoint=function(){return xT(!1)},e.numChains=function(){return Math.min(1,this.numEdges())},e.chain=function(n){return new x1(0,this.numEdges())},e.chainEdge=function(n,r){return new rh(this.points[r],this.points[r+1])},e.chainPosition=function(n){return new _T(0,n)},e.dimension=function(){return 1},e.isEmpty=function(){return Ghe(this)},e.isFull=function(){return qhe(this)},e.typeTag=function(){return Vhe},e.privateInterface=function(){},i.findEndVertex=function(n,r,s){var o=n.points[s],a=YL(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=she(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=Lhe(n,this.points[o-1],this.points[o]);a<r&&(r=a,s=o)}var l=mH(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--,LL(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=kl.newChainEdgeCrosser(this.points[r-1],this.points[r],n.points[0]),o=1;o<n.points.length;o++)if(s.chainCrossingSign(n.points[o])!==Ul)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=AH(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})(),Wq=(function(){function i(){}var e=i.prototype;return e.capBound=function(){return dp.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})(),WL=(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 PH(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=jx(S1,n.cellUnionBound());return r.normalizeCovering(s),s},e.isCanonical=function(n){return this.coverer().isCanonical(n)},i})(),PH=(function(){function i(t,n,r,s){this.region=new Wq,this.result=new S1,this.pq=new Rfe,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 Hx;var r=new Cfe(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 Hx}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=hH(r.id),l=eD(r.id);l!==a;l=Ra(l)){var c=Ca.fromCellID(l);if(s>0){this.region.intersectsCell(c)&&(o+=this.expandChildren(n,c,s));continue}var u=this.newCandidate(c);u instanceof Hx||(n.children.push(u),n.numChildren++,u.terminal&&o++)}return o},e.addCandidate=function(n){if(!(n instanceof Hx)){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=wr(a,c)),!(r>0&&Gm(n[r-1],a))){for(;r>0&&Gm(a,n[r-1]);)r--;n[r]=a,r++}}n.length=r}},e.initialCandidates=function(n){var r=new WL;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(Ca.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 Wq,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]=wr(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 WL,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=Zx(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=wr(n[u],f),R=this.replaceCellsWithAncestor(n,T);for(n.length=0,n.push.apply(n,R);f>this.minLevel&&(f-=this.levelMod,T=wr(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(!Yx(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=Zx(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)||wr(u,w)!==wr(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=iy(r,o);a!==vT(r,o);a=Ra(a)){if(s===-1||n[s]!==a)return!1;s++}return!0},e.replaceCellsWithAncestor=function(n,r){var s=BL(n.length,function(a){return n[a]>qi(r)}),o=BL(n.length,function(a){return n[a]>Gi(r)});return[].concat(n.slice(0,s),[r],n.slice(o))},i})(),Cfe=function(e){this.terminal=!1,this.numChildren=0,this.children=[],this.priority=0,this.cell=e},Hx=function(){this.cell=Ca.fromCellID(ul),this.terminal=!1,this.numChildren=0,this.children=[],this.priority=0},Rfe=(function(i){function e(){return i.apply(this,arguments)||this}Qx(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 Hx},t.reset=function(){this.length=0},e.ascending=function(r,s){return r.priority<s.priority?-1:r.priority>s.priority?1:0},e})(y1(Array)),Gn={__proto__:null,cellid:Rhe,Cap:dp,Cell:Ca,CellIndex:Uhe,CellIndexRangeIterator:gH,CellIndexContentsIterator:vH,CellUnion:S1,ClosestCellQuery:gfe,ClosestCellQueryOptions:MH,PointTarget:ffe,EdgeTarget:dfe,CellTarget:pfe,CellUnionTarget:mfe,ShapeIndexTarget:Afe,ClosestEdgeQuery:cfe,ClosestEdgeQueryOptions:SH,EdgeQueryPointTarget:ofe,EdgeQueryEdgeTarget:afe,EdgeQueryCellTarget:lfe,EdgeQueryShapeIndexTarget:TH,LatLng:ar,Loop:HL,Point:We,Polygon:Tfe,Polyline:Mfe,Rect:Ri,RegionCoverer:WL,Coverer:PH,ShapeIndex:dT};function sh(i){let e=i.attrs?.["atlas.render.as"];return e||(i.displayType==="text"?"text":"pin")}function bT(i){return i?.attrs?.["atlas.geometry.surface"]||"plane"}function iD(i){let e=oh(i);return e||Ife(i)}function Ife(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 oh(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 oy=10,LH=i=>i+1,DH=i=>Gn.cellid.level(Gn.cellid.fromToken(i)),rD={map:null,mapping:null};function wT(){return rD.map!==U.map&&(rD={map:U.map,mapping:iD(U.map)}),rD.mapping}function Pfe(i){let e=wT();if(!e)return null;let[t,n]=e.toLatLng(i[0],-i[1]);return Gn.LatLng.fromDegrees(t,n)}function NH(i){let e=Gn.LatLng.fromPoint(i);return[e.lat*180/Math.PI,e.lng*180/Math.PI]}var FH=new WeakMap;function sD(i){let e=wT();if(!e)return 0n;let t=FH.get(i);if(t&&t.mapping===e)return t.leaf;let n=Pfe(i),r=n?Gn.cellid.fromLatLng(n):0n;return typeof i=="object"&&FH.set(i,{mapping:e,leaf:r}),r}var BH={slug:"s2",name:"S2",short:"S2",appliesTo(i){return bT(i)==="sphere"&&iD(i)!==null},maxLevel(){return LH(oy)},inputLength(){return 6},level(i){return i===""?0:LH(DH(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),sD(e))},descendTarget(i,e){let t=sD(e);if(t===0n)return"";let n=i===""?0:DH(i)+1;return n>oy?"":Gn.cellid.toToken(Gn.cellid.parent(t,n))},bbox(i){if(i==="")return qf();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=wT(),[t,n]=NH(Gn.Cell.fromCellID(Gn.cellid.fromToken(i)).center()),[r,s]=e.toWorld(t,n);return[r,-s]},ring(i){let e=wT(),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=qf(),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]=NH(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)%Gf.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)>oy?Gn.cellid.toToken(Gn.cellid.parent(e,oy)):Gn.cellid.toToken(e)},locate(i){let e=sD(i);return e===0n?null:{label:"S2",value:Gn.cellid.toToken(Gn.cellid.parent(e,oy))}}};function qf(){let i=U.variant?.surface;if(i)return[i.x,-(i.y+i.height),i.x+i.width,-i.y];let e=U.game?.tileGrid.size??0,t=U.variant?.bounds||{x:0,y:0,width:e,height:e};return[t.x,-(t.y+t.height),t.x+t.width,-t.y]}var UH=[gL,BH];function ay(i){return UH.filter(e=>e.appliesTo(i))}function Ss(){return UH.find(i=>i.slug===U.gridSystem)||gL}function kH(i,e,t,n){if(!t)return"";let r=i.center(t),s=OH(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=OH(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 OH([i,e,t,n]){return(t-i)*(n-e)}function zH(i,e,t){let n=i[0]===i[i.length-1]||Lfe(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 Lfe(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 oD(i){let e=Hr();for(let t=0,n=i.length;t<n;++t)Xm(e,i[t]);return e}function Dfe(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 zl(n,r,s,o,t)}function I1(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 TT(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function vp(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 su(i,e){return ly(i,e[0],e[1])}function ah(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function ly(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function ST(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 Hr(){return[1/0,1/0,-1/0,-1/0]}function zl(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 Wm(i){return zl(1/0,1/0,-1/0,-1/0,i)}function ET(i,e){let t=i[0],n=i[1];return zl(t,n,t,n,e)}function P1(i,e,t,n,r){let s=Wm(r);return aD(s,i,e,t,n)}function jm(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function MT(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 Xm(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 aD(i,e,t,n,r){for(;t<n;t+=r)Nfe(i,e[t],e[t+1]);return i}function Nfe(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 CT(i,e){let t;return t=e(L1(i)),t||(t=e(D1(i)),t)||(t=e(N1(i)),t)||(t=e(Tc(i)),t)?t:!1}function cy(i){let e=0;return ch(i)||(e=Zn(i)*Lr(i)),e}function L1(i){return[i[0],i[1]]}function D1(i){return[i[2],i[1]]}function hl(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function VH(i,e){let t;if(e==="bottom-left")t=L1(i);else if(e==="bottom-right")t=D1(i);else if(e==="top-left")t=Tc(i);else if(e==="top-right")t=N1(i);else throw new Error("Invalid corner");return t}function uy(i,e,t,n,r){let[s,o,a,l,c,u,f,d]=lD(i,e,t,n);return zl(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 lD(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 Lr(i){return i[3]-i[1]}function lh(i,e,t){let n=t||Hr();return Dr(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]):Wm(n),n}function cD(i,e){if(!Dr(i,e))return[i.slice()];if(ah(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 Tc(i){return[i[0],i[3]]}function N1(i){return[i[2],i[3]]}function Zn(i){return i[2]-i[0]}function Dr(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function ch(i){return i[2]<i[0]||i[3]<i[1]}function GH(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function qH(i,e,t){let n=!1,r=ST(i,e),s=ST(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 HH(i,e,t,n){if(ch(i))return Wm(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 Dfe(s,o,t)}function uD(i,e){let t=e.getExtent(),n=hl(i);if(e.canWrapX()&&(n[0]<t[0]||n[0]>=t[2])){let r=Zn(t),o=Math.floor((n[0]-t[0])/r)*r;i[0]-=o,i[2]-=o}return i}function RT(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]]];uD(i,e);let r=Zn(n);if(Zn(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 WH(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(...cD(t[o],e[n]));t=s}return t}var jH={info:1,warn:2,error:3,none:4},Ffe=jH.info;function IT(...i){Ffe>jH.warn||console.warn(...i)}function Si(i,e,t){return Math.min(Math.max(i,e),t)}function XH(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 ou(i,e,t,n)}function ou(i,e,t,n){let r=t-i,s=n-e;return r*r+s*s}function $H(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 PT(i){return i*180/Math.PI}function au(i){return i*Math.PI/180}function uh(i,e){let t=i%e;return t*e<0?t+e:t}function Qo(i,e,t){return i+t*(e-i)}function $m(i,e){let t=Math.pow(10,e);return Math.round(i*t)/t}function hy(i,e){return Math.floor($m(i,e))}function fy(i,e){return Math.ceil($m(i,e))}function LT(i,e,t){if(i>=e&&i<t)return i;let n=t-e;return((i-e)%n+n)%n+e}function YH(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function Ym(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 F1(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 ZH(i,e){return i[0]*=e,i[1]*=e,i}function DT(i,e){if(e.canWrapX()){let t=Zn(e.getExtent()),n=KH(i,e,t);n&&(i[0]-=n*t)}return i}function KH(i,e,t){let n=e.getExtent(),r=0;return e.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(t=t||Zn(n),r=Math.floor((i[0]-n[0])/t)),r}function QH(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 Xf={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var hD=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_||Xf[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_}},_p=hD;var dy=6378137,B1=Math.PI*dy,Bfe=[-B1,-B1,B1,B1],Ofe=[-180,-85,180,85],NT=dy*Math.log(Math.tan(Math.PI/2)),xp=class extends _p{constructor(e){super({code:e,units:"m",extent:Bfe,global:!0,worldExtent:Ofe,getPointResolution:function(t,n){return t/Math.cosh(n[1]/dy)}})}},fD=[new xp("EPSG:3857"),new xp("EPSG:102100"),new xp("EPSG:102113"),new xp("EPSG:900913"),new xp("http://www.opengis.net/def/crs/EPSG/0/3857"),new xp("http://www.opengis.net/gml/srs/epsg.xml#3857")];function JH(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]=B1*i[s]/180;let o=dy*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>NT?o=NT:o<-NT&&(o=-NT),e[s+1]=o}return e}function eW(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]/B1,e[s+1]=360*Math.atan(Math.exp(i[s+1]/dy))/Math.PI-90;return e}var Ufe=6378137,tW=[-180,-90,180,90],kfe=Math.PI*Ufe/180,$f=class extends _p{constructor(e,t){super({code:e,units:"degrees",extent:tW,axisOrientation:t,global:!0,metersPerUnit:kfe,worldExtent:tW})}},dD=[new $f("CRS:84"),new $f("EPSG:4326","neu"),new $f("urn:ogc:def:crs:OGC:1.3:CRS84"),new $f("urn:ogc:def:crs:OGC:2:84"),new $f("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new $f("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new $f("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var pD={};function nW(i){return pD[i]||pD[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function iW(i,e){pD[i]=e}function hh(i){for(let e in i)delete i[e]}function lu(i){let e;for(e in i)return!1;return!e}var O1={};function U1(i,e,t){let n=i.getCode(),r=e.getCode();n in O1||(O1[n]={}),O1[n][r]=t}function FT(i,e){return i in O1&&e in O1[i]?O1[i][e]:null}var BT=.9996,Ec=.00669438,UT=Ec*Ec,kT=UT*Ec,Zm=Ec/(1-Ec),rW=Math.sqrt(1-Ec),k1=(1-rW)/(1+rW),lW=k1*k1,mD=lW*k1,AD=mD*k1,cW=AD*k1,uW=1-Ec/4-3*UT/64-5*kT/256,zfe=3*Ec/8+3*UT/32+45*kT/1024,Vfe=15*UT/256+45*kT/1024,Gfe=35*kT/3072,qfe=3/2*k1-27/32*mD+269/512*cW,Hfe=21/16*lW-55/32*AD,Wfe=151/96*mD-417/128*cW,jfe=1097/512*AD,OT=6378137;function Xfe(i,e,t){let n=i-5e5,o=(t.north?e:e-1e7)/BT/(OT*uW),a=o+qfe*Math.sin(2*o)+Hfe*Math.sin(4*o)+Wfe*Math.sin(6*o)+jfe*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-Ec*c,w=Math.sqrt(1-Ec*c),S=OT/w,T=(1-Ec)/y,R=Zm*u**2,P=R*R,I=n/(S*BT),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*Zm))+B/720*(61+90*d+298*R+45*A-252*Zm-3*P),z=(I-D/6*(1+2*d+R)+C/120*(5-2*R+28*d-3*P+8*Zm+24*A))/u;return z=LT(z+au(hW(t.number)),-Math.PI,Math.PI),[PT(z),PT(k)]}var sW=-80,oW=84,$fe=-180,Yfe=180;function Zfe(i,e,t){i=LT(i,$fe,Yfe),e<sW?e=sW:e>oW&&(e=oW);let n=au(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,c=au(i),u=hW(t.number),f=au(u),d=OT/Math.sqrt(1-Ec*r**2),A=Zm*s**2,y=s*LT(c-f,-Math.PI,Math.PI),w=y*y,S=w*y,T=S*y,R=T*y,P=R*y,I=OT*(uW*n-zfe*Math.sin(2*n)+Vfe*Math.sin(4*n)-Gfe*Math.sin(6*n)),F=BT*d*(y+S/6*(1-a+A)+R/120*(5-18*a+l+72*A-58*Zm))+5e5,D=BT*(I+d*o*(w/2+T/24*(5-a+9*A+4*A**2)+P/720*(61-58*a+l+600*A-330*Zm)));return t.north||(D+=1e7),[F,D]}function hW(i){return(i-1)*6-180+3}var Kfe=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function fW(i){let e=0;for(let r of Kfe){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 aW(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 dW(i){return fW(i)?new _p({code:i,units:"m"}):null}function pW(i){let e=fW(i.getCode());return e?{forward:aW(Zfe,e),inverse:aW(Xfe,e)}:null}var Qfe=63710088e-1;function gD(i,e,t){t=t||Qfe;let n=au(i[1]),r=au(e[1]),s=(r-n)/2,o=au(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 Jfe=[pW],ede=[dW];var _D=!0;function AW(i){_D=!(i===void 0?!0:i)}function yD(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 xD(i){iW(i.getCode(),i),U1(i,i,yD)}function tde(i){i.forEach(xD)}function Os(i){if(typeof i!="string")return i;let e=nW(i);if(e)return e;for(let t of ede){let n=t(i);if(n)return n}return null}function bD(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/Xf[n])}}else{let o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{let a=Km(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=gD(c.slice(0,2),c.slice(2,4)),f=gD(c.slice(4,6),c.slice(6,8));r=(u+f)/2}let l=n?Xf[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function mW(i){tde(i),i.forEach(function(e){i.forEach(function(t){e!==t&&U1(e,t,yD)})})}function nde(i,e,t,n){i.forEach(function(r){e.forEach(function(s){U1(r,s,t),U1(s,r,n)})})}function zT(i,e){return i?typeof i=="string"?Os(i):i:Os(e)}function gW(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 z1(i,e){if(i===e)return!0;let t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||Km(i,e)===yD)&&t}function Km(i,e){let t=i.getCode(),n=e.getCode(),r=FT(t,n);if(r)return r;let s=null,o=null;for(let l of Jfe)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=FT(t,a);l&&(r=vD(l,o.forward))}else{let l=FT(a,n);l&&(r=vD(s.inverse,l))}return r&&(xD(i),xD(e),U1(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 Qm(i,e){let t=Os(i),n=Os(e);return Km(t,n)}function V1(i,e,t){let n=Qm(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 vW(i,e,t,n){let r=Qm(e,t);return HH(i,r,void 0,n)}var cu=null;function Jm(){return cu}function py(i,e){return cu?V1(i,e,cu):i}function uu(i,e){return cu?V1(i,cu,e):(_D&&!Ym(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(_D=!1,IT("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i)}function yp(i,e){return cu?vW(i,e,cu):i}function hu(i,e){return cu?vW(i,cu,e):i}function _W(i,e){if(!cu)return i;let t=Os(e).getMetersPerUnit(),n=cu.getMetersPerUnit();return t&&n?i*t/n:i}function ide(){mW(fD),mW(dD),nde(dD,fD,JH,eW)}ide();function wD(i){return i[0]>0&&i[1]>0}function xW(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 as(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}var VT=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 eA(i,e,t,n,r){return r!==void 0?(r.minX=i,r.maxX=e,r.minY=t,r.maxY=n,r):new VT(i,e,t,n)}var GT=VT;function yW(i,e,t){let n,r;t=t||fl;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 fl(i,e){return i>e?1:i<e?-1:0}function bW(i,e){return i<e?1:i>e?-1:0}function G1(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 wW(i,e,t){for(;e<t;){let n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function fu(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 Jo(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 SW(i,e,t){let n=e||fl;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 TW(i,e,t,n,r){return!CT(r,function(o){return!bp(i,e,t,n,o[0],o[1])})}function bp(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 my(i,e,t,n,r,s){if(t.length===0||!bp(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(bp(i,t[o-1],t[o],n,r,s))return!1;return!0}function EW(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(my(i,e,l,n,r,s))return!0;e=l[l.length-1]}return!1}function MW(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 qT(i,e,t,n,r,s){return s=s??aD(Hr(),i,e,t,n),Dr(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:MW(i,e,t,n,function(o,a){return qH(r,o,a)}):!1}function SD(i,e,t,n,r){return!!(qT(i,e,t,n,r)||bp(i,e,t,n,r[0],r[1])||bp(i,e,t,n,r[0],r[3])||bp(i,e,t,n,r[2],r[1])||bp(i,e,t,n,r[2],r[3]))}function TD(i,e,t,n,r){if(!SD(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(TW(i,t[s-1],t[s],n,r)&&!qT(i,t[s-1],t[s],n,r))return!1;return!0}function CW(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(TD(i,e,a,n,r))return!0;e=a[a.length-1]}return!1}function ei(){throw new Error("Unimplemented abstract method.")}var rde=0;function Bn(i){return i.ol_uid||(i.ol_uid=String(++rde))}function q1(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function sde(i,e,t){return i+"/"+e+"/"+t}function H1(i,e,t,n,r){return`${Bn(i)},${e},${sde(t,n,r)}`}function RW(i){return ode(i[0],i[1],i[2])}function ode(i,e,t){return(e<<i)+t}function IW(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 W1=[0,0,0],wp=5,ED=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(SW(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_=Tc(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 GT(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=eA(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 eA(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 eA(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 eA(c,c,u,u,n);let f=Math.floor(l*(s+1))-1,d=Math.floor(l*(o+1))-1;return eA(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,W1);let r=W1[1],s=W1[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,W1);let o=W1[1],a=W1[2];return eA(r,o,s,a,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=as(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=as(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 zl(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=as(this.getTileSize(o),this.tmpSize_),u=a*(e-l[0])/n/c[0],f=a*(l[1]-t)/n/c[1];return r?(u=fy(u,wp)-1,f=fy(f,wp)-1):(u=hy(u,wp),f=hy(f,wp)),q1(o,u,f,s)}getTileCoordForXYAndZ_(e,t,n,r,s){let o=this.getOrigin(n),a=this.getResolution(n),l=as(this.getTileSize(n),this.tmpSize_),c=(e-o[0])/a/l[0],u=(o[1]-t)/a/l[1];return r?(c=fy(c,wp)-1,u=fy(u,wp)-1):(c=hy(c,wp),u=hy(u,wp)),q1(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=G1(this.resolutions_,e,t||0);return Si(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return SD(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}},Ay=ED;function HT(i){let e=i.getDefaultTileGrid();return e||(e=lde(i),i.setDefaultTileGrid(e)),e}function LW(i,e,t){let n=e[0],r=i.getTileCoordCenter(e),s=WT(t);if(!su(s,r)){let o=Zn(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,i.getTileCoordForCoordAndZ(r,n)}return e}function ade(i,e,t,n){n=n!==void 0?n:"top-left";let r=NW(i,e,t);return new Ay({extent:i,origin:VH(i,n),resolutions:r,tileSize:t})}function DW(i){let e=i||{},t=e.extent||Os("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:NW(t,e.maxZoom,e.tileSize,e.maxResolution)};return new Ay(n)}function NW(i,e,t,n){e=e!==void 0?e:42,t=as(t!==void 0?t:256);let r=Lr(i),s=Zn(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 lde(i,e,t,n){let r=WT(i);return ade(r,e,t,n)}function WT(i){i=Os(i);let e=i.getExtent();if(!e){let t=180*Xf.degrees/i.getMetersPerUnit();e=zl(-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 j1(i,e,t,n){return qn(i,e,t,n,!0)}function li(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),hh(i))}var rn={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 MD=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},Sp=MD;function Yf(){return!0}function Zf(){return!1}function Kf(){}function jT(i){let e,t,n;return function(){let r=Array.prototype.slice.call(arguments);return(!t||this!==n||!Jo(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function FW(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 CD=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var mo=CD;var RD=class extends Sp{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 mo(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,Kf);delete o[n]}return l}disposeInternal(){this.listeners_&&hh(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]=Kf,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},Tp=RD;var tA=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",cde=tA.includes("safari")&&!tA.includes("chrom"),rBe=cde&&(tA.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(tA)),BW=tA.includes("webkit")&&!tA.includes("edge"),ID=tA.includes("macintosh"),OW=typeof devicePixelRatio<"u"?devicePixelRatio:1,no=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,PD=typeof Image<"u"&&Image.prototype.decode;var XT=(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 UW(i,e,t){let n=i,r=!0,s=!1,o=!1,a=[j1(n,rn.LOAD,function(){o=!0,s||e()})];return n.src&&PD?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(j1(n,rn.ERROR,t)),function(){r=!1,a.forEach(li)}}function ude(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 kW(i,e){return e&&(i.src=e),i.src&&PD?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(r=>i.complete&&i.width?t(i):n(r))):ude(i)}var an={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function LD(i){return Math.pow(i,3)}function Mc(i){return 1-LD(1-i)}function zW(i){return 3*i*i-2*i*i*i}function VW(i){return i}var DD=class extends Tp{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(rn.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:LD(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()}},X1=DD;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 ND;function gy(){return ND||(ND=Di(1,1)),ND}function nA(i){let e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function FD(i,e){let t=e.parentNode;t&&t.replaceChild(i,e)}function GW(i){for(;i.lastChild;)i.lastChild.remove()}function qW(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 $T(){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 Vl(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}var BD=class extends X1{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_=hde(),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_=UW(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 hde(){let i=Di(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}var YT=BD;var OD,iA=[];function HW(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 UD(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function fde(){if(OD===void 0){let i=Di(6,6,iA);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",HW(i,4,5,4,0),HW(i,4,5,0,5);let e=i.getImageData(0,0,3,3).data;OD=UD(e,0)||UD(e,4)||UD(e,8),nA(i),iA.push(i.canvas)}return OD}function WW(i,e,t,n){let r=V1(t,e,i),s=bD(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||su(l,r)){let c=bD(i,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function jW(i,e,t,n){let r=hl(t),s=WW(i,e,r,n);return(!isFinite(s)||s<=0)&&CT(t,function(o){return s=WW(i,e,o,n),isFinite(s)&&s>0}),s}function XW(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),iA);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=Hr();l.forEach(function(F,D,L){MT(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(Zn(S)*R),Math.round(Lr(S)*R),iA),f||(T.imageSmoothingEnabled=!1),r&&A){let F=(r[0]-S[0])*R,D=-(r[3]-S[3])*R,L=Zn(r)*R,C=Lr(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=Zn(F.clipExtent)*R,H=Lr(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=Zn(F.extent)*R,z=Lr(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=Tc(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),ge=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,ge-J]],mt=$H(Fe);if(!mt)return;if(y.save(),y.beginPath(),fde()||!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,ge)}else y.moveTo(te,ce),y.lineTo($,J),y.lineTo(he,ge);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(Zn(Ye)/Ee.width,-Lr(Ye)/Ee.height)}y.drawImage(Ee,0,0),y.restore()}),T&&(nA(T),iA.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 dde=[1,0,0,1,0,0],NBe=new Array(6);function Ao(){return dde.slice(0)}function $W(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 Wr(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 Ro(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 KT(i,e){let t=pde(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 pde(i){return i[0]*i[3]-i[1]*i[2]}var mde=[1e5,1e5,1e5,1e5,2,2];function YW(i){return"matrix("+i.join(", ")+")"}function ZT(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function ZW(i,e){let t=ZT(i),n=ZT(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*mde[r])!==0)return!1;return!0}var Ade=10,KW=.25,kD=class{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={},c=a?gW(P=>Wr(a,V1(P,this.targetProj_,this.sourceProj_))):Qm(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()&&Zn(r)>=Zn(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Zn(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Zn(this.targetProj_.getExtent()):null;let u=Tc(n),f=N1(n),d=D1(n),A=L1(n),y=this.transformInv_(u),w=this.transformInv_(f),S=this.transformInv_(d),T=this.transformInv_(A),R=Ade+(o?Math.max(0,Math.ceil(Math.log2(cy(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=oD([s,o,a,l]),f=this.sourceWorldWidth_?Zn(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=oD([e,t,n,r]);y=Zn(S)/this.targetWorldWidth_>KW||y}!A&&this.sourceProj_.isGlobal()&&f&&(y=f>KW||y)}if(!y&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!Dr(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=(uh(s[0],d)+uh(a[0],d))/2-uh(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=Hr();return this.triangles_.forEach(function(t,n,r){let s=t.source;Xm(e,s[0]),Xm(e,s[1]),Xm(e,s[2])}),e}getTriangles(){return this.triangles_}},QW=kD;var zD=class extends X1{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?lh(A,y):A;if(cy(S)===0){this.state=an.EMPTY;return}let T=e.getExtent();T&&(w?w=lh(w,T):w=T);let R=r.getResolution(this.wrappedTileCoord_[0]),P=jW(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 QW(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=lh(F,w)),!cy(F))this.state=an.EMPTY;else{let D=0,L=0;e.canWrapX()&&(D=Zn(T),L=Math.floor((F[0]-T[0])/D)),RT(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_=XW(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,rn.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_&&(nA(this.canvas_.getContext("2d")),iA.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},QT=zD;var gde=/\{z\}/g,vde=/\{x\}/g,_de=/\{y\}/g,xde=/\{-y\}/g;function JW(i,e,t,n,r){return i.replace(gde,e.toString()).replace(vde,t.toString()).replace(_de,n.toString()).replace(xde,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 ej(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 yde(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 JW(i,o,t[1],t[2],s)})}function tj(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=yde(i[r],e);return bde(n)}function bde(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;let r=RW(e),s=uh(r,i.length);return i[s](e,t,n)})}var du={PROPERTYCHANGE:"propertychange"};var $1=class extends Tp{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(rn.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]=j1(this,e[s],t)}else n=j1(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)wde(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)}};$1.prototype.on;$1.prototype.once;$1.prototype.un;function wde(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)li(i[e]);else li(i)}var JT=$1;var eE=class extends mo{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},VD=class extends JT{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 eE(n,e,t)),n=du.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new eE(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],lu(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},Us=VD;var GD=class extends Us{constructor(e){super(),this.projection=Os(e.projection),this.attributions_=nj(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_=nj(e),this.changed()}setState(e){this.state_=e,this.changed()}};function nj(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}var tE=GD;var qD=class extends tE{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&&as(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:HT(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=as(r.getTileSize(e),this.tmpSize);return s==1?o:xW(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=LW(r,e,n)),IW(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},nE=class extends mo{constructor(e,t){super(e),this.tile=t}},ij=qD;var iE={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var HD=class i extends ij{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=iE.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==an.ERROR?iE.TILELOADERROR:r==an.LOADED?iE.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new nE(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=ej(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`3-`);this.generateTileUrlFunction_?this.setTileUrlFunction(tj(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},rj=HD;var WD=class extends rj{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:Sde,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:YT,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!z1(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||z1(t,e)))return this.tileGrid;let n=Bn(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=HT(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(rn.CHANGE,this.handleTileChange.bind(this)),u}getTile(e,t,n,r,s,o){let a=this.getProjection();if(!a||!s||z1(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 QT(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=H1(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 Sde(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 sj=WD;var jD=class extends sj{constructor(e){e=e||{};let t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:DW({extent:WT(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_}},oj=jD;function pu(){if(!U.map||!U.variant||U.settling)return;let i=U.engine?.getView();try{let e=aj();e.last=U.game.slug,e.games[U.game.slug]={game:U.game.slug,map:U.map.slug,variant:U.map.variants.indexOf(U.variant),center:i?.getCenter(),zoom:i?.getZoom(),hidden:[...U.hiddenCategories],collapsed:[...U.collapsedSections],overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed},localStorage.setItem(pL,JSON.stringify(e))}catch{}}function aj(){try{let i=JSON.parse(localStorage.getItem(pL)||"null");if(i&&i.games)return i}catch{}return{last:"",games:{}}}function Y1(i){let e=aj(),t=i||e.last,n=t&&e.games[t];return n&&n.game&&n.map?n:null}function Z1(){let[i,e]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(t=>t.trim());return{game:i,map:e}}function lj(){if(!U.game||!U.map)return;let i=`#${U.game.slug}/${U.map.slug}`;location.hash!==i&&history.replaceState(null,"",i)}var XD=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,rn.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?Tde(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 Tde(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 Ep=XD;function dl(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 rE(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 cj(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 uj(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=Ao(),Ede=[NaN,NaN],$D=class extends Us{constructor(){super(),this.extent_=Hr(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=jT((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,Ede,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]))&&Wm(t),this.extentRevision_=this.getRevision()}return GH(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=Lr(c)/Lr(l);Ro(hj,c[0],c[3],u,-u,0,0,0);let f=dl(s,0,s.length,a,hj,o),d=Qm(n,t);return d?d(f,f,a):f}:Qm(n,t);return this.applyTransform(r),this}},fj=$D;var YD=class extends fj{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return P1(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=dj(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){ei()}setLayout(e,t,n){let r;if(e)r=dj(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=Mde(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();rE(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=hl(this.getExtent()));let r=this.getFlatCoordinates();if(r){let s=this.getStride();cj(r,0,r.length,s,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();uj(n,0,n.length,r,e,t,n),this.changed()}}};function Mde(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function dj(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function pj(i,e,t){let n=i.getFlatCoordinates();if(!n)return null;let r=i.getStride();return dl(n,0,n.length,r,e,t)}var fh=YD;function mj(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function vy(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 ZD(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=vy(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function Aj(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=ZD(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 KD=class i extends fh{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=ou(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 ET(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return ly(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=mj(this.flatCoordinates,0,e,this.stride),this.changed()}},mu=KD;function rA(){return hq[U.map?.iconOutset==="dark"?"dark":"light"]}function Cde(i){let e=U.map?.iconOutset==="dark",t=Ide(i);return(e?t>.3:t<.88)?i:Rde(i,e?.74:.42)}function Rde(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 Ide(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 sE(i){let e=Math.abs(Number(i)||0);return Gf[(Math.imul(e,2654435761)>>>0)%Gf.length]}function Qf(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 K1(i,e){i.style.setProperty("--pin-color",sA(e))}function sA(i){return Cde(i.color||sE(i.id))}function Q1(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("${QD(e.iconAsset)}")`),i.classList.add("has-source-icon")}function QD(i){let e=i.split("/").map(t=>encodeURIComponent(t)).join("/");return`${U.game.base}/icons/${e}`}function Au(i){return i.split(/\s+/).slice(0,2).map(e=>e[0]||"").join("")}function gj(i){return Math.imul(Number(i)||0,2654435761)>>>0}function vj(i){return String(i||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`4-5-`).trim()}function gu(i){return new Intl.NumberFormat().format(i)}function ls(i,e,t){return Math.min(t,Math.max(e,i))}function oE(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var Pde=100;function Mp(){if(!_e.searchResults)return;let i=U.pins.filter(n=>!n.filteredHidden).sort((n,r)=>n.location.title.localeCompare(r.location.title)),e=i.slice(0,Pde),t=document.createDocumentFragment();if(!e.length){let n=document.createElement("p");n.className="search-empty",n.textContent=U.search?"No visible locations match.":"Nothing is enabled. Show a category to list its locations.",t.append(n)}for(let n of e){let r=document.createElement("button");r.type="button",r.className="search-result",U.selectedPin===n&&r.classList.add("is-selected"),r.dataset.location=String(n.location.id),K1(r,n.category);let s=document.createElement("span");s.className="result-dot",Q1(s,n.category,Au(n.category.title));let o=document.createElement("span"),a=document.createElement("strong");a.textContent=n.location.title;let l=document.createElement("small");l.textContent=`${n.category.title} \xB7 ${n.group.title}`,o.append(a,l),r.append(s,o),t.append(r)}if(i.length>e.length){let n=document.createElement("p");n.className="dock-note",n.textContent=`First ${e.length} of ${gu(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}_e.searchResults.replaceChildren(t),Dde(i.length),Lde()}var _j=28;function Lde(){let i=U.selectedPin?.location.title||"",e=i.length>_j?`${i.slice(0,_j-1).trimEnd()}\u2026`:i;_e.dockRailName.textContent=e?` \xB7 ${e}`:"",_e.dockRailName.hidden=!e}function Dde(i){_e.dockCount.textContent=`${gu(i)} ${i===1?"location":"locations"}`,U.search?(_e.dockFlag.textContent=`\u201C${U.search}\u201D`,_e.dockFlag.hidden=!1):U.hiddenCategories.size>0?(_e.dockFlag.textContent="filtered",_e.dockFlag.hidden=!1):_e.dockFlag.hidden=!0}function aE(){!U.dockFolded||U.dockDismissed||lE(!1)}function JD(i){U.dockDismissed=i,lE(i)}function lE(i,e=!0){U.dockFolded=i,_e.dock.classList.toggle("is-folded",i),_e.dockFold.setAttribute("aria-expanded",String(!i));let t=i?"Bring the panel back (\u2318\u2325B)":"Put the panel away (\u2318\u2325B)";_e.dockFold.setAttribute("aria-label",t),_e.dockFold.setAttribute("title",t),e&&pu()}function eN(i){U.hiddenCategories.delete(i.category.id),xy(),Cc(),Cp(),_y(i,!0)}function _y(i,e=!1){U.selectedPin=i,document.dispatchEvent(new Event("atlas:selection")),_u(),U.layers.pins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.textDetail.changed(),U.layers.priority.changed(),_e.detailTitle.textContent=i.location.title,_e.detailCategory.textContent=`${i.group.title} / ${i.category.title}`,_e.detailDescription.textContent="",_e.detailLinks.hidden=!0,Fde(i),_e.detailID.textContent=String(i.location.id),_e.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=fq(i.coordinate);_e.detailCell.textContent=t,_e.detailCellField.hidden=!t;for(let r of _e.detail.querySelectorAll("[data-cell-system-row]"))r.remove();for(let r of ay(U.map)){if(r.slug==="geohash")continue;let s=r.locate(i.coordinate,U.map);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),_e.detailCellField.after(o)}let n=Nde(i);if(_e.detailSource.textContent=n,_e.detailSourceField.hidden=!n,K1(_e.detailDot,i.category),Q1(_e.detailDot,i.category,Au(i.category.title)),_e.detail.hidden=!1,aE(),Mp(),e){let r=U.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(dh(U.variant),Math.max(r.getZoom()||0,4)),duration:220})}}function Nde(i){let e=U.map?.merged;if(!e?.length)return"";let t=e.find(n=>n.origin)?.source||"";if(U.pinSourceIndex?.map!==U.map){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)}}U.pinSourceIndex={map:U.map,byID:n}}for(let n of e)if(!n.origin&&i.group.title===n.source)return n.source;return U.pinSourceIndex.byID.get(i.location.id)||t}async function Fde(i){let e=await xj();if(U.selectedPin!==i)return;let t=e[String(i.location.id)]||{};i.location.description=t.d||"",i.location.links=t.l||[],_e.detailDescription.textContent=vj(t.d)||"No description is included in the archive.",Bde(i)}function Bde(i){let e=(i.location.links||[]).filter(n=>U.pinByID.has(n.locationId));if(_e.detailLinks.hidden=e.length===0,!e.length){_e.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)}_e.detailLinks.replaceChildren(t)}function vu(){let i=U.selectedPin!==null;U.selectedPin=null,document.dispatchEvent(new Event("atlas:selection")),U.sources&&(_u(),U.layers.pins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.textDetail.changed(),U.layers.priority.changed()),_e.detail.hidden=!0,i&&Mp()}function ph(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 J1(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++]=ph(i,e,l,n,r[s]),e=l}return r.length=s,r}function yy(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?[]:J1(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}var tN=class i extends fh{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){fu(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<vp(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=ou(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 ph(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new mu(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 mu(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(ly(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=vy(this.flatCoordinates,0,e,this.stride),this.changed()}},yj=tN;function nN(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+=nN(i,e,a,n),e=a}return r}function bj(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 wj(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]=Qo(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 rN(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=ou(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function sN(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=rN(i,e,a,n,r),e=a}return r}function Sj(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=sN(i,e,a,n,r),e=a[a.length-1]}return r}function oN(i,e,t,n,r,s,o,a,l,c,u){if(e==t)return c;let f,d;if(r===0){if(d=ou(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(wj(i,A-n,A,n,o,a,u),d=ou(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&&(wj(i,t-n,e,n,o,a,u),d=ou(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 aN(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=oN(i,e,A,n,r,s,o,a,l,c,u),e=A}return c}function Tj(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=aN(i,e,A,n,r,s,o,a,l,c,u),e=A[A.length-1]}return c}function by(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=XH(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 Ej(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=by(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Rp(i,e){return e*Math.round(i/e)}function Ode(i,e,t,n,r,s,o){if(e==t)return o;let a=Rp(i[e],r),l=Rp(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,u;do if(c=Rp(i[e],r),u=Rp(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=Rp(i[e],r),d=Rp(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 wy(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=Ode(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Mj(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l],f=[];o=wy(i,e,u,n,r,s,o,f),a.push(f),e=u[u.length-1]}return o}var lN=class i extends fh{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<vp(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(rN(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),oN(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return nN(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return ph(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=by(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return qT(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=vy(this.flatCoordinates,0,e,this.stride),this.changed()}},cN=lN;function Sy(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(fl),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,my(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=Sy(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function Cj(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 uN(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 hN(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=uN(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 Rj(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(!hN(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function uE(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=uN(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&Cj(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=uE(i,e,t[s],n,r);return e}function Ij(i,e){let t=[],n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){let l=e[o],c=uN(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 hE=class i extends fh{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?fu(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<vp(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(sN(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),aN(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return my(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(),uE(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,J1(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=hl(this.getExtent());this.flatInteriorPoint_=Sy(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new mu(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new cN(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 cN(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;hN(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=uE(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=wy(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return TD(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=ZD(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},mh=hE;function dN(i){if(ch(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 hE(s,"XY",[s.length])}function fE(i,e,t,n){let r=[],s=Hr();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=P1(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 pN=class i extends fh{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;fu(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;fu(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<vp(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Sj(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Tj(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return EW(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return bj(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,yy(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=fE(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 yj(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;Rj(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=Mj(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 mh(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 mh(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return CW(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=Aj(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()}},dE=pN;function Pj(i){return i.key.toLocaleLowerCase()==="g"?(i.preventDefault(),Lj(),U.gridEnabled?(_e.gridInput.focus(),_e.gridInput.select()):_e.viewport.focus({preventScroll:!0}),!0):i.key===" "&&U.gridEnabled&&i.target!==_e.subgridToggle?(i.preventDefault(),Ty(!U.subgridVisible),!0):i.key==="Escape"&&U.gridEnabled?(i.preventDefault(),mN(),!0):!1}function Lj(i=!U.gridEnabled){U.gridEnabled=i,i&&Ty(!0),Ey(),_u(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()}function Ty(i){U.subgridVisible=i,U.layers.grid.changed(),U.layers.gridContext.changed(),_e.subgridToggle.setAttribute("aria-pressed",String(i)),_e.subgridToggle.setAttribute("aria-label",i?"Hide the subgrid":"Show the subgrid"),Dj(),document.dispatchEvent(new Event("atlas:grid"))}function Dj(){if(!U.gridEnabled){_e.gridHint.textContent="G \xB7 grid off";return}_e.gridHint.textContent=`G-${U.gridCell||"root"}`+(U.subgridVisible?"":" no subgrid")}function oA(i){let e=Ss(),t=e.parseInput(e.normalizeInput(i));if(t===null)return;let n=t!==U.gridCell;U.gridCell=t,U.gridEnabled||(U.gridEnabled=!0),Ey(),_u(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed(),n&&(vu(),U.engine.getView().fit(gN(),{size:U.engine.getSize(),padding:[52,52,52,52],maxZoom:dh(U.variant),duration:180}))}function mN(){if(U.gridEnabled){if(!U.gridCell){Lj(!1);return}oA(Ss().parent(U.gridCell))}}function Ey(){if(U.sources){if(U.sources.grid.clear(),U.sources.gridContext.clear(),_e.gridNavigator.hidden=!U.gridEnabled,Dj(),Ude(),U.gridEnabled&&U.variant){let i=Ss();_e.gridInput.maxLength=i.inputLength(U.map),_e.gridInput.value=U.gridCell,_e.gridBack.title=U.gridCell?`Back one ${i.slug} level`:`Close ${i.slug} grid`;for(let e of AE())Gde(e)}document.dispatchEvent(new Event("atlas:grid"))}}function Ude(){let i=ay(U.map),e=Ss();if(_e.gridSystemName.textContent=e.name,_e.gridSystem.hidden=i.length<2,i.length<2)return;let t=i[(i.indexOf(e)+1)%i.length];_e.gridSystem.textContent=e.short,_e.gridSystem.title=`Dividing by ${e.name} \xB7 \u2318G for ${t.name}`,_e.gridSystem.setAttribute("aria-label",`Cell system: ${e.name}. Switch to ${t.name}`)}function AN(){let i=ay(U.map);if(i.length<2)return;let e=i.indexOf(Ss());kde(i[(e+1)%i.length].slug)}function kde(i){if(i===U.gridSystem)return;let e=Ss(),t=U.gridCell;U.gridSystem=i,U.gridCell=t?kH(e,Ss(),t,U.map):"",Ey(),_u(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()}function zde(i){return Gf[Ss().colorKey(i)]}function mE(i,{subgridVisible:e,labelled:t}){let{role:n,contextDistance:r}=i;if(n==="child"&&(!t||!e))return null;let s=zde(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 AE(){let i=Ss(),e=[],t=Vde(i,U.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(U.gridCell&&i.level(U.gridCell)>=i.maxLevel(U.map))return e.push(pE(i,U.gridCell,"leaf",0)),e;U.gridCell&&e.push(pE(i,U.gridCell,"scope",0));for(let n of i.children(U.gridCell))e.push(pE(i,n,"child",0));return e}function Vde(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 Gde(i){let e=Ss(),t=U.pins.filter(s=>!s.filteredHidden&&e.contains(i.hash,s.coordinate)).length,n=new Ep({geometry:qde(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"?U.sources.gridContext:U.sources.grid).addFeature(n)}function qde(i){let e=qf(),t=i.ring;if(i.pole){let o=i.pole==="north"?e[3]:e[1],a=t.slice(0,-1);t=[...a,[a[a.length-1][0],o],[a[0][0],o],a[0]]}if(t.every(([o])=>o>=e[0]&&o<=e[2]))return new mh([t]);let r=e[2]-e[0],s=[];for(let o of[0,-r,r]){let a=zH(t.map(([l,c])=>[l+o,c]),e[0],e[2]);a.length>=4&&s.push([a])}return new dE(s)}function gN(){return Ss().bbox(U.gridCell)}function Nj(){return Ss().maxLevel(U.map)}function Ip(i){return!U.gridEnabled||!U.gridCell?!1:Ss().contains(U.gridCell,i.coordinate)}var vE=[NaN,NaN,NaN,0],vN;function Hde(){return vN||(vN=Di(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),vN}var Wde=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,jde=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Xde=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,$de=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function gE(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function Cy(i){throw new Error('failed to parse "'+i+'" as color')}function Fj(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(jde)||i.match(Wde)||i.match(Xde);if(s){let o=s[4],a=100/255;return[Si(gE(s[1],a)+.5|0,0,255),Si(gE(s[2],a)+.5|0,0,255),Si(gE(s[3],a)+.5|0,0,255),o!==void 0?Si(gE(o,100),0,1):1]}Cy(i)}if(i.startsWith("#")){if($de.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}Cy(i)}let e=Hde();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&&Cy(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Fj(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]=$m(r[3]/255,3),r}function Bj(i){return typeof i=="string"?i:Iy(i)}var Yde=1024,My={},_N=0;function Oj(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function xN(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function yN(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function bN(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function wN(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function SN(i){let e=bN(i[0]),t=bN(i[1]),n=bN(i[2]),r=wN(e*.222488403+t*.716873169+n*.06060791),s=500*(wN(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-wN(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 Uj(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=yN(e),s=yN(e+t/500*Math.cos(n)),o=yN(e-t/200*Math.sin(n)),a=xN(s*3.021973625-r*1.617392459-o*.404875592),l=xN(s*-.943766287+r*1.916279586+o*.027607165),c=xN(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 Ry(i){if(i==="none")return vE;if(My.hasOwnProperty(i))return My[i];if(_N>=Yde){let t=0;for(let n in My)(t++&3)===0&&(delete My[n],--_N)}let e=Fj(i);e.length!==4&&Cy(i);for(let t of e)isNaN(t)&&Cy(i);return My[i]=e,++_N,e}function Rc(i){return Array.isArray(i)?i:Ry(i)}function Iy(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 EN=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=TN(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=TN(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=TN(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]=gy().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=gy().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function TN(i,e){let t=e?Rc(e):"null";return i+":"+t}var ea=new EN;var Py=null,_E=class extends Tp{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){Py||(Py=Di(1,1,void 0,{willReadFrequently:!0})),Py.drawImage(this.image_,0,0);try{Py.getImageData(0,0,1,1),this.tainted_=!1}catch{Py=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(rn.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&&kW(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=Bj(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(rn.CHANGE,t),e())};this.addEventListener(rn.CHANGE,t)}})),this.ready_}};function Pp(i,e,t,n,r,s){let o=e===void 0?void 0:ea.get(e,r);return o||(o=new _E(i,i&&"src"in i?i.src||void 0:e,t,n,r),ea.set(e,r,o,s)),s&&o&&!ea.getPattern(e,r)&&ea.set(e,r,o,s),o}var kj=_E;function pl(i){return i?Array.isArray(i)?Iy(i):typeof i=="object"&&"src"in i?Zde(i):i:null}function Zde(i){if(!i.offset||!i.size)return ea.getPattern(i.src,i.color);let e=i.src+":"+i.offset,t=ea.getPattern(e,i.color);if(t)return t;let n=ea.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]),Pp(r.canvas,e,void 0,In.LOADED,i.color,!0),ea.getPattern(e,i.color)}var Ly="ol-hidden";var Lp="ol-unselectable";var ev="ol-control",MN="ol-collapsed",Kde=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"),zj=["style","variant","weight","size","lineHeight","family"],xE={normal:400,bold:700},yE=function(i){let e=i.match(Kde);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=zj.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[zj[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in xE&&(t.weight=xE[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var bE="10px sans-serif",io="#000",Ah="round",ml=[],Al=0,gh="round",Jf=10,Gj=0,ta="#000",Dp="center",lA="middle",ed=[0,0,0,0],td=1,aA=new Us,Dy=null,Vj,CN={},Qde=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Jde(i,e,t){return`${i} ${e} 16px "${t}"`}var qj=(function(){let e,t;async function n(s){await t.ready;let o=yE(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let d=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),A=xE[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)?(hh(CN),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=yE(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(Qde.has(c))continue;let u=Jde(o.style,o.weight,c);aA.get(u)===void 0&&(aA.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),epe=(function(){let i;return function(e){let t=CN[e];if(t==null){if(no){let n=yE(e),r=Hj(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);CN[e]=t}return t}})();function Hj(i,e){return Dy||(Dy=Di(1,1)),i!=Vj&&(Dy.font=i,Vj=Dy.font),Dy.measureText(e)}function Wj(i,e){return Hj(i,e).width}function RN(i,e,t){if(e in t)return t[e];let n=e.split(`6-`).reduce((r,s)=>Math.max(r,Wj(i,s)),0);return t[e]=n,n}function jj(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=Wj(d,f);t.push(A),o+=A;let y=epe(d);n.push(y),l=Math.max(l,y)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function Xj(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]),tpe(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 tpe(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 IN=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=as(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_=as(e)}listenImageChange(e){ei()}load(){ei()}unlistenImageChange(e){ei()}ready(){return Promise.resolve()}},wE=IN;var PN=class i extends wE{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=ea.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 kj(r,void 0,null,In.LOADED,null);ea.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=Ah,t=gh,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=pl(this.stroke_.getColor()??ta),a=this.stroke_.getWidth()??td,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??gh,e=this.stroke_.getLineCap()??Ah,n=this.stroke_.getMiterLimit()??Jf);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=pl(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=Rc(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()}},SE=PN;var LN=class i extends SE{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}},TE=LN;var DN=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=Pp(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:Rc(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},cs=DN;function $j(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 NN=class i extends wE{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?Rc(e.color):null,this.iconImage_=Pp(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($j(A[0],A[1],e.width,e.height))};this.listenImageChange(d);return}}c!==void 0&&this.setScale($j(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?Rc(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_=Pp(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_=Pp(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(rn.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(rn.CHANGE,e)}ready(){return this.iconImage_.ready()}},cA=NN;var FN=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}},Io=FN;var EE=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=Yj,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_=Yj,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function Zj(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 BN=null;function ON(i,e){if(!BN){let t=new cs({color:"rgba(255,255,255,0.4)"}),n=new Io({color:"#3399CC",width:1.25});BN=[new EE({image:new TE({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return BN}function Yj(i){return i.getGeometry()}var ks=EE;var npe="#333",UN=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_=as(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 cs({color:npe}),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 cs?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_=as(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}},nd=UN;function Ic(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function Jj(i){let e=i.get("pin");return!e||Pc(e)||e.insideHighlightedZone||tv(e)?null:kN(e,!1)}function eX(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Pc(e)||tv(e)?null:kN(e,!1)}function tX(i){let e=i.get("pin");return!e||Pc(e)||!U.labelsHeld?null:oX(e)}function nX(i){let e=i.get("pin");if(!e||Pc(e)||e.insideHighlightedZone||tv(e)||By())return null;if(U.labelsHeld)return Ny(e,!1);let t=U.fitZoom+Math.log2(pX(e.category));return(U.engine.getView().getZoom()||0)<t?null:Ny(e,!1)}function iX(i){let e=i.get("pin");return!e||Pc(e)||e.insideHighlightedZone||tv(e)||!By()?null:Ny(e,!1)}function rX(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Pc(e)||tv(e)?null:Ny(e,!1)}function sX(i){let e=i.get("pin");if(!e||Pc(e))return null;if(sh(e.category)==="text")return Ny(e,e===U.selectedPin);let t=kN(e,e===U.selectedPin);return e===U.hoveredPin||e===U.selectedPin?[t,oX(e)]:t}function kN(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let n=sA(i.category),r=e?2e7:i.priority,s=U.markerIcons.get(Fy(i.category)),o;return s?o=new ks({image:new cA({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new ks({text:new nd({text:Au(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new cs({color:n}),stroke:new Io({color:rA(),width:e?4:3})}),zIndex:r}),U.styleCache.set(t,o),o}function oX(i){let e=`marker-label:${i.location.id}`;if(U.styleCache.has(e))return U.styleCache.get(e);let t=new ks({text:new nd({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new cs({color:"#f2ece0"}),stroke:new Io({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new cs({color:"rgba(10,12,17,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:i.priority});return U.styleCache.set(e,t),t}function aX(i){if(!i.iconAsset)return;let e=Fy(i);if(U.markerIcons.has(e))return;U.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=sA(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=rA(),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),U.markerIcons.set(e,n.toDataURL("image/png")),ipe(),U.layers.pins.changed(),U.layers.zonePins.changed(),U.layers.priority.changed()},t.onerror=()=>U.markerIcons.set(e,!1),t.src=QD(i.iconAsset)}function ipe(){for(let i of U.styleCache.keys())i.startsWith("marker:")&&U.styleCache.delete(i)}function Fy(i){return`${i.iconAsset||""}:${sA(i)}:${U.map?.iconOutset||"light"}`}function Ny(i,e){let t=`text:${i.location.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let r=[new ks({text:new nd({text:i.location.title,font:`${e?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new cs({color:e?"#7fd0ea":"#f2ece0"}),stroke:new Io({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new cs({color:e?"rgba(13,16,23,0.9)":"rgba(10,12,17,0.58)"}),backgroundStroke:e?new Io({color:"#3aa5c9",width:1}):void 0,padding:[3,6,3,6],overflow:!0}),zIndex:e?2e7:i.priority+3e6})];return U.styleCache.set(t,r),r}function ME(i,e){return`${i} ${e}px ${Vi.labelFont}`}function zN(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="neighbor",r=n?Vi.neighborLabelSizePx:Vi.labelSizePx,s=ME(900,r),o=n?[2,4,2,4]:[3,5,3,5],a=spe(t,s,r,o,e),l=mE(t,{subgridVisible:U.subgridVisible,labelled:a});if(!l)return null;let c=`grid:${U.gridSystem}:${t.hash}:${t.role}:${t.contextDistance}:${a?1:0}:${l.bare?1:0}`;if(U.styleCache.has(c))return U.styleCache.get(c);let u=t.role==="leaf"||t.role==="scope"?100:i.get("priority"),f=[new ks({fill:l.fill?new cs({color:Qf(l.fill.color,l.fill.opacity)}):void 0,stroke:new Io({color:Qf(l.line.color,l.line.opacity),width:l.line.widthPx}),zIndex:u})];if(l.label){let d=l.label.prefix?[l.label.prefix,ME(500,r),l.label.final,ME(900,r)]:l.label.final,A=Vi.labelInsetPx*e,y=rpe(i.getGeometry());y&&f.push(new ks({geometry:new mu([y[0]-A,y[1]+A]),text:new nd({text:d,font:ME(900,r),textAlign:"right",textBaseline:"bottom",fill:new cs({color:Qf(l.label.color,l.label.textAlpha)}),backgroundFill:new cs({color:l.label.chip}),padding:o,overflow:!0}),zIndex:u+1}))}return U.styleCache.set(c,f),f}function rpe(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 spe(i,e,t,n,r){if(!r)return!0;let s=VN(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 Kj=document.createElement("canvas").getContext("2d"),Qj=new Map;function VN(i,e){let t=`${e}|${i}`,n=Qj.get(t);return n===void 0&&(Kj.font=e,n=Kj.measureText(i).width,Qj.set(t,n)),n}var ope=new ks({fill:new cs({color:"rgba(5, 8, 16, 0.62)"})});function lX(){return U.zonesVisible?ope:null}function cX(i){if(!U.zonesVisible)return null;let e=i.get("zone"),t=i.get("child"),n=U.highlightedZones.has(e.id),r=dX(e.id),s=`zone:${e.id}:${t?1:0}:${n?1:r?2:0}`;if(U.styleCache.has(s))return U.styleCache.get(s);let o=i.get("color");if(r){let c=new ks({stroke:new Io({color:Qf(o,t?.34:.44),width:t?1:1.3,lineDash:t?[3,4]:[7,5]}),zIndex:t?101:100});return U.styleCache.set(s,c),c}let a=new ks({fill:new cs({color:Qf(o,t?.035:.07)}),stroke:new Io({color:Qf(o,t?.5:.72),width:t?1.2:1.8,lineDash:t?[3,4]:[7,5]})});if(!n)return U.styleCache.set(s,a),a;let l=[new ks({stroke:new Io({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new ks({fill:new cs({color:Qf(o,.22)}),stroke:new Io({color:o,width:2.6}),zIndex:9001})];return U.styleCache.set(s,l),l}function uX(i){if(!U.zonesVisible||By())return null;let e=i.get("child"),t=U.highlightedZones.has(i.get("zone").id),n=U.engine.getView().getZoom()||0;if(!t&&e&&n<U.fitZoom+3)return null;let r=i.get("span")/U.engine.getView().getResolution();return!t&&U.zoneTitleCount>40&&r<52?null:fX(i)}function hX(i){return!U.zonesVisible||!By()?null:fX(i)}function fX(i){let e=i.get("child"),t=i.get("zone"),n=U.highlightedZones.has(t.id),r=dX(t.id),s=`zone-title:${t.id}:${e?1:0}:${n?1:r?2:0}`;if(U.styleCache.has(s))return U.styleCache.get(s);let o=i.get("color"),a=new ks({text:new nd({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new cs({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new Io({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 cs({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new Io({color:n?"#ffffff":Qf(o,r?.24:.55),width:n?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:n?91e5:i.get("priority")});return U.styleCache.set(s,a),a}function dX(i){if(!U.highlightedZones.size||U.highlightedZones.has(i))return!1;for(let e of U.highlightedZones)if(ape(i,e))return!1;return!0}function ape(i,e){let t=new Set,n=U.zoneRecords.get(e)?.zone.parentRegionId;for(;n!=null&&!t.has(n);){if(n===i)return!0;t.add(n),n=U.zoneRecords.get(n)?.zone.parentRegionId}return!1}function GN(){let i=(U.map.zones||[]).filter(WN);U.renderedShard=U.variant?.shard||0,U.sources.zones.clear(),U.sources.zoneTitles.clear(),U.zoneRecords.clear(),U.highlightedZones.clear(),U.focusedZoneID=null,U.zoneTitleCount=0,CE(!0),_e.zoneIndex.hidden=i.length===0,_e.zoneCount.textContent=gu(i.length);for(let e of i){let t=Hr(),n=[],r=!1;for(let l of e.features||[]){let c=upe(l);c&&(r=!0,n.push(c),MT(t,c.getExtent()),U.sources.zones.addFeature(new Ep({geometry:c,zone:e,color:sE(e.id),child:e.parentRegionId!=null})))}if(!r)continue;let s=sE(e.id),o=e.center?nv(e.center.lat,e.center.lng):hl(t),a=Math.max(t[2]-t[0],t[3]-t[1]);U.sources.zoneTitles.addFeature(new Ep({geometry:new mu(o),zone:e,color:s,child:e.parentRegionId!=null,span:a,priority:(e.parentRegionId==null?2e6:1e6)+Math.round(a)})),U.zoneRecords.set(e.id,{zone:e,extent:t.slice(),geometries:n,color:s})}U.zoneTitleCount=U.sources.zoneTitles.getFeatures().length,AX(),lpe()}function AX(){if(U.sources.zoneScrim.clear(),!U.highlightedZones.size)return;let[i,e,t,n]=U.projection.getExtent(),r=[mX([[i,e],[t,e],[t,n],[i,n],[i,e]],!0)];for(let s of U.highlightedZones)for(let o of U.zoneRecords.get(s)?.geometries||[]){let a=o.getType()==="MultiPolygon"?o.getPolygons():[o];for(let l of a)l.getLinearRings().forEach((c,u)=>{r.push(mX(c.getCoordinates(),u>0))})}U.sources.zoneScrim.addFeature(new Ep({geometry:new mh(r)}))}function mX(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 lpe(){let i=document.createDocumentFragment();for(let{zone:e,depth:t}of cpe()){let n=U.zoneRecords.get(e.id);if(!n)continue;let r=document.createElement("button");r.type="button",r.className="zone-index-item",r.dataset.zone=String(e.id),r.style.setProperty("--zone-color",n.color),r.style.setProperty("--zone-depth",String(t)),r.setAttribute("aria-pressed","false"),r.title=`${e.title}: click to jump; right-click to toggle highlight`;let s=document.createElement("span");s.className="zone-index-marker",s.setAttribute("aria-hidden","true");let o=document.createElement("span");o.textContent=e.title,r.append(s,o),i.append(r)}_e.zoneList.replaceChildren(i),_e.zoneIndex.hidden=U.zoneRecords.size===0}function cpe(){let i=[...U.zoneRecords.values()].map(o=>o.zone),e=new Set(i.map(o=>o.id)),t=new Map;for(let o of i){let a=e.has(o.parentRegionId)?o.parentRegionId:null;t.has(a)||t.set(a,[]),t.get(a).push(o)}for(let o of t.values())o.sort((a,l)=>a.title.localeCompare(l.title,void 0,{numeric:!0,sensitivity:"base"}));let n=[],r=new Set,s=(o,a)=>{if(!r.has(o.id)){r.add(o.id),n.push({zone:o,depth:a});for(let l of t.get(o.id)||[])s(l,a+1)}};for(let o of t.get(null)||[])s(o,0);for(let o of i)s(o,0);return n}function CE(i){U.zonesVisible=i,_e.zoneToggle.checked=i,U.layers.zoneScrim.setVisible(i),U.layers.zones.setVisible(i),U.layers.zoneTitles.setVisible(i),U.layers.zoneTitleDetail.setVisible(i)}function gX(i){let e=U.zoneRecords.get(i);e&&(U.focusedZoneID=i,_X(),vu(),U.engine.getView().fit(e.extent,{size:U.engine.getSize(),padding:[54,54,54,54],maxZoom:dh(U.variant),duration:220}),_e.sidebar.classList.remove("is-open"),_e.mobileLegend.setAttribute("aria-expanded","false"))}function vX(i){U.zoneRecords.has(i)&&(U.highlightedZones.has(i)?U.highlightedZones.delete(i):(U.highlightedZones.add(i),CE(!0)),U.hoveredPin=null,qN(),HN(),_X(),AX(),U.layers.zones.changed(),U.layers.zoneTitles.changed(),U.layers.zoneTitleDetail.changed())}function _X(){_e.zoneIndex.classList.toggle("has-highlights",U.highlightedZones.size>0);for(let i of _e.zoneList.querySelectorAll("[data-zone]")){let e=Number(i.dataset.zone),t=U.highlightedZones.has(e);i.classList.toggle("is-highlighted",t),i.classList.toggle("is-current",U.focusedZoneID===e),i.setAttribute("aria-pressed",String(t))}}function upe(i){if(!i?.coordinates)return null;let e=([t,n])=>nv(n,t);return i.type==="Polygon"?new mh(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new dE(i.coordinates.map(t=>t.map(n=>n.map(e)))):null}function nv(i,e){let t=hpe(),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 hpe(){let i=U.game.tileGrid,e=U.map?.grid;return e?{...i,...e}:i}function xX(){U.sources.pins.clear(),U.sources.text.clear(),U.sources.priority.clear(),U.pins=[],U.pinByID.clear();for(let i of U.map.groups)for(let e of i.categories){sh(e)!=="text"&&aX(e);for(let t of e.locations){let n={location:t,category:e,group:i,coordinate:nv(t.lat,t.lng),filteredHidden:!1,priority:mpe(e,t),feature:null};n.feature=new Ep({geometry:new mu(n.coordinate),pin:n,priority:n.priority}),U.pins.push(n),U.pinByID.set(t.id,n),sh(e)==="text"?U.sources.text.addFeature(n.feature):U.sources.pins.addFeature(n.feature)}}Cc()}function Cc(){for(let i of U.pins){let e=U.hiddenCategories.has(i.category.id),t=U.search&&!i.location.title.toLocaleLowerCase().includes(U.search);i.filteredHidden=!!(e||t)}qN(),HN(),U.selectedPin?.filteredHidden&&vu(),Mp(),document.dispatchEvent(new Event("atlas:filters"))}function qN(){if(!U.highlightedZones.size){for(let e of U.pins)e.insideHighlightedZone=!1;return}let i=[...U.highlightedZones].map(e=>U.zoneRecords.get(e)).filter(Boolean);for(let e of U.pins)e.insideHighlightedZone=i.some(t=>t.geometries.some(n=>fpe(n,e.coordinate)))}function fpe(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}function HN(){U.eligibleLocations=U.pins.filter(i=>!Pc(i)).length,_u(),U.layers.pins.changed(),U.layers.zonePins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.zoneText.changed(),U.layers.textDetail.changed(),U.layers.priority.changed(),uA()}function _u(){U.sources.priority.clear();for(let i of U.pins){if(Pc(i))continue;let e=!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search);(i===U.selectedPin||i===U.hoveredPin||e||Ip(i))&&U.sources.priority.addFeature(i.feature)}}function iv(i){U.hoveredPin!==i&&(U.hoveredPin=i,U.sources&&(_u(),U.layers.pins.changed(),U.layers.priority.changed()))}function RE(i){U.labelsHeld!==i&&(U.labelsHeld=i,_e.labelsHint.textContent=i?"Z \xB7 labels shown":"Z \xB7 hold for labels",U.layers.pinLabels.changed(),U.layers.text.changed(),document.dispatchEvent(new Event("atlas:labels")))}function tv(i){return i===U.selectedPin||i===U.hoveredPin||Ip(i)||!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search)}function Pc(i){return i.filteredHidden||dpe(i)||ppe(i)||!WN(i.location)}function WN(i){let e=U.variant?.shard;return!e||!i.shard||i.shard===e}function dpe(i){return!U.highlightedZones.size||i.insideHighlightedZone||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function ppe(i){return!U.gridEnabled||!U.gridCell||Ip(i)||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function mpe(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+gj(e.id)%1e3}function pX(i){return i.locations.length>200?4:i.locations.length>75?2.5:1}function By(){return(U.engine?.getView().getZoom()||0)>=(U.variant?.maxZoom||0)-.05}function yX(i){let e=[],t=[];for(let n of i){let r=[];for(let s of n.categories)(sh(s)==="text"?t:r).push(s);r.length&&e.push({key:`group-${n.id}`,title:n.title,categories:r})}return t.length&&e.unshift({key:"text",title:"Text",categories:t}),e}function bX(){let i=document.createDocumentFragment();for(let e of U.map.sections){let t=document.createElement("section");t.className="layer-section",t.dataset.layerSection=e.key;let n=e.categories.reduce((s,o)=>s+o.locations.length,0);t.append(Ape(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.categories)r.append(gpe(s));t.append(r),i.append(t)}_e.legend.replaceChildren(i),IE(),Cp()}function Ape(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=gu(t),r.append(s,o,a);let l=wX(`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 wX(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 gpe(i){let e=sh(i)==="text",t=document.createElement("label");t.className="category-row",K1(t,i);let n=document.createElement("input");n.type="checkbox",n.dataset.category=String(i.id),n.checked=!U.hiddenCategories.has(i.id);let r=document.createElement("span");e?(r.className="text-symbol",r.textContent="Tt",r.title="Drawn as a text label"):(r.className="category-icon",Q1(r,i,Au(i.title)),r.title=i.icon||i.title);let s=document.createElement("span");s.className="category-name",s.textContent=i.title;let o=document.createElement("span");o.className="category-count",o.textContent=gu(i.locations.length);let a=wX(`Show only ${i.title}`);return a.dataset.onlyCategory=String(i.id),t.append(n,r,s,a,o),t}function jN(i){if(U.collapsedSections.clear(),i)for(let e of _e.layers.querySelectorAll("[data-section]"))U.collapsedSections.add(e.dataset.section);IE()}function IE(){for(let i of _e.layers.querySelectorAll("[data-section]")){let e=U.collapsedSections.has(i.dataset.section);i.setAttribute("aria-expanded",String(!e)),i.closest(".layer-section").classList.toggle("is-collapsed",e)}pu()}function Oy(i){if(U.hiddenCategories.clear(),!i)for(let e of U.map.groups)for(let t of e.categories)U.hiddenCategories.add(t.id);xy(),Cc(),Mp(),Cp()}function xy(){for(let i of document.querySelectorAll("[data-category]"))i.checked=!U.hiddenCategories.has(Number(i.dataset.category))}function SX(i){let e=U.map.sections.find(n=>n.key===i);if(!e)return;let t=e.categories.some(n=>!U.hiddenCategories.has(n.id));for(let n of e.categories)t?U.hiddenCategories.add(n.id):U.hiddenCategories.delete(n.id);xy(),Cc(),Cp()}function TX(i){if(U.map){if(vpe(i)){Oy(!0);return}U.hiddenCategories.clear();for(let e of U.map.sections){let t=i.section===e.key;for(let n of e.categories)!t&&i.category!==n.id&&U.hiddenCategories.add(n.id)}xy(),Cc(),Mp(),Cp()}}function vpe(i){for(let e of U.map.sections)for(let t of e.categories)if((i.section===e.key||i.category===t.id)===U.hiddenCategories.has(t.id))return!1;return!0}function _pe(){let i=_e.soloChip;if(!U.map){i.hidden=!0;return}let e=null,t=0,n=null,r=0;for(let o of U.map.sections){let a=0;for(let l of o.categories)U.hiddenCategories.has(l.id)||(a++,t++,e=l);a>0&&(r++,n=a===o.categories.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 Cp(){if(U.map){for(let i of U.map.sections){let e=_e.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.categories.some(t=>!U.hiddenCategories.has(t.id)))}_pe(),pu()}}async function EX(i){let[e,t]=await Promise.all([fetch(`${U.game.base}/maps/${i.slug}.json`),fetch(`${U.game.base}/maps/${i.slug}.bin`)]);if(!e.ok||!t.ok)throw new Error(`map ${i.slug} is not served under this catalog any more`);let[n,r]=await Promise.all([e.json(),t.arrayBuffer()]),s=n.groups.flatMap(o=>o.categories);return xpe(r,s),{...i,grid:n.grid,variants:n.variants,groups:n.groups,zones:n.zones||[],attrs:n.attrs||{},merged:n.merged||[],sections:yX(n.groups)}}function xpe(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!==2)throw new Error(`location payload is version ${r}, and this reads 2`);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.locations=[];for(let S=0;S<s;S++)e[A[S]].locations.push({id:a[S],title:w.decode(y.subarray(d[S],d[S+1])),lat:l[S],lng:c[S],regionId:u[S]||void 0,shard:f[S]||void 0})}async function xj(){let i=`${U.game.base}/${U.map.slug}`;return U.textByMap.has(i)||U.textByMap.set(i,fetch(`${U.game.base}/maps/${U.map.slug}.text`).then(e=>e.json()).catch(()=>({}))),U.textByMap.get(i)}var PE=null;function hA(){return PE||(PE=ype().finally(()=>{PE=null})),PE}async function ype(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=U.game;if(U.catalog=await i.json(),Um(_e.game,U.catalog.games,"title"),XN(),!U.catalog.games.length)return;let t=e&&U.catalog.games.find(n=>n.slug===e.slug);if(!t){let n=Z1();await id(n.game||Y1()?.game||U.catalog.games[0].slug,n.game?n.map:void 0);return}if(t.stamp!==e.stamp){for(let r of U.textByMap.keys())r.startsWith(e.base+"/")&&U.textByMap.delete(r);let n=U.engine?.getView();U.restore={game:t.slug,map:U.map?.slug,variant:U.map?U.map.variants.indexOf(U.variant):0,center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...U.hiddenCategories],collapsed:[...U.collapsedSections],overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed},await id(t.slug,U.map?.slug);return}U.game=t,_e.game.value=t.slug}function XN(){let i=!U.catalog?.games?.length;_e.emptyState.hidden=!i,U.catalog?.bundlesDir&&(_e.emptyPath.textContent=U.catalog.bundlesDir)}async function $N(){for(let i of[_e.emptyOpen,_e.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await hA();let t=e.imported?.[0];t&&U.catalog.games.some(n=>n.slug===t)&&await id(t)}finally{for(let i of[_e.emptyOpen,_e.addBundles])i.disabled=!1}}var go={ADD:"add",REMOVE:"remove"};var MX={LENGTH:"length"},rv=class extends mo{constructor(e,t,n){super(e),this.element=t,this.index=n}},YN=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(MX.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 rv(go.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 rv(go.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 rv(go.REMOVE,r,e)),this.dispatchEvent(new rv(go.ADD,t,e))}updateLength_(){this.set(MX.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")}},Po=YN;var ZN=class extends mo{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},Np=ZN;var KN=class extends Np{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()}},vh=KN;var Ar={SINGLECLICK:"singleclick",CLICK:rn.CLICK,DBLCLICK:rn.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var Uy={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var QN=class extends Tp{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,Uy.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=qn(n,Uy.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(rn.TOUCHMOVE,this.boundHandleTouchMove_,XT?{passive:!1}:!1)}emulateClick_(e){let t=new vh(Ar.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new vh(Ar.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new vh(Ar.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==Ar.POINTERUP||t.type==Ar.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==Ar.POINTERDOWN||t.type==Ar.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new vh(Ar.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 vh(Ar.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,Ar.POINTERMOVE,this.handlePointerMove_,this),qn(n,Ar.POINTERUP,this.handlePointerUp_,this),qn(this.element_,Ar.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(qn(this.element_.getRootNode(),Ar.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new vh(Ar.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 vh(Ar.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(rn.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(li(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(li),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},CX=QN;var _h={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var Lo={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var ky=1/0,JN=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,hh(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!=ky?(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==ky?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},RX=JN;var e5=class extends RX{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(rn.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(rn.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())}}},IX=e5;function PX(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return ky;if(!i.wantedTiles[t][e.getKey()])return ky;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 ro={ANIMATING:0,INTERACTING:1};var Lc={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function t5(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 LX(i){return i}function n5(i,e,t,n){let r=Zn(e)/t[0],s=Lr(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function i5(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 DX(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?n5(l,t,o,n):l;if(a)return e?i5(r,u,c):Si(r,c,u);let f=Math.min(u,r),d=Math.floor(G1(i,f,s));return i[d]>u&&d<i.length-1?i[d+1]:i[d]}})}function NX(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?n5(e,r,l,s):e;if(c)return n?i5(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 r5(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?n5(i,n,a,r):i;return!t||!l?Si(s,e,c):i5(s,c,e)}})}function sv(i){if(i!==void 0)return 0}function s5(i){if(i!==void 0)return i}function FX(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 BX(i){let e=i===void 0?au(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var o5=0,l5=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_=zT(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&&AW(),e.center&&(e.center=uu(e.center,this.projection_)),e.extent&&(e.extent=hu(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in Lc)delete t[a];this.setProperties(t,!0);let n=wpe(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=bpe(e),s=n.constraint,o=Spe(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=uu(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=uu(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&&LE(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||zW,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=uh(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+d,l=f.targetRotation}Tpe(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(ro.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[ro.ANIMATING]>0}getInteracting(){return this.hints_[ro.INTERACTING]>0}cancelAnimations(){this.setHint(ro.ANIMATING,-this.hints_[ro.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&LE(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?uh(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(ro.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&LE(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]],F1(n,e-this.getRotation()),YH(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&&py(e,this.getProjection())}getCenterInternal(){return this.get(Lc.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 yp(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"),uy(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(Lc.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(hu(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=Zn(e)/t[0],r=Lr(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(Lc.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=a5(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=G1(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(!ch(e),"Cannot fit empty extent provided as `geometry`");let r=hu(e,this.getProjection());n=dN(r)}else if(e.getType()==="Circle"){let r=hu(e.getExtent(),this.getProjection());n=dN(r),n.rotate(this.getRotation(),hl(r))}else{let r=Jm();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=hl(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:Kf;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),LE(S,!0))}centerOn(e,t,n){this.centerOnInternal(uu(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(a5(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=a5(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=py(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&&uu(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=uu(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&&uu(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(Lc.ROTATION)!==r&&this.set(Lc.ROTATION,r),this.get(Lc.RESOLUTION)!==o&&(this.set(Lc.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Lc.CENTER)||!Ym(this.get(Lc.CENTER),a))&&this.set(Lc.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()||!Ym(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:Mc,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(ro.INTERACTING,1)}endInteraction(e,t,n){n=n&&uu(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(ro.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 LE(i,e){setTimeout(function(){i(e)},0)}function bpe(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return t5(i.extent,i.constrainOnlyCenter,t)}let e=zT(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,t5(t,!1,!1)}return LX}function wpe(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:o5,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=zT(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=DX(S,u,!y&&w,f):e=r5(t,n,u,!y&&w,f)}else{let T=(A?Math.max(Zn(A),Lr(A)):360*Xf.degrees/d.getMetersPerUnit())/256/Math.pow(2,o5),R=T/Math.pow(2,28-o5);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=NX(l,t,n,u,!y&&w,f):e=r5(t,n,u,!y&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function Spe(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?BX():t===!1?s5:typeof t=="number"?FX(t):s5}return sv}function Tpe(i){return!(i.sourceCenter&&i.targetCenter&&!Ym(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function a5(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 Gl=l5;var c5=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!==Kf&&this.listenerKeys.push(qn(e,_h.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},ov=c5;var u5=class extends ov{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(rn.CLICK,this.handleClick_.bind(this),!1);let c=t+" "+Lp+" "+ev+(this.collapsed_&&this.collapsible_?" "+MN:"")+(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=>FW(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Jo(t,this.renderedAttributions_)){GW(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(MN),this.collapsed_?FD(this.collapseLabel_,this.label_):FD(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)}},OX=u5;var h5=class extends ov{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(rn.CLICK,this.handleClick_.bind(this),!1);let a=t+" "+Lp+" "+ev,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(Ly)}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:Mc}):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(Ly);!s&&n===0?this.element.classList.add(Ly):s&&n!==0&&this.element.classList.remove(Ly)}this.label_.style.transform=r}this.rotation_=n}},UX=h5;var f5=class extends ov{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(rn.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(rn.CLICK,this.handleClick_.bind(this,-n),!1);let d=t+" "+Lp+" "+ev,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:Mc})):n.setZoom(s)}}},kX=f5;function DE(i){i=i||{};let e=new Po;return(i.zoom===void 0||i.zoom)&&e.push(new kX(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new UX(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new OX(i.attributionOptions)),e}var d5=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_}},zX=d5;var p5={ACTIVE:"active"};var m5=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(p5.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(p5.ACTIVE,e)}setMap(e){this.map_=e}};function VX(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:VW,center:i.getConstrainedCenter(r)})}}function av(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:Mc})}var xh=m5;var A5=class extends xh{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==Ar.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();av(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},GX=A5;function zy(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 qX=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Epe=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)},NE=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?Epe(i):!0},HX=Yf;var FE=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(BW&&ID&&e.ctrlKey)};var BE=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var WX=function(i){let e=i.originalEvent;return ID?e.metaKey:e.ctrlKey},jX=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},OE=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},UE=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var XX=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var g5=class extends xh{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==Ar.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==Ar.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==Ar.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==Ar.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 lv(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 yh=g5;var v5=class extends yh{constructor(e){super({stopDown:Zf}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:zy(BE,XX);this.condition_=e.onFocusOnly?zy(NE,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(lv(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();ZH(s,a.getResolution()),F1(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:Mc})}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}},$X=v5;var _5=class extends yh{constructor(e){e=e||{},super({stopDown:Zf}),this.condition_=e.condition?e.condition:qX,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!UE(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===sv)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 UE(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return UE(e)&&FE(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},YX=_5;var x5=class extends Sp{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 mh([r])}getGeometry(){return this.geometry_}},ZX=x5;var cv={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},fA=class extends mo{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},y5=class extends yh{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new ZX(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??FE,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 fA(cv.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 fA(t?cv.BOXEND:cv.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 fA(cv.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new fA(cv.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new fA(cv.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},KX=y5;var b5=class extends KX{constructor(e){e=e||{};let t=e.condition?e.condition:jX;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:Mc})}},QX=b5;var Fp={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var w5=class extends xh{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return BE(t)&&OE(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==rn.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Fp.DOWN||r==Fp.LEFT||r==Fp.RIGHT||r==Fp.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==Fp.DOWN?c=-a:r==Fp.LEFT?l=-a:r==Fp.RIGHT?l=a:c=a;let u=[l,c];F1(u,o.getRotation()),VX(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},JX=w5;var S5=class extends xh{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!WX(t)&&OE(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==rn.KEYDOWN||e.type==rn.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();av(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},e$=S5;var Mpe=40,Cpe=300,Rpe=3,T5=class extends xh{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:HX;this.condition_=e.onFocusOnly?zy(NE,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!==rn.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*=Mpe;break;case WheelEvent.DOM_DELTA_PAGE:o*=Cpe;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*Rpe),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),av(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)}},t$=T5;var E5=class extends yh{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=Zf),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!==sv&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(lv(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$=E5;var M5=class extends yh{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=Zf),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(lv(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}},i$=M5;function kE(i){i=i||{};let e=new Po,t=new zX(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new YX),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new GX({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new $X({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new n$),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new i$({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new JX),e.push(new e$({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new t$({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new QX({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 C5=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()}},zE=C5;var Bp={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},xu=class extends mo{constructor(e,t){super(e),this.layer=t}},R5={LAYERS:"layers"},I5=class i extends zE{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(R5.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new Po(n.slice(),{unique:!0}):jn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new Po(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,go.ADD,this.handleLayersAdd_,this),qn(e,go.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(li);hh(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 xu(Bp.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[qn(e,du.PROPERTYCHANGE,this.handleLayerChange_,this),qn(e,rn.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(qn(e,Bp.ADDLAYER,this.handleLayerGroupAdd_,this),qn(e,Bp.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Bn(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new xu(Bp.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new xu(Bp.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new xu(Bp.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 xu(Bp.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(R5.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 xu(Bp.REMOVELAYER,n[r]))}this.set(R5.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=lh(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},Vy=I5;var Do={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var P5=class extends zE{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,rn.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 Gl?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 Gy(r,t.viewState)&&(!s||Dr(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof Gl?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,Do.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=qn(this,rn.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 Gy(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 dA=P5;function VE(i,e,t=0,n=i.length-1,r=Ipe){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));VE(i,e,A,y,r)}let s=i[e],o=t,a=n;for(qy(i,t,e),r(i[n],s)>0&&qy(i,t,n);o<a;){for(qy(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?qy(i,t,a):(a++,qy(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function qy(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function Ipe(i,e){return i<e?-1:i>e?1:0}var pA=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(!qE(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;qE(e,l)&&(t.leaf?n.push(a):D5(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!qE(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(qE(e,o)){if(t.leaf||D5(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=hv([]),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=Ppe(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&D5(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=hv(e.slice(t,n+1)),uv(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=hv([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));r$(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);r$(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 uv(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=L5(c),f=Npe(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),Wy(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=hv(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,uv(n,this.toBBox),uv(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=hv([e,t]),this.data.height=e.height+1,this.data.leaf=!1,uv(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=Hy(e,0,a,this.toBBox),c=Hy(e,a,n,this.toBBox),u=Fpe(l,c),f=L5(l)+L5(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:Lpe,s=e.leaf?this.compareMinY:Dpe,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=Hy(e,0,t,s),a=Hy(e,n-t,n,s),l=GE(o)+GE(a);for(let c=t;c<n-t;c++){let u=e.children[c];Wy(o,e.leaf?s(u):u),l+=GE(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];Wy(a,e.leaf?s(u):u),l+=GE(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)Wy(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():uv(e[t],this.toBBox)}};function Ppe(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 uv(i,e){Hy(i,0,i.children.length,e,i)}function Hy(i,e,t,n,r){r||(r=hv(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];Wy(r,i.leaf?n(o):o)}return r}function Wy(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 Lpe(i,e){return i.minX-e.minX}function Dpe(i,e){return i.minY-e.minY}function L5(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function GE(i){return i.maxX-i.minX+(i.maxY-i.minY)}function Npe(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 Fpe(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 D5(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function qE(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function hv(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function r$(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;VE(i,o,e,t,r),s.push(e,o,o,t)}}var AA=0,WE=0,na=1<<AA++,ci=1<<AA++,ia=1<<AA++,Ia=1<<AA++,sd=1<<AA++,mA=1<<AA++,jE=Math.pow(2,AA)-1,F5={[na]:"boolean",[ci]:"number",[ia]:"string",[Ia]:"color",[sd]:"number[]",[mA]:"size"},Bpe=Object.keys(F5).map(Number).sort(fl);function Ope(i){return i in F5}function rd(i){let e=[];for(let t of Bpe)jy(i,t)&&e.push(F5[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function jy(i,e){return(i&e)===e}function HE(i,e){return!!(i&e)}function Op(i,e){return i===e}var jr=class{constructor(e,t){if(!Ope(e))throw new Error(`literal expressions must have a specific type, got ${rd(e)}`);this.type=e,this.value=t}},XE=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function $E(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function us(i,e,t){switch(typeof i){case"boolean":{if(Op(e,ia))return new jr(ia,i?"true":"false");if(!jy(e,na))throw new Error(`got a boolean, but expected ${rd(e)}`);return new jr(na,i)}case"number":{if(Op(e,mA))return new jr(mA,as(i));if(Op(e,na))return new jr(na,!!i);if(Op(e,ia))return new jr(ia,i.toString());if(!jy(e,ci))throw new Error(`got a number, but expected ${rd(e)}`);return new jr(ci,i)}case"string":{if(Op(e,Ia))return new jr(Ia,Ry(i));if(Op(e,na))return new jr(na,!!i);if(!jy(e,ia))throw new Error(`got a string, but expected ${rd(e)}`);return new jr(ia,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 Ype(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Op(e,mA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new jr(mA,i)}if(Op(e,Ia)){if(i.length===3)return new jr(Ia,[...i,1]);if(i.length===4)return new jr(Ia,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!jy(e,sd))throw new Error(`got an array of numbers, but expected ${rd(e)}`);return new jr(sd,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"},Upe={[et.Get]:Un(ti(1,1/0),s$),[et.Var]:kpe(),[et.Has]:Un(ti(1,1/0),s$),[et.Id]:Un(zpe,fv),[et.Concat]:Un(ti(2,1/0),Qi(ia)),[et.GeometryType]:Un(Vpe,fv),[et.LineMetric]:Un(Gpe,fv),[et.Resolution]:Un(N5,fv),[et.Zoom]:Un(N5,fv),[et.Time]:Un(N5,fv),[et.Any]:Un(ti(2,1/0),Qi(na)),[et.All]:Un(ti(2,1/0),Qi(na)),[et.Not]:Un(ti(1,1),Qi(na)),[et.Equal]:Un(ti(2,2),a$()),[et.NotEqual]:Un(ti(2,2),a$()),[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),o$),[et.Coalesce]:Un(ti(2,1/0),o$),[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),l$,Hpe),[et.Between]:Un(ti(3,3),Qi(ci)),[et.Interpolate]:Un(ti(6,1/0),l$,Wpe),[et.Case]:Un(ti(3,1/0),qpe,jpe),[et.In]:Un(ti(2,2),Xpe),[et.Number]:Un(ti(1,1/0),Qi(jE)),[et.String]:Un(ti(1,1/0),Qi(jE)),[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),$pe),[et.ToString]:Un(ti(1,1),Qi(na|ci|ia|Ia))};function s$(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 jr(ci,o);break}case"string":{r[s]=new jr(ia,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 kpe(){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=us(s,jE,t);if(!(o instanceof jr))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&HE(r,Ia)&&!HE(r,ia)?a=Ia:Array.isArray(s)&&s.length===2&&HE(r,mA)&&!HE(r,sd)&&(a=mA),r&=a,r===WE)throw new Error(`the type expected from the var operator (${rd(e)}) did not have any overlap with the type of the corresponding style variables (${rd(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===WE)throw new Error(`a new type expected from the var operator (${rd(e)}) did not have any overlap with the previous type expected for it (${rd(o)}), variable name: ${n}`)}return t.variables.set(n,r),new XE(r,"var",new jr(ia,n))}}function zpe(i,e,t){t.featureId=!0}function Vpe(i,e,t){t.geometryType=!0}function Gpe(i,e,t){t.mCoordinate=!0}function N5(i,e,t){t.mapState=!0}function fv(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 o$(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=us(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=us(e[o+1],i,n);s[o]=a}return s}}function a$(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=jE;for(let a=0;a<r;++a){let l=us(i[a+1],o,t);o&=l.type}if(o===WE)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=us(i[a+1],o,t);s[a]=l}return s}}function qpe(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 l$(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 Hpe(i,e,t){let n=i.length-1,r=us(i[i.length-1],e,t),s=ia|ci|na,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=us(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===WE)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=us(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=us(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[us(i[1],s,t),...o,r]}function Wpe(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 jr(ci,r),o;try{o=us(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=us(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=us(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 jpe(i,e,t){let n=us(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=us(i[s+1],na,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=us(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 Xpe(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=ia:r=ci;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=us(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[us(i[1],r,t),...s]}function $pe(i,e,t){let n;try{n=us(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=us(r[o],Ia,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof jr))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 XE(t,r,...s)}}function Ype(i,e,t){let n=i[0],r=Upe[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function YE(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 YE(i.getGeometries()[0]);default:return""}}function B5(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function bu(i,e,t){let n=us(i,e,t);return yu(n,t)}function yu(i,e){if(i instanceof jr){if(i.type===Ia&&typeof i.value=="string"){let n=Ry(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 Zpe(i,e);case et.Get:case et.Var:case et.Has:return Kpe(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=>yu(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 Jpe(i,e);case et.Equal:case et.NotEqual:case et.LessThan:case et.LessThanOrEqualTo:case et.GreaterThan:case et.GreaterThanOrEqualTo:return Qpe(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 e0e(i,e);case et.Case:return t0e(i,e);case et.Match:return n0e(i,e);case et.Interpolate:return i0e(i,e);case et.ToString:return r0e(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function Zpe(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=yu(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 Kpe(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 Qpe(i,e){let t=i.operator,n=yu(i.args[0],e),r=yu(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 Jpe(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=yu(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 e0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=yu(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 t0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=yu(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 n0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=yu(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 i0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=yu(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=Oj(f)),u>=o)return c===2?f:d?s0e(s,o,a,l,u,f):Xy(s,o,a,l,u,f);a=u,l=f}return l}}function r0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=yu(i.args[s],e);if(t===et.ToString)return s=>{let o=r[0](s);return i.args[0].type===Ia?Iy(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function Xy(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 s0e(i,e,t,n,r,s){if(r-t===0)return n;let a=SN(n),l=SN(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[Xy(i,e,t,a[0],r,l[0]),Xy(i,e,t,a[1],r,l[1]),a[2]+Xy(i,e,t,0,r,c),Xy(i,e,t,n[3],r,s[3])];return Uj(u)}function o0e(i){return!0}function a0e(i,e){e=e??$E();let t=l0e(i,e),n=B5();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=YE(r.getGeometry())),t(n)}}function c$(i,e){e=e??$E();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=O5(i[o],e);let r=B5(),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=YE(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 d$(i,e){if(e=e??$E(),!Array.isArray(i))return c$([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 a0e(s,e)}return c$(i,e)}function l0e(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?bu(s.filter,na,e):o0e,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=O5(s.style[c],e)}else a=[O5(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 O5(i,e){let t=$y(i,"",e),n=Yy(i,"",e),r=c0e(i,e),s=u0e(i,e),o=No(i,"z-index",e);if(!t&&!n&&!r&&!s&&!lu(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new ks;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 $y(i,e,t){let n;if(e+"fill-pattern-src"in i)n=p0e(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=KE(i,e+"fill-color",t)}if(!n)return null;let r=new cs;return function(s){let o=n(s);return o===vE?null:(r.setColor(o),r)}}function Yy(i,e,t){let n=No(i,e+"stroke-width",t),r=KE(i,e+"stroke-color",t);if(!n&&!r)return null;let s=od(i,e+"stroke-line-cap",t),o=od(i,e+"stroke-line-join",t),a=p$(i,e+"stroke-line-dash",t),l=No(i,e+"stroke-line-dash-offset",t),c=No(i,e+"stroke-miter-limit",t),u=No(i,e+"stroke-offset",t),f=new Io;return function(d){if(r){let A=r(d);if(A===vE)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 c0e(i,e){let t="text-",n=od(i,t+"value",e);if(!n)return null;let r=$y(i,t,e),s=$y(i,t+"background-",e),o=Yy(i,t,e),a=Yy(i,t+"background-",e),l=od(i,t+"font",e),c=No(i,t+"max-angle",e),u=No(i,t+"offset-x",e),f=No(i,t+"offset-y",e),d=dv(i,t+"overflow",e),A=od(i,t+"placement",e),y=No(i,t+"repeat",e),w=QE(i,t+"scale",e),S=dv(i,t+"rotate-with-view",e),T=No(i,t+"rotation",e),R=od(i,t+"align",e),P=od(i,t+"justify",e),I=od(i,t+"baseline",e),F=dv(i,t+"keep-upright",e),D=p$(i,t+"padding",e),L=JE(i,t+"declutter-mode"),C=new nd({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 u0e(i,e){return"icon-src"in i?h0e(i,e):"shape-points"in i?f0e(i,e):"circle-radius"in i?d0e(i,e):null}function h0e(i,e){let t="icon-",n=t+"src",r=m$(i[n],n),s=ZE(i,t+"anchor",e),o=QE(i,t+"scale",e),a=No(i,t+"opacity",e),l=ZE(i,t+"displacement",e),c=No(i,t+"rotation",e),u=dv(i,t+"rotate-with-view",e),f=h$(i,t+"anchor-origin"),d=f$(i,t+"anchor-x-units"),A=f$(i,t+"anchor-y-units"),y=ad(i,t+"color"),w,S=null;y!==void 0&&(Array.isArray(y)&&y.length>0&&typeof y[0]=="string"?S=KE(i,t+"color",e):w=A$(y,t+"color"));let T=A0e(i,t+"cross-origin"),R=g0e(i,t+"offset"),P=h$(i,t+"offset-origin"),I=U5(i,t+"width"),F=U5(i,t+"height"),D=m0e(i,t+"size"),L=JE(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 cA(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 f0e(i,e){let t="shape-",n=t+"points",r=t+"radius",s=k5(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=No(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=No(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=$y(i,t,e),d=Yy(i,t,e),A=QE(i,t+"scale",e),y=ZE(i,t+"displacement",e),w=No(i,t+"rotation",e),S=dv(i,t+"rotate-with-view",e),T=U5(i,t+"angle"),R=JE(i,t+"declutter-mode"),P=new SE({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 d0e(i,e){let t="circle-",n=$y(i,t,e),r=Yy(i,t,e),s=No(i,t+"radius",e),o=QE(i,t+"scale",e),a=ZE(i,t+"displacement",e),l=No(i,t+"rotation",e),c=dv(i,t+"rotate-with-view",e),u=JE(i,t+"declutter-mode"),f=new TE({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 ad(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function No(i,e,t){let n=ad(i,e);if(n===void 0)return;let r=bu(n,ci,t);return function(s){return k5(r(s),e)}}function od(i,e,t){let n=ad(i,e);if(n===void 0)return null;let r=bu(n,ia,t);return function(s){return m$(r(s),e)}}function p0e(i,e,t){let n=od(i,e+"pattern-src",t),r=u$(i,e+"pattern-offset",t),s=u$(i,e+"pattern-size",t),o=KE(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function dv(i,e,t){let n=ad(i,e);if(n===void 0)return null;let r=bu(n,na,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function KE(i,e,t){let n=ad(i,e);if(n===void 0)return null;let r=bu(n,Ia,t);return function(s){return A$(r(s),e)}}function p$(i,e,t){let n=ad(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=bu(o,ci,t);return function(c){return k5(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=bu(n,sd,t);return function(s){return Zy(r(s),e)}}function ZE(i,e,t){let n=ad(i,e);if(n===void 0)return null;let r=bu(n,sd,t);return function(s){let o=Zy(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function u$(i,e,t){let n=ad(i,e);if(n===void 0)return null;let r=bu(n,sd,t);return function(s){return g$(r(s),e)}}function QE(i,e,t){let n=ad(i,e);if(n===void 0)return null;let r=bu(n,sd|ci,t);return function(s){return v0e(r(s),e)}}function U5(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 m0e(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return as(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 A0e(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 h$(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 f$(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 g0e(i,e){let t=i[e];if(t!==void 0)return Zy(t,e)}function JE(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 Zy(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 m$(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function k5(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function A$(i,e){if(typeof i=="string")return i;let t=Zy(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 g$(i,e){let t=Zy(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function v0e(i,e){return typeof i=="number"?i:g$(i,e)}var v$={RENDER_ORDER:"renderOrder"},z5=class extends dA{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(v$.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 pA(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(v$.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?ON:e;let t=_0e(e);this.styleFunction_=e===null?void 0:Zj(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function _0e(i){if(i===void 0)return ON;if(!i)return null;if(typeof i=="function"||i instanceof ks)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof ks){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof ks))throw new Error("Expected a list of style instances");n[r]=s}return n}return d$(i)}var e3=z5;var V5=class extends mo{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},t3=V5;var G5=class extends Sp{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){ei()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;Ro(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),KT(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=DT(e.slice(),d),y=[[0,0]];if(d.canWrapX()&&r){let I=d.getExtent(),F=Zn(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()&&Gy(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,Yf,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){ei()}scheduleExpireIconCache(e){ea.canExpireCache()&&e.postRenderFunctions.push(x0e)}};function x0e(i,e){ea.expire()}var _$=G5;var q5=class extends _${constructor(e){super(e),this.fontChangeListenerKey_=qn(aA,du.PROPERTYCHANGE,e.redrawText,e),this.element_=no?$T():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Lp+" 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 t3(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(Do.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof e3&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;Vl(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(!Gy(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),qW(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,d=u.style.backgroundColor;if(d&&(!Vl(f)||f.width>0)&&(a.fillStyle=d,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!Vl(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(...ZT(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(Do.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))}}},x$=q5;function y$(i){if(i instanceof dA){i.setMapInternal(null);return}i instanceof Vy&&i.getLayers().forEach(y$)}function b$(i,e){if(i instanceof dA){i.setMapInternal(e);return}if(i instanceof Vy){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)b$(t[n],e)}}var H5=class extends Us{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=y0e(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:OW,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Ao(),this.pixelToCoordinateTransform_=Ao(),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 Po:DE()),this.interactions=t.interactions||(no?new Po:kE({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new IX(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Lo.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Lo.VIEW,this.handleViewChanged_),this.addChangeListener(Lo.SIZE,this.handleSizeChanged_),this.addChangeListener(Lo.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof Gl)&&e.view.then(function(r){n.setView(new Gl(r))}),this.controls.addEventListener(go.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(go.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(go.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(go.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(go.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(go.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){b$(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:Yf,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 Vy?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:Yf,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(Lo.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return py(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?Wr(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(Lo.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof Po){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=uu(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?Wr(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(Lo.SIZE)}getView(){return this.get(Lo.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 PX(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new vh(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===Uy.POINTERDOWN||n===rn.WHEEL||n===rn.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[ro.ANIMATING]||o[ro.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(Do.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Do.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Np(_h.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Np(_h.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(rn.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(rn.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Vl(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(Vl(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new x$(this)),!Vl(t)){this.mapBrowserEventHandler_=new CX(this,this.moveTolerance_);for(let r in Ar)this.mapBrowserEventHandler_.addEventListener(Ar[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(rn.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(rn.WHEEL,this.boundHandleBrowserEvent_,XT?{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,rn.KEYDOWN,this.handleBrowserEvent,this),qn(n,rn.KEYPRESS,this.handleBrowserEvent,this)],!Vl(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,du.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=qn(e,rn.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 xu("addlayer",e)),this.layerGroupPropertyListenerKeys_=[qn(e,du.PROPERTYCHANGE,this.render,this),qn(e,rn.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){y$(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&&wD(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:uy(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=uy(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_||!ch(this.previousExtent_)&&!jm(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Np(_h.MOVESTART,this,r)),this.previousExtent_=Wm(this.previousExtent_)),this.previousExtent_&&!s.viewHints[ro.ANIMATING]&&!s.viewHints[ro.INTERACTING]&&!jm(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Np(_h.MOVEEND,this,s)),TT(s.extent,this.previousExtent_))),this.dispatchEvent(new Np(_h.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(_h.LOADSTART)||this.hasListener(_h.LOADEND)||this.hasListener(Do.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 xu("removelayer",t)),this.set(Lo.LAYERGROUP,e)}setSize(e){this.set(Lo.SIZE,e)}setTarget(e){this.set(Lo.TARGET,e)}setView(e){if(!e||e instanceof Gl){this.set(Lo.VIEW,e);return}this.set(Lo.VIEW,new Gl);let t=this;e.then(function(n){t.setView(new Gl(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(Vl(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)],!wD(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&IT("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!Jo(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function y0e(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 Vy({layers:i.layers});t[Lo.LAYERGROUP]=n,t[Lo.TARGET]=i.target,t[Lo.VIEW]=i.view instanceof Gl?i.view:new Gl;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new Po(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 Po(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 Po(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 Po,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var w$=H5;function n3(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var b0e=new Error("disposed");var w0e=[256,256],W5=class extends X1{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=n3(this.data_);return e?[e.width,e.height]:w0e}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(b0e),this.controller_=null),super.disposeInternal()}},j5=W5;var X5=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 Sp&&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}},$5=X5;var Y5=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(gy(),{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}},i3=Y5;var S0e=5,Z5=class extends JT{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=S0e,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(rn.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()}},S$=Z5;var Q5=[],pv=null;function T0e(){pv=Di(1,1,void 0,{willReadFrequently:!0})}var K5=class extends S${constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Ao(),this.pixelTransform=Ao(),this.inversePixelTransform=Ao(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){pv||T0e(),pv.clearRect(0,0,1,1);let r;try{pv.drawImage(e,t,n,1,1,0,0,1,1),r=pv.getImageData(0,0,1,1).data}catch{return pv=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(Vl(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&&Jo(Rc(e.style.backgroundColor),Rc(n)))){let c=e.firstElementChild;Vl(c)&&(l=c.getContext("2d"))}if(l&&ZW(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?$T():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=Tc(n),s=N1(n),o=D1(n),a=L1(n);Wr(t.coordinateToPixelTransform,r),Wr(t.coordinateToPixelTransform,s),Wr(t.coordinateToPixelTransform,o),Wr(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;Wr(l,r),Wr(l,s),Wr(l,o),Wr(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(Zn(n)/r*o),l=Math.round(Lr(n)/r*o);Ro(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),KT(this.inversePixelTransform,this.pixelTransform);let c=YW(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 t3(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(Do.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(Do.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new i3),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(Do.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(Do.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 Ro(this.tempTransform,l,c,u,f,-n,d,A)}disposeInternal(){delete this.frameState,super.disposeInternal()}},r3=K5;function J5(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 E0e(i,e,t){let n=i[t];return n?n.delete(e):!1}function T$(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=lh(e,hu(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=lh(e,r))}return e}var e6=class extends r3{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=Hr(),this.tempTileRange_=new GT(0,0,0,0),this.tempTileCoord_=q1(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new $5(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new $5(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=H1(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||z1(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=Wr(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!su(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=as(l.getTileSize(u)),w=l.getResolution(u),S;if(d instanceof YT||d instanceof QT)S=d.getImage();else if(d instanceof j5){if(S=n3(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?lD(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||!J5(r,F,S))continue;let L=F.getKey();if(f[L]=!0,F.getState()===an.IDLE&&!e.tileQueue.isKeyQueued(L)){let C=q1(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=H1(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)),J5(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=H1(l,c,n,u,f),A=!1;if(a.containsKey(d)){let y=a.peek(d);y.getState()===an.LOADED&&(J5(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?hu(n.extent,s):null,this.layerExtent&&(y=lh(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=T$(e,e.nextExtent);this.enqueueTiles(e,J,$,F,D)}let L=T$(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)){E0e(F,$,d),e.animate=!0;continue}if(this.findAltTiles_(f,te,d+1,F))continue;let ge=f.getMinZoom();for(let Re=d-1;Re>=ge&&!this.findAltTiles_(f,te,Re,F);--Re);}let k=A/o*l/w,z=this.getRenderContext(e);Ro(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(fl);let W=[],Y=[],H=[];for(let $=G.length-1;$>=0;--$){let J=G[$],te=u.getTilePixelSize(J,l,s),he=f.getResolution(J)/A,ge=te[0]*he*k,Re=te[1]*he*k,Qe=f.getTileCoordForCoordAndZ(Tc(I),J),Fe=f.getTileCoordExtent(Qe),mt=Wr(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)*ge),It=Qe[2]-Ye[2],dn=Math.round(mt[1]-(It-1)*Re),Gt=Math.round(mt[0]-Mt*ge),$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]&&Dr(yt,W[tn])&&hn.push(W[tn]);let en;hn.length>0&&(en=WH(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:ge,h:Re,gutter:Qe}=H[$];this.drawTile(te,e,ce,he,ge,Re,Qe,!0,void 0)}if(this.renderedResolution=A,this.extentChanged=!this.renderedExtent_||!jm(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],ge=he?Object.keys(he).length:0;this.updateCacheSize(ge),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 j5){if(u=n3(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}},E$=e6;var Ky={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var t6=class extends dA{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(Ky.PRELOAD)}setPreload(e){this.set(Ky.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(Ky.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(Ky.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},M$=t6;var n6=class extends M${constructor(e){super(e)}createRenderer(){return new E$(this,{cacheSize:this.getCacheSize()})}},i6=n6;var r6=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){}},s3=r6;var Qy={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},Jy=[Qy.FILL],bh=[Qy.STROKE],ld=[Qy.BEGIN_PATH],s6=[Qy.CLOSE_PATH],vn=Qy;var o6=class extends s3{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],su(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=ST(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,yy,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,d,e,r||n,yy,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,J1,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,f,e,r||n,J1,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,ph,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,ph,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([vn.CUSTOM,l,u,e,n,ph,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,ph,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,wW(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=pl(n||io)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=pl(n||ta);let r=e.getLineCap();t.lineCap=r!==void 0?r:Ah;let s=e.getLineDash();t.lineDash=s?s.slice():ml;let o=e.getLineDashOffset();t.lineDashOffset=o||Al;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:gh;let l=e.getWidth();t.lineWidth=l!==void 0?l:td;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:Jf;let u=e.getOffset();t.strokeOffset=u??Gj,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&&!Jo(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_=TT(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;I1(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},wh=o6;var a6=class extends wh{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&&!su(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||su(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}},C$=a6;var l6=class extends wh{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,ta,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,ml,Al],ld);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(bh),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,ta,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,ml,Al],ld);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(bh),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(bh),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(bh),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(ld)}},R$=l6;var c6=class extends wh{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(ld),this.hitDetectionInstructions.push(ld);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(s6),this.hitDetectionInstructions.push(s6)),t=f}return a&&(this.instructions.push(Jy),this.hitDetectionInstructions.push(Jy)),l&&(this.instructions.push(bh),this.hitDetectionInstructions.push(bh)),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,ta,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,ml,Al]);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(ld,f),this.hitDetectionInstructions.push(ld,f),r.fillStyle!==void 0&&(this.instructions.push(Jy),this.hitDetectionInstructions.push(Jy)),r.strokeStyle!==void 0&&(this.instructions.push(bh),this.hitDetectionInstructions.push(bh)),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,ta,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,ml,Al]);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,ta,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,ml,Al]);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]=Rp(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}},u6=c6;var h6=0,f6=1;function M0e(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 h6=u,f6=f,!0}function I$(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(M0e(r,s,o,a,T,R,F,D)){let L=F-T,C=D-R,B=T+h6*L,k=R+h6*C,z=T+f6*L,G=R+f6*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 P$(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=Qo(c,f,y),S=Qo(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=Qo(c,f,y/A),S=Qo(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 L$(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 e2={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},d6=class extends wh{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(!Dr(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")&&!ah(this.getBufferedMaxExtent(),d)){let T=I$(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=P$(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=L$(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!=ed&&(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==ed?ed: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]=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,P,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||Dp,justify:t.justify,textBaseline:t.textBaseline||lA,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=e2[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=pl(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()||Ah,s.lineDash=w?w.slice():ml,s.lineDashOffset=S===void 0?Al:S,s.lineJoin=a.getLineJoin()||gh,s.lineWidth=T===void 0?td:T,s.miterLimit=R===void 0?Jf:R,s.strokeStyle=pl(a.getColor()||ta)}n=this.textState_;let l=e.getFont()||bE;qj(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()||lA,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||ed,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}},D$=d6;var C0e={Circle:u6,Default:wh,Image:C$,LineString:R$,Polygon:u6,Text:D$},p6=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=C0e[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},N$=p6;function F$(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}function o3(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]=R0e(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 R0e(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=QH([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 a3(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 m6;function I0e(){return m6||(m6=new Intl.Segmenter(void 0,{granularity:"grapheme"})),m6}function B$(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=Qo(w,A,I),D=Qo(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=Qo(w,A,I),z=Qo(S,y,I),G=!1;if(d)if(f){let te=[F,D,k,z];rE(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(I0e().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 ge=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===ge)continue;let Qe=(G?J.slice(ce-te,ce-ge):J.slice(ge,te)).join("");I=T===0?0:(s+Re/2-R)/T;let Fe=Qo(w,A,I),mt=Qo(S,y,I);Y.push([Fe,mt,Re/2,he,Qe]),s+=Re}return Y}var mv=Hr(),Up=[],cd=[],ud=[],kp=[];function O$(i){return i[3].declutterBox}var U$=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function A6(i,e){return e==="start"?e=U$.test(i)?"right":"left":e==="end"&&(e=U$.test(i)?"left":"right"),e2[e]}function P0e(i,e,t){return t>0&&i.push(`8-`,""),i.push(e,""),i}function L0e(i,e,t){return t%2===0&&(i+=e),i}var g6=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_=Ao(),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 i3: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?e2[l.justify]:A6(Array.isArray(e)?e[0]:e,l.textAlign||Dp),d=r&&o.lineWidth?o.lineWidth:0,A=Array.isArray(e)?e:String(e).split(`9-`).reduce(P0e,[]),{width:y,height:w,widths:S,heights:T,lineWidths:R}=jj(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 ge=[ce,B+C*S[Y]+f*(S[Y]-R[H]),.5*(d+G)+W];B+=S[Y],r&&k.push("strokeText",ge),n&&z.push("fillText",ge),++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)&&(Up[0]=L,kp[0]=L,Up[1]=C,cd[1]=C,cd[0]=L+F,ud[0]=cd[0],ud[1]=C+D,kp[1]=ud[1]);let B;return f!==0?(B=Ro(Ao(),n,r,1,1,f,-n,-r),Wr(B,Up),Wr(B,cd),Wr(B,ud),Wr(B,kp),zl(Math.min(Up[0],cd[0],ud[0],kp[0]),Math.min(Up[1],cd[1],ud[1],kp[1]),Math.max(Up[0],cd[0],ud[0],kp[0]),Math.max(Up[1],cd[1],ud[1],kp[1]),mv)):zl(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:P,drawImageH:I,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,Up,cd,ud,kp,o,a),Xj(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=Wr(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=A6(Array.isArray(e)?e[0]:e,s.textAlign||Dp),u=e2[s.textBaseline||lA],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_&&Jo(n,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=dl(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),$W(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,ge,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&&!Dr(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],ve=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 ns=Fe[23];S=(Fn.anchorX-ns)*this.pixelRatio,Fe[4]=S;let Pr=Fe[24];T=(Fn.anchorY-Pr)*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=ed,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,ve,s,Z,!!Te||!!Pe,he),ns=[e,t,C,Fn,yt,Te,Pe];if(l){let Pr,Ll,ba;if(zn){let _r=y-A;if(!zn[_r]){zn[_r]={args:ns,declutterMode:P};continue}let Zs=zn[_r];Pr=Zs.args,Ll=Zs.declutterMode,delete zn[_r],ba=O$(Pr)}let Dl,nl;if(Pr&&(Ll!=="declutter"||!l.collides(ba))&&(Dl=!0),(P!=="declutter"||!l.collides(Fn.declutterBox))&&(nl=!0),Ll==="declutter"&&P==="declutter"){let _r=Dl&&nl;Dl=_r,nl=_r}Dl&&(Ll!=="none"&&l.insert(ba),this.replayImageOrLabel_.apply(this,Pr)),nl&&(P!=="none"&&l.insert(Fn.declutterBox),this.replayImageOrLabel_.apply(this,ns))}else this.replayImageOrLabel_.apply(this,ns)}++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],sn=Fe[7],Lt=Fe[8];z=Fe[9];let Rt=Fe[10];B=Fe[11],Array.isArray(B)&&(B=B.reduce(L0e,"")),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]*sn,ye.scale[1]*sn],St;wt in this.widths_?St=this.widths_[wt]:(St={},this.widths_[wt]=St);let Bt=F$(u,vt,Tt,2),ut=Math.abs(Ze[0])*RN(wt,B,St);if(Je||ut<=Bt){let Fn=this.textStates[k].textAlign,ns=(Bt-ut)*A6(B,Fn),Pr=B$(u,vt,Tt,2,B,ns,Pt,Math.abs(Ze[0]),RN,wt,St,J?0:this.viewRotation_,wn);e:if(Pr){let Ll=[],ba,Dl,nl,_r,Zs;if(z)for(ba=0,Dl=Pr.length;ba<Dl;++ba){Zs=Pr[ba],nl=Zs[4],_r=this.createLabel(nl,k,"",z),S=Zs[2]+(Ze[0]<0?-Rt:Rt)-Dn,T=qe*_r.height+(.5-qe)*2*Rt*Ze[1]/Ze[0]-Lt;let Nl=this.calculateImageOrLabelDimensions_(_r.width,_r.height,Zs[0],Zs[1],_r.width,_r.height,S,T,0,0,Zs[3],fn,!1,ed,!1,he);if(l&&P==="declutter"&&l.collides(Nl.declutterBox))break e;Ll.push([e,t,_r,Nl,1,null,null])}if(G)for(ba=0,Dl=Pr.length;ba<Dl;++ba){Zs=Pr[ba],nl=Zs[4],_r=this.createLabel(nl,k,G,""),S=Zs[2]-Dn,T=qe*_r.height-Lt;let Nl=this.calculateImageOrLabelDimensions_(_r.width,_r.height,Zs[0],Zs[1],_r.width,_r.height,S,T,0,0,Zs[3],fn,!1,ed,!1,he);if(l&&P==="declutter"&&l.collides(Nl.declutterBox))break e;Ll.push([e,t,_r,Nl,1,null,null])}l&&P!=="none"&&l.load(Ll.map(O$));for(let Nl=0,Ju=Ll.length;Nl<Ju;++Nl)this.replayImageOrLabel_.apply(this,Ll[Nl])}}++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 ns=(Fe[4]??!1)||Math.abs(u[A]-u[y-2])<1e-6&&Math.abs(u[A+1]-u[y-1])<1e-6;o3(u,A,y,2,R,ns,w),a3(w,2,ns),Ce=w,Yt=0,nr=Ce.length}else Ce=u,Yt=A,nr=y;ge=Ce[Yt],Re=Ce[Yt+1],e.moveTo(ge,Re),I=ge+.5|0,F=Re+.5|0;for(let Fn=Yt+2;Fn<nr;Fn+=2)ge=Ce[Fn],Re=Ce[Fn+1],D=ge+.5|0,L=Re+.5|0,(Fn==nr-2||D!==I||L!==F)&&(e.lineTo(ge,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)}},k$=g6;var zp=["Polygon","Circle","LineString","Image","Text","Default"],x6=["Image","Text"],z$=zp.filter(i=>!x6.includes(i)),V$=!1,G$=!1;function D0e(){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};V$={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],G$=!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_=Ao(),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 k$(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){G$===!1&&D0e(),r=Math.round(r);let a=r*2+1,l=Ro(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:V$}));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=Hr(),Xm(f,e),I1(f,t*(this.renderBuffer_+r),f));let d=N0e(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(fl);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=zp.length-1;T>=0;--T)if(A=zp[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 dl(a,0,8,2,e,a),a}isEmpty(){return lu(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?bW:fl),o=o||zp;let c=zp.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+zp.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(fl);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}},v6={};function N0e(i){if(v6[i]!==void 0)return v6[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 v6[i]=r,r}var q$=_6;var y6=class extends s3{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?$m(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_=Ao()}drawImages_(e,t,n,r){if(!this.image_)return;let s=dl(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_;Ro(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=dl(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=dl(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=o3(l,0,u,2,o,f,l),a3(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_)),!!Dr(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=pj(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_)),!!Dr(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(Dr(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_)),!!Dr(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_)),!!Dr(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),Jo(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:Dp;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:pl(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||ml,f=t.getOffset();this.strokeState_={lineCap:r!==void 0?r:Ah,lineDash:this.pixelRatio_===1?u:u.map(d=>d*this.pixelRatio_),lineDashOffset:(o||Al)*this.pixelRatio_,lineJoin:a!==void 0?a:gh,lineWidth:(l!==void 0?l:td)*this.pixelRatio_,miterLimit:c!==void 0?c:Jf,strokeStyle:pl(n||ta),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:pl(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(),P=n.getMiterLimit();this.textStrokeState_={lineCap:y!==void 0?y:Ah,lineDash:w||ml,lineDashOffset:S||Al,lineJoin:T!==void 0?T:gh,lineWidth:R!==void 0?R:td,miterLimit:P!==void 0?P:Jf,strokeStyle:pl(A||ta)}}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:bE,textAlign:f!==void 0?f:Dp,textBaseline:d!==void 0?d:lA},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]]}}},H$=y6;var wu=.5;function W$(i,e,t,n,r,s,o,a,l){let c=l?yp(r,l):r,u=i[0]*wu,f=i[1]*wu,d=Di(u,f);d.imageSmoothingEnabled=!1;let A=d.canvas,y=new H$(d,wu,r,null,o,a,l?Km(Jm(),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||!Dr(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 ge=Di(he[0],he[1],void 0,{alpha:!1}),Re=ge.canvas;ge.fillStyle=C,ge.fillRect(0,0,Re.width,Re.height),W.setImage(new cA({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 ge=0,Re=he.length;ge<Re;++ge){let Qe=he[ge];te[Qe.getType().replace("Multi","")].push(Qe,W)}}else te[ce.replace("Multi","")].push(G,W)}}let R=Object.keys(T).map(Number).sort(fl);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 j$(i,e,t){let n=[];if(t){let r=Math.floor(Math.round(i[0])*wu),s=Math.floor(Math.round(i[1])*wu),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 F0e=.5,X$={Point:G0e,LineString:k0e,Polygon:H0e,MultiPoint:q0e,MultiLineString:z0e,MultiPolygon:V0e,GeometryCollection:U0e,Circle:B0e};function $$(i,e){return parseInt(Bn(i),10)-parseInt(Bn(e),10)}function b6(i,e){let t=w6(i,e);return t*t}function w6(i,e){return F0e*i/e}function B0e(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 S6(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)),O0e(i,e,t,n,s,o,a),f}function O0e(i,e,t,n,r,s,o){let a=t.getGeometryFunction()(e);if(!a)return;let l=a.simplifyTransformed(n,r);if(t.getRenderer())Y$(i,l,t,e,o);else{let u=X$[l.getType()];u(i,l,t,e,o,s)}}function Y$(i,e,t,n,r){if(e.getType()=="GeometryCollection"){let o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)Y$(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function U0e(i,e,t,n,r,s){let o=e.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=X$[o[a].getType()];c(i,o[a],t,n,r,s)}}function k0e(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 z0e(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 V0e(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 G0e(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 q0e(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 H0e(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 T6=class extends r3{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_=Hr(),this.wrappedRenderedExtent_=Hr(),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[ro.ANIMATING]||y[ro.INTERACTING]),S=this.context,T=Math.round(Zn(r)/a*A),R=Math.round(Lr(r)/a*A),P=f.getWrapX()&&l.canWrapX(),I=P?Zn(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?zp:n?x6:z$,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,Q5))}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,nA(this.context),Q5.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(Do.PRERENDER)||this.getLayer().hasListener(Do.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=hu(n.extent,l);a=Dr(u,e.extent),a&&!ah(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]*wu,d=n[1]*wu;u.push(this.getRenderTransform(r,s,o,wu,f,d,0).slice());let A=c.getSource(),y=a.getExtent();if(A.getWrapX()&&a.canWrapX()&&!ah(y,l)){let S=l[0],T=Zn(y),R=0,P;for(;S<y[0];)--R,P=T*R,u.push(this.getRenderTransform(r,s,o,wu,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,wu,f,d,P).slice()),S-=T}let w=Jm();this.hitDetectionImageData_=W$(n,u,this.renderedFeatures_,c.getStyleFunction(),l,s,o,b6(s,this.renderedPixelRatio_),w?a:null)}t(j$(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[ro.ANIMATING],s=e.viewHints[ro.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=$$);let S=c.center.slice(),T=I1(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();$&&!ch($)&&(this.extendX_=$[0]<I[0]||$[2]>I[2])}if(F&&(!ah(I,e.extent)||this.extendX_)){let $=Zn(I),J=Math.max(Zn(T)/2,$),te=I[0],ce=I[2];this.extendX_&&(te-=$,ce+=$),T[0]=te-J,T[2]=ce+J,DT(S,u);let he=uD(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&&ah(this.wrappedRenderedExtent_,T))return Jo(this.renderedExtent_,R)||(this.hitDetectionImageData_=null,this.renderedExtent_=R),this.renderedCenter_=S,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let D=new N$(w6(f,d),T,f,d),L=Jm(),C;if(L){for(let $=0,J=P.length;$<J;++$){let te=P[$],ce=yp(te,u);n.loadFeatures(ce,_W(f,u),L)}C=Km(L,u)}else for(let $=0,J=P.length;$<J;++$)n.loadFeatures(P[$],f,u);let B=b6(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=yp(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 q$(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=S6(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=S6(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}},Z$=T6;var E6=class extends e3{constructor(e){super(e)}createRenderer(){return new Z$(this)}},K$=E6;var W0e=!1;function j0e(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=W0e,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 M6(i,e){return function(t,n,r,s,o){j0e(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function Q$(i,e){return[[-1/0,-1/0,1/0,1/0]]}function C6(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=yW(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]:Qo(i[a+u],i[a+n+u],l);return s}var J$=Ao(),t2=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"?ET(this.flatCoordinates_):P1(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=hl(this.getExtent());this.flatInteriorPoints_=Sy(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=Ij(this.flatCoordinates_,this.ends_),t=fE(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_=C6(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=C6(e,t,o,this.stride_,.5);fu(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=Lr(n)/Lr(t);Ro(J$,n[0],n[3],r,-r,0,0,0),dl(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,J$,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=jT((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=by(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=Ej(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=wy(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}};t2.prototype.getFlatCoordinates=t2.prototype.getOrientedFlatCoordinates;var gA=t2;var R6=class{constructor(e){this.rbush_=new pA(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];jm(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 lu(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return zl(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]}},I6=R6;var ql={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Sh=class extends mo{constructor(e,t,n){super(e),this.feature=t,this.features=n}},P6=class extends tE{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_=Kf,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_=M6(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:Q$;let t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new I6:null,this.loadedExtentsRtree_=new I6,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 Po(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 Sh(ql.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof gA||(this.featureChangeKeys_[e]=[qn(t,rn.CHANGE,this.handleFeatureChange_,this),qn(t,du.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 gA){let s=this.idIndex_[r];s instanceof gA?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(ql.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new Sh(ql.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(ql.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener(ql.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(go.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(go.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 Sh(ql.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 gA||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 gA||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(),lu(this.nullGeometryFeatures_)||fu(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=RT(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||Yf,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){let u=c.getGeometry(),f=a;if(a=u instanceof gA?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 Sh(ql.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()&&lu(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 ah(u.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Sh(ql.FEATURESLOADSTART));let u=y=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Sh(ql.FEATURESLOADEND,void 0,y))},f=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Sh(ql.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=cD(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(ql.REMOVEFEATURE)&&this.dispatchEvent(new Sh(ql.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(M6(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},hd=P6;var Va={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},a0={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},dM=0,$2=1,pM=2;var _8=0,l0=1,mM=2,Fc=3,Bo=0,mi=1,gr=2,ds=0,Ts=1,Lh=2,Dh=3,Nh=4,Cd=5,Y2=6,so=100,Z2=101,K2=102,AM=103,gM=104,Iu=200,Q2=201,J2=202,eb=203,$p=204,Yp=205,tb=206,nb=207,ib=208,rb=209,sb=210,GY=211,qY=212,HY=213,WY=214,bA=0,wA=1,SA=2,Mh=3,TA=4,EA=5,MA=6,CA=7,WA=0,vM=1,_M=2,oo=0,ob=1,ab=2,lb=3,cb=4,x8=5,ub=6,hb=7;var fb=300,Yl=301,Bc=302,c0=303,u0=304,Fh=306,yd=1e3,oa=1001,bd=1002,Ti=1003,db=1004;var Oc=1005;var Mi=1006,h0=1007;var Uo=1008,y8=1008,Ji=1009,Bh=1010,Oh=1011,xl=1012,Yr=1013,xi=1014,cr=1015,Wi=1016,jA=1017,XA=1018,la=1020,$A=35902,YA=35899,Qv=1021,Rd=1022,Br=1023,Vs=1026,_o=1027,Id=1028,Uh=1029,Ws=1030,kh=1031,pb=1032,f0=1033,zh=33776,Vh=33777,Gh=33778,qh=33779,ZA=35840,KA=35841,QA=35842,JA=35843,d0=36196,p0=37492,m0=37496,A0=37488,g0=37489,Hh=37490,v0=37491,_0=37808,x0=37809,y0=37810,b0=37811,w0=37812,S0=37813,T0=37814,E0=37815,M0=37816,C0=37817,R0=37818,I0=37819,P0=37820,L0=37821,D0=36492,N0=36494,F0=36495,B0=36283,O0=36284,Wh=36285,U0=36286;var m2=2300,V3=2301,k3=2302,o8=2303,a8=2400,l8=2401,c8=2402;var b8=0,w8=1,xM=2,jY=3200;var Zl=0,yM=1,ca="",Nr="srgb",Zp="srgb-linear",Kp="linear",kt="srgb",mb="",bM="rg",S8="ga",T8=0,gd=7680,E8=7681,M8=7682,C8=7683,R8=34055,I8=34056,P8=5386,L8=512,D8=513,N8=514,F8=515,B8=516,O8=517,U8=518,A2=519,Ab=512,Jv=513,gb=514,jh=515,eg=516,vb=517,Pu=518,_b=519,Qp=35044,tg=35048;var k8="300 es",Fo=2e3,gl=2001,Uc={COMPUTE:"compute",RENDER:"render"};var Pd={TEXTURE_COMPARE:"depthTextureCompare"};function X0e(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function e_(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function Bv(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function wM(){let i=Bv("canvas");return i.style.display="block",i}var eY={},Ov=null;function RA(...i){let e="THREE."+i.shift();Ov?Ov("log",e,...i):console.log(e,...i)}function XY(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=XY(i);let e="THREE."+i.shift();if(Ov)Ov("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function ze(...i){i=XY(i);let e="THREE."+i.shift();if(Ov)Ov("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 eY||(eY[e]=!0,Xe(...i))}function z8(){return typeof self<"u"&&typeof self.scheduler<"u"&&typeof self.scheduler.yield<"u"?self.scheduler.yield():new Promise(i=>{requestAnimationFrame(i)})}function $Y(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 xb={[bA]:wA,[SA]:MA,[TA]:CA,[Mh]:EA,[wA]:bA,[MA]:SA,[CA]:TA,[EA]:Mh},aa=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}}},ra=["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"],tY=1234567,h2=Math.PI/180,wd=180/Math.PI;function Eh(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(ra[i&255]+ra[i>>8&255]+ra[i>>16&255]+ra[i>>24&255]+"-"+ra[e&255]+ra[e>>8&255]+"-"+ra[e>>16&15|64]+ra[e>>24&255]+"-"+ra[t&63|128]+ra[t>>8&255]+"-"+ra[t>>16&255]+ra[t>>24&255]+ra[n&255]+ra[n>>8&255]+ra[n>>16&255]+ra[n>>24&255]).toLowerCase()}function Nn(i,e,t){return Math.max(e,Math.min(t,i))}function V8(i,e){return(i%e+e)%e}function $0e(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function Y0e(i,e,t){return i!==e?(t-i)/(e-i):0}function f2(i,e,t){return(1-t)*i+t*e}function Z0e(i,e,t,n){return f2(i,e,1-Math.exp(-t*n))}function K0e(i,e=1){return e-Math.abs(V8(i,e*2)-e)}function Q0e(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function J0e(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function eme(i,e){return i+Math.floor(Math.random()*(e-i+1))}function tme(i,e){return i+Math.random()*(e-i)}function nme(i){return i*(.5-Math.random())}function ime(i){i!==void 0&&(tY=i);let e=tY+=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 rme(i){return i*h2}function sme(i){return i*wd}function ome(i){return(i&i-1)===0&&i!==0}function ame(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function lme(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function cme(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 Da(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 Yn(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 Lu={DEG2RAD:h2,RAD2DEG:wd,generateUUID:Eh,clamp:Nn,euclideanModulo:V8,mapLinear:$0e,inverseLerp:Y0e,lerp:f2,damp:Z0e,pingpong:K0e,smoothstep:Q0e,smootherstep:J0e,randInt:eme,randFloat:tme,randFloatSpread:nme,seededRandom:ime,degToRad:rme,radToDeg:sme,isPowerOfTwo:ome,ceilPowerOfTwo:ame,floorPowerOfTwo:lme,setQuaternionFromProperEuler:cme,normalize:Yn,denormalize:Da},j8=class j8{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}};j8.prototype.isVector2=!0;var Oe=j8,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),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}},X8=class X8{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(nY.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(nY.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 L6.copy(this).projectOnVector(e),this.sub(L6)}reflect(e){return this.sub(L6.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}};X8.prototype.isVector3=!0;var re=X8,L6=new re,nY=new Gs,$8=class $8{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(D6.makeScale(e,t)),this}rotate(e){return ni("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(D6.makeRotation(-e)),this}translate(e,t){return ni("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(D6.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)}};$8.prototype.isMatrix3=!0;var Mn=$8,D6=new Mn,iY=new Mn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),rY=new Mn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function ume(){let i={enabled:!0,workingColorSpace:Zp,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===kt&&(r.r=xd(r.r),r.g=xd(r.g),r.b=xd(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=Fv(r.r),r.g=Fv(r.g),r.b=Fv(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===ca?Kp: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({[Zp]:{primaries:e,whitePoint:n,transfer:Kp,toXYZ:iY,fromXYZ:rY,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Nr},outputColorSpaceConfig:{drawingBufferColorSpace:Nr}},[Nr]:{primaries:e,whitePoint:n,transfer:kt,toXYZ:iY,fromXYZ:rY,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Nr}}}),i}var ln=ume();function xd(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Fv(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Av,G3=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{Av===void 0&&(Av=Bv("canvas")),Av.width=e.width,Av.height=e.height;let r=Av.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Av}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=Bv("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]=xd(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(xd(t[n]/255)*255):t[n]=xd(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}},hme=0,Uv=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:hme++}),this.uuid=Eh(),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(N6(r[o].image)):s.push(N6(r[o]))}else s=N6(r);n.url=s}return t||(e.images[this.uuid]=n),n}};function N6(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?G3.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 fme=0,F6=new re,qs=class i extends aa{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=oa,r=oa,s=Mi,o=Uo,a=Br,l=Ji,c=i.DEFAULT_ANISOTROPY,u=ca){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:fme++}),this.uuid=Eh(),this.name="",this.source=new Uv(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(F6).x}get height(){return this.source.getSize(F6).y}get depth(){return this.source.getSize(F6).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!==fb)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case yd:e.x=e.x-Math.floor(e.x);break;case oa:e.x=e.x<0?0:1;break;case bd: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 yd:e.y=e.y-Math.floor(e.y);break;case oa:e.y=e.y<0?0:1;break;case bd: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=fb;qs.DEFAULT_ANISOTROPY=1;var Y8=class Y8{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}};Y8.prototype.isVector4=!0;var xn=Y8,Na=class extends aa{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 Uv(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"})}},Fa=class extends Na{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},IA=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=oa,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var q3=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=oa,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var fM=class fM{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 fM().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/gv.setFromMatrixColumn(e,0).length(),s=1/gv.setFromMatrixColumn(e,1).length(),o=1/gv.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(dme,e,pme)}lookAt(e,t,n){let r=this.elements;return Hl.subVectors(e,t),Hl.lengthSq()===0&&(Hl.z=1),Hl.normalize(),Vp.crossVectors(n,Hl),Vp.lengthSq()===0&&(Math.abs(n.z)===1?Hl.x+=1e-4:Hl.z+=1e-4,Hl.normalize(),Vp.crossVectors(n,Hl)),Vp.normalize(),l3.crossVectors(Hl,Vp),r[0]=Vp.x,r[4]=l3.x,r[8]=Hl.x,r[1]=Vp.y,r[5]=l3.y,r[9]=Hl.y,r[2]=Vp.z,r[6]=l3.z,r[10]=Hl.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],ge=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*ge,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*ge,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*ge,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*ge,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=gv.set(r[0],r[1],r[2]).length(),a=gv.set(r[4],r[5],r[6]).length(),l=gv.set(r[8],r[9],r[10]).length();s<0&&(o=-o),Su.copy(this);let c=1/o,u=1/a,f=1/l;return Su.elements[0]*=c,Su.elements[1]*=c,Su.elements[2]*=c,Su.elements[4]*=u,Su.elements[5]*=u,Su.elements[6]*=u,Su.elements[8]*=f,Su.elements[9]*=f,Su.elements[10]*=f,t.setFromRotationMatrix(Su),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=Fo,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===Fo)y=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(a===gl)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=Fo,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===Fo)y=-2/(o-s),w=-(o+s)/(o-s);else if(a===gl)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}};fM.prototype.isMatrix4=!0;var cn=fM,gv=new re,Su=new cn,dme=new re(0,0,0),pme=new re(1,1,1),Vp=new re,l3=new re,Hl=new re,sY=new cn,oY=new Gs,Ba=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 sY.makeRotationFromQuaternion(e),this.setFromRotationMatrix(sY,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}};Ba.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}},mme=0,aY=new re,vv=new Gs,fd=new cn,c3=new re,n2=new re,Ame=new re,gme=new Gs,lY=new re(1,0,0),cY=new re(0,1,0),uY=new re(0,0,1),hY={type:"added"},vme={type:"removed"},_v={type:"childadded",child:null},B6={type:"childremoved",child:null},lr=class i extends aa{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:mme++}),this.uuid=Eh(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new re,t=new Ba,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 vv.setFromAxisAngle(e,t),this.quaternion.multiply(vv),this}rotateOnWorldAxis(e,t){return vv.setFromAxisAngle(e,t),this.quaternion.premultiply(vv),this}rotateX(e){return this.rotateOnAxis(lY,e)}rotateY(e){return this.rotateOnAxis(cY,e)}rotateZ(e){return this.rotateOnAxis(uY,e)}translateOnAxis(e,t){return aY.copy(e).applyQuaternion(this.quaternion),this.position.add(aY.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(lY,e)}translateY(e){return this.translateOnAxis(cY,e)}translateZ(e){return this.translateOnAxis(uY,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(fd.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?c3.copy(e):c3.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),n2.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?fd.lookAt(n2,c3,this.up):fd.lookAt(c3,n2,this.up),this.quaternion.setFromRotationMatrix(fd),r&&(fd.extractRotation(r.matrixWorld),vv.setFromRotationMatrix(fd),this.quaternion.premultiply(vv.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(hY),_v.child=e,this.dispatchEvent(_v),_v.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(vme),B6.child=e,this.dispatchEvent(B6),B6.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),fd.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),fd.multiply(e.parent.matrixWorld)),e.applyMatrix4(fd),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(hY),_v.child=e,this.dispatchEvent(_v),_v.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(n2,e,Ame),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(n2,gme,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 Fr=class extends lr{constructor(){super(),this.isGroup=!0,this.type="Group"}},_me={type:"move"},Jp=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Fr,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 Fr,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 Fr,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(_me)))}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 Fr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},YY={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},Gp={h:0,s:0,l:0},u3={h:0,s:0,l:0};function O6(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=Nr){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=V8(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=O6(o,s,e+1/3),this.g=O6(o,s,e),this.b=O6(o,s,e-1/3)}return ln.colorSpaceToWorking(this,r),this}setStyle(e,t=Nr){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=Nr){let n=YY[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=xd(e.r),this.g=xd(e.g),this.b=xd(e.b),this}copyLinearToSRGB(e){return this.r=Fv(e.r),this.g=Fv(e.g),this.b=Fv(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Nr){return ln.workingToColorSpace(sa.copy(this),e),Math.round(Nn(sa.r*255,0,255))*65536+Math.round(Nn(sa.g*255,0,255))*256+Math.round(Nn(sa.b*255,0,255))}getHexString(e=Nr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ln.workingColorSpace){ln.workingToColorSpace(sa.copy(this),t);let n=sa.r,r=sa.g,s=sa.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(sa.copy(this),t),e.r=sa.r,e.g=sa.g,e.b=sa.b,e}getStyle(e=Nr){ln.workingToColorSpace(sa.copy(this),e);let t=sa.r,n=sa.g,r=sa.b;return e!==Nr?`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(Gp),this.setHSL(Gp.h+e,Gp.s+t,Gp.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(Gp),e.getHSL(u3);let n=f2(Gp.h,u3.h,t),r=f2(Gp.s,u3.s,t),s=f2(Gp.l,u3.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}},sa=new zt;zt.NAMES=YY;var e0=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 Ba,this.environmentIntensity=1,this.environmentRotation=new Ba,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}},Tu=new re,dd=new re,U6=new re,pd=new re,xv=new re,yv=new re,fY=new re,k6=new re,z6=new re,V6=new re,G6=new xn,q6=new xn,H6=new xn,vd=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),Tu.subVectors(e,t),r.cross(Tu);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){Tu.subVectors(r,t),dd.subVectors(n,t),U6.subVectors(e,t);let o=Tu.dot(Tu),a=Tu.dot(dd),l=Tu.dot(U6),c=dd.dot(dd),u=dd.dot(U6),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,pd)===null?!1:pd.x>=0&&pd.y>=0&&pd.x+pd.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,pd)===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,pd.x),l.addScaledVector(o,pd.y),l.addScaledVector(a,pd.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return G6.setScalar(0),q6.setScalar(0),H6.setScalar(0),G6.fromBufferAttribute(e,t),q6.fromBufferAttribute(e,n),H6.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(G6,s.x),o.addScaledVector(q6,s.y),o.addScaledVector(H6,s.z),o}static isFrontFacing(e,t,n,r){return Tu.subVectors(n,t),dd.subVectors(e,t),Tu.cross(dd).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 Tu.subVectors(this.c,this.b),dd.subVectors(this.a,this.b),Tu.cross(dd).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;xv.subVectors(r,n),yv.subVectors(s,n),k6.subVectors(e,n);let l=xv.dot(k6),c=yv.dot(k6);if(l<=0&&c<=0)return t.copy(n);z6.subVectors(e,r);let u=xv.dot(z6),f=yv.dot(z6);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(xv,o);V6.subVectors(e,s);let A=xv.dot(V6),y=yv.dot(V6);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(yv,a);let S=u*y-A*f;if(S<=0&&f-u>=0&&A-y>=0)return fY.subVectors(s,r),a=(f-u)/(f-u+(A-y)),t.copy(r).addScaledVector(fY,a);let T=1/(S+w+d);return o=w*T,a=d*T,t.copy(n).addScaledVector(xv,o).addScaledVector(yv,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Oa=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(Eu.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Eu.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=Eu.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,Eu):Eu.fromBufferAttribute(s,o),Eu.applyMatrix4(e.matrixWorld),this.expandByPoint(Eu);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),h3.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),h3.copy(n.boundingBox)),h3.applyMatrix4(e.matrixWorld),this.union(h3)}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,Eu),Eu.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(i2),f3.subVectors(this.max,i2),bv.subVectors(e.a,i2),wv.subVectors(e.b,i2),Sv.subVectors(e.c,i2),qp.subVectors(wv,bv),Hp.subVectors(Sv,wv),vA.subVectors(bv,Sv);let t=[0,-qp.z,qp.y,0,-Hp.z,Hp.y,0,-vA.z,vA.y,qp.z,0,-qp.x,Hp.z,0,-Hp.x,vA.z,0,-vA.x,-qp.y,qp.x,0,-Hp.y,Hp.x,0,-vA.y,vA.x,0];return!W6(t,bv,wv,Sv,f3)||(t=[1,0,0,0,1,0,0,0,1],!W6(t,bv,wv,Sv,f3))?!1:(d3.crossVectors(qp,Hp),t=[d3.x,d3.y,d3.z],W6(t,bv,wv,Sv,f3))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Eu).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Eu).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:(md[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),md[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),md[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),md[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),md[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),md[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),md[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),md[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(md),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}},md=[new re,new re,new re,new re,new re,new re,new re,new re],Eu=new re,h3=new Oa,bv=new re,wv=new re,Sv=new re,qp=new re,Hp=new re,vA=new re,i2=new re,f3=new re,d3=new re,_A=new re;function W6(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){_A.fromArray(i,s);let a=r.x*Math.abs(_A.x)+r.y*Math.abs(_A.y)+r.z*Math.abs(_A.z),l=e.dot(_A),c=t.dot(_A),u=n.dot(_A);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var _d=xme();function xme(){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 Wl(i){Math.abs(i)>65504&&Xe("DataUtils.toHalfFloat(): Value out of range."),i=Nn(i,-65504,65504),_d.floatView[0]=i;let e=_d.uint32View[0],t=e>>23&511;return _d.baseTable[t]+((e&8388607)>>_d.shiftTable[t])}function p3(i){let e=i>>10;return _d.uint32View[0]=_d.mantissaTable[_d.offsetTable[e]+(i&1023)]+_d.exponentTable[e],_d.floatView[0]}var zs=new re,m3=new Oe,yme=0,Hi=class extends aa{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:yme++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Qp,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++)m3.fromBufferAttribute(this,t),m3.applyMatrix3(e),this.setXY(t,m3.x,m3.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=Da(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Yn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Da(t,this.array)),t}setX(e,t){return this.normalized&&(t=Yn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Da(t,this.array)),t}setY(e,t){return this.normalized&&(t=Yn(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=Da(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Yn(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=Da(t,this.array)),t}setW(e,t){return this.normalized&&(t=Yn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Yn(t,this.array),n=Yn(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=Yn(t,this.array),n=Yn(n,this.array),r=Yn(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=Yn(t,this.array),n=Yn(n,this.array),r=Yn(r,this.array),s=Yn(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!==Qp&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var PA=class extends Hi{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var LA=class extends Hi{constructor(e,t,n){super(new Uint32Array(e),t,n)}},zv=class extends Hi{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=p3(this.array[e*this.itemSize]);return this.normalized&&(t=Da(t,this.array)),t}setX(e,t){return this.normalized&&(t=Yn(t,this.array)),this.array[e*this.itemSize]=Wl(t),this}getY(e){let t=p3(this.array[e*this.itemSize+1]);return this.normalized&&(t=Da(t,this.array)),t}setY(e,t){return this.normalized&&(t=Yn(t,this.array)),this.array[e*this.itemSize+1]=Wl(t),this}getZ(e){let t=p3(this.array[e*this.itemSize+2]);return this.normalized&&(t=Da(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Yn(t,this.array)),this.array[e*this.itemSize+2]=Wl(t),this}getW(e){let t=p3(this.array[e*this.itemSize+3]);return this.normalized&&(t=Da(t,this.array)),t}setW(e,t){return this.normalized&&(t=Yn(t,this.array)),this.array[e*this.itemSize+3]=Wl(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Yn(t,this.array),n=Yn(n,this.array)),this.array[e+0]=Wl(t),this.array[e+1]=Wl(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Yn(t,this.array),n=Yn(n,this.array),r=Yn(r,this.array)),this.array[e+0]=Wl(t),this.array[e+1]=Wl(n),this.array[e+2]=Wl(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Yn(t,this.array),n=Yn(n,this.array),r=Yn(r,this.array),s=Yn(s,this.array)),this.array[e+0]=Wl(t),this.array[e+1]=Wl(n),this.array[e+2]=Wl(r),this.array[e+3]=Wl(s),this}},Ln=class extends Hi{constructor(e,t,n){super(new Float32Array(e),t,n)}},bme=new Oa,r2=new re,j6=new re,vl=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):bme.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;r2.subVectors(e,this.center);let t=r2.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(r2,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):(j6.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(r2.copy(e.center).add(j6)),this.expandByPoint(r2.copy(e.center).sub(j6))),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}},wme=0,Dc=new cn,X6=new lr,Tv=new re,jl=new Oa,s2=new Oa,vo=new re,Xn=class i extends aa{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:wme++}),this.uuid=Eh(),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(X0e(e)?LA:PA)(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 Dc.makeRotationFromQuaternion(e),this.applyMatrix4(Dc),this}rotateX(e){return Dc.makeRotationX(e),this.applyMatrix4(Dc),this}rotateY(e){return Dc.makeRotationY(e),this.applyMatrix4(Dc),this}rotateZ(e){return Dc.makeRotationZ(e),this.applyMatrix4(Dc),this}translate(e,t,n){return Dc.makeTranslation(e,t,n),this.applyMatrix4(Dc),this}scale(e,t,n){return Dc.makeScale(e,t,n),this.applyMatrix4(Dc),this}lookAt(e){return X6.lookAt(e),X6.updateMatrix(),this.applyMatrix4(X6.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Tv).negate(),this.translate(Tv.x,Tv.y,Tv.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 Oa);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?(vo.addVectors(this.boundingBox.min,jl.min),this.boundingBox.expandByPoint(vo),vo.addVectors(this.boundingBox.max,jl.max),this.boundingBox.expandByPoint(vo)):(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 vl);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];s2.setFromBufferAttribute(a),this.morphTargetsRelative?(vo.addVectors(jl.min,s2.min),jl.expandByPoint(vo),vo.addVectors(jl.max,s2.max),jl.expandByPoint(vo)):(jl.expandByPoint(s2.min),jl.expandByPoint(s2.max))}jl.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)vo.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(vo));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++)vo.fromBufferAttribute(a,c),l&&(Tv.fromBufferAttribute(e,c),vo.add(Tv)),r=Math.max(r,n.distanceToSquared(vo))}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++)vo.fromBufferAttribute(e,t),vo.normalize(),e.setXYZ(t,vo.x,vo.y,vo.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"})}},Sd=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Qp,this.updateRanges=[],this.version=0,this.uuid=Eh()}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=Eh()),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=Eh()),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}}},Pa=new re,Oo=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++)Pa.fromBufferAttribute(this,t),Pa.applyMatrix4(e),this.setXYZ(t,Pa.x,Pa.y,Pa.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Pa.fromBufferAttribute(this,t),Pa.applyNormalMatrix(e),this.setXYZ(t,Pa.x,Pa.y,Pa.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Pa.fromBufferAttribute(this,t),Pa.transformDirection(e),this.setXYZ(t,Pa.x,Pa.y,Pa.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Da(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Yn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Yn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Yn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Yn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Yn(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=Da(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Da(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Da(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Da(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Yn(t,this.array),n=Yn(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=Yn(t,this.array),n=Yn(n,this.array),r=Yn(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=Yn(t,this.array),n=Yn(n,this.array),r=Yn(r,this.array),s=Yn(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){RA("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){RA("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}}},Sme=0,Hs=class extends aa{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Sme++}),this.uuid=Eh(),this.name="",this.type="Material",this.blending=Ts,this.side=Bo,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=$p,this.blendDst=Yp,this.blendEquation=so,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new zt(0,0,0),this.blendAlpha=0,this.depthFunc=Mh,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=A2,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=gd,this.stencilZFail=gd,this.stencilZPass=gd,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!==Bo&&(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!==$p&&(n.blendSrc=this.blendSrc),this.blendDst!==Yp&&(n.blendDst=this.blendDst),this.blendEquation!==so&&(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!==Mh&&(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!==A2&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==gd&&(n.stencilFail=this.stencilFail),this.stencilZFail!==gd&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==gd&&(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++}},Ch=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}},Ev,o2=new re,Mv=new re,Cv=new re,Rv=new Oe,a2=new Oe,ZY=new cn,A3=new re,l2=new re,g3=new re,dY=new Oe,$6=new Oe,pY=new Oe,DA=class extends lr{constructor(e=new Ch){if(super(),this.isSprite=!0,this.type="Sprite",Ev===void 0){Ev=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 Sd(t,5);Ev.setIndex([0,1,2,0,2,3]),Ev.setAttribute("position",new Oo(n,3,0,!1)),Ev.setAttribute("uv",new Oo(n,2,3,!1))}this.geometry=Ev,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.'),Mv.setFromMatrixScale(this.matrixWorld),ZY.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Cv.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Mv.multiplyScalar(-Cv.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;v3(A3.set(-.5,-.5,0),Cv,o,Mv,r,s),v3(l2.set(.5,-.5,0),Cv,o,Mv,r,s),v3(g3.set(.5,.5,0),Cv,o,Mv,r,s),dY.set(0,0),$6.set(1,0),pY.set(1,1);let a=e.ray.intersectTriangle(A3,l2,g3,!1,o2);if(a===null&&(v3(l2.set(-.5,.5,0),Cv,o,Mv,r,s),$6.set(0,1),a=e.ray.intersectTriangle(A3,g3,l2,!1,o2),a===null))return;let l=e.ray.origin.distanceTo(o2);l<e.near||l>e.far||t.push({distance:l,point:o2.clone(),uv:vd.getInterpolation(o2,A3,l2,g3,dY,$6,pY,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 v3(i,e,t,n,r,s){Rv.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(a2.x=s*Rv.x-r*Rv.y,a2.y=r*Rv.x+s*Rv.y):a2.copy(Rv),i.copy(e),i.x+=a2.x,i.y+=a2.y,i.applyMatrix4(ZY)}var Ad=new re,Y6=new re,_3=new re,Wp=new re,Z6=new re,x3=new re,K6=new re,Td=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,Ad)),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=Ad.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ad.copy(this.origin).addScaledVector(this.direction,t),Ad.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Y6.copy(e).add(t).multiplyScalar(.5),_3.copy(t).sub(e).normalize(),Wp.copy(this.origin).sub(Y6);let s=e.distanceTo(t)*.5,o=-this.direction.dot(_3),a=Wp.dot(this.direction),l=-Wp.dot(_3),c=Wp.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(Y6).addScaledVector(_3,d),A}intersectSphere(e,t){Ad.subVectors(e.center,this.origin);let n=Ad.dot(this.direction),r=Ad.dot(Ad)-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,Ad)!==null}intersectTriangle(e,t,n,r,s){Z6.subVectors(t,e),x3.subVectors(n,e),K6.crossVectors(Z6,x3);let o=this.direction.dot(K6),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Wp.subVectors(this.origin,e);let l=a*this.direction.dot(x3.crossVectors(Wp,x3));if(l<0)return null;let c=a*this.direction.dot(Z6.cross(Wp));if(c<0||l+c>o)return null;let u=-a*Wp.dot(K6);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)}},hs=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 Ba,this.combine=WA,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}},mY=new cn,xA=new Td,y3=new vl,AY=new re,b3=new re,w3=new re,S3=new re,Q6=new re,T3=new re,gY=new re,E3=new re,Hn=class extends lr{constructor(e=new Xn,t=new hs){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){T3.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let u=a[l],f=s[l];u!==0&&(Q6.fromBufferAttribute(f,e),o?T3.addScaledVector(Q6,u):T3.addScaledVector(Q6.sub(t),u))}t.add(T3)}return t}raycast(e,t){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),y3.copy(n.boundingSphere),y3.applyMatrix4(s),xA.copy(e.ray).recast(e.near),!(y3.containsPoint(xA.origin)===!1&&(xA.intersectSphere(y3,AY)===null||xA.origin.distanceToSquared(AY)>(e.far-e.near)**2))&&(mY.copy(s).invert(),xA.copy(e.ray).applyMatrix4(mY),!(n.boundingBox!==null&&xA.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,xA)))}_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=M3(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=M3(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=M3(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=M3(this,o,e,n,c,u,f,R,P,I),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}};function Tme(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===Bo,a),l===null)return null;E3.copy(a),E3.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(E3);return c<t.near||c>t.far?null:{distance:c,point:E3.clone(),object:i}}function M3(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,b3),i.getVertexPosition(l,w3),i.getVertexPosition(c,S3);let u=Tme(i,e,t,n,b3,w3,S3,gY);if(u){let f=new re;vd.getBarycoord(gY,b3,w3,S3,f),r&&(u.uv=vd.getInterpolatedAttribute(r,a,l,c,f,new Oe)),s&&(u.uv1=vd.getInterpolatedAttribute(s,a,l,c,f,new Oe)),o&&(u.normal=vd.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};vd.getNormal(b3,w3,S3,d.normal),u.face=d,u.barycoord=f}return u}var NA=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 Xl=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 J6=new re,Eme=new re,Mme=new Mn,La=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=J6.subVectors(n,t).cross(Eme.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(J6),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||Mme.getNormalMatrix(e),r=this.coplanarPoint(J6).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)}},yA=new vl,Cme=new Oe(.5,.5),C3=new re,Nc=class{constructor(e=new La,t=new La,n=new La,r=new La,s=new La,o=new La){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=Fo,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===Fo)r[5].setComponents(c+l,A+d,T+S,F+I).normalize();else if(t===gl)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(),yA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),yA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(yA)}intersectsSprite(e){yA.center.set(0,0,0);let t=Cme.distanceTo(e.center);return yA.radius=.7071067811865476+t,yA.applyMatrix4(e.matrixWorld),this.intersectsSphere(yA)}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(C3.x=r.normal.x>0?e.max.x:e.min.x,C3.y=r.normal.y>0?e.max.y:e.min.y,C3.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(C3)<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)}},vY=new cn,g2=class i{constructor(){this.coordinateSystem=Fo,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];vY.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[r]===void 0&&(n[r]=new Nc),n[r].setFromProjectionMatrix(vY,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 Nc),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new i().copy(this)}};var Mu=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}},H3=new re,W3=new re,_Y=new cn,c2=new Td,R3=new vl,e8=new re,xY=new re,t0=class extends lr{constructor(e=new Xn,t=new Mu){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++)H3.fromBufferAttribute(t,r-1),W3.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=H3.distanceTo(W3);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(),R3.copy(n.boundingSphere),R3.applyMatrix4(r),R3.radius+=s,e.ray.intersectsSphere(R3)===!1)return;_Y.copy(r).invert(),c2.copy(e.ray).applyMatrix4(_Y);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=I3(this,e,c2,l,T,R,w);P&&t.push(P)}if(this.isLineLoop){let w=u.getX(y-1),S=u.getX(A),T=I3(this,e,c2,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=I3(this,e,c2,l,w,w+1,w);T&&t.push(T)}if(this.isLineLoop){let w=I3(this,e,c2,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 I3(i,e,t,n,r,s,o){let a=i.geometry.attributes.position;if(H3.fromBufferAttribute(a,r),W3.fromBufferAttribute(a,s),t.distanceSqToSegment(H3,W3,e8,xY)>n)return;e8.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(e8);if(!(c<e.near||c>e.far))return{distance:c,point:xY.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var yY=new re,bY=new re,Vv=class extends t0{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)yY.fromBufferAttribute(t,r),bY.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+yY.distanceTo(bY);e.setAttribute("lineDistance",new Ln(n,1))}else Xe("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var n0=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}},wY=new cn,u8=new Td,P3=new vl,L3=new re,v2=class extends lr{constructor(e=new Xn,t=new n0){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(),P3.copy(n.boundingSphere),P3.applyMatrix4(r),P3.radius+=s,e.ray.intersectsSphere(P3)===!1)return;wY.copy(r).invert(),u8.copy(e.ray).applyMatrix4(wY);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);L3.fromBufferAttribute(f,S),SY(L3,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++)L3.fromBufferAttribute(f,y),SY(L3,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 SY(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 FA=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 Rh=class extends qs{constructor(e=[],t=Yl,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!==_o)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 Uv(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}},Gv=class extends Es{constructor(e,t=xi,n=Yl,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}},_2=class extends qs{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Cu=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 ge=he*z-W;for(let Re=0;Re<H;Re++){let Qe=Re*k-G;ce[w]=Qe*R,ce[S]=ge*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 ge=0;ge<L;ge++){let Re=d+ge+H*he,Qe=d+ge+H*(he+1),Fe=d+(ge+1)+H*(he+1),mt=d+(ge+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 qv=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)}},BA=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 Ua=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}},Hv=class extends Ua{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}},j3=class extends Hv{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function G8(){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 TY=new re,EY=new re,t8=new G8,n8=new G8,i8=new G8,X3=class extends Ua{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]:(EY.subVectors(r[0],r[1]).add(r[0]),c=EY);let f=r[a%s],d=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(TY.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=TY),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),t8.initNonuniformCatmullRom(c.x,f.x,d.x,u.x,y,w,S),n8.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"&&(t8.initCatmullRom(c.x,f.x,d.x,u.x,this.tension),n8.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(t8.calc(l),n8.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 MY(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 Rme(i,e){let t=1-i;return t*t*e}function Ime(i,e){return 2*(1-i)*i*e}function Pme(i,e){return i*i*e}function d2(i,e,t,n){return Rme(i,e)+Ime(i,t)+Pme(i,n)}function Lme(i,e){let t=1-i;return t*t*t*e}function Dme(i,e){let t=1-i;return 3*t*t*i*e}function Nme(i,e){return 3*(1-i)*i*i*e}function Fme(i,e){return i*i*i*e}function p2(i,e,t,n,r){return Lme(i,e)+Dme(i,t)+Nme(i,n)+Fme(i,r)}var x2=class extends Ua{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(p2(e,r.x,s.x,o.x,a.x),p2(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}},Wv=class extends Ua{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(p2(e,r.x,s.x,o.x,a.x),p2(e,r.y,s.y,o.y,a.y),p2(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}},y2=class extends Ua{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}},$3=class extends Ua{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}},b2=class extends Ua{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}},w2=class extends Ua{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}},S2=class extends Ua{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(MY(a,l.x,c.x,u.x,f.x),MY(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}},Y3=Object.freeze({__proto__:null,ArcCurve:j3,CatmullRomCurve3:X3,CubicBezierCurve:x2,CubicBezierCurve3:Wv,EllipseCurve:Hv,LineCurve:y2,LineCurve3:$3,QuadraticBezierCurve:b2,QuadraticBezierCurve3:w2,SplineCurve:S2}),Z3=class extends Ua{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 Y3[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 Y3[r.type]().fromJSON(r))}return this}},OA=class extends Z3{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 y2(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 b2(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 x2(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 S2(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 Hv(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}},T2=class extends OA{constructor(e){super(e),this.uuid=Eh(),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 OA().fromJSON(r))}return this}};function Bme(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length,s=KY(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=Vme(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 E2(s,o,t,a,l,c,0),o}function KY(i,e,t,n,r){let s;if(r===Qme(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=CY(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=CY(o/n|0,i[o],i[o+1],s);return s&&jv(s,s.next)&&(C2(s),s=s.next),s}function UA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(jv(t,t.next)||$r(t.prev,t,t.next)===0)){if(C2(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function E2(i,e,t,n,r,s,o){if(!i)return;!o&&s&&jme(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?Ume(i,n,r,s):Ome(i)){e.push(l.i,i.i,c.i),C2(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=kme(UA(i),e),E2(i,e,t,n,r,s,2)):o===2&&zme(i,e,t,n,r,s):E2(UA(i),e,t,n,r,s,1);break}}}function Ome(i){let e=i.prev,t=i,n=i.next;if($r(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&&u2(r,a,s,l,o,c,y.x,y.y)&&$r(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function Ume(i,e,t,n){let r=i.prev,s=i,o=i.next;if($r(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=h8(A,y,e,t,n),R=h8(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&&u2(a,u,l,f,c,d,P.x,P.y)&&$r(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&&u2(a,u,l,f,c,d,I.x,I.y)&&$r(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&&u2(a,u,l,f,c,d,P.x,P.y)&&$r(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&&u2(a,u,l,f,c,d,I.x,I.y)&&$r(I.prev,I,I.next)>=0)return!1;I=I.nextZ}return!0}function kme(i,e){let t=i;do{let n=t.prev,r=t.next.next;!jv(n,r)&&JY(n,t,t.next,r)&&M2(n,r)&&M2(r,n)&&(e.push(n.i,t.i,r.i),C2(t),C2(t.next),t=i=r),t=t.next}while(t!==i);return UA(t)}function zme(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Yme(o,a)){let l=eZ(o,a);o=UA(o,o.next),l=UA(l,l.next),E2(o,e,t,n,r,s,0),E2(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function Vme(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=KY(i,a,l,n,!1);c===c.next&&(c.steiner=!0),r.push($me(c))}r.sort(Gme);for(let s=0;s<r.length;s++)t=qme(r[s],t);return t}function Gme(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 qme(i,e){let t=Hme(i,e);if(!t)return e;let n=eZ(t,i);return UA(n,n.next),UA(t,t.next)}function Hme(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(jv(i,t))return t;do{if(jv(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&&QY(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);M2(t,i)&&(f<u||f===u&&(t.x>o.x||t.x===o.x&&Wme(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function Wme(i,e){return $r(i.prev,i,e.prev)<0&&$r(e.next,i,i.next)<0}function jme(i,e,t,n){let r=i;do r.z===0&&(r.z=h8(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,Xme(r)}function Xme(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 h8(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 $me(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 QY(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 u2(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&QY(i,e,t,n,r,s,o,a)}function Yme(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!Zme(i,e)&&(M2(i,e)&&M2(e,i)&&Kme(i,e)&&($r(i.prev,i,e.prev)||$r(i,e.prev,e))||jv(i,e)&&$r(i.prev,i,i.next)>0&&$r(e.prev,e,e.next)>0)}function $r(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function jv(i,e){return i.x===e.x&&i.y===e.y}function JY(i,e,t,n){let r=N3($r(i,e,t)),s=N3($r(i,e,n)),o=N3($r(t,n,i)),a=N3($r(t,n,e));return!!(r!==s&&o!==a||r===0&&D3(i,t,e)||s===0&&D3(i,n,e)||o===0&&D3(t,i,n)||a===0&&D3(t,e,n))}function D3(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 N3(i){return i>0?1:i<0?-1:0}function Zme(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&&JY(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function M2(i,e){return $r(i.prev,i,i.next)<0?$r(i,e,i.next)>=0&&$r(i,i.prev,e)>=0:$r(i,e,i.prev)<0||$r(i,i.next,e)<0}function Kme(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 eZ(i,e){let t=f8(i.i,i.x,i.y),n=f8(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 CY(i,e,t,n){let r=f8(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 C2(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 f8(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Qme(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 d8=class{static triangulate(e,t,n=2){return Bme(e,t,n)}},Xp=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=[];RY(e),IY(n,e);let o=e.length;t.forEach(RY);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,IY(n,t[l]);let a=d8.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function RY(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function IY(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var R2=class i extends Xn{constructor(e=new T2([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:Jme,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(!Xp.isClockWise(k)){k=k.reverse();for(let $e=0,ot=z.length;$e<ot;$e++){let nt=z[$e];Xp.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,ve=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(ve<=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,ve=nt.y-$e.y,vi=en*en+tn*tn,zn=en*ve-tn*bn;if(Math.abs(zn)>Number.EPSILON){let le=Math.sqrt(vi),Z=Math.sqrt(bn*bn+ve*ve),Te=ot.x-tn/le,Pe=ot.y+en/le,Ge=nt.x-ve/Z,vt=nt.y+bn/Z,Tt=((Ge-Te)*ve-(vt-Pe)*bn)/(en*ve-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(ve)&&(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=[],ge,Re=ce.concat();for(let $e=0,ot=Y;$e<ot;$e++){let nt=z[$e];ge=[];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),ge[bt]=te(nt[bt],nt[hn],nt[en]);he.push(ge),Re=Re.concat(ge)}let Qe;if(S===0)Qe=Xp.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];ge=he[en];let ve=[];for(let vi=0,zn=bn.length;vi<zn;vi++){let le=$(bn[vi],ge[vi],hn);Mt(le.x,le.y,-yt),bt===0&&ve.push(le)}bt===0&&ot.push(ve)}}Qe=Xp.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];ge=he[yt];for(let tn=0,bn=en.length;tn<bn;tn++){let ve=$(en[tn],ge[tn],bt);I?Mt(ve.x,ve.y+P[u-1].y,P[u-1].x+nt):Mt(ve.x,ve.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),ve=ot+bt+tn,vi=ot+yt+tn,zn=ot+yt+bn,le=ot+bt+bn;It(ve,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 eAe(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 Y3[r.type]().fromJSON(r)),new i(n,e.options)}},Jme={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 eAe(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 kA=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 ka=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 I2=class i extends Xn{constructor(e=new w2(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 Y3[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},P2=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),PY(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),PY(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 PY(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 L2=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 ng(i){let e={};for(let t in i){e[t]={};for(let n in i[t]){let r=i[t][n];if(LY(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(LY(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 ua(i){let e={};for(let t=0;t<i.length;t++){let n=ng(i[t]);for(let r in n)e[r]=n[r]}return e}function LY(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function tAe(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function q8(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ln.workingColorSpace}var ig={clone:ng,merge:ua},nAe=`void main() {1+(()=>{var Mue=Object.create;var uL=Object.defineProperty;var Cue=Object.getOwnPropertyDescriptor;var Rue=Object.getOwnPropertyNames;var Iue=Object.getPrototypeOf,Pue=Object.prototype.hasOwnProperty;var lq=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},Lue=(i,e)=>{for(var t in e)uL(i,t,{get:e[t],enumerable:!0})},Due=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Rue(e))!Pue.call(i,r)&&r!==t&&uL(i,r,{get:()=>e[r],enumerable:!(n=Cue(e,r))||n.enumerable});return i};var cq=(i,e,t)=>(t=i!=null?Mue(Iue(i)):{},Due(e||!i||!i.__esModule?uL(t,"default",{value:i,enumerable:!0}):t,i));var mq=lq((tT,pq)=>{(function(i,e){typeof tT=="object"&&typeof pq<"u"?e(tT):typeof define=="function"&&define.amd?define(["exports"],e):e(i.bigfloat={})})(tT,(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,ge=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;)ge-=Y[ce],Re=ge>>>0,ge=-(ge<0),G[ce++]=Re;z+=H,z>$&&(z=$),he=ce}for(C.fractionLen=k;he<z;)ge+=W[te++]-Y[ce++],Re=ge>>>0,ge=-(ge<0),G[he++]=Re;for(;he<J;)ge+=W[te++],Re=ge>>>0,ge=-(ge<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,ge,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;)ge=mt(),Qe=Ee,Ee+=ge,Re=Ee-Qe,Fe=Qe-(Ee-Re)+(ge-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 xJ=lq((cw,qB)=>{(function(i,e){typeof cw=="object"&&typeof qB=="object"?qB.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 uq=i=>new Promise(e=>setTimeout(e,i)),ws=i=>document.querySelector(i);async function Nue(){for(let i=0;i<300&&!(window.__atlasDebug&&!ws("#map-loading")?.checkVisibility?.());i+=1)await uq(100)}async function Fue(){let i="";for(let e=0;e<100;e+=1){await uq(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 op(i,e={}){window.dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0,...e}))}function Bue(i,e={}){window.dispatchEvent(new KeyboardEvent("keyup",{key:i,bubbles:!0,cancelable:!0,...e}))}function Oue(i){ws("#map").dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0}))}function Om(i,e){i.value=e,i.dispatchEvent(new Event("change",{bubbles:!0}))}function hL(i,e){let t=ws(i);t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function fL(i,e=!1){let t=ws("#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 Uue(){let i=[],e=async d=>{await Fue(),i.push({name:d,snapshot:JSON.parse(window.render_game_to_text())})};await Nue(),localStorage.clear();let t=ws("#game-select"),n=t.options[0].value;Om(t,n),await e("initial"),hL("#pin-search","a"),await e("search-a");let r=ws(".search-result");r&&(r.click(),await e("search-select-first"),ws("#close-detail").click(),await e("detail-closed")),hL("#pin-search",""),await e("search-cleared");let s=ws(".category-row input");s&&(s.click(),await e("category-hidden"),s.click(),await e("category-restored"));let o=ws(".only-button");if(o){o.click(),await e("solo-first");let d=ws("#solo-chip");d&&!d.hidden&&d.click(),await e("solo-cleared")}let a=ws("#legend .layer-title");a&&(a.click(),await e("section-folded"),ws("#expand-all").click(),await e("sections-unfolded")),ws("#hide-all").click(),await e("all-hidden"),ws("#show-all").click(),await e("all-shown");let l=ws(".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")),op("g"),await e("grid-open"),hL("#grid-input","m"),await e("grid-descended"),op(" "),await e("subgrid-hidden"),op(" "),op("Escape"),await e("grid-ascended"),op("Escape"),await e("grid-closed"),op("z"),await e("labels-on"),Bue("z"),await e("labels-off"),op("b",{metaKey:!0}),await e("sidebar-collapsed"),op("b",{metaKey:!0}),await e("sidebar-restored"),ws("#zoom-in").click(),await e("zoomed-in");let c=ws("#overview-dock");c&&!ws("#overview-shelf").hidden&&(c.click(),await e("overview-docked"),c.click(),await e("overview-undocked")),ws("#zoom-out").click(),await e("zoomed-out"),Oue("Escape"),await e("viewport-escape");let u=ws("#variant-select");u.options.length>1&&(Om(u,u.options[1].value),await e("variant-second"),Om(u,u.options[0].value),await e("variant-first"));let f=ws("#map-select");return f.options.length>1&&(Om(f,f.options[1].value),await e("map-second"),Om(f,f.options[0].value),await e("map-first")),t.options.length>1&&(Om(t,t.options[1].value),await e("game-second"),Om(t,n),await e("game-first")),localStorage.clear(),{viewport:[window.innerWidth,window.innerHeight],steps:i}}var dL=!1;async function hq(){if(!dL){dL=!0,fL("parity tour running\u2026");try{let i=await Uue(),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}`);fL(`parity tour complete \u2713 ${i.steps.length} steps`),console.log("parity tour saved to",t)}catch(i){fL(`parity tour failed: ${i}`,!0),console.error("parity tour failed",i)}finally{dL=!1}}}window.__atlasTour=hq;window.addEventListener("keydown",i=>{i.key==="F9"&&hq()});var nn=i=>document.querySelector(i),_e={game:nn("#game-select"),map:nn("#map-select"),variant:nn("#variant-select"),variantField:nn("#variant-field"),legend:nn("#legend"),search:nn("#pin-search"),searchResults:nn("#dock-results"),dock:nn("#dock"),dockCount:nn("#dock-count"),dockFlag:nn("#dock-flag"),dockFold:nn("#dock-fold"),dockRailName:nn("#dock-rail-name"),visibleCount:nn("#visible-count"),viewport:nn("#map"),globe:nn("#globe"),globeToggle:nn("#globe-toggle"),layers:nn("#layers"),zoneToggle:nn("#zone-toggle"),zoneCount:nn("#zone-count"),zoneIndex:nn("#zone-index"),zoneList:nn("#zone-list"),loading:nn("#map-loading"),labelsHint:nn("#labels-hint"),gridHint:nn("#grid-hint"),soloChip:nn("#solo-chip"),overview:nn("#overview"),overviewShelf:nn("#overview-shelf"),overviewDock:nn("#overview-dock"),overviewCanvas:nn("#overview-canvas"),overviewViewport:nn("#overview-viewport"),gridNavigator:nn("#grid-navigator"),gridSystem:nn("#grid-system"),gridSystemName:nn("#grid-system-name"),gridInput:nn("#grid-input"),gridBack:nn("#grid-back"),subgridToggle:nn("#subgrid-toggle"),detail:nn("#pin-detail"),detailTitle:nn("#detail-title"),detailCategory:nn("#detail-category"),detailDescription:nn("#detail-description"),detailID:nn("#detail-id"),detailCoordinates:nn("#detail-coordinates"),detailCell:nn("#detail-cell"),detailCellField:nn("#detail-cell-field"),detailSource:nn("#detail-source"),detailSourceField:nn("#detail-source-field"),detailLinks:nn("#detail-links"),detailDot:nn("#detail-dot"),sidebar:nn("#sidebar"),mobileLegend:nn("#mobile-legend"),fatal:nn("#fatal-error"),fatalMessage:nn("#fatal-message"),emptyState:nn("#empty-state"),emptyPath:nn("#empty-path"),emptyOpen:nn("#empty-open"),addBundles:nn("#add-bundles")};function Um(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 U={catalog:null,game:null,map:null,variant:null,engine:null,projection:null,layers:null,sources:null,hiddenCategories:new Set,collapsedSections:new Set,pins:[],pinByID:new Map,selectedPin:null,hoveredPin:null,labelsHeld:!1,gridEnabled:!1,gridSystem:"geohash",globeActive:!1,subgridVisible:!0,gridCell:"",zonesVisible:!0,zoneRecords:new Map,highlightedZones:new Set,focusedZoneID:null,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,mapRun:0,textByMap:new Map,restore:null,settling:!1,styleCache:new Map,markerIcons:new Map};var Gf=["#4fb3d5","#c9924b","#82b56a","#c96a6a","#9581cc","#4bc9a9","#d4b04a","#6a92c9","#b08a5a","#8fb3a2"],km="0123456789bcdefghjkmnpqrstuvwxyz";var pL="atlas.session";var fq={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 eT(i){let e=[...qf()],t=!0;for(let n of i){let r=km.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 AL(i,e){let t=[...qf()],[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+=km[l]}return o}var mL={key:null,extent:null};function kue(i){let t=`${qf().join(",")}|${i}`;return mL.key!==t&&(mL={key:t,extent:eT(i)}),mL.extent}var gL={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[...km].map(e=>i+e)},childIndex(i){return Math.max(0,km.indexOf(i[i.length-1]))},contains(i,e){let t=kue(i),[n,r]=e;return n>=t[0]&&n<=t[2]&&r>=t[1]&&r<=t[3]},descendTarget(i,e){return AL(e,i.length+1)},bbox:eT,center(i){let e=eT(i);return[(e[0]+e[2])/2,(e[1]+e[3])/2]},ring(i){let[e,t,n,r]=eT(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,km.indexOf(i[i.length-1]))%Gf.length},normalizeInput(i){return[...i.toLocaleLowerCase()].filter(e=>km.includes(e)).slice(0,3).join("")},parseInput(i){return i},locate(i){let e=AL(i,3);return e?{label:"Geohash",value:e}:null}};function dq(i,e=3){return AL(i,e)}var m1=cq(mq());function Aq(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 Xx(i,e,t){if(Xq())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&$x(r,t.prototype),r}function gq(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,que(n.key),n)}}function zue(i,e,t){return e&&gq(i.prototype,e),t&&gq(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=Hue(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 ML(i){return ML=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ML(i)}function Jx(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,$x(i,e)}function Vue(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function Xq(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Xq=function(){return!!i})()}function $x(i,e){return $x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},$x(i,e)}function Gue(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 que(i){var e=Gue(i,"string");return typeof e=="symbol"?e:e+""}function Hue(i,e){if(i){if(typeof i=="string")return Aq(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)?Aq(i,e):void 0}}function y1(i){var e=typeof Map=="function"?new Map:void 0;return y1=function(t){if(t===null||!Vue(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 Xx(t,arguments,ML(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),$x(n,t)},y1(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})(),qr=(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 vL=(function(){function i(t,n,r){this.x=t,this.y=n,this.z=r}i.fromVector=function(n){return new i(new m1.BigFloat32(n.x),new m1.BigFloat32(n.y),new m1.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 m1.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 m1.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 CL=Math.PI/180,ap=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},$q=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)},Wue=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},Yq=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},RL=function(e,t){return e*Math.pow(2,t)},vq=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},vc=function(e){return e},Zq=function(e){return e/CL||0};var jue=function(){return 1/0},Xue=function(e){return e==1/0};var _q=function(e){return Zq(e).toFixed(7)},xq=function(e,t,n){return n===void 0&&(n=1e-15),Math.abs(e-t)<=n};var oT=-1,b1=2,xc=4,jL=4,zm=1e-15,jx=2220446049e-25,iT=function(e){if(e<0)return oT;if(Xue(e))return Sc();var t=2*Math.sin(.5*Math.min(Math.PI,vc(e)));return t*t},IL=function(e){return e>jL?xc:e},AT=function(e,t){return $ue(e)?e:Math.max(0,Math.min(jL,e+t))},aT=function(e){return e<0?-1:Kq(e)?jue():2*Math.asin(.5*Math.sqrt(e))},Sc=function(){return 1/0},Kq=function(e){return e==1/0},$ue=function(e){return e<0||Kq(e)};var w1=function(e){return e>=jL?Sc():e<0?0:$q(e,10)};var XL=function(e){return 4.5*jx*e+16*jx*jx};var Gx=function(e,t){return iT(aT(e)+aT(t))},Yue=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))},Zue=function(e){return Math.sqrt(Qq(e))||0},Qq=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*jx>=2*Math.PI)return i.fullInterval()}else{if(this.isFull())return this;if(this.length()+2*n-2*jx<=0)return i.emptyInterval()}var r=i.fromEndpoints(ap(this.lo-n,2*Math.PI),ap(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*zm:n.isEmpty()?this.length()<=2*zm:this.isFull()?n.length()>=2*(Math.PI-zm):n.isFull()?this.length()>=2*(Math.PI-zm):Math.abs(ap(n.lo-this.lo,2*Math.PI))<=zm&&Math.abs(ap(n.hi-this.hi,2*Math.PI))<=zm&&Math.abs(this.length()-n.length())<=2*zm},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 ll=4,wc=1,Wf=2,Kue=[[0,1,3,2],[0,3,1,2],[2,3,1,0],[2,1,3,0]],$L=[[0,1,3,2],[0,2,3,1],[3,2,0,1],[3,1,0,2]],g1=[wc,0,0,Wf|wc],Jq=[],eH=[];lp(0,0,0,0,0,0);lp(0,0,0,wc,0,wc);lp(0,0,0,Wf,0,Wf);lp(0,0,0,wc|Wf,0,wc|Wf);function lp(i,e,t,n,r,s){if(i==ll){var o=(e<<ll)+t;eH[(o<<2)+n]=(r<<2)+s,Jq[(r<<2)+n]=(o<<2)+s;return}i++,e<<=1,t<<=1,r<<=2;var a=$L[s];lp(i,e+(a[0]>>1),t+(a[0]&1),n,r,s^g1[0]),lp(i,e+(a[1]>>1),t+(a[1]&1),n,r+1,s^g1[1]),lp(i,e+(a[2]>>1),t+(a[2]&1),n,r+2,s^g1[2]),lp(i,e+(a[3]>>1),t+(a[3]&1),n,r+3,s^g1[3])}var Que=3,tH=6,_i=30,ey=2*_i+1,cl=Number(1n<<BigInt(_i)),hp=BigInt(tH)<<BigInt(ey),yq=Number(BigInt(cl)<<1n),cp=function(e){return e>yq?1:e/yq},yc=function(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))},nh=function(e){return e>=0?.5*Math.sqrt(1+3*e):1-.5*Math.sqrt(1-3*e)},Yx=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},qm=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]}},lT=function(e){var t=Yx(e),n=qm(t,e),r=n[0],s=n[1];return[t,r,s]},ih=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)}},Jue=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=qm(e,t),r=n[0],s=n[1];return[r,s,!0]},fp=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)}},rT=function(e,t,n){return ih(e,yc(cp(t)),yc(cp(n)))},bq=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)}},wq=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)}},ehe=[[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)]],the=[[[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]]],nH=function(e,t){return ehe[e][t]},cT=function(e,t,n){return the[e][t][n]},nhe=function(e){return nH(e,0)},ihe=function(e){return nH(e,1)},PL=Math.PI/2,Sq=-PL,ar=(function(){function i(t,n){this.lat=t,this.lng=n}i.fromDegrees=function(n,r){return new i(n*CL,r*CL)},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>PL?n=PL:n<Sq&&(n=Sq);var r=ap(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 xq(this.lat,n.lat)&&xq(this.lng,n.lng)},i})(),rhe=function(e,t){return new We(e[0][t],e[1][t],e[2][t])},_L=function(e,t,n){return e[0][t]=n.x,e[1][t]=n.y,e[2][t]=n.z,e},iH=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)},she=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]]]},YL=function(e){var t=[[0,0,0],[0,0,0],[0,0,0]];return _L(t,2,e),_L(t,1,We.ortho(e)),_L(t,0,We.fromVector(rhe(t,1).vector.cross(e.vector))),t},ohe=function(e,t){return iH(she(e),t)},ahe=function(e,t){return iH(e,t)},uT=-1,Hf=0,M1=1,rH=1e-15,Ki=2220446049250313e-31,Tq=1.8274*Ki,lhe=3.2321*Ki,LL=function(e,t,n){return n.vector.cross(e.vector).dot(t.vector)>0},Vm=function(e,t,n){var r=DL(e,t,n);return r===Hf&&(r=NL(e,t,n)),r},che=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=lhe*Math.sqrt(u.norm2()*f.norm2());return A>y?M1:A<-y?uT:Hf},DL=function(e,t,n){var r=e.vector.cross(t.vector).dot(n.vector);return r>Tq?M1:r<-Tq?uT:Hf},NL=function(e,t,n){if(e.equals(t)||t.equals(n)||n.equals(e))return Hf;var r=che(e,t,n);return r!==Hf?r:uhe(e,t,n,!0)},uhe=function(e,t,n,r){var s=M1,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=vL.fromVector(o.vector),A=vL.fromVector(a.vector),y=vL.fromVector(l.vector),w=A.cross(y),S=d.dot(w),T=S.getSign();return T===Hf&&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:M1},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 Vm(r,o,n)!==uT&&a++,Vm(s,o,r)!==uT&&a++,Vm(n,o,s)===M1&&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=rH),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(YL(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(ahe(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[R1(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)})},zue(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}}])})(),hT=function(e,t,n){return e<t?t:e>n?n:e},fhe=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},dhe=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},phe=function(e){return e<0n?-e:e},FL=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 fhe.apply(void 0,[e].concat(n))},xL=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 dhe.apply(void 0,[e].concat(n))},BL=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},ul=(1n<<64n)-1n,ru=function(e){return Number(e>>BigInt(ey))},mhe=function(e){return e&ul>>BigInt(Que)},to=function(e){return _i-(Wue(e)>>>1)},wr=function(e,t){var n=Hm(t);return e&-n|n},ZL=function(e){var t=os(e)<<2n;return e&-t|t},ty=function(e){return(e&Hm(0)-1n)===0n},Zx=function(e){return typeof e!="bigint"||BigInt.asUintN(64,e)!=e?!1:ru(e)<=tH&&(os(e)&0x1555555555555555n)!=0n},KL=function(e){return(e&1n)!=0n},sH=function(e,t){return Number(e>>2n*BigInt(_i-t)+1n)&3},os=function(e){return e&-e},Hm=function(e){return 1n<<BigInt(2*(_i-e))},C1=function(e){var t=[e,e,e,e],n=os(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},oH=function(e,t){var n=[],r=gp(e),s=r.f,o=r.i,a=r.j,l=Ma(to(e));o&=-l,a&=-l;for(var c=Ma(t),u=-c;;u+=c){var f=void 0;if(u<0?f=a+u>=0:u>=l?f=a+u<cl:(f=!0,n.push(wr(up(s,o+u,a-c,a-l>=0),t)),n.push(wr(up(s,o+u,a+l,a+l<cl),t))),n.push(wr(up(s,o-c,a+u,f&&o-l>=0),t)),n.push(wr(up(s,o+l,a+u,f&&o+l<cl),t)),u>=l)break}return n},qi=function(e){return e-(os(e)-1n)},Gi=function(e){return e+(os(e)-1n)},Gm=function(e,t){return qi(e)<=t&&t<=Gi(e)},aH=function(e,t){return qi(t)<=Gi(e)&&Gi(t)>=qi(e)},Ahe=function(e){var t=e.toString(16).padStart(16,"0").replace(/0+$/,"");return t.length===0?"X":t},ghe=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},vhe=function(e){if(!Zx(e))return"Invalid: "+e.toString(16);for(var t=ru(e)+"/",n=1;n<=to(e);n++)t+=sH(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=pp(n),s=2;s<e.length;s++){var o=parseInt(e[s],10);if(isNaN(o)||o<0||o>3)return 0n;r=C1(r)[o]}return r},xhe=function(e,t,n){return wr((BigInt(e)<<BigInt(ey))+(t||1n),n)},pp=function(e){return(BigInt(e)<<BigInt(ey))+Hm(0)},R1=function(e){var t=lT(e.vector),n=t[0],r=t[1],s=t[2],o=Ol(nh(r)),a=Ol(nh(s));return ny(n,o,a)},lH=function(e){return R1(We.fromLatLng(e))},Ol=function(e){return hT(Math.floor(cl*e),0,cl-1)},Ma=function(e){return 1<<hT(_i-e,0,_i)},cH=function(e){return v1(Ma(e))},v1=function(e){return e/cl},uH=function(e){var t=QL(e),n=t.si,r=t.ti;return new Ci(yc(cp(n)),yc(cp(r)))},yhe=function(e){var t=gp(e),n=t.i,r=t.j;return gT(n,r,to(e))},ny=function(e,t,n){for(var r=BigInt(e)<<BigInt(ey-1),s=e&wc,o=7;o>=0;o--){var a=(1<<ll)-1;s+=(t>>o*ll&a)<<ll+2,s+=(n>>o*ll&a)<<2,s=eH[s],r|=BigInt(s>>2)<<BigInt(o*2*ll),s&=wc|Wf}return r*2n+1n},_1=function(e,t,n){t=hT(t,-1,cl),n=hT(n,-1,cl);var r=1/cl,s=$q(1,2),o=Math.max(-s,Math.min(s,r*(Number(BigInt(t)<<1n)+1-cl))),a=Math.max(-s,Math.min(s,r*(Number(BigInt(n)<<1n)+1-cl))),l=lT(ih(e,o,a));return e=l[0],o=l[1],a=l[2],ny(e,Ol(.5*(o+1)),Ol(.5*(a+1)))},up=function(e,t,n,r){return r?ny(e,t,n):_1(e,t,n)},gp=function(e){for(var t=ru(e),n=t&wc,r=_i-7*ll,s=0,o=0,a=7;a>=0;a--)n+=Number((e>>BigInt(a*2*ll+1)&(1n<<BigInt(2*r))-1n)<<2n),n=Jq[n],s+=n>>ll+2<<a*ll,o+=(n>>2&(1<<ll)-1)<<a*ll,n&=wc|Wf,r=ll;return(os(e)&BigInt("0x1111111111111110"))!=0n&&(n^=wc),{f:t,i:s,j:o,orientation:n}},QL=function(e){var t=gp(e),n=t.f,r=t.i,s=t.j,o=0;return KL(e)?o=1:((BigInt(r)^e>>2n)&1n)!=0n&&(o=2),{face:n,si:2*r+o,ti:2*s+o}},gT=function(e,t,n){var r=Ma(n),s=e&-r,o=t&-r;return new qr(new Li(yc(v1(s)),yc(v1(s+r))),new Li(yc(v1(o)),yc(v1(o+r))))},bhe=function(e){return e>>2n*BigInt(_i-to(e))+1n},iy=function(e){var t=QL(e),n=t.face,r=t.si,s=t.ti;return rT(n,r,s)},JL=function(e){return We.fromVector(iy(e).normalize())},whe=function(e){return ar.fromPoint(We.fromVector(iy(e)))},She=function(e){var t=to(e),n=Ma(t),r=gp(e),s=r.f,o=r.i,a=r.j;return[wr(_1(s,o,a-n),t),wr(_1(s,o+n,a),t),wr(_1(s,o,a+n),t),wr(_1(s,o-n,a),t)]},hH=function(e,t){var n=Ma(t+1),r=n<<1,s=gp(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<cl):(f=-r,c=a-r>=0),(l&n)!=0?(d=r,u=l+r<cl):(d=-r,u=l-r>=0);var A=[wr(e,t),wr(up(o,a+f,l,c),t),wr(up(o,a,l+d,u),t)];return(c||u)&&A.push(wr(up(o,a+f,l+d,c&&u),t)),A},eD=function(e){var t=os(e);return e-t+(t>>2n)},ry=function(e,t){return e-os(e)+Hm(t)},fH=function(e){var t=os(e);return e+t+(t>>2n)},vT=function(e,t){return e+os(e)+Hm(t)},Ra=function(e){return e+(os(e)<<1n)&ul},dH=function(e){return e-(os(e)<<1n)&ul},The=function(e){var t=Ra(e);return t<hp?t:t-hp&ul},Ehe=function(e){var t=dH(e);return t<hp?t:t+hp&ul},Mhe=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=hp>>n;t%=s,t<r&&(t+=s)}}else{var o=hp-e>>n;if(t>o){var a=hp>>n;t%=a,t>o&&(t-=a)}}return e+(t<<phe(n))},Kx=function(e,t){var n=e^t;n<os(e)&&(n=os(e)),n<os(t)&&(n=os(t));var r=Yq(n);return r>60?[0,!1]:[60-r>>1,!0]},OL=function(e,t){var n=qi(e);if(n>=qi(t))return t;if(Gi(e)>=t){for(;e=C1(e)[0],!(Gi(e)<t););return e}for(;!ty(e);){var r=ZL(e);if(qi(r)!==n||Gi(r)>=t)break;e=r}return e},Che=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=hp+os(e)-e>>n;t>s&&(t=s)}return e+(t<<n)},UL=function(e,t){return e<t?-1:e>t?1:0},Rhe=function(e,t){return e>t?-1:e<t?1:0},Ihe={__proto__:null,SentinelCellID:ul,face:ru,pos:mhe,level:to,parent:wr,immediateParent:ZL,isFace:ty,valid:Zx,isLeaf:KL,childPosition:sH,lsb:os,lsbForLevel:Hm,children:C1,allNeighbors:oH,rangeMin:qi,rangeMax:Gi,contains:Gm,intersects:aH,toToken:Ahe,fromToken:ghe,toString:vhe,fromString:_he,fromFacePosLevel:xhe,fromFace:pp,fromPoint:R1,fromLatLng:lH,stToIJ:Ol,sizeIJ:Ma,sizeST:cH,ijToSTMin:v1,centerUV:uH,boundUV:yhe,fromFaceIJ:ny,fromFaceIJWrap:_1,fromFaceIJSame:up,faceIJOrientation:gp,faceSiTi:QL,ijLevelToBoundUV:gT,distanceFromBegin:bhe,rawPoint:iy,point:JL,latLng:whe,edgeNeighbors:She,vertexNeighbors:hH,childBegin:eD,childBeginAtLevel:ry,childEnd:fH,childEndAtLevel:vT,next:Ra,prev:dH,nextWrap:The,prevWrap:Ehe,advanceWrap:Mhe,commonAncestorLevel:Kx,maxTile:OL,advance:Che,ascending:UL,descending:Rhe},kl=(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=bc}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=-DL(this.a,this.b,this.c)},e.chainCrossingSign=function(n){var r=DL(this.a,this.b,n);return this.acb===-r&&r!==Hf?(this.c=n,this.acb=-r,Ul):this._crossingSign(n,r)},e.edgeOrVertexChainCrossing=function(n){var r=We.fromVector(this.c.vector);switch(this.chainCrossingSign(n)){case Ul:return!1;case bc:return!0}return mH(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,Ul;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,fT;if(this.a.equals(this.b)||this.c.equals(n))return this.c=n,this.acb=-r,Ul;if(this.acb===Hf&&(this.acb=-NL(this.a,this.b,this.c)),r===Hf&&(r=NL(this.a,this.b,n)),r!==this.acb)return this.c=n,this.acb=-r,Ul;var o=-Vm(this.c,n,this.b);if(o!==this.acb)return this.c=n,this.acb=-r,Ul;var a=Vm(this.c,n,this.a);return a!==this.acb?(this.c=n,this.acb=-r,Ul):(this.c=n,this.acb=-r,bc)},i})(),bc=0,fT=1,Ul=2,pH=function(e,t,n,r){var s=kl.newChainEdgeCrosser(e,t,n);return s.chainCrossingSign(r)},mH=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},Phe=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(vc(n.lat),vc(n.lat)),new eo(vc(n.lng),vc(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(vc(n.lat)),this.lng.addPoint(vc(n.lng))):this},e.expanded=function(n){var r=this.lat.expanded(vc(n.lat)),s=this.lng.expanded(vc(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 dp.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=dp.fromCenterAngle(new We(0,0,n),r);if(ap(this.lng.hi-this.lng.lo,2*Math.PI)>=0&&this.lng.hi-this.lng.lo<2*Math.PI){var o=dp.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(vc(n.lat))&&this.lng.contains(vc(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(iy(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)&&Mq(f,d,this.lat,this.lng.lo)||u.contains(this.lng.hi)&&Mq(f,d,this.lat,this.lng.hi)||Eq(f,d,this.lat.lo,this.lng)||Eq(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 Eq=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(vc(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},Mq=function(e,t,n,r){return pH(e,t,We.fromLatLng(new ar(n.lo,r)),We.fromLatLng(new ar(n.hi,r)))===bc},tD=(function(){function i(t,n){this.dim=t,this.deriv=n}var e=i.prototype;return e.value=function(n){return RL(this.deriv,-this.dim*n)},e.minLevel=function(n){if(n<=0)return _i;var r=-(vq(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=vq(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})(),kL=new tD(1,2*Math.SQRT2/3),Lhe=new tD(1,1.4592137463861061),zL=new tD(2,4*Math.PI/6),Dhe=function(e,t,n){return aT(nD(e,t,n,0,!0).dist)},su=function(e,t,n,r){return nD(e,t,n,r,!1)},Cq=function(e,t,n,r){var s=FL(We.chordAngleBetweenPoints(e,t),We.chordAngleBetweenPoints(e,n));if(s>b1){var o=nD(We.fromVector(e.vector.mul(-1)),t,n,s,!0);s=o.dist,s=xc-s}return r<s?{dist:s,less:!0}:{dist:r,less:!1}},AH=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 LL(r,t,We.fromVector(s))&&LL(We.fromVector(s),n,r)?We.fromVector(s.normalize()):e.vector.sub(t.vector).norm2()<=e.vector.sub(n.vector).norm2()?t:n},gH=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())},Nhe=function(e){return Math.max(Fhe(e),XL(e))},Fhe=function(e){if(e>=b1)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},nD=function(e,t,n,r,s){var o=Bhe(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}},Bhe=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}},Rq=We.fromCoords(1,0,0),dp=(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,iT(r))},i.fromCenterChordAngle=function(n,r){return new i(n,r)},i.fromCenterHeight=function(n,r){return i.fromCenterChordAngle(n,IL(2*r))},i.fromCenterArea=function(n,r){return i.fromCenterChordAngle(n,IL(r/Math.PI))},i.fromCap=function(n){return new i(We.fromVector(n.center.vector),n.rad)},i.emptyCap=function(){return i.fromCenterChordAngle(Rq,oT)},i.fullCap=function(){return i.fromCenterChordAngle(Rq,xc)};var e=i.prototype;return e.isValid=function(){return this.center.vector.isUnit()&&this.rad<=xc},e.isEmpty=function(){return this.rad<0},e.isFull=function(){return this.rad==xc},e.centerPoint=function(){return this.center},e.height=function(){return .5*this.rad},e.radius=function(){return aT(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>=Gx(We.chordAngleBetweenPoints(this.center,n.center),n.rad)},e.intersects=function(n){return this.isEmpty()||n.isEmpty()?!1:Gx(this.rad,n.rad)>=We.chordAngleBetweenPoints(this.center,n.center)},e.interiorIntersects=function(n){return this.rad<=0||n.isEmpty()?!1:Gx(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>=b1||this.isEmpty())return!1;if(n.containsPoint(this.center))return!0;for(var s=Qq(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)),Yue(xc,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=Zue(this.rad),l=Math.cos(ar.latitude(this.center));if(a<=l){var c=Math.asin(a/l);o.lo=ap(ar.longitude(this.center)-c,Math.PI*2),o.hi=ap(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=Gx(We.chordAngleBetweenPoints(this.center,n.center),n.rad),s=AT(r,Ki*r);return s>this.rad&&(this.rad=s),this},e.expanded=function(n){return this.isEmpty()?i.emptyCap():i.fromCenterChordAngle(this.center,Gx(this.rad,iT(n)))},e.toString=function(){return"[Center="+this.center.vector+", Radius="+Zq(this.radius())+"]"},i.radiusToHeight=function(n){return n<0?oT:n>=Math.PI?b1:.5*iT(n)},e.cellUnionBound=function(){var n=kL.maxLevel(this.radius())-1;if(n<0){for(var r=[],s=0;s<6;s++)r[s]=pp(s);return r}return hH(R1(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=gH(.5*(l-o+a),r.center,n.center);return i.fromCenterAngle(u,c)},i})(),VL=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=Ohe(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)))))},Ohe=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},Uhe=function(e,t,n){return Vm(e,t,n)*VL(e,t,n)},Iq=function(e,t,n){var r=e.pointCross(t).vector.angle(t.pointCross(n).vector);return Vm(e,t,n)===M1?r:-r},Pq=Math.asin(Math.sqrt(1/3))-.5*Ki,Ca=(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=gp(n),s=r.f,o=r.i,a=r.j,l=r.orientation,c=to(n);return new i(s,c,l,n,gT(o,a,c))},i.fromPoint=function(n){return i.fromCellID(R1(n))},i.fromLatLng=function(n){return i.fromCellID(lH(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 Ma(this.level)},e.sizeST=function(){return cH(this.level)},e.vertex=function(n){var r=this.uv.vertices()[n];return We.fromVector(ih(this.face,r.x,r.y).normalize())},e.edge=function(n){switch(n){case 0:return We.fromVector(wq(this.face,this.uv.y.lo).normalize());case 1:return We.fromVector(bq(this.face,this.uv.x.hi).normalize());case 2:return We.fromVector(wq(this.face,this.uv.y.hi).mul(-1).normalize());default:return We.fromVector(bq(this.face,this.uv.x.lo).mul(-1).normalize())}},e.boundUV=function(){return this.uv},e.center=function(){return We.fromVector(iy(this.id).normalize())},e.children=function(){var n=[];if(KL(this.id))return n;for(var r=uH(this.id),s=eD(this.id),o=0;o<4;o++){var a=new i(this.face,this.level+1,this.orientation^g1[o],s,qr.empty()),l=$L[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=Ra(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 VL(n,r,s)+VL(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 zL.value(this.level)},e.intersectsCell=function(n){return aH(this.id,n.id)},e.containsCell=function(n){return Gm(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(ih(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(ih(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;nhe(this.face).z===0?s=n<0?1:0:s=n>0?1:0,ihe(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(Pq,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,-Pq),eo.fullInterval())}return c.expanded(new ar(Ki,0))},e.capBound=function(){for(var n=dp.fromPoint(We.fromVector(ih(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=Jue(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 IL(s+o*o)},e.distanceInternal=function(n,r){var s=We.fromVector(fp(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:xL(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)):xL(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(fp(this.face,n.vector)),s=FL(this.vertexChordDist2(r,!1,!1),this.vertexChordDist2(r,!0,!1),this.vertexChordDist2(r,!1,!0),this.vertexChordDist2(r,!0,!0));return s<=b1?s:xc-this.distance(We.fromVector(n.vector.mul(-1)))},e.boundaryDistance=function(n){return this.distanceInternal(n,!1)},e.distanceToEdge=function(n,r){var s=xL(this.distance(n),this.distance(r));if(s===0)return s;for(var o=kl.newChainEdgeCrosser(n,r,this.vertex(3)),a=0;a<4;a++)if(o.chainCrossingSign(this.vertex(a))!==Ul)return 0;for(var l=0;l<4;l++)s=su(this.vertex(l),n,r,s).dist;return s},e.maxDistanceToEdge=function(n,r){var s=FL(this.maxDistance(n),this.maxDistance(r));return s<=b1?s:xc-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=Sc(),l=0;l<4;l++)for(var c=0;c<4;c++)a=su(r[l],s[c],s[c+1&3],a).dist,a=su(s[l],r[c],r[c+1&3],a).dist;return a},e.maxDistanceToCell=function(n){var r=new qr(n.uv.y,n.uv.x);if(this.face===i.oppositeFace(n.face)&&this.uv.intersects(r))return xc;for(var s=[],o=[],a=0;a<4;a++)s.push(this.vertex(a)),o.push(n.vertex(a));for(var l=oT,c=0;c<4;c++)for(var u=0;u<4;u++)l=Cq(s[c],o[u],o[u+1&3],l).dist,l=Cq(o[c],s[u],s[u+1&3],l).dist;return l},i})(),A1=-1,vH=(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===A1},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:A1,parent:-1}}var e=i.prototype;return e.clear=function(){this.prevStartID=0n,this.nodeCutoff=-1,this.nextNodeCutoff=-1,this.node.label=A1},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=A1):this.node=sT({},this.cellTree[this.node.parent])},e.done=function(){return this.node.label===A1},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=A1:this.node=sT({},this.cellTree[r]),this.nextNodeCutoff=r},i})(),khe=(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:Ra(Gi(o.cellID)),cellID:ul,label:-1})}n.push({startID:ry(pp(0),_i),cellID:0n,label:-1}),n.push({startID:vT(pp(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===ul&&(a=this.cellTree[a].parent),l++;this.rangeNodes.push({startID:c,contents:a})}},i})(),S1=(function(i){function e(){return i.apply(this,arguments)||this}Jx(e,i),e.fromRange=function(r,s){for(var o=new e,a=OL(r,s);a!==s;a=OL(Ra(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=Xx(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(!Zx(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(!Zx(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(UL);for(var r=[],s=Ct(this),o;!(o=s()).done;){var a=o.value;if(!(r.length>0&&Gm(r[r.length-1],a))){for(var l=r.length-1;l>=0&&Gm(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=ZL(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=vT(c,f),A=ry(c,f);A!==d;A=Ra(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(Ca.fromCellID(a).rectBound())}return r},t.capBound=function(){if(this.length===0)return dp.emptyCap();for(var r=new We(0,0,0),s=Ct(this),o;!(o=s()).done;){var a=o.value,l=zL.value(to(a));r=We.fromVector(r.vector.add(JL(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=dp.fromPoint(r),u=Ct(this),f;!(f=u()).done;){var d=f.value;c=c.addCap(Ca.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(Ca.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=os(a)<<1n;l=~(l+(l<<1n));var c=a&l;return(r&l)===c&&(s&l)===c&&(o&l)===c&&!ty(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(C1(r)),a;!(a=o()).done;){var l=a.value;this.cellUnionDifferenceInternal(l,s)}},t.expandAtLevel=function(r){for(var s=new e,o=Hm(r),a=this.length-1;a>=0;a--){var l=this[a];if(os(l)<o)for(l=wr(l,r);a>0&&Gm(l,this[a-1]);)a--;s.push(l),s.push.apply(s,oH(l,r))}s.sort(UL),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=kL.maxLevel(r);u===0&&r>kL.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 zL.value(_i)*Number(this.leafCellsCovered())},t.approxArea=function(){for(var r=0,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=Ca.fromCellID(a).approxArea()}return r},t.exactArea=function(){for(var r=0,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=Ca.fromCellID(a).exactArea()}return r},e})(y1(Array)),rh=(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})(),x1=function(e,t){this.start=e,this.length=t},_T=function(e,t){this.chainID=e,this.offset=t},zhe=function(e,t){this.point=e,this.contained=t},xT=function(e){return new zhe(We.originPoint(),e)},xH=0,Vhe=1,Ghe=2,qhe=function(e){return e.numEdges()===0&&(e.dimension()!==2||e.numChains()===0)},Hhe=function(e){return e.numEdges()===0&&e.dimension()===2&&e.numChains()>0},Hx=(function(){function i(){}var e=i.prototype;return e.numEdges=function(){return 0},e.edge=function(n){return new rh(We.originPoint(),We.originPoint())},e.referencePoint=function(){return xT(!1)},e.numChains=function(){return 0},e.chain=function(n){return new x1(0,0)},e.chainEdge=function(n,r){return new rh(We.originPoint(),We.originPoint())},e.chainPosition=function(n){return new _T(0,0)},e.dimension=function(){return-1},e.isEmpty=function(){return!0},e.isFull=function(){return!1},e.typeTag=function(){return xH},e.privateInterface=function(){},i})(),Lq=(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})(),yH=(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})(),Whe=(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 yH},i})(),yL=(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 yH},i})(),GL=0,bH=0,bL=(function(){function i(t,n){if(this.index=t,this.position=0,this.id=ul,this.cell=new yL,n!==void 0)switch(n){case GL:this.begin();break;case bH: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 JL(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===ul},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 yL):(this.id=ul,this.cell=new yL)},e.seek=function(n){var r=this;this.position=BL(this.index.cells.length,function(s){return r.index.cells[s]>=n}),this.refresh()},e.locatePoint=function(n){var r=R1(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 Ap;if(this.cellID()<=Gi(n))return oy}return this.prev()&&Gi(this.cellID())>=n?Ap:yT},i})(),jhe=(function(){function i(){this.isActive=!1,this.a=this.b=i.trackerOrigin(),this.nextCellID=ry(pp(0),_i),this.crosser=null,this.shapeIDs=[],this.savedIDs=[],this.drawTo(We.fromVector(ih(0,-1,-1).normalize()))}i.trackerOrigin=function(){return We.fromVector(ih(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 kl(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})(),jf=1,Dq=2,mp=(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!==Dq)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 kl(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!==Ul){if(R===fT){if(this.model!==jf&&(T.v0.equals(s)||T.v1.equals(s)))return this.model===Dq;mH(A.a,A.b,T.v0,T.v1)?R=bc:R=Ul}o=o!==(R===bc)}}return o},e.shapeContains=function(n,r){if(!n||n instanceof Hx||!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})(),Xhe=(function(){function i(t,n){n===void 0&&(n=new mp(t,jf)),this.index=t,this.containsQuery=n,this.iter=t.iterator()}var e=i.prototype;return e.capBound=function(){var n=Xx(S1,this.cellUnionBound());return n.capBound()},e.rectBound=function(){var n=Xx(S1,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=Kx(this.iter.cellID(),r),o=s[0];o===void 0&&(o=-1),o++;for(var a=wr(r,o),l=wr(this.iter.cellID(),o);l!=a;l=Ra(l))if(!(Gi(l)<this.iter.cellID())){var c=this.iter.cellID();this.iter.seek(Ra(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=Kx(n,r),a=o[0],l=o[1];return l||s.concat([0n]),s.concat([wr(n,a)])},i})(),$he=2.25*Ki,Yhe=3*Ki,sy=9*(1/Math.SQRT2)*Ki,wH=3*Math.SQRT2*Ki,Zhe=function(e,t,n){return Qx(e,t,n,0)},Qx=function(e,t,n,r){if(Yx(e.vector)===n&&Yx(t.vector)===n){var s=qm(n,e.vector),o=s[0],a=s[1],l=qm(n,t.vector),c=l[0],u=l[1];return[new Ci(o,a),new Ci(c,u),!0]}var f=new _c(fp(n,e.pointCross(t).vector)),d=new _c(fp(n,e.vector)),A=new _c(fp(n,t.vector)),y=1+r,w=new _c(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)))<RL(1,-511)&&(f=new _c(We.fromVector(f.vector.mul(RL(1,563)))));var S=new _c(We.fromVector(f.vector.normalize())),T=new _c(We.fromVector(S.vector.cross(d.vector))),R=new _c(We.fromVector(A.vector.cross(S.vector))),P=Nq(A,d,new _c(We.fromVector(w.vector.mul(-1))),R,T,y),I=P[0],F=P[1],D=Nq(d,A,w,T,R,y),L=D[0],C=D[1];return[I,L,F+C<3]},Khe=function(e,t,n){return e+t===n&&e===n-t&&t===n-e},wL=0,qL=1,_c=(function(i){function e(n){return i.call(this,n.x,n.y,n.z)||this}Jx(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)?qL: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?qL: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),Nq=function(e,t,n,r,s,o){var a=1-sy;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 _c(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]},Fq=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])},Bq=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=Fq(o,a,T1(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=Fq(o,!a,T1(l.hi,e,t,r,s));if(o=f[0],c=f[1],!c)return[n,o,!1]}return[n,o,!0]},SH=function(e,t,n){if(!n.intersects(qr.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},Qhe=function(e,t,n){var r=qr.fromPoints(e,t),s=Jhe(e,t,n,r),o=s[0],a=s[1];return a?o:qr.empty()},Jhe=function(e,t,n,r){var s=e.x>t.x!=e.y>t.y,o=Bq(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=Bq(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 qr(d,f),!0]:[new qr(a,l),!1]},T1=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)},efe=(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})(),tfe=function(e,t){var n=new efe(0,new Ci(0,0),new Ci(0,0)),r=lT(e.vector),s=r[0],o=r[1],a=r[2],l=lT(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=Oq(s,e,d,n.a),y=A[0],w=A[1],S=Oq(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=fp(F,d.vector),L=new _c(D),C=L.exitAxis();n.b=L.exitPoint(C),P.push(n.clone());var B=ih(F,n.b.x,n.b.y);F=nfe(F,n.b,C,L,T);var k=fp(F,B);n.face=F,n.a=new Ci(k.x,k.y)}return n.b=I,P.push(n),P},Oq=function(e,t,n,r){var s=1-sy;if(Math.max(Math.abs(r.x),Math.abs(r.y))<=s)return[e,r];var o=fp(e,n.vector),a=new _c(o);if(a.intersectsFace()){var l=a.exitPoint(a.exitAxis()),c=ih(e,l.x,l.y),u=n.vector.normalize().cross(t.vector);if(c.sub(t.vector).dot(u)>=-Yhe)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=qm(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]},nfe=function(e,t,n,r,s){var o=t.x,a=t.y;n==qL&&(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&&Khe(t.x*r.x,t.y*r.y,-r.z)?s:cT(e,n,l)},nT=1,Uq=(function(){function i(t){this.rangeMin=ul,this.rangeMax=ul,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(Ra(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})(),ife=function(e,t){if(e.dimension()!==2)return!1;var n=e.referencePoint();if(n.point===t)return n.contained;for(var r=new kl(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},Ea=(function(){function i(){this.id=0n,this.padding=0,this.boundRect=qr.empty(),this.middleRect=qr.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=qr.empty(),ty(n)){var o=r+1;return s.boundRect=new qr(new Li(-o,o),new Li(-o,o)),s.middleRect=new qr(new Li(-r,r),new Li(-r,r)),s.orientation=ru(n)&1,s}var a=gp(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=gT(l,c,s.level).expandedByMargin(r);var f=Ma(s.level);return s.iLo&=-f,s.jLo&=-f,s},i.fromParentIJ=function(n,r,s){var o=Kue[n.orientation][2*r+s],a=new i;a.id=C1(n.id)[o],a.padding=n.padding,a.boundRect=qr.fromRect(n.boundRect),a.orientation=n.orientation^g1[o],a.level=n.level+1,a.middleRect=qr.empty();var l=Ma(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=Ma(this.level),r=2*this.iLo+n,s=2*this.jLo+n;return We.fromVector(rT(ru(this.id),r,s).normalize())},e.middle=function(){if(this.middleRect.isEmpty()){var n=Ma(this.level),r=yc(cp(2*this.iLo+n)),s=yc(cp(2*this.jLo+n));this.middleRect=new qr(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=$L[this.orientation][n];return[r>>1,r&1]},e.entryVertex=function(){var n=this.iLo,r=this.jLo;if(this.orientation&Wf){var s=Ma(this.level);n+=s,r+=s}return We.fromVector(rT(ru(this.id),2*n,2*r).normalize())},e.exitVertex=function(){var n=this.iLo,r=this.jLo,s=Ma(this.level);return this.orientation===0||this.orientation===wc+Wf?n+=s:r+=s,We.fromVector(rT(ru(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=Ma(this.level);if(n.x.contains(yc(cp(2*this.iLo+r)))||n.y.contains(yc(cp(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<Ol(nh(s.x.lo))&&(o=Ol(nh(s.x.lo))),this.iLo+r-1<=Ol(nh(s.x.hi))?l=o^this.iLo+r-1:l=o^Ol(nh(s.x.hi)),a<Ol(nh(s.y.lo))&&(a=Ol(nh(s.y.lo))),this.jLo+r-1<=Ol(nh(s.y.hi))?c=a^this.jLo+r-1:c=a^Ol(nh(s.y.hi));var u=BigInt((l|c)<<1)+1n,f=_i-Yq(u);return f<=this.level?this.id:wr(ny(ru(this.id),o,a),f)},i})(),Ap=0,oy=1,yT=2,kq=0,qx=2,p1=2*(sy+$he),rfe=1,zq=(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 rh(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 rh(We.fromVector(this.edge.v0.vector),We.fromVector(this.edge.v1.vector)))},i})(),SL=function(e,t){this.faceEdge=e,this.bound=t},dT=(function(){function i(){var t=this;this.iterator=function(){return t.maybeApplyUpdates(),new bL(t,GL)},this.begin=function(){return t.maybeApplyUpdates(),new bL(t,GL)},this.end=function(){return t.maybeApplyUpdates(),new bL(t,bH)},this.region=function(){return new Xhe(t,new mp(t,jf))},this.len=function(){return t.shapes.size},this.reset=function(){t.shapes.clear(),t.nextID=0,t.cellMap.clear(),t.cells=[],t.status=qx},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 Hx)&&(r+=o.numEdges(),r>=n))break}return r},this.shape=function(n){return t.shapes.get(n)||new Hx},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=kq,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 sfe(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=kq}},this.build=function(){return t.maybeApplyUpdates()},this.isFresh=function(){return t.status===qx},this.isFirstUpdate=function(){return t.pendingAdditionsPos===0},this.isShapeBeingRemoved=function(n){return n<t.pendingAdditionsPos},this.maybeApplyUpdates=function(){t.status!==qx&&(t.applyUpdatesInternal(),t.status=qx)},this.applyUpdatesInternal=function(){for(var n=new jhe,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 Hx;if(!(o instanceof Hx)){var a=new zq(n,void 0,void 0,o.dimension()===2);a.hasInterior&&s.addShape(n,ife(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=Vq(u),t.addFaceEdge(a,r)}}},this.addFaceEdge=function(n,r){var s=n.copy(),o=Yx(s.edge.v0.vector);if(o===Yx(s.edge.v1.vector)){var a=qm(o,s.edge.v0.vector),l=a[0],c=a[1];s.a=new Ci(l,c);var u=qm(o,s.edge.v1.vector);l=u[0],c=u[1],s.b=new Ci(l,c);var f=1-p1;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=Qx(s.edge.v0,s.edge.v1,d,p1),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=qr.empty(),c=0;c<o;c++){var u=new SL(r[c],qr.fromPoints(r[c].a,r[c].b));a[c]=u,l=l.addRect(u.bound)}var f=pp(n),d=Ea.fromCellID(f,p1),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=Ea.fromCellID(y,p1),t.updateEdges(d,a,s,A),t.skipCellRange(Ra(Gi(y)),Ra(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)===Ap&&(s=o.cellID())}return s},this.skipCellRange=function(n,r,s,o){if(s.shapeIDs.length!==0)for(var a=S1.fromRange(n,r),l=Ct(a),c;!(c=l()).done;){var u=c.value,f=[];t.updateEdges(Ea.fromCellID(u,p1),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===yT?o=!0:c===Ap&&(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(Ea.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 Whe(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 Lq(R,0),S.containsCenter=!0,y++;else{for(;A<r.length&&r[A].faceEdge.shapeID===T;)A++;S=new Lq(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(Ra(n.id))),!0},this.updateBound=function(n,r,s,o,a){var l=new SL(n.faceEdge,new qr);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(T1(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(T1(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(Ra(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 zq(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=Vq(I.edge),I.hasInterior&&o.testEdge(T,I.edge);var L=Qx(I.edge.v0,I.edge.v1,ru(n.id),p1),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 SL(H,Qhe(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=qx,this.pendingAdditionsPos=0,this.pendingRemovals=[]}var e=i.prototype;return e.removeShapeInternal=function(n,r,s){},i})(),Vq=function(e){var t=e.v0.vector.sub(e.v1.vector).norm()*rfe;return Lhe.minLevel(t)},sfe=function(e,t,n,r){this.shapeID=e,this.hasInterior=t,this.containsTrackerOrigin=n,this.edges=r};function ofe(){return{distance:Sc(),shapeID:-1,edgeID:-1}}function TL(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 TH=(function(){function i(){this.maxResults=1/0,this.maxDistance=Sc(),this.maxError=0,this.includeInteriors=!0,this.useBruteForce=!1}var e=i.prototype;return e.setInclusiveMaxDistance=function(n){this.maxDistance=w1(n)},e.setConservativeMaxDistance=function(n){this.maxDistance=w1(AT(n,Nhe(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})(),afe=(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=su(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 mp(n,jf);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})(),lfe=(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 MH(this.a,this.b,n,r,s)},e.updateMinDistanceToPoint=function(n,r){var s=su(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 mp(n,jf),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})(),cfe=(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 mp(n,jf),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})(),EH=(function(){function i(t){this._includeInteriors=!0,this.index=t,this.query=new mp(t,jf)}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=MH(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=su(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 mp(n,jf),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 MH(i,e,t,n,r){if(r===0)return{distance:0,updated:!1};if(pH(i,e,t,n)===bc)return{distance:0,updated:!0};var s=!1,o=su(i,t,n,r);return o.less&&(r=o.dist,s=!0),o=su(e,t,n,r),o.less&&(r=o.dist,s=!0),o=su(t,i,e,r),o.less&&(r=o.dist,s=!0),o=su(n,i,e,r),o.less&&(r=o.dist,s=!0),{distance:r,updated:s}}var ufe=(function(){function i(t,n){n===void 0&&(n=new TH),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?ofe():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=xc;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=xc;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=xc;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 AH(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(TL);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(TL),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=Ca.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=C1(y.id),S=Ct(w),T;!(T=S()).done;){var R=T.value,P=this.iter.locateCellID(R);if(P===Ap){var I=Ca.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===oy){var D=Ca.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(TL),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:Sc(),cellID:0n,label:-1}}function ffe(i){return i.label<0}var CH=(function(){function i(){this.maxResults=1/0,this.maxDistance=Sc(),this.maxError=0}var e=i.prototype;return e.setInclusiveMaxDistance=function(n){this.maxDistance=w1(n)},e.setConservativeMaxDistance=function(n){this.maxDistance=w1(AT(n,this.computeMaxDistanceError(n)))},e.computeMaxDistanceError=function(n){return XL(n)},i})(),dfe=(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})(),pfe=(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 su(n,this.a,this.b,Sc()).dist},i})(),mfe=(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})(),Afe=(function(){function i(t){this.cellUnion=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){for(var r=Sc(),s=Ct(this.cellUnion),o;!(o=s()).done;){var a=o.value,l=Ca.fromCellID(a),c=l.distanceToCell(n);if(c<r&&(r=c),r===0)break}return r},e.distanceToPoint=function(n){for(var r=Sc(),s=Ct(this.cellUnion),o;!(o=s()).done;){var a=o.value,l=Ca.fromCellID(a),c=l.distance(n);if(c<r&&(r=c),r===0)break}return r},i})(),gfe=(function(){function i(t){this.index=t,this.edgeTarget=new EH(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,Sc());return r.distance},e.distanceToPoint=function(n){var r=this.edgeTarget.updateMinDistanceToPoint(n,Sc());return r.distance},i})(),vfe=(function(){function i(t,n){n===void 0&&(n=new CH),this.index=t,this.options=n}var e=i.prototype;return e.findClosestCells=function(n){var r=new vH(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=Ca.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,!ffe(a)},e.isDistanceLessOrEqual=function(n,r){return this.isDistanceLess(n,w1(r))},e.isConservativeDistanceLessOrEqual=function(n,r){return this.isDistanceLess(n,w1(AT(r,XL(r))))},i})(),E1=(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})();E1.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 RH=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))},xfe=(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 kl(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===nT&&(A===fT||A===bc)||o!==nT&&A===bc)&&(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 kl(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===nT&&(y===fT||y===bc)||s!==nT&&y===bc)&&(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 yfe;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=Zhe(n,r,ru(s.id)),a=o[0],l=o[1],c=o[2];if(c){this.a=a,this.b=l;var u=qr.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=tfe(n,r),o=Ct(s),a;!(a=o()).done;){var l=a.value;this.a=l.a,this.b=l.b;var c=qr.fromPoints(this.a,this.b),u=Ea.fromCellID(pp(l.face),0),f=u.shrinkToFit(c),d=this.iter.locateCellID(f);d===Ap?this.cells.push(this.iter.indexCell()):d===oy&&(ty(f)||(u=Ea.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(Ea.fromParentIJ(n,0,0),o[0]),this.computeCellsIntersected(Ea.fromParentIJ(n,1,0),o[1])):r.y.lo>=s.y?(this.computeCellsIntersected(Ea.fromParentIJ(n,0,1),o[0]),this.computeCellsIntersected(Ea.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(Ea.fromParentIJ(o,s,0),n);else if(n.y.lo>=r)this.computeCellsIntersected(Ea.fromParentIJ(o,s,1),n);else{var a=this.splitVBound(n,r);this.computeCellsIntersected(Ea.fromParentIJ(o,s,0),a[0]),this.computeCellsIntersected(Ea.fromParentIJ(o,s,1),a[1])}},e.splitUBound=function(n,r){var s=n.y.clampPoint(T1(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(T1(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=[qr.fromRect(n),qr.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})(),yfe=(function(i){function e(){return i.apply(this,arguments)||this}return Jx(e,i),e})(y1(Map)),bfe=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))},Gq=new We(0,0,1),qq=new We(0,0,-1),HL=(function(){function i(t){this.originInside=!1,this.depth=0,this.bound=Ri.emptyRect(),this.subregionBound=Ri.emptyRect(),this.vertices=t,this.index=new dT,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([Gq])},i.fullLoop=function(){return new i([qq])};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]&&Phe(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 E1,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=E1.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 wfe;return EL(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 Sfe;return EL(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 Tfe(n.isHole());return EL(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 xT(this.originInside)},e.numEdges=function(){return this.isEmptyOrFull()?0:this.vertices.length},e.edge=function(n){return new rh(this.vertex(n),this.vertex(n+1))},e.numChains=function(){return this.isEmpty()?0:1},e.chain=function(n){return new x1(0,this.numEdges())},e.chainEdge=function(n,r){return new rh(this.vertex(r),this.vertex(r+1))},e.chainPosition=function(n){return new _T(0,n)},e.dimension=function(){return 2},e.typeTag=function(){return xH},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=kl.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!==Ap||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===yT?!1:s===oy||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=sy+wH,a=r.boundUV().expandedByMargin(o),l=Ct(s.edges),c;!(c=l()).done;){var u=c.value,f=Qx(this.vertex(u),this.vertex(u+1),r.face,o),d=f[0],A=f[1],y=f[2];if(y&&SH(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 kl(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(YL(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=Iq(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=Iq(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()?Gq:qq;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?RH(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(Uhe),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(bfe)},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?PH(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===IH||e.containsCenter&&t===mT},EL=function(e,t,n){for(var r=new Uq(e.index),s=new Uq(t.index),o=new Wq(e,t,n,!1),a=new Wq(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=os(r.it.cellID())-os(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},Hq=0,IH=1,mT=2,wfe=(function(){function i(){this.foundSharedVertex=!1}var e=i.prototype;return e.aCrossingTarget=function(){return IH},e.bCrossingTarget=function(){return mT},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,!RH(n,r,s,o,a)},i})(),Sfe=(function(){function i(){this.foundSharedVertex=!1}var e=i.prototype;return e.aCrossingTarget=function(){return mT},e.bCrossingTarget=function(){return mT},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,_fe(n,r,s,o,a)},i})(),Tfe=(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 Hq},e.bCrossingTarget=function(){return Hq},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,PH(n,r,s,a,this.reverse)?this.containsEdge=!0:this.excludesEdge=!0,this.containsEdge&&this.excludesEdge},i})(),PH=function(e,t,n,r,s){return r.equals(e)||r.equals(n)?r.equals(e)===s:We.orderedCCW(e,n,r,t)},Wq=(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 xfe(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 kl(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!==Ul){if(c===bc)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=Ea.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})(),Efe=(function(){function i(t){var n=this;if(t===void 0&&(t=[]),this.loops=[],this.index=new dT,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([HL.fromCell(n)])},e.initNested=function(){if(this.loops.length===1){this.initOneLoop();return}var n=new Mfe;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=E1.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=E1.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 dT,this.index.add(this)}},i.fullPolygon=function(){var n=HL.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 mp(this.index,jf).contains(n)},e.containsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s!==Ap||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===yT?!1:s===oy||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=sy+wH,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=Qx(f.v0,f.v1,r.face,o),A=d[0],y=d[1],w=d[2];if(w&&SH(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 kl(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 rh(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 xT(n)},e.numChains=function(){return this.numLoops()},e.chain=function(n){if(this.cumulativeEdges.length>0)return new x1(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 x1(r,o):new x1(r,0)},e.chainEdge=function(n,r){return new rh(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 _T(r,n)},e.dimension=function(){return 2},e.typeTag=function(){return Vhe},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})(),Mfe=(function(i){function e(){return i.apply(this,arguments)||this}Jx(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})(y1(Map)),Cfe=(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=rH),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 E1,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=kl.newChainEdgeCrosser(a[l],a[l+1&3],this.points[0]),u=1;u<this.points.length;u++)if(c.chainCrossingSign(this.points[u])!==Ul)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 rh(this.points[n],this.points[n+1])},e.referencePoint=function(){return xT(!1)},e.numChains=function(){return Math.min(1,this.numEdges())},e.chain=function(n){return new x1(0,this.numEdges())},e.chainEdge=function(n,r){return new rh(this.points[r],this.points[r+1])},e.chainPosition=function(n){return new _T(0,n)},e.dimension=function(){return 1},e.isEmpty=function(){return qhe(this)},e.isFull=function(){return Hhe(this)},e.typeTag=function(){return Ghe},e.privateInterface=function(){},i.findEndVertex=function(n,r,s){var o=n.points[s],a=YL(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=ohe(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=Dhe(n,this.points[o-1],this.points[o]);a<r&&(r=a,s=o)}var l=AH(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--,LL(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=kl.newChainEdgeCrosser(this.points[r-1],this.points[r],n.points[0]),o=1;o<n.points.length;o++)if(s.chainCrossingSign(n.points[o])!==Ul)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=gH(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})(),jq=(function(){function i(){}var e=i.prototype;return e.capBound=function(){return dp.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})(),WL=(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 LH(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=Xx(S1,n.cellUnionBound());return r.normalizeCovering(s),s},e.isCanonical=function(n){return this.coverer().isCanonical(n)},i})(),LH=(function(){function i(t,n,r,s){this.region=new jq,this.result=new S1,this.pq=new Ife,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 Wx;var r=new Rfe(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 Wx}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=fH(r.id),l=eD(r.id);l!==a;l=Ra(l)){var c=Ca.fromCellID(l);if(s>0){this.region.intersectsCell(c)&&(o+=this.expandChildren(n,c,s));continue}var u=this.newCandidate(c);u instanceof Wx||(n.children.push(u),n.numChildren++,u.terminal&&o++)}return o},e.addCandidate=function(n){if(!(n instanceof Wx)){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=wr(a,c)),!(r>0&&Gm(n[r-1],a))){for(;r>0&&Gm(a,n[r-1]);)r--;n[r]=a,r++}}n.length=r}},e.initialCandidates=function(n){var r=new WL;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(Ca.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 jq,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]=wr(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 WL,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=Kx(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=wr(n[u],f),R=this.replaceCellsWithAncestor(n,T);for(n.length=0,n.push.apply(n,R);f>this.minLevel&&(f-=this.levelMod,T=wr(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(!Zx(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=Kx(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)||wr(u,w)!==wr(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=ry(r,o);a!==vT(r,o);a=Ra(a)){if(s===-1||n[s]!==a)return!1;s++}return!0},e.replaceCellsWithAncestor=function(n,r){var s=BL(n.length,function(a){return n[a]>qi(r)}),o=BL(n.length,function(a){return n[a]>Gi(r)});return[].concat(n.slice(0,s),[r],n.slice(o))},i})(),Rfe=function(e){this.terminal=!1,this.numChildren=0,this.children=[],this.priority=0,this.cell=e},Wx=function(){this.cell=Ca.fromCellID(ul),this.terminal=!1,this.numChildren=0,this.children=[],this.priority=0},Ife=(function(i){function e(){return i.apply(this,arguments)||this}Jx(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 Wx},t.reset=function(){this.length=0},e.ascending=function(r,s){return r.priority<s.priority?-1:r.priority>s.priority?1:0},e})(y1(Array)),Gn={__proto__:null,cellid:Ihe,Cap:dp,Cell:Ca,CellIndex:khe,CellIndexRangeIterator:vH,CellIndexContentsIterator:_H,CellUnion:S1,ClosestCellQuery:vfe,ClosestCellQueryOptions:CH,PointTarget:dfe,EdgeTarget:pfe,CellTarget:mfe,CellUnionTarget:Afe,ShapeIndexTarget:gfe,ClosestEdgeQuery:ufe,ClosestEdgeQueryOptions:TH,EdgeQueryPointTarget:afe,EdgeQueryEdgeTarget:lfe,EdgeQueryCellTarget:cfe,EdgeQueryShapeIndexTarget:EH,LatLng:ar,Loop:HL,Point:We,Polygon:Efe,Polyline:Cfe,Rect:Ri,RegionCoverer:WL,Coverer:LH,ShapeIndex:dT};function sh(i){let e=i.attrs?.["atlas.render.as"];return e||(i.displayType==="text"?"text":"pin")}function bT(i){return i?.attrs?.["atlas.geometry.surface"]||"plane"}function iD(i){let e=oh(i);return e||Pfe(i)}function Pfe(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 oh(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 ay=10,DH=i=>i+1,NH=i=>Gn.cellid.level(Gn.cellid.fromToken(i)),rD={map:null,mapping:null};function wT(){return rD.map!==U.map&&(rD={map:U.map,mapping:iD(U.map)}),rD.mapping}function Lfe(i){let e=wT();if(!e)return null;let[t,n]=e.toLatLng(i[0],-i[1]);return Gn.LatLng.fromDegrees(t,n)}function FH(i){let e=Gn.LatLng.fromPoint(i);return[e.lat*180/Math.PI,e.lng*180/Math.PI]}var BH=new WeakMap;function sD(i){let e=wT();if(!e)return 0n;let t=BH.get(i);if(t&&t.mapping===e)return t.leaf;let n=Lfe(i),r=n?Gn.cellid.fromLatLng(n):0n;return typeof i=="object"&&BH.set(i,{mapping:e,leaf:r}),r}var OH={slug:"s2",name:"S2",short:"S2",appliesTo(i){return bT(i)==="sphere"&&iD(i)!==null},maxLevel(){return DH(ay)},inputLength(){return 6},level(i){return i===""?0:DH(NH(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),sD(e))},descendTarget(i,e){let t=sD(e);if(t===0n)return"";let n=i===""?0:NH(i)+1;return n>ay?"":Gn.cellid.toToken(Gn.cellid.parent(t,n))},bbox(i){if(i==="")return qf();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=wT(),[t,n]=FH(Gn.Cell.fromCellID(Gn.cellid.fromToken(i)).center()),[r,s]=e.toWorld(t,n);return[r,-s]},ring(i){let e=wT(),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=qf(),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]=FH(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)%Gf.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)>ay?Gn.cellid.toToken(Gn.cellid.parent(e,ay)):Gn.cellid.toToken(e)},locate(i){let e=sD(i);return e===0n?null:{label:"S2",value:Gn.cellid.toToken(Gn.cellid.parent(e,ay))}}};function qf(){let i=U.variant?.surface;if(i)return[i.x,-(i.y+i.height),i.x+i.width,-i.y];let e=U.game?.tileGrid.size??0,t=U.variant?.bounds||{x:0,y:0,width:e,height:e};return[t.x,-(t.y+t.height),t.x+t.width,-t.y]}var kH=[gL,OH];function ly(i){return kH.filter(e=>e.appliesTo(i))}function Ss(){return kH.find(i=>i.slug===U.gridSystem)||gL}function zH(i,e,t,n){if(!t)return"";let r=i.center(t),s=UH(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=UH(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 UH([i,e,t,n]){return(t-i)*(n-e)}function VH(i,e,t){let n=i[0]===i[i.length-1]||Dfe(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 Dfe(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 oD(i){let e=Hr();for(let t=0,n=i.length;t<n;++t)Xm(e,i[t]);return e}function Nfe(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 zl(n,r,s,o,t)}function I1(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 TT(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function vp(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 ou(i,e){return cy(i,e[0],e[1])}function ah(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function cy(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function ST(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 Hr(){return[1/0,1/0,-1/0,-1/0]}function zl(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 Wm(i){return zl(1/0,1/0,-1/0,-1/0,i)}function ET(i,e){let t=i[0],n=i[1];return zl(t,n,t,n,e)}function P1(i,e,t,n,r){let s=Wm(r);return aD(s,i,e,t,n)}function jm(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function MT(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 Xm(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 aD(i,e,t,n,r){for(;t<n;t+=r)Ffe(i,e[t],e[t+1]);return i}function Ffe(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 CT(i,e){let t;return t=e(L1(i)),t||(t=e(D1(i)),t)||(t=e(N1(i)),t)||(t=e(Tc(i)),t)?t:!1}function uy(i){let e=0;return ch(i)||(e=Kn(i)*Lr(i)),e}function L1(i){return[i[0],i[1]]}function D1(i){return[i[2],i[1]]}function hl(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function GH(i,e){let t;if(e==="bottom-left")t=L1(i);else if(e==="bottom-right")t=D1(i);else if(e==="top-left")t=Tc(i);else if(e==="top-right")t=N1(i);else throw new Error("Invalid corner");return t}function hy(i,e,t,n,r){let[s,o,a,l,c,u,f,d]=lD(i,e,t,n);return zl(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 lD(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 Lr(i){return i[3]-i[1]}function lh(i,e,t){let n=t||Hr();return Dr(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]):Wm(n),n}function cD(i,e){if(!Dr(i,e))return[i.slice()];if(ah(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 Tc(i){return[i[0],i[3]]}function N1(i){return[i[2],i[3]]}function Kn(i){return i[2]-i[0]}function Dr(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function ch(i){return i[2]<i[0]||i[3]<i[1]}function qH(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function HH(i,e,t){let n=!1,r=ST(i,e),s=ST(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 WH(i,e,t,n){if(ch(i))return Wm(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 Nfe(s,o,t)}function uD(i,e){let t=e.getExtent(),n=hl(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 RT(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]]];uD(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 jH(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(...cD(t[o],e[n]));t=s}return t}var XH={info:1,warn:2,error:3,none:4},Bfe=XH.info;function IT(...i){Bfe>XH.warn||console.warn(...i)}function Si(i,e,t){return Math.min(Math.max(i,e),t)}function $H(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 au(i,e,t,n)}function au(i,e,t,n){let r=t-i,s=n-e;return r*r+s*s}function YH(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 PT(i){return i*180/Math.PI}function lu(i){return i*Math.PI/180}function uh(i,e){let t=i%e;return t*e<0?t+e:t}function Qo(i,e,t){return i+t*(e-i)}function $m(i,e){let t=Math.pow(10,e);return Math.round(i*t)/t}function fy(i,e){return Math.floor($m(i,e))}function dy(i,e){return Math.ceil($m(i,e))}function LT(i,e,t){if(i>=e&&i<t)return i;let n=t-e;return((i-e)%n+n)%n+e}function ZH(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function Ym(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 F1(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 KH(i,e){return i[0]*=e,i[1]*=e,i}function DT(i,e){if(e.canWrapX()){let t=Kn(e.getExtent()),n=QH(i,e,t);n&&(i[0]-=n*t)}return i}function QH(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 JH(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 Xf={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var hD=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_||Xf[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_}},_p=hD;var py=6378137,B1=Math.PI*py,Ofe=[-B1,-B1,B1,B1],Ufe=[-180,-85,180,85],NT=py*Math.log(Math.tan(Math.PI/2)),xp=class extends _p{constructor(e){super({code:e,units:"m",extent:Ofe,global:!0,worldExtent:Ufe,getPointResolution:function(t,n){return t/Math.cosh(n[1]/py)}})}},fD=[new xp("EPSG:3857"),new xp("EPSG:102100"),new xp("EPSG:102113"),new xp("EPSG:900913"),new xp("http://www.opengis.net/def/crs/EPSG/0/3857"),new xp("http://www.opengis.net/gml/srs/epsg.xml#3857")];function eW(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]=B1*i[s]/180;let o=py*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>NT?o=NT:o<-NT&&(o=-NT),e[s+1]=o}return e}function tW(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]/B1,e[s+1]=360*Math.atan(Math.exp(i[s+1]/py))/Math.PI-90;return e}var kfe=6378137,nW=[-180,-90,180,90],zfe=Math.PI*kfe/180,$f=class extends _p{constructor(e,t){super({code:e,units:"degrees",extent:nW,axisOrientation:t,global:!0,metersPerUnit:zfe,worldExtent:nW})}},dD=[new $f("CRS:84"),new $f("EPSG:4326","neu"),new $f("urn:ogc:def:crs:OGC:1.3:CRS84"),new $f("urn:ogc:def:crs:OGC:2:84"),new $f("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new $f("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new $f("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var pD={};function iW(i){return pD[i]||pD[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function rW(i,e){pD[i]=e}function hh(i){for(let e in i)delete i[e]}function cu(i){let e;for(e in i)return!1;return!e}var O1={};function U1(i,e,t){let n=i.getCode(),r=e.getCode();n in O1||(O1[n]={}),O1[n][r]=t}function FT(i,e){return i in O1&&e in O1[i]?O1[i][e]:null}var BT=.9996,Ec=.00669438,UT=Ec*Ec,kT=UT*Ec,Zm=Ec/(1-Ec),sW=Math.sqrt(1-Ec),k1=(1-sW)/(1+sW),cW=k1*k1,mD=cW*k1,AD=mD*k1,uW=AD*k1,hW=1-Ec/4-3*UT/64-5*kT/256,Vfe=3*Ec/8+3*UT/32+45*kT/1024,Gfe=15*UT/256+45*kT/1024,qfe=35*kT/3072,Hfe=3/2*k1-27/32*mD+269/512*uW,Wfe=21/16*cW-55/32*AD,jfe=151/96*mD-417/128*uW,Xfe=1097/512*AD,OT=6378137;function $fe(i,e,t){let n=i-5e5,o=(t.north?e:e-1e7)/BT/(OT*hW),a=o+Hfe*Math.sin(2*o)+Wfe*Math.sin(4*o)+jfe*Math.sin(6*o)+Xfe*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-Ec*c,w=Math.sqrt(1-Ec*c),S=OT/w,T=(1-Ec)/y,R=Zm*u**2,P=R*R,I=n/(S*BT),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*Zm))+B/720*(61+90*d+298*R+45*A-252*Zm-3*P),z=(I-D/6*(1+2*d+R)+C/120*(5-2*R+28*d-3*P+8*Zm+24*A))/u;return z=LT(z+lu(fW(t.number)),-Math.PI,Math.PI),[PT(z),PT(k)]}var oW=-80,aW=84,Yfe=-180,Zfe=180;function Kfe(i,e,t){i=LT(i,Yfe,Zfe),e<oW?e=oW:e>aW&&(e=aW);let n=lu(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,c=lu(i),u=fW(t.number),f=lu(u),d=OT/Math.sqrt(1-Ec*r**2),A=Zm*s**2,y=s*LT(c-f,-Math.PI,Math.PI),w=y*y,S=w*y,T=S*y,R=T*y,P=R*y,I=OT*(hW*n-Vfe*Math.sin(2*n)+Gfe*Math.sin(4*n)-qfe*Math.sin(6*n)),F=BT*d*(y+S/6*(1-a+A)+R/120*(5-18*a+l+72*A-58*Zm))+5e5,D=BT*(I+d*o*(w/2+T/24*(5-a+9*A+4*A**2)+P/720*(61-58*a+l+600*A-330*Zm)));return t.north||(D+=1e7),[F,D]}function fW(i){return(i-1)*6-180+3}var Qfe=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function dW(i){let e=0;for(let r of Qfe){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 lW(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 pW(i){return dW(i)?new _p({code:i,units:"m"}):null}function mW(i){let e=dW(i.getCode());return e?{forward:lW(Kfe,e),inverse:lW($fe,e)}:null}var Jfe=63710088e-1;function gD(i,e,t){t=t||Jfe;let n=lu(i[1]),r=lu(e[1]),s=(r-n)/2,o=lu(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 ede=[mW],tde=[pW];var _D=!0;function gW(i){_D=!(i===void 0?!0:i)}function yD(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 xD(i){rW(i.getCode(),i),U1(i,i,yD)}function nde(i){i.forEach(xD)}function Os(i){if(typeof i!="string")return i;let e=iW(i);if(e)return e;for(let t of tde){let n=t(i);if(n)return n}return null}function bD(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/Xf[n])}}else{let o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{let a=Km(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=gD(c.slice(0,2),c.slice(2,4)),f=gD(c.slice(4,6),c.slice(6,8));r=(u+f)/2}let l=n?Xf[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function AW(i){nde(i),i.forEach(function(e){i.forEach(function(t){e!==t&&U1(e,t,yD)})})}function ide(i,e,t,n){i.forEach(function(r){e.forEach(function(s){U1(r,s,t),U1(s,r,n)})})}function zT(i,e){return i?typeof i=="string"?Os(i):i:Os(e)}function vW(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 z1(i,e){if(i===e)return!0;let t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||Km(i,e)===yD)&&t}function Km(i,e){let t=i.getCode(),n=e.getCode(),r=FT(t,n);if(r)return r;let s=null,o=null;for(let l of ede)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=FT(t,a);l&&(r=vD(l,o.forward))}else{let l=FT(a,n);l&&(r=vD(s.inverse,l))}return r&&(xD(i),xD(e),U1(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 Qm(i,e){let t=Os(i),n=Os(e);return Km(t,n)}function V1(i,e,t){let n=Qm(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 _W(i,e,t,n){let r=Qm(e,t);return WH(i,r,void 0,n)}var uu=null;function Jm(){return uu}function my(i,e){return uu?V1(i,e,uu):i}function hu(i,e){return uu?V1(i,uu,e):(_D&&!Ym(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(_D=!1,IT("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i)}function yp(i,e){return uu?_W(i,e,uu):i}function fu(i,e){return uu?_W(i,uu,e):i}function xW(i,e){if(!uu)return i;let t=Os(e).getMetersPerUnit(),n=uu.getMetersPerUnit();return t&&n?i*t/n:i}function rde(){AW(fD),AW(dD),ide(dD,fD,eW,tW)}rde();function wD(i){return i[0]>0&&i[1]>0}function yW(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 as(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}var VT=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 eA(i,e,t,n,r){return r!==void 0?(r.minX=i,r.maxX=e,r.minY=t,r.maxY=n,r):new VT(i,e,t,n)}var GT=VT;function bW(i,e,t){let n,r;t=t||fl;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 fl(i,e){return i>e?1:i<e?-1:0}function wW(i,e){return i<e?1:i>e?-1:0}function G1(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 SW(i,e,t){for(;e<t;){let n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function du(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 Jo(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 TW(i,e,t){let n=e||fl;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 EW(i,e,t,n,r){return!CT(r,function(o){return!bp(i,e,t,n,o[0],o[1])})}function bp(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 Ay(i,e,t,n,r,s){if(t.length===0||!bp(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(bp(i,t[o-1],t[o],n,r,s))return!1;return!0}function MW(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(Ay(i,e,l,n,r,s))return!0;e=l[l.length-1]}return!1}function CW(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 qT(i,e,t,n,r,s){return s=s??aD(Hr(),i,e,t,n),Dr(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:CW(i,e,t,n,function(o,a){return HH(r,o,a)}):!1}function SD(i,e,t,n,r){return!!(qT(i,e,t,n,r)||bp(i,e,t,n,r[0],r[1])||bp(i,e,t,n,r[0],r[3])||bp(i,e,t,n,r[2],r[1])||bp(i,e,t,n,r[2],r[3]))}function TD(i,e,t,n,r){if(!SD(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(EW(i,t[s-1],t[s],n,r)&&!qT(i,t[s-1],t[s],n,r))return!1;return!0}function RW(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(TD(i,e,a,n,r))return!0;e=a[a.length-1]}return!1}function ei(){throw new Error("Unimplemented abstract method.")}var sde=0;function Bn(i){return i.ol_uid||(i.ol_uid=String(++sde))}function q1(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function ode(i,e,t){return i+"/"+e+"/"+t}function H1(i,e,t,n,r){return`${Bn(i)},${e},${ode(t,n,r)}`}function IW(i){return ade(i[0],i[1],i[2])}function ade(i,e,t){return(e<<i)+t}function PW(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 W1=[0,0,0],wp=5,ED=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(TW(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_=Tc(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 GT(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=eA(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 eA(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 eA(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 eA(c,c,u,u,n);let f=Math.floor(l*(s+1))-1,d=Math.floor(l*(o+1))-1;return eA(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,W1);let r=W1[1],s=W1[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,W1);let o=W1[1],a=W1[2];return eA(r,o,s,a,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=as(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=as(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 zl(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=as(this.getTileSize(o),this.tmpSize_),u=a*(e-l[0])/n/c[0],f=a*(l[1]-t)/n/c[1];return r?(u=dy(u,wp)-1,f=dy(f,wp)-1):(u=fy(u,wp),f=fy(f,wp)),q1(o,u,f,s)}getTileCoordForXYAndZ_(e,t,n,r,s){let o=this.getOrigin(n),a=this.getResolution(n),l=as(this.getTileSize(n),this.tmpSize_),c=(e-o[0])/a/l[0],u=(o[1]-t)/a/l[1];return r?(c=dy(c,wp)-1,u=dy(u,wp)-1):(c=fy(c,wp),u=fy(u,wp)),q1(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=G1(this.resolutions_,e,t||0);return Si(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return SD(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}},gy=ED;function HT(i){let e=i.getDefaultTileGrid();return e||(e=cde(i),i.setDefaultTileGrid(e)),e}function DW(i,e,t){let n=e[0],r=i.getTileCoordCenter(e),s=WT(t);if(!ou(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 lde(i,e,t,n){n=n!==void 0?n:"top-left";let r=FW(i,e,t);return new gy({extent:i,origin:GH(i,n),resolutions:r,tileSize:t})}function NW(i){let e=i||{},t=e.extent||Os("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:FW(t,e.maxZoom,e.tileSize,e.maxResolution)};return new gy(n)}function FW(i,e,t,n){e=e!==void 0?e:42,t=as(t!==void 0?t:256);let r=Lr(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 cde(i,e,t,n){let r=WT(i);return lde(r,e,t,n)}function WT(i){i=Os(i);let e=i.getExtent();if(!e){let t=180*Xf.degrees/i.getMetersPerUnit();e=zl(-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 j1(i,e,t,n){return qn(i,e,t,n,!0)}function li(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),hh(i))}var rn={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 MD=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},Sp=MD;function Yf(){return!0}function Zf(){return!1}function Kf(){}function jT(i){let e,t,n;return function(){let r=Array.prototype.slice.call(arguments);return(!t||this!==n||!Jo(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function BW(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 CD=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var mo=CD;var RD=class extends Sp{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 mo(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,Kf);delete o[n]}return l}disposeInternal(){this.listeners_&&hh(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]=Kf,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},Tp=RD;var tA=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",ude=tA.includes("safari")&&!tA.includes("chrom"),sBe=ude&&(tA.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(tA)),OW=tA.includes("webkit")&&!tA.includes("edge"),ID=tA.includes("macintosh"),UW=typeof devicePixelRatio<"u"?devicePixelRatio:1,no=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,PD=typeof Image<"u"&&Image.prototype.decode;var XT=(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 kW(i,e,t){let n=i,r=!0,s=!1,o=!1,a=[j1(n,rn.LOAD,function(){o=!0,s||e()})];return n.src&&PD?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(j1(n,rn.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 zW(i,e){return e&&(i.src=e),i.src&&PD?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 LD(i){return Math.pow(i,3)}function Mc(i){return 1-LD(1-i)}function VW(i){return 3*i*i-2*i*i*i}function GW(i){return i}var DD=class extends Tp{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(rn.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:LD(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()}},X1=DD;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 ND;function vy(){return ND||(ND=Di(1,1)),ND}function nA(i){let e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function FD(i,e){let t=e.parentNode;t&&t.replaceChild(i,e)}function qW(i){for(;i.lastChild;)i.lastChild.remove()}function HW(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 $T(){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 Vl(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}var BD=class extends X1{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_=fde(),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_=kW(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 fde(){let i=Di(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}var YT=BD;var OD,iA=[];function WW(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 UD(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function dde(){if(OD===void 0){let i=Di(6,6,iA);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",WW(i,4,5,4,0),WW(i,4,5,0,5);let e=i.getImageData(0,0,3,3).data;OD=UD(e,0)||UD(e,4)||UD(e,8),nA(i),iA.push(i.canvas)}return OD}function jW(i,e,t,n){let r=V1(t,e,i),s=bD(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||ou(l,r)){let c=bD(i,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function XW(i,e,t,n){let r=hl(t),s=jW(i,e,r,n);return(!isFinite(s)||s<=0)&&CT(t,function(o){return s=jW(i,e,o,n),isFinite(s)&&s>0}),s}function $W(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),iA);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=Hr();l.forEach(function(F,D,L){MT(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(Lr(S)*R),iA),f||(T.imageSmoothingEnabled=!1),r&&A){let F=(r[0]-S[0])*R,D=-(r[3]-S[3])*R,L=Kn(r)*R,C=Lr(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=Lr(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=Lr(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=Tc(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),ge=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,ge-J]],mt=YH(Fe);if(!mt)return;if(y.save(),y.beginPath(),dde()||!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,ge)}else y.moveTo(te,ce),y.lineTo($,J),y.lineTo(he,ge);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,-Lr(Ye)/Ee.height)}y.drawImage(Ee,0,0),y.restore()}),T&&(nA(T),iA.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 pde=[1,0,0,1,0,0],FBe=new Array(6);function Ao(){return pde.slice(0)}function YW(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 Wr(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 Io(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 KT(i,e){let t=mde(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 mde(i){return i[0]*i[3]-i[1]*i[2]}var Ade=[1e5,1e5,1e5,1e5,2,2];function ZW(i){return"matrix("+i.join(", ")+")"}function ZT(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function KW(i,e){let t=ZT(i),n=ZT(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*Ade[r])!==0)return!1;return!0}var gde=10,QW=.25,kD=class{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={},c=a?vW(P=>Wr(a,V1(P,this.targetProj_,this.sourceProj_))):Qm(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=Tc(n),f=N1(n),d=D1(n),A=L1(n),y=this.transformInv_(u),w=this.transformInv_(f),S=this.transformInv_(d),T=this.transformInv_(A),R=gde+(o?Math.max(0,Math.ceil(Math.log2(uy(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=oD([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=oD([e,t,n,r]);y=Kn(S)/this.targetWorldWidth_>QW||y}!A&&this.sourceProj_.isGlobal()&&f&&(y=f>QW||y)}if(!y&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!Dr(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=(uh(s[0],d)+uh(a[0],d))/2-uh(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=Hr();return this.triangles_.forEach(function(t,n,r){let s=t.source;Xm(e,s[0]),Xm(e,s[1]),Xm(e,s[2])}),e}getTriangles(){return this.triangles_}},JW=kD;var zD=class extends X1{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?lh(A,y):A;if(uy(S)===0){this.state=an.EMPTY;return}let T=e.getExtent();T&&(w?w=lh(w,T):w=T);let R=r.getResolution(this.wrappedTileCoord_[0]),P=XW(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 JW(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=lh(F,w)),!uy(F))this.state=an.EMPTY;else{let D=0,L=0;e.canWrapX()&&(D=Kn(T),L=Math.floor((F[0]-T[0])/D)),RT(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_=$W(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,rn.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_&&(nA(this.canvas_.getContext("2d")),iA.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},QT=zD;var vde=/\{z\}/g,_de=/\{x\}/g,xde=/\{y\}/g,yde=/\{-y\}/g;function ej(i,e,t,n,r){return i.replace(vde,e.toString()).replace(_de,t.toString()).replace(xde,n.toString()).replace(yde,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 tj(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 bde(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 ej(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]=bde(i[r],e);return wde(n)}function wde(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;let r=IW(e),s=uh(r,i.length);return i[s](e,t,n)})}var pu={PROPERTYCHANGE:"propertychange"};var $1=class extends Tp{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(rn.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]=j1(this,e[s],t)}else n=j1(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)Sde(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)}};$1.prototype.on;$1.prototype.once;$1.prototype.un;function Sde(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)li(i[e]);else li(i)}var JT=$1;var eE=class extends mo{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},VD=class extends JT{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 eE(n,e,t)),n=pu.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new eE(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],cu(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},Us=VD;var GD=class extends Us{constructor(e){super(),this.projection=Os(e.projection),this.attributions_=ij(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_=ij(e),this.changed()}setState(e){this.state_=e,this.changed()}};function ij(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}var tE=GD;var qD=class extends tE{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&&as(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:HT(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=as(r.getTileSize(e),this.tmpSize);return s==1?o:yW(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=DW(r,e,n)),PW(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},nE=class extends mo{constructor(e,t){super(e),this.tile=t}},rj=qD;var iE={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var HD=class i extends rj{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=iE.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==an.ERROR?iE.TILELOADERROR:r==an.LOADED?iE.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new nE(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=tj(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){}},sj=HD;var WD=class extends sj{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:Tde,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:YT,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!z1(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||z1(t,e)))return this.tileGrid;let n=Bn(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=HT(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(rn.CHANGE,this.handleTileChange.bind(this)),u}getTile(e,t,n,r,s,o){let a=this.getProjection();if(!a||!s||z1(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 QT(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=H1(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 Tde(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 oj=WD;var jD=class extends oj{constructor(e){e=e||{};let t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:NW({extent:WT(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_}},aj=jD;function mu(){if(!U.map||!U.variant||U.settling)return;let i=U.engine?.getView();try{let e=lj();e.last=U.game.slug,e.games[U.game.slug]={game:U.game.slug,map:U.map.slug,variant:U.map.variants.indexOf(U.variant),center:i?.getCenter(),zoom:i?.getZoom(),hidden:[...U.hiddenCategories],collapsed:[...U.collapsedSections],overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed},localStorage.setItem(pL,JSON.stringify(e))}catch{}}function lj(){try{let i=JSON.parse(localStorage.getItem(pL)||"null");if(i&&i.games)return i}catch{}return{last:"",games:{}}}function Y1(i){let e=lj(),t=i||e.last,n=t&&e.games[t];return n&&n.game&&n.map?n:null}function Z1(){let[i,e]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(t=>t.trim());return{game:i,map:e}}function cj(){if(!U.game||!U.map)return;let i=`#${U.game.slug}/${U.map.slug}`;location.hash!==i&&history.replaceState(null,"",i)}var XD=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,rn.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?Ede(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 Ede(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 Ep=XD;function dl(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 rE(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 uj(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 hj(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 fj=Ao(),Mde=[NaN,NaN],$D=class extends Us{constructor(){super(),this.extent_=Hr(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=jT((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,Mde,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]))&&Wm(t),this.extentRevision_=this.getRevision()}return qH(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=Lr(c)/Lr(l);Io(fj,c[0],c[3],u,-u,0,0,0);let f=dl(s,0,s.length,a,fj,o),d=Qm(n,t);return d?d(f,f,a):f}:Qm(n,t);return this.applyTransform(r),this}},dj=$D;var YD=class extends dj{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return P1(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=pj(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){ei()}setLayout(e,t,n){let r;if(e)r=pj(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=Cde(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();rE(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=hl(this.getExtent()));let r=this.getFlatCoordinates();if(r){let s=this.getStride();uj(r,0,r.length,s,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();hj(n,0,n.length,r,e,t,n),this.changed()}}};function Cde(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function pj(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function mj(i,e,t){let n=i.getFlatCoordinates();if(!n)return null;let r=i.getStride();return dl(n,0,n.length,r,e,t)}var fh=YD;function Aj(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function _y(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 ZD(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=_y(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function gj(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=ZD(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 KD=class i extends fh{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=au(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 ET(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return cy(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Aj(this.flatCoordinates,0,e,this.stride),this.changed()}},Au=KD;function rA(){return fq[U.map?.iconOutset==="dark"?"dark":"light"]}function Rde(i){let e=U.map?.iconOutset==="dark",t=Pde(i);return(e?t>.3:t<.88)?i:Ide(i,e?.74:.42)}function Ide(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 Pde(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 sE(i){let e=Math.abs(Number(i)||0);return Gf[(Math.imul(e,2654435761)>>>0)%Gf.length]}function Qf(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 K1(i,e){i.style.setProperty("--pin-color",sA(e))}function sA(i){return Rde(i.color||sE(i.id))}function Q1(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("${QD(e.iconAsset)}")`),i.classList.add("has-source-icon")}function QD(i){let e=i.split("/").map(t=>encodeURIComponent(t)).join("/");return`${U.game.base}/icons/${e}`}function gu(i){return i.split(/\s+/).slice(0,2).map(e=>e[0]||"").join("")}function vj(i){return Math.imul(Number(i)||0,2654435761)>>>0}function _j(i){return String(i||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`4+5+`).trim()}function vu(i){return new Intl.NumberFormat().format(i)}function ls(i,e,t){return Math.min(t,Math.max(e,i))}function oE(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var Lde=100;function Mp(){if(!_e.searchResults)return;let i=U.pins.filter(n=>!n.filteredHidden).sort((n,r)=>n.location.title.localeCompare(r.location.title)),e=i.slice(0,Lde),t=document.createDocumentFragment();if(!e.length){let n=document.createElement("p");n.className="search-empty",n.textContent=U.search?"No visible locations match.":"Nothing is enabled. Show a category to list its locations.",t.append(n)}for(let n of e){let r=document.createElement("button");r.type="button",r.className="search-result",U.selectedPin===n&&r.classList.add("is-selected"),r.dataset.location=String(n.location.id),K1(r,n.category);let s=document.createElement("span");s.className="result-dot",Q1(s,n.category,gu(n.category.title));let o=document.createElement("span"),a=document.createElement("strong");a.textContent=n.location.title;let l=document.createElement("small");l.textContent=`${n.category.title} \xB7 ${n.group.title}`,o.append(a,l),r.append(s,o),t.append(r)}if(i.length>e.length){let n=document.createElement("p");n.className="dock-note",n.textContent=`First ${e.length} of ${vu(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}_e.searchResults.replaceChildren(t),Nde(i.length),Dde()}var xj=28;function Dde(){let i=U.selectedPin?.location.title||"",e=i.length>xj?`${i.slice(0,xj-1).trimEnd()}\u2026`:i;_e.dockRailName.textContent=e?` \xB7 ${e}`:"",_e.dockRailName.hidden=!e}function Nde(i){_e.dockCount.textContent=`${vu(i)} ${i===1?"location":"locations"}`,U.search?(_e.dockFlag.textContent=`\u201C${U.search}\u201D`,_e.dockFlag.hidden=!1):U.hiddenCategories.size>0?(_e.dockFlag.textContent="filtered",_e.dockFlag.hidden=!1):_e.dockFlag.hidden=!0}function aE(){!U.dockFolded||U.dockDismissed||lE(!1)}function JD(i){U.dockDismissed=i,lE(i)}function lE(i,e=!0){U.dockFolded=i,_e.dock.classList.toggle("is-folded",i),_e.dockFold.setAttribute("aria-expanded",String(!i));let t=i?"Bring the panel back (\u2318\u2325B)":"Put the panel away (\u2318\u2325B)";_e.dockFold.setAttribute("aria-label",t),_e.dockFold.setAttribute("title",t),e&&mu()}function eN(i){U.hiddenCategories.delete(i.category.id),yy(),Cc(),Cp(),xy(i,!0)}function xy(i,e=!1){U.selectedPin=i,document.dispatchEvent(new Event("atlas:selection")),xu(),U.layers.pins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.textDetail.changed(),U.layers.priority.changed(),_e.detailTitle.textContent=i.location.title,_e.detailCategory.textContent=`${i.group.title} / ${i.category.title}`,_e.detailDescription.textContent="",_e.detailLinks.hidden=!0,Bde(i),_e.detailID.textContent=String(i.location.id),_e.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=dq(i.coordinate);_e.detailCell.textContent=t,_e.detailCellField.hidden=!t;for(let r of _e.detail.querySelectorAll("[data-cell-system-row]"))r.remove();for(let r of ly(U.map)){if(r.slug==="geohash")continue;let s=r.locate(i.coordinate,U.map);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),_e.detailCellField.after(o)}let n=Fde(i);if(_e.detailSource.textContent=n,_e.detailSourceField.hidden=!n,K1(_e.detailDot,i.category),Q1(_e.detailDot,i.category,gu(i.category.title)),_e.detail.hidden=!1,aE(),Mp(),e){let r=U.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(dh(U.variant),Math.max(r.getZoom()||0,4)),duration:220})}}function Fde(i){let e=U.map?.merged;if(!e?.length)return"";let t=e.find(n=>n.origin)?.source||"";if(U.pinSourceIndex?.map!==U.map){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)}}U.pinSourceIndex={map:U.map,byID:n}}for(let n of e)if(!n.origin&&i.group.title===n.source)return n.source;return U.pinSourceIndex.byID.get(i.location.id)||t}async function Bde(i){let e=await yj();if(U.selectedPin!==i)return;let t=e[String(i.location.id)]||{};i.location.description=t.d||"",i.location.links=t.l||[],_e.detailDescription.textContent=_j(t.d)||"No description is included in the archive.",Ode(i)}function Ode(i){let e=(i.location.links||[]).filter(n=>U.pinByID.has(n.locationId));if(_e.detailLinks.hidden=e.length===0,!e.length){_e.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)}_e.detailLinks.replaceChildren(t)}function _u(){let i=U.selectedPin!==null;U.selectedPin=null,document.dispatchEvent(new Event("atlas:selection")),U.sources&&(xu(),U.layers.pins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.textDetail.changed(),U.layers.priority.changed()),_e.detail.hidden=!0,i&&Mp()}function ph(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 J1(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++]=ph(i,e,l,n,r[s]),e=l}return r.length=s,r}function by(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?[]:J1(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}var tN=class i extends fh{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){du(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<vp(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=au(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 ph(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Au(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 Au(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(cy(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=_y(this.flatCoordinates,0,e,this.stride),this.changed()}},bj=tN;function nN(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+=nN(i,e,a,n),e=a}return r}function wj(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 Sj(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]=Qo(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 rN(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=au(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function sN(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=rN(i,e,a,n,r),e=a}return r}function Tj(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=sN(i,e,a,n,r),e=a[a.length-1]}return r}function oN(i,e,t,n,r,s,o,a,l,c,u){if(e==t)return c;let f,d;if(r===0){if(d=au(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(Sj(i,A-n,A,n,o,a,u),d=au(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&&(Sj(i,t-n,e,n,o,a,u),d=au(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 aN(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=oN(i,e,A,n,r,s,o,a,l,c,u),e=A}return c}function Ej(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=aN(i,e,A,n,r,s,o,a,l,c,u),e=A[A.length-1]}return c}function wy(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=$H(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 Mj(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=wy(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Rp(i,e){return e*Math.round(i/e)}function Ude(i,e,t,n,r,s,o){if(e==t)return o;let a=Rp(i[e],r),l=Rp(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,u;do if(c=Rp(i[e],r),u=Rp(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=Rp(i[e],r),d=Rp(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 Sy(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=Ude(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Cj(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l],f=[];o=Sy(i,e,u,n,r,s,o,f),a.push(f),e=u[u.length-1]}return o}var lN=class i extends fh{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<vp(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(rN(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),oN(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return nN(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return ph(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=wy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return qT(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=_y(this.flatCoordinates,0,e,this.stride),this.changed()}},cN=lN;function Ty(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(fl),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,Ay(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=Ty(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function Rj(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 uN(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 hN(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=uN(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 Ij(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(!hN(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function uE(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=uN(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&Rj(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=uE(i,e,t[s],n,r);return e}function Pj(i,e){let t=[],n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){let l=e[o],c=uN(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 hE=class i extends fh{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?du(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<vp(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(sN(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),aN(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return Ay(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(),uE(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,J1(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=hl(this.getExtent());this.flatInteriorPoint_=Ty(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Au(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new cN(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 cN(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;hN(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=uE(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Sy(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return TD(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=ZD(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},mh=hE;function dN(i){if(ch(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 hE(s,"XY",[s.length])}function fE(i,e,t,n){let r=[],s=Hr();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=P1(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 pN=class i extends fh{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;du(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;du(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<vp(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Tj(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ej(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return MW(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return wj(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,by(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=fE(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 bj(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;Ij(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=Cj(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 mh(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 mh(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return RW(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=gj(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()}},dE=pN;function Lj(i){return i.key.toLocaleLowerCase()==="g"?(i.preventDefault(),Dj(),U.gridEnabled?(_e.gridInput.focus(),_e.gridInput.select()):_e.viewport.focus({preventScroll:!0}),!0):i.key===" "&&U.gridEnabled&&i.target!==_e.subgridToggle?(i.preventDefault(),Ey(!U.subgridVisible),!0):i.key==="Escape"&&U.gridEnabled?(i.preventDefault(),mN(),!0):!1}function Dj(i=!U.gridEnabled){U.gridEnabled=i,i&&Ey(!0),My(),xu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()}function Ey(i){U.subgridVisible=i,U.layers.grid.changed(),U.layers.gridContext.changed(),_e.subgridToggle.setAttribute("aria-pressed",String(i)),_e.subgridToggle.setAttribute("aria-label",i?"Hide the subgrid":"Show the subgrid"),Nj(),document.dispatchEvent(new Event("atlas:grid"))}function Nj(){if(!U.gridEnabled){_e.gridHint.textContent="G \xB7 grid off";return}_e.gridHint.textContent=`G-${U.gridCell||"root"}`+(U.subgridVisible?"":" no subgrid")}function oA(i){let e=Ss(),t=e.parseInput(e.normalizeInput(i));if(t===null)return;let n=t!==U.gridCell;U.gridCell=t,U.gridEnabled||(U.gridEnabled=!0),My(),xu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed(),n&&(_u(),U.engine.getView().fit(gN(),{size:U.engine.getSize(),padding:[52,52,52,52],maxZoom:dh(U.variant),duration:180}))}function mN(){if(U.gridEnabled){if(!U.gridCell){Dj(!1);return}oA(Ss().parent(U.gridCell))}}function My(){if(U.sources){if(U.sources.grid.clear(),U.sources.gridContext.clear(),_e.gridNavigator.hidden=!U.gridEnabled,Nj(),kde(),U.gridEnabled&&U.variant){let i=Ss();_e.gridInput.maxLength=i.inputLength(U.map),_e.gridInput.value=U.gridCell,_e.gridBack.title=U.gridCell?`Back one ${i.slug} level`:`Close ${i.slug} grid`;for(let e of AE())qde(e)}document.dispatchEvent(new Event("atlas:grid"))}}function kde(){let i=ly(U.map),e=Ss();if(_e.gridSystemName.textContent=e.name,_e.gridSystem.hidden=i.length<2,i.length<2)return;let t=i[(i.indexOf(e)+1)%i.length];_e.gridSystem.textContent=e.short,_e.gridSystem.title=`Dividing by ${e.name} \xB7 \u2318G for ${t.name}`,_e.gridSystem.setAttribute("aria-label",`Cell system: ${e.name}. Switch to ${t.name}`)}function AN(){let i=ly(U.map);if(i.length<2)return;let e=i.indexOf(Ss());zde(i[(e+1)%i.length].slug)}function zde(i){if(i===U.gridSystem)return;let e=Ss(),t=U.gridCell;U.gridSystem=i,U.gridCell=t?zH(e,Ss(),t,U.map):"",My(),xu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()}function Vde(i){return Gf[Ss().colorKey(i)]}function mE(i,{subgridVisible:e,labelled:t}){let{role:n,contextDistance:r}=i;if(n==="child"&&(!t||!e))return null;let s=Vde(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 AE(){let i=Ss(),e=[],t=Gde(i,U.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(U.gridCell&&i.level(U.gridCell)>=i.maxLevel(U.map))return e.push(pE(i,U.gridCell,"leaf",0)),e;U.gridCell&&e.push(pE(i,U.gridCell,"scope",0));for(let n of i.children(U.gridCell))e.push(pE(i,n,"child",0));return e}function Gde(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 qde(i){let e=Ss(),t=U.pins.filter(s=>!s.filteredHidden&&e.contains(i.hash,s.coordinate)).length,n=new Ep({geometry:Hde(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"?U.sources.gridContext:U.sources.grid).addFeature(n)}function Hde(i){let e=qf(),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 mh([t]);let r=e[2]-e[0],s=[];for(let o of[0,-r,r]){let a=VH(t.map(([l,c])=>[l+o,c]),e[0],e[2]);a.length>=4&&s.push([a])}return new dE(s)}function gN(){return Ss().bbox(U.gridCell)}function Fj(){return Ss().maxLevel(U.map)}function Ip(i){return!U.gridEnabled||!U.gridCell?!1:Ss().contains(U.gridCell,i.coordinate)}var vE=[NaN,NaN,NaN,0],vN;function Wde(){return vN||(vN=Di(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),vN}var jde=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Xde=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,$de=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Yde=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function gE(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function Ry(i){throw new Error('failed to parse "'+i+'" as color')}function Bj(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(Xde)||i.match(jde)||i.match($de);if(s){let o=s[4],a=100/255;return[Si(gE(s[1],a)+.5|0,0,255),Si(gE(s[2],a)+.5|0,0,255),Si(gE(s[3],a)+.5|0,0,255),o!==void 0?Si(gE(o,100),0,1):1]}Ry(i)}if(i.startsWith("#")){if(Yde.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}Ry(i)}let e=Wde();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&&Ry(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Bj(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]=$m(r[3]/255,3),r}function Oj(i){return typeof i=="string"?i:Py(i)}var Zde=1024,Cy={},_N=0;function Uj(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function xN(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function yN(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function bN(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function wN(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function SN(i){let e=bN(i[0]),t=bN(i[1]),n=bN(i[2]),r=wN(e*.222488403+t*.716873169+n*.06060791),s=500*(wN(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-wN(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 kj(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=yN(e),s=yN(e+t/500*Math.cos(n)),o=yN(e-t/200*Math.sin(n)),a=xN(s*3.021973625-r*1.617392459-o*.404875592),l=xN(s*-.943766287+r*1.916279586+o*.027607165),c=xN(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 Iy(i){if(i==="none")return vE;if(Cy.hasOwnProperty(i))return Cy[i];if(_N>=Zde){let t=0;for(let n in Cy)(t++&3)===0&&(delete Cy[n],--_N)}let e=Bj(i);e.length!==4&&Ry(i);for(let t of e)isNaN(t)&&Ry(i);return Cy[i]=e,++_N,e}function Rc(i){return Array.isArray(i)?i:Iy(i)}function Py(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 EN=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=TN(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=TN(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=TN(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]=vy().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=vy().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function TN(i,e){let t=e?Rc(e):"null";return i+":"+t}var ea=new EN;var Ly=null,_E=class extends Tp{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){Ly||(Ly=Di(1,1,void 0,{willReadFrequently:!0})),Ly.drawImage(this.image_,0,0);try{Ly.getImageData(0,0,1,1),this.tainted_=!1}catch{Ly=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(rn.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&&zW(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=Oj(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(rn.CHANGE,t),e())};this.addEventListener(rn.CHANGE,t)}})),this.ready_}};function Pp(i,e,t,n,r,s){let o=e===void 0?void 0:ea.get(e,r);return o||(o=new _E(i,i&&"src"in i?i.src||void 0:e,t,n,r),ea.set(e,r,o,s)),s&&o&&!ea.getPattern(e,r)&&ea.set(e,r,o,s),o}var zj=_E;function pl(i){return i?Array.isArray(i)?Py(i):typeof i=="object"&&"src"in i?Kde(i):i:null}function Kde(i){if(!i.offset||!i.size)return ea.getPattern(i.src,i.color);let e=i.src+":"+i.offset,t=ea.getPattern(e,i.color);if(t)return t;let n=ea.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]),Pp(r.canvas,e,void 0,In.LOADED,i.color,!0),ea.getPattern(e,i.color)}var Dy="ol-hidden";var Lp="ol-unselectable";var ev="ol-control",MN="ol-collapsed",Qde=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"),Vj=["style","variant","weight","size","lineHeight","family"],xE={normal:400,bold:700},yE=function(i){let e=i.match(Qde);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=Vj.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[Vj[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in xE&&(t.weight=xE[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var bE="10px sans-serif",io="#000",Ah="round",ml=[],Al=0,gh="round",Jf=10,qj=0,ta="#000",Dp="center",lA="middle",ed=[0,0,0,0],td=1,aA=new Us,Ny=null,Gj,CN={},Jde=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function epe(i,e,t){return`${i} ${e} 16px "${t}"`}var Hj=(function(){let e,t;async function n(s){await t.ready;let o=yE(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let d=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),A=xE[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)?(hh(CN),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=yE(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(Jde.has(c))continue;let u=epe(o.style,o.weight,c);aA.get(u)===void 0&&(aA.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),tpe=(function(){let i;return function(e){let t=CN[e];if(t==null){if(no){let n=yE(e),r=Wj(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);CN[e]=t}return t}})();function Wj(i,e){return Ny||(Ny=Di(1,1)),i!=Gj&&(Ny.font=i,Gj=Ny.font),Ny.measureText(e)}function jj(i,e){return Wj(i,e).width}function RN(i,e,t){if(e in t)return t[e];let n=e.split(`6+`).reduce((r,s)=>Math.max(r,jj(i,s)),0);return t[e]=n,n}function Xj(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=jj(d,f);t.push(A),o+=A;let y=tpe(d);n.push(y),l=Math.max(l,y)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function $j(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]),npe(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 npe(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 IN=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=as(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_=as(e)}listenImageChange(e){ei()}load(){ei()}unlistenImageChange(e){ei()}ready(){return Promise.resolve()}},wE=IN;var PN=class i extends wE{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=ea.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 zj(r,void 0,null,In.LOADED,null);ea.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=Ah,t=gh,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=pl(this.stroke_.getColor()??ta),a=this.stroke_.getWidth()??td,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??gh,e=this.stroke_.getLineCap()??Ah,n=this.stroke_.getMiterLimit()??Jf);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=pl(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=Rc(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()}},SE=PN;var LN=class i extends SE{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}},TE=LN;var DN=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=Pp(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:Rc(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},cs=DN;function Yj(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 NN=class i extends wE{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?Rc(e.color):null,this.iconImage_=Pp(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(Yj(A[0],A[1],e.width,e.height))};this.listenImageChange(d);return}}c!==void 0&&this.setScale(Yj(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?Rc(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_=Pp(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_=Pp(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(rn.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(rn.CHANGE,e)}ready(){return this.iconImage_.ready()}},cA=NN;var FN=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}},Po=FN;var EE=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=Zj,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_=Zj,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function Kj(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 BN=null;function ON(i,e){if(!BN){let t=new cs({color:"rgba(255,255,255,0.4)"}),n=new Po({color:"#3399CC",width:1.25});BN=[new EE({image:new TE({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return BN}function Zj(i){return i.getGeometry()}var ks=EE;var ipe="#333",UN=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_=as(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 cs({color:ipe}),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 cs?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_=as(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}},nd=UN;function Ic(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function eX(i){let e=i.get("pin");return!e||Pc(e)||e.insideHighlightedZone||tv(e)?null:kN(e,!1)}function tX(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Pc(e)||tv(e)?null:kN(e,!1)}function nX(i){let e=i.get("pin");return!e||Pc(e)||!U.labelsHeld?null:aX(e)}function iX(i){let e=i.get("pin");if(!e||Pc(e)||e.insideHighlightedZone||tv(e)||Oy())return null;if(U.labelsHeld)return Fy(e,!1);let t=U.fitZoom+Math.log2(mX(e.category));return(U.engine.getView().getZoom()||0)<t?null:Fy(e,!1)}function rX(i){let e=i.get("pin");return!e||Pc(e)||e.insideHighlightedZone||tv(e)||!Oy()?null:Fy(e,!1)}function sX(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Pc(e)||tv(e)?null:Fy(e,!1)}function oX(i){let e=i.get("pin");if(!e||Pc(e))return null;if(sh(e.category)==="text")return Fy(e,e===U.selectedPin);let t=kN(e,e===U.selectedPin);return e===U.hoveredPin||e===U.selectedPin?[t,aX(e)]:t}function kN(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let n=sA(i.category),r=e?2e7:i.priority,s=U.markerIcons.get(By(i.category)),o;return s?o=new ks({image:new cA({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new ks({text:new nd({text:gu(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new cs({color:n}),stroke:new Po({color:rA(),width:e?4:3})}),zIndex:r}),U.styleCache.set(t,o),o}function aX(i){let e=`marker-label:${i.location.id}`;if(U.styleCache.has(e))return U.styleCache.get(e);let t=new ks({text:new nd({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new cs({color:"#f2ece0"}),stroke:new Po({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new cs({color:"rgba(10,12,17,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:i.priority});return U.styleCache.set(e,t),t}function lX(i){if(!i.iconAsset)return;let e=By(i);if(U.markerIcons.has(e))return;U.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=sA(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=rA(),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),U.markerIcons.set(e,n.toDataURL("image/png")),rpe(),U.layers.pins.changed(),U.layers.zonePins.changed(),U.layers.priority.changed()},t.onerror=()=>U.markerIcons.set(e,!1),t.src=QD(i.iconAsset)}function rpe(){for(let i of U.styleCache.keys())i.startsWith("marker:")&&U.styleCache.delete(i)}function By(i){return`${i.iconAsset||""}:${sA(i)}:${U.map?.iconOutset||"light"}`}function Fy(i,e){let t=`text:${i.location.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let r=[new ks({text:new nd({text:i.location.title,font:`${e?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new cs({color:e?"#7fd0ea":"#f2ece0"}),stroke:new Po({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new cs({color:e?"rgba(13,16,23,0.9)":"rgba(10,12,17,0.58)"}),backgroundStroke:e?new Po({color:"#3aa5c9",width:1}):void 0,padding:[3,6,3,6],overflow:!0}),zIndex:e?2e7:i.priority+3e6})];return U.styleCache.set(t,r),r}function ME(i,e){return`${i} ${e}px ${Vi.labelFont}`}function zN(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="neighbor",r=n?Vi.neighborLabelSizePx:Vi.labelSizePx,s=ME(900,r),o=n?[2,4,2,4]:[3,5,3,5],a=ope(t,s,r,o,e),l=mE(t,{subgridVisible:U.subgridVisible,labelled:a});if(!l)return null;let c=`grid:${U.gridSystem}:${t.hash}:${t.role}:${t.contextDistance}:${a?1:0}:${l.bare?1:0}`;if(U.styleCache.has(c))return U.styleCache.get(c);let u=t.role==="leaf"||t.role==="scope"?100:i.get("priority"),f=[new ks({fill:l.fill?new cs({color:Qf(l.fill.color,l.fill.opacity)}):void 0,stroke:new Po({color:Qf(l.line.color,l.line.opacity),width:l.line.widthPx}),zIndex:u})];if(l.label){let d=l.label.prefix?[l.label.prefix,ME(500,r),l.label.final,ME(900,r)]:l.label.final,A=Vi.labelInsetPx*e,y=spe(i.getGeometry());y&&f.push(new ks({geometry:new Au([y[0]-A,y[1]+A]),text:new nd({text:d,font:ME(900,r),textAlign:"right",textBaseline:"bottom",fill:new cs({color:Qf(l.label.color,l.label.textAlpha)}),backgroundFill:new cs({color:l.label.chip}),padding:o,overflow:!0}),zIndex:u+1}))}return U.styleCache.set(c,f),f}function spe(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 ope(i,e,t,n,r){if(!r)return!0;let s=VN(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 Qj=document.createElement("canvas").getContext("2d"),Jj=new Map;function VN(i,e){let t=`${e}|${i}`,n=Jj.get(t);return n===void 0&&(Qj.font=e,n=Qj.measureText(i).width,Jj.set(t,n)),n}var ape=new ks({fill:new cs({color:"rgba(5, 8, 16, 0.62)"})});function cX(){return U.zonesVisible?ape:null}function uX(i){if(!U.zonesVisible)return null;let e=i.get("zone"),t=i.get("child"),n=U.highlightedZones.has(e.id),r=pX(e.id),s=`zone:${e.id}:${t?1:0}:${n?1:r?2:0}`;if(U.styleCache.has(s))return U.styleCache.get(s);let o=i.get("color");if(r){let c=new ks({stroke:new Po({color:Qf(o,t?.34:.44),width:t?1:1.3,lineDash:t?[3,4]:[7,5]}),zIndex:t?101:100});return U.styleCache.set(s,c),c}let a=new ks({fill:new cs({color:Qf(o,t?.035:.07)}),stroke:new Po({color:Qf(o,t?.5:.72),width:t?1.2:1.8,lineDash:t?[3,4]:[7,5]})});if(!n)return U.styleCache.set(s,a),a;let l=[new ks({stroke:new Po({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new ks({fill:new cs({color:Qf(o,.22)}),stroke:new Po({color:o,width:2.6}),zIndex:9001})];return U.styleCache.set(s,l),l}function hX(i){if(!U.zonesVisible||Oy())return null;let e=i.get("child"),t=U.highlightedZones.has(i.get("zone").id),n=U.engine.getView().getZoom()||0;if(!t&&e&&n<U.fitZoom+3)return null;let r=i.get("span")/U.engine.getView().getResolution();return!t&&U.zoneTitleCount>40&&r<52?null:dX(i)}function fX(i){return!U.zonesVisible||!Oy()?null:dX(i)}function dX(i){let e=i.get("child"),t=i.get("zone"),n=U.highlightedZones.has(t.id),r=pX(t.id),s=`zone-title:${t.id}:${e?1:0}:${n?1:r?2:0}`;if(U.styleCache.has(s))return U.styleCache.get(s);let o=i.get("color"),a=new ks({text:new nd({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new cs({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new Po({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 cs({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new Po({color:n?"#ffffff":Qf(o,r?.24:.55),width:n?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:n?91e5:i.get("priority")});return U.styleCache.set(s,a),a}function pX(i){if(!U.highlightedZones.size||U.highlightedZones.has(i))return!1;for(let e of U.highlightedZones)if(lpe(i,e))return!1;return!0}function lpe(i,e){let t=new Set,n=U.zoneRecords.get(e)?.zone.parentRegionId;for(;n!=null&&!t.has(n);){if(n===i)return!0;t.add(n),n=U.zoneRecords.get(n)?.zone.parentRegionId}return!1}function GN(){let i=(U.map.zones||[]).filter(WN);U.renderedShard=U.variant?.shard||0,U.sources.zones.clear(),U.sources.zoneTitles.clear(),U.zoneRecords.clear(),U.highlightedZones.clear(),U.focusedZoneID=null,U.zoneTitleCount=0,CE(!0),_e.zoneIndex.hidden=i.length===0,_e.zoneCount.textContent=vu(i.length);for(let e of i){let t=Hr(),n=[],r=!1;for(let l of e.features||[]){let c=hpe(l);c&&(r=!0,n.push(c),MT(t,c.getExtent()),U.sources.zones.addFeature(new Ep({geometry:c,zone:e,color:sE(e.id),child:e.parentRegionId!=null})))}if(!r)continue;let s=sE(e.id),o=e.center?nv(e.center.lat,e.center.lng):hl(t),a=Math.max(t[2]-t[0],t[3]-t[1]);U.sources.zoneTitles.addFeature(new Ep({geometry:new Au(o),zone:e,color:s,child:e.parentRegionId!=null,span:a,priority:(e.parentRegionId==null?2e6:1e6)+Math.round(a)})),U.zoneRecords.set(e.id,{zone:e,extent:t.slice(),geometries:n,color:s})}U.zoneTitleCount=U.sources.zoneTitles.getFeatures().length,gX(),cpe()}function gX(){if(U.sources.zoneScrim.clear(),!U.highlightedZones.size)return;let[i,e,t,n]=U.projection.getExtent(),r=[AX([[i,e],[t,e],[t,n],[i,n],[i,e]],!0)];for(let s of U.highlightedZones)for(let o of U.zoneRecords.get(s)?.geometries||[]){let a=o.getType()==="MultiPolygon"?o.getPolygons():[o];for(let l of a)l.getLinearRings().forEach((c,u)=>{r.push(AX(c.getCoordinates(),u>0))})}U.sources.zoneScrim.addFeature(new Ep({geometry:new mh(r)}))}function AX(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 cpe(){let i=document.createDocumentFragment();for(let{zone:e,depth:t}of upe()){let n=U.zoneRecords.get(e.id);if(!n)continue;let r=document.createElement("button");r.type="button",r.className="zone-index-item",r.dataset.zone=String(e.id),r.style.setProperty("--zone-color",n.color),r.style.setProperty("--zone-depth",String(t)),r.setAttribute("aria-pressed","false"),r.title=`${e.title}: click to jump; right-click to toggle highlight`;let s=document.createElement("span");s.className="zone-index-marker",s.setAttribute("aria-hidden","true");let o=document.createElement("span");o.textContent=e.title,r.append(s,o),i.append(r)}_e.zoneList.replaceChildren(i),_e.zoneIndex.hidden=U.zoneRecords.size===0}function upe(){let i=[...U.zoneRecords.values()].map(o=>o.zone),e=new Set(i.map(o=>o.id)),t=new Map;for(let o of i){let a=e.has(o.parentRegionId)?o.parentRegionId:null;t.has(a)||t.set(a,[]),t.get(a).push(o)}for(let o of t.values())o.sort((a,l)=>a.title.localeCompare(l.title,void 0,{numeric:!0,sensitivity:"base"}));let n=[],r=new Set,s=(o,a)=>{if(!r.has(o.id)){r.add(o.id),n.push({zone:o,depth:a});for(let l of t.get(o.id)||[])s(l,a+1)}};for(let o of t.get(null)||[])s(o,0);for(let o of i)s(o,0);return n}function CE(i){U.zonesVisible=i,_e.zoneToggle.checked=i,U.layers.zoneScrim.setVisible(i),U.layers.zones.setVisible(i),U.layers.zoneTitles.setVisible(i),U.layers.zoneTitleDetail.setVisible(i)}function vX(i){let e=U.zoneRecords.get(i);e&&(U.focusedZoneID=i,xX(),_u(),U.engine.getView().fit(e.extent,{size:U.engine.getSize(),padding:[54,54,54,54],maxZoom:dh(U.variant),duration:220}),_e.sidebar.classList.remove("is-open"),_e.mobileLegend.setAttribute("aria-expanded","false"))}function _X(i){U.zoneRecords.has(i)&&(U.highlightedZones.has(i)?U.highlightedZones.delete(i):(U.highlightedZones.add(i),CE(!0)),U.hoveredPin=null,qN(),HN(),xX(),gX(),U.layers.zones.changed(),U.layers.zoneTitles.changed(),U.layers.zoneTitleDetail.changed())}function xX(){_e.zoneIndex.classList.toggle("has-highlights",U.highlightedZones.size>0);for(let i of _e.zoneList.querySelectorAll("[data-zone]")){let e=Number(i.dataset.zone),t=U.highlightedZones.has(e);i.classList.toggle("is-highlighted",t),i.classList.toggle("is-current",U.focusedZoneID===e),i.setAttribute("aria-pressed",String(t))}}function hpe(i){if(!i?.coordinates)return null;let e=([t,n])=>nv(n,t);return i.type==="Polygon"?new mh(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new dE(i.coordinates.map(t=>t.map(n=>n.map(e)))):null}function nv(i,e){let t=fpe(),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 fpe(){let i=U.game.tileGrid,e=U.map?.grid;return e?{...i,...e}:i}function yX(){U.sources.pins.clear(),U.sources.text.clear(),U.sources.priority.clear(),U.pins=[],U.pinByID.clear();for(let i of U.map.groups)for(let e of i.categories){sh(e)!=="text"&&lX(e);for(let t of e.locations){let n={location:t,category:e,group:i,coordinate:nv(t.lat,t.lng),filteredHidden:!1,priority:Ape(e,t),feature:null};n.feature=new Ep({geometry:new Au(n.coordinate),pin:n,priority:n.priority}),U.pins.push(n),U.pinByID.set(t.id,n),sh(e)==="text"?U.sources.text.addFeature(n.feature):U.sources.pins.addFeature(n.feature)}}Cc()}function Cc(){for(let i of U.pins){let e=U.hiddenCategories.has(i.category.id),t=U.search&&!i.location.title.toLocaleLowerCase().includes(U.search);i.filteredHidden=!!(e||t)}qN(),HN(),U.selectedPin?.filteredHidden&&_u(),Mp(),document.dispatchEvent(new Event("atlas:filters"))}function qN(){if(!U.highlightedZones.size){for(let e of U.pins)e.insideHighlightedZone=!1;return}let i=[...U.highlightedZones].map(e=>U.zoneRecords.get(e)).filter(Boolean);for(let e of U.pins)e.insideHighlightedZone=i.some(t=>t.geometries.some(n=>dpe(n,e.coordinate)))}function dpe(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}function HN(){U.eligibleLocations=U.pins.filter(i=>!Pc(i)).length,xu(),U.layers.pins.changed(),U.layers.zonePins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.zoneText.changed(),U.layers.textDetail.changed(),U.layers.priority.changed(),uA()}function xu(){U.sources.priority.clear();for(let i of U.pins){if(Pc(i))continue;let e=!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search);(i===U.selectedPin||i===U.hoveredPin||e||Ip(i))&&U.sources.priority.addFeature(i.feature)}}function iv(i){U.hoveredPin!==i&&(U.hoveredPin=i,U.sources&&(xu(),U.layers.pins.changed(),U.layers.priority.changed()))}function RE(i){U.labelsHeld!==i&&(U.labelsHeld=i,_e.labelsHint.textContent=i?"Z \xB7 labels shown":"Z \xB7 hold for labels",U.layers.pinLabels.changed(),U.layers.text.changed(),document.dispatchEvent(new Event("atlas:labels")))}function tv(i){return i===U.selectedPin||i===U.hoveredPin||Ip(i)||!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search)}function Pc(i){return i.filteredHidden||ppe(i)||mpe(i)||!WN(i.location)}function WN(i){let e=U.variant?.shard;return!e||!i.shard||i.shard===e}function ppe(i){return!U.highlightedZones.size||i.insideHighlightedZone||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function mpe(i){return!U.gridEnabled||!U.gridCell||Ip(i)||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function Ape(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+vj(e.id)%1e3}function mX(i){return i.locations.length>200?4:i.locations.length>75?2.5:1}function Oy(){return(U.engine?.getView().getZoom()||0)>=(U.variant?.maxZoom||0)-.05}function bX(i){let e=[],t=[];for(let n of i){let r=[];for(let s of n.categories)(sh(s)==="text"?t:r).push(s);r.length&&e.push({key:`group-${n.id}`,title:n.title,categories:r})}return t.length&&e.unshift({key:"text",title:"Text",categories:t}),e}function wX(){let i=document.createDocumentFragment();for(let e of U.map.sections){let t=document.createElement("section");t.className="layer-section",t.dataset.layerSection=e.key;let n=e.categories.reduce((s,o)=>s+o.locations.length,0);t.append(gpe(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.categories)r.append(vpe(s));t.append(r),i.append(t)}_e.legend.replaceChildren(i),IE(),Cp()}function gpe(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=vu(t),r.append(s,o,a);let l=SX(`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 SX(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 vpe(i){let e=sh(i)==="text",t=document.createElement("label");t.className="category-row",K1(t,i);let n=document.createElement("input");n.type="checkbox",n.dataset.category=String(i.id),n.checked=!U.hiddenCategories.has(i.id);let r=document.createElement("span");e?(r.className="text-symbol",r.textContent="Tt",r.title="Drawn as a text label"):(r.className="category-icon",Q1(r,i,gu(i.title)),r.title=i.icon||i.title);let s=document.createElement("span");s.className="category-name",s.textContent=i.title;let o=document.createElement("span");o.className="category-count",o.textContent=vu(i.locations.length);let a=SX(`Show only ${i.title}`);return a.dataset.onlyCategory=String(i.id),t.append(n,r,s,a,o),t}function jN(i){if(U.collapsedSections.clear(),i)for(let e of _e.layers.querySelectorAll("[data-section]"))U.collapsedSections.add(e.dataset.section);IE()}function IE(){for(let i of _e.layers.querySelectorAll("[data-section]")){let e=U.collapsedSections.has(i.dataset.section);i.setAttribute("aria-expanded",String(!e)),i.closest(".layer-section").classList.toggle("is-collapsed",e)}mu()}function Uy(i){if(U.hiddenCategories.clear(),!i)for(let e of U.map.groups)for(let t of e.categories)U.hiddenCategories.add(t.id);yy(),Cc(),Mp(),Cp()}function yy(){for(let i of document.querySelectorAll("[data-category]"))i.checked=!U.hiddenCategories.has(Number(i.dataset.category))}function TX(i){let e=U.map.sections.find(n=>n.key===i);if(!e)return;let t=e.categories.some(n=>!U.hiddenCategories.has(n.id));for(let n of e.categories)t?U.hiddenCategories.add(n.id):U.hiddenCategories.delete(n.id);yy(),Cc(),Cp()}function EX(i){if(U.map){if(_pe(i)){Uy(!0);return}U.hiddenCategories.clear();for(let e of U.map.sections){let t=i.section===e.key;for(let n of e.categories)!t&&i.category!==n.id&&U.hiddenCategories.add(n.id)}yy(),Cc(),Mp(),Cp()}}function _pe(i){for(let e of U.map.sections)for(let t of e.categories)if((i.section===e.key||i.category===t.id)===U.hiddenCategories.has(t.id))return!1;return!0}function xpe(){let i=_e.soloChip;if(!U.map){i.hidden=!0;return}let e=null,t=0,n=null,r=0;for(let o of U.map.sections){let a=0;for(let l of o.categories)U.hiddenCategories.has(l.id)||(a++,t++,e=l);a>0&&(r++,n=a===o.categories.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 Cp(){if(U.map){for(let i of U.map.sections){let e=_e.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.categories.some(t=>!U.hiddenCategories.has(t.id)))}xpe(),mu()}}async function MX(i){let[e,t]=await Promise.all([fetch(`${U.game.base}/maps/${i.slug}.json`),fetch(`${U.game.base}/maps/${i.slug}.bin`)]);if(!e.ok||!t.ok)throw new Error(`map ${i.slug} is not served under this catalog any more`);let[n,r]=await Promise.all([e.json(),t.arrayBuffer()]),s=n.groups.flatMap(o=>o.categories);return ype(r,s),{...i,grid:n.grid,variants:n.variants,groups:n.groups,zones:n.zones||[],attrs:n.attrs||{},merged:n.merged||[],sections:bX(n.groups)}}function ype(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!==2)throw new Error(`location payload is version ${r}, and this reads 2`);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.locations=[];for(let S=0;S<s;S++)e[A[S]].locations.push({id:a[S],title:w.decode(y.subarray(d[S],d[S+1])),lat:l[S],lng:c[S],regionId:u[S]||void 0,shard:f[S]||void 0})}async function yj(){let i=`${U.game.base}/${U.map.slug}`;return U.textByMap.has(i)||U.textByMap.set(i,fetch(`${U.game.base}/maps/${U.map.slug}.text`).then(e=>e.json()).catch(()=>({}))),U.textByMap.get(i)}var PE=null;function hA(){return PE||(PE=bpe().finally(()=>{PE=null})),PE}async function bpe(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=U.game;if(U.catalog=await i.json(),Um(_e.game,U.catalog.games,"title"),XN(),!U.catalog.games.length)return;let t=e&&U.catalog.games.find(n=>n.slug===e.slug);if(!t){let n=Z1();await id(n.game||Y1()?.game||U.catalog.games[0].slug,n.game?n.map:void 0);return}if(t.stamp!==e.stamp){for(let r of U.textByMap.keys())r.startsWith(e.base+"/")&&U.textByMap.delete(r);let n=U.engine?.getView();U.restore={game:t.slug,map:U.map?.slug,variant:U.map?U.map.variants.indexOf(U.variant):0,center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...U.hiddenCategories],collapsed:[...U.collapsedSections],overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed},await id(t.slug,U.map?.slug);return}U.game=t,_e.game.value=t.slug}function XN(){let i=!U.catalog?.games?.length;_e.emptyState.hidden=!i,U.catalog?.bundlesDir&&(_e.emptyPath.textContent=U.catalog.bundlesDir)}async function $N(){for(let i of[_e.emptyOpen,_e.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await hA();let t=e.imported?.[0];t&&U.catalog.games.some(n=>n.slug===t)&&await id(t)}finally{for(let i of[_e.emptyOpen,_e.addBundles])i.disabled=!1}}var go={ADD:"add",REMOVE:"remove"};var CX={LENGTH:"length"},rv=class extends mo{constructor(e,t,n){super(e),this.element=t,this.index=n}},YN=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(CX.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 rv(go.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 rv(go.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 rv(go.REMOVE,r,e)),this.dispatchEvent(new rv(go.ADD,t,e))}updateLength_(){this.set(CX.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")}},Lo=YN;var ZN=class extends mo{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},Np=ZN;var KN=class extends Np{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()}},vh=KN;var Ar={SINGLECLICK:"singleclick",CLICK:rn.CLICK,DBLCLICK:rn.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var ky={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var QN=class extends Tp{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,ky.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=qn(n,ky.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(rn.TOUCHMOVE,this.boundHandleTouchMove_,XT?{passive:!1}:!1)}emulateClick_(e){let t=new vh(Ar.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new vh(Ar.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new vh(Ar.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==Ar.POINTERUP||t.type==Ar.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==Ar.POINTERDOWN||t.type==Ar.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new vh(Ar.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 vh(Ar.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,Ar.POINTERMOVE,this.handlePointerMove_,this),qn(n,Ar.POINTERUP,this.handlePointerUp_,this),qn(this.element_,Ar.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(qn(this.element_.getRootNode(),Ar.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new vh(Ar.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 vh(Ar.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(rn.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(li(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(li),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},RX=QN;var _h={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var Do={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var zy=1/0,JN=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,hh(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!=zy?(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==zy?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},IX=JN;var e5=class extends IX{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(rn.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(rn.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())}}},PX=e5;function LX(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return zy;if(!i.wantedTiles[t][e.getKey()])return zy;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 ro={ANIMATING:0,INTERACTING:1};var Lc={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function t5(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 DX(i){return i}function n5(i,e,t,n){let r=Kn(e)/t[0],s=Lr(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function i5(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 NX(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?n5(l,t,o,n):l;if(a)return e?i5(r,u,c):Si(r,c,u);let f=Math.min(u,r),d=Math.floor(G1(i,f,s));return i[d]>u&&d<i.length-1?i[d+1]:i[d]}})}function FX(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?n5(e,r,l,s):e;if(c)return n?i5(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 r5(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?n5(i,n,a,r):i;return!t||!l?Si(s,e,c):i5(s,c,e)}})}function sv(i){if(i!==void 0)return 0}function s5(i){if(i!==void 0)return i}function BX(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 OX(i){let e=i===void 0?lu(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var o5=0,l5=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_=zT(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&&gW(),e.center&&(e.center=hu(e.center,this.projection_)),e.extent&&(e.extent=fu(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in Lc)delete t[a];this.setProperties(t,!0);let n=Spe(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=wpe(e),s=n.constraint,o=Tpe(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=hu(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=hu(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&&LE(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||VW,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=uh(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+d,l=f.targetRotation}Epe(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(ro.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[ro.ANIMATING]>0}getInteracting(){return this.hints_[ro.INTERACTING]>0}cancelAnimations(){this.setHint(ro.ANIMATING,-this.hints_[ro.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&LE(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?uh(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(ro.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&LE(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]],F1(n,e-this.getRotation()),ZH(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&&my(e,this.getProjection())}getCenterInternal(){return this.get(Lc.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 yp(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"),hy(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(Lc.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(fu(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=Kn(e)/t[0],r=Lr(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(Lc.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=a5(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=G1(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(!ch(e),"Cannot fit empty extent provided as `geometry`");let r=fu(e,this.getProjection());n=dN(r)}else if(e.getType()==="Circle"){let r=fu(e.getExtent(),this.getProjection());n=dN(r),n.rotate(this.getRotation(),hl(r))}else{let r=Jm();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=hl(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:Kf;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),LE(S,!0))}centerOn(e,t,n){this.centerOnInternal(hu(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(a5(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=a5(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=my(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&&hu(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=hu(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&&hu(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(Lc.ROTATION)!==r&&this.set(Lc.ROTATION,r),this.get(Lc.RESOLUTION)!==o&&(this.set(Lc.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Lc.CENTER)||!Ym(this.get(Lc.CENTER),a))&&this.set(Lc.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()||!Ym(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:Mc,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(ro.INTERACTING,1)}endInteraction(e,t,n){n=n&&hu(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(ro.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 LE(i,e){setTimeout(function(){i(e)},0)}function wpe(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return t5(i.extent,i.constrainOnlyCenter,t)}let e=zT(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,t5(t,!1,!1)}return DX}function Spe(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:o5,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=zT(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=NX(S,u,!y&&w,f):e=r5(t,n,u,!y&&w,f)}else{let T=(A?Math.max(Kn(A),Lr(A)):360*Xf.degrees/d.getMetersPerUnit())/256/Math.pow(2,o5),R=T/Math.pow(2,28-o5);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=FX(l,t,n,u,!y&&w,f):e=r5(t,n,u,!y&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function Tpe(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?OX():t===!1?s5:typeof t=="number"?BX(t):s5}return sv}function Epe(i){return!(i.sourceCenter&&i.targetCenter&&!Ym(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function a5(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 Gl=l5;var c5=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!==Kf&&this.listenerKeys.push(qn(e,_h.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},ov=c5;var u5=class extends ov{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(rn.CLICK,this.handleClick_.bind(this),!1);let c=t+" "+Lp+" "+ev+(this.collapsed_&&this.collapsible_?" "+MN:"")+(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=>BW(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Jo(t,this.renderedAttributions_)){qW(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(MN),this.collapsed_?FD(this.collapseLabel_,this.label_):FD(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)}},UX=u5;var h5=class extends ov{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(rn.CLICK,this.handleClick_.bind(this),!1);let a=t+" "+Lp+" "+ev,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(Dy)}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:Mc}):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(Dy);!s&&n===0?this.element.classList.add(Dy):s&&n!==0&&this.element.classList.remove(Dy)}this.label_.style.transform=r}this.rotation_=n}},kX=h5;var f5=class extends ov{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(rn.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(rn.CLICK,this.handleClick_.bind(this,-n),!1);let d=t+" "+Lp+" "+ev,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:Mc})):n.setZoom(s)}}},zX=f5;function DE(i){i=i||{};let e=new Lo;return(i.zoom===void 0||i.zoom)&&e.push(new zX(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new kX(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new UX(i.attributionOptions)),e}var d5=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_}},VX=d5;var p5={ACTIVE:"active"};var m5=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(p5.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(p5.ACTIVE,e)}setMap(e){this.map_=e}};function GX(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:GW,center:i.getConstrainedCenter(r)})}}function av(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:Mc})}var xh=m5;var A5=class extends xh{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==Ar.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();av(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},qX=A5;function Vy(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 HX=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Mpe=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)},NE=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?Mpe(i):!0},WX=Yf;var FE=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(OW&&ID&&e.ctrlKey)};var BE=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var jX=function(i){let e=i.originalEvent;return ID?e.metaKey:e.ctrlKey},XX=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},OE=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},UE=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var $X=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var g5=class extends xh{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==Ar.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==Ar.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==Ar.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==Ar.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 lv(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 yh=g5;var v5=class extends yh{constructor(e){super({stopDown:Zf}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:Vy(BE,$X);this.condition_=e.onFocusOnly?Vy(NE,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(lv(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();KH(s,a.getResolution()),F1(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:Mc})}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}},YX=v5;var _5=class extends yh{constructor(e){e=e||{},super({stopDown:Zf}),this.condition_=e.condition?e.condition:HX,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!UE(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===sv)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 UE(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return UE(e)&&FE(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},ZX=_5;var x5=class extends Sp{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 mh([r])}getGeometry(){return this.geometry_}},KX=x5;var cv={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},fA=class extends mo{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},y5=class extends yh{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new KX(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??FE,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 fA(cv.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 fA(t?cv.BOXEND:cv.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 fA(cv.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new fA(cv.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new fA(cv.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},QX=y5;var b5=class extends QX{constructor(e){e=e||{};let t=e.condition?e.condition:XX;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:Mc})}},JX=b5;var Fp={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var w5=class extends xh{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return BE(t)&&OE(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==rn.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Fp.DOWN||r==Fp.LEFT||r==Fp.RIGHT||r==Fp.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==Fp.DOWN?c=-a:r==Fp.LEFT?l=-a:r==Fp.RIGHT?l=a:c=a;let u=[l,c];F1(u,o.getRotation()),GX(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},e$=w5;var S5=class extends xh{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!jX(t)&&OE(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==rn.KEYDOWN||e.type==rn.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();av(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},t$=S5;var Cpe=40,Rpe=300,Ipe=3,T5=class extends xh{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:WX;this.condition_=e.onFocusOnly?Vy(NE,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!==rn.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*=Cpe;break;case WheelEvent.DOM_DELTA_PAGE:o*=Rpe;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*Ipe),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),av(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)}},n$=T5;var E5=class extends yh{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=Zf),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!==sv&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(lv(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}},i$=E5;var M5=class extends yh{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=Zf),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(lv(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}},r$=M5;function kE(i){i=i||{};let e=new Lo,t=new VX(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new ZX),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new qX({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new YX({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new i$),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new r$({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new e$),e.push(new t$({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new n$({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new JX({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 C5=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()}},zE=C5;var Bp={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},yu=class extends mo{constructor(e,t){super(e),this.layer=t}},R5={LAYERS:"layers"},I5=class i extends zE{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(R5.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new Lo(n.slice(),{unique:!0}):jn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new Lo(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,go.ADD,this.handleLayersAdd_,this),qn(e,go.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(li);hh(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 yu(Bp.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[qn(e,pu.PROPERTYCHANGE,this.handleLayerChange_,this),qn(e,rn.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(qn(e,Bp.ADDLAYER,this.handleLayerGroupAdd_,this),qn(e,Bp.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Bn(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new yu(Bp.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new yu(Bp.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new yu(Bp.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 yu(Bp.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(R5.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 yu(Bp.REMOVELAYER,n[r]))}this.set(R5.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=lh(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},Gy=I5;var No={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var P5=class extends zE{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,rn.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 Gl?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 qy(r,t.viewState)&&(!s||Dr(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof Gl?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,No.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=qn(this,rn.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 qy(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 dA=P5;function VE(i,e,t=0,n=i.length-1,r=Ppe){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));VE(i,e,A,y,r)}let s=i[e],o=t,a=n;for(Hy(i,t,e),r(i[n],s)>0&&Hy(i,t,n);o<a;){for(Hy(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?Hy(i,t,a):(a++,Hy(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function Hy(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function Ppe(i,e){return i<e?-1:i>e?1:0}var pA=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(!qE(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;qE(e,l)&&(t.leaf?n.push(a):D5(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!qE(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(qE(e,o)){if(t.leaf||D5(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=hv([]),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=Lpe(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&D5(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=hv(e.slice(t,n+1)),uv(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=hv([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));s$(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);s$(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 uv(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=L5(c),f=Fpe(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),jy(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=hv(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,uv(n,this.toBBox),uv(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=hv([e,t]),this.data.height=e.height+1,this.data.leaf=!1,uv(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=Wy(e,0,a,this.toBBox),c=Wy(e,a,n,this.toBBox),u=Bpe(l,c),f=L5(l)+L5(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:Dpe,s=e.leaf?this.compareMinY:Npe,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=Wy(e,0,t,s),a=Wy(e,n-t,n,s),l=GE(o)+GE(a);for(let c=t;c<n-t;c++){let u=e.children[c];jy(o,e.leaf?s(u):u),l+=GE(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];jy(a,e.leaf?s(u):u),l+=GE(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)jy(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():uv(e[t],this.toBBox)}};function Lpe(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 uv(i,e){Wy(i,0,i.children.length,e,i)}function Wy(i,e,t,n,r){r||(r=hv(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];jy(r,i.leaf?n(o):o)}return r}function jy(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 Dpe(i,e){return i.minX-e.minX}function Npe(i,e){return i.minY-e.minY}function L5(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function GE(i){return i.maxX-i.minX+(i.maxY-i.minY)}function Fpe(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 Bpe(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 D5(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function qE(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function hv(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function s$(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;VE(i,o,e,t,r),s.push(e,o,o,t)}}var AA=0,WE=0,na=1<<AA++,ci=1<<AA++,ia=1<<AA++,Ia=1<<AA++,sd=1<<AA++,mA=1<<AA++,jE=Math.pow(2,AA)-1,F5={[na]:"boolean",[ci]:"number",[ia]:"string",[Ia]:"color",[sd]:"number[]",[mA]:"size"},Ope=Object.keys(F5).map(Number).sort(fl);function Upe(i){return i in F5}function rd(i){let e=[];for(let t of Ope)Xy(i,t)&&e.push(F5[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function Xy(i,e){return(i&e)===e}function HE(i,e){return!!(i&e)}function Op(i,e){return i===e}var jr=class{constructor(e,t){if(!Upe(e))throw new Error(`literal expressions must have a specific type, got ${rd(e)}`);this.type=e,this.value=t}},XE=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function $E(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function us(i,e,t){switch(typeof i){case"boolean":{if(Op(e,ia))return new jr(ia,i?"true":"false");if(!Xy(e,na))throw new Error(`got a boolean, but expected ${rd(e)}`);return new jr(na,i)}case"number":{if(Op(e,mA))return new jr(mA,as(i));if(Op(e,na))return new jr(na,!!i);if(Op(e,ia))return new jr(ia,i.toString());if(!Xy(e,ci))throw new Error(`got a number, but expected ${rd(e)}`);return new jr(ci,i)}case"string":{if(Op(e,Ia))return new jr(Ia,Iy(i));if(Op(e,na))return new jr(na,!!i);if(!Xy(e,ia))throw new Error(`got a string, but expected ${rd(e)}`);return new jr(ia,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 Zpe(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Op(e,mA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new jr(mA,i)}if(Op(e,Ia)){if(i.length===3)return new jr(Ia,[...i,1]);if(i.length===4)return new jr(Ia,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!Xy(e,sd))throw new Error(`got an array of numbers, but expected ${rd(e)}`);return new jr(sd,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"},kpe={[et.Get]:Un(ti(1,1/0),o$),[et.Var]:zpe(),[et.Has]:Un(ti(1,1/0),o$),[et.Id]:Un(Vpe,fv),[et.Concat]:Un(ti(2,1/0),Qi(ia)),[et.GeometryType]:Un(Gpe,fv),[et.LineMetric]:Un(qpe,fv),[et.Resolution]:Un(N5,fv),[et.Zoom]:Un(N5,fv),[et.Time]:Un(N5,fv),[et.Any]:Un(ti(2,1/0),Qi(na)),[et.All]:Un(ti(2,1/0),Qi(na)),[et.Not]:Un(ti(1,1),Qi(na)),[et.Equal]:Un(ti(2,2),l$()),[et.NotEqual]:Un(ti(2,2),l$()),[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),a$),[et.Coalesce]:Un(ti(2,1/0),a$),[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),c$,Wpe),[et.Between]:Un(ti(3,3),Qi(ci)),[et.Interpolate]:Un(ti(6,1/0),c$,jpe),[et.Case]:Un(ti(3,1/0),Hpe,Xpe),[et.In]:Un(ti(2,2),$pe),[et.Number]:Un(ti(1,1/0),Qi(jE)),[et.String]:Un(ti(1,1/0),Qi(jE)),[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),Ype),[et.ToString]:Un(ti(1,1),Qi(na|ci|ia|Ia))};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 jr(ci,o);break}case"string":{r[s]=new jr(ia,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 zpe(){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=us(s,jE,t);if(!(o instanceof jr))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&HE(r,Ia)&&!HE(r,ia)?a=Ia:Array.isArray(s)&&s.length===2&&HE(r,mA)&&!HE(r,sd)&&(a=mA),r&=a,r===WE)throw new Error(`the type expected from the var operator (${rd(e)}) did not have any overlap with the type of the corresponding style variables (${rd(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===WE)throw new Error(`a new type expected from the var operator (${rd(e)}) did not have any overlap with the previous type expected for it (${rd(o)}), variable name: ${n}`)}return t.variables.set(n,r),new XE(r,"var",new jr(ia,n))}}function Vpe(i,e,t){t.featureId=!0}function Gpe(i,e,t){t.geometryType=!0}function qpe(i,e,t){t.mCoordinate=!0}function N5(i,e,t){t.mapState=!0}function fv(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 a$(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=us(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=us(e[o+1],i,n);s[o]=a}return s}}function l$(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=jE;for(let a=0;a<r;++a){let l=us(i[a+1],o,t);o&=l.type}if(o===WE)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=us(i[a+1],o,t);s[a]=l}return s}}function Hpe(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 c$(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 Wpe(i,e,t){let n=i.length-1,r=us(i[i.length-1],e,t),s=ia|ci|na,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=us(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===WE)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=us(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=us(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[us(i[1],s,t),...o,r]}function jpe(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 jr(ci,r),o;try{o=us(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=us(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=us(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 Xpe(i,e,t){let n=us(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=us(i[s+1],na,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=us(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 $pe(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=ia:r=ci;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=us(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[us(i[1],r,t),...s]}function Ype(i,e,t){let n;try{n=us(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=us(r[o],Ia,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof jr))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 XE(t,r,...s)}}function Zpe(i,e,t){let n=i[0],r=kpe[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function YE(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 YE(i.getGeometries()[0]);default:return""}}function B5(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function wu(i,e,t){let n=us(i,e,t);return bu(n,t)}function bu(i,e){if(i instanceof jr){if(i.type===Ia&&typeof i.value=="string"){let n=Iy(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 Kpe(i,e);case et.Get:case et.Var:case et.Has:return Qpe(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=>bu(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 e0e(i,e);case et.Equal:case et.NotEqual:case et.LessThan:case et.LessThanOrEqualTo:case et.GreaterThan:case et.GreaterThanOrEqualTo:return Jpe(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 t0e(i,e);case et.Case:return n0e(i,e);case et.Match:return i0e(i,e);case et.Interpolate:return r0e(i,e);case et.ToString:return s0e(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function Kpe(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=bu(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 Qpe(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 Jpe(i,e){let t=i.operator,n=bu(i.args[0],e),r=bu(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 e0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=bu(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 t0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=bu(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 n0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=bu(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 i0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=bu(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 r0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=bu(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=Uj(f)),u>=o)return c===2?f:d?o0e(s,o,a,l,u,f):$y(s,o,a,l,u,f);a=u,l=f}return l}}function s0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=bu(i.args[s],e);if(t===et.ToString)return s=>{let o=r[0](s);return i.args[0].type===Ia?Py(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function $y(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 o0e(i,e,t,n,r,s){if(r-t===0)return n;let a=SN(n),l=SN(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[$y(i,e,t,a[0],r,l[0]),$y(i,e,t,a[1],r,l[1]),a[2]+$y(i,e,t,0,r,c),$y(i,e,t,n[3],r,s[3])];return kj(u)}function a0e(i){return!0}function l0e(i,e){e=e??$E();let t=c0e(i,e),n=B5();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=YE(r.getGeometry())),t(n)}}function u$(i,e){e=e??$E();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=O5(i[o],e);let r=B5(),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=YE(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 p$(i,e){if(e=e??$E(),!Array.isArray(i))return u$([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 l0e(s,e)}return u$(i,e)}function c0e(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?wu(s.filter,na,e):a0e,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=O5(s.style[c],e)}else a=[O5(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 O5(i,e){let t=Yy(i,"",e),n=Zy(i,"",e),r=u0e(i,e),s=h0e(i,e),o=Fo(i,"z-index",e);if(!t&&!n&&!r&&!s&&!cu(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new ks;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 Yy(i,e,t){let n;if(e+"fill-pattern-src"in i)n=m0e(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=KE(i,e+"fill-color",t)}if(!n)return null;let r=new cs;return function(s){let o=n(s);return o===vE?null:(r.setColor(o),r)}}function Zy(i,e,t){let n=Fo(i,e+"stroke-width",t),r=KE(i,e+"stroke-color",t);if(!n&&!r)return null;let s=od(i,e+"stroke-line-cap",t),o=od(i,e+"stroke-line-join",t),a=m$(i,e+"stroke-line-dash",t),l=Fo(i,e+"stroke-line-dash-offset",t),c=Fo(i,e+"stroke-miter-limit",t),u=Fo(i,e+"stroke-offset",t),f=new Po;return function(d){if(r){let A=r(d);if(A===vE)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 u0e(i,e){let t="text-",n=od(i,t+"value",e);if(!n)return null;let r=Yy(i,t,e),s=Yy(i,t+"background-",e),o=Zy(i,t,e),a=Zy(i,t+"background-",e),l=od(i,t+"font",e),c=Fo(i,t+"max-angle",e),u=Fo(i,t+"offset-x",e),f=Fo(i,t+"offset-y",e),d=dv(i,t+"overflow",e),A=od(i,t+"placement",e),y=Fo(i,t+"repeat",e),w=QE(i,t+"scale",e),S=dv(i,t+"rotate-with-view",e),T=Fo(i,t+"rotation",e),R=od(i,t+"align",e),P=od(i,t+"justify",e),I=od(i,t+"baseline",e),F=dv(i,t+"keep-upright",e),D=m$(i,t+"padding",e),L=JE(i,t+"declutter-mode"),C=new nd({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 h0e(i,e){return"icon-src"in i?f0e(i,e):"shape-points"in i?d0e(i,e):"circle-radius"in i?p0e(i,e):null}function f0e(i,e){let t="icon-",n=t+"src",r=A$(i[n],n),s=ZE(i,t+"anchor",e),o=QE(i,t+"scale",e),a=Fo(i,t+"opacity",e),l=ZE(i,t+"displacement",e),c=Fo(i,t+"rotation",e),u=dv(i,t+"rotate-with-view",e),f=f$(i,t+"anchor-origin"),d=d$(i,t+"anchor-x-units"),A=d$(i,t+"anchor-y-units"),y=ad(i,t+"color"),w,S=null;y!==void 0&&(Array.isArray(y)&&y.length>0&&typeof y[0]=="string"?S=KE(i,t+"color",e):w=g$(y,t+"color"));let T=g0e(i,t+"cross-origin"),R=v0e(i,t+"offset"),P=f$(i,t+"offset-origin"),I=U5(i,t+"width"),F=U5(i,t+"height"),D=A0e(i,t+"size"),L=JE(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 cA(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 d0e(i,e){let t="shape-",n=t+"points",r=t+"radius",s=k5(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=Fo(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=Fo(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=Yy(i,t,e),d=Zy(i,t,e),A=QE(i,t+"scale",e),y=ZE(i,t+"displacement",e),w=Fo(i,t+"rotation",e),S=dv(i,t+"rotate-with-view",e),T=U5(i,t+"angle"),R=JE(i,t+"declutter-mode"),P=new SE({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 p0e(i,e){let t="circle-",n=Yy(i,t,e),r=Zy(i,t,e),s=Fo(i,t+"radius",e),o=QE(i,t+"scale",e),a=ZE(i,t+"displacement",e),l=Fo(i,t+"rotation",e),c=dv(i,t+"rotate-with-view",e),u=JE(i,t+"declutter-mode"),f=new TE({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 ad(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function Fo(i,e,t){let n=ad(i,e);if(n===void 0)return;let r=wu(n,ci,t);return function(s){return k5(r(s),e)}}function od(i,e,t){let n=ad(i,e);if(n===void 0)return null;let r=wu(n,ia,t);return function(s){return A$(r(s),e)}}function m0e(i,e,t){let n=od(i,e+"pattern-src",t),r=h$(i,e+"pattern-offset",t),s=h$(i,e+"pattern-size",t),o=KE(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function dv(i,e,t){let n=ad(i,e);if(n===void 0)return null;let r=wu(n,na,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function KE(i,e,t){let n=ad(i,e);if(n===void 0)return null;let r=wu(n,Ia,t);return function(s){return g$(r(s),e)}}function m$(i,e,t){let n=ad(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=wu(o,ci,t);return function(c){return k5(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=wu(n,sd,t);return function(s){return Ky(r(s),e)}}function ZE(i,e,t){let n=ad(i,e);if(n===void 0)return null;let r=wu(n,sd,t);return function(s){let o=Ky(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function h$(i,e,t){let n=ad(i,e);if(n===void 0)return null;let r=wu(n,sd,t);return function(s){return v$(r(s),e)}}function QE(i,e,t){let n=ad(i,e);if(n===void 0)return null;let r=wu(n,sd|ci,t);return function(s){return _0e(r(s),e)}}function U5(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 A0e(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return as(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 g0e(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 f$(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 d$(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 v0e(i,e){let t=i[e];if(t!==void 0)return Ky(t,e)}function JE(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 Ky(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 A$(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function k5(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function g$(i,e){if(typeof i=="string")return i;let t=Ky(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 v$(i,e){let t=Ky(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function _0e(i,e){return typeof i=="number"?i:v$(i,e)}var _$={RENDER_ORDER:"renderOrder"},z5=class extends dA{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(_$.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 pA(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(_$.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?ON:e;let t=x0e(e);this.styleFunction_=e===null?void 0:Kj(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function x0e(i){if(i===void 0)return ON;if(!i)return null;if(typeof i=="function"||i instanceof ks)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof ks){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof ks))throw new Error("Expected a list of style instances");n[r]=s}return n}return p$(i)}var e3=z5;var V5=class extends mo{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},t3=V5;var G5=class extends Sp{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){ei()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;Io(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),KT(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=DT(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()&&qy(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,Yf,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){ei()}scheduleExpireIconCache(e){ea.canExpireCache()&&e.postRenderFunctions.push(y0e)}};function y0e(i,e){ea.expire()}var x$=G5;var q5=class extends x${constructor(e){super(e),this.fontChangeListenerKey_=qn(aA,pu.PROPERTYCHANGE,e.redrawText,e),this.element_=no?$T():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Lp+" 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 t3(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(No.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof e3&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;Vl(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(!qy(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),HW(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,d=u.style.backgroundColor;if(d&&(!Vl(f)||f.width>0)&&(a.fillStyle=d,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!Vl(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(...ZT(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(No.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))}}},y$=q5;function b$(i){if(i instanceof dA){i.setMapInternal(null);return}i instanceof Gy&&i.getLayers().forEach(b$)}function w$(i,e){if(i instanceof dA){i.setMapInternal(e);return}if(i instanceof Gy){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)w$(t[n],e)}}var H5=class extends Us{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=b0e(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:UW,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Ao(),this.pixelToCoordinateTransform_=Ao(),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 Lo:DE()),this.interactions=t.interactions||(no?new Lo:kE({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new PX(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Do.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Do.VIEW,this.handleViewChanged_),this.addChangeListener(Do.SIZE,this.handleSizeChanged_),this.addChangeListener(Do.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof Gl)&&e.view.then(function(r){n.setView(new Gl(r))}),this.controls.addEventListener(go.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(go.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(go.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(go.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(go.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(go.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){w$(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:Yf,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 Gy?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:Yf,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(Do.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return my(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?Wr(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(Do.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof Lo){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=hu(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?Wr(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(Do.SIZE)}getView(){return this.get(Do.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 LX(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new vh(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===ky.POINTERDOWN||n===rn.WHEEL||n===rn.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[ro.ANIMATING]||o[ro.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(No.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(No.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Np(_h.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Np(_h.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(rn.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(rn.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Vl(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(Vl(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new y$(this)),!Vl(t)){this.mapBrowserEventHandler_=new RX(this,this.moveTolerance_);for(let r in Ar)this.mapBrowserEventHandler_.addEventListener(Ar[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(rn.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(rn.WHEEL,this.boundHandleBrowserEvent_,XT?{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,rn.KEYDOWN,this.handleBrowserEvent,this),qn(n,rn.KEYPRESS,this.handleBrowserEvent,this)],!Vl(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,pu.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=qn(e,rn.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 yu("addlayer",e)),this.layerGroupPropertyListenerKeys_=[qn(e,pu.PROPERTYCHANGE,this.render,this),qn(e,rn.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){b$(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&&wD(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:hy(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=hy(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_||!ch(this.previousExtent_)&&!jm(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Np(_h.MOVESTART,this,r)),this.previousExtent_=Wm(this.previousExtent_)),this.previousExtent_&&!s.viewHints[ro.ANIMATING]&&!s.viewHints[ro.INTERACTING]&&!jm(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Np(_h.MOVEEND,this,s)),TT(s.extent,this.previousExtent_))),this.dispatchEvent(new Np(_h.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(_h.LOADSTART)||this.hasListener(_h.LOADEND)||this.hasListener(No.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 yu("removelayer",t)),this.set(Do.LAYERGROUP,e)}setSize(e){this.set(Do.SIZE,e)}setTarget(e){this.set(Do.TARGET,e)}setView(e){if(!e||e instanceof Gl){this.set(Do.VIEW,e);return}this.set(Do.VIEW,new Gl);let t=this;e.then(function(n){t.setView(new Gl(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(Vl(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)],!wD(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&IT("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!Jo(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function b0e(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 Gy({layers:i.layers});t[Do.LAYERGROUP]=n,t[Do.TARGET]=i.target,t[Do.VIEW]=i.view instanceof Gl?i.view:new Gl;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new Lo(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 Lo(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 Lo(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 Lo,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var S$=H5;function n3(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var w0e=new Error("disposed");var S0e=[256,256],W5=class extends X1{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=n3(this.data_);return e?[e.width,e.height]:S0e}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(w0e),this.controller_=null),super.disposeInternal()}},j5=W5;var X5=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 Sp&&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}},$5=X5;var Y5=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(vy(),{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}},i3=Y5;var T0e=5,Z5=class extends JT{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=T0e,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(rn.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()}},T$=Z5;var Q5=[],pv=null;function E0e(){pv=Di(1,1,void 0,{willReadFrequently:!0})}var K5=class extends T${constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Ao(),this.pixelTransform=Ao(),this.inversePixelTransform=Ao(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){pv||E0e(),pv.clearRect(0,0,1,1);let r;try{pv.drawImage(e,t,n,1,1,0,0,1,1),r=pv.getImageData(0,0,1,1).data}catch{return pv=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(Vl(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&&Jo(Rc(e.style.backgroundColor),Rc(n)))){let c=e.firstElementChild;Vl(c)&&(l=c.getContext("2d"))}if(l&&KW(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?$T():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=Tc(n),s=N1(n),o=D1(n),a=L1(n);Wr(t.coordinateToPixelTransform,r),Wr(t.coordinateToPixelTransform,s),Wr(t.coordinateToPixelTransform,o),Wr(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;Wr(l,r),Wr(l,s),Wr(l,o),Wr(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(Lr(n)/r*o);Io(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),KT(this.inversePixelTransform,this.pixelTransform);let c=ZW(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 t3(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(No.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(No.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new i3),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(No.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(No.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 Io(this.tempTransform,l,c,u,f,-n,d,A)}disposeInternal(){delete this.frameState,super.disposeInternal()}},r3=K5;function J5(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 M0e(i,e,t){let n=i[t];return n?n.delete(e):!1}function E$(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=lh(e,fu(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=lh(e,r))}return e}var e6=class extends r3{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=Hr(),this.tempTileRange_=new GT(0,0,0,0),this.tempTileCoord_=q1(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new $5(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new $5(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=H1(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||z1(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=Wr(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!ou(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=as(l.getTileSize(u)),w=l.getResolution(u),S;if(d instanceof YT||d instanceof QT)S=d.getImage();else if(d instanceof j5){if(S=n3(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?lD(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||!J5(r,F,S))continue;let L=F.getKey();if(f[L]=!0,F.getState()===an.IDLE&&!e.tileQueue.isKeyQueued(L)){let C=q1(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=H1(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)),J5(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=H1(l,c,n,u,f),A=!1;if(a.containsKey(d)){let y=a.peek(d);y.getState()===an.LOADED&&(J5(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?fu(n.extent,s):null,this.layerExtent&&(y=lh(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=E$(e,e.nextExtent);this.enqueueTiles(e,J,$,F,D)}let L=E$(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)){M0e(F,$,d),e.animate=!0;continue}if(this.findAltTiles_(f,te,d+1,F))continue;let ge=f.getMinZoom();for(let Re=d-1;Re>=ge&&!this.findAltTiles_(f,te,Re,F);--Re);}let k=A/o*l/w,z=this.getRenderContext(e);Io(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(fl);let W=[],Y=[],H=[];for(let $=G.length-1;$>=0;--$){let J=G[$],te=u.getTilePixelSize(J,l,s),he=f.getResolution(J)/A,ge=te[0]*he*k,Re=te[1]*he*k,Qe=f.getTileCoordForCoordAndZ(Tc(I),J),Fe=f.getTileCoordExtent(Qe),mt=Wr(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)*ge),It=Qe[2]-Ye[2],dn=Math.round(mt[1]-(It-1)*Re),Gt=Math.round(mt[0]-Mt*ge),$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]&&Dr(yt,W[tn])&&hn.push(W[tn]);let en;hn.length>0&&(en=jH(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:ge,h:Re,gutter:Qe}=H[$];this.drawTile(te,e,ce,he,ge,Re,Qe,!0,void 0)}if(this.renderedResolution=A,this.extentChanged=!this.renderedExtent_||!jm(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],ge=he?Object.keys(he).length:0;this.updateCacheSize(ge),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 j5){if(u=n3(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}},M$=e6;var Qy={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var t6=class extends dA{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(Qy.PRELOAD)}setPreload(e){this.set(Qy.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(Qy.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(Qy.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},C$=t6;var n6=class extends C${constructor(e){super(e)}createRenderer(){return new M$(this,{cacheSize:this.getCacheSize()})}},i6=n6;var r6=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){}},s3=r6;var Jy={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},e2=[Jy.FILL],bh=[Jy.STROKE],ld=[Jy.BEGIN_PATH],s6=[Jy.CLOSE_PATH],vn=Jy;var o6=class extends s3{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],ou(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=ST(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,by,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,d,e,r||n,by,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,J1,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,f,e,r||n,J1,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,ph,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,ph,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([vn.CUSTOM,l,u,e,n,ph,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,ph,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,SW(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=pl(n||io)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=pl(n||ta);let r=e.getLineCap();t.lineCap=r!==void 0?r:Ah;let s=e.getLineDash();t.lineDash=s?s.slice():ml;let o=e.getLineDashOffset();t.lineDashOffset=o||Al;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:gh;let l=e.getWidth();t.lineWidth=l!==void 0?l:td;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:Jf;let u=e.getOffset();t.strokeOffset=u??qj,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&&!Jo(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_=TT(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;I1(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},wh=o6;var a6=class extends wh{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&&!ou(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||ou(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}},R$=a6;var l6=class extends wh{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,ta,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,ml,Al],ld);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(bh),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,ta,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,ml,Al],ld);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(bh),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(bh),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(bh),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(ld)}},I$=l6;var c6=class extends wh{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(ld),this.hitDetectionInstructions.push(ld);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(s6),this.hitDetectionInstructions.push(s6)),t=f}return a&&(this.instructions.push(e2),this.hitDetectionInstructions.push(e2)),l&&(this.instructions.push(bh),this.hitDetectionInstructions.push(bh)),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,ta,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,ml,Al]);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(ld,f),this.hitDetectionInstructions.push(ld,f),r.fillStyle!==void 0&&(this.instructions.push(e2),this.hitDetectionInstructions.push(e2)),r.strokeStyle!==void 0&&(this.instructions.push(bh),this.hitDetectionInstructions.push(bh)),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,ta,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,ml,Al]);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,ta,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,ml,Al]);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]=Rp(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}},u6=c6;var h6=0,f6=1;function C0e(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 h6=u,f6=f,!0}function P$(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(C0e(r,s,o,a,T,R,F,D)){let L=F-T,C=D-R,B=T+h6*L,k=R+h6*C,z=T+f6*L,G=R+f6*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 L$(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=Qo(c,f,y),S=Qo(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=Qo(c,f,y/A),S=Qo(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 D$(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 t2={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},d6=class extends wh{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(!Dr(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")&&!ah(this.getBufferedMaxExtent(),d)){let T=P$(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=L$(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=D$(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!=ed&&(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==ed?ed: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]=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,P,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||Dp,justify:t.justify,textBaseline:t.textBaseline||lA,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=t2[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=pl(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()||Ah,s.lineDash=w?w.slice():ml,s.lineDashOffset=S===void 0?Al:S,s.lineJoin=a.getLineJoin()||gh,s.lineWidth=T===void 0?td:T,s.miterLimit=R===void 0?Jf:R,s.strokeStyle=pl(a.getColor()||ta)}n=this.textState_;let l=e.getFont()||bE;Hj(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()||lA,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||ed,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}},N$=d6;var R0e={Circle:u6,Default:wh,Image:R$,LineString:I$,Polygon:u6,Text:N$},p6=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=R0e[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},F$=p6;function B$(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}function o3(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]=I0e(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 I0e(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=JH([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 a3(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 m6;function P0e(){return m6||(m6=new Intl.Segmenter(void 0,{granularity:"grapheme"})),m6}function O$(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=Qo(w,A,I),D=Qo(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=Qo(w,A,I),z=Qo(S,y,I),G=!1;if(d)if(f){let te=[F,D,k,z];rE(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(P0e().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 ge=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===ge)continue;let Qe=(G?J.slice(ce-te,ce-ge):J.slice(ge,te)).join("");I=T===0?0:(s+Re/2-R)/T;let Fe=Qo(w,A,I),mt=Qo(S,y,I);Y.push([Fe,mt,Re/2,he,Qe]),s+=Re}return Y}var mv=Hr(),Up=[],cd=[],ud=[],kp=[];function U$(i){return i[3].declutterBox}var k$=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function A6(i,e){return e==="start"?e=k$.test(i)?"right":"left":e==="end"&&(e=k$.test(i)?"left":"right"),t2[e]}function L0e(i,e,t){return t>0&&i.push(`8+`,""),i.push(e,""),i}function D0e(i,e,t){return t%2===0&&(i+=e),i}var g6=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_=Ao(),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 i3: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?t2[l.justify]:A6(Array.isArray(e)?e[0]:e,l.textAlign||Dp),d=r&&o.lineWidth?o.lineWidth:0,A=Array.isArray(e)?e:String(e).split(`9+`).reduce(L0e,[]),{width:y,height:w,widths:S,heights:T,lineWidths:R}=Xj(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 ge=[ce,B+C*S[Y]+f*(S[Y]-R[H]),.5*(d+G)+W];B+=S[Y],r&&k.push("strokeText",ge),n&&z.push("fillText",ge),++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)&&(Up[0]=L,kp[0]=L,Up[1]=C,cd[1]=C,cd[0]=L+F,ud[0]=cd[0],ud[1]=C+D,kp[1]=ud[1]);let B;return f!==0?(B=Io(Ao(),n,r,1,1,f,-n,-r),Wr(B,Up),Wr(B,cd),Wr(B,ud),Wr(B,kp),zl(Math.min(Up[0],cd[0],ud[0],kp[0]),Math.min(Up[1],cd[1],ud[1],kp[1]),Math.max(Up[0],cd[0],ud[0],kp[0]),Math.max(Up[1],cd[1],ud[1],kp[1]),mv)):zl(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:P,drawImageH:I,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,Up,cd,ud,kp,o,a),$j(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=Wr(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=A6(Array.isArray(e)?e[0]:e,s.textAlign||Dp),u=t2[s.textBaseline||lA],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_&&Jo(n,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=dl(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),YW(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,ge,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&&!Dr(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],ve=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 ns=Fe[23];S=(Fn.anchorX-ns)*this.pixelRatio,Fe[4]=S;let Pr=Fe[24];T=(Fn.anchorY-Pr)*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=ed,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,ve,s,Z,!!Te||!!Pe,he),ns=[e,t,C,Fn,yt,Te,Pe];if(l){let Pr,Ll,ba;if(zn){let _r=y-A;if(!zn[_r]){zn[_r]={args:ns,declutterMode:P};continue}let Zs=zn[_r];Pr=Zs.args,Ll=Zs.declutterMode,delete zn[_r],ba=U$(Pr)}let Dl,nl;if(Pr&&(Ll!=="declutter"||!l.collides(ba))&&(Dl=!0),(P!=="declutter"||!l.collides(Fn.declutterBox))&&(nl=!0),Ll==="declutter"&&P==="declutter"){let _r=Dl&&nl;Dl=_r,nl=_r}Dl&&(Ll!=="none"&&l.insert(ba),this.replayImageOrLabel_.apply(this,Pr)),nl&&(P!=="none"&&l.insert(Fn.declutterBox),this.replayImageOrLabel_.apply(this,ns))}else this.replayImageOrLabel_.apply(this,ns)}++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],sn=Fe[7],Lt=Fe[8];z=Fe[9];let Rt=Fe[10];B=Fe[11],Array.isArray(B)&&(B=B.reduce(D0e,"")),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]*sn,ye.scale[1]*sn],St;wt in this.widths_?St=this.widths_[wt]:(St={},this.widths_[wt]=St);let Bt=B$(u,vt,Tt,2),ut=Math.abs(Ze[0])*RN(wt,B,St);if(Je||ut<=Bt){let Fn=this.textStates[k].textAlign,ns=(Bt-ut)*A6(B,Fn),Pr=O$(u,vt,Tt,2,B,ns,Pt,Math.abs(Ze[0]),RN,wt,St,J?0:this.viewRotation_,wn);e:if(Pr){let Ll=[],ba,Dl,nl,_r,Zs;if(z)for(ba=0,Dl=Pr.length;ba<Dl;++ba){Zs=Pr[ba],nl=Zs[4],_r=this.createLabel(nl,k,"",z),S=Zs[2]+(Ze[0]<0?-Rt:Rt)-Dn,T=qe*_r.height+(.5-qe)*2*Rt*Ze[1]/Ze[0]-Lt;let Nl=this.calculateImageOrLabelDimensions_(_r.width,_r.height,Zs[0],Zs[1],_r.width,_r.height,S,T,0,0,Zs[3],fn,!1,ed,!1,he);if(l&&P==="declutter"&&l.collides(Nl.declutterBox))break e;Ll.push([e,t,_r,Nl,1,null,null])}if(G)for(ba=0,Dl=Pr.length;ba<Dl;++ba){Zs=Pr[ba],nl=Zs[4],_r=this.createLabel(nl,k,G,""),S=Zs[2]-Dn,T=qe*_r.height-Lt;let Nl=this.calculateImageOrLabelDimensions_(_r.width,_r.height,Zs[0],Zs[1],_r.width,_r.height,S,T,0,0,Zs[3],fn,!1,ed,!1,he);if(l&&P==="declutter"&&l.collides(Nl.declutterBox))break e;Ll.push([e,t,_r,Nl,1,null,null])}l&&P!=="none"&&l.load(Ll.map(U$));for(let Nl=0,Ju=Ll.length;Nl<Ju;++Nl)this.replayImageOrLabel_.apply(this,Ll[Nl])}}++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 ns=(Fe[4]??!1)||Math.abs(u[A]-u[y-2])<1e-6&&Math.abs(u[A+1]-u[y-1])<1e-6;o3(u,A,y,2,R,ns,w),a3(w,2,ns),Ce=w,Yt=0,nr=Ce.length}else Ce=u,Yt=A,nr=y;ge=Ce[Yt],Re=Ce[Yt+1],e.moveTo(ge,Re),I=ge+.5|0,F=Re+.5|0;for(let Fn=Yt+2;Fn<nr;Fn+=2)ge=Ce[Fn],Re=Ce[Fn+1],D=ge+.5|0,L=Re+.5|0,(Fn==nr-2||D!==I||L!==F)&&(e.lineTo(ge,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)}},z$=g6;var zp=["Polygon","Circle","LineString","Image","Text","Default"],x6=["Image","Text"],V$=zp.filter(i=>!x6.includes(i)),G$=!1,q$=!1;function N0e(){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};G$={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],q$=!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_=Ao(),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 z$(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){q$===!1&&N0e(),r=Math.round(r);let a=r*2+1,l=Io(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:G$}));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=Hr(),Xm(f,e),I1(f,t*(this.renderBuffer_+r),f));let d=F0e(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(fl);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=zp.length-1;T>=0;--T)if(A=zp[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 dl(a,0,8,2,e,a),a}isEmpty(){return cu(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?wW:fl),o=o||zp;let c=zp.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+zp.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(fl);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}},v6={};function F0e(i){if(v6[i]!==void 0)return v6[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 v6[i]=r,r}var H$=_6;var y6=class extends s3{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?$m(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_=Ao()}drawImages_(e,t,n,r){if(!this.image_)return;let s=dl(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_;Io(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=dl(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=dl(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=o3(l,0,u,2,o,f,l),a3(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_)),!!Dr(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=mj(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_)),!!Dr(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(Dr(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_)),!!Dr(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_)),!!Dr(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),Jo(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:Dp;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:pl(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||ml,f=t.getOffset();this.strokeState_={lineCap:r!==void 0?r:Ah,lineDash:this.pixelRatio_===1?u:u.map(d=>d*this.pixelRatio_),lineDashOffset:(o||Al)*this.pixelRatio_,lineJoin:a!==void 0?a:gh,lineWidth:(l!==void 0?l:td)*this.pixelRatio_,miterLimit:c!==void 0?c:Jf,strokeStyle:pl(n||ta),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:pl(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(),P=n.getMiterLimit();this.textStrokeState_={lineCap:y!==void 0?y:Ah,lineDash:w||ml,lineDashOffset:S||Al,lineJoin:T!==void 0?T:gh,lineWidth:R!==void 0?R:td,miterLimit:P!==void 0?P:Jf,strokeStyle:pl(A||ta)}}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:bE,textAlign:f!==void 0?f:Dp,textBaseline:d!==void 0?d:lA},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]]}}},W$=y6;var Su=.5;function j$(i,e,t,n,r,s,o,a,l){let c=l?yp(r,l):r,u=i[0]*Su,f=i[1]*Su,d=Di(u,f);d.imageSmoothingEnabled=!1;let A=d.canvas,y=new W$(d,Su,r,null,o,a,l?Km(Jm(),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||!Dr(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 ge=Di(he[0],he[1],void 0,{alpha:!1}),Re=ge.canvas;ge.fillStyle=C,ge.fillRect(0,0,Re.width,Re.height),W.setImage(new cA({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 ge=0,Re=he.length;ge<Re;++ge){let Qe=he[ge];te[Qe.getType().replace("Multi","")].push(Qe,W)}}else te[ce.replace("Multi","")].push(G,W)}}let R=Object.keys(T).map(Number).sort(fl);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 X$(i,e,t){let n=[];if(t){let r=Math.floor(Math.round(i[0])*Su),s=Math.floor(Math.round(i[1])*Su),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 B0e=.5,$$={Point:q0e,LineString:z0e,Polygon:W0e,MultiPoint:H0e,MultiLineString:V0e,MultiPolygon:G0e,GeometryCollection:k0e,Circle:O0e};function Y$(i,e){return parseInt(Bn(i),10)-parseInt(Bn(e),10)}function b6(i,e){let t=w6(i,e);return t*t}function w6(i,e){return B0e*i/e}function O0e(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 S6(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)),U0e(i,e,t,n,s,o,a),f}function U0e(i,e,t,n,r,s,o){let a=t.getGeometryFunction()(e);if(!a)return;let l=a.simplifyTransformed(n,r);if(t.getRenderer())Z$(i,l,t,e,o);else{let u=$$[l.getType()];u(i,l,t,e,o,s)}}function Z$(i,e,t,n,r){if(e.getType()=="GeometryCollection"){let o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)Z$(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function k0e(i,e,t,n,r,s){let o=e.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=$$[o[a].getType()];c(i,o[a],t,n,r,s)}}function z0e(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 V0e(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 G0e(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 q0e(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 H0e(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 W0e(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 T6=class extends r3{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_=Hr(),this.wrappedRenderedExtent_=Hr(),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[ro.ANIMATING]||y[ro.INTERACTING]),S=this.context,T=Math.round(Kn(r)/a*A),R=Math.round(Lr(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?zp:n?x6:V$,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,Q5))}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,nA(this.context),Q5.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(No.PRERENDER)||this.getLayer().hasListener(No.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=fu(n.extent,l);a=Dr(u,e.extent),a&&!ah(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]*Su,d=n[1]*Su;u.push(this.getRenderTransform(r,s,o,Su,f,d,0).slice());let A=c.getSource(),y=a.getExtent();if(A.getWrapX()&&a.canWrapX()&&!ah(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,Su,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,Su,f,d,P).slice()),S-=T}let w=Jm();this.hitDetectionImageData_=j$(n,u,this.renderedFeatures_,c.getStyleFunction(),l,s,o,b6(s,this.renderedPixelRatio_),w?a:null)}t(X$(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[ro.ANIMATING],s=e.viewHints[ro.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=Y$);let S=c.center.slice(),T=I1(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();$&&!ch($)&&(this.extendX_=$[0]<I[0]||$[2]>I[2])}if(F&&(!ah(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,DT(S,u);let he=uD(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&&ah(this.wrappedRenderedExtent_,T))return Jo(this.renderedExtent_,R)||(this.hitDetectionImageData_=null,this.renderedExtent_=R),this.renderedCenter_=S,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let D=new F$(w6(f,d),T,f,d),L=Jm(),C;if(L){for(let $=0,J=P.length;$<J;++$){let te=P[$],ce=yp(te,u);n.loadFeatures(ce,xW(f,u),L)}C=Km(L,u)}else for(let $=0,J=P.length;$<J;++$)n.loadFeatures(P[$],f,u);let B=b6(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=yp(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 H$(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=S6(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=S6(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}},K$=T6;var E6=class extends e3{constructor(e){super(e)}createRenderer(){return new K$(this)}},Q$=E6;var j0e=!1;function X0e(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=j0e,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 M6(i,e){return function(t,n,r,s,o){X0e(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function J$(i,e){return[[-1/0,-1/0,1/0,1/0]]}function C6(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=bW(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]:Qo(i[a+u],i[a+n+u],l);return s}var eY=Ao(),n2=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"?ET(this.flatCoordinates_):P1(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=hl(this.getExtent());this.flatInteriorPoints_=Ty(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=Pj(this.flatCoordinates_,this.ends_),t=fE(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_=C6(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=C6(e,t,o,this.stride_,.5);du(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=Lr(n)/Lr(t);Io(eY,n[0],n[3],r,-r,0,0,0),dl(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,eY,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=jT((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=wy(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=Mj(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=Sy(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}};n2.prototype.getFlatCoordinates=n2.prototype.getOrientedFlatCoordinates;var gA=n2;var R6=class{constructor(e){this.rbush_=new pA(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];jm(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 cu(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return zl(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]}},I6=R6;var ql={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Sh=class extends mo{constructor(e,t,n){super(e),this.feature=t,this.features=n}},P6=class extends tE{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_=Kf,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_=M6(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:J$;let t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new I6:null,this.loadedExtentsRtree_=new I6,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 Lo(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 Sh(ql.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof gA||(this.featureChangeKeys_[e]=[qn(t,rn.CHANGE,this.handleFeatureChange_,this),qn(t,pu.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 gA){let s=this.idIndex_[r];s instanceof gA?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(ql.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new Sh(ql.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(ql.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener(ql.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(go.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(go.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 Sh(ql.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 gA||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 gA||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(),cu(this.nullGeometryFeatures_)||du(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=RT(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||Yf,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){let u=c.getGeometry(),f=a;if(a=u instanceof gA?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 Sh(ql.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()&&cu(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 ah(u.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Sh(ql.FEATURESLOADSTART));let u=y=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Sh(ql.FEATURESLOADEND,void 0,y))},f=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Sh(ql.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=cD(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(ql.REMOVEFEATURE)&&this.dispatchEvent(new Sh(ql.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(M6(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},hd=P6;var Va={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},a0={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},dM=0,Y2=1,pM=2;var _8=0,l0=1,mM=2,Fc=3,Oo=0,mi=1,gr=2,ds=0,Ts=1,Lh=2,Dh=3,Nh=4,Cd=5,Z2=6,so=100,K2=101,Q2=102,AM=103,gM=104,Pu=200,J2=201,eb=202,tb=203,$p=204,Yp=205,nb=206,ib=207,rb=208,sb=209,ob=210,qY=211,HY=212,WY=213,jY=214,bA=0,wA=1,SA=2,Mh=3,TA=4,EA=5,MA=6,CA=7,WA=0,vM=1,_M=2,oo=0,ab=1,lb=2,cb=3,ub=4,x8=5,hb=6,fb=7;var db=300,Yl=301,Bc=302,c0=303,u0=304,Fh=306,yd=1e3,oa=1001,bd=1002,Ti=1003,pb=1004;var Oc=1005;var Mi=1006,h0=1007;var ko=1008,y8=1008,Ji=1009,Bh=1010,Oh=1011,xl=1012,Yr=1013,xi=1014,cr=1015,Wi=1016,jA=1017,XA=1018,la=1020,$A=35902,YA=35899,Qv=1021,Rd=1022,Br=1023,Vs=1026,_o=1027,Id=1028,Uh=1029,Ws=1030,kh=1031,mb=1032,f0=1033,zh=33776,Vh=33777,Gh=33778,qh=33779,ZA=35840,KA=35841,QA=35842,JA=35843,d0=36196,p0=37492,m0=37496,A0=37488,g0=37489,Hh=37490,v0=37491,_0=37808,x0=37809,y0=37810,b0=37811,w0=37812,S0=37813,T0=37814,E0=37815,M0=37816,C0=37817,R0=37818,I0=37819,P0=37820,L0=37821,D0=36492,N0=36494,F0=36495,B0=36283,O0=36284,Wh=36285,U0=36286;var A2=2300,V3=2301,k3=2302,o8=2303,a8=2400,l8=2401,c8=2402;var b8=0,w8=1,xM=2,XY=3200;var Zl=0,yM=1,ca="",Nr="srgb",Zp="srgb-linear",Kp="linear",kt="srgb",Ab="",bM="rg",S8="ga",T8=0,gd=7680,E8=7681,M8=7682,C8=7683,R8=34055,I8=34056,P8=5386,L8=512,D8=513,N8=514,F8=515,B8=516,O8=517,U8=518,g2=519,gb=512,Jv=513,vb=514,jh=515,eg=516,_b=517,Lu=518,xb=519,Qp=35044,tg=35048;var k8="300 es",Bo=2e3,gl=2001,Uc={COMPUTE:"compute",RENDER:"render"};var Pd={TEXTURE_COMPARE:"depthTextureCompare"};function $0e(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function e_(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function Bv(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function wM(){let i=Bv("canvas");return i.style.display="block",i}var tY={},Ov=null;function RA(...i){let e="THREE."+i.shift();Ov?Ov("log",e,...i):console.log(e,...i)}function $Y(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=$Y(i);let e="THREE."+i.shift();if(Ov)Ov("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function ze(...i){i=$Y(i);let e="THREE."+i.shift();if(Ov)Ov("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 tY||(tY[e]=!0,Xe(...i))}function z8(){return typeof self<"u"&&typeof self.scheduler<"u"&&typeof self.scheduler.yield<"u"?self.scheduler.yield():new Promise(i=>{requestAnimationFrame(i)})}function YY(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 yb={[bA]:wA,[SA]:MA,[TA]:CA,[Mh]:EA,[wA]:bA,[MA]:SA,[CA]:TA,[EA]:Mh},aa=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}}},ra=["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"],nY=1234567,f2=Math.PI/180,wd=180/Math.PI;function Eh(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(ra[i&255]+ra[i>>8&255]+ra[i>>16&255]+ra[i>>24&255]+"-"+ra[e&255]+ra[e>>8&255]+"-"+ra[e>>16&15|64]+ra[e>>24&255]+"-"+ra[t&63|128]+ra[t>>8&255]+"-"+ra[t>>16&255]+ra[t>>24&255]+ra[n&255]+ra[n>>8&255]+ra[n>>16&255]+ra[n>>24&255]).toLowerCase()}function Nn(i,e,t){return Math.max(e,Math.min(t,i))}function V8(i,e){return(i%e+e)%e}function Y0e(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function Z0e(i,e,t){return i!==e?(t-i)/(e-i):0}function d2(i,e,t){return(1-t)*i+t*e}function K0e(i,e,t,n){return d2(i,e,1-Math.exp(-t*n))}function Q0e(i,e=1){return e-Math.abs(V8(i,e*2)-e)}function J0e(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function eme(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function tme(i,e){return i+Math.floor(Math.random()*(e-i+1))}function nme(i,e){return i+Math.random()*(e-i)}function ime(i){return i*(.5-Math.random())}function rme(i){i!==void 0&&(nY=i);let e=nY+=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 sme(i){return i*f2}function ome(i){return i*wd}function ame(i){return(i&i-1)===0&&i!==0}function lme(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function cme(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function ume(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 Da(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 Du={DEG2RAD:f2,RAD2DEG:wd,generateUUID:Eh,clamp:Nn,euclideanModulo:V8,mapLinear:Y0e,inverseLerp:Z0e,lerp:d2,damp:K0e,pingpong:Q0e,smoothstep:J0e,smootherstep:eme,randInt:tme,randFloat:nme,randFloatSpread:ime,seededRandom:rme,degToRad:sme,radToDeg:ome,isPowerOfTwo:ame,ceilPowerOfTwo:lme,floorPowerOfTwo:cme,setQuaternionFromProperEuler:ume,normalize:Zn,denormalize:Da},j8=class j8{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}};j8.prototype.isVector2=!0;var Oe=j8,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),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}},X8=class X8{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(iY.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(iY.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 L6.copy(this).projectOnVector(e),this.sub(L6)}reflect(e){return this.sub(L6.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}};X8.prototype.isVector3=!0;var re=X8,L6=new re,iY=new Gs,$8=class $8{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(D6.makeScale(e,t)),this}rotate(e){return ni("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(D6.makeRotation(-e)),this}translate(e,t){return ni("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(D6.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)}};$8.prototype.isMatrix3=!0;var Mn=$8,D6=new Mn,rY=new Mn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),sY=new Mn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function hme(){let i={enabled:!0,workingColorSpace:Zp,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===kt&&(r.r=xd(r.r),r.g=xd(r.g),r.b=xd(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=Fv(r.r),r.g=Fv(r.g),r.b=Fv(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===ca?Kp: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({[Zp]:{primaries:e,whitePoint:n,transfer:Kp,toXYZ:rY,fromXYZ:sY,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Nr},outputColorSpaceConfig:{drawingBufferColorSpace:Nr}},[Nr]:{primaries:e,whitePoint:n,transfer:kt,toXYZ:rY,fromXYZ:sY,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Nr}}}),i}var ln=hme();function xd(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Fv(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Av,G3=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{Av===void 0&&(Av=Bv("canvas")),Av.width=e.width,Av.height=e.height;let r=Av.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Av}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=Bv("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]=xd(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(xd(t[n]/255)*255):t[n]=xd(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}},fme=0,Uv=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:fme++}),this.uuid=Eh(),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(N6(r[o].image)):s.push(N6(r[o]))}else s=N6(r);n.url=s}return t||(e.images[this.uuid]=n),n}};function N6(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?G3.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 dme=0,F6=new re,qs=class i extends aa{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=oa,r=oa,s=Mi,o=ko,a=Br,l=Ji,c=i.DEFAULT_ANISOTROPY,u=ca){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:dme++}),this.uuid=Eh(),this.name="",this.source=new Uv(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(F6).x}get height(){return this.source.getSize(F6).y}get depth(){return this.source.getSize(F6).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!==db)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case yd:e.x=e.x-Math.floor(e.x);break;case oa:e.x=e.x<0?0:1;break;case bd: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 yd:e.y=e.y-Math.floor(e.y);break;case oa:e.y=e.y<0?0:1;break;case bd: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=db;qs.DEFAULT_ANISOTROPY=1;var Y8=class Y8{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}};Y8.prototype.isVector4=!0;var xn=Y8,Na=class extends aa{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 Uv(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"})}},Fa=class extends Na{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},IA=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=oa,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var q3=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=oa,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var fM=class fM{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 fM().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/gv.setFromMatrixColumn(e,0).length(),s=1/gv.setFromMatrixColumn(e,1).length(),o=1/gv.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(pme,e,mme)}lookAt(e,t,n){let r=this.elements;return Hl.subVectors(e,t),Hl.lengthSq()===0&&(Hl.z=1),Hl.normalize(),Vp.crossVectors(n,Hl),Vp.lengthSq()===0&&(Math.abs(n.z)===1?Hl.x+=1e-4:Hl.z+=1e-4,Hl.normalize(),Vp.crossVectors(n,Hl)),Vp.normalize(),l3.crossVectors(Hl,Vp),r[0]=Vp.x,r[4]=l3.x,r[8]=Hl.x,r[1]=Vp.y,r[5]=l3.y,r[9]=Hl.y,r[2]=Vp.z,r[6]=l3.z,r[10]=Hl.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],ge=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*ge,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*ge,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*ge,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*ge,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=gv.set(r[0],r[1],r[2]).length(),a=gv.set(r[4],r[5],r[6]).length(),l=gv.set(r[8],r[9],r[10]).length();s<0&&(o=-o),Tu.copy(this);let c=1/o,u=1/a,f=1/l;return Tu.elements[0]*=c,Tu.elements[1]*=c,Tu.elements[2]*=c,Tu.elements[4]*=u,Tu.elements[5]*=u,Tu.elements[6]*=u,Tu.elements[8]*=f,Tu.elements[9]*=f,Tu.elements[10]*=f,t.setFromRotationMatrix(Tu),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=Bo,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===Bo)y=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(a===gl)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=Bo,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===Bo)y=-2/(o-s),w=-(o+s)/(o-s);else if(a===gl)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}};fM.prototype.isMatrix4=!0;var cn=fM,gv=new re,Tu=new cn,pme=new re(0,0,0),mme=new re(1,1,1),Vp=new re,l3=new re,Hl=new re,oY=new cn,aY=new Gs,Ba=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 oY.makeRotationFromQuaternion(e),this.setFromRotationMatrix(oY,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return aY.setFromEuler(this),this.setFromQuaternion(aY,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}};Ba.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}},Ame=0,lY=new re,vv=new Gs,fd=new cn,c3=new re,i2=new re,gme=new re,vme=new Gs,cY=new re(1,0,0),uY=new re(0,1,0),hY=new re(0,0,1),fY={type:"added"},_me={type:"removed"},_v={type:"childadded",child:null},B6={type:"childremoved",child:null},lr=class i extends aa{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Ame++}),this.uuid=Eh(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new re,t=new Ba,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 vv.setFromAxisAngle(e,t),this.quaternion.multiply(vv),this}rotateOnWorldAxis(e,t){return vv.setFromAxisAngle(e,t),this.quaternion.premultiply(vv),this}rotateX(e){return this.rotateOnAxis(cY,e)}rotateY(e){return this.rotateOnAxis(uY,e)}rotateZ(e){return this.rotateOnAxis(hY,e)}translateOnAxis(e,t){return lY.copy(e).applyQuaternion(this.quaternion),this.position.add(lY.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(cY,e)}translateY(e){return this.translateOnAxis(uY,e)}translateZ(e){return this.translateOnAxis(hY,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(fd.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?c3.copy(e):c3.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),i2.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?fd.lookAt(i2,c3,this.up):fd.lookAt(c3,i2,this.up),this.quaternion.setFromRotationMatrix(fd),r&&(fd.extractRotation(r.matrixWorld),vv.setFromRotationMatrix(fd),this.quaternion.premultiply(vv.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(fY),_v.child=e,this.dispatchEvent(_v),_v.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(_me),B6.child=e,this.dispatchEvent(B6),B6.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),fd.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),fd.multiply(e.parent.matrixWorld)),e.applyMatrix4(fd),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(fY),_v.child=e,this.dispatchEvent(_v),_v.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(i2,e,gme),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(i2,vme,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 Fr=class extends lr{constructor(){super(),this.isGroup=!0,this.type="Group"}},xme={type:"move"},Jp=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Fr,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 Fr,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 Fr,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(xme)))}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 Fr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},ZY={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},Gp={h:0,s:0,l:0},u3={h:0,s:0,l:0};function O6(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=Nr){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=V8(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=O6(o,s,e+1/3),this.g=O6(o,s,e),this.b=O6(o,s,e-1/3)}return ln.colorSpaceToWorking(this,r),this}setStyle(e,t=Nr){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=Nr){let n=ZY[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=xd(e.r),this.g=xd(e.g),this.b=xd(e.b),this}copyLinearToSRGB(e){return this.r=Fv(e.r),this.g=Fv(e.g),this.b=Fv(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Nr){return ln.workingToColorSpace(sa.copy(this),e),Math.round(Nn(sa.r*255,0,255))*65536+Math.round(Nn(sa.g*255,0,255))*256+Math.round(Nn(sa.b*255,0,255))}getHexString(e=Nr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ln.workingColorSpace){ln.workingToColorSpace(sa.copy(this),t);let n=sa.r,r=sa.g,s=sa.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(sa.copy(this),t),e.r=sa.r,e.g=sa.g,e.b=sa.b,e}getStyle(e=Nr){ln.workingToColorSpace(sa.copy(this),e);let t=sa.r,n=sa.g,r=sa.b;return e!==Nr?`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(Gp),this.setHSL(Gp.h+e,Gp.s+t,Gp.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(Gp),e.getHSL(u3);let n=d2(Gp.h,u3.h,t),r=d2(Gp.s,u3.s,t),s=d2(Gp.l,u3.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}},sa=new zt;zt.NAMES=ZY;var e0=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 Ba,this.environmentIntensity=1,this.environmentRotation=new Ba,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}},Eu=new re,dd=new re,U6=new re,pd=new re,xv=new re,yv=new re,dY=new re,k6=new re,z6=new re,V6=new re,G6=new xn,q6=new xn,H6=new xn,vd=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),Eu.subVectors(e,t),r.cross(Eu);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){Eu.subVectors(r,t),dd.subVectors(n,t),U6.subVectors(e,t);let o=Eu.dot(Eu),a=Eu.dot(dd),l=Eu.dot(U6),c=dd.dot(dd),u=dd.dot(U6),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,pd)===null?!1:pd.x>=0&&pd.y>=0&&pd.x+pd.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,pd)===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,pd.x),l.addScaledVector(o,pd.y),l.addScaledVector(a,pd.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return G6.setScalar(0),q6.setScalar(0),H6.setScalar(0),G6.fromBufferAttribute(e,t),q6.fromBufferAttribute(e,n),H6.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(G6,s.x),o.addScaledVector(q6,s.y),o.addScaledVector(H6,s.z),o}static isFrontFacing(e,t,n,r){return Eu.subVectors(n,t),dd.subVectors(e,t),Eu.cross(dd).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 Eu.subVectors(this.c,this.b),dd.subVectors(this.a,this.b),Eu.cross(dd).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;xv.subVectors(r,n),yv.subVectors(s,n),k6.subVectors(e,n);let l=xv.dot(k6),c=yv.dot(k6);if(l<=0&&c<=0)return t.copy(n);z6.subVectors(e,r);let u=xv.dot(z6),f=yv.dot(z6);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(xv,o);V6.subVectors(e,s);let A=xv.dot(V6),y=yv.dot(V6);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(yv,a);let S=u*y-A*f;if(S<=0&&f-u>=0&&A-y>=0)return dY.subVectors(s,r),a=(f-u)/(f-u+(A-y)),t.copy(r).addScaledVector(dY,a);let T=1/(S+w+d);return o=w*T,a=d*T,t.copy(n).addScaledVector(xv,o).addScaledVector(yv,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Oa=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(Mu.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Mu.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=Mu.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,Mu):Mu.fromBufferAttribute(s,o),Mu.applyMatrix4(e.matrixWorld),this.expandByPoint(Mu);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),h3.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),h3.copy(n.boundingBox)),h3.applyMatrix4(e.matrixWorld),this.union(h3)}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,Mu),Mu.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(r2),f3.subVectors(this.max,r2),bv.subVectors(e.a,r2),wv.subVectors(e.b,r2),Sv.subVectors(e.c,r2),qp.subVectors(wv,bv),Hp.subVectors(Sv,wv),vA.subVectors(bv,Sv);let t=[0,-qp.z,qp.y,0,-Hp.z,Hp.y,0,-vA.z,vA.y,qp.z,0,-qp.x,Hp.z,0,-Hp.x,vA.z,0,-vA.x,-qp.y,qp.x,0,-Hp.y,Hp.x,0,-vA.y,vA.x,0];return!W6(t,bv,wv,Sv,f3)||(t=[1,0,0,0,1,0,0,0,1],!W6(t,bv,wv,Sv,f3))?!1:(d3.crossVectors(qp,Hp),t=[d3.x,d3.y,d3.z],W6(t,bv,wv,Sv,f3))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Mu).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Mu).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:(md[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),md[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),md[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),md[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),md[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),md[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),md[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),md[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(md),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}},md=[new re,new re,new re,new re,new re,new re,new re,new re],Mu=new re,h3=new Oa,bv=new re,wv=new re,Sv=new re,qp=new re,Hp=new re,vA=new re,r2=new re,f3=new re,d3=new re,_A=new re;function W6(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){_A.fromArray(i,s);let a=r.x*Math.abs(_A.x)+r.y*Math.abs(_A.y)+r.z*Math.abs(_A.z),l=e.dot(_A),c=t.dot(_A),u=n.dot(_A);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var _d=yme();function yme(){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 Wl(i){Math.abs(i)>65504&&Xe("DataUtils.toHalfFloat(): Value out of range."),i=Nn(i,-65504,65504),_d.floatView[0]=i;let e=_d.uint32View[0],t=e>>23&511;return _d.baseTable[t]+((e&8388607)>>_d.shiftTable[t])}function p3(i){let e=i>>10;return _d.uint32View[0]=_d.mantissaTable[_d.offsetTable[e]+(i&1023)]+_d.exponentTable[e],_d.floatView[0]}var zs=new re,m3=new Oe,bme=0,Hi=class extends aa{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:bme++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Qp,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++)m3.fromBufferAttribute(this,t),m3.applyMatrix3(e),this.setXY(t,m3.x,m3.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=Da(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=Da(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=Da(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=Da(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=Da(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!==Qp&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var PA=class extends Hi{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var LA=class extends Hi{constructor(e,t,n){super(new Uint32Array(e),t,n)}},zv=class extends Hi{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=p3(this.array[e*this.itemSize]);return this.normalized&&(t=Da(t,this.array)),t}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize]=Wl(t),this}getY(e){let t=p3(this.array[e*this.itemSize+1]);return this.normalized&&(t=Da(t,this.array)),t}setY(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+1]=Wl(t),this}getZ(e){let t=p3(this.array[e*this.itemSize+2]);return this.normalized&&(t=Da(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+2]=Wl(t),this}getW(e){let t=p3(this.array[e*this.itemSize+3]);return this.normalized&&(t=Da(t,this.array)),t}setW(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+3]=Wl(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]=Wl(t),this.array[e+1]=Wl(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]=Wl(t),this.array[e+1]=Wl(n),this.array[e+2]=Wl(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]=Wl(t),this.array[e+1]=Wl(n),this.array[e+2]=Wl(r),this.array[e+3]=Wl(s),this}},Ln=class extends Hi{constructor(e,t,n){super(new Float32Array(e),t,n)}},wme=new Oa,s2=new re,j6=new re,vl=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):wme.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):(j6.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(s2.copy(e.center).add(j6)),this.expandByPoint(s2.copy(e.center).sub(j6))),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}},Sme=0,Dc=new cn,X6=new lr,Tv=new re,jl=new Oa,o2=new Oa,vo=new re,Xn=class i extends aa{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Sme++}),this.uuid=Eh(),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($0e(e)?LA:PA)(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 Dc.makeRotationFromQuaternion(e),this.applyMatrix4(Dc),this}rotateX(e){return Dc.makeRotationX(e),this.applyMatrix4(Dc),this}rotateY(e){return Dc.makeRotationY(e),this.applyMatrix4(Dc),this}rotateZ(e){return Dc.makeRotationZ(e),this.applyMatrix4(Dc),this}translate(e,t,n){return Dc.makeTranslation(e,t,n),this.applyMatrix4(Dc),this}scale(e,t,n){return Dc.makeScale(e,t,n),this.applyMatrix4(Dc),this}lookAt(e){return X6.lookAt(e),X6.updateMatrix(),this.applyMatrix4(X6.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Tv).negate(),this.translate(Tv.x,Tv.y,Tv.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 Oa);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?(vo.addVectors(this.boundingBox.min,jl.min),this.boundingBox.expandByPoint(vo),vo.addVectors(this.boundingBox.max,jl.max),this.boundingBox.expandByPoint(vo)):(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 vl);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];o2.setFromBufferAttribute(a),this.morphTargetsRelative?(vo.addVectors(jl.min,o2.min),jl.expandByPoint(vo),vo.addVectors(jl.max,o2.max),jl.expandByPoint(vo)):(jl.expandByPoint(o2.min),jl.expandByPoint(o2.max))}jl.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)vo.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(vo));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++)vo.fromBufferAttribute(a,c),l&&(Tv.fromBufferAttribute(e,c),vo.add(Tv)),r=Math.max(r,n.distanceToSquared(vo))}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++)vo.fromBufferAttribute(e,t),vo.normalize(),e.setXYZ(t,vo.x,vo.y,vo.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"})}},Sd=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Qp,this.updateRanges=[],this.version=0,this.uuid=Eh()}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=Eh()),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=Eh()),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}}},Pa=new re,Uo=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++)Pa.fromBufferAttribute(this,t),Pa.applyMatrix4(e),this.setXYZ(t,Pa.x,Pa.y,Pa.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Pa.fromBufferAttribute(this,t),Pa.applyNormalMatrix(e),this.setXYZ(t,Pa.x,Pa.y,Pa.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Pa.fromBufferAttribute(this,t),Pa.transformDirection(e),this.setXYZ(t,Pa.x,Pa.y,Pa.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Da(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=Da(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Da(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Da(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Da(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){RA("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){RA("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}}},Tme=0,Hs=class extends aa{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Tme++}),this.uuid=Eh(),this.name="",this.type="Material",this.blending=Ts,this.side=Oo,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=$p,this.blendDst=Yp,this.blendEquation=so,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new zt(0,0,0),this.blendAlpha=0,this.depthFunc=Mh,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=g2,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=gd,this.stencilZFail=gd,this.stencilZPass=gd,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!==Oo&&(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!==$p&&(n.blendSrc=this.blendSrc),this.blendDst!==Yp&&(n.blendDst=this.blendDst),this.blendEquation!==so&&(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!==Mh&&(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!==g2&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==gd&&(n.stencilFail=this.stencilFail),this.stencilZFail!==gd&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==gd&&(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++}},Ch=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}},Ev,a2=new re,Mv=new re,Cv=new re,Rv=new Oe,l2=new Oe,KY=new cn,A3=new re,c2=new re,g3=new re,pY=new Oe,$6=new Oe,mY=new Oe,DA=class extends lr{constructor(e=new Ch){if(super(),this.isSprite=!0,this.type="Sprite",Ev===void 0){Ev=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 Sd(t,5);Ev.setIndex([0,1,2,0,2,3]),Ev.setAttribute("position",new Uo(n,3,0,!1)),Ev.setAttribute("uv",new Uo(n,2,3,!1))}this.geometry=Ev,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.'),Mv.setFromMatrixScale(this.matrixWorld),KY.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Cv.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Mv.multiplyScalar(-Cv.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;v3(A3.set(-.5,-.5,0),Cv,o,Mv,r,s),v3(c2.set(.5,-.5,0),Cv,o,Mv,r,s),v3(g3.set(.5,.5,0),Cv,o,Mv,r,s),pY.set(0,0),$6.set(1,0),mY.set(1,1);let a=e.ray.intersectTriangle(A3,c2,g3,!1,a2);if(a===null&&(v3(c2.set(-.5,.5,0),Cv,o,Mv,r,s),$6.set(0,1),a=e.ray.intersectTriangle(A3,g3,c2,!1,a2),a===null))return;let l=e.ray.origin.distanceTo(a2);l<e.near||l>e.far||t.push({distance:l,point:a2.clone(),uv:vd.getInterpolation(a2,A3,c2,g3,pY,$6,mY,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 v3(i,e,t,n,r,s){Rv.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(l2.x=s*Rv.x-r*Rv.y,l2.y=r*Rv.x+s*Rv.y):l2.copy(Rv),i.copy(e),i.x+=l2.x,i.y+=l2.y,i.applyMatrix4(KY)}var Ad=new re,Y6=new re,_3=new re,Wp=new re,Z6=new re,x3=new re,K6=new re,Td=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,Ad)),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=Ad.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ad.copy(this.origin).addScaledVector(this.direction,t),Ad.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Y6.copy(e).add(t).multiplyScalar(.5),_3.copy(t).sub(e).normalize(),Wp.copy(this.origin).sub(Y6);let s=e.distanceTo(t)*.5,o=-this.direction.dot(_3),a=Wp.dot(this.direction),l=-Wp.dot(_3),c=Wp.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(Y6).addScaledVector(_3,d),A}intersectSphere(e,t){Ad.subVectors(e.center,this.origin);let n=Ad.dot(this.direction),r=Ad.dot(Ad)-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,Ad)!==null}intersectTriangle(e,t,n,r,s){Z6.subVectors(t,e),x3.subVectors(n,e),K6.crossVectors(Z6,x3);let o=this.direction.dot(K6),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Wp.subVectors(this.origin,e);let l=a*this.direction.dot(x3.crossVectors(Wp,x3));if(l<0)return null;let c=a*this.direction.dot(Z6.cross(Wp));if(c<0||l+c>o)return null;let u=-a*Wp.dot(K6);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)}},hs=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 Ba,this.combine=WA,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}},AY=new cn,xA=new Td,y3=new vl,gY=new re,b3=new re,w3=new re,S3=new re,Q6=new re,T3=new re,vY=new re,E3=new re,Hn=class extends lr{constructor(e=new Xn,t=new hs){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){T3.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let u=a[l],f=s[l];u!==0&&(Q6.fromBufferAttribute(f,e),o?T3.addScaledVector(Q6,u):T3.addScaledVector(Q6.sub(t),u))}t.add(T3)}return t}raycast(e,t){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),y3.copy(n.boundingSphere),y3.applyMatrix4(s),xA.copy(e.ray).recast(e.near),!(y3.containsPoint(xA.origin)===!1&&(xA.intersectSphere(y3,gY)===null||xA.origin.distanceToSquared(gY)>(e.far-e.near)**2))&&(AY.copy(s).invert(),xA.copy(e.ray).applyMatrix4(AY),!(n.boundingBox!==null&&xA.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,xA)))}_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=M3(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=M3(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=M3(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=M3(this,o,e,n,c,u,f,R,P,I),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}};function Eme(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===Oo,a),l===null)return null;E3.copy(a),E3.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(E3);return c<t.near||c>t.far?null:{distance:c,point:E3.clone(),object:i}}function M3(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,b3),i.getVertexPosition(l,w3),i.getVertexPosition(c,S3);let u=Eme(i,e,t,n,b3,w3,S3,vY);if(u){let f=new re;vd.getBarycoord(vY,b3,w3,S3,f),r&&(u.uv=vd.getInterpolatedAttribute(r,a,l,c,f,new Oe)),s&&(u.uv1=vd.getInterpolatedAttribute(s,a,l,c,f,new Oe)),o&&(u.normal=vd.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};vd.getNormal(b3,w3,S3,d.normal),u.face=d,u.barycoord=f}return u}var NA=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 Xl=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 J6=new re,Mme=new re,Cme=new Mn,La=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=J6.subVectors(n,t).cross(Mme.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(J6),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||Cme.getNormalMatrix(e),r=this.coplanarPoint(J6).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)}},yA=new vl,Rme=new Oe(.5,.5),C3=new re,Nc=class{constructor(e=new La,t=new La,n=new La,r=new La,s=new La,o=new La){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=Bo,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===Bo)r[5].setComponents(c+l,A+d,T+S,F+I).normalize();else if(t===gl)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(),yA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),yA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(yA)}intersectsSprite(e){yA.center.set(0,0,0);let t=Rme.distanceTo(e.center);return yA.radius=.7071067811865476+t,yA.applyMatrix4(e.matrixWorld),this.intersectsSphere(yA)}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(C3.x=r.normal.x>0?e.max.x:e.min.x,C3.y=r.normal.y>0?e.max.y:e.min.y,C3.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(C3)<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)}},_Y=new cn,v2=class i{constructor(){this.coordinateSystem=Bo,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];_Y.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[r]===void 0&&(n[r]=new Nc),n[r].setFromProjectionMatrix(_Y,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 Nc),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new i().copy(this)}};var Cu=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}},H3=new re,W3=new re,xY=new cn,u2=new Td,R3=new vl,e8=new re,yY=new re,t0=class extends lr{constructor(e=new Xn,t=new Cu){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++)H3.fromBufferAttribute(t,r-1),W3.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=H3.distanceTo(W3);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(),R3.copy(n.boundingSphere),R3.applyMatrix4(r),R3.radius+=s,e.ray.intersectsSphere(R3)===!1)return;xY.copy(r).invert(),u2.copy(e.ray).applyMatrix4(xY);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=I3(this,e,u2,l,T,R,w);P&&t.push(P)}if(this.isLineLoop){let w=u.getX(y-1),S=u.getX(A),T=I3(this,e,u2,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=I3(this,e,u2,l,w,w+1,w);T&&t.push(T)}if(this.isLineLoop){let w=I3(this,e,u2,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 I3(i,e,t,n,r,s,o){let a=i.geometry.attributes.position;if(H3.fromBufferAttribute(a,r),W3.fromBufferAttribute(a,s),t.distanceSqToSegment(H3,W3,e8,yY)>n)return;e8.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(e8);if(!(c<e.near||c>e.far))return{distance:c,point:yY.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var bY=new re,wY=new re,Vv=class extends t0{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)bY.fromBufferAttribute(t,r),wY.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+bY.distanceTo(wY);e.setAttribute("lineDistance",new Ln(n,1))}else Xe("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var n0=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}},SY=new cn,u8=new Td,P3=new vl,L3=new re,_2=class extends lr{constructor(e=new Xn,t=new n0){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(),P3.copy(n.boundingSphere),P3.applyMatrix4(r),P3.radius+=s,e.ray.intersectsSphere(P3)===!1)return;SY.copy(r).invert(),u8.copy(e.ray).applyMatrix4(SY);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);L3.fromBufferAttribute(f,S),TY(L3,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++)L3.fromBufferAttribute(f,y),TY(L3,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 TY(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 FA=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 Rh=class extends qs{constructor(e=[],t=Yl,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!==_o)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 Uv(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}},Gv=class extends Es{constructor(e,t=xi,n=Yl,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}},x2=class extends qs{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Ru=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 ge=he*z-W;for(let Re=0;Re<H;Re++){let Qe=Re*k-G;ce[w]=Qe*R,ce[S]=ge*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 ge=0;ge<L;ge++){let Re=d+ge+H*he,Qe=d+ge+H*(he+1),Fe=d+(ge+1)+H*(he+1),mt=d+(ge+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 qv=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)}},BA=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 Ua=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}},Hv=class extends Ua{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}},j3=class extends Hv{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function G8(){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 EY=new re,MY=new re,t8=new G8,n8=new G8,i8=new G8,X3=class extends Ua{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]:(MY.subVectors(r[0],r[1]).add(r[0]),c=MY);let f=r[a%s],d=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(EY.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=EY),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),t8.initNonuniformCatmullRom(c.x,f.x,d.x,u.x,y,w,S),n8.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"&&(t8.initCatmullRom(c.x,f.x,d.x,u.x,this.tension),n8.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(t8.calc(l),n8.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 CY(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 Ime(i,e){let t=1-i;return t*t*e}function Pme(i,e){return 2*(1-i)*i*e}function Lme(i,e){return i*i*e}function p2(i,e,t,n){return Ime(i,e)+Pme(i,t)+Lme(i,n)}function Dme(i,e){let t=1-i;return t*t*t*e}function Nme(i,e){let t=1-i;return 3*t*t*i*e}function Fme(i,e){return 3*(1-i)*i*i*e}function Bme(i,e){return i*i*i*e}function m2(i,e,t,n,r){return Dme(i,e)+Nme(i,t)+Fme(i,n)+Bme(i,r)}var y2=class extends Ua{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(m2(e,r.x,s.x,o.x,a.x),m2(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}},Wv=class extends Ua{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(m2(e,r.x,s.x,o.x,a.x),m2(e,r.y,s.y,o.y,a.y),m2(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}},b2=class extends Ua{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}},$3=class extends Ua{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}},w2=class extends Ua{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}},S2=class extends Ua{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}},T2=class extends Ua{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(CY(a,l.x,c.x,u.x,f.x),CY(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}},Y3=Object.freeze({__proto__:null,ArcCurve:j3,CatmullRomCurve3:X3,CubicBezierCurve:y2,CubicBezierCurve3:Wv,EllipseCurve:Hv,LineCurve:b2,LineCurve3:$3,QuadraticBezierCurve:w2,QuadraticBezierCurve3:S2,SplineCurve:T2}),Z3=class extends Ua{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 Y3[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 Y3[r.type]().fromJSON(r))}return this}},OA=class extends Z3{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 b2(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 w2(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 y2(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 T2(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 Hv(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}},E2=class extends OA{constructor(e){super(e),this.uuid=Eh(),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 OA().fromJSON(r))}return this}};function Ome(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length,s=QY(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=Gme(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 M2(s,o,t,a,l,c,0),o}function QY(i,e,t,n,r){let s;if(r===Jme(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=RY(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=RY(o/n|0,i[o],i[o+1],s);return s&&jv(s,s.next)&&(R2(s),s=s.next),s}function UA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(jv(t,t.next)||$r(t.prev,t,t.next)===0)){if(R2(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function M2(i,e,t,n,r,s,o){if(!i)return;!o&&s&&Xme(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?kme(i,n,r,s):Ume(i)){e.push(l.i,i.i,c.i),R2(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=zme(UA(i),e),M2(i,e,t,n,r,s,2)):o===2&&Vme(i,e,t,n,r,s):M2(UA(i),e,t,n,r,s,1);break}}}function Ume(i){let e=i.prev,t=i,n=i.next;if($r(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&&h2(r,a,s,l,o,c,y.x,y.y)&&$r(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function kme(i,e,t,n){let r=i.prev,s=i,o=i.next;if($r(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=h8(A,y,e,t,n),R=h8(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&&h2(a,u,l,f,c,d,P.x,P.y)&&$r(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&&h2(a,u,l,f,c,d,I.x,I.y)&&$r(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&&h2(a,u,l,f,c,d,P.x,P.y)&&$r(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&&h2(a,u,l,f,c,d,I.x,I.y)&&$r(I.prev,I,I.next)>=0)return!1;I=I.nextZ}return!0}function zme(i,e){let t=i;do{let n=t.prev,r=t.next.next;!jv(n,r)&&eZ(n,t,t.next,r)&&C2(n,r)&&C2(r,n)&&(e.push(n.i,t.i,r.i),R2(t),R2(t.next),t=i=r),t=t.next}while(t!==i);return UA(t)}function Vme(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Zme(o,a)){let l=tZ(o,a);o=UA(o,o.next),l=UA(l,l.next),M2(o,e,t,n,r,s,0),M2(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function Gme(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=QY(i,a,l,n,!1);c===c.next&&(c.steiner=!0),r.push(Yme(c))}r.sort(qme);for(let s=0;s<r.length;s++)t=Hme(r[s],t);return t}function qme(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 Hme(i,e){let t=Wme(i,e);if(!t)return e;let n=tZ(t,i);return UA(n,n.next),UA(t,t.next)}function Wme(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(jv(i,t))return t;do{if(jv(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&&JY(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);C2(t,i)&&(f<u||f===u&&(t.x>o.x||t.x===o.x&&jme(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function jme(i,e){return $r(i.prev,i,e.prev)<0&&$r(e.next,i,i.next)<0}function Xme(i,e,t,n){let r=i;do r.z===0&&(r.z=h8(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,$me(r)}function $me(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 h8(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 Yme(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 JY(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 h2(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&JY(i,e,t,n,r,s,o,a)}function Zme(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!Kme(i,e)&&(C2(i,e)&&C2(e,i)&&Qme(i,e)&&($r(i.prev,i,e.prev)||$r(i,e.prev,e))||jv(i,e)&&$r(i.prev,i,i.next)>0&&$r(e.prev,e,e.next)>0)}function $r(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function jv(i,e){return i.x===e.x&&i.y===e.y}function eZ(i,e,t,n){let r=N3($r(i,e,t)),s=N3($r(i,e,n)),o=N3($r(t,n,i)),a=N3($r(t,n,e));return!!(r!==s&&o!==a||r===0&&D3(i,t,e)||s===0&&D3(i,n,e)||o===0&&D3(t,i,n)||a===0&&D3(t,e,n))}function D3(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 N3(i){return i>0?1:i<0?-1:0}function Kme(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&&eZ(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function C2(i,e){return $r(i.prev,i,i.next)<0?$r(i,e,i.next)>=0&&$r(i,i.prev,e)>=0:$r(i,e,i.prev)<0||$r(i,i.next,e)<0}function Qme(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 tZ(i,e){let t=f8(i.i,i.x,i.y),n=f8(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 RY(i,e,t,n){let r=f8(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 R2(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 f8(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Jme(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 d8=class{static triangulate(e,t,n=2){return Ome(e,t,n)}},Xp=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=[];IY(e),PY(n,e);let o=e.length;t.forEach(IY);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,PY(n,t[l]);let a=d8.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function IY(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function PY(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var I2=class i extends Xn{constructor(e=new E2([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:eAe,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(!Xp.isClockWise(k)){k=k.reverse();for(let $e=0,ot=z.length;$e<ot;$e++){let nt=z[$e];Xp.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,ve=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(ve<=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,ve=nt.y-$e.y,vi=en*en+tn*tn,zn=en*ve-tn*bn;if(Math.abs(zn)>Number.EPSILON){let le=Math.sqrt(vi),Z=Math.sqrt(bn*bn+ve*ve),Te=ot.x-tn/le,Pe=ot.y+en/le,Ge=nt.x-ve/Z,vt=nt.y+bn/Z,Tt=((Ge-Te)*ve-(vt-Pe)*bn)/(en*ve-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(ve)&&(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=[],ge,Re=ce.concat();for(let $e=0,ot=Y;$e<ot;$e++){let nt=z[$e];ge=[];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),ge[bt]=te(nt[bt],nt[hn],nt[en]);he.push(ge),Re=Re.concat(ge)}let Qe;if(S===0)Qe=Xp.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];ge=he[en];let ve=[];for(let vi=0,zn=bn.length;vi<zn;vi++){let le=$(bn[vi],ge[vi],hn);Mt(le.x,le.y,-yt),bt===0&&ve.push(le)}bt===0&&ot.push(ve)}}Qe=Xp.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];ge=he[yt];for(let tn=0,bn=en.length;tn<bn;tn++){let ve=$(en[tn],ge[tn],bt);I?Mt(ve.x,ve.y+P[u-1].y,P[u-1].x+nt):Mt(ve.x,ve.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),ve=ot+bt+tn,vi=ot+yt+tn,zn=ot+yt+bn,le=ot+bt+bn;It(ve,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 tAe(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 Y3[r.type]().fromJSON(r)),new i(n,e.options)}},eAe={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 tAe(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 kA=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 ka=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 P2=class i extends Xn{constructor(e=new S2(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 Y3[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},L2=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),LY(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),LY(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 LY(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 D2=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 ng(i){let e={};for(let t in i){e[t]={};for(let n in i[t]){let r=i[t][n];if(DY(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(DY(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 ua(i){let e={};for(let t=0;t<i.length;t++){let n=ng(i[t]);for(let r in n)e[r]=n[r]}return e}function DY(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function nAe(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function q8(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ln.workingColorSpace}var ig={clone:ng,merge:ua},iAe=`void main() {1111 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );12-}`,iAe=`void main() {12+}`,rAe=`void main() {1313 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );14-}`,fs=class extends Hs{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=nAe,this.fragmentShader=iAe,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=ng(e.uniforms),this.uniformsGroups=tAe(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}},K3=class extends fs{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},Xv=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=Zl,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 Ba,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}},D2=class extends Xv{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=Zl,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 Ba,this.combine=WA,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}},N2=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=Zl,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}},F2=class extends Hs{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zl,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}},za=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=Zl,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 Ba,this.combine=WA,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}},Q3=class extends Hs{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=jY,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}},J3=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}},B2=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=Zl,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}},O2=class extends Mu{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 F3(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}var i0=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_(){}},eM=class extends i0{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:a8,endingEnd:a8}}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 l8:s=e,a=2*t-n;break;case c8: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 l8:o=e,l=2*n-t;break;case c8: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}},tM=class extends i0{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}},nM=class extends i0{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},iM=class extends i0{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}},$l=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=F3(t,this.TimeBufferType),this.values=F3(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:F3(e.times,Array),values:F3(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new nM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new tM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new eM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new iM(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 m2:t=this.InterpolantFactoryMethodDiscrete;break;case V3:t=this.InterpolantFactoryMethodLinear;break;case k3:t=this.InterpolantFactoryMethodSmooth;break;case o8: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 m2;case this.InterpolantFactoryMethodLinear:return V3;case this.InterpolantFactoryMethodSmooth:return k3;case this.InterpolantFactoryMethodBezier:return o8}}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&&e_(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()===k3,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}};$l.prototype.ValueTypeName="";$l.prototype.TimeBufferType=Float32Array;$l.prototype.ValueBufferType=Float32Array;$l.prototype.DefaultInterpolation=V3;var r0=class extends $l{constructor(e,t,n){super(e,t,n)}};r0.prototype.ValueTypeName="bool";r0.prototype.ValueBufferType=Array;r0.prototype.DefaultInterpolation=m2;r0.prototype.InterpolantFactoryMethodLinear=void 0;r0.prototype.InterpolantFactoryMethodSmooth=void 0;var rM=class extends $l{constructor(e,t,n,r){super(e,t,n,r)}};rM.prototype.ValueTypeName="color";var sM=class extends $l{constructor(e,t,n,r){super(e,t,n,r)}};sM.prototype.ValueTypeName="number";var oM=class extends i0{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}},U2=class extends $l{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new oM(this.times,this.values,this.getValueSize(),e)}};U2.prototype.ValueTypeName="quaternion";U2.prototype.InterpolantFactoryMethodSmooth=void 0;var s0=class extends $l{constructor(e,t,n){super(e,t,n)}};s0.prototype.ValueTypeName="string";s0.prototype.ValueBufferType=Array;s0.prototype.DefaultInterpolation=m2;s0.prototype.InterpolantFactoryMethodLinear=void 0;s0.prototype.InterpolantFactoryMethodSmooth=void 0;var aM=class extends $l{constructor(e,t,n,r){super(e,t,n,r)}};aM.prototype.ValueTypeName="vector";var z3={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(DY(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!DY(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function DY(i){try{let e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var lM=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}},tZ=new lM,o0=class{constructor(e){this.manager=e!==void 0?e:tZ,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}};o0.DEFAULT_MATERIAL_NAME="__DEFAULT";var Iv=new WeakMap,cM=class extends o0{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=z3.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=Iv.get(o);f===void 0&&(f=[],Iv.set(o,f)),f.push({onLoad:t,onError:r})}return o}let a=Bv("img");function l(){u(),t&&t(this);let f=Iv.get(this)||[];for(let d=0;d<f.length;d++){let A=f[d];A.onLoad&&A.onLoad(this)}Iv.delete(this),s.manager.itemEnd(e)}function c(f){u(),r&&r(f),z3.remove(`image:${e}`);let d=Iv.get(this)||[];for(let A=0;A<d.length;A++){let y=d[A];y.onError&&y.onError(f)}Iv.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),z3.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}};var _l=class extends o0{constructor(e){super(e)}load(e,t,n,r){let s=new qs,o=new cM(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}},k2=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}},r8=new cn,NY=new re,FY=new re,z2=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 Nc,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;NY.setFromMatrixPosition(e.matrixWorld),t.position.copy(NY),FY.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(FY),t.updateMatrixWorld(),r8.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(r8,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===gl||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(r8)}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}},B3=new re,O3=new Gs,Th=new re,Ed=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=Fo,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(B3,O3,Th),Th.x===1&&Th.y===1&&Th.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(B3,O3,Th.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(B3,O3,Th),Th.x===1&&Th.y===1&&Th.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(B3,O3,Th.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},jp=new re,BY=new Oe,OY=new Oe,Xr=class extends Ed{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=wd*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(h2*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return wd*2*Math.atan(Math.tan(h2*.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){jp.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(jp.x,jp.y).multiplyScalar(-e/jp.z),jp.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(jp.x,jp.y).multiplyScalar(-e/jp.z)}getViewSize(e,t){return this.getViewBounds(e,BY,OY),t.subVectors(OY,BY)}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(h2*.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}},p8=class extends z2{constructor(){super(new Xr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=wd*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}},VA=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 p8}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}},m8=class extends z2{constructor(){super(new Xr(90,1,.5,500)),this.isPointLightShadow=!0}},V2=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 m8}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}},Ru=class extends Ed{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}},A8=class extends z2{constructor(){super(new Ru(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},GA=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 A8}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}},qA=class extends Ih{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}},G2=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}},uM=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)}},q2=class extends Ih{constructor(e=new uM,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 H2=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 Pv=-90,Lv=1,$v=class extends lr{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Xr(Pv,Lv,e,t);r.layers=this.layers,this.add(r);let s=new Xr(Pv,Lv,e,t);s.layers=this.layers,this.add(s);let o=new Xr(Pv,Lv,e,t);o.layers=this.layers,this.add(o);let a=new Xr(Pv,Lv,e,t);a.layers=this.layers,this.add(a);let l=new Xr(Pv,Lv,e,t);l.layers=this.layers,this.add(l);let c=new Xr(Pv,Lv,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===Fo)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===gl)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}},Yv=class extends Xr{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},HA=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=rAe.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 rAe(){this._document.hidden===!1&&this.reset()}var H8="\\[\\]\\.:\\/",sAe=new RegExp("["+H8+"]","g"),W8="[^"+H8+"]",oAe="[^"+H8.replace("\\.","")+"]",aAe=/((?:WC+[\/:])*)/.source.replace("WC",W8),lAe=/(WCOD+)?/.source.replace("WCOD",oAe),cAe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",W8),uAe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",W8),hAe=new RegExp("^"+aAe+lAe+cAe+uAe+"$"),fAe=["material","materials","bones","map"],g8=class{constructor(e,t,n){let r=n||Sr.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()}},Sr=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(sAe,"")}static parseTrackName(e){let t=hAe.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);fAe.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}};Sr.Composite=g8;Sr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Sr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Sr.prototype.GetterByBindingType=[Sr.prototype._getValue_direct,Sr.prototype._getValue_array,Sr.prototype._getValue_arrayElement,Sr.prototype._getValue_toArray];Sr.prototype.SetterByBindingTypeAndVersioning=[[Sr.prototype._setValue_direct,Sr.prototype._setValue_direct_setNeedsUpdate,Sr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Sr.prototype._setValue_array,Sr.prototype._setValue_array_setNeedsUpdate,Sr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Sr.prototype._setValue_arrayElement,Sr.prototype._setValue_arrayElement_setNeedsUpdate,Sr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Sr.prototype._setValue_fromArray,Sr.prototype._setValue_fromArray_setNeedsUpdate,Sr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var sYe=new Float32Array(1);var Ph=class extends Sd{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 UY=new cn,W2=class{constructor(e,t,n=0,r=1/0){this.ray=new Td(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 UY.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(UY),this}intersectObject(e,t=!0,n=[]){return v8(e,this,n,t),n.sort(kY),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)v8(e[r],this,n,t);return n.sort(kY),n}};function kY(i,e){return i.distance-e.distance}function v8(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++)v8(s[o],e,t,!0)}}var Zv=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 Z8=class Z8{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}};Z8.prototype.isMatrix2=!0;var Kv=Z8,zY=new Oe,hM=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=zY.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,zY).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)}},VY=new re,U3=new re,Dv=new re,Nv=new re,s8=new re,dAe=new re,pAe=new re,j2=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){VY.subVectors(e,this.start),U3.subVectors(this.end,this.start);let n=U3.dot(U3);if(n===0)return 0;let s=U3.dot(VY)/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=dAe,n=pAe){let r=10000000000000001e-32,s,o,a=this.start,l=e.start,c=this.end,u=e.end;Dv.subVectors(c,a),Nv.subVectors(u,l),s8.subVectors(a,l);let f=Dv.dot(Dv),d=Nv.dot(Nv),A=Nv.dot(s8);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=Dv.dot(s8);if(d<=r)o=0,s=Nn(-y/f,0,1);else{let w=Dv.dot(Nv),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(Dv,s),n.copy(l).addScaledVector(Nv,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 X2=class{constructor(){this.type="ShapePath",this.color=new zt,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new OA,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=Xp.area(c);if(u===0)continue;let f=new hM;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 T2;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 OA;u.curves=l.subPath.curves,c.holes.push(u)}return o}},Md=class extends aa{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 yb(i,e,t,n){let r=mAe(n);switch(t){case Qv:return i*e;case Id:return i*e/r.components*r.byteLength;case Uh:return i*e/r.components*r.byteLength;case Ws:return i*e*2/r.components*r.byteLength;case kh:return i*e*2/r.components*r.byteLength;case Rd:return i*e*3/r.components*r.byteLength;case Br:return i*e*4/r.components*r.byteLength;case f0:return i*e*4/r.components*r.byteLength;case zh:case Vh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Gh:case qh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case KA:case JA:return Math.max(i,16)*Math.max(e,8)/4;case ZA:case QA:return Math.max(i,8)*Math.max(e,8)/2;case d0:case p0:case A0:case g0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case m0:case Hh:case v0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case _0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case x0:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case y0:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case b0:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case w0:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case S0:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case T0:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case E0:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case M0:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case C0:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case R0:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case I0:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case P0:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case L0:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case D0:case N0:case F0:return Math.ceil(i/4)*Math.ceil(e/4)*16;case B0:case O0:return Math.ceil(i/4)*Math.ceil(e/4)*8;case Wh:case U0:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function mAe(i){switch(i){case Ji:case Bh:return{byteLength:1,components:1};case xl:case Oh:case Wi:return{byteLength:2,components:1};case jA:case XA:return{byteLength:2,components:4};case xi:case Yr:case cr:return{byteLength:4,components:1};case $A:case YA: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 TZ(){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 vAe(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 _Ae=`#ifdef USE_ALPHAHASH14+}`,fs=class extends Hs{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=iAe,this.fragmentShader=rAe,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=ng(e.uniforms),this.uniformsGroups=nAe(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}},K3=class extends fs{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},Xv=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=Zl,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 Ba,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}},N2=class extends Xv{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=Zl,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 Ba,this.combine=WA,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}},F2=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=Zl,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}},B2=class extends Hs{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zl,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}},za=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=Zl,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 Ba,this.combine=WA,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}},Q3=class extends Hs{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=XY,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}},J3=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}},O2=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=Zl,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}},U2=class extends Cu{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 F3(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}var i0=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_(){}},eM=class extends i0{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:a8,endingEnd:a8}}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 l8:s=e,a=2*t-n;break;case c8: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 l8:o=e,l=2*n-t;break;case c8: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}},tM=class extends i0{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}},nM=class extends i0{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},iM=class extends i0{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}},$l=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=F3(t,this.TimeBufferType),this.values=F3(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:F3(e.times,Array),values:F3(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new nM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new tM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new eM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new iM(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 A2:t=this.InterpolantFactoryMethodDiscrete;break;case V3:t=this.InterpolantFactoryMethodLinear;break;case k3:t=this.InterpolantFactoryMethodSmooth;break;case o8: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 A2;case this.InterpolantFactoryMethodLinear:return V3;case this.InterpolantFactoryMethodSmooth:return k3;case this.InterpolantFactoryMethodBezier:return o8}}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&&e_(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()===k3,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}};$l.prototype.ValueTypeName="";$l.prototype.TimeBufferType=Float32Array;$l.prototype.ValueBufferType=Float32Array;$l.prototype.DefaultInterpolation=V3;var r0=class extends $l{constructor(e,t,n){super(e,t,n)}};r0.prototype.ValueTypeName="bool";r0.prototype.ValueBufferType=Array;r0.prototype.DefaultInterpolation=A2;r0.prototype.InterpolantFactoryMethodLinear=void 0;r0.prototype.InterpolantFactoryMethodSmooth=void 0;var rM=class extends $l{constructor(e,t,n,r){super(e,t,n,r)}};rM.prototype.ValueTypeName="color";var sM=class extends $l{constructor(e,t,n,r){super(e,t,n,r)}};sM.prototype.ValueTypeName="number";var oM=class extends i0{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}},k2=class extends $l{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new oM(this.times,this.values,this.getValueSize(),e)}};k2.prototype.ValueTypeName="quaternion";k2.prototype.InterpolantFactoryMethodSmooth=void 0;var s0=class extends $l{constructor(e,t,n){super(e,t,n)}};s0.prototype.ValueTypeName="string";s0.prototype.ValueBufferType=Array;s0.prototype.DefaultInterpolation=A2;s0.prototype.InterpolantFactoryMethodLinear=void 0;s0.prototype.InterpolantFactoryMethodSmooth=void 0;var aM=class extends $l{constructor(e,t,n,r){super(e,t,n,r)}};aM.prototype.ValueTypeName="vector";var z3={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(NY(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!NY(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function NY(i){try{let e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var lM=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}},nZ=new lM,o0=class{constructor(e){this.manager=e!==void 0?e:nZ,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}};o0.DEFAULT_MATERIAL_NAME="__DEFAULT";var Iv=new WeakMap,cM=class extends o0{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=z3.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=Iv.get(o);f===void 0&&(f=[],Iv.set(o,f)),f.push({onLoad:t,onError:r})}return o}let a=Bv("img");function l(){u(),t&&t(this);let f=Iv.get(this)||[];for(let d=0;d<f.length;d++){let A=f[d];A.onLoad&&A.onLoad(this)}Iv.delete(this),s.manager.itemEnd(e)}function c(f){u(),r&&r(f),z3.remove(`image:${e}`);let d=Iv.get(this)||[];for(let A=0;A<d.length;A++){let y=d[A];y.onError&&y.onError(f)}Iv.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),z3.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}};var _l=class extends o0{constructor(e){super(e)}load(e,t,n,r){let s=new qs,o=new cM(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}},z2=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}},r8=new cn,FY=new re,BY=new re,V2=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 Nc,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;FY.setFromMatrixPosition(e.matrixWorld),t.position.copy(FY),BY.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(BY),t.updateMatrixWorld(),r8.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(r8,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===gl||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(r8)}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}},B3=new re,O3=new Gs,Th=new re,Ed=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=Bo,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(B3,O3,Th),Th.x===1&&Th.y===1&&Th.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(B3,O3,Th.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(B3,O3,Th),Th.x===1&&Th.y===1&&Th.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(B3,O3,Th.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},jp=new re,OY=new Oe,UY=new Oe,Xr=class extends Ed{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=wd*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(f2*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return wd*2*Math.atan(Math.tan(f2*.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){jp.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(jp.x,jp.y).multiplyScalar(-e/jp.z),jp.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(jp.x,jp.y).multiplyScalar(-e/jp.z)}getViewSize(e,t){return this.getViewBounds(e,OY,UY),t.subVectors(UY,OY)}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(f2*.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}},p8=class extends V2{constructor(){super(new Xr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=wd*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}},VA=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 p8}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}},m8=class extends V2{constructor(){super(new Xr(90,1,.5,500)),this.isPointLightShadow=!0}},G2=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 m8}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}},Iu=class extends Ed{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}},A8=class extends V2{constructor(){super(new Iu(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},GA=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 A8}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}},qA=class extends Ih{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}},q2=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}},uM=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)}},H2=class extends Ih{constructor(e=new uM,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 W2=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 Pv=-90,Lv=1,$v=class extends lr{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Xr(Pv,Lv,e,t);r.layers=this.layers,this.add(r);let s=new Xr(Pv,Lv,e,t);s.layers=this.layers,this.add(s);let o=new Xr(Pv,Lv,e,t);o.layers=this.layers,this.add(o);let a=new Xr(Pv,Lv,e,t);a.layers=this.layers,this.add(a);let l=new Xr(Pv,Lv,e,t);l.layers=this.layers,this.add(l);let c=new Xr(Pv,Lv,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===Bo)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===gl)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}},Yv=class extends Xr{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},HA=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=sAe.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 sAe(){this._document.hidden===!1&&this.reset()}var H8="\\[\\]\\.:\\/",oAe=new RegExp("["+H8+"]","g"),W8="[^"+H8+"]",aAe="[^"+H8.replace("\\.","")+"]",lAe=/((?:WC+[\/:])*)/.source.replace("WC",W8),cAe=/(WCOD+)?/.source.replace("WCOD",aAe),uAe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",W8),hAe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",W8),fAe=new RegExp("^"+lAe+cAe+uAe+hAe+"$"),dAe=["material","materials","bones","map"],g8=class{constructor(e,t,n){let r=n||Sr.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()}},Sr=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(oAe,"")}static parseTrackName(e){let t=fAe.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);dAe.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}};Sr.Composite=g8;Sr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Sr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Sr.prototype.GetterByBindingType=[Sr.prototype._getValue_direct,Sr.prototype._getValue_array,Sr.prototype._getValue_arrayElement,Sr.prototype._getValue_toArray];Sr.prototype.SetterByBindingTypeAndVersioning=[[Sr.prototype._setValue_direct,Sr.prototype._setValue_direct_setNeedsUpdate,Sr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Sr.prototype._setValue_array,Sr.prototype._setValue_array_setNeedsUpdate,Sr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Sr.prototype._setValue_arrayElement,Sr.prototype._setValue_arrayElement_setNeedsUpdate,Sr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Sr.prototype._setValue_fromArray,Sr.prototype._setValue_fromArray_setNeedsUpdate,Sr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var oYe=new Float32Array(1);var Ph=class extends Sd{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 kY=new cn,j2=class{constructor(e,t,n=0,r=1/0){this.ray=new Td(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 kY.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(kY),this}intersectObject(e,t=!0,n=[]){return v8(e,this,n,t),n.sort(zY),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)v8(e[r],this,n,t);return n.sort(zY),n}};function zY(i,e){return i.distance-e.distance}function v8(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++)v8(s[o],e,t,!0)}}var Zv=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 Z8=class Z8{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}};Z8.prototype.isMatrix2=!0;var Kv=Z8,VY=new Oe,hM=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=VY.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,VY).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)}},GY=new re,U3=new re,Dv=new re,Nv=new re,s8=new re,pAe=new re,mAe=new re,X2=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){GY.subVectors(e,this.start),U3.subVectors(this.end,this.start);let n=U3.dot(U3);if(n===0)return 0;let s=U3.dot(GY)/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=pAe,n=mAe){let r=10000000000000001e-32,s,o,a=this.start,l=e.start,c=this.end,u=e.end;Dv.subVectors(c,a),Nv.subVectors(u,l),s8.subVectors(a,l);let f=Dv.dot(Dv),d=Nv.dot(Nv),A=Nv.dot(s8);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=Dv.dot(s8);if(d<=r)o=0,s=Nn(-y/f,0,1);else{let w=Dv.dot(Nv),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(Dv,s),n.copy(l).addScaledVector(Nv,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 $2=class{constructor(){this.type="ShapePath",this.color=new zt,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new OA,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=Xp.area(c);if(u===0)continue;let f=new hM;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 E2;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 OA;u.curves=l.subPath.curves,c.holes.push(u)}return o}},Md=class extends aa{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 bb(i,e,t,n){let r=AAe(n);switch(t){case Qv:return i*e;case Id:return i*e/r.components*r.byteLength;case Uh:return i*e/r.components*r.byteLength;case Ws:return i*e*2/r.components*r.byteLength;case kh:return i*e*2/r.components*r.byteLength;case Rd:return i*e*3/r.components*r.byteLength;case Br:return i*e*4/r.components*r.byteLength;case f0:return i*e*4/r.components*r.byteLength;case zh:case Vh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Gh:case qh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case KA:case JA:return Math.max(i,16)*Math.max(e,8)/4;case ZA:case QA:return Math.max(i,8)*Math.max(e,8)/2;case d0:case p0:case A0:case g0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case m0:case Hh:case v0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case _0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case x0:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case y0:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case b0:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case w0:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case S0:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case T0:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case E0:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case M0:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case C0:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case R0:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case I0:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case P0:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case L0:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case D0:case N0:case F0:return Math.ceil(i/4)*Math.ceil(e/4)*16;case B0:case O0:return Math.ceil(i/4)*Math.ceil(e/4)*8;case Wh:case U0:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function AAe(i){switch(i){case Ji:case Bh:return{byteLength:1,components:1};case xl:case Oh:case Wi:return{byteLength:2,components:1};case jA:case XA:return{byteLength:2,components:4};case xi:case Yr:case cr:return{byteLength:4,components:1};case $A:case YA: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 EZ(){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 _Ae(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 xAe=`#ifdef USE_ALPHAHASH1515 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;16-#endif`,xAe=`#ifdef USE_ALPHAHASH16+#endif`,yAe=`#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`,yAe=`#ifdef USE_ALPHAMAP52- diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;5351 #endif`,bAe=`#ifdef USE_ALPHAMAP52+ diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;53+#endif`,wAe=`#ifdef USE_ALPHAMAP5454 uniform sampler2D alphaMap;55-#endif`,wAe=`#ifdef USE_ALPHATEST55+#endif`,SAe=`#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`,SAe=`#ifdef USE_ALPHATEST62+#endif`,TAe=`#ifdef USE_ALPHATEST6363 uniform float alphaTest;64-#endif`,TAe=`#ifdef USE_AOMAP64+#endif`,EAe=`#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`,EAe=`#ifdef USE_AOMAP77+#endif`,MAe=`#ifdef USE_AOMAP7878 uniform sampler2D aoMap;7979 uniform float aoMapIntensity;80-#endif`,MAe=`#ifdef USE_BATCHING80+#endif`,CAe=`#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`,CAe=`#ifdef USE_BATCHING114+#endif`,RAe=`#ifdef USE_BATCHING115115 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );116-#endif`,RAe=`vec3 transformed = vec3( position );116+#endif`,IAe=`vec3 transformed = vec3( position );117117 #ifdef USE_ALPHAHASH118118 vPosition = vec3( position );119-#endif`,IAe=`vec3 objectNormal = vec3( normal );119+#endif`,PAe=`vec3 objectNormal = vec3( normal );120120 #ifdef USE_TANGENT121121 vec3 objectTangent = vec3( tangent.xyz );122-#endif`,PAe=`float G_BlinnPhong_Implicit( ) {122+#endif`,LAe=`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`,LAe=`#ifdef USE_IRIDESCENCE136+} // validated`,DAe=`#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`,DAe=`#ifdef USE_BUMPMAP199+#endif`,NAe=`#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`,NAe=`#if NUM_CLIPPING_PLANES > 0220+#endif`,FAe=`#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`,FAe=`#if NUM_CLIPPING_PLANES > 0267- varying vec3 vClipPosition;268- uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];269266 #endif`,BAe=`#if NUM_CLIPPING_PLANES > 0270267 varying vec3 vClipPosition;268+ uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];271269 #endif`,OAe=`#if NUM_CLIPPING_PLANES > 0270+ varying vec3 vClipPosition;271+#endif`,UAe=`#if NUM_CLIPPING_PLANES > 0272272 vClipPosition = - mvPosition.xyz;273-#endif`,UAe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )274- diffuseColor *= vColor;275273 #endif`,kAe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )276- varying vec4 vColor;277-#endif`,zAe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )274+ diffuseColor *= vColor;275+#endif`,zAe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )278276 varying vec4 vColor;279277 #endif`,VAe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )278+ varying vec4 vColor;279+#endif`,GAe=`#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`,GAe=`#define PI 3.141592653589793292+#endif`,qAe=`#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`,qAe=`#ifdef ENVMAP_TYPE_CUBE_UV363+} // validated`,HAe=`#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`,HAe=`vec3 transformedNormal = objectNormal;456+#endif`,WAe=`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`,WAe=`#ifdef USE_DISPLACEMENTMAP482+#endif`,jAe=`#ifdef USE_DISPLACEMENTMAP483483 uniform sampler2D displacementMap;484484 uniform float displacementScale;485485 uniform float displacementBias;486-#endif`,jAe=`#ifdef USE_DISPLACEMENTMAP486+#endif`,XAe=`#ifdef USE_DISPLACEMENTMAP487487 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );488-#endif`,XAe=`#ifdef USE_EMISSIVEMAP488+#endif`,$Ae=`#ifdef USE_EMISSIVEMAP489489 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );490490 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE491491 emissiveColor = sRGBTransferEOTF( emissiveColor );492492 #endif493493 totalEmissiveRadiance *= emissiveColor.rgb;494-#endif`,$Ae=`#ifdef USE_EMISSIVEMAP494+#endif`,YAe=`#ifdef USE_EMISSIVEMAP495495 uniform sampler2D emissiveMap;496-#endif`,YAe="gl_FragColor = linearToOutputTexel( gl_FragColor );",ZAe=`vec4 LinearTransferOETF( in vec4 value ) {496+#endif`,ZAe="gl_FragColor = linearToOutputTexel( gl_FragColor );",KAe=`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-}`,KAe=`#ifdef USE_ENVMAP504+}`,QAe=`#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`,QAe=`#ifdef USE_ENVMAP531+#endif`,JAe=`#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`,JAe=`#ifdef USE_ENVMAP539+#endif`,ege=`#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`,ege=`#ifdef USE_ENVMAP550+#endif`,tge=`#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`,tge=`#ifdef USE_ENVMAP561+#endif`,nge=`#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`,nge=`#ifdef USE_FOG579- vFogDepth = - mvPosition.z;580578 #endif`,ige=`#ifdef USE_FOG581- varying float vFogDepth;579+ vFogDepth = - mvPosition.z;582580 #endif`,rge=`#ifdef USE_FOG581+ varying float vFogDepth;582+#endif`,sge=`#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`,sge=`#ifdef USE_FOG589+#endif`,oge=`#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`,oge=`#ifdef USE_GRADIENTMAP598+#endif`,age=`#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-}`,age=`#ifdef USE_LIGHTMAP610+}`,lge=`#ifdef USE_LIGHTMAP611611 uniform sampler2D lightMap;612612 uniform float lightMapIntensity;613-#endif`,lge=`LambertMaterial material;613+#endif`,cge=`LambertMaterial material;614614 material.diffuseColor = diffuseColor.rgb;615-material.specularStrength = specularStrength;`,cge=`varying vec3 vViewPosition;615+material.specularStrength = specularStrength;`,uge=`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`,uge=`uniform bool receiveShadow;629+#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,hge=`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>`,hge=`#ifdef USE_ENVMAP746+#include <lightprobes_pars_fragment>`,fge=`#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`,fge=`ToonMaterial material;780-material.diffuseColor = diffuseColor.rgb;`,dge=`varying vec3 vViewPosition;779+#endif`,dge=`ToonMaterial material;780+material.diffuseColor = diffuseColor.rgb;`,pge=`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`,pge=`BlinnPhongMaterial material;792+#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,mge=`BlinnPhongMaterial material;793793 material.diffuseColor = diffuseColor.rgb;794794 material.specularColor = specular;795795 material.specularShininess = shininess;796-material.specularStrength = specularStrength;`,mge=`varying vec3 vViewPosition;796+material.specularStrength = specularStrength;`,Age=`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`,Age=`PhysicalMaterial material;813+#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,gge=`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`,gge=`uniform sampler2D dfgLUT;903+#endif`,vge=`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-}`,vge=`1263+}`,_ge=`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`,_ge=`#if defined( RE_IndirectDiffuse )1385+#endif`,xge=`#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`,xge=`#if defined( RE_IndirectDiffuse )1406+#endif`,yge=`#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`,yge=`#ifdef USE_LIGHT_PROBES_GRID1414+#endif`,bge=`#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`,bge=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )1460- gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;14611459 #endif`,wge=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )1460+ gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;1461+#endif`,Sge=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )14621462 uniform float logDepthBufFC;14631463 varying float vFragDepth;14641464 varying float vIsPerspective;1465-#endif`,Sge=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER1465+#endif`,Tge=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER14661466 varying float vFragDepth;14671467 varying float vIsPerspective;1468-#endif`,Tge=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER1468+#endif`,Ege=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER14691469 vFragDepth = 1.0 + gl_Position.w;14701470 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );1471-#endif`,Ege=`#ifdef USE_MAP1471+#endif`,Mge=`#ifdef USE_MAP14721472 vec4 sampledDiffuseColor = texture2D( map, vMapUv );14731473 #ifdef DECODE_VIDEO_TEXTURE14741474 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );14751475 #endif14761476 diffuseColor *= sampledDiffuseColor;1477-#endif`,Mge=`#ifdef USE_MAP1477+#endif`,Cge=`#ifdef USE_MAP14781478 uniform sampler2D map;1479-#endif`,Cge=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )1479+#endif`,Rge=`#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`,Rge=`#if defined( USE_POINTS_UV )1491+#endif`,Ige=`#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`,Ige=`float metalnessFactor = metalness;1503+#endif`,Pge=`float metalnessFactor = metalness;15041504 #ifdef USE_METALNESSMAP15051505 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );15061506 metalnessFactor *= texelMetalness.b;1507-#endif`,Pge=`#ifdef USE_METALNESSMAP1507+#endif`,Lge=`#ifdef USE_METALNESSMAP15081508 uniform sampler2D metalnessMap;1509-#endif`,Lge=`#ifdef USE_INSTANCING_MORPH1509+#endif`,Dge=`#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`,Dge=`#if defined( USE_MORPHCOLORS )1515+#endif`,Nge=`#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`,Nge=`#ifdef USE_MORPHNORMALS1524+#endif`,Fge=`#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`,Fge=`#ifdef USE_MORPHTARGETS1529+#endif`,Bge=`#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`,Bge=`#ifdef USE_MORPHTARGETS1543+#endif`,Oge=`#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`,Oge=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;1548+#endif`,Uge=`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;`,Uge=`#ifdef USE_NORMALMAP_OBJECTSPACE1589+vec3 nonPerturbedNormal = normal;`,kge=`#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;`,Uge=`#ifdef USE_NORMALMAP_OBJECTSPACE
16041604 normal = normalize( tbn * mapN );16051605 #elif defined( USE_BUMPMAP )16061606 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );1607-#endif`,kge=`#ifndef FLAT_SHADED1607+#endif`,zge=`#ifndef FLAT_SHADED16081608 varying vec3 vNormal;16091609 #ifdef USE_TANGENT16101610 varying vec3 vTangent;16111611 varying vec3 vBitangent;16121612 #endif1613-#endif`,zge=`#ifndef FLAT_SHADED1613+#endif`,Vge=`#ifndef FLAT_SHADED16141614 varying vec3 vNormal;16151615 #ifdef USE_TANGENT16161616 varying vec3 vTangent;16171617 varying vec3 vBitangent;16181618 #endif1619-#endif`,Vge=`#ifndef FLAT_SHADED1619+#endif`,Gge=`#ifndef FLAT_SHADED16201620 vNormal = normalize( transformedNormal );16211621 #ifdef USE_TANGENT16221622 vTangent = normalize( transformedTangent );@@ -1625,7 +1625,7 @@ vec3 nonPerturbedNormal = normal;`,Uge=`#ifdef USE_NORMALMAP_OBJECTSPACE
16251625 vBitangent = - vBitangent;16261626 #endif16271627 #endif1628-#endif`,Gge=`#ifdef USE_NORMALMAP1628+#endif`,qge=`#ifdef USE_NORMALMAP16291629 uniform sampler2D normalMap;16301630 uniform vec2 normalScale;16311631 #endif@@ -1647,13 +1647,13 @@ vec3 nonPerturbedNormal = normal;`,Uge=`#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`,qge=`#ifdef USE_CLEARCOAT1650+#endif`,Hge=`#ifdef USE_CLEARCOAT16511651 vec3 clearcoatNormal = nonPerturbedNormal;1652-#endif`,Hge=`#ifdef USE_CLEARCOAT_NORMALMAP1652+#endif`,Wge=`#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`,Wge=`#ifdef USE_CLEARCOATMAP1656+#endif`,jge=`#ifdef USE_CLEARCOATMAP16571657 uniform sampler2D clearcoatMap;16581658 #endif16591659 #ifdef USE_CLEARCOAT_NORMALMAP@@ -1662,18 +1662,18 @@ vec3 nonPerturbedNormal = normal;`,Uge=`#ifdef USE_NORMALMAP_OBJECTSPACE
16621662 #endif16631663 #ifdef USE_CLEARCOAT_ROUGHNESSMAP16641664 uniform sampler2D clearcoatRoughnessMap;1665-#endif`,jge=`#ifdef USE_IRIDESCENCEMAP1665+#endif`,Xge=`#ifdef USE_IRIDESCENCEMAP16661666 uniform sampler2D iridescenceMap;16671667 #endif16681668 #ifdef USE_IRIDESCENCE_THICKNESSMAP16691669 uniform sampler2D iridescenceThicknessMap;1670-#endif`,Xge=`#ifdef OPAQUE1670+#endif`,$ge=`#ifdef OPAQUE16711671 diffuseColor.a = 1.0;16721672 #endif16731673 #ifdef USE_TRANSMISSION16741674 diffuseColor.a *= material.transmissionAlpha;16751675 #endif1676-gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,$ge=`vec3 packNormalToRGB( const in vec3 normal ) {1676+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Yge=`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-}`,Yge=`#ifdef PREMULTIPLIED_ALPHA1755+}`,Zge=`#ifdef PREMULTIPLIED_ALPHA17561756 gl_FragColor.rgb *= gl_FragColor.a;1757-#endif`,Zge=`vec4 mvPosition = vec4( transformed, 1.0 );1757+#endif`,Kge=`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;`,Kge=`#ifdef DITHERING1765+gl_Position = projectionMatrix * mvPosition;`,Qge=`#ifdef DITHERING17661766 gl_FragColor.rgb = dithering( gl_FragColor.rgb );1767-#endif`,Qge=`#ifdef DITHERING1767+#endif`,Jge=`#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`,Jge=`float roughnessFactor = roughness;1774+#endif`,e1e=`float roughnessFactor = roughness;17751775 #ifdef USE_ROUGHNESSMAP17761776 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );17771777 roughnessFactor *= texelRoughness.g;1778-#endif`,e1e=`#ifdef USE_ROUGHNESSMAP1778+#endif`,t1e=`#ifdef USE_ROUGHNESSMAP17791779 uniform sampler2D roughnessMap;1780-#endif`,t1e=`#if NUM_SPOT_LIGHT_COORDS > 01780+#endif`,n1e=`#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;`,Kge=`#ifdef DITHERING
19771977 }19781978 #endif19791979 #endif1980-#endif`,n1e=`#if NUM_SPOT_LIGHT_COORDS > 01980+#endif`,i1e=`#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;`,Kge=`#ifdef DITHERING
20182018 };20192019 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];20202020 #endif2021-#endif`,i1e=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )2021+#endif`,r1e=`#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;`,Kge=`#ifdef DITHERING
20542054 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;20552055 }20562056 #pragma unroll_loop_end2057-#endif`,r1e=`float getShadowMask() {2057+#endif`,s1e=`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;`,Kge=`#ifdef DITHERING
20862086 #endif20872087 #endif20882088 return shadow;2089-}`,s1e=`#ifdef USE_SKINNING2089+}`,o1e=`#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`,o1e=`#ifdef USE_SKINNING2094+#endif`,a1e=`#ifdef USE_SKINNING20952095 uniform mat4 bindMatrix;20962096 uniform mat4 bindMatrixInverse;20972097 uniform highp sampler2D boneTexture;@@ -2106,7 +2106,7 @@ gl_Position = projectionMatrix * mvPosition;`,Kge=`#ifdef DITHERING
21062106 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );21072107 return mat4( v1, v2, v3, v4 );21082108 }2109-#endif`,a1e=`#ifdef USE_SKINNING2109+#endif`,l1e=`#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;`,Kge=`#ifdef DITHERING
21142114 skinned += boneMatZ * skinVertex * skinWeight.z;21152115 skinned += boneMatW * skinVertex * skinWeight.w;21162116 transformed = ( bindMatrixInverse * skinned ).xyz;2117-#endif`,l1e=`#ifdef USE_SKINNING2117+#endif`,c1e=`#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;`,Kge=`#ifdef DITHERING
21252125 #ifdef USE_TANGENT21262126 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;21272127 #endif2128-#endif`,c1e=`float specularStrength;2128+#endif`,u1e=`float specularStrength;21292129 #ifdef USE_SPECULARMAP21302130 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );21312131 specularStrength = texelSpecular.r;21322132 #else21332133 specularStrength = 1.0;2134-#endif`,u1e=`#ifdef USE_SPECULARMAP2134+#endif`,h1e=`#ifdef USE_SPECULARMAP21352135 uniform sampler2D specularMap;2136-#endif`,h1e=`#if defined( TONE_MAPPING )2136+#endif`,f1e=`#if defined( TONE_MAPPING )21372137 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );2138-#endif`,f1e=`#ifndef saturate2138+#endif`,d1e=`#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; }`,d1e=`#ifdef USE_TRANSMISSION2235+vec3 CustomToneMapping( vec3 color ) { return color; }`,p1e=`#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; }`,d1e=`#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`,p1e=`#ifdef USE_TRANSMISSION2256+#endif`,m1e=`#ifdef USE_TRANSMISSION22572257 uniform float transmission;22582258 uniform float thickness;22592259 uniform float attenuationDistance;@@ -2379,7 +2379,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,d1e=`#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`,m1e=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2382+#endif`,A1e=`#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; }`,d1e=`#ifdef USE_TRANSMIS
24492449 #ifdef USE_THICKNESSMAP24502450 uniform mat3 thicknessMapTransform;24512451 varying vec2 vThicknessMapUv;2452-#endif`,A1e=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2452+#endif`,g1e=`#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; }`,d1e=`#ifdef USE_TRANSMIS
25432543 #ifdef USE_THICKNESSMAP25442544 uniform mat3 thicknessMapTransform;25452545 varying vec2 vThicknessMapUv;2546-#endif`,g1e=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2546+#endif`,v1e=`#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; }`,d1e=`#ifdef USE_TRANSMIS
26142614 #endif26152615 #ifdef USE_THICKNESSMAP26162616 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;2617-#endif`,v1e=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 02617+#endif`,_1e=`#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; }`,d1e=`#ifdef USE_TRANSMIS
26232623 worldPosition = instanceMatrix * worldPosition;26242624 #endif26252625 worldPosition = modelMatrix * worldPosition;2626-#endif`,_1e=`varying vec2 vUv;2626+#endif`,x1e=`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-}`,x1e=`uniform sampler2D t2D;2631+}`,y1e=`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-}`,y1e=`varying vec3 vWorldDirection;2643+}`,b1e=`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-}`,b1e=`#ifdef ENVMAP_TYPE_CUBE2650+}`,w1e=`#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-}`,w1e=`varying vec3 vWorldDirection;2672+}`,S1e=`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-}`,S1e=`uniform samplerCube tCube;2679+}`,T1e=`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-}`,T1e=`#include <common>2689+}`,E1e=`#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-}`,E1e=`#if DEPTH_PACKING == 32002716+}`,M1e=`#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-}`,M1e=`#define DISTANCE2754+}`,C1e=`#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-}`,C1e=`#define DISTANCE2781+}`,R1e=`#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-}`,R1e=`varying vec3 vWorldDirection;2804+}`,I1e=`varying vec3 vWorldDirection;28052805 #include <common>28062806 void main() {28072807 vWorldDirection = transformDirection( position, modelMatrix );28082808 #include <begin_vertex>28092809 #include <project_vertex>2810-}`,I1e=`uniform sampler2D tEquirect;2810+}`,P1e=`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-}`,P1e=`uniform float scale;2819+}`,L1e=`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-}`,L1e=`uniform vec3 diffuse;2841+}`,D1e=`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-}`,D1e=`#include <common>2869+}`,N1e=`#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-}`,N1e=`uniform vec3 diffuse;2901+}`,F1e=`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-}`,F1e=`#define LAMBERT2949+}`,B1e=`#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-}`,B1e=`#define LAMBERT2988+}`,O1e=`#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-}`,O1e=`#define MATCAP3046+}`,U1e=`#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-}`,U1e=`#define MATCAP3080+}`,k1e=`#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-}`,k1e=`#define NORMAL3126+}`,z1e=`#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-}`,z1e=`#define NORMAL3159+}`,V1e=`#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-}`,V1e=`#define PHONG3180+}`,G1e=`#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-}`,G1e=`#define PHONG3219+}`,q1e=`#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-}`,q1e=`#define STANDARD3279+}`,H1e=`#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-}`,H1e=`#define STANDARD3322+}`,W1e=`#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-}`,W1e=`#define TOON3447+}`,j1e=`#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-}`,j1e=`#define TOON3484+}`,X1e=`#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-}`,X1e=`uniform float size;3536+}`,$1e=`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-}`,$1e=`uniform vec3 diffuse;3567+}`,Y1e=`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-}`,Y1e=`#include <common>3592+}`,Z1e=`#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-}`,Z1e=`uniform vec3 color;3615+}`,K1e=`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-}`,K1e=`uniform float rotation;3631+}`,Q1e=`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-}`,Q1e=`uniform vec3 diffuse;3655+}`,J1e=`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:_Ae,alphahash_pars_fragment:xAe,alphamap_fragment:yAe,alphamap_pars_fragment:bAe,alphatest_fragment:wAe,alphatest_pars_fragment:SAe,aomap_fragment:TAe,aomap_pars_fragment:EAe,batching_pars_vertex:MAe,batching_vertex:CAe,begin_vertex:RAe,beginnormal_vertex:IAe,bsdfs:PAe,iridescence_fragment:LAe,bumpmap_pars_fragment:DAe,clipping_planes_fragment:NAe,clipping_planes_pars_fragment:FAe,clipping_planes_pars_vertex:BAe,clipping_planes_vertex:OAe,color_fragment:UAe,color_pars_fragment:kAe,color_pars_vertex:zAe,color_vertex:VAe,common:GAe,cube_uv_reflection_fragment:qAe,defaultnormal_vertex:HAe,displacementmap_pars_vertex:WAe,displacementmap_vertex:jAe,emissivemap_fragment:XAe,emissivemap_pars_fragment:$Ae,colorspace_fragment:YAe,colorspace_pars_fragment:ZAe,envmap_fragment:KAe,envmap_common_pars_fragment:QAe,envmap_pars_fragment:JAe,envmap_pars_vertex:ege,envmap_physical_pars_fragment:hge,envmap_vertex:tge,fog_vertex:nge,fog_pars_vertex:ige,fog_fragment:rge,fog_pars_fragment:sge,gradientmap_pars_fragment:oge,lightmap_pars_fragment:age,lights_lambert_fragment:lge,lights_lambert_pars_fragment:cge,lights_pars_begin:uge,lights_toon_fragment:fge,lights_toon_pars_fragment:dge,lights_phong_fragment:pge,lights_phong_pars_fragment:mge,lights_physical_fragment:Age,lights_physical_pars_fragment:gge,lights_fragment_begin:vge,lights_fragment_maps:_ge,lights_fragment_end:xge,lightprobes_pars_fragment:yge,logdepthbuf_fragment:bge,logdepthbuf_pars_fragment:wge,logdepthbuf_pars_vertex:Sge,logdepthbuf_vertex:Tge,map_fragment:Ege,map_pars_fragment:Mge,map_particle_fragment:Cge,map_particle_pars_fragment:Rge,metalnessmap_fragment:Ige,metalnessmap_pars_fragment:Pge,morphinstance_vertex:Lge,morphcolor_vertex:Dge,morphnormal_vertex:Nge,morphtarget_pars_vertex:Fge,morphtarget_vertex:Bge,normal_fragment_begin:Oge,normal_fragment_maps:Uge,normal_pars_fragment:kge,normal_pars_vertex:zge,normal_vertex:Vge,normalmap_pars_fragment:Gge,clearcoat_normal_fragment_begin:qge,clearcoat_normal_fragment_maps:Hge,clearcoat_pars_fragment:Wge,iridescence_pars_fragment:jge,opaque_fragment:Xge,packing:$ge,premultiplied_alpha_fragment:Yge,project_vertex:Zge,dithering_fragment:Kge,dithering_pars_fragment:Qge,roughnessmap_fragment:Jge,roughnessmap_pars_fragment:e1e,shadowmap_pars_fragment:t1e,shadowmap_pars_vertex:n1e,shadowmap_vertex:i1e,shadowmask_pars_fragment:r1e,skinbase_vertex:s1e,skinning_pars_vertex:o1e,skinning_vertex:a1e,skinnormal_vertex:l1e,specularmap_fragment:c1e,specularmap_pars_fragment:u1e,tonemapping_fragment:h1e,tonemapping_pars_fragment:f1e,transmission_fragment:d1e,transmission_pars_fragment:p1e,uv_pars_fragment:m1e,uv_pars_vertex:A1e,uv_vertex:g1e,worldpos_vertex:v1e,background_vert:_1e,background_frag:x1e,backgroundCube_vert:y1e,backgroundCube_frag:b1e,cube_vert:w1e,cube_frag:S1e,depth_vert:T1e,depth_frag:E1e,distance_vert:M1e,distance_frag:C1e,equirect_vert:R1e,equirect_frag:I1e,linedashed_vert:P1e,linedashed_frag:L1e,meshbasic_vert:D1e,meshbasic_frag:N1e,meshlambert_vert:F1e,meshlambert_frag:B1e,meshmatcap_vert:O1e,meshmatcap_frag:U1e,meshnormal_vert:k1e,meshnormal_frag:z1e,meshphong_vert:V1e,meshphong_frag:G1e,meshphysical_vert:q1e,meshphysical_frag:H1e,meshtoon_vert:W1e,meshtoon_frag:j1e,points_vert:X1e,points_frag:$1e,shadow_vert:Y1e,shadow_frag:Z1e,sprite_vert:K1e,sprite_frag:Q1e},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}}},Ga={basic:{uniforms:ua([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.fog]),vertexShader:kn.meshbasic_vert,fragmentShader:kn.meshbasic_frag},lambert:{uniforms:ua([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:ua([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:ua([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:ua([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:ua([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,{matcap:{value:null}}]),vertexShader:kn.meshmatcap_vert,fragmentShader:kn.meshmatcap_frag},points:{uniforms:ua([Nt.points,Nt.fog]),vertexShader:kn.points_vert,fragmentShader:kn.points_frag},dashed:{uniforms:ua([Nt.common,Nt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:kn.linedashed_vert,fragmentShader:kn.linedashed_frag},depth:{uniforms:ua([Nt.common,Nt.displacementmap]),vertexShader:kn.depth_vert,fragmentShader:kn.depth_frag},normal:{uniforms:ua([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,{opacity:{value:1}}]),vertexShader:kn.meshnormal_vert,fragmentShader:kn.meshnormal_frag},sprite:{uniforms:ua([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:ua([Nt.common,Nt.displacementmap,{referencePosition:{value:new re},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:kn.distance_vert,fragmentShader:kn.distance_frag},shadow:{uniforms:ua([Nt.lights,Nt.fog,{color:{value:new zt(0)},opacity:{value:1}}]),vertexShader:kn.shadow_vert,fragmentShader:kn.shadow_frag}};Ga.physical={uniforms:ua([Ga.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 SM={r:0,b:0,g:0},J1e=new cn,EZ=new Mn;EZ.set(-1,0,0,0,1,0,0,0,1);function eve(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===Fh)?(c===void 0&&(c=new Hn(new Cu(1,1,1),new fs({name:"BackgroundCubeMaterial",uniforms:ng(Ga.backgroundCube.uniforms),vertexShader:Ga.backgroundCube.vertexShader,fragmentShader:Ga.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(J1e.makeRotationFromEuler(P.backgroundRotation)).transpose(),I.isCubeTexture&&I.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(EZ),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 kA(2,2),new fs({name:"BackgroundMaterial",uniforms:ng(Ga.background.uniforms),vertexShader:Ga.background.vertexShader,fragmentShader:Ga.background.fragmentShader,side:Bo,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(SM,q8(i)),t.buffers.color.setClear(SM.r,SM.g,SM.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 tve(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 ge=H[ce],Re=$[ce];if(Re===void 0&&(ce==="instanceMatrix"&&z.instanceMatrix&&(Re=z.instanceMatrix),ce==="instanceColor"&&z.instanceColor&&(Re=z.instanceColor)),ge===void 0||ge.attribute!==Re||Re&&ge.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 ge=$[ce];ge===void 0&&(ce==="instanceMatrix"&&z.instanceMatrix&&(ge=z.instanceMatrix),ce==="instanceColor"&&z.instanceColor&&(ge=z.instanceColor));let Re={};Re.attribute=ge,ge&&ge.data&&(Re.data=ge.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 ge=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===Yr;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,ge,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,ge,Re*Ee,Re/ce.locationSize*Ye*Ee,Ve)}}else if(J!==void 0){let ge=J[te];if(ge!==void 0)switch(ge.length){case 2:i.vertexAttrib2fv(ce.location,ge);break;case 3:i.vertexAttrib3fv(ce.location,ge);break;case 4:i.vertexAttrib4fv(ce.location,ge);break;default:i.vertexAttrib1fv(ce.location,ge)}}}}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 nve(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 ive(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!==Br&&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 rve(i){let e=this,t=null,n=0,r=!1,s=!1,o=new La,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 k0=4,nZ=[.125,.215,.35,.446,.526,.582],rg=20,sve=256,bb=new Ru,iZ=new zt,K8=null,Q8=0,J8=0,eF=!1,ove=new re,EM=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=ove}=s;K8=this._renderer.getRenderTarget(),Q8=this._renderer.getActiveCubeFace(),J8=this._renderer.getActiveMipmapLevel(),eF=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=sZ(),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(K8,Q8,J8),this._renderer.xr.enabled=eF,e.scissorTest=!1,t_(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Yl||e.mapping===Bc?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),K8=this._renderer.getRenderTarget(),Q8=this._renderer.getActiveCubeFace(),J8=this._renderer.getActiveMipmapLevel(),eF=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:Br,colorSpace:Zp,depthBuffer:!1},r=rZ(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=rZ(e,t,n);let{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=ave(s)),this._blurMaterial=cve(s,e,t),this._ggxMaterial=lve(s,e,t)}return r}_compileMaterial(e){let t=new Hn(new Xn,e);this._renderer.compile(t,bb)}_sceneToCubeUV(e,t,n,r,s){let l=new Xr(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(iZ),f.toneMapping=oo,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Hn(new Cu,new hs({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(iZ),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;t_(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===Yl||e.mapping===Bc;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=oZ()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=sZ());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;t_(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,bb)}_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-k0?n-y+k0:0),T=4*(this._cubeSize-w);l.envMap.value=e.texture,l.roughness.value=A,l.mipInt.value=y-t,t_(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,bb),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=y-n,t_(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,bb)}_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*rg-1),w=s/y,S=isFinite(s)?1+Math.floor(u*w):rg;S>rg&&Xe(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${rg}`);let T=[],R=0;for(let L=0;L<rg;++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-k0?r-P+k0:0),D=4*(this._cubeSize-I);t_(t,F,D,3*I,2*I),l.setRenderTarget(t),l.render(f,bb)}};function ave(i){let e=[],t=[],n=[],r=i,s=i-k0+1+nZ.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-k0?l=nZ[o-i+k0-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>k0&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function rZ(i,e,t){let n=new Fa(i,e,t);return n.texture.mapping=Fh,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function t_(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function lve(i,e,t){return new fs({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:sve,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:RM(),fragmentShader:`3680+}`,kn={alphahash_fragment:xAe,alphahash_pars_fragment:yAe,alphamap_fragment:bAe,alphamap_pars_fragment:wAe,alphatest_fragment:SAe,alphatest_pars_fragment:TAe,aomap_fragment:EAe,aomap_pars_fragment:MAe,batching_pars_vertex:CAe,batching_vertex:RAe,begin_vertex:IAe,beginnormal_vertex:PAe,bsdfs:LAe,iridescence_fragment:DAe,bumpmap_pars_fragment:NAe,clipping_planes_fragment:FAe,clipping_planes_pars_fragment:BAe,clipping_planes_pars_vertex:OAe,clipping_planes_vertex:UAe,color_fragment:kAe,color_pars_fragment:zAe,color_pars_vertex:VAe,color_vertex:GAe,common:qAe,cube_uv_reflection_fragment:HAe,defaultnormal_vertex:WAe,displacementmap_pars_vertex:jAe,displacementmap_vertex:XAe,emissivemap_fragment:$Ae,emissivemap_pars_fragment:YAe,colorspace_fragment:ZAe,colorspace_pars_fragment:KAe,envmap_fragment:QAe,envmap_common_pars_fragment:JAe,envmap_pars_fragment:ege,envmap_pars_vertex:tge,envmap_physical_pars_fragment:fge,envmap_vertex:nge,fog_vertex:ige,fog_pars_vertex:rge,fog_fragment:sge,fog_pars_fragment:oge,gradientmap_pars_fragment:age,lightmap_pars_fragment:lge,lights_lambert_fragment:cge,lights_lambert_pars_fragment:uge,lights_pars_begin:hge,lights_toon_fragment:dge,lights_toon_pars_fragment:pge,lights_phong_fragment:mge,lights_phong_pars_fragment:Age,lights_physical_fragment:gge,lights_physical_pars_fragment:vge,lights_fragment_begin:_ge,lights_fragment_maps:xge,lights_fragment_end:yge,lightprobes_pars_fragment:bge,logdepthbuf_fragment:wge,logdepthbuf_pars_fragment:Sge,logdepthbuf_pars_vertex:Tge,logdepthbuf_vertex:Ege,map_fragment:Mge,map_pars_fragment:Cge,map_particle_fragment:Rge,map_particle_pars_fragment:Ige,metalnessmap_fragment:Pge,metalnessmap_pars_fragment:Lge,morphinstance_vertex:Dge,morphcolor_vertex:Nge,morphnormal_vertex:Fge,morphtarget_pars_vertex:Bge,morphtarget_vertex:Oge,normal_fragment_begin:Uge,normal_fragment_maps:kge,normal_pars_fragment:zge,normal_pars_vertex:Vge,normal_vertex:Gge,normalmap_pars_fragment:qge,clearcoat_normal_fragment_begin:Hge,clearcoat_normal_fragment_maps:Wge,clearcoat_pars_fragment:jge,iridescence_pars_fragment:Xge,opaque_fragment:$ge,packing:Yge,premultiplied_alpha_fragment:Zge,project_vertex:Kge,dithering_fragment:Qge,dithering_pars_fragment:Jge,roughnessmap_fragment:e1e,roughnessmap_pars_fragment:t1e,shadowmap_pars_fragment:n1e,shadowmap_pars_vertex:i1e,shadowmap_vertex:r1e,shadowmask_pars_fragment:s1e,skinbase_vertex:o1e,skinning_pars_vertex:a1e,skinning_vertex:l1e,skinnormal_vertex:c1e,specularmap_fragment:u1e,specularmap_pars_fragment:h1e,tonemapping_fragment:f1e,tonemapping_pars_fragment:d1e,transmission_fragment:p1e,transmission_pars_fragment:m1e,uv_pars_fragment:A1e,uv_pars_vertex:g1e,uv_vertex:v1e,worldpos_vertex:_1e,background_vert:x1e,background_frag:y1e,backgroundCube_vert:b1e,backgroundCube_frag:w1e,cube_vert:S1e,cube_frag:T1e,depth_vert:E1e,depth_frag:M1e,distance_vert:C1e,distance_frag:R1e,equirect_vert:I1e,equirect_frag:P1e,linedashed_vert:L1e,linedashed_frag:D1e,meshbasic_vert:N1e,meshbasic_frag:F1e,meshlambert_vert:B1e,meshlambert_frag:O1e,meshmatcap_vert:U1e,meshmatcap_frag:k1e,meshnormal_vert:z1e,meshnormal_frag:V1e,meshphong_vert:G1e,meshphong_frag:q1e,meshphysical_vert:H1e,meshphysical_frag:W1e,meshtoon_vert:j1e,meshtoon_frag:X1e,points_vert:$1e,points_frag:Y1e,shadow_vert:Z1e,shadow_frag:K1e,sprite_vert:Q1e,sprite_frag:J1e},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}}},Ga={basic:{uniforms:ua([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.fog]),vertexShader:kn.meshbasic_vert,fragmentShader:kn.meshbasic_frag},lambert:{uniforms:ua([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:ua([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:ua([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:ua([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:ua([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,{matcap:{value:null}}]),vertexShader:kn.meshmatcap_vert,fragmentShader:kn.meshmatcap_frag},points:{uniforms:ua([Nt.points,Nt.fog]),vertexShader:kn.points_vert,fragmentShader:kn.points_frag},dashed:{uniforms:ua([Nt.common,Nt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:kn.linedashed_vert,fragmentShader:kn.linedashed_frag},depth:{uniforms:ua([Nt.common,Nt.displacementmap]),vertexShader:kn.depth_vert,fragmentShader:kn.depth_frag},normal:{uniforms:ua([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,{opacity:{value:1}}]),vertexShader:kn.meshnormal_vert,fragmentShader:kn.meshnormal_frag},sprite:{uniforms:ua([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:ua([Nt.common,Nt.displacementmap,{referencePosition:{value:new re},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:kn.distance_vert,fragmentShader:kn.distance_frag},shadow:{uniforms:ua([Nt.lights,Nt.fog,{color:{value:new zt(0)},opacity:{value:1}}]),vertexShader:kn.shadow_vert,fragmentShader:kn.shadow_frag}};Ga.physical={uniforms:ua([Ga.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 SM={r:0,b:0,g:0},eve=new cn,MZ=new Mn;MZ.set(-1,0,0,0,1,0,0,0,1);function tve(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===Fh)?(c===void 0&&(c=new Hn(new Ru(1,1,1),new fs({name:"BackgroundCubeMaterial",uniforms:ng(Ga.backgroundCube.uniforms),vertexShader:Ga.backgroundCube.vertexShader,fragmentShader:Ga.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(eve.makeRotationFromEuler(P.backgroundRotation)).transpose(),I.isCubeTexture&&I.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(MZ),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 kA(2,2),new fs({name:"BackgroundMaterial",uniforms:ng(Ga.background.uniforms),vertexShader:Ga.background.vertexShader,fragmentShader:Ga.background.fragmentShader,side:Oo,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(SM,q8(i)),t.buffers.color.setClear(SM.r,SM.g,SM.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 nve(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 ge=H[ce],Re=$[ce];if(Re===void 0&&(ce==="instanceMatrix"&&z.instanceMatrix&&(Re=z.instanceMatrix),ce==="instanceColor"&&z.instanceColor&&(Re=z.instanceColor)),ge===void 0||ge.attribute!==Re||Re&&ge.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 ge=$[ce];ge===void 0&&(ce==="instanceMatrix"&&z.instanceMatrix&&(ge=z.instanceMatrix),ce==="instanceColor"&&z.instanceColor&&(ge=z.instanceColor));let Re={};Re.attribute=ge,ge&&ge.data&&(Re.data=ge.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 ge=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===Yr;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,ge,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,ge,Re*Ee,Re/ce.locationSize*Ye*Ee,Ve)}}else if(J!==void 0){let ge=J[te];if(ge!==void 0)switch(ge.length){case 2:i.vertexAttrib2fv(ce.location,ge);break;case 3:i.vertexAttrib3fv(ce.location,ge);break;case 4:i.vertexAttrib4fv(ce.location,ge);break;default:i.vertexAttrib1fv(ce.location,ge)}}}}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 ive(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 rve(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!==Br&&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 sve(i){let e=this,t=null,n=0,r=!1,s=!1,o=new La,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 k0=4,iZ=[.125,.215,.35,.446,.526,.582],rg=20,ove=256,wb=new Iu,rZ=new zt,K8=null,Q8=0,J8=0,eF=!1,ave=new re,EM=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=ave}=s;K8=this._renderer.getRenderTarget(),Q8=this._renderer.getActiveCubeFace(),J8=this._renderer.getActiveMipmapLevel(),eF=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=aZ(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=oZ(),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(K8,Q8,J8),this._renderer.xr.enabled=eF,e.scissorTest=!1,t_(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Yl||e.mapping===Bc?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),K8=this._renderer.getRenderTarget(),Q8=this._renderer.getActiveCubeFace(),J8=this._renderer.getActiveMipmapLevel(),eF=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:Br,colorSpace:Zp,depthBuffer:!1},r=sZ(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=sZ(e,t,n);let{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=lve(s)),this._blurMaterial=uve(s,e,t),this._ggxMaterial=cve(s,e,t)}return r}_compileMaterial(e){let t=new Hn(new Xn,e);this._renderer.compile(t,wb)}_sceneToCubeUV(e,t,n,r,s){let l=new Xr(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(rZ),f.toneMapping=oo,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Hn(new Ru,new hs({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(rZ),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;t_(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===Yl||e.mapping===Bc;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=aZ()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=oZ());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;t_(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,wb)}_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-k0?n-y+k0:0),T=4*(this._cubeSize-w);l.envMap.value=e.texture,l.roughness.value=A,l.mipInt.value=y-t,t_(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,wb),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=y-n,t_(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,wb)}_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*rg-1),w=s/y,S=isFinite(s)?1+Math.floor(u*w):rg;S>rg&&Xe(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${rg}`);let T=[],R=0;for(let L=0;L<rg;++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-k0?r-P+k0:0),D=4*(this._cubeSize-I);t_(t,F,D,3*I,2*I),l.setRenderTarget(t),l.render(f,wb)}};function lve(i){let e=[],t=[],n=[],r=i,s=i-k0+1+iZ.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-k0?l=iZ[o-i+k0-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>k0&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function sZ(i,e,t){let n=new Fa(i,e,t);return n.texture.mapping=Fh,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function t_(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function cve(i,e,t){return new fs({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:ove,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:RM(),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:ds,depthTest:!1,depthWrite:!1})}function cve(i,e,t){let n=new Float32Array(rg),r=new re(0,1,0);return new fs({name:"SphericalGaussianBlur",defines:{n:rg,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:RM(),fragmentShader:`3784+ `,blending:ds,depthTest:!1,depthWrite:!1})}function uve(i,e,t){let n=new Float32Array(rg),r=new re(0,1,0);return new fs({name:"SphericalGaussianBlur",defines:{n:rg,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:RM(),fragmentShader:`37853785 37863786 precision mediump float;37873787 precision mediump int;@@ -3841,7 +3841,7 @@ void main() {
38413841 }38423842 38433843 }3844- `,blending:ds,depthTest:!1,depthWrite:!1})}function sZ(){return new fs({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:RM(),fragmentShader:`3844+ `,blending:ds,depthTest:!1,depthWrite:!1})}function oZ(){return new fs({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:RM(),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:ds,depthTest:!1,depthWrite:!1})}function oZ(){return new fs({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:RM(),fragmentShader:`3863+ `,blending:ds,depthTest:!1,depthWrite:!1})}function aZ(){return new fs({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:RM(),fragmentShader:`38643864 38653865 precision mediump float;38663866 precision mediump int;@@ -3966,7 +3966,7 @@ void main() {
39663966 gl_FragColor = texture2D( tEquirect, sampleUV );39673967 39683968 }3969- `},r=new Cu(5,5,5),s=new fs({name:"CubemapFromEquirect",uniforms:ng(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:mi,blending:ds});s.uniforms.tEquirect.value=t;let o=new Hn(r,s),a=t.minFilter;return t.minFilter===Uo&&(t.minFilter=Mi),new $v(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 uve(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===c0||A===u0)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 MM(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===c0||A===u0,w=A===Yl||A===Bc;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 EM(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 EM(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===c0?d.mapping=Yl:A===u0&&(d.mapping=Bc),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 hve(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 fve(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?LA:PA)(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 dve(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 pve(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 mve(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 IA(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 Ave(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 gve={[ob]:"LINEAR_TONE_MAPPING",[ab]:"REINHARD_TONE_MAPPING",[lb]:"CINEON_TONE_MAPPING",[cb]:"ACES_FILMIC_TONE_MAPPING",[ub]:"AGX_TONE_MAPPING",[hb]:"NEUTRAL_TONE_MAPPING",[x8]:"CUSTOM_TONE_MAPPING"};function vve(i,e,t,n,r,s){let o=new Fa(e,t,{type:i,depthBuffer:r,stencilBuffer:s,samples:n?4:0,depthTexture:r?new Es(e,t):void 0}),a=new Fa(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 K3({uniforms:{tDiffuse:{value:null}},vertexShader:`3969+ `},r=new Ru(5,5,5),s=new fs({name:"CubemapFromEquirect",uniforms:ng(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:mi,blending:ds});s.uniforms.tEquirect.value=t;let o=new Hn(r,s),a=t.minFilter;return t.minFilter===ko&&(t.minFilter=Mi),new $v(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 hve(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===c0||A===u0)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 MM(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===c0||A===u0,w=A===Yl||A===Bc;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 EM(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 EM(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===c0?d.mapping=Yl:A===u0&&(d.mapping=Bc),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 fve(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 dve(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?LA:PA)(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 pve(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 mve(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 Ave(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 IA(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 gve(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 vve={[ab]:"LINEAR_TONE_MAPPING",[lb]:"REINHARD_TONE_MAPPING",[cb]:"CINEON_TONE_MAPPING",[ub]:"ACES_FILMIC_TONE_MAPPING",[hb]:"AGX_TONE_MAPPING",[fb]:"NEUTRAL_TONE_MAPPING",[x8]:"CUSTOM_TONE_MAPPING"};function _ve(i,e,t,n,r,s){let o=new Fa(e,t,{type:i,depthBuffer:r,stencilBuffer:s,samples:n?4:0,depthTexture:r?new Es(e,t):void 0}),a=new Fa(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 K3({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 Ru(-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===oo&&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=oo,!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=gve[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 MZ=new qs,iF=new Es(1,1),CZ=new IA,RZ=new q3,IZ=new Rh,aZ=[],lZ=[],cZ=new Float32Array(16),uZ=new Float32Array(9),hZ=new Float32Array(4);function i_(i,e,t){let n=i[0];if(n<=0||n>0)return i;let r=e*t,s=aZ[r];if(s===void 0&&(s=new Float32Array(r),aZ[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 ao(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 lo(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function IM(i,e){let t=lZ[e];t===void 0&&(t=new Int32Array(e),lZ[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function _ve(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function xve(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(ao(t,e))return;i.uniform2fv(this.addr,e),lo(t,e)}}function yve(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(ao(t,e))return;i.uniform3fv(this.addr,e),lo(t,e)}}function bve(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(ao(t,e))return;i.uniform4fv(this.addr,e),lo(t,e)}}function wve(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(ao(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),lo(t,e)}else{if(ao(t,n))return;hZ.set(n),i.uniformMatrix2fv(this.addr,!1,hZ),lo(t,n)}}function Sve(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(ao(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),lo(t,e)}else{if(ao(t,n))return;uZ.set(n),i.uniformMatrix3fv(this.addr,!1,uZ),lo(t,n)}}function Tve(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(ao(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),lo(t,e)}else{if(ao(t,n))return;cZ.set(n),i.uniformMatrix4fv(this.addr,!1,cZ),lo(t,n)}}function Eve(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function Mve(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(ao(t,e))return;i.uniform2iv(this.addr,e),lo(t,e)}}function Cve(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(ao(t,e))return;i.uniform3iv(this.addr,e),lo(t,e)}}function Rve(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(ao(t,e))return;i.uniform4iv(this.addr,e),lo(t,e)}}function Ive(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function Pve(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(ao(t,e))return;i.uniform2uiv(this.addr,e),lo(t,e)}}function Lve(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(ao(t,e))return;i.uniform3uiv(this.addr,e),lo(t,e)}}function Dve(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(ao(t,e))return;i.uniform4uiv(this.addr,e),lo(t,e)}}function Nve(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()?Pu:jh,s=iF):s=MZ,t.setTexture2D(e||s,r)}function Fve(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||RZ,r)}function Bve(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||IZ,r)}function Ove(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||CZ,r)}function Uve(i){switch(i){case 5126:return _ve;case 35664:return xve;case 35665:return yve;case 35666:return bve;case 35674:return wve;case 35675:return Sve;case 35676:return Tve;case 5124:case 35670:return Eve;case 35667:case 35671:return Mve;case 35668:case 35672:return Cve;case 35669:case 35673:return Rve;case 5125:return Ive;case 36294:return Pve;case 36295:return Lve;case 36296:return Dve;case 35678:case 36198:case 36298:case 36306:case 35682:return Nve;case 35679:case 36299:case 36307:return Fve;case 35680:case 36300:case 36308:case 36293:return Bve;case 36289:case 36303:case 36311:case 36292:return Ove}}function kve(i,e){i.uniform1fv(this.addr,e)}function zve(i,e){let t=i_(e,this.size,2);i.uniform2fv(this.addr,t)}function Vve(i,e){let t=i_(e,this.size,3);i.uniform3fv(this.addr,t)}function Gve(i,e){let t=i_(e,this.size,4);i.uniform4fv(this.addr,t)}function qve(i,e){let t=i_(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function Hve(i,e){let t=i_(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function Wve(i,e){let t=i_(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function jve(i,e){i.uniform1iv(this.addr,e)}function Xve(i,e){i.uniform2iv(this.addr,e)}function $ve(i,e){i.uniform3iv(this.addr,e)}function Yve(i,e){i.uniform4iv(this.addr,e)}function Zve(i,e){i.uniform1uiv(this.addr,e)}function Kve(i,e){i.uniform2uiv(this.addr,e)}function Qve(i,e){i.uniform3uiv(this.addr,e)}function Jve(i,e){i.uniform4uiv(this.addr,e)}function e_e(i,e,t){let n=this.cache,r=e.length,s=IM(t,r);ao(n,s)||(i.uniform1iv(this.addr,s),lo(n,s));let o;this.type===i.SAMPLER_2D_SHADOW?o=iF:o=MZ;for(let a=0;a!==r;++a)t.setTexture2D(e[a]||o,s[a])}function t_e(i,e,t){let n=this.cache,r=e.length,s=IM(t,r);ao(n,s)||(i.uniform1iv(this.addr,s),lo(n,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||RZ,s[o])}function n_e(i,e,t){let n=this.cache,r=e.length,s=IM(t,r);ao(n,s)||(i.uniform1iv(this.addr,s),lo(n,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||IZ,s[o])}function i_e(i,e,t){let n=this.cache,r=e.length,s=IM(t,r);ao(n,s)||(i.uniform1iv(this.addr,s),lo(n,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||CZ,s[o])}function r_e(i){switch(i){case 5126:return kve;case 35664:return zve;case 35665:return Vve;case 35666:return Gve;case 35674:return qve;case 35675:return Hve;case 35676:return Wve;case 5124:case 35670:return jve;case 35667:case 35671:return Xve;case 35668:case 35672:return $ve;case 35669:case 35673:return Yve;case 5125:return Zve;case 36294:return Kve;case 36295:return Qve;case 36296:return Jve;case 35678:case 36198:case 36298:case 36306:case 35682:return e_e;case 35679:case 36299:case 36307:return t_e;case 35680:case 36300:case 36308:case 36293:return n_e;case 36289:case 36303:case 36311:case 36292:return i_e}}var rF=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Uve(t.type)}},sF=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=r_e(t.type)}},oF=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)}}},tF=/(\w+)(\])?(\[|\.)?/g;function fZ(i,e){i.seq.push(e),i.map[e.id]=e}function s_e(i,e,t){let n=i.name,r=n.length;for(tF.lastIndex=0;;){let s=tF.exec(n),o=tF.lastIndex,a=s[1],l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){fZ(t,c===void 0?new rF(a,i,e):new sF(a,i,e));break}else{let f=t.map[a];f===void 0&&(f=new oF(a),fZ(t,f)),t=f}}}var n_=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);s_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 dZ(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var o_e=37297,a_e=0;function l_e(i,e){let t=i.split(`4015+ }`,depthTest:!1,depthWrite:!1}),u=new Hn(l,c),f=new Iu(-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===oo&&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=oo,!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=vve[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 CZ=new qs,iF=new Es(1,1),RZ=new IA,IZ=new q3,PZ=new Rh,lZ=[],cZ=[],uZ=new Float32Array(16),hZ=new Float32Array(9),fZ=new Float32Array(4);function i_(i,e,t){let n=i[0];if(n<=0||n>0)return i;let r=e*t,s=lZ[r];if(s===void 0&&(s=new Float32Array(r),lZ[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 ao(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 lo(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function IM(i,e){let t=cZ[e];t===void 0&&(t=new Int32Array(e),cZ[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function xve(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function yve(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(ao(t,e))return;i.uniform2fv(this.addr,e),lo(t,e)}}function bve(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(ao(t,e))return;i.uniform3fv(this.addr,e),lo(t,e)}}function wve(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(ao(t,e))return;i.uniform4fv(this.addr,e),lo(t,e)}}function Sve(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(ao(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),lo(t,e)}else{if(ao(t,n))return;fZ.set(n),i.uniformMatrix2fv(this.addr,!1,fZ),lo(t,n)}}function Tve(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(ao(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),lo(t,e)}else{if(ao(t,n))return;hZ.set(n),i.uniformMatrix3fv(this.addr,!1,hZ),lo(t,n)}}function Eve(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(ao(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),lo(t,e)}else{if(ao(t,n))return;uZ.set(n),i.uniformMatrix4fv(this.addr,!1,uZ),lo(t,n)}}function Mve(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function Cve(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(ao(t,e))return;i.uniform2iv(this.addr,e),lo(t,e)}}function Rve(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(ao(t,e))return;i.uniform3iv(this.addr,e),lo(t,e)}}function Ive(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(ao(t,e))return;i.uniform4iv(this.addr,e),lo(t,e)}}function Pve(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function Lve(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(ao(t,e))return;i.uniform2uiv(this.addr,e),lo(t,e)}}function Dve(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(ao(t,e))return;i.uniform3uiv(this.addr,e),lo(t,e)}}function Nve(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(ao(t,e))return;i.uniform4uiv(this.addr,e),lo(t,e)}}function Fve(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()?Lu:jh,s=iF):s=CZ,t.setTexture2D(e||s,r)}function Bve(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||IZ,r)}function Ove(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||PZ,r)}function Uve(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||RZ,r)}function kve(i){switch(i){case 5126:return xve;case 35664:return yve;case 35665:return bve;case 35666:return wve;case 35674:return Sve;case 35675:return Tve;case 35676:return Eve;case 5124:case 35670:return Mve;case 35667:case 35671:return Cve;case 35668:case 35672:return Rve;case 35669:case 35673:return Ive;case 5125:return Pve;case 36294:return Lve;case 36295:return Dve;case 36296:return Nve;case 35678:case 36198:case 36298:case 36306:case 35682:return Fve;case 35679:case 36299:case 36307:return Bve;case 35680:case 36300:case 36308:case 36293:return Ove;case 36289:case 36303:case 36311:case 36292:return Uve}}function zve(i,e){i.uniform1fv(this.addr,e)}function Vve(i,e){let t=i_(e,this.size,2);i.uniform2fv(this.addr,t)}function Gve(i,e){let t=i_(e,this.size,3);i.uniform3fv(this.addr,t)}function qve(i,e){let t=i_(e,this.size,4);i.uniform4fv(this.addr,t)}function Hve(i,e){let t=i_(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function Wve(i,e){let t=i_(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function jve(i,e){let t=i_(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function Xve(i,e){i.uniform1iv(this.addr,e)}function $ve(i,e){i.uniform2iv(this.addr,e)}function Yve(i,e){i.uniform3iv(this.addr,e)}function Zve(i,e){i.uniform4iv(this.addr,e)}function Kve(i,e){i.uniform1uiv(this.addr,e)}function Qve(i,e){i.uniform2uiv(this.addr,e)}function Jve(i,e){i.uniform3uiv(this.addr,e)}function e_e(i,e){i.uniform4uiv(this.addr,e)}function t_e(i,e,t){let n=this.cache,r=e.length,s=IM(t,r);ao(n,s)||(i.uniform1iv(this.addr,s),lo(n,s));let o;this.type===i.SAMPLER_2D_SHADOW?o=iF:o=CZ;for(let a=0;a!==r;++a)t.setTexture2D(e[a]||o,s[a])}function n_e(i,e,t){let n=this.cache,r=e.length,s=IM(t,r);ao(n,s)||(i.uniform1iv(this.addr,s),lo(n,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||IZ,s[o])}function i_e(i,e,t){let n=this.cache,r=e.length,s=IM(t,r);ao(n,s)||(i.uniform1iv(this.addr,s),lo(n,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||PZ,s[o])}function r_e(i,e,t){let n=this.cache,r=e.length,s=IM(t,r);ao(n,s)||(i.uniform1iv(this.addr,s),lo(n,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||RZ,s[o])}function s_e(i){switch(i){case 5126:return zve;case 35664:return Vve;case 35665:return Gve;case 35666:return qve;case 35674:return Hve;case 35675:return Wve;case 35676:return jve;case 5124:case 35670:return Xve;case 35667:case 35671:return $ve;case 35668:case 35672:return Yve;case 35669:case 35673:return Zve;case 5125:return Kve;case 36294:return Qve;case 36295:return Jve;case 36296:return e_e;case 35678:case 36198:case 36298:case 36306:case 35682:return t_e;case 35679:case 36299:case 36307:return n_e;case 35680:case 36300:case 36308:case 36293:return i_e;case 36289:case 36303:case 36311:case 36292:return r_e}}var rF=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=kve(t.type)}},sF=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=s_e(t.type)}},oF=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)}}},tF=/(\w+)(\])?(\[|\.)?/g;function dZ(i,e){i.seq.push(e),i.map[e.id]=e}function o_e(i,e,t){let n=i.name,r=n.length;for(tF.lastIndex=0;;){let s=tF.exec(n),o=tF.lastIndex,a=s[1],l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){dZ(t,c===void 0?new rF(a,i,e):new sF(a,i,e));break}else{let f=t.map[a];f===void 0&&(f=new oF(a),dZ(t,f)),t=f}}}var n_=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);o_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 pZ(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var a_e=37297,l_e=0;function c_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 pZ=new Mn;function c_e(i){ln._getMatrix(pZ,ln.workingColorSpace,i);let e=`mat3( ${pZ.elements.map(t=>t.toFixed(4))} )`;switch(ln.getTransfer(i)){case Kp:return[e,"LinearTransferOETF"];case kt:return[e,"sRGBTransferOETF"];default:return Xe("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function mZ(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 mZ=new Mn;function u_e(i){ln._getMatrix(mZ,ln.workingColorSpace,i);let e=`mat3( ${mZ.elements.map(t=>t.toFixed(4))} )`;switch(ln.getTransfer(i)){case Kp:return[e,"LinearTransferOETF"];case kt:return[e,"sRGBTransferOETF"];default:return Xe("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function AZ(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-`+l_e(i.getShaderSource(e),a)}else return s}function u_e(i,e){let t=c_e(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`4022-`)}var h_e={[ob]:"Linear",[ab]:"Reinhard",[lb]:"Cineon",[cb]:"ACESFilmic",[ub]:"AgX",[hb]:"Neutral",[x8]:"Custom"};function f_e(i,e){let t=h_e[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 TM=new re;function d_e(){ln.getLuminanceCoefficients(TM);let i=TM.x.toFixed(4),e=TM.y.toFixed(4),t=TM.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`4023-`)}function p_e(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Sb).join(`4024-`)}function m_e(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`4025-`)}function A_e(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 Sb(i){return i!==""}function AZ(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 gZ(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var g_e=/^[ \t]*#include +<([\w\d./]+)>/gm;function aF(i){return i.replace(g_e,__e)}var v_e=new Map;function __e(i,e){let t=kn[e];if(t===void 0){let n=v_e.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 aF(t)}var x_e=/#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 vZ(i){return i.replace(x_e,y_e)}function y_e(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 _Z(i){let e=`precision ${i.precision} float;4021+`+c_e(i.getShaderSource(e),a)}else return s}function h_e(i,e){let t=u_e(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`4022+`)}var f_e={[ab]:"Linear",[lb]:"Reinhard",[cb]:"Cineon",[ub]:"ACESFilmic",[hb]:"AgX",[fb]:"Neutral",[x8]:"Custom"};function d_e(i,e){let t=f_e[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 TM=new re;function p_e(){ln.getLuminanceCoefficients(TM);let i=TM.x.toFixed(4),e=TM.y.toFixed(4),t=TM.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`4023+`)}function m_e(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Tb).join(`4024+`)}function A_e(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`4025+`)}function g_e(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 Tb(i){return i!==""}function gZ(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 vZ(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var v_e=/^[ \t]*#include +<([\w\d./]+)>/gm;function aF(i){return i.replace(v_e,x_e)}var __e=new Map;function x_e(i,e){let t=kn[e];if(t===void 0){let n=__e.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 aF(t)}var y_e=/#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 _Z(i){return i.replace(y_e,b_e)}function b_e(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 xZ(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 b_e={[l0]:"SHADOWMAP_TYPE_PCF",[Fc]:"SHADOWMAP_TYPE_VSM"};function w_e(i){return b_e[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var S_e={[Yl]:"ENVMAP_TYPE_CUBE",[Bc]:"ENVMAP_TYPE_CUBE",[Fh]:"ENVMAP_TYPE_CUBE_UV"};function T_e(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":S_e[i.envMapMode]||"ENVMAP_TYPE_CUBE"}var E_e={[Bc]:"ENVMAP_MODE_REFRACTION"};function M_e(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":E_e[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var C_e={[WA]:"ENVMAP_BLENDING_MULTIPLY",[vM]:"ENVMAP_BLENDING_MIX",[_M]:"ENVMAP_BLENDING_ADD"};function R_e(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":C_e[i.combine]||"ENVMAP_BLENDING_NONE"}function I_e(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 P_e(i,e,t,n){let r=i.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,l=w_e(t),c=T_e(t),u=M_e(t),f=R_e(t),d=I_e(t),A=p_e(t),y=m_e(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(Sb).join(`4045+#define LOW_PRECISION`),e}var w_e={[l0]:"SHADOWMAP_TYPE_PCF",[Fc]:"SHADOWMAP_TYPE_VSM"};function S_e(i){return w_e[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var T_e={[Yl]:"ENVMAP_TYPE_CUBE",[Bc]:"ENVMAP_TYPE_CUBE",[Fh]:"ENVMAP_TYPE_CUBE_UV"};function E_e(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":T_e[i.envMapMode]||"ENVMAP_TYPE_CUBE"}var M_e={[Bc]:"ENVMAP_MODE_REFRACTION"};function C_e(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":M_e[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var R_e={[WA]:"ENVMAP_BLENDING_MULTIPLY",[vM]:"ENVMAP_BLENDING_MIX",[_M]:"ENVMAP_BLENDING_ADD"};function I_e(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":R_e[i.combine]||"ENVMAP_BLENDING_NONE"}function P_e(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 L_e(i,e,t,n){let r=i.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,l=S_e(t),c=E_e(t),u=C_e(t),f=I_e(t),d=P_e(t),A=m_e(t),y=A_e(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(Tb).join(`40474047 `),S.length>0&&(S+=`4048-`),T=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(Sb).join(`4048+`),T=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(Tb).join(`40494049 `),T.length>0&&(T+=`4050-`)):(S=[_Z(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(Sb).join(`4052-`),T=[_Z(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!==oo?"#define TONE_MAPPING":"",t.toneMapping!==oo?kn.tonemapping_pars_fragment:"",t.toneMapping!==oo?f_e("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",kn.colorspace_pars_fragment,u_e("linearToOutputTexel",t.outputColorSpace),d_e(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`4053-`].filter(Sb).join(`4054-`)),o=aF(o),o=AZ(o,t),o=gZ(o,t),a=aF(a),a=AZ(a,t),a=gZ(a,t),o=vZ(o),a=vZ(a),t.isRawShaderMaterial!==!0&&(R=`#version 300 es4050+`)):(S=[xZ(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(Tb).join(`4052+`),T=[xZ(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!==oo?"#define TONE_MAPPING":"",t.toneMapping!==oo?kn.tonemapping_pars_fragment:"",t.toneMapping!==oo?d_e("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",kn.colorspace_pars_fragment,h_e("linearToOutputTexel",t.outputColorSpace),p_e(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`4053+`].filter(Tb).join(`4054+`)),o=aF(o),o=gZ(o,t),o=vZ(o,t),a=aF(a),a=gZ(a,t),a=vZ(a,t),o=_Z(o),a=_Z(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===k8?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===k8?"":"#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=dZ(r,r.VERTEX_SHADER,P),D=dZ(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=mZ(r,F,"vertex"),ge=mZ(r,D,"fragment");ze("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(w,r.VALIDATE_STATUS)+`4059+`+T);let P=R+S+o,I=R+T+a,F=pZ(r,r.VERTEX_SHADER,P),D=pZ(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=AZ(r,F,"vertex"),ge=AZ(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-`+ge)}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 n_(r,w),B=A_e(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,o_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=a_e++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=F,this.fragmentShader=D,this}var L_e=0,lF=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 cF(e),t.set(e,n)),n}},cF=class{constructor(e){this.id=L_e++,this.code=e,this.usedTimes=0}};function D_e(i){return i===Ws||i===Hh||i===Wh}function N_e(i,e,t,n,r,s){let o=new kv,a=new lF,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===Fh?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 ge=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,Re=ge!==void 0?ge.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=Ga[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,ve=C.anisotropy>0,vi=C.clearcoat>0,zn=C.dispersion>0,le=C.iridescence>0,Z=C.sheen>0,Te=C.transmission>0,Pe=ve&&!!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,sn=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=oo;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===yM,normalMapTangentSpace:yt&&C.normalMapType===Zl,packedNormalMap:yt&&C.normalMapType===Zl&&D_e(C.normalMap.format),metalnessMap:tn,roughnessMap:bn,anisotropy:ve,anisotropyMap:Pe,clearcoat:vi,clearcoatMap:Ge,clearcoatNormalMap:vt,clearcoatRoughnessMap:Tt,dispersion:zn,iridescence:le,iridescenceMap:qe,iridescenceThicknessMap:Je,sheen:Z,sheenColorMap:Pt,sheenRoughnessMap:sn,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: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:sn&&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||ve),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===gr,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=Ga[B];k=ig.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 P_e(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 F_e(){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 B_e(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 xZ(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 yZ(){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||B_e),n.length>1&&n.sort(A||xZ),r.length>1&&r.sort(A||xZ),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 O_e(){let i=new WeakMap;function e(n,r){let s=i.get(n),o;return s===void 0?(o=new yZ,i.set(n,[o])):r>=s.length?(o=new yZ,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function U_e(){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 k_e(){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 z_e=0;function V_e(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function G_e(i){let e=new U_e,t=k_e(),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(V_e);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,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=z_e++)}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 bZ(i){let e=new G_e(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 q_e(i){let e=new WeakMap;function t(r,s=0){let o=e.get(r),a;return o===void 0?(a=new bZ(i),e.set(r,[a])):s>=o.length?(a=new bZ(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var H_e=`void main() {4066+`+ge)}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 n_(r,w),B=g_e(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,a_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=l_e++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=F,this.fragmentShader=D,this}var D_e=0,lF=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 cF(e),t.set(e,n)),n}},cF=class{constructor(e){this.id=D_e++,this.code=e,this.usedTimes=0}};function N_e(i){return i===Ws||i===Hh||i===Wh}function F_e(i,e,t,n,r,s){let o=new kv,a=new lF,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===Fh?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 ge=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,Re=ge!==void 0?ge.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=Ga[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,ve=C.anisotropy>0,vi=C.clearcoat>0,zn=C.dispersion>0,le=C.iridescence>0,Z=C.sheen>0,Te=C.transmission>0,Pe=ve&&!!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,sn=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=oo;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===yM,normalMapTangentSpace:yt&&C.normalMapType===Zl,packedNormalMap:yt&&C.normalMapType===Zl&&N_e(C.normalMap.format),metalnessMap:tn,roughnessMap:bn,anisotropy:ve,anisotropyMap:Pe,clearcoat:vi,clearcoatMap:Ge,clearcoatNormalMap:vt,clearcoatRoughnessMap:Tt,dispersion:zn,iridescence:le,iridescenceMap:qe,iridescenceThicknessMap:Je,sheen:Z,sheenColorMap:Pt,sheenRoughnessMap:sn,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: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:sn&&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||ve),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===gr,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=Ga[B];k=ig.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 L_e(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 B_e(){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 O_e(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 yZ(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 bZ(){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||O_e),n.length>1&&n.sort(A||yZ),r.length>1&&r.sort(A||yZ),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 U_e(){let i=new WeakMap;function e(n,r){let s=i.get(n),o;return s===void 0?(o=new bZ,i.set(n,[o])):r>=s.length?(o=new bZ,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function k_e(){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 z_e(){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 V_e=0;function G_e(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function q_e(i){let e=new k_e,t=z_e(),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(G_e);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,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=V_e++)}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 wZ(i){let e=new q_e(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 H_e(i){let e=new WeakMap;function t(r,s=0){let o=e.get(r),a;return o===void 0?(a=new wZ(i),e.set(r,[a])):s>=o.length?(a=new wZ(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var W_e=`void main() {40674067 gl_Position = vec4( position, 1.0 );4068-}`,W_e=`uniform sampler2D shadow_pass;4068+}`,j_e=`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-}`,j_e=[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)],X_e=[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)],wZ=new cn,wb=new re,nF=new re;function $_e(i,e,t){let n=new Nc,r=new Oe,s=new Oe,o=new xn,a=new Q3,l=new J3,c={},u=t.maxTextureSize,f={[Bo]:mi,[mi]:Bo,[gr]:gr},d=new fs({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Oe},radius:{value:4}},vertexShader:H_e,fragmentShader:W_e}),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=l0;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===mM&&(Xe("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=l0);let B=i.getRenderTarget(),k=i.getActiveCubeFace(),z=i.getActiveMipmapLevel(),G=i.state;G.setBlending(ds),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===Fc){if($.isPointLight){Xe("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}J.map=new Fa(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 MM(r.x),J.map.depthTexture=new Gv(r.x,xi)):(J.map=new Fa(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===l0?(J.map.depthTexture.compareFunction=ce?Pu:jh,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 ge=0;ge<he;ge++){if(J.map.isWebGLCubeRenderTarget)i.setRenderTarget(J.map,ge),i.clear();else{ge===0&&(i.setRenderTarget(J.map),i.clear());let Re=J.getViewport(ge);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()),wb.setFromMatrixPosition($.matrixWorld),Re.position.copy(wb),nF.copy(Re.position),nF.add(j_e[ge]),Re.up.copy(X_e[ge]),Re.lookAt(nF),Re.updateMatrixWorld(),Qe.makeTranslation(-wb.x,-wb.y,-wb.z),wZ.multiplyMatrices(Re.projectionMatrix,Re.matrixWorldInverse),J._frustum.setFromProjectionMatrix(wZ,Re.coordinateSystem,Re.reversedDepth)}else J.updateMatrices($);n=J.getFrustum(),I(L,C,J.camera,$,this.type)}J.isPointLightShadow!==!0&&this.type===Fc&&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 Fa(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 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===Fc?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===Fc)&&(!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 Y_e(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=xb[ut]),St!==ut){switch(ut){case bA:i.depthFunc(i.NEVER);break;case wA:i.depthFunc(i.ALWAYS);break;case SA:i.depthFunc(i.LESS);break;case Mh:i.depthFunc(i.LEQUAL);break;case TA:i.depthFunc(i.EQUAL);break;case EA:i.depthFunc(i.GEQUAL);break;case MA:i.depthFunc(i.GREATER);break;case CA: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,ns,Pr){(Ze!==Fn||St!==ns||Bt!==Pr)&&(i.stencilFunc(Fn,ns,Pr),Ze=Fn,St=ns,Bt=Pr)},setOp:function(Fn,ns,Pr){(ut!==Fn||Ce!==ns||Yt!==Pr)&&(i.stencilOp(Fn,ns,Pr),ut=Fn,Ce=ns,Yt=Pr)},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,ge={},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(Mh),bt(!1),yt($2),Ye(i.CULL_FACE),ot(ds);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={[so]:i.FUNC_ADD,[Z2]:i.FUNC_SUBTRACT,[K2]:i.FUNC_REVERSE_SUBTRACT};Gt[AM]=i.MIN,Gt[gM]=i.MAX;let $e={[Iu]:i.ZERO,[Q2]:i.ONE,[J2]:i.SRC_COLOR,[$p]:i.SRC_ALPHA,[sb]:i.SRC_ALPHA_SATURATE,[ib]:i.DST_COLOR,[tb]:i.DST_ALPHA,[eb]:i.ONE_MINUS_SRC_COLOR,[Yp]:i.ONE_MINUS_SRC_ALPHA,[rb]:i.ONE_MINUS_DST_COLOR,[nb]:i.ONE_MINUS_DST_ALPHA,[GY]:i.CONSTANT_COLOR,[qY]:i.ONE_MINUS_CONSTANT_COLOR,[HY]:i.CONSTANT_ALPHA,[WY]:i.ONE_MINUS_CONSTANT_ALPHA};function ot(ye,wt,Ze,St,Bt,ut,Ce,Yt,nr,Fn){if(ye===ds){S===!0&&(Mt(i.BLEND),S=!1);return}if(S===!1&&(Ye(i.BLEND),S=!0),ye!==Cd){if(ye!==T||Fn!==k){if((R!==so||F!==so)&&(i.blendEquation(i.FUNC_ADD),R=so,F=so),Fn)switch(ye){case Ts:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Lh:i.blendFunc(i.ONE,i.ONE);break;case Dh:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Nh: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 Lh:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case Dh:ze("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Nh: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===gr?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(ds):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!==dM?(Ye(i.CULL_FACE),ye!==G&&(ye===$2?i.cullFace(i.BACK):ye===pM?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 ve(ye,wt,Ze){Ze===void 0&&(he===null?Ze=i.TEXTURE0+$-1:Ze=he);let St=ge[Ze];St===void 0&&(St={type:void 0,texture:void 0},ge[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=ge[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 sn(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,ge={},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:ve,unbindTexture:vi,compressedTexImage2D:zn,compressedTexImage3D:le,texImage2D:qe,texImage3D:Je,pixelStorei:sn,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 Z_e(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):Bv("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?Kp: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===la?Te=i.DEPTH24_STENCIL8:Z===cr?Te=i.DEPTH32F_STENCIL8:Z===xl&&(Te=i.DEPTH24_STENCIL8,Xe("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):Z===null||Z===xi||Z===la?Te=i.DEPTH_COMPONENT24:Z===cr?Te=i.DEPTH_COMPONENT32F:Z===xl&&(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&&ve(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 ge(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={[yd]:i.REPEAT,[oa]:i.CLAMP_TO_EDGE,[bd]:i.MIRRORED_REPEAT},Qe={[Ti]:i.NEAREST,[db]:i.NEAREST_MIPMAP_NEAREST,[Oc]:i.NEAREST_MIPMAP_LINEAR,[Mi]:i.LINEAR,[h0]:i.LINEAR_MIPMAP_NEAREST,[Uo]:i.LINEAR_MIPMAP_LINEAR},Fe={[Ab]:i.NEVER,[_b]:i.ALWAYS,[Jv]:i.LESS,[jh]:i.LEQUAL,[gb]:i.EQUAL,[Pu]:i.GEQUAL,[eg]:i.GREATER,[vb]:i.NOTEQUAL};function mt(le,Z){if(Z.type===cr&&e.has("OES_texture_float_linear")===!1&&(Z.magFilter===Mi||Z.magFilter===h0||Z.magFilter===Oc||Z.magFilter===Uo||Z.minFilter===Mi||Z.minFilter===h0||Z.minFilter===Oc||Z.minFilter===Uo)&&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!==Oc&&Z.minFilter!==Uo||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((sn,Lt)=>sn.start-Lt.start);let Tt=0;for(let sn=1;sn<vt.length;sn++){let Lt=vt[Tt],Rt=vt[sn],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 sn=0,Lt=vt.length;sn<Lt;sn++){let Rt=vt[sn],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===ca?null:ln.getPrimaries(Z.colorSpace),Bt=Z.colorSpace===ca||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),sn=s.convert(Z.type),Lt=I(Z.internalFormat,Pt,sn,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===_o,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,sn,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,sn,Rt.data):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,Pt,sn,Rt.data);Z.generateMipmaps=!1}else wn?(Dn&&t.texStorage2D(i.TEXTURE_2D,wt,Lt,Je.width,Je.height),ye&&Ye(Z,Je,Pt,sn)):t.texImage2D(i.TEXTURE_2D,0,Lt,Je.width,Je.height,0,Pt,sn,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!==Br)if(Pt!==null)if(wn){if(ye)if(Z.layerUpdates.size>0){let Bt=yb(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,sn,Rt.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Ze,Lt,Rt.width,Rt.height,Je.depth,0,Pt,sn,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!==Br?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,sn,Rt.data):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,Pt,sn,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=yb(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,sn,Bt)}Z.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Je.width,Je.height,Je.depth,Pt,sn,Je.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Lt,Je.width,Je.height,Je.depth,0,Pt,sn,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,sn,Je.data)):t.texImage3D(i.TEXTURE_3D,0,Lt,Je.width,Je.height,Je.depth,0,Pt,sn,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,sn,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,sn,Rt):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Pt,sn,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,sn,Je)}else t.texImage2D(i.TEXTURE_2D,0,Lt,Pt,sn,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===ca?null:ln.getPrimaries(Z.colorSpace),Je=Z.colorSpace===ca||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,sn=Z.image[0]&&Z.image[0].isDataTexture,Lt=[];for(let ut=0;ut<6;ut++)!Pt&&!sn?Lt[ut]=S(Z.image[ut],!0,r.maxCubemapSize):Lt[ut]=sn?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!==Br?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(sn){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),sn=n.get(Te);if(sn.__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,sn.__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,sn.__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),sn=s.convert(Z.depthTexture.type),Lt;Z.depthTexture.format===Vs?Lt=i.DEPTH_COMPONENT24:Z.depthTexture.format===_o&&(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,sn,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===_o?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===_o)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),sn=s.convert(Je.type),Lt=I(Je.internalFormat,Pt,sn,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],sn=n.get(Pt),Lt=i.TEXTURE_2D;(le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(Lt=le.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(Lt,sn.__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 sn=n.get(Z[Pt]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,sn,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 sn=n.get(Z[Pt]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pt,i.TEXTURE_2D,sn,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 ve(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!==Zp&&Te!==ca&&(ln.getTransfer(Te)===kt?(Pe!==Br||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=ge,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 K_e(i,e){function t(n,r=ca){let s,o=ln.getTransfer(r);if(n===Ji)return i.UNSIGNED_BYTE;if(n===jA)return i.UNSIGNED_SHORT_4_4_4_4;if(n===XA)return i.UNSIGNED_SHORT_5_5_5_1;if(n===$A)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===YA)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Bh)return i.BYTE;if(n===Oh)return i.SHORT;if(n===xl)return i.UNSIGNED_SHORT;if(n===Yr)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===Qv)return i.ALPHA;if(n===Rd)return i.RGB;if(n===Br)return i.RGBA;if(n===Vs)return i.DEPTH_COMPONENT;if(n===_o)return i.DEPTH_STENCIL;if(n===Id)return i.RED;if(n===Uh)return i.RED_INTEGER;if(n===Ws)return i.RG;if(n===kh)return i.RG_INTEGER;if(n===f0)return i.RGBA_INTEGER;if(n===zh||n===Vh||n===Gh||n===qh)if(o===kt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===zh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Vh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Gh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===qh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===zh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Vh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Gh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===qh)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===ZA||n===KA||n===QA||n===JA)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===ZA)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===KA)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===QA)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===JA)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===d0||n===p0||n===m0||n===A0||n===g0||n===Hh||n===v0)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===d0||n===p0)return o===kt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===m0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===A0)return s.COMPRESSED_R11_EAC;if(n===g0)return s.COMPRESSED_SIGNED_R11_EAC;if(n===Hh)return s.COMPRESSED_RG11_EAC;if(n===v0)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===_0||n===x0||n===y0||n===b0||n===w0||n===S0||n===T0||n===E0||n===M0||n===C0||n===R0||n===I0||n===P0||n===L0)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===_0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===x0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===y0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===b0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===w0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===S0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===T0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===E0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===M0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===C0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===R0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===I0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===P0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===L0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===D0||n===N0||n===F0)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===D0)return o===kt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===N0)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===F0)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===B0||n===O0||n===Wh||n===U0)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===B0)return s.COMPRESSED_RED_RGTC1_EXT;if(n===O0)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Wh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===U0)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===la?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var Q_e=`4093+}`,X_e=[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)],$_e=[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)],SZ=new cn,Sb=new re,nF=new re;function Y_e(i,e,t){let n=new Nc,r=new Oe,s=new Oe,o=new xn,a=new Q3,l=new J3,c={},u=t.maxTextureSize,f={[Oo]:mi,[mi]:Oo,[gr]:gr},d=new fs({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Oe},radius:{value:4}},vertexShader:W_e,fragmentShader:j_e}),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=l0;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===mM&&(Xe("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=l0);let B=i.getRenderTarget(),k=i.getActiveCubeFace(),z=i.getActiveMipmapLevel(),G=i.state;G.setBlending(ds),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===Fc){if($.isPointLight){Xe("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}J.map=new Fa(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 MM(r.x),J.map.depthTexture=new Gv(r.x,xi)):(J.map=new Fa(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===l0?(J.map.depthTexture.compareFunction=ce?Lu:jh,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 ge=0;ge<he;ge++){if(J.map.isWebGLCubeRenderTarget)i.setRenderTarget(J.map,ge),i.clear();else{ge===0&&(i.setRenderTarget(J.map),i.clear());let Re=J.getViewport(ge);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()),Sb.setFromMatrixPosition($.matrixWorld),Re.position.copy(Sb),nF.copy(Re.position),nF.add(X_e[ge]),Re.up.copy($_e[ge]),Re.lookAt(nF),Re.updateMatrixWorld(),Qe.makeTranslation(-Sb.x,-Sb.y,-Sb.z),SZ.multiplyMatrices(Re.projectionMatrix,Re.matrixWorldInverse),J._frustum.setFromProjectionMatrix(SZ,Re.coordinateSystem,Re.reversedDepth)}else J.updateMatrices($);n=J.getFrustum(),I(L,C,J.camera,$,this.type)}J.isPointLightShadow!==!0&&this.type===Fc&&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 Fa(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 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===Fc?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===Fc)&&(!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 Z_e(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=yb[ut]),St!==ut){switch(ut){case bA:i.depthFunc(i.NEVER);break;case wA:i.depthFunc(i.ALWAYS);break;case SA:i.depthFunc(i.LESS);break;case Mh:i.depthFunc(i.LEQUAL);break;case TA:i.depthFunc(i.EQUAL);break;case EA:i.depthFunc(i.GEQUAL);break;case MA:i.depthFunc(i.GREATER);break;case CA: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,ns,Pr){(Ze!==Fn||St!==ns||Bt!==Pr)&&(i.stencilFunc(Fn,ns,Pr),Ze=Fn,St=ns,Bt=Pr)},setOp:function(Fn,ns,Pr){(ut!==Fn||Ce!==ns||Yt!==Pr)&&(i.stencilOp(Fn,ns,Pr),ut=Fn,Ce=ns,Yt=Pr)},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,ge={},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(Mh),bt(!1),yt(Y2),Ye(i.CULL_FACE),ot(ds);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={[so]:i.FUNC_ADD,[K2]:i.FUNC_SUBTRACT,[Q2]:i.FUNC_REVERSE_SUBTRACT};Gt[AM]=i.MIN,Gt[gM]=i.MAX;let $e={[Pu]:i.ZERO,[J2]:i.ONE,[eb]:i.SRC_COLOR,[$p]:i.SRC_ALPHA,[ob]:i.SRC_ALPHA_SATURATE,[rb]:i.DST_COLOR,[nb]:i.DST_ALPHA,[tb]:i.ONE_MINUS_SRC_COLOR,[Yp]:i.ONE_MINUS_SRC_ALPHA,[sb]:i.ONE_MINUS_DST_COLOR,[ib]:i.ONE_MINUS_DST_ALPHA,[qY]:i.CONSTANT_COLOR,[HY]:i.ONE_MINUS_CONSTANT_COLOR,[WY]:i.CONSTANT_ALPHA,[jY]:i.ONE_MINUS_CONSTANT_ALPHA};function ot(ye,wt,Ze,St,Bt,ut,Ce,Yt,nr,Fn){if(ye===ds){S===!0&&(Mt(i.BLEND),S=!1);return}if(S===!1&&(Ye(i.BLEND),S=!0),ye!==Cd){if(ye!==T||Fn!==k){if((R!==so||F!==so)&&(i.blendEquation(i.FUNC_ADD),R=so,F=so),Fn)switch(ye){case Ts:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Lh:i.blendFunc(i.ONE,i.ONE);break;case Dh:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Nh: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 Lh:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case Dh:ze("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Nh: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===gr?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(ds):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!==dM?(Ye(i.CULL_FACE),ye!==G&&(ye===Y2?i.cullFace(i.BACK):ye===pM?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 ve(ye,wt,Ze){Ze===void 0&&(he===null?Ze=i.TEXTURE0+$-1:Ze=he);let St=ge[Ze];St===void 0&&(St={type:void 0,texture:void 0},ge[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=ge[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 sn(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,ge={},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:ve,unbindTexture:vi,compressedTexImage2D:zn,compressedTexImage3D:le,texImage2D:qe,texImage3D:Je,pixelStorei:sn,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 K_e(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):Bv("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?Kp: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===la?Te=i.DEPTH24_STENCIL8:Z===cr?Te=i.DEPTH32F_STENCIL8:Z===xl&&(Te=i.DEPTH24_STENCIL8,Xe("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):Z===null||Z===xi||Z===la?Te=i.DEPTH_COMPONENT24:Z===cr?Te=i.DEPTH_COMPONENT32F:Z===xl&&(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&&ve(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 ge(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={[yd]:i.REPEAT,[oa]:i.CLAMP_TO_EDGE,[bd]:i.MIRRORED_REPEAT},Qe={[Ti]:i.NEAREST,[pb]:i.NEAREST_MIPMAP_NEAREST,[Oc]:i.NEAREST_MIPMAP_LINEAR,[Mi]:i.LINEAR,[h0]:i.LINEAR_MIPMAP_NEAREST,[ko]:i.LINEAR_MIPMAP_LINEAR},Fe={[gb]:i.NEVER,[xb]:i.ALWAYS,[Jv]:i.LESS,[jh]:i.LEQUAL,[vb]:i.EQUAL,[Lu]:i.GEQUAL,[eg]:i.GREATER,[_b]:i.NOTEQUAL};function mt(le,Z){if(Z.type===cr&&e.has("OES_texture_float_linear")===!1&&(Z.magFilter===Mi||Z.magFilter===h0||Z.magFilter===Oc||Z.magFilter===ko||Z.minFilter===Mi||Z.minFilter===h0||Z.minFilter===Oc||Z.minFilter===ko)&&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!==Oc&&Z.minFilter!==ko||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((sn,Lt)=>sn.start-Lt.start);let Tt=0;for(let sn=1;sn<vt.length;sn++){let Lt=vt[Tt],Rt=vt[sn],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 sn=0,Lt=vt.length;sn<Lt;sn++){let Rt=vt[sn],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===ca?null:ln.getPrimaries(Z.colorSpace),Bt=Z.colorSpace===ca||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),sn=s.convert(Z.type),Lt=I(Z.internalFormat,Pt,sn,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===_o,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,sn,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,sn,Rt.data):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,Pt,sn,Rt.data);Z.generateMipmaps=!1}else wn?(Dn&&t.texStorage2D(i.TEXTURE_2D,wt,Lt,Je.width,Je.height),ye&&Ye(Z,Je,Pt,sn)):t.texImage2D(i.TEXTURE_2D,0,Lt,Je.width,Je.height,0,Pt,sn,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!==Br)if(Pt!==null)if(wn){if(ye)if(Z.layerUpdates.size>0){let Bt=bb(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,sn,Rt.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Ze,Lt,Rt.width,Rt.height,Je.depth,0,Pt,sn,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!==Br?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,sn,Rt.data):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,Pt,sn,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=bb(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,sn,Bt)}Z.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Je.width,Je.height,Je.depth,Pt,sn,Je.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Lt,Je.width,Je.height,Je.depth,0,Pt,sn,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,sn,Je.data)):t.texImage3D(i.TEXTURE_3D,0,Lt,Je.width,Je.height,Je.depth,0,Pt,sn,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,sn,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,sn,Rt):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Pt,sn,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,sn,Je)}else t.texImage2D(i.TEXTURE_2D,0,Lt,Pt,sn,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===ca?null:ln.getPrimaries(Z.colorSpace),Je=Z.colorSpace===ca||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,sn=Z.image[0]&&Z.image[0].isDataTexture,Lt=[];for(let ut=0;ut<6;ut++)!Pt&&!sn?Lt[ut]=S(Z.image[ut],!0,r.maxCubemapSize):Lt[ut]=sn?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!==Br?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(sn){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),sn=n.get(Te);if(sn.__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,sn.__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,sn.__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),sn=s.convert(Z.depthTexture.type),Lt;Z.depthTexture.format===Vs?Lt=i.DEPTH_COMPONENT24:Z.depthTexture.format===_o&&(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,sn,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===_o?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===_o)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),sn=s.convert(Je.type),Lt=I(Je.internalFormat,Pt,sn,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],sn=n.get(Pt),Lt=i.TEXTURE_2D;(le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(Lt=le.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(Lt,sn.__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 sn=n.get(Z[Pt]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,sn,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 sn=n.get(Z[Pt]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pt,i.TEXTURE_2D,sn,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 ve(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!==Zp&&Te!==ca&&(ln.getTransfer(Te)===kt?(Pe!==Br||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=ge,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 Q_e(i,e){function t(n,r=ca){let s,o=ln.getTransfer(r);if(n===Ji)return i.UNSIGNED_BYTE;if(n===jA)return i.UNSIGNED_SHORT_4_4_4_4;if(n===XA)return i.UNSIGNED_SHORT_5_5_5_1;if(n===$A)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===YA)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Bh)return i.BYTE;if(n===Oh)return i.SHORT;if(n===xl)return i.UNSIGNED_SHORT;if(n===Yr)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===Qv)return i.ALPHA;if(n===Rd)return i.RGB;if(n===Br)return i.RGBA;if(n===Vs)return i.DEPTH_COMPONENT;if(n===_o)return i.DEPTH_STENCIL;if(n===Id)return i.RED;if(n===Uh)return i.RED_INTEGER;if(n===Ws)return i.RG;if(n===kh)return i.RG_INTEGER;if(n===f0)return i.RGBA_INTEGER;if(n===zh||n===Vh||n===Gh||n===qh)if(o===kt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===zh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Vh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Gh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===qh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===zh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Vh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Gh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===qh)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===ZA||n===KA||n===QA||n===JA)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===ZA)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===KA)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===QA)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===JA)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===d0||n===p0||n===m0||n===A0||n===g0||n===Hh||n===v0)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===d0||n===p0)return o===kt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===m0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===A0)return s.COMPRESSED_R11_EAC;if(n===g0)return s.COMPRESSED_SIGNED_R11_EAC;if(n===Hh)return s.COMPRESSED_RG11_EAC;if(n===v0)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===_0||n===x0||n===y0||n===b0||n===w0||n===S0||n===T0||n===E0||n===M0||n===C0||n===R0||n===I0||n===P0||n===L0)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===_0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===x0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===y0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===b0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===w0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===S0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===T0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===E0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===M0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===C0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===R0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===I0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===P0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===L0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===D0||n===N0||n===F0)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===D0)return o===kt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===N0)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===F0)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===B0||n===O0||n===Wh||n===U0)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===B0)return s.COMPRESSED_RED_RGTC1_EXT;if(n===O0)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Wh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===U0)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===la?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var J_e=`40944094 void main() {40954095 40964096 gl_Position = vec4( position, 1.0 );40974097 4098-}`,J_e=`4098+}`,exe=`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 _2(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 fs({vertexShader:Q_e,fragmentShader:J_e,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Hn(new kA(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},hF=class extends aa{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 Xr;B.viewport=new xn;let k=new Xr;k.viewport=new xn;let z=[B,k],G=new Yv,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 Jp,F[Ee]=Ve),Ve.getTargetRaySpace()},this.getControllerGrip=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new Jp,F[Ee]=Ve),Ve.getGripSpace()},this.getHand=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new Jp,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?_o:Vs,Mt=R.stencil?la: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 Fa(d.textureWidth,d.textureHeight,{format:Br,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),I=new Fa(A.framebufferWidth,A.framebufferHeight,{format:Br,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,ve=Gt+en,vi=yt-tn,zn=hn+(Mt-tn),le=$e*Gt/ve*bn,Z=ot*Gt/ve*bn;Ee.projectionMatrix.makePerspective(vi,zn,le,Z,bn,ve),Ee.projectionMatrixInverse.copy(Ee.projectionMatrix).invert()}}function ge(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;ge(G,Mt);for(let It=0;It<Et.length;It++)ge(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=wd*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 Xr,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 _2,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 TZ;mt.setAnimationLoop(Fe),this.setAnimationLoop=function(Ee){Qe=Ee},this.dispose=function(){}}},exe=new cn,PZ=new Mn;PZ.set(-1,0,0,0,1,0,0,0,1);function txe(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,q8(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(exe.makeRotationFromEuler(I)).transpose(),P.isCubeTexture&&P.isRenderTargetTexture===!1&&S.envMapRotation.value.premultiply(PZ),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 nxe(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,ge=he%ce.boundary,Re=he+ge;D+=ge,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 ixe=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]),Xh=null;function rxe(){return Xh===null&&(Xh=new NA(ixe,16,16,Ws,Wi),Xh.name="DFG_LUT",Xh.minFilter=Mi,Xh.magFilter=Mi,Xh.wrapS=oa,Xh.wrapT=oa,Xh.generateMipmaps=!1,Xh.needsUpdate=!0),Xh}var CM=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([f0,kh,Uh]),T=new Set([Ji,xi,xl,la,jA,XA]),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=oo,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let k=this,z=!1,G=null,W=null,Y=null,H=null;this._outputColorSpace=Nr;let $=0,J=0,te=null,ce=-1,he=null,ge=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 Nc,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 ve=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",ns,!1),ve===null){let Se="webgl2";if(ve=vi(Se,ne),ve===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,sn,Lt,Rt,fn,wn,Dn,ye,wt,Ze,St,Bt,ut;function Ce(){zn=new hve(ve),zn.init(),St=new K_e(ve,zn),le=new ive(ve,zn,e,St),Z=new Y_e(ve,zn),le.reversedDepthBuffer&&d&&Z.buffers.depth.setReversed(!0),W=ve.createFramebuffer(),Y=ve.createFramebuffer(),H=ve.createFramebuffer(),Te=new pve(ve),Pe=new F_e,Ge=new Z_e(ve,zn,Z,Pe,le,St,Te),vt=new uve(k),Tt=new vAe(ve),Bt=new tve(ve,Tt),qe=new fve(ve,Tt,Te,Bt),Je=new Ave(ve,qe,Tt,Bt,Te),ye=new mve(ve,le,Ge),fn=new rve(Pe),Pt=new N_e(k,vt,zn,le,Bt,fn),sn=new txe(k,Pe),Lt=new O_e,Rt=new q_e(zn),Dn=new eve(k,vt,Z,Je,y,l),wn=new $_e(k,Je,le),ut=new nxe(ve,Te,le,Z),wt=new nve(ve,zn,Te),Ze=new dve(ve,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 vve(w,t.width,t.height,a,r,s));let Yt=new hF(k,ve);this.xr=Yt,this.getContext=function(){return ve},this.getContextAttributes=function(){return ve.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(ge)},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(ge.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(),on=Dn.getClearAlpha(),pn=Vt.r,Wn=Vt.g,Jn=Vt.b;Qt?(R[0]=pn,R[1]=Wn,R[2]=Jn,R[3]=on,ve.clearBufferuiv(ve.COLOR,0,R)):(P[0]=pn,P[1]=Wn,P[2]=Jn,P[3]=on,ve.clearBufferiv(ve.COLOR,0,P))}else De|=ve.COLOR_BUFFER_BIT}Se&&(De|=ve.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),ke&&(De|=ve.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),De!==0&&ve.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",ns,!1),Dn.dispose(),Lt.dispose(),Rt.dispose(),Pe.dispose(),vt.dispose(),Je.dispose(),Bt.dispose(),ut.dispose(),Pt.dispose(),Yt.dispose(),Yt.removeEventListener("sessionstart",Zs),Yt.removeEventListener("sessionend",Nl),Ju.stop()};function nr(ne){ne.preventDefault(),RA("WebGLRenderer: Context Lost."),z=!0}function Fn(){RA("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 ns(ne){ze("WebGLRenderer: A WebGL context could not be created. Reason: ",ne.statusMessage)}function Pr(ne){let Se=ne.target;Se.removeEventListener("dispose",Pr),Ll(Se)}function Ll(ne){ba(ne),Pe.remove(ne)}function ba(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=dG(ne,Se,ke,De,Ne);Z.setMaterial(De,Qt);let on=ke.index,pn=1;if(De.wireframe===!0){if(on=qe.getWireframeAttribute(ke),on===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)),on!==null?(gn=Math.max(gn,0),Yi=Math.min(Yi,on.count)):Jn!=null&&(gn=Math.max(gn,0),Yi=Math.min(Yi,Jn.count));let is=Yi-gn;if(is<0||is===1/0)return;Bt.setup(Ne,De,Vt,ke,on);let Gr,ir=wt;if(on!==null&&(Gr=Tt.get(on),ir=Ze,ir.setIndex(Gr)),Ne.isMesh)De.wireframe===!0?(Z.setLineWidth(De.wireframeLinewidth*bn()),ir.setMode(ve.LINES)):ir.setMode(ve.TRIANGLES);else if(Ne.isLine){let Eo=De.linewidth;Eo===void 0&&(Eo=1),Z.setLineWidth(Eo*bn()),Ne.isLineSegments?ir.setMode(ve.LINES):Ne.isLineLoop?ir.setMode(ve.LINE_LOOP):ir.setMode(ve.LINE_STRIP)}else Ne.isPoints?ir.setMode(ve.POINTS):Ne.isSprite&&ir.setMode(ve.TRIANGLES);if(Ne.isBatchedMesh)if(zn.get("WEBGL_multi_draw"))ir.renderMultiDraw(Ne._multiDrawStarts,Ne._multiDrawCounts,Ne._multiDrawCount);else{let Eo=Ne._multiDrawStarts,Zt=Ne._multiDrawCounts,il=Ne._multiDrawCount,yi=on?Tt.get(on).bytesPerElement:1,Fl=Pe.get(De).currentProgram.getUniforms();for(let tu=0;tu<il;tu++)Fl.setValue(ve,"_gl_DrawID",tu),ir.render(Eo[tu]/yi,Zt[tu])}else if(Ne.isInstancedMesh)ir.renderInstances(gn,is,Ne.count);else if(ke.isInstancedBufferGeometry){let Eo=ke._maxInstanceCount!==void 0?ke._maxInstanceCount:1/0,Zt=Math.min(ke.instanceCount,Eo);ir.renderInstances(gn,is,Zt)}else ir.render(gn,is)};function Dl(ne,Se,ke){ne.transparent===!0&&ne.side===gr&&ne.forceSinglePass===!1?(ne.side=mi,ne.needsUpdate=!0,Rx(ne,Se,ke),ne.side=Bo,ne.needsUpdate=!0,Rx(ne,Se,ke),ne.side=gr):Rx(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];Dl(Vt,ke,Ne),De.add(Vt)}else Dl(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 nl=null;function _r(ne){nl&&nl(ne)}function Zs(){Ju.stop()}function Nl(){Ju.start()}let Ju=new TZ;Ju.setAnimationLoop(_r),typeof self<"u"&&Ju.setContext(self),this.setAnimationLoop=function(ne){nl=ne,Yt.setAnimationLoop(ne),ne===null?Ju.stop():Ju.start()},Yt.addEventListener("sessionstart",Zs),Yt.addEventListener("sessionend",Nl),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,Fo,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&&kS(Qt,Se,-1/0,k.sortObjects)}kS(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 on=Se.cameras;if(Vt.length>0)for(let pn=0,Wn=on.length;pn<Wn;pn++){let Jn=on[pn];PP(Qt,Vt,ne,Jn)}tn&&Dn.render(ne);for(let pn=0,Wn=on.length;pn<Wn;pn++){let Jn=on[pn];IP(F,ne,Jn,Jn.viewport)}}else Vt.length>0&&PP(Qt,Vt,ne,Se),tn&&Dn.render(ne),IP(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 kS(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 on=Qt.groups;for(let pn=0,Wn=on.length;pn<Wn;pn++){let Jn=on[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++)kS(qt[Qt],Se,ke,De)}function IP(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(ge.copy(De)),Ne.length>0&&Cx(Ne,Se,ke),qt.length>0&&Cx(qt,Se,ke),Qt.length>0&&Cx(Qt,Se,ke),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function PP(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 Fa(1,1,{generateMipmaps:!0,type:gn?Wi:Ji,minFilter:Uo,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||ge;qt.setSize(Qt.z*k.transmissionResolutionScale,Qt.w*k.transmissionResolutionScale);let Vt=k.getRenderTarget(),on=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=oo;let Jn=De.viewport;if(De.viewport!==void 0&&(De.viewport=void 0),D.setupLightsView(De),ot===!0&&fn.setGlobalState(k.clippingPlanes,De),Cx(ne,ke,De),Ge.updateMultisampleRenderTarget(qt),Ge.updateRenderTargetMipmap(qt),zn.has("WEBGL_multisampled_render_to_texture")===!1){let gn=!1;for(let Yi=0,is=Se.length;Yi<is;Yi++){let Gr=Se[Yi],{object:ir,geometry:Eo,material:Zt,group:il}=Gr;if(Zt.side===gr&&ir.layers.test(De.layers)){let yi=Zt.side;Zt.side=mi,Zt.needsUpdate=!0,LP(ir,ke,De,Eo,Zt,il),Zt.side=yi,Zt.needsUpdate=!0,gn=!0}}gn===!0&&(Ge.updateMultisampleRenderTarget(qt),Ge.updateRenderTargetMipmap(qt))}k.setRenderTarget(Vt,on,pn),k.setClearColor(Fe,mt),Jn!==void 0&&(De.viewport=Jn),k.toneMapping=Wn}function Cx(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:on,group:pn}=Qt,Wn=Qt.material;Wn.allowOverride===!0&&De!==null&&(Wn=De),Vt.layers.test(ke.layers)&&LP(Vt,Se,ke,on,Wn,pn)}}function LP(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===gr&&Ne.forceSinglePass===!1?(Ne.side=mi,Ne.needsUpdate=!0,k.renderBufferDirect(ke,Se,De,Ne,ne,qt),Ne.side=Bo,Ne.needsUpdate=!0,k.renderBufferDirect(ke,Se,De,Ne,ne,qt),Ne.side=gr):k.renderBufferDirect(ke,Se,De,Ne,ne,qt),ne.onAfterRender(k,Se,ke,De,Ne,qt)}function Rx(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),on=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",Pr),pn=new Map,De.programs=pn);let Jn=pn.get(on);if(Jn!==void 0){if(De.currentProgram===Jn&&De.lightsStateVersion===Qt)return NP(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,on),pn.set(on,Jn),De.uniforms=Vt.uniforms;let gn=De.uniforms;return(!ne.isShaderMaterial&&!ne.isRawShaderMaterial||ne.clipping===!0)&&(gn.clippingPlanes=fn.uniform),NP(ne,Vt),De.needsLights=mG(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 DP(ne){if(ne.uniformsList===null){let Se=ne.currentProgram.getUniforms();ne.uniformsList=n_.seqWithValue(Se.seq,ne.uniforms)}return ne.uniformsList}function NP(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 fG(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 dG(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,on=De.isMeshStandardMaterial||De.isMeshLambertMaterial&&!De.envMap||De.isMeshPhongMaterial&&!De.envMap,pn=vt.get(De.envMap||Qt,on),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,is=!!ke.morphAttributes.color,Gr=oo;De.toneMapped&&(te===null||te.isXRRenderTarget===!0)&&(Gr=k.toneMapping);let ir=ke.morphAttributes.position||ke.morphAttributes.normal||ke.morphAttributes.color,Eo=ir!==void 0?ir.length:0,Zt=Pe.get(De),il=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!==il.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!==is||Zt.toneMapping!==Gr||Zt.morphTargetsCount!==Eo||!!Zt.lightProbeGrid!=D.state.lightProbeGridArray.length>0)&&(yi=!0):(yi=!0,Zt.__version=De.version);let Fl=Zt.currentProgram;yi===!0&&(Fl=Rx(De,Se,Ne),G&&De.isNodeMaterial&&G.onUpdateProgram(De,Fl,Zt));let tu=!1,Of=!1,Pm=!1,rr=Fl.getUniforms(),rs=Zt.uniforms;if(Z.useProgram(Fl.program)&&(tu=!0,Of=!0,Pm=!0),De.id!==ce&&(ce=De.id,Of=!0),Zt.needsLights){let pr=fG(D.state.lightProbeGridArray,Ne);Zt.lightProbeGrid!==pr&&(Zt.lightProbeGrid=pr,Of=!0)}if(tu||he!==ne){Z.buffers.depth.getReversed()&&ne.reversedDepth!==!0&&(ne._reversedDepth=!0,ne.updateProjectionMatrix()),rr.setValue(ve,"projectionMatrix",ne.projectionMatrix),rr.setValue(ve,"viewMatrix",ne.matrixWorldInverse);let kf=rr.map.cameraPosition;kf!==void 0&&kf.setValue(ve,yt.setFromMatrixPosition(ne.matrixWorld)),le.logarithmicDepthBuffer&&rr.setValue(ve,"logDepthBufFC",2/(Math.log(ne.far+1)/Math.LN2)),(De.isMeshPhongMaterial||De.isMeshToonMaterial||De.isMeshLambertMaterial||De.isMeshBasicMaterial||De.isMeshStandardMaterial||De.isShaderMaterial)&&rr.setValue(ve,"isOrthographic",ne.isOrthographicCamera===!0),he!==ne&&(he=ne,Of=!0,Pm=!0)}if(Zt.needsLights&&(il.state.directionalShadowMap.length>0&&rr.setValue(ve,"directionalShadowMap",il.state.directionalShadowMap,Ge),il.state.spotShadowMap.length>0&&rr.setValue(ve,"spotShadowMap",il.state.spotShadowMap,Ge),il.state.pointShadowMap.length>0&&rr.setValue(ve,"pointShadowMap",il.state.pointShadowMap,Ge)),Ne.isSkinnedMesh){rr.setOptional(ve,Ne,"bindMatrix"),rr.setOptional(ve,Ne,"bindMatrixInverse");let pr=Ne.skeleton;pr&&(pr.boneTexture===null&&pr.computeBoneTexture(),rr.setValue(ve,"boneTexture",pr.boneTexture,Ge))}Ne.isBatchedMesh&&(rr.setOptional(ve,Ne,"batchingTexture"),rr.setValue(ve,"batchingTexture",Ne._matricesTexture,Ge),rr.setOptional(ve,Ne,"batchingIdTexture"),rr.setValue(ve,"batchingIdTexture",Ne._indirectTexture,Ge),rr.setOptional(ve,Ne,"batchingColorTexture"),Ne._colorsTexture!==null&&rr.setValue(ve,"batchingColorTexture",Ne._colorsTexture,Ge));let Uf=ke.morphAttributes;if((Uf.position!==void 0||Uf.normal!==void 0||Uf.color!==void 0)&&ye.update(Ne,ke,Fl),(Of||Zt.receiveShadow!==Ne.receiveShadow)&&(Zt.receiveShadow=Ne.receiveShadow,rr.setValue(ve,"receiveShadow",Ne.receiveShadow)),(De.isMeshStandardMaterial||De.isMeshLambertMaterial||De.isMeshPhongMaterial)&&De.envMap===null&&Se.environment!==null&&(rs.envMapIntensity.value=Se.environmentIntensity),rs.dfgLUT!==void 0&&(rs.dfgLUT.value=rxe()),Of){if(rr.setValue(ve,"toneMappingExposure",k.toneMappingExposure),Zt.needsLights&&pG(rs,Pm),qt&&De.fog===!0&&sn.refreshFogUniforms(rs,qt),sn.refreshMaterialUniforms(rs,De,Ye,Ve,D.state.transmissionRenderTarget[ne.id]),Zt.needsLights&&Zt.lightProbeGrid){let pr=Zt.lightProbeGrid;rs.probesSH.value=pr.texture,rs.probesMin.value.copy(pr.boundingBox.min),rs.probesMax.value.copy(pr.boundingBox.max),rs.probesResolution.value.copy(pr.resolution)}n_.upload(ve,DP(Zt),rs,Ge)}if(De.isShaderMaterial&&De.uniformsNeedUpdate===!0&&(n_.upload(ve,DP(Zt),rs,Ge),De.uniformsNeedUpdate=!1),De.isSpriteMaterial&&rr.setValue(ve,"center",Ne.center),rr.setValue(ve,"modelViewMatrix",Ne.modelViewMatrix),rr.setValue(ve,"normalMatrix",Ne.normalMatrix),rr.setValue(ve,"modelMatrix",Ne.matrixWorld),De.uniformsGroups!==void 0){let pr=De.uniformsGroups;for(let kf=0,Lm=pr.length;kf<Lm;kf++){let FP=pr[kf];ut.update(FP,Fl),ut.bind(FP,Fl)}}return Fl}function pG(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 mG(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(ve.FRAMEBUFFER,Vt.__webglFramebuffer),ge.copy(ne.viewport),Re.copy(ne.scissor),Qe=ne.scissorTest,Z.viewport(ge),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 on=ne.texture;(on.isData3DTexture||on.isDataArrayTexture||on.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,ge.copy(ne.viewport),Re.copy(ne.scissor),Qe=ne.scissorTest}else ge.copy(It).multiplyScalar(Ye).floor(),Re.copy(dn).multiplyScalar(Ye).floor(),Qe=Gt;if(ke!==0&&(De=W),Z.bindFramebuffer(ve.FRAMEBUFFER,De)&&Z.drawBuffers(ne,De),Z.viewport(ge),Z.scissor(Re),Z.setScissorTest(Qe),Ne){let Vt=Pe.get(ne.texture);ve.framebufferTexture2D(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Vt.__webglTexture,ke)}else if(qt){let Vt=Se;for(let on=0;on<ne.textures.length;on++){let pn=Pe.get(ne.textures[on]);ve.framebufferTextureLayer(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0+on,pn.__webglTexture,ke,Vt)}}else if(ne!==null&&ke!==0){let Vt=Pe.get(ne.texture);ve.framebufferTexture2D(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.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 on=Pe.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&Qt!==void 0&&(on=on[Qt]),on){Z.bindFramebuffer(ve.FRAMEBUFFER,on);try{let pn=ne.textures[Vt],Wn=pn.format,Jn=pn.type;if(ne.textures.length>1&&ve.readBuffer(ve.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&&ve.readPixels(Se,ke,De,Ne,St.convert(Wn),St.convert(Jn),qt)}finally{let pn=te!==null?Pe.get(te).__webglFramebuffer:null;Z.bindFramebuffer(ve.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 on=Pe.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&Qt!==void 0&&(on=on[Qt]),on)if(Se>=0&&Se<=ne.width-De&&ke>=0&&ke<=ne.height-Ne){Z.bindFramebuffer(ve.FRAMEBUFFER,on);let pn=ne.textures[Vt],Wn=pn.format,Jn=pn.type;if(ne.textures.length>1&&ve.readBuffer(ve.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=ve.createBuffer();ve.bindBuffer(ve.PIXEL_PACK_BUFFER,gn),ve.bufferData(ve.PIXEL_PACK_BUFFER,qt.byteLength,ve.STREAM_READ),ve.readPixels(Se,ke,De,Ne,St.convert(Wn),St.convert(Jn),0);let Yi=te!==null?Pe.get(te).__webglFramebuffer:null;Z.bindFramebuffer(ve.FRAMEBUFFER,Yi);let is=ve.fenceSync(ve.SYNC_GPU_COMMANDS_COMPLETE,0);return ve.flush(),await $Y(ve,is,4),ve.bindBuffer(ve.PIXEL_PACK_BUFFER,gn),ve.getBufferSubData(ve.PIXEL_PACK_BUFFER,0,qt),ve.deleteBuffer(gn),ve.deleteSync(is),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),ve.copyTexSubImage2D(ve.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,on,pn,Wn,Jn,gn,Yi,is,Gr=ne.isCompressedTexture?ne.mipmaps[qt]:ne.image;if(ke!==null)Qt=ke.max.x-ke.min.x,Vt=ke.max.y-ke.min.y,on=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 rs=Math.pow(2,-Ne);Qt=Math.floor(Gr.width*rs),Vt=Math.floor(Gr.height*rs),ne.isDataArrayTexture?on=Gr.depth:ne.isData3DTexture?on=Math.floor(Gr.depth*rs):on=1,pn=0,Wn=0,Jn=0}De!==null?(gn=De.x,Yi=De.y,is=De.z):(gn=0,Yi=0,is=0);let ir=St.convert(Se.format),Eo=St.convert(Se.type),Zt;Se.isData3DTexture?(Ge.setTexture3D(Se,0),Zt=ve.TEXTURE_3D):Se.isDataArrayTexture||Se.isCompressedArrayTexture?(Ge.setTexture2DArray(Se,0),Zt=ve.TEXTURE_2D_ARRAY):(Ge.setTexture2D(Se,0),Zt=ve.TEXTURE_2D),Z.activeTexture(ve.TEXTURE0),Z.pixelStorei(ve.UNPACK_FLIP_Y_WEBGL,Se.flipY),Z.pixelStorei(ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Se.premultiplyAlpha),Z.pixelStorei(ve.UNPACK_ALIGNMENT,Se.unpackAlignment);let il=Z.getParameter(ve.UNPACK_ROW_LENGTH),yi=Z.getParameter(ve.UNPACK_IMAGE_HEIGHT),Fl=Z.getParameter(ve.UNPACK_SKIP_PIXELS),tu=Z.getParameter(ve.UNPACK_SKIP_ROWS),Of=Z.getParameter(ve.UNPACK_SKIP_IMAGES);Z.pixelStorei(ve.UNPACK_ROW_LENGTH,Gr.width),Z.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,Gr.height),Z.pixelStorei(ve.UNPACK_SKIP_PIXELS,pn),Z.pixelStorei(ve.UNPACK_SKIP_ROWS,Wn),Z.pixelStorei(ve.UNPACK_SKIP_IMAGES,Jn);let Pm=ne.isDataArrayTexture||ne.isData3DTexture,rr=Se.isDataArrayTexture||Se.isData3DTexture;if(ne.isDepthTexture){let rs=Pe.get(ne),Uf=Pe.get(Se),pr=Pe.get(rs.__renderTarget),kf=Pe.get(Uf.__renderTarget);Z.bindFramebuffer(ve.READ_FRAMEBUFFER,pr.__webglFramebuffer),Z.bindFramebuffer(ve.DRAW_FRAMEBUFFER,kf.__webglFramebuffer);for(let Lm=0;Lm<on;Lm++)Pm&&(ve.framebufferTextureLayer(ve.READ_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,Pe.get(ne).__webglTexture,Ne,Jn+Lm),ve.framebufferTextureLayer(ve.DRAW_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,Pe.get(Se).__webglTexture,qt,is+Lm)),ve.blitFramebuffer(pn,Wn,Qt,Vt,gn,Yi,Qt,Vt,ve.DEPTH_BUFFER_BIT,ve.NEAREST);Z.bindFramebuffer(ve.READ_FRAMEBUFFER,null),Z.bindFramebuffer(ve.DRAW_FRAMEBUFFER,null)}else if(Ne!==0||ne.isRenderTargetTexture||Pe.has(ne)){let rs=Pe.get(ne),Uf=Pe.get(Se);Z.bindFramebuffer(ve.READ_FRAMEBUFFER,Y),Z.bindFramebuffer(ve.DRAW_FRAMEBUFFER,H);for(let pr=0;pr<on;pr++)Pm?ve.framebufferTextureLayer(ve.READ_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,rs.__webglTexture,Ne,Jn+pr):ve.framebufferTexture2D(ve.READ_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.TEXTURE_2D,rs.__webglTexture,Ne),rr?ve.framebufferTextureLayer(ve.DRAW_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,Uf.__webglTexture,qt,is+pr):ve.framebufferTexture2D(ve.DRAW_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.TEXTURE_2D,Uf.__webglTexture,qt),Ne!==0?ve.blitFramebuffer(pn,Wn,Qt,Vt,gn,Yi,Qt,Vt,ve.COLOR_BUFFER_BIT,ve.NEAREST):rr?ve.copyTexSubImage3D(Zt,qt,gn,Yi,is+pr,pn,Wn,Qt,Vt):ve.copyTexSubImage2D(Zt,qt,gn,Yi,pn,Wn,Qt,Vt);Z.bindFramebuffer(ve.READ_FRAMEBUFFER,null),Z.bindFramebuffer(ve.DRAW_FRAMEBUFFER,null)}else rr?ne.isDataTexture||ne.isData3DTexture?ve.texSubImage3D(Zt,qt,gn,Yi,is,Qt,Vt,on,ir,Eo,Gr.data):Se.isCompressedArrayTexture?ve.compressedTexSubImage3D(Zt,qt,gn,Yi,is,Qt,Vt,on,ir,Gr.data):ve.texSubImage3D(Zt,qt,gn,Yi,is,Qt,Vt,on,ir,Eo,Gr):ne.isDataTexture?ve.texSubImage2D(ve.TEXTURE_2D,qt,gn,Yi,Qt,Vt,ir,Eo,Gr.data):ne.isCompressedTexture?ve.compressedTexSubImage2D(ve.TEXTURE_2D,qt,gn,Yi,Gr.width,Gr.height,ir,Gr.data):ve.texSubImage2D(ve.TEXTURE_2D,qt,gn,Yi,Qt,Vt,ir,Eo,Gr);Z.pixelStorei(ve.UNPACK_ROW_LENGTH,il),Z.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,yi),Z.pixelStorei(ve.UNPACK_SKIP_PIXELS,Fl),Z.pixelStorei(ve.UNPACK_SKIP_ROWS,tu),Z.pixelStorei(ve.UNPACK_SKIP_IMAGES,Of),qt===0&&Se.generateMipmaps&&ve.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 Fo}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 PM=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}},r_=new re,LZ=new cn,DZ=new cn,NZ=new re,FZ=new re,LM=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(),LZ.copy(w.matrixWorldInverse),DZ.multiplyMatrices(w.projectionMatrix,LZ),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){r_.setFromMatrixPosition(y.matrixWorld),r_.applyMatrix4(DZ);let T=r_.z>=-1&&r_.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("+(r_.x*s+s)+"px,"+(-r_.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 NZ.setFromMatrixPosition(y.matrixWorld),FZ.setFromMatrixPosition(w.matrixWorld),NZ.distanceToSquared(FZ)}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 sxe(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var Tb=sxe;var oxe=typeof global=="object"&&global&&global.Object===Object&&global,BZ=oxe;var axe=typeof self=="object"&&self&&self.Object===Object&&self,lxe=BZ||axe||Function("return this")(),DM=lxe;var cxe=function(){return DM.Date.now()},NM=cxe;var uxe=/\s/;function hxe(i){for(var e=i.length;e--&&uxe.test(i.charAt(e)););return e}var OZ=hxe;var fxe=/^\s+/;function dxe(i){return i&&i.slice(0,OZ(i)+1).replace(fxe,"")}var UZ=dxe;var pxe=DM.Symbol,s_=pxe;var kZ=Object.prototype,mxe=kZ.hasOwnProperty,Axe=kZ.toString,Eb=s_?s_.toStringTag:void 0;function gxe(i){var e=mxe.call(i,Eb),t=i[Eb];try{i[Eb]=void 0;var n=!0}catch{}var r=Axe.call(i);return n&&(e?i[Eb]=t:delete i[Eb]),r}var zZ=gxe;var vxe=Object.prototype,_xe=vxe.toString;function xxe(i){return _xe.call(i)}var VZ=xxe;var yxe="[object Null]",bxe="[object Undefined]",GZ=s_?s_.toStringTag:void 0;function wxe(i){return i==null?i===void 0?bxe:yxe:GZ&&GZ in Object(i)?zZ(i):VZ(i)}var qZ=wxe;function Sxe(i){return i!=null&&typeof i=="object"}var HZ=Sxe;var Txe="[object Symbol]";function Exe(i){return typeof i=="symbol"||HZ(i)&&qZ(i)==Txe}var WZ=Exe;var jZ=NaN,Mxe=/^[-+]0x[0-9a-f]+$/i,Cxe=/^0b[01]+$/i,Rxe=/^0o[0-7]+$/i,Ixe=parseInt;function Pxe(i){if(typeof i=="number")return i;if(WZ(i))return jZ;if(Tb(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=Tb(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=UZ(i);var t=Cxe.test(i);return t||Rxe.test(i)?Ixe(i.slice(2),t?2:8):Mxe.test(i)?jZ:+i}var fF=Pxe;var Lxe="Expected a function",Dxe=Math.max,Nxe=Math.min;function Fxe(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(Lxe);e=fF(e)||0,Tb(t)&&(u=!!t.leading,f="maxWait"in t,s=f?Dxe(fF(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?Nxe(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=NM();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(NM())}function F(){var D=NM(),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 XZ=Fxe;function $Z(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 Bxe(i){if(Array.isArray(i))return i}function Oxe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Uxe(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function kxe(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 zxe(){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 Vxe(i,e){return Bxe(i)||kxe(i,e)||Gxe(i,e)||zxe()}function Gxe(i,e){if(i){if(typeof i=="string")return $Z(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)?$Z(i,e):void 0}}var qxe=Uxe(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;Oxe(this,i),this.name=e,this.defaultVal=r,this.triggerUpdate=o,this.onChange=l});function Zr(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 qxe(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=XZ(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(ge,Re){}:J,ce=W.defaultVal,he=ce===void 0?null:ce;return function(ge){var Re=D[Y];if(!arguments.length)return Re;var Qe=ge===void 0?he:ge;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=Vxe(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 Kr=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-Kr.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?Kr.Bounce.In(i*2)*.5:Kr.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}}}}),Mb=function(){return performance.now()},og=(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=Mb()),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})(),o_={Linear:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=o_.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=o_.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=o_.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=o_.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}}},YZ=(function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i})(),dF=new og,co=(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=Kr.Linear.None,this._interpolationFunction=o_.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=YZ.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=dF,dF.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=Mb()),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=Mb()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},i.prototype.resume=function(e){return e===void 0&&(e=Mb()),!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=Kr.Linear.None),this._easingFunction=e,this},i.prototype.interpolation=function(e){return e===void 0&&(e=o_.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=Mb()),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 kKe=YZ.nextId,$h=dF,zKe=$h.getAll.bind($h),VKe=$h.removeAll.bind($h),GKe=$h.add.bind($h),qKe=$h.remove.bind($h),HKe=$h.update.bind($h);function ZZ(i){let e=+this._x.call(null,i),t=+this._y.call(null,i),n=+this._z.call(null,i);return KZ(this.cover(e,t,n),e,t,n,i)}function KZ(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 QZ(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)KZ(this,t[f],n[f],r[f],i[f]);return this}function JZ(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 eK(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function tK(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 nK(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 Hxe=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function iK(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;Hxe(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 rK(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 sK(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function oK(){return this._root}function aK(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function lK(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 cK(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 uK(i){return i[0]}function hK(i){return arguments.length?(this._x=i,this):this._x}function fK(i){return i[1]}function dK(i){return arguments.length?(this._y=i,this):this._y}function pK(i){return i[2]}function mK(i){return arguments.length?(this._z=i,this):this._z}function Cb(i,e,t,n){var r=new pF(e??uK,t??fK,n??pK,NaN,NaN,NaN,NaN,NaN,NaN);return i==null?r:r.addAll(i)}function pF(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 AK(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var ko=Cb.prototype=pF.prototype;ko.copy=function(){var i=new pF(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=AK(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]=AK(n));return i};ko.add=ZZ;ko.addAll=QZ;ko.cover=JZ;ko.data=eK;ko.extent=tK;ko.find=nK;ko.findAllWithinRadius=iK;ko.remove=rK;ko.removeAll=sK;ko.root=oK;ko.size=aK;ko.visit=lK;ko.visitAfter=cK;ko.x=hK;ko.y=dK;ko.z=mK;function ag(i,e){return i==null||e==null?NaN:i<e?-1:i>e?1:i>=e?0:NaN}function mF(i,e){return i==null||e==null?NaN:e<i?-1:e>i?1:e>=i?0:NaN}function FM(i){let e,t,n;i.length!==2?(e=ag,t=(a,l)=>ag(i(a),l),n=(a,l)=>i(a)-l):(e=i===ag||i===mF?i:Wxe,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 Wxe(){return 0}function AF(i){return i===null?NaN:+i}var gK=FM(ag),vK=gK.right,jxe=gK.left,Xxe=FM(AF).center,Rb=vK;function z0(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 zo=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 $xe=Math.sqrt(50),Yxe=Math.sqrt(10),Zxe=Math.sqrt(2);function BM(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>=$xe?10:s>=Yxe?5:s>=Zxe?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?BM(i,e,t*2):[a,l,c]}function OM(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?BM(e,i,t):BM(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 Ib(i,e,t){return e=+e,i=+i,t=+t,BM(i,e,t)[2]}function gF(i,e,t){e=+e,i=+i,t=+t;let n=e<i,r=n?Ib(e,i,t):Ib(i,e,t);return(n?-1:1)*(r<0?1/-r:r)}function UM(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 kM(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*Kxe(i){for(let e of i)yield*e}function Yh(i){return Array.from(Kxe(i))}function Ld(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 zM(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 VM(i,e){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(e).domain(i);break}return this}function GM(i,e,t){i.prototype=e.prototype=t,t.constructor=i}function vF(i,e){var t=Object.create(i.prototype);for(var n in e)t[n]=e[n];return t}function Db(){}var Pb=.7,WM=1/Pb,a_="\\s*([+-]?\\d+)\\s*",Lb="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Zh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Qxe=/^#([0-9a-f]{3,8})$/,Jxe=new RegExp(`^rgb\\(${a_},${a_},${a_}\\)$`),eye=new RegExp(`^rgb\\(${Zh},${Zh},${Zh}\\)$`),tye=new RegExp(`^rgba\\(${a_},${a_},${a_},${Lb}\\)$`),nye=new RegExp(`^rgba\\(${Zh},${Zh},${Zh},${Lb}\\)$`),iye=new RegExp(`^hsl\\(${Lb},${Zh},${Zh}\\)$`),rye=new RegExp(`^hsla\\(${Lb},${Zh},${Zh},${Lb}\\)$`),_K={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};GM(Db,Nu,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:xK,formatHex:xK,formatHex8:sye,formatHsl:oye,formatRgb:yK,toString:yK});function xK(){return this.rgb().formatHex()}function sye(){return this.rgb().formatHex8()}function oye(){return MK(this).formatHsl()}function yK(){return this.rgb().formatRgb()}function Nu(i){var e,t;return i=(i+"").trim().toLowerCase(),(e=Qxe.exec(i))?(t=e[1].length,e=parseInt(e[1],16),t===6?bK(e):t===3?new yl(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?qM(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?qM(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=Jxe.exec(i))?new yl(e[1],e[2],e[3],1):(e=eye.exec(i))?new yl(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=tye.exec(i))?qM(e[1],e[2],e[3],e[4]):(e=nye.exec(i))?qM(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=iye.exec(i))?TK(e[1],e[2]/100,e[3]/100,1):(e=rye.exec(i))?TK(e[1],e[2]/100,e[3]/100,e[4]):_K.hasOwnProperty(i)?bK(_K[i]):i==="transparent"?new yl(NaN,NaN,NaN,0):null}function bK(i){return new yl(i>>16&255,i>>8&255,i&255,1)}function qM(i,e,t,n){return n<=0&&(i=e=t=NaN),new yl(i,e,t,n)}function aye(i){return i instanceof Db||(i=Nu(i)),i?(i=i.rgb(),new yl(i.r,i.g,i.b,i.opacity)):new yl}function l_(i,e,t,n){return arguments.length===1?aye(i):new yl(i,e,t,n??1)}function yl(i,e,t,n){this.r=+i,this.g=+e,this.b=+t,this.opacity=+n}GM(yl,l_,vF(Db,{brighter(i){return i=i==null?WM:Math.pow(WM,i),new yl(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?Pb:Math.pow(Pb,i),new yl(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new yl(cg(this.r),cg(this.g),cg(this.b),jM(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:wK,formatHex:wK,formatHex8:lye,formatRgb:SK,toString:SK}));function wK(){return`#${lg(this.r)}${lg(this.g)}${lg(this.b)}`}function lye(){return`#${lg(this.r)}${lg(this.g)}${lg(this.b)}${lg((isNaN(this.opacity)?1:this.opacity)*255)}`}function SK(){let i=jM(this.opacity);return`${i===1?"rgb(":"rgba("}${cg(this.r)}, ${cg(this.g)}, ${cg(this.b)}${i===1?")":`, ${i})`}`}function jM(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function cg(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function lg(i){return i=cg(i),(i<16?"0":"")+i.toString(16)}function TK(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new Du(i,e,t,n)}function MK(i){if(i instanceof Du)return new Du(i.h,i.s,i.l,i.opacity);if(i instanceof Db||(i=Nu(i)),!i)return new Du;if(i instanceof Du)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 Du(o,a,l,i.opacity)}function CK(i,e,t,n){return arguments.length===1?MK(i):new Du(i,e,t,n??1)}function Du(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}GM(Du,CK,vF(Db,{brighter(i){return i=i==null?WM:Math.pow(WM,i),new Du(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?Pb:Math.pow(Pb,i),new Du(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 yl(_F(i>=240?i-240:i+120,r,n),_F(i,r,n),_F(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new Du(EK(this.h),HM(this.s),HM(this.l),jM(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=jM(this.opacity);return`${i===1?"hsl(":"hsla("}${EK(this.h)}, ${HM(this.s)*100}%, ${HM(this.l)*100}%${i===1?")":`, ${i})`}`}}));function EK(i){return i=(i||0)%360,i<0?i+360:i}function HM(i){return Math.max(0,Math.min(1,i||0))}function _F(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 xF(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 RK(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 xF((t-n/e)*e,o,r,s,a)}}function IK(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 xF((t-n/e)*e,r,s,o,a)}}var Nb=i=>()=>i;function cye(i,e){return function(t){return i+t*e}}function uye(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 PK(i){return(i=+i)==1?XM:function(e,t){return t-e?uye(e,t,i):Nb(isNaN(e)?t:e)}}function XM(i,e){var t=e-i;return t?cye(i,t):Nb(isNaN(i)?e:i)}var yF=(function i(e){var t=PK(e);function n(r,s){var o=t((r=l_(r)).r,(s=l_(s)).r),a=t(r.g,s.g),l=t(r.b,s.b),c=XM(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 LK(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=l_(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 _Je=LK(RK),xJe=LK(IK);function $M(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 YM(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function bF(i,e){return(YM(e)?$M:wF)(i,e)}function wF(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]=ug(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 DK(i,e){var t=new Date;return i=+i,e=+e,function(n){return t.setTime(i*(1-n)+e*n),t}}function Kh(i,e){return i=+i,e=+e,function(t){return i*(1-t)+e*t}}function NK(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]=ug(i[r],e[r]):n[r]=e[r];return function(s){for(r in t)n[r]=t[r](s);return n}}var TF=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,SF=new RegExp(TF.source,"g");function hye(i){return function(){return i}}function fye(i){return function(e){return i(e)+""}}function FK(i,e){var t=TF.lastIndex=SF.lastIndex=0,n,r,s,o=-1,a=[],l=[];for(i=i+"",e=e+"";(n=TF.exec(i))&&(r=SF.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:Kh(n,r)})),t=SF.lastIndex;return t<e.length&&(s=e.slice(t),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?fye(l[0].x):hye(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 ug(i,e){var t=typeof e,n;return e==null||t==="boolean"?Nb(e):(t==="number"?Kh:t==="string"?(n=Nu(e))?(e=n,yF):FK:e instanceof Nu?yF:e instanceof Date?DK:YM(e)?$M:Array.isArray(e)?wF:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?NK:Kh)(i,e)}function EF(i,e){return i=+i,e=+e,function(t){return Math.round(i*(1-t)+e*t)}}function MF(i){return function(){return i}}function CF(i){return+i}var BK=[0,1];function c_(i){return i}function RF(i,e){return(e-=i=+i)?function(t){return(t-i)/e}:MF(isNaN(e)?NaN:.5)}function dye(i,e){var t;return i>e&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function pye(i,e,t){var n=i[0],r=i[1],s=e[0],o=e[1];return r<n?(n=RF(r,n),s=t(o,s)):(n=RF(n,r),s=t(s,o)),function(a){return s(n(a))}}function mye(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]=RF(i[o],i[o+1]),s[o]=t(e[o],e[o+1]);return function(a){var l=Rb(i,a,1,n)-1;return s[l](r[l](a))}}function OK(i,e){return e.domain(i.domain()).range(i.range()).interpolate(i.interpolate()).clamp(i.clamp()).unknown(i.unknown())}function Aye(){var i=BK,e=BK,t=ug,n,r,s,o=c_,a,l,c;function u(){var d=Math.min(i.length,e.length);return o!==c_&&(o=dye(i[0],i[d-1])),a=d>2?mye:pye,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),Kh)))(d)))},f.domain=function(d){return arguments.length?(i=Array.from(d,CF),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=EF,u()},f.clamp=function(d){return arguments.length?(o=d?!0:c_,u()):o!==c_},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 IF(){return Aye()(c_,c_)}function UK(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function hg(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 Qh(i){return i=hg(Math.abs(i)),i?i[1]:NaN}function kK(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 zK(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var gye=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function V0(i){if(!(e=gye.exec(i)))throw new Error("invalid format: "+i);var e;return new ZM({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]})}V0.prototype=ZM.prototype;function ZM(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+""}ZM.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 VK(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 Fb;function GK(i,e){var t=hg(i,e);if(!t)return Fb=void 0,i.toPrecision(e);var n=t[0],r=t[1],s=r-(Fb=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")+hg(i,Math.max(0,e+s-1))[0]}function PF(i,e){var t=hg(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 LF={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:UK,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)=>PF(i*100,e),r:PF,s:GK,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function DF(i){return i}var qK=Array.prototype.map,HK=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function WK(i){var e=i.grouping===void 0||i.thousands===void 0?DF:kK(qK.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?DF:zK(qK.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=V0(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"):LF[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=LF[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=VK(G)),te&&+G==0&&w!=="+"&&(te=!1),W=(te?w==="("?w:a:w==="-"||w==="("?"":w)+W,Y=(D==="s"&&!isNaN(G)&&Fb!==void 0?HK[8+Fb/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(Qh(d)/3)))*3,y=Math.pow(10,-A),w=c((f=V0(f),f.type="f",f),{suffix:HK[8+A/3]});return function(S){return w(y*S)}}return{format:c,formatPrefix:u}}var KM,QM,JM;NF({thousands:",",grouping:[3],currency:["$",""]});function NF(i){return KM=WK(i),QM=KM.format,JM=KM.formatPrefix,KM}function FF(i){return Math.max(0,-Qh(Math.abs(i)))}function BF(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Qh(e)/3)))*3-Qh(Math.abs(i)))}function OF(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,Qh(e)-Qh(i))+1}function UF(i,e,t,n){var r=gF(i,e,t),s;switch(n=V0(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=BF(r,o))&&(n.precision=s),JM(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=OF(r,Math.max(Math.abs(i),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=FF(r))&&(n.precision=s-(n.type==="%")*2);break}}return QM(n)}function kF(i){var e=i.domain;return i.ticks=function(t){var n=e();return OM(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return UF(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=Ib(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 bl(){var i=IF();return i.copy=function(){return OK(i,bl())},VM.apply(i,arguments),kF(i)}function Bb(){var i=0,e=1,t=1,n=[.5],r=[0,1],s;function o(l){return l!=null&&l<=l?r[Rb(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 Bb().domain([i,e]).range(r).unknown(s)},VM.apply(kF(o),arguments)}var Pn=1e-6,fg=1e-12,ri=Math.PI,xo=ri/2,u_=ri/4,yo=ri*2,ur=180/ri,_n=ri/180,si=Math.abs,h_=Math.atan,Ms=Math.atan2,mn=Math.cos,Ob=Math.ceil,jK=Math.exp;var eC=Math.hypot,XK=Math.log;var un=Math.sin,$K=Math.sign||function(i){return i>0?1:i<0?-1:0},Vo=Math.sqrt,YK=Math.tan;function ZK(i){return i>1?0:i<-1?ri:Math.acos(i)}function ha(i){return i>1?xo:i<-1?-xo:Math.asin(i)}function zF(i){return(i=un(i/2))*i}function ps(){}function tC(i,e){i&&QK.hasOwnProperty(i.type)&&QK[i.type](i,e)}var KK={Feature:function(i,e){tC(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)tC(t[n].geometry,e)}},QK={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){VF(i.coordinates,e,0)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)VF(t[n],e,0)},Polygon:function(i,e){JK(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)JK(t[n],e)},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)tC(t[n],e)}};function VF(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 JK(i,e){var t=-1,n=i.length;for(e.polygonStart();++t<n;)VF(i[t],e,1);e.polygonEnd()}function G0(i,e){i&&KK.hasOwnProperty(i.type)?KK[i.type](i,e):tC(i,e)}var Ub=new zo,eQ=new zo,tQ,nQ,GF,qF,HF,Jh={point:ps,lineStart:ps,lineEnd:ps,polygonStart:function(){Ub=new zo,Jh.lineStart=vye,Jh.lineEnd=_ye},polygonEnd:function(){var i=+Ub;eQ.add(i<0?yo+i:i),this.lineStart=this.lineEnd=this.point=ps},sphere:function(){eQ.add(yo)}};function vye(){Jh.point=xye}function _ye(){iQ(tQ,nQ)}function xye(i,e){Jh.point=iQ,tQ=i,nQ=e,i*=_n,e*=_n,GF=i,qF=mn(e=e/2+u_),HF=un(e)}function iQ(i,e){i*=_n,e*=_n,e=e/2+u_;var t=i-GF,n=t>=0?1:-1,r=n*t,s=mn(e),o=un(e),a=HF*o,l=qF*s+a*mn(r),c=a*n*un(r);Ub.add(Ms(c,l)),GF=i,qF=s,HF=o}function dg(i){return[Ms(i[1],i[0]),ha(i[2])]}function kc(i){var e=i[0],t=i[1],n=mn(t);return[n*mn(e),n*un(e),un(t)]}function kb(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Dd(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 nC(i,e){i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}function zb(i,e){return[i[0]*e,i[1]*e,i[2]*e]}function pg(i){var e=Vo(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);i[0]/=e,i[1]/=e,i[2]/=e}var Qr,wl,ms,Ql,mg,aQ,lQ,f_,Vb,q0,Fd,Nd={point:WF,lineStart:rQ,lineEnd:sQ,polygonStart:function(){Nd.point=uQ,Nd.lineStart=yye,Nd.lineEnd=bye,Vb=new zo,Jh.polygonStart()},polygonEnd:function(){Jh.polygonEnd(),Nd.point=WF,Nd.lineStart=rQ,Nd.lineEnd=sQ,Ub<0?(Qr=-(ms=180),wl=-(Ql=90)):Vb>Pn?Ql=90:Vb<-Pn&&(wl=-90),Fd[0]=Qr,Fd[1]=ms},sphere:function(){Qr=-(ms=180),wl=-(Ql=90)}};function WF(i,e){q0.push(Fd=[Qr=i,ms=i]),e<wl&&(wl=e),e>Ql&&(Ql=e)}function cQ(i,e){var t=kc([i*_n,e*_n]);if(f_){var n=Dd(f_,t),r=[n[1],-n[0],0],s=Dd(r,n);pg(s),s=dg(s);var o=i-mg,a=o>0?1:-1,l=s[0]*ur*a,c,u=si(o)>180;u^(a*mg<l&&l<a*i)?(c=s[1]*ur,c>Ql&&(Ql=c)):(l=(l+360)%360-180,u^(a*mg<l&&l<a*i)?(c=-s[1]*ur,c<wl&&(wl=c)):(e<wl&&(wl=e),e>Ql&&(Ql=e))),u?i<mg?Kl(Qr,i)>Kl(Qr,ms)&&(ms=i):Kl(i,ms)>Kl(Qr,ms)&&(Qr=i):ms>=Qr?(i<Qr&&(Qr=i),i>ms&&(ms=i)):i>mg?Kl(Qr,i)>Kl(Qr,ms)&&(ms=i):Kl(i,ms)>Kl(Qr,ms)&&(Qr=i)}else q0.push(Fd=[Qr=i,ms=i]);e<wl&&(wl=e),e>Ql&&(Ql=e),f_=t,mg=i}function rQ(){Nd.point=cQ}function sQ(){Fd[0]=Qr,Fd[1]=ms,Nd.point=WF,f_=null}function uQ(i,e){if(f_){var t=i-mg;Vb.add(si(t)>180?t+(t>0?360:-360):t)}else aQ=i,lQ=e;Jh.point(i,e),cQ(i,e)}function yye(){Jh.lineStart()}function bye(){uQ(aQ,lQ),Jh.lineEnd(),si(Vb)>Pn&&(Qr=-(ms=180)),Fd[0]=Qr,Fd[1]=ms,f_=null}function Kl(i,e){return(e-=i)<0?e+360:e}function wye(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 iC(i){var e,t,n,r,s,o,a;if(Ql=ms=-(Qr=wl=1/0),q0=[],G0(i,Nd),t=q0.length){for(q0.sort(wye),e=1,n=q0[0],s=[n];e<t;++e)r=q0[e],oQ(n,r[0])||oQ(n,r[1])?(Kl(n[0],r[1])>Kl(n[0],n[1])&&(n[1]=r[1]),Kl(r[0],n[1])>Kl(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=Kl(n[1],r[0]))>o&&(o=a,Qr=r[0],ms=n[1])}return q0=Fd=null,Qr===1/0||wl===1/0?[[NaN,NaN],[NaN,NaN]]:[[Qr,wl],[ms,Ql]]}var Gb,rC,sC,oC,aC,lC,cC,uC,jF,XF,$F,dQ,pQ,qa,Ha,Wa,Fu={sphere:ps,point:YF,lineStart:hQ,lineEnd:fQ,polygonStart:function(){Fu.lineStart=Eye,Fu.lineEnd=Mye},polygonEnd:function(){Fu.lineStart=hQ,Fu.lineEnd=fQ}};function YF(i,e){i*=_n,e*=_n;var t=mn(e);qb(t*mn(i),t*un(i),un(e))}function qb(i,e,t){++Gb,sC+=(i-sC)/Gb,oC+=(e-oC)/Gb,aC+=(t-aC)/Gb}function hQ(){Fu.point=Sye}function Sye(i,e){i*=_n,e*=_n;var t=mn(e);qa=t*mn(i),Ha=t*un(i),Wa=un(e),Fu.point=Tye,qb(qa,Ha,Wa)}function Tye(i,e){i*=_n,e*=_n;var t=mn(e),n=t*mn(i),r=t*un(i),s=un(e),o=Ms(Vo((o=Ha*s-Wa*r)*o+(o=Wa*n-qa*s)*o+(o=qa*r-Ha*n)*o),qa*n+Ha*r+Wa*s);rC+=o,lC+=o*(qa+(qa=n)),cC+=o*(Ha+(Ha=r)),uC+=o*(Wa+(Wa=s)),qb(qa,Ha,Wa)}function fQ(){Fu.point=YF}function Eye(){Fu.point=Cye}function Mye(){mQ(dQ,pQ),Fu.point=YF}function Cye(i,e){dQ=i,pQ=e,i*=_n,e*=_n,Fu.point=mQ;var t=mn(e);qa=t*mn(i),Ha=t*un(i),Wa=un(e),qb(qa,Ha,Wa)}function mQ(i,e){i*=_n,e*=_n;var t=mn(e),n=t*mn(i),r=t*un(i),s=un(e),o=Ha*s-Wa*r,a=Wa*n-qa*s,l=qa*r-Ha*n,c=eC(o,a,l),u=ha(c),f=c&&-u/c;jF.add(f*o),XF.add(f*a),$F.add(f*l),rC+=u,lC+=u*(qa+(qa=n)),cC+=u*(Ha+(Ha=r)),uC+=u*(Wa+(Wa=s)),qb(qa,Ha,Wa)}function hC(i){Gb=rC=sC=oC=aC=lC=cC=uC=0,jF=new zo,XF=new zo,$F=new zo,G0(i,Fu);var e=+jF,t=+XF,n=+$F,r=eC(e,t,n);return r<fg&&(e=lC,t=cC,n=uC,rC<Pn&&(e=sC,t=oC,n=aC),r=eC(e,t,n),r<fg)?[NaN,NaN]:[Ms(t,e)*ur,ha(n/r)*ur]}function Hb(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 ZF(i,e){return si(i)>ri&&(i-=Math.round(i/yo)*yo),[i,e]}ZF.invert=ZF;function KF(i,e,t){return(i%=yo)?e||t?Hb(gQ(i),vQ(e,t)):gQ(i):e||t?vQ(e,t):ZF}function AQ(i){return function(e,t){return e+=i,si(e)>ri&&(e-=Math.round(e/yo)*yo),[e,t]}}function gQ(i){var e=AQ(i);return e.invert=AQ(-i),e}function vQ(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),ha(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),ha(A*t-u*n)]},o}function QF(i){i=KF(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 xQ(i,e,t,n,r,s){if(t){var o=mn(e),a=un(e),l=n*t;r==null?(r=e+n*yo,s=e-l/2):(r=_Q(o,r),s=_Q(o,s),(n>0?r<s:r>s)&&(r+=n*yo));for(var c,u=r;n>0?u>s:u<s;u-=l)c=dg([o,-a*mn(u),-a*un(u)]),i.point(c[0],c[1])}}function _Q(i,e){e=kc(e),e[0]-=i,pg(e);var t=ZK(-e[1]);return((-e[2]<0?-t:t)+yo-Pn)%yo}function fC(){var i=[],e;return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){i.push(e=[])},lineEnd:ps,rejoin:function(){i.length>1&&i.push(i.pop().concat(i.shift()))},result:function(){var t=i;return i=[],e=null,t}}}function d_(i,e){return si(i[0]-e[0])<Pn&&si(i[1]-e[1])<Pn}function dC(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 pC(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(d_(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 dC(S,y,null,!0)),o.push(R.o=new dC(S,null,R,!1)),s.push(R=new dC(T,y,null,!1)),o.push(R.o=new dC(T,null,R,!0))}}),!!s.length){for(o.sort(e),yQ(s),yQ(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 yQ(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 JF(i){return si(i[0])<=ri?i[0]:$K(i[0])*((si(i[0])+ri)%yo-ri)}function mC(i,e){var t=JF(e),n=e[1],r=un(n),s=[un(t),-mn(t),0],o=0,a=0,l=new zo;r===1?n=xo+Pn:r===-1&&(n=-xo-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=JF(A),w=A[1]/2+u_,S=un(w),T=mn(w),R=0;R<d;++R,y=I,S=D,T=L,A=P){var P=f[R],I=JF(P),F=P[1]/2+u_,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(Ms(G*B*un(k),T*L+G*mn(k))),o+=z?C+B*yo:C,z^y>=t^I>=t){var W=Dd(kc(A),kc(P));pg(W);var Y=Dd(s,W);pg(Y);var H=(z^C>=0?-1:1)*ha(Y[2]);(n>H||n===H&&(W[0]||W[1]))&&(a+=z^C>=0?1:-1)}}return(o<-Pn||o<Pn&&l<-fg)^a&1}function AC(i,e,t,n){return function(r){var s=e(r),o=fC(),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=Yh(u);var I=mC(c,n);u.length?(l||(r.polygonStart(),l=!0),pC(u,Iye,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(Rye))}}return d}}function Rye(i){return i.length>1}function Iye(i,e){return((i=i.x)[0]<0?i[1]-xo-Pn:xo-i[1])-((e=e.x)[0]<0?e[1]-xo-Pn:xo-e[1])}var eB=AC(function(){return!0},Pye,Dye,[-ri,-xo]);function Pye(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?xo:-xo),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=Lye(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 Lye(i,e,t,n){var r,s,o=un(i-t);return si(o)>Pn?h_((un(e)*(s=mn(n))*un(t)-un(n)*(r=mn(e))*un(i))/(r*s*o)):(e+n)/2}function Dye(i,e,t,n){var r;if(i==null)r=t*xo,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 bQ(i){var e=mn(i),t=2*_n,n=e>0,r=si(e)>Pn;function s(u,f,d,A){xQ(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||d_(f,P)||d_(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||!d_(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=kc(u),y=kc(f),w=[1,0,0],S=Dd(A,y),T=kb(S,S),R=S[0],P=T-R*R;if(!P)return!d&&u;var I=e*T/P,F=-e*R/P,D=Dd(w,S),L=zb(w,I),C=zb(S,F);nC(L,C);var B=D,k=kb(L,B),z=kb(B,B),G=k*k-z*(kb(L,L)-1);if(!(G<0)){var W=Vo(G),Y=zb(B,(-k-W)/z);if(nC(Y,L),Y=dg(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,ge=si(he-ri)<Pn,Re=ge||he<Pn;if(!ge&&te<J&&(ce=J,J=te,te=ce),Re?ge?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=zb(B,(-k+W)/z);return nC(Qe,L),[Y,dg(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 AC(o,a,s,n?[0,-i]:[-ri,i-ri])}function wQ(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 Wb=1e9,gC=-Wb;function tB(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=fC(),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,ge=te[0],Re,Qe,Fe=ge[0],mt=ge[1];ce<he;++ce)Re=Fe,Qe=mt,ge=te[ce],Fe=ge[0],mt=ge[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=Yh(d)).length;($||J)&&(c.polygonStart(),$&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),J&&pC(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(gC,Math.min(Wb,R)),P=Math.max(gC,Math.min(Wb,P))],ce=[H=Math.max(gC,Math.min(Wb,H)),$=Math.max(gC,Math.min(Wb,$))];wQ(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 nB,iB,vC,_C,p_={sphere:ps,point:ps,lineStart:Nye,lineEnd:ps,polygonStart:ps,polygonEnd:ps};function Nye(){p_.point=Bye,p_.lineEnd=Fye}function Fye(){p_.point=p_.lineEnd=ps}function Bye(i,e){i*=_n,e*=_n,iB=i,vC=un(e),_C=mn(e),p_.point=Oye}function Oye(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=_C*t-vC*n*s,c=vC*t+_C*n*s;nB.add(Ms(Vo(a*a+l*l),c)),iB=i,vC=t,_C=n}function SQ(i){return nB=new zo,G0(i,p_),+nB}var rB=[null,null],Uye={type:"LineString",coordinates:rB};function Sl(i,e){return rB[0]=i,rB[1]=e,SQ(Uye)}var TQ={Feature:function(i,e){return xC(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)if(xC(t[n].geometry,e))return!0;return!1}},EQ={Sphere:function(){return!0},Point:function(i,e){return MQ(i.coordinates,e)},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(MQ(t[n],e))return!0;return!1},LineString:function(i,e){return CQ(i.coordinates,e)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(CQ(t[n],e))return!0;return!1},Polygon:function(i,e){return RQ(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(RQ(t[n],e))return!0;return!1},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)if(xC(t[n],e))return!0;return!1}};function xC(i,e){return i&&EQ.hasOwnProperty(i.type)?EQ[i.type](i,e):!1}function MQ(i,e){return Sl(i,e)===0}function CQ(i,e){for(var t,n,r,s=0,o=i.length;s<o;s++){if(n=Sl(i[s],e),n===0||s>0&&(r=Sl(i[s],i[s-1]),r>0&&t<=r&&n<=r&&(t+n-r)*(1-Math.pow((t-n)/r,2))<fg*r))return!0;t=n}return!1}function RQ(i,e){return!!mC(i.map(kye),IQ(e))}function kye(i){return i=i.map(IQ),i.pop(),i}function IQ(i){return[i[0]*_n,i[1]*_n]}function sB(i,e){return(i&&TQ.hasOwnProperty(i.type)?TQ[i.type]:xC)(i,e)}function PQ(i,e,t){var n=Ld(i,e-Pn,t).concat(e);return function(r){return n.map(function(s){return[r,s]})}}function LQ(i,e,t){var n=Ld(i,e-Pn,t).concat(e);return function(r){return n.map(function(s){return[s,r]})}}function oB(){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 Ld(Ob(n/u)*u,t,u).map(y).concat(Ld(Ob(a/f)*f,o,f).map(w)).concat(Ld(Ob(e/l)*l,i,l).filter(function(P){return si(P%u)>Pn}).map(d)).concat(Ld(Ob(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=PQ(s,r,90),A=LQ(e,i,S),y=PQ(a,o,90),w=LQ(n,t,S),T):S},T.extentMajor([[-180,-90+Pn],[180,90-Pn]]).extentMinor([[-180,-80-Pn],[180,80+Pn]])}function aB(){return oB()()}function Ag(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*ha(Vo(zF(s-n)+o*l*zF(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[Ms(F,I)*ur,Ms(D,Vo(I*I+F*F))*ur]}:function(){return[t*ur,n*ur]};return S.distance=y,S}var lB=i=>i;var m_=1/0,yC=m_,jb=-m_,bC=jb,zye={point:Vye,lineStart:ps,lineEnd:ps,polygonStart:ps,polygonEnd:ps,result:function(){var i=[[m_,yC],[jb,bC]];return jb=bC=-(yC=m_=1/0),i}};function Vye(i,e){i<m_&&(m_=i),i>jb&&(jb=i),e<yC&&(yC=e),e>bC&&(bC=e)}var cB=zye;function Xb(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 hB(i,e,t){var n=i.clipExtent&&i.clipExtent();return i.scale(150).translate([0,0]),n!=null&&i.clipExtent(null),G0(t,i.stream(cB)),e(cB.result()),n!=null&&i.clipExtent(n),i}function fB(i,e,t){return hB(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 DQ(i,e,t){return fB(i,[[0,0],e],t)}function NQ(i,e,t){return hB(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 FQ(i,e,t){return hB(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 BQ=16,Gye=mn(30*_n);function dB(i,e){return+e?Hye(i,e):qye(i)}function qye(i){return Xb({point:function(e,t){e=i(e,t),this.stream.point(e[0],e[1])}})}function Hye(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=Vo(I*I+F*F+D*D),C=ha(D/=L),B=si(si(D)-1)<Pn||si(s-f)<Pn?(s+f)/2:Ms(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<Gye)&&(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=kc([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],BQ,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,BQ,n),S.lineEnd=I,I()}return S}}var Wye=Xb({point:function(i,e){this.stream.point(i*_n,e*_n)}});function jye(i){return Xb({point:function(e,t){var n=i(e,t);return this.stream.point(n[0],n[1])}})}function Xye(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 OQ(i,e,t,n,r,s){if(!s)return Xye(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 pB(i){return $ye(function(){return i})()}function $ye(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=eB,S=null,T,R,P,I=lB,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=Wye(jye(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?bQ(y=H*_n):(y=null,eB),Y()):y*ur},z.clipExtent=function(H){return arguments.length?(I=H==null?(S=T=R=P=null,lB):tB(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=dB(L,F=H*H),Y()):Vo(F)},z.fitExtent=function(H,$){return fB(z,H,$)},z.fitSize=function(H,$){return DQ(z,H,$)},z.fitWidth=function(H,$){return NQ(z,H,$)},z.fitHeight=function(H,$){return FQ(z,H,$)};function W(){var H=OQ(t,0,0,d,A,f).apply(null,e(s,o)),$=OQ(t,n-H[0],r-H[1],d,A,f);return u=KF(a,l,c),L=Hb(e,$),C=Hb(u,L),D=dB(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 UQ(i){return function(e,t){var n=Vo(e*e+t*t),r=i(n),s=un(r),o=mn(r);return[Ms(e*s,n*o),ha(n&&t*s/n)]}}function $b(i,e){return[i,XK(YK((xo+e)/2))]}$b.invert=function(i,e){return[i,2*h_(jK(e))-xo]};function mB(i,e){var t=mn(e),n=1+mn(i)*t;return[t*un(i)/n,un(e)/n]}mB.invert=UQ(function(i){return 2*h_(i)});function AB(){return pB(mB).scale(250).clipAngle(142)}function _B(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 Yye(i){if(Array.isArray(i))return i}function Zye(i){if(Array.isArray(i))return _B(i)}function Yb(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 Kye(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Qye(i,e,t){return e=EC(e),l2e(i,qQ()?Reflect.construct(e,[],EC(i).constructor):e.apply(i,t))}function GQ(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Jye(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function oi(i,e){return i.get(Yb(i,e))}function H0(i,e,t){GQ(i,e),e.set(i,t)}function W0(i,e,t){return i.set(Yb(i,e),t),t}function e2e(i,e){GQ(i,e),e.add(i)}function t2e(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,WQ(n.key),n)}}function n2e(i,e,t){return e&&t2e(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function A_(i,e,t){return(e=WQ(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function EC(i){return EC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},EC(i)}function i2e(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&&xB(i,e)}function qQ(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(qQ=function(){return!!i})()}function r2e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function s2e(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 o2e(){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 a2e(){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 l2e(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 Kye(i)}function xB(i,e){return xB=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},xB(i,e)}function TC(i,e){return Yye(i)||s2e(i,e)||jQ(i,e)||o2e()}function HQ(i){return Zye(i)||r2e(i)||jQ(i)||a2e()}function c2e(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 WQ(i){var e=c2e(i,"string");return typeof e=="symbol"?e:e+""}function jQ(i,e){if(i){if(typeof i=="string")return _B(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)?_B(i,e):void 0}}var XQ=function(e){e instanceof Array?e.forEach(XQ):(e.map&&e.map.dispose(),e.dispose())},yB=function(e){e.geometry&&e.geometry.dispose(),e.material&&XQ(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(yB)};function $Q(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 u2e(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 gg(i){return i*Math.PI/180}var YQ=function(e){return 1-($b(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},gB=function(e){return Math.max(0,Math.min(1,YQ(e)))},kQ=function(e){return .5-$b.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},h2e=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=bl().domain([1,0]).range([t,n]).clamp(!0),s=bl().domain([gB(t),gB(n)]).range([1,0]).clamp(!0),o=function(f){return s(gB(r(f)))},a=e.array,l=0,c=a.length;l<c;l+=2)a[l+1]=o(a[l+1]);e.needsUpdate=!0},zQ=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,YQ(a))));var l=Math.floor(a*s);return[o,l]},bB=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:kQ(w/l)*l;var P=w+1===l?w+1:kQ((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},f2e=6,d2e=7,p2e=3,m2e=90,ef=new WeakMap,j0=new WeakMap,vB=new WeakMap,wC=new WeakMap,zc=new WeakMap,MC=new WeakMap,g_=new WeakMap,vg=new WeakMap,SC=new WeakSet,ZQ=(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 Jye(this,e),n=Qye(this,e),e2e(n,SC),H0(n,ef,void 0),H0(n,j0,void 0),H0(n,vB,void 0),H0(n,wC,void 0),H0(n,zc,{}),H0(n,MC,void 0),H0(n,g_,void 0),H0(n,vg,void 0),A_(n,"minLevel",void 0),A_(n,"maxLevel",void 0),A_(n,"thresholds",HQ(new Array(30)).map(function(d,A){return 8/Math.pow(2,A)})),A_(n,"curvatureResolution",5),A_(n,"tileMargin",0),A_(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)})}),W0(zc,n,{})}),W0(ef,n,t),n.tileUrl=s,W0(j0,n,f),n.minLevel=a,n.maxLevel=c,n.level=0,n.add(W0(vg,n,new Hn(new ka(oi(ef,n)*.99,180,90),new hs({color:0})))),oi(vg,n).visible=!1,oi(vg,n).material.polygonOffset=!0,oi(vg,n).material.polygonOffsetUnits=3,oi(vg,n).material.polygonOffsetFactor=1,n}return i2e(e,i),n2e(e,[{key:"tileUrl",get:function(){return oi(vB,this)},set:function(n){W0(vB,this,n),this.updatePov(oi(g_,this))}},{key:"level",get:function(){return oi(wC,this)},set:function(n){var r,s=this;oi(zc,this)[n]||Yb(SC,this,A2e).call(this,n);var o=oi(wC,this);if(W0(wC,this,n),!(n===o||o===void 0)){if(oi(vg,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)});Yb(SC,this,VQ).call(this)}}},{key:"updatePov",value:function(n){var r=this;if(!(!n||!(n instanceof Ed))){W0(g_,this,n);var s;if(W0(MC,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=TC(P,2),F=I[0],D=I[1];return $Q(F,D,oi(ef,r))}).map(function(P){var I=P.x,F=P.y,D=P.z;return new re(I,F,D)})}return s||(s=new Nc,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(ef,this))/oi(ef,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)),Yb(SC,this,VQ).call(this)}}}}])})(Fr);function A2e(i){var e=this;if(i>d2e){oi(zc,this)[i]=[];return}var t=oi(zc,this)[i]=bB(i,oi(j0,this));t.forEach(function(n){return n.centroid=$Q(n.lat,n.lng,oi(ef,e))}),t.octree=Cb().x(function(n){return n.centroid.x}).y(function(n){return n.centroid.y}).z(function(n){return n.centroid.z}).addAll(t)}function VQ(){var i=this;if(!(!this.tileUrl||this.level===void 0||!oi(zc,this).hasOwnProperty(this.level))&&!(!oi(MC,this)&&this.level>f2e)){var e=oi(zc,this)[this.level];if(oi(g_,this)){var t=this.worldToLocal(oi(g_,this).position.clone());if(e.octree){var n,r=this.worldToLocal(oi(g_,this).position.clone()),s=(r.length()-oi(ef,this))*p2e;e=(n=e.octree).findAllWithinRadius.apply(n,HQ(r).concat([s]))}else{var o=u2e(t),a=(o.r/oi(ef,this)-1)*m2e,l=a/Math.cos(gg(o.lat)),c=[o.lng-l,o.lng+l],u=[o.lat+a,o.lat-a],f=zQ(this.level,oi(j0,this),c[0],u[0]),d=TC(f,2),A=d[0],y=d[1],w=zQ(this.level,oi(j0,this),c[1],u[1]),S=TC(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=bB(this.level,oi(j0,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]=bB(this.level,oi(j0,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(MC,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=gg(z),te=gg(-G),ce=new Hn(new ka(oi(ef,i),Math.ceil(H/i.curvatureResolution),Math.ceil($/i.curvatureResolution),gg(90-H/2)+J,gg(H),gg(90-$/2)+te,gg($)),new za);if(oi(j0,i)){var he=[G+W/2,G-W/2].map(function(Fe){return .5-Fe/180}),ge=TC(he,2),Re=ge[0],Qe=ge[1];h2e(ce.geometry.attributes.uv,Re,Qe)}C.obj=ce}C.loading||(C.loading=!0,new _l().load(i.tileUrl(B,k,i.level),function(Fe){var mt=C.obj;mt&&(Fe.colorSpace=Nr,mt.material.map=Fe,mt.material.color=null,mt.material.needsUpdate=!0,i.add(mt)),C.loading=!1}))})}}var Jb=new Set,wB=!1;function IB(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length;Jb.size&&Jb.clear();let s=eJ(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a=0,l=0,c=0;if(n&&(s=y2e(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 SB(s,o,a,l,c),o}function eJ(i,e,t,n,r){let s=null;if(r===N2e(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=JQ(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=JQ(o/n|0,i[o],i[o+1],s);return s&&ew(s,s.next)&&(nw(s),s=s.next),s}function xg(i,e=i){let t=e===i,n=i,r;do r=!1,n!==n.next&&(Jb.size===0||!Jb.has(n))&&(ew(n,n.next)||js(n.prev,n,n.next)===0)?((t||n===e)&&(e=n.prev),wB=!0,nw(n),n=n.prev,r=!0):(t||n!==e)&&(n=n.next,r=!t);while(r||n!==e);return e}function SB(i,e,t,n,r){r&&C2e(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?v2e(i,t,n,r):g2e(i))){e.push(a.i,i.i,l.i),nw(i),i=l,s=l;continue}if(i=l,i===s){if(wB=!1,i=xg(i),wB){s=i;continue}if(!o){i=_2e(i,e),s=i,o=!0;continue}x2e(i,e,t,n,r);break}}}function g2e(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)&&PC(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 v2e(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=CB(A,y,e,t,n),R=CB(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)&&PC(a,u,l,f,c,d,P.x,P.y)&&js(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)&&PC(a,u,l,f,c,d,I.x,I.y)&&js(I.prev,I,I.next)>=0)return!1;I=I.nextZ}return!0}function _2e(i,e){let t=i,n=!1;do{let r=t.prev,s=t.next.next;iJ(r,t,t.next,s,!1)&&tw(r,s)&&tw(s,r)&&(e.push(r.i,t.i,s.i),nw(t),nw(t.next),t=i=s,n=!0),t=t.next}while(t!==i);return n?xg(t):t}function x2e(i,e,t,n,r){let s=i;do{let o=s.next.next;for(;o!==s.prev;){if(s.i!==o.i&&P2e(s,o)){let a=rJ(s,o);s=xg(s,s.next),a=xg(a,a.next),SB(s,e,t,n,r),SB(a,e,t,n,r);return}o=o.next}s=s.next}while(s!==i)}var TB=!1;function y2e(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=eJ(i,a,l,n,!1);c===c.next&&Jb.add(c),r.push(I2e(c))}r.sort(b2e),S2e(i.length/n,e.length),nJ(t,t),TB=!0;for(let s=0;s<r.length;s++)t=w2e(r[s],t);return TB=!1,xg(t)}function b2e(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 w2e(i,e){let t=E2e(i,e);if(!t)return e;let n=rJ(t,i),r=n.next;return nJ(t,r.next),xg(n,n.next),xg(t,t.next)}var tJ=16,As=new Float64Array(0),IC=0,EB=[],MB=[];function S2e(i,e){let t=Math.ceil((i+2*e)/tJ)+e+2;As.length<t*4&&(As=new Float64Array(t*4)),IC=0}function nJ(i,e){let t=i;do{let n=IC++;EB[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<tJ&&t!==e);MB[n]=t;let c=n*4;As[c]=r,As[c+1]=s,As[c+2]=o,As[c+3]=a}while(t!==e)}function T2e(i,e){let t=i.z*4;e.x<As[t]&&(As[t]=e.x),e.y<As[t+1]&&(As[t+1]=e.y),e.x>As[t+2]&&(As[t+2]=e.x),e.y>As[t+3]&&(As[t+3]=e.y)}function KQ(i){let e=MB[i];for(;e.prev.next!==e;)e=e.next;return MB[i]=e,e}function QQ(i){let e=EB[i];for(;e.prev.next!==e;)e=e.next;return EB[i]=e,e}function E2e(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(ew(i,t))return t;for(let d=0,A=0;d<IC;d++,A+=4){if(r<As[A+1]||r>As[A+3]||As[A]>n||As[A+2]<=s)continue;let y=KQ(d);t=QQ(d);do{if(t.prev.next===t){if(ew(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<IC;d++,A+=4){if(As[A+2]<a||As[A]>n||As[A+3]<c||As[A+1]>u)continue;let y=KQ(d);t=QQ(d);do{if(t.prev.next===t&&n>=t.x&&t.x>=a&&n!==t.x&&PC(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);(tw(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&&M2e(o,t)))&&(o=t,f=w)}t=t.next}while(t!==y)}return o}function M2e(i,e){return js(i.prev,i,e.prev)<0&&js(e.next,i,i.next)<0}var Vc=[],Zb=[],_g=new Uint32Array(0),Kb=new Uint32Array(0),Qb=new Uint32Array(256);function C2e(i,e,t,n){let r=i,s=0;do r.z=CB(r.x,r.y,e,t,n),Vc[s++]=r,r=r.next;while(r!==i);R2e(s);let o=null;for(let a=0;a<s;a++){let l=Vc[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function R2e(i){if(i<=32){for(let e=1;e<i;e++){let t=Vc[e],n=t.z,r=e-1;for(;r>=0&&Vc[r].z>n;)Vc[r+1]=Vc[r],r--;Vc[r+1]=t}return}_g.length<i&&(_g=new Uint32Array(i),Kb=new Uint32Array(i),Zb=new Array(i));for(let e=0;e<i;e++)_g[e]=Vc[e].z;CC(i,Vc,_g,Zb,Kb,0),CC(i,Zb,Kb,Vc,_g,8),CC(i,Vc,_g,Zb,Kb,16),CC(i,Zb,Kb,Vc,_g,24)}function CC(i,e,t,n,r,s){Qb.fill(0);for(let a=0;a<i;a++)Qb[t[a]>>>s&255]++;let o=0;for(let a=0;a<256;a++){let l=Qb[a];Qb[a]=o,o+=l}for(let a=0;a<i;a++){let l=t[a],c=Qb[l>>>s&255]++;n[c]=e[a],r[c]=l}}function CB(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 I2e(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 PC(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 P2e(i,e){let t=ew(i,e)&&js(i.prev,i,i.next)>0&&js(e.prev,e,e.next)>0;return i.next.i!==e.i&&(t||tw(i,e)&&tw(e,i)&&(js(i.prev,i,e.prev)!==0||js(i,e.prev,e)!==0))&&!L2e(i,e)&&(t||D2e(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 ew(i,e){return i.x===e.x&&i.y===e.y}function iJ(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&&RC(i,t,e)||o===0&&RC(i,n,e)||a===0&&RC(t,i,n)||l===0&&RC(t,e,n)):!1}function RC(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 L2e(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&&iJ(o,a,i,e))return!0;o=a}while(o!==i);return!1}function tw(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 D2e(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 rJ(i,e){let t=RB(i.i,i.x,i.y),n=RB(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 JQ(i,e,t,n){let r=RB(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 nw(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),TB&&T2e(i.prev,i.next)}function RB(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function N2e(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 v_(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 LB(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 F2e(i){if(Array.isArray(i))return i}function B2e(i){if(Array.isArray(i))return LB(i)}function O2e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function U2e(i,e,t){return e=LC(e),X2e(i,aJ()?Reflect.construct(e,[],LC(i).constructor):e.apply(i,t))}function k2e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function z2e(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function V2e(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=FB(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 LC(i){return LC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},LC(i)}function G2e(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&&DB(i,e)}function aJ(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(aJ=function(){return!!i})()}function q2e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function H2e(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 W2e(){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 j2e(){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 X2e(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 O2e(i)}function DB(i,e){return DB=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},DB(i,e)}function iw(i,e){return F2e(i)||H2e(i,e)||FB(i,e)||W2e()}function $2e(i){return B2e(i)||q2e(i)||FB(i)||j2e()}function FB(i,e){if(i){if(typeof i=="string")return LB(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)?LB(i,e):void 0}}var sJ=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=Sl(s,r)*180/Math.PI;if(o>t)for(var a=Ag(r,s),l=r.length>2||s.length>2?Kh(r[2]||0,s[2]||0):null,c=l?function(d){return[].concat($2e(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},NB=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:Xn,Float32BufferAttribute:Ln},Y2e=new NB.BufferGeometry().setAttribute?"setAttribute":"addAttribute",BB=(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;k2e(this,e),n=U2e(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;rw({indices:a,vertices:l},S),n.addGroup(T,a.length-T,c++)}),a.length&&n.setIndex(a),l.length&&n[Y2e]("position",new NB.Float32BufferAttribute(l,3));function u(S,T){var R=PB(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=iw(P,1),F=I[0];rw(R,F)}),[R]}function d(S,T){for(var R=sJ(S,s).map(function(C){var B=iw(C,3),k=B[0],z=B[1],G=B[2],W=G===void 0?0:G;return PB(z,k,T+W)}),P=v_([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=iw(P,1),F=I[0];rw(R,F)}),[R]}function y(S,T){for(var R=S.map(function(H){return sJ(H,s).map(function($){var J=iw($,3),te=J[0],ce=J[1],he=J[2],ge=he===void 0?0:he;return PB(ce,te,T+ge)})}),P=v_(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=iw(F,2),L=D[0],C=D[1];rw(R,L),C&&rw(P,C)});var I=[R];return P.vertices.length&&I.push(P),I}return n}return G2e(e,i),z2e(e)})(NB.BufferGeometry);function rw(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=V2e(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 PB(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 sw={};Pue(sw,{computeMikkTSpaceTangents:()=>Z2e,computeMorphedAttributes:()=>rbe,deepCloneAttribute:()=>Q2e,deinterleaveAttribute:()=>DC,deinterleaveGeometry:()=>ebe,estimateBytesUsed:()=>tbe,interleaveAttributes:()=>J2e,mergeAttributes:()=>OB,mergeGeometries:()=>K2e,mergeGroups:()=>sbe,mergeVertices:()=>nbe,toCreasedNormals:()=>obe,toTrianglesDrawMode:()=>ibe});function Z2e(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 K2e(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=OB(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=OB(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 OB(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 Q2e(i){return i.isInstancedInterleavedBufferAttribute||i.isInterleavedBufferAttribute?DC(i):i.isInstancedBufferAttribute?new Xl().copy(i):new Hi().copy(i)}function J2e(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 Sd(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 Oo(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 DC(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 Xl(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 ebe(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,DC(s)),e[r]=n.get(s))}for(let r in t){let s=t[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,DC(s)),t[r]=n.get(s))}}function tbe(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 nbe(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 ibe(i,e){if(e===b8)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===xM||e===w8){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===xM)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 rbe(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,ge,Re,Qe,Fe,mt,Ee){e.fromBufferAttribute(he,Qe),t.fromBufferAttribute(he,Fe),n.fromBufferAttribute(he,mt);let Ve=ce.morphTargetInfluences;if(ge&&Ve){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let Ye=0,Mt=ge.length;Ye<Mt;Ye++){let Et=Ve[Ye],It=ge[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 sbe(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 obe(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,ge=$*he-J*ce,Re=J*te-H*he,Qe=H*ce-$*te,Fe=1/(Math.sqrt(ge*ge+Re*Re+Qe*Qe)||1);c[3*I+0]=ge*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],ge=c[te+2];D*ce+L*he+C*ge>o&&(G+=ce,W+=he,Y+=ge)}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 NC(i){"@babel/helpers - typeof";return NC=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},NC(i)}var abe=/^\s+/,lbe=/\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=cbe(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=pJ(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=cJ(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=cJ(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=lJ(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=lJ(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 uJ(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return dbe(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(Or(this._r,255)*100)+"%",g:Math.round(Or(this._g,255)*100)+"%",b:Math.round(Or(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Or(this._r,255)*100)+"%, "+Math.round(Or(this._g,255)*100)+"%, "+Math.round(Or(this._b,255)*100)+"%)":"rgba("+Math.round(Or(this._r,255)*100)+"%, "+Math.round(Or(this._g,255)*100)+"%, "+Math.round(Or(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Tbe[uJ(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+hJ(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=An(e);n="#"+hJ(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(gbe,arguments)},brighten:function(){return this._applyModification(vbe,arguments)},darken:function(){return this._applyModification(_be,arguments)},desaturate:function(){return this._applyModification(pbe,arguments)},saturate:function(){return this._applyModification(mbe,arguments)},greyscale:function(){return this._applyModification(Abe,arguments)},spin:function(){return this._applyModification(xbe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(wbe,arguments)},complement:function(){return this._applyCombination(ybe,arguments)},monochromatic:function(){return this._applyCombination(Sbe,arguments)},splitcomplement:function(){return this._applyCombination(bbe,arguments)},triad:function(){return this._applyCombination(fJ,[3])},tetrad:function(){return this._applyCombination(fJ,[4])}};An.fromRatio=function(i,e){if(NC(i)=="object"){var t={};for(var n in i)i.hasOwnProperty(n)&&(n==="a"?t[n]=i[n]:t[n]=ow(i[n]));i=t}return An(i,e)};function cbe(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=Rbe(i)),NC(i)=="object"&&(Bd(i.r)&&Bd(i.g)&&Bd(i.b)?(e=ube(i.r,i.g,i.b),o=!0,a=String(i.r).substr(-1)==="%"?"prgb":"rgb"):Bd(i.h)&&Bd(i.s)&&Bd(i.v)?(n=ow(i.s),r=ow(i.v),e=fbe(i.h,n,r),o=!0,a="hsv"):Bd(i.h)&&Bd(i.s)&&Bd(i.l)&&(n=ow(i.s),s=ow(i.l),e=hbe(i.h,n,s),o=!0,a="hsl"),i.hasOwnProperty("a")&&(t=i.a)),t=pJ(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 ube(i,e,t){return{r:Or(i,255)*255,g:Or(e,255)*255,b:Or(t,255)*255}}function lJ(i,e,t){i=Or(i,255),e=Or(e,255),t=Or(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 hbe(i,e,t){var n,r,s;i=Or(i,360),e=Or(e,100),t=Or(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 cJ(i,e,t){i=Or(i,255),e=Or(e,255),t=Or(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 fbe(i,e,t){i=Or(i,360)*6,e=Or(e,100),t=Or(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 uJ(i,e,t,n){var r=[Ou(Math.round(i).toString(16)),Ou(Math.round(e).toString(16)),Ou(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 dbe(i,e,t,n,r){var s=[Ou(Math.round(i).toString(16)),Ou(Math.round(e).toString(16)),Ou(Math.round(t).toString(16)),Ou(mJ(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 hJ(i,e,t,n){var r=[Ou(mJ(n)),Ou(Math.round(i).toString(16)),Ou(Math.round(e).toString(16)),Ou(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 pbe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.s-=e/100,t.s=FC(t.s),An(t)}function mbe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.s+=e/100,t.s=FC(t.s),An(t)}function Abe(i){return An(i).desaturate(100)}function gbe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.l+=e/100,t.l=FC(t.l),An(t)}function vbe(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 _be(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.l-=e/100,t.l=FC(t.l),An(t)}function xbe(i,e){var t=An(i).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,An(t)}function ybe(i){var e=An(i).toHsl();return e.h=(e.h+180)%360,An(e)}function fJ(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 bbe(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 wbe(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 Sbe(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=Ibe(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 UB=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"},Tbe=An.hexNames=Ebe(UB);function Ebe(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function pJ(i){return i=parseFloat(i),(isNaN(i)||i<0||i>1)&&(i=1),i}function Or(i,e){Mbe(i)&&(i="100%");var t=Cbe(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 FC(i){return Math.min(1,Math.max(0,i))}function Jl(i){return parseInt(i,16)}function Mbe(i){return typeof i=="string"&&i.indexOf(".")!=-1&&parseFloat(i)===1}function Cbe(i){return typeof i=="string"&&i.indexOf("%")!=-1}function Ou(i){return i.length==1?"0"+i:""+i}function ow(i){return i<=1&&(i=i*100+"%"),i}function mJ(i){return Math.round(parseFloat(i)*255).toString(16)}function dJ(i){return Jl(i)/255}var Bu=(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 Bd(i){return!!Bu.CSS_UNIT.exec(i)}function Rbe(i){i=i.replace(abe,"").replace(lbe,"").toLowerCase();var e=!1;if(UB[i])i=UB[i],e=!0;else if(i=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Bu.rgb.exec(i))?{r:t[1],g:t[2],b:t[3]}:(t=Bu.rgba.exec(i))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Bu.hsl.exec(i))?{h:t[1],s:t[2],l:t[3]}:(t=Bu.hsla.exec(i))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Bu.hsv.exec(i))?{h:t[1],s:t[2],v:t[3]}:(t=Bu.hsva.exec(i))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Bu.hex8.exec(i))?{r:Jl(t[1]),g:Jl(t[2]),b:Jl(t[3]),a:dJ(t[4]),format:e?"name":"hex8"}:(t=Bu.hex6.exec(i))?{r:Jl(t[1]),g:Jl(t[2]),b:Jl(t[3]),format:e?"name":"hex"}:(t=Bu.hex4.exec(i))?{r:Jl(t[1]+""+t[1]),g:Jl(t[2]+""+t[2]),b:Jl(t[3]+""+t[3]),a:dJ(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Bu.hex3.exec(i))?{r:Jl(t[1]+""+t[1]),g:Jl(t[2]+""+t[2]),b:Jl(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function Ibe(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 GB(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 Pbe(i){if(Array.isArray(i))return i}function Lbe(i){if(Array.isArray(i))return GB(i)}function AJ(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 Dbe(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Nbe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function fa(i,e){return i.get(AJ(i,e))}function __(i,e,t){Dbe(i,e),e.set(i,t)}function BC(i,e,t){return i.set(AJ(i,e),t),t}function Fbe(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,Hbe(n.key),n)}}function Bbe(i,e,t){return e&&Fbe(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Obe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Ube(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 kbe(){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 zbe(){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 Vbe(i,e){return Pbe(i)||Ube(i,e)||gJ(i,e)||kbe()}function Gbe(i){return Lbe(i)||Obe(i)||gJ(i)||zbe()}function qbe(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 Hbe(i){var e=qbe(i,"string");return typeof e=="symbol"?e:e+""}function gJ(i,e){if(i){if(typeof i=="string")return GB(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)?GB(i,e):void 0}}var x_=new WeakMap,aw=new WeakMap,y_=new WeakMap,kB=new WeakMap,zB=new WeakMap,VB=new WeakMap,vJ=(function(){function i(){Nbe(this,i),__(this,x_,new Map),__(this,aw,new Map),__(this,y_,function(e){return e}),__(this,kB,function(){return{}}),__(this,zB,function(){}),__(this,VB,function(){})}return Bbe(i,[{key:"getObj",value:function(t){return fa(x_,this).get(fa(y_,this).call(this,t))}},{key:"getData",value:function(t){return fa(aw,this).get(t)}},{key:"entries",value:function(){return Gbe(fa(aw,this).entries()).map(function(t){var n=Vbe(t,2),r=n[0],s=n[1];return[s,r]})}},{key:"id",value:function(t){return BC(y_,this,st(t)),this}},{key:"onCreateObj",value:function(t){return BC(kB,this,t),this}},{key:"onUpdateObj",value:function(t){return BC(zB,this,t),this}},{key:"onRemoveObj",value:function(t){return BC(VB,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(s){return!fa(x_,n).has(fa(y_,n).call(n,s))}).forEach(function(s){var o=fa(kB,n).call(n,s);fa(x_,n).set(fa(y_,n).call(n,s),o),fa(aw,n).set(o,s)});var r=new Map(t.map(function(s){return[fa(y_,n).call(n,s),s]}));return fa(x_,this).forEach(function(s,o){r.has(o)?fa(zB,n).call(n,s,r.get(o)):(fa(VB,n).call(n,s,o),fa(x_,n).delete(o),fa(aw,n).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})();var s1=lq(_J(),1);var Ei=11102230246251565e-32,Xs=134217729,cw=(3+8*Ei)*Ei;function yg(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 uw(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 Wbe=(3+16*Ei)*Ei,jbe=(2+12*Ei)*Ei,Xbe=(9+64*Ei)*Ei*Ei,b_=ht(4),xJ=ht(8),yJ=ht(12),bJ=ht(16),ja=ht(4);function $be(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=Xs*B,A=d-(d-B),y=B-A,d=Xs*G,w=d-(d-G),S=G-w,F=y*S-(I-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,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=uw(4,b_),Y=jbe*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=Xbe*o+cw*Math.abs(W),W+=B*u+G*a-(z*c+k*l),W>=Y||-W>=Y))return W;I=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-(I-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,ja[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,ja[1]=P-(T+f)+(f-D),C=R+T,f=C-R,ja[2]=R-(C-f)+(T-f),ja[3]=C;let H=yg(4,b_,4,ja,xJ);I=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-(I-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,ja[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,ja[1]=P-(T+f)+(f-D),C=R+T,f=C-R,ja[2]=R-(C-f)+(T-f),ja[3]=C;let $=yg(H,xJ,4,ja,yJ);I=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-(I-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,ja[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,ja[1]=P-(T+f)+(f-D),C=R+T,f=C-R,ja[2]=R-(C-f)+(T-f),ja[3]=C;let J=yg($,yJ,4,ja,bJ);return bJ[J-1]}function X0(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)>=Wbe*c?l:-$be(i,e,t,n,r,s,c)}var Lit=(7+56*Ei)*Ei,Dit=(3+28*Ei)*Ei,Nit=(26+288*Ei)*Ei*Ei,Fit=ht(4),Bit=ht(4),Oit=ht(4),Uit=ht(4),kit=ht(4),zit=ht(4),Vit=ht(4),Git=ht(4),qit=ht(4),Hit=ht(8),Wit=ht(8),jit=ht(8),Xit=ht(4),$it=ht(8),Yit=ht(8),Zit=ht(16),Kit=ht(12),Qit=ht(192),Jit=ht(192);var nrt=(10+96*Ei)*Ei,irt=(4+48*Ei)*Ei,rrt=(44+576*Ei)*Ei*Ei,srt=ht(4),ort=ht(4),art=ht(4),lrt=ht(4),crt=ht(4),urt=ht(4),hrt=ht(4),frt=ht(4),drt=ht(8),prt=ht(8),mrt=ht(8),Art=ht(8),grt=ht(8),vrt=ht(8),_rt=ht(8),xrt=ht(8),yrt=ht(8),brt=ht(4),wrt=ht(4),Srt=ht(4),Trt=ht(8),Ert=ht(16),Mrt=ht(16),Crt=ht(16),Rrt=ht(32),Irt=ht(32),Prt=ht(48),Lrt=ht(64),Drt=ht(1152),Nrt=ht(1152);var Urt=(16+224*Ei)*Ei,krt=(5+72*Ei)*Ei,zrt=(71+1408*Ei)*Ei*Ei,Vrt=ht(4),Grt=ht(4),qrt=ht(4),Hrt=ht(4),Wrt=ht(4),jrt=ht(4),Xrt=ht(4),$rt=ht(4),Yrt=ht(4),Zrt=ht(4),Krt=ht(24),Qrt=ht(24),Jrt=ht(24),est=ht(24),tst=ht(24),nst=ht(24),ist=ht(24),rst=ht(24),sst=ht(24),ost=ht(24),ast=ht(1152),lst=ht(1152),cst=ht(1152),ust=ht(1152),hst=ht(1152),fst=ht(2304),dst=ht(2304),pst=ht(3456),mst=ht(5760),Ast=ht(8),gst=ht(8),vst=ht(8),_st=ht(16),xst=ht(24),yst=ht(48),bst=ht(48),wst=ht(96),Sst=ht(192),Tst=ht(384),Est=ht(384),Mst=ht(384),Cst=ht(768);var Rst=ht(96),Ist=ht(96),Pst=ht(96),Lst=ht(1152);var SJ=Math.pow(2,-52),OC=new Uint32Array(512),$0=class i{static from(e,t=ewe,n=twe){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=HB(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=HB(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=Qbe(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];w_(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(X0(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=Jbe(S,T,R,P,F,D);this._cx=L.x,this._cy=L.y;for(let B=0;B<o;B++)this._dists[B]=HB(e[2*B],e[2*B+1],L.x,L.y);w_(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)<=SJ&&Math.abs(Y-z)<=SJ||(k=W,z=Y,G===A||G===y||G===w))continue;let H=0;for(let he=0,ge=this._hashKey(W,Y);he<this._hashSize&&(H=s[(ge+he)%this._hashSize],!(H!==-1&&H!==n[H]));he++);H=t[H];let $=H,J;for(;J=n[$],X0(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],X0(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[$],X0(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(Zbe(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=OC[--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(Kbe(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<OC.length&&(OC[s++]=R)}else{if(s===0)break;e=OC[--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 Zbe(i,e){let t=i/(Math.abs(i)+Math.abs(e));return(e>0?3-t:1+t)/4}function HB(i,e,t,n){let r=i-t,s=e-n;return r*r+s*s}function Kbe(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 Qbe(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 Jbe(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 w_(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;hw(i,r,s),e[i[t]]>e[i[n]]&&hw(i,t,n),e[i[s]]>e[i[n]]&&hw(i,s,n),e[i[t]]>e[i[s]]&&hw(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;hw(i,s,o)}i[t+1]=i[o],i[o]=a,n-s+1>=o-t?(w_(i,e,s,n),w_(i,e,t,o-1)):(w_(i,e,t,o-1),w_(i,e,s,n))}}function hw(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function ewe(i){return i[0]}function twe(i){return i[1]}function TJ(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=X0(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 EJ(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 MJ(i){return i.type==="Feature"?i.geometry:i}function nwe(i,e,t={}){if(!i)throw new Error("point is required");if(!e)throw new Error("polygon is required");let n=EJ(i),r=MJ(e),s=r.type,o=e.bbox,a=r.coordinates;if(o&&iwe(n,o)===!1)return!1;s==="Polygon"&&(a=[a]);let l=!1;for(var c=0;c<a.length;++c){let u=TJ(n,a[c]);if(u===0)return!t.ignoreBoundary;u&&(l=!0)}return l}function iwe(i,e){return e[0]<=i[0]&&e[1]<=i[1]&&e[2]>=i[0]&&e[3]>=i[1]}var CJ=nwe;var Gc=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 Y0=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 fw=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 Gc: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 Gc: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 Gc: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 Y0;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 rwe=2*Math.PI,S_=Math.pow;function swe(i){return i[0]}function owe(i){return i[1]}function awe(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 lwe(i,e,t){return[i+Math.sin(i+e)*t,e+Math.cos(i-e)*t]}var T_=class i{static from(e,t=swe,n=owe,r){return new i("length"in e?cwe(e,t,n,r):Float64Array.from(uwe(e,t,n,r)))}constructor(e){this._delaunator=new $0(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&&awe(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=lwe(t[2*d],t[2*d+1],f);t[2*d]=y[0],t[2*d+1]=y[1]}this._delaunator=new $0(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 fw(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=S_(t-c[e*2],2)+S_(n-c[e*2+1],2),d=r[e],A=d;do{let y=l[A],w=S_(t-c[y*2],2)+S_(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&&S_(t-c[A*2],2)+S_(n-c[A*2+1],2)<f)return A;break}}while(A!==d);return u}render(e){let t=e==null?e=new Gc: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 Gc: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,rwe)}return n&&n.value()}renderHull(e){let t=e==null?e=new Gc: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 Y0;return this.renderHull(e),e.value()}renderTriangle(e,t){let n=t==null?t=new Gc: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 Y0;return this.renderTriangle(e,t),t.value()}};function cwe(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*uwe(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,RJ=dw/2,fot=dw/4,dot=dw*2,WB=180/dw,jB=dw/180;var XB=Math.atan2,UC=Math.cos;var IJ=Math.max,PJ=Math.min;var kC=Math.sin,LJ=Math.sign||function(i){return i>0?1:i<0?-1:0},zC=Math.sqrt;function $B(i){return i>1?RJ:i<-1?-RJ:Math.asin(i)}function YB(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Tl(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 pw(i,e){return[i[0]+e[0],i[1]+e[1],i[2]+e[2]]}function mw(i){var e=zC(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);return[i[0]/e,i[1]/e,i[2]/e]}function ZB(i){return[XB(i[1],i[0])*WB,$B(IJ(-1,PJ(1,i[2])))*WB]}function tf(i){let e=i[0]*jB,t=i[1]*jB,n=UC(t);return[n*UC(e),n*kC(e),kC(t)]}function VC(i){return i=i.map(e=>tf(e)),YB(i[0],Tl(i[2],i[1]))}function NJ(i){let e=fwe(i),t=pwe(e),n=dwe(t,i),r=Awe(t,i.length),s=hwe(r,i),o=mwe(t,i),{polygons:a,centers:l}=gwe(o,t,i),c=vwe(a),u=xwe(t,i),f=_we(n,t);return{delaunay:e,edges:n,triangles:t,centers:l,neighbors:r,polygons:a,mesh:c,hull:u,urquhart:f,find:s}}function hwe(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=tf([r,s]);do a=o,o=null,l=t(u,tf(e[a])),i[a].forEach(f=>{let d=t(u,tf(e[f]));if(d<l){l=d,o=f,c=f;return}});while(o!==null);return c}}function fwe(i){if(i.length<2)return{};let e=0;for(;isNaN(i[e][0]+i[e][1])&&e++<i.length;);let t=QF(i[e]),n=AB().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*zC(s);r.forEach(d=>i[d]=[o,0]),i.push([0,o]),i.push([-o,0]),i.push([0,-o]);let a=T_.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 dwe(i,e){let t=new Set;return e.length===2?[[0,1]]:(i.forEach(n=>{if(n[0]!==n[1]&&!(VC(n.map(r=>e[r]))<0))for(let r=0,s;r<3;r++)s=(r+1)%3,t.add(z0([n[r],n[s]]).join("-"))}),Array.from(t,n=>n.split("-").map(Number)))}function pwe(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 mwe(i,e){return i.map(t=>{let n=t.map(s=>e[s]).map(tf),r=pw(pw(Tl(n[1],n[0]),Tl(n[2],n[1])),Tl(n[0],n[2]));return ZB(mw(r))})}function Awe(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 gwe(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=tf(t[0]),l=tf(t[1]),c=mw(pw(a,l)),u=mw(Tl(a,l)),f=Tl(c,u),d=[c,Tl(c,f),Tl(Tl(c,f),f),Tl(Tl(Tl(c,f),f),f)].map(ZB).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=DJ(t[a[0][3][0]],t[a[0][3][1]],r[l[0]]),f=DJ(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 DJ(i,e,t){i=tf(i),e=tf(e),t=tf(t);let n=LJ(YB(Tl(e,i),t));return ZB(mw(pw(i,e)).map(r=>n*r))}function vwe(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 _we(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=z0([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 xwe(i,e){let t=new Set,n=[];i.map(a=>{if(!(VC(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 KB(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=NJ(e.points)}return e};return e._vx=function(t){if(typeof t=="object"&&"type"in t)return hC(t)[0];if(0 in t)return t[0]},e._vy=function(t){if(typeof t=="object"&&"type"in t)return hC(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=>VC(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=>Sl(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||Sl([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 JB(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 JB(i)}function wwe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Swe(i,e,t){return e=qC(e),Lwe(i,BJ()?Reflect.construct(e,[],qC(i).constructor):e.apply(i,t))}function Twe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Ewe(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function qC(i){return qC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},qC(i)}function Mwe(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&&eO(i,e)}function BJ(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(BJ=function(){return!!i})()}function Cwe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Rwe(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 Iwe(){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 Pwe(){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 Lwe(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 wwe(i)}function eO(i,e){return eO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},eO(i,e)}function nf(i,e){return ywe(i)||Rwe(i,e)||OJ(i,e)||Iwe()}function QB(i){return bwe(i)||Cwe(i)||OJ(i)||Pwe()}function OJ(i,e){if(i){if(typeof i=="string")return JB(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)?JB(i,e):void 0}}function Dwe(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=Nwe(i,n),s=Yh(r),o=Fwe(i,n),a=[].concat(QB(s),QB(o)),l={type:"Polygon",coordinates:i},c=iC(l),u=nf(c,2),f=nf(u[0],2),d=f[0],A=f[1],y=nf(u[1],2),w=y[0],S=y[1],T=d>w||S>=89||A<=-89,R=[];if(T){var P=KB(a).triangles(),I=new Map(a.map(function(J,te){var ce=nf(J,2),he=ce[0],ge=ce[1];return["".concat(he,"-").concat(ge),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=nf(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 ge=J.properties.circumcenter;if(!tO(ge,l,T))return}(te=R).push.apply(te,he)}})}else if(o.length)for(var B=$0.from(a),k=function(te){var ce,he=[2,1,0].map(function(Qe){return B.triangles[te+Qe]}),ge=he.map(function(Qe){return a[Qe]});if(he.some(function(Qe){return Qe<s.length})){var Re=[0,1].map(function(Qe){return kM(ge,function(Fe){return Fe[Qe]})});if(!tO(Re,l,T))return 1}(ce=R).push.apply(ce,QB(he))},z=0,G=B.triangles.length;z<G;z+=3)k(z);else{var F=v_(r),D=F.vertices,L=F.holes,C=L===void 0?[]:L;R=IB(D,C,2)}var W=bl(z0(a,function(J){return J[0]}),[0,1]),Y=bl(z0(a,function(J){return J[1]}),[0,1]),H=a.map(function(J){var te=nf(J,2),ce=te[0],he=te[1];return[W(ce),Y(he)]}),$={points:a,indices:R,uvs:H};return{contour:r,triangles:$}}function Nwe(i,e){return i.map(function(t){var n=[],r;return t.forEach(function(s){if(r){var o=Sl(s,r)*180/Math.PI;if(o>e)for(var a=Ag(r,s),l=1/Math.ceil(o/e),c=l;c<1;)n.push(a(c)),c+=l}n.push(r=s)}),n})}function Fwe(i,e){var t={type:"Polygon",coordinates:i},n=iC(t),r=nf(n,2),s=nf(r[0],2),o=s[0],a=s[1],l=nf(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 Bwe(e,{minLng:o,maxLng:c,minLat:a,maxLat:u}).filter(function(d){return tO(d,t,f)})}function Bwe(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 tO(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?sB(e,i):CJ(i,e)}var GC=window.THREE?window.THREE:{BufferGeometry:Xn,Float32BufferAttribute:Ln},FJ=new GC.BufferGeometry().setAttribute?"setAttribute":"addAttribute",HC=(function(i){function e(t,n,r,s,o,a,l){var c;Twe(this,e),c=Swe(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=Dwe(t,{resolution:l}),f=u.contour,d=u.triangles,A=Yh(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[FJ]("position",new GC.Float32BufferAttribute(y,3)),c[FJ]("uv",new GC.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=nf(z,2),W=G[0],Y=G[1];return Owe(Y,W,C(W,Y))})});return v_(B)}function I(){for(var D=P(f,n),L=D.vertices,C=D.holes,B=P(f,r),k=B.vertices,z=Yh([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 ge=0;ge<G;ge+=1)ce.push(ge/(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 Mwe(e,i),Ewe(e)})(GC.BufferGeometry);function Owe(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 nO(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 Uwe(i){if(Array.isArray(i))return i}function kwe(i){if(Array.isArray(i))return nO(i)}function zwe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Vwe(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 Gwe(){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 qwe(){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 Hwe(i,e){if(i==null)return{};var t,n,r=Wwe(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 Wwe(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 jwe(i,e){return Uwe(i)||Vwe(i,e)||UJ(i,e)||Gwe()}function Xwe(i){return kwe(i)||zwe(i)||UJ(i)||qwe()}function $we(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 Ywe(i){var e=$we(i,"string");return typeof e=="symbol"?e:e+""}function UJ(i,e){if(i){if(typeof i=="string")return nO(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)?nO(i,e):void 0}}var kJ=(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=Hwe(S,[A].map(Ywe));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=jwe(u,2),d=f[0],A=f[1];return a(A,[].concat(Xwe(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":ge[Le>>3]=it;break;default:Dm("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 ge[Le>>3];default:Dm("invalid type for getValue: "+it)}return null}var S=!1;function T(Le,it){Le||Dm("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 VS=(ii.length<<2)+1;zi=AG(VS),B(ii,zi,VS)}return zi},array:function(ii){var zi=AG(ii.length);return z(ii,zi),zi}};function Ii(ii){return it==="string"?L(ii):it==="boolean"?!!ii:ii}var ie=R(Le),or=[],rl=0;if(He)for(var ho=0;ho<He.length;ho++){var Ks=sr[Dt[ho]];Ks?(rl===0&&(rl=Vle()),or[ho]=Ks(He[ho])):or[ho]=He[ho]}var ys=ie.apply(null,or);return ys=Ii(ys),rl!==0&&zle(rl),ys}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 rl=Ii-65536;sr+=String.fromCharCode(55296|rl>>10,56320|rl&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,ge;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=ge=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,ve=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),ve)){var it=ve;ve=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 sn(Le,it,Dt,He){Dm("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){Dm("OOM")}function Dn(Le){try{var it=new ArrayBuffer(Le);return it.byteLength!=Le?void 0:(new Int8Array(it).set(Y),on(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,rl,ho=0;Le=Le.replace(/[^A-Za-z0-9\+\/\=]/g,"");do Ii=it.indexOf(Le.charAt(ho++)),ie=it.indexOf(Le.charAt(ho++)),or=it.indexOf(Le.charAt(ho++)),rl=it.indexOf(Le.charAt(ho++)),He=Ii<<2|ie>>4,h=(ie&15)<<4|or>>2,sr=(or&3)<<6|rl,Dt=Dt+String.fromCharCode(He),or!==64&&(Dt=Dt+String.fromCharCode(h)),rl!==64&&(Dt=Dt+String.fromCharCode(sr));while(ho<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:Dm,b:f,c:d,d:sn,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,rl=it.p|0,ho=Le.Math.floor,Ks=Le.Math.abs,ys=Le.Math.sqrt,ii=Le.Math.cos,zi=Le.Math.sin,VS=Le.Math.tan,Gle=Le.Math.acos,Ix=Le.Math.asin,xG=Le.Math.atan,wa=Le.Math.atan2,u1=Le.Math.ceil,sl=Le.Math.imul,UP=Le.Math.min,qle=Le.Math.max,zf=Le.Math.clz32,Hle=it.a,On=it.b,ee=it.c,di=it.d,yG=it.e,Wle=it.f,jle=it.g,Xle=it.h,$le=it.i,Q=28416;function Yle(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 Zle(p){p=p|0;var m=0;return m=Q,Q=Q+p|0,Q=Q+15&-16,m|0}function Kle(){return Q|0}function Qle(p){p=p|0,Q=p}function Jle(p,m){p=p|0,m=m|0,Q=p}function ece(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=WS(15,m)|0,m|0):(g=((p|0)<0)<<31>>31,v=br(p|0,g|0,3,0)|0,_=ee()|0,g=At(p|0,g|0,1,0)|0,g=br(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 bG(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,wG(p,m,g,_,0)|0}function wG(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,!(SG(p,m,g,_,v)|0))return _=0,Q=M,_|0;do if((g|0)>=0){if((g|0)>13780509){if(x=WS(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=br(g|0,x|0,3,0)|0,E=ee()|0,x=At(g|0,x|0,1,0)|0,x=br(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(ip(_|0,0,b<<3|0)|0,v|0){ip(v|0,0,b<<2|0)|0,x=eh(p,m,g,_,v,b,E,0)|0;break}x=Sa(b,4)|0,x?(N=eh(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 SG(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,O=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(O=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=_+(O<<3)|0,h[p>>2]=x,h[p+4>>2]=m,h[v+(O<<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 O=O+1|0,N=b?0:p,q=b?M?0:E:q}else for(O=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=_+(O<<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 O=O+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 eh(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,O=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=Vf(p|0,m|0,x|0,b|0)|0,O=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,O|0,1,0)|0,M=np(M|0,ee()|0,x|0,b|0)|0,O=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=eh(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=eh(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=eh(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=eh(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=eh(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=eh(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,O=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,O=q&127,O>>>0>121)return v=5,v|0;M=ol(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=(mc(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+(O*28|0)+(g<<2)>>2]|0,X=ft(K|0,0,45)|0,p=X|p,m=ee()|0|m&-1040385,g=h[4272+(O*28|0)+(g<<2)>>2]|0,(K&127|0)==127&&(K=ft(h[848+(O*28|0)+20>>2]|0,0,45)|0,m=ee()|0|m&-1040385,g=h[4272+(O*28|0)+20>>2]|0,p=Nm(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(xr(E)|0){t:do if((ol(p,m)|0)==1){if((O|0)!=(E|0))if(CG(E,h[7696+(O*28|0)>>2]|0)|0){p=ZP(p,m)|0,b=1,m=ee()|0;break}else di(27634,26928,533,26936);switch(M|0){case 3:{p=Nm(p,m)|0,m=ee()|0,h[_>>2]=(h[_>>2]|0)+1,b=0;break t}case 5:{p=ZP(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=YP(p,m)|0,m=ee()|0,x=x+1|0;while((x|0)!=(g|0))}if((O|0)!=(E|0)){if(!(kP(E)|0)){if((b|0)!=0|(ol(p,m)|0)!=5)break;h[_>>2]=(h[_>>2]|0)+1;break}switch(q&127){case 8:case 118:break e;default:}(ol(p,m)|0)!=3&&(h[_>>2]=(h[_>>2]|0)+1)}}else if((g|0)>0){x=0;do p=Nm(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 tce(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,TG(p,m,g,_)|0?(ip(_|0,0,g*48|0)|0,_=nce(p,m,g,_)|0,_|0):(_=0,_|0)}function TG(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,O=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));O=_,h[O>>2]=q,h[O+4>>2]=m,O=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)!=(O|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 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,O=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=WS(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,O=br(g|0,v|0,3,0)|0,x=ee()|0,v=At(g|0,v|0,1,0)|0,v=br(O|0,x|0,v|0,ee()|0)|0,v=At(v|0,ee()|0,1,0)|0,x=ee()|0,O=b,h[O>>2]=v,h[O+4>>2]=x;if(N=Sa(v,8)|0,!N)v=13;else{if(O=Sa(v,4)|0,!O){_t(N),v=13;break}if(v=eh(p,m,g,N,O,v,x,0)|0,v|0){_t(N),_t(O);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[O+(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(O),v=0}}else v=2;while(!1);return j=v,Q=q,j|0}function GS(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 ice(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=Ux(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,jG(x,v),g=LG(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 EG(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,O=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,Mo=0,Vn=0,wi=0,Ta=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=vce(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)),Ta=+ie[Ut>>3],M=Js(N|0,M|0,xe|0,se|0)|0,wi=+(M>>>0)+4294967296*+(ee()|0),Mo=+(xe>>>0)+4294967296*+(se|0),ie[Be>>3]=Vn*(Ta*wi)+Vn*(+ie[lt>>3]*Mo),ie[je>>3]=Vn*(+ie[be>>3]*wi)+Vn*(+ie[gt>>3]*Mo),M=KP(Be,_,Ke)|0,M|0){E=M;break}ue=Ke,ae=h[ue>>2]|0,ue=h[ue+4>>2]|0,j=Vf(ae|0,ue|0,m|0,g|0)|0,O=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,O|0,1,0)|0,j=np(M|0,ee()|0,m|0,g|0)|0,O=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 rce(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,O=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,Mo=0,Vn=0,wi=0;if(wi=Q,Q=Q+112|0,pi=wi+80|0,M=wi+72|0,bi=wi,Mo=wi+56|0,v=Ux(g)|0,v|0)return Vn=v,Q=wi,Vn|0;if(N=p+8|0,Vn=yr((h[N>>2]<<5)+32|0)|0,!Vn)return Vn=13,Q=wi,Vn|0;if(rL(p,Vn),v=Ux(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,jG(M,pi),v=LG(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=Sa(lt,8)|0,!g)return _t(Vn),Vn=13,Q=wi,Vn|0;if(E=Sa(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=EG(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=EG((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<>>>0>0&&ip(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,SG(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=Sa(7,4)|0,E|0&&(eh(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(O=Vf(X|0,K|0,lt|0,pt|0)|0,N=ee()|0,E=_+(O<<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(O|0,N|0,1,0)|0,O=np(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=_+(O<<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}d1(X,K,Mo)|0,sL(p,Vn,Mo)|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 sce(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=xce(p,m,((m|0)<0)<<31>>31,b)|0,p|0)return b=p,Q=E,b|0;if(x=tue(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 pc(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=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=+wa(+(+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=_;O=p,p=p+1|0,q=(p|0)%(b|0)|0,N=+ie[x+(O<<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+(O<<4)+8>>3],g=+wa(+(+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=Fm(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],pc(_,g)|0,x=0,Q=b,x|0)}function ace(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=Fm(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],pc(_,g)|0,ie[g>>3]=+ie[g>>3]*4058973249931477e-8,x=0,Q=b,x|0)}function lce(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=Fm(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],pc(_,g)|0,ie[g>>3]=+ie[g>>3]*4058973249931477e-8*1e6,x=0,Q=b,x|0)}function xr(p){return p=p|0,p>>>0>121?(p=0,p|0):(p=h[7696+(p*28|0)+16>>2]|0,p|0)}function kP(p){return p=p|0,(p|0)==4|(p|0)==117|0}function MG(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 cce(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 uce(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 hce(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 CG(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 zP(p,m){return p=p|0,m=m|0,h[848+(p*28|0)+(m<<2)>>2]|0}function VP(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 fce(){return 122}function dce(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 pce(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 mce(p){return p=p|0,+ie[p+16>>3]<+ie[p+24>>3]|0}function Ace(p){return p=p|0,+(+ie[p>>3]-+ie[p+8>>3])}function RG(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 GP(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=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,O=+ie[g>>3],b=x<O,_=m+16|0,N=+ie[_>>3],v=m+24|0,M=+ie[v>>3],E=N<M,m=O-N<M-x,p=b?E|m?1:2:0,m=E?b?1:m?2:1:0,x=+Bl(x,p),x<+Bl(+ie[v>>3],m)||(O=+Bl(+ie[g>>3],p),O>+Bl(+ie[_>>3],m))?(E=0,E|0):(E=1,E|0))}function gce(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 IG(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=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,O=+ie[g>>3],v=m+24|0,N=+ie[v>>3],E=O<N,m=x-O<N-M,p=b?E|m?1:2:0,m=E?b?1:m?2:1:0,x=+Bl(x,p),x<=+Bl(+ie[v>>3],m)?(O=+Bl(+ie[_>>3],p),E=O>=+Bl(+ie[g>>3],m),E|0):(E=0,E|0))}function PG(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));nu(p|0,_|0,168)|0,Q=v}function LG(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,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0;K=Q,Q=Q+288|0,O=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=JP(m,N)|0,m|0?(X=m,Q=K,X|0):(M=N,N=h[M>>2]|0,M=h[M+4>>2]|0,d1(N,M,O)|0,Fm(N,M,q)|0,b=+Fx(O,q+8|0),ie[O>>3]=+ie[p>>3],M=O+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=+Fx(O,q),ue=+ie[M>>3]-+ie[N>>3],x=+Ks(+ue),ae=+ie[O>>3]-+ie[q>>3],_=+Ks(+ae),!(ue==0|ae==0)&&(ue=+sq(+x,+_),ue=+u1(+(v*v/+QS(+(ue/+QS(+x,+_)),3)/(b*(b*2.59807621135)*.8))),ie[or>>3]=ue,j=~~ue>>>0,X=+Ks(ue)>=1?ue>0?~~+UP(+ho(ue/4294967296),4294967295)>>>0:~~+u1((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 vce(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,O=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=JP(g,M)|0,g|0?(_=g,Q=N,_|0):(g=M,v=h[g>>2]|0,g=h[g+4>>2]|0,d1(v,g,b)|0,Fm(v,g,E)|0,O=+Fx(b,E+8|0),O=+u1(+(+Fx(p,m)/(O*2))),ie[or>>3]=O,g=~~O>>>0,v=+Ks(O)>=1?O>0?~~+UP(+ho(O/4294967296),4294967295)>>>0:~~+u1((O-+(~~O>>>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 _ce(p,m){p=p|0,m=+m;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=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],O=N-M,_=(_*m-_)*.5,m=(O*m-O)*.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 xce(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,O=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=jP(h[v>>2]|0,h[v+4>>2]|0)|0,b=0,E=0;;){if(x=p+(b<<3)|0,lt=x,!(HS(h[lt>>2]|0,h[lt+4>>2]|0)|0)){v=5,je=159;break}if(lt=x,lt=(jP(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=yr(v)|0,!b)return lt=13,Q=pt,lt|0;for(nu(b|0,p|0,v|0)|0,$S(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=br(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=br(Ae|0,we|0,10,0)|0,se=ee()|0,Ut=yr(Ae<<5)|0,!Ut)return lt=13,Q=pt,lt|0;if(lt=Sa(xe,4)|0,!lt)return _t(Ut),lt=13,Q=pt,lt|0;e:do if(M){for(be=p,qP(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,O=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,O|0,q|0,j|0)|0,Ke=Vf(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,qP(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=br(v^b|0,(ee()|0)^x|0,484763065,-1084733587)|0,b=ee()|0,v=tt(x|0,b|0,27)|0,b=br(v^x|0,(ee()|0)^b|0,321982955,-1798288965)|0,x=ee()|0,v=tt(b|0,x|0,31)|0,x=Vf(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=np(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,NG(h[be>>2]|0,h[be+4>>2]|0,gt)|0){je=39;break}O=gt,N=h[O>>2]|0,O=h[O+4>>2]|0,x=tt(N|0,O|0,30)|0,x=br(x^N|0,(ee()|0)^O|0,484763065,-1084733587)|0,b=ee()|0,v=tt(x|0,b|0,27)|0,b=br(v^x|0,(ee()|0)^b|0,321982955,-1798288965)|0,x=ee()|0,v=tt(b|0,x|0,31)|0,x=Vf(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)==(O|0));)if(v=At(x|0,b|0,1,0)|0,x=np(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=qS(E)|0,be=qS(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,O=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,O|0,1,0)|0,O=ee()|0,(O|0)<(we|0)|(O|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=yr(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=yr(x<<4)|0,!K)break;x=ae,b=ue,X=0,j=0,E=0,M=0;do{if(Px(x,b,Be)|0){je=69;break n}if(se=h[Be>>2]|0,O=se+-1|0,q=((O|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<O>>>0);E=b,M=x}X=At(X|0,j|0,O|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=yue(K,X<<4)|0,!x){je=75;break}ue=qS(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],pc(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);$S(be,Me,24,2);t:do if((Me|0)==0&(Ke|0)==0){if(se=yr(192)|0,se|0){if(h[se+16>>2]=0,h[se+20>>2]=0,j=se+8|0,h[j>>2]=3,v=yr(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],pc(gt,se)|0,h[se+40>>2]=0,h[se+44>>2]=0,q=se+32|0,h[q>>2]=3,v=yr(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],O=v+16|0,h[O>>2]=h[3876],h[O+4>>2]=h[3877],h[O+8>>2]=h[3878],h[O+12>>2]=h[3879],O=v+32|0,h[O>>2]=h[3880],h[O+4>>2]=h[3881],h[O+8>>2]=h[3882],h[O+12>>2]=h[3883],h[gt>>2]=h[q>>2],h[gt+4>>2]=h[q+4>>2],pc(gt,se+24|0)|0,h[se+64>>2]=0,h[se+68>>2]=0,O=se+56|0,h[O>>2]=3,v=yr(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[O>>2],h[gt+4>>2]=h[O+4>>2],pc(gt,se+48|0)|0,h[se+88>>2]=0,h[se+92>>2]=0,N=se+80|0,h[N>>2]=3,v=yr(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],pc(gt,se+72|0)|0,h[se+112>>2]=0,h[se+116>>2]=0,M=se+104|0,h[M>>2]=3,v=yr(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],pc(gt,se+96|0)|0,h[se+136>>2]=0,h[se+140>>2]=0,E=se+128|0,h[E>>2]=3,v=yr(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],pc(gt,se+120|0)|0,h[se+160>>2]=0,h[se+164>>2]=0,b=se+152|0,h[b>>2]=3,v=yr(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],pc(gt,se+144|0)|0,h[se+184>>2]=0,h[se+188>>2]=0,x=se+176|0,h[x>>2]=3,v=yr(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],pc(gt,se+168|0)|0,$S(se,8,24,3),v=yr(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[O>>2],h[je+4>>2]=h[O+4>>2],h[je+8>>2]=h[O+8>>2],h[je+12>>2]=h[O+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=yr(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(O=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=yr(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=O+(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($S(p,ue,24,3),v=yr(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 yce(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 qS(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=qS(g)|0,h[m>>2]=g,g|0)}function bce(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 wce(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 Sce(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,O=0,q=0;if(q=Q,Q=Q+64|0,O=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){$P(p,m,x,O)|0,$P(g,_,x,E)|0,N=O,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=O,b=x+56|0;do h[x>>2]=0,x=x+4|0;while((x|0)<(b|0));return bG(p,m,1,O)|0,m=O,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0))&&(m=O+8|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=O+16|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=O+24|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=O+32|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=O+40|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))?(x=O+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 Tce(p,m,g,_,v){return p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,g=GS(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 Ece(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 Mce(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 DG(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=HS(p,g)|0,g|0)}function Cce(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 qP(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 Px(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,_=vue(p,x,_&7)|0,(_|0)==-1?(h[g>>2]=0,x=6,Q=b,x|0):(f1(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?HP(v,m,_,2,g):WP(v,m,_,2,g),x=0,Q=b,x|0)):(x=6,Q=b,x|0)}function NG(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=GS(_,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 Rce(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,O=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],O=+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]-O,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=+Gle(+(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=+ys(+(Be*Be+(b*b+ae*ae))),ue=ue>0?1/ue:0,b=b*ue,ae=ae*ue,ue=Be*ue,Be=-(N*se+O*we+M*xe),K=N+se*Be,_=O+we*Be,N=M+xe*Be,O=+ys(+(N*N+(K*K+_*_))),O=O>0?1/O:0,K=K*O,_=_*O,O=N*O,_=+Nx(Ae-+Nx(+wa(+(O*(we*b-se*ae)+(K*(xe*ae-we*ue)+_*(se*ue-xe*b))),+(ue*O+(b*K+ae*_))))),mc(m)|0?b=+Nx(_+-.3334731722518321):b=_,_=+VS(+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 Ice(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,Lx(v,h[p>>2]|0,m,0,g),Q=_}function Lx(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,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0;if(x=+gue(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=+wa(+ +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=(mc(g)|0)==0,x=+xG(+((g?E:E*.37796447300922725)*.381966011250105))):(x=+xG(+(x*.381966011250105)),mc(g)|0&&(b=+Nx(b+.3334731722518321))),q=+Nx(+ie[16368+(m*24|0)>>3]-b),E=+ie[15888+(m*24|0)>>3],O=+ie[15888+(m*24|0)+8>>3],ae=+ie[15888+(m*24|0)+16>>3],X=-(ae+(E*0+O*0)),N=E*X+0,b=O*X+0,X=ae*X+1,j=+ys(+(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-O*j)),x=ue*O+K*(X*b+q*(E*j-ae*N)),b=ue*ae+K*(X*j+q*(O*N-E*b)),E=+ys(+(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 HP(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,O=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,Mo=0,Vn=0,wi=0,Ta=0,Ns=0,ss=0,Fs=0,bs=0,al=0,fo=0,po=0,gc=0,Co=0,Pi=0,Bm=0;if(al=Q,Q=Q+256|0,x=al+240|0,pi=al+224|0,ss=al,Fs=al+208|0,bs=al+192|0,bi=al+168|0,Mo=al+152|0,Vn=al+136|0,wi=al+120|0,Ta=al+104|0,Ns=al+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],FG(pi,x,ss),h[v>>2]=0,pi=_+g+((_|0)==5&1)|0,(pi|0)<=(g|0)){Q=al;return}Ae=h[x>>2]|0,we=Fs+4|0,xe=Fs+8|0,se=Fs+12|0,Be=bs+8|0,Ke=g+5|0,Me=16848+(Ae<<2)|0,be=bi+8|0,gt=16928+(Ae<<2)|0,je=Mo+8|0,Ut=Vn+8|0,lt=wi+8|0,pt=bs+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=ss+(((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((h1(Fs,Ae,0,1)|0)==2);if((j|0)>(g|0)&(mc(m)|0)!=0){if(q=h[Fs>>2]|0,p=h[we>>2]|0,N=h[xe>>2]|0,x=h[se>>2]|0,fo=+(E-M|0),ie[bs>>3]=+(b-M|0)-fo*.5,ie[Be>>3]=fo*.8660254037844386,M=h[17008+(q*80|0)+(_<<2)>>2]|0,O=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 Co=x+p|0,Pi=(Co|0)<0,N=_+p-(Pi?Co:0)|0,gc=(N|0)<0,po=x+_-(Pi?Co:0)-(gc?N:0)|0,x=(po|0)<0,p=(Pi?0:Co)-(gc?N:0)-(x?po:0)|0,_=(gc?0:N)-(x?po:0)|0,po=x?0:po,x=(_|0)<(p|0)?_:p,x=(po|0)<(x|0)?po:x,N=(x|0)>0,p=p-(N?x:0)|0,_=_-(N?x:0)|0,x=po-(N?x:0)|0,b=b+1|0;while((b|0)<(E|0))}else _=N;switch(Pi=(h[Me>>2]|0)*3|0,po=(sl(Pi,h[18608+(q*80|0)+(M*20|0)+4>>2]|0)|0)+p|0,N=(sl(Pi,h[18608+(q*80|0)+(M*20|0)+8>>2]|0)|0)+_|0,Pi=(sl(Pi,h[18608+(q*80|0)+(M*20|0)+12>>2]|0)|0)+x|0,M=(po|0)<0,N=N-(M?po:0)|0,gc=(N|0)<0,Pi=Pi+(M?0-po|0:0)+(gc?0-N|0:0)|0,Co=(Pi|0)<0,po=(M?0:po)-(gc?N:0)-(Co?Pi:0)|0,N=(gc?0:N)-(Co?Pi:0)|0,Pi=Co?0:Pi,Co=(N|0)<(po|0)?N:po,Co=(Pi|0)<(Co|0)?Pi:Co,gc=(Co|0)>0,Pi=Pi-(gc?Co:0)|0,fo=+(N-(gc?Co:0)-Pi|0),ie[bi>>3]=+(po-(gc?Co:0)-Pi|0)-fo*.5,ie[be>>3]=fo*.8660254037844386,fo=+(h[gt>>2]|0),ie[Mo>>3]=fo*3,ie[je>>3]=0,Bm=fo*-1.5,ie[Vn>>3]=Bm,ie[Ut>>3]=fo*2.598076211353316,ie[wi>>3]=Bm,ie[lt>>3]=fo*-2.598076211353316,h[17008+(O*80|0)+(q<<2)>>2]|0){case 1:{p=Vn,_=Mo;break}case 3:{p=wi,_=Vn;break}case 2:{p=Mo,_=wi;break}default:{p=12;break e}}YG(bs,bi,_,p,Ta),Lx(Ta,O,Ae,1,Ns),Pi=h[v>>2]|0,fo=+Ix(+ +ie[ue>>3]),Bm=+wa(+ +ie[K>>3],+ +ie[Ns>>3]),ie[v+8+(Pi<<4)>>3]=fo,ie[v+8+(Pi<<4)+8>>3]=Bm,h[v>>2]=(h[v>>2]|0)+1}if((j|0)<(Ke|0)&&(Pi=h[se>>2]|0,fo=+((h[xe>>2]|0)-Pi|0),ie[bs>>3]=+((h[we>>2]|0)-Pi|0)-fo*.5,ie[pt>>3]=fo*.8660254037844386,Lx(bs,h[Fs>>2]|0,Ae,1,bi),Pi=h[v>>2]|0,fo=+Ix(+ +ie[ae>>3]),Bm=+wa(+ +ie[X>>3],+ +ie[bi>>3]),ie[v+8+(Pi<<4)>>3]=fo,ie[v+8+(Pi<<4)+8>>3]=Bm,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=al;return}else(p|0)==12&&di(27073,27120,599,27130)}function FG(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,O=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(O=(mc(h[m>>2]|0)|0)==0,O=O?_: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-_),mc(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[O+4>>2]|0,N=h[O+8>>2]|0,b=(h[O>>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[O+16>>2]|0,N=h[O+20>>2]|0,b=(h[O+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[O+28>>2]|0,N=h[O+32>>2]|0,b=(h[O+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[O+40>>2]|0,N=h[O+44>>2]|0,b=(h[O+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[O+52>>2]|0,M=h[O+56>>2]|0,b=(h[O+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 h1(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,O=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,O=p+4|0,E=h[O>>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[O>>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[O>>2]=b,h[N>>2]=x,h[M>>2]=_}return ae=h[16848+(m<<2)>>2]|0,ae=q?ae*3|0:ae,ue=sl(ae,h[v+8>>2]|0)|0,xe=sl(ae,h[v+12>>2]|0)|0,b=(sl(ae,h[v+4>>2]|0)|0)+b|0,h[O>>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[O>>2]=0,x=0):(v=x,x=b),(v|0)<0?(p=x-v|0,h[O>>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[O>>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[O>>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 Pce(p,m){p=p|0,m=m|0;var g=0;do g=h1(p,m,0,1)|0;while((g|0)==2);return g|0}function WP(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,O=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,Mo=0,Vn=0,wi=0,Ta=0,Ns=0,ss=0,Fs=0,bs=0;if(Ns=Q,Q=Q+272|0,x=Ns+256|0,b=Ns+240|0,Vn=Ns,wi=Ns+224|0,Ta=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],BG(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=Ta+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=Ta+8|0,M=je+8|0,O=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=h1(wi,xe,0,1)|0,(E|0)>(g|0)&(mc(m)|0)!=0&&(Mo=h[wi>>2]|0,(p|0)!=1&(Mo|0)!=(_|0))){switch(bs=(x+5|0)%6|0,p=h[Vn+(bs<<4)+12>>2]|0,ss=+((h[Vn+(bs<<4)+8>>2]|0)-p|0),ie[Ta>>3]=+((h[Vn+(bs<<4)+4>>2]|0)-p|0)-ss*.5,ie[we>>3]=ss*.8660254037844386,p=h[Vn+(x<<4)+12>>2]|0,ss=+((h[Vn+(x<<4)+8>>2]|0)-p|0),ie[je>>3]=+((h[Vn+(x<<4)+4>>2]|0)-p|0)-ss*.5,ie[Ae>>3]=ss*.8660254037844386,ss=+(h[Be>>2]|0),ie[Ut>>3]=ss*3,ie[Ke>>3]=0,Fs=ss*-1.5,ie[lt>>3]=Fs,ie[Me>>3]=ss*2.598076211353316,ie[pt>>3]=Fs,ie[be>>3]=ss*-2.598076211353316,h[17008+(ae*80|0)+(((_|0)==(ae|0)?Mo:_)<<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}}YG(Ta,je,_,p,pi),!(ZG(Ta,pi)|0)&&!(ZG(je,pi)|0)&&(Lx(pi,ae,xe,1,bi),bs=h[v>>2]|0,ss=+Ix(+ +ie[q>>3]),Fs=+wa(+ +ie[N>>3],+ +ie[bi>>3]),ie[v+8+(bs<<4)>>3]=ss,ie[v+8+(bs<<4)+8>>3]=Fs,h[v>>2]=(h[v>>2]|0)+1)}if((E|0)<(se|0)&&(bs=h[K>>2]|0,ss=+((h[X>>2]|0)-bs|0),ie[Ta>>3]=+((h[j>>2]|0)-bs|0)-ss*.5,ie[ue>>3]=ss*.8660254037844386,Lx(Ta,h[wi>>2]|0,xe,1,je),bs=h[v>>2]|0,ss=+Ix(+ +ie[O>>3]),Fs=+wa(+ +ie[M>>3],+ +ie[je>>3]),ie[v+8+(bs<<4)>>3]=ss,ie[v+8+(bs<<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 BG(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,O=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=(mc(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-_),mc(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,O=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,_=O+_|0,O=g+(M<<4)+12|0,h[O>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[N>>2]=x,h[O>>2]=_,h[m>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[m>>2]=b,_=_-v|0,h[O>>2]=_,h[N>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[m>>2]=E,h[N>>2]=x,h[O>>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[O>>2]=_-v),M=M+1|0;while((M|0)!=6);Q=ae}function jP(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,52)|0,ee()|0,m&15|0}function OG(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,45)|0,ee()|0,m&127|0}function Lce(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 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;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 HS(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=lL(p|0,m|0,0)|0,ee()|0,((63-b|0)%3|0|0)!=0|0))}function Nce(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=lL(p|0,g|0,0)|0,ee()|0,(63-b|0)%3|0|0))||DG(p,m)|0?(b=1,b|0):(b=(KG(p,m)|0)!=0&1,b|0)}function XP(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 $P(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 Dx(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(!(xr(g&127)|0))g=ep(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=ep(7,0,v,((v|0)<0)<<31>>31)|0,v=ee()|0;break e}while(!1);g=ep(7,0,v,((v|0)<0)<<31>>31)|0,g=br(g|0,ee()|0,5,0)|0,g=At(g|0,ee()|0,-5,-1)|0,g=tp(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,!(xr(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 Fce(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,eL(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,tL(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 UG(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 kG(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 Bce(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,O=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=yr(je)|0,!lt)return pt=13,pt|0;if(nu(lt|0,p|0,je|0)|0,Ut=Sa(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(O=tt(E|0,p|0,52)|0,ee()|0,O=O&15,(O|0)<(gt|0)){v=12,pt=27;break e}if((O|0)!=(gt|0)&&(E=E|se,p=p&-15728641|we,O>>>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<O>>>0)}if(j=Vf(E|0,p|0,g|0,_|0)|0,X=ee()|0,M=Ut+(j<<3)|0,O=M,q=h[O>>2]|0,O=h[O+4>>2]|0,!((q|0)==0&(O|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)&(O&-117440513|0)==(p|0)){K=tt(q|0,O|0,56)|0,ee()|0,K=K&7,ae=K+1|0,Be=tt(q|0,O|0,45)|0,ee()|0;n:do if(!(xr(Be&127)|0))O=7;else{if(q=tt(q|0,O|0,52)|0,ee()|0,q=q&15,!q){O=6;break}for(O=1;;){if(Be=ft(7,0,(15-O|0)*3|0)|0,!((Be&E|0)==0&((ee()|0)&p|0)==0)){O=7;break n}if(O>>>0<q>>>0)O=O+1|0;else{O=6;break}}}while(!1);if((K+2|0)>>>0>O>>>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=np(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,O=M,q=h[O>>2]|0,O=h[O+4>>2]|0}while(!((q|0)==0&(O|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=tp(g|0,_|0,6,0)|0,ee()|0,Be=Sa(Be,8)|0,!Be){pt=48;break}do if(Ke){for(ae=0,p=0,K=0,ue=0;;){if(O=Ut+(ae<<3)|0,b=O,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(xr(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=O,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(O=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,O=Me|O,q=ee()|0|q;while(j>>>0<X>>>0)}}else O=N,q=v;K=Vf(O|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)==(O|0)){pt=65;break}Me=At(K|0,ue|0,1,0)|0,K=np(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)==(O|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(ip(Ut|0,0,je|0)|0,nu(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&&(nu(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 Oce(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,O=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,O=tt(M|0,N|0,52)|0,ee()|0,(O&15|0)>(b|0)){E=12,M=11;break}if(eL(K,M,N,b),O=K,N=h[O>>2]|0,O=h[O+4>>2]|0,(N|0)==0&(O|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]=O,M=At(M|0,E|0,1,0)|0,E=ee()|0,tL(K),q=K,N=h[q>>2]|0,O=h[q+4>>2]|0}while(!((N|0)==0&(O|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 Uce(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,O=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,O=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=(Dx(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,O|0,1,0)|0,O=ee()|0,!((O|0)<(g|0)|(O|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 kce(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,52)|0,ee()|0,m&1|0}function ol(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 YP(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0;if(O=tt(p|0,m|0,52)|0,ee()|0,O=O&15,!O)return N=m,O=p,On(N|0),O|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<O>>>0)N=N+1|0;else break}return On(m|0),p|0}function Nm(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 zce(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0;if(O=tt(p|0,m|0,52)|0,ee()|0,O=O&15,!O)return N=m,O=p,On(N|0),O|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<O>>>0)N=N+1|0;else break}return On(m|0),p|0}function ZP(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 Vce(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=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(MG(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,O=h[we+4>>2]|0;;){X=K,K=K+-1|0,p=O-j|0,_=q-j|0,X&1?(x=th(+((p*3|0)-_|0)*.14285714285714285)|0,h[se>>2]=x,p=th(+((_<<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=th(+((p<<1)+_|0)*.14285714285714285)|0,h[se>>2]=E,v=th(+((_*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),_=O+(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,O=(j|0)<0,E=O?0:j,Me=(b?0:M)-(O?j:0)|0,j=(x?0:_)-(b?M:0)-(O?j:0)|0,O=(Me|0)<(j|0)?Me:j,O=(E|0)<(O|0)?E:O,M=(O|0)>0,j=j-(M?O: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?O:0)-Ke|0,Be=(Me|0)<0,Ke=(Be?0-Me|0:0)+(E-(M?O: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,O=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(_=MG(we)|0,p=ft(_|0,0,45)|0,m=p|m,p=ee()|0|g&-1040385,M=cce(we)|0,!(xr(_)|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(CG(_,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=YP(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 mc(p){return p=p|0,(p|0)%2|0|0}function KP(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,O=0,q=0;if(O=Q,Q=Q+64|0,E=O+24|0,M=O+48|0,N=O,m>>>0>15)return N=4,Q=O,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=O,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],Rce(E,m,M),M=Vce(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=O,N|0}function QP(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,O=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,xr(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,O=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,O&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-O|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)),O>>>0<K>>>0;)O=O+1|0;return _|0}function f1(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,O=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((xr(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],!(QP(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,O=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=O+1|0):v=O,!(xr(j)|0))_=0;else{e:do if(!O)_=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<O>>>0)m=m+1|0;else{_=0;break}}while(!1);_=(_|0)==4&1}if(!(h1(g,v,_,0)|0))(v|0)!=(O|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(xr(j)|0)do;while((h1(g,v,0,0)|0)!=0);(v|0)!=(O|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=th(+((_<<1)+p|0)*.14285714285714285)|0,h[X>>2]=m,_=th(+((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 d1(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=f1(p,m,_)|0,x?(Q=b,x|0):(x=tt(p|0,m|0,52)|0,ee()|0,Ice(_,x&15,v),M=+Ix(+ +ie[v+16>>3]),E=+wa(+ +ie[v+8>>3],+ +ie[v>>3]),ie[g>>3]=M,ie[g+8>>3]=E,x=0,Q=b,x|0)}function Fm(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,_=f1(p,m,x)|0,_|0)return x=_,Q=b,x|0;_=tt(p|0,m|0,45)|0,ee()|0,_=(xr(_&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 HP(x,v,0,5,g),E=0,Q=b,E|0}while(!1);return WP(x,v,0,6,g),E=0,Q=b,E|0}function Gce(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,!(xr(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 zG(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,O=0,q=0;q=Q,Q=Q+128|0,N=q+112|0,x=q+96|0,O=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(xr(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,O=ee()|0|m&-15728641,N=ft(7,0,(14-E|0)*3|0)|0,O=zG((M|p)&~N,O&~(ee()|0),g)|0,Q=q,O|0}else v=0;while(!1);if(_=f1(p,m,x)|0,!_){v?(FG(x,N,O),M=5):(BG(x,N,O),M=6);e:do if(xr(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);ip(g|0,-1,p<<2|0)|0;e:do if(v)for(x=0;;){if(b=O+(x<<4)|0,Pce(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=O+(x<<4)|0,h1(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 O=_,Q=q,O|0}function qce(){return 12}function JP(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 xr(_)|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(xr(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 Hce(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,O=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(xr(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(O=tt(q|0,M|0,45)|0,ee()|0,!(xr(O&127)|0))x=0;else{O=tt(q|0,M|0,52)|0,ee()|0,O=O&15;t:do if(!O)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<O>>>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=ep(7,0,N,((N|0)<0)<<31>>31)|0,O=ee()|0,x?(x=br(N|0,O|0,5,0)|0,x=At(x|0,ee()|0,-5,-1)|0,x=tp(x|0,ee()|0,6,0)|0,x=At(x|0,ee()|0,1,0)|0,M=ee()|0):(x=N,M=O),j=q+-1|0,j=br(N|0,O|0,j|0,((j|0)<0)<<31>>31|0)|0,j=At(x|0,M|0,j|0,ee()|0)|0,q=ee()|0,O=_,O=At(j|0,q|0,h[O>>2]|0,h[O+4>>2]|0)|0,q=ee()|0,j=_,h[j>>2]=O,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=ep(7,0,b,((b|0)<0)<<31>>31)|0,v=br(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 Dx(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 Wce(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,O=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(Dx(g,_,v,b)|0&&di(27634,27225,1367,27274),O=b,N=h[O+4>>2]|0,!(((m|0)>-1|(m|0)==-1&p>>>0>4294967295)&((N|0)>(m|0)|((N|0)==(m|0)?(h[O>>2]|0)>>>0>p>>>0:0))))return x=2,Q=q,x|0;O=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(xr(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((O|0)<1)return x=0,Q=q,x|0;for(N=E^15,_=-1,M=1,b=1;;){E=O-M|0,E=ep(7,0,E,((E|0)<0)<<31>>31)|0,g=ee()|0;do if(b)if(b=br(E|0,g|0,5,0)|0,b=At(b|0,ee()|0,-5,-1)|0,b=tp(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),_=tp(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=br(_|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=tp(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=br(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((O|0)>(M|0))_=~M,M=M+1|0;else{m=0;break}}return Q=q,m|0}while(!1);if((O|0)<1)return ae=0,Q=q,ae|0;for(v=E^15,b=1;;)if(K=O-b|0,K=ep(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=tp(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=br(j|0,X|0,K|0,ae|0)|0,p=Js(p|0,m|0,ae|0,ee()|0)|0,m=ee()|0,(O|0)<=(b|0)){m=0;break}else b=b+1|0;return Q=q,m|0}function eL(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=UG(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 VG(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=UG(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 tL(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 Nx(p){p=+p;var m=0;return m=p<0?p+6.283185307179586:p,+(p>=6.283185307179586?m+-6.283185307179586:m)}function Bl(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 jce(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),+(+wa(+ +ys(+g),+ +ys(+(1-g)))*2)}function Fx(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),+(+wa(+ +ys(+g),+ +ys(+(1-g)))*2*6371.007180918475)}function Xce(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),+(+wa(+ +ys(+g),+ +ys(+(1-g)))*2*6371.007180918475*1e3)}function GG(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 $ce(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 Yce(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 Zce(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 WS(p,m){p=p|0,m=m|0;var g=0;return p>>>0>15?(m=4,m|0):(g=ep(7,0,p,((p|0)<0)<<31>>31)|0,g=br(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 Kce(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,O=0;if(E=Q,Q=Q+176|0,b=E,p=Px(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],O=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=O*O+M*(+ii(+_)*+ii(+N)*M),x=x+ +wa(+ +ys(+M),+ +ys(+(1-M)))*2;while((p|0)<(m|0));return ie[g>>3]=x,b=0,Q=E,b|0}function Qce(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,O=0;if(E=Q,Q=Q+176|0,b=E,p=Px(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],O=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=O*O+M*(+ii(+N)*+ii(+_)*M),x=x+ +wa(+ +ys(+M),+ +ys(+(1-M)))*2;while((p|0)!=(m|0));return ie[g>>3]=x,b=0,O=x,O=O*6371.007180918475,ie[g>>3]=O,Q=E,b|0}function Jce(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,O=0;if(E=Q,Q=Q+176|0,b=E,p=Px(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],O=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=O*O+M*(+ii(+N)*+ii(+_)*M),x=x+ +wa(+ +ys(+M),+ +ys(+(1-M)))*2;while((p|0)!=(m|0));return ie[g>>3]=x,b=0,O=x,O=O*6371.007180918475,O=O*1e3,ie[g>>3]=O,Q=E,b|0}function eue(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 tue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=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=Sa(1,12)|0,!g){g=5;break}h[p+8>>2]=g,p=g}if(M=h[K>>2]|0,N=Sa(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=yr(24)|0,!b){p=13,g=37;break e}cL(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){O=M+(X<<4)+12|0,M=0;do{if(_=h[O>>2]|0,g=N,N=Sa(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=yr(24)|0,!x){p=13,g=37;break e}cL(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 Bx(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,O=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,O=tt(p|0,m|0,52)|0,ee()|0,O=O&15,X=tt(g|0,_|0,52)|0,ee()|0,(O|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=VP(M,N)|0,(b|0)==7)return ue=1,Q=xe,ue|0;E=VP(N,M)|0,(E|0)==7?di(27291,27315,164,27325):(ae=b,x=E)}else ae=0,x=0;q=xr(M)|0,j=xr(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=zce(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=ZP(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(QP(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=ol(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=ol(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),O)for(;;)if(M=x*3|0,N=E*3|0,g=b*3|0,mc(O)|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,(O|0)>1)O=O+-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,O=ue+8|0,ae=h[O>>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[O>>2]=E,x=se+b|0,h[_>>2]=x,b=E-M|0,(M|0)<0?(x=x-M|0,h[O>>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[O>>2]=0,b=0),N=E-x|0,M=b-x|0,(x|0)<0?(h[g>>2]=N,h[O>>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[O>>2]=M-b,h[_>>2]=x-b),K=77}else x=5}else if(QP(g,_,ue)|0,(q|0)!=0&(j|0)!=0)if((N|0)!=(M|0)&&di(27398,27315,264,27325),b=ol(p,m)|0,x=ol(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){O=ue+4|0,_=ue+8|0,q=ue+12|0,N=0,E=h[O>>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[O>>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 qG(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,O=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=xr(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=zP(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,mc(ae)|0){if(M){if(O=(K|0)>0,q=2147483647-K|0,j=-2147483648-K|0,O?(q|0)<(K|0):(j|0)>(K|0)){v=1,se=107;break}if(be=K<<1,O?(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,(O?(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=th(+(M-X|0)*.14285714285714285)|0,O=th(+(N+K|0)*.14285714285714285)|0,N=(O|0)<(q|0),M=N?q:O,N=N?O: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=O-(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,O=(q|0)<0,Me=O?0:q,N=(M?0:be)-(O?q:0)|0,q=(Be?0:Ke)-(M?be:0)-(O?q:0)|0,O=(N|0)<(q|0)?N:q,O=(Me|0)<(O|0)?Me:O,be=(O|0)>0,M=be?O:0,N=N-(be?O:0)|0,O=Me-(be?O: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,O=(X|0)>0,O?(2147483647-X|0)<(X|0):(-2147483648-X|0)>(X|0)){v=1,se=107;break}if(j=X<<1,O?(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=th(+(M+X|0)*.14285714285714285)|0,O=th(+(N-K|0)*.14285714285714285)|0,N=(O|0)<(q|0),M=N?q:O,N=N?O: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=O-(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,O=(q|0)<0,Ke=O?0:q,N=(M?0:Be)-(O?q:0)|0,q=(be?0:Me)-(M?Be:0)-(O?q:0)|0,O=(N|0)<(q|0)?N:q,O=(Ke|0)<(O|0)?Ke:O,Be=(O|0)>0,M=Be?O:0,N=N-(Be?O:0)|0,O=Ke-(Be?O:0)|0}M=b+(M-q)|0,Me=(M|0)<0,N=E-N-(Me?M:0)|0,q=(N|0)<0,Be=g-O+(Me?0-M|0:0)+(q?0-N|0:0)|0,b=(Be|0)<0,O=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=(O|0)<(b|0)?O: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)+(O-(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=zP(Ae,x)|0,(E|0)==127?N=0:N=xr(E)|0;e:do if(x){if(ue){if(g=ol(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=zP(Ae,g)|0,(x|0)==127&&di(27476,27315,415,27506),xr(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=Nm(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=Nm(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=VP(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=Nm(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=ol(x,g)|0,(g|0)==7&&di(27634,27315,444,27506),x=kP(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=YP(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=ol(p,m)|0,g=_,g=ol(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=Nm(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=_,(ol(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 nue(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=Bx(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 iue(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,O=0,q=0;return q=Q,Q=Q+16|0,O=q,_|0?(O=15,Q=q,O|0):(E=h[g>>2]|0,b=h[g+4>>2]|0,h[O>>2]=E,M=O+4|0,h[M>>2]=b,N=O+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[O>>2]=0,E=0):(_=b,x=0),b=E-_|0,g=x-_|0,(_|0)<0?(h[O>>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[O>>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[O>>2]=b-_,h[M>>2]=x-_,h[N>>2]=g-_),_=qG(p,m,O,v)|0),O=_,Q=q,O|0)}function nL(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=Bx(p,m,p,m,b)|0,x|0?(E=x,Q=M,E|0):(p=Bx(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 rue(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=nL(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 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;return M=Q,Q=Q+16|0,x=M,b=nL(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=HG(p,m,g,_,x,b,v,0,0,1,0)|0,E?(v=(HG(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 HG(p,m,g,_,v,x,b,E,M,N,O){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,O=O|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,Bx(p,m,p,m,q)|0&&di(27634,27315,696,27575),Bx(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,_=~~+JS(+lt),q=~~+JS(+X),g=~~+JS(+K),lt=+Ks(+(+(_|0)-lt)),X=+Ks(+(+(q|0)-X)),K=+Ks(+(+(g|0)-K)),lt>X<>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=br(xe|0,se|0,N|0,O|0)|0,g=At(g|0,ee()|0,E|0,M|0)|0,ee()|0,g=qG(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 ep(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=br((b?1:x)|0,(b?0:v)|0,p|0,m|0)|0,m=ee()|0,g=rq(g|0,_|0,1)|0,_=ee()|0,x=br(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 iL(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,O=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=d1(p,m,x)|0,!v){N=+ie[x>>3],M=1/+ii(+N),O=+ie[26032+(b<<3)>>3],ie[g>>3]=N+O,ie[g+8>>3]=N-O,N=+ie[x+8>>3],M=O*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 _ce(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,O=0;N=Q,Q=Q+48|0,b=N+32|0,x=N+40|0,E=N,XP(b,0,0,0),M=h[b>>2]|0,b=h[b+4>>2]|0;do if(g>>>0<=15){if(v=Ux(_)|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=Sa((h[m+8>>2]|0)+1|0,32)|0,v){rL(m,v),O=E,h[O>>2]=M,h[O+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,O=E+29|0,h[M>>2]=0,h[M+4>>2]=0,h[M+8>>2]=0,He[M+12>>0]=0,He[O>>0]=He[x>>0]|0,He[O+1>>0]=He[x+1>>0]|0,He[O+2>>0]=He[x+2>>0]|0;while(!1);jS(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 jS(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=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=WG(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,O=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(O&15){case 0:case 2:case 3:{if(v=d1(g,_,X)|0,v|0){ue=15;break t}if(sL(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],RG(26896,X)|0)){if(KP(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=Fm(g,_,X)|0,v|0){ue=32;break}if(iL(g,_,K,0)|0){ue=36;break}if(b&&XG(h[we>>2]|0,h[j>>2]|0,X,K)|0){ue=42;break}if(M&&$G(h[we>>2]|0,h[j>>2]|0,X,K)|0){ue=42;break}}if(q){if(m=iL(g,_,X,1)|0,v=h[j>>2]|0,m|0){ue=45;break}if(GP(v,X)|0){if(PG(K,X),IG(X,h[j>>2]|0)|0){ue=53;break}if(sL(h[we>>2]|0,h[j>>2]|0,E)|0){ue=53;break}if($G(h[we>>2]|0,h[j>>2]|0,K,X)|0){ue=53;break}}}}do if((x|0)<(h[ae>>2]|0)){if(m=iL(g,_,X,1)|0,v=h[j>>2]|0,m|0){ue=58;break t}if(!(GP(v,X)|0)){ue=73;break}if(IG(h[j>>2]|0,X)|0&&(PG(K,X),XG(h[we>>2]|0,h[j>>2]|0,K,X)|0)){ue=65;break t}if(g=kG(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=WG(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 WG(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0;q=Q,Q=Q+16|0,O=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 O=(M|0)==0&(Zi(g,v)|0)!=0,O=ft((O?2:1)+M|0,0,x|0)|0,N=ee()|0|m&~E,O=O|p&~b,On(N|0),Q=q,O|0}while(!1);return g=g&127,g>>>0>120?(N=0,O=0,On(N|0),Q=q,O|0):(XP(O,0,g+1|0,0),N=h[O+4>>2]|0,O=h[O>>2]|0,On(N|0),Q=q,O|0)}function aue(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,O=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,eL(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,O=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,tL(j),p=j,m=h[p>>2]|0,p=h[p+4>>2]|0,(m|0)==0&(p|0)==0){if(jS(g),m=g,p=h[m>>2]|0,m=h[m+4>>2]|0,(p|0)==0&(m|0)==0){K=10;break}VG(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[O>>2]=0,h[ae+36>>2]=0,h[q>>2]=-1,h[ae+32>>2]=0,h[p>>2]=0,VG(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[O>>2]),ae=h[X>>2]|0,Q=ue,ae|0)}function lue(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,O=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 O=_,h[O>>2]=0,h[O+4>>2]=0,O=0,Q=q,O|0;XP(M,0,0,0),b=M,v=h[b>>2]|0,b=h[b+4>>2]|0;do if(m>>>0>15)O=N,h[O>>2]=0,h[O+4>>2]=0,h[N+8>>2]=4,h[N+12>>2]=-1,O=N+16|0,g=N+29|0,h[O>>2]=0,h[O+4>>2]=0,h[O+8>>2]=0,He[O+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,O=9;else{if(g=Ux(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,O=N+29|0,h[M>>2]=0,h[M+4>>2]=0,h[M+8>>2]=0,He[M+12>>0]=0,He[O>>0]=He[E>>0]|0,He[O+1>>0]=He[E+1>>0]|0,He[O+2>>0]=He[E+2>>0]|0,O=9;break}if(g=Sa((h[p+8>>2]|0)+1|0,32)|0,!g){O=N,h[O>>2]=0,h[O+4>>2]=0,h[N+8>>2]=13,h[N+12>>2]=-1,O=N+16|0,g=N+29|0,h[O>>2]=0,h[O+4>>2]=0,h[O+8>>2]=0,He[O+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,O=9;break}rL(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=+Ace(g),j=j*+pce(g),x=+Ks(+ +ie[g>>3]),x=j/+ii(+ +QS(+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(GG(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(jS(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 Dx(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,jS(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 Ox(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,O=0,q=0,j=0;if(!(RG(m,g)|0)||(m=mce(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,O=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,O=E==O|b==O?O+-2220446049250313e-31:O,M=E+(b-E)*((_-x)/(M-x)),(M<0?M+6.283185307179586:M)>O&&(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,O=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(O=b==O|v==O?O+-2220446049250313e-31:O,b+(v-b)*((_-x)/(M-x))>O&&(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 jG(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=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,O=-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,O=E<0&E>O?E:O,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]=O,ie[ue>>3]=N)}}function Ux(p){return p=p|0,(p>>>0<4?0:15)|0}function rL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=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],O=+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),O<N&&(ie[ue>>3]=O,N=O),x>q?ie[m>>3]=x:x=q,O>b&&(ie[xe>>3]=O,b=O),j=O>0&O<j?O:j,X=O<0&O>X?O:X,_=_|+Ks(+(O-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,O=-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>O?ie[ue>>3]=x:x=O,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=_,O=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 sL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if(!(Ox(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,Ox((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 XG(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,O=0;if(N=Q,Q=Q+16|0,E=N,b=g+8|0,!(Ox(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(O=v,v=v+1|0,Ox((h[x>>2]|0)+(O<<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(XS(p,m,g,_)|0)return O=0,Q=N,O|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(Ox(E,_,h[v+(b<<3)+4>>2]|0)|0){v=0;break e}if(v=b+1|0,XS((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 O=v,Q=N,O|0}function XS(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,O=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,!(GP(m,_)|0))return p=0,Q=Ke,p|0;if(gce(m,_,se,v),nu(we|0,g|0,168)|0,(h[g>>2]|0)>0){m=0;do Me=we+8+(m<<4)+8|0,xe=+Bl(+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=+Bl(+ie[_+16>>3],h[v>>2]|0),X=+Bl(+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=+Bl(+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=+Bl(+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,O=q*b-N*M,O!=0&&(Ae=K-x,Be=j-E,M=(Ae*M-b*Be)/O,!(M<0|M>1))&&(O=(q*Ae-N*Be)/O,O>=0&O<=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 $G(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;if(XS(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,XS((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 cue(){return 8}function uue(){return 16}function hue(){return 168}function fue(){return 8}function due(){return 16}function pue(){return 12}function mue(){return 8}function Aue(p){return p=p|0,+(+((h[p>>2]|0)>>>0)+4294967296*+(h[p+4>>2]|0))}function gue(p){p=p|0;var m=0,g=0;return g=+ie[p>>3],m=+ie[p+8>>3],+ +ys(+(g*g+m*m))}function YG(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,O=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],O=+ie[_+8>>3]-j,x=(x*(E-j)-(N-q)*O)/(M*O-b*x),ie[v>>3]=N+M*x,ie[v+8>>3]=E+b*x}function ZG(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 vue(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(kx(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 kx(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,O=0;if(O=Q,Q=Q+32|0,E=O+16|0,M=O,_=f1(p,m,E)|0,_|0)return g=_,Q=O,g|0;x=OG(p,m)|0,N=ol(p,m)|0,uce(x,M),_=hce(x,h[E>>2]|0)|0;do if(xr(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=kP(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=O,g|0}function Ac(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,O=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,O=tt(p|0,m|0,52)|0,ee()|0,O=O&15,M>>>0<=g>>>0)return _=2,Q=we,_|0;q=(O|0)==0,!q&&(ae=ft(7,0,(O^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)||kx(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,(O^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),kx(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=GS(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(kx(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=GS(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(kx(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 _ue(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,_=Ac(p,m,0,g)|0,v=(_|0)==0,x?!v||(_=Ac(p,m,1,g+8|0)|0,_|0)||(_=Ac(p,m,2,g+16|0)|0,_|0)||(_=Ac(p,m,3,g+24|0)|0,_|0)||(_=Ac(p,m,4,g+32|0)|0,_)?(x=_,x|0):Ac(p,m,5,g+40|0)|0:!v||(_=Ac(p,m,1,g+8|0)|0,_|0)||(_=Ac(p,m,2,g+16|0)|0,_|0)||(_=Ac(p,m,3,g+24|0)|0,_|0)||(_=Ac(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 xue(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,_=f1(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?HP(x,m,b,1,v):WP(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 KG(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,!(HS(p,_)|0))?(_=0,Q=v,_|0):(x=tt(p|0,m|0,56)|0,ee()|0,x=(Ac(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 QG(){return 27680}function $S(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,O=0,q=0,j=0;q=Q,Q=Q+208|0,M=q,N=q+192|0,b=sl(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?oL(p,g,_,v,M):ZS(p,g,_,N,v,0,M),(v|0)==1){KS(N,1),v=0;break}else{KS(N,m),v=1;break}else oL(p,g,_,v,M),YS(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(ZS(p,g,_,N,v,0,M),x=N+4|0;;){if((v|0)==1&(m|0)==1)if(h[x>>2]|0)O=19;else break e;else(v|0)<2?O=19:(KS(N,2),j=v+-2|0,h[N>>2]=h[N>>2]^7,YS(N,1),ZS(p+(0-(h[M+(j<<2)>>2]|0))+E|0,g,_,N,v+-1|0,1,M),KS(N,1),m=h[N>>2]|1,h[N>>2]=m,p=p+E|0,ZS(p,g,_,N,j,1,M),v=j);(O|0)==19&&(O=0,m=JG(N)|0,YS(N,m),p=p+E|0,v=m+v|0,m=h[N>>2]|0)}}while(!1);Q=q}function oL(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,O=0,q=0;q=Q,Q=Q+240|0,O=q,h[O>>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,(sp[g&3](b,p)|0)>-1&&(sp[g&3](b,E)|0)>-1||(b=O+(_<<2)|0,(sp[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[O>>2]|0}else _=1;while(!1);tq(m,O,_),Q=q}function YS(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 ZS(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,O=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&&(O=0-m|0,E=p+(0-(h[b+(v<<2)>>2]|0))|0,(sp[g&3](E,p)|0)>=1))for(_=1,x=(x|0)==0,M=E;;){if(x&(v|0)>1){if(x=p+O|0,E=h[b+(v+-2<<2)>>2]|0,(sp[g&3](x,M)|0)>-1){E=10;break e}if((sp[g&3](x+(0-E)|0,M)|0)>-1){E=10;break e}}if(x=_+1|0,h[j+(_<<2)>>2]=M,K=JG(q)|0,YS(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,(sp[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&&(tq(m,j,_),oL(p,m,g,v,b)),Q=X}function KS(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 JG(p){p=p|0;var m=0;return m=eq((h[p>>2]|0)+-1|0)|0,m?m|0:(m=eq(h[p+4>>2]|0)|0,((m|0)==0?0:m+32|0)|0)}function eq(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 tq(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,nu(_|0,h[m>>2]|0,v|0)|0,_=0;do E=m+(_<<2)|0,_=_+1|0,nu(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 th(p){return p=+p,~~+oq(+p)|0}function yr(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=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(O=h[6923]|0,N>>>0>O>>>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,O|0&&(_=h[6926]|0,m=O>>>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,O|0&&(_=h[6926]|0,m=O>>>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&&(O=E+N|0,O>>>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[O+4>>2]=b|1,h[O+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]=O,h[m+12>>2]=O,h[O+8>>2]=m,h[O+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[O+28>>2]=g,p=O+16|0,h[p+4>>2]=0,h[p>>2]=0,p=1<<g,!(_&p)){h[6922]=_|p,h[m>>2]=O,h[O+24>>2]=m,h[O+12>>2]=O,h[O+8>>2]=O;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]=O,h[O+24>>2]=m,h[O+12>>2]=O,h[O+8>>2]=O;break e}while(!1);we=m+8|0,Ae=h[we>>2]|0,h[Ae+12>>2]=O,h[we>>2]=O,h[O+8>>2]=Ae,h[O+12>>2]=m,h[O+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&&(O=h[7029]|0,j=O+N|0,j>>>0<=O>>>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=rp(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=rp(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=rp(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((rp(p|0)|0)==-1){rp(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=rp(N|0)|0,K=rp(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,O=m+4|0,h[O>>2]=(h[O>>2]|0)+b,O=x+8|0,O=x+((O&7|0)==0?0:0-O&7)|0,m=g+8|0,m=g+((m&7|0)==0?0:0-m&7)|0,N=O+q|0,E=m-O-q|0,h[O+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=O+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=QG()|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 Sa(p,m){p=p|0,m=m|0;var g=0;return p?(g=sl(m,p)|0,(m|p)>>>0>65535&&(g=((g>>>0)/(p>>>0)|0|0)==(m|0)?g:-1)):g=0,p=yr(g)|0,!p||!(h[p+-4>>2]&3)||ip(p|0,0,g|0)|0,p|0}function yue(p,m){p=p|0,m=m|0;var g=0,_=0;return p?m>>>0>4294967231?(m=QG()|0,h[m>>2]=12,m=0,m|0):(g=bue(p+-8|0,m>>>0<11?16:m+11&-8)|0,g|0?(m=g+8|0,m|0):(g=yr(m)|0,g?(_=h[p+-4>>2]|0,_=(_&-8)-((_&3|0)==0?8:4)|0,nu(g|0,p|0,(_>>>0<m>>>0?_:m)|0)|0,_t(p),m=g,m|0):(m=0,m|0))):(m=yr(m)|0,m|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,O=0,q=0;if(O=p+4|0,q=h[O>>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[O>>2]=q&1|m|2,h[N+4>>2]=g|3,q=E+4|0,h[q>>2]=h[q>>2]|1,nq(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[O>>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[O>>2]=q&1|m|2,h[N+4>>2]=g|1,h[_>>2]=g,_=_+4|0,h[_>>2]=h[_>>2]&-2,_=N):(h[O>>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[O>>2]=q&1|M|2,q=p+M+4|0,h[q>>2]=h[q>>2]|1,p|0):(E=p+m|0,h[O>>2]=q&1|m|2,h[E+4>>2]=N|3,q=p+M+4|0,h[q>>2]=h[q>>2]|1,nq(E,N),p|0)}function nq(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 iq(p){return p=p|0,(p?31-(zf(p^p-1)|0)|0:32)|0}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,O=0,q=0,j=0,X=0,K=0;if(O=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]=(O>>>0)%(b>>>0),h[v+4>>2]=0),j=0,v=(O>>>0)/(b>>>0)>>>0,On(j|0),v|0);x=(E|0)==0;do if(b){if(!x){if(x=(zf(E|0)|0)-(zf(N|0)|0)|0,x>>>0<=31){q=x+1|0,E=31-x|0,m=x-31>>31,b=q,p=O>>>(q>>>0)&m|N<<E,m=N>>>(q>>>0)&m,x=0,E=O<<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=(zf(b|0)|0)+33-(zf(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|O>>>(E>>>0))&m,m=m&N>>>(E>>>0),x=O<<K&M,E=(N<<K|O>>>(X>>>0))&M|O<<q&E-33>>31;break}return v|0&&(h[v>>2]=x&O,h[v+4>>2]=0),(b|0)==1?(X=M|m&0,K=p|0|0,On(X|0),K|0):(K=iq(b|0)|0,X=N>>>(K>>>0)|0,K=N<<32-K|O>>>(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(!O)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>>>((iq(E|0)|0)>>>0),On(X|0),K|0;if(x=(zf(E|0)|0)-(zf(N|0)|0)|0,x>>>0<=30){m=x+1|0,E=31-x|0,b=m,p=N<<E|O>>>(m>>>0),m=N>>>(m>>>0),x=0,E=O<<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,O=j|_&0,N=At(q|0,O|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)&O|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 tp(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((aL(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 wue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return x=p&65535,v=m&65535,g=sl(v,x)|0,_=p>>>16,p=(g>>>16)+(sl(v,_)|0)|0,v=m>>>16,m=sl(v,x)|0,On((p>>>16)+(sl(v,_)|0)+(((p&65535)+m|0)>>>16)|0),p+m<<16|g&65535|0|0}function br(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;return v=p,x=g,g=wue(v,x)|0,p=ee()|0,On((sl(m,x)|0)+(sl(_,v)|0)+p|p&0|0),g|0|0|0}function np(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,aL(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 Vf(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,aL(p,m,g,_,v)|0,Q=x,On(h[v+4>>2]|0),h[v>>2]|0|0}function rq(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 lL(p,m,g){return p=p|0,m=m|0,g=g|0,m=zf(m)|0,(m|0)==32&&(m=m+(zf(p)|0)|0),On(0),m|0}function sq(p,m){return p=+p,m=+m,p!=p?+m:m!=m?+p:+qle(+p,+m)}function QS(p,m){return p=+p,m=+m,p!=p?+m:m!=m?+p:+UP(+p,+m)}function JS(p){return p=+p,p>=0?+ho(p+.5):+u1(p-.5)}function nu(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if((g|0)>=8192)return jle(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 cL(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 nu(p,m,g)|0;return p|0}function ip(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 oq(p){return p=+p,p>=0?+ho(p+.5):+u1(p-.5)}function rp(p){p=p|0;var m=0,g=0,_=0;return _=Wle()|0,g=h[rl>>2]|0,m=g+p|0,(p|0)>0&(m|0)<(g|0)|(m|0)<0?($le(m|0)|0,yG(12),-1):(m|0)>(_|0)&&!(Xle(m|0)|0)?(yG(12),-1):(h[rl>>2]=m,g|0)}function Sue(p,m,g){return p=p|0,m=m|0,g=g|0,sp[p&3](m|0,g|0)|0}function Tue(p,m){return p=p|0,m=m|0,Hle(0),0}var sp=[Tue,yce,bce,wce];return{___divdi3:tp,___muldi3:br,___remdi3:np,___uremdi3:Vf,_areNeighborCells:Sce,_bitshift64Ashr:rq,_bitshift64Lshr:tt,_bitshift64Shl:ft,_calloc:Sa,_cellAreaKm2:ace,_cellAreaM2:lce,_cellAreaRads2:oce,_cellToBoundary:Fm,_cellToCenterChild:kG,_cellToChildPos:Hce,_cellToChildren:Fce,_cellToChildrenSize:Dx,_cellToLatLng:d1,_cellToLocalIj:nue,_cellToParent:$P,_cellToVertex:Ac,_cellToVertexes:_ue,_cellsToDirectedEdge:Tce,_cellsToLinkedMultiPolygon:sce,_childPosToCell:Wce,_compactCells:Bce,_constructCell:Dce,_destroyLinkedMultiPolygon:eue,_directedEdgeToBoundary:Px,_directedEdgeToCells:Cce,_edgeLengthKm:Qce,_edgeLengthM:Jce,_edgeLengthRads:Kce,_emscripten_replace_memory:Yle,_free:_t,_getBaseCellNumber:OG,_getDirectedEdgeDestination:Mce,_getDirectedEdgeOrigin:Ece,_getHexagonAreaAvgKm2:GG,_getHexagonAreaAvgM2:$ce,_getHexagonEdgeLengthAvgKm:Yce,_getHexagonEdgeLengthAvgM:Zce,_getIcosahedronFaces:zG,_getIndexDigit:Lce,_getNumCells:WS,_getPentagons:JP,_getRes0Cells:dce,_getResolution:jP,_greatCircleDistanceKm:Fx,_greatCircleDistanceM:Xce,_greatCircleDistanceRads:jce,_gridDisk:bG,_gridDiskDistances:wG,_gridDistance:nL,_gridPathCells:sue,_gridPathCellsSize:rue,_gridRing:tce,_gridRingUnsafe:TG,_i64Add:At,_i64Subtract:Js,_isPentagon:Zi,_isResClassIII:kce,_isValidCell:HS,_isValidDirectedEdge:DG,_isValidIndex:Nce,_isValidVertex:KG,_latLngToCell:KP,_llvm_ctlz_i64:lL,_llvm_maxnum_f64:sq,_llvm_minnum_f64:QS,_llvm_round_f64:JS,_localIjToCell:iue,_malloc:yr,_maxFaceCount:Gce,_maxGridDiskSize:ece,_maxPolygonToCellsSize:ice,_maxPolygonToCellsSizeExperimental:lue,_memcpy:nu,_memmove:cL,_memset:ip,_originToDirectedEdges:qP,_pentagonCount:qce,_polygonToCells:rce,_polygonToCellsExperimental:aue,_readInt64AsDoubleFromPointer:Aue,_res0CellCount:fce,_reverseDirectedEdge:NG,_round:oq,_sbrk:rp,_sizeOfCellBoundary:hue,_sizeOfCoordIJ:mue,_sizeOfGeoLoop:fue,_sizeOfGeoPolygon:due,_sizeOfH3Index:cue,_sizeOfLatLng:uue,_sizeOfLinkedGeoPolygon:pue,_uncompactCells:Oce,_uncompactCellsSize:Uce,_vertexToLatLng:xue,dynCall_iii:Sue,establishStackSpace:Jle,stackAlloc:Zle,stackRestore:Qle,stackSave:Kle}})(Bt,ut,W),Yt=e.___divdi3=Ce.___divdi3,nr=e.___muldi3=Ce.___muldi3,Fn=e.___remdi3=Ce.___remdi3,ns=e.___uremdi3=Ce.___uremdi3,Pr=e._areNeighborCells=Ce._areNeighborCells,Ll=e._bitshift64Ashr=Ce._bitshift64Ashr,ba=e._bitshift64Lshr=Ce._bitshift64Lshr,Dl=e._bitshift64Shl=Ce._bitshift64Shl,nl=e._calloc=Ce._calloc,_r=e._cellAreaKm2=Ce._cellAreaKm2,Zs=e._cellAreaM2=Ce._cellAreaM2,Nl=e._cellAreaRads2=Ce._cellAreaRads2,Ju=e._cellToBoundary=Ce._cellToBoundary,kS=e._cellToCenterChild=Ce._cellToCenterChild,IP=e._cellToChildPos=Ce._cellToChildPos,PP=e._cellToChildren=Ce._cellToChildren,Cx=e._cellToChildrenSize=Ce._cellToChildrenSize,LP=e._cellToLatLng=Ce._cellToLatLng,Rx=e._cellToLocalIj=Ce._cellToLocalIj,DP=e._cellToParent=Ce._cellToParent,NP=e._cellToVertex=Ce._cellToVertex,fG=e._cellToVertexes=Ce._cellToVertexes,dG=e._cellsToDirectedEdge=Ce._cellsToDirectedEdge,pG=e._cellsToLinkedMultiPolygon=Ce._cellsToLinkedMultiPolygon,mG=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,on=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,is=e._getHexagonAreaAvgM2=Ce._getHexagonAreaAvgM2,Gr=e._getHexagonEdgeLengthAvgKm=Ce._getHexagonEdgeLengthAvgKm,ir=e._getHexagonEdgeLengthAvgM=Ce._getHexagonEdgeLengthAvgM,Eo=e._getIcosahedronFaces=Ce._getIcosahedronFaces,Zt=e._getIndexDigit=Ce._getIndexDigit,il=e._getNumCells=Ce._getNumCells,yi=e._getPentagons=Ce._getPentagons,Fl=e._getRes0Cells=Ce._getRes0Cells,tu=e._getResolution=Ce._getResolution,Of=e._greatCircleDistanceKm=Ce._greatCircleDistanceKm,Pm=e._greatCircleDistanceM=Ce._greatCircleDistanceM,rr=e._greatCircleDistanceRads=Ce._greatCircleDistanceRads,rs=e._gridDisk=Ce._gridDisk,Uf=e._gridDiskDistances=Ce._gridDiskDistances,pr=e._gridDistance=Ce._gridDistance,kf=e._gridPathCells=Ce._gridPathCells,Lm=e._gridPathCellsSize=Ce._gridPathCellsSize,FP=e._gridRing=Ce._gridRing,y6e=e._gridRingUnsafe=Ce._gridRingUnsafe,b6e=e._i64Add=Ce._i64Add,w6e=e._i64Subtract=Ce._i64Subtract,S6e=e._isPentagon=Ce._isPentagon,T6e=e._isResClassIII=Ce._isResClassIII,E6e=e._isValidCell=Ce._isValidCell,M6e=e._isValidDirectedEdge=Ce._isValidDirectedEdge,C6e=e._isValidIndex=Ce._isValidIndex,R6e=e._isValidVertex=Ce._isValidVertex,I6e=e._latLngToCell=Ce._latLngToCell,P6e=e._llvm_ctlz_i64=Ce._llvm_ctlz_i64,L6e=e._llvm_maxnum_f64=Ce._llvm_maxnum_f64,D6e=e._llvm_minnum_f64=Ce._llvm_minnum_f64,N6e=e._llvm_round_f64=Ce._llvm_round_f64,F6e=e._localIjToCell=Ce._localIjToCell,B6e=e._malloc=Ce._malloc,O6e=e._maxFaceCount=Ce._maxFaceCount,U6e=e._maxGridDiskSize=Ce._maxGridDiskSize,k6e=e._maxPolygonToCellsSize=Ce._maxPolygonToCellsSize,z6e=e._maxPolygonToCellsSizeExperimental=Ce._maxPolygonToCellsSizeExperimental,V6e=e._memcpy=Ce._memcpy,G6e=e._memmove=Ce._memmove,q6e=e._memset=Ce._memset,H6e=e._originToDirectedEdges=Ce._originToDirectedEdges,W6e=e._pentagonCount=Ce._pentagonCount,j6e=e._polygonToCells=Ce._polygonToCells,X6e=e._polygonToCellsExperimental=Ce._polygonToCellsExperimental,$6e=e._readInt64AsDoubleFromPointer=Ce._readInt64AsDoubleFromPointer,Y6e=e._res0CellCount=Ce._res0CellCount,Z6e=e._reverseDirectedEdge=Ce._reverseDirectedEdge,K6e=e._round=Ce._round,Q6e=e._sbrk=Ce._sbrk,J6e=e._sizeOfCellBoundary=Ce._sizeOfCellBoundary,e8e=e._sizeOfCoordIJ=Ce._sizeOfCoordIJ,t8e=e._sizeOfGeoLoop=Ce._sizeOfGeoLoop,n8e=e._sizeOfGeoPolygon=Ce._sizeOfGeoPolygon,i8e=e._sizeOfH3Index=Ce._sizeOfH3Index,r8e=e._sizeOfLatLng=Ce._sizeOfLatLng,s8e=e._sizeOfLinkedGeoPolygon=Ce._sizeOfLinkedGeoPolygon,o8e=e._uncompactCells=Ce._uncompactCells,a8e=e._uncompactCellsSize=Ce._uncompactCellsSize,l8e=e._vertexToLatLng=Ce._vertexToLatLng,c8e=e.establishStackSpace=Ce.establishStackSpace,AG=e.stackAlloc=Ce.stackAlloc,zle=e.stackRestore=Ce.stackRestore,Vle=e.stackSave=Ce.stackSave,u8e=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 BP=function(Le){Le.byteLength&&(Le=new Uint8Array(Le)),H.set(Le,A),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,zn("memory initializer")},gG=function(){a(le,BP,function(){throw"could not load memory initializer "+le})},vG=St(le);if(vG)BP(vG.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),gG();return}}BP(it)};e.memoryInitializerRequest.response?setTimeout(_G,0):e.memoryInitializerRequest.addEventListener("load",_G)}else gG()}}var zS;ve=function Le(){zS||OP(),zS||(ve=Le)};function OP(Le){if(Le=Le||r,tn>0||(It(),tn>0))return;function it(){zS||(zS=!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=OP;function Dm(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=Dm,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return OP(),i})(typeof Ai=="object"?Ai:{}),En="number",Sn=En,E_=En,Cn=En,Rn=En,bo=En,jt=En,Zwe=[["sizeOfH3Index",En],["sizeOfLatLng",En],["sizeOfCellBoundary",En],["sizeOfGeoLoop",En],["sizeOfGeoPolygon",En],["sizeOfLinkedGeoPolygon",En],["sizeOfCoordIJ",En],["readInt64AsDoubleFromPointer",En],["isValidCell",E_,[Cn,Rn]],["isValidIndex",E_,[Cn,Rn]],["latLngToCell",Sn,[En,En,bo,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,bo,En,jt]],["polygonToCells",Sn,[jt,bo,En,jt]],["maxPolygonToCellsSizeExperimental",Sn,[jt,bo,En,jt]],["polygonToCellsExperimental",Sn,[jt,bo,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,bo]],["uncompactCellsSize",Sn,[jt,En,En,bo,jt]],["isPentagon",E_,[Cn,Rn]],["isResClassIII",E_,[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,bo,jt]],["cellToChildren",Sn,[Cn,Rn,bo,jt]],["cellToCenterChild",Sn,[Cn,Rn,bo,jt]],["cellToChildrenSize",Sn,[Cn,Rn,bo,jt]],["cellToChildPos",Sn,[Cn,Rn,bo,jt]],["childPosToCell",Sn,[En,En,Cn,Rn,bo,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",E_,[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,[bo,jt]],["getHexagonAreaAvgKm2",Sn,[bo,jt]],["getHexagonEdgeLengthAvgM",Sn,[bo,jt]],["getHexagonEdgeLengthAvgKm",Sn,[bo,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,[bo,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",E_,[Cn,Rn]]],Kwe=0,Qwe=1,Jwe=2,eSe=3,GJ=4,tSe=5,nSe=6,iSe=7,rSe=8,sSe=9,oSe=10,aSe=11,lSe=12,cSe=13,uSe=14,hSe=15,fSe=16,dSe=17,pSe=18,mSe=19,Cs={};Cs[Kwe]="Success";Cs[Qwe]="The operation failed but a more specific error is not available";Cs[Jwe]="Argument was outside of acceptable range";Cs[eSe]="Latitude or longitude arguments were outside of acceptable range";Cs[GJ]="Resolution argument was outside of acceptable range";Cs[tSe]="Cell argument was not valid";Cs[nSe]="Directed edge argument was not valid";Cs[iSe]="Undirected edge argument was not valid";Cs[rSe]="Vertex argument was not valid";Cs[sSe]="Pentagon distortion was encountered";Cs[oSe]="Duplicate input";Cs[aSe]="Cell arguments were not neighbors";Cs[lSe]="Cell arguments had incompatible resolutions";Cs[cSe]="Memory allocation failed";Cs[uSe]="Bounds of provided memory were insufficient";Cs[hSe]="Mode or flags argument was not valid";Cs[fSe]="Index argument was not valid";Cs[dSe]="Base cell number was outside of acceptable range";Cs[pSe]="Child indexing digits invalid";Cs[mSe]="Child indexing digits refer to a deleted subsequence";var ASe=1e3,qJ=1001,HJ=1002,XC={};XC[ASe]="Unknown unit";XC[qJ]="Array length out of bounds";XC[HJ]="Got unexpected null value for H3 index";var gSe="Unknown error";function WJ(i,e,t){var n=t&&"value"in t,r=new Error((i[e]||gSe)+" (code: "+e+(n?", value: "+t.value:"")+")");return r.code=e,r}function jJ(i,e){var t=arguments.length===2?{value:e}:{};return WJ(Cs,i,t)}function XJ(i,e){var t=arguments.length===2?{value:e}:{};return WJ(XC,i,t)}function gw(i){if(i!==0)throw jJ(i)}var El={};Zwe.forEach(function(e){El[e[0]]=Ai.cwrap.apply(Ai,e)});var M_=16;var vw=4;var C_=8,vSe=8,WC=El.sizeOfH3Index(),iO=El.sizeOfLatLng(),_Se=El.sizeOfCellBoundary(),xSe=El.sizeOfGeoPolygon(),Aw=El.sizeOfGeoLoop(),Uot=El.sizeOfLinkedGeoPolygon(),kot=El.sizeOfCoordIJ();function ySe(i){if(typeof i!="number"||i<0||i>15||Math.floor(i)!==i)throw jJ(GJ,i);return i}function bSe(i){if(!i)throw XJ(HJ);return i}var wSe=Math.pow(2,32)-1,zot=Math.pow(2,31)-1;function SSe(i){if(i>wSe)throw XJ(qJ,i);return i}var TSe=/[^0-9a-fA-F]/;function $J(i){if(Array.isArray(i)&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1]))return i;if(typeof i!="string"||TSe.test(i))return[0,0];var e=parseInt(i.substring(0,i.length-8),M_),t=parseInt(i.substring(i.length-8),M_);return[t,e]}function zJ(i){if(i>=0)return i.toString(M_);i=i&2147483647;var e=YJ(8,i.toString(M_)),t=(parseInt(e[0],M_)+8).toString(M_);return e=t+e.substring(1),e}function ESe(i,e){return zJ(e)+YJ(8,zJ(i))}function YJ(i,e){for(var t=i-e.length,n="",r=0;r<t;r++)n+="0";return n=n+e,n}var Vot=Math.pow(2,32);function VJ(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(JJ),r/C_+a);return Ai.HEAPU32.set([n,r],e/vw),e}function MSe(i,e){var t=i.length-1,n=Ai._calloc(xSe),r=0,s=r+Aw,o=s+vw;VJ(i[0],n+r,e);var a;if(t>0){a=Ai._calloc(t,Aw);for(var l=0;l<t;l++)VJ(i[l+1],a+Aw*l,e)}return Ai.setValue(n+s,t,"i32"),Ai.setValue(n+o,a,"i32"),n}function CSe(i){var e=0,t=e+Aw,n=t+vw,r=vw;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+Aw*a+r,"i8*"));Ai._free(o)}Ai._free(i)}function ZJ(i,e){e===void 0&&(e=0);var t=Ai.getValue(i+WC*e,"i32"),n=Ai.getValue(i+WC*e+vw,"i32");return n?ESe(t,n):null}function RSe(i){return El.readInt64AsDoubleFromPointer(i)}function ISe(i,e){for(var t=[],n=0;n<e;n++){var r=ZJ(i,n);r!==null&&t.push(r)}return t}function jC(i){return DSe(Ai.getValue(i,"double"))}function KJ(i){return[jC(i),jC(i+C_)]}function PSe(i){return[jC(i+C_),jC(i)]}function LSe(i,e,t){for(var n=Ai.getValue(i,"i32"),r=i+C_,s=[],o=e?PSe:KJ,a=0;a<n*2;a+=2)s.push(o(r+C_*a));return t&&s.push(s[0]),s}function QJ(i,e,t){var n=Ai._malloc(iO);Ai.HEAPF64.set([i,e].map(JJ),n/C_);var r=Ai._malloc(WC);try{return gw(El.latLngToCell(n,t,r)),bSe(ZJ(r))}finally{Ai._free(r),Ai._free(n)}}function rO(i){var e=Ai._malloc(iO),t=$J(i),n=t[0],r=t[1];try{return gw(El.cellToLatLng(n,r,e)),KJ(e)}finally{Ai._free(e)}}function sO(i,e){var t=Ai._malloc(_Se),n=$J(i),r=n[0],s=n[1];try{return gw(El.cellToBoundary(r,s,t)),LSe(t,e,e)}finally{Ai._free(t)}}function oO(i,e,t){if(ySe(e),t=!!t,i.length===0||i[0].length===0)return[];var n=typeof i[0][0]=="number"?[i]:i,r=MSe(n,t),s=Ai._malloc(vSe);try{gw(El.maxPolygonToCellsSize(r,e,0,s));var o=SSe(RSe(s)),a=Ai._calloc(o,WC);try{return gw(El.polygonToCells(r,e,0,a)),ISe(a,o)}finally{Ai._free(a)}}finally{Ai._free(s),CSe(r)}}function JJ(i){return i*Math.PI/180}function DSe(i){return i*180/Math.PI}function aO(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 NSe=["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"],eee=new WeakMap,tee=new WeakMap,nee=new WeakMap,jO=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=NSe,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=nee.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}},nee.set(e,t)),t}getMaterialData(e){let t=tee.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)}tee.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=eee.get(e);return n===void 0&&(n={renderId:-1,lightsData:[]},eee.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}},FSe=[/^StackTrace\.js$/,/^TSLCore\.js$/,/^.*Node\.js$/,/^three\.webgpu.*\.js$/];function BSe(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&&!FSe.some(n=>n.test(t.file)))}var Jr=class{constructor(e=null){this.isStackTrace=!0,this.stack=BSe(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 x2(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 fs({vertexShader:J_e,fragmentShader:exe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Hn(new kA(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},hF=class extends aa{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 Xr;B.viewport=new xn;let k=new Xr;k.viewport=new xn;let z=[B,k],G=new Yv,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 Jp,F[Ee]=Ve),Ve.getTargetRaySpace()},this.getControllerGrip=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new Jp,F[Ee]=Ve),Ve.getGripSpace()},this.getHand=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new Jp,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?_o:Vs,Mt=R.stencil?la: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 Fa(d.textureWidth,d.textureHeight,{format:Br,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),I=new Fa(A.framebufferWidth,A.framebufferHeight,{format:Br,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,ve=Gt+en,vi=yt-tn,zn=hn+(Mt-tn),le=$e*Gt/ve*bn,Z=ot*Gt/ve*bn;Ee.projectionMatrix.makePerspective(vi,zn,le,Z,bn,ve),Ee.projectionMatrixInverse.copy(Ee.projectionMatrix).invert()}}function ge(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;ge(G,Mt);for(let It=0;It<Et.length;It++)ge(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=wd*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 Xr,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 x2,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 EZ;mt.setAnimationLoop(Fe),this.setAnimationLoop=function(Ee){Qe=Ee},this.dispose=function(){}}},txe=new cn,LZ=new Mn;LZ.set(-1,0,0,0,1,0,0,0,1);function nxe(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,q8(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(txe.makeRotationFromEuler(I)).transpose(),P.isCubeTexture&&P.isRenderTargetTexture===!1&&S.envMapRotation.value.premultiply(LZ),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 ixe(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,ge=he%ce.boundary,Re=he+ge;D+=ge,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 rxe=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]),Xh=null;function sxe(){return Xh===null&&(Xh=new NA(rxe,16,16,Ws,Wi),Xh.name="DFG_LUT",Xh.minFilter=Mi,Xh.magFilter=Mi,Xh.wrapS=oa,Xh.wrapT=oa,Xh.generateMipmaps=!1,Xh.needsUpdate=!0),Xh}var CM=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([f0,kh,Uh]),T=new Set([Ji,xi,xl,la,jA,XA]),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=oo,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let k=this,z=!1,G=null,W=null,Y=null,H=null;this._outputColorSpace=Nr;let $=0,J=0,te=null,ce=-1,he=null,ge=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 Nc,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 ve=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",ns,!1),ve===null){let Se="webgl2";if(ve=vi(Se,ne),ve===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,sn,Lt,Rt,fn,wn,Dn,ye,wt,Ze,St,Bt,ut;function Ce(){zn=new fve(ve),zn.init(),St=new Q_e(ve,zn),le=new rve(ve,zn,e,St),Z=new Z_e(ve,zn),le.reversedDepthBuffer&&d&&Z.buffers.depth.setReversed(!0),W=ve.createFramebuffer(),Y=ve.createFramebuffer(),H=ve.createFramebuffer(),Te=new mve(ve),Pe=new B_e,Ge=new K_e(ve,zn,Z,Pe,le,St,Te),vt=new hve(k),Tt=new _Ae(ve),Bt=new nve(ve,Tt),qe=new dve(ve,Tt,Te,Bt),Je=new gve(ve,qe,Tt,Bt,Te),ye=new Ave(ve,le,Ge),fn=new sve(Pe),Pt=new F_e(k,vt,zn,le,Bt,fn),sn=new nxe(k,Pe),Lt=new U_e,Rt=new H_e(zn),Dn=new tve(k,vt,Z,Je,y,l),wn=new Y_e(k,Je,le),ut=new ixe(ve,Te,le,Z),wt=new ive(ve,zn,Te),Ze=new pve(ve,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 _ve(w,t.width,t.height,a,r,s));let Yt=new hF(k,ve);this.xr=Yt,this.getContext=function(){return ve},this.getContextAttributes=function(){return ve.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(ge)},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(ge.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(),on=Dn.getClearAlpha(),pn=Vt.r,Wn=Vt.g,Jn=Vt.b;Qt?(R[0]=pn,R[1]=Wn,R[2]=Jn,R[3]=on,ve.clearBufferuiv(ve.COLOR,0,R)):(P[0]=pn,P[1]=Wn,P[2]=Jn,P[3]=on,ve.clearBufferiv(ve.COLOR,0,P))}else De|=ve.COLOR_BUFFER_BIT}Se&&(De|=ve.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),ke&&(De|=ve.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),De!==0&&ve.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",ns,!1),Dn.dispose(),Lt.dispose(),Rt.dispose(),Pe.dispose(),vt.dispose(),Je.dispose(),Bt.dispose(),ut.dispose(),Pt.dispose(),Yt.dispose(),Yt.removeEventListener("sessionstart",Zs),Yt.removeEventListener("sessionend",Nl),Ju.stop()};function nr(ne){ne.preventDefault(),RA("WebGLRenderer: Context Lost."),z=!0}function Fn(){RA("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 ns(ne){ze("WebGLRenderer: A WebGL context could not be created. Reason: ",ne.statusMessage)}function Pr(ne){let Se=ne.target;Se.removeEventListener("dispose",Pr),Ll(Se)}function Ll(ne){ba(ne),Pe.remove(ne)}function ba(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=pG(ne,Se,ke,De,Ne);Z.setMaterial(De,Qt);let on=ke.index,pn=1;if(De.wireframe===!0){if(on=qe.getWireframeAttribute(ke),on===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)),on!==null?(gn=Math.max(gn,0),Yi=Math.min(Yi,on.count)):Jn!=null&&(gn=Math.max(gn,0),Yi=Math.min(Yi,Jn.count));let is=Yi-gn;if(is<0||is===1/0)return;Bt.setup(Ne,De,Vt,ke,on);let Gr,ir=wt;if(on!==null&&(Gr=Tt.get(on),ir=Ze,ir.setIndex(Gr)),Ne.isMesh)De.wireframe===!0?(Z.setLineWidth(De.wireframeLinewidth*bn()),ir.setMode(ve.LINES)):ir.setMode(ve.TRIANGLES);else if(Ne.isLine){let Mo=De.linewidth;Mo===void 0&&(Mo=1),Z.setLineWidth(Mo*bn()),Ne.isLineSegments?ir.setMode(ve.LINES):Ne.isLineLoop?ir.setMode(ve.LINE_LOOP):ir.setMode(ve.LINE_STRIP)}else Ne.isPoints?ir.setMode(ve.POINTS):Ne.isSprite&&ir.setMode(ve.TRIANGLES);if(Ne.isBatchedMesh)if(zn.get("WEBGL_multi_draw"))ir.renderMultiDraw(Ne._multiDrawStarts,Ne._multiDrawCounts,Ne._multiDrawCount);else{let Mo=Ne._multiDrawStarts,Zt=Ne._multiDrawCounts,il=Ne._multiDrawCount,yi=on?Tt.get(on).bytesPerElement:1,Fl=Pe.get(De).currentProgram.getUniforms();for(let nu=0;nu<il;nu++)Fl.setValue(ve,"_gl_DrawID",nu),ir.render(Mo[nu]/yi,Zt[nu])}else if(Ne.isInstancedMesh)ir.renderInstances(gn,is,Ne.count);else if(ke.isInstancedBufferGeometry){let Mo=ke._maxInstanceCount!==void 0?ke._maxInstanceCount:1/0,Zt=Math.min(ke.instanceCount,Mo);ir.renderInstances(gn,is,Zt)}else ir.render(gn,is)};function Dl(ne,Se,ke){ne.transparent===!0&&ne.side===gr&&ne.forceSinglePass===!1?(ne.side=mi,ne.needsUpdate=!0,Ix(ne,Se,ke),ne.side=Oo,ne.needsUpdate=!0,Ix(ne,Se,ke),ne.side=gr):Ix(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];Dl(Vt,ke,Ne),De.add(Vt)}else Dl(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 nl=null;function _r(ne){nl&&nl(ne)}function Zs(){Ju.stop()}function Nl(){Ju.start()}let Ju=new EZ;Ju.setAnimationLoop(_r),typeof self<"u"&&Ju.setContext(self),this.setAnimationLoop=function(ne){nl=ne,Yt.setAnimationLoop(ne),ne===null?Ju.stop():Ju.start()},Yt.addEventListener("sessionstart",Zs),Yt.addEventListener("sessionend",Nl),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,Bo,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&&kS(Qt,Se,-1/0,k.sortObjects)}kS(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 on=Se.cameras;if(Vt.length>0)for(let pn=0,Wn=on.length;pn<Wn;pn++){let Jn=on[pn];PP(Qt,Vt,ne,Jn)}tn&&Dn.render(ne);for(let pn=0,Wn=on.length;pn<Wn;pn++){let Jn=on[pn];IP(F,ne,Jn,Jn.viewport)}}else Vt.length>0&&PP(Qt,Vt,ne,Se),tn&&Dn.render(ne),IP(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 kS(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 on=Qt.groups;for(let pn=0,Wn=on.length;pn<Wn;pn++){let Jn=on[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++)kS(qt[Qt],Se,ke,De)}function IP(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(ge.copy(De)),Ne.length>0&&Rx(Ne,Se,ke),qt.length>0&&Rx(qt,Se,ke),Qt.length>0&&Rx(Qt,Se,ke),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function PP(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 Fa(1,1,{generateMipmaps:!0,type:gn?Wi:Ji,minFilter:ko,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||ge;qt.setSize(Qt.z*k.transmissionResolutionScale,Qt.w*k.transmissionResolutionScale);let Vt=k.getRenderTarget(),on=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=oo;let Jn=De.viewport;if(De.viewport!==void 0&&(De.viewport=void 0),D.setupLightsView(De),ot===!0&&fn.setGlobalState(k.clippingPlanes,De),Rx(ne,ke,De),Ge.updateMultisampleRenderTarget(qt),Ge.updateRenderTargetMipmap(qt),zn.has("WEBGL_multisampled_render_to_texture")===!1){let gn=!1;for(let Yi=0,is=Se.length;Yi<is;Yi++){let Gr=Se[Yi],{object:ir,geometry:Mo,material:Zt,group:il}=Gr;if(Zt.side===gr&&ir.layers.test(De.layers)){let yi=Zt.side;Zt.side=mi,Zt.needsUpdate=!0,LP(ir,ke,De,Mo,Zt,il),Zt.side=yi,Zt.needsUpdate=!0,gn=!0}}gn===!0&&(Ge.updateMultisampleRenderTarget(qt),Ge.updateRenderTargetMipmap(qt))}k.setRenderTarget(Vt,on,pn),k.setClearColor(Fe,mt),Jn!==void 0&&(De.viewport=Jn),k.toneMapping=Wn}function Rx(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:on,group:pn}=Qt,Wn=Qt.material;Wn.allowOverride===!0&&De!==null&&(Wn=De),Vt.layers.test(ke.layers)&&LP(Vt,Se,ke,on,Wn,pn)}}function LP(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===gr&&Ne.forceSinglePass===!1?(Ne.side=mi,Ne.needsUpdate=!0,k.renderBufferDirect(ke,Se,De,Ne,ne,qt),Ne.side=Oo,Ne.needsUpdate=!0,k.renderBufferDirect(ke,Se,De,Ne,ne,qt),Ne.side=gr):k.renderBufferDirect(ke,Se,De,Ne,ne,qt),ne.onAfterRender(k,Se,ke,De,Ne,qt)}function Ix(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),on=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",Pr),pn=new Map,De.programs=pn);let Jn=pn.get(on);if(Jn!==void 0){if(De.currentProgram===Jn&&De.lightsStateVersion===Qt)return NP(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,on),pn.set(on,Jn),De.uniforms=Vt.uniforms;let gn=De.uniforms;return(!ne.isShaderMaterial&&!ne.isRawShaderMaterial||ne.clipping===!0)&&(gn.clippingPlanes=fn.uniform),NP(ne,Vt),De.needsLights=AG(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 DP(ne){if(ne.uniformsList===null){let Se=ne.currentProgram.getUniforms();ne.uniformsList=n_.seqWithValue(Se.seq,ne.uniforms)}return ne.uniformsList}function NP(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 dG(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 pG(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,on=De.isMeshStandardMaterial||De.isMeshLambertMaterial&&!De.envMap||De.isMeshPhongMaterial&&!De.envMap,pn=vt.get(De.envMap||Qt,on),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,is=!!ke.morphAttributes.color,Gr=oo;De.toneMapped&&(te===null||te.isXRRenderTarget===!0)&&(Gr=k.toneMapping);let ir=ke.morphAttributes.position||ke.morphAttributes.normal||ke.morphAttributes.color,Mo=ir!==void 0?ir.length:0,Zt=Pe.get(De),il=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!==il.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!==is||Zt.toneMapping!==Gr||Zt.morphTargetsCount!==Mo||!!Zt.lightProbeGrid!=D.state.lightProbeGridArray.length>0)&&(yi=!0):(yi=!0,Zt.__version=De.version);let Fl=Zt.currentProgram;yi===!0&&(Fl=Ix(De,Se,Ne),G&&De.isNodeMaterial&&G.onUpdateProgram(De,Fl,Zt));let nu=!1,Of=!1,Pm=!1,rr=Fl.getUniforms(),rs=Zt.uniforms;if(Z.useProgram(Fl.program)&&(nu=!0,Of=!0,Pm=!0),De.id!==ce&&(ce=De.id,Of=!0),Zt.needsLights){let pr=dG(D.state.lightProbeGridArray,Ne);Zt.lightProbeGrid!==pr&&(Zt.lightProbeGrid=pr,Of=!0)}if(nu||he!==ne){Z.buffers.depth.getReversed()&&ne.reversedDepth!==!0&&(ne._reversedDepth=!0,ne.updateProjectionMatrix()),rr.setValue(ve,"projectionMatrix",ne.projectionMatrix),rr.setValue(ve,"viewMatrix",ne.matrixWorldInverse);let kf=rr.map.cameraPosition;kf!==void 0&&kf.setValue(ve,yt.setFromMatrixPosition(ne.matrixWorld)),le.logarithmicDepthBuffer&&rr.setValue(ve,"logDepthBufFC",2/(Math.log(ne.far+1)/Math.LN2)),(De.isMeshPhongMaterial||De.isMeshToonMaterial||De.isMeshLambertMaterial||De.isMeshBasicMaterial||De.isMeshStandardMaterial||De.isShaderMaterial)&&rr.setValue(ve,"isOrthographic",ne.isOrthographicCamera===!0),he!==ne&&(he=ne,Of=!0,Pm=!0)}if(Zt.needsLights&&(il.state.directionalShadowMap.length>0&&rr.setValue(ve,"directionalShadowMap",il.state.directionalShadowMap,Ge),il.state.spotShadowMap.length>0&&rr.setValue(ve,"spotShadowMap",il.state.spotShadowMap,Ge),il.state.pointShadowMap.length>0&&rr.setValue(ve,"pointShadowMap",il.state.pointShadowMap,Ge)),Ne.isSkinnedMesh){rr.setOptional(ve,Ne,"bindMatrix"),rr.setOptional(ve,Ne,"bindMatrixInverse");let pr=Ne.skeleton;pr&&(pr.boneTexture===null&&pr.computeBoneTexture(),rr.setValue(ve,"boneTexture",pr.boneTexture,Ge))}Ne.isBatchedMesh&&(rr.setOptional(ve,Ne,"batchingTexture"),rr.setValue(ve,"batchingTexture",Ne._matricesTexture,Ge),rr.setOptional(ve,Ne,"batchingIdTexture"),rr.setValue(ve,"batchingIdTexture",Ne._indirectTexture,Ge),rr.setOptional(ve,Ne,"batchingColorTexture"),Ne._colorsTexture!==null&&rr.setValue(ve,"batchingColorTexture",Ne._colorsTexture,Ge));let Uf=ke.morphAttributes;if((Uf.position!==void 0||Uf.normal!==void 0||Uf.color!==void 0)&&ye.update(Ne,ke,Fl),(Of||Zt.receiveShadow!==Ne.receiveShadow)&&(Zt.receiveShadow=Ne.receiveShadow,rr.setValue(ve,"receiveShadow",Ne.receiveShadow)),(De.isMeshStandardMaterial||De.isMeshLambertMaterial||De.isMeshPhongMaterial)&&De.envMap===null&&Se.environment!==null&&(rs.envMapIntensity.value=Se.environmentIntensity),rs.dfgLUT!==void 0&&(rs.dfgLUT.value=sxe()),Of){if(rr.setValue(ve,"toneMappingExposure",k.toneMappingExposure),Zt.needsLights&&mG(rs,Pm),qt&&De.fog===!0&&sn.refreshFogUniforms(rs,qt),sn.refreshMaterialUniforms(rs,De,Ye,Ve,D.state.transmissionRenderTarget[ne.id]),Zt.needsLights&&Zt.lightProbeGrid){let pr=Zt.lightProbeGrid;rs.probesSH.value=pr.texture,rs.probesMin.value.copy(pr.boundingBox.min),rs.probesMax.value.copy(pr.boundingBox.max),rs.probesResolution.value.copy(pr.resolution)}n_.upload(ve,DP(Zt),rs,Ge)}if(De.isShaderMaterial&&De.uniformsNeedUpdate===!0&&(n_.upload(ve,DP(Zt),rs,Ge),De.uniformsNeedUpdate=!1),De.isSpriteMaterial&&rr.setValue(ve,"center",Ne.center),rr.setValue(ve,"modelViewMatrix",Ne.modelViewMatrix),rr.setValue(ve,"normalMatrix",Ne.normalMatrix),rr.setValue(ve,"modelMatrix",Ne.matrixWorld),De.uniformsGroups!==void 0){let pr=De.uniformsGroups;for(let kf=0,Lm=pr.length;kf<Lm;kf++){let FP=pr[kf];ut.update(FP,Fl),ut.bind(FP,Fl)}}return Fl}function mG(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 AG(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(ve.FRAMEBUFFER,Vt.__webglFramebuffer),ge.copy(ne.viewport),Re.copy(ne.scissor),Qe=ne.scissorTest,Z.viewport(ge),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 on=ne.texture;(on.isData3DTexture||on.isDataArrayTexture||on.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,ge.copy(ne.viewport),Re.copy(ne.scissor),Qe=ne.scissorTest}else ge.copy(It).multiplyScalar(Ye).floor(),Re.copy(dn).multiplyScalar(Ye).floor(),Qe=Gt;if(ke!==0&&(De=W),Z.bindFramebuffer(ve.FRAMEBUFFER,De)&&Z.drawBuffers(ne,De),Z.viewport(ge),Z.scissor(Re),Z.setScissorTest(Qe),Ne){let Vt=Pe.get(ne.texture);ve.framebufferTexture2D(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Vt.__webglTexture,ke)}else if(qt){let Vt=Se;for(let on=0;on<ne.textures.length;on++){let pn=Pe.get(ne.textures[on]);ve.framebufferTextureLayer(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0+on,pn.__webglTexture,ke,Vt)}}else if(ne!==null&&ke!==0){let Vt=Pe.get(ne.texture);ve.framebufferTexture2D(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.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 on=Pe.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&Qt!==void 0&&(on=on[Qt]),on){Z.bindFramebuffer(ve.FRAMEBUFFER,on);try{let pn=ne.textures[Vt],Wn=pn.format,Jn=pn.type;if(ne.textures.length>1&&ve.readBuffer(ve.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&&ve.readPixels(Se,ke,De,Ne,St.convert(Wn),St.convert(Jn),qt)}finally{let pn=te!==null?Pe.get(te).__webglFramebuffer:null;Z.bindFramebuffer(ve.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 on=Pe.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&Qt!==void 0&&(on=on[Qt]),on)if(Se>=0&&Se<=ne.width-De&&ke>=0&&ke<=ne.height-Ne){Z.bindFramebuffer(ve.FRAMEBUFFER,on);let pn=ne.textures[Vt],Wn=pn.format,Jn=pn.type;if(ne.textures.length>1&&ve.readBuffer(ve.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=ve.createBuffer();ve.bindBuffer(ve.PIXEL_PACK_BUFFER,gn),ve.bufferData(ve.PIXEL_PACK_BUFFER,qt.byteLength,ve.STREAM_READ),ve.readPixels(Se,ke,De,Ne,St.convert(Wn),St.convert(Jn),0);let Yi=te!==null?Pe.get(te).__webglFramebuffer:null;Z.bindFramebuffer(ve.FRAMEBUFFER,Yi);let is=ve.fenceSync(ve.SYNC_GPU_COMMANDS_COMPLETE,0);return ve.flush(),await YY(ve,is,4),ve.bindBuffer(ve.PIXEL_PACK_BUFFER,gn),ve.getBufferSubData(ve.PIXEL_PACK_BUFFER,0,qt),ve.deleteBuffer(gn),ve.deleteSync(is),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),ve.copyTexSubImage2D(ve.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,on,pn,Wn,Jn,gn,Yi,is,Gr=ne.isCompressedTexture?ne.mipmaps[qt]:ne.image;if(ke!==null)Qt=ke.max.x-ke.min.x,Vt=ke.max.y-ke.min.y,on=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 rs=Math.pow(2,-Ne);Qt=Math.floor(Gr.width*rs),Vt=Math.floor(Gr.height*rs),ne.isDataArrayTexture?on=Gr.depth:ne.isData3DTexture?on=Math.floor(Gr.depth*rs):on=1,pn=0,Wn=0,Jn=0}De!==null?(gn=De.x,Yi=De.y,is=De.z):(gn=0,Yi=0,is=0);let ir=St.convert(Se.format),Mo=St.convert(Se.type),Zt;Se.isData3DTexture?(Ge.setTexture3D(Se,0),Zt=ve.TEXTURE_3D):Se.isDataArrayTexture||Se.isCompressedArrayTexture?(Ge.setTexture2DArray(Se,0),Zt=ve.TEXTURE_2D_ARRAY):(Ge.setTexture2D(Se,0),Zt=ve.TEXTURE_2D),Z.activeTexture(ve.TEXTURE0),Z.pixelStorei(ve.UNPACK_FLIP_Y_WEBGL,Se.flipY),Z.pixelStorei(ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Se.premultiplyAlpha),Z.pixelStorei(ve.UNPACK_ALIGNMENT,Se.unpackAlignment);let il=Z.getParameter(ve.UNPACK_ROW_LENGTH),yi=Z.getParameter(ve.UNPACK_IMAGE_HEIGHT),Fl=Z.getParameter(ve.UNPACK_SKIP_PIXELS),nu=Z.getParameter(ve.UNPACK_SKIP_ROWS),Of=Z.getParameter(ve.UNPACK_SKIP_IMAGES);Z.pixelStorei(ve.UNPACK_ROW_LENGTH,Gr.width),Z.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,Gr.height),Z.pixelStorei(ve.UNPACK_SKIP_PIXELS,pn),Z.pixelStorei(ve.UNPACK_SKIP_ROWS,Wn),Z.pixelStorei(ve.UNPACK_SKIP_IMAGES,Jn);let Pm=ne.isDataArrayTexture||ne.isData3DTexture,rr=Se.isDataArrayTexture||Se.isData3DTexture;if(ne.isDepthTexture){let rs=Pe.get(ne),Uf=Pe.get(Se),pr=Pe.get(rs.__renderTarget),kf=Pe.get(Uf.__renderTarget);Z.bindFramebuffer(ve.READ_FRAMEBUFFER,pr.__webglFramebuffer),Z.bindFramebuffer(ve.DRAW_FRAMEBUFFER,kf.__webglFramebuffer);for(let Lm=0;Lm<on;Lm++)Pm&&(ve.framebufferTextureLayer(ve.READ_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,Pe.get(ne).__webglTexture,Ne,Jn+Lm),ve.framebufferTextureLayer(ve.DRAW_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,Pe.get(Se).__webglTexture,qt,is+Lm)),ve.blitFramebuffer(pn,Wn,Qt,Vt,gn,Yi,Qt,Vt,ve.DEPTH_BUFFER_BIT,ve.NEAREST);Z.bindFramebuffer(ve.READ_FRAMEBUFFER,null),Z.bindFramebuffer(ve.DRAW_FRAMEBUFFER,null)}else if(Ne!==0||ne.isRenderTargetTexture||Pe.has(ne)){let rs=Pe.get(ne),Uf=Pe.get(Se);Z.bindFramebuffer(ve.READ_FRAMEBUFFER,Y),Z.bindFramebuffer(ve.DRAW_FRAMEBUFFER,H);for(let pr=0;pr<on;pr++)Pm?ve.framebufferTextureLayer(ve.READ_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,rs.__webglTexture,Ne,Jn+pr):ve.framebufferTexture2D(ve.READ_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.TEXTURE_2D,rs.__webglTexture,Ne),rr?ve.framebufferTextureLayer(ve.DRAW_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,Uf.__webglTexture,qt,is+pr):ve.framebufferTexture2D(ve.DRAW_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.TEXTURE_2D,Uf.__webglTexture,qt),Ne!==0?ve.blitFramebuffer(pn,Wn,Qt,Vt,gn,Yi,Qt,Vt,ve.COLOR_BUFFER_BIT,ve.NEAREST):rr?ve.copyTexSubImage3D(Zt,qt,gn,Yi,is+pr,pn,Wn,Qt,Vt):ve.copyTexSubImage2D(Zt,qt,gn,Yi,pn,Wn,Qt,Vt);Z.bindFramebuffer(ve.READ_FRAMEBUFFER,null),Z.bindFramebuffer(ve.DRAW_FRAMEBUFFER,null)}else rr?ne.isDataTexture||ne.isData3DTexture?ve.texSubImage3D(Zt,qt,gn,Yi,is,Qt,Vt,on,ir,Mo,Gr.data):Se.isCompressedArrayTexture?ve.compressedTexSubImage3D(Zt,qt,gn,Yi,is,Qt,Vt,on,ir,Gr.data):ve.texSubImage3D(Zt,qt,gn,Yi,is,Qt,Vt,on,ir,Mo,Gr):ne.isDataTexture?ve.texSubImage2D(ve.TEXTURE_2D,qt,gn,Yi,Qt,Vt,ir,Mo,Gr.data):ne.isCompressedTexture?ve.compressedTexSubImage2D(ve.TEXTURE_2D,qt,gn,Yi,Gr.width,Gr.height,ir,Gr.data):ve.texSubImage2D(ve.TEXTURE_2D,qt,gn,Yi,Qt,Vt,ir,Mo,Gr);Z.pixelStorei(ve.UNPACK_ROW_LENGTH,il),Z.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,yi),Z.pixelStorei(ve.UNPACK_SKIP_PIXELS,Fl),Z.pixelStorei(ve.UNPACK_SKIP_ROWS,nu),Z.pixelStorei(ve.UNPACK_SKIP_IMAGES,Of),qt===0&&Se.generateMipmaps&&ve.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 Bo}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 PM=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}},r_=new re,DZ=new cn,NZ=new cn,FZ=new re,BZ=new re,LM=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(),DZ.copy(w.matrixWorldInverse),NZ.multiplyMatrices(w.projectionMatrix,DZ),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){r_.setFromMatrixPosition(y.matrixWorld),r_.applyMatrix4(NZ);let T=r_.z>=-1&&r_.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("+(r_.x*s+s)+"px,"+(-r_.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 FZ.setFromMatrixPosition(y.matrixWorld),BZ.setFromMatrixPosition(w.matrixWorld),FZ.distanceToSquared(BZ)}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 oxe(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var Eb=oxe;var axe=typeof global=="object"&&global&&global.Object===Object&&global,OZ=axe;var lxe=typeof self=="object"&&self&&self.Object===Object&&self,cxe=OZ||lxe||Function("return this")(),DM=cxe;var uxe=function(){return DM.Date.now()},NM=uxe;var hxe=/\s/;function fxe(i){for(var e=i.length;e--&&hxe.test(i.charAt(e)););return e}var UZ=fxe;var dxe=/^\s+/;function pxe(i){return i&&i.slice(0,UZ(i)+1).replace(dxe,"")}var kZ=pxe;var mxe=DM.Symbol,s_=mxe;var zZ=Object.prototype,Axe=zZ.hasOwnProperty,gxe=zZ.toString,Mb=s_?s_.toStringTag:void 0;function vxe(i){var e=Axe.call(i,Mb),t=i[Mb];try{i[Mb]=void 0;var n=!0}catch{}var r=gxe.call(i);return n&&(e?i[Mb]=t:delete i[Mb]),r}var VZ=vxe;var _xe=Object.prototype,xxe=_xe.toString;function yxe(i){return xxe.call(i)}var GZ=yxe;var bxe="[object Null]",wxe="[object Undefined]",qZ=s_?s_.toStringTag:void 0;function Sxe(i){return i==null?i===void 0?wxe:bxe:qZ&&qZ in Object(i)?VZ(i):GZ(i)}var HZ=Sxe;function Txe(i){return i!=null&&typeof i=="object"}var WZ=Txe;var Exe="[object Symbol]";function Mxe(i){return typeof i=="symbol"||WZ(i)&&HZ(i)==Exe}var jZ=Mxe;var XZ=NaN,Cxe=/^[-+]0x[0-9a-f]+$/i,Rxe=/^0b[01]+$/i,Ixe=/^0o[0-7]+$/i,Pxe=parseInt;function Lxe(i){if(typeof i=="number")return i;if(jZ(i))return XZ;if(Eb(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=Eb(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=kZ(i);var t=Rxe.test(i);return t||Ixe.test(i)?Pxe(i.slice(2),t?2:8):Cxe.test(i)?XZ:+i}var fF=Lxe;var Dxe="Expected a function",Nxe=Math.max,Fxe=Math.min;function Bxe(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(Dxe);e=fF(e)||0,Eb(t)&&(u=!!t.leading,f="maxWait"in t,s=f?Nxe(fF(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?Fxe(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=NM();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(NM())}function F(){var D=NM(),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 $Z=Bxe;function YZ(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 Oxe(i){if(Array.isArray(i))return i}function Uxe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function kxe(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function zxe(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 Vxe(){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 Gxe(i,e){return Oxe(i)||zxe(i,e)||qxe(i,e)||Vxe()}function qxe(i,e){if(i){if(typeof i=="string")return YZ(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)?YZ(i,e):void 0}}var Hxe=kxe(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;Uxe(this,i),this.name=e,this.defaultVal=r,this.triggerUpdate=o,this.onChange=l});function Zr(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 Hxe(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=$Z(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(ge,Re){}:J,ce=W.defaultVal,he=ce===void 0?null:ce;return function(ge){var Re=D[Y];if(!arguments.length)return Re;var Qe=ge===void 0?he:ge;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=Gxe(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 Kr=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-Kr.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?Kr.Bounce.In(i*2)*.5:Kr.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}}}}),Cb=function(){return performance.now()},og=(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=Cb()),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})(),o_={Linear:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=o_.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=o_.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=o_.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=o_.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}}},ZZ=(function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i})(),dF=new og,co=(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=Kr.Linear.None,this._interpolationFunction=o_.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=ZZ.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=dF,dF.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=Cb()),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=Cb()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},i.prototype.resume=function(e){return e===void 0&&(e=Cb()),!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=Kr.Linear.None),this._easingFunction=e,this},i.prototype.interpolation=function(e){return e===void 0&&(e=o_.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=Cb()),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 zKe=ZZ.nextId,$h=dF,VKe=$h.getAll.bind($h),GKe=$h.removeAll.bind($h),qKe=$h.add.bind($h),HKe=$h.remove.bind($h),WKe=$h.update.bind($h);function KZ(i){let e=+this._x.call(null,i),t=+this._y.call(null,i),n=+this._z.call(null,i);return QZ(this.cover(e,t,n),e,t,n,i)}function QZ(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 JZ(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)QZ(this,t[f],n[f],r[f],i[f]);return this}function eK(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 tK(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function nK(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 iK(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 Wxe=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function rK(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;Wxe(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 sK(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 oK(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function aK(){return this._root}function lK(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function cK(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 uK(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 hK(i){return i[0]}function fK(i){return arguments.length?(this._x=i,this):this._x}function dK(i){return i[1]}function pK(i){return arguments.length?(this._y=i,this):this._y}function mK(i){return i[2]}function AK(i){return arguments.length?(this._z=i,this):this._z}function Rb(i,e,t,n){var r=new pF(e??hK,t??dK,n??mK,NaN,NaN,NaN,NaN,NaN,NaN);return i==null?r:r.addAll(i)}function pF(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 gK(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var zo=Rb.prototype=pF.prototype;zo.copy=function(){var i=new pF(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=gK(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]=gK(n));return i};zo.add=KZ;zo.addAll=JZ;zo.cover=eK;zo.data=tK;zo.extent=nK;zo.find=iK;zo.findAllWithinRadius=rK;zo.remove=sK;zo.removeAll=oK;zo.root=aK;zo.size=lK;zo.visit=cK;zo.visitAfter=uK;zo.x=fK;zo.y=pK;zo.z=AK;function ag(i,e){return i==null||e==null?NaN:i<e?-1:i>e?1:i>=e?0:NaN}function mF(i,e){return i==null||e==null?NaN:e<i?-1:e>i?1:e>=i?0:NaN}function FM(i){let e,t,n;i.length!==2?(e=ag,t=(a,l)=>ag(i(a),l),n=(a,l)=>i(a)-l):(e=i===ag||i===mF?i:jxe,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 jxe(){return 0}function AF(i){return i===null?NaN:+i}var vK=FM(ag),_K=vK.right,Xxe=vK.left,$xe=FM(AF).center,Ib=_K;function z0(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 Vo=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 Yxe=Math.sqrt(50),Zxe=Math.sqrt(10),Kxe=Math.sqrt(2);function BM(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>=Yxe?10:s>=Zxe?5:s>=Kxe?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?BM(i,e,t*2):[a,l,c]}function OM(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?BM(e,i,t):BM(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 Pb(i,e,t){return e=+e,i=+i,t=+t,BM(i,e,t)[2]}function gF(i,e,t){e=+e,i=+i,t=+t;let n=e<i,r=n?Pb(e,i,t):Pb(i,e,t);return(n?-1:1)*(r<0?1/-r:r)}function UM(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 kM(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*Qxe(i){for(let e of i)yield*e}function Yh(i){return Array.from(Qxe(i))}function Ld(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 zM(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 VM(i,e){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(e).domain(i);break}return this}function GM(i,e,t){i.prototype=e.prototype=t,t.constructor=i}function vF(i,e){var t=Object.create(i.prototype);for(var n in e)t[n]=e[n];return t}function Nb(){}var Lb=.7,WM=1/Lb,a_="\\s*([+-]?\\d+)\\s*",Db="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Zh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Jxe=/^#([0-9a-f]{3,8})$/,eye=new RegExp(`^rgb\\(${a_},${a_},${a_}\\)$`),tye=new RegExp(`^rgb\\(${Zh},${Zh},${Zh}\\)$`),nye=new RegExp(`^rgba\\(${a_},${a_},${a_},${Db}\\)$`),iye=new RegExp(`^rgba\\(${Zh},${Zh},${Zh},${Db}\\)$`),rye=new RegExp(`^hsl\\(${Db},${Zh},${Zh}\\)$`),sye=new RegExp(`^hsla\\(${Db},${Zh},${Zh},${Db}\\)$`),xK={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};GM(Nb,Fu,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:yK,formatHex:yK,formatHex8:oye,formatHsl:aye,formatRgb:bK,toString:bK});function yK(){return this.rgb().formatHex()}function oye(){return this.rgb().formatHex8()}function aye(){return CK(this).formatHsl()}function bK(){return this.rgb().formatRgb()}function Fu(i){var e,t;return i=(i+"").trim().toLowerCase(),(e=Jxe.exec(i))?(t=e[1].length,e=parseInt(e[1],16),t===6?wK(e):t===3?new yl(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?qM(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?qM(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=eye.exec(i))?new yl(e[1],e[2],e[3],1):(e=tye.exec(i))?new yl(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=nye.exec(i))?qM(e[1],e[2],e[3],e[4]):(e=iye.exec(i))?qM(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=rye.exec(i))?EK(e[1],e[2]/100,e[3]/100,1):(e=sye.exec(i))?EK(e[1],e[2]/100,e[3]/100,e[4]):xK.hasOwnProperty(i)?wK(xK[i]):i==="transparent"?new yl(NaN,NaN,NaN,0):null}function wK(i){return new yl(i>>16&255,i>>8&255,i&255,1)}function qM(i,e,t,n){return n<=0&&(i=e=t=NaN),new yl(i,e,t,n)}function lye(i){return i instanceof Nb||(i=Fu(i)),i?(i=i.rgb(),new yl(i.r,i.g,i.b,i.opacity)):new yl}function l_(i,e,t,n){return arguments.length===1?lye(i):new yl(i,e,t,n??1)}function yl(i,e,t,n){this.r=+i,this.g=+e,this.b=+t,this.opacity=+n}GM(yl,l_,vF(Nb,{brighter(i){return i=i==null?WM:Math.pow(WM,i),new yl(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?Lb:Math.pow(Lb,i),new yl(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new yl(cg(this.r),cg(this.g),cg(this.b),jM(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:SK,formatHex:SK,formatHex8:cye,formatRgb:TK,toString:TK}));function SK(){return`#${lg(this.r)}${lg(this.g)}${lg(this.b)}`}function cye(){return`#${lg(this.r)}${lg(this.g)}${lg(this.b)}${lg((isNaN(this.opacity)?1:this.opacity)*255)}`}function TK(){let i=jM(this.opacity);return`${i===1?"rgb(":"rgba("}${cg(this.r)}, ${cg(this.g)}, ${cg(this.b)}${i===1?")":`, ${i})`}`}function jM(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function cg(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function lg(i){return i=cg(i),(i<16?"0":"")+i.toString(16)}function EK(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new Nu(i,e,t,n)}function CK(i){if(i instanceof Nu)return new Nu(i.h,i.s,i.l,i.opacity);if(i instanceof Nb||(i=Fu(i)),!i)return new Nu;if(i instanceof Nu)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 Nu(o,a,l,i.opacity)}function RK(i,e,t,n){return arguments.length===1?CK(i):new Nu(i,e,t,n??1)}function Nu(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}GM(Nu,RK,vF(Nb,{brighter(i){return i=i==null?WM:Math.pow(WM,i),new Nu(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?Lb:Math.pow(Lb,i),new Nu(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 yl(_F(i>=240?i-240:i+120,r,n),_F(i,r,n),_F(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new Nu(MK(this.h),HM(this.s),HM(this.l),jM(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=jM(this.opacity);return`${i===1?"hsl(":"hsla("}${MK(this.h)}, ${HM(this.s)*100}%, ${HM(this.l)*100}%${i===1?")":`, ${i})`}`}}));function MK(i){return i=(i||0)%360,i<0?i+360:i}function HM(i){return Math.max(0,Math.min(1,i||0))}function _F(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 xF(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 IK(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 xF((t-n/e)*e,o,r,s,a)}}function PK(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 xF((t-n/e)*e,r,s,o,a)}}var Fb=i=>()=>i;function uye(i,e){return function(t){return i+t*e}}function hye(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 LK(i){return(i=+i)==1?XM:function(e,t){return t-e?hye(e,t,i):Fb(isNaN(e)?t:e)}}function XM(i,e){var t=e-i;return t?uye(i,t):Fb(isNaN(i)?e:i)}var yF=(function i(e){var t=LK(e);function n(r,s){var o=t((r=l_(r)).r,(s=l_(s)).r),a=t(r.g,s.g),l=t(r.b,s.b),c=XM(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 DK(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=l_(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 xJe=DK(IK),yJe=DK(PK);function $M(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 YM(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function bF(i,e){return(YM(e)?$M:wF)(i,e)}function wF(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]=ug(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 NK(i,e){var t=new Date;return i=+i,e=+e,function(n){return t.setTime(i*(1-n)+e*n),t}}function Kh(i,e){return i=+i,e=+e,function(t){return i*(1-t)+e*t}}function FK(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]=ug(i[r],e[r]):n[r]=e[r];return function(s){for(r in t)n[r]=t[r](s);return n}}var TF=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,SF=new RegExp(TF.source,"g");function fye(i){return function(){return i}}function dye(i){return function(e){return i(e)+""}}function BK(i,e){var t=TF.lastIndex=SF.lastIndex=0,n,r,s,o=-1,a=[],l=[];for(i=i+"",e=e+"";(n=TF.exec(i))&&(r=SF.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:Kh(n,r)})),t=SF.lastIndex;return t<e.length&&(s=e.slice(t),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?dye(l[0].x):fye(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 ug(i,e){var t=typeof e,n;return e==null||t==="boolean"?Fb(e):(t==="number"?Kh:t==="string"?(n=Fu(e))?(e=n,yF):BK:e instanceof Fu?yF:e instanceof Date?NK:YM(e)?$M:Array.isArray(e)?wF:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?FK:Kh)(i,e)}function EF(i,e){return i=+i,e=+e,function(t){return Math.round(i*(1-t)+e*t)}}function MF(i){return function(){return i}}function CF(i){return+i}var OK=[0,1];function c_(i){return i}function RF(i,e){return(e-=i=+i)?function(t){return(t-i)/e}:MF(isNaN(e)?NaN:.5)}function pye(i,e){var t;return i>e&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function mye(i,e,t){var n=i[0],r=i[1],s=e[0],o=e[1];return r<n?(n=RF(r,n),s=t(o,s)):(n=RF(n,r),s=t(s,o)),function(a){return s(n(a))}}function Aye(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]=RF(i[o],i[o+1]),s[o]=t(e[o],e[o+1]);return function(a){var l=Ib(i,a,1,n)-1;return s[l](r[l](a))}}function UK(i,e){return e.domain(i.domain()).range(i.range()).interpolate(i.interpolate()).clamp(i.clamp()).unknown(i.unknown())}function gye(){var i=OK,e=OK,t=ug,n,r,s,o=c_,a,l,c;function u(){var d=Math.min(i.length,e.length);return o!==c_&&(o=pye(i[0],i[d-1])),a=d>2?Aye:mye,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),Kh)))(d)))},f.domain=function(d){return arguments.length?(i=Array.from(d,CF),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=EF,u()},f.clamp=function(d){return arguments.length?(o=d?!0:c_,u()):o!==c_},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 IF(){return gye()(c_,c_)}function kK(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function hg(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 Qh(i){return i=hg(Math.abs(i)),i?i[1]:NaN}function zK(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 VK(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var vye=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function V0(i){if(!(e=vye.exec(i)))throw new Error("invalid format: "+i);var e;return new ZM({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]})}V0.prototype=ZM.prototype;function ZM(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+""}ZM.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 GK(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 Bb;function qK(i,e){var t=hg(i,e);if(!t)return Bb=void 0,i.toPrecision(e);var n=t[0],r=t[1],s=r-(Bb=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")+hg(i,Math.max(0,e+s-1))[0]}function PF(i,e){var t=hg(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 LF={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:kK,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)=>PF(i*100,e),r:PF,s:qK,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function DF(i){return i}var HK=Array.prototype.map,WK=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function jK(i){var e=i.grouping===void 0||i.thousands===void 0?DF:zK(HK.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?DF:VK(HK.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=V0(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"):LF[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=LF[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=GK(G)),te&&+G==0&&w!=="+"&&(te=!1),W=(te?w==="("?w:a:w==="-"||w==="("?"":w)+W,Y=(D==="s"&&!isNaN(G)&&Bb!==void 0?WK[8+Bb/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(Qh(d)/3)))*3,y=Math.pow(10,-A),w=c((f=V0(f),f.type="f",f),{suffix:WK[8+A/3]});return function(S){return w(y*S)}}return{format:c,formatPrefix:u}}var KM,QM,JM;NF({thousands:",",grouping:[3],currency:["$",""]});function NF(i){return KM=jK(i),QM=KM.format,JM=KM.formatPrefix,KM}function FF(i){return Math.max(0,-Qh(Math.abs(i)))}function BF(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Qh(e)/3)))*3-Qh(Math.abs(i)))}function OF(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,Qh(e)-Qh(i))+1}function UF(i,e,t,n){var r=gF(i,e,t),s;switch(n=V0(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=BF(r,o))&&(n.precision=s),JM(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=OF(r,Math.max(Math.abs(i),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=FF(r))&&(n.precision=s-(n.type==="%")*2);break}}return QM(n)}function kF(i){var e=i.domain;return i.ticks=function(t){var n=e();return OM(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return UF(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=Pb(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 bl(){var i=IF();return i.copy=function(){return UK(i,bl())},VM.apply(i,arguments),kF(i)}function Ob(){var i=0,e=1,t=1,n=[.5],r=[0,1],s;function o(l){return l!=null&&l<=l?r[Ib(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 Ob().domain([i,e]).range(r).unknown(s)},VM.apply(kF(o),arguments)}var Pn=1e-6,fg=1e-12,ri=Math.PI,xo=ri/2,u_=ri/4,yo=ri*2,ur=180/ri,_n=ri/180,si=Math.abs,h_=Math.atan,Ms=Math.atan2,mn=Math.cos,Ub=Math.ceil,XK=Math.exp;var eC=Math.hypot,$K=Math.log;var un=Math.sin,YK=Math.sign||function(i){return i>0?1:i<0?-1:0},Go=Math.sqrt,ZK=Math.tan;function KK(i){return i>1?0:i<-1?ri:Math.acos(i)}function ha(i){return i>1?xo:i<-1?-xo:Math.asin(i)}function zF(i){return(i=un(i/2))*i}function ps(){}function tC(i,e){i&&JK.hasOwnProperty(i.type)&&JK[i.type](i,e)}var QK={Feature:function(i,e){tC(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)tC(t[n].geometry,e)}},JK={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){VF(i.coordinates,e,0)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)VF(t[n],e,0)},Polygon:function(i,e){eQ(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)eQ(t[n],e)},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)tC(t[n],e)}};function VF(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 eQ(i,e){var t=-1,n=i.length;for(e.polygonStart();++t<n;)VF(i[t],e,1);e.polygonEnd()}function G0(i,e){i&&QK.hasOwnProperty(i.type)?QK[i.type](i,e):tC(i,e)}var kb=new Vo,tQ=new Vo,nQ,iQ,GF,qF,HF,Jh={point:ps,lineStart:ps,lineEnd:ps,polygonStart:function(){kb=new Vo,Jh.lineStart=_ye,Jh.lineEnd=xye},polygonEnd:function(){var i=+kb;tQ.add(i<0?yo+i:i),this.lineStart=this.lineEnd=this.point=ps},sphere:function(){tQ.add(yo)}};function _ye(){Jh.point=yye}function xye(){rQ(nQ,iQ)}function yye(i,e){Jh.point=rQ,nQ=i,iQ=e,i*=_n,e*=_n,GF=i,qF=mn(e=e/2+u_),HF=un(e)}function rQ(i,e){i*=_n,e*=_n,e=e/2+u_;var t=i-GF,n=t>=0?1:-1,r=n*t,s=mn(e),o=un(e),a=HF*o,l=qF*s+a*mn(r),c=a*n*un(r);kb.add(Ms(c,l)),GF=i,qF=s,HF=o}function dg(i){return[Ms(i[1],i[0]),ha(i[2])]}function kc(i){var e=i[0],t=i[1],n=mn(t);return[n*mn(e),n*un(e),un(t)]}function zb(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Dd(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 nC(i,e){i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}function Vb(i,e){return[i[0]*e,i[1]*e,i[2]*e]}function pg(i){var e=Go(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);i[0]/=e,i[1]/=e,i[2]/=e}var Qr,wl,ms,Ql,mg,lQ,cQ,f_,Gb,q0,Fd,Nd={point:WF,lineStart:sQ,lineEnd:oQ,polygonStart:function(){Nd.point=hQ,Nd.lineStart=bye,Nd.lineEnd=wye,Gb=new Vo,Jh.polygonStart()},polygonEnd:function(){Jh.polygonEnd(),Nd.point=WF,Nd.lineStart=sQ,Nd.lineEnd=oQ,kb<0?(Qr=-(ms=180),wl=-(Ql=90)):Gb>Pn?Ql=90:Gb<-Pn&&(wl=-90),Fd[0]=Qr,Fd[1]=ms},sphere:function(){Qr=-(ms=180),wl=-(Ql=90)}};function WF(i,e){q0.push(Fd=[Qr=i,ms=i]),e<wl&&(wl=e),e>Ql&&(Ql=e)}function uQ(i,e){var t=kc([i*_n,e*_n]);if(f_){var n=Dd(f_,t),r=[n[1],-n[0],0],s=Dd(r,n);pg(s),s=dg(s);var o=i-mg,a=o>0?1:-1,l=s[0]*ur*a,c,u=si(o)>180;u^(a*mg<l&&l<a*i)?(c=s[1]*ur,c>Ql&&(Ql=c)):(l=(l+360)%360-180,u^(a*mg<l&&l<a*i)?(c=-s[1]*ur,c<wl&&(wl=c)):(e<wl&&(wl=e),e>Ql&&(Ql=e))),u?i<mg?Kl(Qr,i)>Kl(Qr,ms)&&(ms=i):Kl(i,ms)>Kl(Qr,ms)&&(Qr=i):ms>=Qr?(i<Qr&&(Qr=i),i>ms&&(ms=i)):i>mg?Kl(Qr,i)>Kl(Qr,ms)&&(ms=i):Kl(i,ms)>Kl(Qr,ms)&&(Qr=i)}else q0.push(Fd=[Qr=i,ms=i]);e<wl&&(wl=e),e>Ql&&(Ql=e),f_=t,mg=i}function sQ(){Nd.point=uQ}function oQ(){Fd[0]=Qr,Fd[1]=ms,Nd.point=WF,f_=null}function hQ(i,e){if(f_){var t=i-mg;Gb.add(si(t)>180?t+(t>0?360:-360):t)}else lQ=i,cQ=e;Jh.point(i,e),uQ(i,e)}function bye(){Jh.lineStart()}function wye(){hQ(lQ,cQ),Jh.lineEnd(),si(Gb)>Pn&&(Qr=-(ms=180)),Fd[0]=Qr,Fd[1]=ms,f_=null}function Kl(i,e){return(e-=i)<0?e+360:e}function Sye(i,e){return i[0]-e[0]}function aQ(i,e){return i[0]<=i[1]?i[0]<=e&&e<=i[1]:e<i[0]||i[1]<e}function iC(i){var e,t,n,r,s,o,a;if(Ql=ms=-(Qr=wl=1/0),q0=[],G0(i,Nd),t=q0.length){for(q0.sort(Sye),e=1,n=q0[0],s=[n];e<t;++e)r=q0[e],aQ(n,r[0])||aQ(n,r[1])?(Kl(n[0],r[1])>Kl(n[0],n[1])&&(n[1]=r[1]),Kl(r[0],n[1])>Kl(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=Kl(n[1],r[0]))>o&&(o=a,Qr=r[0],ms=n[1])}return q0=Fd=null,Qr===1/0||wl===1/0?[[NaN,NaN],[NaN,NaN]]:[[Qr,wl],[ms,Ql]]}var qb,rC,sC,oC,aC,lC,cC,uC,jF,XF,$F,pQ,mQ,qa,Ha,Wa,Bu={sphere:ps,point:YF,lineStart:fQ,lineEnd:dQ,polygonStart:function(){Bu.lineStart=Mye,Bu.lineEnd=Cye},polygonEnd:function(){Bu.lineStart=fQ,Bu.lineEnd=dQ}};function YF(i,e){i*=_n,e*=_n;var t=mn(e);Hb(t*mn(i),t*un(i),un(e))}function Hb(i,e,t){++qb,sC+=(i-sC)/qb,oC+=(e-oC)/qb,aC+=(t-aC)/qb}function fQ(){Bu.point=Tye}function Tye(i,e){i*=_n,e*=_n;var t=mn(e);qa=t*mn(i),Ha=t*un(i),Wa=un(e),Bu.point=Eye,Hb(qa,Ha,Wa)}function Eye(i,e){i*=_n,e*=_n;var t=mn(e),n=t*mn(i),r=t*un(i),s=un(e),o=Ms(Go((o=Ha*s-Wa*r)*o+(o=Wa*n-qa*s)*o+(o=qa*r-Ha*n)*o),qa*n+Ha*r+Wa*s);rC+=o,lC+=o*(qa+(qa=n)),cC+=o*(Ha+(Ha=r)),uC+=o*(Wa+(Wa=s)),Hb(qa,Ha,Wa)}function dQ(){Bu.point=YF}function Mye(){Bu.point=Rye}function Cye(){AQ(pQ,mQ),Bu.point=YF}function Rye(i,e){pQ=i,mQ=e,i*=_n,e*=_n,Bu.point=AQ;var t=mn(e);qa=t*mn(i),Ha=t*un(i),Wa=un(e),Hb(qa,Ha,Wa)}function AQ(i,e){i*=_n,e*=_n;var t=mn(e),n=t*mn(i),r=t*un(i),s=un(e),o=Ha*s-Wa*r,a=Wa*n-qa*s,l=qa*r-Ha*n,c=eC(o,a,l),u=ha(c),f=c&&-u/c;jF.add(f*o),XF.add(f*a),$F.add(f*l),rC+=u,lC+=u*(qa+(qa=n)),cC+=u*(Ha+(Ha=r)),uC+=u*(Wa+(Wa=s)),Hb(qa,Ha,Wa)}function hC(i){qb=rC=sC=oC=aC=lC=cC=uC=0,jF=new Vo,XF=new Vo,$F=new Vo,G0(i,Bu);var e=+jF,t=+XF,n=+$F,r=eC(e,t,n);return r<fg&&(e=lC,t=cC,n=uC,rC<Pn&&(e=sC,t=oC,n=aC),r=eC(e,t,n),r<fg)?[NaN,NaN]:[Ms(t,e)*ur,ha(n/r)*ur]}function Wb(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 ZF(i,e){return si(i)>ri&&(i-=Math.round(i/yo)*yo),[i,e]}ZF.invert=ZF;function KF(i,e,t){return(i%=yo)?e||t?Wb(vQ(i),_Q(e,t)):vQ(i):e||t?_Q(e,t):ZF}function gQ(i){return function(e,t){return e+=i,si(e)>ri&&(e-=Math.round(e/yo)*yo),[e,t]}}function vQ(i){var e=gQ(i);return e.invert=gQ(-i),e}function _Q(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),ha(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),ha(A*t-u*n)]},o}function QF(i){i=KF(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 yQ(i,e,t,n,r,s){if(t){var o=mn(e),a=un(e),l=n*t;r==null?(r=e+n*yo,s=e-l/2):(r=xQ(o,r),s=xQ(o,s),(n>0?r<s:r>s)&&(r+=n*yo));for(var c,u=r;n>0?u>s:u<s;u-=l)c=dg([o,-a*mn(u),-a*un(u)]),i.point(c[0],c[1])}}function xQ(i,e){e=kc(e),e[0]-=i,pg(e);var t=KK(-e[1]);return((-e[2]<0?-t:t)+yo-Pn)%yo}function fC(){var i=[],e;return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){i.push(e=[])},lineEnd:ps,rejoin:function(){i.length>1&&i.push(i.pop().concat(i.shift()))},result:function(){var t=i;return i=[],e=null,t}}}function d_(i,e){return si(i[0]-e[0])<Pn&&si(i[1]-e[1])<Pn}function dC(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 pC(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(d_(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 dC(S,y,null,!0)),o.push(R.o=new dC(S,null,R,!1)),s.push(R=new dC(T,y,null,!1)),o.push(R.o=new dC(T,null,R,!0))}}),!!s.length){for(o.sort(e),bQ(s),bQ(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 bQ(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 JF(i){return si(i[0])<=ri?i[0]:YK(i[0])*((si(i[0])+ri)%yo-ri)}function mC(i,e){var t=JF(e),n=e[1],r=un(n),s=[un(t),-mn(t),0],o=0,a=0,l=new Vo;r===1?n=xo+Pn:r===-1&&(n=-xo-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=JF(A),w=A[1]/2+u_,S=un(w),T=mn(w),R=0;R<d;++R,y=I,S=D,T=L,A=P){var P=f[R],I=JF(P),F=P[1]/2+u_,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(Ms(G*B*un(k),T*L+G*mn(k))),o+=z?C+B*yo:C,z^y>=t^I>=t){var W=Dd(kc(A),kc(P));pg(W);var Y=Dd(s,W);pg(Y);var H=(z^C>=0?-1:1)*ha(Y[2]);(n>H||n===H&&(W[0]||W[1]))&&(a+=z^C>=0?1:-1)}}return(o<-Pn||o<Pn&&l<-fg)^a&1}function AC(i,e,t,n){return function(r){var s=e(r),o=fC(),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=Yh(u);var I=mC(c,n);u.length?(l||(r.polygonStart(),l=!0),pC(u,Pye,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(Iye))}}return d}}function Iye(i){return i.length>1}function Pye(i,e){return((i=i.x)[0]<0?i[1]-xo-Pn:xo-i[1])-((e=e.x)[0]<0?e[1]-xo-Pn:xo-e[1])}var eB=AC(function(){return!0},Lye,Nye,[-ri,-xo]);function Lye(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?xo:-xo),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=Dye(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 Dye(i,e,t,n){var r,s,o=un(i-t);return si(o)>Pn?h_((un(e)*(s=mn(n))*un(t)-un(n)*(r=mn(e))*un(i))/(r*s*o)):(e+n)/2}function Nye(i,e,t,n){var r;if(i==null)r=t*xo,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 wQ(i){var e=mn(i),t=2*_n,n=e>0,r=si(e)>Pn;function s(u,f,d,A){yQ(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||d_(f,P)||d_(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||!d_(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=kc(u),y=kc(f),w=[1,0,0],S=Dd(A,y),T=zb(S,S),R=S[0],P=T-R*R;if(!P)return!d&&u;var I=e*T/P,F=-e*R/P,D=Dd(w,S),L=Vb(w,I),C=Vb(S,F);nC(L,C);var B=D,k=zb(L,B),z=zb(B,B),G=k*k-z*(zb(L,L)-1);if(!(G<0)){var W=Go(G),Y=Vb(B,(-k-W)/z);if(nC(Y,L),Y=dg(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,ge=si(he-ri)<Pn,Re=ge||he<Pn;if(!ge&&te<J&&(ce=J,J=te,te=ce),Re?ge?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=Vb(B,(-k+W)/z);return nC(Qe,L),[Y,dg(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 AC(o,a,s,n?[0,-i]:[-ri,i-ri])}function SQ(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 jb=1e9,gC=-jb;function tB(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=fC(),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,ge=te[0],Re,Qe,Fe=ge[0],mt=ge[1];ce<he;++ce)Re=Fe,Qe=mt,ge=te[ce],Fe=ge[0],mt=ge[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=Yh(d)).length;($||J)&&(c.polygonStart(),$&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),J&&pC(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(gC,Math.min(jb,R)),P=Math.max(gC,Math.min(jb,P))],ce=[H=Math.max(gC,Math.min(jb,H)),$=Math.max(gC,Math.min(jb,$))];SQ(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 nB,iB,vC,_C,p_={sphere:ps,point:ps,lineStart:Fye,lineEnd:ps,polygonStart:ps,polygonEnd:ps};function Fye(){p_.point=Oye,p_.lineEnd=Bye}function Bye(){p_.point=p_.lineEnd=ps}function Oye(i,e){i*=_n,e*=_n,iB=i,vC=un(e),_C=mn(e),p_.point=Uye}function Uye(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=_C*t-vC*n*s,c=vC*t+_C*n*s;nB.add(Ms(Go(a*a+l*l),c)),iB=i,vC=t,_C=n}function TQ(i){return nB=new Vo,G0(i,p_),+nB}var rB=[null,null],kye={type:"LineString",coordinates:rB};function Sl(i,e){return rB[0]=i,rB[1]=e,TQ(kye)}var EQ={Feature:function(i,e){return xC(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)if(xC(t[n].geometry,e))return!0;return!1}},MQ={Sphere:function(){return!0},Point:function(i,e){return CQ(i.coordinates,e)},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(CQ(t[n],e))return!0;return!1},LineString:function(i,e){return RQ(i.coordinates,e)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(RQ(t[n],e))return!0;return!1},Polygon:function(i,e){return IQ(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(IQ(t[n],e))return!0;return!1},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)if(xC(t[n],e))return!0;return!1}};function xC(i,e){return i&&MQ.hasOwnProperty(i.type)?MQ[i.type](i,e):!1}function CQ(i,e){return Sl(i,e)===0}function RQ(i,e){for(var t,n,r,s=0,o=i.length;s<o;s++){if(n=Sl(i[s],e),n===0||s>0&&(r=Sl(i[s],i[s-1]),r>0&&t<=r&&n<=r&&(t+n-r)*(1-Math.pow((t-n)/r,2))<fg*r))return!0;t=n}return!1}function IQ(i,e){return!!mC(i.map(zye),PQ(e))}function zye(i){return i=i.map(PQ),i.pop(),i}function PQ(i){return[i[0]*_n,i[1]*_n]}function sB(i,e){return(i&&EQ.hasOwnProperty(i.type)?EQ[i.type]:xC)(i,e)}function LQ(i,e,t){var n=Ld(i,e-Pn,t).concat(e);return function(r){return n.map(function(s){return[r,s]})}}function DQ(i,e,t){var n=Ld(i,e-Pn,t).concat(e);return function(r){return n.map(function(s){return[s,r]})}}function oB(){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 Ld(Ub(n/u)*u,t,u).map(y).concat(Ld(Ub(a/f)*f,o,f).map(w)).concat(Ld(Ub(e/l)*l,i,l).filter(function(P){return si(P%u)>Pn}).map(d)).concat(Ld(Ub(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=LQ(s,r,90),A=DQ(e,i,S),y=LQ(a,o,90),w=DQ(n,t,S),T):S},T.extentMajor([[-180,-90+Pn],[180,90-Pn]]).extentMinor([[-180,-80-Pn],[180,80+Pn]])}function aB(){return oB()()}function Ag(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*ha(Go(zF(s-n)+o*l*zF(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[Ms(F,I)*ur,Ms(D,Go(I*I+F*F))*ur]}:function(){return[t*ur,n*ur]};return S.distance=y,S}var lB=i=>i;var m_=1/0,yC=m_,Xb=-m_,bC=Xb,Vye={point:Gye,lineStart:ps,lineEnd:ps,polygonStart:ps,polygonEnd:ps,result:function(){var i=[[m_,yC],[Xb,bC]];return Xb=bC=-(yC=m_=1/0),i}};function Gye(i,e){i<m_&&(m_=i),i>Xb&&(Xb=i),e<yC&&(yC=e),e>bC&&(bC=e)}var cB=Vye;function $b(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 hB(i,e,t){var n=i.clipExtent&&i.clipExtent();return i.scale(150).translate([0,0]),n!=null&&i.clipExtent(null),G0(t,i.stream(cB)),e(cB.result()),n!=null&&i.clipExtent(n),i}function fB(i,e,t){return hB(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 NQ(i,e,t){return fB(i,[[0,0],e],t)}function FQ(i,e,t){return hB(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 BQ(i,e,t){return hB(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 OQ=16,qye=mn(30*_n);function dB(i,e){return+e?Wye(i,e):Hye(i)}function Hye(i){return $b({point:function(e,t){e=i(e,t),this.stream.point(e[0],e[1])}})}function Wye(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=Go(I*I+F*F+D*D),C=ha(D/=L),B=si(si(D)-1)<Pn||si(s-f)<Pn?(s+f)/2:Ms(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<qye)&&(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=kc([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],OQ,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,OQ,n),S.lineEnd=I,I()}return S}}var jye=$b({point:function(i,e){this.stream.point(i*_n,e*_n)}});function Xye(i){return $b({point:function(e,t){var n=i(e,t);return this.stream.point(n[0],n[1])}})}function $ye(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 UQ(i,e,t,n,r,s){if(!s)return $ye(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 pB(i){return Yye(function(){return i})()}function Yye(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=eB,S=null,T,R,P,I=lB,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=jye(Xye(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?wQ(y=H*_n):(y=null,eB),Y()):y*ur},z.clipExtent=function(H){return arguments.length?(I=H==null?(S=T=R=P=null,lB):tB(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=dB(L,F=H*H),Y()):Go(F)},z.fitExtent=function(H,$){return fB(z,H,$)},z.fitSize=function(H,$){return NQ(z,H,$)},z.fitWidth=function(H,$){return FQ(z,H,$)},z.fitHeight=function(H,$){return BQ(z,H,$)};function W(){var H=UQ(t,0,0,d,A,f).apply(null,e(s,o)),$=UQ(t,n-H[0],r-H[1],d,A,f);return u=KF(a,l,c),L=Wb(e,$),C=Wb(u,L),D=dB(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 kQ(i){return function(e,t){var n=Go(e*e+t*t),r=i(n),s=un(r),o=mn(r);return[Ms(e*s,n*o),ha(n&&t*s/n)]}}function Yb(i,e){return[i,$K(ZK((xo+e)/2))]}Yb.invert=function(i,e){return[i,2*h_(XK(e))-xo]};function mB(i,e){var t=mn(e),n=1+mn(i)*t;return[t*un(i)/n,un(e)/n]}mB.invert=kQ(function(i){return 2*h_(i)});function AB(){return pB(mB).scale(250).clipAngle(142)}function _B(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 Zye(i){if(Array.isArray(i))return i}function Kye(i){if(Array.isArray(i))return _B(i)}function Zb(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 Qye(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Jye(i,e,t){return e=EC(e),c2e(i,HQ()?Reflect.construct(e,[],EC(i).constructor):e.apply(i,t))}function qQ(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function e2e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function oi(i,e){return i.get(Zb(i,e))}function H0(i,e,t){qQ(i,e),e.set(i,t)}function W0(i,e,t){return i.set(Zb(i,e),t),t}function t2e(i,e){qQ(i,e),e.add(i)}function n2e(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,jQ(n.key),n)}}function i2e(i,e,t){return e&&n2e(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function A_(i,e,t){return(e=jQ(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function EC(i){return EC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},EC(i)}function r2e(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&&xB(i,e)}function HQ(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(HQ=function(){return!!i})()}function s2e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function o2e(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 a2e(){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 l2e(){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 c2e(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 Qye(i)}function xB(i,e){return xB=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},xB(i,e)}function TC(i,e){return Zye(i)||o2e(i,e)||XQ(i,e)||a2e()}function WQ(i){return Kye(i)||s2e(i)||XQ(i)||l2e()}function u2e(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 jQ(i){var e=u2e(i,"string");return typeof e=="symbol"?e:e+""}function XQ(i,e){if(i){if(typeof i=="string")return _B(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)?_B(i,e):void 0}}var $Q=function(e){e instanceof Array?e.forEach($Q):(e.map&&e.map.dispose(),e.dispose())},yB=function(e){e.geometry&&e.geometry.dispose(),e.material&&$Q(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(yB)};function YQ(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 h2e(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 gg(i){return i*Math.PI/180}var ZQ=function(e){return 1-(Yb(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},gB=function(e){return Math.max(0,Math.min(1,ZQ(e)))},zQ=function(e){return .5-Yb.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},f2e=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=bl().domain([1,0]).range([t,n]).clamp(!0),s=bl().domain([gB(t),gB(n)]).range([1,0]).clamp(!0),o=function(f){return s(gB(r(f)))},a=e.array,l=0,c=a.length;l<c;l+=2)a[l+1]=o(a[l+1]);e.needsUpdate=!0},VQ=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,ZQ(a))));var l=Math.floor(a*s);return[o,l]},bB=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:zQ(w/l)*l;var P=w+1===l?w+1:zQ((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},d2e=6,p2e=7,m2e=3,A2e=90,ef=new WeakMap,j0=new WeakMap,vB=new WeakMap,wC=new WeakMap,zc=new WeakMap,MC=new WeakMap,g_=new WeakMap,vg=new WeakMap,SC=new WeakSet,KQ=(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 e2e(this,e),n=Jye(this,e),t2e(n,SC),H0(n,ef,void 0),H0(n,j0,void 0),H0(n,vB,void 0),H0(n,wC,void 0),H0(n,zc,{}),H0(n,MC,void 0),H0(n,g_,void 0),H0(n,vg,void 0),A_(n,"minLevel",void 0),A_(n,"maxLevel",void 0),A_(n,"thresholds",WQ(new Array(30)).map(function(d,A){return 8/Math.pow(2,A)})),A_(n,"curvatureResolution",5),A_(n,"tileMargin",0),A_(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)})}),W0(zc,n,{})}),W0(ef,n,t),n.tileUrl=s,W0(j0,n,f),n.minLevel=a,n.maxLevel=c,n.level=0,n.add(W0(vg,n,new Hn(new ka(oi(ef,n)*.99,180,90),new hs({color:0})))),oi(vg,n).visible=!1,oi(vg,n).material.polygonOffset=!0,oi(vg,n).material.polygonOffsetUnits=3,oi(vg,n).material.polygonOffsetFactor=1,n}return r2e(e,i),i2e(e,[{key:"tileUrl",get:function(){return oi(vB,this)},set:function(n){W0(vB,this,n),this.updatePov(oi(g_,this))}},{key:"level",get:function(){return oi(wC,this)},set:function(n){var r,s=this;oi(zc,this)[n]||Zb(SC,this,g2e).call(this,n);var o=oi(wC,this);if(W0(wC,this,n),!(n===o||o===void 0)){if(oi(vg,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)});Zb(SC,this,GQ).call(this)}}},{key:"updatePov",value:function(n){var r=this;if(!(!n||!(n instanceof Ed))){W0(g_,this,n);var s;if(W0(MC,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=TC(P,2),F=I[0],D=I[1];return YQ(F,D,oi(ef,r))}).map(function(P){var I=P.x,F=P.y,D=P.z;return new re(I,F,D)})}return s||(s=new Nc,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(ef,this))/oi(ef,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)),Zb(SC,this,GQ).call(this)}}}}])})(Fr);function g2e(i){var e=this;if(i>p2e){oi(zc,this)[i]=[];return}var t=oi(zc,this)[i]=bB(i,oi(j0,this));t.forEach(function(n){return n.centroid=YQ(n.lat,n.lng,oi(ef,e))}),t.octree=Rb().x(function(n){return n.centroid.x}).y(function(n){return n.centroid.y}).z(function(n){return n.centroid.z}).addAll(t)}function GQ(){var i=this;if(!(!this.tileUrl||this.level===void 0||!oi(zc,this).hasOwnProperty(this.level))&&!(!oi(MC,this)&&this.level>d2e)){var e=oi(zc,this)[this.level];if(oi(g_,this)){var t=this.worldToLocal(oi(g_,this).position.clone());if(e.octree){var n,r=this.worldToLocal(oi(g_,this).position.clone()),s=(r.length()-oi(ef,this))*m2e;e=(n=e.octree).findAllWithinRadius.apply(n,WQ(r).concat([s]))}else{var o=h2e(t),a=(o.r/oi(ef,this)-1)*A2e,l=a/Math.cos(gg(o.lat)),c=[o.lng-l,o.lng+l],u=[o.lat+a,o.lat-a],f=VQ(this.level,oi(j0,this),c[0],u[0]),d=TC(f,2),A=d[0],y=d[1],w=VQ(this.level,oi(j0,this),c[1],u[1]),S=TC(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=bB(this.level,oi(j0,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]=bB(this.level,oi(j0,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(MC,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=gg(z),te=gg(-G),ce=new Hn(new ka(oi(ef,i),Math.ceil(H/i.curvatureResolution),Math.ceil($/i.curvatureResolution),gg(90-H/2)+J,gg(H),gg(90-$/2)+te,gg($)),new za);if(oi(j0,i)){var he=[G+W/2,G-W/2].map(function(Fe){return .5-Fe/180}),ge=TC(he,2),Re=ge[0],Qe=ge[1];f2e(ce.geometry.attributes.uv,Re,Qe)}C.obj=ce}C.loading||(C.loading=!0,new _l().load(i.tileUrl(B,k,i.level),function(Fe){var mt=C.obj;mt&&(Fe.colorSpace=Nr,mt.material.map=Fe,mt.material.color=null,mt.material.needsUpdate=!0,i.add(mt)),C.loading=!1}))})}}var ew=new Set,wB=!1;function IB(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length;ew.size&&ew.clear();let s=tJ(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a=0,l=0,c=0;if(n&&(s=b2e(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 SB(s,o,a,l,c),o}function tJ(i,e,t,n,r){let s=null;if(r===F2e(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=eJ(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=eJ(o/n|0,i[o],i[o+1],s);return s&&tw(s,s.next)&&(iw(s),s=s.next),s}function xg(i,e=i){let t=e===i,n=i,r;do r=!1,n!==n.next&&(ew.size===0||!ew.has(n))&&(tw(n,n.next)||js(n.prev,n,n.next)===0)?((t||n===e)&&(e=n.prev),wB=!0,iw(n),n=n.prev,r=!0):(t||n!==e)&&(n=n.next,r=!t);while(r||n!==e);return e}function SB(i,e,t,n,r){r&&R2e(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?_2e(i,t,n,r):v2e(i))){e.push(a.i,i.i,l.i),iw(i),i=l,s=l;continue}if(i=l,i===s){if(wB=!1,i=xg(i),wB){s=i;continue}if(!o){i=x2e(i,e),s=i,o=!0;continue}y2e(i,e,t,n,r);break}}}function v2e(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)&&PC(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 _2e(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=CB(A,y,e,t,n),R=CB(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)&&PC(a,u,l,f,c,d,P.x,P.y)&&js(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)&&PC(a,u,l,f,c,d,I.x,I.y)&&js(I.prev,I,I.next)>=0)return!1;I=I.nextZ}return!0}function x2e(i,e){let t=i,n=!1;do{let r=t.prev,s=t.next.next;rJ(r,t,t.next,s,!1)&&nw(r,s)&&nw(s,r)&&(e.push(r.i,t.i,s.i),iw(t),iw(t.next),t=i=s,n=!0),t=t.next}while(t!==i);return n?xg(t):t}function y2e(i,e,t,n,r){let s=i;do{let o=s.next.next;for(;o!==s.prev;){if(s.i!==o.i&&L2e(s,o)){let a=sJ(s,o);s=xg(s,s.next),a=xg(a,a.next),SB(s,e,t,n,r),SB(a,e,t,n,r);return}o=o.next}s=s.next}while(s!==i)}var TB=!1;function b2e(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=tJ(i,a,l,n,!1);c===c.next&&ew.add(c),r.push(P2e(c))}r.sort(w2e),T2e(i.length/n,e.length),iJ(t,t),TB=!0;for(let s=0;s<r.length;s++)t=S2e(r[s],t);return TB=!1,xg(t)}function w2e(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 S2e(i,e){let t=M2e(i,e);if(!t)return e;let n=sJ(t,i),r=n.next;return iJ(t,r.next),xg(n,n.next),xg(t,t.next)}var nJ=16,As=new Float64Array(0),IC=0,EB=[],MB=[];function T2e(i,e){let t=Math.ceil((i+2*e)/nJ)+e+2;As.length<t*4&&(As=new Float64Array(t*4)),IC=0}function iJ(i,e){let t=i;do{let n=IC++;EB[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<nJ&&t!==e);MB[n]=t;let c=n*4;As[c]=r,As[c+1]=s,As[c+2]=o,As[c+3]=a}while(t!==e)}function E2e(i,e){let t=i.z*4;e.x<As[t]&&(As[t]=e.x),e.y<As[t+1]&&(As[t+1]=e.y),e.x>As[t+2]&&(As[t+2]=e.x),e.y>As[t+3]&&(As[t+3]=e.y)}function QQ(i){let e=MB[i];for(;e.prev.next!==e;)e=e.next;return MB[i]=e,e}function JQ(i){let e=EB[i];for(;e.prev.next!==e;)e=e.next;return EB[i]=e,e}function M2e(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(tw(i,t))return t;for(let d=0,A=0;d<IC;d++,A+=4){if(r<As[A+1]||r>As[A+3]||As[A]>n||As[A+2]<=s)continue;let y=QQ(d);t=JQ(d);do{if(t.prev.next===t){if(tw(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<IC;d++,A+=4){if(As[A+2]<a||As[A]>n||As[A+3]<c||As[A+1]>u)continue;let y=QQ(d);t=JQ(d);do{if(t.prev.next===t&&n>=t.x&&t.x>=a&&n!==t.x&&PC(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);(nw(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&&C2e(o,t)))&&(o=t,f=w)}t=t.next}while(t!==y)}return o}function C2e(i,e){return js(i.prev,i,e.prev)<0&&js(e.next,i,i.next)<0}var Vc=[],Kb=[],_g=new Uint32Array(0),Qb=new Uint32Array(0),Jb=new Uint32Array(256);function R2e(i,e,t,n){let r=i,s=0;do r.z=CB(r.x,r.y,e,t,n),Vc[s++]=r,r=r.next;while(r!==i);I2e(s);let o=null;for(let a=0;a<s;a++){let l=Vc[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function I2e(i){if(i<=32){for(let e=1;e<i;e++){let t=Vc[e],n=t.z,r=e-1;for(;r>=0&&Vc[r].z>n;)Vc[r+1]=Vc[r],r--;Vc[r+1]=t}return}_g.length<i&&(_g=new Uint32Array(i),Qb=new Uint32Array(i),Kb=new Array(i));for(let e=0;e<i;e++)_g[e]=Vc[e].z;CC(i,Vc,_g,Kb,Qb,0),CC(i,Kb,Qb,Vc,_g,8),CC(i,Vc,_g,Kb,Qb,16),CC(i,Kb,Qb,Vc,_g,24)}function CC(i,e,t,n,r,s){Jb.fill(0);for(let a=0;a<i;a++)Jb[t[a]>>>s&255]++;let o=0;for(let a=0;a<256;a++){let l=Jb[a];Jb[a]=o,o+=l}for(let a=0;a<i;a++){let l=t[a],c=Jb[l>>>s&255]++;n[c]=e[a],r[c]=l}}function CB(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 P2e(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 PC(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 L2e(i,e){let t=tw(i,e)&&js(i.prev,i,i.next)>0&&js(e.prev,e,e.next)>0;return i.next.i!==e.i&&(t||nw(i,e)&&nw(e,i)&&(js(i.prev,i,e.prev)!==0||js(i,e.prev,e)!==0))&&!D2e(i,e)&&(t||N2e(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 tw(i,e){return i.x===e.x&&i.y===e.y}function rJ(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&&RC(i,t,e)||o===0&&RC(i,n,e)||a===0&&RC(t,i,n)||l===0&&RC(t,e,n)):!1}function RC(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 D2e(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&&rJ(o,a,i,e))return!0;o=a}while(o!==i);return!1}function nw(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 N2e(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 sJ(i,e){let t=RB(i.i,i.x,i.y),n=RB(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 eJ(i,e,t,n){let r=RB(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 iw(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),TB&&E2e(i.prev,i.next)}function RB(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function F2e(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 v_(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 LB(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 B2e(i){if(Array.isArray(i))return i}function O2e(i){if(Array.isArray(i))return LB(i)}function U2e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function k2e(i,e,t){return e=LC(e),$2e(i,lJ()?Reflect.construct(e,[],LC(i).constructor):e.apply(i,t))}function z2e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function V2e(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function G2e(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=FB(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 LC(i){return LC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},LC(i)}function q2e(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&&DB(i,e)}function lJ(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(lJ=function(){return!!i})()}function H2e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function W2e(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 j2e(){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 X2e(){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 $2e(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 U2e(i)}function DB(i,e){return DB=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},DB(i,e)}function rw(i,e){return B2e(i)||W2e(i,e)||FB(i,e)||j2e()}function Y2e(i){return O2e(i)||H2e(i)||FB(i)||X2e()}function FB(i,e){if(i){if(typeof i=="string")return LB(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)?LB(i,e):void 0}}var oJ=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=Sl(s,r)*180/Math.PI;if(o>t)for(var a=Ag(r,s),l=r.length>2||s.length>2?Kh(r[2]||0,s[2]||0):null,c=l?function(d){return[].concat(Y2e(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},NB=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:Xn,Float32BufferAttribute:Ln},Z2e=new NB.BufferGeometry().setAttribute?"setAttribute":"addAttribute",BB=(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;z2e(this,e),n=k2e(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[Z2e]("position",new NB.Float32BufferAttribute(l,3));function u(S,T){var R=PB(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=rw(P,1),F=I[0];sw(R,F)}),[R]}function d(S,T){for(var R=oJ(S,s).map(function(C){var B=rw(C,3),k=B[0],z=B[1],G=B[2],W=G===void 0?0:G;return PB(z,k,T+W)}),P=v_([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=rw(P,1),F=I[0];sw(R,F)}),[R]}function y(S,T){for(var R=S.map(function(H){return oJ(H,s).map(function($){var J=rw($,3),te=J[0],ce=J[1],he=J[2],ge=he===void 0?0:he;return PB(ce,te,T+ge)})}),P=v_(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=rw(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 q2e(e,i),V2e(e)})(NB.BufferGeometry);function sw(i,e){var t=Math.round(i.vertices.length/3);aJ(i.vertices,e.vertices),aJ(i.indices,e.indices.map(function(n){return n+t}))}function aJ(i,e){var t=G2e(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 PB(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 ow={};Lue(ow,{computeMikkTSpaceTangents:()=>K2e,computeMorphedAttributes:()=>sbe,deepCloneAttribute:()=>J2e,deinterleaveAttribute:()=>DC,deinterleaveGeometry:()=>tbe,estimateBytesUsed:()=>nbe,interleaveAttributes:()=>ebe,mergeAttributes:()=>OB,mergeGeometries:()=>Q2e,mergeGroups:()=>obe,mergeVertices:()=>ibe,toCreasedNormals:()=>abe,toTrianglesDrawMode:()=>rbe});function K2e(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 Q2e(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=OB(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=OB(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 OB(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 J2e(i){return i.isInstancedInterleavedBufferAttribute||i.isInterleavedBufferAttribute?DC(i):i.isInstancedBufferAttribute?new Xl().copy(i):new Hi().copy(i)}function ebe(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 Sd(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 Uo(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 DC(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 Xl(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 tbe(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,DC(s)),e[r]=n.get(s))}for(let r in t){let s=t[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,DC(s)),t[r]=n.get(s))}}function nbe(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 ibe(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 rbe(i,e){if(e===b8)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===xM||e===w8){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===xM)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 sbe(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,ge,Re,Qe,Fe,mt,Ee){e.fromBufferAttribute(he,Qe),t.fromBufferAttribute(he,Fe),n.fromBufferAttribute(he,mt);let Ve=ce.morphTargetInfluences;if(ge&&Ve){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let Ye=0,Mt=ge.length;Ye<Mt;Ye++){let Et=Ve[Ye],It=ge[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 obe(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 abe(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,ge=$*he-J*ce,Re=J*te-H*he,Qe=H*ce-$*te,Fe=1/(Math.sqrt(ge*ge+Re*Re+Qe*Qe)||1);c[3*I+0]=ge*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],ge=c[te+2];D*ce+L*he+C*ge>o&&(G+=ce,W+=he,Y+=ge)}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 NC(i){"@babel/helpers - typeof";return NC=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},NC(i)}var lbe=/^\s+/,cbe=/\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=ube(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=mJ(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=uJ(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=uJ(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=cJ(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=cJ(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 hJ(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return pbe(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(Or(this._r,255)*100)+"%",g:Math.round(Or(this._g,255)*100)+"%",b:Math.round(Or(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Or(this._r,255)*100)+"%, "+Math.round(Or(this._g,255)*100)+"%, "+Math.round(Or(this._b,255)*100)+"%)":"rgba("+Math.round(Or(this._r,255)*100)+"%, "+Math.round(Or(this._g,255)*100)+"%, "+Math.round(Or(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Ebe[hJ(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+fJ(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=An(e);n="#"+fJ(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(vbe,arguments)},brighten:function(){return this._applyModification(_be,arguments)},darken:function(){return this._applyModification(xbe,arguments)},desaturate:function(){return this._applyModification(mbe,arguments)},saturate:function(){return this._applyModification(Abe,arguments)},greyscale:function(){return this._applyModification(gbe,arguments)},spin:function(){return this._applyModification(ybe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(Sbe,arguments)},complement:function(){return this._applyCombination(bbe,arguments)},monochromatic:function(){return this._applyCombination(Tbe,arguments)},splitcomplement:function(){return this._applyCombination(wbe,arguments)},triad:function(){return this._applyCombination(dJ,[3])},tetrad:function(){return this._applyCombination(dJ,[4])}};An.fromRatio=function(i,e){if(NC(i)=="object"){var t={};for(var n in i)i.hasOwnProperty(n)&&(n==="a"?t[n]=i[n]:t[n]=aw(i[n]));i=t}return An(i,e)};function ube(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=Ibe(i)),NC(i)=="object"&&(Bd(i.r)&&Bd(i.g)&&Bd(i.b)?(e=hbe(i.r,i.g,i.b),o=!0,a=String(i.r).substr(-1)==="%"?"prgb":"rgb"):Bd(i.h)&&Bd(i.s)&&Bd(i.v)?(n=aw(i.s),r=aw(i.v),e=dbe(i.h,n,r),o=!0,a="hsv"):Bd(i.h)&&Bd(i.s)&&Bd(i.l)&&(n=aw(i.s),s=aw(i.l),e=fbe(i.h,n,s),o=!0,a="hsl"),i.hasOwnProperty("a")&&(t=i.a)),t=mJ(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 hbe(i,e,t){return{r:Or(i,255)*255,g:Or(e,255)*255,b:Or(t,255)*255}}function cJ(i,e,t){i=Or(i,255),e=Or(e,255),t=Or(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 fbe(i,e,t){var n,r,s;i=Or(i,360),e=Or(e,100),t=Or(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 uJ(i,e,t){i=Or(i,255),e=Or(e,255),t=Or(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 dbe(i,e,t){i=Or(i,360)*6,e=Or(e,100),t=Or(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 hJ(i,e,t,n){var r=[Uu(Math.round(i).toString(16)),Uu(Math.round(e).toString(16)),Uu(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 pbe(i,e,t,n,r){var s=[Uu(Math.round(i).toString(16)),Uu(Math.round(e).toString(16)),Uu(Math.round(t).toString(16)),Uu(AJ(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 fJ(i,e,t,n){var r=[Uu(AJ(n)),Uu(Math.round(i).toString(16)),Uu(Math.round(e).toString(16)),Uu(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 mbe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.s-=e/100,t.s=FC(t.s),An(t)}function Abe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.s+=e/100,t.s=FC(t.s),An(t)}function gbe(i){return An(i).desaturate(100)}function vbe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.l+=e/100,t.l=FC(t.l),An(t)}function _be(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 xbe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.l-=e/100,t.l=FC(t.l),An(t)}function ybe(i,e){var t=An(i).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,An(t)}function bbe(i){var e=An(i).toHsl();return e.h=(e.h+180)%360,An(e)}function dJ(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 wbe(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 Sbe(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 Tbe(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=Pbe(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 UB=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"},Ebe=An.hexNames=Mbe(UB);function Mbe(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function mJ(i){return i=parseFloat(i),(isNaN(i)||i<0||i>1)&&(i=1),i}function Or(i,e){Cbe(i)&&(i="100%");var t=Rbe(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 FC(i){return Math.min(1,Math.max(0,i))}function Jl(i){return parseInt(i,16)}function Cbe(i){return typeof i=="string"&&i.indexOf(".")!=-1&&parseFloat(i)===1}function Rbe(i){return typeof i=="string"&&i.indexOf("%")!=-1}function Uu(i){return i.length==1?"0"+i:""+i}function aw(i){return i<=1&&(i=i*100+"%"),i}function AJ(i){return Math.round(parseFloat(i)*255).toString(16)}function pJ(i){return Jl(i)/255}var Ou=(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 Bd(i){return!!Ou.CSS_UNIT.exec(i)}function Ibe(i){i=i.replace(lbe,"").replace(cbe,"").toLowerCase();var e=!1;if(UB[i])i=UB[i],e=!0;else if(i=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Ou.rgb.exec(i))?{r:t[1],g:t[2],b:t[3]}:(t=Ou.rgba.exec(i))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Ou.hsl.exec(i))?{h:t[1],s:t[2],l:t[3]}:(t=Ou.hsla.exec(i))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Ou.hsv.exec(i))?{h:t[1],s:t[2],v:t[3]}:(t=Ou.hsva.exec(i))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Ou.hex8.exec(i))?{r:Jl(t[1]),g:Jl(t[2]),b:Jl(t[3]),a:pJ(t[4]),format:e?"name":"hex8"}:(t=Ou.hex6.exec(i))?{r:Jl(t[1]),g:Jl(t[2]),b:Jl(t[3]),format:e?"name":"hex"}:(t=Ou.hex4.exec(i))?{r:Jl(t[1]+""+t[1]),g:Jl(t[2]+""+t[2]),b:Jl(t[3]+""+t[3]),a:pJ(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Ou.hex3.exec(i))?{r:Jl(t[1]+""+t[1]),g:Jl(t[2]+""+t[2]),b:Jl(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function Pbe(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 GB(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 Lbe(i){if(Array.isArray(i))return i}function Dbe(i){if(Array.isArray(i))return GB(i)}function gJ(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 Nbe(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Fbe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function fa(i,e){return i.get(gJ(i,e))}function __(i,e,t){Nbe(i,e),e.set(i,t)}function BC(i,e,t){return i.set(gJ(i,e),t),t}function Bbe(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,Wbe(n.key),n)}}function Obe(i,e,t){return e&&Bbe(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Ube(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function kbe(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 zbe(){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 Vbe(){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 Gbe(i,e){return Lbe(i)||kbe(i,e)||vJ(i,e)||zbe()}function qbe(i){return Dbe(i)||Ube(i)||vJ(i)||Vbe()}function Hbe(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 Wbe(i){var e=Hbe(i,"string");return typeof e=="symbol"?e:e+""}function vJ(i,e){if(i){if(typeof i=="string")return GB(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)?GB(i,e):void 0}}var x_=new WeakMap,lw=new WeakMap,y_=new WeakMap,kB=new WeakMap,zB=new WeakMap,VB=new WeakMap,_J=(function(){function i(){Fbe(this,i),__(this,x_,new Map),__(this,lw,new Map),__(this,y_,function(e){return e}),__(this,kB,function(){return{}}),__(this,zB,function(){}),__(this,VB,function(){})}return Obe(i,[{key:"getObj",value:function(t){return fa(x_,this).get(fa(y_,this).call(this,t))}},{key:"getData",value:function(t){return fa(lw,this).get(t)}},{key:"entries",value:function(){return qbe(fa(lw,this).entries()).map(function(t){var n=Gbe(t,2),r=n[0],s=n[1];return[s,r]})}},{key:"id",value:function(t){return BC(y_,this,st(t)),this}},{key:"onCreateObj",value:function(t){return BC(kB,this,t),this}},{key:"onUpdateObj",value:function(t){return BC(zB,this,t),this}},{key:"onRemoveObj",value:function(t){return BC(VB,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(s){return!fa(x_,n).has(fa(y_,n).call(n,s))}).forEach(function(s){var o=fa(kB,n).call(n,s);fa(x_,n).set(fa(y_,n).call(n,s),o),fa(lw,n).set(o,s)});var r=new Map(t.map(function(s){return[fa(y_,n).call(n,s),s]}));return fa(x_,this).forEach(function(s,o){r.has(o)?fa(zB,n).call(n,s,r.get(o)):(fa(VB,n).call(n,s,o),fa(x_,n).delete(o),fa(lw,n).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})();var s1=cq(xJ(),1);var Ei=11102230246251565e-32,Xs=134217729,uw=(3+8*Ei)*Ei;function yg(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 hw(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 jbe=(3+16*Ei)*Ei,Xbe=(2+12*Ei)*Ei,$be=(9+64*Ei)*Ei*Ei,b_=ht(4),yJ=ht(8),bJ=ht(12),wJ=ht(16),ja=ht(4);function Ybe(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=Xs*B,A=d-(d-B),y=B-A,d=Xs*G,w=d-(d-G),S=G-w,F=y*S-(I-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,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=hw(4,b_),Y=Xbe*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=$be*o+uw*Math.abs(W),W+=B*u+G*a-(z*c+k*l),W>=Y||-W>=Y))return W;I=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-(I-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,ja[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,ja[1]=P-(T+f)+(f-D),C=R+T,f=C-R,ja[2]=R-(C-f)+(T-f),ja[3]=C;let H=yg(4,b_,4,ja,yJ);I=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-(I-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,ja[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,ja[1]=P-(T+f)+(f-D),C=R+T,f=C-R,ja[2]=R-(C-f)+(T-f),ja[3]=C;let $=yg(H,yJ,4,ja,bJ);I=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-(I-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,ja[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,ja[1]=P-(T+f)+(f-D),C=R+T,f=C-R,ja[2]=R-(C-f)+(T-f),ja[3]=C;let J=yg($,bJ,4,ja,wJ);return wJ[J-1]}function X0(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)>=jbe*c?l:-Ybe(i,e,t,n,r,s,c)}var Dit=(7+56*Ei)*Ei,Nit=(3+28*Ei)*Ei,Fit=(26+288*Ei)*Ei*Ei,Bit=ht(4),Oit=ht(4),Uit=ht(4),kit=ht(4),zit=ht(4),Vit=ht(4),Git=ht(4),qit=ht(4),Hit=ht(4),Wit=ht(8),jit=ht(8),Xit=ht(8),$it=ht(4),Yit=ht(8),Zit=ht(8),Kit=ht(16),Qit=ht(12),Jit=ht(192),ert=ht(192);var irt=(10+96*Ei)*Ei,rrt=(4+48*Ei)*Ei,srt=(44+576*Ei)*Ei*Ei,ort=ht(4),art=ht(4),lrt=ht(4),crt=ht(4),urt=ht(4),hrt=ht(4),frt=ht(4),drt=ht(4),prt=ht(8),mrt=ht(8),Art=ht(8),grt=ht(8),vrt=ht(8),_rt=ht(8),xrt=ht(8),yrt=ht(8),brt=ht(8),wrt=ht(4),Srt=ht(4),Trt=ht(4),Ert=ht(8),Mrt=ht(16),Crt=ht(16),Rrt=ht(16),Irt=ht(32),Prt=ht(32),Lrt=ht(48),Drt=ht(64),Nrt=ht(1152),Frt=ht(1152);var krt=(16+224*Ei)*Ei,zrt=(5+72*Ei)*Ei,Vrt=(71+1408*Ei)*Ei*Ei,Grt=ht(4),qrt=ht(4),Hrt=ht(4),Wrt=ht(4),jrt=ht(4),Xrt=ht(4),$rt=ht(4),Yrt=ht(4),Zrt=ht(4),Krt=ht(4),Qrt=ht(24),Jrt=ht(24),est=ht(24),tst=ht(24),nst=ht(24),ist=ht(24),rst=ht(24),sst=ht(24),ost=ht(24),ast=ht(24),lst=ht(1152),cst=ht(1152),ust=ht(1152),hst=ht(1152),fst=ht(1152),dst=ht(2304),pst=ht(2304),mst=ht(3456),Ast=ht(5760),gst=ht(8),vst=ht(8),_st=ht(8),xst=ht(16),yst=ht(24),bst=ht(48),wst=ht(48),Sst=ht(96),Tst=ht(192),Est=ht(384),Mst=ht(384),Cst=ht(384),Rst=ht(768);var Ist=ht(96),Pst=ht(96),Lst=ht(96),Dst=ht(1152);var TJ=Math.pow(2,-52),OC=new Uint32Array(512),$0=class i{static from(e,t=twe,n=nwe){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=HB(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=HB(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=Jbe(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];w_(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(X0(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=ewe(S,T,R,P,F,D);this._cx=L.x,this._cy=L.y;for(let B=0;B<o;B++)this._dists[B]=HB(e[2*B],e[2*B+1],L.x,L.y);w_(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)<=TJ&&Math.abs(Y-z)<=TJ||(k=W,z=Y,G===A||G===y||G===w))continue;let H=0;for(let he=0,ge=this._hashKey(W,Y);he<this._hashSize&&(H=s[(ge+he)%this._hashSize],!(H!==-1&&H!==n[H]));he++);H=t[H];let $=H,J;for(;J=n[$],X0(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],X0(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[$],X0(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(Kbe(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=OC[--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(Qbe(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<OC.length&&(OC[s++]=R)}else{if(s===0)break;e=OC[--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 Kbe(i,e){let t=i/(Math.abs(i)+Math.abs(e));return(e>0?3-t:1+t)/4}function HB(i,e,t,n){let r=i-t,s=e-n;return r*r+s*s}function Qbe(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 Jbe(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 ewe(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 w_(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;fw(i,r,s),e[i[t]]>e[i[n]]&&fw(i,t,n),e[i[s]]>e[i[n]]&&fw(i,s,n),e[i[t]]>e[i[s]]&&fw(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;fw(i,s,o)}i[t+1]=i[o],i[o]=a,n-s+1>=o-t?(w_(i,e,s,n),w_(i,e,t,o-1)):(w_(i,e,t,o-1),w_(i,e,s,n))}}function fw(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function twe(i){return i[0]}function nwe(i){return i[1]}function EJ(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=X0(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 MJ(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 CJ(i){return i.type==="Feature"?i.geometry:i}function iwe(i,e,t={}){if(!i)throw new Error("point is required");if(!e)throw new Error("polygon is required");let n=MJ(i),r=CJ(e),s=r.type,o=e.bbox,a=r.coordinates;if(o&&rwe(n,o)===!1)return!1;s==="Polygon"&&(a=[a]);let l=!1;for(var c=0;c<a.length;++c){let u=EJ(n,a[c]);if(u===0)return!t.ignoreBoundary;u&&(l=!0)}return l}function rwe(i,e){return e[0]<=i[0]&&e[1]<=i[1]&&e[2]>=i[0]&&e[3]>=i[1]}var RJ=iwe;var Gc=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 Y0=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 dw=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 Gc: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 Gc: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 Gc: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 Y0;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 swe=2*Math.PI,S_=Math.pow;function owe(i){return i[0]}function awe(i){return i[1]}function lwe(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 cwe(i,e,t){return[i+Math.sin(i+e)*t,e+Math.cos(i-e)*t]}var T_=class i{static from(e,t=owe,n=awe,r){return new i("length"in e?uwe(e,t,n,r):Float64Array.from(hwe(e,t,n,r)))}constructor(e){this._delaunator=new $0(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&&lwe(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=cwe(t[2*d],t[2*d+1],f);t[2*d]=y[0],t[2*d+1]=y[1]}this._delaunator=new $0(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 dw(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=S_(t-c[e*2],2)+S_(n-c[e*2+1],2),d=r[e],A=d;do{let y=l[A],w=S_(t-c[y*2],2)+S_(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&&S_(t-c[A*2],2)+S_(n-c[A*2+1],2)<f)return A;break}}while(A!==d);return u}render(e){let t=e==null?e=new Gc: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 Gc: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,swe)}return n&&n.value()}renderHull(e){let t=e==null?e=new Gc: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 Y0;return this.renderHull(e),e.value()}renderTriangle(e,t){let n=t==null?t=new Gc: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 Y0;return this.renderTriangle(e,t),t.value()}};function uwe(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*hwe(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,IJ=pw/2,dot=pw/4,pot=pw*2,WB=180/pw,jB=pw/180;var XB=Math.atan2,UC=Math.cos;var PJ=Math.max,LJ=Math.min;var kC=Math.sin,DJ=Math.sign||function(i){return i>0?1:i<0?-1:0},zC=Math.sqrt;function $B(i){return i>1?IJ:i<-1?-IJ:Math.asin(i)}function YB(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Tl(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 mw(i,e){return[i[0]+e[0],i[1]+e[1],i[2]+e[2]]}function Aw(i){var e=zC(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);return[i[0]/e,i[1]/e,i[2]/e]}function ZB(i){return[XB(i[1],i[0])*WB,$B(PJ(-1,LJ(1,i[2])))*WB]}function tf(i){let e=i[0]*jB,t=i[1]*jB,n=UC(t);return[n*UC(e),n*kC(e),kC(t)]}function VC(i){return i=i.map(e=>tf(e)),YB(i[0],Tl(i[2],i[1]))}function FJ(i){let e=dwe(i),t=mwe(e),n=pwe(t,i),r=gwe(t,i.length),s=fwe(r,i),o=Awe(t,i),{polygons:a,centers:l}=vwe(o,t,i),c=_we(a),u=ywe(t,i),f=xwe(n,t);return{delaunay:e,edges:n,triangles:t,centers:l,neighbors:r,polygons:a,mesh:c,hull:u,urquhart:f,find:s}}function fwe(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=tf([r,s]);do a=o,o=null,l=t(u,tf(e[a])),i[a].forEach(f=>{let d=t(u,tf(e[f]));if(d<l){l=d,o=f,c=f;return}});while(o!==null);return c}}function dwe(i){if(i.length<2)return{};let e=0;for(;isNaN(i[e][0]+i[e][1])&&e++<i.length;);let t=QF(i[e]),n=AB().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*zC(s);r.forEach(d=>i[d]=[o,0]),i.push([0,o]),i.push([-o,0]),i.push([0,-o]);let a=T_.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 pwe(i,e){let t=new Set;return e.length===2?[[0,1]]:(i.forEach(n=>{if(n[0]!==n[1]&&!(VC(n.map(r=>e[r]))<0))for(let r=0,s;r<3;r++)s=(r+1)%3,t.add(z0([n[r],n[s]]).join("-"))}),Array.from(t,n=>n.split("-").map(Number)))}function mwe(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 Awe(i,e){return i.map(t=>{let n=t.map(s=>e[s]).map(tf),r=mw(mw(Tl(n[1],n[0]),Tl(n[2],n[1])),Tl(n[0],n[2]));return ZB(Aw(r))})}function gwe(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 vwe(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=tf(t[0]),l=tf(t[1]),c=Aw(mw(a,l)),u=Aw(Tl(a,l)),f=Tl(c,u),d=[c,Tl(c,f),Tl(Tl(c,f),f),Tl(Tl(Tl(c,f),f),f)].map(ZB).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=NJ(t[a[0][3][0]],t[a[0][3][1]],r[l[0]]),f=NJ(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 NJ(i,e,t){i=tf(i),e=tf(e),t=tf(t);let n=DJ(YB(Tl(e,i),t));return ZB(Aw(mw(i,e)).map(r=>n*r))}function _we(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 xwe(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=z0([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 ywe(i,e){let t=new Set,n=[];i.map(a=>{if(!(VC(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 KB(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=FJ(e.points)}return e};return e._vx=function(t){if(typeof t=="object"&&"type"in t)return hC(t)[0];if(0 in t)return t[0]},e._vy=function(t){if(typeof t=="object"&&"type"in t)return hC(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=>VC(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=>Sl(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||Sl([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 JB(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 bwe(i){if(Array.isArray(i))return i}function wwe(i){if(Array.isArray(i))return JB(i)}function Swe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Twe(i,e,t){return e=qC(e),Dwe(i,OJ()?Reflect.construct(e,[],qC(i).constructor):e.apply(i,t))}function Ewe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Mwe(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function qC(i){return qC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},qC(i)}function Cwe(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&&eO(i,e)}function OJ(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(OJ=function(){return!!i})()}function Rwe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Iwe(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 Pwe(){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 Lwe(){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 Dwe(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 Swe(i)}function eO(i,e){return eO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},eO(i,e)}function nf(i,e){return bwe(i)||Iwe(i,e)||UJ(i,e)||Pwe()}function QB(i){return wwe(i)||Rwe(i)||UJ(i)||Lwe()}function UJ(i,e){if(i){if(typeof i=="string")return JB(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)?JB(i,e):void 0}}function Nwe(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=Fwe(i,n),s=Yh(r),o=Bwe(i,n),a=[].concat(QB(s),QB(o)),l={type:"Polygon",coordinates:i},c=iC(l),u=nf(c,2),f=nf(u[0],2),d=f[0],A=f[1],y=nf(u[1],2),w=y[0],S=y[1],T=d>w||S>=89||A<=-89,R=[];if(T){var P=KB(a).triangles(),I=new Map(a.map(function(J,te){var ce=nf(J,2),he=ce[0],ge=ce[1];return["".concat(he,"-").concat(ge),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=nf(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 ge=J.properties.circumcenter;if(!tO(ge,l,T))return}(te=R).push.apply(te,he)}})}else if(o.length)for(var B=$0.from(a),k=function(te){var ce,he=[2,1,0].map(function(Qe){return B.triangles[te+Qe]}),ge=he.map(function(Qe){return a[Qe]});if(he.some(function(Qe){return Qe<s.length})){var Re=[0,1].map(function(Qe){return kM(ge,function(Fe){return Fe[Qe]})});if(!tO(Re,l,T))return 1}(ce=R).push.apply(ce,QB(he))},z=0,G=B.triangles.length;z<G;z+=3)k(z);else{var F=v_(r),D=F.vertices,L=F.holes,C=L===void 0?[]:L;R=IB(D,C,2)}var W=bl(z0(a,function(J){return J[0]}),[0,1]),Y=bl(z0(a,function(J){return J[1]}),[0,1]),H=a.map(function(J){var te=nf(J,2),ce=te[0],he=te[1];return[W(ce),Y(he)]}),$={points:a,indices:R,uvs:H};return{contour:r,triangles:$}}function Fwe(i,e){return i.map(function(t){var n=[],r;return t.forEach(function(s){if(r){var o=Sl(s,r)*180/Math.PI;if(o>e)for(var a=Ag(r,s),l=1/Math.ceil(o/e),c=l;c<1;)n.push(a(c)),c+=l}n.push(r=s)}),n})}function Bwe(i,e){var t={type:"Polygon",coordinates:i},n=iC(t),r=nf(n,2),s=nf(r[0],2),o=s[0],a=s[1],l=nf(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 Owe(e,{minLng:o,maxLng:c,minLat:a,maxLat:u}).filter(function(d){return tO(d,t,f)})}function Owe(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 tO(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?sB(e,i):RJ(i,e)}var GC=window.THREE?window.THREE:{BufferGeometry:Xn,Float32BufferAttribute:Ln},BJ=new GC.BufferGeometry().setAttribute?"setAttribute":"addAttribute",HC=(function(i){function e(t,n,r,s,o,a,l){var c;Ewe(this,e),c=Twe(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=Nwe(t,{resolution:l}),f=u.contour,d=u.triangles,A=Yh(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[BJ]("position",new GC.Float32BufferAttribute(y,3)),c[BJ]("uv",new GC.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=nf(z,2),W=G[0],Y=G[1];return Uwe(Y,W,C(W,Y))})});return v_(B)}function I(){for(var D=P(f,n),L=D.vertices,C=D.holes,B=P(f,r),k=B.vertices,z=Yh([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 ge=0;ge<G;ge+=1)ce.push(ge/(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 Cwe(e,i),Mwe(e)})(GC.BufferGeometry);function Uwe(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 nO(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 kwe(i){if(Array.isArray(i))return i}function zwe(i){if(Array.isArray(i))return nO(i)}function Vwe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Gwe(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 qwe(){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 Hwe(){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 Wwe(i,e){if(i==null)return{};var t,n,r=jwe(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 jwe(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 Xwe(i,e){return kwe(i)||Gwe(i,e)||kJ(i,e)||qwe()}function $we(i){return zwe(i)||Vwe(i)||kJ(i)||Hwe()}function Ywe(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 Zwe(i){var e=Ywe(i,"string");return typeof e=="symbol"?e:e+""}function kJ(i,e){if(i){if(typeof i=="string")return nO(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)?nO(i,e):void 0}}var zJ=(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=Wwe(S,[A].map(Zwe));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=Xwe(u,2),d=f[0],A=f[1];return a(A,[].concat($we(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":ge[Le>>3]=it;break;default:Dm("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 ge[Le>>3];default:Dm("invalid type for getValue: "+it)}return null}var S=!1;function T(Le,it){Le||Dm("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 VS=(ii.length<<2)+1;zi=gG(VS),B(ii,zi,VS)}return zi},array:function(ii){var zi=gG(ii.length);return z(ii,zi),zi}};function Ii(ii){return it==="string"?L(ii):it==="boolean"?!!ii:ii}var ie=R(Le),or=[],rl=0;if(He)for(var ho=0;ho<He.length;ho++){var Ks=sr[Dt[ho]];Ks?(rl===0&&(rl=Gle()),or[ho]=Ks(He[ho])):or[ho]=He[ho]}var ys=ie.apply(null,or);return ys=Ii(ys),rl!==0&&Vle(rl),ys}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 rl=Ii-65536;sr+=String.fromCharCode(55296|rl>>10,56320|rl&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,ge;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=ge=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,ve=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),ve)){var it=ve;ve=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 sn(Le,it,Dt,He){Dm("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){Dm("OOM")}function Dn(Le){try{var it=new ArrayBuffer(Le);return it.byteLength!=Le?void 0:(new Int8Array(it).set(Y),on(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,rl,ho=0;Le=Le.replace(/[^A-Za-z0-9\+\/\=]/g,"");do Ii=it.indexOf(Le.charAt(ho++)),ie=it.indexOf(Le.charAt(ho++)),or=it.indexOf(Le.charAt(ho++)),rl=it.indexOf(Le.charAt(ho++)),He=Ii<<2|ie>>4,h=(ie&15)<<4|or>>2,sr=(or&3)<<6|rl,Dt=Dt+String.fromCharCode(He),or!==64&&(Dt=Dt+String.fromCharCode(h)),rl!==64&&(Dt=Dt+String.fromCharCode(sr));while(ho<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:Dm,b:f,c:d,d:sn,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,rl=it.p|0,ho=Le.Math.floor,Ks=Le.Math.abs,ys=Le.Math.sqrt,ii=Le.Math.cos,zi=Le.Math.sin,VS=Le.Math.tan,qle=Le.Math.acos,Px=Le.Math.asin,yG=Le.Math.atan,wa=Le.Math.atan2,u1=Le.Math.ceil,sl=Le.Math.imul,UP=Le.Math.min,Hle=Le.Math.max,zf=Le.Math.clz32,Wle=it.a,On=it.b,ee=it.c,di=it.d,bG=it.e,jle=it.f,Xle=it.g,$le=it.h,Yle=it.i,Q=28416;function Zle(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 Kle(p){p=p|0;var m=0;return m=Q,Q=Q+p|0,Q=Q+15&-16,m|0}function Qle(){return Q|0}function Jle(p){p=p|0,Q=p}function ece(p,m){p=p|0,m=m|0,Q=p}function tce(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=WS(15,m)|0,m|0):(g=((p|0)<0)<<31>>31,v=br(p|0,g|0,3,0)|0,_=ee()|0,g=At(p|0,g|0,1,0)|0,g=br(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 wG(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,SG(p,m,g,_,0)|0}function SG(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,!(TG(p,m,g,_,v)|0))return _=0,Q=M,_|0;do if((g|0)>=0){if((g|0)>13780509){if(x=WS(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=br(g|0,x|0,3,0)|0,E=ee()|0,x=At(g|0,x|0,1,0)|0,x=br(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(ip(_|0,0,b<<3|0)|0,v|0){ip(v|0,0,b<<2|0)|0,x=eh(p,m,g,_,v,b,E,0)|0;break}x=Sa(b,4)|0,x?(N=eh(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 TG(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,O=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(O=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=_+(O<<3)|0,h[p>>2]=x,h[p+4>>2]=m,h[v+(O<<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 O=O+1|0,N=b?0:p,q=b?M?0:E:q}else for(O=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=_+(O<<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 O=O+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 eh(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,O=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=Vf(p|0,m|0,x|0,b|0)|0,O=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,O|0,1,0)|0,M=np(M|0,ee()|0,x|0,b|0)|0,O=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=eh(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=eh(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=eh(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=eh(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=eh(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=eh(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,O=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,O=q&127,O>>>0>121)return v=5,v|0;M=ol(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=(mc(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+(O*28|0)+(g<<2)>>2]|0,X=ft(K|0,0,45)|0,p=X|p,m=ee()|0|m&-1040385,g=h[4272+(O*28|0)+(g<<2)>>2]|0,(K&127|0)==127&&(K=ft(h[848+(O*28|0)+20>>2]|0,0,45)|0,m=ee()|0|m&-1040385,g=h[4272+(O*28|0)+20>>2]|0,p=Nm(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(xr(E)|0){t:do if((ol(p,m)|0)==1){if((O|0)!=(E|0))if(RG(E,h[7696+(O*28|0)>>2]|0)|0){p=ZP(p,m)|0,b=1,m=ee()|0;break}else di(27634,26928,533,26936);switch(M|0){case 3:{p=Nm(p,m)|0,m=ee()|0,h[_>>2]=(h[_>>2]|0)+1,b=0;break t}case 5:{p=ZP(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=YP(p,m)|0,m=ee()|0,x=x+1|0;while((x|0)!=(g|0))}if((O|0)!=(E|0)){if(!(kP(E)|0)){if((b|0)!=0|(ol(p,m)|0)!=5)break;h[_>>2]=(h[_>>2]|0)+1;break}switch(q&127){case 8:case 118:break e;default:}(ol(p,m)|0)!=3&&(h[_>>2]=(h[_>>2]|0)+1)}}else if((g|0)>0){x=0;do p=Nm(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 nce(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,EG(p,m,g,_)|0?(ip(_|0,0,g*48|0)|0,_=ice(p,m,g,_)|0,_|0):(_=0,_|0)}function EG(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,O=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));O=_,h[O>>2]=q,h[O+4>>2]=m,O=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)!=(O|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 ice(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,O=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=WS(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,O=br(g|0,v|0,3,0)|0,x=ee()|0,v=At(g|0,v|0,1,0)|0,v=br(O|0,x|0,v|0,ee()|0)|0,v=At(v|0,ee()|0,1,0)|0,x=ee()|0,O=b,h[O>>2]=v,h[O+4>>2]=x;if(N=Sa(v,8)|0,!N)v=13;else{if(O=Sa(v,4)|0,!O){_t(N),v=13;break}if(v=eh(p,m,g,N,O,v,x,0)|0,v|0){_t(N),_t(O);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[O+(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(O),v=0}}else v=2;while(!1);return j=v,Q=q,j|0}function GS(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 rce(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,XG(x,v),g=DG(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 MG(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,O=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,Co=0,Vn=0,wi=0,Ta=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=_ce(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)),Ta=+ie[Ut>>3],M=Js(N|0,M|0,xe|0,se|0)|0,wi=+(M>>>0)+4294967296*+(ee()|0),Co=+(xe>>>0)+4294967296*+(se|0),ie[Be>>3]=Vn*(Ta*wi)+Vn*(+ie[lt>>3]*Co),ie[je>>3]=Vn*(+ie[be>>3]*wi)+Vn*(+ie[gt>>3]*Co),M=KP(Be,_,Ke)|0,M|0){E=M;break}ue=Ke,ae=h[ue>>2]|0,ue=h[ue+4>>2]|0,j=Vf(ae|0,ue|0,m|0,g|0)|0,O=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,O|0,1,0)|0,j=np(M|0,ee()|0,m|0,g|0)|0,O=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 sce(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,O=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,Co=0,Vn=0,wi=0;if(wi=Q,Q=Q+112|0,pi=wi+80|0,M=wi+72|0,bi=wi,Co=wi+56|0,v=kx(g)|0,v|0)return Vn=v,Q=wi,Vn|0;if(N=p+8|0,Vn=yr((h[N>>2]<<5)+32|0)|0,!Vn)return Vn=13,Q=wi,Vn|0;if(rL(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,XG(M,pi),v=DG(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=Sa(lt,8)|0,!g)return _t(Vn),Vn=13,Q=wi,Vn|0;if(E=Sa(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=MG(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=MG((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<>>>0>0&&ip(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,TG(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=Sa(7,4)|0,E|0&&(eh(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(O=Vf(X|0,K|0,lt|0,pt|0)|0,N=ee()|0,E=_+(O<<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(O|0,N|0,1,0)|0,O=np(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=_+(O<<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}d1(X,K,Co)|0,sL(p,Vn,Co)|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 oce(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=yce(p,m,((m|0)<0)<<31>>31,b)|0,p|0)return b=p,Q=E,b|0;if(x=nue(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 pc(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=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=+wa(+(+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=_;O=p,p=p+1|0,q=(p|0)%(b|0)|0,N=+ie[x+(O<<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+(O<<4)+8>>3],g=+wa(+(+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 ace(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=Fm(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],pc(_,g)|0,x=0,Q=b,x|0)}function lce(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=Fm(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],pc(_,g)|0,ie[g>>3]=+ie[g>>3]*4058973249931477e-8,x=0,Q=b,x|0)}function cce(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=Fm(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],pc(_,g)|0,ie[g>>3]=+ie[g>>3]*4058973249931477e-8*1e6,x=0,Q=b,x|0)}function xr(p){return p=p|0,p>>>0>121?(p=0,p|0):(p=h[7696+(p*28|0)+16>>2]|0,p|0)}function kP(p){return p=p|0,(p|0)==4|(p|0)==117|0}function CG(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 uce(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 hce(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 fce(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 RG(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 zP(p,m){return p=p|0,m=m|0,h[848+(p*28|0)+(m<<2)>>2]|0}function VP(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 dce(){return 122}function pce(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 mce(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 Ace(p){return p=p|0,+ie[p+16>>3]<+ie[p+24>>3]|0}function gce(p){return p=p|0,+(+ie[p>>3]-+ie[p+8>>3])}function IG(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 GP(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=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,O=+ie[g>>3],b=x<O,_=m+16|0,N=+ie[_>>3],v=m+24|0,M=+ie[v>>3],E=N<M,m=O-N<M-x,p=b?E|m?1:2:0,m=E?b?1:m?2:1:0,x=+Bl(x,p),x<+Bl(+ie[v>>3],m)||(O=+Bl(+ie[g>>3],p),O>+Bl(+ie[_>>3],m))?(E=0,E|0):(E=1,E|0))}function vce(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 PG(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=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,O=+ie[g>>3],v=m+24|0,N=+ie[v>>3],E=O<N,m=x-O<N-M,p=b?E|m?1:2:0,m=E?b?1:m?2:1:0,x=+Bl(x,p),x<=+Bl(+ie[v>>3],m)?(O=+Bl(+ie[_>>3],p),E=O>=+Bl(+ie[g>>3],m),E|0):(E=0,E|0))}function LG(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));iu(p|0,_|0,168)|0,Q=v}function DG(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,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0;K=Q,Q=Q+288|0,O=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=JP(m,N)|0,m|0?(X=m,Q=K,X|0):(M=N,N=h[M>>2]|0,M=h[M+4>>2]|0,d1(N,M,O)|0,Fm(N,M,q)|0,b=+Bx(O,q+8|0),ie[O>>3]=+ie[p>>3],M=O+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=+Bx(O,q),ue=+ie[M>>3]-+ie[N>>3],x=+Ks(+ue),ae=+ie[O>>3]-+ie[q>>3],_=+Ks(+ae),!(ue==0|ae==0)&&(ue=+oq(+x,+_),ue=+u1(+(v*v/+QS(+(ue/+QS(+x,+_)),3)/(b*(b*2.59807621135)*.8))),ie[or>>3]=ue,j=~~ue>>>0,X=+Ks(ue)>=1?ue>0?~~+UP(+ho(ue/4294967296),4294967295)>>>0:~~+u1((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 _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,N=0,O=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=JP(g,M)|0,g|0?(_=g,Q=N,_|0):(g=M,v=h[g>>2]|0,g=h[g+4>>2]|0,d1(v,g,b)|0,Fm(v,g,E)|0,O=+Bx(b,E+8|0),O=+u1(+(+Bx(p,m)/(O*2))),ie[or>>3]=O,g=~~O>>>0,v=+Ks(O)>=1?O>0?~~+UP(+ho(O/4294967296),4294967295)>>>0:~~+u1((O-+(~~O>>>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 xce(p,m){p=p|0,m=+m;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=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],O=N-M,_=(_*m-_)*.5,m=(O*m-O)*.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 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,O=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=jP(h[v>>2]|0,h[v+4>>2]|0)|0,b=0,E=0;;){if(x=p+(b<<3)|0,lt=x,!(HS(h[lt>>2]|0,h[lt+4>>2]|0)|0)){v=5,je=159;break}if(lt=x,lt=(jP(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=yr(v)|0,!b)return lt=13,Q=pt,lt|0;for(iu(b|0,p|0,v|0)|0,$S(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=br(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=br(Ae|0,we|0,10,0)|0,se=ee()|0,Ut=yr(Ae<<5)|0,!Ut)return lt=13,Q=pt,lt|0;if(lt=Sa(xe,4)|0,!lt)return _t(Ut),lt=13,Q=pt,lt|0;e:do if(M){for(be=p,qP(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,O=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,O|0,q|0,j|0)|0,Ke=Vf(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,qP(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=br(v^b|0,(ee()|0)^x|0,484763065,-1084733587)|0,b=ee()|0,v=tt(x|0,b|0,27)|0,b=br(v^x|0,(ee()|0)^b|0,321982955,-1798288965)|0,x=ee()|0,v=tt(b|0,x|0,31)|0,x=Vf(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=np(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,FG(h[be>>2]|0,h[be+4>>2]|0,gt)|0){je=39;break}O=gt,N=h[O>>2]|0,O=h[O+4>>2]|0,x=tt(N|0,O|0,30)|0,x=br(x^N|0,(ee()|0)^O|0,484763065,-1084733587)|0,b=ee()|0,v=tt(x|0,b|0,27)|0,b=br(v^x|0,(ee()|0)^b|0,321982955,-1798288965)|0,x=ee()|0,v=tt(b|0,x|0,31)|0,x=Vf(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)==(O|0));)if(v=At(x|0,b|0,1,0)|0,x=np(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=qS(E)|0,be=qS(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,O=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,O|0,1,0)|0,O=ee()|0,(O|0)<(we|0)|(O|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=yr(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=yr(x<<4)|0,!K)break;x=ae,b=ue,X=0,j=0,E=0,M=0;do{if(Lx(x,b,Be)|0){je=69;break n}if(se=h[Be>>2]|0,O=se+-1|0,q=((O|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<O>>>0);E=b,M=x}X=At(X|0,j|0,O|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=bue(K,X<<4)|0,!x){je=75;break}ue=qS(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],pc(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);$S(be,Me,24,2);t:do if((Me|0)==0&(Ke|0)==0){if(se=yr(192)|0,se|0){if(h[se+16>>2]=0,h[se+20>>2]=0,j=se+8|0,h[j>>2]=3,v=yr(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],pc(gt,se)|0,h[se+40>>2]=0,h[se+44>>2]=0,q=se+32|0,h[q>>2]=3,v=yr(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],O=v+16|0,h[O>>2]=h[3876],h[O+4>>2]=h[3877],h[O+8>>2]=h[3878],h[O+12>>2]=h[3879],O=v+32|0,h[O>>2]=h[3880],h[O+4>>2]=h[3881],h[O+8>>2]=h[3882],h[O+12>>2]=h[3883],h[gt>>2]=h[q>>2],h[gt+4>>2]=h[q+4>>2],pc(gt,se+24|0)|0,h[se+64>>2]=0,h[se+68>>2]=0,O=se+56|0,h[O>>2]=3,v=yr(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[O>>2],h[gt+4>>2]=h[O+4>>2],pc(gt,se+48|0)|0,h[se+88>>2]=0,h[se+92>>2]=0,N=se+80|0,h[N>>2]=3,v=yr(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],pc(gt,se+72|0)|0,h[se+112>>2]=0,h[se+116>>2]=0,M=se+104|0,h[M>>2]=3,v=yr(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],pc(gt,se+96|0)|0,h[se+136>>2]=0,h[se+140>>2]=0,E=se+128|0,h[E>>2]=3,v=yr(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],pc(gt,se+120|0)|0,h[se+160>>2]=0,h[se+164>>2]=0,b=se+152|0,h[b>>2]=3,v=yr(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],pc(gt,se+144|0)|0,h[se+184>>2]=0,h[se+188>>2]=0,x=se+176|0,h[x>>2]=3,v=yr(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],pc(gt,se+168|0)|0,$S(se,8,24,3),v=yr(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[O>>2],h[je+4>>2]=h[O+4>>2],h[je+8>>2]=h[O+8>>2],h[je+12>>2]=h[O+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=yr(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(O=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=yr(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=O+(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($S(p,ue,24,3),v=yr(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 bce(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 qS(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=qS(g)|0,h[m>>2]=g,g|0)}function wce(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 Sce(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 Tce(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,O=0,q=0;if(q=Q,Q=Q+64|0,O=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){$P(p,m,x,O)|0,$P(g,_,x,E)|0,N=O,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=O,b=x+56|0;do h[x>>2]=0,x=x+4|0;while((x|0)<(b|0));return wG(p,m,1,O)|0,m=O,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0))&&(m=O+8|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=O+16|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=O+24|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=O+32|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=O+40|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))?(x=O+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 Ece(p,m,g,_,v){return p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,g=GS(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 Mce(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 Cce(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 NG(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=HS(p,g)|0,g|0)}function Rce(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 qP(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 Lx(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,_=_ue(p,x,_&7)|0,(_|0)==-1?(h[g>>2]=0,x=6,Q=b,x|0):(f1(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?HP(v,m,_,2,g):WP(v,m,_,2,g),x=0,Q=b,x|0)):(x=6,Q=b,x|0)}function FG(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=GS(_,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 Ice(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,O=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],O=+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]-O,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=+qle(+(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=+ys(+(Be*Be+(b*b+ae*ae))),ue=ue>0?1/ue:0,b=b*ue,ae=ae*ue,ue=Be*ue,Be=-(N*se+O*we+M*xe),K=N+se*Be,_=O+we*Be,N=M+xe*Be,O=+ys(+(N*N+(K*K+_*_))),O=O>0?1/O:0,K=K*O,_=_*O,O=N*O,_=+Fx(Ae-+Fx(+wa(+(O*(we*b-se*ae)+(K*(xe*ae-we*ue)+_*(se*ue-xe*b))),+(ue*O+(b*K+ae*_))))),mc(m)|0?b=+Fx(_+-.3334731722518321):b=_,_=+VS(+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 Pce(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,Dx(v,h[p>>2]|0,m,0,g),Q=_}function Dx(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,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0;if(x=+vue(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=+wa(+ +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=(mc(g)|0)==0,x=+yG(+((g?E:E*.37796447300922725)*.381966011250105))):(x=+yG(+(x*.381966011250105)),mc(g)|0&&(b=+Fx(b+.3334731722518321))),q=+Fx(+ie[16368+(m*24|0)>>3]-b),E=+ie[15888+(m*24|0)>>3],O=+ie[15888+(m*24|0)+8>>3],ae=+ie[15888+(m*24|0)+16>>3],X=-(ae+(E*0+O*0)),N=E*X+0,b=O*X+0,X=ae*X+1,j=+ys(+(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-O*j)),x=ue*O+K*(X*b+q*(E*j-ae*N)),b=ue*ae+K*(X*j+q*(O*N-E*b)),E=+ys(+(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 HP(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,O=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,Co=0,Vn=0,wi=0,Ta=0,Ns=0,ss=0,Fs=0,bs=0,al=0,fo=0,po=0,gc=0,Ro=0,Pi=0,Bm=0;if(al=Q,Q=Q+256|0,x=al+240|0,pi=al+224|0,ss=al,Fs=al+208|0,bs=al+192|0,bi=al+168|0,Co=al+152|0,Vn=al+136|0,wi=al+120|0,Ta=al+104|0,Ns=al+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],BG(pi,x,ss),h[v>>2]=0,pi=_+g+((_|0)==5&1)|0,(pi|0)<=(g|0)){Q=al;return}Ae=h[x>>2]|0,we=Fs+4|0,xe=Fs+8|0,se=Fs+12|0,Be=bs+8|0,Ke=g+5|0,Me=16848+(Ae<<2)|0,be=bi+8|0,gt=16928+(Ae<<2)|0,je=Co+8|0,Ut=Vn+8|0,lt=wi+8|0,pt=bs+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=ss+(((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((h1(Fs,Ae,0,1)|0)==2);if((j|0)>(g|0)&(mc(m)|0)!=0){if(q=h[Fs>>2]|0,p=h[we>>2]|0,N=h[xe>>2]|0,x=h[se>>2]|0,fo=+(E-M|0),ie[bs>>3]=+(b-M|0)-fo*.5,ie[Be>>3]=fo*.8660254037844386,M=h[17008+(q*80|0)+(_<<2)>>2]|0,O=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 Ro=x+p|0,Pi=(Ro|0)<0,N=_+p-(Pi?Ro:0)|0,gc=(N|0)<0,po=x+_-(Pi?Ro:0)-(gc?N:0)|0,x=(po|0)<0,p=(Pi?0:Ro)-(gc?N:0)-(x?po:0)|0,_=(gc?0:N)-(x?po:0)|0,po=x?0:po,x=(_|0)<(p|0)?_:p,x=(po|0)<(x|0)?po:x,N=(x|0)>0,p=p-(N?x:0)|0,_=_-(N?x:0)|0,x=po-(N?x:0)|0,b=b+1|0;while((b|0)<(E|0))}else _=N;switch(Pi=(h[Me>>2]|0)*3|0,po=(sl(Pi,h[18608+(q*80|0)+(M*20|0)+4>>2]|0)|0)+p|0,N=(sl(Pi,h[18608+(q*80|0)+(M*20|0)+8>>2]|0)|0)+_|0,Pi=(sl(Pi,h[18608+(q*80|0)+(M*20|0)+12>>2]|0)|0)+x|0,M=(po|0)<0,N=N-(M?po:0)|0,gc=(N|0)<0,Pi=Pi+(M?0-po|0:0)+(gc?0-N|0:0)|0,Ro=(Pi|0)<0,po=(M?0:po)-(gc?N:0)-(Ro?Pi:0)|0,N=(gc?0:N)-(Ro?Pi:0)|0,Pi=Ro?0:Pi,Ro=(N|0)<(po|0)?N:po,Ro=(Pi|0)<(Ro|0)?Pi:Ro,gc=(Ro|0)>0,Pi=Pi-(gc?Ro:0)|0,fo=+(N-(gc?Ro:0)-Pi|0),ie[bi>>3]=+(po-(gc?Ro:0)-Pi|0)-fo*.5,ie[be>>3]=fo*.8660254037844386,fo=+(h[gt>>2]|0),ie[Co>>3]=fo*3,ie[je>>3]=0,Bm=fo*-1.5,ie[Vn>>3]=Bm,ie[Ut>>3]=fo*2.598076211353316,ie[wi>>3]=Bm,ie[lt>>3]=fo*-2.598076211353316,h[17008+(O*80|0)+(q<<2)>>2]|0){case 1:{p=Vn,_=Co;break}case 3:{p=wi,_=Vn;break}case 2:{p=Co,_=wi;break}default:{p=12;break e}}ZG(bs,bi,_,p,Ta),Dx(Ta,O,Ae,1,Ns),Pi=h[v>>2]|0,fo=+Px(+ +ie[ue>>3]),Bm=+wa(+ +ie[K>>3],+ +ie[Ns>>3]),ie[v+8+(Pi<<4)>>3]=fo,ie[v+8+(Pi<<4)+8>>3]=Bm,h[v>>2]=(h[v>>2]|0)+1}if((j|0)<(Ke|0)&&(Pi=h[se>>2]|0,fo=+((h[xe>>2]|0)-Pi|0),ie[bs>>3]=+((h[we>>2]|0)-Pi|0)-fo*.5,ie[pt>>3]=fo*.8660254037844386,Dx(bs,h[Fs>>2]|0,Ae,1,bi),Pi=h[v>>2]|0,fo=+Px(+ +ie[ae>>3]),Bm=+wa(+ +ie[X>>3],+ +ie[bi>>3]),ie[v+8+(Pi<<4)>>3]=fo,ie[v+8+(Pi<<4)+8>>3]=Bm,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=al;return}else(p|0)==12&&di(27073,27120,599,27130)}function BG(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,O=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(O=(mc(h[m>>2]|0)|0)==0,O=O?_: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-_),mc(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[O+4>>2]|0,N=h[O+8>>2]|0,b=(h[O>>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[O+16>>2]|0,N=h[O+20>>2]|0,b=(h[O+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[O+28>>2]|0,N=h[O+32>>2]|0,b=(h[O+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[O+40>>2]|0,N=h[O+44>>2]|0,b=(h[O+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[O+52>>2]|0,M=h[O+56>>2]|0,b=(h[O+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 h1(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,O=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,O=p+4|0,E=h[O>>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[O>>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[O>>2]=b,h[N>>2]=x,h[M>>2]=_}return ae=h[16848+(m<<2)>>2]|0,ae=q?ae*3|0:ae,ue=sl(ae,h[v+8>>2]|0)|0,xe=sl(ae,h[v+12>>2]|0)|0,b=(sl(ae,h[v+4>>2]|0)|0)+b|0,h[O>>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[O>>2]=0,x=0):(v=x,x=b),(v|0)<0?(p=x-v|0,h[O>>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[O>>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[O>>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 Lce(p,m){p=p|0,m=m|0;var g=0;do g=h1(p,m,0,1)|0;while((g|0)==2);return g|0}function WP(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,O=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,Co=0,Vn=0,wi=0,Ta=0,Ns=0,ss=0,Fs=0,bs=0;if(Ns=Q,Q=Q+272|0,x=Ns+256|0,b=Ns+240|0,Vn=Ns,wi=Ns+224|0,Ta=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],OG(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=Ta+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=Ta+8|0,M=je+8|0,O=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=h1(wi,xe,0,1)|0,(E|0)>(g|0)&(mc(m)|0)!=0&&(Co=h[wi>>2]|0,(p|0)!=1&(Co|0)!=(_|0))){switch(bs=(x+5|0)%6|0,p=h[Vn+(bs<<4)+12>>2]|0,ss=+((h[Vn+(bs<<4)+8>>2]|0)-p|0),ie[Ta>>3]=+((h[Vn+(bs<<4)+4>>2]|0)-p|0)-ss*.5,ie[we>>3]=ss*.8660254037844386,p=h[Vn+(x<<4)+12>>2]|0,ss=+((h[Vn+(x<<4)+8>>2]|0)-p|0),ie[je>>3]=+((h[Vn+(x<<4)+4>>2]|0)-p|0)-ss*.5,ie[Ae>>3]=ss*.8660254037844386,ss=+(h[Be>>2]|0),ie[Ut>>3]=ss*3,ie[Ke>>3]=0,Fs=ss*-1.5,ie[lt>>3]=Fs,ie[Me>>3]=ss*2.598076211353316,ie[pt>>3]=Fs,ie[be>>3]=ss*-2.598076211353316,h[17008+(ae*80|0)+(((_|0)==(ae|0)?Co:_)<<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}}ZG(Ta,je,_,p,pi),!(KG(Ta,pi)|0)&&!(KG(je,pi)|0)&&(Dx(pi,ae,xe,1,bi),bs=h[v>>2]|0,ss=+Px(+ +ie[q>>3]),Fs=+wa(+ +ie[N>>3],+ +ie[bi>>3]),ie[v+8+(bs<<4)>>3]=ss,ie[v+8+(bs<<4)+8>>3]=Fs,h[v>>2]=(h[v>>2]|0)+1)}if((E|0)<(se|0)&&(bs=h[K>>2]|0,ss=+((h[X>>2]|0)-bs|0),ie[Ta>>3]=+((h[j>>2]|0)-bs|0)-ss*.5,ie[ue>>3]=ss*.8660254037844386,Dx(Ta,h[wi>>2]|0,xe,1,je),bs=h[v>>2]|0,ss=+Px(+ +ie[O>>3]),Fs=+wa(+ +ie[M>>3],+ +ie[je>>3]),ie[v+8+(bs<<4)>>3]=ss,ie[v+8+(bs<<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 OG(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,O=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=(mc(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-_),mc(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,O=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,_=O+_|0,O=g+(M<<4)+12|0,h[O>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[N>>2]=x,h[O>>2]=_,h[m>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[m>>2]=b,_=_-v|0,h[O>>2]=_,h[N>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[m>>2]=E,h[N>>2]=x,h[O>>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[O>>2]=_-v),M=M+1|0;while((M|0)!=6);Q=ae}function jP(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,52)|0,ee()|0,m&15|0}function UG(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,45)|0,ee()|0,m&127|0}function Dce(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 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(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 HS(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=lL(p|0,m|0,0)|0,ee()|0,((63-b|0)%3|0|0)!=0|0))}function Fce(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=lL(p|0,g|0,0)|0,ee()|0,(63-b|0)%3|0|0))||NG(p,m)|0?(b=1,b|0):(b=(QG(p,m)|0)!=0&1,b|0)}function XP(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 $P(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 Nx(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(!(xr(g&127)|0))g=ep(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=ep(7,0,v,((v|0)<0)<<31>>31)|0,v=ee()|0;break e}while(!1);g=ep(7,0,v,((v|0)<0)<<31>>31)|0,g=br(g|0,ee()|0,5,0)|0,g=At(g|0,ee()|0,-5,-1)|0,g=tp(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,!(xr(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 Bce(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,eL(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,tL(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 kG(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 zG(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 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,O=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=yr(je)|0,!lt)return pt=13,pt|0;if(iu(lt|0,p|0,je|0)|0,Ut=Sa(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(O=tt(E|0,p|0,52)|0,ee()|0,O=O&15,(O|0)<(gt|0)){v=12,pt=27;break e}if((O|0)!=(gt|0)&&(E=E|se,p=p&-15728641|we,O>>>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<O>>>0)}if(j=Vf(E|0,p|0,g|0,_|0)|0,X=ee()|0,M=Ut+(j<<3)|0,O=M,q=h[O>>2]|0,O=h[O+4>>2]|0,!((q|0)==0&(O|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)&(O&-117440513|0)==(p|0)){K=tt(q|0,O|0,56)|0,ee()|0,K=K&7,ae=K+1|0,Be=tt(q|0,O|0,45)|0,ee()|0;n:do if(!(xr(Be&127)|0))O=7;else{if(q=tt(q|0,O|0,52)|0,ee()|0,q=q&15,!q){O=6;break}for(O=1;;){if(Be=ft(7,0,(15-O|0)*3|0)|0,!((Be&E|0)==0&((ee()|0)&p|0)==0)){O=7;break n}if(O>>>0<q>>>0)O=O+1|0;else{O=6;break}}}while(!1);if((K+2|0)>>>0>O>>>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=np(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,O=M,q=h[O>>2]|0,O=h[O+4>>2]|0}while(!((q|0)==0&(O|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=tp(g|0,_|0,6,0)|0,ee()|0,Be=Sa(Be,8)|0,!Be){pt=48;break}do if(Ke){for(ae=0,p=0,K=0,ue=0;;){if(O=Ut+(ae<<3)|0,b=O,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(xr(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=O,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(O=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,O=Me|O,q=ee()|0|q;while(j>>>0<X>>>0)}}else O=N,q=v;K=Vf(O|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)==(O|0)){pt=65;break}Me=At(K|0,ue|0,1,0)|0,K=np(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)==(O|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(ip(Ut|0,0,je|0)|0,iu(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&&(iu(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 Uce(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,O=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,O=tt(M|0,N|0,52)|0,ee()|0,(O&15|0)>(b|0)){E=12,M=11;break}if(eL(K,M,N,b),O=K,N=h[O>>2]|0,O=h[O+4>>2]|0,(N|0)==0&(O|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]=O,M=At(M|0,E|0,1,0)|0,E=ee()|0,tL(K),q=K,N=h[q>>2]|0,O=h[q+4>>2]|0}while(!((N|0)==0&(O|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 kce(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,O=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,O=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=(Nx(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,O|0,1,0)|0,O=ee()|0,!((O|0)<(g|0)|(O|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 zce(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,52)|0,ee()|0,m&1|0}function ol(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 YP(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0;if(O=tt(p|0,m|0,52)|0,ee()|0,O=O&15,!O)return N=m,O=p,On(N|0),O|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<O>>>0)N=N+1|0;else break}return On(m|0),p|0}function Nm(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 Vce(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0;if(O=tt(p|0,m|0,52)|0,ee()|0,O=O&15,!O)return N=m,O=p,On(N|0),O|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<O>>>0)N=N+1|0;else break}return On(m|0),p|0}function ZP(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 Gce(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=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(CG(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,O=h[we+4>>2]|0;;){X=K,K=K+-1|0,p=O-j|0,_=q-j|0,X&1?(x=th(+((p*3|0)-_|0)*.14285714285714285)|0,h[se>>2]=x,p=th(+((_<<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=th(+((p<<1)+_|0)*.14285714285714285)|0,h[se>>2]=E,v=th(+((_*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),_=O+(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,O=(j|0)<0,E=O?0:j,Me=(b?0:M)-(O?j:0)|0,j=(x?0:_)-(b?M:0)-(O?j:0)|0,O=(Me|0)<(j|0)?Me:j,O=(E|0)<(O|0)?E:O,M=(O|0)>0,j=j-(M?O: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?O:0)-Ke|0,Be=(Me|0)<0,Ke=(Be?0-Me|0:0)+(E-(M?O: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,O=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(_=CG(we)|0,p=ft(_|0,0,45)|0,m=p|m,p=ee()|0|g&-1040385,M=uce(we)|0,!(xr(_)|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(RG(_,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=YP(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 mc(p){return p=p|0,(p|0)%2|0|0}function KP(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,O=0,q=0;if(O=Q,Q=Q+64|0,E=O+24|0,M=O+48|0,N=O,m>>>0>15)return N=4,Q=O,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=O,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],Ice(E,m,M),M=Gce(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=O,N|0}function QP(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,O=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,xr(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,O=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,O&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-O|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)),O>>>0<K>>>0;)O=O+1|0;return _|0}function f1(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,O=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((xr(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],!(QP(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,O=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=O+1|0):v=O,!(xr(j)|0))_=0;else{e:do if(!O)_=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<O>>>0)m=m+1|0;else{_=0;break}}while(!1);_=(_|0)==4&1}if(!(h1(g,v,_,0)|0))(v|0)!=(O|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(xr(j)|0)do;while((h1(g,v,0,0)|0)!=0);(v|0)!=(O|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=th(+((_<<1)+p|0)*.14285714285714285)|0,h[X>>2]=m,_=th(+((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 d1(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=f1(p,m,_)|0,x?(Q=b,x|0):(x=tt(p|0,m|0,52)|0,ee()|0,Pce(_,x&15,v),M=+Px(+ +ie[v+16>>3]),E=+wa(+ +ie[v+8>>3],+ +ie[v>>3]),ie[g>>3]=M,ie[g+8>>3]=E,x=0,Q=b,x|0)}function Fm(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,_=f1(p,m,x)|0,_|0)return x=_,Q=b,x|0;_=tt(p|0,m|0,45)|0,ee()|0,_=(xr(_&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 HP(x,v,0,5,g),E=0,Q=b,E|0}while(!1);return WP(x,v,0,6,g),E=0,Q=b,E|0}function qce(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,!(xr(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 VG(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,O=0,q=0;q=Q,Q=Q+128|0,N=q+112|0,x=q+96|0,O=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(xr(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,O=ee()|0|m&-15728641,N=ft(7,0,(14-E|0)*3|0)|0,O=VG((M|p)&~N,O&~(ee()|0),g)|0,Q=q,O|0}else v=0;while(!1);if(_=f1(p,m,x)|0,!_){v?(BG(x,N,O),M=5):(OG(x,N,O),M=6);e:do if(xr(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);ip(g|0,-1,p<<2|0)|0;e:do if(v)for(x=0;;){if(b=O+(x<<4)|0,Lce(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=O+(x<<4)|0,h1(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 O=_,Q=q,O|0}function Hce(){return 12}function JP(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 xr(_)|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(xr(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 Wce(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,O=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(xr(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(O=tt(q|0,M|0,45)|0,ee()|0,!(xr(O&127)|0))x=0;else{O=tt(q|0,M|0,52)|0,ee()|0,O=O&15;t:do if(!O)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<O>>>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=ep(7,0,N,((N|0)<0)<<31>>31)|0,O=ee()|0,x?(x=br(N|0,O|0,5,0)|0,x=At(x|0,ee()|0,-5,-1)|0,x=tp(x|0,ee()|0,6,0)|0,x=At(x|0,ee()|0,1,0)|0,M=ee()|0):(x=N,M=O),j=q+-1|0,j=br(N|0,O|0,j|0,((j|0)<0)<<31>>31|0)|0,j=At(x|0,M|0,j|0,ee()|0)|0,q=ee()|0,O=_,O=At(j|0,q|0,h[O>>2]|0,h[O+4>>2]|0)|0,q=ee()|0,j=_,h[j>>2]=O,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=ep(7,0,b,((b|0)<0)<<31>>31)|0,v=br(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 Nx(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 jce(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,O=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(Nx(g,_,v,b)|0&&di(27634,27225,1367,27274),O=b,N=h[O+4>>2]|0,!(((m|0)>-1|(m|0)==-1&p>>>0>4294967295)&((N|0)>(m|0)|((N|0)==(m|0)?(h[O>>2]|0)>>>0>p>>>0:0))))return x=2,Q=q,x|0;O=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(xr(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((O|0)<1)return x=0,Q=q,x|0;for(N=E^15,_=-1,M=1,b=1;;){E=O-M|0,E=ep(7,0,E,((E|0)<0)<<31>>31)|0,g=ee()|0;do if(b)if(b=br(E|0,g|0,5,0)|0,b=At(b|0,ee()|0,-5,-1)|0,b=tp(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),_=tp(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=br(_|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=tp(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=br(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((O|0)>(M|0))_=~M,M=M+1|0;else{m=0;break}}return Q=q,m|0}while(!1);if((O|0)<1)return ae=0,Q=q,ae|0;for(v=E^15,b=1;;)if(K=O-b|0,K=ep(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=tp(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=br(j|0,X|0,K|0,ae|0)|0,p=Js(p|0,m|0,ae|0,ee()|0)|0,m=ee()|0,(O|0)<=(b|0)){m=0;break}else b=b+1|0;return Q=q,m|0}function eL(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=kG(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 GG(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=kG(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 tL(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 Fx(p){p=+p;var m=0;return m=p<0?p+6.283185307179586:p,+(p>=6.283185307179586?m+-6.283185307179586:m)}function Bl(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 Xce(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),+(+wa(+ +ys(+g),+ +ys(+(1-g)))*2)}function Bx(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),+(+wa(+ +ys(+g),+ +ys(+(1-g)))*2*6371.007180918475)}function $ce(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),+(+wa(+ +ys(+g),+ +ys(+(1-g)))*2*6371.007180918475*1e3)}function qG(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 Yce(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 Zce(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 Kce(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 WS(p,m){p=p|0,m=m|0;var g=0;return p>>>0>15?(m=4,m|0):(g=ep(7,0,p,((p|0)<0)<<31>>31)|0,g=br(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 Qce(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,O=0;if(E=Q,Q=Q+176|0,b=E,p=Lx(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],O=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=O*O+M*(+ii(+_)*+ii(+N)*M),x=x+ +wa(+ +ys(+M),+ +ys(+(1-M)))*2;while((p|0)<(m|0));return ie[g>>3]=x,b=0,Q=E,b|0}function Jce(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,O=0;if(E=Q,Q=Q+176|0,b=E,p=Lx(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],O=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=O*O+M*(+ii(+N)*+ii(+_)*M),x=x+ +wa(+ +ys(+M),+ +ys(+(1-M)))*2;while((p|0)!=(m|0));return ie[g>>3]=x,b=0,O=x,O=O*6371.007180918475,ie[g>>3]=O,Q=E,b|0}function eue(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,O=0;if(E=Q,Q=Q+176|0,b=E,p=Lx(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],O=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=O*O+M*(+ii(+N)*+ii(+_)*M),x=x+ +wa(+ +ys(+M),+ +ys(+(1-M)))*2;while((p|0)!=(m|0));return ie[g>>3]=x,b=0,O=x,O=O*6371.007180918475,O=O*1e3,ie[g>>3]=O,Q=E,b|0}function tue(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 nue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=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=Sa(1,12)|0,!g){g=5;break}h[p+8>>2]=g,p=g}if(M=h[K>>2]|0,N=Sa(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=yr(24)|0,!b){p=13,g=37;break e}cL(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){O=M+(X<<4)+12|0,M=0;do{if(_=h[O>>2]|0,g=N,N=Sa(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=yr(24)|0,!x){p=13,g=37;break e}cL(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 Ox(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,O=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,O=tt(p|0,m|0,52)|0,ee()|0,O=O&15,X=tt(g|0,_|0,52)|0,ee()|0,(O|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=VP(M,N)|0,(b|0)==7)return ue=1,Q=xe,ue|0;E=VP(N,M)|0,(E|0)==7?di(27291,27315,164,27325):(ae=b,x=E)}else ae=0,x=0;q=xr(M)|0,j=xr(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=Vce(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=ZP(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(QP(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=ol(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=ol(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),O)for(;;)if(M=x*3|0,N=E*3|0,g=b*3|0,mc(O)|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,(O|0)>1)O=O+-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,O=ue+8|0,ae=h[O>>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[O>>2]=E,x=se+b|0,h[_>>2]=x,b=E-M|0,(M|0)<0?(x=x-M|0,h[O>>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[O>>2]=0,b=0),N=E-x|0,M=b-x|0,(x|0)<0?(h[g>>2]=N,h[O>>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[O>>2]=M-b,h[_>>2]=x-b),K=77}else x=5}else if(QP(g,_,ue)|0,(q|0)!=0&(j|0)!=0)if((N|0)!=(M|0)&&di(27398,27315,264,27325),b=ol(p,m)|0,x=ol(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){O=ue+4|0,_=ue+8|0,q=ue+12|0,N=0,E=h[O>>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[O>>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 HG(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,O=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=xr(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=zP(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,mc(ae)|0){if(M){if(O=(K|0)>0,q=2147483647-K|0,j=-2147483648-K|0,O?(q|0)<(K|0):(j|0)>(K|0)){v=1,se=107;break}if(be=K<<1,O?(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,(O?(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=th(+(M-X|0)*.14285714285714285)|0,O=th(+(N+K|0)*.14285714285714285)|0,N=(O|0)<(q|0),M=N?q:O,N=N?O: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=O-(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,O=(q|0)<0,Me=O?0:q,N=(M?0:be)-(O?q:0)|0,q=(Be?0:Ke)-(M?be:0)-(O?q:0)|0,O=(N|0)<(q|0)?N:q,O=(Me|0)<(O|0)?Me:O,be=(O|0)>0,M=be?O:0,N=N-(be?O:0)|0,O=Me-(be?O: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,O=(X|0)>0,O?(2147483647-X|0)<(X|0):(-2147483648-X|0)>(X|0)){v=1,se=107;break}if(j=X<<1,O?(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=th(+(M+X|0)*.14285714285714285)|0,O=th(+(N-K|0)*.14285714285714285)|0,N=(O|0)<(q|0),M=N?q:O,N=N?O: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=O-(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,O=(q|0)<0,Ke=O?0:q,N=(M?0:Be)-(O?q:0)|0,q=(be?0:Me)-(M?Be:0)-(O?q:0)|0,O=(N|0)<(q|0)?N:q,O=(Ke|0)<(O|0)?Ke:O,Be=(O|0)>0,M=Be?O:0,N=N-(Be?O:0)|0,O=Ke-(Be?O:0)|0}M=b+(M-q)|0,Me=(M|0)<0,N=E-N-(Me?M:0)|0,q=(N|0)<0,Be=g-O+(Me?0-M|0:0)+(q?0-N|0:0)|0,b=(Be|0)<0,O=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=(O|0)<(b|0)?O: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)+(O-(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=zP(Ae,x)|0,(E|0)==127?N=0:N=xr(E)|0;e:do if(x){if(ue){if(g=ol(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=zP(Ae,g)|0,(x|0)==127&&di(27476,27315,415,27506),xr(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=Nm(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=Nm(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=VP(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=Nm(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=ol(x,g)|0,(g|0)==7&&di(27634,27315,444,27506),x=kP(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=YP(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=ol(p,m)|0,g=_,g=ol(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=Nm(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=_,(ol(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 iue(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=Ox(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 rue(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,O=0,q=0;return q=Q,Q=Q+16|0,O=q,_|0?(O=15,Q=q,O|0):(E=h[g>>2]|0,b=h[g+4>>2]|0,h[O>>2]=E,M=O+4|0,h[M>>2]=b,N=O+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[O>>2]=0,E=0):(_=b,x=0),b=E-_|0,g=x-_|0,(_|0)<0?(h[O>>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[O>>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[O>>2]=b-_,h[M>>2]=x-_,h[N>>2]=g-_),_=HG(p,m,O,v)|0),O=_,Q=q,O|0)}function nL(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=Ox(p,m,p,m,b)|0,x|0?(E=x,Q=M,E|0):(p=Ox(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 sue(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=nL(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 oue(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=nL(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=WG(p,m,g,_,x,b,v,0,0,1,0)|0,E?(v=(WG(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 WG(p,m,g,_,v,x,b,E,M,N,O){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,O=O|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,Ox(p,m,p,m,q)|0&&di(27634,27315,696,27575),Ox(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,_=~~+JS(+lt),q=~~+JS(+X),g=~~+JS(+K),lt=+Ks(+(+(_|0)-lt)),X=+Ks(+(+(q|0)-X)),K=+Ks(+(+(g|0)-K)),lt>X<>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=br(xe|0,se|0,N|0,O|0)|0,g=At(g|0,ee()|0,E|0,M|0)|0,ee()|0,g=HG(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 ep(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=br((b?1:x)|0,(b?0:v)|0,p|0,m|0)|0,m=ee()|0,g=sq(g|0,_|0,1)|0,_=ee()|0,x=br(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 iL(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,O=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=d1(p,m,x)|0,!v){N=+ie[x>>3],M=1/+ii(+N),O=+ie[26032+(b<<3)>>3],ie[g>>3]=N+O,ie[g+8>>3]=N-O,N=+ie[x+8>>3],M=O*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 xce(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 aue(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,O=0;N=Q,Q=Q+48|0,b=N+32|0,x=N+40|0,E=N,XP(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=Sa((h[m+8>>2]|0)+1|0,32)|0,v){rL(m,v),O=E,h[O>>2]=M,h[O+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,O=E+29|0,h[M>>2]=0,h[M+4>>2]=0,h[M+8>>2]=0,He[M+12>>0]=0,He[O>>0]=He[x>>0]|0,He[O+1>>0]=He[x+1>>0]|0,He[O+2>>0]=He[x+2>>0]|0;while(!1);jS(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 jS(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=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=jG(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,O=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(O&15){case 0:case 2:case 3:{if(v=d1(g,_,X)|0,v|0){ue=15;break t}if(sL(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],IG(26896,X)|0)){if(KP(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=Fm(g,_,X)|0,v|0){ue=32;break}if(iL(g,_,K,0)|0){ue=36;break}if(b&&$G(h[we>>2]|0,h[j>>2]|0,X,K)|0){ue=42;break}if(M&&YG(h[we>>2]|0,h[j>>2]|0,X,K)|0){ue=42;break}}if(q){if(m=iL(g,_,X,1)|0,v=h[j>>2]|0,m|0){ue=45;break}if(GP(v,X)|0){if(LG(K,X),PG(X,h[j>>2]|0)|0){ue=53;break}if(sL(h[we>>2]|0,h[j>>2]|0,E)|0){ue=53;break}if(YG(h[we>>2]|0,h[j>>2]|0,K,X)|0){ue=53;break}}}}do if((x|0)<(h[ae>>2]|0)){if(m=iL(g,_,X,1)|0,v=h[j>>2]|0,m|0){ue=58;break t}if(!(GP(v,X)|0)){ue=73;break}if(PG(h[j>>2]|0,X)|0&&(LG(K,X),$G(h[we>>2]|0,h[j>>2]|0,K,X)|0)){ue=65;break t}if(g=zG(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=jG(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 jG(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0;q=Q,Q=Q+16|0,O=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 O=(M|0)==0&(Zi(g,v)|0)!=0,O=ft((O?2:1)+M|0,0,x|0)|0,N=ee()|0|m&~E,O=O|p&~b,On(N|0),Q=q,O|0}while(!1);return g=g&127,g>>>0>120?(N=0,O=0,On(N|0),Q=q,O|0):(XP(O,0,g+1|0,0),N=h[O+4>>2]|0,O=h[O>>2]|0,On(N|0),Q=q,O|0)}function lue(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,O=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,aue(q,p,m,g),N=q,eL(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,O=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,tL(j),p=j,m=h[p>>2]|0,p=h[p+4>>2]|0,(m|0)==0&(p|0)==0){if(jS(g),m=g,p=h[m>>2]|0,m=h[m+4>>2]|0,(p|0)==0&(m|0)==0){K=10;break}GG(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[O>>2]=0,h[ae+36>>2]=0,h[q>>2]=-1,h[ae+32>>2]=0,h[p>>2]=0,GG(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[O>>2]),ae=h[X>>2]|0,Q=ue,ae|0)}function cue(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,O=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 O=_,h[O>>2]=0,h[O+4>>2]=0,O=0,Q=q,O|0;XP(M,0,0,0),b=M,v=h[b>>2]|0,b=h[b+4>>2]|0;do if(m>>>0>15)O=N,h[O>>2]=0,h[O+4>>2]=0,h[N+8>>2]=4,h[N+12>>2]=-1,O=N+16|0,g=N+29|0,h[O>>2]=0,h[O+4>>2]=0,h[O+8>>2]=0,He[O+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,O=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,O=N+29|0,h[M>>2]=0,h[M+4>>2]=0,h[M+8>>2]=0,He[M+12>>0]=0,He[O>>0]=He[E>>0]|0,He[O+1>>0]=He[E+1>>0]|0,He[O+2>>0]=He[E+2>>0]|0,O=9;break}if(g=Sa((h[p+8>>2]|0)+1|0,32)|0,!g){O=N,h[O>>2]=0,h[O+4>>2]=0,h[N+8>>2]=13,h[N+12>>2]=-1,O=N+16|0,g=N+29|0,h[O>>2]=0,h[O+4>>2]=0,h[O+8>>2]=0,He[O+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,O=9;break}rL(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=+gce(g),j=j*+mce(g),x=+Ks(+ +ie[g>>3]),x=j/+ii(+ +QS(+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(qG(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(jS(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 Nx(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,jS(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 Ux(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,O=0,q=0,j=0;if(!(IG(m,g)|0)||(m=Ace(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,O=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,O=E==O|b==O?O+-2220446049250313e-31:O,M=E+(b-E)*((_-x)/(M-x)),(M<0?M+6.283185307179586:M)>O&&(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,O=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(O=b==O|v==O?O+-2220446049250313e-31:O,b+(v-b)*((_-x)/(M-x))>O&&(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 XG(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=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,O=-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,O=E<0&E>O?E:O,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]=O,ie[ue>>3]=N)}}function kx(p){return p=p|0,(p>>>0<4?0:15)|0}function rL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=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],O=+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),O<N&&(ie[ue>>3]=O,N=O),x>q?ie[m>>3]=x:x=q,O>b&&(ie[xe>>3]=O,b=O),j=O>0&O<j?O:j,X=O<0&O>X?O:X,_=_|+Ks(+(O-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,O=-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>O?ie[ue>>3]=x:x=O,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=_,O=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 sL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if(!(Ux(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,Ux((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 $G(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,O=0;if(N=Q,Q=Q+16|0,E=N,b=g+8|0,!(Ux(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(O=v,v=v+1|0,Ux((h[x>>2]|0)+(O<<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(XS(p,m,g,_)|0)return O=0,Q=N,O|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(Ux(E,_,h[v+(b<<3)+4>>2]|0)|0){v=0;break e}if(v=b+1|0,XS((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 O=v,Q=N,O|0}function XS(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,O=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,!(GP(m,_)|0))return p=0,Q=Ke,p|0;if(vce(m,_,se,v),iu(we|0,g|0,168)|0,(h[g>>2]|0)>0){m=0;do Me=we+8+(m<<4)+8|0,xe=+Bl(+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=+Bl(+ie[_+16>>3],h[v>>2]|0),X=+Bl(+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=+Bl(+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=+Bl(+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,O=q*b-N*M,O!=0&&(Ae=K-x,Be=j-E,M=(Ae*M-b*Be)/O,!(M<0|M>1))&&(O=(q*Ae-N*Be)/O,O>=0&O<=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 YG(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;if(XS(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,XS((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 uue(){return 8}function hue(){return 16}function fue(){return 168}function due(){return 8}function pue(){return 16}function mue(){return 12}function Aue(){return 8}function gue(p){return p=p|0,+(+((h[p>>2]|0)>>>0)+4294967296*+(h[p+4>>2]|0))}function vue(p){p=p|0;var m=0,g=0;return g=+ie[p>>3],m=+ie[p+8>>3],+ +ys(+(g*g+m*m))}function ZG(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,O=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],O=+ie[_+8>>3]-j,x=(x*(E-j)-(N-q)*O)/(M*O-b*x),ie[v>>3]=N+M*x,ie[v+8>>3]=E+b*x}function KG(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 _ue(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(zx(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 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,O=0;if(O=Q,Q=Q+32|0,E=O+16|0,M=O,_=f1(p,m,E)|0,_|0)return g=_,Q=O,g|0;x=UG(p,m)|0,N=ol(p,m)|0,hce(x,M),_=fce(x,h[E>>2]|0)|0;do if(xr(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=kP(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=O,g|0}function Ac(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,O=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,O=tt(p|0,m|0,52)|0,ee()|0,O=O&15,M>>>0<=g>>>0)return _=2,Q=we,_|0;q=(O|0)==0,!q&&(ae=ft(7,0,(O^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)||zx(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,(O^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),zx(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=GS(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(zx(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=GS(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(zx(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 xue(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,_=Ac(p,m,0,g)|0,v=(_|0)==0,x?!v||(_=Ac(p,m,1,g+8|0)|0,_|0)||(_=Ac(p,m,2,g+16|0)|0,_|0)||(_=Ac(p,m,3,g+24|0)|0,_|0)||(_=Ac(p,m,4,g+32|0)|0,_)?(x=_,x|0):Ac(p,m,5,g+40|0)|0:!v||(_=Ac(p,m,1,g+8|0)|0,_|0)||(_=Ac(p,m,2,g+16|0)|0,_|0)||(_=Ac(p,m,3,g+24|0)|0,_|0)||(_=Ac(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 yue(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,_=f1(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?HP(x,m,b,1,v):WP(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 QG(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,!(HS(p,_)|0))?(_=0,Q=v,_|0):(x=tt(p|0,m|0,56)|0,ee()|0,x=(Ac(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 JG(){return 27680}function $S(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,O=0,q=0,j=0;q=Q,Q=Q+208|0,M=q,N=q+192|0,b=sl(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?oL(p,g,_,v,M):ZS(p,g,_,N,v,0,M),(v|0)==1){KS(N,1),v=0;break}else{KS(N,m),v=1;break}else oL(p,g,_,v,M),YS(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(ZS(p,g,_,N,v,0,M),x=N+4|0;;){if((v|0)==1&(m|0)==1)if(h[x>>2]|0)O=19;else break e;else(v|0)<2?O=19:(KS(N,2),j=v+-2|0,h[N>>2]=h[N>>2]^7,YS(N,1),ZS(p+(0-(h[M+(j<<2)>>2]|0))+E|0,g,_,N,v+-1|0,1,M),KS(N,1),m=h[N>>2]|1,h[N>>2]=m,p=p+E|0,ZS(p,g,_,N,j,1,M),v=j);(O|0)==19&&(O=0,m=eq(N)|0,YS(N,m),p=p+E|0,v=m+v|0,m=h[N>>2]|0)}}while(!1);Q=q}function oL(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,O=0,q=0;q=Q,Q=Q+240|0,O=q,h[O>>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,(sp[g&3](b,p)|0)>-1&&(sp[g&3](b,E)|0)>-1||(b=O+(_<<2)|0,(sp[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[O>>2]|0}else _=1;while(!1);nq(m,O,_),Q=q}function YS(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 ZS(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,O=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&&(O=0-m|0,E=p+(0-(h[b+(v<<2)>>2]|0))|0,(sp[g&3](E,p)|0)>=1))for(_=1,x=(x|0)==0,M=E;;){if(x&(v|0)>1){if(x=p+O|0,E=h[b+(v+-2<<2)>>2]|0,(sp[g&3](x,M)|0)>-1){E=10;break e}if((sp[g&3](x+(0-E)|0,M)|0)>-1){E=10;break e}}if(x=_+1|0,h[j+(_<<2)>>2]=M,K=eq(q)|0,YS(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,(sp[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&&(nq(m,j,_),oL(p,m,g,v,b)),Q=X}function KS(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 eq(p){p=p|0;var m=0;return m=tq((h[p>>2]|0)+-1|0)|0,m?m|0:(m=tq(h[p+4>>2]|0)|0,((m|0)==0?0:m+32|0)|0)}function tq(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 nq(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,iu(_|0,h[m>>2]|0,v|0)|0,_=0;do E=m+(_<<2)|0,_=_+1|0,iu(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 th(p){return p=+p,~~+aq(+p)|0}function yr(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=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(O=h[6923]|0,N>>>0>O>>>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,O|0&&(_=h[6926]|0,m=O>>>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,O|0&&(_=h[6926]|0,m=O>>>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&&(O=E+N|0,O>>>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[O+4>>2]=b|1,h[O+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]=O,h[m+12>>2]=O,h[O+8>>2]=m,h[O+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[O+28>>2]=g,p=O+16|0,h[p+4>>2]=0,h[p>>2]=0,p=1<<g,!(_&p)){h[6922]=_|p,h[m>>2]=O,h[O+24>>2]=m,h[O+12>>2]=O,h[O+8>>2]=O;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]=O,h[O+24>>2]=m,h[O+12>>2]=O,h[O+8>>2]=O;break e}while(!1);we=m+8|0,Ae=h[we>>2]|0,h[Ae+12>>2]=O,h[we>>2]=O,h[O+8>>2]=Ae,h[O+12>>2]=m,h[O+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&&(O=h[7029]|0,j=O+N|0,j>>>0<=O>>>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=rp(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=rp(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=rp(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((rp(p|0)|0)==-1){rp(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=rp(N|0)|0,K=rp(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,O=m+4|0,h[O>>2]=(h[O>>2]|0)+b,O=x+8|0,O=x+((O&7|0)==0?0:0-O&7)|0,m=g+8|0,m=g+((m&7|0)==0?0:0-m&7)|0,N=O+q|0,E=m-O-q|0,h[O+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=O+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=JG()|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 Sa(p,m){p=p|0,m=m|0;var g=0;return p?(g=sl(m,p)|0,(m|p)>>>0>65535&&(g=((g>>>0)/(p>>>0)|0|0)==(m|0)?g:-1)):g=0,p=yr(g)|0,!p||!(h[p+-4>>2]&3)||ip(p|0,0,g|0)|0,p|0}function bue(p,m){p=p|0,m=m|0;var g=0,_=0;return p?m>>>0>4294967231?(m=JG()|0,h[m>>2]=12,m=0,m|0):(g=wue(p+-8|0,m>>>0<11?16:m+11&-8)|0,g|0?(m=g+8|0,m|0):(g=yr(m)|0,g?(_=h[p+-4>>2]|0,_=(_&-8)-((_&3|0)==0?8:4)|0,iu(g|0,p|0,(_>>>0<m>>>0?_:m)|0)|0,_t(p),m=g,m|0):(m=0,m|0))):(m=yr(m)|0,m|0)}function wue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0;if(O=p+4|0,q=h[O>>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[O>>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[O>>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[O>>2]=q&1|m|2,h[N+4>>2]=g|1,h[_>>2]=g,_=_+4|0,h[_>>2]=h[_>>2]&-2,_=N):(h[O>>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[O>>2]=q&1|M|2,q=p+M+4|0,h[q>>2]=h[q>>2]|1,p|0):(E=p+m|0,h[O>>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 rq(p){return p=p|0,(p?31-(zf(p^p-1)|0)|0:32)|0}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,O=0,q=0,j=0,X=0,K=0;if(O=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]=(O>>>0)%(b>>>0),h[v+4>>2]=0),j=0,v=(O>>>0)/(b>>>0)>>>0,On(j|0),v|0);x=(E|0)==0;do if(b){if(!x){if(x=(zf(E|0)|0)-(zf(N|0)|0)|0,x>>>0<=31){q=x+1|0,E=31-x|0,m=x-31>>31,b=q,p=O>>>(q>>>0)&m|N<<E,m=N>>>(q>>>0)&m,x=0,E=O<<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=(zf(b|0)|0)+33-(zf(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|O>>>(E>>>0))&m,m=m&N>>>(E>>>0),x=O<<K&M,E=(N<<K|O>>>(X>>>0))&M|O<<q&E-33>>31;break}return v|0&&(h[v>>2]=x&O,h[v+4>>2]=0),(b|0)==1?(X=M|m&0,K=p|0|0,On(X|0),K|0):(K=rq(b|0)|0,X=N>>>(K>>>0)|0,K=N<<32-K|O>>>(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(!O)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>>>((rq(E|0)|0)>>>0),On(X|0),K|0;if(x=(zf(E|0)|0)-(zf(N|0)|0)|0,x>>>0<=30){m=x+1|0,E=31-x|0,b=m,p=N<<E|O>>>(m>>>0),m=N>>>(m>>>0),x=0,E=O<<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,O=j|_&0,N=At(q|0,O|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)&O|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 tp(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((aL(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 Sue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return x=p&65535,v=m&65535,g=sl(v,x)|0,_=p>>>16,p=(g>>>16)+(sl(v,_)|0)|0,v=m>>>16,m=sl(v,x)|0,On((p>>>16)+(sl(v,_)|0)+(((p&65535)+m|0)>>>16)|0),p+m<<16|g&65535|0|0}function br(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;return v=p,x=g,g=Sue(v,x)|0,p=ee()|0,On((sl(m,x)|0)+(sl(_,v)|0)+p|p&0|0),g|0|0|0}function np(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,aL(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 Vf(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,aL(p,m,g,_,v)|0,Q=x,On(h[v+4>>2]|0),h[v>>2]|0|0}function sq(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 lL(p,m,g){return p=p|0,m=m|0,g=g|0,m=zf(m)|0,(m|0)==32&&(m=m+(zf(p)|0)|0),On(0),m|0}function oq(p,m){return p=+p,m=+m,p!=p?+m:m!=m?+p:+Hle(+p,+m)}function QS(p,m){return p=+p,m=+m,p!=p?+m:m!=m?+p:+UP(+p,+m)}function JS(p){return p=+p,p>=0?+ho(p+.5):+u1(p-.5)}function iu(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if((g|0)>=8192)return Xle(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 cL(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 iu(p,m,g)|0;return p|0}function ip(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 aq(p){return p=+p,p>=0?+ho(p+.5):+u1(p-.5)}function rp(p){p=p|0;var m=0,g=0,_=0;return _=jle()|0,g=h[rl>>2]|0,m=g+p|0,(p|0)>0&(m|0)<(g|0)|(m|0)<0?(Yle(m|0)|0,bG(12),-1):(m|0)>(_|0)&&!($le(m|0)|0)?(bG(12),-1):(h[rl>>2]=m,g|0)}function Tue(p,m,g){return p=p|0,m=m|0,g=g|0,sp[p&3](m|0,g|0)|0}function Eue(p,m){return p=p|0,m=m|0,Wle(0),0}var sp=[Eue,bce,wce,Sce];return{___divdi3:tp,___muldi3:br,___remdi3:np,___uremdi3:Vf,_areNeighborCells:Tce,_bitshift64Ashr:sq,_bitshift64Lshr:tt,_bitshift64Shl:ft,_calloc:Sa,_cellAreaKm2:lce,_cellAreaM2:cce,_cellAreaRads2:ace,_cellToBoundary:Fm,_cellToCenterChild:zG,_cellToChildPos:Wce,_cellToChildren:Bce,_cellToChildrenSize:Nx,_cellToLatLng:d1,_cellToLocalIj:iue,_cellToParent:$P,_cellToVertex:Ac,_cellToVertexes:xue,_cellsToDirectedEdge:Ece,_cellsToLinkedMultiPolygon:oce,_childPosToCell:jce,_compactCells:Oce,_constructCell:Nce,_destroyLinkedMultiPolygon:tue,_directedEdgeToBoundary:Lx,_directedEdgeToCells:Rce,_edgeLengthKm:Jce,_edgeLengthM:eue,_edgeLengthRads:Qce,_emscripten_replace_memory:Zle,_free:_t,_getBaseCellNumber:UG,_getDirectedEdgeDestination:Cce,_getDirectedEdgeOrigin:Mce,_getHexagonAreaAvgKm2:qG,_getHexagonAreaAvgM2:Yce,_getHexagonEdgeLengthAvgKm:Zce,_getHexagonEdgeLengthAvgM:Kce,_getIcosahedronFaces:VG,_getIndexDigit:Dce,_getNumCells:WS,_getPentagons:JP,_getRes0Cells:pce,_getResolution:jP,_greatCircleDistanceKm:Bx,_greatCircleDistanceM:$ce,_greatCircleDistanceRads:Xce,_gridDisk:wG,_gridDiskDistances:SG,_gridDistance:nL,_gridPathCells:oue,_gridPathCellsSize:sue,_gridRing:nce,_gridRingUnsafe:EG,_i64Add:At,_i64Subtract:Js,_isPentagon:Zi,_isResClassIII:zce,_isValidCell:HS,_isValidDirectedEdge:NG,_isValidIndex:Fce,_isValidVertex:QG,_latLngToCell:KP,_llvm_ctlz_i64:lL,_llvm_maxnum_f64:oq,_llvm_minnum_f64:QS,_llvm_round_f64:JS,_localIjToCell:rue,_malloc:yr,_maxFaceCount:qce,_maxGridDiskSize:tce,_maxPolygonToCellsSize:rce,_maxPolygonToCellsSizeExperimental:cue,_memcpy:iu,_memmove:cL,_memset:ip,_originToDirectedEdges:qP,_pentagonCount:Hce,_polygonToCells:sce,_polygonToCellsExperimental:lue,_readInt64AsDoubleFromPointer:gue,_res0CellCount:dce,_reverseDirectedEdge:FG,_round:aq,_sbrk:rp,_sizeOfCellBoundary:fue,_sizeOfCoordIJ:Aue,_sizeOfGeoLoop:due,_sizeOfGeoPolygon:pue,_sizeOfH3Index:uue,_sizeOfLatLng:hue,_sizeOfLinkedGeoPolygon:mue,_uncompactCells:Uce,_uncompactCellsSize:kce,_vertexToLatLng:yue,dynCall_iii:Tue,establishStackSpace:ece,stackAlloc:Kle,stackRestore:Jle,stackSave:Qle}})(Bt,ut,W),Yt=e.___divdi3=Ce.___divdi3,nr=e.___muldi3=Ce.___muldi3,Fn=e.___remdi3=Ce.___remdi3,ns=e.___uremdi3=Ce.___uremdi3,Pr=e._areNeighborCells=Ce._areNeighborCells,Ll=e._bitshift64Ashr=Ce._bitshift64Ashr,ba=e._bitshift64Lshr=Ce._bitshift64Lshr,Dl=e._bitshift64Shl=Ce._bitshift64Shl,nl=e._calloc=Ce._calloc,_r=e._cellAreaKm2=Ce._cellAreaKm2,Zs=e._cellAreaM2=Ce._cellAreaM2,Nl=e._cellAreaRads2=Ce._cellAreaRads2,Ju=e._cellToBoundary=Ce._cellToBoundary,kS=e._cellToCenterChild=Ce._cellToCenterChild,IP=e._cellToChildPos=Ce._cellToChildPos,PP=e._cellToChildren=Ce._cellToChildren,Rx=e._cellToChildrenSize=Ce._cellToChildrenSize,LP=e._cellToLatLng=Ce._cellToLatLng,Ix=e._cellToLocalIj=Ce._cellToLocalIj,DP=e._cellToParent=Ce._cellToParent,NP=e._cellToVertex=Ce._cellToVertex,dG=e._cellToVertexes=Ce._cellToVertexes,pG=e._cellsToDirectedEdge=Ce._cellsToDirectedEdge,mG=e._cellsToLinkedMultiPolygon=Ce._cellsToLinkedMultiPolygon,AG=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,on=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,is=e._getHexagonAreaAvgM2=Ce._getHexagonAreaAvgM2,Gr=e._getHexagonEdgeLengthAvgKm=Ce._getHexagonEdgeLengthAvgKm,ir=e._getHexagonEdgeLengthAvgM=Ce._getHexagonEdgeLengthAvgM,Mo=e._getIcosahedronFaces=Ce._getIcosahedronFaces,Zt=e._getIndexDigit=Ce._getIndexDigit,il=e._getNumCells=Ce._getNumCells,yi=e._getPentagons=Ce._getPentagons,Fl=e._getRes0Cells=Ce._getRes0Cells,nu=e._getResolution=Ce._getResolution,Of=e._greatCircleDistanceKm=Ce._greatCircleDistanceKm,Pm=e._greatCircleDistanceM=Ce._greatCircleDistanceM,rr=e._greatCircleDistanceRads=Ce._greatCircleDistanceRads,rs=e._gridDisk=Ce._gridDisk,Uf=e._gridDiskDistances=Ce._gridDiskDistances,pr=e._gridDistance=Ce._gridDistance,kf=e._gridPathCells=Ce._gridPathCells,Lm=e._gridPathCellsSize=Ce._gridPathCellsSize,FP=e._gridRing=Ce._gridRing,b6e=e._gridRingUnsafe=Ce._gridRingUnsafe,w6e=e._i64Add=Ce._i64Add,S6e=e._i64Subtract=Ce._i64Subtract,T6e=e._isPentagon=Ce._isPentagon,E6e=e._isResClassIII=Ce._isResClassIII,M6e=e._isValidCell=Ce._isValidCell,C6e=e._isValidDirectedEdge=Ce._isValidDirectedEdge,R6e=e._isValidIndex=Ce._isValidIndex,I6e=e._isValidVertex=Ce._isValidVertex,P6e=e._latLngToCell=Ce._latLngToCell,L6e=e._llvm_ctlz_i64=Ce._llvm_ctlz_i64,D6e=e._llvm_maxnum_f64=Ce._llvm_maxnum_f64,N6e=e._llvm_minnum_f64=Ce._llvm_minnum_f64,F6e=e._llvm_round_f64=Ce._llvm_round_f64,B6e=e._localIjToCell=Ce._localIjToCell,O6e=e._malloc=Ce._malloc,U6e=e._maxFaceCount=Ce._maxFaceCount,k6e=e._maxGridDiskSize=Ce._maxGridDiskSize,z6e=e._maxPolygonToCellsSize=Ce._maxPolygonToCellsSize,V6e=e._maxPolygonToCellsSizeExperimental=Ce._maxPolygonToCellsSizeExperimental,G6e=e._memcpy=Ce._memcpy,q6e=e._memmove=Ce._memmove,H6e=e._memset=Ce._memset,W6e=e._originToDirectedEdges=Ce._originToDirectedEdges,j6e=e._pentagonCount=Ce._pentagonCount,X6e=e._polygonToCells=Ce._polygonToCells,$6e=e._polygonToCellsExperimental=Ce._polygonToCellsExperimental,Y6e=e._readInt64AsDoubleFromPointer=Ce._readInt64AsDoubleFromPointer,Z6e=e._res0CellCount=Ce._res0CellCount,K6e=e._reverseDirectedEdge=Ce._reverseDirectedEdge,Q6e=e._round=Ce._round,J6e=e._sbrk=Ce._sbrk,e8e=e._sizeOfCellBoundary=Ce._sizeOfCellBoundary,t8e=e._sizeOfCoordIJ=Ce._sizeOfCoordIJ,n8e=e._sizeOfGeoLoop=Ce._sizeOfGeoLoop,i8e=e._sizeOfGeoPolygon=Ce._sizeOfGeoPolygon,r8e=e._sizeOfH3Index=Ce._sizeOfH3Index,s8e=e._sizeOfLatLng=Ce._sizeOfLatLng,o8e=e._sizeOfLinkedGeoPolygon=Ce._sizeOfLinkedGeoPolygon,a8e=e._uncompactCells=Ce._uncompactCells,l8e=e._uncompactCellsSize=Ce._uncompactCellsSize,c8e=e._vertexToLatLng=Ce._vertexToLatLng,u8e=e.establishStackSpace=Ce.establishStackSpace,gG=e.stackAlloc=Ce.stackAlloc,Vle=e.stackRestore=Ce.stackRestore,Gle=e.stackSave=Ce.stackSave,h8e=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 BP=function(Le){Le.byteLength&&(Le=new Uint8Array(Le)),H.set(Le,A),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,zn("memory initializer")},vG=function(){a(le,BP,function(){throw"could not load memory initializer "+le})},_G=St(le);if(_G)BP(_G.buffer);else if(e.memoryInitializerRequest){var xG=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),vG();return}}BP(it)};e.memoryInitializerRequest.response?setTimeout(xG,0):e.memoryInitializerRequest.addEventListener("load",xG)}else vG()}}var zS;ve=function Le(){zS||OP(),zS||(ve=Le)};function OP(Le){if(Le=Le||r,tn>0||(It(),tn>0))return;function it(){zS||(zS=!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=OP;function Dm(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=Dm,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return OP(),i})(typeof Ai=="object"?Ai:{}),En="number",Sn=En,E_=En,Cn=En,Rn=En,bo=En,jt=En,Kwe=[["sizeOfH3Index",En],["sizeOfLatLng",En],["sizeOfCellBoundary",En],["sizeOfGeoLoop",En],["sizeOfGeoPolygon",En],["sizeOfLinkedGeoPolygon",En],["sizeOfCoordIJ",En],["readInt64AsDoubleFromPointer",En],["isValidCell",E_,[Cn,Rn]],["isValidIndex",E_,[Cn,Rn]],["latLngToCell",Sn,[En,En,bo,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,bo,En,jt]],["polygonToCells",Sn,[jt,bo,En,jt]],["maxPolygonToCellsSizeExperimental",Sn,[jt,bo,En,jt]],["polygonToCellsExperimental",Sn,[jt,bo,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,bo]],["uncompactCellsSize",Sn,[jt,En,En,bo,jt]],["isPentagon",E_,[Cn,Rn]],["isResClassIII",E_,[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,bo,jt]],["cellToChildren",Sn,[Cn,Rn,bo,jt]],["cellToCenterChild",Sn,[Cn,Rn,bo,jt]],["cellToChildrenSize",Sn,[Cn,Rn,bo,jt]],["cellToChildPos",Sn,[Cn,Rn,bo,jt]],["childPosToCell",Sn,[En,En,Cn,Rn,bo,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",E_,[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,[bo,jt]],["getHexagonAreaAvgKm2",Sn,[bo,jt]],["getHexagonEdgeLengthAvgM",Sn,[bo,jt]],["getHexagonEdgeLengthAvgKm",Sn,[bo,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,[bo,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",E_,[Cn,Rn]]],Qwe=0,Jwe=1,eSe=2,tSe=3,qJ=4,nSe=5,iSe=6,rSe=7,sSe=8,oSe=9,aSe=10,lSe=11,cSe=12,uSe=13,hSe=14,fSe=15,dSe=16,pSe=17,mSe=18,ASe=19,Cs={};Cs[Qwe]="Success";Cs[Jwe]="The operation failed but a more specific error is not available";Cs[eSe]="Argument was outside of acceptable range";Cs[tSe]="Latitude or longitude arguments were outside of acceptable range";Cs[qJ]="Resolution argument was outside of acceptable range";Cs[nSe]="Cell argument was not valid";Cs[iSe]="Directed edge argument was not valid";Cs[rSe]="Undirected edge argument was not valid";Cs[sSe]="Vertex argument was not valid";Cs[oSe]="Pentagon distortion was encountered";Cs[aSe]="Duplicate input";Cs[lSe]="Cell arguments were not neighbors";Cs[cSe]="Cell arguments had incompatible resolutions";Cs[uSe]="Memory allocation failed";Cs[hSe]="Bounds of provided memory were insufficient";Cs[fSe]="Mode or flags argument was not valid";Cs[dSe]="Index argument was not valid";Cs[pSe]="Base cell number was outside of acceptable range";Cs[mSe]="Child indexing digits invalid";Cs[ASe]="Child indexing digits refer to a deleted subsequence";var gSe=1e3,HJ=1001,WJ=1002,XC={};XC[gSe]="Unknown unit";XC[HJ]="Array length out of bounds";XC[WJ]="Got unexpected null value for H3 index";var vSe="Unknown error";function jJ(i,e,t){var n=t&&"value"in t,r=new Error((i[e]||vSe)+" (code: "+e+(n?", value: "+t.value:"")+")");return r.code=e,r}function XJ(i,e){var t=arguments.length===2?{value:e}:{};return jJ(Cs,i,t)}function $J(i,e){var t=arguments.length===2?{value:e}:{};return jJ(XC,i,t)}function vw(i){if(i!==0)throw XJ(i)}var El={};Kwe.forEach(function(e){El[e[0]]=Ai.cwrap.apply(Ai,e)});var M_=16;var _w=4;var C_=8,_Se=8,WC=El.sizeOfH3Index(),iO=El.sizeOfLatLng(),xSe=El.sizeOfCellBoundary(),ySe=El.sizeOfGeoPolygon(),gw=El.sizeOfGeoLoop(),kot=El.sizeOfLinkedGeoPolygon(),zot=El.sizeOfCoordIJ();function bSe(i){if(typeof i!="number"||i<0||i>15||Math.floor(i)!==i)throw XJ(qJ,i);return i}function wSe(i){if(!i)throw $J(WJ);return i}var SSe=Math.pow(2,32)-1,Vot=Math.pow(2,31)-1;function TSe(i){if(i>SSe)throw $J(HJ,i);return i}var ESe=/[^0-9a-fA-F]/;function YJ(i){if(Array.isArray(i)&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1]))return i;if(typeof i!="string"||ESe.test(i))return[0,0];var e=parseInt(i.substring(0,i.length-8),M_),t=parseInt(i.substring(i.length-8),M_);return[t,e]}function VJ(i){if(i>=0)return i.toString(M_);i=i&2147483647;var e=ZJ(8,i.toString(M_)),t=(parseInt(e[0],M_)+8).toString(M_);return e=t+e.substring(1),e}function MSe(i,e){return VJ(e)+ZJ(8,VJ(i))}function ZJ(i,e){for(var t=i-e.length,n="",r=0;r<t;r++)n+="0";return n=n+e,n}var Got=Math.pow(2,32);function GJ(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(eee),r/C_+a);return Ai.HEAPU32.set([n,r],e/_w),e}function CSe(i,e){var t=i.length-1,n=Ai._calloc(ySe),r=0,s=r+gw,o=s+_w;GJ(i[0],n+r,e);var a;if(t>0){a=Ai._calloc(t,gw);for(var l=0;l<t;l++)GJ(i[l+1],a+gw*l,e)}return Ai.setValue(n+s,t,"i32"),Ai.setValue(n+o,a,"i32"),n}function RSe(i){var e=0,t=e+gw,n=t+_w,r=_w;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+gw*a+r,"i8*"));Ai._free(o)}Ai._free(i)}function KJ(i,e){e===void 0&&(e=0);var t=Ai.getValue(i+WC*e,"i32"),n=Ai.getValue(i+WC*e+_w,"i32");return n?MSe(t,n):null}function ISe(i){return El.readInt64AsDoubleFromPointer(i)}function PSe(i,e){for(var t=[],n=0;n<e;n++){var r=KJ(i,n);r!==null&&t.push(r)}return t}function jC(i){return NSe(Ai.getValue(i,"double"))}function QJ(i){return[jC(i),jC(i+C_)]}function LSe(i){return[jC(i+C_),jC(i)]}function DSe(i,e,t){for(var n=Ai.getValue(i,"i32"),r=i+C_,s=[],o=e?LSe:QJ,a=0;a<n*2;a+=2)s.push(o(r+C_*a));return t&&s.push(s[0]),s}function JJ(i,e,t){var n=Ai._malloc(iO);Ai.HEAPF64.set([i,e].map(eee),n/C_);var r=Ai._malloc(WC);try{return vw(El.latLngToCell(n,t,r)),wSe(KJ(r))}finally{Ai._free(r),Ai._free(n)}}function rO(i){var e=Ai._malloc(iO),t=YJ(i),n=t[0],r=t[1];try{return vw(El.cellToLatLng(n,r,e)),QJ(e)}finally{Ai._free(e)}}function sO(i,e){var t=Ai._malloc(xSe),n=YJ(i),r=n[0],s=n[1];try{return vw(El.cellToBoundary(r,s,t)),DSe(t,e,e)}finally{Ai._free(t)}}function oO(i,e,t){if(bSe(e),t=!!t,i.length===0||i[0].length===0)return[];var n=typeof i[0][0]=="number"?[i]:i,r=CSe(n,t),s=Ai._malloc(_Se);try{vw(El.maxPolygonToCellsSize(r,e,0,s));var o=TSe(ISe(s)),a=Ai._calloc(o,WC);try{return vw(El.polygonToCells(r,e,0,a)),PSe(a,o)}finally{Ai._free(a)}}finally{Ai._free(s),RSe(r)}}function eee(i){return i*Math.PI/180}function NSe(i){return i*180/Math.PI}function aO(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 FSe=["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"],tee=new WeakMap,nee=new WeakMap,iee=new WeakMap,jO=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=FSe,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=iee.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}},iee.set(e,t)),t}getMaterialData(e){let t=nee.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)}nee.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=tee.get(e);return n===void 0&&(n={renderId:-1,lightsData:[]},tee.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}},BSe=[/^StackTrace\.js$/,/^TSLCore\.js$/,/^.*Node\.js$/,/^three\.webgpu.*\.js$/];function OSe(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&&!BSe.some(n=>n.test(t.file)))}var Jr=class{constructor(e=null){this.isStackTrace=!0,this.stack=OSe(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 L9(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 cx=i=>L9(i),mS=i=>L9(i),kw=(...i)=>L9(i),OSe=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),iee=new WeakMap;function Tte(i){return OSe.get(i)}function OR(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 Ete(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 Jr)}function USe(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 Jr)}function kSe(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 Jr)}function am(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 D9(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 Kv(...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"?VSe(e[0]):null}function Mte(i){let e=iee.get(i);return e===void 0&&(e={},iee.set(i,e)),e}function zSe(i){let e="",t=new Uint8Array(i);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function VSe(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0)).buffer}var G_={VERTEX:"vertex",FRAGMENT:"fragment"},yn={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},GSe={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},Wo={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},Cte=["fragment","vertex"],PR=["setup","analyze","generate"],LR=[...Cte,"compute"],Kg=["x","y","z","w"],qSe={analyze:"setup",generate:"analyze"},HSe=0,Kt=class i extends aa{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=HSe++,this.stackTrace=null,i.captureStackTrace===!0&&(this.stackTrace=new Jr)}set needsUpdate(e){e===!0&&this.version++}get uuid(){return this._uuid===null&&(this._uuid=Lu.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(cx(r.slice(0,-4)),s.getCacheKey(e,t));this._cacheKey=kw(mS(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=qSe[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 Wd=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} ]`}},UR=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)}},Cr=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)}},XO=class extends Cr{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)}},WSe=Kg.join(""),kR=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(Kg.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===WSe.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}},$O=class extends Cr{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=Kg[d];A===n[0]?(f.push(l),d+=n.length-1):f.push(c+"."+A)}return`${e.getType(s)}( ${f.join(", ")} )`}},YO=class extends Cr{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=Kg[f];d===t[u]?(c.push("1.0 - "+(a+"."+d)),u++):c.push(a+"."+d)}return`${e.getType(r)}( ${c.join(", ")} )`}},$w=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?am(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=am(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=zSe(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?D9(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.")}},ree=/float|u?int/,Kc=class extends $w{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 ree.test(n)&&ree.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}},ZO=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}},hm=null,KO=new Map;function Ue(i,e){if(KO.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`);KO.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 jSe=i=>i.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),see=i=>jSe(i).split("").sort().join("");Kt.prototype.assign=function(...i){if(this.isStackNode!==!0)return hm!==null?hm.assign(this,...i):ze("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new Jr),this;{let e=KO.get("assign");return this.addToStack(e(...i))}};Kt.prototype.toVarIntent=function(){return this};Kt.prototype.get=function(i){return new ZO(this,i)};var zw={};function $C(i,e,t){zw[i]=zw[e]=zw[t]={get(){this._cache=this._cache||{};let o=this._cache[i];return o===void 0&&(o=new kR(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=see(i);return new $O(this,a,Ht(o))},Kt.prototype["flip"+n]=Kt.prototype["flip"+r]=Kt.prototype["flip"+s]=function(){let o=see(i);return new YO(this,o)}}var rf=["x","y","z","w"],sf=["r","g","b","a"],of=["s","t","p","q"];for(let i=0;i<4;i++){let e=rf[i],t=sf[i],n=of[i];$C(e,t,n);for(let r=0;r<4;r++){e=rf[i]+rf[r],t=sf[i]+sf[r],n=of[i]+of[r],$C(e,t,n);for(let s=0;s<4;s++){e=rf[i]+rf[r]+rf[s],t=sf[i]+sf[r]+sf[s],n=of[i]+of[r]+of[s],$C(e,t,n);for(let o=0;o<4;o++)e=rf[i]+rf[r]+rf[s]+rf[o],t=sf[i]+sf[r]+sf[s]+sf[o],n=of[i]+of[r]+of[s]+of[o],$C(e,t,n)}}}for(let i=0;i<32;i++)zw[i]={get(){this._cache=this._cache||{};let e=this._cache[i];return e===void 0&&(e=new Wd(this,new Kc(i,"uint")),this._cache[i]=e),e},set(e){this[i].assign(Ht(e))}};Object.defineProperties(Kt.prototype,zw);var XSe=function(i,e=null){let t=am(i);return t==="node"?i:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?Ht(eU(i,e)):t==="shader"?i.isFn?i:me(i):i},$Se=function(i,e=null){for(let t in i)i[t]=Ht(i[t],e);return i},YSe=function(i,e=null){let t=i.length;for(let n=0;n<t;n++)i[n]=Ht(i[n],e);return i},Rte=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 Jr),u.concat(new Array(a-u.length).fill(0))):l!==void 0&&u.length>l?(ze(`TSL: "${f}" parameter length exceeds limit.`,new Jr),u.slice(0,l)):u}return e===null?s=(...u)=>r(new i(...Fg(c(u)))):t!==null?(t=Ht(t),s=(...u)=>r(new i(e,...Fg(c(u)),t))):s=(...u)=>r(new i(e,...Fg(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},ZSe=function(i,...e){return new i(...Fg(e))},QO=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(Ite(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?KSe(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?QSe(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 Ite(i){return i[0]&&(i[0].isNode||Object.getPrototypeOf(i[0])!==Object.prototype)}function KSe(i){let e;return Q4(i),Ite(i)?e=[...i]:e=i[0],e}function QSe(i){let e=0;return Q4(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 JO=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 QO(this,e)}setup(){return this.call()}},JSe=[!1,!0],eTe=[0,1,2,3],tTe=[-1,-2],Pte=[.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],N9=new Map;for(let i of JSe)N9.set(i,new Kc(i));var F9=new Map;for(let i of eTe)F9.set(i,new Kc(i,"uint"));var B9=new Map([...F9].map(i=>new Kc(i.value,"int")));for(let i of tTe)B9.set(i,new Kc(i,"int"));var Z4=new Map([...B9].map(i=>new Kc(i.value)));for(let i of Pte)Z4.set(i,new Kc(i));for(let i of Pte)Z4.set(-i,new Kc(-i));var K4={bool:N9,uint:F9,ints:B9,float:Z4},oee=new Map([...N9,...Z4]),eU=(i,e)=>oee.has(i)?oee.get(i):i.isNode===!0?i:new Kc(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 Jr),new Kc(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=[D9(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return Ow(e.get(t[0]));if(t.length===1){let r=eU(t[0],i);return r.nodeType===i?Ow(r):Ow(new UR(r,i))}let n=t.map(r=>eU(r));return Ow(new XO(n,i))}};function J_(i){return i&&i.isNode&&i.traverse(e=>{e.isConstNode&&(i=e.value)}),!!i}var Lte=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function W_(i,e){return new JO(i,e)}var Ht=(i,e=null)=>XSe(i,e),Ow=(i,e=null)=>Ht(i,e).toVarIntent(),Q4=(i,e=null)=>new $Se(i,e),Fg=(i,e=null)=>new YSe(i,e),$n=(i,e=null,t=null,n=null)=>new Rte(i,e,t,n),xt=(i,...e)=>new ZSe(i,...e),ct=(i,e=null,t=null,n={})=>new Rte(i,e,t,{...n,intent:!0}),O9=(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)}}),nTe=0,tU=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 Jr),t=null)),this.shaderNode=new W_(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"+nTe++,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 tU(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 Yw=i=>{hm=i},U9=()=>hm,$t=(...i)=>hm.If(...i),iTe=(...i)=>hm.Switch(...i);function J4(i){return hm&&hm.addToStack(i),i}Ue("toStack",J4);var Dte=new Ys("color"),oe=new Ys("float",K4.float),de=new Ys("int",K4.ints),rt=new Ys("uint",K4.uint),lc=new Ys("bool",K4.bool),dt=new Ys("vec2"),Ur=new Ys("ivec2"),k9=new Ys("uvec2"),Nte=new Ys("bvec2"),pe=new Ys("vec3"),z9=new Ys("ivec3"),Qg=new Ys("uvec3"),V9=new Ys("bvec3"),Ft=new Ys("vec4"),G9=new Ys("ivec4"),q9=new Ys("uvec4"),Fte=new Ys("bvec4"),eI=new Ys("mat2"),So=new Ys("mat3"),cm=new Ys("mat4");Ue("toColor",Dte);Ue("toFloat",oe);Ue("toInt",de);Ue("toUint",rt);Ue("toBool",lc);Ue("toVec2",dt);Ue("toIVec2",Ur);Ue("toUVec2",k9);Ue("toBVec2",Nte);Ue("toVec3",pe);Ue("toIVec3",z9);Ue("toUVec3",Qg);Ue("toBVec3",V9);Ue("toVec4",Ft);Ue("toIVec4",G9);Ue("toUVec4",q9);Ue("toBVec4",Fte);Ue("toMat2",eI);Ue("toMat3",So);Ue("toMat4",cm);var Bte=$n(Wd).setParameterLength(2),Ote=(i,e)=>new UR(Ht(i),e),rTe=(i,e)=>new kR(Ht(i),e);Ue("element",Bte);Ue("convert",Ote);var sTe=i=>(Xe("TSL: append() has been renamed to Stack().",new Jr),J4(i));Ue("append",i=>(Xe("TSL: .append() has been renamed to .toStack().",new Jr),J4(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 cx(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)}},$d=(i,e,t=null)=>new gi(i,e,!1,t),Jg=(i,e,t=null)=>new gi(i,e,!0,t),Bi=xt(gi,"vec4","DiffuseColor"),Rg=xt(gi,"vec3","DiffuseContribution"),nU=xt(gi,"vec3","EmissiveColor"),df=xt(gi,"float","Roughness"),Hd=xt(gi,"float","Metalness"),zR=xt(gi,"float","Clearcoat"),X_=xt(gi,"float","ClearcoatRoughness"),rc=xt(gi,"vec3","Sheen"),nm=xt(gi,"float","SheenRoughness"),tI=xt(gi,"float","Iridescence"),VR=xt(gi,"float","IridescenceIOR"),GR=xt(gi,"float","IridescenceThickness"),qR=xt(gi,"float","AlphaT"),tm=xt(gi,"float","Anisotropy"),Vw=xt(gi,"vec3","AnisotropyT"),Bg=xt(gi,"vec3","AnisotropyB"),fm=xt(gi,"color","SpecularColor"),Pg=xt(gi,"color","SpecularColorBlended"),Lg=xt(gi,"float","SpecularF90"),HR=xt(gi,"float","Shininess"),$_=xt(gi,"output","Output"),Og=xt(gi,"float","dashSize"),Zw=xt(gi,"float","gapSize"),oTe=xt(gi,"float","pointWidth"),Gw=xt(gi,"float","IOR"),WR=xt(gi,"float","Transmission"),H9=xt(gi,"float","Thickness"),W9=xt(gi,"float","AttenuationDistance"),j9=xt(gi,"color","AttenuationColor"),X9=xt(gi,"float","Dispersion"),iU=xt(gi,"float","AmbientOcclusion",!1,1),jR=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}},Ute=(i,e=1,t=null)=>new jR(i,!1,e,t),nI=(i,e=0,t=null)=>new jR(i,!0,e,t),aTe=nI("frame",0,yn.FRAME),Jt=nI("render",0,yn.RENDER),kte=Ute("object",1,yn.OBJECT),Gg=class extends $w{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=kte}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.',new Jr),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=Lte(e||i);if(t===i&&(i=D9(t)),i&&i.isNode===!0){let n=i.value;i.traverse(r=>{r.isConstNode===!0&&(n=r.value)}),i=n}return new Gg(i,t)},XR=class extends Cr{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)}},zte=(...i)=>{let e;if(i.length===1){let t=i[0];e=new XR(null,t.length,t)}else{let t=i[0],n=i[1];e=new XR(t,n)}return Ht(e)};Ue("toArray",(i,e)=>zte(Array(e).fill(i)));var rU=class extends Cr{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 Kg.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)}},Vte=$n(rU).setParameterLength(2);Ue("assign",Vte);var sU=class extends Cr{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(", ")} )`}},Gte=(i,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?Fg(e):Q4(e[0]),new sU(Ht(i),e));Ue("call",Gte);var lTe={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"},es=class i extends Cr{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(lTe[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===Fo;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}},Is=ct(es,"+").setParameterLength(2,1/0).setName("add"),ai=ct(es,"-").setParameterLength(2,1/0).setName("sub"),Tn=ct(es,"*").setParameterLength(2,1/0).setName("mul"),cc=ct(es,"/").setParameterLength(2,1/0).setName("div"),iI=ct(es,"%").setParameterLength(2).setName("mod"),qte=ct(es,"==").setParameterLength(2).setName("equal"),Hte=ct(es,"!=").setParameterLength(2).setName("notEqual"),Wte=ct(es,"<").setParameterLength(2).setName("lessThan"),$9=ct(es,">").setParameterLength(2).setName("greaterThan"),jte=ct(es,"<=").setParameterLength(2).setName("lessThanEqual"),Xte=ct(es,">=").setParameterLength(2).setName("greaterThanEqual"),$te=ct(es,"&&").setParameterLength(2,1/0).setName("and"),Yte=ct(es,"||").setParameterLength(2,1/0).setName("or"),Zte=ct(es,"!").setParameterLength(1).setName("not"),Kte=ct(es,"^^").setParameterLength(2).setName("xor"),Qte=ct(es,"&").setParameterLength(2).setName("bitAnd"),Jte=ct(es,"~").setParameterLength(1).setName("bitNot"),ene=ct(es,"|").setParameterLength(2).setName("bitOr"),tne=ct(es,"^").setParameterLength(2).setName("bitXor"),nne=ct(es,"<<").setParameterLength(2).setName("shiftLeft"),ine=ct(es,">>").setParameterLength(2).setName("shiftRight"),rne=me(([i])=>(i.addAssign(1),i)),sne=me(([i])=>(i.subAssign(1),i)),one=me(([i])=>{let e=de(i).toConst();return i.addAssign(1),e}),ane=me(([i])=>{let e=de(i).toConst();return i.subAssign(1),e});Ue("add",Is);Ue("sub",ai);Ue("mul",Tn);Ue("div",cc);Ue("mod",iI);Ue("equal",qte);Ue("notEqual",Hte);Ue("lessThan",Wte);Ue("greaterThan",$9);Ue("lessThanEqual",jte);Ue("greaterThanEqual",Xte);Ue("and",$te);Ue("or",Yte);Ue("not",Zte);Ue("xor",Kte);Ue("bitAnd",Qte);Ue("bitNot",Jte);Ue("bitOr",ene);Ue("bitXor",tne);Ue("shiftLeft",nne);Ue("shiftRight",ine);Ue("incrementBefore",rne);Ue("decrementBefore",sne);Ue("increment",one);Ue("decrement",ane);var Ie=class i extends Cr{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=cc(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=_a(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===Fo&&r===i.STEP?f.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":o),l.build(e,o)):u===Fo&&(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===gl&&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 rI=oe(1e-6),cTe=oe(1e6),$R=oe(Math.PI),uTe=oe(Math.PI*2),hTe=oe(Math.PI*2),fTe=oe(Math.PI*.5),lne=ct(Ie,Ie.ALL).setParameterLength(1),cne=ct(Ie,Ie.ANY).setParameterLength(1),une=ct(Ie,Ie.RADIANS).setParameterLength(1),hne=ct(Ie,Ie.DEGREES).setParameterLength(1),Y9=ct(Ie,Ie.EXP).setParameterLength(1),ex=ct(Ie,Ie.EXP2).setParameterLength(1),sI=ct(Ie,Ie.LOG).setParameterLength(1),mf=ct(Ie,Ie.LOG2).setParameterLength(1),Qa=ct(Ie,Ie.SQRT).setParameterLength(1),Z9=ct(Ie,Ie.INVERSE_SQRT).setParameterLength(1),Af=ct(Ie,Ie.FLOOR).setParameterLength(1),oI=ct(Ie,Ie.CEIL).setParameterLength(1),_a=ct(Ie,Ie.NORMALIZE).setParameterLength(1),Hu=ct(Ie,Ie.FRACT).setParameterLength(1),Ya=ct(Ie,Ie.SIN).setParameterLength(1),fne=ct(Ie,Ie.SINH).setParameterLength(1),zu=ct(Ie,Ie.COS).setParameterLength(1),dne=ct(Ie,Ie.COSH).setParameterLength(1),pne=ct(Ie,Ie.TAN).setParameterLength(1),mne=ct(Ie,Ie.TANH).setParameterLength(1),Ane=ct(Ie,Ie.ASIN).setParameterLength(1),gne=ct(Ie,Ie.ASINH).setParameterLength(1),K9=ct(Ie,Ie.ACOS).setParameterLength(1),vne=ct(Ie,Ie.ACOSH).setParameterLength(1),Q9=ct(Ie,Ie.ATAN).setParameterLength(1,2),_ne=ct(Ie,Ie.ATANH).setParameterLength(1),fr=ct(Ie,Ie.ABS).setParameterLength(1),J9=ct(Ie,Ie.SIGN).setParameterLength(1),gf=ct(Ie,Ie.LENGTH).setParameterLength(1),ez=ct(Ie,Ie.NEGATE).setParameterLength(1),xne=ct(Ie,Ie.ONE_MINUS).setParameterLength(1),tz=ct(Ie,Ie.DFDX).setParameterLength(1),nz=ct(Ie,Ie.DFDY).setParameterLength(1),yne=ct(Ie,Ie.ROUND).setParameterLength(1),bne=ct(Ie,Ie.RECIPROCAL).setParameterLength(1),iz=ct(Ie,Ie.TRUNC).setParameterLength(1),rz=ct(Ie,Ie.FWIDTH).setParameterLength(1),wne=ct(Ie,Ie.TRANSPOSE).setParameterLength(1),Sne=ct(Ie,Ie.DETERMINANT).setParameterLength(1),Tne=ct(Ie,Ie.INVERSE).setParameterLength(1),Ml=ct(Ie,Ie.MIN).setParameterLength(2,1/0),kr=ct(Ie,Ie.MAX).setParameterLength(2,1/0),qg=ct(Ie,Ie.STEP).setParameterLength(2),Ene=ct(Ie,Ie.REFLECT).setParameterLength(2),Mne=ct(Ie,Ie.DISTANCE).setParameterLength(2),Cne=ct(Ie,Ie.DIFFERENCE).setParameterLength(2),Qc=ct(Ie,Ie.DOT).setParameterLength(2),jd=ct(Ie,Ie.CROSS).setParameterLength(2),$c=ct(Ie,Ie.POW).setParameterLength(2),sz=i=>Tn(i,i),Rne=i=>Tn(i,i,i),oz=i=>Tn(i,i,i,i),Ine=ct(Ie,Ie.TRANSFORM_DIRECTION).setParameterLength(2),Pne=(i,e)=>_a(Tn(e,Ft(pe(i),0)).xyz),Lne=(i,e)=>_a(Ft(pe(i),0).mul(e).xyz),Dne=i=>Tn(J9(i),$c(fr(i),1/3)),az=i=>Qc(i,i),Kn=ct(Ie,Ie.MIX).setParameterLength(3),Wu=(i,e=0,t=1)=>new Ie(Ie.CLAMP,Ht(i),Ht(e),Ht(t)),aI=i=>Wu(i),lz=ct(Ie,Ie.REFRACT).setParameterLength(3),uc=ct(Ie,Ie.SMOOTHSTEP).setParameterLength(3),cz=ct(Ie,Ie.FACEFORWARD).setParameterLength(3),Nne=me(([i])=>{let n=43758.5453,r=Qc(i.xy,dt(12.9898,78.233)),s=iI(r,$R);return Hu(Ya(s).mul(n))}),Fne=(i,e,t)=>Kn(e,t,i),Bne=(i,e,t)=>uc(e,t,i),One=(i,e)=>qg(e,i),dTe=cz,pTe=Z9;Ue("all",lne);Ue("any",cne);Ue("radians",une);Ue("degrees",hne);Ue("exp",Y9);Ue("exp2",ex);Ue("log",sI);Ue("log2",mf);Ue("sqrt",Qa);Ue("inverseSqrt",Z9);Ue("floor",Af);Ue("ceil",oI);Ue("normalize",_a);Ue("fract",Hu);Ue("sin",Ya);Ue("sinh",fne);Ue("cos",zu);Ue("cosh",dne);Ue("tan",pne);Ue("tanh",mne);Ue("asin",Ane);Ue("asinh",gne);Ue("acos",K9);Ue("acosh",vne);Ue("atan",Q9);Ue("atanh",_ne);Ue("abs",fr);Ue("sign",J9);Ue("length",gf);Ue("lengthSq",az);Ue("negate",ez);Ue("oneMinus",xne);Ue("dFdx",tz);Ue("dFdy",nz);Ue("round",yne);Ue("reciprocal",bne);Ue("trunc",iz);Ue("fwidth",rz);Ue("min",Ml);Ue("max",kr);Ue("step",One);Ue("reflect",Ene);Ue("distance",Mne);Ue("dot",Qc);Ue("cross",jd);Ue("pow",$c);Ue("pow2",sz);Ue("pow3",Rne);Ue("pow4",oz);Ue("transformDirection",Ine);Ue("transformNormalByViewMatrix",Pne);Ue("transformNormalByInverseViewMatrix",Lne);Ue("mix",Fne);Ue("clamp",Wu);Ue("refract",lz);Ue("smoothstep",Bne);Ue("faceForward",cz);Ue("difference",Cne);Ue("saturate",aI);Ue("cbrt",Dne);Ue("transpose",wne);Ue("determinant",Sne);Ue("inverse",Tne);Ue("rand",Nne);var oU=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?$d(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 L9(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 cx=i=>L9(i),AS=i=>L9(i),zw=(...i)=>L9(i),USe=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),ree=new WeakMap;function Ete(i){return USe.get(i)}function OR(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 Mte(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 Jr)}function kSe(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 Jr)}function zSe(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 Jr)}function am(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 D9(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 Kv(...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"?GSe(e[0]):null}function Cte(i){let e=ree.get(i);return e===void 0&&(e={},ree.set(i,e)),e}function VSe(i){let e="",t=new Uint8Array(i);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function GSe(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0)).buffer}var G_={VERTEX:"vertex",FRAGMENT:"fragment"},yn={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},qSe={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},jo={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},Rte=["fragment","vertex"],PR=["setup","analyze","generate"],LR=[...Rte,"compute"],Kg=["x","y","z","w"],HSe={analyze:"setup",generate:"analyze"},WSe=0,Kt=class i extends aa{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=WSe++,this.stackTrace=null,i.captureStackTrace===!0&&(this.stackTrace=new Jr)}set needsUpdate(e){e===!0&&this.version++}get uuid(){return this._uuid===null&&(this._uuid=Du.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(cx(r.slice(0,-4)),s.getCacheKey(e,t));this._cacheKey=zw(AS(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=HSe[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 Wd=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} ]`}},UR=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)}},Cr=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)}},XO=class extends Cr{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)}},jSe=Kg.join(""),kR=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(Kg.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===jSe.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}},$O=class extends Cr{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=Kg[d];A===n[0]?(f.push(l),d+=n.length-1):f.push(c+"."+A)}return`${e.getType(s)}( ${f.join(", ")} )`}},YO=class extends Cr{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=Kg[f];d===t[u]?(c.push("1.0 - "+(a+"."+d)),u++):c.push(a+"."+d)}return`${e.getType(r)}( ${c.join(", ")} )`}},Yw=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?am(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=am(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=VSe(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?D9(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.")}},see=/float|u?int/,Kc=class extends Yw{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 see.test(n)&&see.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}},ZO=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}},hm=null,KO=new Map;function Ue(i,e){if(KO.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`);KO.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 XSe=i=>i.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),oee=i=>XSe(i).split("").sort().join("");Kt.prototype.assign=function(...i){if(this.isStackNode!==!0)return hm!==null?hm.assign(this,...i):ze("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new Jr),this;{let e=KO.get("assign");return this.addToStack(e(...i))}};Kt.prototype.toVarIntent=function(){return this};Kt.prototype.get=function(i){return new ZO(this,i)};var Vw={};function $C(i,e,t){Vw[i]=Vw[e]=Vw[t]={get(){this._cache=this._cache||{};let o=this._cache[i];return o===void 0&&(o=new kR(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=oee(i);return new $O(this,a,Ht(o))},Kt.prototype["flip"+n]=Kt.prototype["flip"+r]=Kt.prototype["flip"+s]=function(){let o=oee(i);return new YO(this,o)}}var rf=["x","y","z","w"],sf=["r","g","b","a"],of=["s","t","p","q"];for(let i=0;i<4;i++){let e=rf[i],t=sf[i],n=of[i];$C(e,t,n);for(let r=0;r<4;r++){e=rf[i]+rf[r],t=sf[i]+sf[r],n=of[i]+of[r],$C(e,t,n);for(let s=0;s<4;s++){e=rf[i]+rf[r]+rf[s],t=sf[i]+sf[r]+sf[s],n=of[i]+of[r]+of[s],$C(e,t,n);for(let o=0;o<4;o++)e=rf[i]+rf[r]+rf[s]+rf[o],t=sf[i]+sf[r]+sf[s]+sf[o],n=of[i]+of[r]+of[s]+of[o],$C(e,t,n)}}}for(let i=0;i<32;i++)Vw[i]={get(){this._cache=this._cache||{};let e=this._cache[i];return e===void 0&&(e=new Wd(this,new Kc(i,"uint")),this._cache[i]=e),e},set(e){this[i].assign(Ht(e))}};Object.defineProperties(Kt.prototype,Vw);var $Se=function(i,e=null){let t=am(i);return t==="node"?i:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?Ht(eU(i,e)):t==="shader"?i.isFn?i:me(i):i},YSe=function(i,e=null){for(let t in i)i[t]=Ht(i[t],e);return i},ZSe=function(i,e=null){let t=i.length;for(let n=0;n<t;n++)i[n]=Ht(i[n],e);return i},Ite=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 Jr),u.concat(new Array(a-u.length).fill(0))):l!==void 0&&u.length>l?(ze(`TSL: "${f}" parameter length exceeds limit.`,new Jr),u.slice(0,l)):u}return e===null?s=(...u)=>r(new i(...Fg(c(u)))):t!==null?(t=Ht(t),s=(...u)=>r(new i(e,...Fg(c(u)),t))):s=(...u)=>r(new i(e,...Fg(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},KSe=function(i,...e){return new i(...Fg(e))},QO=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(Pte(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?QSe(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?JSe(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 Pte(i){return i[0]&&(i[0].isNode||Object.getPrototypeOf(i[0])!==Object.prototype)}function QSe(i){let e;return Q4(i),Pte(i)?e=[...i]:e=i[0],e}function JSe(i){let e=0;return Q4(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 JO=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 QO(this,e)}setup(){return this.call()}},eTe=[!1,!0],tTe=[0,1,2,3],nTe=[-1,-2],Lte=[.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],N9=new Map;for(let i of eTe)N9.set(i,new Kc(i));var F9=new Map;for(let i of tTe)F9.set(i,new Kc(i,"uint"));var B9=new Map([...F9].map(i=>new Kc(i.value,"int")));for(let i of nTe)B9.set(i,new Kc(i,"int"));var Z4=new Map([...B9].map(i=>new Kc(i.value)));for(let i of Lte)Z4.set(i,new Kc(i));for(let i of Lte)Z4.set(-i,new Kc(-i));var K4={bool:N9,uint:F9,ints:B9,float:Z4},aee=new Map([...N9,...Z4]),eU=(i,e)=>aee.has(i)?aee.get(i):i.isNode===!0?i:new Kc(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 Jr),new Kc(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=[D9(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return Uw(e.get(t[0]));if(t.length===1){let r=eU(t[0],i);return r.nodeType===i?Uw(r):Uw(new UR(r,i))}let n=t.map(r=>eU(r));return Uw(new XO(n,i))}};function J_(i){return i&&i.isNode&&i.traverse(e=>{e.isConstNode&&(i=e.value)}),!!i}var Dte=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function W_(i,e){return new JO(i,e)}var Ht=(i,e=null)=>$Se(i,e),Uw=(i,e=null)=>Ht(i,e).toVarIntent(),Q4=(i,e=null)=>new YSe(i,e),Fg=(i,e=null)=>new ZSe(i,e),$n=(i,e=null,t=null,n=null)=>new Ite(i,e,t,n),xt=(i,...e)=>new KSe(i,...e),ct=(i,e=null,t=null,n={})=>new Ite(i,e,t,{...n,intent:!0}),O9=(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)}}),iTe=0,tU=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 Jr),t=null)),this.shaderNode=new W_(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"+iTe++,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 tU(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 Zw=i=>{hm=i},U9=()=>hm,$t=(...i)=>hm.If(...i),rTe=(...i)=>hm.Switch(...i);function J4(i){return hm&&hm.addToStack(i),i}Ue("toStack",J4);var Nte=new Ys("color"),oe=new Ys("float",K4.float),de=new Ys("int",K4.ints),rt=new Ys("uint",K4.uint),lc=new Ys("bool",K4.bool),dt=new Ys("vec2"),Ur=new Ys("ivec2"),k9=new Ys("uvec2"),Fte=new Ys("bvec2"),pe=new Ys("vec3"),z9=new Ys("ivec3"),Qg=new Ys("uvec3"),V9=new Ys("bvec3"),Ft=new Ys("vec4"),G9=new Ys("ivec4"),q9=new Ys("uvec4"),Bte=new Ys("bvec4"),eI=new Ys("mat2"),So=new Ys("mat3"),cm=new Ys("mat4");Ue("toColor",Nte);Ue("toFloat",oe);Ue("toInt",de);Ue("toUint",rt);Ue("toBool",lc);Ue("toVec2",dt);Ue("toIVec2",Ur);Ue("toUVec2",k9);Ue("toBVec2",Fte);Ue("toVec3",pe);Ue("toIVec3",z9);Ue("toUVec3",Qg);Ue("toBVec3",V9);Ue("toVec4",Ft);Ue("toIVec4",G9);Ue("toUVec4",q9);Ue("toBVec4",Bte);Ue("toMat2",eI);Ue("toMat3",So);Ue("toMat4",cm);var Ote=$n(Wd).setParameterLength(2),Ute=(i,e)=>new UR(Ht(i),e),sTe=(i,e)=>new kR(Ht(i),e);Ue("element",Ote);Ue("convert",Ute);var oTe=i=>(Xe("TSL: append() has been renamed to Stack().",new Jr),J4(i));Ue("append",i=>(Xe("TSL: .append() has been renamed to .toStack().",new Jr),J4(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 cx(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)}},$d=(i,e,t=null)=>new gi(i,e,!1,t),Jg=(i,e,t=null)=>new gi(i,e,!0,t),Bi=xt(gi,"vec4","DiffuseColor"),Rg=xt(gi,"vec3","DiffuseContribution"),nU=xt(gi,"vec3","EmissiveColor"),df=xt(gi,"float","Roughness"),Hd=xt(gi,"float","Metalness"),zR=xt(gi,"float","Clearcoat"),X_=xt(gi,"float","ClearcoatRoughness"),rc=xt(gi,"vec3","Sheen"),nm=xt(gi,"float","SheenRoughness"),tI=xt(gi,"float","Iridescence"),VR=xt(gi,"float","IridescenceIOR"),GR=xt(gi,"float","IridescenceThickness"),qR=xt(gi,"float","AlphaT"),tm=xt(gi,"float","Anisotropy"),Gw=xt(gi,"vec3","AnisotropyT"),Bg=xt(gi,"vec3","AnisotropyB"),fm=xt(gi,"color","SpecularColor"),Pg=xt(gi,"color","SpecularColorBlended"),Lg=xt(gi,"float","SpecularF90"),HR=xt(gi,"float","Shininess"),$_=xt(gi,"output","Output"),Og=xt(gi,"float","dashSize"),Kw=xt(gi,"float","gapSize"),aTe=xt(gi,"float","pointWidth"),qw=xt(gi,"float","IOR"),WR=xt(gi,"float","Transmission"),H9=xt(gi,"float","Thickness"),W9=xt(gi,"float","AttenuationDistance"),j9=xt(gi,"color","AttenuationColor"),X9=xt(gi,"float","Dispersion"),iU=xt(gi,"float","AmbientOcclusion",!1,1),jR=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}},kte=(i,e=1,t=null)=>new jR(i,!1,e,t),nI=(i,e=0,t=null)=>new jR(i,!0,e,t),lTe=nI("frame",0,yn.FRAME),Jt=nI("render",0,yn.RENDER),zte=kte("object",1,yn.OBJECT),Gg=class extends Yw{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=zte}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.',new Jr),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=Dte(e||i);if(t===i&&(i=D9(t)),i&&i.isNode===!0){let n=i.value;i.traverse(r=>{r.isConstNode===!0&&(n=r.value)}),i=n}return new Gg(i,t)},XR=class extends Cr{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)}},Vte=(...i)=>{let e;if(i.length===1){let t=i[0];e=new XR(null,t.length,t)}else{let t=i[0],n=i[1];e=new XR(t,n)}return Ht(e)};Ue("toArray",(i,e)=>Vte(Array(e).fill(i)));var rU=class extends Cr{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 Kg.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)}},Gte=$n(rU).setParameterLength(2);Ue("assign",Gte);var sU=class extends Cr{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(", ")} )`}},qte=(i,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?Fg(e):Q4(e[0]),new sU(Ht(i),e));Ue("call",qte);var cTe={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"},es=class i extends Cr{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(cTe[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===Bo;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}},Is=ct(es,"+").setParameterLength(2,1/0).setName("add"),ai=ct(es,"-").setParameterLength(2,1/0).setName("sub"),Tn=ct(es,"*").setParameterLength(2,1/0).setName("mul"),cc=ct(es,"/").setParameterLength(2,1/0).setName("div"),iI=ct(es,"%").setParameterLength(2).setName("mod"),Hte=ct(es,"==").setParameterLength(2).setName("equal"),Wte=ct(es,"!=").setParameterLength(2).setName("notEqual"),jte=ct(es,"<").setParameterLength(2).setName("lessThan"),$9=ct(es,">").setParameterLength(2).setName("greaterThan"),Xte=ct(es,"<=").setParameterLength(2).setName("lessThanEqual"),$te=ct(es,">=").setParameterLength(2).setName("greaterThanEqual"),Yte=ct(es,"&&").setParameterLength(2,1/0).setName("and"),Zte=ct(es,"||").setParameterLength(2,1/0).setName("or"),Kte=ct(es,"!").setParameterLength(1).setName("not"),Qte=ct(es,"^^").setParameterLength(2).setName("xor"),Jte=ct(es,"&").setParameterLength(2).setName("bitAnd"),ene=ct(es,"~").setParameterLength(1).setName("bitNot"),tne=ct(es,"|").setParameterLength(2).setName("bitOr"),nne=ct(es,"^").setParameterLength(2).setName("bitXor"),ine=ct(es,"<<").setParameterLength(2).setName("shiftLeft"),rne=ct(es,">>").setParameterLength(2).setName("shiftRight"),sne=me(([i])=>(i.addAssign(1),i)),one=me(([i])=>(i.subAssign(1),i)),ane=me(([i])=>{let e=de(i).toConst();return i.addAssign(1),e}),lne=me(([i])=>{let e=de(i).toConst();return i.subAssign(1),e});Ue("add",Is);Ue("sub",ai);Ue("mul",Tn);Ue("div",cc);Ue("mod",iI);Ue("equal",Hte);Ue("notEqual",Wte);Ue("lessThan",jte);Ue("greaterThan",$9);Ue("lessThanEqual",Xte);Ue("greaterThanEqual",$te);Ue("and",Yte);Ue("or",Zte);Ue("not",Kte);Ue("xor",Qte);Ue("bitAnd",Jte);Ue("bitNot",ene);Ue("bitOr",tne);Ue("bitXor",nne);Ue("shiftLeft",ine);Ue("shiftRight",rne);Ue("incrementBefore",sne);Ue("decrementBefore",one);Ue("increment",ane);Ue("decrement",lne);var Ie=class i extends Cr{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=cc(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=_a(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===Bo&&r===i.STEP?f.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":o),l.build(e,o)):u===Bo&&(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===gl&&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 rI=oe(1e-6),uTe=oe(1e6),$R=oe(Math.PI),hTe=oe(Math.PI*2),fTe=oe(Math.PI*2),dTe=oe(Math.PI*.5),cne=ct(Ie,Ie.ALL).setParameterLength(1),une=ct(Ie,Ie.ANY).setParameterLength(1),hne=ct(Ie,Ie.RADIANS).setParameterLength(1),fne=ct(Ie,Ie.DEGREES).setParameterLength(1),Y9=ct(Ie,Ie.EXP).setParameterLength(1),ex=ct(Ie,Ie.EXP2).setParameterLength(1),sI=ct(Ie,Ie.LOG).setParameterLength(1),mf=ct(Ie,Ie.LOG2).setParameterLength(1),Qa=ct(Ie,Ie.SQRT).setParameterLength(1),Z9=ct(Ie,Ie.INVERSE_SQRT).setParameterLength(1),Af=ct(Ie,Ie.FLOOR).setParameterLength(1),oI=ct(Ie,Ie.CEIL).setParameterLength(1),_a=ct(Ie,Ie.NORMALIZE).setParameterLength(1),Wu=ct(Ie,Ie.FRACT).setParameterLength(1),Ya=ct(Ie,Ie.SIN).setParameterLength(1),dne=ct(Ie,Ie.SINH).setParameterLength(1),Vu=ct(Ie,Ie.COS).setParameterLength(1),pne=ct(Ie,Ie.COSH).setParameterLength(1),mne=ct(Ie,Ie.TAN).setParameterLength(1),Ane=ct(Ie,Ie.TANH).setParameterLength(1),gne=ct(Ie,Ie.ASIN).setParameterLength(1),vne=ct(Ie,Ie.ASINH).setParameterLength(1),K9=ct(Ie,Ie.ACOS).setParameterLength(1),_ne=ct(Ie,Ie.ACOSH).setParameterLength(1),Q9=ct(Ie,Ie.ATAN).setParameterLength(1,2),xne=ct(Ie,Ie.ATANH).setParameterLength(1),fr=ct(Ie,Ie.ABS).setParameterLength(1),J9=ct(Ie,Ie.SIGN).setParameterLength(1),gf=ct(Ie,Ie.LENGTH).setParameterLength(1),ez=ct(Ie,Ie.NEGATE).setParameterLength(1),yne=ct(Ie,Ie.ONE_MINUS).setParameterLength(1),tz=ct(Ie,Ie.DFDX).setParameterLength(1),nz=ct(Ie,Ie.DFDY).setParameterLength(1),bne=ct(Ie,Ie.ROUND).setParameterLength(1),wne=ct(Ie,Ie.RECIPROCAL).setParameterLength(1),iz=ct(Ie,Ie.TRUNC).setParameterLength(1),rz=ct(Ie,Ie.FWIDTH).setParameterLength(1),Sne=ct(Ie,Ie.TRANSPOSE).setParameterLength(1),Tne=ct(Ie,Ie.DETERMINANT).setParameterLength(1),Ene=ct(Ie,Ie.INVERSE).setParameterLength(1),Ml=ct(Ie,Ie.MIN).setParameterLength(2,1/0),kr=ct(Ie,Ie.MAX).setParameterLength(2,1/0),qg=ct(Ie,Ie.STEP).setParameterLength(2),Mne=ct(Ie,Ie.REFLECT).setParameterLength(2),Cne=ct(Ie,Ie.DISTANCE).setParameterLength(2),Rne=ct(Ie,Ie.DIFFERENCE).setParameterLength(2),Qc=ct(Ie,Ie.DOT).setParameterLength(2),jd=ct(Ie,Ie.CROSS).setParameterLength(2),$c=ct(Ie,Ie.POW).setParameterLength(2),sz=i=>Tn(i,i),Ine=i=>Tn(i,i,i),oz=i=>Tn(i,i,i,i),Pne=ct(Ie,Ie.TRANSFORM_DIRECTION).setParameterLength(2),Lne=(i,e)=>_a(Tn(e,Ft(pe(i),0)).xyz),Dne=(i,e)=>_a(Ft(pe(i),0).mul(e).xyz),Nne=i=>Tn(J9(i),$c(fr(i),1/3)),az=i=>Qc(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)),aI=i=>ju(i),lz=ct(Ie,Ie.REFRACT).setParameterLength(3),uc=ct(Ie,Ie.SMOOTHSTEP).setParameterLength(3),cz=ct(Ie,Ie.FACEFORWARD).setParameterLength(3),Fne=me(([i])=>{let n=43758.5453,r=Qc(i.xy,dt(12.9898,78.233)),s=iI(r,$R);return Wu(Ya(s).mul(n))}),Bne=(i,e,t)=>Qn(e,t,i),One=(i,e,t)=>uc(e,t,i),Une=(i,e)=>qg(e,i),pTe=cz,mTe=Z9;Ue("all",cne);Ue("any",une);Ue("radians",hne);Ue("degrees",fne);Ue("exp",Y9);Ue("exp2",ex);Ue("log",sI);Ue("log2",mf);Ue("sqrt",Qa);Ue("inverseSqrt",Z9);Ue("floor",Af);Ue("ceil",oI);Ue("normalize",_a);Ue("fract",Wu);Ue("sin",Ya);Ue("sinh",dne);Ue("cos",Vu);Ue("cosh",pne);Ue("tan",mne);Ue("tanh",Ane);Ue("asin",gne);Ue("asinh",vne);Ue("acos",K9);Ue("acosh",_ne);Ue("atan",Q9);Ue("atanh",xne);Ue("abs",fr);Ue("sign",J9);Ue("length",gf);Ue("lengthSq",az);Ue("negate",ez);Ue("oneMinus",yne);Ue("dFdx",tz);Ue("dFdy",nz);Ue("round",bne);Ue("reciprocal",wne);Ue("trunc",iz);Ue("fwidth",rz);Ue("min",Ml);Ue("max",kr);Ue("step",Une);Ue("reflect",Mne);Ue("distance",Cne);Ue("dot",Qc);Ue("cross",jd);Ue("pow",$c);Ue("pow2",sz);Ue("pow3",Ine);Ue("pow4",oz);Ue("transformDirection",Pne);Ue("transformNormalByViewMatrix",Lne);Ue("transformNormalByInverseViewMatrix",Dne);Ue("mix",Bne);Ue("clamp",ju);Ue("refract",lz);Ue("smoothstep",One);Ue("faceForward",cz);Ue("difference",Rne);Ue("saturate",aI);Ue("cbrt",Nne);Ue("transpose",Sne);Ue("determinant",Tne);Ue("inverse",Ene);Ue("rand",Fne);var oU=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?$d(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)}},va=$n(oU).setParameterLength(2,3);Ue("select",va);var Kw=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}},Yd=(i=null,e={})=>{let t=i;return(t===null||t.isNode!==!0)&&(e=t||e,t=null),new Kw(t,e)},Une=i=>Yd(i,{uniformFlow:!0}),uz=(i,e)=>Yd(i,{nodeName:e});function kne(i,e,t=null){return Yd(t,{getShadow:({light:n,shadowColorNode:r})=>e===n?r.mul(i):r})}function zne(i,e=null){return Yd(e,{getAO:(t,{material:n})=>n.transparent===!0?t:t!==null?t.mul(i):i})}function Vne(i,e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.'),uz(i,e)}Ue("context",Yd);Ue("label",Vne);Ue("uniformFlow",Une);Ue("setName",uz);Ue("builtinShadowContext",(i,e,t)=>kne(e,t,i));Ue("builtinAOContext",(i,e)=>zne(e,i));var Y_=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}},hz=$n(Y_),Gne=(i,e=null)=>hz(i,e).toStack(),qne=(i,e=null)=>hz(i,e,!0).toStack(),Hne=i=>hz(i).setIntent(!0).toStack();Ue("toVar",Gne);Ue("toConst",qne);Ue("toVarIntent",Hne);var aU=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}},Ug=(i,e,t=null)=>new aU(Ht(i),e,t),lU=class extends Kt{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=Ug(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=Ug(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(G_.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(G_.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,G_.VERTEX);if(e.shaderStage===G_.VERTEX){let a=n.node.build(e,s);e.addLineFlowCode(`${o} = ${a}`,this)}else e.flowNodeFromShaderStage(G_.VERTEX,n.node,s,o);n[t]=o}return e.getPropertyName(r)}},Am=$n(lU).setParameterLength(1,2),Wne=i=>Am(i);Ue("toVarying",Am);Ue("toVertexStage",Wne);var jne=me(([i])=>{let e=i.mul(.9478672986).add(.0521327014).pow(2.4),t=i.mul(.0773993808),n=i.lessThanEqual(.04045);return Kn(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Xne=me(([i])=>{let e=i.pow(.41666).mul(1.055).sub(.055),t=i.mul(12.92),n=i.lessThanEqual(.0031308);return Kn(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),fz="WorkingColorSpace",mTe="OutputColorSpace",Qw=class extends Cr{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===fz?ln.workingColorSpace:t===mTe?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(jne(s.rgb),s.a)),ln.getPrimaries(n)!==ln.getPrimaries(r)&&(s=Ft(So(ln._getMatrix(new Mn,n,r)).mul(s.rgb),s.a)),ln.getTransfer(r)===kt&&(s=Ft(Xne(s.rgb),s.a))),s}},$ne=(i,e)=>new Qw(Ht(i),fz,e),lI=(i,e)=>new Qw(Ht(i),e,fz),ATe=(i,e,t)=>new Qw(Ht(i),e,t);Ue("workingToColorSpace",$ne);Ue("colorSpaceToWorking",lI);var gTe=class extends Wd{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)}},YR=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 gTe(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}},vTe=(i,e,t)=>new YR(i,e,t),cU=class extends YR{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}},Yne=(i,e,t=null)=>new cU(i,e,t),uU=class extends Cr{static get type(){return"ToneMappingNode"}constructor(e,t=Kne,n=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return kw(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===oo)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}},Zne=(i,e,t)=>new uU(i,Ht(e),Ht(t)),Kne=Yne("toneMappingExposure","float");Ue("toneMapping",(i,e,t)=>Zne(e,t,i));var aee=new WeakMap;function lee(i,e){let t=aee.get(i);return t===void 0&&(t=new Sd(i,e),aee.set(i,t)),t}var ff=class extends $w{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=Qp,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=lee(r.array,s):a=lee(r,s);let l=new Oo(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=Am(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 cI(i,e=null,t=0,n=0,r=Qp,s=!1){return e==="mat3"||e===null&&i.itemSize===9?So(new ff(i,"vec3",9,0).setUsage(r).setInstanced(s),new ff(i,"vec3",9,3).setUsage(r).setInstanced(s),new ff(i,"vec3",9,6).setUsage(r).setInstanced(s)):e==="mat4"||e===null&&i.itemSize===16?cm(new ff(i,"vec4",16,0).setUsage(r).setInstanced(s),new ff(i,"vec4",16,4).setUsage(r).setInstanced(s),new ff(i,"vec4",16,8).setUsage(r).setInstanced(s),new ff(i,"vec4",16,12).setUsage(r).setInstanced(s)):new ff(i,e,t,n).setUsage(r)}var dz=(i,e=null,t=0,n=0)=>cI(i,e,t,n),_Te=(i,e=null,t=0,n=0)=>cI(i,e,t,n,tg),uI=(i,e=null,t=0,n=0)=>cI(i,e,t,n,Qp,!0),pz=(i,e=null,t=0,n=0)=>cI(i,e,t,n,tg,!0);Ue("toAttribute",i=>dz(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=Am(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 Qne=xt($s,$s.VERTEX),qu=xt($s,$s.INSTANCE),xTe=xt($s,$s.SUBGROUP),yTe=xt($s,$s.INVOCATION_SUBGROUP),bTe=xt($s,$s.INVOCATION_LOCAL),Jne=xt($s,$s.DRAW),hU=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 Jr),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=qu.build(e,"uint");e.flow.code=`${e.tab}if ( ${o} >= ${s} ) { return; }4146+`);return e.format(u,n,t)}},va=$n(oU).setParameterLength(2,3);Ue("select",va);var Qw=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}},Yd=(i=null,e={})=>{let t=i;return(t===null||t.isNode!==!0)&&(e=t||e,t=null),new Qw(t,e)},kne=i=>Yd(i,{uniformFlow:!0}),uz=(i,e)=>Yd(i,{nodeName:e});function zne(i,e,t=null){return Yd(t,{getShadow:({light:n,shadowColorNode:r})=>e===n?r.mul(i):r})}function Vne(i,e=null){return Yd(e,{getAO:(t,{material:n})=>n.transparent===!0?t:t!==null?t.mul(i):i})}function Gne(i,e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.'),uz(i,e)}Ue("context",Yd);Ue("label",Gne);Ue("uniformFlow",kne);Ue("setName",uz);Ue("builtinShadowContext",(i,e,t)=>zne(e,t,i));Ue("builtinAOContext",(i,e)=>Vne(e,i));var Y_=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}},hz=$n(Y_),qne=(i,e=null)=>hz(i,e).toStack(),Hne=(i,e=null)=>hz(i,e,!0).toStack(),Wne=i=>hz(i).setIntent(!0).toStack();Ue("toVar",qne);Ue("toConst",Hne);Ue("toVarIntent",Wne);var aU=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}},Ug=(i,e,t=null)=>new aU(Ht(i),e,t),lU=class extends Kt{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=Ug(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=Ug(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(G_.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(G_.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,G_.VERTEX);if(e.shaderStage===G_.VERTEX){let a=n.node.build(e,s);e.addLineFlowCode(`${o} = ${a}`,this)}else e.flowNodeFromShaderStage(G_.VERTEX,n.node,s,o);n[t]=o}return e.getPropertyName(r)}},Am=$n(lU).setParameterLength(1,2),jne=i=>Am(i);Ue("toVarying",Am);Ue("toVertexStage",jne);var Xne=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"}]}),$ne=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"}]}),fz="WorkingColorSpace",ATe="OutputColorSpace",Jw=class extends Cr{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===fz?ln.workingColorSpace:t===ATe?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(Xne(s.rgb),s.a)),ln.getPrimaries(n)!==ln.getPrimaries(r)&&(s=Ft(So(ln._getMatrix(new Mn,n,r)).mul(s.rgb),s.a)),ln.getTransfer(r)===kt&&(s=Ft($ne(s.rgb),s.a))),s}},Yne=(i,e)=>new Jw(Ht(i),fz,e),lI=(i,e)=>new Jw(Ht(i),e,fz),gTe=(i,e,t)=>new Jw(Ht(i),e,t);Ue("workingToColorSpace",Yne);Ue("colorSpaceToWorking",lI);var vTe=class extends Wd{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)}},YR=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 vTe(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}},_Te=(i,e,t)=>new YR(i,e,t),cU=class extends YR{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}},Zne=(i,e,t=null)=>new cU(i,e,t),uU=class extends Cr{static get type(){return"ToneMappingNode"}constructor(e,t=Qne,n=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return zw(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===oo)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}},Kne=(i,e,t)=>new uU(i,Ht(e),Ht(t)),Qne=Zne("toneMappingExposure","float");Ue("toneMapping",(i,e,t)=>Kne(e,t,i));var lee=new WeakMap;function cee(i,e){let t=lee.get(i);return t===void 0&&(t=new Sd(i,e),lee.set(i,t)),t}var ff=class extends Yw{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=Qp,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=cee(r.array,s):a=cee(r,s);let l=new Uo(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=Am(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 cI(i,e=null,t=0,n=0,r=Qp,s=!1){return e==="mat3"||e===null&&i.itemSize===9?So(new ff(i,"vec3",9,0).setUsage(r).setInstanced(s),new ff(i,"vec3",9,3).setUsage(r).setInstanced(s),new ff(i,"vec3",9,6).setUsage(r).setInstanced(s)):e==="mat4"||e===null&&i.itemSize===16?cm(new ff(i,"vec4",16,0).setUsage(r).setInstanced(s),new ff(i,"vec4",16,4).setUsage(r).setInstanced(s),new ff(i,"vec4",16,8).setUsage(r).setInstanced(s),new ff(i,"vec4",16,12).setUsage(r).setInstanced(s)):new ff(i,e,t,n).setUsage(r)}var dz=(i,e=null,t=0,n=0)=>cI(i,e,t,n),xTe=(i,e=null,t=0,n=0)=>cI(i,e,t,n,tg),uI=(i,e=null,t=0,n=0)=>cI(i,e,t,n,Qp,!0),pz=(i,e=null,t=0,n=0)=>cI(i,e,t,n,tg,!0);Ue("toAttribute",i=>dz(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=Am(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 Jne=xt($s,$s.VERTEX),Hu=xt($s,$s.INSTANCE),yTe=xt($s,$s.SUBGROUP),bTe=xt($s,$s.INVOCATION_SUBGROUP),wTe=xt($s,$s.INVOCATION_LOCAL),eie=xt($s,$s.DRAW),hU=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 Jr),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=Hu.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)}}},mz=(i,e=[64])=>{(e.length===0||e.length>3)&&ze("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new Jr);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 Jr)}for(;e.length<3;)e.push(1);return new hU(Ht(i),e)},eie=(i,e,t)=>{let n=mz(i,t);return typeof e=="number"?n.count=e:n.dispatchSize=e,n};Ue("compute",eie);Ue("computeKernel",mz);var fU=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}},Z_=i=>new fU(Ht(i));function tie(i,e=!0){return Xe('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),Z_(i).setParent(e)}Ue("cache",tie);Ue("isolate",Z_);var dU=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)}},nie=$n(dU).setParameterLength(2);Ue("bypass",nie);var Az=me(([i,e,t,n=oe(0),r=oe(1),s=lc(!1)])=>{let o=i.sub(e).div(t.sub(e));return J_(s)&&(o=o.clamp()),o.mul(r.sub(n)).add(n)});function iie(i,e,t,n=oe(0),r=oe(1)){return Az(i,e,t,n,r,!0)}Ue("remap",Az);Ue("remapClamp",iie);var K_=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)}},oc=$n(K_).setParameterLength(1,2),rie=i=>(i?va(i,oc("discard")):oc("discard")).toStack(),wTe=()=>oc("return").toStack();Ue("discard",rie);var gz=me(([i])=>Ft(i.rgb.mul(i.a),i.a),{color:"vec4",return:"vec4"}),sie=me(([i])=>i.a.equal(0).select(Ft(0),Ft(i.rgb.div(i.a),i.a)),{color:"vec4",return:"vec4"}),pU=class extends Cr{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=sie(t);let n=(this._toneMapping!==null?this._toneMapping:e.toneMapping)||oo,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||ca;return n!==oo&&(t=t.toneMapping(n)),r!==ca&&r!==ln.workingColorSpace&&(t=t.workingToColorSpace(r)),t=gz(t),t}},vz=(i,e=null,t=null)=>new pU(Ht(i),e,t);Ue("renderOutput",vz);var mU=class extends Cr{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)}}},mz=(i,e=[64])=>{(e.length===0||e.length>3)&&ze("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new Jr);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 Jr)}for(;e.length<3;)e.push(1);return new hU(Ht(i),e)},tie=(i,e,t)=>{let n=mz(i,t);return typeof e=="number"?n.count=e:n.dispatchSize=e,n};Ue("compute",tie);Ue("computeKernel",mz);var fU=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}},Z_=i=>new fU(Ht(i));function nie(i,e=!0){return Xe('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),Z_(i).setParent(e)}Ue("cache",nie);Ue("isolate",Z_);var dU=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)}},iie=$n(dU).setParameterLength(2);Ue("bypass",iie);var Az=me(([i,e,t,n=oe(0),r=oe(1),s=lc(!1)])=>{let o=i.sub(e).div(t.sub(e));return J_(s)&&(o=o.clamp()),o.mul(r.sub(n)).add(n)});function rie(i,e,t,n=oe(0),r=oe(1)){return Az(i,e,t,n,r,!0)}Ue("remap",Az);Ue("remapClamp",rie);var K_=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)}},oc=$n(K_).setParameterLength(1,2),sie=i=>(i?va(i,oc("discard")):oc("discard")).toStack(),STe=()=>oc("return").toStack();Ue("discard",sie);var gz=me(([i])=>Ft(i.rgb.mul(i.a),i.a),{color:"vec4",return:"vec4"}),oie=me(([i])=>i.a.equal(0).select(Ft(0),Ft(i.rgb.div(i.a),i.a)),{color:"vec4",return:"vec4"}),pU=class extends Cr{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=oie(t);let n=(this._toneMapping!==null?this._toneMapping:e.toneMapping)||oo,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||ca;return n!==oo&&(t=t.toneMapping(n)),r!==ca&&r!==ln.workingColorSpace&&(t=t.workingToColorSpace(r)),t=gz(t),t}},vz=(i,e=null,t=null)=>new pU(Ht(i),e,t);Ue("renderOutput",vz);var mU=class extends Cr{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-`,RA(o)}return n}},oie=(i,e=null)=>new mU(Ht(i),e).toStack();Ue("debug",oie);var ZR=class extends aa{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(){}},AU=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!==ZR&&ni('TSL: ".toInspector()" is only available with WebGPU.'),t}};function aie(i,e="",t=null){return i=Ht(i),i.before(new AU(i,e,t))}Ue("toInspector",aie);function STe(i){Xe("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",i)}var KR=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):Am(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}},ac=(i,e=null)=>new KR(i,e),Ui=(i=0)=>ac("uv"+(i>0?i:""),"vec2"),gU=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)}},Hg=$n(gU).setParameterLength(1,2),vU=class extends Gg{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))}}},_z=$n(vU).setParameterLength(1),QR=class extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}},xz=new qs,Jc=class extends Gg{static get type(){return"TextureNode"}constructor(e=xz,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===Yr?"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(Hg(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 QR("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(Pd.TEXTURE_COMPARE))o=this.compareNode;else{let l=n.compareFunction;l===null||l===Jv||l===jh||l===eg||l===Pu?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;$===eg||$===Pu?H=qg(oc(H,a),oc(C,"float")).build(e,a):H=qg(oc(C,"float"),oc(H,a)).build(e,a)}e.addLineFlowCode(`${l} = ${H}`,this),o.snippet=H,o.propertyName=l}let c=l;return e.needsToWorkingColorSpace(n)&&(c=lI(oc(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(_z(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 Hg(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}},TTe=$n(Jc).setParameterLength(1,4).setName("texture"),fi=(i=xz,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=TTe(i,e,t,n),r},ETe=(i=xz)=>fi(i),vs=(...i)=>fi(...i).setSampler(!1),MTe=(i,e,t)=>fi(i,e).level(t),CTe=i=>(i.isNode===!0?i:fi(i)).convert("sampler"),RTe=i=>(i.isNode===!0?i:fi(i)).convert("samplerComparison"),Jw=class extends Gg{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"}},ux=(i,e,t)=>new Jw(i,e,t),_U=class extends Wd{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)}},xU=class extends Jw{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?am(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 _U(this,Ht(e))}},Ho=(i,e)=>new xU(i,e),yU=class extends Kt{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}},Zd=$n(yU).setParameterLength(1),_w,xw,jo=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?xw.copy(t.viewport):(e.getViewport(xw),xw.multiplyScalar(e.getPixelRatio())):this.scope===i.DPR?this._output.value=e.getPixelRatio():t!==null?(_w.width=t.width,_w.height=t.height):e.getDrawingBufferSize(_w)}setup(){let e=this.scope,t=null;return e===i.SIZE?t=Xt(_w||(_w=new Oe)):e===i.VIEWPORT?t=Xt(xw||(xw=new xn)):e===i.DPR?t=Xt(1):t=dt(e1.div(Wg)),this._output=t,t}generate(e){if(this.scope===i.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){let n=e.getNodeProperties(Wg).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}};jo.COORDINATE="coordinate";jo.VIEWPORT="viewport";jo.SIZE="size";jo.UV="uv";jo.DPR="dpr";var yz=xt(jo,jo.DPR),Gu=xt(jo,jo.UV),Wg=xt(jo,jo.SIZE),e1=xt(jo,jo.COORDINATE),Q_=xt(jo,jo.VIEWPORT),bz=Q_.zw,lie=e1.sub(Q_.xy),ITe=lie.div(bz),PTe=me(()=>(Xe('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new Jr),Wg),"vec2").once()(),lO=null,YC=null,cO=null,ZC=null,uO=null,KC=null,hO=null,QC=null,fO=null,JC=null,dO=null,eR=null,pO=null,tR=null,gm=Xt(0,"uint").setName("u_cameraIndex").setGroup(nI("cameraIndex")).toVarying("v_cameraIndex"),im=Xt("float").setName("cameraNear").setGroup(Jt).onRenderUpdate(({camera:i})=>i.near),rm=Xt("float").setName("cameraFar").setGroup(Jt).onRenderUpdate(({camera:i})=>i.far),Ka=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrix);YC===null?YC=Ho(t).setGroup(Jt).setName("cameraProjectionMatrices"):YC.array=t,e=YC.element(i.isMultiViewCamera?Zd("gl_ViewID_OVR"):gm)}else lO===null&&(lO=Xt(i.projectionMatrix).setName("cameraProjectionMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.projectionMatrix)),e=lO;return e}).once()(),cie=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrixInverse);ZC===null?ZC=Ho(t).setGroup(Jt).setName("cameraProjectionMatricesInverse"):ZC.array=t,e=ZC.element(i.isMultiViewCamera?Zd("gl_ViewID_OVR"):gm)}else cO===null&&(cO=Xt(i.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(Jt).onRenderUpdate(({camera:t})=>t.projectionMatrixInverse)),e=cO;return e}).once()(),vm=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorldInverse);KC===null?KC=Ho(t).setGroup(Jt).setName("cameraViewMatrices"):KC.array=t,e=KC.element(i.isMultiViewCamera?Zd("gl_ViewID_OVR"):gm)}else uO===null&&(uO=Xt(i.matrixWorldInverse).setName("cameraViewMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.matrixWorldInverse)),e=uO;return e}).once()(),AS=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorld);QC===null?QC=Ho(t).setGroup(Jt).setName("cameraWorldMatrices"):QC.array=t,e=QC.element(i.isMultiViewCamera?Zd("gl_ViewID_OVR"):gm)}else hO===null&&(hO=Xt(i.matrixWorld).setName("cameraWorldMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.matrixWorld)),e=hO;return e}).once()(),LTe=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.normalMatrix);JC===null?JC=Ho(t).setGroup(Jt).setName("cameraNormalMatrices"):JC.array=t,e=JC.element(i.isMultiViewCamera?Zd("gl_ViewID_OVR"):gm)}else fO===null&&(fO=Xt(i.normalMatrix).setName("cameraNormalMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.normalMatrix)),e=fO;return e}).once()(),uie=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);eR===null?eR=Ho(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)}):eR.array=t,e=eR.element(i.isMultiViewCamera?Zd("gl_ViewID_OVR"):gm)}else dO===null&&(dO=Xt(new re).setName("cameraPosition").setGroup(Jt).onRenderUpdate(({camera:t},n)=>n.value.setFromMatrixPosition(t.matrixWorld))),e=dO;return e}).once()(),DTe=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.viewport);tR===null?tR=Ho(t,"vec4").setGroup(Jt).setName("cameraViewports"):tR.array=t,e=tR.element(gm)}else pO===null&&(pO=Ft(0,0,Wg.x,Wg.y).toConst("cameraViewport")),e=pO;return e}).once()(),cee=new vl,Ps=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 Gg(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(),cee.copy(s.boundingSphere).applyMatrix4(t.matrixWorld),n.value=cee.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}};Ps.WORLD_MATRIX="worldMatrix";Ps.POSITION="position";Ps.SCALE="scale";Ps.VIEW_POSITION="viewPosition";Ps.DIRECTION="direction";Ps.RADIUS="radius";var NTe=$n(Ps,Ps.DIRECTION).setParameterLength(1),FTe=$n(Ps,Ps.WORLD_MATRIX).setParameterLength(1),BTe=$n(Ps,Ps.POSITION).setParameterLength(1),OTe=$n(Ps,Ps.SCALE).setParameterLength(1),UTe=$n(Ps,Ps.VIEW_POSITION).setParameterLength(1),kTe=$n(Ps,Ps.RADIUS).setParameterLength(1),Cl=class extends Ps{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}},zTe=xt(Cl,Cl.DIRECTION),Yc=xt(Cl,Cl.WORLD_MATRIX),VTe=xt(Cl,Cl.POSITION),GTe=xt(Cl,Cl.SCALE),qTe=xt(Cl,Cl.VIEW_POSITION),HTe=xt(Cl,Cl.RADIUS),hie=Xt(new Mn).onObjectUpdate(({object:i},e)=>e.value.getNormalMatrix(i.matrixWorld)),WTe=Xt(new cn).onObjectUpdate(({object:i},e)=>e.value.copy(i.matrixWorld).invert()),yf=me(i=>i.context.modelViewMatrix||fie).once()().toVar("modelViewMatrix"),fie=vm.mul(Yc),bU=me(i=>(i.context.isHighPrecisionModelViewMatrix=!0,Xt("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),wU=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"),die=me(i=>i.shaderStage!=="fragment"?(ni("TSL: `clipSpace` is only available in fragment stage."),Ft()):i.context.clipSpace.toVarying("v_clipSpace")).once()(),Aa=ac("position","vec3"),Er=Aa.toVarying("positionLocal"),jg=Aa.toVarying("positionPrevious"),vf=me(i=>Yc.mul(Er).xyz.toVarying(i.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),wz=me(()=>Er.transformDirection(Yc).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),_s=me(i=>{if(i.shaderStage==="fragment"&&i.material.vertexNode){let e=cie.mul(die);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=_s.negate().toVarying("v_positionViewDirection").normalize(),e.toVar("positionViewDirection")},"vec3").once(["POSITION"])(),SU=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()}},pie=xt(SU),Sz=oe(pie).mul(2).sub(1),t1=me(([i],{material:e})=>{let t=e.side;return t===mi?i=i.mul(-1):t===gr&&(i=i.mul(Sz)),i}),jTe=i=>(ni('TSL: "directionToFaceDirection()" has been renamed to "negateOnBackSide()".'),t1(i)),hI=ac("normal","vec3"),ya=me(i=>i.geometry.hasAttribute("normal")===!1?(Xe('TSL: Vertex attribute "normal" not found on geometry.'),pe(0,1,0)):hI,"vec3").once()().toVar("normalLocal"),mie=_s.dFdx().cross(_s.dFdy()).normalize().toVar("normalFlat"),tx=me(i=>{let e;return i.isFlatShading()?e=mie:e=Ez(ya).toVarying("v_normalViewGeometry").normalize(),e},"vec3").once()().toVar("normalViewGeometry"),Aie=me(i=>{let e=tx.transformNormalByInverseViewMatrix(vm);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=tx,i.isFlatShading()!==!0&&(e=t1(e))):e=i.context.setupNormal().context({getUV:null,getTextureLevel:null}),e},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),_m=hi.transformNormalByInverseViewMatrix(vm).toVar("normalWorld"),sm=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"),Tz=me(([i,e=Yc])=>So(e).inverse().transpose().mul(i).normalize());Ue("transformNormal",Tz);var Ez=me(([i],e)=>{let t=e.context.modelNormalViewMatrix;return t?i.transformNormalByViewMatrix(t):hie.mul(i).transformNormalByViewMatrix(vm)}),XTe=me(()=>(Xe('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),hi)).once(["NORMAL","VERTEX"])(),$Te=me(()=>(Xe('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),_m)).once(["NORMAL","VERTEX"])(),YTe=me(()=>(Xe('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),sm)).once(["NORMAL","VERTEX"])(),mO=new cn,gie=Xt(0).onReference(({material:i})=>i).onObjectUpdate(({material:i})=>i.refractionRatio),DR=Xt(1).onReference(({material:i})=>i).onObjectUpdate(function({material:i,scene:e}){return i.envMap?i.envMapIntensity:e.environmentIntensity}),JR=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?mO.makeRotationFromEuler(n).transpose():mO.identity(),mO}),vie=er.negate().reflect(hi),_ie=er.negate().refract(hi,gie),xie=vie.transformDirection(AS).toVar("reflectVector"),yie=_ie.transformDirection(AS).toVar("refractVector"),bie=new Rh,TU=class extends Jc{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===Yl?xie:e.mapping===Bc?yie:(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===gl?pe(t.x,t.y.negate(),t.z):t:(t=JR.mul(t),(e.renderer.coordinateSystem===gl||!n.isRenderTargetTexture)&&(t=pe(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}},Mz=$n(TU).setParameterLength(1,4).setName("cubeTexture"),Za=(i=bie,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=Mz(i,e,t,n),r},ZTe=(i=bie)=>Mz(i),EU=class extends Wd{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)}},nx=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 EU(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=ux(null,e,this.count):Array.isArray(this.getValueFromReference())?(t=Ho(null,e),t.updateType=yn.OBJECT):e==="texture"?t=fi(null):e==="cubeTexture"?t=Za(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 nx(i,e,t),wie=(i,e,t,n)=>new nx(i,e,n,t),MU=class extends nx{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}},Gd=(i,e,t=null)=>new MU(i,e,t),Sie=Ui(),KTe=_s.dFdx(),QTe=_s.dFdy(),Tie=Sie.dFdx(),Eie=Sie.dFdy(),Mie=hi,Cie=QTe.cross(Mie),Rie=Mie.cross(KTe),CU=Cie.mul(Tie.x).add(Rie.mul(Eie.x)),RU=Cie.mul(Tie.y).add(Rie.mul(Eie.y)),uee=CU.dot(CU).max(RU.dot(RU)),Iie=uee.equal(0).select(0,uee.inverseSqrt()),JTe=CU.mul(Iie).toVar("tangentViewFrame"),eEe=RU.mul(Iie).toVar("bitangentViewFrame"),fI=ac("tangent","vec4"),dm=fI.xyz.toVar("tangentLocal"),dI=me(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=yf.mul(Ft(dm,0)).xyz.toVarying("v_tangentView").normalize():e=JTe,i.isFlatShading()!==!0&&(e=t1(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),Pie=dI.transformDirection(AS).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),pI=me(([i,e],t)=>{let n=i.mul(fI.w).xyz;return t.subBuildFn==="NORMAL"&&t.isFlatShading()!==!0&&(n=n.toVarying(e)),n}).once(["NORMAL"]),tEe=pI(hI.cross(fI),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),nEe=pI(ya.cross(dm),"v_bitangentLocal").normalize().toVar("bitangentLocal"),Lie=me(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=pI(hi.cross(dI),"v_bitangentView").normalize():e=eEe,i.isFlatShading()!==!0&&(e=t1(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),iEe=pI(_m.cross(Pie),"v_bitangentWorld").normalize().toVar("bitangentWorld"),Dg=So(dI,Lie,hi).toVar("TBNViewMatrix"),Die=er.mul(Dg),rEe=(i,e)=>i.sub(Die.mul(e)),Nie=me(()=>{let i=Bg.cross(er);return i=i.cross(Bg).normalize(),i=Kn(i,hi,tm.mul(df.oneMinus()).oneMinus().pow2().pow2()).normalize(),i}).once()(),Cz=i=>Ht(i).mul(.5).add(.5),Fie=i=>Ht(i).mul(2).sub(1),IU=i=>pe(i,Qa(aI(oe(1).sub(Qc(i,i))))),sEe=i=>(ni('TSL: "directionToColor()" has been renamed to "packNormalToRGB()".'),Cz(i)),oEe=i=>(ni('TSL: "colorToDirection()" has been renamed to "unpackRGBToNormal()".'),Fie(i)),PU=class extends Cr{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=Zl,this.unpackNormalMode=mb}setup(e){let{normalMapType:t,scaleNode:n,unpackNormalMode:r}=this,s=this.node.mul(2).sub(1);if(t===Zl?r===bM?s=IU(s.xy):r===S8?s=IU(s.yw):r!==mb&&ze(`THREE.NodeMaterial: Unexpected unpack normal mode: ${r}`):r!==mb&&ze(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${r}'`),n!==null){let a=n;e.isFlatShading()===!0&&(a=t1(a)),s=pe(s.xy.mul(a),s.z)}let o=null;return t===yM?o=Ez(s):t===Zl?o=Dg.mul(s).normalize():(ze(`NodeMaterial: Unsupported normal map type: ${t}`),o=hi),o}},LU=$n(PU).setParameterLength(1,2),aEe=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)}),lEe=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(Sz),u=c.sign().mul(n.x.mul(a).add(n.y.mul(l)));return c.abs().mul(t).sub(u).normalize()}),DU=class extends Cr{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=aEe({textureNode:this.textureNode,bumpScale:t});return lEe({surf_pos:_s,surf_norm:hi,dHdxy:n})}},Rz=$n(DU).setParameterLength(1,2),hee=new Map,at=class i extends Kt{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=hee.get(e);return n===void 0&&(n=Gd(e,t),hee.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=LU(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType,(t.normalMap.format==Ws||t.normalMap.format==Wh||t.normalMap.format==Hh)&&(r.unpackNormalMode=bM)):t.bumpMap?r=Rz(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=LU(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=eI(q_.x,q_.y,q_.y.negate(),q_.x).mul(s.rg.mul(2).sub(dt(1)).normalize().mul(s.b))}else r=q_;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 Bie=xt(at,at.ALPHA_TEST),Oie=xt(at,at.COLOR),Uie=xt(at,at.SHININESS),kie=xt(at,at.EMISSIVE),Iz=xt(at,at.OPACITY),zie=xt(at,at.SPECULAR),NU=xt(at,at.SPECULAR_INTENSITY),Vie=xt(at,at.SPECULAR_COLOR),qw=xt(at,at.SPECULAR_STRENGTH),NR=xt(at,at.REFLECTIVITY),Gie=xt(at,at.ROUGHNESS),qie=xt(at,at.METALNESS),Hie=xt(at,at.NORMAL),Wie=xt(at,at.CLEARCOAT),jie=xt(at,at.CLEARCOAT_ROUGHNESS),Xie=xt(at,at.CLEARCOAT_NORMAL),$ie=xt(at,at.ROTATION),Yie=xt(at,at.SHEEN),Zie=xt(at,at.SHEEN_ROUGHNESS),Kie=xt(at,at.ANISOTROPY),Qie=xt(at,at.IRIDESCENCE),Jie=xt(at,at.IRIDESCENCE_IOR),ere=xt(at,at.IRIDESCENCE_THICKNESS),tre=xt(at,at.TRANSMISSION),nre=xt(at,at.THICKNESS),ire=xt(at,at.IOR),rre=xt(at,at.ATTENUATION_DISTANCE),sre=xt(at,at.ATTENUATION_COLOR),Pz=xt(at,at.LINE_SCALE),Lz=xt(at,at.LINE_DASH_SIZE),Dz=xt(at,at.LINE_GAP_SIZE),e4=xt(at,at.LINE_WIDTH),Nz=xt(at,at.LINE_DASH_OFFSET),ore=xt(at,at.POINT_SIZE),are=xt(at,at.DISPERSION),Fz=xt(at,at.LIGHT_MAP),lre=xt(at,at.AO),q_=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))}),cre=me(i=>i.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection"),Ja=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)}};Ja.OBJECT="object";Ja.MATERIAL="material";Ja.FRAME="frame";Ja.BEFORE_OBJECT="beforeObject";Ja.BEFORE_MATERIAL="beforeMaterial";Ja.BEFORE_FRAME="beforeFrame";var hx=(i,e)=>new Ja(i,e).toStack(),gS=i=>hx(Ja.OBJECT,i),cEe=i=>hx(Ja.MATERIAL,i),ure=i=>hx(Ja.FRAME,i),uEe=i=>hx(Ja.BEFORE_OBJECT,i),hEe=i=>hx(Ja.BEFORE_MATERIAL,i),fEe=i=>hx(Ja.BEFORE_FRAME,i),FU=class extends Wd{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}},dEe=$n(FU).setParameterLength(2),BU=class extends Jw{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=Tte(e.itemSize),n=e.count):r=t,super(e,r,n),this.isStorageBufferNode=!0,this.structTypeNode=s,this.access=Wo.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 dEe(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(Wo.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=dz(this.value),this._varying=Am(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}},um=(i,e=null,t=0)=>new BU(i,e,t),OU=new WeakMap,fee=new WeakMap,UU=new WeakMap;function hre(i,e){let t,n=Math.max(e.count,1);if(e.isStorageInstancedBufferAttribute===!0)t=um(e,"mat4",n).element(qu);else if(n*16*4<=i.getUniformBufferLimit())t=ux(e.array,"mat4",n).element(qu);else{let o=OU.get(e);o||(o=new Ph(e.array,16,1),OU.set(e,o));let a=e.usage===tg?pz:uI,l=[a(o,"vec4",16,0),a(o,"vec4",16,4),a(o,"vec4",16,8),a(o,"vec4",16,12)];t=cm(...l)}return t}function pEe(i,e,t){let n=UU.get(i);if(n===void 0){let r=e.clone();n={previousInstanceMatrix:r,node:hre(t,r)},UU.set(i,n)}return n.node}var Bz=Jg("vec3","vInstanceColor"),fre=me(([i,e=null],t)=>{let n=i.isStorageInstancedBufferAttribute===!0,r=e&&e.isStorageInstancedBufferAttribute===!0,s=hre(t,i),o=null;n||Math.max(i.count,1)*16*4>t.getUniformBufferLimit()&&(o=OU.get(i));let a=null,l=null;if(e)if(r)a=um(e,"vec3",Math.max(e.count,1)).element(qu);else{let u=fee.get(e);u||(u=new Xl(e.array,3),fee.set(e,u)),l=u;let f=e.usage===tg?pz:uI;a=pe(f(u,"vec3",3,0))}(o!==null||l!==null)&&ure(()=>{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(Er).xyz;if(Er.assign(c),t.needsPreviousData()){let u=t.object;gS(({object:d})=>{UU.get(d).previousInstanceMatrix.array.set(i.array)});let f=pEe(u,i,t);jg.assign(f.mul(jg).xyz)}if(t.hasGeometryAttribute("normal")){let u=Tz(ya,s);ya.assign(u)}a!==null&&Bz.assign(a)},"void"),dre=me(([i])=>{let{instanceMatrix:e,instanceColor:t}=i;fre(e,t)},"void"),mEe=me(([i,e])=>{let t=de(Hg(vs(i),0).x).toConst(),n=de(e),r=n.mod(t).toConst(),s=n.div(t).toConst();return vs(i,Ur(r,s))}),AEe=me(([i,e])=>{let t=de(Hg(vs(i),0).x).toConst(),n=de(e).mod(t).toConst(),r=de(e).div(t).toConst();return vs(i,Ur(n,r)).x}),Oz=Jg("vec4","vBatchColor"),pre=me(([i],e)=>{let t=e.getDrawIndex()===null?qu:Jne,n=AEe(i._indirectTexture,de(t)),r=i._matricesTexture,s=de(Hg(vs(r),0).x).toConst(),o=oe(n).mul(4).toInt().toConst(),a=o.mod(s).toConst(),l=o.div(s).toConst(),c=cm(vs(r,Ur(a,l)),vs(r,Ur(a.add(1),l)),vs(r,Ur(a.add(2),l)),vs(r,Ur(a.add(3),l))),u=i._colorsTexture;if(u!==null){let y=mEe(u,n);Oz.assign(y)}let f=So(c);Er.assign(c.mul(Er));let d=ya.div(pe(f[0].dot(f[0]),f[1].dot(f[1]),f[2].dot(f[2]))),A=f.mul(d).xyz;ya.assign(A),e.hasGeometryAttribute("tangent")&&dm.mulAssign(f)},"void"),t4=new WeakMap,n4=new WeakMap;function Uz(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=Is(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 mre(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=Is(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 Are(i,e,t,n,r){let s=i.skeleton,o=n4.get(s);if(o===void 0){s.update();let a=new Float32Array(s.boneMatrices);o={previousBoneMatrices:a,node:ux(a,"mat4",s.bones.length)},n4.set(s,o)}return Uz(o.node,jg,e,t,n,r)}var gre=me(([i],e)=>{let t=ac("skinIndex","uvec4"),n=ac("skinWeight","vec4"),r=mr("bindMatrix","mat4"),s=mr("bindMatrixInverse","mat4"),o=wie("skeleton.boneMatrices","mat4",i.skeleton.bones.length);if(gS(({object:l,frameId:c})=>{let u=l.skeleton;if(t4.get(u)!==c){t4.set(u,c);let f=n4.get(u);f!==void 0&&f.previousBoneMatrices.set(u.boneMatrices),u.update()}}),e.needsPreviousData()){let l=Are(i,r,s,t,n);jg.assign(l)}let a=Uz(o,Er,r,s,t,n);if(Er.assign(a),e.hasGeometryAttribute("normal")){let{skinNormal:l,skinTangent:c}=mre(o,ya,dm,r,s,t,n);ya.assign(l),e.hasGeometryAttribute("tangent")&&dm.assign(c)}},"void"),gEe=me(([i,e=null],t)=>{let n=um(new Xl(i.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(qu).toVar(),r=um(new Xl(new Uint32Array(i.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(qu).toVar(),s=um(new Xl(i.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(qu).toVar(),o=Xt(i.bindMatrix,"mat4"),a=Xt(i.bindMatrixInverse,"mat4"),l=ux(i.skeleton.boneMatrices,"mat4",i.skeleton.bones.length),c=i.skeleton;if(gS(({frameId:f})=>{if(t4.get(c)!==f){t4.set(c,f);let d=n4.get(c);d!==void 0&&d.previousBoneMatrices.set(c.boneMatrices),c.update()}}),t.needsPreviousData()){let f=Are(i,o,a,r,s);jg.assign(f)}let u=Uz(l,n,o,a,r,s);if(e!==null&&e.assign(u),t.hasGeometryAttribute("normal")){let{skinNormal:f,skinTangent:d}=mre(l,ya,dm,o,a,r,s);ya.assign(f),t.hasGeometryAttribute("tangent")&&dm.assign(d)}return u}),kU=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]=oc(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+`,RA(o)}return n}},aie=(i,e=null)=>new mU(Ht(i),e).toStack();Ue("debug",aie);var ZR=class extends aa{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(){}},AU=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!==ZR&&ni('TSL: ".toInspector()" is only available with WebGPU.'),t}};function lie(i,e="",t=null){return i=Ht(i),i.before(new AU(i,e,t))}Ue("toInspector",lie);function TTe(i){Xe("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",i)}var KR=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):Am(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}},ac=(i,e=null)=>new KR(i,e),Ui=(i=0)=>ac("uv"+(i>0?i:""),"vec2"),gU=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)}},Hg=$n(gU).setParameterLength(1,2),vU=class extends Gg{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))}}},_z=$n(vU).setParameterLength(1),QR=class extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}},xz=new qs,Jc=class extends Gg{static get type(){return"TextureNode"}constructor(e=xz,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===Yr?"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(Hg(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 QR("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(Pd.TEXTURE_COMPARE))o=this.compareNode;else{let l=n.compareFunction;l===null||l===Jv||l===jh||l===eg||l===Lu?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;$===eg||$===Lu?H=qg(oc(H,a),oc(C,"float")).build(e,a):H=qg(oc(C,"float"),oc(H,a)).build(e,a)}e.addLineFlowCode(`${l} = ${H}`,this),o.snippet=H,o.propertyName=l}let c=l;return e.needsToWorkingColorSpace(n)&&(c=lI(oc(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(_z(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 Hg(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}},ETe=$n(Jc).setParameterLength(1,4).setName("texture"),fi=(i=xz,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=ETe(i,e,t,n),r},MTe=(i=xz)=>fi(i),vs=(...i)=>fi(...i).setSampler(!1),CTe=(i,e,t)=>fi(i,e).level(t),RTe=i=>(i.isNode===!0?i:fi(i)).convert("sampler"),ITe=i=>(i.isNode===!0?i:fi(i)).convert("samplerComparison"),eS=class extends Gg{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"}},ux=(i,e,t)=>new eS(i,e,t),_U=class extends Wd{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)}},xU=class extends eS{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?am(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 _U(this,Ht(e))}},Wo=(i,e)=>new xU(i,e),yU=class extends Kt{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}},Zd=$n(yU).setParameterLength(1),xw,yw,Xo=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?yw.copy(t.viewport):(e.getViewport(yw),yw.multiplyScalar(e.getPixelRatio())):this.scope===i.DPR?this._output.value=e.getPixelRatio():t!==null?(xw.width=t.width,xw.height=t.height):e.getDrawingBufferSize(xw)}setup(){let e=this.scope,t=null;return e===i.SIZE?t=Xt(xw||(xw=new Oe)):e===i.VIEWPORT?t=Xt(yw||(yw=new xn)):e===i.DPR?t=Xt(1):t=dt(e1.div(Wg)),this._output=t,t}generate(e){if(this.scope===i.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){let n=e.getNodeProperties(Wg).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}};Xo.COORDINATE="coordinate";Xo.VIEWPORT="viewport";Xo.SIZE="size";Xo.UV="uv";Xo.DPR="dpr";var yz=xt(Xo,Xo.DPR),qu=xt(Xo,Xo.UV),Wg=xt(Xo,Xo.SIZE),e1=xt(Xo,Xo.COORDINATE),Q_=xt(Xo,Xo.VIEWPORT),bz=Q_.zw,cie=e1.sub(Q_.xy),PTe=cie.div(bz),LTe=me(()=>(Xe('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new Jr),Wg),"vec2").once()(),lO=null,YC=null,cO=null,ZC=null,uO=null,KC=null,hO=null,QC=null,fO=null,JC=null,dO=null,eR=null,pO=null,tR=null,gm=Xt(0,"uint").setName("u_cameraIndex").setGroup(nI("cameraIndex")).toVarying("v_cameraIndex"),im=Xt("float").setName("cameraNear").setGroup(Jt).onRenderUpdate(({camera:i})=>i.near),rm=Xt("float").setName("cameraFar").setGroup(Jt).onRenderUpdate(({camera:i})=>i.far),Ka=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrix);YC===null?YC=Wo(t).setGroup(Jt).setName("cameraProjectionMatrices"):YC.array=t,e=YC.element(i.isMultiViewCamera?Zd("gl_ViewID_OVR"):gm)}else lO===null&&(lO=Xt(i.projectionMatrix).setName("cameraProjectionMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.projectionMatrix)),e=lO;return e}).once()(),uie=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrixInverse);ZC===null?ZC=Wo(t).setGroup(Jt).setName("cameraProjectionMatricesInverse"):ZC.array=t,e=ZC.element(i.isMultiViewCamera?Zd("gl_ViewID_OVR"):gm)}else cO===null&&(cO=Xt(i.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(Jt).onRenderUpdate(({camera:t})=>t.projectionMatrixInverse)),e=cO;return e}).once()(),vm=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorldInverse);KC===null?KC=Wo(t).setGroup(Jt).setName("cameraViewMatrices"):KC.array=t,e=KC.element(i.isMultiViewCamera?Zd("gl_ViewID_OVR"):gm)}else uO===null&&(uO=Xt(i.matrixWorldInverse).setName("cameraViewMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.matrixWorldInverse)),e=uO;return e}).once()(),gS=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorld);QC===null?QC=Wo(t).setGroup(Jt).setName("cameraWorldMatrices"):QC.array=t,e=QC.element(i.isMultiViewCamera?Zd("gl_ViewID_OVR"):gm)}else hO===null&&(hO=Xt(i.matrixWorld).setName("cameraWorldMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.matrixWorld)),e=hO;return e}).once()(),DTe=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.normalMatrix);JC===null?JC=Wo(t).setGroup(Jt).setName("cameraNormalMatrices"):JC.array=t,e=JC.element(i.isMultiViewCamera?Zd("gl_ViewID_OVR"):gm)}else fO===null&&(fO=Xt(i.normalMatrix).setName("cameraNormalMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.normalMatrix)),e=fO;return e}).once()(),hie=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);eR===null?eR=Wo(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)}):eR.array=t,e=eR.element(i.isMultiViewCamera?Zd("gl_ViewID_OVR"):gm)}else dO===null&&(dO=Xt(new re).setName("cameraPosition").setGroup(Jt).onRenderUpdate(({camera:t},n)=>n.value.setFromMatrixPosition(t.matrixWorld))),e=dO;return e}).once()(),NTe=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.viewport);tR===null?tR=Wo(t,"vec4").setGroup(Jt).setName("cameraViewports"):tR.array=t,e=tR.element(gm)}else pO===null&&(pO=Ft(0,0,Wg.x,Wg.y).toConst("cameraViewport")),e=pO;return e}).once()(),uee=new vl,Ps=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 Gg(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(),uee.copy(s.boundingSphere).applyMatrix4(t.matrixWorld),n.value=uee.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}};Ps.WORLD_MATRIX="worldMatrix";Ps.POSITION="position";Ps.SCALE="scale";Ps.VIEW_POSITION="viewPosition";Ps.DIRECTION="direction";Ps.RADIUS="radius";var FTe=$n(Ps,Ps.DIRECTION).setParameterLength(1),BTe=$n(Ps,Ps.WORLD_MATRIX).setParameterLength(1),OTe=$n(Ps,Ps.POSITION).setParameterLength(1),UTe=$n(Ps,Ps.SCALE).setParameterLength(1),kTe=$n(Ps,Ps.VIEW_POSITION).setParameterLength(1),zTe=$n(Ps,Ps.RADIUS).setParameterLength(1),Cl=class extends Ps{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}},VTe=xt(Cl,Cl.DIRECTION),Yc=xt(Cl,Cl.WORLD_MATRIX),GTe=xt(Cl,Cl.POSITION),qTe=xt(Cl,Cl.SCALE),HTe=xt(Cl,Cl.VIEW_POSITION),WTe=xt(Cl,Cl.RADIUS),fie=Xt(new Mn).onObjectUpdate(({object:i},e)=>e.value.getNormalMatrix(i.matrixWorld)),jTe=Xt(new cn).onObjectUpdate(({object:i},e)=>e.value.copy(i.matrixWorld).invert()),yf=me(i=>i.context.modelViewMatrix||die).once()().toVar("modelViewMatrix"),die=vm.mul(Yc),bU=me(i=>(i.context.isHighPrecisionModelViewMatrix=!0,Xt("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),wU=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"),pie=me(i=>i.shaderStage!=="fragment"?(ni("TSL: `clipSpace` is only available in fragment stage."),Ft()):i.context.clipSpace.toVarying("v_clipSpace")).once()(),Aa=ac("position","vec3"),Er=Aa.toVarying("positionLocal"),jg=Aa.toVarying("positionPrevious"),vf=me(i=>Yc.mul(Er).xyz.toVarying(i.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),wz=me(()=>Er.transformDirection(Yc).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),_s=me(i=>{if(i.shaderStage==="fragment"&&i.material.vertexNode){let e=uie.mul(pie);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=_s.negate().toVarying("v_positionViewDirection").normalize(),e.toVar("positionViewDirection")},"vec3").once(["POSITION"])(),SU=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()}},mie=xt(SU),Sz=oe(mie).mul(2).sub(1),t1=me(([i],{material:e})=>{let t=e.side;return t===mi?i=i.mul(-1):t===gr&&(i=i.mul(Sz)),i}),XTe=i=>(ni('TSL: "directionToFaceDirection()" has been renamed to "negateOnBackSide()".'),t1(i)),hI=ac("normal","vec3"),ya=me(i=>i.geometry.hasAttribute("normal")===!1?(Xe('TSL: Vertex attribute "normal" not found on geometry.'),pe(0,1,0)):hI,"vec3").once()().toVar("normalLocal"),Aie=_s.dFdx().cross(_s.dFdy()).normalize().toVar("normalFlat"),tx=me(i=>{let e;return i.isFlatShading()?e=Aie:e=Ez(ya).toVarying("v_normalViewGeometry").normalize(),e},"vec3").once()().toVar("normalViewGeometry"),gie=me(i=>{let e=tx.transformNormalByInverseViewMatrix(vm);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=tx,i.isFlatShading()!==!0&&(e=t1(e))):e=i.context.setupNormal().context({getUV:null,getTextureLevel:null}),e},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),_m=hi.transformNormalByInverseViewMatrix(vm).toVar("normalWorld"),sm=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"),Tz=me(([i,e=Yc])=>So(e).inverse().transpose().mul(i).normalize());Ue("transformNormal",Tz);var Ez=me(([i],e)=>{let t=e.context.modelNormalViewMatrix;return t?i.transformNormalByViewMatrix(t):fie.mul(i).transformNormalByViewMatrix(vm)}),$Te=me(()=>(Xe('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),hi)).once(["NORMAL","VERTEX"])(),YTe=me(()=>(Xe('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),_m)).once(["NORMAL","VERTEX"])(),ZTe=me(()=>(Xe('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),sm)).once(["NORMAL","VERTEX"])(),mO=new cn,vie=Xt(0).onReference(({material:i})=>i).onObjectUpdate(({material:i})=>i.refractionRatio),DR=Xt(1).onReference(({material:i})=>i).onObjectUpdate(function({material:i,scene:e}){return i.envMap?i.envMapIntensity:e.environmentIntensity}),JR=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?mO.makeRotationFromEuler(n).transpose():mO.identity(),mO}),_ie=er.negate().reflect(hi),xie=er.negate().refract(hi,vie),yie=_ie.transformDirection(gS).toVar("reflectVector"),bie=xie.transformDirection(gS).toVar("refractVector"),wie=new Rh,TU=class extends Jc{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===Yl?yie:e.mapping===Bc?bie:(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===gl?pe(t.x,t.y.negate(),t.z):t:(t=JR.mul(t),(e.renderer.coordinateSystem===gl||!n.isRenderTargetTexture)&&(t=pe(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}},Mz=$n(TU).setParameterLength(1,4).setName("cubeTexture"),Za=(i=wie,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=Mz(i,e,t,n),r},KTe=(i=wie)=>Mz(i),EU=class extends Wd{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)}},nx=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 EU(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=ux(null,e,this.count):Array.isArray(this.getValueFromReference())?(t=Wo(null,e),t.updateType=yn.OBJECT):e==="texture"?t=fi(null):e==="cubeTexture"?t=Za(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 nx(i,e,t),Sie=(i,e,t,n)=>new nx(i,e,n,t),MU=class extends nx{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}},Gd=(i,e,t=null)=>new MU(i,e,t),Tie=Ui(),QTe=_s.dFdx(),JTe=_s.dFdy(),Eie=Tie.dFdx(),Mie=Tie.dFdy(),Cie=hi,Rie=JTe.cross(Cie),Iie=Cie.cross(QTe),CU=Rie.mul(Eie.x).add(Iie.mul(Mie.x)),RU=Rie.mul(Eie.y).add(Iie.mul(Mie.y)),hee=CU.dot(CU).max(RU.dot(RU)),Pie=hee.equal(0).select(0,hee.inverseSqrt()),eEe=CU.mul(Pie).toVar("tangentViewFrame"),tEe=RU.mul(Pie).toVar("bitangentViewFrame"),fI=ac("tangent","vec4"),dm=fI.xyz.toVar("tangentLocal"),dI=me(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=yf.mul(Ft(dm,0)).xyz.toVarying("v_tangentView").normalize():e=eEe,i.isFlatShading()!==!0&&(e=t1(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),Lie=dI.transformDirection(gS).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),pI=me(([i,e],t)=>{let n=i.mul(fI.w).xyz;return t.subBuildFn==="NORMAL"&&t.isFlatShading()!==!0&&(n=n.toVarying(e)),n}).once(["NORMAL"]),nEe=pI(hI.cross(fI),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),iEe=pI(ya.cross(dm),"v_bitangentLocal").normalize().toVar("bitangentLocal"),Die=me(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=pI(hi.cross(dI),"v_bitangentView").normalize():e=tEe,i.isFlatShading()!==!0&&(e=t1(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),rEe=pI(_m.cross(Lie),"v_bitangentWorld").normalize().toVar("bitangentWorld"),Dg=So(dI,Die,hi).toVar("TBNViewMatrix"),Nie=er.mul(Dg),sEe=(i,e)=>i.sub(Nie.mul(e)),Fie=me(()=>{let i=Bg.cross(er);return i=i.cross(Bg).normalize(),i=Qn(i,hi,tm.mul(df.oneMinus()).oneMinus().pow2().pow2()).normalize(),i}).once()(),Cz=i=>Ht(i).mul(.5).add(.5),Bie=i=>Ht(i).mul(2).sub(1),IU=i=>pe(i,Qa(aI(oe(1).sub(Qc(i,i))))),oEe=i=>(ni('TSL: "directionToColor()" has been renamed to "packNormalToRGB()".'),Cz(i)),aEe=i=>(ni('TSL: "colorToDirection()" has been renamed to "unpackRGBToNormal()".'),Bie(i)),PU=class extends Cr{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=Zl,this.unpackNormalMode=Ab}setup(e){let{normalMapType:t,scaleNode:n,unpackNormalMode:r}=this,s=this.node.mul(2).sub(1);if(t===Zl?r===bM?s=IU(s.xy):r===S8?s=IU(s.yw):r!==Ab&&ze(`THREE.NodeMaterial: Unexpected unpack normal mode: ${r}`):r!==Ab&&ze(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${r}'`),n!==null){let a=n;e.isFlatShading()===!0&&(a=t1(a)),s=pe(s.xy.mul(a),s.z)}let o=null;return t===yM?o=Ez(s):t===Zl?o=Dg.mul(s).normalize():(ze(`NodeMaterial: Unsupported normal map type: ${t}`),o=hi),o}},LU=$n(PU).setParameterLength(1,2),lEe=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)}),cEe=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(Sz),u=c.sign().mul(n.x.mul(a).add(n.y.mul(l)));return c.abs().mul(t).sub(u).normalize()}),DU=class extends Cr{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=lEe({textureNode:this.textureNode,bumpScale:t});return cEe({surf_pos:_s,surf_norm:hi,dHdxy:n})}},Rz=$n(DU).setParameterLength(1,2),fee=new Map,at=class i extends Kt{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=fee.get(e);return n===void 0&&(n=Gd(e,t),fee.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=LU(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType,(t.normalMap.format==Ws||t.normalMap.format==Wh||t.normalMap.format==Hh)&&(r.unpackNormalMode=bM)):t.bumpMap?r=Rz(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=LU(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=eI(q_.x,q_.y,q_.y.negate(),q_.x).mul(s.rg.mul(2).sub(dt(1)).normalize().mul(s.b))}else r=q_;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 Oie=xt(at,at.ALPHA_TEST),Uie=xt(at,at.COLOR),kie=xt(at,at.SHININESS),zie=xt(at,at.EMISSIVE),Iz=xt(at,at.OPACITY),Vie=xt(at,at.SPECULAR),NU=xt(at,at.SPECULAR_INTENSITY),Gie=xt(at,at.SPECULAR_COLOR),Hw=xt(at,at.SPECULAR_STRENGTH),NR=xt(at,at.REFLECTIVITY),qie=xt(at,at.ROUGHNESS),Hie=xt(at,at.METALNESS),Wie=xt(at,at.NORMAL),jie=xt(at,at.CLEARCOAT),Xie=xt(at,at.CLEARCOAT_ROUGHNESS),$ie=xt(at,at.CLEARCOAT_NORMAL),Yie=xt(at,at.ROTATION),Zie=xt(at,at.SHEEN),Kie=xt(at,at.SHEEN_ROUGHNESS),Qie=xt(at,at.ANISOTROPY),Jie=xt(at,at.IRIDESCENCE),ere=xt(at,at.IRIDESCENCE_IOR),tre=xt(at,at.IRIDESCENCE_THICKNESS),nre=xt(at,at.TRANSMISSION),ire=xt(at,at.THICKNESS),rre=xt(at,at.IOR),sre=xt(at,at.ATTENUATION_DISTANCE),ore=xt(at,at.ATTENUATION_COLOR),Pz=xt(at,at.LINE_SCALE),Lz=xt(at,at.LINE_DASH_SIZE),Dz=xt(at,at.LINE_GAP_SIZE),e4=xt(at,at.LINE_WIDTH),Nz=xt(at,at.LINE_DASH_OFFSET),are=xt(at,at.POINT_SIZE),lre=xt(at,at.DISPERSION),Fz=xt(at,at.LIGHT_MAP),cre=xt(at,at.AO),q_=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))}),ure=me(i=>i.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection"),Ja=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)}};Ja.OBJECT="object";Ja.MATERIAL="material";Ja.FRAME="frame";Ja.BEFORE_OBJECT="beforeObject";Ja.BEFORE_MATERIAL="beforeMaterial";Ja.BEFORE_FRAME="beforeFrame";var hx=(i,e)=>new Ja(i,e).toStack(),vS=i=>hx(Ja.OBJECT,i),uEe=i=>hx(Ja.MATERIAL,i),hre=i=>hx(Ja.FRAME,i),hEe=i=>hx(Ja.BEFORE_OBJECT,i),fEe=i=>hx(Ja.BEFORE_MATERIAL,i),dEe=i=>hx(Ja.BEFORE_FRAME,i),FU=class extends Wd{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}},pEe=$n(FU).setParameterLength(2),BU=class extends eS{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=Ete(e.itemSize),n=e.count):r=t,super(e,r,n),this.isStorageBufferNode=!0,this.structTypeNode=s,this.access=jo.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 pEe(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(jo.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=dz(this.value),this._varying=Am(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}},um=(i,e=null,t=0)=>new BU(i,e,t),OU=new WeakMap,dee=new WeakMap,UU=new WeakMap;function fre(i,e){let t,n=Math.max(e.count,1);if(e.isStorageInstancedBufferAttribute===!0)t=um(e,"mat4",n).element(Hu);else if(n*16*4<=i.getUniformBufferLimit())t=ux(e.array,"mat4",n).element(Hu);else{let o=OU.get(e);o||(o=new Ph(e.array,16,1),OU.set(e,o));let a=e.usage===tg?pz:uI,l=[a(o,"vec4",16,0),a(o,"vec4",16,4),a(o,"vec4",16,8),a(o,"vec4",16,12)];t=cm(...l)}return t}function mEe(i,e,t){let n=UU.get(i);if(n===void 0){let r=e.clone();n={previousInstanceMatrix:r,node:fre(t,r)},UU.set(i,n)}return n.node}var Bz=Jg("vec3","vInstanceColor"),dre=me(([i,e=null],t)=>{let n=i.isStorageInstancedBufferAttribute===!0,r=e&&e.isStorageInstancedBufferAttribute===!0,s=fre(t,i),o=null;n||Math.max(i.count,1)*16*4>t.getUniformBufferLimit()&&(o=OU.get(i));let a=null,l=null;if(e)if(r)a=um(e,"vec3",Math.max(e.count,1)).element(Hu);else{let u=dee.get(e);u||(u=new Xl(e.array,3),dee.set(e,u)),l=u;let f=e.usage===tg?pz:uI;a=pe(f(u,"vec3",3,0))}(o!==null||l!==null)&&hre(()=>{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(Er).xyz;if(Er.assign(c),t.needsPreviousData()){let u=t.object;vS(({object:d})=>{UU.get(d).previousInstanceMatrix.array.set(i.array)});let f=mEe(u,i,t);jg.assign(f.mul(jg).xyz)}if(t.hasGeometryAttribute("normal")){let u=Tz(ya,s);ya.assign(u)}a!==null&&Bz.assign(a)},"void"),pre=me(([i])=>{let{instanceMatrix:e,instanceColor:t}=i;dre(e,t)},"void"),AEe=me(([i,e])=>{let t=de(Hg(vs(i),0).x).toConst(),n=de(e),r=n.mod(t).toConst(),s=n.div(t).toConst();return vs(i,Ur(r,s))}),gEe=me(([i,e])=>{let t=de(Hg(vs(i),0).x).toConst(),n=de(e).mod(t).toConst(),r=de(e).div(t).toConst();return vs(i,Ur(n,r)).x}),Oz=Jg("vec4","vBatchColor"),mre=me(([i],e)=>{let t=e.getDrawIndex()===null?Hu:eie,n=gEe(i._indirectTexture,de(t)),r=i._matricesTexture,s=de(Hg(vs(r),0).x).toConst(),o=oe(n).mul(4).toInt().toConst(),a=o.mod(s).toConst(),l=o.div(s).toConst(),c=cm(vs(r,Ur(a,l)),vs(r,Ur(a.add(1),l)),vs(r,Ur(a.add(2),l)),vs(r,Ur(a.add(3),l))),u=i._colorsTexture;if(u!==null){let y=AEe(u,n);Oz.assign(y)}let f=So(c);Er.assign(c.mul(Er));let d=ya.div(pe(f[0].dot(f[0]),f[1].dot(f[1]),f[2].dot(f[2]))),A=f.mul(d).xyz;ya.assign(A),e.hasGeometryAttribute("tangent")&&dm.mulAssign(f)},"void"),t4=new WeakMap,n4=new WeakMap;function Uz(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=Is(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 Are(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=Is(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 gre(i,e,t,n,r){let s=i.skeleton,o=n4.get(s);if(o===void 0){s.update();let a=new Float32Array(s.boneMatrices);o={previousBoneMatrices:a,node:ux(a,"mat4",s.bones.length)},n4.set(s,o)}return Uz(o.node,jg,e,t,n,r)}var vre=me(([i],e)=>{let t=ac("skinIndex","uvec4"),n=ac("skinWeight","vec4"),r=mr("bindMatrix","mat4"),s=mr("bindMatrixInverse","mat4"),o=Sie("skeleton.boneMatrices","mat4",i.skeleton.bones.length);if(vS(({object:l,frameId:c})=>{let u=l.skeleton;if(t4.get(u)!==c){t4.set(u,c);let f=n4.get(u);f!==void 0&&f.previousBoneMatrices.set(u.boneMatrices),u.update()}}),e.needsPreviousData()){let l=gre(i,r,s,t,n);jg.assign(l)}let a=Uz(o,Er,r,s,t,n);if(Er.assign(a),e.hasGeometryAttribute("normal")){let{skinNormal:l,skinTangent:c}=Are(o,ya,dm,r,s,t,n);ya.assign(l),e.hasGeometryAttribute("tangent")&&dm.assign(c)}},"void"),vEe=me(([i,e=null],t)=>{let n=um(new Xl(i.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(Hu).toVar(),r=um(new Xl(new Uint32Array(i.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(Hu).toVar(),s=um(new Xl(i.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(Hu).toVar(),o=Xt(i.bindMatrix,"mat4"),a=Xt(i.bindMatrixInverse,"mat4"),l=ux(i.skeleton.boneMatrices,"mat4",i.skeleton.bones.length),c=i.skeleton;if(vS(({frameId:f})=>{if(t4.get(c)!==f){t4.set(c,f);let d=n4.get(c);d!==void 0&&d.previousBoneMatrices.set(c.boneMatrices),c.update()}}),t.needsPreviousData()){let f=gre(i,o,a,r,s);jg.assign(f)}let u=Uz(l,n,o,a,r,s);if(e!==null&&e.assign(u),t.hasGeometryAttribute("normal")){let{skinNormal:f,skinTangent:d}=Are(l,ya,dm,o,a,r,s);ya.assign(f),t.hasGeometryAttribute("tangent")&&dm.assign(d)}return u}),kU=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]=oc(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?`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 kU(Fg(i,"int")).toStack(),vEe=()=>oc("continue").toStack(),vre=()=>oc("break").toStack(),AO=new WeakMap,ec=new xn,dee=new WeakMap,pee=me(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{let o=de(Qne).mul(t).add(s),a=o.div(n),l=o.sub(a.mul(n));return vs(i,Ur(l,a)).depth(r).xyz.mul(e)});function _Ee(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=AO.get(i);if(o===void 0||o.count!==s){let T=function(){w.dispose(),AO.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 IA(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&&(ec.fromBufferAttribute(P,L),y[D+C+0]=ec.x,y[D+C+1]=ec.y,y[D+C+2]=ec.z,y[D+C+3]=0),t===!0&&(ec.fromBufferAttribute(I,L),y[D+C+4]=ec.x,y[D+C+5]=ec.y,y[D+C+6]=ec.z,y[D+C+7]=0),n===!0&&(ec.fromBufferAttribute(F,L),y[D+C+8]=ec.x,y[D+C+9]=ec.y,y[D+C+10]=ec.z,y[D+C+11]=F.itemSize===4?ec.w:1)}}o={count:s,texture:w,stride:u,size:new Oe(f,d)},AO.set(i,o),i.addEventListener("dispose",T)}return o}var _re=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=dee.get(i);(o===void 0||o.count!==s)&&(o={base:Xt(1),influences:i.morphTargetInfluences?Ho(i.morphTargetInfluences,"float"):null,count:s},dee.set(i,o));let{base:a,influences:l}=o,{texture:c,stride:u,size:f}=_Ee(e);t===!0&&Er.mulAssign(a),n===!0&&ya.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(vs(i.morphTexture,Ur(de(A).add(1),de(qu))).r):y.assign(l.element(A).toVar()),$t(y.notEqual(0),()=>{t===!0&&Er.addAssign(pee({bufferMap:c,influence:y,stride:u,width:d,depth:A,offset:de(0)})),n===!0&&ya.addAssign(pee({bufferMap:c,influence:y,stride:u,width:d,depth:A,offset:de(1)}))})}),gS(({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"),pm=class extends Kt{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}},zU=class extends pm{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}},VU=class extends Kw{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)}},xre=$n(VU),GU=class extends pm{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}},bg=new Oe,ix=class extends Jc{static get type(){return"ViewportTextureNode"}constructor(e=Gu,t=null,n=null){let r=null;n===null?(r=new FA,r.minFilter=Uo,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(bg):s.getDrawingBufferSize?s.getDrawingBufferSize(bg):bg.set(s.width,s.height);let o=this.getTextureForReference(s);(o.image.width!==bg.width||o.image.height!==bg.height)&&(o.image.width=bg.width,o.image.height=bg.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}},xEe=$n(ix).setParameterLength(0,3),kz=$n(ix,null,null,{generateMipmaps:!0}).setParameterLength(0,3),yEe=kz(),yre=(i=Gu,e=null)=>yEe.sample(i,e),gO=null,qU=class extends ix{static get type(){return"ViewportDepthTextureNode"}constructor(e=Gu,t=null,n=null){n===null&&(gO===null&&(gO=new Es),n=gO),super(e,t,n)}},zz=$n(qU).setParameterLength(0,3),ju=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=Sre().assign(n));else if(t===i.DEPTH)e.isPerspectiveCamera?r=Vz(_s.z,im,rm):r=kg(_s.z,im,rm);else if(t===i.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){let s=mI(n,im,rm);r=kg(s,im,rm)}else r=n;else r=kg(_s.z,im,rm);return r}};ju.DEPTH_BASE="depthBase";ju.DEPTH="depth";ju.LINEAR_DEPTH="linearDepth";var kg=(i,e,t)=>i.add(e).div(e.sub(t)),bEe=(i,e,t)=>i.add(t).div(t.sub(e)),bre=me(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?t.sub(e).mul(i).sub(t):e.sub(t).mul(i).sub(e)),Vz=(i,e,t)=>e.add(i).mul(t).div(t.sub(e).mul(i)),wre=(i,e,t)=>e.mul(i.add(t)).div(i.mul(e.sub(t))),mI=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))),AI=(i,e,t)=>{e=e.max(1e-6).toVar();let n=mf(i.negate().div(e)),r=mf(t.div(e));return n.div(r)},wEe=(i,e,t)=>{let n=i.mul(sI(t.div(e)));return oe(Math.E).pow(n).mul(e).negate()},Sre=$n(ju,ju.DEPTH_BASE),Gz=xt(ju,ju.DEPTH),i4=$n(ju,ju.LINEAR_DEPTH).setParameterLength(0,1),SEe=i4(zz());Gz.assign=i=>Sre(i);var bf=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=Ho(t).setGroup(Jt);Oi(o,({i:c})=>{let u=l.element(c);n.assign(_s.dot(u.xyz).negate().add(u.w)),r.assign(n.fwidth().div(2)),s.mulAssign(uc(r.negate(),r,n))})}let a=e.length;if(a>0){let l=Ho(e).setGroup(Jt),c=oe(1).toVar("intersectionClipOpacity");Oi(a,({i:u})=>{let f=l.element(u);n.assign(_s.dot(f.xyz).negate().add(f.w)),r.assign(n.fwidth().div(2)),c.mulAssign(uc(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=Ho(t).setGroup(Jt);Oi(n,({i:o})=>{let a=s.element(o);_s.dot(a.xyz).greaterThan(a.w).discard()})}let r=e.length;if(r>0){let s=Ho(e).setGroup(Jt),o=lc(!0).toVar("clipped");Oi(r,({i:a})=>{let l=s.element(a);o.assign(_s.dot(l.xyz).greaterThan(l.w).and(o))}),o.discard()}})()}setupHardwareClipping(e,t){let n=e.length;return t.enableHardwareClipping(n),me(()=>{let r=Ho(e).setGroup(Jt),s=Zd(t.getClipDistance());Oi(n,({i:o})=>{let a=r.element(o),l=_s.dot(a.xyz).sub(a.w).negate();s.element(o).assign(l)})})()}};bf.ALPHA_TO_COVERAGE="alphaToCoverage";bf.DEFAULT="default";bf.HARDWARE="hardware";var TEe=()=>new bf,EEe=()=>new bf(bf.ALPHA_TO_COVERAGE),MEe=()=>new bf(bf.HARDWARE),CEe=.05,mee=me(([i])=>Hu(Tn(1e4,Ya(Tn(17,i.x).add(Tn(.1,i.y)))).mul(Is(.1,fr(Ya(Tn(13,i.y).add(i.x))))))),Aee=me(([i])=>mee(dt(mee(i.xy),i.z))),REe=me(([i])=>{let e=kr(gf(tz(i.xyz)),gf(nz(i.xyz))),t=oe(1).div(oe(CEe).mul(e)).toVar("pixScale"),n=dt(ex(Af(mf(t))),ex(oI(mf(t)))),r=dt(Aee(Af(n.x.mul(i.xyz))),Aee(Af(n.y.mul(i.xyz)))),s=Hu(mf(t)),o=Is(Tn(s.oneMinus(),r.x),Tn(s,r.y)),a=Ml(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 Wu(c,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]}),HU=class extends KR{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}},Tre=(i=0)=>new HU(i),Rr=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(cx(t.slice(0,-4)),n.getCacheKey());return this.type+mS(e)}build(e){this.setup(e)}setupObserver(e){return new jO(e)}setup(e){e.context.setupNormal=()=>Ug(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=Ug(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),$_.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&&$_.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=EEe():e.stack.addToStack(TEe())}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(MEe()),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=AI(_s.z,im,rm):r=kg(_s.z,im,rm))}r!==null&&Gz.assign(r).toStack()}setupPositionView(){return yf.mul(Er).xyz}setupModelViewProjection(){return Ka.mul(_s)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),cre}setupPosition(e){let{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&_re(t),t.isSkinnedMesh===!0&&gre(t),this.displacementMap){let r=Gd("displacementMap","texture"),s=Gd("displacementScale","float"),o=Gd("displacementBias","float");Er.addAssign(ya.normalize().mul(r.x.mul(s).add(o)))}return t.isBatchedMesh&&pre(t),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&dre(t),this.positionNode!==null&&Er.assign(Ug(this.positionNode,"POSITION","vec3")),Er}setupDiffuseColor(e){let{object:t,geometry:n}=e;this.maskNode!==null&&lc(this.maskNode).not().discard();let r=this.colorNode?Ft(this.colorNode):Oie;this.vertexColors===!0&&n.hasAttribute("color")&&(r=r.mul(Tre())),t.instanceColor&&(r=Bz.mul(r)),t.isBatchedMesh&&t._colorsTexture&&(r=Oz.mul(r)),Bi.assign(r);let s=this.opacityNode?oe(this.opacityNode):Iz;Bi.a.assign(Bi.a.mul(s));let o=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(o=this.alphaTestNode!==null?oe(this.alphaTestNode):Bie,this.alphaToCoverage===!0?(Bi.a=uc(o,o.add(rz(Bi.a)),Bi.a),Bi.a.lessThanEqual(0).discard()):Bi.a.lessThanEqual(o).discard()),this.alphaHash===!0&&Bi.a.lessThan(REe(Er)).discard(),e.isOpaque()&&Bi.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?pe(0):Bi.rgb}setupNormal(){return this.normalNode?pe(this.normalNode):Hie}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Gd("envMap","cubeTexture"):Gd("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new GU(Fz)),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 zU(e.context.ambientOcclusion)),t}setupAmbientOcclusion(e){let t=this.aoNode;t===null&&e.material.aoMap&&(t=lre),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=xre(l,u,a,n,r)}else n!==null&&(c=pe(r!==null?Kn(c,n,r):n));return(s&&s.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(nU.assign(pe(s||kie)),c=c.add(nU)),c}setupFog(e,t){let n=e.fogNode;return n&&($_.assign(t),t=Ft(n.toVar())),t}setupPremultipliedAlpha(e,t){return gz(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}},IEe=new Mu,WU=class extends Rr{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(IEe),this.setValues(e)}},PEe=new O2,jU=class extends Rr{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(PEe),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):Nz,t=this.dashScaleNode?oe(this.dashScaleNode):Pz,n=this.dashSizeNode?oe(this.dashSizeNode):Lz,r=this.gapSizeNode?oe(this.gapSizeNode):Dz;Og.assign(n),Zw.assign(r);let s=Am(ac("lineDistance").mul(t));(e?s.add(e):s).mod(Og.add(Zw)).greaterThan(Og).discard()}};var FR=Jg("vec3","worldStart"),XU=Jg("vec3","worldEnd"),Ere=Jg("float","lineDistance"),Cg=Jg("vec4","worldPos"),gee=me(({start:i,end:e})=>{let t=Ka.element(2).element(2),n=Ka.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"}),LEe=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"}),$ot=me(({material:i})=>{let e=i._useDash,t=i._useWorldUnits,n=ac("instanceStart"),r=ac("instanceEnd"),s=Ft(yf.mul(Ft(n,1))).toVar("start"),o=Ft(yf.mul(Ft(r,1))).toVar("end"),a,l;e&&(a=oe(ac("instanceDistanceStart")).toVar("distanceStart"),l=oe(ac("instanceDistanceEnd")).toVar("distanceEnd")),t&&(FR.assign(s.xyz),XU.assign(o.xyz));let c=Q_.z.div(Q_.w),u=Ka.element(2).element(3).equal(-1);if($t(u,()=>{$t(s.z.lessThan(0).and(o.z.greaterThan(0)),()=>{let T=gee({start:s,end:o});o.assign(Ft(Kn(s.xyz,o.xyz,T),o.w)),e&&l.assign(Kn(a,l,T))}).ElseIf(o.z.lessThan(0).and(s.z.greaterThanEqual(0)),()=>{let T=gee({start:o,end:s});s.assign(Ft(Kn(o.xyz,s.xyz,T),s.w)),e&&a.assign(Kn(l,a,T))})}),e){let T=i.dashScaleNode?oe(i.dashScaleNode):Pz,R=i.offsetNode?oe(i.offsetNode):Nz,P=Aa.y.lessThan(.5).select(T.mul(a),T.mul(l));P=P.add(R),Ere.assign(P)}let f=Ka.mul(s),d=Ka.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=Kn(s.xyz,o.xyz,.5).normalize(),P=T.cross(R).normalize(),I=T.cross(P);Cg.assign(Aa.y.lessThan(.5).select(s,o));let F=e4.mul(.5);Cg.addAssign(Ft(Aa.x.lessThan(0).select(P.mul(F),P.mul(F).negate()),0)),e||(Cg.addAssign(Ft(Aa.y.lessThan(.5).select(T.mul(F).negate(),T.mul(F)),0)),Cg.addAssign(Ft(I.mul(F),0)),$t(Aa.y.greaterThan(1).or(Aa.y.lessThan(0)),()=>{Cg.subAssign(Ft(I.mul(2).mul(F),0))})),S.assign(Ka.mul(Cg));let D=pe().toVar();D.assign(Aa.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(Aa.x.lessThan(0).select(T.negate(),T)),$t(Aa.y.lessThan(0),()=>{T.assign(T.sub(w))}).ElseIf(Aa.y.greaterThan(1),()=>{T.assign(T.add(w))}),T.assign(T.mul(e4)),T.assign(T.div(Q_.w.div(yz))),S.assign(Aa.y.lessThan(.5).select(f,d)),T.assign(T.mul(S.w)),S.assign(S.add(Ft(T,0,0)))}return S})(),Yot=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):Lz,l=i.gapSizeNode?oe(i.gapSizeNode):Dz;Og.assign(a),Zw.assign(l),s.y.lessThan(-1).or(s.y.greaterThan(1)).discard(),Ere.mod(Og.add(Zw)).greaterThan(Og).discard()}let o=oe(1).toVar("alpha");if(r){let a=Cg.xyz.normalize().mul(1e5),l=XU.sub(FR),c=LEe({p1:FR,p2:XU,p3:pe(0,0,0),p4:a}),u=FR.add(l.mul(c.x)),f=a.mul(c.y),y=u.sub(f).length().div(e4);if(!n)if(t&&e.currentSamples>0){let w=y.fwidth();o.assign(uc(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(uc(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 DEe=new F2,$U=class extends Rr{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(DEe),this.setValues(e)}setupDiffuseColor(){let e=this.opacityNode?oe(this.opacityNode):Iz;Bi.assign(lI(Ft(Cz(hi),e),Nr))}},qz=me(([i=wz])=>{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)}),YU=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)}),r4=class extends Na{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 Rh(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 Cu(5,5,5),o=qz(wz),a=new Rr;a.colorNode=fi(t,o,0),a.side=mi,a.blending=ds;let l=new Hn(s,a),c=new e0;c.add(l),t.minFilter===Uo&&(t.minFilter=Mi);let u=new $v(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)}},Hw=new WeakMap,ZU=class extends Cr{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=Za(null);let t=new Rh;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===c0||o===u0){if(Hw.has(s)){let a=Hw.get(s);vee(a,s.mapping),this._cubeTexture=a}else{let a=s.image;if(NEe(a)){let l=new r4(a.height);l.fromEquirectangularTexture(t,s),vee(l.texture,s.mapping),this._cubeTexture=l.texture,Hw.set(s,l.texture),s.addEventListener("dispose",Mre)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}};function NEe(i){return i==null?!1:i.height>0}function Mre(i){let e=i.target;e.removeEventListener("dispose",Mre);let t=Hw.get(e);t!==void 0&&(Hw.delete(e),t.dispose())}function vee(i,e){e===c0?i.mapping=Yl:e===u0&&(i.mapping=Bc)}var Cre=$n(ZU).setParameterLength(1),eS=class extends pm{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=Cre(this.envNode)}},KU=class extends pm{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)}},rx=class{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}},s4=class extends rx{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 WA:r.rgb.assign(Kn(r.rgb,r.rgb.mul(s.rgb),qw.mul(NR)));break;case vM:r.rgb.assign(Kn(r.rgb,s.rgb,qw.mul(NR)));break;case _M:r.rgb.addAssign(s.rgb.mul(qw.mul(NR)));break;default:Xe("BasicLightingModel: Unsupported .combine value:",t.combine);break}}},FEe=new hs,QU=class extends Rr{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(FEe),this.setValues(e)}setupNormal(){return t1(tx)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new eS(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new KU(Fz)),t}setupOutgoingLight(){return Bi.rgb}setupLightingModel(){return new s4}},sx=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))}),Xg=me(i=>i.diffuseColor.mul(1/Math.PI)),BEe=()=>oe(.25),OEe=me(({dotNH:i})=>HR.mul(oe(.5)).add(1).mul(oe(1/Math.PI)).mul(i.pow(HR))),UEe=me(({lightDirection:i})=>{let e=i.add(er).normalize(),t=hi.dot(e).clamp(),n=er.dot(e).clamp(),r=sx({f0:fm,f90:1,dotVH:n}),s=BEe(),o=OEe({dotNH:t});return r.mul(s).mul(o)}),o4=class extends s4{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(Xg({diffuseColor:Bi.rgb}))),this.specular===!0&&n.directSpecular.addAssign(s.mul(UEe({lightDirection:e})).mul(qw))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(Xg({diffuseColor:Bi}))),r.indirectDiffuse.mulAssign(t)}},kEe=new za,JU=class extends Rr{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(kEe),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new eS(t):null}setupLightingModel(){return new o4(!1)}},zEe=new zA,e7=class extends Rr{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(zEe),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new eS(t):null}setupLightingModel(){return new o4}setupVariants(){let e=(this.shininessNode?oe(this.shininessNode):Uie).max(1e-4);HR.assign(e);let t=this.specularNode||zie;fm.assign(t)}},Rre=me(i=>{if(i.geometry.hasAttribute("normal")===!1)return oe(0);let e=tx.dFdx().abs().max(tx.dFdy().abs());return e.x.max(e.y).max(e.z)}),Hz=me(i=>{let{roughness:e}=i,t=Rre(),n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),Ire=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 cc(.5,r.add(s).max(rI))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),VEe=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 cc(.5,l.add(c).max(rI))}).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"}]}),Pre=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"}]}),GEe=oe(1/Math.PI),qEe=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 GEe.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"}]}),Wz=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=sx({f0:e,f90:t,dotVH:A}),w,S;if(J_(o)&&(y=tI.mix(y,r)),J_(a)){let T=Vw.dot(i),R=Vw.dot(er),P=Vw.dot(c),I=Bg.dot(i),F=Bg.dot(er),D=Bg.dot(c);w=VEe({alphaT:qR,alphaB:l,dotTV:R,dotBV:F,dotTL:T,dotBL:I,dotNV:f,dotNL:u}),S=qEe({alphaT:qR,alphaB:l,dotNH:d,dotTH:P,dotBH:D})}else w=Ire({alpha:l,dotNL:u,dotNV:f}),S=Pre({alpha:l,dotNH:d});return y.mul(w).mul(S)}),HEe=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]),af=null,tS=me(({roughness:i,dotNV:e})=>{af===null&&(af=new NA(HEe,16,16,Ws,Wi),af.name="DFG_LUT",af.minFilter=Mi,af.magFilter=Mi,af.wrapS=oa,af.wrapT=oa,af.generateMipmaps=!1,af.needsUpdate=!0);let t=dt(i,e);return fi(af,t).rg}),WEe=me(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o})=>{let a=Wz({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=tS({roughness:n,dotNV:c}),f=tS({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(rI)),I=S.mul(T),F=P.mul(I);return a.add(F)}),Lre=me(i=>{let{dotNV:e,specularColor:t,specularF90:n,roughness:r}=i,s=tS({dotNV:e,roughness:r});return t.mul(s.x).add(n.mul(s.y))}),t7=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"}]}),jEe=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"}]}),XEe=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"}]}),$Ee=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=jEe({roughness:nm,dotNH:r}),o=XEe({dotNV:n,dotNL:t});return rc.mul(s).mul(o)}),_ee=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"}]}),YEe=me(({f:i})=>{let e=i.length();return kr(e.mul(e).add(i.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),nR=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,kr(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"}]}),vO=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(So(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(nR({v1:w,v2:S})),P.addAssign(nR({v1:S,v2:T})),P.addAssign(nR({v1:T,v2:R})),P.addAssign(nR({v1:R,v2:w})),f.assign(pe(YEe({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 gI=1/6,Dre=i=>Tn(gI,Tn(i,Tn(i,i.negate().add(3)).sub(3)).add(1)),n7=i=>Tn(gI,Tn(i,Tn(i,Tn(3,i).sub(6))).add(4)),Nre=i=>Tn(gI,Tn(i,Tn(i,Tn(-3,i).add(3)).add(3)).add(1)),i7=i=>Tn(gI,$c(i,3)),xee=i=>Dre(i).add(n7(i)),yee=i=>Nre(i).add(i7(i)),bee=i=>Is(-1,n7(i).div(Dre(i).add(n7(i)))),wee=i=>Is(1,i7(i).div(Nre(i).add(i7(i)))),See=(i,e,t)=>{let n=i.uvNode,r=Tn(n,e.zw).add(.5),s=Af(r),o=Hu(r),a=xee(o.x),l=yee(o.x),c=bee(o.x),u=wee(o.x),f=bee(o.y),d=wee(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=xee(o.y).mul(Is(a.mul(i.sample(A).level(t)),l.mul(i.sample(y).level(t)))),R=yee(o.y).mul(Is(a.mul(i.sample(w).level(t)),l.mul(i.sample(S).level(t))));return T.add(R)},jz=me(([i,e])=>{let t=dt(i.size(de(e))),n=dt(i.size(de(e.add(1)))),r=cc(1,t),s=cc(1,n),o=See(i,Ft(r,t),Af(e)),a=See(i,Ft(s,n),oI(e));return Hu(e).mix(o,a)}),ZEe=me(([i,e])=>{let t=e.mul(_z(i));return jz(i,t)}),Tee=me(([i,e,t,n,r])=>{let s=pe(lz(e.negate(),_a(i),cc(1,n))),o=pe(gf(r[0].xyz),gf(r[1].xyz),gf(r[2].xyz));return _a(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"}]}),KEe=me(([i,e])=>i.mul(Wu(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),QEe=kz(),JEe=yre(),Eee=me(([i,e,t],{material:n})=>{let s=(n.side===mi?QEe:JEe).sample(i),o=mf(Wg.x).mul(KEe(e,t));return jz(s,o)}),Mee=me(([i,e,t])=>($t(t.notEqual(0),()=>{let n=sI(e).negate().div(t);return Y9(n.negate().mul(i))}),pe(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),e3e=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=Tee(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=Eee(G,t,C);w.element(L).assign(W.element(L)),w.a.addAssign(W.a),S.element(L).assign(n.element(L).mul(Mee(gf(B),d,A).element(L)))}),w.a.divAssign(3)}else{let F=Tee(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=Eee(C,t,u),S=n.mul(Mee(gf(F),d,A))}let T=S.rgb.mul(w.rgb),R=i.dot(e).clamp(),P=pe(Lre({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())}),t3e=So(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),n3e=i=>{let e=i.sqrt();return pe(1).add(e).div(pe(1).sub(e))},Cee=(i,e)=>i.sub(e).div(i.add(e)).pow2(),i3e=(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),t3e.mul(a)},Ree=me(({outsideIOR:i,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:r})=>{let s=Kn(i,e,uc(0,.03,n)),a=i.div(s).pow2().mul(t.pow2().oneMinus()).oneMinus();$t(a.lessThan(0),()=>pe(1));let l=a.sqrt(),c=Cee(s,i),u=sx({f0:c,f90:1,dotVH:t}),f=u.oneMinus(),d=s.lessThan(i).select(Math.PI,0),A=oe(Math.PI).sub(d),y=n3e(r.clamp(0,.9999)),w=Cee(y,s.toVec3()),S=sx({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=i3e(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"}]}),yw=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()}),bw=pe(.04),iR=oe(1),a4=class extends rx{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=Ree({outsideIOR:oe(1),eta2:VR,cosTheta1:t,thinFilmThickness:GR,baseF0:fm}),r=Ree({outsideIOR:oe(1),eta2:VR,cosTheta1:t,thinFilmThickness:GR,baseF0:Bi.rgb});this.iridescenceFresnel=Kn(n,r,Hd),this.iridescenceF0Dielectric=t7({f:n,f90:1,dotVH:t}),this.iridescenceF0Metallic=t7({f:r,f90:1,dotVH:t}),this.iridescenceF0=Kn(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,Hd)}if(this.transmission===!0){let t=vf,n=uie.sub(vf).normalize(),r=_m,s=e.context;s.backdrop=e3e(r,n,df,Rg,Pg,Lg,t,Yc,vm,Ka,Gw,H9,j9,W9,this.dispersion?X9:null),s.backdropAlpha=WR,Bi.a.mulAssign(Kn(1,s.backdrop.a,WR))}super.start(e)}computeMultiscattering(e,t,n,r,s=null){let o=hi.dot(er).clamp(),a=tS({roughness:df,dotNV:o}),l=s?tI.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($Ee({lightDirection:e})));let o=yw({normal:hi,viewDir:er,roughness:nm}),a=yw({normal:hi,viewDir:e,roughness:nm}),l=rc.r.max(rc.g).max(rc.b).mul(o.max(a)).oneMinus();s.mulAssign(l)}if(this.clearcoat===!0){let a=sm.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(a.mul(Wz({lightDirection:e,f0:bw,f90:iR,roughness:X_,normalView:sm})))}n.directDiffuse.addAssign(s.mul(Xg({diffuseColor:Rg}))),n.directSpecular.addAssign(s.mul(WEe({lightDirection:e,f0:Pg,f90:1,roughness:df,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=_s.toVar(),w=_ee({N:d,V:A,roughness:df}),S=o.sample(w).toVar(),T=a.sample(w).toVar(),R=So(pe(S.x,0,S.y),pe(0,1,0),pe(S.z,0,S.w)).toVar(),P=Pg.mul(T.x).add(Lg.sub(Pg).mul(T.y)).toVar();if(s.directSpecular.addAssign(e.mul(P).mul(vO({N:d,V:A,P:y,mInv:R,p0:l,p1:c,p2:u,p3:f}))),s.directDiffuse.addAssign(e.mul(Rg).mul(vO({N:d,V:A,P:y,mInv:So(1,0,0,0,1,0,0,0,1),p0:l,p1:c,p2:u,p3:f}))),this.clearcoat===!0){let I=sm,F=_ee({N:I,V:A,roughness:X_}),D=o.sample(F),L=a.sample(F),C=So(pe(D.x,0,D.y),pe(0,1,0),pe(D.z,0,D.w)),B=bw.mul(L.x).add(iR.sub(bw).mul(L.y));this.clearcoatSpecularDirect.addAssign(e.mul(B).mul(vO({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(Xg({diffuseColor:Rg})).toVar();if(this.sheen===!0){let s=yw({normal:hi,viewDir:er,roughness:nm}),o=rc.r.max(rc.g).max(rc.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(rc,yw({normal:hi,viewDir:er,roughness:nm}))),this.clearcoat===!0){let S=sm.dot(er).clamp(),T=Lre({dotNV:S,specularColor:bw,specularF90:iR,roughness:X_});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,Lg,fm,this.iridescenceF0Dielectric),this.computeMultiscattering(a,l,Lg,Bi.rgb,this.iridescenceF0Metallic);let c=Kn(s,a,Hd),u=Kn(o,l,Hd),f=s.add(o),d=Rg.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=yw({normal:hi,viewDir:er,roughness:nm}),T=rc.r.max(rc.g).max(rc.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=df.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=sm.dot(er).clamp(),r=sx({dotVH:n,f0:bw,f90:iR}),s=t.mul(zR.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(zR));t.assign(s)}if(this.sheen===!0){let n=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(n)}}},Iee=oe(1),r7=oe(-2),rR=oe(.8),_O=oe(-1),sR=oe(.4),xO=oe(2),oR=oe(.305),yO=oe(3),Pee=oe(.21),r3e=oe(4),Lee=oe(4),s3e=oe(16),o3e=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(va(i.x.greaterThan(0),0,3))}).Else(()=>{t.assign(va(i.y.greaterThan(0),1,4))})}).Else(()=>{$t(e.z.greaterThan(e.y),()=>{t.assign(va(i.z.greaterThan(0),2,5))}).Else(()=>{t.assign(va(i.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),a3e=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"}]}),l3e=me(([i])=>{let e=oe(0).toVar();return $t(i.greaterThanEqual(rR),()=>{e.assign(Iee.sub(i).mul(_O.sub(r7)).div(Iee.sub(rR)).add(r7))}).ElseIf(i.greaterThanEqual(sR),()=>{e.assign(rR.sub(i).mul(xO.sub(_O)).div(rR.sub(sR)).add(_O))}).ElseIf(i.greaterThanEqual(oR),()=>{e.assign(sR.sub(i).mul(yO.sub(xO)).div(sR.sub(oR)).add(xO))}).ElseIf(i.greaterThanEqual(Pee),()=>{e.assign(oR.sub(i).mul(r3e.sub(yO)).div(oR.sub(Pee)).add(yO))}).Else(()=>{e.assign(oe(-2).mul(mf(Tn(1.16,i))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),Fre=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"}]}),Bre=me(([i,e,t,n,r,s])=>{let o=oe(t),a=pe(e),l=Wu(l3e(o),r7,s),c=Hu(l),u=Af(l),f=pe(nS(i,a,u,n,r,s)).toVar();return $t(c.notEqual(0),()=>{let d=pe(nS(i,a,u.add(1),n,r,s)).toVar();f.assign(Kn(f,d,c))}),f}),nS=me(([i,e,t,n,r,s])=>{let o=oe(t).toVar(),a=pe(e),l=oe(o3e(a)).toVar(),c=oe(kr(Lee.sub(o),0)).toVar();o.assign(kr(o,Lee));let u=oe(ex(o)).toVar(),f=dt(a3e(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,s3e))),f.y.addAssign(Tn(4,ex(s).sub(u))),f.x.mulAssign(n),f.y.mulAssign(r),i.sample(f).grad(dt(),dt())}),bO=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=zu(n),c=t.mul(l).add(r.cross(t).mul(Ya(n))).add(r.mul(r.dot(t).mul(l.oneMinus())));return nS(i,c,e,s,o,a)}),Ore=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(va(e,t,jd(t,n))).toVar();$t(d.equal(pe(0)),()=>{d.assign(pe(n.z,0,n.x.negate()))}),d.assign(_a(d));let A=pe().toVar();return A.addAssign(r.element(0).mul(bO({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),()=>{vre()});let w=oe(o.mul(oe(y))).toVar();A.addAssign(r.element(y).mul(bO({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(bO({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)}),c3e=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)}),u3e=me(([i,e])=>dt(oe(i).div(oe(e)),c3e(i))),h3e=me(([i,e,t])=>{let n=t.mul(t).toConst(),r=pe(1,0,0).toConst(),s=jd(e,r).toConst(),o=Qa(i.x).toConst(),a=Tn(2,3.14159265359).mul(i.y).toConst(),l=o.mul(zu(a)).toConst(),c=o.mul(Ya(a)).toVar(),u=Tn(.5,e.z.add(1)).toConst();c.assign(u.oneMinus().mul(Qa(l.mul(l).oneMinus())).add(u.mul(c)));let f=r.mul(l).add(s.mul(c)).add(e.mul(Qa(kr(0,l.mul(l).add(c.mul(c)).oneMinus()))));return _a(pe(n.mul(f.x),n.mul(f.y),kr(0,f.z)))}),Ure=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(nS(t,l,e,s,o,a))}).Else(()=>{let f=va(fr(l.z).lessThan(.999),pe(0,0,1),pe(1,0,0)),d=_a(jd(f,l)).toVar(),A=jd(l,d).toVar();Oi({start:rt(0),end:r},({i:y})=>{let w=u3e(y,r),S=h3e(w,pe(0,0,1),i),T=_a(d.mul(S.x).add(A.mul(S.y)).add(l.mul(S.z))),R=_a(T.mul(Qc(l,T).mul(2)).sub(l)),P=kr(Qc(l,R),0);$t(P.greaterThan(0),()=>{let I=nS(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)}),lm=4,Dee=[.125,.215,.35,.446,.526,.582],Ig=20,f3e=512,ww=new Ru(-1,1,1,-1,0,1),d3e=new Xr(90,1),Nee=new zt,wO=null,SO=0,TO=0,p3e=new re,l4=new WeakMap,m3e=[3,1,5,0,4,2],EO=Fre(Ui(),ac("faceIndex")).normalize(),vI=pe(EO.x,EO.y,EO.z),s7=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=p3e,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.');wO=this._renderer.getRenderTarget(),SO=this._renderer.getActiveCubeFace(),TO=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=Bee(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Oee(),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===Yl||e.mapping===Bc?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(wO,SO,TO),e.scissorTest=!1,this._setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),wO=this._renderer.getRenderTarget(),SO=this._renderer.getActiveCubeFace(),TO=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 Fee(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=Fee(e.width,e.height);let{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=A3e(t)),this._blurMaterial=g3e(t,e.width,e.height),this._ggxMaterial=v3e(t,e.width,e.height)}}async _compileMaterial(e){let t=new Hn(new Xn,e);await this._renderer.compile(t,ww)}_sceneToCubeUV(e,t,n,r,s){let o=d3e;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(Nee),c.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new Hn(new Cu,new hs({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(Nee),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===Yl||e.mapping===Bc;r?this._cubemapMaterial===null&&(this._cubemapMaterial=Bee(e)):this._equirectMaterial===null&&(this._equirectMaterial=Oee(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,ww)}_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=l4.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-lm?n-y+lm: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,ww),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,ww)}_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=l4.get(c),A=this._sizeLods[n]-1,y=isFinite(s)?Math.PI/(2*A):2*Math.PI/(2*Ig-1),w=s/y,S=isFinite(s)?1+Math.floor(u*w):Ig;S>Ig&&Xe(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${Ig}`);let T=[],R=0;for(let L=0;L<Ig;++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-lm?r-P+lm:0),D=4*(this._cubeSize-I);this._setViewport(t,F,D,3*I,2*I),l.setRenderTarget(t),l.render(f,ww)}_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 A3e(i){let e=[],t=[],n=[],r=i,s=i-lm+1+Dee.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-lm?l=Dee[o-i+lm-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=m3e[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>lm&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function Fee(i,e,t){let n={magFilter:Mi,minFilter:Mi,generateMipmaps:!1,type:Wi,format:Br,colorSpace:Zp,depthBuffer:t},r=new Na(i,e,n);return r.texture.mapping=Fh,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function _I(i){let e=new Rr;return e.depthTest=!1,e.depthWrite=!1,e.blending=ds,e.name=`PMREM_${i}`,e}function g3e(i,e,t){let n=Ho(new Array(Ig).fill(0)),r=Xt(new re(0,1,0)),s=Xt(0),o=oe(Ig),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:vI,dTheta:s,samples:l,envMap:c,mipInt:u,CUBEUV_TEXEL_WIDTH:f,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:A},w=_I("blur");return w.fragmentNode=Ore({...y,latitudinal:a.equal(1)}),l4.set(w,y),w}function v3e(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=_I("ggx");return u.fragmentNode=Ure({...c,N_immutable:vI,GGX_SAMPLES:rt(f3e)}),l4.set(u,c),u}function Bee(i){let e=_I("cubemap");return e.fragmentNode=Za(i,vI),e}function Oee(i){let e=_I("equirect");return e.fragmentNode=fi(i,qz(vI),0),e}var Uee=new WeakMap;function _3e(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 x3e(i,e,t){let n=y3e(e),r=n.get(i);if((r!==void 0?r.pmremVersion:-1)!==i.pmremVersion){let o=i.image;if(i.isCubeTexture)if(b3e(o))r=t.fromCubemap(i,r);else return null;else if(w3e(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 y3e(i){let e=Uee.get(i);return e===void 0&&(e=new WeakMap,Uee.set(i,e)),e}var o7=class extends Cr{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=_3e(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===Fh?t=r:t=x3e(r,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new s7(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=this._pmrem.isRenderTargetTexture?JR.mul(pe(t.x,t.y.negate(),t.z)):JR.mul(t);let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),Bre(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}};function b3e(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 w3e(i){return i==null?!1:i.height>0}var Xz=$n(o7).setParameterLength(1,3),kee=new WeakMap,a7=class extends pm{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=Xz(f),d.set(f,A)),n=A}let s=t.useAnisotropy===!0||t.anisotropy>0?Nie:hi,o=n.context(zee(df,s)).mul(DR),a=n.context(S3e(_m)).mul(Math.PI).mul(DR),l=Z_(o),c=Z_(a);e.context.radiance.addAssign(l),e.context.iblIrradiance.addAssign(c);let u=e.context.lightingModel.clearcoatRadiance;if(u){let f=n.context(zee(X_,sm)).mul(DR),d=Z_(f);u.addAssign(d)}}_getPMREMNodeCache(e){let t=kee.get(e);return t===void 0&&(t=new WeakMap,kee.set(e,t)),t}},zee=(i,e)=>{let t=null;return{getUV:()=>(t===null&&(t=er.negate().reflect(e),t=oz(i).mix(t,e).normalize(),t=t.transformDirection(AS)),t),getTextureLevel:()=>i}},S3e=i=>({getUV:()=>i,getTextureLevel:()=>oe(1)}),T3e=new Xv,c4=class extends Rr{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(T3e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new a7(t):null}setupLightingModel(){return new a4}setupSpecular(){let e=Kn(pe(.04),Bi.rgb,Hd);fm.assign(pe(.04)),Pg.assign(e),Lg.assign(1)}setupVariants(){let e=this.metalnessNode?oe(this.metalnessNode):qie;Hd.assign(e);let t=this.roughnessNode?oe(this.roughnessNode):Gie;t=Hz({roughness:t}),df.assign(t),this.setupSpecular(),Rg.assign(Bi.rgb.mul(e.oneMinus()))}},E3e=new D2,l7=class extends c4{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(E3e),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):ire;Gw.assign(e),fm.assign(Ml(sz(Gw.sub(1).div(Gw.add(1))).mul(Vie),pe(1)).mul(NU)),Pg.assign(Kn(fm,Bi.rgb,Hd)),Lg.assign(Kn(NU,1,Hd))}setupLightingModel(){return new a4(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):Wie,n=this.clearcoatRoughnessNode?oe(this.clearcoatRoughnessNode):jie;zR.assign(t),X_.assign(Hz({roughness:n}))}if(this.useSheen){let t=this.sheenNode?pe(this.sheenNode):Yie,n=this.sheenRoughnessNode?oe(this.sheenRoughnessNode):Zie;rc.assign(t),nm.assign(n)}if(this.useIridescence){let t=this.iridescenceNode?oe(this.iridescenceNode):Qie,n=this.iridescenceIORNode?oe(this.iridescenceIORNode):Jie,r=this.iridescenceThicknessNode?oe(this.iridescenceThicknessNode):ere;tI.assign(t),VR.assign(n),GR.assign(r)}if(this.useAnisotropy){let t=(this.anisotropyNode?dt(this.anisotropyNode):Kie).toVar();tm.assign(t.length()),$t(tm.equal(0),()=>{t.assign(dt(1,0))}).Else(()=>{t.divAssign(dt(tm)),tm.assign(tm.saturate())}),qR.assign(tm.pow2().mix(df.pow2(),1)),Vw.assign(Dg[0].mul(t.x).add(Dg[1].mul(t.y))),Bg.assign(Dg[1].mul(t.x).sub(Dg[0].mul(t.y)))}if(this.useTransmission){let t=this.transmissionNode?oe(this.transmissionNode):tre,n=this.thicknessNode?oe(this.thicknessNode):nre,r=this.attenuationDistanceNode?oe(this.attenuationDistanceNode):rre,s=this.attenuationColorNode?pe(this.attenuationColorNode):sre;if(WR.assign(t),H9.assign(n),W9.assign(r),j9.assign(s),this.useDispersion){let o=this.dispersionNode?oe(this.dispersionNode):are;X9.assign(o)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?pe(this.clearcoatNormalNode):Xie}setup(e){e.context.setupClearcoatNormal=()=>Ug(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}};var M3e=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=Gd("gradientMap","texture").context({getUV:()=>r});return pe(s.r)}else{let s=r.fwidth().mul(.5);return Kn(pe(.7),pe(1),uc(oe(.7).sub(s.x),oe(.7).add(s.x),r.x))}}),c7=class extends rx{direct({lightDirection:e,lightColor:t,reflectedLight:n},r){let s=M3e({normal:hI,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(s.mul(Xg({diffuseColor:Bi.rgb})))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(Xg({diffuseColor:Bi}))),r.indirectDiffuse.mulAssign(t)}},C3e=new N2,u7=class extends Rr{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(C3e),this.setValues(e)}setupLightingModel(){return new c7}},kre=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"),R3e=new B2,h7=class extends Rr{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(R3e),this.setValues(e)}setupVariants(e){let t=kre,n;e.material.matcap?n=Gd("matcap","texture").context({getUV:()=>t}):n=pe(Kn(.2,.8,t.y)),Bi.rgb.mulAssign(n.rgb)}},f7=class extends Cr{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 eI(s,o,o.negate(),s).mul(n)}else{let s=t,o=cm(Ft(1,0,0,0),Ft(0,zu(s.x),Ya(s.x).negate(),0),Ft(0,Ya(s.x),zu(s.x),0),Ft(0,0,0,1)),a=cm(Ft(zu(s.y),0,Ya(s.y),0),Ft(0,1,0,0),Ft(Ya(s.y).negate(),0,zu(s.y),0),Ft(0,0,0,1)),l=cm(Ft(zu(s.z),Ya(s.z).negate(),0,0),Ft(Ya(s.z),zu(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}}},vS=$n(f7).setParameterLength(2),I3e=new Ch,u4=class extends Rr{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(I3e),this.setValues(e)}setupPositionView(e){let{object:t,camera:n}=e,{positionNode:r,rotationNode:s,scaleNode:o,sizeAttenuation:a}=this,l=yf.mul(pe(r||0)),c=dt(Yc[0].xyz.length(),Yc[1].xyz.length());o!==null&&(c=c.mul(dt(o))),n.isPerspectiveCamera&&a===!1&&(c=c.mul(l.z.negate()));let u=Aa.xy;if(t.center&&t.center.isVector2===!0){let A=vTe("center","vec2",t);u=u.sub(A.sub(.5))}u=u.mul(c);let f=oe(s||$ie),d=vS(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)}},P3e=new n0,L3e=new Oe,d7=class extends u4{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(P3e),this.setValues(e)}setupPositionView(){let{positionNode:e}=this;return yf.mul(pe(e||Er)).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(D3e.div(_s.z.negate()))),s&&s.isNode&&(c=c.mul(dt(s)));let u=Aa.xy;if(r&&r.isNode){let f=oe(r);u=vS(u,f)}return u=u.mul(c),u=u.div(bz.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)}},D3e=Xt(1).onFrameUpdate(function({renderer:i}){let e=i.getSize(L3e);this.value=.5*e.y}),p7=class extends rx{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)}},N3e=new L2,m7=class extends Rr{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(N3e),this.setValues(e)}setupLightingModel(){return new p7}},Zot=$d("vec3"),Kot=$d("vec3"),Qot=$d("vec3");var A7=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()}},wf=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])}},F3e=0,Vee=new WeakMap;function B3e(i){let e=Object.keys(i),t=Vee.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)}Vee.set(i.constructor,t)}for(let n=0;n<t.length;n++)e.push(t[n]);return e}var g7=class{constructor(e,t,n,r,s,o,a,l,c,u){this.id=F3e++,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 B3e(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+",",cx(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=kw(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=kw(e,1)),e=kw(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()}},lf=[],v7=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);lf[0]=e,lf[1]=t,lf[2]=o,lf[3]=s;let u=c.get(lf);return u===void 0?(u=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,s,o,a,l),c.set(lf,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)),lf[0]=null,lf[1]=null,lf[2]=null,lf[3]=null,u}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new wf)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,s,o,a,l,c,u,f){let d=this.getChainMap(f),A=new g7(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}},Sf=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}},Zc={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},om=16,O3e=211,U3e=212,_7=class extends Sf{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===Zc.VERTEX?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===Zc.INDEX?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===Zc.STORAGE?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===Zc.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===tg)&&(this.backend.updateAttribute(e),n.version=r.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}};function zre(i){return i.index!==null?i.index.version:i.attributes.position.version}function Vre(i){return i.index!==null?i.index.id:i.attributes.position.id}function Gee(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?LA:PA)(e,1);return r.version=zre(i),r.__id=Vre(i),r}var x7=class extends Sf{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,Zc.STORAGE):this.updateAttribute(s,Zc.VERTEX);let n=this.getIndex(e);n!==null&&this.updateAttribute(n,Zc.INDEX);let r=e.geometry.indirect;r!==null&&this.updateAttribute(r,Zc.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=Gee(t),s.set(t,o)):(o.version!==zre(t)||o.__id!==Vre(t))&&(this.attributes.delete(o),o=Gee(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===Bh||e.type===Ji?t=1:e.type===Oh||e.type===xl||e.type===Wi?t=2:(e.type===Yr||e.type===xi||e.type===cr)&&(t=4);let n=4;e.format===Qv||e.format===Id||e.format===Uh||e.format===Vs||e.format===_o?n=1:e.format===Ws||e.format===kh?n=2:(e.format===Rd||e.format===pb)&&(n=3);let r=t*n;e.type===jA||e.type===XA?r=2:(e.type===la||e.type===$A||e.type===YA)&&(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}},h4=class{constructor(e){this.cacheKey=e,this.usedTimes=0}},b7=class extends h4{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}},w7=class extends h4{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}},k3e=0,Ww=class{constructor(e,t,n,r=null,s=null){this.id=k3e++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=s,this.usedTimes=0}},S7=class extends Sf{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 Ww(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 Ww(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 Ww(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 w7(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 b7(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)}},T7=class extends Sf{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?Zc.INDIRECT:Zc.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?Zc.INDIRECT:Zc.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)}},z3e=Object.freeze([]);function V3e(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 qee(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 Hee(i){return(i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode)&&i.side===gr&&i.forceSinglePass===!1}var E7=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?(Hee(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?(Hee(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||V3e),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||qee),this.transparent.length>1&&this.transparent.sort(t||qee),n&&(this.opaque.reverse(),this.transparentDoublePass.reverse(),this.transparent.reverse())}finish(){this.lightsNode.setLights(this.lighting.enabled?this.lightsArray:z3e);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}},R_=[],M7=class{constructor(e){this.lighting=e,this.lists=new wf}get(e,t){let n=this.lists;R_[0]=e,R_[1]=t;let r=n.get(R_);return r===void 0&&(r=new E7(this.lighting,e,t),n.set(R_,r)),R_[0]=null,R_[1]=null,r}dispose(){this.lists=new wf}},G3e=0,C7=class{constructor(){this.id=G3e++,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 Gre(this)}};function Gre(i){let{textures:e,activeCubeFace:t,activeMipmapLevel:n}=i,r=[t,n];for(let s of e)r.push(s.id);return mS(r)}var R7=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 C7,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={}}},q3e=new re,I7=class extends Sf{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?_o:Vs,u.type=e.stencilBuffer?la: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=q3e){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)}}},iS=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)}},f4=class extends Kw{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 qre(i,e=null,t=null){if(e&&e.isNode){let n=e;e=()=>n}return new f4(new Map([[i,e]]),t)}Ue("overrideNode",(i,e,t)=>qre(e,t,i));function Hre(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 f4(t,e)}Ue("overrideNodes",(i,e)=>Hre(e,i));var d4=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 Jr),s="float"),s}getHash(){return String(this.id)}generate(){return this.name}},H3e=(i,e)=>new d4(i,e),P7=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 Jr),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 W_(t);return this._currentCond=va(e,n),this.addToStack(this._currentCond)}ElseIf(e,t){let n=new W_(t),r=va(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new W_(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 Jr);let n=e[e.length-1],r=new W_(n),s=t[0];for(let a=1;a<t.length;a++)s=s.or(t[a]);let o=va(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=U9(),r=e.buildStage;Yw(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 Yw(n),e.removeActiveStack(this),s}},BR=$n(P7).setParameterLength(0,1);function W3e(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 L7=class extends Kt{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=W3e(e),this.name=t,this.isStructTypeNode=!0}getLength(){let e=1,t=0;for(let n of this.membersLayout){let r=n.type,s=USe(r),o=kSe(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)}},D7=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}},j3e=(i,e=null)=>{let t=new L7(i,e);return O9((...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 D7(t,s)},t)},p4=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}},X3e=$n(p4),m4=class{constructor(e=Ts){this.blending=e,this.blendSrc=$p,this.blendDst=Yp,this.blendEquation=so,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)}},$3e=new m4(ds),Y3e=new m4(Y2);function Wre(i,e){for(let t=0;t<i.length;t++)if(i[t].name===e)return t;return-1}var N7=class extends p4{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.blendModes={output:Y3e},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||$3e}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=jre(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=Wre(s,o);if(a===-1)continue;let l=e.getOutputType(a);r[a]=t[o].convert(l)}return this.members=r,super.setup(e)}},jre=$n(N7),$g=class extends Cr{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)} )`}},Xre=ct($g).setParameterLength(2),Z3e=i=>new $g(i,"int","float"),$re=i=>new $g(i,"uint","float"),K3e=i=>new $g(i,"float","int"),Q3e=i=>new $g(i,"float","uint"),aR={},Xu=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(Xre(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return rt;case"int":return de;case"uvec2":return k9;case"uvec3":return Qg;case"uvec4":return q9;case"ivec2":return Ur;case"ivec3":return z9;case"ivec4":return G9}}_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(ez(o))),c=$re(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=aR[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}}aR[l]=u}let f=aR[c];return f===void 0&&(f=this._createMainLayout(c,s,a,u),aR[c]=f),me(()=>f(n))()}};Xu.COUNT_TRAILING_ZEROS="countTrailingZeros";Xu.COUNT_LEADING_ZEROS="countLeadingZeros";Xu.COUNT_ONE_BITS="countOneBits";var J3e=ct(Xu,Xu.COUNT_TRAILING_ZEROS).setParameterLength(1),eMe=ct(Xu,Xu.COUNT_LEADING_ZEROS).setParameterLength(1),tMe=ct(Xu,Xu.COUNT_ONE_BITS).setParameterLength(1),nMe=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)}),F7=(i,e)=>$c(Tn(4,i.mul(ai(1,i))),e),iMe=(i,e)=>i.lessThan(.5)?F7(i.mul(2),e).div(2):ai(1,F7(Tn(ai(1,i),2),e).div(2)),rMe=(i,e,t)=>$c(cc($c(i,e),Is($c(i,e),$c(ai(1,i),t))),1/e),sMe=(i,e)=>Ya($R.mul(e.mul(i).sub(1))).div($R.mul(e.mul(i).sub(1))),rS=class extends Cr{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)})`}},oMe=ct(rS,"snorm").setParameterLength(1),aMe=ct(rS,"unorm").setParameterLength(1),lMe=ct(rS,"float16").setParameterLength(1),sS=class extends Cr{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)})`}},cMe=ct(sS,"snorm").setParameterLength(1),uMe=ct(sS,"unorm").setParameterLength(1),hMe=ct(sS,"float16").setParameterLength(1),Vd=me(([i])=>i.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),fMe=me(([i])=>pe(Vd(i.z.add(Vd(i.y.mul(1)))),Vd(i.z.add(Vd(i.x.mul(1)))),Vd(i.y.add(Vd(i.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),dMe=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(fMe(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(Vd(n.z.add(Vd(n.x.add(Vd(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"}]}),B7=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)}},pMe=$n(B7),Xo=i=>(...e)=>pMe(i,...e),fx=Xt(0).setGroup(Jt).onRenderUpdate(i=>i.time),mMe=Xt(0).setGroup(Jt).onRenderUpdate(i=>i.deltaTime),Yre=Xt(0,"uint").setGroup(Jt).onRenderUpdate(i=>i.frameId),AMe=(i=fx)=>i.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),gMe=(i=fx)=>i.fract().round(),vMe=(i=fx)=>i.add(.5).fract().mul(2).sub(1).abs(),_Me=(i=fx)=>i.fract();function xMe(i,e=null){return Yd(e,{getUV:typeof i=="function"?i:()=>i})}var yMe=me(([i,e,t=dt(.5)])=>vS(i.sub(t),e).add(t)),bMe=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))}),wMe=me(({position:i=null,horizontal:e=!0,vertical:t=!1})=>{let n;i!==null?(n=Yc.toVar(),n[3][0]=i.x,n[3][1]=i.y,n[3][2]=i.z):n=Yc;let r=vm.mul(n);return J_(e)&&(r[0][0]=Yc[0].length(),r[0][1]=0,r[0][2]=0),J_(t)&&(r[1][0]=0,r[1][1]=Yc[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,Ka.mul(r).mul(Er)}),SMe=me(([i=null])=>{let e=i4();return i4(zz(i)).sub(e).lessThan(0).select(Gu,i)}),TMe=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)}),Zre=me(([i,e=null,t=null,n=oe(1),r=Er,s=ya])=>{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 Is(A,y,w)}),EMe=(...i)=>Zre(...i),I_=new La,wg=new re,P_=new re,MO=new re,Sw=new cn,lR=new re(0,0,-1),cf=new xn,Tw=new re,cR=new re,Ew=new xn,uR=new Oe,A4=new Na,MMe=Gu.flipX();A4.depthTexture=new Es(1,1);var hR=!1,O7=class i extends Jc{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||A4.texture,MMe),this._reflectorBaseNode=e.reflector||new U7(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:A4.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()}},U7=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(uR),e.setSize(Math.round(uR.width*n),Math.round(uR.height*n))}setup(e){return this._updateResolution(A4,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 Na(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&&hR)return!1;hR=!0;let{scene:t,camera:n,renderer:r,material:s}=e,{target:o}=this,a=this.getVirtualCamera(n),l=this.getRenderTarget(a);r.getDrawingBufferSize(uR),this._updateResolution(l,r),P_.setFromMatrixPosition(o.matrixWorld),MO.setFromMatrixPosition(n.matrixWorld),Sw.extractRotation(o.matrixWorld),wg.set(0,0,1),wg.applyMatrix4(Sw),Tw.subVectors(P_,MO);let c=Tw.dot(wg)>0,u=!1;if(c===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){hR=!1;return}u=!0}Tw.reflect(wg).negate(),Tw.add(P_),Sw.extractRotation(n.matrixWorld),lR.set(0,0,-1),lR.applyMatrix4(Sw),lR.add(MO),cR.subVectors(P_,lR),cR.reflect(wg).negate(),cR.add(P_),a.coordinateSystem=n.coordinateSystem,a.position.copy(Tw),a.up.set(0,1,0),a.up.applyMatrix4(Sw),a.up.reflect(wg),a.lookAt(cR),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),I_.setFromNormalAndCoplanarPoint(wg,P_),I_.applyMatrix4(a.matrixWorldInverse),cf.set(I_.normal.x,I_.normal.y,I_.normal.z,I_.constant);let f=a.projectionMatrix;Ew.x=(Math.sign(cf.x)+f.elements[8])/f.elements[0],Ew.y=(Math.sign(cf.y)+f.elements[9])/f.elements[5],Ew.z=-1,Ew.w=(1+f.elements[10])/f.elements[14],cf.multiplyScalar(1/cf.dot(Ew));let d=0;f.elements[2]=cf.x,f.elements[6]=cf.y,f.elements[10]=r.coordinateSystem===gl?cf.z-d:cf.z+1-d,f.elements[14]=cf.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,hR=!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}},CMe=i=>new O7(i),CO=new Ru(-1,1,1,-1,0,1),k7=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))}},RMe=new k7,oS=class extends Hn{constructor(e=null){super(RMe,e),this.camera=CO,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,CO)}render(e){e.render(this,CO)}},IMe=new Oe,z7=class extends Jc{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:Wi}){let s=new Na(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 oS(new Rr),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(IMe),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 Jc(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}},Kre=(i,...e)=>new z7(Ht(i),...e),PMe=(i,...e)=>i.isSampleNode||i.isTextureNode?i:i.isPassNode?i.getTextureNode():Kre(i,...e),H_=me(([i,e,t],n)=>{let r;n.renderer.coordinateSystem===gl?(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)}),LMe=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())}),DMe=me(([i,e,t])=>{let n=Hg(vs(e)),r=Ur(i.mul(n)).toVar(),s=vs(e,r).toVar(),o=vs(e,r.sub(Ur(2,0))).toVar(),a=vs(e,r.sub(Ur(1,0))).toVar(),l=vs(e,r.add(Ur(1,0))).toVar(),c=vs(e,r.add(Ur(2,0))).toVar(),u=vs(e,r.add(Ur(0,2))).toVar(),f=vs(e,r.add(Ur(0,1))).toVar(),d=vs(e,r.sub(Ur(0,1))).toVar(),A=vs(e,r.sub(Ur(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=H_(i,s,t).toVar(),P=y.lessThan(w).select(R.sub(H_(i.sub(dt(oe(1).div(n.x),0)),a,t)),R.negate().add(H_(i.add(dt(oe(1).div(n.x),0)),l,t))),I=S.lessThan(T).select(R.sub(H_(i.add(dt(0,oe(1).div(n.y))),f,t)),R.negate().add(H_(i.sub(dt(0,oe(1).div(n.y))),d,t)));return _a(jd(P,I))}),$z=me(([i])=>Hu(oe(52.9829189).mul(Hu(Qc(i,dt(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),Vu=me(([i,e,t])=>{let n=oe(2.399963229728653),r=Qa(oe(i).add(.5).div(oe(e))),s=oe(i).mul(n).add(t);return dt(zu(s),Ya(s)).mul(r)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]}),V7=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)}},NMe=(i,e=null)=>new V7(i,Ht(e)),Yg=class extends Xl{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}},G7=class extends Hi{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}},FMe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=OR("float")):(t=Ete(e),n=OR(e));let r=new G7(i,t,n);return um(r,e,i)},BMe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=OR("float")):(t=Ete(e),n=OR(e));let r=new Yg(i,t,n);return um(r,e,r.count)},q7=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 )"}},OMe=xt(q7),RO=new cn,Qre=Xt(0).setGroup(Jt).onRenderUpdate(({scene:i})=>i.backgroundBlurriness),H7=Xt(1).setGroup(Jt).onRenderUpdate(({scene:i})=>i.backgroundIntensity),Jre=Xt(new cn).setGroup(Jt).onRenderUpdate(({scene:i})=>{let e=i.background;return e!==null&&e.isTexture&&e.mapping!==fb||i.backgroundNode&&i.backgroundNode.isNode?RO.makeRotationFromEuler(i.backgroundRotation).transpose():RO.identity(),RO}),g4=class extends Jc{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=Wo.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(Wo.READ_WRITE)}toReadOnly(){return this.setAccess(Wo.READ_ONLY)}toWriteOnly(){return this.setAccess(Wo.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}},ese=$n(g4).setParameterLength(1,3),UMe=(i,e,t)=>{let n;return i.isStorageTextureNode===!0?n=i.store(e,t):(n=ese(i,e,t),t!==null&&n.toStack()),n},W7=class extends g4{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")}},kMe=$n(W7).setParameterLength(1,3),zMe=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()}),j7=class extends Jc{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 zMe({texture:this,uv:e})}},Yz=$n(j7).setParameterLength(1,3),VMe=(...i)=>Yz(...i).setSampler(!1),GMe=(i,e,t)=>Yz(i,e).level(t),X7=class extends nx{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}},qMe=(i,e,t)=>new X7(i,e,t),Wee=new WeakMap,$7=class extends Cr{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=jee(n);this.previousModelWorldMatrix.value.copy(r);let s=tse(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}){jee(e).copy(e.matrixWorld)}setup(){let e=this.projectionMatrix===null?Ka:Xt(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(yf).mul(Er),r=this.previousProjectionMatrix.mul(t).mul(jg),s=n.xy.div(n.w),o=r.xy.div(r.w);return ai(s,o)}};function tse(i){let e=Wee.get(i);return e===void 0&&(e={},Wee.set(i,e)),e}function jee(i,e=0){let t=tse(i),n=t[e];return n===void 0&&(t[e]=n=new cn,t[e].copy(i.matrixWorld)),n}var HMe=xt($7),WMe=me(([i,e])=>Ml(1,i.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),jMe=me(([i,e])=>Ml(i.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),XMe=me(([i,e])=>i.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),$Me=me(([i,e])=>Kn(i.mul(2).mul(e),i.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),qg(.5,i))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),YMe=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"}]}),ZMe=me(([i])=>Zz(i.rgb)),KMe=me(([i,e=oe(1)])=>e.mix(Zz(i.rgb),i.rgb).max(0)),QMe=me(([i,e=oe(0)])=>{let t=Is(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 Kn(i.rgb,n,r).max(0)}),JMe=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(Qc(t,i.rgb).mul(n.oneMinus()))))).max(0)}),Zz=(i,e=pe(ln.getLuminanceCoefficients(new re)))=>Qc(i,e),eCe=me(([i,e=pe(1),t=pe(0),n=pe(1),r=oe(1),s=pe(ln.getLuminanceCoefficients(new re,Zp))])=>{let o=i.rgb.dot(pe(s)),a=kr(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)}),tCe=me(([i,e])=>i.mul(e).floor().div(e)),fR=null,Y7=class extends ix{static get type(){return"ViewportSharedTextureNode"}constructor(e=Gu,t=null){fR===null&&(fR=new FA),super(e,t,fR)}getTextureForReference(){return fR}updateReference(){return this}},nCe=$n(Y7).setParameterLength(0,2),dR=new Oe,v4=class extends Jc{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)}},_4=class extends v4{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}},Tf=class i extends Cr{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 Na(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 _4(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 _4(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=mI(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=kg(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),dR.set(s.width,s.height)):(r=this.camera,t.getDrawingBufferSize(dR)),this.setSize(dR.width,dR.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:Yd({...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()}};Tf.COLOR="color";Tf.DEPTH="depth";var iCe=(i,e,t)=>new Tf(Tf.COLOR,i,e,t),rCe=(i,e)=>new v4(i,e),sCe=(i,e,t)=>new Tf(Tf.DEPTH,i,e,t),Z7=class extends Tf{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,s){super(Tf.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 Rr;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=mi;let t=ya.negate(),n=Ka.mul(yf),r=oe(1),s=n.mul(Ft(Er,1)),o=n.mul(Ft(Er.add(t),1)),a=_a(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}},oCe=(i,e,t=new zt(0,0,0),n=.003,r=1)=>new Z7(i,e,Ht(t),Ht(n),Ht(r)),nse=me(([i,e])=>i.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),ise=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"}]}),rse=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"}]}),aCe=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)}),sse=me(([i,e])=>{let t=So(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=So(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return i=i.mul(e).div(.6),i=t.mul(i),i=aCe(i),i=n.mul(i),i.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),lCe=So(pe(1.6605,-.1246,-.0182),pe(-.5876,1.1329,-.1006),pe(-.0728,-.0083,1.1187)),cCe=So(pe(.6274,.0691,.0164),pe(.3293,.9195,.088),pe(.0433,.0113,.8956)),uCe=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=So(pe(.856627153315983,.137318972929847,.11189821299995),pe(.0951212405381588,.761241990602591,.0767994186031903),pe(.0482516061458583,.101439036467562,.811302368396859)),r=So(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(cCe.mul(t)),t.assign(n.mul(t)),t.assign(kr(t,1e-10)),t.assign(mf(t)),t.assign(t.sub(s).div(o.sub(s))),t.assign(Wu(t,0,1)),t.assign(uCe(t)),t.assign(r.mul(t)),t.assign($c(kr(pe(0),t),pe(2.2))),t.assign(lCe.mul(t)),t.assign(Wu(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),ase=me(([i,e])=>{let t=oe(.76),n=oe(.15);i=i.mul(e);let r=Ml(i.r,Ml(i.g,i.b)),s=va(r.lessThan(.08),r.sub(Tn(6.25,r.mul(r))),.04);i.subAssign(s);let o=kr(i.r,kr(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,cc(1,n.mul(o.sub(l)).add(1)));return Kn(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}},xI=$n(hr).setParameterLength(1,3),hCe=(i,e)=>xI(i,e,"js"),fCe=(i,e)=>xI(i,e,"wgsl"),dCe=(i,e)=>xI(i,e,"glsl"),x4=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)}},lse=(i,e=[],t="")=>{let n=new x4(i,e,t);return O9((...s)=>n.call(...s),n)},pCe=(i,e)=>lse(i,e,"glsl"),mCe=(i,e)=>lse(i,e,"wgsl");function Kz(i){let e,t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||_s.z).negate()}var cse=me(([i,e],t)=>{let n=Kz(t);return uc(i,e,n)}),use=me(([i],e)=>{let t=Kz(e);return i.mul(i,t,t).negate().exp().oneMinus()}),ACe=me(([i,e],t)=>{let n=Kz(t),s=e.sub(vf.y).max(0).toConst().mul(n).toConst();return i.mul(i,s,s).negate().exp().oneMinus()}),K7=me(([i,e])=>Ft(e.toFloat().mix($_.rgb,i.toVec3()),$_.a)),Sg=null,Tg=null,Q7=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(am(t.value)),s=e.getTypeLength(am(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 QR('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(am(o)),c=e.getTypeLength(am(a));Sg=Sg||new xn,Tg=Tg||new xn,Sg.setScalar(0),Tg.setScalar(0),l===1?Sg.setScalar(o):o.isColor?Sg.set(o.r,o.g,o.b,1):Sg.set(o.x,o.y,o.z||0,o.w||0),c===1?Tg.setScalar(a):a.isColor?Tg.set(a.r,a.g,a.b,1):Tg.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=Sg.getComponent(S),R=Tg.getComponent(S);d[w]=Lu.lerp(T,R,Math.random())}let A=this.getNodeType(e);if(t.count*4*4<=e.getUniformBufferLimit())n=ux(d,"vec4",t.count).element(qu).convert(A);else{let w=new Xl(d,4);e.geometry.setAttribute("__range"+this.id,w),n=uI(w).convert(A)}}else n=oe(0);return n}},gCe=$n(Q7).setParameterLength(2),J7=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}},_S=(i,e)=>new J7(i,e),vCe=_S("numWorkgroups","uvec3"),_Ce=_S("workgroupId","uvec3"),xCe=_S("globalId","uvec3"),yCe=_S("localId","uvec3"),bCe=_S("subgroupSize","uint"),ek=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)}},Qz=$n(ek),wCe=()=>Qz("workgroup").toStack(),SCe=()=>Qz("storage").toStack(),TCe=()=>Qz("texture").toStack(),tk=class extends Wd{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}},nk=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 Jr),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new tk(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)}},ECe=(i,e)=>new nk("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=oc(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 MCe=$n(Ls),Mf=(i,e,t)=>MCe(i,e,t).toStack(),CCe=i=>Mf(Ls.ATOMIC_LOAD,i,null),RCe=(i,e)=>Mf(Ls.ATOMIC_STORE,i,e),ICe=(i,e)=>Mf(Ls.ATOMIC_ADD,i,e),PCe=(i,e)=>Mf(Ls.ATOMIC_SUB,i,e),LCe=(i,e)=>Mf(Ls.ATOMIC_MAX,i,e),DCe=(i,e)=>Mf(Ls.ATOMIC_MIN,i,e),NCe=(i,e)=>Mf(Ls.ATOMIC_AND,i,e),FCe=(i,e)=>Mf(Ls.ATOMIC_OR,i,e),BCe=(i,e)=>Mf(Ls.ATOMIC_XOR,i,e),Ot=class i extends Cr{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 OCe=ct(Ot,Ot.SUBGROUP_ELECT).setParameterLength(0),UCe=ct(Ot,Ot.SUBGROUP_BALLOT).setParameterLength(1),kCe=ct(Ot,Ot.SUBGROUP_ADD).setParameterLength(1),zCe=ct(Ot,Ot.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),VCe=ct(Ot,Ot.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),GCe=ct(Ot,Ot.SUBGROUP_MUL).setParameterLength(1),qCe=ct(Ot,Ot.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),HCe=ct(Ot,Ot.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),WCe=ct(Ot,Ot.SUBGROUP_AND).setParameterLength(1),jCe=ct(Ot,Ot.SUBGROUP_OR).setParameterLength(1),XCe=ct(Ot,Ot.SUBGROUP_XOR).setParameterLength(1),$Ce=ct(Ot,Ot.SUBGROUP_MIN).setParameterLength(1),YCe=ct(Ot,Ot.SUBGROUP_MAX).setParameterLength(1),ZCe=ct(Ot,Ot.SUBGROUP_ALL).setParameterLength(0),KCe=ct(Ot,Ot.SUBGROUP_ANY).setParameterLength(0),QCe=ct(Ot,Ot.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),JCe=ct(Ot,Ot.QUAD_SWAP_X).setParameterLength(1),eRe=ct(Ot,Ot.QUAD_SWAP_Y).setParameterLength(1),tRe=ct(Ot,Ot.QUAD_SWAP_DIAGONAL).setParameterLength(1),nRe=ct(Ot,Ot.SUBGROUP_BROADCAST).setParameterLength(2),iRe=ct(Ot,Ot.SUBGROUP_SHUFFLE).setParameterLength(2),rRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),sRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_UP).setParameterLength(2),oRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),aRe=ct(Ot,Ot.QUAD_BROADCAST).setParameterLength(1),pR;function yI(i){pR=pR||new WeakMap;let e=pR.get(i);return e===void 0&&pR.set(i,e={}),e}function bI(i){let e=yI(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 hse(i,e=vf){let t=bI(i).mul(e);return t.xyz.div(t.w)}function Jz(i){let e=yI(i);return e.position||(e.position=Xt(new re).setGroup(Jt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function fse(i){let e=yI(i);return e.targetPosition||(e.targetPosition=Xt(new re).setGroup(Jt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function eV(i){let e=yI(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 tV=i=>vm.transformDirection(Jz(i).sub(fse(i))),lRe=$d("vec3","totalDiffuse"),cRe=$d("vec3","totalSpecular"),uRe=$d("vec3","outgoingLight"),hRe=i=>i.sort((e,t)=>e.id-t.id),fRe=(i,e)=>{for(let t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},IO=new WeakMap,Mw=[],aS=class extends Kt{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=lRe,this.totalSpecularNode=cRe,this.outgoingLightNode=uRe,this._lights=[],this.global=!0}customCacheKey(){let e=this._lights;for(let n=0;n<e.length;n++){let r=e[n];if(Mw.push(r.id),Mw.push(r.castShadow?1:0),r.isSpotLight===!0){let s=r.map!==null?r.map.id:-1,o=r.colorNode?r.colorNode.getCacheKey():-1;Mw.push(s,o)}}let t=mS(Mw);return Mw.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=hRe([...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=fRe(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}IO.has(l)===!1&&IO.set(l,new u(l)),c=IO.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}},dRe=(i=[])=>new aS().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}){nV.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||vf)}},nV=$d("vec3","shadowPositionWorld");function pRe(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 mRe(i,e){return e=pRe(i,e),i.setMRT(null),i.setRenderObjectFunction(null),i.setClearColor(0,1),i.autoClear=!0,e}function ARe(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 gRe(i,e={}){return e.background=i.background,e.backgroundNode=i.backgroundNode,e.overrideMaterial=i.overrideMaterial,e}function vRe(i,e){return e=gRe(i,e),i.background=null,i.backgroundNode=null,i.overrideMaterial=null,e}function _Re(i,e){i.background=e.background,i.backgroundNode=e.backgroundNode,i.overrideMaterial=e.overrideMaterial}function xRe(i,e,t){return t=mRe(i,t),t=vRe(e,t),t}function yRe(i,e,t){ARe(i,t),_Re(e,t)}var y4=new WeakMap,dse=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)}),pse=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=$z(e1.xy).mul(6.28318530718);return Is(r(e.xy.add(Vu(0,5,c).mul(l)),e.z),r(e.xy.add(Vu(1,5,c).mul(l)),e.z),r(e.xy.add(Vu(2,5,c).mul(l)),e.z),r(e.xy.add(Vu(3,5,c).mul(l)),e.z),r(e.xy.add(Vu(4,5,c).mul(l)),e.z)).mul(1/5)}),mse=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=Hu(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(Ur(-1,1)).toConst(),u=l(Ur(1,1)).toConst(),f=l(Ur(-1,-1)).toConst(),d=l(Ur(1,-1)).toConst();return Is(Kn(c.x,u.y,a.x).add(c.y).add(u.x).mul(a.y),Kn(c.w,u.z,a.x).add(c.z).add(u.w),Kn(f.x,d.y,a.x).add(f.y).add(d.x),Kn(f.w,d.z,a.x).add(f.z).add(d.w).mul(a.y.oneMinus())).mul(1/9)}),Ase=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=kr(1e-7,r.y.mul(r.y)),a=n.renderer.reversedDepthBuffer?qg(s,e.z):qg(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=Wu(ai(u,.3).div(.65)),l.assign(kr(a,u))}),l}),gse=i=>{let e=y4.get(i);return e===void 0&&(e=new Rr,e.colorNode=Ft(0,0,0,1),e.isShadowPassMaterial=!0,e.name="ShadowMaterial",e.blending=ds,e.fog=!1,y4.set(i,e)),e},vse=i=>{let e=y4.get(i);e!==void 0&&(e.dispose(),y4.delete(i))},Xee=new wf,L_=[],_se=(i,e,t,n)=>{L_[0]=i,L_[1]=e;let r=Xee.get(L_);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===Fc)&&(n&&(Mte(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,Xee.set(L_,r)),L_[0]=null,L_[1]=null,r},bRe=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(Is(e1.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=Qa(o.sub(s.mul(s)).max(0));return dt(s,c)}),wRe=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(Is(e1.xy,dt(f,0).mul(e)).div(t));n.value.isArrayTexture&&(d=d.depth(r)),s.addAssign(d.x),o.addAssign(Is(d.y.mul(d.y),d.x.mul(d.x)))}),s.divAssign(i),o.divAssign(i);let c=Qa(o.sub(s.mul(s)).max(0));return dt(s,c)}),SRe=[dse,pse,mse,Ase],PO,mR=new oS,b4=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=AI(l.negate(),c,u)}return o=pe(o.x,o.y.oneMinus(),r.reversedDepthBuffer?a.sub(s):a.add(s)),o}getShadowFilterFn(e){return SRe[e]}setupRenderTarget(e,t){let n=new Es(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Pu:jh;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(Pd.TEXTURE_COMPARE);if((l===l0||l===mM)&&c?(o.minFilter=Mi,o.magFilter=Mi):(o.minFilter=Ti,o.magFilter=Ti),s.camera.coordinateSystem=n.coordinateSystem,s.camera.updateProjectionMatrix(),l===Fc&&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 Rr);z.fragmentNode=bRe({samples:C,radius:B,size:k,shadowPass:D,depthLayer:this.depthLayer}).context(e.getSharedContext()),z.name="VSMVertical",z=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new Rr),z.fragmentNode=wRe({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=bI(r),A=_m.mul(f),y;!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld?y=d.mul(nV.add(A)):y=Xt("mat4").onObjectUpdate(({object:L},C)=>C.value.multiplyMatrices(d.value,L.matrixWorld)).mul(Er).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===Fc&&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=Za(a.texture,w.xyz):(P=fi(a.texture,w),o.isArrayTexture&&(P=P.depth(this.depthLayer))));let I;P?I=Kn(1,R.rgb.mix(P,1),u.mul(P.a)).toVar():I=Kn(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?Za(this.shadowMap.texture,YU()):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=Za(this.shadowMap.depthTexture,YU()).r:C=fi(this.shadowMap.depthTexture).r;let B;return this.shadow.camera.isPerspectiveCamera?B=mI(C,D,L):B=bre(C,D,L),B=kg(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;PO=xRe(s,o,PO),o.overrideMaterial=gse(n),s.setRenderObjectFunction(_se(s,r,l,A)),s.setClearColor(0,0),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(f),l===Fc&&r.isPointLightShadow!==!0&&this.vsmPass(s),r.camera.layers.mask=u,yRe(s,o,PO)}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),mR.material=this.vsmMaterialVertical,mR.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),mR.material=this.vsmMaterialHorizontal,mR.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,vse(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))}},xse=(i,e)=>new b4(i,e),TRe=new zt,$ee=new cn,Cw=new re,LO=new re,ERe=[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)],MRe=[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)],CRe=[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)],RRe=[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)],yse=me(({depthTexture:i,bd3D:e,dp:t})=>Za(i,e).compare(t)),bse=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=_a(jd(e,a.x.greaterThan(a.z).select(pe(0,1,0),pe(1,0,0)))),c=jd(e,l),u=$z(e1.xy).mul(6.28318530718),f=Vu(0,5,u),d=Vu(1,5,u),A=Vu(2,5,u),y=Vu(3,5,u),w=Vu(4,5,u);return Za(i,e.add(l.mul(f.x).add(c.mul(f.y)).mul(o))).compare(t).add(Za(i,e.add(l.mul(d.x).add(c.mul(d.y)).mul(o))).compare(t)).add(Za(i,e.add(l.mul(A.x).add(c.mul(A.y)).mul(o))).compare(t)).add(Za(i,e.add(l.mul(y.x).add(c.mul(y.y)).mul(o))).compare(t)).add(Za(i,e.add(l.mul(w.x).add(c.mul(w.y)).mul(o))).compare(t)).mul(1/5)}),IRe=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=wre(a.negate(),l,c),d.subAssign(u)):r.renderer.logarithmicDepthBuffer?(d=AI(a.negate(),l,c),d.addAssign(u)):(d=Vz(a.negate(),l,c),d.addAssign(u));let A=s.normalize();f.assign(i({depthTexture:e,bd3D:A,dp:d,shadow:n}))}),f}),rk=class extends b4{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===_8?yse:bse}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s}){return IRe({filterFn:t,depthTexture:n,shadowCoord:r,shadow:s})}setupRenderTarget(e,t){let n=new Gv(e.mapSize.width);n.name="PointShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Pu:jh;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===gl,u=c?ERe:CRe,f=c?MRe:RRe;n.setSize(t.mapSize.width,t.mapSize.width);let d=s.autoClear,A=s.getClearColor(TRe),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()),Cw.setFromMatrixPosition(r.matrixWorld),a.position.copy(Cw),LO.copy(a.position),LO.add(u[w]),a.up.copy(f[w]),a.lookAt(LO),a.updateMatrixWorld(),l.makeTranslation(-Cw.x,-Cw.y,-Cw.z),$ee.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix($ee,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)}},wse=(i,e)=>new rk(i,e),Xd=class extends pm{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 eV(this.light).sub(e.context.positionView||_s)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return xse(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)}),Sse=({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}},sk=class extends Xd{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 wse(this.light)}setupDirect(e){return Sse({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}},PRe=me(([i=Ui()])=>{let e=i.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),LRe=me(([i=Ui()],{renderer:e,material:t})=>{let n=az(i.mul(2).sub(1)),r;if(t.alphaToCoverage&&e.currentSamples>0){let s=oe(n.fwidth()).toVar();r=uc(s.oneMinus(),s.add(1),n).oneMinus()}else r=va(n.greaterThan(1),0,1);return r}),jw=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=lc(i).toVar();return va(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=lc(e).toVar(),n=oe(i).toVar();return va(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(Af(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),Mr=me(([i,e])=>{let t=oe(i).toVar();return e.assign(Rs(t)),t.sub(oe(e))}),DRe=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"}]}),NRe=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"}]}),Tse=Xo([DRe,NRe]),FRe=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"}]}),BRe=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"}]}),Ese=Xo([FRe,BRe]),ORe=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(jw(o.lessThan(rt(4)),r,n)).toVar(),l=oe(Tn(2,jw(o.lessThan(rt(4)),n,r))).toVar();return w4(a,lc(o.bitAnd(rt(1)))).add(w4(l,lc(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"}]}),URe=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(jw(l.lessThan(rt(8)),o,s)).toVar(),u=oe(jw(l.lessThan(rt(4)),s,jw(l.equal(rt(12)).or(l.equal(rt(14))),o,r))).toVar();return w4(c,lc(l.bitAnd(rt(1)))).add(w4(u,lc(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"}]}),wo=Xo([ORe,URe]),kRe=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=Qg(i).toVar();return pe(wo(s.x,r,n),wo(s.y,r,n),wo(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"}]}),zRe=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=oe(e).toVar(),a=Qg(i).toVar();return pe(wo(a.x,o,s,r),wo(a.y,o,s,r),wo(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"}]}),jc=Xo([kRe,zRe]),VRe=me(([i])=>{let e=oe(i).toVar();return Tn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),GRe=me(([i])=>{let e=oe(i).toVar();return Tn(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),qRe=me(([i])=>{let e=pe(i).toVar();return Tn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Mse=Xo([VRe,qRe]),HRe=me(([i])=>{let e=pe(i).toVar();return Tn(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Cse=Xo([GRe,HRe]),sc=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"}]}),Rse=me(([i,e,t])=>{i.subAssign(t),i.bitXorAssign(sc(t,de(4))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(sc(i,de(6))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(sc(e,de(8))),e.addAssign(i),i.subAssign(t),i.bitXorAssign(sc(t,de(16))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(sc(i,de(19))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(sc(e,de(4))),e.addAssign(i)}),xS=me(([i,e,t])=>{let n=rt(t).toVar(),r=rt(e).toVar(),s=rt(i).toVar();return n.bitXorAssign(r),n.subAssign(sc(r,de(14))),s.bitXorAssign(n),s.subAssign(sc(n,de(11))),r.bitXorAssign(s),r.subAssign(sc(s,de(25))),n.bitXorAssign(r),n.subAssign(sc(r,de(16))),s.bitXorAssign(n),s.subAssign(sc(n,de(4))),r.bitXorAssign(s),r.subAssign(sc(s,de(14))),n.bitXorAssign(r),n.subAssign(sc(r,de(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),xa=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"}]}),_f=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"}]}),WRe=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 xS(n.add(rt(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),jRe=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)),xS(s,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),XRe=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)),xS(a,l,c)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),$Re=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)),Rse(c,u,f),c.addAssign(rt(r)),xS(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"}]}),YRe=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)),Rse(f,d,A),f.addAssign(rt(o)),d.addAssign(rt(s)),xS(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=Xo([WRe,jRe,XRe,$Re,YRe]),ZRe=me(([i,e])=>{let t=de(e).toVar(),n=de(i).toVar(),r=rt(Xi(n,t)).toVar(),s=Qg().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"}]}),KRe=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=Qg().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"}]}),Xc=Xo([ZRe,KRe]),QRe=me(([i])=>{let e=dt(i).toVar(),t=de().toVar(),n=de().toVar(),r=oe(Mr(e.x,t)).toVar(),s=oe(Mr(e.y,n)).toVar(),o=oe(_f(r)).toVar(),a=oe(_f(s)).toVar(),l=oe(Tse(wo(Xi(t,n),r,s),wo(Xi(t.add(de(1)),n),r.sub(1),s),wo(Xi(t,n.add(de(1))),r,s.sub(1)),wo(Xi(t.add(de(1)),n.add(de(1))),r.sub(1),s.sub(1)),o,a)).toVar();return Mse(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),JRe=me(([i])=>{let e=pe(i).toVar(),t=de().toVar(),n=de().toVar(),r=de().toVar(),s=oe(Mr(e.x,t)).toVar(),o=oe(Mr(e.y,n)).toVar(),a=oe(Mr(e.z,r)).toVar(),l=oe(_f(s)).toVar(),c=oe(_f(o)).toVar(),u=oe(_f(a)).toVar(),f=oe(Ese(wo(Xi(t,n,r),s,o,a),wo(Xi(t.add(de(1)),n,r),s.sub(1),o,a),wo(Xi(t,n.add(de(1)),r),s,o.sub(1),a),wo(Xi(t.add(de(1)),n.add(de(1)),r),s.sub(1),o.sub(1),a),wo(Xi(t,n,r.add(de(1))),s,o,a.sub(1)),wo(Xi(t.add(de(1)),n,r.add(de(1))),s.sub(1),o,a.sub(1)),wo(Xi(t,n.add(de(1)),r.add(de(1))),s,o.sub(1),a.sub(1)),wo(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 Cse(f)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),rV=Xo([QRe,JRe]),e4e=me(([i])=>{let e=dt(i).toVar(),t=de().toVar(),n=de().toVar(),r=oe(Mr(e.x,t)).toVar(),s=oe(Mr(e.y,n)).toVar(),o=oe(_f(r)).toVar(),a=oe(_f(s)).toVar(),l=pe(Tse(jc(Xc(t,n),r,s),jc(Xc(t.add(de(1)),n),r.sub(1),s),jc(Xc(t,n.add(de(1))),r,s.sub(1)),jc(Xc(t.add(de(1)),n.add(de(1))),r.sub(1),s.sub(1)),o,a)).toVar();return Mse(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),t4e=me(([i])=>{let e=pe(i).toVar(),t=de().toVar(),n=de().toVar(),r=de().toVar(),s=oe(Mr(e.x,t)).toVar(),o=oe(Mr(e.y,n)).toVar(),a=oe(Mr(e.z,r)).toVar(),l=oe(_f(s)).toVar(),c=oe(_f(o)).toVar(),u=oe(_f(a)).toVar(),f=pe(Ese(jc(Xc(t,n,r),s,o,a),jc(Xc(t.add(de(1)),n,r),s.sub(1),o,a),jc(Xc(t,n.add(de(1)),r),s,o.sub(1),a),jc(Xc(t.add(de(1)),n.add(de(1)),r),s.sub(1),o.sub(1),a),jc(Xc(t,n,r.add(de(1))),s,o,a.sub(1)),jc(Xc(t.add(de(1)),n,r.add(de(1))),s.sub(1),o,a.sub(1)),jc(Xc(t,n.add(de(1)),r.add(de(1))),s,o.sub(1),a.sub(1)),jc(Xc(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 Cse(f)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),yS=Xo([e4e,t4e]),n4e=me(([i])=>{let e=oe(i).toVar(),t=de(Rs(e)).toVar();return xa(Xi(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),i4e=me(([i])=>{let e=dt(i).toVar(),t=de(Rs(e.x)).toVar(),n=de(Rs(e.y)).toVar();return xa(Xi(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),r4e=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 xa(Xi(t,n,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),s4e=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 xa(Xi(t,n,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),o4e=Xo([n4e,i4e,r4e,s4e]),a4e=me(([i])=>{let e=oe(i).toVar(),t=de(Rs(e)).toVar();return pe(xa(Xi(t,de(0))),xa(Xi(t,de(1))),xa(Xi(t,de(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),l4e=me(([i])=>{let e=dt(i).toVar(),t=de(Rs(e.x)).toVar(),n=de(Rs(e.y)).toVar();return pe(xa(Xi(t,n,de(0))),xa(Xi(t,n,de(1))),xa(Xi(t,n,de(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),c4e=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(xa(Xi(t,n,r,de(0))),xa(Xi(t,n,r,de(1))),xa(Xi(t,n,r,de(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),u4e=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(xa(Xi(t,n,r,s,de(0))),xa(Xi(t,n,r,s,de(1))),xa(Xi(t,n,r,s,de(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),wI=Xo([a4e,l4e,c4e,u4e]),S4=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(rV(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"}]}),SI=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(yS(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"}]}),h4e=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar();return dt(S4(a,o,s,r),S4(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"}]}),f4e=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar(),l=pe(SI(a,o,s,r)).toVar(),c=oe(S4(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"}]}),d4e=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)),()=>kr(fr(T.x),fr(T.y))),Qc(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"}]}),p4e=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)),()=>kr(fr(I.x),fr(I.y),fr(I.z))),Qc(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"}]}),dx=Xo([d4e,p4e]),m4e=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(Mr(s.x,o),Mr(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(dx(l,u,f,o,a,r,n)).toVar();c.assign(Ml(c,d))})}),$t(n.equal(de(0)),()=>{c.assign(Qa(c))}),c}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),A4e=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(Mr(s.x,o),Mr(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(dx(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(Qa(c))}),c}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),g4e=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(Mr(s.x,o),Mr(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(dx(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(Qa(c))}),c}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),v4e=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(Mr(s.x,o),Mr(s.y,a),Mr(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(dx(c,f,d,A,o,a,l,r,n)).toVar();u.assign(Ml(u,y))})})}),$t(n.equal(de(0)),()=>{u.assign(Qa(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),_4e=Xo([m4e,v4e]),x4e=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(Mr(s.x,o),Mr(s.y,a),Mr(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(dx(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(Qa(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),y4e=Xo([A4e,x4e]),b4e=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(Mr(s.x,o),Mr(s.y,a),Mr(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(dx(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(Qa(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),sV=Xo([g4e,b4e]),w4e=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=lc(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(yS(D))}),$t(f.equal(de(1)),()=>{L.assign(wI(D))}),$t(f.equal(de(2)),()=>{L.assign(sV(D,w,de(0)))}),$t(f.equal(de(3)),()=>{L.assign(SI(pe(D,0),P,I,F))}),L.assign(L.mul(T.sub(S)).add(S)),$t(R,()=>{L.assign(Wu(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"}]}),S4e=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=lc(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(yS(D))}),$t(f.equal(de(1)),()=>{L.assign(wI(D))}),$t(f.equal(de(2)),()=>{L.assign(sV(D,w,de(0)))}),$t(f.equal(de(3)),()=>{L.assign(SI(D,P,I,F))}),L.assign(L.mul(T.sub(S)).add(S)),$t(R,()=>{L.assign(Wu(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"}]}),T4e=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(Af(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"}]}),E4e=me(([i])=>{let e=pe(i).toVar(),t=oe(e.x).toVar(),n=oe(e.y).toVar(),r=oe(e.z).toVar(),s=oe(Ml(t,Ml(n,r))).toVar(),o=oe(kr(t,kr(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(Is(2,r.sub(t).div(a)))}).Else(()=>{l.assign(Is(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"}]}),M4e=me(([i])=>{let e=pe(i).toVar(),t=V9($9(e,pe(.04045))).toVar(),n=pe(e.div(12.92)).toVar(),r=pe($c(kr(e.add(pe(.055)),pe(0)).div(1.055),pe(2.4))).toVar();return Kn(n,r,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Ise=(i,e)=>{i=oe(i),e=oe(e);let t=dt(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return uc(i.sub(t),i.add(t),e)},Pse=(i,e,t,n)=>Kn(i,e,t[n].clamp()),C4e=(i,e,t=Ui())=>Pse(i,e,t,"x"),R4e=(i,e,t=Ui())=>Pse(i,e,t,"y"),I4e=(i,e,t,n,r=Ui())=>{let s=r.x.clamp(),o=r.y.clamp(),a=Kn(i,e,s),l=Kn(t,n,s);return Kn(a,l,o)},Lse=(i,e,t,n,r)=>Kn(i,e,Ise(t,n[r])),P4e=(i,e,t,n=Ui())=>Lse(i,e,t,n,"x"),L4e=(i,e,t,n=Ui())=>Lse(i,e,t,n,"y"),D4e=(i=1,e=0,t=Ui())=>t.mul(i).add(e),N4e=(i,e=1)=>(i=oe(i),i.abs().pow(e).mul(i.sign())),F4e=(i,e=1,t=.5)=>oe(i).sub(t).mul(e).add(t),B4e=(i=Ui(),e=1,t=0)=>rV(i.convert("vec2|vec3")).mul(e).add(t),O4e=(i=Ui(),e=1,t=0)=>yS(i.convert("vec2|vec3")).mul(e).add(t),U4e=(i=Ui(),e=1,t=0)=>(i=i.convert("vec2|vec3"),Ft(yS(i),rV(i.add(dt(19,73)))).mul(e).add(t)),k4e=(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)=>w4e(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),z4e=(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)=>S4e(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),V4e=(i=Ui(),e=1)=>_4e(i.convert("vec2|vec3"),e,de(1)),G4e=(i=Ui(),e=1)=>y4e(i.convert("vec2|vec3"),e,de(1)),q4e=(i=Ui(),e=1)=>sV(i.convert("vec2|vec3"),e,de(1)),H4e=(i=Ui())=>o4e(i.convert("vec2|vec3")),W4e=(i=Ui(),e=3,t=2,n=.5,r=1)=>S4(i,de(e),t,n).mul(r),j4e=(i=Ui(),e=3,t=2,n=.5,r=1)=>h4e(i,de(e),t,n).mul(r),X4e=(i=Ui(),e=3,t=2,n=.5,r=1)=>SI(i,de(e),t,n).mul(r),$4e=(i=Ui(),e=3,t=2,n=.5,r=1)=>f4e(i,de(e),t,n).mul(r),Y4e=(i,e=oe(0))=>Is(i,e),Z4e=(i,e=oe(0))=>ai(i,e),K4e=(i,e=oe(1))=>Tn(i,e),Q4e=(i,e=oe(1))=>cc(i,e),J4e=(i,e=oe(1))=>iI(i,e),eIe=(i,e=oe(1))=>$c(i,e),tIe=(i=oe(0),e=oe(1))=>Q9(i,e),nIe=()=>fx,iIe=()=>Yre,rIe=(i,e=oe(1))=>ai(e,i),sIe=(i,e,t,n)=>i.greaterThan(e).mix(t,n),oIe=(i,e,t,n)=>i.greaterThanEqual(e).mix(t,n),aIe=(i,e,t,n)=>i.equal(e).mix(t,n),lIe=(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},cIe=(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},uIe=(i,e)=>{i=dt(i),e=oe(e);let t=e.mul(Math.PI/180);return vS(i,t)},hIe=(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))},fIe=(i,e)=>(i=pe(i),e=oe(e),Rz(i,e)),dIe=me(([i,e,t])=>{let n=_a(i).toVar(),r=ai(oe(.5).mul(e.sub(t)),vf).div(n).toVar(),s=ai(oe(-.5).mul(e.sub(t)),vf).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=Ml(o.x,o.y,o.z).toVar();return vf.add(n.mul(a)).toVar().sub(t)}),Dse=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:Wz,BRDF_Lambert:Xg,BasicPointShadowFilter:yse,BasicShadowFilter:dse,Break:vre,Const:qne,Continue:vEe,DFGLUT:tS,D_GGX:Pre,Discard:rie,EPSILON:rI,F_Schlick:sx,Fn:me,HALF_PI:fTe,INFINITY:cTe,If:$t,Loop:Oi,NodeAccess:Wo,NodeShaderStage:G_,NodeType:GSe,NodeUpdateType:yn,OnBeforeFrameUpdate:fEe,OnBeforeMaterialUpdate:hEe,OnBeforeObjectUpdate:uEe,OnFrameUpdate:ure,OnMaterialUpdate:cEe,OnObjectUpdate:gS,PCFShadowFilter:pse,PCFSoftShadowFilter:mse,PI:$R,PI2:uTe,PointShadowFilter:bse,Return:wTe,Schlick_to_F0:t7,ShaderNode:W_,Stack:J4,Switch:iTe,TBNViewMatrix:Dg,TWO_PI:hTe,VSMShadowFilter:Ase,V_GGX_SmithCorrelated:Ire,Var:Gne,VarIntent:Hne,abs:fr,acesFilmicToneMapping:sse,acos:K9,acosh:vne,add:Is,addMethodChaining:Ue,addNodeElement:STe,agxToneMapping:ose,all:lne,alphaT:qR,ambientOcclusion:iU,and:$te,anisotropy:tm,anisotropyB:Bg,anisotropyT:Vw,any:cne,append:sTe,array:zte,asin:Ane,asinh:gne,assign:Vte,atan:Q9,atanh:_ne,atomicAdd:ICe,atomicAnd:NCe,atomicFunc:Mf,atomicLoad:CCe,atomicMax:LCe,atomicMin:DCe,atomicOr:FCe,atomicStore:RCe,atomicSub:PCe,atomicXor:BCe,attenuationColor:j9,attenuationDistance:W9,attribute:ac,attributeArray:FMe,backgroundBlurriness:Qre,backgroundIntensity:H7,backgroundRotation:Jre,batch:pre,batchColor:Oz,bentNormalView:Nie,billboarding:wMe,bitAnd:Qte,bitNot:Jte,bitOr:ene,bitXor:tne,bitangentGeometry:tEe,bitangentLocal:nEe,bitangentView:Lie,bitangentWorld:iEe,bitcast:Xre,blendBurn:WMe,blendColor:YMe,blendDodge:jMe,blendOverlay:$Me,blendScreen:XMe,blur:Ore,bool:lc,buffer:ux,bufferAttribute:dz,builtin:Zd,builtinAOContext:zne,builtinShadowContext:kne,bumpMap:Rz,bvec2:Nte,bvec3:V9,bvec4:Fte,bypass:nie,cache:tie,call:Gte,cameraFar:rm,cameraIndex:gm,cameraNear:im,cameraNormalMatrix:LTe,cameraPosition:uie,cameraProjectionMatrix:Ka,cameraProjectionMatrixInverse:cie,cameraViewMatrix:vm,cameraViewport:DTe,cameraWorldMatrix:AS,cbrt:Dne,cdl:eCe,ceil:oI,checker:PRe,cineonToneMapping:rse,clamp:Wu,clearcoat:zR,clearcoatNormalView:sm,clearcoatRoughness:X_,clipSpace:die,code:xI,color:Dte,colorSpaceToWorking:lI,colorToDirection:oEe,compute:eie,computeKernel:mz,computeSkinning:gEe,context:Yd,convert:Ote,convertColorSpace:ATe,convertToTexture:PMe,cos:zu,cosh:dne,countLeadingZeros:eMe,countOneBits:tMe,countTrailingZeros:J3e,cross:jd,cubeTexture:Za,cubeTextureBase:Mz,dFdx:tz,dFdy:nz,dashSize:Og,debug:oie,decrement:ane,decrementBefore:sne,defaultBuildStages:PR,defaultShaderStages:Cte,defined:J_,degrees:hne,deltaTime:mMe,densityFogFactor:use,depth:Gz,depthPass:sCe,determinant:Sne,difference:Cne,diffuseColor:Bi,diffuseContribution:Rg,directPointLight:Sse,directionToColor:sEe,directionToFaceDirection:jTe,dispersion:X9,disposeShadowMaterial:vse,distance:Mne,div:cc,dot:Qc,drawIndex:Jne,dynamicBufferAttribute:_Te,element:Bte,emissive:nU,equal:qte,equirectDirection:YU,equirectUV:qz,exp:Y9,exp2:ex,exponentialHeightFogFactor:ACe,expression:oc,faceDirection:Sz,faceForward:cz,faceforward:dTe,float:oe,floatBitsToInt:Z3e,floatBitsToUint:$re,floor:Af,fog:K7,fract:Hu,frameGroup:aTe,frameId:Yre,frontFacing:pie,fwidth:rz,gain:iMe,gapSize:Zw,getConstNodeType:Lte,getCurrentStack:U9,getDirection:Fre,getDistanceAttenuation:iV,getGeometryRoughness:Rre,getNormalFromDepth:DMe,getParallaxCorrectNormal:dIe,getRoughness:Hz,getScreenPosition:LMe,getShIrradianceAt:Dse,getShadowMaterial:gse,getShadowRenderObjectFunction:_se,getTextureIndex:Wre,getViewPosition:H_,ggxConvolution:Ure,globalId:xCe,glsl:dCe,glslFn:pCe,grayscale:ZMe,greaterThan:$9,greaterThanEqual:Xte,hash:nMe,highpModelNormalViewMatrix:wU,highpModelViewMatrix:bU,hue:JMe,increment:one,incrementBefore:rne,inspector:aie,instance:fre,instanceColor:Bz,instanceIndex:qu,instancedArray:BMe,instancedBufferAttribute:uI,instancedDynamicBufferAttribute:pz,instancedMesh:dre,int:de,intBitsToFloat:K3e,interleavedGradientNoise:$z,inverse:Tne,inverseSqrt:Z9,inversesqrt:pTe,invocationLocalIndex:bTe,invocationSubgroupIndex:yTe,ior:Gw,iridescence:tI,iridescenceIOR:VR,iridescenceThickness:GR,isolate:Z_,ivec2:Ur,ivec3:z9,ivec4:G9,js:hCe,label:Vne,length:gf,lengthSq:az,lessThan:Wte,lessThanEqual:jte,lightPosition:Jz,lightProjectionUV:hse,lightShadowMatrix:bI,lightTargetDirection:tV,lightTargetPosition:fse,lightViewPosition:eV,lightingContext:xre,lights:dRe,linearDepth:i4,linearToneMapping:nse,localId:yCe,log:sI,log2:mf,logarithmicDepthToViewZ:wEe,luminance:Zz,mat2:eI,mat3:So,mat4:cm,matcapUV:kre,materialAO:lre,materialAlphaTest:Bie,materialAnisotropy:Kie,materialAnisotropyVector:q_,materialAttenuationColor:sre,materialAttenuationDistance:rre,materialClearcoat:Wie,materialClearcoatNormal:Xie,materialClearcoatRoughness:jie,materialColor:Oie,materialDispersion:are,materialEmissive:kie,materialEnvIntensity:DR,materialEnvRotation:JR,materialIOR:ire,materialIridescence:Qie,materialIridescenceIOR:Jie,materialIridescenceThickness:ere,materialLightMap:Fz,materialLineDashOffset:Nz,materialLineDashSize:Lz,materialLineGapSize:Dz,materialLineScale:Pz,materialLineWidth:e4,materialMetalness:qie,materialNormal:Hie,materialOpacity:Iz,materialPointSize:ore,materialReference:Gd,materialReflectivity:NR,materialRefractionRatio:gie,materialRotation:$ie,materialRoughness:Gie,materialSheen:Yie,materialSheenRoughness:Zie,materialShininess:Uie,materialSpecular:zie,materialSpecularColor:Vie,materialSpecularIntensity:NU,materialSpecularStrength:qw,materialThickness:nre,materialTransmission:tre,max:kr,maxMipLevel:_z,mediumpModelViewMatrix:fie,metalness:Hd,min:Ml,mix:Kn,mixElement:Fne,mod:iI,modelDirection:zTe,modelNormalMatrix:hie,modelPosition:VTe,modelRadius:HTe,modelScale:GTe,modelViewMatrix:yf,modelViewPosition:qTe,modelViewProjection:cre,modelWorldMatrix:Yc,modelWorldMatrixInverse:WTe,morphReference:_re,mrt:jre,mul:Tn,mx_aastep:Ise,mx_add:Y4e,mx_atan2:tIe,mx_cell_noise_float:H4e,mx_contrast:F4e,mx_divide:Q4e,mx_fractal_noise_float:W4e,mx_fractal_noise_vec2:j4e,mx_fractal_noise_vec3:X4e,mx_fractal_noise_vec4:$4e,mx_frame:iIe,mx_heighttonormal:fIe,mx_hsvtorgb:T4e,mx_ifequal:aIe,mx_ifgreater:sIe,mx_ifgreatereq:oIe,mx_invert:rIe,mx_modulo:J4e,mx_multiply:K4e,mx_noise_float:B4e,mx_noise_vec3:O4e,mx_noise_vec4:U4e,mx_place2d:cIe,mx_power:eIe,mx_ramp4:I4e,mx_ramplr:C4e,mx_ramptb:R4e,mx_rgbtohsv:E4e,mx_rotate2d:uIe,mx_rotate3d:hIe,mx_safepower:N4e,mx_separate:lIe,mx_splitlr:P4e,mx_splittb:L4e,mx_srgb_texture_to_lin_rec709:M4e,mx_subtract:Z4e,mx_timer:nIe,mx_transform_uv:D4e,mx_unifiednoise2d:k4e,mx_unifiednoise3d:z4e,mx_worley_noise_float:V4e,mx_worley_noise_vec2:G4e,mx_worley_noise_vec3:q4e,negate:ez,negateOnBackSide:t1,neutralToneMapping:ase,nodeArray:Fg,nodeImmutable:xt,nodeObject:Ht,nodeObjectIntent:Ow,nodeObjects:Q4,nodeProxy:$n,nodeProxyConstructor:O9,nodeProxyIntent:ct,normalFlat:mie,normalGeometry:hI,normalLocal:ya,normalMap:LU,normalView:hi,normalViewGeometry:tx,normalWorld:_m,normalWorldGeometry:Aie,normalize:_a,not:Zte,notEqual:Hte,numWorkgroups:vCe,objectDirection:NTe,objectGroup:kte,objectPosition:BTe,objectRadius:kTe,objectScale:OTe,objectViewPosition:UTe,objectWorldMatrix:FTe,oneMinus:xne,or:Yte,orthographicDepthToViewZ:bre,oscSawtooth:_Me,oscSine:AMe,oscSquare:gMe,oscTriangle:vMe,output:$_,outputStruct:X3e,overloadingFn:Xo,overrideNode:qre,overrideNodes:Hre,packHalf2x16:lMe,packNormalToRGB:Cz,packSnorm2x16:oMe,packUnorm2x16:aMe,parabola:F7,parallaxDirection:Die,parallaxUV:rEe,parameter:H3e,pass:iCe,passTexture:rCe,pcurve:rMe,perspectiveDepthToViewZ:mI,pmremTexture:Xz,pointShadow:wse,pointUV:OMe,pointWidth:oTe,positionGeometry:Aa,positionLocal:Er,positionPrevious:jg,positionView:_s,positionViewDirection:er,positionWorld:vf,positionWorldDirection:wz,posterize:tCe,pow:$c,pow2:sz,pow3:Rne,pow4:oz,premultiplyAlpha:gz,property:$d,quadBroadcast:aRe,quadSwapDiagonal:tRe,quadSwapX:JCe,quadSwapY:eRe,radians:une,rand:Nne,range:gCe,rangeFogFactor:cse,reciprocal:bne,reference:mr,referenceBuffer:wie,reflect:Ene,reflectVector:xie,reflectView:vie,reflector:CMe,refract:lz,refractVector:yie,refractView:_ie,reinhardToneMapping:ise,remap:Az,remapClamp:iie,renderGroup:Jt,renderOutput:vz,rendererReference:Yne,replaceDefaultUV:xMe,rotate:vS,rotateUV:yMe,roughness:df,round:yne,rtt:Kre,sRGBTransferEOTF:jne,sRGBTransferOETF:Xne,sample:NMe,sampler:CTe,samplerComparison:RTe,saturate:aI,saturation:KMe,screenCoordinate:e1,screenDPR:yz,screenSize:Wg,screenUV:Gu,select:va,setCurrentStack:Yw,setName:uz,shaderStages:LR,shadow:xse,shadowPositionWorld:nV,shapeCircle:LRe,sharedUniformGroup:nI,sheen:rc,sheenRoughness:nm,shiftLeft:nne,shiftRight:ine,shininess:HR,sign:J9,sin:Ya,sinc:sMe,sinh:fne,skinning:gre,smoothstep:uc,smoothstepElement:Bne,specularColor:fm,specularColorBlended:Pg,specularF90:Lg,spherizeUV:bMe,split:rTe,spritesheetUV:TMe,sqrt:Qa,stack:BR,step:qg,stepElement:One,storage:um,storageBarrier:SCe,storageTexture:ese,storageTexture3D:kMe,struct:j3e,sub:ai,subBuild:Ug,subgroupAdd:kCe,subgroupAll:ZCe,subgroupAnd:WCe,subgroupAny:KCe,subgroupBallot:UCe,subgroupBroadcast:nRe,subgroupBroadcastFirst:QCe,subgroupElect:OCe,subgroupExclusiveAdd:VCe,subgroupExclusiveMul:HCe,subgroupInclusiveAdd:zCe,subgroupInclusiveMul:qCe,subgroupIndex:xTe,subgroupMax:YCe,subgroupMin:$Ce,subgroupMul:GCe,subgroupOr:jCe,subgroupShuffle:iRe,subgroupShuffleDown:oRe,subgroupShuffleUp:sRe,subgroupShuffleXor:rRe,subgroupSize:bCe,subgroupXor:XCe,tan:pne,tangentGeometry:fI,tangentLocal:dm,tangentView:dI,tangentWorld:Pie,tanh:mne,texture:fi,texture3D:Yz,texture3DLevel:GMe,texture3DLoad:VMe,textureBarrier:TCe,textureBicubic:ZEe,textureBicubicLevel:jz,textureCubeUV:Bre,textureLevel:MTe,textureLoad:vs,textureSize:Hg,textureStore:UMe,thickness:H9,time:fx,toneMapping:Zne,toneMappingExposure:Kne,toonOutlinePass:oCe,transformDirection:Ine,transformNormal:Tz,transformNormalByInverseViewMatrix:Lne,transformNormalByViewMatrix:Pne,transformNormalToView:Ez,transformedClearcoatNormalView:YTe,transformedNormalView:XTe,transformedNormalWorld:$Te,transmission:WR,transpose:wne,triNoise3D:dMe,triplanarTexture:EMe,triplanarTextures:Zre,trunc:iz,uint:rt,uintBitsToFloat:Q3e,uniform:Xt,uniformArray:Ho,uniformCubeTexture:ZTe,uniformFlow:Une,uniformGroup:Ute,uniformTexture:ETe,unpackHalf2x16:hMe,unpackNormal:IU,unpackRGBToNormal:Fie,unpackSnorm2x16:cMe,unpackUnorm2x16:uMe,unpremultiplyAlpha:sie,userData:qMe,uv:Ui,uvec2:k9,uvec3:Qg,uvec4:q9,varying:Am,varyingProperty:Jg,vec2:dt,vec3:pe,vec4:Ft,vectorComponents:Kg,velocity:HMe,vertexColor:Tre,vertexIndex:Qne,vertexStage:Wne,vibrance:QMe,viewZToLogarithmicDepth:AI,viewZToOrthographicDepth:kg,viewZToPerspectiveDepth:Vz,viewZToReversedOrthographicDepth:bEe,viewZToReversedPerspectiveDepth:wre,viewport:Q_,viewportCoordinate:lie,viewportDepthTexture:zz,viewportLinearDepth:SEe,viewportMipTexture:kz,viewportOpaqueMipTexture:yre,viewportResolution:PTe,viewportSafeUV:SMe,viewportSharedTexture:nCe,viewportSize:bz,viewportTexture:xEe,viewportUV:ITe,vogelDiskSample:Vu,wgsl:fCe,wgslFn:mCe,workgroupArray:ECe,workgroupBarrier:wCe,workgroupId:_Ce,workingToColorSpace:$ne,xor:Kte}),Uu=new iS,ok=class extends Sf{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(Uu),Uu.a=r._clearColor.a;else if(s.isColor===!0)s.getRGB(Uu),Uu.a=1,o=!0;else if(s.isNode===!0){let l=this.get(e),c=s;Uu.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(H7).context({getUV:()=>Jre.mul(Aie),getTextureLevel:()=>Qre}),A=Ka.element(3).element(3).equal(1),y=cc(1,Ka.element(1).element(1)).mul(3),w=A.select(Er.mul(y),Er),S=yf.mul(Ft(w,0)),T=Ka.mul(Ft(S.xyz,1));T=T.setZ(T.w);let R=new Rr;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 ka(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(H7),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"?Uu.set(0,0,0,1):a==="alpha-blend"&&Uu.set(0,0,0,0),r.autoClear===!0||o===!0){let l=n.clearColorValue;l.r=Uu.r,l.g=Uu.g,l.b=Uu.b,l.a=Uu.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}},pIe=0,lS=class{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=pIe++}},ak=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 lS(t.name,[]);e.push(r);for(let s of t.bindings)r.bindings.push(s.clone())}else e.push(t);return e}},T4=class{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}},lk=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}},E4=class{constructor(e,t,n=!1,r=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=r}},ck=class extends E4{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})}},mIe=0,Xw=class{constructor(e=null){this.id=mIe++,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)}},hk=class{constructor(e,t){this.name=e,this.members=t,this.output=!1}},Ef=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}},fk=class extends Ef{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}},dk=class extends Ef{constructor(e,t=new Oe){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}},pk=class extends Ef{constructor(e,t=new re){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}},mk=class extends Ef{constructor(e,t=new xn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}},Ak=class extends Ef{constructor(e,t=new zt){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}},gk=class extends Ef{constructor(e,t=new Kv){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}},vk=class extends Ef{constructor(e,t=new Mn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}},_k=class extends Ef{constructor(e,t=new cn){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}},xk=class extends fk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},yk=class extends dk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},bk=class extends pk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},wk=class extends mk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Sk=class extends Ak{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Tk=class extends gk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Ek=class extends vk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Mk=class extends _k{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},AIe=0,Yee=new WeakMap,Zee=new WeakMap,gIe=new WeakMap,vIe=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),AR=i=>/e/g.test(i)?String(i).replace(/\+/g,""):(i=Number(i),i+(i%1?"":".0")),Nse=i=>{if(i.writeUsageCount>0)return!0;if(i.subBuildsCache!==void 0){for(let e in i.subBuildsCache)if(Nse(i.subBuildsCache[e]))return!0}return!1},M4=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=BR(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new Xw,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:AIe++})}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 Na(e,t,n)}createCubeRenderTarget(e,t){return new r4(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===Yr?o="ivec":r===xi&&(o="uvec"),s===Id||s===Uh?r===Yr?t="int":r===xi?t="uint":t="float":s===Ws||s===kh?t=`${o}2`:s===Rd||s===pb?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=Yee.get(a);l===void 0&&(l=new Map,Yee.set(a,l));let c=cx(o);s=l.get(c),s===void 0&&(s=new lS(e,t),l.set(c,s))}else s=new lS(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 LR)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===h0||e.magFilter===Oc||e.magFilter===Uo||e.minFilter===Mi||e.minFilter===h0||e.minFilter===Oc||e.minFilter===Uo}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 Xw(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(Nse(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 AR(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")}( ${AR(t.r)}, ${AR(t.g)}, ${AR(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 T4(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===Yr?"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=Tte(e),r=t==="float"?"":t[0];return/mat2/.test(t)===!0&&(n=n.replace("vec","mat")),r+n}getTypeFromArray(e){return vIe.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 zv)&&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=BR(this.stack);let e=U9();return this.stacks.push(e),Yw(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,Yw(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 T4(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 hk(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 lk(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 E4(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 ck(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=Zee.get(t);n===void 0&&(n=new WeakMap,Zee.set(t,n));let r=n.get(e);if(r===void 0){r=new x4;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 d4(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 Xw,this.stack=BR();for(let u of PR)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 kU(Fg(i,"int")).toStack(),_Ee=()=>oc("continue").toStack(),_re=()=>oc("break").toStack(),AO=new WeakMap,ec=new xn,pee=new WeakMap,mee=me(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{let o=de(Jne).mul(t).add(s),a=o.div(n),l=o.sub(a.mul(n));return vs(i,Ur(l,a)).depth(r).xyz.mul(e)});function xEe(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=AO.get(i);if(o===void 0||o.count!==s){let T=function(){w.dispose(),AO.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 IA(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&&(ec.fromBufferAttribute(P,L),y[D+C+0]=ec.x,y[D+C+1]=ec.y,y[D+C+2]=ec.z,y[D+C+3]=0),t===!0&&(ec.fromBufferAttribute(I,L),y[D+C+4]=ec.x,y[D+C+5]=ec.y,y[D+C+6]=ec.z,y[D+C+7]=0),n===!0&&(ec.fromBufferAttribute(F,L),y[D+C+8]=ec.x,y[D+C+9]=ec.y,y[D+C+10]=ec.z,y[D+C+11]=F.itemSize===4?ec.w:1)}}o={count:s,texture:w,stride:u,size:new Oe(f,d)},AO.set(i,o),i.addEventListener("dispose",T)}return o}var xre=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=pee.get(i);(o===void 0||o.count!==s)&&(o={base:Xt(1),influences:i.morphTargetInfluences?Wo(i.morphTargetInfluences,"float"):null,count:s},pee.set(i,o));let{base:a,influences:l}=o,{texture:c,stride:u,size:f}=xEe(e);t===!0&&Er.mulAssign(a),n===!0&&ya.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(vs(i.morphTexture,Ur(de(A).add(1),de(Hu))).r):y.assign(l.element(A).toVar()),$t(y.notEqual(0),()=>{t===!0&&Er.addAssign(mee({bufferMap:c,influence:y,stride:u,width:d,depth:A,offset:de(0)})),n===!0&&ya.addAssign(mee({bufferMap:c,influence:y,stride:u,width:d,depth:A,offset:de(1)}))})}),vS(({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"),pm=class extends Kt{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}},zU=class extends pm{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}},VU=class extends Qw{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)}},yre=$n(VU),GU=class extends pm{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}},bg=new Oe,ix=class extends Jc{static get type(){return"ViewportTextureNode"}constructor(e=qu,t=null,n=null){let r=null;n===null?(r=new FA,r.minFilter=ko,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(bg):s.getDrawingBufferSize?s.getDrawingBufferSize(bg):bg.set(s.width,s.height);let o=this.getTextureForReference(s);(o.image.width!==bg.width||o.image.height!==bg.height)&&(o.image.width=bg.width,o.image.height=bg.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}},yEe=$n(ix).setParameterLength(0,3),kz=$n(ix,null,null,{generateMipmaps:!0}).setParameterLength(0,3),bEe=kz(),bre=(i=qu,e=null)=>bEe.sample(i,e),gO=null,qU=class extends ix{static get type(){return"ViewportDepthTextureNode"}constructor(e=qu,t=null,n=null){n===null&&(gO===null&&(gO=new Es),n=gO),super(e,t,n)}},zz=$n(qU).setParameterLength(0,3),Xu=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=Tre().assign(n));else if(t===i.DEPTH)e.isPerspectiveCamera?r=Vz(_s.z,im,rm):r=kg(_s.z,im,rm);else if(t===i.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){let s=mI(n,im,rm);r=kg(s,im,rm)}else r=n;else r=kg(_s.z,im,rm);return r}};Xu.DEPTH_BASE="depthBase";Xu.DEPTH="depth";Xu.LINEAR_DEPTH="linearDepth";var kg=(i,e,t)=>i.add(e).div(e.sub(t)),wEe=(i,e,t)=>i.add(t).div(t.sub(e)),wre=me(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?t.sub(e).mul(i).sub(t):e.sub(t).mul(i).sub(e)),Vz=(i,e,t)=>e.add(i).mul(t).div(t.sub(e).mul(i)),Sre=(i,e,t)=>e.mul(i.add(t)).div(i.mul(e.sub(t))),mI=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))),AI=(i,e,t)=>{e=e.max(1e-6).toVar();let n=mf(i.negate().div(e)),r=mf(t.div(e));return n.div(r)},SEe=(i,e,t)=>{let n=i.mul(sI(t.div(e)));return oe(Math.E).pow(n).mul(e).negate()},Tre=$n(Xu,Xu.DEPTH_BASE),Gz=xt(Xu,Xu.DEPTH),i4=$n(Xu,Xu.LINEAR_DEPTH).setParameterLength(0,1),TEe=i4(zz());Gz.assign=i=>Tre(i);var bf=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=Wo(t).setGroup(Jt);Oi(o,({i:c})=>{let u=l.element(c);n.assign(_s.dot(u.xyz).negate().add(u.w)),r.assign(n.fwidth().div(2)),s.mulAssign(uc(r.negate(),r,n))})}let a=e.length;if(a>0){let l=Wo(e).setGroup(Jt),c=oe(1).toVar("intersectionClipOpacity");Oi(a,({i:u})=>{let f=l.element(u);n.assign(_s.dot(f.xyz).negate().add(f.w)),r.assign(n.fwidth().div(2)),c.mulAssign(uc(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=Wo(t).setGroup(Jt);Oi(n,({i:o})=>{let a=s.element(o);_s.dot(a.xyz).greaterThan(a.w).discard()})}let r=e.length;if(r>0){let s=Wo(e).setGroup(Jt),o=lc(!0).toVar("clipped");Oi(r,({i:a})=>{let l=s.element(a);o.assign(_s.dot(l.xyz).greaterThan(l.w).and(o))}),o.discard()}})()}setupHardwareClipping(e,t){let n=e.length;return t.enableHardwareClipping(n),me(()=>{let r=Wo(e).setGroup(Jt),s=Zd(t.getClipDistance());Oi(n,({i:o})=>{let a=r.element(o),l=_s.dot(a.xyz).sub(a.w).negate();s.element(o).assign(l)})})()}};bf.ALPHA_TO_COVERAGE="alphaToCoverage";bf.DEFAULT="default";bf.HARDWARE="hardware";var EEe=()=>new bf,MEe=()=>new bf(bf.ALPHA_TO_COVERAGE),CEe=()=>new bf(bf.HARDWARE),REe=.05,Aee=me(([i])=>Wu(Tn(1e4,Ya(Tn(17,i.x).add(Tn(.1,i.y)))).mul(Is(.1,fr(Ya(Tn(13,i.y).add(i.x))))))),gee=me(([i])=>Aee(dt(Aee(i.xy),i.z))),IEe=me(([i])=>{let e=kr(gf(tz(i.xyz)),gf(nz(i.xyz))),t=oe(1).div(oe(REe).mul(e)).toVar("pixScale"),n=dt(ex(Af(mf(t))),ex(oI(mf(t)))),r=dt(gee(Af(n.x.mul(i.xyz))),gee(Af(n.y.mul(i.xyz)))),s=Wu(mf(t)),o=Is(Tn(s.oneMinus(),r.x),Tn(s,r.y)),a=Ml(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"}]}),HU=class extends KR{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}},Ere=(i=0)=>new HU(i),Rr=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(cx(t.slice(0,-4)),n.getCacheKey());return this.type+AS(e)}build(e){this.setup(e)}setupObserver(e){return new jO(e)}setup(e){e.context.setupNormal=()=>Ug(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=Ug(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),$_.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&&$_.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=MEe():e.stack.addToStack(EEe())}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(CEe()),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=AI(_s.z,im,rm):r=kg(_s.z,im,rm))}r!==null&&Gz.assign(r).toStack()}setupPositionView(){return yf.mul(Er).xyz}setupModelViewProjection(){return Ka.mul(_s)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),ure}setupPosition(e){let{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&xre(t),t.isSkinnedMesh===!0&&vre(t),this.displacementMap){let r=Gd("displacementMap","texture"),s=Gd("displacementScale","float"),o=Gd("displacementBias","float");Er.addAssign(ya.normalize().mul(r.x.mul(s).add(o)))}return t.isBatchedMesh&&mre(t),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&pre(t),this.positionNode!==null&&Er.assign(Ug(this.positionNode,"POSITION","vec3")),Er}setupDiffuseColor(e){let{object:t,geometry:n}=e;this.maskNode!==null&&lc(this.maskNode).not().discard();let r=this.colorNode?Ft(this.colorNode):Uie;this.vertexColors===!0&&n.hasAttribute("color")&&(r=r.mul(Ere())),t.instanceColor&&(r=Bz.mul(r)),t.isBatchedMesh&&t._colorsTexture&&(r=Oz.mul(r)),Bi.assign(r);let s=this.opacityNode?oe(this.opacityNode):Iz;Bi.a.assign(Bi.a.mul(s));let o=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(o=this.alphaTestNode!==null?oe(this.alphaTestNode):Oie,this.alphaToCoverage===!0?(Bi.a=uc(o,o.add(rz(Bi.a)),Bi.a),Bi.a.lessThanEqual(0).discard()):Bi.a.lessThanEqual(o).discard()),this.alphaHash===!0&&Bi.a.lessThan(IEe(Er)).discard(),e.isOpaque()&&Bi.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?pe(0):Bi.rgb}setupNormal(){return this.normalNode?pe(this.normalNode):Wie}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Gd("envMap","cubeTexture"):Gd("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new GU(Fz)),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 zU(e.context.ambientOcclusion)),t}setupAmbientOcclusion(e){let t=this.aoNode;t===null&&e.material.aoMap&&(t=cre),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=yre(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)&&(nU.assign(pe(s||zie)),c=c.add(nU)),c}setupFog(e,t){let n=e.fogNode;return n&&($_.assign(t),t=Ft(n.toVar())),t}setupPremultipliedAlpha(e,t){return gz(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}},PEe=new Cu,WU=class extends Rr{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(PEe),this.setValues(e)}},LEe=new U2,jU=class extends Rr{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(LEe),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):Nz,t=this.dashScaleNode?oe(this.dashScaleNode):Pz,n=this.dashSizeNode?oe(this.dashSizeNode):Lz,r=this.gapSizeNode?oe(this.gapSizeNode):Dz;Og.assign(n),Kw.assign(r);let s=Am(ac("lineDistance").mul(t));(e?s.add(e):s).mod(Og.add(Kw)).greaterThan(Og).discard()}};var FR=Jg("vec3","worldStart"),XU=Jg("vec3","worldEnd"),Mre=Jg("float","lineDistance"),Cg=Jg("vec4","worldPos"),vee=me(({start:i,end:e})=>{let t=Ka.element(2).element(2),n=Ka.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"}),DEe=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"}),Yot=me(({material:i})=>{let e=i._useDash,t=i._useWorldUnits,n=ac("instanceStart"),r=ac("instanceEnd"),s=Ft(yf.mul(Ft(n,1))).toVar("start"),o=Ft(yf.mul(Ft(r,1))).toVar("end"),a,l;e&&(a=oe(ac("instanceDistanceStart")).toVar("distanceStart"),l=oe(ac("instanceDistanceEnd")).toVar("distanceEnd")),t&&(FR.assign(s.xyz),XU.assign(o.xyz));let c=Q_.z.div(Q_.w),u=Ka.element(2).element(3).equal(-1);if($t(u,()=>{$t(s.z.lessThan(0).and(o.z.greaterThan(0)),()=>{let T=vee({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=vee({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):Pz,R=i.offsetNode?oe(i.offsetNode):Nz,P=Aa.y.lessThan(.5).select(T.mul(a),T.mul(l));P=P.add(R),Mre.assign(P)}let f=Ka.mul(s),d=Ka.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);Cg.assign(Aa.y.lessThan(.5).select(s,o));let F=e4.mul(.5);Cg.addAssign(Ft(Aa.x.lessThan(0).select(P.mul(F),P.mul(F).negate()),0)),e||(Cg.addAssign(Ft(Aa.y.lessThan(.5).select(T.mul(F).negate(),T.mul(F)),0)),Cg.addAssign(Ft(I.mul(F),0)),$t(Aa.y.greaterThan(1).or(Aa.y.lessThan(0)),()=>{Cg.subAssign(Ft(I.mul(2).mul(F),0))})),S.assign(Ka.mul(Cg));let D=pe().toVar();D.assign(Aa.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(Aa.x.lessThan(0).select(T.negate(),T)),$t(Aa.y.lessThan(0),()=>{T.assign(T.sub(w))}).ElseIf(Aa.y.greaterThan(1),()=>{T.assign(T.add(w))}),T.assign(T.mul(e4)),T.assign(T.div(Q_.w.div(yz))),S.assign(Aa.y.lessThan(.5).select(f,d)),T.assign(T.mul(S.w)),S.assign(S.add(Ft(T,0,0)))}return S})(),Zot=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):Lz,l=i.gapSizeNode?oe(i.gapSizeNode):Dz;Og.assign(a),Kw.assign(l),s.y.lessThan(-1).or(s.y.greaterThan(1)).discard(),Mre.mod(Og.add(Kw)).greaterThan(Og).discard()}let o=oe(1).toVar("alpha");if(r){let a=Cg.xyz.normalize().mul(1e5),l=XU.sub(FR),c=DEe({p1:FR,p2:XU,p3:pe(0,0,0),p4:a}),u=FR.add(l.mul(c.x)),f=a.mul(c.y),y=u.sub(f).length().div(e4);if(!n)if(t&&e.currentSamples>0){let w=y.fwidth();o.assign(uc(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(uc(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 NEe=new B2,$U=class extends Rr{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(NEe),this.setValues(e)}setupDiffuseColor(){let e=this.opacityNode?oe(this.opacityNode):Iz;Bi.assign(lI(Ft(Cz(hi),e),Nr))}},qz=me(([i=wz])=>{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)}),YU=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)}),r4=class extends Na{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 Rh(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 Ru(5,5,5),o=qz(wz),a=new Rr;a.colorNode=fi(t,o,0),a.side=mi,a.blending=ds;let l=new Hn(s,a),c=new e0;c.add(l),t.minFilter===ko&&(t.minFilter=Mi);let u=new $v(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)}},Ww=new WeakMap,ZU=class extends Cr{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=Za(null);let t=new Rh;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===c0||o===u0){if(Ww.has(s)){let a=Ww.get(s);_ee(a,s.mapping),this._cubeTexture=a}else{let a=s.image;if(FEe(a)){let l=new r4(a.height);l.fromEquirectangularTexture(t,s),_ee(l.texture,s.mapping),this._cubeTexture=l.texture,Ww.set(s,l.texture),s.addEventListener("dispose",Cre)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}};function FEe(i){return i==null?!1:i.height>0}function Cre(i){let e=i.target;e.removeEventListener("dispose",Cre);let t=Ww.get(e);t!==void 0&&(Ww.delete(e),t.dispose())}function _ee(i,e){e===c0?i.mapping=Yl:e===u0&&(i.mapping=Bc)}var Rre=$n(ZU).setParameterLength(1),tS=class extends pm{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=Rre(this.envNode)}},KU=class extends pm{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)}},rx=class{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}},s4=class extends rx{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 WA:r.rgb.assign(Qn(r.rgb,r.rgb.mul(s.rgb),Hw.mul(NR)));break;case vM:r.rgb.assign(Qn(r.rgb,s.rgb,Hw.mul(NR)));break;case _M:r.rgb.addAssign(s.rgb.mul(Hw.mul(NR)));break;default:Xe("BasicLightingModel: Unsupported .combine value:",t.combine);break}}},BEe=new hs,QU=class extends Rr{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(BEe),this.setValues(e)}setupNormal(){return t1(tx)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new tS(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new KU(Fz)),t}setupOutgoingLight(){return Bi.rgb}setupLightingModel(){return new s4}},sx=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))}),Xg=me(i=>i.diffuseColor.mul(1/Math.PI)),OEe=()=>oe(.25),UEe=me(({dotNH:i})=>HR.mul(oe(.5)).add(1).mul(oe(1/Math.PI)).mul(i.pow(HR))),kEe=me(({lightDirection:i})=>{let e=i.add(er).normalize(),t=hi.dot(e).clamp(),n=er.dot(e).clamp(),r=sx({f0:fm,f90:1,dotVH:n}),s=OEe(),o=UEe({dotNH:t});return r.mul(s).mul(o)}),o4=class extends s4{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(Xg({diffuseColor:Bi.rgb}))),this.specular===!0&&n.directSpecular.addAssign(s.mul(kEe({lightDirection:e})).mul(Hw))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(Xg({diffuseColor:Bi}))),r.indirectDiffuse.mulAssign(t)}},zEe=new za,JU=class extends Rr{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(zEe),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new tS(t):null}setupLightingModel(){return new o4(!1)}},VEe=new zA,e7=class extends Rr{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(VEe),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new tS(t):null}setupLightingModel(){return new o4}setupVariants(){let e=(this.shininessNode?oe(this.shininessNode):kie).max(1e-4);HR.assign(e);let t=this.specularNode||Vie;fm.assign(t)}},Ire=me(i=>{if(i.geometry.hasAttribute("normal")===!1)return oe(0);let e=tx.dFdx().abs().max(tx.dFdy().abs());return e.x.max(e.y).max(e.z)}),Hz=me(i=>{let{roughness:e}=i,t=Ire(),n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),Pre=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 cc(.5,r.add(s).max(rI))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),GEe=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 cc(.5,l.add(c).max(rI))}).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"}]}),Lre=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"}]}),qEe=oe(1/Math.PI),HEe=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 qEe.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"}]}),Wz=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=sx({f0:e,f90:t,dotVH:A}),w,S;if(J_(o)&&(y=tI.mix(y,r)),J_(a)){let T=Gw.dot(i),R=Gw.dot(er),P=Gw.dot(c),I=Bg.dot(i),F=Bg.dot(er),D=Bg.dot(c);w=GEe({alphaT:qR,alphaB:l,dotTV:R,dotBV:F,dotTL:T,dotBL:I,dotNV:f,dotNL:u}),S=HEe({alphaT:qR,alphaB:l,dotNH:d,dotTH:P,dotBH:D})}else w=Pre({alpha:l,dotNL:u,dotNV:f}),S=Lre({alpha:l,dotNH:d});return y.mul(w).mul(S)}),WEe=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]),af=null,nS=me(({roughness:i,dotNV:e})=>{af===null&&(af=new NA(WEe,16,16,Ws,Wi),af.name="DFG_LUT",af.minFilter=Mi,af.magFilter=Mi,af.wrapS=oa,af.wrapT=oa,af.generateMipmaps=!1,af.needsUpdate=!0);let t=dt(i,e);return fi(af,t).rg}),jEe=me(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o})=>{let a=Wz({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=nS({roughness:n,dotNV:c}),f=nS({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(rI)),I=S.mul(T),F=P.mul(I);return a.add(F)}),Dre=me(i=>{let{dotNV:e,specularColor:t,specularF90:n,roughness:r}=i,s=nS({dotNV:e,roughness:r});return t.mul(s.x).add(n.mul(s.y))}),t7=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"}]}),XEe=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"}]}),$Ee=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"}]}),YEe=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=XEe({roughness:nm,dotNH:r}),o=$Ee({dotNV:n,dotNL:t});return rc.mul(s).mul(o)}),xee=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"}]}),ZEe=me(({f:i})=>{let e=i.length();return kr(e.mul(e).add(i.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),nR=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,kr(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"}]}),vO=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(So(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(nR({v1:w,v2:S})),P.addAssign(nR({v1:S,v2:T})),P.addAssign(nR({v1:T,v2:R})),P.addAssign(nR({v1:R,v2:w})),f.assign(pe(ZEe({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 gI=1/6,Nre=i=>Tn(gI,Tn(i,Tn(i,i.negate().add(3)).sub(3)).add(1)),n7=i=>Tn(gI,Tn(i,Tn(i,Tn(3,i).sub(6))).add(4)),Fre=i=>Tn(gI,Tn(i,Tn(i,Tn(-3,i).add(3)).add(3)).add(1)),i7=i=>Tn(gI,$c(i,3)),yee=i=>Nre(i).add(n7(i)),bee=i=>Fre(i).add(i7(i)),wee=i=>Is(-1,n7(i).div(Nre(i).add(n7(i)))),See=i=>Is(1,i7(i).div(Fre(i).add(i7(i)))),Tee=(i,e,t)=>{let n=i.uvNode,r=Tn(n,e.zw).add(.5),s=Af(r),o=Wu(r),a=yee(o.x),l=bee(o.x),c=wee(o.x),u=See(o.x),f=wee(o.y),d=See(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=yee(o.y).mul(Is(a.mul(i.sample(A).level(t)),l.mul(i.sample(y).level(t)))),R=bee(o.y).mul(Is(a.mul(i.sample(w).level(t)),l.mul(i.sample(S).level(t))));return T.add(R)},jz=me(([i,e])=>{let t=dt(i.size(de(e))),n=dt(i.size(de(e.add(1)))),r=cc(1,t),s=cc(1,n),o=Tee(i,Ft(r,t),Af(e)),a=Tee(i,Ft(s,n),oI(e));return Wu(e).mix(o,a)}),KEe=me(([i,e])=>{let t=e.mul(_z(i));return jz(i,t)}),Eee=me(([i,e,t,n,r])=>{let s=pe(lz(e.negate(),_a(i),cc(1,n))),o=pe(gf(r[0].xyz),gf(r[1].xyz),gf(r[2].xyz));return _a(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"}]}),QEe=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"}]}),JEe=kz(),e3e=bre(),Mee=me(([i,e,t],{material:n})=>{let s=(n.side===mi?JEe:e3e).sample(i),o=mf(Wg.x).mul(QEe(e,t));return jz(s,o)}),Cee=me(([i,e,t])=>($t(t.notEqual(0),()=>{let n=sI(e).negate().div(t);return Y9(n.negate().mul(i))}),pe(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),t3e=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=Eee(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=Mee(G,t,C);w.element(L).assign(W.element(L)),w.a.addAssign(W.a),S.element(L).assign(n.element(L).mul(Cee(gf(B),d,A).element(L)))}),w.a.divAssign(3)}else{let F=Eee(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=Mee(C,t,u),S=n.mul(Cee(gf(F),d,A))}let T=S.rgb.mul(w.rgb),R=i.dot(e).clamp(),P=pe(Dre({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())}),n3e=So(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),i3e=i=>{let e=i.sqrt();return pe(1).add(e).div(pe(1).sub(e))},Ree=(i,e)=>i.sub(e).div(i.add(e)).pow2(),r3e=(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),n3e.mul(a)},Iee=me(({outsideIOR:i,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:r})=>{let s=Qn(i,e,uc(0,.03,n)),a=i.div(s).pow2().mul(t.pow2().oneMinus()).oneMinus();$t(a.lessThan(0),()=>pe(1));let l=a.sqrt(),c=Ree(s,i),u=sx({f0:c,f90:1,dotVH:t}),f=u.oneMinus(),d=s.lessThan(i).select(Math.PI,0),A=oe(Math.PI).sub(d),y=i3e(r.clamp(0,.9999)),w=Ree(y,s.toVec3()),S=sx({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=r3e(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"}]}),bw=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()}),ww=pe(.04),iR=oe(1),a4=class extends rx{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=Iee({outsideIOR:oe(1),eta2:VR,cosTheta1:t,thinFilmThickness:GR,baseF0:fm}),r=Iee({outsideIOR:oe(1),eta2:VR,cosTheta1:t,thinFilmThickness:GR,baseF0:Bi.rgb});this.iridescenceFresnel=Qn(n,r,Hd),this.iridescenceF0Dielectric=t7({f:n,f90:1,dotVH:t}),this.iridescenceF0Metallic=t7({f:r,f90:1,dotVH:t}),this.iridescenceF0=Qn(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,Hd)}if(this.transmission===!0){let t=vf,n=hie.sub(vf).normalize(),r=_m,s=e.context;s.backdrop=t3e(r,n,df,Rg,Pg,Lg,t,Yc,vm,Ka,qw,H9,j9,W9,this.dispersion?X9:null),s.backdropAlpha=WR,Bi.a.mulAssign(Qn(1,s.backdrop.a,WR))}super.start(e)}computeMultiscattering(e,t,n,r,s=null){let o=hi.dot(er).clamp(),a=nS({roughness:df,dotNV:o}),l=s?tI.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(YEe({lightDirection:e})));let o=bw({normal:hi,viewDir:er,roughness:nm}),a=bw({normal:hi,viewDir:e,roughness:nm}),l=rc.r.max(rc.g).max(rc.b).mul(o.max(a)).oneMinus();s.mulAssign(l)}if(this.clearcoat===!0){let a=sm.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(a.mul(Wz({lightDirection:e,f0:ww,f90:iR,roughness:X_,normalView:sm})))}n.directDiffuse.addAssign(s.mul(Xg({diffuseColor:Rg}))),n.directSpecular.addAssign(s.mul(jEe({lightDirection:e,f0:Pg,f90:1,roughness:df,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=_s.toVar(),w=xee({N:d,V:A,roughness:df}),S=o.sample(w).toVar(),T=a.sample(w).toVar(),R=So(pe(S.x,0,S.y),pe(0,1,0),pe(S.z,0,S.w)).toVar(),P=Pg.mul(T.x).add(Lg.sub(Pg).mul(T.y)).toVar();if(s.directSpecular.addAssign(e.mul(P).mul(vO({N:d,V:A,P:y,mInv:R,p0:l,p1:c,p2:u,p3:f}))),s.directDiffuse.addAssign(e.mul(Rg).mul(vO({N:d,V:A,P:y,mInv:So(1,0,0,0,1,0,0,0,1),p0:l,p1:c,p2:u,p3:f}))),this.clearcoat===!0){let I=sm,F=xee({N:I,V:A,roughness:X_}),D=o.sample(F),L=a.sample(F),C=So(pe(D.x,0,D.y),pe(0,1,0),pe(D.z,0,D.w)),B=ww.mul(L.x).add(iR.sub(ww).mul(L.y));this.clearcoatSpecularDirect.addAssign(e.mul(B).mul(vO({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(Xg({diffuseColor:Rg})).toVar();if(this.sheen===!0){let s=bw({normal:hi,viewDir:er,roughness:nm}),o=rc.r.max(rc.g).max(rc.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(rc,bw({normal:hi,viewDir:er,roughness:nm}))),this.clearcoat===!0){let S=sm.dot(er).clamp(),T=Dre({dotNV:S,specularColor:ww,specularF90:iR,roughness:X_});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,Lg,fm,this.iridescenceF0Dielectric),this.computeMultiscattering(a,l,Lg,Bi.rgb,this.iridescenceF0Metallic);let c=Qn(s,a,Hd),u=Qn(o,l,Hd),f=s.add(o),d=Rg.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=bw({normal:hi,viewDir:er,roughness:nm}),T=rc.r.max(rc.g).max(rc.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=df.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=sm.dot(er).clamp(),r=sx({dotVH:n,f0:ww,f90:iR}),s=t.mul(zR.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(zR));t.assign(s)}if(this.sheen===!0){let n=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(n)}}},Pee=oe(1),r7=oe(-2),rR=oe(.8),_O=oe(-1),sR=oe(.4),xO=oe(2),oR=oe(.305),yO=oe(3),Lee=oe(.21),s3e=oe(4),Dee=oe(4),o3e=oe(16),a3e=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(va(i.x.greaterThan(0),0,3))}).Else(()=>{t.assign(va(i.y.greaterThan(0),1,4))})}).Else(()=>{$t(e.z.greaterThan(e.y),()=>{t.assign(va(i.z.greaterThan(0),2,5))}).Else(()=>{t.assign(va(i.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),l3e=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"}]}),c3e=me(([i])=>{let e=oe(0).toVar();return $t(i.greaterThanEqual(rR),()=>{e.assign(Pee.sub(i).mul(_O.sub(r7)).div(Pee.sub(rR)).add(r7))}).ElseIf(i.greaterThanEqual(sR),()=>{e.assign(rR.sub(i).mul(xO.sub(_O)).div(rR.sub(sR)).add(_O))}).ElseIf(i.greaterThanEqual(oR),()=>{e.assign(sR.sub(i).mul(yO.sub(xO)).div(sR.sub(oR)).add(xO))}).ElseIf(i.greaterThanEqual(Lee),()=>{e.assign(oR.sub(i).mul(s3e.sub(yO)).div(oR.sub(Lee)).add(yO))}).Else(()=>{e.assign(oe(-2).mul(mf(Tn(1.16,i))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),Bre=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"}]}),Ore=me(([i,e,t,n,r,s])=>{let o=oe(t),a=pe(e),l=ju(c3e(o),r7,s),c=Wu(l),u=Af(l),f=pe(iS(i,a,u,n,r,s)).toVar();return $t(c.notEqual(0),()=>{let d=pe(iS(i,a,u.add(1),n,r,s)).toVar();f.assign(Qn(f,d,c))}),f}),iS=me(([i,e,t,n,r,s])=>{let o=oe(t).toVar(),a=pe(e),l=oe(a3e(a)).toVar(),c=oe(kr(Dee.sub(o),0)).toVar();o.assign(kr(o,Dee));let u=oe(ex(o)).toVar(),f=dt(l3e(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,o3e))),f.y.addAssign(Tn(4,ex(s).sub(u))),f.x.mulAssign(n),f.y.mulAssign(r),i.sample(f).grad(dt(),dt())}),bO=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=Vu(n),c=t.mul(l).add(r.cross(t).mul(Ya(n))).add(r.mul(r.dot(t).mul(l.oneMinus())));return iS(i,c,e,s,o,a)}),Ure=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(va(e,t,jd(t,n))).toVar();$t(d.equal(pe(0)),()=>{d.assign(pe(n.z,0,n.x.negate()))}),d.assign(_a(d));let A=pe().toVar();return A.addAssign(r.element(0).mul(bO({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),()=>{_re()});let w=oe(o.mul(oe(y))).toVar();A.addAssign(r.element(y).mul(bO({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(bO({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)}),u3e=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)}),h3e=me(([i,e])=>dt(oe(i).div(oe(e)),u3e(i))),f3e=me(([i,e,t])=>{let n=t.mul(t).toConst(),r=pe(1,0,0).toConst(),s=jd(e,r).toConst(),o=Qa(i.x).toConst(),a=Tn(2,3.14159265359).mul(i.y).toConst(),l=o.mul(Vu(a)).toConst(),c=o.mul(Ya(a)).toVar(),u=Tn(.5,e.z.add(1)).toConst();c.assign(u.oneMinus().mul(Qa(l.mul(l).oneMinus())).add(u.mul(c)));let f=r.mul(l).add(s.mul(c)).add(e.mul(Qa(kr(0,l.mul(l).add(c.mul(c)).oneMinus()))));return _a(pe(n.mul(f.x),n.mul(f.y),kr(0,f.z)))}),kre=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(iS(t,l,e,s,o,a))}).Else(()=>{let f=va(fr(l.z).lessThan(.999),pe(0,0,1),pe(1,0,0)),d=_a(jd(f,l)).toVar(),A=jd(l,d).toVar();Oi({start:rt(0),end:r},({i:y})=>{let w=h3e(y,r),S=f3e(w,pe(0,0,1),i),T=_a(d.mul(S.x).add(A.mul(S.y)).add(l.mul(S.z))),R=_a(T.mul(Qc(l,T).mul(2)).sub(l)),P=kr(Qc(l,R),0);$t(P.greaterThan(0),()=>{let I=iS(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)}),lm=4,Nee=[.125,.215,.35,.446,.526,.582],Ig=20,d3e=512,Sw=new Iu(-1,1,1,-1,0,1),p3e=new Xr(90,1),Fee=new zt,wO=null,SO=0,TO=0,m3e=new re,l4=new WeakMap,A3e=[3,1,5,0,4,2],EO=Bre(Ui(),ac("faceIndex")).normalize(),vI=pe(EO.x,EO.y,EO.z),s7=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=m3e,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.');wO=this._renderer.getRenderTarget(),SO=this._renderer.getActiveCubeFace(),TO=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=Oee(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Uee(),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===Yl||e.mapping===Bc?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(wO,SO,TO),e.scissorTest=!1,this._setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),wO=this._renderer.getRenderTarget(),SO=this._renderer.getActiveCubeFace(),TO=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 Bee(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=Bee(e.width,e.height);let{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=g3e(t)),this._blurMaterial=v3e(t,e.width,e.height),this._ggxMaterial=_3e(t,e.width,e.height)}}async _compileMaterial(e){let t=new Hn(new Xn,e);await this._renderer.compile(t,Sw)}_sceneToCubeUV(e,t,n,r,s){let o=p3e;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(Fee),c.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new Hn(new Ru,new hs({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(Fee),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===Yl||e.mapping===Bc;r?this._cubemapMaterial===null&&(this._cubemapMaterial=Oee(e)):this._equirectMaterial===null&&(this._equirectMaterial=Uee(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,Sw)}_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=l4.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-lm?n-y+lm: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,Sw),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,Sw)}_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=l4.get(c),A=this._sizeLods[n]-1,y=isFinite(s)?Math.PI/(2*A):2*Math.PI/(2*Ig-1),w=s/y,S=isFinite(s)?1+Math.floor(u*w):Ig;S>Ig&&Xe(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${Ig}`);let T=[],R=0;for(let L=0;L<Ig;++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-lm?r-P+lm:0),D=4*(this._cubeSize-I);this._setViewport(t,F,D,3*I,2*I),l.setRenderTarget(t),l.render(f,Sw)}_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 g3e(i){let e=[],t=[],n=[],r=i,s=i-lm+1+Nee.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-lm?l=Nee[o-i+lm-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=A3e[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>lm&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function Bee(i,e,t){let n={magFilter:Mi,minFilter:Mi,generateMipmaps:!1,type:Wi,format:Br,colorSpace:Zp,depthBuffer:t},r=new Na(i,e,n);return r.texture.mapping=Fh,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function _I(i){let e=new Rr;return e.depthTest=!1,e.depthWrite=!1,e.blending=ds,e.name=`PMREM_${i}`,e}function v3e(i,e,t){let n=Wo(new Array(Ig).fill(0)),r=Xt(new re(0,1,0)),s=Xt(0),o=oe(Ig),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:vI,dTheta:s,samples:l,envMap:c,mipInt:u,CUBEUV_TEXEL_WIDTH:f,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:A},w=_I("blur");return w.fragmentNode=Ure({...y,latitudinal:a.equal(1)}),l4.set(w,y),w}function _3e(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=_I("ggx");return u.fragmentNode=kre({...c,N_immutable:vI,GGX_SAMPLES:rt(d3e)}),l4.set(u,c),u}function Oee(i){let e=_I("cubemap");return e.fragmentNode=Za(i,vI),e}function Uee(i){let e=_I("equirect");return e.fragmentNode=fi(i,qz(vI),0),e}var kee=new WeakMap;function x3e(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 y3e(i,e,t){let n=b3e(e),r=n.get(i);if((r!==void 0?r.pmremVersion:-1)!==i.pmremVersion){let o=i.image;if(i.isCubeTexture)if(w3e(o))r=t.fromCubemap(i,r);else return null;else if(S3e(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 b3e(i){let e=kee.get(i);return e===void 0&&(e=new WeakMap,kee.set(i,e)),e}var o7=class extends Cr{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=x3e(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===Fh?t=r:t=y3e(r,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new s7(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=this._pmrem.isRenderTargetTexture?JR.mul(pe(t.x,t.y.negate(),t.z)):JR.mul(t);let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),Ore(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}};function w3e(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 S3e(i){return i==null?!1:i.height>0}var Xz=$n(o7).setParameterLength(1,3),zee=new WeakMap,a7=class extends pm{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=Xz(f),d.set(f,A)),n=A}let s=t.useAnisotropy===!0||t.anisotropy>0?Fie:hi,o=n.context(Vee(df,s)).mul(DR),a=n.context(T3e(_m)).mul(Math.PI).mul(DR),l=Z_(o),c=Z_(a);e.context.radiance.addAssign(l),e.context.iblIrradiance.addAssign(c);let u=e.context.lightingModel.clearcoatRadiance;if(u){let f=n.context(Vee(X_,sm)).mul(DR),d=Z_(f);u.addAssign(d)}}_getPMREMNodeCache(e){let t=zee.get(e);return t===void 0&&(t=new WeakMap,zee.set(e,t)),t}},Vee=(i,e)=>{let t=null;return{getUV:()=>(t===null&&(t=er.negate().reflect(e),t=oz(i).mix(t,e).normalize(),t=t.transformDirection(gS)),t),getTextureLevel:()=>i}},T3e=i=>({getUV:()=>i,getTextureLevel:()=>oe(1)}),E3e=new Xv,c4=class extends Rr{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(E3e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new a7(t):null}setupLightingModel(){return new a4}setupSpecular(){let e=Qn(pe(.04),Bi.rgb,Hd);fm.assign(pe(.04)),Pg.assign(e),Lg.assign(1)}setupVariants(){let e=this.metalnessNode?oe(this.metalnessNode):Hie;Hd.assign(e);let t=this.roughnessNode?oe(this.roughnessNode):qie;t=Hz({roughness:t}),df.assign(t),this.setupSpecular(),Rg.assign(Bi.rgb.mul(e.oneMinus()))}},M3e=new N2,l7=class extends c4{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(M3e),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):rre;qw.assign(e),fm.assign(Ml(sz(qw.sub(1).div(qw.add(1))).mul(Gie),pe(1)).mul(NU)),Pg.assign(Qn(fm,Bi.rgb,Hd)),Lg.assign(Qn(NU,1,Hd))}setupLightingModel(){return new a4(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):jie,n=this.clearcoatRoughnessNode?oe(this.clearcoatRoughnessNode):Xie;zR.assign(t),X_.assign(Hz({roughness:n}))}if(this.useSheen){let t=this.sheenNode?pe(this.sheenNode):Zie,n=this.sheenRoughnessNode?oe(this.sheenRoughnessNode):Kie;rc.assign(t),nm.assign(n)}if(this.useIridescence){let t=this.iridescenceNode?oe(this.iridescenceNode):Jie,n=this.iridescenceIORNode?oe(this.iridescenceIORNode):ere,r=this.iridescenceThicknessNode?oe(this.iridescenceThicknessNode):tre;tI.assign(t),VR.assign(n),GR.assign(r)}if(this.useAnisotropy){let t=(this.anisotropyNode?dt(this.anisotropyNode):Qie).toVar();tm.assign(t.length()),$t(tm.equal(0),()=>{t.assign(dt(1,0))}).Else(()=>{t.divAssign(dt(tm)),tm.assign(tm.saturate())}),qR.assign(tm.pow2().mix(df.pow2(),1)),Gw.assign(Dg[0].mul(t.x).add(Dg[1].mul(t.y))),Bg.assign(Dg[1].mul(t.x).sub(Dg[0].mul(t.y)))}if(this.useTransmission){let t=this.transmissionNode?oe(this.transmissionNode):nre,n=this.thicknessNode?oe(this.thicknessNode):ire,r=this.attenuationDistanceNode?oe(this.attenuationDistanceNode):sre,s=this.attenuationColorNode?pe(this.attenuationColorNode):ore;if(WR.assign(t),H9.assign(n),W9.assign(r),j9.assign(s),this.useDispersion){let o=this.dispersionNode?oe(this.dispersionNode):lre;X9.assign(o)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?pe(this.clearcoatNormalNode):$ie}setup(e){e.context.setupClearcoatNormal=()=>Ug(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}};var C3e=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=Gd("gradientMap","texture").context({getUV:()=>r});return pe(s.r)}else{let s=r.fwidth().mul(.5);return Qn(pe(.7),pe(1),uc(oe(.7).sub(s.x),oe(.7).add(s.x),r.x))}}),c7=class extends rx{direct({lightDirection:e,lightColor:t,reflectedLight:n},r){let s=C3e({normal:hI,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(s.mul(Xg({diffuseColor:Bi.rgb})))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(Xg({diffuseColor:Bi}))),r.indirectDiffuse.mulAssign(t)}},R3e=new F2,u7=class extends Rr{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(R3e),this.setValues(e)}setupLightingModel(){return new c7}},zre=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"),I3e=new O2,h7=class extends Rr{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(I3e),this.setValues(e)}setupVariants(e){let t=zre,n;e.material.matcap?n=Gd("matcap","texture").context({getUV:()=>t}):n=pe(Qn(.2,.8,t.y)),Bi.rgb.mulAssign(n.rgb)}},f7=class extends Cr{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 eI(s,o,o.negate(),s).mul(n)}else{let s=t,o=cm(Ft(1,0,0,0),Ft(0,Vu(s.x),Ya(s.x).negate(),0),Ft(0,Ya(s.x),Vu(s.x),0),Ft(0,0,0,1)),a=cm(Ft(Vu(s.y),0,Ya(s.y),0),Ft(0,1,0,0),Ft(Ya(s.y).negate(),0,Vu(s.y),0),Ft(0,0,0,1)),l=cm(Ft(Vu(s.z),Ya(s.z).negate(),0,0),Ft(Ya(s.z),Vu(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}}},_S=$n(f7).setParameterLength(2),P3e=new Ch,u4=class extends Rr{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(P3e),this.setValues(e)}setupPositionView(e){let{object:t,camera:n}=e,{positionNode:r,rotationNode:s,scaleNode:o,sizeAttenuation:a}=this,l=yf.mul(pe(r||0)),c=dt(Yc[0].xyz.length(),Yc[1].xyz.length());o!==null&&(c=c.mul(dt(o))),n.isPerspectiveCamera&&a===!1&&(c=c.mul(l.z.negate()));let u=Aa.xy;if(t.center&&t.center.isVector2===!0){let A=_Te("center","vec2",t);u=u.sub(A.sub(.5))}u=u.mul(c);let f=oe(s||Yie),d=_S(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)}},L3e=new n0,D3e=new Oe,d7=class extends u4{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(L3e),this.setValues(e)}setupPositionView(){let{positionNode:e}=this;return yf.mul(pe(e||Er)).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):are;c=c.mul(yz),n.isPerspectiveCamera&&a===!0&&(c=c.mul(N3e.div(_s.z.negate()))),s&&s.isNode&&(c=c.mul(dt(s)));let u=Aa.xy;if(r&&r.isNode){let f=oe(r);u=_S(u,f)}return u=u.mul(c),u=u.div(bz.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)}},N3e=Xt(1).onFrameUpdate(function({renderer:i}){let e=i.getSize(D3e);this.value=.5*e.y}),p7=class extends rx{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)}},F3e=new D2,m7=class extends Rr{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(F3e),this.setValues(e)}setupLightingModel(){return new p7}},Kot=$d("vec3"),Qot=$d("vec3"),Jot=$d("vec3");var A7=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()}},wf=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])}},B3e=0,Gee=new WeakMap;function O3e(i){let e=Object.keys(i),t=Gee.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)}Gee.set(i.constructor,t)}for(let n=0;n<t.length;n++)e.push(t[n]);return e}var g7=class{constructor(e,t,n,r,s,o,a,l,c,u){this.id=B3e++,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 O3e(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+",",cx(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=zw(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=zw(e,1)),e=zw(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()}},lf=[],v7=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);lf[0]=e,lf[1]=t,lf[2]=o,lf[3]=s;let u=c.get(lf);return u===void 0?(u=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,s,o,a,l),c.set(lf,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)),lf[0]=null,lf[1]=null,lf[2]=null,lf[3]=null,u}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new wf)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,s,o,a,l,c,u,f){let d=this.getChainMap(f),A=new g7(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}},Sf=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}},Zc={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},om=16,U3e=211,k3e=212,_7=class extends Sf{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===Zc.VERTEX?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===Zc.INDEX?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===Zc.STORAGE?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===Zc.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===tg)&&(this.backend.updateAttribute(e),n.version=r.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}};function Vre(i){return i.index!==null?i.index.version:i.attributes.position.version}function Gre(i){return i.index!==null?i.index.id:i.attributes.position.id}function qee(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?LA:PA)(e,1);return r.version=Vre(i),r.__id=Gre(i),r}var x7=class extends Sf{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,Zc.STORAGE):this.updateAttribute(s,Zc.VERTEX);let n=this.getIndex(e);n!==null&&this.updateAttribute(n,Zc.INDEX);let r=e.geometry.indirect;r!==null&&this.updateAttribute(r,Zc.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=qee(t),s.set(t,o)):(o.version!==Vre(t)||o.__id!==Gre(t))&&(this.attributes.delete(o),o=qee(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===Bh||e.type===Ji?t=1:e.type===Oh||e.type===xl||e.type===Wi?t=2:(e.type===Yr||e.type===xi||e.type===cr)&&(t=4);let n=4;e.format===Qv||e.format===Id||e.format===Uh||e.format===Vs||e.format===_o?n=1:e.format===Ws||e.format===kh?n=2:(e.format===Rd||e.format===mb)&&(n=3);let r=t*n;e.type===jA||e.type===XA?r=2:(e.type===la||e.type===$A||e.type===YA)&&(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}},h4=class{constructor(e){this.cacheKey=e,this.usedTimes=0}},b7=class extends h4{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}},w7=class extends h4{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}},z3e=0,jw=class{constructor(e,t,n,r=null,s=null){this.id=z3e++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=s,this.usedTimes=0}},S7=class extends Sf{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 jw(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 jw(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 jw(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 w7(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 b7(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)}},T7=class extends Sf{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?Zc.INDIRECT:Zc.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?Zc.INDIRECT:Zc.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)}},V3e=Object.freeze([]);function G3e(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 Hee(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 Wee(i){return(i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode)&&i.side===gr&&i.forceSinglePass===!1}var E7=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?(Wee(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?(Wee(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||G3e),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||Hee),this.transparent.length>1&&this.transparent.sort(t||Hee),n&&(this.opaque.reverse(),this.transparentDoublePass.reverse(),this.transparent.reverse())}finish(){this.lightsNode.setLights(this.lighting.enabled?this.lightsArray:V3e);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}},R_=[],M7=class{constructor(e){this.lighting=e,this.lists=new wf}get(e,t){let n=this.lists;R_[0]=e,R_[1]=t;let r=n.get(R_);return r===void 0&&(r=new E7(this.lighting,e,t),n.set(R_,r)),R_[0]=null,R_[1]=null,r}dispose(){this.lists=new wf}},q3e=0,C7=class{constructor(){this.id=q3e++,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 qre(this)}};function qre(i){let{textures:e,activeCubeFace:t,activeMipmapLevel:n}=i,r=[t,n];for(let s of e)r.push(s.id);return AS(r)}var R7=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 C7,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={}}},H3e=new re,I7=class extends Sf{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?_o:Vs,u.type=e.stencilBuffer?la: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=H3e){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)}}},rS=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)}},f4=class extends Qw{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 Hre(i,e=null,t=null){if(e&&e.isNode){let n=e;e=()=>n}return new f4(new Map([[i,e]]),t)}Ue("overrideNode",(i,e,t)=>Hre(e,t,i));function Wre(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 f4(t,e)}Ue("overrideNodes",(i,e)=>Wre(e,i));var d4=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 Jr),s="float"),s}getHash(){return String(this.id)}generate(){return this.name}},W3e=(i,e)=>new d4(i,e),P7=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 Jr),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 W_(t);return this._currentCond=va(e,n),this.addToStack(this._currentCond)}ElseIf(e,t){let n=new W_(t),r=va(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new W_(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 Jr);let n=e[e.length-1],r=new W_(n),s=t[0];for(let a=1;a<t.length;a++)s=s.or(t[a]);let o=va(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=U9(),r=e.buildStage;Zw(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 Zw(n),e.removeActiveStack(this),s}},BR=$n(P7).setParameterLength(0,1);function j3e(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 L7=class extends Kt{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=j3e(e),this.name=t,this.isStructTypeNode=!0}getLength(){let e=1,t=0;for(let n of this.membersLayout){let r=n.type,s=kSe(r),o=zSe(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)}},D7=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}},X3e=(i,e=null)=>{let t=new L7(i,e);return O9((...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 D7(t,s)},t)},p4=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}},$3e=$n(p4),m4=class{constructor(e=Ts){this.blending=e,this.blendSrc=$p,this.blendDst=Yp,this.blendEquation=so,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)}},Y3e=new m4(ds),Z3e=new m4(Z2);function jre(i,e){for(let t=0;t<i.length;t++)if(i[t].name===e)return t;return-1}var N7=class extends p4{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.blendModes={output:Z3e},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||Y3e}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=Xre(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=jre(s,o);if(a===-1)continue;let l=e.getOutputType(a);r[a]=t[o].convert(l)}return this.members=r,super.setup(e)}},Xre=$n(N7),$g=class extends Cr{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)} )`}},$re=ct($g).setParameterLength(2),K3e=i=>new $g(i,"int","float"),Yre=i=>new $g(i,"uint","float"),Q3e=i=>new $g(i,"float","int"),J3e=i=>new $g(i,"float","uint"),aR={},$u=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($re(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return rt;case"int":return de;case"uvec2":return k9;case"uvec3":return Qg;case"uvec4":return q9;case"ivec2":return Ur;case"ivec3":return z9;case"ivec4":return G9}}_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(ez(o))),c=Yre(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=aR[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}}aR[l]=u}let f=aR[c];return f===void 0&&(f=this._createMainLayout(c,s,a,u),aR[c]=f),me(()=>f(n))()}};$u.COUNT_TRAILING_ZEROS="countTrailingZeros";$u.COUNT_LEADING_ZEROS="countLeadingZeros";$u.COUNT_ONE_BITS="countOneBits";var eMe=ct($u,$u.COUNT_TRAILING_ZEROS).setParameterLength(1),tMe=ct($u,$u.COUNT_LEADING_ZEROS).setParameterLength(1),nMe=ct($u,$u.COUNT_ONE_BITS).setParameterLength(1),iMe=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)}),F7=(i,e)=>$c(Tn(4,i.mul(ai(1,i))),e),rMe=(i,e)=>i.lessThan(.5)?F7(i.mul(2),e).div(2):ai(1,F7(Tn(ai(1,i),2),e).div(2)),sMe=(i,e,t)=>$c(cc($c(i,e),Is($c(i,e),$c(ai(1,i),t))),1/e),oMe=(i,e)=>Ya($R.mul(e.mul(i).sub(1))).div($R.mul(e.mul(i).sub(1))),sS=class extends Cr{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)})`}},aMe=ct(sS,"snorm").setParameterLength(1),lMe=ct(sS,"unorm").setParameterLength(1),cMe=ct(sS,"float16").setParameterLength(1),oS=class extends Cr{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)})`}},uMe=ct(oS,"snorm").setParameterLength(1),hMe=ct(oS,"unorm").setParameterLength(1),fMe=ct(oS,"float16").setParameterLength(1),Vd=me(([i])=>i.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),dMe=me(([i])=>pe(Vd(i.z.add(Vd(i.y.mul(1)))),Vd(i.z.add(Vd(i.x.mul(1)))),Vd(i.y.add(Vd(i.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),pMe=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(dMe(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(Vd(n.z.add(Vd(n.x.add(Vd(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"}]}),B7=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)}},mMe=$n(B7),$o=i=>(...e)=>mMe(i,...e),fx=Xt(0).setGroup(Jt).onRenderUpdate(i=>i.time),AMe=Xt(0).setGroup(Jt).onRenderUpdate(i=>i.deltaTime),Zre=Xt(0,"uint").setGroup(Jt).onRenderUpdate(i=>i.frameId),gMe=(i=fx)=>i.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),vMe=(i=fx)=>i.fract().round(),_Me=(i=fx)=>i.add(.5).fract().mul(2).sub(1).abs(),xMe=(i=fx)=>i.fract();function yMe(i,e=null){return Yd(e,{getUV:typeof i=="function"?i:()=>i})}var bMe=me(([i,e,t=dt(.5)])=>_S(i.sub(t),e).add(t)),wMe=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))}),SMe=me(({position:i=null,horizontal:e=!0,vertical:t=!1})=>{let n;i!==null?(n=Yc.toVar(),n[3][0]=i.x,n[3][1]=i.y,n[3][2]=i.z):n=Yc;let r=vm.mul(n);return J_(e)&&(r[0][0]=Yc[0].length(),r[0][1]=0,r[0][2]=0),J_(t)&&(r[1][0]=0,r[1][1]=Yc[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,Ka.mul(r).mul(Er)}),TMe=me(([i=null])=>{let e=i4();return i4(zz(i)).sub(e).lessThan(0).select(qu,i)}),EMe=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)}),Kre=me(([i,e=null,t=null,n=oe(1),r=Er,s=ya])=>{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 Is(A,y,w)}),MMe=(...i)=>Kre(...i),I_=new La,wg=new re,P_=new re,MO=new re,Tw=new cn,lR=new re(0,0,-1),cf=new xn,Ew=new re,cR=new re,Mw=new xn,uR=new Oe,A4=new Na,CMe=qu.flipX();A4.depthTexture=new Es(1,1);var hR=!1,O7=class i extends Jc{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||A4.texture,CMe),this._reflectorBaseNode=e.reflector||new U7(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:A4.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()}},U7=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(uR),e.setSize(Math.round(uR.width*n),Math.round(uR.height*n))}setup(e){return this._updateResolution(A4,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 Na(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&&hR)return!1;hR=!0;let{scene:t,camera:n,renderer:r,material:s}=e,{target:o}=this,a=this.getVirtualCamera(n),l=this.getRenderTarget(a);r.getDrawingBufferSize(uR),this._updateResolution(l,r),P_.setFromMatrixPosition(o.matrixWorld),MO.setFromMatrixPosition(n.matrixWorld),Tw.extractRotation(o.matrixWorld),wg.set(0,0,1),wg.applyMatrix4(Tw),Ew.subVectors(P_,MO);let c=Ew.dot(wg)>0,u=!1;if(c===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){hR=!1;return}u=!0}Ew.reflect(wg).negate(),Ew.add(P_),Tw.extractRotation(n.matrixWorld),lR.set(0,0,-1),lR.applyMatrix4(Tw),lR.add(MO),cR.subVectors(P_,lR),cR.reflect(wg).negate(),cR.add(P_),a.coordinateSystem=n.coordinateSystem,a.position.copy(Ew),a.up.set(0,1,0),a.up.applyMatrix4(Tw),a.up.reflect(wg),a.lookAt(cR),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),I_.setFromNormalAndCoplanarPoint(wg,P_),I_.applyMatrix4(a.matrixWorldInverse),cf.set(I_.normal.x,I_.normal.y,I_.normal.z,I_.constant);let f=a.projectionMatrix;Mw.x=(Math.sign(cf.x)+f.elements[8])/f.elements[0],Mw.y=(Math.sign(cf.y)+f.elements[9])/f.elements[5],Mw.z=-1,Mw.w=(1+f.elements[10])/f.elements[14],cf.multiplyScalar(1/cf.dot(Mw));let d=0;f.elements[2]=cf.x,f.elements[6]=cf.y,f.elements[10]=r.coordinateSystem===gl?cf.z-d:cf.z+1-d,f.elements[14]=cf.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,hR=!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}},RMe=i=>new O7(i),CO=new Iu(-1,1,1,-1,0,1),k7=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))}},IMe=new k7,aS=class extends Hn{constructor(e=null){super(IMe,e),this.camera=CO,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,CO)}render(e){e.render(this,CO)}},PMe=new Oe,z7=class extends Jc{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:Wi}){let s=new Na(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 aS(new Rr),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(PMe),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 Jc(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}},Qre=(i,...e)=>new z7(Ht(i),...e),LMe=(i,...e)=>i.isSampleNode||i.isTextureNode?i:i.isPassNode?i.getTextureNode():Qre(i,...e),H_=me(([i,e,t],n)=>{let r;n.renderer.coordinateSystem===gl?(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)}),DMe=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())}),NMe=me(([i,e,t])=>{let n=Hg(vs(e)),r=Ur(i.mul(n)).toVar(),s=vs(e,r).toVar(),o=vs(e,r.sub(Ur(2,0))).toVar(),a=vs(e,r.sub(Ur(1,0))).toVar(),l=vs(e,r.add(Ur(1,0))).toVar(),c=vs(e,r.add(Ur(2,0))).toVar(),u=vs(e,r.add(Ur(0,2))).toVar(),f=vs(e,r.add(Ur(0,1))).toVar(),d=vs(e,r.sub(Ur(0,1))).toVar(),A=vs(e,r.sub(Ur(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=H_(i,s,t).toVar(),P=y.lessThan(w).select(R.sub(H_(i.sub(dt(oe(1).div(n.x),0)),a,t)),R.negate().add(H_(i.add(dt(oe(1).div(n.x),0)),l,t))),I=S.lessThan(T).select(R.sub(H_(i.add(dt(0,oe(1).div(n.y))),f,t)),R.negate().add(H_(i.sub(dt(0,oe(1).div(n.y))),d,t)));return _a(jd(P,I))}),$z=me(([i])=>Wu(oe(52.9829189).mul(Wu(Qc(i,dt(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),Gu=me(([i,e,t])=>{let n=oe(2.399963229728653),r=Qa(oe(i).add(.5).div(oe(e))),s=oe(i).mul(n).add(t);return dt(Vu(s),Ya(s)).mul(r)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]}),V7=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)}},FMe=(i,e=null)=>new V7(i,Ht(e)),Yg=class extends Xl{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}},G7=class extends Hi{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}},BMe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=OR("float")):(t=Mte(e),n=OR(e));let r=new G7(i,t,n);return um(r,e,i)},OMe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=OR("float")):(t=Mte(e),n=OR(e));let r=new Yg(i,t,n);return um(r,e,r.count)},q7=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 )"}},UMe=xt(q7),RO=new cn,Jre=Xt(0).setGroup(Jt).onRenderUpdate(({scene:i})=>i.backgroundBlurriness),H7=Xt(1).setGroup(Jt).onRenderUpdate(({scene:i})=>i.backgroundIntensity),ese=Xt(new cn).setGroup(Jt).onRenderUpdate(({scene:i})=>{let e=i.background;return e!==null&&e.isTexture&&e.mapping!==db||i.backgroundNode&&i.backgroundNode.isNode?RO.makeRotationFromEuler(i.backgroundRotation).transpose():RO.identity(),RO}),g4=class extends Jc{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=jo.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(jo.READ_WRITE)}toReadOnly(){return this.setAccess(jo.READ_ONLY)}toWriteOnly(){return this.setAccess(jo.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}},tse=$n(g4).setParameterLength(1,3),kMe=(i,e,t)=>{let n;return i.isStorageTextureNode===!0?n=i.store(e,t):(n=tse(i,e,t),t!==null&&n.toStack()),n},W7=class extends g4{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")}},zMe=$n(W7).setParameterLength(1,3),VMe=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()}),j7=class extends Jc{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 VMe({texture:this,uv:e})}},Yz=$n(j7).setParameterLength(1,3),GMe=(...i)=>Yz(...i).setSampler(!1),qMe=(i,e,t)=>Yz(i,e).level(t),X7=class extends nx{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}},HMe=(i,e,t)=>new X7(i,e,t),jee=new WeakMap,$7=class extends Cr{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=Xee(n);this.previousModelWorldMatrix.value.copy(r);let s=nse(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}){Xee(e).copy(e.matrixWorld)}setup(){let e=this.projectionMatrix===null?Ka:Xt(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(yf).mul(Er),r=this.previousProjectionMatrix.mul(t).mul(jg),s=n.xy.div(n.w),o=r.xy.div(r.w);return ai(s,o)}};function nse(i){let e=jee.get(i);return e===void 0&&(e={},jee.set(i,e)),e}function Xee(i,e=0){let t=nse(i),n=t[e];return n===void 0&&(t[e]=n=new cn,t[e].copy(i.matrixWorld)),n}var WMe=xt($7),jMe=me(([i,e])=>Ml(1,i.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),XMe=me(([i,e])=>Ml(i.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),$Me=me(([i,e])=>i.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),YMe=me(([i,e])=>Qn(i.mul(2).mul(e),i.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),qg(.5,i))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),ZMe=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"}]}),KMe=me(([i])=>Zz(i.rgb)),QMe=me(([i,e=oe(1)])=>e.mix(Zz(i.rgb),i.rgb).max(0)),JMe=me(([i,e=oe(0)])=>{let t=Is(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)}),eCe=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(Qc(t,i.rgb).mul(n.oneMinus()))))).max(0)}),Zz=(i,e=pe(ln.getLuminanceCoefficients(new re)))=>Qc(i,e),tCe=me(([i,e=pe(1),t=pe(0),n=pe(1),r=oe(1),s=pe(ln.getLuminanceCoefficients(new re,Zp))])=>{let o=i.rgb.dot(pe(s)),a=kr(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)}),nCe=me(([i,e])=>i.mul(e).floor().div(e)),fR=null,Y7=class extends ix{static get type(){return"ViewportSharedTextureNode"}constructor(e=qu,t=null){fR===null&&(fR=new FA),super(e,t,fR)}getTextureForReference(){return fR}updateReference(){return this}},iCe=$n(Y7).setParameterLength(0,2),dR=new Oe,v4=class extends Jc{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)}},_4=class extends v4{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}},Tf=class i extends Cr{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 Na(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 _4(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 _4(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=mI(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=kg(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),dR.set(s.width,s.height)):(r=this.camera,t.getDrawingBufferSize(dR)),this.setSize(dR.width,dR.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:Yd({...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()}};Tf.COLOR="color";Tf.DEPTH="depth";var rCe=(i,e,t)=>new Tf(Tf.COLOR,i,e,t),sCe=(i,e)=>new v4(i,e),oCe=(i,e,t)=>new Tf(Tf.DEPTH,i,e,t),Z7=class extends Tf{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,s){super(Tf.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 Rr;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=mi;let t=ya.negate(),n=Ka.mul(yf),r=oe(1),s=n.mul(Ft(Er,1)),o=n.mul(Ft(Er.add(t),1)),a=_a(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}},aCe=(i,e,t=new zt(0,0,0),n=.003,r=1)=>new Z7(i,e,Ht(t),Ht(n),Ht(r)),ise=me(([i,e])=>i.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),rse=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"}]}),sse=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"}]}),lCe=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)}),ose=me(([i,e])=>{let t=So(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=So(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return i=i.mul(e).div(.6),i=t.mul(i),i=lCe(i),i=n.mul(i),i.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),cCe=So(pe(1.6605,-.1246,-.0182),pe(-.5876,1.1329,-.1006),pe(-.0728,-.0083,1.1187)),uCe=So(pe(.6274,.0691,.0164),pe(.3293,.9195,.088),pe(.0433,.0113,.8956)),hCe=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))))}),ase=me(([i,e])=>{let t=pe(i).toVar(),n=So(pe(.856627153315983,.137318972929847,.11189821299995),pe(.0951212405381588,.761241990602591,.0767994186031903),pe(.0482516061458583,.101439036467562,.811302368396859)),r=So(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(uCe.mul(t)),t.assign(n.mul(t)),t.assign(kr(t,1e-10)),t.assign(mf(t)),t.assign(t.sub(s).div(o.sub(s))),t.assign(ju(t,0,1)),t.assign(hCe(t)),t.assign(r.mul(t)),t.assign($c(kr(pe(0),t),pe(2.2))),t.assign(cCe.mul(t)),t.assign(ju(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),lse=me(([i,e])=>{let t=oe(.76),n=oe(.15);i=i.mul(e);let r=Ml(i.r,Ml(i.g,i.b)),s=va(r.lessThan(.08),r.sub(Tn(6.25,r.mul(r))),.04);i.subAssign(s);let o=kr(i.r,kr(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,cc(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}},xI=$n(hr).setParameterLength(1,3),fCe=(i,e)=>xI(i,e,"js"),dCe=(i,e)=>xI(i,e,"wgsl"),pCe=(i,e)=>xI(i,e,"glsl"),x4=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)}},cse=(i,e=[],t="")=>{let n=new x4(i,e,t);return O9((...s)=>n.call(...s),n)},mCe=(i,e)=>cse(i,e,"glsl"),ACe=(i,e)=>cse(i,e,"wgsl");function Kz(i){let e,t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||_s.z).negate()}var use=me(([i,e],t)=>{let n=Kz(t);return uc(i,e,n)}),hse=me(([i],e)=>{let t=Kz(e);return i.mul(i,t,t).negate().exp().oneMinus()}),gCe=me(([i,e],t)=>{let n=Kz(t),s=e.sub(vf.y).max(0).toConst().mul(n).toConst();return i.mul(i,s,s).negate().exp().oneMinus()}),K7=me(([i,e])=>Ft(e.toFloat().mix($_.rgb,i.toVec3()),$_.a)),Sg=null,Tg=null,Q7=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(am(t.value)),s=e.getTypeLength(am(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 QR('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(am(o)),c=e.getTypeLength(am(a));Sg=Sg||new xn,Tg=Tg||new xn,Sg.setScalar(0),Tg.setScalar(0),l===1?Sg.setScalar(o):o.isColor?Sg.set(o.r,o.g,o.b,1):Sg.set(o.x,o.y,o.z||0,o.w||0),c===1?Tg.setScalar(a):a.isColor?Tg.set(a.r,a.g,a.b,1):Tg.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=Sg.getComponent(S),R=Tg.getComponent(S);d[w]=Du.lerp(T,R,Math.random())}let A=this.getNodeType(e);if(t.count*4*4<=e.getUniformBufferLimit())n=ux(d,"vec4",t.count).element(Hu).convert(A);else{let w=new Xl(d,4);e.geometry.setAttribute("__range"+this.id,w),n=uI(w).convert(A)}}else n=oe(0);return n}},vCe=$n(Q7).setParameterLength(2),J7=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}},xS=(i,e)=>new J7(i,e),_Ce=xS("numWorkgroups","uvec3"),xCe=xS("workgroupId","uvec3"),yCe=xS("globalId","uvec3"),bCe=xS("localId","uvec3"),wCe=xS("subgroupSize","uint"),ek=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)}},Qz=$n(ek),SCe=()=>Qz("workgroup").toStack(),TCe=()=>Qz("storage").toStack(),ECe=()=>Qz("texture").toStack(),tk=class extends Wd{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}},nk=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 Jr),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new tk(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)}},MCe=(i,e)=>new nk("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=oc(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 CCe=$n(Ls),Mf=(i,e,t)=>CCe(i,e,t).toStack(),RCe=i=>Mf(Ls.ATOMIC_LOAD,i,null),ICe=(i,e)=>Mf(Ls.ATOMIC_STORE,i,e),PCe=(i,e)=>Mf(Ls.ATOMIC_ADD,i,e),LCe=(i,e)=>Mf(Ls.ATOMIC_SUB,i,e),DCe=(i,e)=>Mf(Ls.ATOMIC_MAX,i,e),NCe=(i,e)=>Mf(Ls.ATOMIC_MIN,i,e),FCe=(i,e)=>Mf(Ls.ATOMIC_AND,i,e),BCe=(i,e)=>Mf(Ls.ATOMIC_OR,i,e),OCe=(i,e)=>Mf(Ls.ATOMIC_XOR,i,e),Ot=class i extends Cr{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 UCe=ct(Ot,Ot.SUBGROUP_ELECT).setParameterLength(0),kCe=ct(Ot,Ot.SUBGROUP_BALLOT).setParameterLength(1),zCe=ct(Ot,Ot.SUBGROUP_ADD).setParameterLength(1),VCe=ct(Ot,Ot.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),GCe=ct(Ot,Ot.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),qCe=ct(Ot,Ot.SUBGROUP_MUL).setParameterLength(1),HCe=ct(Ot,Ot.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),WCe=ct(Ot,Ot.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),jCe=ct(Ot,Ot.SUBGROUP_AND).setParameterLength(1),XCe=ct(Ot,Ot.SUBGROUP_OR).setParameterLength(1),$Ce=ct(Ot,Ot.SUBGROUP_XOR).setParameterLength(1),YCe=ct(Ot,Ot.SUBGROUP_MIN).setParameterLength(1),ZCe=ct(Ot,Ot.SUBGROUP_MAX).setParameterLength(1),KCe=ct(Ot,Ot.SUBGROUP_ALL).setParameterLength(0),QCe=ct(Ot,Ot.SUBGROUP_ANY).setParameterLength(0),JCe=ct(Ot,Ot.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),eRe=ct(Ot,Ot.QUAD_SWAP_X).setParameterLength(1),tRe=ct(Ot,Ot.QUAD_SWAP_Y).setParameterLength(1),nRe=ct(Ot,Ot.QUAD_SWAP_DIAGONAL).setParameterLength(1),iRe=ct(Ot,Ot.SUBGROUP_BROADCAST).setParameterLength(2),rRe=ct(Ot,Ot.SUBGROUP_SHUFFLE).setParameterLength(2),sRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),oRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_UP).setParameterLength(2),aRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),lRe=ct(Ot,Ot.QUAD_BROADCAST).setParameterLength(1),pR;function yI(i){pR=pR||new WeakMap;let e=pR.get(i);return e===void 0&&pR.set(i,e={}),e}function bI(i){let e=yI(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 fse(i,e=vf){let t=bI(i).mul(e);return t.xyz.div(t.w)}function Jz(i){let e=yI(i);return e.position||(e.position=Xt(new re).setGroup(Jt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function dse(i){let e=yI(i);return e.targetPosition||(e.targetPosition=Xt(new re).setGroup(Jt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function eV(i){let e=yI(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 tV=i=>vm.transformDirection(Jz(i).sub(dse(i))),cRe=$d("vec3","totalDiffuse"),uRe=$d("vec3","totalSpecular"),hRe=$d("vec3","outgoingLight"),fRe=i=>i.sort((e,t)=>e.id-t.id),dRe=(i,e)=>{for(let t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},IO=new WeakMap,Cw=[],lS=class extends Kt{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=cRe,this.totalSpecularNode=uRe,this.outgoingLightNode=hRe,this._lights=[],this.global=!0}customCacheKey(){let e=this._lights;for(let n=0;n<e.length;n++){let r=e[n];if(Cw.push(r.id),Cw.push(r.castShadow?1:0),r.isSpotLight===!0){let s=r.map!==null?r.map.id:-1,o=r.colorNode?r.colorNode.getCacheKey():-1;Cw.push(s,o)}}let t=AS(Cw);return Cw.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=fRe([...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=dRe(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}IO.has(l)===!1&&IO.set(l,new u(l)),c=IO.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}},pRe=(i=[])=>new lS().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}){nV.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||vf)}},nV=$d("vec3","shadowPositionWorld");function mRe(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 ARe(i,e){return e=mRe(i,e),i.setMRT(null),i.setRenderObjectFunction(null),i.setClearColor(0,1),i.autoClear=!0,e}function gRe(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 vRe(i,e={}){return e.background=i.background,e.backgroundNode=i.backgroundNode,e.overrideMaterial=i.overrideMaterial,e}function _Re(i,e){return e=vRe(i,e),i.background=null,i.backgroundNode=null,i.overrideMaterial=null,e}function xRe(i,e){i.background=e.background,i.backgroundNode=e.backgroundNode,i.overrideMaterial=e.overrideMaterial}function yRe(i,e,t){return t=ARe(i,t),t=_Re(e,t),t}function bRe(i,e,t){gRe(i,t),xRe(e,t)}var y4=new WeakMap,pse=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)}),mse=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=$z(e1.xy).mul(6.28318530718);return Is(r(e.xy.add(Gu(0,5,c).mul(l)),e.z),r(e.xy.add(Gu(1,5,c).mul(l)),e.z),r(e.xy.add(Gu(2,5,c).mul(l)),e.z),r(e.xy.add(Gu(3,5,c).mul(l)),e.z),r(e.xy.add(Gu(4,5,c).mul(l)),e.z)).mul(1/5)}),Ase=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=Wu(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(Ur(-1,1)).toConst(),u=l(Ur(1,1)).toConst(),f=l(Ur(-1,-1)).toConst(),d=l(Ur(1,-1)).toConst();return Is(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)}),gse=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=kr(1e-7,r.y.mul(r.y)),a=n.renderer.reversedDepthBuffer?qg(s,e.z):qg(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(kr(a,u))}),l}),vse=i=>{let e=y4.get(i);return e===void 0&&(e=new Rr,e.colorNode=Ft(0,0,0,1),e.isShadowPassMaterial=!0,e.name="ShadowMaterial",e.blending=ds,e.fog=!1,y4.set(i,e)),e},_se=i=>{let e=y4.get(i);e!==void 0&&(e.dispose(),y4.delete(i))},$ee=new wf,L_=[],xse=(i,e,t,n)=>{L_[0]=i,L_[1]=e;let r=$ee.get(L_);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===Fc)&&(n&&(Cte(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,$ee.set(L_,r)),L_[0]=null,L_[1]=null,r},wRe=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(Is(e1.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=Qa(o.sub(s.mul(s)).max(0));return dt(s,c)}),SRe=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(Is(e1.xy,dt(f,0).mul(e)).div(t));n.value.isArrayTexture&&(d=d.depth(r)),s.addAssign(d.x),o.addAssign(Is(d.y.mul(d.y),d.x.mul(d.x)))}),s.divAssign(i),o.divAssign(i);let c=Qa(o.sub(s.mul(s)).max(0));return dt(s,c)}),TRe=[pse,mse,Ase,gse],PO,mR=new aS,b4=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=AI(l.negate(),c,u)}return o=pe(o.x,o.y.oneMinus(),r.reversedDepthBuffer?a.sub(s):a.add(s)),o}getShadowFilterFn(e){return TRe[e]}setupRenderTarget(e,t){let n=new Es(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Lu:jh;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(Pd.TEXTURE_COMPARE);if((l===l0||l===mM)&&c?(o.minFilter=Mi,o.magFilter=Mi):(o.minFilter=Ti,o.magFilter=Ti),s.camera.coordinateSystem=n.coordinateSystem,s.camera.updateProjectionMatrix(),l===Fc&&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 Rr);z.fragmentNode=wRe({samples:C,radius:B,size:k,shadowPass:D,depthLayer:this.depthLayer}).context(e.getSharedContext()),z.name="VSMVertical",z=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new Rr),z.fragmentNode=SRe({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=bI(r),A=_m.mul(f),y;!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld?y=d.mul(nV.add(A)):y=Xt("mat4").onObjectUpdate(({object:L},C)=>C.value.multiplyMatrices(d.value,L.matrixWorld)).mul(Er).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===Fc&&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=Za(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?Za(this.shadowMap.texture,YU()):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=Za(this.shadowMap.depthTexture,YU()).r:C=fi(this.shadowMap.depthTexture).r;let B;return this.shadow.camera.isPerspectiveCamera?B=mI(C,D,L):B=wre(C,D,L),B=kg(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;PO=yRe(s,o,PO),o.overrideMaterial=vse(n),s.setRenderObjectFunction(xse(s,r,l,A)),s.setClearColor(0,0),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(f),l===Fc&&r.isPointLightShadow!==!0&&this.vsmPass(s),r.camera.layers.mask=u,bRe(s,o,PO)}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),mR.material=this.vsmMaterialVertical,mR.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),mR.material=this.vsmMaterialHorizontal,mR.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,_se(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))}},yse=(i,e)=>new b4(i,e),ERe=new zt,Yee=new cn,Rw=new re,LO=new re,MRe=[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)],CRe=[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)],RRe=[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)],IRe=[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)],bse=me(({depthTexture:i,bd3D:e,dp:t})=>Za(i,e).compare(t)),wse=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=_a(jd(e,a.x.greaterThan(a.z).select(pe(0,1,0),pe(1,0,0)))),c=jd(e,l),u=$z(e1.xy).mul(6.28318530718),f=Gu(0,5,u),d=Gu(1,5,u),A=Gu(2,5,u),y=Gu(3,5,u),w=Gu(4,5,u);return Za(i,e.add(l.mul(f.x).add(c.mul(f.y)).mul(o))).compare(t).add(Za(i,e.add(l.mul(d.x).add(c.mul(d.y)).mul(o))).compare(t)).add(Za(i,e.add(l.mul(A.x).add(c.mul(A.y)).mul(o))).compare(t)).add(Za(i,e.add(l.mul(y.x).add(c.mul(y.y)).mul(o))).compare(t)).add(Za(i,e.add(l.mul(w.x).add(c.mul(w.y)).mul(o))).compare(t)).mul(1/5)}),PRe=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=Sre(a.negate(),l,c),d.subAssign(u)):r.renderer.logarithmicDepthBuffer?(d=AI(a.negate(),l,c),d.addAssign(u)):(d=Vz(a.negate(),l,c),d.addAssign(u));let A=s.normalize();f.assign(i({depthTexture:e,bd3D:A,dp:d,shadow:n}))}),f}),rk=class extends b4{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===_8?bse:wse}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s}){return PRe({filterFn:t,depthTexture:n,shadowCoord:r,shadow:s})}setupRenderTarget(e,t){let n=new Gv(e.mapSize.width);n.name="PointShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Lu:jh;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===gl,u=c?MRe:RRe,f=c?CRe:IRe;n.setSize(t.mapSize.width,t.mapSize.width);let d=s.autoClear,A=s.getClearColor(ERe),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()),Rw.setFromMatrixPosition(r.matrixWorld),a.position.copy(Rw),LO.copy(a.position),LO.add(u[w]),a.up.copy(f[w]),a.lookAt(LO),a.updateMatrixWorld(),l.makeTranslation(-Rw.x,-Rw.y,-Rw.z),Yee.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix(Yee,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)}},Sse=(i,e)=>new rk(i,e),Xd=class extends pm{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 eV(this.light).sub(e.context.positionView||_s)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return yse(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)}),Tse=({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}},sk=class extends Xd{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 Sse(this.light)}setupDirect(e){return Tse({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}},LRe=me(([i=Ui()])=>{let e=i.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),DRe=me(([i=Ui()],{renderer:e,material:t})=>{let n=az(i.mul(2).sub(1)),r;if(t.alphaToCoverage&&e.currentSamples>0){let s=oe(n.fwidth()).toVar();r=uc(s.oneMinus(),s.add(1),n).oneMinus()}else r=va(n.greaterThan(1),0,1);return r}),Xw=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=lc(i).toVar();return va(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=lc(e).toVar(),n=oe(i).toVar();return va(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(Af(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),Mr=me(([i,e])=>{let t=oe(i).toVar();return e.assign(Rs(t)),t.sub(oe(e))}),NRe=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"}]}),FRe=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"}]}),Ese=$o([NRe,FRe]),BRe=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"}]}),ORe=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"}]}),Mse=$o([BRe,ORe]),URe=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(Xw(o.lessThan(rt(4)),r,n)).toVar(),l=oe(Tn(2,Xw(o.lessThan(rt(4)),n,r))).toVar();return w4(a,lc(o.bitAnd(rt(1)))).add(w4(l,lc(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"}]}),kRe=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(Xw(l.lessThan(rt(8)),o,s)).toVar(),u=oe(Xw(l.lessThan(rt(4)),s,Xw(l.equal(rt(12)).or(l.equal(rt(14))),o,r))).toVar();return w4(c,lc(l.bitAnd(rt(1)))).add(w4(u,lc(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"}]}),wo=$o([URe,kRe]),zRe=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=Qg(i).toVar();return pe(wo(s.x,r,n),wo(s.y,r,n),wo(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"}]}),VRe=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=oe(e).toVar(),a=Qg(i).toVar();return pe(wo(a.x,o,s,r),wo(a.y,o,s,r),wo(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"}]}),jc=$o([zRe,VRe]),GRe=me(([i])=>{let e=oe(i).toVar();return Tn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),qRe=me(([i])=>{let e=oe(i).toVar();return Tn(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),HRe=me(([i])=>{let e=pe(i).toVar();return Tn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Cse=$o([GRe,HRe]),WRe=me(([i])=>{let e=pe(i).toVar();return Tn(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Rse=$o([qRe,WRe]),sc=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"}]}),Ise=me(([i,e,t])=>{i.subAssign(t),i.bitXorAssign(sc(t,de(4))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(sc(i,de(6))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(sc(e,de(8))),e.addAssign(i),i.subAssign(t),i.bitXorAssign(sc(t,de(16))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(sc(i,de(19))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(sc(e,de(4))),e.addAssign(i)}),yS=me(([i,e,t])=>{let n=rt(t).toVar(),r=rt(e).toVar(),s=rt(i).toVar();return n.bitXorAssign(r),n.subAssign(sc(r,de(14))),s.bitXorAssign(n),s.subAssign(sc(n,de(11))),r.bitXorAssign(s),r.subAssign(sc(s,de(25))),n.bitXorAssign(r),n.subAssign(sc(r,de(16))),s.bitXorAssign(n),s.subAssign(sc(n,de(4))),r.bitXorAssign(s),r.subAssign(sc(s,de(14))),n.bitXorAssign(r),n.subAssign(sc(r,de(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),xa=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"}]}),_f=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"}]}),jRe=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 yS(n.add(rt(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),XRe=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)),yS(s,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),$Re=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)),yS(a,l,c)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),YRe=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)),Ise(c,u,f),c.addAssign(rt(r)),yS(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"}]}),ZRe=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)),Ise(f,d,A),f.addAssign(rt(o)),d.addAssign(rt(s)),yS(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=$o([jRe,XRe,$Re,YRe,ZRe]),KRe=me(([i,e])=>{let t=de(e).toVar(),n=de(i).toVar(),r=rt(Xi(n,t)).toVar(),s=Qg().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"}]}),QRe=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=Qg().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"}]}),Xc=$o([KRe,QRe]),JRe=me(([i])=>{let e=dt(i).toVar(),t=de().toVar(),n=de().toVar(),r=oe(Mr(e.x,t)).toVar(),s=oe(Mr(e.y,n)).toVar(),o=oe(_f(r)).toVar(),a=oe(_f(s)).toVar(),l=oe(Ese(wo(Xi(t,n),r,s),wo(Xi(t.add(de(1)),n),r.sub(1),s),wo(Xi(t,n.add(de(1))),r,s.sub(1)),wo(Xi(t.add(de(1)),n.add(de(1))),r.sub(1),s.sub(1)),o,a)).toVar();return Cse(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),e4e=me(([i])=>{let e=pe(i).toVar(),t=de().toVar(),n=de().toVar(),r=de().toVar(),s=oe(Mr(e.x,t)).toVar(),o=oe(Mr(e.y,n)).toVar(),a=oe(Mr(e.z,r)).toVar(),l=oe(_f(s)).toVar(),c=oe(_f(o)).toVar(),u=oe(_f(a)).toVar(),f=oe(Mse(wo(Xi(t,n,r),s,o,a),wo(Xi(t.add(de(1)),n,r),s.sub(1),o,a),wo(Xi(t,n.add(de(1)),r),s,o.sub(1),a),wo(Xi(t.add(de(1)),n.add(de(1)),r),s.sub(1),o.sub(1),a),wo(Xi(t,n,r.add(de(1))),s,o,a.sub(1)),wo(Xi(t.add(de(1)),n,r.add(de(1))),s.sub(1),o,a.sub(1)),wo(Xi(t,n.add(de(1)),r.add(de(1))),s,o.sub(1),a.sub(1)),wo(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 Rse(f)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),rV=$o([JRe,e4e]),t4e=me(([i])=>{let e=dt(i).toVar(),t=de().toVar(),n=de().toVar(),r=oe(Mr(e.x,t)).toVar(),s=oe(Mr(e.y,n)).toVar(),o=oe(_f(r)).toVar(),a=oe(_f(s)).toVar(),l=pe(Ese(jc(Xc(t,n),r,s),jc(Xc(t.add(de(1)),n),r.sub(1),s),jc(Xc(t,n.add(de(1))),r,s.sub(1)),jc(Xc(t.add(de(1)),n.add(de(1))),r.sub(1),s.sub(1)),o,a)).toVar();return Cse(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),n4e=me(([i])=>{let e=pe(i).toVar(),t=de().toVar(),n=de().toVar(),r=de().toVar(),s=oe(Mr(e.x,t)).toVar(),o=oe(Mr(e.y,n)).toVar(),a=oe(Mr(e.z,r)).toVar(),l=oe(_f(s)).toVar(),c=oe(_f(o)).toVar(),u=oe(_f(a)).toVar(),f=pe(Mse(jc(Xc(t,n,r),s,o,a),jc(Xc(t.add(de(1)),n,r),s.sub(1),o,a),jc(Xc(t,n.add(de(1)),r),s,o.sub(1),a),jc(Xc(t.add(de(1)),n.add(de(1)),r),s.sub(1),o.sub(1),a),jc(Xc(t,n,r.add(de(1))),s,o,a.sub(1)),jc(Xc(t.add(de(1)),n,r.add(de(1))),s.sub(1),o,a.sub(1)),jc(Xc(t,n.add(de(1)),r.add(de(1))),s,o.sub(1),a.sub(1)),jc(Xc(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 Rse(f)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),bS=$o([t4e,n4e]),i4e=me(([i])=>{let e=oe(i).toVar(),t=de(Rs(e)).toVar();return xa(Xi(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),r4e=me(([i])=>{let e=dt(i).toVar(),t=de(Rs(e.x)).toVar(),n=de(Rs(e.y)).toVar();return xa(Xi(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),s4e=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 xa(Xi(t,n,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),o4e=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 xa(Xi(t,n,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),a4e=$o([i4e,r4e,s4e,o4e]),l4e=me(([i])=>{let e=oe(i).toVar(),t=de(Rs(e)).toVar();return pe(xa(Xi(t,de(0))),xa(Xi(t,de(1))),xa(Xi(t,de(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),c4e=me(([i])=>{let e=dt(i).toVar(),t=de(Rs(e.x)).toVar(),n=de(Rs(e.y)).toVar();return pe(xa(Xi(t,n,de(0))),xa(Xi(t,n,de(1))),xa(Xi(t,n,de(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),u4e=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(xa(Xi(t,n,r,de(0))),xa(Xi(t,n,r,de(1))),xa(Xi(t,n,r,de(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),h4e=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(xa(Xi(t,n,r,s,de(0))),xa(Xi(t,n,r,s,de(1))),xa(Xi(t,n,r,s,de(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),wI=$o([l4e,c4e,u4e,h4e]),S4=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(rV(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"}]}),SI=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(bS(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"}]}),f4e=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar();return dt(S4(a,o,s,r),S4(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"}]}),d4e=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar(),l=pe(SI(a,o,s,r)).toVar(),c=oe(S4(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"}]}),p4e=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)),()=>kr(fr(T.x),fr(T.y))),Qc(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"}]}),m4e=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)),()=>kr(fr(I.x),fr(I.y),fr(I.z))),Qc(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"}]}),dx=$o([p4e,m4e]),A4e=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(Mr(s.x,o),Mr(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(dx(l,u,f,o,a,r,n)).toVar();c.assign(Ml(c,d))})}),$t(n.equal(de(0)),()=>{c.assign(Qa(c))}),c}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),g4e=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(Mr(s.x,o),Mr(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(dx(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(Qa(c))}),c}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),v4e=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(Mr(s.x,o),Mr(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(dx(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(Qa(c))}),c}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),_4e=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(Mr(s.x,o),Mr(s.y,a),Mr(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(dx(c,f,d,A,o,a,l,r,n)).toVar();u.assign(Ml(u,y))})})}),$t(n.equal(de(0)),()=>{u.assign(Qa(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),x4e=$o([A4e,_4e]),y4e=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(Mr(s.x,o),Mr(s.y,a),Mr(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(dx(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(Qa(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),b4e=$o([g4e,y4e]),w4e=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(Mr(s.x,o),Mr(s.y,a),Mr(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(dx(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(Qa(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),sV=$o([v4e,w4e]),S4e=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=lc(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(bS(D))}),$t(f.equal(de(1)),()=>{L.assign(wI(D))}),$t(f.equal(de(2)),()=>{L.assign(sV(D,w,de(0)))}),$t(f.equal(de(3)),()=>{L.assign(SI(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"}]}),T4e=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=lc(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(bS(D))}),$t(f.equal(de(1)),()=>{L.assign(wI(D))}),$t(f.equal(de(2)),()=>{L.assign(sV(D,w,de(0)))}),$t(f.equal(de(3)),()=>{L.assign(SI(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"}]}),E4e=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(Af(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"}]}),M4e=me(([i])=>{let e=pe(i).toVar(),t=oe(e.x).toVar(),n=oe(e.y).toVar(),r=oe(e.z).toVar(),s=oe(Ml(t,Ml(n,r))).toVar(),o=oe(kr(t,kr(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(Is(2,r.sub(t).div(a)))}).Else(()=>{l.assign(Is(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"}]}),C4e=me(([i])=>{let e=pe(i).toVar(),t=V9($9(e,pe(.04045))).toVar(),n=pe(e.div(12.92)).toVar(),r=pe($c(kr(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"}]}),Pse=(i,e)=>{i=oe(i),e=oe(e);let t=dt(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return uc(i.sub(t),i.add(t),e)},Lse=(i,e,t,n)=>Qn(i,e,t[n].clamp()),R4e=(i,e,t=Ui())=>Lse(i,e,t,"x"),I4e=(i,e,t=Ui())=>Lse(i,e,t,"y"),P4e=(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)},Dse=(i,e,t,n,r)=>Qn(i,e,Pse(t,n[r])),L4e=(i,e,t,n=Ui())=>Dse(i,e,t,n,"x"),D4e=(i,e,t,n=Ui())=>Dse(i,e,t,n,"y"),N4e=(i=1,e=0,t=Ui())=>t.mul(i).add(e),F4e=(i,e=1)=>(i=oe(i),i.abs().pow(e).mul(i.sign())),B4e=(i,e=1,t=.5)=>oe(i).sub(t).mul(e).add(t),O4e=(i=Ui(),e=1,t=0)=>rV(i.convert("vec2|vec3")).mul(e).add(t),U4e=(i=Ui(),e=1,t=0)=>bS(i.convert("vec2|vec3")).mul(e).add(t),k4e=(i=Ui(),e=1,t=0)=>(i=i.convert("vec2|vec3"),Ft(bS(i),rV(i.add(dt(19,73)))).mul(e).add(t)),z4e=(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)=>S4e(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),V4e=(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)=>T4e(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),G4e=(i=Ui(),e=1)=>x4e(i.convert("vec2|vec3"),e,de(1)),q4e=(i=Ui(),e=1)=>b4e(i.convert("vec2|vec3"),e,de(1)),H4e=(i=Ui(),e=1)=>sV(i.convert("vec2|vec3"),e,de(1)),W4e=(i=Ui())=>a4e(i.convert("vec2|vec3")),j4e=(i=Ui(),e=3,t=2,n=.5,r=1)=>S4(i,de(e),t,n).mul(r),X4e=(i=Ui(),e=3,t=2,n=.5,r=1)=>f4e(i,de(e),t,n).mul(r),$4e=(i=Ui(),e=3,t=2,n=.5,r=1)=>SI(i,de(e),t,n).mul(r),Y4e=(i=Ui(),e=3,t=2,n=.5,r=1)=>d4e(i,de(e),t,n).mul(r),Z4e=(i,e=oe(0))=>Is(i,e),K4e=(i,e=oe(0))=>ai(i,e),Q4e=(i,e=oe(1))=>Tn(i,e),J4e=(i,e=oe(1))=>cc(i,e),eIe=(i,e=oe(1))=>iI(i,e),tIe=(i,e=oe(1))=>$c(i,e),nIe=(i=oe(0),e=oe(1))=>Q9(i,e),iIe=()=>fx,rIe=()=>Zre,sIe=(i,e=oe(1))=>ai(e,i),oIe=(i,e,t,n)=>i.greaterThan(e).mix(t,n),aIe=(i,e,t,n)=>i.greaterThanEqual(e).mix(t,n),lIe=(i,e,t,n)=>i.equal(e).mix(t,n),cIe=(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},uIe=(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},hIe=(i,e)=>{i=dt(i),e=oe(e);let t=e.mul(Math.PI/180);return _S(i,t)},fIe=(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))},dIe=(i,e)=>(i=pe(i),e=oe(e),Rz(i,e)),pIe=me(([i,e,t])=>{let n=_a(i).toVar(),r=ai(oe(.5).mul(e.sub(t)),vf).div(n).toVar(),s=ai(oe(-.5).mul(e.sub(t)),vf).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=Ml(o.x,o.y,o.z).toVar();return vf.add(n.mul(a)).toVar().sub(t)}),Nse=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:Wz,BRDF_Lambert:Xg,BasicPointShadowFilter:bse,BasicShadowFilter:pse,Break:_re,Const:Hne,Continue:_Ee,DFGLUT:nS,D_GGX:Lre,Discard:sie,EPSILON:rI,F_Schlick:sx,Fn:me,HALF_PI:dTe,INFINITY:uTe,If:$t,Loop:Oi,NodeAccess:jo,NodeShaderStage:G_,NodeType:qSe,NodeUpdateType:yn,OnBeforeFrameUpdate:dEe,OnBeforeMaterialUpdate:fEe,OnBeforeObjectUpdate:hEe,OnFrameUpdate:hre,OnMaterialUpdate:uEe,OnObjectUpdate:vS,PCFShadowFilter:mse,PCFSoftShadowFilter:Ase,PI:$R,PI2:hTe,PointShadowFilter:wse,Return:STe,Schlick_to_F0:t7,ShaderNode:W_,Stack:J4,Switch:rTe,TBNViewMatrix:Dg,TWO_PI:fTe,VSMShadowFilter:gse,V_GGX_SmithCorrelated:Pre,Var:qne,VarIntent:Wne,abs:fr,acesFilmicToneMapping:ose,acos:K9,acosh:_ne,add:Is,addMethodChaining:Ue,addNodeElement:TTe,agxToneMapping:ase,all:cne,alphaT:qR,ambientOcclusion:iU,and:Yte,anisotropy:tm,anisotropyB:Bg,anisotropyT:Gw,any:une,append:oTe,array:Vte,asin:gne,asinh:vne,assign:Gte,atan:Q9,atanh:xne,atomicAdd:PCe,atomicAnd:FCe,atomicFunc:Mf,atomicLoad:RCe,atomicMax:DCe,atomicMin:NCe,atomicOr:BCe,atomicStore:ICe,atomicSub:LCe,atomicXor:OCe,attenuationColor:j9,attenuationDistance:W9,attribute:ac,attributeArray:BMe,backgroundBlurriness:Jre,backgroundIntensity:H7,backgroundRotation:ese,batch:mre,batchColor:Oz,bentNormalView:Fie,billboarding:SMe,bitAnd:Jte,bitNot:ene,bitOr:tne,bitXor:nne,bitangentGeometry:nEe,bitangentLocal:iEe,bitangentView:Die,bitangentWorld:rEe,bitcast:$re,blendBurn:jMe,blendColor:ZMe,blendDodge:XMe,blendOverlay:YMe,blendScreen:$Me,blur:Ure,bool:lc,buffer:ux,bufferAttribute:dz,builtin:Zd,builtinAOContext:Vne,builtinShadowContext:zne,bumpMap:Rz,bvec2:Fte,bvec3:V9,bvec4:Bte,bypass:iie,cache:nie,call:qte,cameraFar:rm,cameraIndex:gm,cameraNear:im,cameraNormalMatrix:DTe,cameraPosition:hie,cameraProjectionMatrix:Ka,cameraProjectionMatrixInverse:uie,cameraViewMatrix:vm,cameraViewport:NTe,cameraWorldMatrix:gS,cbrt:Nne,cdl:tCe,ceil:oI,checker:LRe,cineonToneMapping:sse,clamp:ju,clearcoat:zR,clearcoatNormalView:sm,clearcoatRoughness:X_,clipSpace:pie,code:xI,color:Nte,colorSpaceToWorking:lI,colorToDirection:aEe,compute:tie,computeKernel:mz,computeSkinning:vEe,context:Yd,convert:Ute,convertColorSpace:gTe,convertToTexture:LMe,cos:Vu,cosh:pne,countLeadingZeros:tMe,countOneBits:nMe,countTrailingZeros:eMe,cross:jd,cubeTexture:Za,cubeTextureBase:Mz,dFdx:tz,dFdy:nz,dashSize:Og,debug:aie,decrement:lne,decrementBefore:one,defaultBuildStages:PR,defaultShaderStages:Rte,defined:J_,degrees:fne,deltaTime:AMe,densityFogFactor:hse,depth:Gz,depthPass:oCe,determinant:Tne,difference:Rne,diffuseColor:Bi,diffuseContribution:Rg,directPointLight:Tse,directionToColor:oEe,directionToFaceDirection:XTe,dispersion:X9,disposeShadowMaterial:_se,distance:Cne,div:cc,dot:Qc,drawIndex:eie,dynamicBufferAttribute:xTe,element:Ote,emissive:nU,equal:Hte,equirectDirection:YU,equirectUV:qz,exp:Y9,exp2:ex,exponentialHeightFogFactor:gCe,expression:oc,faceDirection:Sz,faceForward:cz,faceforward:pTe,float:oe,floatBitsToInt:K3e,floatBitsToUint:Yre,floor:Af,fog:K7,fract:Wu,frameGroup:lTe,frameId:Zre,frontFacing:mie,fwidth:rz,gain:rMe,gapSize:Kw,getConstNodeType:Dte,getCurrentStack:U9,getDirection:Bre,getDistanceAttenuation:iV,getGeometryRoughness:Ire,getNormalFromDepth:NMe,getParallaxCorrectNormal:pIe,getRoughness:Hz,getScreenPosition:DMe,getShIrradianceAt:Nse,getShadowMaterial:vse,getShadowRenderObjectFunction:xse,getTextureIndex:jre,getViewPosition:H_,ggxConvolution:kre,globalId:yCe,glsl:pCe,glslFn:mCe,grayscale:KMe,greaterThan:$9,greaterThanEqual:$te,hash:iMe,highpModelNormalViewMatrix:wU,highpModelViewMatrix:bU,hue:eCe,increment:ane,incrementBefore:sne,inspector:lie,instance:dre,instanceColor:Bz,instanceIndex:Hu,instancedArray:OMe,instancedBufferAttribute:uI,instancedDynamicBufferAttribute:pz,instancedMesh:pre,int:de,intBitsToFloat:Q3e,interleavedGradientNoise:$z,inverse:Ene,inverseSqrt:Z9,inversesqrt:mTe,invocationLocalIndex:wTe,invocationSubgroupIndex:bTe,ior:qw,iridescence:tI,iridescenceIOR:VR,iridescenceThickness:GR,isolate:Z_,ivec2:Ur,ivec3:z9,ivec4:G9,js:fCe,label:Gne,length:gf,lengthSq:az,lessThan:jte,lessThanEqual:Xte,lightPosition:Jz,lightProjectionUV:fse,lightShadowMatrix:bI,lightTargetDirection:tV,lightTargetPosition:dse,lightViewPosition:eV,lightingContext:yre,lights:pRe,linearDepth:i4,linearToneMapping:ise,localId:bCe,log:sI,log2:mf,logarithmicDepthToViewZ:SEe,luminance:Zz,mat2:eI,mat3:So,mat4:cm,matcapUV:zre,materialAO:cre,materialAlphaTest:Oie,materialAnisotropy:Qie,materialAnisotropyVector:q_,materialAttenuationColor:ore,materialAttenuationDistance:sre,materialClearcoat:jie,materialClearcoatNormal:$ie,materialClearcoatRoughness:Xie,materialColor:Uie,materialDispersion:lre,materialEmissive:zie,materialEnvIntensity:DR,materialEnvRotation:JR,materialIOR:rre,materialIridescence:Jie,materialIridescenceIOR:ere,materialIridescenceThickness:tre,materialLightMap:Fz,materialLineDashOffset:Nz,materialLineDashSize:Lz,materialLineGapSize:Dz,materialLineScale:Pz,materialLineWidth:e4,materialMetalness:Hie,materialNormal:Wie,materialOpacity:Iz,materialPointSize:are,materialReference:Gd,materialReflectivity:NR,materialRefractionRatio:vie,materialRotation:Yie,materialRoughness:qie,materialSheen:Zie,materialSheenRoughness:Kie,materialShininess:kie,materialSpecular:Vie,materialSpecularColor:Gie,materialSpecularIntensity:NU,materialSpecularStrength:Hw,materialThickness:ire,materialTransmission:nre,max:kr,maxMipLevel:_z,mediumpModelViewMatrix:die,metalness:Hd,min:Ml,mix:Qn,mixElement:Bne,mod:iI,modelDirection:VTe,modelNormalMatrix:fie,modelPosition:GTe,modelRadius:WTe,modelScale:qTe,modelViewMatrix:yf,modelViewPosition:HTe,modelViewProjection:ure,modelWorldMatrix:Yc,modelWorldMatrixInverse:jTe,morphReference:xre,mrt:Xre,mul:Tn,mx_aastep:Pse,mx_add:Z4e,mx_atan2:nIe,mx_cell_noise_float:W4e,mx_contrast:B4e,mx_divide:J4e,mx_fractal_noise_float:j4e,mx_fractal_noise_vec2:X4e,mx_fractal_noise_vec3:$4e,mx_fractal_noise_vec4:Y4e,mx_frame:rIe,mx_heighttonormal:dIe,mx_hsvtorgb:E4e,mx_ifequal:lIe,mx_ifgreater:oIe,mx_ifgreatereq:aIe,mx_invert:sIe,mx_modulo:eIe,mx_multiply:Q4e,mx_noise_float:O4e,mx_noise_vec3:U4e,mx_noise_vec4:k4e,mx_place2d:uIe,mx_power:tIe,mx_ramp4:P4e,mx_ramplr:R4e,mx_ramptb:I4e,mx_rgbtohsv:M4e,mx_rotate2d:hIe,mx_rotate3d:fIe,mx_safepower:F4e,mx_separate:cIe,mx_splitlr:L4e,mx_splittb:D4e,mx_srgb_texture_to_lin_rec709:C4e,mx_subtract:K4e,mx_timer:iIe,mx_transform_uv:N4e,mx_unifiednoise2d:z4e,mx_unifiednoise3d:V4e,mx_worley_noise_float:G4e,mx_worley_noise_vec2:q4e,mx_worley_noise_vec3:H4e,negate:ez,negateOnBackSide:t1,neutralToneMapping:lse,nodeArray:Fg,nodeImmutable:xt,nodeObject:Ht,nodeObjectIntent:Uw,nodeObjects:Q4,nodeProxy:$n,nodeProxyConstructor:O9,nodeProxyIntent:ct,normalFlat:Aie,normalGeometry:hI,normalLocal:ya,normalMap:LU,normalView:hi,normalViewGeometry:tx,normalWorld:_m,normalWorldGeometry:gie,normalize:_a,not:Kte,notEqual:Wte,numWorkgroups:_Ce,objectDirection:FTe,objectGroup:zte,objectPosition:OTe,objectRadius:zTe,objectScale:UTe,objectViewPosition:kTe,objectWorldMatrix:BTe,oneMinus:yne,or:Zte,orthographicDepthToViewZ:wre,oscSawtooth:xMe,oscSine:gMe,oscSquare:vMe,oscTriangle:_Me,output:$_,outputStruct:$3e,overloadingFn:$o,overrideNode:Hre,overrideNodes:Wre,packHalf2x16:cMe,packNormalToRGB:Cz,packSnorm2x16:aMe,packUnorm2x16:lMe,parabola:F7,parallaxDirection:Nie,parallaxUV:sEe,parameter:W3e,pass:rCe,passTexture:sCe,pcurve:sMe,perspectiveDepthToViewZ:mI,pmremTexture:Xz,pointShadow:Sse,pointUV:UMe,pointWidth:aTe,positionGeometry:Aa,positionLocal:Er,positionPrevious:jg,positionView:_s,positionViewDirection:er,positionWorld:vf,positionWorldDirection:wz,posterize:nCe,pow:$c,pow2:sz,pow3:Ine,pow4:oz,premultiplyAlpha:gz,property:$d,quadBroadcast:lRe,quadSwapDiagonal:nRe,quadSwapX:eRe,quadSwapY:tRe,radians:hne,rand:Fne,range:vCe,rangeFogFactor:use,reciprocal:wne,reference:mr,referenceBuffer:Sie,reflect:Mne,reflectVector:yie,reflectView:_ie,reflector:RMe,refract:lz,refractVector:bie,refractView:xie,reinhardToneMapping:rse,remap:Az,remapClamp:rie,renderGroup:Jt,renderOutput:vz,rendererReference:Zne,replaceDefaultUV:yMe,rotate:_S,rotateUV:bMe,roughness:df,round:bne,rtt:Qre,sRGBTransferEOTF:Xne,sRGBTransferOETF:$ne,sample:FMe,sampler:RTe,samplerComparison:ITe,saturate:aI,saturation:QMe,screenCoordinate:e1,screenDPR:yz,screenSize:Wg,screenUV:qu,select:va,setCurrentStack:Zw,setName:uz,shaderStages:LR,shadow:yse,shadowPositionWorld:nV,shapeCircle:DRe,sharedUniformGroup:nI,sheen:rc,sheenRoughness:nm,shiftLeft:ine,shiftRight:rne,shininess:HR,sign:J9,sin:Ya,sinc:oMe,sinh:dne,skinning:vre,smoothstep:uc,smoothstepElement:One,specularColor:fm,specularColorBlended:Pg,specularF90:Lg,spherizeUV:wMe,split:sTe,spritesheetUV:EMe,sqrt:Qa,stack:BR,step:qg,stepElement:Une,storage:um,storageBarrier:TCe,storageTexture:tse,storageTexture3D:zMe,struct:X3e,sub:ai,subBuild:Ug,subgroupAdd:zCe,subgroupAll:KCe,subgroupAnd:jCe,subgroupAny:QCe,subgroupBallot:kCe,subgroupBroadcast:iRe,subgroupBroadcastFirst:JCe,subgroupElect:UCe,subgroupExclusiveAdd:GCe,subgroupExclusiveMul:WCe,subgroupInclusiveAdd:VCe,subgroupInclusiveMul:HCe,subgroupIndex:yTe,subgroupMax:ZCe,subgroupMin:YCe,subgroupMul:qCe,subgroupOr:XCe,subgroupShuffle:rRe,subgroupShuffleDown:aRe,subgroupShuffleUp:oRe,subgroupShuffleXor:sRe,subgroupSize:wCe,subgroupXor:$Ce,tan:mne,tangentGeometry:fI,tangentLocal:dm,tangentView:dI,tangentWorld:Lie,tanh:Ane,texture:fi,texture3D:Yz,texture3DLevel:qMe,texture3DLoad:GMe,textureBarrier:ECe,textureBicubic:KEe,textureBicubicLevel:jz,textureCubeUV:Ore,textureLevel:CTe,textureLoad:vs,textureSize:Hg,textureStore:kMe,thickness:H9,time:fx,toneMapping:Kne,toneMappingExposure:Qne,toonOutlinePass:aCe,transformDirection:Pne,transformNormal:Tz,transformNormalByInverseViewMatrix:Dne,transformNormalByViewMatrix:Lne,transformNormalToView:Ez,transformedClearcoatNormalView:ZTe,transformedNormalView:$Te,transformedNormalWorld:YTe,transmission:WR,transpose:Sne,triNoise3D:pMe,triplanarTexture:MMe,triplanarTextures:Kre,trunc:iz,uint:rt,uintBitsToFloat:J3e,uniform:Xt,uniformArray:Wo,uniformCubeTexture:KTe,uniformFlow:kne,uniformGroup:kte,uniformTexture:MTe,unpackHalf2x16:fMe,unpackNormal:IU,unpackRGBToNormal:Bie,unpackSnorm2x16:uMe,unpackUnorm2x16:hMe,unpremultiplyAlpha:oie,userData:HMe,uv:Ui,uvec2:k9,uvec3:Qg,uvec4:q9,varying:Am,varyingProperty:Jg,vec2:dt,vec3:pe,vec4:Ft,vectorComponents:Kg,velocity:WMe,vertexColor:Ere,vertexIndex:Jne,vertexStage:jne,vibrance:JMe,viewZToLogarithmicDepth:AI,viewZToOrthographicDepth:kg,viewZToPerspectiveDepth:Vz,viewZToReversedOrthographicDepth:wEe,viewZToReversedPerspectiveDepth:Sre,viewport:Q_,viewportCoordinate:cie,viewportDepthTexture:zz,viewportLinearDepth:TEe,viewportMipTexture:kz,viewportOpaqueMipTexture:bre,viewportResolution:LTe,viewportSafeUV:TMe,viewportSharedTexture:iCe,viewportSize:bz,viewportTexture:yEe,viewportUV:PTe,vogelDiskSample:Gu,wgsl:dCe,wgslFn:ACe,workgroupArray:MCe,workgroupBarrier:SCe,workgroupId:xCe,workingToColorSpace:Yne,xor:Qte}),ku=new rS,ok=class extends Sf{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(ku),ku.a=r._clearColor.a;else if(s.isColor===!0)s.getRGB(ku),ku.a=1,o=!0;else if(s.isNode===!0){let l=this.get(e),c=s;ku.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(H7).context({getUV:()=>ese.mul(gie),getTextureLevel:()=>Jre}),A=Ka.element(3).element(3).equal(1),y=cc(1,Ka.element(1).element(1)).mul(3),w=A.select(Er.mul(y),Er),S=yf.mul(Ft(w,0)),T=Ka.mul(Ft(S.xyz,1));T=T.setZ(T.w);let R=new Rr;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 ka(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(H7),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"?ku.set(0,0,0,1):a==="alpha-blend"&&ku.set(0,0,0,0),r.autoClear===!0||o===!0){let l=n.clearColorValue;l.r=ku.r,l.g=ku.g,l.b=ku.b,l.a=ku.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}},mIe=0,cS=class{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=mIe++}},ak=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}},T4=class{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}},lk=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}},E4=class{constructor(e,t,n=!1,r=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=r}},ck=class extends E4{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})}},AIe=0,$w=class{constructor(e=null){this.id=AIe++,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)}},hk=class{constructor(e,t){this.name=e,this.members=t,this.output=!1}},Ef=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}},fk=class extends Ef{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}},dk=class extends Ef{constructor(e,t=new Oe){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}},pk=class extends Ef{constructor(e,t=new re){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}},mk=class extends Ef{constructor(e,t=new xn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}},Ak=class extends Ef{constructor(e,t=new zt){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}},gk=class extends Ef{constructor(e,t=new Kv){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}},vk=class extends Ef{constructor(e,t=new Mn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}},_k=class extends Ef{constructor(e,t=new cn){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}},xk=class extends fk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},yk=class extends dk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},bk=class extends pk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},wk=class extends mk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Sk=class extends Ak{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Tk=class extends gk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Ek=class extends vk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Mk=class extends _k{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},gIe=0,Zee=new WeakMap,Kee=new WeakMap,vIe=new WeakMap,_Ie=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),AR=i=>/e/g.test(i)?String(i).replace(/\+/g,""):(i=Number(i),i+(i%1?"":".0")),Fse=i=>{if(i.writeUsageCount>0)return!0;if(i.subBuildsCache!==void 0){for(let e in i.subBuildsCache)if(Fse(i.subBuildsCache[e]))return!0}return!1},M4=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=BR(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new $w,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:gIe++})}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 Na(e,t,n)}createCubeRenderTarget(e,t){return new r4(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===Yr?o="ivec":r===xi&&(o="uvec"),s===Id||s===Uh?r===Yr?t="int":r===xi?t="uint":t="float":s===Ws||s===kh?t=`${o}2`:s===Rd||s===mb?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=Zee.get(a);l===void 0&&(l=new Map,Zee.set(a,l));let c=cx(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 LR)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===h0||e.magFilter===Oc||e.magFilter===ko||e.minFilter===Mi||e.minFilter===h0||e.minFilter===Oc||e.minFilter===ko}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 $w(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(Fse(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 AR(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")}( ${AR(t.r)}, ${AR(t.g)}, ${AR(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 T4(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===Yr?"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=Ete(e),r=t==="float"?"":t[0];return/mat2/.test(t)===!0&&(n=n.replace("vec","mat")),r+n}getTypeFromArray(e){return _Ie.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 zv)&&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=BR(this.stack);let e=U9();return this.stacks.push(e),Zw(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,Zw(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 T4(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 hk(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 lk(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 E4(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 ck(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=Kee.get(t);n===void 0&&(n=new WeakMap,Kee.set(t,n));let r=n.get(e);if(r===void 0){r=new x4;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 d4(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 $w,this.stack=BR();for(let u of PR)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 Rr),r.build(this)}else this.addFlow("compute",e)}build(){this.prebuild();for(let e of PR){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of LR){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 PR){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of LR){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this);await z8()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=gIe.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 xk(e);else if(t==="vec2"||t==="ivec2"||t==="uvec2")r=new yk(e);else if(t==="vec3"||t==="ivec3"||t==="uvec3")r=new bk(e);else if(t==="vec4"||t==="ivec4"||t==="uvec4")r=new wk(e);else if(t==="color")r=new Sk(e);else if(t==="mat2")r=new Tk(e);else if(t==="mat3")r=new Ek(e);else if(t==="mat4")r=new Mk(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")||Mte(this.object).useVelocity===!0}},C4=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}},cS=class{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}};cS.isNodeFunctionInput=!0;var Ck=class extends Xd{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}},Rk=class extends Xd{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){let e=this.colorNode;return{lightDirection:tV(this.light),lightColor:e}}},Ik=class extends Xd{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=Jz(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=_m.dot(r).mul(.5).add(.5),a=Kn(n,t,o);e.context.irradiance.addAssign(a)}},uS=class extends Xd{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 uc(n,r,t)}getLightCoord(e){let t=e.getNodeProperties(this),n=t.projectionUV;return n===void 0&&(n=hse(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(tV(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}}},Pk=class extends uS{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)}},Lk=class extends Xd{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=Ho(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=Dse(_m,this.lightProbe);e.context.irradiance.addAssign(t)}},_Ie=me(([i,e])=>{let t=i.abs().sub(e);return gf(kr(t,0)).add(Ml(kr(t.x,t.y),0))}),Dk=class extends uS{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=bI(this.light).mul(e.context.positionWorld||vf);return $t(r.w.greaterThan(0),()=>{let s=r.xyz.div(r.w),o=_Ie(s.xy.sub(dt(.5)),dt(.5)),a=cc(-1,ai(1,K9(n)).sub(1));t.assign(aI(o.mul(-2).mul(a)))}),t}},DO=new cn,gR=new cn,Rw=null,Nk=class extends Xd{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;gR.identity(),DO.copy(t.matrixWorld),DO.premultiply(n),gR.extractRotation(DO),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(gR),this.halfHeight.value.applyMatrix4(gR)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=fi(Rw.LTC_FLOAT_1),n=fi(Rw.LTC_FLOAT_2)):(t=fi(Rw.LTC_HALF_1),n=fi(Rw.LTC_HALF_2));let{colorNode:r,light:s}=this,o=eV(s);return{lightColor:r,lightPosition:o,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){Rw=e}},R4=class{parseFunction(){Xe("Abstract function.")}},hS=class{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){Xe("Abstract function.")}};hS.isNodeFunction=!0;var xIe=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,yIe=/[a-z_0-9]+/ig,Kee="#pragma main",bIe=i=>{i=i.trim();let e=i.indexOf(Kee),t=e!==-1?i.slice(e+Kee.length):i,n=t.match(xIe);if(n!==null&&n.length===5){let r=n[4],s=[],o=null;for(;(o=yIe.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 cS(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.")},Fk=class extends hS{constructor(e){let{type:t,inputs:n,name:r,precision:s,inputsCode:o,blockCode:a,headerCode:l}=bIe(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}},Bk=class extends R4{parseFunction(e){return new Fk(e)}},qc=[],Od=[],Qee=Xt(0,"int").setGroup(Jt),Ok=class extends Sf{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new C4,this.nodeBuilderCache=new Map,this.callHashCache=new wf,this.groupsData=new wf,this._buildQueue=[],this._buildInProgress=!1,this.cacheLib={}}updateGroup(e){let t=e.groupNode;if(t.updateType===yn.OBJECT)return!0;qc[0]=t,qc[1]=e;let n=this.groupsData.get(qc);return n===void 0&&this.groupsData.set(qc,n={}),qc[0]=null,qc[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 Rr),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 Rr),l.build();let u=c.stackTrace;!u&&c.stack&&(u=new Jr(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 ak(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){qc[0]=e,qc[1]=t;let n=this.renderer.info.calls,r=this.callHashCache.get(qc)||{};if(r.callId!==n){if(Od.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),Od.push(this.renderer.lighting.enabled?1:0),this.renderer.lighting.enabled){Od.push(t.getCacheKey(!0)),Od.push(this.renderer.shadowMap.enabled?1:0),Od.push(this.renderer.shadowMap.type);let o=this.getEnvironmentNode(e);o&&Od.push(o.getCacheKey())}let s=this.getFogNode(e);s&&Od.push(s.getCacheKey()),r.callId=n,r.cacheKey=mS(Od),this.callHashCache.set(qc,r),Od.length=0}return qc[0]=null,qc[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===c0||n.mapping===u0||n.mapping===Fh){if(e.backgroundBlurriness>0||n.mapping===Fh)return Xz(n);{let o;return n.isCubeTexture===!0?o=Za(n):o=fi(n),Cre(o)}}else{if(n.isTexture===!0)return fi(n,Gu.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 K7(s,use(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 K7(s,cse(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 Za(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,Gu).depth(Zd("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):n=fi(e,Gu).depth(Qee).renderOutput(t.toneMapping,t.currentColorSpace):n=fi(e,Gu).renderOutput(t.toneMapping,t.currentColorSpace),n}setOutputLayerIndex(e){Qee.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 C4,this.nodeBuilderCache=new Map,this.cacheLib={}}},NO=new La,I4=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++){NO.copy(e[s]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);let o=t[n+s],a=NO.normal;o.x=-a.x,o.y=-a.y,o.z=-a.z,o.w=NO.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}},Uk=class{constructor(e,t,n){this.bundleGroup=e,this.camera=t,this.renderContext=n}},Z0=[],kk=class{constructor(){this.bundles=new wf}get(e,t,n){let r=this.bundles;Z0[0]=e,Z0[1]=t,Z0[2]=n;let s=r.get(Z0);return s===void 0&&(s=new Uk(e,t,n),r.set(Z0,s)),Z0[0]=null,Z0[1]=null,Z0[2]=null,s}dispose(){this.bundles=new wf}},P4=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)}},wIe=new aS,Jee=new WeakMap,zk=class{constructor(){this.enabled=!0,this._cache=[]}createNode(e=[]){return new aS().setLights(e)}getNode(e){if(e.isScene!==!0&&e.isGroup!==!0)return wIe;let t=Jee.get(e);return t===void 0&&(t=this.createNode(),Jee.set(e,t)),t}beginRender(e){this._cache.push(this.getNode(e).getLights())}finishRender(e){this.getNode(e).setLights(this._cache.pop())}},Ng=class extends Na{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}},ete=new re,tte=new re,nte=new WeakMap,Vk=class extends aa{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new Xr,this._cameraL.viewport=new xn,this._cameraL.matrixWorldAutoUpdate=!1,this._cameraR=new Xr,this._cameraR.viewport=new xn,this._cameraR.matrixWorldAutoUpdate=!1,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new Yv,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=RIe.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSamples=null,this._currentSize=new Oe,this._onSessionEvent=EIe.bind(this),this._onSessionEnd=MIe.bind(this),this._onInputSourcesChange=CIe.bind(this),this._onAnimationFrame=IIe.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 Na(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 kA(e,t),u=new Ng(s,o,{format:Br,type:Ji,depthTexture:new Es(s,o,l.stencil?la:xi,void 0,void 0,void 0,void 0,void 0,void 0,l.stencil?_o:Vs),stencilBuffer:l.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});u._autoAllocateDepthBuffer=!0;let f=new hs({color:16777215,side:Bo});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 hs({color:16777215,side:Bo}),A.plane.material.blending=Cd,A.plane.material.blendEquation=so,A.plane.material.blendSrc=Iu,A.plane.material.blendDst=Iu,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 BA(e,e,e*t/n,64,64,!0,Math.PI-t/2,t),f=new Ng(o,a,{format:Br,type:Ji,depthTexture:new Es(o,a,c.stencil?la:xi,void 0,void 0,void 0,void 0,void 0,void 0,c.stencil?_o:Vs),stencilBuffer:c.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});f._autoAllocateDepthBuffer=!0;let d=new hs({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 hs({color:16777215,side:mi}),y.plane.material.blending=Cd,y.plane.material.blendEquation=so,y.plane.material.blendSrc=Iu,y.plane.material.blendDst=Iu,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=nte.get(l),c===void 0&&(c=l.context({getOutput:f=>vz(f,n.toneMapping,n.outputColorSpace)}),nte.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?_o:Vs,s=t.stencil?la: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 Ng(c.textureWidth,c.textureHeight,{format:Br,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 hs({color:16777215,side:A.type==="cylinder"?mi:Bo}),A.plane.material.blending=Cd,A.plane.material.blendEquation=so,A.plane.material.blendSrc=Iu,A.plane.material.blendDst=Iu,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 Ng(s.framebufferWidth,s.framebufferHeight,{format:Br,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;ite(s,l);for(let u=0;u<c.length;u++)ite(c[u],l);c.length===2?SIe(s,o,a):s.projectionMatrix.copy(o.projectionMatrix),TIe(e,s,l)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new Jp,this._controllers[e]=t),t}};function SIe(i,e,t){ete.setFromMatrixPosition(e.matrixWorld),tte.setFromMatrixPosition(t.matrixWorld);let n=ete.distanceTo(tte),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 ite(i,e){e===null?i.matrixWorld.copy(i.matrix):i.matrixWorld.multiplyMatrices(e.matrixWorld,i.matrix),i.matrixWorldInverse.copy(i.matrixWorld).invert()}function TIe(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=wd*2*Math.atan(1/i.projectionMatrix.elements[5]),i.zoom=1)}function EIe(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 MIe(){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 Ng(t.pixelwidth,t.pixelheight,{format:Br,type:Ji,depthTexture:new Es(t.pixelwidth,t.pixelheight,t.stencilBuffer?la:xi,void 0,void 0,void 0,void 0,void 0,void 0,t.stencilBuffer?_o: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 CIe(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 RIe(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 IIe(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 Xr,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 Gk=class extends aa{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 FA,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"})}},rte=new e0,D_=new Oe,FO=new xn,vR=new Nc,_R=new g2,N_=new cn,Ud=new xn,PIe={[Bo]:mi,[mi]:Bo,[gr]:gr},qk=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=Nr,this.toneMapping=oo,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=o,this.stencil=a,this.info=new y7,this.contextNode=Yd(),this.library=new P4,this.lighting=new zk,this._samples=c||l===!0?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new Gk(e.getDomElement()),this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new ZR,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 iS(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:l0},this.xr=new Vk(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 Ok(this,n),this._animation=new A7(this,this._nodes,this.info),this._attributes=new _7(n,this.info),this._background=new ok(this,this._nodes),this._geometries=new x7(this._attributes,this.info),this._textures=new I7(this,n,this.info),this._pipelines=new S7(n,this._nodes,this.info),this._bindings=new T7(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new v7(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new M7(this.lighting),this._bundles=new kk,this._renderContexts=new R7(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:rte,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 I4),A.clippingContext.updateGlobal(u,t),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t),u.onBeforeRender(this,e,t,d);let S=t.isArrayCamera?_R:vR;t.isArrayCamera?S.setFromArrayCamera(t):(N_.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),S.setFromProjectionMatrix(N_,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 z8()}}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=bU,t.modelNormalViewMatrix=wU):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){let e=this.contextNode.value;return e.modelViewMatrix===bU&&e.modelNormalViewMatrix===wU}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 Rr),r.build(this)}else this.addFlow("compute",e)}build(){this.prebuild();for(let e of PR){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of LR){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 PR){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of LR){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this);await z8()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=vIe.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 xk(e);else if(t==="vec2"||t==="ivec2"||t==="uvec2")r=new yk(e);else if(t==="vec3"||t==="ivec3"||t==="uvec3")r=new bk(e);else if(t==="vec4"||t==="ivec4"||t==="uvec4")r=new wk(e);else if(t==="color")r=new Sk(e);else if(t==="mat2")r=new Tk(e);else if(t==="mat3")r=new Ek(e);else if(t==="mat4")r=new Mk(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")||Cte(this.object).useVelocity===!0}},C4=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}},uS=class{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}};uS.isNodeFunctionInput=!0;var Ck=class extends Xd{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}},Rk=class extends Xd{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){let e=this.colorNode;return{lightDirection:tV(this.light),lightColor:e}}},Ik=class extends Xd{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=Jz(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=_m.dot(r).mul(.5).add(.5),a=Qn(n,t,o);e.context.irradiance.addAssign(a)}},hS=class extends Xd{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 uc(n,r,t)}getLightCoord(e){let t=e.getNodeProperties(this),n=t.projectionUV;return n===void 0&&(n=fse(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(tV(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}}},Pk=class extends hS{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)}},Lk=class extends Xd{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=Wo(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=Nse(_m,this.lightProbe);e.context.irradiance.addAssign(t)}},xIe=me(([i,e])=>{let t=i.abs().sub(e);return gf(kr(t,0)).add(Ml(kr(t.x,t.y),0))}),Dk=class extends hS{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=bI(this.light).mul(e.context.positionWorld||vf);return $t(r.w.greaterThan(0),()=>{let s=r.xyz.div(r.w),o=xIe(s.xy.sub(dt(.5)),dt(.5)),a=cc(-1,ai(1,K9(n)).sub(1));t.assign(aI(o.mul(-2).mul(a)))}),t}},DO=new cn,gR=new cn,Iw=null,Nk=class extends Xd{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;gR.identity(),DO.copy(t.matrixWorld),DO.premultiply(n),gR.extractRotation(DO),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(gR),this.halfHeight.value.applyMatrix4(gR)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=fi(Iw.LTC_FLOAT_1),n=fi(Iw.LTC_FLOAT_2)):(t=fi(Iw.LTC_HALF_1),n=fi(Iw.LTC_HALF_2));let{colorNode:r,light:s}=this,o=eV(s);return{lightColor:r,lightPosition:o,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){Iw=e}},R4=class{parseFunction(){Xe("Abstract function.")}},fS=class{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){Xe("Abstract function.")}};fS.isNodeFunction=!0;var yIe=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,bIe=/[a-z_0-9]+/ig,Qee="#pragma main",wIe=i=>{i=i.trim();let e=i.indexOf(Qee),t=e!==-1?i.slice(e+Qee.length):i,n=t.match(yIe);if(n!==null&&n.length===5){let r=n[4],s=[],o=null;for(;(o=bIe.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 uS(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.")},Fk=class extends fS{constructor(e){let{type:t,inputs:n,name:r,precision:s,inputsCode:o,blockCode:a,headerCode:l}=wIe(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}},Bk=class extends R4{parseFunction(e){return new Fk(e)}},qc=[],Od=[],Jee=Xt(0,"int").setGroup(Jt),Ok=class extends Sf{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new C4,this.nodeBuilderCache=new Map,this.callHashCache=new wf,this.groupsData=new wf,this._buildQueue=[],this._buildInProgress=!1,this.cacheLib={}}updateGroup(e){let t=e.groupNode;if(t.updateType===yn.OBJECT)return!0;qc[0]=t,qc[1]=e;let n=this.groupsData.get(qc);return n===void 0&&this.groupsData.set(qc,n={}),qc[0]=null,qc[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 Rr),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 Rr),l.build();let u=c.stackTrace;!u&&c.stack&&(u=new Jr(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 ak(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){qc[0]=e,qc[1]=t;let n=this.renderer.info.calls,r=this.callHashCache.get(qc)||{};if(r.callId!==n){if(Od.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),Od.push(this.renderer.lighting.enabled?1:0),this.renderer.lighting.enabled){Od.push(t.getCacheKey(!0)),Od.push(this.renderer.shadowMap.enabled?1:0),Od.push(this.renderer.shadowMap.type);let o=this.getEnvironmentNode(e);o&&Od.push(o.getCacheKey())}let s=this.getFogNode(e);s&&Od.push(s.getCacheKey()),r.callId=n,r.cacheKey=AS(Od),this.callHashCache.set(qc,r),Od.length=0}return qc[0]=null,qc[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===c0||n.mapping===u0||n.mapping===Fh){if(e.backgroundBlurriness>0||n.mapping===Fh)return Xz(n);{let o;return n.isCubeTexture===!0?o=Za(n):o=fi(n),Rre(o)}}else{if(n.isTexture===!0)return fi(n,qu.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 K7(s,hse(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 K7(s,use(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 Za(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,qu).depth(Zd("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):n=fi(e,qu).depth(Jee).renderOutput(t.toneMapping,t.currentColorSpace):n=fi(e,qu).renderOutput(t.toneMapping,t.currentColorSpace),n}setOutputLayerIndex(e){Jee.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 C4,this.nodeBuilderCache=new Map,this.cacheLib={}}},NO=new La,I4=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++){NO.copy(e[s]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);let o=t[n+s],a=NO.normal;o.x=-a.x,o.y=-a.y,o.z=-a.z,o.w=NO.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}},Uk=class{constructor(e,t,n){this.bundleGroup=e,this.camera=t,this.renderContext=n}},Z0=[],kk=class{constructor(){this.bundles=new wf}get(e,t,n){let r=this.bundles;Z0[0]=e,Z0[1]=t,Z0[2]=n;let s=r.get(Z0);return s===void 0&&(s=new Uk(e,t,n),r.set(Z0,s)),Z0[0]=null,Z0[1]=null,Z0[2]=null,s}dispose(){this.bundles=new wf}},P4=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)}},SIe=new lS,ete=new WeakMap,zk=class{constructor(){this.enabled=!0,this._cache=[]}createNode(e=[]){return new lS().setLights(e)}getNode(e){if(e.isScene!==!0&&e.isGroup!==!0)return SIe;let t=ete.get(e);return t===void 0&&(t=this.createNode(),ete.set(e,t)),t}beginRender(e){this._cache.push(this.getNode(e).getLights())}finishRender(e){this.getNode(e).setLights(this._cache.pop())}},Ng=class extends Na{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}},tte=new re,nte=new re,ite=new WeakMap,Vk=class extends aa{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new Xr,this._cameraL.viewport=new xn,this._cameraL.matrixWorldAutoUpdate=!1,this._cameraR=new Xr,this._cameraR.viewport=new xn,this._cameraR.matrixWorldAutoUpdate=!1,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new Yv,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=IIe.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSamples=null,this._currentSize=new Oe,this._onSessionEvent=MIe.bind(this),this._onSessionEnd=CIe.bind(this),this._onInputSourcesChange=RIe.bind(this),this._onAnimationFrame=PIe.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 Na(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 kA(e,t),u=new Ng(s,o,{format:Br,type:Ji,depthTexture:new Es(s,o,l.stencil?la:xi,void 0,void 0,void 0,void 0,void 0,void 0,l.stencil?_o:Vs),stencilBuffer:l.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});u._autoAllocateDepthBuffer=!0;let f=new hs({color:16777215,side:Oo});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 hs({color:16777215,side:Oo}),A.plane.material.blending=Cd,A.plane.material.blendEquation=so,A.plane.material.blendSrc=Pu,A.plane.material.blendDst=Pu,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 BA(e,e,e*t/n,64,64,!0,Math.PI-t/2,t),f=new Ng(o,a,{format:Br,type:Ji,depthTexture:new Es(o,a,c.stencil?la:xi,void 0,void 0,void 0,void 0,void 0,void 0,c.stencil?_o:Vs),stencilBuffer:c.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});f._autoAllocateDepthBuffer=!0;let d=new hs({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 hs({color:16777215,side:mi}),y.plane.material.blending=Cd,y.plane.material.blendEquation=so,y.plane.material.blendSrc=Pu,y.plane.material.blendDst=Pu,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=ite.get(l),c===void 0&&(c=l.context({getOutput:f=>vz(f,n.toneMapping,n.outputColorSpace)}),ite.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?_o:Vs,s=t.stencil?la: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 Ng(c.textureWidth,c.textureHeight,{format:Br,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 hs({color:16777215,side:A.type==="cylinder"?mi:Oo}),A.plane.material.blending=Cd,A.plane.material.blendEquation=so,A.plane.material.blendSrc=Pu,A.plane.material.blendDst=Pu,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 Ng(s.framebufferWidth,s.framebufferHeight,{format:Br,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;rte(s,l);for(let u=0;u<c.length;u++)rte(c[u],l);c.length===2?TIe(s,o,a):s.projectionMatrix.copy(o.projectionMatrix),EIe(e,s,l)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new Jp,this._controllers[e]=t),t}};function TIe(i,e,t){tte.setFromMatrixPosition(e.matrixWorld),nte.setFromMatrixPosition(t.matrixWorld);let n=tte.distanceTo(nte),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 rte(i,e){e===null?i.matrixWorld.copy(i.matrix):i.matrixWorld.multiplyMatrices(e.matrixWorld,i.matrix),i.matrixWorldInverse.copy(i.matrixWorld).invert()}function EIe(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=wd*2*Math.atan(1/i.projectionMatrix.elements[5]),i.zoom=1)}function MIe(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 CIe(){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 Ng(t.pixelwidth,t.pixelheight,{format:Br,type:Ji,depthTexture:new Es(t.pixelwidth,t.pixelheight,t.stencilBuffer?la:xi,void 0,void 0,void 0,void 0,void 0,void 0,t.stencilBuffer?_o: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 RIe(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 IIe(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 PIe(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 Xr,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 Gk=class extends aa{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 FA,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"})}},ste=new e0,D_=new Oe,FO=new xn,vR=new Nc,_R=new v2,N_=new cn,Ud=new xn,LIe={[Oo]:mi,[mi]:Oo,[gr]:gr},qk=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=Nr,this.toneMapping=oo,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=o,this.stencil=a,this.info=new y7,this.contextNode=Yd(),this.library=new P4,this.lighting=new zk,this._samples=c||l===!0?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new Gk(e.getDomElement()),this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new ZR,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 rS(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:l0},this.xr=new Vk(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 Ok(this,n),this._animation=new A7(this,this._nodes,this.info),this._attributes=new _7(n,this.info),this._background=new ok(this,this._nodes),this._geometries=new x7(this._attributes,this.info),this._textures=new I7(this,n,this.info),this._pipelines=new S7(n,this._nodes,this.info),this._bindings=new T7(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new v7(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new M7(this.lighting),this._bundles=new kk,this._renderContexts=new R7(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:ste,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 I4),A.clippingContext.updateGlobal(u,t),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t),u.onBeforeRender(this,e,t,d);let S=t.isArrayCamera?_R:vR;t.isArrayCamera?S.setFromArrayCamera(t):(N_.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),S.setFromProjectionMatrix(N_,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 z8()}}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=bU,t.modelNormalViewMatrix=wU):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){let e=this.contextNode.value;return e.modelViewMatrix===bU&&e.modelNormalViewMatrix===wU}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!==oo,r=t!==ln.workingColorSpace;if(n===!1&&r===!1)return null;let{width:s,height:o}=this.getDrawingBufferSize(D_),{depth:a,stencil:l}=this,c=this._outputRenderTarget||this._canvasTarget,u=this._frameBufferTargets.get(c);if(u===void 0){u=new Na(s,o,{depthBuffer:a,stencilBuffer:l,type:this._outputBufferType,format:Br,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:rte,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(D_),FO.set(0,0,D_.width,D_.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(FO)===!1,w.scissorValue.copy(R).multiplyScalar(P).floor(),w.scissor=S._scissorTest&&w.scissorValue.equals(FO)===!1,w.scissorValue.width>>=A,w.scissorValue.height>>=A,w.clippingContext||(w.clippingContext=new I4),w.clippingContext.updateGlobal(u,t),u.onBeforeRender(this,e,t,y);let D=t.isArrayCamera?_R:vR;t.isArrayCamera?D.setFromArrayCamera(t):(N_.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),D.setFromProjectionMatrix(N_,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=D_.width,w.height=D_.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(Ud.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 oS(new Rr),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!==oo,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:oo}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=Ud.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=Ud.copy(t).floor();else{ze("Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=Ud.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?_R:vR;if(!e.frustumCulled||l.intersectsSprite(e)){this.sortObjects===!0&&Ud.setFromMatrixPosition(e.matrixWorld).applyMatrix4(N_);let{geometry:c,material:u}=e;u.visible&&r.push(e,c,u,n,Ud.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?_R:vR;if(!e.frustumCulled||l.intersectsObject(e)){let{geometry:c,material:u}=e;if(this.sortObjects===!0&&(c.boundingSphere===null&&c.computeBoundingSphere(),Ud.copy(c.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(N_)),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,Ud.z,y,s)}}else u.visible&&r.push(e,c,u,n,Ud.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=Bo;this._renderObjects(e,n,r,s);for(let{material:o}of t)o.side=gr}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===Fc?P.side=s.shadowSide!==null?s.shadowSide:s.side:P.side=s.shadowSide!==null?s.shadowSide:PIe[s.side],I!==null&&(P.colorNode=I),F!==null&&(P.depthNode=F),D!==null&&(P.positionNode=D)}s=P}s.transparent===!0&&s.side===gr&&s.forceSinglePass===!1?(s.side=mi,this._handleObjectFunction(e,s,t,n,a,o,l,"backSide"),s.side=Bo,this._handleObjectFunction(e,s,t,n,a,o,l,c),s.side=gr):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}},L4=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 Fse(i){return i+(om-i%om)%om}var D4=class extends L4{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 Fse(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}release(){this._buffer=null}},N4=class extends D4{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}},LIe=0,F4=class extends N4{constructor(e,t){super("UniformBuffer_"+LIe++,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 Fse(this.buffer.byteLength)}get buffer(){return this.nodeUniform.value}},Hk=class extends N4{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%om,c=l%o,u=l+c;t+=c,u!==0&&om-u<a&&(t+=om-u),s.offset=t/e,s.index=n,t+=a}return Math.ceil(t/om)*om}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 NIe(n,r,s)===!1&&(this.buffer.set(r,s),DIe(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 DIe(i,e,t){for(let n=0,r=e.length;n<r;n++)i[t+n]=e[n]}function NIe(i,e,t){for(let n=0,r=e.length;n<r;n++)if(i[t+n]!==e[n])return!1;return!0}var FIe=0,B4=class extends Hk{constructor(e,t){super(e),this.id=FIe++,this.groupNode=t,this.isNodeUniformsGroup=!0}},O4=class extends L4{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}},BIe=0,Wk=class extends O4{constructor(e,t){super(e,t),this.id=BIe++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}},ox=class extends Wk{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()}},U4=class extends ox{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledCubeTexture=!0}},fS=class extends ox{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledTexture3D=!0}},ste={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!==oo,r=t!==ln.workingColorSpace;if(n===!1&&r===!1)return null;let{width:s,height:o}=this.getDrawingBufferSize(D_),{depth:a,stencil:l}=this,c=this._outputRenderTarget||this._canvasTarget,u=this._frameBufferTargets.get(c);if(u===void 0){u=new Na(s,o,{depthBuffer:a,stencilBuffer:l,type:this._outputBufferType,format:Br,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:ste,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(D_),FO.set(0,0,D_.width,D_.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(FO)===!1,w.scissorValue.copy(R).multiplyScalar(P).floor(),w.scissor=S._scissorTest&&w.scissorValue.equals(FO)===!1,w.scissorValue.width>>=A,w.scissorValue.height>>=A,w.clippingContext||(w.clippingContext=new I4),w.clippingContext.updateGlobal(u,t),u.onBeforeRender(this,e,t,y);let D=t.isArrayCamera?_R:vR;t.isArrayCamera?D.setFromArrayCamera(t):(N_.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),D.setFromProjectionMatrix(N_,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=D_.width,w.height=D_.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(Ud.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 aS(new Rr),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!==oo,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:oo}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=Ud.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=Ud.copy(t).floor();else{ze("Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=Ud.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?_R:vR;if(!e.frustumCulled||l.intersectsSprite(e)){this.sortObjects===!0&&Ud.setFromMatrixPosition(e.matrixWorld).applyMatrix4(N_);let{geometry:c,material:u}=e;u.visible&&r.push(e,c,u,n,Ud.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?_R:vR;if(!e.frustumCulled||l.intersectsObject(e)){let{geometry:c,material:u}=e;if(this.sortObjects===!0&&(c.boundingSphere===null&&c.computeBoundingSphere(),Ud.copy(c.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(N_)),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,Ud.z,y,s)}}else u.visible&&r.push(e,c,u,n,Ud.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=Oo;this._renderObjects(e,n,r,s);for(let{material:o}of t)o.side=gr}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===Fc?P.side=s.shadowSide!==null?s.shadowSide:s.side:P.side=s.shadowSide!==null?s.shadowSide:LIe[s.side],I!==null&&(P.colorNode=I),F!==null&&(P.depthNode=F),D!==null&&(P.positionNode=D)}s=P}s.transparent===!0&&s.side===gr&&s.forceSinglePass===!1?(s.side=mi,this._handleObjectFunction(e,s,t,n,a,o,l,"backSide"),s.side=Oo,this._handleObjectFunction(e,s,t,n,a,o,l,c),s.side=gr):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}},L4=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 Bse(i){return i+(om-i%om)%om}var D4=class extends L4{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 Bse(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}release(){this._buffer=null}},N4=class extends D4{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}},DIe=0,F4=class extends N4{constructor(e,t){super("UniformBuffer_"+DIe++,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 Bse(this.buffer.byteLength)}get buffer(){return this.nodeUniform.value}},Hk=class extends N4{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%om,c=l%o,u=l+c;t+=c,u!==0&&om-u<a&&(t+=om-u),s.offset=t/e,s.index=n,t+=a}return Math.ceil(t/om)*om}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 FIe(n,r,s)===!1&&(this.buffer.set(r,s),NIe(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 NIe(i,e,t){for(let n=0,r=e.length;n<r;n++)i[t+n]=e[n]}function FIe(i,e,t){for(let n=0,r=e.length;n<r;n++)if(i[t+n]!==e[n])return!1;return!0}var BIe=0,B4=class extends Hk{constructor(e,t){super(e),this.id=BIe++,this.groupNode=t,this.isNodeUniformsGroup=!0}},O4=class extends L4{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}},OIe=0,Wk=class extends O4{constructor(e,t){super(e,t),this.id=OIe++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}},ox=class extends Wk{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()}},U4=class extends ox{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledCubeTexture=!0}},dS=class extends ox{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledTexture3D=!0}},ote={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-`)},OIe={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"},ate={swizzleAssign:!0,storageBuffer:!1},lte={perspective:"smooth",linear:"noperspective"},cte={centroid:"centroid"},ute=`4225+`)},UIe={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"},ate={low:"lowp",medium:"mediump",high:"highp"},lte={swizzleAssign:!0,storageBuffer:!1},cte={perspective:"smooth",linear:"noperspective"},ute={centroid:"centroid"},hte=`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-`,jk=class extends M4{constructor(e,t){super(e,t,new Bk),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==ca}_include(e){let t=ste[e];return t.build(this),this.addInclude(t),t}getMethod(e){return ste[e]!==void 0&&this._include(e),OIe[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+`,jk=class extends M4{constructor(e,t){super(e,t,new Bk),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==ca}_include(e){let t=ote[e];return t.build(this),this.addInclude(t),t}getMethod(e){return ote[e]!==void 0&&this._include(e),UIe[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?Uh:Id;s===2?a=o?kh:Ws:s===3?a=o?pb:Rd:s===4&&(a=o?f0:Br);let l={Float32Array:cr,Uint8Array:Ji,Uint16Array:xl,Uint32Array:xi,Int8Array:Bh,Int16Array:Oh,Int32Array:Yr,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 NA(t.array,c,u,a,l[t.array.constructor.name]||cr);A.needsUpdate=!0,A.isPBOTexture=!0;let y=new Jc(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="."+Kg.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===Yr&&(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===Yr&&(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?Uh:Id;s===2?a=o?kh:Ws:s===3?a=o?mb:Rd:s===4&&(a=o?f0:Br);let l={Float32Array:cr,Uint8Array:Ji,Uint16Array:xl,Uint32Array:xi,Int8Array:Bh,Int16Array:Oh,Int32Array:Yr,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 NA(t.array,c,u,a,l[t.array.constructor.name]||cr);A.needsUpdate=!0,A.isPBOTexture=!0;let y=new Jc(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="."+Kg.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===Yr&&(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===Yr&&(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=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(`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=ate[w]+" "+S),f.push(" "+S)}r[c]=f}}l=!0}if(!l){let c=o.node.precision;c!==null&&(a=ate[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!==Yr){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=lte[r.interpolationType]||r.interpolationType,a=cte[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=cte[r.interpolationType]||r.interpolationType,a=ute[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=lte[r.interpolationType]||r.interpolationType,a=cte[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=cte[r.interpolationType]||r.interpolationType,a=ute[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=ate[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)}ate[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=lte[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)}lte[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-${ute}4288+${hte}42894289 42904290 // structs42914291 ${e.structs}@@ -4324,7 +4324,7 @@ ${this.getSignature()}
43244324 ${e.extensions}43254325 43264326 // precision4327-${ute}4327+${hte}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 ox(s.name,s.node,l),u.push(a);else if(t==="cubeTexture"||t==="cubeDepthTexture")a=new U4(s.name,s.node,l),u.push(a);else if(t==="texture3D")a=new fS(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 F4(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 B4(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}},BO=null,F_=null,k4=class{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[Uc.RENDER]:null,[Uc.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:")?Uc.COMPUTE:Uc.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 BO=BO||new Oe,this.renderer.getDrawingBufferSize(BO)}setScissorTest(){}getClearColor(){let e=this.renderer;return F_=F_||new iS,e.getClearColor(F_),F_.getRGB(F_),F_}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(){}},UIe=0,Xk=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}},$k=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===Yr,id:UIe++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){let d=this._createBuffer(r,t,s,o);f=new Xk(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}},Iw,kd,Yk=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;Iw={[so]:e.FUNC_ADD,[Z2]:e.FUNC_SUBTRACT,[K2]:e.FUNC_REVERSE_SUBTRACT},kd={[Iu]:e.ZERO,[Q2]:e.ONE,[J2]:e.SRC_COLOR,[$p]:e.SRC_ALPHA,[sb]:e.SRC_ALPHA_SATURATE,[ib]:e.DST_COLOR,[tb]:e.DST_ALPHA,[eb]:e.ONE_MINUS_SRC_COLOR,[Yp]:e.ONE_MINUS_SRC_ALPHA,[rb]:e.ONE_MINUS_DST_COLOR,[nb]: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!==dM?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===$2?t.cullFace(t.BACK):e===pM?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===Y2?l=n:c.blending!==ds&&(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===Cd){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,Iw[l],Iw[d]),r.blendFuncSeparateiOES(e,kd[o],kd[a],kd[u],kd[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 Lh:r.blendFuncSeparateiOES(e,n.ONE,n.ONE,n.ONE,n.ONE);break;case Dh:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Nh: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 Lh:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case Dh:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Nh: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===ds){this.currentBlendingEnabled===!0&&(this.disable(c.BLEND),this.currentBlendingEnabled=!1);return}if(this.currentBlendingEnabled===!1&&(this.enable(c.BLEND),this.currentBlendingEnabled=!0),e!==Cd){if(e!==this.currentBlending||l!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==so||this.currentBlendEquationAlpha!==so)&&(c.blendEquation(c.FUNC_ADD),this.currentBlendEquation=so,this.currentBlendEquationAlpha=so),l)switch(e){case Ts:c.blendFuncSeparate(c.ONE,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case Lh:c.blendFunc(c.ONE,c.ONE);break;case Dh:c.blendFuncSeparate(c.ZERO,c.ONE_MINUS_SRC_COLOR,c.ZERO,c.ONE);break;case Nh: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 Lh:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE,c.ONE,c.ONE);break;case Dh:ze("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Nh: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(Iw[t],Iw[s]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=s),(n!==this.currentBlendSrc||r!==this.currentBlendDst||o!==this.currentBlendSrcAlpha||a!==this.currentBlendDstAlpha)&&(c.blendFuncSeparate(kd[n],kd[r],kd[o],kd[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=xb[e]),this.currentDepthFunc!==e){let{gl:t}=this;switch(e){case bA:t.depthFunc(t.NEVER);break;case wA:t.depthFunc(t.ALWAYS);break;case SA:t.depthFunc(t.LESS);break;case Mh:t.depthFunc(t.LEQUAL);break;case TA:t.depthFunc(t.EQUAL);break;case EA:t.depthFunc(t.GEQUAL);break;case MA:t.depthFunc(t.GREATER);break;case CA: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===gr?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(ds):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)}},Zk=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=ca){let{gl:n,extensions:r}=this,s,o=ln.getTransfer(t);if(e===Ji)return n.UNSIGNED_BYTE;if(e===jA)return n.UNSIGNED_SHORT_4_4_4_4;if(e===XA)return n.UNSIGNED_SHORT_5_5_5_1;if(e===$A)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===YA)return n.UNSIGNED_INT_10F_11F_11F_REV;if(e===Bh)return n.BYTE;if(e===Oh)return n.SHORT;if(e===xl)return n.UNSIGNED_SHORT;if(e===Yr)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===Qv)return n.ALPHA;if(e===Rd)return n.RGB;if(e===Br)return n.RGBA;if(e===Vs)return n.DEPTH_COMPONENT;if(e===_o)return n.DEPTH_STENCIL;if(e===Id)return n.RED;if(e===Uh)return n.RED_INTEGER;if(e===Ws)return n.RG;if(e===kh)return n.RG_INTEGER;if(e===f0)return n.RGBA_INTEGER;if(e===zh||e===Vh||e===Gh||e===qh)if(o===kt)if(s=r.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(e===zh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===Vh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===Gh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===qh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=r.get("WEBGL_compressed_texture_s3tc"),s!==null){if(e===zh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Vh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Gh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===qh)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===ZA||e===KA||e===QA||e===JA)if(s=r.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(e===ZA)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===KA)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===QA)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===JA)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===d0||e===p0||e===m0||e===A0||e===g0||e===Hh||e===v0)if(s=r.get("WEBGL_compressed_texture_etc"),s!==null){if(e===d0||e===p0)return o===kt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(e===m0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(e===A0)return s.COMPRESSED_R11_EAC;if(e===g0)return s.COMPRESSED_SIGNED_R11_EAC;if(e===Hh)return s.COMPRESSED_RG11_EAC;if(e===v0)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(e===_0||e===x0||e===y0||e===b0||e===w0||e===S0||e===T0||e===E0||e===M0||e===C0||e===R0||e===I0||e===P0||e===L0)if(s=r.get("WEBGL_compressed_texture_astc"),s!==null){if(e===_0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===x0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===y0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===b0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===w0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===S0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===T0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===E0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===M0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===C0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===R0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===I0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===P0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===L0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===D0||e===N0||e===F0)if(s=r.get("EXT_texture_compression_bptc"),s!==null){if(e===D0)return o===kt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(e===N0)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(e===F0)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(e===B0||e===O0||e===Wh||e===U0)if(s=r.get("EXT_texture_compression_rgtc"),s!==null){if(e===B0)return s.COMPRESSED_RED_RGTC1_EXT;if(e===O0)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===Wh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===U0)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===la?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()})}},hte=!1,xR,OO,fte,Kk=class{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,hte===!1&&(this._init(),hte=!0)}_init(){let e=this.gl;xR={[yd]:e.REPEAT,[oa]:e.CLAMP_TO_EDGE,[bd]:e.MIRRORED_REPEAT},OO={[Ti]:e.NEAREST,[db]:e.NEAREST_MIPMAP_NEAREST,[Oc]:e.NEAREST_MIPMAP_LINEAR,[Mi]:e.LINEAR,[h0]:e.LINEAR_MIPMAP_NEAREST,[Uo]:e.LINEAR_MIPMAP_LINEAR},fte={[Ab]:e.NEVER,[_b]:e.ALWAYS,[Jv]:e.LESS,[jh]:e.LEQUAL,[gb]:e.EQUAL,[Pu]:e.GEQUAL,[eg]:e.GREATER,[vb]: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?Kp: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?Kp: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===ca?null:ln.getPrimaries(t.colorSpace),c=t.colorSpace===ca||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,xR[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,xR[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,xR[t.wrapR])),n.texParameteri(e,n.TEXTURE_MAG_FILTER,OO[t.magFilter]);let u=t.mipmaps!==void 0&&t.mipmaps.length>0,f=t.minFilter===Mi&&u?Uo:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,OO[f]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,fte[t.compareFunction])),r.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===Ti||t.minFilter!==Oc&&t.minFilter!==Uo||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=yR(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=yR(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=yb(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=yR(y);n.texSubImage2D(a,d,0,0,y.width,y.height,l,c,w)}else{let d=yR(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],ge=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,ge),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 yR(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 Qk=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)}},Jk=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}},dte={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"},e9=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)}}},z4=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(){}},t9=class extends z4{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}}},V4=class extends k4{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 Qk(this),this.capabilities=new Jk(this),this.attributeUtils=new $k(this),this.textureUtils=new Kk(this),this.bufferRenderer=new e9(this),this.state=new Yk(this),this.utils=new Zk(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 Fo}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 t9(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(Uc.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(Uc.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(Uc.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(Uc.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,ge=te.width*z,Re=te.height*z;c.viewport(Math.floor(ce),Math.floor(e.context.height-Re-he),Math.floor(ge),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 jk(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 ox(s.name,s.node,l),u.push(a);else if(t==="cubeTexture"||t==="cubeDepthTexture")a=new U4(s.name,s.node,l),u.push(a);else if(t==="texture3D")a=new dS(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 F4(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 B4(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}},BO=null,F_=null,k4=class{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[Uc.RENDER]:null,[Uc.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:")?Uc.COMPUTE:Uc.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 BO=BO||new Oe,this.renderer.getDrawingBufferSize(BO)}setScissorTest(){}getClearColor(){let e=this.renderer;return F_=F_||new rS,e.getClearColor(F_),F_.getRGB(F_),F_}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(){}},kIe=0,Xk=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}},$k=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===Yr,id:kIe++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){let d=this._createBuffer(r,t,s,o);f=new Xk(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}},Pw,kd,Yk=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;Pw={[so]:e.FUNC_ADD,[K2]:e.FUNC_SUBTRACT,[Q2]:e.FUNC_REVERSE_SUBTRACT},kd={[Pu]:e.ZERO,[J2]:e.ONE,[eb]:e.SRC_COLOR,[$p]:e.SRC_ALPHA,[ob]:e.SRC_ALPHA_SATURATE,[rb]:e.DST_COLOR,[nb]:e.DST_ALPHA,[tb]:e.ONE_MINUS_SRC_COLOR,[Yp]:e.ONE_MINUS_SRC_ALPHA,[sb]:e.ONE_MINUS_DST_COLOR,[ib]: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!==dM?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===Y2?t.cullFace(t.BACK):e===pM?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===Z2?l=n:c.blending!==ds&&(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===Cd){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,Pw[l],Pw[d]),r.blendFuncSeparateiOES(e,kd[o],kd[a],kd[u],kd[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 Lh:r.blendFuncSeparateiOES(e,n.ONE,n.ONE,n.ONE,n.ONE);break;case Dh:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Nh: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 Lh:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case Dh:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Nh: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===ds){this.currentBlendingEnabled===!0&&(this.disable(c.BLEND),this.currentBlendingEnabled=!1);return}if(this.currentBlendingEnabled===!1&&(this.enable(c.BLEND),this.currentBlendingEnabled=!0),e!==Cd){if(e!==this.currentBlending||l!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==so||this.currentBlendEquationAlpha!==so)&&(c.blendEquation(c.FUNC_ADD),this.currentBlendEquation=so,this.currentBlendEquationAlpha=so),l)switch(e){case Ts:c.blendFuncSeparate(c.ONE,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case Lh:c.blendFunc(c.ONE,c.ONE);break;case Dh:c.blendFuncSeparate(c.ZERO,c.ONE_MINUS_SRC_COLOR,c.ZERO,c.ONE);break;case Nh: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 Lh:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE,c.ONE,c.ONE);break;case Dh:ze("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Nh: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(Pw[t],Pw[s]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=s),(n!==this.currentBlendSrc||r!==this.currentBlendDst||o!==this.currentBlendSrcAlpha||a!==this.currentBlendDstAlpha)&&(c.blendFuncSeparate(kd[n],kd[r],kd[o],kd[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=yb[e]),this.currentDepthFunc!==e){let{gl:t}=this;switch(e){case bA:t.depthFunc(t.NEVER);break;case wA:t.depthFunc(t.ALWAYS);break;case SA:t.depthFunc(t.LESS);break;case Mh:t.depthFunc(t.LEQUAL);break;case TA:t.depthFunc(t.EQUAL);break;case EA:t.depthFunc(t.GEQUAL);break;case MA:t.depthFunc(t.GREATER);break;case CA: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===gr?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(ds):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)}},Zk=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=ca){let{gl:n,extensions:r}=this,s,o=ln.getTransfer(t);if(e===Ji)return n.UNSIGNED_BYTE;if(e===jA)return n.UNSIGNED_SHORT_4_4_4_4;if(e===XA)return n.UNSIGNED_SHORT_5_5_5_1;if(e===$A)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===YA)return n.UNSIGNED_INT_10F_11F_11F_REV;if(e===Bh)return n.BYTE;if(e===Oh)return n.SHORT;if(e===xl)return n.UNSIGNED_SHORT;if(e===Yr)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===Qv)return n.ALPHA;if(e===Rd)return n.RGB;if(e===Br)return n.RGBA;if(e===Vs)return n.DEPTH_COMPONENT;if(e===_o)return n.DEPTH_STENCIL;if(e===Id)return n.RED;if(e===Uh)return n.RED_INTEGER;if(e===Ws)return n.RG;if(e===kh)return n.RG_INTEGER;if(e===f0)return n.RGBA_INTEGER;if(e===zh||e===Vh||e===Gh||e===qh)if(o===kt)if(s=r.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(e===zh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===Vh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===Gh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===qh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=r.get("WEBGL_compressed_texture_s3tc"),s!==null){if(e===zh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Vh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Gh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===qh)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===ZA||e===KA||e===QA||e===JA)if(s=r.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(e===ZA)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===KA)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===QA)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===JA)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===d0||e===p0||e===m0||e===A0||e===g0||e===Hh||e===v0)if(s=r.get("WEBGL_compressed_texture_etc"),s!==null){if(e===d0||e===p0)return o===kt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(e===m0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(e===A0)return s.COMPRESSED_R11_EAC;if(e===g0)return s.COMPRESSED_SIGNED_R11_EAC;if(e===Hh)return s.COMPRESSED_RG11_EAC;if(e===v0)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(e===_0||e===x0||e===y0||e===b0||e===w0||e===S0||e===T0||e===E0||e===M0||e===C0||e===R0||e===I0||e===P0||e===L0)if(s=r.get("WEBGL_compressed_texture_astc"),s!==null){if(e===_0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===x0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===y0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===b0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===w0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===S0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===T0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===E0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===M0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===C0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===R0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===I0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===P0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===L0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===D0||e===N0||e===F0)if(s=r.get("EXT_texture_compression_bptc"),s!==null){if(e===D0)return o===kt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(e===N0)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(e===F0)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(e===B0||e===O0||e===Wh||e===U0)if(s=r.get("EXT_texture_compression_rgtc"),s!==null){if(e===B0)return s.COMPRESSED_RED_RGTC1_EXT;if(e===O0)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===Wh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===U0)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===la?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()})}},fte=!1,xR,OO,dte,Kk=class{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,fte===!1&&(this._init(),fte=!0)}_init(){let e=this.gl;xR={[yd]:e.REPEAT,[oa]:e.CLAMP_TO_EDGE,[bd]:e.MIRRORED_REPEAT},OO={[Ti]:e.NEAREST,[pb]:e.NEAREST_MIPMAP_NEAREST,[Oc]:e.NEAREST_MIPMAP_LINEAR,[Mi]:e.LINEAR,[h0]:e.LINEAR_MIPMAP_NEAREST,[ko]:e.LINEAR_MIPMAP_LINEAR},dte={[gb]:e.NEVER,[xb]:e.ALWAYS,[Jv]:e.LESS,[jh]:e.LEQUAL,[vb]:e.EQUAL,[Lu]:e.GEQUAL,[eg]:e.GREATER,[_b]: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?Kp: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?Kp: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===ca?null:ln.getPrimaries(t.colorSpace),c=t.colorSpace===ca||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,xR[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,xR[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,xR[t.wrapR])),n.texParameteri(e,n.TEXTURE_MAG_FILTER,OO[t.magFilter]);let u=t.mipmaps!==void 0&&t.mipmaps.length>0,f=t.minFilter===Mi&&u?ko:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,OO[f]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,dte[t.compareFunction])),r.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===Ti||t.minFilter!==Oc&&t.minFilter!==ko||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=yR(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=yR(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=bb(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=yR(y);n.texSubImage2D(a,d,0,0,y.width,y.height,l,c,w)}else{let d=yR(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],ge=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,ge),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 yR(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 Qk=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)}},Jk=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}},pte={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"},e9=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)}}},z4=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(){}},t9=class extends z4{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}}},V4=class extends k4{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 Qk(this),this.capabilities=new Jk(this),this.attributeUtils=new $k(this),this.textureUtils=new Kk(this),this.bufferRenderer=new e9(this),this.state=new Yk(this),this.utils=new Zk(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 Bo}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 t9(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(Uc.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(Uc.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(Uc.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(Uc.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,ge=te.width*z,Re=te.height*z;c.viewport(Math.floor(ce),Math.floor(e.context.height-Re-he),Math.floor(ge),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 jk(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=e_(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=e_(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(dte).filter(r=>dte[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===Pd.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=Gre(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)}},Uw={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list"},xf=typeof self<"u"&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},Go={Never:"never",Less:"less",Equal:"equal",LessEqual:"less-equal",Greater:"greater",NotEqual:"not-equal",GreaterEqual:"greater-equal",Always:"always"},$a={Store:"store"},Fi={Load:"load",Clear:"clear"},pte={CCW:"ccw",CW:"cw"},mte={None:"none",Back:"back"},G4={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"},UO={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},Wc={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"},Eg={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},Ate={None:0,All:15},K0={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},kO={Storage:"storage",ReadOnlyStorage:"read-only-storage"},zO={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},gte={NonFiltering:"non-filtering",Comparison:"comparison"},Mg={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},vte={TwoD:"2d",ThreeD:"3d"},qo={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},kIe={All:"all"},bR={Vertex:"vertex",Instance:"instance"},q4={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"},_te={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"},n9=class extends O4{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 D4{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}},zIe=0,r9=class extends i9{constructor(e,t){super("StorageBuffer_"+zIe++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:Wo.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}},VO=[null],s9=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 Uw.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return Uw.LineList;if(e.isLine)return Uw.LineStrip;if(e.isMesh)return Uw.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 pf(i,e){VO[0]=e,i.queue.submit(VO),VO[0]=null}var H4=class{constructor(){this.label="",this.layout=null,this.entries=[]}reset(){this.label="",this.layout=null,this.entries.length=0}},mm=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}},Zg=class{constructor(){this.label=""}reset(){this.label=""}},W4=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}},Vg=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}},j4=class{constructor(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample=new o9,this.fragment=null}reset(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample.reset(),this.fragment=null}},o9=class{constructor(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}reset(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}},X4=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}},pS=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"}},Q0=new H4,J0=new mm,wR=new Zg,GO=new W4,qO=new Vg,B_=new j4,Pw=new zg,SR=new X4,O_=new dS,gs=new pS,a9=class extends Sf{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=e_(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=e_(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(pte).filter(r=>pte[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===Pd.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=qre(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)}},kw={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list"},xf=typeof self<"u"&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},qo={Never:"never",Less:"less",Equal:"equal",LessEqual:"less-equal",Greater:"greater",NotEqual:"not-equal",GreaterEqual:"greater-equal",Always:"always"},$a={Store:"store"},Fi={Load:"load",Clear:"clear"},mte={CCW:"ccw",CW:"cw"},Ate={None:"none",Back:"back"},G4={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"},UO={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},Wc={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"},Eg={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},gte={None:0,All:15},K0={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},kO={Storage:"storage",ReadOnlyStorage:"read-only-storage"},zO={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},vte={NonFiltering:"non-filtering",Comparison:"comparison"},Mg={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},_te={TwoD:"2d",ThreeD:"3d"},Ho={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},zIe={All:"all"},bR={Vertex:"vertex",Instance:"instance"},q4={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"},xte={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"},n9=class extends O4{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 D4{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}},VIe=0,r9=class extends i9{constructor(e,t){super("StorageBuffer_"+VIe++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:jo.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}},VO=[null],s9=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 kw.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return kw.LineList;if(e.isLine)return kw.LineStrip;if(e.isMesh)return kw.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 pf(i,e){VO[0]=e,i.queue.submit(VO),VO[0]=null}var H4=class{constructor(){this.label="",this.layout=null,this.entries=[]}reset(){this.label="",this.layout=null,this.entries.length=0}},mm=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}},Zg=class{constructor(){this.label=""}reset(){this.label=""}},W4=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}},Vg=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}},j4=class{constructor(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample=new o9,this.fragment=null}reset(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample.reset(),this.fragment=null}},o9=class{constructor(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}reset(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}},X4=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}},mS=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"}},Q0=new H4,J0=new mm,wR=new Zg,GO=new W4,qO=new Vg,B_=new j4,Lw=new zg,SR=new X4,O_=new pS,gs=new mS,a9=class extends Sf{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:Wc.Linear}),this.flipYSampler=e.createSampler({minFilter:Wc.Nearest}),J0.size=4,J0.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,this.flipUniformBuffer=e.createBuffer(J0),J0.reset(),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),J0.size=4,J0.usage=GPUBufferUsage.UNIFORM,this.noFlipUniformBuffer=e.createBuffer(J0),J0.reset(),this.transferPipelines={},SR.label="mipmap",SR.code=t,this.mipmapShaderModule=e.createShaderModule(SR),SR.reset()}getTransferPipeline(e,t){t=t||"2d-array";let n=`${e}-${t}`,r=this.transferPipelines[n];return r===void 0&&(B_.label=`mipmap-${e}-${t}`,B_.vertex={module:this.mipmapShaderModule},B_.fragment={module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},B_.layout="auto",r=this.device.createRenderPipeline(B_),B_.reset(),this.transferPipelines[n]=r),r}flipY(e,t,n=0){let r=t.format,{width:s,height:o}=t.size;O_.size.width=s,O_.size.height=o,O_.format=r,O_.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING;let a=this.device.createTexture(O_);O_.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);gs.dimension=A.textureBindingViewDimension||"2d-array",gs.mipLevelCount=1;let P=A.createView(gs);gs.reset(),Q0.layout=R,Q0.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(Q0);Q0.reset(),gs.dimension="2d",gs.mipLevelCount=1,gs.baseArrayLayer=S,gs.arrayLayerCount=1;let F=w.createView(gs);gs.reset(),Pw.view=F,Pw.loadOp=Fi.Clear,Pw.storeOp=$a.Store,qO.colorAttachments.push(Pw);let D=u.beginRenderPass(qO);qO.reset(),Pw.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),pf(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&&pf(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++){gs.dimension=t,gs.baseMipLevel=o-1,gs.mipLevelCount=1;let l=e.createView(gs);gs.reset(),Q0.layout=r,Q0.entries.push({binding:0,resource:this.mipmapSampler},{binding:1,resource:l},{binding:2,resource:{buffer:this.noFlipUniformBuffer}});let c=this.device.createBindGroup(Q0);Q0.reset(),gs.dimension="2d",gs.baseMipLevel=o,gs.mipLevelCount=1,gs.baseArrayLayer=a,gs.arrayLayerCount=1;let u=e.createView(gs);gs.reset();let f=new zg;f.view=u,f.loadOp=Fi.Clear,f.storeOp=$a.Store;let d=new Vg;d.colorAttachments.push(f),GO.colorFormats=[e.format];let A=this.device.createRenderBundleEncoder(GO);GO.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()}}},l9=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}},ax=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"}},c9=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}},h9=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}},f9=class extends ax{constructor(){super(),this.colorSpace="srgb",this.premultipliedAlpha=!1}reset(){super.reset(),this.colorSpace="srgb",this.premultipliedAlpha=!1}},$4=class{constructor(){this.width=0,this.height=1,this.depthOrArrayLayers=1}reset(){this.width=0,this.height=1,this.depthOrArrayLayers=1}},TR=new mm,VIe=new Zg,da=new l9,ga=new ax,ER=new c9,qd=new u9,MR=new h9,U_=new f9,em=new dS,ma=new $4,GIe={[Ab]:"never",[Jv]:"less",[gb]:"equal",[jh]:"less-equal",[eg]:"greater",[Pu]:"greater-equal",[_b]:"always",[vb]:"not-equal"},qIe=[0,1,3,2,4,5];function xte(i,e,t,n,r,s,o,a,l,c){ga.texture=e,ga.mipLevel=t,ga.origin.z=n,qd.offset=n*s,qd.bytesPerRow=o,qd.rowsPerImage=a,ma.width=l,ma.height=c,i.queue.writeTexture(ga,r.data,qd,ma),ga.reset(),qd.reset(),ma.reset()}var d9=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){da.addressModeU=this._convertAddressMode(n.wrapS),da.addressModeV=this._convertAddressMode(n.wrapT),da.addressModeW=this._convertAddressMode(n.wrapR),da.magFilter=this._convertFilterMode(n.magFilter),da.minFilter=this._convertFilterMode(n.minFilter),da.mipmapFilter=this._convertMipmapFilterMode(n.minFilter),n.isDepthTexture&&(n.compareFunction===null||r.compareNode===null)&&(da.magFilter=Wc.Nearest,da.minFilter=Wc.Nearest,da.mipmapFilter=Wc.Nearest),da.magFilter===Wc.Linear&&da.minFilter===Wc.Linear&&da.mipmapFilter===Wc.Linear&&(da.maxAnisotropy=n.anisotropy),n.isDepthTexture&&n.compareFunction!==null&&r.compareNode!==null&&t.hasCompatibility(Pd.TEXTURE_COMPARE)&&(da.compare=GIe[n.compareFunction]);let l=t.device.createSampler(da);da.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=p9(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||p9(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=qo.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(),em.label="colorBuffer",em.size.width=n,em.size.height=r,em.sampleCount=e.utils.getSampleCount(e.renderer.currentSamples),em.format=e.utils.getPreferredCanvasFormat(),em.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,l=e.device.createTexture(em),em.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=_o,f=n.renderer.reversedDepthBuffer===!0?cr:la):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,TR.size=(s-1)*d+r*f,TR.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let A=a.createBuffer(TR);TR.reset();let y=a.createCommandEncoder(VIe);ga.texture=c,ga.origin.x=t,ga.origin.y=n,ga.origin.z=o,ER.buffer=A,ER.bytesPerRow=d,ma.width=r,ma.height=s,y.copyTextureToBuffer(ga,ER,ma),ga.reset(),ER.reset(),ma.reset();let w=this._getTypedArrayType(u);pf(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 Rh;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?qIe[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;MR.source=e,MR.flipY=s,U_.texture=t,U_.mipLevel=a,U_.origin.z=r,U_.premultipliedAlpha=o,ma.width=c,ma.height=u;try{l.queue.copyExternalImageToTexture(MR,U_,ma)}catch{}finally{MR.reset(),U_.reset(),ma.reset()}}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new a9(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;ga.texture=t,ga.mipLevel=a,ga.origin.z=r,qd.offset=e.width*e.height*u*o,qd.bytesPerRow=f,ma.width=e.width,ma.height=e.height,l.queue.writeTexture(ga,c,qd,ma),ga.reset(),qd.reset(),ma.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)xte(s,t,c,P,u,S,y,w,T,R);else for(let P=0;P<A;P++)xte(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=UO.ClampToEdge;return e===yd?t=UO.Repeat:e===bd&&(t=UO.MirrorRepeat),t}_convertFilterMode(e){let t=Wc.Linear;return(e===Ti||e===db||e===Oc)&&(t=Wc.Nearest),t}_convertMipmapFilterMode(e){return e===Oc||e===Uo?Wc.Linear:Wc.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=vte.ThreeD:t=vte.TwoD,t}};function p9(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(q4.TextureFormatsTier1),l===!1&&Xe("WebGPURenderer: Unable to use normalized textures without texture-formats-tier1 feature.")),i.isCompressedTexture===!0||i.isCompressedArrayTexture===!0)switch(t){case zh:case Vh:a=o===kt?fe.BC1RGBAUnormSRGB:fe.BC1RGBAUnorm;break;case Gh:a=o===kt?fe.BC2RGBAUnormSRGB:fe.BC2RGBAUnorm;break;case qh:a=o===kt?fe.BC3RGBAUnormSRGB:fe.BC3RGBAUnorm;break;case B0:a=fe.BC4RUnorm;break;case O0:a=fe.BC4RSnorm;break;case Wh:a=fe.BC5RGUnorm;break;case U0:a=fe.BC5RGSnorm;break;case D0:a=o===kt?fe.BC7RGBAUnormSRGB:fe.BC7RGBAUnorm;break;case N0:a=fe.BC6HRGBFloat;break;case F0:a=fe.BC6HRGBUFloat;break;case p0:case d0:a=o===kt?fe.ETC2RGB8UnormSRGB:fe.ETC2RGB8Unorm;break;case m0:a=o===kt?fe.ETC2RGBA8UnormSRGB:fe.ETC2RGBA8Unorm;break;case A0:a=fe.EACR11Unorm;break;case g0:a=fe.EACR11Snorm;break;case Hh:a=fe.EACRG11Unorm;break;case v0:a=fe.EACRG11Snorm;break;case _0:a=o===kt?fe.ASTC4x4UnormSRGB:fe.ASTC4x4Unorm;break;case x0:a=o===kt?fe.ASTC5x4UnormSRGB:fe.ASTC5x4Unorm;break;case y0:a=o===kt?fe.ASTC5x5UnormSRGB:fe.ASTC5x5Unorm;break;case b0:a=o===kt?fe.ASTC6x5UnormSRGB:fe.ASTC6x5Unorm;break;case w0:a=o===kt?fe.ASTC6x6UnormSRGB:fe.ASTC6x6Unorm;break;case S0:a=o===kt?fe.ASTC8x5UnormSRGB:fe.ASTC8x5Unorm;break;case T0:a=o===kt?fe.ASTC8x6UnormSRGB:fe.ASTC8x6Unorm;break;case E0:a=o===kt?fe.ASTC8x8UnormSRGB:fe.ASTC8x8Unorm;break;case M0:a=o===kt?fe.ASTC10x5UnormSRGB:fe.ASTC10x5Unorm;break;case C0:a=o===kt?fe.ASTC10x6UnormSRGB:fe.ASTC10x6Unorm;break;case R0:a=o===kt?fe.ASTC10x8UnormSRGB:fe.ASTC10x8Unorm;break;case I0:a=o===kt?fe.ASTC10x10UnormSRGB:fe.ASTC10x10Unorm;break;case P0:a=o===kt?fe.ASTC12x10UnormSRGB:fe.ASTC12x10Unorm;break;case L0:a=o===kt?fe.ASTC12x12UnormSRGB:fe.ASTC12x12Unorm;break;case Br:a=o===kt?fe.RGBA8UnormSRGB:fe.RGBA8Unorm;break;default:ze("WebGPURenderer: Unsupported texture format.",t)}else switch(t){case Br:switch(n){case Bh:a=fe.RGBA8Snorm;break;case Oh:a=l?fe.RGBA16Snorm:fe.RGBA16Sint;break;case xl:a=l?fe.RGBA16Unorm:fe.RGBA16Uint;break;case xi:a=fe.RGBA32Uint;break;case Yr: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 Rd:switch(n){case $A:a=fe.RGB9E5UFloat;break;case YA:a=fe.RG11B10UFloat;break;default:ze("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case Id:switch(n){case Bh:a=fe.R8Snorm;break;case Oh:a=l?fe.R16Snorm:fe.R16Sint;break;case xl:a=l?fe.R16Unorm:fe.R16Uint;break;case xi:a=fe.R32Uint;break;case Yr: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 Bh:a=fe.RG8Snorm;break;case Oh:a=l?fe.RG16Snorm:fe.RG16Sint;break;case xl:a=l?fe.RG16Unorm:fe.RG16Uint;break;case xi:a=fe.RG32Uint;break;case Yr: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 xl: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 _o:switch(n){case la:a=fe.Depth24PlusStencil8;break;case cr:e&&e.features.has(q4.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 Uh:switch(n){case Yr:a=fe.R32Sint;break;case xi:a=fe.R32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case kh:switch(n){case Yr:a=fe.RG32Sint;break;case xi:a=fe.RG32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n)}break;case f0:switch(n){case Yr: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 HIe=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,WIe=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,yte={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"},jIe=i=>{i=i.trim();let e=i.match(HIe);if(e!==null&&e.length===4){let t=e[2],n=[],r=null;for(;(r=WIe.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=yte[A]),s.push(new cS(A,f))}let o=i.substring(e[0].length),a=e[3]||"void",l=e[1]!==void 0?e[1]:"";return{type:yte[a]||a,inputs:s,name:l,inputsCode:t,blockCode:o,outputType:a}}else throw new Error("THREE.WGSLNodeFunction: Function is not a WGSL code.")},m9=class extends hS{constructor(e){let{type:t,inputs:n,name:r,inputsCode:s,blockCode:o,outputType:a}=jIe(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}},A9=class extends R4{parseFunction(e){return new m9(e)}},XIe={[Wo.READ_ONLY]:"read",[Wo.WRITE_ONLY]:"write",[Wo.READ_WRITE]:"read_write"},bte={[yd]:"repeat",[oa]:"clamp",[bd]:"mirror"},HO={vertex:xf.VERTEX,fragment:xf.FRAGMENT,compute:xf.COMPUTE},wte={instance:!0,swizzleAssign:!1,storageBuffer:!0},$Ie={"^^":"tsl_xor"},YIe={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>"},Ste={},Lw={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:Wc.Linear}),this.flipYSampler=e.createSampler({minFilter:Wc.Nearest}),J0.size=4,J0.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,this.flipUniformBuffer=e.createBuffer(J0),J0.reset(),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),J0.size=4,J0.usage=GPUBufferUsage.UNIFORM,this.noFlipUniformBuffer=e.createBuffer(J0),J0.reset(),this.transferPipelines={},SR.label="mipmap",SR.code=t,this.mipmapShaderModule=e.createShaderModule(SR),SR.reset()}getTransferPipeline(e,t){t=t||"2d-array";let n=`${e}-${t}`,r=this.transferPipelines[n];return r===void 0&&(B_.label=`mipmap-${e}-${t}`,B_.vertex={module:this.mipmapShaderModule},B_.fragment={module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},B_.layout="auto",r=this.device.createRenderPipeline(B_),B_.reset(),this.transferPipelines[n]=r),r}flipY(e,t,n=0){let r=t.format,{width:s,height:o}=t.size;O_.size.width=s,O_.size.height=o,O_.format=r,O_.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING;let a=this.device.createTexture(O_);O_.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);gs.dimension=A.textureBindingViewDimension||"2d-array",gs.mipLevelCount=1;let P=A.createView(gs);gs.reset(),Q0.layout=R,Q0.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(Q0);Q0.reset(),gs.dimension="2d",gs.mipLevelCount=1,gs.baseArrayLayer=S,gs.arrayLayerCount=1;let F=w.createView(gs);gs.reset(),Lw.view=F,Lw.loadOp=Fi.Clear,Lw.storeOp=$a.Store,qO.colorAttachments.push(Lw);let D=u.beginRenderPass(qO);qO.reset(),Lw.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),pf(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&&pf(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++){gs.dimension=t,gs.baseMipLevel=o-1,gs.mipLevelCount=1;let l=e.createView(gs);gs.reset(),Q0.layout=r,Q0.entries.push({binding:0,resource:this.mipmapSampler},{binding:1,resource:l},{binding:2,resource:{buffer:this.noFlipUniformBuffer}});let c=this.device.createBindGroup(Q0);Q0.reset(),gs.dimension="2d",gs.baseMipLevel=o,gs.mipLevelCount=1,gs.baseArrayLayer=a,gs.arrayLayerCount=1;let u=e.createView(gs);gs.reset();let f=new zg;f.view=u,f.loadOp=Fi.Clear,f.storeOp=$a.Store;let d=new Vg;d.colorAttachments.push(f),GO.colorFormats=[e.format];let A=this.device.createRenderBundleEncoder(GO);GO.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()}}},l9=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}},ax=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"}},c9=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}},h9=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}},f9=class extends ax{constructor(){super(),this.colorSpace="srgb",this.premultipliedAlpha=!1}reset(){super.reset(),this.colorSpace="srgb",this.premultipliedAlpha=!1}},$4=class{constructor(){this.width=0,this.height=1,this.depthOrArrayLayers=1}reset(){this.width=0,this.height=1,this.depthOrArrayLayers=1}},TR=new mm,GIe=new Zg,da=new l9,ga=new ax,ER=new c9,qd=new u9,MR=new h9,U_=new f9,em=new pS,ma=new $4,qIe={[gb]:"never",[Jv]:"less",[vb]:"equal",[jh]:"less-equal",[eg]:"greater",[Lu]:"greater-equal",[xb]:"always",[_b]:"not-equal"},HIe=[0,1,3,2,4,5];function yte(i,e,t,n,r,s,o,a,l,c){ga.texture=e,ga.mipLevel=t,ga.origin.z=n,qd.offset=n*s,qd.bytesPerRow=o,qd.rowsPerImage=a,ma.width=l,ma.height=c,i.queue.writeTexture(ga,r.data,qd,ma),ga.reset(),qd.reset(),ma.reset()}var d9=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){da.addressModeU=this._convertAddressMode(n.wrapS),da.addressModeV=this._convertAddressMode(n.wrapT),da.addressModeW=this._convertAddressMode(n.wrapR),da.magFilter=this._convertFilterMode(n.magFilter),da.minFilter=this._convertFilterMode(n.minFilter),da.mipmapFilter=this._convertMipmapFilterMode(n.minFilter),n.isDepthTexture&&(n.compareFunction===null||r.compareNode===null)&&(da.magFilter=Wc.Nearest,da.minFilter=Wc.Nearest,da.mipmapFilter=Wc.Nearest),da.magFilter===Wc.Linear&&da.minFilter===Wc.Linear&&da.mipmapFilter===Wc.Linear&&(da.maxAnisotropy=n.anisotropy),n.isDepthTexture&&n.compareFunction!==null&&r.compareNode!==null&&t.hasCompatibility(Pd.TEXTURE_COMPARE)&&(da.compare=qIe[n.compareFunction]);let l=t.device.createSampler(da);da.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=p9(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||p9(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=Ho.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(),em.label="colorBuffer",em.size.width=n,em.size.height=r,em.sampleCount=e.utils.getSampleCount(e.renderer.currentSamples),em.format=e.utils.getPreferredCanvasFormat(),em.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,l=e.device.createTexture(em),em.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=_o,f=n.renderer.reversedDepthBuffer===!0?cr:la):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,TR.size=(s-1)*d+r*f,TR.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let A=a.createBuffer(TR);TR.reset();let y=a.createCommandEncoder(GIe);ga.texture=c,ga.origin.x=t,ga.origin.y=n,ga.origin.z=o,ER.buffer=A,ER.bytesPerRow=d,ma.width=r,ma.height=s,y.copyTextureToBuffer(ga,ER,ma),ga.reset(),ER.reset(),ma.reset();let w=this._getTypedArrayType(u);pf(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 Rh;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?HIe[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;MR.source=e,MR.flipY=s,U_.texture=t,U_.mipLevel=a,U_.origin.z=r,U_.premultipliedAlpha=o,ma.width=c,ma.height=u;try{l.queue.copyExternalImageToTexture(MR,U_,ma)}catch{}finally{MR.reset(),U_.reset(),ma.reset()}}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new a9(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;ga.texture=t,ga.mipLevel=a,ga.origin.z=r,qd.offset=e.width*e.height*u*o,qd.bytesPerRow=f,ma.width=e.width,ma.height=e.height,l.queue.writeTexture(ga,c,qd,ma),ga.reset(),qd.reset(),ma.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)yte(s,t,c,P,u,S,y,w,T,R);else for(let P=0;P<A;P++)yte(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=UO.ClampToEdge;return e===yd?t=UO.Repeat:e===bd&&(t=UO.MirrorRepeat),t}_convertFilterMode(e){let t=Wc.Linear;return(e===Ti||e===pb||e===Oc)&&(t=Wc.Nearest),t}_convertMipmapFilterMode(e){return e===Oc||e===ko?Wc.Linear:Wc.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=_te.ThreeD:t=_te.TwoD,t}};function p9(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(q4.TextureFormatsTier1),l===!1&&Xe("WebGPURenderer: Unable to use normalized textures without texture-formats-tier1 feature.")),i.isCompressedTexture===!0||i.isCompressedArrayTexture===!0)switch(t){case zh:case Vh:a=o===kt?fe.BC1RGBAUnormSRGB:fe.BC1RGBAUnorm;break;case Gh:a=o===kt?fe.BC2RGBAUnormSRGB:fe.BC2RGBAUnorm;break;case qh:a=o===kt?fe.BC3RGBAUnormSRGB:fe.BC3RGBAUnorm;break;case B0:a=fe.BC4RUnorm;break;case O0:a=fe.BC4RSnorm;break;case Wh:a=fe.BC5RGUnorm;break;case U0:a=fe.BC5RGSnorm;break;case D0:a=o===kt?fe.BC7RGBAUnormSRGB:fe.BC7RGBAUnorm;break;case N0:a=fe.BC6HRGBFloat;break;case F0:a=fe.BC6HRGBUFloat;break;case p0:case d0:a=o===kt?fe.ETC2RGB8UnormSRGB:fe.ETC2RGB8Unorm;break;case m0:a=o===kt?fe.ETC2RGBA8UnormSRGB:fe.ETC2RGBA8Unorm;break;case A0:a=fe.EACR11Unorm;break;case g0:a=fe.EACR11Snorm;break;case Hh:a=fe.EACRG11Unorm;break;case v0:a=fe.EACRG11Snorm;break;case _0:a=o===kt?fe.ASTC4x4UnormSRGB:fe.ASTC4x4Unorm;break;case x0:a=o===kt?fe.ASTC5x4UnormSRGB:fe.ASTC5x4Unorm;break;case y0:a=o===kt?fe.ASTC5x5UnormSRGB:fe.ASTC5x5Unorm;break;case b0:a=o===kt?fe.ASTC6x5UnormSRGB:fe.ASTC6x5Unorm;break;case w0:a=o===kt?fe.ASTC6x6UnormSRGB:fe.ASTC6x6Unorm;break;case S0:a=o===kt?fe.ASTC8x5UnormSRGB:fe.ASTC8x5Unorm;break;case T0:a=o===kt?fe.ASTC8x6UnormSRGB:fe.ASTC8x6Unorm;break;case E0:a=o===kt?fe.ASTC8x8UnormSRGB:fe.ASTC8x8Unorm;break;case M0:a=o===kt?fe.ASTC10x5UnormSRGB:fe.ASTC10x5Unorm;break;case C0:a=o===kt?fe.ASTC10x6UnormSRGB:fe.ASTC10x6Unorm;break;case R0:a=o===kt?fe.ASTC10x8UnormSRGB:fe.ASTC10x8Unorm;break;case I0:a=o===kt?fe.ASTC10x10UnormSRGB:fe.ASTC10x10Unorm;break;case P0:a=o===kt?fe.ASTC12x10UnormSRGB:fe.ASTC12x10Unorm;break;case L0:a=o===kt?fe.ASTC12x12UnormSRGB:fe.ASTC12x12Unorm;break;case Br:a=o===kt?fe.RGBA8UnormSRGB:fe.RGBA8Unorm;break;default:ze("WebGPURenderer: Unsupported texture format.",t)}else switch(t){case Br:switch(n){case Bh:a=fe.RGBA8Snorm;break;case Oh:a=l?fe.RGBA16Snorm:fe.RGBA16Sint;break;case xl:a=l?fe.RGBA16Unorm:fe.RGBA16Uint;break;case xi:a=fe.RGBA32Uint;break;case Yr: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 Rd:switch(n){case $A:a=fe.RGB9E5UFloat;break;case YA:a=fe.RG11B10UFloat;break;default:ze("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case Id:switch(n){case Bh:a=fe.R8Snorm;break;case Oh:a=l?fe.R16Snorm:fe.R16Sint;break;case xl:a=l?fe.R16Unorm:fe.R16Uint;break;case xi:a=fe.R32Uint;break;case Yr: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 Bh:a=fe.RG8Snorm;break;case Oh:a=l?fe.RG16Snorm:fe.RG16Sint;break;case xl:a=l?fe.RG16Unorm:fe.RG16Uint;break;case xi:a=fe.RG32Uint;break;case Yr: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 xl: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 _o:switch(n){case la:a=fe.Depth24PlusStencil8;break;case cr:e&&e.features.has(q4.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 Uh:switch(n){case Yr:a=fe.R32Sint;break;case xi:a=fe.R32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case kh:switch(n){case Yr:a=fe.RG32Sint;break;case xi:a=fe.RG32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n)}break;case f0:switch(n){case Yr: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 WIe=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,jIe=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,bte={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"},XIe=i=>{i=i.trim();let e=i.match(WIe);if(e!==null&&e.length===4){let t=e[2],n=[],r=null;for(;(r=jIe.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=bte[A]),s.push(new uS(A,f))}let o=i.substring(e[0].length),a=e[3]||"void",l=e[1]!==void 0?e[1]:"";return{type:bte[a]||a,inputs:s,name:l,inputsCode:t,blockCode:o,outputType:a}}else throw new Error("THREE.WGSLNodeFunction: Function is not a WGSL code.")},m9=class extends fS{constructor(e){let{type:t,inputs:n,name:r,inputsCode:s,blockCode:o,outputType:a}=XIe(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}},A9=class extends R4{parseFunction(e){return new m9(e)}},$Ie={[jo.READ_ONLY]:"read",[jo.WRITE_ONLY]:"write",[jo.READ_WRITE]:"read_write"},wte={[yd]:"repeat",[oa]:"clamp",[bd]:"mirror"},HO={vertex:xf.VERTEX,fragment:xf.FRAGMENT,compute:xf.COMPUTE},Ste={instance:!0,swizzleAssign:!1,storageBuffer:!0},YIe={"^^":"tsl_xor"},ZIe={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>"},Tte={},Dw={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-`)},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"},Bse="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(Bse+=`diagnostic( off, derivative_uniformity );4563-`);var g9=class extends M4{constructor(e,t){super(e,t,new A9),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_${bte[e.wrapS]}S_${bte[e.wrapT]}T_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}`,n=Ste[t];if(n===void 0){let r=[],s=e.is3DTexture||e.isData3DTexture?"vec3f":"vec2f",o=`fn ${t}( coord : ${s} ) -> ${s} {4562+`)},KIe={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"},Ose="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(Ose+=`diagnostic( off, derivative_uniformity );4563+`);var g9=class extends M4{constructor(e,t){super(e,t,new A9),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_${wte[e.wrapS]}S_${wte[e.wrapT]}T_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}`,n=Tte[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===yd?(r.push(Lw.repeatWrapping_float),o+=` tsl_repeatWrapping_float( coord.${c} )`):l===oa?(r.push(Lw.clampWrapping_float),o+=` tsl_clampWrapping_float( coord.${c} )`):l===bd?(r.push(Lw.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===yd?(r.push(Dw.repeatWrapping_float),o+=` tsl_repeatWrapping_float( coord.${c} )`):l===oa?(r.push(Dw.clampWrapping_float),o+=` tsl_clampWrapping_float( coord.${c} )`):l===bd?(r.push(Dw.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-`,Ste[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 Y_(new K_(`textureDimensions( ${o} )`,a)),r.dimensionsSnippet[n]=s,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(r.arrayLayerCount=new Y_(new K_(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new Y_(new K_("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(Pd.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=$Ie[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."),Wo.READ_WRITE):Wo.READ_ONLY:e.access}getStorageAccess(e,t){return XIe[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 fS(s.name,s.node,l,d):f=new ox(s.name,s.node,l,d):t==="cubeTexture"||t==="cubeDepthTexture"?f=new U4(s.name,s.node,l,d):t==="texture3D"&&(f=new fS(s.name,s.node,l,d)),f.store=e.isStorageTextureNode===!0,f.mipLevel=f.store?e.mipLevel:0,f.setVisibility(HO[n]),e.value.isCubeTexture===!0||this.isUnfilterable(e.value)===!1&&f.store===!1||e.gatherNode!==null){let y=new n9(`${s.name}_sampler`,s.node,l);y.setVisibility(HO[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"?F4:r9;d=new A(e,l),f.buffer=d}d.setVisibility(d.getVisibility()|HO[n]),u.push(d),a=d,s.name=r||"NodeBuffer_"+s.id}else{let f=this.uniformGroups[c];f===void 0&&(f=new B4(c,l),f.setVisibility(xf.VERTEX|xf.FRAGMENT|xf.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+`,Tte[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 Y_(new K_(`textureDimensions( ${o} )`,a)),r.dimensionsSnippet[n]=s,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(r.arrayLayerCount=new Y_(new K_(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new Y_(new K_("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(Pd.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=YIe[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."),jo.READ_WRITE):jo.READ_ONLY:e.access}getStorageAccess(e,t){return $Ie[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 dS(s.name,s.node,l,d):f=new ox(s.name,s.node,l,d):t==="cubeTexture"||t==="cubeDepthTexture"?f=new U4(s.name,s.node,l,d):t==="texture3D"&&(f=new dS(s.name,s.node,l,d)),f.store=e.isStorageTextureNode===!0,f.mipLevel=f.store?e.mipLevel:0,f.setVisibility(HO[n]),e.value.isCubeTexture===!0||this.isUnfilterable(e.value)===!1&&f.store===!1||e.gatherNode!==null){let y=new n9(`${s.name}_sampler`,s.node,l);y.setVisibility(HO[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"?F4:r9;d=new A(e,l),f.buffer=d}d.setVisibility(d.getVisibility()|HO[n]),u.push(d),a=d,s.name=r||"NodeBuffer_"+s.id}else{let f=this.uniformGroups[c];f===void 0&&(f=new B4(c,l),f.setVisibility(xf.VERTEX|xf.FRAGMENT|xf.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};@@ -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 YIe[e]||e}isAvailable(e){let t=wte[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),wte[e]=t),t}_getWGSLMethod(e){return Lw[e]!==void 0&&this._include(e),ZIe[e]}_include(e){let t=Lw[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 ZIe[e]||e}isAvailable(e){let t=Ste[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),Ste[e]=t),t}_getWGSLMethod(e){return Dw[e]!==void 0&&this._include(e),KIe[e]}_include(e){let t=Dw[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-${Bse}4638+${Ose}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};`}},pa=new mm,WO=new Zg,Ose=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"&&Ose.set(Float16Array,["float16"]);var KIe=new Map([[zv,["float16"]]]),QIe=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]),v9=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;pa.label=n.name,pa.size=f,pa.usage=t,pa.mappedAtCreation=!0,o=a.createBuffer(pa),pa.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=e_(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?bR.Instance:bR.Vertex):(f=s.itemSize*o,d=s.isInstancedBufferAttribute?bR.Instance:bR.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){pa.label=`${t.name}_readback`,pa.size=t.maxByteLength,pa.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(pa),pa.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 pa.label=`${e.name}_readback`,pa.size=c,pa.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(pa),pa.reset();WO.label=`readback_encoder_${e.name}`;let f=o.createCommandEncoder(WO);WO.reset(),f.copyBufferToBuffer(l,n,u,0,c);let d=f.finish();if(pf(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=QIe.get(r);else{let l=(KIe.get(s)||Ose.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}},tc=new H4,Dw=new mm,k_=new pS,_9=class{constructor(e){this.layoutGPU=e,this.usedTimes=0}},x9=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=cx(JSON.stringify(s)),a=this._bindGroupLayoutCache.get(o);return a===void 0&&(a=new _9(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=e_(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];Dw.label="bindingCameraIndex_"+o,Dw.size=16,Dw.usage=s;let a=r.createBuffer(Dw);Dw.reset(),r.queue.writeBuffer(a,0,e,0),tc.label="bindGroupCameraIndex_"+o,tc.layout=t,tc.entries.push({binding:0,resource:{buffer:a}});let l=r.createBindGroup(tc);return tc.reset(),l}createBindGroup(e,t){let n=this.backend,r=n.device,s=0;tc.label="bindGroup_"+e.name,tc.layout=t;for(let a of e.bindings){if(a.isUniformBuffer){let l=n.get(a);tc.entries.push({binding:s,resource:{buffer:l.buffer}})}else if(a.isStorageBuffer){let l=n.get(a.attribute).buffer;tc.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=kIe.All,y;a.isSampledCubeTexture?y=qo.Cube:a.texture.isArrayTexture||a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?y=qo.TwoDArray:a.isSampledTexture3D?y=qo.ThreeD:y=qo.TwoD,k_.aspect=A,k_.dimension=y,k_.mipLevelCount=u,k_.baseMipLevel=f,c=l[d]=l.texture.createView(k_),k_.reset()}}tc.entries.push({binding:s,resource:c})}else if(a.isSampler){let l=n.get(a);tc.entries.push({binding:s,resource:l.sampler})}s++}let o=r.createBindGroup(tc);return tc.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&xf.COMPUTE&&(r.access===Wo.READ_WRITE||r.access===Wo.WRITE_ONLY)?a.type=kO.Storage:a.type=kO.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===Wo.READ_WRITE?a.access=zO.ReadWrite:l===Wo.WRITE_ONLY?a.access=zO.WriteOnly:a.access=zO.ReadOnly,r.texture.isArrayTexture?a.viewDimension=qo.TwoDArray:r.texture.is3DTexture&&(a.viewDimension=qo.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=Mg.UnfilterableFloat)),r.texture.isDepthTexture)s.compatibilityMode&&r.texture.compareFunction===null?a.sampleType=Mg.UnfilterableFloat:a.sampleType=Mg.Depth;else{let c=r.texture.type;c===Yr?a.sampleType=Mg.SInt:c===xi?a.sampleType=Mg.UInt:c===cr&&(this.backend.hasFeature("float32-filterable")?a.sampleType=Mg.Float:a.sampleType=Mg.UnfilterableFloat)}r.isSampledCubeTexture?a.viewDimension=qo.Cube:r.texture.isArrayTexture||r.texture.isDataArrayTexture||r.texture.isCompressedArrayTexture?a.viewDimension=qo.TwoDArray:r.isSampledTexture3D&&(a.viewDimension=qo.ThreeD),o.texture=a}else if(r.isSampler){let a={};r.texture.isDepthTexture&&(r.texture.compareFunction!==null&&r.textureNode.compareNode!==null&&s.hasCompatibility(Pd.TEXTURE_COMPARE)?a.type=gte.Comparison:a.type=gte.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}},b9=class{constructor(){this.label="",this.layout=null,this.compute=null}reset(){this.label="",this.layout=null,this.compute=null}},w9=class{constructor(){this.label="",this.bindGroupLayouts=null}reset(){this.label="",this.bindGroupLayouts=null}},Nw=new b9,z_=new w9,V_=new W4,nc=new j4,S9=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!==ds&&(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 ge=$.getBlendMode(te.name);ge.blending===Y2?he=w:ge.blending!==ds&&(he=this._getBlending(ge))}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);z_.bindGroupLayouts=A;let B=u.createPipelineLayout(z_);z_.reset(),nc.label=`renderPipeline_${r.name||r.type}_${r.id}`,nc.vertex=Object.assign({},P,{buffers:y}),nc.fragment=Object.assign({},I,{targets:R}),nc.primitive=F,nc.multisample.count=C,nc.multisample.alphaToCoverageEnabled=r.alphaToCoverage&&C>1,nc.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===Uw.TriangleList&&(k.depthBias=r.polygonOffsetUnits,k.depthBiasSlopeScale=r.polygonOffsetFactor,k.depthBiasClamp=0),nc.depthStencil=k),u.pushErrorScope("validation");let W=[{program:a,module:P.module},{program:l,module:I.module}],Y=nc.label;if(t===null)d.pipeline=u.createRenderPipeline(nc),nc.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(nc)}catch(he){J=he}if(nc.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);V_.label=t,V_.colorFormats=a,V_.depthStencilFormat=o,V_.sampleCount=l;let c=s.createRenderBundleEncoder(V_);return V_.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"),z_.bindGroupLayouts=a;let u=r.createPipelineLayout(z_);z_.reset(),Nw.label=c,Nw.compute=s,Nw.layout=u,o.pipeline=r.createComputePipeline(Nw),Nw.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};`}},pa=new mm,WO=new Zg,Use=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"&&Use.set(Float16Array,["float16"]);var QIe=new Map([[zv,["float16"]]]),JIe=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]),v9=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;pa.label=n.name,pa.size=f,pa.usage=t,pa.mappedAtCreation=!0,o=a.createBuffer(pa),pa.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=e_(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?bR.Instance:bR.Vertex):(f=s.itemSize*o,d=s.isInstancedBufferAttribute?bR.Instance:bR.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){pa.label=`${t.name}_readback`,pa.size=t.maxByteLength,pa.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(pa),pa.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 pa.label=`${e.name}_readback`,pa.size=c,pa.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(pa),pa.reset();WO.label=`readback_encoder_${e.name}`;let f=o.createCommandEncoder(WO);WO.reset(),f.copyBufferToBuffer(l,n,u,0,c);let d=f.finish();if(pf(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=JIe.get(r);else{let l=(QIe.get(s)||Use.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}},tc=new H4,Nw=new mm,k_=new mS,_9=class{constructor(e){this.layoutGPU=e,this.usedTimes=0}},x9=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=cx(JSON.stringify(s)),a=this._bindGroupLayoutCache.get(o);return a===void 0&&(a=new _9(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=e_(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];Nw.label="bindingCameraIndex_"+o,Nw.size=16,Nw.usage=s;let a=r.createBuffer(Nw);Nw.reset(),r.queue.writeBuffer(a,0,e,0),tc.label="bindGroupCameraIndex_"+o,tc.layout=t,tc.entries.push({binding:0,resource:{buffer:a}});let l=r.createBindGroup(tc);return tc.reset(),l}createBindGroup(e,t){let n=this.backend,r=n.device,s=0;tc.label="bindGroup_"+e.name,tc.layout=t;for(let a of e.bindings){if(a.isUniformBuffer){let l=n.get(a);tc.entries.push({binding:s,resource:{buffer:l.buffer}})}else if(a.isStorageBuffer){let l=n.get(a.attribute).buffer;tc.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=zIe.All,y;a.isSampledCubeTexture?y=Ho.Cube:a.texture.isArrayTexture||a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?y=Ho.TwoDArray:a.isSampledTexture3D?y=Ho.ThreeD:y=Ho.TwoD,k_.aspect=A,k_.dimension=y,k_.mipLevelCount=u,k_.baseMipLevel=f,c=l[d]=l.texture.createView(k_),k_.reset()}}tc.entries.push({binding:s,resource:c})}else if(a.isSampler){let l=n.get(a);tc.entries.push({binding:s,resource:l.sampler})}s++}let o=r.createBindGroup(tc);return tc.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&xf.COMPUTE&&(r.access===jo.READ_WRITE||r.access===jo.WRITE_ONLY)?a.type=kO.Storage:a.type=kO.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===jo.READ_WRITE?a.access=zO.ReadWrite:l===jo.WRITE_ONLY?a.access=zO.WriteOnly:a.access=zO.ReadOnly,r.texture.isArrayTexture?a.viewDimension=Ho.TwoDArray:r.texture.is3DTexture&&(a.viewDimension=Ho.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=Mg.UnfilterableFloat)),r.texture.isDepthTexture)s.compatibilityMode&&r.texture.compareFunction===null?a.sampleType=Mg.UnfilterableFloat:a.sampleType=Mg.Depth;else{let c=r.texture.type;c===Yr?a.sampleType=Mg.SInt:c===xi?a.sampleType=Mg.UInt:c===cr&&(this.backend.hasFeature("float32-filterable")?a.sampleType=Mg.Float:a.sampleType=Mg.UnfilterableFloat)}r.isSampledCubeTexture?a.viewDimension=Ho.Cube:r.texture.isArrayTexture||r.texture.isDataArrayTexture||r.texture.isCompressedArrayTexture?a.viewDimension=Ho.TwoDArray:r.isSampledTexture3D&&(a.viewDimension=Ho.ThreeD),o.texture=a}else if(r.isSampler){let a={};r.texture.isDepthTexture&&(r.texture.compareFunction!==null&&r.textureNode.compareNode!==null&&s.hasCompatibility(Pd.TEXTURE_COMPARE)?a.type=vte.Comparison:a.type=vte.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}},b9=class{constructor(){this.label="",this.layout=null,this.compute=null}reset(){this.label="",this.layout=null,this.compute=null}},w9=class{constructor(){this.label="",this.bindGroupLayouts=null}reset(){this.label="",this.bindGroupLayouts=null}},Fw=new b9,z_=new w9,V_=new W4,nc=new j4,S9=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!==ds&&(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 ge=$.getBlendMode(te.name);ge.blending===Z2?he=w:ge.blending!==ds&&(he=this._getBlending(ge))}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);z_.bindGroupLayouts=A;let B=u.createPipelineLayout(z_);z_.reset(),nc.label=`renderPipeline_${r.name||r.type}_${r.id}`,nc.vertex=Object.assign({},P,{buffers:y}),nc.fragment=Object.assign({},I,{targets:R}),nc.primitive=F,nc.multisample.count=C,nc.multisample.alphaToCoverageEnabled=r.alphaToCoverage&&C>1,nc.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===kw.TriangleList&&(k.depthBias=r.polygonOffsetUnits,k.depthBiasSlopeScale=r.polygonOffsetFactor,k.depthBiasClamp=0),nc.depthStencil=k),u.pushErrorScope("validation");let W=[{program:a,module:P.module},{program:l,module:I.module}],Y=nc.label;if(t===null)d.pipeline=u.createRenderPipeline(nc),nc.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(nc)}catch(he){J=he}if(nc.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);V_.label=t,V_.colorFormats=a,V_.depthStencilFormat=o,V_.sampleCount=l;let c=s.createRenderBundleEncoder(V_);return V_.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"),z_.bindGroupLayouts=a;let u=r.createPipelineLayout(z_);z_.reset(),Fw.label=c,Fw.compute=s,Fw.layout=u,o.pipeline=r.createComputePipeline(Fw),Fw.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===Cd){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:Eg.Add},n={srcFactor:d,dstFactor:A,operation:Eg.Add}};if(l)switch(r){case Ts:c(ui.One,ui.OneMinusSrcAlpha,ui.One,ui.OneMinusSrcAlpha);break;case Lh:c(ui.One,ui.One,ui.One,ui.One);break;case Dh:c(ui.Zero,ui.OneMinusSrc,ui.Zero,ui.One);break;case Nh: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 Lh:c(ui.SrcAlpha,ui.One,ui.One,ui.One);break;case Dh:ze(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case Nh: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 Iu:t=ui.Zero;break;case Q2:t=ui.One;break;case J2:t=ui.Src;break;case eb:t=ui.OneMinusSrc;break;case $p:t=ui.SrcAlpha;break;case Yp:t=ui.OneMinusSrcAlpha;break;case ib:t=ui.Dst;break;case rb:t=ui.OneMinusDst;break;case tb:t=ui.DstAlpha;break;case nb:t=ui.OneMinusDstAlpha;break;case sb:t=ui.SrcAlphaSaturated;break;case O3e:t=ui.Constant;break;case U3e:t=ui.OneMinusConstant;break;default:ze("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t,n=e.stencilFunc;switch(n){case L8:t=Go.Never;break;case A2:t=Go.Always;break;case D8:t=Go.Less;break;case F8:t=Go.LessEqual;break;case N8:t=Go.Equal;break;case U8:t=Go.GreaterEqual;break;case B8:t=Go.Greater;break;case O8:t=Go.NotEqual;break;default:ze("WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case gd:t=K0.Keep;break;case T8:t=K0.Zero;break;case E8:t=K0.Replace;break;case P8:t=K0.Invert;break;case M8:t=K0.IncrementClamp;break;case C8:t=K0.DecrementClamp;break;case R8:t=K0.IncrementWrap;break;case I8:t=K0.DecrementWrap;break;default:ze("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case so:t=Eg.Add;break;case Z2:t=Eg.Subtract;break;case K2:t=Eg.ReverseSubtract;break;case AM:t=Eg.Min;break;case gM:t=Eg.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?G4.Uint16:G4.Uint32);let o=n.side===mi;return e.isMesh&&e.matrixWorld.determinantAffine()<0&&(o=!o),r.frontFace=o===!0?pte.CW:pte.CCW,r.cullMode=n.side===gr?mte.None:mte.Back,r}_getColorWriteMask(e){return e.colorWrite===!0?Ate.All:Ate.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=Go.Always;else{let n=this.backend.parameters.reversedDepthBuffer?xb[e.depthFunc]:e.depthFunc;switch(n){case bA:t=Go.Never;break;case wA:t=Go.Always;break;case SA:t=Go.Less;break;case Mh:t=Go.LessEqual;break;case TA:t=Go.Equal;break;case EA:t=Go.GreaterEqual;break;case MA:t=Go.Greater;break;case CA:t=Go.NotEqual;break;default:ze("WebGPUPipelineUtils: Invalid depth function.",n)}}return t}},Y4=class{constructor(){this.label="",this.type=void 0,this.count=0}reset(){this.label="",this.type=void 0,this.count=0}},uf=new mm,JIe=new Zg,Fw=new Y4,T9=class extends z4{constructor(e,t,n=2048){super(n),this.device=e,this.type=t,Fw.label=`queryset_global_timestamp_${t}`,Fw.type="timestamp",Fw.count=this.maxQueries,this.querySet=this.device.createQuerySet(Fw),Fw.reset();let r=this.maxQueries*8;uf.label=`buffer_timestamp_resolve_${t}`,uf.size=r,uf.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,this.resolveBuffer=this.device.createBuffer(uf),uf.reset(),uf.label=`buffer_timestamp_result_${t}`,uf.size=r,uf.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,this.resultBuffer=this.device.createBuffer(uf),uf.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(JIe);r.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),r.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);let s=r.finish();if(pf(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}}},E9=class{constructor(){this.label="",this.timestampWrites=void 0}reset(){this.label="",this.timestampWrites=void 0}},j_=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}},M9=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}},ku={r:0,g:0,b:0,a:1},ic=new mm,Xa=new Zg,CR=new E9,Bw=new Y4,RR=new X4,IR=new M9,Hc=new ax,hf=new ax,Tr=new pS,zd=new $4,C9=class extends k4{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 s9(this),this.attributeUtils=new v9(this),this.bindingUtils=new x9(this),this.capabilities=new y9(this),this.pipelineUtils=new S9(this),this.textureUtils=new d9(this),this.occludedResolveCache=new Map;let t=typeof navigator>"u"?!0:/Android/.test(navigator.userAgent)===!1;this._compatibility={[Pd.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(q4),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(q4.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 gl}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 Vg,s.colorAttachments.push(new zg),e.depth===!0||e.stencil===!0){let l=new j_;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:qo.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(Tr.label=`colorAttachment_${w}`,Tr.baseMipLevel=e.activeMipmapLevel,Tr.mipLevelCount=1,Tr.baseArrayLayer=e.activeCubeFace,Tr.arrayLayerCount=1,Tr.dimension=qo.TwoD,n.isRenderTarget3D)d=e.activeCubeFace,Tr.baseArrayLayer=0,Tr.dimension=qo.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++){Tr.baseArrayLayer=R,Tr.arrayLayerCount=1,Tr.dimension=qo.TwoD;let P=S.texture.createView(Tr);f.push({view:P,resolveTarget:void 0,depthSlice:void 0})}}else Tr.dimension=qo.TwoDArray;if(A!==!0){let T=S.texture.createView(Tr),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})}Tr.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 Vg},e.depth){let w=this.get(e.depthTexture);(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(Tr.dimension=qo.TwoD,Tr.arrayLayerCount=1,Tr.baseArrayLayer=e.activeCubeFace);let S=new j_;S.view=w.texture.createView(Tr),l.depthStencilAttachment=S,Tr.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||$a.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,Bw.label=`occlusionQuerySet_${e.id}`,Bw.type="occlusion",Bw.count=r,s=n.createQuerySet(Bw),Bw.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(Uc.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:(ku.r=0,ku.g=0,ku.b=0,ku.a=1,f.clearValue=ku),f.loadOp=Fi.Clear):f.loadOp=Fi.Load,f.storeOp=$a.Store}}else{let c=o.colorAttachments[0];e.clearColor?(c.clearValue=e.clearColorValue,c.loadOp=Fi.Clear):c.loadOp=Fi.Load,c.storeOp=$a.Store}e.depth&&(e.clearDepth?(a.depthClearValue=e.clearDepthValue,a.depthLoadOp=Fi.Clear):a.depthLoadOp=Fi.Load,a.depthStoreOp=$a.Store),e.stencil&&(e.clearStencil?(a.stencilClearValue=e.clearStencilValue,a.stencilLoadOp=Fi.Clear):a.stencilLoadOp=Fi.Load,a.stencilStoreOp=$a.Store),Xa.label="renderContext_"+e.id;let l=n.createCommandEncoder(Xa);if(Xa.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 Vg;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]||(Tr.dimension=qo.TwoD,Tr.baseArrayLayer=a,Tr.arrayLayerCount=1,o.viewCache[f]=o.texture.createView(Tr),Tr.reset());let d=new j_;d.view=o.viewCache[f],d.depthLoadOp=s.depthLoadOp||Fi.Clear,d.depthStoreOp=s.depthStoreOp||$a.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 j_;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&&(ic.size=s,ic.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,o=this.device.createBuffer(ic),ic.reset(),this.occludedResolveCache.set(s,o)),ic.size=s,ic.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let a=this.device.createBuffer(ic);ic.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(pf(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();ku.r=A.r,ku.g=A.g,ku.b=A.b,ku.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=ku,y.loadOp=Fi.Clear,y.storeOp=$a.Store}(c||u)&&(l=A.depthStencilAttachment)}else{c=r.depth,u=r.stencil;let A={loadOp:e?Fi.Clear:Fi.Load,clearValue:e?ku:void 0};c&&(A.depthLoadOp=t?Fi.Clear:Fi.Load,A.depthClearValue=t?o.getClearDepth():void 0,A.depthStoreOp=$a.Store),u&&(A.stencilLoadOp=n?Fi.Clear:Fi.Load,A.stencilClearValue=n?o.getClearStencil():void 0,A.stencilStoreOp=$a.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=$a.Store):(l.depthLoadOp=Fi.Load,l.depthStoreOp=$a.Store)),u&&l&&(n?(l.stencilLoadOp=Fi.Clear,l.stencilClearValue=o.getClearStencil(),l.stencilStoreOp=$a.Store):(l.stencilLoadOp=Fi.Load,l.stencilStoreOp=$a.Store)),Xa.label="clear";let f=s.createCommandEncoder(Xa);Xa.reset(),f.beginRenderPass({colorAttachments:a,depthStencilAttachment:l}).end(),pf(s,f.finish())}beginCompute(e){let t=this.get(e),n="computeGroup_"+e.id;CR.label=n,Xa.label=n,this.initTimestampQuery(Uc.COMPUTE,this.getTimestampUID(e),CR),t.cmdEncoderGPU=this.device.createCommandEncoder(Xa),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(CR),t.currentPipeline=null,Xa.reset(),CR.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(),pf(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?G4.Uint16:G4.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 T9(this.device,e,2048));let r=this.timestampQueryPool[e],s=r.allocateQueriesForContext(t);IR.querySet=r.querySet,IR.beginningOfPassWriteIndex=s,IR.endOfPassWriteIndex=s+1,n.timestampWrites=IR}createNodeBuilder(e,t){return new g9(e,t)}createProgram(e){let t=this.get(e);RR.label=e.stage+(e.name!==""?`_${e.name}`:""),RR.code=e.code,t.module={module:this.device.createShaderModule(RR),entryPoint:"main"},RR.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&xf.VERTEX&&s.push("vertex"),e.visibility&xf.FRAGMENT&&s.push("fragment"),e.visibility&xf.COMPUTE&&s.push("compute");let o=`(${s.join(",")})`;ic.label=`bindingBuffer${e.id}_${e.name}_${o}`,ic.size=n,ic.usage=r;let a=this.device.createBuffer(ic);ic.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 _te[e]!==void 0&&(e=_te[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),Xa.label="copyTextureToTexture_"+e.id+"_"+t.id;let S=this.device.createCommandEncoder(Xa);Xa.reset();let T=this.get(e).texture,R=this.get(t).texture;Hc.texture=T,Hc.mipLevel=s,Hc.origin.x=u,Hc.origin.y=f,Hc.origin.z=d,hf.texture=R,hf.mipLevel=o,hf.origin.x=a,hf.origin.y=l,hf.origin.z=c,zd.width=A,zd.height=y,zd.depthOrArrayLayers=w,S.copyTextureToTexture(Hc,hf,zd),Hc.reset(),hf.reset(),zd.reset(),pf(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):(Xa.label="copyFramebufferToTexture_"+e.id,a=this.device.createCommandEncoder(Xa),Xa.reset()),Hc.texture=s,Hc.origin.x=n.x,Hc.origin.y=n.y,hf.texture=o,zd.width=n.z,zd.height=n.w,a.copyTextureToTexture(Hc,hf,zd),Hc.reset(),hf.reset(),zd.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 pf(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()}},R9=class extends VA{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}},I9=class extends VA{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}},P9=class extends P4{constructor(){super(),this.addMaterial(e7,"MeshPhongMaterial"),this.addMaterial(c4,"MeshStandardMaterial"),this.addMaterial(l7,"MeshPhysicalMaterial"),this.addMaterial(u7,"MeshToonMaterial"),this.addMaterial(QU,"MeshBasicMaterial"),this.addMaterial(JU,"MeshLambertMaterial"),this.addMaterial($U,"MeshNormalMaterial"),this.addMaterial(h7,"MeshMatcapMaterial"),this.addMaterial(WU,"LineBasicMaterial"),this.addMaterial(jU,"LineDashedMaterial"),this.addMaterial(d7,"PointsMaterial"),this.addMaterial(u4,"SpriteMaterial"),this.addMaterial(m7,"ShadowMaterial"),this.addLight(sk,V2),this.addLight(Rk,GA),this.addLight(Nk,G2),this.addLight(uS,VA),this.addLight(Ck,qA),this.addLight(Ik,k2),this.addLight(Lk,q2),this.addLight(Pk,R9),this.addLight(Dk,I9),this.addToneMapping(nse,ob),this.addToneMapping(ise,ab),this.addToneMapping(rse,lb),this.addToneMapping(sse,cb),this.addToneMapping(ose,ub),this.addToneMapping(ase,hb)}},lx=class extends qk{constructor(e={}){let t;e.forceWebGL?t=V4:(t=C9,e.getFallback=()=>(Xe("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new V4(e)));let n=new t(e);super(n,e),this.library=new P9,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}};var tat=V.BRDF_GGX,nat=V.BRDF_Lambert,iat=V.BasicPointShadowFilter,rat=V.BasicShadowFilter,sat=V.Break,oat=V.Const,aat=V.Continue,lat=V.DFGLUT,cat=V.D_GGX,uat=V.Discard,hat=V.EPSILON,fat=V.F_Schlick,Use=V.Fn,dat=V.INFINITY,kse=V.If,zse=V.Loop,pat=V.NodeAccess,mat=V.NodeShaderStage,Aat=V.NodeType,gat=V.NodeUpdateType,vat=V.PCFShadowFilter,_at=V.PCFSoftShadowFilter,xat=V.PI,yat=V.PI2,bat=V.TWO_PI,wat=V.HALF_PI,Sat=V.PointShadowFilter,Tat=V.Return,Eat=V.Schlick_to_F0,Mat=V.ShaderNode,Cat=V.Stack,Rat=V.Switch,Iat=V.TBNViewMatrix,Pat=V.VSMShadowFilter,Lat=V.V_GGX_SmithCorrelated,Dat=V.Var,Nat=V.VarIntent,Fat=V.abs,Bat=V.acesFilmicToneMapping,Oat=V.acos,Uat=V.acosh,kat=V.add,zat=V.addMethodChaining,Vat=V.addNodeElement,Gat=V.agxToneMapping,qat=V.all,Hat=V.alphaT,Wat=V.ambientOcclusion,jat=V.and,Xat=V.anisotropy,$at=V.anisotropyB,Yat=V.anisotropyT,Zat=V.any,Kat=V.append,Qat=V.array,Vse=V.asin,Jat=V.asinh,elt=V.assign,tlt=V.atan,nlt=V.atanh,ilt=V.atomicAdd,rlt=V.atomicAnd,slt=V.atomicFunc,olt=V.atomicLoad,alt=V.atomicMax,llt=V.atomicMin,clt=V.atomicOr,ult=V.atomicStore,hlt=V.atomicSub,flt=V.atomicXor,dlt=V.attenuationColor,plt=V.attenuationDistance,mlt=V.attribute,Alt=V.attributeArray,glt=V.backgroundBlurriness,vlt=V.backgroundIntensity,_lt=V.backgroundRotation,xlt=V.batch,ylt=V.bentNormalView,blt=V.billboarding,wlt=V.bitAnd,Slt=V.bitNot,Tlt=V.bitOr,Elt=V.bitXor,Mlt=V.bitangentGeometry,Clt=V.bitangentLocal,Rlt=V.bitangentView,Ilt=V.bitangentWorld,Plt=V.bitcast,Llt=V.blendBurn,Dlt=V.blendColor,Nlt=V.blendDodge,Flt=V.blendOverlay,Blt=V.blendScreen,Olt=V.blur,Ult=V.bool,klt=V.buffer,zlt=V.bufferAttribute,Vlt=V.bumpMap,Glt=V.builtin,qlt=V.builtinAOContext,Hlt=V.builtinShadowContext,Wlt=V.bvec2,jlt=V.bvec3,Xlt=V.bvec4,$lt=V.bypass,Ylt=V.cache,Zlt=V.call,Klt=V.cameraFar,Qlt=V.cameraIndex,Jlt=V.cameraNear,ect=V.cameraNormalMatrix,tct=V.cameraPosition,nct=V.cameraProjectionMatrix,ict=V.cameraProjectionMatrixInverse,rct=V.cameraViewMatrix,sct=V.cameraViewport,oct=V.cameraWorldMatrix,act=V.cbrt,lct=V.cdl,cct=V.ceil,uct=V.checker,hct=V.cineonToneMapping,fct=V.clamp,dct=V.clearcoat,pct=V.clearcoatNormalView,mct=V.clearcoatRoughness,Act=V.clipSpace,gct=V.code,vct=V.color,_ct=V.colorSpaceToWorking,xct=V.colorToDirection,yct=V.compute,bct=V.computeKernel,wct=V.computeSkinning,Sct=V.context,Tct=V.convert,Ect=V.convertColorSpace,Mct=V.convertToTexture,Cct=V.countLeadingZeros,Rct=V.countOneBits,Ict=V.countTrailingZeros,Gse=V.cos,Pct=V.cosh,Lct=V.cross,Dct=V.cubeTexture,Nct=V.cubeTextureBase,Fct=V.dFdx,Bct=V.dFdy,Oct=V.dashSize,Uct=V.debug,kct=V.decrement,zct=V.decrementBefore,Vct=V.defaultBuildStages,Gct=V.defaultShaderStages,qct=V.defined,Hct=V.degrees,Wct=V.deltaTime,jct=V.densityFog,Xct=V.densityFogFactor,$ct=V.depth,Yct=V.depthPass,Zct=V.determinant,Kct=V.difference,Qct=V.diffuseColor,Jct=V.directPointLight,eut=V.directionToColor,tut=V.directionToFaceDirection,nut=V.dispersion,iut=V.distance,rut=V.div,sut=V.dot,out=V.drawIndex,aut=V.dynamicBufferAttribute,lut=V.element,cut=V.emissive,uut=V.equal,hut=V.equirectDirection,fut=V.equirectUV,qse=V.exp,dut=V.exp2,put=V.exponentialHeightFogFactor,mut=V.expression,Aut=V.faceDirection,gut=V.faceForward,vut=V.faceforward,Hse=V.float,_ut=V.floatBitsToInt,xut=V.floatBitsToUint,yut=V.floor,but=V.fog,wut=V.fract,Sut=V.frameGroup,Tut=V.frameId,Eut=V.frontFacing,Mut=V.fwidth,Cut=V.gain,Rut=V.gapSize,Iut=V.getConstNodeType,Put=V.getCurrentStack,Lut=V.getDirection,Dut=V.getDistanceAttenuation,Nut=V.getGeometryRoughness,Fut=V.getNormalFromDepth,But=V.interleavedGradientNoise,Out=V.vogelDiskSample,Uut=V.getParallaxCorrectNormal,kut=V.getRoughness,zut=V.getScreenPosition,Vut=V.getShIrradianceAt,Gut=V.getShadowMaterial,qut=V.getShadowRenderObjectFunction,Hut=V.getTextureIndex,Wut=V.getViewPosition,jut=V.globalId,Xut=V.glsl,$ut=V.glslFn,Yut=V.grayscale,Zut=V.greaterThan,Kut=V.greaterThanEqual,Qut=V.hash,Jut=V.highpModelNormalViewMatrix,eht=V.highpModelViewMatrix,tht=V.hue,nht=V.increment,iht=V.incrementBefore,rht=V.instance,Wse=V.instanceIndex,sht=V.instancedArray,oht=V.instancedBufferAttribute,aht=V.instancedDynamicBufferAttribute,lht=V.instancedMesh,cht=V.int,uht=V.intBitsToFloat,hht=V.inverse,fht=V.inverseSqrt,dht=V.inversesqrt,pht=V.invocationLocalIndex,mht=V.invocationSubgroupIndex,Aht=V.ior,ght=V.iridescence,vht=V.iridescenceIOR,_ht=V.iridescenceThickness,xht=V.ivec2,yht=V.ivec3,bht=V.ivec4,wht=V.js,Sht=V.label,Tht=V.length,Eht=V.lengthSq,Mht=V.lessThan,Cht=V.lessThanEqual,Rht=V.lightPosition,Iht=V.lightProjectionUV,Pht=V.lightShadowMatrix,Lht=V.lightTargetDirection,Dht=V.lightTargetPosition,Nht=V.lightViewPosition,Fht=V.lightingContext,Bht=V.lights,Oht=V.linearDepth,Uht=V.linearToneMapping,kht=V.localId,zht=V.log,Vht=V.log2,Ght=V.logarithmicDepthToViewZ,qht=V.luminance,Hht=V.mat2,Wht=V.mat3,jht=V.mat4,Xht=V.matcapUV,$ht=V.materialAO,Yht=V.materialAlphaTest,Zht=V.materialAnisotropy,Kht=V.materialAnisotropyVector,Qht=V.materialAttenuationColor,Jht=V.materialAttenuationDistance,eft=V.materialClearcoat,tft=V.materialClearcoatNormal,nft=V.materialClearcoatRoughness,ift=V.materialColor,rft=V.materialDispersion,sft=V.materialEmissive,oft=V.materialEnvIntensity,aft=V.materialEnvRotation,lft=V.materialIOR,cft=V.materialIridescence,uft=V.materialIridescenceIOR,hft=V.materialIridescenceThickness,fft=V.materialLightMap,dft=V.materialLineDashOffset,pft=V.materialLineDashSize,mft=V.materialLineGapSize,Aft=V.materialLineScale,gft=V.materialLineWidth,vft=V.materialMetalness,_ft=V.materialNormal,xft=V.materialOpacity,yft=V.materialPointSize,bft=V.materialReference,wft=V.materialReflectivity,Sft=V.materialRefractionRatio,Tft=V.materialRotation,Eft=V.materialRoughness,Mft=V.materialSheen,Cft=V.materialSheenRoughness,Rft=V.materialShininess,Ift=V.materialSpecular,Pft=V.materialSpecularColor,Lft=V.materialSpecularIntensity,Dft=V.materialSpecularStrength,Nft=V.materialThickness,Fft=V.materialTransmission,Bft=V.max,Oft=V.maxMipLevel,Uft=V.mediumpModelViewMatrix,kft=V.metalness,zft=V.min,Vft=V.mix,Gft=V.mixElement,qft=V.mod,Hft=V.modelDirection,Wft=V.modelNormalMatrix,jft=V.modelPosition,Xft=V.modelRadius,$ft=V.modelScale,Yft=V.modelViewMatrix,Zft=V.modelViewPosition,Kft=V.modelViewProjection,Qft=V.modelWorldMatrix,Jft=V.modelWorldMatrixInverse,edt=V.morphReference,tdt=V.mrt,ndt=V.mul,idt=V.mx_aastep,rdt=V.mx_add,sdt=V.mx_atan2,odt=V.mx_cell_noise_float,adt=V.mx_contrast,ldt=V.mx_divide,cdt=V.mx_fractal_noise_float,udt=V.mx_fractal_noise_vec2,hdt=V.mx_fractal_noise_vec3,fdt=V.mx_fractal_noise_vec4,ddt=V.mx_frame,pdt=V.mx_heighttonormal,mdt=V.mx_hsvtorgb,Adt=V.mx_ifequal,gdt=V.mx_ifgreater,vdt=V.mx_ifgreatereq,_dt=V.mx_invert,xdt=V.mx_modulo,ydt=V.mx_multiply,bdt=V.mx_noise_float,wdt=V.mx_noise_vec3,Sdt=V.mx_noise_vec4,Tdt=V.mx_place2d,Edt=V.mx_power,Mdt=V.mx_ramp4,Cdt=V.mx_ramplr,Rdt=V.mx_ramptb,Idt=V.mx_rgbtohsv,Pdt=V.mx_rotate2d,Ldt=V.mx_rotate3d,Ddt=V.mx_safepower,Ndt=V.mx_separate,Fdt=V.mx_splitlr,Bdt=V.mx_splittb,Odt=V.mx_srgb_texture_to_lin_rec709,Udt=V.mx_subtract,kdt=V.mx_timer,zdt=V.mx_transform_uv,Vdt=V.mx_unifiednoise2d,Gdt=V.mx_unifiednoise3d,qdt=V.mx_worley_noise_float,Hdt=V.mx_worley_noise_vec2,Wdt=V.mx_worley_noise_vec3,jse=V.negate,jdt=V.negateOnBackSide,Xdt=V.neutralToneMapping,$dt=V.nodeArray,Ydt=V.nodeImmutable,Zdt=V.nodeObject,Kdt=V.nodeObjectIntent,Qdt=V.nodeObjects,Jdt=V.nodeProxy,ept=V.nodeProxyIntent,tpt=V.normalFlat,npt=V.normalGeometry,ipt=V.normalLocal,rpt=V.normalMap,spt=V.normalView,opt=V.normalViewGeometry,apt=V.normalWorld,lpt=V.normalWorldGeometry,cpt=V.normalize,upt=V.not,hpt=V.notEqual,fpt=V.numWorkgroups,dpt=V.objectDirection,ppt=V.objectGroup,mpt=V.objectPosition,Apt=V.objectRadius,gpt=V.objectScale,vpt=V.objectViewPosition,_pt=V.objectWorldMatrix,xpt=V.OnBeforeObjectUpdate,ypt=V.OnBeforeMaterialUpdate,bpt=V.OnObjectUpdate,wpt=V.OnMaterialUpdate,Spt=V.oneMinus,Tpt=V.or,Ept=V.orthographicDepthToViewZ,Mpt=V.oscSawtooth,Cpt=V.oscSine,Rpt=V.oscSquare,Ipt=V.oscTriangle,Ppt=V.output,Lpt=V.outputStruct,Dpt=V.overloadingFn,Npt=V.overrideNode,Fpt=V.overrideNodes,Bpt=V.packHalf2x16,Opt=V.packSnorm2x16,Upt=V.packUnorm2x16,kpt=V.packNormalToRGB,zpt=V.parabola,Vpt=V.parallaxDirection,Gpt=V.parallaxUV,qpt=V.parameter,Hpt=V.pass,Wpt=V.passTexture,jpt=V.pcurve,Xpt=V.perspectiveDepthToViewZ,$pt=V.pmremTexture,Ypt=V.pointShadow,Zpt=V.pointUV,Kpt=V.pointWidth,Qpt=V.positionGeometry,Jpt=V.positionLocal,e0t=V.positionPrevious,t0t=V.positionView,n0t=V.positionViewDirection,i0t=V.positionWorld,r0t=V.positionWorldDirection,s0t=V.posterize,o0t=V.pow,a0t=V.pow2,l0t=V.pow3,c0t=V.pow4,u0t=V.premultiplyAlpha,h0t=V.property,f0t=V.radians,d0t=V.rand,p0t=V.range,m0t=V.rangeFog,A0t=V.rangeFogFactor,g0t=V.reciprocal,v0t=V.reference,_0t=V.referenceBuffer,x0t=V.reflect,y0t=V.reflectVector,b0t=V.reflectView,w0t=V.reflector,S0t=V.refract,T0t=V.refractVector,E0t=V.refractView,M0t=V.reinhardToneMapping,C0t=V.remap,R0t=V.remapClamp,I0t=V.renderGroup,P0t=V.renderOutput,L0t=V.rendererReference,D0t=V.replaceDefaultUV,N0t=V.rotate,F0t=V.rotateUV,B0t=V.roughness,O0t=V.round,U0t=V.rtt,k0t=V.sRGBTransferEOTF,z0t=V.sRGBTransferOETF,V0t=V.sample,G0t=V.sampler,q0t=V.samplerComparison,H0t=V.saturate,W0t=V.saturation,j0t=V.screen,X0t=V.screenCoordinate,$0t=V.screenDPR,Y0t=V.screenSize,Z0t=V.screenUV,K0t=V.select,Q0t=V.setCurrentStack,J0t=V.setName,emt=V.shaderStages,tmt=V.shadow,nmt=V.shadowPositionWorld,imt=V.shapeCircle,rmt=V.sharedUniformGroup,smt=V.sheen,omt=V.sheenRoughness,amt=V.shiftLeft,lmt=V.shiftRight,cmt=V.shininess,umt=V.sign,Xse=V.sin,hmt=V.sinh,fmt=V.sinc,dmt=V.skinning,pmt=V.smoothstep,mmt=V.smoothstepElement,Amt=V.specularColor,gmt=V.specularF90,vmt=V.spherizeUV,_mt=V.split,xmt=V.spritesheetUV,$se=V.sqrt,ymt=V.stack,bmt=V.step,wmt=V.stepElement,Yse=V.storage,Smt=V.storageBarrier,Tmt=V.storageTexture,Emt=V.storageTexture3D,Mmt=V.struct,Cmt=V.sub,Rmt=V.subgroupAdd,Imt=V.subgroupAll,Pmt=V.subgroupAnd,Lmt=V.subgroupAny,Dmt=V.subgroupBallot,Nmt=V.subgroupBroadcast,Fmt=V.subgroupBroadcastFirst,Bmt=V.subBuild,Omt=V.subgroupElect,Umt=V.subgroupExclusiveAdd,kmt=V.subgroupExclusiveMul,zmt=V.subgroupInclusiveAdd,Vmt=V.subgroupInclusiveMul,Gmt=V.subgroupIndex,qmt=V.subgroupMax,Hmt=V.subgroupMin,Wmt=V.subgroupMul,jmt=V.subgroupOr,Xmt=V.subgroupShuffle,$mt=V.subgroupShuffleDown,Ymt=V.subgroupShuffleUp,Zmt=V.subgroupShuffleXor,Kmt=V.subgroupSize,Qmt=V.subgroupXor,Jmt=V.tan,eAt=V.tanh,tAt=V.tangentGeometry,nAt=V.tangentLocal,iAt=V.tangentView,rAt=V.tangentWorld,sAt=V.texture,oAt=V.texture3D,aAt=V.textureBarrier,lAt=V.textureBicubic,cAt=V.textureBicubicLevel,uAt=V.textureCubeUV,hAt=V.textureLoad,fAt=V.textureSize,dAt=V.textureLevel,pAt=V.textureStore,mAt=V.thickness,AAt=V.time,gAt=V.toneMapping,vAt=V.toneMappingExposure,_At=V.toonOutlinePass,xAt=V.transformDirection,yAt=V.transformNormal,bAt=V.transformNormalByInverseViewMatrix,wAt=V.transformNormalByViewMatrix,SAt=V.transformNormalToView,TAt=V.transformedClearcoatNormalView,EAt=V.transformedNormalView,MAt=V.transformedNormalWorld,CAt=V.transmission,RAt=V.transpose,IAt=V.triNoise3D,PAt=V.triplanarTexture,LAt=V.triplanarTextures,DAt=V.trunc,NAt=V.uint,FAt=V.uintBitsToFloat,Zse=V.uniform,BAt=V.uniformArray,OAt=V.uniformCubeTexture,UAt=V.uniformGroup,kAt=V.uniformFlow,zAt=V.uniformTexture,VAt=V.unpackHalf2x16,GAt=V.unpackSnorm2x16,qAt=V.unpackUnorm2x16,HAt=V.unpackRGBToNormal,WAt=V.unpremultiplyAlpha,jAt=V.userData,XAt=V.uv,$At=V.uvec2,YAt=V.uvec3,ZAt=V.uvec4,KAt=V.varying,QAt=V.varyingProperty,JAt=V.vec2,egt=V.vec3,tgt=V.vec4,ngt=V.vectorComponents,igt=V.velocity,rgt=V.vertexColor,sgt=V.vertexIndex,ogt=V.vertexStage,agt=V.vibrance,lgt=V.viewZToLogarithmicDepth,cgt=V.viewZToOrthographicDepth,ugt=V.viewZToPerspectiveDepth,hgt=V.viewZToReversedOrthographicDepth,fgt=V.viewZToReversedPerspectiveDepth,dgt=V.viewport,pgt=V.viewportCoordinate,mgt=V.viewportDepthTexture,Agt=V.viewportLinearDepth,ggt=V.viewportMipTexture,vgt=V.viewportOpaqueMipTexture,_gt=V.viewportResolution,xgt=V.viewportSafeUV,ygt=V.viewportSharedTexture,bgt=V.viewportSize,wgt=V.viewportTexture,Sgt=V.viewportUV,Tgt=V.wgsl,Egt=V.wgslFn,Mgt=V.workgroupArray,Cgt=V.workgroupBarrier,Rgt=V.workgroupId,Igt=V.workingToColorSpace,Pgt=V.xor;var Kse=new Oa,TI=new re,px=class extends H2{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 Ph(t,6,1);return this.setAttribute("instanceStart",new Oo(n,3,0)),this.setAttribute("instanceEnd",new Oo(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 Ph(t,6,1);return this.setAttribute("instanceColorStart",new Oo(n,3,0)),this.setAttribute("instanceColorEnd",new Oo(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 P2(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Oa);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Kse.setFromBufferAttribute(t),this.boundingBox.union(Kse))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new vl),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++)TI.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(TI)),TI.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(TI));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}};Ga.line={uniforms:ig.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===Cd){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:Eg.Add},n={srcFactor:d,dstFactor:A,operation:Eg.Add}};if(l)switch(r){case Ts:c(ui.One,ui.OneMinusSrcAlpha,ui.One,ui.OneMinusSrcAlpha);break;case Lh:c(ui.One,ui.One,ui.One,ui.One);break;case Dh:c(ui.Zero,ui.OneMinusSrc,ui.Zero,ui.One);break;case Nh: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 Lh:c(ui.SrcAlpha,ui.One,ui.One,ui.One);break;case Dh:ze(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case Nh: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 Pu:t=ui.Zero;break;case J2:t=ui.One;break;case eb:t=ui.Src;break;case tb:t=ui.OneMinusSrc;break;case $p:t=ui.SrcAlpha;break;case Yp:t=ui.OneMinusSrcAlpha;break;case rb:t=ui.Dst;break;case sb:t=ui.OneMinusDst;break;case nb:t=ui.DstAlpha;break;case ib:t=ui.OneMinusDstAlpha;break;case ob:t=ui.SrcAlphaSaturated;break;case U3e:t=ui.Constant;break;case k3e:t=ui.OneMinusConstant;break;default:ze("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t,n=e.stencilFunc;switch(n){case L8:t=qo.Never;break;case g2:t=qo.Always;break;case D8:t=qo.Less;break;case F8:t=qo.LessEqual;break;case N8:t=qo.Equal;break;case U8:t=qo.GreaterEqual;break;case B8:t=qo.Greater;break;case O8:t=qo.NotEqual;break;default:ze("WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case gd:t=K0.Keep;break;case T8:t=K0.Zero;break;case E8:t=K0.Replace;break;case P8:t=K0.Invert;break;case M8:t=K0.IncrementClamp;break;case C8:t=K0.DecrementClamp;break;case R8:t=K0.IncrementWrap;break;case I8:t=K0.DecrementWrap;break;default:ze("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case so:t=Eg.Add;break;case K2:t=Eg.Subtract;break;case Q2:t=Eg.ReverseSubtract;break;case AM:t=Eg.Min;break;case gM:t=Eg.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?G4.Uint16:G4.Uint32);let o=n.side===mi;return e.isMesh&&e.matrixWorld.determinantAffine()<0&&(o=!o),r.frontFace=o===!0?mte.CW:mte.CCW,r.cullMode=n.side===gr?Ate.None:Ate.Back,r}_getColorWriteMask(e){return e.colorWrite===!0?gte.All:gte.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=qo.Always;else{let n=this.backend.parameters.reversedDepthBuffer?yb[e.depthFunc]:e.depthFunc;switch(n){case bA:t=qo.Never;break;case wA:t=qo.Always;break;case SA:t=qo.Less;break;case Mh:t=qo.LessEqual;break;case TA:t=qo.Equal;break;case EA:t=qo.GreaterEqual;break;case MA:t=qo.Greater;break;case CA:t=qo.NotEqual;break;default:ze("WebGPUPipelineUtils: Invalid depth function.",n)}}return t}},Y4=class{constructor(){this.label="",this.type=void 0,this.count=0}reset(){this.label="",this.type=void 0,this.count=0}},uf=new mm,ePe=new Zg,Bw=new Y4,T9=class extends z4{constructor(e,t,n=2048){super(n),this.device=e,this.type=t,Bw.label=`queryset_global_timestamp_${t}`,Bw.type="timestamp",Bw.count=this.maxQueries,this.querySet=this.device.createQuerySet(Bw),Bw.reset();let r=this.maxQueries*8;uf.label=`buffer_timestamp_resolve_${t}`,uf.size=r,uf.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,this.resolveBuffer=this.device.createBuffer(uf),uf.reset(),uf.label=`buffer_timestamp_result_${t}`,uf.size=r,uf.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,this.resultBuffer=this.device.createBuffer(uf),uf.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(ePe);r.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),r.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);let s=r.finish();if(pf(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}}},E9=class{constructor(){this.label="",this.timestampWrites=void 0}reset(){this.label="",this.timestampWrites=void 0}},j_=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}},M9=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}},zu={r:0,g:0,b:0,a:1},ic=new mm,Xa=new Zg,CR=new E9,Ow=new Y4,RR=new X4,IR=new M9,Hc=new ax,hf=new ax,Tr=new mS,zd=new $4,C9=class extends k4{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 s9(this),this.attributeUtils=new v9(this),this.bindingUtils=new x9(this),this.capabilities=new y9(this),this.pipelineUtils=new S9(this),this.textureUtils=new d9(this),this.occludedResolveCache=new Map;let t=typeof navigator>"u"?!0:/Android/.test(navigator.userAgent)===!1;this._compatibility={[Pd.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(q4),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(q4.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 gl}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 Vg,s.colorAttachments.push(new zg),e.depth===!0||e.stencil===!0){let l=new j_;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:Ho.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(Tr.label=`colorAttachment_${w}`,Tr.baseMipLevel=e.activeMipmapLevel,Tr.mipLevelCount=1,Tr.baseArrayLayer=e.activeCubeFace,Tr.arrayLayerCount=1,Tr.dimension=Ho.TwoD,n.isRenderTarget3D)d=e.activeCubeFace,Tr.baseArrayLayer=0,Tr.dimension=Ho.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++){Tr.baseArrayLayer=R,Tr.arrayLayerCount=1,Tr.dimension=Ho.TwoD;let P=S.texture.createView(Tr);f.push({view:P,resolveTarget:void 0,depthSlice:void 0})}}else Tr.dimension=Ho.TwoDArray;if(A!==!0){let T=S.texture.createView(Tr),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})}Tr.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 Vg},e.depth){let w=this.get(e.depthTexture);(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(Tr.dimension=Ho.TwoD,Tr.arrayLayerCount=1,Tr.baseArrayLayer=e.activeCubeFace);let S=new j_;S.view=w.texture.createView(Tr),l.depthStencilAttachment=S,Tr.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||$a.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,Ow.label=`occlusionQuerySet_${e.id}`,Ow.type="occlusion",Ow.count=r,s=n.createQuerySet(Ow),Ow.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(Uc.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:(zu.r=0,zu.g=0,zu.b=0,zu.a=1,f.clearValue=zu),f.loadOp=Fi.Clear):f.loadOp=Fi.Load,f.storeOp=$a.Store}}else{let c=o.colorAttachments[0];e.clearColor?(c.clearValue=e.clearColorValue,c.loadOp=Fi.Clear):c.loadOp=Fi.Load,c.storeOp=$a.Store}e.depth&&(e.clearDepth?(a.depthClearValue=e.clearDepthValue,a.depthLoadOp=Fi.Clear):a.depthLoadOp=Fi.Load,a.depthStoreOp=$a.Store),e.stencil&&(e.clearStencil?(a.stencilClearValue=e.clearStencilValue,a.stencilLoadOp=Fi.Clear):a.stencilLoadOp=Fi.Load,a.stencilStoreOp=$a.Store),Xa.label="renderContext_"+e.id;let l=n.createCommandEncoder(Xa);if(Xa.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 Vg;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]||(Tr.dimension=Ho.TwoD,Tr.baseArrayLayer=a,Tr.arrayLayerCount=1,o.viewCache[f]=o.texture.createView(Tr),Tr.reset());let d=new j_;d.view=o.viewCache[f],d.depthLoadOp=s.depthLoadOp||Fi.Clear,d.depthStoreOp=s.depthStoreOp||$a.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 j_;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&&(ic.size=s,ic.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,o=this.device.createBuffer(ic),ic.reset(),this.occludedResolveCache.set(s,o)),ic.size=s,ic.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let a=this.device.createBuffer(ic);ic.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(pf(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();zu.r=A.r,zu.g=A.g,zu.b=A.b,zu.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=zu,y.loadOp=Fi.Clear,y.storeOp=$a.Store}(c||u)&&(l=A.depthStencilAttachment)}else{c=r.depth,u=r.stencil;let A={loadOp:e?Fi.Clear:Fi.Load,clearValue:e?zu:void 0};c&&(A.depthLoadOp=t?Fi.Clear:Fi.Load,A.depthClearValue=t?o.getClearDepth():void 0,A.depthStoreOp=$a.Store),u&&(A.stencilLoadOp=n?Fi.Clear:Fi.Load,A.stencilClearValue=n?o.getClearStencil():void 0,A.stencilStoreOp=$a.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=$a.Store):(l.depthLoadOp=Fi.Load,l.depthStoreOp=$a.Store)),u&&l&&(n?(l.stencilLoadOp=Fi.Clear,l.stencilClearValue=o.getClearStencil(),l.stencilStoreOp=$a.Store):(l.stencilLoadOp=Fi.Load,l.stencilStoreOp=$a.Store)),Xa.label="clear";let f=s.createCommandEncoder(Xa);Xa.reset(),f.beginRenderPass({colorAttachments:a,depthStencilAttachment:l}).end(),pf(s,f.finish())}beginCompute(e){let t=this.get(e),n="computeGroup_"+e.id;CR.label=n,Xa.label=n,this.initTimestampQuery(Uc.COMPUTE,this.getTimestampUID(e),CR),t.cmdEncoderGPU=this.device.createCommandEncoder(Xa),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(CR),t.currentPipeline=null,Xa.reset(),CR.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(),pf(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?G4.Uint16:G4.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 T9(this.device,e,2048));let r=this.timestampQueryPool[e],s=r.allocateQueriesForContext(t);IR.querySet=r.querySet,IR.beginningOfPassWriteIndex=s,IR.endOfPassWriteIndex=s+1,n.timestampWrites=IR}createNodeBuilder(e,t){return new g9(e,t)}createProgram(e){let t=this.get(e);RR.label=e.stage+(e.name!==""?`_${e.name}`:""),RR.code=e.code,t.module={module:this.device.createShaderModule(RR),entryPoint:"main"},RR.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&xf.VERTEX&&s.push("vertex"),e.visibility&xf.FRAGMENT&&s.push("fragment"),e.visibility&xf.COMPUTE&&s.push("compute");let o=`(${s.join(",")})`;ic.label=`bindingBuffer${e.id}_${e.name}_${o}`,ic.size=n,ic.usage=r;let a=this.device.createBuffer(ic);ic.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 xte[e]!==void 0&&(e=xte[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),Xa.label="copyTextureToTexture_"+e.id+"_"+t.id;let S=this.device.createCommandEncoder(Xa);Xa.reset();let T=this.get(e).texture,R=this.get(t).texture;Hc.texture=T,Hc.mipLevel=s,Hc.origin.x=u,Hc.origin.y=f,Hc.origin.z=d,hf.texture=R,hf.mipLevel=o,hf.origin.x=a,hf.origin.y=l,hf.origin.z=c,zd.width=A,zd.height=y,zd.depthOrArrayLayers=w,S.copyTextureToTexture(Hc,hf,zd),Hc.reset(),hf.reset(),zd.reset(),pf(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):(Xa.label="copyFramebufferToTexture_"+e.id,a=this.device.createCommandEncoder(Xa),Xa.reset()),Hc.texture=s,Hc.origin.x=n.x,Hc.origin.y=n.y,hf.texture=o,zd.width=n.z,zd.height=n.w,a.copyTextureToTexture(Hc,hf,zd),Hc.reset(),hf.reset(),zd.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 pf(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()}},R9=class extends VA{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}},I9=class extends VA{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}},P9=class extends P4{constructor(){super(),this.addMaterial(e7,"MeshPhongMaterial"),this.addMaterial(c4,"MeshStandardMaterial"),this.addMaterial(l7,"MeshPhysicalMaterial"),this.addMaterial(u7,"MeshToonMaterial"),this.addMaterial(QU,"MeshBasicMaterial"),this.addMaterial(JU,"MeshLambertMaterial"),this.addMaterial($U,"MeshNormalMaterial"),this.addMaterial(h7,"MeshMatcapMaterial"),this.addMaterial(WU,"LineBasicMaterial"),this.addMaterial(jU,"LineDashedMaterial"),this.addMaterial(d7,"PointsMaterial"),this.addMaterial(u4,"SpriteMaterial"),this.addMaterial(m7,"ShadowMaterial"),this.addLight(sk,G2),this.addLight(Rk,GA),this.addLight(Nk,q2),this.addLight(hS,VA),this.addLight(Ck,qA),this.addLight(Ik,z2),this.addLight(Lk,H2),this.addLight(Pk,R9),this.addLight(Dk,I9),this.addToneMapping(ise,ab),this.addToneMapping(rse,lb),this.addToneMapping(sse,cb),this.addToneMapping(ose,ub),this.addToneMapping(ase,hb),this.addToneMapping(lse,fb)}},lx=class extends qk{constructor(e={}){let t;e.forceWebGL?t=V4:(t=C9,e.getFallback=()=>(Xe("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new V4(e)));let n=new t(e);super(n,e),this.library=new P9,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}};var nat=V.BRDF_GGX,iat=V.BRDF_Lambert,rat=V.BasicPointShadowFilter,sat=V.BasicShadowFilter,oat=V.Break,aat=V.Const,lat=V.Continue,cat=V.DFGLUT,uat=V.D_GGX,hat=V.Discard,fat=V.EPSILON,dat=V.F_Schlick,kse=V.Fn,pat=V.INFINITY,zse=V.If,Vse=V.Loop,mat=V.NodeAccess,Aat=V.NodeShaderStage,gat=V.NodeType,vat=V.NodeUpdateType,_at=V.PCFShadowFilter,xat=V.PCFSoftShadowFilter,yat=V.PI,bat=V.PI2,wat=V.TWO_PI,Sat=V.HALF_PI,Tat=V.PointShadowFilter,Eat=V.Return,Mat=V.Schlick_to_F0,Cat=V.ShaderNode,Rat=V.Stack,Iat=V.Switch,Pat=V.TBNViewMatrix,Lat=V.VSMShadowFilter,Dat=V.V_GGX_SmithCorrelated,Nat=V.Var,Fat=V.VarIntent,Bat=V.abs,Oat=V.acesFilmicToneMapping,Uat=V.acos,kat=V.acosh,zat=V.add,Vat=V.addMethodChaining,Gat=V.addNodeElement,qat=V.agxToneMapping,Hat=V.all,Wat=V.alphaT,jat=V.ambientOcclusion,Xat=V.and,$at=V.anisotropy,Yat=V.anisotropyB,Zat=V.anisotropyT,Kat=V.any,Qat=V.append,Jat=V.array,Gse=V.asin,elt=V.asinh,tlt=V.assign,nlt=V.atan,ilt=V.atanh,rlt=V.atomicAdd,slt=V.atomicAnd,olt=V.atomicFunc,alt=V.atomicLoad,llt=V.atomicMax,clt=V.atomicMin,ult=V.atomicOr,hlt=V.atomicStore,flt=V.atomicSub,dlt=V.atomicXor,plt=V.attenuationColor,mlt=V.attenuationDistance,Alt=V.attribute,glt=V.attributeArray,vlt=V.backgroundBlurriness,_lt=V.backgroundIntensity,xlt=V.backgroundRotation,ylt=V.batch,blt=V.bentNormalView,wlt=V.billboarding,Slt=V.bitAnd,Tlt=V.bitNot,Elt=V.bitOr,Mlt=V.bitXor,Clt=V.bitangentGeometry,Rlt=V.bitangentLocal,Ilt=V.bitangentView,Plt=V.bitangentWorld,Llt=V.bitcast,Dlt=V.blendBurn,Nlt=V.blendColor,Flt=V.blendDodge,Blt=V.blendOverlay,Olt=V.blendScreen,Ult=V.blur,klt=V.bool,zlt=V.buffer,Vlt=V.bufferAttribute,Glt=V.bumpMap,qlt=V.builtin,Hlt=V.builtinAOContext,Wlt=V.builtinShadowContext,jlt=V.bvec2,Xlt=V.bvec3,$lt=V.bvec4,Ylt=V.bypass,Zlt=V.cache,Klt=V.call,Qlt=V.cameraFar,Jlt=V.cameraIndex,ect=V.cameraNear,tct=V.cameraNormalMatrix,nct=V.cameraPosition,ict=V.cameraProjectionMatrix,rct=V.cameraProjectionMatrixInverse,sct=V.cameraViewMatrix,oct=V.cameraViewport,act=V.cameraWorldMatrix,lct=V.cbrt,cct=V.cdl,uct=V.ceil,hct=V.checker,fct=V.cineonToneMapping,dct=V.clamp,pct=V.clearcoat,mct=V.clearcoatNormalView,Act=V.clearcoatRoughness,gct=V.clipSpace,vct=V.code,_ct=V.color,xct=V.colorSpaceToWorking,yct=V.colorToDirection,bct=V.compute,wct=V.computeKernel,Sct=V.computeSkinning,Tct=V.context,Ect=V.convert,Mct=V.convertColorSpace,Cct=V.convertToTexture,Rct=V.countLeadingZeros,Ict=V.countOneBits,Pct=V.countTrailingZeros,qse=V.cos,Lct=V.cosh,Dct=V.cross,Nct=V.cubeTexture,Fct=V.cubeTextureBase,Bct=V.dFdx,Oct=V.dFdy,Uct=V.dashSize,kct=V.debug,zct=V.decrement,Vct=V.decrementBefore,Gct=V.defaultBuildStages,qct=V.defaultShaderStages,Hct=V.defined,Wct=V.degrees,jct=V.deltaTime,Xct=V.densityFog,$ct=V.densityFogFactor,Yct=V.depth,Zct=V.depthPass,Kct=V.determinant,Qct=V.difference,Jct=V.diffuseColor,eut=V.directPointLight,tut=V.directionToColor,nut=V.directionToFaceDirection,iut=V.dispersion,rut=V.distance,sut=V.div,out=V.dot,aut=V.drawIndex,lut=V.dynamicBufferAttribute,cut=V.element,uut=V.emissive,hut=V.equal,fut=V.equirectDirection,dut=V.equirectUV,Hse=V.exp,put=V.exp2,mut=V.exponentialHeightFogFactor,Aut=V.expression,gut=V.faceDirection,vut=V.faceForward,_ut=V.faceforward,Wse=V.float,xut=V.floatBitsToInt,yut=V.floatBitsToUint,but=V.floor,wut=V.fog,Sut=V.fract,Tut=V.frameGroup,Eut=V.frameId,Mut=V.frontFacing,Cut=V.fwidth,Rut=V.gain,Iut=V.gapSize,Put=V.getConstNodeType,Lut=V.getCurrentStack,Dut=V.getDirection,Nut=V.getDistanceAttenuation,Fut=V.getGeometryRoughness,But=V.getNormalFromDepth,Out=V.interleavedGradientNoise,Uut=V.vogelDiskSample,kut=V.getParallaxCorrectNormal,zut=V.getRoughness,Vut=V.getScreenPosition,Gut=V.getShIrradianceAt,qut=V.getShadowMaterial,Hut=V.getShadowRenderObjectFunction,Wut=V.getTextureIndex,jut=V.getViewPosition,Xut=V.globalId,$ut=V.glsl,Yut=V.glslFn,Zut=V.grayscale,Kut=V.greaterThan,Qut=V.greaterThanEqual,Jut=V.hash,eht=V.highpModelNormalViewMatrix,tht=V.highpModelViewMatrix,nht=V.hue,iht=V.increment,rht=V.incrementBefore,sht=V.instance,jse=V.instanceIndex,oht=V.instancedArray,aht=V.instancedBufferAttribute,lht=V.instancedDynamicBufferAttribute,cht=V.instancedMesh,uht=V.int,hht=V.intBitsToFloat,fht=V.inverse,dht=V.inverseSqrt,pht=V.inversesqrt,mht=V.invocationLocalIndex,Aht=V.invocationSubgroupIndex,ght=V.ior,vht=V.iridescence,_ht=V.iridescenceIOR,xht=V.iridescenceThickness,yht=V.ivec2,bht=V.ivec3,wht=V.ivec4,Sht=V.js,Tht=V.label,Eht=V.length,Mht=V.lengthSq,Cht=V.lessThan,Rht=V.lessThanEqual,Iht=V.lightPosition,Pht=V.lightProjectionUV,Lht=V.lightShadowMatrix,Dht=V.lightTargetDirection,Nht=V.lightTargetPosition,Fht=V.lightViewPosition,Bht=V.lightingContext,Oht=V.lights,Uht=V.linearDepth,kht=V.linearToneMapping,zht=V.localId,Vht=V.log,Ght=V.log2,qht=V.logarithmicDepthToViewZ,Hht=V.luminance,Wht=V.mat2,jht=V.mat3,Xht=V.mat4,$ht=V.matcapUV,Yht=V.materialAO,Zht=V.materialAlphaTest,Kht=V.materialAnisotropy,Qht=V.materialAnisotropyVector,Jht=V.materialAttenuationColor,eft=V.materialAttenuationDistance,tft=V.materialClearcoat,nft=V.materialClearcoatNormal,ift=V.materialClearcoatRoughness,rft=V.materialColor,sft=V.materialDispersion,oft=V.materialEmissive,aft=V.materialEnvIntensity,lft=V.materialEnvRotation,cft=V.materialIOR,uft=V.materialIridescence,hft=V.materialIridescenceIOR,fft=V.materialIridescenceThickness,dft=V.materialLightMap,pft=V.materialLineDashOffset,mft=V.materialLineDashSize,Aft=V.materialLineGapSize,gft=V.materialLineScale,vft=V.materialLineWidth,_ft=V.materialMetalness,xft=V.materialNormal,yft=V.materialOpacity,bft=V.materialPointSize,wft=V.materialReference,Sft=V.materialReflectivity,Tft=V.materialRefractionRatio,Eft=V.materialRotation,Mft=V.materialRoughness,Cft=V.materialSheen,Rft=V.materialSheenRoughness,Ift=V.materialShininess,Pft=V.materialSpecular,Lft=V.materialSpecularColor,Dft=V.materialSpecularIntensity,Nft=V.materialSpecularStrength,Fft=V.materialThickness,Bft=V.materialTransmission,Oft=V.max,Uft=V.maxMipLevel,kft=V.mediumpModelViewMatrix,zft=V.metalness,Vft=V.min,Gft=V.mix,qft=V.mixElement,Hft=V.mod,Wft=V.modelDirection,jft=V.modelNormalMatrix,Xft=V.modelPosition,$ft=V.modelRadius,Yft=V.modelScale,Zft=V.modelViewMatrix,Kft=V.modelViewPosition,Qft=V.modelViewProjection,Jft=V.modelWorldMatrix,edt=V.modelWorldMatrixInverse,tdt=V.morphReference,ndt=V.mrt,idt=V.mul,rdt=V.mx_aastep,sdt=V.mx_add,odt=V.mx_atan2,adt=V.mx_cell_noise_float,ldt=V.mx_contrast,cdt=V.mx_divide,udt=V.mx_fractal_noise_float,hdt=V.mx_fractal_noise_vec2,fdt=V.mx_fractal_noise_vec3,ddt=V.mx_fractal_noise_vec4,pdt=V.mx_frame,mdt=V.mx_heighttonormal,Adt=V.mx_hsvtorgb,gdt=V.mx_ifequal,vdt=V.mx_ifgreater,_dt=V.mx_ifgreatereq,xdt=V.mx_invert,ydt=V.mx_modulo,bdt=V.mx_multiply,wdt=V.mx_noise_float,Sdt=V.mx_noise_vec3,Tdt=V.mx_noise_vec4,Edt=V.mx_place2d,Mdt=V.mx_power,Cdt=V.mx_ramp4,Rdt=V.mx_ramplr,Idt=V.mx_ramptb,Pdt=V.mx_rgbtohsv,Ldt=V.mx_rotate2d,Ddt=V.mx_rotate3d,Ndt=V.mx_safepower,Fdt=V.mx_separate,Bdt=V.mx_splitlr,Odt=V.mx_splittb,Udt=V.mx_srgb_texture_to_lin_rec709,kdt=V.mx_subtract,zdt=V.mx_timer,Vdt=V.mx_transform_uv,Gdt=V.mx_unifiednoise2d,qdt=V.mx_unifiednoise3d,Hdt=V.mx_worley_noise_float,Wdt=V.mx_worley_noise_vec2,jdt=V.mx_worley_noise_vec3,Xse=V.negate,Xdt=V.negateOnBackSide,$dt=V.neutralToneMapping,Ydt=V.nodeArray,Zdt=V.nodeImmutable,Kdt=V.nodeObject,Qdt=V.nodeObjectIntent,Jdt=V.nodeObjects,ept=V.nodeProxy,tpt=V.nodeProxyIntent,npt=V.normalFlat,ipt=V.normalGeometry,rpt=V.normalLocal,spt=V.normalMap,opt=V.normalView,apt=V.normalViewGeometry,lpt=V.normalWorld,cpt=V.normalWorldGeometry,upt=V.normalize,hpt=V.not,fpt=V.notEqual,dpt=V.numWorkgroups,ppt=V.objectDirection,mpt=V.objectGroup,Apt=V.objectPosition,gpt=V.objectRadius,vpt=V.objectScale,_pt=V.objectViewPosition,xpt=V.objectWorldMatrix,ypt=V.OnBeforeObjectUpdate,bpt=V.OnBeforeMaterialUpdate,wpt=V.OnObjectUpdate,Spt=V.OnMaterialUpdate,Tpt=V.oneMinus,Ept=V.or,Mpt=V.orthographicDepthToViewZ,Cpt=V.oscSawtooth,Rpt=V.oscSine,Ipt=V.oscSquare,Ppt=V.oscTriangle,Lpt=V.output,Dpt=V.outputStruct,Npt=V.overloadingFn,Fpt=V.overrideNode,Bpt=V.overrideNodes,Opt=V.packHalf2x16,Upt=V.packSnorm2x16,kpt=V.packUnorm2x16,zpt=V.packNormalToRGB,Vpt=V.parabola,Gpt=V.parallaxDirection,qpt=V.parallaxUV,Hpt=V.parameter,Wpt=V.pass,jpt=V.passTexture,Xpt=V.pcurve,$pt=V.perspectiveDepthToViewZ,Ypt=V.pmremTexture,Zpt=V.pointShadow,Kpt=V.pointUV,Qpt=V.pointWidth,Jpt=V.positionGeometry,e0t=V.positionLocal,t0t=V.positionPrevious,n0t=V.positionView,i0t=V.positionViewDirection,r0t=V.positionWorld,s0t=V.positionWorldDirection,o0t=V.posterize,a0t=V.pow,l0t=V.pow2,c0t=V.pow3,u0t=V.pow4,h0t=V.premultiplyAlpha,f0t=V.property,d0t=V.radians,p0t=V.rand,m0t=V.range,A0t=V.rangeFog,g0t=V.rangeFogFactor,v0t=V.reciprocal,_0t=V.reference,x0t=V.referenceBuffer,y0t=V.reflect,b0t=V.reflectVector,w0t=V.reflectView,S0t=V.reflector,T0t=V.refract,E0t=V.refractVector,M0t=V.refractView,C0t=V.reinhardToneMapping,R0t=V.remap,I0t=V.remapClamp,P0t=V.renderGroup,L0t=V.renderOutput,D0t=V.rendererReference,N0t=V.replaceDefaultUV,F0t=V.rotate,B0t=V.rotateUV,O0t=V.roughness,U0t=V.round,k0t=V.rtt,z0t=V.sRGBTransferEOTF,V0t=V.sRGBTransferOETF,G0t=V.sample,q0t=V.sampler,H0t=V.samplerComparison,W0t=V.saturate,j0t=V.saturation,X0t=V.screen,$0t=V.screenCoordinate,Y0t=V.screenDPR,Z0t=V.screenSize,K0t=V.screenUV,Q0t=V.select,J0t=V.setCurrentStack,emt=V.setName,tmt=V.shaderStages,nmt=V.shadow,imt=V.shadowPositionWorld,rmt=V.shapeCircle,smt=V.sharedUniformGroup,omt=V.sheen,amt=V.sheenRoughness,lmt=V.shiftLeft,cmt=V.shiftRight,umt=V.shininess,hmt=V.sign,$se=V.sin,fmt=V.sinh,dmt=V.sinc,pmt=V.skinning,mmt=V.smoothstep,Amt=V.smoothstepElement,gmt=V.specularColor,vmt=V.specularF90,_mt=V.spherizeUV,xmt=V.split,ymt=V.spritesheetUV,Yse=V.sqrt,bmt=V.stack,wmt=V.step,Smt=V.stepElement,Zse=V.storage,Tmt=V.storageBarrier,Emt=V.storageTexture,Mmt=V.storageTexture3D,Cmt=V.struct,Rmt=V.sub,Imt=V.subgroupAdd,Pmt=V.subgroupAll,Lmt=V.subgroupAnd,Dmt=V.subgroupAny,Nmt=V.subgroupBallot,Fmt=V.subgroupBroadcast,Bmt=V.subgroupBroadcastFirst,Omt=V.subBuild,Umt=V.subgroupElect,kmt=V.subgroupExclusiveAdd,zmt=V.subgroupExclusiveMul,Vmt=V.subgroupInclusiveAdd,Gmt=V.subgroupInclusiveMul,qmt=V.subgroupIndex,Hmt=V.subgroupMax,Wmt=V.subgroupMin,jmt=V.subgroupMul,Xmt=V.subgroupOr,$mt=V.subgroupShuffle,Ymt=V.subgroupShuffleDown,Zmt=V.subgroupShuffleUp,Kmt=V.subgroupShuffleXor,Qmt=V.subgroupSize,Jmt=V.subgroupXor,eAt=V.tan,tAt=V.tanh,nAt=V.tangentGeometry,iAt=V.tangentLocal,rAt=V.tangentView,sAt=V.tangentWorld,oAt=V.texture,aAt=V.texture3D,lAt=V.textureBarrier,cAt=V.textureBicubic,uAt=V.textureBicubicLevel,hAt=V.textureCubeUV,fAt=V.textureLoad,dAt=V.textureSize,pAt=V.textureLevel,mAt=V.textureStore,AAt=V.thickness,gAt=V.time,vAt=V.toneMapping,_At=V.toneMappingExposure,xAt=V.toonOutlinePass,yAt=V.transformDirection,bAt=V.transformNormal,wAt=V.transformNormalByInverseViewMatrix,SAt=V.transformNormalByViewMatrix,TAt=V.transformNormalToView,EAt=V.transformedClearcoatNormalView,MAt=V.transformedNormalView,CAt=V.transformedNormalWorld,RAt=V.transmission,IAt=V.transpose,PAt=V.triNoise3D,LAt=V.triplanarTexture,DAt=V.triplanarTextures,NAt=V.trunc,FAt=V.uint,BAt=V.uintBitsToFloat,Kse=V.uniform,OAt=V.uniformArray,UAt=V.uniformCubeTexture,kAt=V.uniformGroup,zAt=V.uniformFlow,VAt=V.uniformTexture,GAt=V.unpackHalf2x16,qAt=V.unpackSnorm2x16,HAt=V.unpackUnorm2x16,WAt=V.unpackRGBToNormal,jAt=V.unpremultiplyAlpha,XAt=V.userData,$At=V.uv,YAt=V.uvec2,ZAt=V.uvec3,KAt=V.uvec4,QAt=V.varying,JAt=V.varyingProperty,egt=V.vec2,tgt=V.vec3,ngt=V.vec4,igt=V.vectorComponents,rgt=V.velocity,sgt=V.vertexColor,ogt=V.vertexIndex,agt=V.vertexStage,lgt=V.vibrance,cgt=V.viewZToLogarithmicDepth,ugt=V.viewZToOrthographicDepth,hgt=V.viewZToPerspectiveDepth,fgt=V.viewZToReversedOrthographicDepth,dgt=V.viewZToReversedPerspectiveDepth,pgt=V.viewport,mgt=V.viewportCoordinate,Agt=V.viewportDepthTexture,ggt=V.viewportLinearDepth,vgt=V.viewportMipTexture,_gt=V.viewportOpaqueMipTexture,xgt=V.viewportResolution,ygt=V.viewportSafeUV,bgt=V.viewportSharedTexture,wgt=V.viewportSize,Sgt=V.viewportTexture,Tgt=V.viewportUV,Egt=V.wgsl,Mgt=V.wgslFn,Cgt=V.workgroupArray,Rgt=V.workgroupBarrier,Igt=V.workgroupId,Pgt=V.workingToColorSpace,Lgt=V.xor;var Qse=new Oa,TI=new re,px=class extends W2{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 Ph(t,6,1);return this.setAttribute("instanceStart",new Uo(n,3,0)),this.setAttribute("instanceEnd",new Uo(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 Ph(t,6,1);return this.setAttribute("instanceColorStart",new Uo(n,3,0)),this.setAttribute("instanceColorEnd",new Uo(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 L2(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Oa);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Qse.setFromBufferAttribute(t),this.boundingBox.union(Qse))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new vl),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++)TI.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(TI)),TI.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(TI));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}};Ga.line={uniforms:ig.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};`}},pa=new mm,WO=new Zg,Ose=new Map([[Int8Array,["sint8","
50935093 #include <premultiplied_alpha_fragment>50945094 50955095 }5096- `};var Cf=class extends fs{constructor(e){super({type:"LineMaterial",uniforms:ig.clone(Ga.line.uniforms),vertexShader:Ga.line.vertexShader,fragmentShader:Ga.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 oV=new xn,Qse=new re,Jse=new re,$o=new xn,Yo=new xn,Rf=new xn,aV=new re,lV=new cn,Zo=new j2,eoe=new re,EI=new Oa,MI=new vl,If=new xn,Pf,n1;function toe(i,e,t){return If.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),If.multiplyScalar(1/If.w),If.x=n1/t.width,If.y=n1/t.height,If.applyMatrix4(i.projectionMatrixInverse),If.multiplyScalar(1/If.w),Math.abs(Math.max(If.x,If.y))}function tPe(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++){Zo.start.fromBufferAttribute(r,a),Zo.end.fromBufferAttribute(s,a),Zo.applyMatrix4(t);let c=new re,u=new re;Pf.distanceSqToSegment(Zo.start,Zo.end,u,c),u.distanceTo(c)<n1*.5&&e.push({point:u,pointOnLine:c,distance:Pf.origin.distanceTo(u),object:i,face:null,faceIndex:a,uv:null,uv1:null})}}function nPe(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;Pf.at(1,Rf),Rf.w=1,Rf.applyMatrix4(e.matrixWorldInverse),Rf.applyMatrix4(n),Rf.multiplyScalar(1/Rf.w),Rf.x*=s.x/2,Rf.y*=s.y/2,Rf.z=0,aV.copy(Rf),lV.multiplyMatrices(e.matrixWorldInverse,o);for(let d=0,A=u;d<A;d++){if($o.fromBufferAttribute(l,d),Yo.fromBufferAttribute(c,d),$o.w=1,Yo.w=1,$o.applyMatrix4(lV),Yo.applyMatrix4(lV),$o.z>f&&Yo.z>f)continue;if($o.z>f){let P=$o.z-Yo.z,I=($o.z-f)/P;$o.lerp(Yo,I)}else if(Yo.z>f){let P=Yo.z-$o.z,I=(Yo.z-f)/P;Yo.lerp($o,I)}$o.applyMatrix4(n),Yo.applyMatrix4(n),$o.multiplyScalar(1/$o.w),Yo.multiplyScalar(1/Yo.w),$o.x*=s.x/2,$o.y*=s.y/2,Yo.x*=s.x/2,Yo.y*=s.y/2,Zo.start.copy($o),Zo.start.z=0,Zo.end.copy(Yo),Zo.end.z=0;let w=Zo.closestPointToPointParameter(aV,!0);Zo.at(w,eoe);let S=Lu.lerp($o.z,Yo.z,w),T=S>=-1&&S<=1,R=aV.distanceTo(eoe)<n1*.5;if(T&&R){Zo.start.fromBufferAttribute(l,d),Zo.end.fromBufferAttribute(c,d),Zo.start.applyMatrix4(o),Zo.end.applyMatrix4(o);let P=new re,I=new re;Pf.distanceSqToSegment(Zo.start,Zo.end,I,P),t.push({point:I,pointOnLine:P,distance:Pf.origin.distanceTo(I),object:i,face:null,faceIndex:d,uv:null,uv1:null})}}}var CI=class extends Hn{constructor(e=new px,t=new Cf({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)Qse.fromBufferAttribute(t,o),Jse.fromBufferAttribute(n,o),r[a]=a===0?0:r[a-1],r[a+1]=r[a]+Qse.distanceTo(Jse);let s=new Ph(r,2,1);return e.setAttribute("instanceDistanceStart",new Oo(s,1,0)),e.setAttribute("instanceDistanceEnd",new Oo(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;Pf=e.ray;let o=this.matrixWorld,a=this.geometry,l=this.material;n1=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),MI.copy(a.boundingSphere).applyMatrix4(o);let c;if(n)c=n1*.5;else{let f=Math.max(r.near,MI.distanceToPoint(Pf.origin));c=toe(r,f,l.resolution)}if(MI.radius+=c,Pf.intersectsSphere(MI)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),EI.copy(a.boundingBox).applyMatrix4(o);let u;if(n)u=n1*.5;else{let f=Math.max(r.near,EI.distanceToPoint(Pf.origin));u=toe(r,f,l.resolution)}EI.expandByScalar(u),Pf.intersectsBox(EI)!==!1&&(n?tPe(this,t):nPe(this,r,t))}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(oV),this.material.uniforms.resolution.value.set(oV.z,oV.w))}};var xm=class extends px{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 CI{constructor(e=new xm,t=new Cf({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}};var Ax=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,n="ltr"){let r=[],s=iPe(e,t,this.data,n);for(let o=0,a=s.length;o<a;o++)r.push(...s[o].toShapes());return r}};function iPe(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=rPe(f,s,l,c,t);n=="tb"?(l=0,c+=t.ascender*s):l+=d.offsetX,a.push(d.path)}}return a}function rPe(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 X2,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 bS=class i extends R2{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 Ax(t.font.data),new i(t.text,t)}};function dV(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 sPe(i){if(Array.isArray(i))return i}function oPe(i){if(Array.isArray(i))return dV(i)}function doe(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 aPe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function noe(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 lPe(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){noe(s,n,r,o,a,"next",l)}function a(l){noe(s,n,r,o,a,"throw",l)}o(void 0)})}}function FI(i,e,t){return e=xx(e),gPe(i,_V()?Reflect.construct(e,t||[],xx(i).constructor):e.apply(i,t))}function cPe(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function BI(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function wS(i,e){return i.get(doe(i,e))}function cV(i,e,t){cPe(i,e),e.set(i,t)}function uV(i,e,t){return i.set(doe(i,e),t),t}function vV(i,e,t){if(_V())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 uPe(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,poe(n.key),n)}}function OI(i,e,t){return e&&uPe(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function To(i,e,t){return(e=poe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function pV(){return pV=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,t){var n=vPe(i,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?i:t):r.value}},pV.apply(null,arguments)}function xx(i){return xx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},xx(i)}function UI(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&&AV(i,e)}function _V(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_V=function(){return!!i})()}function hPe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function fPe(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 dPe(){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 pPe(){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 ioe(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?ioe(Object(t),!0).forEach(function(n){To(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):ioe(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function mPe(i,e){if(i==null)return{};var t,n,r=APe(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 APe(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 gPe(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 aPe(i)}function mV(){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 hc(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]())):(hc(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,hc(A,r,"GeneratorFunction")),A.prototype=Object.create(f),A}return l.prototype=c,hc(f,"constructor",c),hc(c,"constructor",l),l.displayName="GeneratorFunction",hc(c,r,"GeneratorFunction"),hc(f),hc(f,r,"Generator"),hc(f,n,function(){return this}),hc(f,"toString",function(){return"[object Generator]"}),(mV=function(){return{w:s,m:d}})()}function hc(i,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}hc=function(s,o,a,l){function c(u,f){hc(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))},hc(i,e,t,n)}function AV(i,e){return AV=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},AV(i,e)}function Ir(i,e){return sPe(i)||fPe(i,e)||moe(i,e)||dPe()}function vPe(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=xx(i))!==null;);return i}function hV(i,e,t,n){var r=pV(xx(i.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function tr(i){return oPe(i)||hPe(i)||moe(i)||pPe()}function _Pe(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 poe(i){var e=_Pe(i,"string");return typeof e=="symbol"?e:e+""}function moe(i,e){if(i){if(typeof i=="string")return dV(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)?dV(i,e):void 0}}var Aoe=function(e){e instanceof Array?e.forEach(Aoe):(e.map&&e.map.dispose(),e.dispose())},wm=function(e){e.geometry&&e.geometry.dispose(),e.material&&Aoe(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(wm)},ts=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),wm(t)}};function el(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 vr=100;function roe(){return vr}function eu(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=vr*(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 goe(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/vr-1}}function r1(i){return i*Math.PI/180}var TS=window.THREE?window.THREE:{BackSide:mi,BufferAttribute:Hi,Color:zt,Mesh:Hn,ShaderMaterial:fs},xPe=`5096+ `};var Cf=class extends fs{constructor(e){super({type:"LineMaterial",uniforms:ig.clone(Ga.line.uniforms),vertexShader:Ga.line.vertexShader,fragmentShader:Ga.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 oV=new xn,Jse=new re,eoe=new re,Yo=new xn,Zo=new xn,Rf=new xn,aV=new re,lV=new cn,Ko=new X2,toe=new re,EI=new Oa,MI=new vl,If=new xn,Pf,n1;function noe(i,e,t){return If.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),If.multiplyScalar(1/If.w),If.x=n1/t.width,If.y=n1/t.height,If.applyMatrix4(i.projectionMatrixInverse),If.multiplyScalar(1/If.w),Math.abs(Math.max(If.x,If.y))}function nPe(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++){Ko.start.fromBufferAttribute(r,a),Ko.end.fromBufferAttribute(s,a),Ko.applyMatrix4(t);let c=new re,u=new re;Pf.distanceSqToSegment(Ko.start,Ko.end,u,c),u.distanceTo(c)<n1*.5&&e.push({point:u,pointOnLine:c,distance:Pf.origin.distanceTo(u),object:i,face:null,faceIndex:a,uv:null,uv1:null})}}function iPe(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;Pf.at(1,Rf),Rf.w=1,Rf.applyMatrix4(e.matrixWorldInverse),Rf.applyMatrix4(n),Rf.multiplyScalar(1/Rf.w),Rf.x*=s.x/2,Rf.y*=s.y/2,Rf.z=0,aV.copy(Rf),lV.multiplyMatrices(e.matrixWorldInverse,o);for(let d=0,A=u;d<A;d++){if(Yo.fromBufferAttribute(l,d),Zo.fromBufferAttribute(c,d),Yo.w=1,Zo.w=1,Yo.applyMatrix4(lV),Zo.applyMatrix4(lV),Yo.z>f&&Zo.z>f)continue;if(Yo.z>f){let P=Yo.z-Zo.z,I=(Yo.z-f)/P;Yo.lerp(Zo,I)}else if(Zo.z>f){let P=Zo.z-Yo.z,I=(Zo.z-f)/P;Zo.lerp(Yo,I)}Yo.applyMatrix4(n),Zo.applyMatrix4(n),Yo.multiplyScalar(1/Yo.w),Zo.multiplyScalar(1/Zo.w),Yo.x*=s.x/2,Yo.y*=s.y/2,Zo.x*=s.x/2,Zo.y*=s.y/2,Ko.start.copy(Yo),Ko.start.z=0,Ko.end.copy(Zo),Ko.end.z=0;let w=Ko.closestPointToPointParameter(aV,!0);Ko.at(w,toe);let S=Du.lerp(Yo.z,Zo.z,w),T=S>=-1&&S<=1,R=aV.distanceTo(toe)<n1*.5;if(T&&R){Ko.start.fromBufferAttribute(l,d),Ko.end.fromBufferAttribute(c,d),Ko.start.applyMatrix4(o),Ko.end.applyMatrix4(o);let P=new re,I=new re;Pf.distanceSqToSegment(Ko.start,Ko.end,I,P),t.push({point:I,pointOnLine:P,distance:Pf.origin.distanceTo(I),object:i,face:null,faceIndex:d,uv:null,uv1:null})}}}var CI=class extends Hn{constructor(e=new px,t=new Cf({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)Jse.fromBufferAttribute(t,o),eoe.fromBufferAttribute(n,o),r[a]=a===0?0:r[a-1],r[a+1]=r[a]+Jse.distanceTo(eoe);let s=new Ph(r,2,1);return e.setAttribute("instanceDistanceStart",new Uo(s,1,0)),e.setAttribute("instanceDistanceEnd",new Uo(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;Pf=e.ray;let o=this.matrixWorld,a=this.geometry,l=this.material;n1=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),MI.copy(a.boundingSphere).applyMatrix4(o);let c;if(n)c=n1*.5;else{let f=Math.max(r.near,MI.distanceToPoint(Pf.origin));c=noe(r,f,l.resolution)}if(MI.radius+=c,Pf.intersectsSphere(MI)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),EI.copy(a.boundingBox).applyMatrix4(o);let u;if(n)u=n1*.5;else{let f=Math.max(r.near,EI.distanceToPoint(Pf.origin));u=noe(r,f,l.resolution)}EI.expandByScalar(u),Pf.intersectsBox(EI)!==!1&&(n?nPe(this,t):iPe(this,r,t))}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(oV),this.material.uniforms.resolution.value.set(oV.z,oV.w))}};var xm=class extends px{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 CI{constructor(e=new xm,t=new Cf({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}};var Ax=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,n="ltr"){let r=[],s=rPe(e,t,this.data,n);for(let o=0,a=s.length;o<a;o++)r.push(...s[o].toShapes());return r}};function rPe(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=sPe(f,s,l,c,t);n=="tb"?(l=0,c+=t.ascender*s):l+=d.offsetX,a.push(d.path)}}return a}function sPe(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 $2,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 wS=class i extends I2{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 Ax(t.font.data),new i(t.text,t)}};function dV(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 oPe(i){if(Array.isArray(i))return i}function aPe(i){if(Array.isArray(i))return dV(i)}function poe(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 lPe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function ioe(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 cPe(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){ioe(s,n,r,o,a,"next",l)}function a(l){ioe(s,n,r,o,a,"throw",l)}o(void 0)})}}function FI(i,e,t){return e=xx(e),vPe(i,_V()?Reflect.construct(e,t||[],xx(i).constructor):e.apply(i,t))}function uPe(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function BI(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function SS(i,e){return i.get(poe(i,e))}function cV(i,e,t){uPe(i,e),e.set(i,t)}function uV(i,e,t){return i.set(poe(i,e),t),t}function vV(i,e,t){if(_V())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 hPe(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,moe(n.key),n)}}function OI(i,e,t){return e&&hPe(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function To(i,e,t){return(e=moe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function pV(){return pV=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,t){var n=_Pe(i,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?i:t):r.value}},pV.apply(null,arguments)}function xx(i){return xx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},xx(i)}function UI(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&&AV(i,e)}function _V(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_V=function(){return!!i})()}function fPe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function dPe(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 pPe(){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 mPe(){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 roe(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?roe(Object(t),!0).forEach(function(n){To(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):roe(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function APe(i,e){if(i==null)return{};var t,n,r=gPe(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 gPe(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 vPe(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 lPe(i)}function mV(){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 hc(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]())):(hc(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,hc(A,r,"GeneratorFunction")),A.prototype=Object.create(f),A}return l.prototype=c,hc(f,"constructor",c),hc(c,"constructor",l),l.displayName="GeneratorFunction",hc(c,r,"GeneratorFunction"),hc(f),hc(f,r,"Generator"),hc(f,n,function(){return this}),hc(f,"toString",function(){return"[object Generator]"}),(mV=function(){return{w:s,m:d}})()}function hc(i,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}hc=function(s,o,a,l){function c(u,f){hc(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))},hc(i,e,t,n)}function AV(i,e){return AV=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},AV(i,e)}function Ir(i,e){return oPe(i)||dPe(i,e)||Aoe(i,e)||pPe()}function _Pe(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=xx(i))!==null;);return i}function hV(i,e,t,n){var r=pV(xx(i.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function tr(i){return aPe(i)||fPe(i)||Aoe(i)||mPe()}function xPe(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 moe(i){var e=xPe(i,"string");return typeof e=="symbol"?e:e+""}function Aoe(i,e){if(i){if(typeof i=="string")return dV(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)?dV(i,e):void 0}}var goe=function(e){e instanceof Array?e.forEach(goe):(e.map&&e.map.dispose(),e.dispose())},wm=function(e){e.geometry&&e.geometry.dispose(),e.material&&goe(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(wm)},ts=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),wm(t)}};function el(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 vr=100;function soe(){return vr}function eu(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=vr*(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 voe(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/vr-1}}function r1(i){return i*Math.PI/180}var ES=window.THREE?window.THREE:{BackSide:mi,BufferAttribute:Hi,Color:zt,Mesh:Hn,ShaderMaterial:fs},yPe=`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-}`,yPe=`5119+}`,bPe=`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 bPe(i,e,t,n){return new TS.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:xPe,fragmentShader:yPe,uniforms:{coefficient:{value:i},color:{value:new TS.Color(e)},power:{value:t},hollowRadius:{value:n}}})}function wPe(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 TS.BufferAttribute(n,3)),t}var SPe=(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;BI(this,e),n=FI(this,e);var T=wPe(t,l),R=bPe(u,o,d,y);return S&&(R.side=TS.BackSide),n.geometry=T,n.material=R,n}return UI(e,i),OI(e)})(TS.Mesh),Lf=window.THREE?window.THREE:{Color:zt,Group:Fr,LineBasicMaterial:Mu,LineSegments:Vv,Mesh:Hn,MeshPhongMaterial:zA,SphereGeometry:ka,SRGBColorSpace:Nr,TextureLoader:_l},voe=Zr({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){wm(e.globeObj),wm(e.tileEngine),wm(e.graticulesObj)}},stateInit:function(){var e=new Lf.MeshPhongMaterial({color:0}),t=new Lf.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new ZQ(vr),r=new Lf.Group;r.__globeObjType="globe",r.add(t),r.add(n);var s=new Lf.LineSegments(new BB(aB(),vr,2),new Lf.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1}));return{globeGroup:r,globeObj:t,graticulesObj:s,defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){ts(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 Lf.SphereGeometry(vr,s,s/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?new Lf.TextureLoader().load(e.globeImageUrl,function(a){var l;a.colorSpace=Lf.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 Lf.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&new Lf.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),wm(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var o=e.atmosphereObj=new SPe(e.globeObj.geometry,{color:e.atmosphereColor,size:vr*e.atmosphereAltitude,hollowRadius:vr,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())}}),Df=function(e){return isNaN(e)?parseInt(An(e).toHex(),16):e},Ku=function(e){return e&&isNaN(e)?Nu(e).opacity:1},Sm=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 TPe(i,e,t){return i.opacity=e,i.transparent=e<1,i.depthWrite=e>=1,i}var soe=window.THREE?window.THREE:{BufferAttribute:Hi};function Nf(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 soe.BufferAttribute(new t(i),e);for(var n=new soe.BufferAttribute(new t(i.length*e),e),r=0,s=i.length;r<s;r++)n.set(i[r],r*e);return n}function EPe(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 fV=new WeakMap,RI=new WeakMap,II=new WeakMap,Rl=(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 BI(this,e),n=FI(this,e),To(n,"scene",void 0),cV(n,fV,void 0),cV(n,RI,void 0),cV(n,II,void 0),n.scene=t,uV(fV,n,o),uV(RI,n,l),uV(II,n,u),n.onRemoveObj(function(){}),n}return UI(e,i),OI(e,[{key:"onCreateObj",value:function(n){var r=this;return hV(e,"onCreateObj",this)([function(s){var o=n(s);return s[wS(RI,r)]=o,o[wS(fV,r)]=s,r.scene.add(o),o}]),this}},{key:"onRemoveObj",value:function(n){var r=this;return hV(e,"onRemoveObj",this)([function(s,o){var a=hV(e,"getData",r)([s]);n(s,o);var l=function(){r.scene.remove(s),wm(s),delete a[wS(RI,r)]};wS(II,r)?setTimeout(l,wS(II,r)):l()}]),this}}])})(vJ),$u=window.THREE?window.THREE:{BufferGeometry:Xn,CylinderGeometry:BA,Matrix4:cn,Mesh:Hn,MeshLambertMaterial:za,Object3D:lr,Vector3:re},ooe=Object.assign({},sw),aoe=ooe.BufferGeometryUtils||ooe,_oe=Zr({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;ts(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Rl(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 $u.CylinderGeometry(1,1,1,e.pointResolution);l.applyMatrix4(new $u.Matrix4().makeRotationX(Math.PI/2)),l.applyMatrix4(new $u.Matrix4().makeTranslation(0,0,-.5));var c=2*Math.PI*vr/360,u={};if(!e.pointsMerge&&t.hasOwnProperty("pointsMerge")&&ts(e.scene),e.dataMapper.scene=e.pointsMerge?new $u.Object3D:e.scene,e.dataMapper.onCreateObj(A).onUpdateObj(y).digest(e.pointsData),e.pointsMerge){var f=e.pointsData.length?(aoe.mergeGeometries||aoe.mergeBufferGeometries)(e.pointsData.map(function(w){var S=e.dataMapper.getObj(w),T=S.geometry.clone();S.updateMatrix(),T.applyMatrix4(S.matrix);var R=Sm(a(w));return T.setAttribute("color",Nf(Array(T.getAttribute("position").count).fill(R),4)),T})):new $u.BufferGeometry,d=new $u.Mesh(f,new $u.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0}));d.__globeObjType="points",d.__data=e.pointsData,e.dataMapper.clear(),ts(e.scene),e.scene.add(d)}function A(){var w=new $u.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,eu(G,W));var Y=e.pointsMerge?new $u.Vector3(0,0,0):e.scene.localToWorld(new $u.Vector3(0,0,0));w.lookAt(Y),w.scale.x=w.scale.y=Math.min(30,k)*c,w.scale.z=Math.max(z*vr,.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 co(P).to(R,e.pointsTransitionDuration).easing(Kr.Quadratic.InOut).onUpdate(T).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.pointsMerge){var I=a(S),F=I?Ku(I):0,D=!!F;w.visible=D,D&&(u.hasOwnProperty(I)||(u[I]=new $u.MeshLambertMaterial({color:Df(I),transparent:F<1,opacity:F})),w.material=u[I])}}}}),xoe=function(){return{uniforms:{dashOffset:{value:0},dashSize:{value:1},gapSize:{value:0},dashTranslate:{value:0}},vertexShader:`5142+}`;function wPe(i,e,t,n){return new ES.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:yPe,fragmentShader:bPe,uniforms:{coefficient:{value:i},color:{value:new ES.Color(e)},power:{value:t},hollowRadius:{value:n}}})}function SPe(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 ES.BufferAttribute(n,3)),t}var TPe=(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;BI(this,e),n=FI(this,e);var T=SPe(t,l),R=wPe(u,o,d,y);return S&&(R.side=ES.BackSide),n.geometry=T,n.material=R,n}return UI(e,i),OI(e)})(ES.Mesh),Lf=window.THREE?window.THREE:{Color:zt,Group:Fr,LineBasicMaterial:Cu,LineSegments:Vv,Mesh:Hn,MeshPhongMaterial:zA,SphereGeometry:ka,SRGBColorSpace:Nr,TextureLoader:_l},_oe=Zr({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){wm(e.globeObj),wm(e.tileEngine),wm(e.graticulesObj)}},stateInit:function(){var e=new Lf.MeshPhongMaterial({color:0}),t=new Lf.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new KQ(vr),r=new Lf.Group;r.__globeObjType="globe",r.add(t),r.add(n);var s=new Lf.LineSegments(new BB(aB(),vr,2),new Lf.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1}));return{globeGroup:r,globeObj:t,graticulesObj:s,defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){ts(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 Lf.SphereGeometry(vr,s,s/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?new Lf.TextureLoader().load(e.globeImageUrl,function(a){var l;a.colorSpace=Lf.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 Lf.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&new Lf.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),wm(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var o=e.atmosphereObj=new TPe(e.globeObj.geometry,{color:e.atmosphereColor,size:vr*e.atmosphereAltitude,hollowRadius:vr,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())}}),Df=function(e){return isNaN(e)?parseInt(An(e).toHex(),16):e},Qu=function(e){return e&&isNaN(e)?Fu(e).opacity:1},Sm=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 EPe(i,e,t){return i.opacity=e,i.transparent=e<1,i.depthWrite=e>=1,i}var ooe=window.THREE?window.THREE:{BufferAttribute:Hi};function Nf(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 ooe.BufferAttribute(new t(i),e);for(var n=new ooe.BufferAttribute(new t(i.length*e),e),r=0,s=i.length;r<s;r++)n.set(i[r],r*e);return n}function MPe(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 fV=new WeakMap,RI=new WeakMap,II=new WeakMap,Rl=(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 BI(this,e),n=FI(this,e),To(n,"scene",void 0),cV(n,fV,void 0),cV(n,RI,void 0),cV(n,II,void 0),n.scene=t,uV(fV,n,o),uV(RI,n,l),uV(II,n,u),n.onRemoveObj(function(){}),n}return UI(e,i),OI(e,[{key:"onCreateObj",value:function(n){var r=this;return hV(e,"onCreateObj",this)([function(s){var o=n(s);return s[SS(RI,r)]=o,o[SS(fV,r)]=s,r.scene.add(o),o}]),this}},{key:"onRemoveObj",value:function(n){var r=this;return hV(e,"onRemoveObj",this)([function(s,o){var a=hV(e,"getData",r)([s]);n(s,o);var l=function(){r.scene.remove(s),wm(s),delete a[SS(RI,r)]};SS(II,r)?setTimeout(l,SS(II,r)):l()}]),this}}])})(_J),Yu=window.THREE?window.THREE:{BufferGeometry:Xn,CylinderGeometry:BA,Matrix4:cn,Mesh:Hn,MeshLambertMaterial:za,Object3D:lr,Vector3:re},aoe=Object.assign({},ow),loe=aoe.BufferGeometryUtils||aoe,xoe=Zr({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;ts(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Rl(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 Yu.CylinderGeometry(1,1,1,e.pointResolution);l.applyMatrix4(new Yu.Matrix4().makeRotationX(Math.PI/2)),l.applyMatrix4(new Yu.Matrix4().makeTranslation(0,0,-.5));var c=2*Math.PI*vr/360,u={};if(!e.pointsMerge&&t.hasOwnProperty("pointsMerge")&&ts(e.scene),e.dataMapper.scene=e.pointsMerge?new Yu.Object3D:e.scene,e.dataMapper.onCreateObj(A).onUpdateObj(y).digest(e.pointsData),e.pointsMerge){var f=e.pointsData.length?(loe.mergeGeometries||loe.mergeBufferGeometries)(e.pointsData.map(function(w){var S=e.dataMapper.getObj(w),T=S.geometry.clone();S.updateMatrix(),T.applyMatrix4(S.matrix);var R=Sm(a(w));return T.setAttribute("color",Nf(Array(T.getAttribute("position").count).fill(R),4)),T})):new Yu.BufferGeometry,d=new Yu.Mesh(f,new Yu.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0}));d.__globeObjType="points",d.__data=e.pointsData,e.dataMapper.clear(),ts(e.scene),e.scene.add(d)}function A(){var w=new Yu.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,eu(G,W));var Y=e.pointsMerge?new Yu.Vector3(0,0,0):e.scene.localToWorld(new Yu.Vector3(0,0,0));w.lookAt(Y),w.scale.x=w.scale.y=Math.min(30,k)*c,w.scale.z=Math.max(z*vr,.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 co(P).to(R,e.pointsTransitionDuration).easing(Kr.Quadratic.InOut).onUpdate(T).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.pointsMerge){var I=a(S),F=I?Qu(I):0,D=!!F;w.visible=D,D&&(u.hasOwnProperty(I)||(u[I]=new Yu.MeshLambertMaterial({color:Df(I),transparent:F<1,opacity:F})),w.material=u[I])}}}}),yoe=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},MPe=function(e){return e.vertexShader=`5190+`)),e},CPe=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},xV=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},CPe=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)}}},RPe=["stroke"],Yu=window.THREE?window.THREE:{BufferGeometry:Xn,CubicBezierCurve3:Wv,Curve:Ua,Group:Fr,Line:t0,Mesh:Hn,NormalBlending:Ts,ShaderMaterial:fs,TubeGeometry:I2,Vector3:re},IPe=s1.default.default||s1.default,yoe=Zr({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 IPe,sharedMaterial:new Yu.ShaderMaterial($i($i({},xoe()),{},{transparent:!0,blending:Yu.NormalBlending}))}},init:function(e,t){ts(e),t.scene=e,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new Yu.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(P,I){var F=u(I),D=F!=null;if(!P.children.length||D!==(P.children[0].type==="Mesh")){ts(P);var L=D?new Yu.Mesh:new Yu.Line(new Yu.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=mPe(J,RPe),he=S(ce);D?(C.geometry&&C.geometry.dispose(),C.geometry=new Yu.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 co(Y).to(W,e.arcsTransitionDuration).easing(Kr.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=Ir(Ee,3),Ye=Ve[0],Mt=Ve[1],Et=Ve[2],It=eu(Mt,Ye,Et),dn=It.x,Gt=It.y,$e=It.z;return new Yu.Vector3(dn,Gt,$e)},W=[L,D],Y=[k,B],H=I;if(H==null&&(H=Sl(W,Y)/2*F+Math.max(C,z)),H||C||z){var $=Ag(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],ge=ce[1],Re=vV(Yu.CubicBezierCurve3,tr([[].concat(W,[C]),he,ge,[].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 Yu.Vector3().addVectors(mt.clone().multiplyScalar(Math.sin((1-Et)*Ve)),Ee.clone().multiplyScalar(Math.sin(Et*Ve))).divideScalar(Math.sin(Ve))},Mt=new Yu.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?bl().domain(P.map(function(H,$){return $/(P.length-1)})).range(P):P;L=function($){return Sm(C($),!0,!0)}}else{var B=Sm(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 Nf(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(),Nf(L,1)}}}),ym=window.THREE?window.THREE:{BufferGeometry:Xn,DoubleSide:gr,Mesh:Hn,MeshLambertMaterial:za,Object3D:lr},loe=Object.assign({},sw),coe=loe.BufferGeometryUtils||loe,boe=Zr({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;ts(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Rl(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=kJ(e.hexBinPointsData.map(function(R){return $i($i({},R),{},{h3Idx:QJ(n(R),r(R),e.hexBinResolution)})}),"h3Idx"),f=Object.entries(u).map(function(R){var P=Ir(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")&&ts(e.scene),e.dataMapper.scene=e.hexBinMerge?new ym.Object3D:e.scene,e.dataMapper.id(function(R){return R.h3Idx}).onCreateObj(S).onUpdateObj(T).digest(f),e.hexBinMerge){var A=f.length?(coe.mergeGeometries||coe.mergeBufferGeometries)(f.map(function(R){var P=e.dataMapper.getObj(R),I=P.geometry.toNonIndexed();P.updateMatrix(),I.applyMatrix4(P.matrix);var F=Sm(a(R)),D=Sm(l(R)),L=I.getAttribute("position").count,C=I.groups[0].count;return I.setAttribute("color",Nf(tr(new Array(L)).map(function(B,k){return k>=C?F:D}),4)),I})):new ym.BufferGeometry,y=new ym.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:ym.DoubleSide});y.onBeforeCompile=function(R){y.userData.shader=gV(R)};var w=new ym.Mesh(A,y);w.__globeObjType="hexBinPoints",w.__data=f,e.dataMapper.clear(),ts(e.scene),e.scene.add(w)}function S(R){var P=new ym.Mesh;P.__hexCenter=rO(R.h3Idx),P.__hexGeoJson=sO(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=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 ge=Ir(he,2),Re=ge[0],Qe=ge[1];return I(Re,Qe,F)})}),k=e.hexTopCurvatureResolution;R.geometry&&R.geometry.dispose(),R.geometry=new HC([B],0,vr,!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=vr/(ce+1);R.geometry.setAttribute("surfaceRadius",Nf(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 co(W).to(z,e.hexTransitionDuration).easing(Kr.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=Ku($);d[$]=xV(new ym.MeshLambertMaterial({color:Df($),transparent:J<1,opacity:J,side:ym.DoubleSide}),gV)}}),R.material=[Y,H].map(function($){return d[$]})}}}}),woe=function(e){return e*e},Kd=function(e){return e*Math.PI/180};function PPe(i,e){var t=Math.sqrt,n=Math.cos,r=function(u){return woe(Math.sin(u/2))},s=Kd(i[1]),o=Kd(e[1]),a=Kd(i[0]),l=Kd(e[0]);return 2*Math.asin(t(r(o-s)+n(s)*n(o)*r(l-a)))}var LPe=Math.sqrt(2*Math.PI);function DPe(i,e){return Math.exp(-woe(i/e)/2)/(e*LPe)}var NPe=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 zM(s.map(function(S){var T=d(S);if(!T)return 0;var R=PPe(y,[l(S),u(S)]);return DPe(R,w)*T}))},FPe=(function(){var i=lPe(mV().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,ge,Re,Qe,Fe,mt,Ee,Ve=arguments,Ye,Mt,Et;return mV().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 NPe(dn,r,{lngAccessor:a,latAccessor:c,weightAccessor:f,bandwidth:d})}));case 1:return A=4,y=Use,w=kse,S=Zse,T=Yse,R=Hse,P=Wse,I=zse,F=$se,D=Xse,L=Gse,C=Vse,B=qse,k=jse,z=T(new Yg(new Float32Array(t.flat().map(Kd)),2),"vec2",t.length),G=T(new Yg(new Float32Array(r.map(function(dn){return[Kd(a(dn)),Kd(c(dn)),f(dn)]}).flat()),3),"vec3",r.length),W=new Yg(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($))},ge=S(Kd(d)),Re=S(Kd(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,ge).mul(bt))})})})}),mt=Fe().compute(t.length),Ee=new lx,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)}})(),PI=window.THREE?window.THREE:{Mesh:Hn,MeshLambertMaterial:za,SphereGeometry:ka},BPe=3.5,OPe=.1,uoe=100,UPe=function(e){var t=Nu(aO(e));return t.opacity=Math.cbrt(e),t.formatRgb()},Soe=Zr({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 UPe}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ts(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var s=new PI.Mesh(new PI.SphereGeometry(vr),xV(new PI.MeshLambertMaterial({vertexColors:!0,transparent:!0}),MPe));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=eu(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(OPe,A/BPe),I=Math.ceil(360/(P||-1));f.geometry.parameters.widthSegments!==I&&(f.geometry.dispose(),f.geometry=new PI.SphereGeometry(vr,I,I/2));var F=EPe(f.geometry.getAttribute("position")),D=F.map(function(L){var C=Ir(L,3),B=C[0],k=C[1],z=C[2],G=goe({x:B,y:k,z}),W=G.lng,Y=G.lat;return[W,Y]});FPe(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(uoe)).map(function(G,W){return Sm(y(W/(uoe-1)))}),B=function(W){var Y=f.__currentTargetD=W,H=Y.kdeVals,$=Y.topAlt,J=Y.saturation,te=UM(H.map(Math.abs))||1e-15,ce=Bb([0,te/J],C);f.geometry.setAttribute("color",Nf(H.map(function(ge){return ce(Math.abs(ge))}),4));var he=bl([0,te],[vr*(1+S),vr*(1+($||S))]);f.geometry.setAttribute("r",Nf(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 co(z).to(k,e.heatmapsTransitionDuration).easing(Kr.Quadratic.InOut).onUpdate(B).onComplete(function(){e.tweenGroup.remove(this)}).start()))})}).digest(e.heatmapsData)}}),bm=window.THREE?window.THREE:{DoubleSide:gr,Group:Fr,LineBasicMaterial:Mu,LineSegments:Vv,Mesh:Hn,MeshBasicMaterial:hs},Toe=Zr({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;ts(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjPolygon"}).id(function(s){return s.id}).onCreateObj(function(){var s=new bm.Group;return s.__defaultSideMaterial=xV(new bm.MeshBasicMaterial({side:bm.DoubleSide,depthWrite:!0}),gV),s.__defaultCapMaterial=new bm.MeshBasicMaterial({side:bm.DoubleSide,depthWrite:!0}),s.add(new bm.Mesh(void 0,[s.__defaultSideMaterial,s.__defaultCapMaterial])),s.add(new bm.LineSegments(void 0,new bm.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=Ir(f.children,2),D=F[0],L=F[1],C=!!R;L.visible=C;var B=!!(y||w),k=!!(S||T);kPe(D.geometry.parameters||{},{polygonGeoJson:A,curvatureResolution:I,closedTop:B,includeSides:k})||(D.geometry&&D.geometry.dispose(),D.geometry=new HC(A,0,vr,!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 BB({type:"Polygon",coordinates:A},vr,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=Ir(te,2),he=ce[0],ge=ce[1];if(!(!he||ge<0)){var Re=D.material[ge],Qe=Ku(he);Re.color.set(Df(he)),Re.transparent=Qe<1,Re.opacity=Qe}}),C){var W=L.material,Y=Ku(R);W.color.set(Df(R)),W.transparent=Y<1,W.opacity=Y}var H={alt:P},$=function(ce){var he=f.__currentTargetD=ce,ge=he.alt;D.scale.x=D.scale.y=D.scale.z=1+ge,C&&(L.scale.x=L.scale.y=L.scale.z=1+ge+1e-4),CPe(f.__defaultSideMaterial,function(Re){return Re.uSurfaceRadius.value=vr/(ge+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 co(J).to(H,e.polygonsTransitionDuration).easing(Kr.Quadratic.InOut).onUpdate($).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(u)}});function kPe(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 gx=window.THREE?window.THREE:{BufferGeometry:Xn,DoubleSide:gr,Mesh:Hn,MeshLambertMaterial:za,Vector3:re},hoe=Object.assign({},sw),foe=hoe.BufferGeometryUtils||hoe,Eoe=Zr({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;ts(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var s=new gx.Mesh(void 0,new gx.MeshLambertMaterial({side:gx.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=Ku(P);u.material.color.set(Df(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"?oO(d.coordinates,A,!0).forEach(function(G){return B.push(G)}):d.type==="MultiPolygon"?d.coordinates.forEach(function(G){return oO(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=rO(G),Y=sO(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?(foe.mergeGeometries||foe.mergeBufferGeometries)(k.map(function(te){var ce=Ir(te.hexCenter,2),he=ce[0],ge=ce[1];if(S){var Re=eu(he,ge,H),Qe=eu(te.hexGeoJson[0][1],te.hexGeoJson[0][0],H),Fe=.85*(1-$)*new gx.Vector3(Re.x,Re.y,Re.z).distanceTo(new gx.Vector3(Qe.x,Qe.y,Qe.z)),mt=new qv(Fe,R);return mt.rotateX(r1(-he)),mt.rotateY(r1(ge)),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=Ir(Ye,2),Et=Mt[0],It=Mt[1];return[[Et,ge],[It,he]].map(function(dn){var Gt=Ir(dn,2),$e=Gt[0],ot=Gt[1];return Ee($e,ot,$)})});return new HC([Ve],vr,vr*(1+H),!1,!0,!1,J)}})):new gx.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?z(F):e.tweenGroup.add(new co(L).to(F,e.hexPolygonsTransitionDuration).easing(Kr.Quadratic.InOut).onUpdate(z).onComplete(function(){e.tweenGroup.remove(this)}).start())}}).digest(e.hexPolygonsData)}}),zPe=window.THREE?window.THREE:{Vector3:re};function VPe(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=bF.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 zPe.Vector3(l,c,u)})}}var i1=window.THREE?window.THREE:{BufferGeometry:Xn,Color:zt,Group:Fr,Line:t0,NormalBlending:Ts,ShaderMaterial:fs,Vector3:re},GPe=s1.default.default||s1.default,Moe=Zr({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 GPe,sharedMaterial:new i1.ShaderMaterial($i($i({},xoe()),{},{transparent:!0,blending:i1.NormalBlending}))}},init:function(e,t){ts(e),t.scene=e,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var n=new i1.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),P=R!=null;if(!S.children.length||P===(S.children[0].type==="Line")){ts(S);var I=P?new mx(new xm,new Cf):new i1.Line(new i1.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,$=Ku(H);F.material.color=new i1.Color(Df(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=VPe(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(ge){return he[ge]!==ce[ge]})&&(!e.pathTransitionDuration||e.pathTransitionDuration<0?te(ce):e.tweenGroup.add(new co(he).to(ce,e.pathTransitionDuration).easing(Kr.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=Ir(B,3),z=k[0],G=k[1],W=k[2],Y=eu(z,G,W),H=Y.x,$=Y.y,J=Y.z;return new i1.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?bl().domain(S.map(function(W,Y){return Y/(S.length-1)})).range(S):S;F=function(Y){return Sm(D(Y),P,!0)}}else{var L=Sm(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 Nf(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(),Nf(I,1)}}}),LI=window.THREE?window.THREE:{Euler:Ba,Mesh:Hn,MeshLambertMaterial:za,SphereGeometry:ka},Coe=Zr({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 LI.MeshLambertMaterial({color:"#ffbb88",opacity:.4,transparent:!0})}},tileCurvatureResolution:{default:5},tilesTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ts(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjTile"}).onCreateObj(function(){var s=new LI.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=vx(F),k=vx(-I);u.geometry&&u.geometry.dispose(),u.geometry=new LI.SphereGeometry(vr*(1+D),Math.ceil(L/(A||-1)),Math.ceil(C/(A||-1)),vx(90-L/2)+(d?B:0),vx(L),vx(90-C/2)+(d?k:0),vx(C)),d||u.setRotationFromEuler(new LI.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 co(S).to(w,e.tilesTransitionDuration).easing(Kr.Quadratic.InOut).onUpdate(y).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.tilesData)}}),vx=function(e){return e*Math.PI/180},SS=window.THREE?window.THREE:{BufferGeometry:Xn,Color:zt,Points:v2,PointsMaterial:n0},Roe=Zr({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){ts(e),t.scene=e,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjParticles"}).onCreateObj(function(){var n=new SS.Points(new SS.BufferGeometry,new SS.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",Nf(s(r).map(function(c){return Object.values(eu(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 SS.Color(16777215),u.material.transparent=!1,u.material.alphaTest=.5,u.material.map=o(c);else{var f=n(c),d=Ku(f);u.material.color=new SS.Color(Df(f)),u.material.transparent=d<1,u.material.opacity=d,u.material.alphaTest=0}})}}),qPe=window.THREE?window.THREE:{BufferGeometry:Xn},HPe=(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;BI(this,e),t=FI(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 UI(e,i),OI(e)})(qPe.BufferGeometry),_x=window.THREE?window.THREE:{Color:zt,Group:Fr,Line:t0,LineBasicMaterial:Mu,Vector3:re},WPe=s1.default.default||s1.default,Ioe=Zr({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;ts(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var s=new _x.Group;return s.__globeObjType="ring",s}),t.ticker=new WPe,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 _x.Line(new HPe(1,t.ringResolution),new _x.LineBasicMaterial),T=o(A),R=T instanceof Array||T instanceof Function,P;R?T instanceof Array?(P=bl().domain(T.map(function(z,G){return G/(T.length-1)})).range(T),S.material.transparent=T.some(function(z){return Ku(z)<1})):(P=T,S.material.transparent=!0):(S.material.color=new _x.Color(Df(T)),TPe(S.material,Ku(T)));var I=vr*(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 _x.Color(Df(H)),S.material.transparent&&(S.material.opacity=Ku(H))}};if(L===0)B({t:0}),y.add(S);else{var k=Math.abs(F/L)*1e3;t.tweenGroup.add(new co({t:0}).to({t:1},k).onUpdate(B).onStart(function(){return y.add(S)}).onComplete(function(){t.tweenGroup.remove(this),y.remove(S),wm(S)}).start())}}})}})},update:function(e){var t=st(e.ringLat),n=st(e.ringLng),r=st(e.ringAltitude),s=e.scene.localToWorld(new _x.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(o,a){var l=t(a),c=n(a),u=r(a);Object.assign(o.position,eu(l,c,u)),o.lookAt(s)}).digest(e.ringsData)}}),jPe={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 "}},XPe="normal",$Pe=1189,YPe=-100,ZPe="normal",KPe={yMin:-334,xMin:-111,yMax:1189,xMax:1672},QPe=1e3,JPe={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},xV=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},RPe=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)}}},IPe=["stroke"],Zu=window.THREE?window.THREE:{BufferGeometry:Xn,CubicBezierCurve3:Wv,Curve:Ua,Group:Fr,Line:t0,Mesh:Hn,NormalBlending:Ts,ShaderMaterial:fs,TubeGeometry:P2,Vector3:re},PPe=s1.default.default||s1.default,boe=Zr({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 PPe,sharedMaterial:new Zu.ShaderMaterial($i($i({},yoe()),{},{transparent:!0,blending:Zu.NormalBlending}))}},init:function(e,t){ts(e),t.scene=e,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new Zu.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(P,I){var F=u(I),D=F!=null;if(!P.children.length||D!==(P.children[0].type==="Mesh")){ts(P);var L=D?new Zu.Mesh:new Zu.Line(new Zu.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=APe(J,IPe),he=S(ce);D?(C.geometry&&C.geometry.dispose(),C.geometry=new Zu.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 co(Y).to(W,e.arcsTransitionDuration).easing(Kr.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=Ir(Ee,3),Ye=Ve[0],Mt=Ve[1],Et=Ve[2],It=eu(Mt,Ye,Et),dn=It.x,Gt=It.y,$e=It.z;return new Zu.Vector3(dn,Gt,$e)},W=[L,D],Y=[k,B],H=I;if(H==null&&(H=Sl(W,Y)/2*F+Math.max(C,z)),H||C||z){var $=Ag(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],ge=ce[1],Re=vV(Zu.CubicBezierCurve3,tr([[].concat(W,[C]),he,ge,[].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 Zu.Vector3().addVectors(mt.clone().multiplyScalar(Math.sin((1-Et)*Ve)),Ee.clone().multiplyScalar(Math.sin(Et*Ve))).divideScalar(Math.sin(Ve))},Mt=new Zu.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?bl().domain(P.map(function(H,$){return $/(P.length-1)})).range(P):P;L=function($){return Sm(C($),!0,!0)}}else{var B=Sm(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 Nf(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(),Nf(L,1)}}}),ym=window.THREE?window.THREE:{BufferGeometry:Xn,DoubleSide:gr,Mesh:Hn,MeshLambertMaterial:za,Object3D:lr},coe=Object.assign({},ow),uoe=coe.BufferGeometryUtils||coe,woe=Zr({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;ts(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Rl(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=zJ(e.hexBinPointsData.map(function(R){return $i($i({},R),{},{h3Idx:JJ(n(R),r(R),e.hexBinResolution)})}),"h3Idx"),f=Object.entries(u).map(function(R){var P=Ir(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")&&ts(e.scene),e.dataMapper.scene=e.hexBinMerge?new ym.Object3D:e.scene,e.dataMapper.id(function(R){return R.h3Idx}).onCreateObj(S).onUpdateObj(T).digest(f),e.hexBinMerge){var A=f.length?(uoe.mergeGeometries||uoe.mergeBufferGeometries)(f.map(function(R){var P=e.dataMapper.getObj(R),I=P.geometry.toNonIndexed();P.updateMatrix(),I.applyMatrix4(P.matrix);var F=Sm(a(R)),D=Sm(l(R)),L=I.getAttribute("position").count,C=I.groups[0].count;return I.setAttribute("color",Nf(tr(new Array(L)).map(function(B,k){return k>=C?F:D}),4)),I})):new ym.BufferGeometry,y=new ym.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:ym.DoubleSide});y.onBeforeCompile=function(R){y.userData.shader=gV(R)};var w=new ym.Mesh(A,y);w.__globeObjType="hexBinPoints",w.__data=f,e.dataMapper.clear(),ts(e.scene),e.scene.add(w)}function S(R){var P=new ym.Mesh;P.__hexCenter=rO(R.h3Idx),P.__hexGeoJson=sO(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=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 ge=Ir(he,2),Re=ge[0],Qe=ge[1];return I(Re,Qe,F)})}),k=e.hexTopCurvatureResolution;R.geometry&&R.geometry.dispose(),R.geometry=new HC([B],0,vr,!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=vr/(ce+1);R.geometry.setAttribute("surfaceRadius",Nf(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 co(W).to(z,e.hexTransitionDuration).easing(Kr.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=Qu($);d[$]=xV(new ym.MeshLambertMaterial({color:Df($),transparent:J<1,opacity:J,side:ym.DoubleSide}),gV)}}),R.material=[Y,H].map(function($){return d[$]})}}}}),Soe=function(e){return e*e},Kd=function(e){return e*Math.PI/180};function LPe(i,e){var t=Math.sqrt,n=Math.cos,r=function(u){return Soe(Math.sin(u/2))},s=Kd(i[1]),o=Kd(e[1]),a=Kd(i[0]),l=Kd(e[0]);return 2*Math.asin(t(r(o-s)+n(s)*n(o)*r(l-a)))}var DPe=Math.sqrt(2*Math.PI);function NPe(i,e){return Math.exp(-Soe(i/e)/2)/(e*DPe)}var FPe=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 zM(s.map(function(S){var T=d(S);if(!T)return 0;var R=LPe(y,[l(S),u(S)]);return NPe(R,w)*T}))},BPe=(function(){var i=cPe(mV().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,ge,Re,Qe,Fe,mt,Ee,Ve=arguments,Ye,Mt,Et;return mV().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 FPe(dn,r,{lngAccessor:a,latAccessor:c,weightAccessor:f,bandwidth:d})}));case 1:return A=4,y=kse,w=zse,S=Kse,T=Zse,R=Wse,P=jse,I=Vse,F=Yse,D=$se,L=qse,C=Gse,B=Hse,k=Xse,z=T(new Yg(new Float32Array(t.flat().map(Kd)),2),"vec2",t.length),G=T(new Yg(new Float32Array(r.map(function(dn){return[Kd(a(dn)),Kd(c(dn)),f(dn)]}).flat()),3),"vec3",r.length),W=new Yg(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($))},ge=S(Kd(d)),Re=S(Kd(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,ge).mul(bt))})})})}),mt=Fe().compute(t.length),Ee=new lx,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)}})(),PI=window.THREE?window.THREE:{Mesh:Hn,MeshLambertMaterial:za,SphereGeometry:ka},OPe=3.5,UPe=.1,hoe=100,kPe=function(e){var t=Fu(aO(e));return t.opacity=Math.cbrt(e),t.formatRgb()},Toe=Zr({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 kPe}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ts(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var s=new PI.Mesh(new PI.SphereGeometry(vr),xV(new PI.MeshLambertMaterial({vertexColors:!0,transparent:!0}),CPe));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=eu(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(UPe,A/OPe),I=Math.ceil(360/(P||-1));f.geometry.parameters.widthSegments!==I&&(f.geometry.dispose(),f.geometry=new PI.SphereGeometry(vr,I,I/2));var F=MPe(f.geometry.getAttribute("position")),D=F.map(function(L){var C=Ir(L,3),B=C[0],k=C[1],z=C[2],G=voe({x:B,y:k,z}),W=G.lng,Y=G.lat;return[W,Y]});BPe(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(hoe)).map(function(G,W){return Sm(y(W/(hoe-1)))}),B=function(W){var Y=f.__currentTargetD=W,H=Y.kdeVals,$=Y.topAlt,J=Y.saturation,te=UM(H.map(Math.abs))||1e-15,ce=Ob([0,te/J],C);f.geometry.setAttribute("color",Nf(H.map(function(ge){return ce(Math.abs(ge))}),4));var he=bl([0,te],[vr*(1+S),vr*(1+($||S))]);f.geometry.setAttribute("r",Nf(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 co(z).to(k,e.heatmapsTransitionDuration).easing(Kr.Quadratic.InOut).onUpdate(B).onComplete(function(){e.tweenGroup.remove(this)}).start()))})}).digest(e.heatmapsData)}}),bm=window.THREE?window.THREE:{DoubleSide:gr,Group:Fr,LineBasicMaterial:Cu,LineSegments:Vv,Mesh:Hn,MeshBasicMaterial:hs},Eoe=Zr({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;ts(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjPolygon"}).id(function(s){return s.id}).onCreateObj(function(){var s=new bm.Group;return s.__defaultSideMaterial=xV(new bm.MeshBasicMaterial({side:bm.DoubleSide,depthWrite:!0}),gV),s.__defaultCapMaterial=new bm.MeshBasicMaterial({side:bm.DoubleSide,depthWrite:!0}),s.add(new bm.Mesh(void 0,[s.__defaultSideMaterial,s.__defaultCapMaterial])),s.add(new bm.LineSegments(void 0,new bm.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=Ir(f.children,2),D=F[0],L=F[1],C=!!R;L.visible=C;var B=!!(y||w),k=!!(S||T);zPe(D.geometry.parameters||{},{polygonGeoJson:A,curvatureResolution:I,closedTop:B,includeSides:k})||(D.geometry&&D.geometry.dispose(),D.geometry=new HC(A,0,vr,!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 BB({type:"Polygon",coordinates:A},vr,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=Ir(te,2),he=ce[0],ge=ce[1];if(!(!he||ge<0)){var Re=D.material[ge],Qe=Qu(he);Re.color.set(Df(he)),Re.transparent=Qe<1,Re.opacity=Qe}}),C){var W=L.material,Y=Qu(R);W.color.set(Df(R)),W.transparent=Y<1,W.opacity=Y}var H={alt:P},$=function(ce){var he=f.__currentTargetD=ce,ge=he.alt;D.scale.x=D.scale.y=D.scale.z=1+ge,C&&(L.scale.x=L.scale.y=L.scale.z=1+ge+1e-4),RPe(f.__defaultSideMaterial,function(Re){return Re.uSurfaceRadius.value=vr/(ge+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 co(J).to(H,e.polygonsTransitionDuration).easing(Kr.Quadratic.InOut).onUpdate($).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(u)}});function zPe(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 gx=window.THREE?window.THREE:{BufferGeometry:Xn,DoubleSide:gr,Mesh:Hn,MeshLambertMaterial:za,Vector3:re},foe=Object.assign({},ow),doe=foe.BufferGeometryUtils||foe,Moe=Zr({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;ts(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var s=new gx.Mesh(void 0,new gx.MeshLambertMaterial({side:gx.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=Qu(P);u.material.color.set(Df(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"?oO(d.coordinates,A,!0).forEach(function(G){return B.push(G)}):d.type==="MultiPolygon"?d.coordinates.forEach(function(G){return oO(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=rO(G),Y=sO(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?(doe.mergeGeometries||doe.mergeBufferGeometries)(k.map(function(te){var ce=Ir(te.hexCenter,2),he=ce[0],ge=ce[1];if(S){var Re=eu(he,ge,H),Qe=eu(te.hexGeoJson[0][1],te.hexGeoJson[0][0],H),Fe=.85*(1-$)*new gx.Vector3(Re.x,Re.y,Re.z).distanceTo(new gx.Vector3(Qe.x,Qe.y,Qe.z)),mt=new qv(Fe,R);return mt.rotateX(r1(-he)),mt.rotateY(r1(ge)),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=Ir(Ye,2),Et=Mt[0],It=Mt[1];return[[Et,ge],[It,he]].map(function(dn){var Gt=Ir(dn,2),$e=Gt[0],ot=Gt[1];return Ee($e,ot,$)})});return new HC([Ve],vr,vr*(1+H),!1,!0,!1,J)}})):new gx.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?z(F):e.tweenGroup.add(new co(L).to(F,e.hexPolygonsTransitionDuration).easing(Kr.Quadratic.InOut).onUpdate(z).onComplete(function(){e.tweenGroup.remove(this)}).start())}}).digest(e.hexPolygonsData)}}),VPe=window.THREE?window.THREE:{Vector3:re};function GPe(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=bF.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 VPe.Vector3(l,c,u)})}}var i1=window.THREE?window.THREE:{BufferGeometry:Xn,Color:zt,Group:Fr,Line:t0,NormalBlending:Ts,ShaderMaterial:fs,Vector3:re},qPe=s1.default.default||s1.default,Coe=Zr({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 qPe,sharedMaterial:new i1.ShaderMaterial($i($i({},yoe()),{},{transparent:!0,blending:i1.NormalBlending}))}},init:function(e,t){ts(e),t.scene=e,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var n=new i1.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),P=R!=null;if(!S.children.length||P===(S.children[0].type==="Line")){ts(S);var I=P?new mx(new xm,new Cf):new i1.Line(new i1.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,$=Qu(H);F.material.color=new i1.Color(Df(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=GPe(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(ge){return he[ge]!==ce[ge]})&&(!e.pathTransitionDuration||e.pathTransitionDuration<0?te(ce):e.tweenGroup.add(new co(he).to(ce,e.pathTransitionDuration).easing(Kr.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=Ir(B,3),z=k[0],G=k[1],W=k[2],Y=eu(z,G,W),H=Y.x,$=Y.y,J=Y.z;return new i1.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?bl().domain(S.map(function(W,Y){return Y/(S.length-1)})).range(S):S;F=function(Y){return Sm(D(Y),P,!0)}}else{var L=Sm(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 Nf(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(),Nf(I,1)}}}),LI=window.THREE?window.THREE:{Euler:Ba,Mesh:Hn,MeshLambertMaterial:za,SphereGeometry:ka},Roe=Zr({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 LI.MeshLambertMaterial({color:"#ffbb88",opacity:.4,transparent:!0})}},tileCurvatureResolution:{default:5},tilesTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ts(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjTile"}).onCreateObj(function(){var s=new LI.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=vx(F),k=vx(-I);u.geometry&&u.geometry.dispose(),u.geometry=new LI.SphereGeometry(vr*(1+D),Math.ceil(L/(A||-1)),Math.ceil(C/(A||-1)),vx(90-L/2)+(d?B:0),vx(L),vx(90-C/2)+(d?k:0),vx(C)),d||u.setRotationFromEuler(new LI.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 co(S).to(w,e.tilesTransitionDuration).easing(Kr.Quadratic.InOut).onUpdate(y).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.tilesData)}}),vx=function(e){return e*Math.PI/180},TS=window.THREE?window.THREE:{BufferGeometry:Xn,Color:zt,Points:_2,PointsMaterial:n0},Ioe=Zr({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){ts(e),t.scene=e,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjParticles"}).onCreateObj(function(){var n=new TS.Points(new TS.BufferGeometry,new TS.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",Nf(s(r).map(function(c){return Object.values(eu(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 TS.Color(16777215),u.material.transparent=!1,u.material.alphaTest=.5,u.material.map=o(c);else{var f=n(c),d=Qu(f);u.material.color=new TS.Color(Df(f)),u.material.transparent=d<1,u.material.opacity=d,u.material.alphaTest=0}})}}),HPe=window.THREE?window.THREE:{BufferGeometry:Xn},WPe=(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;BI(this,e),t=FI(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 UI(e,i),OI(e)})(HPe.BufferGeometry),_x=window.THREE?window.THREE:{Color:zt,Group:Fr,Line:t0,LineBasicMaterial:Cu,Vector3:re},jPe=s1.default.default||s1.default,Poe=Zr({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;ts(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var s=new _x.Group;return s.__globeObjType="ring",s}),t.ticker=new jPe,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 _x.Line(new WPe(1,t.ringResolution),new _x.LineBasicMaterial),T=o(A),R=T instanceof Array||T instanceof Function,P;R?T instanceof Array?(P=bl().domain(T.map(function(z,G){return G/(T.length-1)})).range(T),S.material.transparent=T.some(function(z){return Qu(z)<1})):(P=T,S.material.transparent=!0):(S.material.color=new _x.Color(Df(T)),EPe(S.material,Qu(T)));var I=vr*(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 _x.Color(Df(H)),S.material.transparent&&(S.material.opacity=Qu(H))}};if(L===0)B({t:0}),y.add(S);else{var k=Math.abs(F/L)*1e3;t.tweenGroup.add(new co({t:0}).to({t:1},k).onUpdate(B).onStart(function(){return y.add(S)}).onComplete(function(){t.tweenGroup.remove(this),y.remove(S),wm(S)}).start())}}})}})},update:function(e){var t=st(e.ringLat),n=st(e.ringLng),r=st(e.ringAltitude),s=e.scene.localToWorld(new _x.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(o,a){var l=t(a),c=n(a),u=r(a);Object.assign(o.position,eu(l,c,u)),o.lookAt(s)}).digest(e.ringsData)}}),XPe={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 "}},$Pe="normal",YPe=1189,ZPe=-100,KPe="normal",QPe={yMin:-334,xMin:-111,yMax:1189,xMax:1672},JPe=1e3,eLe={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"},eLe=-334,tLe="Helvetiker",nLe=1522,iLe=50,rLe={glyphs:jPe,cssFontWeight:XPe,ascender:$Pe,underlinePosition:YPe,cssFontStyle:ZPe,boundingBox:KPe,resolution:QPe,original_font_information:JPe,descender:eLe,familyName:tLe,lineHeight:nLe,underlineThickness:iLe},Zu=$i($i({},window.THREE?window.THREE:{BoxGeometry:Cu,CircleGeometry:qv,DoubleSide:gr,Group:Fr,Mesh:Hn,MeshLambertMaterial:za,TextGeometry:bS,Vector3:re}),{},{Font:Ax,TextGeometry:bS}),Poe=Zr({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:rLe,onChange:function(e,t){t.font=new Zu.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;ts(e),t.scene=e,t.tweenGroup=r;var s=new Zu.CircleGeometry(1,32);t.dataMapper=new Rl(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var o=new Zu.MeshLambertMaterial;o.side=gr;var a=new Zu.Group;a.add(new Zu.Mesh(s,o));var l=new Zu.Mesh(void 0,o);a.add(l);var c=new Zu.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*vr/360;e.dataMapper.onUpdateObj(function(y,w){var S=Ir(y.children,2),T=S[0],R=S[1],P=Ir(R.children,1),I=P[0],F=l(w),D=Ku(F);R.material.color.set(Df(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 Zu.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=vV(Zu.BoxGeometry,tr(new Zu.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,ge=J.rot,Re=J.scale;Object.assign(y.position,eu(te,ce,he)),y.lookAt(e.scene.localToWorld(new Zu.Vector3(0,0,0))),y.rotateY(Math.PI),y.rotateZ(-ge*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 co(Y).to(W,e.labelsTransitionDuration).easing(Kr.Quadratic.InOut).onUpdate(G).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.labelsData)}}),sLe=$i($i({},window.THREE?window.THREE:{}),{},{CSS2DObject:PM}),Loe=Zr({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;ts(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjHtml"}).onCreateObj(function(s){var o=st(t.htmlElement)(s),a=new sLe.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,eu(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 co(a.__currentTargetD).to(u,e.htmlTransitionDuration).easing(Kr.Quadratic.InOut).onUpdate(c).onComplete(function(){e.tweenGroup.remove(this)}).start())}).digest(e.htmlElementsData)}}),DI=window.THREE?window.THREE:{Group:Fr,Mesh:Hn,MeshLambertMaterial:za,SphereGeometry:ka},Doe=Zr({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new DI.Mesh(new DI.SphereGeometry(1,16,8),new DI.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){ts(e),t.scene=e,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjObject"}).onCreateObj(function(n){var r=st(t.objectThreeObject)(n);t.objectThreeObject===r&&(r=r.clone());var s=new DI.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,eu(u,f,d)),o(c)?l.setRotationFromEuler(new Ba(r1(-u),r1(f),0,"YXZ")):l.rotation.set(0,0,0);var A=l.children[0],y=a(c);y&&A.setRotationFromEuler(new Ba(r1(y.x||0),r1(y.y||0),r1(y.z||0)))}).digest(e.objectsData)}}),Noe=Zr({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){ts(e),t.scene=e,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(n){var r=st(t.customThreeObject)(n,vr);return r&&(t.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r})},update:function(e,t){e.customThreeObjectUpdate||ts(e.scene);var n=st(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(r,s){return n(r,s,vr)}).digest(e.customLayerData)}}),NI=window.THREE?window.THREE:{Camera:Ed,Group:Fr,Vector2:Oe,Vector3:re},oLe=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],Foe=el("globeLayer",voe),aLe=Object.assign.apply(Object,tr(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(i){return To({},i,Foe.linkProp(i))}))),lLe=Object.assign.apply(Object,tr(["globeMaterial","globeTileEngineClearCache"].map(function(i){return To({},i,Foe.linkMethod(i))}))),cLe=el("pointsLayer",_oe),uLe=Object.assign.apply(Object,tr(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(i){return To({},i,cLe.linkProp(i))}))),hLe=el("arcsLayer",yoe),fLe=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 To({},i,hLe.linkProp(i))}))),dLe=el("hexBinLayer",boe),pLe=Object.assign.apply(Object,tr(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(i){return To({},i,dLe.linkProp(i))}))),mLe=el("heatmapsLayer",Soe),ALe=Object.assign.apply(Object,tr(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(i){return To({},i,mLe.linkProp(i))}))),gLe=el("hexedPolygonsLayer",Eoe),vLe=Object.assign.apply(Object,tr(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(i){return To({},i,gLe.linkProp(i))}))),_Le=el("polygonsLayer",Toe),xLe=Object.assign.apply(Object,tr(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(i){return To({},i,_Le.linkProp(i))}))),yLe=el("pathsLayer",Moe),bLe=Object.assign.apply(Object,tr(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(i){return To({},i,yLe.linkProp(i))}))),wLe=el("tilesLayer",Coe),SLe=Object.assign.apply(Object,tr(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(i){return To({},i,wLe.linkProp(i))}))),TLe=el("particlesLayer",Roe),ELe=Object.assign.apply(Object,tr(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(i){return To({},i,TLe.linkProp(i))}))),MLe=el("ringsLayer",Ioe),CLe=Object.assign.apply(Object,tr(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(i){return To({},i,MLe.linkProp(i))}))),RLe=el("labelsLayer",Poe),ILe=Object.assign.apply(Object,tr(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(i){return To({},i,RLe.linkProp(i))}))),PLe=el("htmlElementsLayer",Loe),LLe=Object.assign.apply(Object,tr(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(i){return To({},i,PLe.linkProp(i))}))),DLe=el("objectsLayer",Doe),NLe=Object.assign.apply(Object,tr(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(i){return To({},i,DLe.linkProp(i))}))),FLe=el("customLayer",Noe),BLe=Object.assign.apply(Object,tr(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return To({},i,FLe.linkProp(i))}))),OLe=Zr({props:$i($i($i($i($i($i($i($i($i($i($i($i($i($i($i({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new NI.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},aLe),uLe),fLe),pLe),ALe),xLe),vLe),bLe),SLe),ELe),CLe),ILe),LLe),NLe),BLe),methods:$i({getGlobeRadius:roe,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 eu.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 goe.apply(void 0,n)},setPointOfView:function(e,t){var n=t instanceof NI.Camera?t.position:t,r=roe(),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()})}},lLe),stateInit:function(){var e=new og,t={tweenGroup:e},n={globeLayer:voe(t),pointsLayer:_oe(t),arcsLayer:yoe(t),hexBinLayer:boe(t),heatmapsLayer:Soe(t),polygonsLayer:Toe(t),hexedPolygonsLayer:Eoe(t),pathsLayer:Moe(t),tilesLayer:Coe(t),particlesLayer:Roe(t),ringsLayer:Ioe(t),labelsLayer:Poe(t),htmlElementsLayer:Loe(t),objectsLayer:Doe(t),customLayer:Noe(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;ts(e),t.scene=e,t.scene.visible=!1,oLe.forEach(function(c){var u=new NI.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 co({k:1e-6}).to({k:1},600).easing(Kr.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 NI.Vector3(0,1,0);t.tweenGroup.add(new co({rot:Math.PI*2}).to({rot:0},1200).easing(Kr.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 ULe(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;BI(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=FI(this,s,[].concat(l)),o.__kapsuleInstance=vV(i,[].concat(tr(t?[o]:[]),l)),o}return UI(s,r),OI(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 kLe=window.THREE?window.THREE:{Group:Fr},yV=ULe(OLe,kLe.Group,!0);var bV={type:"change"},TV={type:"start"},EV={type:"end"},Boe=1e-6,ki={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},kI=new Oe,Tm=new Oe,zLe=new re,zI=new re,wV=new re,yx=new Gs,Ooe=new re,VI=new re,SV=new re,GI=new re,qI=class extends Md{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:Va.ROTATE,MIDDLE:Va.DOLLY,RIGHT:Va.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=GLe.bind(this),this._onPointerDown=VLe.bind(this),this._onPointerUp=qLe.bind(this),this._onPointerCancel=HLe.bind(this),this._onContextMenu=KLe.bind(this),this._onMouseWheel=ZLe.bind(this),this._onKeyDown=jLe.bind(this),this._onKeyUp=WLe.bind(this),this._onTouchStart=QLe.bind(this),this._onTouchMove=JLe.bind(this),this._onTouchEnd=eDe.bind(this),this._onMouseDown=XLe.bind(this),this._onMouseMove=$Le.bind(this),this._onMouseUp=YLe.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)>Boe&&(this.dispatchEvent(bV),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>Boe||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(bV),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(bV),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(Tm.copy(this._panEnd).sub(this._panStart),Tm.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;Tm.x*=e,Tm.y*=t}Tm.multiplyScalar(this._eye.length()*this.panSpeed),zI.copy(this._eye).cross(this.object.up).setLength(Tm.x),zI.add(zLe.copy(this.object.up).setLength(Tm.y)),this.object.position.add(zI),this.target.add(zI),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(Tm.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){GI.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=GI.length();e?(this._eye.copy(this.object.position).sub(this.target),Ooe.copy(this._eye).normalize(),VI.copy(this.object.up).normalize(),SV.crossVectors(VI,Ooe).normalize(),VI.setLength(this._moveCurr.y-this._movePrev.y),SV.setLength(this._moveCurr.x-this._movePrev.x),GI.copy(VI.add(SV)),wV.crossVectors(GI,this._eye).normalize(),e*=this.rotateSpeed,yx.setFromAxisAngle(wV,e),this._eye.applyQuaternion(yx),this.object.up.applyQuaternion(yx),this._lastAxis.copy(wV),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),yx.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(yx),this.object.up.applyQuaternion(yx)),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=Lu.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=Lu.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 kI.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),kI}_getMouseOnCircle(e,t){return kI.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),kI}_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 VLe(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 GLe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function qLe(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 HLe(i){this._removePointer(i)}function WLe(){this.enabled!==!1&&(this.keyState=ki.NONE,window.addEventListener("keydown",this._onKeyDown))}function jLe(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 XLe(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 Va.DOLLY:this.state=ki.ZOOM;break;case Va.ROTATE:this.state=ki.ROTATE;break;case Va.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(TV)}function $Le(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 YLe(){this.state=ki.NONE,this.dispatchEvent(EV)}function ZLe(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(TV),this.dispatchEvent(EV)}}function KLe(i){this.enabled!==!1&&i.preventDefault()}function QLe(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(TV)}function JLe(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 eDe(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(EV)}var Uoe={type:"change"},CV={type:"start"},zoe={type:"end"},HI=new Td,koe=new La,tDe=Math.cos(70*Lu.DEG2RAD),uo=new re,Il=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},MV=1e-6,WI=class extends Md{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:Va.ROTATE,MIDDLE:Va.DOLLY,RIGHT:Va.PAN},this.touches={ONE:a0.ROTATE,TWO:a0.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 Zv,this._sphericalDelta=new Zv,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=iDe.bind(this),this._onPointerDown=nDe.bind(this),this._onPointerUp=rDe.bind(this),this._onContextMenu=hDe.bind(this),this._onMouseWheel=aDe.bind(this),this._onKeyDown=lDe.bind(this),this._onTouchStart=cDe.bind(this),this._onTouchMove=uDe.bind(this),this._onMouseDown=sDe.bind(this),this._onMouseMove=oDe.bind(this),this._interceptControlDown=fDe.bind(this),this._interceptControlUp=dDe.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(Uoe),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;uo.copy(t).sub(this.target),uo.applyQuaternion(this._quat),this._spherical.setFromVector3(uo),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+=Il:n>Math.PI&&(n-=Il),r<-Math.PI?r+=Il:r>Math.PI&&(r-=Il),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(uo.setFromSpherical(this._spherical),uo.applyQuaternion(this._quatInverse),t.copy(this.target).add(uo),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=uo.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=uo.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):(HI.origin.copy(this.object.position),HI.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(HI.direction))<tDe?this.object.lookAt(this.target):(koe.setFromNormalAndCoplanarPoint(this.object.up,this.target),HI.intersectPlane(koe,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)>MV||8*(1-this._lastQuaternion.dot(this.object.quaternion))>MV||this._lastTargetPosition.distanceToSquared(this.target)>MV?(this.dispatchEvent(Uoe),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Il/60*this.autoRotateSpeed*e:Il/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){uo.setFromMatrixColumn(t,0),uo.multiplyScalar(-e),this._panOffset.add(uo)}_panUp(e,t){this.screenSpacePanning===!0?uo.setFromMatrixColumn(t,1):(uo.setFromMatrixColumn(t,0),uo.crossVectors(this.object.up,uo)),uo.multiplyScalar(e),this._panOffset.add(uo)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;uo.copy(r).sub(this.target);let s=uo.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(Il*this._rotateDelta.x/t.clientHeight),this._rotateUp(Il*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(Il*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(-Il*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(Il*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(-Il*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(Il*this._rotateDelta.x/t.clientHeight),this._rotateUp(Il*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 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._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function iDe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function rDe(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(zoe),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 sDe(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 Va.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=dr.DOLLY;break;case Va.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 Va.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(CV)}function oDe(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 aDe(i){this.enabled===!1||this.enableZoom===!1||this.state!==dr.NONE||(i.preventDefault(),this.dispatchEvent(CV),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(zoe))}function lDe(i){this.enabled!==!1&&this._handleKeyDown(i)}function cDe(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case a0.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=dr.TOUCH_ROTATE;break;case a0.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 a0.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=dr.TOUCH_DOLLY_PAN;break;case a0.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(CV)}function uDe(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 hDe(i){this.enabled!==!1&&i.preventDefault()}function fDe(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function dDe(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var pDe={type:"change"},Voe=1e-6,Goe=new Gs,jI=class extends Md{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=mDe.bind(this),this._onKeyUp=ADe.bind(this),this._onPointerMove=vDe.bind(this),this._onPointerDown=gDe.bind(this),this._onPointerUp=_De.bind(this),this._onPointerCancel=xDe.bind(this),this._onContextMenu=yDe.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),Goe.set(this._rotationVector.x*r,this._rotationVector.y*r,this._rotationVector.z*r,1).normalize(),t.quaternion.multiply(Goe),(this._lastPosition.distanceToSquared(t.position)>Voe||8*(1-this._lastQuaternion.dot(t.quaternion))>Voe)&&(this.dispatchEvent(pDe),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 mDe(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 ADe(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 gDe(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 vDe(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 _De(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 xDe(){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 yDe(i){this.enabled!==!1&&i.preventDefault()}var qoe={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"},tLe=-334,nLe="Helvetiker",iLe=1522,rLe=50,sLe={glyphs:XPe,cssFontWeight:$Pe,ascender:YPe,underlinePosition:ZPe,cssFontStyle:KPe,boundingBox:QPe,resolution:JPe,original_font_information:eLe,descender:tLe,familyName:nLe,lineHeight:iLe,underlineThickness:rLe},Ku=$i($i({},window.THREE?window.THREE:{BoxGeometry:Ru,CircleGeometry:qv,DoubleSide:gr,Group:Fr,Mesh:Hn,MeshLambertMaterial:za,TextGeometry:wS,Vector3:re}),{},{Font:Ax,TextGeometry:wS}),Loe=Zr({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:sLe,onChange:function(e,t){t.font=new Ku.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;ts(e),t.scene=e,t.tweenGroup=r;var s=new Ku.CircleGeometry(1,32);t.dataMapper=new Rl(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var o=new Ku.MeshLambertMaterial;o.side=gr;var a=new Ku.Group;a.add(new Ku.Mesh(s,o));var l=new Ku.Mesh(void 0,o);a.add(l);var c=new Ku.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*vr/360;e.dataMapper.onUpdateObj(function(y,w){var S=Ir(y.children,2),T=S[0],R=S[1],P=Ir(R.children,1),I=P[0],F=l(w),D=Qu(F);R.material.color.set(Df(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 Ku.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=vV(Ku.BoxGeometry,tr(new Ku.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,ge=J.rot,Re=J.scale;Object.assign(y.position,eu(te,ce,he)),y.lookAt(e.scene.localToWorld(new Ku.Vector3(0,0,0))),y.rotateY(Math.PI),y.rotateZ(-ge*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 co(Y).to(W,e.labelsTransitionDuration).easing(Kr.Quadratic.InOut).onUpdate(G).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.labelsData)}}),oLe=$i($i({},window.THREE?window.THREE:{}),{},{CSS2DObject:PM}),Doe=Zr({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;ts(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjHtml"}).onCreateObj(function(s){var o=st(t.htmlElement)(s),a=new oLe.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,eu(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 co(a.__currentTargetD).to(u,e.htmlTransitionDuration).easing(Kr.Quadratic.InOut).onUpdate(c).onComplete(function(){e.tweenGroup.remove(this)}).start())}).digest(e.htmlElementsData)}}),DI=window.THREE?window.THREE:{Group:Fr,Mesh:Hn,MeshLambertMaterial:za,SphereGeometry:ka},Noe=Zr({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new DI.Mesh(new DI.SphereGeometry(1,16,8),new DI.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){ts(e),t.scene=e,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjObject"}).onCreateObj(function(n){var r=st(t.objectThreeObject)(n);t.objectThreeObject===r&&(r=r.clone());var s=new DI.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,eu(u,f,d)),o(c)?l.setRotationFromEuler(new Ba(r1(-u),r1(f),0,"YXZ")):l.rotation.set(0,0,0);var A=l.children[0],y=a(c);y&&A.setRotationFromEuler(new Ba(r1(y.x||0),r1(y.y||0),r1(y.z||0)))}).digest(e.objectsData)}}),Foe=Zr({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){ts(e),t.scene=e,t.dataMapper=new Rl(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(n){var r=st(t.customThreeObject)(n,vr);return r&&(t.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r})},update:function(e,t){e.customThreeObjectUpdate||ts(e.scene);var n=st(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(r,s){return n(r,s,vr)}).digest(e.customLayerData)}}),NI=window.THREE?window.THREE:{Camera:Ed,Group:Fr,Vector2:Oe,Vector3:re},aLe=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],Boe=el("globeLayer",_oe),lLe=Object.assign.apply(Object,tr(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(i){return To({},i,Boe.linkProp(i))}))),cLe=Object.assign.apply(Object,tr(["globeMaterial","globeTileEngineClearCache"].map(function(i){return To({},i,Boe.linkMethod(i))}))),uLe=el("pointsLayer",xoe),hLe=Object.assign.apply(Object,tr(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(i){return To({},i,uLe.linkProp(i))}))),fLe=el("arcsLayer",boe),dLe=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 To({},i,fLe.linkProp(i))}))),pLe=el("hexBinLayer",woe),mLe=Object.assign.apply(Object,tr(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(i){return To({},i,pLe.linkProp(i))}))),ALe=el("heatmapsLayer",Toe),gLe=Object.assign.apply(Object,tr(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(i){return To({},i,ALe.linkProp(i))}))),vLe=el("hexedPolygonsLayer",Moe),_Le=Object.assign.apply(Object,tr(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(i){return To({},i,vLe.linkProp(i))}))),xLe=el("polygonsLayer",Eoe),yLe=Object.assign.apply(Object,tr(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(i){return To({},i,xLe.linkProp(i))}))),bLe=el("pathsLayer",Coe),wLe=Object.assign.apply(Object,tr(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(i){return To({},i,bLe.linkProp(i))}))),SLe=el("tilesLayer",Roe),TLe=Object.assign.apply(Object,tr(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(i){return To({},i,SLe.linkProp(i))}))),ELe=el("particlesLayer",Ioe),MLe=Object.assign.apply(Object,tr(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(i){return To({},i,ELe.linkProp(i))}))),CLe=el("ringsLayer",Poe),RLe=Object.assign.apply(Object,tr(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(i){return To({},i,CLe.linkProp(i))}))),ILe=el("labelsLayer",Loe),PLe=Object.assign.apply(Object,tr(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(i){return To({},i,ILe.linkProp(i))}))),LLe=el("htmlElementsLayer",Doe),DLe=Object.assign.apply(Object,tr(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(i){return To({},i,LLe.linkProp(i))}))),NLe=el("objectsLayer",Noe),FLe=Object.assign.apply(Object,tr(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(i){return To({},i,NLe.linkProp(i))}))),BLe=el("customLayer",Foe),OLe=Object.assign.apply(Object,tr(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return To({},i,BLe.linkProp(i))}))),ULe=Zr({props:$i($i($i($i($i($i($i($i($i($i($i($i($i($i($i({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new NI.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},lLe),hLe),dLe),mLe),gLe),yLe),_Le),wLe),TLe),MLe),RLe),PLe),DLe),FLe),OLe),methods:$i({getGlobeRadius:soe,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 eu.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 voe.apply(void 0,n)},setPointOfView:function(e,t){var n=t instanceof NI.Camera?t.position:t,r=soe(),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()})}},cLe),stateInit:function(){var e=new og,t={tweenGroup:e},n={globeLayer:_oe(t),pointsLayer:xoe(t),arcsLayer:boe(t),hexBinLayer:woe(t),heatmapsLayer:Toe(t),polygonsLayer:Eoe(t),hexedPolygonsLayer:Moe(t),pathsLayer:Coe(t),tilesLayer:Roe(t),particlesLayer:Ioe(t),ringsLayer:Poe(t),labelsLayer:Loe(t),htmlElementsLayer:Doe(t),objectsLayer:Noe(t),customLayer:Foe(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;ts(e),t.scene=e,t.scene.visible=!1,aLe.forEach(function(c){var u=new NI.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 co({k:1e-6}).to({k:1},600).easing(Kr.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 NI.Vector3(0,1,0);t.tweenGroup.add(new co({rot:Math.PI*2}).to({rot:0},1200).easing(Kr.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 kLe(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;BI(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=FI(this,s,[].concat(l)),o.__kapsuleInstance=vV(i,[].concat(tr(t?[o]:[]),l)),o}return UI(s,r),OI(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 zLe=window.THREE?window.THREE:{Group:Fr},yV=kLe(ULe,zLe.Group,!0);var bV={type:"change"},TV={type:"start"},EV={type:"end"},Ooe=1e-6,ki={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},kI=new Oe,Tm=new Oe,VLe=new re,zI=new re,wV=new re,yx=new Gs,Uoe=new re,VI=new re,SV=new re,GI=new re,qI=class extends Md{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:Va.ROTATE,MIDDLE:Va.DOLLY,RIGHT:Va.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=qLe.bind(this),this._onPointerDown=GLe.bind(this),this._onPointerUp=HLe.bind(this),this._onPointerCancel=WLe.bind(this),this._onContextMenu=QLe.bind(this),this._onMouseWheel=KLe.bind(this),this._onKeyDown=XLe.bind(this),this._onKeyUp=jLe.bind(this),this._onTouchStart=JLe.bind(this),this._onTouchMove=eDe.bind(this),this._onTouchEnd=tDe.bind(this),this._onMouseDown=$Le.bind(this),this._onMouseMove=YLe.bind(this),this._onMouseUp=ZLe.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)>Ooe&&(this.dispatchEvent(bV),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>Ooe||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(bV),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(bV),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(Tm.copy(this._panEnd).sub(this._panStart),Tm.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;Tm.x*=e,Tm.y*=t}Tm.multiplyScalar(this._eye.length()*this.panSpeed),zI.copy(this._eye).cross(this.object.up).setLength(Tm.x),zI.add(VLe.copy(this.object.up).setLength(Tm.y)),this.object.position.add(zI),this.target.add(zI),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(Tm.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){GI.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=GI.length();e?(this._eye.copy(this.object.position).sub(this.target),Uoe.copy(this._eye).normalize(),VI.copy(this.object.up).normalize(),SV.crossVectors(VI,Uoe).normalize(),VI.setLength(this._moveCurr.y-this._movePrev.y),SV.setLength(this._moveCurr.x-this._movePrev.x),GI.copy(VI.add(SV)),wV.crossVectors(GI,this._eye).normalize(),e*=this.rotateSpeed,yx.setFromAxisAngle(wV,e),this._eye.applyQuaternion(yx),this.object.up.applyQuaternion(yx),this._lastAxis.copy(wV),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),yx.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(yx),this.object.up.applyQuaternion(yx)),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=Du.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=Du.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 kI.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),kI}_getMouseOnCircle(e,t){return kI.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),kI}_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 GLe(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 qLe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function HLe(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 WLe(i){this._removePointer(i)}function jLe(){this.enabled!==!1&&(this.keyState=ki.NONE,window.addEventListener("keydown",this._onKeyDown))}function XLe(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 $Le(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 Va.DOLLY:this.state=ki.ZOOM;break;case Va.ROTATE:this.state=ki.ROTATE;break;case Va.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(TV)}function YLe(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 ZLe(){this.state=ki.NONE,this.dispatchEvent(EV)}function KLe(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(TV),this.dispatchEvent(EV)}}function QLe(i){this.enabled!==!1&&i.preventDefault()}function JLe(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(TV)}function eDe(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 tDe(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(EV)}var koe={type:"change"},CV={type:"start"},Voe={type:"end"},HI=new Td,zoe=new La,nDe=Math.cos(70*Du.DEG2RAD),uo=new re,Il=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},MV=1e-6,WI=class extends Md{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:Va.ROTATE,MIDDLE:Va.DOLLY,RIGHT:Va.PAN},this.touches={ONE:a0.ROTATE,TWO:a0.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 Zv,this._sphericalDelta=new Zv,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=rDe.bind(this),this._onPointerDown=iDe.bind(this),this._onPointerUp=sDe.bind(this),this._onContextMenu=fDe.bind(this),this._onMouseWheel=lDe.bind(this),this._onKeyDown=cDe.bind(this),this._onTouchStart=uDe.bind(this),this._onTouchMove=hDe.bind(this),this._onMouseDown=oDe.bind(this),this._onMouseMove=aDe.bind(this),this._interceptControlDown=dDe.bind(this),this._interceptControlUp=pDe.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(koe),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;uo.copy(t).sub(this.target),uo.applyQuaternion(this._quat),this._spherical.setFromVector3(uo),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+=Il:n>Math.PI&&(n-=Il),r<-Math.PI?r+=Il:r>Math.PI&&(r-=Il),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(uo.setFromSpherical(this._spherical),uo.applyQuaternion(this._quatInverse),t.copy(this.target).add(uo),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=uo.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=uo.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):(HI.origin.copy(this.object.position),HI.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(HI.direction))<nDe?this.object.lookAt(this.target):(zoe.setFromNormalAndCoplanarPoint(this.object.up,this.target),HI.intersectPlane(zoe,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)>MV||8*(1-this._lastQuaternion.dot(this.object.quaternion))>MV||this._lastTargetPosition.distanceToSquared(this.target)>MV?(this.dispatchEvent(koe),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Il/60*this.autoRotateSpeed*e:Il/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){uo.setFromMatrixColumn(t,0),uo.multiplyScalar(-e),this._panOffset.add(uo)}_panUp(e,t){this.screenSpacePanning===!0?uo.setFromMatrixColumn(t,1):(uo.setFromMatrixColumn(t,0),uo.crossVectors(this.object.up,uo)),uo.multiplyScalar(e),this._panOffset.add(uo)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;uo.copy(r).sub(this.target);let s=uo.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(Il*this._rotateDelta.x/t.clientHeight),this._rotateUp(Il*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(Il*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(-Il*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(Il*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(-Il*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(Il*this._rotateDelta.x/t.clientHeight),this._rotateUp(Il*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 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._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function rDe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function sDe(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(Voe),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 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 Va.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=dr.DOLLY;break;case Va.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 Va.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(CV)}function aDe(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 lDe(i){this.enabled===!1||this.enableZoom===!1||this.state!==dr.NONE||(i.preventDefault(),this.dispatchEvent(CV),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(Voe))}function cDe(i){this.enabled!==!1&&this._handleKeyDown(i)}function uDe(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case a0.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=dr.TOUCH_ROTATE;break;case a0.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 a0.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=dr.TOUCH_DOLLY_PAN;break;case a0.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(CV)}function hDe(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 fDe(i){this.enabled!==!1&&i.preventDefault()}function dDe(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function pDe(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var mDe={type:"change"},Goe=1e-6,qoe=new Gs,jI=class extends Md{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=ADe.bind(this),this._onKeyUp=gDe.bind(this),this._onPointerMove=_De.bind(this),this._onPointerDown=vDe.bind(this),this._onPointerUp=xDe.bind(this),this._onPointerCancel=yDe.bind(this),this._onContextMenu=bDe.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),qoe.set(this._rotationVector.x*r,this._rotationVector.y*r,this._rotationVector.z*r,1).normalize(),t.quaternion.multiply(qoe),(this._lastPosition.distanceToSquared(t.position)>Goe||8*(1-this._lastQuaternion.dot(t.quaternion))>Goe)&&(this.dispatchEvent(mDe),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 ADe(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 gDe(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 vDe(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 _De(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 xDe(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 yDe(){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 bDe(i){this.enabled!==!1&&i.preventDefault()}var Hoe={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 Qd=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(){}},bDe=new Ru(-1,1,1,-1,0,1),RV=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))}},wDe=new RV,XI=class{constructor(e){this._mesh=new Hn(wDe,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,bDe)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}};var $I=class extends Qd{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof fs?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=ig.clone(e.uniforms),this.material=new fs({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 XI(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 ES=class extends Qd{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)}},YI=class extends Qd{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}};var ZI=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 Fa(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 $I(qoe),this.copyPass.material.blending=ds,this.timer=new HA}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()}ES!==void 0&&(o instanceof ES?n=!0:o instanceof YI&&(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 KI=class extends Qd{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 tl(){return tl=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},tl.apply(null,arguments)}function Hoe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Em(i,e){return Em=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Em(i,e)}function Woe(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,Em(i,e)}function QI(i){return QI=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},QI(i)}function joe(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function IV(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(IV=function(){return!!i})()}function Xoe(i,e,t){if(IV())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&Em(r,t.prototype),r}function JI(i){var e=typeof Map=="function"?new Map:void 0;return JI=function(n){if(n===null||!joe(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 Xoe(n,arguments,QI(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Em(r,n)},JI(i)}var Pl=(function(i){Woe(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 Hoe(n)}return e})(JI(Error));function $oe(i,e){return i.substr(-e.length)===e}var SDe=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;function Yoe(i){if(typeof i!="string")return i;var e=i.match(SDe);return e?parseFloat(i):i}var TDe=function(e){return function(t,n){n===void 0&&(n="16px");var r=t,s=n;if(typeof t=="string"){if(!$oe(t,"px"))throw new Pl(69,e,t);r=Yoe(t)}if(typeof n=="string"){if(!$oe(n,"px"))throw new Pl(70,e,n);s=Yoe(n)}if(typeof r=="string")throw new Pl(71,t,e);if(typeof s=="string")throw new Pl(72,n,e);return""+r/s+e}},Koe=TDe,dvt=Koe("em");var pvt=Koe("rem");function PV(i){return Math.round(i*255)}function EDe(i,e,t){return PV(i)+","+PV(e)+","+PV(t)}function MS(i,e,t,n){if(n===void 0&&(n=EDe),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 Zoe={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 MDe(i){if(typeof i!="string")return i;var e=i.toLowerCase();return Zoe[e]?"#"+Zoe[e]:i}var CDe=/^#[a-fA-F0-9]{6}$/,RDe=/^#[a-fA-F0-9]{8}$/,IDe=/^#[a-fA-F0-9]{3}$/,PDe=/^#[a-fA-F0-9]{4}$/,LV=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,LDe=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,DDe=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,NDe=/^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 Mm(i){if(typeof i!="string")throw new Pl(3);var e=MDe(i);if(e.match(CDe))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(RDe)){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(IDe))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(PDe)){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=LV.exec(e);if(r)return{red:parseInt(""+r[1],10),green:parseInt(""+r[2],10),blue:parseInt(""+r[3],10)};var s=LDe.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=DDe.exec(e);if(o){var a=parseInt(""+o[1],10),l=parseInt(""+o[2],10)/100,c=parseInt(""+o[3],10)/100,u="rgb("+MS(a,l,c)+")",f=LV.exec(u);if(!f)throw new Pl(4,e,u);return{red:parseInt(""+f[1],10),green:parseInt(""+f[2],10),blue:parseInt(""+f[3],10)}}var d=NDe.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("+MS(A,y,w)+")",T=LV.exec(S);if(!T)throw new Pl(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 Pl(5)}function FDe(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 Cm(i){return FDe(Mm(i))}var BDe=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},NV=BDe;function o1(i){var e=i.toString(16);return e.length===1?"0"+e:e}function DV(i){return o1(Math.round(i*255))}function ODe(i,e,t){return NV("#"+DV(i)+DV(e)+DV(t))}function eP(i,e,t){return MS(i,e,t,ODe)}function UDe(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return eP(i,e,t);if(typeof i=="object"&&e===void 0&&t===void 0)return eP(i.hue,i.saturation,i.lightness);throw new Pl(1)}function kDe(i,e,t,n){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?eP(i,e,t):"rgba("+MS(i,e,t)+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?eP(i.hue,i.saturation,i.lightness):"rgba("+MS(i.hue,i.saturation,i.lightness)+","+i.alpha+")";throw new Pl(2)}function FV(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return NV("#"+o1(i)+o1(e)+o1(t));if(typeof i=="object"&&e===void 0&&t===void 0)return NV("#"+o1(i.red)+o1(i.green)+o1(i.blue));throw new Pl(6)}function tP(i,e,t,n){if(typeof i=="string"&&typeof e=="number"){var r=Mm(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?FV(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?FV(i.red,i.green,i.blue):"rgba("+i.red+","+i.green+","+i.blue+","+i.alpha+")"}throw new Pl(7)}var zDe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},VDe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&typeof e.alpha=="number"},GDe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},qDe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&typeof e.alpha=="number"};function Rm(i){if(typeof i!="object")throw new Pl(8);if(VDe(i))return tP(i);if(zDe(i))return FV(i);if(qDe(i))return kDe(i);if(GDe(i))return UDe(i);throw new Pl(8)}function Qoe(i,e,t){return function(){var r=t.concat(Array.prototype.slice.call(arguments));return r.length>=e?i.apply(this,r):Qoe(i,e,r)}}function fc(i){return Qoe(i,i.length,[])}function HDe(i,e){if(e==="transparent")return e;var t=Cm(e);return Rm(tl({},t,{hue:t.hue+parseFloat(i)}))}var mvt=fc(HDe);function bx(i,e,t){return Math.max(i,Math.min(e,t))}function WDe(i,e){if(e==="transparent")return e;var t=Cm(e);return Rm(tl({},t,{lightness:bx(0,1,t.lightness-parseFloat(i))}))}var Avt=fc(WDe);function jDe(i,e){if(e==="transparent")return e;var t=Cm(e);return Rm(tl({},t,{saturation:bx(0,1,t.saturation-parseFloat(i))}))}var gvt=fc(jDe);function XDe(i,e){if(e==="transparent")return e;var t=Cm(e);return Rm(tl({},t,{lightness:bx(0,1,t.lightness+parseFloat(i))}))}var vvt=fc(XDe);function $De(i,e,t){if(e==="transparent")return t;if(t==="transparent")return e;if(i===0)return t;var n=Mm(e),r=tl({},n,{alpha:typeof n.alpha=="number"?n.alpha:1}),s=Mm(t),o=tl({},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 tP(A)}var YDe=fc($De),Joe=YDe;function ZDe(i,e){if(e==="transparent")return e;var t=Mm(e),n=typeof t.alpha=="number"?t.alpha:1,r=tl({},t,{alpha:bx(0,1,(n*100+parseFloat(i)*100)/100)});return tP(r)}var KDe=fc(ZDe),eae=KDe;function QDe(i,e){if(e==="transparent")return e;var t=Cm(e);return Rm(tl({},t,{saturation:bx(0,1,t.saturation+parseFloat(i))}))}var _vt=fc(QDe);function JDe(i,e){return e==="transparent"?e:Rm(tl({},Cm(e),{hue:parseFloat(i)}))}var xvt=fc(JDe);function eNe(i,e){return e==="transparent"?e:Rm(tl({},Cm(e),{lightness:parseFloat(i)}))}var yvt=fc(eNe);function tNe(i,e){return e==="transparent"?e:Rm(tl({},Cm(e),{saturation:parseFloat(i)}))}var bvt=fc(tNe);function nNe(i,e){return e==="transparent"?e:Joe(parseFloat(i),"rgb(0, 0, 0)",e)}var wvt=fc(nNe);function iNe(i,e){return e==="transparent"?e:Joe(parseFloat(i),"rgb(255, 255, 255)",e)}var Svt=fc(iNe);function rNe(i,e){if(e==="transparent")return e;var t=Mm(e),n=typeof t.alpha=="number"?t.alpha:1,r=tl({},t,{alpha:bx(0,1,+(n*100-parseFloat(i)*100).toFixed(2)/100)});return tP(r)}var Tvt=fc(rNe);var nP="http://www.w3.org/1999/xhtml",BV={svg:"http://www.w3.org/2000/svg",xhtml:nP,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function iP(i){var e=i+="",t=e.indexOf(":");return t>=0&&(e=i.slice(0,t))!=="xmlns"&&(i=i.slice(t+1)),BV.hasOwnProperty(e)?{space:BV[e],local:i}:i}function sNe(i){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===nP&&e.documentElement.namespaceURI===nP?e.createElement(i):e.createElementNS(t,i)}}function oNe(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function rP(i){var e=iP(i);return(e.local?oNe:sNe)(e)}function aNe(){}function sP(i){return i==null?aNe:function(){return this.querySelector(i)}}function tae(i){typeof i!="function"&&(i=sP(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 xs(n,this._parents)}function OV(i){return i==null?[]:Array.isArray(i)?i:Array.from(i)}function lNe(){return[]}function nae(i){return i==null?lNe:function(){return this.querySelectorAll(i)}}function cNe(i){return function(){return OV(i.apply(this,arguments))}}function iae(i){typeof i=="function"?i=cNe(i):i=nae(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 xs(n,r)}function rae(i){return function(){return this.matches(i)}}function oP(i){return function(e){return e.matches(i)}}var uNe=Array.prototype.find;function hNe(i){return function(){return uNe.call(this.children,i)}}function fNe(){return this.firstElementChild}function sae(i){return this.select(i==null?fNe:hNe(typeof i=="function"?i:oP(i)))}var dNe=Array.prototype.filter;function pNe(){return Array.from(this.children)}function mNe(i){return function(){return dNe.call(this.children,i)}}function oae(i){return this.selectAll(i==null?pNe:mNe(typeof i=="function"?i:oP(i)))}function aae(i){typeof i!="function"&&(i=rae(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 xs(n,this._parents)}function aP(i){return new Array(i.length)}function lae(){return new xs(this._enter||this._groups.map(aP),this._parents)}function CS(i,e){this.ownerDocument=i.ownerDocument,this.namespaceURI=i.namespaceURI,this._next=null,this._parent=i,this.__data__=e}CS.prototype={constructor:CS,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 cae(i){return function(){return i}}function ANe(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 CS(i,s[o]);for(;o<l;++o)(a=e[o])&&(r[o]=a)}function gNe(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 CS(i,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(d[a])===l&&(r[a]=l)}function vNe(i){return i.__data__}function uae(i,e){if(!arguments.length)return Array.from(this,vNe);var t=e?gNe:ANe,n=this._parents,r=this._groups;typeof i!="function"&&(i=cae(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=_Ne(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 xs(o,n),o._enter=a,o._exit=l,o}function _Ne(i){return typeof i=="object"&&"length"in i?i:Array.from(i)}function hae(){return new xs(this._exit||this._groups.map(aP),this._parents)}function fae(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 dae(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 xs(a,this._parents)}function pae(){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 mae(i){i||(i=xNe);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 xs(r,this._parents).order()}function xNe(i,e){return i<e?-1:i>e?1:i>=e?0:NaN}function Aae(){var i=arguments[0];return arguments[0]=this,i.apply(null,arguments),this}function gae(){return Array.from(this)}function vae(){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 _ae(){let i=0;for(let e of this)++i;return i}function xae(){return!this.node()}function yae(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 yNe(i){return function(){this.removeAttribute(i)}}function bNe(i){return function(){this.removeAttributeNS(i.space,i.local)}}function wNe(i,e){return function(){this.setAttribute(i,e)}}function SNe(i,e){return function(){this.setAttributeNS(i.space,i.local,e)}}function TNe(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttribute(i):this.setAttribute(i,t)}}function ENe(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 bae(i,e){var t=iP(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?bNe:yNe:typeof e=="function"?t.local?ENe:TNe:t.local?SNe:wNe)(t,e))}function lP(i){return i.ownerDocument&&i.ownerDocument.defaultView||i.document&&i||i.defaultView}function MNe(i){return function(){this.style.removeProperty(i)}}function CNe(i,e,t){return function(){this.style.setProperty(i,e,t)}}function RNe(i,e,t){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(i):this.style.setProperty(i,n,t)}}function wae(i,e,t){return arguments.length>1?this.each((e==null?MNe:typeof e=="function"?RNe:CNe)(i,e,t??"")):INe(this.node(),i)}function INe(i,e){return i.style.getPropertyValue(e)||lP(i).getComputedStyle(i,null).getPropertyValue(e)}function PNe(i){return function(){delete this[i]}}function LNe(i,e){return function(){this[i]=e}}function DNe(i,e){return function(){var t=e.apply(this,arguments);t==null?delete this[i]:this[i]=t}}function Sae(i,e){return arguments.length>1?this.each((e==null?PNe:typeof e=="function"?DNe:LNe)(i,e)):this.node()[i]}function Tae(i){return i.trim().split(/^|\s+/)}function UV(i){return i.classList||new Eae(i)}function Eae(i){this._node=i,this._names=Tae(i.getAttribute("class")||"")}Eae.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 Mae(i,e){for(var t=UV(i),n=-1,r=e.length;++n<r;)t.add(e[n])}function Cae(i,e){for(var t=UV(i),n=-1,r=e.length;++n<r;)t.remove(e[n])}function NNe(i){return function(){Mae(this,i)}}function FNe(i){return function(){Cae(this,i)}}function BNe(i,e){return function(){(e.apply(this,arguments)?Mae:Cae)(this,i)}}function Rae(i,e){var t=Tae(i+"");if(arguments.length<2){for(var n=UV(this.node()),r=-1,s=t.length;++r<s;)if(!n.contains(t[r]))return!1;return!0}return this.each((typeof e=="function"?BNe:e?NNe:FNe)(t,e))}function ONe(){this.textContent=""}function UNe(i){return function(){this.textContent=i}}function kNe(i){return function(){var e=i.apply(this,arguments);this.textContent=e??""}}function Iae(i){return arguments.length?this.each(i==null?ONe:(typeof i=="function"?kNe:UNe)(i)):this.node().textContent}function zNe(){this.innerHTML=""}function VNe(i){return function(){this.innerHTML=i}}function GNe(i){return function(){var e=i.apply(this,arguments);this.innerHTML=e??""}}function Pae(i){return arguments.length?this.each(i==null?zNe:(typeof i=="function"?GNe:VNe)(i)):this.node().innerHTML}function qNe(){this.nextSibling&&this.parentNode.appendChild(this)}function Lae(){return this.each(qNe)}function HNe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Dae(){return this.each(HNe)}function Nae(i){var e=typeof i=="function"?i:rP(i);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function WNe(){return null}function Fae(i,e){var t=typeof i=="function"?i:rP(i),n=e==null?WNe:typeof e=="function"?e:sP(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)})}function jNe(){var i=this.parentNode;i&&i.removeChild(this)}function Bae(){return this.each(jNe)}function XNe(){var i=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function $Ne(){var i=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function Oae(i){return this.select(i?$Ne:XNe)}function Uae(i){return arguments.length?this.property("__data__",i):this.node().__data__}function YNe(i){return function(e){i.call(this,e,this.__data__)}}function ZNe(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 KNe(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 QNe(i,e,t){return function(){var n=this.__on,r,s=YNe(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 kae(i,e,t){var n=ZNe(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?QNe:KNe,r=0;r<s;++r)this.each(a(n[r],e,t));return this}function zae(i,e,t){var n=lP(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 JNe(i,e){return function(){return zae(this,i,e)}}function e5e(i,e){return function(){return zae(this,i,e.apply(this,arguments))}}function Vae(i,e){return this.each((typeof e=="function"?e5e:JNe)(i,e))}function*Gae(){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 kV=[null];function xs(i,e){this._groups=i,this._parents=e}function t5e(){return new xs([[document.documentElement]],kV)}function n5e(){return this}xs.prototype=t5e.prototype={constructor:xs,select:tae,selectAll:iae,selectChild:sae,selectChildren:oae,filter:aae,data:uae,enter:lae,exit:hae,join:fae,merge:dae,selection:n5e,order:pae,sort:mae,call:Aae,nodes:gae,node:vae,size:_ae,empty:xae,each:yae,attr:bae,style:wae,property:Sae,classed:Rae,text:Iae,html:Pae,raise:Lae,lower:Dae,append:Nae,insert:Fae,remove:Bae,clone:Oae,datum:Uae,on:kae,dispatch:Vae,[Symbol.iterator]:Gae};function zV(i){return typeof i=="string"?new xs([[document.querySelector(i)]],[document.documentElement]):new xs([[i]],kV)}function qae(i){let e;for(;e=i.sourceEvent;)i=e;return i}function VV(i,e){if(i=qae(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 PS,zr,$ae,WV,Im,Hae,Yae,Zae,GV,uP,RS,Kae,jV,qV,HV,i5e,fP={},dP=[],r5e=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,mP=Array.isArray;function Ff(i,e){for(var t in e)i[t]=e[t];return i}function XV(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function s5e(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?PS.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 IS(i,o,n,r,null)}function IS(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??++$ae,__i:-1,__u:0};return r==null&&zr.vnode!=null&&zr.vnode(s),s}function AP(i){return i.children}function hP(i,e){this.props=i,this.context=e}function a1(i,e){if(e==null)return i.__?a1(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"?a1(i):null}function o5e(i){if(i.__P&&i.__d){var e=i.__v,t=e.__e,n=[],r=[],s=Ff({},e);s.__v=e.__v+1,zr.vnode&&zr.vnode(s),$V(i.__P,s,e,i.__n,i.__P.namespaceURI,32&e.__u?[t]:null,n,t??a1(e),!!(32&e.__u),r),s.__v=e.__v,s.__.__k[s.__i]=s,nle(n,s,r),e.__e=e.__=null,s.__e!=t&&Qae(s)}}function Qae(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}),Qae(i)}function Wae(i){(!i.__d&&(i.__d=!0)&&Im.push(i)&&!pP.__r++||Hae!=zr.debounceRendering)&&((Hae=zr.debounceRendering)||Yae)(pP)}function pP(){try{for(var i,e=1;Im.length;)Im.length>e&&Im.sort(Zae),i=Im.shift(),e=Im.length,o5e(i)}finally{Im.length=pP.__r=0}}function Jae(i,e,t,n,r,s,o,a,l,c,u){var f,d,A,y,w,S,T=n&&n.__k||dP,R=e.length;for(l=a5e(t,e,T,l,R),f=0;f<R;f++)(A=t.__k[f])!=null&&(d=A.__i!=-1&&T[A.__i]||fP,A.__i=f,S=$V(i,A,d,r,s,o,a,l,c,u),y=A.__e,A.ref&&d.ref!=A.ref&&(d.ref&&YV(d.ref,null,A),u.push(A.ref,A.__c||y,A)),w==null&&y!=null&&(w=y),4&A.__u?(l=ele(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 a5e(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]=IS(null,o,null,null,null):mP(o)?o=i.__k[s]=IS(AP,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[s]=IS(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=l5e(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=a1(a)),rle(a,a));return n}function ele(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=ele(n[r],e,t));return e}i.__e!=e&&(e&&i.type&&!e.parentNode&&(e=a1(i)),e=t.insertBefore(i.__e,e||null));do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function l5e(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 jae(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||r5e.test(e)?t:t+"px"}function cP(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||jae(i.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||jae(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(Kae,"$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[RS]=n[RS]:(t[RS]=jV,i.addEventListener(e,s?HV:qV,s)):i.removeEventListener(e,s?HV:qV,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 Xae(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e[uP]==null)e[uP]=jV++;else if(e[uP]<t[RS])return;return t(zr.event?zr.event(e):e)}}}function $V(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=zr.__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 hP(R,F),d.constructor=k,d.render=u5e),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=Ff({},d.__s)),Ff(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)}),dP.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d),a=a1(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=zr.__r,L=0,P)d.state=d.__s,d.__d=!1,D&&D(e),u=d.render(d.props,d.state,d.context),dP.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=Ff(Ff({},n),d.getChildContext())),P&&!A&&d.getSnapshotBeforeUpdate!=null&&(S=d.getSnapshotBeforeUpdate(y,w)),C=u!=null&&u.type===AP&&u.key==null?ile(u.props.children):u,a=Jae(i,mP(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--;)XV(s[B])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),z.then||tle(e),zr.__e(z,e,t)}}else s==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=c5e(t.__e,e,t,n,r,s,o,l,c);return(u=zr.diffed)&&u(e),128&e.__u?void 0:a}function tle(i){i&&(i.__c&&(i.__c.__e=!0),i.__k&&i.__k.some(tle))}function nle(i,e,t){for(var n=0;n<t.length;n++)YV(t[n],t[++n],t[++n]);zr.__c&&zr.__c(e,i),i.some(function(r){try{i=r.__h,r.__h=[],i.some(function(s){s.call(r)})}catch(s){zr.__e(s,r.__v)}})}function ile(i){return typeof i!="object"||i==null||i.__b>0?i:mP(i)?i.map(ile):i.constructor!==void 0?null:Ff({},i)}function c5e(i,e,t,n,r,s,o,a,l){var c,u,f,d,A,y,w,S=t.props||fP,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&&(zr.__m&&zr.__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&&PS.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||cP(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||cP(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=""),Jae(e.type=="template"?i.content:i,mP(d)?d:[d],e,t,n,R=="foreignObject"?"http://www.w3.org/1999/xhtml":r,s,o,s?s[0]:t.__k&&a1(t,0),a,l),s!=null)for(c=s.length;c--;)XV(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])&&cP(i,c,y,S[c],r),c="checked",w!=null&&w!=i[c]&&cP(i,c,w,S[c],r))}return i}function YV(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){zr.__e(r,t)}}function rle(i,e,t){var n,r;if(zr.unmount&&zr.unmount(i),(n=i.ref)&&(n.current&&n.current!=i.__e||YV(n,null,e)),(n=i.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){zr.__e(s,e)}n.base=n.__P=n.__n=null}if(n=i.__k)for(r=0;r<n.length;r++)n[r]&&rle(n[r],e,t||typeof i.type!="function");t||XV(i.__e),i.__c=i.__=i.__e=void 0}function u5e(i,e,t){return this.constructor(i,t)}function sle(i,e,t){var n,r,s,o;e==document&&(e=document.documentElement),zr.__&&zr.__(i,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,s=[],o=[],$V(e,i=(!n&&t||e).__k=s5e(AP,null,[i]),r||fP,fP,e.namespaceURI,!n&&t?[t]:r?null:e.firstChild?PS.call(e.childNodes):null,s,!n&&t?t:r?r.__e:e.firstChild,n,o),nle(s,i,o),i.props.children=null}function ZV(i,e,t){var n,r,s,o,a=Ff({},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?PS.call(arguments,2):t),IS(i.type,a,n||i.key,r||i.ref,null)}PS=dP.slice,zr={__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}},$ae=0,WV=function(i){return i!=null&&i.constructor===void 0},hP.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ff({},this.state),typeof i=="function"&&(i=i(Ff({},t),this.props)),i&&Ff(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),Wae(this))},hP.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),Wae(this))},hP.prototype.render=AP,Im=[],Yae=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Zae=function(i,e){return i.__v.__b-e.__v.__b},pP.__r=0,GV=Math.random().toString(8),uP="__d"+GV,RS="__a"+GV,Kae=/(PointerCapture)$|Capture$/i,jV=0,qV=Xae(!1),HV=Xae(!0),i5e=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 h5e(i){if(Array.isArray(i))return i}function f5e(i,e,t){return(e=v5e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function d5e(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 p5e(){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 ale(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 m5e(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ale(Object(t),!0).forEach(function(n){f5e(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):ale(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function A5e(i,e){return h5e(i)||d5e(i,e)||_5e(i,e)||p5e()}function g5e(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 v5e(i){var e=g5e(i,"string");return typeof e=="symbol"?e:e+""}function gP(i){"@babel/helpers - typeof";return gP=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},gP(i)}function _5e(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 KV=function(e){if(gP(e)!=="object")return e;var t=ZV(e);if(t.props){var n;t.props=m5e({},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(KV):KV(t.props.children))}return t},x5e=function(e){return WV(ZV(e))},y5e=function(e,t){delete t.__k,sle(KV(e),t)};function b5e(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 w5e=`.float-tooltip-kap {5258+ }`};var Qd=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(){}},wDe=new Iu(-1,1,1,-1,0,1),RV=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))}},SDe=new RV,XI=class{constructor(e){this._mesh=new Hn(SDe,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,wDe)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}};var $I=class extends Qd{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof fs?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=ig.clone(e.uniforms),this.material=new fs({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 XI(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 MS=class extends Qd{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)}},YI=class extends Qd{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}};var ZI=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 Fa(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 $I(Hoe),this.copyPass.material.blending=ds,this.timer=new HA}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()}MS!==void 0&&(o instanceof MS?n=!0:o instanceof YI&&(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 KI=class extends Qd{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 tl(){return tl=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},tl.apply(null,arguments)}function Woe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Em(i,e){return Em=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Em(i,e)}function joe(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,Em(i,e)}function QI(i){return QI=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},QI(i)}function Xoe(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function IV(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(IV=function(){return!!i})()}function $oe(i,e,t){if(IV())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&Em(r,t.prototype),r}function JI(i){var e=typeof Map=="function"?new Map:void 0;return JI=function(n){if(n===null||!Xoe(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 $oe(n,arguments,QI(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Em(r,n)},JI(i)}var Pl=(function(i){joe(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 Woe(n)}return e})(JI(Error));function Yoe(i,e){return i.substr(-e.length)===e}var TDe=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;function Zoe(i){if(typeof i!="string")return i;var e=i.match(TDe);return e?parseFloat(i):i}var EDe=function(e){return function(t,n){n===void 0&&(n="16px");var r=t,s=n;if(typeof t=="string"){if(!Yoe(t,"px"))throw new Pl(69,e,t);r=Zoe(t)}if(typeof n=="string"){if(!Yoe(n,"px"))throw new Pl(70,e,n);s=Zoe(n)}if(typeof r=="string")throw new Pl(71,t,e);if(typeof s=="string")throw new Pl(72,n,e);return""+r/s+e}},Qoe=EDe,pvt=Qoe("em");var mvt=Qoe("rem");function PV(i){return Math.round(i*255)}function MDe(i,e,t){return PV(i)+","+PV(e)+","+PV(t)}function CS(i,e,t,n){if(n===void 0&&(n=MDe),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 Koe={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 CDe(i){if(typeof i!="string")return i;var e=i.toLowerCase();return Koe[e]?"#"+Koe[e]:i}var RDe=/^#[a-fA-F0-9]{6}$/,IDe=/^#[a-fA-F0-9]{8}$/,PDe=/^#[a-fA-F0-9]{3}$/,LDe=/^#[a-fA-F0-9]{4}$/,LV=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,DDe=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,NDe=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,FDe=/^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 Mm(i){if(typeof i!="string")throw new Pl(3);var e=CDe(i);if(e.match(RDe))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(IDe)){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(PDe))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(LDe)){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=LV.exec(e);if(r)return{red:parseInt(""+r[1],10),green:parseInt(""+r[2],10),blue:parseInt(""+r[3],10)};var s=DDe.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=NDe.exec(e);if(o){var a=parseInt(""+o[1],10),l=parseInt(""+o[2],10)/100,c=parseInt(""+o[3],10)/100,u="rgb("+CS(a,l,c)+")",f=LV.exec(u);if(!f)throw new Pl(4,e,u);return{red:parseInt(""+f[1],10),green:parseInt(""+f[2],10),blue:parseInt(""+f[3],10)}}var d=FDe.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("+CS(A,y,w)+")",T=LV.exec(S);if(!T)throw new Pl(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 Pl(5)}function BDe(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 Cm(i){return BDe(Mm(i))}var ODe=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},NV=ODe;function o1(i){var e=i.toString(16);return e.length===1?"0"+e:e}function DV(i){return o1(Math.round(i*255))}function UDe(i,e,t){return NV("#"+DV(i)+DV(e)+DV(t))}function eP(i,e,t){return CS(i,e,t,UDe)}function kDe(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return eP(i,e,t);if(typeof i=="object"&&e===void 0&&t===void 0)return eP(i.hue,i.saturation,i.lightness);throw new Pl(1)}function zDe(i,e,t,n){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?eP(i,e,t):"rgba("+CS(i,e,t)+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?eP(i.hue,i.saturation,i.lightness):"rgba("+CS(i.hue,i.saturation,i.lightness)+","+i.alpha+")";throw new Pl(2)}function FV(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return NV("#"+o1(i)+o1(e)+o1(t));if(typeof i=="object"&&e===void 0&&t===void 0)return NV("#"+o1(i.red)+o1(i.green)+o1(i.blue));throw new Pl(6)}function tP(i,e,t,n){if(typeof i=="string"&&typeof e=="number"){var r=Mm(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?FV(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?FV(i.red,i.green,i.blue):"rgba("+i.red+","+i.green+","+i.blue+","+i.alpha+")"}throw new Pl(7)}var VDe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},GDe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&typeof e.alpha=="number"},qDe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},HDe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&typeof e.alpha=="number"};function Rm(i){if(typeof i!="object")throw new Pl(8);if(GDe(i))return tP(i);if(VDe(i))return FV(i);if(HDe(i))return zDe(i);if(qDe(i))return kDe(i);throw new Pl(8)}function Joe(i,e,t){return function(){var r=t.concat(Array.prototype.slice.call(arguments));return r.length>=e?i.apply(this,r):Joe(i,e,r)}}function fc(i){return Joe(i,i.length,[])}function WDe(i,e){if(e==="transparent")return e;var t=Cm(e);return Rm(tl({},t,{hue:t.hue+parseFloat(i)}))}var Avt=fc(WDe);function bx(i,e,t){return Math.max(i,Math.min(e,t))}function jDe(i,e){if(e==="transparent")return e;var t=Cm(e);return Rm(tl({},t,{lightness:bx(0,1,t.lightness-parseFloat(i))}))}var gvt=fc(jDe);function XDe(i,e){if(e==="transparent")return e;var t=Cm(e);return Rm(tl({},t,{saturation:bx(0,1,t.saturation-parseFloat(i))}))}var vvt=fc(XDe);function $De(i,e){if(e==="transparent")return e;var t=Cm(e);return Rm(tl({},t,{lightness:bx(0,1,t.lightness+parseFloat(i))}))}var _vt=fc($De);function YDe(i,e,t){if(e==="transparent")return t;if(t==="transparent")return e;if(i===0)return t;var n=Mm(e),r=tl({},n,{alpha:typeof n.alpha=="number"?n.alpha:1}),s=Mm(t),o=tl({},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 tP(A)}var ZDe=fc(YDe),eae=ZDe;function KDe(i,e){if(e==="transparent")return e;var t=Mm(e),n=typeof t.alpha=="number"?t.alpha:1,r=tl({},t,{alpha:bx(0,1,(n*100+parseFloat(i)*100)/100)});return tP(r)}var QDe=fc(KDe),tae=QDe;function JDe(i,e){if(e==="transparent")return e;var t=Cm(e);return Rm(tl({},t,{saturation:bx(0,1,t.saturation+parseFloat(i))}))}var xvt=fc(JDe);function eNe(i,e){return e==="transparent"?e:Rm(tl({},Cm(e),{hue:parseFloat(i)}))}var yvt=fc(eNe);function tNe(i,e){return e==="transparent"?e:Rm(tl({},Cm(e),{lightness:parseFloat(i)}))}var bvt=fc(tNe);function nNe(i,e){return e==="transparent"?e:Rm(tl({},Cm(e),{saturation:parseFloat(i)}))}var wvt=fc(nNe);function iNe(i,e){return e==="transparent"?e:eae(parseFloat(i),"rgb(0, 0, 0)",e)}var Svt=fc(iNe);function rNe(i,e){return e==="transparent"?e:eae(parseFloat(i),"rgb(255, 255, 255)",e)}var Tvt=fc(rNe);function sNe(i,e){if(e==="transparent")return e;var t=Mm(e),n=typeof t.alpha=="number"?t.alpha:1,r=tl({},t,{alpha:bx(0,1,+(n*100-parseFloat(i)*100).toFixed(2)/100)});return tP(r)}var Evt=fc(sNe);var nP="http://www.w3.org/1999/xhtml",BV={svg:"http://www.w3.org/2000/svg",xhtml:nP,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function iP(i){var e=i+="",t=e.indexOf(":");return t>=0&&(e=i.slice(0,t))!=="xmlns"&&(i=i.slice(t+1)),BV.hasOwnProperty(e)?{space:BV[e],local:i}:i}function oNe(i){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===nP&&e.documentElement.namespaceURI===nP?e.createElement(i):e.createElementNS(t,i)}}function aNe(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function rP(i){var e=iP(i);return(e.local?aNe:oNe)(e)}function lNe(){}function sP(i){return i==null?lNe:function(){return this.querySelector(i)}}function nae(i){typeof i!="function"&&(i=sP(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 xs(n,this._parents)}function OV(i){return i==null?[]:Array.isArray(i)?i:Array.from(i)}function cNe(){return[]}function iae(i){return i==null?cNe:function(){return this.querySelectorAll(i)}}function uNe(i){return function(){return OV(i.apply(this,arguments))}}function rae(i){typeof i=="function"?i=uNe(i):i=iae(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 xs(n,r)}function sae(i){return function(){return this.matches(i)}}function oP(i){return function(e){return e.matches(i)}}var hNe=Array.prototype.find;function fNe(i){return function(){return hNe.call(this.children,i)}}function dNe(){return this.firstElementChild}function oae(i){return this.select(i==null?dNe:fNe(typeof i=="function"?i:oP(i)))}var pNe=Array.prototype.filter;function mNe(){return Array.from(this.children)}function ANe(i){return function(){return pNe.call(this.children,i)}}function aae(i){return this.selectAll(i==null?mNe:ANe(typeof i=="function"?i:oP(i)))}function lae(i){typeof i!="function"&&(i=sae(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 xs(n,this._parents)}function aP(i){return new Array(i.length)}function cae(){return new xs(this._enter||this._groups.map(aP),this._parents)}function RS(i,e){this.ownerDocument=i.ownerDocument,this.namespaceURI=i.namespaceURI,this._next=null,this._parent=i,this.__data__=e}RS.prototype={constructor:RS,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 uae(i){return function(){return i}}function gNe(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 RS(i,s[o]);for(;o<l;++o)(a=e[o])&&(r[o]=a)}function vNe(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 RS(i,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(d[a])===l&&(r[a]=l)}function _Ne(i){return i.__data__}function hae(i,e){if(!arguments.length)return Array.from(this,_Ne);var t=e?vNe:gNe,n=this._parents,r=this._groups;typeof i!="function"&&(i=uae(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=xNe(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 xs(o,n),o._enter=a,o._exit=l,o}function xNe(i){return typeof i=="object"&&"length"in i?i:Array.from(i)}function fae(){return new xs(this._exit||this._groups.map(aP),this._parents)}function dae(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 pae(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 xs(a,this._parents)}function mae(){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 Aae(i){i||(i=yNe);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 xs(r,this._parents).order()}function yNe(i,e){return i<e?-1:i>e?1:i>=e?0:NaN}function gae(){var i=arguments[0];return arguments[0]=this,i.apply(null,arguments),this}function vae(){return Array.from(this)}function _ae(){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 xae(){let i=0;for(let e of this)++i;return i}function yae(){return!this.node()}function bae(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 bNe(i){return function(){this.removeAttribute(i)}}function wNe(i){return function(){this.removeAttributeNS(i.space,i.local)}}function SNe(i,e){return function(){this.setAttribute(i,e)}}function TNe(i,e){return function(){this.setAttributeNS(i.space,i.local,e)}}function ENe(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttribute(i):this.setAttribute(i,t)}}function MNe(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 wae(i,e){var t=iP(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?wNe:bNe:typeof e=="function"?t.local?MNe:ENe:t.local?TNe:SNe)(t,e))}function lP(i){return i.ownerDocument&&i.ownerDocument.defaultView||i.document&&i||i.defaultView}function CNe(i){return function(){this.style.removeProperty(i)}}function RNe(i,e,t){return function(){this.style.setProperty(i,e,t)}}function INe(i,e,t){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(i):this.style.setProperty(i,n,t)}}function Sae(i,e,t){return arguments.length>1?this.each((e==null?CNe:typeof e=="function"?INe:RNe)(i,e,t??"")):PNe(this.node(),i)}function PNe(i,e){return i.style.getPropertyValue(e)||lP(i).getComputedStyle(i,null).getPropertyValue(e)}function LNe(i){return function(){delete this[i]}}function DNe(i,e){return function(){this[i]=e}}function NNe(i,e){return function(){var t=e.apply(this,arguments);t==null?delete this[i]:this[i]=t}}function Tae(i,e){return arguments.length>1?this.each((e==null?LNe:typeof e=="function"?NNe:DNe)(i,e)):this.node()[i]}function Eae(i){return i.trim().split(/^|\s+/)}function UV(i){return i.classList||new Mae(i)}function Mae(i){this._node=i,this._names=Eae(i.getAttribute("class")||"")}Mae.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 Cae(i,e){for(var t=UV(i),n=-1,r=e.length;++n<r;)t.add(e[n])}function Rae(i,e){for(var t=UV(i),n=-1,r=e.length;++n<r;)t.remove(e[n])}function FNe(i){return function(){Cae(this,i)}}function BNe(i){return function(){Rae(this,i)}}function ONe(i,e){return function(){(e.apply(this,arguments)?Cae:Rae)(this,i)}}function Iae(i,e){var t=Eae(i+"");if(arguments.length<2){for(var n=UV(this.node()),r=-1,s=t.length;++r<s;)if(!n.contains(t[r]))return!1;return!0}return this.each((typeof e=="function"?ONe:e?FNe:BNe)(t,e))}function UNe(){this.textContent=""}function kNe(i){return function(){this.textContent=i}}function zNe(i){return function(){var e=i.apply(this,arguments);this.textContent=e??""}}function Pae(i){return arguments.length?this.each(i==null?UNe:(typeof i=="function"?zNe:kNe)(i)):this.node().textContent}function VNe(){this.innerHTML=""}function GNe(i){return function(){this.innerHTML=i}}function qNe(i){return function(){var e=i.apply(this,arguments);this.innerHTML=e??""}}function Lae(i){return arguments.length?this.each(i==null?VNe:(typeof i=="function"?qNe:GNe)(i)):this.node().innerHTML}function HNe(){this.nextSibling&&this.parentNode.appendChild(this)}function Dae(){return this.each(HNe)}function WNe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Nae(){return this.each(WNe)}function Fae(i){var e=typeof i=="function"?i:rP(i);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function jNe(){return null}function Bae(i,e){var t=typeof i=="function"?i:rP(i),n=e==null?jNe:typeof e=="function"?e:sP(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)})}function XNe(){var i=this.parentNode;i&&i.removeChild(this)}function Oae(){return this.each(XNe)}function $Ne(){var i=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function YNe(){var i=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function Uae(i){return this.select(i?YNe:$Ne)}function kae(i){return arguments.length?this.property("__data__",i):this.node().__data__}function ZNe(i){return function(e){i.call(this,e,this.__data__)}}function KNe(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 QNe(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 JNe(i,e,t){return function(){var n=this.__on,r,s=ZNe(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 zae(i,e,t){var n=KNe(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?JNe:QNe,r=0;r<s;++r)this.each(a(n[r],e,t));return this}function Vae(i,e,t){var n=lP(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 e5e(i,e){return function(){return Vae(this,i,e)}}function t5e(i,e){return function(){return Vae(this,i,e.apply(this,arguments))}}function Gae(i,e){return this.each((typeof e=="function"?t5e:e5e)(i,e))}function*qae(){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 kV=[null];function xs(i,e){this._groups=i,this._parents=e}function n5e(){return new xs([[document.documentElement]],kV)}function i5e(){return this}xs.prototype=n5e.prototype={constructor:xs,select:nae,selectAll:rae,selectChild:oae,selectChildren:aae,filter:lae,data:hae,enter:cae,exit:fae,join:dae,merge:pae,selection:i5e,order:mae,sort:Aae,call:gae,nodes:vae,node:_ae,size:xae,empty:yae,each:bae,attr:wae,style:Sae,property:Tae,classed:Iae,text:Pae,html:Lae,raise:Dae,lower:Nae,append:Fae,insert:Bae,remove:Oae,clone:Uae,datum:kae,on:zae,dispatch:Gae,[Symbol.iterator]:qae};function zV(i){return typeof i=="string"?new xs([[document.querySelector(i)]],[document.documentElement]):new xs([[i]],kV)}function Hae(i){let e;for(;e=i.sourceEvent;)i=e;return i}function VV(i,e){if(i=Hae(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 LS,zr,Yae,WV,Im,Wae,Zae,Kae,GV,uP,IS,Qae,jV,qV,HV,r5e,fP={},dP=[],s5e=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,mP=Array.isArray;function Ff(i,e){for(var t in e)i[t]=e[t];return i}function XV(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function o5e(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?LS.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 PS(i,o,n,r,null)}function PS(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??++Yae,__i:-1,__u:0};return r==null&&zr.vnode!=null&&zr.vnode(s),s}function AP(i){return i.children}function hP(i,e){this.props=i,this.context=e}function a1(i,e){if(e==null)return i.__?a1(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"?a1(i):null}function a5e(i){if(i.__P&&i.__d){var e=i.__v,t=e.__e,n=[],r=[],s=Ff({},e);s.__v=e.__v+1,zr.vnode&&zr.vnode(s),$V(i.__P,s,e,i.__n,i.__P.namespaceURI,32&e.__u?[t]:null,n,t??a1(e),!!(32&e.__u),r),s.__v=e.__v,s.__.__k[s.__i]=s,ile(n,s,r),e.__e=e.__=null,s.__e!=t&&Jae(s)}}function Jae(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}),Jae(i)}function jae(i){(!i.__d&&(i.__d=!0)&&Im.push(i)&&!pP.__r++||Wae!=zr.debounceRendering)&&((Wae=zr.debounceRendering)||Zae)(pP)}function pP(){try{for(var i,e=1;Im.length;)Im.length>e&&Im.sort(Kae),i=Im.shift(),e=Im.length,a5e(i)}finally{Im.length=pP.__r=0}}function ele(i,e,t,n,r,s,o,a,l,c,u){var f,d,A,y,w,S,T=n&&n.__k||dP,R=e.length;for(l=l5e(t,e,T,l,R),f=0;f<R;f++)(A=t.__k[f])!=null&&(d=A.__i!=-1&&T[A.__i]||fP,A.__i=f,S=$V(i,A,d,r,s,o,a,l,c,u),y=A.__e,A.ref&&d.ref!=A.ref&&(d.ref&&YV(d.ref,null,A),u.push(A.ref,A.__c||y,A)),w==null&&y!=null&&(w=y),4&A.__u?(l=tle(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 l5e(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]=PS(null,o,null,null,null):mP(o)?o=i.__k[s]=PS(AP,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[s]=PS(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=c5e(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=a1(a)),sle(a,a));return n}function tle(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=tle(n[r],e,t));return e}i.__e!=e&&(e&&i.type&&!e.parentNode&&(e=a1(i)),e=t.insertBefore(i.__e,e||null));do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function c5e(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 Xae(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||s5e.test(e)?t:t+"px"}function cP(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||Xae(i.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||Xae(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(Qae,"$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[IS]=n[IS]:(t[IS]=jV,i.addEventListener(e,s?HV:qV,s)):i.removeEventListener(e,s?HV:qV,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 $ae(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e[uP]==null)e[uP]=jV++;else if(e[uP]<t[IS])return;return t(zr.event?zr.event(e):e)}}}function $V(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=zr.__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 hP(R,F),d.constructor=k,d.render=h5e),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=Ff({},d.__s)),Ff(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)}),dP.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d),a=a1(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=zr.__r,L=0,P)d.state=d.__s,d.__d=!1,D&&D(e),u=d.render(d.props,d.state,d.context),dP.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=Ff(Ff({},n),d.getChildContext())),P&&!A&&d.getSnapshotBeforeUpdate!=null&&(S=d.getSnapshotBeforeUpdate(y,w)),C=u!=null&&u.type===AP&&u.key==null?rle(u.props.children):u,a=ele(i,mP(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--;)XV(s[B])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),z.then||nle(e),zr.__e(z,e,t)}}else s==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=u5e(t.__e,e,t,n,r,s,o,l,c);return(u=zr.diffed)&&u(e),128&e.__u?void 0:a}function nle(i){i&&(i.__c&&(i.__c.__e=!0),i.__k&&i.__k.some(nle))}function ile(i,e,t){for(var n=0;n<t.length;n++)YV(t[n],t[++n],t[++n]);zr.__c&&zr.__c(e,i),i.some(function(r){try{i=r.__h,r.__h=[],i.some(function(s){s.call(r)})}catch(s){zr.__e(s,r.__v)}})}function rle(i){return typeof i!="object"||i==null||i.__b>0?i:mP(i)?i.map(rle):i.constructor!==void 0?null:Ff({},i)}function u5e(i,e,t,n,r,s,o,a,l){var c,u,f,d,A,y,w,S=t.props||fP,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&&(zr.__m&&zr.__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&&LS.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||cP(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||cP(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=""),ele(e.type=="template"?i.content:i,mP(d)?d:[d],e,t,n,R=="foreignObject"?"http://www.w3.org/1999/xhtml":r,s,o,s?s[0]:t.__k&&a1(t,0),a,l),s!=null)for(c=s.length;c--;)XV(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])&&cP(i,c,y,S[c],r),c="checked",w!=null&&w!=i[c]&&cP(i,c,w,S[c],r))}return i}function YV(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){zr.__e(r,t)}}function sle(i,e,t){var n,r;if(zr.unmount&&zr.unmount(i),(n=i.ref)&&(n.current&&n.current!=i.__e||YV(n,null,e)),(n=i.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){zr.__e(s,e)}n.base=n.__P=n.__n=null}if(n=i.__k)for(r=0;r<n.length;r++)n[r]&&sle(n[r],e,t||typeof i.type!="function");t||XV(i.__e),i.__c=i.__=i.__e=void 0}function h5e(i,e,t){return this.constructor(i,t)}function ole(i,e,t){var n,r,s,o;e==document&&(e=document.documentElement),zr.__&&zr.__(i,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,s=[],o=[],$V(e,i=(!n&&t||e).__k=o5e(AP,null,[i]),r||fP,fP,e.namespaceURI,!n&&t?[t]:r?null:e.firstChild?LS.call(e.childNodes):null,s,!n&&t?t:r?r.__e:e.firstChild,n,o),ile(s,i,o),i.props.children=null}function ZV(i,e,t){var n,r,s,o,a=Ff({},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?LS.call(arguments,2):t),PS(i.type,a,n||i.key,r||i.ref,null)}LS=dP.slice,zr={__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}},Yae=0,WV=function(i){return i!=null&&i.constructor===void 0},hP.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ff({},this.state),typeof i=="function"&&(i=i(Ff({},t),this.props)),i&&Ff(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),jae(this))},hP.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),jae(this))},hP.prototype.render=AP,Im=[],Zae=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Kae=function(i,e){return i.__v.__b-e.__v.__b},pP.__r=0,GV=Math.random().toString(8),uP="__d"+GV,IS="__a"+GV,Qae=/(PointerCapture)$|Capture$/i,jV=0,qV=$ae(!1),HV=$ae(!0),r5e=0;function ale(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 f5e(i){if(Array.isArray(i))return i}function d5e(i,e,t){return(e=_5e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function p5e(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 m5e(){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 lle(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 A5e(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?lle(Object(t),!0).forEach(function(n){d5e(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):lle(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function g5e(i,e){return f5e(i)||p5e(i,e)||x5e(i,e)||m5e()}function v5e(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 _5e(i){var e=v5e(i,"string");return typeof e=="symbol"?e:e+""}function gP(i){"@babel/helpers - typeof";return gP=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},gP(i)}function x5e(i,e){if(i){if(typeof i=="string")return ale(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)?ale(i,e):void 0}}var KV=function(e){if(gP(e)!=="object")return e;var t=ZV(e);if(t.props){var n;t.props=A5e({},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(KV):KV(t.props.children))}return t},y5e=function(e){return WV(ZV(e))},b5e=function(e,t){delete t.__k,ole(KV(e),t)};function w5e(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 S5e=`.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-`;b5e(w5e);var lle=Zr({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&&gP(e)==="object"&&!!e.node&&typeof e.node=="function",a=zV(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=A5e(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=VV(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):x5e(e.content)?(e.tooltipEl.text(""),y5e(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 S5e(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 T5e=`.scene-nav-info {5270+`;w5e(S5e);var cle=Zr({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&&gP(e)==="object"&&!!e.node&&typeof e.node=="function",a=zV(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=g5e(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=VV(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):y5e(e.content)?(e.tooltipEl.text(""),b5e(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 T5e(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 E5e=`.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-}`;S5e(T5e);function QV(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 E5e(i){if(Array.isArray(i))return i}function M5e(i){if(Array.isArray(i))return QV(i)}function C5e(i,e,t){return(e=F5e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function R5e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function I5e(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 P5e(){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 L5e(){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 D5e(i,e){return E5e(i)||I5e(i,e)||cle(i,e)||P5e()}function l1(i){return M5e(i)||R5e(i)||cle(i)||L5e()}function N5e(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 F5e(i){var e=N5e(i,"string");return typeof e=="symbol"?e:e+""}function cle(i,e){if(i){if(typeof i=="string")return QV(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)?QV(i,e):void 0}}var ule=function(e){e instanceof Array?e.forEach(ule):(e.map&&e.map.dispose(),e.dispose())},hle=function(e){e.geometry&&e.geometry.dispose(),e.material&&ule(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(hle)},B5e=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),hle(t)}},Vr=window.THREE?window.THREE:{WebGLRenderer:CM,Scene:e0,PerspectiveCamera:Xr,Raycaster:W2,SRGBColorSpace:Nr,TextureLoader:_l,Vector2:Oe,Vector3:re,Box3:Oa,Color:zt,Mesh:Hn,SphereGeometry:ka,MeshBasicMaterial:hs,BackSide:mi,Timer:HA},JV=Zr({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 co(u).to(l,r).easing(Kr.Quadratic.Out).onUpdate(d).onComplete(function(){e.povPosTween=void 0,e.tweenGroup.remove(this)}).start()),e.tweenGroup.add(e.povTgtTween=new co(f).to(c,r/3).easing(Kr.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 Vr.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 Vr.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 Vr.Vector3(0,0,0),a=Math.max.apply(Math,l1(Object.entries(t).map(function(A){var y=D5e(A,2),w=y[0],S=y[1];return Math.max.apply(Math,l1(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 Vr.Box3(new Vr.Vector3(0,0,0),new Vr.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(s){return n.expandByObject(s)}),Object.assign.apply(Object,l1(["x","y","z"].map(function(s){return C5e({},s,[n.min[s],n.max[s]])})))):null},getScreenCoords:function(e,t,n,r){var s=new Vr.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 Vr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),o=new Vr.Raycaster;return o.setFromCamera(s,e.camera),Object.assign({},o.ray.at(r,new Vr.Vector3))},intersectingObjects:function(e,t,n){var r=new Vr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),s=new Vr.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;B5e(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 Vr.Scene,camera:new Vr.PerspectiveCamera,timer:new Vr.Timer,tweenGroup:new og,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 lle(t.container),t.pointerPos=new Vr.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?lx:Vr.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 ZI(t.renderer),t.postProcessingComposer.addPass(new KI(t.scene,t.camera)),t.controls=new{trackball:qI,orbit:WI,fly:jI}[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(l1(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 Vr.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(l1(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(l1(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(l1(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 Vr.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var f=Mm(e.backgroundColor).alpha;f===void 0&&(f=1),e.renderer.setClearColor(new Vr.Color(eae(1,e.backgroundColor)),f)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new Vr.TextureLoader().load(e.backgroundImageUrl,function(A){A.colorSpace=Vr.SRGBColorSpace,e.skysphere.material=new Vr.MeshBasicMaterial({map:A,side:Vr.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 O5e(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 U5e=`.scene-container .clickable {5285+}`;T5e(E5e);function QV(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 M5e(i){if(Array.isArray(i))return i}function C5e(i){if(Array.isArray(i))return QV(i)}function R5e(i,e,t){return(e=B5e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function I5e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function P5e(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 L5e(){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 D5e(){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 N5e(i,e){return M5e(i)||P5e(i,e)||ule(i,e)||L5e()}function l1(i){return C5e(i)||I5e(i)||ule(i)||D5e()}function F5e(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 B5e(i){var e=F5e(i,"string");return typeof e=="symbol"?e:e+""}function ule(i,e){if(i){if(typeof i=="string")return QV(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)?QV(i,e):void 0}}var hle=function(e){e instanceof Array?e.forEach(hle):(e.map&&e.map.dispose(),e.dispose())},fle=function(e){e.geometry&&e.geometry.dispose(),e.material&&hle(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(fle)},O5e=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),fle(t)}},Vr=window.THREE?window.THREE:{WebGLRenderer:CM,Scene:e0,PerspectiveCamera:Xr,Raycaster:j2,SRGBColorSpace:Nr,TextureLoader:_l,Vector2:Oe,Vector3:re,Box3:Oa,Color:zt,Mesh:Hn,SphereGeometry:ka,MeshBasicMaterial:hs,BackSide:mi,Timer:HA},JV=Zr({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 co(u).to(l,r).easing(Kr.Quadratic.Out).onUpdate(d).onComplete(function(){e.povPosTween=void 0,e.tweenGroup.remove(this)}).start()),e.tweenGroup.add(e.povTgtTween=new co(f).to(c,r/3).easing(Kr.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 Vr.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 Vr.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 Vr.Vector3(0,0,0),a=Math.max.apply(Math,l1(Object.entries(t).map(function(A){var y=N5e(A,2),w=y[0],S=y[1];return Math.max.apply(Math,l1(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 Vr.Box3(new Vr.Vector3(0,0,0),new Vr.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(s){return n.expandByObject(s)}),Object.assign.apply(Object,l1(["x","y","z"].map(function(s){return R5e({},s,[n.min[s],n.max[s]])})))):null},getScreenCoords:function(e,t,n,r){var s=new Vr.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 Vr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),o=new Vr.Raycaster;return o.setFromCamera(s,e.camera),Object.assign({},o.ray.at(r,new Vr.Vector3))},intersectingObjects:function(e,t,n){var r=new Vr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),s=new Vr.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;O5e(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 Vr.Scene,camera:new Vr.PerspectiveCamera,timer:new Vr.Timer,tweenGroup:new og,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 cle(t.container),t.pointerPos=new Vr.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?lx:Vr.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 ZI(t.renderer),t.postProcessingComposer.addPass(new KI(t.scene,t.camera)),t.controls=new{trackball:qI,orbit:WI,fly:jI}[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(l1(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 Vr.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(l1(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(l1(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(l1(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 Vr.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var f=Mm(e.backgroundColor).alpha;f===void 0&&(f=1),e.renderer.setClearColor(new Vr.Color(tae(1,e.backgroundColor)),f)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new Vr.TextureLoader().load(e.backgroundImageUrl,function(A){A.colorSpace=Vr.SRGBColorSpace,e.skysphere.material=new Vr.MeshBasicMaterial({map:A,side:Vr.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 U5e(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 k5e=`.scene-container .clickable {52885288 cursor: pointer;5289-}`;O5e(U5e);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 k5e(i){if(Array.isArray(i))return eG(i)}function DS(i,e,t){return(e=W5e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function z5e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function V5e(){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 fle(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 c1(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fle(Object(t),!0).forEach(function(n){DS(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):fle(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function G5e(i,e){if(i==null)return{};var t,n,r=q5e(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 q5e(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 vP(i){return k5e(i)||z5e(i)||j5e(i)||V5e()}function H5e(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 W5e(i){var e=H5e(i,"string");return typeof e=="symbol"?e:e+""}function j5e(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}}function dle(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 X5e=["rendererConfig","waitForGlobeReady"],LS=c1(c1({},window.THREE?window.THREE:{AmbientLight:qA,DirectionalLight:GA,Vector2:Oe,REVISION:"185"}),{},{CSS2DRenderer:LM}),ple=dle("globe",yV),$5e=Object.assign.apply(Object,vP(["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 DS({},i,ple.linkProp(i))}))),Y5e=Object.assign.apply(Object,vP(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return DS({},i,ple.linkMethod(i))}))),mle=dle("renderObjs",JV),Z5e=Object.assign.apply(Object,vP(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return DS({},i,mle.linkProp(i))}))),K5e=Object.assign.apply(Object,vP(["lights","postProcessingComposer"].map(function(i){return DS({},i,mle.linkMethod(i))}))),Ale=Zr({props:c1(c1({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}))}}},$5e),Z5e),methods:c1(c1({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 co(r).to(o,n).easing(Kr.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()}},Y5e),K5e),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=G5e(e,X5e),o=new yV(c1({waitForGlobeReady:r},s));return{globe:o,renderObjs:JV({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new LS.CSS2DRenderer]}).skyRadius(o.getGlobeRadius()*500).showNavInfo(!1).objects([o]).lights([new LS.AmbientLight(13421772,Math.PI),new LS.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new og}},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 LS.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}};LS.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 _le=4,FS=100,OS=FS+.2,Jd=8,Q5e=96,xle=.045,yle=.08;function wx(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 Qn=null,xP="",Ds={group:null,tiles:new Map,key:"",variant:""},Ko={group:null,cell:null,fitKey:""},Qu={group:null,key:""},J5e=180,nG=null,Sx=new Map,wP=new Map,gle=new Map;function ble(){let i=bT(U.map)==="sphere"&&oh(U.map)!==null;_e.globeToggle.hidden=!i,wle(),!i&&Qn&&(NS(),Ds.group=null,Ko.group=null,Ko.cell=null,Qu.group=null,Qu.key="",Qn._destructor(),Qn=null,xP="",nG=null,_e.globe.replaceChildren())}function SP(){U.globeActive?wle():Ele()}var BS=2.5,yP=2,Tx=.08,TP=4;function e6e(i){let e=Number.isFinite(i)?i:yP;return ls(BS/2**(e-yP),Tx,TP)}function rG(i){let e=Number.isFinite(i)?Math.max(i,Tx/2):BS,t=(U.variant?.maxZoom??yP)+2;return ls(yP+Math.log2(BS/e),0,t)}function sG(i){if(!Qn||!U.globeActive)return;let e=Qn.pointOfView(),t=ls((Number.isFinite(e.altitude)?e.altitude:BS)/2**i,Tx,TP);Qn.pointOfView({altitude:t},180)}function wle(){let i=oh(U.map),e=U.engine?.getView();if(Qn&&U.globeActive&&i&&e){let t=Qn.pointOfView(),[n,r]=i.toWorld(t.lat,t.lng);Number.isFinite(n)&&Number.isFinite(r)&&(e.cancelAnimations(),e.setCenter([n,-r]),e.setZoom(rG(t.altitude)))}U.globeActive=!1,_e.globe.hidden=!0,_e.globeToggle.setAttribute("aria-pressed","false"),_e.viewport.hidden=!1,NS(),U.overviewKey="",document.dispatchEvent(new Event("atlas:globe-camera"))}function Sle(){if(!Qn||!U.globeActive)return null;let i=Qn.pointOfView();return{lat:i.lat,lng:i.lng}}function Tle(i,e,t){if(!Qn)return;let n=Qn.pointOfView().altitude;Qn.pointOfView({lat:i,lng:e,altitude:n},t?180:0)}async function Ele(){let i=oh(U.map);if(!i)return;if(U.globeActive=!0,_e.viewport.hidden=!0,_e.globe.hidden=!1,_e.globeToggle.setAttribute("aria-pressed","true"),U.overviewKey="",!Qn){Qn=Ale({animateIn:!1})(_e.globe).backgroundColor("#0b0e12").showAtmosphere(!0).atmosphereColor("#8a6f5b").atmosphereAltitude(.12).objectLat(o=>o.lat).objectLng(o=>o.lng).objectAltitude(o=>o.pin===U.selectedPin?.03:.014).objectThreeObject(o=>f6e(o.pin)).objectLabel(o=>o.pin.location.title).onObjectClick(o=>_y(o.pin)).onObjectHover(o=>{_e.globe.style.cursor=o?"pointer":""}).onZoom(()=>{document.dispatchEvent(new Event("atlas:globe-camera")),vle(),_P(),d6e()}),document.addEventListener("atlas:selection",h6e),document.addEventListener("atlas:filters",tG),document.addEventListener("atlas:grid",()=>{bP(),tG(),_P()}),document.addEventListener("atlas:labels",_P),Qn.onGlobeClick(({lat:o,lng:a})=>{if(!U.gridEnabled)return;let l=oh(U.map);if(!l)return;let[c,u]=l.toWorld(o,a),f=Ss().descendTarget(U.gridCell,[c,-u]);f&&oA(f)});let s=Qn.controls();s.minDistance=FS*(1+Tx),s.maxDistance=FS*(1+TP),Ds.group=new Fr,Qn.scene().add(Ds.group),Ko.group=new Fr,Qn.scene().add(Ko.group),Qu.group=new Fr,Qn.scene().add(Qu.group),window.__atlasGlobe={detail:Ds,grid:Ko,labels:Qu,sprites:Sx}}aG();let e=U.engine?.getView(),t=e?.getCenter();if(t&&Number.isFinite(t[0])&&Number.isFinite(t[1])){let[s,o]=i.toLatLng(t[0],-t[1]);Qn.pointOfView({lat:s,lng:o,altitude:e6e(e.getZoom())})}else Qn.pointOfView({lat:10,lng:0,altitude:BS});let n=U.variant||U.map.variants[0],r=`${U.game.stamp}:${U.map.slug}:${n.tiles}`;if(xP!==r){xP=r;let s=await m6e(n);s&&xP===r&&Qn.globeImageUrl(s)}nG!==U.pins&&(nG=U.pins,Sx.clear(),wP.clear(),Qn.objectsData(p6e(i))),tG(),Ile(),vle(),bP(),_P(),document.dispatchEvent(new Event("atlas:globe-camera"))}function bP(){if(!Qn||!Ko.group)return;for(let t of[...Ko.group.children])Ko.group.remove(t),t.geometry?.dispose(),t.material?.map?.dispose(),t.material?.dispose();let i=U.globeActive?oh(U.map):null;if(!i||!U.gridEnabled){Ko.cell=null;return}let e=Ss();for(let t of AE()){let n=Mle(t.ring,i),r=oG(n),s=mE(t,{subgridVisible:U.subgridVisible,labelled:i6e(t,r)});if(s){if(s.fill){let o=Cle(e.center(t.hash),i);Ko.group.add(r6e(n,o,s.fill))}Ko.group.add(a6e(n,s.line)),s.label&&Ko.group.add(l6e(s.label,r))}}Ko.cell!==null&&Ko.cell!==U.gridCell&&c6e(i),Ko.cell=U.gridCell}function Mle(i,e){return i.map(([t,n])=>e.toLatLng(t,-n))}function Cle(i,e){return e.toLatLng(i[0],-i[1])}function t6e(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=ls(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 oG(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 n6e(i){let e=Qn.pointOfView(),t=Math.max(e.altitude,Tx/2),n=50*Math.PI/180,r=2*t*FS*Math.tan(n/2)/Math.max(1,_e.globe.clientHeight||1),s=FS*Math.PI/180/r;return{width:Math.abs(i.east-i.west)*s,height:Math.abs(i.north-i.south)*s}}function i6e(i,e){let n=i.role==="neighbor"?Vi.neighborLabelSizePx:Vi.labelSizePx,r=`900 ${n}px ${Vi.labelFont}`,s=n6e(e);return VN(i.hash,r)+9<=s.width&&n+6<=s.height}function r6e(i,e,t){let n=OS+.12,r=t6e(i),s=oG(i),o=Math.max(s.east-s.west,s.north-s.south),a=ls(Math.ceil(o/6),2,24),l=wx(e[0],e[1],n),c=r.map(([T,R])=>wx(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 hs({color:t.color,transparent:!0,opacity:t.opacity,depthWrite:!1,side:2}),S=new Hn(y,w);return S.renderOrder=1,S}function _P(){if(!Qn||!Qu.group)return;let i=U.globeActive&&U.labelsHeld,e=i?Qn.pointOfView():null,t=i?`${Math.round(e.lat)}:${Math.round(e.lng)}:${e.altitude.toFixed(2)}:${U.gridSystem}:${U.gridCell}`:"";if(t===Qu.key)return;Qu.key=t;for(let r of[...Qu.group.children])Qu.group.remove(r),r.material?.map?.dispose(),r.material?.dispose();if(!i)return;let n=[];for(let[r,s]of Sx){if(!s.visible)continue;let o=wP.get(r);if(!o)continue;let a=s6e(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,J5e))Qu.group.add(o6e(r,s))}function s6e(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(ls(n,-1,1))*180/Math.PI}function o6e(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 Ch({depthWrite:!1,sizeAttenuation:!1,transparent:!0});new _l().load(n.toDataURL("image/png"),u=>{a.map=u,a.needsUpdate=!0});let l=new DA(a);l.position.set(...wx(e.lat,e.lng,OS+.4));let c=.028;return l.scale.set(c*o/40,c,1),l.center.set(.5,0),l}function a6e(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=ls(Math.ceil(f/2),4,48);for(let A=0;A<d;A++){let y=A/d;t.push(...wx(a+(c-a)*y,l+(u-l)*y,OS+.25))}}t.push(...t.slice(0,3));let n=new xm;n.setPositions(t);let r=new Cf({color:e.color,transparent:!0,opacity:e.opacity,linewidth:e.widthPx,depthWrite:!1});r.resolution.set(_e.globe.clientWidth||1,_e.globe.clientHeight||1);let s=new mx(n,r);return s.computeLineDistances(),s.renderOrder=2,s}function l6e(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 Ch({depthWrite:!1,transparent:!0,sizeAttenuation:!1});new _l().load(o.toDataURL("image/png"),R=>{d.map=R,d.needsUpdate=!0});let A=new DA(d),y=Math.abs(e.north-e.south)*.02,w=Math.abs(e.east-e.west)*.02;A.position.set(...wx(e.south+y,e.east-w,OS+.35));let S=Math.max(1,_e.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 c6e(i){let t=AE().find(l=>l.role==="scope"||l.role==="leaf");if(!t)return;let[n,r]=Cle(Ss().center(t.hash),i),s=oG(Mle(t.ring,i)),o=Math.max(s.east-s.west,s.north-s.south),a=ls(o/45,Tx,TP);Qn.pointOfView({lat:n,lng:r,altitude:a},400)}function vle(){if(!Qn||!Ds.group)return;let i=U.globeActive?U.variant||U.map.variants[0]:null;if(!i){NS();return}Ds.variant!==i.tiles&&(NS(),Ds.variant=i.tiles);let e=Qn.pointOfView(),t=Math.min(Math.round(rG(e.altitude))+1,i.maxZoom);if(t<=_le||!i.formats[t]){NS(),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>Q5e&&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),Rle(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=u6e(i,A,y,w);Ds.tiles.set(d,S),Ds.group.add(S)}}}function u6e(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<=Jd;w++){let S=o-w/Jd*r;for(let T=0;T<=Jd;T++){let R=s+T/Jd*r;a.push(...wx(S,R,OS)),l.push(T/Jd,1-w/Jd)}}let u=Jd+1;for(let w=0;w<Jd;w++)for(let S=0;S<Jd;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 hs,A=new Hn(f,d);A.visible=!1;let y=`${U.game.base}/tiles/${i.tiles}/${e}/${t}/${n}.${i.formats[e]}`;return new _l().load(y,w=>{w.colorSpace=Nr,d.map=w,d.needsUpdate=!0,A.visible=!0}),A}function NS(){if(Ds.group){for(let i of Ds.tiles.values())Ds.group.remove(i),Rle(i);Ds.tiles.clear(),Ds.key=""}}function Rle(i){i.geometry.dispose(),i.material.map?.dispose(),i.material.dispose()}function Ile(){if(Qn){for(let[i,e]of Sx){let t=i===U.selectedPin;e.material=Lle(i.category,t);let n=t?yle:xle;e.scale.set(n,n,1)}Qn.objectAltitude(i=>i.pin===U.selectedPin?.03:.014)}}function h6e(){if(!Qn||!U.globeActive)return;Ile();let i=wP.get(U.selectedPin);if(i){let e=Qn.pointOfView().altitude;Qn.pointOfView({lat:i.lat,lng:i.lng,altitude:e},600)}}function Ple(i){return!(i.filteredHidden||U.hiddenCategories.has(i.category.id)||U.gridEnabled&&U.gridCell&&!Ip(i))}function tG(){if(!(!Qn||!U.globeActive))for(let[i,e]of Sx)e.visible=Ple(i)}function f6e(i){let e=new DA(Lle(i.category,i===U.selectedPin)),t=i===U.selectedPin?yle:xle;return e.scale.set(t,t,1),e.visible=Ple(i),Sx.set(i,e),e}function Lle(i,e){let t=`${Fy(i)}:${e?"ringed":"plain"}`,n=gle.get(t);if(n)return n;n=new Ch({depthWrite:!1,sizeAttenuation:!1}),gle.set(t,n);let r=U.markerIcons.get(Fy(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=rA(),l.strokeText(Au(i.title),40,41),l.fillStyle=sA(i),l.fillText(Au(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 _l().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 Dle(){U.globeActive&&Ele()}function aG(){!Qn||_e.globe.hidden||(Qn.width(_e.globe.clientWidth).height(_e.globe.clientHeight),bP())}function d6e(){if(!Qn||!U.globeActive||!U.gridEnabled)return;let i=Qn.pointOfView(),e=`${U.gridSystem}:${U.gridCell}:${Math.round(rG(i.altitude)*2)}`;e!==Ko.fitKey&&(Ko.fitKey=e,bP())}function p6e(i){let e=[];for(let t of U.pins){let[n,r]=nv(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 m6e(i){let e=Math.min(_le,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=`${U.game.base}/tiles/${i.tiles}/${e}/${c}/${l}.${t}`;a.push(A6e(u).then(f=>{f&&o.drawImage(f,c*256,l*256,256,256)}))}return await Promise.all(a),s.toDataURL("image/jpeg",.92)}function A6e(i){return new Promise(e=>{let t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=i})}function Nle(){let i=U.variant,e=_e.overviewCanvas,t=e.getContext("2d"),n=Bf(),r=U.game.tileGrid.size,s=U.game.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=++U.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||!MP(i,l,T,S))continue;let R=new Image;R.onload=()=>{U.overviewRun===u&&t.drawImage(R,T*s-n[0]*c,S*s+n[3]*c,s,s)},R.src=`${U.game.base}/tiles/${encodeURIComponent(i.tiles)}/${l}/${T}/${S}.${f}`}Ex()}function Ex(){let i=Sle();if(i){let w=oh(U.map);if(!w||!U.variant)return;let S=Bf(),[T,R]=w.toWorld(i.lat,i.lng),P=_e.overviewCanvas,I=ls((T-S[0])/(S[2]-S[0]),0,1),F=ls((R+S[3])/(S[3]-S[1]),0,1);U.overviewKey="",_e.overviewShelf.hidden=!1;let D=_e.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=U.engine?.getView();if(!e||!U.variant)return;let t=Bf(),n=e.calculateExtent(U.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===U.overviewKey||(U.overviewKey=l,_e.overviewShelf.hidden=a,a))return;let c=_e.overviewCanvas,u=ls((n[0]-t[0])/r,0,1),f=ls((n[2]-t[0])/r,0,1),d=ls((t[3]-n[3])/s,0,1),A=ls((t[3]-n[1])/s,0,1),y=_e.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 EP(i,e=!0){U.overviewDocked=i,i&&U.overviewPointer!==null&&(U.overviewPointer=null,Mx()),_e.overviewShelf.classList.toggle("is-docked",i),_e.overviewDock.setAttribute("aria-expanded",String(!i));let t=i?"Bring the overview back":"Put the overview away";_e.overviewDock.setAttribute("aria-label",t),_e.overviewDock.title=t,e&&pu()}function lG(i,e){let t=_e.overviewCanvas.getBoundingClientRect(),n=Bf(),r=(a,l,c)=>ls((a-l)/(c-l),0,1);if(U.globeActive){let a=oh(U.map);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);Tle(u,f,e);return}let s=U.engine?.getView();if(!s||!U.variant)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 dc(i){return new K$({updateWhileAnimating:!0,...i})}function Fle(){let i=U.game.tileGrid.size,e=[0,-i,i,0];U.projection=new _p({code:"ATLAS:PIXELS",units:"pixels",extent:e}),U.sources={grid:new hd({wrapX:!1}),gridContext:new hd({wrapX:!1}),zoneScrim:new hd({wrapX:!1}),zones:new hd({wrapX:!1}),zoneTitles:new hd({wrapX:!1}),text:new hd({wrapX:!1}),pins:new hd({wrapX:!1}),priority:new hd({wrapX:!1})},U.layers={raster:new i6({zIndex:0}),rasterDetail:new i6({zIndex:1}),grid:dc({source:U.sources.grid,style:zN,renderOrder:Ic,renderBuffer:40,zIndex:5}),zoneScrim:dc({source:U.sources.zoneScrim,style:lX,zIndex:6}),zones:dc({source:U.sources.zones,style:cX,renderBuffer:32,zIndex:10}),zoneTitles:dc({source:U.sources.zoneTitles,style:uX,renderOrder:Ic,renderBuffer:160,zIndex:20}),zoneTitleDetail:dc({source:U.sources.zoneTitles,style:hX,renderOrder:Ic,renderBuffer:160,zIndex:44}),text:dc({source:U.sources.text,style:nX,renderOrder:Ic,renderBuffer:220,zIndex:30}),textDetail:dc({source:U.sources.text,style:iX,renderOrder:Ic,renderBuffer:220,zIndex:45}),zoneText:dc({source:U.sources.text,style:rX,renderOrder:Ic,renderBuffer:220,zIndex:41}),pins:dc({source:U.sources.pins,style:Jj,renderOrder:Ic,renderBuffer:48,zIndex:40}),zonePins:dc({source:U.sources.pins,style:eX,renderOrder:Ic,renderBuffer:48,zIndex:42}),pinLabels:dc({source:U.sources.pins,style:tX,renderOrder:Ic,renderBuffer:180,zIndex:45}),gridContext:dc({source:U.sources.gridContext,style:zN,renderOrder:Ic,renderBuffer:40,zIndex:48}),priority:dc({source:U.sources.priority,style:sX,renderOrder:Ic,renderBuffer:220,zIndex:50})},U.engine=new w$({target:_e.viewport,layers:Object.values(U.layers),controls:DE({attribution:!1,rotate:!1,zoom:!1}),interactions:kE({onFocusOnly:!1}),view:RP(5)}),U.engine.on("movestart",()=>{U.engine.getViewport().classList.add("is-dragging")}),U.engine.on("moveend",()=>{U.engine.getViewport().classList.remove("is-dragging"),U.overviewPointer===null&&Mx()}),U.engine.on("postrender",Ex),_e.viewport.addEventListener("wheel",()=>{document.activeElement!==_e.viewport&&_e.viewport.focus({preventScroll:!0})},{capture:!0,passive:!0}),U.engine.on("singleclick",t=>{if(U.gridEnabled){let r=U.engine.forEachFeatureAtPixel(t.pixel,s=>{let o=s.get("gridCell");return o&&o.role!=="leaf"&&o.role!=="scope"?o:null},{hitTolerance:1,layerFilter:s=>s===U.layers.grid||s===U.layers.gridContext});if(r){oA(r.hash);return}}let n=U.engine.forEachFeatureAtPixel(t.pixel,(r,s)=>CP(s)&&r.get("pin")||null,{hitTolerance:5,layerFilter:CP});n&&_y(n)}),U.engine.on("pointermove",t=>{if(t.dragging){iv(null);return}let n=U.engine.forEachFeatureAtPixel(t.pixel,(o,a)=>CP(a)&&o.get("pin")||null,{hitTolerance:4,layerFilter:CP}),r=n&&sh(n.category)==="text"?null:n;iv(r||null);let s=U.gridEnabled&&U.engine.hasFeatureAtPixel(t.pixel,{layerFilter:o=>o===U.layers.grid||o===U.layers.gridContext});U.engine.getTargetElement().style.cursor=n||s?"pointer":""}),U.engine.getViewport().addEventListener("pointerleave",()=>iv(null))}function CP(i){return i===U.layers.pins||i===U.layers.zonePins||i===U.layers.pinLabels||i===U.layers.priority||i===U.layers.text||i===U.layers.textDetail||i===U.layers.zoneText}function RP(i,e=null){let t=U.game.tileGrid.size,n=e||[0,-t,t,0];return new Gl({projection:U.projection,center:[(n[0]+n[2])/2,(n[1]+n[3])/2],resolutions:cG(i),minZoom:0,maxZoom:i,extent:n,constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function cG(i){let e=U.game.tileGrid.size/U.game.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function id(i,e){U.game=U.catalog.games.find(r=>r.slug===i)||U.catalog.games[0],U.engine||Fle(),!e&&!U.restore&&(U.restore=Y1(U.game.slug)),_e.game.value=U.game.slug,Um(_e.map,U.game.maps,"title"),_e.map.disabled=U.game.maps.length===1,_e.map.title=_e.map.disabled?"This game has one map":"Choose a map";let t=U.restore?.game===U.game.slug?U.restore:null,n=e&&U.game.maps.find(r=>r.slug===e)||t&&U.game.maps.find(r=>r.slug===t.map);await uG((n||U.game.maps[0]).slug)}async function uG(i){let e=U.game.maps.find(s=>s.slug===i)||U.game.maps[0],t=++U.mapRun;_e.loading.hidden=!1;let n;try{n=await EX(e)}catch{U.mapRun===t&&(_e.loading.hidden=!0,hA());return}if(U.mapRun!==t)return;U.settling=!0,U.map=n,document.documentElement.style.setProperty("--icon-outset-color",rA()),_e.map.value=U.map.slug,Um(_e.variant,U.map.variants,"name"),_e.variantField.hidden=U.map.variants.length<2,U.styleCache.clear(),iv(null),U.gridCell="",U.gridSystem="geohash",U.hiddenCategories.clear(),U.collapsedSections.clear(),U.collapsedSections.add("zones");for(let s of U.map.groups)for(let o of s.categories)o.visible||U.hiddenCategories.add(o.id);let r=U.restore?.map===U.map.slug?U.restore:null;r&&(U.hiddenCategories=new Set(r.hidden),U.collapsedSections=new Set(r.collapsed)),EP(!!U.restore?.overviewDocked,!1),lE(U.restore?!!U.restore.dockFolded:!0,!1),U.dockDismissed=!!U.restore?.dockDismissed,U.search="",_e.search.value="",_e.dock.hidden=!1,vu(),bX(),GN(),xX(),hG(r?ls(r.variant,0,U.map.variants.length-1):0,!0),ble(),U.restore=null,_e.sidebar.classList.remove("is-open"),_e.mobileLegend.setAttribute("aria-expanded","false"),lj(),U.settling=!1,pu()}function hG(i,e=!1){let t=U.variant;U.variant=U.map.variants[i]||U.map.variants[0];let n=U.variant,r=e?null:_6e(t,n),s=dh(n);if(_e.variant.value=String(U.map.variants.indexOf(U.variant)),e)U.engine.setView(RP(s,Bf()));else{let w=U.engine.getView(),S=RP(s,Bf());S.setCenter(w.getCenter()),S.setZoom(w.getZoom()||0),U.engine.setView(S)}let o=++U.tileRun,a=0;U.tileStats={requested:0,loaded:0,errors:0,peakPending:0},_e.loading.hidden=!1;let l=w=>{w.on("tileloadstart",()=>{U.tileRun===o&&(a++,U.tileStats.requested++,U.tileStats.peakPending=Math.max(U.tileStats.peakPending,a))});let S=T=>{U.tileRun===o&&(a=Math.max(0,a-1),T?U.tileStats.errors++:U.tileStats.loaded++,a===0&&U.tileStats.loaded>0&&(_e.loading.hidden=!0))};return w.on("tileloadend",()=>S(!1)),w.on("tileloaderror",()=>S(!0)),w},c=(w,S)=>l(new oj({projection:U.projection,tileGrid:new Ay({extent:[0,-U.game.tileGrid.size,U.game.tileGrid.size,0],origin:[0,0],resolutions:cG(w),tileSize:U.game.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`${U.game.base}/tiles/${encodeURIComponent(n.tiles)}/${T}/${R}/${P}.${I}`}})),u=n.fullZoom??n.maxZoom,f=c(u,(w,S,T)=>MP(n,w,S,T)),d=U.layers.raster.getSource();U.layers.raster.setSource(f),U.layers.raster.setExtent(Bf()),U.layers.raster.setBackground(n.background||void 0),d?.clear();let A=U.layers.rasterDetail.getSource();n.maxZoom>u?(U.layers.rasterDetail.setSource(c(n.maxZoom,(w,S,T)=>w>u&&MP(n,w,S,T))),U.layers.rasterDetail.setExtent(Bf()),U.layers.rasterDetail.setVisible(!0)):U.layers.rasterDetail.setVisible(!1),A?.clear(),Ey(),U.gridEnabled&&(_u(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()),U.overviewKey="",Nle();let y=e&&U.restore?.map===U.map.slug?U.restore:null;if(U.renderedShard!==(n.shard||0)&&(GN(),Cc()),y?.center&&Number.isFinite(y.zoom)){let w=U.engine.getView();w.setCenter(y.center),w.setZoom(y.zoom),U.fitZoom=y.zoom,uA()}else e?requestAnimationFrame(x6e):(r&&U.engine.getView().animate({center:r,duration:200}),uA());pu()}function MP(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=v6e(i,e,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function v6e(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 dh(i){return i.maxZoom+2}function Mx(){uA(),pu()}function _6e(i,e){if(!i||!e||!i.shard||!e.shard||i.shard===e.shard||!i.bounds||!e.bounds)return null;let n=U.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+ls(r,0,1)*e.bounds.width,-(e.bounds.y+ls(s,0,1)*e.bounds.height)]}function Ble(){let e=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");_e.mobileLegend.setAttribute("aria-expanded",String(!e)),requestAnimationFrame(()=>U.engine?.updateSize())}function Bf(){let i=U.game.tileGrid.size,e=U.variant?.bounds||{x:0,y:0,width:i,height:i};return[e.x,-(e.y+e.height),e.x+e.width,-e.y]}function x6e(){if(!U.engine||!U.variant)return;let i=U.engine.getView();i.fit(Bf(),{size:U.engine.getSize(),padding:[36,36,36,36],maxZoom:U.variant.maxZoom,duration:0}),U.fitZoom=i.getZoom()||0,uA()}function US(i){let e=U.engine.getView(),t=e.getZoom()||0;e.animate({zoom:ls(t+i,U.variant.minZoom,dh(U.variant)),duration:140})}function uA(){let i=U.engine?.getView().getZoom();if(_e.viewport.dataset.zoom=Number.isFinite(i)?i.toFixed(3):"",!U.engine||!U.pins.length){_e.visibleCount.textContent="0 locations visible";return}let e=U.engine.getView().calculateExtent(U.engine.getSize()),t=0;for(let n of U.pins){if(Pc(n))continue;let[r,s]=n.coordinate;r>=e[0]&&r<=e[2]&&s>=e[1]&&s<=e[3]&&t++}_e.visibleCount.textContent=`${gu(U.eligibleLocations)} enabled \xB7 ${gu(t)} in view`}function Ole(){_e.game.addEventListener("change",()=>{id(_e.game.value)}),_e.map.addEventListener("change",()=>{uG(_e.map.value)}),_e.addBundles.addEventListener("click",()=>{$N()}),_e.emptyOpen.addEventListener("click",()=>{$N()}),_e.variant.addEventListener("change",()=>{hG(Number(_e.variant.value)),Dle()}),_e.globeToggle.addEventListener("click",()=>SP()),_e.legend.addEventListener("change",n=>{let r=n.target;if(r.dataset.sectionToggle){SX(r.dataset.sectionToggle);return}if(!r.dataset.category)return;let s=Number(r.dataset.category);r.checked?U.hiddenCategories.delete(s):U.hiddenCategories.add(s),Cc(),Cp()});let i=null,e=()=>{for(let s of _e.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&&_e.layers.contains(r)&&r.classList.add("is-hovered")};_e.layers.addEventListener("pointermove",n=>{i={x:n.clientX,y:n.clientY},e()},{passive:!0}),_e.layers.addEventListener("pointerleave",()=>{i=null,e()}),_e.layers.addEventListener("scroll",e,{passive:!0}),_e.layers.addEventListener("click",n=>{let r=n.target.closest("[data-only-category], [data-only-section]");if(r){n.preventDefault(),n.stopPropagation(),TX(r.dataset.onlyCategory?{category:Number(r.dataset.onlyCategory)}:{section:r.dataset.onlySection});return}let s=n.target.closest("[data-section]");if(!s)return;let o=s.dataset.section;U.collapsedSections.has(o)?U.collapsedSections.delete(o):U.collapsedSections.add(o),IE()}),_e.soloChip.addEventListener("click",()=>Oy(!0)),nn("#expand-all").addEventListener("click",()=>jN(!1)),nn("#collapse-all").addEventListener("click",()=>jN(!0)),nn("#show-all").addEventListener("click",()=>Oy(!0)),nn("#hide-all").addEventListener("click",()=>Oy(!1)),_e.zoneToggle.addEventListener("change",()=>{CE(_e.zoneToggle.checked)}),_e.zoneIndex.addEventListener("click",n=>{let r=n.target.closest("[data-zone]");r&&gX(Number(r.dataset.zone))}),_e.zoneIndex.addEventListener("contextmenu",n=>{let r=n.target.closest("[data-zone]");r&&(n.preventDefault(),vX(Number(r.dataset.zone)))}),_e.search.addEventListener("input",()=>{U.search=_e.search.value.trim().toLocaleLowerCase(),Cc(),U.search&&aE()}),_e.dockFold.addEventListener("click",()=>{JD(!U.dockFolded)}),_e.searchResults.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&eN(s)}),_e.detailLinks.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&eN(s)}),nn("#close-detail").addEventListener("click",vu),nn("#zoom-in").addEventListener("click",()=>U.globeActive?sG(1):US(1)),nn("#zoom-out").addEventListener("click",()=>U.globeActive?sG(-1):US(-1)),_e.gridBack.addEventListener("click",mN),_e.gridSystem.addEventListener("click",AN),_e.gridInput.addEventListener("input",()=>{let n=Ss(),r=n.normalizeInput(_e.gridInput.value);_e.gridInput.value=r,n.parseInput(r)!==null&&oA(r)}),_e.subgridToggle.addEventListener("click",()=>{Ty(!U.subgridVisible),_e.viewport.focus({preventScroll:!0})}),_e.gridInput.addEventListener("keydown",n=>{if(n.key===" "){n.preventDefault(),Ty(!U.subgridVisible);return}if(n.key==="`"){n.preventDefault(),_e.globeToggle.hidden||SP();return}n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),_e.viewport.focus({preventScroll:!0}))}),_e.viewport.addEventListener("keydown",n=>{if(!oE(n.target)){if(n.key==="+"||n.key==="=")US(1);else if(n.key==="-")US(-1);else if(n.key==="Escape")vu();else return;n.preventDefault()}}),window.addEventListener("contextmenu",n=>{oE(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(),AN();return}if(!oE(n.target)){if(n.key==="`"&&!n.metaKey&&!n.ctrlKey&&!n.altKey){_e.globeToggle.hidden||(n.preventDefault(),SP());return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="k"){n.preventDefault(),_e.search.focus(),_e.search.select();return}if((n.metaKey||n.ctrlKey)&&n.altKey&&n.code==="KeyB"){n.preventDefault(),_e.dock.hidden||JD(!U.dockFolded);return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="b"){n.preventDefault(),Ble();return}Pj(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),n.repeat||RE(!0))}}),window.addEventListener("keyup",n=>{n.key.toLocaleLowerCase()==="z"&&RE(!1)}),window.addEventListener("blur",()=>RE(!1)),window.addEventListener("hashchange",()=>{let n=Z1();n.game===U.game?.slug&&n.map===U.map?.slug||(U.restore=null,id(n.game||U.catalog.games[0].slug,n.map))}),window.addEventListener("resize",()=>{U.engine?.updateSize(),Ex(),aG()}),document.addEventListener("atlas:globe-camera",()=>Ex()),_e.overview.addEventListener("pointerdown",n=>{U.overviewDocked||n.pointerType==="mouse"&&n.button!==0||(n.preventDefault(),_e.overview.setPointerCapture(n.pointerId),U.overviewPointer=n.pointerId,lG(n,!0))}),_e.overview.addEventListener("pointermove",n=>{U.overviewPointer===n.pointerId&&(n.preventDefault(),lG(n,!1))});let t=n=>{U.overviewPointer===n.pointerId&&(U.overviewPointer=null,Mx())};_e.overview.addEventListener("pointerup",t),_e.overview.addEventListener("pointercancel",t),_e.overviewDock.addEventListener("click",()=>{EP(!U.overviewDocked),_e.viewport.focus({preventScroll:!0})}),_e.mobileLegend.addEventListener("click",()=>{let n=_e.sidebar.classList.toggle("is-open");_e.mobileLegend.setAttribute("aria-expanded",String(n))})}function Ule(){let i=()=>({game:U.game?.title,map:U.map?.title,variant:U.variant?.name,zoom:U.engine?.getView().getZoom(),center:U.engine?.getView().getCenter(),resolution:U.engine?.getView().getResolution(),nativeMaxZoom:U.variant?.maxZoom,maxZoom:U.variant?dh(U.variant):null,interpolate:U.variant?.interpolate,tileStats:{...U.tileStats},pins:U.pins.length,eligibleLocations:U.eligibleLocations,domNodes:document.querySelectorAll("*").length,canvases:document.querySelectorAll("canvas").length,rasterCacheSize:64,labelsHeld:U.labelsHeld,hoveredPin:U.hoveredPin?.location.title||null,selectedPin:U.selectedPin?.location.title||null,fitZoom:U.fitZoom,filters:{hiddenCategories:[...U.hiddenCategories].sort(),collapsedSections:[...U.collapsedSections].sort()},ui:{sidebarCollapsed:document.querySelector(".app-shell")?.classList.contains("sidebar-collapsed")??!1,detailOpen:!_e.detail.hidden,detailTitle:_e.detail.hidden?null:_e.detailTitle.textContent||null,searchQuery:U.search,searchResultsVisible:!_e.searchResults.hidden,soloChip:_e.soloChip.hidden?null:_e.soloChip.textContent,visibleCountText:_e.visibleCount.textContent,overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed,subgridVisible:U.subgridVisible},zones:{visible:U.zonesVisible,count:U.zoneRecords.size,focused:U.zoneRecords.get(U.focusedZoneID)?.zone.title||null,highlighted:[...U.highlightedZones].map(e=>U.zoneRecords.get(e)?.zone.title).filter(Boolean),focusedPins:U.pins.filter(e=>!e.filteredHidden&&e.insideHighlightedZone).length},grid:{enabled:U.gridEnabled,system:U.gridSystem,prefix:U.gridCell,maximumDepth:Nj(),extent:U.gridEnabled?gN():null,cells:[...U.sources.grid.getFeatures(),...U.sources.gridContext.getFeatures()].map(e=>e.get("gridCell")),priorityPins:U.gridCell?U.pins.filter(e=>!e.filteredHidden&&Ip(e)).length:0}});window.__atlasDebug={snapshot:i,setLayerVisible:(e,t)=>U.layers[e]?.setVisible(t),refreshCatalog:hA},window.render_game_to_text=()=>JSON.stringify({coordinateSystem:"ATLAS:PIXELS; origin top-left; x increases right; y decreases downward",...i()}),window.advanceTime=()=>U.engine?.renderSync()}async function kle(){Ole();try{let i=await fetch("/data/catalog.json");if(!i.ok)throw new Error(`catalog request returned ${i.status}`);if(U.catalog=await i.json(),Um(_e.game,U.catalog.games,"title"),XN(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{hA()}),U.catalog.games.length){let e=Z1(),t=Y1(),n=t&&(!e.game||e.game===t.game&&e.map===t.map);U.restore=n?t:null,await id(e.game||t?.game||U.catalog.games[0].slug,e.map||t?.map),U.restore=null}else _e.loading.hidden=!0;Ule(),requestAnimationFrame(()=>_e.viewport.focus({preventScroll:!0}))}catch(i){_e.loading.hidden=!0,_e.fatalMessage.textContent=i instanceof Error?i.message:String(i),_e.fatal.hidden=!1}}kle();})();5289+}`;U5e(k5e);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 z5e(i){if(Array.isArray(i))return eG(i)}function NS(i,e,t){return(e=j5e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function V5e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function G5e(){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 dle(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 c1(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?dle(Object(t),!0).forEach(function(n){NS(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):dle(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function q5e(i,e){if(i==null)return{};var t,n,r=H5e(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 H5e(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 vP(i){return z5e(i)||V5e(i)||X5e(i)||G5e()}function W5e(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 j5e(i){var e=W5e(i,"string");return typeof e=="symbol"?e:e+""}function X5e(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}}function ple(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 $5e=["rendererConfig","waitForGlobeReady"],DS=c1(c1({},window.THREE?window.THREE:{AmbientLight:qA,DirectionalLight:GA,Vector2:Oe,REVISION:"185"}),{},{CSS2DRenderer:LM}),mle=ple("globe",yV),Y5e=Object.assign.apply(Object,vP(["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 NS({},i,mle.linkProp(i))}))),Z5e=Object.assign.apply(Object,vP(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return NS({},i,mle.linkMethod(i))}))),Ale=ple("renderObjs",JV),K5e=Object.assign.apply(Object,vP(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return NS({},i,Ale.linkProp(i))}))),Q5e=Object.assign.apply(Object,vP(["lights","postProcessingComposer"].map(function(i){return NS({},i,Ale.linkMethod(i))}))),gle=Zr({props:c1(c1({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}))}}},Y5e),K5e),methods:c1(c1({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 co(r).to(o,n).easing(Kr.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()}},Z5e),Q5e),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=q5e(e,$5e),o=new yV(c1({waitForGlobeReady:r},s));return{globe:o,renderObjs:JV({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new DS.CSS2DRenderer]}).skyRadius(o.getGlobeRadius()*500).showNavInfo(!1).objects([o]).lights([new DS.AmbientLight(13421772,Math.PI),new DS.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new og}},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 DS.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}};DS.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 xle=4,wx=100,OS=wx+.2,Jd=8,J5e=96,yle=.045,ble=.08;function Sx(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,xP="",Ds={group:null,tiles:new Map,key:"",variant:""},Eo={group:null,cell:null,fitKey:""},tu={group:null,key:""},e6e=180,nG=null,Tx=new Map,wP=new Map,vle=new Map;function wle(){let i=bT(U.map)==="sphere"&&oh(U.map)!==null;_e.globeToggle.hidden=!i,Sle(),!i&&Yn&&(FS(),Ds.group=null,Eo.group=null,Eo.cell=null,tu.group=null,tu.key="",Yn._destructor(),Yn=null,xP="",nG=null,_e.globe.replaceChildren())}function SP(){U.globeActive?Sle():Mle()}var BS=2.5,yP=2,Ex=.08,TP=4;function t6e(i){let e=Number.isFinite(i)?i:yP;return ls(BS/2**(e-yP),Ex,TP)}function rG(i){let e=Number.isFinite(i)?Math.max(i,Ex/2):BS,t=(U.variant?.maxZoom??yP)+2;return ls(yP+Math.log2(BS/e),0,t)}function sG(i){if(!Yn||!U.globeActive)return;let e=Yn.pointOfView(),t=ls((Number.isFinite(e.altitude)?e.altitude:BS)/2**i,Ex,TP);Yn.pointOfView({altitude:t},180)}function Sle(){let i=oh(U.map),e=U.engine?.getView();if(Yn&&U.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(rG(t.altitude)))}U.globeActive=!1,_e.globe.hidden=!0,_e.globeToggle.setAttribute("aria-pressed","false"),_e.viewport.hidden=!1,FS(),U.overviewKey="",document.dispatchEvent(new Event("atlas:globe-camera"))}function Tle(){if(!Yn||!U.globeActive)return null;let i=Yn.pointOfView();return{lat:i.lat,lng:i.lng}}function Ele(i,e,t){if(!Yn)return;let n=Yn.pointOfView().altitude;Yn.pointOfView({lat:i,lng:e,altitude:n},t?180:0)}async function Mle(){let i=oh(U.map);if(!i)return;if(U.globeActive=!0,_e.viewport.hidden=!0,_e.globe.hidden=!1,_e.globeToggle.setAttribute("aria-pressed","true"),U.overviewKey="",!Yn){Yn=gle({animateIn:!1})(_e.globe).backgroundColor("#0b0e12").showAtmosphere(!0).atmosphereColor("#8a6f5b").atmosphereAltitude(.12).objectLat(o=>o.lat).objectLng(o=>o.lng).objectAltitude(o=>o.pin===U.selectedPin?.03:.014).objectThreeObject(o=>d6e(o.pin)).objectLabel(o=>o.pin.location.title).onObjectClick(o=>xy(o.pin)).onObjectHover(o=>{_e.globe.style.cursor=o?"pointer":""}).onZoom(()=>{document.dispatchEvent(new Event("atlas:globe-camera")),_le(),_P(),p6e(),aG()}),document.addEventListener("atlas:selection",f6e),document.addEventListener("atlas:filters",tG),document.addEventListener("atlas:grid",()=>{bP(),tG(),_P()}),document.addEventListener("atlas:labels",_P),Yn.onGlobeClick(({lat:o,lng:a})=>{if(!U.gridEnabled)return;let l=oh(U.map);if(!l)return;let[c,u]=l.toWorld(o,a),f=Ss().descendTarget(U.gridCell,[c,-u]);f&&oA(f)});let s=Yn.controls();s.minDistance=wx*(1+Ex),s.maxDistance=wx*(1+TP),Ds.group=new Fr,Yn.scene().add(Ds.group),Eo.group=new Fr,Yn.scene().add(Eo.group),tu.group=new Fr,Yn.scene().add(tu.group),window.__atlasGlobe={detail:Ds,grid:Eo,labels:tu,sprites:Tx}}lG();let e=U.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:t6e(e.getZoom())})}else Yn.pointOfView({lat:10,lng:0,altitude:BS});let n=U.variant||U.map.variants[0],r=`${U.game.stamp}:${U.map.slug}:${n.tiles}`;if(xP!==r){xP=r;let s=await A6e(n);s&&xP===r&&Yn.globeImageUrl(s)}nG!==U.pins&&(nG=U.pins,Tx.clear(),wP.clear(),Yn.objectsData(m6e(i))),tG(),Ple(),_le(),bP(),_P(),document.dispatchEvent(new Event("atlas:globe-camera"))}function bP(){if(!Yn||!Eo.group)return;for(let t of[...Eo.group.children])Eo.group.remove(t),t.geometry?.dispose(),t.material?.map?.dispose(),t.material?.dispose();let i=U.globeActive?oh(U.map):null;if(!i||!U.gridEnabled){Eo.cell=null;return}let e=Ss();for(let t of AE()){let n=Cle(t.ring,i),r=oG(n),s=mE(t,{subgridVisible:U.subgridVisible,labelled:r6e(t,r)});if(s){if(s.fill){let o=Rle(e.center(t.hash),i);Eo.group.add(s6e(n,o,s.fill))}Eo.group.add(l6e(n,s.line)),s.label&&Eo.group.add(c6e(s.label,r))}}Eo.cell!==null&&Eo.cell!==U.gridCell&&u6e(i),Eo.cell=U.gridCell,aG()}function Cle(i,e){return i.map(([t,n])=>e.toLatLng(t,-n))}function Rle(i,e){return e.toLatLng(i[0],-i[1])}function n6e(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=ls(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 oG(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 i6e(i){let e=Yn.pointOfView(),t=Math.max(e.altitude,Ex/2),n=50*Math.PI/180,r=2*t*wx*Math.tan(n/2)/Math.max(1,_e.globe.clientHeight||1),s=wx*Math.PI/180/r;return{width:Math.abs(i.east-i.west)*s,height:Math.abs(i.north-i.south)*s}}function r6e(i,e){let n=i.role==="neighbor"?Vi.neighborLabelSizePx:Vi.labelSizePx,r=`900 ${n}px ${Vi.labelFont}`,s=i6e(e);return VN(i.hash,r)+9<=s.width&&n+6<=s.height}function s6e(i,e,t){let n=OS+.12,r=n6e(i),s=oG(i),o=Math.max(s.east-s.west,s.north-s.south),a=ls(Math.ceil(o/6),2,24),l=Sx(e[0],e[1],n),c=r.map(([T,R])=>Sx(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 hs({color:t.color,transparent:!0,opacity:t.opacity,depthWrite:!1,side:2}),S=new Hn(y,w);return S.renderOrder=1,S}function _P(){if(!Yn||!tu.group)return;let i=U.globeActive&&U.labelsHeld,e=i?Yn.pointOfView():null,t=i?`${Math.round(e.lat)}:${Math.round(e.lng)}:${e.altitude.toFixed(2)}:${U.gridSystem}:${U.gridCell}`:"";if(t===tu.key)return;tu.key=t;for(let r of[...tu.group.children])tu.group.remove(r),r.material?.map?.dispose(),r.material?.dispose();if(!i)return;let n=[];for(let[r,s]of Tx){if(!s.visible)continue;let o=wP.get(r);if(!o)continue;let a=o6e(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,e6e))tu.group.add(a6e(r,s));aG()}function aG(){if(!Yn)return;let i=Yn.camera().position,e=i.length()||1,t=wx/e;for(let n of[Eo.group,tu.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 o6e(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(ls(n,-1,1))*180/Math.PI}function a6e(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 Ch({depthTest:!1,depthWrite:!1,sizeAttenuation:!1,transparent:!0});new _l().load(n.toDataURL("image/png"),u=>{a.map=u,a.needsUpdate=!0});let l=new DA(a);l.position.set(...Sx(e.lat,e.lng,OS+.4)),l.renderOrder=4;let c=.028;return l.scale.set(c*o/40,c,1),l.center.set(.5,0),l}function l6e(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=ls(Math.ceil(f/2),4,48);for(let A=0;A<d;A++){let y=A/d;t.push(...Sx(a+(c-a)*y,l+(u-l)*y,OS+.25))}}t.push(...t.slice(0,3));let n=new xm;n.setPositions(t);let r=new Cf({color:e.color,transparent:!0,opacity:e.opacity,linewidth:e.widthPx,depthWrite:!1});r.resolution.set(_e.globe.clientWidth||1,_e.globe.clientHeight||1);let s=new mx(n,r);return s.computeLineDistances(),s.renderOrder=2,s}function c6e(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 Ch({depthTest:!1,depthWrite:!1,transparent:!0,sizeAttenuation:!1});new _l().load(o.toDataURL("image/png"),R=>{d.map=R,d.needsUpdate=!0});let A=new DA(d),y=Math.abs(e.north-e.south)*.02,w=Math.abs(e.east-e.west)*.02;A.position.set(...Sx(e.south+y,e.east-w,OS+.35));let S=Math.max(1,_e.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 u6e(i){let t=AE().find(l=>l.role==="scope"||l.role==="leaf");if(!t)return;let[n,r]=Rle(Ss().center(t.hash),i),s=oG(Cle(t.ring,i)),o=Math.max(s.east-s.west,s.north-s.south),a=ls(o/45,Ex,TP);Yn.pointOfView({lat:n,lng:r,altitude:a},400)}function _le(){if(!Yn||!Ds.group)return;let i=U.globeActive?U.variant||U.map.variants[0]:null;if(!i){FS();return}Ds.variant!==i.tiles&&(FS(),Ds.variant=i.tiles);let e=Yn.pointOfView(),t=Math.min(Math.round(rG(e.altitude))+1,i.maxZoom);if(t<=xle||!i.formats[t]){FS(),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>J5e&&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),Ile(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=h6e(i,A,y,w);Ds.tiles.set(d,S),Ds.group.add(S)}}}function h6e(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<=Jd;w++){let S=o-w/Jd*r;for(let T=0;T<=Jd;T++){let R=s+T/Jd*r;a.push(...Sx(S,R,OS)),l.push(T/Jd,1-w/Jd)}}let u=Jd+1;for(let w=0;w<Jd;w++)for(let S=0;S<Jd;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 hs,A=new Hn(f,d);A.visible=!1;let y=`${U.game.base}/tiles/${i.tiles}/${e}/${t}/${n}.${i.formats[e]}`;return new _l().load(y,w=>{w.colorSpace=Nr,d.map=w,d.needsUpdate=!0,A.visible=!0}),A}function FS(){if(Ds.group){for(let i of Ds.tiles.values())Ds.group.remove(i),Ile(i);Ds.tiles.clear(),Ds.key=""}}function Ile(i){i.geometry.dispose(),i.material.map?.dispose(),i.material.dispose()}function Ple(){if(Yn){for(let[i,e]of Tx){let t=i===U.selectedPin;e.material=Dle(i.category,t);let n=t?ble:yle;e.scale.set(n,n,1)}Yn.objectAltitude(i=>i.pin===U.selectedPin?.03:.014)}}function f6e(){if(!Yn||!U.globeActive)return;Ple();let i=wP.get(U.selectedPin);if(i){let e=Yn.pointOfView().altitude;Yn.pointOfView({lat:i.lat,lng:i.lng,altitude:e},600)}}function Lle(i){return!(i.filteredHidden||U.hiddenCategories.has(i.category.id)||U.gridEnabled&&U.gridCell&&!Ip(i))}function tG(){if(!(!Yn||!U.globeActive))for(let[i,e]of Tx)e.visible=Lle(i)}function d6e(i){let e=new DA(Dle(i.category,i===U.selectedPin)),t=i===U.selectedPin?ble:yle;return e.scale.set(t,t,1),e.visible=Lle(i),Tx.set(i,e),e}function Dle(i,e){let t=`${By(i)}:${e?"ringed":"plain"}`,n=vle.get(t);if(n)return n;n=new Ch({depthWrite:!1,sizeAttenuation:!1}),vle.set(t,n);let r=U.markerIcons.get(By(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=rA(),l.strokeText(gu(i.title),40,41),l.fillStyle=sA(i),l.fillText(gu(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 _l().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 Nle(){U.globeActive&&Mle()}function lG(){!Yn||_e.globe.hidden||(Yn.width(_e.globe.clientWidth).height(_e.globe.clientHeight),bP())}function p6e(){if(!Yn||!U.globeActive||!U.gridEnabled)return;let i=Yn.pointOfView(),e=`${U.gridSystem}:${U.gridCell}:${Math.round(rG(i.altitude)*2)}`;e!==Eo.fitKey&&(Eo.fitKey=e,bP())}function m6e(i){let e=[];for(let t of U.pins){let[n,r]=nv(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 A6e(i){let e=Math.min(xle,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=`${U.game.base}/tiles/${i.tiles}/${e}/${c}/${l}.${t}`;a.push(g6e(u).then(f=>{f&&o.drawImage(f,c*256,l*256,256,256)}))}return await Promise.all(a),s.toDataURL("image/jpeg",.92)}function g6e(i){return new Promise(e=>{let t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=i})}function Fle(){let i=U.variant,e=_e.overviewCanvas,t=e.getContext("2d"),n=Bf(),r=U.game.tileGrid.size,s=U.game.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=++U.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||!MP(i,l,T,S))continue;let R=new Image;R.onload=()=>{U.overviewRun===u&&t.drawImage(R,T*s-n[0]*c,S*s+n[3]*c,s,s)},R.src=`${U.game.base}/tiles/${encodeURIComponent(i.tiles)}/${l}/${T}/${S}.${f}`}Mx()}function Mx(){let i=Tle();if(i){let w=oh(U.map);if(!w||!U.variant)return;let S=Bf(),[T,R]=w.toWorld(i.lat,i.lng),P=_e.overviewCanvas,I=ls((T-S[0])/(S[2]-S[0]),0,1),F=ls((R+S[3])/(S[3]-S[1]),0,1);U.overviewKey="",_e.overviewShelf.hidden=!1;let D=_e.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=U.engine?.getView();if(!e||!U.variant)return;let t=Bf(),n=e.calculateExtent(U.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===U.overviewKey||(U.overviewKey=l,_e.overviewShelf.hidden=a,a))return;let c=_e.overviewCanvas,u=ls((n[0]-t[0])/r,0,1),f=ls((n[2]-t[0])/r,0,1),d=ls((t[3]-n[3])/s,0,1),A=ls((t[3]-n[1])/s,0,1),y=_e.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 EP(i,e=!0){U.overviewDocked=i,i&&U.overviewPointer!==null&&(U.overviewPointer=null,Cx()),_e.overviewShelf.classList.toggle("is-docked",i),_e.overviewDock.setAttribute("aria-expanded",String(!i));let t=i?"Bring the overview back":"Put the overview away";_e.overviewDock.setAttribute("aria-label",t),_e.overviewDock.title=t,e&&mu()}function cG(i,e){let t=_e.overviewCanvas.getBoundingClientRect(),n=Bf(),r=(a,l,c)=>ls((a-l)/(c-l),0,1);if(U.globeActive){let a=oh(U.map);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);Ele(u,f,e);return}let s=U.engine?.getView();if(!s||!U.variant)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 dc(i){return new Q$({updateWhileAnimating:!0,...i})}function Ble(){let i=U.game.tileGrid.size,e=[0,-i,i,0];U.projection=new _p({code:"ATLAS:PIXELS",units:"pixels",extent:e}),U.sources={grid:new hd({wrapX:!1}),gridContext:new hd({wrapX:!1}),zoneScrim:new hd({wrapX:!1}),zones:new hd({wrapX:!1}),zoneTitles:new hd({wrapX:!1}),text:new hd({wrapX:!1}),pins:new hd({wrapX:!1}),priority:new hd({wrapX:!1})},U.layers={raster:new i6({zIndex:0}),rasterDetail:new i6({zIndex:1}),grid:dc({source:U.sources.grid,style:zN,renderOrder:Ic,renderBuffer:40,zIndex:5}),zoneScrim:dc({source:U.sources.zoneScrim,style:cX,zIndex:6}),zones:dc({source:U.sources.zones,style:uX,renderBuffer:32,zIndex:10}),zoneTitles:dc({source:U.sources.zoneTitles,style:hX,renderOrder:Ic,renderBuffer:160,zIndex:20}),zoneTitleDetail:dc({source:U.sources.zoneTitles,style:fX,renderOrder:Ic,renderBuffer:160,zIndex:44}),text:dc({source:U.sources.text,style:iX,renderOrder:Ic,renderBuffer:220,zIndex:30}),textDetail:dc({source:U.sources.text,style:rX,renderOrder:Ic,renderBuffer:220,zIndex:45}),zoneText:dc({source:U.sources.text,style:sX,renderOrder:Ic,renderBuffer:220,zIndex:41}),pins:dc({source:U.sources.pins,style:eX,renderOrder:Ic,renderBuffer:48,zIndex:40}),zonePins:dc({source:U.sources.pins,style:tX,renderOrder:Ic,renderBuffer:48,zIndex:42}),pinLabels:dc({source:U.sources.pins,style:nX,renderOrder:Ic,renderBuffer:180,zIndex:45}),gridContext:dc({source:U.sources.gridContext,style:zN,renderOrder:Ic,renderBuffer:40,zIndex:48}),priority:dc({source:U.sources.priority,style:oX,renderOrder:Ic,renderBuffer:220,zIndex:50})},U.engine=new S$({target:_e.viewport,layers:Object.values(U.layers),controls:DE({attribution:!1,rotate:!1,zoom:!1}),interactions:kE({onFocusOnly:!1}),view:RP(5)}),U.engine.on("movestart",()=>{U.engine.getViewport().classList.add("is-dragging")}),U.engine.on("moveend",()=>{U.engine.getViewport().classList.remove("is-dragging"),U.overviewPointer===null&&Cx()}),U.engine.on("postrender",Mx),_e.viewport.addEventListener("wheel",()=>{document.activeElement!==_e.viewport&&_e.viewport.focus({preventScroll:!0})},{capture:!0,passive:!0}),U.engine.on("singleclick",t=>{if(U.gridEnabled){let r=U.engine.forEachFeatureAtPixel(t.pixel,s=>{let o=s.get("gridCell");return o&&o.role!=="leaf"&&o.role!=="scope"?o:null},{hitTolerance:1,layerFilter:s=>s===U.layers.grid||s===U.layers.gridContext});if(r){oA(r.hash);return}}let n=U.engine.forEachFeatureAtPixel(t.pixel,(r,s)=>CP(s)&&r.get("pin")||null,{hitTolerance:5,layerFilter:CP});n&&xy(n)}),U.engine.on("pointermove",t=>{if(t.dragging){iv(null);return}let n=U.engine.forEachFeatureAtPixel(t.pixel,(o,a)=>CP(a)&&o.get("pin")||null,{hitTolerance:4,layerFilter:CP}),r=n&&sh(n.category)==="text"?null:n;iv(r||null);let s=U.gridEnabled&&U.engine.hasFeatureAtPixel(t.pixel,{layerFilter:o=>o===U.layers.grid||o===U.layers.gridContext});U.engine.getTargetElement().style.cursor=n||s?"pointer":""}),U.engine.getViewport().addEventListener("pointerleave",()=>iv(null))}function CP(i){return i===U.layers.pins||i===U.layers.zonePins||i===U.layers.pinLabels||i===U.layers.priority||i===U.layers.text||i===U.layers.textDetail||i===U.layers.zoneText}function RP(i,e=null){let t=U.game.tileGrid.size,n=e||[0,-t,t,0];return new Gl({projection:U.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=U.game.tileGrid.size/U.game.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function id(i,e){U.game=U.catalog.games.find(r=>r.slug===i)||U.catalog.games[0],U.engine||Ble(),!e&&!U.restore&&(U.restore=Y1(U.game.slug)),_e.game.value=U.game.slug,Um(_e.map,U.game.maps,"title"),_e.map.disabled=U.game.maps.length===1,_e.map.title=_e.map.disabled?"This game has one map":"Choose a map";let t=U.restore?.game===U.game.slug?U.restore:null,n=e&&U.game.maps.find(r=>r.slug===e)||t&&U.game.maps.find(r=>r.slug===t.map);await hG((n||U.game.maps[0]).slug)}async function hG(i){let e=U.game.maps.find(s=>s.slug===i)||U.game.maps[0],t=++U.mapRun;_e.loading.hidden=!1;let n;try{n=await MX(e)}catch{U.mapRun===t&&(_e.loading.hidden=!0,hA());return}if(U.mapRun!==t)return;U.settling=!0,U.map=n,document.documentElement.style.setProperty("--icon-outset-color",rA()),_e.map.value=U.map.slug,Um(_e.variant,U.map.variants,"name"),_e.variantField.hidden=U.map.variants.length<2,U.styleCache.clear(),iv(null),U.gridCell="",U.gridSystem="geohash",U.hiddenCategories.clear(),U.collapsedSections.clear(),U.collapsedSections.add("zones");for(let s of U.map.groups)for(let o of s.categories)o.visible||U.hiddenCategories.add(o.id);let r=U.restore?.map===U.map.slug?U.restore:null;r&&(U.hiddenCategories=new Set(r.hidden),U.collapsedSections=new Set(r.collapsed)),EP(!!U.restore?.overviewDocked,!1),lE(U.restore?!!U.restore.dockFolded:!0,!1),U.dockDismissed=!!U.restore?.dockDismissed,U.search="",_e.search.value="",_e.dock.hidden=!1,_u(),wX(),GN(),yX(),fG(r?ls(r.variant,0,U.map.variants.length-1):0,!0),wle(),U.restore=null,_e.sidebar.classList.remove("is-open"),_e.mobileLegend.setAttribute("aria-expanded","false"),cj(),U.settling=!1,mu()}function fG(i,e=!1){let t=U.variant;U.variant=U.map.variants[i]||U.map.variants[0];let n=U.variant,r=e?null:x6e(t,n),s=dh(n);if(_e.variant.value=String(U.map.variants.indexOf(U.variant)),e)U.engine.setView(RP(s,Bf()));else{let w=U.engine.getView(),S=RP(s,Bf());S.setCenter(w.getCenter()),S.setZoom(w.getZoom()||0),U.engine.setView(S)}let o=++U.tileRun,a=0;U.tileStats={requested:0,loaded:0,errors:0,peakPending:0},_e.loading.hidden=!1;let l=w=>{w.on("tileloadstart",()=>{U.tileRun===o&&(a++,U.tileStats.requested++,U.tileStats.peakPending=Math.max(U.tileStats.peakPending,a))});let S=T=>{U.tileRun===o&&(a=Math.max(0,a-1),T?U.tileStats.errors++:U.tileStats.loaded++,a===0&&U.tileStats.loaded>0&&(_e.loading.hidden=!0))};return w.on("tileloadend",()=>S(!1)),w.on("tileloaderror",()=>S(!0)),w},c=(w,S)=>l(new aj({projection:U.projection,tileGrid:new gy({extent:[0,-U.game.tileGrid.size,U.game.tileGrid.size,0],origin:[0,0],resolutions:uG(w),tileSize:U.game.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`${U.game.base}/tiles/${encodeURIComponent(n.tiles)}/${T}/${R}/${P}.${I}`}})),u=n.fullZoom??n.maxZoom,f=c(u,(w,S,T)=>MP(n,w,S,T)),d=U.layers.raster.getSource();U.layers.raster.setSource(f),U.layers.raster.setExtent(Bf()),U.layers.raster.setBackground(n.background||void 0),d?.clear();let A=U.layers.rasterDetail.getSource();n.maxZoom>u?(U.layers.rasterDetail.setSource(c(n.maxZoom,(w,S,T)=>w>u&&MP(n,w,S,T))),U.layers.rasterDetail.setExtent(Bf()),U.layers.rasterDetail.setVisible(!0)):U.layers.rasterDetail.setVisible(!1),A?.clear(),My(),U.gridEnabled&&(xu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()),U.overviewKey="",Fle();let y=e&&U.restore?.map===U.map.slug?U.restore:null;if(U.renderedShard!==(n.shard||0)&&(GN(),Cc()),y?.center&&Number.isFinite(y.zoom)){let w=U.engine.getView();w.setCenter(y.center),w.setZoom(y.zoom),U.fitZoom=y.zoom,uA()}else e?requestAnimationFrame(y6e):(r&&U.engine.getView().animate({center:r,duration:200}),uA());mu()}function MP(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=_6e(i,e,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function _6e(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 dh(i){return i.maxZoom+2}function Cx(){uA(),mu()}function x6e(i,e){if(!i||!e||!i.shard||!e.shard||i.shard===e.shard||!i.bounds||!e.bounds)return null;let n=U.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+ls(r,0,1)*e.bounds.width,-(e.bounds.y+ls(s,0,1)*e.bounds.height)]}function Ole(){let e=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");_e.mobileLegend.setAttribute("aria-expanded",String(!e)),requestAnimationFrame(()=>U.engine?.updateSize())}function Bf(){let i=U.game.tileGrid.size,e=U.variant?.bounds||{x:0,y:0,width:i,height:i};return[e.x,-(e.y+e.height),e.x+e.width,-e.y]}function y6e(){if(!U.engine||!U.variant)return;let i=U.engine.getView();i.fit(Bf(),{size:U.engine.getSize(),padding:[36,36,36,36],maxZoom:U.variant.maxZoom,duration:0}),U.fitZoom=i.getZoom()||0,uA()}function US(i){let e=U.engine.getView(),t=e.getZoom()||0;e.animate({zoom:ls(t+i,U.variant.minZoom,dh(U.variant)),duration:140})}function uA(){let i=U.engine?.getView().getZoom();if(_e.viewport.dataset.zoom=Number.isFinite(i)?i.toFixed(3):"",!U.engine||!U.pins.length){_e.visibleCount.textContent="0 locations visible";return}let e=U.engine.getView().calculateExtent(U.engine.getSize()),t=0;for(let n of U.pins){if(Pc(n))continue;let[r,s]=n.coordinate;r>=e[0]&&r<=e[2]&&s>=e[1]&&s<=e[3]&&t++}_e.visibleCount.textContent=`${vu(U.eligibleLocations)} enabled \xB7 ${vu(t)} in view`}function Ule(){_e.game.addEventListener("change",()=>{id(_e.game.value)}),_e.map.addEventListener("change",()=>{hG(_e.map.value)}),_e.addBundles.addEventListener("click",()=>{$N()}),_e.emptyOpen.addEventListener("click",()=>{$N()}),_e.variant.addEventListener("change",()=>{fG(Number(_e.variant.value)),Nle()}),_e.globeToggle.addEventListener("click",()=>SP()),_e.legend.addEventListener("change",n=>{let r=n.target;if(r.dataset.sectionToggle){TX(r.dataset.sectionToggle);return}if(!r.dataset.category)return;let s=Number(r.dataset.category);r.checked?U.hiddenCategories.delete(s):U.hiddenCategories.add(s),Cc(),Cp()});let i=null,e=()=>{for(let s of _e.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&&_e.layers.contains(r)&&r.classList.add("is-hovered")};_e.layers.addEventListener("pointermove",n=>{i={x:n.clientX,y:n.clientY},e()},{passive:!0}),_e.layers.addEventListener("pointerleave",()=>{i=null,e()}),_e.layers.addEventListener("scroll",e,{passive:!0}),_e.layers.addEventListener("click",n=>{let r=n.target.closest("[data-only-category], [data-only-section]");if(r){n.preventDefault(),n.stopPropagation(),EX(r.dataset.onlyCategory?{category:Number(r.dataset.onlyCategory)}:{section:r.dataset.onlySection});return}let s=n.target.closest("[data-section]");if(!s)return;let o=s.dataset.section;U.collapsedSections.has(o)?U.collapsedSections.delete(o):U.collapsedSections.add(o),IE()}),_e.soloChip.addEventListener("click",()=>Uy(!0)),nn("#expand-all").addEventListener("click",()=>jN(!1)),nn("#collapse-all").addEventListener("click",()=>jN(!0)),nn("#show-all").addEventListener("click",()=>Uy(!0)),nn("#hide-all").addEventListener("click",()=>Uy(!1)),_e.zoneToggle.addEventListener("change",()=>{CE(_e.zoneToggle.checked)}),_e.zoneIndex.addEventListener("click",n=>{let r=n.target.closest("[data-zone]");r&&vX(Number(r.dataset.zone))}),_e.zoneIndex.addEventListener("contextmenu",n=>{let r=n.target.closest("[data-zone]");r&&(n.preventDefault(),_X(Number(r.dataset.zone)))}),_e.search.addEventListener("input",()=>{U.search=_e.search.value.trim().toLocaleLowerCase(),Cc(),U.search&&aE()}),_e.dockFold.addEventListener("click",()=>{JD(!U.dockFolded)}),_e.searchResults.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&eN(s)}),_e.detailLinks.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&eN(s)}),nn("#close-detail").addEventListener("click",_u),nn("#zoom-in").addEventListener("click",()=>U.globeActive?sG(1):US(1)),nn("#zoom-out").addEventListener("click",()=>U.globeActive?sG(-1):US(-1)),_e.gridBack.addEventListener("click",mN),_e.gridSystem.addEventListener("click",AN),_e.gridInput.addEventListener("input",()=>{let n=Ss(),r=n.normalizeInput(_e.gridInput.value);_e.gridInput.value=r,n.parseInput(r)!==null&&oA(r)}),_e.subgridToggle.addEventListener("click",()=>{Ey(!U.subgridVisible),_e.viewport.focus({preventScroll:!0})}),_e.gridInput.addEventListener("keydown",n=>{if(n.key===" "){n.preventDefault(),Ey(!U.subgridVisible);return}if(n.key==="`"){n.preventDefault(),_e.globeToggle.hidden||SP();return}n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),_e.viewport.focus({preventScroll:!0}))}),_e.viewport.addEventListener("keydown",n=>{if(!oE(n.target)){if(n.key==="+"||n.key==="=")US(1);else if(n.key==="-")US(-1);else if(n.key==="Escape")_u();else return;n.preventDefault()}}),window.addEventListener("contextmenu",n=>{oE(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(),AN();return}if(!oE(n.target)){if(n.key==="`"&&!n.metaKey&&!n.ctrlKey&&!n.altKey){_e.globeToggle.hidden||(n.preventDefault(),SP());return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="k"){n.preventDefault(),_e.search.focus(),_e.search.select();return}if((n.metaKey||n.ctrlKey)&&n.altKey&&n.code==="KeyB"){n.preventDefault(),_e.dock.hidden||JD(!U.dockFolded);return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="b"){n.preventDefault(),Ole();return}Lj(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),n.repeat||RE(!0))}}),window.addEventListener("keyup",n=>{n.key.toLocaleLowerCase()==="z"&&RE(!1)}),window.addEventListener("blur",()=>RE(!1)),window.addEventListener("hashchange",()=>{let n=Z1();n.game===U.game?.slug&&n.map===U.map?.slug||(U.restore=null,id(n.game||U.catalog.games[0].slug,n.map))}),window.addEventListener("resize",()=>{U.engine?.updateSize(),Mx(),lG()}),document.addEventListener("atlas:globe-camera",()=>Mx()),_e.overview.addEventListener("pointerdown",n=>{U.overviewDocked||n.pointerType==="mouse"&&n.button!==0||(n.preventDefault(),_e.overview.setPointerCapture(n.pointerId),U.overviewPointer=n.pointerId,cG(n,!0))}),_e.overview.addEventListener("pointermove",n=>{U.overviewPointer===n.pointerId&&(n.preventDefault(),cG(n,!1))});let t=n=>{U.overviewPointer===n.pointerId&&(U.overviewPointer=null,Cx())};_e.overview.addEventListener("pointerup",t),_e.overview.addEventListener("pointercancel",t),_e.overviewDock.addEventListener("click",()=>{EP(!U.overviewDocked),_e.viewport.focus({preventScroll:!0})}),_e.mobileLegend.addEventListener("click",()=>{let n=_e.sidebar.classList.toggle("is-open");_e.mobileLegend.setAttribute("aria-expanded",String(n))})}function kle(){let i=()=>({game:U.game?.title,map:U.map?.title,variant:U.variant?.name,zoom:U.engine?.getView().getZoom(),center:U.engine?.getView().getCenter(),resolution:U.engine?.getView().getResolution(),nativeMaxZoom:U.variant?.maxZoom,maxZoom:U.variant?dh(U.variant):null,interpolate:U.variant?.interpolate,tileStats:{...U.tileStats},pins:U.pins.length,eligibleLocations:U.eligibleLocations,domNodes:document.querySelectorAll("*").length,canvases:document.querySelectorAll("canvas").length,rasterCacheSize:64,labelsHeld:U.labelsHeld,hoveredPin:U.hoveredPin?.location.title||null,selectedPin:U.selectedPin?.location.title||null,fitZoom:U.fitZoom,filters:{hiddenCategories:[...U.hiddenCategories].sort(),collapsedSections:[...U.collapsedSections].sort()},ui:{sidebarCollapsed:document.querySelector(".app-shell")?.classList.contains("sidebar-collapsed")??!1,detailOpen:!_e.detail.hidden,detailTitle:_e.detail.hidden?null:_e.detailTitle.textContent||null,searchQuery:U.search,searchResultsVisible:!_e.searchResults.hidden,soloChip:_e.soloChip.hidden?null:_e.soloChip.textContent,visibleCountText:_e.visibleCount.textContent,overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed,subgridVisible:U.subgridVisible},zones:{visible:U.zonesVisible,count:U.zoneRecords.size,focused:U.zoneRecords.get(U.focusedZoneID)?.zone.title||null,highlighted:[...U.highlightedZones].map(e=>U.zoneRecords.get(e)?.zone.title).filter(Boolean),focusedPins:U.pins.filter(e=>!e.filteredHidden&&e.insideHighlightedZone).length},grid:{enabled:U.gridEnabled,system:U.gridSystem,prefix:U.gridCell,maximumDepth:Fj(),extent:U.gridEnabled?gN():null,cells:[...U.sources.grid.getFeatures(),...U.sources.gridContext.getFeatures()].map(e=>e.get("gridCell")),priorityPins:U.gridCell?U.pins.filter(e=>!e.filteredHidden&&Ip(e)).length:0}});window.__atlasDebug={snapshot:i,setLayerVisible:(e,t)=>U.layers[e]?.setVisible(t),refreshCatalog:hA},window.render_game_to_text=()=>JSON.stringify({coordinateSystem:"ATLAS:PIXELS; origin top-left; x increases right; y decreases downward",...i()}),window.advanceTime=()=>U.engine?.renderSync()}async function zle(){Ule();try{let i=await fetch("/data/catalog.json");if(!i.ok)throw new Error(`catalog request returned ${i.status}`);if(U.catalog=await i.json(),Um(_e.game,U.catalog.games,"title"),XN(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{hA()}),U.catalog.games.length){let e=Z1(),t=Y1(),n=t&&(!e.game||e.game===t.game&&e.map===t.map);U.restore=n?t:null,await id(e.game||t?.game||U.catalog.games[0].slug,e.map||t?.map),U.restore=null}else _e.loading.hidden=!0;kle(),requestAnimationFrame(()=>_e.viewport.focus({preventScroll:!0}))}catch(i){_e.loading.hidden=!0,_e.fatalMessage.textContent=i instanceof Error?i.message:String(i),_e.fatal.hidden=!1}}zle();})();@@ -241,6 +241,7 @@ async function enterGlobe() {
241241 updateDetailTiles();242242 rebuildGlobeLabels();243243 regridWhenFitChanges();244+ cullHiddenLabels();244245 });245246 document.addEventListener("atlas:selection", syncSelection);246247 document.addEventListener("atlas:filters", syncFilters);@@ -353,6 +354,9 @@ function rebuildGlobeGrid() {
353354 frameGridCell(mapping);354355 }355356 grid.cell = state.gridCell;357+ // Chips are born visible; a rebuild with the camera already elsewhere358+ // must not leave far-side chips shining through the planet.359+ cullHiddenLabels();356360 }357361 358362 // ringLatLng lands a system's world-pixel ring on the sphere. The ring is@@ -522,6 +526,31 @@ function rebuildGlobeLabels() {
522526 for (const { pin, stood } of nearby.slice(0, labelBudget)) {523527 labels.group.add(labelSprite(pin, stood));524528 }529+ cullHiddenLabels();530+}531+532+// cullHiddenLabels enforces the horizon that the label sprites' materials533+// no longer test for: a card whose anchor has slipped past the planet's534+// silhouette goes invisible instead of shining through it. A point at the535+// limb sits where the cosine of its angle from the camera's axis equals536+// radius over distance; anything beyond that is the far side.537+function cullHiddenLabels() {538+ if (!globe) return;539+ const camera = globe.camera().position;540+ const distance = camera.length() || 1;541+ const horizon = globeRadius / distance;542+ for (const group of [grid.group, labels.group]) {543+ if (!group) continue;544+ for (const child of group.children) {545+ if (!child.isSprite) continue;546+ const anchor = child.position;547+ const reach = anchor.length() || 1;548+ const facing =549+ (anchor.x * camera.x + anchor.y * camera.y + anchor.z * camera.z) /550+ (reach * distance);551+ child.visible = facing > horizon;552+ }553+ }525554 }526555 527556 // angularDistance is the great-circle separation in degrees, which is what@@ -553,6 +582,10 @@ function labelSprite(pin, stood) {
553582 context.fillStyle = "#e6ebf0";554583 context.fillText(title, width / 2, 21);555584 const material = new SpriteMaterial({585+ // No depth test: a screen-sized card anchored on the ground loses its586+ // lower half to the planet's own curve at any glancing angle. The587+ // horizon is enforced by hand in cullHiddenLabels instead.588+ depthTest: false,556589 depthWrite: false,557590 sizeAttenuation: false,558591 transparent: true,@@ -563,6 +596,7 @@ function labelSprite(pin, stood) {
563596 });564597 const sprite = new Sprite(material);565598 sprite.position.set(...surfacePoint(stood.lat, stood.lng, detailRadius + 0.4));599+ sprite.renderOrder = 4;566600 const height = 0.028;567601 sprite.scale.set((height * width) / 40, height, 1);568602 // Anchored at its bottom edge -- the far end of center's 0..1 contract --@@ -645,6 +679,8 @@ function cellChip(label, corners) {
645679 context.globalAlpha = 1;646680 647681 const material = new SpriteMaterial({682+ // Same bargain as the name cards: no depth test, horizon by hand.683+ depthTest: false,648684 depthWrite: false,649685 transparent: true,650686 sizeAttenuation: false,@@ -337,13 +337,16 @@ function gridGeometry(cell) {
337337 const surface = surfaceExtent();338338 let ring = cell.ring;339339 if (cell.pole) {340+ // The whole loop, closing point included: a pole cell's walk ends a341+ // world over from where it began, and the closure is what spans the342+ // last tessellation step. Dropping it left a sliver of ground the343+ // polygon never covered, one step wide, at the walk's own longitude.340344 const poleY = cell.pole === "north" ? surface[3] : surface[1];341- const open = ring.slice(0, -1);342345 ring = [343- ...open,344- [open[open.length - 1][0], poleY],345- [open[0][0], poleY],346- open[0],346+ ...ring,347+ [ring[ring.length - 1][0], poleY],348+ [ring[0][0], poleY],349+ ring[0],347350 ];348351 }349352 const inside = ring.every(([x]) => x >= surface[0] && x <= surface[2]);