selectWorld guards against being overtaken by numbering each run, and the rename left the counter's cradle behind: state still declared mapRun while the guard incremented worldRun, so the first run counted from undefined to NaN, and NaN equals nothing -- not even itself. The world loaded, the guard compared NaN to NaN, and the swap-in returned without a word, spinner standing. The counter is named what the guard reads, the text cache follows the same rename, and the stale-stamp catch now speaks the error it swallows -- a coding fault in the load path was wearing the same silence as a bundle replaced mid-open, which is how this hid.
- commit
- 9ac51c11bf164a1acd2f898d1cc145a1dc38cd38
- parent
- c51defac90b9bf749665def565d3d7eba9091a48
- author
- Dami <dami.etoile@gmail.com>
| M | assets/ | 6 | +++--- |
| M | frontend/ | 9 | +++++---- |
| M | frontend/ | 4 | ++-- |
| M | frontend/ | 5 | ++++- |
| M | frontend/ | 4 | ++-- |
@@ -1,10 +1,10 @@
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={volume:nn("#volume-select"),world:nn("#world-select"),lens:nn("#lens-select"),lensField:nn("#lens-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,volume:null,world:null,lens: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.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={volume:nn("#volume-select"),world:nn("#world-select"),lens:nn("#lens-select"),lensField:nn("#lens-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,volume:null,world:null,lens: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,worldRun:0,textByWorld: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.22 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.world&&(rD={map:U.world,mapping:iD(U.world)}),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.lens?.surface;if(i)return[i.x,-(i.y+i.height),i.x+i.width,-i.y];let e=U.volume?.tileGrid.size??0,t=U.lens?.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(`33 `);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.world||!U.lens||U.settling)return;let i=U.engine?.getView();try{let e=lj();e.last=U.volume.slug,e.volumes[U.volume.slug]={volume:U.volume.slug,world:U.world.slug,lens:U.world.lenses.indexOf(U.lens),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.volumes)return i}catch{}return{last:"",volumes:{}}}function Y1(i){let e=lj(),t=i||e.last,n=t&&e.volumes[t];return n&&n.volume&&n.world?n:null}function Z1(){let[i,e]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(t=>t.trim());return{volume:i,world:e}}function cj(){if(!U.volume||!U.world)return;let i=`#${U.volume.slug}/${U.world.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.world?.iconOutset==="dark"?"dark":"light"]}function Rde(i){let e=U.world?.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.volume.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,`44 55 `).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.world)){if(r.slug==="geohash")continue;let s=r.locate(i.coordinate,U.world);if(!s)continue;let o=document.createElement("div");o.dataset.cellSystemRow=r.slug;let a=document.createElement("dt");a.textContent=s.label;let l=document.createElement("dd");l.textContent=s.value,o.append(a,l),_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.lens),Math.max(r.getZoom()||0,4)),duration:220})}}function Fde(i){let e=U.world?.merged;if(!e?.length)return"";let t=e.find(n=>n.origin)?.source||"";if(U.pinSourceIndex?.world!==U.world){let n=new Map;for(let r of e){for(let s of r.adopted||[])n.set(s.d,r.source);for(let s of r.matched||[]){let o=`confirmed by ${r.source}`;n.set(s.w,t?`${t} \xB7 ${o}`:o)}}U.pinSourceIndex={world:U.world,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.lens),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.lens){let i=Ss();_e.gridInput.maxLength=i.inputLength(U.world),_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.world),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.world);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.world):"",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.world))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.world)}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(`66 `).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.world?.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.world.zones||[]).filter(WN);U.renderedShard=U.lens?.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.lens),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.volume.tileGrid,e=U.world?.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.world.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.lens?.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.lens?.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.world.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.world.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.world.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.world){if(_pe(i)){Uy(!0);return}U.hiddenCategories.clear();for(let e of U.world.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.world.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.world){i.hidden=!0;return}let e=null,t=0,n=null,r=0;for(let o of U.world.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.world){for(let i of U.world.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.volume.base}/worlds/${i.slug}.json`),fetch(`${U.volume.base}/worlds/${i.slug}.bin`)]);if(!e.ok||!t.ok)throw new Error(`world ${i.slug} is not served under this catalog any more`);let[n,r]=await Promise.all([e.json(),t.arrayBuffer()]),s=n.groups.flatMap(o=>o.categories);return ype(r,s),{...i,grid:n.grid,lenses:n.lenses,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.volume.base}/${U.world.slug}`;return U.textByMap.has(i)||U.textByMap.set(i,fetch(`${U.volume.base}/worlds/${U.world.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.volume;if(U.catalog=await i.json(),Um(_e.volume,U.catalog.volumes,"title"),XN(),!U.catalog.volumes.length)return;let t=e&&U.catalog.volumes.find(n=>n.slug===e.slug);if(!t){let n=Z1();await id(n.volume||Y1()?.volume||U.catalog.volumes[0].slug,n.volume?n.world: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={volume:t.slug,world:U.world?.slug,lens:U.world?U.world.lenses.indexOf(U.lens):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.world?.slug);return}U.volume=t,_e.volume.value=t.slug}function XN(){let i=!U.catalog?.volumes?.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.volumes.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(`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.world?.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.world.zones||[]).filter(WN);U.renderedShard=U.lens?.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.lens),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.volume.tileGrid,e=U.world?.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.world.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.lens?.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.lens?.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.world.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.world.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.world.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.world){if(_pe(i)){Uy(!0);return}U.hiddenCategories.clear();for(let e of U.world.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.world.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.world){i.hidden=!0;return}let e=null,t=0,n=null,r=0;for(let o of U.world.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.world){for(let i of U.world.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.volume.base}/worlds/${i.slug}.json`),fetch(`${U.volume.base}/worlds/${i.slug}.bin`)]);if(!e.ok||!t.ok)throw new Error(`world ${i.slug} is not served under this catalog any more`);let[n,r]=await Promise.all([e.json(),t.arrayBuffer()]),s=n.groups.flatMap(a=>a.categories);ype(r,s);let o=bX(n.groups);return{...i,grid:n.grid,lenses:n.lenses,groups:n.groups,zones:n.zones||[],attrs:n.attrs||{},merged:n.merged||[],sections:o}}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.volume.base}/${U.world.slug}`;return U.textByWorld.has(i)||U.textByWorld.set(i,fetch(`${U.volume.base}/worlds/${U.world.slug}.text`).then(e=>e.json()).catch(()=>({}))),U.textByWorld.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.volume;if(U.catalog=await i.json(),Um(_e.volume,U.catalog.volumes,"title"),XN(),!U.catalog.volumes.length)return;let t=e&&U.catalog.volumes.find(n=>n.slug===e.slug);if(!t){let n=Z1();await id(n.volume||Y1()?.volume||U.catalog.volumes[0].slug,n.volume?n.world:void 0);return}if(t.stamp!==e.stamp){for(let r of U.textByWorld.keys())r.startsWith(e.base+"/")&&U.textByWorld.delete(r);let n=U.engine?.getView();U.restore={volume:t.slug,world:U.world?.slug,lens:U.world?U.world.lenses.indexOf(U.lens):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.world?.slug);return}U.volume=t,_e.volume.value=t.slug}function XN(){let i=!U.catalog?.volumes?.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.volumes.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(`88 `,""),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(`99 `).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===`1010 `){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() {@@ -5287,4 +5287,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
52875287 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;52895289 }`;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:"",lens:""},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.world)==="sphere"&&oh(U.world)!==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.lens?.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.world),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.world);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.world);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.lens||U.world.lenses[0],r=`${U.volume.stamp}:${U.world.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.world):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.lens||U.world.lenses[0]:null;if(!i){FS();return}Ds.lens!==i.tiles&&(FS(),Ds.lens=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.volume.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.volume.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.lens,e=_e.overviewCanvas,t=e.getContext("2d"),n=Bf(),r=U.volume.tileGrid.size,s=U.volume.tileGrid.tileSize,o=n[2]-n[0],a=n[3]-n[1],l=0;for(;l<i.fullZoom&&Math.max(o,a)/r*s*2**l<168;)l++;let c=s*2**l/r;e.width=Math.max(1,Math.round(o*c)),e.height=Math.max(1,Math.round(a*c)),t.clearRect(0,0,e.width,e.height),i.background&&(t.fillStyle=i.background,t.fillRect(0,0,e.width,e.height));let u=++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.volume.base}/tiles/${encodeURIComponent(i.tiles)}/${l}/${T}/${S}.${f}`}Mx()}function Mx(){let i=Tle();if(i){let w=oh(U.world);if(!w||!U.lens)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.lens)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.world);if(!a)return;let l=n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),c=-n[3]+r(i.clientY,t.top,t.bottom)*(n[3]-n[1]),[u,f]=a.toLatLng(l,c);Ele(u,f,e);return}let s=U.engine?.getView();if(!s||!U.lens)return;let o=[n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),n[3]-r(i.clientY,t.top,t.bottom)*(n[3]-n[1])];if(e){s.animate({center:o,duration:180});return}s.cancelAnimations(),s.setCenter(o)}function dc(i){return new Q$({updateWhileAnimating:!0,...i})}function Ble(){let i=U.volume.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.volume.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.volume.tileGrid.size/U.volume.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function id(i,e){U.volume=U.catalog.volumes.find(r=>r.slug===i)||U.catalog.volumes[0],U.engine||Ble(),!e&&!U.restore&&(U.restore=Y1(U.volume.slug)),_e.volume.value=U.volume.slug,Um(_e.world,U.volume.worlds,"title"),_e.world.disabled=U.volume.worlds.length===1,_e.world.title=_e.world.disabled?"This volume has one world":"Choose a world";let t=U.restore?.volume===U.volume.slug?U.restore:null,n=e&&U.volume.worlds.find(r=>r.slug===e)||t&&U.volume.worlds.find(r=>r.slug===t.world);await hG((n||U.volume.worlds[0]).slug)}async function hG(i){let e=U.volume.worlds.find(s=>s.slug===i)||U.volume.worlds[0],t=++U.worldRun;_e.loading.hidden=!1;let n;try{n=await MX(e)}catch{U.worldRun===t&&(_e.loading.hidden=!0,hA());return}if(U.worldRun!==t)return;U.settling=!0,U.world=n,document.documentElement.style.setProperty("--icon-outset-color",rA()),_e.world.value=U.world.slug,Um(_e.lens,U.world.lenses,"name"),_e.lensField.hidden=U.world.lenses.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.world.groups)for(let o of s.categories)o.visible||U.hiddenCategories.add(o.id);let r=U.restore?.map===U.world.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.lens,0,U.world.lenses.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.lens;U.lens=U.world.lenses[i]||U.world.lenses[0];let n=U.lens,r=e?null:x6e(t,n),s=dh(n);if(_e.lens.value=String(U.world.lenses.indexOf(U.lens)),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.volume.tileGrid.size,U.volume.tileGrid.size,0],origin:[0,0],resolutions:uG(w),tileSize:U.volume.tileGrid.tileSize}),cacheSize:64,interpolate:n.interpolate,transition:0,wrapX:!1,tileUrlFunction:([T,R,P])=>{let I=n.formats[T];if(!(!I||R<0||P<0||!S(T,R,P)))return`${U.volume.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.world.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.volume.tileGrid.size,e=U.lens?.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.lens)return;let i=U.engine.getView();i.fit(Bf(),{size:U.engine.getSize(),padding:[36,36,36,36],maxZoom:U.lens.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.lens.minZoom,dh(U.lens)),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.volume.addEventListener("change",()=>{id(_e.volume.value)}),_e.world.addEventListener("change",()=>{hG(_e.world.value)}),_e.addBundles.addEventListener("click",()=>{$N()}),_e.emptyOpen.addEventListener("click",()=>{$N()}),_e.lens.addEventListener("change",()=>{fG(Number(_e.lens.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.volume===U.volume?.slug&&n.world===U.world?.slug||(U.restore=null,id(n.volume||U.catalog.volumes[0].slug,n.world))}),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=()=>({volume:U.volume?.title,world:U.world?.title,lens:U.lens?.name,zoom:U.engine?.getView().getZoom(),center:U.engine?.getView().getCenter(),resolution:U.engine?.getView().getResolution(),nativeMaxZoom:U.lens?.maxZoom,maxZoom:U.lens?dh(U.lens):null,interpolate:U.lens?.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.volume,U.catalog.volumes,"title"),XN(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{hA()}),U.catalog.volumes.length){let e=Z1(),t=Y1(),n=t&&(!e.volume||e.volume===t.volume&&e.world===t.world);U.restore=n?t:null,await id(e.volume||t?.volume||U.catalog.volumes[0].slug,e.world||t?.world),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();})();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:"",lens:""},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.world)==="sphere"&&oh(U.world)!==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.lens?.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.world),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.world);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.world);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.lens||U.world.lenses[0],r=`${U.volume.stamp}:${U.world.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.world):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.lens||U.world.lenses[0]:null;if(!i){FS();return}Ds.lens!==i.tiles&&(FS(),Ds.lens=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.volume.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.volume.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.lens,e=_e.overviewCanvas,t=e.getContext("2d"),n=Bf(),r=U.volume.tileGrid.size,s=U.volume.tileGrid.tileSize,o=n[2]-n[0],a=n[3]-n[1],l=0;for(;l<i.fullZoom&&Math.max(o,a)/r*s*2**l<168;)l++;let c=s*2**l/r;e.width=Math.max(1,Math.round(o*c)),e.height=Math.max(1,Math.round(a*c)),t.clearRect(0,0,e.width,e.height),i.background&&(t.fillStyle=i.background,t.fillRect(0,0,e.width,e.height));let u=++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.volume.base}/tiles/${encodeURIComponent(i.tiles)}/${l}/${T}/${S}.${f}`}Mx()}function Mx(){let i=Tle();if(i){let w=oh(U.world);if(!w||!U.lens)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.lens)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.world);if(!a)return;let l=n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),c=-n[3]+r(i.clientY,t.top,t.bottom)*(n[3]-n[1]),[u,f]=a.toLatLng(l,c);Ele(u,f,e);return}let s=U.engine?.getView();if(!s||!U.lens)return;let o=[n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),n[3]-r(i.clientY,t.top,t.bottom)*(n[3]-n[1])];if(e){s.animate({center:o,duration:180});return}s.cancelAnimations(),s.setCenter(o)}function dc(i){return new Q$({updateWhileAnimating:!0,...i})}function Ble(){let i=U.volume.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.volume.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.volume.tileGrid.size/U.volume.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function id(i,e){U.volume=U.catalog.volumes.find(r=>r.slug===i)||U.catalog.volumes[0],U.engine||Ble(),!e&&!U.restore&&(U.restore=Y1(U.volume.slug)),_e.volume.value=U.volume.slug,Um(_e.world,U.volume.worlds,"title"),_e.world.disabled=U.volume.worlds.length===1,_e.world.title=_e.world.disabled?"This volume has one world":"Choose a world";let t=U.restore?.volume===U.volume.slug?U.restore:null,n=e&&U.volume.worlds.find(r=>r.slug===e)||t&&U.volume.worlds.find(r=>r.slug===t.world);await hG((n||U.volume.worlds[0]).slug)}async function hG(i){let e=U.volume.worlds.find(s=>s.slug===i)||U.volume.worlds[0],t=++U.worldRun;_e.loading.hidden=!1;let n;try{n=await MX(e)}catch(s){console.error(`world ${e.slug} failed to load`,s),U.worldRun===t&&(_e.loading.hidden=!0,hA());return}if(U.worldRun!==t)return;U.settling=!0,U.world=n,document.documentElement.style.setProperty("--icon-outset-color",rA()),_e.world.value=U.world.slug,Um(_e.lens,U.world.lenses,"name"),_e.lensField.hidden=U.world.lenses.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.world.groups)for(let o of s.categories)o.visible||U.hiddenCategories.add(o.id);let r=U.restore?.map===U.world.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.lens,0,U.world.lenses.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.lens;U.lens=U.world.lenses[i]||U.world.lenses[0];let n=U.lens,r=e?null:x6e(t,n),s=dh(n);if(_e.lens.value=String(U.world.lenses.indexOf(U.lens)),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.volume.tileGrid.size,U.volume.tileGrid.size,0],origin:[0,0],resolutions:uG(w),tileSize:U.volume.tileGrid.tileSize}),cacheSize:64,interpolate:n.interpolate,transition:0,wrapX:!1,tileUrlFunction:([T,R,P])=>{let I=n.formats[T];if(!(!I||R<0||P<0||!S(T,R,P)))return`${U.volume.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.world.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.volume.tileGrid.size,e=U.lens?.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.lens)return;let i=U.engine.getView();i.fit(Bf(),{size:U.engine.getSize(),padding:[36,36,36,36],maxZoom:U.lens.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.lens.minZoom,dh(U.lens)),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.volume.addEventListener("change",()=>{id(_e.volume.value)}),_e.world.addEventListener("change",()=>{hG(_e.world.value)}),_e.addBundles.addEventListener("click",()=>{$N()}),_e.emptyOpen.addEventListener("click",()=>{$N()}),_e.lens.addEventListener("change",()=>{fG(Number(_e.lens.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.volume===U.volume?.slug&&n.world===U.world?.slug||(U.restore=null,id(n.volume||U.catalog.volumes[0].slug,n.world))}),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=()=>({volume:U.volume?.title,world:U.world?.title,lens:U.lens?.name,zoom:U.engine?.getView().getZoom(),center:U.engine?.getView().getCenter(),resolution:U.engine?.getView().getResolution(),nativeMaxZoom:U.lens?.maxZoom,maxZoom:U.lens?dh(U.lens):null,interpolate:U.lens?.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.volume,U.catalog.volumes,"title"),XN(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{hA()}),U.catalog.volumes.length){let e=Z1(),t=Y1(),n=t&&(!e.volume||e.volume===t.volume&&e.world===t.world);U.restore=n?t:null,await id(e.volume||t?.volume||U.catalog.volumes[0].slug,e.world||t?.world),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();})();@@ -21,6 +21,7 @@ export async function loadWorld(entry) {
2121 ]);2222 const categories = detail.groups.flatMap((group) => group.categories);2323 unpackLocations(packed, categories);24+ const sections = legendSections(detail.groups);2425 return {2526 ...entry,2627 grid: detail.grid,@@ -29,7 +30,7 @@ export async function loadWorld(entry) {
2930 zones: detail.zones || [],3031 attrs: detail.attrs || {},3132 merged: detail.merged || [],32- sections: legendSections(detail.groups),33+ sections,3334 };3435 }3536 @@ -74,11 +75,11 @@ export function unpackLocations(buffer, categories) {
7475 // with the words of the build it replaced.7576 export async function worldText() {7677 const key = `${state.volume.base}/${state.world.slug}`;77- if (!state.textByMap.has(key)) {78- state.textByMap.set(78+ if (!state.textByWorld.has(key)) {79+ state.textByWorld.set(7980 key,8081 fetch(`${state.volume.base}/worlds/${state.world.slug}.text`).then((r) => r.json()).catch(() => ({})),8182 );8283 }83- return state.textByMap.get(key);84+ return state.textByWorld.get(key);8485 }@@ -45,8 +45,8 @@ async function reconcile() {
4545 // screen through the new stamped base, carrying the exact arrangement --4646 // camera, filters, panels -- across so the swap reads as the map4747 // sharpening rather than the application starting over.48- for (const key of state.textByMap.keys()) {49- if (key.startsWith(previous.base + "/")) state.textByMap.delete(key);48+ for (const key of state.textByWorld.keys()) {49+ if (key.startsWith(previous.base + "/")) state.textByWorld.delete(key);5050 }5151 const view = state.engine?.getView();5252 state.restore = {@@ -52,9 +52,12 @@ export async function selectWorld(slug) {
5252 let loaded;5353 try {5454 loaded = await loadWorld(entry);55- } catch {55+ } catch (error) {5656 // The bundle moved underneath the catalog: refetching the catalog brings5757 // the new build's URLs, and the refresh re-selects this world through them.58+ // The error is spoken either way -- a coding fault in the load path would59+ // otherwise wear the same silence as a stale stamp, forever.60+ console.error(`world ${entry.slug} failed to load`, error);5861 if (state.worldRun === run) {5962 elements.loading.hidden = true;6063 void refreshCatalog();@@ -45,8 +45,8 @@ export const state = {
4545 // comes out on its own the first time there is something in it to read.4646 dockDismissed: false,4747 renderedShard: 0,48- mapRun: 0,49- textByMap: new Map(),48+ worldRun: 0,49+ textByWorld: new Map(),5050 restore: null,5151 settling: false,5252 styleCache: new Map(),